VTK  9.4.20251007
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
28
29#ifndef vtkLineRepresentation_h
30#define vtkLineRepresentation_h
31
32#include "vtkInteractionWidgetsModule.h" // For export macro
34#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
35
36VTK_ABI_NAMESPACE_BEGIN
37class vtkActor;
38class vtkConeSource;
40class vtkLineSource;
41class vtkProperty;
42class vtkPolyData;
45class vtkBox;
46class vtkFollower;
47class vtkVectorText;
49class vtkCellPicker;
50
51class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkLineRepresentation
53{
54public:
59
61
65 void PrintSelf(ostream& os, vtkIndent indent) override;
67
69
74 void GetPoint1WorldPosition(double pos[3]);
77 void GetPoint1DisplayPosition(double pos[3]);
80 void SetPoint1WorldPosition(double pos[3]);
82 void SetPoint1DisplayPosition(double pos[3]);
84 void GetPoint2DisplayPosition(double pos[3]);
87 void GetPoint2WorldPosition(double pos[3]);
89 void SetPoint2WorldPosition(double pos[3]);
91 void SetPoint2DisplayPosition(double pos[3]);
93
95
108
110
117
119
123 vtkGetObjectMacro(EndPointProperty, vtkProperty);
126
128
132 vtkGetObjectMacro(EndPoint2Property, vtkProperty);
135
137
141 vtkGetObjectMacro(LineProperty, vtkProperty);
144
146
151 vtkSetClampMacro(Tolerance, int, 1, 100);
152 vtkGetMacro(Tolerance, int);
154
156
161 void SetResolution(int res);
164
174
176
179 void PlaceWidget(double bounds[6]) override;
180 void BuildRepresentation() override;
181 int ComputeInteractionState(int X, int Y, int modify = 0) override;
182 void StartWidgetInteraction(double e[2]) override;
183 void WidgetInteraction(double e[2]) override;
184 double* GetBounds() VTK_SIZEHINT(6) override;
186
188
191 void GetActors(vtkPropCollection* pc) override;
197
198 // Manage the state of the widget
199 enum
200 {
208 };
209
211
220 vtkSetClampMacro(InteractionState, int, Outside, Scaling);
222
224
228 virtual void SetRepresentationState(int);
229 vtkGetMacro(RepresentationState, int);
231
233
237 void SetDirectionalLine(bool val);
238 vtkGetMacro(DirectionalLine, bool);
239 vtkBooleanMacro(DirectionalLine, bool);
241
247
251 void SetRenderer(vtkRenderer* ren) override;
252
254
261
263
268 vtkSetStringMacro(DistanceAnnotationFormat);
269 vtkGetStringMacro(DistanceAnnotationFormat);
271
273
276 void SetDistanceAnnotationScale(double x, double y, double z)
277 {
278 double scale[3];
279 scale[0] = x;
280 scale[1] = y;
281 scale[2] = z;
282 this->SetDistanceAnnotationScale(scale);
283 }
284 virtual void SetDistanceAnnotationScale(double scale[3]);
287
291 double GetDistance();
292
297 void SetLineColor(double r, double g, double b);
298
300
303 void SetInteractionColor(double, double, double);
304 void SetInteractionColor(double c[3]) { this->SetInteractionColor(c[0], c[1], c[2]); }
305 void SetForegroundColor(double, double, double);
306 void SetForegroundColor(double c[3]) { this->SetForegroundColor(c[0], c[1], c[2]); }
308
313
315
318 vtkGetObjectMacro(TextActor, vtkFollower);
320
321 enum
322 {
327 };
328
329protected:
332
333 // The handle and the rep used to close the handles
338
339 // Manage how the representation appears
342
343 // the line
347
348 // glyphs representing hot spots (e.g., handles)
352
353 // Properties used to control the appearance of selected objects and
354 // the manipulator in general.
362
363 // Selection tolerance for the handles and the line
365
366 // Helper members
368 void ClampPosition(double x[3]);
369 void HighlightPoint(int ptId, int highlight);
370 void HighlightLine(int highlight);
371 int InBounds(double x[3]);
373
374 // Ivars used during widget interaction to hold initial positions
375 double StartP1[3];
376 double StartP2[3];
378 double Length;
380
381 // Support GetBounds() method
383
384 // Need to keep track if we have successfully initialized the display position.
385 // The widget tends to do stuff in world coordinates, put if the renderer has
386 // not been assigned, then certain operations do not properly update the display
387 // position.
389
390 // Format for the label
393
397 double Distance;
399
401
402private:
404 void operator=(const vtkLineRepresentation&) = delete;
405};
406
407VTK_ABI_NAMESPACE_END
408#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:42
implicit function for a bounding box
Definition vtkBox.h:31
ray-cast cell picker for all kinds of Prop3Ds
generate polygonal cone
a subclass of actor that always faces the camera
Definition vtkFollower.h:33
a simple class to control print indentation
Definition vtkIndent.h:29
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 GetPoint2DisplayPosition(double pos[3])
Methods to Set/Get the coordinates of the two points defining this representation.
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 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
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 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.
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
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:72
an ordered list of Props
represent surface properties of a geometric object
Definition vtkProperty.h:60
abstract specification for renderers
Definition vtkRenderer.h:63
create polygonal text
abstract specification for Viewports
Definition vtkViewport.h:46
window superclass for vtkRenderWindow
Definition vtkWindow.h:29
int vtkTypeBool
Definition vtkABI.h:64
#define vtkPolyDataAlgorithm
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)