VTK  9.5.2
vtkImageTracerWidget.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
83
84#ifndef vtkImageTracerWidget_h
85#define vtkImageTracerWidget_h
86
87#include "vtk3DWidget.h"
88#include "vtkInteractionWidgetsModule.h" // For export macro
89
90VTK_ABI_NAMESPACE_BEGIN
92class vtkActor;
93class vtkCellArray;
94class vtkCellPicker;
95class vtkFloatArray;
97class vtkPoints;
98class vtkPolyData;
99class vtkProp;
100class vtkProperty;
101class vtkPropPicker;
102class vtkTransform;
104
105#define VTK_ITW_PROJECTION_YZ 0
106#define VTK_ITW_PROJECTION_XZ 1
107#define VTK_ITW_PROJECTION_XY 2
108#define VTK_ITW_SNAP_CELLS 0
109#define VTK_ITW_SNAP_POINTS 1
110
111class VTKINTERACTIONWIDGETS_EXPORT vtkImageTracerWidget : public vtk3DWidget
112{
113public:
118
120 void PrintSelf(ostream& os, vtkIndent indent) override;
121
123
126 void SetEnabled(int) override;
127 void PlaceWidget(double bounds[6]) override;
128 void PlaceWidget() override { this->Superclass::PlaceWidget(); }
130 double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
131 {
132 this->Superclass::PlaceWidget(xmin, xmax, ymin, ymax, zmin, zmax);
133 }
134
135
137
142 vtkGetObjectMacro(HandleProperty, vtkProperty);
146
148
153 vtkGetObjectMacro(LineProperty, vtkProperty);
157
161 void SetViewProp(vtkProp* prop);
162
164
169 vtkBooleanMacro(ProjectToPlane, vtkTypeBool);
171
173
180 vtkGetMacro(ProjectionNormal, int);
185
187
194 void SetProjectionPosition(double position);
195 vtkGetMacro(ProjectionPosition, double);
197
199
204 vtkBooleanMacro(SnapToImage, vtkTypeBool);
206
208
213 vtkSetMacro(AutoClose, vtkTypeBool);
214 vtkGetMacro(AutoClose, vtkTypeBool);
215 vtkBooleanMacro(AutoClose, vtkTypeBool);
217
219
225 vtkSetMacro(CaptureRadius, double);
226 vtkGetMacro(CaptureRadius, double);
228
236
241
243
248 vtkGetMacro(ImageSnapType, int);
250
252
255 void SetHandlePosition(int handle, double xyz[3]);
256 void SetHandlePosition(int handle, double x, double y, double z);
257 void GetHandlePosition(int handle, double xyz[3]);
258 double* GetHandlePosition(int handle) VTK_SIZEHINT(3);
260
262
265 vtkGetMacro(NumberOfHandles, int);
267
269
274 vtkBooleanMacro(Interaction, vtkTypeBool);
276
283
287 int IsClosed();
288
290
303
304protected:
307
308 // Manage the state of the widget
309 int State;
321
322 // handles the events
323 static void ProcessEvents(
324 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
325
326 // ProcessEvents() dispatches to these methods.
334
336
337 // Controlling ivars
344 double CaptureRadius; // tolerance for auto path close
347 int LastX;
348 int LastY;
349
350 void Trace(int, int);
351 void Snap(double*);
352 void MovePoint(const double*, const double*);
353 void Translate(const double*, const double*);
354 void ClosePath();
355
356 // 2D glyphs representing hot spots (e.g., handles)
360
361 // Transforms required as 2D glyphs are generated in the x-y plane
365
366 void AppendHandles(double*);
368 void AllocateHandles(const int&);
369 void AdjustHandlePosition(const int&, double*);
370 int HighlightHandle(vtkProp*); // returns handle index or -1 on fail
371 void EraseHandle(const int&);
372 void SizeHandles() override;
373 void InsertHandleOnLine(double*);
374
378
379 vtkProp* ViewProp; // the prop we want to pick on
380 vtkPropPicker* PropPicker; // the prop's picker
381
382 // Representation of the line
388
389 void HighlightLine(const int&);
391 void ResetLine(double*);
392 void AppendLine(double*);
394
395 // Do the picking of the handles and the lines
399
400 // Register internal Pickers within PickingManager
401 void RegisterPickers() override;
402
403 // Properties used to control the appearance of selected objects and
404 // the manipulator in general.
410
411 // Enable/Disable mouse button events
415
416private:
418 void operator=(const vtkImageTracerWidget&) = delete;
419};
420
421VTK_ABI_NAMESPACE_END
422#endif
virtual void PlaceWidget(double bounds[6])=0
This method is used to initially place the widget.
abstract API for pickers that can pick an instance of vtkProp
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
object to represent cell connectivity
ray-cast cell picker for all kinds of Prop3Ds
dynamic, self-adjusting array of float
create 2D glyphs represented by vtkPolyData
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
void SetProjectionNormalToYAxes()
Set the projection normal.
void AppendLine(double *)
void InsertHandleOnLine(double *)
void GetHandlePosition(int handle, double xyz[3])
Set/Get the handle position in terms of a zero-based array of handles.
virtual void SetSelectedLineProperty(vtkProperty *)
Set/Get the line properties.
void AppendHandles(double *)
void SetProjectionPosition(double position)
Set the position of the widgets' handles in terms of a plane's position.
static vtkImageTracerWidget * New()
Instantiate the object.
void GetPath(vtkPolyData *pd)
Grab the points and lines that define the traced path.
~vtkImageTracerWidget() override
void ResetLine(double *)
void HighlightLine(const int &)
vtkTransformPolyDataFilter * TransformFilter
virtual void SetProjectionNormal(int)
Set the projection normal.
void PlaceWidget(double bounds[6]) override
Methods that satisfy the superclass' API.
virtual void SetSelectedHandleProperty(vtkProperty *)
Set/Get the handle properties (the 2D glyphs are the handles).
vtkGlyphSource2D * GetGlyphSource()
Get the handles' geometric representation via vtkGlyphSource2D.
void SetProjectionNormalToZAxes()
Set the projection normal.
void SetEnabled(int) override
Methods that satisfy the superclass' API.
int HighlightHandle(vtkProp *)
void SetHandlePosition(int handle, double x, double y, double z)
Set/Get the handle position in terms of a zero-based array of handles.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetInteraction(vtkTypeBool interact)
Enable/disable mouse interaction when the widget is visible.
void SizeHandles() override
void EraseHandle(const int &)
double * GetHandlePosition(int handle)
Set/Get the handle position in terms of a zero-based array of handles.
vtkAbstractPropPicker * CurrentPicker
void InitializeHandles(vtkPoints *)
Initialize the widget with a set of points and generate lines between them.
void PlaceWidget() override
Methods that satisfy the superclass' API.
vtkFloatArray * TemporaryHandlePoints
void Translate(const double *, const double *)
void SetProjectionNormalToXAxes()
Set the projection normal.
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkGlyphSource2D * HandleGenerator
void Snap(double *)
void CreateDefaultProperties()
void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
Methods that satisfy the superclass' API.
void MovePoint(const double *, const double *)
virtual void SetHandleProperty(vtkProperty *)
Set/Get the handle properties (the 2D glyphs are the handles).
vtkProperty * SelectedHandleProperty
void SetSnapToImage(vtkTypeBool snap)
Force snapping to image data while tracing.
void SetHandlePosition(int handle, double xyz[3])
Set/Get the handle position in terms of a zero-based array of handles.
int IsClosed()
Is the path closed or open?
void AllocateHandles(const int &)
void Trace(int, int)
void AdjustHandlePosition(const int &, double *)
void SetViewProp(vtkProp *prop)
Set the prop, usually a vtkImageActor, to trace over.
virtual void SetLineProperty(vtkProperty *)
Set/Get the line properties.
a simple class to control print indentation
Definition vtkIndent.h:108
represent and manipulate 3D points
Definition vtkPoints.h:139
concrete dataset represents vertices, lines, polygons, and triangle strips
pick an actor/prop using graphics hardware
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:63
represent surface properties of a geometric object
transform points and associated normals and vectors for polygonal dataset
describes linear transformations via a 4x4 matrix
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_ITW_SNAP_CELLS
#define VTK_ITW_SNAP_POINTS
#define VTK_ITW_PROJECTION_YZ
#define VTK_ITW_PROJECTION_XY
int vtkIdType
Definition vtkType.h:332
#define VTK_SIZEHINT(...)