Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VTKViewer_Trihedron.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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, or (at your option) any later version.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 #ifndef VTKVIEWER_TRIHEDRON_H
24 #define VTKVIEWER_TRIHEDRON_H
25 
26 #include "VTKViewer.h"
27 
28 #include <vtkObject.h>
29 #include <vtkFollower.h>
30 #include <vtkVersion.h>
31 
32 class vtkRenderer;
33 class vtkActorCollection;
34 class vtkCamera;
35 class vtkProperty;
36 class vtkPolyDataMapper;
37 class vtkLineSource;
38 class vtkConeSource;
39 class vtkVectorText;
40 class vtkTextActor;
41 class vtkTextMapper;
42 
43 class VTKViewer_Axis;
44 
45 #if !defined(VTK_XVERSION)
46 #define VTK_XVERSION (VTK_MAJOR_VERSION<<16)+(VTK_MINOR_VERSION<<8)+(VTK_BUILD_VERSION)
47 #endif
48 
49 // VTKViewer_UnScaledActor is temporarily replaced with simple vtkTextActor
50 // This workaround caused by the bug with disappeared labels of the trihedron
51 // reproduced after migration from qt-4.4.3 to qt-4.5.2
52 #if (VTK_XVERSION < 0x050200)
53 #define IPAL21440
54 #endif
55 
63 {
65 
66 public:
67 
68  vtkTypeMacro(VTKViewer_UnScaledActor,vtkFollower);
69 
71  static VTKViewer_UnScaledActor *New();
72 
73  virtual double* GetBounds();
74  virtual void SetSize(int theSize);
75  virtual void Render(vtkRenderer *theRenderer);
76 
77 protected:
78  VTKViewer_UnScaledActor();
81 
82  int mySize;
83 };
84 
89 {
91 
92 public:
94  vtkTypeMacro(VTKViewer_LineActor,vtkFollower);
95 
97  static VTKViewer_LineActor *New();
98 
99 #ifdef IPAL21440
100 
103  void SetLabelActor(vtkTextActor* theLabelActor);
104 #else
105 
108  void SetLabelActor(VTKViewer_UnScaledActor* theLabelActor);
109 #endif
110 
114  void SetArrowActor(vtkFollower* theArrowActor);
115 
116  virtual void Render(vtkRenderer *theRenderer);
117 
118 protected:
119 
122  LabelActor = NULL;
123  ArrowActor = NULL;
124  }
125 
128  SetLabelActor(NULL);
129  SetArrowActor(NULL);
130  }
131 
133 #ifdef IPAL21440
134  vtkTextActor* LabelActor;
135 #else
136  VTKViewer_UnScaledActor* LabelActor;
137 #endif
138 
141 };
142 
145 {
146 protected:
149 
152 
154  virtual ~VTKViewer_Trihedron();
155 
156 public:
158  vtkTypeMacro(VTKViewer_Trihedron,vtkObject);
159 
161  static VTKViewer_Trihedron *New();
162 
166  virtual void SetSize(double theSize);
167 
171  virtual double GetSize() { return mySize;}
172 
173  enum TVisibility{eOff, eOn, eOnlyLineOn};
174 
176  virtual void SetVisibility(TVisibility theVis);
177 
179  virtual void VisibilityOff() { SetVisibility(eOff);}
180 
182  virtual void VisibilityOn() { SetVisibility(eOn);}
183 
185  virtual TVisibility GetVisibility();
186 
190  virtual void AddToRender(vtkRenderer* theRenderer);
191 
195  virtual void RemoveFromRender(vtkRenderer* theRenderer);
196 
200  virtual int GetVisibleActorCount(vtkRenderer* theRenderer);
201 
206  virtual bool OwnActor(const vtkActor* theActor);
207 
208 protected:
210  vtkActorCollection* myPresent;
211 
216  VTKViewer_Axis* myAxis[3];
217 
219  double mySize;
220 };
221 
227 {
228 protected:
229  VTKViewer_Axis();
231  virtual ~VTKViewer_Axis();
232 
233 public:
235  vtkTypeMacro(VTKViewer_Axis,vtkObject);
236 
239  virtual void AddToRender(vtkRenderer* theRenderer);
240  virtual void RemoveFromRender(vtkRenderer* theRenderer);
241 
244  virtual void SetVisibility(VTKViewer_Trihedron::TVisibility theVis);
245 
249  virtual VTKViewer_Trihedron::TVisibility GetVisibility() { return myVisibility; }
250 
253  virtual void SetCamera(vtkCamera* theCamera);
254 
260  virtual void SetColor(double theRed, double theGreen, double theBlue);
261 
264  virtual void SetSize(double theSize);
265 
269 #ifdef IPAL21440
270  virtual vtkTextActor* GetLabel() { return myLabelActor; }
271 #else
272  virtual VTKViewer_UnScaledActor* GetLabel() { return myLabelActor; }
273 #endif
274 
278  virtual vtkFollower* GetArrow() { return myArrowActor; }
279 
284  virtual bool OwnActor(const vtkActor* theActor);
285 
286 protected:
290 
297  double myDir[3], myRot[3];
298 
302 
306 
309 #ifdef IPAL21440
310  vtkTextActor *myLabelActor;
311 #else
312  VTKViewer_UnScaledActor *myLabelActor;
313 #endif
314 
319  vtkPolyDataMapper *myMapper[3];
320 
323  vtkLineSource *myLineSource;
324 
327  vtkConeSource *myConeSource;
328 
329 #ifdef IPAL21440
330 
332  vtkTextMapper *myTextMapper;
333 #else
334 
336  vtkVectorText* myVectorText;
337 #endif
338 };
339 
340 #endif