mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-24 01:22:05 +05:00
PAL131191: EDF160 GEOM: in Glue Faces, visualize faces existing twice
This commit is contained in:
parent
3e52968abb
commit
b11f36342b
@ -26,6 +26,8 @@
|
|||||||
// Module : GEOM
|
// Module : GEOM
|
||||||
// $Header$
|
// $Header$
|
||||||
|
|
||||||
|
#include "OCCViewer_ViewModel.h"
|
||||||
|
|
||||||
#include "RepairGUI_GlueDlg.h"
|
#include "RepairGUI_GlueDlg.h"
|
||||||
#include "DlgRef_1Sel_Ext.h"
|
#include "DlgRef_1Sel_Ext.h"
|
||||||
#include "GEOMImpl_Types.hxx"
|
#include "GEOMImpl_Types.hxx"
|
||||||
@ -46,6 +48,9 @@
|
|||||||
|
|
||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
#include <qlabel.h>
|
#include <qlabel.h>
|
||||||
|
#include <qcheckbox.h>
|
||||||
|
#include <qhbox.h>
|
||||||
|
#include <qgrid.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -60,10 +65,12 @@ using namespace std;
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
|
RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
|
||||||
const char* name, bool modal, WFlags fl)
|
const char* name, bool modal, WFlags fl)
|
||||||
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
|
: GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
|
||||||
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
|
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
|
||||||
|
myCurrConstrId( -1 )
|
||||||
{
|
{
|
||||||
QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_GLUE_FACES")));
|
QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_GLUE_FACES")));
|
||||||
|
QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_GLUE_FACES2")));
|
||||||
QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||||
|
|
||||||
setCaption(tr("GEOM_GLUE_TITLE"));
|
setCaption(tr("GEOM_GLUE_TITLE"));
|
||||||
@ -71,7 +78,8 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* paren
|
|||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
GroupConstructors->setTitle(tr("GEOM_GLUE_TITLE"));
|
GroupConstructors->setTitle(tr("GEOM_GLUE_TITLE"));
|
||||||
RadioButton1->setPixmap(image0);
|
RadioButton1->setPixmap(image0);
|
||||||
RadioButton2->close(TRUE);
|
RadioButton2->setPixmap(image2);
|
||||||
|
//RadioButton2->close(TRUE);
|
||||||
RadioButton3->close(TRUE);
|
RadioButton3->close(TRUE);
|
||||||
|
|
||||||
GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints");
|
GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints");
|
||||||
@ -79,22 +87,51 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* paren
|
|||||||
GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
|
GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
|
||||||
GroupPoints->PushButton1->setPixmap(image1);
|
GroupPoints->PushButton1->setPixmap(image1);
|
||||||
GroupPoints->LineEdit1->setReadOnly( true );
|
GroupPoints->LineEdit1->setReadOnly( true );
|
||||||
|
|
||||||
|
int aWidth = GroupPoints->TextLabel1->sizeHint().width() +
|
||||||
|
GroupPoints->PushButton1->sizeHint().width() +
|
||||||
|
GroupPoints->getGroupBoxLayout()->spacing();
|
||||||
|
|
||||||
Layout1->addWidget(GroupPoints, 2, 0);
|
Layout1->addWidget(GroupPoints, 2, 0);
|
||||||
|
|
||||||
QGridLayout* aLay = new QGridLayout( 0, 2, 2, 0, 6, "aLay" );
|
QHBox* aHBox = new QHBox( GroupPoints->GroupBox1 );
|
||||||
QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->GroupBox1 );
|
aHBox->setSpacing( 5 );
|
||||||
myTolEdt = new QtxDblSpinBox( 0, 100, 1e-7, GroupPoints->GroupBox1 );
|
|
||||||
|
(new QLabel( tr( "GEOM_TOLERANCE" ), aHBox ))->setFixedWidth( aWidth );
|
||||||
|
myTolEdt = new QtxDblSpinBox( 0, 100, 1e-7, aHBox );
|
||||||
|
myTolEdt->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
||||||
myTolEdt->setPrecision( 10 );
|
myTolEdt->setPrecision( 10 );
|
||||||
myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE );
|
myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE );
|
||||||
|
GroupPoints->getGroupBoxLayout()->addWidget( aHBox, 3, 0 );
|
||||||
|
/***************************************************************/
|
||||||
|
|
||||||
aLay->addWidget( aLbl1, 0, 0 );
|
GroupPoints2 = new DlgRef_1Sel_Ext(this, "GroupPoints2");
|
||||||
aLay->addWidget( myTolEdt, 0, 1 );
|
GroupPoints2->GroupBox1->setTitle(tr("GEOM_GLUE"));
|
||||||
|
GroupPoints2->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
|
||||||
|
GroupPoints2->PushButton1->setPixmap(image1);
|
||||||
|
GroupPoints2->LineEdit1->setReadOnly( true );
|
||||||
|
Layout1->addWidget(GroupPoints2, 2, 0);
|
||||||
|
|
||||||
GroupPoints->getGroupBoxLayout()->addLayout( aLay, 3, 0 );
|
QGrid* aGrid = new QGrid( 2, Qt::Horizontal, GroupPoints2->GroupBox1 );
|
||||||
|
aGrid->setSpacing( 5 );
|
||||||
|
(new QLabel( tr( "GEOM_TOLERANCE" ), aGrid ))->setFixedWidth( aWidth );;
|
||||||
|
myTolEdt2 = new QtxDblSpinBox( 0, 100, 1e-7, aGrid );
|
||||||
|
myTolEdt2->setPrecision( 10 );
|
||||||
|
myTolEdt2->setValue( DEFAULT_TOLERANCE_VALUE );
|
||||||
|
myTolEdt2->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
||||||
|
(new QLabel( tr( "GLUE_FACES" ), aGrid ))->setFixedWidth( aWidth );;
|
||||||
|
myDetectBtn = new QPushButton( tr( "GEOM_DETECT" ), aGrid );
|
||||||
|
myDetectBtn->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
||||||
|
mySubShapesChk = new QCheckBox( tr( "SELECT_FACES" ), aGrid );
|
||||||
|
GroupPoints2->getGroupBoxLayout()->addWidget( aGrid, 3, 0 );
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
setHelpFileName("glue_faces.htm");
|
setHelpFileName("glue_faces.htm");
|
||||||
|
|
||||||
|
// Disable second way of gluing if OCC viewer is not active one
|
||||||
|
if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
|
||||||
|
!= OCCViewer_Viewer::Type())
|
||||||
|
RadioButton2->setEnabled(false);
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
@ -121,19 +158,100 @@ void RepairGUI_GlueDlg::Init()
|
|||||||
myObject = GEOM::GEOM_Object::_nil();
|
myObject = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
//myGeomGUI->SetState( 0 );
|
//myGeomGUI->SetState( 0 );
|
||||||
globalSelection( GEOM_COMPOUND );
|
//globalSelection( GEOM_COMPOUND );
|
||||||
|
|
||||||
/* signals and slots connections */
|
/* signals and slots connections */
|
||||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||||
|
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
|
||||||
|
|
||||||
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
|
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(GroupPoints2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
connect(GroupPoints2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
|
connect( myTolEdt2, SIGNAL( valueChanged( double ) ), this, SLOT( onTolerChanged( double ) ) );
|
||||||
|
connect( mySubShapesChk, SIGNAL( stateChanged( int ) ), this, SLOT( onSubShapesChk() ) );
|
||||||
|
|
||||||
|
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
||||||
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) );
|
||||||
|
|
||||||
|
connect(myDetectBtn, SIGNAL(clicked()), this, SLOT(onDetect()));
|
||||||
|
|
||||||
initName( tr( "GLUE_NEW_OBJ_NAME" ) );
|
initName( tr( "GLUE_NEW_OBJ_NAME" ) );
|
||||||
|
|
||||||
|
ConstructorsClicked(0);
|
||||||
|
|
||||||
|
activateSelection();
|
||||||
|
updateButtonState();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ConstructorsClicked()
|
||||||
|
// purpose : Radio button management
|
||||||
|
//=================================================================================
|
||||||
|
void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
|
||||||
|
{
|
||||||
|
if ( myCurrConstrId == constructorId )
|
||||||
|
return;
|
||||||
|
|
||||||
|
disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
|
||||||
|
|
||||||
|
switch ( constructorId )
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
GroupPoints2->hide();
|
||||||
|
resize( 0, 0 );
|
||||||
|
GroupPoints->show();
|
||||||
|
GroupPoints->LineEdit1->setText( "" );
|
||||||
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
|
|
||||||
|
if ( myCurrConstrId >= 0 ) // i.e. it is not initialisation
|
||||||
|
{
|
||||||
|
// copy tolerance from previous tolerance field
|
||||||
|
myTolEdt->setValue( myTolEdt2->value() );
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
GroupPoints->hide();
|
||||||
|
resize(0, 0);
|
||||||
|
GroupPoints2->show();
|
||||||
|
GroupPoints->LineEdit1->setText("");
|
||||||
|
myEditCurrentArgument = GroupPoints2->LineEdit1;
|
||||||
|
|
||||||
|
if ( myCurrConstrId >= 0 ) // i.e. it is not initialisation
|
||||||
|
{
|
||||||
|
// copy tolerance from previous tolerance field
|
||||||
|
myTolEdt2->setValue( myTolEdt->value() );
|
||||||
|
mySubShapesChk->setChecked( false );
|
||||||
|
clearTemporary();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
myCurrConstrId = constructorId;
|
||||||
|
|
||||||
|
myEditCurrentArgument->setFocus();
|
||||||
|
|
||||||
|
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
||||||
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
|
qApp->processEvents();
|
||||||
|
updateGeometry();
|
||||||
|
QSize aSize = minimumSizeHint();
|
||||||
|
resize( width(), aSize.height() );
|
||||||
|
|
||||||
|
displayPreview();
|
||||||
|
updateButtonState();
|
||||||
|
activateSelection();
|
||||||
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -159,10 +277,12 @@ bool RepairGUI_GlueDlg::ClickOnApply()
|
|||||||
|
|
||||||
initName();
|
initName();
|
||||||
|
|
||||||
GroupPoints->LineEdit1->setText("");
|
//GroupPoints->LineEdit1->setText("");
|
||||||
myObject = GEOM::GEOM_Object::_nil();
|
//myObject = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
globalSelection( GEOM_COMPOUND );
|
//globalSelection( GEOM_COMPOUND );
|
||||||
|
|
||||||
|
ConstructorsClicked( getConstructorId() );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -174,6 +294,9 @@ bool RepairGUI_GlueDlg::ClickOnApply()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void RepairGUI_GlueDlg::SelectionIntoArgument()
|
void RepairGUI_GlueDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
|
if ( mySubShapesChk->isChecked() && getConstructorId() == 1 )
|
||||||
|
return;
|
||||||
|
|
||||||
erasePreview();
|
erasePreview();
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
myObject = GEOM::GEOM_Object::_nil();
|
myObject = GEOM::GEOM_Object::_nil();
|
||||||
@ -185,6 +308,7 @@ void RepairGUI_GlueDlg::SelectionIntoArgument()
|
|||||||
if ( aRes )
|
if ( aRes )
|
||||||
myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
|
myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
|
||||||
}
|
}
|
||||||
|
updateButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -194,7 +318,7 @@ void RepairGUI_GlueDlg::SelectionIntoArgument()
|
|||||||
void RepairGUI_GlueDlg::SetEditCurrentArgument()
|
void RepairGUI_GlueDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
const QObject* send = sender();
|
const QObject* send = sender();
|
||||||
if ( send == GroupPoints->PushButton1 ) {
|
if ( send == GroupPoints->PushButton1 || send == GroupPoints2->PushButton1 ) {
|
||||||
myEditCurrentArgument->setFocus();
|
myEditCurrentArgument->setFocus();
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
@ -212,6 +336,10 @@ void RepairGUI_GlueDlg::LineEditReturnPressed()
|
|||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||||
}
|
}
|
||||||
|
else if( send == GroupPoints2->LineEdit1 ) {
|
||||||
|
myEditCurrentArgument = GroupPoints2->LineEdit1;
|
||||||
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -225,11 +353,13 @@ void RepairGUI_GlueDlg::ActivateThisDialog()
|
|||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
GroupPoints->LineEdit1->setText("");
|
//GroupPoints->LineEdit1->setText("");
|
||||||
myObject = GEOM::GEOM_Object::_nil();
|
//GroupPoints2->LineEdit1->setText("");
|
||||||
|
//myObject = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
//myGeomGUI->SetState( 0 );
|
//myGeomGUI->SetState( 0 );
|
||||||
globalSelection( GEOM_COMPOUND );
|
//globalSelection( GEOM_COMPOUND );
|
||||||
|
activateSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -243,7 +373,6 @@ void RepairGUI_GlueDlg::enterEvent(QEvent* e)
|
|||||||
ActivateThisDialog();
|
ActivateThisDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : closeEvent()
|
// function : closeEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -254,6 +383,7 @@ void RepairGUI_GlueDlg::closeEvent(QCloseEvent* e)
|
|||||||
GEOMBase_Skeleton::closeEvent( e );
|
GEOMBase_Skeleton::closeEvent( e );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : createOperation
|
// function : createOperation
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -279,15 +409,74 @@ bool RepairGUI_GlueDlg::isValid( QString& msg )
|
|||||||
bool RepairGUI_GlueDlg::execute( ObjectList& objects )
|
bool RepairGUI_GlueDlg::execute( ObjectList& objects )
|
||||||
{
|
{
|
||||||
bool aResult = false;
|
bool aResult = false;
|
||||||
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow
|
objects.clear();
|
||||||
( getOperation() )->MakeGlueFaces( myObject, myTolEdt->value() );
|
|
||||||
aResult = !anObj->_is_nil();
|
switch ( getConstructorId() )
|
||||||
if ( aResult )
|
{
|
||||||
objects.push_back( anObj._retn() );
|
case 0 :
|
||||||
|
{
|
||||||
|
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow
|
||||||
|
( getOperation() )->MakeGlueFaces( myObject, myTolEdt2->value() );
|
||||||
|
aResult = !anObj->_is_nil();
|
||||||
|
if ( aResult )
|
||||||
|
objects.push_back( anObj._retn() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1 :
|
||||||
|
if ( IsPreview() )
|
||||||
|
{
|
||||||
|
// if this method is used for displaying preview then we must detect glue faces only
|
||||||
|
ObjectList::iterator anIter;
|
||||||
|
for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter)
|
||||||
|
objects.push_back( GEOM::GEOM_Object::_duplicate( *anIter ) );
|
||||||
|
return myTmpObjs.size() ? true : false;
|
||||||
|
} // IsPreview
|
||||||
|
|
||||||
|
// Make glue face by list.
|
||||||
|
// Iterate through myTmpObjs and verifies where each object is currently selected or not.
|
||||||
|
QMap<QString, char> selected;
|
||||||
|
|
||||||
|
// Get names of selected objects
|
||||||
|
SALOME_ListIteratorOfListIO it ( selectedIO() );
|
||||||
|
for (; it.More(); it.Next())
|
||||||
|
selected.insert( it.Value()->getName(), 0 );
|
||||||
|
|
||||||
|
// Iterate through result and select objects with names from selection
|
||||||
|
// ObjectList toRemoveFromEnggine;
|
||||||
|
ObjectList toGlue;
|
||||||
|
ObjectList::iterator anIter;
|
||||||
|
for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter)
|
||||||
|
{
|
||||||
|
if ( selected.contains( myGeomGUI->getApp()->orb()->object_to_string(*anIter) ) )
|
||||||
|
toGlue.push_back(*anIter);
|
||||||
|
}
|
||||||
|
|
||||||
|
// make glue faces
|
||||||
|
GEOM::ListOfGO_var aListForGlue = new GEOM::ListOfGO();
|
||||||
|
aListForGlue->length( toGlue.size() );
|
||||||
|
ObjectList::iterator anIter3 = toGlue.begin();
|
||||||
|
for ( int i = 0; anIter3 != toGlue.end(); ++anIter3, ++i )
|
||||||
|
aListForGlue[ i ] = *anIter3;
|
||||||
|
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow
|
||||||
|
( getOperation() )->MakeGlueFacesByList( myObject, myTolEdt2->value(), aListForGlue );
|
||||||
|
|
||||||
|
aResult = !anObj->_is_nil();
|
||||||
|
|
||||||
|
if ( aResult )
|
||||||
|
objects.push_back( anObj._retn() );
|
||||||
|
|
||||||
|
// Remove from engine useless objects
|
||||||
|
clearTemporary();
|
||||||
|
|
||||||
|
updateButtonState();
|
||||||
|
|
||||||
|
break;
|
||||||
|
} // case
|
||||||
|
|
||||||
return aResult;
|
return aResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//================================================================
|
//================================================================
|
||||||
// Function : clearShapeBufferLocal
|
// Function : clearShapeBufferLocal
|
||||||
// Purpose :
|
// Purpose :
|
||||||
@ -326,7 +515,7 @@ void RepairGUI_GlueDlg::clearShapeBufferLocal( GEOM::GEOM_Object_ptr theObj )
|
|||||||
// It perfroms user input validation, then it
|
// It perfroms user input validation, then it
|
||||||
// performs a proper operation and manages transactions, etc.
|
// performs a proper operation and manages transactions, etc.
|
||||||
//================================================================
|
//================================================================
|
||||||
bool RepairGUI_GlueDlg::onAcceptLocal( const bool publish, const bool useTransaction )
|
bool RepairGUI_GlueDlg::onAcceptLocal()
|
||||||
{
|
{
|
||||||
if ( !getStudy() || !( getStudy()->studyDS() ) )
|
if ( !getStudy() || !( getStudy()->studyDS() ) )
|
||||||
return false;
|
return false;
|
||||||
@ -334,76 +523,79 @@ bool RepairGUI_GlueDlg::onAcceptLocal( const bool publish, const bool useTransac
|
|||||||
_PTR(Study) aStudy = getStudy()->studyDS();
|
_PTR(Study) aStudy = getStudy()->studyDS();
|
||||||
|
|
||||||
bool aLocked = aStudy->GetProperties()->IsLocked();
|
bool aLocked = aStudy->GetProperties()->IsLocked();
|
||||||
if ( aLocked ) {
|
if ( aLocked )
|
||||||
|
{
|
||||||
MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked");
|
MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked");
|
||||||
SUIT_MessageBox::warn1 ( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()),
|
SUIT_MessageBox::warn1 ( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()),
|
||||||
QObject::tr("WRN_WARNING"),
|
QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED"), QObject::tr("BUT_OK") );
|
||||||
QObject::tr("WRN_STUDY_LOCKED"),
|
|
||||||
QObject::tr("BUT_OK") );
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString msg;
|
QString msg;
|
||||||
if ( !isValid( msg ) ) {
|
if ( !isValid( msg ) )
|
||||||
|
{
|
||||||
showError( msg );
|
showError( msg );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
erasePreview( false );
|
erasePreview( false );
|
||||||
|
|
||||||
try {
|
try
|
||||||
if ( ( !publish && !useTransaction ) || openCommand() ) {
|
{
|
||||||
|
if ( openCommand() )
|
||||||
|
{
|
||||||
SUIT_OverrideCursor wc;
|
SUIT_OverrideCursor wc;
|
||||||
|
|
||||||
SUIT_Session::session()->activeApplication()->putInfo( "" );
|
SUIT_Session::session()->activeApplication()->putInfo( "" );
|
||||||
ObjectList objects;
|
ObjectList objects;
|
||||||
// JFA 28.12.2004 if ( !execute( objects ) || !getOperation()->IsDone() ) {
|
|
||||||
if ( !execute( objects ) ) { // JFA 28.12.2004 // To enable warnings
|
if ( !execute( objects ) )
|
||||||
wc.suspend();
|
{
|
||||||
|
wc.suspend();
|
||||||
abortCommand();
|
abortCommand();
|
||||||
showError();
|
showError();
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
const int nbObjs = objects.size();
|
{
|
||||||
bool withChildren = false;
|
const int nbObjs = objects.size();
|
||||||
for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
|
bool withChildren = false;
|
||||||
if ( publish ) {
|
for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it )
|
||||||
QString aName("");
|
{
|
||||||
if ( nbObjs > 1 )
|
QString aName("");
|
||||||
aName = strlen( getNewObjectName() ) ? GEOMBase::GetDefaultName( getNewObjectName() ) : GEOMBase::GetDefaultName( getPrefix( *it ) );
|
if ( nbObjs > 1 )
|
||||||
else {
|
{
|
||||||
aName = getNewObjectName();
|
aName = strlen( getNewObjectName() ) ? GEOMBase::GetDefaultName( getNewObjectName() ) : GEOMBase::GetDefaultName( getPrefix( *it ) );
|
||||||
// PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
|
|
||||||
if ( aName.isEmpty() )
|
|
||||||
aName = GEOMBase::GetDefaultName( getPrefix( *it ) );
|
|
||||||
}
|
|
||||||
addInStudy( *it, aName.latin1() );
|
|
||||||
withChildren = false;
|
|
||||||
display( *it, false );
|
|
||||||
}
|
|
||||||
else { // asv : fix of PAL6454. If publish==false, then the original shape was modified, and need to be re-cached in GEOM_Client
|
|
||||||
// before redisplay
|
|
||||||
clearShapeBufferLocal( *it );
|
|
||||||
withChildren = true;
|
|
||||||
redisplay( *it, withChildren, false );
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
aName = getNewObjectName();
|
||||||
|
// PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
|
||||||
|
if ( aName.isEmpty() )
|
||||||
|
aName = GEOMBase::GetDefaultName( getPrefix( *it ) );
|
||||||
|
}
|
||||||
|
addInStudy( *it, aName.latin1() );
|
||||||
|
withChildren = false;
|
||||||
|
display( *it, false );
|
||||||
|
}
|
||||||
|
|
||||||
if ( nbObjs ) {
|
if ( nbObjs )
|
||||||
commitCommand();
|
{
|
||||||
updateObjBrowser();
|
commitCommand();
|
||||||
SUIT_Session::session()->activeApplication()->putInfo( QObject::tr("GEOM_PRP_DONE") );
|
updateObjBrowser();
|
||||||
}
|
SUIT_Session::session()->activeApplication()->putInfo( QObject::tr("GEOM_PRP_DONE") );
|
||||||
else {
|
}
|
||||||
abortCommand();
|
else
|
||||||
|
{
|
||||||
|
abortCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
// JFA 28.12.2004 BEGIN // To enable warnings
|
// JFA 28.12.2004 BEGIN // To enable warnings
|
||||||
if ( !getOperation()->_is_nil() ) {
|
if ( !getOperation()->_is_nil() )
|
||||||
if ( !getOperation()->IsDone() ) {
|
{
|
||||||
|
if ( !getOperation()->IsDone() )
|
||||||
|
{
|
||||||
wc.suspend();
|
wc.suspend();
|
||||||
QString msgw = QObject::tr( getOperation()->GetErrorCode() );
|
QString msgw = QObject::tr( getOperation()->GetErrorCode() );
|
||||||
SUIT_MessageBox::warn1((QWidget*)(SUIT_Session::session()->activeApplication()->desktop()),
|
SUIT_MessageBox::warn1((QWidget*)(SUIT_Session::session()->activeApplication()->desktop()),
|
||||||
QObject::tr( "WRN_WARNING" ),
|
QObject::tr( "WRN_WARNING" ),
|
||||||
msgw,
|
msgw,
|
||||||
@ -414,12 +606,195 @@ bool RepairGUI_GlueDlg::onAcceptLocal( const bool publish, const bool useTransac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( const SALOME::SALOME_Exception& e ) {
|
catch( const SALOME::SALOME_Exception& e )
|
||||||
|
{
|
||||||
SalomeApp_Tools::QtCatchCorbaException( e );
|
SalomeApp_Tools::QtCatchCorbaException( e );
|
||||||
abortCommand();
|
abortCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateViewer();
|
updateViewer();
|
||||||
|
activateSelection();
|
||||||
|
updateButtonState();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onDetect
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void RepairGUI_GlueDlg::onDetect()
|
||||||
|
{
|
||||||
|
clearTemporary();
|
||||||
|
QString msg;
|
||||||
|
if ( !isValid( msg ) ) {
|
||||||
|
showError( msg );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GEOM::ListOfGO_var aList = GEOM::GEOM_IShapesOperations::_narrow
|
||||||
|
( getOperation() )->GetGlueFaces( myObject, myTolEdt2->value() );
|
||||||
|
|
||||||
|
for (int i = 0, n = aList->length(); i < n; i++)
|
||||||
|
myTmpObjs.push_back(GEOM::GEOM_Object::_duplicate(aList[i]));
|
||||||
|
|
||||||
|
if ( myTmpObjs.size() > 0 )
|
||||||
|
{
|
||||||
|
msg = tr( "FACES_FOR_GLUING_ARE_DETECTED" ).arg( myTmpObjs.size() );
|
||||||
|
mySubShapesChk->setChecked( true );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg = tr( "THERE_ARE_NO_FACES_FOR_GLUING" );
|
||||||
|
}
|
||||||
|
|
||||||
|
SUIT_MessageBox::info1( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, "Close" );
|
||||||
|
updateButtonState();
|
||||||
|
activateSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : activateSelection
|
||||||
|
// purpose : Redisplay preview and Activate selection
|
||||||
|
//=================================================================================
|
||||||
|
void RepairGUI_GlueDlg::activateSelection()
|
||||||
|
{
|
||||||
|
erasePreview(false);
|
||||||
|
|
||||||
|
int anId = getConstructorId();
|
||||||
|
if ( anId == 0 ) // Case of whole gluing
|
||||||
|
{
|
||||||
|
disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
||||||
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
|
||||||
|
|
||||||
|
globalSelection( GEOM_ALLSHAPES );
|
||||||
|
if (myObject->_is_nil())
|
||||||
|
SelectionIntoArgument();
|
||||||
|
|
||||||
|
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
||||||
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
|
||||||
|
}
|
||||||
|
else // Second case of gluing
|
||||||
|
{
|
||||||
|
if ( !mySubShapesChk->isChecked() )
|
||||||
|
globalSelection( GEOM_ALLSHAPES );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
displayPreview( true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED );
|
||||||
|
globalSelection( GEOM_PREVIEW );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateViewer();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : updateButtonState
|
||||||
|
// purpose : Update button state
|
||||||
|
//=================================================================================
|
||||||
|
void RepairGUI_GlueDlg::updateButtonState()
|
||||||
|
{
|
||||||
|
int anId = getConstructorId();
|
||||||
|
bool hasMainObj = !myObject->_is_nil();
|
||||||
|
if ( anId == 0 )
|
||||||
|
{
|
||||||
|
buttonOk->setEnabled( hasMainObj );
|
||||||
|
buttonApply->setEnabled( hasMainObj );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool wasDetected = myTmpObjs.size() ? true : false;
|
||||||
|
buttonOk->setEnabled( hasMainObj && wasDetected );
|
||||||
|
buttonApply->setEnabled( hasMainObj && wasDetected );
|
||||||
|
mySubShapesChk->setEnabled( hasMainObj && wasDetected );
|
||||||
|
myDetectBtn->setEnabled( hasMainObj );
|
||||||
|
if ( !hasMainObj || !wasDetected )
|
||||||
|
mySubShapesChk->setChecked( false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : clearTemporary
|
||||||
|
// purpose : Remove temporary objects from engine
|
||||||
|
//=================================================================================
|
||||||
|
void RepairGUI_GlueDlg::clearTemporary()
|
||||||
|
{
|
||||||
|
ObjectList::iterator anIter;
|
||||||
|
for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter)
|
||||||
|
getGeomEngine()->RemoveObject(*anIter);
|
||||||
|
|
||||||
|
myTmpObjs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onTolerChanged
|
||||||
|
// purpose : Remove temporary objects from engine
|
||||||
|
//=================================================================================
|
||||||
|
void RepairGUI_GlueDlg::onTolerChanged( double /*theVal*/ )
|
||||||
|
{
|
||||||
|
clearTemporary();
|
||||||
|
activateSelection();
|
||||||
|
updateButtonState();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onSubShapesChk
|
||||||
|
// purpose : Update selection mode
|
||||||
|
//=================================================================================
|
||||||
|
void RepairGUI_GlueDlg::onSubShapesChk()
|
||||||
|
{
|
||||||
|
if ( !mySubShapesChk->isChecked() )
|
||||||
|
clearTemporary();
|
||||||
|
activateSelection();
|
||||||
|
updateButtonState();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ClickOnCancel
|
||||||
|
// purpose : Remove temporary objects from engine and call method of base class
|
||||||
|
//=================================================================================
|
||||||
|
void RepairGUI_GlueDlg::ClickOnCancel()
|
||||||
|
{
|
||||||
|
clearTemporary();
|
||||||
|
GEOMBase_Skeleton::ClickOnCancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================
|
||||||
|
// Function : getEntry
|
||||||
|
// Purpose :
|
||||||
|
//================================================================
|
||||||
|
static string getEntry( GEOM::GEOM_Object_ptr object )
|
||||||
|
{
|
||||||
|
SUIT_Session* session = SUIT_Session::session();
|
||||||
|
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
|
||||||
|
if ( app )
|
||||||
|
{
|
||||||
|
string IOR = app->orb()->object_to_string( object );
|
||||||
|
if ( IOR != "" )
|
||||||
|
{
|
||||||
|
SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy();
|
||||||
|
_PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) );
|
||||||
|
if ( SO )
|
||||||
|
return SO->GetID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
class QtxDblSpinBox;
|
class QtxDblSpinBox;
|
||||||
class DlgRef_1Sel_Ext;
|
class DlgRef_1Sel_Ext;
|
||||||
|
class QCheckBox;
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : RepairGUI_GlueDlg
|
// class : RepairGUI_GlueDlg
|
||||||
@ -42,8 +43,8 @@ class RepairGUI_GlueDlg : public GEOMBase_Skeleton
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0,
|
RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* parent = 0,
|
||||||
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
|
const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
|
||||||
~RepairGUI_GlueDlg();
|
~RepairGUI_GlueDlg();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -57,16 +58,34 @@ private:
|
|||||||
void enterEvent(QEvent* e);
|
void enterEvent(QEvent* e);
|
||||||
void closeEvent(QCloseEvent* e);
|
void closeEvent(QCloseEvent* e);
|
||||||
void initSelection();
|
void initSelection();
|
||||||
|
|
||||||
|
void clearTemporary();
|
||||||
|
|
||||||
bool onAcceptLocal( const bool publish = true, const bool useTransaction = true );
|
bool onAcceptLocal();
|
||||||
void clearShapeBufferLocal( GEOM::GEOM_Object_ptr );
|
void clearShapeBufferLocal( GEOM::GEOM_Object_ptr );
|
||||||
// Reimplementation of onAccept for local case of this class.
|
// Reimplementation of onAccept for local case of this class.
|
||||||
|
|
||||||
|
void activateSelection();
|
||||||
|
void updateButtonState();
|
||||||
|
void selectTmpInViewer();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
GEOM::GEOM_Object_var myObject;
|
GEOM::GEOM_Object_var myObject;
|
||||||
|
ObjectList myTmpObjs;
|
||||||
|
|
||||||
DlgRef_1Sel_Ext* GroupPoints;
|
DlgRef_1Sel_Ext* GroupPoints;
|
||||||
|
DlgRef_1Sel_Ext* GroupPoints2;
|
||||||
QtxDblSpinBox* myTolEdt;
|
QtxDblSpinBox* myTolEdt;
|
||||||
|
QtxDblSpinBox* myTolEdt2;
|
||||||
|
QPushButton* myDetectBtn;
|
||||||
|
QCheckBox* mySubShapesChk;
|
||||||
|
|
||||||
|
int myCurrConstrId;
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
virtual void ClickOnCancel();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
bool ClickOnApply();
|
bool ClickOnApply();
|
||||||
@ -76,6 +95,13 @@ private slots:
|
|||||||
void LineEditReturnPressed();
|
void LineEditReturnPressed();
|
||||||
void SelectionIntoArgument();
|
void SelectionIntoArgument();
|
||||||
void SetEditCurrentArgument();
|
void SetEditCurrentArgument();
|
||||||
|
|
||||||
|
void ConstructorsClicked(int);
|
||||||
|
//void ValueChangedInSpinBox();
|
||||||
|
|
||||||
|
void onDetect();
|
||||||
|
void onTolerChanged( double );
|
||||||
|
void onSubShapesChk();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGBOX_Glue_H
|
#endif // DIALOGBOX_Glue_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user