From ef9744bfc6b59d1c8ab5700eade85067028470a6 Mon Sep 17 00:00:00 2001 From: ouv Date: Thu, 22 Jan 2009 14:59:30 +0000 Subject: [PATCH] Fix for point 3 of issue 0020137: EDF 931 VISU : Trihedron Issues --- src/VTKViewer/VTKViewer_Trihedron.cxx | 17 +++++++++++------ src/VTKViewer/VTKViewer_Trihedron.h | 10 +++++----- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/VTKViewer/VTKViewer_Trihedron.cxx b/src/VTKViewer/VTKViewer_Trihedron.cxx index e3be10d16..067dfecf6 100755 --- a/src/VTKViewer/VTKViewer_Trihedron.cxx +++ b/src/VTKViewer/VTKViewer_Trihedron.cxx @@ -98,7 +98,7 @@ void VTKViewer_UnScaledActor::Render(vtkRenderer *theRenderer) vtkStandardNewMacro(VTKViewer_LineActor); vtkCxxSetObjectMacro(VTKViewer_LineActor,LabelActor,VTKViewer_UnScaledActor); -vtkCxxSetObjectMacro(VTKViewer_LineActor,ArrowActor,VTKViewer_UnScaledActor); +vtkCxxSetObjectMacro(VTKViewer_LineActor,ArrowActor,vtkFollower); /*!Adds Label and Arrow actors to \a theRenderer.*/ void VTKViewer_LineActor::Render(vtkRenderer *theRenderer) @@ -132,16 +132,17 @@ VTKViewer_Axis::VTKViewer_Axis() /*! \li Initialize the Arrow pipe-line representation*/ myConeSource = vtkConeSource::New(); - myConeSource->SetResolution(2); + myConeSource->SetResolution(16); myConeSource->SetAngle(10); + myConeSource->SetCenter(-0.5,0.0,0.0); myMapper[1] = vtkPolyDataMapper::New(); myMapper[1]->SetInput(myConeSource->GetOutput()); - myArrowActor = VTKViewer_UnScaledActor::New(); + myArrowActor = vtkFollower::New(); myArrowActor->SetMapper(myMapper[1]); - static int aArrowActorSize = 24; - myArrowActor->SetSize(aArrowActorSize); + static int aArrowActorSize = 16; + myArrowActor->SetScale(aArrowActorSize); myArrowActor->PickableOff(); myLineActor->SetArrowActor(myArrowActor); @@ -255,11 +256,15 @@ void VTKViewer_Axis::SetProperty(vtkProperty* theProperty){ void VTKViewer_Axis::SetSize(vtkFloatingPointType theSize) { vtkFloatingPointType aPosition[3] = {myDir[0]*theSize, myDir[1]*theSize, myDir[2]*theSize}; - myLineSource->SetPoint2(aPosition); + + vtkFloatingPointType aCoef = 0.99; + vtkFloatingPointType aLinePosition[3] = {aPosition[0]*aCoef, aPosition[1]*aCoef, aPosition[2]*aCoef}; + myLineSource->SetPoint2(aLinePosition); myArrowActor->SetPosition(0.0,0.0,0.0); myArrowActor->AddPosition(aPosition); myArrowActor->SetOrientation(myRot); + myArrowActor->SetScale(theSize / 10.); myLabelActor->SetPosition(0.0,0.0,0.0); myLabelActor->AddPosition(aPosition); diff --git a/src/VTKViewer/VTKViewer_Trihedron.h b/src/VTKViewer/VTKViewer_Trihedron.h index 1fa61da8b..f1bf77d3e 100755 --- a/src/VTKViewer/VTKViewer_Trihedron.h +++ b/src/VTKViewer/VTKViewer_Trihedron.h @@ -89,7 +89,7 @@ public: /*! Sets Arrow actor. * \param theLabelActor - VTKViewer_UnScaledActor */ - void SetArrowActor(VTKViewer_UnScaledActor* theLabelActor); + void SetArrowActor(vtkFollower* theArrowActor); virtual void Render(vtkRenderer *theRenderer); @@ -111,7 +111,7 @@ protected: VTKViewer_UnScaledActor* LabelActor; /*!Arrow actor pointer*/ - VTKViewer_UnScaledActor* ArrowActor; + vtkFollower* ArrowActor; }; /*!This class provide support trihedron object in vtk viewer.*/ @@ -242,7 +242,7 @@ public: /*! Get arrow actor. * \retval Return myArrowActor */ - virtual VTKViewer_UnScaledActor* GetArrow() { return myArrowActor; } + virtual vtkFollower* GetArrow() { return myArrowActor; } /*! Check if actor belongs to the axis object * \param theActor - vtkActor pointer @@ -267,9 +267,9 @@ protected: */ VTKViewer_LineActor *myLineActor; - /*! VTKViewer_UnScaledActor actor pointer + /*! vtkFollower actor pointer */ - VTKViewer_UnScaledActor *myArrowActor; + vtkFollower *myArrowActor; /*! VTKViewer_UnScaledActor actor pointer */ -- 2.39.2