]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
23315: [CEA 1929] Too much memory used to display a mesh in shading and wireframe
authoreap <eap@opencascade.com>
Mon, 24 Oct 2016 15:05:40 +0000 (18:05 +0300)
committereap <eap@opencascade.com>
Mon, 24 Oct 2016 15:05:40 +0000 (18:05 +0300)
src/SVTK/SVTK_Actor.cxx
src/SVTK/SVTK_ViewWindow.cxx
src/VTKViewer/VTKViewer_Actor.cxx
src/VTKViewer/VTKViewer_Actor.h
src/VTKViewer/VTKViewer_ConvexTool.cxx
src/VTKViewer/VTKViewer_ConvexTool.h
src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx
src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.h
src/VTKViewer/VTKViewer_GeometryFilter.cxx
src/VTKViewer/VTKViewer_GeometryFilter.h
src/VTKViewer/VTKViewer_ViewWindow.h

index ceccd5afccf4f1300f5f8d09b40d6c7627f5b752..a4e404ee69cbd7bd39002f4d48c5e9bda91ff20e 100644 (file)
@@ -111,8 +111,8 @@ SVTK_Actor
   myUnstructuredGrid->Initialize();
   myUnstructuredGrid->Allocate();
 
-  vtkDataSet *aSourceDataSet = theMapActor->GetInput();
-  SVTK::CopyPoints(GetSource(),aSourceDataSet);
+  vtkUnstructuredGrid * aSourceGrid = (vtkUnstructuredGrid *)theMapActor->GetInput();
+  GetSource()->SetPoints( aSourceGrid->GetPoints() );
 
   int aNbOfParts = theMapIndex.Extent();
   for(int ind = 1; ind <= aNbOfParts; ind++){
@@ -182,8 +182,8 @@ SVTK_Actor
   myUnstructuredGrid->Initialize();
   myUnstructuredGrid->Allocate();
 
-  vtkDataSet *aSourceDataSet = theMapActor->GetInput();
-  SVTK::CopyPoints(GetSource(),aSourceDataSet);
+  vtkUnstructuredGrid * aSourceGrid = (vtkUnstructuredGrid *)theMapActor->GetInput();
+  GetSource()->SetPoints( aSourceGrid->GetPoints() );
 
 
   if(theMapIndex.Extent() == 2){
index b9df65cdf8a08c76e18182ac713ad206078123be..16578ddbf74b53db8cffe25d00778da375f5338a 100755 (executable)
@@ -77,6 +77,7 @@
 
 #include "VTKViewer_Utilities.h"
 #include "VTKViewer_Trihedron.h"
+#include "VTKViewer_Actor.h"
 
 #include "SVTK_View.h"
 #include "SVTK_Selector.h"
@@ -1084,6 +1085,15 @@ void SVTK_ViewWindow::SetSelectionEnabled( bool theEnable )
     dynamic_cast<QtxActionGroup*>( getAction( PreselectionId ) );
   if ( aPreselectionGroup )
     aPreselectionGroup->setEnabled( theEnable );
+
+  // notify actors
+  vtkActorCollection *actors = getRenderer()->GetActors();
+  for (int i = 0; i < actors->GetNumberOfItems(); ++i )
+    if (VTKViewer_Actor *actor = dynamic_cast<VTKViewer_Actor*>(actors->GetItemAsObject(i)))
+    {
+      cout << "actor " << actor << endl;
+      actor->EnableSelection( theEnable );
+    }
 }
 
 /*!
index b63a9ed50c9c2b75a6ac3ea3f64b14f347f37fe5..7d676c4cff0162c6345894ee43aeb4bfbde9356c 100755 (executable)
@@ -61,18 +61,18 @@ vtkStandardNewMacro(VTKViewer_Actor);
 */
 VTKViewer_Actor
 ::VTKViewer_Actor():
+  myIsResolveCoincidentTopology(true),
   myOpacity(1.0),
-  myIsHighlighted(false),
-  myIsPreselected(false),
-  myRepresentation(VTKViewer::Representation::Surface),
   myDisplayMode(1),
-  myProperty(vtkProperty::New()),
-  PreviewProperty(NULL),
   myIsInfinite(false),
-  myIsResolveCoincidentTopology(true),
   myStoreMapping(false),
   myGeomFilter(VTKViewer_GeometryFilter::New()),
-  myTransformFilter(VTKViewer_TransformFilter::New())
+  myTransformFilter(VTKViewer_TransformFilter::New()),
+  myRepresentation(VTKViewer::Representation::Surface),
+  myProperty(vtkProperty::New()),
+  PreviewProperty(NULL),
+  myIsPreselected(false),
+  myIsHighlighted(false)
 {
   vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
                                                                  myPolygonOffsetUnits);
index d561e48f36637ba830e3b43272d2ca60c3e699fd..1b2a2a497292d9819931647b492cdc74b82925f0 100755 (executable)
@@ -305,6 +305,11 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
   GetChildActors(vtkActorCollection*);
 
   //----------------------------------------------------------------------------
+  //! Is notified on enabling/disabling selection
+  virtual
+  void
+  EnableSelection( bool enable ) {}
+
   //! Ask, if the descendant of the VTKViewer_Actor will implement its own highlight or not
   virtual
   bool
index 6e2fb20e3040d50bb28647e354ecdca45ce0cfbc..f15527b73d83c9aae6ab574adfecafc8b3c4cf2a 100644 (file)
@@ -81,9 +81,9 @@ namespace
 VTKViewer_Triangulator
 ::VTKViewer_Triangulator():
   myCellIds(vtkIdList::New()),
+  myPointIds(NULL),
   myFaceIds(vtkIdList::New()),
-  myPoints(vtkPoints::New()),
-  myPointIds(NULL)
+  myPoints(vtkPoints::New())
 {}
 
 
@@ -200,7 +200,7 @@ VTKViewer_Triangulator
           vtkCellData* theOutputCD,
           int theStoreMapping,
           std::vector<vtkIdType>& theVTK2ObjIds,
-          std::map< vtkIdType, std::vector<vtkIdType> >& theDimension2VTK2ObjIds,
+          std::vector< std::vector<vtkIdType> >& theDimension2VTK2ObjIds,
           bool theIsCheckConvex)
 {
   vtkPoints *aPoints = InitPoints(theInput, theCellId);
@@ -573,7 +573,7 @@ VTKViewer_Triangulator
       if(DEBUG_TRIA_EXECUTE) cout << "PoilygonId="<<aPolygonId<<" | ";
       TConnectivities& aConnectivities = aPolygon.myConnectivities;
       if(DEBUG_TRIA_EXECUTE) {
-        for(int i=0;i<aConnectivities.size();i++)
+        for(size_t i=0;i<aConnectivities.size();i++)
           cout << aConnectivities[i] << ",";
         cout << endl;
       }
index bfdbb76888d2efbaa68ba3ddec78fcfb29f4e9f9..621dde78ee6c21d50b14aafe754ea1a92633f88f 100644 (file)
@@ -64,7 +64,7 @@ class VTKVIEWER_EXPORT VTKViewer_Triangulator
           vtkCellData* theOutputCD,
           int theStoreMapping,
           std::vector<vtkIdType>& theVTK2ObjIds,
-          std::map< vtkIdType, std::vector<vtkIdType> >& theDimension2VTK2ObjIds,
+          std::vector< std::vector<vtkIdType> >& theDimension2VTK2ObjIds,
           bool theIsCheckConvex);
 
  private:
index 6e696644ff56919a28c3a803609b87fe7e677153..1f665caf97d423ad9ec8574e2429323e49a87d25 100755 (executable)
@@ -55,27 +55,30 @@ VTKViewer_ExtractUnstructuredGrid::VTKViewer_ExtractUnstructuredGrid():
 {}
 
 
-VTKViewer_ExtractUnstructuredGrid::~VTKViewer_ExtractUnstructuredGrid(){}
-
+VTKViewer_ExtractUnstructuredGrid::~VTKViewer_ExtractUnstructuredGrid()
+{}
 
