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
168
169#ifndef vtkOrientationMarkerWidget_h
170#define vtkOrientationMarkerWidget_h
171
172#include "vtkInteractionWidgetsModule.h" // For export macro
174#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
175
176VTK_ABI_NAMESPACE_BEGIN
177class vtkActor2D;
178class vtkPolyData;
179class vtkProp;
180class vtkOrientationMarkerWidgetObserver;
181class vtkRenderer;
182
183class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkOrientationMarkerWidget
184 : public vtkInteractorObserver
185{
186public:
189 void PrintSelf(ostream& os, vtkIndent indent) override;
190
195 void SetRenderer(vtkRenderer* renderer);
197
199
202 virtual void SetOrientationMarker(vtkProp* prop);
203 vtkGetObjectMacro(OrientationMarker, vtkProp);
205
209 void SetEnabled(int) override;
210
215 void ExecuteCameraUpdateEvent(vtkObject* o, unsigned long event, void* calldata);
216
218
224 vtkBooleanMacro(Interactive, vtkTypeBool);
226
228
233 void SetOutlineColor(double r, double g, double b);
236
238
250 vtkSetVector4Macro(Viewport, double);
251 vtkGetVector4Macro(Viewport, double);
253
255
260 vtkSetClampMacro(Tolerance, int, 1, 10);
261 vtkGetMacro(Tolerance, int);
263
265
269 vtkSetClampMacro(Zoom, double, 0.1, 10.0);
270 vtkGetMacro(Zoom, double);
272
274
278 void Modified() override;
280
282
285 void EndInteraction() override;
287
289
293 void SetShouldConstrainSize(vtkTypeBool shouldConstrainSize);
296
298
304 bool SetSizeConstraintDimensionSizes(int minDimensionSize, int maxDimensionSize);
306
308
311 vtkGetMacro(MinDimensionSize, int);
313
315
318 vtkGetMacro(MaxDimensionSize, int);
320
321protected:
324
329
330 unsigned long StartEventObserverId;
331
332 static void ProcessEvents(
333 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
334
335 // ProcessEvents() dispatches to these methods.
336 virtual void OnLeftButtonDown();
337 virtual void OnLeftButtonUp();
338 virtual void OnMouseMove();
339
340 // observer to update the renderer's camera
341 vtkOrientationMarkerWidgetObserver* Observer;
342
346 double Zoom = 1.0;
347
348 // viewport to position/size this widget
349 double Viewport[4];
350
351 // used to compute relative movements
353
354 // Manage the state of the widget
355 int State;
366
367 // Whether the min/max size constraints should be applied.
369 // The minimum dimension size to be allowed for width and height.
371 // The maximum dimension size to be allowed for width and height.
373
375 bool RendererBound = false;
376 bool EventsBound = false;
377
378 // use to determine what state the mouse is over, edge1 p1, etc.
379 // returns a state from the WidgetState enum above
380 virtual int ComputeStateBasedOnPosition(int X, int Y, int* pos1, int* pos2);
381
382 // set the cursor to the correct shape based on State argument
383 virtual void SetCursor(int state);
384
385 // adjust the viewport depending on state
386 void MoveWidget(int X, int Y);
387 void ResizeTopLeft(int X, int Y);
388 void ResizeTopRight(int X, int Y);
389 void ResizeBottomLeft(int X, int Y);
390 void ResizeBottomRight(int X, int Y);
391
394
395 // Used to reverse compute the Viewport ivar with respect to the current
396 // renderer viewport
398 // Used to compute and set the viewport on the internal renderer based on the
399 // Viewport ivar. The computed viewport will be with respect to the whole
400 // render window
402
403 // Resize the widget if it is outside of the current size constraints,
404 // or if the widget is not square.
406
413
414private:
416 void operator=(const vtkOrientationMarkerWidget&) = delete;
417};
418
419VTK_ABI_NAMESPACE_END
420#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:63
abstract specification for renderers
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO