VTK  9.1.0
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
vtkWidgetRepresentation.h
vtkDistanceRepresentation::Tolerance
int Tolerance
Definition: vtkDistanceRepresentation.h:213
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:155
vtkDistanceRepresentation::~vtkDistanceRepresentation
~vtkDistanceRepresentation() override
vtkDistanceRepresentation::WidgetInteraction
void WidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkDistanceRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK methods.
vtkDistanceRepresentation::StartComplexInteraction
void StartComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkDistanceRepresentation::Scale
double Scale
Definition: vtkDistanceRepresentation.h:220
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:60
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:56
vtkDistanceRepresentation::ComplexInteraction
void ComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkDistanceRepresentation::Point1Representation
vtkHandleRepresentation * Point1Representation
Definition: vtkDistanceRepresentation.h:209
vtkAbstractWidget
define the API for widget / widget representation
Definition: vtkAbstractWidget.h:66
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:48
vtkDistanceRepresentation
represent the vtkDistanceWidget
Definition: vtkDistanceRepresentation.h:55
vtkDistanceRepresentation::GetPoint1WorldPosition
virtual void GetPoint1WorldPosition(double pos[3])=0
Methods to Set/Get the coordinates of the two points defining this representation.
vtkDistanceRepresentation::HandleRepresentation
vtkHandleRepresentation * HandleRepresentation
Definition: vtkDistanceRepresentation.h:208
vtkDistanceRepresentation::BuildRepresentation
void BuildRepresentation() override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkDistanceRepresentation::NearP1
@ NearP1
Definition: vtkDistanceRepresentation.h:183
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkDistanceRepresentation::GetDistance
virtual double GetDistance()=0
This representation and all subclasses must keep a distance consistent with the state of the widget.
vtkDistanceRepresentation::RulerDistance
double RulerDistance
Definition: vtkDistanceRepresentation.h:224
vtkDistanceRepresentation::ComputeComplexInteractionState
int ComputeComplexInteractionState(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata, int modify=0) override
These are methods that satisfy vtkWidgetRepresentation's API.
VTK_FLOAT_MAX
#define VTK_FLOAT_MAX
Definition: vtkType.h:163
vtkDistanceRepresentation::StartWidgetInteraction
void StartWidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkDistanceRepresentation::LabelFormat
char * LabelFormat
Definition: vtkDistanceRepresentation.h:216
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:192
vtkDistanceRepresentation::GetPoint1WorldPosition
virtual double * GetPoint1WorldPosition()=0
Methods to Set/Get the coordinates of the two points defining this representation.
vtkDistanceRepresentation::GetPoint2WorldPosition
virtual void GetPoint2WorldPosition(double pos[3])=0
Methods to Set/Get the coordinates of the two points defining this representation.
vtkDistanceRepresentation::NumberOfRulerTicks
int NumberOfRulerTicks
Definition: vtkDistanceRepresentation.h:225
vtkDistanceRepresentation::Point2Representation
vtkHandleRepresentation * Point2Representation
Definition: vtkDistanceRepresentation.h:210
vtkDistanceRepresentation::RulerMode
vtkTypeBool RulerMode
Definition: vtkDistanceRepresentation.h:223
vtkDistanceRepresentation::ComputeInteractionState
int ComputeInteractionState(int X, int Y, int modify=0) override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkDistanceRepresentation::vtkDistanceRepresentation
vtkDistanceRepresentation()