VTK  9.0.2
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) override;
93 
95 
98  virtual void SetOrientationMarker(vtkProp* prop);
99  vtkGetObjectMacro(OrientationMarker, vtkProp);
101 
105  void SetEnabled(int) override;
106 
111  void ExecuteCameraUpdateEvent(vtkObject* o, unsigned long event, void* calldata);
112 
114 
119  vtkGetMacro(Interactive, vtkTypeBool);
120  vtkBooleanMacro(Interactive, vtkTypeBool);
122 
124 
129  void SetOutlineColor(double r, double g, double b);
132 
134 
146  vtkSetVector4Macro(Viewport, double);
147  vtkGetVector4Macro(Viewport, double);
149 
151 
156  vtkSetClampMacro(Tolerance, int, 1, 10);
157  vtkGetMacro(Tolerance, int);
159 
161 
165  void Modified() override;
167 
168 protected:
171 
172  vtkRenderer* Renderer;
173  vtkProp* OrientationMarker;
174  vtkPolyData* Outline;
175  vtkActor2D* OutlineActor;
176 
177  unsigned long StartEventObserverId;
178 
179  static void ProcessEvents(
180  vtkObject* object, unsigned long event, void* clientdata, void* calldata);
181 
182  // ProcessEvents() dispatches to these methods.
183  virtual void OnLeftButtonDown();
184  virtual void OnLeftButtonUp();
185  virtual void OnMouseMove();
186 
187  // observer to update the renderer's camera
188  vtkOrientationMarkerWidgetObserver* Observer;
189 
190  vtkTypeBool Interactive;
191  int Tolerance;
192  int Moving;
193 
194  // viewport to position/size this widget
195  double Viewport[4];
196 
197  // used to compute relative movements
198  int StartPosition[2];
199 
200  // Manage the state of the widget
201  int State;
203  {
204  Outside = 0,
210  AdjustingP4
211  };
212 
213  // use to determine what state the mouse is over, edge1 p1, etc.
214  // returns a state from the WidgetState enum above
215  virtual int ComputeStateBasedOnPosition(int X, int Y, int* pos1, int* pos2);
216 
217  // set the cursor to the correct shape based on State argument
218  virtual void SetCursor(int state);
219 
220  // adjust the viewport depending on state
221  void MoveWidget(int X, int Y);
222  void ResizeTopLeft(int X, int Y);
223  void ResizeTopRight(int X, int Y);
224  void ResizeBottomLeft(int X, int Y);
225  void ResizeBottomRight(int X, int Y);
226 
229 
230  // Used to reverse compute the Viewport ivar with respect to the current
231  // renderer viewport
233  // Used to compute and set the viewport on the internal renderer based on the
234  // Viewport ivar. The computed viewport will be with respect to the whole
235  // render window
237 
238 private:
240  void operator=(const vtkOrientationMarkerWidget&) = delete;
241 
242  // set up the actors and observers created by this widget
243  void SetupWindowInteraction();
244  // tear down up the actors and observers created by this widget
245  void TearDownWindowInteraction();
246 };
247 
248 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:40
a simple class to control print indentation
Definition: vtkIndent.h:34
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
abstract base class for most VTK objects
Definition: vtkObject.h:63
2D widget for manipulating a marker prop
void SetInteractive(vtkTypeBool state)
Set/get whether to allow this widget to be interactively moved/scaled.
void ResizeBottomLeft(int X, int Y)
virtual int ComputeStateBasedOnPosition(int X, int Y, int *pos1, int *pos2)
void SetEnabled(int) override
Enable/disable the widget.
void SetOutlineColor(double r, double g, double b)
Set/get the color of the outline of this widget.
void ResizeTopLeft(int X, int Y)
void ResizeBottomRight(int X, int Y)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void ResizeTopRight(int X, int Y)
static vtkOrientationMarkerWidget * New()
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...
virtual void SetCursor(int state)
virtual void SetOrientationMarker(vtkProp *prop)
Set/get the orientation marker to be displayed in this widget.
void MoveWidget(int X, int Y)
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:54
abstract specification for renderers
Definition: vtkRenderer.h:68
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_SIZEHINT(...)