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

#include <MainWindow.h>

Inheritance diagram for MainWindow:
Collaboration diagram for MainWindow:

Public Slots

void enablePickingOperation (QString message)
 
void cancelPreviousPickingOperation (bool aborted)
 
void doActionPerspectiveProjection ()
 
void doActionOrthogonalProjection ()
 

Signals

void exclusiveFullScreenToggled (bool exclusive)
 Signal emitted when the exclusive full screen is toggled. More...
 
void translation (const CCVector3d &t)
 Signal emitted when the selected object is translated by the user. More...
 
void rotation (const ccGLMatrixd &rotMat)
 Signal emitted when the selected object is rotated by the user. More...
 

Public Member Functions

void setUiManager (QUIWidget *uiManager)
 
void saveGUIElementsPos ()
 Saves position and state of all GUI elements. More...
 
void setAutoPickPivot (bool state)
 
void setOrthoView ()
 
void setPerspectiveView ()
 
void updateViewModePopUpMenu ()
 
ccBBox getSelectedEntityBbox ()
 
void updateFullScreenMenu (bool state)
 
void addToDBAuto (const QStringList &filenames, bool displayDialog=true)
 
void addToDB (const QStringList &filenames, QString fileFilter=QString(), bool displayDialog=true)
 
void initPlugins ()
 Sets up the UI (menus and toolbars) based on loaded plugins. More...
 
void updatePropertiesView ()
 Updates the 'Properties' view. More...
 
void doActionSaveViewportAsCamera ()
 
void onItemPicked (const PickedItem &pi) override
 Inherited from ccPickingListener. More...
 
ccDBRootdb ()
 Returns real 'dbRoot' object. More...
 
int getRenderWindowCount () const
 Returns the number of 3D views. More...
 
QMdiSubWindow * getMDISubWindow (QWidget *win)
 Returns MDI area subwindow corresponding to a given 3D view. More...
 
QWidget * getActiveWindow () override
 
QWidget * getWindow (int index) const
 
void update3DViewsMenu ()
 
void spawnHistogramDialog (const std::vector< unsigned > &histoValues, double minVal, double maxVal, QString title, QString xAxisLabel) override
 
ccPickingHubpickingHub () override
 
void toggleExclusiveFullScreen (bool state) override
 
void toggle3DView (bool state) override
 
void forceConsoleDisplay () override
 Forces display of console widget. More...
 
ccHObjectdbRootObject () override
 Returns DB root (as a ccHObject) More...
 
void refreshAll (bool only2D=false, bool forceRedraw=true) override
 Redraws all GL windows that have the 'refresh' flag on. More...
 
void enableAll () override
 Enables all windows. More...
 
void disableAll () override
 Disables all windows. More...
 
void refreshSelected (bool only2D=false, bool forceRedraw=true) override
 
void refreshObject (ccHObject *obj, bool only2D=false, bool forceRedraw=true) override
 
void refreshObjects (ccHObject::Container objs, bool only2D=false, bool forceRedraw=true) override
 
void resetSelectedBBox () override
 
void removeFromDB (ccHObject *obj, bool autoDelete=true) override
 Removes an entity from main db tree. More...
 
void setSelectedInDB (ccHObject *obj, bool selected) override
 Selects or unselects an entity (in db tree) More...
 
void putObjectBackIntoDBTree (ccHObject *obj, const ccHObjectContext &context) override
 Adds back object to DB tree. More...
 
QMainWindow * getMainWindow () override
 Returns main window. More...
 
const ccHObject::ContainergetSelectedEntities () const override
 Returns currently selected entities ("read only") More...
 
ccHObjectContext removeObjectTemporarilyFromDBTree (ccHObject *obj) override
 Removes object temporarily from DB tree. More...
 
ccColorScalesManagergetColorScalesManager () override
 Returns color scale manager (unique instance) More...
 
void addToDB (ccHObject *obj, bool updateZoom=false, bool autoExpandDBTree=true, bool checkDimensions=false, bool autoRedraw=true) override
 
void registerOverlayDialog (ccOverlayDialog *dlg, Qt::Corner pos) override
 Registers a MDI area 'overlay' dialog. More...
 
