VTK  9.2.6
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
41#ifndef vtkLineRepresentation_h
42#define vtkLineRepresentation_h
43
44#include "vtkInteractionWidgetsModule.h" // For export macro
46
47class vtkActor;
48class vtkConeSource;
50class vtkLineSource;
51class vtkProperty;
52class vtkPolyData;
55class vtkBox;
56class vtkFollower;
57class vtkVectorText;
59class vtkCellPicker;
60
61class VTKINTERACTIONWIDGETS_EXPORT vtkLineRepresentation : public vtkWidgetRepresentation
62{
63public:
68
70
74 void PrintSelf(ostream& os, vtkIndent indent) override;
76
78
83 void GetPoint1WorldPosition(double pos[3]);
85 void GetPoint1DisplayPosition(double pos[3]);
87 void SetPoint1WorldPosition(double pos[3]);
88 void SetPoint1DisplayPosition(double pos[3]);
89 void GetPoint2DisplayPosition(double pos[3]);
91 void GetPoint2WorldPosition(double pos[3]);
93 void SetPoint2WorldPosition(double pos[3]);
94 void SetPoint2DisplayPosition(double pos[3]);
96
98
111
113
120
122
126 vtkGetObjectMacro(EndPointProperty, vtkProperty);
129
131
135 vtkGetObjectMacro(EndPoint2Property, vtkProperty);
138
140
144 vtkGetObjectMacro(LineProperty, vtkProperty);
147
149
154 vtkSetClampMacro(Tolerance, int, 1, 100);
155 vtkGetMacro(Tolerance, int);
157
159
164 void SetResolution(int res);
167
177
179
182 void PlaceWidget(double bounds[6]) override;
183 void BuildRepresentation() override;
184 int ComputeInteractionState(int X, int Y, int modify = 0) override;
185 void StartWidgetInteraction(double e[2]) override;
186 void WidgetInteraction(double e[2]) override;
187 double* GetBounds() VTK_SIZEHINT(6) override;
189
191
194 void GetActors(vtkPropCollection* pc) override;
200
201 // Manage the state of the widget
202 enum
203 {
211 };
212
214
223 vtkSetClampMacro(InteractionState, int, Outside, Scaling);
225
227
231 virtual void SetRepresentationState(int);
232 vtkGetMacro(RepresentationState, int);
234
236
240 void SetDirectionalLine(bool val);
241 vtkGetMacro(DirectionalLine, bool);
242 vtkBooleanMacro(DirectionalLine, bool);
244
250
254 void SetRenderer(vtkRenderer* ren) override;
255
257
264
266
271 vtkSetStringMacro(DistanceAnnotationFormat);
272 vtkGetStringMacro(DistanceAnnotationFormat);
274
276
279 void SetDistanceAnnotationScale(double x, double y, double z)
280 {
281 double scale[3];
282 scale[0] = x;
283 scale[1] = y;
284 scale[2] = z;
285 this->SetDistanceAnnotationScale(scale);
286 }
287 virtual void SetDistanceAnnotationScale(double scale[3]);
290
294 double GetDistance();
295
300 void SetLineColor(double r, double g, double b);
301
306
308
311 vtkGetObjectMacro(TextActor, vtkFollower);
313
314 enum
315 {
320 };
321
322protected:
325
326 // The handle and the rep used to close the handles
331
332 // Manage how the representation appears
335
336 // the line
340
341 // glyphs representing hot spots (e.g., handles)
345
346 // Properties used to control the appearance of selected objects and
347 // the manipulator in general.
355
356 // Selection tolerance for the handles and the line
358
359 // Helper members
361 void ClampPosition(double x[3]);
362 void HighlightPoint(int ptId, int highlight);
363 void HighlightLine(int highlight);
364 int InBounds(double x[3]);
366
367 // Ivars used during widget interaction to hold initial positions
368 double StartP1[3];
369 double StartP2[3];
371 double Length;
373
374 // Support GetBounds() method
376
377 // Need to keep track if we have successfully initialized the display position.
378 // The widget tends to do stuff in world coordinates, put if the renderer has
379 // not been assigned, then certain operations do not properly update the display
380 // position.
382
383 // Format for the label
386
390 double Distance;
392
394
395private:
397 void operator=(const vtkLineRepresentation&) = delete;
398};
399
400#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:52
implicit function for a bounding box
Definition vtkBox.h:42
ray-cast cell picker for all kinds of Prop3Ds
generate polygonal cone
a subclass of actor that always faces the camera
Definition vtkFollower.h:44
a simple class to control print indentation
Definition vtkIndent.h:40
void SetDirectionalLine(bool val)
Sets the representation to be a directional line with point 1 represented as a cone.
void InstantiateHandleRepresentation()
This method is used to specify the type of handle representation to use for the three internal vtkHan...
double * GetBounds() override
These are methods that satisfy vtkWidgetRepresentation's API.
void WidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods supporting the rendering process.
vtkPolyDataMapper * TextMapper
void ReleaseGraphicsResources(vtkWindow *) override
Methods supporting the rendering process.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for the class.
static vtkLineRepresentation * New()
Instantiate the class.
virtual void SetDistanceAnnotationScale(double scale[3])
Scale text (font size along each dimension).
void PlaceWidget(double bounds[6]) override
These are methods that satisfy vtkWidgetRepresentation's API.
void GetPoint2DisplayPosition(double pos[3])
Methods to Set/Get the coordinates of the two points defining this representation.
void SetDistanceAnnotationScale(double x, double y, double z)
Scale text (font size along each dimension).
vtkPointHandleRepresentation3D * Point1Representation
void ClampPosition(double x[3])
virtual void SetRepresentationState(int)
Sets the visual appearance of the representation based on the state it is in.
void GetPoint2WorldPosition(double pos[3])
Methods to Set/Get the coordinates of the two points defining this representation.
void SetPoint1DisplayPosition(double pos[3])
Methods to Set/Get the coordinates of the two points defining this representation.
void SetResolution(int res)
Set/Get the resolution (number of subdivisions) of the line.
vtkPolyDataMapper * LineMapper
vtkPointHandleRepresentation3D * LineHandleRepresentation
void SetPoint1WorldPosition(double pos[3])
Methods to Set/Get the coordinates of the two points defining this representation.
int RenderOpaqueGeometry(vtkViewport *) override
Methods supporting the rendering process.
double * GetPoint1WorldPosition()
Methods to Set/Get the coordinates of the two points defining this representation.
void GetPoint1DisplayPosition(double pos[3])
Methods to Set/Get the coordinates of the two points defining this representation.
int ComputeInteractionState(int X, int Y, int modify=0) override
These are methods that satisfy vtkWidgetRepresentation's API.
void SetRenderer(vtkRenderer *ren) override
Overridden to set the rendererer on the internal representations.
void GetActors(vtkPropCollection *pc) override
Methods supporting the rendering process.
void SetHandleRepresentation(vtkPointHandleRepresentation3D *handle)
This method is used to specify the type of handle representation to use for the three internal vtkHan...
void SetLineColor(double r, double g, double b)
Convenience method to set the line color.
vtkPolyDataAlgorithm ** HandleGeometry
virtual double * GetDistanceAnnotationScale()
Scale text (font size along each dimension).
virtual vtkProperty * GetDistanceAnnotationProperty()
Get the distance annotation property.
void HighlightLine(int highlight)
void HighlightPoint(int ptId, int highlight)
void GetPolyData(vtkPolyData *pd)
Retrieve the polydata (including points) that defines the line.
double GetDistance()
Get the distance between the points.
vtkPointHandleRepresentation3D * Point2Representation
vtkPointHandleRepresentation3D * HandleRepresentation
void StartWidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkPolyDataMapper ** HandleMapper
int GetResolution()
Set/Get the resolution (number of subdivisions) of the line.
void SetPoint2DisplayPosition(double pos[3])
Methods to Set/Get the coordinates of the two points defining this representation.
void SetPoint2WorldPosition(double pos[3])
Methods to Set/Get the coordinates of the two points defining this representation.
vtkProperty * SelectedEndPoint2Property
~vtkLineRepresentation() override
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Methods supporting the rendering process.
void GetPoint1WorldPosition(double pos[3])
Methods to Set/Get the coordinates of the two points defining this representation.
void BuildRepresentation() override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkMTimeType GetMTime() override
Overload the superclasses' GetMTime() because internal classes are used to keep the state of the repr...
int InBounds(double x[3])
create a line defined by two end points
represent the position of a point in 3D space
Superclass for algorithms that produce only polydata as output.
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:91
an ordered list of Props
represent surface properties of a geometric object
Definition vtkProperty.h:68
abstract specification for renderers
Definition vtkRenderer.h:73
create polygonal text
abstract specification for Viewports
Definition vtkViewport.h:56
window superclass for vtkRenderWindow
Definition vtkWindow.h:39
int vtkTypeBool
Definition vtkABI.h:69
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:287
#define VTK_SIZEHINT(...)