[TechDraw] Add customizability for dimension line spacing
This commit is contained in:
committed by
WandererFan
parent
ec4a963f57
commit
ddff39dbac
@@ -559,6 +559,40 @@ Multiplier of 'Font Size'</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="font">
|
||||
<font>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Controls the size of spacing between dimension line and dimension text for ISO dimensions.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Line Spacing - ISO</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="2">
|
||||
<widget class="Gui::PrefDoubleSpinBox" name="pdsbLineSpacingFactorISO">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Controls the size of spacing between dimension line and dimension text. Value * linewidth is the line spacing.</p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double></double>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>LineSpacingFactorISO</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/TechDraw/Dimensions</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@@ -849,7 +849,7 @@ Base::Vector2d QGIViewDimension::getIsoRefOutsetPoint(const Base::BoundBox2d& la
|
||||
{
|
||||
return Base::Vector2d(right ? labelRectangle.MinX - getDefaultIsoReferenceLineOverhang()
|
||||
: labelRectangle.MaxX + getDefaultIsoReferenceLineOverhang(),
|
||||
labelRectangle.MinY - getDefaultIsoDimensionLineSpacing());
|
||||
labelRectangle.MinY - getIsoDimensionLineSpacing());
|
||||
}
|
||||
|
||||
Base::Vector2d QGIViewDimension::getIsoRefJointPoint(const Base::BoundBox2d& labelRectangle,
|
||||
@@ -1146,10 +1146,10 @@ bool QGIViewDimension::constructDimensionArc(
|
||||
double borderRadius = (labelRectangle.GetCenter() - arcCenter).Length();
|
||||
|
||||
if (borderRadius > arcRadius) {
|
||||
borderRadius = arcRadius + getDefaultIsoDimensionLineSpacing();
|
||||
borderRadius = arcRadius + getIsoDimensionLineSpacing();
|
||||
}
|
||||
else if (borderRadius < arcRadius) {
|
||||
borderRadius = arcRadius - getDefaultIsoDimensionLineSpacing();
|
||||
borderRadius = arcRadius - getIsoDimensionLineSpacing();
|
||||
}
|
||||
|
||||
// ISO oriented labels are symmetrical along their center axis
|
||||
@@ -1576,7 +1576,7 @@ void QGIViewDimension::drawDistanceExecutive(const Base::Vector2d& startPoint,
|
||||
labelCenter
|
||||
+ Base::Vector2d::FromPolar(
|
||||
placementFactor
|
||||
* (labelRectangle.Height() * 0.5 + getDefaultIsoDimensionLineSpacing()),
|
||||
* (labelRectangle.Height() * 0.5 + getIsoDimensionLineSpacing()),
|
||||
lineAngle + M_PI_2));
|
||||
|
||||
// Compute the dimensional line start and end crossings with (virtual) extension lines
|
||||
@@ -1786,7 +1786,7 @@ void QGIViewDimension::drawDistanceOverride(const Base::Vector2d& startPoint,
|
||||
labelCenter
|
||||
+ Base::Vector2d::FromPolar(
|
||||
placementFactor
|
||||
* (labelRectangle.Height() * 0.5 + getDefaultIsoDimensionLineSpacing()),
|
||||
* (labelRectangle.Height() * 0.5 + getIsoDimensionLineSpacing()),
|
||||
lineAngle + M_PI_2));
|
||||
|
||||
// Compute the dimensional line start and end crossings with (virtual) extension lines
|
||||
@@ -1990,7 +1990,7 @@ void QGIViewDimension::drawRadiusExecutive(const Base::Vector2d& centerPoint,
|
||||
double lineAngle;
|
||||
double devAngle = computeLineAndLabelAngles(centerPoint, labelCenter,
|
||||
labelRectangle.Height() * 0.5
|
||||
+ getDefaultIsoDimensionLineSpacing(),
|
||||
+ getIsoDimensionLineSpacing(),
|
||||
lineAngle, labelAngle);
|
||||
|
||||
// Is there point on the arc, where line from center intersects it perpendicularly?
|
||||
@@ -2014,7 +2014,7 @@ void QGIViewDimension::drawRadiusExecutive(const Base::Vector2d& centerPoint,
|
||||
|
||||
devAngle = computeLineAndLabelAngles(arcPoint, labelCenter,
|
||||
labelRectangle.Height() * 0.5
|
||||
+ getDefaultIsoDimensionLineSpacing(),
|
||||
+ getIsoDimensionLineSpacing(),
|
||||
lineAngle, labelAngle);
|
||||
lineAngle = DrawUtil::angleComposition(lineAngle, M_PI);
|
||||
|
||||
@@ -2239,7 +2239,7 @@ void QGIViewDimension::drawDiameter(TechDraw::DrawViewDimension* dimension,
|
||||
double lineAngle;
|
||||
double devAngle = computeLineAndLabelAngles(curveCenter, labelCenter,
|
||||
labelRectangle.Height() * 0.5
|
||||
+ getDefaultIsoDimensionLineSpacing(),
|
||||
+ getIsoDimensionLineSpacing(),
|
||||
lineAngle, labelAngle);
|
||||
|
||||
// Correct the label center distance projected on the leader line and subtract radius
|
||||
@@ -2437,7 +2437,7 @@ void QGIViewDimension::drawAngle(TechDraw::DrawViewDimension* dimension,
|
||||
|
||||
arcRadius = labelDirection.Length()
|
||||
- placementFactor
|
||||
* (labelRectangle.Height() * 0.5 + getDefaultIsoDimensionLineSpacing());
|
||||
* (labelRectangle.Height() * 0.5 + getIsoDimensionLineSpacing());
|
||||
if (arcRadius < 0.0) {
|
||||
arcRadius = labelDirection.Length();
|
||||
}
|
||||
@@ -2633,6 +2633,13 @@ double QGIViewDimension::getDefaultIsoDimensionLineSpacing() const
|
||||
return Rez::appX(m_lineWidth * 2.0);
|
||||
}
|
||||
|
||||
// Returns the line spacing for ISO dimension based on the user inputted factor
|
||||
double QGIViewDimension::getIsoDimensionLineSpacing() const
|
||||
{
|
||||
auto vp = static_cast<ViewProviderDimension*>(getViewProvider(getViewObject()));
|
||||
return Rez::appX(m_lineWidth * vp->LineSpacingFactorISO.getValue());
|
||||
}
|
||||
|
||||
double QGIViewDimension::getDefaultIsoReferenceLineOverhang() const
|
||||
{
|
||||
// Not specified directly but seems to be exactly Line Width according to ISO 129-1 Annex A
|
||||
|
||||
@@ -294,6 +294,7 @@ private:
|
||||
double getDefaultExtensionLineOverhang() const;
|
||||
double getDefaultArrowTailLength() const;
|
||||
double getDefaultIsoDimensionLineSpacing() const;
|
||||
double getIsoDimensionLineSpacing() const;
|
||||
double getDefaultIsoReferenceLineOverhang() const;
|
||||
double getDefaultAsmeHorizontalLeaderLength() const;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/***************************************************************************
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2004 Jürgen Riegel <juergen.riegel@web.de> *
|
||||
* Copyright (c) 2012 Luke Parry <l.parry@warwick.ac.uk> *
|
||||
* *
|
||||
@@ -86,6 +86,8 @@ ViewProviderDimension::ViewProviderDimension()
|
||||
"Adjusts the gap between dimension point and extension line");
|
||||
ADD_PROPERTY_TYPE(GapFactorASME, (Preferences::GapASME()), group, App::Prop_None,
|
||||
"Adjusts the gap between dimension point and extension line");
|
||||
ADD_PROPERTY_TYPE(LineSpacingFactorISO, (2.0), group, App::Prop_None,
|
||||
"Adjusts the gap between dimension line and dimension text");
|
||||
|
||||
StackOrder.setValue(ZVALUE::DIMENSION);
|
||||
}
|
||||
@@ -198,7 +200,8 @@ void ViewProviderDimension::onChanged(const App::Property* p)
|
||||
(p == &RenderingExtent) ||
|
||||
(p == &FlipArrowheads) ||
|
||||
(p == &GapFactorASME) ||
|
||||
(p == &GapFactorISO)) {
|
||||
(p == &GapFactorISO) ||
|
||||
p == &LineSpacingFactorISO) {
|
||||
QGIView* qgiv = getQView();
|
||||
if (qgiv) {
|
||||
qgiv->updateView(true);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/***************************************************************************
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2004 Jürgen Riegel <juergen.riegel@web.de> *
|
||||
* Copyright (c) 2012 Luke Parry <l.parry@warwick.ac.uk> *
|
||||
* *
|
||||
@@ -66,6 +66,7 @@ public:
|
||||
|
||||
App::PropertyFloat GapFactorISO;
|
||||
App::PropertyFloat GapFactorASME;
|
||||
App::PropertyFloat LineSpacingFactorISO;
|
||||
|
||||
void attach(App::DocumentObject *) override;
|
||||
bool useNewSelectionModel() const override {return false;}
|
||||
|
||||
Reference in New Issue
Block a user