ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cvGenericMeasurementTool Class Referenceabstract

#include <cvGenericMeasurementTool.h>

Inheritance diagram for cvGenericMeasurementTool:
[legend]
Collaboration diagram for cvGenericMeasurementTool:
[legend]

Signals

void measurementValueChanged ()
 Signal sent when the measurement value changes. More...
 
void pointPickingRequested (int pointIndex)
 
void pointPickingCancelled ()
 Signal sent when point picking is cancelled. More...
 

Public Member Functions

 cvGenericMeasurementTool (QWidget *parent=nullptr)
 
virtual ~cvGenericMeasurementTool ()
 
virtual void start ()
 
virtual void update ()
 
virtual void reset ()
 
virtual ccHObject * getOutput ()
 
virtual bool initModel ()
 
virtual bool setInput (ccHObject *obj)
 
virtual void showWidget (bool state)
 
virtual void clearAllActor ()
 
virtual double getMeasurementValue () const
 Get measurement value (distance or angle) More...
 
virtual void getPoint1 (double pos[3]) const
 Get point 1 coordinates. More...
 
virtual void getPoint2 (double pos[3]) const
 Get point 2 coordinates. More...
 
virtual void getCenter (double pos[3]) const
 Get center point coordinates (for angle/protractor) More...
 
virtual void setPoint1 (double pos[3])
 Set point 1 coordinates. More...
 
virtual void setPoint2 (double pos[3])
 Set point 2 coordinates. More...
 
virtual void setCenter (double pos[3])
 Set center point coordinates (for angle/protractor) More...
 
virtual void setColor (double r, double g, double b)
 Set measurement color (RGB values in range [0.0, 1.0]) More...
 
virtual bool getColor (double &r, double &g, double &b) const
 
virtual void lockInteraction ()
 Lock tool interaction (disable VTK widget interaction and UI controls) More...
 
virtual void unlockInteraction ()
 Unlock tool interaction (enable VTK widget interaction and UI controls) More...
 
virtual void setInstanceLabel (const QString &label)
 Set instance label suffix (e.g., "#1", "#2") for display in 3D view. More...
 
virtual void setFontFamily (const QString &family)
 
virtual void setFontSize (int size)
 Set font size for measurement labels. More...
 
virtual void setBold (bool bold)
 Set font bold state for measurement labels. More...
 
virtual void setItalic (bool italic)
 Set font italic state for measurement labels. More...
 
virtual void setShadow (bool shadow)
 Set font shadow state for measurement labels. More...
 
virtual void setFontOpacity (double opacity)
 Set font opacity for measurement labels (0.0 to 1.0) More...
 
virtual void setFontColor (double r, double g, double b)
 Set font color for measurement labels (RGB values 0.0-1.0) More...
 
virtual void setHorizontalJustification (const QString &justification)
 
virtual void setVerticalJustification (const QString &justification)
 
QString getFontFamily () const
 Get font properties (for UI synchronization) More...
 
int getFontSize () const
 
void getFontColor (double &r, double &g, double &b) const
 
bool getFontBold () const
 
bool getFontItalic () const
 
bool getFontShadow () const
 
double getFontOpacity () const
 
QString getHorizontalJustification () const
 
QString getVerticalJustification () const
 
void setUpViewer (PclUtils::PCLVis *viewer)
 
void setInteractor (vtkRenderWindowInteractor *interactor)
 
vtkRenderWindowInteractor * getInteractor ()
 
vtkRenderer * getRenderer ()
 
void setupShortcuts (QWidget *vtkWidget)
 
void disableShortcuts ()
 Disable all keyboard shortcuts (call before tool destruction) More...
 
void clearPickingCache ()
 

Protected Member Functions

virtual void applyFontProperties ()=0
 
virtual void modelReady ()
 
virtual void dataChanged ()
 
void safeOff (vtkAbstractWidget *widget)
 
virtual void initTool ()
 
virtual void createUi ()
 
virtual void setupPointPickingShortcuts (QWidget *vtkWidget)
 
