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.
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 
223 
224 private:
225  vtkOrientationMarkerWidget(const vtkOrientationMarkerWidget&) VTK_DELETE_FUNCTION;
226  void operator=(const vtkOrientationMarkerWidget&) VTK_DELETE_FUNCTION;
227 };
228 
229 #endif
vtkOrientationMarkerWidget::ResizeTopLeft
void ResizeTopLeft(int X, int Y)
vtkOrientationMarkerWidget::OnMouseMove
void OnMouseMove()
vtkOrientationMarkerWidget::OutlineActor
vtkActor2D * OutlineActor
Definition: vtkOrientationMarkerWidget.h:167
vtkOrientationMarkerWidget::Moving
int Moving
Definition: vtkOrientationMarkerWidget.h:184
vtkOrientationMarkerWidget::ResizeBottomRight
void ResizeBottomRight(int X, int Y)
vtkOrientationMarkerWidget::OnLeftButtonUp
void OnLeftButtonUp()
vtkOrientationMarkerWidget::OrientationMarker
vtkProp * OrientationMarker
Definition: vtkOrientationMarkerWidget.h:165
vtkOrientationMarkerWidget::ResizeBottomLeft
void ResizeBottomLeft(int X, int Y)
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkOrientationMarkerWidget::ProcessEvents
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkOrientationMarkerWidget::SetOutlineColor
void SetOutlineColor(double r, double g, double b)
Set/get the color of the outline of this widget.
vtkOrientationMarkerWidget::Translating
@ Translating
Definition: vtkOrientationMarkerWidget.h:198
vtkInteractorObserver
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
Definition: vtkInteractorObserver.h:60
vtkOrientationMarkerWidget::StartEventObserverId
unsigned long StartEventObserverId
Definition: vtkOrientationMarkerWidget.h:169
vtkOrientationMarkerWidget::SquareRenderer
void SquareRenderer()
vtkOrientationMarkerWidget::Renderer
vtkRenderer * Renderer
Definition: vtkOrientationMarkerWidget.h:164
vtkOrientationMarkerWidget::AdjustingP3
@ AdjustingP3
Definition: vtkOrientationMarkerWidget.h:201
vtkOrientationMarkerWidget::~vtkOrientationMarkerWidget
~vtkOrientationMarkerWidget()
vtkOrientationMarkerWidget::Interactive
int Interactive
Definition: vtkOrientationMarkerWidget.h:182
vtkOrientationMarkerWidget::AdjustingP1
@ AdjustingP1
Definition: vtkOrientationMarkerWidget.h:199
vtkOrientationMarkerWidget::New
static vtkOrientationMarkerWidget * New()
vtkOrientationMarkerWidget::vtkOrientationMarkerWidget
vtkOrientationMarkerWidget()
vtkOrientationMarkerWidget::Observer
vtkOrientationMarkerWidgetObserver * Observer
Definition: vtkOrientationMarkerWidget.h:180
vtkOrientationMarkerWidget::ExecuteCameraUpdateEvent
void ExecuteCameraUpdateEvent(vtkObject *o, unsigned long event, void *calldata)
Callback to keep the camera for the orientation marker up to date with the camera in the parent rende...
vtkOrientationMarkerWidget::UpdateOutline
void UpdateOutline()
vtkOrientationMarkerWidget::GetOutlineColor
double * GetOutlineColor()
vtkOrientationMarkerWidget::ComputeStateBasedOnPosition
int ComputeStateBasedOnPosition(int X, int Y, int *pos1, int *pos2)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkOrientationMarkerWidget::AdjustingP2
@ AdjustingP2
Definition: vtkOrientationMarkerWidget.h:200
vtkOrientationMarkerWidget::ResizeTopRight
void ResizeTopRight(int X, int Y)
vtkOrientationMarkerWidget::State
int State
Definition: vtkOrientationMarkerWidget.h:193
vtkOrientationMarkerWidget::UpdateViewport
void UpdateViewport()
vtkOrientationMarkerWidget::Tolerance
int Tolerance
Definition: vtkOrientationMarkerWidget.h:183
vtkOrientationMarkerWidget::SetInteractive
void SetInteractive(int state)
Set/get whether to allow this widget to be interactively moved/scaled.
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:46
vtkOrientationMarkerWidget::SetCursor
void SetCursor(int state)
vtkOrientationMarkerWidget::OnLeftButtonDown
void OnLeftButtonDown()
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkOrientationMarkerWidget::MoveWidget
void MoveWidget(int X, int Y)
vtkInteractorObserver.h
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
vtkOrientationMarkerWidget::Inside
@ Inside
Definition: vtkOrientationMarkerWidget.h:197
vtkOrientationMarkerWidget
2D widget for manipulating a marker prop
Definition: vtkOrientationMarkerWidget.h:88
vtkOrientationMarkerWidget::SetOrientationMarker
virtual void SetOrientationMarker(vtkProp *prop)
Set/get the orientation marker to be displayed in this widget.
vtkOrientationMarkerWidget::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkOrientationMarkerWidget::Outline
vtkPolyData * Outline
Definition: vtkOrientationMarkerWidget.h:166
vtkOrientationMarkerWidget::WidgetState
WidgetState
Definition: vtkOrientationMarkerWidget.h:195
vtkOrientationMarkerWidget::SetEnabled
virtual void SetEnabled(int)
Enable/disable the widget.