X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_Measurements_i.cxx;h=704e9549b1d2a3d071a00c324901b488950441fa;hp=37278a3de698e7dbf448b2c145ec301099584959;hb=54d95073e18f1aca5c8e031c6b14e930c84f320e;hpb=3f36e2f8be3687a5c1b48595f878df46c4d81e74 diff --git a/src/SMESH_I/SMESH_Measurements_i.cxx b/src/SMESH_I/SMESH_Measurements_i.cxx index 37278a3de..704e9549b 100644 --- a/src/SMESH_I/SMESH_Measurements_i.cxx +++ b/src/SMESH_I/SMESH_Measurements_i.cxx @@ -151,7 +151,8 @@ static SMESHDS_Mesh* getMesh(SMESH::SMESH_IDSource_ptr theSource) { if (!CORBA::is_nil( theSource )) { - SMESH_Mesh_i* anImplPtr = DownCast(theSource->GetMesh()); + SMESH::SMESH_Mesh_var mesh = theSource->GetMesh(); + SMESH_Mesh_i* anImplPtr = DownCast( mesh ); if (anImplPtr) return anImplPtr->GetImpl().GetMeshDS(); } @@ -287,19 +288,28 @@ static void enlargeBoundingBox(const SMESH::SMESH_IDSource_ptr theObject, const SMESHDS_Mesh* aMesh = getMesh( theObject ); if ( !aMesh ) return; - SMESH::array_of_ElementType_var types = theObject->GetTypes(); - SMESH::long_array_var aElementsId = theObject->GetIDs(); - // here we assume that type of all IDs defined by first type in array - const bool isNode = isNodeType( types ); - for(int i = 0, n = aElementsId->length(); i < n; i++) + + if ( DownCast( theObject )) // theObject is mesh { - if (isNode) - enlargeBoundingBox( aMesh->FindNode( aElementsId[i] ), theMeasure); - else + for (SMDS_NodeIteratorPtr aNodeIter = aMesh->nodesIterator(); aNodeIter->more(); ) + enlargeBoundingBox( aNodeIter->next(), theMeasure); + } + else + { + SMESH::array_of_ElementType_var types = theObject->GetTypes(); + SMESH::long_array_var aElementsId = theObject->GetIDs(); + // here we assume that type of all IDs defined by first type in array + const bool isNode = isNodeType( types ); + for(int i = 0, n = aElementsId->length(); i < n; i++) { - if ( const SMDS_MeshElement* elem = aMesh->FindElement( aElementsId[i] )) - for (SMDS_NodeIteratorPtr aNodeIter = elem->nodeIterator(); aNodeIter->more(); ) - enlargeBoundingBox( aNodeIter->next(), theMeasure); + if (isNode) + enlargeBoundingBox( aMesh->FindNode( aElementsId[i] ), theMeasure); + else + { + if ( const SMDS_MeshElement* elem = aMesh->FindElement( aElementsId[i] )) + for (SMDS_NodeIteratorPtr aNodeIter = elem->nodeIterator(); aNodeIter->more(); ) + enlargeBoundingBox( aNodeIter->next(), theMeasure); + } } } }