PartDesign: modernize type checking

This commit is contained in:
Florian Foinant-Willig
2023-10-15 21:39:11 +02:00
parent 2e16f5aa36
commit 6adc675a12
26 changed files with 114 additions and 114 deletions

View File

@@ -146,11 +146,11 @@ QVariant TaskSketchBasedParameters::setUpToFace(const QString& text)
if (!obj)
return {};
if (obj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) {
if (obj->isDerivedFrom<App::Plane>()) {
// everything is OK (we assume a Part can only have exactly 3 App::Plane objects located at the base of the feature tree)
return {};
}
else if (obj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId())) {
else if (obj->isDerivedFrom<Part::Datum>()) {
// it's up to the document to check that the datum plane is in the same body
return {};
}
@@ -256,7 +256,7 @@ bool TaskDlgSketchBasedParameters::accept() {
// Make sure the feature is what we are expecting
// Should be fine but you never know...
if (!feature->getTypeId().isDerivedFrom(PartDesign::ProfileBased::getClassTypeId())) {
if (!feature->isDerivedFrom<PartDesign::ProfileBased>()) {
throw Base::TypeError("Bad object processed in the sketch based dialog.");
}