1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef VTKVIEWER_TRIHEDRON_H
20 #define VTKVIEWER_TRIHEDRON_H
22 #include "VTKViewer.h"
24 #include <vtkObject.h>
25 #include <vtkFollower.h>
28 class vtkActorCollection;
31 class vtkPolyDataMapper;
36 class VTKViewer_VectorText;
38 /*! \class vtkFollower
39 * See <a href="http://www.vtk.org/">vtk documentation</a>
41 /*!a subclass of actor that always faces the camera
44 class VTKVIEWER_EXPORT VTKViewer_UnScaledActor: public vtkFollower
46 VTKViewer_UnScaledActor(const VTKViewer_UnScaledActor&);
50 vtkTypeMacro(VTKViewer_UnScaledActor,vtkFollower);
52 /*!Create new instance of VTKViewer_UnScaledActor.*/
53 static VTKViewer_UnScaledActor *New();
55 virtual vtkFloatingPointType* GetBounds();
56 virtual void SetSize(int theSize);
57 virtual void Render(vtkRenderer *theRenderer);
60 VTKViewer_UnScaledActor();
61 /*!Destructor. Do nothing.*/
62 ~VTKViewer_UnScaledActor(){}
67 /*!a subclass of actor that always faces the camera
70 class VTKVIEWER_EXPORT VTKViewer_LineActor: public vtkFollower
72 VTKViewer_LineActor(const VTKViewer_LineActor&);
76 vtkTypeMacro(VTKViewer_LineActor,vtkFollower);
78 /*!Create new instance of VTKViewer_LineActor.*/
79 static VTKViewer_LineActor *New();
82 * \param theLabelActor - VTKViewer_UnScaledActor
84 void SetLabelActor(VTKViewer_UnScaledActor* theLabelActor);
87 * \param theLabelActor - VTKViewer_UnScaledActor
89 void SetArrowActor(VTKViewer_UnScaledActor* theLabelActor);
91 virtual void Render(vtkRenderer *theRenderer);
95 /*! Constructor which sets \a LabelActor and \a ArrowActor to NULL*/
96 VTKViewer_LineActor(){
101 /*!Destructor which call SetLabelActor(NULL) and SetArrowActor(NULL)*/
102 ~VTKViewer_LineActor(){
107 /*!Label actor pointer*/
108 VTKViewer_UnScaledActor* LabelActor;
110 /*!Arrow actor pointer*/
111 VTKViewer_UnScaledActor* ArrowActor;
114 /*!This class provide support trihedron object in vtk viewer.*/
115 class VTKVIEWER_EXPORT VTKVIEWER_EXPORT VTKViewer_Trihedron : public vtkObject
118 /*!Initialize fields by default values.*/
119 VTKViewer_Trihedron();
121 /*!Const copy constructor.*/
122 VTKViewer_Trihedron(const VTKViewer_Trihedron&);
124 /*!Destructor. Remove all fileds.*/
125 virtual ~VTKViewer_Trihedron();
128 /*!vtk type macros.*/
129 vtkTypeMacro(VTKViewer_Trihedron,vtkObject);
131 /*!Create new instance of VTKViewer_Trihedron.*/
132 static VTKViewer_Trihedron *New();
134 /*!Sets size of trihedron.
135 * \param theSize - vtkFloatingPointType value
137 virtual void SetSize(vtkFloatingPointType theSize);
139 /*! Get size of trihedron.
140 * \retval mySize - vtkFloatingPointType value
142 virtual vtkFloatingPointType GetSize() { return mySize;}
144 enum TVisibility{eOff, eOn, eOnlyLineOn};
146 /*! Sets visibility for all Axis to \a theVis*/
147 virtual void SetVisibility(TVisibility theVis);
149 /*! OFF visibility for all Axis.*/
150 virtual void VisibilityOff() { SetVisibility(eOff);}
152 /*! ON visibility for all Axis.*/
153 virtual void VisibilityOn() { SetVisibility(eOn);}
155 /*! Gets visibility of myAxis[0] actor.*/
156 virtual TVisibility GetVisibility();
158 /*! Add to render all Axis
159 * \param theRenderer - vtkRenderer pointer
161 virtual void AddToRender(vtkRenderer* theRenderer);
163 /*! Remove all actors from \a theRenderer which are in myPresent.
164 * \param theRenderer - vtkRenderer pointer
166 virtual void RemoveFromRender(vtkRenderer* theRenderer);
168 /*! Return count of visible actors.
169 * \param theRenderer - vtkRenderer pointer
171 virtual int GetVisibleActorCount(vtkRenderer* theRenderer);
174 /*! Actor collection*/
175 vtkActorCollection* myPresent;
177 /*! \li myAxis[0] - X Axis actor
178 * \li myAxis[1] - Y Axis actor
179 * \li myAxis[2] - Z Axis actor
181 VTKViewer_Axis* myAxis[3];
183 /*! Common size for trihedron, for each axis.*/
184 vtkFloatingPointType mySize;
187 /*!The base class for concreate Axis.
188 * Its only duty is to give correct initialization and destruction
191 class VTKVIEWER_EXPORT VTKViewer_Axis : public vtkObject
195 VTKViewer_Axis(const VTKViewer_Axis&);
196 virtual ~VTKViewer_Axis();
199 /*!vtk type macros.*/
200 vtkTypeMacro(VTKViewer_Axis,vtkObject);
202 /*! Add to \a theRenderer actors: myLineActor,myLabelActor,myArrowActor
204 virtual void AddToRender(vtkRenderer* theRenderer);
205 virtual void RemoveFromRender(vtkRenderer* theRenderer);
207 /*! Sets visibility for actors: myLineActor,myLabelActor,myArrowActor
209 virtual void SetVisibility(VTKViewer_Trihedron::TVisibility theVis);
211 /*! Return visibility of VTKViewer_Axis
212 * \retval myVisibility
214 virtual VTKViewer_Trihedron::TVisibility GetVisibility() { return myVisibility; }
216 /*! Set camera for myLabelActor
218 virtual void SetCamera(vtkCamera* theCamera);
220 /*! Sets \a theProperty for actors: myLineActor,myLabelActor,myArrowActor
222 virtual void SetProperty(vtkProperty* theProperty);
224 /*! Set size of VTKViewer_Axis
226 virtual void SetSize(vtkFloatingPointType theSize);
229 * \retval Return myLabelActor.
231 virtual VTKViewer_UnScaledActor* GetLabel() { return myLabelActor; }
234 * \retval Return myArrowActor
236 virtual VTKViewer_UnScaledActor* GetArrow() { return myArrowActor; }
241 VTKViewer_Trihedron::TVisibility myVisibility;
249 vtkFloatingPointType myDir[3], myRot[3];
251 /*! VTKViewer_LineActor actor pointer
253 VTKViewer_LineActor *myLineActor;
255 /*! VTKViewer_UnScaledActor actor pointer
257 VTKViewer_UnScaledActor *myArrowActor;
259 /*! VTKViewer_UnScaledActor actor pointer
261 VTKViewer_UnScaledActor *myLabelActor;
263 /*! \li myMapper[0] - for the Line pipe-line representation
264 * \li myMapper[1] - for the Arrow pipe-line representation
265 * \li myMapper[2] - for the Label pipe-line representation
267 vtkPolyDataMapper *myMapper[3];
269 /*! vtkLineSource pointer (Line)
271 vtkLineSource *myLineSource;
273 /*! vtkConeSource pointer (Arrow)
275 vtkConeSource *myConeSource;
277 /*! VTKViewer_VectorText pointer (Label)
279 VTKViewer_VectorText* myVectorText;