]> Shamusworld >> Repos - architektonas/blobdiff - src/base/dimlinear.cpp
Removed unnecessary RS_ prefix from classes and whatnot.
[architektonas] / src / base / dimlinear.cpp
index 9ce80df3a8ec950d789a03d8ffe8e52105be4976..16063aa1fd39fdccefb5b34804cbb6ea647105b9 100644 (file)
  * @para d Common dimension geometrical data.
  * @para ed Extended geometrical data for linear dimension.
  */
-RS_DimLinear::RS_DimLinear(RS_EntityContainer * parent, const RS_DimensionData & d,
-       const RS_DimLinearData & ed): RS_Dimension(parent, d), edata(ed)
+DimLinear::DimLinear(EntityContainer * parent, const DimensionData & d,
+       const DimLinearData & ed): Dimension(parent, d), edata(ed)
 {
     calculateBorders();
 }
 
-/*virtual*/ RS_DimLinear::~RS_DimLinear()
+/*virtual*/ DimLinear::~DimLinear()
 {
 }
 
-/*virtual*/ RS_Entity * RS_DimLinear::clone()
+/*virtual*/ Entity * DimLinear::clone()
 {
-       RS_DimLinear * d = new RS_DimLinear(*this);
+       DimLinear * d = new DimLinear(*this);
 #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
 //     d->entities.setAutoDelete(entities.autoDelete());
        d->initId();
@@ -51,7 +51,7 @@ RS_DimLinear::RS_DimLinear(RS_EntityContainer * parent, const RS_DimensionData &
 }
 
 /**    @return RS2::EntityDimLinear */
-/*virtual*/ RS2::EntityType RS_DimLinear::rtti() const
+/*virtual*/ RS2::EntityType DimLinear::rtti() const
 {
        return RS2::EntityDimLinear;
 }
@@ -60,12 +60,12 @@ RS_DimLinear::RS_DimLinear(RS_EntityContainer * parent, const RS_DimensionData &
  * @return Copy of data that defines the linear dimension.
  * @see getData()
  */
-RS_DimLinearData RS_DimLinear::getEData() const
+DimLinearData DimLinear::getEData() const
 {
        return edata;
 }
 
-VectorSolutions RS_DimLinear::getRefPoints()
+VectorSolutions DimLinear::getRefPoints()
 {
        VectorSolutions ret(edata.extensionPoint1, edata.extensionPoint2,
                data.definitionPoint, data.middleOfText);
@@ -77,14 +77,14 @@ VectorSolutions RS_DimLinear::getRefPoints()
  * @return Automatically created label for the default
  * measurement of this dimension.
  */
-QString RS_DimLinear::getMeasuredLabel()
+QString DimLinear::getMeasuredLabel()
 {
        // direction of dimension line
        Vector dirDim;
        dirDim.setPolar(100.0, edata.angle);
 
        // construction line for dimension line
-       RS_ConstructionLine dimLine(NULL, RS_ConstructionLineData(data.definitionPoint,
+       ConstructionLine dimLine(NULL, ConstructionLineData(data.definitionPoint,
                data.definitionPoint + dirDim));
 
        Vector dimP1 = dimLine.getNearestPointOnEntity(edata.extensionPoint1);
@@ -98,17 +98,17 @@ QString RS_DimLinear::getMeasuredLabel()
        QString ret;
 
        if (graphic)
-               ret = RS_Units::formatLinear(dist, graphic->getUnit(),
+               ret = Units::formatLinear(dist, graphic->getUnit(),
                        graphic->getLinearFormat(), graphic->getLinearPrecision());
        else
                ret = QString("%1").arg(dist);
 //It's properly creating the label...
-//printf("RS_DimLinear::getMeasuredLabel: label=\"%s\"\n", ret.toAscii().data());
+//printf("DimLinear::getMeasuredLabel: label=\"%s\"\n", ret.toAscii().data());
 
        return ret;
 }
 
-bool RS_DimLinear::hasEndpointsWithinWindow(Vector v1, Vector v2)
+bool DimLinear::hasEndpointsWithinWindow(Vector v1, Vector v2)
 {
        return (edata.extensionPoint1.isInWindow(v1, v2)
                || edata.extensionPoint2.isInWindow(v1, v2));
@@ -120,9 +120,9 @@ bool RS_DimLinear::hasEndpointsWithinWindow(Vector v1, Vector v2)
  *
  * @param autoText Automatically reposition the text label
  */
-void RS_DimLinear::update(bool autoText)
+void DimLinear::update(bool autoText)
 {
-       RS_DEBUG->print("RS_DimLinear::update");
+       DEBUG->print("DimLinear::update");
 
        clear();
 
@@ -134,7 +134,7 @@ void RS_DimLinear::update(bool autoText)
        // extension line extension (DIMEXE)
        double dimexe = getExtensionLineExtension();
 
-       RS_LineData ld;
+       LineData ld;
        double extAngle = edata.angle + (M_PI / 2.0);
 
        // direction of dimension line
@@ -145,7 +145,7 @@ void RS_DimLinear::update(bool autoText)
        dirExt.setPolar(100.0, extAngle);
 
        // construction line for dimension line
-       RS_ConstructionLine dimLine(NULL, RS_ConstructionLineData(data.definitionPoint,
+       ConstructionLine dimLine(NULL, ConstructionLineData(data.definitionPoint,
                data.definitionPoint + dirDim));
 
        Vector dimP1 = dimLine.getNearestPointOnEntity(edata.extensionPoint1);
@@ -154,8 +154,8 @@ void RS_DimLinear::update(bool autoText)
        // Definitive dimension line:
        updateCreateDimensionLine(dimP1, dimP2, true, true, autoText);
        /*
-       ld = RS_LineData(data.definitionPoint, dimP1);
-       RS_Line* dimensionLine = new RS_Line(this, ld);
+       ld = LineData(data.definitionPoint, dimP1);
+       Line* dimensionLine = new Line(this, ld);
                addEntity(dimensionLine);
        */
        Vector vDimexo1, vDimexe1, vDimexo2, vDimexe2;
@@ -178,78 +178,78 @@ void RS_DimLinear::update(bool autoText)
        }
 
        // extension lines:
-       ld = RS_LineData(edata.extensionPoint1 + vDimexo1, dimP1 + vDimexe1);
-       RS_Line * line = new RS_Line(this, ld);
-       line->setPen(RS_Pen(RS2::FlagInvalid));
+       ld = LineData(edata.extensionPoint1 + vDimexo1, dimP1 + vDimexe1);
+       Line * line = new Line(this, ld);
+       line->setPen(Pen(RS2::FlagInvalid));
        line->setLayer(NULL);
        addEntity(line);
 
-       ld = RS_LineData(edata.extensionPoint2 + vDimexo2, dimP2 + vDimexe2);
+       ld = LineData(edata.extensionPoint2 + vDimexo2, dimP2 + vDimexe2);
        //data.definitionPoint+vDimexe2);
-       line = new RS_Line(this, ld);
-       line->setPen(RS_Pen(RS2::FlagInvalid));
+       line = new Line(this, ld);
+       line->setPen(Pen(RS2::FlagInvalid));
        line->setLayer(NULL);
        addEntity(line);
 
        calculateBorders();
 }
 
-Vector RS_DimLinear::getExtensionPoint1()
+Vector DimLinear::getExtensionPoint1()
 {
        return edata.extensionPoint1;
 }
 
-Vector RS_DimLinear::getExtensionPoint2()
+Vector DimLinear::getExtensionPoint2()
 {
        return edata.extensionPoint2;
 }
 
-double RS_DimLinear::getAngle()
+double DimLinear::getAngle()
 {
        return edata.angle;
 }
 
-void RS_DimLinear::setAngle(double a)
+void DimLinear::setAngle(double a)
 {
-       edata.angle = RS_Math::correctAngle(a);
+       edata.angle = Math::correctAngle(a);
 }
 
-double RS_DimLinear::getOblique()
+double DimLinear::getOblique()
 {
        return edata.oblique;
 }
 
-void RS_DimLinear::move(Vector offset)
+void DimLinear::move(Vector offset)
 {
-       RS_Dimension::move(offset);
+       Dimension::move(offset);
 
        edata.extensionPoint1.move(offset);
        edata.extensionPoint2.move(offset);
        update();
 }
 
-void RS_DimLinear::rotate(Vector center, double angle)
+void DimLinear::rotate(Vector center, double angle)
 {
-       RS_Dimension::rotate(center, angle);
+       Dimension::rotate(center, angle);
 
        edata.extensionPoint1.rotate(center, angle);
        edata.extensionPoint2.rotate(center, angle);
-       edata.angle = RS_Math::correctAngle(edata.angle+angle);
+       edata.angle = Math::correctAngle(edata.angle+angle);
        update();
 }
 
-void RS_DimLinear::scale(Vector center, Vector factor)
+void DimLinear::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_DimLinear::mirror(Vector axisPoint1, Vector axisPoint2)
+void DimLinear::mirror(Vector axisPoint1, Vector axisPoint2)
 {
-       RS_Dimension::mirror(axisPoint1, axisPoint2);
+       Dimension::mirror(axisPoint1, axisPoint2);
 
        edata.extensionPoint1.mirror(axisPoint1, axisPoint2);
        edata.extensionPoint2.mirror(axisPoint1, axisPoint2);
@@ -262,7 +262,7 @@ void RS_DimLinear::mirror(Vector axisPoint1, Vector axisPoint2)
        update();
 }
 
-void RS_DimLinear::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
+void DimLinear::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
 {
        //e->calculateBorders();
        if (getMin().isInWindow(firstCorner, secondCorner)
@@ -287,13 +287,13 @@ void RS_DimLinear::stretch(Vector firstCorner, Vector secondCorner, Vector offse
                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) {
                        diff-=2*M_PI;
                }
 
                if (fabs(diff)>M_PI/2) {
-                       ang2 = RS_Math::correctAngle(ang2+M_PI);
+                       ang2 = Math::correctAngle(ang2+M_PI);
                }
 
                Vector v;
@@ -305,7 +305,7 @@ void RS_DimLinear::stretch(Vector firstCorner, Vector secondCorner, Vector offse
        update(true);
 }
 
-void RS_DimLinear::moveRef(const Vector & ref, const Vector & offset)
+void DimLinear::moveRef(const Vector & ref, const Vector & offset)
 {
        if (ref.distanceTo(data.definitionPoint) < 1.0e-4)
        {
@@ -332,7 +332,7 @@ void RS_DimLinear::moveRef(const Vector & ref, const Vector & offset)
 /**
  * Dumps the point's data to stdout.
  */
-std::ostream & operator<<(std::ostream & os, const RS_DimLinear & d)
+std::ostream & operator<<(std::ostream & os, const DimLinear & d)
 {
     os << " DimLinear: " << d.getData() << "\n" << d.getEData() << "\n";
     return os;