X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_ComputeDlg.cxx;h=7bf81c56cca5918ccbd2a78f177abd3ba273a683;hb=1b57300c826e4cb17d9a40124991a14eabb9eee8;hp=a8e8fd20c5fcf8b4ba9509a7650c4811714fa4bf;hpb=2c607013a23bd4e7ba07e72e0c04dee2c1209cff;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index a8e8fd20c..7bf81c56c 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -337,18 +337,22 @@ namespace SMESH { QString text; switch ( errCode ) { - CASE2TEXT( COMPERR_OK ); - CASE2TEXT( COMPERR_BAD_INPUT_MESH); - CASE2TEXT( COMPERR_STD_EXCEPTION ); - CASE2TEXT( COMPERR_OCC_EXCEPTION ); + CASE2TEXT( COMPERR_OK ); + CASE2TEXT( COMPERR_BAD_INPUT_MESH ); + CASE2TEXT( COMPERR_STD_EXCEPTION ); + CASE2TEXT( COMPERR_OCC_EXCEPTION ); case SMESH::COMPERR_SLM_EXCEPTION: break; // avoid double "Salome exception" - CASE2TEXT( COMPERR_EXCEPTION ); - CASE2TEXT( COMPERR_MEMORY_PB ); - CASE2TEXT( COMPERR_BAD_SHAPE ); + CASE2TEXT( COMPERR_EXCEPTION ); + CASE2TEXT( COMPERR_MEMORY_PB ); + CASE2TEXT( COMPERR_BAD_SHAPE ); + CASE2TEXT( COMPERR_CANCELED ); + CASE2TEXT( COMPERR_NO_MESH_ON_SHAPE ); case SMESH::COMPERR_ALGO_FAILED: if ( strlen(comment) == 0 ) text = QObject::tr("COMPERR_ALGO_FAILED"); break; + case SMESH::COMPERR_WARNING: + return comment ? QString(comment) : QObject::tr("COMPERR_UNKNOWN"); default: text = QString("#%1").arg( -errCode ); } @@ -357,7 +361,7 @@ namespace SMESH } // ----------------------------------------------------------------------- /*! - * \brief Return SO of a subshape + * \brief Return SO of a sub-shape */ _PTR(SObject) getSubShapeSO( int subShapeID, GEOM::GEOM_Object_var aMainShape) { @@ -382,7 +386,7 @@ namespace SMESH } // ----------------------------------------------------------------------- /*! - * \brief Return subshape by ID + * \brief Return sub-shape by ID */ GEOM::GEOM_Object_ptr getSubShape( int subShapeID, GEOM::GEOM_Object_var aMainShape) { @@ -420,7 +424,7 @@ namespace SMESH } // ----------------------------------------------------------------------- /*! - * \brief Return text describing a subshape + * \brief Return text describing a sub-shape */ QString shapeText(int subShapeID, GEOM::GEOM_Object_var aMainShape ) { @@ -535,10 +539,11 @@ QFrame* SMESHGUI_ComputeDlg::createMainFrame (QWidget* theParent, bool ForEval) // Computation errors myCompErrorGroup = new QGroupBox(tr("ERRORS"), aFrame); - myTable = new QTableWidget( 1, NB_COLUMNS, myCompErrorGroup); - myShowBtn = new QPushButton(tr("SHOW_SHAPE"), myCompErrorGroup); - myPublishBtn = new QPushButton(tr("PUBLISH_SHAPE"), myCompErrorGroup); - myBadMeshBtn = new QPushButton(tr("SHOW_BAD_MESH"), myCompErrorGroup); + myWarningLabel = new QLabel(QString("%1").arg(tr("COMPUTE_WARNING")), myCompErrorGroup); + myTable = new QTableWidget( 1, NB_COLUMNS, myCompErrorGroup); + myShowBtn = new QPushButton(tr("SHOW_SHAPE"), myCompErrorGroup); + myPublishBtn = new QPushButton(tr("PUBLISH_SHAPE"), myCompErrorGroup); + myBadMeshBtn = new QPushButton(tr("SHOW_BAD_MESH"), myCompErrorGroup); //myTable->setReadOnly( true ); // VSR: check myTable->setEditTriggers( QAbstractItemView::NoEditTriggers ); @@ -546,6 +551,9 @@ QFrame* SMESHGUI_ComputeDlg::createMainFrame (QWidget* theParent, bool ForEval) myTable->hideColumn( COL_SHAPEID ); myTable->hideColumn( COL_BAD_MESH ); myTable->horizontalHeader()->setResizeMode( COL_ERROR, QHeaderView::Interactive ); + myTable->setWordWrap( true ); + myTable->horizontalHeader()->setStretchLastSection( true ); + myTable->setMinimumWidth( 500 ); QStringList headers; headers << tr( "COL_ALGO_HEADER" ); @@ -560,11 +568,12 @@ QFrame* SMESHGUI_ComputeDlg::createMainFrame (QWidget* theParent, bool ForEval) QGridLayout* grpLayout = new QGridLayout(myCompErrorGroup); grpLayout->setSpacing(SPACING); grpLayout->setMargin(MARGIN); - grpLayout->addWidget( myTable, 0, 0, 4, 1 ); - grpLayout->addWidget( myShowBtn, 0, 1 ); - grpLayout->addWidget( myPublishBtn, 1, 1 ); - grpLayout->addWidget( myBadMeshBtn, 2, 1 ); - grpLayout->setRowStretch( 3, 1 ); + grpLayout->addWidget( myWarningLabel, 0, 0, 1, 4 ); + grpLayout->addWidget( myTable, 1, 0, 1, 4 ); + grpLayout->addWidget( myShowBtn, 2, 0 ); + grpLayout->addWidget( myPublishBtn, 2, 1 ); + grpLayout->addWidget( myBadMeshBtn, 2, 2 ); + grpLayout->setColumnStretch( 3, 1 ); // Hypothesis definition errors @@ -941,26 +950,45 @@ void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack, } else { - QTableWidget* tbl = aCompDlg->myTable; + bool onlyWarnings = !theNoCompError; // == valid mesh computed but there are errors reported + for ( int i = 0; i < theCompErrors->length() && onlyWarnings; ++i ) + onlyWarnings = ( theCompErrors[ i ].code == SMESH::COMPERR_WARNING || + theCompErrors[ i ].code == SMESH::COMPERR_NO_MESH_ON_SHAPE ); + + // full or brief mesh info SMESH::long_array_var aRes = myMesh->GetMeshInfo(); - aCompDlg->myBriefInfo->SetMeshInfo( aRes ); - aCompDlg->myBriefInfo->show(); - aCompDlg->myFullInfo->hide(); + if ( onlyWarnings ) { + aCompDlg->myFullInfo->SetMeshInfo( aRes ); + aCompDlg->myFullInfo->show(); + aCompDlg->myBriefInfo->hide(); + } else { + aCompDlg->myBriefInfo->SetMeshInfo( aRes ); + aCompDlg->myBriefInfo->show(); + aCompDlg->myFullInfo->hide(); + } + // pbs of hypo dfinitions if ( theNoHypoError ) { aCompDlg->myHypErrorGroup->hide(); - } - else { + } else { aCompDlg->myHypErrorGroup->show(); aCompDlg->myHypErrorLabel->setText( theHypErrors ); } - if ( theNoCompError ) { + // table of errors + if ( theNoCompError ) + { aCompDlg->myCompErrorGroup->hide(); } - else { + else + { aCompDlg->myCompErrorGroup->show(); + if ( onlyWarnings ) + aCompDlg->myWarningLabel->show(); + else + aCompDlg->myWarningLabel->hide(); + if ( !hasShape ) { aCompDlg->myPublishBtn->hide(); aCompDlg->myShowBtn->hide(); @@ -971,6 +999,7 @@ void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack, } // fill table of errors + QTableWidget* tbl = aCompDlg->myTable; tbl->setRowCount( theCompErrors->length() ); if ( !hasShape ) tbl->hideColumn( COL_SHAPE ); else tbl->showColumn( COL_SHAPE ); @@ -1011,6 +1040,7 @@ void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack, } tbl->resizeColumnToContents( COL_ALGO ); tbl->resizeColumnToContents( COL_SHAPE ); + tbl->setWordWrap( true ); if ( hasBadMesh ) aCompDlg->myBadMeshBtn->show(); @@ -1049,7 +1079,7 @@ void SMESHGUI_BaseComputeOp::stopOperation() //================================================================================ /*! - * \brief publish selected subshape + * \brief publish selected sub-shape */ //================================================================================ @@ -1118,13 +1148,13 @@ void SMESHGUI_BaseComputeOp::onShowBadMesh() SMESH::MeshPreviewStruct_var aMeshData = gen->GetBadInputElements(myMesh,curSub); vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3); vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1); - // delete property !!!!!!!!!! vtkProperty* prop = vtkProperty::New(); prop->SetLineWidth( aLineWidth * 3 ); prop->SetPointSize( aPointSize * 3 ); prop->SetColor( 250, 0, 250 ); myBadMeshDisplayer->GetActor()->SetProperty( prop ); myBadMeshDisplayer->SetData( aMeshData._retn() ); + prop->Delete(); } } } @@ -2060,6 +2090,7 @@ void SMESHGUI_BaseComputeOp::showEvaluateResult(const SMESH::long_array& theRes, } tbl->resizeColumnToContents( COL_ALGO ); tbl->resizeColumnToContents( COL_SHAPE ); + tbl->setWordWrap( true ); if ( hasBadMesh ) aCompDlg->myBadMeshBtn->show();