1 // SMESH SMESHGUI : GUI for SMESH component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESHGUI_MeshInfosDlg.cxx
25 // Author : Nicolas BARBEROU
29 #include "SMESHGUI_MeshInfosDlg.h"
32 #include "SMESHGUI_Utils.h"
34 #include "SUIT_Desktop.h"
35 #include "SUIT_ResourceMgr.h"
36 #include "SUIT_OverrideCursor.h"
38 #include "LightApp_SelectionMgr.h"
39 #include "SALOMEDSClient_Study.hxx"
40 #include "SALOME_ListIO.hxx"
42 #include "utilities.h"
45 #include <qgroupbox.h>
48 #include <qwidgetstack.h>
51 #include <qpushbutton.h>
54 #include "SALOMEconfig.h"
55 #include CORBA_SERVER_HEADER(SMESH_Mesh)
56 #include CORBA_SERVER_HEADER(SMESH_Group)
60 #define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" )
62 //=================================================================================
63 // function : SMESHGUI_MeshInfosDlg()
64 // purpose : Constructor
65 //=================================================================================
66 SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg (SMESHGUI* theModule,
70 QDialog(SMESH::GetDesktop(theModule),
73 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
74 mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
78 setName("SMESHGUI_MeshInfosDlg");
79 setCaption(tr("SMESH_MESHINFO_TITLE"));
80 setSizeGripEnabled(TRUE);
82 myStartSelection = true;
83 myIsActiveWindow = true;
85 QVBoxLayout* aTopLayout = new QVBoxLayout(this);
86 aTopLayout->setSpacing(6); aTopLayout->setMargin(11);
88 // select button & label
89 QPixmap image0(SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH",tr("ICON_SELECT")));
90 mySelectBtn = new QPushButton(this, "mySelectBtn");
91 mySelectBtn->setPixmap(image0);
92 mySelectBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
94 mySelectLab = new QLabel(this, "mySelectLab");
95 mySelectLab->setAlignment(AlignCenter);
96 QFont fnt = mySelectLab->font(); fnt.setBold(true);
97 mySelectLab->setFont(fnt);
99 QHBoxLayout* aSelectLayout = new QHBoxLayout;
100 aSelectLayout->setMargin(0); aSelectLayout->setSpacing(0);
101 aSelectLayout->addWidget(mySelectBtn);
102 aSelectLayout->addWidget(mySelectLab);
105 myWGStack = new QWidgetStack(this);
107 // no valid selection
108 QWidget* myBadWidget = new QWidget(myWGStack);
109 QVBoxLayout* aBadLayout = new QVBoxLayout(myBadWidget);
110 QLabel* myBadLab = new QLabel(tr("SMESH_BAD_SELECTION"), myBadWidget, "myBadLab");
111 myBadLab->setAlignment(Qt::AlignCenter);
112 myBadLab->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
113 aBadLayout->addWidget(myBadLab);
114 myWGStack->addWidget(myBadWidget, 0);
117 myMeshWidget = new QWidget(myWGStack);
118 QGridLayout* aMeshLayout = new QGridLayout(myMeshWidget);
119 aMeshLayout->setSpacing(6); aMeshLayout->setMargin(0);
120 myWGStack->addWidget(myMeshWidget);
123 QLabel* myMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myMeshWidget, "myMeshNameLab");
124 myMeshName = new QLabel(myMeshWidget, "myMeshName");
125 myMeshName->setMinimumWidth(100);
126 QFrame* line1 = new QFrame(myMeshWidget);
127 line1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
130 QLabel* myMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), myMeshWidget, "myMeshNbNodesLab");
131 myMeshNbNodes = new QLabel(myMeshWidget, "myMeshNbNodes");
132 myMeshNbNodes->setMinimumWidth(100);
135 QLabel* myMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), myMeshWidget, "myMeshNbEdgesLab");
136 myMeshNbEdges = new QLabel(myMeshWidget, "myMeshNbEdges");
137 myMeshNbEdges->setMinimumWidth(100);
140 myMeshFacesGroup = new QGroupBox(tr("SMESH_MESHINFO_FACES"), myMeshWidget, "myMeshFacesGroup");
141 myMeshFacesGroup->setColumnLayout(0, Qt::Vertical);
142 myMeshFacesGroup->layout()->setSpacing(0); myMeshFacesGroup->layout()->setMargin(0);
143 QGridLayout* myMeshFacesGroupLayout = new QGridLayout(myMeshFacesGroup->layout());
144 myMeshFacesGroupLayout->setAlignment(Qt::AlignTop);
145 myMeshFacesGroupLayout->setSpacing(6); myMeshFacesGroupLayout->setMargin(11);
147 // --> faces --> total
148 QLabel* myMeshNbFacesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), myMeshFacesGroup, "myMeshNbFacesLab");
149 myMeshNbFacesLab->setFont(fnt);
150 myMeshNbFaces = new QLabel(myMeshFacesGroup, "myMeshNbFaces");
151 myMeshNbFaces->setMinimumWidth(100);
152 myMeshNbFaces->setFont(fnt);
154 // --> faces --> triangles
155 QLabel* myMeshNbTrianglesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TRIANGLES")), myMeshFacesGroup, "myMeshNbTrianglesLab");
156 myMeshNbTriangles = new QLabel(myMeshFacesGroup, "myMeshNbTriangles");
157 myMeshNbTriangles->setMinimumWidth(100);
159 // --> faces --> quadrangles
160 QLabel* myMeshNbQuadranglesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_QUADRANGLES")), myMeshFacesGroup, "myMeshNbQuadranglesLab");
161 myMeshNbQuadrangles = new QLabel(myMeshFacesGroup, "myMeshNbQuadrangles");
162 myMeshNbQuadrangles->setMinimumWidth(100);
164 // --> faces --> polygons
165 QLabel* myMeshNbPolygonesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYGONES" ) ), myMeshFacesGroup, "myMeshNbPolygonesLab" );
166 myMeshNbPolygones = new QLabel( myMeshFacesGroup, "myMeshNbPolygones" );
167 myMeshNbPolygones->setMinimumWidth( 100 );
169 myMeshFacesGroupLayout->addWidget(myMeshNbFacesLab, 0, 0);
170 myMeshFacesGroupLayout->addWidget(myMeshNbFaces, 0, 1);
171 myMeshFacesGroupLayout->addWidget(myMeshNbTrianglesLab, 1, 0);
172 myMeshFacesGroupLayout->addWidget(myMeshNbTriangles, 1, 1);
173 myMeshFacesGroupLayout->addWidget(myMeshNbQuadranglesLab, 2, 0);
174 myMeshFacesGroupLayout->addWidget(myMeshNbQuadrangles, 2, 1);
175 myMeshFacesGroupLayout->addWidget( myMeshNbPolygonesLab, 3, 0 );
176 myMeshFacesGroupLayout->addWidget( myMeshNbPolygones, 3, 1 );
179 myMeshVolumesGroup = new QGroupBox(tr("SMESH_MESHINFO_VOLUMES"), myMeshWidget, "myMeshVolumesGroup");
180 myMeshVolumesGroup->setColumnLayout(0, Qt::Vertical);
181 myMeshVolumesGroup->layout()->setSpacing(0); myMeshVolumesGroup->layout()->setMargin(0);
182 QGridLayout* myMeshVolumesGroupLayout = new QGridLayout(myMeshVolumesGroup->layout());
183 myMeshVolumesGroupLayout->setAlignment(Qt::AlignTop);
184 myMeshVolumesGroupLayout->setSpacing(6); myMeshVolumesGroupLayout->setMargin(11);
186 // --> volumes --> total
187 QLabel* myMeshNbVolumesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), myMeshVolumesGroup, "myMeshNbVolumesLab");
188 myMeshNbVolumesLab->setFont(fnt);
189 myMeshNbVolumes = new QLabel(myMeshVolumesGroup, "myMeshNbVolumes");
190 myMeshNbVolumes->setMinimumWidth(100);
191 myMeshNbVolumes->setFont(fnt);
193 // --> volumes --> tetrahedrons
194 QLabel* myMeshNbTetraLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TETRAS")), myMeshVolumesGroup, "myMeshNbTetraLab");
195 myMeshNbTetra = new QLabel(myMeshVolumesGroup, "myMeshNbTetra");
196 myMeshNbTetra->setMinimumWidth(100);
198 // --> volumes --> hexahedrons
199 QLabel* myMeshNbHexaLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_HEXAS")), myMeshVolumesGroup, "myMeshNbHexaLab");
200 myMeshNbHexa = new QLabel(myMeshVolumesGroup, "myMeshNbHexa");
201 myMeshNbHexaLab->setMinimumWidth(100);
203 // --> volumes --> prisms
204 QLabel* myMeshNbPrismLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PRISMS")), myMeshVolumesGroup, "myMeshNbPrismLab");
205 myMeshNbPrism = new QLabel(myMeshVolumesGroup, "myMeshNbPrism");
206 myMeshNbPrism->setMinimumWidth(100);
208 // --> volumes --> pyramids
209 QLabel* myMeshNbPyraLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PYRAS")), myMeshVolumesGroup, "myMeshNbPyraLab");
210 myMeshNbPyra = new QLabel(myMeshVolumesGroup, "myMeshNbPyra");
211 myMeshNbPyra->setMinimumWidth(100);
213 // --> volumes --> polyherones
214 QLabel* myMeshNbPolyhedronesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYEDRES" ) ), myMeshVolumesGroup, "myMeshNbPolyhedronLab" );
215 myMeshNbPolyhedrones = new QLabel( myMeshVolumesGroup, "myMeshNbPolyhedrones" );
216 myMeshNbPolyhedrones->setMinimumWidth( 100 );
218 myMeshVolumesGroupLayout->addWidget(myMeshNbVolumesLab, 0, 0);
219 myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes, 0, 1);
220 myMeshVolumesGroupLayout->addWidget(myMeshNbTetraLab, 1, 0);
221 myMeshVolumesGroupLayout->addWidget(myMeshNbTetra, 1, 1);
222 myMeshVolumesGroupLayout->addWidget(myMeshNbHexaLab, 2, 0);
223 myMeshVolumesGroupLayout->addWidget(myMeshNbHexa, 2, 1);
224 myMeshVolumesGroupLayout->addWidget(myMeshNbPrismLab, 3, 0);
225 myMeshVolumesGroupLayout->addWidget(myMeshNbPrism, 3, 1);
226 myMeshVolumesGroupLayout->addWidget(myMeshNbPyraLab, 4, 0);
227 myMeshVolumesGroupLayout->addWidget(myMeshNbPyra, 4, 1);
228 myMeshVolumesGroupLayout->addWidget( myMeshNbPolyhedronesLab, 5, 0 );
229 myMeshVolumesGroupLayout->addWidget( myMeshNbPolyhedrones, 5, 1 );
231 aMeshLayout->addWidget(myMeshNameLab, 0, 0);
232 aMeshLayout->addWidget(myMeshName, 0, 1);
233 aMeshLayout->addMultiCellWidget(line1, 1, 1, 0, 1);
234 aMeshLayout->addWidget(myMeshNbNodesLab, 2, 0);
235 aMeshLayout->addWidget(myMeshNbNodes, 2, 1);
236 aMeshLayout->addWidget(myMeshNbEdgesLab, 3, 0);
237 aMeshLayout->addWidget(myMeshNbEdges, 3, 1);
238 aMeshLayout->addMultiCellWidget(myMeshFacesGroup, 4, 4, 0, 1);
239 aMeshLayout->addMultiCellWidget(myMeshVolumesGroup, 5, 5, 0, 1);
240 aMeshLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding), 6, 0);
243 mySubMeshWidget = new QWidget(myWGStack);
244 QGridLayout* aSubMeshLayout = new QGridLayout(mySubMeshWidget);
245 aSubMeshLayout->setSpacing(6); aSubMeshLayout->setMargin(0);
246 myWGStack->addWidget(mySubMeshWidget);
249 QLabel* mySubMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), mySubMeshWidget, "mySubMeshNameLab");
250 mySubMeshName = new QLabel(mySubMeshWidget, "mySubMeshName");
251 mySubMeshName->setMinimumWidth(100);
252 QFrame* line2 = new QFrame(mySubMeshWidget);
253 line2->setFrameStyle(QFrame::HLine | QFrame::Sunken);
256 QLabel* mySubMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), mySubMeshWidget, "mySubMeshNbNodesLab");
257 mySubMeshNbNodes = new QLabel(mySubMeshWidget, "mySubMeshNbNodes");
258 mySubMeshNbNodes->setMinimumWidth(100);
261 mySubMeshElementsGroup = new QGroupBox(tr("SMESH_MESHINFO_ELEMENTS"), mySubMeshWidget, "mySubMeshElementsGroup");
262 mySubMeshElementsGroup->setColumnLayout(0, Qt::Vertical);
263 mySubMeshElementsGroup->layout()->setSpacing(0); mySubMeshElementsGroup->layout()->setMargin(0);
264 QGridLayout* mySubMeshElementsGroupLayout = new QGridLayout(mySubMeshElementsGroup->layout());
265 mySubMeshElementsGroupLayout->setAlignment(Qt::AlignTop);
266 mySubMeshElementsGroupLayout->setSpacing(6); mySubMeshElementsGroupLayout->setMargin(11);
268 // --> elements --> total
269 QLabel* mySubMeshNbElementsLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), mySubMeshElementsGroup, "mySubMeshNbElementsLab");
270 mySubMeshNbElementsLab->setFont(fnt);
271 mySubMeshNbElements = new QLabel(mySubMeshElementsGroup, "mySubMeshNbElements");
272 mySubMeshNbElements->setMinimumWidth(100);
273 mySubMeshNbElements->setFont(fnt);
275 // --> elements --> edges
276 QLabel* mySubMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), mySubMeshElementsGroup, "mySubMeshNbEdgesLab");
277 mySubMeshNbEdges = new QLabel(mySubMeshElementsGroup, "mySubMeshNbEdges");
278 mySubMeshNbEdges->setMinimumWidth(100);
280 // --> elements --> faces
281 QLabel* mySubMeshNbFacesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), mySubMeshElementsGroup, "mySubMeshNbFacesLab");
282 mySubMeshNbFaces = new QLabel(mySubMeshElementsGroup, "mySubMeshNbFaces");
283 mySubMeshNbFaces->setMinimumWidth(100);
285 // --> elements --> volumes
286 QLabel* mySubMeshNbVolumesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), mySubMeshElementsGroup, "mySubMeshNbVolumesLab");
287 mySubMeshNbVolumes = new QLabel(mySubMeshElementsGroup, "mySubMeshNbVolumes");
288 mySubMeshNbVolumes->setMinimumWidth(100);
290 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbElementsLab, 0, 0);
291 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbElements, 0, 1);
292 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdgesLab, 1, 0);
293 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdges, 1, 1);
294 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFacesLab, 2, 0);
295 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFaces, 2, 1);
296 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumesLab, 3, 0);
297 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumes, 3, 1);
299 aSubMeshLayout->addWidget(mySubMeshNameLab, 0, 0);
300 aSubMeshLayout->addWidget(mySubMeshName, 0, 1);
301 aSubMeshLayout->addMultiCellWidget(line2, 1, 1, 0, 1);
302 aSubMeshLayout->addWidget(mySubMeshNbNodesLab, 2, 0);
303 aSubMeshLayout->addWidget(mySubMeshNbNodes, 2, 1);
304 aSubMeshLayout->addMultiCellWidget(mySubMeshElementsGroup, 3, 3, 0, 1);
305 aSubMeshLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0);
308 myGroupWidget = new QWidget(myWGStack);
309 QGridLayout* myGroupWidgetLayout = new QGridLayout(myGroupWidget);
310 myGroupWidgetLayout->setSpacing(6); myGroupWidgetLayout->setMargin(0);
311 myWGStack->addWidget(myGroupWidget);
314 QLabel* myGroupNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myGroupWidget, "myGroupNameLab");
315 myGroupName = new QLabel(myGroupWidget, "myGroupName");
316 myGroupName->setMinimumWidth(100);
317 QFrame* line3 = new QFrame(myGroupWidget);
318 line3->setFrameStyle(QFrame::HLine | QFrame::Sunken);
321 QLabel* myGroupTypeLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TYPE")), myGroupWidget, "myGroupTypeLab");
322 myGroupType = new QLabel(myGroupWidget, "myGroupType");
323 myGroupType->setMinimumWidth(100);
325 // --> number of entities
326 QLabel* myGroupNbLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_ENTITIES")), myGroupWidget, "myGroupNbLab");
327 myGroupNb = new QLabel(myGroupWidget, "myGroupNb");
328 myGroupNb->setMinimumWidth(100);
330 myGroupWidgetLayout->addWidget(myGroupNameLab, 0, 0);
331 myGroupWidgetLayout->addWidget(myGroupName, 0, 1);
332 myGroupWidgetLayout->addMultiCellWidget(line3, 1, 1, 0, 1);
333 myGroupWidgetLayout->addWidget(myGroupTypeLab, 2, 0);
334 myGroupWidgetLayout->addWidget(myGroupType, 2, 1);
335 myGroupWidgetLayout->addWidget(myGroupNbLab, 3, 0);
336 myGroupWidgetLayout->addWidget(myGroupNb, 3, 1);
337 myGroupWidgetLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0);
340 myButtonsGroup = new QGroupBox(this, "myButtonsGroup");
341 myButtonsGroup->setColumnLayout(0, Qt::Vertical);
342 myButtonsGroup->layout()->setSpacing(0); myButtonsGroup->layout()->setMargin(0);
343 QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout(myButtonsGroup->layout());
344 myButtonsGroupLayout->setAlignment(Qt::AlignTop);
345 myButtonsGroupLayout->setSpacing(6); myButtonsGroupLayout->setMargin(11);
347 // buttons --> OK button
348 myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), myButtonsGroup, "myOkBtn");
349 myOkBtn->setAutoDefault(TRUE); myOkBtn->setDefault(TRUE);
350 myButtonsGroupLayout->addStretch();
351 myButtonsGroupLayout->addWidget(myOkBtn);
352 myButtonsGroupLayout->addStretch();
354 aTopLayout->addLayout(aSelectLayout);
355 aTopLayout->addWidget(myWGStack);
356 aTopLayout->addWidget(myButtonsGroup);
358 mySMESHGUI->SetActiveDialogBox(this);
361 connect(myOkBtn, SIGNAL(clicked()), this, SLOT(close()));
362 connect(mySelectBtn, SIGNAL(clicked()), this, SLOT(onStartSelection()));
363 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(close()));
364 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
365 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
367 // resize and move dialog, then show
369 mySMESHGUI->DefineDlgPosition(this, x, y);
373 // init dialog with current selection
374 onSelectionChanged();
377 //=================================================================================
378 // function : ~SMESHGUI_MeshInfosDlg()
379 // purpose : Destructor
380 //=================================================================================
381 SMESHGUI_MeshInfosDlg::~SMESHGUI_MeshInfosDlg()
385 //=================================================================================
386 // function : DumpMeshInfos()
388 //=================================================================================
389 void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
391 SUIT_OverrideCursor wc;
394 mySelectionMgr->selectedObjects(aList);
396 int nbSel = aList.Extent();
398 myStartSelection = false;
399 mySelectLab->setText("");
400 Handle(SALOME_InteractiveObject) IObject = aList.First();
401 _PTR(SObject) aSO = SMESH::GetActiveStudyDocument()->FindObjectID(IObject->getEntry());
403 //CORBA::Object_var anObject = aSO->GetObject();
404 CORBA::Object_var anObject = SMESH::SObjectToObject(aSO);
405 if (!CORBA::is_nil(anObject)) {
406 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObject);
407 if (!aMesh->_is_nil()) {
408 myWGStack->raiseWidget(myMeshWidget);
409 setCaption(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_OBJECT_MESH") + "]");
410 myMeshName->setText(aSO->GetName().c_str());
411 myMeshNbNodes->setNum((int)aMesh->NbNodes());
412 myMeshNbEdges->setNum((int)aMesh->NbEdges());
413 myMeshNbFaces->setNum((int)aMesh->NbFaces());
414 myMeshNbTriangles->setNum((int)aMesh->NbTriangles());
415 myMeshNbQuadrangles->setNum((int)aMesh->NbQuadrangles());
416 myMeshNbPolygones->setNum( (int)aMesh->NbPolygons() );
417 myMeshNbVolumes->setNum((int)aMesh->NbVolumes());
418 myMeshNbTetra->setNum((int)aMesh->NbTetras());
419 myMeshNbHexa->setNum((int)aMesh->NbHexas());
420 myMeshNbPrism->setNum((int)aMesh->NbPrisms());
421 myMeshNbPyra->setNum((int)aMesh->NbPyramids());
422 myMeshNbPolyhedrones->setNum( (int)aMesh->NbPolyhedrons() );
425 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObject);
426 if (!aSubMesh->_is_nil()) {
427 myWGStack->raiseWidget(mySubMeshWidget);
428 setCaption(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_SUBMESH") + "]");
429 mySubMeshName->setText(aSO->GetName().c_str());
430 mySubMeshNbNodes->setNum((int)aSubMesh->GetNumberOfNodes(true));
431 mySubMeshNbElements->setNum((int)aSubMesh->GetNumberOfElements());
432 mySubMeshNbEdges->setNum((int)(aSubMesh->GetElementsByType(SMESH::EDGE)->length()));
433 mySubMeshNbFaces->setNum((int)(aSubMesh->GetElementsByType(SMESH::FACE)->length()));
434 mySubMeshNbVolumes->setNum((int)(aSubMesh->GetElementsByType(SMESH::VOLUME)->length()));
437 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
438 if (!aGroup->_is_nil()) {
439 myWGStack->raiseWidget(myGroupWidget);
440 setCaption(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_GROUP") + "]");
441 myGroupName->setText(aSO->GetName().c_str());
442 int aType = aGroup->GetType();
446 strType = "SMESH_MESHINFO_NODES"; break;
448 strType = "SMESH_MESHINFO_EDGES"; break;
450 strType = "SMESH_MESHINFO_FACES"; break;
452 strType = "SMESH_MESHINFO_VOLUMES"; break;
454 strType = "SMESH_MESHINFO_ALL_TYPES"; break;
457 myGroupType->setText(tr(strType));
458 myGroupNb->setNum((int)aGroup->Size());
464 myWGStack->raiseWidget(0);
465 setCaption(tr("SMESH_MESHINFO_TITLE"));
468 //=================================================================================
469 // function : SelectionIntoArgument()
470 // purpose : Called when selection has changed
471 //=================================================================================
472 void SMESHGUI_MeshInfosDlg::onSelectionChanged()
474 if (myStartSelection)
478 //=================================================================================
479 // function : closeEvent()
481 //=================================================================================
482 void SMESHGUI_MeshInfosDlg::closeEvent (QCloseEvent* e)
484 mySMESHGUI->ResetState();
485 QDialog::closeEvent(e);
488 //=================================================================================
489 // function : windowActivationChange()
490 // purpose : called when window is activated/deactivated
491 //=================================================================================
492 void SMESHGUI_MeshInfosDlg::windowActivationChange (bool oldActive)
494 QDialog::windowActivationChange(oldActive);
495 if (isActiveWindow() && myIsActiveWindow != isActiveWindow())
496 ActivateThisDialog();
497 myIsActiveWindow = isActiveWindow();
500 //=================================================================================
501 // function : DeactivateActiveDialog()
503 //=================================================================================
504 void SMESHGUI_MeshInfosDlg::DeactivateActiveDialog()
506 disconnect(mySelectionMgr, 0, this, 0);
509 //=================================================================================
510 // function : ActivateThisDialog()
512 //=================================================================================
513 void SMESHGUI_MeshInfosDlg::ActivateThisDialog()
515 /* Emit a signal to deactivate any active dialog */
516 mySMESHGUI->EmitSignalDeactivateDialog();
517 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
520 //=================================================================================
521 // function : onStartSelection()
522 // purpose : starts selection
523 //=================================================================================
524 void SMESHGUI_MeshInfosDlg::onStartSelection()
526 myStartSelection = true;
527 onSelectionChanged();
528 myStartSelection = true;
529 mySelectLab->setText(tr("INF_SELECT_OBJECT"));