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

GUI database tree root. More...

#include <ecvDBRoot.h>

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

Public Slots

void changeSelection (const QItemSelection &selected, const QItemSelection &deselected)
 
void reflectObjectPropChange (ccHObject *obj)
 
void redrawCCObject (ccHObject *object, bool forceRedraw=true)
 
void redrawCCObjectAndChildren (ccHObject *object, bool forceRedraw=true)
 
void updateCCObject (ccHObject *object)
 
void deleteSelectedEntities ()
 
void selectEntity (ccHObject *obj, bool forceAdditiveSelection=false)
 Selects a given entity. More...
 
void selectEntities (std::unordered_set< int > entIDs)
 Selects multiple entities at once (shortcut to the other version) More...
 
void selectEntities (const ccHObject::Container &entities, bool incremental=false)
 Selects multiple entities at once. More...
 

Signals

void selectionChanged ()
 
void dbIsEmpty ()
 
void dbIsNotEmptyAnymore ()
 

Public Member Functions

 ccDBRoot (ccCustomQTreeView *dbTreeWidget, QTreeView *propertiesTreeWidget, QObject *parent=nullptr)
 Default constructor. More...
 
virtual ~ccDBRoot () override
 Destructor. More...
 
void hide ()
 
void show ()
 
ccHObject * getRootEntity ()
 Returns associated root object. More...
 
void hidePropertiesView ()
 Hides properties view. More...
 
void updatePropertiesView ()
 Updates properties view. More...
 
ccPropertiesTreeDelegate * getPropertiesDelegate ()
 Get properties tree delegate. More...
 
void addElement (ccHObject *object, bool autoExpand=true)
 Adds an element to the DB tree. More...
 
void removeElement (ccHObject *object)
 Removes an element from the DB tree. More...
 
void removeElements (ccHObject::Container &objects)
 Removes several elements at once from the DB tree. More...
 
ccHObject * find (int uniqueID) const
 Finds an element in DB. More...
 
int countSelectedEntities (CV_CLASS_ENUM filter=CV_TYPES::OBJECT)
 
size_t getSelectedEntities (ccHObject::Container &selectedEntities, CV_CLASS_ENUM filter=CV_TYPES::OBJECT, dbTreeSelectionInfo *info=nullptr)
 
void expandElement (ccHObject *object, bool state)
 Expands tree at a given node. More...
 
void unselectEntity (ccHObject *obj)
 Unselects a given entity. More...
 
void unselectAllEntities ()
 Unselects all entities. More...
 
void unloadAll ()
 Unloads all entities. More...
 
virtual QVariant data (const QModelIndex &index, int role) const override
 
virtual QModelIndex index (int row, int column, const QModelIndex &parentIndex=QModelIndex()) const override
 
QModelIndex index (ccHObject *object)
 
virtual QModelIndex parent (const QModelIndex &index) const override
 
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
virtual int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
virtual Qt::ItemFlags flags (const QModelIndex &index) const override
 
virtual bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 
virtual Qt::DropActions supportedDropActions () const override
 
virtual bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
 
virtual QMap< int, QVariant > itemData (const QModelIndex &index) const override
 
virtual Qt::DropActions supportedDragActions () const override
 

Protected Types

enum  TOGGLE_PROPERTY {
  TG_ENABLE, TG_VISIBLE, TG_COLOR, TG_SF,
  TG_NORMAL, TG_MATERIAL, TG_3D_NAME
}
 Entity property that can be toggled. More...
 
enum  SortRules { SORT_A2Z, SORT_Z2A, SORT_BY_TYPE }
 Entities sorting schemes. More...
 

Protected Slots

void showContextMenu (const QPoint &)
 
void expandBranch ()
 
void collapseBranch ()
 
void gatherRecursiveInformation ()
 
void sortChildrenAZ ()
 
void sortChildrenZA ()
 
void sortChildrenType ()
 
void selectByTypeAndName ()
 
void exportImages ()
 
void toggleSelectedEntities ()
 
void toggleSelectedEntitiesVisibility ()
 
