VTK  9.5.2
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
59
60#ifndef vtkOrientationMarkerWidget_h
61#define vtkOrientationMarkerWidget_h
62
63#include "vtkInteractionWidgetsModule.h" // For export macro
65#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
66
67VTK_ABI_NAMESPACE_BEGIN
68class vtkActor2D;
69class vtkPolyData;
70class vtkProp;
71class vtkOrientationMarkerWidgetObserver;
72class vtkRenderer;
73
74class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkOrientationMarkerWidget
76{
77public:
80 void PrintSelf(ostream& os, vtkIndent indent) override;
81
86 void SetRenderer(vtkRenderer* renderer);
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
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);
187
189
195 bool SetSizeConstraintDimensionSizes(int minDimensionSize, int maxDimensionSize);
197
199
202 vtkGetMacro(MinDimensionSize, int);
204
206
209 vtkGetMacro(MaxDimensionSize, int);
211
212protected:
215
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
237 double Zoom = 1.0;
238
239 // viewport to position/size this widget
240 double Viewport[4];
241
242 // used to compute relative movements
244
245 // Manage the state of the widget
246 int State;
257
258 // Whether the min/max size constraints should be applied.
260 // The minimum dimension size to be allowed for width and height.
262 // The maximum dimension size to be allowed for width and height.
264
266 bool RendererBound = false;
267 bool EventsBound = false;
268
269 // use to determine what state the mouse is over, edge1 p1, etc.
270 // returns a state from the WidgetState enum above
271 virtual int ComputeStateBasedOnPosition(int X, int Y, int* pos1, int* pos2);
272
273 // set the cursor to the correct shape based on State argument
274 virtual void SetCursor(int state);
275
276 // adjust the viewport depending on state
277 void MoveWidget(int X, int Y);
278 void ResizeTopLeft(int X, int Y);
279 void ResizeTopRight(int X, int Y);
280 void ResizeBottomLeft(int X, int Y);
281 void ResizeBottomRight(int X, int Y);
282
285
286 // Used to reverse compute the Viewport ivar with respect to the current
287 // renderer viewport
289 // Used to compute and set the viewport on the internal renderer based on the
290 // Viewport ivar. The computed viewport will be with respect to the whole
291 // render window
293
294 // Resize the widget if it is outside of the current size constraints,
295 // or if the widget is not square.
297
304
305private:
307 void operator=(const vtkOrientationMarkerWidget&) = delete;
308};
309
310VTK_ABI_NAMESPACE_END
311#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:44
abstract specification for renderers
Definition vtkRenderer.h:60
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO