From: adam Date: Fri, 3 Jun 2005 08:50:12 +0000 (+0000) Subject: portability vtk4.4 and compatibility vtk4.2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3c18d70a7c9d7051a69f8b07443101ec59c11c40;p=modules%2Fkernel.git portability vtk4.4 and compatibility vtk4.2 --- diff --git a/src/OBJECT/SALOME_Actor.cxx b/src/OBJECT/SALOME_Actor.cxx index 4b0b088e8..3d27885bd 100644 --- a/src/OBJECT/SALOME_Actor.cxx +++ b/src/OBJECT/SALOME_Actor.cxx @@ -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]; diff --git a/src/OBJECT/SALOME_Actor.h b/src/OBJECT/SALOME_Actor.h index 6b57f9ca8..7e9f08773 100644 --- a/src/OBJECT/SALOME_Actor.h +++ b/src/OBJECT/SALOME_Actor.h @@ -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); diff --git a/src/VTKFilter/SALOME_ExtractUnstructuredGrid.cxx b/src/VTKFilter/SALOME_ExtractUnstructuredGrid.cxx index 6de6d5ac9..2dabe8d79 100644 --- a/src/VTKFilter/SALOME_ExtractUnstructuredGrid.cxx +++ b/src/VTKFilter/SALOME_ExtractUnstructuredGrid.cxx @@ -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(); diff --git a/src/VTKFilter/SALOME_GeometryFilter.cxx b/src/VTKFilter/SALOME_GeometryFilter.cxx index 05e18db03..ef99ddb05 100644 --- a/src/VTKFilter/SALOME_GeometryFilter.cxx +++ b/src/VTKFilter/SALOME_GeometryFilter.cxx @@ -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()); diff --git a/src/VTKFilter/SALOME_ShrinkFilter.cxx b/src/VTKFilter/SALOME_ShrinkFilter.cxx index 7d9d8b18b..88bafd7dd 100644 --- a/src/VTKFilter/SALOME_ShrinkFilter.cxx +++ b/src/VTKFilter/SALOME_ShrinkFilter.cxx @@ -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(); diff --git a/src/VTKFilter/SALOME_Transform.cxx b/src/VTKFilter/SALOME_Transform.cxx index 7700215d1..31016193a 100644 --- a/src/VTKFilter/SALOME_Transform.cxx +++ b/src/VTKFilter/SALOME_Transform.cxx @@ -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); }