void toggleSelectedEntitiesColor ()
 
void toggleSelectedEntitiesNormals ()
 
void toggleSelectedEntitiesSF ()
 
void toggleSelectedEntitiesMat ()
 
void toggleSelectedEntities3DName ()
 
void addEmptyGroup ()
 
void alignCameraWithEntityDirect ()
 
void alignCameraWithEntityIndirect ()
 
void enableBubbleViewMode ()
 
void editLabelScalarValue ()
 

Protected Member Functions

void toggleSelectedEntitiesProperty (TOGGLE_PROPERTY prop)
 
void alignCameraWithEntity (bool reverse)
 Aligns the camera with the currently selected entity. More...
 
void showPropertiesView (ccHObject *obj)
 Shows properties view for a given element. More...
 
void sortSelectedEntitiesChildren (SortRules rule)
 Sorts selected entities children. More...
 
void expandOrCollapseHoveredBranch (bool expand)
 Expands or collapses hovered item. More...
 
void selectChildrenByTypeAndName (CV_CLASS_ENUM type, bool typeIsExclusive=true, QString name=QString(), bool nameIsRegex=false)
 Selects objects by type and/or name. More...
 

Protected Attributes

ccHObject * m_treeRoot
 Associated DB root. More...
 
QTreeView * m_dbTreeWidget
 Associated widget for DB tree. More...
 
QTreeView * m_propertiesTreeWidget
 Associated widget for selected entity's properties tree. More...
 
QStandardItemModel * m_propertiesModel
 Selected entity's properties data model. More...
 
ccPropertiesTreeDelegate * m_ccPropDelegate
 Selected entity's properties delegate. More...
 
QAction * m_expandBranch
 Context menu action: expand tree branch. More...
 
QAction * m_collapseBranch
 Context menu action: collapse tree branch. More...
 
QAction * m_gatherInformation
 Context menu action: gather (recursive) information on selected entities. More...
 
QAction * m_sortChildrenAZ
 Context menu action: sort children in alphabetical order. More...
 
QAction * m_sortChildrenZA
 Context menu action: sort children in reverse alphabetical order. More...
 
QAction * m_sortChildrenType
 Context menu action: sort children by type. More...
 
QAction * m_selectByTypeAndName
 Context menu action: select object by type and/or by name. More...
 
QAction * m_exportImages
 Context menu action: export images. More...
 
QAction * m_deleteSelectedEntities
 Context menu action: delete selected entities. More...
 
QAction * m_toggleSelectedEntities
 Context menu action: enabled/disable selected entities. More...
 
QAction * m_toggleSelectedEntitiesVisibility
 Context menu action: hide/show selected entities. More...
 
QAction * m_toggleSelectedEntitiesColor
 Context menu action: hide/show selected entities color. More...
 
QAction * m_toggleSelectedEntitiesNormals
 Context menu action: hide/show selected entities normals. More...
 
QAction * m_toggleSelectedEntitiesMat
 Context menu action: hide/show selected entities materials/textures. More...
 
QAction * m_toggleSelectedEntitiesSF
 Context menu action: hide/show selected entities SF. More...
 
QAction * m_toggleSelectedEntities3DName
 Context menu action: hide/show selected entities 3D name. More...
 
QAction * m_addEmptyGroup
 Context menu action: add empty group. More...
 
QAction * m_alignCameraWithEntity
 Context menu action: use 3-points labels or planes to orient camera. More...
 
QAction * m_alignCameraWithEntityReverse
 Context menu action: reverse of m_alignCameraWithEntity. More...
 
QAction * m_enableBubbleViewMode
 Context menu action: enable bubble-view (on a sensor) More...
 
QAction * m_editLabelScalarValue
 Context menu action: change current scalar value (via a 2D label) More...
 
QPoint m_contextMenuPos
 Last context menu pos. More...
 

Detailed Description

GUI database tree root.

Member Enumeration Documentation

◆ SortRules

enum ccDBRoot::SortRules
protected

Entities sorting schemes.

Enumerator
SORT_A2Z 
SORT_Z2A 
SORT_BY_TYPE 

