diff options
-rw-r--r-- | apps/samples/vrml/viewer.html | 2 | ||||
-rw-r--r-- | apps/samples/vrml/viewer.js | 57 | ||||
-rw-r--r-- | contrib/cmake/FindSWI.cmake | 6 | ||||
-rw-r--r-- | src/uscxml/server/InterpreterServlet.cpp | 1 | ||||
-rw-r--r-- | test/samples/uscxml/test-prolog.scxml | 10 |
5 files changed, 43 insertions, 33 deletions
diff --git a/apps/samples/vrml/viewer.html b/apps/samples/vrml/viewer.html index 53a4446..9838c33 100644 --- a/apps/samples/vrml/viewer.html +++ b/apps/samples/vrml/viewer.html @@ -3,6 +3,8 @@ <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dijit/themes/tundra/tundra.css"> + <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dojox/layout/resources/FloatingPane.css"> + <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dojox/layout/resources/ResizeHandle.css"> <link rel="stylesheet" href="viewer.css"> <style type="text/css"> diff --git a/apps/samples/vrml/viewer.js b/apps/samples/vrml/viewer.js index 209be85..4cc167c 100644 --- a/apps/samples/vrml/viewer.js +++ b/apps/samples/vrml/viewer.js @@ -24,6 +24,7 @@ function VRMLViewer(element, params) { this.pose.autorotate = false; this.serverURL; this.imageURL; + this.resRoot = (params && params.resRoot ? params.resRoot : ""); this.pose.width = this.width; this.pose.height = this.height; @@ -35,7 +36,7 @@ function VRMLViewer(element, params) { if (self.imageURL && !self.batchChanges) { self.imgElem.src = self.imageURL + urlSuffixForPose(self.pose); } - } + }; var urlSuffixForPose = function(pose) { var url = @@ -50,7 +51,7 @@ function VRMLViewer(element, params) { '&zoom=' + pose.zoom + '&autorotate=' + (pose.autorotate ? '1' : '0'); return url; - } + }; var moverRelativeTo = function(mover, container) { var containerPos = absolutePosition(container); @@ -58,13 +59,13 @@ function VRMLViewer(element, params) { x: mover.x - containerPos.x, y: mover.y - containerPos.y }; - } + }; // see http://stackoverflow.com/questions/288699/get-the-position-of-a-div-span-tag var absolutePosition = function(el) { for (var lx=0, ly=0; el != null; lx += el.offsetLeft, ly += el.offsetTop, el = el.offsetParent); return {x: lx,y: ly}; - } + }; this.refreshServer = function(server) { self.serverURL = server; @@ -93,7 +94,7 @@ function VRMLViewer(element, params) { } (result.models, "root", "")); } }); - } + }; this.setPose = function(imageURL, pose, serverURL) { if (serverURL && serverURL != self.serverURL) { @@ -121,7 +122,7 @@ function VRMLViewer(element, params) { self.xyHandlerElem.parentNode.style.top = y + "%"; self.updateScene(); - } + }; require(["dojo/dom-construct", "dojo/_base/xhr", @@ -178,7 +179,7 @@ function VRMLViewer(element, params) { <tr>\ <td valign="top">\ <div style="position: relative; padding: 0px">\ - <img class="model" src="img/Tutorial.png" style="z-index: -1; width: ' + self.pose.width + 'px; height: ' + self.pose.height + 'px"></img>\ + <img class="model" src="' + self.resRoot + 'img/Tutorial.png" style="z-index: -1; width: ' + self.pose.width + 'px; height: ' + self.pose.height + 'px"></img>\ <div style="z-index: 1; position: absolute; right: 45%; top: 45%">\ <div class="progress"></div>\ </div>\ @@ -196,7 +197,7 @@ function VRMLViewer(element, params) { <div class="pitchRollHandler" style="font-size: 0.5em; background-color: rgba(255,255,255,0.5); border-radius: 5px; moz-border-radius: 5px;">\ <table>\ <tr>\ - <td><img class="pitchRollHandlerImg" src="img/pitchRoll.png" width="20px" style="padding: 2px 0px 0px 4px;" /></td>\ + <td><img class="pitchRollHandlerImg" src="' + self.resRoot + 'img/pitchRoll.png" width="20px" style="padding: 2px 0px 0px 4px;" /></td>\ <td><div class="pitchLabel"></div><div class="rollLabel"></div></td>\ </tr>\ </table>\ @@ -206,7 +207,7 @@ function VRMLViewer(element, params) { <div class="yawZoomHandler" style="font-size: 0.5em; background-color: rgba(255,255,255,0.5); border-radius: 5px; moz-border-radius: 5px;">\ <table>\ <tr>\ - <td><img class="yawZoomHandlerImg" src="img/yawZoom.png" width="20px" style="padding: 2px 0px 0px 4px;" /></td>\ + <td><img class="yawZoomHandlerImg" src="' + self.resRoot + 'img/yawZoom.png" width="20px" style="padding: 2px 0px 0px 4px;" /></td>\ <td><div class="yawLabel"></div><div class="zoomLabel"></div></td>\ </tr>\ </table>\ @@ -216,7 +217,7 @@ function VRMLViewer(element, params) { <div class="xyHandler" style="font-size: 0.5em; background-color: rgba(255,255,255,0.5); border-radius: 5px; moz-border-radius: 5px;">\ <table>\ <tr>\ - <td><img class="xyHandlerImg" src="img/xy.png" width="20px" style="padding: 2px 0px 0px 4px;" /></td>\ + <td><img class="xyHandlerImg" src="' + self.resRoot + 'img/xy.png" width="20px" style="padding: 2px 0px 0px 4px;" /></td>\ <td><div class="xLabel"></div><div class="yLabel"></div></td>\ </tr>\ </table>\ @@ -254,7 +255,7 @@ function VRMLViewer(element, params) { rollLabel.innerHTML = ''; self.updateScene(); - } + }; self.pitchRollHandler.onMoving = function(mover) { // mover.node.style.backgroundColor = "rgba(255,255,255,0.5)"; // mover.node.style.borderRadius = "5px"; @@ -275,7 +276,7 @@ function VRMLViewer(element, params) { self.pose.pitch = Math.ceil((self.pose.pitch) * 10) / 10; pitchLabel.innerHTML = 'Pitch:' + self.pose.pitch; rollLabel.innerHTML = 'Roll:' + self.pose.roll; - } + }; self.yawZoomHandler = new Moveable(self.yawZoomHandlerElem); self.yawZoomHandler.onMoveStop = function(mover) { @@ -287,7 +288,7 @@ function VRMLViewer(element, params) { zoomLabel.innerHTML = ''; self.updateScene(); - } + }; self.yawZoomHandler.onMoving = function(mover) { var handlerImg = dojo.query("img.yawZoomHandlerImg", mover.node)[0]; var yawLabel = dojo.query("div.yawLabel", mover.node)[0]; @@ -304,7 +305,7 @@ function VRMLViewer(element, params) { self.pose.yaw = Math.ceil((self.pose.yaw) * 10) / 10; yawLabel.innerHTML = 'Yaw:' + self.pose.yaw; zoomLabel.innerHTML = 'Zoom:' + self.pose.zoom; - } + }; self.xyHandler = new Moveable(self.xyHandlerElem); self.xyHandler.onMoveStop = function(mover) { @@ -316,7 +317,7 @@ function VRMLViewer(element, params) { yLabel.innerHTML = ''; self.updateScene(); - } + }; self.xyHandler.onMoving = function(mover) { var handlerImg = dojo.query("img.xyHandlerImg", mover.node)[0]; var xLabel = dojo.query("div.xLabel", mover.node)[0]; @@ -331,7 +332,7 @@ function VRMLViewer(element, params) { self.pose.x = Math.ceil((self.pose.x) * 10) / 10; xLabel.innerHTML = 'X:' + self.pose.x; yLabel.innerHTML = 'Y:' + self.pose.y; - } + }; self.createAvatar = function(item, mode) { if (mode == 'avatar') { @@ -349,8 +350,7 @@ function VRMLViewer(element, params) { item.pose = avatarPose; return {node: avatar, data: item, type: item.type}; } - console.log(item, mode); - var handler = dojo.create( 'div', { innerHTML: '<img src="img/drag.png" width="20px" />' }); + var handler = dojo.create( 'div', { innerHTML: '<img src="' + self.resRoot + 'img/drag.png" width="20px" />' }); return {node: handler, data: item, type: item.type}; }; @@ -383,7 +383,7 @@ function VRMLViewer(element, params) { } }, getIconClass: function(item, opened) { - return (!item || !('url' in item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "dijitLeaf" + return (!item || !('url' in item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "dijitLeaf"; }, getIconStyle: function(item, opened){ if('url' in item) { @@ -394,6 +394,14 @@ function VRMLViewer(element, params) { }); + if (self.params && self.params.serverURL) + self.serverURL = self.params.serverURL; + var savedServerURL = self.localStorage.get("vrmlServer"); + if (savedServerURL && !self.serverURL) { + self.serverURL = savedServerURL; + self.refreshServer(savedServerURL); + } + self.serverBox = new TextBox({ name: "Server", value: self.serverURL, @@ -447,17 +455,10 @@ function VRMLViewer(element, params) { }, self.resetButtonElem); // do we have parameters for the initial pose? - if(self.params) + if(self.params && self.params.pose) self.setPose(self.params.imageURL, self.params.pose, self.params.serverURL); - var savedServerURL = self.localStorage.get("vrmlServer"); - if (savedServerURL && !self.serverURL) { - self.serverURL = savedServerURL; - self.serverBox.value = savedServerURL; - self.refreshServer(savedServerURL); - } - - }) + }); }); diff --git a/contrib/cmake/FindSWI.cmake b/contrib/cmake/FindSWI.cmake index 976a19a..bd08711 100644 --- a/contrib/cmake/FindSWI.cmake +++ b/contrib/cmake/FindSWI.cmake @@ -75,12 +75,10 @@ FIND_PROGRAM(SWI_BINARY swipl PATHS ${SWI_SEARCH_PATHS} ) -#message("SWI_BINARY: ${SWI_BINARY}") - FIND_LIBRARY(SWI_LIBRARY_RELEASE NAMES libswipl swipl PATH_SUFFIXES - lib/${SWI_PLATFORM_ID} # still in source directory + lib/${SWI_PLATFORM_ID} # still in source directory lib/swipl-${SWI_VERSION}/lib/${SWI_PLATFORM_ID} # after make install PATHS ${SWI_SEARCH_PATHS} ) @@ -93,7 +91,7 @@ FIND_LIBRARY(SWI_LIBRARY_DEBUG PATHS ${SWI_SEARCH_PATHS} ) -if (NOT SWI_LIBRARY_DEBUG)# no explicit debug build, just reuse release +if (NOT SWI_LIBRARY_DEBUG) # no explicit debug build, just reuse release if (UNIX) set(SWI_LIBRARY_DEBUG ${SWI_LIBRARY_RELEASE}) endif() diff --git a/src/uscxml/server/InterpreterServlet.cpp b/src/uscxml/server/InterpreterServlet.cpp index 0386c3b..28b7c1b 100644 --- a/src/uscxml/server/InterpreterServlet.cpp +++ b/src/uscxml/server/InterpreterServlet.cpp @@ -35,6 +35,7 @@ void InterpreterServlet::httpRecvRequest(const HTTPServer::Request& req) { event.name = "http." + event.data.compound["type"].atom; event.origin = toStr((uintptr_t)req.curlReq); + event.initContent(event.data.compound["content"].atom); _interpreter->receive(event); } diff --git a/test/samples/uscxml/test-prolog.scxml b/test/samples/uscxml/test-prolog.scxml index 54734cf..3fe7608 100644 --- a/test/samples/uscxml/test-prolog.scxml +++ b/test/samples/uscxml/test-prolog.scxml @@ -48,9 +48,17 @@ </send> </onentry> <transition - target="end" + target="idle" event="foo" cond="member(element('p',_,_), X), event(data(X))" /> </state> + + <state id="idle"> + <transition event="http.post" target="idle"> + <log expr="listing." /> + <respond status="200" to="event(origin(X))" /> + </transition> + </state> + <state id="end" final="true" /> </scxml> |