Skip to content

Commit a804741

Browse files
author
Charles PIGNEROL
committed
Additional reset options on the user interface side during session reset.
1 parent fb1a03c commit a804741

File tree

7 files changed

+107
-28
lines changed

7 files changed

+107
-28
lines changed

src/QtComponents/QtEntitiesItemViewPanel.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ void QtEntitiesItemViewPanel::setMainWindow (QtMgx3DMainWindow* mainWindow)
110110
} // QtEntitiesItemViewPanel::setMainWindow
111111

112112

113+
void QtEntitiesItemViewPanel::sessionCleared ( )
114+
{
115+
} // QtEntitiesItemViewPanel::sessionCleared
116+
117+
113118
Mgx3D::Internal::Context& QtEntitiesItemViewPanel::getContext ( )
114119
{
115120
if (0 == _context)

src/QtComponents/QtEntitiesPanel.cpp

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,7 @@ void QtEntitiesGroupTreeWidgetItem::setRepresentationMask (unsigned long mask)
222222
} // QtEntitiesGroupTreeWidgetItem::setRepresentationMask
223223

224224

225-
DisplayRepresentation::display_type
226-
QtEntitiesGroupTreeWidgetItem::getEntitiesType ( ) const
225+
DisplayRepresentation::display_type QtEntitiesGroupTreeWidgetItem::getEntitiesType ( ) const
227226
{
228227
return _entitiesType;
229228
} // QtEntitiesGroupTreeWidgetItem::getEntitiesType
@@ -328,6 +327,12 @@ const Entity* QtEntityTreeWidgetItem::getEntity ( ) const
328327
} // QtEntityTreeWidgetItem::getEntity
329328

330329

