1 /****************************************************************************
2 ** $Id: rs_modification.h 1946 2004-12-24 19:27:43Z andrew $
4 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
6 ** This file is part of the qcadlib Library project.
8 ** This file may be distributed and/or modified under the terms of the
9 ** GNU General Public License version 2 as published by the Free Software
10 ** Foundation and appearing in the file LICENSE.GPL included in the
11 ** packaging of this file.
13 ** Licensees holding valid qcadlib Professional Edition licenses may use
14 ** this file in accordance with the qcadlib Commercial License
15 ** Agreement provided with the Software.
17 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 ** See http://www.ribbonsoft.com for further details.
22 ** Contact info@ribbonsoft.com if any conditions of this licensing are
25 **********************************************************************/
27 #ifndef RS_MODIFICATION_H
28 #define RS_MODIFICATION_H
30 #include "rs_entitycontainer.h"
31 #include "rs_graphicview.h"
35 * Holds the data needed for move modifications.
41 bool useCurrentAttributes;
47 * Holds the data needed for rotation modifications.
53 bool useCurrentAttributes;
60 * Holds the data needed for scale modifications.
66 bool useCurrentAttributes;
68 Vector referencePoint;
73 * Holds the data needed for mirror modifications.
79 bool useCurrentAttributes;
86 * Holds the data needed for move/rotate modifications.
88 class RS_MoveRotateData
92 bool useCurrentAttributes;
94 Vector referencePoint;
100 * Holds the data needed for rotation around two centers modifications.
106 bool useCurrentAttributes;
107 bool useCurrentLayer;
115 * Holds the data needed for beveling modifications.
126 * Holds the data needed for rounding modifications.
136 * Holds the data needed for moving reference points.
146 * Holds the data needed for changing attributes.
148 class RS_AttributesData
160 * Holds the data needed for pasting.
165 RS_PasteData(Vector insertionPoint, double factor, double angle,
166 bool asInsert, const QString & blockName)
168 this->insertionPoint = insertionPoint;
169 this->factor = factor;
171 this->asInsert = asInsert;
172 this->blockName = blockName;
176 Vector insertionPoint;
181 //! Paste as an insert rather than individual entities.
183 //! Name of the block to create or an empty string to assign a new auto name.
188 * API Class for manipulating entities.
189 * There's no interaction handled in this class.
191 * All modifications can be undone / redone if the container
194 * This class is connected to an entity container and
195 * can be connected to a graphic view.
197 * @author Andrew Mustun
199 class RS_Modification
202 RS_Modification(RS_EntityContainer & entityContainer,
203 RS_GraphicView * graphicView = NULL, bool handleUndo = true);
206 bool changeAttributes(RS_AttributesData& data);
208 void copy(const Vector & ref, const bool cut);
210 void copyEntity(RS_Entity * e, const Vector & ref, const bool cut);
212 void copyLayers(RS_Entity * e);
213 void copyBlocks(RS_Entity * e);
214 void paste(const RS_PasteData & data, RS_Graphic * source = NULL);
216 bool move(RS_MoveData & data);
217 bool rotate(RS_RotateData & data);
218 bool scale(RS_ScaleData & data);
219 bool mirror(RS_MirrorData & data);
220 bool moveRotate(RS_MoveRotateData & data);
221 bool rotate2(RS_Rotate2Data & data);
223 bool trim(const Vector & trimCoord, RS_AtomicEntity * trimEntity,
224 const Vector & limitCoord, RS_Entity * limitEntity,
226 bool trimAmount(const Vector & trimCoord, RS_AtomicEntity * trimEntity,
229 bool cut(const Vector& cutCoord, RS_AtomicEntity* cutEntity);
230 bool stretch(const Vector & firstCorner, const Vector & secondCorner,
231 const Vector & offset);
233 bool bevel(const Vector & coord1, RS_AtomicEntity * entity1,
234 const Vector & coord2, RS_AtomicEntity * entity2,
235 RS_BevelData & data);
236 bool round(const Vector & coord, const Vector & coord1, RS_AtomicEntity * entity1,
237 const Vector & coord2, RS_AtomicEntity * entity2, RS_RoundData & data);
240 bool explodeTextIntoLetters();
241 // bool explodeTextIntoLetters(RS_Text* text, Q3PtrList<RS_Entity>& addList);
242 bool explodeTextIntoLetters(RS_Text * text, QList<RS_Entity *> & addList);
243 bool moveRef(RS_MoveRefData & data);
245 bool splitPolyline(RS_Polyline & polyline, RS_Entity & e1, Vector v1,
246 RS_Entity & e2, Vector v2, RS_Polyline ** polyline1, RS_Polyline ** polyline2) const;
247 RS_Polyline * addPolylineNode(RS_Polyline& polyline,
248 const RS_AtomicEntity& segment, const Vector& node);
249 RS_Polyline * deletePolylineNode(RS_Polyline& polyline, const Vector& node);
250 RS_Polyline * deletePolylineNodesBetween(RS_Polyline & polyline, RS_AtomicEntity & segment,
251 const Vector& node1, const Vector & node2);
252 RS_Polyline * polylineTrim(RS_Polyline & polyline,
253 RS_AtomicEntity & segment1, RS_AtomicEntity & segment2);
256 void deselectOriginals(bool remove);
257 // void addNewEntities(Q3PtrList<RS_Entity>& addList);
258 void addNewEntities(QList<RS_Entity *> & addList);
261 RS_EntityContainer * container;
262 RS_Graphic * graphic;
263 RS_Document * document;
264 RS_GraphicView * graphicView;