1 | /*========================================================================= |
---|
2 | |
---|
3 | Program: Visualization Toolkit |
---|
4 | Module: vtkRpCubeAxesActor.h |
---|
5 | Language: C++ |
---|
6 | Date: $Date$ |
---|
7 | Version: $Revision$ |
---|
8 | Thanks: Kathleen Bonnell, B Division, Lawrence Livermore Nat'l Laboratory |
---|
9 | |
---|
10 | Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen |
---|
11 | All rights reserve |
---|
12 | See Copyright.txt or http://www.kitware.com/Copyright.htm for details. |
---|
13 | |
---|
14 | This software is distributed WITHOUT ANY WARRANTY; without even |
---|
15 | the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
---|
16 | PURPOSE. See the above copyright notice for more information. |
---|
17 | =========================================================================*/ |
---|
18 | // .NAME vtkRpCubeAxesActor - create a plot of a bounding box edges - |
---|
19 | // used for navigation |
---|
20 | // .SECTION Description |
---|
21 | // vtkRpCubeAxesActor is a composite actor that draws axes of the |
---|
22 | // bounding box of an input dataset. The axes include labels and titles |
---|
23 | // for the x-y-z axes. The algorithm selects which axes to draw based |
---|
24 | // on the user-defined 'fly' mode. (STATIC is default). |
---|
25 | // 'STATIC' constructs axes from all edges of the bounding box. |
---|
26 | // 'CLOSEST_TRIAD' consists of the three axes x-y-z forming a triad that |
---|
27 | // lies closest to the specified camera. |
---|
28 | // 'FURTHEST_TRIAD' consists of the three axes x-y-z forming a triad that |
---|
29 | // lies furthest from the specified camera. |
---|
30 | // 'OUTER_EDGES' is constructed from edges that are on the "exterior" of the |
---|
31 | // bounding box, exterior as determined from examining outer edges of the |
---|
32 | // bounding box in projection (display) space. |
---|
33 | // |
---|
34 | // To use this object you must define a bounding box and the camera used |
---|
35 | // to render the vtkRpCubeAxesActor. You can optionally turn on/off labels, |
---|
36 | // ticks, gridlines, and set tick location, number of labels, and text to |
---|
37 | // use for axis-titles. A 'corner offset' can also be set. This allows |
---|
38 | // the axes to be set partially away from the actual bounding box to perhaps |
---|
39 | // prevent overlap of labels between the various axes. |
---|
40 | // |
---|
41 | // The Bounds instance variable (an array of six doubles) is used to determine |
---|
42 | // the bounding box. |
---|
43 | // |
---|
44 | // .SECTION Thanks |
---|
45 | // This class was written by: |
---|
46 | // Hank Childs, Kathleen Bonnell, Amy Squillacote, Brad Whitlock, Will Schroeder, |
---|
47 | // Eric Brugger, Daniel Aguilera, Claire Guilbaud, Nicolas Dolegieviez, |
---|
48 | // Aashish Chaudhary, Philippe Pebay, David Gobbi, David Partyka, Utkarsh Ayachit |
---|
49 | // David Cole, Francois Bertel, and Mark Olesen |
---|
50 | // Part of this work was supported by CEA/DIF - Commissariat a l'Energie Atomique, |
---|
51 | // Centre DAM Ile-De-France, BP12, F-91297 Arpajon, France. |
---|
52 | // |
---|
53 | // .section See Also |
---|
54 | // vtkActor vtkAxisActor vtkCubeAxesActor2D |
---|
55 | |
---|
56 | #ifndef vtkRpCubeAxesActor_h |
---|
57 | #define vtkRpCubeAxesActor_h |
---|
58 | |
---|
59 | #define VTK_FLY_OUTER_EDGES 0 |
---|
60 | #define VTK_FLY_CLOSEST_TRIAD 1 |
---|
61 | #define VTK_FLY_FURTHEST_TRIAD 2 |
---|
62 | #define VTK_FLY_STATIC_TRIAD 3 |
---|
63 | #define VTK_FLY_STATIC_EDGES 4 |
---|
64 | |
---|
65 | #define VTK_TICKS_INSIDE 0 |
---|
66 | #define VTK_TICKS_OUTSIDE 1 |
---|
67 | #define VTK_TICKS_BOTH 2 |
---|
68 | |
---|
69 | #define VTK_GRID_LINES_ALL 0 |
---|
70 | #define VTK_GRID_LINES_CLOSEST 1 |
---|
71 | #define VTK_GRID_LINES_FURTHEST 2 |
---|
72 | |
---|
73 | #define NUMBER_OF_ALIGNED_AXIS 4 |
---|
74 | |
---|
75 | #include "vtkRenderingAnnotationModule.h" // For export macro |
---|
76 | #include "vtkActor.h" |
---|
77 | |
---|
78 | class vtkRpAxisActor; |
---|
79 | class vtkCamera; |
---|
80 | class vtkTextProperty; |
---|
81 | class vtkStringArray; |
---|
82 | |
---|
83 | class VTKRENDERINGANNOTATION_EXPORT vtkRpCubeAxesActor : public vtkActor |
---|
84 | { |
---|
85 | public: |
---|
86 | vtkTypeMacro(vtkRpCubeAxesActor,vtkActor); |
---|
87 | void PrintSelf(ostream& os, vtkIndent indent); |
---|
88 | |
---|
89 | // Description: |
---|
90 | // Instantiate object with label format "6.3g" and the number of labels |
---|
91 | // per axis set to 3. |
---|
92 | static vtkRpCubeAxesActor *New(); |
---|
93 | |
---|
94 | // Description: |
---|
95 | // Draw the axes as per the vtkProp superclass' API. |
---|
96 | virtual int RenderOpaqueGeometry(vtkViewport*); |
---|
97 | virtual int RenderTranslucentGeometry(vtkViewport*); |
---|
98 | virtual int RenderTranslucentPolygonalGeometry(vtkViewport*); |
---|
99 | virtual int RenderOverlay(vtkViewport*); |
---|
100 | int HasTranslucentPolygonalGeometry(); |
---|
101 | |
---|
102 | // Description: |
---|
103 | // Gets/Sets the RebuildAxes flag |
---|
104 | vtkSetMacro( RebuildAxes, bool ); |
---|
105 | vtkGetMacro( RebuildAxes, bool ); |
---|
106 | |
---|
107 | // Description: |
---|
108 | // Explicitly specify the region in space around which to draw the bounds. |
---|
109 | // The bounds is used only when no Input or Prop is specified. The bounds |
---|
110 | // are specified according to (xmin,xmax, ymin,ymax, zmin,zmax), making |
---|
111 | // sure that the min's are less than the max's. |
---|
112 | vtkSetVector6Macro(Bounds,double); |
---|
113 | vtkGetVector6Macro(Bounds,double); |
---|
114 | |
---|
115 | // Description: |
---|
116 | // Method used to properly return the bounds of the cube axis itself with all |
---|
117 | // its labels. |
---|
118 | virtual void GetRenderedBounds(double rBounds[6]); |
---|
119 | virtual double* GetRenderedBounds(); |
---|
120 | |
---|
121 | // Description: |
---|
122 | // Explicitly specify the range of each axes that's used to define the prop. |
---|
123 | // The default, (if you do not use these methods) is to use the bounds |
---|
124 | // specified, or use the bounds of the Input Prop if one is specified. This |
---|
125 | // method allows you to separate the notion of extent of the axes in physical |
---|
126 | // space (bounds) and the extent of the values it represents. In other words, |
---|
127 | // you can have the ticks and labels show a different range. |
---|
128 | vtkSetVector2Macro( XAxisRange, double ); |
---|
129 | vtkSetVector2Macro( YAxisRange, double ); |
---|
130 | vtkSetVector2Macro( ZAxisRange, double ); |
---|
131 | vtkGetVector2Macro( XAxisRange, double ); |
---|
132 | vtkGetVector2Macro( YAxisRange, double ); |
---|
133 | // Description |
---|
134 | // Explicitly specify the axis labels along an axis as an array of strings |
---|
135 | // instead of using the values. |
---|
136 | vtkStringArray* GetAxisLabels(int axis); |
---|
137 | void SetAxisLabels(int axis, vtkStringArray* value); |
---|
138 | |
---|
139 | vtkGetVector2Macro( ZAxisRange, double ); |
---|
140 | |
---|
141 | // Description: |
---|
142 | // Explicitly specify the screen size of title and label text. |
---|
143 | // ScreenSize determines the size of the text in terms of screen |
---|
144 | // pixels. Default is 10.0. |
---|
145 | void SetScreenSize(double screenSize); |
---|
146 | vtkGetMacro(ScreenSize, double); |
---|
147 | |
---|
148 | // Description: |
---|
149 | // Explicitly specify the distance between labels and the axis. |
---|
150 | // Default is 20.0. |
---|
151 | void SetLabelOffset(double offset); |
---|
152 | vtkGetMacro(LabelOffset, double); |
---|
153 | |
---|
154 | // Description: |
---|
155 | // Explicitly specify the distance between title and labels. |
---|
156 | // Default is 20.0. |
---|
157 | void SetTitleOffset(double offset); |
---|
158 | vtkGetMacro(TitleOffset, double); |
---|
159 | |
---|
160 | // Description: |
---|
161 | // Set/Get the camera to perform scaling and translation of the |
---|
162 | // vtkRpCubeAxesActor. |
---|
163 | virtual void SetCamera(vtkCamera*); |
---|
164 | vtkGetObjectMacro(Camera,vtkCamera); |
---|
165 | |
---|
166 | // Description: |
---|
167 | // Specify a mode to control how the axes are drawn: either static, |
---|
168 | // closest triad, furthest triad or outer edges in relation to the |
---|
169 | // camera position. |
---|
170 | vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_STATIC_EDGES); |
---|
171 | vtkGetMacro(FlyMode, int); |
---|
172 | void SetFlyModeToOuterEdges() |
---|
173 | {this->SetFlyMode(VTK_FLY_OUTER_EDGES);}; |
---|
174 | void SetFlyModeToClosestTriad() |
---|
175 | {this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD);}; |
---|
176 | void SetFlyModeToFurthestTriad() |
---|
177 | {this->SetFlyMode(VTK_FLY_FURTHEST_TRIAD);}; |
---|
178 | void SetFlyModeToStaticTriad() |
---|
179 | {this->SetFlyMode(VTK_FLY_STATIC_TRIAD);}; |
---|
180 | void SetFlyModeToStaticEdges() |
---|
181 | {this->SetFlyMode(VTK_FLY_STATIC_EDGES);}; |
---|
182 | |
---|
183 | // Description: |
---|
184 | // Set/Get the labels for the x, y, and z axes. By default, |
---|
185 | // use "X-Axis", "Y-Axis" and "Z-Axis". |
---|
186 | vtkSetStringMacro(XTitle); |
---|
187 | vtkGetStringMacro(XTitle); |
---|
188 | vtkSetStringMacro(XUnits); |
---|
189 | vtkGetStringMacro(XUnits); |
---|
190 | vtkSetStringMacro(YTitle); |
---|
191 | vtkGetStringMacro(YTitle); |
---|
192 | vtkSetStringMacro(YUnits); |
---|
193 | vtkGetStringMacro(YUnits); |
---|
194 | vtkSetStringMacro(ZTitle); |
---|
195 | vtkGetStringMacro(ZTitle); |
---|
196 | vtkSetStringMacro(ZUnits); |
---|
197 | vtkGetStringMacro(ZUnits); |
---|
198 | |
---|
199 | // Description: |
---|
200 | // Set/Get the format with which to print the labels on each of the |
---|
201 | // x-y-z axes. |
---|
202 | vtkSetStringMacro(XLabelFormat); |
---|
203 | vtkGetStringMacro(XLabelFormat); |
---|
204 | vtkSetStringMacro(YLabelFormat); |
---|
205 | vtkGetStringMacro(YLabelFormat); |
---|
206 | vtkSetStringMacro(ZLabelFormat); |
---|
207 | vtkGetStringMacro(ZLabelFormat); |
---|
208 | |
---|
209 | // Description: |
---|
210 | // Set/Get the inertial factor that controls how often (i.e, how |
---|
211 | // many renders) the axes can switch position (jump from one axes |
---|
212 | // to another). |
---|
213 | vtkSetClampMacro(Inertia, int, 1, VTK_INT_MAX); |
---|
214 | vtkGetMacro(Inertia, int); |
---|
215 | |
---|
216 | // Description: |
---|
217 | // Specify an offset value to "pull back" the axes from the corner at |
---|
218 | // which they are joined to avoid overlap of axes labels. The |
---|
219 | // "CornerOffset" is the fraction of the axis length to pull back. |
---|
220 | vtkSetMacro(CornerOffset, double); |
---|
221 | vtkGetMacro(CornerOffset, double); |
---|
222 | |
---|
223 | // Description: |
---|
224 | // Release any graphics resources that are being consumed by this actor. |
---|
225 | // The parameter window could be used to determine which graphic |
---|
226 | // resources to release. |
---|
227 | void ReleaseGraphicsResources(vtkWindow *); |
---|
228 | |
---|
229 | // Description: |
---|
230 | // Enable and disable the use of distance based LOD for titles and labels. |
---|
231 | vtkSetMacro( EnableDistanceLOD, int ); |
---|
232 | vtkGetMacro( EnableDistanceLOD, int ); |
---|
233 | |
---|
234 | // Description:a |
---|
235 | // Set distance LOD threshold [0.0 - 1.0] for titles and labels. |
---|
236 | vtkSetClampMacro( DistanceLODThreshold, double, 0.0, 1.0 ); |
---|
237 | vtkGetMacro( DistanceLODThreshold, double); |
---|
238 | |
---|
239 | // Description: |
---|
240 | // Enable and disable the use of view angle based LOD for titles and labels. |
---|
241 | vtkSetMacro( EnableViewAngleLOD, int ); |
---|
242 | vtkGetMacro( EnableViewAngleLOD, int ); |
---|
243 | |
---|
244 | // Description: |
---|
245 | // Set view angle LOD threshold [0.0 - 1.0] for titles and labels. |
---|
246 | vtkSetClampMacro( ViewAngleLODThreshold, double, 0., 1. ); |
---|
247 | vtkGetMacro( ViewAngleLODThreshold, double ); |
---|
248 | |
---|
249 | // Description: |
---|
250 | // Turn on and off the visibility of each axis. |
---|
251 | vtkSetMacro(XAxisVisibility,int); |
---|
252 | vtkGetMacro(XAxisVisibility,int); |
---|
253 | vtkBooleanMacro(XAxisVisibility,int); |
---|
254 | vtkSetMacro(YAxisVisibility,int); |
---|
255 | vtkGetMacro(YAxisVisibility,int); |
---|
256 | vtkBooleanMacro(YAxisVisibility,int); |
---|
257 | vtkSetMacro(ZAxisVisibility,int); |
---|
258 | vtkGetMacro(ZAxisVisibility,int); |
---|
259 | vtkBooleanMacro(ZAxisVisibility,int); |
---|
260 | |
---|
261 | // Description: |
---|
262 | // Turn on and off the visibility of labels for each axis. |
---|
263 | vtkSetMacro(XAxisLabelVisibility,int); |
---|
264 | vtkGetMacro(XAxisLabelVisibility,int); |
---|
265 | vtkBooleanMacro(XAxisLabelVisibility,int); |
---|
266 | |
---|
267 | vtkSetMacro(YAxisLabelVisibility,int); |
---|
268 | vtkGetMacro(YAxisLabelVisibility,int); |
---|
269 | vtkBooleanMacro(YAxisLabelVisibility,int); |
---|
270 | |
---|
271 | vtkSetMacro(ZAxisLabelVisibility,int); |
---|
272 | vtkGetMacro(ZAxisLabelVisibility,int); |
---|
273 | vtkBooleanMacro(ZAxisLabelVisibility,int); |
---|
274 | |
---|
275 | // Description: |
---|
276 | // Turn on and off the visibility of ticks for each axis. |
---|
277 | vtkSetMacro(XAxisTickVisibility,int); |
---|
278 | vtkGetMacro(XAxisTickVisibility,int); |
---|
279 | vtkBooleanMacro(XAxisTickVisibility,int); |
---|
280 | |
---|
281 | vtkSetMacro(YAxisTickVisibility,int); |
---|
282 | vtkGetMacro(YAxisTickVisibility,int); |
---|
283 | vtkBooleanMacro(YAxisTickVisibility,int); |
---|
284 | |
---|
285 | vtkSetMacro(ZAxisTickVisibility,int); |
---|
286 | vtkGetMacro(ZAxisTickVisibility,int); |
---|
287 | vtkBooleanMacro(ZAxisTickVisibility,int); |
---|
288 | |
---|
289 | // Description: |
---|
290 | // Turn on and off the visibility of minor ticks for each axis. |
---|
291 | vtkSetMacro(XAxisMinorTickVisibility,int); |
---|
292 | vtkGetMacro(XAxisMinorTickVisibility,int); |
---|
293 | vtkBooleanMacro(XAxisMinorTickVisibility,int); |
---|
294 | |
---|
295 | vtkSetMacro(YAxisMinorTickVisibility,int); |
---|
296 | vtkGetMacro(YAxisMinorTickVisibility,int); |
---|
297 | vtkBooleanMacro(YAxisMinorTickVisibility,int); |
---|
298 | |
---|
299 | vtkSetMacro(ZAxisMinorTickVisibility,int); |
---|
300 | vtkGetMacro(ZAxisMinorTickVisibility,int); |
---|
301 | vtkBooleanMacro(ZAxisMinorTickVisibility,int); |
---|
302 | |
---|
303 | vtkSetMacro(DrawXGridlines,int); |
---|
304 | vtkGetMacro(DrawXGridlines,int); |
---|
305 | vtkBooleanMacro(DrawXGridlines,int); |
---|
306 | |
---|
307 | vtkSetMacro(DrawYGridlines,int); |
---|
308 | vtkGetMacro(DrawYGridlines,int); |
---|
309 | vtkBooleanMacro(DrawYGridlines,int); |
---|
310 | |
---|
311 | vtkSetMacro(DrawZGridlines,int); |
---|
312 | vtkGetMacro(DrawZGridlines,int); |
---|
313 | vtkBooleanMacro(DrawZGridlines,int); |
---|
314 | |
---|
315 | vtkSetMacro(DrawXInnerGridlines,int); |
---|
316 | vtkGetMacro(DrawXInnerGridlines,int); |
---|
317 | vtkBooleanMacro(DrawXInnerGridlines,int); |
---|
318 | |
---|
319 | vtkSetMacro(DrawYInnerGridlines,int); |
---|
320 | vtkGetMacro(DrawYInnerGridlines,int); |
---|
321 | vtkBooleanMacro(DrawYInnerGridlines,int); |
---|
322 | |
---|
323 | vtkSetMacro(DrawZInnerGridlines,int); |
---|
324 | vtkGetMacro(DrawZInnerGridlines,int); |
---|
325 | vtkBooleanMacro(DrawZInnerGridlines,int); |
---|
326 | |
---|
327 | vtkSetMacro(DrawXGridpolys,int); |
---|
328 | vtkGetMacro(DrawXGridpolys,int); |
---|
329 | vtkBooleanMacro(DrawXGridpolys,int); |
---|
330 | |
---|
331 | vtkSetMacro(DrawYGridpolys,int); |
---|
332 | vtkGetMacro(DrawYGridpolys,int); |
---|
333 | vtkBooleanMacro(DrawYGridpolys,int); |
---|
334 | |
---|
335 | vtkSetMacro(DrawZGridpolys,int); |
---|
336 | vtkGetMacro(DrawZGridpolys,int); |
---|
337 | vtkBooleanMacro(DrawZGridpolys,int); |
---|
338 | |
---|
339 | // Description: |
---|
340 | // Returns the text property for the title on an axis. |
---|
341 | vtkTextProperty *GetTitleTextProperty(int); |
---|
342 | |
---|
343 | // Description: |
---|
344 | // Returns the text property for the labels on an axis. |
---|
345 | vtkTextProperty *GetLabelTextProperty(int); |
---|
346 | |
---|
347 | // Description: |
---|
348 | // Get/Set axes actors properties. |
---|
349 | void SetXAxesLinesProperty(vtkProperty *); |
---|
350 | vtkProperty* GetXAxesLinesProperty(); |
---|
351 | void SetYAxesLinesProperty(vtkProperty *); |
---|
352 | vtkProperty* GetYAxesLinesProperty(); |
---|
353 | void SetZAxesLinesProperty(vtkProperty *); |
---|
354 | vtkProperty* GetZAxesLinesProperty(); |
---|
355 | |
---|
356 | // Description: |
---|
357 | // Get/Set axes (outer) gridlines actors properties. |
---|
358 | void SetXAxesGridlinesProperty(vtkProperty *); |
---|
359 | vtkProperty* GetXAxesGridlinesProperty(); |
---|
360 | void SetYAxesGridlinesProperty(vtkProperty *); |
---|
361 | vtkProperty* GetYAxesGridlinesProperty(); |
---|
362 | void SetZAxesGridlinesProperty(vtkProperty *); |
---|
363 | vtkProperty* GetZAxesGridlinesProperty(); |
---|
364 | |
---|
365 | // Description: |
---|
366 | // Get/Set axes inner gridlines actors properties. |
---|
367 | void SetXAxesInnerGridlinesProperty(vtkProperty *); |
---|
368 | vtkProperty* GetXAxesInnerGridlinesProperty(); |
---|
369 | void SetYAxesInnerGridlinesProperty(vtkProperty *); |
---|
370 | vtkProperty* GetYAxesInnerGridlinesProperty(); |
---|
371 | void SetZAxesInnerGridlinesProperty(vtkProperty *); |
---|
372 | vtkProperty* GetZAxesInnerGridlinesProperty(); |
---|
373 | |
---|
374 | // Description: |
---|
375 | // Get/Set axes gridPolys actors properties. |
---|
376 | void SetXAxesGridpolysProperty(vtkProperty *); |
---|
377 | vtkProperty* GetXAxesGridpolysProperty(); |
---|
378 | void SetYAxesGridpolysProperty(vtkProperty *); |
---|
379 | vtkProperty* GetYAxesGridpolysProperty(); |
---|
380 | void SetZAxesGridpolysProperty(vtkProperty *); |
---|
381 | vtkProperty* GetZAxesGridpolysProperty(); |
---|
382 | |
---|
383 | // Description: |
---|
384 | // Set/Get the location of ticks marks. |
---|
385 | vtkSetClampMacro(TickLocation, int, VTK_TICKS_INSIDE, VTK_TICKS_BOTH); |
---|
386 | vtkGetMacro(TickLocation, int); |
---|
387 | |
---|
388 | void SetTickLocationToInside(void) |
---|
389 | { this->SetTickLocation(VTK_TICKS_INSIDE); }; |
---|
390 | void SetTickLocationToOutside(void) |
---|
391 | { this->SetTickLocation(VTK_TICKS_OUTSIDE); }; |
---|
392 | void SetTickLocationToBoth(void) |
---|
393 | { this->SetTickLocation(VTK_TICKS_BOTH); }; |
---|
394 | |
---|
395 | void SetLabelScaling(bool, int, int, int); |
---|
396 | |
---|
397 | // Description: |
---|
398 | // Get/Set 2D mode |
---|
399 | // NB: Use vtkTextActor for titles in 2D instead of vtkAxisFollower |
---|
400 | void SetUse2DMode( int val ); |
---|
401 | int GetUse2DMode(); |
---|
402 | |
---|
403 | // Description: |
---|
404 | // For 2D mode only: save axis title positions for later use |
---|
405 | void SetSaveTitlePosition( int val ); |
---|
406 | |
---|
407 | // Description: |
---|
408 | // Provide an oriented bounded box when using AxisBaseFor. |
---|
409 | vtkSetVector6Macro(OrientedBounds,double); |
---|
410 | vtkGetVector6Macro(OrientedBounds, double); |
---|
411 | |
---|
412 | // Description: |
---|
413 | // Enable/Disable the usage of the OrientedBounds |
---|
414 | vtkSetMacro(UseOrientedBounds, int); |
---|
415 | vtkGetMacro(UseOrientedBounds, int); |
---|
416 | |
---|
417 | // Description: |
---|
418 | // Vector that should be use as the base for X |
---|
419 | vtkSetVector3Macro(AxisBaseForX,double); |
---|
420 | vtkGetVector3Macro(AxisBaseForX, double); |
---|
421 | |
---|
422 | // Description: |
---|
423 | // Vector that should be use as the base for Y |
---|
424 | vtkSetVector3Macro(AxisBaseForY,double); |
---|
425 | vtkGetVector3Macro(AxisBaseForY, double); |
---|
426 | |
---|
427 | // Description: |
---|
428 | // Vector that should be use as the base for Z |
---|
429 | vtkSetVector3Macro(AxisBaseForZ,double); |
---|
430 | vtkGetVector3Macro(AxisBaseForZ, double); |
---|
431 | |
---|
432 | // Description: |
---|
433 | // Provide a custom AxisOrigin. This point must be inside the bouding box and |
---|
434 | // will represent the point where the 3 axes will interesect |
---|
435 | vtkSetVector3Macro(AxisOrigin,double); |
---|
436 | vtkGetVector3Macro(AxisOrigin, double); |
---|
437 | |
---|
438 | // Description: |
---|
439 | // Enable/Disable the usage of the AxisOrigin |
---|
440 | vtkSetMacro(UseAxisOrigin, int); |
---|
441 | vtkGetMacro(UseAxisOrigin, int); |
---|
442 | |
---|
443 | // Description: |
---|
444 | // Specify the mode in which the cube axes should render its gridLines |
---|
445 | vtkSetMacro(GridLineLocation,int); |
---|
446 | vtkGetMacro(GridLineLocation,int); |
---|
447 | |
---|
448 | vtkSetMacro(XAutoLabelFormat,int); |
---|
449 | vtkGetMacro(XAutoLabelFormat,int); |
---|
450 | vtkBooleanMacro(XAutoLabelFormat,int); |
---|
451 | vtkSetMacro(YAutoLabelFormat,int); |
---|
452 | vtkGetMacro(YAutoLabelFormat,int); |
---|
453 | vtkBooleanMacro(YAutoLabelFormat,int); |
---|
454 | vtkSetMacro(ZAutoLabelFormat,int); |
---|
455 | vtkGetMacro(ZAutoLabelFormat,int); |
---|
456 | vtkBooleanMacro(ZAutoLabelFormat,int); |
---|
457 | |
---|
458 | protected: |
---|
459 | vtkRpCubeAxesActor(); |
---|
460 | ~vtkRpCubeAxesActor(); |
---|
461 | |
---|
462 | int LabelExponent(double min, double max); |
---|
463 | |
---|
464 | int Digits(double min, double max); |
---|
465 | |
---|
466 | double MaxOf(double, double); |
---|
467 | double MaxOf(double, double, double, double); |
---|
468 | |
---|
469 | double FFix(double); |
---|
470 | double FSign(double, double); |
---|
471 | int FRound( double fnt ); |
---|
472 | int GetNumTicks( double range, double fxt); |
---|
473 | |
---|
474 | void UpdateLabels(vtkRpAxisActor **axis, int index); |
---|
475 | |
---|
476 | double Bounds[6]; //Define bounds explicitly |
---|
477 | |
---|
478 | vtkCamera *Camera; |
---|
479 | |
---|
480 | int FlyMode; |
---|
481 | |
---|
482 | // Expose internally closest axis index computation |
---|
483 | int FindClosestAxisIndex(double pts[8][3]); |
---|
484 | |
---|
485 | // Expose internally furthest axis index computation |
---|
486 | int FindFurtherstAxisIndex(double pts[8][3]); |
---|
487 | |
---|
488 | // Expose internally the boundary edge fly mode axis index computation |
---|
489 | void FindBoundaryEdge(int &indexOfAxisX, int &indexOfAxisY, int &indexOfAxisZ, |
---|
490 | double pts[8][3]); |
---|
491 | |
---|
492 | // Description: |
---|
493 | // This will Update AxisActors with GridVisibility when those should be |
---|
494 | // dynamaic regarding the viewport. |
---|
495 | // GridLineLocation = [VTK_CLOSEST_GRID_LINES, VTK_FURTHEST_GRID_LINES] |
---|
496 | void UpdateGridLineVisibility(int axisIndex); |
---|
497 | |
---|
498 | // VTK_ALL_GRID_LINES 0 |
---|
499 | // VTK_CLOSEST_GRID_LINES 1 |
---|
500 | // VTK_FURTHEST_GRID_LINES 2 |
---|
501 | int GridLineLocation; |
---|
502 | |
---|
503 | // Description: |
---|
504 | // If enabled the actor will not be visible at a certain distance from the camera. |
---|
505 | // Default is true |
---|
506 | int EnableDistanceLOD; |
---|
507 | |
---|
508 | // Description: |
---|
509 | // Default is 0.80 |
---|
510 | // This determines at what fraction of camera far clip range, actor is not visible. |
---|
511 | double DistanceLODThreshold; |
---|
512 | |
---|
513 | // Description: |
---|
514 | // If enabled the actor will not be visible at a certain view angle. |
---|
515 | // Default is true. |
---|
516 | int EnableViewAngleLOD; |
---|
517 | |
---|
518 | // Description: |
---|
519 | // This determines at what view angle to geometry will make the geometry not visibile. |
---|
520 | // Default is 0.3. |
---|
521 | double ViewAngleLODThreshold; |
---|
522 | |
---|
523 | // Description: |
---|
524 | // Control variables for all axes |
---|
525 | // NB: [0] always for 'Major' axis during non-static fly modes. |
---|
526 | vtkRpAxisActor *XAxes[NUMBER_OF_ALIGNED_AXIS]; |
---|
527 | vtkRpAxisActor *YAxes[NUMBER_OF_ALIGNED_AXIS]; |
---|
528 | vtkRpAxisActor *ZAxes[NUMBER_OF_ALIGNED_AXIS]; |
---|
529 | |
---|
530 | bool RebuildAxes; |
---|
531 | |
---|
532 | char *XTitle; |
---|
533 | char *XUnits; |
---|
534 | char *YTitle; |
---|
535 | char *YUnits; |
---|
536 | char *ZTitle; |
---|
537 | char *ZUnits; |
---|
538 | |
---|
539 | char *ActualXLabel; |
---|
540 | char *ActualYLabel; |
---|
541 | char *ActualZLabel; |
---|
542 | |
---|
543 | int TickLocation; |
---|
544 | |
---|
545 | int XAxisVisibility; |
---|
546 | int YAxisVisibility; |
---|
547 | int ZAxisVisibility; |
---|
548 | |
---|
549 | int XAxisTickVisibility; |
---|
550 | int YAxisTickVisibility; |
---|
551 | int ZAxisTickVisibility; |
---|
552 | |
---|
553 | int XAxisMinorTickVisibility; |
---|
554 | int YAxisMinorTickVisibility; |
---|
555 | int ZAxisMinorTickVisibility; |
---|
556 | |
---|
557 | int XAxisLabelVisibility; |
---|
558 | int YAxisLabelVisibility; |
---|
559 | int ZAxisLabelVisibility; |
---|
560 | |
---|
561 | int DrawXGridlines; |
---|
562 | int DrawYGridlines; |
---|
563 | int DrawZGridlines; |
---|
564 | |
---|
565 | int DrawXInnerGridlines; |
---|
566 | int DrawYInnerGridlines; |
---|
567 | int DrawZInnerGridlines; |
---|
568 | |
---|
569 | int DrawXGridpolys; |
---|
570 | int DrawYGridpolys; |
---|
571 | int DrawZGridpolys; |
---|
572 | |
---|
573 | char *XLabelFormat; |
---|
574 | char *YLabelFormat; |
---|
575 | char *ZLabelFormat; |
---|
576 | |
---|
577 | double CornerOffset; |
---|
578 | |
---|
579 | int Inertia; |
---|
580 | |
---|
581 | int RenderCount; |
---|
582 | |
---|
583 | int InertiaLocs[3]; |
---|
584 | |
---|
585 | int RenderSomething; |
---|
586 | |
---|
587 | vtkTextProperty* TitleTextProperty[3]; |
---|
588 | vtkStringArray* AxisLabels[3]; |
---|
589 | |
---|
590 | vtkTextProperty* LabelTextProperty[3]; |
---|
591 | |
---|
592 | vtkProperty *XAxesLinesProperty; |
---|
593 | vtkProperty *YAxesLinesProperty; |
---|
594 | vtkProperty *ZAxesLinesProperty; |
---|
595 | vtkProperty *XAxesGridlinesProperty; |
---|
596 | vtkProperty *YAxesGridlinesProperty; |
---|
597 | vtkProperty *ZAxesGridlinesProperty; |
---|
598 | vtkProperty *XAxesInnerGridlinesProperty; |
---|
599 | vtkProperty *YAxesInnerGridlinesProperty; |
---|
600 | vtkProperty *ZAxesInnerGridlinesProperty; |
---|
601 | vtkProperty *XAxesGridpolysProperty; |
---|
602 | vtkProperty *YAxesGridpolysProperty; |
---|
603 | vtkProperty *ZAxesGridpolysProperty; |
---|
604 | |
---|
605 | double RenderedBounds[6]; |
---|
606 | double OrientedBounds[6]; |
---|
607 | int UseOrientedBounds; |
---|
608 | |
---|
609 | double AxisOrigin[3]; |
---|
610 | int UseAxisOrigin; |
---|
611 | |
---|
612 | double AxisBaseForX[3]; |
---|
613 | double AxisBaseForY[3]; |
---|
614 | double AxisBaseForZ[3]; |
---|
615 | |
---|
616 | private: |
---|
617 | vtkRpCubeAxesActor(const vtkRpCubeAxesActor&); // Not implemented |
---|
618 | void operator=(const vtkRpCubeAxesActor&); // Not implemented |
---|
619 | |
---|
620 | vtkSetStringMacro(ActualXLabel); |
---|
621 | vtkSetStringMacro(ActualYLabel); |
---|
622 | vtkSetStringMacro(ActualZLabel); |
---|
623 | |
---|
624 | vtkTimeStamp BuildTime; |
---|
625 | int LastUseOrientedBounds; |
---|
626 | int LastXPow; |
---|
627 | int LastYPow; |
---|
628 | int LastZPow; |
---|
629 | |
---|
630 | int UserXPow; |
---|
631 | int UserYPow; |
---|
632 | int UserZPow; |
---|
633 | |
---|
634 | bool AutoLabelScaling; |
---|
635 | int XAutoLabelFormat; |
---|
636 | int YAutoLabelFormat; |
---|
637 | int ZAutoLabelFormat; |
---|
638 | |
---|
639 | int LastXAxisDigits; |
---|
640 | int LastYAxisDigits; |
---|
641 | int LastZAxisDigits; |
---|
642 | |
---|
643 | double LastXRange[2]; |
---|
644 | double LastYRange[2]; |
---|
645 | double LastZRange[2]; |
---|
646 | double LastBounds[6]; |
---|
647 | |
---|
648 | int LastFlyMode; |
---|
649 | |
---|
650 | int RenderAxesX[NUMBER_OF_ALIGNED_AXIS]; |
---|
651 | int RenderAxesY[NUMBER_OF_ALIGNED_AXIS]; |
---|
652 | int RenderAxesZ[NUMBER_OF_ALIGNED_AXIS]; |
---|
653 | |
---|
654 | int NumberOfAxesX; |
---|
655 | int NumberOfAxesY; |
---|
656 | int NumberOfAxesZ; |
---|
657 | |
---|
658 | bool MustAdjustXValue; |
---|
659 | bool MustAdjustYValue; |
---|
660 | bool MustAdjustZValue; |
---|
661 | |
---|
662 | bool ForceXLabelReset; |
---|
663 | bool ForceYLabelReset; |
---|
664 | bool ForceZLabelReset; |
---|
665 | |
---|
666 | double XAxisRange[2]; |
---|
667 | double YAxisRange[2]; |
---|
668 | double ZAxisRange[2]; |
---|
669 | |
---|
670 | double LabelScale; |
---|
671 | double TitleScale; |
---|
672 | |
---|
673 | double ScreenSize; |
---|
674 | double LabelOffset; |
---|
675 | double TitleOffset; |
---|
676 | |
---|
677 | // Description: |
---|
678 | // Major start and delta values, in each direction. |
---|
679 | // These values are needed for inner grid lines generation |
---|
680 | double MajorStart[3]; |
---|
681 | double DeltaMajor[3]; |
---|
682 | |
---|
683 | int RenderGeometry(bool &initialRender, vtkViewport *viewport, bool checkAxisVisibility,int (vtkRpAxisActor::*renderMethod)(vtkViewport*)); |
---|
684 | |
---|
685 | void TransformBounds(vtkViewport *viewport, const double bounds[6], |
---|
686 | double pts[8][3]); |
---|
687 | void AdjustAxes(double bounds[6], |
---|
688 | double xCoords[NUMBER_OF_ALIGNED_AXIS][6], |
---|
689 | double yCoords[NUMBER_OF_ALIGNED_AXIS][6], |
---|
690 | double zCoords[NUMBER_OF_ALIGNED_AXIS][6], |
---|
691 | double xRange[2], double yRange[2], double zRange[2]); |
---|
692 | |
---|
693 | bool ComputeTickSize(double bounds[6]); |
---|
694 | void AdjustValues(const double xRange[2], |
---|
695 | const double yRange[2], |
---|
696 | const double zRange[2]); |
---|
697 | void AdjustRange(const double bounds[6]); |
---|
698 | void BuildAxes(vtkViewport *); |
---|
699 | void DetermineRenderAxes(vtkViewport *); |
---|
700 | void SetNonDependentAttributes(void); |
---|
701 | void BuildLabels(vtkRpAxisActor *axes[NUMBER_OF_ALIGNED_AXIS]); |
---|
702 | void AdjustTicksComputeRange(vtkRpAxisActor *axes[NUMBER_OF_ALIGNED_AXIS], |
---|
703 | double rangeMin, double rangeMax); |
---|
704 | |
---|
705 | void AutoScale(vtkViewport *viewport); |
---|
706 | void AutoScale(vtkViewport *viewport, vtkRpAxisActor *axes[NUMBER_OF_ALIGNED_AXIS]); |
---|
707 | double AutoScale(vtkViewport *viewport, double screenSize, double position[3]); |
---|
708 | }; |
---|
709 | |
---|
710 | |
---|
711 | #endif |
---|