00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "SMESHGUI_MeshInfosBox.h"
00025
00026 #include "SMDSAbs_ElementType.hxx"
00027
00028
00029 #include <QFrame>
00030 #include <QLabel>
00031 #include <QGridLayout>
00032
00033 #define SPACING 6
00034 #define MARGIN 11
00035
00036 #define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" )
00037
00038 static void addSeparator( QWidget* parent )
00039 {
00040 QGridLayout* l = qobject_cast<QGridLayout*>( parent->layout() );
00041 int row = l->rowCount();
00042 int cols = l->columnCount();
00043 for ( int i = 0; i < cols; i++ ) {
00044 QFrame* hline = new QFrame( parent );
00045 hline->setFrameStyle( QFrame::HLine | QFrame::Sunken );
00046 l->addWidget( hline, row, i );
00047 }
00048 }
00049
00050 enum TCol {
00051 COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, COL_BAD_MESH, NB_COLUMNS
00052 };
00053
00054
00058
00059
00060 SMESHGUI_MeshInfosBox::SMESHGUI_MeshInfosBox(const bool full, QWidget* theParent)
00061 : QGroupBox( tr("SMESH_MESHINFO_TITLE"), theParent ), myFull( full ),
00062 myNbNode(0), my0DElem(0), myNbEdge(0), myNbLinEdge(0), myNbQuadEdge(0),
00063 myNbTrai(0), myNbLinTrai(0), myNbQuadTrai(0), myNbQuad(0), myNbLinQuad(0),
00064 myNbQuadQuad(0), myNbFace(0), myNbLinFace(0), myNbQuadFace(0), myNbPolyg(0),
00065 myNbHexa(0), myNbLinHexa(0), myNbQuadHexa(0), myNbTetra(0), myNbLinTetra(0),
00066 myNbQuadTetra(0), myNbPyra(0), myNbLinPyra(0), myNbQuadPyra(0), myNbPrism(0),
00067 myNbLinPrism(0), myNbQuadPrism(0), myNbVolum(0), myNbLinVolum(0), myNbQuadVolum(0),
00068 myNbPolyh(0)
00069 {
00070 QGridLayout* l = new QGridLayout(this);
00071 l->setMargin( MARGIN );
00072 l->setSpacing( SPACING );
00073
00074 QFont italic = font(); italic.setItalic(true);
00075 QFont bold = font(); bold.setBold(true);
00076
00077 QLabel* lab;
00078 int row = 0;
00079
00080
00081 lab = new QLabel( this );
00082 lab->setMinimumWidth(100); lab->setFont( italic );
00083 l->addWidget( lab, row, 0 );
00084
00085 lab = new QLabel(tr("SMESH_MESHINFO_ORDER0"), this );
00086 lab->setMinimumWidth(100); lab->setFont( italic );
00087 l->addWidget( lab, row, 1 );
00088
00089 lab = new QLabel(tr("SMESH_MESHINFO_ORDER1"), this );
00090 lab->setMinimumWidth(100); lab->setFont( italic );
00091 l->addWidget( lab, row, 2 );
00092
00093 lab = new QLabel(tr("SMESH_MESHINFO_ORDER2"), this );
00094 lab->setMinimumWidth(100); lab->setFont( italic );
00095 l->addWidget( lab, row, 3 );
00096
00097 if ( myFull )
00098 {
00099
00100 row = l->rowCount();
00101
00102 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), this );
00103 lab->setFont( bold );
00104 l->addWidget( lab, row, 0 );
00105
00106 myNbNode = new QLabel( this );
00107 l->addWidget( myNbNode, row, 1 );
00108
00109 addSeparator(this);
00110
00111
00112 row = l->rowCount();
00113
00114 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_0DELEMS")), this );
00115 lab->setFont( bold );
00116 l->addWidget( lab, row, 0 );
00117
00118 my0DElem = new QLabel( this );
00119 l->addWidget( my0DElem, row, 1 );
00120
00121 addSeparator(this);
00122
00123
00124 row = l->rowCount();
00125
00126 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), this );
00127 lab->setFont( bold );
00128 l->addWidget( lab, row, 0 );
00129
00130 myNbEdge = new QLabel( this );
00131 l->addWidget( myNbEdge, row, 1 );
00132
00133 myNbLinEdge = new QLabel( this );
00134 l->addWidget( myNbLinEdge, row, 2 );
00135
00136 myNbQuadEdge = new QLabel( this );
00137 l->addWidget( myNbQuadEdge, row, 3 );
00138
00139 addSeparator(this);
00140
00141
00142 row = l->rowCount();
00143
00144 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), this);
00145 lab->setFont( bold );
00146 l->addWidget( lab, row, 0 );
00147
00148 myNbFace = new QLabel( this );
00149 l->addWidget( myNbFace, row, 1 );
00150
00151 myNbLinFace = new QLabel( this );
00152 l->addWidget( myNbLinFace, row, 2 );
00153
00154 myNbQuadFace = new QLabel( this );
00155 l->addWidget( myNbQuadFace, row, 3 );
00156
00157 row++;
00158
00159 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TRIANGLES")), this );
00160 l->addWidget( lab, row, 0 );
00161
00162 myNbTrai = new QLabel( this );
00163 l->addWidget( myNbTrai, row, 1 );
00164
00165 myNbLinTrai = new QLabel( this );
00166 l->addWidget( myNbLinTrai, row, 2 );
00167
00168 myNbQuadTrai = new QLabel( this );
00169 l->addWidget( myNbQuadTrai, row, 3 );
00170
00171 row++;
00172
00173 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_QUADRANGLES")), this );
00174 l->addWidget( lab, row, 0 );
00175
00176 myNbQuad = new QLabel( this );
00177 l->addWidget( myNbQuad, row, 1 );
00178
00179 myNbLinQuad = new QLabel( this );
00180 l->addWidget( myNbLinQuad, row, 2 );
00181
00182 myNbQuadQuad = new QLabel( this );
00183 l->addWidget( myNbQuadQuad, row, 3 );
00184
00185 row++;
00186
00187 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_POLYGONES")), this );
00188 l->addWidget( lab, row, 0 );
00189 myNbPolyg = new QLabel( this );
00190 l->addWidget( myNbPolyg, row, 1 );
00191
00192 addSeparator(this);
00193
00194
00195 row = l->rowCount();
00196
00197 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), this);
00198 lab->setFont( bold );
00199 l->addWidget( lab, row, 0 );
00200
00201 myNbVolum = new QLabel( this );
00202 l->addWidget( myNbVolum, row, 1 );
00203
00204 myNbLinVolum = new QLabel( this );
00205 l->addWidget( myNbLinVolum, row, 2 );
00206
00207 myNbQuadVolum = new QLabel( this );
00208 l->addWidget( myNbQuadVolum, row, 3 );
00209
00210 row++;
00211
00212 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TETRAS")), this );
00213 l->addWidget( lab, row, 0 );
00214
00215 myNbTetra = new QLabel( this );
00216 l->addWidget( myNbTetra, row, 1 );
00217
00218 myNbLinTetra = new QLabel( this );
00219 l->addWidget( myNbLinTetra, row, 2 );
00220
00221 myNbQuadTetra = new QLabel( this );
00222 l->addWidget( myNbQuadTetra, row, 3 );
00223
00224 row++;
00225
00226 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_HEXAS")), this );
00227 l->addWidget( lab, row, 0 );
00228
00229 myNbHexa = new QLabel( this );
00230 l->addWidget( myNbHexa, row, 1 );
00231
00232 myNbLinHexa = new QLabel( this );
00233 l->addWidget( myNbLinHexa, row, 2 );
00234
00235 myNbQuadHexa = new QLabel( this );
00236 l->addWidget( myNbQuadHexa, row, 3 );
00237
00238 row++;
00239
00240 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PYRAS")), this );
00241 l->addWidget( lab, row, 0 );
00242
00243 myNbPyra = new QLabel( this );
00244 l->addWidget( myNbPyra, row, 1 );
00245
00246 myNbLinPyra = new QLabel( this );
00247 l->addWidget( myNbLinPyra, row, 2 );
00248
00249 myNbQuadPyra = new QLabel( this );
00250 l->addWidget( myNbQuadPyra, row, 3 );
00251
00252 row++;
00253
00254 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PRISMS")), this );
00255 l->addWidget( lab, row, 0 );
00256
00257 myNbPrism = new QLabel( this );
00258 l->addWidget( myNbPrism, row, 1 );
00259
00260 myNbLinPrism = new QLabel( this );
00261 l->addWidget( myNbLinPrism, row, 2 );
00262
00263 myNbQuadPrism = new QLabel( this );
00264 l->addWidget( myNbQuadPrism, row, 3 );
00265
00266 row++;
00267
00268 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_POLYEDRES")), this );
00269 l->addWidget( lab, row, 0 );
00270
00271 myNbPolyh = new QLabel( this );
00272 l->addWidget( myNbPolyh, row, 1 );
00273 }
00274 else
00275 {
00276
00277 row = l->rowCount();
00278
00279 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), this );
00280 l->addWidget( lab, row, 0 );
00281
00282 myNbNode = new QLabel( this );
00283 l->addWidget( myNbNode, row, 1 );
00284
00285
00286 row = l->rowCount();
00287
00288 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_0DELEMS")), this );
00289 l->addWidget( lab, row, 0 );
00290
00291 my0DElem = new QLabel( this );
00292 l->addWidget( my0DElem, row, 1 );
00293
00294 addSeparator(this);
00295
00296
00297 row = l->rowCount();
00298
00299 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), this );
00300 l->addWidget( lab, row, 0 );
00301
00302 myNbEdge = new QLabel( this );
00303 l->addWidget( myNbEdge, row, 1 );
00304
00305 myNbLinEdge = new QLabel( this );
00306 l->addWidget( myNbLinEdge, row, 2 );
00307
00308 myNbQuadEdge = new QLabel( this );
00309 l->addWidget( myNbQuadEdge, row, 3 );
00310
00311
00312 row = l->rowCount();
00313
00314 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), this);
00315 l->addWidget( lab, row, 0 );
00316
00317 myNbFace = new QLabel( this );
00318 l->addWidget( myNbFace, row, 1 );
00319
00320 myNbLinFace = new QLabel( this );
00321 l->addWidget( myNbLinFace, row, 2 );
00322
00323 myNbQuadFace = new QLabel( this );
00324 l->addWidget( myNbQuadFace, row, 3 );
00325
00326
00327 row = l->rowCount();
00328
00329 lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), this);
00330 l->addWidget( lab, row, 0 );
00331
00332 myNbVolum = new QLabel( this );
00333 l->addWidget( myNbVolum, row, 1 );
00334
00335 myNbLinVolum = new QLabel( this );
00336 l->addWidget( myNbLinVolum, row, 2 );
00337
00338 myNbQuadVolum = new QLabel( this );
00339 l->addWidget( myNbQuadVolum, row, 3 );
00340 }
00341 }
00342
00343
00347
00348
00349 void SMESHGUI_MeshInfosBox::SetMeshInfo(const SMESH::long_array& theInfo)
00350 {
00351
00352 myNbNode ->setText( QString("%1").arg( theInfo[SMDSEntity_Node] ));
00353
00354
00355 my0DElem ->setText( QString("%1").arg( theInfo[SMDSEntity_0D] ));
00356
00357
00358 myNbEdge ->setText( QString("%1").arg( theInfo[SMDSEntity_Edge] +
00359 theInfo[SMDSEntity_Quad_Edge] ));
00360 myNbLinEdge ->setText( QString("%1").arg( theInfo[SMDSEntity_Edge] ));
00361 myNbQuadEdge ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Edge] ));
00362
00363
00364 myNbFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] +
00365 theInfo[SMDSEntity_Quad_Triangle] +
00366 theInfo[SMDSEntity_Quadrangle] +
00367 theInfo[SMDSEntity_Quad_Quadrangle] +
00368 theInfo[SMDSEntity_Polygon] ));
00369 myNbLinFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] +
00370 theInfo[SMDSEntity_Quadrangle] +
00371 theInfo[SMDSEntity_Polygon] ));
00372 myNbQuadFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Triangle] +
00373 theInfo[SMDSEntity_Quad_Quadrangle] ));
00374
00375
00376 myNbVolum ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] +
00377 theInfo[SMDSEntity_Quad_Tetra] +
00378 theInfo[SMDSEntity_Pyramid] +
00379 theInfo[SMDSEntity_Quad_Pyramid] +
00380 theInfo[SMDSEntity_Hexa] +
00381 theInfo[SMDSEntity_Quad_Hexa] +
00382 theInfo[SMDSEntity_Penta] +
00383 theInfo[SMDSEntity_Quad_Penta] +
00384 theInfo[SMDSEntity_Polyhedra] ));
00385 myNbLinVolum ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] +
00386 theInfo[SMDSEntity_Pyramid] +
00387 theInfo[SMDSEntity_Hexa] +
00388 theInfo[SMDSEntity_Penta] +
00389 theInfo[SMDSEntity_Polyhedra] ));
00390 myNbQuadVolum->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Tetra] +
00391 theInfo[SMDSEntity_Quad_Pyramid] +
00392 theInfo[SMDSEntity_Quad_Hexa] +
00393 theInfo[SMDSEntity_Quad_Penta] ));
00394
00395 if ( myFull )
00396 {
00397
00398 myNbTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] +
00399 theInfo[SMDSEntity_Quad_Triangle] ));
00400 myNbLinTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] ));
00401 myNbQuadTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Triangle] ));
00402
00403 myNbQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_Quadrangle] +
00404 theInfo[SMDSEntity_Quad_Quadrangle] ));
00405 myNbLinQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_Quadrangle] ));
00406 myNbQuadQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Quadrangle] ));
00407
00408 myNbPolyg ->setText( QString("%1").arg( theInfo[SMDSEntity_Polygon] ));
00409
00410
00411 myNbTetra ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] +
00412 theInfo[SMDSEntity_Quad_Tetra] ));
00413 myNbLinTetra ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] ));
00414 myNbQuadTetra->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Tetra] ));
00415
00416 myNbHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Hexa] +
00417 theInfo[SMDSEntity_Quad_Hexa] ));
00418 myNbLinHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Hexa] ));
00419 myNbQuadHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Hexa] ));
00420
00421 myNbPyra ->setText( QString("%1").arg( theInfo[SMDSEntity_Pyramid] +
00422 theInfo[SMDSEntity_Quad_Pyramid] ));
00423 myNbLinPyra ->setText( QString("%1").arg( theInfo[SMDSEntity_Pyramid] ));
00424 myNbQuadPyra ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Pyramid] ));
00425
00426 myNbPrism ->setText( QString("%1").arg( theInfo[SMDSEntity_Penta] +
00427 theInfo[SMDSEntity_Quad_Penta] ));
00428 myNbLinPrism ->setText( QString("%1").arg( theInfo[SMDSEntity_Penta] ));
00429 myNbQuadPrism->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Penta] ));
00430
00431 myNbPolyh ->setText( QString("%1").arg( theInfo[SMDSEntity_Polyhedra] ));
00432 }
00433 }