From 664f0ef932902c18eecf6126d9ec21a731ddf9d5 Mon Sep 17 00:00:00 2001 From: caremoli Date: Mon, 3 Jan 2011 10:24:43 +0000 Subject: [PATCH] CCAR: add ifdef to be able to install GUI module with VTK version < 5.7 --- src/SVTK/SVTK_Actor.cxx | 7 +++++++ .../VTKViewer_ExtractUnstructuredGrid.cxx | 19 +++++++++++++++++-- src/VTKViewer/VTKViewer_GeometryFilter.cxx | 4 ++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/SVTK/SVTK_Actor.cxx b/src/SVTK/SVTK_Actor.cxx index e513649b5..95718794f 100644 --- a/src/SVTK/SVTK_Actor.cxx +++ b/src/SVTK/SVTK_Actor.cxx @@ -32,7 +32,10 @@ #include #include +#define VTK_XVERSION (VTK_MAJOR_VERSION*10000+VTK_MINOR_VERSION*100+VTK_BUILD_VERSION) +#if VTK_XVERSION > 50700 #include +#endif #include #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(aCell); @@ -140,6 +146,7 @@ SVTK_Actor vtkIdType *pts = polyhedron->GetFaces(); myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),pts[0], pts+1); } +#endif } } diff --git a/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx b/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx index 2ce0a7165..768332bf2 100755 --- a/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx +++ b/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #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 = "<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(); } diff --git a/src/VTKViewer/VTKViewer_GeometryFilter.cxx b/src/VTKViewer/VTKViewer_GeometryFilter.cxx index 0052072e9..75992c5f0 100755 --- a/src/VTKViewer/VTKViewer_GeometryFilter.cxx +++ b/src/VTKViewer/VTKViewer_GeometryFilter.cxx @@ -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: -- 2.39.2