From ee6f757c577b20b5bfe29ebee26a0651a7c7c921 Mon Sep 17 00:00:00 2001 From: Jonathan Zirkle <97168343+jonzirk76@users.noreply.github.com> Date: Mon, 31 Mar 2025 09:17:51 -0400 Subject: [PATCH] Mod: Convert from dynamic to static casts (#20452) --- src/Mod/Measure/Gui/Command.cpp | 2 +- src/Mod/Part/App/Geometry.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Mod/Measure/Gui/Command.cpp b/src/Mod/Measure/Gui/Command.cpp index 5a886fb2c9..2a138080fa 100644 --- a/src/Mod/Measure/Gui/Command.cpp +++ b/src/Mod/Measure/Gui/Command.cpp @@ -70,7 +70,7 @@ bool StdCmdMeasure::isActive() Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); if (view && view->isDerivedFrom()) { - Gui::View3DInventorViewer* viewer = dynamic_cast(view)->getViewer(); + Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); return !viewer->isEditing(); } return false; diff --git a/src/Mod/Part/App/Geometry.cpp b/src/Mod/Part/App/Geometry.cpp index 571b91cd18..bc545995af 100644 --- a/src/Mod/Part/App/Geometry.cpp +++ b/src/Mod/Part/App/Geometry.cpp @@ -765,8 +765,8 @@ GeomLineSegment* GeomCurve::toLineSegment(KeepTag clone) const Base::Vector3d start, end; if (isDerivedFrom()) { - start = dynamic_cast(this)->getStartPoint(); - end = dynamic_cast(this)->getEndPoint(); + start = static_cast(this)->getStartPoint(); + end = static_cast(this)->getEndPoint(); } else { start = pointAtParameter(getFirstParameter()); end = pointAtParameter(getLastParameter()); @@ -4527,7 +4527,7 @@ bool GeomLine::isSame(const Geometry &_other, double tol, double atol) const { if(_other.getTypeId() != getTypeId()) { if (_other.isDerivedFrom()) { - std::unique_ptr geo(dynamic_cast(_other).toLine()); + std::unique_ptr geo(static_cast(_other).toLine()); if (geo) return isSame(*geo, tol, atol); } @@ -4819,10 +4819,10 @@ GeomPlane* GeomSurface::toPlane(bool clone, double tol) const { if (isDerivedFrom()) { if (clone) { - return dynamic_cast(this->clone()); + return static_cast(this->clone()); } else { - return dynamic_cast(this->copy()); + return static_cast(this->copy()); } }