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 =========================================================================*/
27 #ifndef vtkCurveRepresentation_h
28 #define vtkCurveRepresentation_h
29 
30 #include "vtkInteractionWidgetsModule.h" // For export macro
32 
33 class vtkActor;
34 class vtkCellPicker;
35 class vtkDoubleArray;
36 class vtkPlaneSource;
37 class vtkPoints;
38 class vtkPolyData;
39 class vtkProp;
40 class vtkProperty;
41 class vtkSphereSource;
42 class vtkTransform;
43 
44 #define VTK_PROJECTION_YZ 0
45 #define VTK_PROJECTION_XZ 1
46 #define VTK_PROJECTION_XY 2
47 #define VTK_PROJECTION_OBLIQUE 3
49 {
50 public:
52  void PrintSelf(ostream& os, vtkIndent indent);
53 //BTX
54  // Used to manage the InteractionState of the widget
56  Outside=0,
63  Erasing
64  };
65 //ETX
66 
68 
69  vtkSetMacro(InteractionState, int);
71 
73 
79  vtkSetMacro(ProjectToPlane,int);
80  vtkGetMacro(ProjectToPlane,int);
81  vtkBooleanMacro(ProjectToPlane,int);
83 
87 
89  vtkGetMacro(ProjectionNormal,int);
91  { this->SetProjectionNormal(0); }
93  { this->SetProjectionNormal(1); }
95  { this->SetProjectionNormal(2); }
97  { this->SetProjectionNormal(3); }
98 
100 
106  vtkGetMacro(ProjectionPosition, double);
108 
113  virtual void GetPolyData(vtkPolyData *pd) = 0;
114 
116 
119  vtkGetObjectMacro(HandleProperty, vtkProperty);
120  vtkGetObjectMacro(SelectedHandleProperty, vtkProperty);
122 
124 
127  vtkGetObjectMacro(SelectedLineProperty, vtkProperty);
129 
131 
132  virtual void SetNumberOfHandles(int npts) = 0;
133  vtkGetMacro(NumberOfHandles, int);
135 
137 
139  virtual void SetHandlePosition(int handle, double x, double y, double z);
140  virtual void SetHandlePosition(int handle, double xyz[3]);
141  virtual void GetHandlePosition(int handle, double xyz[3]);
142  virtual double* GetHandlePosition(int handle);
145 
147 
150  void SetClosed(int closed);
151  vtkGetMacro(Closed,int);
152  vtkBooleanMacro(Closed,int);
154 
158  int IsClosed();
159 
163  virtual double GetSummedLength() = 0;
164 
169  virtual void InitializeHandles(vtkPoints* points) = 0;
170 
172 
175  virtual void BuildRepresentation() = 0;
176  virtual int ComputeInteractionState(int X, int Y, int modify=0);
177  virtual void StartWidgetInteraction(double e[2]);
178  virtual void WidgetInteraction(double e[2]);
179  virtual void EndWidgetInteraction(double e[2]);
180  virtual double *GetBounds();
182 
184 
188  virtual int RenderOverlay(vtkViewport*);
191 
194  void SetLineColor(double r, double g, double b);
195 
196 //BTX
197 protected:
200 
201  double LastEventPosition[3];
202  double Bounds[6];
203 
204  // Controlling vars
209 
210  // Projection capabilities
214 
216  int Closed;
217 
218  // The line segments
220  void HighlightLine(int highlight);
221 
222  // Glyphs representing hot spots (e.g., handles)
225  void Initialize();
226  int HighlightHandle(vtkProp *prop); //returns handle index or -1 on fail
227  virtual void SizeHandles();
228  virtual void InsertHandleOnLine(double* pos) = 0;
229  void EraseHandle(const int&);
230 
231  // Do the picking
234  double LastPickPosition[3];
237 
238  // Register internal Pickers within PickingManager
239  virtual void RegisterPickers();
240 
241  // Methods to manipulate the curve.
242  void MovePoint(double *p1, double *p2);
243  void Scale(double *p1, double *p2, int X, int Y);
244  void Translate(double *p1, double *p2);
245  void Spin(double *p1, double *p2, double *vpn);
246 
247  // Transform the control points (used for spinning)
249 
250  // Properties used to control the appearance of selected objects and
251  // the manipulator in general.
257 
258  // For efficient spinning
259  double Centroid[3];
261 
262 private:
263  vtkCurveRepresentation(const vtkCurveRepresentation&); // Not implemented.
264  void operator=(const vtkCurveRepresentation&); // Not implemented.
265 //ETX
266 };
267 
268 
269 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkWidgetRepresentation.h
vtkgl::z
GLdouble GLdouble z
Definition: vtkgl.h:11754
vtkCurveRepresentation::_InteractionState
_InteractionState
Definition: vtkCurveRepresentation.h:55
vtkCurveRepresentation::SetProjectionPosition
void SetProjectionPosition(double position)
vtkCurveRepresentation::NumberOfHandles
int NumberOfHandles
Definition: vtkCurveRepresentation.h:215
vtkCurveRepresentation::CreateDefaultProperties
void CreateDefaultProperties()
vtkGetObjectMacro
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:232
vtkCurveRepresentation::Spin
void Spin(double *p1, double *p2, double *vpn)
vtkCurveRepresentation::SetProjectionNormalToYAxes
void SetProjectionNormalToYAxes()
Definition: vtkCurveRepresentation.h:92
vtkCurveRepresentation::ProjectPointsToPlane
void ProjectPointsToPlane()
vtkCurveRepresentation::SetProjectionNormalToOblique
void SetProjectionNormalToOblique()
Definition: vtkCurveRepresentation.h:96
vtkgl::b
GLboolean GLboolean GLboolean b
Definition: vtkgl.h:12312
vtkCurveRepresentation::SetNumberOfHandles
virtual void SetNumberOfHandles(int npts)=0
VTK_PROJECTION_YZ
#define VTK_PROJECTION_YZ
Definition: vtkCurveRepresentation.h:44
vtkCurveRepresentation::SetPlaneSource
void SetPlaneSource(vtkPlaneSource *plane)
vtkCurveRepresentation::Initialize
void Initialize()
vtkCurveRepresentation::HandleGeometry
vtkSphereSource ** HandleGeometry
Definition: vtkCurveRepresentation.h:224
vtkCurveRepresentation::LinePicker
vtkCellPicker * LinePicker
Definition: vtkCurveRepresentation.h:233
vtkCurveRepresentation
vtkWidgetRepresentation base class for a widget that represents an curve that connects control points...
Definition: vtkCurveRepresentation.h:49
vtkCurveRepresentation::CurrentHandle
vtkActor * CurrentHandle
Definition: vtkCurveRepresentation.h:235
vtkCurveRepresentation::SelectedHandleProperty
vtkProperty * SelectedHandleProperty
Definition: vtkCurveRepresentation.h:253
vtkPlaneSource
create an array of quadrilaterals located in a plane
Definition: vtkPlaneSource.h:60
vtkCurveRepresentation::ProjectPointsToOrthoPlane
void ProjectPointsToOrthoPlane()
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:54
vtkInteractionWidgetsModule.h
vtkCurveRepresentation::HighlightHandle
int HighlightHandle(vtkProp *prop)
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkCurveRepresentation::StartWidgetInteraction
virtual void StartWidgetInteraction(double e[2])
vtkCurveRepresentation::CurrentHandleIndex
int CurrentHandleIndex
Definition: vtkCurveRepresentation.h:236
vtkCurveRepresentation::GetBounds
virtual double * GetBounds()
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkCurveRepresentation::Scale
void Scale(double *p1, double *p2, int X, int Y)
vtkgl::points
GLsizei const GLfloat * points
Definition: vtkgl.h:14786
vtkCurveRepresentation::Closed
int Closed
Definition: vtkCurveRepresentation.h:216
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
VTK_PROJECTION_OBLIQUE
#define VTK_PROJECTION_OBLIQUE
Definition: vtkCurveRepresentation.h:47
vtkCurveRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkCurveRepresentation::WidgetInteraction
virtual void WidgetInteraction(double e[2])
vtkCurveRepresentation::LineActor
vtkActor * LineActor
Definition: vtkCurveRepresentation.h:219
vtkCurveRepresentation::HasTranslucentPolygonalGeometry
virtual int HasTranslucentPolygonalGeometry()
vtkX3D::position
@ position
Definition: vtkX3D.h:261
vtkSetClampMacro
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:143
vtkCurveRepresentation::ProjectPointsToObliquePlane
void ProjectPointsToObliquePlane()
vtkCurveRepresentation::vtkCurveRepresentation
vtkCurveRepresentation()
vtkCurveRepresentation::ProjectionPosition
double ProjectionPosition
Definition: vtkCurveRepresentation.h:206
vtkCurveRepresentation::EndWidgetInteraction
virtual void EndWidgetInteraction(double e[2])
vtkCurveRepresentation::MovePoint
void MovePoint(double *p1, double *p2)
vtkCurveRepresentation::RenderOpaqueGeometry
virtual int RenderOpaqueGeometry(vtkViewport *)
vtkCurveRepresentation::IsClosed
int IsClosed()
vtkCurveRepresentation::Spinning
@ Spinning
Definition: vtkCurveRepresentation.h:61
vtkCurveRepresentation::SetLineColor
void SetLineColor(double r, double g, double b)
vtkSphereSource
create a polygonal sphere centered at the origin
Definition: vtkSphereSource.h:46
vtkCurveRepresentation::SetClosed
void SetClosed(int closed)
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkCurveRepresentation::SetProjectionNormalToZAxes
void SetProjectionNormalToZAxes()
Definition: vtkCurveRepresentation.h:94
vtkCurveRepresentation::Transform
vtkTransform * Transform
Definition: vtkCurveRepresentation.h:248
vtkCurveRepresentation::GetPolyData
virtual void GetPolyData(vtkPolyData *pd)=0
vtkCurveRepresentation::SetHandlePosition
virtual void SetHandlePosition(int handle, double x, double y, double z)
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkCurveRepresentation::GetHandlePosition
virtual void GetHandlePosition(int handle, double xyz[3])
vtkCurveRepresentation::ProjectToPlane
int ProjectToPlane
Definition: vtkCurveRepresentation.h:207
vtkCurveRepresentation::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkCurveRepresentation::RegisterPickers
virtual void RegisterPickers()
vtkCurveRepresentation::OnLine
@ OnLine
Definition: vtkCurveRepresentation.h:58
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkCurveRepresentation::InitializeHandles
virtual void InitializeHandles(vtkPoints *points)=0
vtkCurveRepresentation::HandleProperty
vtkProperty * HandleProperty
Definition: vtkCurveRepresentation.h:252
vtkCurveRepresentation::Inserting
@ Inserting
Definition: vtkCurveRepresentation.h:62
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkCurveRepresentation::CalculateCentroid
void CalculateCentroid()
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
vtkCurveRepresentation::Handle
vtkActor ** Handle
Definition: vtkCurveRepresentation.h:223
vtkCurveRepresentation::EraseHandle
void EraseHandle(const int &)
vtkCurveRepresentation::HighlightLine
void HighlightLine(int highlight)
vtkCurveRepresentation::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
vtkgl::r
GLdouble GLdouble GLdouble r
Definition: vtkgl.h:11610
vtkCurveRepresentation::OnHandle
@ OnHandle
Definition: vtkCurveRepresentation.h:57
VTKINTERACTIONWIDGETS_EXPORT
#define VTKINTERACTIONWIDGETS_EXPORT
Definition: vtkInteractionWidgetsModule.h:15
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkgl::g
GLboolean GLboolean g
Definition: vtkgl.h:12312
vtkCurveRepresentation::HandlePicker
vtkCellPicker * HandlePicker
Definition: vtkCurveRepresentation.h:232
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:84
vtkCurveRepresentation::Moving
@ Moving
Definition: vtkCurveRepresentation.h:59
vtkCurveRepresentation::BuildRepresentation
virtual void BuildRepresentation()=0
vtkCurveRepresentation::SelectedLineProperty
vtkProperty * SelectedLineProperty
Definition: vtkCurveRepresentation.h:255
vtkCurveRepresentation::Scaling
@ Scaling
Definition: vtkCurveRepresentation.h:60
vtkCurveRepresentation::InsertHandleOnLine
virtual void InsertHandleOnLine(double *pos)=0
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:49
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:64
vtkCurveRepresentation::SizeHandles
virtual void SizeHandles()
vtkCurveRepresentation::GetSummedLength
virtual double GetSummedLength()=0
vtkCurveRepresentation::LineProperty
vtkProperty * LineProperty
Definition: vtkCurveRepresentation.h:254
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:69
vtkCurveRepresentation::SetProjectionNormalToXAxes
void SetProjectionNormalToXAxes()
Definition: vtkCurveRepresentation.h:90
vtkCurveRepresentation::RenderOverlay
virtual int RenderOverlay(vtkViewport *)
vtkCurveRepresentation::RenderTranslucentPolygonalGeometry
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
vtkCurveRepresentation::~vtkCurveRepresentation
~vtkCurveRepresentation()
vtkCurveRepresentation::PlaneSource
vtkPlaneSource * PlaneSource
Definition: vtkCurveRepresentation.h:208
vtkCurveRepresentation::ProjectionNormal
int ProjectionNormal
Definition: vtkCurveRepresentation.h:205