comparison Framework/Scene2DViewport/MeasureCommands.h @ 722:28b9e3a54200

Undo mechanism implemented (not connected to UI yet). Undo stack and measuring tools are now handled by the ViewportController. Multi-touch does not crash trackers anymore.
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 21 May 2019 10:27:54 +0200
parents 059e1fd05fd6
children c0fcb2757b0a
comparison
equal deleted inserted replaced
721:af0aa0c149fa 722:28b9e3a54200
41 } 41 }
42 virtual void Undo() = 0; 42 virtual void Undo() = 0;
43 virtual void Redo() = 0; 43 virtual void Redo() = 0;
44 44
45 protected: 45 protected:
46 ViewportControllerPtr GetController();
46 ViewportControllerWPtr controllerW_; 47 ViewportControllerWPtr controllerW_;
47 }; 48 };
48 49
49 class CreateMeasureCommand : public TrackerCommand 50 class CreateMeasureCommand : public TrackerCommand
50 { 51 {
51 public: 52 public:
52 CreateMeasureCommand( 53 CreateMeasureCommand(ViewportControllerWPtr controllerW);
53 ViewportControllerWPtr controllerW, MeasureToolList& measureTools);
54 ~CreateMeasureCommand(); 54 ~CreateMeasureCommand();
55 virtual void Undo() ORTHANC_OVERRIDE; 55 virtual void Undo() ORTHANC_OVERRIDE;
56 virtual void Redo() ORTHANC_OVERRIDE; 56 virtual void Redo() ORTHANC_OVERRIDE;
57 protected:
58 MeasureToolList& measureTools_;
59 private: 57 private:
60 /** Must be implemented by the subclasses that create the actual tool */ 58 /** Must be implemented by the subclasses that create the actual tool */
61 virtual MeasureToolPtr GetMeasureTool() = 0; 59 virtual MeasureToolPtr GetMeasureTool() = 0;
62 }; 60 };
63 61
65 { 63 {
66 public: 64 public:
67 CreateLineMeasureCommand( 65 CreateLineMeasureCommand(
68 MessageBroker& broker, 66 MessageBroker& broker,
69 ViewportControllerWPtr controllerW, 67 ViewportControllerWPtr controllerW,
70 MeasureToolList& measureTools,
71 ScenePoint2D point); 68 ScenePoint2D point);
72 69
73 // the starting position is set in the ctor 70 // the starting position is set in the ctor
74 void SetEnd(ScenePoint2D scenePos); 71 void SetEnd(ScenePoint2D scenePos);
75 72
87 public: 84 public:
88 /** Ctor sets end of side 1*/ 85 /** Ctor sets end of side 1*/
89 CreateAngleMeasureCommand( 86 CreateAngleMeasureCommand(
90 MessageBroker& broker, 87 MessageBroker& broker,
91 ViewportControllerWPtr controllerW, 88 ViewportControllerWPtr controllerW,
92 MeasureToolList& measureTools,
93 ScenePoint2D point); 89 ScenePoint2D point);
94 90
95 /** This method sets center*/ 91 /** This method sets center*/
96 void SetCenter(ScenePoint2D scenePos); 92 void SetCenter(ScenePoint2D scenePos);
97 93