ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cvConstrainedPolyLineRepresentation Class Reference

Extended PolyLineRepresentation adding angle display functionality. More...

#include <cvConstrainedPolyLineRepresentation.h>

Inheritance diagram for cvConstrainedPolyLineRepresentation:
Collaboration diagram for cvConstrainedPolyLineRepresentation:

Public Member Functions

 vtkTypeMacro (cvConstrainedPolyLineRepresentation, vtkPolyLineRepresentation)
 
void BuildRepresentation () override
 Build the representation for the angle measurement. More...
 
void SetRenderer (vtkRenderer *ren) override
 Set the renderer for this representation. More...
 
double GetAngle ()
 Calculate the angle formed by the three handles. More...
 
 vtkGetObjectMacro (AngleLabelActor, vtkTextActor)
 Get the angle label actor for custom styling. More...
 
 vtkGetObjectMacro (AngleArcActor, vtkActor2D)
 Get the angle arc actor for custom styling. More...
 
void ReleaseGraphicsResources (vtkWindow *w) override
 Release graphics resources. More...
 
void GetActors2D (vtkPropCollection *pc) override
 Render the angle representation. More...
 
int RenderOverlay (vtkViewport *viewport) override
 
int RenderOpaqueGeometry (vtkViewport *viewport) override
 
int RenderTranslucentPolygonalGeometry (vtkViewport *viewport) override
 
vtkTypeBool HasTranslucentPolygonalGeometry () override
 
void SetPoint1WorldPosition (double pos[3])
 Compatibility API for vtkAngleRepresentation. More...
 
void GetPoint1WorldPosition (double pos[3])
 
void SetPoint1DisplayPosition (double pos[3])
 
void GetPoint1DisplayPosition (double pos[3])
 
void SetCenterWorldPosition (double pos[3])
 
void GetCenterWorldPosition (double pos[3])
 
void SetCenterDisplayPosition (double pos[3])
 
void GetCenterDisplayPosition (double pos[3])
 
void SetPoint2WorldPosition (double pos[3])
 
void GetPoint2WorldPosition (double pos[3])
 
void SetPoint2DisplayPosition (double pos[3])
 
void GetPoint2DisplayPosition (double pos[3])
 
vtkHandleRepresentation * GetPoint1Representation ()
 Compatibility: Get handle representations. More...
 
vtkHandleRepresentation * GetCenterRepresentation ()
 
vtkHandleRepresentation * GetPoint2Representation ()
 
void InstantiateHandleRepresentation ()
 Compatibility: Instantiate handle representations. More...
 
void SetVisibility (vtkTypeBool visible) override
 Override SetVisibility to also control arc and label actors. More...
 
 vtkSetMacro (ShowAngleLabel, vtkTypeBool)
 Control visibility of the angle label. More...
 
 vtkGetMacro (ShowAngleLabel, vtkTypeBool)
 
 vtkBooleanMacro (ShowAngleLabel, vtkTypeBool)
 
 vtkSetStringMacro (LabelSuffix)
 Set/Get angle label suffix (e.g., " #1", " #2") More...
 
 vtkGetStringMacro (LabelSuffix)
 
 vtkSetMacro (ShowAngleArc, vtkTypeBool)
 Control visibility of the angle arc. More...
 
 vtkGetMacro (ShowAngleArc, vtkTypeBool)
 
 vtkBooleanMacro (ShowAngleArc, vtkTypeBool)
 
 vtkSetClampMacro (ArcRadius, double, 0.0, VTK_DOUBLE_MAX)
 Set/Get the radius of the angle arc. More...
 
 vtkGetMacro (ArcRadius, double)
 

Static Public Member Functions

static cvConstrainedPolyLineRepresentationNew ()
 

Protected Member Functions

 cvConstrainedPolyLineRepresentation ()
 
 ~cvConstrainedPolyLineRepresentation () override
 
void BuildAngleArc ()
 Build the angle arc geometry. More...
 

Protected Attributes

vtkTypeBool ShowAngleLabel
 
vtkTypeBool ShowAngleArc
 
double ArcRadius
 
double Angle
 
char * LabelSuffix
 
vtkTextActor * AngleLabelActor
 
vtkActor2D * AngleArcActor
 
vtkPolyDataMapper2D * AngleArcMapper
 
