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

Graphical segmentation mechanism (with polyline) More...

#include <ecvGraphicalSegmentationTool.h>

Inheritance diagram for ccGraphicalSegmentationTool:
Collaboration diagram for ccGraphicalSegmentationTool:

Public Member Functions

 ccGraphicalSegmentationTool (QWidget *parent)
 Default constructor. More...
 
virtual ~ccGraphicalSegmentationTool ()
 Destructor. More...
 
bool addEntity (ccHObject *anObject, bool silent=false)
 Adds an entity (and/or its children) to the 'to be segmented' pool. More...
 
unsigned getNumberOfValidEntities () const
 
ccPolylinegetPolyLine ()
 Get a pointer to the polyline that has been segmented. More...
 
QSet< ccHObject * > & entities ()
 Returns the active 'to be segmented' set. More...
 
const QSet< ccHObject * > & entities () const
 Returns the active 'to be segmented' set (const version) More...
 
virtual bool linkWith (QWidget *win) override
 Links the overlay dialog with a MDI window. More...
 
virtual bool start () override
 Starts process. More...
 
virtual void stop (bool accepted) override
 Stops process/dialog. More...
 
bool deleteHiddenParts () const
 Returns whether hidden parts should be delete after segmentation. More...
 
void removeAllEntities ()
 Remove entities from the 'to be segmented' pool. More...
 
bool applySegmentation (ecvMainAppInterface *app, ccHObject::Container &newEntities)
 Apply segmentation and update the database (helper) More...
 
- Public Member Functions inherited from ccOverlayDialog
 ccOverlayDialog (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::FramelessWindowHint|Qt::Tool)
 Default constructor. More...
 
 ~ccOverlayDialog () override
 Destructor. More...
 
void reject () override
 
void addOverridenShortcut (Qt::Key key)
 
bool started () const
 Returns whether the tool is currently started or not. More...
 

Protected Types

enum  ProcessStates {
  POLYLINE = 1 , RECTANGLE = 2 , PAUSED = 32 , STARTED = 64 ,
  RUNNING = 128
}
 Process states. More...
 

Protected Slots

void segmentIn ()
 
void segmentOut ()
 
void segment (bool)
 
void reset ()
 
void apply ()
 
void applyAndDelete ()
 
void cancel ()
 
void addPointToPolyline (int x, int y)
 
void closePolyLine (int x=0, int y=0)
 
void updateSegmentation ()
 
void closeRectangle ()
 
void updatePolyLine (int x, int y, Qt::MouseButtons buttons)
 
void pauseSegmentationMode (bool state, bool only2D=true)
 
void pauseSegmentation (bool state)
 
void resetSegmentation ()
 
void doSetPolylineSelection ()
 
void doSetRectangularSelection ()
 
void doActionUseExistingPolyline ()
 
void doExportSegmentationPolyline ()
 
void onShortcutTriggered (int)
 To capture overridden shortcuts (pause button, etc.) More...
 
void prepareEntityForRemoval (ccHObject *entity, bool unallocateVisibilityArrays)
 Prepare entity before removal. More...
 
void allowPolylineExport (bool state)
 Whether to allow or not to exort the current segmentation polyline. More...
 
- Protected Slots inherited from ccOverlayDialog
virtual void onLinkedWindowDeletion (QObject *object=nullptr)
 Slot called when the linked window is deleted (calls 'onClose') More...
 

Protected Member Functions

void setDrawFlag (bool state=true)
 
- Protected Member Functions inherited from ccOverlayDialog
bool eventFilter (QObject *obj, QEvent *e) override
 

Protected Attributes

QSet< ccHObject * > m_toSegment
 Set of entities to be segmented. More...
 
bool m_somethingHasChanged
 Whether something has changed or not (for proper 'cancel') More...
 
unsigned m_state
 Current process state. More...
 
ccPolylinem_segmentationPoly
 Segmentation polyline. More...
 
ccPointCloudm_polyVertices
 Segmentation polyline vertices. More...
 
bool m_rectangularSelection
 Selection mode. More...
 
bool m_deleteHiddenParts
 Whether to delete hidden parts after segmentation. More...
 
- Protected Attributes inherited from ccOverlayDialog
QWidget * m_associatedWin
 Associated (MDI) window. More...
 
bool m_processing
 Running/processing state. More...
 
QList< int > m_overriddenKeys
 Overridden keys. More...
 

Additional Inherited Members

- Signals inherited from ccOverlayDialog
void processFinished (bool accepted)
 Signal emitted when process is finished. More...
 
void shortcutTriggered (int key)
 Signal emitted when an overridden key shortcut is pressed. More...
 
void shown ()
 Signal emitted when a 'show' event is detected. More...
 

Detailed Description

Graphical segmentation mechanism (with polyline)

Definition at line 27 of file ecvGraphicalSegmentationTool.h.

Member Enumeration Documentation

◆ ProcessStates

Process states.