void unregisterOverlayDialog (ccOverlayDialog *dlg) override
 Unregisters a MDI area 'overlay' dialog. More...
 
void updateOverlayDialogsPlacement () override
 Forces the update of all registered MDI 'overlay' dialogs. More...
 
ccHObjectloadFile (QString filename, bool silent) override
 Attempts to load a file. More...
 
void setView (CC_VIEW_ORIENTATION view) override
 
void dispToConsole (QString message, ConsoleMessageLevel level=STD_CONSOLE_MESSAGE) override
 
ccUniqueIDGenerator::Shared getUniqueIDGenerator () override
 Returns the unique ID generator. More...
 
void addWidgetToQMdiArea (QWidget *widget) override
 
void increasePointSize () override
 
void decreasePointSize () override
 
void updateUI () override
 
void freezeUI (bool state) override
 Freezes/unfreezes UI. More...
 
void zoomOnSelectedEntities () override
 
void zoomOnEntities (ccHObject *obj) override
 
void setGlobalZoom () override
 
- Public Member Functions inherited from ecvMainAppInterface
virtual ~ecvMainAppInterface ()=default
 
bool haveSelection () const
 Checks if we have any selections. More...
 
bool haveOneSelection () const
 Checks if we have exactly one selection. More...
 
virtual void redrawAll (bool only2D=false, bool forceRedraw=true)
 
- Public Member Functions inherited from ccPickingListener
virtual ~ccPickingListener ()=default
 

Static Public Member Functions

static void UpdateUI ()
 Static shortcut to MainWindow::updateUI. More...
 
static MainWindowTheInstance ()
 Returns the unique instance of this object. More...
 
static QWidget * GetActiveRenderWindow ()
 Static shortcut to MainWindow::getActiveWindow. More...
 
static QWidget * GetRenderWindow (const QString &title)
 Returns a given GL sub-window (determined by its title) More...
 
static void GetRenderWindows (std::vector< QWidget * > &windows)
 Returns all GL sub-windows. More...
 
static void DestroyInstance ()
 Deletes current main window instance. More...
 
static void ChangeStyle (const QString &qssFile)
 

Public Attributes

bool m_FirstShow
 Flag: first time the window is made visible. More...
 

Static Public Attributes

static bool s_autoSaveGuiElementPos = true
 

Protected Member Functions

 MainWindow ()
 
 ~MainWindow () override
 
QMenu * createPopupMenu () override
 Override to add custom actions to right-click menu on toolbars. More...
 

Additional Inherited Members

- Public Types inherited from ecvMainAppInterface
enum  ConsoleMessageLevel { STD_CONSOLE_MESSAGE = 0 , WRN_CONSOLE_MESSAGE = 1 , ERR_CONSOLE_MESSAGE = 2 }
 Console message level (see dispToConsole) More...
 

Detailed Description

Definition at line 117 of file MainWindow.h.

Constructor & Destructor Documentation

◆ MainWindow()

◆ ~MainWindow()

Member Function Documentation

◆ addToDB() [1/2]

◆ addToDB() [2/2]

◆ addToDBAuto()

void MainWindow::addToDBAuto ( const QStringList &  filenames,
bool  displayDialog = true 
)

Definition at line 2147 of file MainWindow.cpp.

References addToDB().

◆ addWidgetToQMdiArea()

void MainWindow::addWidgetToQMdiArea ( QWidget *  widget)
overridevirtual

Implements ecvMainAppInterface.

Definition at line 1911 of file MainWindow.cpp.

References getMDISubWindow(), and GetRenderWindow().

◆ cancelPreviousPickingOperation

◆ ChangeStyle()

void MainWindow::ChangeStyle ( const QString &  qssFile)
static

Definition at line 1982 of file MainWindow.cpp.

References ecvApp.

Referenced by main().

◆ createPopupMenu()

QMenu * MainWindow::createPopupMenu ( )
overrideprotected

Override to add custom actions to right-click menu on toolbars.

Definition at line 628 of file MainWindow.cpp.

◆ db()

◆ dbRootObject()

ccHObject * MainWindow::dbRootObject ( )
overridevirtual

Returns DB root (as a ccHObject)

Implements ecvMainAppInterface.

