Extensions: Handle static/dynamic cast

After the change of the virtual inheritance position in the inheritance chain some
formally added dynamic_cast's can be reverted to the old behaviour
This commit is contained in:
Stefan Tröger
2016-09-21 17:19:57 +02:00
committed by wmayer
parent b101b11c67
commit 15b14783d1
6 changed files with 52 additions and 58 deletions

View File

@@ -263,11 +263,10 @@ 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) {
App::DocumentObject* obj = dynamic_cast<App::DocumentObject*>(father);
if(obj)
Base::Console().Error("Dataset of '%s' cannot be written to vtk file '%s'\n",
obj->Label.getValue(),fi.filePath().c_str());
if (father && father->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
App::DocumentObject* obj = static_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());
}
else {
Base::Console().Error("Cannot save vtk file '%s'\n", fi.filePath().c_str());
@@ -332,11 +331,10 @@ 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) {
App::DocumentObject* obj = dynamic_cast<App::DocumentObject*>(father);
if(obj)
Base::Console().Error("Dataset file '%s' with data of '%s' seems to be empty\n",
fi.filePath().c_str(),obj->Label.getValue());
if (father && father->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
App::DocumentObject* obj = static_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());
}
else {
Base::Console().Warning("Loaded Dataset file '%s' seems to be empty\n", fi.filePath().c_str());