From f5c6269923f8fbb6eeae18c6960a4de62df3cb32 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Mon, 28 Oct 2019 20:04:28 -0400 Subject: [PATCH] [TD]fix const-ness of CS routines --- src/Mod/TechDraw/App/DrawViewSection.cpp | 17 ++++++++--------- src/Mod/TechDraw/App/DrawViewSection.h | 12 ++++++------ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawViewSection.cpp b/src/Mod/TechDraw/App/DrawViewSection.cpp index 6378fb0451..9579d45607 100644 --- a/src/Mod/TechDraw/App/DrawViewSection.cpp +++ b/src/Mod/TechDraw/App/DrawViewSection.cpp @@ -350,9 +350,7 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void) gp_Pln DrawViewSection::getSectionPlane() const { - Base::Vector3d plnPnt = SectionOrigin.getValue(); - Base::Vector3d plnNorm = SectionNormal.getValue(); - gp_Ax2 viewAxis = getViewAxis(plnPnt,plnNorm,false); + gp_Ax2 viewAxis = getSectionCS(); gp_Ax3 viewAxis3(viewAxis); return gp_Pln(viewAxis3); @@ -362,6 +360,7 @@ gp_Pln DrawViewSection::getSectionPlane() const //! tries to find the intersection of the section plane with the shape giving a collection of planar faces TopoDS_Compound DrawViewSection::findSectionPlaneIntersections(const TopoDS_Shape& shape) { +// Base::Console().Message("DVS::findSectionPlaneIntersections()\n"); TopoDS_Compound result; if(shape.IsNull()){ Base::Console().Warning("DrawViewSection::getSectionSurface - Sectional View shape is Empty\n"); @@ -593,14 +592,14 @@ Base::Vector3d DrawViewSection::getSectionVector (const std::string sectionName) } //returns current section cs -gp_Ax2 DrawViewSection::getSectionCS(void) +gp_Ax2 DrawViewSection::getSectionCS(void) const { std::string dirName = SectionDirection.getValueAsString(); return getSectionCS(dirName); } //! calculate the section Projection CS given section direction name -gp_Ax2 DrawViewSection::getSectionCS (const std::string dirName) +gp_Ax2 DrawViewSection::getSectionCS (const std::string dirName) const { Base::Vector3d view = getBaseDVP()->Direction.getValue(); view.Normalize(); @@ -628,7 +627,7 @@ gp_Ax2 DrawViewSection::getSectionCS (const std::string dirName) //TODO: this should be able to handle arbitrary rotation of the CS //TODO: this is useful beyond DVS. move to GO or DU or ??? // or at least static in DVS. doesn't depend on DVS object -gp_Ax2 DrawViewSection::rotateCSCardinal(gp_Ax2 oldCS, int cardinal) +gp_Ax2 DrawViewSection::rotateCSCardinal(gp_Ax2 oldCS, int cardinal) const { // cardinal: 0 - left, 1 - right, 2 - up, 3 - down // as in DVS::SectionDirection @@ -678,7 +677,7 @@ gp_Ax2 DrawViewSection::rotateCSCardinal(gp_Ax2 oldCS, int cardinal) gp_Ax2 DrawViewSection::rotateCSArbitrary(gp_Ax2 oldCS, Base::Vector3d axis, - double degAngle) + double degAngle) const { gp_Ax2 newCS; @@ -716,7 +715,7 @@ void DrawViewSection::unsetupObject() DrawViewPart::unsetupObject(); } -TechDraw::DrawViewPart* DrawViewSection::getBaseDVP() +TechDraw::DrawViewPart* DrawViewSection::getBaseDVP() const { TechDraw::DrawViewPart* baseDVP = nullptr; App::DocumentObject* base = BaseView.getValue(); @@ -728,7 +727,7 @@ TechDraw::DrawViewPart* DrawViewSection::getBaseDVP() return baseDVP; } -TechDraw::DrawProjGroupItem* DrawViewSection::getBaseDPGI() +TechDraw::DrawProjGroupItem* DrawViewSection::getBaseDPGI() const { TechDraw::DrawProjGroupItem* baseDPGI = nullptr; App::DocumentObject* base = BaseView.getValue(); diff --git a/src/Mod/TechDraw/App/DrawViewSection.h b/src/Mod/TechDraw/App/DrawViewSection.h index 11aced372c..501d6241a1 100644 --- a/src/Mod/TechDraw/App/DrawViewSection.h +++ b/src/Mod/TechDraw/App/DrawViewSection.h @@ -89,15 +89,15 @@ public: Base::Vector3d getSectionVector (const std::string sectionName); void setNormalFromBase(const std::string sectionName); - gp_Ax2 rotateCSCardinal(gp_Ax2 oldCS, int cardinal); + gp_Ax2 rotateCSCardinal(gp_Ax2 oldCS, int cardinal) const; gp_Ax2 rotateCSArbitrary(gp_Ax2 oldCS, Base::Vector3d axis, - double degAngle) ; - gp_Ax2 getSectionCS (const std::string dirName); - gp_Ax2 getSectionCS (); + double degAngle) const; + gp_Ax2 getSectionCS(const std::string dirName) const; + gp_Ax2 getSectionCS() const; - TechDraw::DrawViewPart* getBaseDVP(); - TechDraw::DrawProjGroupItem* getBaseDPGI(); + TechDraw::DrawViewPart* getBaseDVP() const; + TechDraw::DrawProjGroupItem* getBaseDPGI() const; virtual void unsetupObject(); virtual std::vector getWireForFace(int idx) const;