vtkPolyData * AngleArcPolyData
 

Detailed Description

Extended PolyLineRepresentation adding angle display functionality.

This extends vtkPolyLineRepresentation to add angle visualization for 3-point angle measurement (Point1-Center-Point2), following ParaView's approach.

Key features:

  1. XYZ constraint support (inherited from vtkPolyLineRepresentation)
  2. Angle calculation and display (custom functionality)
  3. Arc visualization between the two rays (custom functionality)
Note
This is used with 3 handles configured for angle measurement: Handle 0: Point1 Handle 1: Center (vertex of the angle) Handle 2: Point2

Definition at line 35 of file cvConstrainedPolyLineRepresentation.h.

Constructor & Destructor Documentation

◆ cvConstrainedPolyLineRepresentation()

cvConstrainedPolyLineRepresentation::cvConstrainedPolyLineRepresentation ( )
protected

◆ ~cvConstrainedPolyLineRepresentation()

cvConstrainedPolyLineRepresentation::~cvConstrainedPolyLineRepresentation ( )
overrideprotected

Member Function Documentation

◆ BuildAngleArc()

void cvConstrainedPolyLineRepresentation::BuildAngleArc ( )
protected

Build the angle arc geometry.

Definition at line 316 of file cvConstrainedPolyLineRepresentation.cpp.

References a, AngleArcPolyData, ArcRadius, and e.

Referenced by BuildRepresentation().

◆ BuildRepresentation()

void cvConstrainedPolyLineRepresentation::BuildRepresentation ( )
override

Build the representation for the angle measurement.

Extends parent's BuildRepresentation to add:

  • Angle calculation from 3 points
  • Arc visualization
  • Angle label display

Definition at line 123 of file cvConstrainedPolyLineRepresentation.cpp.

References Angle, AngleArcActor, AngleLabelActor, ArcRadius, BuildAngleArc(), GetAngle(), LabelSuffix, ShowAngleArc, and ShowAngleLabel.

◆ GetActors2D()

void cvConstrainedPolyLineRepresentation::GetActors2D ( vtkPropCollection *  pc)
override

Render the angle representation.

Definition at line 442 of file cvConstrainedPolyLineRepresentation.cpp.

References AngleArcActor, and AngleLabelActor.

◆ GetAngle()

double cvConstrainedPolyLineRepresentation::GetAngle ( )

Calculate the angle formed by the three handles.

Following ParaView pqAnglePropertyWidget::updateLabels() implementation: angle = acos(vec1.dot(vec2) / (|vec1| * |vec2|))

Returns
Angle in degrees

Definition at line 278 of file cvConstrainedPolyLineRepresentation.cpp.

References e.

Referenced by BuildRepresentation().

◆ GetCenterDisplayPosition()

void cvConstrainedPolyLineRepresentation::GetCenterDisplayPosition ( double  pos[3])

Definition at line 549 of file cvConstrainedPolyLineRepresentation.cpp.

◆ GetCenterRepresentation()

vtkHandleRepresentation * cvConstrainedPolyLineRepresentation::GetCenterRepresentation ( )

Definition at line 603 of file cvConstrainedPolyLineRepresentation.cpp.

◆ GetCenterWorldPosition()

void cvConstrainedPolyLineRepresentation::GetCenterWorldPosition ( double  pos[3])
inline

Definition at line 93 of file cvConstrainedPolyLineRepresentation.h.

◆ GetPoint1DisplayPosition()

void cvConstrainedPolyLineRepresentation::GetPoint1DisplayPosition ( double  pos[3])

Definition at line 519 of file cvConstrainedPolyLineRepresentation.cpp.

◆ GetPoint1Representation()

vtkHandleRepresentation * cvConstrainedPolyLineRepresentation::GetPoint1Representation ( )

Compatibility: Get handle representations.

These provide access to individual handle representations for direct manipulation if needed.

Definition at line 595 of file cvConstrainedPolyLineRepresentation.cpp.

◆ GetPoint1WorldPosition()

void cvConstrainedPolyLineRepresentation::GetPoint1WorldPosition ( double  pos[3])
inline

Definition at line 84 of file cvConstrainedPolyLineRepresentation.h.

◆ GetPoint2DisplayPosition()