Definition at line 2027 of file MainWindow.cpp.

References ccDBRoot::getRootEntity().

Referenced by ccGraphicalSegmentationTool::doActionUseExistingPolyline().

◆ decreasePointSize()

void MainWindow::decreasePointSize ( )
overridevirtual

◆ DestroyInstance()

void MainWindow::DestroyInstance ( )
static

Deletes current main window instance.

Definition at line 2042 of file MainWindow.cpp.

References s_instance.

Referenced by main().

◆ disableAll()

void MainWindow::disableAll ( )
overridevirtual

Disables all windows.

Implements ecvMainAppInterface.

Definition at line 3319 of file MainWindow.cpp.

◆ dispToConsole()

void MainWindow::dispToConsole ( QString  message,
ConsoleMessageLevel  level = STD_CONSOLE_MESSAGE 
)
overridevirtual

◆ doActionOrthogonalProjection

void MainWindow::doActionOrthogonalProjection ( )
slot

◆ doActionPerspectiveProjection

◆ doActionSaveViewportAsCamera()

void MainWindow::doActionSaveViewportAsCamera ( )

◆ enableAll()

void MainWindow::enableAll ( )
overridevirtual

Enables all windows.

Implements ecvMainAppInterface.

Definition at line 3313 of file MainWindow.cpp.

◆ enablePickingOperation

void MainWindow::enablePickingOperation ( QString  message)
slot

◆ exclusiveFullScreenToggled

void MainWindow::exclusiveFullScreenToggled ( bool  exclusive)
signal

Signal emitted when the exclusive full screen is toggled.

◆ forceConsoleDisplay()

void MainWindow::forceConsoleDisplay ( )
overridevirtual

Forces display of console widget.

Implements ecvMainAppInterface.

Definition at line 2019 of file MainWindow.cpp.

Referenced by ecvConsole::refresh().

◆ freezeUI()

void MainWindow::freezeUI ( bool  state)
overridevirtual

Freezes/unfreezes UI.

Parameters
statefreeze state

Implements ecvMainAppInterface.

Definition at line 4624 of file MainWindow.cpp.

References ccPluginUIManager::additionalPluginToolbars(), and ccPluginUIManager::mainPluginToolbar().

Referenced by cancelPreviousPickingOperation(), enablePickingOperation(), and MainWindow().

◆ GetActiveRenderWindow()

QWidget * MainWindow::GetActiveRenderWindow ( )
static

Static shortcut to MainWindow::getActiveWindow.

Definition at line 1920 of file MainWindow.cpp.

References getActiveWindow(), and TheInstance().

◆ getActiveWindow()

QWidget * MainWindow::getActiveWindow ( )
overridevirtual

◆ getColorScalesManager()

ccColorScalesManager * MainWindow::getColorScalesManager ( )
overridevirtual

Returns color scale manager (unique instance)

Implements ecvMainAppInterface.

Definition at line 3801 of file MainWindow.cpp.

References ccColorScalesManager::GetUniqueInstance().

◆ getMainWindow()

QMainWindow* MainWindow::getMainWindow ( )
inlineoverridevirtual

Returns main window.

Implements ecvMainAppInterface.

Definition at line 237 of file MainWindow.h.

◆ getMDISubWindow()

QMdiSubWindow * MainWindow::getMDISubWindow ( QWidget *  win)

Returns MDI area subwindow corresponding to a given 3D view.

Definition at line 1857 of file MainWindow.cpp.

Referenced by addWidgetToQMdiArea().

◆ GetRenderWindow()

QWidget * MainWindow::GetRenderWindow ( const QString &  title)
static

Returns a given GL sub-window (determined by its title)

Parameters
titlewindow title

Definition at line 1938 of file MainWindow.cpp.

References TheInstance().

Referenced by addWidgetToQMdiArea().

◆ getRenderWindowCount()

int MainWindow::getRenderWindowCount ( ) const

Returns the number of 3D views.

Definition at line 1853 of file MainWindow.cpp.

◆ GetRenderWindows()

void MainWindow::GetRenderWindows ( std::vector< QWidget * > &  windows)
static

Returns all GL sub-windows.

Parameters
[in,out]glWindowsvector to store all sub-windows

