From acc7686b8349def65492d5c623078b2004a7bef8 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Sat, 23 Nov 2019 14:14:06 -0500 Subject: [PATCH] [TD]Section Line position --- src/Mod/TechDraw/App/DrawViewPart.cpp | 9 ++++----- src/Mod/TechDraw/App/DrawViewPart.h | 3 ++- src/Mod/TechDraw/Gui/QGIViewPart.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawViewPart.cpp b/src/Mod/TechDraw/App/DrawViewPart.cpp index 54bcf89013..c9d80a7ff7 100644 --- a/src/Mod/TechDraw/App/DrawViewPart.cpp +++ b/src/Mod/TechDraw/App/DrawViewPart.cpp @@ -328,6 +328,7 @@ GeometryObject* DrawViewPart::makeGeometryForShape(TopoDS_Shape shape) //center shape on origin TopoDS_Shape centeredShape = TechDraw::moveShape(shape, centroid * -1.0); + m_saveCentroid = centroid; m_saveShape = centeredShape; TopoDS_Shape scaledShape = TechDraw::scaleShape(centeredShape, @@ -792,12 +793,10 @@ gp_Ax2 DrawViewPart::getViewAxis(const Base::Vector3d& pt, } //TODO: make saveShape a property -Base::Vector3d DrawViewPart::getCentroid(void) const + +Base::Vector3d DrawViewPart::getOriginalCentroid(void) const { - Base::Vector3d stdOrg(0.0,0.0,0.0); - Base::Vector3d centroid = TechDraw::findCentroidVec(m_saveShape, - getProjectionCS(stdOrg)); - return centroid; + return m_saveCentroid; } std::vector DrawViewPart::getSectionRefs(void) const diff --git a/src/Mod/TechDraw/App/DrawViewPart.h b/src/Mod/TechDraw/App/DrawViewPart.h index 9f965e826e..e5b4ed7fa7 100644 --- a/src/Mod/TechDraw/App/DrawViewPart.h +++ b/src/Mod/TechDraw/App/DrawViewPart.h @@ -155,7 +155,7 @@ public: const bool flip=true) const; virtual gp_Ax2 getProjectionCS(Base::Vector3d pt) const; virtual Base::Vector3d getXDirection(void) const; //don't use XDirection.getValue() - virtual Base::Vector3d getCentroid(void) const; + virtual Base::Vector3d getOriginalCentroid(void) const; virtual Base::Vector3d getLegacyX(const Base::Vector3d& pt, const Base::Vector3d& axis, const bool flip = true) const; @@ -247,6 +247,7 @@ protected: bool m_handleFaces; TopoDS_Shape m_saveShape; //TODO: make this a Property. Part::TopoShapeProperty?? + Base::Vector3d m_saveCentroid; //centroid before centering shape in origin private: bool nowUnsetting; diff --git a/src/Mod/TechDraw/Gui/QGIViewPart.cpp b/src/Mod/TechDraw/Gui/QGIViewPart.cpp index 23fa425af8..d994586f65 100644 --- a/src/Mod/TechDraw/Gui/QGIViewPart.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewPart.cpp @@ -781,9 +781,9 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b //dvp is centered on centroid looking along dvp direction //dvs is centered on SO looking along section normal - //need to subtract SO from centroid to get displacement + //dvp view origin is 000 + centroid Base::Vector3d org = viewSection->SectionOrigin.getValue(); - Base::Vector3d cent = viewPart->getCentroid(); + Base::Vector3d cent = viewPart->getOriginalCentroid(); Base::Vector3d adjOrg = org - cent; double scale = viewPart->getScale(); @@ -794,7 +794,7 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b displace.ProjectToLine(pAdjOrg, arrowDir); Base::Vector3d offset = pAdjOrg + displace; -// makeMark(0.0, 0.0); +// makeMark(0.0, 0.0); //red sectionLine->setPos(Rez::guiX(offset.x),Rez::guiX(offset.y)); double sectionSpan;