]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Issue 0001171: External Task 3.4: Visualisation of THREED by cylinder
authorouv <ouv@opencascade.com>
Thu, 1 Nov 2012 09:45:59 +0000 (09:45 +0000)
committerouv <ouv@opencascade.com>
Thu, 1 Nov 2012 09:45:59 +0000 (09:45 +0000)
Porting to VTK-5.8.0 supporting polyhedron cells.

src/VTKViewer/VTKViewer_ShrinkFilter.cxx

index 8751cd5eb9c8f6bb86b71b8cf22ca8384b4cd368..38a9222da0e85df0cf0537f4db2cc6bd14704dd7 100755 (executable)
@@ -76,6 +76,8 @@ int VTKViewer_ShrinkFilter::RequestData(
   vtkIdType tenth;
   vtkFloatingPointType decimal;
 
+  vtkIdType* pointMap = new vtkIdType[input->GetNumberOfPoints()];
+
   vtkDebugMacro(<<"Shrinking cells");
 
   numCells=input->GetNumberOfCells();
@@ -150,9 +152,25 @@ int VTKViewer_ShrinkFilter::RequestData(
       newId = newPts->InsertNextPoint(pt);
       if(myStoreMapping)
        myVTK2ObjIds.push_back(oldId);
-      newPtIds->InsertId(i,newId);
 
       outPD->CopyData(pd, oldId, newId);
+
+      pointMap[oldId] = newId;
+      }
+
+    // special handling for polyhedron cells
+    if (vtkUnstructuredGrid::SafeDownCast(input) &&
+        input->GetCellType(cellId) == VTK_POLYHEDRON)
+      {
+      vtkUnstructuredGrid::SafeDownCast(input)->GetFaceStream(cellId, newPtIds);
+      vtkUnstructuredGrid::ConvertFaceStreamPointIds(newPtIds, pointMap);
+      }
+    else
+      {
+      for(vtkIdType i=0; i < numIds; ++i)
+        {
+        newPtIds->InsertId(i, pointMap[ptIds->GetId(i)]);
+        }
       }
     output->InsertNextCell(input->GetCellType(cellId), newPtIds);
     }//for all cells
@@ -167,6 +185,8 @@ int VTKViewer_ShrinkFilter::RequestData(
   ptIds->Delete();
   newPtIds->Delete();
   newPts->Delete();
+
+  delete [] pointMap;
   
   return 1;
 }