#include "SALOMEDSClient_SObject.hxx"
#include "SALOME_ListIO.hxx"
#include "SVTK_ViewWindow.h"
+#include "SVTK_ViewModel.h"
#include "SalomeApp_Tools.h"
#include "SalomeApp_Application.h"
#include "SUIT_ResourceMgr.h"
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <qtable.h>
+#include <qhbox.h>
+#include <qhgroupbox.h>
+#include <qvgroupbox.h>
#include <vtkProperty.h>
#define SPACING 5
#define MARGIN 10
+#define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" )
+
+#define _SEPARATOR(father) \
+{\
+ /*new QLabel(father); new QLabel(father); new QLabel(father)*/;\
+ (new QFrame(father))->setFrameStyle(QFrame::HLine | QFrame::Sunken);\
+ (new QFrame(father))->setFrameStyle(QFrame::HLine | QFrame::Sunken);\
+ (new QFrame(father))->setFrameStyle(QFrame::HLine | QFrame::Sunken);\
+ (new QFrame(father))->setFrameStyle(QFrame::HLine | QFrame::Sunken);\
+}
+
enum TCol { COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, NB_COLUMNS };
using namespace SMESH;
namespace SMESH {
+ //=============================================================================
+ /*!
+ * \brief Allocate some memory at construction and release it at destruction.
+ * Is used to be able to continue working after mesh generation or visualization
+ * break due to lack of memory
+ */
+ //=============================================================================
+
+ struct MemoryReserve
+ {
+ char* myBuf;
+ MemoryReserve(): myBuf( new char[1024*1024*1] ){} // 1M
+ ~MemoryReserve() { delete [] myBuf; }
+ };
+
// =========================================================================================
/*!
* \brief Class showing shapes without publishing
// -----------------------------------------------------------------------
void DeleteActors()
{
- TActorIterator actorIt = actorIterator();
- while ( actorIt.more() )
- if (VTKViewer_Actor* anActor = actorIt.next()) {
- myViewWindow->RemoveActor( anActor );
- //anActor->Delete();
- }
+ if ( hasViewWindow() ) {
+ TActorIterator actorIt = actorIterator();
+ while ( actorIt.more() )
+ if (VTKViewer_Actor* anActor = actorIt.next()) {
+ myViewWindow->RemoveActor( anActor );
+ //anActor->Delete();
+ }
+ }
myIndexToShape.Clear();
myActors.clear();
myShownActors.clear();
double deflection = Max( aXmax-aXmin , Max ( aYmax-aYmin , aZmax-aZmin)) * 0.01 *4;
BRepMesh_IncrementalMesh MESH(shape,deflection);
}
+ // -----------------------------------------------------------------------
+ bool hasViewWindow() const
+ {
+ if ( !myViewWindow ) return false;
+
+ if ( SalomeApp_Application* anApp = SMESHGUI::GetSMESHGUI()->getApp() )
+ return FindVtkViewWindow( anApp->getViewManager(SVTK_Viewer::Type(), false ),
+ myViewWindow );
+ return false;
+ }
};
// =========================================================================================
}
return text;
}
+ // -----------------------------------------------------------------------
+ /*!
+ * \brief Return text describing a subshape
+ */
+ bool getSelectedRows(QTable* table, list< int > & rows)
+ {
+ rows.clear();
+ int nbSel = table->numSelections();
+ for ( int i = 0; i < nbSel; ++i )
+ {
+ QTableSelection selected = table->selection(i);
+ if ( !selected.isActive() ) continue;
+ for ( int row = selected.topRow(); row <= selected.bottomRow(); ++row )
+ rows.push_back( row );
+ }
+ return !rows.empty();
+ }
+
} // namespace SMESH
+// =========================================================================================
+/*!
+ * \brief Box showing mesh info
+ */
+// =========================================================================================
+
+SMESHGUI_MeshInfosBox::SMESHGUI_MeshInfosBox(const bool full, QWidget* theParent)
+ :QGroupBox( 4, Qt::Horizontal, tr("SMESH_MESHINFO_TITLE"), theParent ), myFull( full )
+{
+ // title
+ QLabel* lab1 = new QLabel(this);
+ QLabel* lab2 = new QLabel(tr("SMESH_MESHINFO_ORDER0"), this );
+ QLabel* lab3 = new QLabel(tr("SMESH_MESHINFO_ORDER1"), this );
+ QLabel* lab4 = new QLabel(tr("SMESH_MESHINFO_ORDER2"), this );
+
+ QFont italic = lab1->font(); italic.setItalic(true);
+ QFont bold = lab1->font(); bold.setBold(true);
+
+ lab1->setMinimumWidth(100); lab1->setFont( italic );
+ lab2->setMinimumWidth(100); lab2->setFont( italic );
+ lab3->setMinimumWidth(100); lab3->setFont( italic );
+ lab4->setMinimumWidth(100); lab4->setFont( italic );
+
+ if ( myFull )
+ {
+ // nodes
+ (new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), this ))->setFont( bold );
+ myNbNode = new QLabel( this );
+ new QLabel(this);
+ new QLabel(this);
+
+ _SEPARATOR(this);
+
+ // edges
+ (new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), this ))->setFont( bold );
+ myNbEdge = new QLabel( this );
+ myNbLinEdge = new QLabel( this );
+ myNbQuadEdge = new QLabel( this );
+
+ _SEPARATOR(this);
+
+ // faces
+ (new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), this))->setFont( bold );
+ myNbFace = new QLabel( this );
+ myNbLinFace = new QLabel( this );
+ myNbQuadFace = new QLabel( this );
+ // triangles
+ new QLabel(COLONIZE(tr("SMESH_MESHINFO_TRIANGLES")), this );
+ myNbTrai = new QLabel( this );
+ myNbLinTrai = new QLabel( this );
+ myNbQuadTrai = new QLabel( this );
+ // quadrangles
+ new QLabel(COLONIZE(tr("SMESH_MESHINFO_QUADRANGLES")), this );
+ myNbQuad = new QLabel( this );
+ myNbLinQuad = new QLabel( this );
+ myNbQuadQuad = new QLabel( this );
+ // poligones
+ new QLabel(COLONIZE(tr("SMESH_MESHINFO_POLYGONES")), this );
+ myNbPolyg = new QLabel( this );
+ new QLabel("",this );
+ new QLabel("", this );
+
+ _SEPARATOR(this);
+
+ // volumes
+ (new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), this))->setFont( bold );
+ myNbVolum = new QLabel( this );
+ myNbLinVolum = new QLabel( this );
+ myNbQuadVolum = new QLabel( this );
+ // tetras
+ new QLabel(COLONIZE(tr("SMESH_MESHINFO_TETRAS")), this );
+ myNbTetra = new QLabel( this );
+ myNbLinTetra = new QLabel( this );
+ myNbQuadTetra = new QLabel( this );
+ // hexas
+ new QLabel(COLONIZE(tr("SMESH_MESHINFO_HEXAS")), this );
+ myNbHexa = new QLabel( this );
+ myNbLinHexa = new QLabel( this );
+ myNbQuadHexa = new QLabel( this );
+ // pyras
+ new QLabel(COLONIZE(tr("SMESH_MESHINFO_PYRAS")), this );
+ myNbPyra = new QLabel( this );
+ myNbLinPyra = new QLabel( this );
+ myNbQuadPyra = new QLabel( this );
+ // prisms
+ new QLabel(COLONIZE(tr("SMESH_MESHINFO_PRISMS")), this );
+ myNbPrism = new QLabel( this );
+ myNbLinPrism = new QLabel( this );
+ myNbQuadPrism = new QLabel( this );
+ // polyedres
+ new QLabel(COLONIZE(tr("SMESH_MESHINFO_POLYEDRES")), this );
+ myNbPolyh = new QLabel( this );
+ new QLabel("", this );
+ new QLabel("", this );
+ }
+ else
+ {
+ // nodes
+ new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), this );
+ myNbNode = new QLabel( this );
+ new QLabel(this);
+ new QLabel(this);
+
+ // edges
+ new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), this );
+ myNbEdge = new QLabel( this );
+ myNbLinEdge = new QLabel( this );
+ myNbQuadEdge = new QLabel( this );
+
+ // faces
+ new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), this);
+ myNbFace = new QLabel( this );
+ myNbLinFace = new QLabel( this );
+ myNbQuadFace = new QLabel( this );
+
+ // volumes
+ new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), this);
+ myNbVolum = new QLabel( this );
+ myNbLinVolum = new QLabel( this );
+ myNbQuadVolum = new QLabel( this );
+ }
+}
+
+// =========================================================================================
+/*!
+ * \brief Set mesh info
+ */
+// =========================================================================================
+
+void SMESHGUI_MeshInfosBox::SetInfoByMesh(SMESH::SMESH_Mesh_var mesh)
+{
+ const SMESH::ElementOrder lin = SMESH::ORDER_LINEAR;
+ int nbTot, nbLin;
+
+ // nodes
+ myNbNode ->setText( QString("%1").arg( mesh->NbNodes() ));
+
+ // edges
+ nbTot = mesh->NbEdges(), nbLin = mesh->NbEdgesOfOrder(lin);
+ myNbEdge ->setText( QString("%1").arg( nbTot ));
+ myNbLinEdge ->setText( QString("%1").arg( nbLin ));
+ myNbQuadEdge ->setText( QString("%1").arg( nbTot - nbLin ));
+
+ // faces
+ nbTot = mesh->NbFaces(), nbLin = mesh->NbFacesOfOrder(lin);
+ myNbFace ->setText( QString("%1").arg( nbTot ));
+ myNbLinFace ->setText( QString("%1").arg( nbLin ));
+ myNbQuadFace ->setText( QString("%1").arg( nbTot - nbLin ));
+
+ // volumes
+ nbTot = mesh->NbVolumes(), nbLin = mesh->NbVolumesOfOrder(lin);
+ myNbVolum ->setText( QString("%1").arg( nbTot ));
+ myNbLinVolum ->setText( QString("%1").arg( nbLin ));
+ myNbQuadVolum->setText( QString("%1").arg( nbTot - nbLin ));
+
+ if ( myFull )
+ {
+ // triangles
+ nbTot = mesh->NbTriangles(), nbLin = mesh->NbTrianglesOfOrder(lin);
+ myNbTrai ->setText( QString("%1").arg( nbTot ));
+ myNbLinTrai ->setText( QString("%1").arg( nbLin ));
+ myNbQuadTrai ->setText( QString("%1").arg( nbTot - nbLin ));
+ // quadrangles
+ nbTot = mesh->NbQuadrangles(), nbLin = mesh->NbQuadranglesOfOrder(lin);
+ myNbQuad ->setText( QString("%1").arg( nbTot ));
+ myNbLinQuad ->setText( QString("%1").arg( nbLin ));
+ myNbQuadQuad ->setText( QString("%1").arg( nbTot - nbLin ));
+ // poligones
+ myNbPolyg ->setText( QString("%1").arg( mesh->NbPolygons() ));
+
+ // tetras
+ nbTot = mesh->NbTetras(), nbLin = mesh->NbTetrasOfOrder(lin);
+ myNbTetra ->setText( QString("%1").arg( nbTot ));
+ myNbLinTetra ->setText( QString("%1").arg( nbLin ));
+ myNbQuadTetra->setText( QString("%1").arg( nbTot - nbLin ));
+ // hexas
+ nbTot = mesh->NbHexas(), nbLin = mesh->NbHexasOfOrder(lin);
+ myNbHexa ->setText( QString("%1").arg( nbTot ));
+ myNbLinHexa ->setText( QString("%1").arg( nbLin ));
+ myNbQuadHexa ->setText( QString("%1").arg( nbTot - nbLin ));
+ // pyras
+ nbTot = mesh->NbPyramids(), nbLin = mesh->NbPyramidsOfOrder(lin);
+ myNbPyra ->setText( QString("%1").arg( nbTot ));
+ myNbLinPyra ->setText( QString("%1").arg( nbLin ));
+ myNbQuadPyra ->setText( QString("%1").arg( nbTot - nbLin ));
+ // prisms
+ nbTot = mesh->NbPrisms(), nbLin = mesh->NbPrismsOfOrder(lin);
+ myNbPrism ->setText( QString("%1").arg( nbTot ));
+ myNbLinPrism ->setText( QString("%1").arg( nbLin ));
+ myNbQuadPrism->setText( QString("%1").arg( nbTot - nbLin ));
+ // polyedres
+ myNbPolyh ->setText( QString("%1").arg( mesh->NbPolyhedrons() ));
+ }
+}
+
// =========================================================================================
/*!
* \brief Dialog to compute a mesh and show computation errors
*/
//=======================================================================
-SMESHGUI_ComputeDlg::SMESHGUI_ComputeDlg(): SMESHGUI_Dialog( 0, false, true, OK | Help )
+SMESHGUI_ComputeDlg::SMESHGUI_ComputeDlg(): SMESHGUI_Dialog( 0, false, true, OK/* | Help*/ )
{
QVBoxLayout* aDlgLay = new QVBoxLayout (mainFrame(), 0, SPACING);
aRBut->setPixmap(iconCompute);
aRBut->setChecked(TRUE);
+ // Mesh name
+
+ QHGroupBox* nameBox = new QHGroupBox(tr("SMESH_MESHINFO_NAME"), aFrame );
+ myMeshName = new QLabel(nameBox);
+
// Mesh Info
- QGroupBox* infoGrp = new QGroupBox( 2, Qt::Horizontal,
- tr("SMESH_MESHINFO_TITLE"), aFrame, "infoGrp" );
- QLabel* nodeLabel = new QLabel(tr("SMESH_MESHINFO_NODES"), infoGrp );
- myNbNodesLabel = new QLabel("0", infoGrp );
- QLabel* edgeLabel = new QLabel(tr("SMESH_MESHINFO_EDGES"), infoGrp );
- myNbEdgesLabel = new QLabel("0", infoGrp );
- QLabel* faceLabel = new QLabel(tr("SMESH_MESHINFO_FACES"), infoGrp);
- myNbFacesLabel = new QLabel("0", infoGrp );
- QLabel* volumeLbl = new QLabel(tr("SMESH_MESHINFO_VOLUMES"), infoGrp);
- myNbVolumLabel = new QLabel("0", infoGrp );
+ myBriefInfo = new SMESHGUI_MeshInfosBox(false, aFrame);
+ myFullInfo = new SMESHGUI_MeshInfosBox(true, aFrame);
// errors
- QGroupBox* errorGrp = new QGroupBox(tr("ERRORS"), aFrame, "errorGrBox");
- myTable = new QTable( 1, NB_COLUMNS, errorGrp, "myTable");
- myShowBtn = new QPushButton(tr("SHOW_SHAPE"), errorGrp, "myShowBtn");
- myPublishBtn = new QPushButton(tr("PUBLISH_SHAPE"), errorGrp, "myPublishBtn");
+ myErrorGroup = new QGroupBox(tr("ERRORS"), aFrame, "errorGrBox");
+ myTable = new QTable( 1, NB_COLUMNS, myErrorGroup, "myTable");
+ myShowBtn = new QPushButton(tr("SHOW_SHAPE"), myErrorGroup, "myShowBtn");
+ myPublishBtn = new QPushButton(tr("PUBLISH_SHAPE"), myErrorGroup, "myPublishBtn");
myTable->setReadOnly( TRUE );
myTable->hideColumn( COL_PUBLISHED );
myTable->horizontalHeader()->setLabel( col, header );
}
- errorGrp->setColumnLayout(0, Qt::Vertical);
- errorGrp->layout()->setSpacing(0);
- errorGrp->layout()->setMargin(0);
- QGridLayout* grpLayout = new QGridLayout(errorGrp->layout());
+ myErrorGroup->setColumnLayout(0, Qt::Vertical);
+ myErrorGroup->layout()->setSpacing(0);
+ myErrorGroup->layout()->setMargin(0);
+ QGridLayout* grpLayout = new QGridLayout(myErrorGroup->layout());
grpLayout->setAlignment(Qt::AlignTop);
grpLayout->setSpacing(SPACING);
grpLayout->setMargin(MARGIN);
grpLayout->addWidget ( myPublishBtn, 1, 1 );
grpLayout->setRowStretch( 2, 1 );
+ // Memory Lack Label
+
+ myMemoryLackGroup = new QVGroupBox(tr("ERRORS"), aFrame, "memlackGrBox");
+ QLabel* memLackLabel = new QLabel(tr("MEMORY_LACK"), myMemoryLackGroup);
+ QFont bold = memLackLabel->font(); bold.setBold(true);
+ memLackLabel->setFont( bold );
+ memLackLabel->setMinimumWidth(300);
+
+ // add all widgets to aFrame
QVBoxLayout* aLay = new QVBoxLayout(aFrame);
aLay->addWidget( aPixGrp );
- aLay->addWidget( infoGrp );
- aLay->addWidget( errorGrp );
- aLay->setStretchFactor( errorGrp, 1 );
+ aLay->addWidget( nameBox );
+ aLay->addWidget( myBriefInfo );
+ aLay->addWidget( myFullInfo );
+ aLay->addWidget( myErrorGroup );
+ aLay->addWidget( myMemoryLackGroup );
+ aLay->setStretchFactor( myErrorGroup, 1 );
return aFrame;
}
-//================================================================================
-/*!
- * \brief Show mesh info
- */
-//================================================================================
-
-void SMESHGUI_ComputeDlg::SetMeshInfo(int nbNodes, int nbEdges, int nbFaces, int nbVolums)
-{
- myNbNodesLabel->setText(QString("%1").arg(nbNodes));
- myNbEdgesLabel->setText(QString("%1").arg(nbEdges));
- myNbFacesLabel->setText(QString("%1").arg(nbFaces));
- myNbVolumLabel->setText(QString("%1").arg(nbVolums));
-}
//================================================================================
/*!
{
myDlg = new SMESHGUI_ComputeDlg;
myTShapeDisplayer = new TShapeDisplayer();
+ myHelpFileName = "/files/about_meshes.htm";
// connect signals and slots
connect(myDlg->myShowBtn, SIGNAL (clicked()), SLOT(onPreviewShape()));
// COMPUTE MESH
- bool computeFailed = true;
+ bool computeFailed = true, memoryLack = false;
int nbNodes = 0, nbEdges = 0, nbFaces = 0, nbVolums = 0;
LightApp_SelectionMgr *Sel = selectionMgr();
Handle(SALOME_InteractiveObject) IObject = selected.First();
aMesh = SMESH::GetMeshByIO(IObject);
- if (!aMesh->_is_nil()) {
+ if (!aMesh->_is_nil())
+ {
+ MemoryReserve aMemoryReserve;
+ _PTR(SObject) aMeshSObj = SMESH::FindSObject(aMesh);
myMainShape = aMesh->GetShapeToMesh();
- if ( !myMainShape->_is_nil() ) {
+ if ( !myMainShape->_is_nil() && aMeshSObj )
+ {
+ myDlg->myMeshName->setText( aMeshSObj->GetName() );
SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen();
SMESH::algo_error_array_var errors = gen->GetAlgoState(aMesh,myMainShape);
if ( errors->length() > 0 ) {
onCancel();
return;
}
+ SUIT_OverrideCursor aWaitCursor;
try {
- if (gen->Compute(aMesh, myMainShape)) {
+ if (gen->Compute(aMesh, myMainShape))
computeFailed = false;
- }
- else {
- anErrors = gen->GetComputeErrors( aMesh, myMainShape );
-// if ( anErrors->length() == 0 ) {
-// SUIT_MessageBox::warn1(desktop(),
-// tr("SMESH_WRN_WARNING"),
-// tr("SMESH_WRN_COMPUTE_FAILED"),
-// tr("SMESH_BUT_OK"));
-// onCancel();
-// return;
-// }
- }
- nbNodes = aMesh->NbNodes();
- nbEdges = aMesh->NbEdges();
- nbFaces = aMesh->NbFaces();
- nbVolums = aMesh->NbVolumes();
- _PTR(SObject) aMeshSObj = SMESH::FindSObject(aMesh);
- SMESH::ModifiedMesh(aMeshSObj, !computeFailed, nbNodes == 0);
}
catch(const SALOME::SALOME_Exception & S_ex){
- SalomeApp_Tools::QtCatchCorbaException(S_ex);
+ memoryLack = true;
+ //SalomeApp_Tools::QtCatchCorbaException(S_ex);
+ }
+ try {
+ anErrors = gen->GetComputeErrors( aMesh, myMainShape );
+ // if ( anErrors->length() == 0 ) {
+ // SUIT_MessageBox::warn1(desktop(),
+ // tr("SMESH_WRN_WARNING"),
+ // tr("SMESH_WRN_COMPUTE_FAILED"),
+ // tr("SMESH_BUT_OK"));
+ // onCancel();
+ // return;
+ // }
+ // check if there are memory problems
+ for ( int i = 0; i < anErrors->length() && !memoryLack; ++i )
+ memoryLack = ( anErrors[ i ].code == SMESH::COMPERR_MEMORY_PB );
}
- update( UF_ObjBrowser | UF_Model );
-
- if ( getSMESHGUI()->automaticUpdate() ) {
- SVTK_ViewWindow* aVTKView = SMESH::GetViewWindow(getSMESHGUI(), true);
- if (aVTKView) {
- int anId = study()->id();
- TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId, IObject->getEntry());
- if (aVisualObj) {
- aVisualObj->Update();
- SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
- if (!anActor) {
- anActor = SMESH::CreateActor(studyDS(), IObject->getEntry());
- if (anActor) {
- SMESH::DisplayActor(aVTKView, anActor); //apo
- SMESH::FitAll();
+ catch(const SALOME::SALOME_Exception & S_ex){
+ memoryLack = true;
+ }
+
+ // NPAL16631: if ( !memoryLack )
+ {
+ SMESH::ModifiedMesh(aMeshSObj, !computeFailed, aMesh->NbNodes() == 0);
+ update( UF_ObjBrowser | UF_Model );
+
+ // SHOW MESH
+ // NPAL16631: if ( getSMESHGUI()->automaticUpdate() ) {
+ if ( !memoryLack && getSMESHGUI()->automaticUpdate() ) // NPAL16631
+ {
+ try {
+ SVTK_ViewWindow* aVTKView = SMESH::GetViewWindow(getSMESHGUI(), true);
+ if (aVTKView) {
+ int anId = study()->id();
+ TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId, IObject->getEntry());
+ if (aVisualObj) {
+ aVisualObj->Update();
+ SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
+ if (!anActor) {
+ anActor = SMESH::CreateActor(studyDS(), IObject->getEntry());
+ if (anActor) {
+ SMESH::DisplayActor(aVTKView, anActor); //apo
+ SMESH::FitAll();
+ }
+ }
+ SMESH::RepaintCurrentView();
+ Sel->setSelectedObjects( selected );
}
}
- SMESH::RepaintCurrentView();
- Sel->setSelectedObjects( selected );
+ }
+ catch (...) {
+ memoryLack = true;
}
}
}
}
}
-
- // SHOW Mesh Infos
-
- myDlg->SetMeshInfo( nbNodes, nbEdges, nbFaces, nbVolums);
+ else {
+ SUIT_MessageBox::warn1(desktop(),
+ tr("SMESH_WRN_WARNING"),
+ tr("SMESH_WRN_NO_AVAILABLE_DATA"),
+ tr("SMESH_BUT_OK"));
+ onCancel();
+ return;
+ }
myDlg->setCaption(tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED"));
+ myDlg->myMemoryLackGroup->hide();
// SHOW ERRORS
bool noError = ( !anErrors.operator->() || anErrors->length() == 0 );
- QTable* tbl = myDlg->myTable;
-
- if ( noError )
+ if ( memoryLack )
+ {
+ myDlg->myMemoryLackGroup->show();
+ myDlg->myFullInfo->hide();
+ myDlg->myBriefInfo->hide();
+ myDlg->myErrorGroup->hide();
+ }
+ else if ( noError )
{
- tbl->setNumRows(0);
+ myDlg->myFullInfo->SetInfoByMesh( aMesh );
+ myDlg->myFullInfo->show();
+ myDlg->myBriefInfo->hide();
+ myDlg->myErrorGroup->hide();
}
else
{
+ QTable* tbl = myDlg->myTable;
+ myDlg->myBriefInfo->SetInfoByMesh( aMesh );
+ myDlg->myBriefInfo->show();
+ myDlg->myFullInfo->hide();
+ myDlg->myErrorGroup->show();
+
// fill table of errors
tbl->setNumRows( anErrors->length() );
bool hasShape = aMesh->HasShapeToMesh();
tbl->setCurrentCell(0,0);
currentCellChanged(); // to update buttons
}
-
myDlg->show();
}
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
SALOMEDS::Study_var study = SMESHGUI::GetSMESHGen()->GetCurrentStudy();
- int nbSel = table()->numSelections();
- for ( int i = 0; i < nbSel; ++i ) {
- QTableSelection selected = table()->selection(i);
- if ( !selected.isActive() ) continue;
- for ( int row = selected.topRow(); row <= selected.bottomRow(); ++row )
+ list< int > rows;
+ list< int >::iterator row;
+ getSelectedRows( table(), rows );
+ for ( row = rows.begin(); row != rows.end(); ++row )
+ {
+ int curSub = table()->text(*row, COL_SHAPEID).toInt();
+ GEOM::GEOM_Object_var shape = getSubShape( curSub, myMainShape );
+ if ( !shape->_is_nil() && ! getSubShapeSO( curSub, myMainShape ))
{
- bool isPublished = ( !table()->text(row, COL_PUBLISHED).isEmpty() );
- if ( !isPublished ) {
- int curSub = table()->text(row, COL_SHAPEID).toInt();
- GEOM::GEOM_Object_var shape = getSubShape( curSub, myMainShape );
- if ( !shape->_is_nil() && ! getSubShapeSO( curSub, myMainShape ))
- {
- QString name = GEOMBase::GetDefaultName( shapeTypeName( shape, "ERROR_SHAPE" ));
- SALOMEDS::SObject_var so = geomGen->AddInStudy( study, shape, name, myMainShape);
- if ( !so->_is_nil() ) {
- table()->setText( row, COL_SHAPE, so->GetName() );
- table()->setText( row, COL_PUBLISHED, so->GetID() );
+ if ( !getSubShapeSO( 1, myMainShape )) // the main shape not published
+ {
+ QString name = GEOMBase::GetDefaultName( shapeTypeName( myMainShape, "MAIN_SHAPE" ));
+ SALOMEDS::SObject_var so =
+ geomGen->AddInStudy( study, myMainShape, name, GEOM::GEOM_Object::_nil());
+ // look for myMainShape in the table
+ for ( int r = 0, nr = table()->numRows(); r < nr; ++r ) {
+ if ( table()->text(r, COL_SHAPEID) == "1" ) {
+ if ( so->_is_nil() ) {
+ table()->setText( r, COL_SHAPE, so->GetName() );
+ table()->setText( r, COL_PUBLISHED, so->GetID() );
+ }
+ break;
}
}
+ if ( curSub == 1 ) continue;
+ }
+ QString name = GEOMBase::GetDefaultName( shapeTypeName( shape, "ERROR_SHAPE" ));
+ SALOMEDS::SObject_var so = geomGen->AddInStudy( study, shape, name, myMainShape);
+ if ( !so->_is_nil() ) {
+ table()->setText( *row, COL_SHAPE, so->GetName() );
+ table()->setText( *row, COL_PUBLISHED, so->GetID() );
}
}
}
myTShapeDisplayer->SetVisibility( false );
bool publishEnable = 0, showEnable = 0, showOnly = 1;
- int nbSel = table()->numSelections();
- for ( int i = 0; i < nbSel; ++i )
+ list< int > rows;
+ list< int >::iterator row;
+ getSelectedRows( table(), rows );
+ for ( row = rows.begin(); row != rows.end(); ++row )
{
- QTableSelection selected = table()->selection(i);
- if ( !selected.isActive() ) continue;
- for ( int row = selected.topRow(); row <= selected.bottomRow(); ++row )
- {
- bool hasData = ( !table()->text(row, COL_SHAPE).isEmpty() );
- bool isPublished = ( !table()->text(row, COL_PUBLISHED).isEmpty() );
- if ( hasData && !isPublished )
- publishEnable = true;
-
- int curSub = table()->text(row, COL_SHAPEID).toInt();
- bool prsReady = myTShapeDisplayer->HasReadyActorsFor( curSub, myMainShape );
- if ( prsReady ) {
- myTShapeDisplayer->Show( curSub, myMainShape, showOnly );
- showOnly = false;
- }
- else {
- showEnable = true;
- }
+ bool hasData = ( !table()->text(*row, COL_SHAPE).isEmpty() );
+ bool isPublished = ( !table()->text(*row, COL_PUBLISHED).isEmpty() );
+ if ( hasData && !isPublished )
+ publishEnable = true;
+
+ int curSub = table()->text(*row, COL_SHAPEID).toInt();
+ bool prsReady = myTShapeDisplayer->HasReadyActorsFor( curSub, myMainShape );
+ if ( prsReady ) {
+ myTShapeDisplayer->Show( curSub, myMainShape, showOnly );
+ showOnly = false;
+ }
+ else {
+ showEnable = true;
}
}
myDlg->myPublishBtn->setEnabled( publishEnable );
if ( myTShapeDisplayer )
{
SUIT_OverrideCursor aWaitCursor;
+ list< int > rows;
+ list< int >::iterator row;
+ getSelectedRows( table(), rows );
+
bool showOnly = true;
- int nbSel = table()->numSelections();
- for ( int i = 0; i < nbSel; ++i )
+ for ( row = rows.begin(); row != rows.end(); ++row )
{
- QTableSelection selected = table()->selection(i);
- if ( !selected.isActive() ) continue;
- for ( int row = selected.topRow(); row <= selected.bottomRow(); ++row )
- {
- int curSub = table()->text(row, COL_SHAPEID).toInt();
- if ( curSub > 0 ) {
- myTShapeDisplayer->Show( curSub, myMainShape, showOnly );
- showOnly = false;
- }
+ int curSub = table()->text(*row, COL_SHAPEID).toInt();
+ if ( curSub > 0 ) {
+ myTShapeDisplayer->Show( curSub, myMainShape, showOnly );
+ showOnly = false;
}
}
currentCellChanged(); // to update buttons
//================================================================================
/*!
* \brief Destructor
-*/
+ */
//================================================================================
SMESHGUI_ComputeOp::~SMESHGUI_ComputeOp()