Mercurial > hg > orthanc-stone
changeset 1557:a6f339d8e4c2
reorganization
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 20 Aug 2020 11:17:16 +0200 |
parents | 8898f8f755c8 |
children | 314b6dc507d9 |
files | OrthancStone/Resources/CMake/OrthancStoneConfiguration.cmake OrthancStone/Sources/Scene2DViewport/ViewportController.cpp OrthancStone/Sources/Scene2DViewport/ViewportController.h OrthancStone/Sources/Viewport/DefaultViewportInteractor.cpp OrthancStone/Sources/Viewport/DefaultViewportInteractor.h OrthancStone/Sources/Viewport/IViewportInteractor.h OrthancStone/Sources/Viewport/WebAssemblyViewport.cpp |
diffstat | 7 files changed, 155 insertions(+), 78 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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 <boost/make_shared.hpp> namespace OrthancStone { - IFlexiblePointerTracker* DefaultViewportInteractor::CreateTracker( - boost::shared_ptr<IViewport> 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<IViewport> viewport) : viewport_(viewport) , scene_(new Scene2D)
--- 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 <Compatibility.h> @@ -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<IViewport> 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<IViewport> viewport, - const PointerEvent& event, - unsigned int viewportWidth, - unsigned int viewportHeight) ORTHANC_OVERRIDE; - }; - - class UndoStack; const double ARC_RADIUS_CANVAS_COORD = 30.0;
--- /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 <http://www.gnu.org/licenses/>. + **/ + +#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<IViewport> 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; + } + } +}
--- /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 <http://www.gnu.org/licenses/>. + **/ + +#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<IViewport> viewport, + const PointerEvent& event, + unsigned int viewportWidth, + unsigned int viewportHeight) ORTHANC_OVERRIDE; + }; +}
--- /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 <http://www.gnu.org/licenses/>. + **/ + +#pragma once + +namespace OrthancStone +{ + class IViewport; + class PointerEvent; + + class IViewportInteractor : public boost::noncopyable + { + public: + virtual ~IViewportInteractor() + { + } + + virtual IFlexiblePointerTracker* CreateTracker(boost::shared_ptr<IViewport> viewport, + const PointerEvent& event, + unsigned int viewportWidth, + unsigned int viewportHeight) = 0; + }; +}
--- 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 <Toolbox/GenericToolbox.h> #endif +#include "DefaultViewportInteractor.h" + #include <OrthancException.h> #include <boost/make_shared.hpp>