[Sketcher] Use modernized geometry type checks
This commit is contained in:
@@ -1387,7 +1387,7 @@ void SketcherCopy::activate(SketcherCopy::Op op)
|
||||
int GeoId;
|
||||
Sketcher::PointPos PosId;
|
||||
Obj->getGeoVertexIndex(VtId, GeoId, PosId);
|
||||
if (Obj->getGeometry(GeoId)->getTypeId() != Part::GeomPoint::getClassTypeId()) {
|
||||
if (!Obj->getGeometry(GeoId)->is<Part::GeomPoint>()) {
|
||||
LastGeoId = GeoId;
|
||||
LastPointPos = PosId;
|
||||
}
|
||||
@@ -1990,7 +1990,7 @@ void CmdSketcherRectangularArray::activated(int iMsg)
|
||||
int GeoId;
|
||||
Sketcher::PointPos PosId;
|
||||
Obj->getGeoVertexIndex(VtId, GeoId, PosId);
|
||||
if (Obj->getGeometry(GeoId)->getTypeId() != Part::GeomPoint::getClassTypeId()) {
|
||||
if (!Obj->getGeometry(GeoId)->is<Part::GeomPoint>()) {
|
||||
LastGeoId = GeoId;
|
||||
LastPointPos = PosId;
|
||||
}
|
||||
|
||||
@@ -774,10 +774,8 @@ protected:
|
||||
|
||||
// ellipse tangency support using construction elements (lines)
|
||||
if (geom1 && geom2
|
||||
&& (geom1->getTypeId() == Part::GeomEllipse::getClassTypeId()
|
||||
|| geom2->getTypeId() == Part::GeomEllipse::getClassTypeId())) {
|
||||
|
||||
if (geom1->getTypeId() != Part::GeomEllipse::getClassTypeId()) {
|
||||
&& (geom1->is<Part::GeomEllipse>() || geom2->is<Part::GeomEllipse>())) {
|
||||
if (!geom1->is<Part::GeomEllipse>()) {
|
||||
std::swap(geoId1, geoId2);
|
||||
}
|
||||
|
||||
@@ -785,10 +783,10 @@ protected:
|
||||
geom1 = Obj->getGeometry(geoId1);
|
||||
geom2 = Obj->getGeometry(geoId2);
|
||||
|
||||
if (geom2->getTypeId() == Part::GeomEllipse::getClassTypeId()
|
||||
|| geom2->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()
|
||||
|| geom2->getTypeId() == Part::GeomCircle::getClassTypeId()
|
||||
|| geom2->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) {
|
||||
if (geom2->is<Part::GeomEllipse>()
|
||||
|| geom2->is<Part::GeomArcOfEllipse>()
|
||||
|| geom2->is<Part::GeomCircle>()
|
||||
|| geom2->is<Part::GeomArcOfCircle>()) {
|
||||
// in all these cases an intermediate element is needed
|
||||
// makeTangentToEllipseviaNewPoint(
|
||||
// Obj,
|
||||
@@ -801,11 +799,10 @@ protected:
|
||||
|
||||
// arc of ellipse tangency support using external elements
|
||||
if (geom1 && geom2
|
||||
&& (geom1->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()
|
||||
|| geom2->getTypeId()
|
||||
== Part::GeomArcOfEllipse::getClassTypeId())) {
|
||||
&& (geom1->is<Part::GeomArcOfEllipse>()
|
||||
|| geom2->is<Part::GeomArcOfEllipse>())) {
|
||||
|
||||
if (geom1->getTypeId() != Part::GeomArcOfEllipse::getClassTypeId()) {
|
||||
if (!geom1->is<Part::GeomArcOfEllipse>()) {
|
||||
std::swap(geoId1, geoId2);
|
||||
}
|
||||
|
||||
@@ -813,9 +810,8 @@ protected:
|
||||
geom1 = Obj->getGeometry(geoId1);
|
||||
geom2 = Obj->getGeometry(geoId2);
|
||||
|
||||
if (geom2->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()
|
||||
|| geom2->getTypeId() == Part::GeomCircle::getClassTypeId()
|
||||
|| geom2->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) {
|
||||
if (geom2->is<Part::GeomArcOfEllipse>() || geom2->is<Part::GeomCircle>()
|
||||
|| geom2->is<Part::GeomArcOfCircle>()) {
|
||||
// in all these cases an intermediate element is needed
|
||||
// makeTangentToArcOfEllipseviaNewPoint(
|
||||
// Obj,
|
||||
|
||||
@@ -822,7 +822,7 @@ void DrawSketchHandler::createAutoConstraints(const std::vector<AutoConstraint>&
|
||||
if (geom1 && geom2
|
||||
&& (geom1->is<Part::GeomEllipse>() || geom2->is<Part::GeomEllipse>())) {
|
||||
|
||||
if (geom1->getTypeId() != Part::GeomEllipse::getClassTypeId()) {
|
||||
if (!geom1->is<Part::GeomEllipse>()) {
|
||||
std::swap(geoId1, geoId2);
|
||||
}
|
||||
|
||||
@@ -849,7 +849,7 @@ void DrawSketchHandler::createAutoConstraints(const std::vector<AutoConstraint>&
|
||||
&& (geom1->is<Part::GeomArcOfEllipse>()
|
||||
|| geom2->is<Part::GeomArcOfEllipse>())) {
|
||||
|
||||
if (geom1->getTypeId() != Part::GeomArcOfEllipse::getClassTypeId()) {
|
||||
if (!geom1->is<Part::GeomArcOfEllipse>()) {
|
||||
std::swap(geoId1, geoId2);
|
||||
}
|
||||
|
||||
|
||||
@@ -162,8 +162,7 @@ private:
|
||||
|
||||
// in the exceptional event that this may lead to a circle, do not
|
||||
// exposeInternalGeometry
|
||||
if (!ShapeGeometry.empty()
|
||||
&& ShapeGeometry[0]->getTypeId() == Part::GeomEllipse::getClassTypeId()) {
|
||||
if (!ShapeGeometry.empty() && ShapeGeometry[0]->is<Part::GeomEllipse>()) {
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(),
|
||||
"exposeInternalGeometry(%d)",
|
||||
ellipseGeoId);
|
||||
@@ -713,8 +712,7 @@ void DSHEllipseController::addConstraints()
|
||||
|
||||
using namespace Sketcher;
|
||||
|
||||
if (!handler->ShapeGeometry.empty()
|
||||
&& handler->ShapeGeometry[0]->getTypeId() == Part::GeomEllipse::getClassTypeId()) {
|
||||
if (!handler->ShapeGeometry.empty() && handler->ShapeGeometry[0]->is<Part::GeomEllipse>()) {
|
||||
|
||||
int firstLine = firstCurve + 1; // this is always the major axis
|
||||
int secondLine = firstCurve + 2; // this is always the minor axis
|
||||
|
||||
@@ -564,8 +564,7 @@ Restart:
|
||||
|
||||
Base::Vector3d midpos1, dir1, norm1;
|
||||
Base::Vector3d midpos2, dir2, norm2;
|
||||
if (geo1->getTypeId() != Part::GeomLineSegment::getClassTypeId()
|
||||
|| geo2->getTypeId() != Part::GeomLineSegment::getClassTypeId()) {
|
||||
if (!geo1->is<Part::GeomLineSegment>() || !geo2->is<Part::GeomLineSegment>()) {
|
||||
if (Constr->Type == Equal) {
|
||||
double r1a = 0, r1b = 0, r2a = 0, r2b = 0;
|
||||
double angle1,
|
||||
@@ -731,8 +730,7 @@ Restart:
|
||||
|
||||
|
||||
if (geo2->is<Part::GeomEllipse>() || geo2->is<Part::GeomArcOfEllipse>()
|
||||
|| geo2->getTypeId()
|
||||
== Part::GeomArcOfHyperbola::getClassTypeId()) {
|
||||
|| geo2->is<Part::GeomArcOfHyperbola>()) {
|
||||
|
||||
Base::Vector3d majDir, minDir, rvec;
|
||||
majDir = Base::Vector3d(cos(angle2),
|
||||
|
||||
Reference in New Issue
Block a user