◆ TOGGLE_PROPERTY

enum ccDBRoot::TOGGLE_PROPERTY
protected

Entity property that can be toggled.

Enumerator
TG_ENABLE 
TG_VISIBLE 
TG_COLOR 
TG_SF 
TG_NORMAL 
TG_MATERIAL 
TG_3D_NAME 

Constructor & Destructor Documentation

◆ ccDBRoot()

◆ ~ccDBRoot()

ccDBRoot::~ccDBRoot ( )
overridevirtual

Destructor.

References m_ccPropDelegate, m_propertiesModel, and m_treeRoot.

Member Function Documentation

◆ addElement()

◆ addEmptyGroup

void ccDBRoot::addEmptyGroup ( )
protectedslot

◆ alignCameraWithEntity()

◆ alignCameraWithEntityDirect

void ccDBRoot::alignCameraWithEntityDirect ( )
inlineprotectedslot

References alignCameraWithEntity().

Referenced by ccDBRoot().

◆ alignCameraWithEntityIndirect

void ccDBRoot::alignCameraWithEntityIndirect ( )
inlineprotectedslot

References alignCameraWithEntity().

Referenced by ccDBRoot().

◆ changeSelection

void ccDBRoot::changeSelection ( const QItemSelection &  selected,
const QItemSelection &  deselected 
)
slot

◆ collapseBranch

void ccDBRoot::collapseBranch ( )
protectedslot

References expandOrCollapseHoveredBranch().

Referenced by ccDBRoot().

◆ columnCount()

int ccDBRoot::columnCount ( const QModelIndex &  parent = QModelIndex()) const
overridevirtual

References parent().

◆ countSelectedEntities()

int ccDBRoot::countSelectedEntities ( CV_CLASS_ENUM  filter = CV_TYPES::OBJECT)

Returns the number of selected entities in DB tree (optionally with a given type)

References ccObject::isKindOf(), m_dbTreeWidget, and CV_TYPES::OBJECT.

◆ data()

◆ dbIsEmpty

void ccDBRoot::dbIsEmpty ( )
signal

◆ dbIsNotEmptyAnymore

void ccDBRoot::dbIsNotEmptyAnymore ( )
signal

Referenced by addElement().

◆ deleteSelectedEntities

◆ dropMimeData()

◆ editLabelScalarValue

◆ enableBubbleViewMode

void ccDBRoot::enableBubbleViewMode ( )
protectedslot

◆ expandBranch

void ccDBRoot::expandBranch ( )
protectedslot

References expandOrCollapseHoveredBranch().

Referenced by ccDBRoot().

◆ expandElement()

void ccDBRoot::expandElement ( ccHObject *  object,
bool  state 
)

Expands tree at a given node.

References ccHObject::getChild(), ccHObject::getChildrenNumber(), index(), and m_dbTreeWidget.

◆ expandOrCollapseHoveredBranch()

void ccDBRoot::expandOrCollapseHoveredBranch ( bool  expand)
protected

Expands or collapses hovered item.

References ccHObject::getChild(), ccHObject::getChildrenNumber(), index(), m_contextMenuPos, and m_dbTreeWidget.

Referenced by collapseBranch(), and expandBranch().

◆ exportImages

◆ find()

ccHObject * ccDBRoot::find ( int  uniqueID) const

Finds an element in DB.

References ccHObject::find(), and m_treeRoot.

Referenced by selectEntities().

◆ flags()

◆ gatherRecursiveInformation

◆ getPropertiesDelegate()

ccPropertiesTreeDelegate* ccDBRoot::getPropertiesDelegate ( )
inline

Get properties tree delegate.

References m_ccPropDelegate.

◆ getRootEntity()

ccHObject * ccDBRoot::getRootEntity ( )

Returns associated root object.

References m_treeRoot.

Referenced by MainWindow::addToDB(), and MainWindow::dbRootObject().

◆ getSelectedEntities()

◆ hide()

void ccDBRoot::hide ( )

◆ hidePropertiesView()

◆ index() [1/2]

