Commit 8304669b authored by Martin Heistermann's avatar Martin Heistermann

Avoid more uses of dynamic_cast.

parent d246a675
...@@ -108,7 +108,7 @@ bool getObject( int _identifier, HexahedralMeshObject*& _object ) { ...@@ -108,7 +108,7 @@ bool getObject( int _identifier, HexahedralMeshObject*& _object ) {
BaseObjectData* object = 0; BaseObjectData* object = 0;
PluginFunctions::getObject(_identifier,object); PluginFunctions::getObject(_identifier,object);
_object = dynamic_cast< HexahedralMeshObject* >(object); _object = hexahedralMeshObject(object);
return ( _object != 0 ); return ( _object != 0 );
} }
...@@ -120,7 +120,7 @@ bool getObject( int _identifier, HexahedralMeshObject*& _object ) { ...@@ -120,7 +120,7 @@ bool getObject( int _identifier, HexahedralMeshObject*& _object ) {
HexahedralMesh* hexahedralMesh( BaseObjectData* _object ) { HexahedralMesh* hexahedralMesh( BaseObjectData* _object ) {
if ( _object->dataType(DATA_HEXAHEDRAL_MESH) ) { if ( _object->dataType(DATA_HEXAHEDRAL_MESH) ) {
HexahedralMeshObject* object = dynamic_cast< HexahedralMeshObject* >(_object); HexahedralMeshObject* object = static_cast< HexahedralMeshObject* >(_object);
return object->mesh(); return object->mesh();
} else } else
return 0; return 0;
...@@ -139,7 +139,7 @@ HexahedralMesh* hexahedralMesh( int _identifier ) { ...@@ -139,7 +139,7 @@ HexahedralMesh* hexahedralMesh( int _identifier ) {
HexahedralMeshObject* hexahedralMeshObject( BaseObjectData* _object ) { HexahedralMeshObject* hexahedralMeshObject( BaseObjectData* _object ) {
if ( ! _object->dataType(DATA_HEXAHEDRAL_MESH) ) if ( ! _object->dataType(DATA_HEXAHEDRAL_MESH) )
return 0; return 0;
return dynamic_cast< HexahedralMeshObject* >( _object ); return static_cast< HexahedralMeshObject* >( _object );
} }
......
...@@ -102,7 +102,7 @@ bool getObject( int _identifier, TetrahedralMeshObject*& _object ) { ...@@ -102,7 +102,7 @@ bool getObject( int _identifier, TetrahedralMeshObject*& _object ) {
BaseObjectData* object = 0; BaseObjectData* object = 0;
PluginFunctions::getObject(_identifier,object); PluginFunctions::getObject(_identifier,object);
_object = dynamic_cast< TetrahedralMeshObject* >(object); _object = tetrahedralMeshObject(object);
return ( _object != 0 ); return ( _object != 0 );
} }
...@@ -114,7 +114,7 @@ bool getObject( int _identifier, TetrahedralMeshObject*& _object ) { ...@@ -114,7 +114,7 @@ bool getObject( int _identifier, TetrahedralMeshObject*& _object ) {
TetrahedralMesh* tetrahedralMesh( BaseObjectData* _object ) { TetrahedralMesh* tetrahedralMesh( BaseObjectData* _object ) {
if ( _object->dataType(DATA_TETRAHEDRAL_MESH) ) { if ( _object->dataType(DATA_TETRAHEDRAL_MESH) ) {
TetrahedralMeshObject* object = dynamic_cast< TetrahedralMeshObject* >(_object); TetrahedralMeshObject* object = static_cast< TetrahedralMeshObject* >(_object);
return object->mesh(); return object->mesh();
} else } else
return 0; return 0;
...@@ -133,7 +133,7 @@ TetrahedralMesh* tetrahedralMesh( int _identifier ) { ...@@ -133,7 +133,7 @@ TetrahedralMesh* tetrahedralMesh( int _identifier ) {
TetrahedralMeshObject* tetrahedralMeshObject( BaseObjectData* _object ) { TetrahedralMeshObject* tetrahedralMeshObject( BaseObjectData* _object ) {
if ( ! _object->dataType(DATA_TETRAHEDRAL_MESH) ) if ( ! _object->dataType(DATA_TETRAHEDRAL_MESH) )
return 0; return 0;
return dynamic_cast< TetrahedralMeshObject* >( _object ); return static_cast< TetrahedralMeshObject* >( _object );
} }
......
...@@ -298,7 +298,7 @@ void VolumeMeshObject<MeshT>::updateTopology() { ...@@ -298,7 +298,7 @@ void VolumeMeshObject<MeshT>::updateTopology() {
template<class MeshT> template<class MeshT>
BaseObject* VolumeMeshObject<MeshT>::copy() { BaseObject* VolumeMeshObject<MeshT>::copy() {
VolumeMeshObject< MeshT >* object = new VolumeMeshObject<MeshT>(*this); VolumeMeshObject< MeshT >* object = new VolumeMeshObject<MeshT>(*this);
return dynamic_cast<BaseObject*> (object); return static_cast<BaseObject*> (object);
} }
template<class MeshT> template<class MeshT>
......
...@@ -245,7 +245,7 @@ void TypeHexahedralMeshPlugin::switchRendering() { ...@@ -245,7 +245,7 @@ void TypeHexahedralMeshPlugin::switchRendering() {
if(!PluginFunctions::getObject(objectId, bod)) if(!PluginFunctions::getObject(objectId, bod))
return; return;
HexahedralMeshObject* hexMeshObject = dynamic_cast<HexahedralMeshObject*>(bod); HexahedralMeshObject* hexMeshObject = PluginFunctions::hexahedralMeshObject(bod);
if(hexMeshObject) { if(hexMeshObject) {
hexMeshObject->meshNode()->set_boundary_only(render_switch_->isChecked()); hexMeshObject->meshNode()->set_boundary_only(render_switch_->isChecked());
...@@ -267,7 +267,7 @@ void TypeHexahedralMeshPlugin::setTranslucencyFactor() { ...@@ -267,7 +267,7 @@ void TypeHexahedralMeshPlugin::setTranslucencyFactor() {
if(!PluginFunctions::getObject(objectId, bod)) if(!PluginFunctions::getObject(objectId, bod))
return; return;
HexahedralMeshObject* hexMeshObject = dynamic_cast<HexahedralMeshObject*>(bod); HexahedralMeshObject* hexMeshObject = PluginFunctions::hexahedralMeshObject(bod);
if(hexMeshObject) { if(hexMeshObject) {
......
...@@ -208,7 +208,7 @@ void TypePolyhedralMeshPlugin::switchRendering() { ...@@ -208,7 +208,7 @@ void TypePolyhedralMeshPlugin::switchRendering() {
if(!PluginFunctions::getObject(objectId, bod)) if(!PluginFunctions::getObject(objectId, bod))
return; return;
PolyhedralMeshObject* polyMeshObject = dynamic_cast<PolyhedralMeshObject*>(bod); PolyhedralMeshObject* polyMeshObject = PluginFunctions::polyhedralMeshObject(bod);
if(polyMeshObject) { if(polyMeshObject) {
polyMeshObject->meshNode()->set_boundary_only(render_switch_->isChecked()); polyMeshObject->meshNode()->set_boundary_only(render_switch_->isChecked());
...@@ -230,7 +230,7 @@ void TypePolyhedralMeshPlugin::setTranslucencyFactor() { ...@@ -230,7 +230,7 @@ void TypePolyhedralMeshPlugin::setTranslucencyFactor() {
if(!PluginFunctions::getObject(objectId, bod)) if(!PluginFunctions::getObject(objectId, bod))
return; return;
PolyhedralMeshObject* polyMeshObject = dynamic_cast<PolyhedralMeshObject*>(bod); PolyhedralMeshObject* polyMeshObject = PluginFunctions::polyhedralMeshObject(bod);
if(polyMeshObject) { if(polyMeshObject) {
......
...@@ -232,7 +232,7 @@ void TypeTetrahedralMeshPlugin::switchRendering() { ...@@ -232,7 +232,7 @@ void TypeTetrahedralMeshPlugin::switchRendering() {
if(!PluginFunctions::getObject(objectId, bod)) if(!PluginFunctions::getObject(objectId, bod))
return; return;
TetrahedralMeshObject* tetMeshObject = dynamic_cast<TetrahedralMeshObject*>(bod); TetrahedralMeshObject* tetMeshObject = PluginFunctions::tetrahedralMeshObject(bod);
if(tetMeshObject) { if(tetMeshObject) {
tetMeshObject->meshNode()->set_boundary_only(render_switch_->isChecked()); tetMeshObject->meshNode()->set_boundary_only(render_switch_->isChecked());
...@@ -254,7 +254,8 @@ void TypeTetrahedralMeshPlugin::setTranslucencyFactor() { ...@@ -254,7 +254,8 @@ void TypeTetrahedralMeshPlugin::setTranslucencyFactor() {
if(!PluginFunctions::getObject(objectId, bod)) if(!PluginFunctions::getObject(objectId, bod))
return; return;
TetrahedralMeshObject* tetMeshObject = dynamic_cast<TetrahedralMeshObject*>(bod); TetrahedralMeshObject* tetMeshObject = PluginFunctions::tetrahedralMeshObject(bod);
if(tetMeshObject) { if(tetMeshObject) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment