VTK
vtkOrientationMarkerWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOrientationMarkerWidget.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 =========================================================================*/
75 #ifndef vtkOrientationMarkerWidget_h
76 #define vtkOrientationMarkerWidget_h
77 
78 #include "vtkInteractionWidgetsModule.h" // For export macro
79 #include "vtkInteractorObserver.h"
80 
81 class vtkActor2D;
82 class vtkPolyData;
83 class vtkProp;
84 class vtkOrientationMarkerWidgetObserver;
85 class vtkRenderer;
86 
87 class VTKINTERACTIONWIDGETS_EXPORT vtkOrientationMarkerWidget : public vtkInteractorObserver
88 {
89 public:
92  void PrintSelf(ostream& os, vtkIndent indent);
93 
95 
98  virtual void SetOrientationMarker(vtkProp *prop);
99  vtkGetObjectMacro(OrientationMarker, vtkProp);
101 
105  virtual void SetEnabled(int);
106 
111  void ExecuteCameraUpdateEvent(vtkObject *o, unsigned long event, void *calldata);
112 
114 
118  void SetInteractive(int state);
119  vtkGetMacro(Interactive, int);
120  vtkBooleanMacro(Interactive, int);
122 
124 
129  void SetOutlineColor(double r, double g, double b);
130  double *GetOutlineColor();
132 
134 
146  vtkSetVector4Macro(Viewport, double);
147  vtkGetVector4Macro(Viewport, double);
149 
151 
156  vtkSetClampMacro(Tolerance,int,1,10);
157  vtkGetMacro(Tolerance,int);
159 
160 protected:
163 
168 
169  unsigned long StartEventObserverId;
170 
171  static void ProcessEvents(vtkObject *object, unsigned long event,
172  void *clientdata, void *calldata);
173 
174  // ProcessEvents() dispatches to these methods.
175  void OnLeftButtonDown();
176  void OnLeftButtonUp();
177  void OnMouseMove();
178 
179  // observer to update the renderer's camera
180  vtkOrientationMarkerWidgetObserver *Observer;
181 
184  int Moving;
185 
186  // viewport to position/size this widget
187  double Viewport[4];
188 
189  // used to compute relative movements
190  int StartPosition[2];
191 
192  // Manage the state of the widget
193  int State;
195  {
196  Outside = 0,
202  AdjustingP4
203  };
204 
205 
206  // use to determine what state the mouse is over, edge1 p1, etc.
207  // returns a state from the WidgetState enum above
208  int ComputeStateBasedOnPosition(int X, int Y, int *pos1, int *pos2);
209 
210  // set the cursor to the correct shape based on State argument
211  void SetCursor(int state);
212 
213  // adjust the viewport depending on state
214  void MoveWidget(int X, int Y);
215  void ResizeTopLeft(int X, int Y);
216  void ResizeTopRight(int X, int Y);
217  void ResizeBottomLeft(int X, int Y);
218  void ResizeBottomRight(int X, int Y);
219 
220  void SquareRenderer();
221  void UpdateOutline();
222  void UpdateViewport();
223 
224 private:
225  vtkOrientationMarkerWidget(const vtkOrientationMarkerWidget&) VTK_DELETE_FUNCTION;
226  void operator=(const vtkOrientationMarkerWidget&) VTK_DELETE_FUNCTION;
227 };
228 
229 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
abstract base class for most VTK objects
Definition: vtkObject.h:59
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
Handles the char widget activation event.
a actor that draws 2D data
Definition: vtkActor2D.h:45
virtual void SetEnabled(int)
Methods for turning the interactor observer on and off, and determining its state.
2D widget for manipulating a marker prop
abstract specification for renderers
Definition: vtkRenderer.h:63
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkOrientationMarkerWidgetObserver * Observer
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor ...
a simple class to control print indentation
Definition: vtkIndent.h:39
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...