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 "vtkInteractorObserver.h"
81 
82 class vtkActor2D;
83 class vtkPolyData;
84 class vtkProp;
85 class vtkOrientationMarkerWidgetObserver;
86 class vtkRenderer;
87 
89 {
90 public:
93  void PrintSelf(ostream& os, vtkIndent indent);
94 
96 
97  virtual void SetOrientationMarker(vtkProp *prop);
98  vtkGetObjectMacro(OrientationMarker, vtkProp);
100 
102  virtual void SetEnabled(int);
103 
106  void ExecuteCameraUpdateEvent(vtkObject *o, unsigned long event, void *calldata);
107 
109 
111  void SetInteractive(int state);
112  vtkGetMacro(Interactive, int);
113  vtkBooleanMacro(Interactive, int);
115 
117 
120  void SetOutlineColor(double r, double g, double b);
121  double *GetOutlineColor();
123 
125 
127  void SetViewport(double minX, double minY, double maxX, double maxY);
128  double* GetViewport();
130 
132 
135  vtkSetClampMacro(Tolerance,int,1,10);
136  vtkGetMacro(Tolerance,int);
138 
139 protected:
142 
147 
148  unsigned long StartEventObserverId;
149 
150  static void ProcessEvents(vtkObject *object, unsigned long event,
151  void *clientdata, void *calldata);
152 
153  // ProcessEvents() dispatches to these methods.
154  void OnLeftButtonDown();
155  void OnLeftButtonUp();
156  void OnMouseMove();
157 
158  // observer to update the renderer's camera
159  vtkOrientationMarkerWidgetObserver *Observer;
160 
163  int Moving;
164 
165  // used to compute relative movements
166  int StartPosition[2];
167 
168 //BTX - manage the state of the widget
169  int State;
171  {
172  Outside = 0,
178  AdjustingP4
179  };
180 //ETX
181 
182 
183  // use to determine what state the mouse is over, edge1 p1, etc.
184  // returns a state from the WidgetState enum above
185  int ComputeStateBasedOnPosition(int X, int Y, int *pos1, int *pos2);
186 
187  // set the cursor to the correct shape based on State argument
188  void SetCursor(int state);
189 
190  // adjust the viewport depending on state
191  void MoveWidget(int X, int Y);
192  void ResizeTopLeft(int X, int Y);
193  void ResizeTopRight(int X, int Y);
194  void ResizeBottomLeft(int X, int Y);
195  void ResizeBottomRight(int X, int Y);
196 
197  void SquareRenderer();
198  void UpdateOutline();
199 
200 private:
201  vtkOrientationMarkerWidget(const vtkOrientationMarkerWidget&); // Not implemented
202  void operator=(const vtkOrientationMarkerWidget&); // Not implemented
203 };
204 
205 #endif