330+
void QtEntityTreeWidgetItem::releaseEntity ( )
331+
{
332+
_entity = 0;
333+
} // QtEntityTreeWidgetItem::releaseEntity
334+
335+
331336
unsigned long QtEntityTreeWidgetItem::getNativeRepresentationMask ( ) const
332337
{
333338
return _3dRep;
@@ -1510,6 +1515,53 @@ void QtEntitiesPanel::updateEntryItems (DisplayRepresentation::display_type type
15101515
} // QtEntitiesPanel::updateEntryItems
15111516

15121517

1518+
static void clearEntityTreeWidgetItemList (QTreeWidgetItem& entry)
1519+
{
1520+
QList<QTreeWidgetItem*> items = entry.takeChildren ( );
1521+
for (int i = 0; i < items.size ( ); i++)
1522+
{
1523+
QtEntityTreeWidgetItem* entityItem = dynamic_cast<QtEntityTreeWidgetItem*>(items.at (i));
1524+
if (0 != entityItem)
1525+
entityItem->releaseEntity ( );
1526+
delete items.at (i);
1527+
} // for (int i = 0; i < items.size ( ); i++)
1528+
entry.setCheckState (0, Qt::Unchecked);
1529+
} // clearEntityTreeWidgetItemList
1530+
1531+
1532+
void QtEntitiesPanel::sessionCleared ( )
1533+
{
1534+
CHECK_NULL_PTR_ERROR (_cadVolumesItem)
1535+
CHECK_NULL_PTR_ERROR (_cadSurfacesItem)
1536+
CHECK_NULL_PTR_ERROR (_cadCurvesItem)
1537+
CHECK_NULL_PTR_ERROR (_cadCloudsItem)
1538+
CHECK_NULL_PTR_ERROR (_topoBlocksItem)
1539+
CHECK_NULL_PTR_ERROR (_topoFacesItem)
1540+
CHECK_NULL_PTR_ERROR (_topoEdgesItem)
1541+
CHECK_NULL_PTR_ERROR (_topoVerticesItem)
1542+
CHECK_NULL_PTR_ERROR (_meshVolumesItem)
1543+
CHECK_NULL_PTR_ERROR (_meshSurfacesItem)
1544+
CHECK_NULL_PTR_ERROR (_meshLinesItem)
1545+
CHECK_NULL_PTR_ERROR (_meshCloudsItem)
1546+
CHECK_NULL_PTR_ERROR (_sysCoordItem)
1547+
CHECK_NULL_PTR_ERROR (_structuredMeshVolumesItem)
1548+
clearEntityTreeWidgetItemList (*_cadVolumesItem);
1549+
clearEntityTreeWidgetItemList (*_cadSurfacesItem);
1550+
clearEntityTreeWidgetItemList (*_cadCurvesItem);
1551+
clearEntityTreeWidgetItemList (*_cadCloudsItem);
1552+
clearEntityTreeWidgetItemList (*_topoBlocksItem);
1553+
clearEntityTreeWidgetItemList (*_topoFacesItem);
1554+
clearEntityTreeWidgetItemList (*_topoEdgesItem);
1555+
clearEntityTreeWidgetItemList (*_topoVerticesItem);
1556+
clearEntityTreeWidgetItemList (*_meshVolumesItem);
1557+
clearEntityTreeWidgetItemList (*_meshSurfacesItem);
1558+
clearEntityTreeWidgetItemList (*_meshLinesItem);
1559+
clearEntityTreeWidgetItemList (*_meshCloudsItem);
1560+
clearEntityTreeWidgetItemList (*_sysCoordItem);
1561+
clearEntityTreeWidgetItemList (*_structuredMeshVolumesItem);
1562+
} // QtEntitiesPanel::sessionCleared
1563+
1564+
15131565
void QtEntitiesPanel::entitiesAddedToSelection (const vector<Entity*>& entities)
15141566
{
15151567
for (vector<Entity*>::const_iterator it = entities.begin ( );

src/QtComponents/QtGroupsPanel.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,18 @@ vector<Group::GroupEntity*> QtGroupsPanel::getSelectedGroups ( ) const
641641
} // QtGroupsPanel::getSelectedGroups
642642

643643

644+
void QtGroupsPanel::sessionCleared ( )
645+
{
646+
// Rem : ça détruit également la vue multi-niveaux
647+
for (vector<QTreeWidgetItem*>::iterator itge = _groupsEntriesItems.begin ( ); itge != _groupsEntriesItems.end ( ); itge++)
648+
{
649+
QList<QTreeWidgetItem*> items = (*itge)->takeChildren ( );
650+
for (int i = 0; i < items.size ( ); i++)
651+
delete items.at (i);
652+
} // for (vector<QTreeWidgetItem*>::iterator itge = _groupsEntriesItems.begin ( ); itge != _groupsEntriesItems.end ( ); itge++)
653+
} // QtGroupsPanel::sessionCleared
654+
655+
644656
void QtGroupsPanel::displaySelectedTypes (bool display)
645657
{
646658
if (true == getGraphicalWidget ( )->getRenderingManager ( ).displayLocked ( ))

src/QtComponents/QtMgx3DMainWindow.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5395,7 +5395,7 @@ cout << __FILE__ << ' ' << __LINE__ << " QtMgx3DMainWindow::exitCallback" << end
53955395

53965396
BEGIN_QT_TRY_CATCH_BLOCK
53975397

5398-
DISABLE_COMMAND_ACTIONS
5398+
DISABLE_COMMAND_ACTIONS
53995399
DISABLE_GRAPHICAL_OPERATIONS
54005400
getContext().redo();
54015401

@@ -5429,7 +5429,11 @@ cout << __FILE__ << ' ' << __LINE__ << " QtMgx3DMainWindow::exitCallback" << end
54295429

54305430
BEGIN_QT_TRY_CATCH_BLOCK
54315431

5432-
getContext().clearSession();
5432+
DISABLE_GRAPHICAL_OPERATIONS
5433+
5434+
getContext ( ).clearSession ( );
5435+
getGroupsPanel ( ).sessionCleared ( );
5436+
getEntitiesPanel ( ).sessionCleared ( );
54335437

54345438
COMPLETE_QT_TRY_CATCH_BLOCK(true, this, getAppTitle())
54355439
} // QtMgx3DMainWindow::reinitializeCallback

src/QtComponents/protected/QtComponents/QtEntitiesItemViewPanel.h

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,10 @@ class QtMgx3DMainWindow;
2525

2626

2727
/**
28-
* \brief Panneau abstrait de l'IHM <I>Magix 3D</I> affichant des entités
29-
* d'une session <I>Magix 3D</I>.
30-
* L'affichage est ici a priori textuel et couplé à un affichage
31-
* dans une fenêtre graphique 3D.
28+
* \brief Panneau abstrait de l'IHM <I>Magix 3D</I> affichant des entités d'une session <I>Magix 3D</I>.
29+
* L'affichage est ici a priori textuel et couplé à un affichage dans une fenêtre graphique 3D.
3230
*
33-
* <P>L'objectif de cette classe non instanciable est de factoriser
34-
* certains services des vues textuelles type <I>QTreeWidget</I>
35-
* d'entités.
31+
* <P>L'objectif de cette classe non instanciable est de factoriser certains services des vues textuelles type <I>QTreeWidget</I> d'entités.
3632
* </P>
3733
*/
3834
class QtEntitiesItemViewPanel : public QtGroupBox
@@ -45,9 +41,7 @@ class QtEntitiesItemViewPanel : public QtGroupBox
4541
* \param Nom du panneau.
4642
* \param Contexte Magix 3D du panneau
4743
*/
48-
QtEntitiesItemViewPanel (
49-
QWidget* parent, QtMgx3DMainWindow* mainWindow,
50-
const std::string& name, Internal::Context& context);
44+
QtEntitiesItemViewPanel (QWidget* parent, QtMgx3DMainWindow* mainWindow, const std::string& name, Internal::Context& context);
5145

5246
/**
5347
* RAS.
@@ -73,6 +67,11 @@ class QtEntitiesItemViewPanel : public QtGroupBox
7367
*/
7468
virtual void setMainWindow (QtMgx3DMainWindow*);
7569

70+
/**
71+
* A appeler lorsque la session est réinitialisée, doit réinitialiser le panneau. Ne fait rien par défaut, à surcharger.
72+
*/
73+
virtual void sessionCleared ( );
74+
7675
/**
7776
* La gestion de la sélection.
7877
*/
@@ -99,11 +98,8 @@ class QtEntitiesItemViewPanel : public QtGroupBox
9998
//@{
10099

101100
/**
102-
* \param La fenêtre graphique à utiliser pour les affichages 3D,
103-
* ou 0.
104-
* \exception Une exception est levée si la fenêtre transmise en
105-
* argument est non nulle et qu'une autre fenêtre est déjà
106-
* affectée.
101+
* \param La fenêtre graphique à utiliser pour les affichages 3D, ou 0.
102+
* \exception Une exception est levée si la fenêtre transmise en argument est non nulle et qu'une autre fenêtre est déjà affectée.
107103
* \see getGraphicalWidget
108104
*/
109105
virtual void setGraphicalWidget (Qt3DGraphicalWidget* widget3D);
@@ -129,22 +125,18 @@ class QtEntitiesItemViewPanel : public QtGroupBox
129125
virtual void setLogStream (TkUtil::LogOutputStream* stream);
130126

131127
/**
132-
* \param Ecrit le log transmis en argument dans le flux
133-
* d'informations associé.
128+
* \param Ecrit le log transmis en argument dans le flux d'informations associé.
134129
*/
135130
virtual void log (const TkUtil::Log& log);
136131

137132
//@} // La gestion des informations à remonter à l'utilisateur.
138133

139134
/**
140-
* Appelé pour modifier les paramètres d'affichage
141-
* (points/filaire/surfacique) des entités données en argument. Affiche une
142-
* boite de dialogue de choix des types de représentation à utiliser,
143-
* initialisé selon les entités transmises en argument, et effectue les
135+
* Appelé pour modifier les paramètres d'affichage (points/filaire/surfacique) des entités données en argument. Affiche une
136+
* boite de dialogue de choix des types de représentation à utiliser, initialisé selon les entités transmises en argument, et effectue les
144137
* modifications demandées.
145138
*/
146-
virtual void changeRepresentationTypes (
147-
const std::vector<Mgx3D::Utils::Entity*>& entities);
139+
virtual void changeRepresentationTypes (const std::vector<Mgx3D::Utils::Entity*>& entities);
148140

149141

150142
protected :

src/QtComponents/protected/QtComponents/QtEntitiesPanel.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ class QtEntityTreeWidgetItem :
5454
*/
5555
virtual ~QtEntityTreeWidgetItem ( );
5656

57+
/**
58+
* Oublie l'entité représentée.
59+
*/
60+
virtual void releaseEntity ( );
61+
5762
/**
5863
* \return L'entité représentée.
5964
*/
@@ -757,6 +762,11 @@ class QtEntitiesPanel :public QtEntitiesItemViewPanel, public Internal::Selectio
757762
*/
758763
virtual void updateEntryItems (Mgx3D::Utils::DisplayRepresentation::display_type type);
759764

765+
/**
766+
* A appeler lorsque la session est réinitialisée, doit réinitialiser le panneau. Ne fait rien par défaut, à surcharger.
767+
*/
768+
virtual void sessionCleared ( );
769+
760770
//@}
761771

762772
/**

src/QtComponents/protected/QtComponents/QtGroupsPanel.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,11 @@ class QtGroupsPanel : public QtEntitiesItemViewPanel, public Internal::Selection
396396
*/
397397
virtual std::vector<Mgx3D::Group::GroupEntity*> getSelectedGroups ( ) const;
398398

399+
/**
400+
* A appeler lorsque la session est réinitialisée, doit réinitialiser le panneau. Ne fait rien par défaut, à surcharger.
401+
*/
402+
virtual void sessionCleared ( );
403+
399404
//@} // Les groupes représentés.
400405

401406
/**
@@ -760,7 +765,6 @@ class QtGroupsPanel : public QtEntitiesItemViewPanel, public Internal::Selection
760765
*/
761766
virtual void clearGroupCallback ( );
762767

763-
764768
/**
765769
* Appelé lorsque le menu popup est demandé au niveau de l'arborescence des types d'entités à afficher. Affiche ce menu popup à la position transmise en argument.
766770
*/

0 commit comments

Comments
 (0)