-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011 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
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// GEOM GEOMGUI : GUI for Geometry component
// File : BuildGUI_ShellDlg.cxx
// Author : Damien COQUERET, Open CASCADE S.A.S.
myEditCurrentArgument = GroupShell->LineEdit1;
GroupShell->LineEdit1->setReadOnly( true );
- myOkFacesAndShells = false;
+ myFacesAndShells.clear();
TColStd_MapOfInteger aMap;
aMap.Add( GEOM_SHELL );
QList<int> aSubShapes;
aSubShapes.append( GEOM_FACE );
globalSelection( aMap, aSubShapes );
-
/* signals and slots connections */
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_SHELL" ) );
+ SelectionIntoArgument();
}
//=================================================================================
void BuildGUI_ShellDlg::ClickOnOk()
{
+ setIsApplyAndClose( true );
if ( ClickOnApply() )
ClickOnCancel();
}
void BuildGUI_ShellDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText( "" );
- QString aString;
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- SALOME_ListIO aSelList;
- aSelMgr->selectedObjects(aSelList);
-
- myOkFacesAndShells = false;
- int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);
- if ( nbSel == 0 )
- return;
- if ( nbSel != 1 )
- aString = QString( "%1_objects ").arg( nbSel );
+ QList<TopAbs_ShapeEnum> types;
+ types << TopAbs_FACE << TopAbs_SHELL << TopAbs_COMPOUND;
+ myFacesAndShells = getSelected( types, -1 );
- GEOMBase::ConvertListOfIOInListOfGO(aSelList, myFacesAndShells, true);
- if ( !myFacesAndShells.length() )
- return;
-
- myEditCurrentArgument->setText( aString );
- myOkFacesAndShells = true;
+ if ( !myFacesAndShells.isEmpty() ) {
+ QString aName = myFacesAndShells.count() > 1 ? QString( "%1_objects").arg( myFacesAndShells.count() ) : GEOMBase::GetName( myFacesAndShells[0].get() );
+ myEditCurrentArgument->setText( aName );
+ }
}
//=================================================================================
bool BuildGUI_ShellDlg::isValid( QString& )
{
- return myOkFacesAndShells;
+ return !myFacesAndShells.isEmpty();
}
//=================================================================================
bool BuildGUI_ShellDlg::execute( ObjectList& objects )
{
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
- GEOM::GEOM_Object_var anObj = anOper->MakeShell( myFacesAndShells );
+
+ GEOM::ListOfGO_var objlist = new GEOM::ListOfGO();
+ objlist->length( myFacesAndShells.count() );
+ for ( int i = 0; i < myFacesAndShells.count(); i++ )
+ objlist[i] = myFacesAndShells[i].copy();
+
+ GEOM::GEOM_Object_var anObj = anOper->MakeShell( objlist.in() );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );