VTK  9.2.6
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
77
78class vtkActor2D;
79class vtkPolyData;
80class vtkProp;
81class vtkOrientationMarkerWidgetObserver;
82class vtkRenderer;
83
84class VTKINTERACTIONWIDGETS_EXPORT vtkOrientationMarkerWidget : public vtkInteractorObserver
85{
86public:
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
116 vtkGetMacro(Interactive, vtkTypeBool);
117 vtkBooleanMacro(Interactive, vtkTypeBool);
119
121
126 void SetOutlineColor(double r, double g, double b);
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 vtkSetClampMacro(Zoom, double, 0.1, 10.0);
163 vtkGetMacro(Zoom, double);
165
167
171 void Modified() override;
173
175
178 void EndInteraction() override;
180
182
186 void SetShouldConstrainSize(const vtkTypeBool shouldConstrainSize);
187 vtkGetMacro(ShouldConstrainSize, vtkTypeBool);
189
191
197 bool SetSizeConstraintDimensionSizes(const int minDimensionSize, const int maxDimensionSize);
199
201
204 vtkGetMacro(MinDimensionSize, int);
206
208
211 vtkGetMacro(MaxDimensionSize, int);
213
214protected:
217
218 vtkRenderer* Renderer;
219 vtkProp* OrientationMarker;
220 vtkPolyData* Outline;
221 vtkActor2D* OutlineActor;
222
223 unsigned long StartEventObserverId;
224
225 static void ProcessEvents(
226 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
227
228 // ProcessEvents() dispatches to these methods.
229 virtual void OnLeftButtonDown();
230 virtual void OnLeftButtonUp();
231 virtual void OnMouseMove();
232
233 // observer to update the renderer's camera
234 vtkOrientationMarkerWidgetObserver* Observer;
235
236 vtkTypeBool Interactive;
237 int Tolerance;
238 int Moving;
239 double Zoom = 1.0;
240
241 // viewport to position/size this widget
242 double Viewport[4];
243
244 // used to compute relative movements
245 int StartPosition[2];
246
247 // Manage the state of the widget
248 int State;
250 {
251 Outside = 0,
257 AdjustingP4
258 };
259
260 // Whether the min/max size constraints should be applied.
261 vtkTypeBool ShouldConstrainSize = 0;
262 // The minimum dimension size to be allowed for width and height.
263 int MinDimensionSize = 20;
264 // The maximum dimension size to be allowed for width and height.
265 int MaxDimensionSize = 500;
266
267 // use to determine what state the mouse is over, edge1 p1, etc.
268 // returns a state from the WidgetState enum above
269 virtual int ComputeStateBasedOnPosition(int X, int Y, int* pos1, int* pos2);
270
271 // set the cursor to the correct shape based on State argument
272 virtual void SetCursor(int state);
273
274 // adjust the viewport depending on state
275 void MoveWidget(int X, int Y);
276 void ResizeTopLeft(int X, int Y);
277 void ResizeTopRight(int X, int Y);
278 void ResizeBottomLeft(int X, int Y);
279 void ResizeBottomRight(int X, int Y);
280
283
284 // Used to reverse compute the Viewport ivar with respect to the current
285 // renderer viewport
287 // Used to compute and set the viewport on the internal renderer based on the
288 // Viewport ivar. The computed viewport will be with respect to the whole
289 // render window
291
292 // Resize the widget if it is outside of the current size constraints,
293 // or if the widget is not square.
295
296private:
298 void operator=(const vtkOrientationMarkerWidget&) = delete;
299
300 // set up the actors and observers created by this widget
301 void SetupWindowInteraction();
302 // tear down up the actors and observers created by this widget
303 void TearDownWindowInteraction();
304};
305
306#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:57
2D widget for manipulating a marker prop
double * GetOutlineColor()
Set/get the color of the outline of this widget.
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 SetInteractive(vtkTypeBool interact)
Set/get whether to allow this widget to be interactively moved/scaled.
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)
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)
static vtkOrientationMarkerWidget * New()
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:85
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:51
abstract specification for renderers
Definition vtkRenderer.h:67
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_SIZEHINT(...)