VTK  9.0.3
vtkDistanceRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDistanceRepresentation.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
27 #ifndef vtkDistanceRepresentation_h
28 #define vtkDistanceRepresentation_h
29 
30 #include "vtkInteractionWidgetsModule.h" // For export macro
32 
34 
35 class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceRepresentation : public vtkWidgetRepresentation
36 {
37 public:
39 
43  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
50  virtual double GetDistance() = 0;
51 
53 
58  virtual void GetPoint1WorldPosition(double pos[3]) = 0;
59  virtual void GetPoint2WorldPosition(double pos[3]) = 0;
60  virtual double* GetPoint1WorldPosition() VTK_SIZEHINT(3) = 0;
61  virtual double* GetPoint2WorldPosition() VTK_SIZEHINT(3) = 0;
62  virtual void SetPoint1DisplayPosition(double pos[3]) = 0;
63  virtual void SetPoint2DisplayPosition(double pos[3]) = 0;
64  virtual void GetPoint1DisplayPosition(double pos[3]) = 0;
65  virtual void GetPoint2DisplayPosition(double pos[3]) = 0;
66  virtual void SetPoint1WorldPosition(double pos[3]) = 0;
67  virtual void SetPoint2WorldPosition(double pos[3]) = 0;
69 
71 
81  void SetHandleRepresentation(vtkHandleRepresentation* handle);
82  void InstantiateHandleRepresentation();
84 
86 
91  vtkGetObjectMacro(Point1Representation, vtkHandleRepresentation);
92  vtkGetObjectMacro(Point2Representation, vtkHandleRepresentation);
94 
96 
101  vtkSetClampMacro(Tolerance, int, 1, 100);
102  vtkGetMacro(Tolerance, int);
104 
106 
111  vtkSetStringMacro(LabelFormat);
112  vtkGetStringMacro(LabelFormat);
114 
116 
124  vtkSetMacro(Scale, double);
125  vtkGetMacro(Scale, double);
127 
129 
134  vtkSetMacro(RulerMode, vtkTypeBool);
135  vtkGetMacro(RulerMode, vtkTypeBool);
136  vtkBooleanMacro(RulerMode, vtkTypeBool);
138 
140 
144  vtkSetClampMacro(RulerDistance, double, 0, VTK_FLOAT_MAX);
145  vtkGetMacro(RulerDistance, double);
147 
149 
156  vtkSetClampMacro(NumberOfRulerTicks, int, 1, VTK_INT_MAX);
157  vtkGetMacro(NumberOfRulerTicks, int);
159 
160  // Used to communicate about the state of the representation
161  enum
162  {
163  Outside = 0,
165  NearP2
166  };
167 
169 
172  void BuildRepresentation() override;
173  int ComputeInteractionState(int X, int Y, int modify = 0) override;
174  void StartWidgetInteraction(double e[2]) override;
175  void WidgetInteraction(double e[2]) override;
177  unsigned long event, void* calldata) override;
179  unsigned long event, void* calldata) override;
181  unsigned long event, void* calldata, int modify = 0) override;
183 
184 protected:
187 
188  // The handle and the rep used to close the handles
192 
193  // Selection tolerance for the handles
195 
196  // Format for printing the distance
197  char* LabelFormat;
198 
199  // Scale to change from the VTK world coordinates to the desired coordinate
200  // system.
201  double Scale;
202 
203  // Ruler related stuff
207 
208 private:
210  void operator=(const vtkDistanceRepresentation&) = delete;
211 };
212 
213 #endif
define the API for widget / widget representation
represent the vtkDistanceWidget
int ComputeInteractionState(int X, int Y, int modify=0) override
int ComputeComplexInteractionState(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata, int modify=0) override
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
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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
vtkHandleRepresentation * Point2Representation
virtual double * GetPoint1WorldPosition()=0
vtkHandleRepresentation * HandleRepresentation
~vtkDistanceRepresentation() override
void BuildRepresentation() override
These are methods that satisfy vtkWidgetRepresentation's API.
void WidgetInteraction(double e[2]) override
vtkHandleRepresentation * Point1Representation
void ComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
void StartWidgetInteraction(double e[2]) override
abstract class for representing widget handles
a simple class to control print indentation
Definition: vtkIndent.h:34
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:69
#define VTK_INT_MAX
Definition: vtkType.h:155
#define VTK_FLOAT_MAX
Definition: vtkType.h:163
#define VTK_SIZEHINT(...)