Version: 9.12.0
VTKViewer_Trihedron.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, 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 
69 
70 
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:
81 
82  int mySize;
83 };
84 
89 {
91 
92 public:
95 
96 
97  static VTKViewer_LineActor *New();
98 
99 #ifdef IPAL21440
103  void SetLabelActor(vtkTextActor* theLabelActor);
104 #else
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
135 #else
137 #endif
138 
141 };
142 
145 {
146 protected:
149 
152 
154  virtual ~VTKViewer_Trihedron();
155 
156 public:
159 
160 
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:
236 
237 
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
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
332  vtkTextMapper *myTextMapper;
333 #else
336  vtkVectorText* myVectorText;
337 #endif
338 };
339 
340 #endif
#define VTKVIEWER_EXPORT
Definition: VTKViewer.h:33
vtkTextActor
Definition: VTKViewer_Trihedron.cxx:110
LabelActor
Definition: VTKViewer_Trihedron.cxx:110
Definition: VTKViewer_Trihedron.h:227
VTKViewer_LineActor * myLineActor
Definition: VTKViewer_Trihedron.h:301
VTKViewer_Axis(const VTKViewer_Axis &)
vtkConeSource * myConeSource
Definition: VTKViewer_Trihedron.h:327
VTKViewer_Trihedron::TVisibility myVisibility
Definition: VTKViewer_Trihedron.h:289
virtual vtkFollower * GetArrow()
Definition: VTKViewer_Trihedron.h:278
vtkTextActor * myLabelActor
Definition: VTKViewer_Trihedron.h:310
virtual vtkTextActor * GetLabel()
Definition: VTKViewer_Trihedron.h:270
vtkFollower * myArrowActor
Definition: VTKViewer_Trihedron.h:305
virtual VTKViewer_Trihedron::TVisibility GetVisibility()
Definition: VTKViewer_Trihedron.h:249
vtkTextMapper * myTextMapper
Definition: VTKViewer_Trihedron.h:332
vtkTypeMacro(VTKViewer_Axis, vtkObject) virtual void AddToRender(vtkRenderer *theRenderer)
vtkLineSource * myLineSource
Definition: VTKViewer_Trihedron.h:323
Definition: VTKViewer_Trihedron.h:89
~VTKViewer_LineActor()
Definition: VTKViewer_Trihedron.h:127
virtual void Render(vtkRenderer *theRenderer)
vtkTextActor * LabelActor
Definition: VTKViewer_Trihedron.h:134
VTKViewer_LineActor(const VTKViewer_LineActor &)
vtkTypeMacro(VTKViewer_LineActor, vtkFollower) static VTKViewer_LineActor *New()
void SetArrowActor(vtkFollower *theArrowActor)
vtkFollower * ArrowActor
Definition: VTKViewer_Trihedron.h:140
void SetLabelActor(vtkTextActor *theLabelActor)
VTKViewer_LineActor()
Definition: VTKViewer_Trihedron.h:121
Definition: VTKViewer_Trihedron.h:145
double mySize
Definition: VTKViewer_Trihedron.h:219
TVisibility
Definition: VTKViewer_Trihedron.h:173
@ eOff
Definition: VTKViewer_Trihedron.h:173
vtkActorCollection * myPresent
Definition: VTKViewer_Trihedron.h:210
virtual void VisibilityOn()
Definition: VTKViewer_Trihedron.h:182
virtual double GetSize()
Definition: VTKViewer_Trihedron.h:171
vtkTypeMacro(VTKViewer_Trihedron, vtkObject) static VTKViewer_Trihedron *New()
virtual void VisibilityOff()
Definition: VTKViewer_Trihedron.h:179
VTKViewer_Trihedron(const VTKViewer_Trihedron &)
Definition: VTKViewer_Trihedron.h:63
VTKViewer_UnScaledActor(const VTKViewer_UnScaledActor &)
vtkTypeMacro(VTKViewer_UnScaledActor, vtkFollower) static VTKViewer_UnScaledActor *New()
~VTKViewer_UnScaledActor()
Definition: VTKViewer_Trihedron.h:80
int mySize
Definition: VTKViewer_Trihedron.h:82