void updatePickingHelpers ()
 Update point picking helpers with current interactor/renderer. More...
 
void addActor (const vtkSmartPointer< vtkProp > actor)
 
void removeActor (const vtkSmartPointer< vtkProp > actor)
 

Protected Attributes

Ui::GenericMeasurementToolDlg * m_ui = nullptr
 
std::string m_id
 
ccHObject * m_entity = nullptr
 
PclUtils::PCLVis * m_viewer = nullptr
 
vtkRenderWindowInteractor * m_interactor = nullptr
 
vtkRenderer * m_renderer = nullptr
 
vtkSmartPointer< vtkActor > m_modelActor
 
QList< cvPointPickingHelper * > m_pickingHelpers
 List of point picking helpers for keyboard shortcuts. More...
 
QWidget * m_vtkWidget = nullptr
 VTK widget reference for creating shortcuts (saved from linkWith) More...
 
QString m_fontFamily = "Arial"
 Font properties for measurement labels (shared by all tools) More...
 
int m_fontSize = 6
 
double m_fontColor [3] = {1.0, 1.0, 1.0}
 
bool m_fontBold = false
 
bool m_fontItalic = false
 
bool m_fontShadow = true
 
double m_fontOpacity = 1.0
 
QString m_horizontalJustification = "Left"
 
QString m_verticalJustification = "Bottom"
 

Constructor & Destructor Documentation

◆ cvGenericMeasurementTool()

cvGenericMeasurementTool::cvGenericMeasurementTool ( QWidget *  parent = nullptr)
explicit

◆ ~cvGenericMeasurementTool()

cvGenericMeasurementTool::~cvGenericMeasurementTool ( )
virtual

Member Function Documentation

◆ addActor()

void cvGenericMeasurementTool::addActor ( const vtkSmartPointer< vtkProp >  actor)
protected

References m_renderer.

◆ applyFontProperties()

virtual void cvGenericMeasurementTool::applyFontProperties ( )
protectedpure virtual

Apply font properties to VTK text properties Must be implemented by derived classes to apply to their specific VTK actors

Referenced by setBold(), setFontColor(), setFontFamily(), setFontOpacity(), setFontSize(), setHorizontalJustification(), setItalic(), setShadow(), and setVerticalJustification().

◆ clearAllActor()

void cvGenericMeasurementTool::clearAllActor ( )
virtual

◆ clearPickingCache()

void cvGenericMeasurementTool::clearPickingCache ( )

Clear selection cache in all picking helpers (call when scene/camera changes)

References m_pickingHelpers.

Referenced by PclMeasurementTools::clearPickingCache(), start(), and update().

◆ createUi()

virtual void cvGenericMeasurementTool::createUi ( )
inlineprotectedvirtual

Reimplemented in cvProtractorTool, cvDistanceTool, and cvContourTool.

Referenced by start().

◆ dataChanged()

virtual void cvGenericMeasurementTool::dataChanged ( )
inlineprotectedvirtual

Referenced by start().

◆ disableShortcuts()

void cvGenericMeasurementTool::disableShortcuts ( )

◆ getCenter()

virtual void cvGenericMeasurementTool::getCenter ( double  pos[3]) const
inlinevirtual

Get center point coordinates (for angle/protractor)

Reimplemented in cvProtractorTool.

Referenced by PclMeasurementTools::getCenter().

◆ getColor()

virtual bool cvGenericMeasurementTool::getColor ( double &  r,
double &  g,
double &  b 
) const
inlinevirtual

Get measurement color (RGB values in range [0.0, 1.0]) Returns false if not implemented, true if color is retrieved

Reimplemented in cvProtractorTool, cvDistanceTool, and cvContourTool.

Referenced by PclMeasurementTools::getColor().

◆ getFontBold()

bool cvGenericMeasurementTool::getFontBold ( ) const
inline

References m_fontBold.

Referenced by PclMeasurementTools::getFontBold().

◆ getFontColor()

void cvGenericMeasurementTool::getFontColor ( double &  r,
double &  g,
double &  b 
) const
inline

