Points: modernize type checking

This commit is contained in:
Florian Foinant-Willig
2023-10-15 21:39:05 +02:00
parent 0afd77c557
commit e12b7cacab
2 changed files with 7 additions and 7 deletions

View File

@@ -310,7 +310,7 @@ void CmdPointsPolyCut::activated(int iMsg)
if (it == docObj.begin()) {
Gui::Document* doc = getActiveGuiDocument();
Gui::MDIView* view = doc->getActiveView();
if (view->getTypeId().isDerivedFrom(Gui::View3DInventor::getClassTypeId())) {
if (view->isDerivedFrom<Gui::View3DInventor>()) {
Gui::View3DInventorViewer* viewer = ((Gui::View3DInventor*)view)->getViewer();
viewer->setEditing(true);
viewer->startSelection(Gui::View3DInventorViewer::Lasso);
@@ -427,7 +427,7 @@ void CmdPointsStructure::activated(int iMsg)
output->Label.setValue(name);
// Already sorted, so just make a copy
if (it->getTypeId().isDerivedFrom(Points::Structured::getClassTypeId())) {
if (it->isDerivedFrom<Points::Structured>()) {
Points::Structured* input = static_cast<Points::Structured*>(it);
Points::PointKernel* kernel = output->Points.startEditing();

View File

@@ -426,20 +426,20 @@ void ViewProviderScattered::attach(App::DocumentObject* pcObj)
void ViewProviderScattered::updateData(const App::Property* prop)
{
ViewProviderPoints::updateData(prop);
if (prop->getTypeId() == Points::PropertyPointKernel::getClassTypeId()) {
if (prop->is<Points::PropertyPointKernel>()) {
ViewProviderPointsBuilder builder;
builder.createPoints(prop, pcPointsCoord, pcPoints);
// The number of points might have changed, so force also a resize of the Inventor internals
setActiveMode();
}
else if (prop->getTypeId() == Points::PropertyNormalList::getClassTypeId()) {
else if (prop->is<Points::PropertyNormalList>()) {
setActiveMode();
}
else if (prop->getTypeId() == Points::PropertyGreyValueList::getClassTypeId()) {
else if (prop->is<Points::PropertyGreyValueList>()) {
setActiveMode();
}
else if (prop->getTypeId() == App::PropertyColorList::getClassTypeId()) {
else if (prop->is<App::PropertyColorList>()) {
setActiveMode();
}
}
@@ -598,7 +598,7 @@ void ViewProviderStructured::attach(App::DocumentObject* pcObj)
void ViewProviderStructured::updateData(const App::Property* prop)
{
ViewProviderPoints::updateData(prop);
if (prop->getTypeId() == Points::PropertyPointKernel::getClassTypeId()) {
if (prop->is<Points::PropertyPointKernel>()) {
ViewProviderPointsBuilder builder;
builder.createPoints(prop, pcPointsCoord, pcPoints);