From ff476e9c155b6e085e6d2d21ab56662a72aadd83 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 9 Nov 2012 21:32:54 +0000 Subject: [PATCH] Added support for naming slides and layers with slide_name and layer_name properties respectively. Added support for creating events based on key presses using a and tags. --- include/osgPresentation/PickEventHandler | 22 +-- include/osgPresentation/SlideEventHandler | 94 +++++++--- include/osgPresentation/SlideShowConstructor | 36 ++-- src/osgPlugins/p3d/ReaderWriterP3D.cpp | 186 +++++++++++++++---- src/osgPresentation/CMakeLists.txt | 2 + src/osgPresentation/PickEventHandler.cpp | 57 +----- src/osgPresentation/SlideEventHandler.cpp | 136 ++++++++++---- src/osgPresentation/SlideShowConstructor.cpp | 74 ++++++-- 8 files changed, 424 insertions(+), 183 deletions(-) diff --git a/include/osgPresentation/PickEventHandler b/include/osgPresentation/PickEventHandler index feed2195f..c65d51d43 100644 --- a/include/osgPresentation/PickEventHandler +++ b/include/osgPresentation/PickEventHandler @@ -27,9 +27,9 @@ class OSGPRESENTATION_EXPORT PickEventHandler : public osgGA::GUIEventHandler { public: - 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); + PickEventHandler(osgPresentation::Operation operation, const JumpData& jumpData=JumpData()); + PickEventHandler(const std::string& str, osgPresentation::Operation operation, const JumpData& jumpData=JumpData()); + PickEventHandler(const osgPresentation::KeyPosition& keyPos, const JumpData& jumpData=JumpData()); void setOperation(osgPresentation::Operation operation) { _operation = operation; } osgPresentation::Operation getOperation() const { return _operation; } @@ -40,15 +40,9 @@ class OSGPRESENTATION_EXPORT PickEventHandler : public osgGA::GUIEventHandler 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); - - 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; } - + void setJumpData(const JumpData& jumpData) { _jumpData = jumpData; } + const JumpData& getJumpData() const { return _jumpData; } + virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv); virtual void accept(osgGA::GUIEventHandlerVisitor& v); @@ -61,9 +55,7 @@ class OSGPRESENTATION_EXPORT PickEventHandler : public osgGA::GUIEventHandler osgPresentation::KeyPosition _keyPos; osgPresentation::Operation _operation; - bool _relativeJump; - int _slideNum; - int _layerNum; + JumpData _jumpData; }; } diff --git a/include/osgPresentation/SlideEventHandler b/include/osgPresentation/SlideEventHandler index cfe730532..7131eebd2 100644 --- a/include/osgPresentation/SlideEventHandler +++ b/include/osgPresentation/SlideEventHandler @@ -26,6 +26,9 @@ namespace osgPresentation { +// forward declare +class SlideEventHandler; + /// Operations related to click to run/load/key events. enum Operation { @@ -35,6 +38,60 @@ enum Operation JUMP }; +struct JumpData +{ + JumpData(): + relativeJump(false), + slideNum(0), + layerNum(0) {} + + JumpData(bool in_relativeJump, int in_slideNum, int in_layerNum): + relativeJump(in_relativeJump), + slideNum(in_slideNum), + layerNum(in_layerNum) {} + + JumpData(const std::string& in_slideName, const std::string& in_layerName): + relativeJump(false), + slideNum(-1), + layerNum(-1), + slideName(in_slideName), + layerName(in_layerName) {} + + JumpData(const JumpData& rhs): + relativeJump(rhs.relativeJump), + slideNum(rhs.slideNum), + layerNum(rhs.layerNum), + slideName(rhs.slideName), + layerName(rhs.layerName) {} + + JumpData& operator = (const JumpData& rhs) + { + if (&rhs==this) return *this; + relativeJump = rhs.relativeJump; + slideNum = rhs.slideNum; + layerNum = rhs.layerNum; + slideName = rhs.slideName; + layerName = rhs.layerName; + return *this; + } + + bool requiresJump() const + { + if (!slideName.empty() || !layerName.empty()) return true; + return relativeJump ? (slideNum!=0 || layerNum!=0) : true; + } + + bool jump(SlideEventHandler* seh) const; + + bool relativeJump; + int slideNum; + int layerNum; + + std::string slideName; + std::string layerName; +}; + + struct HomePosition : public virtual osg::Referenced { HomePosition() {} @@ -76,8 +133,8 @@ struct LayerCallback : public virtual osg::Referenced struct OSGPRESENTATION_EXPORT 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) {} + LayerAttributes():_duration(0) {} + LayerAttributes(double in_duration):_duration(in_duration) {} void setDuration(double duration) { _duration = duration; } double getDuration() const { return _duration; } @@ -95,26 +152,13 @@ struct OSGPRESENTATION_EXPORT LayerAttributes : public virtual osg::Referenced void addRunString(const std::string& runString) { _runStrings.push_back(runString); } - void setJump(bool relativeJump, int slideNum, int layerNum) - { - _relativeJump = relativeJump; - _slideNum = slideNum; - _layerNum = layerNum; - } + void setJump(const JumpData& jumpData) { _jumpData = jumpData; } + const JumpData& getJumpData() const { return _jumpData; } - 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; + double _duration; + Keys _keys; + RunStrings _runStrings; + JumpData _jumpData; void addEnterCallback(LayerCallback* lc) { _enterLayerCallbacks.push_back(lc); } void addLeaveCallback(LayerCallback* lc) { _leaveLayerCallbacks.push_back(lc); } @@ -144,9 +188,6 @@ struct dereference_less } }; -// forward declare -class SlideEventHandler; - struct ObjectOperator : public osg::Referenced { inline bool operator < (const ObjectOperator& rhs) const { return ptr() < rhs.ptr(); } @@ -282,6 +323,8 @@ public: osgViewer::Viewer* getViewer() { return _viewer.get(); } + osg::Switch* getPresentationSwitch() { return _presentationSwitch.get(); } + enum WhichPosition { FIRST_POSITION = 0, @@ -296,6 +339,9 @@ public: int getActiveSlide() const { return _activeSlide; } int getActiveLayer() const { return _activeLayer; } + osg::Switch* getSlide(int slideNum); + osg::Node* getLayer(int slideNum, int layerNum); + bool selectSlide(int slideNum,int layerNum=FIRST_POSITION); bool selectLayer(int layerNum); diff --git a/include/osgPresentation/SlideShowConstructor b/include/osgPresentation/SlideShowConstructor index 28726b9e7..897060ab1 100644 --- a/include/osgPresentation/SlideShowConstructor +++ b/include/osgPresentation/SlideShowConstructor @@ -79,6 +79,7 @@ public: enum CoordinateFrame { SLIDE, MODEL }; + LayerAttributes* getOrCreateLayerAttributes(osg::Node* node); void setDuration(osg::Node* node,double duration) @@ -96,9 +97,9 @@ public: getOrCreateLayerAttributes(node)->addRunString(runString); } - void setJump(osg::Node* node, bool relativeJump, int slideNum, int layerNum) + void setJump(osg::Node* node, const JumpData& jumpData) { - getOrCreateLayerAttributes(node)->setJump(relativeJump, slideNum, layerNum); + getOrCreateLayerAttributes(node)->setJump(jumpData); } void addPresentationKey(const KeyPosition& kp) @@ -125,10 +126,10 @@ public: if (_slide.valid()) addRunString(_slide.get(),runString); } - void setSlideJump(bool relativeJump, int switchNum, int layerNum) + void setSlideJump(const JumpData& jumpData) { if (!_slide) addSlide(); - if (_slide.valid()) setJump(_slide.get(),relativeJump, switchNum, layerNum); + if (_slide.valid()) setJump(_slide.get(),jumpData); } void addLayerKey(const KeyPosition& kp) @@ -144,10 +145,10 @@ public: } - void setLayerJump(bool relativeJump, int switchNum, int layerNum) + void setLayerJump(const JumpData& jumpData) { if (!_currentLayer) addLayer(); - if (_currentLayer.valid()) setJump(_currentLayer.get(),relativeJump, switchNum, layerNum); + if (_currentLayer.valid()) setJump(_currentLayer.get(),jumpData); } @@ -334,7 +335,6 @@ public: osg::Vec4 color; }; - SlideShowConstructor(osgDB::Options* options); void createPresentation(); @@ -404,9 +404,21 @@ public: PositionData& getModelPositionDataDefault() { return _modelPositionDataDefault; } - 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 KeyPosition& keyPos, bool relativeJump=true, int slideNum=0, int layerNum=0); + enum PresentationContext { + CURRENT_PRESENTATION, + CURRENT_SLIDE, + CURRENT_LAYER + }; + + void addEventHandler(PresentationContext presentationContext, osg::ref_ptr handler); + + void keyToDoOperation(PresentationContext presentationContext, int key, Operation operation, const JumpData& jumpData=JumpData()); + void keyToDoOperation(PresentationContext presentationContext, int key, const std::string& command, Operation operation, const JumpData& jumpData=JumpData()); + void keyEventOperation(PresentationContext presentationContext, int key, const KeyPosition& keyPos, const JumpData& jumpData=JumpData()); + + void layerClickToDoOperation(Operation operation, const JumpData& jumpData=JumpData()); + void layerClickToDoOperation(const std::string& command, Operation operation, const JumpData& jumpData=JumpData()); + void layerClickEventOperation(const KeyPosition& keyPos, const JumpData& jumpData=JumpData()); void addToCurrentLayer(osg::Node* subgraph); @@ -540,7 +552,9 @@ protected: osg::ref_ptr _filePathData; osg::ref_ptr _layerToApplyEventCallbackTo; - osg::ref_ptr _currentEventCallbackToApply; + + typedef std::list< osg::ref_ptr > EventHandlerList; + EventHandlerList _currentEventCallbacksToApply; std::string findFileAndRecordPath(const std::string& filename); diff --git a/src/osgPlugins/p3d/ReaderWriterP3D.cpp b/src/osgPlugins/p3d/ReaderWriterP3D.cpp index 8667b3e64..76c769abb 100644 --- a/src/osgPlugins/p3d/ReaderWriterP3D.cpp +++ b/src/osgPlugins/p3d/ReaderWriterP3D.cpp @@ -178,6 +178,7 @@ public: inline bool read(const std::string& str, osg::Vec4& value) const; bool getProperty(osgDB::XmlNode*cur, const char* token) const; + bool getKeyProperty(osgDB::XmlNode*cur, const char* token, int& value) const; bool getProperty(osgDB::XmlNode*cur, const char* token, int& value) const; bool getProperty(osgDB::XmlNode*cur, const char* token, float& value) const; bool getProperty(osgDB::XmlNode*cur, const char* token, double& value) const; @@ -195,7 +196,7 @@ public: bool getProperties(osgDB::XmlNode*cur, osgPresentation::SlideShowConstructor::FontData& value) const; bool getProperties(osgDB::XmlNode*cur, osgPresentation::SlideShowConstructor::ModelData& value) const; bool getProperties(osgDB::XmlNode*cur, osgPresentation::SlideShowConstructor::ImageData& value) const; - bool getJumpProperties(osgDB::XmlNode*cur, bool& relativeJump, int& slideNum, int& layerNum) const; + bool getJumpProperties(osgDB::XmlNode*cur, osgPresentation::JumpData& jumpData) const; bool getKeyPositionInner(osgDB::XmlNode*cur, osgPresentation::KeyPosition& keyPosition) const; bool getKeyPosition(osgDB::XmlNode*cur, osgPresentation::KeyPosition& keyPosition) const; @@ -380,6 +381,40 @@ bool ReaderWriterP3DXML::getProperty(osgDB::XmlNode*cur, const char* token, int& return read(itr->second,value); } +bool ReaderWriterP3DXML::getKeyProperty(osgDB::XmlNode*cur, const char* token, int& value) const +{ + osgDB::XmlNode::Properties::iterator itr = cur->properties.find(token); + if (itr==cur->properties.end()) return false; + + OSG_NOTICE<<"getKeyProperty()="<second<second.empty()) + { + OSG_NOTICE<<" empty()"<second.find("0x",0,2)!=std::string::npos) + { + std::istringstream iss(itr->second); + iss>>std::hex>>value; + return true; + } + else if (itr->second.size()>1 && (itr->second[0]>='0' && itr->second[0]<='9')) + { + std::istringstream iss(itr->second); + iss>>value; + OSG_NOTICE<<" numeric result = "<second[0]; + OSG_NOTICE<<" alphanumeric result = "<properties.find(token); @@ -922,19 +957,31 @@ bool ReaderWriterP3DXML::getProperties(osgDB::XmlNode*cur, osgPresentation::Slid return propertiesRead; } -bool ReaderWriterP3DXML::getJumpProperties(osgDB::XmlNode*cur, bool& relativeJump, int& slideNum, int& layerNum) const +bool ReaderWriterP3DXML::getJumpProperties(osgDB::XmlNode*cur, osgPresentation::JumpData& jumpData) const { bool propertyRead = false; - if (getProperty(cur, "slide", slideNum)) + if (getProperty(cur, "slide_name", jumpData.slideName)) { - OSG_INFO<<"slide "<name == "click_to_run") { - bool relativeJump = true; - int slideNum = 0; - int layerNum = 0; - getJumpProperties(cur, relativeJump, slideNum, layerNum); + osgPresentation::JumpData jumpData; + getJumpProperties(cur, jumpData); OSG_INFO<<"click_to_run ["<contents<<"]"<contents,osgPresentation::RUN, relativeJump, slideNum, layerNum); + constructor.layerClickToDoOperation(cur->contents,osgPresentation::RUN, jumpData); } else if (cur->name == "click_to_load") { - bool relativeJump = true; - int slideNum = 0; - int layerNum = 0; - getJumpProperties(cur, relativeJump, slideNum, layerNum); + osgPresentation::JumpData jumpData; + getJumpProperties(cur, jumpData); OSG_INFO<<"click_to_load ["<contents<<"]"<contents,osgPresentation::LOAD, relativeJump, slideNum, layerNum); + constructor.layerClickToDoOperation(cur->contents,osgPresentation::LOAD, jumpData); } else if (cur->name == "click_to_event") { - bool relativeJump = true; - int slideNum = 0; - int layerNum = 0; - getJumpProperties(cur, relativeJump, slideNum, layerNum); + osgPresentation::JumpData jumpData; + getJumpProperties(cur, jumpData); if (getKeyPositionInner( cur, keyPosition)) { OSG_INFO<<"click_to_event ["<name == "click_to_jump") { - bool relativeJump = true; - int slideNum = 0; - int layerNum = 0; - getJumpProperties(cur, relativeJump, slideNum, layerNum); + osgPresentation::JumpData jumpData; + getJumpProperties(cur, jumpData); - constructor.layerClickEventOperation(osgPresentation::JUMP, relativeJump, slideNum, layerNum); + constructor.layerClickEventOperation(osgPresentation::JUMP, jumpData); + } + + else if (cur->name == "key_to_run") + { + int key; + if (getKeyProperty(cur, "key", key)) + { + osgPresentation::JumpData jumpData; + getJumpProperties(cur, jumpData); + + OSG_NOTICE<<"key_to_run ["<contents<<"], key="<contents,osgPresentation::RUN, jumpData); + } + } + else if (cur->name == "key_to_load") + { + int key; + if (getKeyProperty(cur, "key", key)) + { + osgPresentation::JumpData jumpData; + getJumpProperties(cur, jumpData); + + OSG_NOTICE<<"key_to_load ["<contents<<"]"<contents,osgPresentation::LOAD, jumpData); + } + } + + else if (cur->name == "key_to_event") + { + int key; + if (getKeyProperty(cur, "key", key)) + { + osgPresentation::JumpData jumpData; + getJumpProperties(cur, jumpData); + + if (getKeyPositionInner( cur, keyPosition)) + { + OSG_NOTICE<<"key_to_event ["<name == "key_to_jump") + { + int key; + if (getKeyProperty(cur, "key", key)) + { + osgPresentation::JumpData jumpData; + getJumpProperties(cur, jumpData); + + OSG_NOTICE<<"key_to_jump"<name == "newline") @@ -1449,6 +1541,19 @@ void ReaderWriterP3DXML::parseLayer(osgPresentation::SlideShowConstructor& const constructor.translateTextCursor(osg::Vec3(-totalIndent,0.0f,0.0f)); } + std::string name; + if (getProperty(root, "layer_name", name)) + { + if (constructor.getCurrentLayer()) + { + constructor.getCurrentLayer()->setUserValue("name",name); + OSG_NOTICE<<"Setting current layers name "<name == "layer") { @@ -1697,6 +1803,20 @@ void ReaderWriterP3DXML::parseSlide (osgPresentation::SlideShowConstructor& cons } } + std::string name; + if (getProperty(root, "slide_name", name)) + { + if (constructor.getCurrentSlide()) + { + constructor.getCurrentSlide()->setUserValue("name",name); + OSG_NOTICE<<"Setting current slide name "<getActiveSlide(); - int previousLayer = SlideEventHandler::instance()->getActiveLayer(); - int newSlide = previousSlide + _slideNum; - int newLayer = previousLayer + _layerNum; - if (newLayer<0) - { - newLayer = 0; - } - - OSG_NOTICE<<" jump to "<selectSlide(newSlide, newLayer); - } - else - { - SlideEventHandler::instance()->selectSlide(_slideNum,_layerNum); - } + _jumpData.jump(SlideEventHandler::instance()); } else { diff --git a/src/osgPresentation/SlideEventHandler.cpp b/src/osgPresentation/SlideEventHandler.cpp index a9c0e8a17..0ddaaefd0 100644 --- a/src/osgPresentation/SlideEventHandler.cpp +++ b/src/osgPresentation/SlideEventHandler.cpp @@ -23,6 +23,8 @@ #include #include +#include + #include #include @@ -35,6 +37,75 @@ static osg::observer_ptr s_seh; SlideEventHandler* SlideEventHandler::instance() { return s_seh.get(); } +bool JumpData::jump(SlideEventHandler* seh) const +{ + OSG_INFO<<"Requires jump "<getPresentationSwitch(); + + for(unsigned int i=0; igetNumChildren(); ++i) + { + osg::Node* node = seh->getSlide(i); + std::string name; + if (node->getUserValue("name",name) && slideName==name) + { + slideNumToUse = i; + break; + } + } + } + else if (relativeJump) + { + slideNumToUse = seh->getActiveSlide() + slideNum; + } + + + if (!layerName.empty()) + { + osg::Switch* slide = seh->getSlide(slideNumToUse); + if (slide) + { + unsigned int i; + for(i=0; igetNumChildren(); ++i) + { + osg::Node* node = slide->getChild(i); + std::string name; + if (node->getUserValue("name",name)) + { + if (layerName==name) + { + layerNumToUse = i; + break; + } + } + } + if (i==slide->getNumChildren()) + { + OSG_INFO<<"Could not find layer with "<getActiveLayer() + layerNum; + } + + if (slideNumToUse<0) slideNumToUse = 0; + if (layerNumToUse<0) layerNumToUse = 0; + + OSG_INFO<<" jump to "<selectSlide(slideNumToUse,layerNumToUse); +} + void LayerAttributes::callEnterCallbacks(osg::Node* node) { OSG_INFO<<"LayerAttributes::callEnterCallbacks("<accept(fov); + + if (incommingNode) + { + incommingNode->accept(fov); + } + else + { + OSG_NOTICE<<"ActiveOperators::collect() incommingNode="<getChild(slideNum)->accept(findSlide); + return findSlide._switch; +} + +osg::Node* SlideEventHandler::getLayer(int slideNum, int layerNum) +{ + osg::Switch* slide = getSlide(slideNum); + return (slide && (layerNum>=0 && layerNum(slide->getNumChildren()))) ? slide->getChild(layerNum) : 0; +} + bool SlideEventHandler::selectSlide(int slideNum,int layerNum) { @@ -1245,25 +1339,9 @@ bool SlideEventHandler::nextSlide() { OSG_INFO<<"nextSlide()"<(_slideSwitch->getUserData()) : 0; - if (la && la->requiresJump()) + if (la && la->getJumpData().requiresJump()) { - if (la->getRelativeJump()) - { - int previousSlide = getActiveSlide(); - int previousLayer = getActiveLayer(); - int newSlide = previousSlide + la->getSlideNum(); - int newLayer = previousLayer + la->getLayerNum(); - if (newLayer<0) - { - newLayer = 0; - } - - return selectSlide(newSlide, newLayer); - } - else - { - return selectSlide(la->getSlideNum(),la->getLayerNum()); - } + return la->getJumpData().jump(this); } if (selectSlide(_activeSlide+1)) return true; @@ -1294,25 +1372,9 @@ bool SlideEventHandler::nextLayer() { la->callLeaveCallbacks(_slideSwitch->getChild(_activeLayer)); - if (la->requiresJump()) + if (la->getJumpData().requiresJump()) { - if (la->getRelativeJump()) - { - int previousSlide = getActiveSlide(); - int previousLayer = getActiveLayer(); - int newSlide = previousSlide + la->getSlideNum(); - int newLayer = previousLayer + la->getLayerNum(); - if (newLayer<0) - { - newLayer = 0; - } - - return selectSlide(newSlide, newLayer); - } - else - { - return selectSlide(la->getSlideNum(),la->getLayerNum()); - } + return la->getJumpData().jump(this); } } diff --git a/src/osgPresentation/SlideShowConstructor.cpp b/src/osgPresentation/SlideShowConstructor.cpp index 1a64e7ffd..65fa5eb79 100644 --- a/src/osgPresentation/SlideShowConstructor.cpp +++ b/src/osgPresentation/SlideShowConstructor.cpp @@ -51,6 +51,7 @@ #include #include +#include #include #include @@ -199,7 +200,7 @@ SlideShowConstructor::SlideShowConstructor(osgDB::Options* options): _slideBackgroundAsHUD = false; _layerToApplyEventCallbackTo = 0; - _currentEventCallbackToApply = 0; + _currentEventCallbacksToApply.clear(); } void SlideShowConstructor::setPresentationAspectRatio(float aspectRatio) @@ -393,6 +394,7 @@ void SlideShowConstructor::addLayer(bool inheritPreviousLayers, bool defineAsBas if (!_slide) addSlide(); _currentLayer = new osg::Group; + _currentLayer->setName("Layer"); // OSG_NOTICE<<"addLayer"<getEventCallback()=="<getEventCallback()<getEventCallback()==0) { if (_layerToApplyEventCallbackTo==0 || _currentLayer==_layerToApplyEventCallbackTo) { - OSG_INFO<<"Assigning event callback."<setEventCallback(_currentEventCallbackToApply.get()); + OSG_NOTICE<<"Assigning event callbacks."<addEventCallback(itr->get()); + } } else { @@ -560,29 +570,65 @@ void SlideShowConstructor::addToCurrentLayer(osg::Node* subgraph) { OSG_NOTICE<<"Warning: subgraph already has event callback assigned, cannot add second event callback."<addChild(subgraph); } -void SlideShowConstructor::layerClickToDoOperation(Operation operation, bool relativeJump, int slideNum, int layerNum) +void SlideShowConstructor::addEventHandler(PresentationContext presentationContext, osg::ref_ptr handler) { - _layerToApplyEventCallbackTo = _currentLayer; - _currentEventCallbackToApply = new PickEventHandler(operation, relativeJump, slideNum, layerNum); + switch(presentationContext) + { + case(CURRENT_PRESENTATION): + OSG_NOTICE<<"Need to add event handler to presentation."<