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 =========================================================================*/
72 #ifndef vtkOrientationMarkerWidget_h
73 #define vtkOrientationMarkerWidget_h
74 
75 #include "vtkInteractionWidgetsModule.h" // For export macro
76 #include "vtkInteractorObserver.h"
77 
78 class vtkActor2D;
79 class vtkPolyData;
80 class vtkProp;
81 class vtkOrientationMarkerWidgetObserver;
82 class vtkRenderer;
83 
84 class VTKINTERACTIONWIDGETS_EXPORT vtkOrientationMarkerWidget : public vtkInteractorObserver
85 {
86 public:
89  void PrintSelf(ostream& os, vtkIndent indent) override;
90 
92 
95  virtual void SetOrientationMarker(vtkProp *prop);
96  vtkGetObjectMacro(OrientationMarker, vtkProp);
98 
102  void SetEnabled(int) override;
103 
108  void ExecuteCameraUpdateEvent(vtkObject *o, unsigned long event, void *calldata);
109 
111 
115  void SetInteractive(vtkTypeBool state);
116  vtkGetMacro(Interactive, vtkTypeBool);
117  vtkBooleanMacro(Interactive, vtkTypeBool);
119 
121 
126  void SetOutlineColor(double r, double g, double b);
127  double *GetOutlineColor();
129 
131 
143  vtkSetVector4Macro(Viewport, double);
144  vtkGetVector4Macro(Viewport, double);
146 
148 
153  vtkSetClampMacro(Tolerance,int,1,10);
154  vtkGetMacro(Tolerance,int);
156 
158 
162  void Modified() override;
164 
165 protected:
167  ~vtkOrientationMarkerWidget() override;
168 
173 
174  unsigned long StartEventObserverId;
175 
176  static void ProcessEvents(vtkObject *object, unsigned long event,
177  void *clientdata, void *calldata);
178 
179  // ProcessEvents() dispatches to these methods.
180  virtual void OnLeftButtonDown();
181  virtual void OnLeftButtonUp();
182  virtual void OnMouseMove();
183 
184  // observer to update the renderer's camera
185  vtkOrientationMarkerWidgetObserver *Observer;
186 
189  int Moving;
190 
191  // viewport to position/size this widget
192  double Viewport[4];
193 
194  // used to compute relative movements
195  int StartPosition[2];
196 
197  // Manage the state of the widget
198  int State;
200  {
201  Outside = 0,
207  AdjustingP4
208  };
209 
210 
211  // use to determine what state the mouse is over, edge1 p1, etc.
212  // returns a state from the WidgetState enum above
213  virtual int ComputeStateBasedOnPosition(int X, int Y, int *pos1, int *pos2);
214 
215  // set the cursor to the correct shape based on State argument
216  virtual void SetCursor(int state);
217 
218  // adjust the viewport depending on state
219  void MoveWidget(int X, int Y);
220  void ResizeTopLeft(int X, int Y);
221  void ResizeTopRight(int X, int Y);
222  void ResizeBottomLeft(int X, int Y);
223  void ResizeBottomRight(int X, int Y);
224 
225  void SquareRenderer();
226  void UpdateOutline();
227 
228  // Used to reverse compute the Viewport ivar with respect to the current
229  // renderer viewport
230  void UpdateViewport();
231  // Used to compute and set the viewport on the internal renderer based on the
232  // Viewport ivar. The computed viewport will be with respect to the whole
233  // render window
234  void UpdateInternalViewport();
235 
236 private:
238  void operator=(const vtkOrientationMarkerWidget&) = delete;
239 
240  //set up the actors and observers created by this widget
241  void SetupWindowInteraction();
242  //tear down up the actors and observers created by this widget
243  void TearDownWindowInteraction();
244 };
245 
246 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
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
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkOrientationMarkerWidgetObserver * Observer
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor ...
int vtkTypeBool
Definition: vtkABI.h:69
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void Modified()
Update the modification time for this object.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...