Definition at line 1924 of file MainWindow.cpp.

References TheInstance().

Referenced by ~MainWindow().

◆ getSelectedEntities()

const ccHObject::Container& MainWindow::getSelectedEntities ( ) const
inlineoverridevirtual

◆ getSelectedEntityBbox()

ccBBox MainWindow::getSelectedEntityBbox ( )

◆ getUniqueIDGenerator()

ccUniqueIDGenerator::Shared MainWindow::getUniqueIDGenerator ( )
overridevirtual

Returns the unique ID generator.

Implements ecvMainAppInterface.

Definition at line 2077 of file MainWindow.cpp.

References ccObject::GetUniqueIDGenerator().

◆ getWindow()

QWidget * MainWindow::getWindow ( int  index) const

Definition at line 1952 of file MainWindow.cpp.

◆ increasePointSize()

void MainWindow::increasePointSize ( )
overridevirtual

◆ initPlugins()

◆ loadFile()

◆ onItemPicked()

void MainWindow::onItemPicked ( const PickedItem pi)
overridevirtual

◆ pickingHub()

ccPickingHub* MainWindow::pickingHub ( )
inlineoverridevirtual

◆ putObjectBackIntoDBTree()

void MainWindow::putObjectBackIntoDBTree ( ccHObject obj,
const ccHObjectContext context 
)
overridevirtual

Adds back object to DB tree.

This method should be called once modifications to the db tree are finished (see removeObjectTemporarilyFromDBTree).

Implements ecvMainAppInterface.

Definition at line 3758 of file MainWindow.cpp.

References ccHObject::addDependency(), ccDBRoot::addElement(), context, and ccHObject::notifyGeometryUpdate().

Referenced by ccGraphicalTransformationTool::apply(), ccLibAlgorithms::ApplyScaleMatchingAlgorithm(), ccEntityAction::clearProperty(), ccEntityAction::computeNormals(), and ccEntityAction::computeOctree().

◆ refreshAll()

void MainWindow::refreshAll ( bool  only2D = false,
bool  forceRedraw = true 
)
overridevirtual

Redraws all GL windows that have the 'refresh' flag on.

! Forces redraw of all GL windows **

Parameters
only2Dwhether to redraw everything (false) or only the 2D layer (true) See ccDrawableObject::prepareDisplayForRefresh.
only2Dwhether to redraw everything (false) or only the 2D layer (true)

Implements ecvMainAppInterface.

Definition at line 4391 of file MainWindow.cpp.

References ecvDisplayTools::RedrawDisplay().

Referenced by ccDBRoot::changeSelection(), decreasePointSize(), ccDBRoot::deleteSelectedEntities(), ccDBRoot::dropMimeData(), ccDBRoot::enableBubbleViewMode(), increasePointSize(), MainWindow(), ccDBRoot::setData(), ccDBRoot::toggleSelectedEntitiesProperty(), and ccDBRoot::unloadAll().

◆ refreshObject()

void MainWindow::refreshObject ( ccHObject obj,
bool  only2D = false,
bool  forceRedraw = true 
)
overridevirtual

◆ refreshObjects()

void MainWindow::refreshObjects ( ccHObject::Container  objs,
bool  only2D = false,
bool  forceRedraw = true 
)
overridevirtual

◆ refreshSelected()

void MainWindow::refreshSelected ( bool  only2D = false,
bool  forceRedraw = true 
)
overridevirtual

◆ registerOverlayDialog()

void MainWindow::registerOverlayDialog ( ccOverlayDialog dlg,
Qt::Corner  pos 
)
overridevirtual

Registers a MDI area 'overlay' dialog.

Overlay dialogs are displayed in the central MDI area, above the 3D views. The position (pos) is defined relatively to the MDI area (as one of its 4 corners). And it is automatically updated when the main window is moved or resized. Registered dialogs are automatically released when CLOUDVIEWER stops.

Notes:

  • it may be necessary to call 'updateOverlayDialogsPlacement' after calling this method
  • it's a good idea to freeez the UI when the tool starts to avoid other overlay dialogs to appear (don't forget to unfreeze the UI afterwards)

Implements ecvMainAppInterface.

