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
60#ifndef vtkOrientationMarkerWidget_h
61#define vtkOrientationMarkerWidget_h
62
63#include "vtkInteractionWidgetsModule.h" // For export macro
65
66VTK_ABI_NAMESPACE_BEGIN
67class vtkActor2D;
68class vtkPolyData;
69class vtkProp;
70class vtkOrientationMarkerWidgetObserver;
71class vtkRenderer;
72
73class VTKINTERACTIONWIDGETS_EXPORT vtkOrientationMarkerWidget : public vtkInteractorObserver
74{
75public:
78 void PrintSelf(ostream& os, vtkIndent indent) override;
79
81
84 virtual void SetOrientationMarker(vtkProp* prop);
85 vtkGetObjectMacro(OrientationMarker, vtkProp);
87
91 void SetEnabled(int) override;
92
97 void ExecuteCameraUpdateEvent(vtkObject* o, unsigned long event, void* calldata);
98
100
105 vtkGetMacro(Interactive, vtkTypeBool);
106 vtkBooleanMacro(Interactive, vtkTypeBool);
108
110
115 void SetOutlineColor(double r, double g, double b);
118
120
132 vtkSetVector4Macro(Viewport, double);
133 vtkGetVector4Macro(Viewport, double);
135
137
142 vtkSetClampMacro(Tolerance, int, 1, 10);
143 vtkGetMacro(Tolerance, int);
145
147
151 vtkSetClampMacro(Zoom, double, 0.1, 10.0);
152 vtkGetMacro(Zoom, double);
154
156
160 void Modified() override;
162
164
167 void EndInteraction() override;
169
171
175 void SetShouldConstrainSize(vtkTypeBool shouldConstrainSize);
176 vtkGetMacro(ShouldConstrainSize, vtkTypeBool);
178
180
186 bool SetSizeConstraintDimensionSizes(int minDimensionSize, int maxDimensionSize);
188
190
193 vtkGetMacro(MinDimensionSize, int);
195
197
200 vtkGetMacro(MaxDimensionSize, int);
202
203protected:
206
207 vtkRenderer* Renderer;
208 vtkProp* OrientationMarker;
209 vtkPolyData* Outline;
210 vtkActor2D* OutlineActor;
211
212 unsigned long StartEventObserverId;
213
214 static void ProcessEvents(
215 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
216
217 // ProcessEvents() dispatches to these methods.
218 virtual void OnLeftButtonDown();
219 virtual void OnLeftButtonUp();
220 virtual void OnMouseMove();
221
222 // observer to update the renderer's camera
223 vtkOrientationMarkerWidgetObserver* Observer;
224
225 vtkTypeBool Interactive;
226 int Tolerance;
227 int Moving;
228 double Zoom = 1.0;
229
230 // viewport to position/size this widget
231 double Viewport[4];
232
233 // used to compute relative movements
234 int StartPosition[2];
235
236 // Manage the state of the widget
237 int State;
239 {
240 Outside = 0,
246 AdjustingP4
247 };
248
249 // Whether the min/max size constraints should be applied.
250 vtkTypeBool ShouldConstrainSize = 0;
251 // The minimum dimension size to be allowed for width and height.
252 int MinDimensionSize = 20;
253 // The maximum dimension size to be allowed for width and height.
254 int MaxDimensionSize = 500;
255
256 // use to determine what state the mouse is over, edge1 p1, etc.
257 // returns a state from the WidgetState enum above
258 virtual int ComputeStateBasedOnPosition(int X, int Y, int* pos1, int* pos2);
259
260 // set the cursor to the correct shape based on State argument
261 virtual void SetCursor(int state);
262
263 // adjust the viewport depending on state
264 void MoveWidget(int X, int Y);
265 void ResizeTopLeft(int X, int Y);
266 void ResizeTopRight(int X, int Y);
267 void ResizeBottomLeft(int X, int Y);
268 void ResizeBottomRight(int X, int Y);
269
272
273 // Used to reverse compute the Viewport ivar with respect to the current
274 // renderer viewport
276 // Used to compute and set the viewport on the internal renderer based on the
277 // Viewport ivar. The computed viewport will be with respect to the whole
278 // render window
280
281 // Resize the widget if it is outside of the current size constraints,
282 // or if the widget is not square.
284
285private:
287 void operator=(const vtkOrientationMarkerWidget&) = delete;
288
289 // set up the actors and observers created by this widget
290 void SetupWindowInteraction();
291 // tear down up the actors and observers created by this widget
292 void TearDownWindowInteraction();
293};
294
295VTK_ABI_NAMESPACE_END
296#endif
a actor that draws 2D data
Definition vtkActor2D.h:35
a simple class to control print indentation
Definition vtkIndent.h:29
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
abstract base class for most VTK objects
Definition vtkObject.h:49
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:80
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:43
abstract specification for renderers
Definition vtkRenderer.h:59
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_SIZEHINT(...)