]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
portability vtk4.4 and compatibility vtk4.2
authoradam <adam>
Fri, 3 Jun 2005 08:50:12 +0000 (08:50 +0000)
committeradam <adam>
Fri, 3 Jun 2005 08:50:12 +0000 (08:50 +0000)
src/OBJECT/SALOME_Actor.cxx
src/OBJECT/SALOME_Actor.h
src/VTKFilter/SALOME_ExtractUnstructuredGrid.cxx
src/VTKFilter/SALOME_GeometryFilter.cxx
src/VTKFilter/SALOME_ShrinkFilter.cxx
src/VTKFilter/SALOME_Transform.cxx

index 4b0b088e8d4753486b90dd04fbb7250d2880bf74..3d27885bdde414e7f30e569adfeff7c3241f9e27 100644 (file)
@@ -68,9 +68,18 @@ SALOME_Actor::SALOME_Actor(){
   myIsInfinite = false;
 
   myIsResolveCoincidentTopology = true;
-
-  vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
-                                                                myPolygonOffsetUnits);
+  
+#if ((VTK_MAJOR_VERSION == 4)&&(VTK_MINOR_VERSION <= 2))
+  float a = myPolygonOffsetFactor ;
+  float b = myPolygonOffsetUnits ;
+#else
+  double a = myPolygonOffsetFactor ;
+  double b = myPolygonOffsetUnits ;
+#endif
+  vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(a, b);
+  myPolygonOffsetFactor = a ;
+  myPolygonOffsetUnits = b ;
+  
   myStoreMapping = false;
   myGeomFilter = SALOME_GeometryFilter::New();
 
@@ -154,7 +163,11 @@ void SALOME_Actor::InitPipeLine(vtkMapper* theMapper){
 void SALOME_Actor::Render(vtkRenderer *ren, vtkMapper* m){
   if(myIsResolveCoincidentTopology){
     int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology();
+#if ((VTK_MAJOR_VERSION == 4)&&(VTK_MINOR_VERSION <= 2))
     float aFactor, aUnit; 
+#else
+    double aFactor, aUnit; 
+#endif
     vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
     
     vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
@@ -242,7 +255,11 @@ vtkCell* SALOME_Actor::GetElemCell(int theObjID){
 }
 
 
+#if ((VTK_MAJOR_VERSION == 4)&&(VTK_MINOR_VERSION <= 2))
 float* SALOME_Actor::GetNodeCoord(int theObjID){
+#else
+double* SALOME_Actor::GetNodeCoord(int theObjID){
+#endif
   return GetInput()->GetPoint(theObjID);
 }
 
@@ -280,7 +297,11 @@ void SALOME_Actor::SetColor(float r,float g,float b){
 }
 
 void SALOME_Actor::GetColor(float& r,float& g,float& b){
+#if ((VTK_MAJOR_VERSION == 4)&&(VTK_MINOR_VERSION <= 2))
   float aColor[3];
+#else
+  double aColor[3];
+#endif
   GetProperty()->GetColor(aColor);
   r = aColor[0];
   g = aColor[1];
index 6b57f9ca81cd125459e701441a826a78a490fabb..7e9f08773d7f75a8ba6680190fdd4650c155820b 100644 (file)
@@ -92,7 +92,11 @@ class SALOME_Actor : public vtkLODActor{
 
   // For selection mapping purpose
   virtual int GetNodeObjId(int theVtkID) { return theVtkID;}
+#if ((VTK_MAJOR_VERSION == 4)&&(VTK_MINOR_VERSION <= 2))
   virtual float* GetNodeCoord(int theObjID);
+#else
+  virtual double* GetNodeCoord(int theObjID);
+#endif
 
   virtual int GetElemObjId(int theVtkID) { return theVtkID;}
   virtual vtkCell* GetElemCell(int theObjID);
index 6de6d5ac96a5c7648878acac146eee8e793a97b0..2dabe8d79f8c0f75af6825a0e47d2ec4f584140d 100644 (file)
@@ -267,7 +267,11 @@ void SALOME_ExtractUnstructuredGrid::Execute(){
        }
       }
       if((aNbElems = aConnectivity->GetNumberOfCells())){
+#if ((VTK_MAJOR_VERSION == 4)&&(VTK_MINOR_VERSION <= 2))
        vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+#else
+       vtkIdTypeArray* aCellLocationsArray = vtkIdTypeArray::New();
+#endif
        aCellLocationsArray->SetNumberOfComponents(1);
        aCellLocationsArray->SetNumberOfTuples(aNbElems);
        aConnectivity->InitTraversal();
@@ -356,7 +360,11 @@ void SALOME_ExtractUnstructuredGrid::Execute(){
       }
     }
     if((aNbElems = aConnectivity->GetNumberOfCells())){
+#if ((VTK_MAJOR_VERSION == 4)&&(VTK_MINOR_VERSION <= 2))
       vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+#else
+      vtkIdTypeArray* aCellLocationsArray = vtkIdTypeArray::New();
+#endif
       aCellLocationsArray->SetNumberOfComponents(1);
       aCellLocationsArray->SetNumberOfTuples(aNbElems);
       aConnectivity->InitTraversal();
index 05e18db031f3d4f2a47bad7da00a6b03fb02c720..ef99ddb05130e363807b55e3738eeb8551492cf6 100644 (file)
@@ -130,7 +130,11 @@ void SALOME_GeometryFilter::UnstructuredGridExecute()
   char *cellVis;
   vtkIdType newCellId;
   int faceId, *faceVerts, numFacePts;
+#if ((VTK_MAJOR_VERSION == 4)&&(VTK_MINOR_VERSION <= 2))
   float *x;
+#else
+  double *x;
+#endif
   int PixelConvert[4], aNewPts[VTK_CELL_SIZE];
   // ghost cell stuff
   unsigned char  updateLevel = (unsigned char)(output->GetUpdateGhostLevel());
index 7d9d8b18b9df9636d6f31d9217aacfbcb3ce6ebf..88bafd7dd22aca6f61e56aa585524a735c85b42a 100644 (file)
@@ -63,7 +63,12 @@ void SALOME_ShrinkFilter::Execute()
   int i, j, numIds, abort=0;
   vtkIdType cellId, numCells, numPts;
   vtkIdType oldId, newId;
-  float center[3], *p, pt[3];
+  float center[3], pt[3];
+#if ((VTK_MAJOR_VERSION == 4)&&(VTK_MINOR_VERSION <= 2))
+  float *p;
+#else
+  double *p;
+#endif
   vtkPointData *pd, *outPD;;
   vtkIdList *ptIds, *newPtIds;
   vtkDataSet *input= this->GetInput();
index 7700215d11c58fc684436c659a081e1dff0ade3a..31016193a009d520f434a82b16edd3a1486a51a1 100644 (file)
@@ -44,6 +44,10 @@ void SALOME_Transform::SetScale(float theScaleX, float theScaleY, float theScale
 }
 
 int SALOME_Transform::IsIdentity(){ 
+#if ((VTK_MAJOR_VERSION == 4)&&(VTK_MINOR_VERSION <= 2))
   float* aScale = GetScale();
+#else
+  double* aScale = GetScale();
+#endif
   return (aScale[0] == 1.0 && aScale[1] == 1.0 && aScale[2] == 1.0);
 }