//---------------------------------------------------------------
typedef vtkDataArray* (vtkDataSetAttributes::* TGetAttribute)();
+#if (VTK_MINOR_VERSION == 0)
typedef int (vtkDataSetAttributes::* TSetAttribute)(vtkDataArray*);
+#else
+ typedef int (vtkDataSetAttributes::* TSetAttribute)(vtkAbstractArray*);
+ typedef int (vtkDataSetAttributes::* TSetDataAttribute)(vtkDataArray*);
+#endif
+
+
+#if (VTK_MINOR_VERSION > 0)
+ inline
+ void
+ CopyArray(vtkDataArray* theDataArray,
+ vtkDataSetAttributes* theOutput,
+ TSetDataAttribute theSetAttribute,
+ vtkIdType theFixedNbTuples)
+ {
+ if(theDataArray){
+ vtkIdType aNbTuples = theDataArray->GetNumberOfTuples();
+ if(theFixedNbTuples == aNbTuples)
+ (theOutput->*theSetAttribute)(theDataArray);
+ }
+ }
+#endif
inline
void
CopyAttribute(vtkDataSetAttributes* theInput,
TGetAttribute theGetAttribute,
vtkDataSetAttributes* theOutput,
+#if (VTK_MINOR_VERSION == 0)
TSetAttribute theSetAttribute,
+#else
+ TSetDataAttribute theSetAttribute,
+#endif
vtkIdType theFixedNbTuples)
{
CopyArray((theInput->*theGetAttribute)(),
CopyDataSetAttribute(vtkDataSet *theInput,
TGetAttribute theGetAttribute,
vtkDataSet *theOutput,
+#if (VTK_MINOR_VERSION == 0)
TSetAttribute theSetAttribute,
+#else
+ TSetDataAttribute theSetAttribute,
+#endif
vtkIdType theNbPoints,
vtkIdType theNbCells)
{
{
CopyArray(theInput->GetArray(theFieldName),
theOutput,
- &vtkDataSetAttributes::AddArray,
+#if (VTK_MINOR_VERSION == 0)
+ &vtkDataSetAttributes::AddArray,
+#else
+ &vtkFieldData::AddArray,
+#endif
theFixedNbTuples);
}
myIsShrinkable(false),
myShrinkFilter(VTKViewer_ShrinkFilter::New()),
myAnnotationMapper(vtkTextMapper::New()),
+#if ( (VTK_MINOR_VERSION == 0))
myAnnotationActor(vtkTextActor::New()),
+#else
+ myAnnotationActor(vtkActor2D::New()),
+#endif
myTextActor(VTKViewer_FramedTextActor::New()),
myIsFeatureEdgesAllowed(false),
myIsFeatureEdgesEnabled(false),
bool myIsShrunk;
vtkSmartPointer<vtkTextMapper> myAnnotationMapper;
+#if (VTK_MINOR_VERSION == 0)
vtkSmartPointer<vtkTextActor> myAnnotationActor;
+#else
+ vtkSmartPointer<vtkActor2D> myAnnotationActor;
+#endif
vtkSmartPointer<VTKViewer_FramedTextActor> myTextActor;
GetMatrix(mySurfaceActor->GetUserMatrix());
using namespace SVTK::Representation;
+#if (VTK_MINOR_VERSION == 0)
switch(GetRepresentation()){
case Points :
myNodeActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
mySurfaceActor->RenderTranslucentGeometry(ren);
break;
}
+#else
+ switch(GetRepresentation()){
+ case Points :
+ myNodeActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+ myNodeActor->RenderTranslucentPolygonalGeometry(ren);
+ break;
+ case Wireframe :
+ case Insideframe :
+ myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+ myEdgeActor->RenderTranslucentPolygonalGeometry(ren);
+ break;
+ case Surface :
+ mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+ mySurfaceActor->RenderTranslucentPolygonalGeometry(ren);
+ break;
+ case Surfaceframe :
+ mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+ mySurfaceActor->RenderTranslucentPolygonalGeometry(ren);
+
+ myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
+ myEdgeActor->RenderTranslucentPolygonalGeometry(ren);
+ break;
+ case FeatureEdges :
+ mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+ mySurfaceActor->RenderTranslucentPolygonalGeometry(ren);
+ break;
+ }
+#endif
return 1;
}
GetMatrix(mySurfaceActor->GetUserMatrix());
using namespace SVTK::Representation;
+#if (VTK_MINOR_VERSION == 0)
switch ( GetRepresentation() ) {
case Surfaceframe:
mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
mySurfaceActor->RenderTranslucentGeometry(ren);
}
+#else
+ switch ( GetRepresentation() ) {
+ case Surfaceframe:
+
+ mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+ mySurfaceActor->RenderTranslucentPolygonalGeometry(ren);
+
+ myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
+ myEdgeActor->RenderTranslucentPolygonalGeometry(ren);
+ break;
+
+ case Points:
+ myPointsActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+ myPointsActor->RenderTranslucentPolygonalGeometry(ren);
+ break;
+
+ default:
+ mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+ mySurfaceActor->RenderTranslucentPolygonalGeometry(ren);
+ }
+#endif
return 1;
}
myCellDataToPointData,
GetMergedInput());
- myScalars = GetMergedInput();
+ myScalars = vtkUnstructuredGrid::SafeDownCast(GetMergedInput());
UpdateScalars();
if(GetScalars() == theScalars)
return;
- myScalars = theScalars;
+ myScalars = vtkUnstructuredGrid::SafeDownCast(theScalars);
UpdateScalars();
}
this->TitleTextProperty);
}
+
+#if (VTK_MINOR_VERSION == 0)
+ //VSV: Function is not supported in VTK 5.2 and high
vtkAxisActor2D::SetFontSize(viewport,
this->TitleMapper,
size,
1.0,
stringSize);
-
+#endif
+
this->TitleActor->GetPositionCoordinate()->SetValue(
pos[0] + 0.5 * (pos2[0] - pos[0]) - stringSize[0] / 2.0,
pos2[1] - stringSize[1] / 2.0);
// Estimate the padding around the X and Y axes
tprop->ShallowCopy(axisX->GetTitleTextProperty());
textMapper->SetInput(axisX->GetTitle());
+
+#if (VTK_MINOR_VERSION == 0)
+ //VSV: Function is not supported in VTK 5.2 and high
vtkAxisActor2D::SetFontSize(
viewport, textMapper, size, fontFactorX, titleSizeX);
-
+#endif
+
tprop->ShallowCopy(axisY->GetTitleTextProperty());
textMapper->SetInput(axisY->GetTitle());
+
+#if (VTK_MINOR_VERSION == 0)
+ //VSV: Function is not supported in VTK 5.2 and high
vtkAxisActor2D::SetFontSize(
viewport, textMapper, size, fontFactorY, titleSizeY);
-
+#endif
+
// At this point the thing to do would be to actually ask the Y axis
// actor to return the largest label.
// In the meantime, let's try with the min and max
sprintf(str2, axisY->GetLabelFormat(), axisY->GetAdjustedRange()[1]);
tprop->ShallowCopy(axisY->GetLabelTextProperty());
textMapper->SetInput(strlen(str1) > strlen(str2) ? str1 : str2);
+
+#if (VTK_MINOR_VERSION == 0)
+ //VSV: Function is not supported in VTK 5.2 and high
vtkAxisActor2D::SetFontSize(
viewport, textMapper, size, labelFactorY * fontFactorY, labelSizeY);
-
+#endif
+
// We do only care of the height of the label in the X axis, so let's
// use the min for example
sprintf(str1, axisX->GetLabelFormat(), axisX->GetAdjustedRange()[0]);
tprop->ShallowCopy(axisX->GetLabelTextProperty());
textMapper->SetInput(str1);
+
+#if (VTK_MINOR_VERSION == 0)
+ //VSV: Function is not supported in VTK 5.2 and high
vtkAxisActor2D::SetFontSize(
viewport, textMapper, size, labelFactorX * fontFactorX, labelSizeX);
-
+#endif
+
tickOffsetX = axisX->GetTickOffset();
tickOffsetY = axisY->GetTickOffset();
tickLengthX = axisX->GetTickLength();