#include <set>
#include <map>
+#if !defined(VTK_XVERSION)
+#define VTK_XVERSION (VTK_MAJOR_VERSION<<16)+(VTK_MINOR_VERSION<<8)+(VTK_BUILD_VERSION)
+#endif
+
namespace
{
//---------------------------------------------------------------
typedef vtkDataArray* (vtkDataSetAttributes::* TGetAttribute)();
+#if (VTK_XVERSION < 0x050100)
typedef int (vtkDataSetAttributes::* TSetAttribute)(vtkDataArray*);
+#else
+ typedef int (vtkDataSetAttributes::* TSetAttribute)(vtkAbstractArray*);
+ typedef int (vtkDataSetAttributes::* TSetDataAttribute)(vtkDataArray*);
+#endif
+
+
+#if (VTK_XVERSION >= 0x050100)
+ 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_XVERSION < 0x050100)
TSetAttribute theSetAttribute,
+#else
+ TSetDataAttribute theSetAttribute,
+#endif
vtkIdType theFixedNbTuples)
{
CopyArray((theInput->*theGetAttribute)(),
CopyDataSetAttribute(vtkDataSet *theInput,
TGetAttribute theGetAttribute,
vtkDataSet *theOutput,
+#if (VTK_XVERSION < 0x050100)
TSetAttribute theSetAttribute,
+#else
+ TSetDataAttribute theSetAttribute,
+#endif
vtkIdType theNbPoints,
vtkIdType theNbCells)
{
{
CopyArray(theInput->GetArray(theFieldName),
theOutput,
- &vtkDataSetAttributes::AddArray,
+#if (VTK_XVERSION < 0x050100)
+ &vtkDataSetAttributes::AddArray,
+#else
+ &vtkFieldData::AddArray,
+#endif
theFixedNbTuples);
}
myIsShrinkable(false),
myShrinkFilter(VTKViewer_ShrinkFilter::New()),
myAnnotationMapper(vtkTextMapper::New()),
+#if (VTK_XVERSION < 0x050100)
myAnnotationActor(vtkTextActor::New()),
+#else
+ myAnnotationActor(vtkActor2D::New()),
+#endif
myTextActor(VTKViewer_FramedTextActor::New()),
myIsFeatureEdgesAllowed(false),
myIsFeatureEdgesEnabled(false),
class VTKViewer_FramedTextActor;
+#if !defined(VTK_XVERSION)
+#define VTK_XVERSION (VTK_MAJOR_VERSION<<16)+(VTK_MINOR_VERSION<<8)+(VTK_BUILD_VERSION)
+#endif
+
namespace SVTK
{
namespace Representation
bool myIsShrunk;
vtkSmartPointer<vtkTextMapper> myAnnotationMapper;
+#if (VTK_XVERSION < 0x050100)
vtkSmartPointer<vtkTextActor> myAnnotationActor;
+#else
+ vtkSmartPointer<vtkActor2D> myAnnotationActor;
+#endif
vtkSmartPointer<VTKViewer_FramedTextActor> myTextActor;
switch(GetRepresentation()){
case Points :
myNodeActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+#if (VTK_XVERSION < 0x050100)
myNodeActor->RenderTranslucentGeometry(ren);
+#else
+ myNodeActor->RenderTranslucentPolygonalGeometry(ren);
+#endif
break;
case Wireframe :
case Insideframe :
myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+#if (VTK_XVERSION < 0x050100)
myEdgeActor->RenderTranslucentGeometry(ren);
+#else
+ myEdgeActor->RenderTranslucentPolygonalGeometry(ren);
+#endif
break;
case Surface :
mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+#if (VTK_XVERSION < 0x050100)
mySurfaceActor->RenderTranslucentGeometry(ren);
+#else
+ mySurfaceActor->RenderTranslucentPolygonalGeometry(ren);
+#endif
break;
case Surfaceframe :
mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+#if (VTK_XVERSION < 0x050100)
mySurfaceActor->RenderTranslucentGeometry(ren);
+#else
+ mySurfaceActor->RenderTranslucentPolygonalGeometry(ren);
+#endif
myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
+#if (VTK_XVERSION < 0x050100)
myEdgeActor->RenderTranslucentGeometry(ren);
+#else
+ myEdgeActor->RenderTranslucentPolygonalGeometry(ren);
+#endif
break;
case FeatureEdges :
mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+#if (VTK_XVERSION < 0x050100)
mySurfaceActor->RenderTranslucentGeometry(ren);
+#else
+ mySurfaceActor->RenderTranslucentPolygonalGeometry(ren);
+#endif
break;
}
return 1;
case Surfaceframe:
mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+#if (VTK_XVERSION < 0x050100)
mySurfaceActor->RenderTranslucentGeometry(ren);
+#else
+ mySurfaceActor->RenderTranslucentPolygonalGeometry(ren);
+#endif
myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
+#if (VTK_XVERSION < 0x050100)
myEdgeActor->RenderTranslucentGeometry(ren);
+#else
+ myEdgeActor->RenderTranslucentPolygonalGeometry(ren);
+#endif
break;
case Points:
myPointsActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+#if (VTK_XVERSION < 0x050100)
myPointsActor->RenderTranslucentGeometry(ren);
+#else
+ myPointsActor->RenderTranslucentPolygonalGeometry(ren);
+#endif
break;
default:
mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+#if (VTK_XVERSION < 0x050100)
mySurfaceActor->RenderTranslucentGeometry(ren);
+#else
+ 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();
}
#define VTK_MAX_PLOTS 50
+#if !defined(VTK_XVERSION)
+#define VTK_XVERSION (VTK_MAJOR_VERSION<<16)+(VTK_MINOR_VERSION<<8)+(VTK_BUILD_VERSION)
+#endif
+
using namespace std;
vtkCxxRevisionMacro(VISU_XYPlotActor, "$Revision$");
this->TitleTextProperty);
}
+
+#if (VTK_XVERSION < 0x050100)
+ //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_XVERSION < 0x050100)
+ //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_XVERSION < 0x050100)
+ //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_XVERSION < 0x050100)
+ //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_XVERSION < 0x050100)
+ //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();