VTK  9.7.1
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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
21 
22 VTK_ABI_NAMESPACE_BEGIN
24 
25 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkDistanceRepresentation
27 {
28 public:
30 
34  void PrintSelf(ostream& os, vtkIndent indent) override;
36 
41  virtual double GetDistance() = 0;
42 
44 
50  virtual void GetPoint1WorldPosition(double pos[3]) VTK_FUTURE_CONST = 0;
52  virtual void GetPoint2WorldPosition(double pos[3]) VTK_FUTURE_CONST = 0;
54  virtual double* GetPoint1WorldPosition() VTK_SIZEHINT(3) = 0;
56  virtual double* GetPoint2WorldPosition() VTK_SIZEHINT(3) = 0;
58  virtual void SetPoint1DisplayPosition(double pos[3]) = 0;
60  virtual void SetPoint2DisplayPosition(double pos[3]) = 0;
62  virtual void GetPoint1DisplayPosition(double pos[3]) VTK_FUTURE_CONST = 0;
64  virtual void GetPoint2DisplayPosition(double pos[3]) VTK_FUTURE_CONST = 0;
66  virtual void SetPoint1WorldPosition(double pos[3]) = 0;
68  virtual void SetPoint2WorldPosition(double pos[3]) = 0;
70 
72 
82  void SetHandleRepresentation(vtkHandleRepresentation* handle);
83  void InstantiateHandleRepresentation();
85 
87 
92  vtkGetObjectMacro(Point1Representation, vtkHandleRepresentation);
93  void SetPoint1Representation(vtkHandleRepresentation* obj);
94  vtkGetObjectMacro(Point2Representation, vtkHandleRepresentation);
95  void SetPoint2Representation(vtkHandleRepresentation* obj);
96 
98 
100 
105  vtkSetClampMacro(Tolerance, int, 1, 100);
106  vtkGetMacro(Tolerance, int);
108 
110 
115  vtkSetStringMacro(LabelFormat);
116  vtkGetStringMacro(LabelFormat);
118 
120 
128  vtkSetMacro(Scale, double);
129  vtkGetMacro(Scale, double);
131 
133 
138  vtkSetMacro(RulerMode, vtkTypeBool);
139  vtkGetMacro(RulerMode, vtkTypeBool);
140  vtkBooleanMacro(RulerMode, vtkTypeBool);
142 
144 
148  vtkSetClampMacro(RulerDistance, double, 0, VTK_FLOAT_MAX);
149  vtkGetMacro(RulerDistance, double);
151 
153 
160  vtkSetClampMacro(NumberOfRulerTicks, int, 1, VTK_INT_MAX);
161  vtkGetMacro(NumberOfRulerTicks, int);
163 
164  // Used to communicate about the state of the representation
165  enum
166  {
167  Outside = 0,
169  NearP2
170  };
171 
173 
176  void BuildRepresentation() override;
177  int ComputeInteractionState(int X, int Y, int modify = 0) override;
178  void StartWidgetInteraction(double e[2]) override;
179  void WidgetInteraction(double e[2]) override;
181  unsigned long event, void* calldata) override;
183  unsigned long event, void* calldata) override;
185  unsigned long event, void* calldata, int modify = 0) override;
187 
188 protected:
190  ~vtkDistanceRepresentation() override;
191 
192  // The handle and the rep used to close the handles
196 
197  // Selection tolerance for the handles
199 
200  // Format for printing the distance
201  char* LabelFormat;
202 
203  // Scale to change from the VTK world coordinates to the desired coordinate
204  // system.
205  double Scale;
206 
207  // Ruler related stuff
211 
212 private:
214  void operator=(const vtkDistanceRepresentation&) = delete;
215 };
216 
217 VTK_ABI_NAMESPACE_END
218 #endif
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract class for representing widget handles
represent the vtkDistanceWidget
virtual void StartWidgetInteraction(double eventPos[2])
#define VTK_INT_MAX
Definition: vtkType.h:192
virtual int ComputeComplexInteractionState(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *callData, int modify=0)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_REDUNDANT
virtual void ComplexInteraction(vtkRenderWindowInteractor *, vtkAbstractWidget *, unsigned long, void *)
virtual void StartComplexInteraction(vtkRenderWindowInteractor *, vtkAbstractWidget *, unsigned long, void *)
abstract class defines interface between the widget and widget representation classes ...
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
vtkHandleRepresentation * HandleRepresentation
int vtkTypeBool
Definition: vtkABI.h:64
platform-independent render window interaction including picking and frame rate control.
#define VTK_FLOAT_MAX
Definition: vtkType.h:200
vtkHandleRepresentation * Point1Representation
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void WidgetInteraction(double newEventPos[2])
#define VTK_SIZEHINT(...)
#define VTK_MARSHALEXCLUDE(reason)
define the API for widget / widget representation
vtkHandleRepresentation * Point2Representation
#define VTK_MARSHALAUTO