VTK  9.2.6
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 =========================================================================*/
36 #ifndef vtkDistanceRepresentation_h
37 #define vtkDistanceRepresentation_h
38 
39 #include "vtkInteractionWidgetsModule.h" // For export macro
41 
43 
44 class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceRepresentation : public vtkWidgetRepresentation
45 {
46 public:
48 
52  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
59  virtual double GetDistance() = 0;
60 
62 
67  virtual void GetPoint1WorldPosition(double pos[3]) = 0;
68  virtual void GetPoint2WorldPosition(double pos[3]) = 0;
69  virtual double* GetPoint1WorldPosition() VTK_SIZEHINT(3) = 0;
70  virtual double* GetPoint2WorldPosition() VTK_SIZEHINT(3) = 0;
71  virtual void SetPoint1DisplayPosition(double pos[3]) = 0;
72  virtual void SetPoint2DisplayPosition(double pos[3]) = 0;
73  virtual void GetPoint1DisplayPosition(double pos[3]) = 0;
74  virtual void GetPoint2DisplayPosition(double pos[3]) = 0;
75  virtual void SetPoint1WorldPosition(double pos[3]) = 0;
76  virtual void SetPoint2WorldPosition(double pos[3]) = 0;
78 
80 
90  void SetHandleRepresentation(vtkHandleRepresentation* handle);
91  void InstantiateHandleRepresentation();
93 
95 
100  vtkGetObjectMacro(Point1Representation, vtkHandleRepresentation);
101  vtkGetObjectMacro(Point2Representation, vtkHandleRepresentation);
103 
105 
110  vtkSetClampMacro(Tolerance, int, 1, 100);
111  vtkGetMacro(Tolerance, int);
113 
115 
120  vtkSetStringMacro(LabelFormat);
121  vtkGetStringMacro(LabelFormat);
123 
125 
133  vtkSetMacro(Scale, double);
134  vtkGetMacro(Scale, double);
136 
138 
143  vtkSetMacro(RulerMode, vtkTypeBool);
144  vtkGetMacro(RulerMode, vtkTypeBool);
145  vtkBooleanMacro(RulerMode, vtkTypeBool);
147 
149 
153  vtkSetClampMacro(RulerDistance, double, 0, VTK_FLOAT_MAX);
154  vtkGetMacro(RulerDistance, double);
156 
158 
165  vtkSetClampMacro(NumberOfRulerTicks, int, 1, VTK_INT_MAX);
166  vtkGetMacro(NumberOfRulerTicks, int);
168 
169  // Used to communicate about the state of the representation
170  enum
171  {
172  Outside = 0,
174  NearP2
175  };
176 
178 
181  void BuildRepresentation() override;
182  int ComputeInteractionState(int X, int Y, int modify = 0) override;
183  void StartWidgetInteraction(double e[2]) override;
184  void WidgetInteraction(double e[2]) override;
186  unsigned long event, void* calldata) override;
188  unsigned long event, void* calldata) override;
190  unsigned long event, void* calldata, int modify = 0) override;
192 
193 protected:
196 
197  // The handle and the rep used to close the handles
201 
202  // Selection tolerance for the handles
204 
205  // Format for printing the distance
206  char* LabelFormat;
207 
208  // Scale to change from the VTK world coordinates to the desired coordinate
209  // system.
210  double Scale;
211 
212  // Ruler related stuff
216 
217 private:
219  void operator=(const vtkDistanceRepresentation&) = delete;
220 };
221 
222 #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
virtual double * GetPoint1WorldPosition()=0
Methods to Set/Get the coordinates of the two points defining this representation.
vtkHandleRepresentation * HandleRepresentation
~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:49
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(...)