Definition at line 4080 of file MainWindow.cpp.

References ccOverlayDialog::shown().

◆ removeFromDB()

void MainWindow::removeFromDB ( ccHObject obj,
bool  autoDelete = true 
)
overridevirtual

Removes an entity from main db tree.

Object is automatically detached from its parent.

Parameters
objentity
autoDeleteautomatically deletes object

Implements ecvMainAppInterface.

Definition at line 4602 of file MainWindow.cpp.

References ccHObject::getParent(), ccHObject::removeDependencyWith(), ccDBRoot::removeElement(), and ccHObject::removeFromRenderScreen().

◆ removeObjectTemporarilyFromDBTree()

MainWindow::ccHObjectContext MainWindow::removeObjectTemporarilyFromDBTree ( ccHObject obj)
overridevirtual

Removes object temporarily from DB tree.

This method must be called before any modification to the db tree

Warning
May change the set of currently selected entities

Implements ecvMainAppInterface.

Definition at line 3776 of file MainWindow.cpp.

References context, ccHObject::getDependencyFlagsWith(), ccHObject::getParent(), ccHObject::removeDependencyWith(), and ccDBRoot::removeElement().

Referenced by ccGraphicalTransformationTool::apply(), ccLibAlgorithms::ApplyScaleMatchingAlgorithm(), ccEntityAction::clearProperty(), ccEntityAction::computeNormals(), and ccEntityAction::computeOctree().

◆ resetSelectedBBox()

void MainWindow::resetSelectedBBox ( )
overridevirtual

◆ rotation

void MainWindow::rotation ( const ccGLMatrixd rotMat)
signal

Signal emitted when the selected object is rotated by the user.

Parameters
rotMatrotation applied to current viewport (4x4 OpenGL matrix)

◆ saveGUIElementsPos()

void MainWindow::saveGUIElementsPos ( )

Saves position and state of all GUI elements.

Definition at line 5287 of file MainWindow.cpp.

References CVLog::Error(), and ecvLayoutManager::saveGUILayout().

◆ setAutoPickPivot()

void MainWindow::setAutoPickPivot ( bool  state)

Definition at line 1824 of file MainWindow.cpp.

◆ setGlobalZoom()

void MainWindow::setGlobalZoom ( )
overridevirtual

◆ setOrthoView()

void MainWindow::setOrthoView ( )

◆ setPerspectiveView()

void MainWindow::setPerspectiveView ( )

◆ setSelectedInDB()

void MainWindow::setSelectedInDB ( ccHObject obj,
bool  selected 
)
overridevirtual

Selects or unselects an entity (in db tree)

Parameters
objentity
selectedwhether entity should be selected or not

Implements ecvMainAppInterface.

Definition at line 4615 of file MainWindow.cpp.

References ccDBRoot::selectEntity(), and ccDBRoot::unselectEntity().

◆ setUiManager()

void MainWindow::setUiManager ( QUIWidget uiManager)

Definition at line 2008 of file MainWindow.cpp.

Referenced by main().

◆ setView()

void MainWindow::setView ( CC_VIEW_ORIENTATION  view)
overridevirtual

Implements ecvMainAppInterface.

Definition at line 3719 of file MainWindow.cpp.

References ecvDisplayTools::SetView().

◆ spawnHistogramDialog()

void MainWindow::spawnHistogramDialog ( const std::vector< unsigned > &  histoValues,
double  minVal,
double  maxVal,
QString  title,
QString  xAxisLabel 
)
overridevirtual

◆ TheInstance()

MainWindow * MainWindow::TheInstance ( )
static

Returns the unique instance of this object.

Definition at line 2037 of file MainWindow.cpp.

References MainWindow(), and s_instance.

