VTK  9.3.20240328
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
160 #ifndef vtkCoordinate_h
161 #define vtkCoordinate_h
162 
163 #include "vtkObject.h"
164 #include "vtkRenderingCoreModule.h" // For export macro
165 VTK_ABI_NAMESPACE_BEGIN
166 class vtkViewport;
167 
168 #define VTK_DISPLAY 0
169 #define VTK_NORMALIZED_DISPLAY 1
170 #define VTK_VIEWPORT 2
171 #define VTK_NORMALIZED_VIEWPORT 3
172 #define VTK_VIEW 4
173 #define VTK_POSE 5
174 #define VTK_WORLD 6
175 #define VTK_USERDEFINED 7
176 
177 class VTKRENDERINGCORE_EXPORT vtkCoordinate : public vtkObject
178 {
179 public:
180  vtkTypeMacro(vtkCoordinate, vtkObject);
181  void PrintSelf(ostream& os, vtkIndent indent) override;
182 
187  static vtkCoordinate* New();
188 
190 
195  vtkSetMacro(CoordinateSystem, int);
196  vtkGetMacro(CoordinateSystem, int);
197  void SetCoordinateSystemToDisplay() { this->SetCoordinateSystem(VTK_DISPLAY); }
199  {
200  this->SetCoordinateSystem(VTK_NORMALIZED_DISPLAY);
201  }
202  void SetCoordinateSystemToViewport() { this->SetCoordinateSystem(VTK_VIEWPORT); }
204  {
205  this->SetCoordinateSystem(VTK_NORMALIZED_VIEWPORT);
206  }
207  void SetCoordinateSystemToView() { this->SetCoordinateSystem(VTK_VIEW); }
208  void SetCoordinateSystemToPose() { this->SetCoordinateSystem(VTK_POSE); }
209  void SetCoordinateSystemToWorld() { this->SetCoordinateSystem(VTK_WORLD); }
211 
213 
215 
219  vtkSetVector3Macro(Value, double);
220  vtkGetVector3Macro(Value, double);
221  void SetValue(double a, double b) { this->SetValue(a, b, 0.0); }
223 
225 
231  vtkGetObjectMacro(ReferenceCoordinate, vtkCoordinate);
233 
235 
242  void SetViewport(vtkViewport* viewport);
243  vtkGetObjectMacro(Viewport, vtkViewport);
245 
247 
255 
258 
266 
274  virtual double* GetComputedUserDefinedValue(vtkViewport*) VTK_SIZEHINT(3) { return this->Value; }
275 
276 protected:
278  ~vtkCoordinate() override;
279 
280  double Value[3];
284  double ComputedWorldValue[3];
285  int ComputedDisplayValue[2];
286  int ComputedViewportValue[2];
288 
289  double ComputedDoubleDisplayValue[2];
290  double ComputedDoubleViewportValue[2];
291  double ComputedUserDefinedValue[3];
292 
293 private:
294  vtkCoordinate(const vtkCoordinate&) = delete;
295  void operator=(const vtkCoordinate&) = delete;
296 };
297 
298 VTK_ABI_NAMESPACE_END
299 #endif
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
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.
~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.
void SetValue(double a, double b)
Set/get the value of this coordinate.
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract base class for most VTK objects
Definition: vtkObject.h:161
abstract specification for Viewports
Definition: vtkViewport.h:64
#define VTK_DISPLAY
#define VTK_WORLD
#define VTK_VIEW
#define VTK_NORMALIZED_VIEWPORT
#define VTK_VIEWPORT
#define VTK_POSE
#define VTK_NORMALIZED_DISPLAY
#define VTK_SIZEHINT(...)