VTK  9.3.0
vtkCoordinate.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
60 #ifndef vtkCoordinate_h
61 #define vtkCoordinate_h
62 
63 #include "vtkObject.h"
64 #include "vtkRenderingCoreModule.h" // For export macro
65 VTK_ABI_NAMESPACE_BEGIN
66 class vtkViewport;
67 
68 #define VTK_DISPLAY 0
69 #define VTK_NORMALIZED_DISPLAY 1
70 #define VTK_VIEWPORT 2
71 #define VTK_NORMALIZED_VIEWPORT 3
72 #define VTK_VIEW 4
73 #define VTK_POSE 5
74 #define VTK_WORLD 6
75 #define VTK_USERDEFINED 7
76 
77 class VTKRENDERINGCORE_EXPORT vtkCoordinate : public vtkObject
78 {
79 public:
80  vtkTypeMacro(vtkCoordinate, vtkObject);
81  void PrintSelf(ostream& os, vtkIndent indent) override;
82 
87  static vtkCoordinate* New();
88 
90 
95  vtkSetMacro(CoordinateSystem, int);
96  vtkGetMacro(CoordinateSystem, int);
97  void SetCoordinateSystemToDisplay() { this->SetCoordinateSystem(VTK_DISPLAY); }
99  {
100  this->SetCoordinateSystem(VTK_NORMALIZED_DISPLAY);
101  }
102  void SetCoordinateSystemToViewport() { this->SetCoordinateSystem(VTK_VIEWPORT); }
104  {
105  this->SetCoordinateSystem(VTK_NORMALIZED_VIEWPORT);
106  }
107  void SetCoordinateSystemToView() { this->SetCoordinateSystem(VTK_VIEW); }
108  void SetCoordinateSystemToPose() { this->SetCoordinateSystem(VTK_POSE); }
109  void SetCoordinateSystemToWorld() { this->SetCoordinateSystem(VTK_WORLD); }
111 
113 
115 
119  vtkSetVector3Macro(Value, double);
120  vtkGetVector3Macro(Value, double);
121  void SetValue(double a, double b) { this->SetValue(a, b, 0.0); }
123 
125 
131  vtkGetObjectMacro(ReferenceCoordinate, vtkCoordinate);
133 
135 
142  void SetViewport(vtkViewport* viewport);
143  vtkGetObjectMacro(Viewport, vtkViewport);
145 
147 
155 
158 
166 
174  virtual double* GetComputedUserDefinedValue(vtkViewport*) VTK_SIZEHINT(3) { return this->Value; }
175 
176 protected:
178  ~vtkCoordinate() override;
179 
180  double Value[3];
184  double ComputedWorldValue[3];
185  int ComputedDisplayValue[2];
186  int ComputedViewportValue[2];
188 
189  double ComputedDoubleDisplayValue[2];
190  double ComputedDoubleViewportValue[2];
191  double ComputedUserDefinedValue[3];
192 
193 private:
194  vtkCoordinate(const vtkCoordinate&) = delete;
195  void operator=(const vtkCoordinate&) = delete;
196 };
197 
198 VTK_ABI_NAMESPACE_END
199 #endif
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
Definition: vtkCoordinate.h:78
int * GetComputedViewportValue(vtkViewport *)
Return the computed value in a specified coordinate system.
void SetCoordinateSystemToWorld()
Set/get the coordinate system which this coordinate is defined in.
double * GetComputedDoubleViewportValue(vtkViewport *)
int * GetComputedDisplayValue(vtkViewport *)
Return the computed value in a specified coordinate system.
const char * GetCoordinateSystemAsString()
virtual void SetReferenceCoordinate(vtkCoordinate *)
If this coordinate is relative to another coordinate, then specify that coordinate as the ReferenceCo...
virtual double * GetComputedUserDefinedValue(vtkViewport *)
GetComputedUserDefinedValue() is to be used only when the coordinate system is VTK_USERDEFINED.
double * GetComputedDoubleDisplayValue(vtkViewport *)
void SetCoordinateSystemToNormalizedViewport()
Set/get the coordinate system which this coordinate is defined in.
void SetCoordinateSystemToDisplay()
Set/get the coordinate system which this coordinate is defined in.
Definition: vtkCoordinate.h:97
~vtkCoordinate() override
void SetCoordinateSystemToPose()
Set/get the coordinate system which this coordinate is defined in.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkCoordinate * New()
Creates an instance of this class with the following defaults: value of (0,0,0) in world coordinates.
int * GetComputedLocalDisplayValue(vtkViewport *)
Return the computed value in a specified coordinate system.
vtkCoordinate * ReferenceCoordinate
void SetCoordinateSystemToViewport()
Set/get the coordinate system which this coordinate is defined in.
double * GetComputedWorldValue(vtkViewport *)
Return the computed value in a specified coordinate system.
void SetViewport(vtkViewport *viewport)
If you want this coordinate to be relative to a specific vtkViewport (vtkRenderer) then you can speci...
vtkViewport * Viewport
void SetCoordinateSystemToView()
Set/get the coordinate system which this coordinate is defined in.
double * GetComputedValue(vtkViewport *)
GetComputedValue() will return either World, Viewport or Display based on what has been set as the co...
void SetCoordinateSystemToNormalizedDisplay()
Set/get the coordinate system which this coordinate is defined in.
Definition: vtkCoordinate.h:98
void SetValue(double a, double b)
Set/get the value of this coordinate.
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract base class for most VTK objects
Definition: vtkObject.h:61
abstract specification for Viewports
Definition: vtkViewport.h:54
#define VTK_DISPLAY
Definition: vtkCoordinate.h:68
#define VTK_WORLD
Definition: vtkCoordinate.h:74
#define VTK_VIEW
Definition: vtkCoordinate.h:72
#define VTK_NORMALIZED_VIEWPORT
Definition: vtkCoordinate.h:71
#define VTK_VIEWPORT
Definition: vtkCoordinate.h:70
#define VTK_POSE
Definition: vtkCoordinate.h:73
#define VTK_NORMALIZED_DISPLAY
Definition: vtkCoordinate.h:69
#define VTK_SIZEHINT(...)