1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // SMESH SMESHGUI : GUI for SMESH component
23 // File : SMESHGUI_MeshInfosDlg.cxx
24 // Author : Nicolas BARBEROU
27 #include "SMESHGUI_MeshInfosDlg.h"
30 #include "SMESHGUI_Utils.h"
32 // SALOME GUI includes
33 #include <SUIT_Desktop.h>
34 #include <SUIT_ResourceMgr.h>
35 #include <SUIT_OverrideCursor.h>
36 #include <SUIT_Session.h>
37 #include <SUIT_MessageBox.h>
39 #include <LightApp_SelectionMgr.h>
40 #include <LightApp_Application.h>
41 #include <SALOME_ListIO.hxx>
43 // SALOME KERNEL includes
44 #include <SALOMEDSClient_Study.hxx>
50 #include <QStackedWidget>
51 #include <QVBoxLayout>
52 #include <QHBoxLayout>
53 #include <QGridLayout>
54 #include <QPushButton>
58 #include <SALOMEconfig.h>
59 #include CORBA_SERVER_HEADER(SMESH_Mesh)
60 #include CORBA_SERVER_HEADER(SMESH_Group)
62 #define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" )
66 //=================================================================================
67 // function : SMESHGUI_MeshInfosDlg()
68 // purpose : Constructor
69 //=================================================================================
70 SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg(SMESHGUI* theModule):
71 QDialog(SMESH::GetDesktop(theModule)),
72 mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
76 setAttribute( Qt::WA_DeleteOnClose, true );
77 setWindowTitle(tr("SMESH_MESHINFO_TITLE"));
78 setSizeGripEnabled(true);
80 myStartSelection = true;
81 myIsActiveWindow = true;
83 QVBoxLayout* aTopLayout = new QVBoxLayout(this);
84 aTopLayout->setSpacing(SPACING); aTopLayout->setMargin(MARGIN);
86 // select button & label
87 QPixmap image0(SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH",tr("ICON_SELECT")));
88 mySelectBtn = new QPushButton(this);
89 mySelectBtn->setIcon(image0);
90 mySelectBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
92 mySelectLab = new QLabel(this);
93 mySelectLab->setAlignment(Qt::AlignCenter);
94 QFont fnt = mySelectLab->font(); fnt.setBold(true);
95 mySelectLab->setFont(fnt);
97 QHBoxLayout* aSelectLayout = new QHBoxLayout;
98 aSelectLayout->setMargin(0); aSelectLayout->setSpacing(0);
99 aSelectLayout->addWidget(mySelectBtn);
100 aSelectLayout->addWidget(mySelectLab);
103 myWGStack = new QStackedWidget(this);
105 // no valid selection
106 QWidget* myBadWidget = new QWidget(myWGStack);
107 QVBoxLayout* aBadLayout = new QVBoxLayout(myBadWidget);
108 QLabel* myBadLab = new QLabel(tr("SMESH_BAD_SELECTION"), myBadWidget);
109 myBadLab->setAlignment(Qt::AlignCenter);
110 myBadLab->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
111 aBadLayout->addWidget(myBadLab);
112 myWGStack->addWidget(myBadWidget);
115 myMeshWidget = new QWidget(myWGStack);
116 QGridLayout* aMeshLayout = new QGridLayout(myMeshWidget);
117 aMeshLayout->setSpacing(SPACING); aMeshLayout->setMargin(0);
118 myWGStack->addWidget(myMeshWidget);
121 QLabel* myMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myMeshWidget);
122 myMeshName = new QLabel(myMeshWidget);
123 myMeshName->setMinimumWidth(100);
124 QFrame* line1 = new QFrame(myMeshWidget);
125 line1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
128 QLabel* myMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), myMeshWidget);
129 myMeshNbNodes = new QLabel(myMeshWidget);
130 myMeshNbNodes->setMinimumWidth(100);
132 // --> header with orders
133 QLabel* myMeshOrder0Lab = new QLabel(tr("SMESH_MESHINFO_ORDER0"), myMeshWidget);
134 QLabel* myMeshOrder1Lab = new QLabel(tr("SMESH_MESHINFO_ORDER1"), myMeshWidget);
135 QLabel* myMeshOrder2Lab = new QLabel(tr("SMESH_MESHINFO_ORDER2"), myMeshWidget);
136 QFont fnti = myMeshOrder0Lab->font(); fnti.setItalic(true);
137 myMeshOrder0Lab->setFont(fnti);
138 myMeshOrder1Lab->setFont(fnti);
139 myMeshOrder2Lab->setFont(fnti);
142 QLabel* myMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), myMeshWidget);
143 myMeshNbEdges = new QLabel(myMeshWidget);
144 myMeshNbEdges->setMinimumWidth(100);
145 myMeshNbEdges1 = new QLabel(myMeshWidget);
146 myMeshNbEdges1->setMinimumWidth(100);
147 myMeshNbEdges2 = new QLabel(myMeshWidget);
148 myMeshNbEdges2->setMinimumWidth(100);
151 myMeshFacesGroup = new QGroupBox(tr("SMESH_MESHINFO_FACES"), myMeshWidget);
152 QGridLayout* myMeshFacesGroupLayout = new QGridLayout(myMeshFacesGroup);
153 myMeshFacesGroupLayout->setSpacing(SPACING); myMeshFacesGroupLayout->setMargin(MARGIN);
155 // --> faces --> total
156 QLabel* myMeshNbFacesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), myMeshFacesGroup);
157 myMeshNbFacesLab->setFont(fnt);
158 myMeshNbFaces = new QLabel(myMeshFacesGroup);
159 myMeshNbFaces->setMinimumWidth(100);
160 myMeshNbFaces->setFont(fnt);
161 myMeshNbFaces1 = new QLabel(myMeshFacesGroup);
162 myMeshNbFaces1->setMinimumWidth(100);
163 myMeshNbFaces1->setFont(fnt);
164 myMeshNbFaces2 = new QLabel(myMeshFacesGroup);
165 myMeshNbFaces2->setMinimumWidth(100);
166 myMeshNbFaces2->setFont(fnt);
168 // --> faces --> triangles
169 QLabel* myMeshNbTrianglesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TRIANGLES")), myMeshFacesGroup);
170 myMeshNbTriangles = new QLabel(myMeshFacesGroup);
171 myMeshNbTriangles->setMinimumWidth(100);
172 myMeshNbTriangles1 = new QLabel(myMeshFacesGroup);
173 myMeshNbTriangles1->setMinimumWidth(100);
174 myMeshNbTriangles2 = new QLabel(myMeshFacesGroup);
175 myMeshNbTriangles2->setMinimumWidth(100);
177 // --> faces --> quadrangles
178 QLabel* myMeshNbQuadranglesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_QUADRANGLES")), myMeshFacesGroup);
179 myMeshNbQuadrangles = new QLabel(myMeshFacesGroup);
180 myMeshNbQuadrangles->setMinimumWidth(100);
181 myMeshNbQuadrangles1 = new QLabel(myMeshFacesGroup);
182 myMeshNbQuadrangles1->setMinimumWidth(100);
183 myMeshNbQuadrangles2 = new QLabel(myMeshFacesGroup);
184 myMeshNbQuadrangles2->setMinimumWidth(100);
186 // --> faces --> polygons
187 QLabel* myMeshNbPolygonesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYGONES" ) ), myMeshFacesGroup );
188 myMeshNbPolygones = new QLabel( myMeshFacesGroup );
189 myMeshNbPolygones->setMinimumWidth( 100 );
191 myMeshFacesGroupLayout->addWidget(myMeshNbFacesLab, 0, 0);
192 myMeshFacesGroupLayout->addWidget(myMeshNbFaces, 0, 1);
193 myMeshFacesGroupLayout->addWidget(myMeshNbFaces1, 0, 2);
194 myMeshFacesGroupLayout->addWidget(myMeshNbFaces2, 0, 3);
195 myMeshFacesGroupLayout->addWidget(myMeshNbTrianglesLab, 1, 0);
196 myMeshFacesGroupLayout->addWidget(myMeshNbTriangles, 1, 1);
197 myMeshFacesGroupLayout->addWidget(myMeshNbTriangles1, 1, 2);
198 myMeshFacesGroupLayout->addWidget(myMeshNbTriangles2, 1, 3);
199 myMeshFacesGroupLayout->addWidget(myMeshNbQuadranglesLab, 2, 0);
200 myMeshFacesGroupLayout->addWidget(myMeshNbQuadrangles, 2, 1);
201 myMeshFacesGroupLayout->addWidget(myMeshNbQuadrangles1, 2, 2);
202 myMeshFacesGroupLayout->addWidget(myMeshNbQuadrangles2, 2, 3);
203 myMeshFacesGroupLayout->addWidget(myMeshNbPolygonesLab, 3, 0);
204 myMeshFacesGroupLayout->addWidget(myMeshNbPolygones, 3, 1);
207 myMeshVolumesGroup = new QGroupBox(tr("SMESH_MESHINFO_VOLUMES"), myMeshWidget);
208 QGridLayout* myMeshVolumesGroupLayout = new QGridLayout(myMeshVolumesGroup);
209 myMeshVolumesGroupLayout->setSpacing(SPACING); myMeshVolumesGroupLayout->setMargin(MARGIN);
211 // --> volumes --> total
212 QLabel* myMeshNbVolumesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), myMeshVolumesGroup);
213 myMeshNbVolumesLab->setFont(fnt);
214 myMeshNbVolumes = new QLabel(myMeshVolumesGroup);
215 myMeshNbVolumes->setMinimumWidth(100);
216 myMeshNbVolumes->setFont(fnt);
217 myMeshNbVolumes1 = new QLabel(myMeshVolumesGroup);
218 myMeshNbVolumes1->setMinimumWidth(100);
219 myMeshNbVolumes1->setFont(fnt);
220 myMeshNbVolumes2 = new QLabel(myMeshVolumesGroup);
221 myMeshNbVolumes2->setMinimumWidth(100);
222 myMeshNbVolumes2->setFont(fnt);
224 // --> volumes --> tetrahedrons
225 QLabel* myMeshNbTetraLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TETRAS")), myMeshVolumesGroup);
226 myMeshNbTetra = new QLabel(myMeshVolumesGroup);
227 myMeshNbTetra->setMinimumWidth(100);
228 myMeshNbTetra1 = new QLabel(myMeshVolumesGroup);
229 myMeshNbTetra1->setMinimumWidth(100);
230 myMeshNbTetra2 = new QLabel(myMeshVolumesGroup);
231 myMeshNbTetra2->setMinimumWidth(100);
233 // --> volumes --> hexahedrons
234 QLabel* myMeshNbHexaLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_HEXAS")), myMeshVolumesGroup);
235 myMeshNbHexa = new QLabel(myMeshVolumesGroup);
236 myMeshNbHexa->setMinimumWidth(100);
237 myMeshNbHexa1 = new QLabel(myMeshVolumesGroup);
238 myMeshNbHexa1->setMinimumWidth(100);
239 myMeshNbHexa2 = new QLabel(myMeshVolumesGroup);
240 myMeshNbHexa2->setMinimumWidth(100);
242 // --> volumes --> prisms
243 QLabel* myMeshNbPrismLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PRISMS")), myMeshVolumesGroup);
244 myMeshNbPrism = new QLabel(myMeshVolumesGroup);
245 myMeshNbPrism->setMinimumWidth(100);
246 myMeshNbPrism1 = new QLabel(myMeshVolumesGroup);
247 myMeshNbPrism1->setMinimumWidth(100);
248 myMeshNbPrism2 = new QLabel(myMeshVolumesGroup);
249 myMeshNbPrism2->setMinimumWidth(100);
251 // --> volumes --> pyramids
252 QLabel* myMeshNbPyraLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PYRAS")), myMeshVolumesGroup);
253 myMeshNbPyra = new QLabel(myMeshVolumesGroup);
254 myMeshNbPyra->setMinimumWidth(100);
255 myMeshNbPyra1 = new QLabel(myMeshVolumesGroup);
256 myMeshNbPyra1->setMinimumWidth(100);
257 myMeshNbPyra2 = new QLabel(myMeshVolumesGroup);
258 myMeshNbPyra2->setMinimumWidth(100);
260 // --> volumes --> polyherones
261 QLabel* myMeshNbPolyhedronesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYEDRES" ) ), myMeshVolumesGroup );
262 myMeshNbPolyhedrones = new QLabel( myMeshVolumesGroup );
263 myMeshNbPolyhedrones->setMinimumWidth( 100 );
265 myMeshVolumesGroupLayout->addWidget(myMeshNbVolumesLab, 0, 0);
266 myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes, 0, 1);
267 myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes1, 0, 2);
268 myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes2, 0, 3);
269 myMeshVolumesGroupLayout->addWidget(myMeshNbTetraLab, 1, 0);
270 myMeshVolumesGroupLayout->addWidget(myMeshNbTetra, 1, 1);
271 myMeshVolumesGroupLayout->addWidget(myMeshNbTetra1, 1, 2);
272 myMeshVolumesGroupLayout->addWidget(myMeshNbTetra2, 1, 3);
273 myMeshVolumesGroupLayout->addWidget(myMeshNbHexaLab, 2, 0);
274 myMeshVolumesGroupLayout->addWidget(myMeshNbHexa, 2, 1);
275 myMeshVolumesGroupLayout->addWidget(myMeshNbHexa1, 2, 2);
276 myMeshVolumesGroupLayout->addWidget(myMeshNbHexa2, 2, 3);
277 myMeshVolumesGroupLayout->addWidget(myMeshNbPrismLab, 3, 0);
278 myMeshVolumesGroupLayout->addWidget(myMeshNbPrism, 3, 1);
279 myMeshVolumesGroupLayout->addWidget(myMeshNbPrism1, 3, 2);
280 myMeshVolumesGroupLayout->addWidget(myMeshNbPrism2, 3, 3);
281 myMeshVolumesGroupLayout->addWidget(myMeshNbPyraLab, 4, 0);
282 myMeshVolumesGroupLayout->addWidget(myMeshNbPyra, 4, 1);
283 myMeshVolumesGroupLayout->addWidget(myMeshNbPyra1, 4, 2);
284 myMeshVolumesGroupLayout->addWidget(myMeshNbPyra2, 4, 3);
285 myMeshVolumesGroupLayout->addWidget(myMeshNbPolyhedronesLab, 5, 0);
286 myMeshVolumesGroupLayout->addWidget(myMeshNbPolyhedrones, 5, 1);
288 aMeshLayout->addWidget(myMeshNameLab, 0, 0);
289 aMeshLayout->addWidget(myMeshName, 0, 1);
290 aMeshLayout->addWidget(line1, 1, 0, 1, 2);
291 aMeshLayout->addWidget(myMeshNbNodesLab, 2, 0);
292 aMeshLayout->addWidget(myMeshNbNodes, 2, 1);
293 aMeshLayout->addWidget(myMeshOrder0Lab, 3, 1);
294 aMeshLayout->addWidget(myMeshOrder1Lab, 3, 2);
295 aMeshLayout->addWidget(myMeshOrder2Lab, 3, 3);
296 aMeshLayout->addWidget(myMeshNbEdgesLab, 4, 0);
297 aMeshLayout->addWidget(myMeshNbEdges, 4, 1);
298 aMeshLayout->addWidget(myMeshNbEdges1, 4, 2);
299 aMeshLayout->addWidget(myMeshNbEdges2, 4, 3);
300 aMeshLayout->addWidget(myMeshFacesGroup, 5, 0, 1, 4);
301 aMeshLayout->addWidget(myMeshVolumesGroup, 6, 0, 1, 4);
302 aMeshLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 7, 0);
305 mySubMeshWidget = new QWidget(myWGStack);
306 QGridLayout* aSubMeshLayout = new QGridLayout(mySubMeshWidget);
307 aSubMeshLayout->setSpacing(SPACING); aSubMeshLayout->setMargin(0);
308 myWGStack->addWidget(mySubMeshWidget);
311 QLabel* mySubMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), mySubMeshWidget);
312 mySubMeshName = new QLabel(mySubMeshWidget);
313 mySubMeshName->setMinimumWidth(100);
314 QFrame* line2 = new QFrame(mySubMeshWidget);
315 line2->setFrameStyle(QFrame::HLine | QFrame::Sunken);
318 QLabel* mySubMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), mySubMeshWidget);
319 mySubMeshNbNodes = new QLabel(mySubMeshWidget);
320 mySubMeshNbNodes->setMinimumWidth(100);
323 mySubMeshElementsGroup = new QGroupBox(tr("SMESH_MESHINFO_ELEMENTS"), mySubMeshWidget);
324 QGridLayout* mySubMeshElementsGroupLayout = new QGridLayout(mySubMeshElementsGroup);
325 mySubMeshElementsGroupLayout->setSpacing(SPACING); mySubMeshElementsGroupLayout->setMargin(MARGIN);
327 // --> elements --> total
328 QLabel* mySubMeshNbElementsLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), mySubMeshElementsGroup);
329 mySubMeshNbElementsLab->setFont(fnt);
330 mySubMeshNbElements = new QLabel(mySubMeshElementsGroup);
331 mySubMeshNbElements->setMinimumWidth(100);
332 mySubMeshNbElements->setFont(fnt);
334 // --> elements --> edges
335 QLabel* mySubMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), mySubMeshElementsGroup);
336 mySubMeshNbEdges = new QLabel(mySubMeshElementsGroup);
337 mySubMeshNbEdges->setMinimumWidth(100);
339 // --> elements --> faces
340 QLabel* mySubMeshNbFacesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), mySubMeshElementsGroup);
341 mySubMeshNbFaces = new QLabel(mySubMeshElementsGroup);
342 mySubMeshNbFaces->setMinimumWidth(100);
344 // --> elements --> volumes
345 QLabel* mySubMeshNbVolumesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), mySubMeshElementsGroup);
346 mySubMeshNbVolumes = new QLabel(mySubMeshElementsGroup);
347 mySubMeshNbVolumes->setMinimumWidth(100);
349 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbElementsLab, 0, 0);
350 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbElements, 0, 1);
351 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdgesLab, 1, 0);
352 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdges, 1, 1);
353 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFacesLab, 2, 0);
354 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFaces, 2, 1);
355 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumesLab, 3, 0);
356 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumes, 3, 1);
358 aSubMeshLayout->addWidget(mySubMeshNameLab, 0, 0);
359 aSubMeshLayout->addWidget(mySubMeshName, 0, 1);
360 aSubMeshLayout->addWidget(line2, 1, 0, 1, 2);
361 aSubMeshLayout->addWidget(mySubMeshNbNodesLab, 2, 0);
362 aSubMeshLayout->addWidget(mySubMeshNbNodes, 2, 1);
363 aSubMeshLayout->addWidget(mySubMeshElementsGroup, 3, 0, 1, 2);
364 aSubMeshLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0);
367 myGroupWidget = new QWidget(myWGStack);
368 QGridLayout* myGroupWidgetLayout = new QGridLayout(myGroupWidget);
369 myGroupWidgetLayout->setSpacing(SPACING); myGroupWidgetLayout->setMargin(0);
370 myWGStack->addWidget(myGroupWidget);
373 QLabel* myGroupNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myGroupWidget);
374 myGroupName = new QLabel(myGroupWidget);
375 myGroupName->setMinimumWidth(100);
376 QFrame* line3 = new QFrame(myGroupWidget);
377 line3->setFrameStyle(QFrame::HLine | QFrame::Sunken);
380 QLabel* myGroupTypeLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TYPE")), myGroupWidget);
381 myGroupType = new QLabel(myGroupWidget);
382 myGroupType->setMinimumWidth(100);
384 // --> number of entities
385 QLabel* myGroupNbLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_ENTITIES")), myGroupWidget);
386 myGroupNb = new QLabel(myGroupWidget);
387 myGroupNb->setMinimumWidth(100);
389 myGroupWidgetLayout->addWidget(myGroupNameLab, 0, 0);
390 myGroupWidgetLayout->addWidget(myGroupName, 0, 1);
391 myGroupWidgetLayout->addWidget(line3, 1, 0, 1, 2);
392 myGroupWidgetLayout->addWidget(myGroupTypeLab, 2, 0);
393 myGroupWidgetLayout->addWidget(myGroupType, 2, 1);
394 myGroupWidgetLayout->addWidget(myGroupNbLab, 3, 0);
395 myGroupWidgetLayout->addWidget(myGroupNb, 3, 1);
396 myGroupWidgetLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0);
399 myButtonsGroup = new QGroupBox(this);
400 QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout(myButtonsGroup);
401 myButtonsGroupLayout->setSpacing(SPACING); myButtonsGroupLayout->setMargin(MARGIN);
403 // buttons --> OK and Help buttons
404 myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), myButtonsGroup);
405 myOkBtn->setAutoDefault(true); myOkBtn->setDefault(true);
406 myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP" ), myButtonsGroup);
407 myHelpBtn->setAutoDefault(true);
409 myButtonsGroupLayout->addWidget(myOkBtn);
410 myButtonsGroupLayout->addSpacing(10);
411 myButtonsGroupLayout->addStretch();
412 myButtonsGroupLayout->addWidget(myHelpBtn);
414 aTopLayout->addLayout(aSelectLayout);
415 aTopLayout->addWidget(myWGStack);
416 aTopLayout->addWidget(myButtonsGroup);
418 mySMESHGUI->SetActiveDialogBox(this);
421 connect(myOkBtn, SIGNAL(clicked()), this, SLOT(close()));
422 connect( myHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp()));
423 connect(mySelectBtn, SIGNAL(clicked()), this, SLOT(onStartSelection()));
424 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(close()));
425 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
426 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
428 // init dialog with current selection
429 onSelectionChanged();
431 myHelpFileName = "mesh_infos_page.html#advanced_mesh_infos_anchor";
434 //=================================================================================
435 // function : ~SMESHGUI_MeshInfosDlg()
436 // purpose : Destructor
437 //=================================================================================
438 SMESHGUI_MeshInfosDlg::~SMESHGUI_MeshInfosDlg()
442 //=================================================================================
443 // function : DumpMeshInfos()
445 //=================================================================================
446 void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
448 SUIT_OverrideCursor wc;
451 mySelectionMgr->selectedObjects(aList);
453 int nbSel = aList.Extent();
455 myStartSelection = false;
456 mySelectLab->setText("");
457 Handle(SALOME_InteractiveObject) IObject = aList.First();
458 _PTR(SObject) aSO = SMESH::GetActiveStudyDocument()->FindObjectID(IObject->getEntry());
460 //CORBA::Object_var anObject = aSO->GetObject();
461 CORBA::Object_var anObject = SMESH::SObjectToObject(aSO);
462 if (!CORBA::is_nil(anObject)) {
463 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObject);
464 if (!aMesh->_is_nil()) {
465 myWGStack->setCurrentWidget(myMeshWidget);
466 setWindowTitle(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_OBJECT_MESH") + "]");
467 myMeshName->setText(aSO->GetName().c_str());
468 myMeshNbNodes->setNum((int)aMesh->NbNodes());
469 myMeshNbEdges->setNum((int)aMesh->NbEdges());
470 myMeshNbEdges1->setNum((int)aMesh->NbEdgesOfOrder(SMESH::ORDER_LINEAR));
471 myMeshNbEdges2->setNum((int)aMesh->NbEdgesOfOrder(SMESH::ORDER_QUADRATIC));
472 myMeshNbFaces->setNum((int)aMesh->NbFaces());
473 myMeshNbFaces1->setNum((int)aMesh->NbFacesOfOrder(SMESH::ORDER_LINEAR));
474 myMeshNbFaces2->setNum((int)aMesh->NbFacesOfOrder(SMESH::ORDER_QUADRATIC));
475 myMeshNbTriangles->setNum((int)aMesh->NbTriangles());
476 myMeshNbTriangles1->setNum((int)aMesh->NbTrianglesOfOrder(SMESH::ORDER_LINEAR));
477 myMeshNbTriangles2->setNum((int)aMesh->NbTrianglesOfOrder(SMESH::ORDER_QUADRATIC));
478 myMeshNbQuadrangles->setNum((int)aMesh->NbQuadrangles());
479 myMeshNbQuadrangles1->setNum((int)aMesh->NbQuadranglesOfOrder(SMESH::ORDER_LINEAR));
480 myMeshNbQuadrangles2->setNum((int)aMesh->NbQuadranglesOfOrder(SMESH::ORDER_QUADRATIC));
481 myMeshNbPolygones->setNum( (int)aMesh->NbPolygons() );
482 myMeshNbVolumes->setNum((int)aMesh->NbVolumes());
483 myMeshNbVolumes1->setNum((int)aMesh->NbVolumesOfOrder(SMESH::ORDER_LINEAR));
484 myMeshNbVolumes2->setNum((int)aMesh->NbVolumesOfOrder(SMESH::ORDER_QUADRATIC));
485 myMeshNbTetra->setNum((int)aMesh->NbTetras());
486 myMeshNbTetra1->setNum((int)aMesh->NbTetrasOfOrder(SMESH::ORDER_LINEAR));
487 myMeshNbTetra2->setNum((int)aMesh->NbTetrasOfOrder(SMESH::ORDER_QUADRATIC));
488 myMeshNbHexa->setNum((int)aMesh->NbHexas());
489 myMeshNbHexa1->setNum((int)aMesh->NbHexasOfOrder(SMESH::ORDER_LINEAR));
490 myMeshNbHexa2->setNum((int)aMesh->NbHexasOfOrder(SMESH::ORDER_QUADRATIC));
491 myMeshNbPrism->setNum((int)aMesh->NbPrisms());
492 myMeshNbPrism1->setNum((int)aMesh->NbPrismsOfOrder(SMESH::ORDER_LINEAR));
493 myMeshNbPrism2->setNum((int)aMesh->NbPrismsOfOrder(SMESH::ORDER_QUADRATIC));
494 myMeshNbPyra->setNum((int)aMesh->NbPyramids());
495 myMeshNbPyra1->setNum((int)aMesh->NbPyramidsOfOrder(SMESH::ORDER_LINEAR));
496 myMeshNbPyra2->setNum((int)aMesh->NbPyramidsOfOrder(SMESH::ORDER_QUADRATIC));
497 myMeshNbPolyhedrones->setNum( (int)aMesh->NbPolyhedrons() );
500 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObject);
501 if (!aSubMesh->_is_nil()) {
502 myWGStack->setCurrentWidget(mySubMeshWidget);
503 setWindowTitle(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_SUBMESH") + "]");
504 mySubMeshName->setText(aSO->GetName().c_str());
505 mySubMeshNbNodes->setNum((int)aSubMesh->GetNumberOfNodes(true));
506 mySubMeshNbElements->setNum((int)aSubMesh->GetNumberOfElements());
507 mySubMeshNbEdges->setNum((int)(aSubMesh->GetElementsByType(SMESH::EDGE)->length()));
508 mySubMeshNbFaces->setNum((int)(aSubMesh->GetElementsByType(SMESH::FACE)->length()));
509 mySubMeshNbVolumes->setNum((int)(aSubMesh->GetElementsByType(SMESH::VOLUME)->length()));
512 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
513 if (!aGroup->_is_nil()) {
514 myWGStack->setCurrentWidget(myGroupWidget);
515 setWindowTitle(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_GROUP") + "]");
516 myGroupName->setText(aSO->GetName().c_str());
517 int aType = aGroup->GetType();
521 strType = "SMESH_MESHINFO_NODES"; break;
523 strType = "SMESH_MESHINFO_EDGES"; break;
525 strType = "SMESH_MESHINFO_FACES"; break;
527 strType = "SMESH_MESHINFO_VOLUMES"; break;
529 strType = "SMESH_MESHINFO_ALL_TYPES"; break;
532 myGroupType->setText(tr(strType.toLatin1().data()));
533 myGroupNb->setNum((int)aGroup->Size());
539 myWGStack->setCurrentIndex(0);
540 setWindowTitle(tr("SMESH_MESHINFO_TITLE"));
543 //=================================================================================
544 // function : SelectionIntoArgument()
545 // purpose : Called when selection has changed
546 //=================================================================================
547 void SMESHGUI_MeshInfosDlg::onSelectionChanged()
549 if (myStartSelection)
553 //=================================================================================
554 // function : closeEvent()
556 //=================================================================================
557 void SMESHGUI_MeshInfosDlg::closeEvent(QCloseEvent* e)
559 mySMESHGUI->ResetState();
560 QDialog::closeEvent(e);
563 //=================================================================================
564 // function : windowActivationChange()
565 // purpose : called when window is activated/deactivated
566 //=================================================================================
567 void SMESHGUI_MeshInfosDlg::windowActivationChange(bool oldActive)
569 QDialog::windowActivationChange(oldActive);
570 if (isActiveWindow() && myIsActiveWindow != isActiveWindow())
571 ActivateThisDialog();
572 myIsActiveWindow = isActiveWindow();
575 //=================================================================================
576 // function : DeactivateActiveDialog()
578 //=================================================================================
579 void SMESHGUI_MeshInfosDlg::DeactivateActiveDialog()
581 disconnect(mySelectionMgr, 0, this, 0);
584 //=================================================================================
585 // function : ActivateThisDialog()
587 //=================================================================================
588 void SMESHGUI_MeshInfosDlg::ActivateThisDialog()
590 /* Emit a signal to deactivate any active dialog */
591 mySMESHGUI->EmitSignalDeactivateDialog();
592 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
595 //=================================================================================
596 // function : onStartSelection()
597 // purpose : starts selection
598 //=================================================================================
599 void SMESHGUI_MeshInfosDlg::onStartSelection()
601 myStartSelection = true;
602 onSelectionChanged();
603 myStartSelection = true;
604 mySelectLab->setText(tr("INF_SELECT_OBJECT"));
607 //=================================================================================
608 // function : onHelp()
610 //=================================================================================
611 void SMESHGUI_MeshInfosDlg::onHelp()
613 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
615 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
619 platform = "winapplication";
621 platform = "application";
623 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
624 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
625 arg(app->resourceMgr()->stringValue("ExternalBrowser",
627 arg(myHelpFileName));
631 //=================================================================================
632 // function : keyPressEvent()
634 //=================================================================================
635 void SMESHGUI_MeshInfosDlg::keyPressEvent( QKeyEvent* e )
637 QDialog::keyPressEvent( e );
638 if ( e->isAccepted() )
641 if ( e->key() == Qt::Key_F1 ) {