From bf4daf11ffd39993e9b34d4654cc6b251f19f475 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 12 Nov 2012 16:46:08 +0000 Subject: [PATCH] Cleaned up reported of events and added assigned of tag region properities when using the wildcard definition of the volume. --- src/osgPresentation/PickEventHandler.cpp | 9 ++++-- src/osgPresentation/SlideEventHandler.cpp | 2 +- src/osgPresentation/SlideShowConstructor.cpp | 34 +++++++++----------- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/osgPresentation/PickEventHandler.cpp b/src/osgPresentation/PickEventHandler.cpp index f2f4df006..d1cd0fb4b 100644 --- a/src/osgPresentation/PickEventHandler.cpp +++ b/src/osgPresentation/PickEventHandler.cpp @@ -25,6 +25,7 @@ PickEventHandler::PickEventHandler(osgPresentation::Operation operation, const J _operation(operation), _jumpData(jumpData) { + OSG_INFO<<"PickEventHandler::PickEventHandler(operation="<dispatchEvent(_keyPos); break; } case(osgPresentation::JUMP): { - OSG_NOTICE<<"Requires jump "< _imageSequence; diff --git a/src/osgPresentation/SlideShowConstructor.cpp b/src/osgPresentation/SlideShowConstructor.cpp index 65fa5eb79..e4bf86c5f 100644 --- a/src/osgPresentation/SlideShowConstructor.cpp +++ b/src/osgPresentation/SlideShowConstructor.cpp @@ -544,32 +544,24 @@ void SlideShowConstructor::addToCurrentLayer(osg::Node* subgraph) if (!_currentLayer) addLayer(); - OSG_NOTICE<<"_currentEventCallbacksToApply.size()="<<_currentEventCallbacksToApply.size()<getEventCallback()=="<getEventCallback()<getEventCallback()==0) + if (_layerToApplyEventCallbackTo==0 || _currentLayer==_layerToApplyEventCallbackTo) { - if (_layerToApplyEventCallbackTo==0 || _currentLayer==_layerToApplyEventCallbackTo) - { - OSG_NOTICE<<"Assigning event callbacks."<addEventCallback(itr->get()); - } - } - else + for(EventHandlerList::iterator itr = _currentEventCallbacksToApply.begin(); + itr != _currentEventCallbacksToApply.end(); + ++itr) { - OSG_INFO<<"Ignoring event callback from previous layer."<addEventCallback(itr->get()); } } else { - OSG_NOTICE<<"Warning: subgraph already has event callback assigned, cannot add second event callback."<addChild(subgraph); @@ -2156,13 +2148,19 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position } layer->rescaleToZeroToOneRange(); + osg::Matrix tm = osg::Matrix::scale(volumeData.region[3]-volumeData.region[0], volumeData.region[4]-volumeData.region[1], volumeData.region[5]-volumeData.region[2]) * + osg::Matrix::translate(volumeData.region[0],volumeData.region[1],volumeData.region[2]); + if (matrix.valid()) { layer->setLocator(new osgVolume::Locator(*matrix)); - osg::Matrix tm = osg::Matrix::scale(volumeData.region[3]-volumeData.region[0], volumeData.region[4]-volumeData.region[1], volumeData.region[5]-volumeData.region[2]) * - osg::Matrix::translate(volumeData.region[0],volumeData.region[1],volumeData.region[2]); tile->setLocator(new osgVolume::Locator(tm * (*matrix))); } + else + { + layer->setLocator(new osgVolume::Locator()); + tile->setLocator(new osgVolume::Locator(tm)); + } tile->setLayer(layer.get());