Merge pull request #17082 from benj5378/useTemplates
[TechDraw] Use templates
This commit is contained in:
@@ -327,8 +327,8 @@ TechDraw::BaseGeomPtr CenterLine::scaledAndRotatedGeometry(TechDraw::DrawViewPar
|
||||
|
||||
TopoDS_Edge newEdge;
|
||||
if (getType() == CLTYPE::FACE ) {
|
||||
gp_Pnt gp1(DU::togp_Pnt(p1));
|
||||
gp_Pnt gp2(DU::togp_Pnt(p2));
|
||||
gp_Pnt gp1(DU::to<gp_Pnt>(p1));
|
||||
gp_Pnt gp2(DU::to<gp_Pnt>(p2));
|
||||
TopoDS_Edge e = BRepBuilderAPI_MakeEdge(gp1, gp2);
|
||||
// Mirror shape in Y and scale
|
||||
TopoDS_Shape s = ShapeUtils::mirrorShape(e, gp_Pnt(0.0, 0.0, 0.0), scale);
|
||||
@@ -337,8 +337,8 @@ TechDraw::BaseGeomPtr CenterLine::scaledAndRotatedGeometry(TechDraw::DrawViewPar
|
||||
newEdge = TopoDS::Edge(s);
|
||||
} else if (getType() == CLTYPE::EDGE ||
|
||||
getType() == CLTYPE::VERTEX) {
|
||||
gp_Pnt gp1(DU::togp_Pnt(DU::invertY(p1 * scale)));
|
||||
gp_Pnt gp2(DU::togp_Pnt(DU::invertY(p2 * scale)));
|
||||
gp_Pnt gp1(DU::to<gp_Pnt>(DU::invertY(p1 * scale)));
|
||||
gp_Pnt gp2(DU::to<gp_Pnt>(DU::invertY(p2 * scale)));
|
||||
newEdge = BRepBuilderAPI_MakeEdge(gp1, gp2);
|
||||
}
|
||||
|
||||
|
||||
@@ -171,8 +171,8 @@ TechDraw::BaseGeomPtr CosmeticEdge::makeCanonicalLine(DrawViewPart* dvp, Base::V
|
||||
{
|
||||
Base::Vector3d cStart = CosmeticVertex::makeCanonicalPoint(dvp, start);
|
||||
Base::Vector3d cEnd = CosmeticVertex::makeCanonicalPoint(dvp, end);
|
||||
gp_Pnt gStart = DU::togp_Pnt(cStart);
|
||||
gp_Pnt gEnd = DU::togp_Pnt(cEnd);
|
||||
gp_Pnt gStart = DU::to<gp_Pnt>(cStart);
|
||||
gp_Pnt gEnd = DU::to<gp_Pnt>(cEnd);
|
||||
TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(gStart, gEnd);
|
||||
return TechDraw::BaseGeom::baseFactory(edge);
|
||||
}
|
||||
@@ -180,8 +180,8 @@ TechDraw::BaseGeomPtr CosmeticEdge::makeCanonicalLine(DrawViewPart* dvp, Base::V
|
||||
//! makes an unscaled, unrotated line from two canonical points.
|
||||
TechDraw::BaseGeomPtr CosmeticEdge::makeLineFromCanonicalPoints(Base::Vector3d start, Base::Vector3d end)
|
||||
{
|
||||
gp_Pnt gStart = DU::togp_Pnt(start);
|
||||
gp_Pnt gEnd = DU::togp_Pnt(end);
|
||||
gp_Pnt gStart = DU::to<gp_Pnt>(start);
|
||||
gp_Pnt gEnd = DU::to<gp_Pnt>(end);
|
||||
TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(gStart, gEnd);
|
||||
return TechDraw::BaseGeom::baseFactory(edge);
|
||||
}
|
||||
|
||||
@@ -97,9 +97,9 @@ void pointPair::mapToPage(const DrawViewPart* dvp)
|
||||
gp_Ax3 OXYZ;
|
||||
xOXYZ.SetTransformation(OXYZ, gp_Ax3(dvp->getRotatedCS()));
|
||||
|
||||
gp_Vec gvFirst = DU::togp_Vec(m_first).Transformed(xOXYZ);
|
||||
gp_Vec gvFirst = DU::to<gp_Vec>(m_first).Transformed(xOXYZ);
|
||||
m_first = DU::toVector3d(gvFirst);
|
||||
gp_Vec gvSecond = DU::togp_Vec(m_second).Transformed(xOXYZ);
|
||||
gp_Vec gvSecond = DU::to<gp_Vec>(m_second).Transformed(xOXYZ);
|
||||
m_second = DU::toVector3d(gvSecond);
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ void anglePoints::mapToPage(const DrawViewPart* dvp)
|
||||
gp_Trsf xOXYZ;
|
||||
gp_Ax3 OXYZ;
|
||||
xOXYZ.SetTransformation(OXYZ, gp_Ax3(dvp->getRotatedCS()));
|
||||
gp_Vec gvVertex = DU::togp_Vec(m_vertex).Transformed(xOXYZ);
|
||||
gp_Vec gvVertex = DU::to<gp_Vec>(m_vertex).Transformed(xOXYZ);
|
||||
m_vertex = DU::toVector3d(gvVertex);
|
||||
}
|
||||
|
||||
@@ -291,17 +291,17 @@ void arcPoints::mapToPage(const DrawViewPart* dvp)
|
||||
gp_Ax3 OXYZ;
|
||||
xOXYZ.SetTransformation(OXYZ, gp_Ax3(dvp->getRotatedCS()));
|
||||
|
||||
gp_Vec gvCenter = DU::togp_Vec(center).Transformed(xOXYZ);
|
||||
gp_Vec gvCenter = DU::to<gp_Vec>(center).Transformed(xOXYZ);
|
||||
center = DU::toVector3d(gvCenter);
|
||||
gp_Vec gvOnCurve1 = DU::togp_Vec(onCurve.first()).Transformed(xOXYZ);
|
||||
gp_Vec gvOnCurve1 = DU::to<gp_Vec>(onCurve.first()).Transformed(xOXYZ);
|
||||
onCurve.first(DU::toVector3d(gvOnCurve1));
|
||||
gp_Vec gvOnCurve2 = DU::togp_Vec(onCurve.second()).Transformed(xOXYZ);
|
||||
gp_Vec gvOnCurve2 = DU::to<gp_Vec>(onCurve.second()).Transformed(xOXYZ);
|
||||
onCurve.second(DU::toVector3d(gvOnCurve2));
|
||||
gp_Vec gvArcEnds1 = DU::togp_Vec(arcEnds.first()).Transformed(xOXYZ);
|
||||
gp_Vec gvArcEnds1 = DU::to<gp_Vec>(arcEnds.first()).Transformed(xOXYZ);
|
||||
arcEnds.first(DU::toVector3d(gvArcEnds1));
|
||||
gp_Vec gvArcEnds2 = DU::togp_Vec(arcEnds.second()).Transformed(xOXYZ);
|
||||
gp_Vec gvArcEnds2 = DU::to<gp_Vec>(arcEnds.second()).Transformed(xOXYZ);
|
||||
arcEnds.second(DU::toVector3d(gvArcEnds2));
|
||||
gp_Vec gvMidArc = DU::togp_Vec(midArc).Transformed(xOXYZ);
|
||||
gp_Vec gvMidArc = DU::to<gp_Vec>(midArc).Transformed(xOXYZ);
|
||||
midArc = DU::toVector3d(gvMidArc);
|
||||
}
|
||||
|
||||
|
||||
@@ -336,12 +336,12 @@ TopoDS_Shape DrawBrokenView::makeHalfSpace(Base::Vector3d planePoint, Base::Vect
|
||||
// DU::formatVector(planePoint).c_str(),
|
||||
// DU::formatVector(planeNormal).c_str(),
|
||||
// DU::formatVector(pointInSpace).c_str());
|
||||
gp_Pnt origin = DU::togp_Pnt(planePoint);
|
||||
gp_Dir axis = DU::togp_Dir(planeNormal);
|
||||
gp_Pnt origin = DU::to<gp_Pnt>(planePoint);
|
||||
gp_Dir axis = DU::to<gp_Dir>(planeNormal);
|
||||
gp_Pln plane(origin, axis);
|
||||
BRepBuilderAPI_MakeFace mkFace(plane);
|
||||
TopoDS_Face face = mkFace.Face();
|
||||
BRepPrimAPI_MakeHalfSpace mkHalf(face, DU::togp_Pnt(pointInSpace));
|
||||
BRepPrimAPI_MakeHalfSpace mkHalf(face, DU::to<gp_Pnt>(pointInSpace));
|
||||
|
||||
return mkHalf.Solid();
|
||||
}
|
||||
@@ -966,7 +966,7 @@ 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::togp_Pnt(point2d).Transformed(xTo3d));
|
||||
auto pseudo3d = DU::toVector3d(DU::to<gp_Pnt>(point2d).Transformed(xTo3d));
|
||||
|
||||
// now shift down and left
|
||||
auto breaksAll = Breaks.getValues();
|
||||
@@ -1246,7 +1246,7 @@ Base::Vector3d DrawBrokenView::getCompressedCentroid() const
|
||||
//! construct a perpendicular direction in the projection CS
|
||||
Base::Vector3d DrawBrokenView::makePerpendicular(Base::Vector3d inDir) const
|
||||
{
|
||||
gp_Dir gDir = DU::togp_Dir(inDir);
|
||||
gp_Dir gDir = DU::to<gp_Dir>(inDir);
|
||||
gp_Pnt origin(0.0, 0.0, 0.0);
|
||||
auto dir = getProjectionCS().Direction();
|
||||
gp_Ax1 axis(origin, dir);
|
||||
|
||||
@@ -796,7 +796,7 @@ std::pair<Base::Vector3d, Base::Vector3d> DrawComplexSection::sectionArrowDirs()
|
||||
}
|
||||
|
||||
gp_Vec gProfileVector = makeProfileVector(profileWire);
|
||||
gp_Vec gSectionNormal = gp_Vec(DU::togp_Dir(SectionNormal.getValue()));
|
||||
gp_Vec gSectionNormal = gp_Vec(DU::to<gp_Dir>(SectionNormal.getValue()));
|
||||
gp_Vec gExtrudeVector = (gSectionNormal.Crossed(gProfileVector)).Normalized();
|
||||
Base::Vector3d vClosestBasis = DrawUtil::closestBasis(gp_Dir(gExtrudeVector), getSectionCS());
|
||||
gp_Dir gExtrudeDir = gp_Dir(vClosestBasis.x, vClosestBasis.y, vClosestBasis.z);
|
||||
|
||||
@@ -340,7 +340,7 @@ std::vector<LineSet> DrawGeomHatch::getTrimmedLines(DrawViewPart* source,
|
||||
grid = mkTransRotate.Shape();
|
||||
}
|
||||
gp_Trsf xGridTranslate;
|
||||
xGridTranslate.SetTranslation(DrawUtil::togp_Vec(hatchOffset));
|
||||
xGridTranslate.SetTranslation(DrawUtil::to<gp_Vec>(hatchOffset));
|
||||
BRepBuilderAPI_Transform mkTransTranslate(grid, xGridTranslate, true);
|
||||
grid = mkTransTranslate.Shape();
|
||||
|
||||
|
||||
@@ -485,7 +485,8 @@ Base::Vector3d DrawUtil::vertex2Vector(const TopoDS_Vertex& v)
|
||||
return Base::Vector3d(gp.X(), gp.Y(), gp.Z());
|
||||
}
|
||||
|
||||
//TODO: make formatVector using toVector3d
|
||||
// template specialization
|
||||
//template <> // GCC BUG 85282, wanting this to be outside class body
|
||||
std::string DrawUtil::formatVector(const Base::Vector3d& v)
|
||||
{
|
||||
std::stringstream builder;
|
||||
@@ -493,53 +494,7 @@ std::string DrawUtil::formatVector(const Base::Vector3d& v)
|
||||
builder << " (" << v.x << ", " << v.y << ", " << v.z << ") ";
|
||||
return builder.str();
|
||||
}
|
||||
|
||||
std::string DrawUtil::formatVector(const gp_Dir& v)
|
||||
{
|
||||
std::stringstream builder;
|
||||
builder << std::fixed << std::setprecision(Base::UnitsApi::getDecimals());
|
||||
builder << " (" << v.X() << ", " << v.Y() << ", " << v.Z() << ") ";
|
||||
return builder.str();
|
||||
}
|
||||
|
||||
std::string DrawUtil::formatVector(const gp_Dir2d& v)
|
||||
{
|
||||
std::stringstream builder;
|
||||
builder << std::fixed << std::setprecision(Base::UnitsApi::getDecimals());
|
||||
builder << " (" << v.X() << ", " << v.Y() << ") ";
|
||||
return builder.str();
|
||||
}
|
||||
std::string DrawUtil::formatVector(const gp_Vec& v)
|
||||
{
|
||||
std::stringstream builder;
|
||||
builder << std::fixed << std::setprecision(Base::UnitsApi::getDecimals());
|
||||
builder << " (" << v.X() << ", " << v.Y() << ", " << v.Z() << ") ";
|
||||
return builder.str();
|
||||
}
|
||||
|
||||
std::string DrawUtil::formatVector(const gp_Pnt& v)
|
||||
{
|
||||
std::stringstream builder;
|
||||
builder << std::fixed << std::setprecision(Base::UnitsApi::getDecimals());
|
||||
builder << " (" << v.X() << ", " << v.Y() << ", " << v.Z() << ") ";
|
||||
return builder.str();
|
||||
}
|
||||
|
||||
std::string DrawUtil::formatVector(const gp_Pnt2d& v)
|
||||
{
|
||||
std::stringstream builder;
|
||||
builder << std::fixed << std::setprecision(Base::UnitsApi::getDecimals());
|
||||
builder << " (" << v.X() << ", " << v.Y() << ") ";
|
||||
return builder.str();
|
||||
}
|
||||
|
||||
std::string DrawUtil::formatVector(const QPointF& v)
|
||||
{
|
||||
std::stringstream builder;
|
||||
builder << std::fixed << std::setprecision(Base::UnitsApi::getDecimals());
|
||||
builder << " (" << v.x() << ", " << v.y() << ") ";
|
||||
return builder.str();
|
||||
}
|
||||
//template std::string DrawUtil::formatVector<Base::Vector3d>(const Base::Vector3d &v);
|
||||
|
||||
//! compare 2 vectors for sorting - true if v1 < v2
|
||||
//! precision::Confusion() is too strict for vertex - vertex comparisons
|
||||
@@ -669,7 +624,7 @@ Base::Vector3d DrawUtil::vecRotate(Base::Vector3d vec, double angle, Base::Vecto
|
||||
|
||||
gp_Vec DrawUtil::closestBasis(gp_Vec inVec)
|
||||
{
|
||||
return gp_Vec(togp_Dir(closestBasis(toVector3d(inVec))));
|
||||
return gp_Vec(to<gp_Dir>(closestBasis(toVector3d(inVec))));
|
||||
}
|
||||
|
||||
//! returns stdX, stdY or stdZ.
|
||||
@@ -909,7 +864,7 @@ gp_Vec DrawUtil::maskDirection(gp_Vec inVec, gp_Dir directionToMask)
|
||||
|
||||
Base::Vector3d DrawUtil::maskDirection(Base::Vector3d inVec, Base::Vector3d directionToMask)
|
||||
{
|
||||
return toVector3d(maskDirection(togp_Vec(inVec), togp_Vec(directionToMask)));
|
||||
return toVector3d(maskDirection(to<gp_Vec>(inVec), to<gp_Vec>(directionToMask)));
|
||||
}
|
||||
|
||||
//! get the coordinate of inPoint for the cardinal unit direction.
|
||||
|
||||
@@ -116,13 +116,12 @@ public:
|
||||
|
||||
static Base::Vector3d vertex2Vector(const TopoDS_Vertex& v);
|
||||
|
||||
template <typename T>
|
||||
static std::string formatVector(const T& v)
|
||||
{
|
||||
return formatVector(toVector3d(v));
|
||||
}
|
||||
static std::string formatVector(const Base::Vector3d& v);
|
||||
static std::string formatVector(const gp_Dir& v);
|
||||
static std::string formatVector(const gp_Dir2d& v);
|
||||
static std::string formatVector(const gp_Vec& v);
|
||||
static std::string formatVector(const gp_Pnt& v);
|
||||
static std::string formatVector(const gp_Pnt2d& v);
|
||||
static std::string formatVector(const QPointF& v);
|
||||
|
||||
static bool vectorLess(const Base::Vector3d& v1, const Base::Vector3d& v2);
|
||||
//!std::map require comparator to be a type not a function
|
||||
@@ -169,36 +168,27 @@ public:
|
||||
static Base::Vector2d Intersect2d(Base::Vector2d p1, Base::Vector2d d1, Base::Vector2d p2,
|
||||
Base::Vector2d d2);
|
||||
|
||||
static Base::Vector3d toVector3d(const gp_Pnt gp)
|
||||
|
||||
template <typename T>
|
||||
static Base::Vector3d toVector3d(const T& v)
|
||||
{
|
||||
return Base::Vector3d(gp.X(), gp.Y(), gp.Z());
|
||||
}
|
||||
static Base::Vector3d toVector3d(const gp_Dir gp)
|
||||
{
|
||||
return Base::Vector3d(gp.X(), gp.Y(), gp.Z());
|
||||
}
|
||||
static Base::Vector3d toVector3d(const gp_Vec gp)
|
||||
{
|
||||
return Base::Vector3d(gp.X(), gp.Y(), gp.Z());
|
||||
}
|
||||
static Base::Vector3d toVector3d(const QPointF gp)
|
||||
{
|
||||
return Base::Vector3d(gp.x(), gp.y(), 0.0);
|
||||
return Base::Vector3d(v.X(), v.Y(), v.Z());
|
||||
}
|
||||
|
||||
static gp_Pnt togp_Pnt(const Base::Vector3d v)
|
||||
static Base::Vector3d toVector3d(const QPointF& v)
|
||||
{
|
||||
return gp_Pnt(v.x, v.y, v.z);
|
||||
return Base::Vector3d(v.x(), v.y(), 0);
|
||||
}
|
||||
static gp_Dir togp_Dir(const Base::Vector3d v)
|
||||
|
||||
//! To gp_*
|
||||
// TODO: Would this be relevant to move to Base::Vector3d? Probably
|
||||
template <typename T>
|
||||
static T to(const Base::Vector3d &v)
|
||||
{
|
||||
return gp_Dir(v.x, v.y, v.z);
|
||||
return T(v.x, v.y, v.z);
|
||||
}
|
||||
static gp_Vec togp_Vec(const Base::Vector3d v)
|
||||
{
|
||||
return gp_Vec(v.x, v.y, v.z);
|
||||
}
|
||||
static QPointF toQPointF(const Base::Vector3d v)
|
||||
|
||||
static QPointF toQPointF(const Base::Vector3d &v)
|
||||
{
|
||||
return QPointF(v.x, v.y);
|
||||
}
|
||||
@@ -294,5 +284,12 @@ public:
|
||||
static void dumpEdges(const char* text, const TopoDS_Shape& s);
|
||||
};
|
||||
|
||||
|
||||
// GCC BUG 85282, wanting this to be outside class body. This is only the declaration, the definition .cpp
|
||||
//template<> std::string DrawUtil::formatVector<Base::Vector3d>(const Base::Vector3d &v);
|
||||
|
||||
// GCC BUG 85282, wanting this to be outside class body. This is only the declaration, the definition .cpp
|
||||
//template<> Base::Vector3d DrawUtil::toVector3d<QPointF>(const QPointF& v);
|
||||
|
||||
}//end namespace TechDraw
|
||||
#endif
|
||||
|
||||
@@ -1131,8 +1131,8 @@ arcPoints DrawViewDimension::arcPointsFromEdge(TopoDS_Edge occEdge)
|
||||
if (pts.isArc) {
|
||||
// part of circle
|
||||
gp_Ax1 axis = circle.Axis();
|
||||
gp_Vec startVec = DrawUtil::togp_Vec(pts.arcEnds.first() - pts.center);
|
||||
gp_Vec endVec = DrawUtil::togp_Vec(pts.arcEnds.second() - pts.center);
|
||||
gp_Vec startVec = DrawUtil::to<gp_Vec>(pts.arcEnds.first() - pts.center);
|
||||
gp_Vec endVec = DrawUtil::to<gp_Vec>(pts.arcEnds.second() - pts.center);
|
||||
double angle = startVec.AngleWithRef(endVec, axis.Direction().XYZ());
|
||||
pts.arcCW = (angle < 0.0);
|
||||
}
|
||||
@@ -1151,8 +1151,8 @@ arcPoints DrawViewDimension::arcPointsFromEdge(TopoDS_Edge occEdge)
|
||||
if (pts.isArc) {
|
||||
// part of ellipse
|
||||
gp_Ax1 axis = ellipse.Axis();
|
||||
gp_Vec startVec = DrawUtil::togp_Vec(pts.arcEnds.first() - pts.center);
|
||||
gp_Vec endVec = DrawUtil::togp_Vec(pts.arcEnds.second() - pts.center);
|
||||
gp_Vec startVec = DrawUtil::to<gp_Vec>(pts.arcEnds.first() - pts.center);
|
||||
gp_Vec endVec = DrawUtil::to<gp_Vec>(pts.arcEnds.second() - pts.center);
|
||||
double angle = startVec.AngleWithRef(endVec, axis.Direction().XYZ());
|
||||
pts.arcCW = (angle < 0.0);
|
||||
}
|
||||
@@ -1180,8 +1180,8 @@ arcPoints DrawViewDimension::arcPointsFromEdge(TopoDS_Edge occEdge)
|
||||
if (pts.isArc) {
|
||||
// part of circle
|
||||
gp_Ax1 axis = circle.Axis();
|
||||
gp_Vec startVec = DrawUtil::togp_Vec(pts.arcEnds.first() - pts.center);
|
||||
gp_Vec endVec = DrawUtil::togp_Vec(pts.arcEnds.second() - pts.center);
|
||||
gp_Vec startVec = DrawUtil::to<gp_Vec>(pts.arcEnds.first() - pts.center);
|
||||
gp_Vec endVec = DrawUtil::to<gp_Vec>(pts.arcEnds.second() - pts.center);
|
||||
double angle = startVec.AngleWithRef(endVec, axis.Direction().XYZ());
|
||||
pts.arcCW = (angle < 0.0);
|
||||
}
|
||||
@@ -1317,7 +1317,7 @@ anglePoints DrawViewDimension::getAnglePointsTwoEdges(ReferenceVector references
|
||||
if (!haveIntersection) {
|
||||
throw Base::RuntimeError("Geometry for 3d angle dimension does not intersect");
|
||||
}
|
||||
gp_Pnt gApex = DrawUtil::togp_Pnt(vApex);
|
||||
gp_Pnt gApex = DrawUtil::to<gp_Pnt>(vApex);
|
||||
|
||||
gp_Pnt gFar0 = gEnd0;
|
||||
if (gStart0.Distance(gApex) > gEnd0.Distance(gApex)) {
|
||||
@@ -1717,9 +1717,9 @@ double DrawViewDimension::getArcAngle(Base::Vector3d center, Base::Vector3d star
|
||||
auto leg0 = startPoint - center;
|
||||
auto leg1 = endPoint - startPoint;
|
||||
auto referenceDirection = leg0.Cross(leg1);
|
||||
gp_Ax1 axis{DU::togp_Pnt(center), DU::togp_Vec(referenceDirection)};
|
||||
gp_Vec startVec = DrawUtil::togp_Vec(leg0);
|
||||
gp_Vec endVec = DrawUtil::togp_Vec(leg1);
|
||||
gp_Ax1 axis{DU::to<gp_Pnt>(center), DU::to<gp_Vec>(referenceDirection)};
|
||||
gp_Vec startVec = DrawUtil::to<gp_Vec>(leg0);
|
||||
gp_Vec endVec = DrawUtil::to<gp_Vec>(leg1);
|
||||
double angle = startVec.AngleWithRef(endVec, axis.Direction().XYZ());
|
||||
return angle;
|
||||
}
|
||||
|
||||
@@ -1099,7 +1099,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::togp_Pnt(basePoint), unrotated.Direction());
|
||||
gp_Ax1 rotationAxis(DU::to<gp_Pnt>(basePoint), unrotated.Direction());
|
||||
double angleRad = Rotation.getValue() * M_PI / 180.0;
|
||||
gp_Ax2 rotated = unrotated.Rotated(rotationAxis, -angleRad);
|
||||
return rotated;
|
||||
|
||||
@@ -968,8 +968,8 @@ ChangePointVector DrawViewSection::getChangePointsFromSectionLine()
|
||||
if (baseDvp) {
|
||||
std::pair<Base::Vector3d, Base::Vector3d> lineEnds = sectionLineEnds();
|
||||
// make start and end marks
|
||||
gp_Pnt location0 = DU::togp_Pnt(lineEnds.first);
|
||||
gp_Pnt location1 = DU::togp_Pnt(lineEnds.second);
|
||||
gp_Pnt location0 = DU::to<gp_Pnt>(lineEnds.first);
|
||||
gp_Pnt location1 = DU::to<gp_Pnt>(lineEnds.second);
|
||||
gp_Dir postDir = gp_Dir(location1.XYZ() - location0.XYZ());
|
||||
gp_Dir preDir = postDir.Reversed();
|
||||
ChangePoint startPoint(location0, preDir, postDir);
|
||||
@@ -1067,9 +1067,9 @@ void DrawViewSection::setCSFromLocalUnit(const Base::Vector3d localUnit)
|
||||
// Base::Console().Message("DVS::setCSFromLocalUnit(%s)\n",
|
||||
// DrawUtil::formatVector(localUnit).c_str());
|
||||
gp_Dir verticalDir = getSectionCS().YDirection();
|
||||
gp_Ax1 verticalAxis(DrawUtil::togp_Pnt(SectionOrigin.getValue()), verticalDir);
|
||||
gp_Ax1 verticalAxis(DrawUtil::to<gp_Pnt>(SectionOrigin.getValue()), verticalDir);
|
||||
gp_Dir oldNormal = getSectionCS().Direction();
|
||||
gp_Dir newNormal = DrawUtil::togp_Dir(projectPoint(localUnit));
|
||||
gp_Dir newNormal = DrawUtil::to<gp_Dir>(projectPoint(localUnit));
|
||||
double angle = oldNormal.AngleWithRef(newNormal, verticalDir);
|
||||
gp_Ax2 newCS = getSectionCS().Rotated(verticalAxis, angle);
|
||||
SectionNormal.setValue(DrawUtil::toVector3d(newCS.Direction()));
|
||||
|
||||
@@ -1442,7 +1442,7 @@ TopoShape Vertex::asTopoShape(double scale)
|
||||
{
|
||||
Base::Vector3d point = DU::toVector3d(BRep_Tool::Pnt(getOCCVertex()));
|
||||
point = point / scale;
|
||||
BRepBuilderAPI_MakeVertex mkVert(DU::togp_Pnt(point));
|
||||
BRepBuilderAPI_MakeVertex mkVert(DU::to<gp_Pnt>(point));
|
||||
return TopoShape(mkVert.Vertex());
|
||||
}
|
||||
|
||||
@@ -1643,7 +1643,7 @@ TopoDS_Edge GeometryUtils::asCircle(TopoDS_Edge splineEdge, bool& arc)
|
||||
throw Base::RuntimeError("GU::asCircle received non-circular edge!");
|
||||
}
|
||||
|
||||
gp_Pnt gCenter = DU::togp_Pnt(center);
|
||||
gp_Pnt gCenter = DU::to<gp_Pnt>(center);
|
||||
gp_Dir gNormal{0, 0, 1};
|
||||
Handle(Geom_Circle) circleFromParms = GC_MakeCircle(gCenter, gNormal, radius);
|
||||
|
||||
@@ -1825,7 +1825,7 @@ std::vector<FacePtr> GeometryUtils::findHolesInFace(const DrawViewPart* dvp, con
|
||||
iFace++;
|
||||
continue;
|
||||
}
|
||||
auto faceCenter = DU::togp_Pnt(face->getCenter());
|
||||
auto faceCenter = DU::to<gp_Pnt>(face->getCenter());
|
||||
auto faceCenterVertex = BRepBuilderAPI_MakeVertex(faceCenter);
|
||||
auto distance = DU::simpleMinDist(faceCenterVertex, bigCheeseOCCFace);
|
||||
if (distance > EWTOLERANCE) {
|
||||
|
||||
@@ -501,8 +501,8 @@ bool TaskComplexSection::apply(bool forceUpdate)
|
||||
}
|
||||
else {
|
||||
gp_Pnt stdOrigin(0.0, 0.0, 0.0);
|
||||
gp_Ax2 sectionCS(stdOrigin, DrawUtil::togp_Dir(m_saveNormal),
|
||||
DrawUtil::togp_Dir(m_saveXDir));
|
||||
gp_Ax2 sectionCS(stdOrigin, DrawUtil::to<gp_Dir>(m_saveNormal),
|
||||
DrawUtil::to<gp_Dir>(m_saveXDir));
|
||||
if (!DrawComplexSection::canBuild(sectionCS, m_profileObject)) {
|
||||
Base::Console().Error(
|
||||
"Can not build Complex Section with this profile and direction (2)\n");
|
||||
|
||||
Reference in New Issue
Block a user