Mesh: Use freecad_cast whenever possible

This commit is contained in:
Kacper Donat
2025-04-25 00:05:44 +02:00
committed by Benjamin Nauck
parent 6d99872b0f
commit 81c772938e
4 changed files with 7 additions and 7 deletions

View File

@@ -42,7 +42,7 @@ Transform::Transform()
App::DocumentObjectExecReturn* Transform::execute()
{
/*
Feature* pcFirst = dynamic_cast<Feature*>(Source.getValue());
Feature* pcFirst = freecad_cast<Feature*>(Source.getValue());
if (!pcFirst || pcFirst->isError())
return new App::DocumentObjectExecReturn("Unknown Error");

View File

@@ -40,7 +40,7 @@ TransformDemolding::TransformDemolding()
App::DocumentObjectExecReturn* TransformDemolding::execute()
{ /*
Feature *pcFirst = dynamic_cast<Feature*>(Source.getValue());
Feature *pcFirst = freecad_cast<Feature*>(Source.getValue());
if (!pcFirst || pcFirst->isError())
return new App::DocumentObjectExecReturn("Unknown Error");

View File

@@ -1793,7 +1793,7 @@ void ViewProviderMesh::fillHoleCallback(void* ud, SoEventCallback* cb)
// By specifying the indexed mesh node 'pcFaceSet' we make sure that the picked point is
// really from the mesh we render and not from any other geometry
Gui::ViewProvider* vp = view->getViewProviderByPathFromTail(point->getPath());
if (auto that = dynamic_cast<ViewProviderMesh*>(vp)) {
if (auto that = freecad_cast<ViewProviderMesh*>(vp)) {
const SoDetail* detail = point->getDetail(that->getShapeNode());
if (detail && detail->getTypeId() == SoFaceDetail::getClassTypeId()) {
// get the boundary to the picked facet
@@ -1868,7 +1868,7 @@ void ViewProviderMesh::markPartCallback(void* ud, SoEventCallback* cb)
// By specifying the indexed mesh node 'pcFaceSet' we make sure that the picked point is
// really from the mesh we render and not from any other geometry
Gui::ViewProvider* vp = view->getViewProviderByPathFromTail(point->getPath());
if (auto that = dynamic_cast<ViewProviderMesh*>(vp)) {
if (auto that = freecad_cast<ViewProviderMesh*>(vp)) {
const SoDetail* detail = point->getDetail(that->getShapeNode());
if (detail && detail->getTypeId() == SoFaceDetail::getClassTypeId()) {
// get the boundary to the picked facet

View File

@@ -325,7 +325,7 @@ void ViewProviderMeshCurvature::updateData(const App::Property* prop)
// get the view provider of the associated mesh feature
App::Document* rDoc = pcObject->getDocument();
Gui::Document* pDoc = Gui::Application::Instance->getDocument(rDoc);
if (auto view = dynamic_cast<ViewProviderMesh*>(pDoc->getViewProvider(object))) {
if (auto view = freecad_cast<ViewProviderMesh*>(pDoc->getViewProvider(object))) {
this->pcLinkRoot->addChild(view->getHighlightNode());
auto mesh = view->getObject<Mesh::Feature>();
@@ -563,7 +563,7 @@ void ViewProviderMeshCurvature::curvatureInfoCallback(void* ud, SoEventCallback*
// By specifying the indexed mesh node 'pcFaceSet' we make sure that the picked point is
// really from the mesh we render and not from any other geometry
Gui::ViewProvider* vp = view->getViewProviderByPathFromTail(point->getPath());
if (auto self = dynamic_cast<ViewProviderMeshCurvature*>(vp)) {
if (auto self = freecad_cast<ViewProviderMeshCurvature*>(vp)) {
const SoDetail* detail = point->getDetail(point->getPath()->getTail());
if (detail && detail->getTypeId() == SoFaceDetail::getClassTypeId()) {
const auto facedetail = static_cast<const SoFaceDetail*>(detail); // NOLINT
@@ -597,7 +597,7 @@ void ViewProviderMeshCurvature::curvatureInfoCallback(void* ud, SoEventCallback*
// By specifying the indexed mesh node 'pcFaceSet' we make sure that the picked point is
// really from the mesh we render and not from any other geometry
Gui::ViewProvider* vp = view->getViewProviderByPathFromTail(point->getPath());
if (auto self = dynamic_cast<ViewProviderMeshCurvature*>(vp)) {
if (auto self = freecad_cast<ViewProviderMeshCurvature*>(vp)) {
const SoDetail* detail = point->getDetail(point->getPath()->getTail());
if (detail && detail->getTypeId() == SoFaceDetail::getClassTypeId()) {
const auto facedetail = static_cast<const SoFaceDetail*>(detail); // NOLINT