+++ /dev/null
-#ifndef __MODIFICATION_H__
-#define __MODIFICATION_H__
-
-#include "entitycontainer.h"
-#include "graphicview.h"
-#include "line.h"
-
-/**
- * Holds the data needed for move modifications.
- */
-class MoveData
-{
- public:
- int number;
- bool useCurrentAttributes;
- bool useCurrentLayer;
- Vector offset;
-};
-
-/**
- * Holds the data needed for rotation modifications.
- */
-class RotateData
-{
- public:
- int number;
- bool useCurrentAttributes;
- bool useCurrentLayer;
- Vector center;
- double angle;
-};
-
-/**
- * Holds the data needed for scale modifications.
- */
-class ScaleData
-{
- public:
- int number;
- bool useCurrentAttributes;
- bool useCurrentLayer;
- Vector referencePoint;
- double factor;
-};
-
-/**
- * Holds the data needed for mirror modifications.
- */
-class MirrorData
-{
- public:
- bool copy;
- bool useCurrentAttributes;
- bool useCurrentLayer;
- Vector axisPoint1;
- Vector axisPoint2;
-};
-
-/**
- * Holds the data needed for move/rotate modifications.
- */
-class MoveRotateData
-{
- public:
- int number;
- bool useCurrentAttributes;
- bool useCurrentLayer;
- Vector referencePoint;
- Vector offset;
- double angle;
-};
-
-/**
- * Holds the data needed for rotation around two centers modifications.
- */
-class Rotate2Data
-{
- public:
- int number;
- bool useCurrentAttributes;
- bool useCurrentLayer;
- Vector center1;
- Vector center2;
- double angle1;
- double angle2;
-};
-
-/**
- * Holds the data needed for beveling modifications.
- */
-class BevelData
-{
- public:
- double length1;
- double length2;
- bool trim;
-};
-
-/**
- * Holds the data needed for rounding modifications.
- */
-class RoundData
-{
- public:
- double radius;
- bool trim;
-};
-
-/**
- * Holds the data needed for moving reference points.
- */
-class MoveRefData
-{
- public:
- Vector ref;
- Vector offset;
-};
-
-/**
- * Holds the data needed for changing attributes.
- */
-class AttributesData
-{
- public:
- QString layer;
- Pen pen;
- bool changeLayer;
- bool changeColor;
- bool changeLineType;
- bool changeWidth;
-};
-
-/**
- * Holds the data needed for pasting.
- */
-class PasteData
-{
- public:
- PasteData(Vector insertionPoint, double factor, double angle,
- bool asInsert, const QString & blockName)
- {
- this->insertionPoint = insertionPoint;
- this->factor = factor;
- this->angle = angle;
- this->asInsert = asInsert;
- this->blockName = blockName;
- }
-
- //! Insertion point.
- Vector insertionPoint;
- //! Scale factor.
- double factor;
- //! Rotation angle.
- double angle;
- //! Paste as an insert rather than individual entities.
- bool asInsert;
- //! Name of the block to create or an empty string to assign a new auto name.
- QString blockName;
-};
-
-/**
- * API Class for manipulating entities.
- * There's no interaction handled in this class.
- *
- * All modifications can be undone / redone if the container
- * is a Drawing.
- *
- * This class is connected to an entity container and
- * can be connected to a graphic view.
- *
- * @author Andrew Mustun
- */
-class Modification
-{
- public:
- Modification(EntityContainer & entityContainer,
- GraphicView * graphicView = NULL, bool handleUndo = true);
-
- void remove();
- bool changeAttributes(AttributesData& data);
-
- void copy(const Vector & ref, const bool cut);
- private:
- void copyEntity(Entity * e, const Vector & ref, const bool cut);
- public:
- void copyLayers(Entity * e);
- void copyBlocks(Entity * e);
- void paste(const PasteData & data, Drawing * source = NULL);
-
- bool move(MoveData & data);
- bool rotate(RotateData & data);
- bool scale(ScaleData & data);
- bool mirror(MirrorData & data);
- bool moveRotate(MoveRotateData & data);
- bool rotate2(Rotate2Data & data);
-
- bool trim(const Vector & trimCoord, AtomicEntity * trimEntity,
- const Vector & limitCoord, Entity * limitEntity,
- bool both);
- bool trimAmount(const Vector & trimCoord, AtomicEntity * trimEntity,
- double dist);
-
- bool cut(const Vector& cutCoord, AtomicEntity* cutEntity);
- bool stretch(const Vector & firstCorner, const Vector & secondCorner,
- const Vector & offset);
-
- bool bevel(const Vector & coord1, AtomicEntity * entity1,
- const Vector & coord2, AtomicEntity * entity2,
- BevelData & data);
- bool round(const Vector & coord, const Vector & coord1, AtomicEntity * entity1,
- const Vector & coord2, AtomicEntity * entity2, RoundData & data);
-
- bool explode();
- bool explodeTextIntoLetters();
- bool explodeTextIntoLetters(Text * text, QList<Entity *> & addList);
- bool moveRef(MoveRefData & data);
-
- bool splitPolyline(Polyline & polyline, Entity & e1, Vector v1,
- Entity & e2, Vector v2, Polyline ** polyline1, Polyline ** polyline2) const;
- Polyline * addPolylineNode(Polyline& polyline,
- const AtomicEntity& segment, const Vector& node);
- Polyline * deletePolylineNode(Polyline& polyline, const Vector& node);
- Polyline * deletePolylineNodesBetween(Polyline & polyline, AtomicEntity & segment,
- const Vector& node1, const Vector & node2);
- Polyline * polylineTrim(Polyline & polyline,
- AtomicEntity & segment1, AtomicEntity & segment2);
-
- private:
- void deselectOriginals(bool remove);
- void addNewEntities(QList<Entity *> & addList);
-
- protected:
- EntityContainer * container;
- Drawing * graphic;
- Document * document;
- GraphicView * graphicView;
- bool handleUndo;
-};
-
-#endif