X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Fdimension.h;fp=src%2Fbase%2Fdimension.h;h=0000000000000000000000000000000000000000;hb=9f6ad3fe0b9cb30115a5d38e8af3aebed0d70c08;hp=50360da2157b66789fe87d21db302f3aabc74496;hpb=43c13b052d069ba435277d93867380d00c04931f;p=architektonas diff --git a/src/base/dimension.h b/src/base/dimension.h deleted file mode 100644 index 50360da..0000000 --- a/src/base/dimension.h +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef __DIMENSION_H__ -#define __DIMENSION_H__ - -#include "entitycontainer.h" - -/** - * Holds the data that is common to all dimension entities. - */ -class DimensionData: public Flags -{ - public: - /** - * Default constructor. Leaves the data object uninitialized. - */ - DimensionData() {} - - /** - * Constructor with initialisation. - * - * @param definitionPoint Definition point. - * @param middleOfText Middle point of dimension text. - * @param valign Vertical alignment. - * @param halign Horizontal alignment. - * @param lineSpacingStyle Line spacing style. - * @param lineSpacingFactor Line spacing factor. - * @param text Text string entered explicitly by user or null - * or "<>" for the actual measurement or " " (one blank space). - * for supressing the text. - * @param style Dimension style name. - * @param angle Rotation angle of dimension text away from - * default orientation. - */ - DimensionData(const Vector & definitionPoint, - const Vector & middleOfText, - RS2::VAlign valign, - RS2::HAlign halign, - RS2::TextLineSpacingStyle lineSpacingStyle, - double lineSpacingFactor, - QString text, - QString style, - double angle) - { - this->definitionPoint = definitionPoint; - this->middleOfText = middleOfText; - this->valign = valign; - this->halign = halign; - this->lineSpacingStyle = lineSpacingStyle; - this->lineSpacingFactor = lineSpacingFactor; - this->text = text; - this->style = style; - this->angle = angle; - } - - friend class Dimension; - friend class DimAligned; - friend class DimLinear; - friend class RS_ActionDimAligned; - friend class RS_ActionDimLinear; - - friend std::ostream & operator<<(std::ostream & os, const DimensionData & dd) - { - os << "(" << dd.definitionPoint << ")"; - return os; - } - - public: - /** Definition point */ - Vector definitionPoint; - /** Middle point of dimension text */ - Vector middleOfText; - /** Vertical alignment */ - RS2::VAlign valign; - /** Horizontal alignment */ - RS2::HAlign halign; - /** Line spacing style */ - RS2::TextLineSpacingStyle lineSpacingStyle; - /** Line spacing factor */ - double lineSpacingFactor; - /** - * Text string entered explicitly by user or null - * or "<>" for the actual measurement or " " (one blank space) - * for supressing the text. - */ - QString text; - /** Dimension style name */ - QString style; - /** Rotation angle of dimension text away from default orientation */ - double angle; -}; - -/** - * Abstract base class for dimension entity classes. - * - * @author Andrew Mustun - */ -class Dimension: public EntityContainer -{ - public: - Dimension(EntityContainer * parent, const DimensionData & d); - virtual ~Dimension(); - - DimensionData getData() const; - Vector getNearestRef(const Vector & coord, double * dist); - Vector getNearestSelectedRef(const Vector & coord, double * dist); - QString getLabel(bool resolve = true); - void setLabel(const QString & l); - - /** - * Needs to be implemented by the dimension class to return the - * measurement of the dimension (e.g. 10.5 or 15'14"). - */ - virtual QString getMeasuredLabel() = 0; - - /** - * Must be overwritten by implementing dimension entity class - * to update the subentities which make up the dimension entity. - */ - virtual void update(bool autoText = false) = 0; - - void updateCreateDimensionLine(const Vector & p1, const Vector & p2, - bool arrow1 = true, bool arrow2 = true, bool autoText = false); - Vector getDefinitionPoint(); - Vector getMiddleOfText(); - RS2::VAlign getVAlign(); - RS2::HAlign getHAlign(); - RS2::TextLineSpacingStyle getLineSpacingStyle(); - double getLineSpacingFactor(); - QString getText(); - QString getStyle(); - double getAngle(); - double getArrowSize(); - double getExtensionLineExtension(); - double getExtensionLineOffset(); - double getDimensionLineGap(); - double getTextHeight(); - double getGraphicVariable(const QString & key, double defMM, int code); - virtual double getLength(); - 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); - - protected: - /** Data common to all dimension entities. */ - DimensionData data; -}; - -#endif