◆ getFontFamily()

QString cvGenericMeasurementTool::getFontFamily ( ) const
inline

Get font properties (for UI synchronization)

References m_fontFamily.

Referenced by PclMeasurementTools::getFontFamily().

◆ getFontItalic()

bool cvGenericMeasurementTool::getFontItalic ( ) const
inline

◆ getFontOpacity()

double cvGenericMeasurementTool::getFontOpacity ( ) const
inline

◆ getFontShadow()

bool cvGenericMeasurementTool::getFontShadow ( ) const
inline

◆ getFontSize()

int cvGenericMeasurementTool::getFontSize ( ) const
inline

References m_fontSize.

Referenced by PclMeasurementTools::getFontSize().

◆ getHorizontalJustification()

QString cvGenericMeasurementTool::getHorizontalJustification ( ) const
inline

◆ getInteractor()

vtkRenderWindowInteractor* cvGenericMeasurementTool::getInteractor ( )
inline

References m_interactor.

◆ getMeasurementValue()

virtual double cvGenericMeasurementTool::getMeasurementValue ( ) const
inlinevirtual

Get measurement value (distance or angle)

Reimplemented in cvProtractorTool, and cvDistanceTool.

Referenced by PclMeasurementTools::getMeasurementValue().

◆ getOutput()

ccHObject * cvGenericMeasurementTool::getOutput ( )
virtual

◆ getPoint1()

virtual void cvGenericMeasurementTool::getPoint1 ( double  pos[3]) const
inlinevirtual

Get point 1 coordinates.

Reimplemented in cvProtractorTool, and cvDistanceTool.

Referenced by PclMeasurementTools::getPoint1().

◆ getPoint2()

virtual void cvGenericMeasurementTool::getPoint2 ( double  pos[3]) const
inlinevirtual

Get point 2 coordinates.

Reimplemented in cvProtractorTool, and cvDistanceTool.

Referenced by PclMeasurementTools::getPoint2().

◆ getRenderer()

vtkRenderer* cvGenericMeasurementTool::getRenderer ( )
inline

References m_renderer.

◆ getVerticalJustification()

QString cvGenericMeasurementTool::getVerticalJustification ( ) const
inline

◆ initModel()

bool cvGenericMeasurementTool::initModel ( )
virtual

◆ initTool()

virtual void cvGenericMeasurementTool::initTool ( )
inlineprotectedvirtual

Reimplemented in cvProtractorTool, cvDistanceTool, and cvContourTool.

Referenced by start().

◆ lockInteraction()

virtual void cvGenericMeasurementTool::lockInteraction ( )
inlinevirtual

Lock tool interaction (disable VTK widget interaction and UI controls)

Reimplemented in cvProtractorTool, cvDistanceTool, and cvContourTool.

Referenced by PclMeasurementTools::lockInteraction().

◆ measurementValueChanged

void cvGenericMeasurementTool::measurementValueChanged ( )
signal

Signal sent when the measurement value changes.

Referenced by PclMeasurementTools::initialize(), cvDistanceTool::reset(), cvContourTool::reset(), and cvProtractorTool::reset().

◆ modelReady()

void cvGenericMeasurementTool::modelReady ( )
protectedvirtual

Referenced by start().

◆ pointPickingCancelled

void cvGenericMeasurementTool::pointPickingCancelled ( )
signal

Signal sent when point picking is cancelled.

Referenced by PclMeasurementTools::initialize().

◆ pointPickingRequested

void cvGenericMeasurementTool::pointPickingRequested ( int  pointIndex)
signal

Signal sent when point picking is requested

Parameters
pointIndex1=point1, 2=point2, 3=center

Referenced by PclMeasurementTools::initialize().

◆ removeActor()

void cvGenericMeasurementTool::removeActor ( const vtkSmartPointer< vtkProp >  actor)
protected

References m_renderer.

◆ reset()

void cvGenericMeasurementTool::reset ( )
virtual

◆ safeOff()

