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
15#ifndef vtkDistanceRepresentation_h
16#define vtkDistanceRepresentation_h
17
18#include "vtkInteractionWidgetsModule.h" // For export macro
20
21VTK_ABI_NAMESPACE_BEGIN
23
24class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceRepresentation : public vtkWidgetRepresentation
25{
26public:
28
32 void PrintSelf(ostream& os, vtkIndent indent) override;
34
39 virtual double GetDistance() = 0;
40
42
47 virtual void GetPoint1WorldPosition(double pos[3]) = 0;
48 virtual void GetPoint2WorldPosition(double pos[3]) = 0;
49 virtual double* GetPoint1WorldPosition() VTK_SIZEHINT(3) = 0;
50 virtual double* GetPoint2WorldPosition() VTK_SIZEHINT(3) = 0;
51 virtual void SetPoint1DisplayPosition(double pos[3]) = 0;
52 virtual void SetPoint2DisplayPosition(double pos[3]) = 0;
53 virtual void GetPoint1DisplayPosition(double pos[3]) = 0;
54 virtual void GetPoint2DisplayPosition(double pos[3]) = 0;
55 virtual void SetPoint1WorldPosition(double pos[3]) = 0;
56 virtual void SetPoint2WorldPosition(double pos[3]) = 0;
58
60
70 void SetHandleRepresentation(vtkHandleRepresentation* handle);
71 void InstantiateHandleRepresentation();
73
75
80 vtkGetObjectMacro(Point1Representation, vtkHandleRepresentation);
81 vtkGetObjectMacro(Point2Representation, vtkHandleRepresentation);
83
85
90 vtkSetClampMacro(Tolerance, int, 1, 100);
91 vtkGetMacro(Tolerance, int);
93
95
100 vtkSetStringMacro(LabelFormat);
101 vtkGetStringMacro(LabelFormat);
103
105
113 vtkSetMacro(Scale, double);
114 vtkGetMacro(Scale, double);
116
118
123 vtkSetMacro(RulerMode, vtkTypeBool);
124 vtkGetMacro(RulerMode, vtkTypeBool);
125 vtkBooleanMacro(RulerMode, vtkTypeBool);
127
129
133 vtkSetClampMacro(RulerDistance, double, 0, VTK_FLOAT_MAX);
134 vtkGetMacro(RulerDistance, double);
136
138
145 vtkSetClampMacro(NumberOfRulerTicks, int, 1, VTK_INT_MAX);
146 vtkGetMacro(NumberOfRulerTicks, int);
148
149 // Used to communicate about the state of the representation
150 enum
151 {
152 Outside = 0,
154 NearP2
155 };
156
158
161 void BuildRepresentation() override;
162 int ComputeInteractionState(int X, int Y, int modify = 0) override;
163 void StartWidgetInteraction(double e[2]) override;
164 void WidgetInteraction(double e[2]) override;
166 unsigned long event, void* calldata) override;
168 unsigned long event, void* calldata) override;
170 unsigned long event, void* calldata, int modify = 0) override;
172
173protected:
176
177 // The handle and the rep used to close the handles
181
182 // Selection tolerance for the handles
184
185 // Format for printing the distance
187
188 // Scale to change from the VTK world coordinates to the desired coordinate
189 // system.
190 double Scale;
191
192 // Ruler related stuff
196
197private:
199 void operator=(const vtkDistanceRepresentation&) = delete;
200};
201
202VTK_ABI_NAMESPACE_END
203#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:29
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(...)