VTK  9.3.0
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
24#ifndef vtkDistanceRepresentation_h
25#define vtkDistanceRepresentation_h
26
27#include "vtkInteractionWidgetsModule.h" // For export macro
29
30VTK_ABI_NAMESPACE_BEGIN
32
33class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceRepresentation : public vtkWidgetRepresentation
34{
35public:
37
41 void PrintSelf(ostream& os, vtkIndent indent) override;
43
48 virtual double GetDistance() = 0;
49
51
56 virtual void GetPoint1WorldPosition(double pos[3]) = 0;
57 virtual void GetPoint2WorldPosition(double pos[3]) = 0;
58 virtual double* GetPoint1WorldPosition() VTK_SIZEHINT(3) = 0;
59 virtual double* GetPoint2WorldPosition() VTK_SIZEHINT(3) = 0;
60 virtual void SetPoint1DisplayPosition(double pos[3]) = 0;
61 virtual void SetPoint2DisplayPosition(double pos[3]) = 0;
62 virtual void GetPoint1DisplayPosition(double pos[3]) = 0;
63 virtual void GetPoint2DisplayPosition(double pos[3]) = 0;
64 virtual void SetPoint1WorldPosition(double pos[3]) = 0;
65 virtual void SetPoint2WorldPosition(double pos[3]) = 0;
67
69
79 void SetHandleRepresentation(vtkHandleRepresentation* handle);
80 void InstantiateHandleRepresentation();
82
84
89 vtkGetObjectMacro(Point1Representation, vtkHandleRepresentation);
90 vtkGetObjectMacro(Point2Representation, vtkHandleRepresentation);
92
94
99 vtkSetClampMacro(Tolerance, int, 1, 100);
100 vtkGetMacro(Tolerance, int);
102
104
109 vtkSetStringMacro(LabelFormat);
110 vtkGetStringMacro(LabelFormat);
112
114
122 vtkSetMacro(Scale, double);
123 vtkGetMacro(Scale, double);
125
127
132 vtkSetMacro(RulerMode, vtkTypeBool);
133 vtkGetMacro(RulerMode, vtkTypeBool);
134 vtkBooleanMacro(RulerMode, vtkTypeBool);
136
138
142 vtkSetClampMacro(RulerDistance, double, 0, VTK_FLOAT_MAX);
143 vtkGetMacro(RulerDistance, double);
145
147
154 vtkSetClampMacro(NumberOfRulerTicks, int, 1, VTK_INT_MAX);
155 vtkGetMacro(NumberOfRulerTicks, int);
157
158 // Used to communicate about the state of the representation
159 enum
160 {
161 Outside = 0,
163 NearP2
164 };
165
167
170 void BuildRepresentation() override;
171 int ComputeInteractionState(int X, int Y, int modify = 0) override;
172 void StartWidgetInteraction(double e[2]) override;
173 void WidgetInteraction(double e[2]) override;
175 unsigned long event, void* calldata) override;
177 unsigned long event, void* calldata) override;
179 unsigned long event, void* calldata, int modify = 0) override;
181
182protected:
185
186 // The handle and the rep used to close the handles
190
191 // Selection tolerance for the handles
193
194 // Format for printing the distance
196
197 // Scale to change from the VTK world coordinates to the desired coordinate
198 // system.
199 double Scale;
200
201 // Ruler related stuff
205
206private:
208 void operator=(const vtkDistanceRepresentation&) = delete;
209};
210
211VTK_ABI_NAMESPACE_END
212#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.
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
vtkHandleRepresentation * HandleRepresentation
virtual double * GetPoint1WorldPosition()=0
Methods to Set/Get the coordinates of the two points defining this representation.
~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:38
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:144
#define VTK_FLOAT_MAX
Definition vtkType.h:152
#define VTK_SIZEHINT(...)