VTK  9.5.2
vtkLineRepresentation.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
47
48#ifndef vtkLineRepresentation_h
49#define vtkLineRepresentation_h
50
51#include "vtkInteractionWidgetsModule.h" // For export macro
53#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
54
55VTK_ABI_NAMESPACE_BEGIN
56class vtkActor;
57class vtkConeSource;
59class vtkLineSource;
60class vtkProperty;
61class vtkPolyData;
64class vtkBox;
65class vtkFollower;
66class vtkVectorText;
68class vtkCellPicker;
69
70class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkLineRepresentation
72{
73public:
78
80
84 void PrintSelf(ostream& os, vtkIndent indent) override;
86
88
93 void GetPoint1WorldPosition(double pos[3]) VTK_FUTURE_CONST;
96 void GetPoint1DisplayPosition(double pos[3]) VTK_FUTURE_CONST;
99 void SetPoint1WorldPosition(double pos[3]);
101 void SetPoint1DisplayPosition(double pos[3]);
103 void GetPoint2DisplayPosition(double pos[3]) VTK_FUTURE_CONST;
106 void GetPoint2WorldPosition(double pos[3]) VTK_FUTURE_CONST;
108 void SetPoint2WorldPosition(double pos[3]);
110 void SetPoint2DisplayPosition(double pos[3]);
112
114
127
129
136
138
142 vtkGetObjectMacro(EndPointProperty, vtkProperty);
145
147
151 vtkGetObjectMacro(EndPoint2Property, vtkProperty);
154
156
160 vtkGetObjectMacro(LineProperty, vtkProperty);
163
165
170 vtkSetClampMacro(Tolerance, int, 1, 100);
171 vtkGetMacro(Tolerance, int);
173
175
180 void SetResolution(int res);
183
193
195
198 void PlaceWidget(double bounds[6]) override;
199 void BuildRepresentation() override;
200 int ComputeInteractionState(int X, int Y, int modify = 0) override;
201 void StartWidgetInteraction(double e[2]) override;
202 void WidgetInteraction(double e[2]) override;
203 double* GetBounds() VTK_SIZEHINT(6) override;
205
207
210 void GetActors(vtkPropCollection* pc) override;
216
217 // Manage the state of the widget
218 enum
219 {
227 };
228
230
239 vtkSetClampMacro(InteractionState, int, Outside, Scaling);
241
243
247 virtual void SetRepresentationState(int);
248 vtkGetMacro(RepresentationState, int);
250
252
256 void SetDirectionalLine(bool val);
257 vtkGetMacro(DirectionalLine, bool);
258 vtkBooleanMacro(DirectionalLine, bool);
260
266
270 void SetRenderer(vtkRenderer* ren) override;
271
273
280
282
287 vtkSetStringMacro(DistanceAnnotationFormat);
288 vtkGetStringMacro(DistanceAnnotationFormat);
290
292
295 void SetDistanceAnnotationScale(double x, double y, double z)
296 {
297 double scale[3];
298 scale[0] = x;
299 scale[1] = y;
300 scale[2] = z;
301 this->SetDistanceAnnotationScale(scale);
302 }
303 virtual void SetDistanceAnnotationScale(double scale[3]);
306
310 double GetDistance();
311
316 void SetLineColor(double r, double g, double b);
317
319
322 void SetInteractionColor(double, double, double);
323 void SetInteractionColor(double c[3]) { this->SetInteractionColor(c[0], c[1], c[2]); }
324 void SetForegroundColor(double, double, double);
325 void SetForegroundColor(double c[3]) { this->SetForegroundColor(c[0], c[1], c[2]); }
327
332
334
337 vtkGetObjectMacro(TextActor, vtkFollower);
339
340 enum
341 {
346 };
347
348protected:
351
352 // The handle and the rep used to close the handles
357
358 // Manage how the representation appears
361
362 // the line
366
367 // glyphs representing hot spots (e.g., handles)
371
372 // Properties used to control the appearance of selected objects and
373 // the manipulator in general.
381
382 // Selection tolerance for the handles and the line
384
385 // Helper members
387 void ClampPosition(double x[3]);
388 void HighlightPoint(int ptId, int highlight);
389 void HighlightLine(int highlight);
390 int InBounds(double x[3]);
392
393 // Ivars used during widget interaction to hold initial positions
394 double StartP1[3];
395 double StartP2[3];
397 double Length;
399
400 // Support GetBounds() method
402
403 // Need to keep track if we have successfully initialized the display position.
404 // The widget tends to do stuff in world coordinates, put if the renderer has
405 // not been assigned, then certain operations do not properly update the display
406 // position.
408
409 // Format for the label
412
416 double Distance;
418
420
421private:
423 void operator=(const vtkLineRepresentation&) = delete;
424};
425
426VTK_ABI_NAMESPACE_END
427#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
implicit function for a bounding box
Definition vtkBox.h:110
ray-cast cell picker for all kinds of Prop3Ds
generate polygonal cone
a subclass of actor that always faces the camera
Definition vtkFollower.h:92
a simple class to control print indentation
Definition vtkIndent.h:108
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.
void SetInteractionColor(double c[3])
Set the widget color, and the color of interactive handles.
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 SetForegroundColor(double c[3])
Set the widget color, and the color of interactive handles.
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 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.
void GetPoint1WorldPosition(double pos[3]) VTK_FUTURE_CONST
Methods to Set/Get the coordinates of the two points defining this representation.
double * GetPoint1WorldPosition()
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 GetPoint1DisplayPosition(double pos[3]) VTK_FUTURE_CONST
Methods to Set/Get the coordinates of the two points defining this representation.
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
void SetForegroundColor(double, double, double)
Set the widget color, and the color of interactive handles.
virtual double * GetDistanceAnnotationScale()
Scale text (font size along each dimension).
virtual vtkProperty * GetDistanceAnnotationProperty()
Get the distance annotation property.
void GetPoint2DisplayPosition(double pos[3]) VTK_FUTURE_CONST
Methods to Set/Get the coordinates of the two points defining this representation.
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.
void SetInteractionColor(double, double, double)
Set the widget color, and the color of interactive handles.
void GetPoint2WorldPosition(double pos[3]) VTK_FUTURE_CONST
Methods to Set/Get the coordinates of the two points defining this representation.
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 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
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
an ordered list of Props
represent surface properties of a geometric object
abstract specification for renderers
create polygonal text
abstract specification for Viewports
Definition vtkViewport.h:66
window superclass for vtkRenderWindow
Definition vtkWindow.h:45
int vtkTypeBool
Definition vtkABI.h:64
#define vtkPolyDataAlgorithm
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:287
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)