diff --git a/Modules/Core/files.cmake b/Modules/Core/files.cmake index 869340a1c3..b54380013b 100644 --- a/Modules/Core/files.cmake +++ b/Modules/Core/files.cmake @@ -1,327 +1,326 @@ file(GLOB_RECURSE H_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include/*") set(CPP_FILES mitkCoreActivator.cpp mitkCoreObjectFactoryBase.cpp mitkCoreObjectFactory.cpp mitkCoreServices.cpp mitkException.cpp Algorithms/mitkBaseDataSource.cpp Algorithms/mitkClippedSurfaceBoundsCalculator.cpp Algorithms/mitkCompareImageDataFilter.cpp Algorithms/mitkCompositePixelValueToString.cpp Algorithms/mitkConvert2Dto3DImageFilter.cpp Algorithms/mitkDataNodeSource.cpp Algorithms/mitkExtractSliceFilter.cpp Algorithms/mitkExtractSliceFilter2.cpp Algorithms/mitkHistogramGenerator.cpp Algorithms/mitkImageChannelSelector.cpp Algorithms/mitkImageSliceSelector.cpp Algorithms/mitkImageSource.cpp Algorithms/mitkImageTimeSelector.cpp Algorithms/mitkImageToImageFilter.cpp Algorithms/mitkImageToSurfaceFilter.cpp Algorithms/mitkMultiComponentImageDataComparisonFilter.cpp Algorithms/mitkPlaneGeometryDataToSurfaceFilter.cpp Algorithms/mitkPointSetSource.cpp Algorithms/mitkPointSetToPointSetFilter.cpp Algorithms/mitkRGBToRGBACastImageFilter.cpp Algorithms/mitkSubImageSelector.cpp Algorithms/mitkSurfaceSource.cpp Algorithms/mitkSurfaceToImageFilter.cpp Algorithms/mitkSurfaceToSurfaceFilter.cpp Algorithms/mitkUIDGenerator.cpp Algorithms/mitkVolumeCalculator.cpp Algorithms/mitkTemporalJoinImagesFilter.cpp Controllers/mitkBaseController.cpp Controllers/mitkCallbackFromGUIThread.cpp Controllers/mitkCameraController.cpp Controllers/mitkCameraRotationController.cpp Controllers/mitkLimitedLinearUndo.cpp Controllers/mitkOperationEvent.cpp Controllers/mitkPlanePositionManager.cpp Controllers/mitkProgressBar.cpp Controllers/mitkRenderingManager.cpp Controllers/mitkSliceNavigationController.cpp - Controllers/mitkSlicesCoordinator.cpp Controllers/mitkStatusBar.cpp Controllers/mitkStepper.cpp Controllers/mitkTestManager.cpp Controllers/mitkUndoController.cpp Controllers/mitkVerboseLimitedLinearUndo.cpp Controllers/mitkVtkLayerController.cpp DataManagement/mitkAnatomicalStructureColorPresets.cpp DataManagement/mitkArbitraryTimeGeometry.cpp DataManagement/mitkAbstractTransformGeometry.cpp DataManagement/mitkAnnotationProperty.cpp DataManagement/mitkApplicationCursor.cpp DataManagement/mitkApplyTransformMatrixOperation.cpp DataManagement/mitkBaseData.cpp DataManagement/mitkBaseGeometry.cpp DataManagement/mitkBaseProperty.cpp DataManagement/mitkChannelDescriptor.cpp DataManagement/mitkClippingProperty.cpp DataManagement/mitkColorProperty.cpp DataManagement/mitkDataNode.cpp DataManagement/mitkDataStorage.cpp DataManagement/mitkEnumerationProperty.cpp DataManagement/mitkFloatPropertyExtension.cpp DataManagement/mitkGeometry3D.cpp DataManagement/mitkGeometryData.cpp DataManagement/mitkGeometryTransformHolder.cpp DataManagement/mitkGroupTagProperty.cpp DataManagement/mitkGenericIDRelationRule.cpp DataManagement/mitkIdentifiable.cpp DataManagement/mitkImageAccessorBase.cpp DataManagement/mitkImageCaster.cpp DataManagement/mitkImageCastPart1.cpp DataManagement/mitkImageCastPart2.cpp DataManagement/mitkImageCastPart3.cpp DataManagement/mitkImageCastPart4.cpp DataManagement/mitkImage.cpp DataManagement/mitkImageDataItem.cpp DataManagement/mitkImageDescriptor.cpp DataManagement/mitkImageReadAccessor.cpp DataManagement/mitkImageStatisticsHolder.cpp DataManagement/mitkImageVtkAccessor.cpp DataManagement/mitkImageVtkReadAccessor.cpp DataManagement/mitkImageVtkWriteAccessor.cpp DataManagement/mitkImageWriteAccessor.cpp DataManagement/mitkIntPropertyExtension.cpp DataManagement/mitkIPersistenceService.cpp DataManagement/mitkIPropertyAliases.cpp DataManagement/mitkIPropertyDescriptions.cpp DataManagement/mitkIPropertyExtensions.cpp DataManagement/mitkIPropertyFilters.cpp DataManagement/mitkIPropertyOwner.cpp DataManagement/mitkIPropertyPersistence.cpp DataManagement/mitkIPropertyProvider.cpp DataManagement/mitkLandmarkProjectorBasedCurvedGeometry.cpp DataManagement/mitkLandmarkProjector.cpp DataManagement/mitkLevelWindow.cpp DataManagement/mitkLevelWindowManager.cpp DataManagement/mitkLevelWindowPreset.cpp DataManagement/mitkLevelWindowProperty.cpp DataManagement/mitkLine.cpp DataManagement/mitkLookupTable.cpp DataManagement/mitkLookupTableProperty.cpp DataManagement/mitkLookupTables.cpp # specializations of GenericLookupTable DataManagement/mitkMaterial.cpp DataManagement/mitkMemoryUtilities.cpp DataManagement/mitkModalityProperty.cpp DataManagement/mitkModifiedLock.cpp DataManagement/mitkNodePredicateAnd.cpp DataManagement/mitkNodePredicateBase.cpp DataManagement/mitkNodePredicateCompositeBase.cpp DataManagement/mitkNodePredicateData.cpp DataManagement/mitkNodePredicateDataType.cpp DataManagement/mitkNodePredicateDataUID.cpp DataManagement/mitkNodePredicateDimension.cpp DataManagement/mitkNodePredicateFirstLevel.cpp DataManagement/mitkNodePredicateFunction.cpp DataManagement/mitkNodePredicateGeometry.cpp DataManagement/mitkNodePredicateNot.cpp DataManagement/mitkNodePredicateOr.cpp DataManagement/mitkNodePredicateProperty.cpp DataManagement/mitkNodePredicateDataProperty.cpp DataManagement/mitkNodePredicateSource.cpp DataManagement/mitkNodePredicateSubGeometry.cpp DataManagement/mitkNumericConstants.cpp DataManagement/mitkPlaneGeometry.cpp DataManagement/mitkPlaneGeometryData.cpp DataManagement/mitkPlaneOperation.cpp DataManagement/mitkPlaneOrientationProperty.cpp DataManagement/mitkPointOperation.cpp DataManagement/mitkPointSet.cpp DataManagement/mitkPointSetShapeProperty.cpp DataManagement/mitkProperties.cpp DataManagement/mitkPropertyAliases.cpp DataManagement/mitkPropertyDescriptions.cpp DataManagement/mitkPropertyExtension.cpp DataManagement/mitkPropertyExtensions.cpp DataManagement/mitkPropertyFilter.cpp DataManagement/mitkPropertyFilters.cpp DataManagement/mitkPropertyKeyPath.cpp DataManagement/mitkPropertyList.cpp DataManagement/mitkPropertyListReplacedObserver.cpp DataManagement/mitkPropertyNameHelper.cpp DataManagement/mitkPropertyObserver.cpp DataManagement/mitkPropertyPersistence.cpp DataManagement/mitkPropertyPersistenceInfo.cpp DataManagement/mitkPropertyRelationRuleBase.cpp DataManagement/mitkProportionalTimeGeometry.cpp DataManagement/mitkRenderingModeProperty.cpp DataManagement/mitkResliceMethodProperty.cpp DataManagement/mitkRestorePlanePositionOperation.cpp DataManagement/mitkRotationOperation.cpp DataManagement/mitkScaleOperation.cpp DataManagement/mitkSlicedData.cpp DataManagement/mitkSlicedGeometry3D.cpp DataManagement/mitkSmartPointerProperty.cpp DataManagement/mitkStandaloneDataStorage.cpp DataManagement/mitkStringProperty.cpp DataManagement/mitkSurface.cpp DataManagement/mitkSurfaceOperation.cpp DataManagement/mitkSourceImageRelationRule.cpp DataManagement/mitkThinPlateSplineCurvedGeometry.cpp DataManagement/mitkTimeGeometry.cpp DataManagement/mitkTransferFunction.cpp DataManagement/mitkTransferFunctionInitializer.cpp DataManagement/mitkTransferFunctionProperty.cpp DataManagement/mitkTemporoSpatialStringProperty.cpp DataManagement/mitkUIDManipulator.cpp DataManagement/mitkVector.cpp DataManagement/mitkVectorProperty.cpp DataManagement/mitkVtkInterpolationProperty.cpp DataManagement/mitkVtkRepresentationProperty.cpp DataManagement/mitkVtkResliceInterpolationProperty.cpp DataManagement/mitkVtkScalarModeProperty.cpp DataManagement/mitkWeakPointerProperty.cpp DataManagement/mitkIPropertyRelations.cpp DataManagement/mitkPropertyRelations.cpp Interactions/mitkAction.cpp Interactions/mitkBindDispatcherInteractor.cpp Interactions/mitkCrosshairPositionEvent.cpp Interactions/mitkDataInteractor.cpp Interactions/mitkDispatcher.cpp Interactions/mitkDisplayActionEventBroadcast.cpp Interactions/mitkDisplayActionEventFunctions.cpp Interactions/mitkDisplayActionEventHandler.cpp Interactions/mitkDisplayActionEventHandlerDesynchronized.cpp Interactions/mitkDisplayActionEventHandlerStd.cpp Interactions/mitkDisplayActionEventHandlerSynchronized.cpp Interactions/mitkDisplayCoordinateOperation.cpp Interactions/mitkDisplayInteractor.cpp Interactions/mitkEventConfig.cpp Interactions/mitkEventFactory.cpp Interactions/mitkEventRecorder.cpp Interactions/mitkEventStateMachine.cpp Interactions/mitkInteractionEventConst.cpp Interactions/mitkInteractionEvent.cpp Interactions/mitkInteractionEventHandler.cpp Interactions/mitkInteractionEventObserver.cpp Interactions/mitkInteractionKeyEvent.cpp Interactions/mitkInteractionPositionEvent.cpp Interactions/mitkInteractionSchemeSwitcher.cpp Interactions/mitkInternalEvent.cpp Interactions/mitkMouseDoubleClickEvent.cpp Interactions/mitkMouseMoveEvent.cpp Interactions/mitkMousePressEvent.cpp Interactions/mitkMouseReleaseEvent.cpp Interactions/mitkMouseWheelEvent.cpp Interactions/mitkPointSetDataInteractor.cpp Interactions/mitkSinglePointDataInteractor.cpp Interactions/mitkStateMachineAction.cpp Interactions/mitkStateMachineCondition.cpp Interactions/mitkStateMachineContainer.cpp Interactions/mitkStateMachineState.cpp Interactions/mitkStateMachineTransition.cpp Interactions/mitkVtkEventAdapter.cpp Interactions/mitkVtkInteractorStyle.cxx Interactions/mitkXML2EventParser.cpp IO/mitkAbstractFileIO.cpp IO/mitkAbstractFileReader.cpp IO/mitkAbstractFileWriter.cpp IO/mitkCustomMimeType.cpp IO/mitkFileReader.cpp IO/mitkFileReaderRegistry.cpp IO/mitkFileReaderSelector.cpp IO/mitkFileReaderWriterBase.cpp IO/mitkFileWriter.cpp IO/mitkFileWriterRegistry.cpp IO/mitkFileWriterSelector.cpp IO/mitkGeometry3DToXML.cpp IO/mitkIFileIO.cpp IO/mitkIFileReader.cpp IO/mitkIFileWriter.cpp IO/mitkGeometryDataReaderService.cpp IO/mitkGeometryDataWriterService.cpp IO/mitkImageGenerator.cpp IO/mitkImageVtkLegacyIO.cpp IO/mitkImageVtkXmlIO.cpp IO/mitkIMimeTypeProvider.cpp IO/mitkIOConstants.cpp IO/mitkIOMimeTypes.cpp IO/mitkIOUtil.cpp IO/mitkItkImageIO.cpp IO/mitkItkLoggingAdapter.cpp IO/mitkLegacyFileReaderService.cpp IO/mitkLegacyFileWriterService.cpp IO/mitkLocaleSwitch.cpp IO/mitkLog.cpp IO/mitkMimeType.cpp IO/mitkMimeTypeProvider.cpp IO/mitkOperation.cpp IO/mitkPixelType.cpp IO/mitkPointSetReaderService.cpp IO/mitkPointSetWriterService.cpp IO/mitkProportionalTimeGeometryToXML.cpp IO/mitkRawImageFileReader.cpp IO/mitkStandardFileLocations.cpp IO/mitkSurfaceStlIO.cpp IO/mitkSurfaceVtkIO.cpp IO/mitkSurfaceVtkLegacyIO.cpp IO/mitkSurfaceVtkXmlIO.cpp IO/mitkUtf8Util.cpp IO/mitkVtkLoggingAdapter.cpp IO/mitkPreferenceListReaderOptionsFunctor.cpp IO/mitkIOMetaInformationPropertyConstants.cpp Rendering/mitkAbstractAnnotationRenderer.cpp Rendering/mitkAnnotationUtils.cpp Rendering/mitkBaseRenderer.cpp #Rendering/mitkGLMapper.cpp Moved to deprecated LegacyGL Module Rendering/mitkGradientBackground.cpp Rendering/mitkImageVtkMapper2D.cpp Rendering/mitkMapper.cpp Rendering/mitkAnnotation.cpp Rendering/mitkPlaneGeometryDataMapper2D.cpp Rendering/mitkPlaneGeometryDataVtkMapper3D.cpp Rendering/mitkPointSetVtkMapper2D.cpp Rendering/mitkPointSetVtkMapper3D.cpp Rendering/mitkRenderWindowBase.cpp Rendering/mitkRenderWindow.cpp Rendering/mitkRenderWindowFrame.cpp #Rendering/mitkSurfaceGLMapper2D.cpp Moved to deprecated LegacyGL Module Rendering/mitkSurfaceVtkMapper2D.cpp Rendering/mitkSurfaceVtkMapper3D.cpp Rendering/mitkVtkEventProvider.cpp Rendering/mitkVtkMapper.cpp Rendering/mitkVtkPropRenderer.cpp Rendering/mitkVtkWidgetRendering.cpp Rendering/vtkMitkLevelWindowFilter.cpp Rendering/vtkMitkRectangleProp.cpp Rendering/vtkMitkRenderProp.cpp Rendering/vtkMitkThickSlicesFilter.cpp Rendering/vtkNeverTranslucentTexture.cpp ) set(RESOURCE_FILES Interactions/globalConfig.xml Interactions/DisplayInteraction.xml Interactions/DisplayConfig.xml Interactions/DisplayConfigMITKBase.xml Interactions/DisplayConfigPACSBase.xml Interactions/DisplayConfigCrosshair.xml Interactions/DisplayConfigRotation.xml Interactions/DisplayConfigActivateCoupling.xml Interactions/DisplayConfigSwivel.xml Interactions/DisplayConfigPACSPan.xml Interactions/DisplayConfigPACSScroll.xml Interactions/DisplayConfigPACSZoom.xml Interactions/DisplayConfigPACSLevelWindow.xml Interactions/DisplayConfigMITKLimited.xml Interactions/DisplayConfigBlockLMB.xml Interactions/PointSet.xml Interactions/Legacy/StateMachine.xml Interactions/Legacy/DisplayConfigMITKTools.xml Interactions/PointSetConfig.xml mitkLevelWindowPresets.xml mitkAnatomicalStructureColorPresets.xml ) diff --git a/Modules/Core/include/mitkEventStateMachine.h b/Modules/Core/include/mitkEventStateMachine.h index bbceab973f..d819ff8d1d 100644 --- a/Modules/Core/include/mitkEventStateMachine.h +++ b/Modules/Core/include/mitkEventStateMachine.h @@ -1,264 +1,263 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef MITKEVENTSTATEMACHINE_H_ #define MITKEVENTSTATEMACHINE_H_ #include "itkObject.h" #include "mitkCommon.h" #include "mitkInteractionEventHandler.h" #include "mitkMessage.h" #include #include /** * Macro that can be used to connect a StateMachineAction with a function. * It assumes that there is a typedef Classname Self in classes that use * this macro, as is provided by e.g. mitkClassMacro */ #define CONNECT_FUNCTION(a, f) \ ::mitk::EventStateMachine::AddActionFunction( \ a, \ ::mitk::MessageDelegate2(this, &Self::f)); #define CONNECT_CONDITION(a, f) \ ::mitk::EventStateMachine::AddConditionFunction( \ a, ::mitk::MessageDelegate1(this, &Self::f)); namespace us { class Module; } namespace mitk { class StateMachineTransition; class StateMachineContainer; class StateMachineAction; class StateMachineCondition; class InteractionEvent; class StateMachineState; class DataNode; class UndoController; /** * \class TActionFunctor * \brief Base class of ActionFunctors, to provide an easy to connect actions with functions. * * \deprecatedSince{2013_03} Use mitk::Message classes instead. */ class TActionFunctor { public: virtual bool DoAction(StateMachineAction *, InteractionEvent *) = 0; virtual ~TActionFunctor() {} }; ///** // * \class TSpecificActionFunctor // * Specific implementation of ActionFunctor class, implements a reference to the function which is to be executed. // It // takes two arguments: // * StateMachineAction - the action by which the function call is invoked, InteractionEvent - the event that caused // the // transition. // */ // template // class DEPRECATED() TSpecificActionFunctor : public TActionFunctor //{ // public: // TSpecificActionFunctor(T* object, bool (T::*memberFunctionPointer)(StateMachineAction*, InteractionEvent*)) : // m_Object(object), m_MemberFunctionPointer(memberFunctionPointer) // { // } // virtual ~TSpecificActionFunctor() // { // } // virtual bool DoAction(StateMachineAction* action, InteractionEvent* event) override // { // return (*m_Object.*m_MemberFunctionPointer)(action, event);// executes member function // } // private: // T* m_Object; // bool (T::*m_MemberFunctionPointer)(StateMachineAction*, InteractionEvent*); //}; /** * \class EventStateMachine * * \brief Super-class that provides the functionality of a StateMachine to DataInteractors. * * A state machine is created by loading a state machine pattern. It consists of states, transitions and action. * The state represent the current status of the interaction, transitions are means to switch between states. Each * transition * is triggered by an event and it is associated with actions that are to be executed when the state change is * performed. * */ class MITKCORE_EXPORT EventStateMachine : public mitk::InteractionEventHandler { public: mitkClassMacro(EventStateMachine, InteractionEventHandler); typedef std::map DEPRECATED(ActionFunctionsMapType); typedef itk::SmartPointer StateMachineStateType; /** * @brief Loads XML resource * * Loads a XML resource file from the given module. * Default is the Mitk module (core). * The files have to be placed in the Resources/Interaction folder of their respective module. **/ bool LoadStateMachine(const std::string &filename, const us::Module *module = nullptr); /** * Receives Event from Dispatcher. * Event is mapped using the EventConfig Object to a variant, then it is checked if the StateMachine is listening * for * such an Event. If this is the case, the transition to the next state it performed and all actions associated with * the transition executed, * and true is returned to the caller. * If the StateMachine can't handle this event false is returned. * Attention: * If a transition is associated with multiple actions - "true" is returned if one action returns true, * and the event is treated as HANDLED even though some actions might not have been executed! So be sure that all * actions that occur within * one transitions have the same conditions. */ bool HandleEvent(InteractionEvent *event, DataNode *dataNode); /** * @brief Enables or disabled Undo. **/ void EnableUndo(bool enable) { m_UndoEnabled = enable; } /** * @brief Enables/disables the state machine. In un-enabled state it won't react to any events. **/ void EnableInteraction(bool enable) { m_IsActive = enable; } protected: EventStateMachine(); ~EventStateMachine() override; typedef MessageAbstractDelegate2 ActionFunctionDelegate; typedef MessageAbstractDelegate1 ConditionFunctionDelegate; /** * Connects action from StateMachine (String in XML file) with a function that is called when this action is to be * executed. */ DEPRECATED(void AddActionFunction(const std::string &action, TActionFunctor *functor)); void AddActionFunction(const std::string &action, const ActionFunctionDelegate &delegate); void AddConditionFunction(const std::string &condition, const ConditionFunctionDelegate &delegate); StateMachineState *GetCurrentState() const; /** * @brief ResetToStartState Reset state machine to it initial starting state. */ void ResetToStartState(); /** * Is called after loading a statemachine. * Overwrite this function in specific interactor implementations. * Connect actions and functions using the CONNECT_FUNCTION macro within this function. */ virtual void ConnectActionsAndFunctions(); virtual bool CheckCondition(const StateMachineCondition &condition, const InteractionEvent *interactionEvent); /** * Looks up function that is associated with action and executes it. * To implement your own execution scheme overwrite this in your DataInteractor. */ virtual void ExecuteAction(StateMachineAction *action, InteractionEvent *interactionEvent); /** * Implements filter scheme for events. * Standard implementation accepts events from 2d and 3d windows, * and rejects events if DataNode is not visible. * \return true if event is accepted, else false * * Overwrite this function to adapt for your own needs, for example to filter out events from * 3d windows like this: \code bool mitk::EventStateMachine::FilterEvents(InteractionEvent* interactionEvent, DataNode*dataNode) { return interactionEvent->GetSender()->GetMapperID() == BaseRenderer::Standard2D; // only 2D mappers } \endcode * or to enforce that the interactor only reacts when the corresponding DataNode is selected in the DataManager view.. */ virtual bool FilterEvents(InteractionEvent *interactionEvent, DataNode *dataNode); /** \brief Sets the specified mouse cursor. * * Use this in subclasses instead of using QmitkApplicationCursor directly. */ void SetMouseCursor(const char *xpm[], int hotspotX, int hotspotY); - /** \brief Resets the mouse cursor (if modified by the SlicesCoordinator) - * to its original state. + /** \brief Resets the mouse cursor to its original state. * * Should be used by subclasses and from external application instead * of using QmitkApplicationCursor directly to avoid conflicts. */ void ResetMouseCursor(); /** * \brief Returns the executable transition for the given event. * * This method takes a list of transitions that correspond to the given * event from the current state. * * This method iterates through all transitions and checks all * corresponding conditions. The results of each condition in stored in * map, as other transitions may need the same condition again. * * As soon as a transition is found for which all conditions are * fulfilled, this instance is returned. * * If a transition has no condition, it is automatically returned. * If no executable transition is found, nullptr is returned. */ StateMachineTransition *GetExecutableTransition(InteractionEvent *event); // Determines if state machine reacts to events bool m_IsActive; // Undo/Redo UndoController *m_UndoController; bool m_UndoEnabled; private: typedef std::map ActionDelegatesMapType; typedef std::map ConditionDelegatesMapType; StateMachineContainer *m_StateMachineContainer; // storage of all states, action, transitions on which the statemachine operates. std::map m_ActionFunctionsMap; // stores association between action string ActionDelegatesMapType m_ActionDelegatesMap; ConditionDelegatesMapType m_ConditionDelegatesMap; StateMachineStateType m_CurrentState; bool m_MouseCursorSet; }; } /* namespace mitk */ #endif /* MITKEVENTSTATEMACHINE_H_ */ diff --git a/Modules/Core/include/mitkSlicesCoordinator.h b/Modules/Core/include/mitkSlicesCoordinator.h deleted file mode 100644 index 99c70fb09f..0000000000 --- a/Modules/Core/include/mitkSlicesCoordinator.h +++ /dev/null @@ -1,99 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#ifndef SLICESCOORDINATOR_H_HEADER_INCLUDED_C1C55A2F -#define SLICESCOORDINATOR_H_HEADER_INCLUDED_C1C55A2F - -#include -#include -#include -#include - -namespace mitk -{ - class SliceNavigationController; - class Action; - class StateEvent; - -#pragma GCC visibility push(default) - itkEventMacroDeclaration(SliceRotationEvent, itk::AnyEvent); -#pragma GCC visibility pop - - /** - * \brief Coordinates a list of SliceNavigationControllers. - * - * Each SliceNavigationController can select one slice from a - * TimeGeometry. This class (SlicesCoordinator) coordinates several - * SliceNavigationControllers to facilitate e.g. rotation of slices. A new - * class is needed, because for rotation one has to know an axis of rotation. - * Such an axis is most easily determined from the "other slices", which are - * not known by a SliceNavigationController. - */ - class MITKCORE_EXPORT SlicesCoordinator : public itk::Object - { - public: - mitkClassMacroItkParent(SlicesCoordinator, itk::Object); - itkFactorylessNewMacro(Self); - - typedef std::vector SNCVector; - /** Add to list of managed slices. Check if CreatedWorldGeometry of SNC is - * managable (i.e. there is basically only one planegeometry) */ - void AddSliceController(SliceNavigationController *snc); - - /** Remove one controller from the internal list */ - void RemoveSliceController(SliceNavigationController *snc); - - /* Reset all Slices to central slice, no rotation */ - // void ResetAllSlices(); - - /** Set/Get whether planes should stay linked to each other (by fixing - * their relative angle) */ - itkSetMacro(LinkPlanes, bool); - itkGetMacro(LinkPlanes, bool); - itkBooleanMacro(LinkPlanes); - - /** \brief Resets the mouse cursor (if modified by the SlicesCoordinator) - * to its original state. - * - * Should be used by subclasses and from external application instead - * of using QmitkApplicationCursor directly to avoid conflicts. */ - void ResetMouseCursor(); - - protected: - /** \brief Default Constructor */ - SlicesCoordinator(); - - /** clear list of controllers */ - ~SlicesCoordinator() override; - - /** \brief Sets the specified mouse cursor. - * - * Use this in subclasses instead of using QmitkApplicationCursor directly. - */ - void SetMouseCursor(const char *xpm[], int hotspotX, int hotspotY); - - /** for implementation in subclasses */ - virtual void OnSliceControllerAdded(SliceNavigationController *snc); - - /** for implementation in subclasses */ - virtual void OnSliceControllerRemoved(SliceNavigationController *snc); - - SNCVector m_SliceNavigationControllers; - - bool m_LinkPlanes; - - bool m_MouseCursorSet; - }; - -} // namespace - -#endif diff --git a/Modules/Core/src/Controllers/mitkSlicesCoordinator.cpp b/Modules/Core/src/Controllers/mitkSlicesCoordinator.cpp deleted file mode 100644 index be8f3d8c63..0000000000 --- a/Modules/Core/src/Controllers/mitkSlicesCoordinator.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#include - -#include - -namespace mitk -{ - itkEventMacroDefinition(SliceRotationEvent, itk::AnyEvent); - - SlicesCoordinator::SlicesCoordinator() : m_LinkPlanes(true), m_MouseCursorSet(false) {} - SlicesCoordinator::~SlicesCoordinator() {} - void SlicesCoordinator::AddSliceController(SliceNavigationController *snc) - { - if (!snc) - return; - - m_SliceNavigationControllers.push_back(snc); - - OnSliceControllerAdded(snc); // notify - } - - void SlicesCoordinator::RemoveSliceController(SliceNavigationController *snc) - { - if (!snc) - return; - - // see, whether snc is in our list - SNCVector::iterator iter; - for (iter = m_SliceNavigationControllers.begin(); iter != m_SliceNavigationControllers.end(); ++iter) - if (*iter == snc) - break; - - // if found, remove from list - if (iter != m_SliceNavigationControllers.end()) - { - m_SliceNavigationControllers.erase(iter); - - OnSliceControllerRemoved(snc); - } - } - - void SlicesCoordinator::ResetMouseCursor() - { - if (m_MouseCursorSet) - { - ApplicationCursor::GetInstance()->PopCursor(); - m_MouseCursorSet = false; - } - } - - void SlicesCoordinator::SetMouseCursor(const char *xpm[], int hotspotX, int hotspotY) - { - // Remove previously set mouse cursor - if (m_MouseCursorSet) - { - ApplicationCursor::GetInstance()->PopCursor(); - } - - ApplicationCursor::GetInstance()->PushCursor(xpm, hotspotX, hotspotY); - m_MouseCursorSet = true; - } - - void SlicesCoordinator::OnSliceControllerAdded(SliceNavigationController *) - { - // implement in subclasses - } - - void SlicesCoordinator::OnSliceControllerRemoved(SliceNavigationController *) - { - // implement in subclasses - } - -} // namespace