X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Fcircle.cpp;fp=src%2Fbase%2Fcircle.cpp;h=9162a5ae50eba88a9d193294639b1d13cd96f75e;hb=16354e0421b316a62c6b9f7b0b4f3b8cf6f06284;hp=dc66e348395b4cbbee1b12351d4e274d8e839b21;hpb=3239ef39dcee08fa6e8cd68cdf2727fc68cc7a8c;p=architektonas diff --git a/src/base/circle.cpp b/src/base/circle.cpp index dc66e34..9162a5a 100644 --- a/src/base/circle.cpp +++ b/src/base/circle.cpp @@ -26,42 +26,42 @@ /** * Default constructor. */ -RS_Circle::RS_Circle(RS_EntityContainer * parent, const RS_CircleData & d): - RS_AtomicEntity(parent), data(d) +Circle::Circle(EntityContainer * parent, const CircleData & d): + AtomicEntity(parent), data(d) { calculateBorders(); } -/*virtual*/ RS_Circle::~RS_Circle() +/*virtual*/ Circle::~Circle() { } -/*virtual*/ RS_Entity * RS_Circle::clone() +/*virtual*/ Entity * Circle::clone() { - RS_Circle * c = new RS_Circle(*this); + Circle * c = new Circle(*this); c->initId(); return c; } /** @return RS2::EntityCircle */ -/*virtual*/ RS2::EntityType RS_Circle::rtti() const +/*virtual*/ RS2::EntityType Circle::rtti() const { return RS2::EntityCircle; } /** @return true */ -/*virtual*/ bool RS_Circle::isEdge() const +/*virtual*/ bool Circle::isEdge() const { return true; } /** @return Copy of data that defines the circle. **/ -RS_CircleData RS_Circle::getData() +CircleData Circle::getData() { return data; } -VectorSolutions RS_Circle::getRefPoints() +VectorSolutions Circle::getRefPoints() { Vector v1(data.radius, 0.0); Vector v2(0.0, data.radius); @@ -70,12 +70,12 @@ VectorSolutions RS_Circle::getRefPoints() return ret; } -/*virtual*/ Vector RS_Circle::getStartpoint() const +/*virtual*/ Vector Circle::getStartpoint() const { return data.center + Vector(data.radius, 0.0); } -/*virtual*/ Vector RS_Circle::getEndpoint() const +/*virtual*/ Vector Circle::getEndpoint() const { return data.center + Vector(data.radius, 0.0); } @@ -84,7 +84,7 @@ VectorSolutions RS_Circle::getRefPoints() * @return Direction 1. The angle at which the arc starts at * the startpoint. */ -double RS_Circle::getDirection1() const +double Circle::getDirection1() const { return M_PI / 2.0; } @@ -93,36 +93,36 @@ double RS_Circle::getDirection1() const * @return Direction 2. The angle at which the arc starts at * the endpoint. */ -double RS_Circle::getDirection2() const +double Circle::getDirection2() const { return M_PI / 2.0 * 3.0; } /** @return The center point (x) of this arc */ -Vector RS_Circle::getCenter() +Vector Circle::getCenter() { return data.center; } /** Sets new center. */ -void RS_Circle::setCenter(const Vector & c) +void Circle::setCenter(const Vector & c) { data.center = c; } /** @return The radius of this arc */ -double RS_Circle::getRadius() +double Circle::getRadius() { return data.radius; } /** Sets new radius. */ -void RS_Circle::setRadius(double r) +void Circle::setRadius(double r) { data.radius = r; } -void RS_Circle::calculateBorders() +void Circle::calculateBorders() { Vector r(data.radius, data.radius, 0.0); minV = data.center - r; @@ -132,7 +132,7 @@ void RS_Circle::calculateBorders() /** * @return Angle length in rad. */ -double RS_Circle::getAngleLength() const +double Circle::getAngleLength() const { return 2 * M_PI; } @@ -140,7 +140,7 @@ double RS_Circle::getAngleLength() const /** * @return Length of the circle which is the circumference. */ -double RS_Circle::getLength() +double Circle::getLength() { return 2 * M_PI * data.radius; } @@ -151,7 +151,7 @@ double RS_Circle::getLength() * @param c Center. * @param r Radius */ -bool RS_Circle::createFromCR(const Vector & c, double r) +bool Circle::createFromCR(const Vector & c, double r) { if (fabs(r) > RS_TOLERANCE) { @@ -161,7 +161,7 @@ bool RS_Circle::createFromCR(const Vector & c, double r) } else { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Circle::createFromCR(): " + DEBUG->print(Debug::D_WARNING, "Circle::createFromCR(): " "Cannot create a circle with radius 0.0."); return false; } @@ -173,7 +173,7 @@ bool RS_Circle::createFromCR(const Vector & c, double r) * @param p1 1st point. * @param p2 2nd point. */ -bool RS_Circle::createFrom2P(const Vector & p1, const Vector & p2) +bool Circle::createFrom2P(const Vector & p1, const Vector & p2) { if (p1.distanceTo(p2) > RS_TOLERANCE) { @@ -183,7 +183,7 @@ bool RS_Circle::createFrom2P(const Vector & p1, const Vector & p2) } else { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Circle::createFrom2P(): " + DEBUG->print(Debug::D_WARNING, "Circle::createFrom2P(): " "Cannot create a circle with radius 0.0."); return false; } @@ -196,7 +196,7 @@ bool RS_Circle::createFrom2P(const Vector & p1, const Vector & p2) * @param p2 2nd point. * @param p3 3rd point. */ -bool RS_Circle::createFrom3P(const Vector & p1, const Vector & p2, const Vector & p3) +bool Circle::createFrom3P(const Vector & p1, const Vector & p2, const Vector & p3) { if (p1.distanceTo(p2) > RS_TOLERANCE && p2.distanceTo(p3) > RS_TOLERANCE @@ -215,13 +215,13 @@ bool RS_Circle::createFrom3P(const Vector & p1, const Vector & p2, const Vector a2 = p2.angleTo(p3) + M_PI / 2.0; dir2.setPolar(100.0, a2); - RS_ConstructionLineData d1(mp1, mp1 + dir1); - RS_ConstructionLineData d2(mp2, mp2 + dir2); - RS_ConstructionLine midLine1(NULL, d1); - RS_ConstructionLine midLine2(NULL, d2); + ConstructionLineData d1(mp1, mp1 + dir1); + ConstructionLineData d2(mp2, mp2 + dir2); + ConstructionLine midLine1(NULL, d1); + ConstructionLine midLine2(NULL, d2); VectorSolutions sol = - RS_Information::getIntersection(&midLine1, &midLine2); + Information::getIntersection(&midLine1, &midLine2); data.center = sol.get(0); data.radius = data.center.distanceTo(p3); @@ -230,14 +230,14 @@ bool RS_Circle::createFrom3P(const Vector & p1, const Vector & p2, const Vector return true; else { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Circle::createFrom3P(): " + DEBUG->print(Debug::D_WARNING, "Circle::createFrom3P(): " "Cannot create a circle with inf radius."); return false; } } else { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Circle::createFrom3P(): " + DEBUG->print(Debug::D_WARNING, "Circle::createFrom3P(): " "Cannot create a circle with radius 0.0."); return false; } @@ -246,14 +246,14 @@ bool RS_Circle::createFrom3P(const Vector & p1, const Vector & p2, const Vector /** * @return Always an invalid vector. */ -Vector RS_Circle::getNearestEndpoint(const Vector & /*coord*/, double * dist) +Vector Circle::getNearestEndpoint(const Vector & /*coord*/, double * dist) { if (dist != NULL) *dist = RS_MAXDOUBLE; return Vector(false); } -Vector RS_Circle::getNearestPointOnEntity(const Vector & coord, bool /*onEntity*/, double * dist, RS_Entity ** entity) +Vector Circle::getNearestPointOnEntity(const Vector & coord, bool /*onEntity*/, double * dist, Entity ** entity) { Vector vec(false); @@ -270,33 +270,33 @@ Vector RS_Circle::getNearestPointOnEntity(const Vector & coord, bool /*onEntity* return vec; } -Vector RS_Circle::getNearestCenter(const Vector & coord, double * dist) +Vector Circle::getNearestCenter(const Vector & coord, double * dist) { if (dist != NULL) *dist = coord.distanceTo(data.center); return data.center; } -Vector RS_Circle::getNearestMiddle(const Vector & /*coord*/, double * dist) +Vector Circle::getNearestMiddle(const Vector & /*coord*/, double * dist) { if (dist != NULL) *dist = RS_MAXDOUBLE; return Vector(false); } -Vector RS_Circle::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist) +Vector Circle::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist) { if (dist != NULL) *dist = RS_MAXDOUBLE; return Vector(false); } -Vector RS_Circle::getNearestDist(double /*distance*/, bool /*startp*/) +Vector Circle::getNearestDist(double /*distance*/, bool /*startp*/) { return Vector(false); } -double RS_Circle::getDistanceToPoint(const Vector & coord, RS_Entity * * entity, RS2::ResolveLevel, double) +double Circle::getDistanceToPoint(const Vector & coord, Entity * * entity, RS2::ResolveLevel, double) { if (entity != NULL) *entity = this; @@ -304,32 +304,32 @@ double RS_Circle::getDistanceToPoint(const Vector & coord, RS_Entity * * entity, return fabs((coord - data.center).magnitude() - data.radius); } -void RS_Circle::move(Vector offset) +void Circle::move(Vector offset) { data.center.move(offset); calculateBorders(); } -void RS_Circle::rotate(Vector center, double angle) +void Circle::rotate(Vector center, double angle) { data.center.rotate(center, angle); calculateBorders(); } -void RS_Circle::scale(Vector center, Vector factor) +void Circle::scale(Vector center, Vector factor) { data.center.scale(center, factor); data.radius *= factor.x; calculateBorders(); } -void RS_Circle::mirror(Vector axisPoint1, Vector axisPoint2) +void Circle::mirror(Vector axisPoint1, Vector axisPoint2) { data.center.mirror(axisPoint1, axisPoint2); calculateBorders(); } -void RS_Circle::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) +void Circle::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) { if (painter == NULL || view == NULL) return; @@ -357,7 +357,7 @@ void RS_Circle::draw(PaintInterface * painter, GraphicView * view, double /*patt } // Pattern: - RS_LineTypePattern * pat; + LineTypePattern * pat; if (isSelected()) pat = &patternSelected; @@ -371,7 +371,7 @@ void RS_Circle::draw(PaintInterface * painter, GraphicView * view, double /*patt return; // Pen to draw pattern is always solid: - RS_Pen pen = painter->getPen(); + Pen pen = painter->getPen(); pen.setLineType(RS2::SolidLine); painter->setPen(pen); @@ -425,7 +425,7 @@ void RS_Circle::draw(PaintInterface * painter, GraphicView * view, double /*patt } } -void RS_Circle::moveRef(const Vector & ref, const Vector & offset) +void Circle::moveRef(const Vector & ref, const Vector & offset) { Vector v1(data.radius, 0.0); Vector v2(0.0, data.radius); @@ -443,9 +443,8 @@ void RS_Circle::moveRef(const Vector & ref, const Vector & offset) /** * Dumps the circle's data to stdout. */ -std::ostream & operator<<(std::ostream & os, const RS_Circle & a) +std::ostream & operator<<(std::ostream & os, const Circle & a) { os << " Circle: " << a.data << "\n"; return os; } -