Skip to content
  • finetjul's avatar
    ENH: Add generic way to handle batch node insertion/removal in vtkMRMLScene · 7b1390b1
    finetjul authored
    vtkMRMLScene has now a notion of state. If the scene is loading a mrml scene file, its state is ImportState( ::BatchProcessState
    
    The previous scene behavior has been kept (pseudo backward compatible), the scene still fires the same (renamed) events for each Close, Import and Restore calls.
    Events have been renamed:
     SceneAboutToBeClosedEvent -> StartCloseEvent
     SceneClosedEvent -> EndCloseEvent
     SceneAboutToBeImportedEvent -> StartImportEvent
     SceneImportedEvent -> EndImportEvent
     SceneAboutToBeRestoredEvent -> StartRestoreEvent
     SceneRestoredEvent -> EndRestoreEvent
    
    New events are added:
     - StartBatchProcessEvent: notably (but not only) fired when StartCloseEvent, StartImportEvent, and StartRestoredEvent are fired
     - EndBatchProcessEvent: notably (but not only) fired when EndCloseEvent, EndImportEvent, and EndRestoredEvent are fired
     - ProgressBatchProcessEvent, ProgressCloseEvent, ProgressImportEvent, ProgressRestoreEvent: not yet fired
     - StartSaveEvent: fired when the scene starts to be saved
     - EndSaveEvent: fired when the scene finished to be saved
    
    StartState(vtkMRMLScene::StateType) and EndState(vtkMRMLScene::StateType) control the scene state. Nested states are supported, but each state events are fired only once (e.g. two successive call to StartState(BatchProcessState) fire StartBatchProcessEvent only once).
    Internally, the methods Clear(), Connect(), Import() and Commit() set the scene states.
    In addition, the state can be set externally by any node (e.g. vtkMRMLSceneViewNode) or logic (e.g. vtkMRMLColorLogic)
    
    Preliminary work has been started to fire progress events, but it hasn't been completed (needs to be implemented in AddNode(), RemoveNode(), Import() and Close()).
    
    git-svn-id: http://svn.slicer.org/Slicer4/trunk@18878 3bd1e089-480b-0410-8dfb-8563597acbee
    7b1390b1