TechDraw: fix extension lines of projected dimension
This commit is contained in:
committed by
WandererFan
parent
ed87ce0af0
commit
2d27b84686
@@ -41,6 +41,14 @@ pointPair::pointPair(const pointPair& pp)
|
||||
{
|
||||
first(pp.first());
|
||||
second(pp.second());
|
||||
overrideFirst(pp.extensionLineFirst());
|
||||
overrideSecond(pp.extensionLineSecond());
|
||||
}
|
||||
|
||||
// set extension line points from argument base points
|
||||
void pointPair::setExtensionLine(const pointPair& pp){
|
||||
overrideFirst(pp.first());
|
||||
overrideSecond(pp.second());
|
||||
}
|
||||
|
||||
//move the points by offset
|
||||
@@ -48,6 +56,8 @@ void pointPair::move(const Base::Vector3d& offset)
|
||||
{
|
||||
m_first = m_first - offset;
|
||||
m_second = m_second - offset;
|
||||
m_overrideFirst = m_overrideFirst - offset;
|
||||
m_overrideSecond = m_overrideSecond - offset;
|
||||
}
|
||||
|
||||
// project the points onto the dvp's paper plane.
|
||||
@@ -55,6 +65,8 @@ void pointPair::project(const DrawViewPart* dvp)
|
||||
{
|
||||
m_first = dvp->projectPoint(m_first) * dvp->getScale();
|
||||
m_second = dvp->projectPoint(m_second) * dvp->getScale();
|
||||
m_overrideFirst = dvp->projectPoint(m_overrideFirst) * dvp->getScale();
|
||||
m_overrideSecond = dvp->projectPoint(m_overrideSecond) * dvp->getScale();
|
||||
}
|
||||
|
||||
// map the points onto the dvp's XY coordinate system
|
||||
|
||||
@@ -38,12 +38,26 @@ class TechDrawExport pointPair
|
||||
{
|
||||
public:
|
||||
pointPair() = default;
|
||||
pointPair(const Base::Vector3d& point0, const Base::Vector3d& point1) { m_first = point0; m_second = point1; }
|
||||
pointPair(const Base::Vector3d& point0, const Base::Vector3d& point1)
|
||||
: m_first(point0)
|
||||
, m_second(point1){};
|
||||
|
||||
pointPair(const Base::Vector3d& point0, const Base::Vector3d& point1,
|
||||
const Base::Vector3d& extensionPoint0, const Base::Vector3d& extensionPoint1)
|
||||
: m_first(point0)
|
||||
, m_second(point1)
|
||||
, m_useOverrideFirst(true)
|
||||
, m_overrideFirst(extensionPoint0)
|
||||
, m_useOverrideSecond(true)
|
||||
, m_overrideSecond(extensionPoint1){};
|
||||
|
||||
pointPair(const pointPair& pp);
|
||||
|
||||
pointPair& operator=(const pointPair& pp) {
|
||||
m_first = pp.first();
|
||||
m_second = pp.second();
|
||||
overrideFirst(pp.extensionLineFirst());
|
||||
overrideSecond(pp.extensionLineSecond());
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -51,6 +65,12 @@ public:
|
||||
void first(Base::Vector3d newFirst) { m_first = newFirst; }
|
||||
Base::Vector3d second() const { return m_second; }
|
||||
void second(Base::Vector3d newSecond) { m_second = newSecond; }
|
||||
// extension line specific points
|
||||
Base::Vector3d extensionLineFirst() const { return m_useOverrideFirst ? m_overrideFirst : m_first; }
|
||||
void overrideFirst(Base::Vector3d newFirst) { m_useOverrideFirst = true; m_overrideFirst = newFirst; }
|
||||
Base::Vector3d extensionLineSecond() const { return m_useOverrideSecond ? m_overrideSecond : m_second; }
|
||||
void overrideSecond(Base::Vector3d newSecond) { m_useOverrideSecond = true; m_overrideSecond = newSecond; }
|
||||
void setExtensionLine(const pointPair& pp);
|
||||
|
||||
void move(const Base::Vector3d& offset);
|
||||
void project(const DrawViewPart* dvp);
|
||||
@@ -61,6 +81,11 @@ public:
|
||||
private:
|
||||
Base::Vector3d m_first;
|
||||
Base::Vector3d m_second;
|
||||
// extension line specific points
|
||||
bool m_useOverrideFirst = false;
|
||||
Base::Vector3d m_overrideFirst;
|
||||
bool m_useOverrideSecond = false;
|
||||
Base::Vector3d m_overrideSecond;
|
||||
};
|
||||
|
||||
//a convenient container for angular dimension points
|
||||
|
||||
@@ -766,7 +766,9 @@ pointPair DrawViewDimension::getPointsEdgeVert(ReferenceVector references)
|
||||
auto p2 = Base::Vector3d(projector.NearestPoint().X()
|
||||
, projector.NearestPoint().Y()
|
||||
, 0.0);
|
||||
return pointPair(p1, p2);
|
||||
pointPair result = pointPair(p1, p2);
|
||||
result.setExtensionLine(closestPoints(edge->getOCCEdge(), vertex->getOCCVertex()));
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
// unable to project
|
||||
|
||||
@@ -2112,7 +2112,7 @@ void QGIViewDimension::drawDistance(TechDraw::DrawViewDimension* dimension,
|
||||
dimension->ExtensionAngle.getValue() * M_PI / 180.0);
|
||||
}
|
||||
else {
|
||||
drawDistanceExecutive(fromQtApp(linePoints.first()), fromQtApp(linePoints.second()),
|
||||
drawDistanceExecutive(fromQtApp(linePoints.extensionLineFirst()), fromQtApp(linePoints.extensionLineSecond()),
|
||||
lineAngle, labelRectangle, standardStyle, renderExtent, flipArrows);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user