Referenced by ecvFilterByLabelDlg::apply(), ccGraphicalTransformationTool::apply(), ccPointListPickingDlg::applyAndExit(), ccPointListPickingDlg::cancelAndExit(), ccDBRoot::changeSelection(), ccPointListPickingDlg::clearLastLabel(), ccDBRoot::deleteSelectedEntities(), ccGraphicalSegmentationTool::doActionUseExistingPolyline(), ccGraphicalSegmentationTool::doExportSegmentationPolyline(), ccDBRoot::dropMimeData(), ecvMeasurementTool::ecvMeasurementTool(), ccDBRoot::editLabelScalarValue(), ccDBRoot::enableBubbleViewMode(), ecvApplication::event(), ccRasterizeTool::exportContourLines(), ccVolumeCalcTool::exportGridAsCloud(), ccDBRoot::exportImages(), ccTracePolylineTool::exportLine(), ecvMeasurementTool::exportMeasurement(), ccGraphicalTransformationTool::exportNewEntities(), ecvFilterTool::exportSlice(), ccPointListPickingDlg::exportToNewCloud(), ccPointListPickingDlg::exportToNewPolyline(), ccDBRoot::gatherRecursiveInformation(), ccRasterizeTool::generateCloud(), ccRasterizeTool::generateMesh(), GetActiveRenderWindow(), GetRenderWindow(), GetRenderWindows(), ccApplyTransformationDlg::initFromDipAndDipDir(), main(), ecvMeasurementTool::onPointPickingRequested(), ccPointListPickingDlg::processPickedPoint(), ccPlaneEditDlg::saveParamsAndAccept(), ccDBRoot::selectByTypeAndName(), ccDBRoot::setData(), ccPropertiesTreeDelegate::setEditorData(), ecvMeasurementTool::start(), ccDBRoot::toggleSelectedEntitiesProperty(), ccDBRoot::unloadAll(), and UpdateUI().

◆ toggle3DView()

void MainWindow::toggle3DView ( bool  state)
overridevirtual

◆ toggleExclusiveFullScreen()

◆ translation

void MainWindow::translation ( const CCVector3d t)
signal

Signal emitted when the selected object is translated by the user.

◆ unregisterOverlayDialog()

void MainWindow::unregisterOverlayDialog ( ccOverlayDialog dlg)
overridevirtual

Unregisters a MDI area 'overlay' dialog.

Warning
Original overlay dialog object will be deleted (see QObject::deleteLater)

Implements ecvMainAppInterface.

Definition at line 4108 of file MainWindow.cpp.

◆ update3DViewsMenu()

void MainWindow::update3DViewsMenu ( )

Definition at line 1867 of file MainWindow.cpp.

◆ updateFullScreenMenu()

void MainWindow::updateFullScreenMenu ( bool  state)

Definition at line 3959 of file MainWindow.cpp.

◆ updateOverlayDialogsPlacement()

void MainWindow::updateOverlayDialogsPlacement ( )
overridevirtual

Forces the update of all registered MDI 'overlay' dialogs.

Implements ecvMainAppInterface.

Definition at line 4118 of file MainWindow.cpp.

◆ updatePropertiesView()

void MainWindow::updatePropertiesView ( )

Updates the 'Properties' view.

Definition at line 4988 of file MainWindow.cpp.

References ccDBRoot::updatePropertiesView().

Referenced by ccPlaneEditDlg::saveParamsAndAccept(), and updateUI().

◆ UpdateUI()

void MainWindow::UpdateUI ( )
static

Static shortcut to MainWindow::updateUI.

Definition at line 5192 of file MainWindow.cpp.

References TheInstance(), and updateUI().

Referenced by ccComparisonDlg::updateDisplay().

◆ updateUI()

void MainWindow::updateUI ( )
overridevirtual

Updates UI (menu and properties browser) to reflect current selection state This method should be called whenever a change is made to any selected entity

Implements ecvMainAppInterface.

Definition at line 4982 of file MainWindow.cpp.

References updatePropertiesView().

Referenced by MainWindow(), and UpdateUI().

◆ updateViewModePopUpMenu()

void MainWindow::updateViewModePopUpMenu ( )

◆ zoomOnEntities()

◆ zoomOnSelectedEntities()

void MainWindow::zoomOnSelectedEntities ( )
overridevirtual

Member Data Documentation

◆ m_FirstShow

bool MainWindow::m_FirstShow

Flag: first time the window is made visible.

Definition at line 206 of file MainWindow.h.

◆ s_autoSaveGuiElementPos

bool MainWindow::s_autoSaveGuiElementPos = true
static

Definition at line 207 of file MainWindow.h.


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