QModelIndex ccDBRoot::index ( ccHObject *  object)

References m_treeRoot, and parent().

◆ index() [2/2]

QModelIndex ccDBRoot::index ( int  row,
int  column,
const QModelIndex &  parentIndex = QModelIndex() 
) const
overridevirtual

◆ itemData()

QMap< int, QVariant > ccDBRoot::itemData ( const QModelIndex &  index) const
overridevirtual

References ccObject::getUniqueID(), and index().

◆ parent()

QModelIndex ccDBRoot::parent ( const QModelIndex &  index) const
overridevirtual

◆ redrawCCObject

void ccDBRoot::redrawCCObject ( ccHObject *  object,
bool  forceRedraw = true 
)
slot

Referenced by ccDBRoot().

◆ redrawCCObjectAndChildren

void ccDBRoot::redrawCCObjectAndChildren ( ccHObject *  object,
bool  forceRedraw = true 
)
slot

Referenced by ccDBRoot(), and setData().

◆ reflectObjectPropChange

void ccDBRoot::reflectObjectPropChange ( ccHObject *  obj)
slot

◆ removeElement()

void ccDBRoot::removeElement ( ccHObject *  object)

◆ removeElements()

void ccDBRoot::removeElements ( ccHObject::Container &  objects)

Removes several elements at once from the DB tree.

Faster than multiple calls to removeElement. Automatically calls prepareDisplayForRefresh on the objects.

Warning
The input container will be cleared.

References dbIsEmpty(), ccHObject::getChildrenNumber(), hidePropertiesView(), index(), m_treeRoot, parent(), updatePropertiesView(), and CVLog::Warning().

Referenced by ccPointListPickingDlg::applyAndExit(), and ccPointListPickingDlg::cancelAndExit().

◆ rowCount()

int ccDBRoot::rowCount ( const QModelIndex &  parent = QModelIndex()) const
overridevirtual

◆ selectByTypeAndName

◆ selectChildrenByTypeAndName()

void ccDBRoot::selectChildrenByTypeAndName ( CV_CLASS_ENUM  type,
bool  typeIsExclusive = true,
QString  name = QString(),
bool  nameIsRegex = false 
)
protected

◆ selectEntities [1/2]

void ccDBRoot::selectEntities ( const ccHObject::Container &  entities,
bool  incremental = false 
)
slot

Selects multiple entities at once.

Parameters
entitiesset of the entities to 'select'
incrementalwhether to 'add' the input set to the selected entities set or to use it as replacement

References index(), ccObject::isA(), ccDrawableObject::isSelected(), CV_TYPES::LABEL_2D, and m_dbTreeWidget.

◆ selectEntities [2/2]

void ccDBRoot::selectEntities ( std::unordered_set< int >  entIDs)
slot

Selects multiple entities at once (shortcut to the other version)

Parameters
entIDslist of the IDs of the entities to select

References find(), and CVLog::Warning().

Referenced by ecvFilterByLabelDlg::apply(), and selectChildrenByTypeAndName().

◆ selectEntity

void ccDBRoot::selectEntity ( ccHObject *  obj,
bool  forceAdditiveSelection = false 
)
slot

Selects a given entity.

If ctrl is pressed by the user at the same time, previous selection will be simply updated accordingly.

Parameters
objentity to select
forceAdditiveSelectionwhether to force additive selection (just as if CTRL key is pressed) or not

References index(), ccObject::isA(), ccDrawableObject::isSelected(), CV_TYPES::LABEL_2D, m_dbTreeWidget, ccDrawableObject::setSelected(), and CVLog::Warning().

Referenced by MainWindow::setSelectedInDB().

◆ selectionChanged

void ccDBRoot::selectionChanged ( )
signal

Referenced by changeSelection().

◆ setData()

◆ show()

void ccDBRoot::show ( )

◆ showContextMenu

◆ showPropertiesView()

void ccDBRoot::showPropertiesView ( ccHObject *  obj)
protected

◆ sortChildrenAZ

void ccDBRoot::sortChildrenAZ ( )
protectedslot

