// 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>
//
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;
dimensionLine->setLayer(NULL);
addEntity(dimensionLine);
- if (outsideArrows == false)
+ if (!outsideArrows)
{
arrowAngle1 = dimensionLine->getAngle2();
arrowAngle2 = dimensionLine->getAngle1();
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;
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);
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);
}