-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// GEOM GEOMGUI : GUI for Geometry component
// File : OperationGUI_PartitionDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
+#include <SUIT_MessageBox.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
+
//=================================================================================
// class : OperationGUI_PartitionDlg()
// purpose : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the
GroupPoints = new DlgRef_2Sel1List1Check( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
- GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECT" ) );
+ GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECTS" ) );
GroupPoints->TextLabel3->setText( tr( "GEOM_RECONSTRUCTION_LIMIT" ) );
GroupPoints->PushButton1->setIcon( image2 );
GroupPoints->PushButton2->setIcon( image2 );
connect( GroupPoints->ComboBox1, SIGNAL( activated( int ) ), this, SLOT( ComboTextChanged() ) );
connect( myGeomGUI->getApp()->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_PARTITION" ) );
switch ( constructorId ) {
case 0: /*Full partition */
GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) );
- GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECT" ) );
+ GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECTS" ) );
GroupPoints->TextLabel3->show();
GroupPoints->ComboBox1->show();
GroupPoints->ComboBox1->setCurrentIndex( 0 );
myEditCurrentArgument->setFocus();
connect( myGeomGUI->getApp()->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
}
if ( !onAccept() )
return false;
+
initName();
- ConstructorsClicked( getConstructorId() );
+ // 0020854: EDF 1398 GEOM: Ergonomy of Partition GUI window
+ // ConstructorsClicked( getConstructorId() );
return true;
}
{
GEOMBase_Skeleton::ActivateThisDialog();
connect( myGeomGUI->getApp()->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
ConstructorsClicked( getConstructorId() );
}
bool OperationGUI_PartitionDlg::isValid( QString& )
{
return ( myListShapes.length() || myListTools.length() ||
- myListKeepInside.length() || myListRemoveInside.length() );
+ myListKeepInside.length() || myListRemoveInside.length() );
}
}
if ( isValid( msg ) ) {
- anObj = GEOM::GEOM_IBooleanOperations::_narrow( getOperation() )->
- MakePartition( myListShapes, myListTools,
- myListKeepInside, myListRemoveInside,
- aLimit, false, myListMaterials, aKeepNonlimitShapes );
+ GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
+ anObj = anOper->MakePartition( myListShapes, myListTools,
+ myListKeepInside, myListRemoveInside,
+ aLimit, false, myListMaterials, aKeepNonlimitShapes );
res = true;
}
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
+ 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;
}
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
+ /*theFindMethod=*/GEOM::FSM_GetInPlaceByHistory,
+ /*theInheritFirstArg=*/myListShapes.length() == 1,
+ mainFrame()->CheckBoxAddPrefix->isChecked() ); // ? false
}
}