VTK
vtkHandleRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkHandleRepresentation.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 =========================================================================*/
48 #ifndef vtkHandleRepresentation_h
49 #define vtkHandleRepresentation_h
50 
51 #include "vtkInteractionWidgetsModule.h" // For export macro
53 
54 class vtkCoordinate;
55 class vtkRenderer;
56 class vtkPointPlacer;
57 
58 class VTKINTERACTIONWIDGETS_EXPORT vtkHandleRepresentation : public vtkWidgetRepresentation
59 {
60 public:
62 
66  void PrintSelf(ostream& os, vtkIndent indent);
68 
70 
78  virtual void SetDisplayPosition(double pos[3]);
79  virtual void GetDisplayPosition(double pos[3]);
80  virtual double* GetDisplayPosition();
81  virtual void SetWorldPosition(double pos[3]);
82  virtual void GetWorldPosition(double pos[3]);
83  virtual double* GetWorldPosition();
85 
87 
92  vtkSetClampMacro(Tolerance,int,1,100);
93  vtkGetMacro(Tolerance,int);
95 
97 
102  vtkSetMacro(ActiveRepresentation,int);
103  vtkGetMacro(ActiveRepresentation,int);
104  vtkBooleanMacro(ActiveRepresentation,int);
106 
107  // Enums define the state of the representation relative to the mouse pointer
108  // position. Used by ComputeInteractionState() to communicate with the
109  // widget. Note that ComputeInteractionState() and several other methods
110  // must be implemented by subclasses.
111  enum _InteractionState { Outside=0, Nearby, Selecting, Translating, Scaling };
112 
114 
123  vtkSetClampMacro(InteractionState,int,Outside,Scaling);
125 
127 
132  vtkSetMacro(Constrained,int);
133  vtkGetMacro(Constrained,int);
134  vtkBooleanMacro(Constrained,int);
136 
144  virtual int CheckConstraint(vtkRenderer *renderer, double pos[2]);
145 
147 
150  virtual void ShallowCopy(vtkProp *prop);
151  virtual void DeepCopy(vtkProp *prop);
152  virtual void SetRenderer(vtkRenderer *ren);
154 
160 
162 
170  virtual void SetPointPlacer ( vtkPointPlacer * );
171  vtkGetObjectMacro( PointPlacer, vtkPointPlacer );
173 
174 protected:
177 
181 
182  // Two vtkCoordinates are available to subclasses, one in display
183  // coordinates and the other in world coordinates. These facilitate
184  // the conversion between these two systems. Note that the WorldPosition
185  // is the ultimate maintainer of position.
188 
189  // Keep track of when coordinates were changed
192 
193  // Constrain the placement of handles.
195 
196 private:
197  vtkHandleRepresentation(const vtkHandleRepresentation&) VTK_DELETE_FUNCTION;
198  void operator=(const vtkHandleRepresentation&) VTK_DELETE_FUNCTION;
199 };
200 
201 #endif
vtkWidgetRepresentation.h
vtkHandleRepresentation::GetMTime
virtual vtkMTimeType GetMTime()
Overload the superclasses' GetMTime() because the internal vtkCoordinates are used to keep the state ...
vtkPointPlacer
Abstract interface to translate 2D display positions to world coordinates.
Definition: vtkPointPlacer.h:50
vtkHandleRepresentation::Tolerance
int Tolerance
Definition: vtkHandleRepresentation.h:178
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:36
vtkHandleRepresentation::vtkHandleRepresentation
vtkHandleRepresentation()
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:55
vtkHandleRepresentation::SetWorldPosition
virtual void SetWorldPosition(double pos[3])
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:59
vtkHandleRepresentation::GetDisplayPosition
virtual double * GetDisplayPosition()
vtkHandleRepresentation::Constrained
int Constrained
Definition: vtkHandleRepresentation.h:180
vtkHandleRepresentation::WorldPositionTime
vtkTimeStamp WorldPositionTime
Definition: vtkHandleRepresentation.h:191
vtkHandleRepresentation::ShallowCopy
virtual void ShallowCopy(vtkProp *prop)
Methods to make this class properly act like a vtkWidgetRepresentation.
vtkMTimeType
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
vtkHandleRepresentation::~vtkHandleRepresentation
~vtkHandleRepresentation()
vtkHandleRepresentation::DisplayPosition
vtkCoordinate * DisplayPosition
Definition: vtkHandleRepresentation.h:186
vtkHandleRepresentation::GetWorldPosition
virtual double * GetWorldPosition()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkCoordinate
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
Definition: vtkCoordinate.h:71
vtkHandleRepresentation::CheckConstraint
virtual int CheckConstraint(vtkRenderer *renderer, double pos[2])
Method has to be overridden in the subclasses which has constraints on placing the handle (Ex.
vtkHandleRepresentation::_InteractionState
_InteractionState
Definition: vtkHandleRepresentation.h:111
vtkHandleRepresentation::GetDisplayPosition
virtual void GetDisplayPosition(double pos[3])
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
vtkHandleRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkHandleRepresentation::DeepCopy
virtual void DeepCopy(vtkProp *prop)
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkHandleRepresentation::SetDisplayPosition
virtual void SetDisplayPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
vtkHandleRepresentation::WorldPosition
vtkCoordinate * WorldPosition
Definition: vtkHandleRepresentation.h:187
vtkHandleRepresentation::DisplayPositionTime
vtkTimeStamp DisplayPositionTime
Definition: vtkHandleRepresentation.h:190
vtkHandleRepresentation::PointPlacer
vtkPointPlacer * PointPlacer
Definition: vtkHandleRepresentation.h:194
vtkHandleRepresentation::GetWorldPosition
virtual void GetWorldPosition(double pos[3])
vtkHandleRepresentation::SetRenderer
virtual void SetRenderer(vtkRenderer *ren)
Subclasses of vtkWidgetRepresentation must implement these methods.
vtkHandleRepresentation::Translating
@ Translating
Definition: vtkHandleRepresentation.h:111
vtkHandleRepresentation::SetPointPlacer
virtual void SetPointPlacer(vtkPointPlacer *)
Set/Get the point placer.
vtkHandleRepresentation::ActiveRepresentation
int ActiveRepresentation
Definition: vtkHandleRepresentation.h:179