]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
CCAR: add ifdef to be able to install GUI module with VTK version < 5.7
authorcaremoli <caremoli>
Mon, 3 Jan 2011 10:24:43 +0000 (10:24 +0000)
committercaremoli <caremoli>
Mon, 3 Jan 2011 10:24:43 +0000 (10:24 +0000)
src/SVTK/SVTK_Actor.cxx
src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx
src/VTKViewer/VTKViewer_GeometryFilter.cxx

index e513649b5f1ab95968f4656bd5d5fe443aae1db6..95718794fcb4987cfaae32bc94b652cb34d2aaed 100644 (file)
 #include <vtkRenderer.h>
 
 #include <vtkCell.h>
+#define VTK_XVERSION (VTK_MAJOR_VERSION*10000+VTK_MINOR_VERSION*100+VTK_BUILD_VERSION)
+#if VTK_XVERSION > 50700
 #include <vtkPolyhedron.h>
+#endif
 #include <vtkPolyData.h>
 
 #include "Utils_SALOME_Exception.hxx"
@@ -130,8 +133,11 @@ SVTK_Actor
     int aPartId = theMapIndex( ind );
     if(vtkCell* aCell = theMapActor->GetElemCell(aPartId))
       {
+#if VTK_XVERSION > 50700
       if (aCell->GetCellType() != VTK_POLYHEDRON)
+#endif
         myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
+#if VTK_XVERSION > 50700
       else
         {
           vtkPolyhedron *polyhedron = dynamic_cast<vtkPolyhedron*>(aCell);
@@ -140,6 +146,7 @@ SVTK_Actor
           vtkIdType *pts = polyhedron->GetFaces();
           myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),pts[0], pts+1);
         }
+#endif
       }
   }
 
index 2ce0a7165c8ff53f605e6097abfb027d899538e2..768332bf236e92977bfd7b5c9ad07c72b1bb7400 100755 (executable)
@@ -36,6 +36,7 @@
 #include <vtkCell.h>
 #include <vtkInformation.h>
 #include <vtkInformationVector.h>
+#include <vtkVersion.h>
 
 #include "utilities.h"
 
@@ -47,6 +48,8 @@ using namespace std;
   #endif
 #endif
 
+#define VTK_XVERSION (VTK_MAJOR_VERSION*10000+VTK_MINOR_VERSION*100+VTK_BUILD_VERSION)
+
 vtkStandardNewMacro(VTKViewer_ExtractUnstructuredGrid);
 
 
@@ -116,11 +119,14 @@ inline void InsertCell(vtkUnstructuredGrid *theInput,
     theIdList->SetId(i,aPntIds->GetId(i));
   }
   vtkIdType aCellType = aCell->GetCellType();
+#if VTK_XVERSION > 50700
   if (aCellType != VTK_POLYHEDRON)
     {
+#endif
       theConnectivity->InsertNextCell(theIdList);
       if (theFaceLocations)
         theFaceLocations->InsertNextValue(-1);
+#if VTK_XVERSION > 50700
     }
   else
     {
@@ -148,6 +154,7 @@ inline void InsertCell(vtkUnstructuredGrid *theInput,
       vtkUnstructuredGrid::DecomposeAPolyhedronCell(
           nfaces, face, realnpts, theConnectivity, theFaces);
     }
+#endif
 
   theCellTypesArray->InsertNextValue(aCellType);
   if(theStoreMapping){
@@ -207,7 +214,7 @@ void VTKViewer_ExtractUnstructuredGrid::Execute()
     MESSAGE("Execute - myChangeMode = "<<myChangeMode);
   }*/
   if(myExtractionMode == eCells){
-    if(myChangeMode == ePassAll || myCellIds.empty() && myCellTypes.empty() && myChangeMode == eRemoving){
+    if(myChangeMode == ePassAll || (myCellIds.empty() && myCellTypes.empty() && myChangeMode == eRemoving)){
       if(vtkIdType aNbElems = anInput->GetNumberOfCells()){
         if(myStoreMapping) myOut2InId.reserve(aNbElems);
         anOutput->ShallowCopy(anInput);
@@ -296,7 +303,11 @@ void VTKViewer_ExtractUnstructuredGrid::Execute()
         for(vtkIdType i = 0, *pts, npts; aConnectivity->GetNextCell(npts,pts); i++){
           aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
         }
+#if VTK_XVERSION > 50700
         anOutput->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity,newFaceLocations,newFaces);
+#else
+        anOutput->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
+#endif
         anOutput->SetPoints(anInput->GetPoints());
         aCellLocationsArray->Delete();
       }
@@ -315,7 +326,7 @@ void VTKViewer_ExtractUnstructuredGrid::Execute()
     aCellTypesArray->Allocate(aNbElems*aCellTypesArray->GetNumberOfComponents());
     // additional condition has been added to treat a case described in IPAL21372
     // note that it is significant only when myExtractionMode == ePoints
-    if(myChangeMode == ePassAll || myCellIds.empty() && myCellTypes.empty() && myChangeMode == eRemoving ||
+    if(myChangeMode == ePassAll || (myCellIds.empty() && myCellTypes.empty() && myChangeMode == eRemoving) ||
        !anInput->GetCellTypesArray()){
       if(myStoreMapping) myOut2InId.reserve(aNbElems);
       for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
@@ -388,7 +399,11 @@ void VTKViewer_ExtractUnstructuredGrid::Execute()
       for(vtkIdType i = 0, *pts, npts; aConnectivity->GetNextCell(npts,pts); i++){
         aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
       }
+#if VTK_XVERSION > 50700
       anOutput->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity,0, 0);
+#else
+      anOutput->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
+#endif
       anOutput->SetPoints(anInput->GetPoints());
       aCellLocationsArray->Delete();
     }
index 0052072e9562d837c7efb95797f65d7735bd25a5..75992c5f0d8a7d88a7d720af7d630e914807dc21 100755 (executable)
@@ -63,6 +63,8 @@
   #endif
 #endif
 
+#define VTK_XVERSION (VTK_MAJOR_VERSION*10000+VTK_MINOR_VERSION*100+VTK_BUILD_VERSION)
+
 //#define __MYDEBUG__
 //#define USE_ROBUST_TRIANGULATION
 
@@ -483,6 +485,7 @@ VTKViewer_GeometryFilter
           break;
         }
 
+#if VTK_XVERSION > 50700
         case VTK_POLYHEDRON:
           {
             //MESSAGE("VTK_POLYHEDRON geometry filter");
@@ -529,6 +532,7 @@ VTKViewer_GeometryFilter
               }
             break;
           }
+#endif
         //Quadratic cells
         case VTK_QUADRATIC_EDGE:
         case VTK_QUADRATIC_TRIANGLE: