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
51 #ifndef vtkCoordinate_h
52 #define vtkCoordinate_h
53 
54 #include "vtkObject.h"
55 #include "vtkRenderingCoreModule.h" // For export macro
56 VTK_ABI_NAMESPACE_BEGIN
57 class vtkViewport;
58 
59 #define VTK_DISPLAY 0
60 #define VTK_NORMALIZED_DISPLAY 1
61 #define VTK_VIEWPORT 2
62 #define VTK_NORMALIZED_VIEWPORT 3
63 #define VTK_VIEW 4
64 #define VTK_POSE 5
65 #define VTK_WORLD 6
66 #define VTK_USERDEFINED 7
67 
68 class VTKRENDERINGCORE_EXPORT vtkCoordinate : public vtkObject
69 {
70 public:
71  vtkTypeMacro(vtkCoordinate, vtkObject);
72  void PrintSelf(ostream& os, vtkIndent indent) override;
73 
78  static vtkCoordinate* New();
79 
81 
86  vtkSetMacro(CoordinateSystem, int);
87  vtkGetMacro(CoordinateSystem, int);
88  void SetCoordinateSystemToDisplay() { this->SetCoordinateSystem(VTK_DISPLAY); }
90  {
91  this->SetCoordinateSystem(VTK_NORMALIZED_DISPLAY);
92  }
93  void SetCoordinateSystemToViewport() { this->SetCoordinateSystem(VTK_VIEWPORT); }
95  {
96  this->SetCoordinateSystem(VTK_NORMALIZED_VIEWPORT);
97  }
98  void SetCoordinateSystemToView() { this->SetCoordinateSystem(VTK_VIEW); }
99  void SetCoordinateSystemToPose() { this->SetCoordinateSystem(VTK_POSE); }
100  void SetCoordinateSystemToWorld() { this->SetCoordinateSystem(VTK_WORLD); }
102 
104 
106 
110  vtkSetVector3Macro(Value, double);
111  vtkGetVector3Macro(Value, double);
112  void SetValue(double a, double b) { this->SetValue(a, b, 0.0); }
114 
116 
122  vtkGetObjectMacro(ReferenceCoordinate, vtkCoordinate);
124 
126 
133  void SetViewport(vtkViewport* viewport);
134  vtkGetObjectMacro(Viewport, vtkViewport);
136 
138 
146 
149 
157 
165  virtual double* GetComputedUserDefinedValue(vtkViewport*) VTK_SIZEHINT(3) { return this->Value; }
166 
167 protected:
169  ~vtkCoordinate() override;
170 
171  double Value[3];
175  double ComputedWorldValue[3];
176  int ComputedDisplayValue[2];
177  int ComputedViewportValue[2];
179 
180  double ComputedDoubleDisplayValue[2];
181  double ComputedDoubleViewportValue[2];
182  double ComputedUserDefinedValue[3];
183 
184 private:
185  vtkCoordinate(const vtkCoordinate&) = delete;
186  void operator=(const vtkCoordinate&) = delete;
187 };
188 
189 VTK_ABI_NAMESPACE_END
190 #endif
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
Definition: vtkCoordinate.h:69
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.
Definition: vtkCoordinate.h:94
void SetCoordinateSystemToDisplay()
Set/get the coordinate system which this coordinate is defined in.
Definition: vtkCoordinate.h:88
~vtkCoordinate() override
void SetCoordinateSystemToPose()
Set/get the coordinate system which this coordinate is defined in.
Definition: vtkCoordinate.h:99
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.
Definition: vtkCoordinate.h:93
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.
Definition: vtkCoordinate.h:98
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:89
void SetValue(double a, double b)
Set/get the value of this coordinate.
a simple class to control print indentation
Definition: vtkIndent.h:29
abstract base class for most VTK objects
Definition: vtkObject.h:52
abstract specification for Viewports
Definition: vtkViewport.h:45
#define VTK_DISPLAY
Definition: vtkCoordinate.h:59
#define VTK_WORLD
Definition: vtkCoordinate.h:65
#define VTK_VIEW
Definition: vtkCoordinate.h:63
#define VTK_NORMALIZED_VIEWPORT
Definition: vtkCoordinate.h:62
#define VTK_VIEWPORT
Definition: vtkCoordinate.h:61
#define VTK_POSE
Definition: vtkCoordinate.h:64
#define VTK_NORMALIZED_DISPLAY
Definition: vtkCoordinate.h:60
#define VTK_SIZEHINT(...)