VTK
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=========================================================================*/
28#ifndef vtkCurveRepresentation_h
29#define vtkCurveRepresentation_h
30
31#include "vtkInteractionWidgetsModule.h" // For export macro
33
34class vtkActor;
35class vtkCellPicker;
36class vtkDoubleArray;
37class vtkPlaneSource;
38class vtkPoints;
39class vtkPolyData;
40class vtkProp;
41class vtkProperty;
42class vtkSphereSource;
43class vtkTransform;
44
45#define VTK_PROJECTION_YZ 0
46#define VTK_PROJECTION_XZ 1
47#define VTK_PROJECTION_XY 2
48#define VTK_PROJECTION_OBLIQUE 3
49class VTKINTERACTIONWIDGETS_EXPORT vtkCurveRepresentation : public vtkWidgetRepresentation
50{
51public:
53 void PrintSelf(ostream& os, vtkIndent indent);
54
55 // Used to manage the InteractionState of the widget
57 Outside=0,
64 Erasing
65 };
66
68
71 vtkSetMacro(InteractionState, int);
73
75
84 vtkSetMacro(ProjectToPlane,int);
85 vtkGetMacro(ProjectToPlane,int);
86 vtkBooleanMacro(ProjectToPlane,int);
88
94
95 vtkSetClampMacro(ProjectionNormal,int,VTK_PROJECTION_YZ,VTK_PROJECTION_OBLIQUE);
96 vtkGetMacro(ProjectionNormal,int);
98 { this->SetProjectionNormal(0); }
100 { this->SetProjectionNormal(1); }
102 { this->SetProjectionNormal(2); }
104 { this->SetProjectionNormal(3); }
105
107
115 vtkGetMacro(ProjectionPosition, double);
117
125 virtual void GetPolyData(vtkPolyData *pd) = 0;
126
128
132 vtkGetObjectMacro(HandleProperty, vtkProperty);
133 vtkGetObjectMacro(SelectedHandleProperty, vtkProperty);
135
137
141 vtkGetObjectMacro(LineProperty, vtkProperty);
142 vtkGetObjectMacro(SelectedLineProperty, vtkProperty);
144
146
149 virtual void SetNumberOfHandles(int npts) = 0;
150 vtkGetMacro(NumberOfHandles, int);
152
154
158 virtual void SetHandlePosition(int handle, double x, double y, double z);
159 virtual void SetHandlePosition(int handle, double xyz[3]);
160 virtual void GetHandlePosition(int handle, double xyz[3]);
161 virtual double* GetHandlePosition(int handle);
164
166
171 void SetClosed(int closed);
172 vtkGetMacro(Closed,int);
173 vtkBooleanMacro(Closed,int);
175
181 int IsClosed();
182
188 virtual double GetSummedLength() = 0;
189
197
199
204 virtual void BuildRepresentation() = 0;
205 virtual int ComputeInteractionState(int X, int Y, int modify=0);
206 virtual void StartWidgetInteraction(double e[2]);
207 virtual void WidgetInteraction(double e[2]);
208 virtual void EndWidgetInteraction(double e[2]);
209 virtual double *GetBounds();
211
213
222
227 void SetLineColor(double r, double g, double b);
228
229protected:
232
233 double LastEventPosition[3];
234 double Bounds[6];
235
236 // Controlling vars
241
242 // Projection capabilities
246
249
250 // The line segments
252 void HighlightLine(int highlight);
253
254 // Glyphs representing hot spots (e.g., handles)
258 int HighlightHandle(vtkProp *prop); //returns handle index or -1 on fail
259 virtual void SizeHandles();
260 virtual void InsertHandleOnLine(double* pos) = 0;
261 void EraseHandle(const int&);
262
263 // Do the picking
266 double LastPickPosition[3];
269
270 // Register internal Pickers within PickingManager
271 virtual void RegisterPickers();
272
273 // Methods to manipulate the curve.
274 void MovePoint(double *p1, double *p2);
275 void Scale(double *p1, double *p2, int X, int Y);
276 void Translate(double *p1, double *p2);
277 void Spin(double *p1, double *p2, double *vpn);
278
279 // Transform the control points (used for spinning)
281
282 // Properties used to control the appearance of selected objects and
283 // the manipulator in general.
289
290 // For efficient spinning
291 double Centroid[3];
293
294private:
295 vtkCurveRepresentation(const vtkCurveRepresentation&) VTK_DELETE_FUNCTION;
296 void operator=(const vtkCurveRepresentation&) VTK_DELETE_FUNCTION;
297
298};
299
300
301#endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:70
vtkWidgetRepresentation base class for a widget that represents an curve that connects control points...
virtual int HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
virtual int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
void EraseHandle(const int &)
void Translate(double *p1, double *p2)
void SetProjectionPosition(double position)
Set the position of poly line handles and points in terms of a plane's position.
virtual vtkDoubleArray * GetHandlePositions()=0
virtual void WidgetInteraction(double e[2])
virtual double GetSummedLength()=0
Get the approximate vs.
virtual int ComputeInteractionState(int X, int Y, int modify=0)
virtual void StartWidgetInteraction(double e[2])
void Scale(double *p1, double *p2, int X, int Y)
vtkSphereSource ** HandleGeometry
void Spin(double *p1, double *p2, double *vpn)
virtual void SetNumberOfHandles(int npts)=0
Set/Get the number of handles for this widget.
virtual double * GetBounds()
Methods to make this class behave as a vtkProp.
void SetLineColor(double r, double g, double b)
Convenience method to set the line color.
void ProjectPointsToObliquePlane()
int HighlightHandle(vtkProp *prop)
void SetClosed(int closed)
Control whether the curve is open or closed.
virtual double * GetHandlePosition(int handle)
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
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 HighlightLine(int highlight)
virtual void SetHandlePosition(int handle, double x, double y, double z)
Set/Get the position of the handles.
virtual int RenderOverlay(vtkViewport *)
virtual void EndWidgetInteraction(double e[2])
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
int IsClosed()
Convenience method to determine whether the curve is closed in a geometric sense.
virtual void ReleaseGraphicsResources(vtkWindow *)
Methods supporting, and required by, the rendering process.
virtual void BuildRepresentation()=0
These are methods that satisfy vtkWidgetRepresentation's API.
virtual void GetHandlePosition(int handle, double xyz[3])
virtual void GetPolyData(vtkPolyData *pd)=0
Grab the polydata (including points) that defines the interpolating curve.
void MovePoint(double *p1, double *p2)
virtual void SizeHandles()
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual void SetHandlePosition(int handle, double xyz[3])
virtual void InsertHandleOnLine(double *pos)=0
dynamic, self-adjusting array of double
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:86
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
represent surface properties of a geometric object
Definition: vtkProperty.h:65
create a polygonal sphere centered at the origin
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
abstract specification for Viewports
Definition: vtkViewport.h:48
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ points
Definition: vtkX3D.h:446
@ position
Definition: vtkX3D.h:261
#define VTK_PROJECTION_YZ
#define VTK_PROJECTION_OBLIQUE
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.