Cleaned up reported of events and added assigned of <volume> tag region properities when using the wildcard definition of the volume.
This commit is contained in:
@@ -25,6 +25,7 @@ PickEventHandler::PickEventHandler(osgPresentation::Operation operation, const J
|
||||
_operation(operation),
|
||||
_jumpData(jumpData)
|
||||
{
|
||||
OSG_INFO<<"PickEventHandler::PickEventHandler(operation="<<operation<<", jumpData.relativeJump="<<jumpData.relativeJump<<", jumpData.="<<jumpData.slideNum<<", jumpData.layerNum="<<jumpData.layerNum<<std::endl;
|
||||
}
|
||||
|
||||
PickEventHandler::PickEventHandler(const std::string& str, osgPresentation::Operation operation, const JumpData& jumpData):
|
||||
@@ -32,6 +33,7 @@ PickEventHandler::PickEventHandler(const std::string& str, osgPresentation::Oper
|
||||
_operation(operation),
|
||||
_jumpData(jumpData)
|
||||
{
|
||||
OSG_INFO<<"PickEventHandler::PickEventHandler(str="<<str<<", operation="<<operation<<", jumpData.relativeJump="<<jumpData.relativeJump<<", jumpData.="<<jumpData.slideNum<<", jumpData.layerNum="<<jumpData.layerNum<<std::endl;
|
||||
}
|
||||
|
||||
PickEventHandler::PickEventHandler(const osgPresentation::KeyPosition& keyPos, const JumpData& jumpData):
|
||||
@@ -39,6 +41,7 @@ PickEventHandler::PickEventHandler(const osgPresentation::KeyPosition& keyPos, c
|
||||
_operation(osgPresentation::EVENT),
|
||||
_jumpData(jumpData)
|
||||
{
|
||||
OSG_INFO<<"PickEventHandler::PickEventHandler(keyPos="<<keyPos._key<<", jumpData.relativeJump="<<jumpData.relativeJump<<", jumpData.="<<jumpData.slideNum<<", jumpData.layerNum="<<jumpData.layerNum<<std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -166,13 +169,13 @@ void PickEventHandler::doOperation()
|
||||
}
|
||||
case(osgPresentation::EVENT):
|
||||
{
|
||||
OSG_INFO<<"Event "<<_keyPos._key<<" "<<_keyPos._x<<" "<<_keyPos._y<<std::endl;
|
||||
OSG_NOTICE<<"Event "<<_keyPos._key<<" "<<_keyPos._x<<" "<<_keyPos._y<<std::endl;
|
||||
if (SlideEventHandler::instance()) SlideEventHandler::instance()->dispatchEvent(_keyPos);
|
||||
break;
|
||||
}
|
||||
case(osgPresentation::JUMP):
|
||||
{
|
||||
OSG_NOTICE<<"Requires jump "<<std::endl;
|
||||
OSG_INFO<<"Requires jump "<<std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -183,7 +186,7 @@ void PickEventHandler::doOperation()
|
||||
}
|
||||
else
|
||||
{
|
||||
OSG_NOTICE<<"No jump required."<<std::endl;
|
||||
OSG_INFO<<"No jump required."<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ struct InteractiveImageSequenceOperator : public ObjectOperator
|
||||
|
||||
void set(SlideEventHandler* seh)
|
||||
{
|
||||
OSG_NOTICE<<"InteractiveImageSequenceOperator::set(..)"<<std::endl;
|
||||
//OSG_NOTICE<<"InteractiveImageSequenceOperator::set(..)"<<std::endl;
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::ImageSequence> _imageSequence;
|
||||
|
||||
@@ -544,32 +544,24 @@ void SlideShowConstructor::addToCurrentLayer(osg::Node* subgraph)
|
||||
|
||||
if (!_currentLayer) addLayer();
|
||||
|
||||
OSG_NOTICE<<"_currentEventCallbacksToApply.size()="<<_currentEventCallbacksToApply.size()<<std::endl;
|
||||
if (!_currentEventCallbacksToApply.empty())
|
||||
{
|
||||
OSG_NOTICE<<" subgraph->getEventCallback()=="<<subgraph->getEventCallback()<<std::endl;
|
||||
if (subgraph->getEventCallback()==0)
|
||||
if (_layerToApplyEventCallbackTo==0 || _currentLayer==_layerToApplyEventCallbackTo)
|
||||
{
|
||||
if (_layerToApplyEventCallbackTo==0 || _currentLayer==_layerToApplyEventCallbackTo)
|
||||
{
|
||||
OSG_NOTICE<<"Assigning event callbacks."<<std::endl;
|
||||
OSG_NOTICE<<"Assigning event callbacks."<<std::endl;
|
||||
|
||||
for(EventHandlerList::iterator itr = _currentEventCallbacksToApply.begin();
|
||||
itr != _currentEventCallbacksToApply.end();
|
||||
++itr)
|
||||
{
|
||||
subgraph->addEventCallback(itr->get());
|
||||
}
|
||||
}
|
||||
else
|
||||
for(EventHandlerList::iterator itr = _currentEventCallbacksToApply.begin();
|
||||
itr != _currentEventCallbacksToApply.end();
|
||||
++itr)
|
||||
{
|
||||
OSG_INFO<<"Ignoring event callback from previous layer."<<std::endl;
|
||||
subgraph->addEventCallback(itr->get());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OSG_NOTICE<<"Warning: subgraph already has event callback assigned, cannot add second event callback."<<std::endl;
|
||||
OSG_INFO<<"Ignoring event callback from previous layer."<<std::endl;
|
||||
}
|
||||
|
||||
_currentEventCallbacksToApply.clear();
|
||||
}
|
||||
_currentLayer->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());
|
||||
|
||||
Reference in New Issue
Block a user