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 detemines 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 | // Set/Get the camera to perform scaling and translation of the |
---|
150 | // vtkRpCubeAxesActor. |
---|
151 | virtual void SetCamera(vtkCamera*); |
---|
152 | vtkGetObjectMacro(Camera,vtkCamera); |
---|
153 | |
---|
154 | // Description: |
---|
155 | // Specify a mode to control how the axes are drawn: either static, |
---|
156 | // closest triad, furthest triad or outer edges in relation to the |
---|
157 | // camera position. |
---|
158 | vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_STATIC_EDGES); |
---|
159 | vtkGetMacro(FlyMode, int); |
---|
160 | void SetFlyModeToOuterEdges() |
---|
161 | {this->SetFlyMode(VTK_FLY_OUTER_EDGES);}; |
---|
162 | void SetFlyModeToClosestTriad() |
---|
163 | {this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD);}; |
---|
164 | void SetFlyModeToFurthestTriad() |
---|
165 | {this->SetFlyMode(VTK_FLY_FURTHEST_TRIAD);}; |
---|
166 | void SetFlyModeToStaticTriad() |
---|
167 | {this->SetFlyMode(VTK_FLY_STATIC_TRIAD);}; |
---|
168 | void SetFlyModeToStaticEdges() |
---|
169 | {this->SetFlyMode(VTK_FLY_STATIC_EDGES);}; |
---|
170 | |
---|
171 | // Description: |
---|
172 | // Set/Get the labels for the x, y, and z axes. By default, |
---|
173 | // use "X-Axis", "Y-Axis" and "Z-Axis". |
---|
174 | vtkSetStringMacro(XTitle); |
---|
175 | vtkGetStringMacro(XTitle); |
---|
176 | vtkSetStringMacro(XUnits); |
---|
177 | vtkGetStringMacro(XUnits); |
---|
178 | vtkSetStringMacro(YTitle); |
---|
179 | vtkGetStringMacro(YTitle); |
---|
180 | vtkSetStringMacro(YUnits); |
---|
181 | vtkGetStringMacro(YUnits); |
---|
182 | vtkSetStringMacro(ZTitle); |
---|
183 | vtkGetStringMacro(ZTitle); |
---|
184 | vtkSetStringMacro(ZUnits); |
---|
185 | vtkGetStringMacro(ZUnits); |
---|
186 | |
---|
187 | // Description: |
---|
188 | // Set/Get the format with which to print the labels on each of the |
---|
189 | // x-y-z axes. |
---|
190 | vtkSetStringMacro(XLabelFormat); |
---|
191 | vtkGetStringMacro(XLabelFormat); |
---|
192 | vtkSetStringMacro(YLabelFormat); |
---|
193 | vtkGetStringMacro(YLabelFormat); |
---|
194 | vtkSetStringMacro(ZLabelFormat); |
---|
195 | vtkGetStringMacro(ZLabelFormat); |
---|
196 | |
---|
197 | // Description: |
---|
198 | // Set/Get the inertial factor that controls how often (i.e, how |
---|
199 | // many renders) the axes can switch position (jump from one axes |
---|
200 | // to another). |
---|
201 | vtkSetClampMacro(Inertia, int, 1, VTK_INT_MAX); |
---|
202 | vtkGetMacro(Inertia, int); |
---|
203 | |
---|
204 | // Description: |
---|
205 | // Specify an offset value to "pull back" the axes from the corner at |
---|
206 | // which they are joined to avoid overlap of axes labels. The |
---|
207 | // "CornerOffset" is the fraction of the axis length to pull back. |
---|
208 | vtkSetMacro(CornerOffset, double); |
---|
209 | vtkGetMacro(CornerOffset, double); |
---|
210 | |
---|
211 | // Description: |
---|
212 | // Release any graphics resources that are being consumed by this actor. |
---|
213 | // The parameter window could be used to determine which graphic |
---|
214 | // resources to release. |
---|
215 | void ReleaseGraphicsResources(vtkWindow *); |
---|
216 | |
---|
217 | // Description: |
---|
218 | // Enable and disable the use of distance based LOD for titles and labels. |
---|
219 | vtkSetMacro( EnableDistanceLOD, int ); |
---|
220 | vtkGetMacro( EnableDistanceLOD, int ); |
---|
221 | |
---|
222 | // Description:a |
---|
223 | // Set distance LOD threshold [0.0 - 1.0] for titles and labels. |
---|
224 | vtkSetClampMacro( DistanceLODThreshold, double, 0.0, 1.0 ); |
---|
225 | vtkGetMacro( DistanceLODThreshold, double); |
---|
226 | |
---|
227 | // Description: |
---|
228 | // Enable and disable the use of view angle based LOD for titles and labels. |
---|
229 | vtkSetMacro( EnableViewAngleLOD, int ); |
---|
230 | vtkGetMacro( EnableViewAngleLOD, int ); |
---|
231 | |
---|
232 | // Description: |
---|
233 | // Set view angle LOD threshold [0.0 - 1.0] for titles and labels. |
---|
234 | vtkSetClampMacro( ViewAngleLODThreshold, double, 0., 1. ); |
---|
235 | vtkGetMacro( ViewAngleLODThreshold, double ); |
---|
236 | |
---|
237 | // Description: |
---|
238 | // Turn on and off the visibility of each axis. |
---|
239 | vtkSetMacro(XAxisVisibility,int); |
---|
240 | vtkGetMacro(XAxisVisibility,int); |
---|
241 | vtkBooleanMacro(XAxisVisibility,int); |
---|
242 | vtkSetMacro(YAxisVisibility,int); |
---|
243 | vtkGetMacro(YAxisVisibility,int); |
---|
244 | vtkBooleanMacro(YAxisVisibility,int); |
---|
245 | vtkSetMacro(ZAxisVisibility,int); |
---|
246 | vtkGetMacro(ZAxisVisibility,int); |
---|
247 | vtkBooleanMacro(ZAxisVisibility,int); |
---|
248 | |
---|
249 | // Description: |
---|
250 | // Turn on and off the visibility of labels for each axis. |
---|
251 | vtkSetMacro(XAxisLabelVisibility,int); |
---|
252 | vtkGetMacro(XAxisLabelVisibility,int); |
---|
253 | vtkBooleanMacro(XAxisLabelVisibility,int); |
---|
254 | |
---|
255 | vtkSetMacro(YAxisLabelVisibility,int); |
---|
256 | vtkGetMacro(YAxisLabelVisibility,int); |
---|
257 | vtkBooleanMacro(YAxisLabelVisibility,int); |
---|
258 | |
---|
259 | vtkSetMacro(ZAxisLabelVisibility,int); |
---|
260 | vtkGetMacro(ZAxisLabelVisibility,int); |
---|
261 | vtkBooleanMacro(ZAxisLabelVisibility,int); |
---|
262 | |
---|
263 | // Description: |
---|
264 | // Turn on and off the visibility of ticks for each axis. |
---|
265 | vtkSetMacro(XAxisTickVisibility,int); |
---|
266 | vtkGetMacro(XAxisTickVisibility,int); |
---|
267 | vtkBooleanMacro(XAxisTickVisibility,int); |
---|
268 | |
---|
269 | vtkSetMacro(YAxisTickVisibility,int); |
---|
270 | vtkGetMacro(YAxisTickVisibility,int); |
---|
271 | vtkBooleanMacro(YAxisTickVisibility,int); |
---|
272 | |
---|
273 | vtkSetMacro(ZAxisTickVisibility,int); |
---|
274 | vtkGetMacro(ZAxisTickVisibility,int); |
---|
275 | vtkBooleanMacro(ZAxisTickVisibility,int); |
---|
276 | |
---|
277 | // Description: |
---|
278 | // Turn on and off the visibility of minor ticks for each axis. |
---|
279 | vtkSetMacro(XAxisMinorTickVisibility,int); |
---|
280 | vtkGetMacro(XAxisMinorTickVisibility,int); |
---|
281 | vtkBooleanMacro(XAxisMinorTickVisibility,int); |
---|
282 | |
---|
283 | vtkSetMacro(YAxisMinorTickVisibility,int); |
---|
284 | vtkGetMacro(YAxisMinorTickVisibility,int); |
---|
285 | vtkBooleanMacro(YAxisMinorTickVisibility,int); |
---|
286 | |
---|
287 | vtkSetMacro(ZAxisMinorTickVisibility,int); |
---|
288 | vtkGetMacro(ZAxisMinorTickVisibility,int); |
---|
289 | vtkBooleanMacro(ZAxisMinorTickVisibility,int); |
---|
290 | |
---|
291 | vtkSetMacro(DrawXGridlines,int); |
---|
292 | vtkGetMacro(DrawXGridlines,int); |
---|
293 | vtkBooleanMacro(DrawXGridlines,int); |
---|
294 | |
---|
295 | vtkSetMacro(DrawYGridlines,int); |
---|
296 | vtkGetMacro(DrawYGridlines,int); |
---|
297 | vtkBooleanMacro(DrawYGridlines,int); |
---|
298 | |
---|
299 | vtkSetMacro(DrawZGridlines,int); |
---|
300 | vtkGetMacro(DrawZGridlines,int); |
---|
301 | vtkBooleanMacro(DrawZGridlines,int); |
---|
302 | |
---|
303 | vtkSetMacro(DrawXInnerGridlines,int); |
---|
304 | vtkGetMacro(DrawXInnerGridlines,int); |
---|
305 | vtkBooleanMacro(DrawXInnerGridlines,int); |
---|
306 | |
---|
307 | vtkSetMacro(DrawYInnerGridlines,int); |
---|
308 | vtkGetMacro(DrawYInnerGridlines,int); |
---|
309 | vtkBooleanMacro(DrawYInnerGridlines,int); |
---|
310 | |
---|
311 | vtkSetMacro(DrawZInnerGridlines,int); |
---|
312 | vtkGetMacro(DrawZInnerGridlines,int); |
---|
313 | vtkBooleanMacro(DrawZInnerGridlines,int); |
---|
314 | |
---|
315 | vtkSetMacro(DrawXGridpolys,int); |
---|
316 | vtkGetMacro(DrawXGridpolys,int); |
---|
317 | vtkBooleanMacro(DrawXGridpolys,int); |
---|
318 | |
---|
319 | vtkSetMacro(DrawYGridpolys,int); |
---|
320 | vtkGetMacro(DrawYGridpolys,int); |
---|
321 | vtkBooleanMacro(DrawYGridpolys,int); |
---|
322 | |
---|
323 | vtkSetMacro(DrawZGridpolys,int); |
---|
324 | vtkGetMacro(DrawZGridpolys,int); |
---|
325 | vtkBooleanMacro(DrawZGridpolys,int); |
---|
326 | |
---|
327 | // Description: |
---|
328 | // Returns the text property for the title on an axis. |
---|
329 | vtkTextProperty *GetTitleTextProperty(int); |
---|
330 | |
---|
331 | // Description: |
---|
332 | // Returns the text property for the labels on an axis. |
---|
333 | vtkTextProperty *GetLabelTextProperty(int); |
---|
334 | |
---|
335 | // Description: |
---|
336 | // Get/Set axes actors properties. |
---|
337 | void SetXAxesLinesProperty(vtkProperty *); |
---|
338 | vtkProperty* GetXAxesLinesProperty(); |
---|
339 | void SetYAxesLinesProperty(vtkProperty *); |
---|
340 | vtkProperty* GetYAxesLinesProperty(); |
---|
341 | void SetZAxesLinesProperty(vtkProperty *); |
---|
342 | vtkProperty* GetZAxesLinesProperty(); |
---|
343 | |
---|
344 | // Description: |
---|
345 | // Get/Set axes (outer) gridlines actors properties. |
---|
346 | void SetXAxesGridlinesProperty(vtkProperty *); |
---|
347 | vtkProperty* GetXAxesGridlinesProperty(); |
---|
348 | void SetYAxesGridlinesProperty(vtkProperty *); |
---|
349 | vtkProperty* GetYAxesGridlinesProperty(); |
---|
350 | void SetZAxesGridlinesProperty(vtkProperty *); |
---|
351 | vtkProperty* GetZAxesGridlinesProperty(); |
---|
352 | |
---|
353 | // Description: |
---|
354 | // Get/Set axes inner gridlines actors properties. |
---|
355 | void SetXAxesInnerGridlinesProperty(vtkProperty *); |
---|
356 | vtkProperty* GetXAxesInnerGridlinesProperty(); |
---|
357 | void SetYAxesInnerGridlinesProperty(vtkProperty *); |
---|
358 | vtkProperty* GetYAxesInnerGridlinesProperty(); |
---|
359 | void SetZAxesInnerGridlinesProperty(vtkProperty *); |
---|
360 | vtkProperty* GetZAxesInnerGridlinesProperty(); |
---|
361 | |
---|
362 | // Description: |
---|
363 | // Get/Set axes gridPolys actors properties. |
---|
364 | void SetXAxesGridpolysProperty(vtkProperty *); |
---|
365 | vtkProperty* GetXAxesGridpolysProperty(); |
---|
366 | void SetYAxesGridpolysProperty(vtkProperty *); |
---|
367 | vtkProperty* GetYAxesGridpolysProperty(); |
---|
368 | void SetZAxesGridpolysProperty(vtkProperty *); |
---|
369 | vtkProperty* GetZAxesGridpolysProperty(); |
---|
370 | |
---|
371 | // Description: |
---|
372 | // Set/Get the location of ticks marks. |
---|
373 | vtkSetClampMacro(TickLocation, int, VTK_TICKS_INSIDE, VTK_TICKS_BOTH); |
---|
374 | vtkGetMacro(TickLocation, int); |
---|
375 | |
---|
376 | void SetTickLocationToInside(void) |
---|
377 | { this->SetTickLocation(VTK_TICKS_INSIDE); }; |
---|
378 | void SetTickLocationToOutside(void) |
---|
379 | { this->SetTickLocation(VTK_TICKS_OUTSIDE); }; |
---|
380 | void SetTickLocationToBoth(void) |
---|
381 | { this->SetTickLocation(VTK_TICKS_BOTH); }; |
---|
382 | |
---|
383 | void SetLabelScaling(bool, int, int, int); |
---|
384 | |
---|
385 | // Description: |
---|
386 | // Get/Set 2D mode |
---|
387 | // NB: Use vtkTextActor for titles in 2D instead of vtkRpAxisFollower |
---|
388 | void SetUse2DMode( int val ); |
---|
389 | int GetUse2DMode(); |
---|
390 | |
---|
391 | // Description: |
---|
392 | // For 2D mode only: save axis title positions for later use |
---|
393 | void SetSaveTitlePosition( int val ); |
---|
394 | |
---|
395 | // Description: |
---|
396 | // Provide an oriented bounded box when using AxisBaseFor. |
---|
397 | vtkSetVector6Macro(OrientedBounds,double); |
---|
398 | vtkGetVector6Macro(OrientedBounds, double); |
---|
399 | |
---|
400 | // Description: |
---|
401 | // Enable/Disable the usage of the OrientedBounds |
---|
402 | vtkSetMacro(UseOrientedBounds, int); |
---|
403 | vtkGetMacro(UseOrientedBounds, int); |
---|
404 | |
---|
405 | // Description: |
---|
406 | // Vector that should be use as the base for X |
---|
407 | vtkSetVector3Macro(AxisBaseForX,double); |
---|
408 | vtkGetVector3Macro(AxisBaseForX, double); |
---|
409 | |
---|
410 | // Description: |
---|
411 | // Vector that should be use as the base for Y |
---|
412 | vtkSetVector3Macro(AxisBaseForY,double); |
---|
413 | vtkGetVector3Macro(AxisBaseForY, double); |
---|
414 | |
---|
415 | // Description: |
---|
416 | // Vector that should be use as the base for Z |
---|
417 | vtkSetVector3Macro(AxisBaseForZ,double); |
---|
418 | vtkGetVector3Macro(AxisBaseForZ, double); |
---|
419 | |
---|
420 | // Description: |
---|
421 | // Provide a custom AxisOrigin. This point must be inside the bouding box and |
---|
422 | // will represent the point where the 3 axes will interesect |
---|
423 | vtkSetVector3Macro(AxisOrigin,double); |
---|
424 | vtkGetVector3Macro(AxisOrigin, double); |
---|
425 | |
---|
426 | // Description: |
---|
427 | // Enable/Disable the usage of the AxisOrigin |
---|
428 | vtkSetMacro(UseAxisOrigin, int); |
---|
429 | vtkGetMacro(UseAxisOrigin, int); |
---|
430 | |
---|
431 | // Description: |
---|
432 | // Specify the mode in which the cube axes should render its gridLines |
---|
433 | vtkSetMacro(GridLineLocation,int); |
---|
434 | vtkGetMacro(GridLineLocation,int); |
---|
435 | |
---|
436 | vtkSetMacro(XAutoLabelFormat,int); |
---|
437 | vtkGetMacro(XAutoLabelFormat,int); |
---|
438 | vtkBooleanMacro(XAutoLabelFormat,int); |
---|
439 | vtkSetMacro(YAutoLabelFormat,int); |
---|
440 | vtkGetMacro(YAutoLabelFormat,int); |
---|
441 | vtkBooleanMacro(YAutoLabelFormat,int); |
---|
442 | vtkSetMacro(ZAutoLabelFormat,int); |
---|
443 | vtkGetMacro(ZAutoLabelFormat,int); |
---|
444 | vtkBooleanMacro(ZAutoLabelFormat,int); |
---|
445 | |
---|
446 | protected: |
---|
447 | vtkRpCubeAxesActor(); |
---|
448 | ~vtkRpCubeAxesActor(); |
---|
449 | |
---|
450 | int LabelExponent(double min, double max); |
---|
451 | |
---|
452 | int Digits(double min, double max); |
---|
453 | |
---|
454 | double MaxOf(double, double); |
---|
455 | double MaxOf(double, double, double, double); |
---|
456 | |
---|
457 | double FFix(double); |
---|
458 | double FSign(double, double); |
---|
459 | int FRound( double fnt ); |
---|
460 | int GetNumTicks( double range, double fxt); |
---|
461 | |
---|
462 | void UpdateLabels(vtkRpAxisActor **axis, int index); |
---|
463 | |
---|
464 | double Bounds[6]; //Define bounds explicitly |
---|
465 | |
---|
466 | vtkCamera *Camera; |
---|
467 | |
---|
468 | int FlyMode; |
---|
469 | |
---|
470 | // Expose internally closest axis index computation |
---|
471 | int FindClosestAxisIndex(double pts[8][3]); |
---|
472 | |
---|
473 | // Expose internally furthest axis index computation |
---|
474 | int FindFurtherstAxisIndex(double pts[8][3]); |
---|
475 | |
---|
476 | // Expose internally the boundary edge fly mode axis index computation |
---|
477 | void FindBoundaryEdge(int &indexOfAxisX, int &indexOfAxisY, int &indexOfAxisZ, |
---|
478 | double pts[8][3]); |
---|
479 | |
---|
480 | // Description: |
---|
481 | // This will Update AxisActors with GridVisibility when those should be |
---|
482 | // dynamaic regarding the viewport. |
---|
483 | // GridLineLocation = [VTK_CLOSEST_GRID_LINES, VTK_FURTHEST_GRID_LINES] |
---|
484 | void UpdateGridLineVisibility(int axisIndex); |
---|
485 | |
---|
486 | // VTK_ALL_GRID_LINES 0 |
---|
487 | // VTK_CLOSEST_GRID_LINES 1 |
---|
488 | // VTK_FURTHEST_GRID_LINES 2 |
---|
489 | int GridLineLocation; |
---|
490 | |
---|
491 | // Description: |
---|
492 | // If enabled the actor will not be visible at a certain distance from the camera. |
---|
493 | // Default is true |
---|
494 | int EnableDistanceLOD; |
---|
495 | |
---|
496 | // Description: |
---|
497 | // Default is 0.80 |
---|
498 | // This determines at what fraction of camera far clip range, actor is not visible. |
---|
499 | double DistanceLODThreshold; |
---|
500 | |
---|
501 | // Description: |
---|
502 | // If enabled the actor will not be visible at a certain view angle. |
---|
503 | // Default is true. |
---|
504 | int EnableViewAngleLOD; |
---|
505 | |
---|
506 | // Description: |
---|
507 | // This determines at what view angle to geometry will make the geometry not visibile. |
---|
508 | // Default is 0.3. |
---|
509 | double ViewAngleLODThreshold; |
---|
510 | |
---|
511 | // Description: |
---|
512 | // Control variables for all axes |
---|
513 | // NB: [0] always for 'Major' axis during non-static fly modes. |
---|
514 | vtkRpAxisActor *XAxes[NUMBER_OF_ALIGNED_AXIS]; |
---|
515 | vtkRpAxisActor *YAxes[NUMBER_OF_ALIGNED_AXIS]; |
---|
516 | vtkRpAxisActor *ZAxes[NUMBER_OF_ALIGNED_AXIS]; |
---|
517 | |
---|
518 | bool RebuildAxes; |
---|
519 | |
---|
520 | char *XTitle; |
---|
521 | char *XUnits; |
---|
522 | char *YTitle; |
---|
523 | char *YUnits; |
---|
524 | char *ZTitle; |
---|
525 | char *ZUnits; |
---|
526 | |
---|
527 | char *ActualXLabel; |
---|
528 | char *ActualYLabel; |
---|
529 | char *ActualZLabel; |
---|
530 | |
---|
531 | int TickLocation; |
---|
532 | |
---|
533 | int XAxisVisibility; |
---|
534 | int YAxisVisibility; |
---|
535 | int ZAxisVisibility; |
---|
536 | |
---|
537 | int XAxisTickVisibility; |
---|
538 | int YAxisTickVisibility; |
---|
539 | int ZAxisTickVisibility; |
---|
540 | |
---|
541 | int XAxisMinorTickVisibility; |
---|
542 | int YAxisMinorTickVisibility; |
---|
543 | int ZAxisMinorTickVisibility; |
---|
544 | |
---|
545 | int XAxisLabelVisibility; |
---|
546 | int YAxisLabelVisibility; |
---|
547 | int ZAxisLabelVisibility; |
---|
548 | |
---|
549 | int DrawXGridlines; |
---|
550 | int DrawYGridlines; |
---|
551 | int DrawZGridlines; |
---|
552 | |
---|
553 | int DrawXInnerGridlines; |
---|
554 | int DrawYInnerGridlines; |
---|
555 | int DrawZInnerGridlines; |
---|
556 | |
---|
557 | int DrawXGridpolys; |
---|
558 | int DrawYGridpolys; |
---|
559 | int DrawZGridpolys; |
---|
560 | |
---|
561 | char *XLabelFormat; |
---|
562 | char *YLabelFormat; |
---|
563 | char *ZLabelFormat; |
---|
564 | |
---|
565 | double CornerOffset; |
---|
566 | |
---|
567 | int Inertia; |
---|
568 | |
---|
569 | int RenderCount; |
---|
570 | |
---|
571 | int InertiaLocs[3]; |
---|
572 | |
---|
573 | int RenderSomething; |
---|
574 | |
---|
575 | double LabelScreenOffset; |
---|
576 | double TitleScreenOffset; |
---|
577 | |
---|
578 | vtkTextProperty* TitleTextProperty[3]; |
---|
579 | vtkStringArray* AxisLabels[3]; |
---|
580 | |
---|
581 | vtkTextProperty* LabelTextProperty[3]; |
---|
582 | |
---|
583 | vtkProperty *XAxesLinesProperty; |
---|
584 | vtkProperty *YAxesLinesProperty; |
---|
585 | vtkProperty *ZAxesLinesProperty; |
---|
586 | vtkProperty *XAxesGridlinesProperty; |
---|
587 | vtkProperty *YAxesGridlinesProperty; |
---|
588 | vtkProperty *ZAxesGridlinesProperty; |
---|
589 | vtkProperty *XAxesInnerGridlinesProperty; |
---|
590 | vtkProperty *YAxesInnerGridlinesProperty; |
---|
591 | vtkProperty *ZAxesInnerGridlinesProperty; |
---|
592 | vtkProperty *XAxesGridpolysProperty; |
---|
593 | vtkProperty *YAxesGridpolysProperty; |
---|
594 | vtkProperty *ZAxesGridpolysProperty; |
---|
595 | |
---|
596 | double RenderedBounds[6]; |
---|
597 | double OrientedBounds[6]; |
---|
598 | int UseOrientedBounds; |
---|
599 | |
---|
600 | double AxisOrigin[3]; |
---|
601 | int UseAxisOrigin; |
---|
602 | |
---|
603 | double AxisBaseForX[3]; |
---|
604 | double AxisBaseForY[3]; |
---|
605 | double AxisBaseForZ[3]; |
---|
606 | |
---|
607 | private: |
---|
608 | vtkRpCubeAxesActor(const vtkRpCubeAxesActor&); // Not implemented |
---|
609 | void operator=(const vtkRpCubeAxesActor&); // Not implemented |
---|
610 | |
---|
611 | vtkSetStringMacro(ActualXLabel); |
---|
612 | vtkSetStringMacro(ActualYLabel); |
---|
613 | vtkSetStringMacro(ActualZLabel); |
---|
614 | |
---|
615 | vtkTimeStamp BuildTime; |
---|
616 | int LastUseOrientedBounds; |
---|
617 | int LastXPow; |
---|
618 | int LastYPow; |
---|
619 | int LastZPow; |
---|
620 | |
---|
621 | int UserXPow; |
---|
622 | int UserYPow; |
---|
623 | int UserZPow; |
---|
624 | |
---|
625 | bool AutoLabelScaling; |
---|
626 | int XAutoLabelFormat; |
---|
627 | int YAutoLabelFormat; |
---|
628 | int ZAutoLabelFormat; |
---|
629 | |
---|
630 | int LastXAxisDigits; |
---|
631 | int LastYAxisDigits; |
---|
632 | int LastZAxisDigits; |
---|
633 | |
---|
634 | double LastXRange[2]; |
---|
635 | double LastYRange[2]; |
---|
636 | double LastZRange[2]; |
---|
637 | double LastBounds[6]; |
---|
638 | |
---|
639 | int LastFlyMode; |
---|
640 | |
---|
641 | int RenderAxesX[NUMBER_OF_ALIGNED_AXIS]; |
---|
642 | int RenderAxesY[NUMBER_OF_ALIGNED_AXIS]; |
---|
643 | int RenderAxesZ[NUMBER_OF_ALIGNED_AXIS]; |
---|
644 | |
---|
645 | int NumberOfAxesX; |
---|
646 | int NumberOfAxesY; |
---|
647 | int NumberOfAxesZ; |
---|
648 | |
---|
649 | bool MustAdjustXValue; |
---|
650 | bool MustAdjustYValue; |
---|
651 | bool MustAdjustZValue; |
---|
652 | |
---|
653 | bool ForceXLabelReset; |
---|
654 | bool ForceYLabelReset; |
---|
655 | bool ForceZLabelReset; |
---|
656 | |
---|
657 | double XAxisRange[2]; |
---|
658 | double YAxisRange[2]; |
---|
659 | double ZAxisRange[2]; |
---|
660 | |
---|
661 | double LabelScale; |
---|
662 | double TitleScale; |
---|
663 | |
---|
664 | double ScreenSize; |
---|
665 | |
---|
666 | // Description: |
---|
667 | // Major start and delta values, in each direction. |
---|
668 | // These values are needed for inner grid lines generation |
---|
669 | double MajorStart[3]; |
---|
670 | double DeltaMajor[3]; |
---|
671 | |
---|
672 | int RenderGeometry(bool &initialRender, vtkViewport *viewport, bool checkAxisVisibility,int (vtkRpAxisActor::*renderMethod)(vtkViewport*)); |
---|
673 | |
---|
674 | void TransformBounds(vtkViewport *viewport, const double bounds[6], |
---|
675 | double pts[8][3]); |
---|
676 | void AdjustAxes(double bounds[6], |
---|
677 | double xCoords[NUMBER_OF_ALIGNED_AXIS][6], |
---|
678 | double yCoords[NUMBER_OF_ALIGNED_AXIS][6], |
---|
679 | double zCoords[NUMBER_OF_ALIGNED_AXIS][6], |
---|
680 | double xRange[2], double yRange[2], double zRange[2]); |
---|
681 | |
---|
682 | bool ComputeTickSize(double bounds[6]); |
---|
683 | void AdjustValues(const double xRange[2], |
---|
684 | const double yRange[2], |
---|
685 | const double zRange[2]); |
---|
686 | void AdjustRange(const double bounds[6]); |
---|
687 | void BuildAxes(vtkViewport *); |
---|
688 | void DetermineRenderAxes(vtkViewport *); |
---|
689 | void SetNonDependentAttributes(void); |
---|
690 | void BuildLabels(vtkRpAxisActor *axes[NUMBER_OF_ALIGNED_AXIS]); |
---|
691 | void AdjustTicksComputeRange(vtkRpAxisActor *axes[NUMBER_OF_ALIGNED_AXIS], |
---|
692 | double rangeMin, double rangeMax); |
---|
693 | |
---|
694 | void AutoScale(vtkViewport *viewport); |
---|
695 | void AutoScale(vtkViewport *viewport, vtkRpAxisActor *axes[NUMBER_OF_ALIGNED_AXIS]); |
---|
696 | double AutoScale(vtkViewport *viewport, double screenSize, double position[3]); |
---|
697 | }; |
---|
698 | |
---|
699 | |
---|
700 | #endif |
---|