References SORT_A2Z, and sortSelectedEntitiesChildren().

Referenced by ccDBRoot().

◆ sortChildrenType

void ccDBRoot::sortChildrenType ( )
protectedslot

References SORT_BY_TYPE, and sortSelectedEntitiesChildren().

Referenced by ccDBRoot().

◆ sortChildrenZA

void ccDBRoot::sortChildrenZA ( )
protectedslot

References SORT_Z2A, and sortSelectedEntitiesChildren().

Referenced by ccDBRoot().

◆ sortSelectedEntitiesChildren()

◆ supportedDragActions()

virtual Qt::DropActions ccDBRoot::supportedDragActions ( ) const
inlineoverridevirtual

◆ supportedDropActions()

Qt::DropActions ccDBRoot::supportedDropActions ( ) const
overridevirtual

◆ toggleSelectedEntities

void ccDBRoot::toggleSelectedEntities ( )
inlineprotectedslot

References TG_ENABLE, and toggleSelectedEntitiesProperty().

Referenced by ccDBRoot().

◆ toggleSelectedEntities3DName

void ccDBRoot::toggleSelectedEntities3DName ( )
inlineprotectedslot

References TG_3D_NAME, and toggleSelectedEntitiesProperty().

Referenced by ccDBRoot().

◆ toggleSelectedEntitiesColor

void ccDBRoot::toggleSelectedEntitiesColor ( )
inlineprotectedslot

References TG_COLOR, and toggleSelectedEntitiesProperty().

Referenced by ccDBRoot().

◆ toggleSelectedEntitiesMat

void ccDBRoot::toggleSelectedEntitiesMat ( )
inlineprotectedslot

References TG_MATERIAL, and toggleSelectedEntitiesProperty().

Referenced by ccDBRoot().

◆ toggleSelectedEntitiesNormals

void ccDBRoot::toggleSelectedEntitiesNormals ( )
inlineprotectedslot

References TG_NORMAL, and toggleSelectedEntitiesProperty().

Referenced by ccDBRoot().

◆ toggleSelectedEntitiesProperty()

◆ toggleSelectedEntitiesSF

void ccDBRoot::toggleSelectedEntitiesSF ( )
inlineprotectedslot

References TG_SF, and toggleSelectedEntitiesProperty().

Referenced by ccDBRoot().

◆ toggleSelectedEntitiesVisibility

void ccDBRoot::toggleSelectedEntitiesVisibility ( )
inlineprotectedslot

References TG_VISIBLE, and toggleSelectedEntitiesProperty().

Referenced by ccDBRoot().

◆ unloadAll()

◆ unselectAllEntities()

void ccDBRoot::unselectAllEntities ( )

Unselects all entities.

References m_dbTreeWidget.

◆ unselectEntity()

void ccDBRoot::unselectEntity ( ccHObject *  obj)

Unselects a given entity.

References index(), ccDrawableObject::isSelected(), and m_dbTreeWidget.

Referenced by MainWindow::setSelectedInDB().

◆ updateCCObject

void ccDBRoot::updateCCObject ( ccHObject *  object)
slot

References index().

Referenced by ccDBRoot().

◆ updatePropertiesView()

Member Data Documentation

◆ m_addEmptyGroup

QAction* ccDBRoot::m_addEmptyGroup
protected

Context menu action: add empty group.

Referenced by showContextMenu().

◆ m_alignCameraWithEntity

QAction* ccDBRoot::m_alignCameraWithEntity
protected

Context menu action: use 3-points labels or planes to orient camera.

Referenced by showContextMenu().

◆ m_alignCameraWithEntityReverse

QAction* ccDBRoot::m_alignCameraWithEntityReverse
protected

Context menu action: reverse of m_alignCameraWithEntity.

Referenced by showContextMenu().

◆ m_ccPropDelegate

ccPropertiesTreeDelegate* ccDBRoot::m_ccPropDelegate
protected

Selected entity's properties delegate.

Referenced by getPropertiesDelegate(), hidePropertiesView(), reflectObjectPropChange(), showPropertiesView(), and ~ccDBRoot().

