-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 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
// 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.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
GroupPoints = new DlgRef_1SelExt( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_SEWING" ) );
- GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
+ GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPES" ) );
GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true );
QGridLayout* aLay = new QGridLayout( GroupPoints->Box );
aLay->setMargin( 0 ); aLay->setSpacing( 6 );
+ myAllowNonManifoldChk = new QCheckBox (tr("GEOM_ALLOW_NON_MANIFOLD"), GroupPoints->Box);
myTolEdt = new SalomeApp_DoubleSpinBox( GroupPoints->Box );
initSpinBox( myTolEdt, 0.0, 100.0, DEFAULT_TOLERANCE_VALUE, "len_tol_precision" );
myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE );
QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box );
myFreeBoundBtn = new QPushButton( tr( "GEOM_DETECT" ) + QString( " [%1]" ).arg( tr( "GEOM_FREE_BOUNDARIES" ) ),
GroupPoints->Box );
- aLay->addWidget( aLbl1, 0, 0 );
- aLay->addWidget( myTolEdt, 0, 1 );
- aLay->addWidget( myFreeBoundBtn, 1, 0, 1, 2 );
+ aLay->addWidget( myAllowNonManifoldChk, 0, 0 );
+ aLay->addWidget( aLbl1, 1, 0 );
+ aLay->addWidget( myTolEdt, 1, 1 );
+ aLay->addWidget( myFreeBoundBtn, 2, 0, 1, 2 );
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
/* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1;
- myObject = GEOM::GEOM_Object::_nil();
+ myObjects.clear();
//myGeomGUI->SetState( 0 );
initSelection();
initName();
GroupPoints->LineEdit1->setText( "" );
- myObject = GEOM::GEOM_Object::_nil();
+ myObjects.clear();
initSelection();
{
erasePreview();
myEditCurrentArgument->setText( "" );
- myObject = GEOM::GEOM_Object::_nil();
+ myObjects.clear();
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- SALOME_ListIO aSelList;
- aSelMgr->selectedObjects(aSelList);
+ myObjects = getSelected( TopAbs_SHAPE, -1 );
- if ( aSelList.Extent() == 1 ) {
- Handle(SALOME_InteractiveObject) anIO = aSelList.First();
- myObject = GEOMBase::ConvertIOinGEOMObject( anIO );
- if ( !CORBA::is_nil( myObject ) )
- myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
+ if ( !myObjects.isEmpty() ) {
+ QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
+ myEditCurrentArgument->setText( aName );
}
}
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
GroupPoints->LineEdit1->setText( "" );
- myObject = GEOM::GEOM_Object::_nil();
+ myObjects.clear();
myClosed = -1;
myOpen = -1;
{
myClosed = -1;
bool ok = myTolEdt->isValid( msg, !IsPreview() );
- return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. ) && ok;
+ return !myObjects.isEmpty() && ( IsPreview() || myTolEdt->value() > 0. ) && ok;
}
//=================================================================================
bool aResult = false;
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() );
+ GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
+ objList->length( myObjects.count() );
+ for ( int i = 0; i < myObjects.count(); ++i )
+ objList[i] = myObjects[i].copy();
+
if ( IsPreview() ) { // called from onDetect(): detect free boundary edges, highlight them (add to objects), display message dialog
GEOM::ListOfGO_var aClosed, anOpen;
- aResult = anOper->GetFreeBoundary( myObject, aClosed, anOpen );
+ aResult = anOper->GetFreeBoundary( objList, aClosed, anOpen );
if ( aResult ) {
myClosed = aClosed->length();
myClosed = -1;
}
else {
- GEOM::GEOM_Object_var anObj = anOper->Sew( myObject, myTolEdt->value() );
+ GEOM::GEOM_Object_var anObj;
+
+ if (myAllowNonManifoldChk->isChecked()) {
+ anObj = anOper->SewAllowNonManifold( objList, myTolEdt->value() );
+ } else {
+ anObj = anOper->Sew( objList, myTolEdt->value() );
+ }
+
aResult = !anObj->_is_nil();
if ( aResult )
{
void RepairGUI_SewingDlg::initSelection()
{
TColStd_MapOfInteger aTypes;
+ aTypes.Add( GEOM_FACE );
aTypes.Add( GEOM_SHELL );
aTypes.Add( GEOM_SOLID );
aTypes.Add( GEOM_COMPOUND );
msg = tr( "GEOM_FREE_BOUNDS_ERROR" );
SUIT_MessageBox::information( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg );
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_SewingDlg::getSourceObjects()
+{
+ return myObjects;
+}