An update will be applied January 25th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit 36491c4e authored by jcfr's avatar jcfr
Browse files

BUG: Add virtual method onMRML{View,Slice}NodeModifiedEvent to...

BUG: Add virtual method onMRML{View,Slice}NodeModifiedEvent to vtkMRMLAbstract{ThreeD,Slice}ViewDisplayableManager

These methods could be overloaded by DisplayableManager to re-act upon a modified
event of the associated DisplayableNode (either a MRMLView node or a slicer view node)

That should fix the crash happening after the MRML view node name was updated in the
MRML node inspector of the Data module.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@14577 3bd1e089-480b-0410-8dfb-8563597acbee
parent c83af90b
......@@ -443,6 +443,26 @@ vtkMRMLNode * vtkMRMLAbstractDisplayableManager::GetMRMLDisplayableNode()
return this->Internal->MRMLDisplayableNode;
}
//---------------------------------------------------------------------------
void vtkMRMLAbstractDisplayableManager::ProcessMRMLEvents(
vtkObject* caller, unsigned long event, void * callData)
{
if (vtkMRMLScene::SafeDownCast(caller))
{
this->Superclass::ProcessMRMLEvents(caller, event, callData);
}
else if (vtkMRMLNode::SafeDownCast(caller))
{
assert(event == vtkCommand::ModifiedEvent);
this->onMRMLDisplayableNodeModifiedEvent(caller);
}
else
{
vtkErrorMacro(<< "ProcessMRMLEvents - Unknown caller:" << caller->GetClassName()
<< " - event:" << event);
}
}
//---------------------------------------------------------------------------
void vtkMRMLAbstractDisplayableManager::SetMRMLSceneInternal(vtkMRMLScene* newScene)
{
......
......@@ -92,10 +92,15 @@ protected:
/// \warning That function should only be used directly !
/// \sa Initialize
virtual void AdditionnalInitializeStep(){}
virtual void ProcessMRMLEvents(vtkObject* caller, unsigned long event, void * callData);
/// Called by SetMRMLScene - Used to initialize the Scene
virtual void SetMRMLSceneInternal(vtkMRMLScene* newScene);
/// Could be overloaded in DisplayableManager subclass
virtual void onMRMLDisplayableNodeModifiedEvent(vtkObject* vtkNotUsed(caller)){}
/// Set MRML DisplayableNode
/// Called by vtkMRMLDisplayableManagerFactory
void SetAndObserveMRMLDisplayableNode(vtkMRMLNode * newMRMLDisplayableNode);
......
......@@ -21,6 +21,9 @@
// VTK includes
#include <vtkObjectFactory.h>
// STD includes
#include <cassert>
//---------------------------------------------------------------------------
vtkStandardNewMacro(vtkMRMLAbstractSliceViewDisplayableManager);
vtkCxxRevisionMacro(vtkMRMLAbstractSliceViewDisplayableManager, "$Revision: 13525 $");
......@@ -44,6 +47,14 @@ void vtkMRMLAbstractSliceViewDisplayableManager::PrintSelf(ostream& os, vtkInden
this->Superclass::PrintSelf(os, indent);
}
//---------------------------------------------------------------------------
void vtkMRMLAbstractSliceViewDisplayableManager::onMRMLDisplayableNodeModifiedEvent(
vtkObject* caller)
{
assert(vtkMRMLSliceNode::SafeDownCast(caller));
this->onMRMLSliceNodeModifiedEvent();
}
//---------------------------------------------------------------------------
vtkMRMLSliceNode * vtkMRMLAbstractSliceViewDisplayableManager::GetMRMLSliceNode()
{
......
......@@ -47,6 +47,11 @@ protected:
vtkMRMLAbstractSliceViewDisplayableManager();
virtual ~vtkMRMLAbstractSliceViewDisplayableManager();
virtual void onMRMLDisplayableNodeModifiedEvent(vtkObject* caller);
/// Could be overloaded if DisplayableManager subclass
virtual void onMRMLSliceNodeModifiedEvent(){}
private:
......
......@@ -21,6 +21,9 @@
// VTK includes
#include <vtkObjectFactory.h>
// STD includes
#include <cassert>
//---------------------------------------------------------------------------
vtkStandardNewMacro(vtkMRMLAbstractThreeDViewDisplayableManager);
vtkCxxRevisionMacro(vtkMRMLAbstractThreeDViewDisplayableManager, "$Revision: 13525 $");
......@@ -44,6 +47,14 @@ void vtkMRMLAbstractThreeDViewDisplayableManager::PrintSelf(ostream& os, vtkInde
this->Superclass::PrintSelf(os, indent);
}
//---------------------------------------------------------------------------
void vtkMRMLAbstractThreeDViewDisplayableManager::onMRMLDisplayableNodeModifiedEvent(
vtkObject* caller)
{
assert(vtkMRMLViewNode::SafeDownCast(caller));
this->onMRMLViewNodeModifiedEvent();
}
//---------------------------------------------------------------------------
vtkMRMLViewNode * vtkMRMLAbstractThreeDViewDisplayableManager::GetMRMLViewNode()
{
......
......@@ -47,6 +47,11 @@ protected:
vtkMRMLAbstractThreeDViewDisplayableManager();
virtual ~vtkMRMLAbstractThreeDViewDisplayableManager();
virtual void onMRMLDisplayableNodeModifiedEvent(vtkObject* caller);
/// Could be overloaded if DisplayableManager subclass
virtual void onMRMLViewNodeModifiedEvent(){}
private:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment