VTK
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 
36 class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceRepresentation : public vtkWidgetRepresentation
37 {
38 public:
40 
44  void PrintSelf(ostream& os, vtkIndent indent);
46 
51  virtual double GetDistance() = 0;
52 
54 
59  virtual void GetPoint1WorldPosition(double pos[3]) = 0;
60  virtual void GetPoint2WorldPosition(double pos[3]) = 0;
61  virtual double* GetPoint1WorldPosition() = 0;
62  virtual double* GetPoint2WorldPosition() = 0;
63  virtual void SetPoint1DisplayPosition(double pos[3]) = 0;
64  virtual void SetPoint2DisplayPosition(double pos[3]) = 0;
65  virtual void GetPoint1DisplayPosition(double pos[3]) = 0;
66  virtual void GetPoint2DisplayPosition(double pos[3]) = 0;
67  virtual void SetPoint1WorldPosition(double pos[3])=0;
68  virtual void SetPoint2WorldPosition(double pos[3])=0;
70 
72 
85 
87 
92  vtkGetObjectMacro(Point1Representation,vtkHandleRepresentation);
93  vtkGetObjectMacro(Point2Representation,vtkHandleRepresentation);
95 
97 
102  vtkSetClampMacro(Tolerance,int,1,100);
103  vtkGetMacro(Tolerance,int);
105 
107 
112  vtkSetStringMacro(LabelFormat);
113  vtkGetStringMacro(LabelFormat);
115 
117 
125  vtkSetMacro(Scale,double);
126  vtkGetMacro(Scale,double);
128 
130 
135  vtkSetMacro(RulerMode,int);
136  vtkGetMacro(RulerMode,int);
137  vtkBooleanMacro(RulerMode,int);
139 
141 
145  vtkSetClampMacro(RulerDistance,double,0,VTK_FLOAT_MAX);
146  vtkGetMacro(RulerDistance,double);
148 
150 
157  vtkSetClampMacro(NumberOfRulerTicks,int,1,VTK_INT_MAX);
158  vtkGetMacro(NumberOfRulerTicks,int);
160 
161  // Used to communicate about the state of the representation
162  enum {Outside=0,NearP1,NearP2};
163 
165 
168  virtual void BuildRepresentation();
169  virtual int ComputeInteractionState(int X, int Y, int modify=0);
170  virtual void StartWidgetInteraction(double e[2]);
171  virtual void WidgetInteraction(double e[2]);
173 
174 protected:
177 
178  // The handle and the rep used to close the handles
182 
183  // Selection tolerance for the handles
185 
186  // Format for printing the distance
187  char *LabelFormat;
188 
189  // Scale to change from the VTK world coordinates to the desired coordinate
190  // system.
191  double Scale;
192 
193  // Ruler related stuff
197 
198 private:
199  vtkDistanceRepresentation(const vtkDistanceRepresentation&) VTK_DELETE_FUNCTION;
200  void operator=(const vtkDistanceRepresentation&) VTK_DELETE_FUNCTION;
201 };
202 
203 #endif
vtkWidgetRepresentation.h
vtkDistanceRepresentation::Tolerance
int Tolerance
Definition: vtkDistanceRepresentation.h:184
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:153
vtkDistanceRepresentation::InstantiateHandleRepresentation
void InstantiateHandleRepresentation()
vtkDistanceRepresentation::SetHandleRepresentation
void SetHandleRepresentation(vtkHandleRepresentation *handle)
This method is used to specify the type of handle representation to use for the two internal vtkHandl...
vtkDistanceRepresentation::StartWidgetInteraction
virtual void StartWidgetInteraction(double e[2])
vtkDistanceRepresentation::Scale
double Scale
Definition: vtkDistanceRepresentation.h:191
vtkDistanceRepresentation::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:55
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:59
vtkDistanceRepresentation::GetPoint1DisplayPosition
virtual void GetPoint1DisplayPosition(double pos[3])=0
vtkDistanceRepresentation::Point1Representation
vtkHandleRepresentation * Point1Representation
Definition: vtkDistanceRepresentation.h:180
vtkDistanceRepresentation::~vtkDistanceRepresentation
~vtkDistanceRepresentation()
vtkDistanceRepresentation
represent the vtkDistanceWidget
Definition: vtkDistanceRepresentation.h:37
vtkDistanceRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
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:179
vtkDistanceRepresentation::WidgetInteraction
virtual void WidgetInteraction(double e[2])
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
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:195
vtkDistanceRepresentation::SetPoint1WorldPosition
virtual void SetPoint1WorldPosition(double pos[3])=0
VTK_FLOAT_MAX
#define VTK_FLOAT_MAX
Definition: vtkType.h:161
vtkGetStringMacro
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkDistanceRepresentation::LabelFormat
char * LabelFormat
Definition: vtkDistanceRepresentation.h:187
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkDistanceRepresentation::GetPoint2WorldPosition
virtual double * GetPoint2WorldPosition()=0
vtkDistanceRepresentation::GetPoint1WorldPosition
virtual double * GetPoint1WorldPosition()=0
vtkDistanceRepresentation::SetPoint2WorldPosition
virtual void SetPoint2WorldPosition(double pos[3])=0
vtkDistanceRepresentation::GetPoint2WorldPosition
virtual void GetPoint2WorldPosition(double pos[3])=0
vtkDistanceRepresentation::NumberOfRulerTicks
int NumberOfRulerTicks
Definition: vtkDistanceRepresentation.h:196
vtkDistanceRepresentation::BuildRepresentation
virtual void BuildRepresentation()
These are methods that satisfy vtkWidgetRepresentation's API.
vtkDistanceRepresentation::Point2Representation
vtkHandleRepresentation * Point2Representation
Definition: vtkDistanceRepresentation.h:181
vtkDistanceRepresentation::RulerMode
int RulerMode
Definition: vtkDistanceRepresentation.h:194
vtkDistanceRepresentation::GetPoint2DisplayPosition
virtual void GetPoint2DisplayPosition(double pos[3])=0
vtkDistanceRepresentation::SetPoint2DisplayPosition
virtual void SetPoint2DisplayPosition(double pos[3])=0
vtkDistanceRepresentation::SetPoint1DisplayPosition
virtual void SetPoint1DisplayPosition(double pos[3])=0
vtkDistanceRepresentation::vtkDistanceRepresentation
vtkDistanceRepresentation()