1 #ifndef VTKVIEWER_TRIHEDRON_H
2 #define VTKVIEWER_TRIHEDRON_H
7 #include <vtkFollower.h>
10 class vtkActorCollection;
13 class vtkPolyDataMapper;
18 class VTKViewer_VectorText;
20 /*! \class vtkFollower
21 * See <a href="http://www.vtk.org/">vtk documentation</a>
23 /*!a subclass of actor that always faces the camera
26 class VTKViewer_UnScaledActor: public vtkFollower
28 VTKViewer_UnScaledActor(const VTKViewer_UnScaledActor&);
32 vtkTypeMacro(VTKViewer_UnScaledActor,vtkFollower);
34 /*!Create new instance of VTKViewer_UnScaledActor.*/
35 static VTKViewer_UnScaledActor *New();
37 virtual void SetSize(int theSize);
38 virtual void Render(vtkRenderer *theRenderer);
41 VTKViewer_UnScaledActor();
42 /*!Destructor. Do nothing.*/
43 ~VTKViewer_UnScaledActor(){}
48 /*!a subclass of actor that always faces the camera
51 class VTKViewer_LineActor: public vtkFollower
53 VTKViewer_LineActor(const VTKViewer_LineActor&);
57 vtkTypeMacro(VTKViewer_LineActor,vtkFollower);
59 /*!Create new instance of VTKViewer_LineActor.*/
60 static VTKViewer_LineActor *New();
63 * \param theLabelActor - VTKViewer_UnScaledActor
65 void SetLabelActor(VTKViewer_UnScaledActor* theLabelActor);
68 * \param theLabelActor - VTKViewer_UnScaledActor
70 void SetArrowActor(VTKViewer_UnScaledActor* theLabelActor);
72 virtual void Render(vtkRenderer *theRenderer);
76 /*! Constructor which sets \a LabelActor and \a ArrowActor to NULL*/
77 VTKViewer_LineActor(){
82 /*!Destructor which call SetLabelActor(NULL) and SetArrowActor(NULL)*/
83 ~VTKViewer_LineActor(){
88 /*!Label actor pointer*/
89 VTKViewer_UnScaledActor* LabelActor;
91 /*!Arrow actor pointer*/
92 VTKViewer_UnScaledActor* ArrowActor;
95 //****************************************************************
96 /*!This class provide support trihedron object in vtk viewer.*/
97 class VTKVIEWER_EXPORT VTKViewer_Trihedron : public vtkObject
100 /*!Initialize fields by default values.*/
101 VTKViewer_Trihedron();
103 /*!Const copy constructor.*/
104 VTKViewer_Trihedron(const VTKViewer_Trihedron&);
106 /*!Destructor. Remove all fileds.*/
107 virtual ~VTKViewer_Trihedron();
110 /*!vtk type macros.*/
111 vtkTypeMacro(VTKViewer_Trihedron,vtkObject);
113 /*!Create new instance of VTKViewer_Trihedron.*/
114 static VTKViewer_Trihedron *New();
116 /*!Sets size of trihedron.
117 * \param theSize - float value
119 virtual void SetSize(float theSize);
121 /*! Get size of trihedron.
122 * \retval mySize - float value
124 virtual float GetSize() { return mySize;}
126 enum TVisibility{eOff, eOn, eOnlyLineOn};
128 /*! Sets visibility for all Axis to \a theVis*/
129 virtual void SetVisibility(TVisibility theVis);
131 /*! OFF visibility for all Axis.*/
132 virtual void VisibilityOff() { SetVisibility(eOff);}
134 /*! ON visibility for all Axis.*/
135 virtual void VisibilityOn() { SetVisibility(eOn);}
137 /*! Gets visibility of myAxis[0] actor.*/
138 virtual TVisibility GetVisibility();
140 /*! Add to render all Axis
141 * \param theRenderer - vtkRenderer pointer
143 virtual void AddToRender(vtkRenderer* theRenderer);
145 /*! Remove all actors from \a theRenderer which are in myPresent.
146 * \param theRenderer - vtkRenderer pointer
148 virtual void RemoveFromRender(vtkRenderer* theRenderer);
150 /*! Return count of visible actors.
151 * \param theRenderer - vtkRenderer pointer
153 virtual int GetVisibleActorCount(vtkRenderer* theRenderer);
156 /*! Actor collection*/
157 vtkActorCollection* myPresent;
159 /*! \li myAxis[0] - X Axis actor
160 * \li myAxis[1] - Y Axis actor
161 * \li myAxis[2] - Z Axis actor
163 VTKViewer_Axis* myAxis[3];
165 /*! Common size for trihedron, for each axis.*/
169 //****************************************************************
170 /*!The base class for concreate Axis.
171 * Its only duty is to give correct initialization and destruction
174 class VTKViewer_Axis : public vtkObject
178 VTKViewer_Axis(const VTKViewer_Axis&);
179 virtual ~VTKViewer_Axis();
182 /*!vtk type macros.*/
183 vtkTypeMacro(VTKViewer_Axis,vtkObject);
185 /*! Add to \a theRenderer actors: myLineActor,myLabelActor,myArrowActor
187 virtual void AddToRender(vtkRenderer* theRenderer);
189 /*! Sets visibility for actors: myLineActor,myLabelActor,myArrowActor
191 virtual void SetVisibility(VTKViewer_Trihedron::TVisibility theVis);
193 /*! Return visibility of VTKViewer_Axis
194 * \retval myVisibility
196 virtual VTKViewer_Trihedron::TVisibility GetVisibility() { return myVisibility; }
198 /*! Set camera for myLabelActor
200 virtual void SetCamera(vtkCamera* theCamera);
202 /*! Sets \a theProperty for actors: myLineActor,myLabelActor,myArrowActor
204 virtual void SetProperty(vtkProperty* theProperty);
206 /*! Set size of VTKViewer_Axis
208 virtual void SetSize(float theSize);
211 * \retval Return myLabelActor.
213 virtual VTKViewer_UnScaledActor* GetLabel() { return myLabelActor; }
216 * \retval Return myArrowActor
218 virtual VTKViewer_UnScaledActor* GetArrow() { return myArrowActor; }
223 VTKViewer_Trihedron::TVisibility myVisibility;
231 float myDir[3], myRot[3];
233 /*! VTKViewer_LineActor actor pointer
235 VTKViewer_LineActor *myLineActor;
237 /*! VTKViewer_UnScaledActor actor pointer
239 VTKViewer_UnScaledActor *myArrowActor;
241 /*! VTKViewer_UnScaledActor actor pointer
243 VTKViewer_UnScaledActor *myLabelActor;
245 /*! \li myMapper[0] - for the Line pipe-line representation
246 * \li myMapper[1] - for the Arrow pipe-line representation
247 * \li myMapper[2] - for the Label pipe-line representation
249 vtkPolyDataMapper *myMapper[3];
251 /*! vtkLineSource pointer (Line)
253 vtkLineSource *myLineSource;
255 /*! vtkConeSource pointer (Arrow)
257 vtkConeSource *myConeSource;
259 /*! VTKViewer_VectorText pointer (Label)
261 VTKViewer_VectorText* myVectorText;