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 =========================================================================*/
46 #ifndef vtkDistanceRepresentation_h
47 #define vtkDistanceRepresentation_h
48 
49 #include "vtkInteractionWidgetsModule.h" // For export macro
51 
53 
54 class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceRepresentation : public vtkWidgetRepresentation
55 {
56 public:
58 
62  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
69  virtual double GetDistance() = 0;
70 
72 
77  virtual void GetPoint1WorldPosition(double pos[3]) = 0;
78  virtual void GetPoint2WorldPosition(double pos[3]) = 0;
79  virtual double* GetPoint1WorldPosition() VTK_SIZEHINT(3) = 0;
80  virtual double* GetPoint2WorldPosition() VTK_SIZEHINT(3) = 0;
81  virtual void SetPoint1DisplayPosition(double pos[3]) = 0;
82  virtual void SetPoint2DisplayPosition(double pos[3]) = 0;
83  virtual void GetPoint1DisplayPosition(double pos[3]) = 0;
84  virtual void GetPoint2DisplayPosition(double pos[3]) = 0;
85  virtual void SetPoint1WorldPosition(double pos[3]) = 0;
86  virtual void SetPoint2WorldPosition(double pos[3]) = 0;
88 
90 
100  void SetHandleRepresentation(vtkHandleRepresentation* handle);
101  void InstantiateHandleRepresentation();
103 
105 
110  vtkGetObjectMacro(Point1Representation, vtkHandleRepresentation);
111  vtkGetObjectMacro(Point2Representation, vtkHandleRepresentation);
113 
115 
120  vtkSetClampMacro(Tolerance, int, 1, 100);
121  vtkGetMacro(Tolerance, int);
123 
125 
130  vtkSetStringMacro(LabelFormat);
131  vtkGetStringMacro(LabelFormat);
133 
135 
143  vtkSetMacro(Scale, double);
144  vtkGetMacro(Scale, double);
146 
148 
153  vtkSetMacro(RulerMode, vtkTypeBool);
154  vtkGetMacro(RulerMode, vtkTypeBool);
155  vtkBooleanMacro(RulerMode, vtkTypeBool);
157 
159 
163  vtkSetClampMacro(RulerDistance, double, 0, VTK_FLOAT_MAX);
164  vtkGetMacro(RulerDistance, double);
166 
168 
175  vtkSetClampMacro(NumberOfRulerTicks, int, 1, VTK_INT_MAX);
176  vtkGetMacro(NumberOfRulerTicks, int);
178 
179  // Used to communicate about the state of the representation
180  enum
181  {
182  Outside = 0,
184  NearP2
185  };
186 
188 
191  void BuildRepresentation() override;
192  int ComputeInteractionState(int X, int Y, int modify = 0) override;
193  void StartWidgetInteraction(double e[2]) override;
194  void WidgetInteraction(double e[2]) override;
196  unsigned long event, void* calldata) override;
198  unsigned long event, void* calldata) override;
200  unsigned long event, void* calldata, int modify = 0) override;
202 
203 protected:
206 
207  // The handle and the rep used to close the handles
211 
212  // Selection tolerance for the handles
214 
215  // Format for printing the distance
216  char* LabelFormat;
217 
218  // Scale to change from the VTK world coordinates to the desired coordinate
219  // system.
220  double Scale;
221 
222  // Ruler related stuff
226 
227 private:
229  void operator=(const vtkDistanceRepresentation&) = delete;
230 };
231 
232 #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:119
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(...)