10 #ifndef __vtkMRMLAbstractLogic_h 11 #define __vtkMRMLAbstractLogic_h 22 #include <vtkCommand.h> 23 #include <vtkObject.h> 27 #include "vtkMRMLLogicExport.h" 35 #ifndef vtkSetMRMLNodeMacro 36 #define vtkSetMRMLNodeMacro(node,value) { \ 37 vtkObject *_oldNode = (node); \ 38 this->GetMRMLNodesObserverManager()->SetObject( \ 39 vtkObjectPointer(&(node)), (value)); \ 40 vtkObject *_newNode = (node); \ 41 if (_oldNode != _newNode) \ 49 #ifndef vtkSetAndObserveMRMLNodeMacro 50 #define vtkSetAndObserveMRMLNodeMacro(node,value) { \ 67 vtkObject *_oldNode = (node); \ 68 this->GetMRMLNodesObserverManager()->SetAndObserveObject( \ 69 vtkObjectPointer(&(node)), (value)); \ 70 vtkObject *_newNode = (node); \ 71 if (_oldNode != _newNode) \ 79 #ifndef vtkSetAndObserveMRMLNodeEventsMacro 80 #define vtkSetAndObserveMRMLNodeEventsMacro(node,value,events) { \ 81 vtkObject *_oldNode = (node); \ 82 this->GetMRMLNodesObserverManager()->SetAndObserveObjectEvents( \ 83 vtkObjectPointer(&(node)), (value), (events)); \ 84 vtkObject *_newNode = (node); \ 85 if (_oldNode != _newNode) \ 92 #ifndef vtkObserveMRMLNodeMacro 93 #define vtkObserveMRMLNodeMacro(node) \ 95 this->GetMRMLNodesObserverManager()->ObserveObject( (node) ); \ 100 #ifndef vtkObserveMRMLNodeEventsMacro 101 #define vtkObserveMRMLNodeEventsMacro(node, events) \ 103 this->GetMRMLNodesObserverManager()->AddObjectEvents ( (node), (events) ); \ 107 #ifndef vtkUnObserveMRMLNodeMacro 108 #define vtkUnObserveMRMLNodeMacro(node) \ 110 this->GetMRMLNodesObserverManager()->RemoveObjectEvents ( (node) ); \ 114 #ifndef vtkIsObservedMRMLNodeEventMacro 115 #define vtkIsObservedMRMLNodeEventMacro(node, event) \ 117 this->GetMRMLNodesObserverManager()->GetObservationsCount(node, event) != 0 \ 141 void PrintSelf(ostream& os, vtkIndent indent)
override;
163 void SetAndObserveMRMLSceneEvents(
vtkMRMLScene * newScene, vtkIntArray * events, vtkFloatArray* priorities=
nullptr);
173 virtual void ProcessMRMLSceneEvents(vtkObject* caller,
186 virtual void ProcessMRMLNodesEvents(vtkObject* caller,
196 virtual void ProcessMRMLLogicsEvents(vtkObject* caller,
204 vtkCallbackCommand * GetMRMLSceneCallbackCommand();
210 vtkCallbackCommand * GetMRMLNodesCallbackCommand();
214 vtkCallbackCommand * GetMRMLLogicsCallbackCommand();
229 int GetProcessingMRMLSceneEvent()
const;
236 virtual void UnobserveMRMLScene();
244 virtual void ObserveMRMLScene();
251 virtual void UpdateFromMRMLScene();
264 virtual void OnMRMLSceneEndBatchProcess();
321 virtual void SetMRMLSceneInternal(
vtkMRMLScene* newScene);
326 void SetAndObserveMRMLSceneInternal(
vtkMRMLScene *newScene);
341 void SetAndObserveMRMLSceneEventsInternal(
vtkMRMLScene *newScene,
343 vtkFloatArray *priorities=
nullptr);
353 void SetInMRMLSceneCallbackFlag(
int flag);
359 int GetInMRMLSceneCallbackFlag()
const;
363 virtual bool EnterMRMLSceneCallback()
const;
367 void SetProcessingMRMLSceneEvent(
int event);
373 void SetInMRMLNodesCallbackFlag(
int flag);
379 int GetInMRMLNodesCallbackFlag()
const;
384 virtual bool EnterMRMLNodesCallback()
const;
390 void SetInMRMLLogicsCallbackFlag(
int flag);
396 int GetInMRMLLogicsCallbackFlag()
const;
400 virtual bool EnterMRMLLogicsCallback()
const;
404 static void MRMLSceneCallback(vtkObject *caller,
unsigned long eid,
void *clientData,
void *callData);
407 static void MRMLNodesCallback(vtkObject *caller,
unsigned long eid,
void *clientData,
void *callData);
410 static void MRMLLogicsCallback(vtkObject *caller,
unsigned long eid,
void *clientData,
void *callData);
415 inline bool StartModify() ;
420 inline int EndModify(
bool wasModifying);
422 bool GetDisableModifiedEvent()
const;
423 void SetDisableModifiedEvent(
bool onOff);
430 void Modified()
override;
434 int InvokePendingModifiedEvent();
436 int GetPendingModifiedEventCount()
const;
444 vtkInternal * Internal;
453 return disabledModify;
460 if (!previousDisableModifiedEventState)
virtual void OnMRMLSceneStartClose()
Superclass for MRML logic classes.
int InvokePendingModifiedEvent()
virtual void OnMRMLSceneEndImport()
virtual void OnMRMLSceneEndClose()
Manages adding and deleting of obserevers with events.
virtual void OnMRMLSceneNew()
bool GetDisableModifiedEvent() const
virtual void OnMRMLSceneStartImport()
int EndModify(bool wasModifying)
virtual void OnMRMLSceneStartBatchProcess()
virtual void OnMRMLNodeModified(vtkMRMLNode *)
A set of MRML Nodes that supports serialization and undo/redo.
virtual void OnMRMLSceneNodeAdded(vtkMRMLNode *)
virtual void RegisterNodes()
virtual void OnMRMLSceneNodeRemoved(vtkMRMLNode *)
int GetPendingModifiedEventCount() const
virtual void OnMRMLSceneEndRestore()
virtual void OnMRMLSceneStartRestore()
void SetDisableModifiedEvent(bool onOff)
Abstract Superclass for all specific types of MRML nodes.