X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Fmodification.h;fp=src%2Fbase%2Fmodification.h;h=0000000000000000000000000000000000000000;hb=9f6ad3fe0b9cb30115a5d38e8af3aebed0d70c08;hp=55345222fd6f3fdbf793ea23d7336edc0e1917d5;hpb=43c13b052d069ba435277d93867380d00c04931f;p=architektonas diff --git a/src/base/modification.h b/src/base/modification.h deleted file mode 100644 index 5534522..0000000 --- a/src/base/modification.h +++ /dev/null @@ -1,240 +0,0 @@ -#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 & 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 & addList); - - protected: - EntityContainer * container; - Drawing * graphic; - Document * document; - GraphicView * graphicView; - bool handleUndo; -}; - -#endif