Enumerator
POLYLINE 
RECTANGLE 
PAUSED 
STARTED 
RUNNING 

Definition at line 118 of file ecvGraphicalSegmentationTool.h.

Constructor & Destructor Documentation

◆ ccGraphicalSegmentationTool()

◆ ~ccGraphicalSegmentationTool()

ccGraphicalSegmentationTool::~ccGraphicalSegmentationTool ( )
virtual

Destructor.

Definition at line 138 of file ecvGraphicalSegmentationTool.cpp.

References m_polyVertices, and m_segmentationPoly.

Member Function Documentation

◆ addEntity()

◆ addPointToPolyline

◆ allowPolylineExport

void ccGraphicalSegmentationTool::allowPolylineExport ( bool  state)
protectedslot

Whether to allow or not to exort the current segmentation polyline.

Definition at line 129 of file ecvGraphicalSegmentationTool.cpp.

Referenced by addPointToPolyline(), ccGraphicalSegmentationTool(), closePolyLine(), closeRectangle(), doActionUseExistingPolyline(), pauseSegmentationMode(), start(), and updatePolyLine().

◆ apply

void ccGraphicalSegmentationTool::apply ( )
protectedslot

Definition at line 1065 of file ecvGraphicalSegmentationTool.cpp.

References m_deleteHiddenParts, and stop().

Referenced by ccGraphicalSegmentationTool().

◆ applyAndDelete

void ccGraphicalSegmentationTool::applyAndDelete ( )
protectedslot

Definition at line 1070 of file ecvGraphicalSegmentationTool.cpp.

References m_deleteHiddenParts, and stop().

Referenced by ccGraphicalSegmentationTool().

◆ applySegmentation()

bool ccGraphicalSegmentationTool::applySegmentation ( ecvMainAppInterface app,
ccHObject::Container newEntities 
)

Apply segmentation and update the database (helper)

Definition at line 1130 of file ecvGraphicalSegmentationTool.cpp.

References ccHObject::addChild(), ecvMainAppInterface::addToDB(), ccGBLSensor::clearDepthBuffer(), ccGenericPointCloud::createNewCloudFromVisibilitySelection(), ccMesh::createNewMeshFromSelection(), ccPolyline::createNewPolylinesFromSelection(), ecvMainAppInterface::dbRootObject(), cc2DLabel::PickedPoint::entity(), CVLog::Error(), ccHObject::filterChildren(), CV_TYPES::GBL_SENSOR, cloudViewer::ReferenceCloud::getAssociatedCloud(), ccGenericMesh::getAssociatedCloud(), ccObject::getName(), ccHObject::getParent(), cc2DLabel::getPickedPoint(), ccObject::isA(), ccHObject::isAncestorOf(), ccGenericMesh::IsCloudVerticesOfMesh(), ccPolyline::IsCloudVerticesOfPolyline(), ccObject::isKindOf(), ccObject::isLocked(), CV_TYPES::LABEL_2D, m_deleteHiddenParts, m_toSegment, CV_TYPES::MESH, ecvMainAppInterface::ccHObjectContext::parent, CV_TYPES::POINT_CLOUD, CV_TYPES::POLY_LINE, prepareEntityForRemoval(), ecvMainAppInterface::putObjectBackIntoDBTree(), removeAllEntities(), ccHObject::removeChild(), ecvMainAppInterface::removeObjectTemporarilyFromDBTree(), RemoveUnusedLabelsAndUpdateTheOthers(), ccObject::setName(), cc2DLabel::size(), cloudViewer::GenericCloud::size(), cloudViewer::GenericMesh::size(), cloudViewer::ReferenceCloud::size(), ccMesh::size(), ccHObjectCaster::ToGBLSensor(), ccHObjectCaster::ToGenericMesh(), ccHObjectCaster::ToGenericPointCloud(), ccHObjectCaster::ToMesh(), and CVLog::Warning().

◆ cancel

void ccGraphicalSegmentationTool::cancel ( )
protectedslot

Definition at line 1075 of file ecvGraphicalSegmentationTool.cpp.

References m_deleteHiddenParts, reset(), and stop().

Referenced by ccGraphicalSegmentationTool().

◆ closePolyLine

◆ closeRectangle

◆ deleteHiddenParts()

bool ccGraphicalSegmentationTool::deleteHiddenParts ( ) const
inline

Returns whether hidden parts should be delete after segmentation.

Definition at line 62 of file ecvGraphicalSegmentationTool.h.

References m_deleteHiddenParts.

◆ doActionUseExistingPolyline

◆ doExportSegmentationPolyline

◆ doSetPolylineSelection

◆ doSetRectangularSelection

◆ entities() [1/2]

QSet<ccHObject*>& ccGraphicalSegmentationTool::entities ( )
inline

Returns the active 'to be segmented' set.

Definition at line 52 of file ecvGraphicalSegmentationTool.h.

References m_toSegment.

◆ entities() [2/2]

