VTK
vtkLineRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLineRepresentation.h
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 =========================================================================*/
40 #ifndef vtkLineRepresentation_h
41 #define vtkLineRepresentation_h
42 
43 #include "vtkInteractionWidgetsModule.h" // For export macro
45 
46 class vtkActor;
47 class vtkPolyDataMapper;
48 class vtkLineSource;
49 class vtkSphereSource;
50 class vtkProperty;
51 class vtkPolyData;
54 class vtkBox;
55 class vtkFollower;
56 class vtkVectorText;
57 class vtkPolyDataMapper;
58 class vtkCellPicker;
59 
61 {
62 public:
65 
67 
69  void PrintSelf(ostream& os, vtkIndent indent);
71 
73 
76  void GetPoint1WorldPosition(double pos[3]);
78  void GetPoint1DisplayPosition(double pos[3]);
80  void SetPoint1WorldPosition(double pos[3]);
81  void SetPoint1DisplayPosition(double pos[3]);
82  void GetPoint2DisplayPosition(double pos[3]);
84  void GetPoint2WorldPosition(double pos[3]);
86  void SetPoint2WorldPosition(double pos[3]);
87  void SetPoint2DisplayPosition(double pos[3]);
89 
91 
102 
104 
109 
111 
113  vtkGetObjectMacro(EndPointProperty,vtkProperty);
114  vtkGetObjectMacro(SelectedEndPointProperty,vtkProperty);
116 
118 
120  vtkGetObjectMacro(EndPoint2Property,vtkProperty);
121  vtkGetObjectMacro(SelectedEndPoint2Property,vtkProperty);
123 
125 
128  vtkGetObjectMacro(SelectedLineProperty,vtkProperty);
130 
132 
135  vtkSetClampMacro(Tolerance,int,1,100);
136  vtkGetMacro(Tolerance,int);
138 
140 
143  void SetResolution(int res);
146 
154 
156 
157  virtual void PlaceWidget(double bounds[6]);
158  virtual void BuildRepresentation();
159  virtual int ComputeInteractionState(int X, int Y, int modify=0);
160  virtual void StartWidgetInteraction(double e[2]);
161  virtual void WidgetInteraction(double e[2]);
162  virtual double *GetBounds();
164 
166 
167  virtual void GetActors(vtkPropCollection *pc);
173 
174 //BTX - manage the state of the widget
175  enum {Outside=0,OnP1,OnP2,TranslatingP1,TranslatingP2,OnLine,Scaling};
176 //ETX
177 
179 
186  vtkSetClampMacro(InteractionState,int,Outside,Scaling);
188 
190 
192  virtual void SetRepresentationState(int);
193  vtkGetMacro(RepresentationState, int);
195 
198  virtual unsigned long GetMTime();
199 
201  virtual void SetRenderer(vtkRenderer *ren);
202 
204 
205  vtkSetMacro( DistanceAnnotationVisibility, int );
206  vtkGetMacro( DistanceAnnotationVisibility, int );
207  vtkBooleanMacro( DistanceAnnotationVisibility, int );
209 
211 
214  vtkSetStringMacro(DistanceAnnotationFormat);
215  vtkGetStringMacro(DistanceAnnotationFormat);
217 
219 
220  void SetDistanceAnnotationScale(double x, double y, double z)
221  {
222  double scale[3];
223  scale[0] = x;
224  scale[1] = y;
225  scale[2] = z;
226  this->SetDistanceAnnotationScale(scale);
227  }
228  virtual void SetDistanceAnnotationScale( double scale[3] );
229  virtual double * GetDistanceAnnotationScale();
231 
233  double GetDistance();
234 
235 
238  void SetLineColor(double r, double g, double b);
239 
242 
244 
247 
248 protected:
251 
252  // The handle and the rep used to close the handles
257 
258  // Manage how the representation appears
260 
261  // the line
265 
266  // glyphs representing hot spots (e.g., handles)
270 
271  // Properties used to control the appearance of selected objects and
272  // the manipulator in general.
280 
281  // Selection tolerance for the handles and the line
283 
284  // Helper members
286  void ClampPosition(double x[3]);
287  void HighlightPoint(int ptId, int highlight);
288  void HighlightLine(int highlight);
289  int InBounds(double x[3]);
290  void SizeHandles();
291 
292  // Ivars used during widget interaction to hold initial positions
293  double StartP1[3];
294  double StartP2[3];
295  double StartLineHandle[3];
296  double Length;
297  double LastEventPosition[3];
298 
299  // Support GetBounds() method
301 
302  // Need to keep track if we have successfully initialized the display position.
303  // The widget tends to do stuff in world coordinates, put if the renderer has
304  // not been assigned, then certain operations do not properly update the display
305  // position.
307 
308  // Format for the label
311 
315  double Distance;
317 
319 
320 private:
321  vtkLineRepresentation(const vtkLineRepresentation&); //Not implemented
322  void operator=(const vtkLineRepresentation&); //Not implemented
323 };
324 
325 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:42
vtkLineRepresentation::HandleRepresentation
vtkPointHandleRepresentation3D * HandleRepresentation
Definition: vtkLineRepresentation.h:253
vtkLineRepresentation::Point2Representation
vtkPointHandleRepresentation3D * Point2Representation
Definition: vtkLineRepresentation.h:255
vtkWidgetRepresentation.h
vtkgl::z
GLdouble GLdouble z
Definition: vtkgl.h:11754
vtkLineRepresentation::SetPoint2DisplayPosition
void SetPoint2DisplayPosition(double pos[3])
vtkLineRepresentation::HandleMapper
vtkPolyDataMapper ** HandleMapper
Definition: vtkLineRepresentation.h:268
vtkLineRepresentation::GetResolution
int GetResolution()
vtkLineRepresentation::EndPoint2Property
vtkProperty * EndPoint2Property
Definition: vtkLineRepresentation.h:275
vtkFollower
a subclass of actor that always faces the camera
Definition: vtkFollower.h:46
vtkGetObjectMacro
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:232
vtkLineRepresentation::GetDistanceAnnotationScale
virtual double * GetDistanceAnnotationScale()
vtkLineRepresentation::~vtkLineRepresentation
~vtkLineRepresentation()
vtkLineRepresentation::HasTranslucentPolygonalGeometry
virtual int HasTranslucentPolygonalGeometry()
vtkgl::b
GLboolean GLboolean GLboolean b
Definition: vtkgl.h:12312
vtkLineRepresentation::SetHandleRepresentation
void SetHandleRepresentation(vtkPointHandleRepresentation3D *handle)
vtkLineRepresentation::SetDistanceAnnotationScale
void SetDistanceAnnotationScale(double x, double y, double z)
Definition: vtkLineRepresentation.h:220
vtkLineRepresentation::ClampToBounds
int ClampToBounds
Definition: vtkLineRepresentation.h:285
vtkLineRepresentation::TextActor
vtkFollower * TextActor
Definition: vtkLineRepresentation.h:312
vtkLineRepresentation::LineHandleRepresentation
vtkPointHandleRepresentation3D * LineHandleRepresentation
Definition: vtkLineRepresentation.h:256
vtkLineRepresentation::HighlightLine
void HighlightLine(int highlight)
vtkLineRepresentation::BoundingBox
vtkBox * BoundingBox
Definition: vtkLineRepresentation.h:300
vtkLineRepresentation::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
vtkPointHandleRepresentation3D
represent the position of a point in 3D space
Definition: vtkPointHandleRepresentation3D.h:43
vtkLineRepresentation::SizeHandles
void SizeHandles()
vtkLineRepresentation::BuildRepresentation
virtual void BuildRepresentation()
vtkLineRepresentation::LineActor
vtkActor * LineActor
Definition: vtkLineRepresentation.h:262
vtkgl::scale
GLenum GLenum GLenum GLenum GLenum scale
Definition: vtkgl.h:15942
vtkLineRepresentation::RenderTranslucentPolygonalGeometry
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
vtkLineRepresentation::vtkLineRepresentation
vtkLineRepresentation()
vtkLineRepresentation::PlaceWidget
virtual void PlaceWidget(double bounds[6])
vtkLineRepresentation::TranslatingP2
@ TranslatingP2
Definition: vtkLineRepresentation.h:175
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
vtkLineRepresentation::SetResolution
void SetResolution(int res)
vtkInteractionWidgetsModule.h
vtkLineRepresentation::SetRepresentationState
virtual void SetRepresentationState(int)
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkLineRepresentation::InstantiateHandleRepresentation
void InstantiateHandleRepresentation()
vtkLineRepresentation::CreateDefaultProperties
void CreateDefaultProperties()
vtkLineRepresentation::AnnotationTextScaleInitialized
bool AnnotationTextScaleInitialized
Definition: vtkLineRepresentation.h:316
vtkLineRepresentation::GetDistanceAnnotationProperty
virtual vtkProperty * GetDistanceAnnotationProperty()
vtkLineRepresentation::SetRenderer
virtual void SetRenderer(vtkRenderer *ren)
vtkLineRepresentation::GetActors
virtual void GetActors(vtkPropCollection *pc)
vtkLineRepresentation::GetPoint1WorldPosition
double * GetPoint1WorldPosition()
vtkLineRepresentation::GetBounds
virtual double * GetBounds()
vtkLineRepresentation::GetPoint1DisplayPosition
double * GetPoint1DisplayPosition()
vtkVectorText
create polygonal text
Definition: vtkVectorText.h:47
vtkLineRepresentation::SetLineColor
void SetLineColor(double r, double g, double b)
vtkLineRepresentation::TextInput
vtkVectorText * TextInput
Definition: vtkLineRepresentation.h:314
vtkLineRepresentation::DistanceAnnotationVisibility
int DistanceAnnotationVisibility
Definition: vtkLineRepresentation.h:309
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkLineRepresentation::GetPoint2DisplayPosition
double * GetPoint2DisplayPosition()
vtkLineRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkLineRepresentation::RenderOpaqueGeometry
virtual int RenderOpaqueGeometry(vtkViewport *)
vtkSetClampMacro
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:143
vtkLineRepresentation::SelectedLineProperty
vtkProperty * SelectedLineProperty
Definition: vtkLineRepresentation.h:278
vtkLineRepresentation::DistanceAnnotationFormat
char * DistanceAnnotationFormat
Definition: vtkLineRepresentation.h:310
vtkLineRepresentation::WidgetInteraction
virtual void WidgetInteraction(double e[2])
vtkLineRepresentation::GetPoint2WorldPosition
double * GetPoint2WorldPosition()
vtkLineRepresentation::GetDistance
double GetDistance()
vtkLineRepresentation::Length
double Length
Definition: vtkLineRepresentation.h:296
vtkLineRepresentation::GetMTime
virtual unsigned long GetMTime()
vtkLineRepresentation::Tolerance
int Tolerance
Definition: vtkLineRepresentation.h:282
vtkSphereSource
create a polygonal sphere centered at the origin
Definition: vtkSphereSource.h:46
vtkLineRepresentation::GetPoint2DisplayPosition
void GetPoint2DisplayPosition(double pos[3])
vtkLineRepresentation::LineProperty
vtkProperty * LineProperty
Definition: vtkLineRepresentation.h:277
vtkLineRepresentation::LinePicker
vtkCellPicker * LinePicker
Definition: vtkLineRepresentation.h:318
vtkLineRepresentation::EndPointProperty
vtkProperty * EndPointProperty
Definition: vtkLineRepresentation.h:273
vtkgl::res
GLuint res
Definition: vtkgl.h:16902
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
vtkSetStringMacro
#define vtkSetStringMacro(name)
Definition: vtkSetGet.h:104
vtkLineRepresentation::GetPolyData
void GetPolyData(vtkPolyData *pd)
vtkLineRepresentation::Point1Representation
vtkPointHandleRepresentation3D * Point1Representation
Definition: vtkLineRepresentation.h:254
vtkLineRepresentation::GetPoint2WorldPosition
void GetPoint2WorldPosition(double pos[3])
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkGetStringMacro
vtkGetStringMacro(ExtensionsString)
vtkLineSource
create a line defined by two end points
Definition: vtkLineSource.h:42
vtkLineRepresentation::HighlightPoint
void HighlightPoint(int ptId, int highlight)
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkLineRepresentation::Handle
vtkActor ** Handle
Definition: vtkLineRepresentation.h:267
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkLineRepresentation::StartWidgetInteraction
virtual void StartWidgetInteraction(double e[2])
vtkLineRepresentation::TextMapper
vtkPolyDataMapper * TextMapper
Definition: vtkLineRepresentation.h:313
vtkgl::r
GLdouble GLdouble GLdouble r
Definition: vtkgl.h:11610
vtkBox
implicit function for a bounding box
Definition: vtkBox.h:41
vtkLineRepresentation::SetPoint1WorldPosition
void SetPoint1WorldPosition(double pos[3])
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
vtkLineRepresentation::RepresentationState
int RepresentationState
Definition: vtkLineRepresentation.h:259
vtkLineRepresentation::New
static vtkLineRepresentation * New()
vtkLineRepresentation::ClampPosition
void ClampPosition(double x[3])
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkLineRepresentation::SetDistanceAnnotationScale
virtual void SetDistanceAnnotationScale(double scale[3])
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkLineRepresentation::Distance
double Distance
Definition: vtkLineRepresentation.h:315
vtkLineRepresentation::LineSource
vtkLineSource * LineSource
Definition: vtkLineRepresentation.h:264
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:64
vtkLineRepresentation::GetPoint1WorldPosition
void GetPoint1WorldPosition(double pos[3])
vtkLineRepresentation::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkLineRepresentation::SetPoint1DisplayPosition
void SetPoint1DisplayPosition(double pos[3])
vtkLineRepresentation::InBounds
int InBounds(double x[3])
vtkPropCollection
a list of Props
Definition: vtkPropCollection.h:38
vtkLineRepresentation::SelectedEndPoint2Property
vtkProperty * SelectedEndPoint2Property
Definition: vtkLineRepresentation.h:276
vtkLineRepresentation::SetPoint2WorldPosition
void SetPoint2WorldPosition(double pos[3])
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:69
vtkLineRepresentation::SelectedEndPointProperty
vtkProperty * SelectedEndPointProperty
Definition: vtkLineRepresentation.h:274
vtkLineRepresentation
a class defining the representation for a vtkLineWidget2
Definition: vtkLineRepresentation.h:61
vtkLineRepresentation::GetPoint1DisplayPosition
void GetPoint1DisplayPosition(double pos[3])
vtkLineRepresentation::InitializedDisplayPosition
int InitializedDisplayPosition
Definition: vtkLineRepresentation.h:306
vtkLineRepresentation::LineMapper
vtkPolyDataMapper * LineMapper
Definition: vtkLineRepresentation.h:263
vtkLineRepresentation::HandleGeometry
vtkSphereSource ** HandleGeometry
Definition: vtkLineRepresentation.h:269
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:44