]> Shamusworld >> Repos - architektonas/blobdiff - src/base/rs_dimension.cpp
Fixed Library Browser...
[architektonas] / src / base / rs_dimension.cpp
index 01097c6c6f443ce8ca1a77b21e1815ed81604015..7537841ecf34b9df975f79aba660ea0c2b818c80 100644 (file)
@@ -3,7 +3,9 @@
 // Part of the Architektonas Project
 // Originally part of QCad Community Edition by Andrew Mustun
 // Extensively rewritten and refactored by James L. Hammons
-// (C) 2010 Underground Software
+// Portions copyright (C) 2001-2003 RibbonSoft
+// Copyright (C) 2010 Underground Software
+// See the README and GPLv2 files for licensing and warranty information
 //
 // JLH = James L. Hammons <jlhamm@acm.org>
 //
@@ -93,17 +95,17 @@ void RS_Dimension::setLabel(const QString & l)
 void RS_Dimension::updateCreateDimensionLine(const Vector & p1,
        const Vector & p2, bool arrow1, bool arrow2, bool forceAutoText)
 {
+#if 0
+printf("RS_Dimension::updateCreateDimensionLine()...\n");
+#endif
        // text height (DIMTXT)
        double dimtxt = getTextHeight();
        // text distance to line (DIMGAP)
        double dimgap = getDimensionLineGap();
-
        // length of dimension line:
        double distance = p1.distanceTo(p2);
-
        // do we have to put the arrows outside of the line?
-       bool outsideArrows = (distance<getArrowSize()*2.5);
-
+       bool outsideArrows = (distance < getArrowSize() * 2.5);
        // arrow angles:
        double arrowAngle1, arrowAngle2;
 
@@ -113,7 +115,7 @@ void RS_Dimension::updateCreateDimensionLine(const Vector & p1,
        dimensionLine->setLayer(NULL);
        addEntity(dimensionLine);
 
-       if (outsideArrows == false)
+       if (!outsideArrows)
        {
                arrowAngle1 = dimensionLine->getAngle2();
                arrowAngle2 = dimensionLine->getAngle1();
@@ -170,19 +172,14 @@ void RS_Dimension::updateCreateDimensionLine(const Vector & p1,
        else
        {
                textPos = dimensionLine->getMiddlepoint();
-
                Vector distV;
 
                // rotate text so it's readable from the bottom or right (ISO)
                // quadrant 1 & 4
                if (corrected)
-               {
                        distV.setPolar(dimgap + dimtxt / 2.0, dimAngle1 - M_PI / 2.0);
-               }
                else
-               {
                        distV.setPolar(dimgap + dimtxt / 2.0, dimAngle1 + M_PI / 2.0);
-               }
 
                // move text away from dimension line:
                textPos += distV;
@@ -193,6 +190,9 @@ void RS_Dimension::updateCreateDimensionLine(const Vector & p1,
 
        textData = RS_TextData(textPos, dimtxt, 30.0, RS2::VAlignMiddle, RS2::HAlignCenter,
                RS2::LeftToRight, RS2::Exact, 1.0, getLabel(), "standard", textAngle);
+#if 0
+printf("--> %s\n", getLabel().toAscii().data());
+#endif
 
        RS_Text * text = new RS_Text(this, textData);
 
@@ -201,8 +201,7 @@ void RS_Dimension::updateCreateDimensionLine(const Vector & p1,
 
        if (text->getUsedTextWidth() > distance)
        {
-               distH.setPolar(text->getUsedTextWidth() / 2.0
-                       + distance / 2.0 + dimgap, textAngle);
+               distH.setPolar(text->getUsedTextWidth() / 2.0 + distance / 2.0 + dimgap, textAngle);
                text->move(distH);
        }