VTK  9.0.1
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:
186  ~vtkDistanceRepresentation() override;
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
vtkWidgetRepresentation::StartWidgetInteraction
virtual void StartWidgetInteraction(double eventPos[2])
Definition: vtkWidgetRepresentation.h:135
vtkWidgetRepresentation.h
vtkDistanceRepresentation::Tolerance
int Tolerance
Definition: vtkDistanceRepresentation.h:194
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:155
vtkDistanceRepresentation::Scale
double Scale
Definition: vtkDistanceRepresentation.h:201
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:59
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:55
vtkDistanceRepresentation::Point1Representation
vtkHandleRepresentation * Point1Representation
Definition: vtkDistanceRepresentation.h:190
vtkWidgetRepresentation::BuildRepresentation
virtual void BuildRepresentation()=0
vtkWidgetRepresentation::StartComplexInteraction
virtual void StartComplexInteraction(vtkRenderWindowInteractor *, vtkAbstractWidget *, unsigned long, void *)
Definition: vtkWidgetRepresentation.h:149
vtkWidgetRepresentation::ComputeComplexInteractionState
virtual int ComputeComplexInteractionState(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *callData, int modify=0)
vtkDistanceRepresentation::NearP1
@ NearP1
Definition: vtkDistanceRepresentation.h:164
vtkAbstractWidget
define the API for widget / widget representation
Definition: vtkAbstractWidget.h:65
vtkWidgetRepresentation::ComplexInteraction
virtual void ComplexInteraction(vtkRenderWindowInteractor *, vtkAbstractWidget *, unsigned long, void *)
Definition: vtkWidgetRepresentation.h:153
vtkWidgetRepresentation::WidgetInteraction
virtual void WidgetInteraction(double newEventPos[2])
Definition: vtkWidgetRepresentation.h:136
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:45
vtkDistanceRepresentation
represent the vtkDistanceWidget
Definition: vtkDistanceRepresentation.h:35
vtkDistanceRepresentation::HandleRepresentation
vtkHandleRepresentation * HandleRepresentation
Definition: vtkDistanceRepresentation.h:189
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkDistanceRepresentation::RulerDistance
double RulerDistance
Definition: vtkDistanceRepresentation.h:205
VTK_FLOAT_MAX
#define VTK_FLOAT_MAX
Definition: vtkType.h:163
vtkDistanceRepresentation::LabelFormat
char * LabelFormat
Definition: vtkDistanceRepresentation.h:197
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:82
vtkDistanceRepresentation::NumberOfRulerTicks
int NumberOfRulerTicks
Definition: vtkDistanceRepresentation.h:206
vtkDistanceRepresentation::Point2Representation
vtkHandleRepresentation * Point2Representation
Definition: vtkDistanceRepresentation.h:191
vtkDistanceRepresentation::RulerMode
vtkTypeBool RulerMode
Definition: vtkDistanceRepresentation.h:204
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkWidgetRepresentation::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkWidgetRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.