VTK  9.2.6
vtkCurveRepresentation.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkCurveRepresentation
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=========================================================================*/
27
28#ifndef vtkCurveRepresentation_h
29#define vtkCurveRepresentation_h
30
31#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
32#include "vtkInteractionWidgetsModule.h" // For export macro
33#include "vtkPolyDataAlgorithm.h" // needed for vtkPolyDataAlgorithm
35
36class vtkActor;
37class vtkCellPicker;
38class vtkDoubleArray;
39class vtkHandleSource;
40class vtkPlaneSource;
41class vtkPoints;
42class vtkPolyData;
43class vtkProp;
44class vtkProperty;
45class vtkTransform;
46
47#define VTK_PROJECTION_YZ 0
48#define VTK_PROJECTION_XZ 1
49#define VTK_PROJECTION_XY 2
50#define VTK_PROJECTION_OBLIQUE 3
51class VTKINTERACTIONWIDGETS_EXPORT vtkCurveRepresentation : public vtkWidgetRepresentation
52{
53public:
55 void PrintSelf(ostream& os, vtkIndent indent) override;
56
57 // Used to manage the InteractionState of the widget
70#if !defined(VTK_LEGACY_REMOVE)
71 VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
73#endif
74
76
79 vtkSetMacro(InteractionState, int);
81
83
94 vtkBooleanMacro(ProjectToPlane, vtkTypeBool);
96
102
104 vtkGetMacro(ProjectionNormal, int);
109
111
118 void SetProjectionPosition(double position);
119 vtkGetMacro(ProjectionPosition, double);
121
129 virtual void GetPolyData(vtkPolyData* pd) = 0;
130
132
136 vtkGetObjectMacro(HandleProperty, vtkProperty);
139
141
145 vtkGetObjectMacro(LineProperty, vtkProperty);
148
150
153 virtual void SetNumberOfHandles(int npts) = 0;
154 vtkGetMacro(NumberOfHandles, int);
156
158
161 VTK_DEPRECATED_IN_9_1_0("renamed to SetDirectional")
162 virtual void SetDirectionalLine(bool val);
163 VTK_DEPRECATED_IN_9_1_0("renamed to GetDirectional")
164 virtual bool GetDirectionalLine();
165 VTK_DEPRECATED_IN_9_1_0("renamed to DirectionalOn")
166 virtual void DirectionalLineOn();
167 VTK_DEPRECATED_IN_9_1_0("renamed to DirectionalOff")
168 virtual void DirectionalLineOff();
170
172
177 virtual void SetDirectional(bool val);
178 vtkGetMacro(Directional, bool);
179 vtkBooleanMacro(Directional, bool);
181
183
187 virtual void SetHandlePosition(int handle, double x, double y, double z);
188 virtual void SetHandlePosition(int handle, double xyz[3]);
189 virtual void GetHandlePosition(int handle, double xyz[3]);
190 virtual double* GetHandlePosition(int handle);
193
195
200 void SetClosed(vtkTypeBool closed);
201 vtkGetMacro(Closed, vtkTypeBool);
202 vtkBooleanMacro(Closed, vtkTypeBool);
204
211
217 virtual double GetSummedLength() = 0;
218
225 virtual void InitializeHandles(vtkPoints* points) = 0;
226
228
233 void BuildRepresentation() override = 0;
234 int ComputeInteractionState(int X, int Y, int modify = 0) override;
235 void StartWidgetInteraction(double e[2]) override;
236 void WidgetInteraction(double e[2]) override;
237 void EndWidgetInteraction(double e[2]) override;
238 double* GetBounds() override;
240
242
251
256 void SetLineColor(double r, double g, double b);
257
258 /*
259 * Register internal Pickers within PickingManager
260 */
261 void RegisterPickers() override;
262
264
269 void SetCurrentHandleIndex(int index);
270 vtkGetMacro(CurrentHandleIndex, int);
272
274
278 vtkGetMacro(TranslationAxis, int);
279 vtkSetClampMacro(TranslationAxis, int, -1, 2);
281
283
286 void SetXTranslationAxisOn() { this->TranslationAxis = Axis::XAxis; }
291
293
298
307
308protected:
311
313 double Bounds[6];
314
315 // Controlling vars
320
321 // Projection capabilities
325
328
329 // The line segments
331 void HighlightLine(int highlight);
332 int HighlightHandle(vtkProp* prop); // returns handle index or -1 on fail
333
334 // accessors to glyphs representing hot spots (e.g., handles)
335 virtual vtkActor* GetHandleActor(int index) = 0;
336 virtual vtkHandleSource* GetHandleSource(int index) = 0;
337
341 virtual int GetHandleIndex(vtkProp* prop) = 0;
342 virtual void SizeHandles();
343
347 virtual int InsertHandleOnLine(double* pos) = 0;
348
349 virtual void PushHandle(double* pos);
350 virtual void EraseHandle(const int&);
351
352 // Do the picking
359
360 // Methods to manipulate the curve.
361 void MovePoint(double* p1, double* p2);
362 void Scale(double* p1, double* p2, int X, int Y);
363 void Translate(double* p1, double* p2);
364 void Spin(double* p1, double* p2, double* vpn);
365
366 // Transform the control points (used for spinning)
368
369 // Manage how the representation appears
370 bool Directional = false;
371
372 // Properties used to control the appearance of selected objects and
373 // the manipulator in general.
379
380 // For efficient spinning
381 double Centroid[3];
383
385
386private:
388 void operator=(const vtkCurveRepresentation&) = delete;
389};
390#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:52
ray-cast cell picker for all kinds of Prop3Ds
virtual void DirectionalLineOff()
virtual void PushHandle(double *pos)
void Translate(double *p1, double *p2)
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Methods supporting, and required by, the rendering process.
void SetProjectionPosition(double position)
Set the position of poly line handles and points in terms of a plane's position.
virtual vtkDoubleArray * GetHandlePositions()=0
Set/Get the position of the handles.
virtual int InsertHandleOnLine(double *pos)=0
Returns the position of insertion or -1 on fail.
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
virtual double GetSummedLength()=0
Get the approximate vs.
virtual void SetProjectionNormal(int)
void SetTranslationAxisOff()
Toggles constraint translation axis on/off.
virtual vtkActor * GetHandleActor(int index)=0
double * GetBounds() override
These are methods that satisfy vtkWidgetRepresentation API.
void Scale(double *p1, double *p2, int X, int Y)
~vtkCurveRepresentation() override
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods supporting, and required by, the rendering process.
void WidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation API.
void EndWidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation API.
void SetZTranslationAxisOn()
Toggles constraint translation axis on/off.
virtual vtkHandleSource * GetHandleSource(int index)=0
vtkTypeBool IsClosed()
Convenience method to determine whether the curve is closed in a geometric sense.
InteractionStateType _InteractionState
void Spin(double *p1, double *p2, double *vpn)
void SetClosed(vtkTypeBool closed)
Control whether the curve is open or closed.
virtual void SetNumberOfHandles(int npts)=0
Set/Get the number of handles for this widget.
void SetLineColor(double r, double g, double b)
Convenience method to set the line color.
virtual void SetDirectionalLine(bool val)
virtual void DirectionalLineOn()
void ProjectPointsToObliquePlane()
void ReleaseGraphicsResources(vtkWindow *) override
Methods supporting, and required by, the rendering process.
int RenderOverlay(vtkViewport *) override
Methods supporting, and required by, the rendering process.
int HighlightHandle(vtkProp *prop)
virtual bool GetDirectionalLine()
void BuildRepresentation() override=0
These are methods that satisfy vtkWidgetRepresentation API.
int ComputeInteractionState(int X, int Y, int modify=0) override
These are methods that satisfy vtkWidgetRepresentation API.
int RenderOpaqueGeometry(vtkViewport *) override
Methods supporting, and required by, the rendering process.
void SetPlaneSource(vtkPlaneSource *plane)
Set up a reference to a vtkPlaneSource that could be from another widget object, e....
virtual void InitializeHandles(vtkPoints *points)=0
Convenience method to allocate and set the handles from a vtkPoints instance.
void SetYTranslationAxisOn()
Toggles constraint translation axis on/off.
void HighlightLine(int highlight)
virtual void SetDirectional(bool val)
Set the representation to be directional or not.
void SetXTranslationAxisOn()
Toggles constraint translation axis on/off.
virtual void SetHandlePosition(int handle, double x, double y, double z)
Set/Get the position of the handles.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void StartWidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation API.
bool IsTranslationConstrained()
Returns true if ContrainedAxis.
void GetActors(vtkPropCollection *) override
Methods to make this class behave as a vtkProp.
virtual void GetHandlePosition(int handle, double xyz[3])
Set/Get the position of the handles.
virtual void GetPolyData(vtkPolyData *pd)=0
Grab the polydata (including points) that defines the interpolating curve.
virtual void EraseHandle(const int &)
void MovePoint(double *p1, double *p2)
virtual void SizeHandles()
virtual int GetHandleIndex(vtkProp *prop)=0
returns handle index or -1 on fail
void SetCurrentHandleIndex(int index)
Get/Set the current handle index.
dynamic, self-adjusting array of double
interface that can be inherited to define handler sources for any kind of interaction.
a simple class to control print indentation
Definition vtkIndent.h:40
create an array of quadrilaterals located in a plane
represent and manipulate 3D points
Definition vtkPoints.h:40
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:91
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:57
represent surface properties of a geometric object
Definition vtkProperty.h:68
describes linear transformations via a 4x4 matrix
abstract specification for Viewports
Definition vtkViewport.h:56
window superclass for vtkRenderWindow
Definition vtkWindow.h:39
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_PROJECTION_YZ
#define VTK_PROJECTION_OBLIQUE
#define VTK_DEPRECATED_IN_9_1_0(reason)
#define VTK_DEPRECATED_IN_9_2_0(reason)