+//=================================================================================
+// function : isValid
+// purpose :
+//=================================================================================
+bool OperationGUI_PartitionDlg::isValid (QString& )
+{
+ return (getConstructorId() == 0 ?
+ myListShapes.length() :
+ myListShapes.length() && myListTools.length());
+}
+
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool OperationGUI_PartitionDlg::execute (ObjectList& objects)
+{
+ bool res = false;
+ GEOM::GEOM_Object_var anObj;
+
+ GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
+
+ switch ( getConstructorId() ) {
+ case 0:
+ {
+ int aLimit = GetLimit();
+ int aKeepNonlimitShapes = GroupPoints->CheckButton1->isChecked();
+ bool aNoSelfIntersection = GroupPoints->CheckButton2->isChecked();
+
+ anObj = aNoSelfIntersection ?
+ anOper->MakePartitionNonSelfIntersectedShape(myListShapes, myListTools,
+ myListKeepInside, myListRemoveInside,
+ aLimit, false, myListMaterials, aKeepNonlimitShapes) :
+ anOper->MakePartition(myListShapes, myListTools,
+ myListKeepInside, myListRemoveInside,
+ aLimit, false, myListMaterials, aKeepNonlimitShapes);
+ res = true;
+ }
+ break;
+ case 1:
+ {
+ anObj = anOper->MakeHalfPartition( myListShapes[0].in(), myListTools[0].in() );
+ res = true;
+ }
+ break;
+ }
+
+ if ( !anObj->_is_nil() ) {
+ TopoDS_Shape aShape;
+ GEOMBase::GetShape( anObj, aShape, TopAbs_SHAPE );
+ TopoDS_Iterator It( aShape, Standard_True, Standard_True );
+ int nbSubshapes = 0;
+ for (; It.More(); It.Next())
+ nbSubshapes++;
+
+ if ( nbSubshapes )
+ objects.push_back( anObj._retn() );
+ else
+ SUIT_MessageBox::warning( this,
+ QObject::tr( "GEOM_ERROR" ),
+ QObject::tr( "GEOM_WRN_PARTITION_RESULT_EMPTY" ) );
+ }
+
+ return res;
+}
+
+//=================================================================================
+// function : restoreSubShapes
+// purpose :
+//=================================================================================
+void OperationGUI_PartitionDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy,
+ SALOMEDS::SObject_ptr theSObject )
+{
+ 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,
+ mainFrame()->CheckBoxAddPrefix->isChecked() ); // ? false
+ }
+}
+