-void VTKViewer_ExtractUnstructuredGrid::RegisterCell(vtkIdType theCellId){
-//  if(0 && MYDEBUG) MESSAGE("RegisterCell - theCellId = "<<theCellId);
-  myCellIds.insert(theCellId);
-  Modified();
+void VTKViewer_ExtractUnstructuredGrid::RegisterCell(vtkIdType theCellId)
+{
+  if ( myCellIds.insert(theCellId).second )
+    Modified();
 }
 
 
-void VTKViewer_ExtractUnstructuredGrid::RegisterCellsWithType(vtkIdType theCellType){
-//  if(0 && MYDEBUG) MESSAGE("RegisterCellsWithType - theCellType = "<<theCellType);
-  myCellTypes.insert(theCellType);
-  //MESSAGE("myCellTypes.insert " << theCellType);
-  Modified();
+void VTKViewer_ExtractUnstructuredGrid::RegisterCellsWithType(vtkIdType theCellType)
+{
+  if ( myCellTypes.insert(theCellType).second )
+    Modified();
 }
 
 
-void VTKViewer_ExtractUnstructuredGrid::SetStoreMapping(int theStoreMapping){
-  myStoreMapping = theStoreMapping != 0;
-  this->Modified();
+void VTKViewer_ExtractUnstructuredGrid::SetStoreMapping(int theStoreMapping)
+{
+  if ( myStoreMapping != ( theStoreMapping != 0 ))
+  {
+    myStoreMapping = theStoreMapping != 0;
+    Modified();
+  }
 }
 
 vtkIdType VTKViewer_ExtractUnstructuredGrid::GetInputId(int theOutId) const
@@ -108,50 +111,44 @@ inline int InsertCell(vtkUnstructuredGrid *theInput,
                       VTKViewer_ExtractUnstructuredGrid::TVectorId& theOut2InId/*,
                       VTKViewer_ExtractUnstructuredGrid::TMapId& theIn2OutId*/)
 {
-  vtkCell     *aCell = theInput->GetCell(theCellId);
-  vtkIdList *aPntIds = aCell->GetPointIds();
-  vtkIdType   aNbIds = aPntIds->GetNumberOfIds();
-  vtkIdType  aCellId = -1;
-  theIdList->SetNumberOfIds(aNbIds);
-  for(vtkIdType i = 0; i < aNbIds; i++){
-    theIdList->SetId(i,aPntIds->GetId(i));
-  }
+  vtkCell      *aCell = theInput->GetCell(theCellId);
   vtkIdType aCellType = aCell->GetCellType();
+  vtkIdType  aCellId = -1;
 #if VTK_XVERSION > 50700
   if (aCellType != VTK_POLYHEDRON)
-    {
+  {
 #endif
-      aCellId = theConnectivity->InsertNextCell(theIdList);
-      if (theFaceLocations)
-        theFaceLocations->InsertNextValue(-1);
+    aCellId = theConnectivity->InsertNextCell( aCell->GetPointIds() ); //theIdList);
+    if (theFaceLocations)
+      theFaceLocations->InsertNextValue(-1);
 #if VTK_XVERSION > 50700
-    }
+  }
   else
+  {
+    //MESSAGE("InsertCell type VTK_POLYHEDRON " << theStoreMapping);
+    if (!theFaces)
     {
-      //MESSAGE("InsertCell type VTK_POLYHEDRON " << theStoreMapping);
-      if (!theFaces)
-        {
-          theFaces = vtkIdTypeArray::New();
-          theFaces->Allocate(theCellTypesArray->GetSize());
-          theFaceLocations = vtkIdTypeArray::New();
-          theFaceLocations->Allocate(theCellTypesArray->GetSize());
-          // FaceLocations must be padded until the current position
-          for (vtkIdType i = 0; i <= theCellTypesArray->GetMaxId(); i++)
-            {
-              theFaceLocations->InsertNextValue(-1);
-            }
-        }
-      // insert face location
-      theFaceLocations->InsertNextValue(theFaces->GetMaxId() + 1);
-
-      // insert cell connectivity and faces stream
-      vtkIdType nfaces = 0;
-      vtkIdType*  face = 0;
-      vtkIdType realnpts;
-      theInput->GetFaceStream(theCellId, nfaces, face);
-      vtkUnstructuredGrid::DecomposeAPolyhedronCell(
-          nfaces, face, realnpts, theConnectivity, theFaces);
+      theFaces = vtkIdTypeArray::New();
+      theFaces->Allocate(theCellTypesArray->GetSize());
+      theFaceLocations = vtkIdTypeArray::New();
+      theFaceLocations->Allocate(theCellTypesArray->GetSize());
+      // FaceLocations must be padded until the current position
+      for (vtkIdType i = 0; i <= theCellTypesArray->GetMaxId(); i++)
+      {
+        theFaceLocations->InsertNextValue(-1);
+      }
     }
+    // insert face location
+    theFaceLocations->InsertNextValue(theFaces->GetMaxId() + 1);
+
+    // insert cell connectivity and faces stream
+    vtkIdType nfaces = 0;
+    vtkIdType*  face = 0;
+    vtkIdType realnpts;
+    theInput->GetFaceStream(theCellId, nfaces, face);
+    vtkUnstructuredGrid::DecomposeAPolyhedronCell(
+                                                  nfaces, face, realnpts, theConnectivity, theFaces);
+  }
 #endif
 
   /*vtkIdType anID = */theCellTypesArray->InsertNextValue(aCellType);
@@ -222,8 +219,8 @@ int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(re
       if(vtkIdType aNbElems = anInput->GetNumberOfCells()){
         if(myStoreMapping) myOut2InId.reserve(aNbElems);
         anOutput->ShallowCopy(anInput);
-        for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
-          if(myStoreMapping){
+        if(myStoreMapping){
+          for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
             myOut2InId.push_back(aCellId);
             //myIn2OutId.insert( myIn2OutId.end(), std::make_pair( aCellId, anOutId ));
           }
index 18a02954699cd617e3a1762feee4714707e5f836..9470ddcd43aa0d8bcedf658dbd183500cd823add 100755 (executable)
@@ -53,7 +53,7 @@ public:
   enum EExtraction{ eCells, ePoints};
   //! Sets mode of extraction to \a theExtractionMode
   void SetModeOfExtraction(EExtraction theExtractionMode){
-    myExtractionMode = theExtractionMode; Modified();
+    if ( myExtractionMode != theExtractionMode ) { myExtractionMode = theExtractionMode; Modified(); }
   }
   //! Get Extraction mode (Return: \a myExtractionMode field)
   EExtraction GetModeOfExtraction(){ return myExtractionMode;}
@@ -61,39 +61,36 @@ public:
   enum EChanging{ ePassAll, eAdding, eRemoving};
   //! Sets mode of changing to \a theChangeMode
   void SetModeOfChanging(EChanging theChangeMode){
-    myChangeMode = theChangeMode; 
-    Modified();
+    if ( myChangeMode != theChangeMode ) { myChangeMode = theChangeMode; Modified(); }
   }
   //! Return \a myChangeMode field
-  EChanging GetModeOfChanging(){ return myChangeMode;}
+  EChanging GetModeOfChanging(){ return myChangeMode; }
 
   //! Add cell id to \a myCellIds std::set
   void RegisterCell(vtkIdType theCellId);
   //! Check if myCellIds is empty.
-  int IsCellsRegistered() { return !myCellIds.empty();}
+  int IsCellsRegistered() { return !myCellIds.empty(); }
   //! Remove the cell from the output
-  void ClearRegisteredCells() { 
-    myCellIds.clear();
-    Modified();
+  void ClearRegisteredCells() {
+    if ( !myCellIds.empty() ) { myCellIds.clear(); Modified(); }
   }
-  
+
   //! Add cell type to \a myCellTypes std::set
   void RegisterCellsWithType(vtkIdType theCellType);
   //! Check if myCellTypes is empty.
-  int IsCellsWithTypeRegistered() { return !myCellTypes.empty();}
+  int IsCellsWithTypeRegistered() { return !myCellTypes.empty(); }
   //! Remove every cells with the type from the output
-  void ClearRegisteredCellsWithType() { 
-    myCellTypes.clear();
-    Modified();
+  void ClearRegisteredCellsWithType() {
+    if ( !myCellTypes.empty() ) { myCellTypes.clear(); Modified(); }
   }
 
   //! \brief Do the filter do some real work
-  int IsChanging() { return IsCellsRegistered() || IsCellsWithTypeRegistered();}
+  int IsChanging() { return IsCellsRegistered() || IsCellsWithTypeRegistered(); }
 
   //! \brief Do it keep the mapping between input's and output's UnstructuredGrid
   void SetStoreMapping(int theStoreMapping);
   //! Get \a myStoreMapping
-  int GetStoreMapping(){ return myStoreMapping;}
+  int GetStoreMapping(){ return myStoreMapping; }
 
   //! Gets the input id by output id.
   vtkIdType GetInputId(int theOutId) const;
index 4ab9a2d9a4204bbabbb42ef8509c1f27119c1bef..c43d20347fe4043c2b7a44ae9fb949dd3dd782f4 100755 (executable)
@@ -108,6 +108,39 @@ VTKViewer_GeometryFilter
 ::~VTKViewer_GeometryFilter()
 {}
 
+/*!
+ * \brief Return true for only one volume including a given edge
+ *  \param [in] id1 - 1st edge end
+ *  \param [in] id2 - second edge end
+ *  \param [in] cellId - volume ID
+ *  \param [in] input - the grid
+ */
+static inline bool toShowEdge( vtkIdType id1, vtkIdType id2, vtkIdType cellId, vtkUnstructuredGrid* input )
+{
+  // return true if the given cell is the 1st among cells including the edge
+  vtkCellLinks * links = input->GetCellLinks();
+  if ( !links ) {
+    input->BuildLinks();
+    links = input->GetCellLinks();
+  }
+  if ( id1 < id2 )
+    std::swap( id1, id2 );
+  vtkIdType *cells = links->GetCells( id1 );
+
+  // among cells, look for a cell including the edge
+  vtkIdType *cellPts, npts, iCell = 0;
+  bool found = false;
+  while ( !found )
+  {
+    if ( cells[iCell] == cellId )
+      return true;
+    input->GetCellPoints( cells[iCell], npts, cellPts );
+    for ( vtkIdType i = 0; i < npts && !found; ++i )
+      found = ( cellPts[i] == id2 );
+    iCell += ( !found );
+  }
+  return ( cells[iCell] == cellId );
+}
 
 int
 VTKViewer_GeometryFilter
@@ -141,14 +174,12 @@ VTKViewer_GeometryFilter
   return 1;
 }
 
-
 int
 VTKViewer_GeometryFilter
 ::UnstructuredGridExecute(vtkDataSet *dataSetInput,
                           vtkPolyData *output,
                           vtkInformation *outInfo)
 {
-
   vtkUnstructuredGrid *input= (vtkUnstructuredGrid *)dataSetInput;
   vtkCellArray *Connectivity = input->GetCells();
   // Check input
@@ -182,7 +213,7 @@ VTKViewer_GeometryFilter
 
   char *cellVis;
   vtkIdType newCellId;
-  int faceId, *faceVerts, numFacePts;
+  int faceId, *faceVerts, *edgeVerts, numFacePts;
   double *x;
   vtkIdType PixelConvert[4];
   // Change the type from int to vtkIdType in order to avoid compilation errors while using VTK
@@ -277,13 +308,13 @@ VTKViewer_GeometryFilter
       cellVis[cellId] = 1;
       if ( ( this->CellClipping && cellId < this->CellMinimum ) ||
            cellId > this->CellMaximum )
-        {
+      {
         cellVis[cellId] = 0;
-        }
+      }
       else
-        {
+      {
         for (i=0; i < npts; i++)
-          {
+        {
           x = p->GetPoint(pts[i]);
           if ( ( ( ( this->PointClipping && (pts[i] < this->PointMinimum ) ) ||
                                              pts[i] > this->PointMaximum) ) ||
@@ -291,42 +322,44 @@ VTKViewer_GeometryFilter
                 ( x[0] < this->Extent[0] || x[0] > this->Extent[1] ||
                   x[1] < this->Extent[2] || x[1] > this->Extent[3] ||
                   x[2] < this->Extent[4] || x[2] > this->Extent[5] )) )
-            {
+          {
             cellVis[cellId] = 0;
             break;
-            }//point/extent clipping
-          }//for each point
-        }//if point clipping needs checking
-      }//for all cells
-    }//if not all visible
+          }//point/extent clipping
+        }//for each point
+      }//if point clipping needs checking
+    }//for all cells
+  }//if not all visible
+
+  if ( input->GetCellLinks() )
+    input->BuildLinks();
 
   // Loop over all cells now that visibility is known
   // (Have to compute visibility first for 3D cell boundaries)
   int progressInterval = numCells/20 + 1;
   TMapOfVectorId aDimension2VTK2ObjIds;
-  if(myStoreMapping){
-    myVTK2ObjIds.clear();
-    myVTK2ObjIds.reserve(numCells);
-  }
+  if ( myStoreMapping )
+    aDimension2VTK2ObjIds.resize( 3 ); // max dimension is 2
+
   for (cellId=0, Connectivity->InitTraversal();
        Connectivity->GetNextCell(npts,pts);
        cellId++)
-    {
+  {
     //Progress and abort method support
     if ( !(cellId % progressInterval) )
-      {
+    {
       vtkDebugMacro(<<"Process cell #" << cellId);
       this->UpdateProgress ((float)cellId/numCells);
-      }
+    }
 
     // Handle ghost cells here.  Another option was used cellVis array.
     if (cellGhostLevels && cellGhostLevels[cellId] > updateLevel)
-      { // Do not create surfaces in outer ghost cells.
+    { // Do not create surfaces in outer ghost cells.
       continue;
-      }
+    }
 
     if (allVisible || cellVis[cellId])  //now if visible extract geometry
-      {
+    {
       //special code for nonlinear cells - rarely occurs, so right now it
       //is slow.
       vtkIdType aCellType = input->GetCellType(cellId);
@@ -406,326 +439,431 @@ VTKViewer_GeometryFilter
 
           break;
         }
-        case VTK_TETRA: {
+        case VTK_TETRA:
+        {
+          if ( myShowInside )
+          {
+            aCellType = VTK_LINE;
+            for ( int edgeID = 0; edgeID < 6; ++edgeID )
+            {
+              edgeVerts = vtkTetra::GetEdgeArray( edgeID );
+              if ( toShowEdge( pts[edgeVerts[0]], pts[edgeVerts[1]], cellId, input ))
+              {
+                aNewPts[0] = pts[edgeVerts[0]];
+                aNewPts[1] = pts[edgeVerts[1]];
+                newCellId = output->InsertNextCell( aCellType, 2, aNewPts );
+                if(myStoreMapping)
+                  InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+                outputCD->CopyData(cd,cellId,newCellId);
+              }
+            }
+            break;
+          }
+          else
+          {
 #ifdef SHOW_COINCIDING_3D_PAL21924
-          faceIdsTmp->Reset();
-          for (int ai=0; ai<npts; ai++)
-            faceIdsTmp->InsertNextId(pts[ai]);
-          input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+            faceIdsTmp->SetNumberOfIds( npts );
+            for ( int ai = 0; ai < npts; ai++ )
+              faceIdsTmp->SetId( ai, pts[ai] );
+            input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
 #endif
-          for (faceId = 0; faceId < 4; faceId++)
-            {
-            faceIds->Reset();
-            faceVerts = vtkTetra::GetFaceArray(faceId);
-            faceIds->InsertNextId(pts[faceVerts[0]]);
-            faceIds->InsertNextId(pts[faceVerts[1]]);
-            faceIds->InsertNextId(pts[faceVerts[2]]);
             aCellType = VTK_TRIANGLE;
             numFacePts = 3;
-            input->GetCellNeighbors(cellId, faceIds, cellIds);
+            for (faceId = 0; faceId < 4; faceId++)
+            {
+              faceIds->Reset();
+              faceVerts = vtkTetra::GetFaceArray(faceId);
+              faceIds->InsertNextId(pts[faceVerts[0]]);
+              faceIds->InsertNextId(pts[faceVerts[1]]);
+              faceIds->InsertNextId(pts[faceVerts[2]]);
+              input->GetCellNeighbors(cellId, faceIds, cellIds);
+              int nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds();
 #ifdef SHOW_COINCIDING_3D_PAL21924
-            int nbNeighbors = 0;
-            for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
-              if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
-            }
-            bool process = nbNeighbors <= 0;
+              bool process = nbNeighbors <= 0;
 #else
-            bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+              bool process = nbNeighbors <= 0 || GetAppendCoincident3D();
 #endif
-            if ( process || myShowInside ||
-                 (!allVisible && !cellVis[cellIds->GetId(0)]) )
+              if ( process || ( !allVisible && !cellVis[cellIds->GetId(0)] ))
               {
-              for ( i=0; i < numFacePts; i++)
-                aNewPts[i] = pts[faceVerts[i]];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-              outputCD->CopyData(cd,cellId,newCellId);
+                for ( i=0; i < numFacePts; i++)
+                  aNewPts[i] = pts[faceVerts[i]];
+                newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+                if(myStoreMapping)
+                  InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+                outputCD->CopyData(cd,cellId,newCellId);
               }
             }
+          }
           break;
         }
-        case VTK_VOXEL: {
+        case VTK_VOXEL:
+        {
+          if ( myShowInside )
+          {
+            aCellType = VTK_LINE;
+            for ( int edgeID = 0; edgeID < 12; ++edgeID )
+            {
+              edgeVerts = vtkVoxel::GetEdgeArray( edgeID );
+              if ( toShowEdge( pts[edgeVerts[0]], pts[edgeVerts[1]], cellId, input ))
+              {
+                aNewPts[0] = pts[edgeVerts[0]];
+                aNewPts[1] = pts[edgeVerts[1]];
+                newCellId = output->InsertNextCell( aCellType, 2, aNewPts );
+                if(myStoreMapping)
+                  InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+                outputCD->CopyData(cd,cellId,newCellId);
+              }
+            }
+            break;
+          }
+          else
+          {
 #ifdef SHOW_COINCIDING_3D_PAL21924
-          faceIdsTmp->Reset();
-          for (int ai=0; ai<npts; ai++)
-            faceIdsTmp->InsertNextId(pts[ai]);
-          input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+            faceIdsTmp->SetNumberOfIds( npts );
+            for ( int ai = 0; ai < npts; ai++ )
+              faceIdsTmp->SetId( ai, pts[ai] );
+            input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
 #endif
-          for (faceId = 0; faceId < 6; faceId++)
+            for (faceId = 0; faceId < 6; faceId++)
             {
-            faceIds->Reset();
-            faceVerts = vtkVoxel::GetFaceArray(faceId);
-            faceIds->InsertNextId(pts[faceVerts[0]]);
-            faceIds->InsertNextId(pts[faceVerts[1]]);
-            faceIds->InsertNextId(pts[faceVerts[2]]);
-            faceIds->InsertNextId(pts[faceVerts[3]]);
-            aCellType = VTK_QUAD;
-            numFacePts = 4;
-            input->GetCellNeighbors(cellId, faceIds, cellIds);
+              faceIds->Reset();
+              faceVerts = vtkVoxel::GetFaceArray(faceId);
+              faceIds->InsertNextId(pts[faceVerts[0]]);
+              faceIds->InsertNextId(pts[faceVerts[1]]);
+              faceIds->InsertNextId(pts[faceVerts[2]]);
+              faceIds->InsertNextId(pts[faceVerts[3]]);
+              aCellType = VTK_QUAD;
+              numFacePts = 4;
+              input->GetCellNeighbors(cellId, faceIds, cellIds);
+              int nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds();
 #ifdef SHOW_COINCIDING_3D_PAL21924
-            int nbNeighbors = 0;
-            for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
-              if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
-            }
-            bool process = nbNeighbors <= 0;
+              bool process = nbNeighbors <= 0;
 #else
-            bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+              bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
 #endif
-            if ( process || myShowInside ||
-                 (!allVisible && !cellVis[cellIds->GetId(0)]) )
+              if ( process || ( !allVisible && !cellVis[cellIds->GetId(0)] ))
               {
-              for ( i=0; i < numFacePts; i++)
-                aNewPts[i] = pts[faceVerts[PixelConvert[i]]];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-              outputCD->CopyData(cd,cellId,newCellId);
+                for ( i=0; i < numFacePts; i++)
+                  aNewPts[i] = pts[faceVerts[PixelConvert[i]]];
+                newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+                if(myStoreMapping)
+                  InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+                outputCD->CopyData(cd,cellId,newCellId);
               }
             }
+          }
           break;
         }
-        case VTK_HEXAHEDRON: {
+        case VTK_HEXAHEDRON:
+        {
+          if ( myShowInside )
+          {
+            aCellType = VTK_LINE;
+            for ( int edgeID = 0; edgeID < 12; ++edgeID )
+            {
+              edgeVerts = vtkHexahedron::GetEdgeArray( edgeID );
+              if ( toShowEdge( pts[edgeVerts[0]], pts[edgeVerts[1]], cellId, input ))
+              {
+                aNewPts[0] = pts[edgeVerts[0]];
+                aNewPts[1] = pts[edgeVerts[1]];
+                newCellId = output->InsertNextCell( aCellType, 2, aNewPts );
+                if(myStoreMapping)
+                  InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+                outputCD->CopyData(cd,cellId,newCellId);
+              }
+            }
+            break;
+          }
+          else
+          {
 #ifdef SHOW_COINCIDING_3D_PAL21924
-          faceIdsTmp->Reset();
-          for (int ai=0; ai<npts; ai++)
-            faceIdsTmp->InsertNextId(pts[ai]);
-          input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+            faceIdsTmp->SetNumberOfIds( npts );
+            for ( int ai = 0; ai < npts; ai++ )
+              faceIdsTmp->SetId( ai, pts[ai] );
+            input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
 #endif
-          for (faceId = 0; faceId < 6; faceId++)
-            {
-            faceIds->Reset();
-            faceVerts = vtkHexahedron::GetFaceArray(faceId);
-            faceIds->InsertNextId(pts[faceVerts[0]]);
-            faceIds->InsertNextId(pts[faceVerts[1]]);
-            faceIds->InsertNextId(pts[faceVerts[2]]);
-            faceIds->InsertNextId(pts[faceVerts[3]]);
             aCellType = VTK_QUAD;
             numFacePts = 4;
-            input->GetCellNeighbors(cellId, faceIds, cellIds);
+            for (faceId = 0; faceId < 6; faceId++)
+            {
+              faceIds->Reset();
+              faceVerts = vtkHexahedron::GetFaceArray(faceId);
+              faceIds->InsertNextId(pts[faceVerts[0]]);
+              faceIds->InsertNextId(pts[faceVerts[1]]);
+              faceIds->InsertNextId(pts[faceVerts[2]]);
+              faceIds->InsertNextId(pts[faceVerts[3]]);
+              input->GetCellNeighbors(cellId, faceIds, cellIds);
+              int nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds();
 #ifdef SHOW_COINCIDING_3D_PAL21924
-            int nbNeighbors = 0;
-            for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
-              if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
-            }
-            bool process = nbNeighbors <= 0;
+              bool process = nbNeighbors <= 0;
 #else
-            bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+              bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
 #endif
-            if ( process || myShowInside ||
-                 (!allVisible && !cellVis[cellIds->GetId(0)]) )
+              if ( process || (!allVisible && !cellVis[cellIds->GetId(0)]) )
               {
-              for ( i=0; i < numFacePts; i++)
-                aNewPts[i] = pts[faceVerts[i]];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-              outputCD->CopyData(cd,cellId,newCellId);
+                for ( i=0; i < numFacePts; i++)
+                  aNewPts[i] = pts[faceVerts[i]];
+                newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+                if(myStoreMapping)
+                  InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+                outputCD->CopyData(cd,cellId,newCellId);
               }
             }
+          }
           break;
         }
-        case VTK_WEDGE: {
+        case VTK_WEDGE:
+        {
+          if ( myShowInside )
+          {
+            aCellType = VTK_LINE;
+            for ( int edgeID = 0; edgeID < 9; ++edgeID )
+            {
+              edgeVerts = vtkWedge::GetEdgeArray( edgeID );
+              if ( toShowEdge( pts[edgeVerts[0]], pts[edgeVerts[1]], cellId, input ))
+              {
+                aNewPts[0] = pts[edgeVerts[0]];
+                aNewPts[1] = pts[edgeVerts[1]];
+                newCellId = output->InsertNextCell( aCellType, 2, aNewPts );
+                if(myStoreMapping)
+                  InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+                outputCD->CopyData(cd,cellId,newCellId);
+              }
+            }
+            break;
+          }
+          else
+          {
 #ifdef SHOW_COINCIDING_3D_PAL21924
-          faceIdsTmp->Reset();
-          for (int ai=0; ai<npts; ai++)
-            faceIdsTmp->InsertNextId(pts[ai]);
-          input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+            faceIdsTmp->SetNumberOfIds( npts );
+            for ( int ai = 0; ai < npts; ai++ )
+              faceIdsTmp->SetId( ai, pts[ai] );
+            input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
 #endif
-          for (faceId = 0; faceId < 5; faceId++)
+            for (faceId = 0; faceId < 5; faceId++)
             {
-            faceIds->Reset();
-            faceVerts = vtkWedge::GetFaceArray(faceId);
-            faceIds->InsertNextId(pts[faceVerts[0]]);
-            faceIds->InsertNextId(pts[faceVerts[1]]);
-            faceIds->InsertNextId(pts[faceVerts[2]]);
-            aCellType = VTK_TRIANGLE;
-            numFacePts = 3;
-            if (faceVerts[3] >= 0)
+              faceIds->Reset();
+              faceVerts = vtkWedge::GetFaceArray(faceId);
+              faceIds->InsertNextId(pts[faceVerts[0]]);
+              faceIds->InsertNextId(pts[faceVerts[1]]);
+              faceIds->InsertNextId(pts[faceVerts[2]]);
+              aCellType = VTK_TRIANGLE;
+              numFacePts = 3;
+              if (faceVerts[3] >= 0)
               {
-              faceIds->InsertNextId(pts[faceVerts[3]]);
-              aCellType = VTK_QUAD;
-              numFacePts = 4;
+                faceIds->InsertNextId(pts[faceVerts[3]]);
+                aCellType = VTK_QUAD;
+                numFacePts = 4;
               }
-
-            input->GetCellNeighbors(cellId, faceIds, cellIds);
+              input->GetCellNeighbors(cellId, faceIds, cellIds);
+              int nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds();
 #ifdef SHOW_COINCIDING_3D_PAL21924
-            int nbNeighbors = 0;
-            for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
-              if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
-            }
-            bool process = nbNeighbors <= 0;
+              bool process = nbNeighbors <= 0;
 #else
-            bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+              bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
 #endif
-            if ( process || myShowInside ||
-                 (!allVisible && !cellVis[cellIds->GetId(0)]) )
+              if ( process || ( !allVisible && !cellVis[cellIds->GetId(0)] ))
               {
-              for ( i=0; i < numFacePts; i++)
-                aNewPts[i] = pts[faceVerts[i]];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-              outputCD->CopyData(cd,cellId,newCellId);
+                for ( i=0; i < numFacePts; i++)
+                  aNewPts[i] = pts[faceVerts[i]];
+                newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+                if(myStoreMapping)
+                  InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+                outputCD->CopyData(cd,cellId,newCellId);
               }
             }
+          }
           break;
         }
-        case VTK_HEXAGONAL_PRISM: {
-#ifdef SHOW_COINCIDING_3D_PAL21924
-          faceIdsTmp->Reset();
-          for (int ai=0; ai<npts; ai++)
-            faceIdsTmp->InsertNextId(pts[ai]);
-          input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
-#endif
-          for (faceId = 0; faceId < 8; faceId++)
+        case VTK_HEXAGONAL_PRISM:
+        {
+          if ( myShowInside )
           {
-            faceVerts = vtkHexagonalPrism::GetFaceArray(faceId);
-            faceIds->Reset();
-            faceIds->InsertNextId(pts[faceVerts[0]]);
-            faceIds->InsertNextId(pts[faceVerts[1]]);
-            faceIds->InsertNextId(pts[faceVerts[2]]);
-            faceIds->InsertNextId(pts[faceVerts[3]]);
-            aCellType = VTK_QUAD;
-            numFacePts = 4;
-            if (faceVerts[5] >= 0)
+            aCellType = VTK_LINE;
+            for ( int edgeID = 0; edgeID < 18; ++edgeID )
             {
-              faceIds->InsertNextId(pts[faceVerts[4]]);
-              faceIds->InsertNextId(pts[faceVerts[5]]);
-              aCellType = VTK_POLYGON;
-              numFacePts = 6;
+              edgeVerts = vtkHexagonalPrism::GetEdgeArray( edgeID );
+              if ( toShowEdge( pts[edgeVerts[0]], pts[edgeVerts[1]], cellId, input ))
+              {
+                aNewPts[0] = pts[edgeVerts[0]];
+                aNewPts[1] = pts[edgeVerts[1]];
+                newCellId = output->InsertNextCell( aCellType, 2, aNewPts );
+                if(myStoreMapping)
+                  InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+                outputCD->CopyData(cd,cellId,newCellId);
+              }
             }
-            input->GetCellNeighbors(cellId, faceIds, cellIds);
+            break;
+          }
+          else
+          {
 #ifdef SHOW_COINCIDING_3D_PAL21924
-            int nbNeighbors = 0;
-            for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
-              if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
-            }
-            bool process = nbNeighbors <= 0;
-#else
-            bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+            faceIdsTmp->SetNumberOfIds( npts );
+            for ( int ai = 0; ai < npts; ai++ )
+              faceIdsTmp->SetId( ai, pts[ai] );
+            input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
 #endif
-            if ( process || myShowInside ||
-                 (!allVisible && !cellVis[cellIds->GetId(0)]) )
+            for (faceId = 0; faceId < 8; faceId++)
             {
-              for ( i=0; i < numFacePts; i++)
-                aNewPts[i] = pts[faceVerts[i]];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-              outputCD->CopyData(cd,cellId,newCellId);
-            }
+              faceVerts = vtkHexagonalPrism::GetFaceArray(faceId);
+              faceIds->Reset();
+              faceIds->InsertNextId(pts[faceVerts[0]]);
+              faceIds->InsertNextId(pts[faceVerts[1]]);
+              faceIds->InsertNextId(pts[faceVerts[2]]);
+              faceIds->InsertNextId(pts[faceVerts[3]]);
+              aCellType = VTK_QUAD;
+              numFacePts = 4;
+              if (faceVerts[5] >= 0)
+              {
+                faceIds->InsertNextId(pts[faceVerts[4]]);
+                faceIds->InsertNextId(pts[faceVerts[5]]);
+                aCellType = VTK_POLYGON;
+                numFacePts = 6;
+              }
+              input->GetCellNeighbors(cellId, faceIds, cellIds);
+              int nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds();
+#ifdef SHOW_COINCIDING_3D_PAL21924
+              bool process = nbNeighbors <= 0;
+#else
+              bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+#endif
+              if ( process || ( !allVisible && !cellVis[cellIds->GetId(0)] ))
+              {
+                for ( i=0; i < numFacePts; i++)
+                  aNewPts[i] = pts[faceVerts[i]];
+                newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+                if(myStoreMapping)
+                  InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+                outputCD->CopyData(cd,cellId,newCellId);
+              }
             }
+          }
           break;
         }
-        case VTK_PYRAMID: {
+        case VTK_PYRAMID:
+        {
+          if ( myShowInside )
+          {
+            aCellType = VTK_LINE;
+            for ( int edgeID = 0; edgeID < 8; ++edgeID )
+            {
+              edgeVerts = vtkPyramid::GetEdgeArray( edgeID );
+              if ( toShowEdge( pts[edgeVerts[0]], pts[edgeVerts[1]], cellId, input ))
+              {
+                aNewPts[0] = pts[edgeVerts[0]];
+                aNewPts[1] = pts[edgeVerts[1]];
+                newCellId = output->InsertNextCell( aCellType, 2, aNewPts );
+                if(myStoreMapping)
+                  InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+                outputCD->CopyData(cd,cellId,newCellId);
+              }
+            }
+            break;
+          }
+          else
+          {
 #ifdef SHOW_COINCIDING_3D_PAL21924
-          faceIdsTmp->Reset();
-          for (int ai=0; ai<npts; ai++)
-            faceIdsTmp->InsertNextId(pts[ai]);
-          input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+            faceIdsTmp->SetNumberOfIds( npts );
+            for ( int ai = 0; ai < npts; ai++ )
+              faceIdsTmp->SetId( ai, pts[ai] );
+            input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
 #endif
-          for (faceId = 0; faceId < 5; faceId++)
+            for (faceId = 0; faceId < 5; faceId++)
             {
-            faceIds->Reset();
-            faceVerts = vtkPyramid::GetFaceArray(faceId);
-            faceIds->InsertNextId(pts[faceVerts[0]]);
-            faceIds->InsertNextId(pts[faceVerts[1]]);
-            faceIds->InsertNextId(pts[faceVerts[2]]);
-            aCellType = VTK_TRIANGLE;
-            numFacePts = 3;
-            if (faceVerts[3] >= 0)
+              faceIds->Reset();
+              faceVerts = vtkPyramid::GetFaceArray(faceId);
+              faceIds->InsertNextId(pts[faceVerts[0]]);
+              faceIds->InsertNextId(pts[faceVerts[1]]);
+              faceIds->InsertNextId(pts[faceVerts[2]]);
+              aCellType = VTK_TRIANGLE;
+              numFacePts = 3;
+              if (faceVerts[3] >= 0)
               {
-              faceIds->InsertNextId(pts[faceVerts[3]]);
-              aCellType = VTK_QUAD;
-              numFacePts = 4;
+                faceIds->InsertNextId(pts[faceVerts[3]]);
+                aCellType = VTK_QUAD;
+                numFacePts = 4;
               }
-            input->GetCellNeighbors(cellId, faceIds, cellIds);
+              input->GetCellNeighbors(cellId, faceIds, cellIds);
+              int nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds();
 #ifdef SHOW_COINCIDING_3D_PAL21924
-            int nbNeighbors = 0;
-            for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
-              if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
-            }
-            bool process = nbNeighbors <= 0;
+              bool process = nbNeighbors <= 0;
 #else
-            bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+              bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
 #endif
-            if ( process || myShowInside ||
-                 (!allVisible && !cellVis[cellIds->GetId(0)]) )
+              if ( process || ( !allVisible && !cellVis[cellIds->GetId(0)] ))
               {
-              for ( i=0; i < numFacePts; i++)
-                aNewPts[i] = pts[faceVerts[i]];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-              outputCD->CopyData(cd,cellId,newCellId);
+                for ( i=0; i < numFacePts; i++)
+                  aNewPts[i] = pts[faceVerts[i]];
+                newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+                if(myStoreMapping)
+                  InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+                outputCD->CopyData(cd,cellId,newCellId);
               }
             }
+          }
           break;
         }
 
 #if VTK_XVERSION > 50700
         case VTK_POLYHEDRON:
-          {
-            //MESSAGE("VTK_POLYHEDRON geometry filter");
-            vtkIdType nFaces = 0;
-            vtkIdType* ptIds = 0;
-            int idp = 0;
-            input->GetFaceStream(cellId, nFaces, ptIds);
+        {
+          vtkIdType nFaces = 0;
+          vtkIdType* ptIds = 0;
+          int idp = 0;
+          input->GetFaceStream(cellId, nFaces, ptIds);
 #ifdef SHOW_COINCIDING_3D_PAL21924
-            faceIdsTmp->Reset();
-            for (int ai=0; ai<npts; ai++)
-              faceIdsTmp->InsertNextId(pts[ai]);
+          if ( !myShowInside )
+          {
+            faceIdsTmp->Reset(); // use 2 facets
+            numFacePts = ptIds[idp];
+            for (i = 0; i < numFacePts; i++)
+              faceIdsTmp->InsertNextId(ptIds[idp + i]);
+            idp += numFacePts+1;
+            numFacePts = ptIds[idp];
+            for (i = 0; i < numFacePts; i++)
+              faceIdsTmp->InsertNextId(ptIds[idp + i]);
             input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+            idp = 0;
+          }
 #endif
-            for (faceId = 0; faceId < nFaces; faceId++)
-              {
-                faceIds->Reset();
-                numFacePts = ptIds[idp];
-                //MESSAGE("numFacePts="<< numFacePts);
-                int pt0 = ++idp;
-                for (i = 0; i < numFacePts; i++)
-                  {
-                    //MESSAGE("ptIds[" << idp + i << "]=" << ptIds[idp + i]);
-                    faceIds->InsertNextId(ptIds[idp + i]);
-                  }
-                idp += numFacePts;
-                switch (numFacePts)
-                  {
-                  case 3:
-                    aCellType = VTK_TRIANGLE;
-                    break;
-                  case 4:
-                    aCellType = VTK_QUAD;
-                    break;
-                  default:
-                    aCellType = VTK_POLYGON;
-                    break;
-                  }
-                // TODO understand and fix display of several polyhedrons                
-                input->GetCellNeighbors(cellId, faceIds, cellIds);
+          for (faceId = 0; faceId < nFaces; faceId++)
+          {
+            faceIds->Reset();
+            numFacePts = ptIds[idp];
+            int pt0 = ++idp;
+            for (i = 0; i < numFacePts; i++)
+            {
+              faceIds->InsertNextId(ptIds[idp + i]);
+            }
+            idp += numFacePts;
+            switch (numFacePts)
+            {
+            case 3: aCellType = VTK_TRIANGLE; break;
+            case 4: aCellType = VTK_QUAD;     break;
+            default:aCellType = VTK_POLYGON;
+            }
+            input->GetCellNeighbors(cellId, faceIds, cellIds);
+            int nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds();
+            if ( myShowInside && nbNeighbors > 0 && cellId < cellIds->GetId(0) )
+              continue; // don't add twice same internal face in wireframe mode
 #ifdef SHOW_COINCIDING_3D_PAL21924
-                int nbNeighbors = 0;
-                for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
-                  if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
-                }
-                bool process = nbNeighbors <= 0;
+            bool process = nbNeighbors <= 0;
 #else
-                bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+            bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
 #endif
-                if (process || myShowInside
-                    || (!allVisible && !cellVis[cellIds->GetId(0)]))
-                  {
-                    for (i = 0; i < numFacePts; i++)
-                      aNewPts[i] = ptIds[pt0 + i];
-                    newCellId = output->InsertNextCell(aCellType, numFacePts, aNewPts);
-                    if (myStoreMapping)
-                      InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-                    outputCD->CopyData(cd, cellId, newCellId);
-                  }
-              }
-            break;
+            if (process || myShowInside
+                || (!allVisible && !cellVis[cellIds->GetId(0)]))
+            {
+              for (i = 0; i < numFacePts; i++)
+                aNewPts[i] = ptIds[pt0 + i];
+              newCellId = output->InsertNextCell(aCellType, numFacePts, aNewPts);
+              if (myStoreMapping)
+                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+              outputCD->CopyData(cd, cellId, newCellId);
+            }
           }
+          break;
+        }
 #endif
         //Quadratic cells
         case VTK_QUADRATIC_EDGE:
@@ -739,7 +877,9 @@ VTKViewer_GeometryFilter
         case VTK_TRIQUADRATIC_HEXAHEDRON:
         case VTK_QUADRATIC_WEDGE:
         case VTK_QUADRATIC_PYRAMID:
-          if(!myIsWireframeMode) {
+
+          if(!myIsWireframeMode)
+          {
             input->GetCell(cellId,cell);
             vtkIdList *lpts = vtkIdList::New();
             vtkPoints *coords = vtkPoints::New();
@@ -811,17 +951,15 @@ VTKViewer_GeometryFilter
 #endif
               aCellType = VTK_TRIANGLE;
               numFacePts = 3;
-              for (int j=0; j < cell->GetNumberOfFaces(); j++){
+              for (int j=0; j < cell->GetNumberOfFaces(); j++)
+              {
                 vtkCell *face = cell->GetFace(j);
                 input->GetCellNeighbors(cellId, face->PointIds, cellIds);
+                int nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds();
 #ifdef SHOW_COINCIDING_3D_PAL21924
-                int nbNeighbors = 0;
-                for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
-                  if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
-                }
                 bool process = nbNeighbors <= 0;
 #else
-                bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+                bool process = nbNeighbors <= 0 || GetAppendCoincident3D();
 #endif
                 if ( process || myShowInside ) {
                   face->Triangulate(0,lpts,coords);
@@ -841,9 +979,11 @@ VTKViewer_GeometryFilter
             coords->Delete();
             lpts->Delete();
             break;
-          } else { // wireframe
+          }
+          else { // wireframe
             switch(aCellType) {
-            case VTK_QUADRATIC_EDGE: {
+            case VTK_QUADRATIC_EDGE:
+            {
               vtkIdType arcResult =-1;
               if(myIsBuildArc) {
                arcResult = Build1DArc(cellId, input, output, pts,myMaxArcAngle);
@@ -867,7 +1007,8 @@ VTKViewer_GeometryFilter
               break;
             }
             case VTK_QUADRATIC_TRIANGLE:
-            case VTK_BIQUADRATIC_TRIANGLE: {
+            case VTK_BIQUADRATIC_TRIANGLE:
+            {
               if(!myIsBuildArc) {
                 aCellType = VTK_POLYGON;
                 numFacePts = 6;
@@ -890,7 +1031,8 @@ VTKViewer_GeometryFilter
               break;
             }
             case VTK_QUADRATIC_QUAD:
-            case VTK_BIQUADRATIC_QUAD: {
+            case VTK_BIQUADRATIC_QUAD:
+            {
               if(!myIsBuildArc) {
                 aCellType = VTK_POLYGON;
                 numFacePts = 8;
@@ -914,7 +1056,8 @@ VTKViewer_GeometryFilter
                 BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds);
               break;
             }
-            case VTK_QUADRATIC_POLYGON: {
+            case VTK_QUADRATIC_POLYGON:
+            {
               if(!myIsBuildArc)
               {
                 aCellType = VTK_POLYGON;
@@ -934,332 +1077,78 @@ VTKViewer_GeometryFilter
                 BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds);
               break;
             }
-            case VTK_QUADRATIC_TETRA: {
-              aCellType = VTK_POLYGON;
-              numFacePts = 6;
-
-              //---------------------------------------------------------------
-              aNewPts[0] = pts[0];
-              aNewPts[1] = pts[4];
-              aNewPts[2] = pts[1];
-              aNewPts[3] = pts[5];
-              aNewPts[4] = pts[2];
-              aNewPts[5] = pts[6];
-
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              //---------------------------------------------------------------
-              aNewPts[0] = pts[0];
-              aNewPts[1] = pts[7];
-              aNewPts[2] = pts[3];
-              aNewPts[3] = pts[8];
-              aNewPts[4] = pts[1];
-              aNewPts[5] = pts[4];
-
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              //---------------------------------------------------------------
-              aNewPts[0] = pts[1];
-              aNewPts[1] = pts[8];
-              aNewPts[2] = pts[3];
-              aNewPts[3] = pts[9];
-              aNewPts[4] = pts[2];
-              aNewPts[5] = pts[5];
-
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              //---------------------------------------------------------------
-              aNewPts[0] = pts[2];
-              aNewPts[1] = pts[9];
-              aNewPts[2] = pts[3];
-              aNewPts[3] = pts[7];
-              aNewPts[4] = pts[0];
-              aNewPts[5] = pts[6];
-
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              break;
-            }
-            case VTK_QUADRATIC_WEDGE: {
-              aCellType = VTK_POLYGON;
-              numFacePts = 6;
-              //---------------------------------------------------------------
-              //Face 1
-              aNewPts[0] = pts[0];
-              aNewPts[1] = pts[6];
-              aNewPts[2] = pts[1];
-              aNewPts[3] = pts[7];
-              aNewPts[4] = pts[2];
-              aNewPts[5] = pts[8];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              //---------------------------------------------------------------
-              //Face 2
-              aNewPts[0] = pts[3];
-              aNewPts[1] = pts[9];
-              aNewPts[2] = pts[4];
-              aNewPts[3] = pts[10];
-              aNewPts[4] = pts[5];
-              aNewPts[5] = pts[11];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              //---------------------------------------------------------------
-              //Face 3
-              numFacePts = 8;
-              aNewPts[0] = pts[0];
-              aNewPts[1] = pts[8];
-              aNewPts[2] = pts[2];
-              aNewPts[3] = pts[14];
-              aNewPts[4] = pts[5];
-              aNewPts[5] = pts[11];
-              aNewPts[6] = pts[3];
-              aNewPts[7] = pts[12];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              //---------------------------------------------------------------
-              //Face 4
-              aNewPts[0] = pts[1];
-              aNewPts[1] = pts[13];
-              aNewPts[2] = pts[4];
-              aNewPts[3] = pts[10];
-              aNewPts[4] = pts[5];
-              aNewPts[5] = pts[14];
-              aNewPts[6] = pts[2];
-              aNewPts[7] = pts[7];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              //---------------------------------------------------------------
-              //Face 5
-              aNewPts[0] = pts[0];
-              aNewPts[1] = pts[12];
-              aNewPts[2] = pts[3];
-              aNewPts[3] = pts[9];
-              aNewPts[4] = pts[4];
-              aNewPts[5] = pts[13];
-              aNewPts[6] = pts[1];
-              aNewPts[7] = pts[6];
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-              outputCD->CopyData(cd,cellId,newCellId);
-              break;
-            }
+            case VTK_QUADRATIC_TETRA:
+            case VTK_QUADRATIC_WEDGE:
             case VTK_TRIQUADRATIC_HEXAHEDRON:
-            case VTK_QUADRATIC_HEXAHEDRON: {
-              aCellType = VTK_POLYGON;
-              numFacePts = 8;
-
-              //---------------------------------------------------------------
-              aNewPts[0] = pts[0];
-              aNewPts[1] = pts[8];
-              aNewPts[2] = pts[1];
-              aNewPts[3] = pts[17];
-              aNewPts[4] = pts[5];
-              aNewPts[5] = pts[12];
-              aNewPts[6] = pts[4];
-              aNewPts[7] = pts[16];
-
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              //---------------------------------------------------------------
-              aNewPts[0] = pts[1];
-              aNewPts[1] = pts[9];
-              aNewPts[2] = pts[2];
-              aNewPts[3] = pts[18];
-              aNewPts[4] = pts[6];
-              aNewPts[5] = pts[13];
-              aNewPts[6] = pts[5];
-              aNewPts[7] = pts[17];
-
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              //---------------------------------------------------------------
-              aNewPts[0] = pts[2];
-              aNewPts[1] = pts[10];
-              aNewPts[2] = pts[3];
-              aNewPts[3] = pts[19];
-              aNewPts[4] = pts[7];
-              aNewPts[5] = pts[14];
-              aNewPts[6] = pts[6];
-              aNewPts[7] = pts[18];
-
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              //---------------------------------------------------------------
-              aNewPts[0] = pts[3];
-              aNewPts[1] = pts[11];
-              aNewPts[2] = pts[0];
-              aNewPts[3] = pts[16];
-              aNewPts[4] = pts[4];
-              aNewPts[5] = pts[15];
-              aNewPts[6] = pts[7];
-              aNewPts[7] = pts[19];
-
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              //---------------------------------------------------------------
-              aNewPts[0] = pts[0];
-              aNewPts[1] = pts[8];
-              aNewPts[2] = pts[1];
-              aNewPts[3] = pts[9];
-              aNewPts[4] = pts[2];
-              aNewPts[5] = pts[10];
-              aNewPts[6] = pts[3];
-              aNewPts[7] = pts[11];
-
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              //---------------------------------------------------------------
-              aNewPts[0] = pts[4];
-              aNewPts[1] = pts[12];
-              aNewPts[2] = pts[5];
-              aNewPts[3] = pts[13];
-              aNewPts[4] = pts[6];
-              aNewPts[5] = pts[14];
-              aNewPts[6] = pts[7];
-              aNewPts[7] = pts[15];
-
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              break;
-            }
-            case VTK_QUADRATIC_PYRAMID: {
-              aCellType = VTK_POLYGON;
-              numFacePts = 6;
-
-              //---------------------------------------------------------------
-              aNewPts[0] = pts[0];
-              aNewPts[1] = pts[8];
-              aNewPts[2] = pts[3];
-              aNewPts[3] = pts[12];
-              aNewPts[4] = pts[4];
-              aNewPts[5] = pts[9];
-
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              //---------------------------------------------------------------
-              aNewPts[0] = pts[0];
-              aNewPts[1] = pts[9];
-              aNewPts[2] = pts[4];
-              aNewPts[3] = pts[10];
-              aNewPts[4] = pts[1];
-              aNewPts[5] = pts[5];
-
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              //---------------------------------------------------------------
-              aNewPts[0] = pts[1];
-              aNewPts[1] = pts[10];
-              aNewPts[2] = pts[4];
-              aNewPts[3] = pts[11];
-              aNewPts[4] = pts[2];
-              aNewPts[5] = pts[6];
-
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              //---------------------------------------------------------------
-              aNewPts[0] = pts[2];
-              aNewPts[1] = pts[11];
-              aNewPts[2] = pts[4];
-              aNewPts[3] = pts[12];
-              aNewPts[4] = pts[3];
-              aNewPts[5] = pts[7];
-
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
-              outputCD->CopyData(cd,cellId,newCellId);
-
-              //---------------------------------------------------------------
-              numFacePts = 8;
-              aNewPts[0] = pts[0];
-              aNewPts[1] = pts[5];
-              aNewPts[2] = pts[1];
-              aNewPts[3] = pts[6];
-              aNewPts[4] = pts[2];
-              aNewPts[5] = pts[7];
-              aNewPts[6] = pts[3];
-              aNewPts[7] = pts[8];
-
-              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
-              if(myStoreMapping)
-                InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
-
-              outputCD->CopyData(cd,cellId,newCellId);
-
+            case VTK_QUADRATIC_HEXAHEDRON:
+            case VTK_QUADRATIC_PYRAMID:
+            {
+              aCellType = VTK_POLY_LINE;
+              input->GetCell(cellId,cell);
+              if ( myShowInside )
+              {
+                int nbEdges = cell->GetNumberOfEdges();
+                for ( int edgeId = 0; edgeId < nbEdges; ++edgeId )
+                {
+                  vtkCell * edge = cell->GetEdge( edgeId );
+                  if ( toShowEdge( edge->GetPointId(0), edge->GetPointId(2), cellId, input ))
+                  {
+                    aNewPts[0] = edge->GetPointId(0);
+                    aNewPts[1] = edge->GetPointId(2);
+                    aNewPts[2] = edge->GetPointId(1);
+                    newCellId = output->InsertNextCell( aCellType, 3, aNewPts );
+                    if(myStoreMapping)
+                      InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+                    outputCD->CopyData(cd,cellId,newCellId);
+                  }
+                }
+              }
+              else
+              {
+#ifdef SHOW_COINCIDING_3D_PAL21924
+                int nbPnt = npts - cell->GetNumberOfEdges();
+                faceIdsTmp->SetNumberOfIds( nbPnt );
+                for ( int ai = 0; ai < nbPnt; ai++ )
+                  faceIdsTmp->SetId( ai, pts[ai] );
+                input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+#endif
+                int nbFaces = cell->GetNumberOfFaces();
+                for ( faceId = 0; faceId < nbFaces; faceId++ )
+                {
+                  vtkCell * face = cell->GetFace( faceId );
+                  input->GetCellNeighbors( cellId, face->GetPointIds(), cellIds );
+                  int nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds();
+                  if ( nbNeighbors <= 0 )
+                  {
+                    int nbEdges = face->GetNumberOfPoints() / 2;
+                    for ( int edgeId = 0; edgeId < nbEdges; ++edgeId )
+                    {
+                      vtkIdType p1 = ( edgeId );
+                      vtkIdType p2 = ( edgeId + nbEdges );
+                      vtkIdType p3 = ( edgeId + 1 ) % nbEdges;
+                      if ( toShowEdge( face->GetPointId(p1), face->GetPointId(p2), cellId, input ))
+                      {
+                        aNewPts[0] = face->GetPointId( p1 );
+                        aNewPts[1] = face->GetPointId( p2 );
+                        aNewPts[2] = face->GetPointId( p3 );
+                        newCellId = output->InsertNextCell( aCellType, 3, aNewPts );
+                        if(myStoreMapping)
+                          InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+                        outputCD->CopyData(cd,cellId,newCellId);
+                      }
+                    }
+                  }
+                }
+              }
               break;
-            } // case VTK_QUADRATIC_PYRAMID:
-            } // switch by type
+            } // case of volumes in wireframe
+            } // switch by quadratic type
           } // end WIREFRAME
           break;
-        } //switch
-      } //if visible
-    } //for all cells
+        } //switch by type
+
+    } //if visible
+  } //for all cells
 
   output->Squeeze();
 
@@ -1278,24 +1167,30 @@ VTKViewer_GeometryFilter
     delete [] cellVis;
   }
 
-  // to sort myVTK2ObjIds vector by cell dimension (ascending)
+  if ( input->GetCellLinks() )
+  {
+    input->GetCellLinks()->Initialize(); // free memory
+  }
+
+  // fill myVTK2ObjIds vector in ascending cell dimension order
+  myVTK2ObjIds.clear();
   if( myStoreMapping && !aDimension2VTK2ObjIds.empty() )
   {
-    myVTK2ObjIds.clear();
-    for( vtkIdType aDimension = 0; aDimension <= 2; aDimension++ )
-    {
-      TMapOfVectorId::const_iterator anIter = aDimension2VTK2ObjIds.find( aDimension );
-      if( anIter != aDimension2VTK2ObjIds.end() )
+    size_t nbCells = ( aDimension2VTK2ObjIds[0].size() +
+                       aDimension2VTK2ObjIds[1].size() +
+                       aDimension2VTK2ObjIds[2].size() );
+    if ( myVTK2ObjIds.capacity() > nbCells )
+      TVectorId().swap( myVTK2ObjIds );
+    myVTK2ObjIds.reserve( nbCells );
+
+    for( int aDimension = 0; aDimension <= 2; aDimension++ )
+      if ( !aDimension2VTK2ObjIds[ aDimension ].empty() )
       {
-        const TVectorId& aCellIds = anIter->second;
-        TVectorId::const_iterator anIdIter, anIdIterEnd = aCellIds.end();
-        for( anIdIter = aCellIds.begin(); anIdIter != anIdIterEnd; anIdIter++ )
-        {
-          const vtkIdType aCellId = *anIdIter;
-          myVTK2ObjIds.push_back( aCellId );
-        }
+        myVTK2ObjIds.insert( myVTK2ObjIds.end(),
+                             aDimension2VTK2ObjIds[ aDimension ].begin(),
+                             aDimension2VTK2ObjIds[ aDimension ].end() );
+        TVectorId().swap( aDimension2VTK2ObjIds[ aDimension ]);
       }
-    }
   }
 
   return 1;
@@ -1308,7 +1203,7 @@ VTKViewer_GeometryFilter
             TVectorId& theVTK2ObjIds,
             TMapOfVectorId& theDimension2VTK2ObjIds )
 {
-  theVTK2ObjIds.push_back( theCellId );
+  //theVTK2ObjIds.push_back( theCellId );
 
   int aDimension = 0;
   switch( theCellType )
index ef69d297a42c8e6f986f0d236812666d5d93ec0b..e2420fef3748b9beac9a25c3b1664ddee1bd7e88 100755 (executable)
@@ -107,7 +107,8 @@ public:
   virtual double GetQuadraticArcAngle() const;
 
   typedef std::vector<vtkIdType> TVectorId;
-  typedef std::map<vtkIdType, TVectorId> TMapOfVectorId;
+  //typedef std::map<vtkIdType, TVectorId> TMapOfVectorId;
+  typedef std::vector<TVectorId> TMapOfVectorId;
 
   static void InsertId( const vtkIdType theCellId,
                         const vtkIdType theCellType,
index 8ac906e78b648d8b08e10cb70ec5e9cd47b5c428..d256bca80d470689c2484c6462a3bc4f487424ff 100755 (executable)
@@ -117,7 +117,7 @@ private:
 private:
   enum { DumpId, FitAllId, FitRectId, FitSelectionId, ZoomId, PanId, GlobalPanId, RotationId,
          FrontId, BackId, TopId, BottomId, LeftId, RightId, ClockWiseId, AntiClockWiseId,
-        ResetId, TrihedronShowId };
+         ResetId, TrihedronShowId };
   typedef QMap<int, QtxAction*> ActionsMap;
   
   void    createActions();