VTK  9.4.20251007
vtkDistanceRepresentation.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
14
15#ifndef vtkDistanceRepresentation_h
16#define vtkDistanceRepresentation_h
17
18#include "vtkInteractionWidgetsModule.h" // For export macro
20#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
21
22VTK_ABI_NAMESPACE_BEGIN
24
25class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkDistanceRepresentation
27{
28public:
30
34 void PrintSelf(ostream& os, vtkIndent indent) override;
36
41 virtual double GetDistance() = 0;
42
44
49 virtual void GetPoint1WorldPosition(double pos[3]) = 0;
50 virtual void GetPoint2WorldPosition(double pos[3]) = 0;
51 virtual double* GetPoint1WorldPosition() VTK_SIZEHINT(3) = 0;
52 virtual double* GetPoint2WorldPosition() VTK_SIZEHINT(3) = 0;
53 virtual void SetPoint1DisplayPosition(double pos[3]) = 0;
54 virtual void SetPoint2DisplayPosition(double pos[3]) = 0;
55 virtual void GetPoint1DisplayPosition(double pos[3]) = 0;
56 virtual void GetPoint2DisplayPosition(double pos[3]) = 0;
57 virtual void SetPoint1WorldPosition(double pos[3]) = 0;
58 virtual void SetPoint2WorldPosition(double pos[3]) = 0;
60
62
75
77
85
87
92 vtkSetClampMacro(Tolerance, int, 1, 100);
93 vtkGetMacro(Tolerance, int);
95
97
102 vtkSetStringMacro(LabelFormat);
103 vtkGetStringMacro(LabelFormat);
105
107
115 vtkSetMacro(Scale, double);
116 vtkGetMacro(Scale, double);
118
120
125 vtkSetMacro(RulerMode, vtkTypeBool);
126 vtkGetMacro(RulerMode, vtkTypeBool);
127 vtkBooleanMacro(RulerMode, vtkTypeBool);
129
131
135 vtkSetClampMacro(RulerDistance, double, 0, VTK_FLOAT_MAX);
136 vtkGetMacro(RulerDistance, double);
138
140
147 vtkSetClampMacro(NumberOfRulerTicks, int, 1, VTK_INT_MAX);
148 vtkGetMacro(NumberOfRulerTicks, int);
150
151 // Used to communicate about the state of the representation
152 enum
153 {
157 };
158
160
163 void BuildRepresentation() override;
164 int ComputeInteractionState(int X, int Y, int modify = 0) override;
165 void StartWidgetInteraction(double e[2]) override;
166 void WidgetInteraction(double e[2]) override;
168 unsigned long event, void* calldata) override;
170 unsigned long event, void* calldata) override;
172 unsigned long event, void* calldata, int modify = 0) override;
174
175protected:
178
179 // The handle and the rep used to close the handles
183
184 // Selection tolerance for the handles
186
187 // Format for printing the distance
189
190 // Scale to change from the VTK world coordinates to the desired coordinate
191 // system.
192 double Scale;
193
194 // Ruler related stuff
198
199private:
201 void operator=(const vtkDistanceRepresentation&) = delete;
202};
203
204VTK_ABI_NAMESPACE_END
205#endif
define the API for widget / widget representation
int ComputeInteractionState(int X, int Y, int modify=0) override
These are methods that satisfy vtkWidgetRepresentation's API.
int ComputeComplexInteractionState(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata, int modify=0) override
These are methods that satisfy vtkWidgetRepresentation's API.
virtual void GetPoint1WorldPosition(double pos[3])=0
Methods to Set/Get the coordinates of the two points defining this representation.
void StartComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
These are methods that satisfy vtkWidgetRepresentation's API.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK methods.
virtual double GetDistance()=0
This representation and all subclasses must keep a distance consistent with the state of the widget.
virtual void GetPoint2WorldPosition(double pos[3])=0
Methods to Set/Get the coordinates of the two points defining this representation.
vtkHandleRepresentation * Point2Representation
virtual void GetPoint2DisplayPosition(double pos[3])=0
Methods to Set/Get the coordinates of the two points defining this representation.
virtual void GetPoint1DisplayPosition(double pos[3])=0
Methods to Set/Get the coordinates of the two points defining this representation.
vtkHandleRepresentation * HandleRepresentation
void SetHandleRepresentation(vtkHandleRepresentation *handle)
This method is used to specify the type of handle representation to use for the two internal vtkHandl...
virtual void SetPoint1WorldPosition(double pos[3])=0
Methods to Set/Get the coordinates of the two points defining this representation.
virtual double * GetPoint1WorldPosition()=0
Methods to Set/Get the coordinates of the two points defining this representation.
void InstantiateHandleRepresentation()
This method is used to specify the type of handle representation to use for the two internal vtkHandl...
~vtkDistanceRepresentation() override
virtual void SetPoint2WorldPosition(double pos[3])=0
Methods to Set/Get the coordinates of the two points defining this representation.
void BuildRepresentation() override
These are methods that satisfy vtkWidgetRepresentation's API.
virtual void SetPoint2DisplayPosition(double pos[3])=0
Methods to Set/Get the coordinates of the two points defining this representation.
void WidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkHandleRepresentation * Point1Representation
void ComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
These are methods that satisfy vtkWidgetRepresentation's API.
void StartWidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation's API.
virtual void SetPoint1DisplayPosition(double pos[3])=0
Methods to Set/Get the coordinates of the two points defining this representation.
abstract class for representing widget handles
a simple class to control print indentation
Definition vtkIndent.h:29
platform-independent render window interaction including picking and frame rate control.
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_INT_MAX
Definition vtkType.h:144
#define VTK_FLOAT_MAX
Definition vtkType.h:152
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO