From 97c82a670309246c17f3cd72c1f2139e1b37bb03 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sat, 11 Dec 2021 14:43:57 +0100 Subject: [PATCH] Sketcher: Convert PointPos into an enum CLASS --- src/Mod/Sketcher/App/Constraint.cpp | 6 +- src/Mod/Sketcher/App/ConstraintPyImp.cpp | 26 +- src/Mod/Sketcher/App/GeoEnum.h | 2 +- src/Mod/Sketcher/App/GeoList.cpp | 38 +- src/Mod/Sketcher/App/GeoList.h | 2 +- src/Mod/Sketcher/App/Sketch.cpp | 294 +++++------ src/Mod/Sketcher/App/SketchAnalysis.cpp | 36 +- src/Mod/Sketcher/App/SketchObject.cpp | 476 +++++++++--------- src/Mod/Sketcher/App/SketchObject.h | 12 +- src/Mod/Sketcher/App/SketchObjectPyImp.cpp | 34 +- src/Mod/Sketcher/Gui/Command.cpp | 2 +- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 336 ++++++------- src/Mod/Sketcher/Gui/CommandCreateGeo.cpp | 193 +++---- src/Mod/Sketcher/Gui/CommandSketcherTools.cpp | 76 +-- src/Mod/Sketcher/Gui/DrawSketchHandler.cpp | 25 +- src/Mod/Sketcher/Gui/DrawSketchHandler.h | 2 +- src/Mod/Sketcher/Gui/SketchMirrorDialog.cpp | 8 +- .../Sketcher/Gui/TaskSketcherConstraints.cpp | 12 +- src/Mod/Sketcher/Gui/TaskSketcherElements.cpp | 18 +- src/Mod/Sketcher/Gui/Utils.cpp | 20 +- src/Mod/Sketcher/Gui/Utils.h | 6 +- src/Mod/Sketcher/Gui/ViewProviderSketch.cpp | 64 +-- 22 files changed, 845 insertions(+), 843 deletions(-) diff --git a/src/Mod/Sketcher/App/Constraint.cpp b/src/Mod/Sketcher/App/Constraint.cpp index c57b86fce9..565510c220 100644 --- a/src/Mod/Sketcher/App/Constraint.cpp +++ b/src/Mod/Sketcher/App/Constraint.cpp @@ -49,11 +49,11 @@ Constraint::Constraint() AlignmentType(Undef), Name(""), First(GeoEnum::GeoUndef), - FirstPos(none), + FirstPos(PointPos::none), Second(GeoEnum::GeoUndef), - SecondPos(none), + SecondPos(PointPos::none), Third(GeoEnum::GeoUndef), - ThirdPos(none), + ThirdPos(PointPos::none), LabelDistance(10.f), LabelPosition(0.f), isDriving(true), diff --git a/src/Mod/Sketcher/App/ConstraintPyImp.cpp b/src/Mod/Sketcher/App/ConstraintPyImp.cpp index acb28d9e59..d6b19c72a1 100644 --- a/src/Mod/Sketcher/App/ConstraintPyImp.cpp +++ b/src/Mod/Sketcher/App/ConstraintPyImp.cpp @@ -50,11 +50,11 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/) char *ConstraintType; int FirstIndex = GeoEnum::GeoUndef; - int FirstPos = none; + int FirstPos = static_cast(PointPos::none); int SecondIndex= GeoEnum::GeoUndef; - int SecondPos = none; + int SecondPos = static_cast(PointPos::none); int ThirdIndex = GeoEnum::GeoUndef; - int ThirdPos = none; + int ThirdPos = static_cast(PointPos::none); double Value = 0; int intArg1, intArg2, intArg3, intArg4, intArg5; // Note: In Python 2.x PyArg_ParseTuple prints a warning if a float is given but an integer is expected. @@ -295,9 +295,9 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/) this->getConstraintPtr()->Type = Tangent; //valid = true;//non-standard assignment this->getConstraintPtr()->First = intArg1; - this->getConstraintPtr()->FirstPos = Sketcher::none; + this->getConstraintPtr()->FirstPos = Sketcher::PointPos::none; this->getConstraintPtr()->Second = intArg2; - this->getConstraintPtr()->SecondPos = Sketcher::none; + this->getConstraintPtr()->SecondPos = Sketcher::PointPos::none; this->getConstraintPtr()->Third = intArg3; this->getConstraintPtr()->ThirdPos = (Sketcher::PointPos) intArg4; return 0; @@ -306,9 +306,9 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/) this->getConstraintPtr()->Type = Perpendicular; //valid = true;//non-standard assignment this->getConstraintPtr()->First = intArg1; - this->getConstraintPtr()->FirstPos = Sketcher::none; + this->getConstraintPtr()->FirstPos = Sketcher::PointPos::none; this->getConstraintPtr()->Second = intArg2; - this->getConstraintPtr()->SecondPos = Sketcher::none; + this->getConstraintPtr()->SecondPos = Sketcher::PointPos::none; this->getConstraintPtr()->Third = intArg3; this->getConstraintPtr()->ThirdPos = (Sketcher::PointPos) intArg4; return 0; @@ -406,9 +406,9 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/) this->getConstraintPtr()->Type = Angle; //valid = true;//non-standard assignment this->getConstraintPtr()->First = intArg1; - this->getConstraintPtr()->FirstPos = Sketcher::none; + this->getConstraintPtr()->FirstPos = Sketcher::PointPos::none; this->getConstraintPtr()->Second = intArg2; //let's goof up all the terminology =) - this->getConstraintPtr()->SecondPos = Sketcher::none; + this->getConstraintPtr()->SecondPos = Sketcher::PointPos::none; this->getConstraintPtr()->Third = intArg3; this->getConstraintPtr()->ThirdPos = (Sketcher::PointPos) intArg4; this->getConstraintPtr()->setValue(Value); @@ -450,7 +450,7 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/) this->getConstraintPtr()->Second = SecondIndex; this->getConstraintPtr()->SecondPos = (Sketcher::PointPos) SecondPos; this->getConstraintPtr()->Third = ThirdIndex; - this->getConstraintPtr()->ThirdPos = none; + this->getConstraintPtr()->ThirdPos = Sketcher::PointPos::none; this->getConstraintPtr()->setValue(Value); return 0; } @@ -570,7 +570,7 @@ void ConstraintPy::setFirstPos(Py::Long arg) { int pos = arg; - if(pos>=Sketcher::none && pos<=Sketcher::mid) { + if(pos>=static_cast(Sketcher::PointPos::none) && pos<=static_cast(Sketcher::PointPos::mid)) { this->getConstraintPtr()->FirstPos = (Sketcher::PointPos)pos; } else { @@ -600,7 +600,7 @@ void ConstraintPy::setSecondPos(Py::Long arg) { int pos = arg; - if(pos>=Sketcher::none && pos<=Sketcher::mid) { + if(pos>=static_cast(Sketcher::PointPos::none) && pos<=static_cast(Sketcher::PointPos::mid)) { this->getConstraintPtr()->SecondPos = (Sketcher::PointPos)pos; } else { @@ -630,7 +630,7 @@ void ConstraintPy::setThirdPos(Py::Long arg) { int pos = arg; - if(pos>=Sketcher::none && pos<=Sketcher::mid) { + if(pos>=static_cast(Sketcher::PointPos::none) && pos<=static_cast(Sketcher::PointPos::mid)) { this->getConstraintPtr()->ThirdPos = (Sketcher::PointPos)pos; } else { diff --git a/src/Mod/Sketcher/App/GeoEnum.h b/src/Mod/Sketcher/App/GeoEnum.h index dc3c579bbc..a9abd671c2 100644 --- a/src/Mod/Sketcher/App/GeoEnum.h +++ b/src/Mod/Sketcher/App/GeoEnum.h @@ -76,7 +76,7 @@ struct SketcherExport GeoEnum * complex geometries like parabola focus or b-spline knots use InternalAlignment constraints * in addition to PointPos. */ -enum PointPos : int { +enum class PointPos : int { none = 0, // Edge of a geometry start = 1, // Starting point of a geometry end = 2, // End point of a geometry diff --git a/src/Mod/Sketcher/App/GeoList.cpp b/src/Mod/Sketcher/App/GeoList.cpp index 6b668515e1..237896d7df 100644 --- a/src/Mod/Sketcher/App/GeoList.cpp +++ b/src/Mod/Sketcher/App/GeoList.cpp @@ -125,59 +125,59 @@ Base::Vector3d GeoListModel::getPoint(const Part::Geometry * geo, Sketcher::P if (geo->getTypeId() == Part::GeomPoint::getClassTypeId()) { const Part::GeomPoint *p = static_cast(geo); - if (pos == start || pos == mid || pos == end) + if (pos == PointPos::start || pos == PointPos::mid || pos == PointPos::end) return p->getPoint(); } else if (geo->getTypeId() == Part::GeomLineSegment::getClassTypeId()) { const Part::GeomLineSegment *lineSeg = static_cast(geo); - if (pos == start) + if (pos == PointPos::start) return lineSeg->getStartPoint(); - else if (pos == end) + else if (pos == PointPos::end) return lineSeg->getEndPoint(); } else if (geo->getTypeId() == Part::GeomCircle::getClassTypeId()) { const Part::GeomCircle *circle = static_cast(geo); - if (pos == mid) + if (pos == PointPos::mid) return circle->getCenter(); } else if (geo->getTypeId() == Part::GeomEllipse::getClassTypeId()) { const Part::GeomEllipse *ellipse = static_cast(geo); - if (pos == mid) + if (pos == PointPos::mid) return ellipse->getCenter(); } else if (geo->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) { const Part::GeomArcOfCircle *aoc = static_cast(geo); - if (pos == start) + if (pos == PointPos::start) return aoc->getStartPoint(/*emulateCCW=*/true); - else if (pos == end) + else if (pos == PointPos::end) return aoc->getEndPoint(/*emulateCCW=*/true); - else if (pos == mid) + else if (pos == PointPos::mid) return aoc->getCenter(); } else if (geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()) { const Part::GeomArcOfEllipse *aoc = static_cast(geo); - if (pos == start) + if (pos == PointPos::start) return aoc->getStartPoint(/*emulateCCW=*/true); - else if (pos == end) + else if (pos == PointPos::end) return aoc->getEndPoint(/*emulateCCW=*/true); - else if (pos == mid) + else if (pos == PointPos::mid) return aoc->getCenter(); } else if (geo->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId()) { const Part::GeomArcOfHyperbola *aoh = static_cast(geo); - if (pos == start) + if (pos == PointPos::start) return aoh->getStartPoint(); - else if (pos == end) + else if (pos == PointPos::end) return aoh->getEndPoint(); - else if (pos == mid) + else if (pos == PointPos::mid) return aoh->getCenter(); } else if (geo->getTypeId() == Part::GeomArcOfParabola::getClassTypeId()) { const Part::GeomArcOfParabola *aop = static_cast(geo); - if (pos == start) + if (pos == PointPos::start) return aop->getStartPoint(); - else if (pos == end) + else if (pos == PointPos::end) return aop->getEndPoint(); - else if (pos == mid) + else if (pos == PointPos::mid) return aop->getCenter(); } else if (geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId()) { const Part::GeomBSplineCurve *bsp = static_cast(geo); - if (pos == start) + if (pos == PointPos::start) return bsp->getStartPoint(); - else if (pos == end) + else if (pos == PointPos::end) return bsp->getEndPoint(); } diff --git a/src/Mod/Sketcher/App/GeoList.h b/src/Mod/Sketcher/App/GeoList.h index 3c781475e5..b70c6edd56 100644 --- a/src/Mod/Sketcher/App/GeoList.h +++ b/src/Mod/Sketcher/App/GeoList.h @@ -43,7 +43,7 @@ namespace Part { } namespace Sketcher { - enum PointPos : int; + enum class PointPos : int; class GeometryFacade; } diff --git a/src/Mod/Sketcher/App/Sketch.cpp b/src/Mod/Sketcher/App/Sketch.cpp index 5b8f3caa2a..ef29792e88 100644 --- a/src/Mod/Sketcher/App/Sketch.cpp +++ b/src/Mod/Sketcher/App/Sketch.cpp @@ -456,16 +456,16 @@ void Sketch::calculateDependentParametersElements(void) Geoms[element->second.first].geo->getExtension(Sketcher::SolverGeometryExtension::getClassTypeId()).lock()); switch(element->second.second) { - case none: + case PointPos::none: solvext->setEdge(SolverGeometryExtension::Dependent); break; - case start: + case PointPos::start: solvext->setStart(SolverGeometryExtension::Dependent); break; - case end: + case PointPos::end: solvext->setEnd(SolverGeometryExtension::Dependent); break; - case mid: + case PointPos::mid: solvext->setMid(SolverGeometryExtension::Dependent); break; } @@ -687,8 +687,8 @@ int Sketch::addPoint(const Part::GeomPoint &point, bool fixed) Geoms.push_back(def); if(!fixed) { - param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::start)); - param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::start)); + param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start)); + param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start)); } // return the position of the newly added geometry @@ -746,10 +746,10 @@ int Sketch::addLineSegment(const Part::GeomLineSegment &lineSegment, bool fixed) Geoms.push_back(def); if(!fixed) { - param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::start)); - param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::start)); - param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::end)); - param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::end)); + param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start)); + param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start)); + param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end)); + param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end)); } // return the position of the newly added geometry @@ -824,15 +824,15 @@ int Sketch::addArc(const Part::GeomArcOfCircle &circleSegment, bool fixed) GCSsys.addConstraintArcRules(a); if(!fixed) { - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::start)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::start)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::end)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::end)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(r), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a1), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a2), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(r), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a1), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a2), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); } // return the position of the newly added geometry @@ -924,17 +924,17 @@ int Sketch::addArcOfEllipse(const Part::GeomArcOfEllipse &ellipseSegment, bool f GCSsys.addConstraintArcOfEllipseRules(a); if(!fixed) { - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::start)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::start)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::end)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::end)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1X), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1Y), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(rmin), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a1), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a2), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1X), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1Y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(rmin), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a1), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a2), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); } // return the position of the newly added geometry @@ -1024,17 +1024,17 @@ int Sketch::addArcOfHyperbola(const Part::GeomArcOfHyperbola &hyperbolaSegment, GCSsys.addConstraintArcOfHyperbolaRules(a); if(!fixed) { - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::start)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::start)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::end)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::end)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1X), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1Y), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(rmin), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a1), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a2), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1X), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1Y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(rmin), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a1), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a2), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); } @@ -1115,16 +1115,16 @@ int Sketch::addArcOfParabola(const Part::GeomArcOfParabola ¶bolaSegment, boo GCSsys.addConstraintArcOfParabolaRules(a); if(!fixed) { - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::start)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::start)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::end)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::end)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p4.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p4.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a1), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a2), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p4.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p4.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a1), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a2), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); } // return the position of the newly added geometry @@ -1191,8 +1191,8 @@ int Sketch::addBSpline(const Part::GeomBSplineCurve &bspline, bool fixed) spoles.push_back(p); if(!fixed) { - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p.x), std::forward_as_tuple(Geoms.size(), Sketcher::none)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p.y), std::forward_as_tuple(Geoms.size(), Sketcher::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p.x), std::forward_as_tuple(Geoms.size(), Sketcher::PointPos::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p.y), std::forward_as_tuple(Geoms.size(), Sketcher::PointPos::none)); } } @@ -1204,7 +1204,7 @@ int Sketch::addBSpline(const Part::GeomBSplineCurve &bspline, bool fixed) sweights.push_back(params[params.size()-1]); if(!fixed) { - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(r), std::forward_as_tuple(Geoms.size(), Sketcher::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(r), std::forward_as_tuple(Geoms.size(), Sketcher::PointPos::none)); } } @@ -1286,10 +1286,10 @@ int Sketch::addBSpline(const Part::GeomBSplineCurve &bspline, bool fixed) if(!fixed) { // Note: Poles and weight parameters are emplaced above - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::start)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::start)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::end)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::end)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end)); } // return the position of the newly added geometry @@ -1336,9 +1336,9 @@ int Sketch::addCircle(const Part::GeomCircle &cir, bool fixed) Geoms.push_back(def); if(!fixed) { - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(r), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(r), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); } // return the position of the newly added geometry @@ -1400,11 +1400,11 @@ int Sketch::addEllipse(const Part::GeomEllipse &elip, bool fixed) Geoms.push_back(def); if(!fixed) { - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(c.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(c.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1X), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1Y), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); - param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(rmin), std::forward_as_tuple(Geoms.size()-1, Sketcher::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(c.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(c.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1X), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1Y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); + param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(rmin), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none)); } // return the position of the newly added geometry @@ -1535,7 +1535,7 @@ int Sketch::addConstraint(const Constraint *constraint) switch (constraint->Type) { case DistanceX: - if (constraint->FirstPos == none){ // horizontal length of a line + if (constraint->FirstPos == PointPos::none){ // horizontal length of a line c.value = new double(constraint->getValue()); if(c.driving) FixParameters.push_back(c.value); @@ -1557,7 +1557,7 @@ int Sketch::addConstraint(const Constraint *constraint) rtn = addCoordinateXConstraint(constraint->First,constraint->FirstPos,c.value,c.driving); } - else if (constraint->SecondPos != none) {// point to point horizontal distance + else if (constraint->SecondPos != PointPos::none) {// point to point horizontal distance c.value = new double(constraint->getValue()); if(c.driving) FixParameters.push_back(c.value); @@ -1571,7 +1571,7 @@ int Sketch::addConstraint(const Constraint *constraint) } break; case DistanceY: - if (constraint->FirstPos == none){ // vertical length of a line + if (constraint->FirstPos == PointPos::none){ // vertical length of a line c.value = new double(constraint->getValue()); if(c.driving) FixParameters.push_back(c.value); @@ -1593,7 +1593,7 @@ int Sketch::addConstraint(const Constraint *constraint) rtn = addCoordinateYConstraint(constraint->First,constraint->FirstPos,c.value,c.driving); } - else if (constraint->SecondPos != none){ // point to point vertical distance + else if (constraint->SecondPos != PointPos::none){ // point to point vertical distance c.value = new double(constraint->getValue()); if(c.driving) FixParameters.push_back(c.value); @@ -1630,8 +1630,8 @@ int Sketch::addConstraint(const Constraint *constraint) rtn = addParallelConstraint(constraint->First,constraint->Second); break; case Perpendicular: - if (constraint->FirstPos == none && - constraint->SecondPos == none && + if (constraint->FirstPos == PointPos::none && + constraint->SecondPos == PointPos::none && constraint->Third == GeoEnum::GeoUndef){ //simple perpendicularity rtn = addPerpendicularConstraint(constraint->First,constraint->Second); @@ -1653,8 +1653,8 @@ int Sketch::addConstraint(const Constraint *constraint) } break; case Tangent: - if (constraint->FirstPos == none && - constraint->SecondPos == none && + if (constraint->FirstPos == PointPos::none && + constraint->SecondPos == PointPos::none && constraint->Third == GeoEnum::GeoUndef){ //simple tangency rtn = addTangentConstraint(constraint->First,constraint->Second); @@ -1676,7 +1676,7 @@ int Sketch::addConstraint(const Constraint *constraint) } break; case Distance: - if (constraint->SecondPos != none){ // point to point distance + if (constraint->SecondPos != PointPos::none){ // point to point distance c.value = new double(constraint->getValue()); if(c.driving) FixParameters.push_back(c.value); @@ -1689,7 +1689,7 @@ int Sketch::addConstraint(const Constraint *constraint) c.value,c.driving); } else if (constraint->Second != GeoEnum::GeoUndef) { - if (constraint->FirstPos != none) { // point to line distance + if (constraint->FirstPos != PointPos::none) { // point to line distance c.value = new double(constraint->getValue()); if(c.driving) FixParameters.push_back(c.value); @@ -1728,7 +1728,7 @@ int Sketch::addConstraint(const Constraint *constraint) constraint->Second, constraint->SecondPos, constraint->Third, constraint->ThirdPos, c.value, constraint->Type,c.driving); - } else if (constraint->SecondPos != none){ // angle between two lines (with explicit start points) + } else if (constraint->SecondPos != PointPos::none){ // angle between two lines (with explicit start points) c.value = new double(constraint->getValue()); if(c.driving) FixParameters.push_back(c.value); @@ -1806,7 +1806,7 @@ int Sketch::addConstraint(const Constraint *constraint) rtn = addEqualConstraint(constraint->First,constraint->Second); break; case Symmetric: - if (constraint->ThirdPos != none) + if (constraint->ThirdPos != PointPos::none) rtn = addSymmetricConstraint(constraint->First,constraint->FirstPos, constraint->Second,constraint->SecondPos, constraint->Third,constraint->ThirdPos); @@ -2376,8 +2376,8 @@ int Sketch::addAngleAtPointConstraint( } bool avp = geoId3!=GeoEnum::GeoUndef; //is angle-via-point? - bool e2c = pos2 == none && pos1 != none;//is endpoint-to-curve? - bool e2e = pos2 != none && pos1 != none;//is endpoint-to-endpoint? + bool e2c = pos2 == PointPos::none && pos1 != PointPos::none;//is endpoint-to-curve? + bool e2e = pos2 != PointPos::none && pos1 != PointPos::none;//is endpoint-to-endpoint? if (!( avp || e2c || e2e )) { //assert(0);//none of the three types. Why are we here?? @@ -2616,19 +2616,19 @@ int Sketch::addAngleConstraint(int geoId1, PointPos pos1, int geoId2, PointPos p return -1; GCS::Point *l1p1=0, *l1p2=0; - if (pos1 == start) { + if (pos1 == PointPos::start) { l1p1 = &Points[Geoms[geoId1].startPointId]; l1p2 = &Points[Geoms[geoId1].endPointId]; - } else if (pos1 == end) { + } else if (pos1 == PointPos::end) { l1p1 = &Points[Geoms[geoId1].endPointId]; l1p2 = &Points[Geoms[geoId1].startPointId]; } GCS::Point *l2p1=0, *l2p2=0; - if (pos2 == start) { + if (pos2 == PointPos::start) { l2p1 = &Points[Geoms[geoId2].startPointId]; l2p2 = &Points[Geoms[geoId2].endPointId]; - } else if (pos2 == end) { + } else if (pos2 == PointPos::end) { l2p1 = &Points[Geoms[geoId2].endPointId]; l2p2 = &Points[Geoms[geoId2].startPointId]; } @@ -2909,7 +2909,7 @@ int Sketch::addSnellsLawConstraint(int geoIdRay1, PointPos posRay1, GCSsys.addConstraintSnellsLaw(*ray1, *ray2, *boundary, p1, n1, n2, - posRay1==start, posRay2 == end, + posRay1 == PointPos::start, posRay2 == PointPos::end, tag, driving); return ConstraintsCounter; } @@ -2927,8 +2927,8 @@ int Sketch::addInternalAlignmentEllipseMajorDiameter(int geoId1, int geoId2) if (Geoms[geoId2].type != Line) return -1; - int pointId1 = getPointId(geoId2, start); - int pointId2 = getPointId(geoId2, end); + int pointId1 = getPointId(geoId2, PointPos::start); + int pointId2 = getPointId(geoId2, PointPos::end); if (pointId1 >= 0 && pointId1 < int(Points.size()) && pointId2 >= 0 && pointId2 < int(Points.size())) { @@ -2969,8 +2969,8 @@ int Sketch::addInternalAlignmentEllipseMinorDiameter(int geoId1, int geoId2) if (Geoms[geoId2].type != Line) return -1; - int pointId1 = getPointId(geoId2, start); - int pointId2 = getPointId(geoId2, end); + int pointId1 = getPointId(geoId2, PointPos::start); + int pointId2 = getPointId(geoId2, PointPos::end); if (pointId1 >= 0 && pointId1 < int(Points.size()) && pointId2 >= 0 && pointId2 < int(Points.size())) { @@ -3010,7 +3010,7 @@ int Sketch::addInternalAlignmentEllipseFocus1(int geoId1, int geoId2) if (Geoms[geoId2].type != Point) return -1; - int pointId1 = getPointId(geoId2, start); + int pointId1 = getPointId(geoId2, PointPos::start); if (pointId1 >= 0 && pointId1 < int(Points.size())) { GCS::Point &p1 = Points[pointId1]; @@ -3049,7 +3049,7 @@ int Sketch::addInternalAlignmentEllipseFocus2(int geoId1, int geoId2) if (Geoms[geoId2].type != Point) return -1; - int pointId1 = getPointId(geoId2, start); + int pointId1 = getPointId(geoId2, PointPos::start); if (pointId1 >= 0 && pointId1 < int(Points.size())) { GCS::Point &p1 = Points[pointId1]; @@ -3088,8 +3088,8 @@ int Sketch::addInternalAlignmentHyperbolaMajorDiameter(int geoId1, int geoId2) if (Geoms[geoId2].type != Line) return -1; - int pointId1 = getPointId(geoId2, start); - int pointId2 = getPointId(geoId2, end); + int pointId1 = getPointId(geoId2, PointPos::start); + int pointId2 = getPointId(geoId2, PointPos::end); if (pointId1 >= 0 && pointId1 < int(Points.size()) && pointId2 >= 0 && pointId2 < int(Points.size())) { @@ -3119,8 +3119,8 @@ int Sketch::addInternalAlignmentHyperbolaMinorDiameter(int geoId1, int geoId2) if (Geoms[geoId2].type != Line) return -1; - int pointId1 = getPointId(geoId2, start); - int pointId2 = getPointId(geoId2, end); + int pointId1 = getPointId(geoId2, PointPos::start); + int pointId2 = getPointId(geoId2, PointPos::end); if (pointId1 >= 0 && pointId1 < int(Points.size()) && pointId2 >= 0 && pointId2 < int(Points.size())) { @@ -3150,7 +3150,7 @@ int Sketch::addInternalAlignmentHyperbolaFocus(int geoId1, int geoId2) if (Geoms[geoId2].type != Point) return -1; - int pointId1 = getPointId(geoId2, start); + int pointId1 = getPointId(geoId2, PointPos::start); if (pointId1 >= 0 && pointId1 < int(Points.size())) { GCS::Point &p1 = Points[pointId1]; @@ -3176,7 +3176,7 @@ int Sketch::addInternalAlignmentParabolaFocus(int geoId1, int geoId2) if (Geoms[geoId2].type != Point) return -1; - int pointId1 = getPointId(geoId2, start); + int pointId1 = getPointId(geoId2, PointPos::start); if (pointId1 >= 0 && pointId1 < int(Points.size())) { GCS::Point &p1 = Points[pointId1]; @@ -3202,7 +3202,7 @@ int Sketch::addInternalAlignmentBSplineControlPoint(int geoId1, int geoId2, int if (Geoms[geoId2].type != Circle) return -1; - int pointId1 = getPointId(geoId2, mid); + int pointId1 = getPointId(geoId2, PointPos::mid); if (pointId1 >= 0 && pointId1 < int(Points.size())) { GCS::Circle &c = Circles[Geoms[geoId2].index]; @@ -3230,7 +3230,7 @@ int Sketch::addInternalAlignmentKnotPoint(int geoId1, int geoId2, int knotindex) if (Geoms[geoId2].type != Point) return -1; - int pointId1 = getPointId(geoId2, start); + int pointId1 = getPointId(geoId2, PointPos::start); if (pointId1 >= 0 && pointId1 < int(Points.size())) { // GCS::Point &p = Points[pointId1]; @@ -3461,7 +3461,7 @@ bool Sketch::updateGeometry() point->setPoint(pointcoords); // update the geompoint of the knot (geometry update) // Now we update the position of the points in the solver, so that any call to solve() // calculates constraints and positions based on the actual position of the knots. - auto pointindex = getPointId(*it5, start); + auto pointindex = getPointId(*it5, PointPos::start); auto solverpoint = Points[pointindex]; *(solverpoint.x) = pointcoords.x; *(solverpoint.y) = pointcoords.y; @@ -3706,7 +3706,7 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine) } if (Geoms[geoId].type == Point) { - if (pos == start) { + if (pos == PointPos::start) { GCS::Point &point = Points[Geoms[geoId].startPointId]; GCS::Point p0; MoveParameters.resize(2); // px,py @@ -3717,23 +3717,23 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine) GCSsys.addConstraintP2PCoincident(p0,point,GCS::DefaultTemporaryConstraint); } } else if (Geoms[geoId].type == Line) { - if (pos == start || pos == end) { + if (pos == PointPos::start || pos == PointPos::end) { MoveParameters.resize(2); // x,y GCS::Point p0; p0.x = &MoveParameters[0]; p0.y = &MoveParameters[1]; - if (pos == start) { + if (pos == PointPos::start) { GCS::Point &p = Points[Geoms[geoId].startPointId]; *p0.x = *p.x; *p0.y = *p.y; GCSsys.addConstraintP2PCoincident(p0,p,GCS::DefaultTemporaryConstraint); - } else if (pos == end) { + } else if (pos == PointPos::end) { GCS::Point &p = Points[Geoms[geoId].endPointId]; *p0.x = *p.x; *p0.y = *p.y; GCSsys.addConstraintP2PCoincident(p0,p,GCS::DefaultTemporaryConstraint); } - } else if (pos == none || pos == mid) { + } else if (pos == PointPos::none || pos == PointPos::mid) { MoveParameters.resize(4); // x1,y1,x2,y2 GCS::Point p1, p2; p1.x = &MoveParameters[0]; @@ -3751,14 +3751,14 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine) } else if (Geoms[geoId].type == Circle) { GCS::Point ¢er = Points[Geoms[geoId].midPointId]; GCS::Point p0,p1; - if (pos == mid) { + if (pos == PointPos::mid) { MoveParameters.resize(2); // cx,cy p0.x = &MoveParameters[0]; p0.y = &MoveParameters[1]; *p0.x = *center.x; *p0.y = *center.y; GCSsys.addConstraintP2PCoincident(p0,center,GCS::DefaultTemporaryConstraint); - } else if (pos == none) { + } else if (pos == PointPos::none) { //bool pole = GeometryFacade::isInternalType(Geoms[geoId].geo, InternalType::BSplineControlPoint); MoveParameters.resize(4); // x,y,cx,cy - For poles blocking the center GCS::Circle &c = Circles[Geoms[geoId].index]; @@ -3779,7 +3779,7 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine) GCS::Point ¢er = Points[Geoms[geoId].midPointId]; GCS::Point p0,p1; - if (pos == mid || pos == none) { + if (pos == PointPos::mid || pos == PointPos::none) { MoveParameters.resize(2); // cx,cy p0.x = &MoveParameters[0]; p0.y = &MoveParameters[1]; @@ -3792,7 +3792,7 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine) GCS::Point ¢er = Points[Geoms[geoId].midPointId]; GCS::Point p0,p1; - if (pos == mid || pos == none) { + if (pos == PointPos::mid || pos == PointPos::none) { MoveParameters.resize(2); // cx,cy p0.x = &MoveParameters[0]; p0.y = &MoveParameters[1]; @@ -3800,12 +3800,12 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine) *p0.y = *center.y; GCSsys.addConstraintP2PCoincident(p0,center,GCS::DefaultTemporaryConstraint); - } else if (pos == start || pos == end) { + } else if (pos == PointPos::start || pos == PointPos::end) { MoveParameters.resize(4); // x,y,cx,cy - if (pos == start || pos == end) { - GCS::Point &p = (pos == start) ? Points[Geoms[geoId].startPointId] - : Points[Geoms[geoId].endPointId];; + if (pos == PointPos::start || pos == PointPos::end) { + GCS::Point &p = (pos == PointPos::start) ? Points[Geoms[geoId].startPointId] + : Points[Geoms[geoId].endPointId];; p0.x = &MoveParameters[0]; p0.y = &MoveParameters[1]; *p0.x = *p.x; @@ -3827,7 +3827,7 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine) GCS::Point ¢er = Points[Geoms[geoId].midPointId]; GCS::Point p0,p1; - if (pos == mid || pos == none) { + if (pos == PointPos::mid || pos == PointPos::none) { MoveParameters.resize(2); // cx,cy p0.x = &MoveParameters[0]; p0.y = &MoveParameters[1]; @@ -3835,12 +3835,12 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine) *p0.y = *center.y; GCSsys.addConstraintP2PCoincident(p0,center,GCS::DefaultTemporaryConstraint); - } else if (pos == start || pos == end) { + } else if (pos == PointPos::start || pos == PointPos::end) { MoveParameters.resize(4); // x,y,cx,cy - if (pos == start || pos == end) { - GCS::Point &p = (pos == start) ? Points[Geoms[geoId].startPointId] - : Points[Geoms[geoId].endPointId];; + if (pos == PointPos::start || pos == PointPos::end) { + GCS::Point &p = (pos == PointPos::start) ? Points[Geoms[geoId].startPointId] + : Points[Geoms[geoId].endPointId];; p0.x = &MoveParameters[0]; p0.y = &MoveParameters[1]; *p0.x = *p.x; @@ -3862,7 +3862,7 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine) GCS::Point ¢er = Points[Geoms[geoId].midPointId]; GCS::Point p0,p1; - if (pos == mid || pos == none) { + if (pos == PointPos::mid || pos == PointPos::none) { MoveParameters.resize(2); // cx,cy p0.x = &MoveParameters[0]; p0.y = &MoveParameters[1]; @@ -3870,12 +3870,12 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine) *p0.y = *center.y; GCSsys.addConstraintP2PCoincident(p0,center,GCS::DefaultTemporaryConstraint); - } else if (pos == start || pos == end) { + } else if (pos == PointPos::start || pos == PointPos::end) { MoveParameters.resize(4); // x,y,cx,cy - if (pos == start || pos == end) { - GCS::Point &p = (pos == start) ? Points[Geoms[geoId].startPointId] - : Points[Geoms[geoId].endPointId];; + if (pos == PointPos::start || pos == PointPos::end) { + GCS::Point &p = (pos == PointPos::start) ? Points[Geoms[geoId].startPointId] + : Points[Geoms[geoId].endPointId];; p0.x = &MoveParameters[0]; p0.y = &MoveParameters[1]; *p0.x = *p.x; @@ -3894,23 +3894,23 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine) } } else if (Geoms[geoId].type == BSpline) { - if (pos == start || pos == end) { + if (pos == PointPos::start || pos == PointPos::end) { MoveParameters.resize(2); // x,y GCS::Point p0; p0.x = &MoveParameters[0]; p0.y = &MoveParameters[1]; - if (pos == start) { + if (pos == PointPos::start) { GCS::Point &p = Points[Geoms[geoId].startPointId]; *p0.x = *p.x; *p0.y = *p.y; GCSsys.addConstraintP2PCoincident(p0,p,GCS::DefaultTemporaryConstraint); - } else if (pos == end) { + } else if (pos == PointPos::end) { GCS::Point &p = Points[Geoms[geoId].endPointId]; *p0.x = *p.x; *p0.y = *p.y; GCSsys.addConstraintP2PCoincident(p0,p,GCS::DefaultTemporaryConstraint); } - } else if (pos == none || pos == mid) { + } else if (pos == PointPos::none || pos == PointPos::mid) { GCS::BSpline &bsp = BSplines[Geoms[geoId].index]; MoveParameters.resize(bsp.poles.size()*2); // x0,y0,x1,y1,....xp,yp @@ -3931,24 +3931,24 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine) } else if (Geoms[geoId].type == Arc) { GCS::Point ¢er = Points[Geoms[geoId].midPointId]; GCS::Point p0,p1; - if (pos == mid) { + if (pos == PointPos::mid) { MoveParameters.resize(2); // cx,cy p0.x = &MoveParameters[0]; p0.y = &MoveParameters[1]; *p0.x = *center.x; *p0.y = *center.y; GCSsys.addConstraintP2PCoincident(p0,center,GCS::DefaultTemporaryConstraint); - } else if (pos == start || pos == end || pos == none) { + } else if (pos == PointPos::start || pos == PointPos::end || pos == PointPos::none) { MoveParameters.resize(4); // x,y,cx,cy - if (pos == start || pos == end) { - GCS::Point &p = (pos == start) ? Points[Geoms[geoId].startPointId] + if (pos == PointPos::start || pos == PointPos::end) { + GCS::Point &p = (pos == PointPos::start) ? Points[Geoms[geoId].startPointId] : Points[Geoms[geoId].endPointId];; p0.x = &MoveParameters[0]; p0.y = &MoveParameters[1]; *p0.x = *p.x; *p0.y = *p.y; GCSsys.addConstraintP2PCoincident(p0,p,GCS::DefaultTemporaryConstraint); - } else if (pos == none) { + } else if (pos == PointPos::none) { GCS::Arc &a = Arcs[Geoms[geoId].index]; p0.x = &MoveParameters[0]; p0.y = &MoveParameters[1]; @@ -4010,15 +4010,15 @@ int Sketch::movePoint(int geoId, PointPos pos, Base::Vector3d toPoint, bool rela MoveParameters[i+1] = InitParameters[i+1] + toPoint.y; } } else if (Geoms[geoId].type == Point) { - if (pos == start) { + if (pos == PointPos::start) { MoveParameters[0] = toPoint.x; MoveParameters[1] = toPoint.y; } } else if (Geoms[geoId].type == Line) { - if (pos == start || pos == end) { + if (pos == PointPos::start || pos == PointPos::end) { MoveParameters[0] = toPoint.x; MoveParameters[1] = toPoint.y; - } else if (pos == none || pos == mid) { + } else if (pos == PointPos::none || pos == PointPos::mid) { double dx = (InitParameters[2]-InitParameters[0])/2; double dy = (InitParameters[3]-InitParameters[1])/2; MoveParameters[0] = toPoint.x - dx; @@ -4027,40 +4027,40 @@ int Sketch::movePoint(int geoId, PointPos pos, Base::Vector3d toPoint, bool rela MoveParameters[3] = toPoint.y + dy; } } else if (Geoms[geoId].type == Circle) { - if (pos == mid || pos == none) { + if (pos == PointPos::mid || pos == PointPos::none) { MoveParameters[0] = toPoint.x; MoveParameters[1] = toPoint.y; } } else if (Geoms[geoId].type == Arc) { - if (pos == start || pos == end || pos == mid || pos == none) { + if (pos == PointPos::start || pos == PointPos::end || pos == PointPos::mid || pos == PointPos::none) { MoveParameters[0] = toPoint.x; MoveParameters[1] = toPoint.y; } } else if (Geoms[geoId].type == Ellipse) { - if (pos == mid || pos == none) { + if (pos == PointPos::mid || pos == PointPos::none) { MoveParameters[0] = toPoint.x; MoveParameters[1] = toPoint.y; } } else if (Geoms[geoId].type == ArcOfEllipse) { - if (pos == start || pos == end || pos == mid || pos == none) { + if (pos == PointPos::start || pos == PointPos::end || pos == PointPos::mid || pos == PointPos::none) { MoveParameters[0] = toPoint.x; MoveParameters[1] = toPoint.y; } } else if (Geoms[geoId].type == ArcOfHyperbola) { - if (pos == start || pos == end || pos == mid || pos == none) { + if (pos == PointPos::start || pos == PointPos::end || pos == PointPos::mid || pos == PointPos::none) { MoveParameters[0] = toPoint.x; MoveParameters[1] = toPoint.y; } } else if (Geoms[geoId].type == ArcOfParabola) { - if (pos == start || pos == end || pos == mid || pos == none) { + if (pos == PointPos::start || pos == PointPos::end || pos == PointPos::mid || pos == PointPos::none) { MoveParameters[0] = toPoint.x; MoveParameters[1] = toPoint.y; } } else if (Geoms[geoId].type == BSpline) { - if (pos == start || pos == end) { + if (pos == PointPos::start || pos == PointPos::end) { MoveParameters[0] = toPoint.x; MoveParameters[1] = toPoint.y; - } else if (pos == none || pos == mid) { + } else if (pos == PointPos::none || pos == PointPos::mid) { GCS::BSpline &bsp = BSplines[Geoms[geoId].index]; double cx = 0, cy = 0; // geometric center @@ -4095,13 +4095,13 @@ int Sketch::getPointId(int geoId, PointPos pos) const if (geoId < 0 || geoId >= (int)Geoms.size()) return -1; switch (pos) { - case start: + case PointPos::start: return Geoms[geoId].startPointId; - case end: + case PointPos::end: return Geoms[geoId].endPointId; - case mid: + case PointPos::mid: return Geoms[geoId].midPointId; - case none: + case PointPos::none: break; } return -1; diff --git a/src/Mod/Sketcher/App/SketchAnalysis.cpp b/src/Mod/Sketcher/App/SketchAnalysis.cpp index e65c28d7ec..ff2a0433c0 100644 --- a/src/Mod/Sketcher/App/SketchAnalysis.cpp +++ b/src/Mod/Sketcher/App/SketchAnalysis.cpp @@ -154,11 +154,11 @@ int SketchAnalysis::detectMissingPointOnPointConstraints(double precision, bool const Part::GeomLineSegment *segm = static_cast(gf->getGeometry()); VertexIds id; id.GeoId = (int)i; - id.PosId = Sketcher::start; + id.PosId = Sketcher::PointPos::start; id.v = segm->getStartPoint(); vertexIds.push_back(id); id.GeoId = (int)i; - id.PosId = Sketcher::end; + id.PosId = Sketcher::PointPos::end; id.v = segm->getEndPoint(); vertexIds.push_back(id); } @@ -166,11 +166,11 @@ int SketchAnalysis::detectMissingPointOnPointConstraints(double precision, bool const Part::GeomArcOfCircle *segm = static_cast(gf->getGeometry()); VertexIds id; id.GeoId = (int)i; - id.PosId = Sketcher::start; + id.PosId = Sketcher::PointPos::start; id.v = segm->getStartPoint(/*emulateCCW=*/true); vertexIds.push_back(id); id.GeoId = (int)i; - id.PosId = Sketcher::end; + id.PosId = Sketcher::PointPos::end; id.v = segm->getEndPoint(/*emulateCCW=*/true); vertexIds.push_back(id); } @@ -178,11 +178,11 @@ int SketchAnalysis::detectMissingPointOnPointConstraints(double precision, bool const Part::GeomArcOfEllipse *segm = static_cast(gf->getGeometry()); VertexIds id; id.GeoId = (int)i; - id.PosId = Sketcher::start; + id.PosId = Sketcher::PointPos::start; id.v = segm->getStartPoint(/*emulateCCW=*/true); vertexIds.push_back(id); id.GeoId = (int)i; - id.PosId = Sketcher::end; + id.PosId = Sketcher::PointPos::end; id.v = segm->getEndPoint(/*emulateCCW=*/true); vertexIds.push_back(id); } @@ -190,11 +190,11 @@ int SketchAnalysis::detectMissingPointOnPointConstraints(double precision, bool const Part::GeomArcOfHyperbola *segm = static_cast(gf->getGeometry()); VertexIds id; id.GeoId = (int)i; - id.PosId = Sketcher::start; + id.PosId = Sketcher::PointPos::start; id.v = segm->getStartPoint(); vertexIds.push_back(id); id.GeoId = (int)i; - id.PosId = Sketcher::end; + id.PosId = Sketcher::PointPos::end; id.v = segm->getEndPoint(); vertexIds.push_back(id); } @@ -202,11 +202,11 @@ int SketchAnalysis::detectMissingPointOnPointConstraints(double precision, bool const Part::GeomArcOfParabola *segm = static_cast(gf->getGeometry()); VertexIds id; id.GeoId = (int)i; - id.PosId = Sketcher::start; + id.PosId = Sketcher::PointPos::start; id.v = segm->getStartPoint(); vertexIds.push_back(id); id.GeoId = (int)i; - id.PosId = Sketcher::end; + id.PosId = Sketcher::PointPos::end; id.v = segm->getEndPoint(); vertexIds.push_back(id); } @@ -214,11 +214,11 @@ int SketchAnalysis::detectMissingPointOnPointConstraints(double precision, bool const Part::GeomBSplineCurve *segm = static_cast(gf->getGeometry()); VertexIds id; id.GeoId = (int)i; - id.PosId = Sketcher::start; + id.PosId = Sketcher::PointPos::start; id.v = segm->getStartPoint(); vertexIds.push_back(id); id.GeoId = (int)i; - id.PosId = Sketcher::end; + id.PosId = Sketcher::PointPos::end; id.v = segm->getEndPoint(); vertexIds.push_back(id); } @@ -406,9 +406,9 @@ int SketchAnalysis::detectMissingVerticalHorizontalConstraints(double anglepreci id.v = dir; id.First = (int)i; - id.FirstPos = Sketcher::none; + id.FirstPos = Sketcher::PointPos::none; id.Second = GeoEnum::GeoUndef; - id.SecondPos = Sketcher::none; + id.SecondPos = Sketcher::PointPos::none; if( checkVertical(dir, angleprecision) ) { id.Type = Sketcher::Vertical; @@ -528,9 +528,9 @@ int SketchAnalysis::detectMissingEqualityConstraints(double precision) id.Type = Equal; id.v.x = vt->l; id.First = vt->GeoId; - id.FirstPos = Sketcher::none; + id.FirstPos = Sketcher::PointPos::none; id.Second = vn->GeoId; - id.SecondPos = Sketcher::none; + id.SecondPos = Sketcher::PointPos::none; equallines.push_back(id); } else { @@ -558,9 +558,9 @@ int SketchAnalysis::detectMissingEqualityConstraints(double precision) id.Type = Equal; id.v.x = vt->l; id.First = vt->GeoId; - id.FirstPos = Sketcher::none; + id.FirstPos = Sketcher::PointPos::none; id.Second = vn->GeoId; - id.SecondPos = Sketcher::none; + id.SecondPos = Sketcher::PointPos::none; equalradius.push_back(id); } else { diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 4955cff462..d99f62be59 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -750,59 +750,59 @@ Base::Vector3d SketchObject::getPoint(int GeoId, PointPos PosId) const const Part::Geometry *geo = getGeometry(GeoId); if (geo->getTypeId() == Part::GeomPoint::getClassTypeId()) { const Part::GeomPoint *p = static_cast(geo); - if (PosId == start || PosId == mid || PosId == end) + if (PosId == PointPos::start || PosId == PointPos::mid || PosId == PointPos::end) return p->getPoint(); } else if (geo->getTypeId() == Part::GeomLineSegment::getClassTypeId()) { const Part::GeomLineSegment *lineSeg = static_cast(geo); - if (PosId == start) + if (PosId == PointPos::start) return lineSeg->getStartPoint(); - else if (PosId == end) + else if (PosId == PointPos::end) return lineSeg->getEndPoint(); } else if (geo->getTypeId() == Part::GeomCircle::getClassTypeId()) { const Part::GeomCircle *circle = static_cast(geo); - if (PosId == mid) + if (PosId == PointPos::mid) return circle->getCenter(); } else if (geo->getTypeId() == Part::GeomEllipse::getClassTypeId()) { const Part::GeomEllipse *ellipse = static_cast(geo); - if (PosId == mid) + if (PosId == PointPos::mid) return ellipse->getCenter(); } else if (geo->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) { const Part::GeomArcOfCircle *aoc = static_cast(geo); - if (PosId == start) + if (PosId == PointPos::start) return aoc->getStartPoint(/*emulateCCW=*/true); - else if (PosId == end) + else if (PosId == PointPos::end) return aoc->getEndPoint(/*emulateCCW=*/true); - else if (PosId == mid) + else if (PosId == PointPos::mid) return aoc->getCenter(); } else if (geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()) { const Part::GeomArcOfEllipse *aoc = static_cast(geo); - if (PosId == start) + if (PosId == PointPos::start) return aoc->getStartPoint(/*emulateCCW=*/true); - else if (PosId == end) + else if (PosId == PointPos::end) return aoc->getEndPoint(/*emulateCCW=*/true); - else if (PosId == mid) + else if (PosId == PointPos::mid) return aoc->getCenter(); } else if (geo->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId()) { const Part::GeomArcOfHyperbola *aoh = static_cast(geo); - if (PosId == start) + if (PosId == PointPos::start) return aoh->getStartPoint(); - else if (PosId == end) + else if (PosId == PointPos::end) return aoh->getEndPoint(); - else if (PosId == mid) + else if (PosId == PointPos::mid) return aoh->getCenter(); } else if (geo->getTypeId() == Part::GeomArcOfParabola::getClassTypeId()) { const Part::GeomArcOfParabola *aop = static_cast(geo); - if (PosId == start) + if (PosId == PointPos::start) return aop->getStartPoint(); - else if (PosId == end) + else if (PosId == PointPos::end) return aop->getEndPoint(); - else if (PosId == mid) + else if (PosId == PointPos::mid) return aop->getCenter(); } else if (geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId()) { const Part::GeomBSplineCurve *bsp = static_cast(geo); - if (PosId == start) + if (PosId == PointPos::start) return bsp->getStartPoint(); - else if (PosId == end) + else if (PosId == PointPos::end) return bsp->getEndPoint(); } @@ -975,13 +975,13 @@ int SketchObject::delGeometry(int GeoId, bool deleteinternalgeo) // Find coincident points to replace the points of the deleted geometry std::vector GeoIdList; std::vector PosIdList; - for (PointPos PosId = start; PosId != mid; ) { + for (PointPos PosId = PointPos::start; PosId != PointPos::mid; ) { getDirectlyCoincidentPoints(GeoId, PosId, GeoIdList, PosIdList); if (GeoIdList.size() > 1) { delConstraintOnPoint(GeoId, PosId, true /* only coincidence */); transferConstraints(GeoIdList[0], PosIdList[0], GeoIdList[1], PosIdList[1]); } - PosId = (PosId == start) ? end : mid; // loop through [start, end, mid] + PosId = (PosId == PointPos::start) ? PointPos::end : PointPos::mid; // loop through [start, end, mid] } const std::vector< Constraint * > &constraints = this->Constraints.getValues(); @@ -1065,13 +1065,13 @@ int SketchObject::delGeometriesExclusiveList(const std::vector& GeoIds) // Find coincident points to replace the points of the deleted geometry std::vector GeoIdList; std::vector PosIdList; - for (PointPos PosId = start; PosId != mid; ) { + for (PointPos PosId = PointPos::start; PosId != PointPos::mid; ) { getDirectlyCoincidentPoints(GeoId, PosId, GeoIdList, PosIdList); if (GeoIdList.size() > 1) { delConstraintOnPoint(GeoId, PosId, true /* only coincidence */); transferConstraints(GeoIdList[0], PosIdList[0], GeoIdList[1], PosIdList[1]); } - PosId = (PosId == start) ? end : mid; // loop through [start, end, mid] + PosId = (PosId == PointPos::start) ? PointPos::end : PointPos::mid; // loop through [start, end, mid] } } @@ -1383,7 +1383,7 @@ int SketchObject::delConstraintOnPoint(int VertexId, bool onlyCoincident) PointPos PosId; if (VertexId == GeoEnum::RtPnt) { // RootPoint GeoId = Sketcher::GeoEnum::RtPnt; - PosId = start; + PosId = PointPos::start; } else getGeoVertexIndex(VertexId, GeoId, PosId); @@ -1398,7 +1398,7 @@ int SketchObject::delConstraintOnPoint(int GeoId, PointPos PosId, bool onlyCoinc // check if constraints can be redirected to some other point int replaceGeoId=GeoEnum::GeoUndef; - PointPos replacePosId=Sketcher::none; + PointPos replacePosId=Sketcher::PointPos::none; if (!onlyCoincident) { for (std::vector::const_iterator it = vals.begin(); it != vals.end(); ++it) { if ((*it)->Type == Sketcher::Coincident) { @@ -1442,8 +1442,8 @@ int SketchObject::delConstraintOnPoint(int GeoId, PointPos PosId, bool onlyCoinc else if (!onlyCoincident) { if ((*it)->Type == Sketcher::Distance || (*it)->Type == Sketcher::DistanceX || (*it)->Type == Sketcher::DistanceY) { - if ((*it)->First == GeoId && (*it)->FirstPos == none && - (PosId == start || PosId == end)) { + if ((*it)->First == GeoId && (*it)->FirstPos == PointPos::none && + (PosId == PointPos::start || PosId == PointPos::end)) { // remove the constraint even if it is not directly associated // with the given point continue; // skip this constraint @@ -1523,8 +1523,8 @@ void SketchObject::transferFilletConstraints(int geoId1, PointPos posId1, int ge for (int i=0; i < int(constraints.size()); i++) { const Constraint *c = constraints[i]; if (c->Type == Sketcher::Distance || c->Type == Sketcher::Equal) { - bool line1 = c->First == geoId1 && c->FirstPos == none; - bool line2 = c->First == geoId2 && c->FirstPos == none; + bool line1 = c->First == geoId1 && c->FirstPos == PointPos::none; + bool line2 = c->First == geoId2 && c->FirstPos == PointPos::none; if (line1 || line2) { deleteme.push_back(i); } @@ -1554,17 +1554,17 @@ void SketchObject::transferFilletConstraints(int geoId1, PointPos posId1, int ge Sketcher::Constraint *cornerToLine1 = new Sketcher::Constraint(); cornerToLine1->Type = Sketcher::PointOnObject; cornerToLine1->First = originalCornerId; - cornerToLine1->FirstPos = start; + cornerToLine1->FirstPos = PointPos::start; cornerToLine1->Second = geoId1; - cornerToLine1->SecondPos = none; + cornerToLine1->SecondPos = PointPos::none; addConstraint(cornerToLine1); delete cornerToLine1; Sketcher::Constraint *cornerToLine2 = new Sketcher::Constraint(); cornerToLine2->Type = Sketcher::PointOnObject; cornerToLine2->First = originalCornerId; - cornerToLine2->FirstPos = start; + cornerToLine2->FirstPos = PointPos::start; cornerToLine2->Second = geoId2; - cornerToLine2->SecondPos = none; + cornerToLine2->SecondPos = PointPos::none; addConstraint(cornerToLine2); delete cornerToLine2; @@ -1580,10 +1580,10 @@ void SketchObject::transferFilletConstraints(int geoId1, PointPos posId1, int ge bool point2Second = c->Second == geoId2 && c->SecondPos == posId2; bool point1Third = c->Third == geoId1 && c->ThirdPos == posId1; bool point2Third = c->Third == geoId2 && c->ThirdPos == posId2; - bool line1First = c->First == geoId1 && c->FirstPos == none; - bool line2First = c->First == geoId2 && c->FirstPos == none; - bool line1Second = c->Second == geoId1 && c->SecondPos == none; - bool line2Second = c->Second == geoId2 && c->SecondPos == none; + bool line1First = c->First == geoId1 && c->FirstPos == PointPos::none; + bool line2First = c->First == geoId2 && c->FirstPos == PointPos::none; + bool line1Second = c->Second == geoId1 && c->SecondPos == PointPos::none; + bool line2Second = c->Second == geoId2 && c->SecondPos == PointPos::none; if (c->Type == Sketcher::Coincident) { if ((point1First && point2Second) || (point2First && point1Second)) { @@ -1594,51 +1594,51 @@ void SketchObject::transferFilletConstraints(int geoId1, PointPos posId1, int ge if (point1First || point2First) { // Move the coincident constraint to the new corner point c->First = originalCornerId; - c->FirstPos = start; + c->FirstPos = PointPos::start; } if (point1Second || point2Second) { // Move the coincident constraint to the new corner point c->Second = originalCornerId; - c->SecondPos = start; + c->SecondPos = PointPos::start; } } else if (c->Type == Sketcher::Horizontal || c->Type == Sketcher::Vertical) { // Point-to-point horizontal or vertical constraint, move to new corner point if (point1First || point2First) { c->First = originalCornerId; - c->FirstPos = start; + c->FirstPos = PointPos::start; } if (point1Second || point2Second) { c->Second = originalCornerId; - c->SecondPos = start; + c->SecondPos = PointPos::start; } } else if (c->Type == Sketcher::Distance || c->Type == Sketcher::DistanceX || c->Type == Sketcher::DistanceY) { // Point-to-point distance constraint. Move it to the new corner point if (point1First || point2First) { c->First = originalCornerId; - c->FirstPos = start; + c->FirstPos = PointPos::start; } if (point1Second || point2Second) { c->Second = originalCornerId; - c->SecondPos = start; + c->SecondPos = PointPos::start; } // Distance constraint on the line itself. Change it to point-point between the far end of the line // and the new corner if (line1First) { - c->FirstPos = (posId1 == start) ? end : start; + c->FirstPos = (posId1 == PointPos::start) ? PointPos::end : PointPos::start; c->Second = originalCornerId; - c->SecondPos = start; + c->SecondPos = PointPos::start; } if (line2First) { - c->FirstPos = (posId2 == start) ? end : start; + c->FirstPos = (posId2 == PointPos::start) ? PointPos::end : PointPos::start; c->Second = originalCornerId; - c->SecondPos = start; + c->SecondPos = PointPos::start; } } else if (c->Type == Sketcher::PointOnObject) { // The corner to be filleted was touching some other object. if (point1First || point2First) { c->First = originalCornerId; - c->FirstPos = start; + c->FirstPos = PointPos::start; } } else if (c->Type == Sketcher::Equal) { // Equal length constraints are dicey because the lines are getting shorter. Safer to @@ -1650,13 +1650,13 @@ void SketchObject::transferFilletConstraints(int geoId1, PointPos posId1, int ge // Symmetries should probably be preserved relative to the original corner if (point1First || point2First) { c->First = originalCornerId; - c->FirstPos = start; + c->FirstPos = PointPos::start; } else if (point1Second || point2Second) { c->Second = originalCornerId; - c->SecondPos = start; + c->SecondPos = PointPos::start; } else if (point1Third || point2Third) { c->Third = originalCornerId; - c->ThirdPos = start; + c->ThirdPos = PointPos::start; } } else if (c->Type == Sketcher::SnellsLaw) { // Can't imagine any cases where you'd fillet a vertex going through a lens, so let's @@ -1817,8 +1817,8 @@ int SketchObject::fillet(int GeoId1, int GeoId2, filletId = addGeometry(newgeo); if (trim) { - PointPos PosId1 = (filletCenter-intersection)*dir1 > 0 ? start : end; - PointPos PosId2 = (filletCenter-intersection)*dir2 > 0 ? start : end; + PointPos PosId1 = (filletCenter-intersection)*dir1 > 0 ? PointPos::start : PointPos::end; + PointPos PosId2 = (filletCenter-intersection)*dir2 > 0 ? PointPos::start : PointPos::end; if (createCorner) { transferFilletConstraints(GeoId1, PosId1, GeoId2, PosId2); @@ -1841,14 +1841,14 @@ int SketchObject::fillet(int GeoId1, int GeoId2, tangent2->Second = filletId; if (dist1.Length() < dist2.Length()) { - tangent1->SecondPos = start; - tangent2->SecondPos = end; + tangent1->SecondPos = PointPos::start; + tangent2->SecondPos = PointPos::end; movePoint(GeoId1, PosId1, arc->getStartPoint(/*emulateCCW=*/true),false,true); movePoint(GeoId2, PosId2, arc->getEndPoint(/*emulateCCW=*/true),false,true); } else { - tangent1->SecondPos = end; - tangent2->SecondPos = start; + tangent1->SecondPos = PointPos::end; + tangent2->SecondPos = PointPos::start; movePoint(GeoId1, PosId1, arc->getEndPoint(/*emulateCCW=*/true),false,true); movePoint(GeoId2, PosId2, arc->getStartPoint(/*emulateCCW=*/true),false,true); } @@ -1945,8 +1945,8 @@ int SketchObject::fillet(int GeoId1, int GeoId2, // look for coincident constraints between curves, take the coincident closest to the refpoints - Sketcher::PointPos curve1PosId = Sketcher::none; - Sketcher::PointPos curve2PosId = Sketcher::none; + Sketcher::PointPos curve1PosId = Sketcher::PointPos::none; + Sketcher::PointPos curve2PosId = Sketcher::PointPos::none; double dist=INFINITY; @@ -1955,7 +1955,7 @@ int SketchObject::fillet(int GeoId1, int GeoId2, for (std::vector::const_iterator it=constraints.begin(); it != constraints.end(); ++it) { if ((*it)->Type == Sketcher::Coincident || (*it)->Type == Sketcher::Perpendicular || (*it)->Type == Sketcher::Tangent) { if ((*it)->First == GeoId1 && (*it)->Second == GeoId2 && - (*it)->FirstPos != Sketcher::none && (*it)->SecondPos != Sketcher::none ) { + (*it)->FirstPos != Sketcher::PointPos::none && (*it)->SecondPos != Sketcher::PointPos::none ) { Base::Vector3d tmpp1 = getPoint((*it)->First,(*it)->FirstPos); Base::Vector3d tmpp2 = getPoint((*it)->Second,(*it)->SecondPos); double tmpdist = distancetorefpoints(tmpp1, @@ -1970,7 +1970,7 @@ int SketchObject::fillet(int GeoId1, int GeoId2, } } else if ((*it)->First == GeoId2 && (*it)->Second == GeoId1 && - (*it)->FirstPos != Sketcher::none && (*it)->SecondPos != Sketcher::none ) { + (*it)->FirstPos != Sketcher::PointPos::none && (*it)->SecondPos != Sketcher::PointPos::none ) { Base::Vector3d tmpp2 = getPoint((*it)->First,(*it)->FirstPos); Base::Vector3d tmpp1 = getPoint((*it)->Second,(*it)->SecondPos); double tmpdist = distancetorefpoints(tmpp1, @@ -1987,7 +1987,7 @@ int SketchObject::fillet(int GeoId1, int GeoId2, } } - if( curve1PosId == Sketcher::none ) { + if( curve1PosId == Sketcher::PointPos::none ) { // no coincident was found, try basis curve intersection if GeomTrimmedCurve if( geo1->isDerivedFrom(Part::GeomTrimmedCurve::getClassTypeId()) && geo2->isDerivedFrom(Part::GeomTrimmedCurve::getClassTypeId())) { @@ -2240,10 +2240,10 @@ int SketchObject::fillet(int GeoId1, int GeoId2, auto selectend = [](double intparam, double refparam, double startparam) { if( (intparam>refparam && startparam >= refparam) || (intparamSecondPos = start; - tangent2->SecondPos = end; + tangent1->SecondPos = PointPos::start; + tangent2->SecondPos = PointPos::end; movePoint(GeoId1, curve1PosId, arc->getStartPoint(true),false,true); movePoint(GeoId2, curve2PosId, arc->getEndPoint(true),false,true); } else { - tangent1->SecondPos = end; - tangent2->SecondPos = start; + tangent1->SecondPos = PointPos::end; + tangent2->SecondPos = PointPos::start; movePoint(GeoId1, curve1PosId, arc->getEndPoint(true),false,true); movePoint(GeoId2, curve2PosId, arc->getStartPoint(true),false,true); } @@ -2314,7 +2314,7 @@ int SketchObject::fillet(int GeoId1, int GeoId2, return -1; } -int SketchObject::extend(int GeoId, double increment, int endpoint) { +int SketchObject::extend(int GeoId, double increment, PointPos endpoint) { if (GeoId < 0 || GeoId > getHighestCurveIndex()) return -1; @@ -2325,29 +2325,29 @@ int SketchObject::extend(int GeoId, double increment, int endpoint) { Part::GeomLineSegment *seg = static_cast(geom); Base::Vector3d startVec = seg->getStartPoint(); Base::Vector3d endVec = seg->getEndPoint(); - if (endpoint == start) { + if (endpoint == PointPos::start) { Base::Vector3d newPoint = startVec - endVec; double scaleFactor = newPoint.Length() + increment; newPoint.Normalize(); newPoint.Scale(scaleFactor, scaleFactor, scaleFactor); newPoint = newPoint + endVec; - retcode = movePoint(GeoId, Sketcher::start, newPoint, false, true); - } else if (endpoint == end) { + retcode = movePoint(GeoId, Sketcher::PointPos::start, newPoint, false, true); + } else if (endpoint == PointPos::end) { Base::Vector3d newPoint = endVec - startVec; double scaleFactor = newPoint.Length() + increment; newPoint.Normalize(); newPoint.Scale(scaleFactor, scaleFactor, scaleFactor); newPoint = newPoint + startVec; - retcode = movePoint(GeoId, Sketcher::end, newPoint, false, true); + retcode = movePoint(GeoId, Sketcher::PointPos::end, newPoint, false, true); } } else if (geom->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) { Part::GeomArcOfCircle *arc = static_cast(geom); double startArc, endArc; arc->getRange(startArc, endArc, true); - if (endpoint == start) { + if (endpoint == PointPos::start) { arc->setRange(startArc - increment, endArc, true); retcode = 0; - } else if (endpoint == end) { + } else if (endpoint == PointPos::end) { arc->setRange(startArc, endArc + increment, true); retcode = 0; } @@ -2496,12 +2496,12 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) if (constr->Type == Sketcher::Tangent) { if (constr->First == GeoId1 && constr->Second == GeoId) { constrType = Sketcher::Tangent; - if (secondPos == Sketcher::none) + if (secondPos == Sketcher::PointPos::none) secondPos = constr->FirstPos; delete_list.push_back(constrId); } else if (constr->First == GeoId && constr->Second == GeoId1) { constrType = Sketcher::Tangent; - if (secondPos == Sketcher::none) + if (secondPos == Sketcher::PointPos::none) secondPos = constr->SecondPos; delete_list.push_back(constrId); } @@ -2509,12 +2509,12 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) if (constr->Type == Sketcher::Perpendicular) { if (constr->First == GeoId1 && constr->Second == GeoId) { constrType = Sketcher::Perpendicular; - if (secondPos == Sketcher::none) + if (secondPos == Sketcher::PointPos::none) secondPos = constr->FirstPos; delete_list.push_back(constrId); } else if (constr->First == GeoId && constr->Second == GeoId1) { constrType = Sketcher::Perpendicular; - if (secondPos == Sketcher::none) + if (secondPos == Sketcher::PointPos::none) secondPos = constr->SecondPos; delete_list.push_back(constrId); } @@ -2532,9 +2532,9 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) // Build Constraints associated with new pair of arcs newConstr->Type = Sketcher::Equal; newConstr->First = GeoId1; - newConstr->FirstPos = Sketcher::none; + newConstr->FirstPos = Sketcher::PointPos::none; newConstr->Second = GeoId2; - newConstr->SecondPos = Sketcher::none; + newConstr->SecondPos = Sketcher::PointPos::none; addConstraint(std::move(newConstr)); }; @@ -2802,7 +2802,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) Geometry.setValues(std::move(newVals)); // go through all constraints and replace the point (GeoId,end) with (newGeoId,end) - transferConstraints(GeoId, end, newGeoId, end); + transferConstraints(GeoId, PointPos::end, newGeoId, PointPos::end); // For a trimmed line segment, if it had an equality constraint, it must be removed as the segment length is not equal // For the rest of trimmed curves, the proportion shall be constrain to be equal. @@ -2818,22 +2818,22 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) //****** Step B.1 (4) => Constraint end points of trim sections ******// // constrain the trimming points on the corresponding geometries - PointPos secondPos1 = Sketcher::none, secondPos2 = Sketcher::none; + PointPos secondPos1 = Sketcher::PointPos::none, secondPos2 = Sketcher::PointPos::none; ConstraintType constrType1 = Sketcher::PointOnObject, constrType2 = Sketcher::PointOnObject; // Segment comprising the start transformPreexistingConstraints (GeoId, GeoId1, point1, constrType1, secondPos1); - addConstraintIfNoPointOnBSpline (constrType1, GeoId, Sketcher::end, GeoId1, secondPos1); + addConstraintIfNoPointOnBSpline (constrType1, GeoId, Sketcher::PointPos::end, GeoId1, secondPos1); // Segment comprising the end transformPreexistingConstraints (GeoId, GeoId2, point2, constrType2, secondPos2); - addConstraintIfNoPointOnBSpline (constrType2, newGeoId, Sketcher::start, GeoId2, secondPos2); + addConstraintIfNoPointOnBSpline (constrType2, newGeoId, Sketcher::PointPos::start, GeoId2, secondPos2); // Both segments have a coincident center if(!isLineSegment && !isBSpline) { - addConstraint(Sketcher::Coincident, GeoId, Sketcher::mid, newGeoId, Sketcher::mid); + addConstraint(Sketcher::Coincident, GeoId, Sketcher::PointPos::mid, newGeoId, Sketcher::PointPos::mid); } if (isNonPeriodicBSpline) @@ -2874,19 +2874,19 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) //****** Step B.1 (4) => Constraint end points ******// ConstraintType constrType = Sketcher::PointOnObject; // So this is the fallback constraint type here. - PointPos secondPos = Sketcher::none; + PointPos secondPos = Sketcher::PointPos::none; transformPreexistingConstraints (GeoId, op.intersectingGeoId, op.actingPoint, constrType, secondPos); if (op.Type == Operation::trim_start) { - delConstraintOnPoint(GeoId, start, false); + delConstraintOnPoint(GeoId, PointPos::start, false); // constrain the trimming point on the corresponding geometry - addConstraintIfNoPointOnBSpline (constrType, GeoId, start, op.intersectingGeoId, secondPos); + addConstraintIfNoPointOnBSpline (constrType, GeoId, PointPos::start, op.intersectingGeoId, secondPos); } else if (op.Type == Operation::trim_end) { - delConstraintOnPoint(GeoId, end, false); + delConstraintOnPoint(GeoId, PointPos::end, false); // constrain the trimming point on the corresponding geometry - addConstraintIfNoPointOnBSpline (constrType, GeoId, end, op.intersectingGeoId, secondPos); + addConstraintIfNoPointOnBSpline (constrType, GeoId, PointPos::end, op.intersectingGeoId, secondPos); } if (isNonPeriodicBSpline) @@ -2948,39 +2948,39 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) //****** Step B.2 (4) => Constraint end points ******// - PointPos secondPos1 = Sketcher::none, secondPos2 = Sketcher::none; + PointPos secondPos1 = Sketcher::PointPos::none, secondPos2 = Sketcher::PointPos::none; ConstraintType constrType1 = Sketcher::PointOnObject, constrType2 = Sketcher::PointOnObject; // check first if start and end points are within a confusion tolerance - if(isPointAtPosition(GeoId1, Sketcher::start, point1)) { + if(isPointAtPosition(GeoId1, Sketcher::PointPos::start, point1)) { constrType1 = Sketcher::Coincident; - secondPos1 = Sketcher::start; + secondPos1 = Sketcher::PointPos::start; } - else if(isPointAtPosition(GeoId1, Sketcher::end, point1)) { + else if(isPointAtPosition(GeoId1, Sketcher::PointPos::end, point1)) { constrType1 = Sketcher::Coincident; - secondPos1 = Sketcher::end; + secondPos1 = Sketcher::PointPos::end; } - if(isPointAtPosition(GeoId2, Sketcher::start, point2)) { + if(isPointAtPosition(GeoId2, Sketcher::PointPos::start, point2)) { constrType2 = Sketcher::Coincident; - secondPos2 = Sketcher::start; + secondPos2 = Sketcher::PointPos::start; } - else if(isPointAtPosition(GeoId2, Sketcher::end, point2)) { + else if(isPointAtPosition(GeoId2, Sketcher::PointPos::end, point2)) { constrType2 = Sketcher::Coincident; - secondPos2 = Sketcher::end; + secondPos2 = Sketcher::PointPos::end; } transformPreexistingConstraints (GeoId, GeoId1, point1, constrType1, secondPos1); transformPreexistingConstraints (GeoId, GeoId2, point2, constrType2, secondPos2); - if( (constrType1 == Sketcher::Coincident && secondPos1 == Sketcher::none) || - (constrType2 == Sketcher::Coincident && secondPos2 == Sketcher::none)) - THROWM(ValueError,"Invalid position Sketcher::none when creating a Coincident constraint") + if( (constrType1 == Sketcher::Coincident && secondPos1 == Sketcher::PointPos::none) || + (constrType2 == Sketcher::Coincident && secondPos2 == Sketcher::PointPos::none)) + THROWM(ValueError,"Invalid position Sketcher::PointPos::none when creating a Coincident constraint") // constrain the trimming points on the corresponding geometries - addConstraintIfNoPointOnBSpline (constrType1, GeoId, end, GeoId1, secondPos1); + addConstraintIfNoPointOnBSpline (constrType1, GeoId, PointPos::end, GeoId1, secondPos1); - addConstraintIfNoPointOnBSpline (constrType2, GeoId, start, GeoId2, secondPos2); + addConstraintIfNoPointOnBSpline (constrType2, GeoId, PointPos::start, GeoId2, secondPos2); if (isBSpline) exposeInternalGeometry(GeoId); @@ -3046,13 +3046,13 @@ int SketchObject::split(int GeoId, const Base::Vector3d &point) Constraint* joint = new Constraint(); joint->Type = Coincident; joint->First = newIds[0]; - joint->FirstPos = end; + joint->FirstPos = PointPos::end; joint->Second = newIds[1]; - joint->SecondPos = start; + joint->SecondPos = PointPos::start; newConstraints.push_back(joint); - transferConstraints(GeoId, start, newIds[0], start, true); - transferConstraints(GeoId, end, newIds[1], end, true); + transferConstraints(GeoId, PointPos::start, newIds[0], PointPos::start, true); + transferConstraints(GeoId, PointPos::end, newIds[1], PointPos::end, true); ok = true; } } @@ -3083,7 +3083,7 @@ int SketchObject::split(int GeoId, const Base::Vector3d &point) newIds.push_back(arcId); setConstruction(arcId, GeometryFacade::getConstruction(geo)); - transferConstraints(GeoId, mid, arcId, mid); + transferConstraints(GeoId, PointPos::mid, arcId, PointPos::mid); ok = true; } } @@ -3131,22 +3131,22 @@ int SketchObject::split(int GeoId, const Base::Vector3d &point) Constraint* joint = new Constraint(); joint->Type = Coincident; joint->First = newIds[0]; - joint->FirstPos = end; + joint->FirstPos = PointPos::end; joint->Second = newIds[1]; - joint->SecondPos = start; + joint->SecondPos = PointPos::start; newConstraints.push_back(joint); joint = new Constraint(); joint->Type = Coincident; joint->First = newIds[0]; - joint->FirstPos = mid; + joint->FirstPos = PointPos::mid; joint->Second = newIds[1]; - joint->SecondPos = mid; + joint->SecondPos = PointPos::mid; newConstraints.push_back(joint); - transferConstraints(GeoId, start, newIds[0], start, true); - transferConstraints(GeoId, mid, newIds[0], mid); - transferConstraints(GeoId, end, newIds[1], end, true); + transferConstraints(GeoId, PointPos::start, newIds[0], PointPos::start, true); + transferConstraints(GeoId, PointPos::mid, newIds[0], PointPos::mid); + transferConstraints(GeoId, PointPos::end, newIds[1], PointPos::end, true); ok = true; } } @@ -3209,19 +3209,19 @@ int SketchObject::split(int GeoId, const Base::Vector3d &point) case DistanceX: case DistanceY: case PointOnObject: { - if (con->FirstPos == none && con->SecondPos == none) { + if (con->FirstPos == PointPos::none && con->SecondPos == PointPos::none) { Constraint *dist = con->copy(); dist->First = newIds[0]; - dist->FirstPos = start; + dist->FirstPos = PointPos::start; dist->Second = newIds[1]; - dist->SecondPos = end; + dist->SecondPos = PointPos::end; newConstraints.push_back(dist); } else { Constraint *trans = con->copy(); trans->First = conId; trans->FirstPos = conPos; - trans->SecondPos = none; + trans->SecondPos = PointPos::none; Base::Vector3d conPoint(getPoint(conId, conPos)); int targetId = newIds[0]; @@ -3460,7 +3460,7 @@ bool SketchObject::isCarbonCopyAllowed(App::Document *pDoc, App::DocumentObject return true; } -int SketchObject::addSymmetric(const std::vector &geoIdList, int refGeoId, Sketcher::PointPos refPosId/*=Sketcher::none*/) +int SketchObject::addSymmetric(const std::vector &geoIdList, int refGeoId, Sketcher::PointPos refPosId/*=Sketcher::PointPos::none*/) { Base::StateLocker lock(managedoperation, true); // no need to check input data validity as this is an sketchobject managed operation. @@ -3491,7 +3491,7 @@ int SketchObject::addSymmetric(const std::vector &geoIdList, int refGeoId, } // reference is a line - if(refPosId == Sketcher::none) { + if(refPosId == Sketcher::PointPos::none) { const Part::Geometry *georef = getGeometry(refGeoId); if(georef->getTypeId() != Part::GeomLineSegment::getClassTypeId()) { Base::Console().Error("Reference for symmetric is neither a point nor a line.\n"); @@ -3699,12 +3699,12 @@ int SketchObject::addSymmetric(const std::vector &geoIdList, int refGeoId, if (georef->getTypeId() == Part::GeomPoint::getClassTypeId()) { refpoint = static_cast(georef)->getPoint(); } - else if ( refGeoId == -1 && refPosId == Sketcher::start) { + else if ( refGeoId == -1 && refPosId == Sketcher::PointPos::start) { refpoint = Vector3d(0,0,0); } else { switch(refPosId){ - case Sketcher::start: + case Sketcher::PointPos::start: if(georef->getTypeId() == Part::GeomLineSegment::getClassTypeId()){ const Part::GeomLineSegment *geosymline = static_cast(georef); refpoint = geosymline->getStartPoint(); @@ -3729,7 +3729,7 @@ int SketchObject::addSymmetric(const std::vector &geoIdList, int refGeoId, refpoint = geosymbsp->getStartPoint(); } break; - case Sketcher::end: + case Sketcher::PointPos::end: if(georef->getTypeId() == Part::GeomLineSegment::getClassTypeId()){ const Part::GeomLineSegment *geosymline = static_cast(georef); refpoint = geosymline->getEndPoint(); @@ -3755,7 +3755,7 @@ int SketchObject::addSymmetric(const std::vector &geoIdList, int refGeoId, refpoint = geosymbsp->getEndPoint(); } break; - case Sketcher::mid: + case Sketcher::PointPos::mid: if(georef->getTypeId() == Part::GeomCircle::getClassTypeId()){ const Part::GeomCircle *geosymcircle = static_cast(georef); refpoint = geosymcircle->getCenter(); @@ -4007,22 +4007,22 @@ int SketchObject::addSymmetric(const std::vector &geoIdList, int refGeoId, constNew->First = fit->second; constNew->Second = sit->second; if(isStartEndInverted[(*it)->First]){ - if((*it)->FirstPos == Sketcher::start) - constNew->FirstPos = Sketcher::end; - else if((*it)->FirstPos == Sketcher::end) - constNew->FirstPos = Sketcher::start; + if((*it)->FirstPos == Sketcher::PointPos::start) + constNew->FirstPos = Sketcher::PointPos::end; + else if((*it)->FirstPos == Sketcher::PointPos::end) + constNew->FirstPos = Sketcher::PointPos::start; } if(isStartEndInverted[(*it)->Second]){ - if((*it)->SecondPos == Sketcher::start) - constNew->SecondPos = Sketcher::end; - else if((*it)->SecondPos == Sketcher::end) - constNew->SecondPos = Sketcher::start; + if((*it)->SecondPos == Sketcher::PointPos::start) + constNew->SecondPos = Sketcher::PointPos::end; + else if((*it)->SecondPos == Sketcher::PointPos::end) + constNew->SecondPos = Sketcher::PointPos::start; } if (constNew->Type == Tangent || constNew->Type == Perpendicular) AutoLockTangencyAndPerpty(constNew,true); - if( ((*it)->Type == Sketcher::Angle) && (refPosId == Sketcher::none)) { + if( ((*it)->Type == Sketcher::Angle) && (refPosId == Sketcher::PointPos::none)) { constNew->setValue(-(*it)->getValue()); } @@ -4038,22 +4038,22 @@ int SketchObject::addSymmetric(const std::vector &geoIdList, int refGeoId, constNew->Second = sit->second; constNew->Third = tit->second; if(isStartEndInverted[(*it)->First]){ - if((*it)->FirstPos == Sketcher::start) - constNew->FirstPos = Sketcher::end; - else if((*it)->FirstPos == Sketcher::end) - constNew->FirstPos = Sketcher::start; + if((*it)->FirstPos == Sketcher::PointPos::start) + constNew->FirstPos = Sketcher::PointPos::end; + else if((*it)->FirstPos == Sketcher::PointPos::end) + constNew->FirstPos = Sketcher::PointPos::start; } if(isStartEndInverted[(*it)->Second]){ - if((*it)->SecondPos == Sketcher::start) - constNew->SecondPos = Sketcher::end; - else if((*it)->SecondPos == Sketcher::end) - constNew->SecondPos = Sketcher::start; + if((*it)->SecondPos == Sketcher::PointPos::start) + constNew->SecondPos = Sketcher::PointPos::end; + else if((*it)->SecondPos == Sketcher::PointPos::end) + constNew->SecondPos = Sketcher::PointPos::start; } if(isStartEndInverted[(*it)->Third]){ - if((*it)->ThirdPos == Sketcher::start) - constNew->ThirdPos = Sketcher::end; - else if((*it)->ThirdPos == Sketcher::end) - constNew->ThirdPos = Sketcher::start; + if((*it)->ThirdPos == Sketcher::PointPos::start) + constNew->ThirdPos = Sketcher::PointPos::end; + else if((*it)->ThirdPos == Sketcher::PointPos::end) + constNew->ThirdPos = Sketcher::PointPos::start; } newconstrVals.push_back(constNew); } @@ -4110,7 +4110,7 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 int currentrowfirstgeoid= -1, prevrowstartfirstgeoid = -1, prevfirstgeoid = -1; - Sketcher::PointPos refposId = Sketcher::none; + Sketcher::PointPos refposId = Sketcher::PointPos::none; std::map geoIdMap; @@ -4149,10 +4149,10 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 iterfirstgeoid = refgeoid; if(geo->getTypeId() == Part::GeomCircle::getClassTypeId() || geo->getTypeId() == Part::GeomEllipse::getClassTypeId() ){ - refposId = Sketcher::mid; + refposId = Sketcher::PointPos::mid; } else - refposId = Sketcher::start; + refposId = Sketcher::PointPos::start; continue; // the first element is already in place } @@ -4315,7 +4315,7 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 if( (*it)->Second == GeoEnum::GeoUndef /*&& (*it)->Third == GeoEnum::GeoUndef*/) { if( ((*it)->Type != Sketcher::DistanceX && (*it)->Type != Sketcher::DistanceY ) || - (*it)->FirstPos == Sketcher::none ) { // if it is not a point locking DistanceX/Y + (*it)->FirstPos == Sketcher::PointPos::none ) { // if it is not a point locking DistanceX/Y if (((*it)->Type == Sketcher::DistanceX || (*it)->Type == Sketcher::DistanceY || (*it)->Type == Sketcher::Distance || @@ -4357,9 +4357,9 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 Constraint *constNew = (*it)->copy(); constNew->Type = Sketcher::Equal; constNew->isDriving = true; - constNew->FirstPos = Sketcher::none; + constNew->FirstPos = Sketcher::PointPos::none; constNew->Second = fit->second; // first is already (*it->First) - constNew->SecondPos = Sketcher::none; + constNew->SecondPos = Sketcher::PointPos::none; newconstrVals.push_back(constNew); } else { // this includes InternalAlignment constraints @@ -4411,7 +4411,7 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 constNew->First = prevrowstartfirstgeoid; constNew->FirstPos = refposId; constNew->Second = cgeoid; - constNew->SecondPos = Sketcher::start; + constNew->SecondPos = Sketcher::PointPos::start; newconstrVals.push_back(constNew); constNew = new Constraint(); @@ -4419,7 +4419,7 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 constNew->First = iterfirstgeoid; constNew->FirstPos = refposId; constNew->Second = cgeoid; - constNew->SecondPos = Sketcher::end; + constNew->SecondPos = Sketcher::PointPos::end; newconstrVals.push_back(constNew); if( y == 1 ) { // it is the first added element of this row in the perpendicular to displacementvector direction @@ -4431,15 +4431,15 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 constNew = new Constraint(); constNew->Type = Sketcher::Equal; constNew->First = rowrefgeoid; - constNew->FirstPos = Sketcher::none; + constNew->FirstPos = Sketcher::PointPos::none; constNew->Second = colrefgeoid; - constNew->SecondPos = Sketcher::none; + constNew->SecondPos = Sketcher::PointPos::none; newconstrVals.push_back(constNew); } else { constNew = new Constraint(); constNew->Type = Sketcher::Distance; constNew->First = rowrefgeoid; - constNew->FirstPos = Sketcher::none; + constNew->FirstPos = Sketcher::PointPos::none; constNew->setValue(perpendicularDisplacement.Length()); newconstrVals.push_back(constNew); } @@ -4447,9 +4447,9 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 constNew = new Constraint(); constNew->Type = Sketcher::Perpendicular; constNew->First = rowrefgeoid; - constNew->FirstPos = Sketcher::none; + constNew->FirstPos = Sketcher::PointPos::none; constNew->Second = colrefgeoid; - constNew->SecondPos = Sketcher::none; + constNew->SecondPos = Sketcher::PointPos::none; newconstrVals.push_back(constNew); } else { // it is just one more element in the col direction @@ -4459,17 +4459,17 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 constNew = new Constraint(); constNew->Type = Sketcher::Equal; constNew->First = rowrefgeoid; - constNew->FirstPos = Sketcher::none; + constNew->FirstPos = Sketcher::PointPos::none; constNew->Second = cgeoid-1; - constNew->SecondPos = Sketcher::none; + constNew->SecondPos = Sketcher::PointPos::none; newconstrVals.push_back(constNew); constNew = new Constraint(); constNew->Type = Sketcher::Perpendicular; constNew->First = cgeoid-1; - constNew->FirstPos = Sketcher::none; + constNew->FirstPos = Sketcher::PointPos::none; constNew->Second = colrefgeoid; - constNew->SecondPos = Sketcher::none; + constNew->SecondPos = Sketcher::PointPos::none; newconstrVals.push_back(constNew); } } @@ -4481,7 +4481,7 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 constNew->First = prevfirstgeoid; constNew->FirstPos = refposId; constNew->Second = cgeoid; - constNew->SecondPos = Sketcher::start; + constNew->SecondPos = Sketcher::PointPos::start; newconstrVals.push_back(constNew); constNew = new Constraint(); @@ -4489,7 +4489,7 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 constNew->First = iterfirstgeoid; constNew->FirstPos = refposId; constNew->Second = cgeoid; - constNew->SecondPos = Sketcher::end; + constNew->SecondPos = Sketcher::PointPos::end; newconstrVals.push_back(constNew); if(y == 0 && x == 1) { // first element of the first row @@ -4500,14 +4500,14 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 constNew = new Constraint(); constNew->Type = Sketcher::Distance; constNew->First = colrefgeoid; - constNew->FirstPos = Sketcher::none; + constNew->FirstPos = Sketcher::PointPos::none; constNew->setValue(displacement.Length()); newconstrVals.push_back(constNew); constNew = new Constraint(); constNew->Type = Sketcher::Angle; constNew->First = colrefgeoid; - constNew->FirstPos = Sketcher::none; + constNew->FirstPos = Sketcher::PointPos::none; constNew->setValue(atan2(displacement.y,displacement.x)); newconstrVals.push_back(constNew); } @@ -4518,17 +4518,17 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 constNew = new Constraint(); constNew->Type = Sketcher::Equal; constNew->First = colrefgeoid; - constNew->FirstPos = Sketcher::none; + constNew->FirstPos = Sketcher::PointPos::none; constNew->Second = cgeoid-1; - constNew->SecondPos = Sketcher::none; + constNew->SecondPos = Sketcher::PointPos::none; newconstrVals.push_back(constNew); constNew = new Constraint(); constNew->Type = Sketcher::Parallel; constNew->First = cgeoid-1; - constNew->FirstPos = Sketcher::none; + constNew->FirstPos = Sketcher::PointPos::none; constNew->Second = colrefgeoid; - constNew->SecondPos = Sketcher::none; + constNew->SecondPos = Sketcher::PointPos::none; newconstrVals.push_back(constNew); } } @@ -4575,27 +4575,27 @@ int SketchObject::removeAxesAlignment(const std::vector &geoIdList) if (constrvals[i]->First == geoid || constrvals[i]->Second == geoid || constrvals[i]->Third == geoid) { switch(constrvals[i]->Type) { case Sketcher::Horizontal: - if( constrvals[i]->FirstPos == Sketcher::none && - constrvals[i]->SecondPos == Sketcher::none ) { + if( constrvals[i]->FirstPos == Sketcher::PointPos::none && + constrvals[i]->SecondPos == Sketcher::PointPos::none ) { changeConstraintIndices.emplace_back(i, constrvals[i]->Type); nhoriz++; } break; case Sketcher::Vertical: - if( constrvals[i]->FirstPos == Sketcher::none && - constrvals[i]->SecondPos == Sketcher::none ) { + if( constrvals[i]->FirstPos == Sketcher::PointPos::none && + constrvals[i]->SecondPos == Sketcher::PointPos::none ) { changeConstraintIndices.emplace_back(i, constrvals[i]->Type); nvert++; } break; case Sketcher::Symmetric: // only remove symmetric to axes if( (constrvals[i]->Third == GeoEnum::HAxis || constrvals[i]->Third == GeoEnum::VAxis) && - constrvals[i]->ThirdPos == Sketcher::none ) + constrvals[i]->ThirdPos == Sketcher::PointPos::none ) changeConstraintIndices.emplace_back(i, constrvals[i]->Type); break; case Sketcher::PointOnObject: if( (constrvals[i]->Second == GeoEnum::HAxis || constrvals[i]->Second == GeoEnum::VAxis) && - constrvals[i]->SecondPos == Sketcher::none ) + constrvals[i]->SecondPos == Sketcher::PointPos::none ) changeConstraintIndices.emplace_back(i, constrvals[i]->Type); break; case Sketcher::DistanceX: @@ -4809,7 +4809,7 @@ int SketchObject::exposeInternalGeometry(int GeoId) newConstr->Type = Sketcher::InternalAlignment; newConstr->AlignmentType = EllipseFocus1; newConstr->First = currentgeoid+incrgeo+1; - newConstr->FirstPos = Sketcher::start; + newConstr->FirstPos = Sketcher::PointPos::start; newConstr->Second = GeoId; icon.push_back(newConstr); @@ -4825,7 +4825,7 @@ int SketchObject::exposeInternalGeometry(int GeoId) newConstr->Type = Sketcher::InternalAlignment; newConstr->AlignmentType = EllipseFocus2; newConstr->First = currentgeoid+incrgeo+1; - newConstr->FirstPos = Sketcher::start; + newConstr->FirstPos = Sketcher::PointPos::start; newConstr->Second = GeoId; icon.push_back(newConstr); @@ -4945,7 +4945,7 @@ int SketchObject::exposeInternalGeometry(int GeoId) newConstr->Type = Sketcher::InternalAlignment; newConstr->AlignmentType = Sketcher::HyperbolaFocus; newConstr->First = currentgeoid+incrgeo+1; - newConstr->FirstPos = Sketcher::start; + newConstr->FirstPos = Sketcher::PointPos::start; newConstr->Second = GeoId; icon.push_back(newConstr); @@ -4995,12 +4995,12 @@ int SketchObject::exposeInternalGeometry(int GeoId) // look for a line from focusgeoid:start to Geoid:mid_external std::vector focusgeoidlistgeoidlist; std::vector focusposidlist; - getDirectlyCoincidentPoints(focusgeoid, Sketcher::start, focusgeoidlistgeoidlist, + getDirectlyCoincidentPoints(focusgeoid, Sketcher::PointPos::start, focusgeoidlistgeoidlist, focusposidlist); std::vector parabgeoidlistgeoidlist; std::vector parabposidlist; - getDirectlyCoincidentPoints(GeoId, Sketcher::mid, parabgeoidlistgeoidlist, + getDirectlyCoincidentPoints(GeoId, Sketcher::PointPos::mid, parabgeoidlistgeoidlist, parabposidlist); if (!focusgeoidlistgeoidlist.empty() && !parabgeoidlistgeoidlist.empty()) { @@ -5010,8 +5010,8 @@ int SketchObject::exposeInternalGeometry(int GeoId) if(focusgeoidlistgeoidlist[i] == parabgeoidlistgeoidlist[j]) { const Part::Geometry * geo = getGeometry(focusgeoidlistgeoidlist[i]); if (geo && geo->getTypeId() == Part::GeomLineSegment::getClassTypeId()) { - if((focusposidlist[i] == Sketcher::start && parabposidlist[j] == Sketcher::end) || - (focusposidlist[i] == Sketcher::end && parabposidlist[j] == Sketcher::start)) + if((focusposidlist[i] == Sketcher::PointPos::start && parabposidlist[j] == Sketcher::PointPos::end) || + (focusposidlist[i] == Sketcher::PointPos::end && parabposidlist[j] == Sketcher::PointPos::start)) focus_to_vertex=true; } } @@ -5041,7 +5041,7 @@ int SketchObject::exposeInternalGeometry(int GeoId) newConstr->Type = Sketcher::InternalAlignment; newConstr->AlignmentType = Sketcher::ParabolaFocus; newConstr->First = currentgeoid+incrgeo+1; - newConstr->FirstPos = Sketcher::start; + newConstr->FirstPos = Sketcher::PointPos::start; newConstr->Second = GeoId; focusgeoid = currentgeoid+incrgeo+1; @@ -5060,18 +5060,18 @@ int SketchObject::exposeInternalGeometry(int GeoId) Sketcher::Constraint *newConstr = new Sketcher::Constraint(); newConstr->Type = Sketcher::Coincident; newConstr->First = focusgeoid; - newConstr->FirstPos = Sketcher::start; + newConstr->FirstPos = Sketcher::PointPos::start; newConstr->Second = currentgeoid+incrgeo+1; // just added line - newConstr->SecondPos = Sketcher::end; + newConstr->SecondPos = Sketcher::PointPos::end; icon.push_back(newConstr); Sketcher::Constraint *newConstr2 = new Sketcher::Constraint(); newConstr2->Type = Sketcher::Coincident; newConstr2->First = GeoId; - newConstr2->FirstPos = Sketcher::mid; + newConstr2->FirstPos = Sketcher::PointPos::mid; newConstr2->Second = currentgeoid+incrgeo+1; // just added line - newConstr2->SecondPos = Sketcher::start; + newConstr2->SecondPos = Sketcher::PointPos::start; icon.push_back(newConstr2); @@ -5180,7 +5180,7 @@ int SketchObject::exposeInternalGeometry(int GeoId) newConstr->Type = Sketcher::InternalAlignment; newConstr->AlignmentType = Sketcher::BSplineControlPoint; newConstr->First = currentgeoid+incrgeo+1; - newConstr->FirstPos = Sketcher::mid; + newConstr->FirstPos = Sketcher::PointPos::mid; newConstr->Second = GeoId; newConstr->InternalAlignmentIndex = index; @@ -5194,9 +5194,9 @@ int SketchObject::exposeInternalGeometry(int GeoId) Sketcher::Constraint *newConstr2 = new Sketcher::Constraint(); newConstr2->Type = Sketcher::Equal; newConstr2->First = currentgeoid+incrgeo+1; - newConstr2->FirstPos = Sketcher::none; + newConstr2->FirstPos = Sketcher::PointPos::none; newConstr2->Second = controlpointgeoids[0]; - newConstr2->SecondPos = Sketcher::none; + newConstr2->SecondPos = Sketcher::PointPos::none; icon.push_back(newConstr2); } @@ -5230,7 +5230,7 @@ int SketchObject::exposeInternalGeometry(int GeoId) newConstr->Type = Sketcher::InternalAlignment; newConstr->AlignmentType = Sketcher::BSplineKnotPoint; newConstr->First = currentgeoid+incrgeo+1; - newConstr->FirstPos = Sketcher::start; + newConstr->FirstPos = Sketcher::PointPos::start; newConstr->Second = GeoId; newConstr->InternalAlignmentIndex = index; @@ -5248,7 +5248,7 @@ int SketchObject::exposeInternalGeometry(int GeoId) Sketcher::Constraint *newConstr = new Sketcher::Constraint(); newConstr->Type = Sketcher::Radius; newConstr->First = controlpointgeoids[0]; - newConstr->FirstPos = Sketcher::none; + newConstr->FirstPos = Sketcher::PointPos::none; newConstr->setValue( round(distance_p0_p1/6)); // 1/6 is just an estimation for acceptable general visualization icon.push_back(newConstr); @@ -5395,12 +5395,12 @@ int SketchObject::deleteUnusedInternalGeometry(int GeoId, bool delgeoid) // look for a line from focusgeoid:start to Geoid:mid_external std::vector focusgeoidlistgeoidlist; std::vector focusposidlist; - getDirectlyCoincidentPoints(focus1elementindex, Sketcher::start, focusgeoidlistgeoidlist, + getDirectlyCoincidentPoints(focus1elementindex, Sketcher::PointPos::start, focusgeoidlistgeoidlist, focusposidlist); std::vector parabgeoidlistgeoidlist; std::vector parabposidlist; - getDirectlyCoincidentPoints(GeoId, Sketcher::mid, parabgeoidlistgeoidlist, + getDirectlyCoincidentPoints(GeoId, Sketcher::PointPos::mid, parabgeoidlistgeoidlist, parabposidlist); if (!focusgeoidlistgeoidlist.empty() && !parabgeoidlistgeoidlist.empty()) { @@ -5410,8 +5410,8 @@ int SketchObject::deleteUnusedInternalGeometry(int GeoId, bool delgeoid) if (focusgeoidlistgeoidlist[i] == parabgeoidlistgeoidlist[j]) { const Part::Geometry * geo = getGeometry(focusgeoidlistgeoidlist[i]); if (geo && geo->getTypeId() == Part::GeomLineSegment::getClassTypeId()) { - if((focusposidlist[i] == Sketcher::start && parabposidlist[j] == Sketcher::end) || - (focusposidlist[i] == Sketcher::end && parabposidlist[j] == Sketcher::start)) + if((focusposidlist[i] == Sketcher::PointPos::start && parabposidlist[j] == Sketcher::PointPos::end) || + (focusposidlist[i] == Sketcher::PointPos::end && parabposidlist[j] == Sketcher::PointPos::start)) majorelementindex = focusgeoidlistgeoidlist[i]; } } @@ -5630,8 +5630,8 @@ bool SketchObject::convertToNURBS(int GeoId) (cvals[index]->First == GeoId || cvals[index]->Second == GeoId || cvals[index]->Third == GeoId); auto coincidentonmidpoint = cvals[index]->Type == Sketcher::Coincident && - ( (cvals[index]->First == GeoId && cvals[index]->FirstPos == Sketcher::mid) || - (cvals[index]->Second == GeoId && cvals[index]->SecondPos == Sketcher::mid) ); + ( (cvals[index]->First == GeoId && cvals[index]->FirstPos == Sketcher::PointPos::mid) || + (cvals[index]->Second == GeoId && cvals[index]->SecondPos == Sketcher::PointPos::mid) ); if (otherthancoincident || coincidentonmidpoint) newcVals.erase(newcVals.begin()+index); @@ -7069,51 +7069,51 @@ void SketchObject::rebuildVertexIndex(void) i = -getExternalGeometryCount(); if ((*it)->getTypeId() == Part::GeomPoint::getClassTypeId()) { VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(start); + VertexId2PosId.push_back(PointPos::start); } else if ((*it)->getTypeId() == Part::GeomLineSegment::getClassTypeId()) { VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(start); + VertexId2PosId.push_back(PointPos::start); VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(end); + VertexId2PosId.push_back(PointPos::end); } else if ((*it)->getTypeId() == Part::GeomCircle::getClassTypeId()) { VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(mid); + VertexId2PosId.push_back(PointPos::mid); } else if ((*it)->getTypeId() == Part::GeomEllipse::getClassTypeId()) { VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(mid); + VertexId2PosId.push_back(PointPos::mid); } else if ((*it)->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) { VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(start); + VertexId2PosId.push_back(PointPos::start); VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(end); + VertexId2PosId.push_back(PointPos::end); VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(mid); + VertexId2PosId.push_back(PointPos::mid); } else if ((*it)->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()) { VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(start); + VertexId2PosId.push_back(PointPos::start); VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(end); + VertexId2PosId.push_back(PointPos::end); VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(mid); + VertexId2PosId.push_back(PointPos::mid); } else if ((*it)->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId()) { VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(start); + VertexId2PosId.push_back(PointPos::start); VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(end); + VertexId2PosId.push_back(PointPos::end); VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(mid); + VertexId2PosId.push_back(PointPos::mid); } else if ((*it)->getTypeId() == Part::GeomArcOfParabola::getClassTypeId()) { VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(start); + VertexId2PosId.push_back(PointPos::start); VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(end); + VertexId2PosId.push_back(PointPos::end); VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(mid); + VertexId2PosId.push_back(PointPos::mid); } else if ((*it)->getTypeId() == Part::GeomBSplineCurve::getClassTypeId()) { VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(start); + VertexId2PosId.push_back(PointPos::start); VertexId2GeoId.push_back(i); - VertexId2PosId.push_back(end); + VertexId2PosId.push_back(PointPos::end); } } } @@ -7196,11 +7196,11 @@ void SketchObject::isCoincidentWithExternalGeometry(int GeoId, bool &start_exter if( geoId1iterator != (*it).end()) { // If First is in this set and the first key in this ordered element key is external if( (*it).begin()->first < 0 ) { - if( (*geoId1iterator).second == Sketcher::start ) + if( (*geoId1iterator).second == Sketcher::PointPos::start ) start_external=true; - else if ( (*geoId1iterator).second == Sketcher::mid ) + else if ( (*geoId1iterator).second == Sketcher::PointPos::mid ) mid_external=true; - else if ( (*geoId1iterator).second == Sketcher::end ) + else if ( (*geoId1iterator).second == Sketcher::PointPos::end ) end_external=true; } } @@ -7391,13 +7391,13 @@ void SketchObject::getGeometryWithDependentParameters(std::vectorgetEdge() == SolverGeometryExtension::Dependent) - geometrymap.emplace_back(geoid,Sketcher::none); + geometrymap.emplace_back(geoid,Sketcher::PointPos::none); if (solvext->getStart() == SolverGeometryExtension::Dependent) - geometrymap.emplace_back(geoid,Sketcher::start); + geometrymap.emplace_back(geoid,Sketcher::PointPos::start); if (solvext->getEnd() == SolverGeometryExtension::Dependent) - geometrymap.emplace_back(geoid,Sketcher::start); + geometrymap.emplace_back(geoid,Sketcher::PointPos::start); if (solvext->getMid() == SolverGeometryExtension::Dependent) - geometrymap.emplace_back(geoid,Sketcher::start); + geometrymap.emplace_back(geoid,Sketcher::PointPos::start); } } } @@ -7628,7 +7628,7 @@ bool SketchObject::isPointOnCurve(int geoIdCurve, double px, double py) pp.x = px; pp.y = py; Part::GeomPoint p(pp); int ipnt = sk.addPoint(p); - int icstr = sk.addPointOnObjectConstraint(ipnt, Sketcher::start, icrv); + int icstr = sk.addPointOnObjectConstraint(ipnt, Sketcher::PointPos::start, icrv); double err = sk.calculateConstraintError(icstr); return err*err < 10.0*sk.getSolverPrecision(); } @@ -7983,7 +7983,7 @@ void SketchObject::getGeoVertexIndex(int VertexId, int &GeoId, PointPos &PosId) { if (VertexId < 0 || VertexId >= int(VertexId2GeoId.size())) { GeoId = GeoEnum::GeoUndef; - PosId = none; + PosId = PointPos::none; return; } GeoId = VertexId2GeoId[VertexId]; @@ -8073,7 +8073,7 @@ int SketchObject::port_reversedExternalArcs(bool justAnalyze) Constraint *constNew = 0; for(int ig=1; ig<=3; ig++){//cycle through constraint.first, second, third int geoId = 0; - Sketcher::PointPos posId = none; + Sketcher::PointPos posId = PointPos::none; switch (ig){ case 1: geoId=newVals[ic]->First; posId = newVals[ic]->FirstPos; break; case 2: geoId=newVals[ic]->Second; posId = newVals[ic]->SecondPos; break; @@ -8081,7 +8081,7 @@ int SketchObject::port_reversedExternalArcs(bool justAnalyze) } if ( geoId <= GeoEnum::RefExt && - (posId==Sketcher::start || posId==Sketcher::end)){ + (posId==Sketcher::PointPos::start || posId==Sketcher::PointPos::end)){ //we are dealing with a link to an endpoint of external geom Part::Geometry* g = this->ExternalGeo[-geoId-1]; if (g->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()){ @@ -8093,10 +8093,10 @@ int SketchObject::port_reversedExternalArcs(bool justAnalyze) constNew = newVals[ic]->clone(); affected=true; //Do the fix on temp vars - if(posId == Sketcher::start) - posId = Sketcher::end; - else if (posId == Sketcher::end) - posId = Sketcher::start; + if(posId == Sketcher::PointPos::start) + posId = Sketcher::PointPos::end; + else if (posId == Sketcher::PointPos::end) + posId = Sketcher::PointPos::start; } } } @@ -8164,7 +8164,7 @@ bool SketchObject::AutoLockTangencyAndPerpty(Constraint *cstr, bool bForce, bool geoIdPt = cstr->First; posPt = cstr->FirstPos; } - if (posPt == none){//not endpoint-to-curve and not endpoint-to-endpoint tangent (is simple tangency) + if (posPt == PointPos::none){//not endpoint-to-curve and not endpoint-to-endpoint tangent (is simple tangency) //no tangency lockdown is implemented for simple tangency. Do nothing. return false; } else { diff --git a/src/Mod/Sketcher/App/SketchObject.h b/src/Mod/Sketcher/App/SketchObject.h index e7452bbbf9..6610577724 100644 --- a/src/Mod/Sketcher/App/SketchObject.h +++ b/src/Mod/Sketcher/App/SketchObject.h @@ -281,12 +281,12 @@ public: /// trim a curve int trim(int geoId, const Base::Vector3d& point); /// extend a curve - int extend(int geoId, double increment, int endPoint); + int extend(int geoId, double increment, PointPos endPoint); /// split a curve int split(int geoId, const Base::Vector3d &point); /// adds symmetric geometric elements with respect to the refGeoId (line or point) - int addSymmetric(const std::vector &geoIdList, int refGeoId, Sketcher::PointPos refPosId=Sketcher::none); + int addSymmetric(const std::vector &geoIdList, int refGeoId, Sketcher::PointPos refPosId=Sketcher::PointPos::none); /// with default parameters adds a copy of the geometric elements displaced by the displacement vector. /// It creates an array of csize elements in the direction of the displacement vector by rsize elements in the /// direction perpendicular to the displacement vector, wherein the modulus of this perpendicular vector is scaled by perpscale. @@ -595,18 +595,18 @@ protected: int firstGeoId, Sketcher::PointPos firstPos, int secondGeoId = GeoEnum::GeoUndef, - Sketcher::PointPos secondPos = Sketcher::none, + Sketcher::PointPos secondPos = Sketcher::PointPos::none, int thirdGeoId = GeoEnum::GeoUndef, - Sketcher::PointPos thirdPos = Sketcher::none); + Sketcher::PointPos thirdPos = Sketcher::PointPos::none); // creates a new constraint std::unique_ptr createConstraint( Sketcher::ConstraintType constrType, int firstGeoId, Sketcher::PointPos firstPos, int secondGeoId = GeoEnum::GeoUndef, - Sketcher::PointPos secondPos = Sketcher::none, + Sketcher::PointPos secondPos = Sketcher::PointPos::none, int thirdGeoId = GeoEnum::GeoUndef, - Sketcher::PointPos thirdPos = Sketcher::none); + Sketcher::PointPos thirdPos = Sketcher::PointPos::none); private: /// Flag to allow external geometry from other bodies than the one this sketch belongs to diff --git a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp index 93e20a39ba..c4c0352f30 100644 --- a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp +++ b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp @@ -570,7 +570,7 @@ PyObject* SketchObjectPy::delConstraintOnPoint(PyObject *args) if (!PyArg_ParseTuple(args, "i|i", &Index, &pos)) return 0; - if (pos>=Sketcher::none && pos<=Sketcher::mid) { // This is the whole range of valid positions + if (pos >= static_cast(Sketcher::PointPos::none) && pos <= static_cast(Sketcher::PointPos::mid)) { // This is the whole range of valid positions if (this->getSketchObjectPtr()->delConstraintOnPoint(Index,(Sketcher::PointPos)pos)) { std::stringstream str; str << "Not able to delete a constraint on point with the given index: " << Index @@ -1030,7 +1030,7 @@ PyObject* SketchObjectPy::getGeoVertexIndex(PyObject *args) obj->getGeoVertexIndex(index, geoId, posId); Py::Tuple tuple(2); tuple.setItem(0, Py::Long(geoId)); - tuple.setItem(1, Py::Long(posId)); + tuple.setItem(1, Py::Long(static_cast(posId))); return Py::new_reference_to(tuple); } @@ -1136,7 +1136,7 @@ PyObject* SketchObjectPy::extend(PyObject *args) int GeoId; if (PyArg_ParseTuple(args, "idi", &GeoId, &increment, &endPoint)) { - if (this->getSketchObjectPtr()->extend(GeoId, increment, endPoint)) { + if (this->getSketchObjectPtr()->extend(GeoId, increment, static_cast(endPoint))) { std::stringstream str; str << "Not able to extend geometry with id : (" << GeoId << ") for increment (" << increment << ") and point position (" << endPoint << ")"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); @@ -1173,7 +1173,7 @@ PyObject* SketchObjectPy::addSymmetric(PyObject *args) { PyObject *pcObj; int refGeoId; - int refPosId = Sketcher::none; + int refPosId = static_cast(Sketcher::PointPos::none); if (!PyArg_ParseTuple(args, "Oi|i", &pcObj, &refGeoId, &refPosId)) return 0; @@ -1671,9 +1671,9 @@ Py::List SketchObjectPy::getMissingPointOnPointConstraints(void) const for (auto c : constraints) { Py::Tuple t(5); t.setItem(0, Py::Long(c.First)); - t.setItem(1, Py::Long(((c.FirstPos == Sketcher::none)?0:(c.FirstPos == Sketcher::start)?1:(c.FirstPos == Sketcher::end)?2:3))); + t.setItem(1, Py::Long(((c.FirstPos == Sketcher::PointPos::none)?0:(c.FirstPos == Sketcher::PointPos::start)?1:(c.FirstPos == Sketcher::PointPos::end)?2:3))); t.setItem(2, Py::Long(c.Second)); - t.setItem(3, Py::Long(((c.SecondPos == Sketcher::none)?0:(c.SecondPos == Sketcher::start)?1:(c.SecondPos == Sketcher::end)?2:3))); + t.setItem(3, Py::Long(((c.SecondPos == Sketcher::PointPos::none)?0:(c.SecondPos == Sketcher::PointPos::start)?1:(c.SecondPos == Sketcher::PointPos::end)?2:3))); t.setItem(4, Py::Long(c.Type)); list.append(t); } @@ -1686,7 +1686,7 @@ void SketchObjectPy::setMissingPointOnPointConstraints(Py::List arg) auto checkpos = [](Py::Tuple &t,int i) { auto checkitem = [](Py::Tuple &t,int i, int val) {return long(Py::Long(t.getItem(i)))==val;}; - return (checkitem(t,i,0)?Sketcher::none:(checkitem(t,i,1)?Sketcher::start:(checkitem(t,i,2)?Sketcher::end:Sketcher::mid))); + return (checkitem(t,i,0)?Sketcher::PointPos::none:(checkitem(t,i,1)?Sketcher::PointPos::start:(checkitem(t,i,2)?Sketcher::PointPos::end:Sketcher::PointPos::mid))); }; for (auto ti : arg) { @@ -1712,9 +1712,9 @@ Py::List SketchObjectPy::getMissingVerticalHorizontalConstraints(void) const for (auto c : constraints) { Py::Tuple t(5); t.setItem(0, Py::Long(c.First)); - t.setItem(1, Py::Long(((c.FirstPos == Sketcher::none)?0:(c.FirstPos == Sketcher::start)?1:(c.FirstPos == Sketcher::end)?2:3))); + t.setItem(1, Py::Long(((c.FirstPos == Sketcher::PointPos::none)?0:(c.FirstPos == Sketcher::PointPos::start)?1:(c.FirstPos == Sketcher::PointPos::end)?2:3))); t.setItem(2, Py::Long(c.Second)); - t.setItem(3, Py::Long(((c.SecondPos == Sketcher::none)?0:(c.SecondPos == Sketcher::start)?1:(c.SecondPos == Sketcher::end)?2:3))); + t.setItem(3, Py::Long(((c.SecondPos == Sketcher::PointPos::none)?0:(c.SecondPos == Sketcher::PointPos::start)?1:(c.SecondPos == Sketcher::PointPos::end)?2:3))); t.setItem(4, Py::Long(c.Type)); list.append(t); } @@ -1727,7 +1727,7 @@ void SketchObjectPy::setMissingVerticalHorizontalConstraints(Py::List arg) auto checkpos = [](Py::Tuple &t,int i) { auto checkitem = [](Py::Tuple &t,int i, int val) {return long(Py::Long(t.getItem(i)))==val;}; - return (checkitem(t,i,0)?Sketcher::none:(checkitem(t,i,1)?Sketcher::start:(checkitem(t,i,2)?Sketcher::end:Sketcher::mid))); + return (checkitem(t,i,0)?Sketcher::PointPos::none:(checkitem(t,i,1)?Sketcher::PointPos::start:(checkitem(t,i,2)?Sketcher::PointPos::end:Sketcher::PointPos::mid))); }; for (auto ti : arg) { @@ -1753,9 +1753,9 @@ Py::List SketchObjectPy::getMissingLineEqualityConstraints(void) const for (auto c : constraints) { Py::Tuple t(4); t.setItem(0, Py::Long(c.First)); - t.setItem(1, Py::Long(((c.FirstPos == Sketcher::none)?0:(c.FirstPos == Sketcher::start)?1:(c.FirstPos == Sketcher::end)?2:3))); + t.setItem(1, Py::Long(((c.FirstPos == Sketcher::PointPos::none)?0:(c.FirstPos == Sketcher::PointPos::start)?1:(c.FirstPos == Sketcher::PointPos::end)?2:3))); t.setItem(2, Py::Long(c.Second)); - t.setItem(3, Py::Long(((c.SecondPos == Sketcher::none)?0:(c.SecondPos == Sketcher::start)?1:(c.SecondPos == Sketcher::end)?2:3))); + t.setItem(3, Py::Long(((c.SecondPos == Sketcher::PointPos::none)?0:(c.SecondPos == Sketcher::PointPos::start)?1:(c.SecondPos == Sketcher::PointPos::end)?2:3))); list.append(t); } return list; @@ -1767,7 +1767,7 @@ void SketchObjectPy::setMissingLineEqualityConstraints(Py::List arg) auto checkpos = [](Py::Tuple &t,int i) { auto checkitem = [](Py::Tuple &t,int i, int val) {return long(Py::Long(t.getItem(i)))==val;}; - return (checkitem(t,i,0)?Sketcher::none:(checkitem(t,i,1)?Sketcher::start:(checkitem(t,i,2)?Sketcher::end:Sketcher::mid))); + return (checkitem(t,i,0)?Sketcher::PointPos::none:(checkitem(t,i,1)?Sketcher::PointPos::start:(checkitem(t,i,2)?Sketcher::PointPos::end:Sketcher::PointPos::mid))); }; for (auto ti : arg) { @@ -1793,9 +1793,9 @@ Py::List SketchObjectPy::getMissingRadiusConstraints(void) const for (auto c : constraints) { Py::Tuple t(4); t.setItem(0, Py::Long(c.First)); - t.setItem(1, Py::Long(((c.FirstPos == Sketcher::none)?0:(c.FirstPos == Sketcher::start)?1:(c.FirstPos == Sketcher::end)?2:3))); + t.setItem(1, Py::Long(((c.FirstPos == Sketcher::PointPos::none)?0:(c.FirstPos == Sketcher::PointPos::start)?1:(c.FirstPos == Sketcher::PointPos::end)?2:3))); t.setItem(2, Py::Long(c.Second)); - t.setItem(3, Py::Long(((c.SecondPos == Sketcher::none)?0:(c.SecondPos == Sketcher::start)?1:(c.SecondPos == Sketcher::end)?2:3))); + t.setItem(3, Py::Long(((c.SecondPos == Sketcher::PointPos::none)?0:(c.SecondPos == Sketcher::PointPos::start)?1:(c.SecondPos == Sketcher::PointPos::end)?2:3))); list.append(t); } return list; @@ -1807,7 +1807,7 @@ void SketchObjectPy::setMissingRadiusConstraints(Py::List arg) auto checkpos = [](Py::Tuple &t,int i) { auto checkitem = [](Py::Tuple &t,int i, int val) {return long(Py::Long(t.getItem(i)))==val;}; - return (checkitem(t,i,0)?Sketcher::none:(checkitem(t,i,1)?Sketcher::start:(checkitem(t,i,2)?Sketcher::end:Sketcher::mid))); + return (checkitem(t,i,0)?Sketcher::PointPos::none:(checkitem(t,i,1)?Sketcher::PointPos::start:(checkitem(t,i,2)?Sketcher::PointPos::end:Sketcher::PointPos::mid))); }; for (auto ti : arg) { @@ -1838,7 +1838,7 @@ PyObject* SketchObjectPy::getGeometryWithDependentParameters(PyObject *args) for (auto pair : geometrymap) { Py::Tuple t(2); t.setItem(0, Py::Long(pair.first)); - t.setItem(1, Py::Long(((pair.second == Sketcher::none)?0:(pair.second == Sketcher::start)?1:(pair.second == Sketcher::end)?2:3))); + t.setItem(1, Py::Long(((pair.second == Sketcher::PointPos::none)?0:(pair.second == Sketcher::PointPos::start)?1:(pair.second == Sketcher::PointPos::end)?2:3))); list.append(t); } return Py::new_reference_to(list); diff --git a/src/Mod/Sketcher/Gui/Command.cpp b/src/Mod/Sketcher/Gui/Command.cpp index b8b8d00691..127496e1c2 100644 --- a/src/Mod/Sketcher/Gui/Command.cpp +++ b/src/Mod/Sketcher/Gui/Command.cpp @@ -777,7 +777,7 @@ void CmdSketcherMirrorSketch::activated(int iMsg) } int refgeoid = -1; - Sketcher::PointPos refposid = Sketcher::none; + Sketcher::PointPos refposid = Sketcher::PointPos::none; // Ask the user the type of mirroring SketchMirrorDialog smd; if (smd.exec() != QDialog::Accepted) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 12f63740c5..ed59761f33 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -211,13 +211,13 @@ void SketcherGui::makeTangentToEllipseviaNewPoint(Sketcher::SketchObject* Obj, // Point on first object Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoIdPoint,Sketcher::start,geoId1); // constrain major axis + GeoIdPoint,static_cast(Sketcher::PointPos::start),geoId1); // constrain major axis // Point on second object Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoIdPoint,Sketcher::start,geoId2); // constrain major axis + GeoIdPoint,static_cast(Sketcher::PointPos::start),geoId2); // constrain major axis // tangent via point Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('TangentViaPoint',%d,%d,%d,%d))", - geoId1, geoId2 ,GeoIdPoint, Sketcher::start); + geoId1, geoId2 ,GeoIdPoint, static_cast(Sketcher::PointPos::start)); } catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what()); @@ -275,13 +275,13 @@ void SketcherGui::makeTangentToArcOfEllipseviaNewPoint(Sketcher::SketchObject* O // Point on first object Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoIdPoint,Sketcher::start,geoId1); // constrain major axis + GeoIdPoint,static_cast(Sketcher::PointPos::start),geoId1); // constrain major axis // Point on second object Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoIdPoint,Sketcher::start,geoId2); // constrain major axis + GeoIdPoint,static_cast(Sketcher::PointPos::start),geoId2); // constrain major axis // tangent via point Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('TangentViaPoint',%d,%d,%d,%d))", - geoId1, geoId2 ,GeoIdPoint, Sketcher::start); + geoId1, geoId2 ,GeoIdPoint, static_cast(Sketcher::PointPos::start)); } catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what()); @@ -356,13 +356,13 @@ void SketcherGui::makeTangentToArcOfHyperbolaviaNewPoint(Sketcher::SketchObject* // Point on first object Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoIdPoint,Sketcher::start,geoId1); // constrain major axis + GeoIdPoint,static_cast(Sketcher::PointPos::start),geoId1); // constrain major axis // Point on second object Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoIdPoint,Sketcher::start,geoId2); // constrain major axis + GeoIdPoint,static_cast(Sketcher::PointPos::start),geoId2); // constrain major axis // tangent via point Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('TangentViaPoint',%d,%d,%d,%d))", - geoId1, geoId2 ,GeoIdPoint, Sketcher::start); + geoId1, geoId2 ,GeoIdPoint, static_cast(Sketcher::PointPos::start)); } catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what()); @@ -432,13 +432,13 @@ void SketcherGui::makeTangentToArcOfParabolaviaNewPoint(Sketcher::SketchObject* // Point on first object Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoIdPoint,Sketcher::start,geoId1); // constrain major axis + GeoIdPoint,static_cast(Sketcher::PointPos::start),geoId1); // constrain major axis // Point on second object Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoIdPoint,Sketcher::start,geoId2); // constrain major axis + GeoIdPoint,static_cast(Sketcher::PointPos::start),geoId2); // constrain major axis // tangent via point Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('TangentViaPoint',%d,%d,%d,%d))", - geoId1, geoId2 ,GeoIdPoint, Sketcher::start); + geoId1, geoId2 ,GeoIdPoint, static_cast(Sketcher::PointPos::start)); } catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what()); @@ -471,13 +471,13 @@ void SketcherGui::doEndpointTangency(Sketcher::SketchObject* Obj, } // end of code supports simple B-spline endpoint tangency Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('Tangent',%d,%d,%d,%d)) ", - GeoId1,PosId1,GeoId2,PosId2); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2)); } void SketcherGui::doEndpointToEdgeTangency( Sketcher::SketchObject* Obj, int GeoId1, PointPos PosId1, int GeoId2) { Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('Tangent',%d,%d,%d)) ", - GeoId1,PosId1,GeoId2); + GeoId1,static_cast(PosId1),GeoId2); } void SketcherGui::notifyConstraintSubstitutions(const QString & message) @@ -735,7 +735,7 @@ public: { SelIdPair selIdPair; selIdPair.GeoId = GeoEnum::GeoUndef; - selIdPair.PosId = Sketcher::none; + selIdPair.PosId = Sketcher::PointPos::none; std::stringstream ss; SelType newSelType = SelUnknown; @@ -745,7 +745,7 @@ public: int CrsId = sketchgui->getPreselectCross(); if (allowedSelTypes & (SelRoot | SelVertexOrRoot) && CrsId == 0) { selIdPair.GeoId = Sketcher::GeoEnum::RtPnt; - selIdPair.PosId = Sketcher::start; + selIdPair.PosId = Sketcher::PointPos::start; newSelType = (allowedSelTypes & SelRoot) ? SelRoot : SelVertexOrRoot; ss << "RootPoint"; } @@ -942,18 +942,18 @@ void CmdSketcherConstrainHorizontal::activated(int iMsg) // check if the edge already has a Horizontal/Vertical/Block constraint for (std::vector< Sketcher::Constraint * >::const_iterator it= vals.begin(); it != vals.end(); ++it) { - if ((*it)->Type == Sketcher::Horizontal && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::none){ + if ((*it)->Type == Sketcher::Horizontal && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::PointPos::none){ QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Double constraint"), QObject::tr("The selected edge already has a horizontal constraint!")); return; } - if ((*it)->Type == Sketcher::Vertical && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::none) { + if ((*it)->Type == Sketcher::Vertical && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::PointPos::none) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a vertical constraint!")); return; } // check if the edge already has a Block constraint - if ((*it)->Type == Sketcher::Block && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::none) { + if ((*it)->Type == Sketcher::Block && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::PointPos::none) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a Block constraint!")); return; @@ -997,7 +997,7 @@ void CmdSketcherConstrainHorizontal::activated(int iMsg) // issue the actual commands to create the constraint Gui::cmdAppObjectArgs(selection[0].getObject() ,"addConstraint(Sketcher.Constraint('Horizontal',%d,%d,%d,%d)) " - ,*it,*itp,*std::next(it),*std::next(itp)); + ,*it,static_cast(*itp),*std::next(it),static_cast(*std::next(itp))); } } else { // vertex mode, fixedpoints > 1 @@ -1037,18 +1037,18 @@ void CmdSketcherConstrainHorizontal::applyConstraint(std::vector &sel // check if the edge already has a Horizontal/Vertical/Block constraint for (std::vector< Sketcher::Constraint * >::const_iterator it= vals.begin(); it != vals.end(); ++it) { - if ((*it)->Type == Sketcher::Horizontal && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::none){ + if ((*it)->Type == Sketcher::Horizontal && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::PointPos::none){ QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Double constraint"), QObject::tr("The selected edge already has a horizontal constraint!")); return; } - if ((*it)->Type == Sketcher::Vertical && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::none) { + if ((*it)->Type == Sketcher::Vertical && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::PointPos::none) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a vertical constraint!")); return; } // check if the edge already has a Block constraint - if ((*it)->Type == Sketcher::Block && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::none) { + if ((*it)->Type == Sketcher::Block && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::PointPos::none) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a Block constraint!")); return; @@ -1086,7 +1086,7 @@ void CmdSketcherConstrainHorizontal::applyConstraint(std::vector &sel // issue the actual commands to create the constraint Gui::cmdAppObjectArgs(sketchgui->getObject() ,"addConstraint(Sketcher.Constraint('Horizontal',%d,%d,%d,%d)) " - ,GeoId1,PosId1,GeoId2,PosId2); + ,GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2)); // finish the transaction and update Gui::Command::commitCommand(); @@ -1180,18 +1180,18 @@ void CmdSketcherConstrainVertical::activated(int iMsg) // check if the edge already has a Horizontal/Vertical/Block constraint for (std::vector< Sketcher::Constraint * >::const_iterator it= vals.begin(); it != vals.end(); ++it) { - if ((*it)->Type == Sketcher::Vertical && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::none){ + if ((*it)->Type == Sketcher::Vertical && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::PointPos::none){ QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Double constraint"), QObject::tr("The selected edge already has a vertical constraint!")); return; } - if ((*it)->Type == Sketcher::Horizontal && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::none) { + if ((*it)->Type == Sketcher::Horizontal && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::PointPos::none) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a horizontal constraint!")); return; } // check if the edge already has a Block constraint - if ((*it)->Type == Sketcher::Block && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::none) { + if ((*it)->Type == Sketcher::Block && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::PointPos::none) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a Block constraint!")); return; @@ -1232,7 +1232,7 @@ void CmdSketcherConstrainVertical::activated(int iMsg) for (it=pointgeoids.begin(), itp=pointpos.begin(); it != std::prev(pointgeoids.end()) && itp != std::prev(pointpos.end()); it++,itp++) { // issue the actual commands to create the constraint Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('Vertical',%d,%d,%d,%d)) " - ,*it,*itp,*std::next(it),*std::next(itp)); + ,*it,static_cast(*itp),*std::next(it),static_cast(*std::next(itp))); } } else { // vertex mode, fixedpoints > 1 @@ -1273,18 +1273,18 @@ void CmdSketcherConstrainVertical::applyConstraint(std::vector &selSe // check if the edge already has a Horizontal or Vertical constraint for (std::vector< Sketcher::Constraint * >::const_iterator it= vals.begin(); it != vals.end(); ++it) { - if ((*it)->Type == Sketcher::Horizontal && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::none){ + if ((*it)->Type == Sketcher::Horizontal && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::PointPos::none){ QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a horizontal constraint!")); return; } - if ((*it)->Type == Sketcher::Vertical && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::none) { + if ((*it)->Type == Sketcher::Vertical && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::PointPos::none) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Double constraint"), QObject::tr("The selected edge already has a vertical constraint!")); return; } // check if the edge already has a Block constraint - if ((*it)->Type == Sketcher::Block && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::none) { + if ((*it)->Type == Sketcher::Block && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::PointPos::none) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a Block constraint!")); return; @@ -1321,7 +1321,7 @@ void CmdSketcherConstrainVertical::applyConstraint(std::vector &selSe // issue the actual commands to create the constraint Gui::cmdAppObjectArgs(sketchgui->getObject() ,"addConstraint(Sketcher.Constraint('Vertical',%d,%d,%d,%d)) " - ,GeoId1,PosId1,GeoId2,PosId2); + ,GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2)); // finish the transaction and update Gui::Command::commitCommand(); @@ -1434,9 +1434,9 @@ void CmdSketcherConstrainLock::activated(int iMsg) // undo command open openCommand(QT_TRANSLATE_NOOP("Command", "Add 'Lock' constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('DistanceX',%d,%d,%f)) ", - GeoId[0],PosId[0],pnt.x); + GeoId[0],static_cast(PosId[0]),pnt.x); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('DistanceY',%d,%d,%f)) ", - GeoId[0],PosId[0],pnt.y); + GeoId[0],static_cast(PosId[0]),pnt.y); lastconstraintindex+=2; @@ -1475,10 +1475,10 @@ void CmdSketcherConstrainLock::activated(int iMsg) // undo command open openCommand(QT_TRANSLATE_NOOP("Command", "Add relative 'Lock' constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('DistanceX',%d,%d,%d,%d,%f)) ", - *itg,*itp,GeoId.back(),PosId.back(),pntr.x-pnt.x); + *itg,static_cast(*itp),GeoId.back(),static_cast(PosId.back()),pntr.x-pnt.x); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('DistanceY',%d,%d,%d,%d,%f)) ", - *itg,*itp,GeoId.back(),PosId.back(),pntr.y-pnt.y); + *itg,static_cast(*itp),GeoId.back(),static_cast(PosId.back()),pntr.y-pnt.y); lastconstraintindex+=2; if ( (refpointfixed && pointfixed) || constraintCreationMode==Reference) { @@ -1520,9 +1520,9 @@ void CmdSketcherConstrainLock::applyConstraint(std::vector &selSeq, i // undo command open Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add fixed constraint")); Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('DistanceX', %d, %d, %f)) ", - selSeq.front().GeoId, selSeq.front().PosId, pnt.x); + selSeq.front().GeoId, static_cast(selSeq.front().PosId), pnt.x); Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('DistanceY', %d, %d, %f)) ", - selSeq.front().GeoId, selSeq.front().PosId, pnt.y); + selSeq.front().GeoId, static_cast(selSeq.front().PosId), pnt.y); if (pointfixed || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving @@ -1650,7 +1650,7 @@ void CmdSketcherConstrainBlock::activated(int iMsg) } // check if the edge already has a Block constraint - if ( checkConstraint(vals, Sketcher::Block, GeoIdt, Sketcher::none)) { + if ( checkConstraint(vals, Sketcher::Block, GeoIdt, Sketcher::PointPos::none)) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Double constraint"), QObject::tr("The selected edge already has a Block constraint!")); return; @@ -1698,7 +1698,7 @@ void CmdSketcherConstrainBlock::applyConstraint(std::vector &selSeq, // check if the edge already has a Block constraint const std::vector< Sketcher::Constraint * > &vals = static_cast(sketchgui->getObject())->Constraints.getValues(); - if ( checkConstraint(vals, Sketcher::Block, selSeq.front().GeoId, Sketcher::none)) { + if ( checkConstraint(vals, Sketcher::Block, selSeq.front().GeoId, Sketcher::PointPos::none)) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Double constraint"), QObject::tr("The selected edge already has a Block constraint!")); return; @@ -1781,7 +1781,7 @@ public: DrawSketchHandlerCoincident() { GeoId1 = GeoId2 = GeoEnum::GeoUndef; - PosId1 = PosId2 = Sketcher::none; + PosId1 = PosId2 = Sketcher::PointPos::none; } virtual ~DrawSketchHandlerCoincident() { @@ -1821,12 +1821,12 @@ public: } else if (CrsId == 0){ GeoId_temp = Sketcher::GeoEnum::RtPnt; - PosId_temp = Sketcher::start; + PosId_temp = Sketcher::PointPos::start; ss << "RootPoint"; } else { GeoId1 = GeoId2 = GeoEnum::GeoUndef; - PosId1 = PosId2 = Sketcher::none; + PosId1 = PosId2 = Sketcher::PointPos::none; Gui::Selection().clearSelection(); return true; @@ -1857,7 +1857,7 @@ public: bool constraintExists = Obj->arePointsCoincident(GeoId1,PosId1,GeoId2,PosId2); if (!constraintExists && (GeoId1 != GeoId2)) { Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Coincident',%d,%d,%d,%d)) ", - GeoId1,PosId1,GeoId2,PosId2); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2)); Gui::Command::commitCommand(); } else { @@ -1916,7 +1916,7 @@ bool CmdSketcherConstrainCoincident::substituteConstraintCombinations(SketchObje int j=0; for (std::vector::const_iterator it = cvals.begin(); it != cvals.end(); ++it,++j) { if( (*it)->Type == Sketcher::Tangent && - (*it)->FirstPos == Sketcher::none && (*it)->SecondPos == Sketcher::none && + (*it)->FirstPos == Sketcher::PointPos::none && (*it)->SecondPos == Sketcher::PointPos::none && (*it)->Third == GeoEnum::GeoUndef && (((*it)->First == GeoId1 && (*it)->Second == GeoId2) || ((*it)->Second == GeoId1 && (*it)->First == GeoId2)) ) { @@ -1925,7 +1925,7 @@ bool CmdSketcherConstrainCoincident::substituteConstraintCombinations(SketchObje if( constraintExists ) { // try to remove any pre-existing direct coincident constraints - Gui::cmdAppObjectArgs(Obj, "delConstraintOnPoint(%i,%i)", GeoId1, PosId1); + Gui::cmdAppObjectArgs(Obj, "delConstraintOnPoint(%i,%i)", GeoId1, static_cast(PosId1)); } Gui::cmdAppObjectArgs(Obj, "delConstraint(%i)", j); @@ -2020,7 +2020,7 @@ void CmdSketcherConstrainCoincident::activated(int iMsg) if (!constraintExists) { constraintsAdded = true; Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('Coincident',%d,%d,%d,%d)) ", - GeoId1,PosId1,GeoId2,PosId2); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2)); } } @@ -2068,7 +2068,7 @@ void CmdSketcherConstrainCoincident::applyConstraint(std::vector &sel bool constraintExists = Obj->arePointsCoincident(GeoId1, PosId1, GeoId2, PosId2); if (!constraintExists && (GeoId1 != GeoId2)) { Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Coincident', %d, %d, %d, %d)) ", - GeoId1, PosId1, GeoId2, PosId2); + GeoId1, static_cast(PosId1), GeoId2, static_cast(PosId2)); Gui::Command::commitCommand(); } else { @@ -2148,7 +2148,7 @@ void CmdSketcherConstrainDistance::activated(int iMsg) } int GeoId1, GeoId2=GeoEnum::GeoUndef; - Sketcher::PointPos PosId1, PosId2=Sketcher::none; + Sketcher::PointPos PosId1, PosId2=Sketcher::PointPos::none; getIdsFromName(SubNames[0], Obj, GeoId1, PosId1); if (SubNames.size() == 2) getIdsFromName(SubNames[1], Obj, GeoId2, PosId2); @@ -2165,21 +2165,21 @@ void CmdSketcherConstrainDistance::activated(int iMsg) Base::Vector3d pnt2 = Obj->getPoint(GeoId2,PosId2); - if (GeoId1 == Sketcher::GeoEnum::HAxis && PosId1 == Sketcher::none) { - PosId1 = Sketcher::start; + if (GeoId1 == Sketcher::GeoEnum::HAxis && PosId1 == Sketcher::PointPos::none) { + PosId1 = Sketcher::PointPos::start; openCommand(QT_TRANSLATE_NOOP("Command", "Add distance from horizontal axis constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('DistanceY',%d,%d,%d,%d,%f)) ", - GeoId1,PosId1,GeoId2,PosId2,pnt2.y); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2),pnt2.y); } - else if (GeoId1 == Sketcher::GeoEnum::VAxis && PosId1 == Sketcher::none) { - PosId1 = Sketcher::start; + else if (GeoId1 == Sketcher::GeoEnum::VAxis && PosId1 == Sketcher::PointPos::none) { + PosId1 = Sketcher::PointPos::start; openCommand(QT_TRANSLATE_NOOP("Command", "Add distance from vertical axis constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('DistanceX',%d,%d,%d,%d,%f)) ", - GeoId1,PosId1,GeoId2,PosId2,pnt2.x); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2),pnt2.x); } else { Base::Vector3d pnt1 = Obj->getPoint(GeoId1,PosId1); @@ -2187,7 +2187,7 @@ void CmdSketcherConstrainDistance::activated(int iMsg) openCommand(QT_TRANSLATE_NOOP("Command", "Add point to point distance constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('Distance',%d,%d,%d,%d,%f)) ", - GeoId1,PosId1,GeoId2,PosId2,(pnt2-pnt1).Length()); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2),(pnt2-pnt1).Length()); } if (arebothpointsorsegmentsfixed || constraintCreationMode==Reference) { @@ -2222,7 +2222,7 @@ void CmdSketcherConstrainDistance::activated(int iMsg) openCommand(QT_TRANSLATE_NOOP("Command", "Add point to line Distance constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('Distance',%d,%d,%d,%f)) ", - GeoId1,PosId1,GeoId2,ActDist); + GeoId1,static_cast(PosId1),GeoId2,ActDist); if (arebothpointsorsegmentsfixed || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); @@ -2284,7 +2284,7 @@ void CmdSketcherConstrainDistance::applyConstraint(std::vector &selSe Sketcher::SketchObject* Obj = sketchgui->getSketchObject(); int GeoId1 = GeoEnum::GeoUndef, GeoId2 = GeoEnum::GeoUndef; - Sketcher::PointPos PosId1 = Sketcher::none, PosId2 = Sketcher::none; + Sketcher::PointPos PosId1 = Sketcher::PointPos::none, PosId2 = Sketcher::PointPos::none; bool arebothpointsorsegmentsfixed=areBothPointsOrSegmentsFixed(Obj,GeoId1, GeoId2); @@ -2297,26 +2297,26 @@ void CmdSketcherConstrainDistance::applyConstraint(std::vector &selSe Base::Vector3d pnt2 = Obj->getPoint(GeoId2,PosId2); - if (GeoId1 == Sketcher::GeoEnum::HAxis && PosId1 == Sketcher::none) { - PosId1 = Sketcher::start; + if (GeoId1 == Sketcher::GeoEnum::HAxis && PosId1 == Sketcher::PointPos::none) { + PosId1 = Sketcher::PointPos::start; openCommand(QT_TRANSLATE_NOOP("Command", "Add distance from horizontal axis constraint")); Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('DistanceY',%d,%d,%d,%d,%f)) ", - GeoId1,PosId1,GeoId2,PosId2,pnt2.y); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2),pnt2.y); } - else if (GeoId1 == Sketcher::GeoEnum::VAxis && PosId1 == Sketcher::none) { - PosId1 = Sketcher::start; + else if (GeoId1 == Sketcher::GeoEnum::VAxis && PosId1 == Sketcher::PointPos::none) { + PosId1 = Sketcher::PointPos::start; openCommand(QT_TRANSLATE_NOOP("Command", "Add distance from vertical axis constraint")); Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('DistanceX',%d,%d,%d,%d,%f)) ", - GeoId1,PosId1,GeoId2,PosId2,pnt2.x); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2),pnt2.x); } else { Base::Vector3d pnt1 = Obj->getPoint(GeoId1,PosId1); openCommand(QT_TRANSLATE_NOOP("Command", "Add point to point distance constraint")); Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('Distance',%d,%d,%d,%d,%f)) ", - GeoId1,PosId1,GeoId2,PosId2,(pnt2-pnt1).Length()); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2),(pnt2-pnt1).Length()); } if (arebothpointsorsegmentsfixed || constraintCreationMode==Reference) { @@ -2336,7 +2336,7 @@ void CmdSketcherConstrainDistance::applyConstraint(std::vector &selSe case 3: // {SelExternalEdge} { GeoId1 = GeoId2 = selSeq.at(0).GeoId; - PosId1 = Sketcher::start; PosId2 = Sketcher::end; + PosId1 = Sketcher::PointPos::start; PosId2 = Sketcher::PointPos::end; arebothpointsorsegmentsfixed=isPointOrSegmentFixed(Obj,GeoId1); @@ -2391,7 +2391,7 @@ void CmdSketcherConstrainDistance::applyConstraint(std::vector &selSe openCommand(QT_TRANSLATE_NOOP("Command", "Add point to line Distance constraint")); Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('Distance',%d,%d,%d,%f)) ", - GeoId1,PosId1,GeoId2,ActDist); + GeoId1,static_cast(PosId1),GeoId2,ActDist); if (arebothpointsorsegmentsfixed || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving @@ -2471,7 +2471,7 @@ bool CmdSketcherConstrainPointOnObject::substituteConstraintCombinations( Sket int cid = 0; for (std::vector::const_iterator it = cvals.begin(); it != cvals.end(); ++it, ++cid) { if( (*it)->Type == Sketcher::Tangent && - (*it)->FirstPos == Sketcher::none && (*it)->SecondPos == Sketcher::none && + (*it)->FirstPos == Sketcher::PointPos::none && (*it)->SecondPos == Sketcher::PointPos::none && (*it)->Third == GeoEnum::GeoUndef && (((*it)->First == GeoId1 && (*it)->Second == GeoId2) || ((*it)->Second == GeoId1 && (*it)->First == GeoId2)) ) { @@ -2570,7 +2570,7 @@ void CmdSketcherConstrainPointOnObject::activated(int iMsg) cnt++; Gui::cmdAppObjectArgs(selection[0].getObject(),"addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - points[iPnt].GeoId, points[iPnt].PosId, curves[iCrv].GeoId); + points[iPnt].GeoId, static_cast(points[iPnt].PosId), curves[iCrv].GeoId); } } if (cnt) { @@ -2660,7 +2660,7 @@ void CmdSketcherConstrainPointOnObject::applyConstraint(std::vector & if (allOK) { Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoIdVt, PosIdVt, GeoIdCrv); + GeoIdVt, static_cast(PosIdVt), GeoIdCrv); commitCommand(); tryAutoRecompute(Obj); @@ -2745,7 +2745,7 @@ void CmdSketcherConstrainDistanceX::activated(int iMsg) } int GeoId1, GeoId2=GeoEnum::GeoUndef; - Sketcher::PointPos PosId1, PosId2=Sketcher::none; + Sketcher::PointPos PosId1, PosId2=Sketcher::PointPos::none; getIdsFromName(SubNames[0], Obj, GeoId1, PosId1); if (SubNames.size() == 2) getIdsFromName(SubNames[1], Obj, GeoId2, PosId2); @@ -2757,12 +2757,12 @@ void CmdSketcherConstrainDistanceX::activated(int iMsg) std::swap(PosId1,PosId2); } - if (GeoId1 == Sketcher::GeoEnum::HAxis && PosId1 == Sketcher::none) + if (GeoId1 == Sketcher::GeoEnum::HAxis && PosId1 == Sketcher::PointPos::none) // reject horizontal axis from selection GeoId1 = GeoEnum::GeoUndef; - else if (GeoId1 == Sketcher::GeoEnum::VAxis && PosId1 == Sketcher::none) { + else if (GeoId1 == Sketcher::GeoEnum::VAxis && PosId1 == Sketcher::PointPos::none) { GeoId1 = Sketcher::GeoEnum::HAxis; - PosId1 = Sketcher::start; + PosId1 = Sketcher::PointPos::start; } if (isEdge(GeoId1,PosId1) && GeoId2 == GeoEnum::GeoUndef) { @@ -2778,9 +2778,9 @@ void CmdSketcherConstrainDistanceX::activated(int iMsg) const Part::Geometry *geom = Obj->getGeometry(GeoId1); if (geom->getTypeId() == Part::GeomLineSegment::getClassTypeId()) { //convert to as if two endpoints of the line have been selected - PosId1 = Sketcher::start; + PosId1 = Sketcher::PointPos::start; GeoId2 = GeoId1; - PosId2 = Sketcher::end; + PosId2 = Sketcher::PointPos::end; } } if (isVertex(GeoId1,PosId1) && isVertex(GeoId2,PosId2)) { @@ -2799,7 +2799,7 @@ void CmdSketcherConstrainDistanceX::activated(int iMsg) openCommand(QT_TRANSLATE_NOOP("Command", "Add point to point horizontal distance constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('DistanceX',%d,%d,%d,%d,%f)) ", - GeoId1,PosId1,GeoId2,PosId2,ActLength); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2),ActLength); if (arebothpointsorsegmentsfixed || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving @@ -2830,7 +2830,7 @@ void CmdSketcherConstrainDistanceX::activated(int iMsg) openCommand(QT_TRANSLATE_NOOP("Command", "Add fixed x-coordinate constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('DistanceX',%d,%d,%f)) ", - GeoId1,PosId1,ActX); + GeoId1,static_cast(PosId1),ActX); if (arebothpointsorsegmentsfixed || constraintCreationMode==Reference) { @@ -2858,7 +2858,7 @@ void CmdSketcherConstrainDistanceX::applyConstraint(std::vector &selS Sketcher::SketchObject* Obj = sketchgui->getSketchObject(); int GeoId1 = GeoEnum::GeoUndef, GeoId2 = GeoEnum::GeoUndef; - Sketcher::PointPos PosId1 = Sketcher::none, PosId2 = Sketcher::none; + Sketcher::PointPos PosId1 = Sketcher::PointPos::none, PosId2 = Sketcher::PointPos::none; switch (seqIndex) { case 0: // {SelVertex, SelVertexOrRoot} @@ -2872,7 +2872,7 @@ void CmdSketcherConstrainDistanceX::applyConstraint(std::vector &selS case 3: // {SelExternalEdge} { GeoId1 = GeoId2 = selSeq.at(0).GeoId; - PosId1 = Sketcher::start; PosId2 = Sketcher::end; + PosId1 = Sketcher::PointPos::start; PosId2 = Sketcher::PointPos::end; const Part::Geometry *geom = Obj->getGeometry(GeoId1); if (geom->getTypeId() != Part::GeomLineSegment::getClassTypeId()) { @@ -2901,7 +2901,7 @@ void CmdSketcherConstrainDistanceX::applyConstraint(std::vector &selS openCommand(QT_TRANSLATE_NOOP("Command", "Add point to point horizontal distance constraint")); Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('DistanceX',%d,%d,%d,%d,%f)) ", - GeoId1,PosId1,GeoId2,PosId2,ActLength); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2),ActLength); if (areBothPointsOrSegmentsFixed(Obj,GeoId1, GeoId2) || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving @@ -2997,7 +2997,7 @@ void CmdSketcherConstrainDistanceY::activated(int iMsg) } int GeoId1, GeoId2=GeoEnum::GeoUndef; - Sketcher::PointPos PosId1, PosId2=Sketcher::none; + Sketcher::PointPos PosId1, PosId2=Sketcher::PointPos::none; getIdsFromName(SubNames[0], Obj, GeoId1, PosId1); if (SubNames.size() == 2) getIdsFromName(SubNames[1], Obj, GeoId2, PosId2); @@ -3009,10 +3009,10 @@ void CmdSketcherConstrainDistanceY::activated(int iMsg) std::swap(PosId1,PosId2); } - if (GeoId1 == Sketcher::GeoEnum::VAxis && PosId1 == Sketcher::none) // reject vertical axis from selection + if (GeoId1 == Sketcher::GeoEnum::VAxis && PosId1 == Sketcher::PointPos::none) // reject vertical axis from selection GeoId1 = GeoEnum::GeoUndef; - else if (GeoId1 == Sketcher::GeoEnum::HAxis && PosId1 == Sketcher::none) - PosId1 = Sketcher::start; + else if (GeoId1 == Sketcher::GeoEnum::HAxis && PosId1 == Sketcher::PointPos::none) + PosId1 = Sketcher::PointPos::start; if (isEdge(GeoId1,PosId1) && GeoId2 == GeoEnum::GeoUndef) { // vertical length of a line if (GeoId1 < 0 && GeoId1 >= Sketcher::GeoEnum::VAxis) { @@ -3026,9 +3026,9 @@ void CmdSketcherConstrainDistanceY::activated(int iMsg) const Part::Geometry *geom = Obj->getGeometry(GeoId1); if (geom->getTypeId() == Part::GeomLineSegment::getClassTypeId()) { //convert to as if two endpoints of the line have been selected - PosId1 = Sketcher::start; + PosId1 = Sketcher::PointPos::start; GeoId2 = GeoId1; - PosId2 = Sketcher::end; + PosId2 = Sketcher::PointPos::end; } } @@ -3048,7 +3048,7 @@ void CmdSketcherConstrainDistanceY::activated(int iMsg) openCommand(QT_TRANSLATE_NOOP("Command", "Add point to point vertical distance constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(),"addConstraint(Sketcher.Constraint('DistanceY',%d,%d,%d,%d,%f)) ", - GeoId1,PosId1,GeoId2,PosId2,ActLength); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2),ActLength); if (arebothpointsorsegmentsfixed || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving @@ -3078,7 +3078,7 @@ void CmdSketcherConstrainDistanceY::activated(int iMsg) openCommand(QT_TRANSLATE_NOOP("Command", "Add fixed y-coordinate constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('DistanceY',%d,%d,%f)) ", - GeoId1,PosId1,ActY); + GeoId1,static_cast(PosId1),ActY); if (GeoId1 <= Sketcher::GeoEnum::RefExt || isBsplineKnot(Obj,GeoId1) @@ -3107,7 +3107,7 @@ void CmdSketcherConstrainDistanceY::applyConstraint(std::vector &selS Sketcher::SketchObject* Obj = sketchgui->getSketchObject(); int GeoId1 = GeoEnum::GeoUndef, GeoId2 = GeoEnum::GeoUndef; - Sketcher::PointPos PosId1 = Sketcher::none, PosId2 = Sketcher::none; + Sketcher::PointPos PosId1 = Sketcher::PointPos::none, PosId2 = Sketcher::PointPos::none; switch (seqIndex) { case 0: // {SelVertex, SelVertexOrRoot} @@ -3121,7 +3121,7 @@ void CmdSketcherConstrainDistanceY::applyConstraint(std::vector &selS case 3: // {SelExternalEdge} { GeoId1 = GeoId2 = selSeq.at(0).GeoId; - PosId1 = Sketcher::start; PosId2 = Sketcher::end; + PosId1 = Sketcher::PointPos::start; PosId2 = Sketcher::PointPos::end; const Part::Geometry *geom = Obj->getGeometry(GeoId1); if (geom->getTypeId() != Part::GeomLineSegment::getClassTypeId()) { @@ -3150,7 +3150,7 @@ void CmdSketcherConstrainDistanceY::applyConstraint(std::vector &selS openCommand(QT_TRANSLATE_NOOP("Command", "Add point to point vertical distance constraint")); Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('DistanceY',%d,%d,%d,%d,%f)) ", - GeoId1,PosId1,GeoId2,PosId2,ActLength); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2),ActLength); if (areBothPointsOrSegmentsFixed(Obj,GeoId1, GeoId2) || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); @@ -3448,21 +3448,21 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) //add missing point-on-object constraints if(! IsPointAlreadyOnCurve(GeoId1, GeoId3, PosId3, Obj)){ Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId1); + GeoId3,static_cast(PosId3),GeoId1); }; if(! IsPointAlreadyOnCurve(GeoId2, GeoId3, PosId3, Obj)){ Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId2); + GeoId3,static_cast(PosId3),GeoId2); }; if(! IsPointAlreadyOnCurve(GeoId1, GeoId3, PosId3, Obj)){//FIXME: it's a good idea to add a check if the sketch is solved Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId1); + GeoId3,static_cast(PosId3),GeoId1); }; Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('PerpendicularViaPoint',%d,%d,%d,%d)) ", - GeoId1,GeoId2,GeoId3,PosId3); + GeoId1,GeoId2,GeoId3,static_cast(PosId3)); } catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what()); QMessageBox::warning(Gui::getMainWindow(), @@ -3512,7 +3512,7 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) openCommand(QT_TRANSLATE_NOOP("Command", "Add perpendicular constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('Perpendicular',%d,%d,%d,%d)) ", - GeoId1,PosId1,GeoId2,PosId2); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2)); commitCommand(); tryAutoRecompute(Obj); @@ -3549,7 +3549,7 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) openCommand(QT_TRANSLATE_NOOP("Command", "Add perpendicularity constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('Perpendicular',%d,%d,%d)) ", - GeoId1,PosId1,GeoId2); + GeoId1,static_cast(PosId1),GeoId2); commitCommand(); tryAutoRecompute(Obj); @@ -3674,14 +3674,14 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) // Point on first object (ellipse, arc of ellipse) Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoIdPoint,Sketcher::start,GeoId1); + GeoIdPoint,static_cast(Sketcher::PointPos::start),GeoId1); // Point on second object Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoIdPoint,Sketcher::start,GeoId2); + GeoIdPoint,static_cast(Sketcher::PointPos::start),GeoId2); // add constraint: Perpendicular-via-point Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('PerpendicularViaPoint',%d,%d,%d,%d))", - GeoId1, GeoId2 ,GeoIdPoint, Sketcher::start); + GeoId1, GeoId2 ,GeoIdPoint, static_cast(Sketcher::PointPos::start)); } catch (const Base::Exception& e) { @@ -3723,7 +3723,7 @@ void CmdSketcherConstrainPerpendicular::applyConstraint(std::vector & Sketcher::SketchObject* Obj = sketchgui->getSketchObject(); int GeoId1 = GeoEnum::GeoUndef, GeoId2 = GeoEnum::GeoUndef, GeoId3 = GeoEnum::GeoUndef; - Sketcher::PointPos PosId1 = Sketcher::none, PosId2 = Sketcher::none, PosId3 = Sketcher::none; + Sketcher::PointPos PosId1 = Sketcher::PointPos::none, PosId2 = Sketcher::PointPos::none, PosId3 = Sketcher::PointPos::none; // check if the edge already has a Block constraint if ( areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2) ) { @@ -3855,14 +3855,14 @@ void CmdSketcherConstrainPerpendicular::applyConstraint(std::vector & // Point on first object (ellipse, arc of ellipse) Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoIdPoint,Sketcher::start,GeoId1); + GeoIdPoint,static_cast(Sketcher::PointPos::start),GeoId1); // Point on second object Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoIdPoint,Sketcher::start,GeoId2); + GeoIdPoint,static_cast(Sketcher::PointPos::start),GeoId2); // add constraint: Perpendicular-via-point Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('PerpendicularViaPoint',%d,%d,%d,%d))", - GeoId1, GeoId2 ,GeoIdPoint, Sketcher::start); + GeoId1, GeoId2 ,GeoIdPoint, static_cast(Sketcher::PointPos::start)); commitCommand(); } @@ -3927,21 +3927,21 @@ void CmdSketcherConstrainPerpendicular::applyConstraint(std::vector & //add missing point-on-object constraints if(! IsPointAlreadyOnCurve(GeoId1, GeoId3, PosId3, Obj)){ Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId1); + GeoId3,static_cast(PosId3),GeoId1); }; if(! IsPointAlreadyOnCurve(GeoId2, GeoId3, PosId3, Obj)){ Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId2); + GeoId3,static_cast(PosId3),GeoId2); }; if(! IsPointAlreadyOnCurve(GeoId1, GeoId3, PosId3, Obj)){//FIXME: it's a good idea to add a check if the sketch is solved Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId1); + GeoId3,static_cast(PosId3),GeoId1); }; Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('PerpendicularViaPoint',%d,%d,%d,%d)) ", - GeoId1,GeoId2,GeoId3,PosId3); + GeoId1,GeoId2,GeoId3,static_cast(PosId3)); } catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what()); QMessageBox::warning(Gui::getMainWindow(), @@ -4140,21 +4140,21 @@ void CmdSketcherConstrainTangent::activated(int iMsg) //add missing point-on-object constraints if(! IsPointAlreadyOnCurve(GeoId1, GeoId3, PosId3, Obj)){ Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId1); + GeoId3,static_cast(PosId3),GeoId1); }; if(! IsPointAlreadyOnCurve(GeoId2, GeoId3, PosId3, Obj)){ Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId2); + GeoId3,static_cast(PosId3),GeoId2); }; if(! IsPointAlreadyOnCurve(GeoId1, GeoId3, PosId3, Obj)){//FIXME: it's a good idea to add a check if the sketch is solved Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId1); + GeoId3,static_cast(PosId3),GeoId1); }; Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('TangentViaPoint',%d,%d,%d,%d)) ", - GeoId1,GeoId2,GeoId3,PosId3); + GeoId1,GeoId2,GeoId3,static_cast(PosId3)); } catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what()); QMessageBox::warning(Gui::getMainWindow(), @@ -4224,7 +4224,7 @@ void CmdSketcherConstrainTangent::activated(int iMsg) openCommand(QT_TRANSLATE_NOOP("Command", "Add tangent constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('Tangent',%d,%d,%d)) ", - GeoId1,PosId1,GeoId2); + GeoId1,static_cast(PosId1),GeoId2); commitCommand(); tryAutoRecompute(Obj); @@ -4415,7 +4415,7 @@ void CmdSketcherConstrainTangent::applyConstraint(std::vector &selSeq QString strError; int GeoId1 = GeoEnum::GeoUndef, GeoId2 = GeoEnum::GeoUndef, GeoId3 = GeoEnum::GeoUndef; - Sketcher::PointPos PosId1 = Sketcher::none, PosId2 = Sketcher::none, PosId3 = Sketcher::none; + Sketcher::PointPos PosId1 = Sketcher::PointPos::none, PosId2 = Sketcher::PointPos::none, PosId3 = Sketcher::PointPos::none; // check if the edge already has a Block constraint if ( areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2) ) { @@ -4612,7 +4612,7 @@ void CmdSketcherConstrainTangent::applyConstraint(std::vector &selSeq openCommand(QT_TRANSLATE_NOOP("Command", "Add tangent constraint")); Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('Tangent',%d,%d,%d,%d)) ", - GeoId1,PosId1,GeoId2,PosId2); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2)); commitCommand(); tryAutoRecompute(Obj); @@ -4637,21 +4637,21 @@ void CmdSketcherConstrainTangent::applyConstraint(std::vector &selSeq //add missing point-on-object constraints if(! IsPointAlreadyOnCurve(GeoId1, GeoId3, PosId3, Obj)){ Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId1); + GeoId3,static_cast(PosId3),GeoId1); }; if(! IsPointAlreadyOnCurve(GeoId2, GeoId3, PosId3, Obj)){ Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId2); + GeoId3,static_cast(PosId3),GeoId2); }; if(! IsPointAlreadyOnCurve(GeoId1, GeoId3, PosId3, Obj)){//FIXME: it's a good idea to add a check if the sketch is solved Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId1); + GeoId3,static_cast(PosId3),GeoId1); }; Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('TangentViaPoint',%d,%d,%d,%d)) ", - GeoId1,GeoId2,GeoId3,PosId3); + GeoId1,GeoId2,GeoId3,static_cast(PosId3)); } catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what()); QMessageBox::warning(Gui::getMainWindow(), @@ -5778,7 +5778,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) int GeoId1, GeoId2=GeoEnum::GeoUndef, GeoId3 = GeoEnum::GeoUndef; - Sketcher::PointPos PosId1, PosId2=Sketcher::none, PosId3 = Sketcher::none; + Sketcher::PointPos PosId1, PosId2=Sketcher::PointPos::none, PosId3 = Sketcher::PointPos::none; getIdsFromName(SubNames[0], Obj, GeoId1, PosId1); if (SubNames.size() > 1) getIdsFromName(SubNames[1], Obj, GeoId2, PosId2); @@ -5814,15 +5814,15 @@ void CmdSketcherConstrainAngle::activated(int iMsg) //add missing point-on-object constraints if (!IsPointAlreadyOnCurve(GeoId1, GeoId3, PosId3, Obj)) { Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId1); + GeoId3,static_cast(PosId3),GeoId1); } if (!IsPointAlreadyOnCurve(GeoId2, GeoId3, PosId3, Obj)) { Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId2); + GeoId3,static_cast(PosId3),GeoId2); } if (!IsPointAlreadyOnCurve(GeoId1, GeoId3, PosId3, Obj)) {//FIXME: it's a good idea to add a check if the sketch is solved Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId1); + GeoId3,static_cast(PosId3),GeoId1); } //assuming point-on-curves have been solved, calculate the angle. @@ -5839,7 +5839,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) } Gui::cmdAppObjectArgs(selection[0].getObject(),"addConstraint(Sketcher.Constraint('AngleViaPoint',%d,%d,%d,%d,%f)) ", - GeoId1,GeoId2,GeoId3,PosId3,ActAngle); + GeoId1,GeoId2,GeoId3,static_cast(PosId3),ActAngle); if (bothexternal || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); @@ -5879,8 +5879,8 @@ void CmdSketcherConstrainAngle::activated(int iMsg) const Part::GeomLineSegment *lineSeg2 = static_cast(geom2); // find the two closest line ends - Sketcher::PointPos PosId1 = Sketcher::none; - Sketcher::PointPos PosId2 = Sketcher::none; + Sketcher::PointPos PosId1 = Sketcher::PointPos::none; + Sketcher::PointPos PosId2 = Sketcher::PointPos::none; Base::Vector3d p1[2], p2[2]; p1[0] = lineSeg1->getStartPoint(); p1[1] = lineSeg1->getEndPoint(); @@ -5895,13 +5895,13 @@ void CmdSketcherConstrainAngle::activated(int iMsg) // get the end points of the line segments that are closest to the intersection point Base::Vector3d s3d(s.x, s.y, p1[0].z); if (Base::DistanceP2(s3d, p1[0]) < Base::DistanceP2(s3d, p1[1])) - PosId1 = Sketcher::start; + PosId1 = Sketcher::PointPos::start; else - PosId1 = Sketcher::end; + PosId1 = Sketcher::PointPos::end; if (Base::DistanceP2(s3d, p2[0]) < Base::DistanceP2(s3d, p2[1])) - PosId2 = Sketcher::start; + PosId2 = Sketcher::PointPos::start; else - PosId2 = Sketcher::end; + PosId2 = Sketcher::PointPos::end; } else { // if all points are collinear @@ -5911,16 +5911,16 @@ void CmdSketcherConstrainAngle::activated(int iMsg) double tmp = Base::DistanceP2(p2[j], p1[i]); if (tmp < length) { length = tmp; - PosId1 = i ? Sketcher::end : Sketcher::start; - PosId2 = j ? Sketcher::end : Sketcher::start; + PosId1 = i ? Sketcher::PointPos::end : Sketcher::PointPos::start; + PosId2 = j ? Sketcher::PointPos::end : Sketcher::PointPos::start; } } } } - Base::Vector3d dir1 = ((PosId1 == Sketcher::start) ? 1. : -1.) * + Base::Vector3d dir1 = ((PosId1 == Sketcher::PointPos::start) ? 1. : -1.) * (lineSeg1->getEndPoint()-lineSeg1->getStartPoint()); - Base::Vector3d dir2 = ((PosId2 == Sketcher::start) ? 1. : -1.) * + Base::Vector3d dir2 = ((PosId2 == Sketcher::PointPos::start) ? 1. : -1.) * (lineSeg2->getEndPoint()-lineSeg2->getStartPoint()); // check if the two lines are parallel, in this case an angle is not possible @@ -5944,7 +5944,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) openCommand(QT_TRANSLATE_NOOP("Command", "Add angle constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(),"addConstraint(Sketcher.Constraint('Angle',%d,%d,%d,%d,%f)) ", - GeoId1,PosId1,GeoId2,PosId2,ActAngle); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2),ActAngle); if (bothexternal || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); @@ -6027,7 +6027,7 @@ void CmdSketcherConstrainAngle::applyConstraint(std::vector &selSeq, Sketcher::SketchObject* Obj = sketchgui->getSketchObject(); int GeoId1 = GeoEnum::GeoUndef, GeoId2 = GeoEnum::GeoUndef, GeoId3 = GeoEnum::GeoUndef; - Sketcher::PointPos PosId1 = Sketcher::none, PosId2 = Sketcher::none, PosId3 = Sketcher::none; + Sketcher::PointPos PosId1 = Sketcher::PointPos::none, PosId2 = Sketcher::PointPos::none, PosId3 = Sketcher::PointPos::none; switch (seqIndex) { case 0: // {SelEdge, SelEdgeOrAxis} @@ -6046,8 +6046,8 @@ void CmdSketcherConstrainAngle::applyConstraint(std::vector &selSeq, const Part::GeomLineSegment *lineSeg2 = static_cast(geom2); // find the two closest line ends - Sketcher::PointPos PosId1 = Sketcher::none; - Sketcher::PointPos PosId2 = Sketcher::none; + Sketcher::PointPos PosId1 = Sketcher::PointPos::none; + Sketcher::PointPos PosId2 = Sketcher::PointPos::none; Base::Vector3d p1[2], p2[2]; p1[0] = lineSeg1->getStartPoint(); p1[1] = lineSeg1->getEndPoint(); @@ -6062,13 +6062,13 @@ void CmdSketcherConstrainAngle::applyConstraint(std::vector &selSeq, // get the end points of the line segments that are closest to the intersection point Base::Vector3d s3d(s.x, s.y, p1[0].z); if (Base::DistanceP2(s3d, p1[0]) < Base::DistanceP2(s3d, p1[1])) - PosId1 = Sketcher::start; + PosId1 = Sketcher::PointPos::start; else - PosId1 = Sketcher::end; + PosId1 = Sketcher::PointPos::end; if (Base::DistanceP2(s3d, p2[0]) < Base::DistanceP2(s3d, p2[1])) - PosId2 = Sketcher::start; + PosId2 = Sketcher::PointPos::start; else - PosId2 = Sketcher::end; + PosId2 = Sketcher::PointPos::end; } else { // if all points are collinear @@ -6078,16 +6078,16 @@ void CmdSketcherConstrainAngle::applyConstraint(std::vector &selSeq, double tmp = Base::DistanceP2(p2[j], p1[i]); if (tmp < length) { length = tmp; - PosId1 = i ? Sketcher::end : Sketcher::start; - PosId2 = j ? Sketcher::end : Sketcher::start; + PosId1 = i ? Sketcher::PointPos::end : Sketcher::PointPos::start; + PosId2 = j ? Sketcher::PointPos::end : Sketcher::PointPos::start; } } } } - Base::Vector3d dir1 = ((PosId1 == Sketcher::start) ? 1. : -1.) * + Base::Vector3d dir1 = ((PosId1 == Sketcher::PointPos::start) ? 1. : -1.) * (lineSeg1->getEndPoint()-lineSeg1->getStartPoint()); - Base::Vector3d dir2 = ((PosId2 == Sketcher::start) ? 1. : -1.) * + Base::Vector3d dir2 = ((PosId2 == Sketcher::PointPos::start) ? 1. : -1.) * (lineSeg2->getEndPoint()-lineSeg2->getStartPoint()); // check if the two lines are parallel, in this case an angle is not possible @@ -6111,7 +6111,7 @@ void CmdSketcherConstrainAngle::applyConstraint(std::vector &selSeq, openCommand(QT_TRANSLATE_NOOP("Command", "Add angle constraint")); Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('Angle',%d,%d,%d,%d,%f)) ", - GeoId1,PosId1,GeoId2,PosId2,ActAngle); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2),ActAngle); if (areBothPointsOrSegmentsFixed(Obj,GeoId1, GeoId2) || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving @@ -6168,16 +6168,16 @@ void CmdSketcherConstrainAngle::applyConstraint(std::vector &selSeq, //add missing point-on-object constraints if(! IsPointAlreadyOnCurve(GeoId1, GeoId3, PosId3, Obj)){ Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId1); + GeoId3,static_cast(PosId3),GeoId1); } if(! IsPointAlreadyOnCurve(GeoId2, GeoId3, PosId3, Obj)){ Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId2); + GeoId3,static_cast(PosId3),GeoId2); } if(! IsPointAlreadyOnCurve(GeoId1, GeoId3, PosId3, Obj)){ //FIXME: it's a good idea to add a check if the sketch is solved Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId3,PosId3,GeoId1); + GeoId3,static_cast(PosId3),GeoId1); } //assuming point-on-curves have been solved, calculate the angle. @@ -6194,7 +6194,7 @@ void CmdSketcherConstrainAngle::applyConstraint(std::vector &selSeq, } Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('AngleViaPoint',%d,%d,%d,%d,%f)) ", - GeoId1,GeoId2,GeoId3,PosId3,ActAngle); + GeoId1,GeoId2,GeoId3,static_cast(PosId3),ActAngle); if (bothexternal || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving @@ -6553,7 +6553,7 @@ void CmdSketcherConstrainSymmetric::activated(int iMsg) openCommand(QT_TRANSLATE_NOOP("Command", "Add symmetric constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('Symmetric',%d,%d,%d,%d,%d,%d)) ", - GeoId1,Sketcher::start,GeoId1,Sketcher::end,GeoId2,PosId2); + GeoId1,static_cast(Sketcher::PointPos::start),GeoId1,static_cast(Sketcher::PointPos::end),GeoId2,static_cast(PosId2)); // finish the transaction and update commitCommand(); @@ -6605,7 +6605,7 @@ void CmdSketcherConstrainSymmetric::activated(int iMsg) openCommand(QT_TRANSLATE_NOOP("Command", "Add symmetric constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('Symmetric',%d,%d,%d,%d,%d)) ", - GeoId1,PosId1,GeoId2,PosId2,GeoId3); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2),GeoId3); // finish the transaction and update commitCommand(); @@ -6621,7 +6621,7 @@ void CmdSketcherConstrainSymmetric::activated(int iMsg) openCommand(QT_TRANSLATE_NOOP("Command", "Add symmetric constraint")); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('Symmetric',%d,%d,%d,%d,%d,%d)) ", - GeoId1,PosId1,GeoId2,PosId2,GeoId3,PosId3); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2),GeoId3,static_cast(PosId3)); // finish the transaction and update commitCommand(); @@ -6645,14 +6645,14 @@ void CmdSketcherConstrainSymmetric::applyConstraint(std::vector &selS QString strError; int GeoId1 = GeoEnum::GeoUndef, GeoId2 = GeoEnum::GeoUndef, GeoId3 = GeoEnum::GeoUndef; - Sketcher::PointPos PosId1 = Sketcher::none, PosId2 = Sketcher::none, PosId3 = Sketcher::none; + Sketcher::PointPos PosId1 = Sketcher::PointPos::none, PosId2 = Sketcher::PointPos::none, PosId3 = Sketcher::PointPos::none; switch (seqIndex) { case 0: // {SelEdge, SelVertexOrRoot} case 1: // {SelExternalEdge, SelVertex} { GeoId1 = GeoId2 = selSeq.at(0).GeoId; GeoId3 = selSeq.at(1).GeoId; - PosId1 = Sketcher::start; PosId2 = Sketcher::end; PosId3 = selSeq.at(1).PosId; + PosId1 = Sketcher::PointPos::start; PosId2 = Sketcher::PointPos::end; PosId3 = selSeq.at(1).PosId; if (GeoId1 == GeoId3) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), @@ -6706,7 +6706,7 @@ void CmdSketcherConstrainSymmetric::applyConstraint(std::vector &selS // undo command open openCommand(QT_TRANSLATE_NOOP("Command", "Add symmetric constraint")); Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('Symmetric',%d,%d,%d,%d,%d)) ", - GeoId1,PosId1,GeoId2,PosId2,GeoId3); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2),GeoId3); // finish the transaction and update commitCommand(); @@ -6741,7 +6741,7 @@ void CmdSketcherConstrainSymmetric::applyConstraint(std::vector &selS // undo command open openCommand(QT_TRANSLATE_NOOP("Command", "Add symmetric constraint")); Gui::cmdAppObjectArgs(Obj,"addConstraint(Sketcher.Constraint('Symmetric',%d,%d,%d,%d,%d,%d)) ", - GeoId1,PosId1,GeoId2,PosId2,GeoId3,PosId3); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2),GeoId3,static_cast(PosId3)); // finish the transaction and update commitCommand(); @@ -6883,15 +6883,15 @@ void CmdSketcherConstrainSnellsLaw::activated(int iMsg) if (! IsPointAlreadyOnCurve(GeoId2,GeoId1,PosId1,Obj)) Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('Coincident',%d,%d,%d,%d)) ", - GeoId1,PosId1,GeoId2,PosId2); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2)); if (! IsPointAlreadyOnCurve(GeoId3,GeoId1,PosId1,Obj)) Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%d,%d,%d)) ", - GeoId1,PosId1,GeoId3); + GeoId1,static_cast(PosId1),GeoId3); Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('SnellsLaw',%d,%d,%d,%d,%d,%.12f)) ", - GeoId1,PosId1,GeoId2,PosId2,GeoId3,n2divn1); + GeoId1,static_cast(PosId1),GeoId2,static_cast(PosId2),GeoId3,n2divn1); /*if (allexternal || constraintCreationMode==Reference) { // it is a constraint on a external line, make it non-driving const std::vector &ConStr = Obj->Constraints.getValues(); @@ -7095,12 +7095,12 @@ void CmdSketcherConstrainInternalAlignment::activated(int iMsg) if(!focus1) { Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('InternalAlignment:EllipseFocus1',%d,%d,%d)) ", - pointids[0],Sketcher::start,ellipseids[0]); + pointids[0],static_cast(Sketcher::PointPos::start),ellipseids[0]); } else if(!focus2) { Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('InternalAlignment:EllipseFocus2',%d,%d,%d)) ", - pointids[0],Sketcher::start,ellipseids[0]); + pointids[0],static_cast(Sketcher::PointPos::start),ellipseids[0]); focus2=true; } else @@ -7112,7 +7112,7 @@ void CmdSketcherConstrainInternalAlignment::activated(int iMsg) if(!focus2) { Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('InternalAlignment:EllipseFocus2',%d,%d,%d)) ", - pointids[1],Sketcher::start,ellipseids[0]); + pointids[1],static_cast(Sketcher::PointPos::start),ellipseids[0]); } else extra_elements=true; @@ -7273,12 +7273,12 @@ void CmdSketcherConstrainInternalAlignment::activated(int iMsg) if(!focus1) { Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('InternalAlignment:EllipseFocus1',%d,%d,%d)) ", - pointids[0],Sketcher::start,arcsofellipseids[0]); + pointids[0],static_cast(Sketcher::PointPos::start),arcsofellipseids[0]); } else if(!focus2) { Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('InternalAlignment:EllipseFocus2',%d,%d,%d)) ", - pointids[0],Sketcher::start,arcsofellipseids[0]); + pointids[0],static_cast(Sketcher::PointPos::start),arcsofellipseids[0]); focus2=true; } else @@ -7290,7 +7290,7 @@ void CmdSketcherConstrainInternalAlignment::activated(int iMsg) if(!focus2) { Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('InternalAlignment:EllipseFocus2',%d,%d,%d)) ", - pointids[1],Sketcher::start,arcsofellipseids[0]); + pointids[1],static_cast(Sketcher::PointPos::start),arcsofellipseids[0]); } else extra_elements=true; diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index ac1bd1b684..1cb60f7f8b 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -195,17 +195,17 @@ void removeRedundantHorizontalVertical(Sketcher::SketchObject* psketch, geoId1iterator = coincidents.find(-1); if( geoId1iterator != coincidents.end()) { - if( (*geoId1iterator).second == Sketcher::start ) + if( (*geoId1iterator).second == Sketcher::PointPos::start ) orig = true; } } else { // it may be that there is no constraint at all, but there is external geometry ext = (*it).GeoId < 0; - orig = ((*it).GeoId == -1 && (*it).PosId == Sketcher::start); + orig = ((*it).GeoId == -1 && (*it).PosId == Sketcher::PointPos::start); } } else if( (*it).Type == Sketcher::PointOnObject && axis == false) { - axis = (((*it).GeoId == -1 && (*it).PosId == Sketcher::none) || ((*it).GeoId == -2 && (*it).PosId == Sketcher::none)); + axis = (((*it).GeoId == -1 && (*it).PosId == Sketcher::PointPos::none) || ((*it).GeoId == -2 && (*it).PosId == Sketcher::PointPos::none)); } } @@ -340,13 +340,13 @@ public: // add auto constraints for the line segment start if (!sugConstr1.empty()) { - createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::start); + createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::start); sugConstr1.clear(); } // add auto constraints for the line segment end if (!sugConstr2.empty()) { - createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::end); + createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::PointPos::end); sugConstr2.clear(); } @@ -626,13 +626,13 @@ public: if(constructionMethod == Diagonal) { // add auto constraints at the start of the first side if (sugConstr1.size() > 0) { - createAutoConstraints(sugConstr1, getHighestCurveIndex() - 3 , Sketcher::start); + createAutoConstraints(sugConstr1, getHighestCurveIndex() - 3 , Sketcher::PointPos::start); sugConstr1.clear(); } // add auto constraints at the end of the second side if (sugConstr2.size() > 0) { - createAutoConstraints(sugConstr2, getHighestCurveIndex() - 2, Sketcher::end); + createAutoConstraints(sugConstr2, getHighestCurveIndex() - 2, Sketcher::PointPos::end); sugConstr2.clear(); } @@ -640,13 +640,13 @@ public: else if (constructionMethod == CenterAndCorner) { // add auto constraints at the start of the first side if (sugConstr1.size() > 0) { - createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::start); + createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::start); sugConstr1.clear(); } // add auto constraints at the end of the second side if (sugConstr2.size() > 0) { - createAutoConstraints(sugConstr2, getHighestCurveIndex() - 3, Sketcher::end); + createAutoConstraints(sugConstr2, getHighestCurveIndex() - 3, Sketcher::PointPos::end); sugConstr2.clear(); } } @@ -1002,13 +1002,13 @@ public: // add auto constraints at the StartPos auxiliary point if (sugConstr1.size() > 0) { - createAutoConstraints(sugConstr1, getHighestCurveIndex() - 1, Sketcher::start); + createAutoConstraints(sugConstr1, getHighestCurveIndex() - 1, Sketcher::PointPos::start); sugConstr1.clear(); } // add auto constraints at the EndPos auxiliary point if (sugConstr2.size() > 0) { - createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::start); + createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::PointPos::start); sugConstr2.clear(); } @@ -1215,8 +1215,8 @@ public: , EditCurve(2) , firstCurve(-1) , previousCurve(-1) - , firstPosId(Sketcher::none) - , previousPosId(Sketcher::none) + , firstPosId(Sketcher::PointPos::none) + , previousPosId(Sketcher::PointPos::none) , startAngle(0) , endAngle(0) , arcRadius(0) @@ -1478,8 +1478,8 @@ public: const Part::Geometry *geom = sketchgui->getSketchObject()->getGeometry(sugConstr1[i].GeoId); if ((geom->getTypeId() == Part::GeomLineSegment::getClassTypeId() || geom->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) && - (sugConstr1[i].PosId == Sketcher::start || - sugConstr1[i].PosId == Sketcher::end)) { + (sugConstr1[i].PosId == Sketcher::PointPos::start || + sugConstr1[i].PosId == Sketcher::PointPos::end)) { previousCurve = sugConstr1[i].GeoId; previousPosId = sugConstr1[i].PosId; updateTransitionData(previousCurve,previousPosId); // -> dirVec, EditCurve[0] @@ -1494,7 +1494,7 @@ public: // remember our first point (even if we are doing a transition from a previous curve) firstCurve = getHighestCurveIndex() + 1; - firstPosId = Sketcher::start; + firstPosId = Sketcher::PointPos::start; if (SegmentMode == SEGMENT_MODE_Line) EditCurve.resize(TransitionMode == TRANSITION_MODE_Free ? 2 : 3); @@ -1522,8 +1522,8 @@ public: suppressTransition=false; firstCurve=-1; previousCurve=-1; - firstPosId=Sketcher::none; - previousPosId=Sketcher::none; + firstPosId=Sketcher::PointPos::none; + previousPosId=Sketcher::PointPos::none; EditCurve.clear(); sketchgui->drawEdit(EditCurve); EditCurve.resize(2); @@ -1541,16 +1541,17 @@ public: } Mode = STATUS_Do; - if (sketchgui->getPreselectPoint() != -1 && firstPosId != Sketcher::none) { + + if (sketchgui->getPreselectPoint() != -1 && firstPosId != Sketcher::PointPos::none) { int GeoId; Sketcher::PointPos PosId; sketchgui->getSketchObject()->getGeoVertexIndex(sketchgui->getPreselectPoint(),GeoId,PosId); if (sketchgui->getSketchObject()->arePointsCoincident(GeoId,PosId,firstCurve,firstPosId)) Mode = STATUS_Close; } - else if (sketchgui->getPreselectCross() == 0 && firstPosId != Sketcher::none) { + else if (sketchgui->getPreselectCross() == 0 && firstPosId != Sketcher::PointPos::none) { // close line started at root point - if (sketchgui->getSketchObject()->arePointsCoincident(-1,Sketcher::start,firstCurve,firstPosId)) + if (sketchgui->getSketchObject()->arePointsCoincident(-1,Sketcher::PointPos::start,firstCurve,firstPosId)) Mode = STATUS_Close; } } @@ -1603,11 +1604,11 @@ public: int lastCurve = getHighestCurveIndex(); // issue the constraint - if (addedGeometry && (previousPosId != Sketcher::none)) { + if (addedGeometry && (previousPosId != Sketcher::PointPos::none)) { Sketcher::PointPos lastStartPosId = (SegmentMode == SEGMENT_MODE_Arc && startAngle > endAngle) ? - Sketcher::end : Sketcher::start; + Sketcher::PointPos::end : Sketcher::PointPos::start; Sketcher::PointPos lastEndPosId = (SegmentMode == SEGMENT_MODE_Arc && startAngle > endAngle) ? - Sketcher::start : Sketcher::end; + Sketcher::PointPos::start : Sketcher::PointPos::end; // in case of a tangency constraint, the coincident constraint is redundant std::string constrType = "Coincident"; if (!suppressTransition && previousCurve != -1) { @@ -1618,7 +1619,7 @@ public: constrType = "Perpendicular"; } Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('%s',%i,%i,%i,%i)) ", - constrType.c_str(), previousCurve, previousPosId, lastCurve, lastStartPosId); + constrType.c_str(), previousCurve, static_cast(previousPosId), lastCurve, static_cast(lastStartPosId)); if(SnapMode == SNAP_MODE_45Degree && Mode != STATUS_Close) { // -360, -315, -270, -225, -180, -135, -90, -45, 0, 45, 90, 135, 180, 225, 270, 315, 360 @@ -1633,7 +1634,7 @@ public: if (Mode == STATUS_Close) { // close the loop by constrain to the first curve point Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Coincident',%i,%i,%i,%i)) ", - lastCurve,lastEndPosId,firstCurve,firstPosId); + lastCurve,static_cast(lastEndPosId),firstCurve,static_cast(firstPosId)); } Gui::Command::commitCommand(); @@ -1661,7 +1662,7 @@ public: if (sugConstr2[i].Type != Sketcher::Coincident) sugConstr.push_back(sugConstr2[i]); } - createAutoConstraints(sugConstr, getHighestCurveIndex(), Sketcher::end); + createAutoConstraints(sugConstr, getHighestCurveIndex(), Sketcher::PointPos::end); sugConstr2.clear(); } @@ -1685,8 +1686,8 @@ public: suppressTransition=false; firstCurve=-1; previousCurve=-1; - firstPosId=Sketcher::none; - previousPosId=Sketcher::none; + firstPosId=Sketcher::PointPos::none; + previousPosId=Sketcher::PointPos::none; EditCurve.clear(); sketchgui->drawEdit(EditCurve); EditCurve.resize(2); @@ -1705,7 +1706,7 @@ public: // Add auto constraints if (sugConstr1.size() > 0) { // this is relevant only to the very first point - createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::start); + createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::start); sugConstr1.clear(); } @@ -1724,7 +1725,7 @@ public: if (sugConstr2.size() > 0) { createAutoConstraints(sugConstr2, getHighestCurveIndex(), (SegmentMode == SEGMENT_MODE_Arc && startAngle > endAngle) ? - Sketcher::start : Sketcher::end); + Sketcher::PointPos::start : Sketcher::PointPos::end); sugConstr2.clear(); } @@ -1733,7 +1734,7 @@ public: // remember the vertex for the next rounds constraint.. previousCurve = getHighestCurveIndex(); previousPosId = (SegmentMode == SEGMENT_MODE_Arc && startAngle > endAngle) ? - Sketcher::start : Sketcher::end; // cw arcs are rendered in reverse + Sketcher::PointPos::start : Sketcher::PointPos::end; // cw arcs are rendered in reverse // setup for the next line segment // calculate dirVec and EditCurve[0] @@ -1785,8 +1786,8 @@ public: suppressTransition=false; firstCurve=-1; previousCurve=-1; - firstPosId=Sketcher::none; - previousPosId=Sketcher::none; + firstPosId=Sketcher::PointPos::none; + previousPosId=Sketcher::PointPos::none; firstsegment=true; EditCurve.clear(); sketchgui->drawEdit(EditCurve); @@ -1826,7 +1827,7 @@ protected: dirVec.Set(lineSeg->getEndPoint().x - lineSeg->getStartPoint().x, lineSeg->getEndPoint().y - lineSeg->getStartPoint().y, 0.f); - if (PosId == Sketcher::start) { + if (PosId == Sketcher::PointPos::start) { dirVec *= -1; EditCurve[0] = Base::Vector2d(lineSeg->getStartPoint().x, lineSeg->getStartPoint().y); } @@ -1835,7 +1836,7 @@ protected: } else if (geom->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) { const Part::GeomArcOfCircle *arcSeg = static_cast(geom); - if (PosId == Sketcher::start) { + if (PosId == Sketcher::PointPos::start) { EditCurve[0] = Base::Vector2d(arcSeg->getStartPoint(/*emulateCCW=*/true).x,arcSeg->getStartPoint(/*emulateCCW=*/true).y); dirVec = Base::Vector3d(0.f,0.f,-1.0) % (arcSeg->getStartPoint(/*emulateCCW=*/true)-arcSeg->getCenter()); } @@ -2045,19 +2046,19 @@ public: // Auto Constraint center point if (sugConstr1.size() > 0) { - createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::mid); + createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::mid); sugConstr1.clear(); } // Auto Constraint first picked point if (sugConstr2.size() > 0) { - createAutoConstraints(sugConstr2, getHighestCurveIndex(), (arcAngle > 0) ? Sketcher::start : Sketcher::end ); + createAutoConstraints(sugConstr2, getHighestCurveIndex(), (arcAngle > 0) ? Sketcher::PointPos::start : Sketcher::PointPos::end ); sugConstr2.clear(); } // Auto Constraint second picked point if (sugConstr3.size() > 0) { - createAutoConstraints(sugConstr3, getHighestCurveIndex(), (arcAngle > 0) ? Sketcher::end : Sketcher::start); + createAutoConstraints(sugConstr3, getHighestCurveIndex(), (arcAngle > 0) ? Sketcher::PointPos::end : Sketcher::PointPos::start); sugConstr3.clear(); } @@ -2129,8 +2130,8 @@ public: : Mode(STATUS_SEEK_First), EditCurve(2) , radius(0), startAngle(0) , endAngle(0), arcAngle(0) - , arcPos1(Sketcher::none) - , arcPos2(Sketcher::none) + , arcPos1(Sketcher::PointPos::none) + , arcPos2(Sketcher::PointPos::none) { } virtual ~DrawSketchHandler3PointArc(){} @@ -2205,14 +2206,14 @@ public: if (angle2 > angle1) { EditCurve[0] = FirstPoint; EditCurve[29] = SecondPoint; - arcPos1 = Sketcher::start; - arcPos2 = Sketcher::end; + arcPos1 = Sketcher::PointPos::start; + arcPos2 = Sketcher::PointPos::end; } else { EditCurve[0] = SecondPoint; EditCurve[29] = FirstPoint; - arcPos1 = Sketcher::end; - arcPos2 = Sketcher::start; + arcPos1 = Sketcher::PointPos::end; + arcPos2 = Sketcher::PointPos::start; } startAngle = min(angle1, angle2); endAngle = max(angle1, angle2); @@ -2223,14 +2224,14 @@ public: if (angle2 > angle1) { EditCurve[0] = SecondPoint; EditCurve[29] = FirstPoint; - arcPos1 = Sketcher::end; - arcPos2 = Sketcher::start; + arcPos1 = Sketcher::PointPos::end; + arcPos2 = Sketcher::PointPos::start; } else { EditCurve[0] = FirstPoint; EditCurve[29] = SecondPoint; - arcPos1 = Sketcher::start; - arcPos2 = Sketcher::end; + arcPos1 = Sketcher::PointPos::start; + arcPos2 = Sketcher::PointPos::end; } startAngle = max(angle1, angle2); endAngle = min(angle1, angle2); @@ -2327,7 +2328,7 @@ public: // Auto Constraint third picked point if (sugConstr3.size() > 0) { - createAutoConstraints(sugConstr3, getHighestCurveIndex(), Sketcher::none); + createAutoConstraints(sugConstr3, getHighestCurveIndex(), Sketcher::PointPos::none); sugConstr3.clear(); } @@ -2585,13 +2586,13 @@ public: // add auto constraints for the center point if (sugConstr1.size() > 0) { - createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::mid); + createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::mid); sugConstr1.clear(); } // add suggested constraints for circumference if (sugConstr2.size() > 0) { - createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::none); + createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::PointPos::none); sugConstr2.clear(); } @@ -3355,30 +3356,30 @@ private: if (method == CENTER_PERIAPSIS_B) { // add auto constraints for the center point if (sugConstr1.size() > 0) { - createAutoConstraints(sugConstr1, currentgeoid, Sketcher::mid); + createAutoConstraints(sugConstr1, currentgeoid, Sketcher::PointPos::mid); sugConstr1.clear(); } if (sugConstr2.size() > 0) { - createAutoConstraints(sugConstr2, currentgeoid, Sketcher::none); + createAutoConstraints(sugConstr2, currentgeoid, Sketcher::PointPos::none); sugConstr2.clear(); } if (sugConstr3.size() > 0) { - createAutoConstraints(sugConstr3, currentgeoid, Sketcher::none); + createAutoConstraints(sugConstr3, currentgeoid, Sketcher::PointPos::none); sugConstr3.clear(); } } if (method == PERIAPSIS_APOAPSIS_B) { if (sugConstr1.size() > 0) { - createAutoConstraints(sugConstr1, currentgeoid, Sketcher::none); + createAutoConstraints(sugConstr1, currentgeoid, Sketcher::PointPos::none); sugConstr1.clear(); } if (sugConstr2.size() > 0) { - createAutoConstraints(sugConstr2, currentgeoid, Sketcher::none); + createAutoConstraints(sugConstr2, currentgeoid, Sketcher::PointPos::none); sugConstr2.clear(); } if (sugConstr3.size() > 0) { - createAutoConstraints(sugConstr3, currentgeoid, Sketcher::none); + createAutoConstraints(sugConstr3, currentgeoid, Sketcher::PointPos::none); sugConstr3.clear(); } } @@ -3727,25 +3728,25 @@ public: // add auto constraints for the center point if (sugConstr1.size() > 0) { - createAutoConstraints(sugConstr1, currentgeoid, Sketcher::mid); + createAutoConstraints(sugConstr1, currentgeoid, Sketcher::PointPos::mid); sugConstr1.clear(); } // add suggested constraints for arc if (sugConstr2.size() > 0) { - createAutoConstraints(sugConstr2, currentgeoid, Sketcher::none); + createAutoConstraints(sugConstr2, currentgeoid, Sketcher::PointPos::none); sugConstr2.clear(); } // add suggested constraints for start of arc if (sugConstr3.size() > 0) { - createAutoConstraints(sugConstr3, currentgeoid, isOriginalArcCCW?Sketcher::start:Sketcher::end); + createAutoConstraints(sugConstr3, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::start:Sketcher::PointPos::end); sugConstr3.clear(); } // add suggested constraints for start of arc if (sugConstr4.size() > 0) { - createAutoConstraints(sugConstr4, currentgeoid, isOriginalArcCCW?Sketcher::end:Sketcher::start); + createAutoConstraints(sugConstr4, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::end:Sketcher::PointPos::start); sugConstr4.clear(); } @@ -4069,25 +4070,25 @@ public: // add auto constraints for the center point if (sugConstr1.size() > 0) { - createAutoConstraints(sugConstr1, currentgeoid, Sketcher::mid); + createAutoConstraints(sugConstr1, currentgeoid, Sketcher::PointPos::mid); sugConstr1.clear(); } // add suggested constraints for arc if (sugConstr2.size() > 0) { - createAutoConstraints(sugConstr2, currentgeoid, Sketcher::none); + createAutoConstraints(sugConstr2, currentgeoid, Sketcher::PointPos::none); sugConstr2.clear(); } // add suggested constraints for start of arc if (sugConstr3.size() > 0) { - createAutoConstraints(sugConstr3, currentgeoid, isOriginalArcCCW?Sketcher::start:Sketcher::end); + createAutoConstraints(sugConstr3, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::start:Sketcher::PointPos::end); sugConstr3.clear(); } // add suggested constraints for start of arc if (sugConstr4.size() > 0) { - createAutoConstraints(sugConstr4, currentgeoid, isOriginalArcCCW?Sketcher::end:Sketcher::start); + createAutoConstraints(sugConstr4, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::end:Sketcher::PointPos::start); sugConstr4.clear(); } @@ -4369,25 +4370,25 @@ public: // add auto constraints for the focus point if (sugConstr1.size() > 0) { - createAutoConstraints(sugConstr1, currentgeoid+1, Sketcher::start); + createAutoConstraints(sugConstr1, currentgeoid+1, Sketcher::PointPos::start); sugConstr1.clear(); } // add suggested constraints for vertex point if (sugConstr2.size() > 0) { - createAutoConstraints(sugConstr2, currentgeoid, Sketcher::mid); + createAutoConstraints(sugConstr2, currentgeoid, Sketcher::PointPos::mid); sugConstr2.clear(); } // add suggested constraints for start of arc if (sugConstr3.size() > 0) { - createAutoConstraints(sugConstr3, currentgeoid, isOriginalArcCCW?Sketcher::start:Sketcher::end); + createAutoConstraints(sugConstr3, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::start:Sketcher::PointPos::end); sugConstr3.clear(); } // add suggested constraints for start of arc if (sugConstr4.size() > 0) { - createAutoConstraints(sugConstr4, currentgeoid, isOriginalArcCCW?Sketcher::end:Sketcher::start); + createAutoConstraints(sugConstr4, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::end:Sketcher::PointPos::start); sugConstr4.clear(); } @@ -4690,7 +4691,7 @@ public: // add auto constraints on pole if (sugConstr[CurrentConstraint].size() > 0) { - createAutoConstraints(sugConstr[CurrentConstraint], FirstPoleGeoId, Sketcher::mid, false); + createAutoConstraints(sugConstr[CurrentConstraint], FirstPoleGeoId, Sketcher::PointPos::mid, false); } static_cast(sketchgui->getObject())->solve(); @@ -4705,7 +4706,7 @@ public: // check if coincident with first pole for(std::vector::const_iterator it = sugConstr[CurrentConstraint].begin(); it != sugConstr[CurrentConstraint].end(); it++) { - if( (*it).Type == Sketcher::Coincident && (*it).GeoId == FirstPoleGeoId && (*it).PosId == Sketcher::mid ) { + if( (*it).Type == Sketcher::Coincident && (*it).GeoId == FirstPoleGeoId && (*it).PosId == Sketcher::PointPos::mid ) { IsClosed = true; } @@ -4756,7 +4757,7 @@ public: // add auto constraints on pole if (sugConstr[CurrentConstraint].size() > 0) { - createAutoConstraints(sugConstr[CurrentConstraint], FirstPoleGeoId + EditCurve.size()-1, Sketcher::mid, false); + createAutoConstraints(sugConstr[CurrentConstraint], FirstPoleGeoId + EditCurve.size()-1, Sketcher::PointPos::mid, false); } //static_cast(sketchgui->getObject())->solve(); @@ -4825,13 +4826,13 @@ public: if (ConstrMethod == 0) { for(auto & constr : static_cast(sketchgui->getObject())->Constraints.getValues()) { - if(constr->First == FirstPoleGeoId && constr->FirstPos == Sketcher::mid) { + if(constr->First == FirstPoleGeoId && constr->FirstPos == Sketcher::PointPos::mid) { constr->First = currentgeoid; - constr->FirstPos = Sketcher::start; + constr->FirstPos = Sketcher::PointPos::start; } - else if(constr->First == (FirstPoleGeoId + CurrentConstraint - 1) && constr->FirstPos == Sketcher::mid) { + else if(constr->First == (FirstPoleGeoId + CurrentConstraint - 1) && constr->FirstPos == Sketcher::PointPos::mid) { constr->First = currentgeoid; - constr->FirstPos = Sketcher::end; + constr->FirstPos = Sketcher::PointPos::end; } } } @@ -4843,7 +4844,7 @@ public: for (size_t i = 0; i < EditCurve.size(); i++) { cstream << "conList.append(Sketcher.Constraint('InternalAlignment:Sketcher::BSplineControlPoint'," << FirstPoleGeoId+i - << "," << Sketcher::mid << "," << currentgeoid << "," << i << "))\n"; + << "," << static_cast(Sketcher::PointPos::mid) << "," << currentgeoid << "," << i << "))\n"; } cstream << Gui::Command::getObjectCmd(sketchgui->getObject()) << ".addConstraint(conList)\n"; @@ -5272,19 +5273,19 @@ public: // Auto Constraint first picked point if (sugConstr1.size() > 0) { - createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::none); + createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::none); sugConstr1.clear(); } // Auto Constraint second picked point if (sugConstr2.size() > 0) { - createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::none); + createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::PointPos::none); sugConstr2.clear(); } // Auto Constraint third picked point if (sugConstr3.size() > 0) { - createAutoConstraints(sugConstr3, getHighestCurveIndex(), Sketcher::none); + createAutoConstraints(sugConstr3, getHighestCurveIndex(), Sketcher::PointPos::none); sugConstr3.clear(); } @@ -5497,7 +5498,7 @@ public: // add auto constraints for the line segment start if (sugConstr.size() > 0) { - createAutoConstraints(sugConstr, getHighestCurveIndex(), Sketcher::start); + createAutoConstraints(sugConstr, getHighestCurveIndex(), Sketcher::PointPos::start); sugConstr.clear(); } @@ -5696,11 +5697,11 @@ public: int VtId = sketchgui->getPreselectPoint(); if (Mode == STATUS_SEEK_First && VtId != -1) { int GeoId; - Sketcher::PointPos PosId=Sketcher::none; + Sketcher::PointPos PosId=Sketcher::PointPos::none; sketchgui->getSketchObject()->getGeoVertexIndex(VtId,GeoId,PosId); const Part::Geometry *geom = sketchgui->getSketchObject()->getGeometry(GeoId); if (geom->getTypeId() == Part::GeomLineSegment::getClassTypeId() && - (PosId == Sketcher::start || PosId == Sketcher::end)) { + (PosId == Sketcher::PointPos::start || PosId == Sketcher::PointPos::end)) { // guess fillet radius double radius=-1; @@ -5717,9 +5718,9 @@ public: const Part::GeomLineSegment *lineSeg2 = static_cast(geom2); Base::Vector3d dir1 = lineSeg1->getEndPoint() - lineSeg1->getStartPoint(); Base::Vector3d dir2 = lineSeg2->getEndPoint() - lineSeg2->getStartPoint(); - if (PosIdList[0] == Sketcher::end) + if (PosIdList[0] == Sketcher::PointPos::end) dir1 *= -1; - if (PosIdList[1] == Sketcher::end) + if (PosIdList[1] == Sketcher::PointPos::end) dir2 *= -1; double l1 = dir1.Length(); double l2 = dir2.Length(); @@ -5735,7 +5736,7 @@ public: try { bool pointFillet = (filletType == 1); Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Create fillet")); - Gui::cmdAppObjectArgs(sketchgui->getObject(), "fillet(%d,%d,%f,%s,%s)", GeoId, PosId, radius, "True", + Gui::cmdAppObjectArgs(sketchgui->getObject(), "fillet(%d,%d,%f,%s,%s)", GeoId, static_cast(PosId), radius, "True", pointFillet ? "True":"False"); if (construction) { @@ -6094,14 +6095,14 @@ public: if(GeoId1 != Sketcher::GeoEnum::GeoUndef) EditMarkers.emplace_back(intersect1.x, intersect1.y); else { - auto start = sk->getPoint(GeoId, Sketcher::start); + auto start = sk->getPoint(GeoId, Sketcher::PointPos::start); EditMarkers.emplace_back(start.x, start.y); } if(GeoId2 != Sketcher::GeoEnum::GeoUndef) EditMarkers.emplace_back(intersect2.x, intersect2.y); else { - auto end = sk->getPoint(GeoId, Sketcher::end); + auto end = sk->getPoint(GeoId, Sketcher::PointPos::end); EditMarkers.emplace_back( end.x, end.y); } @@ -6408,7 +6409,7 @@ public: try { Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Extend edge")); Gui::cmdAppObjectArgs(sketchgui->getObject(), "extend(%d, %f, %d)\n", // GeoId, increment, PointPos - BaseGeoId, Increment, ExtendFromStart ? Sketcher::start : Sketcher::end); + BaseGeoId, Increment, ExtendFromStart ? static_cast(Sketcher::PointPos::start) : static_cast(Sketcher::PointPos::end)); Gui::Command::commitCommand(); ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); @@ -6418,7 +6419,7 @@ public: // constrain chosen point if (SugConstr.size() > 0) { - createAutoConstraints(SugConstr, BaseGeoId, (ExtendFromStart) ? Sketcher::start : Sketcher::end); + createAutoConstraints(SugConstr, BaseGeoId, (ExtendFromStart) ? Sketcher::PointPos::start : Sketcher::PointPos::end); SugConstr.clear(); } bool continuousMode = hGrp->GetBool("ContinuousCreationMode",true); @@ -7145,7 +7146,7 @@ public: try { Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add slot")); - AutoConstraint lastCons = {Sketcher::None, Sketcher::GeoEnum::GeoUndef, Sketcher::none}; + AutoConstraint lastCons = {Sketcher::None, Sketcher::GeoEnum::GeoUndef, Sketcher::PointPos::none}; if (!sugConstr2.empty()) lastCons = sugConstr2.back(); @@ -7208,13 +7209,13 @@ public: // add auto constraints at the center of the first arc if (sugConstr1.size() > 0) { - createAutoConstraints(sugConstr1, getHighestCurveIndex() - 3, Sketcher::mid); + createAutoConstraints(sugConstr1, getHighestCurveIndex() - 3, Sketcher::PointPos::mid); sugConstr1.clear(); } // add auto constraints at the center of the second arc if (sugConstr2.size() > 0) { - createAutoConstraints(sugConstr2, getHighestCurveIndex() - 2, Sketcher::mid); + createAutoConstraints(sugConstr2, getHighestCurveIndex() - 2, Sketcher::PointPos::mid); sugConstr2.clear(); } @@ -7400,13 +7401,13 @@ public: // add auto constraints at the center of the polygon if (sugConstr1.size() > 0) { - createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::mid); + createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::mid); sugConstr1.clear(); } // add auto constraints to the last side of the polygon if (sugConstr2.size() > 0) { - createAutoConstraints(sugConstr2, getHighestCurveIndex() - 1, Sketcher::end); + createAutoConstraints(sugConstr2, getHighestCurveIndex() - 1, Sketcher::PointPos::end); sugConstr2.clear(); } diff --git a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp index 020ee7abca..96a359c6f0 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp @@ -184,14 +184,14 @@ void CmdSketcherCloseShape::activated(int iMsg) Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('Coincident', %d, %d, %d, %d)) ", - GeoId1, Sketcher::end, GeoId2, Sketcher::start); + GeoId1, static_cast(Sketcher::PointPos::end), GeoId2, static_cast(Sketcher::PointPos::start)); } } // Close Last Edge with First Edge Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('Coincident', %d, %d, %d, %d)) ", - GeoIdLast, Sketcher::end, GeoIdFirst, Sketcher::start); + GeoIdLast, static_cast(Sketcher::PointPos::end), GeoIdFirst, static_cast(Sketcher::PointPos::start)); // finish the transaction and update, and clear the selection (convenience) commitCommand(); @@ -276,7 +276,7 @@ void CmdSketcherConnect::activated(int iMsg) } Gui::cmdAppObjectArgs(selection[0].getObject(),"addConstraint(Sketcher.Constraint('Coincident',%d,%d,%d,%d)) ", - GeoId1,Sketcher::end,GeoId2,Sketcher::start); + GeoId1,static_cast(Sketcher::PointPos::end),GeoId2,static_cast(Sketcher::PointPos::start)); } } @@ -775,12 +775,12 @@ void CmdSketcherSelectElementsAssociatedWithConstraints::activated(int iMsg) switch(vals[ConstrId]->FirstPos) { - case Sketcher::none: + case Sketcher::PointPos::none: ss << "Edge" << vals[ConstrId]->First + 1; break; - case Sketcher::start: - case Sketcher::end: - case Sketcher::mid: + case Sketcher::PointPos::start: + case Sketcher::PointPos::end: + case Sketcher::PointPos::mid: int vertex = Obj->getVertexIndexGeoPos(vals[ConstrId]->First,vals[ConstrId]->FirstPos); if(vertex>-1) ss << "Vertex" << vertex + 1; @@ -794,12 +794,12 @@ void CmdSketcherSelectElementsAssociatedWithConstraints::activated(int iMsg) switch(vals[ConstrId]->SecondPos) { - case Sketcher::none: + case Sketcher::PointPos::none: ss << "Edge" << vals[ConstrId]->Second + 1; break; - case Sketcher::start: - case Sketcher::end: - case Sketcher::mid: + case Sketcher::PointPos::start: + case Sketcher::PointPos::end: + case Sketcher::PointPos::mid: int vertex = Obj->getVertexIndexGeoPos(vals[ConstrId]->Second,vals[ConstrId]->SecondPos); if(vertex>-1) ss << "Vertex" << vertex + 1; @@ -814,12 +814,12 @@ void CmdSketcherSelectElementsAssociatedWithConstraints::activated(int iMsg) switch(vals[ConstrId]->ThirdPos) { - case Sketcher::none: + case Sketcher::PointPos::none: ss << "Edge" << vals[ConstrId]->Third + 1; break; - case Sketcher::start: - case Sketcher::end: - case Sketcher::mid: + case Sketcher::PointPos::start: + case Sketcher::PointPos::end: + case Sketcher::PointPos::mid: int vertex = Obj->getVertexIndexGeoPos(vals[ConstrId]->Third,vals[ConstrId]->ThirdPos); if(vertex>-1) ss << "Vertex" << vertex + 1; @@ -915,11 +915,11 @@ void CmdSketcherSelectElementsWithDoFs::activated(int iMsg) if (solvext->getEdge() == SolverGeometryExtension::Dependent) testselectedge(geoid); if (solvext->getStart() == SolverGeometryExtension::Dependent) - testselectvertex(geoid, Sketcher::start); + testselectvertex(geoid, Sketcher::PointPos::start); if (solvext->getEnd() == SolverGeometryExtension::Dependent) - testselectvertex(geoid, Sketcher::end); + testselectvertex(geoid, Sketcher::PointPos::end); if (solvext->getMid() == SolverGeometryExtension::Dependent) - testselectvertex(geoid, Sketcher::mid); + testselectvertex(geoid, Sketcher::PointPos::mid); } } } @@ -1083,7 +1083,7 @@ void CmdSketcherSymmetry::activated(int iMsg) getSelection().clearSelection(); int LastGeoId = 0; - Sketcher::PointPos LastPointPos = Sketcher::none; + Sketcher::PointPos LastPointPos = Sketcher::PointPos::none; const Part::Geometry *LastGeo; typedef enum { invalid = -1, line = 0, point = 1 } GeoType; @@ -1100,11 +1100,11 @@ void CmdSketcherSymmetry::activated(int iMsg) if (it->substr(0,4) == "Edge") { LastGeoId = std::atoi(it->substr(4,4000).c_str()) - 1; - LastPointPos = Sketcher::none; + LastPointPos = Sketcher::PointPos::none; } else { LastGeoId = -std::atoi(it->substr(12,4000).c_str()) - 2; - LastPointPos = Sketcher::none; + LastPointPos = Sketcher::PointPos::none; } // reference can be external or non-external @@ -1130,7 +1130,7 @@ void CmdSketcherSymmetry::activated(int iMsg) if (Obj->getGeometry(GeoId)->getTypeId() == Part::GeomPoint::getClassTypeId()) { LastGeoId = GeoId; - LastPointPos = Sketcher::start; + LastPointPos = Sketcher::PointPos::start; lastgeotype = point; // points to make symmetric @@ -1159,21 +1159,21 @@ void CmdSketcherSymmetry::activated(int iMsg) // check if last selected element is horizontal axis else if (SubNames.rbegin()->size() == 6 && SubNames.rbegin()->substr(0,6) == "H_Axis") { LastGeoId = Sketcher::GeoEnum::HAxis; - LastPointPos = Sketcher::none; + LastPointPos = Sketcher::PointPos::none; lastgeotype = line; lastvertexoraxis = true; } // check if last selected element is vertical axis else if (SubNames.rbegin()->size() == 6 && SubNames.rbegin()->substr(0,6) == "V_Axis") { LastGeoId = Sketcher::GeoEnum::VAxis; - LastPointPos = Sketcher::none; + LastPointPos = Sketcher::PointPos::none; lastgeotype = line; lastvertexoraxis = true; } // check if last selected element is the root point else if (SubNames.rbegin()->size() == 9 && SubNames.rbegin()->substr(0,9) == "RootPoint") { LastGeoId = Sketcher::GeoEnum::RtPnt; - LastPointPos = Sketcher::start; + LastPointPos = Sketcher::PointPos::start; lastgeotype = point; lastvertexoraxis = true; } @@ -1221,7 +1221,7 @@ void CmdSketcherSymmetry::activated(int iMsg) try{ Gui::cmdAppObjectArgs(Obj, "addSymmetric(%s, %d, %d)", - geoIdList.c_str(), LastGeoId, LastPointPos); + geoIdList.c_str(), LastGeoId, static_cast(LastPointPos)); Gui::Command::commitCommand(); } catch (const Base::Exception& e) { @@ -1465,7 +1465,7 @@ void SketcherCopy::activate(SketcherCopy::Op op) getSelection().clearSelection(); int LastGeoId = 0; - Sketcher::PointPos LastPointPos = Sketcher::none; + Sketcher::PointPos LastPointPos = Sketcher::PointPos::none; const Part::Geometry *LastGeo = 0; // create python command with list of elements @@ -1475,7 +1475,7 @@ void SketcherCopy::activate(SketcherCopy::Op op) // only handle non-external edges if (it->size() > 4 && it->substr(0,4) == "Edge") { LastGeoId = std::atoi(it->substr(4,4000).c_str()) - 1; - LastPointPos = Sketcher::none; + LastPointPos = Sketcher::PointPos::none; LastGeo = Obj->getGeometry(LastGeoId); // lines to copy if (LastGeoId >= 0) { @@ -1491,7 +1491,7 @@ void SketcherCopy::activate(SketcherCopy::Op op) Obj->getGeoVertexIndex(VtId, GeoId, PosId); if (Obj->getGeometry(GeoId)->getTypeId() == Part::GeomPoint::getClassTypeId()) { LastGeoId = GeoId; - LastPointPos = Sketcher::start; + LastPointPos = Sketcher::PointPos::start; // points to copy if (LastGeoId >= 0) { geoids++; @@ -1530,13 +1530,13 @@ void SketcherCopy::activate(SketcherCopy::Op op) // if the last element is not a point serving as a reference for the copy process // then make the start point of the last element the copy reference (if it exists, if not the center point) - if (LastPointPos == Sketcher::none) { + if (LastPointPos == Sketcher::PointPos::none) { if (LastGeo->getTypeId() == Part::GeomCircle::getClassTypeId() || LastGeo->getTypeId() == Part::GeomEllipse::getClassTypeId()) { - LastPointPos = Sketcher::mid; + LastPointPos = Sketcher::PointPos::mid; } else { - LastPointPos = Sketcher::start; + LastPointPos = Sketcher::PointPos::start; } } @@ -2021,7 +2021,7 @@ void CmdSketcherRectangularArray::activated(int iMsg) getSelection().clearSelection(); int LastGeoId = 0; - Sketcher::PointPos LastPointPos = Sketcher::none; + Sketcher::PointPos LastPointPos = Sketcher::PointPos::none; const Part::Geometry *LastGeo = 0; // create python command with list of elements @@ -2032,7 +2032,7 @@ void CmdSketcherRectangularArray::activated(int iMsg) // only handle non-external edges if (it->size() > 4 && it->substr(0,4) == "Edge") { LastGeoId = std::atoi(it->substr(4,4000).c_str()) - 1; - LastPointPos = Sketcher::none; + LastPointPos = Sketcher::PointPos::none; LastGeo = Obj->getGeometry(LastGeoId); // lines to copy @@ -2049,7 +2049,7 @@ void CmdSketcherRectangularArray::activated(int iMsg) Obj->getGeoVertexIndex(VtId, GeoId, PosId); if (Obj->getGeometry(GeoId)->getTypeId() == Part::GeomPoint::getClassTypeId()) { LastGeoId = GeoId; - LastPointPos = Sketcher::start; + LastPointPos = Sketcher::PointPos::start; // points to copy if (LastGeoId >= 0) { geoids++; @@ -2088,13 +2088,13 @@ void CmdSketcherRectangularArray::activated(int iMsg) // if the last element is not a point serving as a reference for the copy process // then make the start point of the last element the copy reference (if it exists, if not the center point) - if (LastPointPos == Sketcher::none) { + if (LastPointPos == Sketcher::PointPos::none) { if (LastGeo->getTypeId() == Part::GeomCircle::getClassTypeId() || LastGeo->getTypeId() == Part::GeomEllipse::getClassTypeId()) { - LastPointPos = Sketcher::mid; + LastPointPos = Sketcher::PointPos::mid; } else { - LastPointPos = Sketcher::start; + LastPointPos = Sketcher::PointPos::start; } } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp index 4f0877ebf9..5857bdf7f7 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp @@ -319,7 +319,8 @@ int DrawSketchHandler::seekAutoConstraint(std::vector &suggested int preSelCrs = sketchgui->getPreselectCross(); int GeoId = GeoEnum::GeoUndef; - Sketcher::PointPos PosId = Sketcher::none; + Sketcher::PointPos PosId = Sketcher::PointPos::none; + if (preSelPnt != -1) sketchgui->getSketchObject()->getGeoVertexIndex(preSelPnt, GeoId, PosId); else if (preSelCrv != -1){ @@ -334,7 +335,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector &suggested } else if (preSelCrs == 0) { // root point GeoId = Sketcher::GeoEnum::RtPnt; - PosId = Sketcher::start; + PosId = Sketcher::PointPos::start; } else if (preSelCrs == 1){ // x axis GeoId = Sketcher::GeoEnum::HAxis; @@ -355,13 +356,13 @@ int DrawSketchHandler::seekAutoConstraint(std::vector &suggested constr.Type = Sketcher::None; constr.GeoId = GeoId; constr.PosId = PosId; - if ((type == AutoConstraint::VERTEX || type == AutoConstraint::VERTEX_NO_TANGENCY) && PosId != Sketcher::none) + if ((type == AutoConstraint::VERTEX || type == AutoConstraint::VERTEX_NO_TANGENCY) && PosId != Sketcher::PointPos::none) constr.Type = Sketcher::Coincident; - else if (type == AutoConstraint::CURVE && PosId != Sketcher::none) + else if (type == AutoConstraint::CURVE && PosId != Sketcher::PointPos::none) constr.Type = Sketcher::PointOnObject; - else if ((type == AutoConstraint::VERTEX || type == AutoConstraint::VERTEX_NO_TANGENCY) && PosId == Sketcher::none && hitobject->getTypeId() != Part::GeomBSplineCurve::getClassTypeId()) + else if ((type == AutoConstraint::VERTEX || type == AutoConstraint::VERTEX_NO_TANGENCY) && PosId == Sketcher::PointPos::none && hitobject->getTypeId() != Part::GeomBSplineCurve::getClassTypeId()) constr.Type = Sketcher::PointOnObject; - else if (type == AutoConstraint::CURVE && PosId == Sketcher::none) + else if (type == AutoConstraint::CURVE && PosId == Sketcher::PointPos::none) constr.Type = Sketcher::Tangent; if(constr.Type == Sketcher::Tangent && Dir.Length() > 1e-8 && hitShapeDir.Length() > 1e-8) { // We are hitting a line and have hitting vector information @@ -394,7 +395,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector &suggested AutoConstraint constr; constr.Type = Sketcher::None; constr.GeoId = GeoEnum::GeoUndef; - constr.PosId = Sketcher::none; + constr.PosId = Sketcher::PointPos::none; double angle = std::abs(atan2(Dir.y, Dir.x)); if (angle < angleDevRad || (M_PI - angle) < angleDevRad ) // Suggest horizontal constraint @@ -559,7 +560,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector &suggested // Suggest vertical constraint constr.Type = Tangent; constr.GeoId = tangId; - constr.PosId = Sketcher::none; + constr.PosId = Sketcher::PointPos::none; suggestedConstraints.push_back(constr); } @@ -587,22 +588,22 @@ void DrawSketchHandler::createAutoConstraints(const std::vector switch (it->Type) { case Sketcher::Coincident: { - if (posId1 == Sketcher::none) + if (posId1 == Sketcher::PointPos::none) continue; // If the auto constraint has a point create a coincident otherwise it is an edge on a point Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Coincident',%i,%i,%i,%i)) " - , geoId1, posId1, it->GeoId, it->PosId); + , geoId1, static_cast(posId1), it->GeoId, static_cast(it->PosId)); } break; case Sketcher::PointOnObject: { Sketcher::PointPos posId2 = it->PosId; - if (posId1 == Sketcher::none) { + if (posId1 == Sketcher::PointPos::none) { // Auto constraining an edge so swap parameters std::swap(geoId1,geoId2); std::swap(posId1,posId2); } Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%i,%i,%i)) " - , geoId1, posId1, geoId2); + , geoId1, static_cast(posId1), geoId2); } break; // In special case of Horizontal/Vertical constraint, geoId2 is normally unused and should be 'Constraint::GeoUndef' // However it can be used as a way to require the function to apply these constraints on another geometry diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.h b/src/Mod/Sketcher/Gui/DrawSketchHandler.h index 572a1cbe4c..19fcaae94e 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.h @@ -86,7 +86,7 @@ public: // createowncommand indicates whether a separate command shall be create and committed (for example for undo purposes) or not // is not it is the responsibility of the developer to create and commit the command appropriately. void createAutoConstraints(const std::vector &autoConstrs, - int geoId, Sketcher::PointPos pointPos=Sketcher::none, bool createowncommand = true); + int geoId, Sketcher::PointPos pointPos=Sketcher::PointPos::none, bool createowncommand = true); void setPositionText(const Base::Vector2d &Pos, const SbString &text); void setPositionText(const Base::Vector2d &Pos); diff --git a/src/Mod/Sketcher/Gui/SketchMirrorDialog.cpp b/src/Mod/Sketcher/Gui/SketchMirrorDialog.cpp index c26801db82..9ce815def9 100644 --- a/src/Mod/Sketcher/Gui/SketchMirrorDialog.cpp +++ b/src/Mod/Sketcher/Gui/SketchMirrorDialog.cpp @@ -41,7 +41,7 @@ using namespace SketcherGui; SketchMirrorDialog::SketchMirrorDialog(void) : QDialog(Gui::getMainWindow()) , RefGeoid(-1) - , RefPosid(Sketcher::none) + , RefPosid(Sketcher::PointPos::none) , ui(new Ui_SketchMirrorDialog) { ui->setupUi(this); @@ -55,15 +55,15 @@ void SketchMirrorDialog::accept() { if (ui->XAxisRadioButton->isChecked()) { RefGeoid=Sketcher::GeoEnum::HAxis; - RefPosid=Sketcher::none; + RefPosid=Sketcher::PointPos::none; } else if (ui->YAxisRadioButton->isChecked()) { RefGeoid=Sketcher::GeoEnum::VAxis; - RefPosid=Sketcher::none; + RefPosid=Sketcher::PointPos::none; } else if (ui->OriginRadioButton->isChecked()) { RefGeoid=Sketcher::GeoEnum::RtPnt; - RefPosid=Sketcher::start; + RefPosid=Sketcher::PointPos::start; } QDialog::accept(); diff --git a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp index 49090a6be6..a00897a8a5 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp @@ -172,13 +172,13 @@ public: if(extended) { if(constraint->Second == Sketcher::GeoEnum::GeoUndef) { - name = QString::fromLatin1("%1 [(%2,%3)]").arg(name).arg(constraint->First).arg(constraint->FirstPos); + name = QString::fromLatin1("%1 [(%2,%3)]").arg(name).arg(constraint->First).arg(static_cast(constraint->FirstPos)); } else if(constraint->Third == Sketcher::GeoEnum::GeoUndef) { - name = QString::fromLatin1("%1 [(%2,%3),(%4,%5)]").arg(name).arg(constraint->First).arg(constraint->FirstPos).arg(constraint->Second).arg(constraint->SecondPos); + name = QString::fromLatin1("%1 [(%2,%3),(%4,%5)]").arg(name).arg(constraint->First).arg(static_cast(constraint->FirstPos)).arg(constraint->Second).arg(static_cast(constraint->SecondPos)); } else { - name = QString::fromLatin1("%1 [(%2,%3),(%4,%5),(%6,%7)]").arg(name).arg(constraint->First).arg(constraint->FirstPos).arg(constraint->Second).arg(constraint->SecondPos).arg(constraint->Third).arg(constraint->ThirdPos); + name = QString::fromLatin1("%1 [(%2,%3),(%4,%5),(%6,%7)]").arg(name).arg(constraint->First).arg(static_cast(constraint->FirstPos)).arg(constraint->Second).arg(static_cast(constraint->SecondPos)).arg(constraint->Third).arg(static_cast(constraint->ThirdPos)); } } @@ -998,10 +998,10 @@ void TaskSketcherConstraints::onSelectionChanged(const Gui::SelectionChanges& ms } else if(isFilter(ConstraintFilter::SpecialFilterValue::AssociatedConstraints)) { // is NOT a constraint int geoid = Sketcher::GeoEnum::GeoUndef; - Sketcher::PointPos pointpos = Sketcher::none; + Sketcher::PointPos pointpos = Sketcher::PointPos::none; getSelectionGeoId(expr, geoid, pointpos); - if(geoid != Sketcher::GeoEnum::GeoUndef && pointpos == Sketcher::none){ + if(geoid != Sketcher::GeoEnum::GeoUndef && pointpos == Sketcher::PointPos::none){ // It is not possible to update on single addition/removal of a geometric element, // as one removal may imply removing a constraint that should be added by a different element // that is still selected. The necessary checks outweigh a full rebuild of the filter. @@ -1021,7 +1021,7 @@ void TaskSketcherConstraints::getSelectionGeoId(QString expr, int & geoid, Sketc QRegExp rxEdge(QString::fromLatin1("^Edge(\\d+)$")); int pos = expr.indexOf(rxEdge); geoid = Sketcher::GeoEnum::GeoUndef; - pointpos = Sketcher::none; + pointpos = Sketcher::PointPos::none; if (pos > -1) { bool ok; diff --git a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp index 0e06d85084..7e14a570c8 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp @@ -400,13 +400,13 @@ void TaskSketcherElements::onSelectionChanged(const Gui::SelectionChanges& msg) if (item->ElementNbr == GeoId) { switch(PosId) { - case Sketcher::start: + case Sketcher::PointPos::start: item->isStartingPointSelected=select; break; - case Sketcher::end: + case Sketcher::PointPos::end: item->isEndPointSelected=select; break; - case Sketcher::mid: + case Sketcher::PointPos::mid: item->isMidPointSelected=select; break; default: @@ -791,9 +791,9 @@ void TaskSketcherElements::slotElementsChanged(void) (construction?(QString::fromLatin1("-")+tr("Construction")):QString::fromLatin1("")): (QString::fromLatin1("%1-").arg(i)+tr("Other"))), i-1, - sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::start), - sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::mid), - sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::end), + sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::PointPos::start), + sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::PointPos::mid), + sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::PointPos::end), type, construction, false)); @@ -888,9 +888,9 @@ void TaskSketcherElements::slotElementsChanged(void) (tr("Other") + linkname): (QString::fromLatin1("%1-").arg(i-2)+tr("Other"))), -j, - sketchView->getSketchObject()->getVertexIndexGeoPos(-j,Sketcher::start), - sketchView->getSketchObject()->getVertexIndexGeoPos(-j,Sketcher::mid), - sketchView->getSketchObject()->getVertexIndexGeoPos(-j,Sketcher::end), + sketchView->getSketchObject()->getVertexIndexGeoPos(-j,Sketcher::PointPos::start), + sketchView->getSketchObject()->getVertexIndexGeoPos(-j,Sketcher::PointPos::mid), + sketchView->getSketchObject()->getVertexIndexGeoPos(-j,Sketcher::PointPos::end), type, false, // externals are not construction geometry in the sense of the sketcher ui true // yes, external geometry diff --git a/src/Mod/Sketcher/Gui/Utils.cpp b/src/Mod/Sketcher/Gui/Utils.cpp index 7587d96835..c36ab2ca20 100644 --- a/src/Mod/Sketcher/Gui/Utils.cpp +++ b/src/Mod/Sketcher/Gui/Utils.cpp @@ -131,14 +131,14 @@ void SketcherGui::getIdsFromName(const std::string &name, const Sketcher::Sketch int &GeoId, PointPos &PosId) { GeoId = GeoEnum::GeoUndef; - PosId = Sketcher::none; + PosId = Sketcher::PointPos::none; if (name.size() > 4 && name.substr(0,4) == "Edge") { GeoId = std::atoi(name.substr(4,4000).c_str()) - 1; } else if (name.size() == 9 && name.substr(0,9) == "RootPoint") { GeoId = Sketcher::GeoEnum::RtPnt; - PosId = Sketcher::start; + PosId = Sketcher::PointPos::start; } else if (name.size() == 6 && name.substr(0,6) == "H_Axis") GeoId = Sketcher::GeoEnum::HAxis; @@ -176,7 +176,7 @@ bool SketcherGui::isPointOrSegmentFixed(const Sketcher::SketchObject* Obj, int G if (GeoId == GeoEnum::GeoUndef) return false; else - return checkConstraint(vals, Sketcher::Block, GeoId, Sketcher::none) || GeoId <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId); + return checkConstraint(vals, Sketcher::Block, GeoId, Sketcher::PointPos::none) || GeoId <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId); } bool SketcherGui::areBothPointsOrSegmentsFixed(const Sketcher::SketchObject* Obj, int GeoId1, int GeoId2) @@ -186,8 +186,8 @@ bool SketcherGui::areBothPointsOrSegmentsFixed(const Sketcher::SketchObject* Obj if (GeoId1 == GeoEnum::GeoUndef || GeoId2 == GeoEnum::GeoUndef) return false; else - return ((checkConstraint(vals, Sketcher::Block, GeoId1, Sketcher::none) || GeoId1 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId1)) && - (checkConstraint(vals, Sketcher::Block, GeoId2, Sketcher::none) || GeoId2 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId2))); + return ((checkConstraint(vals, Sketcher::Block, GeoId1, Sketcher::PointPos::none) || GeoId1 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId1)) && + (checkConstraint(vals, Sketcher::Block, GeoId2, Sketcher::PointPos::none) || GeoId2 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId2))); } bool SketcherGui::areAllPointsOrSegmentsFixed(const Sketcher::SketchObject* Obj, int GeoId1, int GeoId2, int GeoId3) @@ -197,19 +197,19 @@ bool SketcherGui::areAllPointsOrSegmentsFixed(const Sketcher::SketchObject* Obj, if (GeoId1 == GeoEnum::GeoUndef || GeoId2 == GeoEnum::GeoUndef || GeoId3 == GeoEnum::GeoUndef) return false; else - return ((checkConstraint(vals, Sketcher::Block, GeoId1, Sketcher::none) || GeoId1 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId1)) && - (checkConstraint(vals, Sketcher::Block, GeoId2, Sketcher::none) || GeoId2 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId2)) && - (checkConstraint(vals, Sketcher::Block, GeoId3, Sketcher::none) || GeoId3 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId3))); + return ((checkConstraint(vals, Sketcher::Block, GeoId1, Sketcher::PointPos::none) || GeoId1 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId1)) && + (checkConstraint(vals, Sketcher::Block, GeoId2, Sketcher::PointPos::none) || GeoId2 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId2)) && + (checkConstraint(vals, Sketcher::Block, GeoId3, Sketcher::PointPos::none) || GeoId3 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId3))); } bool SketcherGui::isSimpleVertex(const Sketcher::SketchObject* Obj, int GeoId, PointPos PosId) { - if (PosId == Sketcher::start && (GeoId == Sketcher::GeoEnum::HAxis || GeoId == Sketcher::GeoEnum::VAxis)) + if (PosId == Sketcher::PointPos::start && (GeoId == Sketcher::GeoEnum::HAxis || GeoId == Sketcher::GeoEnum::VAxis)) return true; const Part::Geometry *geo = Obj->getGeometry(GeoId); if (geo->getTypeId() == Part::GeomPoint::getClassTypeId()) return true; - else if (PosId == Sketcher::mid) + else if (PosId == Sketcher::PointPos::mid) return true; else return false; diff --git a/src/Mod/Sketcher/Gui/Utils.h b/src/Mod/Sketcher/Gui/Utils.h index f456b2ef32..75063840f8 100644 --- a/src/Mod/Sketcher/Gui/Utils.h +++ b/src/Mod/Sketcher/Gui/Utils.h @@ -25,7 +25,7 @@ #define SKETCHERGUI_Recompute_H namespace Sketcher { - enum PointPos : int; + enum class PointPos : int; class SketchObject; } @@ -79,12 +79,12 @@ bool checkConstraint(const std::vector< Sketcher::Constraint * > &vals, Sketcher inline bool isVertex(int GeoId, Sketcher::PointPos PosId) { - return (GeoId != Sketcher::GeoEnum::GeoUndef && PosId != Sketcher::none); + return (GeoId != Sketcher::GeoEnum::GeoUndef && PosId != Sketcher::PointPos::none); } inline bool isEdge(int GeoId, Sketcher::PointPos PosId) { - return (GeoId != Sketcher::GeoEnum::GeoUndef && PosId == Sketcher::none); + return (GeoId != Sketcher::GeoEnum::GeoUndef && PosId == Sketcher::PointPos::none); } } diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 98a4fd92ed..a74f447edc 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -522,7 +522,7 @@ bool ViewProviderSketch::keyPressed(bool pressed, int key) } if (edit && edit->DragCurve >= 0) { if (!pressed) { - getSketchObject()->movePoint(edit->DragCurve, Sketcher::none, Base::Vector3d(0,0,0), true); + getSketchObject()->movePoint(edit->DragCurve, Sketcher::PointPos::none, Base::Vector3d(0,0,0), true); edit->DragCurve = -1; resetPositionText(); Mode = STATUS_NONE; @@ -852,11 +852,11 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe int GeoId; Sketcher::PointPos PosId; getSketchObject()->getGeoVertexIndex(edit->DragPoint, GeoId, PosId); - if (GeoId != Sketcher::GeoEnum::GeoUndef && PosId != Sketcher::none) { + if (GeoId != Sketcher::GeoEnum::GeoUndef && PosId != Sketcher::PointPos::none) { getDocument()->openCommand(QT_TRANSLATE_NOOP("Command", "Drag Point")); try { Gui::cmdAppObjectArgs(getObject(), "movePoint(%i,%i,App.Vector(%f,%f,0),%i)" - ,GeoId, PosId, x-xInit, y-yInit, 0); + ,GeoId, static_cast(PosId), x-xInit, y-yInit, 0); getDocument()->commitCommand(); tryAutoRecomputeIfNotSolve(getSketchObject()); @@ -916,7 +916,7 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe try { Gui::cmdAppObjectArgs(getObject(), "movePoint(%i,%i,App.Vector(%f,%f,0),%i)" - ,edit->DragCurve, Sketcher::none, vec.x, vec.y, relative ? 1 : 0); + ,edit->DragCurve, static_cast(Sketcher::PointPos::none), vec.x, vec.y, relative ? 1 : 0); getDocument()->commitCommand(); tryAutoRecomputeIfNotSolve(getSketchObject()); @@ -1181,7 +1181,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor int GeoId; Sketcher::PointPos PosId; getSketchObject()->getGeoVertexIndex(edit->DragPoint, GeoId, PosId); - if (GeoId != Sketcher::GeoEnum::GeoUndef && PosId != Sketcher::none) { + if (GeoId != Sketcher::GeoEnum::GeoUndef && PosId != Sketcher::PointPos::none) { getSketchObject()->initTemporaryMove(GeoId, PosId, false); relative = false; xInit = 0; @@ -1218,7 +1218,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor // The B-Spline is constrained to be non-rational (equal weights), moving produces a bad effect // because OCCT will normalize the values of the weights. - auto grp = getSolvedSketch().getDependencyGroup(edit->DragCurve, Sketcher::none); + auto grp = getSolvedSketch().getDependencyGroup(edit->DragCurve, Sketcher::PointPos::none); int bsplinegeoid = -1; @@ -1251,7 +1251,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor bool allingroup = true; for( auto polegeoid : polegeoids ) { - std::pair< int, Sketcher::PointPos > thispole = std::make_pair(polegeoid,Sketcher::none); + std::pair< int, Sketcher::PointPos > thispole = std::make_pair(polegeoid,Sketcher::PointPos::none); if(grp.find(thispole) == grp.end()) // not found allingroup = false; @@ -1283,7 +1283,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor yInit = 0; } - getSketchObject()->initTemporaryMove(edit->DragCurve, Sketcher::none, false); + getSketchObject()->initTemporaryMove(edit->DragCurve, Sketcher::PointPos::none, false); } else { Mode = STATUS_NONE; @@ -1308,7 +1308,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor Sketcher::PointPos PosId; getSketchObject()->getGeoVertexIndex(edit->DragPoint, GeoId, PosId); Base::Vector3d vec(x,y,0); - if (GeoId != Sketcher::GeoEnum::GeoUndef && PosId != Sketcher::none) { + if (GeoId != Sketcher::GeoEnum::GeoUndef && PosId != Sketcher::PointPos::none) { if (getSketchObject()->moveTemporaryPoint(GeoId, PosId, vec, false) == 0) { setPositionText(Base::Vector2d(x,y)); draw(true,false); @@ -1346,7 +1346,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor vec = center + dir / scalefactor; } - if (getSketchObject()->moveTemporaryPoint(edit->DragCurve, Sketcher::none, vec, relative) == 0) { + if (getSketchObject()->moveTemporaryPoint(edit->DragCurve, Sketcher::PointPos::none, vec, relative) == 0) { setPositionText(Base::Vector2d(x,y)); draw(true,false); } @@ -1416,7 +1416,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo Constr->Type == Radius || Constr->Type == Diameter || Constr-> Type == Weight) { Base::Vector3d p1(0.,0.,0.), p2(0.,0.,0.); - if (Constr->SecondPos != Sketcher::none) { // point to point distance + if (Constr->SecondPos != Sketcher::PointPos::none) { // point to point distance p1 = getSolvedSketch().getPoint(Constr->First, Constr->FirstPos); p2 = getSolvedSketch().getPoint(Constr->Second, Constr->SecondPos); } else if (Constr->Second != GeoEnum::GeoUndef) { // point to line distance @@ -1431,7 +1431,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo p2 += p1; } else return; - } else if (Constr->FirstPos != Sketcher::none) { + } else if (Constr->FirstPos != Sketcher::PointPos::none) { p2 = getSolvedSketch().getPoint(Constr->First, Constr->FirstPos); } else if (Constr->First != GeoEnum::GeoUndef) { const Part::Geometry *geo = GeoById(geomlist, Constr->First); @@ -1535,8 +1535,8 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo const Part::GeomLineSegment *lineSeg1 = static_cast(geo1); const Part::GeomLineSegment *lineSeg2 = static_cast(geo2); - bool flip1 = (Constr->FirstPos == end); - bool flip2 = (Constr->SecondPos == end); + bool flip1 = (Constr->FirstPos == Sketcher::PointPos::end); + bool flip2 = (Constr->SecondPos == Sketcher::PointPos::end); dir1 = (flip1 ? -1. : 1.) * (lineSeg1->getEndPoint()-lineSeg1->getStartPoint()); dir2 = (flip2 ? -1. : 1.) * (lineSeg2->getEndPoint()-lineSeg2->getStartPoint()); Base::Vector3d pnt1 = flip1 ? lineSeg1->getEndPoint() : lineSeg1->getStartPoint(); @@ -3402,8 +3402,8 @@ void ViewProviderSketch::drawConstraintIcons() case Vertical: { // second icon is available only for point alignment if ((*it)->Second != GeoEnum::GeoUndef && - (*it)->FirstPos != Sketcher::none && - (*it)->SecondPos != Sketcher::none) { + (*it)->FirstPos != Sketcher::PointPos::none && + (*it)->SecondPos != Sketcher::PointPos::none) { multipleIcons = true; } } @@ -3413,7 +3413,7 @@ void ViewProviderSketch::drawConstraintIcons() break; case Perpendicular: // second icon is available only when there is no common point - if ((*it)->FirstPos == Sketcher::none && (*it)->Third == GeoEnum::GeoUndef) + if ((*it)->FirstPos == Sketcher::PointPos::none && (*it)->Third == GeoEnum::GeoUndef) multipleIcons = true; break; case Equal: @@ -5089,7 +5089,7 @@ Restart: } else { assert(Constr->Second >= -extGeoCount && Constr->Second < intGeoCount); - assert(Constr->FirstPos != Sketcher::none && Constr->SecondPos != Sketcher::none); + assert(Constr->FirstPos != Sketcher::PointPos::none && Constr->SecondPos != Sketcher::PointPos::none); Base::Vector3d midpos1, dir1, norm1; Base::Vector3d midpos2, dir2, norm2; @@ -5135,20 +5135,20 @@ Restart: if (Constr->Third != GeoEnum::GeoUndef || //perpty via point - Constr->FirstPos != Sketcher::none) { //endpoint-to-curve or endpoint-to-endpoint perpty + Constr->FirstPos != Sketcher::PointPos::none) { //endpoint-to-curve or endpoint-to-endpoint perpty int ptGeoId; Sketcher::PointPos ptPosId; do {//dummy loop to use break =) Maybe goto? ptGeoId = Constr->First; ptPosId = Constr->FirstPos; - if (ptPosId != Sketcher::none) break; + if (ptPosId != Sketcher::PointPos::none) break; ptGeoId = Constr->Second; ptPosId = Constr->SecondPos; - if (ptPosId != Sketcher::none) break; + if (ptPosId != Sketcher::PointPos::none) break; ptGeoId = Constr->Third; ptPosId = Constr->ThirdPos; - if (ptPosId != Sketcher::none) break; + if (ptPosId != Sketcher::PointPos::none) break; assert(0);//no point found! } while (false); if (temp) @@ -5160,7 +5160,7 @@ Restart: norm1.Normalize(); dir1 = norm1; dir1.RotateZ(-M_PI/2.0); - } else if (Constr->FirstPos == Sketcher::none) { + } else if (Constr->FirstPos == Sketcher::PointPos::none) { if (geo1->getTypeId() == Part::GeomLineSegment::getClassTypeId()) { const Part::GeomLineSegment *lineSeg1 = static_cast(geo1); @@ -5418,7 +5418,7 @@ Restart: assert(Constr->First >= -extGeoCount && Constr->First < intGeoCount); Base::Vector3d pnt1(0.,0.,0.), pnt2(0.,0.,0.); - if (Constr->SecondPos != Sketcher::none) { // point to point distance + if (Constr->SecondPos != Sketcher::PointPos::none) { // point to point distance if (temp) { pnt1 = getSolvedSketch().getPoint(Constr->First, Constr->FirstPos); pnt2 = getSolvedSketch().getPoint(Constr->Second, Constr->SecondPos); @@ -5442,7 +5442,7 @@ Restart: pnt2 += pnt1; } else break; - } else if (Constr->FirstPos != Sketcher::none) { + } else if (Constr->FirstPos != Sketcher::PointPos::none) { if (temp) { pnt2 = getSolvedSketch().getPoint(Constr->First, Constr->FirstPos); } else { @@ -5496,7 +5496,7 @@ Restart: if ( Constr->Type == PointOnObject || Constr->Type == SnellsLaw || (Constr->Type == Tangent && Constr->Third != GeoEnum::GeoUndef) || //Tangency via point - (Constr->Type == Tangent && Constr->FirstPos != Sketcher::none) //endpoint-to-curve or endpoint-to-endpoint tangency + (Constr->Type == Tangent && Constr->FirstPos != Sketcher::PointPos::none) //endpoint-to-curve or endpoint-to-endpoint tangency ) { //find the point of tangency/point that is on object @@ -5506,13 +5506,13 @@ Restart: do {//dummy loop to use break =) Maybe goto? ptGeoId = Constr->First; ptPosId = Constr->FirstPos; - if (ptPosId != Sketcher::none) break; + if (ptPosId != Sketcher::PointPos::none) break; ptGeoId = Constr->Second; ptPosId = Constr->SecondPos; - if (ptPosId != Sketcher::none) break; + if (ptPosId != Sketcher::PointPos::none) break; ptGeoId = Constr->Third; ptPosId = Constr->ThirdPos; - if (ptPosId != Sketcher::none) break; + if (ptPosId != Sketcher::PointPos::none) break; assert(0);//no point found! } while (false); pos = getSolvedSketch().getPoint(ptGeoId, ptPosId); @@ -5685,8 +5685,8 @@ Restart: const Part::GeomLineSegment *lineSeg1 = static_cast(geo1); const Part::GeomLineSegment *lineSeg2 = static_cast(geo2); - bool flip1 = (Constr->FirstPos == end); - bool flip2 = (Constr->SecondPos == end); + bool flip1 = (Constr->FirstPos == Sketcher::PointPos::end); + bool flip2 = (Constr->SecondPos == Sketcher::PointPos::end); dir1 = (flip1 ? -1. : 1.) * (lineSeg1->getEndPoint()-lineSeg1->getStartPoint()); dir2 = (flip2 ? -1. : 1.) * (lineSeg2->getEndPoint()-lineSeg2->getStartPoint()); Base::Vector3d pnt1 = flip1 ? lineSeg1->getEndPoint() : lineSeg1->getStartPoint(); @@ -7239,7 +7239,7 @@ bool ViewProviderSketch::onDelete(const std::vector &subList) if (*rit == GeoEnum::RtPnt) { // RootPoint GeoId = Sketcher::GeoEnum::RtPnt; - PosId = start; + PosId = Sketcher::PointPos::start; } else { getSketchObject()->getGeoVertexIndex(*rit, GeoId, PosId); }