X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Fdimaligned.cpp;h=c25ea9fdadacc4ca2020ebb854329c3c91a78062;hb=2ee84c5948ede7fc2f7b4435c5edef42a030ac05;hp=cc9fc237983ffcfeff0d05ca3fb32b8a5bcf4229;hpb=3239ef39dcee08fa6e8cd68cdf2727fc68cc7a8c;p=architektonas diff --git a/src/base/dimaligned.cpp b/src/base/dimaligned.cpp index cc9fc23..c25ea9f 100644 --- a/src/base/dimaligned.cpp +++ b/src/base/dimaligned.cpp @@ -27,19 +27,19 @@ * @para d Common dimension geometrical data. * @para ed Extended geometrical data for aligned dimension. */ -RS_DimAligned::RS_DimAligned(RS_EntityContainer * parent, const RS_DimensionData & d, - const RS_DimAlignedData & ed): RS_Dimension(parent, d), edata(ed) +DimAligned::DimAligned(EntityContainer * parent, const DimensionData & d, + const DimAlignedData & ed): Dimension(parent, d), edata(ed) { calculateBorders(); } -/*virtual*/ RS_DimAligned::~RS_DimAligned() +/*virtual*/ DimAligned::~DimAligned() { } -/*virtual*/ RS_Entity * RS_DimAligned::clone() +/*virtual*/ Entity * DimAligned::clone() { - RS_DimAligned * d = new RS_DimAligned(*this); + DimAligned * d = new DimAligned(*this); #warning "!!! Need to port setAutoDelete in QList/QMultiHash from Qt3 to Qt4 !!!" // d->entities.setAutoDelete(entities.autoDelete()); d->initId(); @@ -48,7 +48,7 @@ RS_DimAligned::RS_DimAligned(RS_EntityContainer * parent, const RS_DimensionData } /** @return RS2::EntityDimAligned */ -/*virtual*/ RS2::EntityType RS_DimAligned::rtti() const +/*virtual*/ RS2::EntityType DimAligned::rtti() const { return RS2::EntityDimAligned; } @@ -57,7 +57,7 @@ RS_DimAligned::RS_DimAligned(RS_EntityContainer * parent, const RS_DimensionData * @return Copy of data that defines the aligned dimension. * @see getData() */ -RS_DimAlignedData RS_DimAligned::getEData() const +DimAlignedData DimAligned::getEData() const { return edata; } @@ -66,12 +66,12 @@ RS_DimAlignedData RS_DimAligned::getEData() const * Sets a new text. The entities representing the * text are updated. */ -//void RS_DimAligned::setText(const QString& t) { +//void DimAligned::setText(const QString& t) { // data.text = t; // update(); //} -VectorSolutions RS_DimAligned::getRefPoints() +VectorSolutions DimAligned::getRefPoints() { VectorSolutions ret(edata.extensionPoint1, edata.extensionPoint2, data.definitionPoint, data.middleOfText); @@ -82,7 +82,7 @@ VectorSolutions RS_DimAligned::getRefPoints() * @return Automatically creted label for the default * measurement of this dimension. */ -QString RS_DimAligned::getMeasuredLabel() +QString DimAligned::getMeasuredLabel() { double dist = edata.extensionPoint1.distanceTo(edata.extensionPoint2); Drawing * graphic = getGraphic(); @@ -90,7 +90,7 @@ QString RS_DimAligned::getMeasuredLabel() if (graphic != NULL) { - ret = RS_Units::formatLinear(dist, graphic->getUnit(), + ret = Units::formatLinear(dist, graphic->getUnit(), graphic->getLinearFormat(), graphic->getLinearPrecision()); } else @@ -107,9 +107,9 @@ QString RS_DimAligned::getMeasuredLabel() * * @param autoText Automatically reposition the text label */ -void RS_DimAligned::update(bool autoText) +void DimAligned::update(bool autoText) { - RS_DEBUG->print("RS_DimAligned::update"); + DEBUG->print("DimAligned::update"); clear(); @@ -131,28 +131,28 @@ void RS_DimAligned::update(bool autoText) double extLength = edata.extensionPoint2.distanceTo(data.definitionPoint); Vector v1, v2, e1; - RS_LineData ld; - RS_Line * line; + LineData ld; + Line * line; v1.setPolar(dimexo, extAngle); v2.setPolar(dimexe, extAngle); e1.setPolar(1.0, extAngle); // Extension line 1: - ld = RS_LineData(edata.extensionPoint1 + v1, edata.extensionPoint1 + e1 * extLength + v2); - line = new RS_Line(this, ld); + ld = LineData(edata.extensionPoint1 + v1, edata.extensionPoint1 + e1 * extLength + v2); + line = new Line(this, ld); //line->setLayerToActive(); //line->setPenToActive(); - line->setPen(RS_Pen(RS2::FlagInvalid)); + line->setPen(Pen(RS2::FlagInvalid)); line->setLayer(NULL); addEntity(line); // Extension line 2: - ld = RS_LineData(edata.extensionPoint2 + v1, edata.extensionPoint2 + e1 * extLength + v2); - line = new RS_Line(this, ld); + ld = LineData(edata.extensionPoint2 + v1, edata.extensionPoint2 + e1 * extLength + v2); + line = new Line(this, ld); //line->setLayerToActive(); //line->setPenToActive(); - line->setPen(RS_Pen(RS2::FlagInvalid)); + line->setPen(Pen(RS2::FlagInvalid)); line->setLayer(NULL); addEntity(line); @@ -163,59 +163,59 @@ void RS_DimAligned::update(bool autoText) calculateBorders(); } -Vector RS_DimAligned::getExtensionPoint1() +Vector DimAligned::getExtensionPoint1() { return edata.extensionPoint1; } -Vector RS_DimAligned::getExtensionPoint2() +Vector DimAligned::getExtensionPoint2() { return edata.extensionPoint2; } -bool RS_DimAligned::hasEndpointsWithinWindow(Vector v1, Vector v2) +bool DimAligned::hasEndpointsWithinWindow(Vector v1, Vector v2) { return (edata.extensionPoint1.isInWindow(v1, v2) || edata.extensionPoint2.isInWindow(v1, v2)); } -void RS_DimAligned::move(Vector offset) +void DimAligned::move(Vector offset) { - RS_Dimension::move(offset); + Dimension::move(offset); edata.extensionPoint1.move(offset); edata.extensionPoint2.move(offset); update(); } -void RS_DimAligned::rotate(Vector center, double angle) +void DimAligned::rotate(Vector center, double angle) { - RS_Dimension::rotate(center, angle); + Dimension::rotate(center, angle); edata.extensionPoint1.rotate(center, angle); edata.extensionPoint2.rotate(center, angle); update(); } -void RS_DimAligned::scale(Vector center, Vector factor) +void DimAligned::scale(Vector center, Vector factor) { - RS_Dimension::scale(center, factor); + Dimension::scale(center, factor); edata.extensionPoint1.scale(center, factor); edata.extensionPoint2.scale(center, factor); update(); } -void RS_DimAligned::mirror(Vector axisPoint1, Vector axisPoint2) +void DimAligned::mirror(Vector axisPoint1, Vector axisPoint2) { - RS_Dimension::mirror(axisPoint1, axisPoint2); + Dimension::mirror(axisPoint1, axisPoint2); edata.extensionPoint1.mirror(axisPoint1, axisPoint2); edata.extensionPoint2.mirror(axisPoint1, axisPoint2); update(); } -void RS_DimAligned::stretch(Vector firstCorner, Vector secondCorner, Vector offset) +void DimAligned::stretch(Vector firstCorner, Vector secondCorner, Vector offset) { //e->calculateBorders(); if (getMin().isInWindow(firstCorner, secondCorner) && getMax().isInWindow(firstCorner, secondCorner)) @@ -240,7 +240,7 @@ void RS_DimAligned::stretch(Vector firstCorner, Vector secondCorner, Vector offs double ang2 = edata.extensionPoint1.angleTo(edata.extensionPoint2) + M_PI / 2; - double diff = RS_Math::getAngleDifference(ang1, ang2); + double diff = Math::getAngleDifference(ang1, ang2); if (diff > M_PI) { @@ -249,7 +249,7 @@ void RS_DimAligned::stretch(Vector firstCorner, Vector secondCorner, Vector offs if (fabs(diff) > M_PI / 2) { - ang2 = RS_Math::correctAngle(ang2 + M_PI); + ang2 = Math::correctAngle(ang2 + M_PI); } Vector v; @@ -260,20 +260,20 @@ void RS_DimAligned::stretch(Vector firstCorner, Vector secondCorner, Vector offs update(true); } -void RS_DimAligned::moveRef(const Vector & ref, const Vector & offset) +void DimAligned::moveRef(const Vector & ref, const Vector & offset) { if (ref.distanceTo(data.definitionPoint) < 1.0e-4) { - RS_ConstructionLine l(NULL, RS_ConstructionLineData(edata.extensionPoint1, + ConstructionLine l(NULL, ConstructionLineData(edata.extensionPoint1, edata.extensionPoint2)); double d = l.getDistanceToPoint(data.definitionPoint + offset); double a = edata.extensionPoint2.angleTo(data.definitionPoint); - double ad = RS_Math::getAngleDifference(a, + double ad = Math::getAngleDifference(a, edata.extensionPoint2.angleTo(data.definitionPoint + offset)); if (fabs(ad) > M_PI / 2.0 && fabs(ad) < 3.0 / 2.0 * M_PI) { - a = RS_Math::correctAngle(a + M_PI); + a = Math::correctAngle(a + M_PI); } Vector v; @@ -321,7 +321,7 @@ void RS_DimAligned::moveRef(const Vector & ref, const Vector & offset) /** * Dumps the point's data to stdout. */ -std::ostream & operator<<(std::ostream & os, const RS_DimAligned & d) +std::ostream & operator<<(std::ostream & os, const DimAligned & d) { os << " DimAligned: " << d.getData() << "\n" << d.getEData() << "\n"; return os;