1 #ifndef __MODIFICATION_H__
2 #define __MODIFICATION_H__
4 #include "entitycontainer.h"
5 #include "graphicview.h"
9 * Holds the data needed for move modifications.
15 bool useCurrentAttributes;
21 * Holds the data needed for rotation modifications.
27 bool useCurrentAttributes;
34 * Holds the data needed for scale modifications.
40 bool useCurrentAttributes;
42 Vector referencePoint;
47 * Holds the data needed for mirror modifications.
53 bool useCurrentAttributes;
60 * Holds the data needed for move/rotate modifications.
66 bool useCurrentAttributes;
68 Vector referencePoint;
74 * Holds the data needed for rotation around two centers modifications.
80 bool useCurrentAttributes;
89 * Holds the data needed for beveling modifications.
100 * Holds the data needed for rounding modifications.
110 * Holds the data needed for moving reference points.
120 * Holds the data needed for changing attributes.
134 * Holds the data needed for pasting.
139 PasteData(Vector insertionPoint, double factor, double angle,
140 bool asInsert, const QString & blockName)
142 this->insertionPoint = insertionPoint;
143 this->factor = factor;
145 this->asInsert = asInsert;
146 this->blockName = blockName;
150 Vector insertionPoint;
155 //! Paste as an insert rather than individual entities.
157 //! Name of the block to create or an empty string to assign a new auto name.
162 * API Class for manipulating entities.
163 * There's no interaction handled in this class.
165 * All modifications can be undone / redone if the container
168 * This class is connected to an entity container and
169 * can be connected to a graphic view.
171 * @author Andrew Mustun
176 Modification(EntityContainer & entityContainer,
177 GraphicView * graphicView = NULL, bool handleUndo = true);
180 bool changeAttributes(AttributesData& data);
182 void copy(const Vector & ref, const bool cut);
184 void copyEntity(Entity * e, const Vector & ref, const bool cut);
186 void copyLayers(Entity * e);
187 void copyBlocks(Entity * e);
188 void paste(const PasteData & data, Drawing * source = NULL);
190 bool move(MoveData & data);
191 bool rotate(RotateData & data);
192 bool scale(ScaleData & data);
193 bool mirror(MirrorData & data);
194 bool moveRotate(MoveRotateData & data);
195 bool rotate2(Rotate2Data & data);
197 bool trim(const Vector & trimCoord, AtomicEntity * trimEntity,
198 const Vector & limitCoord, Entity * limitEntity,
200 bool trimAmount(const Vector & trimCoord, AtomicEntity * trimEntity,
203 bool cut(const Vector& cutCoord, AtomicEntity* cutEntity);
204 bool stretch(const Vector & firstCorner, const Vector & secondCorner,
205 const Vector & offset);
207 bool bevel(const Vector & coord1, AtomicEntity * entity1,
208 const Vector & coord2, AtomicEntity * entity2,
210 bool round(const Vector & coord, const Vector & coord1, AtomicEntity * entity1,
211 const Vector & coord2, AtomicEntity * entity2, RoundData & data);
214 bool explodeTextIntoLetters();
215 bool explodeTextIntoLetters(Text * text, QList<Entity *> & addList);
216 bool moveRef(MoveRefData & data);
218 bool splitPolyline(Polyline & polyline, Entity & e1, Vector v1,
219 Entity & e2, Vector v2, Polyline ** polyline1, Polyline ** polyline2) const;
220 Polyline * addPolylineNode(Polyline& polyline,
221 const AtomicEntity& segment, const Vector& node);
222 Polyline * deletePolylineNode(Polyline& polyline, const Vector& node);
223 Polyline * deletePolylineNodesBetween(Polyline & polyline, AtomicEntity & segment,
224 const Vector& node1, const Vector & node2);
225 Polyline * polylineTrim(Polyline & polyline,
226 AtomicEntity & segment1, AtomicEntity & segment2);
229 void deselectOriginals(bool remove);
230 void addNewEntities(QList<Entity *> & addList);
233 EntityContainer * container;
236 GraphicView * graphicView;