| 6713 | } |
| 6714 | |
| 6715 | void MainWindow::activateSegmentationMode() |
| 6716 | { |
| 6717 | ccGLWindowInterface* win = getActiveGLWindow(); |
| 6718 | if (!win) |
| 6719 | return; |
| 6720 | |
| 6721 | if (!haveSelection()) |
| 6722 | return; |
| 6723 | |
| 6724 | if (!m_gsTool) |
| 6725 | { |
| 6726 | m_gsTool = new ccGraphicalSegmentationTool(this); |
| 6727 | connect(m_gsTool, &ccOverlayDialog::processFinished, this, &MainWindow::deactivateSegmentationMode); |
| 6728 | |
| 6729 | registerOverlayDialog(m_gsTool, Qt::TopRightCorner); |
| 6730 | } |
| 6731 | |
| 6732 | m_gsTool->linkWith(win); |
| 6733 | |
| 6734 | for ( ccHObject *entity : getSelectedEntities() ) |
| 6735 | { |
| 6736 | m_gsTool->addEntity(entity); |
| 6737 | } |
| 6738 | |
| 6739 | if (m_gsTool->getNumberOfValidEntities() == 0) |
| 6740 | { |
| 6741 | ccConsole::Error(tr("No segmentable entity in active window!")); |
| 6742 | return; |
| 6743 | } |
| 6744 | |
| 6745 | freezeUI(true); |
| 6746 | m_UI->toolBarView->setDisabled(false); |
| 6747 | |
| 6748 | //we disable all other windows |
| 6749 | disableAllBut(win); |
| 6750 | |
| 6751 | if (!m_gsTool->start()) |
| 6752 | deactivateSegmentationMode(false); |
| 6753 | else |
| 6754 | updateOverlayDialogsPlacement(); |
| 6755 | } |
| 6756 | |
| 6757 | void MainWindow::deactivateSegmentationMode(bool state) |
| 6758 | { |
nothing calls this directly
no test coverage detected