-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 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
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_PARTITION" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setIcon( image1 );
+ mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
GroupPoints->CheckButton1->setText( tr( "GEOM_KEEP_NONLIMIT_SHAPES" ) );
GroupPoints->CheckButton2->setText( tr( "GEOM_NO_SELF_INTERSECTION" ) );
+ mySelfInte = new QCheckBox(GroupPoints->GroupBox1);
+ mySelfInte->setText(tr("GEOM_CHECK_SELF_INTERSECTIONS"));
+ GroupPoints->gridLayout1->addWidget(mySelfInte, 5, 0, 1, 3);
+
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_VERTEX" ) );
GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::VERTEX);
GroupPoints->CheckButton1->setChecked( false );
+ mySelfInte->setChecked(false);
mainFrame()->GroupBoxPublish->show();
connect( GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(processPreview()) );
connect( GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(processPreview()) );
+ connect( GroupPoints->CheckButton2, SIGNAL(toggled(bool)), mySelfInte, SLOT(setEnabled(bool)) );
+ connect( mySelfInte, SIGNAL(toggled(bool)), this, SLOT(processPreview()) );
+ mySelfInte->setEnabled(GroupPoints->CheckButton2->isChecked());
initName( tr( "GEOM_PARTITION" ) );
ConstructorsClicked( 0 );
GroupPoints->ComboBox1->setCurrentIndex( 0 );
GroupPoints->CheckButton1->show();
GroupPoints->CheckButton2->show();
+ mySelfInte->show();
GroupPoints->PushButton1->setDown( true );
GroupPoints->PushButton2->setDown( false );
GroupPoints->LineEdit1->setEnabled(true);
GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE" ) );
GroupPoints->CheckButton1->hide();
GroupPoints->CheckButton2->hide();
+ mySelfInte->hide();
GroupPoints->PushButton1->setDown( true );
GroupPoints->LineEdit1->setEnabled(true);
break;
//myListMaterials.length( 0 ); // obsolete
GEOM::shape_type type = GEOM::SHAPE;
- for (int i = 0; i < myListShapes.length(); i++)
+ for (int i = 0; i < (int)myListShapes.length(); i++)
type = qMin( type, myListShapes[i]->GetMaxShapeType() );
int idx = qMax( 0, GroupPoints->ComboBox1->findData( type ) );
GroupPoints->ComboBox1->setCurrentIndex( idx );
if ( !myListTools.length() )
return;
else if ( myListTools.length() == 1 && getConstructorId() == 1 ) {
- GEOM::GEOM_IMeasureOperations_var mOp = getGeomEngine()->GetIMeasureOperations( getStudyId() );
+ GEOM::GEOM_IMeasureOperations_var mOp = getGeomEngine()->GetIMeasureOperations();
GEOM::ListOfLong_var intList;
GEOM::ListOfDouble_var dblList;
GEOM::GEOM_IKindOfShape::shape_kind kind = mOp->KindOfShape( myListTools[0].in(), intList.out(), dblList.out() );
//=================================================================================
GEOM::GEOM_IOperations_ptr OperationGUI_PartitionDlg::createOperation()
{
- return getGeomEngine()->GetIBooleanOperations( getStudyId() );
+ return getGeomEngine()->GetIBooleanOperations();
}
switch ( getConstructorId() ) {
case 0:
{
+ bool isDetectSelfInte = mySelfInte->isChecked();
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) :
+ aLimit, false, myListMaterials, aKeepNonlimitShapes,
+ isDetectSelfInte) :
anOper->MakePartition(myListShapes, myListTools,
myListKeepInside, myListRemoveInside,
aLimit, false, myListMaterials, aKeepNonlimitShapes);
break;
case 1:
{
- anObj = anOper->MakeHalfPartition( myListShapes[0].in(), myListTools[0].in() );
+ anObj = anOper->MakeHalfPartition(myListShapes[0].in(), myListTools[0].in());
res = true;
}
break;
// function : restoreSubShapes
// purpose :
//=================================================================================
-void OperationGUI_PartitionDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy,
- SALOMEDS::SObject_ptr theSObject )
+void OperationGUI_PartitionDlg::restoreSubShapes( 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(),
+ getGeomEngine()->RestoreSubShapesSO( theSObject, GEOM::ListOfGO(),
/*theFindMethod=*/GEOM::FSM_GetInPlaceByHistory,
- /*theInheritFirstArg=*/myListShapes.length() == 1,
+ /*theInheritFirstArg=*/myListShapes.length() == 1 && myListTools.length() == 0,
mainFrame()->CheckBoxAddPrefix->isChecked() ); // ? false
}
}
return aLimit;
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> OperationGUI_PartitionDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res;
+ for (int i = 0; i < (int)myListShapes.length(); i++) {
+ GEOM::GeomObjPtr aGeomObjPtr(myListShapes[i]);
+ res << aGeomObjPtr;
+ }
+ for (int i = 0; i < (int)myListTools.length(); i++) {
+ GEOM::GeomObjPtr aGeomObjPtr(myListTools[i]);
+ res << aGeomObjPtr;
+ }
+ for (int i = 0; i < (int)myListRemoveInside.length(); i++) {
+ GEOM::GeomObjPtr aGeomObjPtr(myListRemoveInside[i]);
+ res << aGeomObjPtr;
+ }
+ for (int i = 0; i < (int)myListKeepInside.length(); i++) {
+ GEOM::GeomObjPtr aGeomObjPtr(myListKeepInside[i]);
+ res << aGeomObjPtr;
+ }
+ return res;
+}