# HG changeset patch # User Sebastien Jodogne # Date 1597915036 -7200 # Node ID a6f339d8e4c285e95c48305914ea0af7d337b1a5 # Parent 8898f8f755c8a694c14554d74fdedd8ed42312f7 reorganization diff -r 8898f8f755c8 -r a6f339d8e4c2 OrthancStone/Resources/CMake/OrthancStoneConfiguration.cmake --- a/OrthancStone/Resources/CMake/OrthancStoneConfiguration.cmake Tue Aug 18 11:58:47 2020 +0200 +++ b/OrthancStone/Resources/CMake/OrthancStoneConfiguration.cmake Thu Aug 20 11:17:16 2020 +0200 @@ -486,6 +486,7 @@ ${ORTHANC_STONE_ROOT}/Sources/Toolbox/UndoRedoStack.h ${ORTHANC_STONE_ROOT}/Sources/Viewport/IViewport.h + ${ORTHANC_STONE_ROOT}/Sources/Viewport/DefaultViewportInteractor.h ${ORTHANC_STONE_ROOT}/Sources/Volumes/IGeometryProvider.h ${ORTHANC_STONE_ROOT}/Sources/Volumes/IVolumeSlicer.cpp diff -r 8898f8f755c8 -r a6f339d8e4c2 OrthancStone/Sources/Scene2DViewport/ViewportController.cpp --- a/OrthancStone/Sources/Scene2DViewport/ViewportController.cpp Tue Aug 18 11:58:47 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/ViewportController.cpp Thu Aug 20 11:17:16 2020 +0200 @@ -20,44 +20,14 @@ #include "ViewportController.h" -#include "UndoStack.h" +#include "../StoneException.h" // For ORTHANC_ASSERT #include "MeasureCommands.h" - -#include "../Scene2D/GrayscaleWindowingSceneTracker.h" -#include "../Scene2D/PanSceneTracker.h" -#include "../Scene2D/RotateSceneTracker.h" -#include "../Scene2D/ZoomSceneTracker.h" -#include "../StoneException.h" +#include "UndoStack.h" #include namespace OrthancStone { - IFlexiblePointerTracker* DefaultViewportInteractor::CreateTracker( - boost::shared_ptr viewport, - const PointerEvent& event, - unsigned int viewportWidth, - unsigned int viewportHeight) - { - switch (event.GetMouseButton()) - { - case MouseButton_Left: - //return new RotateSceneTracker(viewport, event); - - return new GrayscaleWindowingSceneTracker( - viewport, windowingLayer_, event, viewportWidth, viewportHeight); - - case MouseButton_Middle: - return new PanSceneTracker(viewport, event); - - case MouseButton_Right: - return new ZoomSceneTracker(viewport, event, viewportHeight); - - default: - return NULL; - } - } - ViewportController::ViewportController(boost::shared_ptr viewport) : viewport_(viewport) , scene_(new Scene2D) diff -r 8898f8f755c8 -r a6f339d8e4c2 OrthancStone/Sources/Scene2DViewport/ViewportController.h --- a/OrthancStone/Sources/Scene2DViewport/ViewportController.h Tue Aug 18 11:58:47 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/ViewportController.h Thu Aug 20 11:17:16 2020 +0200 @@ -25,6 +25,7 @@ #include "../Messages/IObservable.h" #include "../Scene2D/Scene2D.h" #include "../Scene2DViewport/IFlexiblePointerTracker.h" +#include "../Viewport/IViewportInteractor.h" #include @@ -33,52 +34,6 @@ namespace OrthancStone { - // TODO - Move this to another file - class IViewportInteractor : public boost::noncopyable - { - public: - virtual ~IViewportInteractor() - { - } - - virtual IFlexiblePointerTracker* CreateTracker(boost::shared_ptr viewport, - const PointerEvent& event, - unsigned int viewportWidth, - unsigned int viewportHeight) = 0; - }; - - - // TODO - Move this to another file - class DefaultViewportInteractor : public IViewportInteractor - { - private: - // Index of the layer whose windowing is altered by clicking the - // left mouse button - int windowingLayer_; - - public: - DefaultViewportInteractor() : - windowingLayer_(0) - { - } - - int GetWindowingLayer() const - { - return windowingLayer_; - } - - void SetWindowingLayer(int layerIndex) - { - windowingLayer_ = layerIndex; - } - - virtual IFlexiblePointerTracker* CreateTracker(boost::shared_ptr viewport, - const PointerEvent& event, - unsigned int viewportWidth, - unsigned int viewportHeight) ORTHANC_OVERRIDE; - }; - - class UndoStack; const double ARC_RADIUS_CANVAS_COORD = 30.0; diff -r 8898f8f755c8 -r a6f339d8e4c2 OrthancStone/Sources/Viewport/DefaultViewportInteractor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancStone/Sources/Viewport/DefaultViewportInteractor.cpp Thu Aug 20 11:17:16 2020 +0200 @@ -0,0 +1,54 @@ +/** + * Stone of Orthanc + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2020 Osimis S.A., Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + **/ + +#include "DefaultViewportInteractor.h" + +#include "../Scene2D/GrayscaleWindowingSceneTracker.h" +#include "../Scene2D/PanSceneTracker.h" +#include "../Scene2D/RotateSceneTracker.h" +#include "../Scene2D/ZoomSceneTracker.h" + +namespace OrthancStone +{ + IFlexiblePointerTracker* DefaultViewportInteractor::CreateTracker( + boost::shared_ptr viewport, + const PointerEvent& event, + unsigned int viewportWidth, + unsigned int viewportHeight) + { + switch (event.GetMouseButton()) + { + case MouseButton_Left: + //return new RotateSceneTracker(viewport, event); + + return new GrayscaleWindowingSceneTracker( + viewport, windowingLayer_, event, viewportWidth, viewportHeight); + + case MouseButton_Middle: + return new PanSceneTracker(viewport, event); + + case MouseButton_Right: + return new ZoomSceneTracker(viewport, event, viewportHeight); + + default: + return NULL; + } + } +} diff -r 8898f8f755c8 -r a6f339d8e4c2 OrthancStone/Sources/Viewport/DefaultViewportInteractor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancStone/Sources/Viewport/DefaultViewportInteractor.h Thu Aug 20 11:17:16 2020 +0200 @@ -0,0 +1,55 @@ +/** + * Stone of Orthanc + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2020 Osimis S.A., Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + **/ + +#pragma once + +#include "IViewportInteractor.h" + +namespace OrthancStone +{ + class DefaultViewportInteractor : public IViewportInteractor + { + private: + // Index of the layer whose windowing is altered by clicking the + // left mouse button + int windowingLayer_; + + public: + DefaultViewportInteractor() : + windowingLayer_(0) + { + } + + int GetWindowingLayer() const + { + return windowingLayer_; + } + + void SetWindowingLayer(int layerIndex) + { + windowingLayer_ = layerIndex; + } + + virtual IFlexiblePointerTracker* CreateTracker(boost::shared_ptr viewport, + const PointerEvent& event, + unsigned int viewportWidth, + unsigned int viewportHeight) ORTHANC_OVERRIDE; + }; +} diff -r 8898f8f755c8 -r a6f339d8e4c2 OrthancStone/Sources/Viewport/IViewportInteractor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancStone/Sources/Viewport/IViewportInteractor.h Thu Aug 20 11:17:16 2020 +0200 @@ -0,0 +1,40 @@ +/** + * Stone of Orthanc + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2020 Osimis S.A., Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + **/ + +#pragma once + +namespace OrthancStone +{ + class IViewport; + class PointerEvent; + + class IViewportInteractor : public boost::noncopyable + { + public: + virtual ~IViewportInteractor() + { + } + + virtual IFlexiblePointerTracker* CreateTracker(boost::shared_ptr viewport, + const PointerEvent& event, + unsigned int viewportWidth, + unsigned int viewportHeight) = 0; + }; +} diff -r 8898f8f755c8 -r a6f339d8e4c2 OrthancStone/Sources/Viewport/WebAssemblyViewport.cpp --- a/OrthancStone/Sources/Viewport/WebAssemblyViewport.cpp Tue Aug 18 11:58:47 2020 +0200 +++ b/OrthancStone/Sources/Viewport/WebAssemblyViewport.cpp Thu Aug 20 11:17:16 2020 +0200 @@ -29,6 +29,8 @@ # include #endif +#include "DefaultViewportInteractor.h" + #include #include