1 #ifndef RS_MODIFICATION_H
2 #define RS_MODIFICATION_H
4 #include "rs_entitycontainer.h"
5 #include "rs_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.
62 class RS_MoveRotateData
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.
122 class RS_AttributesData
134 * Holds the data needed for pasting.
139 RS_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
173 class RS_Modification
176 RS_Modification(RS_EntityContainer & entityContainer,
177 RS_GraphicView * graphicView = NULL, bool handleUndo = true);
180 bool changeAttributes(RS_AttributesData& data);
182 void copy(const Vector & ref, const bool cut);
184 void copyEntity(RS_Entity * e, const Vector & ref, const bool cut);
186 void copyLayers(RS_Entity * e);
187 void copyBlocks(RS_Entity * e);
188 void paste(const RS_PasteData & data, Drawing * source = NULL);
190 bool move(RS_MoveData & data);
191 bool rotate(RS_RotateData & data);
192 bool scale(RS_ScaleData & data);
193 bool mirror(RS_MirrorData & data);
194 bool moveRotate(RS_MoveRotateData & data);
195 bool rotate2(RS_Rotate2Data & data);
197 bool trim(const Vector & trimCoord, RS_AtomicEntity * trimEntity,
198 const Vector & limitCoord, RS_Entity * limitEntity,
200 bool trimAmount(const Vector & trimCoord, RS_AtomicEntity * trimEntity,
203 bool cut(const Vector& cutCoord, RS_AtomicEntity* cutEntity);
204 bool stretch(const Vector & firstCorner, const Vector & secondCorner,
205 const Vector & offset);
207 bool bevel(const Vector & coord1, RS_AtomicEntity * entity1,
208 const Vector & coord2, RS_AtomicEntity * entity2,
209 RS_BevelData & data);
210 bool round(const Vector & coord, const Vector & coord1, RS_AtomicEntity * entity1,
211 const Vector & coord2, RS_AtomicEntity * entity2, RS_RoundData & data);
214 bool explodeTextIntoLetters();
215 // bool explodeTextIntoLetters(RS_Text* text, Q3PtrList<RS_Entity>& addList);
216 bool explodeTextIntoLetters(RS_Text * text, QList<RS_Entity *> & addList);
217 bool moveRef(RS_MoveRefData & data);
219 bool splitPolyline(RS_Polyline & polyline, RS_Entity & e1, Vector v1,
220 RS_Entity & e2, Vector v2, RS_Polyline ** polyline1, RS_Polyline ** polyline2) const;
221 RS_Polyline * addPolylineNode(RS_Polyline& polyline,
222 const RS_AtomicEntity& segment, const Vector& node);
223 RS_Polyline * deletePolylineNode(RS_Polyline& polyline, const Vector& node);
224 RS_Polyline * deletePolylineNodesBetween(RS_Polyline & polyline, RS_AtomicEntity & segment,
225 const Vector& node1, const Vector & node2);
226 RS_Polyline * polylineTrim(RS_Polyline & polyline,
227 RS_AtomicEntity & segment1, RS_AtomicEntity & segment2);
230 void deselectOriginals(bool remove);
231 // void addNewEntities(Q3PtrList<RS_Entity>& addList);
232 void addNewEntities(QList<RS_Entity *> & addList);
235 RS_EntityContainer * container;
237 RS_Document * document;
238 RS_GraphicView * graphicView;