mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-15 12:40:37 +05:00
PAL13330( When mesh generation does not success, trace where )
publish submesh even if a main shape not bublished
This commit is contained in:
parent
7ddeb6ccec
commit
d289bea8cf
@ -393,6 +393,24 @@ namespace SMESH {
|
|||||||
}
|
}
|
||||||
return text;
|
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
|
} // namespace SMESH
|
||||||
|
|
||||||
|
|
||||||
@ -691,25 +709,37 @@ void SMESHGUI_ComputeOp::onPublishShape()
|
|||||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
||||||
SALOMEDS::Study_var study = SMESHGUI::GetSMESHGen()->GetCurrentStudy();
|
SALOMEDS::Study_var study = SMESHGUI::GetSMESHGen()->GetCurrentStudy();
|
||||||
|
|
||||||
int nbSel = table()->numSelections();
|
list< int > rows;
|
||||||
for ( int i = 0; i < nbSel; ++i ) {
|
list< int >::iterator row;
|
||||||
QTableSelection selected = table()->selection(i);
|
getSelectedRows( table(), rows );
|
||||||
if ( !selected.isActive() ) continue;
|
for ( row = rows.begin(); row != rows.end(); ++row )
|
||||||
for ( int row = selected.topRow(); row <= selected.bottomRow(); ++row )
|
|
||||||
{
|
{
|
||||||
bool isPublished = ( !table()->text(row, COL_PUBLISHED).isEmpty() );
|
int curSub = table()->text(*row, COL_SHAPEID).toInt();
|
||||||
if ( !isPublished ) {
|
|
||||||
int curSub = table()->text(row, COL_SHAPEID).toInt();
|
|
||||||
GEOM::GEOM_Object_var shape = getSubShape( curSub, myMainShape );
|
GEOM::GEOM_Object_var shape = getSubShape( curSub, myMainShape );
|
||||||
if ( !shape->_is_nil() && ! getSubShapeSO( curSub, myMainShape ))
|
if ( !shape->_is_nil() && ! getSubShapeSO( curSub, myMainShape ))
|
||||||
{
|
{
|
||||||
|
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" ));
|
QString name = GEOMBase::GetDefaultName( shapeTypeName( shape, "ERROR_SHAPE" ));
|
||||||
SALOMEDS::SObject_var so = geomGen->AddInStudy( study, shape, name, myMainShape);
|
SALOMEDS::SObject_var so = geomGen->AddInStudy( study, shape, name, myMainShape);
|
||||||
if ( !so->_is_nil() ) {
|
if ( !so->_is_nil() ) {
|
||||||
table()->setText( row, COL_SHAPE, so->GetName() );
|
table()->setText( *row, COL_SHAPE, so->GetName() );
|
||||||
table()->setText( row, COL_PUBLISHED, so->GetID() );
|
table()->setText( *row, COL_PUBLISHED, so->GetID() );
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -728,19 +758,17 @@ void SMESHGUI_ComputeOp::currentCellChanged()
|
|||||||
myTShapeDisplayer->SetVisibility( false );
|
myTShapeDisplayer->SetVisibility( false );
|
||||||
|
|
||||||
bool publishEnable = 0, showEnable = 0, showOnly = 1;
|
bool publishEnable = 0, showEnable = 0, showOnly = 1;
|
||||||
int nbSel = table()->numSelections();
|
list< int > rows;
|
||||||
for ( int i = 0; i < nbSel; ++i )
|
list< int >::iterator row;
|
||||||
|
getSelectedRows( table(), rows );
|
||||||
|
for ( row = rows.begin(); row != rows.end(); ++row )
|
||||||
{
|
{
|
||||||
QTableSelection selected = table()->selection(i);
|
bool hasData = ( !table()->text(*row, COL_SHAPE).isEmpty() );
|
||||||
if ( !selected.isActive() ) continue;
|
bool isPublished = ( !table()->text(*row, COL_PUBLISHED).isEmpty() );
|
||||||
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 )
|
if ( hasData && !isPublished )
|
||||||
publishEnable = true;
|
publishEnable = true;
|
||||||
|
|
||||||
int curSub = table()->text(row, COL_SHAPEID).toInt();
|
int curSub = table()->text(*row, COL_SHAPEID).toInt();
|
||||||
bool prsReady = myTShapeDisplayer->HasReadyActorsFor( curSub, myMainShape );
|
bool prsReady = myTShapeDisplayer->HasReadyActorsFor( curSub, myMainShape );
|
||||||
if ( prsReady ) {
|
if ( prsReady ) {
|
||||||
myTShapeDisplayer->Show( curSub, myMainShape, showOnly );
|
myTShapeDisplayer->Show( curSub, myMainShape, showOnly );
|
||||||
@ -750,7 +778,6 @@ void SMESHGUI_ComputeOp::currentCellChanged()
|
|||||||
showEnable = true;
|
showEnable = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
myDlg->myPublishBtn->setEnabled( publishEnable );
|
myDlg->myPublishBtn->setEnabled( publishEnable );
|
||||||
myDlg->myShowBtn->setEnabled( showEnable );
|
myDlg->myShowBtn->setEnabled( showEnable );
|
||||||
}
|
}
|
||||||
@ -766,21 +793,19 @@ void SMESHGUI_ComputeOp::onPreviewShape()
|
|||||||
if ( myTShapeDisplayer )
|
if ( myTShapeDisplayer )
|
||||||
{
|
{
|
||||||
SUIT_OverrideCursor aWaitCursor;
|
SUIT_OverrideCursor aWaitCursor;
|
||||||
|
list< int > rows;
|
||||||
|
list< int >::iterator row;
|
||||||
|
getSelectedRows( table(), rows );
|
||||||
|
|
||||||
bool showOnly = true;
|
bool showOnly = true;
|
||||||
int nbSel = table()->numSelections();
|
for ( row = rows.begin(); row != rows.end(); ++row )
|
||||||
for ( int i = 0; i < nbSel; ++i )
|
|
||||||
{
|
{
|
||||||
QTableSelection selected = table()->selection(i);
|
int curSub = table()->text(*row, COL_SHAPEID).toInt();
|
||||||
if ( !selected.isActive() ) continue;
|
|
||||||
for ( int row = selected.topRow(); row <= selected.bottomRow(); ++row )
|
|
||||||
{
|
|
||||||
int curSub = table()->text(row, COL_SHAPEID).toInt();
|
|
||||||
if ( curSub > 0 ) {
|
if ( curSub > 0 ) {
|
||||||
myTShapeDisplayer->Show( curSub, myMainShape, showOnly );
|
myTShapeDisplayer->Show( curSub, myMainShape, showOnly );
|
||||||
showOnly = false;
|
showOnly = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
currentCellChanged(); // to update buttons
|
currentCellChanged(); // to update buttons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -788,7 +813,7 @@ void SMESHGUI_ComputeOp::onPreviewShape()
|
|||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Destructor
|
* \brief Destructor
|
||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
SMESHGUI_ComputeOp::~SMESHGUI_ComputeOp()
|
SMESHGUI_ComputeOp::~SMESHGUI_ComputeOp()
|
||||||
|
Loading…
Reference in New Issue
Block a user