summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2014-06-06 20:53:20 (GMT)
committerStefan Radomski <github@mintwerk.de>2014-06-06 20:53:20 (GMT)
commit804d303487fb9df61750518f659f370f10710120 (patch)
treed580e87aeb4ea3553a059478bfc5659eaa5112ee
parentcc3e42ea32085b6929e9be00672b5dac40bd1985 (diff)
parent2c743c252d5f78e822f852f561f9b8d24688191f (diff)
downloaduscxml-804d303487fb9df61750518f659f370f10710120.zip
uscxml-804d303487fb9df61750518f659f370f10710120.tar.gz
uscxml-804d303487fb9df61750518f659f370f10710120.tar.bz2
Merge pull request #38 from sradomski/master
Changed getNames signature from set to list
-rw-r--r--CMakeLists.txt111
-rw-r--r--apps/samples/vrml/viewer-webgl-setpose.js1353
-rw-r--r--apps/samples/vrml/viewer-webgl.js889
-rw-r--r--apps/samples/vrml/viewer.html104
-rw-r--r--apps/uscxml-browser.cpp12
-rw-r--r--src/bindings/swig/java/JavaDataModel.h4
-rw-r--r--src/bindings/swig/java/JavaInvoker.h4
-rw-r--r--src/uscxml/Factory.cpp78
-rw-r--r--src/uscxml/Factory.h10
-rw-r--r--src/uscxml/Interpreter.cpp4
-rw-r--r--src/uscxml/UUID.h3
-rw-r--r--src/uscxml/interpreter/InterpreterDraft6.h2
-rw-r--r--src/uscxml/plugins/datamodel/CMakeLists.txt15
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h6
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h6
-rw-r--r--src/uscxml/plugins/datamodel/null/NULLDataModel.h6
-rw-r--r--src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h6
-rw-r--r--src/uscxml/plugins/datamodel/promela/PromelaDataModel.h6
-rw-r--r--src/uscxml/plugins/datamodel/xpath/XPathDataModel.h6
-rw-r--r--src/uscxml/plugins/element/CMakeLists.txt10
-rw-r--r--src/uscxml/plugins/invoker/CMakeLists.txt51
-rw-r--r--src/uscxml/plugins/invoker/audio/OpenALInvoker.h10
-rw-r--r--src/uscxml/plugins/invoker/expect/ExpectInvoker.h8
-rw-r--r--src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h8
-rw-r--r--src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h10
-rw-r--r--src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h10
-rw-r--r--src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h12
-rw-r--r--src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h8
-rw-r--r--src/uscxml/plugins/invoker/http/HTTPServletInvoker.h8
-rw-r--r--src/uscxml/plugins/invoker/im/IMInvoker.h10
-rw-r--r--src/uscxml/plugins/invoker/imap/IMAPInvoker.h8
-rw-r--r--src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp11
-rw-r--r--src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h8
-rw-r--r--src/uscxml/plugins/invoker/sample/SampleInvoker.h8
-rw-r--r--src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h12
-rw-r--r--src/uscxml/plugins/invoker/smtp/SMTPInvoker.h8
-rw-r--r--src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h8
-rw-r--r--src/uscxml/plugins/invoker/system/SystemInvoker.h8
-rw-r--r--src/uscxml/plugins/invoker/umundo/UmundoInvoker.h10
-rw-r--r--src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.h8
-rw-r--r--src/uscxml/plugins/ioprocessor/CMakeLists.txt17
-rw-r--r--src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp4
-rw-r--r--src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h13
-rw-r--r--src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.h8
-rw-r--r--src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h8
-rw-r--r--src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h8
-rw-r--r--src/uscxml/server/HTTPServer.cpp3
-rw-r--r--src/uscxml/server/InterpreterServlet.h16
-rw-r--r--src/uscxml/transform/ChartToFSM.h8
-rw-r--r--src/uscxml/transform/FSMToPromela.h8
-rw-r--r--src/uscxml/util/Trie.h5
-rw-r--r--test/CMakeLists.txt27
52 files changed, 2235 insertions, 749 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 909b167..88f6874 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -233,6 +233,11 @@ if (CMAKE_CROSSCOMPILING)
OPTION(ENABLE_COTIRE "Enable compile time reduction techniques" OFF)
else()
OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON)
+endif()
+
+if (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
+ OPTION(ENABLE_COTIRE "Enable compile time reduction techniques" OFF)
+else()
OPTION(ENABLE_COTIRE "Enable compile time reduction techniques" ON)
endif()
@@ -240,7 +245,6 @@ if (NOT BUILD_SHARED_LIBS)
add_definitions("-DUSCXML_STATIC")
endif()
-
#
# BUILD_PREFER_PREBUILT_LIBS:
# Do we want to search system paths or contrib/prebuilt first?
@@ -264,6 +268,7 @@ include_directories(${USCXML_PREBUILT_LIBRARY_PATH}/include)
#message(STATUS "Searching for prebuilt libraries in: ${CMAKE_FIND_ROOT_PATH}")
if (WIN32)
+ set(BUILD_SHARED_LIBS OFF)
include_directories(${PROJECT_SOURCE_DIR}/contrib/src/getopt)
include_directories(${PROJECT_SOURCE_DIR}/contrib/src/inttypes)
endif()
@@ -379,20 +384,23 @@ elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
endforeach()
# use static MSVCRT
- # foreach(FLAGS
- # CMAKE_C_FLAGS_DEBUG
- # CMAKE_C_FLAGS_MINSIZEREL
- # CMAKE_C_FLAGS_RELEASE
- # CMAKE_C_FLAGS_RELWITHDEBINFO
- # CMAKE_CXX_FLAGS_DEBUG
- # CMAKE_CXX_FLAGS_MINSIZEREL
- # CMAKE_CXX_FLAGS_RELEASE
- # CMAKE_CXX_FLAGS_RELWITHDEBINFO)
- # if(${FLAGS} MATCHES "/MD")
- # string(REGEX REPLACE "/MD" "/MT" ${FLAGS} "${${FLAGS}}")
- # endif()
- # endforeach()
-
+ # if (NOT BUILD_AS_PLUGINS)
+ # foreach(FLAGS
+ # CMAKE_C_FLAGS
+ # CMAKE_CXX_FLAGS
+ # CMAKE_C_FLAGS_DEBUG
+ # CMAKE_C_FLAGS_MINSIZEREL
+ # CMAKE_C_FLAGS_RELEASE
+ # CMAKE_C_FLAGS_RELWITHDEBINFO
+ # CMAKE_CXX_FLAGS_DEBUG
+ # CMAKE_CXX_FLAGS_MINSIZEREL
+ # CMAKE_CXX_FLAGS_RELEASE
+ # CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+ # if(${FLAGS} MATCHES "/MD")
+ # string(REGEX REPLACE "/MD" "/MT" ${FLAGS} "${${FLAGS}}")
+ # endif()
+ # endforeach()
+ # endif()
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-parentheses-equality")
@@ -494,12 +502,13 @@ endif()
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/bin" )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib" )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib" )
-foreach( OUTPUT_CONFIG ${CMAKE_CONFIGURATION_TYPES} )
- string( TOUPPER ${OUTPUT_CONFIG} OUTPUT_CONFIG )
- set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUT_CONFIG} "${OUTPUT_DIR}/bin" )
- set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUT_CONFIG} "${OUTPUT_DIR}/lib" )
- set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUT_CONFIG} "${OUTPUT_DIR}/lib" )
-endforeach()
+# do not override configuration specific outputs
+# foreach( OUTPUT_CONFIG ${CMAKE_CONFIGURATION_TYPES} )
+# string( TOUPPER ${OUTPUT_CONFIG} OUTPUT_CONFIG )
+# set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUT_CONFIG} "${OUTPUT_DIR}/bin" )
+# set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUT_CONFIG} "${OUTPUT_DIR}/lib" )
+# set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUT_CONFIG} "${OUTPUT_DIR}/lib" )
+# endforeach()
OPTION(BUILD_AS_PLUGINS "Build invokers, ioprocessors and datamodels as plugins" OFF)
@@ -770,24 +779,22 @@ endif()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_ORIG})
set(CMAKE_FIND_FRAMEWORK "FIRST")
-if (NOT WIN32)
- find_package(OpenAL)
+find_package(OpenAL)
+if (OPENAL_FOUND)
+ list (APPEND USCXML_INCLUDE_DIRS ${OPENAL_INCLUDE_DIR})
+ if (APPLE OR IOS)
+ list (APPEND USCXML_OPT_LIBS ${OPENAL_LIBRARY}/OpenAL)
+ else()
+ list (APPEND USCXML_OPT_LIBS ${OPENAL_LIBRARY})
+ endif()
+else()
+ find_package(OpenALKCAT)
if (OPENAL_FOUND)
list (APPEND USCXML_INCLUDE_DIRS ${OPENAL_INCLUDE_DIR})
- if (APPLE OR IOS)
- list (APPEND USCXML_OPT_LIBS ${OPENAL_LIBRARY}/OpenAL)
- else()
- list (APPEND USCXML_OPT_LIBS ${OPENAL_LIBRARY})
- endif()
- else()
- find_package(OpenALKCAT)
- if (OPENAL_FOUND)
- list (APPEND USCXML_INCLUDE_DIRS ${OPENAL_INCLUDE_DIR})
- list (APPEND USCXML_OPT_LIBS ${OPENAL_LIBRARY})
- endif()
+ list (APPEND USCXML_OPT_LIBS ${OPENAL_LIBRARY})
endif()
- set(CMAKE_FIND_FRAMEWORK "LAST")
endif()
+set(CMAKE_FIND_FRAMEWORK "LAST")
if (NOT AUDIOTOOLBOX_FOUND)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SHARED})
@@ -855,6 +862,7 @@ include_directories(${USCXML_INCLUDE_DIRS})
add_subdirectory(src/uscxml)
if (WIN32)
list(APPEND USCXML_FILES "${PROJECT_SOURCE_DIR}/contrib/src/getopt/getopt.c")
+# SET_SOURCE_FILES_PROPERTIES( ${PROJECT_SOURCE_DIR}/contrib/src/getopt/getopt.c PROPERTIES LANGUAGE CXX )
endif()
if (UNIX AND NOT APPLE)
@@ -921,7 +929,9 @@ endforeach()
# add compile time reducer
# see https://github.com/sakra/cotire
-include(cotire)
+if (ENABLE_COTIRE)
+ include(cotire)
+endif()
# build library
if (BUILD_AS_PLUGINS)
@@ -935,28 +945,41 @@ else()
target_link_libraries(uscxml ${USCXML_OPT_LIBS} ${USCXML_CORE_LIBS})
endif()
if (NOT CMAKE_CROSSCOMPILING)
- set_target_properties(uscxml PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "src/uscxml/pch.h")
- set_target_properties(uscxml PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
if (ENABLE_COTIRE)
+ set_target_properties(uscxml PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "src/uscxml/pch.h")
+ set_target_properties(uscxml PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
cotire(uscxml)
endif()
endif()
if (NOT CMAKE_CROSSCOMPILING)
- add_executable(uscxml-browser apps/uscxml-browser.cpp)
+ if (WIN32)
+ add_executable(uscxml-browser apps/uscxml-browser.cpp ${PROJECT_SOURCE_DIR}/contrib/src/getopt/getopt.c)
+ else()
+ add_executable(uscxml-browser apps/uscxml-browser.cpp)
+ endif()
target_link_libraries(uscxml-browser uscxml)
+
if (NOT CMAKE_CROSSCOMPILING)
- set_target_properties(uscxml-browser PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
+ if (ENABLE_COTIRE)
+ set_target_properties(uscxml-browser PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
+ endif()
# cotire(uscxml-browser)
endif()
set_target_properties(uscxml-browser PROPERTIES FOLDER "Apps")
install_executable(TARGETS uscxml-browser COMPONENT tools)
- add_executable(uscxml-transform apps/uscxml-transform.cpp)
+ if (WIN32)
+ add_executable(uscxml-transform apps/uscxml-transform.cpp ${PROJECT_SOURCE_DIR}/contrib/src/getopt/getopt.c)
+ else()
+ add_executable(uscxml-transform apps/uscxml-transform.cpp)
+ endif()
target_link_libraries(uscxml-transform uscxml)
if (NOT CMAKE_CROSSCOMPILING)
- set_target_properties(uscxml-transform PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
+ if (ENABLE_COTIRE)
+ set_target_properties(uscxml-transform PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
+ endif()
endif()
set_target_properties(uscxml-transform PROPERTIES FOLDER "Apps")
install_executable(TARGETS uscxml-transform COMPONENT tools)
@@ -1087,6 +1110,10 @@ else()
message(STATUS " Preferring dependent libraries . : installed on system")
endif()
+string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC)
+message(STATUS " CXX Flags : " ${CMAKE_CXX_FLAGS} " " ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UC}})
+message(STATUS " C Flags : " ${CMAKE_C_FLAGS} " " ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}})
+
STRING(REGEX REPLACE "${CMAKE_BINARY_DIR}" "BUILD_DIR" REL_CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
STRING(REGEX REPLACE "${CMAKE_SOURCE_DIR}" "SOURCE_DIR" REL_CMAKE_LIBRARY_OUTPUT_DIRECTORY ${REL_CMAKE_LIBRARY_OUTPUT_DIRECTORY})
diff --git a/apps/samples/vrml/viewer-webgl-setpose.js b/apps/samples/vrml/viewer-webgl-setpose.js
new file mode 100644
index 0000000..e2d3c6c
--- /dev/null
+++ b/apps/samples/vrml/viewer-webgl-setpose.js
@@ -0,0 +1,1353 @@
+// Define the namespace
+// var eu_smartvorex_femkit_ui_modelviewer = eu_smartvorex_femkit_ui_modelviewer || {};
+
+// eu_smartvorex_femkit_ui_modelviewer.VRMLViewer = function (element, params) {
+VRMLViewer = function (element, params) {
+ element.innerHTML = "<div name='vrmlviewer'/>";
+
+ this.updatePose = function(pose) {
+ console.log("Updating pose.");
+ console.log("Pose = " + JSON.stringify(pose, null, 4));
+ if (!pose.width) pose.width = self.pose.width;
+ if (!pose.height) pose.height = self.pose.height;
+ // this.setScene(this.imagePath, this.imageFormat, pose, this.serverURL);
+ };
+
+ // private attributes
+ var self = this;
+ var batchChanges = false;
+ var webGLManipulatorsSetup = false;
+ var currWebGLModel = "";
+
+ // private instanceId
+ // if (!eu_smartvorex_femkit_ui_modelviewer.VRMLViewer.instances)
+ // eu_smartvorex_femkit_ui_modelviewer.VRMLViewer.instances = 0;
+ // this.instanceId = eu_smartvorex_femkit_ui_modelviewer.VRMLViewer.instances++;
+
+ if (!VRMLViewer.instances)
+ VRMLViewer.instances = 0;
+ this.instanceId = VRMLViewer.instances++;
+
+ // public attribute defaults
+ this.width = 450;
+ this.height = 350;
+
+ {
+ var pose = {
+ pitch: 0,
+ roll: 0,
+ yaw: 0,
+ zoom: 1,
+ x: 0,
+ y: 0,
+ z: 0,
+ autorotate: false,
+ };
+ this.pose = pose;
+ }
+
+ this.enableMovies = false;
+ this.enableDND = true;
+ this.enableWebGL = true;
+ this.enableSceneshots = false;
+ this.enableDraggables = false;
+ this.treeNavigationStyle = true;
+ this.listNavigationStyle = true;
+ this.listDirectory = "";
+
+ this.serverURL = "localhost:8080";
+ this.imagePath = "";
+ this.imageFormat = ".png";
+ this.resRoot = "";
+
+ osg.setNotifyLevel(osg.ERROR);
+
+ // copy over values from constructor arguments
+ if (params) {
+ for (var param in params) {
+ if (self.hasOwnProperty(param)) {
+ self[param] = params[param];
+ } else {
+ console.log("Unknown paramter " + param);
+ }
+ }
+ }
+
+ if (!self.pose.width)
+ self.pose.width = self.width;
+ if (!self.pose.height)
+ self.pose.height = self.height;
+
+ var hasWebGL = function() {
+ try {
+ if (!window.WebGLRenderingContext) {
+ return false;
+ }
+ var canvas = document.createElement("canvas");
+ var names = ["webgl", "experimental-webgl", "moz-webgl", "webkit-3d"];
+ for (var i = 0; i < 4; i++) {
+ var gl = canvas.getContext(names[i]);
+ if (gl) {
+ return true;
+ }
+ }
+ } catch(e) {
+ return false;
+ }
+ return false;
+ };
+
+ if (self.enableWebGL && !hasWebGL()) {
+ console.log("Your browser does no support WebGL, falling back to sceneshots");
+ self.enableWebGL = false;
+ self.enableSceneshots = true;
+ }
+
+ /**
+ * normalize given parameters
+ */
+ var normalizeParams = function() {
+ // make sure server url begins with protocol and does *not* ends in /
+ if (!self.serverURL.substring(0, 7) == "http://" &&
+ !self.serverURL.substring(0, 8) == "https://")
+ self.serverURL = "http://" + self.serverURL;
+ if (!self.serverURL.lastIndexOf("/") === self.serverURL.length)
+ self.serverURL += self.serverURL.substring(0, self.serverURL - 1);
+
+ // make sure we have a listDirectory with navigation style list ending in /
+ if (self.modelNavigationStyle === "list" && !self.listDirectory && self.imagePath)
+ self.listDirectory = self.imagePath.substring(0, self.imagePath.lastIndexOf("/"));
+ if (!self.listDirectory.indexOf("/", self.listDirectory.length - 1) !== -1)
+ self.listDirectory += "/";
+
+ // use latest image if none given
+ if (!self.imagePath)
+ self.imagePath = self.listDirectory + "latest";
+
+ if (!self.imageFormat.substring(0, 1) !== ".")
+ self.imageFormat = "." + self.imageFormat;
+ };
+ normalizeParams();
+
+ /**
+ * Fetch a remote WebGL model and return a future for it
+ */
+ var getWebGLModel = function(url) {
+ console.log("Loading " + url);
+ if (self.webGLStandby) { self.webGLStandby.show(); }
+ var defer = osgDB.Promise.defer();
+ var node = new osg.MatrixTransform();
+ // node.setMatrix(osg.Matrix.makeRotate(-Math.PI/2, 1,0,0, []));
+ var loadModel = function(url) {
+ osg.log("loading " + url);
+ var req = new XMLHttpRequest();
+ req.open('GET', url, true);
+ req.onreadystatechange = function(aEvt) {
+ if (req.readyState == 4) {
+ if(req.status == 200) {
+ osgDB.Promise.when(osgDB.parseSceneGraph(JSON.parse(req.responseText))).then(function(child) {
+
+ console.log("Loaded " + url);
+
+ var rotate = [];
+ osg.Matrix.makeIdentity(rotate);
+ // osg.Matrix.preMult(rotate, osg.Matrix.makeRotate(Math.PI/2.0, 1,0,0,[]));
+ // osg.Matrix.preMult(rotate, osg.Matrix.makeRotate(Math.PI, 0,1,0,[]));
+
+ node.setMatrix(rotate);
+ node.addChild(child);
+ defer.resolve(node);
+ osg.log("success " + url);
+
+ });
+ if (self.webGLStandby) { self.webGLStandby.hide(); }
+ } else {
+ osg.log("error " + url);
+ if (self.webGLStandby) { self.webGLStandby.hide(); }
+ }
+ }
+ };
+ req.send(null);
+ };
+ loadModel(url);
+ return defer.promise;
+ };
+
+ /**
+ * Concatenate pose as query string
+ */
+ var urlSuffixForPose = function(pose) {
+ var queryString =
+ '?width=' + pose.width +
+ '&height=' + pose.height +
+ '&pitch=' + pose.pitch +
+ '&roll=' + pose.roll +
+ '&yaw=' + pose.yaw +
+ '&x=' + pose.x +
+ '&y=' + pose.y +
+ '&z=' + pose.z +
+ '&zoom=' + pose.zoom +
+ '&autorotate=' + (pose.autorotate ? '1' : '0');
+ return queryString;
+ };
+
+ /**
+ * Get relative position of two elements
+ */
+ var moverRelativeTo = function(mover, container) {
+ // 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};
+ };
+
+ var containerPos = absolutePosition(container);
+ return {
+ x: mover.x - containerPos.x,
+ y: mover.y - containerPos.y
+ };
+ };
+
+ var eulerToMatrix = function(pitch, roll, yaw) {
+ // see http://www.flipcode.com/documents/matrfaq.html#Q36
+ var m = osg.Matrix.makeIdentity([]);
+
+ var A = Math.cos(pitch);
+ var B = Math.sin(pitch);
+ var C = Math.cos(roll);
+ var D = Math.sin(roll);
+ var E = Math.cos(yaw);
+ var F = Math.sin(yaw);
+ var AD = A * D;
+ var BD = B * D;
+
+ osg.Matrix.setRow(m, 0, (C * E), (-C * F), (-D), 0);
+ osg.Matrix.setRow(m, 1, (-BD * E + A * F), (BD * F + A * E), (-B * C), 0);
+ osg.Matrix.setRow(m, 2, (AD * E + B * F), (-AD * F + B * E), (A * C), 0);
+ osg.Matrix.setRow(m, 3, 0, 0, 0, 1);
+
+ return m;
+ }
+
+ var matrixToEuler = function(m) {
+ // see: http://www.flipcode.com/documents/matrfaq.html#Q37
+ var angleX = 0;
+ var angleZ = 0;
+ var D = -1 * Math.asin(osg.Matrix.get(m,0,2)); /* Calculate Y-axis angle */
+ var angleY = D;
+ var C = Math.cos(angleY);
+
+ /* Gimbal lock? */
+ if (Math.abs(C) > 0.005) {
+ var tr_x = osg.Matrix.get(m,2,2) / C; /* No, so get X-axis angle */
+ var tr_y = -1 * osg.Matrix.get(m,1,2) / C;
+ angleX = Math.atan2( tr_y, tr_x );
+ tr_x = osg.Matrix.get(m,0,0) / C; /* Get Z-axis angle */
+ tr_y = -1 * osg.Matrix.get(m,0,1) / C;
+ angleZ = Math.atan2( tr_y, tr_x );
+ } else {
+ /* Gimball lock has occurred */
+ angleX = 0; /* Set X-axis angle to zero */
+ var tr_x = osg.Matrix.get(m,1,1); /* And calculate Z-axis angle */
+ var tr_y = osg.Matrix.get(m,1,0);
+ angleZ = Math.atan2( tr_y, tr_x );
+ }
+
+ /* Clamp all angles to range */
+ return {
+ pitch: angleX % (2 * 3.14159),
+ roll: angleY % (2 * 3.14159),
+ yaw: angleZ % (2 * 3.14159)
+ };
+ }
+
+ // get list of supported ffmpeg codecs from server
+ this.populateMovieCodecs = function(server, selectElem) {
+ self.xhr.get({
+ // The URL to request
+ url: server,
+ handleAs:"json",
+ headers:{"X-Requested-With":null},
+ load: function(result) {
+ for (var codec in result.video) {
+ if (codec !== "mpeg1video" &&
+ codec !== "mpeg2video" &&
+ codec !== "mpeg4" &&
+ codec !== "h264" &&
+ codec !== "ayuv" &&
+ codec !== "flashsv" &&
+ codec !== "flashsv2" &&
+ codec !== "flv" &&
+ codec !== "rv40" &&
+ codec !== "theora" &&
+ codec !== "v210" &&
+ codec !== "v308" &&
+ codec !== "v408" &&
+ codec !== "v410" &&
+ codec !== "wmv3" &&
+ codec !== "y41p" &&
+ codec !== "yuv4")
+ continue;
+ // console.log(codec);
+ selectElem.options.push({ label: result.video[codec].longName, value: codec });
+ if (codec === "mpeg4")
+ selectElem.options[selectElem.options.length - 1].selected = true;
+ }
+ }
+ });
+ };
+
+ // update list of vrml files from server
+ this.refreshServer = function(server, params) {
+ if (!self.listNavigationStyle && !self.treeNavigationStyle)
+ return;
+
+ self.serverURL = server;
+ if (!params)
+ params = {};
+ if (self.fileStandby) { self.fileStandby.show(); }
+
+ self.xhr.get({
+ // The URL to request
+ url: server,
+ handleAs:"json",
+ headers:{"X-Requested-With":null},
+ error: function(result) {
+
+ if (self.browseButton) { self.browseButton.setAttribute('label', 'Browse'); }
+ if (self.fileStandby) { self.fileStandby.hide(); }
+
+ if (!params.skipTree) {
+ if (self.fileTreeStore) {
+ var allItems = self.fileTreeStore.query();
+ for (var i = 0; i < allItems.total; i++) {
+ self.fileTreeStore.remove(allItems[i].id);
+ }
+ }
+ }
+ if (!params.skipList) {
+ if (self.fileListStore) {
+ var allItems = self.fileListStore.query();
+ for (var i = 0; i < allItems.total; i++) {
+ self.fileListStore.remove(allItems[i].id);
+ }
+ }
+ }
+ },
+ load: function(result) {
+// self.localStorage.put("vrmlServer", self.serverURL, null);
+ if (self.browseButton) { self.browseButton.setAttribute('label', 'Refresh'); }
+ if (self.fileStandby) { self.fileStandby.hide(); }
+
+ if (self.treeNavigationStyle && !params.skipTree) {
+ // empty store
+ var allItems = self.fileTreeStore.query();
+ for (var i = 0; i < allItems.total; i++) {
+ self.fileTreeStore.remove(allItems[i].id);
+ }
+
+ // parse result as tree
+ (function fillstore(tree, parentId) {
+ // todo: respect navigation style
+ for (key in tree) {
+ if ('url' in tree[key]) {
+ self.fileTreeStore.add({id:parentId+key, name:key, url:tree[key].path, parent:parentId});
+ } else {
+ self.fileTreeStore.add({id:parentId+key, name:key, parent:parentId});
+ fillstore(tree[key], parentId+key);
+ }
+ }
+ } (result.models, "root", ""));
+ }
+ if (self.listNavigationStyle && !params.skipList) {
+
+ // empty store
+ var allItems = self.fileListStore.query();
+ for (var i = 0; i < allItems.total; i++) {
+ self.fileListStore.remove(allItems[i].id);
+ }
+
+ // parse result as list
+ if (!self.listDirectory)
+ console.log("Requested modelNavigationStyle === list but provided no listDirectory");
+ var dirs = self.listDirectory.split("/");
+ var models = result.models;
+ for (var dir in dirs) {
+ if (!dirs[dir].length)
+ continue;
+ if (dirs[dir] in models) {
+ models = models[dirs[dir]];
+ } else {
+ console.log("No " + dirs[dir] + " in " + models);
+ }
+ }
+ for (var key in models) {
+ var url = self.serverURL + models[key].path;
+ self.fileListStore.add({id:key, value:models[key].path, label:key, name:key, url:url});
+ }
+ self.fileListSelect.startup();
+ }
+ // self.updateScene();
+ }
+ });
+ };
+
+ this.getPose = function() {
+ if (self.webGLViewer && self.webGLViewer.getSceneData()) {
+ var rotate = [];
+ osg.Matrix.makeIdentity(rotate);
+
+ osg.Matrix.preMult(rotate, osg.Matrix.makeRotate(Math.PI/2.0, 1,0,0,[]));
+ osg.Matrix.preMult(rotate, osg.Matrix.makeRotate(Math.PI, 0,1,0,[]));
+ osg.Matrix.postMult(self.webGLViewer.getSceneData().getMatrix(), rotate);
+
+ var pose = matrixToEuler(rotate);
+ return pose;
+ } else {
+ return {
+ pitch: self.pose.pitch,
+ roll: self.pose.roll,
+ yaw: self.pose.yaw,
+ }
+ }
+ }
+
+ this.setPose = function(pose) {
+ this.setScene(self.imagePath, self.imageFormat, pose, self.serverURL);
+ }
+
+ this.setScene = function(imagePath, imageFormat, pose, serverURL) {
+
+ if (serverURL && serverURL != self.serverURL) {
+ self.refreshServer(serverURL);
+ }
+
+ self.imagePath = imagePath;
+ self.imageFormat = imageFormat;
+
+ for (var key in pose) {
+ self.pose[key] = pose[key];
+ }
+
+ self.pose.pitch = (2 * 3.14159 + self.pose.pitch) % (2 * 3.14159);
+ self.pose.roll = (2 * 3.14159 + self.pose.roll) % (2 * 3.14159);
+ self.pose.yaw = (2 * 3.14159 + self.pose.yaw) % (2 * 3.14159);
+
+ var pitch = (self.pose.pitch / (2 * 3.14159) + 0.5) * 100;
+ var roll = (self.pose.roll / (2 * 3.14159) + 0.5) * 100;
+ var yaw = (self.pose.yaw / (2 * 3.14159) + 0.5) * 100;
+ var x = ((self.pose.x / 100) + 0.5) * 100;
+ var y = ((self.pose.y / 100) + 0.5) * 100;
+ var zoom = (((self.pose.zoom - 1) / 3) + 0.5) * 100;
+
+ // console.log("pitch: " + pitch);
+
+ if (self.pitchRollHandlerElem) self.pitchRollHandlerElem.parentNode.style.right = pitch + "%";
+ if (self.pitchRollHandlerElem) self.pitchRollHandlerElem.parentNode.style.top = roll + "%";
+ if (self.yawZoomHandlerElem) self.yawZoomHandlerElem.parentNode.style.right = yaw + "%";
+ if (self.yawZoomHandlerElem) self.yawZoomHandlerElem.parentNode.style.top = zoom + "%";
+ if (self.xyHandlerElem) self.xyHandlerElem.parentNode.style.right = x + "%";
+ if (self.xyHandlerElem) self.xyHandlerElem.parentNode.style.top = y + "%";
+
+ self.updateScene();
+ };
+
+ // update the scene
+ this.updateScene = function() {
+ if (self.serverURL && self.imagePath && !self.batchChanges) {
+ // console.log(self.serverURL + self.imagePath + self.imageFormat + urlSuffixForPose(self.pose));
+
+ if (self.enableWebGL) {
+ var setWebGLPose = function() {
+
+ // reset camera controls
+ self.webGLViewer.getManipulator().reset();
+ self.webGLViewer.getManipulator().computeHomePosition();
+
+ var bs = self.webGLViewer.getSceneData().getBound();
+ var zoom = 1; //self.pose.zoom || 10;
+ var eye = [0, 0, bs.radius() * (1.9 * zoom)];
+ // var center = bs.center();
+ // var up = [1,1,0];
+
+ self.webGLViewer.getManipulator().setEyePosition(eye);
+
+ // var poseMatrix = eulerToMatrix(self.pose.pitch, self.pose.yaw, -1 * self.pose.roll);
+ var poseMatrix = eulerToMatrix(self.pose.pitch * -1, self.pose.roll * -1, self.pose.yaw);
+
+ var rotate = [];
+ osg.Matrix.makeIdentity(rotate);
+ // osg.Matrix.preMult(rotate, osg.Matrix.makeRotate(Math.PI/2.0, 1,0,0,[]));
+ // osg.Matrix.preMult(rotate, osg.Matrix.makeRotate(Math.PI, 0,1,0,[]));
+ osg.Matrix.postMult(poseMatrix, rotate);
+
+ // osg.Matrix.preMult(rotate, poseMatrix);
+ self.webGLViewer.getSceneData().setMatrix(rotate);
+
+ }
+
+ if (self.imagePath != currWebGLModel) {
+ currWebGLModel = self.imagePath;
+ osgDB.Promise.when(getWebGLModel(self.serverURL + self.imagePath + '.osgjs')).then(function(model) {
+ self.webGLViewer.setSceneData(model);
+ if (!webGLManipulatorsSetup) {
+ self.webGLViewer.setupManipulator(new osgGA.OrbitManipulator(), false);
+ self.webGLViewer.getManipulator().computeHomePosition();
+ }
+ webGLManipulatorsSetup = true;
+ setWebGLPose();
+ });
+ }
+ if (self.webGLViewer && currWebGLModel == self.imagePath && self.webGLViewer.getSceneData()) {
+ setWebGLPose();
+ }
+ }
+ if (self.enableSceneshots) {
+ self.imgElem.src = self.serverURL + self.imagePath + self.imageFormat + urlSuffixForPose(self.pose);
+ if (self.enableMovies && self.movieAddButton) {
+ // we are showing an image, activate movie controls
+ self.movieAddButton.domNode.style.display = "";
+ self.movieDropDown.domNode.style.display = "";
+ }
+ }
+ }
+ };
+
+ require(["dojo/dom-construct",
+ "dojo/_base/xhr",
+ "dojo/dom",
+ "dojo/on",
+ "dojo/_base/array",
+ "dojox/storage",
+ "dojo/store/Memory",
+ "dojo/store/Observable",
+ "dijit/tree/ObjectStoreModel",
+ "dojo/data/ObjectStore",
+ "dijit/Tree",
+ "dijit/form/TextBox",
+ "dijit/form/Button",
+ "dojox/widget/Standby",
+ "dijit/form/DropDownButton",
+ "dijit/TooltipDialog",
+ "dojo/dnd/Moveable",
+ "dojo/ready",
+ "dojo/dnd/Source",
+ "dijit/form/HorizontalSlider",
+ "dijit/form/Select",
+ "dijit/form/NumberSpinner"],
+ function(domConst,
+ xhr,
+ dom,
+ on,
+ array,
+ storage,
+ Memory,
+ Observable,
+ ObjectStoreModel,
+ ObjectStore,
+ Tree,
+ TextBox,
+ Button,
+ Standby,
+ DropDownButton,
+ TooltipDialog,
+ Moveable,
+ ready,
+ Source,
+ HorizontalSlider,
+ Selector,
+ NumberSpinner) {
+
+ ready(function() {
+
+ if (typeof(element) === 'string') {
+ element = dom.byId(element);
+ }
+ element.style.height = self.pose.height;
+ element.style.width = self.pose.width;
+
+ self.element = element;
+ self.xhr = xhr;
+
+ // establish our dom
+ element.appendChild(domConst.toDom('\
+ <table>\
+ <tr>\
+ <td valign="top">\
+ <div style="position: relative; padding: 0px; width: ' + self.pose.width + 'px; height: ' + self.pose.height + 'px">\
+ <div class="screenShot" style="position: absolute; width: ' + self.pose.width + 'px; height: ' + self.pose.height + 'px">\
+ <img class="screenShot" style="width: ' + self.pose.width + 'px; height: ' + self.pose.height + 'px"></img>\
+ </div>\
+ <div class="webGL" style="position: absolute; width: ' + self.pose.width + 'px; height: ' + self.pose.height + 'px">\
+ <canvas class="webGL" style="width: ' + self.pose.width + 'px; height: ' + self.pose.height + 'px"></canvas>\
+ </div>\
+ <div style="z-index: -1; position: absolute; right: 45%; top: 45%">\
+ <div class="progress"></div>\
+ </div>\
+ <div style="position: absolute; left: 10px; top: 10px">\
+ <table></tr>\
+ <td class="treeNavigation filesDropDown" style="vertical-align: middle"></td>\
+ <td class="movieControls">\
+ <div class="movieDropDown" style="display: inline"></div>\
+ <button type="button" class="movieAddButton"></button>\
+ </td>\
+ <td align="right"><button type="button" class="resetButton"></button></td>\
+ <td class="dndHandler" style="vertical-align: middle; padding-top: 4px;"></td>\
+ </tr></table>\
+ </div>\
+ <div style="position: absolute; right: 10px; top: 15%; height: 50%">\
+ <div class="zoomSlide"></div>\
+ </div>\
+ <div class="draggable" style="position: absolute; right: 50%; top: 50%">\
+ <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="' + self.resRoot + 'img/pitchRoll-handle.png" height="20px" style="padding: 2px 0px 0px 4px;" /></td>\
+ <td><div class="pitchLabel"></div><div class="rollLabel"></div></td>\
+ </tr>\
+ </table>\
+ </div>\
+ </div>\
+ <div class="draggable"style="position: absolute; right: 50%; top: 50%">\
+ <div class="yawZoomHandler">\
+ <div style="font-size: 0.5em; background-color: rgba(255,255,255,0.5); border-radius: 5px; moz-border-radius: 5px; position: absolute; left: -34px;">\
+ <table>\
+ <tr>\
+ <td><img class="yawZoomHandlerImg" src="' + self.resRoot + 'img/yawZoom-handle.png" height="20px" style="padding: 2px 0px 0px 4px;" /></td>\
+ <td><div class="yawLabel"></div><div class="zoomLabel"></div></td>\
+ </tr>\
+ </table>\
+ </div>\
+ </div>\
+ </div>\
+ <div class="draggable"style="position: absolute; right: 50%; top: 50%">\
+ <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="' + self.resRoot + 'img/xy-handle.png" width="20px" style="padding: 2px 0px 0px 4px;" /></td>\
+ <td><div class="xLabel"></div><div class="yLabel"></div></td>\
+ </tr>\
+ </table>\
+ </div>\
+ </div>\
+ <div class="listNavigation" style="position: absolute; left: 10px; bottom: 10px">\
+ <table></tr>\
+ <td style="vertical-align: middle"><button class="prevButton" type="button" /></td>\
+ <td style="vertical-align: middle"><div class="fileList" /></td>\
+ <td style="vertical-align: middle"><button class="nextButton" type="button" /></td>\
+ </tr></table>\
+ </div>\
+ </div>\
+ </td>\
+ <td valign="top" height="100%">\
+ </td>\
+ </tr>\
+ <tr>\
+ <td colspan="2"><div class="messages"></div></td>\
+ </tr>\
+ </table>\
+ '));
+
+ // fetch special dom nodes for content
+ self.messageBox = dojo.query("div.messages", element)[0];
+ self.imgElem = dojo.query("img.screenShot", element)[0];
+
+ /**
+ * === WebGL ====================
+ */
+ var activateWebGL = function(enable) {
+ if (enable) {
+ self.canvasElem = dojo.query("canvas.webGL", element)[0];
+ self.canvasElem.style.width = self.width;
+ self.canvasElem.style.height = self.height;
+ self.canvasElem.width = self.width;
+ self.canvasElem.height = self.height;
+
+ if (self.webGLViewer === undefined) {
+ self.webGLViewer = new osgViewer.Viewer(self.canvasElem, {antialias : true, alpha: true });
+ self.webGLViewer.init();
+ self.webGLViewer.getCamera().setClearColor([0.0, 0.0, 0.0, 0.0]);
+ self.webGLViewer.setupManipulator();
+ self.webGLViewer.run();
+
+ self.webGLStandby = new Standby({target: self.element });
+ self.element.appendChild(self.webGLStandby.domNode);
+ }
+
+ // show elements
+ array.forEach(dojo.query(".webGL", element), function(entry, i) {
+ entry.style.display = "inline";
+ });
+ } else {
+ if (self.webGLViewer) {
+ self.webGLViewer.stop();
+ }
+ // hide elements
+ array.forEach(dojo.query(".webGL", element), function(entry, i) {
+ entry.style.display = "none";
+ });
+ }
+ };
+ activateWebGL(self.enableWebGL);
+
+ var activateScreenshot = function(enable) {
+ if (enable) {
+ array.forEach(dojo.query(".screenShot", element), function(entry, i) {
+ entry.style.display = "inline";
+ });
+ } else {
+ array.forEach(dojo.query(".screenShot", element), function(entry, i) {
+ entry.style.display = "none";
+ });
+ }
+ };
+ activateScreenshot(self.enableSceneshots);
+
+
+ /**
+ * === POSE MANIPULATION AND RESET ====================
+ */
+ self.resetButtonElem = dojo.query("button.resetButton", element)[0];
+ self.resetButton = new Button({
+ label: "Reset",
+ onClick: function() {
+ if (self.webGLViewer) {
+ self.webGLViewer.setupManipulator();
+ self.webGLViewer.getManipulator().computeHomePosition();
+ }
+ self.pose.x = 0;
+ self.pose.y = 0;
+ self.pose.pitch = 0;
+ self.pose.roll = 0;
+ self.pose.yaw = 0;
+ self.pose.zoom = 1;
+
+ if (self.xyHandler) self.xyHandler.node.style.left = 0;
+ if (self.xyHandler) self.xyHandler.node.style.top = 0;
+ if (self.pitchRollHandler) self.pitchRollHandler.node.style.left = 0;
+ if (self.pitchRollHandler) self.pitchRollHandler.node.style.top = 0;
+ if (self.yawZoomHandler) self.yawZoomHandler.node.style.left = 0;
+ if (self.yawZoomHandler) self.yawZoomHandler.node.style.top = 0;
+
+ self.updateScene();
+ }
+ }, self.resetButtonElem);
+
+ var activateDraggables = function(enable) {
+ if (enable) {
+ if (self.pitchRollHandler == undefined) {
+ self.progressElem = dojo.query("div.progress", element)[0];
+
+ self.pitchRollHandlerElem = dojo.query(".pitchRollHandler", element)[0];
+ self.yawZoomHandlerElem = dojo.query(".yawZoomHandler", element)[0];
+ self.xyHandlerElem = dojo.query(".xyHandler", element)[0];
+
+ self.pitchRollHandler = new Moveable(self.pitchRollHandlerElem);
+ self.pitchRollHandler.onMoveStop = function(mover) {
+ var handlerImg = dojo.query("img.pitchRollHandlerImg", mover.node)[0];
+ var pitchLabel = dojo.query("div.pitchLabel", mover.node)[0];
+ var rollLabel = dojo.query("div.rollLabel", mover.node)[0];
+ pitchLabel.innerHTML = '';
+ rollLabel.innerHTML = '';
+ self.updateScene();
+ };
+ self.pitchRollHandler.onMoving = function(mover) {
+ var handlerImg = dojo.query(".pitchRollHandlerImg", mover.node)[0];
+ var pitchLabel = dojo.query(".pitchLabel", mover.node)[0];
+ var rollLabel = dojo.query(".rollLabel", mover.node)[0];
+ var offset = moverRelativeTo(handlerImg, self.element);
+
+ offset.x += 30;
+ offset.y += 20;
+
+ self.xyHandlerElem.style.zIndex = 1;
+ self.yawZoomHandlerElem.style.zIndex = 1;
+ self.pitchRollHandlerElem.style.zIndex = 2;
+
+ self.pose.roll = offset.x / self.pose.width - 0.5;
+ self.pose.pitch = offset.y / self.pose.height - 0.5;
+ self.pose.pitch *= -1;
+ self.pose.roll *= 2 * 3.14159;
+ self.pose.pitch *= 2 * 3.14159;
+ self.pose.roll = Math.ceil((self.pose.roll) * 10) / 10;
+ 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) {
+ var handlerImg = dojo.query("img.yawZoomHandlerImg", mover.node)[0];
+ var yawLabel = dojo.query("div.yawLabel", mover.node)[0];
+ var zoomLabel = dojo.query("div.zoomLabel", mover.node)[0];
+ yawLabel.innerHTML = '';
+ 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];
+ var zoomLabel = dojo.query("div.zoomLabel", mover.node)[0];
+ var offset = moverRelativeTo(handlerImg, self.element);
+
+ offset.x += 7;
+ offset.y += 9;
+
+ self.xyHandlerElem.style.zIndex = 1;
+ self.yawZoomHandlerElem.style.zIndex = 2;
+ self.pitchRollHandlerElem.style.zIndex = 1;
+
+ // self.pose.pitch = self.pose.pitch % (2 * 3.14159);
+ // self.pose.roll = self.pose.roll % (2 * 3.14159);
+ self.pose.yaw = (self.pose.width - offset.x) / self.pose.width - 0.5;
+ self.pose.zoom = offset.y / self.pose.height - 0.5;
+ self.pose.yaw *= 2 * 3.14159;
+ self.pose.zoom = self.pose.zoom * 3 + 1;
+ self.pose.zoom = Math.ceil((self.pose.zoom) * 10) / 10;
+ 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) {
+ var handlerImg = dojo.query("img.xyHandlerImg", mover.node)[0];
+ var xLabel = dojo.query("div.xLabel", mover.node)[0];
+ var yLabel = dojo.query("div.yLabel", mover.node)[0];
+
+ xLabel.innerHTML = '';
+ 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];
+ var yLabel = dojo.query("div.yLabel", mover.node)[0];
+ var offset = moverRelativeTo(handlerImg, self.element);
+
+ offset.x += 3;
+ offset.y += 13;
+
+ self.xyHandlerElem.style.zIndex = 2;
+ self.yawZoomHandlerElem.style.zIndex = 1;
+ self.pitchRollHandlerElem.style.zIndex = 1;
+
+ self.pose.x = offset.x / self.pose.width - 0.5;
+ self.pose.y = offset.y / self.pose.height - 0.5;
+ self.pose.x *= 100;
+ self.pose.y *= 100;
+ self.pose.y = Math.ceil((self.pose.y) * 10) / 10;
+ self.pose.x = Math.ceil((self.pose.x) * 10) / 10;
+ xLabel.innerHTML = 'X:' + self.pose.x;
+ yLabel.innerHTML = 'Y:' + self.pose.y;
+ };
+ }
+
+ // show all draggables
+ array.forEach(dojo.query(".draggable", element), function(entry, i) {
+ entry.style.display = "inline";
+ });
+
+ } else {
+ // show all draggables
+ array.forEach(dojo.query(".draggable", element), function(entry, i) {
+ entry.style.display = "none";
+ });
+ }
+ };
+ activateDraggables(self.enableDraggables);
+
+ /**
+ * === DRAG HANDLER ====================
+ */
+ var activateDND = function(enable) {
+ if (enable) {
+ self.createAvatar = function(item, mode) {
+ if (mode == 'avatar') {
+ // create your avatar if you want
+ var avatar = dojo.create( 'div', { innerHTML: item.data });
+ var avatarPose = dojo.clone(self.pose);
+ avatarPose.width=60;
+ avatarPose.height=60;
+ var avatarImgUrl = urlSuffixForPose(avatarPose);
+ avatar.innerHTML = '<img src=' + self.serverURL + self.imagePath + self.imageFormat + avatarImgUrl + ' /> ';
+ item.srcEcc = "VRMLViewer";
+ item.iconPoseUrl = self.serverURL + self.imagePath + self.imageFormat + avatarImgUrl;
+ item.imagePath = self.imagePath;
+ item.imageFormat = self.imageFormat;
+ item.serverURL = self.serverURL;
+ item.pose = avatarPose;
+ return {node: avatar, data: item, type: item.type};
+ }
+ var handler = dojo.create( 'div', { innerHTML: '<img src="' + self.resRoot + 'img/drag.png" width="20px" />' });
+ return {node: handler, data: item, type: item.type};
+ };
+
+ self.dndHandler = new Source(dojo.query("td.dndHandler", element)[0], {copyOnly: true, creator: self.createAvatar});
+ self.dndHandler.insertNodes(false, [ { } ]);
+
+ array.forEach(dojo.query(".dndHandler", element), function(entry, i) {
+ entry.style.display = "inline";
+ });
+
+ } else {
+ array.forEach(dojo.query(".dndHandler", element), function(entry, i) {
+ entry.style.display = "none";
+ });
+
+ }
+ };
+
+ activateDND(self.enableDND);
+
+ /**
+ * === FILE NAVIGATION ====================
+ */
+
+ var activateListNavigation = function(enable) {
+ if (enable) {
+ array.forEach(dojo.query(".listNavigation", element), function(entry, i) {
+ entry.style.display = "inline";
+ });
+
+ if (!self.fileListStore) {
+ // setup fileStore
+ self.fileListStore = new Observable(new Memory({
+ data: [],
+ }));
+
+ self.prevButtonElem = dojo.query("button.prevButton", element)[0];
+ self.nextButtonElem = dojo.query("button.nextButton", element)[0];
+ self.fileListElem = dojo.query("div.fileList", element)[0];
+
+ self.fileListSelect = new Selector({
+ store: new ObjectStore({ objectStore: self.fileListStore }),
+ onChange: function(name) {
+ var item = self.fileListStore.query({ id: name })[0];
+ self.imagePath = self.listDirectory + item.name;
+ self.updateScene();
+ }
+ }, self.fileListElem);
+
+ self.prevButton = new Button({
+ label: "<",
+ onClick: function() {
+ var allItems = self.fileListStore.query();
+ var foundAt = 0;
+ for (var i = 0; i < allItems.total; i++) {
+ console.log(self.serverURL + self.imagePath + " === " + allItems[i].url);
+ if (self.serverURL + self.imagePath === allItems[i].url) {
+ foundAt = i;
+ break;
+ }
+ }
+
+ if (foundAt > 0) {
+ self.imagePath = self.listDirectory + allItems[foundAt - 1].name;
+ self.fileListSelect.attr( 'value', allItems[foundAt - 1].id );
+ if (self.serverURL + self.imagePath !== allItems[foundAt - 1].url)
+ console.log(self.serverURL + self.imagePath + " !== " + allItems[foundAt - 1].url);
+ self.updateScene();
+ }
+ }
+ }, self.prevButtonElem);
+
+ self.nextButton = new Button({
+ label: ">",
+ onClick: function() {
+ var allItems = self.fileListStore.query();
+ var foundAt = 0;
+ for (var i = 0; i < allItems.total; i++) {
+ // console.log(self.serverURL + self.imagePath + " === " + allItems[i].url);
+ if (self.serverURL + self.imagePath === allItems[i].url) {
+ foundAt = i;
+ break;
+ }
+ }
+ if (foundAt + 1 < allItems.total) {
+ self.imagePath = self.listDirectory + allItems[foundAt + 1].name + ".png";
+ self.fileListSelect.attr( 'value', allItems[foundAt + 1].id );
+ if (self.serverURL + self.imagePath !== allItems[foundAt + 1].url)
+ console.log(self.serverURL + self.imagePath + " !== " + allItems[foundAt + 1].url);
+ self.updateScene();
+ }
+ }
+ }, self.nextButtonElem);
+ }
+ } else {
+ array.forEach(dojo.query(".listNavigation", element), function(entry, i) {
+ entry.style.display = "none";
+ });
+ }
+ };
+ activateListNavigation(self.listNavigationStyle);
+
+ var activateTreeNavigation = function(enable) {
+ if (enable) {
+
+ array.forEach(dojo.query(".treeNavigation", element), function(entry, i) {
+ entry.style.display = "";
+ });
+
+ if (!self.fileTreeStore) {
+ // setup fileStore
+ self.fileTreeStore = new Observable(new Memory({
+ data: [ { id: 'root', name:'3D Models'} ],
+ getChildren: function(object){
+ return this.query({parent: object.id});
+ }
+ }));
+
+ self.fileTreeModel = new ObjectStoreModel({
+ store: self.fileTreeStore,
+ query: { id: "root" }
+ });
+
+ // setup actual tree dijit
+ self.fileTree = new dijit.Tree({
+ id: "fileTree" + self.instanceId,
+ model: self.fileTreeModel,
+ persist: false,
+ showRoot: false,
+ style: "height: 300px;",
+ onClick: function(item){
+ if ('url' in item) {
+ self.imagePath = item.url;
+ var newListDir = self.imagePath.substring(0, self.imagePath.lastIndexOf("/"));
+ if (newListDir.length > 0)
+ newListDir += '/';
+ if (newListDir !== self.listDirectory) {
+ self.listDirectory = newListDir;
+ self.refreshServer(self.serverURL, { skipTree: true });
+ }
+ self.updateScene();
+ }
+ },
+ getIconClass: function(item, opened) {
+ return (!item || !('url' in item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "dijitLeaf";
+ },
+ getIconStyle: function(item, opened){
+ if('url' in item) {
+ return { backgroundImage: "url('" + self.serverURL + item.url + self.imageFormat + "?width=16&height=16')"};
+ }
+ }
+ });
+
+ self.filesDropDownElem = dojo.query("td.filesDropDown", element)[0];
+
+ self.serverBox = new TextBox({
+ name: "Server",
+ value: self.serverURL,
+ style: "width: 65%",
+
+ onKeyUp: function(e) {
+ if (self.browseButton) {
+ if (this.get("value") !== self.serverURL) {
+ self.browseButton.setAttribute('label', 'Browse');
+ } else {
+ self.browseButton.setAttribute('label', 'Refresh');
+ }
+ }
+ },
+
+ onKeyDown: function(e) {
+ var code = e.keyCode || e.which;
+ if( code === 13 ) {
+ e.preventDefault();
+ self.refreshServer(this.get("value"));
+ return false;
+ }
+ },
+ });
+
+ self.browseButton = new Button({
+ label: "Browse",
+ onClick: function(){
+ self.refreshServer(self.serverBox.get("value"));
+ }
+ });
+
+ self.filesDropDownContent = domConst.toDom('<div />');
+ self.filesDropDownContent.appendChild(self.serverBox.domNode);
+ self.filesDropDownContent.appendChild(self.browseButton.domNode);
+ self.filesDropDownContent.appendChild(self.fileTree.domNode);
+
+ self.filesToolTip = new TooltipDialog({ content:self.filesDropDownContent, style:"max-height:320px"});
+ self.filesDropDown = new DropDownButton({ label: "Files", dropDown: self.filesToolTip });
+ self.filesDropDownElem.appendChild(self.filesDropDown.domNode);
+
+ self.fileStandby = new Standby({target: self.filesDropDownContent });
+ self.filesDropDownContent.appendChild(self.fileStandby.domNode);
+ }
+ } else {
+ array.forEach(dojo.query(".treeNavigation", element), function(entry, i) {
+ entry.style.display = "none";
+ });
+ }
+ };
+
+ activateTreeNavigation(self.treeNavigationStyle);
+
+ /**
+ * === MOVIE DROPDOWN ====================
+ */
+
+ var activateMovies = function(enable) {
+ if (enable) {
+ self.movieDropDownElem = dojo.query("div.movieDropDown", element)[0];
+ self.movieAddButtonElem = dojo.query("button.movieAddButton", element)[0];
+
+ self.movieDropDownContent = domConst.toDom(
+ '<div style="overflow: auto; max-height: 420px;"> \
+ <table><tr class="movieFormatLengthRow" /></tr><tr class="movieWidthHeightLengthRow" /></table> \
+ <div class=\"dndArea\" /> \
+ </div>'
+ );
+
+ self.movieFormatLengthRowElem = dojo.query("tr.movieFormatLengthRow", self.movieDropDownContent)[0];
+ self.movieWidthHeightLengthRowElem = dojo.query("tr.movieWidthHeightLengthRow", self.movieDropDownContent)[0];
+ self.movieDnDArea = dojo.query("div.dndArea", self.movieDropDownContent)[0];
+
+ self.createMovieThumb = function(item, mode) {
+ if (mode == 'avatar') {
+ // when dragged
+ var avatar = dojo.create( 'div', { innerHTML: item.data });
+ var avatarPose = dojo.clone(self.pose);
+ avatarPose.width = 60;
+ avatarPose.height = 60;
+ var avatarImgUrl = urlSuffixForPose(avatarPose);
+ avatar.innerHTML = '<img src=' + self.imagePath + self.imageFormat + avatarImgUrl + ' /> ';
+ item.srcEcc = "VRMLViewer";
+ item.iconPoseUrl = self.imagePath + avatarImgUrl;
+ item.imagePath = self.imagePath;
+ item.serverURL = self.serverURL;
+ item.pose = avatarPose;
+ return {node: avatar, data: item, type: item.type};
+ } else {
+
+ // when added to list
+ var thumb = domConst.toDom("\
+ <div>\
+ <table><tr><td>\
+ <img class=\"movieThumb\"/>\
+ <img class=\"removeThumb\" style=\"vertical-align: top; margin: -3px 0px 0px -8px; width: 20px; height: 20px;\"/>\
+ </td><td align=\"left\">\
+ <table><tr>\
+ <td>Frame:</td><td><div class=\"relFrameLength\"/></td>\
+ <td><div class=\"fillInSeries\" \></td>\
+ </tr><tr>\
+ <td>Transition:</td><td><div class=\"relTransitionLength\"/></td>\
+ </tr></table>\
+ </td></tr></table>\
+ </div>\
+ ");
+ thumb = dojo.query("div", thumb)[0];
+
+ var thumbImgElem = dojo.query("img.movieThumb", thumb)[0];
+ var removeImgElem = dojo.query("img.removeThumb", thumb)[0];
+ var relFrameLengthElem = dojo.query("div.relFrameLength", thumb)[0];
+ var relTransitionLengthElem = dojo.query("div.relTransitionLength", thumb)[0];
+ var fillInSeriesElem = dojo.query("div.fillInSeries", thumb)[0];
+
+ item.getThisAndNeighborsFromDnD = function() {
+ var thisAndNeighbors = {};
+ self.addToMovieHandler.forInItems(function(obj, key, ctx) {
+ if (obj.data === item) {
+ thisAndNeighbors.this = { key: key, obj: obj };
+ } else {
+ thisAndNeighbors.before = { key: key, obj: obj };
+ }
+ if (thisAndNeighbors.this) {
+ thisAndNeighbors.after = { key: key, obj: obj };
+ return thisAndNeighbors;
+ }
+ });
+ return thisAndNeighbors;
+ };
+
+ item.relFrameLengthSlider = new HorizontalSlider({
+ value: 50,
+ title: "Relative Duration of Frame",
+ style: "width:150px;"
+ }, relFrameLengthElem);
+
+ item.relTransitionLengthSlider = new HorizontalSlider({
+ value: 100,
+ title: "Relative Duration of Transition",
+ style: "width:150px;"
+ }, relTransitionLengthElem);
+
+ removeImgElem.onclick = function() {
+ var thisItem = item.getThisAndNeighborsFromDnD();
+ if (thisItem.this) {
+ // haha - what a mess!
+ self.addToMovieHandler.selectNone();
+ self.addToMovieHandler.selection[thisItem.this.key] = thisItem.this.obj;
+ self.addToMovieHandler.deleteSelectedNodes();
+ }
+ // disable create button if this was the last one
+ if (!thisItem.after || !thisItem.before) {
+ self.movieCreateButton.setAttribute('disabled', true);
+ }
+ }
+
+ item.fillInSeriesButton = new Button({
+ label: "Insert Series",
+ style: "display: none;",
+ onClick: function(){
+ alert("foo");
+ }
+ }, fillInSeriesElem);
+
+ removeImgElem.src = self.resRoot + "img/close.png";
+
+ var thumbPose = dojo.clone(self.pose);
+ thumbPose.width = self.pose.width / 10;
+ thumbPose.height = self.pose.height / 10;
+ var thumbImgUrl = urlSuffixForPose(thumbPose);
+
+ thumbImgElem.src = self.serverURL + self.imagePath + self.imageFormat + thumbImgUrl;
+ // removeImgElem.src = self.resRoot + 'img/close.png';
+
+ item.srcEcc = "VRMLViewer";
+ item.iconPoseUrl = self.imagePath + thumbImgUrl;
+ item.imagePath = self.imagePath;
+ item.serverURL = self.serverURL;
+ item.pose = thumbPose;
+
+ return {node: thumb, data: item, type: item.type};
+ }
+ };
+
+ self.addToMovieHandler = new Source(self.movieDnDArea, {copyOnly: true, creator: self.createMovieThumb});
+
+ self.movieFormatSelection = new Selector({
+ name: "movieFormat",
+ style: "width: 320px",
+ options: []
+ });
+ self.populateMovieCodecs(self.serverURL + '/movie/codecs', self.movieFormatSelection);
+
+ self.movieFormatLengthRowElem.appendChild(dojo.create('td', { innerHTML: 'Format:'} ));
+ self.movieFormatLengthRowElem.appendChild(dojo.create('td', { colspan: "2"}));
+ self.movieFormatLengthRowElem.lastChild.appendChild(self.movieFormatSelection.domNode);
+
+ self.movieHeightSpinner = new NumberSpinner({
+ value: 400,
+ smallDelta: 1,
+ style: "width: 60px",
+ constraints: { min:40, places:0 },
+ });
+
+ self.movieWidthSpinner = new NumberSpinner({
+ value: 600,
+ smallDelta: 1,
+ style: "width: 60px",
+ constraints: { min:40, places:0 },
+ });
+
+ self.movieCreateButton = new Button({
+ label: "Create",
+ disabled: true,
+ onClick: function(){
+
+ var form = document.createElement("form");
+
+ form.setAttribute("method", "post");
+ form.setAttribute("action", self.serverURL + "/movie");
+
+ var submitData = {};
+ submitData.frames = [];
+ submitData.movieLength = self.movieDurationSpinner.value;
+ submitData.format = self.movieFormatSelection.value;
+ submitData.width = self.movieWidthSpinner.value;
+ submitData.height = self.movieHeightSpinner.value;
+
+ self.addToMovieHandler.forInItems(function(obj, key, ctx) {
+ var jsonData = {
+ iconPoseUrl: obj.data.iconPoseUrl,
+ imagePath: obj.data.imagePath,
+ serverURL: obj.data.serverURL,
+ pose: obj.data.pose,
+ relFrameLength: obj.data.relFrameLengthSlider.value,
+ relTransitionLength: obj.data.relTransitionLengthSlider.value,
+ }
+ submitData.frames.push(jsonData);
+ });
+
+ var hiddenField = document.createElement("input");
+ hiddenField.setAttribute("type", "hidden");
+ hiddenField.setAttribute("name", "data");
+ hiddenField.setAttribute("value", JSON.stringify(submitData));
+
+ form.appendChild(hiddenField);
+
+ document.body.appendChild(form);
+ form.submit();
+ document.body.removeChild(form);
+ }
+ });
+
+ self.movieDurationSpinner = new NumberSpinner({
+ value: 10,
+ smallDelta: 1,
+ style: "width: 40px",
+ constraints: { min:0, places:0 },
+ });
+
+ // append format duration cell
+ self.movieWidthHeightLengthRowElem.appendChild(dojo.create('td', { innerHTML: 'Size:'} ));
+ var movieDimensionCell = dojo.create('td');
+ movieDimensionCell.appendChild(self.movieWidthSpinner.domNode);
+ movieDimensionCell.appendChild(dojo.create('span', { innerHTML: "x"} ));
+ movieDimensionCell.appendChild(self.movieHeightSpinner.domNode);
+ movieDimensionCell.appendChild(self.movieDurationSpinner.domNode);
+ movieDimensionCell.appendChild(dojo.create('span', { innerHTML: "sec"} ));
+ self.movieWidthHeightLengthRowElem.appendChild(movieDimensionCell);
+
+ self.movieWidthHeightLengthRowElem.appendChild(dojo.create('td', { align: "right"}));
+ self.movieWidthHeightLengthRowElem.lastChild.appendChild(self.movieCreateButton.domNode);
+
+
+ self.movieToolTip = new TooltipDialog({ content:self.movieDropDownContent });
+ self.movieDropDown = new DropDownButton({
+ label: "Movie",
+ style: "display: none;",
+ dropDown: self.movieToolTip });
+ self.movieDropDownElem.appendChild(self.movieDropDown.domNode);
+
+ self.movieAddButton = new Button({
+ label: "+",
+ style: "margin-left: -10px; display: none;",
+ onClick: function(){
+ if (self.movieFormatSelection.options.length == 0) {
+ self.populateMovieCodecs(self.serverURL + '/movie/codecs', self.movieFormatSelection);
+ }
+ // we could pass item.data here to creator
+ self.addToMovieHandler.insertNodes(false, [ { } ]);
+ self.movieCreateButton.setAttribute('disabled', false);
+
+ }
+ }, self.movieAddButtonElem);
+ } else {
+ // remove movie controls
+ var movieControls = dojo.query("td.movieControls", element)[0];
+ movieControls.parentNode.removeChild(movieControls);
+ }
+ }
+ activateMovies(self.enableMovies);
+
+ // do we have parameters for the initial pose?
+ if(self.params && self.params.pose)
+ self.setScene(self.params.imagePath, self.params.pose, self.params.serverURL);
+
+ if (self.serverURL) {
+ self.refreshServer(self.serverURL);
+ self.updateScene();
+ }
+
+ });
+ });
+
+};
diff --git a/apps/samples/vrml/viewer-webgl.js b/apps/samples/vrml/viewer-webgl.js
index e2d3c6c..19a589f 100644
--- a/apps/samples/vrml/viewer-webgl.js
+++ b/apps/samples/vrml/viewer-webgl.js
@@ -1,32 +1,24 @@
// Define the namespace
-// var eu_smartvorex_femkit_ui_modelviewer = eu_smartvorex_femkit_ui_modelviewer || {};
-
-// eu_smartvorex_femkit_ui_modelviewer.VRMLViewer = function (element, params) {
-VRMLViewer = function (element, params) {
- element.innerHTML = "<div name='vrmlviewer'/>";
-
- this.updatePose = function(pose) {
- console.log("Updating pose.");
- console.log("Pose = " + JSON.stringify(pose, null, 4));
- if (!pose.width) pose.width = self.pose.width;
- if (!pose.height) pose.height = self.pose.height;
- // this.setScene(this.imagePath, this.imageFormat, pose, this.serverURL);
- };
+var eu_smartvorex_femkit_ui_modelviewer = eu_smartvorex_femkit_ui_modelviewer || {};
+
+eu_smartvorex_femkit_ui_modelviewer.VRMLViewer = function (element, params) {
+
+ console.log(params);
// private attributes
var self = this;
var batchChanges = false;
var webGLManipulatorsSetup = false;
- var currWebGLModel = "";
// private instanceId
- // if (!eu_smartvorex_femkit_ui_modelviewer.VRMLViewer.instances)
- // eu_smartvorex_femkit_ui_modelviewer.VRMLViewer.instances = 0;
- // this.instanceId = eu_smartvorex_femkit_ui_modelviewer.VRMLViewer.instances++;
-
- if (!VRMLViewer.instances)
- VRMLViewer.instances = 0;
- this.instanceId = VRMLViewer.instances++;
+ // if (!VRMLViewer.instances)
+ // VRMLViewer.instances = 0;
+ // this.instanceId = VRMLViewer.instances++;
+
+ // private instanceId
+ if (!eu_smartvorex_femkit_ui_modelviewer.VRMLViewer.instances)
+ eu_smartvorex_femkit_ui_modelviewer.VRMLViewer.instances = 0;
+ this.instanceId = eu_smartvorex_femkit_ui_modelviewer.VRMLViewer.instances++;
// public attribute defaults
this.width = 450;
@@ -41,8 +33,10 @@ VRMLViewer = function (element, params) {
x: 0,
y: 0,
z: 0,
+ width: false,
+ height: false,
autorotate: false,
- };
+ }
this.pose = pose;
}
@@ -51,17 +45,17 @@ VRMLViewer = function (element, params) {
this.enableWebGL = true;
this.enableSceneshots = false;
this.enableDraggables = false;
+ this.enablePosePublishing = true;
this.treeNavigationStyle = true;
this.listNavigationStyle = true;
this.listDirectory = "";
- this.serverURL = "localhost:8080";
+ this.serverURL = "localhost:8082";
+ this.webSocketURL = "localhost:8083";
this.imagePath = "";
this.imageFormat = ".png";
this.resRoot = "";
- osg.setNotifyLevel(osg.ERROR);
-
// copy over values from constructor arguments
if (params) {
for (var param in params) {
@@ -78,6 +72,13 @@ VRMLViewer = function (element, params) {
if (!self.pose.height)
self.pose.height = self.height;
+ this.hasWebSockets = ("WebSocket" in window);
+
+ if (self.enablePosePublishing && !self.hasWebSockets) {
+ console.log("Your browser does not support WebSockets, deactivating pose publishing");
+ self.enablePosePublishing = false;
+ }
+
var hasWebGL = function() {
try {
if (!window.WebGLRenderingContext) {
@@ -95,17 +96,39 @@ VRMLViewer = function (element, params) {
return false;
}
return false;
- };
+ }
+ self.hasWebGL = hasWebGL();
if (self.enableWebGL && !hasWebGL()) {
- console.log("Your browser does no support WebGL, falling back to sceneshots");
+ console.log("Your browser does not support WebGL, falling back to sceneshots");
self.enableWebGL = false;
self.enableSceneshots = true;
}
- /**
- * normalize given parameters
- */
+ // see http://stackoverflow.com/questions/4810841/how-can-i-pretty-print-json-using-javascript
+ function syntaxHighlight(json) {
+ if (typeof json != 'string') {
+ json = JSON.stringify(json, undefined, 2);
+ }
+ json = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
+ return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
+ var cls = 'number';
+ if (/^"/.test(match)) {
+ if (/:$/.test(match)) {
+ cls = 'key';
+ } else {
+ cls = 'string';
+ }
+ } else if (/true|false/.test(match)) {
+ cls = 'boolean';
+ } else if (/null/.test(match)) {
+ cls = 'null';
+ }
+ return '<span class="' + cls + '">' + match + '</span>';
+ });
+ }
+
+ // normalize parameters
var normalizeParams = function() {
// make sure server url begins with protocol and does *not* ends in /
if (!self.serverURL.substring(0, 7) == "http://" &&
@@ -126,18 +149,14 @@ VRMLViewer = function (element, params) {
if (!self.imageFormat.substring(0, 1) !== ".")
self.imageFormat = "." + self.imageFormat;
- };
+ }
normalizeParams();
-
- /**
- * Fetch a remote WebGL model and return a future for it
- */
+
var getWebGLModel = function(url) {
- console.log("Loading " + url);
if (self.webGLStandby) { self.webGLStandby.show(); }
var defer = osgDB.Promise.defer();
var node = new osg.MatrixTransform();
- // node.setMatrix(osg.Matrix.makeRotate(-Math.PI/2, 1,0,0, []));
+ //node.setMatrix(osg.Matrix.makeRotate(-Math.PI/2, 1,0,0, []));
var loadModel = function(url) {
osg.log("loading " + url);
var req = new XMLHttpRequest();
@@ -146,36 +165,23 @@ VRMLViewer = function (element, params) {
if (req.readyState == 4) {
if(req.status == 200) {
osgDB.Promise.when(osgDB.parseSceneGraph(JSON.parse(req.responseText))).then(function(child) {
-
- console.log("Loaded " + url);
-
- var rotate = [];
- osg.Matrix.makeIdentity(rotate);
- // osg.Matrix.preMult(rotate, osg.Matrix.makeRotate(Math.PI/2.0, 1,0,0,[]));
- // osg.Matrix.preMult(rotate, osg.Matrix.makeRotate(Math.PI, 0,1,0,[]));
-
- node.setMatrix(rotate);
+ node.setMatrix(osg.Matrix.makeRotate(Math.PI/2.0, 1,0,0,[]));
node.addChild(child);
defer.resolve(node);
osg.log("success " + url);
-
});
- if (self.webGLStandby) { self.webGLStandby.hide(); }
} else {
osg.log("error " + url);
- if (self.webGLStandby) { self.webGLStandby.hide(); }
}
+ if (self.webGLStandby) { self.webGLStandby.hide(); }
}
};
req.send(null);
};
loadModel(url);
return defer.promise;
- };
+ }
- /**
- * Concatenate pose as query string
- */
var urlSuffixForPose = function(pose) {
var queryString =
'?width=' + pose.width +
@@ -191,16 +197,7 @@ VRMLViewer = function (element, params) {
return queryString;
};
- /**
- * Get relative position of two elements
- */
var moverRelativeTo = function(mover, container) {
- // 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};
- };
-
var containerPos = absolutePosition(container);
return {
x: mover.x - containerPos.x,
@@ -208,59 +205,37 @@ VRMLViewer = function (element, params) {
};
};
- var eulerToMatrix = function(pitch, roll, yaw) {
- // see http://www.flipcode.com/documents/matrfaq.html#Q36
- var m = osg.Matrix.makeIdentity([]);
-
- var A = Math.cos(pitch);
- var B = Math.sin(pitch);
- var C = Math.cos(roll);
- var D = Math.sin(roll);
- var E = Math.cos(yaw);
- var F = Math.sin(yaw);
- var AD = A * D;
- var BD = B * D;
-
- osg.Matrix.setRow(m, 0, (C * E), (-C * F), (-D), 0);
- osg.Matrix.setRow(m, 1, (-BD * E + A * F), (BD * F + A * E), (-B * C), 0);
- osg.Matrix.setRow(m, 2, (AD * E + B * F), (-AD * F + B * E), (A * C), 0);
- osg.Matrix.setRow(m, 3, 0, 0, 0, 1);
-
- return m;
- }
+ // 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};
+ };
- var matrixToEuler = function(m) {
- // see: http://www.flipcode.com/documents/matrfaq.html#Q37
- var angleX = 0;
- var angleZ = 0;
- var D = -1 * Math.asin(osg.Matrix.get(m,0,2)); /* Calculate Y-axis angle */
- var angleY = D;
- var C = Math.cos(angleY);
-
- /* Gimbal lock? */
- if (Math.abs(C) > 0.005) {
- var tr_x = osg.Matrix.get(m,2,2) / C; /* No, so get X-axis angle */
- var tr_y = -1 * osg.Matrix.get(m,1,2) / C;
- angleX = Math.atan2( tr_y, tr_x );
- tr_x = osg.Matrix.get(m,0,0) / C; /* Get Z-axis angle */
- tr_y = -1 * osg.Matrix.get(m,0,1) / C;
- angleZ = Math.atan2( tr_y, tr_x );
- } else {
- /* Gimball lock has occurred */
- angleX = 0; /* Set X-axis angle to zero */
- var tr_x = osg.Matrix.get(m,1,1); /* And calculate Z-axis angle */
- var tr_y = osg.Matrix.get(m,1,0);
- angleZ = Math.atan2( tr_y, tr_x );
+ // update the scene
+ this.updateScene = function() {
+ if (self.serverURL && self.imagePath && !self.batchChanges) {
+ console.log(self.serverURL + self.imagePath + self.imageFormat + urlSuffixForPose(self.pose));
+ if (self.enableWebGL) {
+ osgDB.Promise.when(getWebGLModel(self.serverURL + self.imagePath + '.osgjs')).then(function(model) {
+ self.webGLViewer.setSceneData(model);
+ if (!webGLManipulatorsSetup) {
+ self.webGLViewer.setupManipulator(new osgGA.OrbitManipulator(), false);
+ self.webGLViewer.getManipulator().computeHomePosition();
+ }
+ webGLManipulatorsSetup = true;
+ });
+ }
+ if (self.enableSceneshots) {
+ self.imgElem.src = self.serverURL + self.imagePath + self.imageFormat + urlSuffixForPose(self.pose);
+ if (self.enableMovies && self.movieAddButton) {
+ // we are showing an image, activate movie controls
+ self.movieAddButton.domNode.style.display = "";
+ self.movieDropDown.domNode.style.display = "";
+ }
+ }
}
-
- /* Clamp all angles to range */
- return {
- pitch: angleX % (2 * 3.14159),
- roll: angleY % (2 * 3.14159),
- yaw: angleZ % (2 * 3.14159)
- };
- }
-
+ };
+
// get list of supported ffmpeg codecs from server
this.populateMovieCodecs = function(server, selectElem) {
self.xhr.get({
@@ -288,20 +263,17 @@ VRMLViewer = function (element, params) {
codec !== "y41p" &&
codec !== "yuv4")
continue;
- // console.log(codec);
+ //console.log(codec);
selectElem.options.push({ label: result.video[codec].longName, value: codec });
if (codec === "mpeg4")
selectElem.options[selectElem.options.length - 1].selected = true;
}
}
});
- };
+ }
// update list of vrml files from server
this.refreshServer = function(server, params) {
- if (!self.listNavigationStyle && !self.treeNavigationStyle)
- return;
-
self.serverURL = server;
if (!params)
params = {};
@@ -335,7 +307,7 @@ VRMLViewer = function (element, params) {
}
},
load: function(result) {
-// self.localStorage.put("vrmlServer", self.serverURL, null);
+// self.localStorage.put("vrmlServer", self.serverURL, null);
if (self.browseButton) { self.browseButton.setAttribute('label', 'Refresh'); }
if (self.fileStandby) { self.fileStandby.hide(); }
@@ -387,132 +359,38 @@ VRMLViewer = function (element, params) {
}
self.fileListSelect.startup();
}
- // self.updateScene();
+ //self.updateScene();
}
});
};
- this.getPose = function() {
- if (self.webGLViewer && self.webGLViewer.getSceneData()) {
- var rotate = [];
- osg.Matrix.makeIdentity(rotate);
-
- osg.Matrix.preMult(rotate, osg.Matrix.makeRotate(Math.PI/2.0, 1,0,0,[]));
- osg.Matrix.preMult(rotate, osg.Matrix.makeRotate(Math.PI, 0,1,0,[]));
- osg.Matrix.postMult(self.webGLViewer.getSceneData().getMatrix(), rotate);
-
- var pose = matrixToEuler(rotate);
- return pose;
- } else {
- return {
- pitch: self.pose.pitch,
- roll: self.pose.roll,
- yaw: self.pose.yaw,
- }
- }
- }
-
- this.setPose = function(pose) {
- this.setScene(self.imagePath, self.imageFormat, pose, self.serverURL);
- }
-
- this.setScene = function(imagePath, imageFormat, pose, serverURL) {
-
+ this.setPose = function(imagePath, imageFormat, pose, serverURL) {
if (serverURL && serverURL != self.serverURL) {
self.refreshServer(serverURL);
}
-
self.imagePath = imagePath;
self.imageFormat = imageFormat;
+ self.pose = pose;
- for (var key in pose) {
- self.pose[key] = pose[key];
- }
+ var pitch = (pose.pitch % (2 * 3.14159) + 0.5) * 100;
+ var roll = (pose.roll % (2 * 3.14159) + 0.5) * 100;
+ var yaw = (pose.yaw % (2 * 3.14159) + 0.5) * 100;
+
+ var x = ((pose.x / 100) + 0.5) * 100;
+ var y = ((pose.y / 100) + 0.5) * 100;
- self.pose.pitch = (2 * 3.14159 + self.pose.pitch) % (2 * 3.14159);
- self.pose.roll = (2 * 3.14159 + self.pose.roll) % (2 * 3.14159);
- self.pose.yaw = (2 * 3.14159 + self.pose.yaw) % (2 * 3.14159);
-
- var pitch = (self.pose.pitch / (2 * 3.14159) + 0.5) * 100;
- var roll = (self.pose.roll / (2 * 3.14159) + 0.5) * 100;
- var yaw = (self.pose.yaw / (2 * 3.14159) + 0.5) * 100;
- var x = ((self.pose.x / 100) + 0.5) * 100;
- var y = ((self.pose.y / 100) + 0.5) * 100;
- var zoom = (((self.pose.zoom - 1) / 3) + 0.5) * 100;
-
- // console.log("pitch: " + pitch);
-
- if (self.pitchRollHandlerElem) self.pitchRollHandlerElem.parentNode.style.right = pitch + "%";
- if (self.pitchRollHandlerElem) self.pitchRollHandlerElem.parentNode.style.top = roll + "%";
- if (self.yawZoomHandlerElem) self.yawZoomHandlerElem.parentNode.style.right = yaw + "%";
- if (self.yawZoomHandlerElem) self.yawZoomHandlerElem.parentNode.style.top = zoom + "%";
- if (self.xyHandlerElem) self.xyHandlerElem.parentNode.style.right = x + "%";
- if (self.xyHandlerElem) self.xyHandlerElem.parentNode.style.top = y + "%";
+ var zoom = (((pose.zoom - 1) / 3) + 0.5) * 100;
+
+ self.pitchRollHandlerElem.parentNode.style.right = pitch + "%";
+ self.pitchRollHandlerElem.parentNode.style.top = roll + "%";
+ self.yawZoomHandlerElem.parentNode.style.right = yaw + "%";
+ self.yawZoomHandlerElem.parentNode.style.top = zoom + "%";
+ self.xyHandlerElem.parentNode.style.right = x + "%";
+ self.xyHandlerElem.parentNode.style.top = y + "%";
self.updateScene();
};
- // update the scene
- this.updateScene = function() {
- if (self.serverURL && self.imagePath && !self.batchChanges) {
- // console.log(self.serverURL + self.imagePath + self.imageFormat + urlSuffixForPose(self.pose));
-
- if (self.enableWebGL) {
- var setWebGLPose = function() {
-
- // reset camera controls
- self.webGLViewer.getManipulator().reset();
- self.webGLViewer.getManipulator().computeHomePosition();
-
- var bs = self.webGLViewer.getSceneData().getBound();
- var zoom = 1; //self.pose.zoom || 10;
- var eye = [0, 0, bs.radius() * (1.9 * zoom)];
- // var center = bs.center();
- // var up = [1,1,0];
-
- self.webGLViewer.getManipulator().setEyePosition(eye);
-
- // var poseMatrix = eulerToMatrix(self.pose.pitch, self.pose.yaw, -1 * self.pose.roll);
- var poseMatrix = eulerToMatrix(self.pose.pitch * -1, self.pose.roll * -1, self.pose.yaw);
-
- var rotate = [];
- osg.Matrix.makeIdentity(rotate);
- // osg.Matrix.preMult(rotate, osg.Matrix.makeRotate(Math.PI/2.0, 1,0,0,[]));
- // osg.Matrix.preMult(rotate, osg.Matrix.makeRotate(Math.PI, 0,1,0,[]));
- osg.Matrix.postMult(poseMatrix, rotate);
-
- // osg.Matrix.preMult(rotate, poseMatrix);
- self.webGLViewer.getSceneData().setMatrix(rotate);
-
- }
-
- if (self.imagePath != currWebGLModel) {
- currWebGLModel = self.imagePath;
- osgDB.Promise.when(getWebGLModel(self.serverURL + self.imagePath + '.osgjs')).then(function(model) {
- self.webGLViewer.setSceneData(model);
- if (!webGLManipulatorsSetup) {
- self.webGLViewer.setupManipulator(new osgGA.OrbitManipulator(), false);
- self.webGLViewer.getManipulator().computeHomePosition();
- }
- webGLManipulatorsSetup = true;
- setWebGLPose();
- });
- }
- if (self.webGLViewer && currWebGLModel == self.imagePath && self.webGLViewer.getSceneData()) {
- setWebGLPose();
- }
- }
- if (self.enableSceneshots) {
- self.imgElem.src = self.serverURL + self.imagePath + self.imageFormat + urlSuffixForPose(self.pose);
- if (self.enableMovies && self.movieAddButton) {
- // we are showing an image, activate movie controls
- self.movieAddButton.domNode.style.display = "";
- self.movieDropDown.domNode.style.display = "";
- }
- }
- }
- };
-
require(["dojo/dom-construct",
"dojo/_base/xhr",
"dojo/dom",
@@ -662,7 +540,17 @@ VRMLViewer = function (element, params) {
self.canvasElem.style.height = self.height;
self.canvasElem.width = self.width;
self.canvasElem.height = self.height;
-
+
+ // osgDB.Promise.when(getWebGLModel('http://localhost:8081/vrml/cranehook/cranehook_bad_convergence/HARD_MP_VAL_013.osgjs')).then(function(model) {
+ // self.webGLViewer = new osgViewer.Viewer(self.canvasElem, {antialias : true, alpha: true });
+ // self.webGLViewer.init();
+ // self.webGLViewer.getCamera().setClearColor([0.0, 0.0, 0.0, 0.0]);
+ // self.webGLViewer.setSceneData(model);
+ // self.webGLViewer.setupManipulator();
+ // self.webGLViewer.getManipulator().computeHomePosition();
+ // self.webGLViewer.run();
+ // });
+
if (self.webGLViewer === undefined) {
self.webGLViewer = new osgViewer.Viewer(self.canvasElem, {antialias : true, alpha: true });
self.webGLViewer.init();
@@ -677,7 +565,7 @@ VRMLViewer = function (element, params) {
// show elements
array.forEach(dojo.query(".webGL", element), function(entry, i) {
entry.style.display = "inline";
- });
+ })
} else {
if (self.webGLViewer) {
self.webGLViewer.stop();
@@ -685,9 +573,9 @@ VRMLViewer = function (element, params) {
// hide elements
array.forEach(dojo.query(".webGL", element), function(entry, i) {
entry.style.display = "none";
- });
+ })
}
- };
+ }
activateWebGL(self.enableWebGL);
var activateScreenshot = function(enable) {
@@ -700,13 +588,13 @@ VRMLViewer = function (element, params) {
entry.style.display = "none";
});
}
- };
+ }
activateScreenshot(self.enableSceneshots);
-
/**
* === POSE MANIPULATION AND RESET ====================
*/
+
self.resetButtonElem = dojo.query("button.resetButton", element)[0];
self.resetButton = new Button({
label: "Reset",
@@ -722,12 +610,12 @@ VRMLViewer = function (element, params) {
self.pose.yaw = 0;
self.pose.zoom = 1;
- if (self.xyHandler) self.xyHandler.node.style.left = 0;
- if (self.xyHandler) self.xyHandler.node.style.top = 0;
- if (self.pitchRollHandler) self.pitchRollHandler.node.style.left = 0;
- if (self.pitchRollHandler) self.pitchRollHandler.node.style.top = 0;
- if (self.yawZoomHandler) self.yawZoomHandler.node.style.left = 0;
- if (self.yawZoomHandler) self.yawZoomHandler.node.style.top = 0;
+ self.xyHandler.node.style.left = 0;
+ self.xyHandler.node.style.top = 0;
+ self.pitchRollHandler.node.style.left = 0;
+ self.pitchRollHandler.node.style.top = 0;
+ self.yawZoomHandler.node.style.left = 0;
+ self.yawZoomHandler.node.style.top = 0;
self.updateScene();
}
@@ -847,15 +735,15 @@ VRMLViewer = function (element, params) {
// show all draggables
array.forEach(dojo.query(".draggable", element), function(entry, i) {
entry.style.display = "inline";
- });
+ })
} else {
// show all draggables
array.forEach(dojo.query(".draggable", element), function(entry, i) {
entry.style.display = "none";
- });
+ })
}
- };
+ }
activateDraggables(self.enableDraggables);
/**
@@ -889,16 +777,15 @@ VRMLViewer = function (element, params) {
array.forEach(dojo.query(".dndHandler", element), function(entry, i) {
entry.style.display = "inline";
- });
+ })
} else {
array.forEach(dojo.query(".dndHandler", element), function(entry, i) {
entry.style.display = "none";
- });
+ })
}
- };
-
+ }
activateDND(self.enableDND);
/**
@@ -959,10 +846,10 @@ VRMLViewer = function (element, params) {
var allItems = self.fileListStore.query();
var foundAt = 0;
for (var i = 0; i < allItems.total; i++) {
- // console.log(self.serverURL + self.imagePath + " === " + allItems[i].url);
+ //console.log(self.serverURL + self.imagePath + " === " + allItems[i].url);
if (self.serverURL + self.imagePath === allItems[i].url) {
foundAt = i;
- break;
+ break
}
}
if (foundAt + 1 < allItems.total) {
@@ -980,7 +867,7 @@ VRMLViewer = function (element, params) {
entry.style.display = "none";
});
}
- };
+ }
activateListNavigation(self.listNavigationStyle);
var activateTreeNavigation = function(enable) {
@@ -1032,6 +919,7 @@ VRMLViewer = function (element, params) {
return { backgroundImage: "url('" + self.serverURL + item.url + self.imageFormat + "?width=16&height=16')"};
}
}
+ //return {backgroundImage: "url('" + item.url + "?width=16&height=16')"};
});
self.filesDropDownElem = dojo.query("td.filesDropDown", element)[0];
@@ -1085,269 +973,318 @@ VRMLViewer = function (element, params) {
entry.style.display = "none";
});
}
- };
-
+ }
activateTreeNavigation(self.treeNavigationStyle);
+ if (self.serverURL) {
+ self.refreshServer(self.serverURL);
+ self.updateScene();
+ }
+
+
+ /**
+ * === Pose Publishing ====================
+ */
+
+ var activatePosePublishing = function(enable) {
+ if (enable && self.hasWebSockets) {
+ self.poseWebSocket = new WebSocket(self.webSocketURL);
+
+ self.poseWebSocket.onopen = function(evt) {
+ foo = 0;
+ function publishPose() {
+ foo++;
+ var viewMatrix = self.webGLViewer.getCamera().getViewMatrix();
+ var roundMatrix = [];
+ for (var i = 0; i < 16; i++) {
+ roundMatrix[i] = viewMatrix[i].toFixed(5);
+ if (roundMatrix[i] == -0.0) roundMatrix[i] = 0.0;
+ }
+ self.poseWebSocket.send(JSON.stringify(roundMatrix));
+ self.messageBox.innerHTML = "<pre>SEND" + syntaxHighlight(roundMatrix) + "</pre>";
+ // self.poseWebSocket.send(foo);
+ // self.messageBox.innerHTML = "<pre>SEND" + foo + "</pre>";
+ if (self.enablePosePublishing) {
+ setTimeout(publishPose, 200);
+ }
+ }
+ self.messageBox.innerHTML = "<pre>Starting</pre>";
+ publishPose();
+ };
+ self.poseWebSocket.onclose = function(evt) {
+ };
+ self.poseWebSocket.onmessage = function(evt) {
+ var result = JSON.parse(evt.data);
+ self.messageBox.innerHTML = "<pre>RCVD" + syntaxHighlight(JSON.parse(result.data.content)) + "</pre>";
+ };
+ self.poseWebSocket.onerror = function(evt) {
+ };
+ } else {
+
+ }
+ }
+ activatePosePublishing(self.enablePosePublishing);
+
/**
* === MOVIE DROPDOWN ====================
*/
- var activateMovies = function(enable) {
- if (enable) {
- self.movieDropDownElem = dojo.query("div.movieDropDown", element)[0];
- self.movieAddButtonElem = dojo.query("button.movieAddButton", element)[0];
-
- self.movieDropDownContent = domConst.toDom(
- '<div style="overflow: auto; max-height: 420px;"> \
- <table><tr class="movieFormatLengthRow" /></tr><tr class="movieWidthHeightLengthRow" /></table> \
- <div class=\"dndArea\" /> \
- </div>'
- );
+ if (self.enableMovies) {
+ self.movieDropDownElem = dojo.query("div.movieDropDown", element)[0];
+ self.movieAddButtonElem = dojo.query("button.movieAddButton", element)[0];
+
+ self.movieDropDownContent = domConst.toDom(
+ '<div style="overflow: auto; max-height: 420px;"> \
+ <table><tr class="movieFormatLengthRow" /></tr><tr class="movieWidthHeightLengthRow" /></table> \
+ <div class=\"dndArea\" /> \
+ </div>'
+ );
- self.movieFormatLengthRowElem = dojo.query("tr.movieFormatLengthRow", self.movieDropDownContent)[0];
- self.movieWidthHeightLengthRowElem = dojo.query("tr.movieWidthHeightLengthRow", self.movieDropDownContent)[0];
- self.movieDnDArea = dojo.query("div.dndArea", self.movieDropDownContent)[0];
+ self.movieFormatLengthRowElem = dojo.query("tr.movieFormatLengthRow", self.movieDropDownContent)[0];
+ self.movieWidthHeightLengthRowElem = dojo.query("tr.movieWidthHeightLengthRow", self.movieDropDownContent)[0];
+ self.movieDnDArea = dojo.query("div.dndArea", self.movieDropDownContent)[0];
- self.createMovieThumb = function(item, mode) {
- if (mode == 'avatar') {
- // when dragged
- var avatar = dojo.create( 'div', { innerHTML: item.data });
- var avatarPose = dojo.clone(self.pose);
- avatarPose.width = 60;
- avatarPose.height = 60;
- var avatarImgUrl = urlSuffixForPose(avatarPose);
- avatar.innerHTML = '<img src=' + self.imagePath + self.imageFormat + avatarImgUrl + ' /> ';
- item.srcEcc = "VRMLViewer";
- item.iconPoseUrl = self.imagePath + avatarImgUrl;
- item.imagePath = self.imagePath;
- item.serverURL = self.serverURL;
- item.pose = avatarPose;
- return {node: avatar, data: item, type: item.type};
- } else {
-
- // when added to list
- var thumb = domConst.toDom("\
- <div>\
- <table><tr><td>\
- <img class=\"movieThumb\"/>\
- <img class=\"removeThumb\" style=\"vertical-align: top; margin: -3px 0px 0px -8px; width: 20px; height: 20px;\"/>\
- </td><td align=\"left\">\
- <table><tr>\
- <td>Frame:</td><td><div class=\"relFrameLength\"/></td>\
- <td><div class=\"fillInSeries\" \></td>\
- </tr><tr>\
- <td>Transition:</td><td><div class=\"relTransitionLength\"/></td>\
- </tr></table>\
- </td></tr></table>\
- </div>\
- ");
- thumb = dojo.query("div", thumb)[0];
+ self.createMovieThumb = function(item, mode) {
+ if (mode == 'avatar') {
+ // when dragged
+ var avatar = dojo.create( 'div', { innerHTML: item.data });
+ var avatarPose = dojo.clone(self.pose);
+ avatarPose.width = 60;
+ avatarPose.height = 60;
+ var avatarImgUrl = urlSuffixForPose(avatarPose);
+ avatar.innerHTML = '<img src=' + self.imagePath + self.imageFormat + avatarImgUrl + ' /> ';
+ item.srcEcc = "VRMLViewer";
+ item.iconPoseUrl = self.imagePath + avatarImgUrl;
+ item.imagePath = self.imagePath;
+ item.serverURL = self.serverURL;
+ item.pose = avatarPose;
+ return {node: avatar, data: item, type: item.type};
+ } else {
- var thumbImgElem = dojo.query("img.movieThumb", thumb)[0];
- var removeImgElem = dojo.query("img.removeThumb", thumb)[0];
- var relFrameLengthElem = dojo.query("div.relFrameLength", thumb)[0];
- var relTransitionLengthElem = dojo.query("div.relTransitionLength", thumb)[0];
- var fillInSeriesElem = dojo.query("div.fillInSeries", thumb)[0];
+ // when added to list
+ var thumb = domConst.toDom("\
+ <div>\
+ <table><tr><td>\
+ <img class=\"movieThumb\"/>\
+ <img class=\"removeThumb\" style=\"vertical-align: top; margin: -3px 0px 0px -8px; width: 20px; height: 20px;\"/>\
+ </td><td align=\"left\">\
+ <table><tr>\
+ <td>Frame:</td><td><div class=\"relFrameLength\"/></td>\
+ <td><div class=\"fillInSeries\" \></td>\
+ </tr><tr>\
+ <td>Transition:</td><td><div class=\"relTransitionLength\"/></td>\
+ </tr></table>\
+ </td></tr></table>\
+ </div>\
+ ");
+ thumb = dojo.query("div", thumb)[0];
- item.getThisAndNeighborsFromDnD = function() {
- var thisAndNeighbors = {};
- self.addToMovieHandler.forInItems(function(obj, key, ctx) {
- if (obj.data === item) {
- thisAndNeighbors.this = { key: key, obj: obj };
- } else {
- thisAndNeighbors.before = { key: key, obj: obj };
- }
- if (thisAndNeighbors.this) {
- thisAndNeighbors.after = { key: key, obj: obj };
- return thisAndNeighbors;
- }
- });
- return thisAndNeighbors;
- };
+ var thumbImgElem = dojo.query("img.movieThumb", thumb)[0];
+ var removeImgElem = dojo.query("img.removeThumb", thumb)[0];
+ var relFrameLengthElem = dojo.query("div.relFrameLength", thumb)[0];
+ var relTransitionLengthElem = dojo.query("div.relTransitionLength", thumb)[0];
+ var fillInSeriesElem = dojo.query("div.fillInSeries", thumb)[0];
- item.relFrameLengthSlider = new HorizontalSlider({
- value: 50,
- title: "Relative Duration of Frame",
- style: "width:150px;"
- }, relFrameLengthElem);
-
- item.relTransitionLengthSlider = new HorizontalSlider({
- value: 100,
- title: "Relative Duration of Transition",
- style: "width:150px;"
- }, relTransitionLengthElem);
-
- removeImgElem.onclick = function() {
- var thisItem = item.getThisAndNeighborsFromDnD();
- if (thisItem.this) {
- // haha - what a mess!
- self.addToMovieHandler.selectNone();
- self.addToMovieHandler.selection[thisItem.this.key] = thisItem.this.obj;
- self.addToMovieHandler.deleteSelectedNodes();
+ item.getThisAndNeighborsFromDnD = function() {
+ var thisAndNeighbors = {};
+ self.addToMovieHandler.forInItems(function(obj, key, ctx) {
+ if (obj.data === item) {
+ thisAndNeighbors.this = { key: key, obj: obj };
+ } else {
+ thisAndNeighbors.before = { key: key, obj: obj };
}
- // disable create button if this was the last one
- if (!thisItem.after || !thisItem.before) {
- self.movieCreateButton.setAttribute('disabled', true);
+ if (thisAndNeighbors.this) {
+ thisAndNeighbors.after = { key: key, obj: obj };
+ return thisAndNeighbors;
}
+ });
+ return thisAndNeighbors;
+ };
+
+ item.relFrameLengthSlider = new HorizontalSlider({
+ value: 50,
+ title: "Relative Duration of Frame",
+ style: "width:150px;"
+ }, relFrameLengthElem);
+
+ item.relTransitionLengthSlider = new HorizontalSlider({
+ value: 100,
+ title: "Relative Duration of Transition",
+ style: "width:150px;"
+ }, relTransitionLengthElem);
+
+ removeImgElem.onclick = function() {
+ var thisItem = item.getThisAndNeighborsFromDnD();
+ if (thisItem.this) {
+ // haha - what a mess!
+ self.addToMovieHandler.selectNone();
+ self.addToMovieHandler.selection[thisItem.this.key] = thisItem.this.obj;
+ self.addToMovieHandler.deleteSelectedNodes();
}
+ // disable create button if this was the last one
+ if (!thisItem.after || !thisItem.before) {
+ self.movieCreateButton.setAttribute('disabled', true);
+ }
+ }
- item.fillInSeriesButton = new Button({
- label: "Insert Series",
- style: "display: none;",
- onClick: function(){
- alert("foo");
- }
- }, fillInSeriesElem);
+ item.fillInSeriesButton = new Button({
+ label: "Insert Series",
+ style: "display: none;",
+ onClick: function(){
+ alert("foo");
+ }
+ }, fillInSeriesElem);
- removeImgElem.src = self.resRoot + "img/close.png";
+ removeImgElem.src = self.resRoot + "img/close.png";
- var thumbPose = dojo.clone(self.pose);
- thumbPose.width = self.pose.width / 10;
- thumbPose.height = self.pose.height / 10;
- var thumbImgUrl = urlSuffixForPose(thumbPose);
+ var thumbPose = dojo.clone(self.pose);
+ thumbPose.width = self.pose.width / 10;
+ thumbPose.height = self.pose.height / 10;
+ var thumbImgUrl = urlSuffixForPose(thumbPose);
- thumbImgElem.src = self.serverURL + self.imagePath + self.imageFormat + thumbImgUrl;
- // removeImgElem.src = self.resRoot + 'img/close.png';
+ thumbImgElem.src = self.serverURL + self.imagePath + self.imageFormat + thumbImgUrl;
+ // removeImgElem.src = self.resRoot + 'img/close.png';
- item.srcEcc = "VRMLViewer";
- item.iconPoseUrl = self.imagePath + thumbImgUrl;
- item.imagePath = self.imagePath;
- item.serverURL = self.serverURL;
- item.pose = thumbPose;
+ item.srcEcc = "VRMLViewer";
+ item.iconPoseUrl = self.imagePath + thumbImgUrl;
+ item.imagePath = self.imagePath;
+ item.serverURL = self.serverURL;
+ item.pose = thumbPose;
- return {node: thumb, data: item, type: item.type};
- }
- };
+ return {node: thumb, data: item, type: item.type};
+ }
+ };
- self.addToMovieHandler = new Source(self.movieDnDArea, {copyOnly: true, creator: self.createMovieThumb});
+ self.addToMovieHandler = new Source(self.movieDnDArea, {copyOnly: true, creator: self.createMovieThumb});
- self.movieFormatSelection = new Selector({
- name: "movieFormat",
- style: "width: 320px",
- options: []
- });
- self.populateMovieCodecs(self.serverURL + '/movie/codecs', self.movieFormatSelection);
+ self.movieFormatSelection = new Selector({
+ name: "movieFormat",
+ style: "width: 320px",
+ options: []
+ });
+ self.populateMovieCodecs(self.serverURL + '/movie/codecs', self.movieFormatSelection);
- self.movieFormatLengthRowElem.appendChild(dojo.create('td', { innerHTML: 'Format:'} ));
- self.movieFormatLengthRowElem.appendChild(dojo.create('td', { colspan: "2"}));
- self.movieFormatLengthRowElem.lastChild.appendChild(self.movieFormatSelection.domNode);
+ self.movieFormatLengthRowElem.appendChild(dojo.create('td', { innerHTML: 'Format:'} ));
+ self.movieFormatLengthRowElem.appendChild(dojo.create('td', { colspan: "2"}));
+ self.movieFormatLengthRowElem.lastChild.appendChild(self.movieFormatSelection.domNode);
- self.movieHeightSpinner = new NumberSpinner({
- value: 400,
- smallDelta: 1,
- style: "width: 60px",
- constraints: { min:40, places:0 },
- });
+ self.movieHeightSpinner = new NumberSpinner({
+ value: 400,
+ smallDelta: 1,
+ style: "width: 60px",
+ constraints: { min:40, places:0 },
+ });
- self.movieWidthSpinner = new NumberSpinner({
- value: 600,
- smallDelta: 1,
- style: "width: 60px",
- constraints: { min:40, places:0 },
- });
+ self.movieWidthSpinner = new NumberSpinner({
+ value: 600,
+ smallDelta: 1,
+ style: "width: 60px",
+ constraints: { min:40, places:0 },
+ });
- self.movieCreateButton = new Button({
- label: "Create",
- disabled: true,
- onClick: function(){
+ self.movieCreateButton = new Button({
+ label: "Create",
+ disabled: true,
+ onClick: function(){
- var form = document.createElement("form");
+ var form = document.createElement("form");
- form.setAttribute("method", "post");
- form.setAttribute("action", self.serverURL + "/movie");
+ form.setAttribute("method", "post");
+ form.setAttribute("action", self.serverURL + "/movie");
- var submitData = {};
- submitData.frames = [];
- submitData.movieLength = self.movieDurationSpinner.value;
- submitData.format = self.movieFormatSelection.value;
- submitData.width = self.movieWidthSpinner.value;
- submitData.height = self.movieHeightSpinner.value;
+ var submitData = {};
+ submitData.frames = [];
+ submitData.movieLength = self.movieDurationSpinner.value;
+ submitData.format = self.movieFormatSelection.value;
+ submitData.width = self.movieWidthSpinner.value;
+ submitData.height = self.movieHeightSpinner.value;
- self.addToMovieHandler.forInItems(function(obj, key, ctx) {
- var jsonData = {
- iconPoseUrl: obj.data.iconPoseUrl,
- imagePath: obj.data.imagePath,
- serverURL: obj.data.serverURL,
- pose: obj.data.pose,
- relFrameLength: obj.data.relFrameLengthSlider.value,
- relTransitionLength: obj.data.relTransitionLengthSlider.value,
- }
- submitData.frames.push(jsonData);
- });
+ self.addToMovieHandler.forInItems(function(obj, key, ctx) {
+ var jsonData = {
+ iconPoseUrl: obj.data.iconPoseUrl,
+ imagePath: obj.data.imagePath,
+ serverURL: obj.data.serverURL,
+ pose: obj.data.pose,
+ relFrameLength: obj.data.relFrameLengthSlider.value,
+ relTransitionLength: obj.data.relTransitionLengthSlider.value,
+ }
+ submitData.frames.push(jsonData);
+ });
- var hiddenField = document.createElement("input");
- hiddenField.setAttribute("type", "hidden");
- hiddenField.setAttribute("name", "data");
- hiddenField.setAttribute("value", JSON.stringify(submitData));
+ var hiddenField = document.createElement("input");
+ hiddenField.setAttribute("type", "hidden");
+ hiddenField.setAttribute("name", "data");
+ hiddenField.setAttribute("value", JSON.stringify(submitData));
- form.appendChild(hiddenField);
-
- document.body.appendChild(form);
- form.submit();
- document.body.removeChild(form);
- }
- });
+ form.appendChild(hiddenField);
+
+ // this will not save the returned binary file
+ // self.xhr.post({
+ // form: form,
+ // load: function(data){
+ // alert("asd");
+ // }
+ // });
+
+ document.body.appendChild(form);
+ form.submit();
+ document.body.removeChild(form);
+ }
+ });
- self.movieDurationSpinner = new NumberSpinner({
- value: 10,
- smallDelta: 1,
- style: "width: 40px",
- constraints: { min:0, places:0 },
- });
+ self.movieDurationSpinner = new NumberSpinner({
+ value: 10,
+ smallDelta: 1,
+ style: "width: 40px",
+ constraints: { min:0, places:0 },
+ });
- // append format duration cell
- self.movieWidthHeightLengthRowElem.appendChild(dojo.create('td', { innerHTML: 'Size:'} ));
- var movieDimensionCell = dojo.create('td');
- movieDimensionCell.appendChild(self.movieWidthSpinner.domNode);
- movieDimensionCell.appendChild(dojo.create('span', { innerHTML: "x"} ));
- movieDimensionCell.appendChild(self.movieHeightSpinner.domNode);
- movieDimensionCell.appendChild(self.movieDurationSpinner.domNode);
- movieDimensionCell.appendChild(dojo.create('span', { innerHTML: "sec"} ));
- self.movieWidthHeightLengthRowElem.appendChild(movieDimensionCell);
-
- self.movieWidthHeightLengthRowElem.appendChild(dojo.create('td', { align: "right"}));
- self.movieWidthHeightLengthRowElem.lastChild.appendChild(self.movieCreateButton.domNode);
-
-
- self.movieToolTip = new TooltipDialog({ content:self.movieDropDownContent });
- self.movieDropDown = new DropDownButton({
- label: "Movie",
- style: "display: none;",
- dropDown: self.movieToolTip });
- self.movieDropDownElem.appendChild(self.movieDropDown.domNode);
-
- self.movieAddButton = new Button({
- label: "+",
- style: "margin-left: -10px; display: none;",
- onClick: function(){
- if (self.movieFormatSelection.options.length == 0) {
- self.populateMovieCodecs(self.serverURL + '/movie/codecs', self.movieFormatSelection);
- }
- // we could pass item.data here to creator
- self.addToMovieHandler.insertNodes(false, [ { } ]);
- self.movieCreateButton.setAttribute('disabled', false);
-
+ // append format duration cell
+ self.movieWidthHeightLengthRowElem.appendChild(dojo.create('td', { innerHTML: 'Size:'} ));
+ var movieDimensionCell = dojo.create('td');
+ movieDimensionCell.appendChild(self.movieWidthSpinner.domNode);
+ movieDimensionCell.appendChild(dojo.create('span', { innerHTML: "x"} ));
+ movieDimensionCell.appendChild(self.movieHeightSpinner.domNode);
+ movieDimensionCell.appendChild(self.movieDurationSpinner.domNode);
+ movieDimensionCell.appendChild(dojo.create('span', { innerHTML: "sec"} ));
+ self.movieWidthHeightLengthRowElem.appendChild(movieDimensionCell);
+
+ self.movieWidthHeightLengthRowElem.appendChild(dojo.create('td', { align: "right"}));
+ self.movieWidthHeightLengthRowElem.lastChild.appendChild(self.movieCreateButton.domNode);
+
+
+ self.movieToolTip = new TooltipDialog({ content:self.movieDropDownContent });
+ self.movieDropDown = new DropDownButton({
+ label: "Movie",
+ style: "display: none;",
+ dropDown: self.movieToolTip });
+ self.movieDropDownElem.appendChild(self.movieDropDown.domNode);
+
+ self.movieAddButton = new Button({
+ label: "+",
+ style: "margin-left: -10px; display: none;",
+ onClick: function(){
+ if (self.movieFormatSelection.options.length == 0) {
+ self.populateMovieCodecs(self.serverURL + '/movie/codecs', self.movieFormatSelection);
}
- }, self.movieAddButtonElem);
- } else {
- // remove movie controls
- var movieControls = dojo.query("td.movieControls", element)[0];
- movieControls.parentNode.removeChild(movieControls);
- }
+ // we could pass item.data here to creator
+ self.addToMovieHandler.insertNodes(false, [ { } ]);
+ self.movieCreateButton.setAttribute('disabled', false);
+
+ }
+ }, self.movieAddButtonElem);
+ } else {
+ // remove movie controls
+ var movieControls = dojo.query("td.movieControls", element)[0];
+ movieControls.parentNode.removeChild(movieControls);
}
- activateMovies(self.enableMovies);
-
+
// do we have parameters for the initial pose?
if(self.params && self.params.pose)
- self.setScene(self.params.imagePath, self.params.pose, self.params.serverURL);
-
- if (self.serverURL) {
- self.refreshServer(self.serverURL);
- self.updateScene();
- }
+ self.setPose(self.params.imagePath, self.params.pose, self.params.serverURL);
});
});
-};
+
+} \ No newline at end of file
diff --git a/apps/samples/vrml/viewer.html b/apps/samples/vrml/viewer.html
index 1a0732d..bcddf2d 100644
--- a/apps/samples/vrml/viewer.html
+++ b/apps/samples/vrml/viewer.html
@@ -79,62 +79,62 @@
enableSceneshots: false,
enableDraggables: false,
enablePosePublishing: true,
- listNavigationStyle: false,
- treeNavigationStyle: false,
- listDirectory: "/cranehook/cranehook_bad_convergence",
- imagePath: "/cranehook/cranehook_bad_convergence/HARD_MP_VAL_001",
+ listNavigationStyle: true,
+ treeNavigationStyle: true,
+ listDirectory: "res_mp",
+ imagePath: "res_mp/RES_MP_VAL_074",
imageFormat: "png",
- serverURL: "http://epikur.local:8008/vrml/",
+ serverURL: "http://femkit.smartvortex.eu:8086/vrml/",
});
- var viewer2 = new VRMLViewer("scene2", {
- pose: {
- pitch : 0,
- roll : 0,
- yaw : 0,
- zoom : 1,
- x : 0,
- y : 0,
- z : 0,
- autorotate : true
- },
- height: 300,
- width: 400,
- enableMovies: false,
- enableDND: false,
- enableWebGL: false,
- enableSceneshots: true,
- enableDraggables: false,
- enablePosePublishing: true,
- listNavigationStyle: false,
- treeNavigationStyle: false,
- listDirectory: "/cranehook/cranehook_bad_convergence",
- imagePath: "/cranehook/cranehook_bad_convergence/HARD_MP_VAL_000",
- imageFormat: "png",
- serverURL: "http://epikur.local:8008/vrml/",
- });
-
- setTimeout(function() {
- setInterval(function(){
- var pose1 = viewer1.getPose();
- var pose2 = viewer2.getPose();
- console.log("Pose1 - pitch: " + pose1.pitch + ", roll: " + pose1.roll + ", yaw: " + pose1.yaw);
- console.log("Pose2 - pitch: " + pose2.pitch + ", roll: " + pose2.roll + ", yaw: " + pose2.yaw);
-
- pose1.pitch += 0.1;
- pose2.pitch += 0.1;
-
- pose1.roll += 0.2;
- pose2.roll += 0.2;
-
- pose1.yaw += 0.4;
- pose2.yaw += 0.4;
+ // var viewer2 = new VRMLViewer("scene2", {
+ // pose: {
+ // pitch : 0,
+ // roll : 0,
+ // yaw : 0,
+ // zoom : 1,
+ // x : 0,
+ // y : 0,
+ // z : 0,
+ // autorotate : true
+ // },
+ // height: 300,
+ // width: 400,
+ // enableMovies: false,
+ // enableDND: false,
+ // enableWebGL: false,
+ // enableSceneshots: true,
+ // enableDraggables: false,
+ // enablePosePublishing: true,
+ // listNavigationStyle: false,
+ // treeNavigationStyle: false,
+ // listDirectory: "/cranehook/cranehook_bad_convergence",
+ // imagePath: "/cranehook/cranehook_bad_convergence/HARD_MP_VAL_000",
+ // imageFormat: "png",
+ // serverURL: "http://femkit.smartvortex.eu:8086/vrml/",
+ // });
- viewer1.setPose(pose2);
- viewer2.setPose(pose2);
-
- }, 400);
- }, 1000);
+ // setTimeout(function() {
+ // setInterval(function(){
+ // var pose1 = viewer1.getPose();
+ // var pose2 = viewer2.getPose();
+ // console.log("Pose1 - pitch: " + pose1.pitch + ", roll: " + pose1.roll + ", yaw: " + pose1.yaw);
+ // console.log("Pose2 - pitch: " + pose2.pitch + ", roll: " + pose2.roll + ", yaw: " + pose2.yaw);
+ //
+ // pose1.pitch += 0.1;
+ // pose2.pitch += 0.1;
+ //
+ // pose1.roll += 0.2;
+ // pose2.roll += 0.2;
+ //
+ // pose1.yaw += 0.4;
+ // pose2.yaw += 0.4;
+ //
+ // viewer1.setPose(pose2);
+ // viewer2.setPose(pose2);
+ //
+ // }, 400);
+ // }, 1000);
});
diff --git a/apps/uscxml-browser.cpp b/apps/uscxml-browser.cpp
index cd74154..5d3b389 100644
--- a/apps/uscxml-browser.cpp
+++ b/apps/uscxml-browser.cpp
@@ -121,9 +121,6 @@ int main(int argc, char** argv) {
#endif
InterpreterOptions options = InterpreterOptions::fromCmdLine(argc, argv);
- if (!options) {
- InterpreterOptions::printUsageAndExit(argv[0]);
- }
// setup logging
google::LogToStderr();
@@ -133,6 +130,13 @@ int main(int argc, char** argv) {
Factory::setDefaultPluginPath(options.pluginPath);
}
+ if (options.verbose) {
+ Factory::getInstance()->listComponents();
+ }
+ if (!options) {
+ InterpreterOptions::printUsageAndExit(argv[0]);
+ }
+
// setup HTTP server
HTTPServer::SSLConfig* sslConf = NULL;
if (options.certificate.length() > 0) {
@@ -149,7 +153,7 @@ int main(int argc, char** argv) {
}
HTTPServer::getInstance(options.httpPort, options.wsPort, sslConf);
-
+
DebuggerServlet* debugger;
if (options.withDebugger) {
debugger = new DebuggerServlet();
diff --git a/src/bindings/swig/java/JavaDataModel.h b/src/bindings/swig/java/JavaDataModel.h
index 4fe6cbe..5da0cda 100644
--- a/src/bindings/swig/java/JavaDataModel.h
+++ b/src/bindings/swig/java/JavaDataModel.h
@@ -20,8 +20,8 @@ public:
_interpreter = interpreter->shared_from_this();
return boost::shared_ptr<DataModelImpl>(create(_interpreter));
}
- virtual std::set<std::string> getNames() {
- return std::set<std::string>();
+ virtual std::list<std::string> getNames() {
+ return std::list<std::string>();
};
virtual bool validate(const std::string& location, const std::string& schema) {
diff --git a/src/bindings/swig/java/JavaInvoker.h b/src/bindings/swig/java/JavaInvoker.h
index e4db759..8994ab5 100644
--- a/src/bindings/swig/java/JavaInvoker.h
+++ b/src/bindings/swig/java/JavaInvoker.h
@@ -12,8 +12,8 @@ public:
JavaInvoker();
virtual ~JavaInvoker();
- virtual std::set<std::string> getNames() {
- return std::set<std::string>();
+ virtual std::list<std::string> getNames() {
+ return std::list<std::string>();
};
virtual Data getDataModelVariables() {
diff --git a/src/uscxml/Factory.cpp b/src/uscxml/Factory.cpp
index 378f15e..c63fc0d 100644
--- a/src/uscxml/Factory.cpp
+++ b/src/uscxml/Factory.cpp
@@ -143,6 +143,16 @@ std::string Factory::getDefaultPluginPath() {
void Factory::registerPlugins() {
#ifdef BUILD_AS_PLUGINS
+ // these are part of core
+ {
+ InterpreterHTTPServlet* ioProcessor = new InterpreterHTTPServlet();
+ registerIOProcessor(ioProcessor);
+ }
+ {
+ InterpreterWebSocketServlet* ioProcessor = new InterpreterWebSocketServlet();
+ registerIOProcessor(ioProcessor);
+ }
+
if (_pluginPath.length() == 0) {
// try to read USCXML_PLUGIN_PATH environment variable
_pluginPath = (getenv("USCXML_PLUGIN_PATH") != NULL ? getenv("USCXML_PLUGIN_PATH") : "");
@@ -174,6 +184,14 @@ void Factory::registerPlugins() {
DataModelImpl* dataModel = (*it)->create();
registerDataModel(dataModel);
}
+
+ std::vector<ExecutableContentImplProvider*> execContentProviders;
+ pluma.getProviders(execContentProviders);
+ for (std::vector<ExecutableContentImplProvider*>::iterator it = execContentProviders.begin() ; it != execContentProviders.end() ; ++it) {
+ ExecutableContentImpl* execContent = (*it)->create();
+ registerExecutableContent(execContent);
+ }
+
} else {
LOG(WARNING) << "No path to plugins known, export USCXML_PLUGIN_PATH or pass path as parameter";
}
@@ -197,7 +215,6 @@ void Factory::registerPlugins() {
#ifdef MILES_FOUND
{
- // eats 8MB of RAM!
MilesSessionInvoker* invoker = new MilesSessionInvoker();
registerInvoker(invoker);
}
@@ -382,9 +399,56 @@ Factory::~Factory() {
#endif
}
+#define LIST_COMPONENTS(type, name) \
+std::map<std::string, type*>::iterator iter = name.begin(); \
+while(iter != name.end()) { \
+ std::list<std::string> names = iter->second->getNames(); \
+ std::list<std::string>::iterator nameIter = names.begin(); \
+ if (nameIter != names.end()) { \
+ std::cout << "\t" << *nameIter; \
+ nameIter++; \
+ std::string seperator = ""; \
+ if (nameIter != names.end()) { \
+ std::cout << "\t("; \
+ while(nameIter != names.end()) { \
+ std::cout << seperator << *nameIter; \
+ seperator = ", "; \
+ nameIter++; \
+ } \
+ std::cout << ")"; \
+ } \
+ std::cout << std::endl; \
+ } \
+ iter++; \
+}
+
+
+void Factory::listComponents() {
+ {
+ std::cout << "Available Datamodels:" << std::endl;
+ LIST_COMPONENTS(DataModelImpl, _dataModels);
+ }
+ {
+ std::cout << "Available Invokers:" << std::endl;
+ LIST_COMPONENTS(InvokerImpl, _invokers);
+ }
+ {
+ std::cout << "Available I/O Processors:" << std::endl;
+ LIST_COMPONENTS(IOProcessorImpl, _ioProcessors);
+ }
+ {
+ std::cout << "Available Elements:" << std::endl;
+ std::map<std::pair<std::string, std::string>, ExecutableContentImpl*>::iterator iter = _executableContent.begin();
+ while(iter != _executableContent.end()) {
+ std::cout << "\t" << iter->second->getNamespace() << " / " << iter->second->getLocalName() << std::endl;
+ iter++;
+ }
+ }
+}
+
void Factory::registerIOProcessor(IOProcessorImpl* ioProcessor) {
- std::set<std::string> names = ioProcessor->getNames();
- std::set<std::string>::iterator nameIter = names.begin();
+ std::list<std::string> names = ioProcessor->getNames();
+ std::list<std::string>::iterator nameIter = names.begin();
if (nameIter != names.end()) {
std::string canonicalName = *nameIter;
_ioProcessors[canonicalName] = ioProcessor;
@@ -396,8 +460,8 @@ void Factory::registerIOProcessor(IOProcessorImpl* ioProcessor) {
}
void Factory::registerDataModel(DataModelImpl* dataModel) {
- std::set<std::string> names = dataModel->getNames();
- std::set<std::string>::iterator nameIter = names.begin();
+ std::list<std::string> names = dataModel->getNames();
+ std::list<std::string>::iterator nameIter = names.begin();
if (nameIter != names.end()) {
std::string canonicalName = *nameIter;
_dataModels[canonicalName] = dataModel;
@@ -409,8 +473,8 @@ void Factory::registerDataModel(DataModelImpl* dataModel) {
}
void Factory::registerInvoker(InvokerImpl* invoker) {
- std::set<std::string> names = invoker->getNames();
- std::set<std::string>::iterator nameIter = names.begin();
+ std::list<std::string> names = invoker->getNames();
+ std::list<std::string>::iterator nameIter = names.begin();
if (nameIter != names.end()) {
std::string canonicalName = *nameIter;
_invokers[canonicalName] = invoker;
diff --git a/src/uscxml/Factory.h b/src/uscxml/Factory.h
index 3a3080a..83b8433 100644
--- a/src/uscxml/Factory.h
+++ b/src/uscxml/Factory.h
@@ -112,7 +112,7 @@ class USCXML_API EventHandlerImpl {
public:
virtual ~EventHandlerImpl() {}
- virtual std::set<std::string> getNames() = 0;
+ virtual std::list<std::string> getNames() = 0;
virtual void setInterpreter(InterpreterImpl* interpreter) {
_interpreter = interpreter;
@@ -155,7 +155,7 @@ public:
EventHandler(const EventHandler& other) : _impl(other._impl) { }
virtual ~EventHandler() {};
- virtual std::set<std::string> getNames() {
+ virtual std::list<std::string> getNames() {
return _impl->getNames();
}
@@ -273,7 +273,7 @@ class USCXML_API DataModelImpl {
public:
virtual ~DataModelImpl() {}
virtual boost::shared_ptr<DataModelImpl> create(InterpreterImpl* interpreter) = 0;
- virtual std::set<std::string> getNames() = 0;
+ virtual std::list<std::string> getNames() = 0;
virtual bool validate(const std::string& location, const std::string& schema) = 0;
virtual void setEvent(const Event& event) = 0;
@@ -352,7 +352,7 @@ public:
return *this;
}
- virtual std::set<std::string> getNames() {
+ virtual std::list<std::string> getNames() {
return _impl->getNames();
}
@@ -453,6 +453,8 @@ public:
std::map<std::string, IOProcessorImpl*> getIOProcessors();
+ void listComponents();
+
static Factory* getInstance();
static void setDefaultPluginPath(const std::string& path);
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index 0afdf04..3d3c181 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -2300,8 +2300,8 @@ void InterpreterImpl::setupIOProcessors() {
}
// register aliases
- std::set<std::string> names = _ioProcessors[ioProcIter->first].getNames();
- std::set<std::string>::iterator nameIter = names.begin();
+ std::list<std::string> names = _ioProcessors[ioProcIter->first].getNames();
+ std::list<std::string>::iterator nameIter = names.begin();
while(nameIter != names.end()) {
if (!boost::equal(*nameIter, ioProcIter->first))
_ioProcessors[*nameIter] = _ioProcessors[ioProcIter->first];
diff --git a/src/uscxml/UUID.h b/src/uscxml/UUID.h
index d0dd50c..c4ccaee 100644
--- a/src/uscxml/UUID.h
+++ b/src/uscxml/UUID.h
@@ -20,6 +20,7 @@
#ifndef UUID_H_8X65R2EI
#define UUID_H_8X65R2EI
+#include "uscxml/Common.h"
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
@@ -27,7 +28,7 @@
namespace uscxml {
-class UUID {
+class USCXML_API UUID {
public:
static std::string getUUID();
static boost::uuids::random_generator uuidGen;
diff --git a/src/uscxml/interpreter/InterpreterDraft6.h b/src/uscxml/interpreter/InterpreterDraft6.h
index a958b47..2ab588e 100644
--- a/src/uscxml/interpreter/InterpreterDraft6.h
+++ b/src/uscxml/interpreter/InterpreterDraft6.h
@@ -24,7 +24,7 @@
namespace uscxml {
-class InterpreterDraft6 : public InterpreterImpl {
+class USCXML_API InterpreterDraft6 : public InterpreterImpl {
protected:
void interpret();
InterpreterState step(bool blocking);
diff --git a/src/uscxml/plugins/datamodel/CMakeLists.txt b/src/uscxml/plugins/datamodel/CMakeLists.txt
index 4e5ef00..f04cb78 100644
--- a/src/uscxml/plugins/datamodel/CMakeLists.txt
+++ b/src/uscxml/plugins/datamodel/CMakeLists.txt
@@ -23,6 +23,8 @@ if (BUILD_DM_ECMA)
"../Plugins.cpp")
target_link_libraries(datamodel_jsc uscxml ${JSC_LIBRARY})
set_target_properties(datamodel_jsc PROPERTIES FOLDER "Plugin DataModel")
+ set_target_properties(datamodel_jsc PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(datamodel_jsc PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${JSC_DATAMODEL})
list (APPEND USCXML_FILES ${JSC_DOM})
@@ -56,6 +58,8 @@ if (BUILD_DM_ECMA)
"../Plugins.cpp")
target_link_libraries(datamodel_v8 uscxml ${V8_LIBRARY})
set_target_properties(datamodel_v8 PROPERTIES FOLDER "Plugin DataModel")
+ set_target_properties(datamodel_v8 PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(datamodel_v8 PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${V8_DATAMODEL})
list (APPEND USCXML_FILES ${V8_DOM})
@@ -77,7 +81,10 @@ if (BUILD_AS_PLUGINS)
add_library(datamodel_null SHARED ${NULL_DATAMODEL} "../Plugins.cpp")
target_link_libraries(datamodel_null uscxml)
set_target_properties(datamodel_null PROPERTIES FOLDER "Plugin DataModel")
- set_target_properties(datamodel_null PROPERTIES COMPILE_FLAGS "-DPLUGIN_EXPORTS")
+ set_target_properties(datamodel_null PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(datamodel_null PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
+
+
else()
list (APPEND USCXML_FILES ${NULL_DATAMODEL})
endif()
@@ -96,6 +103,8 @@ if (BUILD_DM_XPATH)
add_library(datamodel_xpath SHARED ${XPATH_DATAMODEL} "../Plugins.cpp")
target_link_libraries(datamodel_xpath uscxml)
set_target_properties(datamodel_xpath PROPERTIES FOLDER "Plugin DataModel")
+ set_target_properties(datamodel_xpath PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(datamodel_xpath PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${XPATH_DATAMODEL})
endif()
@@ -132,6 +141,8 @@ if (SWI_FOUND AND BUILD_DM_PROLOG)
${CURSES_LIBRARIES}
${SWI_LIBRARY})
set_target_properties(datamodel_swi PROPERTIES FOLDER "Plugin DataModel")
+ set_target_properties(datamodel_swi PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(datamodel_swi PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${SWI_DATAMODEL})
endif()
@@ -156,6 +167,8 @@ if (BUILD_DM_PROMELA)
"../Plugins.cpp")
target_link_libraries(datamodel_promela uscxml)
set_target_properties(datamodel_promela PROPERTIES FOLDER "Plugin DataModel")
+ set_target_properties(datamodel_promela PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(datamodel_promela PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${PROMELA_DATAMODEL})
endif()
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h
index 7443439..82882f0 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h
@@ -42,9 +42,9 @@ public:
virtual ~JSCDataModel();
virtual boost::shared_ptr<DataModelImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("ecmascript");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("ecmascript");
return names;
}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h
index a0a1b09..5bfca93 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h
@@ -43,9 +43,9 @@ public:
virtual ~V8DataModel();
virtual boost::shared_ptr<DataModelImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("ecmascript");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("ecmascript");
return names;
}
diff --git a/src/uscxml/plugins/datamodel/null/NULLDataModel.h b/src/uscxml/plugins/datamodel/null/NULLDataModel.h
index 7ce9fde..162ffdb 100644
--- a/src/uscxml/plugins/datamodel/null/NULLDataModel.h
+++ b/src/uscxml/plugins/datamodel/null/NULLDataModel.h
@@ -40,9 +40,9 @@ public:
virtual ~NULLDataModel();
virtual boost::shared_ptr<DataModelImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("null");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("null");
return names;
}
diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h
index 0e17f4b..f022811 100644
--- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h
+++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h
@@ -54,9 +54,9 @@ public:
virtual ~SWIDataModel();
virtual boost::shared_ptr<DataModelImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("prolog");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("prolog");
return names;
}
diff --git a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.h b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.h
index 6d7d505..cbbf570 100644
--- a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.h
+++ b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.h
@@ -35,9 +35,9 @@ public:
virtual ~PromelaDataModel();
virtual boost::shared_ptr<DataModelImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("promela");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("promela");
return names;
}
diff --git a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.h b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.h
index ac041f9..d18d05a 100644
--- a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.h
+++ b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.h
@@ -85,9 +85,9 @@ public:
virtual ~XPathDataModel();
virtual boost::shared_ptr<DataModelImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("xpath");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("xpath");
return names;
}
diff --git a/src/uscxml/plugins/element/CMakeLists.txt b/src/uscxml/plugins/element/CMakeLists.txt
index aa85b97..16a9a1d 100644
--- a/src/uscxml/plugins/element/CMakeLists.txt
+++ b/src/uscxml/plugins/element/CMakeLists.txt
@@ -13,6 +13,8 @@ if (BUILD_AS_PLUGINS)
"../Plugins.cpp")
target_link_libraries(element_fetch uscxml)
set_target_properties(element_fetch PROPERTIES FOLDER "Plugin Element")
+ set_target_properties(element_fetch PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(element_fetch PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${FETCH_ELEMENT})
endif()
@@ -31,6 +33,8 @@ endif()
# "../Plugins.cpp")
# target_link_libraries(element_mmi uscxml)
# set_target_properties(element_mmi PROPERTIES FOLDER "Plugin Element")
+# set_target_properties(element_mmi PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+# set_target_properties(element_mmi PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
# else()
# list (APPEND USCXML_FILES ${MMI_ELEMENT})
# endif()
@@ -51,6 +55,8 @@ if (BUILD_AS_PLUGINS)
"../Plugins.cpp")
target_link_libraries(element_postpone uscxml)
set_target_properties(element_postpone PROPERTIES FOLDER "Plugin Element")
+ set_target_properties(element_postpone PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(element_postpone PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${POSTPONE_ELEMENT})
endif()
@@ -71,6 +77,8 @@ if (BUILD_AS_PLUGINS)
"../Plugins.cpp")
target_link_libraries(element_file uscxml)
set_target_properties(element_file PROPERTIES FOLDER "Plugin Element")
+ set_target_properties(element_file PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(element_file PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${FILE_ELEMENT})
endif()
@@ -91,6 +99,8 @@ if (BUILD_AS_PLUGINS)
"../Plugins.cpp")
target_link_libraries(element_respond uscxml)
set_target_properties(element_respond PROPERTIES FOLDER "Plugin Element")
+ set_target_properties(element_respond PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(element_respond PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${RESPOND_ELEMENT})
endif()
diff --git a/src/uscxml/plugins/invoker/CMakeLists.txt b/src/uscxml/plugins/invoker/CMakeLists.txt
index 301f04a..f12a7a6 100644
--- a/src/uscxml/plugins/invoker/CMakeLists.txt
+++ b/src/uscxml/plugins/invoker/CMakeLists.txt
@@ -13,6 +13,8 @@ if (BUILD_AS_PLUGINS)
"../Plugins.cpp")
target_link_libraries(invoker_sample uscxml)
set_target_properties(invoker_sample PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_sample PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_sample PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${SAMPLE_INVOKER})
endif()
@@ -32,6 +34,8 @@ if (BUILD_AS_PLUGINS)
"../Plugins.cpp")
target_link_libraries(invoker_dirmon uscxml)
set_target_properties(invoker_dirmon PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_dirmon PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_dirmon PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${DIRMON_INVOKER})
endif()
@@ -71,6 +75,8 @@ if (BUILD_AS_PLUGINS)
"../Plugins.cpp")
target_link_libraries(invoker_xhtml uscxml)
set_target_properties(invoker_xhtml PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_xhtml PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_xhtml PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${XHTML_INVOKER})
endif()
@@ -90,6 +96,8 @@ if (BUILD_AS_PLUGINS)
"../Plugins.cpp")
target_link_libraries(invoker_system uscxml)
set_target_properties(invoker_system PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_system PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_system PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${SYSTEM_INVOKER})
endif()
@@ -111,6 +119,8 @@ if (EXPECT_FOUND AND TCL_FOUND)
"../Plugins.cpp")
target_link_libraries(invoker_expect uscxml ${EXPECT_LIBRARY} ${TCL_LIBRARY})
set_target_properties(invoker_expect PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_expect PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_expect PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${EXPECT_INVOKER})
endif()
@@ -133,6 +143,8 @@ if (CURL_HAS_SMTP)
"../Plugins.cpp")
target_link_libraries(invoker_smtp uscxml)
set_target_properties(invoker_smtp PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_smtp PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_smtp PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${SMTP_INVOKER})
endif()
@@ -154,6 +166,8 @@ if (BUILD_AS_PLUGINS)
"../Plugins.cpp")
target_link_libraries(invoker_imap uscxml)
set_target_properties(invoker_imap PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_imap PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_imap PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${IMAP_INVOKER})
endif()
@@ -174,6 +188,8 @@ if (SQLITE3_FOUND)
"../Plugins.cpp")
target_link_libraries(invoker_sqlite3 uscxml)
set_target_properties(invoker_sqlite3 PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_sqlite3 PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_sqlite3 PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${SQLITE3_INVOKER})
endif()
@@ -196,6 +212,8 @@ if (FFMPEG_FOUND)
"../Plugins.cpp")
target_link_libraries(invoker_ffmpeg uscxml ${FFMPEG_LIBRARIES})
set_target_properties(invoker_ffmpeg PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_ffmpeg PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_ffmpeg PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${FFMPEG_INVOKER})
endif()
@@ -221,6 +239,8 @@ if (LIBPURPLE_FOUND)
"../Plugins.cpp")
target_link_libraries(invoker_im uscxml ${LIBPURPLE_LIBRARY} ${GLIB2_LIBRARIES} ${ICONV_LIBRARIES})
set_target_properties(invoker_im PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_im PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_im PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${LIBPURPLE_INVOKER})
endif()
@@ -243,6 +263,8 @@ if (LIBICAL_FOUND)
"../Plugins.cpp")
target_link_libraries(invoker_calendar uscxml ${LIBICAL_LIBRARIES})
set_target_properties(invoker_calendar PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_calendar PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_calendar PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${CALENDAR_INVOKER})
endif()
@@ -266,6 +288,8 @@ if (CORELOCATION_LIBRARY AND OFF)
"../Plugins.cpp")
target_link_libraries(invoker_location uscxml)
set_target_properties(invoker_location PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_location PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_location PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${LOCATION_INVOKER})
endif()
@@ -301,6 +325,8 @@ if (UMUNDO_FOUND AND PROTOBUF_FOUND)
debug ${PROTOBUF_LIBRARY_DEBUG})
endif()
set_target_properties(invoker_umundo PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_umundo PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_umundo PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${UMUNDO_INVOKER})
endif()
@@ -319,9 +345,10 @@ if (BUILD_AS_PLUGINS)
invoker_uscxml SHARED
${USCXML_INVOKER}
"../Plugins.cpp")
- target_link_libraries(invoker_uscxml
- uscxml)
- set_target_properties(invoker_uscxml PROPERTIES FOLDER "Plugin Invoker")
+ target_link_libraries(invoker_uscxml uscxml)
+ set_target_properties(invoker_uscxml PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_uscxml PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_uscxml PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${USCXML_INVOKER})
endif()
@@ -342,6 +369,8 @@ if (BUILD_AS_PLUGINS)
target_link_libraries(invoker_httpserver
uscxml)
set_target_properties(invoker_httpserver PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_httpserver PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_httpserver PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${HTTPSERVLET_INVOKER})
endif()
@@ -362,6 +391,8 @@ if (BUILD_AS_PLUGINS)
"../Plugins.cpp")
target_link_libraries(invoker_heartbeat uscxml)
set_target_properties(invoker_heartbeat PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_heartbeat PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_heartbeat PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${HEARTBEAT_INVOKER})
endif()
@@ -385,6 +416,8 @@ if (OPENSCENEGRAPH_FOUND AND OPENGL_FOUND)
${OPENGL_LIBRARIES}
uscxml)
set_target_properties(invoker_openscenegraph PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_openscenegraph PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_openscenegraph PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${OPENSCENEGRAPH_INVOKER})
endif()
@@ -405,6 +438,8 @@ if (OPENSCENEGRAPH_FOUND AND OPENGL_FOUND)
${OPENGL_LIBRARIES}
uscxml)
set_target_properties(invoker_openscenegraph_convert PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_openscenegraph_convert PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_openscenegraph_convert PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${OPENSCENEGRAPH_CONVERTER_INVOKER})
endif()
@@ -449,6 +484,8 @@ if (OPENAL_FOUND AND (LIBSNDFILE_FOUND OR AUDIOTOOLBOX_FOUND))
uscxml)
endif()
set_target_properties(invoker_openal PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_openal PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_openal PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${OPENAL_INVOKER})
endif()
@@ -472,13 +509,17 @@ if (MILES_FOUND)
"../Plugins.cpp")
target_link_libraries(invoker_miles
${MILES_LIBRARIES}
- ${OPENAL_LIBRARY}
${JPEG_LIBRARIES}
uscxml)
if (ICONV_FOUND)
target_link_libraries(invoker_miles ${ICONV_LIBRARIES})
endif()
+ if (OPENAL_FOUND)
+ target_link_libraries(invoker_miles ${OPENAL_LIBRARY})
+ endif()
set_target_properties(invoker_miles PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_miles PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_miles PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${MILES_INVOKER})
endif()
@@ -501,6 +542,8 @@ if (UMUNDO_FOUND AND OFF)
"../Plugins.cpp")
target_link_libraries(invoker_voicexml uscxml)
set_target_properties(invoker_voicexml PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_voicexml PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_voicexml PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${VXML_INVOKER})
endif()
diff --git a/src/uscxml/plugins/invoker/audio/OpenALInvoker.h b/src/uscxml/plugins/invoker/audio/OpenALInvoker.h
index 9771f6b..98524ed 100644
--- a/src/uscxml/plugins/invoker/audio/OpenALInvoker.h
+++ b/src/uscxml/plugins/invoker/audio/OpenALInvoker.h
@@ -61,11 +61,11 @@ public:
virtual ~OpenALInvoker();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("openal");
- names.insert("spatial-audio");
- names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#openal");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("openal");
+ names.push_back("spatial-audio");
+ names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#openal");
return names;
}
diff --git a/src/uscxml/plugins/invoker/expect/ExpectInvoker.h b/src/uscxml/plugins/invoker/expect/ExpectInvoker.h
index 902885e..25a2517 100644
--- a/src/uscxml/plugins/invoker/expect/ExpectInvoker.h
+++ b/src/uscxml/plugins/invoker/expect/ExpectInvoker.h
@@ -44,10 +44,10 @@ public:
virtual ~ExpectInvoker();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("expect");
- names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#expect");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("expect");
+ names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#expect");
return names;
}
diff --git a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h
index 7725ec9..964681b 100644
--- a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h
+++ b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h
@@ -40,10 +40,10 @@ public:
virtual ~FFMPEGInvoker();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("ffmpeg");
- names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#ffmpeg");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("ffmpeg");
+ names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#ffmpeg");
return names;
}
diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h
index 9c3f873..78929c6 100644
--- a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h
+++ b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h
@@ -97,11 +97,11 @@ public:
virtual ~DirMonInvoker();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("dirmon");
- names.insert("DirectoryMonitor");
- names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#dirmon");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("dirmon");
+ names.push_back("DirectoryMonitor");
+ names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#dirmon");
return names;
}
diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h
index cda0ad3..af06e23 100644
--- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h
+++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h
@@ -44,11 +44,11 @@ public:
virtual ~OSGInvoker();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("3d");
- names.insert("scenegraph");
- names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#3d");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("3d");
+ names.push_back("scenegraph");
+ names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#3d");
return names;
}
diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h
index a632a19..10e6fc9 100644
--- a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h
+++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h
@@ -36,12 +36,12 @@ public:
virtual ~OSGConverter();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("osgconverter");
- names.insert("osgconvert");
- names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#osgconverter");
- names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#osgconvert");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("osgconverter");
+ names.push_back("osgconvert");
+ names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#osgconverter");
+ names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#osgconvert");
return names;
}
diff --git a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h
index c44e362..a024181 100644
--- a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h
+++ b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h
@@ -34,10 +34,10 @@ public:
virtual ~HeartbeatInvoker();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("heartbeat");
- names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#heartbeat");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("heartbeat");
+ names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#heartbeat");
return names;
}
diff --git a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h
index 7fb2438..59c25ca 100644
--- a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h
+++ b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h
@@ -35,10 +35,10 @@ public:
virtual ~HTTPServletInvoker();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("httpservlet");
- names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#httpserver");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("httpservlet");
+ names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#httpserver");
return names;
}
diff --git a/src/uscxml/plugins/invoker/im/IMInvoker.h b/src/uscxml/plugins/invoker/im/IMInvoker.h
index a3f129a..85c156e 100644
--- a/src/uscxml/plugins/invoker/im/IMInvoker.h
+++ b/src/uscxml/plugins/invoker/im/IMInvoker.h
@@ -72,11 +72,11 @@ public:
virtual ~IMInvoker();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("im");
- names.insert("instant-messaging");
- names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#instant-messaging");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("im");
+ names.push_back("instant-messaging");
+ names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#instant-messaging");
return names;
}
diff --git a/src/uscxml/plugins/invoker/imap/IMAPInvoker.h b/src/uscxml/plugins/invoker/imap/IMAPInvoker.h
index b1da324..1f80e57 100644
--- a/src/uscxml/plugins/invoker/imap/IMAPInvoker.h
+++ b/src/uscxml/plugins/invoker/imap/IMAPInvoker.h
@@ -37,10 +37,10 @@ public:
virtual ~IMAPInvoker();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("imap");
- names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#imap");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("imap");
+ names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#imap");
return names;
}
diff --git a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp
index b29e827..720cab3 100644
--- a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp
+++ b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp
@@ -49,6 +49,7 @@ MilesSessionInvoker::MilesSessionInvoker() {
miles_init();
_isRunning = false;
+ _imageSeq = 0;
num_connected = 0;
}
@@ -446,7 +447,15 @@ void MilesSessionInvoker::processEventThumbnail(const std::string& origin, const
returnEvent(ev);
return;
}
- URL imageURL("emptyface.jpg");
+
+ _imageSeq++;
+ if (_imageSeq > 4)
+ _imageSeq = 1;
+
+ std::stringstream testImageName;
+ testImageName << "test" << _imageSeq << ".jpeg";
+
+ URL imageURL(testImageName.str());
imageURL.toAbsolute(_interpreter->getBaseURI());
std::stringstream ssImage;
ssImage << imageURL;
diff --git a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h
index 84bf280..148be68 100644
--- a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h
+++ b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h
@@ -63,10 +63,10 @@ public:
virtual ~MilesSessionInvoker();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("miles");
- names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#miles");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("miles");
+ names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#miles");
return names;
}
diff --git a/src/uscxml/plugins/invoker/sample/SampleInvoker.h b/src/uscxml/plugins/invoker/sample/SampleInvoker.h
index 16e4df1..562ebd6 100644
--- a/src/uscxml/plugins/invoker/sample/SampleInvoker.h
+++ b/src/uscxml/plugins/invoker/sample/SampleInvoker.h
@@ -34,10 +34,10 @@ public:
virtual ~SampleInvoker();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("sample");
- names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#sample");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("sample");
+ names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#sample");
return names;
}
diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h
index f26955e..7d10bf1 100644
--- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h
+++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h
@@ -47,12 +47,12 @@ public:
USCXMLInvoker();
virtual ~USCXMLInvoker();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("scxml");
- names.insert("uscxml");
- names.insert("http://www.w3.org/TR/scxml");
- names.insert("http://www.w3.org/TR/scxml/");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("scxml");
+ names.push_back("uscxml");
+ names.push_back("http://www.w3.org/TR/scxml");
+ names.push_back("http://www.w3.org/TR/scxml/");
return names;
}
diff --git a/src/uscxml/plugins/invoker/smtp/SMTPInvoker.h b/src/uscxml/plugins/invoker/smtp/SMTPInvoker.h
index 2ae5482..5975b4b 100644
--- a/src/uscxml/plugins/invoker/smtp/SMTPInvoker.h
+++ b/src/uscxml/plugins/invoker/smtp/SMTPInvoker.h
@@ -36,10 +36,10 @@ public:
virtual ~SMTPInvoker();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("smtp");
- names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#smtp");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("smtp");
+ names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#smtp");
return names;
}
diff --git a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h b/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h
index e024fd7..b6e5031 100644
--- a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h
+++ b/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h
@@ -34,10 +34,10 @@ public:
virtual ~Sqlite3Invoker();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("sqlite3");
- names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#sqlite3");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("sqlite3");
+ names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#sqlite3");
return names;
}
diff --git a/src/uscxml/plugins/invoker/system/SystemInvoker.h b/src/uscxml/plugins/invoker/system/SystemInvoker.h
index 5be04eb..a3d1451 100644
--- a/src/uscxml/plugins/invoker/system/SystemInvoker.h
+++ b/src/uscxml/plugins/invoker/system/SystemInvoker.h
@@ -34,10 +34,10 @@ public:
virtual ~SystemInvoker();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("system");
- names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#system");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("system");
+ names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#system");
return names;
}
diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
index 9c64886..1c5c9a3 100644
--- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
+++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
@@ -43,11 +43,11 @@ public:
virtual ~UmundoInvoker();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("umundo");
- names.insert("http://umundo.tk.informatik.tu-darmstadt.de/");
- names.insert("http://umundo.tk.informatik.tu-darmstadt.de");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("umundo");
+ names.push_back("http://umundo.tk.informatik.tu-darmstadt.de/");
+ names.push_back("http://umundo.tk.informatik.tu-darmstadt.de");
return names;
}
diff --git a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.h b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.h
index 03b9116..b1a9c5a 100644
--- a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.h
+++ b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.h
@@ -34,10 +34,10 @@ public:
virtual ~XHTMLInvoker();
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("xhtml");
- names.insert("http://www.w3.org/1999/xhtml");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("xhtml");
+ names.push_back("http://www.w3.org/1999/xhtml");
return names;
}
diff --git a/src/uscxml/plugins/ioprocessor/CMakeLists.txt b/src/uscxml/plugins/ioprocessor/CMakeLists.txt
index 7480b6b..f09a866 100644
--- a/src/uscxml/plugins/ioprocessor/CMakeLists.txt
+++ b/src/uscxml/plugins/ioprocessor/CMakeLists.txt
@@ -11,6 +11,8 @@ if (BUILD_AS_PLUGINS)
"../Plugins.cpp")
target_link_libraries(ioprocessor_sample uscxml)
set_target_properties(ioprocessor_sample PROPERTIES FOLDER "Plugin IOProcessor")
+ set_target_properties(ioprocessor_sample PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(ioprocessor_sample PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${SAMPLE_IOPROCESSOR})
endif()
@@ -28,6 +30,8 @@ if (BUILD_AS_PLUGINS)
"../Plugins.cpp")
target_link_libraries(ioprocessor_comet uscxml)
set_target_properties(ioprocessor_comet PROPERTIES FOLDER "Plugin IOProcessor")
+ set_target_properties(ioprocessor_comet PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(ioprocessor_comet PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${COMET_IOPROCESSOR})
endif()
@@ -48,6 +52,8 @@ if (BUILD_AS_PLUGINS)
"../Plugins.cpp")
target_link_libraries(ioprocessor_basichttp uscxml)
set_target_properties(ioprocessor_basichttp PROPERTIES FOLDER "Plugin IOProcessor")
+ set_target_properties(ioprocessor_basichttp PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(ioprocessor_basichttp PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${BASICHTTP_IOPROCESSOR})
endif()
@@ -60,15 +66,22 @@ file(GLOB_RECURSE SCXML_IOPROCESSOR
scxml/*.cpp
scxml/*.h
)
+file(GLOB_RECURSE BASICHTTP_IOPROCESSOR
+ basichttp/*.cpp
+ basichttp/*.h
+)
if (BUILD_AS_PLUGINS)
source_group("" FILES ${SCXML_IOPROCESSOR})
add_library(
ioprocessor_scxml SHARED
${SCXML_IOPROCESSOR}
+ ${BASICHTTP_IOPROCESSOR}
"../Plugins.cpp")
# scxml ioprocessor is a basichttp ioprocessor
- target_link_libraries(ioprocessor_scxml ioprocessor_basichttp uscxml)
+ target_link_libraries(ioprocessor_scxml uscxml)
set_target_properties(ioprocessor_scxml PROPERTIES FOLDER "Plugin IOProcessor")
+ set_target_properties(ioprocessor_scxml PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(ioprocessor_scxml PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${SCXML_IOPROCESSOR})
endif()
@@ -107,6 +120,8 @@ if (PROTOBUF_FOUND AND OFF)
"../Plugins.cpp")
target_link_libraries(ioprocessor_mmi uscxml mmi_proto)
set_target_properties(ioprocessor_mmi PROPERTIES FOLDER "Plugin IOProcessor")
+ set_target_properties(ioprocessor_mmi PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(ioprocessor_mmi PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
else()
list (APPEND USCXML_FILES ${MMI_IOPROCESSOR})
list (APPEND USCXML_OPT_LIBS mmi_proto)
diff --git a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
index 8489d60..7d9fcb8 100644
--- a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
+++ b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
@@ -49,12 +49,14 @@
namespace uscxml {
-#ifdef BUILD_AS_PLUGINS
+#ifndef ioprocessor_scxml_EXPORTS
+# ifdef BUILD_AS_PLUGINS
PLUMA_CONNECTOR
bool pluginConnect(pluma::Host& host) {
host.add( new BasicHTTPIOProcessorProvider() );
return true;
}
+# endif
#endif
// see http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor
diff --git a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h
index 20369d7..29bc208 100644
--- a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h
+++ b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h
@@ -55,10 +55,10 @@ public:
virtual ~BasicHTTPIOProcessor();
virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("basichttp");
- names.insert("http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("basichttp");
+ names.push_back("http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor");
return names;
}
@@ -86,8 +86,11 @@ protected:
std::map<std::string, std::pair<URL, SendRequest> > _sendRequests;
};
-#ifdef BUILD_AS_PLUGINS
+// do not implement pluma plugins if we build an inherited plugin
+#ifdef ioprocessor_basichttp_EXPORTS
+# ifdef BUILD_AS_PLUGINS
PLUMA_INHERIT_PROVIDER(BasicHTTPIOProcessor, IOProcessorImpl);
+# endif
#endif
}
diff --git a/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.h b/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.h
index 8acbac0..e30bdb2 100644
--- a/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.h
+++ b/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.h
@@ -37,10 +37,10 @@ public:
virtual ~CometIOProcessor();
virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("comet");
- names.insert("http://www.w3.org/TR/scxml/#CometEventProcessor");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("comet");
+ names.push_back("http://www.w3.org/TR/scxml/#CometEventProcessor");
return names;
}
diff --git a/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h b/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h
index 1cbe922..05dd3ef 100644
--- a/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h
+++ b/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h
@@ -44,10 +44,10 @@ public:
virtual ~SampleIOProcessor();
virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("sample");
- names.insert("http://www.w3.org/TR/scxml/#SampleEventProcessor");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("sample");
+ names.push_back("http://www.w3.org/TR/scxml/#SampleEventProcessor");
return names;
}
diff --git a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h
index c4fa677..3eca2db 100644
--- a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h
+++ b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h
@@ -34,10 +34,10 @@ public:
virtual ~SCXMLIOProcessor();
virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("http://www.w3.org/TR/scxml/#SCXMLEventProcessor");
- names.insert("scxml");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("scxml");
+ names.push_back("http://www.w3.org/TR/scxml/#SCXMLEventProcessor");
return names;
}
diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp
index 2d2b5e0..3e7920c 100644
--- a/src/uscxml/server/HTTPServer.cpp
+++ b/src/uscxml/server/HTTPServer.cpp
@@ -179,6 +179,7 @@ tthread::recursive_mutex HTTPServer::_instanceMutex;
HTTPServer* HTTPServer::getInstance(unsigned short port, unsigned short wsPort, SSLConfig* sslConf) {
// tthread::lock_guard<tthread::recursive_mutex> lock(_instanceMutex);
if (_instance == NULL) {
+ std::cout << "Instantiating new HTTPServer" << std::endl;
#ifdef _WIN32
WSADATA wsaData;
WSAStartup(MAKEWORD(2, 2), &wsaData);
@@ -561,7 +562,7 @@ bool HTTPServer::registerServlet(const std::string& path, HTTPServlet* servlet)
HTTPServer* INSTANCE = getInstance();
if (!INSTANCE->_httpHandle)
- return true;
+ return true; // this is the culprit!
tthread::lock_guard<tthread::recursive_mutex> lock(INSTANCE->_mutex);
diff --git a/src/uscxml/server/InterpreterServlet.h b/src/uscxml/server/InterpreterServlet.h
index 0315598..9ff1d34 100644
--- a/src/uscxml/server/InterpreterServlet.h
+++ b/src/uscxml/server/InterpreterServlet.h
@@ -35,10 +35,10 @@ public:
virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("http");
- names.insert("http://www.w3.org/TR/scxml/#HTTPEventProcessor");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("http");
+ names.push_back("http://www.w3.org/TR/scxml/#HTTPEventProcessor");
return names;
}
@@ -86,10 +86,10 @@ public:
virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("websocket");
- names.insert("http://www.w3.org/TR/scxml/#WebSocketEventProcessor");
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("websocket");
+ names.push_back("http://www.w3.org/TR/scxml/#WebSocketEventProcessor");
return names;
}
diff --git a/src/uscxml/transform/ChartToFSM.h b/src/uscxml/transform/ChartToFSM.h
index 80f532a..ef80a6a 100644
--- a/src/uscxml/transform/ChartToFSM.h
+++ b/src/uscxml/transform/ChartToFSM.h
@@ -32,7 +32,7 @@ namespace uscxml {
class GlobalState;
class GlobalTransition;
-class GlobalState {
+class USCXML_API GlobalState {
public:
GlobalState() {}
@@ -52,7 +52,7 @@ public:
};
-class GlobalTransition {
+class USCXML_API GlobalTransition {
public:
class Action {
public:
@@ -99,7 +99,7 @@ protected:
std::list<std::string> getCommonEvents(const Arabica::XPath::NodeSet<std::string>& transitions);
};
-class FlatteningInterpreter : public InterpreterDraft6, public InterpreterMonitor {
+class USCXML_API FlatteningInterpreter : public InterpreterDraft6, public InterpreterMonitor {
public:
FlatteningInterpreter(const Arabica::DOM::Document<std::string>& doc);
virtual ~FlatteningInterpreter();
@@ -146,7 +146,7 @@ protected:
std::map<std::string, GlobalState*> _globalConf;
};
-class ChartToFSM {
+class USCXML_API ChartToFSM {
public:
static Interpreter flatten(const Interpreter& other);
};
diff --git a/src/uscxml/transform/FSMToPromela.h b/src/uscxml/transform/FSMToPromela.h
index 7872997..844d209 100644
--- a/src/uscxml/transform/FSMToPromela.h
+++ b/src/uscxml/transform/FSMToPromela.h
@@ -31,7 +31,7 @@
namespace uscxml {
-class PromelaInline {
+class USCXML_API PromelaInline {
public:
PromelaInline() : type(PROMELA_NIL) {}
@@ -57,7 +57,7 @@ public:
PromelaInlineType type;
};
-class PromelaInlines {
+class USCXML_API PromelaInlines {
public:
PromelaInlines() : progressLabels(0), acceptLabels(0), endLabels(0), eventSources(0), customEventSources(0), codes(0) {}
@@ -84,7 +84,7 @@ public:
int codes;
};
-class PromelaEventSource {
+class USCXML_API PromelaEventSource {
public:
enum PromelaEventSourceType {
@@ -112,7 +112,7 @@ public:
Trie* trie;
};
-class FSMToPromela : public InterpreterDraft6 {
+class USCXML_API FSMToPromela : public InterpreterDraft6 {
public:
static void writeProgram(std::ostream& stream,
const Interpreter& interpreter);
diff --git a/src/uscxml/util/Trie.h b/src/uscxml/util/Trie.h
index 5c2d14e..1f8b201 100644
--- a/src/uscxml/util/Trie.h
+++ b/src/uscxml/util/Trie.h
@@ -20,13 +20,14 @@
#ifndef TRIE_H_UZMQRBO5
#define TRIE_H_UZMQRBO5
+#include "uscxml/Common.h"
#include <string>
#include <map>
#include <list>
namespace uscxml {
-struct TrieNode {
+struct USCXML_API TrieNode {
TrieNode();
virtual ~TrieNode();
@@ -37,7 +38,7 @@ struct TrieNode {
void dump(int indent = 0);
};
-struct Trie {
+struct USCXML_API Trie {
Trie();
Trie(const std::string& seperator);
virtual ~Trie();
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 03fd22c..01cd07c 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -40,11 +40,6 @@ target_link_libraries(test-base64 uscxml)
add_test(test-base64 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-base64)
set_target_properties(test-base64 PROPERTIES FOLDER "Tests")
-add_executable(test-trie src/test-trie.cpp)
-target_link_libraries(test-trie uscxml)
-add_test(test-trie ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-trie)
-set_target_properties(test-trie PROPERTIES FOLDER "Tests")
-
add_executable(test-eventdelay src/test-eventdelay.cpp)
target_link_libraries(test-eventdelay uscxml)
add_test(test-eventdelay ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-eventdelay)
@@ -63,6 +58,11 @@ add_test(test-lifecycle ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-arabica-namespace
set_target_properties(test-lifecycle PROPERTIES FOLDER "Tests")
if (NOT WIN32)
+ add_executable(test-trie src/test-trie.cpp)
+ target_link_libraries(test-trie uscxml)
+ add_test(test-trie ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-trie)
+ set_target_properties(test-trie PROPERTIES FOLDER "Tests")
+
add_executable(test-arabica-namespaces src/test-arabica-namespaces.cpp)
target_link_libraries(test-arabica-namespaces uscxml)
add_test(test-arabica-namespaces ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-arabica-namespaces ${CMAKE_SOURCE_DIR}/test)
@@ -98,6 +98,15 @@ if (NOT WIN32)
# add_test(test-instant-messaging ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-instant-messaging)
# set_target_properties(test-instant-messaging PROPERTIES FOLDER "Tests")
# endif()
+
+ add_executable(test-promela-parser src/test-promela-parser.cpp)
+ target_link_libraries(test-promela-parser uscxml)
+ if (BUILD_AS_PLUGINS)
+ target_link_libraries(test-promela-parser datamodel_promela)
+ endif()
+ add_test(test-url ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-promela-parser)
+ set_target_properties(test-promela-parser PROPERTIES FOLDER "Tests")
+
endif()
add_executable(test-url src/test-url.cpp)
@@ -105,14 +114,6 @@ target_link_libraries(test-url uscxml)
add_test(test-url ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-url)
set_target_properties(test-url PROPERTIES FOLDER "Tests")
-add_executable(test-promela-parser src/test-promela-parser.cpp)
-target_link_libraries(test-promela-parser uscxml)
-if (BUILD_AS_PLUGINS)
- target_link_libraries(test-promela-parser datamodel_promela)
-endif()
-add_test(test-url ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-promela-parser)
-set_target_properties(test-promela-parser PROPERTIES FOLDER "Tests")
-
add_executable(test-cmdline-parsing src/test-cmdline-parsing.cpp)
target_link_libraries(test-cmdline-parsing uscxml)
add_test(test-cmdline-parsing ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-cmdline-parsing)