LibreCAD
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
entityops.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "documentoperation.h"
4 #include <vector>
5 
6 #include <cad/base/cadentity.h>
7 
8 namespace lc {
9  class Document;
10  DECLARE_SHORT_SHARED_PTR(Document)
11 
12  namespace operation {
17  class Base;
19 
20  class Base {
21  public:
22  virtual ~Base();
23 
24  virtual std::vector<entity::CADEntity_CSPtr> process(
25  const std::shared_ptr<Document>,
26  const std::vector<entity::CADEntity_CSPtr> entities,
27  std::vector<entity::CADEntity_CSPtr>& workingBuffer,
28  std::vector<entity::CADEntity_CSPtr>& removals,
29  const std::vector<Base_SPtr> operationStack
30  ) = 0;
31  };
32 
50  class Loop : public Base {
51  public:
52  Loop(const int numTimes);
53 
54  virtual ~Loop();
55 
56  virtual std::vector<entity::CADEntity_CSPtr> process(
57  const Document_SPtr document,
58  std::vector<entity::CADEntity_CSPtr> entities,
59  std::vector<entity::CADEntity_CSPtr>& workingBuffer,
60  std::vector<entity::CADEntity_CSPtr>& removals,
61  const std::vector<Base_SPtr> operationStack);
62 
63  private:
64  int _numTimes;
65  };
67 
68 
86  class Begin : public Base {
87  public:
88  Begin();
89 
90  virtual ~Begin();
91 
92  virtual std::vector<entity::CADEntity_CSPtr> process(
93  const std::shared_ptr<Document> document,
94  std::vector<entity::CADEntity_CSPtr> entities,
95  std::vector<entity::CADEntity_CSPtr>& workingBuffer,
96  std::vector<entity::CADEntity_CSPtr>& removals,
97  const std::vector<Base_SPtr> operationStack);
98 
99  std::vector<entity::CADEntity_CSPtr> getEntities() const;
100 
101  private:
102  std::vector<entity::CADEntity_CSPtr> _entities;
103  };
105 
106 
124  class Move : public Base {
125  public:
126  Move(const geo::Coordinate& offset);
127 
128  virtual ~Move();
129 
130  virtual std::vector<entity::CADEntity_CSPtr> process(
131  const std::shared_ptr<Document> document,
132  std::vector<entity::CADEntity_CSPtr> entities,
133  std::vector<entity::CADEntity_CSPtr>& workingBuffer,
134  std::vector<entity::CADEntity_CSPtr>& removals,
135  const std::vector<Base_SPtr> operationStack);
136 
137  private:
139  };
141 
142 
160  class Copy : public Base {
161  public:
162  Copy(const geo::Coordinate& offset);
163 
164  virtual ~Copy();
165 
166  virtual std::vector<entity::CADEntity_CSPtr> process(
167  const std::shared_ptr<Document> document,
168  std::vector<entity::CADEntity_CSPtr> entities,
169  std::vector<entity::CADEntity_CSPtr>& workingBuffer,
170  std::vector<entity::CADEntity_CSPtr>& removals,
171  const std::vector<Base_SPtr> operationStack);
172 
173  private:
176  };
178 
179 
197  class Rotate : public Base {
198  public:
199  Rotate(const geo::Coordinate& rotation_center, const double rotation_angle);
200 
201  virtual ~Rotate();
202 
203  virtual std::vector<entity::CADEntity_CSPtr> process(
204  const std::shared_ptr<Document> document,
205  std::vector<entity::CADEntity_CSPtr> entities,
206  std::vector<entity::CADEntity_CSPtr>& workingBuffer,
207  std::vector<entity::CADEntity_CSPtr>& removals,
208  const std::vector<Base_SPtr> operationStack);
209 
210  private:
211 
214  };
216 
217  class Scale : public Base {
218  public:
219  Scale(const geo::Coordinate& scale_center, const geo::Coordinate& scale_factor);
220 
221  virtual ~Scale();
222 
223  virtual std::vector<entity::CADEntity_CSPtr> process(
224  const std::shared_ptr<Document> document,
225  std::vector<entity::CADEntity_CSPtr> entities,
226  std::vector<entity::CADEntity_CSPtr>& workingBuffer,
227  std::vector<entity::CADEntity_CSPtr>& removals,
228  const std::vector<Base_SPtr> operationStack);
229 
230  private:
232  _scale_center, _scale_factor;
233  };
235 
236 
256  class Push : public Base {
257  public:
258  Push();
259 
260  virtual ~Push();
261 
262  virtual std::vector<entity::CADEntity_CSPtr> process(
263  const std::shared_ptr<Document> document,
264  std::vector<entity::CADEntity_CSPtr> entities,
265  std::vector<entity::CADEntity_CSPtr>& workingBuffer,
266  std::vector<entity::CADEntity_CSPtr>& removals,
267  const std::vector<Base_SPtr> operationStack);
268  };
270 
271 
288  class SelectByLayer : public Base {
289  public:
290  SelectByLayer(const Layer_CSPtr layer);
291 
292  virtual ~SelectByLayer();
293 
294  virtual std::vector<entity::CADEntity_CSPtr> process(
295  const std::shared_ptr<Document> document,
296  std::vector<entity::CADEntity_CSPtr> entities,
297  std::vector <entity::CADEntity_CSPtr>& workingBuffer,
298  std::vector<entity::CADEntity_CSPtr>& removals,
299  const std::vector<Base_SPtr> operationStack);
300 
301  private:
302  Layer_CSPtr _layer;
303  };
304  DECLARE_SHORT_SHARED_PTR(SelectByLayer)
305 
306 
323  class Remove : public Base {
324  public:
325  Remove();
326 
327  virtual ~Remove();
328 
329  virtual std::vector<entity::CADEntity_CSPtr> process(
330  const std::shared_ptr<Document> document,
331  std::vector<entity::CADEntity_CSPtr> entities,
332  std::vector <entity::CADEntity_CSPtr>& workingBuffer,
333  std::vector<entity::CADEntity_CSPtr>& removals,
334  const std::vector<Base_SPtr> operationStack);
335 
336  private:
337  Layer_CSPtr _layer;
338  };
340  }
341 }
geo::Coordinate _rotation_center
Definition: entityops.h:212
The Move class Allows for setting up the beginning of a loop (NOT YET IMPLEMENTED) ...
Definition: entityops.h:124
The Rotate class Allows for copy of the current set of entities.
Definition: entityops.h:197
The begin class Allows for setting up the beginning of a loop (NOT YET IMPLEMENTED) ...
Definition: entityops.h:86
geo::Coordinate _offset
Definition: entityops.h:138
The Loop class Allows for looping over a set of entities.
Definition: entityops.h:50
DECLARE_SHORT_SHARED_PTR(Document)
Definition: cadentity.h:12
The Push class Allows for pushing all entities on the stack for the next operation.
Definition: entityops.h:256
geo::Coordinate _scale_factor
Definition: entityops.h:232
The Copy class Allows for copy of the current set of entities.
Definition: entityops.h:160
std::vector< entity::CADEntity_CSPtr > _entities
Definition: entityops.h:102
geo::Coordinate _offset
Definition: entityops.h:175