void cvGenericMeasurementTool::safeOff ( vtkAbstractWidget *  widget)
protected

◆ setBold()

void cvGenericMeasurementTool::setBold ( bool  bold)
virtual

Set font bold state for measurement labels.

References applyFontProperties(), and m_fontBold.

Referenced by PclMeasurementTools::setBold().

◆ setCenter()

virtual void cvGenericMeasurementTool::setCenter ( double  pos[3])
inlinevirtual

Set center point coordinates (for angle/protractor)

Reimplemented in cvProtractorTool.

Referenced by PclMeasurementTools::setCenter().

◆ setColor()

virtual void cvGenericMeasurementTool::setColor ( double  r,
double  g,
double  b 
)
inlinevirtual

Set measurement color (RGB values in range [0.0, 1.0])

Reimplemented in cvProtractorTool, cvDistanceTool, and cvContourTool.

Referenced by PclMeasurementTools::setColor().

◆ setFontColor()

void cvGenericMeasurementTool::setFontColor ( double  r,
double  g,
double  b 
)
virtual

Set font color for measurement labels (RGB values 0.0-1.0)

References applyFontProperties(), and m_fontColor.

Referenced by PclMeasurementTools::setFontColor().

◆ setFontFamily()

void cvGenericMeasurementTool::setFontFamily ( const QString &  family)
virtual

Set font family for measurement labels (e.g., "Arial", "Times New Roman")

References applyFontProperties(), and m_fontFamily.

Referenced by PclMeasurementTools::setFontFamily().

◆ setFontOpacity()

void cvGenericMeasurementTool::setFontOpacity ( double  opacity)
virtual

Set font opacity for measurement labels (0.0 to 1.0)

References applyFontProperties(), and m_fontOpacity.

Referenced by PclMeasurementTools::setFontOpacity().

◆ setFontSize()

void cvGenericMeasurementTool::setFontSize ( int  size)
virtual

Set font size for measurement labels.

References applyFontProperties(), m_fontSize, and size.

Referenced by PclMeasurementTools::setFontSize().

◆ setHorizontalJustification()

void cvGenericMeasurementTool::setHorizontalJustification ( const QString &  justification)
virtual

Set horizontal justification for measurement labels ("Left", "Center", "Right")

References applyFontProperties(), and m_horizontalJustification.

Referenced by PclMeasurementTools::setHorizontalJustification().

◆ setInput()

bool cvGenericMeasurementTool::setInput ( ccHObject *  obj)
virtual

◆ setInstanceLabel()

virtual void cvGenericMeasurementTool::setInstanceLabel ( const QString &  label)
inlinevirtual

Set instance label suffix (e.g., "#1", "#2") for display in 3D view.

Reimplemented in cvProtractorTool, cvDistanceTool, and cvContourTool.

Referenced by PclMeasurementTools::setInstanceLabel().

◆ setInteractor()

void cvGenericMeasurementTool::setInteractor ( vtkRenderWindowInteractor *  interactor)

◆ setItalic()

void cvGenericMeasurementTool::setItalic ( bool  italic)
virtual

Set font italic state for measurement labels.

References applyFontProperties(), and m_fontItalic.

Referenced by PclMeasurementTools::setItalic().

◆ setPoint1()

virtual void cvGenericMeasurementTool::setPoint1 ( double  pos[3])
inlinevirtual

Set point 1 coordinates.

Reimplemented in cvProtractorTool, and cvDistanceTool.

Referenced by PclMeasurementTools::setPoint1().

◆ setPoint2()

virtual void cvGenericMeasurementTool::setPoint2 ( double  pos[3])
inlinevirtual

Set point 2 coordinates.

Reimplemented in cvProtractorTool, and cvDistanceTool.

Referenced by PclMeasurementTools::setPoint2().

◆ setShadow()

void cvGenericMeasurementTool::setShadow ( bool  shadow)
virtual

Set font shadow state for measurement labels.

References applyFontProperties(), and m_fontShadow.

Referenced by PclMeasurementTools::setShadow().

◆ setupPointPickingShortcuts()

