VTK  9.2.6
vtkOrientationMarkerWidget.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkOrientationMarkerWidget.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
181#ifndef vtkOrientationMarkerWidget_h
182#define vtkOrientationMarkerWidget_h
183
184#include "vtkInteractionWidgetsModule.h" // For export macro
186
187class vtkActor2D;
188class vtkPolyData;
189class vtkProp;
190class vtkOrientationMarkerWidgetObserver;
191class vtkRenderer;
192
193class VTKINTERACTIONWIDGETS_EXPORT vtkOrientationMarkerWidget : public vtkInteractorObserver
194{
195public:
198 void PrintSelf(ostream& os, vtkIndent indent) override;
199
201
204 virtual void SetOrientationMarker(vtkProp* prop);
205 vtkGetObjectMacro(OrientationMarker, vtkProp);
207
211 void SetEnabled(int) override;
212
217 void ExecuteCameraUpdateEvent(vtkObject* o, unsigned long event, void* calldata);
218
220
225 vtkGetMacro(Interactive, vtkTypeBool);
226 vtkBooleanMacro(Interactive, vtkTypeBool);
228
230
235 void SetOutlineColor(double r, double g, double b);
238
240
252 vtkSetVector4Macro(Viewport, double);
253 vtkGetVector4Macro(Viewport, double);
255
257
262 vtkSetClampMacro(Tolerance, int, 1, 10);
263 vtkGetMacro(Tolerance, int);
265
267
271 vtkSetClampMacro(Zoom, double, 0.1, 10.0);
272 vtkGetMacro(Zoom, double);
274
276
280 void Modified() override;
282
284
287 void EndInteraction() override;
289
291
295 void SetShouldConstrainSize(const vtkTypeBool shouldConstrainSize);
296 vtkGetMacro(ShouldConstrainSize, vtkTypeBool);
298
300
306 bool SetSizeConstraintDimensionSizes(const int minDimensionSize, const int maxDimensionSize);
308
310
313 vtkGetMacro(MinDimensionSize, int);
315
317
320 vtkGetMacro(MaxDimensionSize, int);
322
323protected:
326
327 vtkRenderer* Renderer;
328 vtkProp* OrientationMarker;
329 vtkPolyData* Outline;
330 vtkActor2D* OutlineActor;
331
332 unsigned long StartEventObserverId;
333
334 static void ProcessEvents(
335 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
336
337 // ProcessEvents() dispatches to these methods.
338 virtual void OnLeftButtonDown();
339 virtual void OnLeftButtonUp();
340 virtual void OnMouseMove();
341
342 // observer to update the renderer's camera
343 vtkOrientationMarkerWidgetObserver* Observer;
344
345 vtkTypeBool Interactive;
346 int Tolerance;
347 int Moving;
348 double Zoom = 1.0;
349
350 // viewport to position/size this widget
351 double Viewport[4];
352
353 // used to compute relative movements
354 int StartPosition[2];
355
356 // Manage the state of the widget
357 int State;
359 {
360 Outside = 0,
366 AdjustingP4
367 };
368
369 // Whether the min/max size constraints should be applied.
370 vtkTypeBool ShouldConstrainSize = 0;
371 // The minimum dimension size to be allowed for width and height.
372 int MinDimensionSize = 20;
373 // The maximum dimension size to be allowed for width and height.
374 int MaxDimensionSize = 500;
375
376 // use to determine what state the mouse is over, edge1 p1, etc.
377 // returns a state from the WidgetState enum above
378 virtual int ComputeStateBasedOnPosition(int X, int Y, int* pos1, int* pos2);
379
380 // set the cursor to the correct shape based on State argument
381 virtual void SetCursor(int state);
382
383 // adjust the viewport depending on state
384 void MoveWidget(int X, int Y);
385 void ResizeTopLeft(int X, int Y);
386 void ResizeTopRight(int X, int Y);
387 void ResizeBottomLeft(int X, int Y);
388 void ResizeBottomRight(int X, int Y);
389
392
393 // Used to reverse compute the Viewport ivar with respect to the current
394 // renderer viewport
396 // Used to compute and set the viewport on the internal renderer based on the
397 // Viewport ivar. The computed viewport will be with respect to the whole
398 // render window
400
401 // Resize the widget if it is outside of the current size constraints,
402 // or if the widget is not square.
404
405private:
407 void operator=(const vtkOrientationMarkerWidget&) = delete;
408
409 // set up the actors and observers created by this widget
410 void SetupWindowInteraction();
411 // tear down up the actors and observers created by this widget
412 void TearDownWindowInteraction();
413};
414
415#endif
a actor that draws 2D data
Definition: vtkActor2D.h:155
a simple class to control print indentation
Definition: vtkIndent.h:119
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
abstract base class for most VTK objects
Definition: vtkObject.h:79
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:200
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:73
abstract specification for renderers
Definition: vtkRenderer.h:179
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_SIZEHINT(...)