plugin/planimationLibrary.js
/**
     * Update the planimaiton canvas to display the last action of the plan. 
     * @param  {String} plan a string contains a list of actions.
     * @param  {Boolean} initalStage declare whether to display the inital stage
     * 
     */
Update the planimaiton canvas to display the last action of the plan.
@param  {String} plan a string contains a list of actions.
@param  {Boolean} initalStage declare whether to display the inital stage
Update the planimaiton canvas to display the last action of the plan . @param { String } plan a string contains a list of actions . @param { Boolean } initalStage declare whether to display the inital stage
function updateWithPlan(plan, initalStage) {
        var formData = new FormData();
        formData.append("domain", this.domainPDDL);
        formData.append("problem", this.problemPDDL);
        formData.append("animation", this.animationPDDL);
        formData.append("plan", plan);
        var xhr = new XMLHttpRequest();
        var url = 'https://planimation.planning.domains/upload/pddl';
        xhr.open("Post", url);
        xhr.send(formData);
        xhr.onreadystatechange = function (e) {
            if (xhr.readyState === XMLHttpRequest.DONE) {
                var status = xhr.status;
                if (status === 0 || (status >= 200 && status < 400)) {
                    var vfg = JSON.parse(xhr.responseText);
                    if (!initalStage) {
                        this.currentStage = vfg.visualStages[vfg.visualStages.length - 1].visualSprites;
                    }
                    else {
                        this.currentStage = vfg.visualStages[0].visualSprites;
                    }
                }
            }
        }
    }
function updateWithPlan ( plan , initalStage ) { var formData = new FormData ( ) ; formData . append ( "domain" , this . domainPDDL ) ; formData . append ( "problem" , this . problemPDDL ) ; formData . append ( "animation" , this . animationPDDL ) ; formData . append ( "plan" , plan ) ; var xhr = new XMLHttpRequest ( ) ; var url = 'https://planimation.planning.domains/upload/pddl' ; xhr . open ( "Post" , url ) ; xhr . send ( formData ) ; xhr . onreadystatechange = function ( e ) { if ( xhr . readyState === XMLHttpRequest . DONE ) { var status = xhr . status ; if ( status === 0 || ( status >= 200 && status < 400 ) ) { var vfg = JSON . parse ( xhr . responseText ) ; if ( ! initalStage ) { this . currentStage = vfg . visualStages [ vfg . visualStages . length - 1 ] . visualSprites ; } else { this . currentStage = vfg . visualStages [ 0 ] . visualSprites ; } } } } }
Update the planimaiton canvas to display the last action of the plan.
Update the planimaiton canvas to display the last action of the plan .