Merge pull request #20050 from captain0xff/gp_pnt-conversion

TechDraw: removed gp_* conversion code from TechDraw workbench
This commit is contained in:
Chris Hennes
2025-03-11 02:28:37 +00:00
committed by GitHub
17 changed files with 158 additions and 151 deletions

View File

@@ -68,6 +68,7 @@
#include <App/Document.h>
#include <Base/BoundBox.h>
#include <Base/Console.h>
#include <Base/Converter.h>
#include <Base/Exception.h>
#include <Base/Parameter.h>
@@ -312,7 +313,7 @@ GeometryObjectPtr DrawViewPart::makeGeometryForShape(TopoDS_Shape& shape)
TopoDS_Shape localShape = copier.Shape();
gp_Pnt gCentroid = ShapeUtils::findCentroid(localShape, getProjectionCS());
m_saveCentroid = DU::toVector3d(gCentroid);
m_saveCentroid = Base::convertTo<Base::Vector3d>(gCentroid);
m_saveShape = centerScaleRotate(this, localShape, m_saveCentroid);
return buildGeometryObject(localShape, getProjectionCS());
@@ -1075,7 +1076,7 @@ Base::Vector3d DrawViewPart::localVectorToDirection(const Base::Vector3d localUn
{
// Base::Console().Message("DVP::localVectorToDirection() - localUnit: %s\n", DrawUtil::formatVector(localUnit).c_str());
gp_Ax2 cs = localVectorToCS(localUnit);
return DrawUtil::toVector3d(cs.Direction());
return Base::convertTo<Base::Vector3d>(cs.Direction());
}
gp_Ax2 DrawViewPart::getProjectionCS(const Base::Vector3d pt) const
@@ -1100,7 +1101,7 @@ gp_Ax2 DrawViewPart::getRotatedCS(const Base::Vector3d basePoint) const
{
// Base::Console().Message("DVP::getRotatedCS() - %s - %s\n", getNameInDocument(), Label.getValue());
gp_Ax2 unrotated = getProjectionCS(basePoint);
gp_Ax1 rotationAxis(DU::to<gp_Pnt>(basePoint), unrotated.Direction());
gp_Ax1 rotationAxis(Base::convertTo<gp_Pnt>(basePoint), unrotated.Direction());
double angleRad = Rotation.getValue() * M_PI / 180.0;
gp_Ax2 rotated = unrotated.Rotated(rotationAxis, -angleRad);
return rotated;
@@ -1127,7 +1128,7 @@ Base::Vector3d DrawViewPart::getCurrentCentroid() const
}
gp_Ax2 cs = getProjectionCS();
gp_Pnt gCenter = ShapeUtils::findCentroid(shape, cs);
return DU::toVector3d(gCenter);
return Base::convertTo<Base::Vector3d>(gCenter);
}
std::vector<DrawViewSection*> DrawViewPart::getSectionRefs() const