cherish
AddEntityCommand.h
1 #ifndef ADDENTITYCOMMAND_H
2 #define ADDENTITYCOMMAND_H
3 
4 #include <QUndoCommand>
5 
6 #include <osg/ref_ptr>
7 #include <osg/observer_ptr>
8 
9 #include "UserScene.h"
10 #include "Canvas.h"
11 #include "Photo.h"
12 #include "Stroke.h"
13 #include "Polygon.h"
14 #include "Bookmarks.h"
15 #include "SceneState.h"
16 
17 namespace entity {
18 class UserScene;
19 class Bookmarks;
20 }
21 
27 namespace fur {
28 
29 
33 class AddCanvasCommand : public QUndoCommand
34 {
35 public:
38  AddCanvasCommand(entity::UserScene* scene, const osg::Matrix& R, const osg::Matrix& T,
39  const std::string& name, QUndoCommand* parent = 0);
40 
43  QUndoCommand* parent = 0);
44 
47  AddCanvasCommand(entity::UserScene* scene, const osg::Vec3f& normal, const osg::Vec3f& center,
48  const std::string& name, QUndoCommand* parent = 0);
49 
50 #ifndef DOXYGEN_SHOULD_SKIP_THIS
51  void undo() Q_DECL_OVERRIDE;
52  void redo() Q_DECL_OVERRIDE;
53 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
54 
55 private:
56  osg::observer_ptr<entity::UserScene> m_scene;
57  osg::ref_ptr<entity::Canvas> m_canvas;
58  osg::observer_ptr<entity::Bookmarks> m_bookmarks;
59 }; // class AddCanvasCommand
60 
64 class AddCanvasSeparationCommand : public QUndoCommand
65 {
66 public:
69  QUndoCommand* parent = 0);
70 
71 #ifndef DOXYGEN_SHOULD_SKIP_THIS
72  void undo() Q_DECL_OVERRIDE;
73  void redo() Q_DECL_OVERRIDE;
74 #endif // DOXYGEN_SHOULD_SKIP_THIS
75 
76 private:
77  void moveEntities(entity::Canvas* from, entity::Canvas* to);
78 
79  osg::observer_ptr<entity::UserScene> m_scene;
80  osg::observer_ptr<entity::Canvas> m_source;
81  osg::ref_ptr<entity::Canvas> m_target;
82  std::vector<entity::Entity2D*> m_entities;
83  osg::observer_ptr<entity::Bookmarks> m_bookmarks;
84 };
85 
89 class AddPhotoCommand : public QUndoCommand
90 {
91 public:
93  AddPhotoCommand(entity::UserScene* scene, const std::string& fname, const std::string& ename,
94  QUndoCommand* parent = 0);
95 
96 #ifndef DOXYGEN_SHOULD_SKIP_THIS
97  void undo() Q_DECL_OVERRIDE;
98  void redo() Q_DECL_OVERRIDE;
99 #endif // DOXYGEN_SHOULD_SKIP_THIS
100 
101 private:
102  osg::observer_ptr<entity::UserScene> m_scene;
103  osg::observer_ptr<entity::Canvas> m_canvas;
104  osg::ref_ptr<entity::Photo> m_photo;
105  osg::observer_ptr<entity::Bookmarks> m_bookmarks;
106 };
107 
111 class AddStrokeCommand : public QUndoCommand
112 {
113 public:
115  AddStrokeCommand(entity::UserScene* scene, entity::Stroke* stroke, QUndoCommand *parent = 0);
116 
117 #ifndef DOXYGEN_SHOULD_SKIP_THIS
118  void undo() Q_DECL_OVERRIDE;
119  void redo() Q_DECL_OVERRIDE;
120 #endif // DOXYGEN_SHOULD_SKIP_THIS
121 
122 private:
123  osg::observer_ptr<entity::UserScene> m_scene;
124  osg::observer_ptr<entity::Canvas> m_canvas;
125  osg::ref_ptr<entity::Stroke> m_stroke;
126 };
127 
128 class AddEntityCommand : public QUndoCommand
129 {
130 public:
131  AddEntityCommand(entity::UserScene* scene, entity::Entity2D* entity, QUndoCommand* parent = 0);
132 
133  void undo() Q_DECL_OVERRIDE;
134  void redo() Q_DECL_OVERRIDE;
135 
136 private:
137  osg::observer_ptr<entity::UserScene> m_scene;
138  osg::observer_ptr<entity::Canvas> m_canvas;
139  osg::ref_ptr<entity::Entity2D> m_entity;
140 };
141 
145 class AddPolygonCommand : public QUndoCommand
146 {
147 public:
149  AddPolygonCommand(entity::UserScene* scene, entity::Polygon* polygon, QUndoCommand* parent = 0);
150 
151 #ifndef DOXYGEN_SHOULD_SKIP_THIS
152  void undo() Q_DECL_OVERRIDE;
153  void redo() Q_DECL_OVERRIDE;
154 #endif // DOXYGEN_SHOULD_SKIP_THIS
155 
156 private:
157  osg::observer_ptr<entity::UserScene> m_scene;
158  osg::observer_ptr<entity::Canvas> m_canvas;
159  osg::ref_ptr<entity::Polygon> m_polygon;
160 };
161 
162 class AddLineSegmentCommand : public QUndoCommand
163 {
164 public:
165  AddLineSegmentCommand(entity::UserScene* scene, entity::LineSegment* segment, QUndoCommand* parent = 0);
166 
167  void undo() Q_DECL_OVERRIDE;
168  void redo() Q_DECL_OVERRIDE;
169 
170 private:
171  osg::observer_ptr<entity::UserScene> m_scene;
172  osg::observer_ptr<entity::Canvas> m_canvas;
173  osg::ref_ptr<entity::LineSegment> m_segment;
174 };
175 
176 } // namespace fur
177 
178 #endif // ADDENTITYCOMMAND_H
QUndoCommand that performs addition of a canvas to entity::UserScene.
Definition: AddEntityCommand.h:33
A proxy class that helps to connect scene graph camera positions (in format eye, center, up and name) with the corresponding BookmarkWidget.
Definition: Bookmarks.h:48
Definition: Canvas.h:31
Geometry class that represents a line segment in 3D space.
Definition: LineSegment.h:17
QUndoCommand that performs addition of a stroke to UserScene.
Definition: AddEntityCommand.h:111
Scene graph entities.
Definition: AddEntityCommand.h:17
Geometry class that defined strokes entered by a user. The creation and usage of this class must be f...
Definition: Stroke.h:62
Geometry class that defines opacity polygons drawn by a user. The creation and usage of this class mu...
Definition: Polygon.h:47
The UserScene class contains scene graph that was created by user, including the construction tools...
Definition: UserScene.h:86
Definition: AddEntityCommand.h:162
Definition: Entity2D.h:13
QUndoCommand that perform addition of a entity::Polygon to entity::UserScene.
Definition: AddEntityCommand.h:145
QUndoCommand that performs separation of a canvas and addition of it to entity::UserScene.
Definition: AddEntityCommand.h:64
QUndoCommand that performs addition of a photo to entity::UserScene.
Definition: AddEntityCommand.h:89
Contains QUndoCommand - based classes that are defined within undo/redo framework. All these classes are made friend classes for entity::UserScene (protected) so that to access add and remove entity functionality.
Definition: AddEntityCommand.h:128