const QSet<ccHObject*>& ccGraphicalSegmentationTool::entities ( ) const
inline

Returns the active 'to be segmented' set (const version)

Definition at line 54 of file ecvGraphicalSegmentationTool.h.

References m_toSegment.

◆ getNumberOfValidEntities()

unsigned ccGraphicalSegmentationTool::getNumberOfValidEntities ( ) const

Returns the number of entites currently in the the 'to be segmented' pool

Definition at line 454 of file ecvGraphicalSegmentationTool.cpp.

References m_toSegment.

◆ getPolyLine()

ccPolyline* ccGraphicalSegmentationTool::getPolyLine ( )
inline

Get a pointer to the polyline that has been segmented.

Definition at line 49 of file ecvGraphicalSegmentationTool.h.

References m_segmentationPoly.

◆ linkWith()

bool ccGraphicalSegmentationTool::linkWith ( QWidget *  win)
overridevirtual

Links the overlay dialog with a MDI window.

Warning: link can't be modified while dialog is displayed/process is running!

Returns
success

Reimplemented from ccOverlayDialog.

Definition at line 183 of file ecvGraphicalSegmentationTool.cpp.

References addPointToPolyline(), closePolyLine(), closeRectangle(), ccOverlayDialog::linkWith(), m_segmentationPoly, ecvDisplayTools::TheInstance(), and updatePolyLine().

◆ onShortcutTriggered

void ccGraphicalSegmentationTool::onShortcutTriggered ( int  key)
protectedslot

To capture overridden shortcuts (pause button, etc.)

Definition at line 146 of file ecvGraphicalSegmentationTool.cpp.

References doSetPolylineSelection(), doSetRectangularSelection(), and m_rectangularSelection.

Referenced by ccGraphicalSegmentationTool().

◆ pauseSegmentation

void ccGraphicalSegmentationTool::pauseSegmentation ( bool  state)
inlineprotectedslot

Definition at line 91 of file ecvGraphicalSegmentationTool.h.

References pauseSegmentationMode().

Referenced by ccGraphicalSegmentationTool().

◆ pauseSegmentationMode

◆ prepareEntityForRemoval

void ccGraphicalSegmentationTool::prepareEntityForRemoval ( ccHObject entity,
bool  unallocateVisibilityArrays 
)
protectedslot

◆ removeAllEntities()

void ccGraphicalSegmentationTool::removeAllEntities ( )

Remove entities from the 'to be segmented' pool.

Warning
'unallocateVisibilityArray' will be called on all point clouds prior to be removed from the pool.

Definition at line 264 of file ecvGraphicalSegmentationTool.cpp.

References m_toSegment, prepareEntityForRemoval(), and setDrawFlag().

Referenced by applySegmentation().

◆ reset

◆ resetSegmentation

void ccGraphicalSegmentationTool::resetSegmentation ( )
protectedslot

◆ segment

◆ segmentIn

void ccGraphicalSegmentationTool::segmentIn ( )
protectedslot

Definition at line 656 of file ecvGraphicalSegmentationTool.cpp.

References segment().

Referenced by ccGraphicalSegmentationTool().

◆ segmentOut

void ccGraphicalSegmentationTool::segmentOut ( )
protectedslot

Definition at line 658 of file ecvGraphicalSegmentationTool.cpp.

References segment().

Referenced by ccGraphicalSegmentationTool().

◆ setDrawFlag()

void ccGraphicalSegmentationTool::setDrawFlag ( bool  state = true)
protected

Definition at line 295 of file ecvGraphicalSegmentationTool.cpp.

References m_toSegment.

Referenced by removeAllEntities(), reset(), and segment().

◆ start()

◆ stop()

void ccGraphicalSegmentationTool::stop ( bool  accepted)
overridevirtual

◆ updatePolyLine

◆ updateSegmentation

Member Data Documentation

◆ m_deleteHiddenParts

bool ccGraphicalSegmentationTool::m_deleteHiddenParts
protected

Whether to delete hidden parts after segmentation.

Definition at line 141 of file ecvGraphicalSegmentationTool.h.

Referenced by apply(), applyAndDelete(), applySegmentation(), cancel(), and deleteHiddenParts().

◆ m_polyVertices

ccPointCloud* ccGraphicalSegmentationTool::m_polyVertices
protected

◆ m_rectangularSelection

bool ccGraphicalSegmentationTool::m_rectangularSelection
protected

◆ m_segmentationPoly

◆ m_somethingHasChanged

bool ccGraphicalSegmentationTool::m_somethingHasChanged
protected

Whether something has changed or not (for proper 'cancel')

Definition at line 115 of file ecvGraphicalSegmentationTool.h.

Referenced by reset(), segment(), and start().

◆ m_state

unsigned ccGraphicalSegmentationTool::m_state
protected

◆ m_toSegment

QSet<ccHObject*> ccGraphicalSegmentationTool::m_toSegment
protected

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