#include <vtkConeSource.h>
#include <vtkPolyDataMapper.h>
#include <vtkVectorText.h>
+#include <vtkTextActor.h>
+#include <vtkTextMapper.h>
+#include <vtkTextProperty.h>
// QT includes
#include <QtGlobal>
vtkStandardNewMacro(VTKViewer_LineActor);
+#ifdef IPAL21440
+vtkCxxSetObjectMacro(VTKViewer_LineActor,LabelActor,vtkTextActor);
+#else
vtkCxxSetObjectMacro(VTKViewer_LineActor,LabelActor,VTKViewer_UnScaledActor);
+#endif
vtkCxxSetObjectMacro(VTKViewer_LineActor,ArrowActor,vtkFollower);
/*!Adds Label and Arrow actors to \a theRenderer.*/
void VTKViewer_LineActor::Render(vtkRenderer *theRenderer)
{
+#ifndef IPAL21440
if(LabelActor && LabelActor->GetVisibility()){
LabelActor->Modified();
LabelActor->Render(theRenderer);
}
+#endif
if(ArrowActor && ArrowActor->GetVisibility()){
ArrowActor->Modified();
ArrowActor->Render(theRenderer);
myLineActor->SetArrowActor(myArrowActor);
/*! \li Initialize the Label pipe-line representation */
+#ifdef IPAL21440
+ myTextMapper = vtkTextMapper::New();
+
+ myLabelActor = vtkTextActor::New();
+ myLabelActor->SetMapper(myTextMapper);
+ myLabelActor->ScaledTextOff();
+ myLabelActor->PickableOff();
+
+ vtkCoordinate* aCoord = vtkCoordinate::New();
+ myLabelActor->GetPositionCoordinate()->SetReferenceCoordinate( aCoord );
+ aCoord->Delete();
+#else
myVectorText = vtkVectorText::New();
myMapper[2] = vtkPolyDataMapper::New();
myLabelActor->SetSize(aLabelActorSize);
myLabelActor->PickableOff();
//myLabelActor->DebugOn();
+#endif
myLineActor->SetLabelActor(myLabelActor);
myMapper[0]->RemoveAllInputs();
myMapper[0]->Delete();
- myVectorText->Delete();
-
/*! \li Destroy of the Arrow pipe-line representation */
myArrowActor->Delete();
/*! \li Destroy of the Line pipe-line representation */
myLineActor->Delete();
+#ifdef IPAL21440
+ myTextMapper->RemoveAllInputs();
+ myTextMapper->Delete();
+#else
+ myVectorText->Delete();
+
myMapper[2]->RemoveAllInputs();
myMapper[2]->Delete();
+#endif
myLineSource->Delete();
}
/*! Set camera for myLabelActor
*/
void VTKViewer_Axis::SetCamera(vtkCamera* theCamera){
+#ifndef IPAL21440
myLabelActor->SetCamera(theCamera);
+#endif
}
-/*! Sets \a theProperty for actors: myLineActor,myLabelActor,myArrowActor
+/*! Sets color for actors: myLineActor,myLabelActor,myArrowActor
*/
-void VTKViewer_Axis::SetProperty(vtkProperty* theProperty){
- myLabelActor->SetProperty(theProperty);
- myArrowActor->SetProperty(theProperty);
- myLineActor->SetProperty(theProperty);
+void VTKViewer_Axis::SetColor(double theRed, double theGreen, double theBlue)
+{
+ // Set color property for arrow and line actors
+ vtkProperty* aProperty = vtkProperty::New();
+ aProperty->SetColor(theRed, theGreen, theBlue);
+
+ myArrowActor->SetProperty(aProperty);
+ myLineActor->SetProperty(aProperty);
+#ifndef IPAL21440
+ myLabelActor->SetProperty(aProperty);
+#endif
+
+ aProperty->Delete();
+
+ // Set color property for label actor
+#ifdef IPAL21440
+ vtkTextProperty* aTextProperty = vtkTextProperty::New();
+ aTextProperty->SetColor(theRed, theGreen, theBlue);
+
+ myLabelActor->SetTextProperty(aTextProperty);
+
+ aTextProperty->Delete();
+#endif
}
/*! Set size of VTKViewer_Axis
myArrowActor->SetOrientation(myRot);
myArrowActor->SetScale(theSize / 10.);
+#ifdef IPAL21440
+ if( vtkCoordinate* aCoord = myLabelActor->GetPositionCoordinate()->GetReferenceCoordinate() )
+ aCoord->SetValue( aPosition );
+#else
myLabelActor->SetPosition(0.0,0.0,0.0);
myLabelActor->AddPosition(aPosition);
+#endif
}
/*! Check if actor belongs to the axis object
{
return theActor == myLineActor ||
theActor == myArrowActor ||
+#ifdef IPAL21440
+ false;
+#else
theActor == myLabelActor;
+#endif
}
/*! \class VTKViewer_XAxis
VTKViewer_XAxis::VTKViewer_XAxis(){
myDir[0] = 1.0; myDir[1] = 0.0; myDir[2] = 0.0;
myRot[0] = 0.0; myRot[1] = 0.0; myRot[2] = 0.0;
+#ifdef IPAL21440
+ myTextMapper->SetInput("X");
+#else
myVectorText->SetText("X");
- vtkProperty* aProperty = vtkProperty::New();
- aProperty->SetColor(1.0,0.0,0.0);
- SetProperty(aProperty);
- aProperty->Delete();
+#endif
+ SetColor(1.0,0.0,0.0);
}
/*! \class VTKViewer_YAxis
{
myDir[0] = 0.0; myDir[1] = 1.0; myDir[2] = 0.0;
myRot[0] = 0.0; myRot[1] = 0.0; myRot[2] = 90.;
+#ifdef IPAL21440
+ myTextMapper->SetInput("Y");
+#else
myVectorText->SetText("Y");
- vtkProperty* aProperty = vtkProperty::New();
- aProperty->SetColor(0.0,1.0,0.0);
- SetProperty(aProperty);
- aProperty->Delete();
+#endif
+ SetColor(0.0,1.0,0.0);
}
/*! \class VTKViewer_ZAxis
{
myDir[0] = 0.0; myDir[1] = 0.0; myDir[2] = 1.0;
myRot[0] = 0.0; myRot[1] = -90; myRot[2] = 0.0;
+#ifdef IPAL21440
+ myTextMapper->SetInput("Z");
+#else
myVectorText->SetText("Z");
- vtkProperty* aProperty = vtkProperty::New();
- aProperty->SetColor(0.0,0.0,1.0);
- SetProperty(aProperty);
- aProperty->Delete();
+#endif
+ SetColor(0.0,0.0,1.0);
}
vtkStandardNewMacro(VTKViewer_Trihedron);
class vtkLineSource;
class vtkConeSource;
class vtkVectorText;
+class vtkTextActor;
+class vtkTextMapper;
class VTKViewer_Axis;
+// VTKViewer_UnScaledActor is temporarily replaced with simple vtkTextActor
+// This workaround caused by the bug with disappeared labels of the trihedron
+// reproduced after migration from qt-4.4.3 to qt-4.5.2
+#define IPAL21440
+
/*! \class vtkFollower
* See <a href="http://www.vtk.org/">vtk documentation</a>
*/
/*!Create new instance of VTKViewer_LineActor.*/
static VTKViewer_LineActor *New();
- /*! Sets Lable actor.
+#ifdef IPAL21440
+ /*! Sets Label actor.
+ * \param theLabelActor - vtkTextActor
+ */
+ void SetLabelActor(vtkTextActor* theLabelActor);
+#else
+ /*! Sets Label actor.
* \param theLabelActor - VTKViewer_UnScaledActor
*/
void SetLabelActor(VTKViewer_UnScaledActor* theLabelActor);
+#endif
/*! Sets Arrow actor.
* \param theLabelActor - VTKViewer_UnScaledActor
}
/*!Label actor pointer*/
+#ifdef IPAL21440
+ vtkTextActor* LabelActor;
+#else
VTKViewer_UnScaledActor* LabelActor;
+#endif
/*!Arrow actor pointer*/
vtkFollower* ArrowActor;
*/
virtual void SetCamera(vtkCamera* theCamera);
- /*! Sets \a theProperty for actors: myLineActor,myLabelActor,myArrowActor
+ /*! Sets color for actors: myLineActor,myLabelActor,myArrowActor
+ * \param theRed - red component of the color
+ * \param theGreen - green component of the color
+ * \param theBlue - blue component of the color
*/
- virtual void SetProperty(vtkProperty* theProperty);
+ virtual void SetColor(double theRed, double theGreen, double theBlue);
/*! Set size of VTKViewer_Axis
*/
/*! Get label actor.
* \retval Return myLabelActor.
*/
+#ifdef IPAL21440
+ virtual vtkTextActor* GetLabel() { return myLabelActor; }
+#else
virtual VTKViewer_UnScaledActor* GetLabel() { return myLabelActor; }
+#endif
/*! Get arrow actor.
* \retval Return myArrowActor
/*! VTKViewer_UnScaledActor actor pointer
*/
+#ifdef IPAL21440
+ vtkTextActor *myLabelActor;
+#else
VTKViewer_UnScaledActor *myLabelActor;
+#endif
/*! \li myMapper[0] - for the Line pipe-line representation
* \li myMapper[1] - for the Arrow pipe-line representation
*/
vtkConeSource *myConeSource;
+#ifdef IPAL21440
+ /*! vtkTextMapper pointer (Label)
+ */
+ vtkTextMapper *myTextMapper;
+#else
/*! VTKViewer_VectorText pointer (Label)
*/
vtkVectorText* myVectorText;
+#endif
};
#endif