-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2019 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 <GeometryGUI.h>
#include <GEOMBase.h>
#include <SalomeApp_DoubleSpinBox.h>
+#include "utilities.h"
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
#include <SUIT_ViewWindow.h>
#include <SUIT_ViewManager.h>
#include <OCCViewer_ViewModel.h>
-#include <SALOME_ListIteratorOfListIO.hxx>
+#include <SALOME_ListIO.hxx>
+#include "utilities.h"
#include <GEOMImpl_Types.hxx>
GroupPoints = new DlgRef_1SelExt(centralWidget());
GroupPoints->GroupBox1->setTitle(tr("GEOM_GLUE"));
- GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
+ GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPES"));
GroupPoints->PushButton1->setIcon(image0);
GroupPoints->LineEdit1->setReadOnly(true);
GroupPoints2 = new DlgRef_1SelExt(centralWidget());
GroupPoints2->GroupBox1->setTitle(tr("GEOM_GLUE"));
- GroupPoints2->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
+ GroupPoints2->TextLabel1->setText(tr("GEOM_SELECTED_SHAPES"));
GroupPoints2->PushButton1->setIcon(image0);
GroupPoints2->LineEdit1->setReadOnly(true);
/* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1;
- myObject = GEOM::GEOM_Object::_nil();
+ myObjects.clear();
//myGeomGUI->SetState(0);
//globalSelection(GEOM_COMPOUND);
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 );
}
updateButtonState();
}
//=================================================================================
GEOM::GEOM_IOperations_ptr RepairGUI_GlueDlg::createOperation()
{
- return getGeomEngine()->GetIShapesOperations(getStudyId());
+ return getGeomEngine()->GetIShapesOperations();
}
//=================================================================================
ok = myTolEdt2->isValid(msg, !IsPreview());
break;
}
- return !myObject->_is_nil() && (IsPreview() || v > 0.) && ok;
+ return !myObjects.isEmpty() && (IsPreview() || v > 0.) && ok;
}
//=================================================================================
bool aResult = false;
objects.clear();
+ GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
+ objList->length( myObjects.count() );
+ for ( int i = 0; i < myObjects.count(); ++i )
+ objList[i] = myObjects[i].copy();
+
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
switch (getConstructorId()) {
case 0:
{
GEOM::GEOM_Object_var anObj;
if (myGlueMode == TopAbs_FACE)
- anObj = anOper->MakeGlueFaces(myObject, myTolEdt->value(), true);
+ anObj = anOper->MakeGlueFaces( objList, myTolEdt->value(), true);
else if (myGlueMode == TopAbs_EDGE)
- anObj = anOper->MakeGlueEdges(myObject, myTolEdt->value());
+ anObj = anOper->MakeGlueEdges( objList, myTolEdt->value());
aResult = !anObj->_is_nil();
if (aResult && !IsPreview())
{
QStringList aParameters;
aParameters << myTolEdt->text();
- anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+ anObj->SetParameters(aParameters.join(":").toUtf8().constData());
objects.push_back(anObj._retn());
}
GEOM::GEOM_Object_var anObj;
if (myGlueMode == TopAbs_FACE) {
bool doGlueAllEdges = myGlueAllEdgesChk->isChecked();
- anObj = anOper->MakeGlueFacesByList(myObject, myTolEdt2->value(), aListForGlue.in(),
+ anObj = anOper->MakeGlueFacesByList( objList, myTolEdt2->value(), aListForGlue.in(),
true, doGlueAllEdges);
}
else if (myGlueMode == TopAbs_EDGE)
- anObj = anOper->MakeGlueEdgesByList(myObject, myTolEdt2->value(), aListForGlue.in());
+ anObj = anOper->MakeGlueEdgesByList( objList, myTolEdt2->value(), aListForGlue.in());
aResult = !anObj->_is_nil();
if (!IsPreview()) {
QStringList aParameters;
aParameters << myTolEdt2->text();
- anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+ anObj->SetParameters(aParameters.join(":").toUtf8().constData());
}
objects.push_back(anObj._retn());
}
// function : restoreSubShapes
// purpose :
//=================================================================================
-void RepairGUI_GlueDlg::restoreSubShapes(SALOMEDS::Study_ptr theStudy,
- SALOMEDS::SObject_ptr theSObject)
+void RepairGUI_GlueDlg::restoreSubShapes( SALOMEDS::SObject_ptr theSObject)
{
if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
GEOM::find_shape_method aFindMethod = GEOM::FSM_GetInPlace;
aFindMethod = GEOM::FSM_GetInPlaceByHistory;
// empty list of arguments means that all arguments should be restored
- getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
+ getGeomEngine()->RestoreSubShapesSO( theSObject, GEOM::ListOfGO(),
aFindMethod, /*theInheritFirstArg=*/true,
mainFrame()->CheckBoxAddPrefix->isChecked());
}
//================================================================
// Function : onAccept
// Purpose : This method should be called from dialog's slots onOk() and onApply()
-// It perfroms user input validation, then it
+// It performs user input validation, then it
// performs a proper operation and manages transactions, etc.
//================================================================
bool RepairGUI_GlueDlg::onAcceptLocal()
return false;
}
- erasePreview(false);
-
try {
if (openCommand()) {
SUIT_OverrideCursor wc;
if (aName.isEmpty())
aName = GEOMBase::GetDefaultName(getPrefix(*it));
}
- addInStudy(*it, aName.toLatin1().data());
+ addInStudy(*it, aName.toUtf8().data());
display(*it, false);
}
abortCommand();
}
+ erasePreview(false);
+
updateViewer();
activateSelection();
updateButtonState();
buttonApply()->setEnabled(false);
globalSelection(GEOM_ALLSHAPES);
+ GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
+ objList->length( myObjects.count() );
+ for ( int i = 0; i < myObjects.count(); ++i )
+ objList[i] = myObjects[i].copy();
+
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
GEOM::ListOfGO_var aList;
if (myGlueMode == TopAbs_FACE)
- aList = anOper->GetGlueFaces(myObject.in(), myTolEdt2->value());
+ aList = anOper->GetGlueFaces( objList, myTolEdt2->value());
else if (myGlueMode == TopAbs_EDGE)
- aList = anOper->GetGlueEdges(myObject.in(), myTolEdt2->value());
+ aList = anOper->GetGlueEdges( objList, myTolEdt2->value());
for (int i = 0, n = aList->length(); i < n; i++)
myTmpObjs << GEOM::GeomObjPtr(aList[i].in());
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument())) ;
- SUIT_MessageBox::information(this, tr("GEOM_FREE_BOUNDS_TLT"), msg, tr("Close"));
+ if ( myGlueMode == TopAbs_FACE )
+ SUIT_MessageBox::information(this, tr("GEOM_GLUE_FACES_DETECT_TITLE"), msg, tr("Close"));
+ else
+ SUIT_MessageBox::information(this, tr("GEOM_GLUE_EDGES_DETECT_TITLE"), msg, tr("Close"));
updateButtonState();
activateSelection();
}
this, SLOT(SelectionIntoArgument()));
globalSelection(GEOM_ALLSHAPES);
- if (myObject->_is_nil())
+ if ( myObjects.isEmpty() )
SelectionIntoArgument();
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
void RepairGUI_GlueDlg::updateButtonState()
{
int anId = getConstructorId();
- bool hasMainObj = !myObject->_is_nil();
+ bool hasMainObj = !myObjects.isEmpty();
if (anId == 0) {
buttonOk()->setEnabled(hasMainObj);
buttonApply()->setEnabled(hasMainObj);
clearTemporary();
GEOMBase_Skeleton::ClickOnCancel();
}
+
+//=================================================================================
+// function : getSourceObjects
+// purpose : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_GlueDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> res(myObjects);
+ for (int i = 0; i < myTmpObjs.count(); i++)
+ res << myTmpObjs[i];
+ return res;
+}