X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FOperationGUI%2FOperationGUI_PartitionDlg.cxx;h=9c787d2cef546053ee9f21e21665a5b2a9b1fd78;hb=8cee57a1875ffe457096f1f098d6378eb337d2e1;hp=a566b5664b981f6ecc0a01c03eecc6260ab91aa2;hpb=8491fee81c315f2063e1753ea7b2cd5bc90e6a14;p=modules%2Fgeom.git diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.cxx b/src/OperationGUI/OperationGUI_PartitionDlg.cxx index a566b5664..9c787d2ce 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.cxx +++ b/src/OperationGUI/OperationGUI_PartitionDlg.cxx @@ -24,7 +24,6 @@ // #include "OperationGUI_PartitionDlg.h" -#include "OperationGUI_MaterialDlg.h" #include #include @@ -63,7 +62,7 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( GeometryGUI* theGeometryGU mainFrame()->RadioButton3->close(); // Full partition (contains half-space partition) - GroupPoints = new DlgRef_2Sel1List( centralWidget() ); + GroupPoints = new DlgRef_2Sel1List1Check( centralWidget() ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECT" ) ); @@ -72,6 +71,9 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( GeometryGUI* theGeometryGU GroupPoints->PushButton2->setIcon( image2 ); GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); + GroupPoints->LineEdit1->setEnabled(true); + GroupPoints->LineEdit2->setEnabled(false); + GroupPoints->CheckButton1->setText( tr( "GEOM_KEEP_NONLIMIT_SHAPES" ) ); QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); layout->setMargin( 0 ); layout->setSpacing( 6 ); @@ -79,7 +81,7 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( GeometryGUI* theGeometryGU /***************************************************************/ - setHelpFileName( "partition.htm" ); + setHelpFileName( "partition_page.html" ); Init(); } @@ -117,7 +119,10 @@ void OperationGUI_PartitionDlg::Init() GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_WIRE" ) ); GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_EDGE" ) ); GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_VERTEX" ) ); + GroupPoints->CheckButton1->setChecked( false ); + mainFrame()->GroupBoxPublish->show(); + /* signals and slots connections */ connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); @@ -131,13 +136,14 @@ void OperationGUI_PartitionDlg::Init() connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupPoints->ComboBox1, SIGNAL( activated( int ) ), this, SLOT( ComboTextChanged() ) ); - - connect( myGeomGUI->getApp()->selectionMgr(), + + connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); initName( tr( "GEOM_PARTITION" ) ); ConstructorsClicked( 0 ); + GroupPoints->PushButton1->click(); } @@ -162,14 +168,21 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId ) GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECT" ) ); GroupPoints->TextLabel3->show(); GroupPoints->ComboBox1->show(); - GroupPoints->ComboBox1->setCurrentIndex( 0 ); + GroupPoints->CheckButton1->show(); + GroupPoints->PushButton1->setDown( true ); + GroupPoints->PushButton2->setDown( false ); + GroupPoints->LineEdit1->setEnabled(true); + GroupPoints->LineEdit2->setEnabled(false); break; case 1: /*Half-space partition */ GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION_HALFSPACE" ) ); GroupPoints->TextLabel3->hide(); GroupPoints->ComboBox1->hide(); GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE" ) ); + GroupPoints->CheckButton1->hide(); + GroupPoints->PushButton1->setDown( true ); + GroupPoints->LineEdit1->setEnabled(true); break; } @@ -222,7 +235,11 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument() myEditCurrentArgument->setText( "" ); QString aString = ""; - int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true ); + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); + + int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true); if ( nbSel < 1 ) { if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { @@ -235,7 +252,7 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument() // One and only one plane can be selected - if ( getConstructorId() == 1 && + if ( getConstructorId() == 1 && myEditCurrentArgument == GroupPoints->LineEdit2 && nbSel != 1 ) { myListTools.length( 0 ); @@ -243,13 +260,13 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument() } if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { - GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListShapes, true ); + GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListShapes, true); myListMaterials.length( 0 ); if ( !myListShapes.length() ) return; } else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { - GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListTools, true ); + GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListTools, true); if ( !myListTools.length() ) return; } @@ -266,10 +283,18 @@ void OperationGUI_PartitionDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if ( send == GroupPoints->PushButton1 ) + if ( send == GroupPoints->PushButton1 ) { myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->PushButton2->setDown(false); + GroupPoints->LineEdit1->setEnabled(true); + GroupPoints->LineEdit2->setEnabled(false); + } else if ( send == GroupPoints->PushButton2 ) { + myGeomGUI->getApp()->selectionMgr()->clearSelected(); //clear prewious selection myEditCurrentArgument = GroupPoints->LineEdit2; + GroupPoints->PushButton1->setDown(false); + GroupPoints->LineEdit1->setEnabled(false); + GroupPoints->LineEdit2->setEnabled(true); if ( getConstructorId() == 1 ) globalSelection( GEOM_PLANE ); } @@ -278,6 +303,7 @@ void OperationGUI_PartitionDlg::SetEditCurrentArgument() myEditCurrentArgument->setFocus(); SelectionIntoArgument(); + send->setDown(true); } @@ -356,15 +382,25 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects ) int aLimit = GetLimit(); int aConstructorId = getConstructorId(); + int aKeepNonlimitShapes = 0; - if ( aConstructorId == 1 ) + if ( aConstructorId == 1 ) { aLimit = GEOM::SHAPE; + } + else { + if ( GroupPoints->CheckButton1->isChecked() ) { + aKeepNonlimitShapes = 1; + } + else { + aKeepNonlimitShapes = 0; + } + } if ( isValid( msg ) ) { - anObj = GEOM::GEOM_IBooleanOperations::_narrow(getOperation())-> - MakePartition(myListShapes, myListTools, - myListKeepInside, myListRemoveInside, - aLimit, false, myListMaterials); + anObj = GEOM::GEOM_IBooleanOperations::_narrow( getOperation() )-> + MakePartition( myListShapes, myListTools, + myListKeepInside, myListRemoveInside, + aLimit, false, myListMaterials, aKeepNonlimitShapes ); res = true; } @@ -374,17 +410,21 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects ) return res; } - //================================================================================= -// function : closeEvent +// function : restoreSubShapes // purpose : //================================================================================= -void OperationGUI_PartitionDlg::closeEvent( QCloseEvent* e ) +void OperationGUI_PartitionDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject ) { - GEOMBase_Skeleton::closeEvent( e ); + if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) { + // empty list of arguments means that all arguments should be restored + getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(), + /*theFindMethod=*/GEOM::FSM_GetInPlaceByHistory, + /*theInheritFirstArg=*/myListShapes.length() == 1 ); // ? false + } } - //======================================================================= //function : ComboTextChanged //purpose : @@ -400,7 +440,6 @@ void OperationGUI_PartitionDlg::ComboTextChanged() //GroupPoints->PushButton4->setEnabled(IsEnabled); } - //================================================================================= // function : GetLimit() // purpose :