From f19675a3a236f4a3c04712cc886c38be721ddf71 Mon Sep 17 00:00:00 2001 From: Charles PIGNEROL <> Date: Thu, 30 Jan 2025 15:10:24 +0100 Subject: [PATCH] Issue 170. Creation of a block in bounding box mode of a list of selected entities. --- .../QtTopologyBlockCreationAction.cpp | 2 +- src/QtComponents/QtTopologyCreationAction.cpp | 30 +++++++++++++++++-- .../QtComponents/QtTopologyCreationAction.h | 12 ++++++-- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/QtComponents/QtTopologyBlockCreationAction.cpp b/src/QtComponents/QtTopologyBlockCreationAction.cpp index a14ec25..8314f8d 100644 --- a/src/QtComponents/QtTopologyBlockCreationAction.cpp +++ b/src/QtComponents/QtTopologyBlockCreationAction.cpp @@ -158,7 +158,7 @@ void QtTopologyBlockCreationAction::executeOperation ( ) cmdResult = getContext ( ).getTopoManager( ).newFreeTopoInGroup (groupName, 3); else { - vector names = getContext ( ).getSelectionManager ( ).getEntitiesNames ( ); + vector names = panel->getBoundingEntities ( ); cmdResult = getContext ( ).getTopoManager( ).newFreeBoundedTopoInGroup (groupName, 3, names); } // else if (false == verticesOnSelection) } diff --git a/src/QtComponents/QtTopologyCreationAction.cpp b/src/QtComponents/QtTopologyCreationAction.cpp index fb0e852..13a4092 100644 --- a/src/QtComponents/QtTopologyCreationAction.cpp +++ b/src/QtComponents/QtTopologyCreationAction.cpp @@ -53,7 +53,7 @@ QtTopologyCreationPanel::QtTopologyCreationPanel ( const string& helpURL, const string& helpTag) : QtMgx3DOperationPanel (parent, mainWindow, action, helpURL, helpTag), - _geomEntityPanel (0), _topologyPanel (0), _selectionCheckBox (0) + _geomEntityPanel (0), _topologyPanel (0), _selectionCheckBox (0), _selectionEntitiesPanel (0) { // SET_WIDGET_BACKGROUND (this, Qt::yellow) QVBoxLayout* layout = new QVBoxLayout (this); @@ -105,11 +105,16 @@ QtTopologyCreationPanel::QtTopologyCreationPanel ( case SelectionManagerIfc::D3 : _selectionCheckBox = new QCheckBox ("Sommets aux coins de la sélection", this); layout->addWidget (_selectionCheckBox); + _selectionEntitiesPanel = new QtMgx3DEntityPanel (this, "", true, "Entités : ", "", &mainWindow, SelectionManagerIfc::ALL_DIMENSIONS, FilterEntity::All); + _selectionEntitiesPanel->setMultiSelectMode (true); + layout->addWidget (_selectionEntitiesPanel); break; } // switch (dimension) CHECK_NULL_PTR_ERROR (_geomEntityPanel->getNameTextField ( )) - _geomEntityPanel->getNameTextField ( )->setLinkedSeizureManagers (0, 0); + _geomEntityPanel->getNameTextField ( )->setLinkedSeizureManagers (0, 0 == _selectionEntitiesPanel ? 0 : _selectionEntitiesPanel->getNameTextField ( )); + if ((0 != _selectionEntitiesPanel) && (0 != _selectionEntitiesPanel->getNameTextField ( ))) + _selectionEntitiesPanel->getNameTextField ( )->setLinkedSeizureManagers (0 == _geomEntityPanel ? 0 : _geomEntityPanel->getNameTextField ( ), 0); topologyModifiedCallback ( ); @@ -120,7 +125,7 @@ QtTopologyCreationPanel::QtTopologyCreationPanel ( QtTopologyCreationPanel::QtTopologyCreationPanel (const QtTopologyCreationPanel& cao) : QtMgx3DOperationPanel (0, *new QtMgx3DMainWindow(0), 0, "", ""), - _geomEntityPanel (0), _topologyPanel (0), _selectionCheckBox (0) + _geomEntityPanel (0), _topologyPanel (0), _selectionCheckBox (0), _selectionEntitiesPanel (0) { MGX_FORBIDDEN ("QtTopologyCreationPanel copy constructor is not allowed."); } // QtTopologyCreationPanel::QtTopologyCreationPanel (const QtTopologyCreationPanel&) @@ -172,6 +177,13 @@ bool QtTopologyCreationPanel::placeVerticesOnSelectionBounds ( ) const } // QtTopologyCreationPanel::placeVerticesOnSelectionBounds +vector QtTopologyCreationPanel::getBoundingEntities ( ) const +{ + CHECK_NULL_PTR_ERROR(_selectionEntitiesPanel) + return _selectionEntitiesPanel->getUniqueNames ( ); +} // QtTopologyCreationPanel::getBoundingEntities + + void QtTopologyCreationPanel::reset ( ) { BEGIN_QT_TRY_CATCH_BLOCK @@ -231,6 +243,7 @@ void QtTopologyCreationPanel::cancel ( ) BEGIN_QT_TRY_CATCH_BLOCK setGeomEntityName (""); + COMPLETE_QT_TRY_CATCH_BLOCK (true, this, "Magix 3D") } // if (true == cancelClearEntities ( )) @@ -252,10 +265,19 @@ void QtTopologyCreationPanel::autoUpdate ( ) if (1 == selectedVolumes.size ( )) setGeomEntityName (selectedVolumes [0]); + // A affiner : + if (0 != _selectionEntitiesPanel) + { // Les sommets sont susceptibles d'être positionnés sur la boite englobante de la sélection + const vector selection = getSelectionManager ( ).getEntitiesNames ( ); + _selectionEntitiesPanel->setUniqueNames (selection); + } // if (0 != _selectionEntitiesPanel) + COMPLETE_QT_TRY_CATCH_BLOCK (true, this, "Magix 3D") } // if (true == autoUpdateUsesSelection ( )) #else // AUTO_UPDATE_OLD_SCHEME _geomEntityPanel->clearSelection ( ); + if (0 != _selectionEntitiesPanel) + _selectionEntitiesPanel->clearSelection ( ); #endif // AUTO_UPDATE_OLD_SCHEME _geomEntityPanel->actualizeGui (true); @@ -327,6 +349,8 @@ void QtTopologyCreationPanel::topologyModifiedCallback ( ) getTopologyPanel ( ).allowGroupName (allowGroup); if (0 != _selectionCheckBox) _selectionCheckBox->setEnabled (allowSelection); + if (0 != _selectionEntitiesPanel) + _selectionEntitiesPanel->setEnabled (allowSelection); } // QtTopologyCreationPanel::topologyModifiedCallback diff --git a/src/QtComponents/protected/QtComponents/QtTopologyCreationAction.h b/src/QtComponents/protected/QtComponents/QtTopologyCreationAction.h index 980d3f1..3ce5c3f 100644 --- a/src/QtComponents/protected/QtComponents/QtTopologyCreationAction.h +++ b/src/QtComponents/protected/QtComponents/QtTopologyCreationAction.h @@ -92,9 +92,14 @@ class QtTopologyCreationPanel : public QtMgx3DOperationPanel virtual double getOGridRatio ( ) const; /** - * \return true si il faut positionner les vertex sur les coins de la boite englobant la sélection courante + * \return true si il faut positionner les vertex sur les coins de la boite englobant une sélection d'entités */ virtual bool placeVerticesOnSelectionBounds ( ) const; + + /** + * \return La liste des noms d'entités définissant la boite englobante de positionnement des sommets + */ + virtual std::vector getBoundingEntities ( ) const; /** * Réinitialise le panneau. @@ -173,8 +178,11 @@ class QtTopologyCreationPanel : public QtMgx3DOperationPanel /** La topologie créée. */ QtTopologyPanel* _topologyPanel; - /** Faut-il positionner les sommets topologiques sur les coins de la boite englobant une sélection ? */ + /** Faut-il positionner les sommets topologiques sur les coins d'une boite englobant une sélection d'entités ? */ QCheckBox* _selectionCheckBox; + + /** La sélection définissant une boite englobante. */ + QtMgx3DEntityPanel* _selectionEntitiesPanel; }; // class QtTopologyCreationPanel