diff --git a/applications/present3D/ExportHTML.cpp b/applications/present3D/ExportHTML.cpp
index ee714e486..6c17a246f 100644
--- a/applications/present3D/ExportHTML.cpp
+++ b/applications/present3D/ExportHTML.cpp
@@ -82,7 +82,7 @@ std::string ExportHTML::createFileName(const std::string& basename, unsigned int
else return createString(basename,'_', page, ext);
}
-bool ExportHTML::write(SlideEventHandler* seh, osgViewer::Viewer& viewer, const std::string& filename)
+bool ExportHTML::write(osgPresentation::SlideEventHandler* seh, osgViewer::Viewer& viewer, const std::string& filename)
{
std::string image_basename;
std::string image_ext;
@@ -179,7 +179,7 @@ bool ExportHTML::write(SlideEventHandler* seh, osgViewer::Viewer& viewer, const
}
// wait for all cull and draw threads to complete.
- seh->selectSlide(i, SlideEventHandler::LAST_POSITION);
+ seh->selectSlide(i, osgPresentation::SlideEventHandler::LAST_POSITION);
// fire off the cull and draw traversals of the scene.
viewer.frame();
diff --git a/applications/present3D/ExportHTML.h b/applications/present3D/ExportHTML.h
index dd7a74f9d..da25d7627 100644
--- a/applications/present3D/ExportHTML.h
+++ b/applications/present3D/ExportHTML.h
@@ -19,7 +19,7 @@
class ExportHTML
{
public:
- static bool write(SlideEventHandler* seh, osgViewer::Viewer& viewer, const std::string& filename);
+ static bool write(osgPresentation::SlideEventHandler* seh, osgViewer::Viewer& viewer, const std::string& filename);
static std::string createFileName(const std::string& basename, unsigned int page, const std::string& ext);
};
diff --git a/applications/present3D/PickEventHandler.cpp b/applications/present3D/PickEventHandler.cpp
index 057413b01..16aad1c8e 100644
--- a/applications/present3D/PickEventHandler.cpp
+++ b/applications/present3D/PickEventHandler.cpp
@@ -17,7 +17,9 @@
#include
#include
-PickEventHandler::PickEventHandler(SlideShowConstructor::Operation operation,bool relativeJump, int slideNum, int layerNum):
+using namespace osgPresentation;
+
+PickEventHandler::PickEventHandler(osgPresentation::Operation operation,bool relativeJump, int slideNum, int layerNum):
_operation(operation),
_relativeJump(relativeJump),
_slideNum(slideNum),
@@ -25,7 +27,7 @@ PickEventHandler::PickEventHandler(SlideShowConstructor::Operation operation,boo
{
}
-PickEventHandler::PickEventHandler(const std::string& str, SlideShowConstructor::Operation operation,bool relativeJump, int slideNum, int layerNum):
+PickEventHandler::PickEventHandler(const std::string& str, osgPresentation::Operation operation,bool relativeJump, int slideNum, int layerNum):
_command(str),
_operation(operation),
_relativeJump(relativeJump),
@@ -34,9 +36,9 @@ PickEventHandler::PickEventHandler(const std::string& str, SlideShowConstructor:
{
}
-PickEventHandler::PickEventHandler(const SlideShowConstructor::KeyPosition& keyPos,bool relativeJump, int slideNum, int layerNum):
+PickEventHandler::PickEventHandler(const osgPresentation::KeyPosition& keyPos,bool relativeJump, int slideNum, int layerNum):
_keyPos(keyPos),
- _operation(SlideShowConstructor::EVENT),
+ _operation(osgPresentation::EVENT),
_relativeJump(relativeJump),
_slideNum(slideNum),
_layerNum(layerNum)
@@ -114,13 +116,12 @@ void PickEventHandler::doOperation()
{
switch(_operation)
{
- case(SlideShowConstructor::RUN):
+ case(osgPresentation::RUN):
{
osg::notify(osg::NOTICE)<<"Run "<<_command<dispatchEvent(_keyPos);
break;
}
+ case(osgPresentation::JUMP):
+ {
+ osg::notify(osg::NOTICE)<<"Requires jump "<
-#include "SlideShowConstructor.h"
+#include "SlideEventHandler.h"
+
+namespace osgPresentation
+{
class PickEventHandler : public osgGA::GUIEventHandler
{
public:
- PickEventHandler(SlideShowConstructor::Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0);
- PickEventHandler(const std::string& str, SlideShowConstructor::Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0);
- PickEventHandler(const SlideShowConstructor::KeyPosition& keyPos, bool relativeJump=true, int slideNum=0, int layerNum=0);
+ PickEventHandler(osgPresentation::Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0);
+ PickEventHandler(const std::string& str, osgPresentation::Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0);
+ PickEventHandler(const osgPresentation::KeyPosition& keyPos, bool relativeJump=true, int slideNum=0, int layerNum=0);
- void setOperation(SlideShowConstructor::Operation operation) { _operation = operation; }
- SlideShowConstructor::Operation getOperation() const { return _operation; }
+ void setOperation(osgPresentation::Operation operation) { _operation = operation; }
+ osgPresentation::Operation getOperation() const { return _operation; }
void setCommand(const std::string& str) { _command = str; }
const std::string& getCommand() const { return _command; }
- void setKeyPosition(const SlideShowConstructor::KeyPosition& keyPos) { _keyPos = keyPos; }
- const SlideShowConstructor::KeyPosition& getKeyPosition() const { return _keyPos; }
+ void setKeyPosition(const osgPresentation::KeyPosition& keyPos) { _keyPos = keyPos; }
+ const osgPresentation::KeyPosition& getKeyPosition() const { return _keyPos; }
void setRelativeJump(int slideDelta, int layerDelta);
void setAbsoluteJump(int slideNum, int layerNum);
@@ -55,12 +58,14 @@ class PickEventHandler : public osgGA::GUIEventHandler
void doOperation();
std::string _command;
- SlideShowConstructor::KeyPosition _keyPos;
- SlideShowConstructor::Operation _operation;
+ osgPresentation::KeyPosition _keyPos;
+ osgPresentation::Operation _operation;
bool _relativeJump;
int _slideNum;
int _layerNum;
};
+}
+
#endif
diff --git a/applications/present3D/ReadShowFile.cpp b/applications/present3D/ReadShowFile.cpp
index 14701fffb..d51cdcf35 100644
--- a/applications/present3D/ReadShowFile.cpp
+++ b/applications/present3D/ReadShowFile.cpp
@@ -75,7 +75,7 @@ bool p3d::readEnvVars(osg::ArgumentParser& arguments)
{
bool readVars = false;
- for(unsigned int i=1; i ColorMap;
typedef std::map LayoutMap;
@@ -444,7 +444,7 @@ bool ReaderWriterP3DXML::getProperty(xmlNodePtr cur, const char* token, osgText:
return success;
}
-bool ReaderWriterP3DXML::getProperties(xmlNodePtr cur, SlideShowConstructor::PositionData& value) const
+bool ReaderWriterP3DXML::getProperties(xmlNodePtr cur, osgPresentation::SlideShowConstructor::PositionData& value) const
{
bool propertiesRead=false;
@@ -461,14 +461,14 @@ bool ReaderWriterP3DXML::getProperties(xmlNodePtr cur, SlideShowConstructor::Pos
{
propertiesRead = true;
- if (str=="model") value.frame = SlideShowConstructor::MODEL;
- else if (str=="slide") value.frame = SlideShowConstructor::SLIDE;
+ if (str=="model") value.frame = osgPresentation::SlideShowConstructor::MODEL;
+ else if (str=="slide") value.frame = osgPresentation::SlideShowConstructor::SLIDE;
else osg::notify(_notifyLevel)<<"Parser error - coordinate_frame=\""<xmlChildrenNode;
@@ -925,7 +925,7 @@ void ReaderWriterP3DXML::parseStereoPair(SlideShowConstructor& constructor, xmlD
}
-bool ReaderWriterP3DXML::getKeyPosition(xmlDocPtr doc, xmlNodePtr cur, SlideShowConstructor::KeyPosition& keyPosition) const
+bool ReaderWriterP3DXML::getKeyPosition(xmlDocPtr doc, xmlNodePtr cur, osgPresentation::KeyPosition& keyPosition) const
{
if ((!xmlStrcmp(cur->name, (const xmlChar *)"key")))
{
@@ -941,7 +941,7 @@ bool ReaderWriterP3DXML::getKeyPosition(xmlDocPtr doc, xmlNodePtr cur, SlideShow
return false;
}
-bool ReaderWriterP3DXML::getKeyPositionInner(xmlDocPtr doc, xmlNodePtr cur, SlideShowConstructor::KeyPosition& keyPosition) const
+bool ReaderWriterP3DXML::getKeyPositionInner(xmlDocPtr doc, xmlNodePtr cur, osgPresentation::KeyPosition& keyPosition) const
{
// x in range -1 to 1, from left to right
float x = FLT_MAX;
@@ -995,10 +995,10 @@ bool ReaderWriterP3DXML::getKeyPositionInner(xmlDocPtr doc, xmlNodePtr cur, Slid
-void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const
+void ReaderWriterP3DXML::parseLayer(osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const
{
// create a keyPosition just in case we need it.
- SlideShowConstructor::KeyPosition keyPosition;
+ osgPresentation::KeyPosition keyPosition;
osg::notify(osg::INFO)<name, (const xmlChar *)"newline")))
@@ -1109,10 +1109,10 @@ void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr
if (key)
{
osg::notify(osg::INFO)<<"bullet ["<<(const char*)key<<"]"<xmlChildrenNode, 1);
if (key)
{
- SlideShowConstructor::PositionData positionData = constructor.getTextPositionData();
+ osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getTextPositionData();
bool positionRead = getProperties(cur,positionData);
- SlideShowConstructor::FontData fontData = constructor.getTextFontData();
+ osgPresentation::SlideShowConstructor::FontData fontData = constructor.getTextFontData();
bool fontRead = getProperties(cur,fontData);
constructor.addParagraph((const char*)key,
@@ -1144,10 +1144,10 @@ void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr
key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
if (key)
{
- SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
+ osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
bool positionRead = getProperties(cur,positionData);
- SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
+ osgPresentation::SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
getProperties(cur,imageData);
constructor.addImage((const char*)key,
@@ -1161,10 +1161,10 @@ void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr
key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
if (key)
{
- SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
+ osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
bool positionRead = getProperties(cur,positionData);
- SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
+ osgPresentation::SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
getProperties(cur,imageData);
constructor.addVNC((const char*)key,
@@ -1178,10 +1178,10 @@ void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr
key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
if (key)
{
- SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
+ osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
bool positionRead = getProperties(cur,positionData);
- SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
+ osgPresentation::SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
getProperties(cur,imageData);
constructor.addBrowser((const char*)key,
@@ -1195,10 +1195,10 @@ void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr
key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
if (key)
{
- SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
+ osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
bool positionRead = getProperties(cur,positionData);
- SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
+ osgPresentation::SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
getProperties(cur,imageData);
constructor.addPDF((const char*)key,
@@ -1238,7 +1238,7 @@ void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr
}
-void ReaderWriterP3DXML::parseBullets(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur, bool inheritPreviousLayers, bool defineAsBaseLayer) const
+void ReaderWriterP3DXML::parseBullets(osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur, bool inheritPreviousLayers, bool defineAsBaseLayer) const
{
xmlChar *key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
if (key)
@@ -1246,10 +1246,10 @@ void ReaderWriterP3DXML::parseBullets(SlideShowConstructor& constructor, xmlDocP
constructor.addLayer(inheritPreviousLayers, defineAsBaseLayer);
osg::notify(osg::INFO)<<"bullets ["<<(const char*)key<<"]"<xmlChildrenNode, 1);
if (key)
@@ -1268,10 +1268,10 @@ void ReaderWriterP3DXML::parseText(SlideShowConstructor& constructor, xmlDocPtr
constructor.addLayer(inheritPreviousLayers, defineAsBaseLayer);
osg::notify(osg::INFO)<<"text ["<<(const char*)key<<"]"<xmlChildrenNode, 1);
if (key)
@@ -1313,10 +1313,10 @@ void ReaderWriterP3DXML::parsePage(SlideShowConstructor& constructor, xmlDocPtr
constructor.addLayer(true,false);
- SlideShowConstructor::PositionData positionData = constructor.getTextPositionData();
+ osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getTextPositionData();
bool positionRead = getProperties(cur,positionData);
- SlideShowConstructor::FontData fontData = constructor.getTextFontData();
+ osgPresentation::SlideShowConstructor::FontData fontData = constructor.getTextFontData();
bool fontRead = getProperties(cur,fontData);
constructor.addParagraph((const char*)key,
@@ -1326,7 +1326,7 @@ void ReaderWriterP3DXML::parsePage(SlideShowConstructor& constructor, xmlDocPtr
xmlFree(key);
}
-void ReaderWriterP3DXML::parsePdfDocument(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const
+void ReaderWriterP3DXML::parsePdfDocument(osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const
{
xmlChar *key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
if (key)
@@ -1359,10 +1359,10 @@ void ReaderWriterP3DXML::parsePdfDocument(SlideShowConstructor& constructor, xml
constructor.addLayer(true,false);
- SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
- bool positionRead = getProperties(cur,positionData);
+ osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
+ getProperties(cur,positionData);
- SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
+ osgPresentation::SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
imageData.page = 0;
getProperties(cur,imageData);
@@ -1410,14 +1410,14 @@ void ReaderWriterP3DXML::parsePdfDocument(SlideShowConstructor& constructor, xml
xmlFree(key);
}
-void ReaderWriterP3DXML::parseSlide (SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur, bool parseTitles, bool parseLayers) const
+void ReaderWriterP3DXML::parseSlide (osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur, bool parseTitles, bool parseLayers) const
{
osg::Vec4 previous_bgcolor = constructor.getBackgroundColor();
osg::Vec4 previous_textcolor = constructor.getTextColor();
// create a keyPosition just in case we need it.
- SlideShowConstructor::KeyPosition keyPosition;
+ osgPresentation::KeyPosition keyPosition;
xmlChar *key;
cur = cur->xmlChildrenNode;
@@ -1431,10 +1431,10 @@ void ReaderWriterP3DXML::parseSlide (SlideShowConstructor& constructor, xmlDocPt
if (key)
{
- SlideShowConstructor::PositionData positionData = constructor.getTitlePositionData();
+ osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getTitlePositionData();
bool positionRead = getProperties(cur,positionData);
- SlideShowConstructor::FontData fontData = constructor.getTitleFontData();
+ osgPresentation::SlideShowConstructor::FontData fontData = constructor.getTitleFontData();
bool fontRead = getProperties(cur,fontData);
constructor.setSlideTitle((const char*)key,
@@ -1533,7 +1533,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterP3DXML::readNode(const std::string&
if (fileName.empty()) return ReadResult::FILE_NOT_FOUND;
// create a keyPosition just in case we need it.
- SlideShowConstructor::KeyPosition keyPosition;
+ osgPresentation::KeyPosition keyPosition;
xmlDocPtr doc;
xmlNodePtr cur;
@@ -1559,7 +1559,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterP3DXML::readNode(const std::string&
return ReadResult::FILE_NOT_HANDLED;
}
- SlideShowConstructor constructor;
+ osgPresentation::SlideShowConstructor constructor;
osgDB::FilePathList previousPaths = osgDB::getDataFilePathList();
diff --git a/applications/present3D/SlideEventHandler.cpp b/applications/present3D/SlideEventHandler.cpp
index ae5d7c046..000200335 100644
--- a/applications/present3D/SlideEventHandler.cpp
+++ b/applications/present3D/SlideEventHandler.cpp
@@ -29,11 +29,35 @@
#include
+using namespace osgPresentation;
static osg::observer_ptr s_seh;
SlideEventHandler* SlideEventHandler::instance() { return s_seh.get(); }
+void LayerAttributes::callEnterCallbacks(osg::Node* node)
+{
+ osg::notify(osg::INFO)<<"LayerAttributes::callEnterCallbacks("<_keys.begin();
+ for(LayerAttributes::Keys::iterator itr = _layerAttribute->_keys.begin();
itr != _layerAttribute->_keys.end();
++itr)
{
@@ -186,7 +210,7 @@ struct LayerAttributesOperator : public ObjectOperator
}
if (!_layerAttribute->_runStrings.empty())
{
- for(SlideShowConstructor::LayerAttributes::RunStrings::iterator itr = _layerAttribute->_runStrings.begin();
+ for(LayerAttributes::RunStrings::iterator itr = _layerAttribute->_runStrings.begin();
itr != _layerAttribute->_runStrings.end();
++itr)
{
@@ -232,7 +256,7 @@ struct LayerAttributesOperator : public ObjectOperator
osg::ref_ptr _node;
- osg::ref_ptr _layerAttribute;
+ osg::ref_ptr _layerAttribute;
};
@@ -252,7 +276,7 @@ public:
_operatorList.insert(new CallbackOperator(&node, node.getUpdateCallback()));
}
- SlideShowConstructor::LayerAttributes* la = dynamic_cast(node.getUserData());
+ LayerAttributes* la = dynamic_cast(node.getUserData());
if (la)
{
_operatorList.insert(new LayerAttributesOperator(&node, la));
@@ -409,7 +433,7 @@ public:
void apply(osg::Node& node)
{
- SlideShowConstructor::HomePosition* homePosition = dynamic_cast(node.getUserData());
+ HomePosition* homePosition = dynamic_cast(node.getUserData());
if (homePosition)
{
_homePosition = homePosition;
@@ -418,7 +442,7 @@ public:
traverse(node);
}
- osg::ref_ptr _homePosition;
+ osg::ref_ptr _homePosition;
};
@@ -457,7 +481,7 @@ public:
void apply(osg::Node& node)
{
- SlideShowConstructor::FilePathData* fdd = dynamic_cast(node.getUserData());
+ FilePathData* fdd = dynamic_cast(node.getUserData());
if (fdd)
{
osg::notify(osg::INFO)<<"Recorded FilePathData"<(node->getUserData());
+ const LayerAttributes* la = dynamic_cast(node->getUserData());
return la ? la->_duration : -1.0;
}
@@ -1091,7 +1115,7 @@ bool SlideEventHandler::previousLayerOrSlide()
bool SlideEventHandler::nextSlide()
{
- SlideShowConstructor::LayerAttributes* la = _slideSwitch.valid() ? dynamic_cast(_slideSwitch->getUserData()) : 0;
+ LayerAttributes* la = _slideSwitch.valid() ? dynamic_cast(_slideSwitch->getUserData()) : 0;
if (la && la->requiresJump())
{
if (la->getRelativeJump())
@@ -1135,7 +1159,7 @@ bool SlideEventHandler::previousSlide()
bool SlideEventHandler::nextLayer()
{
- SlideShowConstructor::LayerAttributes* la = (_slideSwitch.valid() && _activeLayer>=0) ? dynamic_cast(_slideSwitch->getChild(_activeLayer)->getUserData()) : 0;
+ LayerAttributes* la = (_slideSwitch.valid() && _activeLayer>=0) ? dynamic_cast(_slideSwitch->getChild(_activeLayer)->getUserData()) : 0;
if (la)
{
la->callLeaveCallbacks(_slideSwitch->getChild(_activeLayer));
@@ -1265,7 +1289,7 @@ void SlideEventHandler::releaseSlide(unsigned int slideNum)
_presentationSwitch->getChild(slideNum)->accept(globjVisitor);
}
-void SlideEventHandler::dispatchEvent(const SlideShowConstructor::KeyPosition& keyPosition)
+void SlideEventHandler::dispatchEvent(const KeyPosition& keyPosition)
{
osg::notify(osg::INFO)<<" keyPosition._key "<
#include "CompileSlideCallback.h"
-#include "SlideShowConstructor.h"
+
+namespace osgPresentation
+{
+
+/// Operations related to click to run/load/key events.
+enum Operation
+{
+ RUN,
+ LOAD,
+ EVENT,
+ JUMP
+};
+
+struct HomePosition : public virtual osg::Referenced
+{
+ HomePosition() {}
+
+ HomePosition(const osg::Vec3& in_eye, const osg::Vec3& in_center, const osg::Vec3& in_up):
+ eye(in_eye),
+ center(in_center),
+ up(in_up) {}
+
+ osg::Vec3 eye;
+ osg::Vec3 center;
+ osg::Vec3 up;
+};
+
+struct KeyPosition
+{
+ KeyPosition(unsigned int key=0, float x=FLT_MAX, float y=FLT_MAX):
+ _key((osgGA::GUIEventAdapter::KeySymbol)key),
+ _x(x),
+ _y(y) {}
+
+
+ void set(unsigned int key=0, float x=FLT_MAX, float y=FLT_MAX)
+ {
+ _key = (osgGA::GUIEventAdapter::KeySymbol)key;
+ _x = x;
+ _y = y;
+ }
+
+ osgGA::GUIEventAdapter::KeySymbol _key;
+ float _x;
+ float _y;
+};
+
+struct LayerCallback : public virtual osg::Referenced
+{
+ virtual void operator() (osg::Node* node) const = 0;
+};
+
+struct LayerAttributes : public virtual osg::Referenced
+{
+ LayerAttributes():_duration(0),_relativeJump(true),_slideNum(0),_layerNum(0) {}
+ LayerAttributes(double in_duration):_duration(in_duration),_relativeJump(true),_slideNum(0),_layerNum(0) {}
+
+ void setDuration(double duration) { _duration = duration; }
+ double getDuration() const { return _duration; }
+
+ typedef std::vector Keys;
+ typedef std::vector RunStrings;
+
+ void setKeys(const Keys& keys) { _keys = keys; }
+ const Keys& getKeys() const { return _keys; }
+
+ void addKey(const KeyPosition& kp) { _keys.push_back(kp); }
+
+ void setRunStrings(const RunStrings& runStrings) { _runStrings = runStrings; }
+ const RunStrings& getRunStrings() const { return _runStrings; }
+
+ void addRunString(const std::string& runString) { _runStrings.push_back(runString); }
+
+ void setJump(bool relativeJump, int slideNum, int layerNum)
+ {
+ _relativeJump = relativeJump;
+ _slideNum = slideNum;
+ _layerNum = layerNum;
+ }
+
+ bool getRelativeJump() const { return _relativeJump; }
+ int getSlideNum() const { return _slideNum; }
+ int getLayerNum() const { return _layerNum; }
+
+ bool requiresJump() const { return _relativeJump ? (_slideNum!=0 || _layerNum!=0) : true; }
+
+ double _duration;
+ Keys _keys;
+ RunStrings _runStrings;
+
+ bool _relativeJump;
+ int _slideNum;
+ int _layerNum;
+
+ void addEnterCallback(LayerCallback* lc) { _enterLayerCallbacks.push_back(lc); }
+ void addLeaveCallback(LayerCallback* lc) { _leaveLayerCallbacks.push_back(lc); }
+
+ void callEnterCallbacks(osg::Node* node);
+ void callLeaveCallbacks(osg::Node* node);
+
+ typedef std::list< osg::ref_ptr > LayerCallbacks;
+ LayerCallbacks _enterLayerCallbacks;
+ LayerCallbacks _leaveLayerCallbacks;
+};
+
+struct FilePathData : public virtual osg::Referenced
+{
+ FilePathData(const osgDB::FilePathList& fpl):filePathList(fpl) {}
+
+ osgDB::FilePathList filePathList;
+};
struct dereference_less
@@ -104,7 +214,7 @@ public:
enum WhichPosition
{
FIRST_POSITION = 0,
- LAST_POSITION = 0xffffffff,
+ LAST_POSITION = 0xffffffff
};
void compileSlide(unsigned int slideNum);
@@ -148,7 +258,7 @@ public:
void setLoopPresentation(bool loop) { _loopPresentation = loop; }
bool getLoopPresentation() const { return _loopPresentation; }
- void dispatchEvent(const SlideShowConstructor::KeyPosition& keyPosition);
+ void dispatchEvent(const KeyPosition& keyPosition);
enum ObjectMask
{
@@ -212,4 +322,6 @@ protected:
};
+}
+
#endif
diff --git a/applications/present3D/SlideShowConstructor.cpp b/applications/present3D/SlideShowConstructor.cpp
index 338d64a13..ef8e571dd 100644
--- a/applications/present3D/SlideShowConstructor.cpp
+++ b/applications/present3D/SlideShowConstructor.cpp
@@ -50,6 +50,8 @@
#include "AnimationMaterial.h"
#include "PickEventHandler.h"
+using namespace osgPresentation;
+
class SetToTransparentBin : public osg::NodeVisitor
{
public:
@@ -84,28 +86,6 @@ public:
}
};
-void SlideShowConstructor::LayerAttributes::callEnterCallbacks(osg::Node* node)
-{
- osg::notify(osg::INFO)<<"SlideShowConstructor::LayerAttributes::callEnterCallbacks("<getScreenDistance();
@@ -208,7 +188,7 @@ void SlideShowConstructor::createPresentation()
if (_autoSteppingActive) _root->addDescription("auto");
}
-SlideShowConstructor::LayerAttributes* SlideShowConstructor::getOrCreateLayerAttributes(osg::Node* node)
+LayerAttributes* SlideShowConstructor::getOrCreateLayerAttributes(osg::Node* node)
{
LayerAttributes* la = dynamic_cast(node->getUserData());
if (!la)
@@ -294,7 +274,7 @@ void SlideShowConstructor::selectSlide(int slideNum)
{
addSlide();
}
- else if (slideNum>=_presentationSwitch->getNumChildren())
+ else if (slideNum>=static_cast(_presentationSwitch->getNumChildren()))
{
addSlide();
}
@@ -435,7 +415,7 @@ void SlideShowConstructor::selectLayer(int layerNum)
addSlide();
addLayer();
}
- else if (layerNum>=0 && layerNum<_slide->getNumChildren() && _slide->getChild(layerNum)->asGroup())
+ else if (layerNum>=0 && layerNum(_slide->getNumChildren()) && _slide->getChild(layerNum)->asGroup())
{
_currentLayer = _slide->getChild(layerNum)->asGroup();
_previousLayer = _currentLayer;
@@ -516,7 +496,7 @@ void SlideShowConstructor::layerClickToDoOperation(const std::string& command, O
}
-void SlideShowConstructor::layerClickEventOperation(const SlideShowConstructor::KeyPosition& keyPos, bool relativeJump, int slideNum, int layerNum)
+void SlideShowConstructor::layerClickEventOperation(const KeyPosition& keyPos, bool relativeJump, int slideNum, int layerNum)
{
if (!_currentLayer) addLayer();
@@ -1075,7 +1055,7 @@ void SlideShowConstructor::addPDF(const std::string& filename, const PositionDat
addInteractiveImage(filename, positionData, imageData);
}
-class SetPageCallback: public SlideShowConstructor::LayerCallback
+class SetPageCallback: public LayerCallback
{
public:
SetPageCallback(osgWidget::PdfImage* pdfImage, int pageNum):
@@ -1444,7 +1424,7 @@ void SlideShowConstructor::addModel(osg::Node* subgraph, const PositionData& pos
void SlideShowConstructor::addVolume(const std::string& filename, const PositionData& positionData)
{
- osg::Object::DataVariance defaultMatrixDataVariance = osg::Object::DYNAMIC; // STATIC
+ // osg::Object::DataVariance defaultMatrixDataVariance = osg::Object::DYNAMIC; // STATIC
std::string foundFile = filename;
diff --git a/applications/present3D/SlideShowConstructor.h b/applications/present3D/SlideShowConstructor.h
index 4bf82b744..4f60b4545 100644
--- a/applications/present3D/SlideShowConstructor.h
+++ b/applications/present3D/SlideShowConstructor.h
@@ -26,6 +26,10 @@
#include
#include "AnimationMaterial.h"
+#include "SlideEventHandler.h"
+
+namespace osgPresentation
+{
class SlideShowConstructor
{
@@ -34,98 +38,6 @@ public:
enum CoordinateFrame { SLIDE, MODEL };
- struct HomePosition : public virtual osg::Referenced
- {
- HomePosition() {}
-
- HomePosition(const osg::Vec3& in_eye, const osg::Vec3& in_center, const osg::Vec3& in_up):
- eye(in_eye),
- center(in_center),
- up(in_up) {}
-
- osg::Vec3 eye;
- osg::Vec3 center;
- osg::Vec3 up;
- };
-
- struct KeyPosition
- {
- KeyPosition(unsigned int key=0, float x=FLT_MAX, float y=FLT_MAX):
- _key((osgGA::GUIEventAdapter::KeySymbol)key),
- _x(x),
- _y(y) {}
-
-
- void set(unsigned int key=0, float x=FLT_MAX, float y=FLT_MAX)
- {
- _key = (osgGA::GUIEventAdapter::KeySymbol)key;
- _x = x;
- _y = y;
- }
-
- osgGA::GUIEventAdapter::KeySymbol _key;
- float _x;
- float _y;
- };
-
- struct LayerCallback : public virtual osg::Referenced
- {
- virtual void operator() (osg::Node* node) const = 0;
- };
-
- struct LayerAttributes : public virtual osg::Referenced
- {
- LayerAttributes():_duration(0),_relativeJump(true),_slideNum(0),_layerNum(0) {}
- LayerAttributes(double in_duration):_duration(in_duration),_relativeJump(true),_slideNum(0),_layerNum(0) {}
-
- void setDuration(double duration) { _duration = duration; }
- double getDuration() const { return _duration; }
-
- typedef std::vector Keys;
- typedef std::vector RunStrings;
-
- void setKeys(const Keys& keys) { _keys = keys; }
- const Keys& getKeys() const { return _keys; }
-
- void addKey(const KeyPosition& kp) { _keys.push_back(kp); }
-
- void setRunStrings(const RunStrings& runStrings) { _runStrings = runStrings; }
- const RunStrings& getRunStrings() const { return _runStrings; }
-
- void addRunString(const std::string& runString) { _runStrings.push_back(runString); }
-
- void setJump(bool relativeJump, int slideNum, int layerNum)
- {
- _relativeJump = relativeJump;
- _slideNum = slideNum;
- _layerNum = layerNum;
- }
-
- bool getRelativeJump() const { return _relativeJump; }
- int getSlideNum() const { return _slideNum; }
- int getLayerNum() const { return _layerNum; }
-
- bool requiresJump() const { return _relativeJump ? (_slideNum!=0 || _layerNum!=0) : true; }
-
- double _duration;
- Keys _keys;
- RunStrings _runStrings;
-
- bool _relativeJump;
- int _slideNum;
- int _layerNum;
-
- void addEnterCallback(LayerCallback* lc) { _enterLayerCallbacks.push_back(lc); }
- void addLeaveCallback(LayerCallback* lc) { _leaveLayerCallbacks.push_back(lc); }
-
- void callEnterCallbacks(osg::Node* node);
- void callLeaveCallbacks(osg::Node* node);
-
- typedef std::list< osg::ref_ptr > LayerCallbacks;
- LayerCallbacks _enterLayerCallbacks;
- LayerCallbacks _leaveLayerCallbacks;
- };
-
LayerAttributes* getOrCreateLayerAttributes(osg::Node* node);
@@ -198,12 +110,6 @@ public:
if (_currentLayer.valid()) setJump(_currentLayer.get(),relativeJump, switchNum, layerNum);
}
- struct FilePathData : public virtual osg::Referenced
- {
- FilePathData(const osgDB::FilePathList& fpl):filePathList(fpl) {}
-
- osgDB::FilePathList filePathList;
- };
struct PositionData
@@ -320,14 +226,6 @@ public:
osg::Vec4 color;
};
- /// Operations related to click to run/load/key events.
- enum Operation
- {
- RUN,
- LOAD,
- EVENT,
- JUMP
- };
SlideShowConstructor();
@@ -399,7 +297,7 @@ public:
void layerClickToDoOperation(Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0);
void layerClickToDoOperation(const std::string& command, Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0);
- void layerClickEventOperation(const SlideShowConstructor::KeyPosition& keyPos, bool relativeJump=true, int slideNum=0, int layerNum=0);
+ void layerClickEventOperation(const KeyPosition& keyPos, bool relativeJump=true, int slideNum=0, int layerNum=0);
void addBullet(const std::string& bullet, PositionData& positionData, FontData& fontData);
@@ -515,4 +413,6 @@ protected:
};
+}
+
#endif
diff --git a/applications/present3D/present3D.cpp b/applications/present3D/present3D.cpp
index a803b4340..cfb43d8d2 100644
--- a/applications/present3D/present3D.cpp
+++ b/applications/present3D/present3D.cpp
@@ -59,7 +59,7 @@ static const char* s_version = "1.3";
void setViewer(osgViewer::Viewer& viewer, float width, float height, float distance)
{
double vfov = osg::RadiansToDegrees(atan2(height/2.0f,distance)*2.0);
- double hfov = osg::RadiansToDegrees(atan2(width/2.0f,distance)*2.0);
+ // double hfov = osg::RadiansToDegrees(atan2(width/2.0f,distance)*2.0);
viewer.getCamera()->setProjectionMatrixAsPerspective( vfov, width/height, 0.1, 1000.0);
}
@@ -160,7 +160,7 @@ enum P3DApplicationType
{
VIEWER,
MASTER,
- SLAVE,
+ SLAVE
};
@@ -321,7 +321,7 @@ int main( int argc, char **argv )
while (arguments.read("--loop")) loopPresentation = true;
// register the slide event handler - which moves the presentation from slide to slide, layer to layer.
- SlideEventHandler* seh = new SlideEventHandler(&viewer);
+ osgPresentation::SlideEventHandler* seh = new osgPresentation::SlideEventHandler(&viewer);
viewer.addEventHandler(seh);
seh->setAutoSteppingActive(autoSteppingActive);