VTK  9.5.20251120
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
171
172#ifndef vtkOrientationMarkerWidget_h
173#define vtkOrientationMarkerWidget_h
174
175#include "vtkInteractionWidgetsModule.h" // For export macro
177#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
178
179VTK_ABI_NAMESPACE_BEGIN
180class vtkActor2D;
181class vtkPolyData;
182class vtkProp;
183class vtkOrientationMarkerWidgetObserver;
184class vtkRenderer;
185
186class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkOrientationMarkerWidget
187 : public vtkInteractorObserver
188{
189public:
192 void PrintSelf(ostream& os, vtkIndent indent) override;
193
198 void SetRenderer(vtkRenderer* renderer);
200
202
205 virtual void SetOrientationMarker(vtkProp* prop);
206 vtkGetObjectMacro(OrientationMarker, vtkProp);
208
212 void SetEnabled(int) override;
213
218 void ExecuteCameraUpdateEvent(vtkObject* o, unsigned long event, void* calldata);
219
221
227 vtkBooleanMacro(Interactive, vtkTypeBool);
229
231
236 void SetOutlineColor(double r, double g, double b);
239
241
253 vtkSetVector4Macro(Viewport, double);
254 vtkGetVector4Macro(Viewport, double);
256
258
263 vtkSetClampMacro(Tolerance, int, 1, 10);
264 vtkGetMacro(Tolerance, int);
266
268
272 vtkSetClampMacro(Zoom, double, 0.1, 10.0);
273 vtkGetMacro(Zoom, double);
275
277
281 void Modified() override;
283
285
288 void EndInteraction() override;
290
292
296 void SetShouldConstrainSize(vtkTypeBool shouldConstrainSize);
299
301
307 bool SetSizeConstraintDimensionSizes(int minDimensionSize, int maxDimensionSize);
309
311
314 vtkGetMacro(MinDimensionSize, int);
316
318
321 vtkGetMacro(MaxDimensionSize, int);
323
324protected:
327
332
333 unsigned long StartEventObserverId;
334
335 static void ProcessEvents(
336 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
337
338 // ProcessEvents() dispatches to these methods.
339 virtual void OnLeftButtonDown();
340 virtual void OnLeftButtonUp();
341 virtual void OnMouseMove();
342
343 // observer to update the renderer's camera
344 vtkOrientationMarkerWidgetObserver* Observer;
345
349 double Zoom = 1.0;
350
351 // viewport to position/size this widget
352 double Viewport[4];
353
354 // used to compute relative movements
356
357 // Manage the state of the widget
358 int State;
369
370 // Whether the min/max size constraints should be applied.
372 // The minimum dimension size to be allowed for width and height.
374 // The maximum dimension size to be allowed for width and height.
376
378 bool RendererBound = false;
379 bool EventsBound = false;
380
381 // use to determine what state the mouse is over, edge1 p1, etc.
382 // returns a state from the WidgetState enum above
383 virtual int ComputeStateBasedOnPosition(int X, int Y, int* pos1, int* pos2);
384
385 // set the cursor to the correct shape based on State argument
386 virtual void SetCursor(int state);
387
388 // adjust the viewport depending on state
389 void MoveWidget(int X, int Y);
390 void ResizeTopLeft(int X, int Y);
391 void ResizeTopRight(int X, int Y);
392 void ResizeBottomLeft(int X, int Y);
393 void ResizeBottomRight(int X, int Y);
394
397
398 // Used to reverse compute the Viewport ivar with respect to the current
399 // renderer viewport
401 // Used to compute and set the viewport on the internal renderer based on the
402 // Viewport ivar. The computed viewport will be with respect to the whole
403 // render window
405
406 // Resize the widget if it is outside of the current size constraints,
407 // or if the widget is not square.
409
416
417private:
419 void operator=(const vtkOrientationMarkerWidget&) = delete;
420};
421
422VTK_ABI_NAMESPACE_END
423#endif
a actor that draws 2D data
Definition vtkActor2D.h:145
a simple class to control print indentation
Definition vtkIndent.h:108
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
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:69
abstract specification for renderers
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO