Extensions: Handle new dynamic_cast's
This commit is contained in:
@@ -263,10 +263,11 @@ void PropertyPostDataObject::SaveDocFile (Base::Writer &writer) const
|
||||
// We only print an error message but continue writing the next files to the
|
||||
// stream...
|
||||
App::PropertyContainer* father = this->getContainer();
|
||||
if (father && father->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
|
||||
if (father) {
|
||||
App::DocumentObject* obj = dynamic_cast<App::DocumentObject*>(father);
|
||||
Base::Console().Error("Dataset of '%s' cannot be written to vtk file '%s'\n",
|
||||
obj->Label.getValue(),fi.filePath().c_str());
|
||||
if(obj)
|
||||
Base::Console().Error("Dataset of '%s' cannot be written to vtk file '%s'\n",
|
||||
obj->Label.getValue(),fi.filePath().c_str());
|
||||
}
|
||||
else {
|
||||
Base::Console().Error("Cannot save vtk file '%s'\n", fi.filePath().c_str());
|
||||
@@ -331,10 +332,11 @@ void PropertyPostDataObject::RestoreDocFile(Base::Reader &reader)
|
||||
// We only print an error message but continue reading the next files from the
|
||||
// stream...
|
||||
App::PropertyContainer* father = this->getContainer();
|
||||
if (father && father->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
|
||||
if (father) {
|
||||
App::DocumentObject* obj = dynamic_cast<App::DocumentObject*>(father);
|
||||
Base::Console().Error("Dataset file '%s' with data of '%s' seems to be empty\n",
|
||||
fi.filePath().c_str(),obj->Label.getValue());
|
||||
if(obj)
|
||||
Base::Console().Error("Dataset file '%s' with data of '%s' seems to be empty\n",
|
||||
fi.filePath().c_str(),obj->Label.getValue());
|
||||
}
|
||||
else {
|
||||
Base::Console().Warning("Loaded Dataset file '%s' seems to be empty\n", fi.filePath().c_str());
|
||||
|
||||
@@ -296,10 +296,11 @@ void PropertyPartShape::SaveDocFile (Base::Writer &writer) const
|
||||
// We only print an error message but continue writing the next files to the
|
||||
// stream...
|
||||
App::PropertyContainer* father = this->getContainer();
|
||||
if (father && father->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
|
||||
if (father) {
|
||||
App::DocumentObject* obj = dynamic_cast<App::DocumentObject*>(father);
|
||||
Base::Console().Error("Shape of '%s' cannot be written to BRep file '%s'\n",
|
||||
obj->Label.getValue(),fi.filePath().c_str());
|
||||
if(obj)
|
||||
Base::Console().Error("Shape of '%s' cannot be written to BRep file '%s'\n",
|
||||
obj->Label.getValue(),fi.filePath().c_str());
|
||||
}
|
||||
else {
|
||||
Base::Console().Error("Cannot save BRep file '%s'\n", fi.filePath().c_str());
|
||||
@@ -375,10 +376,11 @@ void PropertyPartShape::RestoreDocFile(Base::Reader &reader)
|
||||
// We only print an error message but continue reading the next files from the
|
||||
// stream...
|
||||
App::PropertyContainer* father = this->getContainer();
|
||||
if (father && father->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
|
||||
if (father) {
|
||||
App::DocumentObject* obj = dynamic_cast<App::DocumentObject*>(father);
|
||||
Base::Console().Error("BRep file '%s' with shape of '%s' seems to be empty\n",
|
||||
fi.filePath().c_str(),obj->Label.getValue());
|
||||
if(obj)
|
||||
Base::Console().Error("BRep file '%s' with shape of '%s' seems to be empty\n",
|
||||
fi.filePath().c_str(),obj->Label.getValue());
|
||||
}
|
||||
else {
|
||||
Base::Console().Warning("Loaded BRep file '%s' seems to be empty\n", fi.filePath().c_str());
|
||||
|
||||
@@ -442,7 +442,7 @@ void CmdPartDesignNewSketch::activated(int iMsg)
|
||||
auto group = App::GeoFeatureGroupExtension::getGroupOfObject ( pcActiveBody );
|
||||
App::GeoFeatureGroupExtension* geoGroup = nullptr;
|
||||
if(group)
|
||||
geoGroup = dynamic_cast<App::GeoFeatureGroupExtension*>(group->getExtension(App::GeoFeatureGroupExtension::getClassTypeId()));
|
||||
geoGroup = group->getExtensionByType<App::GeoFeatureGroupExtension>();
|
||||
|
||||
std::vector<App::DocumentObject*> planes;
|
||||
std::vector<PartDesignGui::TaskFeaturePick::featureStatus> status;
|
||||
|
||||
@@ -330,7 +330,9 @@ SbBox3f ViewProviderDatum::getRelevantBoundBox () const {
|
||||
App::DocumentObject* group = App::DocumentObjectGroup::getGroupOfObject ( this->getObject () );
|
||||
|
||||
if(group) {
|
||||
objs = dynamic_cast<App::GroupExtension*>(group->getExtension(App::GroupExtension::getClassTypeId()))->getObjects ();
|
||||
auto* ext = group->getExtensionByType<App::GroupExtension>();
|
||||
if(ext)
|
||||
objs = ext->getObjects ();
|
||||
} else {
|
||||
// Fallback to whole document
|
||||
objs = this->getObject ()->getDocument ()->getObjects ();
|
||||
|
||||
Reference in New Issue
Block a user