1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #ifndef VTKVIEWER_TRIHEDRON_H
23 #define VTKVIEWER_TRIHEDRON_H
25 #include "VTKViewer.h"
27 #include <vtkObject.h>
28 #include <vtkFollower.h>
31 class vtkActorCollection;
34 class vtkPolyDataMapper;
41 /*! \class vtkFollower
42 * See <a href="http://www.vtk.org/">vtk documentation</a>
44 /*!a subclass of actor that always faces the camera
47 class VTKVIEWER_EXPORT VTKViewer_UnScaledActor: public vtkFollower
49 VTKViewer_UnScaledActor(const VTKViewer_UnScaledActor&);
53 vtkTypeMacro(VTKViewer_UnScaledActor,vtkFollower);
55 /*!Create new instance of VTKViewer_UnScaledActor.*/
56 static VTKViewer_UnScaledActor *New();
58 virtual vtkFloatingPointType* GetBounds();
59 virtual void SetSize(int theSize);
60 virtual void Render(vtkRenderer *theRenderer);
63 VTKViewer_UnScaledActor();
64 /*!Destructor. Do nothing.*/
65 ~VTKViewer_UnScaledActor(){}
70 /*!a subclass of actor that always faces the camera
73 class VTKVIEWER_EXPORT VTKViewer_LineActor: public vtkFollower
75 VTKViewer_LineActor(const VTKViewer_LineActor&);
79 vtkTypeMacro(VTKViewer_LineActor,vtkFollower);
81 /*!Create new instance of VTKViewer_LineActor.*/
82 static VTKViewer_LineActor *New();
85 * \param theLabelActor - VTKViewer_UnScaledActor
87 void SetLabelActor(VTKViewer_UnScaledActor* theLabelActor);
90 * \param theLabelActor - VTKViewer_UnScaledActor
92 void SetArrowActor(vtkFollower* theArrowActor);
94 virtual void Render(vtkRenderer *theRenderer);
98 /*! Constructor which sets \a LabelActor and \a ArrowActor to NULL*/
99 VTKViewer_LineActor(){
104 /*!Destructor which call SetLabelActor(NULL) and SetArrowActor(NULL)*/
105 ~VTKViewer_LineActor(){
110 /*!Label actor pointer*/
111 VTKViewer_UnScaledActor* LabelActor;
113 /*!Arrow actor pointer*/
114 vtkFollower* ArrowActor;
117 /*!This class provide support trihedron object in vtk viewer.*/
118 class VTKVIEWER_EXPORT VTKViewer_Trihedron : public vtkObject
121 /*!Initialize fields by default values.*/
122 VTKViewer_Trihedron();
124 /*!Const copy constructor.*/
125 VTKViewer_Trihedron(const VTKViewer_Trihedron&);
127 /*!Destructor. Remove all fileds.*/
128 virtual ~VTKViewer_Trihedron();
131 /*!vtk type macros.*/
132 vtkTypeMacro(VTKViewer_Trihedron,vtkObject);
134 /*!Create new instance of VTKViewer_Trihedron.*/
135 static VTKViewer_Trihedron *New();
137 /*!Sets size of trihedron.
138 * \param theSize - vtkFloatingPointType value
140 virtual void SetSize(vtkFloatingPointType theSize);
142 /*! Get size of trihedron.
143 * \retval mySize - vtkFloatingPointType value
145 virtual vtkFloatingPointType GetSize() { return mySize;}
147 enum TVisibility{eOff, eOn, eOnlyLineOn};
149 /*! Sets visibility for all Axis to \a theVis*/
150 virtual void SetVisibility(TVisibility theVis);
152 /*! OFF visibility for all Axis.*/
153 virtual void VisibilityOff() { SetVisibility(eOff);}
155 /*! ON visibility for all Axis.*/
156 virtual void VisibilityOn() { SetVisibility(eOn);}
158 /*! Gets visibility of myAxis[0] actor.*/
159 virtual TVisibility GetVisibility();
161 /*! Add to render all Axis
162 * \param theRenderer - vtkRenderer pointer
164 virtual void AddToRender(vtkRenderer* theRenderer);
166 /*! Remove all actors from \a theRenderer which are in myPresent.
167 * \param theRenderer - vtkRenderer pointer
169 virtual void RemoveFromRender(vtkRenderer* theRenderer);
171 /*! Return count of visible actors.
172 * \param theRenderer - vtkRenderer pointer
174 virtual int GetVisibleActorCount(vtkRenderer* theRenderer);
176 /*! Check if actor belongs to the trihedron object
177 * \param theActor - vtkActor pointer
178 * \retval Return true if the actor belongs to the trihedron object
180 virtual bool OwnActor(const vtkActor* theActor);
183 /*! Actor collection*/
184 vtkActorCollection* myPresent;
186 /*! \li myAxis[0] - X Axis actor
187 * \li myAxis[1] - Y Axis actor
188 * \li myAxis[2] - Z Axis actor
190 VTKViewer_Axis* myAxis[3];
192 /*! Common size for trihedron, for each axis.*/
193 vtkFloatingPointType mySize;
196 /*!The base class for concreate Axis.
197 * Its only duty is to give correct initialization and destruction
200 class VTKVIEWER_EXPORT VTKViewer_Axis : public vtkObject
204 VTKViewer_Axis(const VTKViewer_Axis&);
205 virtual ~VTKViewer_Axis();
208 /*!vtk type macros.*/
209 vtkTypeMacro(VTKViewer_Axis,vtkObject);
211 /*! Add to \a theRenderer actors: myLineActor,myLabelActor,myArrowActor
213 virtual void AddToRender(vtkRenderer* theRenderer);
214 virtual void RemoveFromRender(vtkRenderer* theRenderer);
216 /*! Sets visibility for actors: myLineActor,myLabelActor,myArrowActor
218 virtual void SetVisibility(VTKViewer_Trihedron::TVisibility theVis);
220 /*! Return visibility of VTKViewer_Axis
221 * \retval myVisibility
223 virtual VTKViewer_Trihedron::TVisibility GetVisibility() { return myVisibility; }
225 /*! Set camera for myLabelActor
227 virtual void SetCamera(vtkCamera* theCamera);
229 /*! Sets \a theProperty for actors: myLineActor,myLabelActor,myArrowActor
231 virtual void SetProperty(vtkProperty* theProperty);
233 /*! Set size of VTKViewer_Axis
235 virtual void SetSize(vtkFloatingPointType theSize);
238 * \retval Return myLabelActor.
240 virtual VTKViewer_UnScaledActor* GetLabel() { return myLabelActor; }
243 * \retval Return myArrowActor
245 virtual vtkFollower* GetArrow() { return myArrowActor; }
247 /*! Check if actor belongs to the axis object
248 * \param theActor - vtkActor pointer
249 * \retval Return true if the actor belongs to the axis object
251 virtual bool OwnActor(const vtkActor* theActor);
256 VTKViewer_Trihedron::TVisibility myVisibility;
264 vtkFloatingPointType myDir[3], myRot[3];
266 /*! VTKViewer_LineActor actor pointer
268 VTKViewer_LineActor *myLineActor;
270 /*! vtkFollower actor pointer
272 vtkFollower *myArrowActor;
274 /*! VTKViewer_UnScaledActor actor pointer
276 VTKViewer_UnScaledActor *myLabelActor;
278 /*! \li myMapper[0] - for the Line pipe-line representation
279 * \li myMapper[1] - for the Arrow pipe-line representation
280 * \li myMapper[2] - for the Label pipe-line representation
282 vtkPolyDataMapper *myMapper[3];
284 /*! vtkLineSource pointer (Line)
286 vtkLineSource *myLineSource;
288 /*! vtkConeSource pointer (Arrow)
290 vtkConeSource *myConeSource;
292 /*! VTKViewer_VectorText pointer (Label)
294 vtkVectorText* myVectorText;