void cvConstrainedPolyLineRepresentation::GetPoint2DisplayPosition ( double  pos[3])

Definition at line 579 of file cvConstrainedPolyLineRepresentation.cpp.

◆ GetPoint2Representation()

vtkHandleRepresentation * cvConstrainedPolyLineRepresentation::GetPoint2Representation ( )

Definition at line 608 of file cvConstrainedPolyLineRepresentation.cpp.

◆ GetPoint2WorldPosition()

void cvConstrainedPolyLineRepresentation::GetPoint2WorldPosition ( double  pos[3])
inline

Definition at line 102 of file cvConstrainedPolyLineRepresentation.h.

◆ HasTranslucentPolygonalGeometry()

vtkTypeBool cvConstrainedPolyLineRepresentation::HasTranslucentPolygonalGeometry ( )
override

Definition at line 497 of file cvConstrainedPolyLineRepresentation.cpp.

◆ InstantiateHandleRepresentation()

void cvConstrainedPolyLineRepresentation::InstantiateHandleRepresentation ( )
inline

Compatibility: Instantiate handle representations.

This is called automatically when SetNumberOfHandles is called, but we provide it for API compatibility.

Definition at line 124 of file cvConstrainedPolyLineRepresentation.h.

◆ New()

static cvConstrainedPolyLineRepresentation* cvConstrainedPolyLineRepresentation::New ( )
static

◆ ReleaseGraphicsResources()

void cvConstrainedPolyLineRepresentation::ReleaseGraphicsResources ( vtkWindow *  w)
override

Release graphics resources.

Definition at line 455 of file cvConstrainedPolyLineRepresentation.cpp.

References AngleArcActor, and AngleLabelActor.

◆ RenderOpaqueGeometry()

int cvConstrainedPolyLineRepresentation::RenderOpaqueGeometry ( vtkViewport *  viewport)
override

Definition at line 479 of file cvConstrainedPolyLineRepresentation.cpp.

References AngleArcActor, count, and ShowAngleArc.

◆ RenderOverlay()

int cvConstrainedPolyLineRepresentation::RenderOverlay ( vtkViewport *  viewport)
override

◆ RenderTranslucentPolygonalGeometry()

int cvConstrainedPolyLineRepresentation::RenderTranslucentPolygonalGeometry ( vtkViewport *  viewport)
override

Definition at line 490 of file cvConstrainedPolyLineRepresentation.cpp.

References count.

◆ SetCenterDisplayPosition()

void cvConstrainedPolyLineRepresentation::SetCenterDisplayPosition ( double  pos[3])

Definition at line 533 of file cvConstrainedPolyLineRepresentation.cpp.

◆ SetCenterWorldPosition()

void cvConstrainedPolyLineRepresentation::SetCenterWorldPosition ( double  pos[3])
inline

Definition at line 90 of file cvConstrainedPolyLineRepresentation.h.

◆ SetPoint1DisplayPosition()

void cvConstrainedPolyLineRepresentation::SetPoint1DisplayPosition ( double  pos[3])

Definition at line 502 of file cvConstrainedPolyLineRepresentation.cpp.

◆ SetPoint1WorldPosition()

void cvConstrainedPolyLineRepresentation::SetPoint1WorldPosition ( double  pos[3])
inline

Compatibility API for vtkAngleRepresentation.

These methods provide the same interface as vtkAngleRepresentation for easier integration with existing code.

Mapping:

  • Point1 → Handle 0
  • Center → Handle 1 (vertex of the angle)
  • Point2 → Handle 2

Definition at line 81 of file cvConstrainedPolyLineRepresentation.h.

◆ SetPoint2DisplayPosition()

void cvConstrainedPolyLineRepresentation::SetPoint2DisplayPosition ( double  pos[3])

Definition at line 563 of file cvConstrainedPolyLineRepresentation.cpp.

◆ SetPoint2WorldPosition()

void cvConstrainedPolyLineRepresentation::SetPoint2WorldPosition ( double  pos[3])
inline

Definition at line 99 of file cvConstrainedPolyLineRepresentation.h.

◆ SetRenderer()

void cvConstrainedPolyLineRepresentation::SetRenderer ( vtkRenderer *  ren)
override

Set the renderer for this representation.

Override to ensure our custom 2D actors (angle label and arc) are properly added to the renderer.

