X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Finsert.h;fp=src%2Fbase%2Finsert.h;h=0000000000000000000000000000000000000000;hb=9f6ad3fe0b9cb30115a5d38e8af3aebed0d70c08;hp=a9fbe65356981deb88364fe46709ba4550ab504d;hpb=43c13b052d069ba435277d93867380d00c04931f;p=architektonas diff --git a/src/base/insert.h b/src/base/insert.h deleted file mode 100644 index a9fbe65..0000000 --- a/src/base/insert.h +++ /dev/null @@ -1,124 +0,0 @@ -#ifndef __INSERT_H__ -#define __INSERT_H__ - -#include "entitycontainer.h" -#include "block.h" -#include "drawing.h" - -/** - * Holds the data that defines an insert. - */ -class InsertData -{ - public: - /** - * Default constructor. - */ - InsertData() {} - - /** - * @param name The name of the block used as an identifier. - * @param insertionPoint Insertion point of the block. - * @param scaleFactor Scale factor in x / y. - * @param angle Rotation angle. - * @param cols Number of cols if we insert a whole array. - * @param rows Number of rows if we insert a whole array. - * @param spacing Spacing between rows and cols. - * @param blockSource Source for the block to insert if other than parent. - * Normally blocks are requested from the entity's parent but the - * block can also come from another resource. Text uses that - * to share the blocks (letters) from a font. - * @param updateMode RS2::Update will update the insert entity instantly - * RS2::NoUpdate will not update the insert. You can update - * it later manually using the update() method. This is - * often the case since you might want to adjust attributes - * after creating an insert entity. - */ - InsertData(const QString & name, Vector insertionPoint, Vector scaleFactor, - double angle, int cols, int rows, Vector spacing, BlockList * blockSource = NULL, - RS2::UpdateMode updateMode = RS2::Update) - { - this->name = name; - this->insertionPoint = insertionPoint; - this->scaleFactor = scaleFactor; - this->angle = angle; - this->cols = cols; - this->rows = rows; - this->spacing = spacing; - this->blockSource = blockSource; - this->updateMode = updateMode; - } - - friend class Insert; - - friend std::ostream & operator<<(std::ostream & os, const InsertData & d) - { - os << "(" << d.name.toLatin1().data() << ")"; - return os; - } - - QString name; - Vector insertionPoint; - Vector scaleFactor; - double angle; - int cols, rows; - Vector spacing; - BlockList * blockSource; - RS2::UpdateMode updateMode; -}; - -/** - * An insert inserts a block into the drawing at a certain location - * with certain attributes (angle, scale, ...). - * Inserts don't really contain other entities internally. They just - * refer to a block. However, to the outside world they act exactly - * like EntityContainer. - * - * @author Andrew Mustun - */ -class Insert: public EntityContainer -{ - public: - Insert(EntityContainer * parent, const InsertData & d); - virtual ~Insert(); - - virtual Entity * clone(); - virtual RS2::EntityType rtti() const; - InsertData getData() const; - virtual void reparent(EntityContainer * parent); - - Block * getBlockForInsert(); - virtual void update(); - - QString getName() const; - void setName(const QString & newName); - Vector getInsertionPoint() const; - void setInsertionPoint(const Vector & i); - Vector getScale() const; - void setScale(const Vector & s); - double getAngle() const; - void setAngle(double a); - int getCols() const; - void setCols(int c); - int getRows() const; - void setRows(int r); - Vector getSpacing() const; - void setSpacing(const Vector & s); - virtual bool isVisible(); - - virtual VectorSolutions getRefPoints(); - virtual Vector getNearestRef(const Vector & coord, double * dist = NULL); - - virtual void move(Vector offset); - virtual void rotate(Vector center, double angle); - virtual void scale(Vector center, Vector factor); - virtual void mirror(Vector axisPoint1, Vector axisPoint2); - - friend std::ostream & operator<<(std::ostream & os, const Insert & i); - - protected: - InsertData data; - Block * block; -}; - -#endif