X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Farc.h;fp=src%2Fbase%2Farc.h;h=0000000000000000000000000000000000000000;hb=9f6ad3fe0b9cb30115a5d38e8af3aebed0d70c08;hp=2c785c68556a5e5ed938f707f5dbce97853dd5fb;hpb=43c13b052d069ba435277d93867380d00c04931f;p=architektonas diff --git a/src/base/arc.h b/src/base/arc.h deleted file mode 100644 index 2c785c6..0000000 --- a/src/base/arc.h +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef __ARC_H__ -#define __ARC_H__ - -#include "atomicentity.h" - -class PaintInterface; -class GraphicView; - -/** - * Holds the data that defines an arc. - */ -class ArcData -{ - public: - ArcData() - { - } - - ArcData(const Vector & center, double radius, double angle1, double angle2, bool reversed) - { - this->center = center; - this->radius = radius; - this->angle1 = angle1; - this->angle2 = angle2; - this->reversed = reversed; - } - - void reset() - { - center = Vector(false); - radius = 0.0; - angle1 = 0.0; - angle2 = 0.0; - reversed = false; - } - - bool isValid() - { - return (center.valid && radius > RS_TOLERANCE - && fabs(angle1 - angle2) > RS_TOLERANCE_ANGLE); - } - - friend std::ostream & operator<<(std::ostream & os, const ArcData & ad) - { - os << "(" << ad.center - << "/" << ad.radius - << " " << ad.angle1 - << "," << ad.angle2 - << ")"; - return os; - } - - public: - Vector center; - double radius; - double angle1; - double angle2; - bool reversed; -}; - -/** - * Class for an arc entity. All angles are in Rad. - * - * @author Andrew Mustun - */ -class Arc: public AtomicEntity -{ - public: - Arc(EntityContainer * parent, const ArcData & d); - virtual ~Arc(); - - virtual Entity * clone(); - virtual RS2::EntityType rtti() const; - virtual bool isEdge() const; - ArcData getData() const; - virtual VectorSolutions getRefPoints(); - void setData(ArcData d); - Vector getCenter() const; - void setCenter(const Vector & c); - double getRadius() const; - void setRadius(double r); - double getAngle1() const; - void setAngle1(double a1); - double getAngle2() const; - void setAngle2(double a2); - double getDirection1() const; - double getDirection2() const; - bool isReversed() const; - void setReversed(bool r); - virtual Vector getStartpoint() const; - virtual Vector getEndpoint() const; - virtual void moveStartpoint(const Vector & pos); - virtual void moveEndpoint(const Vector & pos); - virtual void trimStartpoint(const Vector & pos); - virtual void trimEndpoint(const Vector & pos); - virtual RS2::Ending getTrimPoint(const Vector & coord, const Vector & trimPoint); - virtual void reverse(); - Vector getMiddlepoint() const; - double getAngleLength() const; - virtual double getLength(); - double getBulge() const; - - bool createFrom3P(const Vector & p1, const Vector & p2, const Vector & p3); - bool createFrom2PDirectionRadius(const Vector & startPoint, const Vector & endPoint, double direction1, double radius); - bool createFrom2PBulge(const Vector & startPoint, const Vector & endPoint, double bulge); - - virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL); - virtual Vector getNearestPointOnEntity(const Vector & coord, bool onEntity = true, double * dist = NULL, Entity ** entity = NULL); - virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL); - virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL); - virtual Vector getNearestDist(double distance, const Vector & coord, double * dist = NULL); - virtual Vector getNearestDist(double distance, bool startp); - - virtual double getDistanceToPoint(const Vector & coord, Entity * * entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE); - 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); - virtual void moveRef(const Vector & ref, const Vector & offset); - virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset); - - virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0); - - friend std::ostream & operator<<(std::ostream & os, const Arc & a); - - virtual void calculateEndpoints(); - virtual void calculateBorders(); - - protected: - ArcData data; - - /** - * Startpoint. This is redundant but stored for performance - * reasons. - */ - Vector startpoint; - /** - * Endpoint. This is redundant but stored for performance - * reasons. - */ - Vector endpoint; -}; - -#endif // __ARC_H__