]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To introduce ID's mapping for Family mesh
authorapo <apo@opencascade.com>
Wed, 31 Aug 2005 11:48:09 +0000 (11:48 +0000)
committerapo <apo@opencascade.com>
Wed, 31 Aug 2005 11:48:09 +0000 (11:48 +0000)
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_Convertor_impl.hxx

index 4bf49421bab424783af83667ee48009e4cb4b861..cd0f15999d949063aad4600e46b0900a0db22e43 100644 (file)
@@ -405,6 +405,37 @@ namespace VISU
   }
 
 
+  //---------------------------------------------------------------
+  vtkCell* 
+  TFamilyImpl
+  ::GetElemCell(int theObjID)
+  {
+    vtkIdType aVtkID = GetElemVTKID(theObjID);
+    return GetSource()->GetCell(aVtkID);
+  }
+
+  vtkIdType
+  TFamilyImpl
+  ::GetElemVTKID(vtkIdType theID) const
+  {
+    if(myElemObj2VTKID.empty())
+      return theID;
+    else{
+      TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
+      if(anIter != myElemObj2VTKID.end())
+       return anIter->second;
+    }
+    return -1;
+  }
+
+  vtkIdType
+  TFamilyImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    return myMeshID[theID];
+  }
+
+
   //---------------------------------------------------------------
   TNbASizeCells 
   TGroupImpl
@@ -794,6 +825,11 @@ namespace
     aCellTypesArray->SetNumberOfComponents(1);
     aCellTypesArray->SetNumberOfTuples(aNbCells);
 
+    TSubMeshID& aMeshID = theFamily->myMeshID;
+    aMeshID.resize(aNbCells);
+
+    VISU::TID2ID& anElemObj2VTKID = theFamily->myElemObj2VTKID;
+
     const VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
     VISU::TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.begin();
     for(vtkIdType i = 0, j = 0; anIter != aGeom2SubMesh.end(); anIter++){
@@ -817,8 +853,12 @@ namespace
 
       VISU::TSubMeshID::const_iterator aSubMeshIDIter = aSubMeshID.begin();
       for(; aSubMeshIDIter != aSubMeshID.end(); aSubMeshIDIter++, i++){
-       PrintCells(i,aConnectivity,anArray[*aSubMeshIDIter]);
+       vtkIdType anID = *aSubMeshIDIter;
+       PrintCells(i,aConnectivity,anArray[anID]);
        aCellTypesArray->SetValue(j++,(unsigned char)aGeom);
+
+       anElemObj2VTKID[anID] = i;
+       aMeshID[i] = anID;
       }
     }
     vtkIdType *pts = 0, npts = 0;
index feb422a0cef882897f1f44ab6b1cf843916dcad8..51f65ff0ab39117f581845c5ac30daf136739a60 100644 (file)
@@ -323,6 +323,21 @@ namespace VISU
 
   struct TFamilyImpl: virtual TFamily, virtual TSource
   {
+    virtual
+    vtkCell* 
+    GetElemCell(int theObjID);
+
+    virtual 
+    vtkIdType 
+    GetElemVTKID(vtkIdType theID) const;
+
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
+
+    TID2ID myElemObj2VTKID;
+    TSubMeshID myMeshID;
+
     TGeom2SubMeshID myGeom2SubMeshID;
   };
   typedef SharedPtr<TFamilyImpl> PFamilyImpl;