comparison Framework/Scene2DViewport/ViewportController.h @ 1215:9efa66d8d3f8 broker

removed ViewportBase, and removed dependency of ViewportController on IViewport
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 04 Dec 2019 20:12:15 +0100
parents 741201eab130
children 5147277850cf
comparison
equal deleted inserted replaced
1214:741201eab130 1215:9efa66d8d3f8
20 20
21 #pragma once 21 #pragma once
22 22
23 #include "PredeclaredTypes.h" 23 #include "PredeclaredTypes.h"
24 24
25 #include "../Viewport/IViewport.h" 25 #include "../Messages/IObservable.h"
26 #include "../Scene2D/Scene2D.h"
26 #include "../Scene2DViewport/IFlexiblePointerTracker.h" 27 #include "../Scene2DViewport/IFlexiblePointerTracker.h"
27 28
28 #include <boost/enable_shared_from_this.hpp> 29 #include <boost/enable_shared_from_this.hpp>
29 #include <stack> 30 #include <stack>
30 31
37 virtual ~IViewportInteractor() 38 virtual ~IViewportInteractor()
38 { 39 {
39 } 40 }
40 41
41 virtual IFlexiblePointerTracker* CreateTracker(boost::shared_ptr<ViewportController> controller, 42 virtual IFlexiblePointerTracker* CreateTracker(boost::shared_ptr<ViewportController> controller,
42 IViewport& viewport, 43 const PointerEvent& event,
43 const PointerEvent& event) = 0; 44 unsigned int viewportWidth,
45 unsigned int viewportHeight) = 0;
44 }; 46 };
45 47
46 48
47 // TODO - Move this to another file 49 // TODO - Move this to another file
48 class DefaultViewportInteractor : public IViewportInteractor 50 class DefaultViewportInteractor : public IViewportInteractor
49 { 51 {
50 public: 52 public:
51 virtual IFlexiblePointerTracker* CreateTracker(boost::shared_ptr<ViewportController> controller, 53 virtual IFlexiblePointerTracker* CreateTracker(boost::shared_ptr<ViewportController> controller,
52 IViewport& viewport, 54 const PointerEvent& event,
53 const PointerEvent& event) ORTHANC_OVERRIDE; 55 unsigned int viewportWidth,
56 unsigned int viewportHeight) ORTHANC_OVERRIDE;
54 }; 57 };
55 58
56 59
57 class UndoStack; 60 class UndoStack;
58 61
137 140
138 /** Forwarded to the underlying scene, and broadcasted to the observers */ 141 /** Forwarded to the underlying scene, and broadcasted to the observers */
139 void SetSceneToCanvasTransform(const AffineTransform2D& transform); 142 void SetSceneToCanvasTransform(const AffineTransform2D& transform);
140 143
141 /** Forwarded to the underlying scene, and broadcasted to the observers */ 144 /** Forwarded to the underlying scene, and broadcasted to the observers */
142 void FitContent(IViewport& viewport); 145 void FitContent(unsigned int viewportWidth,
146 unsigned int viewportHeight);
143 147
144 /** Adds a new measure tool */ 148 /** Adds a new measure tool */
145 void AddMeasureTool(boost::shared_ptr<MeasureTool> measureTool); 149 void AddMeasureTool(boost::shared_ptr<MeasureTool> measureTool);
146 150
147 /** Removes a measure tool or throws if it cannot be found */ 151 /** Removes a measure tool or throws if it cannot be found */
189 /** forwarded to the UndoStack */ 193 /** forwarded to the UndoStack */
190 bool CanRedo() const; 194 bool CanRedo() const;
191 195
192 196
193 // Must be expressed in canvas coordinates 197 // Must be expressed in canvas coordinates
194 void HandleMousePress(IViewport& viewport, 198 void HandleMousePress(IViewportInteractor& interactor,
195 IViewportInteractor& interactor, 199 const PointerEvent& event,
196 const PointerEvent& event); 200 unsigned int viewportWidth,
201 unsigned int viewportHeight);
197 202
198 // Must be expressed in canvas coordinates 203 // Must be expressed in canvas coordinates
199 void HandleMouseMove(const PointerEvent& event); 204 void HandleMouseMove(const PointerEvent& event);
200 205
201 // Must be expressed in canvas coordinates 206 // Must be expressed in canvas coordinates