VTK  9.2.20230205
vtkCoordinate.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCoordinate.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
172 #ifndef vtkCoordinate_h
173 #define vtkCoordinate_h
174 
175 #include "vtkObject.h"
176 #include "vtkRenderingCoreModule.h" // For export macro
177 VTK_ABI_NAMESPACE_BEGIN
178 class vtkViewport;
179 
180 #define VTK_DISPLAY 0
181 #define VTK_NORMALIZED_DISPLAY 1
182 #define VTK_VIEWPORT 2
183 #define VTK_NORMALIZED_VIEWPORT 3
184 #define VTK_VIEW 4
185 #define VTK_POSE 5
186 #define VTK_WORLD 6
187 #define VTK_USERDEFINED 7
188 
189 class VTKRENDERINGCORE_EXPORT vtkCoordinate : public vtkObject
190 {
191 public:
192  vtkTypeMacro(vtkCoordinate, vtkObject);
193  void PrintSelf(ostream& os, vtkIndent indent) override;
194 
199  static vtkCoordinate* New();
200 
202 
207  vtkSetMacro(CoordinateSystem, int);
208  vtkGetMacro(CoordinateSystem, int);
209  void SetCoordinateSystemToDisplay() { this->SetCoordinateSystem(VTK_DISPLAY); }
211  {
212  this->SetCoordinateSystem(VTK_NORMALIZED_DISPLAY);
213  }
214  void SetCoordinateSystemToViewport() { this->SetCoordinateSystem(VTK_VIEWPORT); }
216  {
217  this->SetCoordinateSystem(VTK_NORMALIZED_VIEWPORT);
218  }
219  void SetCoordinateSystemToView() { this->SetCoordinateSystem(VTK_VIEW); }
220  void SetCoordinateSystemToPose() { this->SetCoordinateSystem(VTK_POSE); }
221  void SetCoordinateSystemToWorld() { this->SetCoordinateSystem(VTK_WORLD); }
223 
225 
227 
231  vtkSetVector3Macro(Value, double);
232  vtkGetVector3Macro(Value, double);
233  void SetValue(double a, double b) { this->SetValue(a, b, 0.0); }
235 
237 
243  vtkGetObjectMacro(ReferenceCoordinate, vtkCoordinate);
245 
247 
254  void SetViewport(vtkViewport* viewport);
255  vtkGetObjectMacro(Viewport, vtkViewport);
257 
259 
267 
270 
278 
286  virtual double* GetComputedUserDefinedValue(vtkViewport*) VTK_SIZEHINT(3) { return this->Value; }
287 
288 protected:
290  ~vtkCoordinate() override;
291 
292  double Value[3];
296  double ComputedWorldValue[3];
297  int ComputedDisplayValue[2];
298  int ComputedViewportValue[2];
300 
301  double ComputedDoubleDisplayValue[2];
302  double ComputedDoubleViewportValue[2];
303  double ComputedUserDefinedValue[3];
304 
305 private:
306  vtkCoordinate(const vtkCoordinate&) = delete;
307  void operator=(const vtkCoordinate&) = delete;
308 };
309 
310 VTK_ABI_NAMESPACE_END
311 #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:120
abstract base class for most VTK objects
Definition: vtkObject.h:83
abstract specification for Viewports
Definition: vtkViewport.h:57
#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(...)