1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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 // File : SMESHGUI_MeshInfo.cxx
23 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
25 #include "SMESHGUI_MeshInfo.h"
27 #include "SMDSAbs_ElementType.hxx"
28 #include "SMDS_BallElement.hxx"
29 #include "SMDS_EdgePosition.hxx"
30 #include "SMDS_FacePosition.hxx"
31 #include "SMDS_Mesh.hxx"
32 #include "SMDS_VolumeTool.hxx"
33 #include "SMESHDS_Mesh.hxx"
35 #include "SMESHGUI_FilterUtils.h"
36 #include "SMESHGUI_IdPreview.h"
37 #include "SMESHGUI_IdValidator.h"
38 #include "SMESHGUI_SpinBox.h"
39 #include "SMESHGUI_Utils.h"
40 #include "SMESHGUI_VTKUtils.h"
41 #include "SMESH_Actor.h"
43 #include <LightApp_SelectionMgr.h>
44 #include <SUIT_FileDlg.h>
45 #include <SUIT_OverrideCursor.h>
46 #include <SUIT_ResourceMgr.h>
47 #include <SUIT_Session.h>
48 #include <SVTK_ViewWindow.h>
50 #include <SALOMEDSClient_Study.hxx>
51 #include <SalomeApp_Study.h>
53 #include <QApplication>
54 #include <QButtonGroup>
56 #include <QContextMenuEvent>
57 #include <QGridLayout>
58 #include <QHBoxLayout>
59 #include <QHeaderView>
60 #include <QItemDelegate>
65 #include <QPushButton>
66 #include <QToolButton>
67 #include <QRadioButton>
68 #include <QTextStream>
70 #include <QTextBrowser>
71 #include <QVBoxLayout>
73 #include "utilities.h"
75 #include <SALOMEconfig.h>
76 #include CORBA_SERVER_HEADER(GEOM_Gen)
80 const int SPACING = 6;
82 const int MAXITEMS = 10;
83 const int GROUPS_ID = 100;
84 const int SUBMESHES_ID = 200;
85 const int SPACING_INFO = 2;
87 const char* id_preview_resource = "id_preview_resource";
90 TypeRole = Qt::UserRole + 10,
95 NodeConnectivity = 100,
104 class ExtraWidget : public QWidget
107 ExtraWidget( QWidget*, bool = false );
110 void updateControls( int, int, int = MAXITEMS );
119 ExtraWidget::ExtraWidget( QWidget* parent, bool b ) : QWidget( parent ), brief( b )
121 current = new QLabel( this );
122 current->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
123 prev = new QPushButton( tr( "<<" ), this );
124 next = new QPushButton( tr( ">>" ), this );
125 QHBoxLayout* hbl = new QHBoxLayout( this );
126 hbl->setContentsMargins( 0, SPACING, 0, 0 );
127 hbl->setSpacing( SPACING );
129 hbl->addWidget( current );
130 hbl->addWidget( prev );
131 hbl->addWidget( next );
134 ExtraWidget::~ExtraWidget()
138 void ExtraWidget::updateControls( int total, int index, int blockSize )
140 setVisible( total > blockSize );
141 QString format = brief ? QString( "%1-%2 / %3" ) : SMESHGUI_MeshInfoDlg::tr( "X_FROM_Y_ITEMS_SHOWN" );
142 current->setText( format.arg( index*blockSize+1 ).arg( qMin( index*blockSize+blockSize, total )).arg( total ));
143 prev->setEnabled( index > 0 );
144 next->setEnabled( (index+1)*blockSize < total );
149 \brief Customization of standard "Save file" dialog box for dump info operation
153 class DumpFileDlg : public SUIT_FileDlg
156 DumpFileDlg( QWidget* parent );
158 QCheckBox* myBaseChk;
159 QCheckBox* myElemChk;
161 QCheckBox* myCtrlChk;
168 DumpFileDlg::DumpFileDlg( QWidget* parent ) : SUIT_FileDlg( parent, false, true, true )
170 QGridLayout* grid = ::qobject_cast<QGridLayout *>( layout() );
172 QWidget* hB = new QWidget( this );
173 myBaseChk = new QCheckBox( SMESHGUI::tr( "PREF_DUMP_BASE_INFO" ), hB );
174 myElemChk = new QCheckBox( SMESHGUI::tr( "PREF_DUMP_ELEM_INFO" ), hB );
175 myAddChk = new QCheckBox( SMESHGUI::tr( "PREF_DUMP_ADD_INFO" ), hB );
176 myCtrlChk = new QCheckBox( SMESHGUI::tr( "PREF_DUMP_CTRL_INFO" ), hB );
178 QGridLayout* layout = new QGridLayout( hB );
179 layout->addWidget( myBaseChk, 0, 0 );
180 layout->addWidget( myElemChk, 0, 1 );
181 layout->addWidget( myAddChk, 1, 0 );
182 layout->addWidget( myCtrlChk, 1, 1 );
184 QPushButton* pb = new QPushButton( this );
186 int row = grid->rowCount();
187 grid->addWidget( new QLabel( "", this ), row, 0 );
188 grid->addWidget( hB, row, 1, 1, 3 );
189 grid->addWidget( pb, row, 5 );
196 \brief Get depth of the tree item
198 \param theItem tree widget item
199 \return item's depth in tree widget (where top-level items have zero depth)
201 static int itemDepth( QTreeWidgetItem* item )
204 QTreeWidgetItem* p = item->parent();
213 \class SMESHGUI_MeshInfo
214 \brief Base mesh information widget
216 Displays the base information about mesh object: mesh, sub-mesh, group or arbitrary ID source.
221 \param parent parent widget
223 SMESHGUI_MeshInfo::SMESHGUI_MeshInfo( QWidget* parent )
224 : QFrame( parent ), myWidgets( iElementsEnd )
226 setFrameStyle( StyledPanel | Sunken );
228 QGridLayout* l = new QGridLayout( this );
229 l->setMargin( MARGIN );
230 l->setSpacing( SPACING );
235 QLabel* aNameLab = new QLabel( tr( "NAME_LAB" ), this );
236 QLabel* aName = createField();
237 aName->setObjectName("meshName");
238 aName->setMinimumWidth( 150 );
239 QLabel* aObjLab = new QLabel( tr( "OBJECT_LAB" ), this );
240 QLabel* aObj = createField();
241 aObj->setObjectName("meshType");
242 aObj->setMinimumWidth( 150 );
243 myWidgets[ index++ ] << aNameLab << aName;
244 myWidgets[ index++ ] << aObjLab << aObj;
247 QWidget* aNodesLine = createLine();
248 QLabel* aNodesLab = new QLabel( tr( "NODES_LAB" ), this );
249 QLabel* aNodes = createField();
250 aNodes->setObjectName("nbNodes");
251 myWidgets[ index++ ] << aNodesLine;
252 myWidgets[ index++ ] << aNodesLab << aNodes;
255 QWidget* aElemLine = createLine();
256 QLabel* aElemLab = new QLabel( tr( "ELEMENTS_LAB" ), this );
257 QLabel* aElemTotal = new QLabel( tr( "TOTAL_LAB" ), this );
258 QLabel* aElemLin = new QLabel( tr( "LINEAR_LAB" ), this );
259 QLabel* aElemQuad = new QLabel( tr( "QUADRATIC_LAB" ), this );
260 QLabel* aElemBiQuad = new QLabel( tr( "BI_QUADRATIC_LAB" ), this );
261 myWidgets[ index++ ] << aElemLine;
262 myWidgets[ index++ ] << aElemLab << aElemTotal << aElemLin << aElemQuad << aElemBiQuad;
264 // ... Number elements
265 QWidget* aNbLine = createLine();
266 QLabel* aNbTotal = createField();
267 aNbTotal->setObjectName("totalNbElems");
268 QLabel* aNbLin = createField();
269 aNbLin->setObjectName("totalNbLinearElems");
270 QLabel* aNbQuad = createField();
271 aNbQuad->setObjectName("totalNbQuadraticElems");
272 QLabel* aNbBiQuad = createField();
273 aNbBiQuad->setObjectName("totalNbBiQuadraticElems");
274 myWidgets[ index++ ] << aNbLine;
275 myWidgets[ index++ ] << new QLabel( "", this ) << aNbTotal << aNbLin << aNbQuad << aNbBiQuad;
278 QWidget* a0DLine = createLine();
279 QLabel* a0DLab = new QLabel( tr( "0D_LAB" ), this );
280 QLabel* a0DTotal = createField();
281 a0DTotal->setObjectName("nb0D");
283 myWidgets[ index++ ] << a0DLine;
284 myWidgets[ index++ ] << a0DLab << a0DTotal;
287 QWidget* aBallLine = createLine();
288 QLabel* aBallLab = new QLabel( tr( "BALL_LAB" ), this );
289 QLabel* aBallTotal = createField();
290 aBallTotal->setObjectName("nbBall");
291 myWidgets[ index++ ] << aBallLine;
292 myWidgets[ index++ ] << aBallLab << aBallTotal;
295 QWidget* a1DLine = createLine();
296 QLabel* a1DLab = new QLabel( tr( "1D_LAB" ), this );
297 QLabel* a1DTotal = createField();
298 a1DTotal->setObjectName("nb1D");
299 QLabel* a1DLin = createField();
300 a1DLin->setObjectName("nbLinear1D");
301 QLabel* a1DQuad = createField();
302 a1DQuad->setObjectName("nbQuadratic1D");
303 myWidgets[ index++ ] << a1DLine;
304 myWidgets[ index++ ] << a1DLab << a1DTotal << a1DLin << a1DQuad;
307 QWidget* a2DLine = createLine();
308 QLabel* a2DLab = new QLabel( tr( "2D_LAB" ), this );
309 QLabel* a2DTotal = createField();
310 a2DTotal->setObjectName("nb2D");
311 QLabel* a2DLin = createField();
312 a2DLin->setObjectName("nbLinear2D");
313 QLabel* a2DQuad = createField();
314 a2DQuad->setObjectName("nbQuadratic2D");
315 QLabel* a2DBiQuad = createField();
316 a2DBiQuad->setObjectName("nbBiQuadratic2D");
317 QLabel* a2DTriLab = new QLabel( tr( "TRIANGLES_LAB" ), this );
318 QLabel* a2DTriTotal = createField();
319 a2DTriTotal->setObjectName("nbTriangle");
320 QLabel* a2DTriLin = createField();
321 a2DTriLin->setObjectName("nbLinearTriangle");
322 QLabel* a2DTriQuad = createField();
323 a2DTriQuad->setObjectName("nbQuadraticTriangle");
324 QLabel* a2DTriBiQuad = createField();
325 a2DTriBiQuad->setObjectName("nbBiQuadraticTriangle");
326 QLabel* a2DQuaLab = new QLabel( tr( "QUADRANGLES_LAB" ), this );
327 QLabel* a2DQuaTotal = createField();
328 a2DQuaTotal->setObjectName("nbQuadrangle");
329 QLabel* a2DQuaLin = createField();
330 a2DQuaLin->setObjectName("nbLinearQuadrangle");
331 QLabel* a2DQuaQuad = createField();
332 a2DQuaQuad->setObjectName("nbQuadraticQuadrangle");
333 QLabel* a2DQuaBiQuad = createField();
334 a2DQuaBiQuad->setObjectName("nbBiQuadraticQuadrangle");
335 QLabel* a2DPolLab = new QLabel( tr( "POLYGONS_LAB" ), this );
336 QLabel* a2DPolTotal = createField();
337 a2DPolTotal->setObjectName("nbPolygon");
338 QLabel* a2DPolLin = createField();
339 a2DPolLin->setObjectName("nbLinearPolygon");
340 QLabel* a2DPolQuad = createField();
341 a2DPolQuad->setObjectName("nbQuadraticPolygon");
342 myWidgets[ index++ ] << a2DLine;
343 myWidgets[ index++ ] << a2DLab << a2DTotal << a2DLin << a2DQuad << a2DBiQuad;
344 myWidgets[ index++ ] << a2DTriLab << a2DTriTotal << a2DTriLin << a2DTriQuad << a2DTriBiQuad;
345 myWidgets[ index++ ] << a2DQuaLab << a2DQuaTotal << a2DQuaLin << a2DQuaQuad << a2DQuaBiQuad;
346 myWidgets[ index++ ] << a2DPolLab << a2DPolTotal << a2DPolLin << a2DPolQuad;
349 QWidget* a3DLine = createLine();
350 QLabel* a3DLab = new QLabel( tr( "3D_LAB" ), this );
351 QLabel* a3DTotal = createField();
352 a3DTotal->setObjectName("nb3D");
353 QLabel* a3DLin = createField();
354 a3DLin->setObjectName("nbLinear3D");
355 QLabel* a3DQuad = createField();
356 a3DQuad->setObjectName("nbQuadratic3D");
357 QLabel* a3DBiQuad = createField();
358 a3DBiQuad->setObjectName("nbBiQuadratic3D");
359 QLabel* a3DTetLab = new QLabel( tr( "TETRAHEDRONS_LAB" ), this );
360 QLabel* a3DTetTotal = createField();
361 a3DTetTotal->setObjectName("nbTetrahedron");
362 QLabel* a3DTetLin = createField();
363 a3DTetLin->setObjectName("nbLinearTetrahedron");
364 QLabel* a3DTetQuad = createField();
365 a3DTetQuad->setObjectName("nbQudraticTetrahedron");
366 QLabel* a3DHexLab = new QLabel( tr( "HEXAHEDONRS_LAB" ), this );
367 QLabel* a3DHexTotal = createField();
368 a3DHexTotal->setObjectName("nbHexahedron");
369 QLabel* a3DHexLin = createField();
370 a3DHexLin->setObjectName("nbLinearHexahedron");
371 QLabel* a3DHexQuad = createField();
372 a3DHexQuad->setObjectName("nbQuadraticHexahedron");
373 QLabel* a3DHexBiQuad = createField();
374 a3DHexBiQuad->setObjectName("nbBiQuadraticHexahedron");
375 QLabel* a3DPyrLab = new QLabel( tr( "PYRAMIDS_LAB" ), this );
376 QLabel* a3DPyrTotal = createField();
377 a3DPyrTotal->setObjectName("nbPyramid");
378 QLabel* a3DPyrLin = createField();
379 a3DPyrLin->setObjectName("nbLinearPyramid");
380 QLabel* a3DPyrQuad = createField();
381 a3DPyrQuad->setObjectName("nbQuadraticPyramid");
382 QLabel* a3DPriLab = new QLabel( tr( "PRISMS_LAB" ), this );
383 QLabel* a3DPriTotal = createField();
384 a3DPriTotal->setObjectName("nbPrism");
385 QLabel* a3DPriLin = createField();
386 a3DPriLin->setObjectName("nbLinearPrism");
387 QLabel* a3DPriQuad = createField();
388 a3DPriQuad->setObjectName("nbQuadraticPrism");
389 QLabel* a3DPriBiQuad = createField();
390 a3DPriBiQuad->setObjectName("nbBiQuadraticPrism");
391 QLabel* a3DHexPriLab = new QLabel( tr( "HEX_PRISMS_LAB" ), this );
392 QLabel* a3DHexPriTotal = createField();
393 a3DHexPriTotal->setObjectName("nbHexagonalPrism");
394 QLabel* a3DPolLab = new QLabel( tr( "POLYHEDRONS_LAB" ), this );
395 QLabel* a3DPolTotal = createField();
396 a3DPolTotal->setObjectName("nbPolyhedron");
397 myWidgets[ index++ ] << a3DLine;
398 myWidgets[ index++ ] << a3DLab << a3DTotal << a3DLin << a3DQuad << a3DBiQuad;
399 myWidgets[ index++ ] << a3DTetLab << a3DTetTotal << a3DTetLin << a3DTetQuad;
400 myWidgets[ index++ ] << a3DHexLab << a3DHexTotal << a3DHexLin << a3DHexQuad << a3DHexBiQuad;
401 myWidgets[ index++ ] << a3DPyrLab << a3DPyrTotal << a3DPyrLin << a3DPyrQuad;
402 myWidgets[ index++ ] << a3DPriLab << a3DPriTotal << a3DPriLin << a3DPriQuad << a3DPriBiQuad;
403 myWidgets[ index++ ] << a3DHexPriLab << a3DHexPriTotal;
404 myWidgets[ index++ ] << a3DPolLab << a3DPolTotal;
406 myLoadBtn = new QPushButton( tr( "BUT_LOAD_MESH" ), this );
407 myLoadBtn->setAutoDefault( true );
408 connect( myLoadBtn, SIGNAL( clicked() ), this, SLOT( loadMesh() ));
410 setFontAttributes( aNameLab, Bold );
411 setFontAttributes( aObjLab, Bold );
412 setFontAttributes( aNodesLab, Bold );
413 setFontAttributes( aElemLab, Bold );
414 setFontAttributes( aElemTotal, Italic );
415 setFontAttributes( aElemLin, Italic );
416 setFontAttributes( aElemQuad, Italic );
417 setFontAttributes( aElemBiQuad, Italic );
418 setFontAttributes( a0DLab, Bold );
419 setFontAttributes( aBallLab, Bold );
420 setFontAttributes( a1DLab, Bold );
421 setFontAttributes( a2DLab, Bold );
422 setFontAttributes( a3DLab, Bold );
424 l->addWidget( aNameLab, 0, 0 );
425 l->addWidget( aName, 0, 1, 1, 4 );
426 l->addWidget( aObjLab, 1, 0 );
427 l->addWidget( aObj, 1, 1, 1, 4 );
428 l->addWidget( aNodesLine, 2, 0, 1, 5 );
429 l->addWidget( aNodesLab, 3, 0 );
430 l->addWidget( aNodes, 3, 1 );
431 l->addWidget( aElemLine, 4, 0, 1, 5 );
432 l->addWidget( aElemLab, 5, 0 );
433 l->addWidget( aElemTotal, 5, 1 );
434 l->addWidget( aElemLin, 5, 2 );
435 l->addWidget( aElemQuad, 5, 3 );
436 l->addWidget( aElemBiQuad, 5, 4 );
437 l->addWidget( aNbLine, 6, 1, 1, 4 );
438 l->addWidget( aNbTotal, 7, 1 );
439 l->addWidget( aNbLin, 7, 2 );
440 l->addWidget( aNbQuad, 7, 3 );
441 l->addWidget( aNbBiQuad, 7, 4 );
442 l->addWidget( a0DLine, 8, 1, 1, 4 );
443 l->addWidget( a0DLab, 9, 0 );
444 l->addWidget( a0DTotal, 9, 1 );
445 l->addWidget( aBallLine, 10, 1, 1, 4 );
446 l->addWidget( aBallLab, 11, 0 );
447 l->addWidget( aBallTotal, 11, 1 );
448 l->addWidget( a1DLine, 12, 1, 1, 4 );
449 l->addWidget( a1DLab, 13, 0 );
450 l->addWidget( a1DTotal, 13, 1 );
451 l->addWidget( a1DLin, 13, 2 );
452 l->addWidget( a1DQuad, 13, 3 );
453 l->addWidget( a2DLine, 14, 1, 1, 4 );
454 l->addWidget( a2DLab, 15, 0 );
455 l->addWidget( a2DTotal, 15, 1 );
456 l->addWidget( a2DLin, 15, 2 );
457 l->addWidget( a2DQuad, 15, 3 );
458 l->addWidget( a2DBiQuad, 15, 4 );
459 l->addWidget( a2DTriLab, 16, 0 );
460 l->addWidget( a2DTriTotal, 16, 1 );
461 l->addWidget( a2DTriLin, 16, 2 );
462 l->addWidget( a2DTriQuad, 16, 3 );
463 l->addWidget( a2DTriBiQuad, 16, 4 );
464 l->addWidget( a2DQuaLab, 17, 0 );
465 l->addWidget( a2DQuaTotal, 17, 1 );
466 l->addWidget( a2DQuaLin, 17, 2 );
467 l->addWidget( a2DQuaQuad, 17, 3 );
468 l->addWidget( a2DQuaBiQuad, 17, 4 );
469 l->addWidget( a2DPolLab, 18, 0 );
470 l->addWidget( a2DPolTotal, 18, 1 );
471 l->addWidget( a2DPolLin, 18, 2 );
472 l->addWidget( a2DPolQuad, 18, 3 );
473 l->addWidget( a3DLine, 19, 1, 1, 4 );
474 l->addWidget( a3DLab, 20, 0 );
475 l->addWidget( a3DTotal, 20, 1 );
476 l->addWidget( a3DLin, 20, 2 );
477 l->addWidget( a3DQuad, 20, 3 );
478 l->addWidget( a3DBiQuad, 20, 4 );
479 l->addWidget( a3DTetLab, 21, 0 );
480 l->addWidget( a3DTetTotal, 21, 1 );
481 l->addWidget( a3DTetLin, 21, 2 );
482 l->addWidget( a3DTetQuad, 21, 3 );
483 l->addWidget( a3DHexLab, 22, 0 );
484 l->addWidget( a3DHexTotal, 22, 1 );
485 l->addWidget( a3DHexLin, 22, 2 );
486 l->addWidget( a3DHexQuad, 22, 3 );
487 l->addWidget( a3DHexBiQuad, 22, 4 );
488 l->addWidget( a3DPyrLab, 23, 0 );
489 l->addWidget( a3DPyrTotal, 23, 1 );
490 l->addWidget( a3DPyrLin, 23, 2 );
491 l->addWidget( a3DPyrQuad, 23, 3 );
492 l->addWidget( a3DPriLab, 24, 0 );
493 l->addWidget( a3DPriTotal, 24, 1 );
494 l->addWidget( a3DPriLin, 24, 2 );
495 l->addWidget( a3DPriQuad, 24, 3 );
496 l->addWidget( a3DPriBiQuad, 24, 4 );
497 l->addWidget( a3DHexPriLab, 25, 0 );
498 l->addWidget( a3DHexPriTotal, 25, 1 );
499 l->addWidget( a3DPolLab, 26, 0 );
500 l->addWidget( a3DPolTotal, 26, 1 );
501 l->addWidget( myLoadBtn, 28, 1, 1, 4 );
503 l->setColumnStretch( 0, 0 );
504 l->setColumnStretch( 1, 5 );
505 l->setColumnStretch( 2, 5 );
506 l->setColumnStretch( 3, 5 );
507 l->setColumnStretch( 4, 5 );
508 l->setRowStretch( 27, 5 );
516 SMESHGUI_MeshInfo::~SMESHGUI_MeshInfo()
521 \brief Show information on the mesh object.
522 \param obj object being processed (mesh, sub-mesh, group, ID source)
524 void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
527 if ( !CORBA::is_nil( obj )) {
528 _PTR(SObject) sobj = SMESH::ObjectToSObject( obj );
530 myWidgets[iName][iSingle]->setProperty( "text", sobj->GetName().c_str() );
531 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( obj );
532 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( obj );
533 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( obj );
534 if ( !aMesh->_is_nil() ) {
535 myWidgets[iObject][iSingle]->setProperty( "text", tr( "OBJECT_MESH" ));
537 else if ( !aSubMesh->_is_nil() ) {
538 myWidgets[iObject][iSingle]->setProperty( "text", tr( "OBJECT_SUBMESH" ));
540 else if ( !aGroup->_is_nil() ) {
542 switch( aGroup->GetType() ) {
543 case SMESH::NODE: objType = tr( "OBJECT_GROUP_NODES" );break;
544 case SMESH::EDGE: objType = tr( "OBJECT_GROUP_EDGES" );break;
545 case SMESH::FACE: objType = tr( "OBJECT_GROUP_FACES" );break;
546 case SMESH::VOLUME:objType = tr( "OBJECT_GROUP_VOLUMES" );break;
547 case SMESH::ELEM0D:objType = tr( "OBJECT_GROUP_0DELEMS" );break;
548 case SMESH::BALL: objType = tr( "OBJECT_GROUP_BALLS" );break;
549 default: objType = tr( "OBJECT_GROUP" );break;
551 myWidgets[iObject][iSingle]->setProperty( "text", objType );
553 SMESH::long_array_var info = obj->GetMeshInfo();
554 myWidgets[iNodes][iTotal] ->setProperty( "text", QString::number( info[SMDSEntity_Node] ));
555 myWidgets[i0D][iTotal] ->setProperty( "text", QString::number( info[SMDSEntity_0D] ));
556 myWidgets[iBalls][iTotal] ->setProperty( "text", QString::number( info[SMDSEntity_Ball] ));
557 long nbEdges = info[SMDSEntity_Edge] + info[SMDSEntity_Quad_Edge];
558 myWidgets[i1D][iTotal] ->setProperty( "text", QString::number( nbEdges ));
559 myWidgets[i1D][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Edge] ));
560 myWidgets[i1D][iQuadratic]->setProperty( "text", QString::number( info[SMDSEntity_Quad_Edge] ));
561 long nbTriangles = info[SMDSEntity_Triangle] + info[SMDSEntity_Quad_Triangle] + info[SMDSEntity_BiQuad_Triangle];
562 long nbQuadrangles = info[SMDSEntity_Quadrangle] + info[SMDSEntity_Quad_Quadrangle] + info[SMDSEntity_BiQuad_Quadrangle];
563 long nb2DPolygons = info[SMDSEntity_Polygon] + info[SMDSEntity_Quad_Polygon];
564 long nb2DLinear = info[SMDSEntity_Triangle] + info[SMDSEntity_Quadrangle] + info[SMDSEntity_Polygon];
565 long nb2DQuadratic = info[SMDSEntity_Quad_Triangle] + info[SMDSEntity_Quad_Quadrangle] + info[SMDSEntity_Quad_Polygon];
566 long nb2DBiQuadratic = info[SMDSEntity_BiQuad_Triangle] + info[SMDSEntity_BiQuad_Quadrangle];
567 long nb2DTotal = nb2DLinear + nb2DQuadratic + nb2DBiQuadratic;
569 myWidgets[i2D][iTotal] ->setProperty( "text", QString::number( nb2DTotal ));
570 myWidgets[i2D][iLinear] ->setProperty( "text", QString::number( nb2DLinear ));
571 myWidgets[i2D][iQuadratic] ->setProperty( "text", QString::number( nb2DQuadratic ));
572 myWidgets[i2D][iBiQuadratic] ->setProperty( "text", QString::number( nb2DBiQuadratic ));
573 myWidgets[i2DTriangles][iTotal] ->setProperty( "text", QString::number( nbTriangles ));
574 myWidgets[i2DTriangles][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Triangle] ));
575 myWidgets[i2DTriangles][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Triangle] ));
576 myWidgets[i2DTriangles][iBiQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_BiQuad_Triangle] ));
577 myWidgets[i2DQuadrangles][iTotal] ->setProperty( "text", QString::number( nbQuadrangles ));
578 myWidgets[i2DQuadrangles][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Quadrangle] ));
579 myWidgets[i2DQuadrangles][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Quadrangle] ));
580 myWidgets[i2DQuadrangles][iBiQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_BiQuad_Quadrangle] ));
581 myWidgets[i2DPolygons][iTotal] ->setProperty( "text", QString::number( nb2DPolygons ));
582 myWidgets[i2DPolygons][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Polygon] ));
583 myWidgets[i2DPolygons][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Polygon] ));
584 long nbTetrahedrons = info[SMDSEntity_Tetra] + info[SMDSEntity_Quad_Tetra];
585 long nbHexahedrons = info[SMDSEntity_Hexa] + info[SMDSEntity_Quad_Hexa] + info[SMDSEntity_TriQuad_Hexa];
586 long nbPyramids = info[SMDSEntity_Pyramid] + info[SMDSEntity_Quad_Pyramid];
587 long nbPrisms = info[SMDSEntity_Penta] + info[SMDSEntity_Quad_Penta] + info[SMDSEntity_BiQuad_Penta];
588 long nb3DLinear = info[SMDSEntity_Tetra] + info[SMDSEntity_Hexa] + info[SMDSEntity_Pyramid] + info[SMDSEntity_Penta] + info[SMDSEntity_Polyhedra] + info[SMDSEntity_Hexagonal_Prism];
589 long nb3DQuadratic = info[SMDSEntity_Quad_Tetra] + info[SMDSEntity_Quad_Hexa] + info[SMDSEntity_Quad_Pyramid] + info[SMDSEntity_Quad_Penta];
590 long nb3DBiQuadratic = info[SMDSEntity_TriQuad_Hexa] + info[SMDSEntity_BiQuad_Penta];
591 long nb3DTotal = nb3DLinear + nb3DQuadratic + nb3DBiQuadratic;
592 myWidgets[i3D][iTotal] ->setProperty( "text", QString::number( nb3DTotal ));
593 myWidgets[i3D][iLinear] ->setProperty( "text", QString::number( nb3DLinear ));
594 myWidgets[i3D][iQuadratic] ->setProperty( "text", QString::number( nb3DQuadratic ));
595 myWidgets[i3D][iBiQuadratic] ->setProperty( "text", QString::number( nb3DBiQuadratic ));
596 myWidgets[i3DTetrahedrons][iTotal] ->setProperty( "text", QString::number( nbTetrahedrons ));
597 myWidgets[i3DTetrahedrons][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Tetra] ));
598 myWidgets[i3DTetrahedrons][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Tetra] ));
599 myWidgets[i3DHexahedrons][iTotal] ->setProperty( "text", QString::number( nbHexahedrons ));
600 myWidgets[i3DHexahedrons][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Hexa] ));
601 myWidgets[i3DHexahedrons][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Hexa] ));
602 myWidgets[i3DHexahedrons][iBiQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_TriQuad_Hexa] ));
603 myWidgets[i3DPyramids][iTotal] ->setProperty( "text", QString::number( nbPyramids ));
604 myWidgets[i3DPyramids][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Pyramid] ));
605 myWidgets[i3DPyramids][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Pyramid] ));
606 myWidgets[i3DPrisms][iTotal] ->setProperty( "text", QString::number( nbPrisms ));
607 myWidgets[i3DPrisms][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Penta] ));
608 myWidgets[i3DPrisms][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Penta] ));
609 myWidgets[i3DPrisms][iBiQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_BiQuad_Penta] ));
610 myWidgets[i3DHexaPrisms][iTotal] ->setProperty( "text", QString::number( info[SMDSEntity_Hexagonal_Prism] ));
611 myWidgets[i3DPolyhedrons][iTotal] ->setProperty( "text", QString::number( info[SMDSEntity_Polyhedra] ));
612 long nbElemTotal = info[SMDSEntity_0D] + info[SMDSEntity_Ball] + nbEdges + nb2DTotal + nb3DTotal;
613 long nbElemLinerial = info[SMDSEntity_Edge] + nb2DLinear + nb3DLinear;
614 long nbElemQuadratic = info[SMDSEntity_Quad_Edge] + nb2DQuadratic + nb3DQuadratic;
615 long nbElemBiQuadratic = nb2DBiQuadratic + nb3DBiQuadratic;
616 myWidgets[iNb][iTotal] ->setProperty( "text", QString::number( nbElemTotal ));
617 myWidgets[iNb][iLinear] ->setProperty( "text", QString::number( nbElemLinerial ));
618 myWidgets[iNb][iQuadratic] ->setProperty( "text", QString::number( nbElemQuadratic ));
619 myWidgets[iNb][iBiQuadratic]->setProperty( "text", QString::number( nbElemBiQuadratic ));
620 // before full loading from study file, type of elements in a sub-mesh can't be defined
622 bool infoOK = obj->IsMeshInfoCorrect();
623 myLoadBtn->setVisible( !infoOK );
627 // 1. Type of 2D or 3D elements is unknown but their nb is OK (for a sub-mesh)
628 // 2. No info at all (for a group on geom or filter)
629 bool hasAnyInfo = false;
630 for ( size_t i = 0; i < info->length() && !hasAnyInfo; ++i )
631 hasAnyInfo = info[i];
632 if ( hasAnyInfo ) // believe it is a sub-mesh
634 if ( nb2DLinear + nb2DQuadratic + nb2DBiQuadratic > 0 )
636 myWidgets[i2D][iLinear] ->setProperty( "text", "?" );
637 myWidgets[i2D][iQuadratic] ->setProperty( "text", "?" );
638 myWidgets[i2D][iBiQuadratic] ->setProperty( "text", "?" );
639 myWidgets[i2DTriangles][iTotal] ->setProperty( "text", "?" );
640 myWidgets[i2DTriangles][iLinear] ->setProperty( "text", "?" );
641 myWidgets[i2DTriangles][iQuadratic] ->setProperty( "text", "?" );
642 myWidgets[i2DTriangles][iBiQuadratic] ->setProperty( "text", "?" );
643 myWidgets[i2DQuadrangles][iTotal] ->setProperty( "text", "?" );
644 myWidgets[i2DQuadrangles][iLinear] ->setProperty( "text", "?" );
645 myWidgets[i2DQuadrangles][iQuadratic] ->setProperty( "text", "?" );
646 myWidgets[i2DQuadrangles][iBiQuadratic] ->setProperty( "text", "?" );
647 myWidgets[i2DPolygons][iLinear] ->setProperty( "text", "?" );
648 myWidgets[i2DPolygons][iQuadratic] ->setProperty( "text", "?" );
649 myWidgets[i2DPolygons][iTotal] ->setProperty( "text", "?" );
650 myWidgets[iNb][iTotal] ->setProperty( "text", "?" );
651 myWidgets[iNb][iLinear] ->setProperty( "text", "?" );
652 myWidgets[iNb][iQuadratic] ->setProperty( "text", "?" );
653 myWidgets[iNb][iBiQuadratic] ->setProperty( "text", "?" );
655 else if ( nb3DLinear + nb3DQuadratic + nb3DBiQuadratic > 0 )
657 myWidgets[i3D][iLinear] ->setProperty( "text", "?" );
658 myWidgets[i3D][iQuadratic] ->setProperty( "text", "?" );
659 myWidgets[i3D][iBiQuadratic] ->setProperty( "text", "?" );
660 myWidgets[i3DTetrahedrons][iTotal] ->setProperty( "text", "?" );
661 myWidgets[i3DTetrahedrons][iLinear] ->setProperty( "text", "?" );
662 myWidgets[i3DTetrahedrons][iQuadratic] ->setProperty( "text", "?" );
663 myWidgets[i3DHexahedrons][iTotal] ->setProperty( "text", "?" );
664 myWidgets[i3DHexahedrons][iLinear] ->setProperty( "text", "?" );
665 myWidgets[i3DHexahedrons][iQuadratic] ->setProperty( "text", "?" );
666 myWidgets[i3DHexahedrons][iBiQuadratic] ->setProperty( "text", "?" );
667 myWidgets[i3DPyramids][iTotal] ->setProperty( "text", "?" );
668 myWidgets[i3DPyramids][iLinear] ->setProperty( "text", "?" );
669 myWidgets[i3DPyramids][iQuadratic] ->setProperty( "text", "?" );
670 myWidgets[i3DPrisms][iTotal] ->setProperty( "text", "?" );
671 myWidgets[i3DPrisms][iLinear] ->setProperty( "text", "?" );
672 myWidgets[i3DPrisms][iQuadratic] ->setProperty( "text", "?" );
673 myWidgets[i3DHexaPrisms][iTotal] ->setProperty( "text", "?" );
674 myWidgets[i3DPolyhedrons][iTotal] ->setProperty( "text", "?" );
675 myWidgets[iNb][iTotal] ->setProperty( "text", "?" );
676 myWidgets[iNb][iLinear] ->setProperty( "text", "?" );
677 myWidgets[iNb][iQuadratic] ->setProperty( "text", "?" );
678 myWidgets[iNb][iBiQuadratic] ->setProperty( "text", "?" );
683 myWidgets[iNodes][iTotal] ->setProperty( "text", "?" );
684 myWidgets[i0D][iTotal] ->setProperty( "text", "?" );
685 myWidgets[iBalls][iTotal] ->setProperty( "text", "?" );
686 myWidgets[i1D][iTotal] ->setProperty( "text", "?" );
687 myWidgets[i1D][iLinear] ->setProperty( "text", "?" );
688 myWidgets[i1D][iQuadratic] ->setProperty( "text", "?" );
689 myWidgets[i2D][iTotal] ->setProperty( "text", "?" );
690 myWidgets[i2D][iLinear] ->setProperty( "text", "?" );
691 myWidgets[i2D][iQuadratic] ->setProperty( "text", "?" );
692 myWidgets[i2D][iBiQuadratic] ->setProperty( "text", "?" );
693 myWidgets[i2DTriangles][iTotal] ->setProperty( "text", "?" );
694 myWidgets[i2DTriangles][iLinear] ->setProperty( "text", "?" );
695 myWidgets[i2DTriangles][iQuadratic] ->setProperty( "text", "?" );
696 myWidgets[i2DTriangles][iBiQuadratic] ->setProperty( "text", "?" );
697 myWidgets[i2DQuadrangles][iTotal] ->setProperty( "text", "?" );
698 myWidgets[i2DQuadrangles][iLinear] ->setProperty( "text", "?" );
699 myWidgets[i2DQuadrangles][iQuadratic] ->setProperty( "text", "?" );
700 myWidgets[i2DQuadrangles][iBiQuadratic] ->setProperty( "text", "?" );
701 myWidgets[i2DPolygons][iTotal] ->setProperty( "text", "?" );
702 myWidgets[i3D][iTotal] ->setProperty( "text", "?" );
703 myWidgets[i3D][iLinear] ->setProperty( "text", "?" );
704 myWidgets[i3D][iQuadratic] ->setProperty( "text", "?" );
705 myWidgets[i3DTetrahedrons][iTotal] ->setProperty( "text", "?" );
706 myWidgets[i3DTetrahedrons][iLinear] ->setProperty( "text", "?" );
707 myWidgets[i3DTetrahedrons][iQuadratic] ->setProperty( "text", "?" );
708 myWidgets[i3DHexahedrons][iTotal] ->setProperty( "text", "?" );
709 myWidgets[i3DHexahedrons][iLinear] ->setProperty( "text", "?" );
710 myWidgets[i3DHexahedrons][iQuadratic] ->setProperty( "text", "?" );
711 myWidgets[i3DHexahedrons][iBiQuadratic] ->setProperty( "text", "?" );
712 myWidgets[i3DPyramids][iTotal] ->setProperty( "text", "?" );
713 myWidgets[i3DPyramids][iLinear] ->setProperty( "text", "?" );
714 myWidgets[i3DPyramids][iQuadratic] ->setProperty( "text", "?" );
715 myWidgets[i3DPrisms][iTotal] ->setProperty( "text", "?" );
716 myWidgets[i3DPrisms][iLinear] ->setProperty( "text", "?" );
717 myWidgets[i3DPrisms][iQuadratic] ->setProperty( "text", "?" );
718 myWidgets[i3DHexaPrisms][iTotal] ->setProperty( "text", "?" );
719 myWidgets[i3DPolyhedrons][iTotal] ->setProperty( "text", "?" );
720 myWidgets[iNb][iTotal] ->setProperty( "text", "?" );
721 myWidgets[iNb][iLinear] ->setProperty( "text", "?" );
722 myWidgets[iNb][iQuadratic] ->setProperty( "text", "?" );
723 myWidgets[iNb][iBiQuadratic] ->setProperty( "text", "?" );
730 \brief Load mesh from a study file
732 void SMESHGUI_MeshInfo::loadMesh()
734 SUIT_OverrideCursor wc;
736 SALOME_ListIO selected;
737 SMESHGUI::selectionMgr()->selectedObjects( selected );
739 if ( selected.Extent() == 1 ) {
740 Handle(SALOME_InteractiveObject) IO = selected.First();
741 SMESH::SMESH_IDSource_var obj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
742 if ( !CORBA::is_nil( obj )) {
743 SMESH::SMESH_Mesh_var mesh = obj->GetMesh();
744 if ( !mesh->_is_nil() )
754 \brief Reset the widget to the initial state (nullify all fields).
756 void SMESHGUI_MeshInfo::clear()
758 myWidgets[iName][iSingle] ->setProperty( "text", QString() );
759 myWidgets[iObject][iSingle] ->setProperty( "text", QString() );
760 myWidgets[iNodes][iTotal] ->setProperty( "text", QString::number( 0 ));
761 myWidgets[i0D][iTotal] ->setProperty( "text", QString::number( 0 ));
762 myWidgets[iBalls][iTotal] ->setProperty( "text", QString::number( 0 ));
763 myWidgets[i1D][iTotal] ->setProperty( "text", QString::number( 0 ));
764 myWidgets[i1D][iLinear] ->setProperty( "text", QString::number( 0 ));
765 myWidgets[i1D][iQuadratic] ->setProperty( "text", QString::number( 0 ));
766 myWidgets[i2D][iTotal] ->setProperty( "text", QString::number( 0 ));
767 myWidgets[i2D][iLinear] ->setProperty( "text", QString::number( 0 ));
768 myWidgets[i2D][iQuadratic] ->setProperty( "text", QString::number( 0 ));
769 myWidgets[i2D][iBiQuadratic] ->setProperty( "text", QString::number( 0 ));
770 myWidgets[i2DTriangles][iTotal] ->setProperty( "text", QString::number( 0 ));
771 myWidgets[i2DTriangles][iLinear] ->setProperty( "text", QString::number( 0 ));
772 myWidgets[i2DTriangles][iQuadratic] ->setProperty( "text", QString::number( 0 ));
773 myWidgets[i2DTriangles][iBiQuadratic] ->setProperty( "text", QString::number( 0 ));
774 myWidgets[i2DQuadrangles][iTotal] ->setProperty( "text", QString::number( 0 ));
775 myWidgets[i2DQuadrangles][iLinear] ->setProperty( "text", QString::number( 0 ));
776 myWidgets[i2DQuadrangles][iQuadratic] ->setProperty( "text", QString::number( 0 ));
777 myWidgets[i2DQuadrangles][iBiQuadratic] ->setProperty( "text", QString::number( 0 ));
778 myWidgets[i2DPolygons][iLinear] ->setProperty( "text", QString::number( 0 ));
779 myWidgets[i2DPolygons][iQuadratic] ->setProperty( "text", QString::number( 0 ));
780 myWidgets[i2DPolygons][iTotal] ->setProperty( "text", QString::number( 0 ));
781 myWidgets[i3D][iTotal] ->setProperty( "text", QString::number( 0 ));
782 myWidgets[i3D][iLinear] ->setProperty( "text", QString::number( 0 ));
783 myWidgets[i3D][iQuadratic] ->setProperty( "text", QString::number( 0 ));
784 myWidgets[i3D][iBiQuadratic] ->setProperty( "text", QString::number( 0 ));
785 myWidgets[i3DTetrahedrons][iTotal] ->setProperty( "text", QString::number( 0 ));
786 myWidgets[i3DTetrahedrons][iLinear] ->setProperty( "text", QString::number( 0 ));
787 myWidgets[i3DTetrahedrons][iQuadratic] ->setProperty( "text", QString::number( 0 ));
788 myWidgets[i3DHexahedrons][iTotal] ->setProperty( "text", QString::number( 0 ));
789 myWidgets[i3DHexahedrons][iLinear] ->setProperty( "text", QString::number( 0 ));
790 myWidgets[i3DHexahedrons][iQuadratic] ->setProperty( "text", QString::number( 0 ));
791 myWidgets[i3DHexahedrons][iBiQuadratic] ->setProperty( "text", QString::number( 0 ));
792 myWidgets[i3DPyramids][iTotal] ->setProperty( "text", QString::number( 0 ));
793 myWidgets[i3DPyramids][iLinear] ->setProperty( "text", QString::number( 0 ));
794 myWidgets[i3DPyramids][iQuadratic] ->setProperty( "text", QString::number( 0 ));
795 myWidgets[i3DPrisms][iTotal] ->setProperty( "text", QString::number( 0 ));
796 myWidgets[i3DPrisms][iLinear] ->setProperty( "text", QString::number( 0 ));
797 myWidgets[i3DPrisms][iQuadratic] ->setProperty( "text", QString::number( 0 ));
798 myWidgets[i3DHexaPrisms][iTotal] ->setProperty( "text", QString::number( 0 ));
799 myWidgets[i3DPolyhedrons][iTotal] ->setProperty( "text", QString::number( 0 ));
800 myWidgets[iNb][iTotal] ->setProperty( "text", QString::number( 0 ));
801 myWidgets[iNb][iLinear] ->setProperty( "text", QString::number( 0 ));
802 myWidgets[iNb][iQuadratic] ->setProperty( "text", QString::number( 0 ));
803 myWidgets[iNb][iBiQuadratic] ->setProperty( "text", QString::number( 0 ));
807 \brief Create info field
808 \return new info field
810 QLabel* SMESHGUI_MeshInfo::createField()
812 QLabel* lab = new QLabel( this );
813 lab->setFrameStyle( StyledPanel | Sunken );
814 lab->setAlignment( Qt::AlignCenter );
815 lab->setAutoFillBackground( true );
816 QPalette pal = lab->palette();
817 pal.setColor( QPalette::Window, QApplication::palette().color( QPalette::Active, QPalette::Base ));
818 lab->setPalette( pal );
819 lab->setMinimumWidth( 70 );
824 \brief Create horizontal rule.
825 \return new line object
827 QWidget* SMESHGUI_MeshInfo::createLine()
829 QFrame* line = new QFrame( this );
830 line->setFrameStyle( HLine | Sunken );
835 \brief Change widget font attributes (bold, italic, ...).
837 \param attr font attributes (XORed flags)
838 \param val value to be set to attributes
840 void SMESHGUI_MeshInfo::setFontAttributes( QWidget* w, int attr, bool val )
844 if ( attr & Bold ) f.setBold( val );
845 if ( attr & Italic ) f.setItalic( val );
851 \brief Show/hide group(s) of fields.
852 \param start beginning of the block
853 \param end end of the block
854 \param on visibility flag
856 void SMESHGUI_MeshInfo::setFieldsVisible( int start, int end, bool on )
858 start = qMax( 0, start );
859 end = qMin( end, (int)iElementsEnd );
860 for ( int i = start; i < end; i++ ) {
861 wlist wl = myWidgets[i];
862 foreach ( QWidget* w, wl ) w->setVisible( on );
866 void SMESHGUI_MeshInfo::saveInfo( QTextStream &out )
868 out << QString( 9, '-' ) << "\n";
869 out << tr( "BASE_INFO" ) << "\n";
870 out << QString( 9, '-' ) << "\n";
871 out << tr( "NAME_LAB" ) << " " << ( myWidgets[iName][iSingle]->property( "text" )).toString() << "\n";
872 out << tr( "OBJECT_LAB" ) << " " << ( myWidgets[iObject][iSingle]->property( "text" )).toString() << "\n";
873 out << tr( "NODES_LAB" ) << " " << ( myWidgets[iNodes][iTotal]->property( "text" )).toString() << "\n";
874 out << tr( "ELEMENTS_LAB" ) << "\n";
875 out << QString( SPACING_INFO, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[iNb][iTotal]->property( "text" )).toString() << "\n";
876 out << QString( SPACING_INFO, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[iNb][iLinear]->property( "text" )).toString() << "\n";
877 out << QString( SPACING_INFO, ' ' ) << tr( "QUADRATIC_LAB" ) << ": " << ( myWidgets[iNb][iQuadratic]->property( "text" )).toString() << "\n";
878 out << QString( SPACING_INFO, ' ' ) << tr( "BI_QUADRATIC_LAB" ) << ": " << ( myWidgets[iNb][iBiQuadratic]->property( "text" )).toString() << "\n";
879 out << QString( SPACING_INFO, ' ' ) << tr( "0D_LAB" ) << "\n";
880 out << QString( SPACING_INFO*2, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i0D][iTotal]->property( "text" )).toString() << "\n";
881 out << QString( SPACING_INFO, ' ' ) << tr( "BALL_LAB" ) << "\n";
882 out << QString( SPACING_INFO*2, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[iBalls][iTotal]->property( "text" )).toString() << "\n";
883 out << QString( SPACING_INFO, ' ' ) << tr( "1D_LAB" ) << "\n";
884 out << QString( SPACING_INFO*2, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i1D][iTotal]->property( "text" )).toString() << "\n";
885 out << QString( SPACING_INFO*2, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[i1D][iLinear]->property( "text" )).toString() << "\n";
886 out << QString( SPACING_INFO*2, ' ' ) << tr( "QUADRATIC_LAB" ) << ": " << ( myWidgets[i1D][iQuadratic]->property( "text" )).toString() << "\n";
887 out << QString( SPACING_INFO, ' ' ) << tr( "2D_LAB" ) << "\n";
888 out << QString( SPACING_INFO*2, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i2D][iTotal]->property( "text" )).toString() << "\n";
889 out << QString( SPACING_INFO*2, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[i2D][iLinear]->property( "text" )).toString() << "\n";
890 out << QString( SPACING_INFO*2, ' ' ) << tr( "QUADRATIC_LAB" ) << ": " << ( myWidgets[i2D][iQuadratic]->property( "text" )).toString() << "\n";
891 out << QString( SPACING_INFO*2, ' ' ) << tr( "BI_QUADRATIC_LAB" ) << ": " << ( myWidgets[i2D][iBiQuadratic]->property( "text" )).toString() << "\n";
892 out << QString( SPACING_INFO*2, ' ' ) << tr( "TRIANGLES_LAB" ) << "\n";
893 out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i2DTriangles][iTotal]->property( "text" )).toString() << "\n";
894 out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[i2DTriangles][iLinear]->property( "text" )).toString() << "\n";
895 out << QString( SPACING_INFO*3, ' ' ) << tr( "QUADRATIC_LAB" ) << ": " << ( myWidgets[i2DTriangles][iQuadratic]->property( "text" )).toString() << "\n";
896 out << QString( SPACING_INFO*3, ' ' ) << tr( "BI_QUADRATIC_LAB" ) << ": " << ( myWidgets[i2DTriangles][iBiQuadratic]->property( "text" )).toString() << "\n";
897 out << QString( SPACING_INFO*2, ' ' ) << tr( "QUADRANGLES_LAB" ) << "\n";
898 out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i2DQuadrangles][iTotal]->property( "text" )).toString() << "\n";
899 out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[i2DQuadrangles][iLinear]->property( "text" )).toString() << "\n";
900 out << QString( SPACING_INFO*3, ' ' ) << tr( "QUADRATIC_LAB" ) << ": " << ( myWidgets[i2DQuadrangles][iQuadratic]->property( "text" )).toString() << "\n";
901 out << QString( SPACING_INFO*3, ' ' ) << tr( "BI_QUADRATIC_LAB" ) << ": " << ( myWidgets[i2DQuadrangles][iBiQuadratic]->property( "text" )).toString() << "\n";
902 out << QString( SPACING_INFO*2, ' ' ) << tr( "POLYGONS_LAB" ) << "\n";
903 out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i2DPolygons][iTotal]->property( "text" )).toString() << "\n";
904 out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[i2DPolygons][iLinear]->property( "text" )).toString() << "\n";
905 out << QString( SPACING_INFO*3, ' ' ) << tr( "QUADRATIC_LAB" ) << ": " << ( myWidgets[i2DPolygons][iQuadratic]->property( "text" )).toString() << "\n";
906 out << QString( SPACING_INFO, ' ' ) << tr( "3D_LAB" ) << "\n";
907 out << QString( SPACING_INFO*2, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i3D][iTotal]->property( "text" )).toString() << "\n";
908 out << QString( SPACING_INFO*2, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[i3D][iLinear]->property( "text" )).toString() << "\n";
909 out << QString( SPACING_INFO*2, ' ' ) << tr( "QUADRATIC_LAB" ) << ": " << ( myWidgets[i3D][iQuadratic]->property( "text" )).toString() << "\n";
910 out << QString( SPACING_INFO*2, ' ' ) << tr( "BI_QUADRATIC_LAB" ) << ": " << ( myWidgets[i3D][iBiQuadratic]->property( "text" )).toString() << "\n";
911 out << QString( SPACING_INFO*2, ' ' ) << tr( "TETRAHEDRONS_LAB" ) << "\n";
912 out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i3DTetrahedrons][iTotal]->property( "text" )).toString() << "\n";
913 out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[i3DTetrahedrons][iLinear]->property( "text" )).toString() << "\n";
914 out << QString( SPACING_INFO*3, ' ' ) << tr( "QUADRATIC_LAB" ) << ": " << ( myWidgets[i3DTetrahedrons][iQuadratic]->property( "text" )).toString() << "\n";
915 out << QString( SPACING_INFO*2, ' ' ) << tr( "HEXAHEDONRS_LAB" ) << "\n";
916 out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i3DHexahedrons][iTotal]->property( "text" )).toString() << "\n";
917 out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[i3DHexahedrons][iLinear]->property( "text" )).toString() << "\n";
918 out << QString( SPACING_INFO*3, ' ' ) << tr( "QUADRATIC_LAB" ) << ": " << ( myWidgets[i3DHexahedrons][iQuadratic]->property( "text" )).toString() << "\n";
919 out << QString( SPACING_INFO*3, ' ' ) << tr( "BI_QUADRATIC_LAB" ) << ": " << ( myWidgets[i3DHexahedrons][iBiQuadratic]->property( "text" )).toString() << "\n";
920 out << QString( SPACING_INFO*2, ' ' ) << tr( "PYRAMIDS_LAB" ) << "\n";
921 out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i3DPyramids][iTotal]->property( "text" )).toString() << "\n";
922 out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[i3DPyramids][iLinear]->property( "text" )).toString() << "\n";
923 out << QString( SPACING_INFO*3, ' ' ) << tr( "QUADRATIC_LAB" ) << ": " << ( myWidgets[i3DPyramids][iQuadratic]->property( "text" )).toString() << "\n";
924 out << QString( SPACING_INFO*2, ' ' ) << tr( "PRISMS_LAB" ) << "\n";
925 out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i3DPrisms][iTotal]->property( "text" )).toString() << "\n";
926 out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" ) << ": " << ( myWidgets[i3DPrisms][iLinear]->property( "text" )).toString() << "\n";
927 out << QString( SPACING_INFO*3, ' ' ) << tr( "QUADRATIC_LAB" ) << ": " << ( myWidgets[i3DPrisms][iQuadratic]->property( "text" )).toString() << "\n";
928 out << QString( SPACING_INFO*2, ' ' ) << tr( "HEX_PRISMS_LAB" ) << "\n";
929 out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i3DHexaPrisms][iTotal]->property( "text" )).toString() << "\n";
930 out << QString( SPACING_INFO*2, ' ' ) << tr( "POLYHEDRONS_LAB" ) << "\n";
931 out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" ) << ": " << ( myWidgets[i3DPolyhedrons][iTotal]->property( "text" )).toString() << "\n" << "\n";
935 \class SMESHGUI_ElemInfo
936 \brief Base class for the mesh element information widget.
941 \param parent parent widget
943 SMESHGUI_ElemInfo::SMESHGUI_ElemInfo( QWidget* parent )
944 : QWidget( parent ), myActor( 0 ), myIsElement( -1 )
946 myFrame = new QWidget( this );
947 myExtra = new ExtraWidget( this );
948 QVBoxLayout* vbl = new QVBoxLayout( this );
950 vbl->setSpacing( 0 );
951 vbl->addWidget( myFrame );
952 vbl->addWidget( myExtra );
953 connect( myExtra->prev, SIGNAL( clicked() ), this, SLOT( showPrevious() ));
954 connect( myExtra->next, SIGNAL( clicked() ), this, SLOT( showNext() ));
961 SMESHGUI_ElemInfo::~SMESHGUI_ElemInfo()
966 \brief Set mesh data source (actor)
967 \param actor mesh object actor
969 void SMESHGUI_ElemInfo::setSource( SMESH_Actor* actor, SMESH::SMESH_IDSource_var obj )
971 if ( myActor != actor ) {
974 SMESH::SMESH_Mesh_var mesh = obj->GetMesh();
975 myMeshHasShape = ( !mesh->_is_nil() && mesh->HasShapeToMesh() );
981 \brief Show mesh element information
982 \param id mesh node / element ID
983 \param isElem show mesh element information if \c true or mesh node information if \c false
985 void SMESHGUI_ElemInfo::showInfo( long id, bool isElem )
989 showInfo( ids, isElem );
993 \brief Show mesh element information
994 \param ids mesh nodes / elements identifiers
995 \param isElem show mesh element information if \c true or mesh node information if \c false
997 void SMESHGUI_ElemInfo::showInfo( QSet<long> ids, bool isElem )
999 QList<long> newIds = ids.toList();
1001 if ( myIDs == newIds && myIsElement == isElem ) return;
1004 myIsElement = isElem;
1007 information( myIDs.mid( myIndex*MAXITEMS, MAXITEMS ));
1011 \brief Clear mesh element information widget
1013 void SMESHGUI_ElemInfo::clear()
1022 \brief Get central area widget
1023 \return central widget
1025 QWidget* SMESHGUI_ElemInfo::frame() const
1032 \return actor being used
1034 SMESH_Actor* SMESHGUI_ElemInfo::actor() const
1040 \brief Get current info mode.
1041 \return \c true if mesh element information is shown or \c false if node information is shown
1043 bool SMESHGUI_ElemInfo::isElements() const
1049 \fn void SMESHGUI_ElemInfo::information( const QList<long>& ids )
1050 \brief Show information on the specified nodes / elements
1052 This function is to be redefined in sub-classes.
1054 \param ids nodes / elements identifiers information is to be shown on
1058 \brief Internal clean-up (reset widget)
1060 void SMESHGUI_ElemInfo::clearInternal()
1065 \brief Get node connectivity
1066 \param node mesh node
1067 \return node connectivity map
1069 SMESHGUI_ElemInfo::Connectivity SMESHGUI_ElemInfo::nodeConnectivity( const SMDS_MeshNode* node )
1073 SMDS_ElemIteratorPtr it = node->GetInverseElementIterator();
1074 while ( it && it->more() ) {
1075 const SMDS_MeshElement* ne = it->next();
1076 elmap[ ne->GetType() ] << ne->GetID();
1083 \brief Format connectivity data to string representation
1084 \param connectivity connetivity map
1085 \param type element type
1086 \return string representation of the connectivity
1088 QString SMESHGUI_ElemInfo::formatConnectivity( Connectivity connectivity, int type )
1091 if ( connectivity.contains( type )) {
1092 QList<int> elements = connectivity[ type ];
1094 foreach( int id, elements )
1095 str << QString::number( id );
1097 return str.join( " " );
1101 \brief Calculate gravity center of the mesh element
1102 \param element mesh element
1104 SMESHGUI_ElemInfo::XYZ SMESHGUI_ElemInfo::gravityCenter( const SMDS_MeshElement* element )
1108 SMDS_ElemIteratorPtr nodeIt = element->nodesIterator();
1109 while ( nodeIt->more() ) {
1110 const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
1111 xyz.add( node->X(), node->Y(), node->Z() );
1113 xyz.divide( element->NbNodes() );
1119 \brief Calculate normal vector to the mesh face
1120 \param element mesh face
1122 SMESHGUI_ElemInfo::XYZ SMESHGUI_ElemInfo::normal( const SMDS_MeshElement* element )
1124 gp_XYZ n = SMESH::getNormale( SMDS_Mesh::DownCast<SMDS_MeshFace>( element ));
1125 return XYZ(n.X(), n.Y(), n.Z());
1129 \brief This slot is called from "Show Previous" button click.
1130 Shows information on the previous group of the items.
1132 void SMESHGUI_ElemInfo::showPrevious()
1134 myIndex = qMax( 0, myIndex-1 );
1136 information( myIDs.mid( myIndex*MAXITEMS, MAXITEMS ));
1140 \brief This slot is called from "Show Next" button click.
1141 Shows information on the next group of the items.
1143 void SMESHGUI_ElemInfo::showNext()
1145 myIndex = qMin( myIndex+1, myIDs.count() / MAXITEMS );
1147 information( myIDs.mid( myIndex*MAXITEMS, MAXITEMS ));
1151 \brief Update widgets state
1153 void SMESHGUI_ElemInfo::updateControls()
1155 myExtra->updateControls( myIDs.count(), myIndex );
1159 \class SMESHGUI_SimpleElemInfo
1160 \brief Represents mesh element information in the simple text area.
1165 \param parent parent widget
1167 SMESHGUI_SimpleElemInfo::SMESHGUI_SimpleElemInfo( QWidget* parent )
1168 : SMESHGUI_ElemInfo( parent )
1170 myInfo = new QTextBrowser( frame() );
1171 QVBoxLayout* l = new QVBoxLayout( frame() );
1173 l->addWidget( myInfo );
1177 \brief Show mesh element information
1178 \param ids mesh nodes / elements identifiers
1180 void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
1185 int grp_details = SMESHGUI::resourceMgr()->booleanValue( "SMESH", "elem_info_grp_details", false );
1186 int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
1187 int cprecision = -1;
1188 if ( SMESHGUI::resourceMgr()->booleanValue( "SMESH", "use_precision", false ))
1189 cprecision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "controls_precision", -1 );
1190 foreach ( long id, ids ) {
1191 if ( !isElements() ) {
1195 const SMDS_MeshNode* node = actor()->GetObject()->GetMesh()->FindNode( id );
1196 if ( !node ) return;
1199 myInfo->append( QString( "<b>%1 #%2</b>" ).arg( SMESHGUI_ElemInfo::tr( "NODE" )).arg( id ));
1201 myInfo->append( "" );
1203 myInfo->append( QString( "<b>%1:</b> (%2, %3, %4)" ).arg( SMESHGUI_ElemInfo::tr( "COORDINATES" )).
1204 arg( node->X(), 0, precision > 0 ? 'f' : 'g', qAbs( precision )).
1205 arg( node->Y(), 0, precision > 0 ? 'f' : 'g', qAbs( precision )).
1206 arg( node->Z(), 0, precision > 0 ? 'f' : 'g', qAbs( precision )) );
1208 myInfo->append( "" );
1210 Connectivity connectivity = nodeConnectivity( node );
1211 if ( !connectivity.isEmpty() ) {
1212 myInfo->append( QString( "<b>%1:</b>" ).arg( SMESHGUI_ElemInfo::tr( "CONNECTIVITY" )) );
1213 QString con = formatConnectivity( connectivity, SMDSAbs_0DElement );
1214 if ( !con.isEmpty() )
1215 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "0D_ELEMENTS" )).arg( con ));
1216 con = formatConnectivity( connectivity, SMDSAbs_Edge );
1217 if ( !con.isEmpty() )
1218 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "EDGES" )).arg( con ));
1219 con = formatConnectivity( connectivity, SMDSAbs_Ball );
1220 if ( !con.isEmpty() )
1221 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "BALL_ELEMENTS" )).arg( con ));
1222 con = formatConnectivity( connectivity, SMDSAbs_Face );
1223 if ( !con.isEmpty() )
1224 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "FACES" )).arg( con ));
1225 con = formatConnectivity( connectivity, SMDSAbs_Volume );
1226 if ( !con.isEmpty() )
1227 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "VOLUMES" )).arg( con ));
1230 myInfo->append( QString( "<b>%1</b>" ).arg( SMESHGUI_ElemInfo::tr( "FREE_NODE" )).arg( id ));
1233 SMESH::SMESH_Mesh_ptr aMeshPtr = actor()->GetObject()->GetMeshServer();
1234 if ( !CORBA::is_nil( aMeshPtr )) {
1235 SMESH::NodePosition_var pos = aMeshPtr->GetNodePosition( id );
1236 int shapeID = pos->shapeID;
1237 if ( shapeID > 0 ) {
1239 double u = 0, v = 0;
1240 switch ( pos->shapeType ) {
1242 shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" );
1243 if ( pos->params.length() == 1 )
1247 shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" );
1248 if ( pos->params.length() == 2 ) {
1254 shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" );
1257 shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" );
1261 myInfo->append( "" );
1262 myInfo->append( QString( "<b>%1:" ).arg( SMESHGUI_ElemInfo::tr( "POSITION" )) );
1263 myInfo->append( QString( "- <b>%1: #%2</b>" ).arg( shapeType ).arg( shapeID ));
1264 if ( pos->shapeType == GEOM::EDGE || pos->shapeType == GEOM::FACE ) {
1265 myInfo->append( QString( "- <b>%1: #%2</b>" ).arg( SMESHGUI_ElemInfo::tr( "U_POSITION" )).
1266 arg( QString::number( u, precision > 0 ? 'f' : 'g', qAbs( precision )) ));
1267 if ( pos->shapeType == GEOM::FACE ) {
1268 myInfo->append( QString( "- <b>%1: #%2</b>" ).arg( SMESHGUI_ElemInfo::tr( "V_POSITION" )).
1269 arg( QString::number( v, precision > 0 ? 'f' : 'g', qAbs( precision )) ));
1274 // groups node belongs to
1275 SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();
1276 if ( !CORBA::is_nil( aMesh )) {
1277 SMESH::ListOfGroups_var groups = aMesh->GetGroups();
1278 myInfo->append( "" ); // separator
1279 bool top_created = false;
1280 for ( CORBA::ULong i = 0; i < groups->length(); i++ ) {
1281 SMESH::SMESH_GroupBase_var aGrp = groups[i];
1282 if ( CORBA::is_nil( aGrp )) continue;
1283 QString aName = aGrp->GetName();
1284 if ( aGrp->GetType() == SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id )) {
1285 if ( !top_created ) {
1286 myInfo->append( QString( "<b>%1:</b>" ).arg( SMESHGUI_AddInfo::tr( "GROUPS" )) );
1289 myInfo->append( QString( "+ <b>%1:</b>" ).arg( aName.trimmed() ));
1290 if ( grp_details ) {
1291 SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp );
1292 SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp );
1293 SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp );
1295 // type : group on geometry, standalone group, group on filter
1296 if ( !CORBA::is_nil( aStdGroup )) {
1297 myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" )).
1298 arg( SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" )) );
1300 else if ( !CORBA::is_nil( aGeomGroup )) {
1301 myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" )).
1302 arg( SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" )) );
1303 GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape();
1304 _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj );
1306 myInfo->append( QString( " - <b>%1:</b> %2: %3" ).arg( SMESHGUI_AddInfo::tr( "TYPE" )).
1307 arg( SMESHGUI_AddInfo::tr( "GEOM_OBJECT" )).arg( sobj->GetName().c_str() ));
1310 else if ( !CORBA::is_nil( aFltGroup )) {
1311 myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" )).
1312 arg( SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" )) );
1316 myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "SIZE" )).
1317 arg( QString::number( aGrp->Size() )) );
1320 SALOMEDS::Color color = aGrp->GetColor();
1321 myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "COLOR" )).
1322 arg( QColor( color.R*255., color.G*255., color.B*255. ).name() ));
1330 // show element info
1332 const SMDS_MeshElement* e = actor()->GetObject()->GetMesh()->FindElement( id );
1333 SMESH::Controls::NumericalFunctorPtr afunctor;
1336 // Element ID && Type
1338 switch( e->GetType() ) {
1339 case SMDSAbs_0DElement:
1340 stype = SMESHGUI_ElemInfo::tr( "0D_ELEMENT" ); break;
1342 stype = SMESHGUI_ElemInfo::tr( "BALL" ); break;
1344 stype = SMESHGUI_ElemInfo::tr( "EDGE" ); break;
1346 stype = SMESHGUI_ElemInfo::tr( "FACE" ); break;
1347 case SMDSAbs_Volume:
1348 stype = SMESHGUI_ElemInfo::tr( "VOLUME" ); break;
1352 if ( stype.isEmpty() ) return;
1353 myInfo->append( QString( "<b>%1 #%2</b>" ).arg( stype ).arg( id ));
1355 myInfo->append( "" );
1359 switch( e->GetEntityType() ) {
1360 case SMDSEntity_Triangle:
1361 case SMDSEntity_Quad_Triangle:
1362 case SMDSEntity_BiQuad_Triangle:
1363 gtype = SMESHGUI_ElemInfo::tr( "TRIANGLE" ); break;
1364 case SMDSEntity_Quadrangle:
1365 case SMDSEntity_Quad_Quadrangle:
1366 case SMDSEntity_BiQuad_Quadrangle:
1367 gtype = SMESHGUI_ElemInfo::tr( "QUADRANGLE" ); break;
1368 case SMDSEntity_Polygon:
1369 case SMDSEntity_Quad_Polygon:
1370 gtype = SMESHGUI_ElemInfo::tr( "POLYGON" ); break;
1371 case SMDSEntity_Tetra:
1372 case SMDSEntity_Quad_Tetra:
1373 gtype = SMESHGUI_ElemInfo::tr( "TETRAHEDRON" ); break;
1374 case SMDSEntity_Pyramid:
1375 case SMDSEntity_Quad_Pyramid:
1376 gtype = SMESHGUI_ElemInfo::tr( "PYRAMID" ); break;
1377 case SMDSEntity_Hexa:
1378 case SMDSEntity_Quad_Hexa:
1379 case SMDSEntity_TriQuad_Hexa:
1380 gtype = SMESHGUI_ElemInfo::tr( "HEXAHEDRON" ); break;
1381 case SMDSEntity_Penta:
1382 case SMDSEntity_Quad_Penta:
1383 case SMDSEntity_BiQuad_Penta:
1384 gtype = SMESHGUI_ElemInfo::tr( "PRISM" ); break;
1385 case SMDSEntity_Hexagonal_Prism:
1386 gtype = SMESHGUI_ElemInfo::tr( "HEX_PRISM" ); break;
1387 case SMDSEntity_Polyhedra:
1388 case SMDSEntity_Quad_Polyhedra:
1389 gtype = SMESHGUI_ElemInfo::tr( "POLYHEDRON" ); break;
1393 if ( !gtype.isEmpty() )
1394 myInfo->append( QString( "<b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "TYPE" )).arg( gtype ));
1396 // Quadratic flag (any element except 0D)
1397 if ( e->GetEntityType() > SMDSEntity_0D && e->GetEntityType() < SMDSEntity_Ball ) {
1398 myInfo->append( QString( "<b>%1?</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "QUADRATIC" )).arg( e->IsQuadratic() ? SMESHGUI_ElemInfo::tr( "YES" ) : SMESHGUI_ElemInfo::tr( "NO" )) );
1400 if ( const SMDS_BallElement* ball = SMDS_Mesh::DownCast<SMDS_BallElement>( e )) {
1402 myInfo->append( QString( "<b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "BALL_DIAMETER" )).arg( ball->GetDiameter() ));
1405 myInfo->append( "" );
1408 SMDS_ElemIteratorPtr nodeIt = e->nodesIterator();
1409 for ( int idx = 1; nodeIt->more(); idx++ ) {
1410 const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
1411 // node number and ID
1412 myInfo->append( QString( "<b>%1 %2/%3</b> - #%4" ).arg( SMESHGUI_ElemInfo::tr( "NODE" )).arg( idx ).arg( e->NbNodes() ).arg( node->GetID() ));
1414 myInfo->append( QString( "<b>%1:</b> (%2, %3, %4)" ).arg( SMESHGUI_ElemInfo::tr( "COORDINATES" )).
1415 arg( node->X(), 0, precision > 0 ? 'f' : 'g', qAbs( precision )).
1416 arg( node->Y(), 0, precision > 0 ? 'f' : 'g', qAbs( precision )).
1417 arg( node->Z(), 0, precision > 0 ? 'f' : 'g', qAbs( precision )) );
1418 // node connectivity
1419 Connectivity connectivity = nodeConnectivity( node );
1420 if ( !connectivity.isEmpty() ) {
1421 myInfo->append( QString( "<b>%1:</b>" ).arg( SMESHGUI_ElemInfo::tr( "CONNECTIVITY" )) );
1422 QString con = formatConnectivity( connectivity, SMDSAbs_0DElement );
1423 if ( !con.isEmpty() )
1424 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "0D_ELEMENTS" )).arg( con ));
1425 con = formatConnectivity( connectivity, SMDSAbs_Edge );
1426 if ( !con.isEmpty() )
1427 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "EDGES" )).arg( con ));
1428 con = formatConnectivity( connectivity, SMDSAbs_Face );
1429 if ( !con.isEmpty() )
1430 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "FACES" )).arg( con ));
1431 con = formatConnectivity( connectivity, SMDSAbs_Volume );
1432 if ( !con.isEmpty() )
1433 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "VOLUMES" )).arg( con ));
1436 myInfo->append( QString( "<b>%1</b>" ).arg( SMESHGUI_ElemInfo::tr( "FREE_NODE" )).arg( id ));
1440 myInfo->append( "" );
1443 myInfo->append( QString( "<b>%1:</b>" ).arg( SMESHGUI_ElemInfo::tr( "CONTROLS" )) );
1445 if ( e->GetType() == SMDSAbs_Edge ) {
1446 afunctor.reset( new SMESH::Controls::Length() );
1447 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
1448 afunctor->SetPrecision( cprecision );
1449 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "LENGTH_EDGES" )).arg( afunctor->GetValue( id )) );
1451 if( e->GetType() == SMDSAbs_Face ) {
1453 afunctor.reset( new SMESH::Controls::Area() );
1454 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
1455 afunctor->SetPrecision( cprecision );
1456 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "AREA_ELEMENTS" )).arg( afunctor->GetValue( id )) );
1458 afunctor.reset( new SMESH::Controls::Taper() );
1459 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
1460 afunctor->SetPrecision( cprecision );
1461 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "TAPER_ELEMENTS" )).arg( afunctor->GetValue( id )) );
1463 afunctor.reset( new SMESH::Controls::AspectRatio() );
1464 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
1465 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "ASPECTRATIO_ELEMENTS" )).arg( afunctor->GetValue( id )) );
1467 afunctor.reset( new SMESH::Controls::MinimumAngle() );
1468 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
1469 afunctor->SetPrecision( cprecision );
1470 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MINIMUMANGLE_ELEMENTS" )).arg( afunctor->GetValue( id )) );
1472 afunctor.reset( new SMESH::Controls::Warping() );
1473 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
1474 afunctor->SetPrecision( cprecision );
1475 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "WARP_ELEMENTS" )).arg( afunctor->GetValue( id )) );
1477 afunctor.reset( new SMESH::Controls::Skew() );
1478 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
1479 afunctor->SetPrecision( cprecision );
1480 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "SKEW_ELEMENTS" )).arg( afunctor->GetValue( id )) );
1482 afunctor.reset( new SMESH::Controls::MaxElementLength2D() );
1483 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
1484 afunctor->SetPrecision( cprecision );
1485 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MAX_ELEMENT_LENGTH_2D" )).arg( afunctor->GetValue( id )) );
1487 afunctor.reset( new SMESH::Controls::Length2D() );
1488 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
1489 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MIN_ELEM_EDGE" )).arg( afunctor->GetValue( id )) );
1491 if( e->GetType() == SMDSAbs_Volume ) {
1493 afunctor.reset( new SMESH::Controls::AspectRatio3D() );
1494 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
1495 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "ASPECTRATIO_3D_ELEMENTS" )).arg( afunctor->GetValue( id )) );
1497 afunctor.reset( new SMESH::Controls::Volume() );
1498 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
1499 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "VOLUME_3D_ELEMENTS" )).arg( afunctor->GetValue( id )) );
1501 afunctor.reset( new SMESH::Controls::Volume() );
1502 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
1503 myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MAX_ELEMENT_LENGTH_3D" )).arg( afunctor->GetValue( id )) );
1506 myInfo->append( "" );
1509 XYZ gc = gravityCenter( e );
1510 myInfo->append( QString( "<b>%1:</b> (%2, %3, %4)" ).arg( SMESHGUI_ElemInfo::tr( "GRAVITY_CENTER" )).arg( gc.x() ).arg( gc.y() ).arg( gc.z() ));
1513 if( e->GetType() == SMDSAbs_Face ) {
1514 XYZ gc = normal( e );
1515 myInfo->append( QString( "<b>%1:</b> (%2, %3, %4)" ).arg( SMESHGUI_ElemInfo::tr( "NORMAL_VECTOR" )).arg( gc.x() ).arg( gc.y() ).arg( gc.z() ));
1519 if ( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
1520 SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();
1521 if ( !CORBA::is_nil( aMesh )) {
1522 SMESH::ElementPosition pos = aMesh->GetElementPosition( id );
1523 int shapeID = pos.shapeID;
1524 if ( shapeID > 0 ) {
1525 myInfo->append( "" ); // separator
1527 switch ( pos.shapeType ) {
1528 case GEOM::EDGE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" ); break;
1529 case GEOM::FACE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" ); break;
1530 case GEOM::VERTEX: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" ); break;
1531 case GEOM::SOLID: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" ); break;
1532 case GEOM::SHELL: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHELL" ); break;
1533 default: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHAPE" ); break;
1535 myInfo->append( QString( "<b>%1:</b> %2 #%3" ).arg( SMESHGUI_ElemInfo::tr( "POSITION" )).arg( shapeType ).arg( shapeID ));
1540 // Groups the element belongs to
1541 SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();
1542 if ( !CORBA::is_nil( aMesh )) {
1543 SMESH::ListOfGroups_var groups = aMesh->GetGroups();
1544 myInfo->append( "" ); // separator
1545 bool top_created = false;
1546 for ( CORBA::ULong i = 0; i < groups->length(); i++ ) {
1547 SMESH::SMESH_GroupBase_var aGrp = groups[i];
1548 if ( CORBA::is_nil( aGrp )) continue;
1549 QString aName = aGrp->GetName();
1550 if ( aGrp->GetType() != SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id )) {
1551 if ( !top_created ) {
1552 myInfo->append( QString( "<b>%1:</b>" ).arg( SMESHGUI_AddInfo::tr( "GROUPS" )) );
1555 myInfo->append( QString( "+ <b>%1:</b>" ).arg( aName.trimmed() ));
1556 if ( grp_details ) {
1557 SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp );
1558 SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp );
1559 SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp );
1561 // type : group on geometry, standalone group, group on filter
1562 if ( !CORBA::is_nil( aStdGroup )) {
1563 myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" )).
1564 arg( SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" )) );
1566 else if ( !CORBA::is_nil( aGeomGroup )) {
1567 myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" )).
1568 arg( SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" )) );
1569 GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape();
1570 _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj );
1572 myInfo->append( QString( " - <b>%1:</b> %2: %3" ).arg( SMESHGUI_AddInfo::tr( "TYPE" )).
1573 arg( SMESHGUI_AddInfo::tr( "GEOM_OBJECT" )).arg( sobj->GetName().c_str() ));
1576 else if ( !CORBA::is_nil( aFltGroup )) {
1577 myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" )).
1578 arg( SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" )) );
1581 myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "SIZE" )).
1582 arg( QString::number( aGrp->Size() )) );
1585 SALOMEDS::Color color = aGrp->GetColor();
1586 myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "COLOR" )).
1587 arg( QColor( color.R*255., color.G*255., color.B*255. ).name() ));
1594 if ( ids.count() > 1 ) {
1595 myInfo->append( "" );
1596 myInfo->append( "------" );
1597 myInfo->append( "" );
1604 \brief Internal clean-up (reset widget)
1606 void SMESHGUI_SimpleElemInfo::clearInternal()
1611 void SMESHGUI_SimpleElemInfo::saveInfo( QTextStream &out )
1613 out << QString( 12, '-' ) << "\n";
1614 out << SMESHGUI_ElemInfo::tr( "ELEM_INFO" ) << "\n";
1615 out << QString( 12, '-' ) << "\n";
1616 out << myInfo->toPlainText();
1622 \class SMESHGUI_TreeElemInfo::ItemDelegate
1623 \brief Item delegate for tree mesh info widget
1626 class SMESHGUI_TreeElemInfo::ItemDelegate : public QItemDelegate
1629 ItemDelegate( QObject* );
1630 QWidget* createEditor( QWidget*, const QStyleOptionViewItem&, const QModelIndex& ) const;
1637 SMESHGUI_TreeElemInfo::ItemDelegate::ItemDelegate( QObject* parent ) : QItemDelegate( parent )
1642 \brief Create item editor widget
1645 QWidget* SMESHGUI_TreeElemInfo::ItemDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const
1647 QWidget* w = index.column() == 0 ? 0: QItemDelegate::createEditor( parent, option, index );
1648 if ( qobject_cast<QLineEdit*>( w )) qobject_cast<QLineEdit*>( w )->setReadOnly( true );
1653 \class SMESHGUI_TreeElemInfo
1654 \brief Represents mesh element information in the tree-like form.
1659 \param parent parent widget
1661 SMESHGUI_TreeElemInfo::SMESHGUI_TreeElemInfo( QWidget* parent )
1662 : SMESHGUI_ElemInfo( parent )
1664 myInfo = new QTreeWidget( frame() );
1665 myInfo->setColumnCount( 2 );
1666 myInfo->setHeaderLabels( QStringList() << tr( "PROPERTY" ) << tr( "VALUE" ));
1667 myInfo->header()->setStretchLastSection( true );
1668 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
1669 myInfo->header()->setResizeMode( 0, QHeaderView::ResizeToContents );
1671 myInfo->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
1673 myInfo->setItemDelegate( new ItemDelegate( myInfo ));
1674 QVBoxLayout* l = new QVBoxLayout( frame() );
1676 l->addWidget( myInfo );
1677 connect( myInfo, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int )), this, SLOT( itemDoubleClicked( QTreeWidgetItem*, int )) );
1678 connect( myInfo, SIGNAL( itemCollapsed( QTreeWidgetItem* )), this, SLOT( saveExpanded( QTreeWidgetItem* )) );
1679 connect( myInfo, SIGNAL( itemExpanded( QTreeWidgetItem* )), this, SLOT( saveExpanded( QTreeWidgetItem* )) );
1683 \brief Show mesh element information
1684 \param ids mesh nodes / elements identifiers
1686 void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
1691 int grp_details = SMESHGUI::resourceMgr()->booleanValue( "SMESH", "elem_info_grp_details", false );
1692 int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
1693 int cprecision = -1;
1694 if ( SMESHGUI::resourceMgr()->booleanValue( "SMESH", "use_precision", false ))
1695 cprecision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "controls_precision", -1 );
1696 foreach ( long id, ids ) {
1697 if ( !isElements() ) {
1701 const SMDS_MeshElement* e = actor()->GetObject()->GetMesh()->FindNode( id );
1703 const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( e );
1706 QTreeWidgetItem* nodeItem = createItem( 0, Bold | All );
1707 nodeItem->setText( 0, SMESHGUI_ElemInfo::tr( "NODE" ));
1708 nodeItem->setText( 1, QString( "#%1" ).arg( id ));
1710 QTreeWidgetItem* coordItem = createItem( nodeItem, Bold );
1711 coordItem->setText( 0, SMESHGUI_ElemInfo::tr( "COORDINATES" ));
1712 QTreeWidgetItem* xItem = createItem( coordItem );
1713 xItem->setText( 0, "X" );
1714 xItem->setText( 1, QString::number( node->X(), precision > 0 ? 'f' : 'g', qAbs( precision )) );
1715 QTreeWidgetItem* yItem = createItem( coordItem );
1716 yItem->setText( 0, "Y" );
1717 yItem->setText( 1, QString::number( node->Y(), precision > 0 ? 'f' : 'g', qAbs( precision )) );
1718 QTreeWidgetItem* zItem = createItem( coordItem );
1719 zItem->setText( 0, "Z" );
1720 zItem->setText( 1, QString::number( node->Z(), precision > 0 ? 'f' : 'g', qAbs( precision )) );
1722 QTreeWidgetItem* conItem = createItem( nodeItem, Bold );
1723 conItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONNECTIVITY" ));
1724 Connectivity connectivity = nodeConnectivity( node );
1725 if ( !connectivity.isEmpty() ) {
1726 QString con = formatConnectivity( connectivity, SMDSAbs_0DElement );
1727 if ( !con.isEmpty() ) {
1728 QTreeWidgetItem* i = createItem( conItem );
1729 i->setText( 0, SMESHGUI_ElemInfo::tr( "0D_ELEMENTS" ));
1730 i->setText( 1, con );
1732 con = formatConnectivity( connectivity, SMDSAbs_Ball );
1733 if ( !con.isEmpty() ) {
1734 QTreeWidgetItem* i = createItem( conItem );
1735 i->setText( 0, SMESHGUI_ElemInfo::tr( "BALL_ELEMENTS" ));
1736 i->setText( 1, con );
1737 i->setData( 1, TypeRole, NodeConnectivity );
1739 con = formatConnectivity( connectivity, SMDSAbs_Edge );
1740 if ( !con.isEmpty() ) {
1741 QTreeWidgetItem* i = createItem( conItem );
1742 i->setText( 0, SMESHGUI_ElemInfo::tr( "EDGES" ));
1743 i->setText( 1, con );
1744 i->setData( 1, TypeRole, NodeConnectivity );
1746 con = formatConnectivity( connectivity, SMDSAbs_Face );
1747 if ( !con.isEmpty() ) {
1748 QTreeWidgetItem* i = createItem( conItem );
1749 i->setText( 0, SMESHGUI_ElemInfo::tr( "FACES" ));
1750 i->setText( 1, con );
1751 i->setData( 1, TypeRole, NodeConnectivity );
1753 con = formatConnectivity( connectivity, SMDSAbs_Volume );
1754 if ( !con.isEmpty() ) {
1755 QTreeWidgetItem* i = createItem( conItem );
1756 i->setText( 0, SMESHGUI_ElemInfo::tr( "VOLUMES" ));
1757 i->setText( 1, con );
1758 i->setData( 1, TypeRole, NodeConnectivity );
1762 conItem->setText( 1, SMESHGUI_ElemInfo::tr( "FREE_NODE" ));
1765 SMESH::SMESH_Mesh_ptr aMeshPtr = actor()->GetObject()->GetMeshServer();
1766 if ( !CORBA::is_nil( aMeshPtr )) {
1767 SMESH::NodePosition_var pos = aMeshPtr->GetNodePosition( id );
1768 int shapeID = pos->shapeID;
1769 if ( shapeID > 0 ) {
1771 double u = 0, v = 0;
1772 switch ( pos->shapeType ) {
1774 shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" );
1775 if ( pos->params.length() == 1 )
1779 shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" );
1780 if ( pos->params.length() == 2 ) {
1786 shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" );
1789 shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" );
1792 QTreeWidgetItem* posItem = createItem( nodeItem, Bold );
1793 posItem->setText( 0, SMESHGUI_ElemInfo::tr("POSITION") );
1794 posItem->setText( 1, (shapeType + " #%1").arg( shapeID ));
1795 if ( pos->shapeType == GEOM::EDGE || pos->shapeType == GEOM::FACE ) {
1796 QTreeWidgetItem* uItem = createItem( posItem );
1797 uItem->setText( 0, SMESHGUI_ElemInfo::tr("U_POSITION") );
1798 uItem->setText( 1, QString::number( u, precision > 0 ? 'f' : 'g', qAbs( precision )));
1799 if ( pos->shapeType == GEOM::FACE ) {
1800 QTreeWidgetItem* vItem = createItem( posItem );
1801 vItem->setText( 0, SMESHGUI_ElemInfo::tr("V_POSITION") );
1802 vItem->setText( 1, QString::number( v, precision > 0 ? 'f' : 'g', qAbs( precision )));
1807 // groups node belongs to
1808 SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();
1809 if ( !CORBA::is_nil( aMesh )) {
1810 SMESH::ListOfGroups_var groups = aMesh->GetGroups();
1811 QTreeWidgetItem* groupsItem = 0;
1812 for ( CORBA::ULong i = 0; i < groups->length(); i++ ) {
1813 SMESH::SMESH_GroupBase_var aGrp = groups[i];
1814 if ( CORBA::is_nil( aGrp )) continue;
1815 QString aName = aGrp->GetName();
1816 if ( aGrp->GetType() == SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id )) {
1817 if ( !groupsItem ) {
1818 groupsItem = createItem( nodeItem, Bold );
1819 groupsItem->setText( 0, SMESHGUI_AddInfo::tr( "GROUPS" ));
1821 QTreeWidgetItem* it = createItem( groupsItem, Bold );
1822 it->setText( 0, aName.trimmed() );
1823 if ( grp_details ) {
1824 SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp );
1825 SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp );
1826 SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp );
1828 // type : group on geometry, standalone group, group on filter
1829 QTreeWidgetItem* typeItem = createItem( it );
1830 typeItem->setText( 0, SMESHGUI_AddInfo::tr( "TYPE" ));
1831 if ( !CORBA::is_nil( aStdGroup )) {
1832 typeItem->setText( 1, SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ));
1834 else if ( !CORBA::is_nil( aGeomGroup )) {
1835 typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ));
1836 GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape();
1837 _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj );
1839 QTreeWidgetItem* gobjItem = createItem( typeItem );
1840 gobjItem->setText( 0, SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ));
1841 gobjItem->setText( 1, sobj->GetName().c_str() );
1844 else if ( !CORBA::is_nil( aFltGroup )) {
1845 typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ));
1849 QTreeWidgetItem* sizeItem = createItem( it );
1850 sizeItem->setText( 0, SMESHGUI_AddInfo::tr( "SIZE" ));
1851 sizeItem->setText( 1, QString::number( aGrp->Size() ));
1854 SALOMEDS::Color color = aGrp->GetColor();
1855 QTreeWidgetItem* colorItem = createItem( it );
1856 colorItem->setText( 0, SMESHGUI_AddInfo::tr( "COLOR" ));
1857 colorItem->setBackground( 1, QBrush( QColor( color.R*255., color.G*255., color.B*255.) ));
1865 // show element info
1867 const SMDS_MeshElement* e = actor()->GetObject()->GetMesh()->FindElement( id );
1868 SMESH::Controls::NumericalFunctorPtr afunctor;
1871 // element ID && type
1873 switch( e->GetType() ) {
1874 case SMDSAbs_0DElement: stype = SMESHGUI_ElemInfo::tr( "0D_ELEMENT" ); break;
1875 case SMDSAbs_Ball: stype = SMESHGUI_ElemInfo::tr( "BALL" ); break;
1876 case SMDSAbs_Edge: stype = SMESHGUI_ElemInfo::tr( "EDGE" ); break;
1877 case SMDSAbs_Face: stype = SMESHGUI_ElemInfo::tr( "FACE" ); break;
1878 case SMDSAbs_Volume: stype = SMESHGUI_ElemInfo::tr( "VOLUME" ); break;
1881 if ( stype.isEmpty() ) return;
1882 QTreeWidgetItem* elemItem = createItem( 0, Bold | All );
1883 elemItem->setText( 0, stype );
1884 elemItem->setText( 1, QString( "#%1" ).arg( id ));
1887 switch( e->GetEntityType() ) {
1888 case SMDSEntity_Triangle:
1889 case SMDSEntity_Quad_Triangle:
1890 case SMDSEntity_BiQuad_Triangle:
1891 gtype = SMESHGUI_ElemInfo::tr( "TRIANGLE" ); break;
1892 case SMDSEntity_Quadrangle:
1893 case SMDSEntity_Quad_Quadrangle:
1894 case SMDSEntity_BiQuad_Quadrangle:
1895 gtype = SMESHGUI_ElemInfo::tr( "QUADRANGLE" ); break;
1896 case SMDSEntity_Polygon:
1897 case SMDSEntity_Quad_Polygon:
1898 gtype = SMESHGUI_ElemInfo::tr( "POLYGON" ); break;
1899 case SMDSEntity_Tetra:
1900 case SMDSEntity_Quad_Tetra:
1901 gtype = SMESHGUI_ElemInfo::tr( "TETRAHEDRON" ); break;
1902 case SMDSEntity_Pyramid:
1903 case SMDSEntity_Quad_Pyramid:
1904 gtype = SMESHGUI_ElemInfo::tr( "PYRAMID" ); break;
1905 case SMDSEntity_Hexa:
1906 case SMDSEntity_Quad_Hexa:
1907 case SMDSEntity_TriQuad_Hexa:
1908 gtype = SMESHGUI_ElemInfo::tr( "HEXAHEDRON" ); break;
1909 case SMDSEntity_Penta:
1910 case SMDSEntity_Quad_Penta:
1911 case SMDSEntity_BiQuad_Penta:
1912 gtype = SMESHGUI_ElemInfo::tr( "PRISM" ); break;
1913 case SMDSEntity_Hexagonal_Prism:
1914 gtype = SMESHGUI_ElemInfo::tr( "HEX_PRISM" ); break;
1915 case SMDSEntity_Polyhedra:
1916 case SMDSEntity_Quad_Polyhedra:
1917 gtype = SMESHGUI_ElemInfo::tr( "POLYHEDRON" ); break;
1921 if ( !gtype.isEmpty() ) {
1922 QTreeWidgetItem* typeItem = createItem( elemItem, Bold );
1923 typeItem->setText( 0, SMESHGUI_ElemInfo::tr( "TYPE" ));
1924 typeItem->setText( 1, gtype );
1926 // quadratic flag (for edges, faces and volumes)
1927 if ( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
1929 QTreeWidgetItem* quadItem = createItem( elemItem, Bold );
1930 quadItem->setText( 0, SMESHGUI_ElemInfo::tr( "QUADRATIC" ));
1931 quadItem->setText( 1, e->IsQuadratic() ? SMESHGUI_ElemInfo::tr( "YES" ) : SMESHGUI_ElemInfo::tr( "NO" ));
1933 if ( const SMDS_BallElement* ball = SMDS_Mesh::DownCast< SMDS_BallElement >( e )) {
1935 QTreeWidgetItem* diamItem = createItem( elemItem, Bold );
1936 diamItem->setText( 0, SMESHGUI_ElemInfo::tr( "BALL_DIAMETER" ));
1937 diamItem->setText( 1, QString( "%1" ).arg( ball->GetDiameter() ));
1940 QTreeWidgetItem* conItem = createItem( elemItem, Bold );
1941 conItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONNECTIVITY" ));
1944 if( e->GetGeomType() != SMDSGeom_POLYHEDRA ) {
1945 SMDS_ElemIteratorPtr nodeIt = e->nodesIterator();
1946 for ( int idx = 1; nodeIt->more(); idx++ ) {
1947 const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
1948 nodeInfo( node, idx, e->NbNodes(), conItem );
1952 SMDS_NodeIteratorPtr nodeIt = e->nodeIterator();
1953 std::set< const SMDS_MeshNode* > addedNodes;
1954 QList<const SMDS_MeshElement*> uniqueNodes;
1955 while ( nodeIt->more() ) {
1956 const SMDS_MeshNode* node = nodeIt->next();
1957 if ( addedNodes.insert( node ).second )
1958 uniqueNodes.append( nodeIt->next() );
1960 SMDS_VolumeTool vtool( e );
1961 const int nbFaces = vtool.NbFaces();
1962 for( int face_id = 0; face_id < nbFaces; face_id++ ) {
1963 QTreeWidgetItem* faceItem = createItem( conItem, Bold );
1964 faceItem->setText( 0, QString( "%1 %2 / %3" ).arg( SMESHGUI_ElemInfo::tr( "FACE" )).arg( face_id + 1 ).arg( nbFaces ));
1965 faceItem->setExpanded( true );
1967 const SMDS_MeshNode** aNodeIds = vtool.GetFaceNodes( face_id );
1968 const int nbNodes = vtool.NbFaceNodes ( face_id );
1969 for( int node_id = 0; node_id < nbNodes; node_id++ ) {
1970 const SMDS_MeshNode* node = aNodeIds[node_id];
1971 nodeInfo( node, uniqueNodes.indexOf(node) + 1, uniqueNodes.size(), faceItem );
1976 QTreeWidgetItem* cntrItem = createItem( elemItem, Bold );
1977 cntrItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONTROLS" ));
1979 if( e->GetType()==SMDSAbs_Edge){
1980 afunctor.reset( new SMESH::Controls::Length() );
1981 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
1982 afunctor->SetPrecision( cprecision );
1983 QTreeWidgetItem* lenItem = createItem( cntrItem, Bold );
1984 lenItem->setText( 0, tr( "LENGTH_EDGES" ));
1985 lenItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
1987 if( e->GetType() == SMDSAbs_Face ) {
1989 afunctor.reset( new SMESH::Controls::Area() );
1990 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
1991 afunctor->SetPrecision( cprecision );
1992 QTreeWidgetItem* areaItem = createItem( cntrItem, Bold );
1993 areaItem->setText( 0, tr( "AREA_ELEMENTS" ));
1994 areaItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue(id) ));
1996 if ( e->NbNodes() == 4 ) // see SMESH_Controls.cxx
1998 afunctor.reset( new SMESH::Controls::Taper() );
1999 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
2000 afunctor->SetPrecision( cprecision );
2001 QTreeWidgetItem* taperlItem = createItem( cntrItem, Bold );
2002 taperlItem->setText( 0, tr( "TAPER_ELEMENTS" ));
2003 taperlItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
2005 afunctor.reset( new SMESH::Controls::Warping() );
2006 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
2007 afunctor->SetPrecision( cprecision );
2008 QTreeWidgetItem* warpItem = createItem( cntrItem, Bold );
2009 warpItem->setText( 0, tr( "WARP_ELEMENTS" ));
2010 warpItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
2015 afunctor.reset( new SMESH::Controls::AspectRatio() );
2016 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
2017 QTreeWidgetItem* ratlItem = createItem( cntrItem, Bold );
2018 ratlItem->setText( 0, tr( "ASPECTRATIO_ELEMENTS" ));
2019 ratlItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
2022 afunctor.reset( new SMESH::Controls::MinimumAngle() );
2023 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
2024 afunctor->SetPrecision( cprecision );
2025 QTreeWidgetItem* minanglItem = createItem( cntrItem, Bold );
2026 minanglItem->setText( 0, tr( "MINIMUMANGLE_ELEMENTS" ));
2027 minanglItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
2029 if ( e->NbNodes() == 3 || e->NbNodes() == 4 )
2031 afunctor.reset( new SMESH::Controls::Skew() );
2032 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
2033 afunctor->SetPrecision( cprecision );
2034 QTreeWidgetItem* skewItem = createItem( cntrItem, Bold );
2035 skewItem->setText( 0, tr( "SKEW_ELEMENTS" ));
2036 skewItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
2039 if ( hasShapeToMesh() )
2041 afunctor.reset( new SMESH::Controls::Deflection2D() );
2042 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
2043 QTreeWidgetItem* deflItem = createItem( cntrItem, Bold );
2044 deflItem->setText( 0, tr( "DEFLECTION_2D" ));
2045 deflItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
2050 afunctor.reset( new SMESH::Controls::MaxElementLength2D() );
2051 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
2052 QTreeWidgetItem* diamItem = createItem( cntrItem, Bold );
2053 diamItem->setText( 0, tr( "MAX_ELEMENT_LENGTH_2D" ));
2054 diamItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
2057 if( e->GetType() == SMDSAbs_Volume ) {
2061 afunctor.reset( new SMESH::Controls::AspectRatio3D() );
2062 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
2063 QTreeWidgetItem* ratlItem3 = createItem( cntrItem, Bold );
2064 ratlItem3->setText( 0, tr( "ASPECTRATIO_3D_ELEMENTS" ));
2065 ratlItem3->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
2068 afunctor.reset( new SMESH::Controls::Volume() );
2069 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
2070 QTreeWidgetItem* volItem = createItem( cntrItem, Bold );
2071 volItem->setText( 0, tr( "VOLUME_3D_ELEMENTS" ));
2072 volItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
2074 afunctor.reset( new SMESH::Controls::MaxElementLength3D() );
2075 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
2076 QTreeWidgetItem* diam3Item = createItem( cntrItem, Bold );
2077 diam3Item->setText( 0, tr( "MAX_ELEMENT_LENGTH_3D" ));
2078 diam3Item->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
2082 afunctor.reset( new SMESH::Controls::Length2D() );
2083 afunctor->SetMesh( actor()->GetObject()->GetMesh() );
2084 QTreeWidgetItem* minEdgeItem = createItem( cntrItem, Bold );
2085 minEdgeItem->setText( 0, tr( "MIN_ELEM_EDGE" ));
2086 minEdgeItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
2089 XYZ gc = gravityCenter( e );
2090 QTreeWidgetItem* gcItem = createItem( elemItem, Bold );
2091 gcItem->setText( 0, SMESHGUI_ElemInfo::tr( "GRAVITY_CENTER" ));
2092 QTreeWidgetItem* xItem = createItem( gcItem );
2093 xItem->setText( 0, "X" );
2094 xItem->setText( 1, QString::number( gc.x(), precision > 0 ? 'f' : 'g', qAbs( precision )) );
2095 QTreeWidgetItem* yItem = createItem( gcItem );
2096 yItem->setText( 0, "Y" );
2097 yItem->setText( 1, QString::number( gc.y(), precision > 0 ? 'f' : 'g', qAbs( precision )) );
2098 QTreeWidgetItem* zItem = createItem( gcItem );
2099 zItem->setText( 0, "Z" );
2100 zItem->setText( 1, QString::number( gc.z(), precision > 0 ? 'f' : 'g', qAbs( precision )) );
2103 if( e->GetType() == SMDSAbs_Face ) {
2104 XYZ gc = normal( e );
2105 QTreeWidgetItem* nItem = createItem( elemItem, Bold );
2106 nItem->setText( 0, SMESHGUI_ElemInfo::tr( "NORMAL_VECTOR" ));
2107 QTreeWidgetItem* xItem = createItem( nItem );
2108 xItem->setText( 0, "X" );
2109 xItem->setText( 1, QString::number( gc.x(), precision > 0 ? 'f' : 'g', qAbs( precision )) );
2110 QTreeWidgetItem* yItem = createItem( nItem );
2111 yItem->setText( 0, "Y" );
2112 yItem->setText( 1, QString::number( gc.y(), precision > 0 ? 'f' : 'g', qAbs( precision )) );
2113 QTreeWidgetItem* zItem = createItem( nItem );
2114 zItem->setText( 0, "Z" );
2115 zItem->setText( 1, QString::number( gc.z(), precision > 0 ? 'f' : 'g', qAbs( precision )) );
2119 SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();
2120 if ( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
2121 if ( !CORBA::is_nil( aMesh )) {
2122 SMESH::ElementPosition pos = aMesh->GetElementPosition( id );
2123 int shapeID = pos.shapeID;
2124 if ( shapeID > 0 ) {
2125 QTreeWidgetItem* shItem = createItem( elemItem, Bold );
2127 switch ( pos.shapeType ) {
2128 case GEOM::EDGE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" ); break;
2129 case GEOM::FACE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" ); break;
2130 case GEOM::VERTEX: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" ); break;
2131 case GEOM::SOLID: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" ); break;
2132 case GEOM::SHELL: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHELL" ); break;
2133 default: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHAPE" ); break;
2135 shItem->setText( 0, SMESHGUI_ElemInfo::tr( "POSITION" ));
2136 shItem->setText( 1, QString( "%1 #%2" ).arg( shapeType ).arg( shapeID ));
2140 // groups element belongs to
2141 if ( !CORBA::is_nil( aMesh )) {
2142 SMESH::ListOfGroups_var groups = aMesh->GetGroups();
2143 QTreeWidgetItem* groupsItem = 0;
2144 for ( CORBA::ULong i = 0; i < groups->length(); i++ ) {
2145 SMESH::SMESH_GroupBase_var aGrp = groups[i];
2146 if ( CORBA::is_nil( aGrp )) continue;
2147 QString aName = aGrp->GetName();
2148 if ( aGrp->GetType() != SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id )) {
2149 if ( !groupsItem ) {
2150 groupsItem = createItem( elemItem, Bold );
2151 groupsItem->setText( 0, SMESHGUI_AddInfo::tr( "GROUPS" ));
2153 QTreeWidgetItem* it = createItem( groupsItem, Bold );
2154 it->setText( 0, aName.trimmed() );
2155 if ( grp_details ) {
2156 SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp );
2157 SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp );
2158 SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp );
2160 // type : group on geometry, standalone group, group on filter
2161 QTreeWidgetItem* typeItem = createItem( it );
2162 typeItem->setText( 0, SMESHGUI_AddInfo::tr( "TYPE" ));
2163 if ( !CORBA::is_nil( aStdGroup )) {
2164 typeItem->setText( 1, SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ));
2166 else if ( !CORBA::is_nil( aGeomGroup )) {
2167 typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ));
2168 GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape();
2169 _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj );
2171 QTreeWidgetItem* gobjItem = createItem( typeItem );
2172 gobjItem->setText( 0, SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ));
2173 gobjItem->setText( 1, sobj->GetName().c_str() );
2176 else if ( !CORBA::is_nil( aFltGroup )) {
2177 typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ));
2181 QTreeWidgetItem* sizeItem = createItem( it );
2182 sizeItem->setText( 0, SMESHGUI_AddInfo::tr( "SIZE" ));
2183 sizeItem->setText( 1, QString::number( aGrp->Size() ));
2186 SALOMEDS::Color color = aGrp->GetColor();
2187 QTreeWidgetItem* colorItem = createItem( it );
2188 colorItem->setText( 0, SMESHGUI_AddInfo::tr( "COLOR" ));
2189 colorItem->setBackground( 1, QBrush( QColor( color.R*255., color.G*255., color.B*255.) ));
2200 \brief Show node information
2201 \param node mesh node for showing
2202 \param index index of current node
2203 \param nbNodes number of unique nodes in element
2204 \param parentItem parent item of tree
2206 void SMESHGUI_TreeElemInfo::nodeInfo( const SMDS_MeshNode* node, int index,
2207 int nbNodes, QTreeWidgetItem* parentItem )
2209 int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
2210 // node number and ID
2211 QTreeWidgetItem* nodeItem = createItem( parentItem, Bold );
2212 nodeItem->setText( 0, QString( "%1 %2 / %3" ).arg( SMESHGUI_ElemInfo::tr( "NODE" )).arg( index ).arg( nbNodes ));
2213 nodeItem->setText( 1, QString( "#%1" ).arg( node->GetID() ));
2214 nodeItem->setData( 1, TypeRole, ElemConnectivity );
2215 nodeItem->setData( 1, IdRole, node->GetID() );
2216 nodeItem->setExpanded( false );
2218 QTreeWidgetItem* coordItem = createItem( nodeItem );
2219 coordItem->setText( 0, SMESHGUI_ElemInfo::tr( "COORDINATES" ));
2220 QTreeWidgetItem* xItem = createItem( coordItem );
2221 xItem->setText( 0, "X" );
2222 xItem->setText( 1, QString::number( node->X(), precision > 0 ? 'f' : 'g', qAbs( precision )) );
2223 QTreeWidgetItem* yItem = createItem( coordItem );
2224 yItem->setText( 0, "Y" );
2225 yItem->setText( 1, QString::number( node->Y(), precision > 0 ? 'f' : 'g', qAbs( precision )) );
2226 QTreeWidgetItem* zItem = createItem( coordItem );
2227 zItem->setText( 0, "Z" );
2228 zItem->setText( 1, QString::number( node->Z(), precision > 0 ? 'f' : 'g', qAbs( precision )) );
2229 // node connectivity
2230 QTreeWidgetItem* nconItem = createItem( nodeItem );
2231 nconItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONNECTIVITY" ));
2232 Connectivity connectivity = nodeConnectivity( node );
2233 if ( !connectivity.isEmpty() ) {
2234 QString con = formatConnectivity( connectivity, SMDSAbs_0DElement );
2235 if ( !con.isEmpty() ) {
2236 QTreeWidgetItem* i = createItem( nconItem );
2237 i->setText( 0, SMESHGUI_ElemInfo::tr( "0D_ELEMENTS" ));
2238 i->setText( 1, con );
2240 con = formatConnectivity( connectivity, SMDSAbs_Edge );
2241 if ( !con.isEmpty() ) {
2242 QTreeWidgetItem* i = createItem( nconItem );
2243 i->setText( 0, SMESHGUI_ElemInfo::tr( "EDGES" ));
2244 i->setText( 1, con );
2245 i->setData( 1, TypeRole, NodeConnectivity );
2247 con = formatConnectivity( connectivity, SMDSAbs_Ball );
2248 if ( !con.isEmpty() ) {
2249 QTreeWidgetItem* i = createItem( nconItem );
2250 i->setText( 0, SMESHGUI_ElemInfo::tr( "BALL_ELEMENTS" ));
2251 i->setText( 1, con );
2252 i->setData( 1, TypeRole, NodeConnectivity );
2254 con = formatConnectivity( connectivity, SMDSAbs_Face );
2255 if ( !con.isEmpty() ) {
2256 QTreeWidgetItem* i = createItem( nconItem );
2257 i->setText( 0, SMESHGUI_ElemInfo::tr( "FACES" ));
2258 i->setText( 1, con );
2259 i->setData( 1, TypeRole, NodeConnectivity );
2261 con = formatConnectivity( connectivity, SMDSAbs_Volume );
2262 if ( !con.isEmpty() ) {
2263 QTreeWidgetItem* i = createItem( nconItem );
2264 i->setText( 0, SMESHGUI_ElemInfo::tr( "VOLUMES" ));
2265 i->setText( 1, con );
2266 i->setData( 1, TypeRole, NodeConnectivity );
2271 \brief Internal clean-up (reset widget)
2273 void SMESHGUI_TreeElemInfo::clearInternal()
2280 \brief Create new tree item.
2281 \param parent parent tree widget item
2282 \param flags item flag
2283 \return new tree widget item
2285 QTreeWidgetItem* SMESHGUI_TreeElemInfo::createItem( QTreeWidgetItem* parent, int flags )
2287 QTreeWidgetItem* item;
2289 item = new QTreeWidgetItem( parent );
2291 item = new QTreeWidgetItem( myInfo );
2293 item->setFlags( item->flags() | Qt::ItemIsEditable );
2295 QFont f = item->font( 0 );
2297 for ( int i = 0; i < myInfo->columnCount(); i++ ) {
2298 if ( ( flags & Bold ) && ( i == 0 || flags & All ))
2299 item->setFont( i, f );
2302 if ( parent && parent->childCount() == 1 && itemDepth( parent ) == 1 )
2304 QString resName = expandedResource( parent );
2305 parent->setExpanded( SMESHGUI::resourceMgr()->booleanValue("SMESH", resName, true ));
2308 item->setExpanded( true );
2312 void SMESHGUI_TreeElemInfo::contextMenuEvent( QContextMenuEvent* e )
2314 QList< QTreeWidgetItem* > widgets = myInfo->selectedItems();
2315 if ( widgets.isEmpty() ) return;
2316 QTreeWidgetItem* aTreeItem = widgets.first();
2317 int type = aTreeItem->data( 1, TypeRole ).toInt();
2318 int id = aTreeItem->data( 1, IdRole ).toInt();
2320 QAction* a = menu.addAction( tr( "SHOW_ITEM_INFO" ));
2321 if ( type == ElemConnectivity && id > 0 && menu.exec( e->globalPos() ) == a )
2322 emit( itemInfo( id ));
2323 else if ( type == NodeConnectivity && menu.exec( e->globalPos() ) == a )
2324 emit( itemInfo( aTreeItem->text( 1 )) );
2327 void SMESHGUI_TreeElemInfo::itemDoubleClicked( QTreeWidgetItem* theItem, int theColumn )
2330 int type = theItem->data( 1, TypeRole ).toInt();
2331 int id = theItem->data( 1, IdRole ).toInt();
2332 if ( type == ElemConnectivity && id > 0 )
2333 emit( itemInfo( id ));
2334 else if ( type == NodeConnectivity )
2335 emit( itemInfo( theItem->text( 1 )) );
2339 void SMESHGUI_TreeElemInfo::saveExpanded( QTreeWidgetItem* theItem )
2342 SMESHGUI::resourceMgr()->setValue("SMESH", expandedResource( theItem ), theItem->isExpanded() );
2345 QString SMESHGUI_TreeElemInfo::expandedResource( QTreeWidgetItem* theItem )
2347 return QString("Expanded_") + ( isElements() ? "E_" : "N_" ) + theItem->text(0);
2350 void SMESHGUI_TreeElemInfo::saveInfo( QTextStream &out )
2352 out << QString( 12, '-' ) << "\n";
2353 out << SMESHGUI_ElemInfo::tr( "ELEM_INFO" ) << "\n";
2354 out << QString( 12, '-' ) << "\n";
2356 QTreeWidgetItemIterator it( myInfo );
2358 if ( !( *it )->text(0).isEmpty() ) {
2359 out << QString( SPACING_INFO * itemDepth( *it ), ' ' ) << ( *it )->text(0);
2360 if ( !( *it )->text(1).isEmpty() ) out << ": " << ( *it )->text(1);
2370 \brief Mesh information computer
2373 The class is created for different computation operation. Currently it is used
2374 to compute number of underlying nodes for the groups.
2380 GrpComputor::GrpComputor( SMESH::SMESH_GroupBase_ptr grp,
2381 QTreeWidgetItem* item,
2384 : QObject( parent ), myItem( item ), myToComputeSize( toComputeSize )
2386 myGroup = SMESH::SMESH_GroupBase::_narrow( grp );
2390 \brief Compute function
2392 void GrpComputor::compute()
2394 if ( !CORBA::is_nil( myGroup ) && myItem ) {
2395 SUIT_OverrideCursor wc;
2396 QTreeWidgetItem* item = myItem;
2398 int nb = myToComputeSize ? myGroup->Size() : myGroup->GetNumberOfNodes();
2399 item->treeWidget()->removeItemWidget( item, 1 );
2400 item->setText( 1, QString::number( nb ));
2405 \class SMESHGUI_AddInfo
2406 \brief The wigdet shows additional information on the mesh object.
2411 \param parent parent widget
2413 SMESHGUI_AddInfo::SMESHGUI_AddInfo( QWidget* parent )
2414 : QTreeWidget( parent )
2416 setColumnCount( 2 );
2417 header()->setStretchLastSection( true );
2418 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
2419 header()->setResizeMode( 0, QHeaderView::ResizeToContents );
2421 header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
2429 SMESHGUI_AddInfo::~SMESHGUI_AddInfo()
2434 \brief Show additional information on the selected object
2435 \param obj object being processed (mesh, sub-mesh, group, ID source)
2437 void SMESHGUI_AddInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
2439 setProperty( "group_index", 0 );
2440 setProperty( "submesh_index", 0 );
2441 myComputors.clear();
2444 if ( CORBA::is_nil( obj )) return;
2446 _PTR(SObject) sobj = SMESH::ObjectToSObject( obj );
2447 if ( !sobj ) return;
2450 QTreeWidgetItem* nameItem = createItem( 0, Bold | All );
2451 nameItem->setText( 0, tr( "NAME" ));
2452 nameItem->setText( 1, sobj->GetName().c_str() );
2454 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( obj );
2455 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( obj );
2456 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( obj );
2458 if ( !aMesh->_is_nil() )
2459 meshInfo( aMesh, nameItem );
2460 else if ( !aSubMesh->_is_nil() )
2461 subMeshInfo( aSubMesh, nameItem );
2462 else if ( !aGroup->_is_nil() )
2463 groupInfo( aGroup.in(), nameItem );
2467 \brief Create new tree item.
2468 \param parent parent tree widget item
2469 \param flags item flag
2470 \return new tree widget item
2472 QTreeWidgetItem* SMESHGUI_AddInfo::createItem( QTreeWidgetItem* parent, int flags )
2474 QTreeWidgetItem* item;
2477 item = new QTreeWidgetItem( parent );
2479 item = new QTreeWidgetItem( this );
2481 //item->setFlags( item->flags() | Qt::ItemIsEditable );
2483 QFont f = item->font( 0 );
2485 for ( int i = 0; i < columnCount(); i++ ) {
2486 if ( ( flags & Bold ) && ( i == 0 || flags & All ))
2487 item->setFont( i, f );
2490 item->setExpanded( true );
2495 \brief Show mesh info
2496 \param mesh mesh object
2497 \param parent parent tree item
2499 void SMESHGUI_AddInfo::meshInfo( SMESH::SMESH_Mesh_ptr mesh, QTreeWidgetItem* parent )
2502 GEOM::GEOM_Object_var shape = mesh->GetShapeToMesh();
2503 SMESH::MedFileInfo_var inf = mesh->GetMEDFileInfo();
2504 QTreeWidgetItem* typeItem = createItem( parent, Bold );
2505 typeItem->setText( 0, tr( "TYPE" ));
2506 if ( !CORBA::is_nil( shape )) {
2507 typeItem->setText( 1, tr( "MESH_ON_GEOMETRY" ));
2508 _PTR(SObject) sobj = SMESH::ObjectToSObject( shape );
2510 QTreeWidgetItem* gobjItem = createItem( typeItem );
2511 gobjItem->setText( 0, tr( "GEOM_OBJECT" ));
2512 gobjItem->setText( 1, sobj->GetName().c_str() );
2515 else if ( strlen( (char*)inf->fileName ) > 0 ) {
2516 typeItem->setText( 1, tr( "MESH_FROM_FILE" ));
2517 QTreeWidgetItem* fileItem = createItem( typeItem );
2518 fileItem->setText( 0, tr( "FILE_NAME" ));
2519 fileItem->setText( 1, (char*)inf->fileName );
2522 typeItem->setText( 1, tr( "STANDALONE_MESH" ));
2526 myGroups = mesh->GetGroups();
2530 mySubMeshes = mesh->GetSubMeshes();
2535 \brief Show sub-mesh info
2536 \param subMesh sub-mesh object
2537 \param parent parent tree item
2539 void SMESHGUI_AddInfo::subMeshInfo( SMESH::SMESH_subMesh_ptr subMesh, QTreeWidgetItem* parent )
2541 bool isShort = parent->parent() != 0;
2545 _PTR(SObject) sobj = SMESH::ObjectToSObject( subMesh->GetFather() );
2547 QTreeWidgetItem* nameItem = createItem( parent, Bold );
2548 nameItem->setText( 0, tr( "PARENT_MESH" ));
2549 nameItem->setText( 1, sobj->GetName().c_str() );
2554 GEOM::GEOM_Object_var gobj = subMesh->GetSubShape();
2555 _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj );
2557 QTreeWidgetItem* gobjItem = createItem( parent, Bold );
2558 gobjItem->setText( 0, tr( "GEOM_OBJECT" ));
2559 gobjItem->setText( 1, sobj->GetName().c_str() );
2564 \brief Show group info
2565 \param grp mesh group object
2566 \param parent parent tree item
2568 void SMESHGUI_AddInfo::groupInfo( SMESH::SMESH_GroupBase_ptr grp, QTreeWidgetItem* parent )
2570 bool isShort = parent->parent() != 0;
2572 SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( grp );
2573 SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( grp );
2574 SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( grp );
2578 _PTR(SObject) sobj = SMESH::ObjectToSObject( grp->GetMesh() );
2580 QTreeWidgetItem* nameItem = createItem( parent, Bold );
2581 nameItem->setText( 0, tr( "PARENT_MESH" ));
2582 nameItem->setText( 1, sobj->GetName().c_str() );
2586 // type : group on geometry, standalone group, group on filter
2587 QTreeWidgetItem* typeItem = createItem( parent, Bold );
2588 typeItem->setText( 0, tr( "TYPE" ));
2589 if ( !CORBA::is_nil( aStdGroup )) {
2590 typeItem->setText( 1, tr( "STANDALONE_GROUP" ));
2592 else if ( !CORBA::is_nil( aGeomGroup )) {
2593 typeItem->setText( 1, tr( "GROUP_ON_GEOMETRY" ));
2594 GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape();
2595 _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj );
2597 QTreeWidgetItem* gobjItem = createItem( typeItem );
2598 gobjItem->setText( 0, tr( "GEOM_OBJECT" ));
2599 gobjItem->setText( 1, sobj->GetName().c_str() );
2602 else if ( !CORBA::is_nil( aFltGroup )) {
2603 typeItem->setText( 1, tr( "GROUP_ON_FILTER" ));
2608 QString etype = tr( "UNKNOWN" );
2609 switch( grp->GetType() ) {
2611 etype = tr( "NODE" );
2614 etype = tr( "EDGE" );
2617 etype = tr( "FACE" );
2620 etype = tr( "VOLUME" );
2623 etype = tr( "0DELEM" );
2626 etype = tr( "BALL" );
2631 QTreeWidgetItem* etypeItem = createItem( parent, Bold );
2632 etypeItem->setText( 0, tr( "ENTITY_TYPE" ));
2633 etypeItem->setText( 1, etype );
2636 SMESH::SMESH_Mesh_var mesh = grp->GetMesh();
2637 bool meshLoaded = mesh->IsLoaded();
2639 // size. Don't call grp->Size() for GroupOnFilter - issue IPAL52831
2641 if ( grp->IsNodeInfoAvailable() || CORBA::is_nil( aFltGroup ))
2642 groupSize = grp->Size();
2644 QTreeWidgetItem* sizeItem = createItem( parent, Bold );
2645 sizeItem->setText( 0, tr( "SIZE" ));
2646 if ( groupSize > -1 ) {
2647 sizeItem->setText( 1, QString::number( groupSize ));
2650 QPushButton* btn = new QPushButton( tr( meshLoaded ? "COMPUTE" : "LOAD"), this );
2651 setItemWidget( sizeItem, 1, btn );
2652 GrpComputor* comp = new GrpComputor( grp, sizeItem, this, /*size=*/true );
2653 connect( btn, SIGNAL( clicked() ), comp, SLOT( compute() ));
2654 myComputors.append( comp );
2656 connect( btn, SIGNAL( clicked() ), this, SLOT( changeLoadToCompute() ));
2660 SALOMEDS::Color color = grp->GetColor();
2661 QTreeWidgetItem* colorItem = createItem( parent, Bold );
2662 colorItem->setText( 0, tr( "COLOR" ));
2663 colorItem->setBackground( 1, QBrush( QColor( color.R*255., color.G*255., color.B*255.) ));
2665 // nb of underlying nodes
2666 if ( grp->GetType() != SMESH::NODE) {
2667 QTreeWidgetItem* nodesItem = createItem( parent, Bold );
2668 nodesItem->setText( 0, tr( "NB_NODES" ));
2669 int nbNodesLimit = SMESHGUI::resourceMgr()->integerValue( "SMESH", "info_groups_nodes_limit", 100000 );
2670 bool toShowNodes = groupSize >= 0 ? ( grp->IsNodeInfoAvailable() || nbNodesLimit <= 0 || groupSize <= nbNodesLimit ) : false;
2671 if ( toShowNodes && meshLoaded ) {
2672 // already calculated and up-to-date
2673 nodesItem->setText( 1, QString::number( grp->GetNumberOfNodes() ));
2676 QPushButton* btn = new QPushButton( tr( meshLoaded ? "COMPUTE" : "LOAD"), this );
2677 setItemWidget( nodesItem, 1, btn );
2678 GrpComputor* comp = new GrpComputor( grp, nodesItem, this );
2679 connect( btn, SIGNAL( clicked() ), comp, SLOT( compute() ));
2680 myComputors.append( comp );
2682 connect( btn, SIGNAL( clicked() ), this, SLOT( changeLoadToCompute() ));
2687 void SMESHGUI_AddInfo::showGroups()
2689 myComputors.clear();
2691 QTreeWidgetItem* parent = topLevelItemCount() > 0 ? topLevelItem( 0 ) : 0; // parent should be first top level item
2692 if ( !parent ) return;
2694 int idx = property( "group_index" ).toInt();
2696 QTreeWidgetItem* itemGroups = 0;
2697 for ( int i = 0; i < parent->childCount() && !itemGroups; i++ ) {
2698 if ( parent->child( i )->data( 0, Qt::UserRole ).toInt() == GROUPS_ID ) {
2699 itemGroups = parent->child( i );
2700 ExtraWidget* extra = dynamic_cast<ExtraWidget*>( itemWidget( itemGroups, 1 ));
2702 extra->updateControls( myGroups->length(), idx );
2703 while ( itemGroups->childCount() ) delete itemGroups->child( 0 ); // clear child items
2707 QMap<int, QTreeWidgetItem*> grpItems;
2708 for ( int i = idx*MAXITEMS ; i < qMin( (idx+1)*MAXITEMS, (int)myGroups->length() ); i++ ) {
2709 SMESH::SMESH_GroupBase_var grp = myGroups[i];
2710 if ( CORBA::is_nil( grp )) continue;
2711 _PTR(SObject) grpSObj = SMESH::ObjectToSObject( grp );
2712 if ( !grpSObj ) continue;
2714 int grpType = grp->GetType();
2716 if ( !itemGroups ) {
2717 // create top-level groups container item
2718 itemGroups = createItem( parent, Bold | All );
2719 itemGroups->setText( 0, tr( "GROUPS" ));
2720 itemGroups->setData( 0, Qt::UserRole, GROUPS_ID );
2722 // total number of groups > 10, show extra widgets for info browsing
2723 if ((int) myGroups->length() > MAXITEMS ) {
2724 ExtraWidget* extra = new ExtraWidget( this, true );
2725 connect( extra->prev, SIGNAL( clicked() ), this, SLOT( showPreviousGroups() ));
2726 connect( extra->next, SIGNAL( clicked() ), this, SLOT( showNextGroups() ));
2727 setItemWidget( itemGroups, 1, extra );
2728 extra->updateControls( myGroups->length(), idx );
2732 if ( grpItems.find( grpType ) == grpItems.end() ) {
2733 grpItems[ grpType ] = createItem( itemGroups, Bold | All );
2734 grpItems[ grpType ]->setText( 0, tr( QString( "GROUPS_%1" ).arg( grpType ).toLatin1().constData() ));
2735 itemGroups->insertChild( grpType-1, grpItems[ grpType ] );
2739 QTreeWidgetItem* grpNameItem = createItem( grpItems[ grpType ] );
2740 grpNameItem->setText( 0, QString( grpSObj->GetName().c_str() ).trimmed() ); // name is trimmed
2743 groupInfo( grp.in(), grpNameItem );
2747 void SMESHGUI_AddInfo::showSubMeshes()
2749 QTreeWidgetItem* parent = topLevelItemCount() > 0 ? topLevelItem( 0 ) : 0; // parent should be first top level item
2750 if ( !parent ) return;
2752 int idx = property( "submesh_index" ).toInt();
2754 QTreeWidgetItem* itemSubMeshes = 0;
2755 for ( int i = 0; i < parent->childCount() && !itemSubMeshes; i++ ) {
2756 if ( parent->child( i )->data( 0, Qt::UserRole ).toInt() == SUBMESHES_ID ) {
2757 itemSubMeshes = parent->child( i );
2758 ExtraWidget* extra = dynamic_cast<ExtraWidget*>( itemWidget( itemSubMeshes, 1 ));
2760 extra->updateControls( mySubMeshes->length(), idx );
2761 while ( itemSubMeshes->childCount() ) delete itemSubMeshes->child( 0 ); // clear child items
2765 QMap<int, QTreeWidgetItem*> smItems;
2766 for ( int i = idx*MAXITEMS ; i < qMin( (idx+1)*MAXITEMS, (int)mySubMeshes->length() ); i++ ) {
2767 SMESH::SMESH_subMesh_var sm = mySubMeshes[i];
2768 if ( CORBA::is_nil( sm )) continue;
2769 _PTR(SObject) smSObj = SMESH::ObjectToSObject( sm );
2770 if ( !smSObj ) continue;
2772 GEOM::GEOM_Object_var gobj = sm->GetSubShape();
2773 if ( CORBA::is_nil(gobj )) continue;
2775 int smType = gobj->GetShapeType();
2776 if ( smType == GEOM::COMPSOLID ) smType = GEOM::COMPOUND;
2778 if ( !itemSubMeshes ) {
2779 itemSubMeshes = createItem( parent, Bold | All );
2780 itemSubMeshes->setText( 0, tr( "SUBMESHES" ));
2781 itemSubMeshes->setData( 0, Qt::UserRole, SUBMESHES_ID );
2783 // total number of sub-meshes > 10, show extra widgets for info browsing
2784 if ((int) mySubMeshes->length() > MAXITEMS ) {
2785 ExtraWidget* extra = new ExtraWidget( this, true );
2786 connect( extra->prev, SIGNAL( clicked() ), this, SLOT( showPreviousSubMeshes() ));
2787 connect( extra->next, SIGNAL( clicked() ), this, SLOT( showNextSubMeshes() ));
2788 setItemWidget( itemSubMeshes, 1, extra );
2789 extra->updateControls( mySubMeshes->length(), idx );
2793 if ( smItems.find( smType ) == smItems.end() ) {
2794 smItems[ smType ] = createItem( itemSubMeshes, Bold | All );
2795 smItems[ smType ]->setText( 0, tr( QString( "SUBMESHES_%1" ).arg( smType ).toLatin1().constData() ));
2796 itemSubMeshes->insertChild( smType, smItems[ smType ] );
2800 QTreeWidgetItem* smNameItem = createItem( smItems[ smType ] );
2801 smNameItem->setText( 0, QString( smSObj->GetName().c_str() ).trimmed() ); // name is trimmed
2804 subMeshInfo( sm.in(), smNameItem );
2809 * \brief Change button label of "nb underlying node" group from "Load" to "Compute"
2811 void SMESHGUI_AddInfo::changeLoadToCompute()
2813 for ( int i = 0; i < myComputors.count(); ++i )
2815 if ( QTreeWidgetItem* item = myComputors[i]->getItem() )
2817 if ( QPushButton* btn = qobject_cast<QPushButton*>( itemWidget ( item, 1 )) )
2818 btn->setText( tr("COMPUTE") );
2823 void SMESHGUI_AddInfo::showPreviousGroups()
2825 int idx = property( "group_index" ).toInt();
2826 setProperty( "group_index", idx-1 );
2830 void SMESHGUI_AddInfo::showNextGroups()
2832 int idx = property( "group_index" ).toInt();
2833 setProperty( "group_index", idx+1 );
2837 void SMESHGUI_AddInfo::showPreviousSubMeshes()
2839 int idx = property( "submesh_index" ).toInt();
2840 setProperty( "submesh_index", idx-1 );
2844 void SMESHGUI_AddInfo::showNextSubMeshes()
2846 int idx = property( "submesh_index" ).toInt();
2847 setProperty( "submesh_index", idx+1 );
2851 void SMESHGUI_AddInfo::saveInfo( QTextStream &out )
2853 out << QString( 15, '-') << "\n";
2854 out << tr( "ADDITIONAL_INFO" ) << "\n";
2855 out << QString( 15, '-' ) << "\n";
2856 QTreeWidgetItemIterator it( this );
2858 if ( !( ( *it )->text(0) ).isEmpty() ) {
2859 out << QString( SPACING_INFO * itemDepth( *it ), ' ' ) << ( *it )->text(0);
2860 if ( ( *it )->text(0) == tr( "COLOR" )) {
2861 out << ": " << ( ( ( *it )->background(1) ).color() ).name();
2863 else if ( !( ( *it )->text(1) ).isEmpty() ) out << ": " << ( *it )->text(1);
2872 \class SMESHGUI_MeshInfoDlg
2873 \brief Mesh information dialog box
2878 \param parent parent widget
2879 \param page specifies the dialog page to be shown at the start-up
2881 SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
2882 : QDialog( parent ), myActor( 0 )
2885 setAttribute( Qt::WA_DeleteOnClose, true );
2886 setWindowTitle( tr( "MESH_INFO" ));
2887 setSizeGripEnabled( true );
2889 myTabWidget = new QTabWidget( this );
2893 myBaseInfo = new SMESHGUI_MeshInfo( myTabWidget );
2894 myTabWidget->addTab( myBaseInfo, tr( "BASE_INFO" ));
2898 QWidget* w = new QWidget( myTabWidget );
2900 myMode = new QButtonGroup( this );
2901 myMode->addButton( new QRadioButton( tr( "NODE_MODE" ), w ), NodeMode );
2902 myMode->addButton( new QRadioButton( tr( "ELEM_MODE" ), w ), ElemMode );
2903 myMode->button( NodeMode )->setChecked( true );
2904 myID = new QLineEdit( w );
2905 myID->setValidator( new SMESHGUI_IdValidator( this ));
2906 myIDPreviewCheck = new QCheckBox( tr( "SHOW_IDS" ), w );
2907 myIDPreview = new SMESHGUI_IdPreview( SMESH::GetViewWindow( SMESHGUI::GetSMESHGUI() ));
2909 int mode = SMESHGUI::resourceMgr()->integerValue( "SMESH", "mesh_elem_info", 1 );
2910 mode = qMin( 1, qMax( 0, mode ));
2913 myElemInfo = new SMESHGUI_SimpleElemInfo( w );
2915 myElemInfo = new SMESHGUI_TreeElemInfo( w );
2917 QGridLayout* elemLayout = new QGridLayout( w );
2918 elemLayout->setMargin( MARGIN );
2919 elemLayout->setSpacing( SPACING );
2920 elemLayout->addWidget( myMode->button( NodeMode ), 0, 0 );
2921 elemLayout->addWidget( myMode->button( ElemMode ), 0, 1 );
2922 elemLayout->addWidget( myID, 0, 2 );
2923 elemLayout->addWidget( myIDPreviewCheck, 1, 0, 1, 2 );
2924 elemLayout->addWidget( myElemInfo, 2, 0, 1, 3 );
2926 myTabWidget->addTab( w, tr( "ELEM_INFO" ));
2930 myAddInfo = new SMESHGUI_AddInfo( myTabWidget );
2931 myTabWidget->addTab( myAddInfo, tr( "ADDITIONAL_INFO" ));
2935 myCtrlInfo = new SMESHGUI_CtrlInfo( myTabWidget );
2936 myTabWidget->addTab( myCtrlInfo, tr( "CTRL_INFO" ));
2940 QPushButton* okBtn = new QPushButton( tr( "SMESH_BUT_OK" ), this );
2941 okBtn->setAutoDefault( true );
2942 okBtn->setDefault( true );
2944 QPushButton* dumpBtn = new QPushButton( tr( "BUT_DUMP_MESH" ), this );
2945 dumpBtn->setAutoDefault( true );
2946 QPushButton* helpBtn = new QPushButton( tr( "SMESH_BUT_HELP" ), this );
2947 helpBtn->setAutoDefault( true );
2949 QHBoxLayout* btnLayout = new QHBoxLayout;
2950 btnLayout->setSpacing( SPACING );
2951 btnLayout->setMargin( 0 );
2953 btnLayout->addWidget( okBtn );
2954 btnLayout->addWidget( dumpBtn );
2955 btnLayout->addStretch( 10 );
2956 btnLayout->addWidget( helpBtn );
2958 QVBoxLayout* l = new QVBoxLayout ( this );
2959 l->setMargin( MARGIN );
2960 l->setSpacing( SPACING );
2961 l->addWidget( myTabWidget );
2962 l->addLayout( btnLayout );
2964 myTabWidget->setCurrentIndex( qMax( (int)BaseInfo, qMin( (int)ElemInfo, page )));
2966 connect( okBtn, SIGNAL( clicked() ), this, SLOT( reject() ));
2967 connect( dumpBtn, SIGNAL( clicked() ), this, SLOT( dump() ));
2968 connect( helpBtn, SIGNAL( clicked() ), this, SLOT( help() ));
2969 connect( myTabWidget, SIGNAL( currentChanged( int )), this, SLOT( updateSelection() ));
2970 connect( myMode, SIGNAL( buttonClicked( int )), this, SLOT( modeChanged() ));
2971 connect( myID, SIGNAL( textChanged( QString )), this, SLOT( idChanged() ));
2972 connect( myIDPreviewCheck, SIGNAL( toggled(bool) ), this, SLOT( idPreviewChange(bool) ));
2973 connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( deactivate() ));
2974 connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), this, SLOT( reject() ));
2975 connect( myElemInfo, SIGNAL( itemInfo( int )), this, SLOT( showItemInfo( int )));
2976 connect( myElemInfo, SIGNAL( itemInfo( QString )), this, SLOT( showItemInfo( QString )));
2978 myIDPreviewCheck->setChecked( SMESHGUI::resourceMgr()->booleanValue( "SMESH", id_preview_resource, false ));
2986 SMESHGUI_MeshInfoDlg::~SMESHGUI_MeshInfoDlg()
2992 \brief Show mesh information
2993 \param IO interactive object
2995 void SMESHGUI_MeshInfoDlg::showInfo( const Handle(SALOME_InteractiveObject)& IO )
3000 SMESH::SMESH_IDSource_var obj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
3001 if ( !CORBA::is_nil( obj ))
3003 myAddInfo->showInfo( obj ); // nb of nodes in a group can be computed by myAddInfo,
3004 myBaseInfo->showInfo( obj ); // and it will be used by myBaseInfo (IPAL52871)
3005 if ( myTabWidget->currentIndex() == CtrlInfo )
3006 myCtrlInfo->showInfo( obj );
3009 myActor = SMESH::FindActorByEntry( IO->getEntry() );
3010 SVTK_Selector* selector = SMESH::GetSelector();
3013 if ( myActor && selector ) {
3014 nb = myMode->checkedId() == NodeMode ?
3015 SMESH::GetNameOfSelectedElements( selector, IO, ID ) :
3016 SMESH::GetNameOfSelectedNodes( selector, IO, ID );
3018 myElemInfo->setSource( myActor, obj ) ;
3020 myID->setText( ID.trimmed() );
3022 QStringList idTxt = ID.split( " ", QString::SkipEmptyParts );
3023 foreach ( ID, idTxt )
3024 ids << ID.trimmed().toLong();
3025 myElemInfo->showInfo( ids, myMode->checkedId() == ElemMode );
3029 myElemInfo->clear();
3036 \brief Perform clean-up actions on the dialog box closing.
3038 void SMESHGUI_MeshInfoDlg::reject()
3040 LightApp_SelectionMgr* selMgr = SMESHGUI::selectionMgr();
3041 selMgr->clearFilters();
3042 SMESH::SetPointRepresentation( false );
3043 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
3044 aViewWindow->SetSelectionMode( ActorSelection );
3046 myIDPreview->SetPointsLabeled(false);
3050 \brief Process keyboard event
3051 \param e key press event
3053 void SMESHGUI_MeshInfoDlg::keyPressEvent( QKeyEvent* e )
3055 QDialog::keyPressEvent( e );
3056 if ( !e->isAccepted() && e->key() == Qt::Key_F1 ) {
3063 \brief Reactivate dialog box, when mouse pointer goes into it.
3065 void SMESHGUI_MeshInfoDlg::enterEvent( QEvent* )
3071 \brief Setup selection mode depending on the current dialog box state.
3073 void SMESHGUI_MeshInfoDlg::updateSelection()
3075 LightApp_SelectionMgr* selMgr = SMESHGUI::selectionMgr();
3077 disconnect( selMgr, 0, this, 0 );
3078 selMgr->clearFilters();
3080 if ( myTabWidget->currentIndex() == BaseInfo ||
3081 myTabWidget->currentIndex() == AddInfo ||
3082 myTabWidget->currentIndex() == CtrlInfo ) {
3083 SMESH::SetPointRepresentation( false );
3084 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
3085 aViewWindow->SetSelectionMode( ActorSelection );
3088 if ( myMode->checkedId() == NodeMode ) {
3089 SMESH::SetPointRepresentation( true );
3090 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
3091 aViewWindow->SetSelectionMode( NodeSelection );
3094 SMESH::SetPointRepresentation( false );
3095 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
3096 aViewWindow->SetSelectionMode( CellSelection );
3100 QString oldID = myID->text().trimmed();
3101 SMESH_Actor* oldActor = myActor;
3104 connect( selMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( updateInfo() ));
3107 if ( oldActor == myActor && myActor && !oldID.isEmpty() ) {
3108 myID->setText( oldID );
3114 \brief Show help page
3116 void SMESHGUI_MeshInfoDlg::help()
3118 SMESH::ShowHelpFile( ( myTabWidget->currentIndex() == BaseInfo || myTabWidget->currentIndex() == AddInfo ) ?
3119 "mesh_infos.html#advanced-mesh-infos-anchor" :
3120 "mesh_infos.html#mesh-element-info-anchor" );
3124 \brief Show mesh information
3126 void SMESHGUI_MeshInfoDlg::updateInfo()
3128 SUIT_OverrideCursor wc;
3130 SALOME_ListIO selected;
3131 SMESHGUI::selectionMgr()->selectedObjects( selected );
3133 if ( selected.Extent() == 1 ) {
3134 Handle(SALOME_InteractiveObject) IO = selected.First();
3143 \brief Activate dialog box
3145 void SMESHGUI_MeshInfoDlg::activate()
3147 SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
3148 SMESHGUI::GetSMESHGUI()->SetActiveDialogBox( this );
3149 myTabWidget->setEnabled( true );
3154 \brief Deactivate dialog box
3156 void SMESHGUI_MeshInfoDlg::deactivate()
3158 myTabWidget->setEnabled( false );
3159 disconnect( SMESHGUI::selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( updateInfo() ));
3163 \brief Called when users switches between node / element modes.
3165 void SMESHGUI_MeshInfoDlg::modeChanged()
3172 \brief Called when users prints mesh element ID in the corresponding field.
3174 void SMESHGUI_MeshInfoDlg::idChanged()
3176 myIDPreview->SetPointsLabeled( false );
3178 SVTK_Selector* selector = SMESH::GetSelector();
3179 if ( myActor && selector ) {
3180 Handle(SALOME_InteractiveObject) IO = myActor->getIO();
3181 TColStd_MapOfInteger ID;
3183 std::vector<int> idVec;
3184 std::list< gp_XYZ > aGrCentersXYZ;
3185 QStringList idTxt = myID->text().split( " ", QString::SkipEmptyParts );
3186 foreach ( QString tid, idTxt ) {
3187 long id = tid.trimmed().toLong();
3188 const SMDS_MeshElement* e = myMode->checkedId() == ElemMode ?
3189 myActor->GetObject()->GetMesh()->FindElement( id ) :
3190 myActor->GetObject()->GetMesh()->FindNode( id );
3194 if ( myMode->checkedId() == ElemMode )
3196 idVec.push_back( id );
3197 aGrCentersXYZ.push_back( myElemInfo->getGravityCenter( e ));
3201 selector->AddOrRemoveIndex( IO, ID, false );
3202 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() ) {
3204 if ( myMode->checkedId() == NodeMode )
3205 myIDPreview->SetPointsData( myActor->GetObject()->GetMesh(), ID );
3207 myIDPreview->SetElemsData( idVec, aGrCentersXYZ );
3209 bool showIDs = ( !ID.IsEmpty() &&
3210 myIDPreviewCheck->isChecked() &&
3211 myTabWidget->currentIndex() == ElemInfo );
3212 myIDPreview->SetPointsLabeled( showIDs, myActor->GetVisibility() );
3214 aViewWindow->highlight( IO, true, true );
3215 aViewWindow->Repaint();
3217 myElemInfo->showInfo( ids, myMode->checkedId() == ElemMode );
3222 * \brief Show IDs clicked
3224 void SMESHGUI_MeshInfoDlg::idPreviewChange( bool isOn )
3226 myIDPreview->SetPointsLabeled( isOn && !myID->text().simplified().isEmpty() );
3227 SMESHGUI::resourceMgr()->setValue("SMESH", id_preview_resource, isOn );
3228 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
3229 aViewWindow->Repaint();
3232 void SMESHGUI_MeshInfoDlg::showItemInfo( int id )
3234 if ( id > 0 && myActor->GetObject()->GetMesh()->FindNode( id )) {
3235 myMode->button( NodeMode )->click();
3236 myID->setText( QString::number( id ));
3240 void SMESHGUI_MeshInfoDlg::showItemInfo( const QString& theStr )
3242 if ( !theStr.isEmpty() ) {
3243 myMode->button( ElemMode )->click();
3244 myID->setText( theStr );
3248 void SMESHGUI_MeshInfoDlg::dump()
3250 SUIT_Application* app = SUIT_Session::session()->activeApplication();
3252 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study *>( app->activeStudy() );
3253 if ( !appStudy ) return;
3254 _PTR( Study ) aStudy = appStudy->studyDS();
3256 QStringList aFilters;
3257 aFilters.append( tr( "TEXT_FILES" ));
3259 bool anIsBase = true;
3260 bool anIsElem = true;
3261 bool anIsAdd = true;
3262 bool anIsCtrl = true;
3264 if ( SUIT_ResourceMgr* aResourceMgr = SMESHGUI::resourceMgr() ) {
3265 anIsBase = aResourceMgr->booleanValue( "SMESH", "info_dump_base", anIsBase );
3266 anIsElem = aResourceMgr->booleanValue( "SMESH", "info_dump_elem", anIsElem );
3267 anIsAdd = aResourceMgr->booleanValue( "SMESH", "info_dump_add", anIsAdd );
3268 anIsCtrl = aResourceMgr->booleanValue( "SMESH", "info_dump_ctrl", anIsCtrl );
3271 DumpFileDlg fd( this );
3272 fd.setWindowTitle( tr( "SAVE_INFO" ));
3273 fd.setNameFilters( aFilters );
3274 fd.myBaseChk->setChecked( anIsBase );
3275 fd.myElemChk->setChecked( anIsElem );
3276 fd.myAddChk ->setChecked( anIsAdd );
3277 fd.myCtrlChk->setChecked( anIsCtrl );
3278 if ( fd.exec() == QDialog::Accepted )
3280 QString aFileName = fd.selectedFile();
3282 bool toBase = fd.myBaseChk->isChecked();
3283 bool toElem = fd.myElemChk->isChecked();
3284 bool toAdd = fd.myAddChk->isChecked();
3285 bool toCtrl = fd.myCtrlChk->isChecked();
3287 if ( !aFileName.isEmpty() ) {
3288 QFileInfo aFileInfo( aFileName );
3289 if ( aFileInfo.isDir() )
3292 QFile aFile( aFileName );
3293 if ( !aFile.open( QIODevice::WriteOnly | QIODevice::Text ))
3296 QTextStream out( &aFile );
3298 if ( toBase ) myBaseInfo->saveInfo( out );
3299 if ( toElem ) myElemInfo->saveInfo( out );
3300 if ( toAdd ) myAddInfo ->saveInfo( out );
3301 if ( toCtrl ) myCtrlInfo->saveInfo( out );
3307 \class SMESHGUI_CtrlInfo
3308 \brief Class for the mesh controls information widget.
3313 \param parent parent widget
3315 SMESHGUI_CtrlInfo::SMESHGUI_CtrlInfo( QWidget* parent )
3316 : QFrame( parent ), myPlot( 0 ), myPlot3D( 0 )
3318 setFrameStyle( StyledPanel | Sunken );
3320 myMainLayout = new QGridLayout( this );
3321 myMainLayout->setMargin( MARGIN );
3322 myMainLayout->setSpacing( SPACING );
3325 QLabel* aNameLab = new QLabel( tr( "NAME_LAB" ), this );
3326 QLabel* aName = createField();
3327 aName->setMinimumWidth( 150 );
3330 SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
3331 QIcon aComputeIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_COMPUTE" )) );
3333 SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
3336 QLabel* aNodesLab = new QLabel( tr( "NODES_INFO" ), this );
3337 QLabel* aNodesFreeLab = new QLabel( tr( "NUMBER_OF_THE_FREE_NODES" ), this );
3338 QLabel* aNodesFree = createField();
3339 myWidgets << aNodesFree;
3340 myPredicates << aFilterMgr->CreateFreeNodes();
3342 QLabel* aNodesNbConnLab = new QLabel( tr( "MAX_NODE_CONNECTIVITY" ), this );
3343 QLabel* aNodesNbConn = createField();
3344 myWidgets << aNodesNbConn;
3345 myNodeConnFunctor = aFilterMgr->CreateNodeConnectivityNumber();
3347 QLabel* aNodesDoubleLab = new QLabel( tr( "NUMBER_OF_THE_DOUBLE_NODES" ), this );
3348 QLabel* aNodesDouble = createField();
3349 myWidgets << aNodesDouble;
3350 myPredicates << aFilterMgr->CreateEqualNodes();
3351 QLabel* aToleranceLab = new QLabel( tr( "DOUBLE_NODES_TOLERANCE" ), this );
3352 myToleranceWidget = new SMESHGUI_SpinBox( this );
3353 myToleranceWidget->RangeStepAndValidator(0.0000000001, 1000000.0, 0.0000001, "length_precision" );
3354 myToleranceWidget->setAcceptNames( false );
3355 myToleranceWidget->SetValue( SMESHGUI::resourceMgr()->doubleValue( "SMESH", "equal_nodes_tolerance", 1e-7 ));
3358 QLabel* anEdgesLab = new QLabel( tr( "EDGES_INFO" ), this );
3359 QLabel* anEdgesDoubleLab = new QLabel( tr( "NUMBER_OF_THE_DOUBLE_EDGES" ), this );
3360 QLabel* anEdgesDouble = createField();
3361 myWidgets << anEdgesDouble;
3362 myPredicates << aFilterMgr->CreateEqualEdges();
3365 QLabel* aFacesLab = new QLabel( tr( "FACES_INFO" ), this );
3366 QLabel* aFacesDoubleLab = new QLabel( tr( "NUMBER_OF_THE_DOUBLE_FACES" ), this );
3367 QLabel* aFacesDouble = createField();
3368 myWidgets << aFacesDouble;
3369 myPredicates << aFilterMgr->CreateEqualFaces();
3370 QLabel* aFacesOverLab = new QLabel( tr( "NUMBER_OF_THE_OVER_CONSTRAINED" ), this );
3371 QLabel* aFacesOver = createField();
3372 myWidgets << aFacesOver;
3373 myPredicates << aFilterMgr->CreateOverConstrainedFace();
3374 QLabel* anAspectRatioLab = new QLabel( tr( "ASPECT_RATIO_HISTOGRAM" ), this );
3375 myPlot = createPlot( this );
3376 myAspectRatio = aFilterMgr->CreateAspectRatio();
3379 QLabel* aVolumesLab = new QLabel( tr( "VOLUMES_INFO" ), this );
3380 QLabel* aVolumesDoubleLab = new QLabel( tr( "NUMBER_OF_THE_DOUBLE_VOLUMES" ), this );
3381 QLabel* aVolumesDouble = createField();
3382 myWidgets << aVolumesDouble;
3383 myPredicates << aFilterMgr->CreateEqualVolumes();
3384 QLabel* aVolumesOverLab = new QLabel( tr( "NUMBER_OF_THE_OVER_CONSTRAINED" ), this );
3385 QLabel* aVolumesOver = createField();
3386 myWidgets << aVolumesOver;
3387 myPredicates << aFilterMgr->CreateOverConstrainedVolume();
3388 QLabel* anAspectRatio3DLab = new QLabel( tr( "ASPECT_RATIO_3D_HISTOGRAM" ), this );
3389 myPlot3D = createPlot( this );
3390 myAspectRatio3D = aFilterMgr->CreateAspectRatio3D();
3392 QToolButton* aFreeNodesBtn = new QToolButton( this );
3393 aFreeNodesBtn->setIcon(aComputeIcon);
3394 myButtons << aFreeNodesBtn; //0
3396 QToolButton* aNodesNbConnBtn = new QToolButton( this );
3397 aNodesNbConnBtn->setIcon(aComputeIcon);
3398 myButtons << aNodesNbConnBtn; //1
3400 QToolButton* aDoubleNodesBtn = new QToolButton( this );
3401 aDoubleNodesBtn->setIcon(aComputeIcon);
3402 myButtons << aDoubleNodesBtn; //2
3404 QToolButton* aDoubleEdgesBtn = new QToolButton( this );
3405 aDoubleEdgesBtn->setIcon(aComputeIcon);
3406 myButtons << aDoubleEdgesBtn; //3
3408 QToolButton* aDoubleFacesBtn = new QToolButton( this );
3409 aDoubleFacesBtn->setIcon(aComputeIcon);
3410 myButtons << aDoubleFacesBtn; //4
3412 QToolButton* aOverContFacesBtn = new QToolButton( this );
3413 aOverContFacesBtn->setIcon(aComputeIcon);
3414 myButtons << aOverContFacesBtn; //5
3416 QToolButton* aComputeFaceBtn = new QToolButton( this );
3417 aComputeFaceBtn->setIcon(aComputeIcon);
3418 myButtons << aComputeFaceBtn; //6
3420 QToolButton* aDoubleVolumesBtn = new QToolButton( this );
3421 aDoubleVolumesBtn->setIcon(aComputeIcon);
3422 myButtons << aDoubleVolumesBtn; //7
3424 QToolButton* aOverContVolumesBtn = new QToolButton( this );
3425 aOverContVolumesBtn->setIcon(aComputeIcon);
3426 myButtons << aOverContVolumesBtn; //8
3428 QToolButton* aComputeVolumeBtn = new QToolButton( this );
3429 aComputeVolumeBtn->setIcon(aComputeIcon);
3430 myButtons << aComputeVolumeBtn; //9
3432 connect( aComputeFaceBtn, SIGNAL( clicked() ), this, SLOT( computeAspectRatio() ));
3433 connect( aComputeVolumeBtn, SIGNAL( clicked() ), this, SLOT( computeAspectRatio3D() ));
3434 connect( aFreeNodesBtn, SIGNAL( clicked() ), this, SLOT( computeFreeNodesInfo() ));
3435 connect( aNodesNbConnBtn, SIGNAL( clicked() ), this, SLOT( computeNodesNbConnInfo() ));
3436 connect( aDoubleNodesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleNodesInfo() ));
3437 connect( aDoubleEdgesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleEdgesInfo() ));
3438 connect( aDoubleFacesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleFacesInfo() ));
3439 connect( aOverContFacesBtn, SIGNAL( clicked() ), this, SLOT( computeOverConstrainedFacesInfo() ));
3440 connect( aDoubleVolumesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleVolumesInfo() ));
3441 connect( aOverContVolumesBtn,SIGNAL( clicked() ), this, SLOT( computeOverConstrainedVolumesInfo() ));
3442 connect( myToleranceWidget, SIGNAL(valueChanged(double)), this, SLOT( setTolerance( double )));
3444 setFontAttributes( aNameLab );
3445 setFontAttributes( aNodesLab );
3446 setFontAttributes( anEdgesLab );
3447 setFontAttributes( aFacesLab );
3448 setFontAttributes( aVolumesLab );
3450 myMainLayout->addWidget( aNameLab, 0, 0 ); //0
3451 myMainLayout->addWidget( aName, 0, 1, 1, 2 ); //1
3452 myMainLayout->addWidget( aNodesLab, 1, 0, 1, 3 ); //2
3453 myMainLayout->addWidget( aNodesFreeLab, 2, 0 ); //3
3454 myMainLayout->addWidget( aNodesFree, 2, 1 ); //4
3455 myMainLayout->addWidget( aFreeNodesBtn, 2, 2 ); //5
3456 myMainLayout->addWidget( aNodesNbConnLab, 3, 0 ); //6
3457 myMainLayout->addWidget( aNodesNbConn, 3, 1 ); //7
3458 myMainLayout->addWidget( aNodesNbConnBtn, 3, 2 ); //8
3459 myMainLayout->addWidget( aNodesDoubleLab, 4, 0 ); //9
3460 myMainLayout->addWidget( aNodesDouble, 4, 1 ); //10
3461 myMainLayout->addWidget( aDoubleNodesBtn, 4, 2 ); //11
3462 myMainLayout->addWidget( aToleranceLab, 5, 0 ); //12
3463 myMainLayout->addWidget( myToleranceWidget, 5, 1 ); //13
3464 myMainLayout->addWidget( anEdgesLab, 6, 0, 1, 3 ); //14
3465 myMainLayout->addWidget( anEdgesDoubleLab, 7, 0 ); //15
3466 myMainLayout->addWidget( anEdgesDouble, 7, 1 ); //16
3467 myMainLayout->addWidget( aDoubleEdgesBtn, 7, 2 ); //17
3468 myMainLayout->addWidget( aFacesLab, 8, 0, 1, 3 ); //18
3469 myMainLayout->addWidget( aFacesDoubleLab, 9, 0 ); //19
3470 myMainLayout->addWidget( aFacesDouble, 9, 1 ); //20
3471 myMainLayout->addWidget( aDoubleFacesBtn, 9, 2 ); //21
3472 myMainLayout->addWidget( aFacesOverLab, 10, 0 ); //22
3473 myMainLayout->addWidget( aFacesOver, 10, 1 ); //23
3474 myMainLayout->addWidget( aOverContFacesBtn, 10, 2 ); //24
3475 myMainLayout->addWidget( anAspectRatioLab, 11, 0 ); //25
3476 myMainLayout->addWidget( aComputeFaceBtn, 11, 2 ); //26
3477 myMainLayout->addWidget( myPlot, 12, 0, 1, 3 );//27
3478 myMainLayout->addWidget( aVolumesLab, 13, 0, 1, 3 );//28
3479 myMainLayout->addWidget( aVolumesDoubleLab, 14, 0 ); //29
3480 myMainLayout->addWidget( aVolumesDouble, 14, 1 ); //30
3481 myMainLayout->addWidget( aDoubleVolumesBtn, 14, 2 ); //31
3482 myMainLayout->addWidget( aVolumesOverLab, 15, 0 ); //32
3483 myMainLayout->addWidget( aVolumesOver, 15, 1 ); //33
3484 myMainLayout->addWidget( aOverContVolumesBtn,15, 2 ); //34
3485 myMainLayout->addWidget( anAspectRatio3DLab, 16, 0 ); //35
3486 myMainLayout->addWidget( aComputeVolumeBtn, 16, 2 ); //36
3487 myMainLayout->addWidget( myPlot3D, 17, 0, 1, 3 );//37
3489 myMainLayout->setColumnStretch( 0, 0 );
3490 myMainLayout->setColumnStretch( 1, 5 );
3491 myMainLayout->setRowStretch ( 11, 5 );
3492 myMainLayout->setRowStretch ( 16, 5 );
3493 myMainLayout->setRowStretch ( 17, 1 );
3501 SMESHGUI_CtrlInfo::~SMESHGUI_CtrlInfo()
3505 \brief Change widget font attributes (bold, ...).
3507 \param attr font attributes (XORed flags)
3509 void SMESHGUI_CtrlInfo::setFontAttributes( QWidget* w )
3512 QFont f = w->font();
3519 \brief Create info field
3520 \return new info field
3522 QLabel* SMESHGUI_CtrlInfo::createField()
3524 QLabel* lab = new QLabel( this );
3525 lab->setFrameStyle( StyledPanel | Sunken );
3526 lab->setAlignment( Qt::AlignCenter );
3527 lab->setAutoFillBackground( true );
3528 QPalette pal = lab->palette();
3529 pal.setColor( QPalette::Window, QApplication::palette().color( QPalette::Active, QPalette::Base ));
3530 lab->setPalette( pal );
3531 lab->setMinimumWidth( 60 );
3536 \brief Create QwtPlot
3539 QwtPlot* SMESHGUI_CtrlInfo::createPlot( QWidget* parent )
3541 QwtPlot* aPlot = new QwtPlot( parent );
3542 aPlot->setMinimumSize( 100, 100 );
3543 QFont xFont = aPlot->axisFont( QwtPlot::xBottom );
3544 xFont.setPointSize( 5 );
3545 QFont yFont = aPlot->axisFont( QwtPlot::yLeft );
3546 yFont.setPointSize( 5 );
3547 aPlot->setAxisFont( QwtPlot::xBottom, xFont );
3548 aPlot->setAxisFont( QwtPlot::yLeft, yFont );
3554 \brief Show controls information on the selected object
3556 void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
3560 myObject = SMESH::SMESH_IDSource::_duplicate( obj );
3561 if ( myObject->_is_nil() ) return;
3563 if ( _PTR(SObject) aSO = SMESH::FindSObject( obj ))
3564 myWidgets[0]->setText( aSO->GetName().c_str() );
3566 SMESH::SMESH_Mesh_var mesh = obj->GetMesh();
3567 if ( mesh->_is_nil() ) return;
3569 const bool meshLoaded = mesh->IsLoaded();
3570 if ( !meshLoaded ) // mesh not yet loaded from the hdf file
3571 // enable Compute buttons, just in case obj->GetNbElementsByType() fails
3572 for ( int i = 0; i < myButtons.count(); ++i )
3573 myButtons[i]->setEnabled( true );
3575 SMESH::long_array_var nbElemsByType = obj->GetNbElementsByType();
3576 if ( ! &nbElemsByType.in() ) return;
3578 const CORBA::Long ctrlLimit =
3579 meshLoaded ? SMESHGUI::resourceMgr()->integerValue( "SMESH", "info_controls_limit", 3000 ) : -1;
3582 const CORBA::Long nbNodes = nbElemsByType[ SMESH::NODE ];
3583 const CORBA::Long nbElems = ( nbElemsByType[ SMESH::EDGE ] +
3584 nbElemsByType[ SMESH::FACE ] +
3585 nbElemsByType[ SMESH::VOLUME ] );
3586 if ( nbNodes + nbElems > 0 ) {
3587 if ( Max( (int)nbNodes, (int)nbElems ) <= ctrlLimit ) {
3589 computeFreeNodesInfo();
3590 computeNodesNbConnInfo();
3592 if ( Max( (int)mesh->NbNodes(), (int)mesh->NbElements() ) <= ctrlLimit )
3593 computeDoubleNodesInfo();
3596 myButtons[0]->setEnabled( true );
3597 myButtons[1]->setEnabled( true );
3598 myButtons[2]->setEnabled( true );
3602 for( int i=2; i<=11; i++)
3603 myMainLayout->itemAt(i)->widget()->setVisible( false );
3607 if ( nbElemsByType[ SMESH::EDGE ] > 0 ) {
3609 if( nbElemsByType[ SMESH::EDGE ] <= ctrlLimit )
3610 computeDoubleEdgesInfo();
3612 myButtons[3]->setEnabled( true );
3615 for( int i=11; i<=14; i++)
3616 myMainLayout->itemAt(i)->widget()->setVisible( false );
3620 if ( nbElemsByType[ SMESH::FACE ] > 0 ) {
3621 if ( nbElemsByType[ SMESH::FACE ] <= ctrlLimit ) {
3623 computeDoubleFacesInfo();
3624 // over constrained faces
3625 computeOverConstrainedFacesInfo();
3626 // aspect Ratio histogram
3627 computeAspectRatio();
3630 myButtons[4]->setEnabled( true );
3631 myButtons[5]->setEnabled( true );
3632 myButtons[6]->setEnabled( true );
3634 #ifdef DISABLE_PLOT2DVIEWER
3635 myMainLayout->setRowStretch(12,0);
3636 for( int i=25; i<=27; i++)
3637 myMainLayout->itemAt(i)->widget()->setVisible( false );
3641 myMainLayout->setRowStretch(12,0);
3642 for( int i=18; i<=27; i++)
3643 myMainLayout->itemAt(i)->widget()->setVisible( false );
3647 if ( nbElemsByType[ SMESH::VOLUME ] > 0 ) {
3648 if ( nbElemsByType[ SMESH::VOLUME ] <= ctrlLimit ) {
3650 computeDoubleVolumesInfo();
3651 // over constrained volumes
3652 computeOverConstrainedVolumesInfo();
3653 // aspect Ratio 3D histogram
3654 computeAspectRatio3D();
3657 myButtons[7]->setEnabled( true );
3658 myButtons[8]->setEnabled( true );
3659 myButtons[9]->setEnabled( true );
3661 #ifdef DISABLE_PLOT2DVIEWER
3662 myMainLayout->setRowStretch(17,0);
3663 for( int i=35; i<=37; i++)
3664 myMainLayout->itemAt(i)->widget()->setVisible( false );
3668 myMainLayout->setRowStretch(17,0);
3669 for( int i=28; i<=37; i++)
3670 myMainLayout->itemAt(i)->widget()->setVisible( false );
3674 //================================================================================
3676 * \brief Computes and shows nb of elements satisfying a given predicate
3677 * \param [in] ft - a predicate type (SMESH::FunctorType)
3678 * \param [in] iBut - index of one of myButtons to disable
3679 * \param [in] iWdg - index of one of myWidgets to show the computed number
3681 //================================================================================
3683 void SMESHGUI_CtrlInfo::computeNb( int ft, int iBut, int iWdg )
3685 myButtons[ iBut ]->setEnabled( false );
3686 myWidgets[ iWdg ]->setText( "" );
3687 if ( myObject->_is_nil() ) return;
3689 SUIT_OverrideCursor wc;
3691 SMESH::SMESH_Mesh_var mesh = myObject->GetMesh();
3692 if ( !mesh->_is_nil() && !mesh->IsLoaded() )
3695 this->showInfo( myObject ); // try to show all values
3696 if ( !myWidgets[ iWdg ]->text().isEmpty() )
3697 return; // <ft> predicate already computed
3699 // look for a predicate of type <ft>
3700 for ( int i = 0; i < myPredicates.count(); ++i )
3701 if ( myPredicates[i]->GetFunctorType() == ft )
3703 CORBA::Long nb = myPredicates[i]->NbSatisfying( myObject );
3704 myWidgets[ iWdg ]->setText( QString::number( nb ));
3708 void SMESHGUI_CtrlInfo::computeFreeNodesInfo()
3710 computeNb( SMESH::FT_FreeNodes, 0, 1 );
3713 void SMESHGUI_CtrlInfo::computeDoubleNodesInfo()
3715 computeNb( SMESH::FT_EqualNodes, 2, 3 );
3718 void SMESHGUI_CtrlInfo::computeDoubleEdgesInfo()
3720 computeNb( SMESH::FT_EqualEdges, 3, 4 );
3723 void SMESHGUI_CtrlInfo::computeDoubleFacesInfo()
3725 computeNb( SMESH::FT_EqualFaces, 4, 5 );
3728 void SMESHGUI_CtrlInfo::computeOverConstrainedFacesInfo()
3730 computeNb( SMESH::FT_OverConstrainedFace, 5, 6 );
3733 void SMESHGUI_CtrlInfo::computeDoubleVolumesInfo()
3735 computeNb( SMESH::FT_EqualVolumes, 7, 7 );
3738 void SMESHGUI_CtrlInfo::computeOverConstrainedVolumesInfo()
3740 computeNb( SMESH::FT_OverConstrainedVolume, 8, 8 );
3743 void SMESHGUI_CtrlInfo::computeNodesNbConnInfo()
3745 myButtons[ 1 ]->setEnabled( false );
3746 myWidgets[ 2 ]->setText( "" );
3747 SMESH::SMESH_Mesh_var mesh = myObject->GetMesh();
3748 if ( mesh->_is_nil() ) return;
3749 if ( !mesh->IsLoaded() )
3752 this->showInfo( myObject ); // try to show all values
3753 if ( !myWidgets[ 2 ]->text().isEmpty() )
3754 return; // already computed
3756 myNodeConnFunctor->SetMesh( mesh );
3757 SMESH::Histogram_var histogram =
3758 myNodeConnFunctor->GetLocalHistogram( 1, /*isLogarithmic=*/false, myObject );
3760 myWidgets[ 2 ]->setText( QString::number( histogram[0].max ));
3763 void SMESHGUI_CtrlInfo::computeAspectRatio()
3765 #ifndef DISABLE_PLOT2DVIEWER
3766 myButtons[6]->setEnabled( false );
3768 if ( myObject->_is_nil() ) return;
3770 SUIT_OverrideCursor wc;
3772 Plot2d_Histogram* aHistogram = getHistogram( myAspectRatio );
3773 if ( aHistogram && !aHistogram->isEmpty() ) {
3774 QwtPlotItem* anItem = aHistogram->createPlotItem();
3775 anItem->attach( myPlot );
3782 void SMESHGUI_CtrlInfo::computeAspectRatio3D()
3784 #ifndef DISABLE_PLOT2DVIEWER
3785 myButtons[9]->setEnabled( false );
3787 if ( myObject->_is_nil() ) return;
3789 SUIT_OverrideCursor wc;
3791 Plot2d_Histogram* aHistogram = getHistogram( myAspectRatio3D );
3792 if ( aHistogram && !aHistogram->isEmpty() ) {
3793 QwtPlotItem* anItem = aHistogram->createPlotItem();
3794 anItem->attach( myPlot3D );
3802 \brief Internal clean-up (reset widget)
3804 void SMESHGUI_CtrlInfo::clearInternal()
3806 for( int i=0; i<=35; i++)
3807 myMainLayout->itemAt(i)->widget()->setVisible( true );
3808 for( int i=0; i<=9; i++)
3809 myButtons[i]->setEnabled( false );
3810 myPlot->detachItems();
3811 myPlot3D->detachItems();
3814 myWidgets[0]->setText( QString() );
3815 for ( int i = 1; i < myWidgets.count(); i++ )
3816 myWidgets[i]->setText( "" );
3817 myMainLayout->setRowStretch(11,5);
3818 myMainLayout->setRowStretch(16,5);
3821 void SMESHGUI_CtrlInfo::setTolerance( double theTolerance )
3823 //SMESH::long_array_var anElems = getElementsByType( SMESH::NODE );
3824 myButtons[1]->setEnabled( true );
3825 myWidgets[2]->setText("");
3828 #ifndef DISABLE_PLOT2DVIEWER
3829 Plot2d_Histogram* SMESHGUI_CtrlInfo::getHistogram( SMESH::NumericalFunctor_ptr aNumFun )
3831 SMESH::SMESH_Mesh_var mesh = myObject->GetMesh();
3832 if ( mesh->_is_nil() ) return 0;
3833 if ( !mesh->IsLoaded() )
3835 aNumFun->SetMesh( mesh );
3837 CORBA::Long cprecision = 6;
3838 if ( SMESHGUI::resourceMgr()->booleanValue( "SMESH", "use_precision", false ))
3839 cprecision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "controls_precision", -1 );
3840 aNumFun->SetPrecision( cprecision );
3842 int nbIntervals = SMESHGUI::resourceMgr()->integerValue( "SMESH", "scalar_bar_num_colors", false );
3844 SMESH::Histogram_var histogramVar = aNumFun->GetLocalHistogram( nbIntervals,
3845 /*isLogarithmic=*/false,
3847 Plot2d_Histogram* aHistogram = new Plot2d_Histogram();
3848 aHistogram->setColor( palette().color( QPalette::Highlight ));
3849 if ( &histogramVar.in() )
3851 for ( size_t i = 0, nb = histogramVar->length(); i < nb; i++ )
3852 aHistogram->addPoint( 0.5 * ( histogramVar[i].min + histogramVar[i].max ), histogramVar[i].nbEvents );
3853 if ( histogramVar->length() >= 2 )
3854 aHistogram->setWidth( ( histogramVar[0].max - histogramVar[0].min ) * 0.8 );
3860 void SMESHGUI_CtrlInfo::saveInfo( QTextStream &out ) {
3861 out << QString( 20, '-' ) << "\n";
3862 out << tr( "CTRL_INFO" ) << "\n";
3863 out << QString( 20, '-' ) << "\n";
3864 out << tr( "NAME_LAB" ) << " " << myWidgets[0]->text() << "\n";
3865 out << tr( "NODES_INFO" ) << "\n";
3866 out << QString( SPACING_INFO, ' ' ) << tr( "NUMBER_OF_THE_FREE_NODES" ) << ": " << myWidgets[1]->text() << "\n";
3867 out << QString( SPACING_INFO, ' ' ) << tr( "NUMBER_OF_THE_DOUBLE_NODES" ) << ": " << myWidgets[2]->text() << "\n";
3868 out << tr( "EDGES_INFO" ) << "\n";
3869 out << QString( SPACING_INFO, ' ' ) << tr( "NUMBER_OF_THE_DOUBLE_EDGES" ) << ": " << myWidgets[3]->text() << "\n";
3870 out << tr( "FACES_INFO" ) << "\n";
3871 out << QString( SPACING_INFO, ' ' ) << tr( "NUMBER_OF_THE_DOUBLE_FACES" ) << ": " << myWidgets[4]->text() << "\n";
3872 out << QString( SPACING_INFO, ' ' ) << tr( "NUMBER_OF_THE_OVER_CONSTRAINED" ) << ": " << myWidgets[5]->text() << "\n";
3873 out << tr( "VOLUMES_INFO" ) << "\n";
3874 out << QString( SPACING_INFO, ' ' ) << tr( "NUMBER_OF_THE_DOUBLE_VOLUMES" ) << ": " << myWidgets[6]->text() << "\n";
3875 out << QString( SPACING_INFO, ' ' ) << tr( "NUMBER_OF_THE_OVER_CONSTRAINED" ) << ": " << myWidgets[7]->text() << "\n";
3879 \class SMESHGUI_CtrlInfoDlg
3880 \brief Controls information dialog box
3885 \param parent parent widget
3887 SMESHGUI_CtrlInfoDlg::SMESHGUI_CtrlInfoDlg( QWidget* parent )
3890 setAttribute( Qt::WA_DeleteOnClose, true );
3891 setWindowTitle( tr( "CTRL_INFO" ));
3892 setMinimumSize( 400, 600 );
3894 myCtrlInfo = new SMESHGUI_CtrlInfo( this );
3897 QPushButton* okBtn = new QPushButton( tr( "SMESH_BUT_OK" ), this );
3898 okBtn->setAutoDefault( true );
3899 okBtn->setDefault( true );
3901 QPushButton* dumpBtn = new QPushButton( tr( "BUT_DUMP_MESH" ), this );
3902 dumpBtn->setAutoDefault( true );
3903 QPushButton* helpBtn = new QPushButton( tr( "SMESH_BUT_HELP" ), this );
3904 helpBtn->setAutoDefault( true );
3906 QHBoxLayout* btnLayout = new QHBoxLayout;
3907 btnLayout->setSpacing( SPACING );
3908 btnLayout->setMargin( 0 );
3910 btnLayout->addWidget( okBtn );
3911 btnLayout->addWidget( dumpBtn );
3912 btnLayout->addStretch( 10 );
3913 btnLayout->addWidget( helpBtn );
3915 QVBoxLayout* l = new QVBoxLayout ( this );
3916 l->setMargin( MARGIN );
3917 l->setSpacing( SPACING );
3918 l->addWidget( myCtrlInfo );
3919 l->addLayout( btnLayout );
3921 connect( okBtn, SIGNAL( clicked() ), this, SLOT( reject() ));
3922 connect( dumpBtn, SIGNAL( clicked() ), this, SLOT( dump() ));
3923 connect( helpBtn, SIGNAL( clicked() ), this, SLOT( help() ));
3924 connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( deactivate() ));
3925 connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), this, SLOT( reject() ));
3933 SMESHGUI_CtrlInfoDlg::~SMESHGUI_CtrlInfoDlg()
3938 \brief Show controls information
3939 \param IO interactive object
3941 void SMESHGUI_CtrlInfoDlg::showInfo( const Handle(SALOME_InteractiveObject)& IO )
3943 if ( SMESH::SMESH_IDSource_var obj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO ))
3944 myCtrlInfo->showInfo( obj );
3948 \brief Perform clean-up actions on the dialog box closing.
3950 void SMESHGUI_CtrlInfoDlg::reject()
3952 SMESH::SetPointRepresentation( false );
3957 \brief Setup selection mode depending on the current dialog box state.
3959 void SMESHGUI_CtrlInfoDlg::updateSelection()
3961 LightApp_SelectionMgr* selMgr = SMESHGUI::selectionMgr();
3962 disconnect( selMgr, 0, this, 0 );
3963 SMESH::SetPointRepresentation( false );
3964 connect( selMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( updateInfo() ));
3969 \brief Show mesh information
3971 void SMESHGUI_CtrlInfoDlg::updateInfo()
3973 SUIT_OverrideCursor wc;
3975 SALOME_ListIO selected;
3976 SMESHGUI::selectionMgr()->selectedObjects( selected );
3978 if ( selected.Extent() == 1 ) {
3979 Handle(SALOME_InteractiveObject) IO = selected.First();
3985 \brief Activate dialog box
3987 void SMESHGUI_CtrlInfoDlg::activate()
3989 SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
3990 SMESHGUI::GetSMESHGUI()->SetActiveDialogBox( this );
3995 \brief Deactivate dialog box
3997 void SMESHGUI_CtrlInfoDlg::deactivate()
3999 disconnect( SMESHGUI::selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( updateInfo() ));
4003 * \brief Dump contents into a file
4005 void SMESHGUI_CtrlInfoDlg::dump()
4007 SUIT_Application* app = SUIT_Session::session()->activeApplication();
4009 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study *>( app->activeStudy() );
4010 if ( !appStudy ) return;
4011 _PTR( Study ) aStudy = appStudy->studyDS();
4013 QStringList aFilters;
4014 aFilters.append( tr( "TEXT_FILES" ));
4016 DumpFileDlg fd( this );
4017 fd.setWindowTitle( tr( "SAVE_INFO" ));
4018 fd.setNameFilters( aFilters );
4019 fd.myBaseChk->hide();
4020 fd.myElemChk->hide();
4021 fd.myAddChk ->hide();
4022 fd.myCtrlChk->hide();
4023 if ( fd.exec() == QDialog::Accepted )
4025 QString aFileName = fd.selectedFile();
4026 if ( !aFileName.isEmpty() ) {
4027 QFileInfo aFileInfo( aFileName );
4028 if ( aFileInfo.isDir() )
4031 QFile aFile( aFileName );
4032 if ( !aFile.open( QIODevice::WriteOnly | QIODevice::Text ))
4035 QTextStream out( &aFile );
4036 myCtrlInfo->saveInfo( out );
4044 void SMESHGUI_CtrlInfoDlg::help()
4046 SMESH::ShowHelpFile("mesh_infos.html#mesh_quality_info_anchor");