PartDesign: modernize type checking
This commit is contained in:
@@ -68,11 +68,11 @@ bool ReferenceSelection::allow(App::Document* pDoc, App::DocumentObject* pObj, c
|
||||
}
|
||||
|
||||
// Enable selection from origin of current part/
|
||||
if (pObj->getTypeId().isDerivedFrom(App::OriginFeature::getClassTypeId())) {
|
||||
if (pObj->isDerivedFrom<App::OriginFeature>()) {
|
||||
return allowOrigin(body, originGroup, pObj);
|
||||
}
|
||||
|
||||
if (pObj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId())) {
|
||||
if (pObj->isDerivedFrom<Part::Datum>()) {
|
||||
return allowDatum(body, pObj);
|
||||
}
|
||||
|
||||
@@ -90,11 +90,11 @@ bool ReferenceSelection::allow(App::Document* pDoc, App::DocumentObject* pObj, c
|
||||
return type.testFlag(AllowSelection::WHOLE);
|
||||
|
||||
// resolve links if needed
|
||||
if (!pObj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (!pObj->isDerivedFrom<Part::Feature>()) {
|
||||
pObj = Part::Feature::getShapeOwner(pObj, sSubName);
|
||||
}
|
||||
|
||||
if (pObj && pObj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (pObj && pObj->isDerivedFrom<Part::Feature>()) {
|
||||
return allowPartFeature(pObj, sSubName);
|
||||
}
|
||||
|
||||
@@ -138,10 +138,10 @@ App::OriginGroupExtension* ReferenceSelection::getOriginGroupExtension(PartDesig
|
||||
bool ReferenceSelection::allowOrigin(PartDesign::Body *body, App::OriginGroupExtension* originGroup, App::DocumentObject* pObj) const
|
||||
{
|
||||
bool fits = false;
|
||||
if (type.testFlag(AllowSelection::FACE) && pObj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) {
|
||||
if (type.testFlag(AllowSelection::FACE) && pObj->isDerivedFrom<App::Plane>()) {
|
||||
fits = true;
|
||||
}
|
||||
else if (type.testFlag(AllowSelection::EDGE) && pObj->getTypeId().isDerivedFrom(App::Line::getClassTypeId())) {
|
||||
else if (type.testFlag(AllowSelection::EDGE) && pObj->isDerivedFrom<App::Line>()) {
|
||||
fits = true;
|
||||
}
|
||||
|
||||
@@ -173,11 +173,11 @@ bool ReferenceSelection::allowDatum(PartDesign::Body *body, App::DocumentObject*
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type.testFlag(AllowSelection::FACE) && (pObj->getTypeId().isDerivedFrom(PartDesign::Plane::getClassTypeId())))
|
||||
if (type.testFlag(AllowSelection::FACE) && (pObj->isDerivedFrom<PartDesign::Plane>()))
|
||||
return true;
|
||||
if (type.testFlag(AllowSelection::EDGE) && (pObj->getTypeId().isDerivedFrom(PartDesign::Line::getClassTypeId())))
|
||||
if (type.testFlag(AllowSelection::EDGE) && (pObj->isDerivedFrom<PartDesign::Line>()))
|
||||
return true;
|
||||
if (type.testFlag(AllowSelection::POINT) && (pObj->getTypeId().isDerivedFrom(PartDesign::Point::getClassTypeId())))
|
||||
if (type.testFlag(AllowSelection::POINT) && (pObj->isDerivedFrom<PartDesign::Point>()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user