VTK  9.4.20251007
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
62
63#ifndef vtkOrientationMarkerWidget_h
64#define vtkOrientationMarkerWidget_h
65
66#include "vtkInteractionWidgetsModule.h" // For export macro
68#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
69
70VTK_ABI_NAMESPACE_BEGIN
71class vtkActor2D;
72class vtkPolyData;
73class vtkProp;
74class vtkOrientationMarkerWidgetObserver;
75class vtkRenderer;
76
77class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkOrientationMarkerWidget
79{
80public:
83 void PrintSelf(ostream& os, vtkIndent indent) override;
84
89 void SetRenderer(vtkRenderer* renderer);
91
93
96 virtual void SetOrientationMarker(vtkProp* prop);
97 vtkGetObjectMacro(OrientationMarker, vtkProp);
99
103 void SetEnabled(int) override;
104
109 void ExecuteCameraUpdateEvent(vtkObject* o, unsigned long event, void* calldata);
110
112
118 vtkBooleanMacro(Interactive, vtkTypeBool);
120
122
127 void SetOutlineColor(double r, double g, double b);
130
132
144 vtkSetVector4Macro(Viewport, double);
145 vtkGetVector4Macro(Viewport, double);
147
149
154 vtkSetClampMacro(Tolerance, int, 1, 10);
155 vtkGetMacro(Tolerance, int);
157
159
163 vtkSetClampMacro(Zoom, double, 0.1, 10.0);
164 vtkGetMacro(Zoom, double);
166
168
172 void Modified() override;
174
176
179 void EndInteraction() override;
181
183
187 void SetShouldConstrainSize(vtkTypeBool shouldConstrainSize);
190
192
198 bool SetSizeConstraintDimensionSizes(int minDimensionSize, int maxDimensionSize);
200
202
205 vtkGetMacro(MinDimensionSize, int);
207
209
212 vtkGetMacro(MaxDimensionSize, int);
214
215protected:
218
223
224 unsigned long StartEventObserverId;
225
226 static void ProcessEvents(
227 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
228
229 // ProcessEvents() dispatches to these methods.
230 virtual void OnLeftButtonDown();
231 virtual void OnLeftButtonUp();
232 virtual void OnMouseMove();
233
234 // observer to update the renderer's camera
235 vtkOrientationMarkerWidgetObserver* Observer;
236
240 double Zoom = 1.0;
241
242 // viewport to position/size this widget
243 double Viewport[4];
244
245 // used to compute relative movements
247
248 // Manage the state of the widget
249 int State;
260
261 // Whether the min/max size constraints should be applied.
263 // The minimum dimension size to be allowed for width and height.
265 // The maximum dimension size to be allowed for width and height.
267
269 bool RendererBound = false;
270 bool EventsBound = false;
271
272 // use to determine what state the mouse is over, edge1 p1, etc.
273 // returns a state from the WidgetState enum above
274 virtual int ComputeStateBasedOnPosition(int X, int Y, int* pos1, int* pos2);
275
276 // set the cursor to the correct shape based on State argument
277 virtual void SetCursor(int state);
278
279 // adjust the viewport depending on state
280 void MoveWidget(int X, int Y);
281 void ResizeTopLeft(int X, int Y);
282 void ResizeTopRight(int X, int Y);
283 void ResizeBottomLeft(int X, int Y);
284 void ResizeBottomRight(int X, int Y);
285
288
289 // Used to reverse compute the Viewport ivar with respect to the current
290 // renderer viewport
292 // Used to compute and set the viewport on the internal renderer based on the
293 // Viewport ivar. The computed viewport will be with respect to the whole
294 // render window
296
297 // Resize the widget if it is outside of the current size constraints,
298 // or if the widget is not square.
300
307
308private:
310 void operator=(const vtkOrientationMarkerWidget&) = delete;
311};
312
313VTK_ABI_NAMESPACE_END
314#endif
a actor that draws 2D data
Definition vtkActor2D.h:36
a simple class to control print indentation
Definition vtkIndent.h:29
double * GetOutlineColor()
Set/get the color of the outline of this widget.
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
void ResizeBottomLeft(int X, int Y)
virtual void OnMouseMove()
bool SetSizeConstraintDimensionSizes(int minDimensionSize, int maxDimensionSize)
Sets the minimum and maximum dimension (width and height) size limits for the widget.
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.
vtkOrientationMarkerWidgetObserver * Observer
void SetRenderer(vtkRenderer *renderer)
This widget creates a renderer in the constructor, but this allows one to pass an externally declared...
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 Modified() override
Need to reimplement this->Modified() because of the vtkSetVector4Macro/vtkGetVector4Macro use.
vtkRenderer * GetRenderer()
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 OnLeftButtonUp()
virtual void SetCursor(int state)
virtual void SetOrientationMarker(vtkProp *prop)
Set/get the orientation marker to be displayed in this widget.
virtual void OnLeftButtonDown()
void SetShouldConstrainSize(vtkTypeBool shouldConstrainSize)
Set/get whether the widget should constrain the size to be within the min and max limits.
void MoveWidget(int X, int Y)
static vtkOrientationMarkerWidget * New()
void EndInteraction() override
Ends any in progress interaction and resets border visibility.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:72
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:47
abstract specification for renderers
Definition vtkRenderer.h:63
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO