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.salome-platform.org/ or email : webmaster.salome@opencascade.com
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"
37 #include "SUIT_Session.h"
38 #include "SUIT_MessageBox.h"
40 #include "LightApp_SelectionMgr.h"
41 #include "LightApp_Application.h"
42 #include "SALOMEDSClient_Study.hxx"
43 #include "SALOME_ListIO.hxx"
45 #include "utilities.h"
48 #include <qgroupbox.h>
51 #include <qwidgetstack.h>
54 #include <qpushbutton.h>
57 #include "SALOMEconfig.h"
58 #include CORBA_SERVER_HEADER(SMESH_Mesh)
59 #include CORBA_SERVER_HEADER(SMESH_Group)
63 #define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" )
65 //=================================================================================
66 // function : SMESHGUI_MeshInfosDlg()
67 // purpose : Constructor
68 //=================================================================================
69 SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg (SMESHGUI* theModule,
73 QDialog(SMESH::GetDesktop(theModule),
76 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
77 mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
81 setName("SMESHGUI_MeshInfosDlg");
82 setCaption(tr("SMESH_MESHINFO_TITLE"));
83 setSizeGripEnabled(TRUE);
85 myStartSelection = true;
86 myIsActiveWindow = true;
88 QVBoxLayout* aTopLayout = new QVBoxLayout(this);
89 aTopLayout->setSpacing(6); aTopLayout->setMargin(11);
91 // select button & label
92 QPixmap image0(SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH",tr("ICON_SELECT")));
93 mySelectBtn = new QPushButton(this, "mySelectBtn");
94 mySelectBtn->setPixmap(image0);
95 mySelectBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
97 mySelectLab = new QLabel(this, "mySelectLab");
98 mySelectLab->setAlignment(AlignCenter);
99 QFont fnt = mySelectLab->font(); fnt.setBold(true);
100 mySelectLab->setFont(fnt);
102 QHBoxLayout* aSelectLayout = new QHBoxLayout;
103 aSelectLayout->setMargin(0); aSelectLayout->setSpacing(0);
104 aSelectLayout->addWidget(mySelectBtn);
105 aSelectLayout->addWidget(mySelectLab);
108 myWGStack = new QWidgetStack(this);
110 // no valid selection
111 QWidget* myBadWidget = new QWidget(myWGStack);
112 QVBoxLayout* aBadLayout = new QVBoxLayout(myBadWidget);
113 QLabel* myBadLab = new QLabel(tr("SMESH_BAD_SELECTION"), myBadWidget, "myBadLab");
114 myBadLab->setAlignment(Qt::AlignCenter);
115 myBadLab->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
116 aBadLayout->addWidget(myBadLab);
117 myWGStack->addWidget(myBadWidget, 0);
120 myMeshWidget = new QWidget(myWGStack);
121 QGridLayout* aMeshLayout = new QGridLayout(myMeshWidget);
122 aMeshLayout->setSpacing(6); aMeshLayout->setMargin(0);
123 myWGStack->addWidget(myMeshWidget);
126 QLabel* myMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myMeshWidget, "myMeshNameLab");
127 myMeshName = new QLabel(myMeshWidget, "myMeshName");
128 myMeshName->setMinimumWidth(100);
129 QFrame* line1 = new QFrame(myMeshWidget);
130 line1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
133 QLabel* myMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), myMeshWidget, "myMeshNbNodesLab");
134 myMeshNbNodes = new QLabel(myMeshWidget, "myMeshNbNodes");
135 myMeshNbNodes->setMinimumWidth(100);
137 // --> header with orders
138 QLabel* myMeshOrder0Lab = new QLabel(tr("SMESH_MESHINFO_ORDER0"), myMeshWidget, "myMeshOrder0Lab");
139 QLabel* myMeshOrder1Lab = new QLabel(tr("SMESH_MESHINFO_ORDER1"), myMeshWidget, "myMeshOrder1Lab");
140 QLabel* myMeshOrder2Lab = new QLabel(tr("SMESH_MESHINFO_ORDER2"), myMeshWidget, "myMeshOrder2Lab");
141 QFont fnti = myMeshOrder0Lab->font(); fnti.setItalic(true);
142 myMeshOrder0Lab->setFont(fnti);
143 myMeshOrder1Lab->setFont(fnti);
144 myMeshOrder2Lab->setFont(fnti);
147 QLabel* myMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), myMeshWidget, "myMeshNbEdgesLab");
148 myMeshNbEdges = new QLabel(myMeshWidget, "myMeshNbEdges");
149 myMeshNbEdges->setMinimumWidth(100);
150 myMeshNbEdges1 = new QLabel(myMeshWidget, "myMeshNbEdges1");
151 myMeshNbEdges1->setMinimumWidth(100);
152 myMeshNbEdges2 = new QLabel(myMeshWidget, "myMeshNbEdges2");
153 myMeshNbEdges2->setMinimumWidth(100);
156 myMeshFacesGroup = new QGroupBox(tr("SMESH_MESHINFO_FACES"), myMeshWidget, "myMeshFacesGroup");
157 myMeshFacesGroup->setColumnLayout(0, Qt::Vertical);
158 myMeshFacesGroup->layout()->setSpacing(0); myMeshFacesGroup->layout()->setMargin(0);
159 QGridLayout* myMeshFacesGroupLayout = new QGridLayout(myMeshFacesGroup->layout());
160 myMeshFacesGroupLayout->setAlignment(Qt::AlignTop);
161 myMeshFacesGroupLayout->setSpacing(6); myMeshFacesGroupLayout->setMargin(11);
163 // --> faces --> total
164 QLabel* myMeshNbFacesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), myMeshFacesGroup, "myMeshNbFacesLab");
165 myMeshNbFacesLab->setFont(fnt);
166 myMeshNbFaces = new QLabel(myMeshFacesGroup, "myMeshNbFaces");
167 myMeshNbFaces->setMinimumWidth(100);
168 myMeshNbFaces->setFont(fnt);
169 myMeshNbFaces1 = new QLabel(myMeshFacesGroup, "myMeshNbFaces1");
170 myMeshNbFaces1->setMinimumWidth(100);
171 myMeshNbFaces1->setFont(fnt);
172 myMeshNbFaces2 = new QLabel(myMeshFacesGroup, "myMeshNbFaces2");
173 myMeshNbFaces2->setMinimumWidth(100);
174 myMeshNbFaces2->setFont(fnt);
176 // --> faces --> triangles
177 QLabel* myMeshNbTrianglesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TRIANGLES")), myMeshFacesGroup, "myMeshNbTrianglesLab");
178 myMeshNbTriangles = new QLabel(myMeshFacesGroup, "myMeshNbTriangles");
179 myMeshNbTriangles->setMinimumWidth(100);
180 myMeshNbTriangles1 = new QLabel(myMeshFacesGroup, "myMeshNbTriangles1");
181 myMeshNbTriangles1->setMinimumWidth(100);
182 myMeshNbTriangles2 = new QLabel(myMeshFacesGroup, "myMeshNbTriangles2");
183 myMeshNbTriangles2->setMinimumWidth(100);
185 // --> faces --> quadrangles
186 QLabel* myMeshNbQuadranglesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_QUADRANGLES")), myMeshFacesGroup, "myMeshNbQuadranglesLab");
187 myMeshNbQuadrangles = new QLabel(myMeshFacesGroup, "myMeshNbQuadrangles");
188 myMeshNbQuadrangles->setMinimumWidth(100);
189 myMeshNbQuadrangles1 = new QLabel(myMeshFacesGroup, "myMeshNbQuadrangles1");
190 myMeshNbQuadrangles1->setMinimumWidth(100);
191 myMeshNbQuadrangles2 = new QLabel(myMeshFacesGroup, "myMeshNbQuadrangles2");
192 myMeshNbQuadrangles2->setMinimumWidth(100);
194 // --> faces --> polygons
195 QLabel* myMeshNbPolygonesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYGONES" ) ), myMeshFacesGroup, "myMeshNbPolygonesLab" );
196 myMeshNbPolygones = new QLabel( myMeshFacesGroup, "myMeshNbPolygones" );
197 myMeshNbPolygones->setMinimumWidth( 100 );
199 myMeshFacesGroupLayout->addWidget(myMeshNbFacesLab, 0, 0);
200 myMeshFacesGroupLayout->addWidget(myMeshNbFaces, 0, 1);
201 myMeshFacesGroupLayout->addWidget(myMeshNbFaces1, 0, 2);
202 myMeshFacesGroupLayout->addWidget(myMeshNbFaces2, 0, 3);
203 myMeshFacesGroupLayout->addWidget(myMeshNbTrianglesLab, 1, 0);
204 myMeshFacesGroupLayout->addWidget(myMeshNbTriangles, 1, 1);
205 myMeshFacesGroupLayout->addWidget(myMeshNbTriangles1, 1, 2);
206 myMeshFacesGroupLayout->addWidget(myMeshNbTriangles2, 1, 3);
207 myMeshFacesGroupLayout->addWidget(myMeshNbQuadranglesLab, 2, 0);
208 myMeshFacesGroupLayout->addWidget(myMeshNbQuadrangles, 2, 1);
209 myMeshFacesGroupLayout->addWidget(myMeshNbQuadrangles1, 2, 2);
210 myMeshFacesGroupLayout->addWidget(myMeshNbQuadrangles2, 2, 3);
211 myMeshFacesGroupLayout->addWidget( myMeshNbPolygonesLab, 3, 0 );
212 myMeshFacesGroupLayout->addWidget( myMeshNbPolygones, 3, 1 );
215 myMeshVolumesGroup = new QGroupBox(tr("SMESH_MESHINFO_VOLUMES"), myMeshWidget, "myMeshVolumesGroup");
216 myMeshVolumesGroup->setColumnLayout(0, Qt::Vertical);
217 myMeshVolumesGroup->layout()->setSpacing(0); myMeshVolumesGroup->layout()->setMargin(0);
218 QGridLayout* myMeshVolumesGroupLayout = new QGridLayout(myMeshVolumesGroup->layout());
219 myMeshVolumesGroupLayout->setAlignment(Qt::AlignTop);
220 myMeshVolumesGroupLayout->setSpacing(6); myMeshVolumesGroupLayout->setMargin(11);
222 // --> volumes --> total
223 QLabel* myMeshNbVolumesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), myMeshVolumesGroup, "myMeshNbVolumesLab");
224 myMeshNbVolumesLab->setFont(fnt);
225 myMeshNbVolumes = new QLabel(myMeshVolumesGroup, "myMeshNbVolumes");
226 myMeshNbVolumes->setMinimumWidth(100);
227 myMeshNbVolumes->setFont(fnt);
228 myMeshNbVolumes1 = new QLabel(myMeshVolumesGroup, "myMeshNbVolumes1");
229 myMeshNbVolumes1->setMinimumWidth(100);
230 myMeshNbVolumes1->setFont(fnt);
231 myMeshNbVolumes2 = new QLabel(myMeshVolumesGroup, "myMeshNbVolumes2");
232 myMeshNbVolumes2->setMinimumWidth(100);
233 myMeshNbVolumes2->setFont(fnt);
235 // --> volumes --> tetrahedrons
236 QLabel* myMeshNbTetraLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TETRAS")), myMeshVolumesGroup, "myMeshNbTetraLab");
237 myMeshNbTetra = new QLabel(myMeshVolumesGroup, "myMeshNbTetra");
238 myMeshNbTetra->setMinimumWidth(100);
239 myMeshNbTetra1 = new QLabel(myMeshVolumesGroup, "myMeshNbTetra1");
240 myMeshNbTetra1->setMinimumWidth(100);
241 myMeshNbTetra2 = new QLabel(myMeshVolumesGroup, "myMeshNbTetra2");
242 myMeshNbTetra2->setMinimumWidth(100);
244 // --> volumes --> hexahedrons
245 QLabel* myMeshNbHexaLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_HEXAS")), myMeshVolumesGroup, "myMeshNbHexaLab");
246 myMeshNbHexa = new QLabel(myMeshVolumesGroup, "myMeshNbHexa");
247 myMeshNbHexa->setMinimumWidth(100);
248 myMeshNbHexa1 = new QLabel(myMeshVolumesGroup, "myMeshNbHexa1");
249 myMeshNbHexa1->setMinimumWidth(100);
250 myMeshNbHexa2 = new QLabel(myMeshVolumesGroup, "myMeshNbHexa2");
251 myMeshNbHexa2->setMinimumWidth(100);
253 // --> volumes --> prisms
254 QLabel* myMeshNbPrismLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PRISMS")), myMeshVolumesGroup, "myMeshNbPrismLab");
255 myMeshNbPrism = new QLabel(myMeshVolumesGroup, "myMeshNbPrism");
256 myMeshNbPrism->setMinimumWidth(100);
257 myMeshNbPrism1 = new QLabel(myMeshVolumesGroup, "myMeshNbPrism1");
258 myMeshNbPrism1->setMinimumWidth(100);
259 myMeshNbPrism2 = new QLabel(myMeshVolumesGroup, "myMeshNbPrism2");
260 myMeshNbPrism2->setMinimumWidth(100);
262 // --> volumes --> pyramids
263 QLabel* myMeshNbPyraLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PYRAS")), myMeshVolumesGroup, "myMeshNbPyraLab");
264 myMeshNbPyra = new QLabel(myMeshVolumesGroup, "myMeshNbPyra");
265 myMeshNbPyra->setMinimumWidth(100);
266 myMeshNbPyra1 = new QLabel(myMeshVolumesGroup, "myMeshNbPyra1");
267 myMeshNbPyra1->setMinimumWidth(100);
268 myMeshNbPyra2 = new QLabel(myMeshVolumesGroup, "myMeshNbPyra2");
269 myMeshNbPyra2->setMinimumWidth(100);
271 // --> volumes --> polyherones
272 QLabel* myMeshNbPolyhedronesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYEDRES" ) ), myMeshVolumesGroup, "myMeshNbPolyhedronLab" );
273 myMeshNbPolyhedrones = new QLabel( myMeshVolumesGroup, "myMeshNbPolyhedrones" );
274 myMeshNbPolyhedrones->setMinimumWidth( 100 );
276 myMeshVolumesGroupLayout->addWidget(myMeshNbVolumesLab, 0, 0);
277 myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes, 0, 1);
278 myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes1, 0, 2);
279 myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes2, 0, 3);
280 myMeshVolumesGroupLayout->addWidget(myMeshNbTetraLab, 1, 0);
281 myMeshVolumesGroupLayout->addWidget(myMeshNbTetra, 1, 1);
282 myMeshVolumesGroupLayout->addWidget(myMeshNbTetra1, 1, 2);
283 myMeshVolumesGroupLayout->addWidget(myMeshNbTetra2, 1, 3);
284 myMeshVolumesGroupLayout->addWidget(myMeshNbHexaLab, 2, 0);
285 myMeshVolumesGroupLayout->addWidget(myMeshNbHexa, 2, 1);
286 myMeshVolumesGroupLayout->addWidget(myMeshNbHexa1, 2, 2);
287 myMeshVolumesGroupLayout->addWidget(myMeshNbHexa2, 2, 3);
288 myMeshVolumesGroupLayout->addWidget(myMeshNbPrismLab, 3, 0);
289 myMeshVolumesGroupLayout->addWidget(myMeshNbPrism, 3, 1);
290 myMeshVolumesGroupLayout->addWidget(myMeshNbPrism1, 3, 2);
291 myMeshVolumesGroupLayout->addWidget(myMeshNbPrism2, 3, 3);
292 myMeshVolumesGroupLayout->addWidget(myMeshNbPyraLab, 4, 0);
293 myMeshVolumesGroupLayout->addWidget(myMeshNbPyra, 4, 1);
294 myMeshVolumesGroupLayout->addWidget(myMeshNbPyra1, 4, 2);
295 myMeshVolumesGroupLayout->addWidget(myMeshNbPyra2, 4, 3);
296 myMeshVolumesGroupLayout->addWidget( myMeshNbPolyhedronesLab, 5, 0 );
297 myMeshVolumesGroupLayout->addWidget( myMeshNbPolyhedrones, 5, 1 );
299 aMeshLayout->addWidget(myMeshNameLab, 0, 0);
300 aMeshLayout->addWidget(myMeshName, 0, 1);
301 aMeshLayout->addMultiCellWidget(line1, 1, 1, 0, 1);
302 aMeshLayout->addWidget(myMeshNbNodesLab, 2, 0);
303 aMeshLayout->addWidget(myMeshNbNodes, 2, 1);
304 aMeshLayout->addWidget(myMeshOrder0Lab, 3, 1);
305 aMeshLayout->addWidget(myMeshOrder1Lab, 3, 2);
306 aMeshLayout->addWidget(myMeshOrder2Lab, 3, 3);
307 aMeshLayout->addWidget(myMeshNbEdgesLab, 4, 0);
308 aMeshLayout->addWidget(myMeshNbEdges, 4, 1);
309 aMeshLayout->addWidget(myMeshNbEdges1, 4, 2);
310 aMeshLayout->addWidget(myMeshNbEdges2, 4, 3);
311 aMeshLayout->addMultiCellWidget(myMeshFacesGroup, 5, 5, 0, 3);
312 aMeshLayout->addMultiCellWidget(myMeshVolumesGroup, 6, 6, 0, 3);
313 aMeshLayout->addItem(new QSpacerItem(6, 6, QSizePolicy::Minimum, QSizePolicy::Expanding), 7, 0);
316 mySubMeshWidget = new QWidget(myWGStack);
317 QGridLayout* aSubMeshLayout = new QGridLayout(mySubMeshWidget);
318 aSubMeshLayout->setSpacing(6); aSubMeshLayout->setMargin(0);
319 myWGStack->addWidget(mySubMeshWidget);
322 QLabel* mySubMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), mySubMeshWidget, "mySubMeshNameLab");
323 mySubMeshName = new QLabel(mySubMeshWidget, "mySubMeshName");
324 mySubMeshName->setMinimumWidth(100);
325 QFrame* line2 = new QFrame(mySubMeshWidget);
326 line2->setFrameStyle(QFrame::HLine | QFrame::Sunken);
329 QLabel* mySubMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), mySubMeshWidget, "mySubMeshNbNodesLab");
330 mySubMeshNbNodes = new QLabel(mySubMeshWidget, "mySubMeshNbNodes");
331 mySubMeshNbNodes->setMinimumWidth(100);
334 mySubMeshElementsGroup = new QGroupBox(tr("SMESH_MESHINFO_ELEMENTS"), mySubMeshWidget, "mySubMeshElementsGroup");
335 mySubMeshElementsGroup->setColumnLayout(0, Qt::Vertical);
336 mySubMeshElementsGroup->layout()->setSpacing(0); mySubMeshElementsGroup->layout()->setMargin(0);
337 QGridLayout* mySubMeshElementsGroupLayout = new QGridLayout(mySubMeshElementsGroup->layout());
338 mySubMeshElementsGroupLayout->setAlignment(Qt::AlignTop);
339 mySubMeshElementsGroupLayout->setSpacing(6); mySubMeshElementsGroupLayout->setMargin(11);
341 // --> elements --> total
342 QLabel* mySubMeshNbElementsLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), mySubMeshElementsGroup, "mySubMeshNbElementsLab");
343 mySubMeshNbElementsLab->setFont(fnt);
344 mySubMeshNbElements = new QLabel(mySubMeshElementsGroup, "mySubMeshNbElements");
345 mySubMeshNbElements->setMinimumWidth(100);
346 mySubMeshNbElements->setFont(fnt);
348 // --> elements --> edges
349 QLabel* mySubMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), mySubMeshElementsGroup, "mySubMeshNbEdgesLab");
350 mySubMeshNbEdges = new QLabel(mySubMeshElementsGroup, "mySubMeshNbEdges");
351 mySubMeshNbEdges->setMinimumWidth(100);
353 // --> elements --> faces
354 QLabel* mySubMeshNbFacesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), mySubMeshElementsGroup, "mySubMeshNbFacesLab");
355 mySubMeshNbFaces = new QLabel(mySubMeshElementsGroup, "mySubMeshNbFaces");
356 mySubMeshNbFaces->setMinimumWidth(100);
358 // --> elements --> volumes
359 QLabel* mySubMeshNbVolumesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), mySubMeshElementsGroup, "mySubMeshNbVolumesLab");
360 mySubMeshNbVolumes = new QLabel(mySubMeshElementsGroup, "mySubMeshNbVolumes");
361 mySubMeshNbVolumes->setMinimumWidth(100);
363 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbElementsLab, 0, 0);
364 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbElements, 0, 1);
365 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdgesLab, 1, 0);
366 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdges, 1, 1);
367 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFacesLab, 2, 0);
368 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFaces, 2, 1);
369 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumesLab, 3, 0);
370 mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumes, 3, 1);
372 aSubMeshLayout->addWidget(mySubMeshNameLab, 0, 0);
373 aSubMeshLayout->addWidget(mySubMeshName, 0, 1);
374 aSubMeshLayout->addMultiCellWidget(line2, 1, 1, 0, 1);
375 aSubMeshLayout->addWidget(mySubMeshNbNodesLab, 2, 0);
376 aSubMeshLayout->addWidget(mySubMeshNbNodes, 2, 1);
377 aSubMeshLayout->addMultiCellWidget(mySubMeshElementsGroup, 3, 3, 0, 1);
378 aSubMeshLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0);
381 myGroupWidget = new QWidget(myWGStack);
382 QGridLayout* myGroupWidgetLayout = new QGridLayout(myGroupWidget);
383 myGroupWidgetLayout->setSpacing(6); myGroupWidgetLayout->setMargin(0);
384 myWGStack->addWidget(myGroupWidget);
387 QLabel* myGroupNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myGroupWidget, "myGroupNameLab");
388 myGroupName = new QLabel(myGroupWidget, "myGroupName");
389 myGroupName->setMinimumWidth(100);
390 QFrame* line3 = new QFrame(myGroupWidget);
391 line3->setFrameStyle(QFrame::HLine | QFrame::Sunken);
394 QLabel* myGroupTypeLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TYPE")), myGroupWidget, "myGroupTypeLab");
395 myGroupType = new QLabel(myGroupWidget, "myGroupType");
396 myGroupType->setMinimumWidth(100);
398 // --> number of entities
399 QLabel* myGroupNbLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_ENTITIES")), myGroupWidget, "myGroupNbLab");
400 myGroupNb = new QLabel(myGroupWidget, "myGroupNb");
401 myGroupNb->setMinimumWidth(100);
403 myGroupWidgetLayout->addWidget(myGroupNameLab, 0, 0);
404 myGroupWidgetLayout->addWidget(myGroupName, 0, 1);
405 myGroupWidgetLayout->addMultiCellWidget(line3, 1, 1, 0, 1);
406 myGroupWidgetLayout->addWidget(myGroupTypeLab, 2, 0);
407 myGroupWidgetLayout->addWidget(myGroupType, 2, 1);
408 myGroupWidgetLayout->addWidget(myGroupNbLab, 3, 0);
409 myGroupWidgetLayout->addWidget(myGroupNb, 3, 1);
410 myGroupWidgetLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0);
413 myButtonsGroup = new QGroupBox(this, "myButtonsGroup");
414 myButtonsGroup->setColumnLayout(0, Qt::Vertical);
415 myButtonsGroup->layout()->setSpacing(0); myButtonsGroup->layout()->setMargin(0);
416 QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout(myButtonsGroup->layout());
417 myButtonsGroupLayout->setAlignment(Qt::AlignTop);
418 myButtonsGroupLayout->setSpacing(6); myButtonsGroupLayout->setMargin(11);
420 // buttons --> OK and Help buttons
421 myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), myButtonsGroup, "myOkBtn");
422 myOkBtn->setAutoDefault(TRUE); myOkBtn->setDefault(TRUE);
423 myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP" ), myButtonsGroup, "myHelpBtn");
424 myHelpBtn->setAutoDefault(TRUE);
426 myButtonsGroupLayout->addWidget(myOkBtn);
427 myButtonsGroupLayout->addStretch();
428 myButtonsGroupLayout->addWidget(myHelpBtn);
430 aTopLayout->addLayout(aSelectLayout);
431 aTopLayout->addWidget(myWGStack);
432 aTopLayout->addWidget(myButtonsGroup);
434 mySMESHGUI->SetActiveDialogBox(this);
437 connect(myOkBtn, SIGNAL(clicked()), this, SLOT(close()));
438 connect( myHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp()));
439 connect(mySelectBtn, SIGNAL(clicked()), this, SLOT(onStartSelection()));
440 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(close()));
441 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
442 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
446 // init dialog with current selection
447 onSelectionChanged();
449 myHelpFileName = "mesh_infos_page.html#advanced_mesh_infos_anchor";
452 //=================================================================================
453 // function : ~SMESHGUI_MeshInfosDlg()
454 // purpose : Destructor
455 //=================================================================================
456 SMESHGUI_MeshInfosDlg::~SMESHGUI_MeshInfosDlg()
460 //=================================================================================
461 // function : DumpMeshInfos()
463 //=================================================================================
464 void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
466 SUIT_OverrideCursor wc;
469 mySelectionMgr->selectedObjects(aList);
471 int nbSel = aList.Extent();
473 myStartSelection = false;
474 mySelectLab->setText("");
475 Handle(SALOME_InteractiveObject) IObject = aList.First();
476 _PTR(SObject) aSO = SMESH::GetActiveStudyDocument()->FindObjectID(IObject->getEntry());
478 //CORBA::Object_var anObject = aSO->GetObject();
479 CORBA::Object_var anObject = SMESH::SObjectToObject(aSO);
480 if (!CORBA::is_nil(anObject)) {
481 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObject);
482 if (!aMesh->_is_nil()) {
483 myWGStack->raiseWidget(myMeshWidget);
484 setCaption(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_OBJECT_MESH") + "]");
485 myMeshName->setText(aSO->GetName().c_str());
486 myMeshNbNodes->setNum((int)aMesh->NbNodes());
487 myMeshNbEdges->setNum((int)aMesh->NbEdges());
488 myMeshNbEdges1->setNum((int)aMesh->NbEdgesOfOrder(SMESH::ORDER_LINEAR));
489 myMeshNbEdges2->setNum((int)aMesh->NbEdgesOfOrder(SMESH::ORDER_QUADRATIC));
490 myMeshNbFaces->setNum((int)aMesh->NbFaces());
491 myMeshNbFaces1->setNum((int)aMesh->NbFacesOfOrder(SMESH::ORDER_LINEAR));
492 myMeshNbFaces2->setNum((int)aMesh->NbFacesOfOrder(SMESH::ORDER_QUADRATIC));
493 myMeshNbTriangles->setNum((int)aMesh->NbTriangles());
494 myMeshNbTriangles1->setNum((int)aMesh->NbTrianglesOfOrder(SMESH::ORDER_LINEAR));
495 myMeshNbTriangles2->setNum((int)aMesh->NbTrianglesOfOrder(SMESH::ORDER_QUADRATIC));
496 myMeshNbQuadrangles->setNum((int)aMesh->NbQuadrangles());
497 myMeshNbQuadrangles1->setNum((int)aMesh->NbQuadranglesOfOrder(SMESH::ORDER_LINEAR));
498 myMeshNbQuadrangles2->setNum((int)aMesh->NbQuadranglesOfOrder(SMESH::ORDER_QUADRATIC));
499 myMeshNbPolygones->setNum( (int)aMesh->NbPolygons() );
500 myMeshNbVolumes->setNum((int)aMesh->NbVolumes());
501 myMeshNbVolumes1->setNum((int)aMesh->NbVolumesOfOrder(SMESH::ORDER_LINEAR));
502 myMeshNbVolumes2->setNum((int)aMesh->NbVolumesOfOrder(SMESH::ORDER_QUADRATIC));
503 myMeshNbTetra->setNum((int)aMesh->NbTetras());
504 myMeshNbTetra1->setNum((int)aMesh->NbTetrasOfOrder(SMESH::ORDER_LINEAR));
505 myMeshNbTetra2->setNum((int)aMesh->NbTetrasOfOrder(SMESH::ORDER_QUADRATIC));
506 myMeshNbHexa->setNum((int)aMesh->NbHexas());
507 myMeshNbHexa1->setNum((int)aMesh->NbHexasOfOrder(SMESH::ORDER_LINEAR));
508 myMeshNbHexa2->setNum((int)aMesh->NbHexasOfOrder(SMESH::ORDER_QUADRATIC));
509 myMeshNbPrism->setNum((int)aMesh->NbPrisms());
510 myMeshNbPrism1->setNum((int)aMesh->NbPrismsOfOrder(SMESH::ORDER_LINEAR));
511 myMeshNbPrism2->setNum((int)aMesh->NbPrismsOfOrder(SMESH::ORDER_QUADRATIC));
512 myMeshNbPyra->setNum((int)aMesh->NbPyramids());
513 myMeshNbPyra1->setNum((int)aMesh->NbPyramidsOfOrder(SMESH::ORDER_LINEAR));
514 myMeshNbPyra2->setNum((int)aMesh->NbPyramidsOfOrder(SMESH::ORDER_QUADRATIC));
515 myMeshNbPolyhedrones->setNum( (int)aMesh->NbPolyhedrons() );
518 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObject);
519 if (!aSubMesh->_is_nil()) {
520 myWGStack->raiseWidget(mySubMeshWidget);
521 setCaption(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_SUBMESH") + "]");
522 mySubMeshName->setText(aSO->GetName().c_str());
523 mySubMeshNbNodes->setNum((int)aSubMesh->GetNumberOfNodes(true));
524 mySubMeshNbElements->setNum((int)aSubMesh->GetNumberOfElements());
525 mySubMeshNbEdges->setNum((int)(aSubMesh->GetElementsByType(SMESH::EDGE)->length()));
526 mySubMeshNbFaces->setNum((int)(aSubMesh->GetElementsByType(SMESH::FACE)->length()));
527 mySubMeshNbVolumes->setNum((int)(aSubMesh->GetElementsByType(SMESH::VOLUME)->length()));
530 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
531 if (!aGroup->_is_nil()) {
532 myWGStack->raiseWidget(myGroupWidget);
533 setCaption(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_GROUP") + "]");
534 myGroupName->setText(aSO->GetName().c_str());
535 int aType = aGroup->GetType();
539 strType = "SMESH_MESHINFO_NODES"; break;
541 strType = "SMESH_MESHINFO_EDGES"; break;
543 strType = "SMESH_MESHINFO_FACES"; break;
545 strType = "SMESH_MESHINFO_VOLUMES"; break;
547 strType = "SMESH_MESHINFO_ALL_TYPES"; break;
550 myGroupType->setText(tr(strType));
551 myGroupNb->setNum((int)aGroup->Size());
557 myWGStack->raiseWidget(0);
558 setCaption(tr("SMESH_MESHINFO_TITLE"));
561 //=================================================================================
562 // function : SelectionIntoArgument()
563 // purpose : Called when selection has changed
564 //=================================================================================
565 void SMESHGUI_MeshInfosDlg::onSelectionChanged()
567 if (myStartSelection)
571 //=================================================================================
572 // function : closeEvent()
574 //=================================================================================
575 void SMESHGUI_MeshInfosDlg::closeEvent (QCloseEvent* e)
577 mySMESHGUI->ResetState();
578 QDialog::closeEvent(e);
581 //=================================================================================
582 // function : windowActivationChange()
583 // purpose : called when window is activated/deactivated
584 //=================================================================================
585 void SMESHGUI_MeshInfosDlg::windowActivationChange (bool oldActive)
587 QDialog::windowActivationChange(oldActive);
588 if (isActiveWindow() && myIsActiveWindow != isActiveWindow())
589 ActivateThisDialog();
590 myIsActiveWindow = isActiveWindow();
593 //=================================================================================
594 // function : DeactivateActiveDialog()
596 //=================================================================================
597 void SMESHGUI_MeshInfosDlg::DeactivateActiveDialog()
599 disconnect(mySelectionMgr, 0, this, 0);
602 //=================================================================================
603 // function : ActivateThisDialog()
605 //=================================================================================
606 void SMESHGUI_MeshInfosDlg::ActivateThisDialog()
608 /* Emit a signal to deactivate any active dialog */
609 mySMESHGUI->EmitSignalDeactivateDialog();
610 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
613 //=================================================================================
614 // function : onStartSelection()
615 // purpose : starts selection
616 //=================================================================================
617 void SMESHGUI_MeshInfosDlg::onStartSelection()
619 myStartSelection = true;
620 onSelectionChanged();
621 myStartSelection = true;
622 mySelectLab->setText(tr("INF_SELECT_OBJECT"));
625 //=================================================================================
626 // function : onHelp()
628 //=================================================================================
629 void SMESHGUI_MeshInfosDlg::onHelp()
631 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
633 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
637 platform = "winapplication";
639 platform = "application";
641 SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
642 QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
643 arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
644 QObject::tr("BUT_OK"));
648 //=================================================================================
649 // function : keyPressEvent()
651 //=================================================================================
652 void SMESHGUI_MeshInfosDlg::keyPressEvent( QKeyEvent* e )
654 QDialog::keyPressEvent( e );
655 if ( e->isAccepted() )
658 if ( e->key() == Key_F1 )