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 =========================================================================*/
77 #ifndef vtkOrientationMarkerWidget_h
78 #define vtkOrientationMarkerWidget_h
79 
80 #include "vtkInteractionWidgetsModule.h" // For export macro
81 #include "vtkInteractorObserver.h"
82 
83 class vtkActor2D;
84 class vtkPolyData;
85 class vtkProp;
86 class vtkOrientationMarkerWidgetObserver;
87 class vtkRenderer;
88 
90 {
91 public:
94  void PrintSelf(ostream& os, vtkIndent indent);
95 
97 
98  virtual void SetOrientationMarker(vtkProp *prop);
99  vtkGetObjectMacro(OrientationMarker, vtkProp);
101 
103  virtual void SetEnabled(int);
104 
107  void ExecuteCameraUpdateEvent(vtkObject *o, unsigned long event, void *calldata);
108 
110 
112  void SetInteractive(int state);
113  vtkGetMacro(Interactive, int);
114  vtkBooleanMacro(Interactive, int);
116 
118 
121  void SetOutlineColor(double r, double g, double b);
122  double *GetOutlineColor();
124 
126 
128  void SetViewport(double minX, double minY, double maxX, double maxY);
129  void SetViewport(double viewport[4]);
130  double* GetViewport();
132 
134 
137  vtkSetClampMacro(Tolerance,int,1,10);
138  vtkGetMacro(Tolerance,int);
140 
141 protected:
144 
149 
150  unsigned long StartEventObserverId;
151 
152  static void ProcessEvents(vtkObject *object, unsigned long event,
153  void *clientdata, void *calldata);
154 
155  // ProcessEvents() dispatches to these methods.
156  void OnLeftButtonDown();
157  void OnLeftButtonUp();
158  void OnMouseMove();
159 
160  // observer to update the renderer's camera
161  vtkOrientationMarkerWidgetObserver *Observer;
162 
165  int Moving;
166 
167  // used to compute relative movements
168  int StartPosition[2];
169 
170  // Manage the state of the widget
171  int State;
173  {
174  Outside = 0,
180  AdjustingP4
181  };
182 
183 
184  // use to determine what state the mouse is over, edge1 p1, etc.
185  // returns a state from the WidgetState enum above
186  int ComputeStateBasedOnPosition(int X, int Y, int *pos1, int *pos2);
187 
188  // set the cursor to the correct shape based on State argument
189  void SetCursor(int state);
190 
191  // adjust the viewport depending on state
192  void MoveWidget(int X, int Y);
193  void ResizeTopLeft(int X, int Y);
194  void ResizeTopRight(int X, int Y);
195  void ResizeBottomLeft(int X, int Y);
196  void ResizeBottomRight(int X, int Y);
197 
198  void SquareRenderer();
199  void UpdateOutline();
200 
201 private:
202  vtkOrientationMarkerWidget(const vtkOrientationMarkerWidget&); // Not implemented
203  void operator=(const vtkOrientationMarkerWidget&); // Not implemented
204 };
205 
206 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
abstract base class for most VTK objects
Definition: vtkObject.h:61
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
a actor that draws 2D data
Definition: vtkActor2D.h:44
virtual void SetEnabled(int)
2D widget for manipulating a marker prop
abstract specification for renderers
Definition: vtkRenderer.h:62
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkOrientationMarkerWidgetObserver * Observer
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor ...
#define VTKINTERACTIONWIDGETS_EXPORT
a simple class to control print indentation
Definition: vtkIndent.h:38
void PrintSelf(ostream &os, vtkIndent indent)
static vtkObject * New()