VTK  9.5.20250806
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
34#ifndef vtkDistanceRepresentation_h
35#define vtkDistanceRepresentation_h
36
37#include "vtkInteractionWidgetsModule.h" // For export macro
39#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
40
41VTK_ABI_NAMESPACE_BEGIN
43
44class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkDistanceRepresentation
46{
47public:
49
53 void PrintSelf(ostream& os, vtkIndent indent) override;
55
60 virtual double GetDistance() = 0;
61
63
69 virtual void GetPoint1WorldPosition(double pos[3]) VTK_FUTURE_CONST = 0;
71 virtual void GetPoint2WorldPosition(double pos[3]) VTK_FUTURE_CONST = 0;
73 virtual double* GetPoint1WorldPosition() VTK_SIZEHINT(3) = 0;
75 virtual double* GetPoint2WorldPosition() VTK_SIZEHINT(3) = 0;
77 virtual void SetPoint1DisplayPosition(double pos[3]) = 0;
79 virtual void SetPoint2DisplayPosition(double pos[3]) = 0;
81 virtual void GetPoint1DisplayPosition(double pos[3]) VTK_FUTURE_CONST = 0;
83 virtual void GetPoint2DisplayPosition(double pos[3]) VTK_FUTURE_CONST = 0;
85 virtual void SetPoint1WorldPosition(double pos[3]) = 0;
87 virtual void SetPoint2WorldPosition(double pos[3]) = 0;
89
91
101 void SetHandleRepresentation(vtkHandleRepresentation* handle);
102 void InstantiateHandleRepresentation();
104
106
111 vtkGetObjectMacro(Point1Representation, vtkHandleRepresentation);
112 void SetPoint1Representation(vtkHandleRepresentation* obj);
113 vtkGetObjectMacro(Point2Representation, vtkHandleRepresentation);
114 void SetPoint2Representation(vtkHandleRepresentation* obj);
115
117
119
124 vtkSetClampMacro(Tolerance, int, 1, 100);
125 vtkGetMacro(Tolerance, int);
127
129
134 vtkSetStringMacro(LabelFormat);
135 vtkGetStringMacro(LabelFormat);
137
139
147 vtkSetMacro(Scale, double);
148 vtkGetMacro(Scale, double);
150
152
157 vtkSetMacro(RulerMode, vtkTypeBool);
158 vtkGetMacro(RulerMode, vtkTypeBool);
159 vtkBooleanMacro(RulerMode, vtkTypeBool);
161
163
167 vtkSetClampMacro(RulerDistance, double, 0, VTK_FLOAT_MAX);
168 vtkGetMacro(RulerDistance, double);
170
172
179 vtkSetClampMacro(NumberOfRulerTicks, int, 1, VTK_INT_MAX);
180 vtkGetMacro(NumberOfRulerTicks, int);
182
183 // Used to communicate about the state of the representation
184 enum
185 {
186 Outside = 0,
188 NearP2
189 };
190
192
195 void BuildRepresentation() override;
196 int ComputeInteractionState(int X, int Y, int modify = 0) override;
197 void StartWidgetInteraction(double e[2]) override;
198 void WidgetInteraction(double e[2]) override;
200 unsigned long event, void* calldata) override;
202 unsigned long event, void* calldata) override;
204 unsigned long event, void* calldata, int modify = 0) override;
206
207protected:
210
211 // The handle and the rep used to close the handles
215
216 // Selection tolerance for the handles
218
219 // Format for printing the distance
221
222 // Scale to change from the VTK world coordinates to the desired coordinate
223 // system.
224 double Scale;
225
226 // Ruler related stuff
230
231private:
233 void operator=(const vtkDistanceRepresentation&) = delete;
234};
235
236VTK_ABI_NAMESPACE_END
237#endif
define the API for widget / widget representation
represent the vtkDistanceWidget
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.
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.
vtkHandleRepresentation * Point2Representation
vtkHandleRepresentation * HandleRepresentation
~vtkDistanceRepresentation() override
void BuildRepresentation() override
These are methods that satisfy vtkWidgetRepresentation's API.
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.
abstract class for representing widget handles
a simple class to control print indentation
Definition vtkIndent.h:108
platform-independent render window interaction including picking and frame rate control.
abstract class defines interface between the widget and widget representation classes
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_INT_MAX
Definition vtkType.h:161
#define VTK_FLOAT_MAX
Definition vtkType.h:169
#define VTK_MARSHAL_EXCLUDE_REASON_IS_REDUNDANT
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)