remove gp_* conversion code from TechDraw workbench
This commit is contained in:
@@ -73,6 +73,7 @@
|
||||
#include <App/Document.h>
|
||||
#include <Base/BoundBox.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Converter.h>
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
@@ -244,7 +245,7 @@ TopoDS_Shape DrawBrokenView::compressHorizontal(const TopoDS_Shape& shapeToComp
|
||||
{
|
||||
auto pieces = getPieces(shapeToCompress);
|
||||
auto breaksAll = Breaks.getValues();
|
||||
auto moveDirection = DU::closestBasisOriented(DU::toVector3d(getProjectionCS().XDirection()));
|
||||
auto moveDirection = DU::closestBasisOriented(Base::convertTo<Base::Vector3d>(getProjectionCS().XDirection()));
|
||||
bool descend = false;
|
||||
auto sortedBreaks = makeSortedBreakList(breaksAll, moveDirection, descend);
|
||||
auto limits = getPieceLimits(pieces, moveDirection);
|
||||
@@ -283,7 +284,7 @@ TopoDS_Shape DrawBrokenView::compressVertical(const TopoDS_Shape& shapeToCompre
|
||||
auto pieces = getPieces(shapeToCompress);
|
||||
auto breaksAll = Breaks.getValues();
|
||||
// not sure about using closestBasis here. may prevent oblique breaks later.
|
||||
auto moveDirection = DU::closestBasisOriented(DU::toVector3d(getProjectionCS().YDirection()));
|
||||
auto moveDirection = DU::closestBasisOriented(Base::convertTo<Base::Vector3d>(getProjectionCS().YDirection()));
|
||||
|
||||
bool descend = false;
|
||||
auto sortedBreaks = makeSortedBreakList(breaksAll, moveDirection, descend);
|
||||
@@ -323,11 +324,11 @@ TopoDS_Shape DrawBrokenView::makeHalfSpace(const Base::Vector3d& planePoint,
|
||||
const Base::Vector3d& planeNormal,
|
||||
const Base::Vector3d& pointInSpace) const
|
||||
{
|
||||
auto origin = DU::to<gp_Pnt>(planePoint);
|
||||
auto axis = DU::to<gp_Dir>(planeNormal);
|
||||
auto origin = Base::convertTo<gp_Pnt>(planePoint);
|
||||
auto axis = Base::convertTo<gp_Dir>(planeNormal);
|
||||
gp_Pln plane(origin, axis);
|
||||
BRepBuilderAPI_MakeFace mkFace(plane);
|
||||
BRepPrimAPI_MakeHalfSpace mkHalf(mkFace.Face(), DU::to<gp_Pnt>(pointInSpace));
|
||||
BRepPrimAPI_MakeHalfSpace mkHalf(mkFace.Face(), Base::convertTo<gp_Pnt>(pointInSpace));
|
||||
|
||||
return mkHalf.Solid();
|
||||
}
|
||||
@@ -478,7 +479,7 @@ std::pair<Base::Vector3d, Base::Vector3d> DrawBrokenView::breakPointsFromEdge(co
|
||||
TopoDS_Edge edge = TopoDS::Edge(locShape);
|
||||
gp_Pnt start = BRep_Tool::Pnt(TopExp::FirstVertex(edge));
|
||||
gp_Pnt end = BRep_Tool::Pnt(TopExp::LastVertex(edge));
|
||||
return {DU::toVector3d(start), DU::toVector3d(end)};
|
||||
return {Base::convertTo<Base::Vector3d>(start), Base::convertTo<Base::Vector3d>(end)};
|
||||
}
|
||||
|
||||
|
||||
@@ -641,7 +642,7 @@ bool DrawBrokenView::isVertical(const TopoDS_Edge& edge, const bool projected) c
|
||||
auto edgeDir = ends.second - ends.first;
|
||||
edgeDir.Normalize();
|
||||
|
||||
auto upDir = DU::toVector3d(getProjectionCS().YDirection());
|
||||
auto upDir = Base::convertTo<Base::Vector3d>(getProjectionCS().YDirection());
|
||||
if (projected) {
|
||||
upDir = stdY;
|
||||
}
|
||||
@@ -657,7 +658,7 @@ bool DrawBrokenView::isVertical(std::pair<Base::Vector3d, Base::Vector3d> inPoin
|
||||
auto pointDir = inPoints.second - inPoints.first;
|
||||
pointDir.Normalize();
|
||||
|
||||
auto upDir = DU::toVector3d(getProjectionCS().YDirection());
|
||||
auto upDir = Base::convertTo<Base::Vector3d>(getProjectionCS().YDirection());
|
||||
if (projected) {
|
||||
upDir = stdY;
|
||||
}
|
||||
@@ -673,7 +674,7 @@ bool DrawBrokenView::isHorizontal(const TopoDS_Edge& edge, bool projected) const
|
||||
auto edgeDir = ends.second - ends.first;
|
||||
edgeDir.Normalize();
|
||||
|
||||
auto sideDir = DU::toVector3d(getProjectionCS().XDirection());
|
||||
auto sideDir = Base::convertTo<Base::Vector3d>(getProjectionCS().XDirection());
|
||||
if (projected) {
|
||||
sideDir = stdX;
|
||||
}
|
||||
@@ -876,7 +877,7 @@ Base::Vector3d DrawBrokenView::mapPoint3dToView(Base::Vector3d point3d) const
|
||||
|
||||
auto breaksAll = Breaks.getValues();
|
||||
bool descend = false;
|
||||
auto moveXDirection = DU::closestBasisOriented(DU::toVector3d(getProjectionCS().XDirection()));
|
||||
auto moveXDirection = DU::closestBasisOriented(Base::convertTo<Base::Vector3d>(getProjectionCS().XDirection()));
|
||||
|
||||
// get the breaks that move us in X
|
||||
auto sortedXBreaks = makeSortedBreakList(breaksAll, moveXDirection, descend);
|
||||
@@ -885,7 +886,7 @@ Base::Vector3d DrawBrokenView::mapPoint3dToView(Base::Vector3d point3d) const
|
||||
double xShift = shiftAmountShrink(xLimit, moveXDirection, sortedXBreaks);
|
||||
Base::Vector3d xMove = moveXDirection * xShift; // move to the right (+X)
|
||||
|
||||
auto moveYDirection = DU::closestBasisOriented(DU::toVector3d(getProjectionCS().YDirection()));
|
||||
auto moveYDirection = DU::closestBasisOriented(Base::convertTo<Base::Vector3d>(getProjectionCS().YDirection()));
|
||||
descend = false;
|
||||
// get the breaks that move us in Y
|
||||
auto sortedYBreaks = makeSortedBreakList(breaksAll, moveYDirection, descend);
|
||||
@@ -913,12 +914,12 @@ Base::Vector3d DrawBrokenView::mapPoint2dFromView(Base::Vector3d point2d) const
|
||||
gp_Ax3 projCS3(getProjectionCS(getCompressedCentroid()));
|
||||
gp_Trsf xTo3d;
|
||||
xTo3d.SetTransformation(projCS3, OXYZ);
|
||||
auto pseudo3d = DU::toVector3d(DU::to<gp_Pnt>(point2d).Transformed(xTo3d));
|
||||
auto pseudo3d = Base::convertTo<Base::Vector3d>(Base::convertTo<gp_Pnt>(point2d).Transformed(xTo3d));
|
||||
|
||||
// now shift down and left
|
||||
auto breaksAll = Breaks.getValues();
|
||||
|
||||
auto moveXDirection = DU::closestBasisOriented(DU::toVector3d(getProjectionCS().XDirection()));
|
||||
auto moveXDirection = DU::closestBasisOriented(Base::convertTo<Base::Vector3d>(getProjectionCS().XDirection()));
|
||||
// we are expanding, so the direction should be to the "left"/"down" which is the opposite of
|
||||
// our XDirection
|
||||
auto moveXReverser = isDirectionReversed(moveXDirection) ? 1.0 : -1.0;
|
||||
@@ -941,7 +942,7 @@ Base::Vector3d DrawBrokenView::mapPoint2dFromView(Base::Vector3d point2d) const
|
||||
}
|
||||
double xCoord2 = xLimit + breakSum * moveXReverser;
|
||||
|
||||
auto moveYDirection = DU::closestBasisOriented(DU::toVector3d(getProjectionCS().YDirection()));
|
||||
auto moveYDirection = DU::closestBasisOriented(Base::convertTo<Base::Vector3d>(getProjectionCS().YDirection()));
|
||||
auto moveYReverser = isDirectionReversed(moveYDirection) ? 1.0 : -1.0;
|
||||
descend = false;
|
||||
auto sortedYBreaks = makeSortedBreakList(breaksAll, moveYDirection, descend);
|
||||
@@ -1102,18 +1103,18 @@ Base::Vector3d DrawBrokenView::getCompressedCentroid() const
|
||||
}
|
||||
gp_Ax2 cs = getProjectionCS();
|
||||
gp_Pnt gCenter = ShapeUtils::findCentroid(m_compressedShape, cs);
|
||||
return DU::toVector3d(gCenter);
|
||||
return Base::convertTo<Base::Vector3d>(gCenter);
|
||||
}
|
||||
|
||||
//! construct a perpendicular direction in the projection CS
|
||||
Base::Vector3d DrawBrokenView::makePerpendicular(Base::Vector3d inDir) const
|
||||
{
|
||||
auto gDir = DU::to<gp_Dir>(inDir);
|
||||
auto gDir = Base::convertTo<gp_Dir>(inDir);
|
||||
gp_Pnt origin(0.0, 0.0, 0.0);
|
||||
auto dir = getProjectionCS().Direction();
|
||||
gp_Ax1 axis(origin, dir);
|
||||
auto gRotated = gDir.Rotated(axis, M_PI_2);
|
||||
return DU::toVector3d(gRotated);
|
||||
return Base::convertTo<Base::Vector3d>(gRotated);
|
||||
}
|
||||
|
||||
//! true if this piece should be moved
|
||||
|
||||
Reference in New Issue
Block a user