Definition at line 98 of file cvConstrainedPolyLineRepresentation.cpp.

References AngleArcActor, and AngleLabelActor.

◆ SetVisibility()

void cvConstrainedPolyLineRepresentation::SetVisibility ( vtkTypeBool  visible)
override

Override SetVisibility to also control arc and label actors.

Definition at line 420 of file cvConstrainedPolyLineRepresentation.cpp.

References AngleArcActor, AngleLabelActor, ShowAngleArc, and ShowAngleLabel.

◆ vtkBooleanMacro() [1/2]

cvConstrainedPolyLineRepresentation::vtkBooleanMacro ( ShowAngleArc  ,
vtkTypeBool   
)

◆ vtkBooleanMacro() [2/2]

cvConstrainedPolyLineRepresentation::vtkBooleanMacro ( ShowAngleLabel  ,
vtkTypeBool   
)

◆ vtkGetMacro() [1/3]

cvConstrainedPolyLineRepresentation::vtkGetMacro ( ArcRadius  ,
double   
)

◆ vtkGetMacro() [2/3]

cvConstrainedPolyLineRepresentation::vtkGetMacro ( ShowAngleArc  ,
vtkTypeBool   
)

◆ vtkGetMacro() [3/3]

cvConstrainedPolyLineRepresentation::vtkGetMacro ( ShowAngleLabel  ,
vtkTypeBool   
)

◆ vtkGetObjectMacro() [1/2]

cvConstrainedPolyLineRepresentation::vtkGetObjectMacro ( AngleArcActor  ,
vtkActor2D   
)

Get the angle arc actor for custom styling.

◆ vtkGetObjectMacro() [2/2]

cvConstrainedPolyLineRepresentation::vtkGetObjectMacro ( AngleLabelActor  ,
vtkTextActor   
)

Get the angle label actor for custom styling.

◆ vtkGetStringMacro()

cvConstrainedPolyLineRepresentation::vtkGetStringMacro ( LabelSuffix  )

◆ vtkSetClampMacro()

cvConstrainedPolyLineRepresentation::vtkSetClampMacro ( ArcRadius  ,
double  ,
0.  0,
VTK_DOUBLE_MAX   
)

Set/Get the radius of the angle arc.

◆ vtkSetMacro() [1/2]

cvConstrainedPolyLineRepresentation::vtkSetMacro ( ShowAngleArc  ,
vtkTypeBool   
)

Control visibility of the angle arc.

◆ vtkSetMacro() [2/2]

cvConstrainedPolyLineRepresentation::vtkSetMacro ( ShowAngleLabel  ,
vtkTypeBool   
)

Control visibility of the angle label.

◆ vtkSetStringMacro()

cvConstrainedPolyLineRepresentation::vtkSetStringMacro ( LabelSuffix  )

Set/Get angle label suffix (e.g., " #1", " #2")

◆ vtkTypeMacro()

cvConstrainedPolyLineRepresentation::vtkTypeMacro ( cvConstrainedPolyLineRepresentation  ,
vtkPolyLineRepresentation   
)

Member Data Documentation

◆ Angle

double cvConstrainedPolyLineRepresentation::Angle
protected

Definition at line 206 of file cvConstrainedPolyLineRepresentation.h.

Referenced by BuildRepresentation().

◆ AngleArcActor

◆ AngleArcMapper

vtkPolyDataMapper2D* cvConstrainedPolyLineRepresentation::AngleArcMapper
protected

◆ AngleArcPolyData

vtkPolyData* cvConstrainedPolyLineRepresentation::AngleArcPolyData
protected

◆ AngleLabelActor

◆ ArcRadius

double cvConstrainedPolyLineRepresentation::ArcRadius
protected

Definition at line 205 of file cvConstrainedPolyLineRepresentation.h.

Referenced by BuildAngleArc(), and BuildRepresentation().

◆ LabelSuffix

char* cvConstrainedPolyLineRepresentation::LabelSuffix
protected

◆ ShowAngleArc

vtkTypeBool cvConstrainedPolyLineRepresentation::ShowAngleArc
protected

◆ ShowAngleLabel

vtkTypeBool cvConstrainedPolyLineRepresentation::ShowAngleLabel
protected

The documentation for this class was generated from the following files: