-// Copyright (C) 2007-2014 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
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
-#include <SALOME_ListIteratorOfListIO.hxx>
+#include <SALOME_ListIO.hxx>
// VSR 22/08/2012: issue 0021787: remove "Preview" button from BOP and Partition operations
// Comment next line to enable preview in BOP dialog box
}
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()), Qt::UniqueConnection);
initName(mainFrame()->GroupConstructors->title());
mainFrame()->RadioButton1->setFocus();
globalSelection(GEOM_ALLSHAPES);
-
+ //localSelection(TopAbs_SHAPE); // VSR 24/09/2015: dectivate local selection in BOP (CoTech decision)
+
myGroup->PushButton1->click();
- SelectionIntoArgument();
resize(100,100);
}
//=================================================================================
void BooleanGUI_Dialog::reset()
{
- myObjects = new GEOM::ListOfGO;
- myObjects->length( 0 );
+ myObjects.clear();
}
//=================================================================================
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
myGeomGUI->getApp()->selectionMgr()->clearSelected();
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
- this, SLOT(SelectionIntoArgument()));
+ this, SLOT(SelectionIntoArgument()), Qt::UniqueConnection);
if (myEditCurrentArgument == myGroup->LineEdit1) {
myObject1 = aSelectedObject;
- if (!myGroup->PushButton2->isHidden() && !myObjects->length())
+ if (!myGroup->PushButton2->isHidden() && !myObjects.count())
myGroup->PushButton2->click();
}
else if (myEditCurrentArgument == myGroup->LineEdit2) {
- myObjects->length(1);
- myObjects[0] = aSelectedObject.get();
+ myObjects.clear();
+ myObjects << aSelectedObject;
if (!myObject1)
myGroup->PushButton1->click();
}
myEditCurrentArgument->setText( "" );
reset();
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- SALOME_ListIO aSelList;
- aSelMgr->selectedObjects(aSelList);
- myObjects->length(aSelList.Extent());
-
- int i = 0;
- for (SALOME_ListIteratorOfListIO anIt (aSelList); anIt.More(); anIt.Next()) {
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value() );
-
- if ( !CORBA::is_nil( aSelectedObject ) ) {
- myObjects[i++] = aSelectedObject;
- }
- }
+ myObjects = getSelected( TopAbs_SHAPE, -1 );
- myObjects->length( i );
+ int i = myObjects.count();
if ( i == 1 ) {
- myEditCurrentArgument->setText( GEOMBase::GetName( myObjects[0] ) );
+ myEditCurrentArgument->setText( GEOMBase::GetName( myObjects.first().get() ) );
} else if ( i > 0 ) {
myEditCurrentArgument->setText( QString::number( i ) + "_" + tr( "GEOM_OBJECTS" ) );
}
//=================================================================================
void BooleanGUI_Dialog::SelectionIntoArgument()
{
+ myEditCurrentArgument->setText("");
if ( myOperation == BooleanGUI::SECTION ||
(myOperation == BooleanGUI::CUT &&
myEditCurrentArgument == myGroup->LineEdit1)) {
myGroup->LineEdit1->setEnabled(false);
}
+ globalSelection(GEOM_ALLSHAPES);
+ //localSelection(TopAbs_SHAPE); // VSR 24/09/2015: dectivate local selection in BOP (CoTech decision)
+
// enable line edit
myEditCurrentArgument->setEnabled(true);
myEditCurrentArgument->setFocus();
// after setFocus(), because it will be setDown(false) when loses focus
send->setDown(true);
+
+ SelectionIntoArgument();
}
//=================================================================================
GEOMBase_Skeleton::ActivateThisDialog();
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
- this, SLOT( SelectionIntoArgument() ) );
+ this, SLOT( SelectionIntoArgument() ), Qt::UniqueConnection );
processPreview();
}
//=================================================================================
GEOM::GEOM_IOperations_ptr BooleanGUI_Dialog::createOperation()
{
- return getGeomEngine()->GetIBooleanOperations(getStudyId());
+ return getGeomEngine()->GetIBooleanOperations();
}
//=================================================================================
switch (myOperation) {
case BooleanGUI::FUSE:
case BooleanGUI::COMMON:
- isOK = myObjects->length() > 1;
+ isOK = myObjects.count() > 1;
break;
case BooleanGUI::CUT:
- isOK = myObject1 && myObjects->length();
+ isOK = myObject1 && myObjects.count();
break;
case BooleanGUI::SECTION:
- isOK = myObject1 && (myObjects->length() == 1);
+ isOK = myObject1 && (myObjects.count() == 1);
break;
default:
break;
GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
const bool isCheckSelfInte = myGroup->CheckBox1->isChecked();
+ GEOM::ListOfGO_var anObjects = new GEOM::ListOfGO();
+ anObjects->length( myObjects.count() );
+ for ( int i = 0; i < myObjects.count(); i++ )
+ anObjects[i] = myObjects[i].copy();
+
switch (myOperation) {
case BooleanGUI::FUSE:
{
const bool isRmExtraEdges = myGroup->CheckBox2->isChecked();
anObj = anOper->MakeFuseList
- (myObjects, isCheckSelfInte, isRmExtraEdges);
+ (anObjects, isCheckSelfInte, isRmExtraEdges);
}
break;
case BooleanGUI::COMMON:
- anObj = anOper->MakeCommonList(myObjects, isCheckSelfInte);
+ anObj = anOper->MakeCommonList(anObjects, isCheckSelfInte);
break;
case BooleanGUI::CUT:
anObj =
- anOper->MakeCutList(myObject1.get(), myObjects, isCheckSelfInte);
+ anOper->MakeCutList(myObject1.get(), anObjects, isCheckSelfInte);
break;
case BooleanGUI::SECTION:
anObj = anOper->MakeBoolean
- (myObject1.get(), myObjects[0], myOperation, isCheckSelfInte);
+ (myObject1.get(), anObjects[0], myOperation, isCheckSelfInte);
break;
default:
break;
// function : restoreSubShapes
// purpose :
//=================================================================================
-void BooleanGUI_Dialog::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
- SALOMEDS::SObject_ptr theSObject)
+void BooleanGUI_Dialog::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_GetInPlace, // ? GEOM::FSM_GetSame
/*theInheritFirstArg=*/myOperation == BooleanGUI::CUT,
mainFrame()->CheckBoxAddPrefix->isChecked()); // ? false
}
}
+
+//=================================================================================
+// function : addSubshapesToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BooleanGUI_Dialog::addSubshapesToStudy()
+{
+ GEOMBase::PublishSubObject( myObject1.get() );
+ for ( int i = 0; i < myObjects.count(); i++ )
+ GEOMBase::PublishSubObject( myObjects[i].get() );
+}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BooleanGUI_Dialog::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res(myObjects);
+ res << myObject1;
+ return res;
+}