diff --git a/src/Mod/Mesh/App/FeatureMeshDefects.cpp b/src/Mod/Mesh/App/FeatureMeshDefects.cpp index 68a95abad0..fa00cd59cf 100644 --- a/src/Mod/Mesh/App/FeatureMeshDefects.cpp +++ b/src/Mod/Mesh/App/FeatureMeshDefects.cpp @@ -70,7 +70,7 @@ App::DocumentObjectExecReturn* HarmonizeNormals::execute() return new App::DocumentObjectExecReturn("No mesh linked"); } App::Property* prop = link->getPropertyByName("Mesh"); - if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) { + if (prop && prop->is()) { Mesh::PropertyMeshKernel* kernel = static_cast(prop); std::unique_ptr mesh(new MeshObject); *mesh = kernel->getValue(); @@ -94,7 +94,7 @@ App::DocumentObjectExecReturn* FlipNormals::execute() return new App::DocumentObjectExecReturn("No mesh linked"); } App::Property* prop = link->getPropertyByName("Mesh"); - if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) { + if (prop && prop->is()) { Mesh::PropertyMeshKernel* kernel = static_cast(prop); std::unique_ptr mesh(new MeshObject); *mesh = kernel->getValue(); @@ -118,7 +118,7 @@ App::DocumentObjectExecReturn* FixNonManifolds::execute() return new App::DocumentObjectExecReturn("No mesh linked"); } App::Property* prop = link->getPropertyByName("Mesh"); - if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) { + if (prop && prop->is()) { Mesh::PropertyMeshKernel* kernel = static_cast(prop); std::unique_ptr mesh(new MeshObject); *mesh = kernel->getValue(); @@ -142,7 +142,7 @@ App::DocumentObjectExecReturn* FixDuplicatedFaces::execute() return new App::DocumentObjectExecReturn("No mesh linked"); } App::Property* prop = link->getPropertyByName("Mesh"); - if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) { + if (prop && prop->is()) { Mesh::PropertyMeshKernel* kernel = static_cast(prop); std::unique_ptr mesh(new MeshObject); *mesh = kernel->getValue(); @@ -166,7 +166,7 @@ App::DocumentObjectExecReturn* FixDuplicatedPoints::execute() return new App::DocumentObjectExecReturn("No mesh linked"); } App::Property* prop = link->getPropertyByName("Mesh"); - if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) { + if (prop && prop->is()) { Mesh::PropertyMeshKernel* kernel = static_cast(prop); std::unique_ptr mesh(new MeshObject); *mesh = kernel->getValue(); @@ -190,7 +190,7 @@ App::DocumentObjectExecReturn* FixDegenerations::execute() return new App::DocumentObjectExecReturn("No mesh linked"); } App::Property* prop = link->getPropertyByName("Mesh"); - if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) { + if (prop && prop->is()) { Mesh::PropertyMeshKernel* kernel = static_cast(prop); std::unique_ptr mesh(new MeshObject); *mesh = kernel->getValue(); @@ -217,7 +217,7 @@ App::DocumentObjectExecReturn* FixDeformations::execute() return new App::DocumentObjectExecReturn("No mesh linked"); } App::Property* prop = link->getPropertyByName("Mesh"); - if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) { + if (prop && prop->is()) { Mesh::PropertyMeshKernel* kernel = static_cast(prop); std::unique_ptr mesh(new MeshObject); *mesh = kernel->getValue(); @@ -242,7 +242,7 @@ App::DocumentObjectExecReturn* FixIndices::execute() return new App::DocumentObjectExecReturn("No mesh linked"); } App::Property* prop = link->getPropertyByName("Mesh"); - if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) { + if (prop && prop->is()) { Mesh::PropertyMeshKernel* kernel = static_cast(prop); std::unique_ptr mesh(new MeshObject); *mesh = kernel->getValue(); @@ -270,7 +270,7 @@ App::DocumentObjectExecReturn* FillHoles::execute() return new App::DocumentObjectExecReturn("No mesh linked"); } App::Property* prop = link->getPropertyByName("Mesh"); - if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) { + if (prop && prop->is()) { Mesh::PropertyMeshKernel* kernel = static_cast(prop); std::unique_ptr mesh(new MeshObject); *mesh = kernel->getValue(); @@ -299,7 +299,7 @@ App::DocumentObjectExecReturn* RemoveComponents::execute() return new App::DocumentObjectExecReturn("No mesh linked"); } App::Property* prop = link->getPropertyByName("Mesh"); - if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) { + if (prop && prop->is()) { Mesh::PropertyMeshKernel* kernel = static_cast(prop); std::unique_ptr mesh(new MeshObject); *mesh = kernel->getValue(); diff --git a/src/Mod/Mesh/App/FeatureMeshSegmentByMesh.cpp b/src/Mod/Mesh/App/FeatureMeshSegmentByMesh.cpp index 5df89ecef7..814bf51fd5 100644 --- a/src/Mod/Mesh/App/FeatureMeshSegmentByMesh.cpp +++ b/src/Mod/Mesh/App/FeatureMeshSegmentByMesh.cpp @@ -64,7 +64,7 @@ App::DocumentObjectExecReturn* SegmentByMesh::execute() App::DocumentObject* mesh = Source.getValue(); if (mesh) { App::Property* prop = mesh->getPropertyByName("Mesh"); - if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) { + if (prop && prop->is()) { kernel = static_cast(prop); } } @@ -79,7 +79,7 @@ App::DocumentObjectExecReturn* SegmentByMesh::execute() App::DocumentObject* tool = Tool.getValue(); if (tool) { App::Property* prop = tool->getPropertyByName("Mesh"); - if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) { + if (prop && prop->is()) { toolmesh = static_cast(prop); } } diff --git a/src/Mod/Mesh/App/Mesh.cpp b/src/Mod/Mesh/App/Mesh.cpp index 6c3df65f05..1de8503d77 100644 --- a/src/Mod/Mesh/App/Mesh.cpp +++ b/src/Mod/Mesh/App/Mesh.cpp @@ -141,7 +141,7 @@ void MeshObject::getFacesFromSubElement(const Data::Segment* element, std::vector& /*pointNormals*/, std::vector& faces) const { - if (element && element->getTypeId() == MeshSegment::getClassTypeId()) { + if (element && element->is()) { const MeshSegment* segm = static_cast(element); if (segm->segment) { Base::Reference submesh( diff --git a/src/Mod/Mesh/Gui/Command.cpp b/src/Mod/Mesh/Gui/Command.cpp index 87a8d4f19b..b5a4dc3b96 100644 --- a/src/Mod/Mesh/Gui/Command.cpp +++ b/src/Mod/Mesh/Gui/Command.cpp @@ -483,15 +483,14 @@ void CmdMeshFromGeometry::activated(int) std::vector geo = Gui::Selection().getObjectsOfType(App::GeoFeature::getClassTypeId()); for (auto it : geo) { - if (!it->getTypeId().isDerivedFrom(Mesh::Feature::getClassTypeId())) { + if (!it->isDerivedFrom()) { // exclude meshes std::map Map; it->getPropertyMap(Map); Mesh::MeshObject mesh; for (const auto& jt : Map) { if (jt.first == "Shape" - && jt.second->getTypeId().isDerivedFrom( - App::PropertyComplexGeoData::getClassTypeId())) { + && jt.second->isDerivedFrom()) { std::vector aPoints; std::vector aTopo; const Data::ComplexGeoData* data = @@ -675,7 +674,7 @@ void CmdMeshPolySegm::activated(int) if (it == docObj.begin()) { Gui::Document* doc = getActiveGuiDocument(); Gui::MDIView* view = doc->getActiveView(); - if (view->getTypeId().isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = ((Gui::View3DInventor*)view)->getViewer(); viewer->setEditing(true); viewer->startSelection(Gui::View3DInventorViewer::Clip); @@ -732,7 +731,7 @@ void CmdMeshAddFacet::activated(int) for (auto it : docObj) { Gui::Document* doc = Gui::Application::Instance->getDocument(it->getDocument()); Gui::MDIView* view = doc->getActiveView(); - if (view->getTypeId().isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view->isDerivedFrom()) { MeshGui::MeshFaceAddition* edit = new MeshGui::MeshFaceAddition(static_cast(view)); edit->startEditing(static_cast( @@ -783,7 +782,7 @@ void CmdMeshPolyCut::activated(int) if (it == docObj.begin()) { Gui::Document* doc = getActiveGuiDocument(); Gui::MDIView* view = doc->getActiveView(); - if (view->getTypeId().isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = ((Gui::View3DInventor*)view)->getViewer(); viewer->setEditing(true); @@ -848,7 +847,7 @@ void CmdMeshPolyTrim::activated(int) if (it == docObj.begin()) { Gui::Document* doc = getActiveGuiDocument(); Gui::MDIView* view = doc->getActiveView(); - if (view->getTypeId().isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = ((Gui::View3DInventor*)view)->getViewer(); viewer->setEditing(true); @@ -1001,7 +1000,7 @@ void CmdMeshPolySplit::activated(int) if (it == docObj.begin()) { Gui::Document* doc = getActiveGuiDocument(); Gui::MDIView* view = doc->getActiveView(); - if (view->getTypeId().isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = ((Gui::View3DInventor*)view)->getViewer(); viewer->setEditing(true); viewer->startSelection(Gui::View3DInventorViewer::Clip); diff --git a/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp b/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp index 24ef560230..89046e0d55 100644 --- a/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp +++ b/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp @@ -258,7 +258,7 @@ void DlgEvaluateMeshImp::changeEvent(QEvent* e) void DlgEvaluateMeshImp::slotCreatedObject(const App::DocumentObject& Obj) { // add new mesh object to the list - if (Obj.getTypeId().isDerivedFrom(Mesh::Feature::getClassTypeId())) { + if (Obj.isDerivedFrom()) { QString label = QString::fromUtf8(Obj.Label.getValue()); QString name = QString::fromLatin1(Obj.getNameInDocument()); d->ui.meshNameButton->addItem(label, name); @@ -268,7 +268,7 @@ void DlgEvaluateMeshImp::slotCreatedObject(const App::DocumentObject& Obj) void DlgEvaluateMeshImp::slotDeletedObject(const App::DocumentObject& Obj) { // remove mesh objects from the list - if (Obj.getTypeId().isDerivedFrom(Mesh::Feature::getClassTypeId())) { + if (Obj.isDerivedFrom()) { int index = d->ui.meshNameButton->findData(QString::fromLatin1(Obj.getNameInDocument())); if (index > 0) { d->ui.meshNameButton->removeItem(index); @@ -290,16 +290,15 @@ void DlgEvaluateMeshImp::slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop) { // if the current mesh object was modified update everything - if (&Obj == d->meshFeature && Prop.getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) { + if (&Obj == d->meshFeature && Prop.is()) { removeViewProviders(); cleanInformation(); showInformation(); d->self_intersections.clear(); } - else if (Obj.getTypeId().isDerivedFrom(Mesh::Feature::getClassTypeId())) { + else if (Obj.isDerivedFrom()) { // if the label has changed update the entry in the list - if (Prop.getTypeId() == App::PropertyString::getClassTypeId() - && strcmp(Prop.getName(), "Label") == 0) { + if (Prop.is() && strcmp(Prop.getName(), "Label") == 0) { QString label = QString::fromUtf8(Obj.Label.getValue()); QString name = QString::fromLatin1(Obj.getNameInDocument()); int index = d->ui.meshNameButton->findData(name); @@ -353,7 +352,7 @@ void DlgEvaluateMeshImp::addViewProvider(const char* name, if (d->view) { ViewProviderMeshDefects* vp = static_cast(Base::Type::createInstanceByName(name)); - assert(vp->getTypeId().isDerivedFrom(Gui::ViewProvider::getClassTypeId())); + assert(vp->isDerivedFrom()); vp->attach(d->meshFeature); d->view->getViewer()->addViewProvider(vp); vp->showDefects(indices); diff --git a/src/Mod/Mesh/Gui/MeshSelection.cpp b/src/Mod/Mesh/Gui/MeshSelection.cpp index ee54fc9eb6..2c34abd3a6 100644 --- a/src/Mod/Mesh/Gui/MeshSelection.cpp +++ b/src/Mod/Mesh/Gui/MeshSelection.cpp @@ -162,7 +162,7 @@ Gui::View3DInventorViewer* MeshSelection::getViewer() const return nullptr; } Gui::MDIView* view = doc->getActiveView(); - if (view && view->getTypeId().isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); return viewer; } @@ -561,7 +561,7 @@ void MeshSelection::pickFaceCallback(void* ud, SoEventCallback* n) // 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 (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderMesh::getClassTypeId())) { + if (!vp || !vp->isDerivedFrom()) { return; } ViewProviderMesh* mesh = static_cast(vp); diff --git a/src/Mod/Mesh/Gui/ViewProvider.cpp b/src/Mod/Mesh/Gui/ViewProvider.cpp index e1759373f3..d24dc4cc7b 100644 --- a/src/Mod/Mesh/Gui/ViewProvider.cpp +++ b/src/Mod/Mesh/Gui/ViewProvider.cpp @@ -506,10 +506,10 @@ void ViewProviderMesh::updateData(const App::Property* prop) { Gui::ViewProviderGeometryObject::updateData(prop); - if (prop->getTypeId() == App::PropertyColorList::getClassTypeId()) { + if (prop->is()) { Coloring.setStatus(App::Property::Hidden, false); } - else if (prop->getTypeId() == Mesh::PropertyMaterial::getClassTypeId()) { + else if (prop->is()) { Coloring.setStatus(App::Property::Hidden, false); } } @@ -1708,7 +1708,7 @@ void ViewProviderMesh::faceInfoCallback(void* ud, SoEventCallback* n) // 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 (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderMesh::getClassTypeId())) { + if (!vp || !vp->isDerivedFrom()) { return; } @@ -1791,7 +1791,7 @@ void ViewProviderMesh::fillHoleCallback(void* ud, SoEventCallback* n) // 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 (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderMesh::getClassTypeId())) { + if (!vp || !vp->isDerivedFrom()) { return; } ViewProviderMesh* that = static_cast(vp); @@ -1868,7 +1868,7 @@ void ViewProviderMesh::markPartCallback(void* ud, SoEventCallback* n) // 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 (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderMesh::getClassTypeId())) { + if (!vp || !vp->isDerivedFrom()) { return; } ViewProviderMesh* that = static_cast(vp); @@ -2501,7 +2501,7 @@ void ViewProviderIndexedFaceSet::attach(App::DocumentObject* pcFeat) void ViewProviderIndexedFaceSet::updateData(const App::Property* prop) { ViewProviderMesh::updateData(prop); - if (prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) { + if (prop->is()) { ViewProviderMeshBuilder builder; builder.createMesh(prop, pcMeshCoord, pcMeshFaces); showOpenEdges(OpenEdges.getValue()); @@ -2592,7 +2592,7 @@ void ViewProviderMeshObject::attach(App::DocumentObject* pcFeat) void ViewProviderMeshObject::updateData(const App::Property* prop) { ViewProviderMesh::updateData(prop); - if (prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) { + if (prop->is()) { const Mesh::PropertyMeshKernel* mesh = static_cast(prop); this->pcMeshNode->mesh.setValue( Base::Reference(mesh->getValuePtr())); diff --git a/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp b/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp index 6e1f35104d..ec0a778f1a 100644 --- a/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp @@ -289,7 +289,7 @@ void ViewProviderMeshCurvature::attach(App::DocumentObject* pcFeat) void ViewProviderMeshCurvature::updateData(const App::Property* prop) { // set to the expected size - if (prop->getTypeId().isDerivedFrom(App::PropertyLink::getClassTypeId())) { + if (prop->isDerivedFrom()) { Mesh::Feature* object = static_cast(prop)->getValue(); Gui::coinRemoveAllChildren(this->pcLinkRoot); @@ -309,7 +309,7 @@ void ViewProviderMeshCurvature::updateData(const App::Property* prop) ViewProviderMesh::updateTransform(p, pcTransform); } } - else if (prop->getTypeId() == Mesh::PropertyCurvatureList::getClassTypeId()) { + else if (prop->is()) { const Mesh::PropertyCurvatureList* curv = static_cast(prop); if (curv->getSize() < 3) { // invalid array @@ -545,8 +545,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 (!vp - || !vp->getTypeId().isDerivedFrom(ViewProviderMeshCurvature::getClassTypeId())) { + if (!vp || !vp->isDerivedFrom()) { return; } ViewProviderMeshCurvature* self = static_cast(vp); @@ -582,7 +581,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 (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderMeshCurvature::getClassTypeId())) { + if (!vp || !vp->isDerivedFrom()) { return; } ViewProviderMeshCurvature* that = static_cast(vp); @@ -605,7 +604,7 @@ ViewProviderMeshCurvature::curvatureInfo(bool detail, int index1, int index2, in // get the curvature info of the three points of the picked facet App::Property* prop = pcObject->getPropertyByName("CurvInfo"); std::stringstream str; - if (prop && prop->getTypeId() == Mesh::PropertyCurvatureList::getClassTypeId()) { + if (prop && prop->is()) { Mesh::PropertyCurvatureList* curv = static_cast(prop); const Mesh::CurvatureInfo& cVal1 = (*curv)[index1]; const Mesh::CurvatureInfo& cVal2 = (*curv)[index2]; diff --git a/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp b/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp index 7ddb233844..49a95431be 100644 --- a/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp @@ -100,7 +100,7 @@ void ViewProviderMeshFaceSet::attach(App::DocumentObject* pcFeat) void ViewProviderMeshFaceSet::updateData(const App::Property* prop) { ViewProviderMesh::updateData(prop); - if (prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) { + if (prop->is()) { const Mesh::MeshObject* mesh = static_cast(prop)->getValuePtr();