VTK  9.3.0
vtkOrientationMarkerWidget.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
69#ifndef vtkOrientationMarkerWidget_h
70#define vtkOrientationMarkerWidget_h
71
72#include "vtkInteractionWidgetsModule.h" // For export macro
74
75VTK_ABI_NAMESPACE_BEGIN
76class vtkActor2D;
77class vtkPolyData;
78class vtkProp;
79class vtkOrientationMarkerWidgetObserver;
80class vtkRenderer;
81
82class VTKINTERACTIONWIDGETS_EXPORT vtkOrientationMarkerWidget : public vtkInteractorObserver
83{
84public:
87 void PrintSelf(ostream& os, vtkIndent indent) override;
88
90
93 virtual void SetOrientationMarker(vtkProp* prop);
94 vtkGetObjectMacro(OrientationMarker, vtkProp);
96
100 void SetEnabled(int) override;
101
106 void ExecuteCameraUpdateEvent(vtkObject* o, unsigned long event, void* calldata);
107
109
114 vtkGetMacro(Interactive, vtkTypeBool);
115 vtkBooleanMacro(Interactive, vtkTypeBool);
117
119
124 void SetOutlineColor(double r, double g, double b);
127
129
141 vtkSetVector4Macro(Viewport, double);
142 vtkGetVector4Macro(Viewport, double);
144
146
151 vtkSetClampMacro(Tolerance, int, 1, 10);
152 vtkGetMacro(Tolerance, int);
154
156
160 vtkSetClampMacro(Zoom, double, 0.1, 10.0);
161 vtkGetMacro(Zoom, double);
163
165
169 void Modified() override;
171
173
176 void EndInteraction() override;
178
180
184 void SetShouldConstrainSize(vtkTypeBool shouldConstrainSize);
185 vtkGetMacro(ShouldConstrainSize, vtkTypeBool);
187
189
195 bool SetSizeConstraintDimensionSizes(int minDimensionSize, int maxDimensionSize);
197
199
202 vtkGetMacro(MinDimensionSize, int);
204
206
209 vtkGetMacro(MaxDimensionSize, int);
211
212protected:
215
216 vtkRenderer* Renderer;
217 vtkProp* OrientationMarker;
218 vtkPolyData* Outline;
219 vtkActor2D* OutlineActor;
220
221 unsigned long StartEventObserverId;
222
223 static void ProcessEvents(
224 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
225
226 // ProcessEvents() dispatches to these methods.
227 virtual void OnLeftButtonDown();
228 virtual void OnLeftButtonUp();
229 virtual void OnMouseMove();
230
231 // observer to update the renderer's camera
232 vtkOrientationMarkerWidgetObserver* Observer;
233
234 vtkTypeBool Interactive;
235 int Tolerance;
236 int Moving;
237 double Zoom = 1.0;
238
239 // viewport to position/size this widget
240 double Viewport[4];
241
242 // used to compute relative movements
243 int StartPosition[2];
244
245 // Manage the state of the widget
246 int State;
248 {
249 Outside = 0,
255 AdjustingP4
256 };
257
258 // Whether the min/max size constraints should be applied.
259 vtkTypeBool ShouldConstrainSize = 0;
260 // The minimum dimension size to be allowed for width and height.
261 int MinDimensionSize = 20;
262 // The maximum dimension size to be allowed for width and height.
263 int MaxDimensionSize = 500;
264
265 // use to determine what state the mouse is over, edge1 p1, etc.
266 // returns a state from the WidgetState enum above
267 virtual int ComputeStateBasedOnPosition(int X, int Y, int* pos1, int* pos2);
268
269 // set the cursor to the correct shape based on State argument
270 virtual void SetCursor(int state);
271
272 // adjust the viewport depending on state
273 void MoveWidget(int X, int Y);
274 void ResizeTopLeft(int X, int Y);
275 void ResizeTopRight(int X, int Y);
276 void ResizeBottomLeft(int X, int Y);
277 void ResizeBottomRight(int X, int Y);
278
281
282 // Used to reverse compute the Viewport ivar with respect to the current
283 // renderer viewport
285 // Used to compute and set the viewport on the internal renderer based on the
286 // Viewport ivar. The computed viewport will be with respect to the whole
287 // render window
289
290 // Resize the widget if it is outside of the current size constraints,
291 // or if the widget is not square.
293
294private:
296 void operator=(const vtkOrientationMarkerWidget&) = delete;
297
298 // set up the actors and observers created by this widget
299 void SetupWindowInteraction();
300 // tear down up the actors and observers created by this widget
301 void TearDownWindowInteraction();
302};
303
304VTK_ABI_NAMESPACE_END
305#endif
a actor that draws 2D data
Definition vtkActor2D.h:44
a simple class to control print indentation
Definition vtkIndent.h:38
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
abstract base class for most VTK objects
Definition vtkObject.h:58
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:89
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:52
abstract specification for renderers
Definition vtkRenderer.h:68
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_SIZEHINT(...)