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
28 #include "SMESHGUI_MeshInfosDlg.h"
31 #include "SMESHGUI_Utils.h"
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 "SALOMEDSClient_Study.hxx"
42 #include "SALOME_ListIO.hxx"
44 #include "utilities.h"
47 #include <qgroupbox.h>
50 #include <qwidgetstack.h>
53 #include <qpushbutton.h>
56 #include "SALOMEconfig.h"
57 #include CORBA_SERVER_HEADER(SMESH_Mesh)
58 #include CORBA_SERVER_HEADER(SMESH_Group)
62 #define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" )
64 //=================================================================================
65 // function : SMESHGUI_MeshInfosDlg()
66 // purpose : Constructor
67 //=================================================================================
68 SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg (SMESHGUI* theModule,
72 QDialog(SMESH::GetDesktop(theModule),
75 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
76 mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
80 setName("SMESHGUI_MeshInfosDlg");
81 setCaption(tr("SMESH_MESHINFO_TITLE"));
82 setSizeGripEnabled(TRUE);
84 myStartSelection = true;
85 myIsActiveWindow = true;
87 QVBoxLayout* aTopLayout = new QVBoxLayout(this);
88 aTopLayout->setSpacing(6); aTopLayout->setMargin(11);
90 // select button & label
91 QPixmap image0(SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH",tr("ICON_SELECT")));
92 mySelectBtn = new QPushButton(this, "mySelectBtn");
93 mySelectBtn->setPixmap(image0);
94 mySelectBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
96 mySelectLab = new QLabel(this, "mySelectLab");
97 mySelectLab->setAlignment(AlignCenter);
98 QFont fnt = mySelectLab->font(); fnt.setBold(true);
99 mySelectLab->setFont(fnt);
101 QHBoxLayout* aSelectLayout = new QHBoxLayout;
102 aSelectLayout->setMargin(0); aSelectLayout->setSpacing(0);
103 aSelectLayout->addWidget(mySelectBtn);
104 aSelectLayout->addWidget(mySelectLab);
107 myWGStack = new QWidgetStack(this);
109 // no valid selection
110 QWidget* myBadWidget = new QWidget(myWGStack);
111 QVBoxLayout* aBadLayout = new QVBoxLayout(myBadWidget);
112 QLabel* myBadLab = new QLabel(tr("SMESH_BAD_SELECTION"), myBadWidget, "myBadLab");
113 myBadLab->setAlignment(Qt::AlignCenter);
114 myBadLab->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
115 aBadLayout->addWidget(myBadLab);
116 myWGStack->addWidget(myBadWidget, 0);
119 myMeshWidget = new QWidget(myWGStack);
120 QGridLayout* aMeshLayout = new QGridLayout(myMeshWidget);
121 aMeshLayout->setSpacing(6); aMeshLayout->setMargin(0);
122 myWGStack->addWidget(myMeshWidget);
125 QLabel* myMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myMeshWidget, "myMeshNameLab");
126 myMeshName = new QLabel(myMeshWidget, "myMeshName");
127 myMeshName->setMinimumWidth(100);
128 QFrame* line1 = new QFrame(myMeshWidget);
129 line1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
132 QLabel* myMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), myMeshWidget, "myMeshNbNodesLab");
133 myMeshNbNodes = new QLabel(myMeshWidget, "myMeshNbNodes");
134 myMeshNbNodes->setMinimumWidth(100);
136 // --> header with orders
137 QLabel* myMeshOrder0Lab = new QLabel(tr("SMESH_MESHINFO_ORDER0"), myMeshWidget, "myMeshOrder0Lab");
138 QLabel* myMeshOrder1Lab = new QLabel(tr("SMESH_MESHINFO_ORDER1"), myMeshWidget, "myMeshOrder1Lab");
139 QLabel* myMeshOrder2Lab = new QLabel(tr("SMESH_MESHINFO_ORDER2"), myMeshWidget, "myMeshOrder2Lab");
140 QFont fnti = myMeshOrder0Lab->font(); fnti.setItalic(true);
141 myMeshOrder0Lab->setFont(fnti);
142 myMeshOrder1Lab->setFont(fnti);
143 myMeshOrder2Lab->setFont(fnti);
146 QLabel* myMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), myMeshWidget, "myMeshNbEdgesLab");
147 myMeshNbEdges = new QLabel(myMeshWidget, "myMeshNbEdges");
148 myMeshNbEdges->setMinimumWidth(100);
149 myMeshNbEdges1 = new QLabel(myMeshWidget, "myMeshNbEdges1");
150 myMeshNbEdges1->setMinimumWidth(100);
151 myMeshNbEdges2 = new QLabel(myMeshWidget, "myMeshNbEdges2");
152 myMeshNbEdges2->setMinimumWidth(100);
155 myMeshFacesGroup = new QGroupBox(tr("SMESH_MESHINFO_FACES"), myMeshWidget, "myMeshFacesGroup");
156 myMeshFacesGroup->setColumnLayout(0, Qt::Vertical);
157 myMeshFacesGroup->layout()->setSpacing(0); myMeshFacesGroup->layout()->setMargin(0);
158 QGridLayout* myMeshFacesGroupLayout = new QGridLayout(myMeshFacesGroup->layout());
159 myMeshFacesGroupLayout->setAlignment(Qt::AlignTop);
160 myMeshFacesGroupLayout->setSpacing(6); myMeshFacesGroupLayout->setMargin(11);
162 // --> faces --> total
163 QLabel* myMeshNbFacesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), myMeshFacesGroup, "myMeshNbFacesLab");
164 myMeshNbFacesLab->setFont(fnt);
165 myMeshNbFaces = new QLabel(myMeshFacesGroup, "myMeshNbFaces");
166 myMeshNbFaces->setMinimumWidth(100);
167 myMeshNbFaces->setFont(fnt);
168 myMeshNbFaces1 = new QLabel(myMeshFacesGroup, "myMeshNbFaces1");
169 myMeshNbFaces1->setMinimumWidth(100);
170 myMeshNbFaces1->setFont(fnt);
171 myMeshNbFaces2 = new QLabel(myMeshFacesGroup, "myMeshNbFaces2");
172 myMeshNbFaces2->setMinimumWidth(100);
173 myMeshNbFaces2->setFont(fnt);
175 // --> faces --> triangles
176 QLabel* myMeshNbTrianglesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TRIANGLES")), myMeshFacesGroup, "myMeshNbTrianglesLab");
177 myMeshNbTriangles = new QLabel(myMeshFacesGroup, "myMeshNbTriangles");
178 myMeshNbTriangles->setMinimumWidth(100);
179 myMeshNbTriangles1 = new QLabel(myMeshFacesGroup, "myMeshNbTriangles1");
180 myMeshNbTriangles1->setMinimumWidth(100);
181 myMeshNbTriangles2 = new QLabel(myMeshFacesGroup, "myMeshNbTriangles2");
182 myMeshNbTriangles2->setMinimumWidth(100);
184 // --> faces --> quadrangles
185 QLabel* myMeshNbQuadranglesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_QUADRANGLES")), myMeshFacesGroup, "myMeshNbQuadranglesLab");
186 myMeshNbQuadrangles = new QLabel(myMeshFacesGroup, "myMeshNbQuadrangles");
187 myMeshNbQuadrangles->setMinimumWidth(100);
188 myMeshNbQuadrangles1 = new QLabel(myMeshFacesGroup, "myMeshNbQuadrangles1");
189 myMeshNbQuadrangles1->setMinimumWidth(100);
190 myMeshNbQuadrangles2 = new QLabel(myMeshFacesGroup, "myMeshNbQuadrangles2");
191 myMeshNbQuadrangles2->setMinimumWidth(100);
193 // --> faces --> polygons
194 QLabel* myMeshNbPolygonesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYGONES" ) ), myMeshFacesGroup, "myMeshNbPolygonesLab" );
195 myMeshNbPolygones = new QLabel( myMeshFacesGroup, "myMeshNbPolygones" );
196 myMeshNbPolygones->setMinimumWidth( 100 );
198 myMeshFacesGroupLayout->addWidget(myMeshNbFacesLab, 0, 0);
199 myMeshFacesGroupLayout->addWidget(myMeshNbFaces, 0, 1);
200 myMeshFacesGroupLayout->addWidget(myMeshNbFaces1, 0, 2);
201 myMeshFacesGroupLayout->addWidget(myMeshNbFaces2, 0, 3);
202 myMeshFacesGroupLayout->addWidget(myMeshNbTrianglesLab, 1, 0);
203 myMeshFacesGroupLayout->addWidget(myMeshNbTriangles, 1, 1);
204 myMeshFacesGroupLayout->addWidget(myMeshNbTriangles1, 1, 2);
205 myMeshFacesGroupLayout->addWidget(myMeshNbTriangles2, 1, 3);
206 myMeshFacesGroupLayout->addWidget(myMeshNbQuadranglesLab, 2, 0);
207 myMeshFacesGroupLayout->addWidget(myMeshNbQuadrangles, 2, 1);
208 myMeshFacesGroupLayout->addWidget(myMeshNbQuadrangles1, 2, 2);
209 myMeshFacesGroupLayout->addWidget(myMeshNbQuadrangles2, 2, 3);
210 myMeshFacesGroupLayout->addWidget( myMeshNbPolygonesLab, 3, 0 );
211 myMeshFacesGroupLayout->addWidget( myMeshNbPolygones, 3, 1 );
214 myMeshVolumesGroup = new QGroupBox(tr("SMESH_MESHINFO_VOLUMES"), myMeshWidget, "myMeshVolumesGroup");
215 myMeshVolumesGroup->setColumnLayout(0, Qt::Vertical);
216 myMeshVolumesGroup->layout()->setSpacing(0); myMeshVolumesGroup->layout()->setMargin(0);
217 QGridLayout* myMeshVolumesGroupLayout = new QGridLayout(myMeshVolumesGroup->layout());
218 myMeshVolumesGroupLayout->setAlignment(Qt::AlignTop);
219 myMeshVolumesGroupLayout->setSpacing(6); myMeshVolumesGroupLayout->setMargin(11);
221 // --> volumes --> total
222 QLabel* myMeshNbVolumesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), myMeshVolumesGroup, "myMeshNbVolumesLab");
223 myMeshNbVolumesLab->setFont(fnt);
224 myMeshNbVolumes = new QLabel(myMeshVolumesGroup, "myMeshNbVolumes");
225 myMeshNbVolumes->setMinimumWidth(100);
226 myMeshNbVolumes->setFont(fnt);
227 myMeshNbVolumes1 = new QLabel(myMeshVolumesGroup, "myMeshNbVolumes1");
228 myMeshNbVolumes1->setMinimumWidth(100);
229 myMeshNbVolumes1->setFont(fnt);
230 myMeshNbVolumes2 = new QLabel(myMeshVolumesGroup, "myMeshNbVolumes2");
231 myMeshNbVolumes2->setMinimumWidth(100);
232 myMeshNbVolumes2->setFont(fnt);
234 // --> volumes --> tetrahedrons
235 QLabel* myMeshNbTetraLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TETRAS")), myMeshVolumesGroup, "myMeshNbTetraLab");
236 myMeshNbTetra = new QLabel(myMeshVolumesGroup, "myMeshNbTetra");
237 myMeshNbTetra->setMinimumWidth(100);
238 myMeshNbTetra1 = new QLabel(myMeshVolumesGroup, "myMeshNbTetra1");
239 myMeshNbTetra1->setMinimumWidth(100);
240 myMeshNbTetra2 = new QLabel(myMeshVolumesGroup, "myMeshNbTetra2");
241 myMeshNbTetra2->setMinimumWidth(100);
243 // --> volumes --> hexahedrons
244 QLabel* myMeshNbHexaLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_HEXAS")), myMeshVolumesGroup, "myMeshNbHexaLab");
245 myMeshNbHexa = new QLabel(myMeshVolumesGroup, "myMeshNbHexa");
246 myMeshNbHexa->setMinimumWidth(100);
247 myMeshNbHexa1 = new QLabel(myMeshVolumesGroup, "myMeshNbHexa1");
248 myMeshNbHexa1->setMinimumWidth(100);
249 myMeshNbHexa2 = new QLabel(myMeshVolumesGroup, "myMeshNbHexa2");
250 myMeshNbHexa2->setMinimumWidth(100);
252 // --> volumes --> prisms
253 QLabel* myMeshNbPrismLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PRISMS")), myMeshVolumesGroup, "myMeshNbPrismLab");
254 myMeshNbPrism = new QLabel(myMeshVolumesGroup, "myMeshNbPrism");
255 myMeshNbPrism->setMinimumWidth(100);
256 myMeshNbPrism1 = new QLabel(myMeshVolumesGroup, "myMeshNbPrism1");
257 myMeshNbPrism1->setMinimumWidth(100);
258 myMeshNbPrism2 = new QLabel(myMeshVolumesGroup, "myMeshNbPrism2");
259 myMeshNbPrism2->setMinimumWidth(100);
261 // --> volumes --> pyramids
262 QLabel* myMeshNbPyraLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PYRAS")), myMeshVolumesGroup, "myMeshNbPyraLab");
263 myMeshNbPyra = new QLabel(myMeshVolumesGroup, "myMeshNbPyra");
264 myMeshNbPyra->setMinimumWidth(100);
265 myMeshNbPyra1 = new QLabel(myMeshVolumesGroup, "myMeshNbPyra1");
266 myMeshNbPyra1->setMinimumWidth(100);
267 myMeshNbPyra2 = new QLabel(myMeshVolumesGroup, "myMeshNbPyra2");
268 myMeshNbPyra2->setMinimumWidth(100);
270 // --> volumes --> polyherones
271 QLabel* myMeshNbPolyhedronesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYEDRES" ) ), myMeshVolumesGroup, "myMeshNbPolyhedronLab" );
272 myMeshNbPolyhedrones = new QLabel( myMeshVolumesGroup, "myMeshNbPolyhedrones" );
273 myMeshNbPolyhedrones->setMinimumWidth( 100 );
275 myMeshVolumesGroupLayout->addWidget(myMeshNbVolumesLab, 0, 0);
276 myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes, 0, 1);
277 myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes1, 0, 2);
278 myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes2, 0, 3);
279 myMeshVolumesGroupLayout->addWidget(myMeshNbTetraLab, 1, 0);
280 myMeshVolumesGroupLayout->addWidget(myMeshNbTetra, 1, 1);
281 myMeshVolumesGroupLayout->addWidget(myMeshNbTetra1, 1, 2);
282 myMeshVolumesGroupLayout->addWidget(myMeshNbTetra2, 1, 3);
283 myMeshVolumesGroupLayout->addWidget(myMeshNbHexaLab, 2, 0);
284 myMeshVolumesGroupLayout->addWidget(myMeshNbHexa, 2, 1);
285 myMeshVolumesGroupLayout->addWidget(myMeshNbHexa1, 2, 2);
286 myMeshVolumesGroupLayout->addWidget(myMeshNbHexa2, 2, 3);
287 myMeshVolumesGroupLayout->addWidget(myMeshNbPrismLab, 3, 0);
288 myMeshVolumesGroupLayout->addWidget(myMeshNbPrism, 3, 1);
289 myMeshVolumesGroupLayout->addWidget(myMeshNbPrism1, 3, 2);
290 myMeshVolumesGroupLayout->addWidget(myMeshNbPrism2, 3, 3);
291 myMeshVolumesGroupLayout->addWidget(myMeshNbPyraLab, 4, 0);
292 myMeshVolumesGroupLayout->addWidget(myMeshNbPyra, 4, 1);
293 myMeshVolumesGroupLayout->addWidget(myMeshNbPyra1, 4, 2);
294 myMeshVolumesGroupLayout->addWidget(myMeshNbPyra2, 4, 3);
295 myMeshVolumesGroupLayout->addWidget( myMeshNbPolyhedronesLab, 5, 0 );
296 myMeshVolumesGroupLayout->addWidget( myMeshNbPolyhedrones, 5, 1 );
298 aMeshLayout->addWidget(myMeshNameLab, 0, 0);
299 aMeshLayout->addWidget(myMeshName, 0, 1);
300 aMeshLayout->addMultiCellWidget(line1, 1, 1, 0, 1);
301 aMeshLayout->addWidget(myMeshNbNodesLab, 2, 0);
302 aMeshLayout->addWidget(myMeshNbNodes, 2, 1);
303 aMeshLayout->addWidget(myMeshOrder0Lab, 3, 1);
304 aMeshLayout->addWidget(myMeshOrder1Lab, 3, 2);
305 aMeshLayout->addWidget(myMeshOrder2Lab, 3, 3);
306 aMeshLayout->addWidget(myMeshNbEdgesLab, 4, 0);
307 aMeshLayout->addWidget(myMeshNbEdges, 4, 1);
308 aMeshLayout->addWidget(myMeshNbEdges1, 4, 2);
309 aMeshLayout->addWidget(myMeshNbEdges2, 4, 3);
310 aMeshLayout->addMultiCellWidget(myMeshFacesGroup, 5, 5, 0, 3);
311 aMeshLayout->addMultiCellWidget(myMeshVolumesGroup, 6, 6, 0, 3);
312 aMeshLayout->addItem(new QSpacerItem(6, 6, QSizePolicy::Minimum, QSizePolicy::Expanding), 7, 0);
315 mySubMeshWidget = new QWidget(myWGStack);
316 QGridLayout* aSubMeshLayout = new QGridLayout(mySubMeshWidget);
317 aSubMeshLayout->setSpacing(6); aSubMeshLayout->setMargin(0);
318 myWGStack->addWidget(mySubMeshWidget);
321 QLabel* mySubMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), mySubMeshWidget, "mySubMeshNameLab");
322 mySubMeshName = new QLabel(mySubMeshWidget, "mySubMeshName");
323 mySubMeshName->setMinimumWidth(100);
324 QFrame* line2 = new QFrame(mySubMeshWidget);
325 line2->setFrameStyle(QFrame::HLine | QFrame::Sunken);
328 QLabel* mySubMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), mySubMeshWidget, "mySubMeshNbNodesLab");
329 mySubMeshNbNodes = new QLabel(mySubMeshWidget, "mySubMeshNbNodes");
330 mySubMeshNbNodes->setMinimumWidth(100);
333 mySubMeshElementsGroup = new QGroupBox(tr("SMESH_MESHINFO_ELEMENTS"), mySubMeshWidget, "mySubMeshElementsGroup");
334 mySubMeshElementsGroup->setColumnLayout(0, Qt::Vertical);
335 mySubMeshElementsGroup->layout()->setSpacing(0); mySubMeshElementsGroup->layout()->setMargin(0);
336 QGridLayout* mySubMeshElementsGroupLayout = new QGridLayout(mySubMeshElementsGroup->layout());
337 mySubMeshElementsGroupLayout->setAlignment(Qt::AlignTop);
338 mySubMeshElementsGroupLayout->setSpacing(6); mySubMeshElementsGroupLayout->setMargin(11);
340 // --> elements --> total
341 QLabel* mySubMeshNbElementsLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), mySubMeshElementsGroup, "mySubMeshNbElementsLab");
342 mySubMeshNbElementsLab->setFont(fnt);
343 mySubMeshNbElements = new QLabel(mySubMeshElementsGroup, "mySubMeshNbElements");
344 mySubMeshNbElements->setMinimumWidth(100);
345 mySubMeshNbElements->setFont(fnt);
347 // --> elements --> edges
348 QLabel* mySubMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), mySubMeshElementsGroup, "mySubMeshNbEdgesLab");
349 mySubMeshNbEdges = new QLabel(mySubMeshElementsGroup, "mySubMeshNbEdges");
350 mySubMeshNbEdges->setMinimumWidth(100);
352 // --> elements --> faces
353 QLabel* mySubMeshNbFacesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), mySubMeshElementsGroup, "mySubMeshNbFacesLab");
354 mySubMeshNbFaces = new QLabel(mySubMeshElementsGroup, "mySubMeshNbFaces");
355 mySubMeshNbFaces->setMinimumWidth(100);
357 // --> elements --> volumes
358 QLabel* mySubMeshNbVolumesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), mySubMeshElementsGroup, "mySubMeshNbVolumesLab");
359 mySubMeshNbVolumes = new QLabel(mySubMeshElementsGroup, "mySubMeshNbVolumes");
360 mySubMeshNbVolumes->setMinimumWidth(100);
362 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbElementsLab, 0, 0);
363 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbElements, 0, 1);
364 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdgesLab, 1, 0);
365 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdges, 1, 1);
366 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFacesLab, 2, 0);
367 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFaces, 2, 1);
368 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumesLab, 3, 0);
369 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumes, 3, 1);
371 aSubMeshLayout->addWidget(mySubMeshNameLab, 0, 0);
372 aSubMeshLayout->addWidget(mySubMeshName, 0, 1);
373 aSubMeshLayout->addMultiCellWidget(line2, 1, 1, 0, 1);
374 aSubMeshLayout->addWidget(mySubMeshNbNodesLab, 2, 0);
375 aSubMeshLayout->addWidget(mySubMeshNbNodes, 2, 1);
376 aSubMeshLayout->addMultiCellWidget(mySubMeshElementsGroup, 3, 3, 0, 1);
377 aSubMeshLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0);
380 myGroupWidget = new QWidget(myWGStack);
381 QGridLayout* myGroupWidgetLayout = new QGridLayout(myGroupWidget);
382 myGroupWidgetLayout->setSpacing(6); myGroupWidgetLayout->setMargin(0);
383 myWGStack->addWidget(myGroupWidget);
386 QLabel* myGroupNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myGroupWidget, "myGroupNameLab");
387 myGroupName = new QLabel(myGroupWidget, "myGroupName");
388 myGroupName->setMinimumWidth(100);
389 QFrame* line3 = new QFrame(myGroupWidget);
390 line3->setFrameStyle(QFrame::HLine | QFrame::Sunken);
393 QLabel* myGroupTypeLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TYPE")), myGroupWidget, "myGroupTypeLab");
394 myGroupType = new QLabel(myGroupWidget, "myGroupType");
395 myGroupType->setMinimumWidth(100);
397 // --> number of entities
398 QLabel* myGroupNbLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_ENTITIES")), myGroupWidget, "myGroupNbLab");
399 myGroupNb = new QLabel(myGroupWidget, "myGroupNb");
400 myGroupNb->setMinimumWidth(100);
402 myGroupWidgetLayout->addWidget(myGroupNameLab, 0, 0);
403 myGroupWidgetLayout->addWidget(myGroupName, 0, 1);
404 myGroupWidgetLayout->addMultiCellWidget(line3, 1, 1, 0, 1);
405 myGroupWidgetLayout->addWidget(myGroupTypeLab, 2, 0);
406 myGroupWidgetLayout->addWidget(myGroupType, 2, 1);
407 myGroupWidgetLayout->addWidget(myGroupNbLab, 3, 0);
408 myGroupWidgetLayout->addWidget(myGroupNb, 3, 1);
409 myGroupWidgetLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0);
412 myButtonsGroup = new QGroupBox(this, "myButtonsGroup");
413 myButtonsGroup->setColumnLayout(0, Qt::Vertical);
414 myButtonsGroup->layout()->setSpacing(0); myButtonsGroup->layout()->setMargin(0);
415 QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout(myButtonsGroup->layout());
416 myButtonsGroupLayout->setAlignment(Qt::AlignTop);
417 myButtonsGroupLayout->setSpacing(6); myButtonsGroupLayout->setMargin(11);
419 // buttons --> OK and Help buttons
420 myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), myButtonsGroup, "myOkBtn");
421 myOkBtn->setAutoDefault(TRUE); myOkBtn->setDefault(TRUE);
422 myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP" ), myButtonsGroup, "myHelpBtn");
423 myHelpBtn->setAutoDefault(TRUE);
425 myButtonsGroupLayout->addWidget(myOkBtn);
426 myButtonsGroupLayout->addStretch();
427 myButtonsGroupLayout->addWidget(myHelpBtn);
429 aTopLayout->addLayout(aSelectLayout);
430 aTopLayout->addWidget(myWGStack);
431 aTopLayout->addWidget(myButtonsGroup);
433 mySMESHGUI->SetActiveDialogBox(this);
436 connect(myOkBtn, SIGNAL(clicked()), this, SLOT(close()));
437 connect( myHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp()));
438 connect(mySelectBtn, SIGNAL(clicked()), this, SLOT(onStartSelection()));
439 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(close()));
440 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
441 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
445 // init dialog with current selection
446 onSelectionChanged();
448 myHelpFileName = "mesh_infos_page.html#advanced_mesh_infos_anchor";
451 //=================================================================================
452 // function : ~SMESHGUI_MeshInfosDlg()
453 // purpose : Destructor
454 //=================================================================================
455 SMESHGUI_MeshInfosDlg::~SMESHGUI_MeshInfosDlg()
459 //=================================================================================
460 // function : DumpMeshInfos()
462 //=================================================================================
463 void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
465 SUIT_OverrideCursor wc;
468 mySelectionMgr->selectedObjects(aList);
470 int nbSel = aList.Extent();
472 myStartSelection = false;
473 mySelectLab->setText("");
474 Handle(SALOME_InteractiveObject) IObject = aList.First();
475 _PTR(SObject) aSO = SMESH::GetActiveStudyDocument()->FindObjectID(IObject->getEntry());
477 //CORBA::Object_var anObject = aSO->GetObject();
478 CORBA::Object_var anObject = SMESH::SObjectToObject(aSO);
479 if (!CORBA::is_nil(anObject)) {
480 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObject);
481 if (!aMesh->_is_nil()) {
482 myWGStack->raiseWidget(myMeshWidget);
483 setCaption(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_OBJECT_MESH") + "]");
484 myMeshName->setText(aSO->GetName().c_str());
485 myMeshNbNodes->setNum((int)aMesh->NbNodes());
486 myMeshNbEdges->setNum((int)aMesh->NbEdges());
487 myMeshNbEdges1->setNum((int)aMesh->NbEdgesOfOrder(SMESH::ORDER_LINEAR));
488 myMeshNbEdges2->setNum((int)aMesh->NbEdgesOfOrder(SMESH::ORDER_QUADRATIC));
489 myMeshNbFaces->setNum((int)aMesh->NbFaces());
490 myMeshNbFaces1->setNum((int)aMesh->NbFacesOfOrder(SMESH::ORDER_LINEAR));
491 myMeshNbFaces2->setNum((int)aMesh->NbFacesOfOrder(SMESH::ORDER_QUADRATIC));
492 myMeshNbTriangles->setNum((int)aMesh->NbTriangles());
493 myMeshNbTriangles1->setNum((int)aMesh->NbTrianglesOfOrder(SMESH::ORDER_LINEAR));
494 myMeshNbTriangles2->setNum((int)aMesh->NbTrianglesOfOrder(SMESH::ORDER_QUADRATIC));
495 myMeshNbQuadrangles->setNum((int)aMesh->NbQuadrangles());
496 myMeshNbQuadrangles1->setNum((int)aMesh->NbQuadranglesOfOrder(SMESH::ORDER_LINEAR));
497 myMeshNbQuadrangles2->setNum((int)aMesh->NbQuadranglesOfOrder(SMESH::ORDER_QUADRATIC));
498 myMeshNbPolygones->setNum( (int)aMesh->NbPolygons() );
499 myMeshNbVolumes->setNum((int)aMesh->NbVolumes());
500 myMeshNbVolumes1->setNum((int)aMesh->NbVolumesOfOrder(SMESH::ORDER_LINEAR));
501 myMeshNbVolumes2->setNum((int)aMesh->NbVolumesOfOrder(SMESH::ORDER_QUADRATIC));
502 myMeshNbTetra->setNum((int)aMesh->NbTetras());
503 myMeshNbTetra1->setNum((int)aMesh->NbTetrasOfOrder(SMESH::ORDER_LINEAR));
504 myMeshNbTetra2->setNum((int)aMesh->NbTetrasOfOrder(SMESH::ORDER_QUADRATIC));
505 myMeshNbHexa->setNum((int)aMesh->NbHexas());
506 myMeshNbHexa1->setNum((int)aMesh->NbHexasOfOrder(SMESH::ORDER_LINEAR));
507 myMeshNbHexa2->setNum((int)aMesh->NbHexasOfOrder(SMESH::ORDER_QUADRATIC));
508 myMeshNbPrism->setNum((int)aMesh->NbPrisms());
509 myMeshNbPrism1->setNum((int)aMesh->NbPrismsOfOrder(SMESH::ORDER_LINEAR));
510 myMeshNbPrism2->setNum((int)aMesh->NbPrismsOfOrder(SMESH::ORDER_QUADRATIC));
511 myMeshNbPyra->setNum((int)aMesh->NbPyramids());
512 myMeshNbPyra1->setNum((int)aMesh->NbPyramidsOfOrder(SMESH::ORDER_LINEAR));
513 myMeshNbPyra2->setNum((int)aMesh->NbPyramidsOfOrder(SMESH::ORDER_QUADRATIC));
514 myMeshNbPolyhedrones->setNum( (int)aMesh->NbPolyhedrons() );
517 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObject);
518 if (!aSubMesh->_is_nil()) {
519 myWGStack->raiseWidget(mySubMeshWidget);
520 setCaption(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_SUBMESH") + "]");
521 mySubMeshName->setText(aSO->GetName().c_str());
522 mySubMeshNbNodes->setNum((int)aSubMesh->GetNumberOfNodes(true));
523 mySubMeshNbElements->setNum((int)aSubMesh->GetNumberOfElements());
524 mySubMeshNbEdges->setNum((int)(aSubMesh->GetElementsByType(SMESH::EDGE)->length()));
525 mySubMeshNbFaces->setNum((int)(aSubMesh->GetElementsByType(SMESH::FACE)->length()));
526 mySubMeshNbVolumes->setNum((int)(aSubMesh->GetElementsByType(SMESH::VOLUME)->length()));
529 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
530 if (!aGroup->_is_nil()) {
531 myWGStack->raiseWidget(myGroupWidget);
532 setCaption(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_GROUP") + "]");
533 myGroupName->setText(aSO->GetName().c_str());
534 int aType = aGroup->GetType();
538 strType = "SMESH_MESHINFO_NODES"; break;
540 strType = "SMESH_MESHINFO_EDGES"; break;
542 strType = "SMESH_MESHINFO_FACES"; break;
544 strType = "SMESH_MESHINFO_VOLUMES"; break;
546 strType = "SMESH_MESHINFO_ALL_TYPES"; break;
549 myGroupType->setText(tr(strType));
550 myGroupNb->setNum((int)aGroup->Size());
556 myWGStack->raiseWidget(0);
557 setCaption(tr("SMESH_MESHINFO_TITLE"));
560 //=================================================================================
561 // function : SelectionIntoArgument()
562 // purpose : Called when selection has changed
563 //=================================================================================
564 void SMESHGUI_MeshInfosDlg::onSelectionChanged()
566 if (myStartSelection)
570 //=================================================================================
571 // function : closeEvent()
573 //=================================================================================
574 void SMESHGUI_MeshInfosDlg::closeEvent (QCloseEvent* e)
576 mySMESHGUI->ResetState();
577 QDialog::closeEvent(e);
580 //=================================================================================
581 // function : windowActivationChange()
582 // purpose : called when window is activated/deactivated
583 //=================================================================================
584 void SMESHGUI_MeshInfosDlg::windowActivationChange (bool oldActive)
586 QDialog::windowActivationChange(oldActive);
587 if (isActiveWindow() && myIsActiveWindow != isActiveWindow())
588 ActivateThisDialog();
589 myIsActiveWindow = isActiveWindow();
592 //=================================================================================
593 // function : DeactivateActiveDialog()
595 //=================================================================================
596 void SMESHGUI_MeshInfosDlg::DeactivateActiveDialog()
598 disconnect(mySelectionMgr, 0, this, 0);
601 //=================================================================================
602 // function : ActivateThisDialog()
604 //=================================================================================
605 void SMESHGUI_MeshInfosDlg::ActivateThisDialog()
607 /* Emit a signal to deactivate any active dialog */
608 mySMESHGUI->EmitSignalDeactivateDialog();
609 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
612 //=================================================================================
613 // function : onStartSelection()
614 // purpose : starts selection
615 //=================================================================================
616 void SMESHGUI_MeshInfosDlg::onStartSelection()
618 myStartSelection = true;
619 onSelectionChanged();
620 myStartSelection = true;
621 mySelectLab->setText(tr("INF_SELECT_OBJECT"));
624 //=================================================================================
625 // function : onHelp()
627 //=================================================================================
628 void SMESHGUI_MeshInfosDlg::onHelp()
630 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
632 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
636 platform = "winapplication";
638 platform = "application";
640 SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
641 QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
642 arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
643 QObject::tr("BUT_OK"));
647 //=================================================================================
648 // function : keyPressEvent()
650 //=================================================================================
651 void SMESHGUI_MeshInfosDlg::keyPressEvent( QKeyEvent* e )
653 QDialog::keyPressEvent( e );
654 if ( e->isAccepted() )
657 if ( e->key() == Key_F1 )