PartDesign: modernize type checking
This commit is contained in:
@@ -51,7 +51,7 @@ void MultiTransform::positionBySupport()
|
||||
PartDesign::Transformed::positionBySupport();
|
||||
std::vector<App::DocumentObject*> transFeatures = Transformations.getValues();
|
||||
for (auto f : transFeatures) {
|
||||
if (!(f->getTypeId().isDerivedFrom(PartDesign::Transformed::getClassTypeId())))
|
||||
if (!(f->isDerivedFrom<PartDesign::Transformed>()))
|
||||
throw Base::TypeError("Transformation features must be subclasses of Transformed");
|
||||
PartDesign::Transformed* transFeature = static_cast<PartDesign::Transformed*>(f);
|
||||
transFeature->Placement.setValue(this->Placement.getValue());
|
||||
@@ -80,7 +80,7 @@ const std::list<gp_Trsf> MultiTransform::getTransformations(const std::vector<Ap
|
||||
Part::Feature* originalFeature = static_cast<Part::Feature*>(originals.front());
|
||||
TopoDS_Shape original;
|
||||
|
||||
if (originalFeature->getTypeId().isDerivedFrom(PartDesign::FeatureAddSub::getClassTypeId())) {
|
||||
if (originalFeature->isDerivedFrom<PartDesign::FeatureAddSub>()) {
|
||||
PartDesign::FeatureAddSub* addFeature = static_cast<PartDesign::FeatureAddSub*>(originalFeature);
|
||||
//if (addFeature->getAddSubType() == FeatureAddSub::Additive)
|
||||
// original = addFeature->AddSubShape.getShape().getShape();
|
||||
@@ -97,7 +97,7 @@ const std::list<gp_Trsf> MultiTransform::getTransformations(const std::vector<Ap
|
||||
std::vector<App::DocumentObject*>::const_iterator f;
|
||||
|
||||
for (f = transFeatures.begin(); f != transFeatures.end(); ++f) {
|
||||
if (!((*f)->getTypeId().isDerivedFrom(PartDesign::Transformed::getClassTypeId())))
|
||||
if (!((*f)->isDerivedFrom<PartDesign::Transformed>()))
|
||||
throw Base::TypeError("Transformation features must be subclasses of Transformed");
|
||||
PartDesign::Transformed* transFeature = static_cast<PartDesign::Transformed*>(*f);
|
||||
std::list<gp_Trsf> newTransformations = transFeature->getTransformations(originals);
|
||||
@@ -116,7 +116,7 @@ const std::list<gp_Trsf> MultiTransform::getTransformations(const std::vector<Ap
|
||||
std::list<gp_Pnt> oldCogs;
|
||||
cogs.swap(oldCogs); // empty cogs to receive new cogs
|
||||
|
||||
if ((*f)->getTypeId() == PartDesign::Scaled::getClassTypeId()) {
|
||||
if ((*f)->is<PartDesign::Scaled>()) {
|
||||
// Diagonal method
|
||||
// Multiply every element in the old transformations' slices with the corresponding
|
||||
// element in the newTransformations. Example:
|
||||
|
||||
Reference in New Issue
Block a user