◆ m_collapseBranch

QAction* ccDBRoot::m_collapseBranch
protected

Context menu action: collapse tree branch.

Referenced by showContextMenu().

◆ m_contextMenuPos

QPoint ccDBRoot::m_contextMenuPos
protected

◆ m_dbTreeWidget

◆ m_deleteSelectedEntities

QAction* ccDBRoot::m_deleteSelectedEntities
protected

Context menu action: delete selected entities.

Referenced by showContextMenu().

◆ m_editLabelScalarValue

QAction* ccDBRoot::m_editLabelScalarValue
protected

Context menu action: change current scalar value (via a 2D label)

Referenced by showContextMenu().

◆ m_enableBubbleViewMode

QAction* ccDBRoot::m_enableBubbleViewMode
protected

Context menu action: enable bubble-view (on a sensor)

Referenced by showContextMenu().

◆ m_expandBranch

QAction* ccDBRoot::m_expandBranch
protected

Context menu action: expand tree branch.

Referenced by showContextMenu().

◆ m_exportImages

QAction* ccDBRoot::m_exportImages
protected

Context menu action: export images.

Referenced by showContextMenu().

◆ m_gatherInformation

QAction* ccDBRoot::m_gatherInformation
protected

Context menu action: gather (recursive) information on selected entities.

Referenced by showContextMenu().

◆ m_propertiesModel

QStandardItemModel* ccDBRoot::m_propertiesModel
protected

Selected entity's properties data model.

Referenced by hidePropertiesView(), and ~ccDBRoot().

◆ m_propertiesTreeWidget

QTreeView* ccDBRoot::m_propertiesTreeWidget
protected

Associated widget for selected entity's properties tree.

Referenced by hide(), hidePropertiesView(), reflectObjectPropChange(), show(), and showPropertiesView().

◆ m_selectByTypeAndName

QAction* ccDBRoot::m_selectByTypeAndName
protected

Context menu action: select object by type and/or by name.

Referenced by showContextMenu().

◆ m_sortChildrenAZ

QAction* ccDBRoot::m_sortChildrenAZ
protected

Context menu action: sort children in alphabetical order.

Referenced by showContextMenu().

◆ m_sortChildrenType

QAction* ccDBRoot::m_sortChildrenType
protected

Context menu action: sort children by type.

Referenced by showContextMenu().

◆ m_sortChildrenZA

QAction* ccDBRoot::m_sortChildrenZA
protected

Context menu action: sort children in reverse alphabetical order.

Referenced by showContextMenu().

◆ m_toggleSelectedEntities

QAction* ccDBRoot::m_toggleSelectedEntities
protected

Context menu action: enabled/disable selected entities.

Referenced by showContextMenu().

◆ m_toggleSelectedEntities3DName

QAction* ccDBRoot::m_toggleSelectedEntities3DName
protected

Context menu action: hide/show selected entities 3D name.

Referenced by showContextMenu().

◆ m_toggleSelectedEntitiesColor

QAction* ccDBRoot::m_toggleSelectedEntitiesColor
protected

Context menu action: hide/show selected entities color.

Referenced by showContextMenu().

◆ m_toggleSelectedEntitiesMat

QAction* ccDBRoot::m_toggleSelectedEntitiesMat
protected

Context menu action: hide/show selected entities materials/textures.

Referenced by showContextMenu().

◆ m_toggleSelectedEntitiesNormals

QAction* ccDBRoot::m_toggleSelectedEntitiesNormals
protected

Context menu action: hide/show selected entities normals.

Referenced by showContextMenu().

◆ m_toggleSelectedEntitiesSF

QAction* ccDBRoot::m_toggleSelectedEntitiesSF
protected

Context menu action: hide/show selected entities SF.

Referenced by showContextMenu().

◆ m_toggleSelectedEntitiesVisibility

QAction* ccDBRoot::m_toggleSelectedEntitiesVisibility
protected

Context menu action: hide/show selected entities.

Referenced by showContextMenu().

◆ m_treeRoot


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