VTK  9.2.6
vtkCubeAxesActor.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkCubeAxesActor.h
5 Language: C++
6
7Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen
8All 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=========================================================================*/
58
59#ifndef vtkCubeAxesActor_h
60#define vtkCubeAxesActor_h
61
62#include "vtkActor.h"
63#include "vtkRenderingAnnotationModule.h" // For export macro
64
65class vtkAxisActor;
66class vtkCamera;
67class vtkTextProperty;
68class vtkStringArray;
69
70class VTKRENDERINGANNOTATION_EXPORT vtkCubeAxesActor : public vtkActor
71{
72public:
73 vtkTypeMacro(vtkCubeAxesActor, vtkActor);
74 void PrintSelf(ostream& os, vtkIndent indent) override;
75
81
83
89 int RenderOverlay(vtkViewport*) override;
92
94
97 vtkSetMacro(RebuildAxes, bool);
98 vtkGetMacro(RebuildAxes, bool);
100
102
108 vtkSetVector6Macro(Bounds, double);
110 double* GetBounds() VTK_SIZEHINT(6) override { return this->Bounds; }
112
114
118 virtual void GetRenderedBounds(double rBounds[6]);
119 virtual double* GetRenderedBounds();
121
123
131 vtkSetVector2Macro(XAxisRange, double);
132 vtkSetVector2Macro(YAxisRange, double);
133 vtkSetVector2Macro(ZAxisRange, double);
134 vtkGetVector2Macro(XAxisRange, double);
135 vtkGetVector2Macro(YAxisRange, double);
138
143 void SetAxisLabels(int axis, vtkStringArray* value);
145
146 vtkGetVector2Macro(ZAxisRange, double);
147
149
154 void SetScreenSize(double screenSize);
155 vtkGetMacro(ScreenSize, double);
157
159
163 void SetLabelOffset(double offset);
164 vtkGetMacro(LabelOffset, double);
166
168
172 void SetTitleOffset(double offset);
173 vtkGetMacro(TitleOffset, double);
175
177
181 virtual void SetCamera(vtkCamera*);
182 vtkGetObjectMacro(Camera, vtkCamera);
184
193
195
201 vtkGetMacro(FlyMode, int);
208
210
214 vtkSetStringMacro(XTitle);
215 vtkGetStringMacro(XTitle);
216 vtkSetStringMacro(XUnits);
217 vtkGetStringMacro(XUnits);
218 vtkSetStringMacro(YTitle);
219 vtkGetStringMacro(YTitle);
220 vtkSetStringMacro(YUnits);
221 vtkGetStringMacro(YUnits);
222 vtkSetStringMacro(ZTitle);
223 vtkGetStringMacro(ZTitle);
224 vtkSetStringMacro(ZUnits);
225 vtkGetStringMacro(ZUnits);
227
229
233 vtkSetStringMacro(XLabelFormat);
234 vtkGetStringMacro(XLabelFormat);
235 vtkSetStringMacro(YLabelFormat);
236 vtkGetStringMacro(YLabelFormat);
237 vtkSetStringMacro(ZLabelFormat);
238 vtkGetStringMacro(ZLabelFormat);
240
242
247 vtkSetClampMacro(Inertia, int, 1, VTK_INT_MAX);
248 vtkGetMacro(Inertia, int);
250
252
257 vtkSetMacro(CornerOffset, double);
258 vtkGetMacro(CornerOffset, double);
260
267
269
272 vtkSetMacro(EnableDistanceLOD, int);
273 vtkGetMacro(EnableDistanceLOD, int);
275
277
280 vtkSetClampMacro(DistanceLODThreshold, double, 0.0, 1.0);
281 vtkGetMacro(DistanceLODThreshold, double);
283
285
288 vtkSetMacro(EnableViewAngleLOD, int);
289 vtkGetMacro(EnableViewAngleLOD, int);
291
293
296 vtkSetClampMacro(ViewAngleLODThreshold, double, 0., 1.);
297 vtkGetMacro(ViewAngleLODThreshold, double);
299
301
306 vtkBooleanMacro(XAxisVisibility, vtkTypeBool);
309 vtkBooleanMacro(YAxisVisibility, vtkTypeBool);
312 vtkBooleanMacro(ZAxisVisibility, vtkTypeBool);
314
316
323
327
331
333
340
344
348
350
357
361
365
368 vtkBooleanMacro(DrawXGridlines, vtkTypeBool);
369
372 vtkBooleanMacro(DrawYGridlines, vtkTypeBool);
373
376 vtkBooleanMacro(DrawZGridlines, vtkTypeBool);
377
381
385
389
392 vtkBooleanMacro(DrawXGridpolys, vtkTypeBool);
393
396 vtkBooleanMacro(DrawYGridpolys, vtkTypeBool);
397
400 vtkBooleanMacro(DrawZGridpolys, vtkTypeBool);
401
406
411
413
423
425
435
437
447
449
459
466
468
472 vtkGetMacro(TickLocation, int);
474
478
479 void SetLabelScaling(bool, int, int, int);
480
482
487 void SetUseTextActor3D(int val);
490
492
496 void SetUse2DMode(int val);
499
503 void SetSaveTitlePosition(int val);
504
506
509 vtkSetVector6Macro(OrientedBounds, double);
510 vtkGetVector6Macro(OrientedBounds, double);
512
514
517 vtkSetMacro(UseOrientedBounds, int);
518 vtkGetMacro(UseOrientedBounds, int);
520
522
525 vtkSetVector3Macro(AxisBaseForX, double);
526 vtkGetVector3Macro(AxisBaseForX, double);
528
530
533 vtkSetVector3Macro(AxisBaseForY, double);
534 vtkGetVector3Macro(AxisBaseForY, double);
536
538
541 vtkSetVector3Macro(AxisBaseForZ, double);
542 vtkGetVector3Macro(AxisBaseForZ, double);
544
546
550 vtkSetVector3Macro(AxisOrigin, double);
551 vtkGetVector3Macro(AxisOrigin, double);
553
555
558 vtkSetMacro(UseAxisOrigin, int);
559 vtkGetMacro(UseAxisOrigin, int);
561
563
566 vtkSetMacro(GridLineLocation, int);
567 vtkGetMacro(GridLineLocation, int);
569
571
576 vtkSetMacro(StickyAxes, vtkTypeBool);
577 vtkGetMacro(StickyAxes, vtkTypeBool);
578 vtkBooleanMacro(StickyAxes, vtkTypeBool);
580
582
591 vtkBooleanMacro(CenterStickyAxes, vtkTypeBool);
593
600
601protected:
604
611 vtkViewport* viewport, const double bounds[6], double sphereCenter[3], double& sphereRadius);
612
616 void GetViewportLimitedBounds(vtkViewport* viewport, double bounds[6]);
617
623 unsigned int pointIndex, unsigned int& xBit, unsigned int& yBit, unsigned int& zBit);
624
628 static void GetBoundsPoint(unsigned int pointIndex, const double bounds[6], double point[3]);
629
630 int LabelExponent(double min, double max);
631
632 int Digits(double min, double max);
633
634 double MaxOf(double, double);
635 double MaxOf(double, double, double, double);
636
637 double FFix(double);
638 double FSign(double, double);
639 int FRound(double fnt);
640 int GetNumTicks(double range, double fxt);
641
642 void UpdateLabels(vtkAxisActor** axis, int index);
643
645
647
648 // Expose internally closest axis index computation
649 int FindClosestAxisIndex(double pts[8][3]);
650
651 // Expose internally furthest axis index computation
652 int FindFurtherstAxisIndex(double pts[8][3]);
653
654 // Expose internally the boundary edge fly mode axis index computation
655 void FindBoundaryEdge(int& indexOfAxisX, int& indexOfAxisY, int& indexOfAxisZ, double pts[8][3]);
656
662 void UpdateGridLineVisibility(int axisIndex);
663
664 // VTK_ALL_GRID_LINES 0
665 // VTK_CLOSEST_GRID_LINES 1
666 // VTK_FURTHEST_GRID_LINES 2
668
673
678
684
690
696
702
707
709
717
719
720 char* XTitle;
721 char* XUnits;
722 char* YTitle;
723 char* YUnits;
724 char* ZTitle;
725 char* ZUnits;
726
730
732
736
740
744
748
752
756
760
764
766
768
770
772
774
777
779
792
793 double RenderedBounds[6];
794 double OrientedBounds[6];
796
797 double AxisOrigin[3];
799
800 double AxisBaseForX[3];
801 double AxisBaseForY[3];
802 double AxisBaseForZ[3];
803
804private:
805 vtkCubeAxesActor(const vtkCubeAxesActor&) = delete;
806 void operator=(const vtkCubeAxesActor&) = delete;
807
808 vtkSetStringMacro(ActualXLabel);
809 vtkSetStringMacro(ActualYLabel);
810 vtkSetStringMacro(ActualZLabel);
811
812 vtkTimeStamp BuildTime;
813 int LastUseOrientedBounds;
814 int LastXPow;
815 int LastYPow;
816 int LastZPow;
817
818 int UserXPow;
819 int UserYPow;
820 int UserZPow;
821
822 bool AutoLabelScaling;
823
824 int LastXAxisDigits;
825 int LastYAxisDigits;
826 int LastZAxisDigits;
827
828 double LastXRange[2];
829 double LastYRange[2];
830 double LastZRange[2];
831 double LastBounds[6];
832
833 int LastFlyMode;
834
835 int RenderAxesX[NUMBER_OF_ALIGNED_AXIS];
836 int RenderAxesY[NUMBER_OF_ALIGNED_AXIS];
837 int RenderAxesZ[NUMBER_OF_ALIGNED_AXIS];
838
839 int NumberOfAxesX;
840 int NumberOfAxesY;
841 int NumberOfAxesZ;
842
843 bool MustAdjustXValue;
844 bool MustAdjustYValue;
845 bool MustAdjustZValue;
846
847 bool ForceXLabelReset;
848 bool ForceYLabelReset;
849 bool ForceZLabelReset;
850
851 double XAxisRange[2];
852 double YAxisRange[2];
853 double ZAxisRange[2];
854
855 double LabelScale;
856 double TitleScale;
857
858 double ScreenSize;
859 double LabelOffset;
860 double TitleOffset;
861
863
867 double MajorStart[3];
868 double DeltaMajor[3];
870
871 int RenderGeometry(bool& initialRender, vtkViewport* viewport, bool checkAxisVisibility,
872 int (vtkAxisActor::*renderMethod)(vtkViewport*));
873
874 void TransformBounds(vtkViewport* viewport, const double bounds[6], double pts[8][3]);
875 void AdjustAxes(double bounds[6], double xCoords[NUMBER_OF_ALIGNED_AXIS][6],
876 double yCoords[NUMBER_OF_ALIGNED_AXIS][6], double zCoords[NUMBER_OF_ALIGNED_AXIS][6],
877 double xRange[2], double yRange[2], double zRange[2]);
878
879 bool ComputeTickSize(double bounds[6]);
880 void AdjustValues(const double xRange[2], const double yRange[2], const double zRange[2]);
881 void AdjustRange(const double bounds[6]);
882 void BuildAxes(vtkViewport*);
883 void DetermineRenderAxes(vtkViewport*);
884 void SetNonDependentAttributes(void);
885 void BuildLabels(vtkAxisActor* axes[NUMBER_OF_ALIGNED_AXIS]);
886 void AdjustTicksComputeRange(
887 vtkAxisActor* axes[NUMBER_OF_ALIGNED_AXIS], double rangeMin, double rangeMax);
888
889 void AutoScale(vtkViewport* viewport);
890 void AutoScale(vtkViewport* viewport, vtkAxisActor* axes[NUMBER_OF_ALIGNED_AXIS]);
891 double AutoScale(vtkViewport* viewport, double screenSize, double position[3]);
892};
893
894#endif
double * GetBounds() override
Return a reference to the Prop3D's composite transform.
Create an axis with tick marks and labels.
a virtual camera for 3D rendering
Definition vtkCamera.h:52
void FindBoundaryEdge(int &indexOfAxisX, int &indexOfAxisY, int &indexOfAxisZ, double pts[8][3])
void SetTickLocationToInside(void)
vtkProperty * GetZAxesGridpolysProperty()
Get/Set axes gridPolys actors properties.
vtkStringArray * AxisLabels[3]
int EnableDistanceLOD
If enabled the actor will not be visible at a certain distance from the camera.
vtkTypeBool DrawZGridlines
void SetXAxesGridlinesProperty(vtkProperty *)
Get/Set axes (outer) gridlines actors properties.
void GetViewportLimitedBounds(vtkViewport *viewport, double bounds[6])
Get bounds such that the axes are entirely within a viewport.
void UpdateGridLineVisibility(int axisIndex)
This will Update AxisActors with GridVisibility when those should be dynamaic regarding the viewport.
void SetScreenSize(double screenSize)
Explicitly specify the screen size of title and label text.
int RenderOverlay(vtkViewport *) override
Draw the axes as per the vtkProp superclass' API.
vtkTypeBool CenterStickyAxes
Flag for centering sticky axes.
virtual int RenderTranslucentGeometry(vtkViewport *)
Draw the axes as per the vtkProp superclass' API.
vtkTypeBool DrawYGridlines
double FSign(double, double)
void SetYAxesInnerGridlinesProperty(vtkProperty *)
Get/Set axes inner gridlines actors properties.
vtkTypeBool YAxisVisibility
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
void SetUse2DMode(int val)
Get/Set 2D mode NB: Use vtkTextActor for titles in 2D instead of vtkAxisFollower.
vtkTypeBool DrawXGridpolys
vtkProperty * GetZAxesGridlinesProperty()
Get/Set axes (outer) gridlines actors properties.
vtkTypeBool DrawXInnerGridlines
void SetFlyModeToOuterEdges()
Specify a mode to control how the axes are drawn: either static, closest triad, furthest triad or out...
vtkTypeBool HasTranslucentPolygonalGeometry() override
Draw the axes as per the vtkProp superclass' API.
vtkProperty * GetXAxesLinesProperty()
Get/Set axes actors properties.
vtkTypeBool DrawZInnerGridlines
vtkProperty * GetXAxesInnerGridlinesProperty()
Get/Set axes inner gridlines actors properties.
int EnableViewAngleLOD
If enabled the actor will not be visible at a certain view angle.
vtkProperty * XAxesInnerGridlinesProperty
void SetXAxesGridpolysProperty(vtkProperty *)
Get/Set axes gridPolys actors properties.
void SetTitleOffset(double offset)
Explicitly specify the distance between title and labels.
int GetUseTextActor3D()
Use or not vtkTextActor3D for titles and labels.
void SetZAxesGridpolysProperty(vtkProperty *)
Get/Set axes gridPolys actors properties.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkProperty * YAxesLinesProperty
double * GetBounds() override
Explicitly specify the region in space around which to draw the bounds.
void SetFlyModeToClosestTriad()
Specify a mode to control how the axes are drawn: either static, closest triad, furthest triad or out...
void SetYAxesGridpolysProperty(vtkProperty *)
Get/Set axes gridPolys actors properties.
void SetZAxesInnerGridlinesProperty(vtkProperty *)
Get/Set axes inner gridlines actors properties.
void SetZAxesGridlinesProperty(vtkProperty *)
Get/Set axes (outer) gridlines actors properties.
double ViewAngleLODThreshold
This determines at what view angle to geometry will make the geometry not visible.
~vtkCubeAxesActor() override
void SetAxisLabels(int axis, vtkStringArray *value)
Explicitly specify the axis labels along an axis as an array of strings instead of using the values.
static vtkCubeAxesActor * New()
Instantiate object with label format "6.3g" and the number of labels per axis set to 3.
int FRound(double fnt)
int FindClosestAxisIndex(double pts[8][3])
int RenderOpaqueGeometry(vtkViewport *) override
Draw the axes as per the vtkProp superclass' API.
vtkProperty * YAxesInnerGridlinesProperty
vtkAxisActor * YAxes[NUMBER_OF_ALIGNED_AXIS]
Control variables for all axes NB: [0] always for 'Major' axis during non-static fly modes.
void ComputeStickyAxesBoundingSphere(vtkViewport *viewport, const double bounds[6], double sphereCenter[3], double &sphereRadius)
Computes a bounding sphere used to determine the sticky bounding box.
static void GetBoundsPoint(unsigned int pointIndex, const double bounds[6], double point[3])
Get a point on the bounding box by point index.
vtkTypeBool DrawYInnerGridlines
vtkProperty * YAxesGridlinesProperty
void SetLabelOffset(double offset)
Explicitly specify the distance between labels and the axis.
vtkTypeBool YAxisLabelVisibility
vtkTypeBool XAxisVisibility
vtkTextProperty * LabelTextProperty[3]
vtkProperty * GetXAxesGridlinesProperty()
Get/Set axes (outer) gridlines actors properties.
vtkTypeBool StickyAxes
Flag for axes stickiness.
vtkTypeBool XAxisTickVisibility
vtkTypeBool YAxisTickVisibility
vtkAxisActor * ZAxes[NUMBER_OF_ALIGNED_AXIS]
Control variables for all axes NB: [0] always for 'Major' axis during non-static fly modes.
vtkTextProperty * GetLabelTextProperty(int)
Returns the text property for the labels on an axis.
void SetZAxesLinesProperty(vtkProperty *)
Get/Set axes actors properties.
vtkTypeBool DrawYGridpolys
void SetFlyModeToStaticEdges()
Specify a mode to control how the axes are drawn: either static, closest triad, furthest triad or out...
vtkTypeBool YAxisMinorTickVisibility
void SetFlyModeToStaticTriad()
Specify a mode to control how the axes are drawn: either static, closest triad, furthest triad or out...
void SetYAxesLinesProperty(vtkProperty *)
Get/Set axes actors properties.
vtkStringArray * GetAxisLabels(int axis)
Explicitly specify the axis labels along an axis as an array of strings instead of using the values.
virtual double * GetRenderedBounds()
Method used to properly return the bounds of the cube axis itself with all its labels.
vtkProperty * GetYAxesGridlinesProperty()
Get/Set axes (outer) gridlines actors properties.
vtkProperty * GetZAxesLinesProperty()
Get/Set axes actors properties.
void SetSaveTitlePosition(int val)
For 2D mode only: save axis title positions for later use.
vtkAxisActor * XAxes[NUMBER_OF_ALIGNED_AXIS]
Control variables for all axes NB: [0] always for 'Major' axis during non-static fly modes.
vtkTextProperty * GetTitleTextProperty(int)
Returns the text property for the title on an axis.
vtkProperty * YAxesGridpolysProperty
vtkProperty * XAxesGridlinesProperty
static void GetBoundsPointBits(unsigned int pointIndex, unsigned int &xBit, unsigned int &yBit, unsigned int &zBit)
Get the bits for a bounds point.
int GetUse2DMode()
Get/Set 2D mode NB: Use vtkTextActor for titles in 2D instead of vtkAxisFollower.
void SetXAxesInnerGridlinesProperty(vtkProperty *)
Get/Set axes inner gridlines actors properties.
void SetLabelScaling(bool, int, int, int)
void SetTickLocationToOutside(void)
vtkProperty * ZAxesLinesProperty
void SetUseTextActor3D(int val)
Use or not vtkTextActor3D for titles and labels.
double FFix(double)
int FindFurtherstAxisIndex(double pts[8][3])
vtkTypeBool DrawZGridpolys
vtkProperty * XAxesGridpolysProperty
vtkProperty * GetXAxesGridpolysProperty()
Get/Set axes gridPolys actors properties.
vtkTextProperty * TitleTextProperty[3]
vtkProperty * ZAxesGridlinesProperty
vtkTypeBool DrawXGridlines
vtkProperty * ZAxesInnerGridlinesProperty
double MaxOf(double, double, double, double)
int GetNumTicks(double range, double fxt)
void UpdateLabels(vtkAxisActor **axis, int index)
vtkTypeBool ZAxisTickVisibility
vtkProperty * GetYAxesInnerGridlinesProperty()
Get/Set axes inner gridlines actors properties.
vtkProperty * XAxesLinesProperty
int Digits(double min, double max)
vtkTypeBool XAxisLabelVisibility
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Draw the axes as per the vtkProp superclass' API.
vtkProperty * GetZAxesInnerGridlinesProperty()
Get/Set axes inner gridlines actors properties.
virtual void SetFlyMode(int)
Specify a mode to control how the axes are drawn: either static, closest triad, furthest triad or out...
vtkTypeBool ZAxisVisibility
vtkTypeBool ZAxisMinorTickVisibility
virtual void SetCamera(vtkCamera *)
Set/Get the camera to perform scaling and translation of the vtkCubeAxesActor.
virtual void GetRenderedBounds(double rBounds[6])
Method used to properly return the bounds of the cube axis itself with all its labels.
double MaxOf(double, double)
vtkTypeBool XAxisMinorTickVisibility
vtkProperty * GetYAxesLinesProperty()
Get/Set axes actors properties.
int LabelExponent(double min, double max)
vtkProperty * ZAxesGridpolysProperty
void SetXAxesLinesProperty(vtkProperty *)
Get/Set axes actors properties.
void SetYAxesGridlinesProperty(vtkProperty *)
Get/Set axes (outer) gridlines actors properties.
vtkProperty * GetYAxesGridpolysProperty()
Get/Set axes gridPolys actors properties.
virtual void SetTickLocation(int)
Set/Get the location of ticks marks.
void SetTickLocationToBoth(void)
void SetFlyModeToFurthestTriad()
Specify a mode to control how the axes are drawn: either static, closest triad, furthest triad or out...
vtkTypeBool ZAxisLabelVisibility
double DistanceLODThreshold
Default is 0.80 This determines at what fraction of camera far clip range, actor is not visible.
a simple class to control print indentation
Definition vtkIndent.h:40
double Bounds[6]
Definition vtkProp3D.h:408
represent surface properties of a geometric object
Definition vtkProperty.h:68
a vtkAbstractArray subclass for strings
represent text properties.
record modification and/or execution time
abstract specification for Viewports
Definition vtkViewport.h:56
window superclass for vtkRenderWindow
Definition vtkWindow.h:39
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_INT_MAX
Definition vtkType.h:155
#define VTK_SIZEHINT(...)
#define max(a, b)