VTK  9.3.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 
21 VTK_ABI_NAMESPACE_BEGIN
23 
24 class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceRepresentation : public vtkWidgetRepresentation
25 {
26 public:
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 
173 protected:
175  ~vtkDistanceRepresentation() override;
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
186  char* LabelFormat;
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 
197 private:
199  void operator=(const vtkDistanceRepresentation&) = delete;
200 };
201 
202 VTK_ABI_NAMESPACE_END
203 #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:144
virtual int ComputeComplexInteractionState(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *callData, int modify=0)
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:152
vtkHandleRepresentation * Point1Representation
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void WidgetInteraction(double newEventPos[2])
#define VTK_SIZEHINT(...)
define the API for widget / widget representation
vtkHandleRepresentation * Point2Representation