-class RS_Arc : public RS_AtomicEntity {
-public:
- RS_Arc(RS_EntityContainer* parent,
- const RS_ArcData& d);
- virtual ~RS_Arc() {}
-
- virtual RS_Entity* clone() {
- RS_Arc* a = new RS_Arc(*this);
- a->initId();
- return a;
- }
-
- /** @return RS2::EntityArc */
- virtual RS2::EntityType rtti() const {
- return RS2::EntityArc;
- }
- /** @return true */
- virtual bool isEdge() const {
- return true;
- }
-
- /** @return Copy of data that defines the arc. **/
- RS_ArcData getData() const {
- return data;
- }
-
- virtual VectorSolutions getRefPoints();
-
- /** Sets new arc parameters. **/
- void setData(RS_ArcData d) {
- data = d;
- }
-
- /** @return The center point (x) of this arc */
- Vector getCenter() const {
- return data.center;
- }
- /** Sets new center. */
- void setCenter(const Vector& c) {
- data.center = c;
- }
-
- /** @return The radius of this arc */
- double getRadius() const {
- return data.radius;
- }
- /** Sets new radius. */
- void setRadius(double r) {
- data.radius = r;
- }
-
- /** @return The start angle of this arc */
- double getAngle1() const {
- return data.angle1;
- }
- /** Sets new start angle. */
- void setAngle1(double a1) {
- data.angle1 = a1;
- }
- /** @return The end angle of this arc */
- double getAngle2() const {
- return data.angle2;
- }
- /** Sets new end angle. */
- void setAngle2(double a2) {
- data.angle2 = a2;
- }
- /**
- * @return Direction 1. The angle at which the arc starts at
- * the startpoint.
- */
- double getDirection1() const {
- if (!data.reversed) {
- return RS_Math::correctAngle(data.angle1+M_PI/2.0);
- }
- else {
- return RS_Math::correctAngle(data.angle1-M_PI/2.0);
- }
- }
- /**
- * @return Direction 2. The angle at which the arc starts at
- * the endpoint.
- */
- double getDirection2() const {
- if (!data.reversed) {
- return RS_Math::correctAngle(data.angle2-M_PI/2.0);
- }
- else {
- return RS_Math::correctAngle(data.angle2+M_PI/2.0);
- }
- }
-
- /**
- * @retval true if the arc is reversed (clockwise),
- * @retval false otherwise
- */
- bool isReversed() const {
- return data.reversed;
- }
- /** sets the reversed status. */
- void setReversed(bool r) {
- data.reversed = r;
- }
-
- /** @return Start point of the entity. */
- virtual Vector getStartpoint() const {
- return startpoint;
- }
- /** @return End point of the entity. */
- virtual Vector getEndpoint() const {
- return endpoint;
- }
- 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, RS_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,
- RS_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(RS_Painter* painter, RS_GraphicView* view, double patternOffset=0.0);
- virtual void draw(PaintInterface * painter, RS_GraphicView * view, double patternOffset = 0.0);
-
- friend std::ostream & operator<<(std::ostream & os, const RS_Arc & a);
-
- virtual void calculateEndpoints();
- virtual void calculateBorders();
-
-protected:
- RS_ArcData data;
-
- /**
- * Startpoint. This is redundant but stored for performance
- * reasons.
- */
- Vector startpoint;
- /**
- * Endpoint. This is redundant but stored for performance
- * reasons.
- */
- Vector endpoint;
+class RS_Arc: public RS_AtomicEntity
+{
+ public:
+ RS_Arc(RS_EntityContainer * parent, const RS_ArcData & d);
+ virtual ~RS_Arc();
+
+ virtual RS_Entity * clone();
+ virtual RS2::EntityType rtti() const;
+ virtual bool isEdge() const;
+ RS_ArcData getData() const;
+ virtual VectorSolutions getRefPoints();
+ void setData(RS_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, RS_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, RS_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 RS_Arc & a);
+
+ virtual void calculateEndpoints();
+ virtual void calculateBorders();
+
+ protected:
+ RS_ArcData data;
+
+ /**
+ * Startpoint. This is redundant but stored for performance
+ * reasons.
+ */
+ Vector startpoint;
+ /**
+ * Endpoint. This is redundant but stored for performance
+ * reasons.
+ */
+ Vector endpoint;