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 
34 class vtkActor;
35 class vtkCellPicker;
36 class vtkDoubleArray;
37 class vtkPlaneSource;
38 class vtkPoints;
39 class vtkPolyData;
40 class vtkProp;
41 class vtkProperty;
42 class vtkSphereSource;
43 class 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
49 class VTKINTERACTIONWIDGETS_EXPORT vtkCurveRepresentation : public vtkWidgetRepresentation
50 {
51 public:
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 
196  virtual void InitializeHandles(vtkPoints* points) = 0;
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 
219  virtual int RenderOverlay(vtkViewport*);
222 
227  void SetLineColor(double r, double g, double b);
228 
229 protected:
232 
233  double LastEventPosition[3];
234  double Bounds[6];
235 
236  // Controlling vars
241 
242  // Projection capabilities
246 
248  int Closed;
249 
250  // The line segments
252  void HighlightLine(int highlight);
253 
254  // Glyphs representing hot spots (e.g., handles)
257  void Initialize();
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 
294 private:
295  vtkCurveRepresentation(const vtkCurveRepresentation&) VTK_DELETE_FUNCTION;
296  void operator=(const vtkCurveRepresentation&) VTK_DELETE_FUNCTION;
297 
298 };
299 
300 
301 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:40
vtkWidgetRepresentation.h
vtkCurveRepresentation::_InteractionState
_InteractionState
Definition: vtkCurveRepresentation.h:56
vtkCurveRepresentation::SetProjectionPosition
void SetProjectionPosition(double position)
Set the position of poly line handles and points in terms of a plane's position.
vtkCurveRepresentation::NumberOfHandles
int NumberOfHandles
Definition: vtkCurveRepresentation.h:247
vtkCurveRepresentation::CreateDefaultProperties
void CreateDefaultProperties()
vtkCurveRepresentation::Spin
void Spin(double *p1, double *p2, double *vpn)
vtkCurveRepresentation::SetProjectionNormalToYAxes
void SetProjectionNormalToYAxes()
Definition: vtkCurveRepresentation.h:99
vtkCurveRepresentation::ProjectPointsToPlane
void ProjectPointsToPlane()
vtkCurveRepresentation::SetProjectionNormalToOblique
void SetProjectionNormalToOblique()
Definition: vtkCurveRepresentation.h:103
vtkCurveRepresentation::SetNumberOfHandles
virtual void SetNumberOfHandles(int npts)=0
Set/Get the number of handles for this widget.
VTK_PROJECTION_YZ
#define VTK_PROJECTION_YZ
Definition: vtkCurveRepresentation.h:45
vtkCurveRepresentation::SetPlaneSource
void SetPlaneSource(vtkPlaneSource *plane)
Set up a reference to a vtkPlaneSource that could be from another widget object, e....
vtkCurveRepresentation::Initialize
void Initialize()
vtkCurveRepresentation::HandleGeometry
vtkSphereSource ** HandleGeometry
Definition: vtkCurveRepresentation.h:256
vtkCurveRepresentation::LinePicker
vtkCellPicker * LinePicker
Definition: vtkCurveRepresentation.h:265
vtkCurveRepresentation
vtkWidgetRepresentation base class for a widget that represents an curve that connects control points...
Definition: vtkCurveRepresentation.h:50
vtkCurveRepresentation::CurrentHandle
vtkActor * CurrentHandle
Definition: vtkCurveRepresentation.h:267
vtkCurveRepresentation::SelectedHandleProperty
vtkProperty * SelectedHandleProperty
Definition: vtkCurveRepresentation.h:285
vtkPlaneSource
create an array of quadrilaterals located in a plane
Definition: vtkPlaneSource.h:61
vtkCurveRepresentation::ProjectPointsToOrthoPlane
void ProjectPointsToOrthoPlane()
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:55
vtkCurveRepresentation::HighlightHandle
int HighlightHandle(vtkProp *prop)
vtkCurveRepresentation::StartWidgetInteraction
virtual void StartWidgetInteraction(double e[2])
vtkCurveRepresentation::CurrentHandleIndex
int CurrentHandleIndex
Definition: vtkCurveRepresentation.h:268
vtkCurveRepresentation::GetBounds
virtual double * GetBounds()
Methods to make this class behave as a vtkProp.
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
vtkCurveRepresentation::Scale
void Scale(double *p1, double *p2, int X, int Y)
vtkCurveRepresentation::Closed
int Closed
Definition: vtkCurveRepresentation.h:248
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
VTK_PROJECTION_OBLIQUE
#define VTK_PROJECTION_OBLIQUE
Definition: vtkCurveRepresentation.h:48
vtkCurveRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkCurveRepresentation::WidgetInteraction
virtual void WidgetInteraction(double e[2])
vtkCurveRepresentation::LineActor
vtkActor * LineActor
Definition: vtkCurveRepresentation.h:251
vtkCurveRepresentation::HasTranslucentPolygonalGeometry
virtual int HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkX3D::position
@ position
Definition: vtkX3D.h:261
vtkX3D::points
@ points
Definition: vtkX3D.h:446
vtkCurveRepresentation::ProjectPointsToObliquePlane
void ProjectPointsToObliquePlane()
vtkCurveRepresentation::vtkCurveRepresentation
vtkCurveRepresentation()
vtkCurveRepresentation::ProjectionPosition
double ProjectionPosition
Definition: vtkCurveRepresentation.h:238
vtkCurveRepresentation::EndWidgetInteraction
virtual void EndWidgetInteraction(double e[2])
vtkCurveRepresentation::MovePoint
void MovePoint(double *p1, double *p2)
vtkCurveRepresentation::RenderOpaqueGeometry
virtual int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkCurveRepresentation::IsClosed
int IsClosed()
Convenience method to determine whether the curve is closed in a geometric sense.
vtkCurveRepresentation::Spinning
@ Spinning
Definition: vtkCurveRepresentation.h:62
vtkCurveRepresentation::SetLineColor
void SetLineColor(double r, double g, double b)
Convenience method to set the line color.
vtkSphereSource
create a polygonal sphere centered at the origin
Definition: vtkSphereSource.h:47
vtkCurveRepresentation::SetClosed
void SetClosed(int closed)
Control whether the curve is open or closed.
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkCurveRepresentation::SetProjectionNormalToZAxes
void SetProjectionNormalToZAxes()
Definition: vtkCurveRepresentation.h:101
vtkCurveRepresentation::Transform
vtkTransform * Transform
Definition: vtkCurveRepresentation.h:280
vtkCurveRepresentation::GetPolyData
virtual void GetPolyData(vtkPolyData *pd)=0
Grab the polydata (including points) that defines the interpolating curve.
vtkCurveRepresentation::SetHandlePosition
virtual void SetHandlePosition(int handle, double x, double y, double z)
Set/Get the position of the handles.
vtkCurveRepresentation::GetHandlePosition
virtual void GetHandlePosition(int handle, double xyz[3])
vtkCurveRepresentation::ProjectToPlane
int ProjectToPlane
Definition: vtkCurveRepresentation.h:239
vtkCurveRepresentation::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkCurveRepresentation::RegisterPickers
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
vtkCurveRepresentation::OnLine
@ OnLine
Definition: vtkCurveRepresentation.h:59
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:48
vtkCurveRepresentation::InitializeHandles
virtual void InitializeHandles(vtkPoints *points)=0
Convenience method to allocate and set the handles from a vtkPoints instance.
vtkCurveRepresentation::HandleProperty
vtkProperty * HandleProperty
Definition: vtkCurveRepresentation.h:284
vtkCurveRepresentation::Inserting
@ Inserting
Definition: vtkCurveRepresentation.h:63
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkCurveRepresentation::CalculateCentroid
void CalculateCentroid()
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
vtkCurveRepresentation::Handle
vtkActor ** Handle
Definition: vtkCurveRepresentation.h:255
vtkCurveRepresentation::EraseHandle
void EraseHandle(const int &)
vtkCurveRepresentation::HighlightLine
void HighlightLine(int highlight)
vtkCurveRepresentation::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
Methods supporting, and required by, the rendering process.
vtkCurveRepresentation::OnHandle
@ OnHandle
Definition: vtkCurveRepresentation.h:58
vtkCurveRepresentation::HandlePicker
vtkCellPicker * HandlePicker
Definition: vtkCurveRepresentation.h:264
vtkCurveRepresentation::Translate
void Translate(double *p1, double *p2)
vtkCurveRepresentation::GetHandlePositions
virtual vtkDoubleArray * GetHandlePositions()=0
vtkCurveRepresentation::SetHandlePosition
virtual void SetHandlePosition(int handle, double xyz[3])
vtkCurveRepresentation::GetHandlePosition
virtual double * GetHandlePosition(int handle)
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
vtkCurveRepresentation::Moving
@ Moving
Definition: vtkCurveRepresentation.h:60
vtkCurveRepresentation::BuildRepresentation
virtual void BuildRepresentation()=0
These are methods that satisfy vtkWidgetRepresentation's API.
vtkCurveRepresentation::SelectedLineProperty
vtkProperty * SelectedLineProperty
Definition: vtkCurveRepresentation.h:287
vtkCurveRepresentation::Scaling
@ Scaling
Definition: vtkCurveRepresentation.h:61
vtkCurveRepresentation::InsertHandleOnLine
virtual void InsertHandleOnLine(double *pos)=0
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:42
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:65
vtkCurveRepresentation::SizeHandles
virtual void SizeHandles()
vtkCurveRepresentation::GetSummedLength
virtual double GetSummedLength()=0
Get the approximate vs.
vtkCurveRepresentation::LineProperty
vtkProperty * LineProperty
Definition: vtkCurveRepresentation.h:286
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:70
vtkCurveRepresentation::SetProjectionNormalToXAxes
void SetProjectionNormalToXAxes()
Definition: vtkCurveRepresentation.h:97
vtkCurveRepresentation::RenderOverlay
virtual int RenderOverlay(vtkViewport *)
vtkCurveRepresentation::RenderTranslucentPolygonalGeometry
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
vtkCurveRepresentation::~vtkCurveRepresentation
~vtkCurveRepresentation()
vtkCurveRepresentation::PlaneSource
vtkPlaneSource * PlaneSource
Definition: vtkCurveRepresentation.h:240
vtkCurveRepresentation::ProjectionNormal
int ProjectionNormal
Definition: vtkCurveRepresentation.h:237