]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
In context of [Bug NPAL15278] EDF 347 : ScalarMaponDeformedShape
authorapo <apo@opencascade.com>
Wed, 2 May 2007 11:52:53 +0000 (11:52 +0000)
committerapo <apo@opencascade.com>
Wed, 2 May 2007 11:52:53 +0000 (11:52 +0000)
Restore selection functionality

src/CONVERTOR/VISU_Convertor_impl.cxx
src/OBJECT/VISU_Actor.cxx

index fa80167575edbdf4d0685086b21607909e1e4e27..e63d3b60ae18d1aa8bfe8f9901cb9cbc701f253c 100644 (file)
@@ -656,16 +656,25 @@ namespace VISU
   TMeshOnEntityImpl
   ::GetElemVTKID(vtkIdType theID) const
   {
-    VISU::TVTKOutput* anOutput = GetFilter()->GetOutput();
-    return VISU::GetElemVTKID(anOutput, theID, (int)myEntity);
+    if(myElemObj2VTKID.empty())
+      return theID;
+    else{
+      TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
+      if(anIter != myElemObj2VTKID.end())
+       return anIter->second;
+    }
+    return -1;
   }
 
   vtkIdType
   TMeshOnEntityImpl
   ::GetElemObjID(vtkIdType theID) const
   {
-    VISU::TVTKOutput* anOutput = GetFilter()->GetOutput();
-    return VISU::GetElemObjID(anOutput, theID);
+    vtkIdType anInputID, aStartId, anInputDataSetID;
+    const TVTKAppendFilter& anAppendFilter = GetFilter();
+    anAppendFilter->GetCellInputID(theID,anInputID,aStartId,anInputDataSetID);
+    const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputDataSetID];
+    return aSubMesh->GetElemObjID(anInputID);
   }
 
   std::string 
@@ -2010,6 +2019,10 @@ VISU_Convertor_impl
       const TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
       TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.begin();
 
+      TID2ID& anElemObj2VTKID = aMeshOnEntity->myElemObj2VTKID;
+      TSubMeshArr& aSubMeshArr = aMeshOnEntity->mySubMeshArr;
+      aSubMeshArr.resize(aGeom2SubMesh.size());
+
       for(vtkIdType anID = 0, aCellID = 0; anIter != aGeom2SubMesh.end(); anIter++, anID++){
        EGeometry aEGeom = anIter->first;
        vtkIdType aVGeom = VISUGeom2VTK(aEGeom);
@@ -2028,7 +2041,14 @@ VISU_Convertor_impl
        aSubMesh->myStartID = aCellID;
        GetCellsOnSubMesh(aSource, aMeshOnEntity, aSubMesh, aVGeom);
        anAppendFilter->AddInput(aSource.GetPointer());
-       aCellID += aSource->GetNumberOfCells();
+       
+       vtkIdType aNbCells = aSource->GetNumberOfCells();
+       for(vtkIdType aCell = 0; aCell < aNbCells; aCell++, aCellID++){
+         vtkIdType anObjID = aSubMesh->GetElemObjID(aCell);
+         anElemObj2VTKID[anObjID] = aCellID;
+       }
+
+       aSubMeshArr[anID] = aSubMesh;
       }
       aMeshOnEntity->myNamedPointCoords = aMesh->myNamedPointCoords;
       //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
index 06c487b3675362a7b32f1e0aab032c9d09444155..c2f6a388c513be414ddd1e8b807fd6ba1aae573c 100644 (file)
@@ -32,9 +32,6 @@
 #include "VTKViewer_GeometryFilter.h"
 #include "VTKViewer_PassThroughFilter.h"
 
-#include "VISU_ConvertorUtils.hxx"
-#include "VISU_ConvertorDef.hxx"
-
 #include <stdexcept>
 #include <sstream>
 
@@ -411,16 +408,25 @@ vtkIdType
 VISU_Actor
 ::GetNodeObjId(vtkIdType theID)
 {
-  if(MYDEBUG) cout << "GetNodeObjId("<<theID<<")"<<endl;
-  return VISU::GetNodeObjID(this->GetInput(),theID);
+  if(myIsVTKMapping)
+    return Superclass::GetNodeObjId(theID);
+
+  vtkIdType anID = myGeomFilter->GetNodeObjId(theID);
+
+  if(myIsShrunk)
+   anID = myShrinkFilter->GetNodeObjId(anID);
+
+  return GetCurrentPL()->GetNodeObjID(anID);
 }
 
 vtkIdType
 VISU_Actor
 ::GetNodeVTKID(vtkIdType theID)
 {
-  if(MYDEBUG) cout << "GetNodeVTKID("<<theID<<")"<<endl;
-  return VISU::GetNodeVTKID(this->GetInput(),theID);
+  if(myIsVTKMapping)
+    return theID;
+
+  return GetCurrentPL()->GetNodeVTKID(theID);
 }
 
 vtkFloatingPointType*
@@ -439,23 +445,25 @@ vtkIdType
 VISU_Actor
 ::GetElemObjId(vtkIdType theID)
 {
-  if(MYDEBUG) cout << "GetElemObjId("<<theID<<")"<<endl;
-  return VISU::GetElemObjID(this->GetInput(),theID);
+  if(myIsVTKMapping)
+    return Superclass::GetElemObjId(theID);
+
+  vtkIdType anID = myGeomFilter->GetElemObjId(theID);
+
+  if(myIsShrunk)
+   anID = myShrinkFilter->GetElemObjId(anID);
+
+  return GetCurrentPL()->GetElemObjID(anID);
 }
 
 vtkIdType
 VISU_Actor
 ::GetElemVTKID(vtkIdType theID)
 {
-  if(MYDEBUG) cout << "GetElemVTKID("<<theID<<")"<<endl;
-  vtkIdType theId = VISU::GetElemVTKID(this->GetInput(),theID,VISU::CELL_ENTITY);
-  if(theId > -1)
-    return theId;
-  theId = VISU::GetElemVTKID(this->GetInput(),theID,VISU::FACE_ENTITY);
-  if(theId > -1)
-    return theId;
-  theId = VISU::GetElemVTKID(this->GetInput(),theID,VISU::EDGE_ENTITY);
-  return theId;
+  if(myIsVTKMapping)
+    return theID;
+
+  return GetCurrentPL()->GetElemVTKID(theID);
 }
 
 vtkCell*