VTK
vtkPolarAxesActor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCubeAxesActor.h
5  Language: C++
6 
7 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen
8 All rights reserve
9  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
10 
11  This software is distributed WITHOUT ANY WARRANTY; without even
12  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13  PURPOSE. See the above copyright notice for more information.
14 =========================================================================*/
39 #ifndef vtkPolarAxesActor_h
40 #define vtkPolarAxesActor_h
41 
42 #define VTK_MAXIMUM_NUMBER_OF_RADIAL_AXES 50
43 #define VTK_DEFAULT_NUMBER_OF_RADIAL_AXES 5
44 #define VTK_MAXIMUM_NUMBER_OF_POLAR_AXIS_TICKS 200
45 #define VTK_MAXIMUM_RATIO 1000.0
46 #define VTK_POLAR_ARC_RESOLUTION_PER_DEG 0.2
47 
48 #include "vtkRenderingAnnotationModule.h" // For export macro
49 #include "vtkActor.h"
50 #include "vtkAxisActor.h" // access to enum values
51 #include <list> // To process exponent list as reference
52 
53 class vtkCamera;
54 class vtkPolyData;
55 class vtkPolyDataMapper;
56 class vtkProperty;
57 class vtkStringArray;
58 class vtkTextProperty;
59 
60 class VTKRENDERINGANNOTATION_EXPORT vtkPolarAxesActor : public vtkActor
61 {
62 public:
63  vtkTypeMacro(vtkPolarAxesActor, vtkActor);
64  void PrintSelf(ostream& os, vtkIndent indent);
65 
70  static vtkPolarAxesActor *New();
71 
73 
76  virtual int RenderOpaqueGeometry(vtkViewport*);
77  virtual int RenderOverlay(vtkViewport*);
80 
82 
85  virtual void SetPole(double[3]);
86  virtual void SetPole(double, double, double);
87  vtkGetVector3Macro(Pole, double);
89 
91 
95  vtkSetMacro(Log, bool);
96  vtkGetMacro(Log, bool);
97  vtkBooleanMacro(Log, bool);
99 
101 
104  virtual void SetNumberOfRadialAxes(vtkIdType);
105  vtkGetMacro(NumberOfRadialAxes, vtkIdType);
107 
109 
113  virtual void SetNumberOfPolarAxisTicks(int);
114  int GetNumberOfPolarAxisTicks();
116 
118 
122  vtkSetMacro(AutoSubdividePolarAxis, bool);
123  vtkGetMacro(AutoSubdividePolarAxis, bool);
124  vtkBooleanMacro(AutoSubdividePolarAxis, bool);
126 
128 
131  vtkSetVector2Macro(Range, double);
132  vtkGetVectorMacro(Range, double, 2);
134 
136 
139  virtual void SetMinimumRadius(double);
140  vtkGetMacro(MinimumRadius, double);
142 
144 
147  virtual void SetMaximumRadius(double);
148  vtkGetMacro(MaximumRadius, double);
150 
152 
156  vtkSetMacro(AutoScaleRadius, bool);
157  vtkGetMacro(AutoScaleRadius, bool);
159 
161 
164  virtual void SetMinimumAngle(double);
165  vtkGetMacro(MinimumAngle, double);
167 
169 
172  virtual void SetMaximumAngle(double);
173  vtkGetMacro(MaximumAngle, double);
175 
177 
182  vtkSetClampMacro(SmallestVisiblePolarAngle, double, 0., 5.);
183  vtkGetMacro(SmallestVisiblePolarAngle, double);
185 
187 
192  vtkSetClampMacro(TickLocation, int, vtkAxisActor::VTK_TICKS_INSIDE, vtkAxisActor::VTK_TICKS_BOTH);
193  vtkGetMacro(TickLocation, int);
195 
197 
200  vtkSetMacro(RadialUnits, bool);
201  vtkGetMacro(RadialUnits, bool);
203 
205 
211  vtkSetMacro(ScreenSize, double);
212  vtkGetMacro(ScreenSize, double);
214 
216 
220  virtual void SetCamera(vtkCamera*);
221  vtkGetObjectMacro(Camera, vtkCamera);
223 
225 
229  vtkSetStringMacro(PolarAxisTitle);
230  vtkGetStringMacro(PolarAxisTitle);
232 
234 
237  vtkSetStringMacro(PolarLabelFormat);
238  vtkGetStringMacro(PolarLabelFormat);
240 
242  {
243  VTK_EXPONENT_BOTTOM = 0,
244  VTK_EXPONENT_EXTERN = 1,
245  VTK_EXPONENT_LABELS = 2
246  };
247 
249 
254  vtkSetClampMacro(ExponentLocation, int, VTK_EXPONENT_BOTTOM, VTK_EXPONENT_LABELS);
255  vtkGetMacro(ExponentLocation, int);
257 
259 
262  vtkSetStringMacro(RadialAngleFormat);
263  vtkGetStringMacro(RadialAngleFormat);
265 
272 
274 
277  vtkSetMacro(EnableDistanceLOD, int);
278  vtkGetMacro(EnableDistanceLOD, int);
280 
282 
285  vtkSetClampMacro(DistanceLODThreshold, double, 0.0, 1.0);
286  vtkGetMacro(DistanceLODThreshold, double);
288 
290 
293  vtkSetMacro(EnableViewAngleLOD, int);
294  vtkGetMacro(EnableViewAngleLOD, int);
296 
298 
301  vtkSetClampMacro(ViewAngleLODThreshold, double, 0., 1.);
302  vtkGetMacro(ViewAngleLODThreshold, double);
304 
306 
309  vtkSetMacro(PolarAxisVisibility, int);
310  vtkGetMacro(PolarAxisVisibility, int);
311  vtkBooleanMacro(PolarAxisVisibility, int);
313 
315 
318  vtkSetMacro(DrawRadialGridlines, int);
319  vtkGetMacro(DrawRadialGridlines, int);
320  vtkBooleanMacro(DrawRadialGridlines, int);
322 
324 
327  vtkSetMacro(DrawPolarArcsGridlines, int);
328  vtkGetMacro(DrawPolarArcsGridlines, int);
329  vtkBooleanMacro(DrawPolarArcsGridlines, int);
331 
333 
336  vtkSetMacro(PolarTitleVisibility, int);
337  vtkGetMacro(PolarTitleVisibility, int);
338  vtkBooleanMacro(PolarTitleVisibility, int);
340 
342  {
343  VTK_TITLE_BOTTOM = 0,
344  VTK_TITLE_EXTERN = 1
345  };
346 
348 
352  vtkSetClampMacro(RadialAxisTitleLocation, int, VTK_TITLE_BOTTOM, VTK_TITLE_EXTERN);
353  vtkGetMacro(RadialAxisTitleLocation, int);
355 
357 
361  vtkSetClampMacro(PolarAxisTitleLocation, int, VTK_TITLE_BOTTOM, VTK_TITLE_EXTERN);
362  vtkGetMacro(PolarAxisTitleLocation, int);
364 
366 
369  vtkSetMacro(PolarLabelVisibility, int);
370  vtkGetMacro(PolarLabelVisibility, int);
371  vtkBooleanMacro(PolarLabelVisibility, int);
373 
375 
380  vtkSetMacro(ArcTicksOriginToPolarAxis, int);
381  vtkGetMacro(ArcTicksOriginToPolarAxis, int);
382  vtkBooleanMacro(ArcTicksOriginToPolarAxis, int);
384 
386 
391  vtkSetMacro(RadialAxesOriginToPolarAxis, int);
392  vtkGetMacro(RadialAxesOriginToPolarAxis, int);
393  vtkBooleanMacro(RadialAxesOriginToPolarAxis, int);
395 
397 
400  vtkSetMacro(PolarTickVisibility, int);
401  vtkGetMacro(PolarTickVisibility, int);
402  vtkBooleanMacro(PolarTickVisibility, int);
404 
406 
409  vtkSetMacro(AxisTickVisibility, int);
410  vtkGetMacro(AxisTickVisibility, int);
411  vtkBooleanMacro(AxisTickVisibility, int);
413 
415 
418  vtkSetMacro(AxisMinorTickVisibility, int);
419  vtkGetMacro(AxisMinorTickVisibility, int);
420  vtkBooleanMacro(AxisMinorTickVisibility, int);
422 
424 
427  vtkSetMacro(ArcTickVisibility, int);
428  vtkGetMacro(ArcTickVisibility, int);
429  vtkBooleanMacro(ArcTickVisibility, int);
431 
433 
436  vtkSetMacro(ArcMinorTickVisibility, int);
437  vtkGetMacro(ArcMinorTickVisibility, int);
438  vtkBooleanMacro(ArcMinorTickVisibility, int);
440 
442 
445  vtkSetMacro(ArcMajorTickSize, double);
446  vtkGetMacro(ArcMajorTickSize, double);
448 
450 
453  vtkSetMacro(PolarAxisMajorTickSize, double);
454  vtkGetMacro(PolarAxisMajorTickSize, double);
456 
458 
461  vtkSetMacro(LastRadialAxisMajorTickSize, double);
462  vtkGetMacro(LastRadialAxisMajorTickSize, double);
464 
466 
469  vtkSetMacro(PolarAxisTickRatioSize, double);
470  vtkGetMacro(PolarAxisTickRatioSize, double);
472 
474 
477  vtkSetMacro(LastAxisTickRatioSize, double);
478  vtkGetMacro(LastAxisTickRatioSize, double);
480 
482 
485  vtkSetMacro(ArcTickRatioSize, double);
486  vtkGetMacro(ArcTickRatioSize, double);
488 
490 
493  vtkSetMacro(PolarAxisMajorTickThickness, double);
494  vtkGetMacro(PolarAxisMajorTickThickness, double);
496 
498 
501  vtkSetMacro(LastRadialAxisMajorTickThickness, double);
502  vtkGetMacro(LastRadialAxisMajorTickThickness, double);
504 
506 
509  vtkSetMacro(ArcMajorTickThickness, double);
510  vtkGetMacro(ArcMajorTickThickness, double);
512 
514 
517  vtkSetMacro(PolarAxisTickRatioThickness, double);
518  vtkGetMacro(PolarAxisTickRatioThickness, double);
520 
522 
525  vtkSetMacro(LastAxisTickRatioThickness, double);
526  vtkGetMacro(LastAxisTickRatioThickness, double);
528 
530 
533  vtkSetMacro(ArcTickRatioThickness, double);
534  vtkGetMacro(ArcTickRatioThickness, double);
536 
538 
541  vtkSetMacro(DeltaRangeMajor, double);
542  vtkGetMacro(DeltaRangeMajor, double);
544 
546 
549  vtkSetMacro(DeltaRangeMinor, double);
550  vtkGetMacro(DeltaRangeMinor, double);
552 
554 
557  vtkSetMacro(DeltaAngleMajor, double);
558  vtkGetMacro(DeltaAngleMajor, double);
560 
562 
565  vtkSetMacro(DeltaAngleMinor, double);
566  vtkGetMacro(DeltaAngleMinor, double);
568 
570 
573  vtkSetMacro(DeltaAngleRadialAxes, double);
574  vtkGetMacro(DeltaAngleRadialAxes, double);
576 
577  //------------------------------------------------
578 
580 
583  vtkSetMacro(RadialAxesVisibility, int);
584  vtkGetMacro(RadialAxesVisibility, int);
585  vtkBooleanMacro(RadialAxesVisibility, int);
587 
589 
592  vtkSetMacro(RadialTitleVisibility, int);
593  vtkGetMacro(RadialTitleVisibility, int);
594  vtkBooleanMacro(RadialTitleVisibility, int);
596 
598 
601  vtkSetMacro(PolarArcsVisibility, int);
602  vtkGetMacro(PolarArcsVisibility, int);
603  vtkBooleanMacro(PolarArcsVisibility, int);
605 
607 
610  void SetUse2DMode(int val);
611  int GetUse2DMode();
613 
615 
618  virtual void SetPolarAxisTitleTextProperty(vtkTextProperty *p);
619  vtkGetObjectMacro(PolarAxisTitleTextProperty, vtkTextProperty);
621 
623 
626  virtual void SetPolarAxisLabelTextProperty(vtkTextProperty *p);
627  vtkGetObjectMacro(PolarAxisLabelTextProperty, vtkTextProperty);
629 
631 
634  virtual void SetLastRadialAxisTextProperty(vtkTextProperty *p);
635  vtkGetObjectMacro(LastRadialAxisTextProperty, vtkTextProperty);
637 
639 
642  virtual void SetSecondaryRadialAxesTextProperty(vtkTextProperty *p);
643  vtkGetObjectMacro(SecondaryRadialAxesTextProperty, vtkTextProperty);
645 
647 
650  virtual void SetPolarAxisProperty(vtkProperty *);
651  vtkGetObjectMacro(PolarAxisProperty, vtkProperty);
653 
655 
658  virtual void SetLastRadialAxisProperty(vtkProperty* p);
659  vtkGetObjectMacro(LastRadialAxisProperty, vtkProperty);
661 
663 
666  virtual void SetSecondaryRadialAxesProperty(vtkProperty* p);
667  vtkGetObjectMacro(SecondaryRadialAxesProperty, vtkProperty);
669 
671 
674  virtual void SetPolarArcsProperty(vtkProperty* p);
675  vtkProperty* GetPolarArcsProperty();
677 
679 
682  virtual void SetSecondaryPolarArcsProperty(vtkProperty* p);
683  vtkProperty* GetSecondaryPolarArcsProperty();
685 
687 
693  vtkSetVector6Macro(Bounds, double);
694  double *GetBounds();
695  void GetBounds(double& xmin, double& xmax, double& ymin, double& ymax,
696  double& zmin, double& zmax);
697  void GetBounds(double bounds[6]);
699 
701 
704  vtkSetClampMacro(Ratio, double, 0.001, 100.0);
705  vtkGetMacro(Ratio, double);
707 
708 protected:
711 
715  bool CheckMembersConsistency();
716 
721  void BuildAxes(vtkViewport *);
722 
726  void CalculateBounds();
727 
731  void SetCommonAxisAttributes(vtkAxisActor*);
732 
736  void SetPolarAxisAttributes(vtkAxisActor*);
737 
741  void CreateRadialAxes(int axisCount);
742 
746  void BuildRadialAxes();
747 
753  void AutoComputeTicksProperties();
754 
758  double ComputeIdealStep(int subDivsRequired, double rangeLength, int maxSubDivs = 1000);
759 
763  void BuildArcTicks();
764 
768  void StoreTicksPtsFromParamEllipse(double a, double angleEllipseRad, double tickSize, vtkPoints* tickPts);
769 
773  void BuildPolarAxisLabelsArcs();
774 
778  void BuildPolarAxisLabelsArcsLog();
779 
783  void BuildLabelsLog();
784 
785  void BuildPolarArcsLog();
786 
790  std::string FindExponentAndAdjustValues(std::list<double>& valuesList);
791 
795  void GetSignificantPartFromValues(vtkStringArray* valuesStr, std::list<double>& valuesList);
796 
798 
801  double FFix(double);
802  double FSign(double, double);
804 
809  void AutoScale(vtkViewport* viewport);
810 
815  static double ComputeEllipseAngle(double angleInDegrees, double ratio);
816 
821  double Pole[3];
822 
827 
833 
837  double Ratio;
838 
842  double Range[2];
843 
848 
853 
858 
863 
868 
874 
880 
885  bool Log;
886 
891 
896  double MinimumAngle;
897 
902  double MaximumAngle;
903 
908 
912  double Bounds[6];
913 
914  // Structures for principal polar arc
918 
920 
927 
932 
937 
942 
944 
951 
956 
962 
968 
974 
980 
986 
988 
995 
1003 
1008 
1015 
1022 
1026  int AxisTickVisibility, AxisMinorTickVisibility;
1027 
1031  int ArcTickVisibility, ArcMinorTickVisibility;
1032 
1036  double PolarAxisMajorTickSize, LastRadialAxisMajorTickSize, ArcMajorTickSize;
1037 
1041  double PolarAxisTickRatioSize, LastAxisTickRatioSize, ArcTickRatioSize;
1042 
1046  double PolarAxisMajorTickThickness, LastRadialAxisMajorTickThickness, ArcMajorTickThickness;
1047 
1051  double PolarAxisTickRatioThickness, LastAxisTickRatioThickness, ArcTickRatioThickness;
1052 
1054 
1060 
1065 
1070 
1076 
1081 
1086 
1091 
1096 
1101 
1103 
1113 
1115 
1121 
1126 
1131 
1137 
1142 
1147 
1149 
1153  double TitleScale;
1154 
1158  double LabelScale;
1159 
1163  double ScreenSize;
1164 
1165 private:
1166  vtkPolarAxesActor(const vtkPolarAxesActor&) VTK_DELETE_FUNCTION;
1167  void operator=(const vtkPolarAxesActor&) VTK_DELETE_FUNCTION;
1168 };
1169 
1170 #endif
vtkProperty * SecondaryRadialAxesProperty
General properties of radial axes.
double MinimumRadius
Minimum polar radius.
int PolarAxisTitleLocation
Define the alignement of the title related to the polar axis.
vtkPolyDataMapper * ArcTickPolyDataMapper
vtk object for arc Ticks
vtkActor * ArcTickActor
vtk object for arc Ticks
bool AutoScaleRadius
Auto-scale polar radius (with respect to average length scale of x-y bounding box).
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkTextProperty * SecondaryRadialAxesTextProperty
Text properties of secondary radial axes.
double MaximumAngle
Maximum polar angle Default: 90.
int TickLocation
Describes the tick orientation for the graph elements involved by this property.
vtkPolyDataMapper * SecondaryPolarArcsMapper
Structures for secondary polar arcs.
char * PolarLabelFormat
Title to be used for the polar axis NB: Non-polar radial axes use the polar angle as title and have n...
abstract specification for Viewports
Definition: vtkViewport.h:47
represent surface properties of a geometric object
Definition: vtkProperty.h:64
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
Draw the polar axes.
virtual int RenderOverlay(vtkViewport *)
Definition: vtkProp.h:228
int EnableDistanceLOD
If enabled the actor will not be visible at a certain distance from the camera.
double Ratio
Ratio for elliptical representation of the polar axes actor.
vtkPolyDataMapper * PolarArcsMapper
record modification and/or execution time
Definition: vtkTimeStamp.h:35
Create an axis with tick marks and labels.
Definition: vtkAxisActor.h:74
vtkPolyData * SecondaryPolarArcs
Structures for secondary polar arcs.
double PolarAxisMajorTickThickness
Defines the tickness of the major ticks.
vtkActor * ArcMinorTickActor
vtk object for arc Ticks
char * PolarAxisTitle
Title to be used for the polar axis NB: Non-polar radial axes use the polar angle as title and have n...
a vtkAbstractArray subclass for strings
vtkTextProperty * PolarAxisTitleTextProperty
Text properties of polar axis title and labels.
double SmallestVisiblePolarAngle
Smallest radial angle distinguishable from polar axis.
vtkActor * SecondaryPolarArcsActor
Structures for secondary polar arcs.
int vtkIdType
Definition: vtkType.h:287
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
static vtkActor * New()
Creates an actor with the following defaults: origin(0,0,0) position=(0,0,0) scale=(1,1,1) visibility=1 pickable=1 dragable=1 orientation=(0,0,0).
double MinimumAngle
Minimum polar angle Default: 0.
int DrawPolarArcsGridlines
Visibility of the inner arcs (overriden to 0 if PolarArcsVisibility is set to 0)
int PolarArcsVisibility
Visibility of polar arcs.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkAxisActor ** RadialAxes
Control variables for non-polar radial axes.
double PolarAxisMajorTickSize
Defines the length of the ticks located on the last arc.
vtkPolyData * PolarArcs
int PolarTickVisibility
Hold visibility for all present ticks.
double ScreenSize
Text screen size.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkProperty * PolarAxisProperty
General properties of polar axis Behavior may be override by polar axis ticks 's actor property...
int PolarAxisVisibility
Visibility of polar axis and its title, labels, ticks (major only)
double PolarAxisTickRatioSize
Set the ratios between major tick Size for each ticks location.
int ExponentLocation
Define the location of the exponent of the labels values, located on the polar axis.
int RadialAxisTitleLocation
Define the alignement of the title related to the radial axis.
double DeltaAngleMinor
Angle between 2 minor ticks on the last arc.
double DeltaAngleMajor
Angle between 2 major ticks on the last arc.
a simple class to control print indentation
Definition: vtkIndent.h:39
a virtual camera for 3D rendering
Definition: vtkCamera.h:50
vtkPolyDataMapper * ArcMinorTickPolyDataMapper
vtk object for arc Ticks
int NumberOfRadialAxes
Number of radial axes.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
int PolarLabelVisibility
Visibility of polar axis and its title, labels, ticks (major only)
represent text properties.
vtkProperty * LastRadialAxisProperty
General properties of last radial axis.
int RadialAxesVisibility
Visibility of radial axes and their titles.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
int ArcTickVisibility
Enable / Disable major/minor tick visibility on the last arc displayed.
double * GetBounds()
Return a reference to the Prop3D's composite transform.
map vtkPolyData to graphics primitives
int RadialTitleVisibility
Visibility of radial axes and their titles.
vtkAxisActor * PolarAxis
Control variables for polar axis.
double TitleScale
Title scale factor.
double PolarAxisTickRatioThickness
Set the ratios between major tick thickness for each ticks location.
virtual int RenderOpaqueGeometry(vtkViewport *viewport)
Support the standard render methods.
double ViewAngleLODThreshold
This determines at what view angle to geometry will make the geometry not visibile.
int DrawRadialGridlines
Visibility of the inner axes (overriden to 0 if RadialAxesVisibility is set to 0) ...
bool RadialUnits
Display angle units (degrees) to label radial axes Default is true.
vtkCamera * Camera
Camera attached to the polar axes system.
vtkPolyData * ArcMinorTickPolyData
vtk object for arc Ticks
int AxisTickVisibility
Hold visibility of major/minor ticks for the polar axis and the last radial axis. ...
int PolarTitleVisibility
Visibility of polar axis and its title, labels, ticks (major only)
double LabelScale
Label scale factor.
int EnableViewAngleLOD
If enabled the actor will not be visible at a certain view angle.
void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this actor.
double DeltaAngleRadialAxes
Angle between 2 radial Axes.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
vtkTextProperty * LastRadialAxisTextProperty
Text properties of last radial axis.
int ArcTicksOriginToPolarAxis
If On, the ticks are drawn from the angle of the polarAxis (i.e.
double MaximumRadius
Maximum polar radius.
vtkPoints * ArcMajorTickPts
Keep the arc major ticks vtkPoints instances.
int RadialAxesOriginToPolarAxis
If On, the radial axes are drawn from the angle of the polarAxis (i.e.
double DeltaRangeMajor
Step between 2 major ticks, in range value (values displayed on the axis).
vtkPoints * ArcMinorTickPts
Keep the arc minor ticks vtkPoints instances.
bool Log
Enable/Disable log scale Default: 0.
represent and manipulate 3D points
Definition: vtkPoints.h:39
char * RadialAngleFormat
String to format angle values displayed on the radial axes.
vtkTextProperty * PolarAxisLabelTextProperty
Text properties of polar axis title and labels.
vtkPolyData * ArcTickPolyData
vtk object for arc Ticks
bool AutoSubdividePolarAxis
Whether the number of polar axis ticks and arcs should be automatically calculated.
double DeltaRangeMinor
Step between 2 minor ticks, in range value (values displayed on the axis).
double DistanceLODThreshold
Default is 0.80 This determines at what fraction of camera far clip range, actor is not visible...
create an actor of a polar axes -