virtual void cvGenericMeasurementTool::setupPointPickingShortcuts ( QWidget *  vtkWidget)
inlineprotectedvirtual

Setup keyboard shortcuts for point picking Override in derived classes to add specific shortcuts

Parameters
vtkWidgetThe VTK render window widget to bind shortcuts to

Reimplemented in cvProtractorTool, and cvDistanceTool.

Referenced by setupShortcuts().

◆ setupShortcuts()

void cvGenericMeasurementTool::setupShortcuts ( QWidget *  vtkWidget)

◆ setUpViewer()

void cvGenericMeasurementTool::setUpViewer ( PclUtils::PCLVis *  viewer)

◆ setVerticalJustification()

void cvGenericMeasurementTool::setVerticalJustification ( const QString &  justification)
virtual

Set vertical justification for measurement labels ("Top", "Center", "Bottom")

References applyFontProperties(), and m_verticalJustification.

Referenced by PclMeasurementTools::setVerticalJustification().

◆ showWidget()

virtual void cvGenericMeasurementTool::showWidget ( bool  state)
inlinevirtual

◆ start()

◆ unlockInteraction()

virtual void cvGenericMeasurementTool::unlockInteraction ( )
inlinevirtual

Unlock tool interaction (enable VTK widget interaction and UI controls)

Reimplemented in cvProtractorTool, cvDistanceTool, and cvContourTool.

Referenced by PclMeasurementTools::unlockInteraction().

◆ update()

◆ updatePickingHelpers()

void cvGenericMeasurementTool::updatePickingHelpers ( )
protected

Update point picking helpers with current interactor/renderer.

References m_interactor, m_pickingHelpers, and m_renderer.

Referenced by setupShortcuts(), and cvProtractorTool::unlockInteraction().

Member Data Documentation

◆ m_entity

◆ m_fontBold

bool cvGenericMeasurementTool::m_fontBold = false
protected

Referenced by getFontBold(), and setBold().

◆ m_fontColor

double cvGenericMeasurementTool::m_fontColor[3] = {1.0, 1.0, 1.0}
protected

◆ m_fontFamily

QString cvGenericMeasurementTool::m_fontFamily = "Arial"
protected

Font properties for measurement labels (shared by all tools)

Referenced by getFontFamily(), and setFontFamily().

◆ m_fontItalic

bool cvGenericMeasurementTool::m_fontItalic = false
protected

Referenced by getFontItalic(), and setItalic().

◆ m_fontOpacity

double cvGenericMeasurementTool::m_fontOpacity = 1.0
protected

◆ m_fontShadow

bool cvGenericMeasurementTool::m_fontShadow = true
protected

Referenced by getFontShadow(), and setShadow().

◆ m_fontSize

int cvGenericMeasurementTool::m_fontSize = 6
protected

◆ m_horizontalJustification

QString cvGenericMeasurementTool::m_horizontalJustification = "Left"
protected

◆ m_id

std::string cvGenericMeasurementTool::m_id
protected

Referenced by setInput().

◆ m_interactor

◆ m_modelActor

vtkSmartPointer<vtkActor> cvGenericMeasurementTool::m_modelActor
protected

Referenced by clearAllActor().

◆ m_pickingHelpers

◆ m_renderer

◆ m_ui

Ui::GenericMeasurementToolDlg* cvGenericMeasurementTool::m_ui = nullptr
protected

◆ m_verticalJustification

QString cvGenericMeasurementTool::m_verticalJustification = "Bottom"
protected

◆ m_viewer

PclUtils::PCLVis* cvGenericMeasurementTool::m_viewer = nullptr
protected

Referenced by initModel(), setUpViewer(), and update().

◆ m_vtkWidget

QWidget* cvGenericMeasurementTool::m_vtkWidget = nullptr
protected

VTK widget reference for creating shortcuts (saved from linkWith)

Referenced by setupShortcuts(), cvContourTool::unlockInteraction(), cvDistanceTool::unlockInteraction(), and cvProtractorTool::unlockInteraction().


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