mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-30 03:40:34 +05:00
Bugs 16640, 19050: Improve selection mechanism in GEOM dialog boxes.
This commit is contained in:
parent
0c6f0114a9
commit
54666ebd00
File diff suppressed because it is too large
Load Diff
@ -81,7 +81,6 @@ private slots:
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent( QEvent* );
|
||||
void reset();
|
||||
void createSelWg( const QString&, QPixmap&, QWidget*,
|
||||
QGridLayout*, const int );
|
||||
void createRadioWg( const QString&, const QString&, QWidget*,
|
||||
@ -96,6 +95,9 @@ private:
|
||||
QMap< int, int > myFace; // indexes of faces from second tab ( Face1,2 )
|
||||
TColStd_IndexedMapOfInteger myFaces; // indexes of faces from first tab ( Faces )
|
||||
TColStd_IndexedMapOfInteger myEdges; // indexes of edges from fourth tab (Edges)
|
||||
|
||||
// to initialize the first selection field with a selected object on the dialog creation
|
||||
bool myInitial;
|
||||
|
||||
QGroupBox* myGrp1;
|
||||
QGroupBox* myGrp2;
|
||||
|
@ -1,22 +1,22 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 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.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : OperationGUI_FilletDlg.cxx
|
||||
@ -38,6 +38,7 @@
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
#include <OCCViewer_ViewModel.h>
|
||||
|
||||
// OCCT Includes
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
|
||||
@ -45,166 +46,182 @@
|
||||
|
||||
//=================================================================================
|
||||
// class : OperationGUI_FilletDlg()
|
||||
// purpose : Constructs a OperationGUI_FilletDlg which is a child of 'parent', with the
|
||||
// purpose : Constructs a OperationGUI_FilletDlg which is a child of 'parent', with the
|
||||
// name 'name' and widget flags set to 'f'.
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
OperationGUI_FilletDlg::OperationGUI_FilletDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
|
||||
: GEOMBase_Skeleton( theGeometryGUI, parent, false )
|
||||
OperationGUI_FilletDlg::OperationGUI_FilletDlg (GeometryGUI* theGeometryGUI, QWidget* parent)
|
||||
: GEOMBase_Skeleton(theGeometryGUI, parent, false),
|
||||
myInitial(true)
|
||||
{
|
||||
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
||||
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_ALL" ) ) );
|
||||
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_EDGE" ) ) );
|
||||
QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_FACE" ) ) );
|
||||
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_FILLET_ALL")));
|
||||
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_FILLET_EDGE")));
|
||||
QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_FILLET_FACE")));
|
||||
|
||||
QPixmap iconSelect( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
|
||||
QPixmap iconSelect (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||
|
||||
setWindowTitle( tr( "GEOM_FILLET_TITLE" ) );
|
||||
setWindowTitle(tr("GEOM_FILLET_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_FILLET" ) );
|
||||
mainFrame()->RadioButton1->setIcon( image0 );
|
||||
mainFrame()->RadioButton2->setIcon( image1 );
|
||||
mainFrame()->RadioButton3->setIcon( image2 );
|
||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_FILLET"));
|
||||
mainFrame()->RadioButton1->setIcon(image0);
|
||||
mainFrame()->RadioButton2->setIcon(image1);
|
||||
mainFrame()->RadioButton3->setIcon(image2);
|
||||
|
||||
Group1 = new DlgRef_1Sel1Spin( centralWidget() );
|
||||
Group1->GroupBox1->setTitle( tr( "GEOM_FILLET_ALL" ) );
|
||||
Group1->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
|
||||
Group1->TextLabel2->setText( tr( "GEOM_RADIUS" ) );
|
||||
Group1->PushButton1->setIcon( iconSelect );
|
||||
Group1->LineEdit1->setReadOnly( true );
|
||||
Group1 = new DlgRef_1Sel1Spin(centralWidget());
|
||||
Group1->GroupBox1->setTitle(tr("GEOM_FILLET_ALL"));
|
||||
Group1->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
|
||||
Group1->TextLabel2->setText(tr("GEOM_RADIUS"));
|
||||
Group1->PushButton1->setIcon(iconSelect);
|
||||
Group1->LineEdit1->setReadOnly(true);
|
||||
|
||||
Group2 = new DlgRef_2Sel3Spin2Rb( centralWidget() );
|
||||
Group2->GroupBox1->setTitle( tr( "GEOM_FILLET_EDGES" ) );
|
||||
Group2->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
|
||||
Group2->TextLabel2->setText( tr( "SELECTED_EDGES" ) );
|
||||
Group2->TextLabel3->setText( tr( "GEOM_RADIUS" ) );
|
||||
Group2->TextLabel4->setText( tr( "GEOM_R1" ) );
|
||||
Group2->TextLabel5->setText( tr( "GEOM_R2" ) );
|
||||
Group2->PushButton1->setIcon( iconSelect );
|
||||
Group2->PushButton2->setIcon( iconSelect );
|
||||
Group2->LineEdit1->setReadOnly( true );
|
||||
Group2->LineEdit2->setReadOnly( true );
|
||||
Group2 = new DlgRef_2Sel3Spin2Rb(centralWidget());
|
||||
Group2->GroupBox1->setTitle(tr("GEOM_FILLET_EDGES"));
|
||||
Group2->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
|
||||
Group2->TextLabel2->setText(tr("SELECTED_EDGES"));
|
||||
Group2->TextLabel3->setText(tr("GEOM_RADIUS"));
|
||||
Group2->TextLabel4->setText(tr("GEOM_R1"));
|
||||
Group2->TextLabel5->setText(tr("GEOM_R2"));
|
||||
Group2->PushButton1->setIcon(iconSelect);
|
||||
Group2->PushButton2->setIcon(iconSelect);
|
||||
Group2->LineEdit1->setReadOnly(true);
|
||||
Group2->LineEdit2->setReadOnly(true);
|
||||
|
||||
Group3 = new DlgRef_2Sel3Spin2Rb( centralWidget() );
|
||||
Group3->GroupBox1->setTitle( tr( "GEOM_FILLET_FACES" ) );
|
||||
Group3->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
|
||||
Group3->TextLabel2->setText( tr( "SELECTED_FACES" ) );
|
||||
Group3->TextLabel3->setText( tr( "GEOM_RADIUS" ) );
|
||||
Group3->TextLabel4->setText( tr( "GEOM_R1" ) );
|
||||
Group3->TextLabel5->setText( tr( "GEOM_R2" ) );
|
||||
Group3->PushButton1->setIcon( iconSelect );
|
||||
Group3->PushButton2->setIcon( iconSelect );
|
||||
Group3->LineEdit1->setReadOnly( true );
|
||||
Group3->LineEdit2->setReadOnly( true );
|
||||
Group3 = new DlgRef_2Sel3Spin2Rb(centralWidget());
|
||||
Group3->GroupBox1->setTitle(tr("GEOM_FILLET_FACES"));
|
||||
Group3->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
|
||||
Group3->TextLabel2->setText(tr("SELECTED_FACES"));
|
||||
Group3->TextLabel3->setText(tr("GEOM_RADIUS"));
|
||||
Group3->TextLabel4->setText(tr("GEOM_R1"));
|
||||
Group3->TextLabel5->setText(tr("GEOM_R2"));
|
||||
Group3->PushButton1->setIcon(iconSelect);
|
||||
Group3->PushButton2->setIcon(iconSelect);
|
||||
Group3->LineEdit1->setReadOnly(true);
|
||||
Group3->LineEdit2->setReadOnly(true);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
|
||||
layout->setMargin( 0 ); layout->setSpacing( 6 );
|
||||
layout->addWidget( Group1 );
|
||||
layout->addWidget( Group2 );
|
||||
layout->addWidget( Group3 );
|
||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||
layout->setMargin(0); layout->setSpacing(6);
|
||||
layout->addWidget(Group1);
|
||||
layout->addWidget(Group2);
|
||||
layout->addWidget(Group3);
|
||||
/***************************************************************/
|
||||
|
||||
// Set range of spinboxes
|
||||
double SpecificStep = 10.0;
|
||||
initSpinBox( Group1->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox( Group2->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox( Group2->SpinBox_DY, 0.001, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox( Group2->SpinBox_DZ, 0.001, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox( Group3->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox( Group3->SpinBox_DY, 0.001, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox( Group3->SpinBox_DZ, 0.001, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
|
||||
setHelpFileName( "fillet_operation_page.html" );
|
||||
initSpinBox(Group1->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox(Group2->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox(Group2->SpinBox_DY, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox(Group2->SpinBox_DZ, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox(Group3->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox(Group3->SpinBox_DY, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox(Group3->SpinBox_DZ, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
|
||||
/* Initialisations */
|
||||
setHelpFileName("fillet_operation_page.html");
|
||||
|
||||
// Initialisation
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~OperationGUI_FilletDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
OperationGUI_FilletDlg::~OperationGUI_FilletDlg()
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void OperationGUI_FilletDlg::Init()
|
||||
{
|
||||
myConstructorId = -1;
|
||||
reset();
|
||||
// Set Initial values of spinboxes
|
||||
Group1->SpinBox_DX->setValue(5);
|
||||
Group2->SpinBox_DX->setValue(5);
|
||||
Group2->SpinBox_DY->setValue(5);
|
||||
Group2->SpinBox_DZ->setValue(5);
|
||||
Group3->SpinBox_DX->setValue(5);
|
||||
Group3->SpinBox_DY->setValue(5);
|
||||
Group3->SpinBox_DZ->setValue(5);
|
||||
|
||||
// Clear line edits
|
||||
Group1->LineEdit1->setText("");
|
||||
Group2->LineEdit1->setText("");
|
||||
Group2->LineEdit2->setText("");
|
||||
Group3->LineEdit1->setText("");
|
||||
Group3->LineEdit2->setText("");
|
||||
|
||||
myShape = GEOM::GEOM_Object::_nil();
|
||||
|
||||
myFaces.Clear();
|
||||
myEdges.Clear();
|
||||
|
||||
// signals and slots connections
|
||||
|
||||
// main buttons
|
||||
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk() ));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
// group box
|
||||
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
|
||||
connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
|
||||
|
||||
// push buttons
|
||||
connect( Group1->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( Group2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( Group3->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( Group2->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( Group3->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(Group3->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(Group2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(Group3->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
// line edits
|
||||
connect( Group1->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( Group2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( Group3->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(Group3->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
// spin boxes
|
||||
connect( Group1->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
connect( Group2->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
connect( Group2->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
connect( Group2->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
connect( Group3->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
connect( Group3->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
connect( Group3->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
// spin boxes
|
||||
connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(Group2->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(Group2->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(Group2->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(Group3->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(Group3->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(Group3->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
|
||||
// radio buttons
|
||||
connect( Group2->RadioButton1, SIGNAL( clicked() ), this, SLOT( RadioButtonClicked() ) );
|
||||
connect( Group2->RadioButton2, SIGNAL( clicked() ), this, SLOT( RadioButtonClicked() ) );
|
||||
connect( Group3->RadioButton1, SIGNAL( clicked() ), this, SLOT( RadioButtonClicked() ) );
|
||||
connect( Group3->RadioButton2, SIGNAL( clicked() ), this, SLOT( RadioButtonClicked() ) );
|
||||
connect(Group2->RadioButton1, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
|
||||
connect(Group2->RadioButton2, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
|
||||
connect(Group3->RadioButton1, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
|
||||
connect(Group3->RadioButton2, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
|
||||
|
||||
// selection
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
initName(tr("GEOM_FILLET"));
|
||||
|
||||
initName( tr( "GEOM_FILLET" ) );
|
||||
|
||||
ConstructorsClicked( 0 );
|
||||
myConstructorId = -1;
|
||||
ConstructorsClicked(0);
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void OperationGUI_FilletDlg::ConstructorsClicked( int constructorId )
|
||||
void OperationGUI_FilletDlg::ConstructorsClicked (int constructorId)
|
||||
{
|
||||
if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
|
||||
!= OCCViewer_Viewer::Type() ) {
|
||||
mainFrame()->RadioButton1->setChecked( true );
|
||||
if (myGeomGUI->getApp()->desktop()->activeWindow()->getViewManager()->getType()
|
||||
!= OCCViewer_Viewer::Type()) {
|
||||
mainFrame()->RadioButton1->setChecked(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( myConstructorId == constructorId )
|
||||
if (myConstructorId == constructorId)
|
||||
return;
|
||||
|
||||
// Get radius from previous widget
|
||||
double R = 5, R1 = 5, R2 = 5;
|
||||
if ( myConstructorId == 0 ) {
|
||||
if (myConstructorId == 0) {
|
||||
R = Group1->SpinBox_DX->value();
|
||||
}
|
||||
else if ( myConstructorId == 1 ) {
|
||||
else if (myConstructorId == 1) {
|
||||
R = Group2->SpinBox_DX->value();
|
||||
R1 = Group2->SpinBox_DY->value();
|
||||
R2 = Group2->SpinBox_DZ->value();
|
||||
@ -217,87 +234,104 @@ void OperationGUI_FilletDlg::ConstructorsClicked( int constructorId )
|
||||
|
||||
myConstructorId = constructorId;
|
||||
|
||||
switch ( constructorId ) {
|
||||
switch (constructorId) {
|
||||
case 0:
|
||||
Group2->hide();
|
||||
Group3->hide();
|
||||
Group1->show();
|
||||
Group1->SpinBox_DX->setValue( R );
|
||||
Group1->SpinBox_DX->setValue(R);
|
||||
break;
|
||||
case 1:
|
||||
Group1->hide();
|
||||
Group3->hide();
|
||||
Group2->show();
|
||||
Group2->SpinBox_DX->setValue( R );
|
||||
Group2->SpinBox_DY->setValue( R1 );
|
||||
Group2->SpinBox_DZ->setValue( R2 );
|
||||
Group2->SpinBox_DX->setValue(R);
|
||||
Group2->SpinBox_DY->setValue(R1);
|
||||
Group2->SpinBox_DZ->setValue(R2);
|
||||
break;
|
||||
case 2:
|
||||
Group1->hide();
|
||||
Group2->hide();
|
||||
Group3->show();
|
||||
Group3->SpinBox_DX->setValue( R );
|
||||
Group3->SpinBox_DY->setValue( R1 );
|
||||
Group3->SpinBox_DZ->setValue( R2 );
|
||||
Group3->SpinBox_DX->setValue(R);
|
||||
Group3->SpinBox_DY->setValue(R1);
|
||||
Group3->SpinBox_DZ->setValue(R2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ( constructorId == 0 ) myEditCurrentArgument = Group1->LineEdit1;
|
||||
else if ( constructorId == 1 ) myEditCurrentArgument = Group2->LineEdit1;
|
||||
else myEditCurrentArgument = Group3->LineEdit1;
|
||||
if (constructorId == 0) Group1->PushButton1->click();
|
||||
else if (constructorId == 1) Group2->PushButton1->click();
|
||||
else Group3->PushButton1->click();
|
||||
|
||||
activateSelection();
|
||||
enableWidgets();
|
||||
|
||||
if ( !myShape->_is_nil() ) {
|
||||
myEditCurrentArgument->setText( GEOMBase::GetName( myShape ) );
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
if (myInitial) {
|
||||
myInitial = false;
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
else {
|
||||
if (!myShape->_is_nil()) {
|
||||
myEditCurrentArgument->setText(GEOMBase::GetName(myShape));
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
switch (getConstructorId()) {
|
||||
case 1:
|
||||
if (myEdges.Extent() == 0)
|
||||
Group2->PushButton2->click();
|
||||
break;
|
||||
case 2:
|
||||
if (myFaces.Extent() == 0)
|
||||
Group3->PushButton2->click();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
else
|
||||
myEditCurrentArgument->setText( "" );
|
||||
|
||||
qApp->processEvents();
|
||||
updateGeometry();
|
||||
resize( minimumSize() );
|
||||
|
||||
displayPreview();
|
||||
resize(minimumSize());
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void OperationGUI_FilletDlg::ClickOnOk()
|
||||
{
|
||||
if ( ClickOnApply() )
|
||||
if (ClickOnApply())
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool OperationGUI_FilletDlg::ClickOnApply()
|
||||
{
|
||||
if ( !onAccept() )
|
||||
if (!onAccept())
|
||||
return false;
|
||||
|
||||
initName();
|
||||
// activate selection and connect selection manager
|
||||
ConstructorsClicked(getConstructorId());
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection has changed
|
||||
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||
//=================================================================================
|
||||
void OperationGUI_FilletDlg::SelectionIntoArgument()
|
||||
{
|
||||
erasePreview();
|
||||
myEditCurrentArgument->setText( "" );
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
@ -308,6 +342,7 @@ void OperationGUI_FilletDlg::SelectionIntoArgument()
|
||||
myEditCurrentArgument == Group2->LineEdit1 ||
|
||||
myEditCurrentArgument == Group3->LineEdit1)
|
||||
{
|
||||
myShape = GEOM::GEOM_Object::_nil();
|
||||
if (aSelList.Extent() == 1) {
|
||||
Standard_Boolean aResult = Standard_False;
|
||||
GEOM::GEOM_Object_var anObj =
|
||||
@ -317,18 +352,17 @@ void OperationGUI_FilletDlg::SelectionIntoArgument()
|
||||
myShape = anObj;
|
||||
myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
|
||||
displayPreview();
|
||||
enableWidgets();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
myShape = GEOM::GEOM_Object::_nil();
|
||||
enableWidgets();
|
||||
}
|
||||
// If face or edge selection is activated
|
||||
else if (myEditCurrentArgument == Group2->LineEdit2 ||
|
||||
myEditCurrentArgument == Group3->LineEdit2)
|
||||
{
|
||||
if (myEditCurrentArgument == Group2->LineEdit2) myEdges.Clear();
|
||||
else myFaces.Clear();
|
||||
if (aSelList.Extent() == 1) {
|
||||
Standard_Boolean aResult = Standard_False;
|
||||
GEOM::GEOM_Object_var anObj =
|
||||
@ -343,48 +377,52 @@ void OperationGUI_FilletDlg::SelectionIntoArgument()
|
||||
if (anIndexes.Extent() == 1) {
|
||||
int anIndex = anIndexes(1);
|
||||
|
||||
aName = QString( GEOMBase::GetName( anObj ) ) + QString( ":%1" ).arg( anIndex );
|
||||
aName = QString(GEOMBase::GetName(anObj)) + QString(":%1").arg(anIndex);
|
||||
}
|
||||
else {
|
||||
aName = tr("GEOM_MEN_POPUP_NAME").arg(anIndexes.Extent());
|
||||
}
|
||||
else
|
||||
aName = tr( "GEOM_MEN_POPUP_NAME" ).arg( anIndexes.Extent() );
|
||||
|
||||
myEditCurrentArgument->setText( aName );
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if ( myConstructorId == 1 )
|
||||
if (myConstructorId == 1)
|
||||
myEdges = anIndexes;
|
||||
else
|
||||
myFaces = anIndexes;
|
||||
|
||||
displayPreview();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
myFaces.Clear();
|
||||
}
|
||||
|
||||
// clear selection
|
||||
if (!(myEditCurrentArgument == Group2->LineEdit2 ||
|
||||
myEditCurrentArgument == Group3->LineEdit2)) {
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
}
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 1:
|
||||
if (myEditCurrentArgument == Group2->LineEdit1) {
|
||||
if (!myShape->_is_nil() && myEdges.Extent() == 0)
|
||||
Group2->PushButton2->click();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (myEditCurrentArgument == Group3->LineEdit1) {
|
||||
if (!myShape->_is_nil() && myFaces.Extent() == 0)
|
||||
Group3->PushButton2->click();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void OperationGUI_FilletDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = ( QLineEdit* )sender();
|
||||
|
||||
if ( send == Group1->LineEdit1 )
|
||||
myEditCurrentArgument = Group1->LineEdit1;
|
||||
else if ( send == Group2->LineEdit1 )
|
||||
myEditCurrentArgument = Group2->LineEdit1;
|
||||
else if ( send == Group3->LineEdit1 )
|
||||
myEditCurrentArgument = Group3->LineEdit1;
|
||||
else
|
||||
return;
|
||||
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
@ -393,30 +431,61 @@ void OperationGUI_FilletDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
|
||||
if ( send == Group1->PushButton1 ) {
|
||||
Group1->LineEdit1->setFocus();
|
||||
if (send == Group1->PushButton1) {
|
||||
myEditCurrentArgument = Group1->LineEdit1;
|
||||
}
|
||||
else if ( send == Group2->PushButton1 ) {
|
||||
Group2->LineEdit1->setFocus();
|
||||
else if (send == Group2->PushButton1) {
|
||||
myEditCurrentArgument = Group2->LineEdit1;
|
||||
Group2->PushButton2->setDown(false);
|
||||
Group2->LineEdit2->setEnabled(false);
|
||||
}
|
||||
else if ( send == Group2->PushButton2 ) {
|
||||
Group2->LineEdit2->setFocus();
|
||||
else if (send == Group2->PushButton2) {
|
||||
myEditCurrentArgument = Group2->LineEdit2;
|
||||
Group2->PushButton1->setDown(false);
|
||||
Group2->LineEdit1->setEnabled(false);
|
||||
}
|
||||
else if ( send == Group3->PushButton1 ) {
|
||||
Group3->LineEdit1->setFocus();
|
||||
else if (send == Group3->PushButton1) {
|
||||
myEditCurrentArgument = Group3->LineEdit1;
|
||||
Group3->PushButton2->setDown(false);
|
||||
Group3->LineEdit2->setEnabled(false);
|
||||
}
|
||||
else if ( send == Group3->PushButton2 ) {
|
||||
Group3->LineEdit1->setFocus();
|
||||
else if (send == Group3->PushButton2) {
|
||||
myEditCurrentArgument = Group3->LineEdit2;
|
||||
Group3->PushButton1->setDown(false);
|
||||
Group3->LineEdit1->setEnabled(false);
|
||||
}
|
||||
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
|
||||
activateSelection();
|
||||
|
||||
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void OperationGUI_FilletDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
|
||||
if (send == Group1->LineEdit1)
|
||||
myEditCurrentArgument = Group1->LineEdit1;
|
||||
else if (send == Group2->LineEdit1)
|
||||
myEditCurrentArgument = Group2->LineEdit1;
|
||||
else if (send == Group3->LineEdit1)
|
||||
myEditCurrentArgument = Group3->LineEdit1;
|
||||
else
|
||||
return;
|
||||
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
@ -426,21 +495,17 @@ void OperationGUI_FilletDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
activateSelection();
|
||||
displayPreview();
|
||||
// reinit, because some selected objects could be removed
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void OperationGUI_FilletDlg::enterEvent( QEvent* )
|
||||
void OperationGUI_FilletDlg::enterEvent (QEvent*)
|
||||
{
|
||||
if ( !mainFrame()->GroupConstructors->isEnabled() )
|
||||
if (!mainFrame()->GroupConstructors->isEnabled())
|
||||
this->ActivateThisDialog();
|
||||
}
|
||||
|
||||
@ -448,71 +513,33 @@ void OperationGUI_FilletDlg::enterEvent( QEvent* )
|
||||
// function : ValueChangedInSpinBox()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void OperationGUI_FilletDlg::ValueChangedInSpinBox( double )
|
||||
void OperationGUI_FilletDlg::ValueChangedInSpinBox (double)
|
||||
{
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : reset()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void OperationGUI_FilletDlg::reset()
|
||||
{
|
||||
// Set Initial values of spinboxes
|
||||
Group1->SpinBox_DX->setValue( 5 );
|
||||
Group2->SpinBox_DX->setValue( 5 );
|
||||
Group2->SpinBox_DY->setValue( 5 );
|
||||
Group2->SpinBox_DZ->setValue( 5 );
|
||||
Group3->SpinBox_DX->setValue( 5 );
|
||||
Group3->SpinBox_DY->setValue( 5 );
|
||||
Group3->SpinBox_DZ->setValue( 5 );
|
||||
|
||||
Group1->LineEdit1->setText( "" );
|
||||
Group2->LineEdit1->setText( "" );
|
||||
Group2->LineEdit2->setText( "" );
|
||||
Group3->LineEdit1->setText( "" );
|
||||
Group3->LineEdit2->setText( "" );
|
||||
|
||||
// constructor id
|
||||
int aConstructorId = getConstructorId();
|
||||
|
||||
if ( aConstructorId == 0 ) myEditCurrentArgument = Group1->LineEdit1;
|
||||
else if ( aConstructorId == 1 ) myEditCurrentArgument = Group2->LineEdit1;
|
||||
else myEditCurrentArgument = Group3->LineEdit1;
|
||||
|
||||
myShape = GEOM::GEOM_Object::_nil();
|
||||
|
||||
myFaces.Clear();
|
||||
myEdges.Clear();
|
||||
|
||||
erasePreview( true );
|
||||
|
||||
activateSelection();
|
||||
|
||||
enableWidgets();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : activateSelection
|
||||
// purpose : Activate selection in accordance with myEditCurrentArgument
|
||||
//=================================================================================
|
||||
void OperationGUI_FilletDlg::activateSelection()
|
||||
{
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
|
||||
if ( !myShape->_is_nil() && myEditCurrentArgument == Group2->LineEdit2 )
|
||||
localSelection( myShape, TopAbs_EDGE );
|
||||
else if ( !myShape->_is_nil() && myEditCurrentArgument == Group3->LineEdit2 )
|
||||
localSelection( myShape, TopAbs_FACE );
|
||||
if (!myShape->_is_nil() && myEditCurrentArgument == Group2->LineEdit2)
|
||||
localSelection(myShape, TopAbs_EDGE);
|
||||
else if (!myShape->_is_nil() && myEditCurrentArgument == Group3->LineEdit2)
|
||||
localSelection(myShape, TopAbs_FACE);
|
||||
else {
|
||||
TColStd_MapOfInteger aMap;
|
||||
aMap.Add( GEOM_SHELL );
|
||||
aMap.Add( GEOM_SOLID );
|
||||
aMap.Add( GEOM_COMPOUND );
|
||||
globalSelection( aMap );
|
||||
aMap.Add(GEOM_SHELL);
|
||||
aMap.Add(GEOM_SOLID);
|
||||
aMap.Add(GEOM_COMPOUND);
|
||||
globalSelection(aMap);
|
||||
}
|
||||
|
||||
SelectionIntoArgument();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -525,21 +552,21 @@ void OperationGUI_FilletDlg::enableWidgets()
|
||||
|
||||
bool toEnable = !myShape->_is_nil();
|
||||
|
||||
if ( anId == 1 ) {
|
||||
Group2->LineEdit2->setEnabled( toEnable );
|
||||
Group2->PushButton2->setEnabled( toEnable );
|
||||
|
||||
if ( !toEnable ) {
|
||||
Group2->LineEdit2->setText( "" );
|
||||
if (anId == 1) {
|
||||
//Group2->LineEdit2->setEnabled(toEnable);
|
||||
Group2->PushButton2->setEnabled(toEnable);
|
||||
|
||||
if (!toEnable) {
|
||||
Group2->LineEdit2->setText("");
|
||||
myEdges.Clear();
|
||||
}
|
||||
}
|
||||
else if ( anId == 2 ) {
|
||||
Group3->LineEdit2->setEnabled( toEnable );
|
||||
Group3->PushButton2->setEnabled( toEnable );
|
||||
else if (anId == 2) {
|
||||
//Group3->LineEdit2->setEnabled(toEnable);
|
||||
Group3->PushButton2->setEnabled(toEnable);
|
||||
|
||||
if ( !toEnable ) {
|
||||
Group3->LineEdit2->setText( "" );
|
||||
if (!toEnable) {
|
||||
Group3->LineEdit2->setText("");
|
||||
myFaces.Clear();
|
||||
}
|
||||
}
|
||||
@ -551,16 +578,16 @@ void OperationGUI_FilletDlg::enableWidgets()
|
||||
//=================================================================================
|
||||
GEOM::GEOM_IOperations_ptr OperationGUI_FilletDlg::createOperation()
|
||||
{
|
||||
return getGeomEngine()->GetILocalOperations( getStudyId() );
|
||||
return getGeomEngine()->GetILocalOperations(getStudyId());
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// function : isValid()
|
||||
// purpose : Verify validity of input data
|
||||
//=================================================================================
|
||||
bool OperationGUI_FilletDlg::isValid( QString& )
|
||||
bool OperationGUI_FilletDlg::isValid (QString&)
|
||||
{
|
||||
switch ( getConstructorId() )
|
||||
switch (getConstructorId())
|
||||
{
|
||||
case 0: return !myShape->_is_nil();
|
||||
case 1: return !myShape->_is_nil() && myEdges.Extent() > 0;
|
||||
@ -573,99 +600,98 @@ bool OperationGUI_FilletDlg::isValid( QString& )
|
||||
// function : execute
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool OperationGUI_FilletDlg::execute( ObjectList& objects )
|
||||
bool OperationGUI_FilletDlg::execute (ObjectList& objects)
|
||||
{
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
int anId = getConstructorId();
|
||||
if ( anId == 0 )
|
||||
anObj = GEOM::GEOM_ILocalOperations::_narrow(
|
||||
getOperation() )->MakeFilletAll( myShape, getRadius() );
|
||||
else if ( anId == 1 ) {
|
||||
if (anId == 0)
|
||||
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
|
||||
MakeFilletAll(myShape, getRadius());
|
||||
else if (anId == 1) {
|
||||
GEOM::ListOfLong_var aList = new GEOM::ListOfLong;
|
||||
aList->length( myEdges.Extent() );
|
||||
aList->length(myEdges.Extent());
|
||||
|
||||
for ( int i = 1, n = myEdges.Extent(); i <= n; i++ )
|
||||
aList[ i - 1 ] = myEdges( i );
|
||||
for (int i = 1, n = myEdges.Extent(); i <= n; i++)
|
||||
aList[ i - 1 ] = myEdges(i);
|
||||
|
||||
if ( Group2->RadioButton1->isChecked() )
|
||||
anObj = GEOM::GEOM_ILocalOperations::_narrow( getOperation() )->
|
||||
MakeFilletEdges( myShape, getRadius(), aList );
|
||||
if (Group2->RadioButton1->isChecked())
|
||||
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
|
||||
MakeFilletEdges(myShape, getRadius(), aList);
|
||||
else
|
||||
anObj = GEOM::GEOM_ILocalOperations::_narrow( getOperation() )->
|
||||
MakeFilletEdgesR1R2( myShape,
|
||||
Group2->SpinBox_DY->value(),
|
||||
Group2->SpinBox_DZ->value(),
|
||||
aList );
|
||||
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
|
||||
MakeFilletEdgesR1R2(myShape,
|
||||
Group2->SpinBox_DY->value(),
|
||||
Group2->SpinBox_DZ->value(),
|
||||
aList);
|
||||
}
|
||||
else if ( anId == 2 ) {
|
||||
else if (anId == 2) {
|
||||
GEOM::ListOfLong_var aList = new GEOM::ListOfLong;
|
||||
aList->length( myFaces.Extent() );
|
||||
aList->length(myFaces.Extent());
|
||||
|
||||
for ( int i = 1, n = myFaces.Extent(); i <= n; i++ )
|
||||
aList[ i - 1 ] = myFaces( i );
|
||||
for (int i = 1, n = myFaces.Extent(); i <= n; i++)
|
||||
aList[ i - 1 ] = myFaces(i);
|
||||
|
||||
if ( Group3->RadioButton1->isChecked() ) {
|
||||
anObj = GEOM::GEOM_ILocalOperations::_narrow( getOperation() )->
|
||||
MakeFilletFaces( myShape, getRadius(), aList );
|
||||
if (Group3->RadioButton1->isChecked()) {
|
||||
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
|
||||
MakeFilletFaces(myShape, getRadius(), aList);
|
||||
}
|
||||
else {
|
||||
anObj = GEOM::GEOM_ILocalOperations::_narrow( getOperation() )->
|
||||
MakeFilletFacesR1R2( myShape,
|
||||
Group3->SpinBox_DY->value(),
|
||||
Group3->SpinBox_DZ->value(), aList );
|
||||
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
|
||||
MakeFilletFacesR1R2(myShape,
|
||||
Group3->SpinBox_DY->value(),
|
||||
Group3->SpinBox_DZ->value(), aList);
|
||||
}
|
||||
}
|
||||
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : getRadius
|
||||
// purpose : Get radius
|
||||
// purpose : Get radius
|
||||
//=================================================================================
|
||||
double OperationGUI_FilletDlg::getRadius() const
|
||||
{
|
||||
int anId = getConstructorId();
|
||||
if ( anId == 0 ) return Group1->SpinBox_DX->value();
|
||||
else if ( anId == 1 ) return Group2->SpinBox_DX->value();
|
||||
else return Group3->SpinBox_DX->value();
|
||||
if (anId == 0) return Group1->SpinBox_DX->value();
|
||||
else if (anId == 1) return Group2->SpinBox_DX->value();
|
||||
else return Group3->SpinBox_DX->value();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : RadiobuttonClicked
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
|
||||
void OperationGUI_FilletDlg::RadioButtonClicked()
|
||||
{
|
||||
const QObject* s = sender();
|
||||
|
||||
bool flag = s == Group2->RadioButton1 || s == Group3->RadioButton1;
|
||||
|
||||
Group2->RadioButton1->blockSignals( true );
|
||||
Group2->RadioButton2->blockSignals( true );
|
||||
Group3->RadioButton1->blockSignals( true );
|
||||
Group3->RadioButton2->blockSignals( true );
|
||||
|
||||
Group2->SpinBox_DX->setEnabled( flag );
|
||||
Group2->SpinBox_DY->setEnabled( !flag );
|
||||
Group2->SpinBox_DZ->setEnabled( !flag );
|
||||
Group2->RadioButton1->setChecked( flag );
|
||||
Group2->RadioButton2->setChecked( !flag );
|
||||
Group3->SpinBox_DX->setEnabled( flag );
|
||||
Group3->SpinBox_DY->setEnabled( !flag );
|
||||
Group3->SpinBox_DZ->setEnabled( !flag );
|
||||
Group3->RadioButton1->setChecked( flag );
|
||||
Group3->RadioButton2->setChecked( !flag );
|
||||
|
||||
Group2->RadioButton1->blockSignals( false );
|
||||
Group2->RadioButton2->blockSignals( false );
|
||||
Group3->RadioButton1->blockSignals( false );
|
||||
Group3->RadioButton2->blockSignals( false );
|
||||
Group2->RadioButton1->blockSignals(true);
|
||||
Group2->RadioButton2->blockSignals(true);
|
||||
Group3->RadioButton1->blockSignals(true);
|
||||
Group3->RadioButton2->blockSignals(true);
|
||||
|
||||
displayPreview();
|
||||
Group2->SpinBox_DX->setEnabled(flag);
|
||||
Group2->SpinBox_DY->setEnabled(!flag);
|
||||
Group2->SpinBox_DZ->setEnabled(!flag);
|
||||
Group2->RadioButton1->setChecked(flag);
|
||||
Group2->RadioButton2->setChecked(!flag);
|
||||
Group3->SpinBox_DX->setEnabled(flag);
|
||||
Group3->SpinBox_DY->setEnabled(!flag);
|
||||
Group3->SpinBox_DZ->setEnabled(!flag);
|
||||
Group3->RadioButton1->setChecked(flag);
|
||||
Group3->RadioButton2->setChecked(!flag);
|
||||
|
||||
Group2->RadioButton1->blockSignals(false);
|
||||
Group2->RadioButton2->blockSignals(false);
|
||||
Group3->RadioButton1->blockSignals(false);
|
||||
Group3->RadioButton2->blockSignals(false);
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
|
@ -65,7 +65,6 @@ private slots:
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent( QEvent* );
|
||||
void reset();
|
||||
void activateSelection();
|
||||
void enableWidgets();
|
||||
double getRadius() const;
|
||||
@ -76,6 +75,9 @@ private:
|
||||
GEOM::GEOM_Object_var myShape;
|
||||
TColStd_IndexedMapOfInteger myEdges;
|
||||
TColStd_IndexedMapOfInteger myFaces;
|
||||
|
||||
// to initialize the first selection field with a selected object on the dialog creation
|
||||
bool myInitial;
|
||||
|
||||
DlgRef_1Sel1Spin* Group1;
|
||||
DlgRef_2Sel3Spin2Rb* Group2;
|
||||
|
@ -1,21 +1,21 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
// 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.
|
||||
// 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.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
@ -25,15 +25,15 @@
|
||||
|
||||
#include "OperationGUI_GetShapesOnShapeDlg.h"
|
||||
|
||||
#include <DlgRef.h>
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
#include <DlgRef.h>
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
|
||||
//==============================================================================
|
||||
// class : OperationGUI_GetShapesOnShapeDlg()
|
||||
// purpose : Constructs a OperationGUI_GetShapesOnShapeDlg which is a child of
|
||||
@ -41,41 +41,43 @@
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
OperationGUI_GetShapesOnShapeDlg::OperationGUI_GetShapesOnShapeDlg( GeometryGUI* theGeometryGUI,
|
||||
QWidget* parent )
|
||||
: GEOMBase_Skeleton( theGeometryGUI, parent, false )
|
||||
OperationGUI_GetShapesOnShapeDlg::OperationGUI_GetShapesOnShapeDlg (GeometryGUI* theGeometryGUI,
|
||||
QWidget* parent)
|
||||
: GEOMBase_Skeleton(theGeometryGUI, parent, false)
|
||||
{
|
||||
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
||||
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_SHAPES_ON_SHAPE" ) ) );
|
||||
QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
|
||||
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_SHAPES_ON_SHAPE")));
|
||||
QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||
|
||||
setWindowTitle( tr( "GEOM_SHAPES_ON_SHAPE_TITLE" ) );
|
||||
setWindowTitle(tr("GEOM_SHAPES_ON_SHAPE_TITLE"));
|
||||
|
||||
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_SHAPES_ON_SHAPE" ) );
|
||||
/***************************************************************/
|
||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_SHAPES_ON_SHAPE"));
|
||||
mainFrame()->RadioButton1->setIcon(image0);
|
||||
mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
|
||||
mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
|
||||
mainFrame()->RadioButton2->close();
|
||||
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
|
||||
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
|
||||
mainFrame()->RadioButton3->close();
|
||||
|
||||
GroupPoints = new DlgRef_2Sel2List( centralWidget() );
|
||||
GroupPoints = new DlgRef_2Sel2List(centralWidget());
|
||||
//GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION"));
|
||||
GroupPoints->GroupBox1->setTitle( "Input data" );
|
||||
GroupPoints->TextLabel1->setText( tr( "GEOM_SHAPES_ON_SHAPE_ESHAPE" ) );
|
||||
GroupPoints->TextLabel2->setText( tr( "GEOM_SHAPES_ON_SHAPE_CSHAPE" ) );
|
||||
GroupPoints->TextLabel3->setText( tr( "GEOM_RECONSTRUCTION_LIMIT" ) );
|
||||
GroupPoints->TextLabel4->setText( tr( "GEOM_SHAPES_ON_SHAPE_STATE" ) );
|
||||
GroupPoints->PushButton1->setIcon( image2 );
|
||||
GroupPoints->PushButton2->setIcon( image2 );
|
||||
GroupPoints->LineEdit1->setReadOnly( true );
|
||||
GroupPoints->LineEdit2->setReadOnly( true );
|
||||
GroupPoints->GroupBox1->setTitle("Input data");
|
||||
GroupPoints->TextLabel1->setText(tr("GEOM_SHAPES_ON_SHAPE_ESHAPE"));
|
||||
GroupPoints->TextLabel2->setText(tr("GEOM_SHAPES_ON_SHAPE_CSHAPE"));
|
||||
GroupPoints->TextLabel3->setText(tr("GEOM_RECONSTRUCTION_LIMIT"));
|
||||
GroupPoints->TextLabel4->setText(tr("GEOM_SHAPES_ON_SHAPE_STATE"));
|
||||
GroupPoints->PushButton1->setIcon(image2);
|
||||
GroupPoints->PushButton2->setIcon(image2);
|
||||
GroupPoints->LineEdit1->setReadOnly(true);
|
||||
GroupPoints->LineEdit2->setReadOnly(true);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
|
||||
layout->setMargin( 0 ); layout->setSpacing( 6 );
|
||||
layout->addWidget( GroupPoints );
|
||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||
layout->setMargin(0); layout->setSpacing(6);
|
||||
layout->addWidget(GroupPoints);
|
||||
/***************************************************************/
|
||||
|
||||
setHelpFileName("shapesonshape_page.html");
|
||||
|
||||
setHelpFileName( "shapesonshape_page.html" );
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
@ -93,54 +95,55 @@ OperationGUI_GetShapesOnShapeDlg::~OperationGUI_GetShapesOnShapeDlg()
|
||||
//=================================================================================
|
||||
void OperationGUI_GetShapesOnShapeDlg::Init()
|
||||
{
|
||||
/* type for sub shape selection */
|
||||
GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_SOLID" ) );
|
||||
// type for sub shape selection
|
||||
GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_SOLID"));
|
||||
// commented by skl for IPAL19949 - finder isn't allowed such type
|
||||
//GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_SHELL" ) );
|
||||
GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_FACE" ) );
|
||||
//GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_SHELL"));
|
||||
GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_FACE"));
|
||||
// commented by skl for IPAL19949 - finder isn't allowed such type
|
||||
//GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_WIRE" ) );
|
||||
GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_EDGE" ) );
|
||||
GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_VERTEX" ) );
|
||||
//GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_WIRE"));
|
||||
GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_EDGE"));
|
||||
GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_VERTEX"));
|
||||
|
||||
/* type for state selection */
|
||||
GroupPoints->ComboBox2->addItem( tr( "GEOM_STATE_IN" ) );
|
||||
GroupPoints->ComboBox2->addItem( tr( "GEOM_STATE_OUT" ) );
|
||||
GroupPoints->ComboBox2->addItem( tr( "GEOM_STATE_ON" ) );
|
||||
GroupPoints->ComboBox2->addItem( tr( "GEOM_STATE_ONIN" ) );
|
||||
GroupPoints->ComboBox2->addItem( tr( "GEOM_STATE_ONOUT" ) );
|
||||
// type for state selection
|
||||
GroupPoints->ComboBox2->addItem(tr("GEOM_STATE_IN"));
|
||||
GroupPoints->ComboBox2->addItem(tr("GEOM_STATE_OUT"));
|
||||
GroupPoints->ComboBox2->addItem(tr("GEOM_STATE_ON"));
|
||||
GroupPoints->ComboBox2->addItem(tr("GEOM_STATE_ONIN"));
|
||||
GroupPoints->ComboBox2->addItem(tr("GEOM_STATE_ONOUT"));
|
||||
|
||||
GroupPoints->LineEdit1->clear();
|
||||
GroupPoints->LineEdit2->clear();
|
||||
myObject1 = myObject2 = GEOM::GEOM_Object::_nil();
|
||||
|
||||
/* signals and slots connections */
|
||||
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
|
||||
// signals and slots connections
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
|
||||
connect( GroupPoints->ComboBox1, SIGNAL( activated( int ) ), this, SLOT( ComboTextChanged() ) );
|
||||
connect( GroupPoints->ComboBox2, SIGNAL( activated( int ) ), this, SLOT( ComboTextChanged() ) );
|
||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
|
||||
connect(GroupPoints->ComboBox2, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
|
||||
|
||||
globalSelection( GEOM_ALLSHAPES );
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
initName( mainFrame()->GroupConstructors->title() );
|
||||
initName(mainFrame()->GroupConstructors->title());
|
||||
|
||||
GroupPoints->TextLabel3->show();
|
||||
GroupPoints->ComboBox1->show();
|
||||
GroupPoints->ComboBox1->setCurrentIndex( 0 );
|
||||
GroupPoints->ComboBox1->setCurrentIndex(0);
|
||||
GroupPoints->ComboBox2->show();
|
||||
GroupPoints->ComboBox2->setCurrentIndex( 0 );
|
||||
GroupPoints->ComboBox2->setCurrentIndex(0);
|
||||
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
myEditCurrentArgument->setFocus();
|
||||
globalSelection(GEOM_ALLSHAPES);
|
||||
|
||||
GroupPoints->PushButton1->click();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -149,7 +152,7 @@ void OperationGUI_GetShapesOnShapeDlg::Init()
|
||||
//=================================================================================
|
||||
void OperationGUI_GetShapesOnShapeDlg::ClickOnOk()
|
||||
{
|
||||
if ( ClickOnApply() )
|
||||
if (ClickOnApply())
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
@ -159,41 +162,57 @@ void OperationGUI_GetShapesOnShapeDlg::ClickOnOk()
|
||||
//=================================================================================
|
||||
bool OperationGUI_GetShapesOnShapeDlg::ClickOnApply()
|
||||
{
|
||||
if ( !onAccept() )
|
||||
return false;
|
||||
if (!onAccept())
|
||||
return false;
|
||||
|
||||
initName();
|
||||
// activate first line edit
|
||||
GroupPoints->PushButton1->click();
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection has changed
|
||||
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||
//=================================================================================
|
||||
void OperationGUI_GetShapesOnShapeDlg::SelectionIntoArgument()
|
||||
{
|
||||
myEditCurrentArgument->setText( "" );
|
||||
QString aString = "";
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) myObject1 = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) myObject2 = GEOM::GEOM_Object::_nil();
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);
|
||||
QString aName = "";
|
||||
int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName, true);
|
||||
|
||||
if (nbSel > 0) {
|
||||
Standard_Boolean aRes = Standard_False;
|
||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
|
||||
if (!CORBA::is_nil(aSelectedObject) && aRes && GEOMBase::IsShape(aSelectedObject)) {
|
||||
{
|
||||
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) myObject1 = aSelectedObject;
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) myObject2 = aSelectedObject;
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
// clear selection
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
myObject1 = aSelectedObject;
|
||||
if (myObject2->_is_nil())
|
||||
GroupPoints->PushButton2->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||
myObject2 = aSelectedObject;
|
||||
if (myObject1->_is_nil())
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setText( aString );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -204,11 +223,24 @@ void OperationGUI_GetShapesOnShapeDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
|
||||
if ( send == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
if (send == GroupPoints->PushButton1) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
|
||||
GroupPoints->PushButton2->setDown(false);
|
||||
GroupPoints->LineEdit2->setEnabled(false);
|
||||
}
|
||||
else if (send == GroupPoints->PushButton2) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
|
||||
GroupPoints->PushButton1->setDown(false);
|
||||
GroupPoints->LineEdit1->setEnabled(false);
|
||||
}
|
||||
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
SelectionIntoArgument();
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -218,7 +250,7 @@ void OperationGUI_GetShapesOnShapeDlg::SetEditCurrentArgument()
|
||||
void OperationGUI_GetShapesOnShapeDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if ( send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2 )
|
||||
if (send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2)
|
||||
{
|
||||
myEditCurrentArgument = send;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
@ -232,18 +264,18 @@ void OperationGUI_GetShapesOnShapeDlg::LineEditReturnPressed()
|
||||
void OperationGUI_GetShapesOnShapeDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
globalSelection( GEOM_ALLSHAPES );
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
// reinit, because some selected objects could be removed
|
||||
Init();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose : when mouse enter onto the QWidget
|
||||
//=================================================================================
|
||||
void OperationGUI_GetShapesOnShapeDlg::enterEvent(QEvent * e)
|
||||
void OperationGUI_GetShapesOnShapeDlg::enterEvent (QEvent*)
|
||||
{
|
||||
if ( !mainFrame()->GroupConstructors->isEnabled() )
|
||||
if (!mainFrame()->GroupConstructors->isEnabled())
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
@ -253,32 +285,32 @@ void OperationGUI_GetShapesOnShapeDlg::enterEvent(QEvent * e)
|
||||
//=================================================================================
|
||||
GEOM::GEOM_IOperations_ptr OperationGUI_GetShapesOnShapeDlg::createOperation()
|
||||
{
|
||||
return getGeomEngine()->GetIShapesOperations( getStudyId() );
|
||||
return getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool OperationGUI_GetShapesOnShapeDlg::isValid( QString& msg )
|
||||
bool OperationGUI_GetShapesOnShapeDlg::isValid(QString&)
|
||||
{
|
||||
//Handle(SALOME_InteractiveObject) IO = firstIObject();
|
||||
//Standard_Boolean testResult;
|
||||
//GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject( IO, testResult );
|
||||
//if ( !testResult || anObject->_is_nil() )
|
||||
//GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject(IO, testResult);
|
||||
//if (!testResult || anObject->_is_nil())
|
||||
// return false;
|
||||
|
||||
return !CORBA::is_nil( myObject1 ) && !CORBA::is_nil( myObject2 );
|
||||
return !CORBA::is_nil(myObject1) && !CORBA::is_nil(myObject2);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : execute
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool OperationGUI_GetShapesOnShapeDlg::execute( ObjectList& objects )
|
||||
bool OperationGUI_GetShapesOnShapeDlg::execute (ObjectList& objects)
|
||||
{
|
||||
int aLimit = GroupPoints->ComboBox1->currentIndex();
|
||||
switch ( aLimit )
|
||||
switch (aLimit)
|
||||
{
|
||||
case 0: aLimit = GEOM::SOLID ; break;
|
||||
case 1: aLimit = GEOM::FACE ; break;
|
||||
@ -288,7 +320,7 @@ bool OperationGUI_GetShapesOnShapeDlg::execute( ObjectList& objects )
|
||||
}
|
||||
|
||||
GEOM::shape_state aState;
|
||||
switch ( GroupPoints->ComboBox2->currentIndex() )
|
||||
switch (GroupPoints->ComboBox2->currentIndex())
|
||||
{
|
||||
case 0: aState = GEOM::ST_IN; break;
|
||||
case 1: aState = GEOM::ST_OUT; break;
|
||||
@ -298,20 +330,21 @@ bool OperationGUI_GetShapesOnShapeDlg::execute( ObjectList& objects )
|
||||
default: break;
|
||||
}
|
||||
|
||||
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::
|
||||
_narrow( getOperation() )->GetShapesOnShapeAsCompound( myObject2, myObject1,
|
||||
(CORBA::Short) aLimit,
|
||||
aState );
|
||||
GEOM::GEOM_Object_var anObj =
|
||||
GEOM::GEOM_IShapesOperations::_narrow(getOperation())->
|
||||
GetShapesOnShapeAsCompound(myObject2, myObject1,
|
||||
(CORBA::Short) aLimit,
|
||||
aState);
|
||||
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
|
||||
return objects.size();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComboTextChanged
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void OperationGUI_GetShapesOnShapeDlg::ComboTextChanged()
|
||||
{
|
||||
|
@ -1,22 +1,22 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 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.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : TransformationGUI_MirrorDlg.cxx
|
||||
@ -29,11 +29,12 @@
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
// OCCT Includes
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
@ -45,258 +46,256 @@
|
||||
|
||||
//=================================================================================
|
||||
// class : TransformationGUI_MirrorDlg()
|
||||
// purpose : Constructs a TransformationGUI_MirrorDlg which is a child of 'parent', with the
|
||||
// purpose : Constructs a TransformationGUI_MirrorDlg which is a child of 'parent', with the
|
||||
// name 'name' and widget flags set to 'f'.
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
|
||||
bool modal, Qt::WindowFlags fl )
|
||||
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
|
||||
TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
|
||||
bool modal, Qt::WindowFlags fl)
|
||||
: GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
|
||||
myInitial(true)
|
||||
{
|
||||
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_MIRROR_POINT" ) ) );
|
||||
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_MIRROR_AXE" ) ) );
|
||||
QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_MIRROR_PLANE" ) ) );
|
||||
QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
|
||||
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
||||
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MIRROR_POINT")));
|
||||
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MIRROR_AXE")));
|
||||
QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MIRROR_PLANE")));
|
||||
QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||
|
||||
setWindowTitle( tr( "GEOM_MIRROR_TITLE" ) );
|
||||
setWindowTitle(tr("GEOM_MIRROR_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_MIRROR" ) );
|
||||
mainFrame()->RadioButton1->setIcon( image0 );
|
||||
mainFrame()->RadioButton2->setIcon( image1 );
|
||||
mainFrame()->RadioButton3->setIcon( image2 );
|
||||
|
||||
GroupPoints = new DlgRef_2Sel1Spin2Check( centralWidget() );
|
||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_MIRROR"));
|
||||
mainFrame()->RadioButton1->setIcon(image0);
|
||||
mainFrame()->RadioButton2->setIcon(image1);
|
||||
mainFrame()->RadioButton3->setIcon(image2);
|
||||
|
||||
GroupPoints = new DlgRef_2Sel1Spin2Check(centralWidget());
|
||||
GroupPoints->SpinBox_DX->hide();
|
||||
GroupPoints->TextLabel3->hide();
|
||||
GroupPoints->CheckButton2->hide();
|
||||
GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
|
||||
GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
|
||||
GroupPoints->TextLabel2->setText( tr( "GEOM_POINT_MIRROR" ) );
|
||||
GroupPoints->TextLabel2->setFixedWidth( 74 );
|
||||
GroupPoints->PushButton1->setIcon( image3 );
|
||||
GroupPoints->PushButton2->setIcon( image3 );
|
||||
GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) );
|
||||
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS"));
|
||||
GroupPoints->TextLabel2->setText(tr("GEOM_POINT_MIRROR"));
|
||||
GroupPoints->TextLabel2->setFixedWidth(74);
|
||||
GroupPoints->PushButton1->setIcon(image3);
|
||||
GroupPoints->PushButton2->setIcon(image3);
|
||||
GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY"));
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
|
||||
layout->setMargin( 0 ); layout->setSpacing( 6 );
|
||||
layout->addWidget( GroupPoints );
|
||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||
layout->setMargin(0); layout->setSpacing(6);
|
||||
layout->addWidget(GroupPoints);
|
||||
/***************************************************************/
|
||||
|
||||
setHelpFileName( "mirror_operation_page.html" );
|
||||
|
||||
setHelpFileName("mirror_operation_page.html");
|
||||
|
||||
// Activate Create a Copy mode
|
||||
GroupPoints->CheckButton1->setChecked(true);
|
||||
CreateCopyModeChanged(true);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~TransformationGUI_MirrorDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
TransformationGUI_MirrorDlg::~TransformationGUI_MirrorDlg()
|
||||
{
|
||||
/* no need to delete child widgets, Qt does it all for us */
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MirrorDlg::Init()
|
||||
{
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setReadOnly( true );
|
||||
GroupPoints->LineEdit2->setReadOnly( true );
|
||||
|
||||
{
|
||||
// init variables
|
||||
GroupPoints->LineEdit1->setReadOnly(true);
|
||||
GroupPoints->LineEdit2->setReadOnly(true);
|
||||
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
|
||||
myArgument = GEOM::GEOM_Object::_nil();
|
||||
|
||||
// Activate Create a Copy mode
|
||||
GroupPoints->CheckButton1->setChecked( true );
|
||||
CreateCopyModeChanged( true );
|
||||
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
|
||||
/* signals and slots connections */
|
||||
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
|
||||
// signals and slots connections
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
|
||||
connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
|
||||
|
||||
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
|
||||
connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) );
|
||||
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
initName( tr( "GEOM_MIRROR" ) );
|
||||
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
||||
|
||||
ConstructorsClicked( 0 );
|
||||
initName(tr("GEOM_MIRROR"));
|
||||
|
||||
ConstructorsClicked(0);
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void TransformationGUI_MirrorDlg::ConstructorsClicked( int constructorId )
|
||||
void TransformationGUI_MirrorDlg::ConstructorsClicked (int constructorId)
|
||||
{
|
||||
disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
|
||||
|
||||
globalSelection();
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
|
||||
GroupPoints->LineEdit2->clear();
|
||||
myArgument = GEOM::GEOM_Object::_nil();
|
||||
|
||||
switch ( constructorId ) {
|
||||
case 0: /* mirror an object by point */
|
||||
GroupPoints->TextLabel2->setText( tr( "GEOM_POINT_MIRROR" ) );
|
||||
|
||||
switch (constructorId) {
|
||||
case 0: // mirror an object by point
|
||||
GroupPoints->TextLabel2->setText(tr("GEOM_POINT_MIRROR"));
|
||||
break;
|
||||
case 1: /* mirror an object by axe */
|
||||
GroupPoints->TextLabel2->setText( tr( "GEOM_AXE_MIRROR" ) );
|
||||
case 1: // mirror an object by axe
|
||||
GroupPoints->TextLabel2->setText(tr("GEOM_AXE_MIRROR"));
|
||||
break;
|
||||
case 2: /* mirror an object by plane */
|
||||
GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE_MIRROR" ) );
|
||||
case 2: // mirror an object by plane
|
||||
GroupPoints->TextLabel2->setText(tr("GEOM_PLANE_MIRROR"));
|
||||
break;
|
||||
}
|
||||
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
GroupPoints->PushButton1->click();
|
||||
|
||||
if (myInitial) {
|
||||
myInitial = false;
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
else {
|
||||
displayPreview();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MirrorDlg::ClickOnOk()
|
||||
{
|
||||
if ( ClickOnApply() )
|
||||
if (ClickOnApply())
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_MirrorDlg::ClickOnApply()
|
||||
{
|
||||
if ( !onAccept( GroupPoints->CheckButton1->isChecked() ) )
|
||||
if (!onAccept(GroupPoints->CheckButton1->isChecked()))
|
||||
return false;
|
||||
|
||||
|
||||
initName();
|
||||
ConstructorsClicked( getConstructorId() );
|
||||
// activate selection and connect selection manager
|
||||
ConstructorsClicked(getConstructorId());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection has changed
|
||||
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||
//=================================================================================
|
||||
void TransformationGUI_MirrorDlg::SelectionIntoArgument()
|
||||
{
|
||||
myEditCurrentArgument->setText( "" );
|
||||
QString aName;
|
||||
erasePreview();
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||
myObjects.length(0);
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||
myArgument = GEOM::GEOM_Object::_nil();
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
QString aName;
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
||||
if ( aNbSel < 1 ) {
|
||||
myObjects.length(0);
|
||||
if (aNbSel < 1)
|
||||
return;
|
||||
}
|
||||
|
||||
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
||||
if (!myObjects.length())
|
||||
return;
|
||||
if (aNbSel != 1)
|
||||
aName = tr("%1_objects").arg(aNbSel);
|
||||
else
|
||||
myEditCurrentArgument->setText(aName);
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||
if (aSelList.Extent() != 1) {
|
||||
myArgument = GEOM::GEOM_Object::_nil();
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
}
|
||||
|
||||
// nbSel == 1
|
||||
Standard_Boolean testResult = Standard_False;
|
||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
||||
myArgument = aSelectedObject;
|
||||
myArgument = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
||||
if (!testResult || CORBA::is_nil(myArgument))
|
||||
return;
|
||||
|
||||
aName = GEOMBase::GetName(aSelectedObject);
|
||||
|
||||
if (testResult && !aSelectedObject->_is_nil()) {
|
||||
aName = GEOMBase::GetName(myArgument);
|
||||
|
||||
if (testResult && !myArgument->_is_nil()) {
|
||||
TopoDS_Shape aShape;
|
||||
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
|
||||
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
|
||||
if ( getConstructorId() == 1 )
|
||||
aNeedType = TopAbs_EDGE;
|
||||
else if ( getConstructorId() == 2 )
|
||||
aNeedType = TopAbs_FACE;
|
||||
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
||||
if ( aMap.Extent() == 1 ) {
|
||||
int anIndex = aMap( 1 );
|
||||
if ( aNeedType == TopAbs_VERTEX )
|
||||
aName += QString( ":vertex_%1" ).arg( anIndex );
|
||||
else
|
||||
aName += QString( ":edge_%1" ).arg( anIndex );
|
||||
|
||||
//Find SubShape Object in Father
|
||||
GEOM::GEOM_Object_var aFindedObject = findObjectInFather( aSelectedObject, aName );
|
||||
|
||||
if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
|
||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||
getGeomEngine()->GetIShapesOperations( getStudyId() );
|
||||
myArgument = aShapesOp->GetSubShape( aSelectedObject, anIndex );
|
||||
}
|
||||
else {
|
||||
myArgument = aFindedObject; // get Object from study
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( aShape.ShapeType() != aNeedType ) {
|
||||
myArgument = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
}
|
||||
}
|
||||
if (GEOMBase::GetShape(myArgument, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
|
||||
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
|
||||
if (getConstructorId() == 1)
|
||||
aNeedType = TopAbs_EDGE;
|
||||
else if (getConstructorId() == 2)
|
||||
aNeedType = TopAbs_FACE;
|
||||
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
||||
if (aMap.Extent() == 1) {
|
||||
int anIndex = aMap(1);
|
||||
if (aNeedType == TopAbs_VERTEX)
|
||||
aName += QString(":vertex_%1").arg(anIndex);
|
||||
else
|
||||
aName += QString(":edge_%1").arg(anIndex);
|
||||
|
||||
//Find SubShape Object in Father
|
||||
GEOM::GEOM_Object_var aFindedObject = findObjectInFather(myArgument, aName);
|
||||
|
||||
if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
|
||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||
myArgument = aShapesOp->GetSubShape(myArgument, anIndex);
|
||||
}
|
||||
else {
|
||||
myArgument = aFindedObject; // get Object from study
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aShape.ShapeType() != aNeedType) {
|
||||
myArgument = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (!myArgument->_is_nil() && !myObjects.length())
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
myEditCurrentArgument->setText( aName );
|
||||
|
||||
displayPreview();
|
||||
|
||||
// clear selection
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MirrorDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if ( send == GroupPoints->LineEdit1 ||
|
||||
send == GroupPoints->LineEdit2 ) {
|
||||
myEditCurrentArgument = send;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
@ -304,30 +303,60 @@ void TransformationGUI_MirrorDlg::LineEditReturnPressed()
|
||||
void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
globalSelection();
|
||||
|
||||
if ( send == GroupPoints->PushButton1 ) {
|
||||
|
||||
if (send == GroupPoints->PushButton1) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
|
||||
GroupPoints->PushButton2->setDown(false);
|
||||
GroupPoints->LineEdit2->setEnabled(false);
|
||||
}
|
||||
else if ( send == GroupPoints->PushButton2 ) {
|
||||
else if (send == GroupPoints->PushButton2) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
switch ( getConstructorId() ) {
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||
break;
|
||||
case 1:
|
||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||
break;
|
||||
case 2:
|
||||
globalSelection( GEOM_PLANE );
|
||||
globalSelection(GEOM_PLANE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GroupPoints->PushButton1->setDown(false);
|
||||
GroupPoints->LineEdit1->setEnabled(false);
|
||||
}
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
SelectionIntoArgument();
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
|
||||
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MirrorDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if (send == GroupPoints->LineEdit1 ||
|
||||
send == GroupPoints->LineEdit2) {
|
||||
myEditCurrentArgument = send;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
@ -336,118 +365,116 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
|
||||
void TransformationGUI_MirrorDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
ConstructorsClicked( getConstructorId() );
|
||||
}
|
||||
|
||||
// reinit, because some selected objects could be removed
|
||||
Init();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose : when mouse enter onto the QWidget
|
||||
//=================================================================================
|
||||
void TransformationGUI_MirrorDlg::enterEvent( QEvent* )
|
||||
void TransformationGUI_MirrorDlg::enterEvent (QEvent*)
|
||||
{
|
||||
if ( !mainFrame()->GroupConstructors->isEnabled() )
|
||||
if (!mainFrame()->GroupConstructors->isEnabled())
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : createOperation
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
GEOM::GEOM_IOperations_ptr TransformationGUI_MirrorDlg::createOperation()
|
||||
{
|
||||
return getGeomEngine()->GetITransformOperations( getStudyId() );
|
||||
return getGeomEngine()->GetITransformOperations(getStudyId());
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_MirrorDlg::isValid( QString& /*msg*/ )
|
||||
bool TransformationGUI_MirrorDlg::isValid (QString& /*msg*/)
|
||||
{
|
||||
return !( myObjects.length() == 0 || myArgument->_is_nil() );
|
||||
return !(myObjects.length() == 0 || myArgument->_is_nil());
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : execute
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_MirrorDlg::execute( ObjectList& objects )
|
||||
bool TransformationGUI_MirrorDlg::execute (ObjectList& objects)
|
||||
{
|
||||
bool res = false;
|
||||
bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
|
||||
|
||||
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
switch ( getConstructorId() ) {
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
{
|
||||
if ( toCreateCopy ) {
|
||||
for ( int i = 0; i < myObjects.length(); i++ ) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
|
||||
MirrorPointCopy( myObjects[i], myArgument );
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
}
|
||||
if (toCreateCopy) {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
MirrorPointCopy(myObjects[i], myArgument);
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
else {
|
||||
for ( int i = 0; i < myObjects.length(); i++ ) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
|
||||
MirrorPoint( myObjects[i], myArgument );
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
}
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
MirrorPoint(myObjects[i], myArgument);
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if ( toCreateCopy ) {
|
||||
for ( int i = 0; i < myObjects.length(); i++ ) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
|
||||
MirrorAxisCopy( myObjects[i], myArgument );
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
}
|
||||
if (toCreateCopy) {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
MirrorAxisCopy(myObjects[i], myArgument);
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
else {
|
||||
for ( int i = 0; i < myObjects.length(); i++ ) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
|
||||
MirrorAxis( myObjects[i], myArgument );
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
}
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
MirrorAxis(myObjects[i], myArgument);
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if ( toCreateCopy ) {
|
||||
for ( int i = 0; i < myObjects.length(); i++ ) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlaneCopy( myObjects[i], myArgument );
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
}
|
||||
if (toCreateCopy) {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
MirrorPlaneCopy(myObjects[i], myArgument);
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
else {
|
||||
for ( int i = 0; i < myObjects.length(); i++ ) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlane( myObjects[i], myArgument );
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
}
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
MirrorPlane(myObjects[i], myArgument);
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -455,14 +482,14 @@ bool TransformationGUI_MirrorDlg::execute( ObjectList& objects )
|
||||
// function : restoreSubShapes
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MirrorDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy,
|
||||
SALOMEDS::SObject_ptr theSObject )
|
||||
void TransformationGUI_MirrorDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
||||
SALOMEDS::SObject_ptr theSObject)
|
||||
{
|
||||
if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) {
|
||||
if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
|
||||
// empty list of arguments means that all arguments should be restored
|
||||
getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(),
|
||||
/*theFindMethod=*/GEOM::FSM_Transformed,
|
||||
/*theInheritFirstArg=*/true );
|
||||
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
|
||||
/*theFindMethod=*/GEOM::FSM_Transformed,
|
||||
/*theInheritFirstArg=*/true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -470,9 +497,9 @@ void TransformationGUI_MirrorDlg::restoreSubShapes( SALOMEDS::Study_ptr theStu
|
||||
// function : CreateCopyModeChanged()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MirrorDlg::CreateCopyModeChanged( bool isCreateCopy )
|
||||
void TransformationGUI_MirrorDlg::CreateCopyModeChanged (bool isCreateCopy)
|
||||
{
|
||||
mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
|
||||
mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -482,10 +509,10 @@ void TransformationGUI_MirrorDlg::CreateCopyModeChanged( bool isCreateCopy )
|
||||
void TransformationGUI_MirrorDlg::addSubshapesToStudy()
|
||||
{
|
||||
bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
|
||||
if ( toCreateCopy ) {
|
||||
if (toCreateCopy) {
|
||||
QMap<QString, GEOM::GEOM_Object_var> objMap;
|
||||
|
||||
switch ( getConstructorId() ) {
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
objMap[GroupPoints->LineEdit2->text()] = myArgument;
|
||||
break;
|
||||
@ -495,6 +522,6 @@ void TransformationGUI_MirrorDlg::addSubshapesToStudy()
|
||||
case 2:
|
||||
return;
|
||||
}
|
||||
addSubshapesToFather( objMap );
|
||||
addSubshapesToFather(objMap);
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,9 @@ private:
|
||||
private:
|
||||
GEOM::GEOM_Object_var myArgument;
|
||||
GEOM::ListOfGO myObjects;
|
||||
|
||||
// to initialize the first selection field with a selected object on the dialog creation
|
||||
bool myInitial;
|
||||
|
||||
DlgRef_2Sel1Spin2Check* GroupPoints;
|
||||
|
||||
|
@ -1,22 +1,22 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 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.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : TransformationGUI_MultiRotationDlg.cxx
|
||||
@ -29,11 +29,12 @@
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
// OCCT Includes
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
@ -45,65 +46,65 @@
|
||||
|
||||
//=================================================================================
|
||||
// class : TransformationGUI_MultiRotationDlg()
|
||||
// purpose : Constructs a TransformationGUI_MultiRotationDlg which is a child of 'parent', with the
|
||||
// purpose : Constructs a TransformationGUI_MultiRotationDlg which is a child of 'parent', with the
|
||||
// name 'name' and widget flags set to 'f'.
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg
|
||||
( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
|
||||
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
|
||||
(GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
|
||||
: GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
|
||||
myInitial(true)
|
||||
{
|
||||
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
||||
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_MULTIROTATION_SIMPLE" ) ) );
|
||||
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_MULTIROTATION_DOUBLE" ) ) );
|
||||
QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
|
||||
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTIROTATION_SIMPLE")));
|
||||
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTIROTATION_DOUBLE")));
|
||||
QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||
|
||||
setWindowTitle( tr( "GEOM_MULTIROTATION_TITLE" ) );
|
||||
setWindowTitle(tr("GEOM_MULTIROTATION_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_MULTIROTATION" ) );
|
||||
mainFrame()->RadioButton1->setIcon( image0 );
|
||||
mainFrame()->RadioButton2->setIcon( image1 );
|
||||
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
|
||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_MULTIROTATION"));
|
||||
mainFrame()->RadioButton1->setIcon(image0);
|
||||
mainFrame()->RadioButton2->setIcon(image1);
|
||||
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
|
||||
mainFrame()->RadioButton3->close();
|
||||
|
||||
GroupPoints = new DlgRef_2Sel1Spin( centralWidget() );
|
||||
GroupPoints->GroupBox1->setTitle( tr( "GEOM_MULTIROTATION_SIMPLE" ) );
|
||||
GroupPoints->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
|
||||
GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) );
|
||||
GroupPoints->TextLabel3->setText( tr( "GEOM_NB_TIMES" ) );
|
||||
GroupPoints->PushButton1->setIcon( image2 );
|
||||
GroupPoints->PushButton2->setIcon( image2 );
|
||||
GroupPoints->LineEdit1->setReadOnly( true );
|
||||
GroupPoints->LineEdit2->setReadOnly( true );
|
||||
GroupPoints = new DlgRef_2Sel1Spin(centralWidget());
|
||||
GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_SIMPLE"));
|
||||
GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
|
||||
GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
|
||||
GroupPoints->TextLabel3->setText(tr("GEOM_NB_TIMES"));
|
||||
GroupPoints->PushButton1->setIcon(image2);
|
||||
GroupPoints->PushButton2->setIcon(image2);
|
||||
GroupPoints->LineEdit1->setReadOnly(true);
|
||||
GroupPoints->LineEdit2->setReadOnly(true);
|
||||
|
||||
GroupDimensions = new DlgRef_2Sel4Spin1Check( centralWidget() );
|
||||
GroupDimensions->GroupBox1->setTitle( tr( "GEOM_MULTIROTATION_DOUBLE" ) );
|
||||
GroupDimensions->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
|
||||
GroupDimensions->TextLabel2->setText( tr( "GEOM_VECTOR" ) );
|
||||
GroupDimensions->TextLabel3->setText( tr( "GEOM_ANGLE" ) );
|
||||
GroupDimensions->TextLabel4->setText( tr( "GEOM_NB_TIMES" ) );
|
||||
GroupDimensions->TextLabel5->setText( tr( "GEOM_STEP" ) );
|
||||
GroupDimensions->TextLabel6->setText( tr( "GEOM_NB_TIMES" ) );
|
||||
GroupDimensions->CheckButton1->setText( tr( "GEOM_REVERSE" ) );
|
||||
GroupDimensions->PushButton1->setIcon( image2 );
|
||||
GroupDimensions->PushButton2->setIcon( image2 );
|
||||
GroupDimensions->LineEdit1->setReadOnly( true );
|
||||
GroupDimensions->LineEdit2->setReadOnly( true );
|
||||
GroupDimensions = new DlgRef_2Sel4Spin1Check(centralWidget());
|
||||
GroupDimensions->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_DOUBLE"));
|
||||
GroupDimensions->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
|
||||
GroupDimensions->TextLabel2->setText(tr("GEOM_VECTOR"));
|
||||
GroupDimensions->TextLabel3->setText(tr("GEOM_ANGLE"));
|
||||
GroupDimensions->TextLabel4->setText(tr("GEOM_NB_TIMES"));
|
||||
GroupDimensions->TextLabel5->setText(tr("GEOM_STEP"));
|
||||
GroupDimensions->TextLabel6->setText(tr("GEOM_NB_TIMES"));
|
||||
GroupDimensions->CheckButton1->setText(tr("GEOM_REVERSE"));
|
||||
GroupDimensions->PushButton1->setIcon(image2);
|
||||
GroupDimensions->PushButton2->setIcon(image2);
|
||||
GroupDimensions->LineEdit1->setReadOnly(true);
|
||||
GroupDimensions->LineEdit2->setReadOnly(true);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
|
||||
layout->setMargin( 0 ); layout->setSpacing( 6 );
|
||||
layout->addWidget( GroupPoints );
|
||||
layout->addWidget( GroupDimensions );
|
||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||
layout->setMargin(0); layout->setSpacing(6);
|
||||
layout->addWidget(GroupPoints);
|
||||
layout->addWidget(GroupDimensions);
|
||||
/***************************************************************/
|
||||
|
||||
setHelpFileName( "multi_rotation_operation_page.html" );
|
||||
setHelpFileName("multi_rotation_operation_page.html");
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~TransformationGUI_MultiRotationDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
@ -113,73 +114,80 @@ TransformationGUI_MultiRotationDlg::~TransformationGUI_MultiRotationDlg()
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiRotationDlg::Init()
|
||||
{
|
||||
/* Get setting of step value from file configuration */
|
||||
// Get setting of step value from file configuration
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
|
||||
double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
|
||||
|
||||
double SpecificStep1 = 5;
|
||||
double SpecificStep2 = 1;
|
||||
/* min, max, step and decimals for spin boxes & initial values */
|
||||
initSpinBox( GroupPoints->SpinBox_DX, 1.0, MAX_NUMBER, SpecificStep2, 10 );
|
||||
GroupPoints->SpinBox_DX->setValue( myNbTimes1 );
|
||||
// min, max, step and decimals for spin boxes & initial values
|
||||
initSpinBox(GroupPoints->SpinBox_DX, 1.0, MAX_NUMBER, SpecificStep2, 10);
|
||||
GroupPoints->SpinBox_DX->setValue(myNbTimes1);
|
||||
|
||||
initSpinBox( GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, 10 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox( GroupDimensions->SpinBox_DY1, 1.0, MAX_NUMBER, SpecificStep2, 10 );
|
||||
initSpinBox( GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, 10 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox( GroupDimensions->SpinBox_DY2, 1.0, MAX_NUMBER, SpecificStep2, 10 );
|
||||
GroupDimensions->SpinBox_DX1->setValue( myAng );
|
||||
GroupDimensions->SpinBox_DY1->setValue( myNbTimes1 );
|
||||
GroupDimensions->SpinBox_DX2->setValue( myStep );
|
||||
GroupDimensions->SpinBox_DY2->setValue( myNbTimes2 );
|
||||
initSpinBox(GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, 10); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox(GroupDimensions->SpinBox_DY1, 1.0, MAX_NUMBER, SpecificStep2, 10);
|
||||
initSpinBox(GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, 10); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox(GroupDimensions->SpinBox_DY2, 1.0, MAX_NUMBER, SpecificStep2, 10);
|
||||
GroupDimensions->SpinBox_DX1->setValue(myAng);
|
||||
GroupDimensions->SpinBox_DY1->setValue(myNbTimes1);
|
||||
GroupDimensions->SpinBox_DX2->setValue(myStep);
|
||||
GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);
|
||||
|
||||
/* signals and slots connections */
|
||||
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
|
||||
// init variables
|
||||
myAng = 45.0;
|
||||
myStep = 50.0;
|
||||
myNbTimes1 = myNbTimes2 = 2;
|
||||
|
||||
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
|
||||
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( GroupDimensions->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( GroupDimensions->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
GroupDimensions->LineEdit1->setText("");
|
||||
GroupDimensions->LineEdit2->setText("");
|
||||
|
||||
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( GroupDimensions->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( GroupDimensions->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
myBase = myVector = GEOM::GEOM_Object::_nil();
|
||||
|
||||
connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
connect( GroupDimensions->SpinBox_DX1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
connect( GroupDimensions->SpinBox_DY1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
connect( GroupDimensions->SpinBox_DX2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
connect( GroupDimensions->SpinBox_DY2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
// signals and slots connections
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
|
||||
connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
|
||||
|
||||
connect( GroupDimensions->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseAngle() ) );
|
||||
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
initName( tr( "GEOM_MULTIROTATION" ) );
|
||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
ConstructorsClicked( 0 );
|
||||
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
|
||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
|
||||
|
||||
connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle()));
|
||||
|
||||
initName(tr("GEOM_MULTIROTATION"));
|
||||
|
||||
ConstructorsClicked(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetDoubleSpinBoxStep()
|
||||
// purpose : Double spin box management
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiRotationDlg::SetDoubleSpinBoxStep( double step )
|
||||
void TransformationGUI_MultiRotationDlg::SetDoubleSpinBoxStep (double step)
|
||||
{
|
||||
GroupPoints->SpinBox_DX->setSingleStep(step);
|
||||
GroupDimensions->SpinBox_DX1->setSingleStep(step);
|
||||
@ -192,160 +200,178 @@ void TransformationGUI_MultiRotationDlg::SetDoubleSpinBoxStep( double step )
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiRotationDlg::ConstructorsClicked( int constructorId )
|
||||
void TransformationGUI_MultiRotationDlg::ConstructorsClicked (int constructorId)
|
||||
{
|
||||
disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
|
||||
myAng = 45.0;
|
||||
myStep = 50.0;
|
||||
myNbTimes1 = myNbTimes2 = 2;
|
||||
|
||||
globalSelection( GEOM_ALLSHAPES );
|
||||
|
||||
switch ( constructorId ) {
|
||||
case 0: /* Rotate simple */
|
||||
switch (constructorId) {
|
||||
case 0: // Rotate simple
|
||||
{
|
||||
GroupDimensions->hide();
|
||||
GroupPoints->show();
|
||||
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setText( "" );
|
||||
GroupPoints->LineEdit2->setText( "" );
|
||||
|
||||
GroupPoints->SpinBox_DX->setValue( myNbTimes1 );
|
||||
|
||||
break;
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
myBase = myVector = GEOM::GEOM_Object::_nil();
|
||||
|
||||
GroupPoints->SpinBox_DX->setValue(myNbTimes1);
|
||||
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
case 1: /* Rotate double */
|
||||
break;
|
||||
case 1: // Rotate double
|
||||
{
|
||||
GroupPoints->hide();
|
||||
GroupDimensions->show();
|
||||
|
||||
myEditCurrentArgument = GroupDimensions->LineEdit1;
|
||||
GroupDimensions->LineEdit1->setText( "" );
|
||||
GroupDimensions->LineEdit2->setText( "" );
|
||||
|
||||
GroupDimensions->SpinBox_DX1->setValue( myAng );
|
||||
GroupDimensions->SpinBox_DY1->setValue( myNbTimes1 );
|
||||
GroupDimensions->SpinBox_DX2->setValue( myStep );
|
||||
GroupDimensions->SpinBox_DY2->setValue( myNbTimes2 );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
GroupDimensions->LineEdit1->setText("");
|
||||
GroupDimensions->LineEdit2->setText("");
|
||||
myBase = myVector = GEOM::GEOM_Object::_nil();
|
||||
|
||||
GroupDimensions->SpinBox_DX1->setValue(myAng);
|
||||
GroupDimensions->SpinBox_DY1->setValue(myNbTimes1);
|
||||
GroupDimensions->SpinBox_DX2->setValue(myStep);
|
||||
GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);
|
||||
|
||||
GroupDimensions->PushButton1->click();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
qApp->processEvents();
|
||||
updateGeometry();
|
||||
resize( minimumSize() );
|
||||
resize(minimumSize());
|
||||
|
||||
myEditCurrentArgument->setFocus();
|
||||
myBase = myVector = GEOM::GEOM_Object::_nil();
|
||||
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
|
||||
this, SLOT( SelectionIntoArgument() ) );
|
||||
if (myInitial) {
|
||||
myInitial = false;
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
else {
|
||||
displayPreview();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiRotationDlg::ClickOnOk()
|
||||
{
|
||||
if ( ClickOnApply() )
|
||||
if (ClickOnApply())
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_MultiRotationDlg::ClickOnApply()
|
||||
{
|
||||
if ( !onAccept() )
|
||||
if (!onAccept())
|
||||
return false;
|
||||
|
||||
|
||||
initName();
|
||||
ConstructorsClicked( getConstructorId() );
|
||||
// activate selection and connect selection manager
|
||||
ConstructorsClicked(getConstructorId());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection as changed or other case
|
||||
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
|
||||
{
|
||||
myEditCurrentArgument->setText( "" );
|
||||
erasePreview();
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit1)
|
||||
myBase = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit2)
|
||||
myVector = GEOM::GEOM_Object::_nil();
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
if ( aSelList.Extent() != 1 ) {
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit1 )
|
||||
myBase = GEOM::GEOM_Object::_nil();
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit2 )
|
||||
myVector = GEOM::GEOM_Object::_nil();
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
}
|
||||
|
||||
// nbSel == 1
|
||||
Standard_Boolean testResult = Standard_False;;
|
||||
GEOM::GEOM_Object_var aSelectedObject =
|
||||
GEOMBase::ConvertIOinGEOMObject( aSelList.First(), testResult );
|
||||
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
||||
|
||||
if ( !testResult || CORBA::is_nil( aSelectedObject) || !GEOMBase::IsShape( aSelectedObject ) )
|
||||
if (!testResult || CORBA::is_nil(aSelectedObject) || !GEOMBase::IsShape(aSelectedObject))
|
||||
return;
|
||||
|
||||
QString aName = GEOMBase::GetName( aSelectedObject );
|
||||
QString aName = GEOMBase::GetName(aSelectedObject);
|
||||
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit1 )
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit1)
|
||||
myBase = aSelectedObject;
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit2 ) {
|
||||
if ( testResult && !aSelectedObject->_is_nil() ) {
|
||||
TopoDS_Shape aShape;
|
||||
|
||||
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
aSelMgr->GetIndexes( aSelList.First(), aMap );
|
||||
if ( aMap.Extent() == 1 ) {
|
||||
int anIndex = aMap( 1 );
|
||||
aName += QString( ":edge_%1" ).arg( anIndex );
|
||||
|
||||
//Find SubShape Object in Father
|
||||
GEOM::GEOM_Object_var aFindedObject = findObjectInFather( aSelectedObject, aName );
|
||||
|
||||
if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
|
||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||
getGeomEngine()->GetIShapesOperations( getStudyId() );
|
||||
myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||
}
|
||||
else {
|
||||
myVector = aFindedObject; // get existing object
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( aShape.ShapeType() != TopAbs_EDGE ) {
|
||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
}
|
||||
myVector = aSelectedObject;
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit2) {
|
||||
TopoDS_Shape aShape;
|
||||
|
||||
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
||||
if (aMap.Extent() == 1) {
|
||||
int anIndex = aMap(1);
|
||||
aName += QString(":edge_%1").arg(anIndex);
|
||||
|
||||
//Find SubShape Object in Father
|
||||
GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
|
||||
|
||||
if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
|
||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||
myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||
}
|
||||
else {
|
||||
myVector = aFindedObject; // get existing object
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aShape.ShapeType() != TopAbs_EDGE) {
|
||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
}
|
||||
myVector = aSelectedObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
myEditCurrentArgument->setText( aName );
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
if (!myBase->_is_nil() && myVector->_is_nil())
|
||||
GroupPoints->PushButton2->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||
if (!myVector->_is_nil() && myBase->_is_nil())
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupDimensions->LineEdit1) {
|
||||
if (!myBase->_is_nil() && myVector->_is_nil())
|
||||
GroupDimensions->PushButton2->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupDimensions->LineEdit2) {
|
||||
if (!myVector->_is_nil() && myBase->_is_nil())
|
||||
GroupDimensions->PushButton1->click();
|
||||
}
|
||||
|
||||
// clear selection
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
@ -353,27 +379,50 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
|
||||
void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
globalSelection( GEOM_ALLSHAPES );
|
||||
|
||||
if ( send == GroupPoints->PushButton1 ) {
|
||||
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
globalSelection(GEOM_ALLSHAPES);
|
||||
|
||||
if (send == GroupPoints->PushButton1) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
|
||||
GroupPoints->PushButton2->setDown(false);
|
||||
GroupPoints->LineEdit2->setEnabled(false);
|
||||
}
|
||||
else if ( send == GroupPoints->PushButton2 ) {
|
||||
else if (send == GroupPoints->PushButton2) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
|
||||
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||
|
||||
GroupPoints->PushButton1->setDown(false);
|
||||
GroupPoints->LineEdit1->setEnabled(false);
|
||||
}
|
||||
else if ( send == GroupDimensions->PushButton1 ) {
|
||||
else if (send == GroupDimensions->PushButton1) {
|
||||
myEditCurrentArgument = GroupDimensions->LineEdit1;
|
||||
|
||||
GroupDimensions->PushButton2->setDown(false);
|
||||
GroupDimensions->LineEdit2->setEnabled(false);
|
||||
}
|
||||
else if ( send == GroupDimensions->PushButton2 ) {
|
||||
else if (send == GroupDimensions->PushButton2) {
|
||||
myEditCurrentArgument = GroupDimensions->LineEdit2;
|
||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
|
||||
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||
|
||||
GroupDimensions->PushButton1->setDown(false);
|
||||
GroupDimensions->LineEdit1->setEnabled(false);
|
||||
}
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
|
||||
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
@ -382,14 +431,13 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
|
||||
void TransformationGUI_MultiRotationDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if ( send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 ||
|
||||
send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 ) {
|
||||
myEditCurrentArgument = send;
|
||||
if (send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 ||
|
||||
send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2) {
|
||||
myEditCurrentArgument = send;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -397,45 +445,41 @@ void TransformationGUI_MultiRotationDlg::LineEditReturnPressed()
|
||||
void TransformationGUI_MultiRotationDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
ConstructorsClicked( getConstructorId() );
|
||||
}
|
||||
|
||||
// reinit, because some selected objects could be removed
|
||||
Init();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiRotationDlg::enterEvent( QEvent* )
|
||||
void TransformationGUI_MultiRotationDlg::enterEvent (QEvent*)
|
||||
{
|
||||
if ( !mainFrame()->GroupConstructors->isEnabled() )
|
||||
if (!mainFrame()->GroupConstructors->isEnabled())
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ValueChangedInSpinBox()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox( double newValue )
|
||||
void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox (double newValue)
|
||||
{
|
||||
QObject* send = (QObject*)sender();
|
||||
|
||||
if ( send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1 )
|
||||
if (send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1)
|
||||
myNbTimes1 = (int)newValue;
|
||||
else if ( send == GroupDimensions->SpinBox_DX1 )
|
||||
else if (send == GroupDimensions->SpinBox_DX1)
|
||||
myAng = newValue;
|
||||
else if ( send == GroupDimensions->SpinBox_DX2 )
|
||||
else if (send == GroupDimensions->SpinBox_DX2)
|
||||
myStep = newValue;
|
||||
else if ( send == GroupDimensions->SpinBox_DY2 )
|
||||
else if (send == GroupDimensions->SpinBox_DY2)
|
||||
myNbTimes2 = (int)newValue;
|
||||
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ReverseAngle()
|
||||
// purpose : 'state' not used here
|
||||
@ -446,64 +490,62 @@ void TransformationGUI_MultiRotationDlg::ReverseAngle()
|
||||
|
||||
int aConstructorId = getConstructorId();
|
||||
|
||||
if ( aConstructorId == 0 )
|
||||
GroupPoints->SpinBox_DX->setValue( myAng );
|
||||
else if ( aConstructorId == 1 )
|
||||
GroupDimensions->SpinBox_DX1->setValue( myAng );
|
||||
if (aConstructorId == 0)
|
||||
GroupPoints->SpinBox_DX->setValue(myAng);
|
||||
else if (aConstructorId == 1)
|
||||
GroupDimensions->SpinBox_DX1->setValue(myAng);
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : createOperation
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation()
|
||||
{
|
||||
return myGeomGUI->GetGeomGen()->GetITransformOperations( getStudyId() );
|
||||
return getGeomEngine()->GetITransformOperations(getStudyId());
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_MultiRotationDlg::isValid( QString& /*msg*/ )
|
||||
bool TransformationGUI_MultiRotationDlg::isValid (QString& /*msg*/)
|
||||
{
|
||||
return !( myBase->_is_nil() || myVector->_is_nil() );
|
||||
return !(myBase->_is_nil() || myVector->_is_nil());
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : execute
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects )
|
||||
bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects)
|
||||
{
|
||||
bool res = false;
|
||||
|
||||
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
switch ( getConstructorId() ) {
|
||||
case 0 :
|
||||
if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) ) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
|
||||
MultiRotate1D( myBase, myVector, myNbTimes1 );
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
MultiRotate1D(myBase, myVector, myNbTimes1);
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
case 1 :
|
||||
if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) ) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
|
||||
MultiRotate2D( myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2 );
|
||||
case 1:
|
||||
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
MultiRotate2D(myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2);
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
|
||||
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -514,8 +556,8 @@ bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects )
|
||||
void TransformationGUI_MultiRotationDlg::addSubshapesToStudy()
|
||||
{
|
||||
QMap<QString, GEOM::GEOM_Object_var> objMap;
|
||||
|
||||
switch ( getConstructorId() ) {
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
objMap[GroupPoints->LineEdit2->text()] = myVector;
|
||||
break;
|
||||
@ -523,5 +565,5 @@ void TransformationGUI_MultiRotationDlg::addSubshapesToStudy()
|
||||
objMap[GroupDimensions->LineEdit2->text()] = myVector;
|
||||
break;
|
||||
}
|
||||
addSubshapesToFather( objMap );
|
||||
addSubshapesToFather(objMap);
|
||||
}
|
||||
|
@ -61,6 +61,9 @@ private:
|
||||
int myNbTimes2;
|
||||
Standard_Real myAng;
|
||||
Standard_Real myStep;
|
||||
|
||||
// to initialize the first selection field with a selected object on the dialog creation
|
||||
bool myInitial;
|
||||
|
||||
DlgRef_2Sel1Spin* GroupPoints;
|
||||
DlgRef_2Sel4Spin1Check* GroupDimensions;
|
||||
|
@ -1,22 +1,22 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 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.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : TransformationGUI_MultiTranslationDlg.cxx
|
||||
@ -29,11 +29,12 @@
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
// OCCT Includes
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
@ -45,71 +46,71 @@
|
||||
|
||||
//=================================================================================
|
||||
// class : TransformationGUI_MultiTranslationDlg()
|
||||
// purpose : Constructs a TransformationGUI_MultiTranslationDlg which is a child of 'parent', with the
|
||||
// purpose : Constructs a TransformationGUI_MultiTranslationDlg which is a child of 'parent', with the
|
||||
// name 'name' and widget flags set to 'f'.
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg
|
||||
( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
|
||||
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
|
||||
(GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
|
||||
: GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
|
||||
myInitial(true)
|
||||
{
|
||||
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
||||
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_MULTITRANSLATION_SIMPLE" ) ) );
|
||||
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_MULTITRANSLATION_DOUBLE" ) ) );
|
||||
QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
|
||||
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTITRANSLATION_SIMPLE")));
|
||||
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTITRANSLATION_DOUBLE")));
|
||||
QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||
|
||||
setWindowTitle( tr( "GEOM_MULTITRANSLATION_TITLE" ) );
|
||||
setWindowTitle(tr("GEOM_MULTITRANSLATION_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_MULTITRANSLATION" ) );
|
||||
mainFrame()->RadioButton1->setIcon( image0 );
|
||||
mainFrame()->RadioButton2->setIcon( image1 );
|
||||
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
|
||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_MULTITRANSLATION"));
|
||||
mainFrame()->RadioButton1->setIcon(image0);
|
||||
mainFrame()->RadioButton2->setIcon(image1);
|
||||
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
|
||||
mainFrame()->RadioButton3->close();
|
||||
|
||||
GroupPoints = new DlgRef_2Sel2Spin1Check( centralWidget() );
|
||||
GroupPoints->GroupBox1->setTitle( tr( "GEOM_MULTITRANSLATION_SIMPLE" ) );
|
||||
GroupPoints->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
|
||||
GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR_U" ) );
|
||||
GroupPoints->TextLabel3->setText( tr( "GEOM_STEP_U" ) );
|
||||
GroupPoints->TextLabel4->setText( tr( "GEOM_NB_TIMES_U" ) );
|
||||
GroupPoints->CheckButton1->setText( tr( "GEOM_REVERSE_U" ) );
|
||||
GroupPoints->PushButton1->setIcon( image2 );
|
||||
GroupPoints->PushButton2->setIcon( image2 );
|
||||
GroupPoints->LineEdit1->setReadOnly( true );
|
||||
GroupPoints->LineEdit2->setReadOnly( true );
|
||||
GroupPoints = new DlgRef_2Sel2Spin1Check(centralWidget());
|
||||
GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_SIMPLE"));
|
||||
GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
|
||||
GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR_U"));
|
||||
GroupPoints->TextLabel3->setText(tr("GEOM_STEP_U"));
|
||||
GroupPoints->TextLabel4->setText(tr("GEOM_NB_TIMES_U"));
|
||||
GroupPoints->CheckButton1->setText(tr("GEOM_REVERSE_U"));
|
||||
GroupPoints->PushButton1->setIcon(image2);
|
||||
GroupPoints->PushButton2->setIcon(image2);
|
||||
GroupPoints->LineEdit1->setReadOnly(true);
|
||||
GroupPoints->LineEdit2->setReadOnly(true);
|
||||
|
||||
GroupDimensions = new DlgRef_3Sel4Spin2Check( centralWidget() );
|
||||
GroupDimensions->GroupBox1->setTitle( tr( "GEOM_MULTITRANSLATION_DOUBLE" ) );
|
||||
GroupDimensions->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
|
||||
GroupDimensions->TextLabel2->setText( tr( "GEOM_VECTOR_U" ) );
|
||||
GroupDimensions->TextLabel3->setText( tr( "GEOM_VECTOR_V" ) );
|
||||
GroupDimensions->TextLabel4->setText( tr( "GEOM_STEP_U" ) );
|
||||
GroupDimensions->TextLabel5->setText( tr( "GEOM_NB_TIMES_U" ) );
|
||||
GroupDimensions->TextLabel6->setText( tr( "GEOM_STEP_V" ) );
|
||||
GroupDimensions->TextLabel7->setText( tr( "GEOM_NB_TIMES_V" ) );
|
||||
GroupDimensions->CheckButton1->setText( tr( "GEOM_REVERSE_U" ) );
|
||||
GroupDimensions->CheckButton2->setText( tr( "GEOM_REVERSE_V" ) );
|
||||
GroupDimensions->PushButton1->setIcon( image2 );
|
||||
GroupDimensions->PushButton2->setIcon( image2 );
|
||||
GroupDimensions->PushButton3->setIcon( image2 );
|
||||
GroupDimensions->LineEdit1->setReadOnly( true );
|
||||
GroupDimensions->LineEdit2->setReadOnly( true );
|
||||
GroupDimensions->LineEdit3->setReadOnly( true );
|
||||
GroupDimensions = new DlgRef_3Sel4Spin2Check(centralWidget());
|
||||
GroupDimensions->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_DOUBLE"));
|
||||
GroupDimensions->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
|
||||
GroupDimensions->TextLabel2->setText(tr("GEOM_VECTOR_U"));
|
||||
GroupDimensions->TextLabel3->setText(tr("GEOM_VECTOR_V"));
|
||||
GroupDimensions->TextLabel4->setText(tr("GEOM_STEP_U"));
|
||||
GroupDimensions->TextLabel5->setText(tr("GEOM_NB_TIMES_U"));
|
||||
GroupDimensions->TextLabel6->setText(tr("GEOM_STEP_V"));
|
||||
GroupDimensions->TextLabel7->setText(tr("GEOM_NB_TIMES_V"));
|
||||
GroupDimensions->CheckButton1->setText(tr("GEOM_REVERSE_U"));
|
||||
GroupDimensions->CheckButton2->setText(tr("GEOM_REVERSE_V"));
|
||||
GroupDimensions->PushButton1->setIcon(image2);
|
||||
GroupDimensions->PushButton2->setIcon(image2);
|
||||
GroupDimensions->PushButton3->setIcon(image2);
|
||||
GroupDimensions->LineEdit1->setReadOnly(true);
|
||||
GroupDimensions->LineEdit2->setReadOnly(true);
|
||||
GroupDimensions->LineEdit3->setReadOnly(true);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
|
||||
layout->setMargin( 0 ); layout->setSpacing( 6 );
|
||||
layout->addWidget( GroupPoints );
|
||||
layout->addWidget( GroupDimensions );
|
||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||
layout->setMargin(0); layout->setSpacing(6);
|
||||
layout->addWidget(GroupPoints);
|
||||
layout->addWidget(GroupDimensions);
|
||||
/***************************************************************/
|
||||
|
||||
setHelpFileName( "multi_translation_operation_page.html" );
|
||||
setHelpFileName("multi_translation_operation_page.html");
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~TransformationGUI_MultiTranslationDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
@ -119,78 +120,86 @@ TransformationGUI_MultiTranslationDlg::~TransformationGUI_MultiTranslationDlg()
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiTranslationDlg::Init()
|
||||
{
|
||||
/* Get setting of step value from file configuration */
|
||||
// Get setting of step value from file configuration
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
|
||||
|
||||
double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
|
||||
|
||||
double SpecificStep = 1;
|
||||
/* min, max, step and decimals for spin boxes & initial values */
|
||||
initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 10 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox( GroupPoints->SpinBox_DY, 1.0, MAX_NUMBER, SpecificStep, 10 );
|
||||
GroupPoints->SpinBox_DX->setValue( myStepU );
|
||||
GroupPoints->SpinBox_DY->setValue( myNbTimesU );
|
||||
// min, max, step and decimals for spin boxes & initial values
|
||||
initSpinBox(GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 10); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox(GroupPoints->SpinBox_DY, 1.0, MAX_NUMBER, SpecificStep, 10);
|
||||
GroupPoints->SpinBox_DX->setValue(myStepU);
|
||||
GroupPoints->SpinBox_DY->setValue(myNbTimesU);
|
||||
|
||||
initSpinBox( GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, step, 10 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox( GroupDimensions->SpinBox_DY1, 1.0, MAX_NUMBER, SpecificStep, 10 );
|
||||
initSpinBox( GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, 10 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox( GroupDimensions->SpinBox_DY2, 1.0, MAX_NUMBER, SpecificStep, 10 );
|
||||
GroupDimensions->SpinBox_DX1->setValue( myStepU );
|
||||
GroupDimensions->SpinBox_DY1->setValue( myNbTimesU );
|
||||
GroupDimensions->SpinBox_DX2->setValue( myStepV );
|
||||
GroupDimensions->SpinBox_DY2->setValue( myNbTimesV );
|
||||
initSpinBox(GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, step, 10); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox(GroupDimensions->SpinBox_DY1, 1.0, MAX_NUMBER, SpecificStep, 10);
|
||||
initSpinBox(GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, 10); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
initSpinBox(GroupDimensions->SpinBox_DY2, 1.0, MAX_NUMBER, SpecificStep, 10);
|
||||
GroupDimensions->SpinBox_DX1->setValue(myStepU);
|
||||
GroupDimensions->SpinBox_DY1->setValue(myNbTimesU);
|
||||
GroupDimensions->SpinBox_DX2->setValue(myStepV);
|
||||
GroupDimensions->SpinBox_DY2->setValue(myNbTimesV);
|
||||
|
||||
/* signals and slots connections */
|
||||
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
|
||||
// init variables
|
||||
myStepU = myStepV = 50.0;
|
||||
myNbTimesU = myNbTimesV = 2;
|
||||
|
||||
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
|
||||
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( GroupDimensions->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( GroupDimensions->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( GroupDimensions->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
GroupDimensions->LineEdit1->setText("");
|
||||
GroupDimensions->LineEdit2->setText("");
|
||||
GroupDimensions->LineEdit3->setText("");
|
||||
|
||||
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( GroupDimensions->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( GroupDimensions->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( GroupDimensions->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
myBase = myVectorU = myVectorV = GEOM::GEOM_Object::_nil();
|
||||
|
||||
connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
connect( GroupPoints->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
connect( GroupDimensions->SpinBox_DX1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
connect( GroupDimensions->SpinBox_DY1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
connect( GroupDimensions->SpinBox_DX2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
connect( GroupDimensions->SpinBox_DY2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||
// signals and slots connections
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
|
||||
connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
|
||||
|
||||
connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseStepU() ) );
|
||||
connect( GroupDimensions->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseStepU() ) );
|
||||
connect( GroupDimensions->CheckButton2, SIGNAL( toggled( bool ) ), this, SLOT( ReverseStepV() ) );
|
||||
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
initName( tr( "GEOM_MULTITRANSLATION" ) );
|
||||
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupDimensions->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
ConstructorsClicked( 0 );
|
||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupDimensions->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
|
||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
|
||||
|
||||
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU()));
|
||||
connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU()));
|
||||
connect(GroupDimensions->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(ReverseStepV()));
|
||||
|
||||
initName(tr("GEOM_MULTITRANSLATION"));
|
||||
|
||||
ConstructorsClicked(0);
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetDoubleSpinBoxStep()
|
||||
// purpose : Double spin box management
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiTranslationDlg::SetDoubleSpinBoxStep( double step )
|
||||
void TransformationGUI_MultiTranslationDlg::SetDoubleSpinBoxStep (double step)
|
||||
{
|
||||
GroupPoints->SpinBox_DX->setSingleStep(step);
|
||||
GroupPoints->SpinBox_DY->setSingleStep(step);
|
||||
@ -204,174 +213,195 @@ void TransformationGUI_MultiTranslationDlg::SetDoubleSpinBoxStep( double step )
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiTranslationDlg::ConstructorsClicked( int constructorId )
|
||||
void TransformationGUI_MultiTranslationDlg::ConstructorsClicked (int constructorId)
|
||||
{
|
||||
disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
|
||||
|
||||
myStepU = myStepV = 50.0;
|
||||
myNbTimesU = myNbTimesV = 2;
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
|
||||
globalSelection( GEOM_ALLSHAPES );
|
||||
|
||||
switch ( constructorId ) {
|
||||
case 0: /* Translate simple */
|
||||
switch (constructorId) {
|
||||
case 0: // Translate simple
|
||||
{
|
||||
GroupDimensions->hide();
|
||||
GroupPoints->show();
|
||||
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setText( "" );
|
||||
GroupPoints->LineEdit2->setText( "" );
|
||||
|
||||
GroupPoints->SpinBox_DX->setValue( myStepU );
|
||||
GroupPoints->SpinBox_DY->setValue( myNbTimesU );
|
||||
|
||||
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
myBase = myVectorU = GEOM::GEOM_Object::_nil();
|
||||
|
||||
GroupPoints->SpinBox_DX->setValue(myStepU);
|
||||
GroupPoints->SpinBox_DY->setValue(myNbTimesU);
|
||||
|
||||
GroupPoints->PushButton1->click();
|
||||
break;
|
||||
}
|
||||
case 1: /* Translate double */
|
||||
case 1: // Translate double
|
||||
{
|
||||
GroupPoints->hide();
|
||||
GroupDimensions->show();
|
||||
|
||||
myEditCurrentArgument = GroupDimensions->LineEdit1;
|
||||
GroupDimensions->LineEdit1->setText( "" );
|
||||
GroupDimensions->LineEdit2->setText( "" );
|
||||
GroupDimensions->LineEdit3->setText( "" );
|
||||
|
||||
GroupDimensions->SpinBox_DX1->setValue( myStepU );
|
||||
GroupDimensions->SpinBox_DY1->setValue( myNbTimesU );
|
||||
GroupDimensions->SpinBox_DX2->setValue( myStepV );
|
||||
GroupDimensions->SpinBox_DY2->setValue( myNbTimesV );
|
||||
|
||||
myVectorV = GEOM::GEOM_Object::_nil();
|
||||
|
||||
GroupDimensions->LineEdit1->setText("");
|
||||
GroupDimensions->LineEdit2->setText("");
|
||||
GroupDimensions->LineEdit3->setText("");
|
||||
myBase = myVectorU = myVectorV = GEOM::GEOM_Object::_nil();
|
||||
|
||||
GroupDimensions->SpinBox_DX1->setValue(myStepU);
|
||||
GroupDimensions->SpinBox_DY1->setValue(myNbTimesU);
|
||||
GroupDimensions->SpinBox_DX2->setValue(myStepV);
|
||||
GroupDimensions->SpinBox_DY2->setValue(myNbTimesV);
|
||||
|
||||
GroupDimensions->PushButton1->click();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
qApp->processEvents();
|
||||
updateGeometry();
|
||||
resize( minimumSize() );
|
||||
resize(minimumSize());
|
||||
|
||||
myEditCurrentArgument->setFocus();
|
||||
myBase = myVectorU = GEOM::GEOM_Object::_nil();
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
if (myInitial) {
|
||||
myInitial = false;
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
else {
|
||||
displayPreview();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiTranslationDlg::ClickOnOk()
|
||||
{
|
||||
if ( ClickOnApply() )
|
||||
if (ClickOnApply())
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_MultiTranslationDlg::ClickOnApply()
|
||||
{
|
||||
if ( !onAccept() )
|
||||
if (!onAccept())
|
||||
return false;
|
||||
|
||||
|
||||
initName();
|
||||
ConstructorsClicked( getConstructorId() );
|
||||
// activate selection and connect selection manager
|
||||
ConstructorsClicked(getConstructorId());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection as changed or other case
|
||||
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
|
||||
{
|
||||
myEditCurrentArgument->setText( "" );
|
||||
|
||||
erasePreview();
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit1)
|
||||
myBase = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit2)
|
||||
myVectorU = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupDimensions->LineEdit3)
|
||||
myVectorV = GEOM::GEOM_Object::_nil();
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
if ( aSelList.Extent() != 1 ) {
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit1 )
|
||||
myBase = GEOM::GEOM_Object::_nil();
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit2 )
|
||||
myVectorU = GEOM::GEOM_Object::_nil();
|
||||
else if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
|
||||
myVectorV = GEOM::GEOM_Object::_nil();
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
}
|
||||
|
||||
// nbSel == 1
|
||||
Standard_Boolean testResult = Standard_False;;
|
||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First(), testResult );
|
||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
||||
|
||||
if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) )
|
||||
if (!testResult || CORBA::is_nil(aSelectedObject) || !GEOMBase::IsShape(aSelectedObject))
|
||||
return;
|
||||
|
||||
QString aName = GEOMBase::GetName( aSelectedObject );
|
||||
QString aName = GEOMBase::GetName(aSelectedObject);
|
||||
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit1 )
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit1)
|
||||
myBase = aSelectedObject;
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit3 ) {
|
||||
if ( testResult && !aSelectedObject->_is_nil() ) {
|
||||
TopoDS_Shape aShape;
|
||||
|
||||
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
aSelMgr->GetIndexes( aSelList.First(), aMap );
|
||||
if ( aMap.Extent() == 1 ) {
|
||||
int anIndex = aMap( 1 );
|
||||
aName += QString( ":edge_%1" ).arg( anIndex );
|
||||
|
||||
//Find SubShape Object in Father
|
||||
GEOM::GEOM_Object_var aFindedObject = findObjectInFather( aSelectedObject, aName );
|
||||
|
||||
if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
|
||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||
getGeomEngine()->GetIShapesOperations( getStudyId() );
|
||||
if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
|
||||
myVectorV = aShapesOp->GetSubShape( aSelectedObject, anIndex );
|
||||
else
|
||||
myVectorU = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||
}
|
||||
else {
|
||||
if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
|
||||
myVectorV = aFindedObject;
|
||||
else
|
||||
myVectorU = aFindedObject;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( aShape.ShapeType() != TopAbs_EDGE ) {
|
||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
}
|
||||
if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
|
||||
myVectorV = aSelectedObject;
|
||||
else
|
||||
myVectorU = aSelectedObject;
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit3) {
|
||||
TopoDS_Shape aShape;
|
||||
|
||||
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
||||
if (aMap.Extent() == 1) {
|
||||
int anIndex = aMap(1);
|
||||
aName += QString(":edge_%1").arg(anIndex);
|
||||
|
||||
//Find SubShape Object in Father
|
||||
GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
|
||||
|
||||
if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
|
||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||
if (myEditCurrentArgument == GroupDimensions->LineEdit3)
|
||||
myVectorV = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||
else
|
||||
myVectorU = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||
}
|
||||
else {
|
||||
if (myEditCurrentArgument == GroupDimensions->LineEdit3)
|
||||
myVectorV = aFindedObject;
|
||||
else
|
||||
myVectorU = aFindedObject;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aShape.ShapeType() != TopAbs_EDGE) {
|
||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
}
|
||||
if (myEditCurrentArgument == GroupDimensions->LineEdit3)
|
||||
myVectorV = aSelectedObject;
|
||||
else
|
||||
myVectorU = aSelectedObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
myEditCurrentArgument->setText( aName );
|
||||
|
||||
displayPreview();
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
if (!myBase->_is_nil() && myVectorU->_is_nil())
|
||||
GroupPoints->PushButton2->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||
if (!myVectorU->_is_nil() && myBase->_is_nil())
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupDimensions->LineEdit1) {
|
||||
if (!myBase->_is_nil() && myVectorU->_is_nil())
|
||||
GroupDimensions->PushButton2->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupDimensions->LineEdit2) {
|
||||
if (!myVectorU->_is_nil() && myVectorV->_is_nil())
|
||||
GroupDimensions->PushButton3->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupDimensions->LineEdit3) {
|
||||
if (!myVectorV->_is_nil() && myBase->_is_nil())
|
||||
GroupDimensions->PushButton1->click();
|
||||
}
|
||||
|
||||
// clear selection
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
@ -379,31 +409,64 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
|
||||
void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
globalSelection( GEOM_ALLSHAPES );
|
||||
|
||||
if ( send == GroupPoints->PushButton1 ) {
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
globalSelection(GEOM_ALLSHAPES);
|
||||
|
||||
if (send == GroupPoints->PushButton1) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
}
|
||||
else if ( send == GroupPoints->PushButton2 ) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
|
||||
}
|
||||
else if ( send == GroupDimensions->PushButton1 ) {
|
||||
myEditCurrentArgument = GroupDimensions->LineEdit1;
|
||||
}
|
||||
else if ( send == GroupDimensions->PushButton2 ) {
|
||||
myEditCurrentArgument = GroupDimensions->LineEdit2;
|
||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
|
||||
}
|
||||
else if ( send == GroupDimensions->PushButton3 ) {
|
||||
myEditCurrentArgument = GroupDimensions->LineEdit3;
|
||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setFocus();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
GroupPoints->PushButton2->setDown(false);
|
||||
GroupPoints->LineEdit2->setEnabled(false);
|
||||
}
|
||||
else if (send == GroupPoints->PushButton2) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||
|
||||
GroupPoints->PushButton1->setDown(false);
|
||||
GroupPoints->LineEdit1->setEnabled(false);
|
||||
}
|
||||
else if (send == GroupDimensions->PushButton1) {
|
||||
myEditCurrentArgument = GroupDimensions->LineEdit1;
|
||||
|
||||
GroupDimensions->PushButton2->setDown(false);
|
||||
GroupDimensions->PushButton3->setDown(false);
|
||||
GroupDimensions->LineEdit2->setEnabled(false);
|
||||
GroupDimensions->LineEdit3->setEnabled(false);
|
||||
}
|
||||
else if (send == GroupDimensions->PushButton2) {
|
||||
myEditCurrentArgument = GroupDimensions->LineEdit2;
|
||||
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||
|
||||
GroupDimensions->PushButton1->setDown(false);
|
||||
GroupDimensions->PushButton3->setDown(false);
|
||||
GroupDimensions->LineEdit1->setEnabled(false);
|
||||
GroupDimensions->LineEdit3->setEnabled(false);
|
||||
}
|
||||
else if (send == GroupDimensions->PushButton3) {
|
||||
myEditCurrentArgument = GroupDimensions->LineEdit3;
|
||||
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||
|
||||
GroupDimensions->PushButton1->setDown(false);
|
||||
GroupDimensions->PushButton2->setDown(false);
|
||||
GroupDimensions->LineEdit1->setEnabled(false);
|
||||
GroupDimensions->LineEdit2->setEnabled(false);
|
||||
}
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
|
||||
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
@ -412,15 +475,14 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
|
||||
void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if ( send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 ||
|
||||
send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 ||
|
||||
send == GroupDimensions->LineEdit3 ) {
|
||||
myEditCurrentArgument = send;
|
||||
if (send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 ||
|
||||
send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 ||
|
||||
send == GroupDimensions->LineEdit3) {
|
||||
myEditCurrentArgument = send;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -428,55 +490,51 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed()
|
||||
void TransformationGUI_MultiTranslationDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
ConstructorsClicked( getConstructorId() );
|
||||
// reinit, because some selected objects could be removed
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiTranslationDlg::enterEvent( QEvent* )
|
||||
void TransformationGUI_MultiTranslationDlg::enterEvent (QEvent*)
|
||||
{
|
||||
if ( !mainFrame()->GroupConstructors->isEnabled() )
|
||||
if (!mainFrame()->GroupConstructors->isEnabled())
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ValueChangedInSpinBox()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox( double newValue )
|
||||
void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox (double newValue)
|
||||
{
|
||||
QObject* send = (QObject*)sender();
|
||||
|
||||
switch ( getConstructorId() ) {
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
if ( send == GroupPoints->SpinBox_DX )
|
||||
if (send == GroupPoints->SpinBox_DX)
|
||||
myStepU = newValue;
|
||||
else if ( send == GroupPoints->SpinBox_DY )
|
||||
else if (send == GroupPoints->SpinBox_DY)
|
||||
myNbTimesU = (int)newValue;
|
||||
break;
|
||||
case 1 :
|
||||
if ( send == GroupDimensions->SpinBox_DX1 )
|
||||
case 1:
|
||||
if (send == GroupDimensions->SpinBox_DX1)
|
||||
myStepU = newValue;
|
||||
else if ( send == GroupDimensions->SpinBox_DY1)
|
||||
else if (send == GroupDimensions->SpinBox_DY1)
|
||||
myNbTimesU = (int)newValue;
|
||||
else if ( send == GroupDimensions->SpinBox_DX2 )
|
||||
else if (send == GroupDimensions->SpinBox_DX2)
|
||||
myStepV = newValue;
|
||||
else if ( send == GroupDimensions->SpinBox_DY2 )
|
||||
else if (send == GroupDimensions->SpinBox_DY2)
|
||||
myNbTimesV = (int)newValue;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ReverseStepU()
|
||||
// purpose : 'state' not used here
|
||||
@ -484,18 +542,17 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox( double newVal
|
||||
void TransformationGUI_MultiTranslationDlg::ReverseStepU()
|
||||
{
|
||||
myStepU = -myStepU;
|
||||
|
||||
|
||||
int aConstructorId = getConstructorId();
|
||||
|
||||
if ( aConstructorId == 0 )
|
||||
GroupPoints->SpinBox_DX->setValue( myStepU );
|
||||
else if ( aConstructorId == 1 )
|
||||
GroupDimensions->SpinBox_DX1->setValue( myStepU );
|
||||
|
||||
if (aConstructorId == 0)
|
||||
GroupPoints->SpinBox_DX->setValue(myStepU);
|
||||
else if (aConstructorId == 1)
|
||||
GroupDimensions->SpinBox_DX1->setValue(myStepU);
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ReverseStepV
|
||||
// purpose : 'state' not used here
|
||||
@ -503,72 +560,71 @@ void TransformationGUI_MultiTranslationDlg::ReverseStepU()
|
||||
void TransformationGUI_MultiTranslationDlg::ReverseStepV()
|
||||
{
|
||||
myStepV = -myStepV;
|
||||
|
||||
GroupDimensions->SpinBox_DX2->setValue( myStepV );
|
||||
|
||||
|
||||
GroupDimensions->SpinBox_DX2->setValue(myStepV);
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : createOperation
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperation()
|
||||
{
|
||||
return myGeomGUI->GetGeomGen()->GetITransformOperations( getStudyId() );
|
||||
return getGeomEngine()->GetITransformOperations(getStudyId());
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_MultiTranslationDlg::isValid( QString& /*msg*/ )
|
||||
bool TransformationGUI_MultiTranslationDlg::isValid (QString& /*msg*/)
|
||||
{
|
||||
int aConstructorId = getConstructorId();
|
||||
|
||||
if ( aConstructorId == 0 )
|
||||
return !( myBase->_is_nil() || myVectorU->_is_nil() );
|
||||
else if ( aConstructorId == 1 )
|
||||
return !( myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil() );
|
||||
return 0;
|
||||
|
||||
if (aConstructorId == 0)
|
||||
return !(myBase->_is_nil() || myVectorU->_is_nil());
|
||||
else if (aConstructorId == 1)
|
||||
return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil());
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : execute
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects )
|
||||
bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects)
|
||||
{
|
||||
bool res = false;
|
||||
|
||||
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
switch ( getConstructorId() ) {
|
||||
case 0 :
|
||||
if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVectorU ) ) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate1D( myBase, myVectorU, myStepU, myNbTimesU );
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU)) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
MultiTranslate1D(myBase, myVectorU, myStepU, myNbTimesU);
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
case 1 :
|
||||
if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVectorU ) &&
|
||||
!CORBA::is_nil( myVectorV ) ) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate2D( myBase, myVectorU, myStepU, myNbTimesU,
|
||||
myVectorV, myStepV, myNbTimesV );
|
||||
case 1:
|
||||
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU) &&
|
||||
!CORBA::is_nil(myVectorV)) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
MultiTranslate2D(myBase, myVectorU, myStepU, myNbTimesU,
|
||||
myVectorV, myStepV, myNbTimesV);
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
|
||||
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : addSubshapeToStudy
|
||||
// purpose : virtual method to add new SubObjects if local selection
|
||||
@ -576,8 +632,8 @@ bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects )
|
||||
void TransformationGUI_MultiTranslationDlg::addSubshapesToStudy()
|
||||
{
|
||||
QMap<QString, GEOM::GEOM_Object_var> objMap;
|
||||
|
||||
switch ( getConstructorId() ) {
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
objMap[GroupPoints->LineEdit2->text()] = myVectorU;
|
||||
break;
|
||||
@ -586,5 +642,5 @@ void TransformationGUI_MultiTranslationDlg::addSubshapesToStudy()
|
||||
objMap[GroupDimensions->LineEdit3->text()] = myVectorV;
|
||||
break;
|
||||
}
|
||||
addSubshapesToFather( objMap );
|
||||
addSubshapesToFather(objMap);
|
||||
}
|
||||
|
@ -61,6 +61,9 @@ private:
|
||||
int myNbTimesV;
|
||||
Standard_Real myStepU;
|
||||
Standard_Real myStepV;
|
||||
|
||||
// to initialize the first selection field with a selected object on the dialog creation
|
||||
bool myInitial;
|
||||
|
||||
DlgRef_2Sel2Spin1Check* GroupPoints;
|
||||
DlgRef_3Sel4Spin2Check* GroupDimensions;
|
||||
|
@ -209,6 +209,7 @@ void TransformationGUI_OffsetDlg::SetEditCurrentArgument()
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
|
||||
if ( send == GroupPoints->PushButton1 ) {
|
||||
GroupPoints->PushButton1->setDown(true);
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
myEditCurrentArgument->setFocus();
|
||||
SelectionIntoArgument();
|
||||
|
@ -1,22 +1,22 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 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.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : TransformationGUI_PositionDlg.cxx
|
||||
@ -29,247 +29,324 @@
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
// OCCT Includes
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
|
||||
//=================================================================================
|
||||
// class : TransformationGUI_PositionDlg()
|
||||
// purpose : Constructs a TransformationGUI_PositionDlg which is a child of 'parent', with the
|
||||
// purpose : Constructs a TransformationGUI_PositionDlg which is a child of 'parent', with the
|
||||
// name 'name' and widget flags set to 'f'.
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
|
||||
( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
|
||||
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
|
||||
(GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
|
||||
: GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
|
||||
myInitial(true)
|
||||
{
|
||||
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
||||
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_POSITION" ) ) );
|
||||
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_POSITION2" ) ) );
|
||||
QPixmap imageselect( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT") ) );
|
||||
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POSITION")));
|
||||
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POSITION2")));
|
||||
QPixmap imageselect (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||
|
||||
setWindowTitle( tr( "GEOM_POSITION_TITLE" ) );
|
||||
setWindowTitle(tr("GEOM_POSITION_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_POSITION" ) );
|
||||
mainFrame()->RadioButton1->setIcon( image0 );
|
||||
mainFrame()->RadioButton2->setIcon( image1 );
|
||||
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
|
||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_POSITION"));
|
||||
mainFrame()->RadioButton1->setIcon(image0);
|
||||
mainFrame()->RadioButton2->setIcon(image1);
|
||||
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
|
||||
mainFrame()->RadioButton3->close();
|
||||
|
||||
Group1 = new DlgRef_3Sel3Spin1Check( centralWidget() );
|
||||
|
||||
Group1 = new DlgRef_3Sel3Spin1Check(centralWidget());
|
||||
Group1->SpinBox1->hide();
|
||||
Group1->SpinBox2->hide();
|
||||
Group1->SpinBox3->hide();
|
||||
Group1->TextLabel4->hide();
|
||||
Group1->TextLabel5->hide();
|
||||
Group1->TextLabel6->hide();
|
||||
Group1->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
|
||||
Group1->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
|
||||
Group1->TextLabel2->setText( tr( "GEOM_START_LCS" ) );
|
||||
Group1->TextLabel3->setText( tr( "GEOM_END_LCS" ) );
|
||||
Group1->PushButton1->setIcon( imageselect );
|
||||
Group1->PushButton2->setIcon( imageselect );
|
||||
Group1->PushButton3->setIcon( imageselect );
|
||||
Group1->CheckBox1->setText( tr( "GEOM_CREATE_COPY" ) );
|
||||
Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||
Group1->TextLabel1->setText(tr("GEOM_OBJECTS"));
|
||||
Group1->TextLabel2->setText(tr("GEOM_START_LCS"));
|
||||
Group1->TextLabel3->setText(tr("GEOM_END_LCS"));
|
||||
Group1->PushButton1->setIcon(imageselect);
|
||||
Group1->PushButton2->setIcon(imageselect);
|
||||
Group1->PushButton3->setIcon(imageselect);
|
||||
Group1->CheckBox1->setText(tr("GEOM_CREATE_COPY"));
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
|
||||
layout->setMargin( 0 ); layout->setSpacing( 6 );
|
||||
layout->addWidget( Group1 );
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||
layout->setMargin(0); layout->setSpacing(6);
|
||||
layout->addWidget(Group1);
|
||||
/***************************************************************/
|
||||
|
||||
setHelpFileName( "modify_location_operation_page.html" );
|
||||
|
||||
setHelpFileName("modify_location_operation_page.html");
|
||||
|
||||
// Activate Create a Copy mode
|
||||
Group1->CheckBox1->setChecked(true);
|
||||
CreateCopyModeChanged(true);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~TransformationGUI_PositionDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
TransformationGUI_PositionDlg::~TransformationGUI_PositionDlg()
|
||||
{
|
||||
/* no need to delete child widgets, Qt does it all for us */
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_PositionDlg::Init()
|
||||
{
|
||||
/* init variables */
|
||||
Group1->LineEdit1->setReadOnly( true );
|
||||
Group1->LineEdit2->setReadOnly( true );
|
||||
Group1->LineEdit3->setReadOnly( true );
|
||||
|
||||
myStartLCS = GEOM::GEOM_Object::_nil();
|
||||
myEndLCS = GEOM::GEOM_Object::_nil();
|
||||
|
||||
// Activate Create a Copy mode
|
||||
Group1->CheckBox1->setChecked( true );
|
||||
CreateCopyModeChanged( true );
|
||||
{
|
||||
// init variables
|
||||
Group1->LineEdit1->setReadOnly(true);
|
||||
Group1->LineEdit2->setReadOnly(true);
|
||||
Group1->LineEdit3->setReadOnly(true);
|
||||
|
||||
Group1->LineEdit1->setText("");
|
||||
Group1->LineEdit2->setText("");
|
||||
Group1->LineEdit3->setText("");
|
||||
|
||||
myStartLCS = myEndLCS = GEOM::GEOM_Object::_nil();
|
||||
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
|
||||
/* signals and slots connections */
|
||||
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
|
||||
// signals and slots connections
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
|
||||
connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
|
||||
|
||||
connect( Group1->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( Group1->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( Group1->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(Group1->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(Group1->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect( Group1->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( Group1->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( Group1->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
|
||||
connect( Group1->CheckBox1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) );
|
||||
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(Group1->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(Group1->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
initName( tr( "GEOM_POSITION" ) );
|
||||
connect(Group1->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
||||
|
||||
ConstructorsClicked( 0 );
|
||||
initName(tr("GEOM_POSITION"));
|
||||
|
||||
ConstructorsClicked(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void TransformationGUI_PositionDlg::ConstructorsClicked( int constructorId )
|
||||
void TransformationGUI_PositionDlg::ConstructorsClicked (int constructorId)
|
||||
{
|
||||
disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
|
||||
|
||||
globalSelection();
|
||||
myEditCurrentArgument = Group1->LineEdit1;
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
|
||||
Group1->LineEdit2->clear();
|
||||
Group1->LineEdit3->clear();
|
||||
myStartLCS = GEOM::GEOM_Object::_nil();
|
||||
myEndLCS = GEOM::GEOM_Object::_nil();
|
||||
|
||||
switch ( constructorId ) {
|
||||
|
||||
switch (constructorId) {
|
||||
case 0:
|
||||
Group1->LineEdit2->hide();
|
||||
Group1->TextLabel2->hide();
|
||||
Group1->PushButton2->hide();
|
||||
{
|
||||
Group1->LineEdit2->hide();
|
||||
Group1->TextLabel2->hide();
|
||||
Group1->PushButton2->hide();
|
||||
|
||||
Group1->PushButton1->click();
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
Group1->LineEdit2->show();
|
||||
Group1->TextLabel2->show();
|
||||
Group1->PushButton2->show();
|
||||
{
|
||||
Group1->LineEdit2->show();
|
||||
Group1->TextLabel2->show();
|
||||
Group1->PushButton2->show();
|
||||
|
||||
Group1->PushButton1->click();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
qApp->processEvents();
|
||||
updateGeometry();
|
||||
resize( minimumSize() );
|
||||
resize(minimumSize());
|
||||
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT(SelectionIntoArgument() ) );
|
||||
SelectionIntoArgument();
|
||||
if (myInitial) {
|
||||
myInitial = false;
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
else {
|
||||
displayPreview();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_PositionDlg::ClickOnOk()
|
||||
{
|
||||
if ( ClickOnApply() )
|
||||
if (ClickOnApply())
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_PositionDlg::ClickOnApply()
|
||||
{
|
||||
if ( !onAccept( Group1->CheckBox1->isChecked() ) )
|
||||
if (!onAccept(Group1->CheckBox1->isChecked()))
|
||||
return false;
|
||||
|
||||
|
||||
initName();
|
||||
ConstructorsClicked( getConstructorId() );
|
||||
// activate selection and connect selection manager
|
||||
ConstructorsClicked(getConstructorId());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection has changed
|
||||
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||
//=================================================================================
|
||||
void TransformationGUI_PositionDlg::SelectionIntoArgument()
|
||||
{
|
||||
myEditCurrentArgument->setText( "" );
|
||||
QString aName;
|
||||
erasePreview();
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
if (myEditCurrentArgument == Group1->LineEdit1)
|
||||
myObjects.length(0);
|
||||
else if (myEditCurrentArgument == Group1->LineEdit2)
|
||||
myStartLCS = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == Group1->LineEdit3)
|
||||
myEndLCS = GEOM::GEOM_Object::_nil();
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
QString aName;
|
||||
|
||||
if (myEditCurrentArgument == Group1->LineEdit1) {
|
||||
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
||||
if (aNbSel < 1) {
|
||||
myObjects.length(0);
|
||||
displayPreview();
|
||||
if (aNbSel < 1)
|
||||
return;
|
||||
}
|
||||
|
||||
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
||||
if ( !myObjects.length() ) {
|
||||
displayPreview();
|
||||
if (!myObjects.length())
|
||||
return;
|
||||
}
|
||||
else
|
||||
myEditCurrentArgument->setText(aName);
|
||||
}
|
||||
else if (myEditCurrentArgument == Group1->LineEdit2) {
|
||||
myStartLCS = GEOM::GEOM_Object::_nil();
|
||||
if (aSelList.Extent() != 1) {
|
||||
displayPreview();
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
}
|
||||
|
||||
// nbSel == 1
|
||||
Standard_Boolean testResult = Standard_False;
|
||||
myStartLCS = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
||||
if ( !testResult || CORBA::is_nil( myStartLCS ) ) {
|
||||
displayPreview();
|
||||
if (!testResult || CORBA::is_nil(myStartLCS))
|
||||
return;
|
||||
}
|
||||
aName = GEOMBase::GetName( myStartLCS );
|
||||
|
||||
aName = GEOMBase::GetName(myStartLCS);
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (!myStartLCS->_is_nil() && myEndLCS->_is_nil())
|
||||
Group1->PushButton3->click();
|
||||
}
|
||||
else if ( myEditCurrentArgument == Group1->LineEdit3 ) {
|
||||
else if (myEditCurrentArgument == Group1->LineEdit3) {
|
||||
myEndLCS = GEOM::GEOM_Object::_nil();
|
||||
if ( aSelList.Extent() != 1 ) {
|
||||
displayPreview();
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean testResult = Standard_False;
|
||||
myEndLCS = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
||||
if ( !testResult || CORBA::is_nil( myEndLCS ) ) {
|
||||
displayPreview();
|
||||
if (!testResult || CORBA::is_nil(myEndLCS))
|
||||
return;
|
||||
}
|
||||
aName = GEOMBase::GetName( myEndLCS );
|
||||
|
||||
aName = GEOMBase::GetName(myEndLCS);
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (!myEndLCS->_is_nil() && !myObjects.length())
|
||||
Group1->PushButton1->click();
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setText( aName );
|
||||
displayPreview();
|
||||
// clear selection
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_PositionDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
if (send == Group1->PushButton1) {
|
||||
myEditCurrentArgument = Group1->LineEdit1;
|
||||
|
||||
globalSelection();
|
||||
|
||||
Group1->PushButton2->setDown(false);
|
||||
Group1->PushButton3->setDown(false);
|
||||
Group1->LineEdit2->setEnabled(false);
|
||||
Group1->LineEdit3->setEnabled(false);
|
||||
}
|
||||
else if (send == Group1->PushButton2) {
|
||||
myEditCurrentArgument = Group1->LineEdit2;
|
||||
|
||||
TColStd_MapOfInteger aMap;
|
||||
aMap.Add(GEOM_PLANE);
|
||||
aMap.Add(GEOM_MARKER);
|
||||
globalSelection(aMap);
|
||||
|
||||
Group1->PushButton1->setDown(false);
|
||||
Group1->PushButton3->setDown(false);
|
||||
Group1->LineEdit1->setEnabled(false);
|
||||
Group1->LineEdit3->setEnabled(false);
|
||||
}
|
||||
else if (send == Group1->PushButton3) {
|
||||
myEditCurrentArgument = Group1->LineEdit3;
|
||||
|
||||
TColStd_MapOfInteger aMap;
|
||||
aMap.Add(GEOM_PLANE);
|
||||
aMap.Add(GEOM_MARKER);
|
||||
globalSelection(aMap);
|
||||
|
||||
Group1->PushButton1->setDown(false);
|
||||
Group1->PushButton2->setDown(false);
|
||||
Group1->LineEdit1->setEnabled(false);
|
||||
Group1->LineEdit2->setEnabled(false);
|
||||
}
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
|
||||
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -279,46 +356,14 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
|
||||
void TransformationGUI_PositionDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if ( send == Group1->LineEdit1 || send == Group1->LineEdit2 ||
|
||||
send == Group1->LineEdit3 ) {
|
||||
if (send == Group1->LineEdit1 ||
|
||||
send == Group1->LineEdit2 ||
|
||||
send == Group1->LineEdit3) {
|
||||
myEditCurrentArgument = send;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_PositionDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
|
||||
if ( send == Group1->PushButton1 ) {
|
||||
myEditCurrentArgument = Group1->LineEdit1;
|
||||
globalSelection();
|
||||
}
|
||||
else if ( send == Group1->PushButton2 ) {
|
||||
myEditCurrentArgument = Group1->LineEdit2;
|
||||
TColStd_MapOfInteger aMap;
|
||||
aMap.Add( GEOM_PLANE );
|
||||
aMap.Add( GEOM_MARKER );
|
||||
globalSelection( aMap );
|
||||
}
|
||||
else if ( send == Group1->PushButton3 ) {
|
||||
myEditCurrentArgument = Group1->LineEdit3;
|
||||
TColStd_MapOfInteger aMap;
|
||||
aMap.Add( GEOM_PLANE );
|
||||
aMap.Add( GEOM_MARKER );
|
||||
globalSelection( aMap );
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setFocus();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -326,93 +371,89 @@ void TransformationGUI_PositionDlg::SetEditCurrentArgument()
|
||||
void TransformationGUI_PositionDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
ConstructorsClicked( getConstructorId() );
|
||||
}
|
||||
|
||||
// reinit, because some selected objects could be removed
|
||||
Init();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose : when mouse enter onto the QWidget
|
||||
//=================================================================================
|
||||
void TransformationGUI_PositionDlg::enterEvent( QEvent* )
|
||||
void TransformationGUI_PositionDlg::enterEvent (QEvent*)
|
||||
{
|
||||
if ( !mainFrame()->GroupConstructors->isEnabled() )
|
||||
if (!mainFrame()->GroupConstructors->isEnabled())
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : createOperation
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
GEOM::GEOM_IOperations_ptr TransformationGUI_PositionDlg::createOperation()
|
||||
GEOM::GEOM_IOperations_ptr TransformationGUI_PositionDlg::createOperation()
|
||||
{
|
||||
return getGeomEngine()->GetITransformOperations( getStudyId() );
|
||||
return getGeomEngine()->GetITransformOperations(getStudyId());
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_PositionDlg::isValid( QString& /*msg*/ )
|
||||
bool TransformationGUI_PositionDlg::isValid (QString& /*msg*/)
|
||||
{
|
||||
bool res;
|
||||
if ( getConstructorId() == 0 )
|
||||
res = !( myObjects.length() == 0 || myEndLCS->_is_nil() );
|
||||
if (getConstructorId() == 0)
|
||||
res = !(myObjects.length() == 0 || myEndLCS->_is_nil());
|
||||
else
|
||||
res = !( myObjects.length() == 0 || myStartLCS->_is_nil() || myEndLCS->_is_nil() );
|
||||
res = !(myObjects.length() == 0 || myStartLCS->_is_nil() || myEndLCS->_is_nil());
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : execute
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_PositionDlg::execute( ObjectList& objects )
|
||||
bool TransformationGUI_PositionDlg::execute (ObjectList& objects)
|
||||
{
|
||||
bool res = false;
|
||||
bool toCreateCopy = IsPreview() || Group1->CheckBox1->isChecked();
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
switch ( getConstructorId() ) {
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
{
|
||||
for ( int i = 0; i < myObjects.length(); i++ ) {
|
||||
if ( toCreateCopy )
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
|
||||
PositionShapeCopy( myObjects[i], myObjects[i], myEndLCS );
|
||||
else
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
|
||||
PositionShape( myObjects[i], myObjects[i], myEndLCS );
|
||||
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
if (toCreateCopy)
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
PositionShapeCopy(myObjects[i], myObjects[i], myEndLCS);
|
||||
else
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
PositionShape(myObjects[i], myObjects[i], myEndLCS);
|
||||
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
for ( int i = 0; i < myObjects.length(); i++ ) {
|
||||
if ( toCreateCopy )
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
|
||||
PositionShapeCopy( myObjects[i], myStartLCS, myEndLCS );
|
||||
else
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
|
||||
PositionShape( myObjects[i], myStartLCS, myEndLCS );
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
if (toCreateCopy)
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
PositionShapeCopy(myObjects[i], myStartLCS, myEndLCS);
|
||||
else
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
PositionShape(myObjects[i], myStartLCS, myEndLCS);
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -420,14 +461,14 @@ bool TransformationGUI_PositionDlg::execute( ObjectList& objects )
|
||||
// function : restoreSubShapes
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_PositionDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy,
|
||||
SALOMEDS::SObject_ptr theSObject )
|
||||
void TransformationGUI_PositionDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
||||
SALOMEDS::SObject_ptr theSObject)
|
||||
{
|
||||
if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) {
|
||||
if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
|
||||
// empty list of arguments means that all arguments should be restored
|
||||
getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(),
|
||||
/*theFindMethod=*/GEOM::FSM_Transformed,
|
||||
/*theInheritFirstArg=*/true );
|
||||
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
|
||||
/*theFindMethod=*/GEOM::FSM_Transformed,
|
||||
/*theInheritFirstArg=*/true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -435,7 +476,7 @@ void TransformationGUI_PositionDlg::restoreSubShapes( SALOMEDS::Study_ptr theS
|
||||
// function : CreateCopyModeChanged()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_PositionDlg::CreateCopyModeChanged( bool isCreateCopy )
|
||||
void TransformationGUI_PositionDlg::CreateCopyModeChanged (bool isCreateCopy)
|
||||
{
|
||||
mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
|
||||
mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
|
||||
}
|
||||
|
@ -58,6 +58,9 @@ private:
|
||||
GEOM::GEOM_Object_var myStartLCS;
|
||||
GEOM::GEOM_Object_var myEndLCS;
|
||||
GEOM::ListOfGO myObjects;
|
||||
|
||||
// to initialize the first selection field with a selected object on the dialog creation
|
||||
bool myInitial;
|
||||
|
||||
DlgRef_3Sel3Spin1Check* Group1;
|
||||
|
||||
|
@ -1,22 +1,22 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 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.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : TransformationGUI_RotationDlg.cxx
|
||||
@ -29,11 +29,12 @@
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
// OCCT Includes
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
@ -45,92 +46,63 @@
|
||||
|
||||
//=================================================================================
|
||||
// class : TransformationGUI_RotationDlg()
|
||||
// purpose : Constructs a TransformationGUI_RotationDlg which is a child of 'parent', with the
|
||||
// purpose : Constructs a TransformationGUI_RotationDlg which is a child of 'parent', with the
|
||||
// name 'name' and widget flags set to 'f'.
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
TransformationGUI_RotationDlg::TransformationGUI_RotationDlg
|
||||
( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
|
||||
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
|
||||
(GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
|
||||
: GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
|
||||
myInitial(true)
|
||||
{
|
||||
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
||||
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ROTATION" ) ) );
|
||||
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
|
||||
QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ROTATION_THREE_POINTS" ) ) );
|
||||
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_ROTATION")));
|
||||
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||
QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_ROTATION_THREE_POINTS")));
|
||||
|
||||
setWindowTitle( tr( "GEOM_ROTATION_TITLE" ) );
|
||||
setWindowTitle(tr("GEOM_ROTATION_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_ROTATION" ) );
|
||||
mainFrame()->RadioButton1->setIcon( image0 );
|
||||
mainFrame()->RadioButton2->setIcon( image2 );
|
||||
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
|
||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_ROTATION"));
|
||||
mainFrame()->RadioButton1->setIcon(image0);
|
||||
mainFrame()->RadioButton2->setIcon(image2);
|
||||
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
|
||||
mainFrame()->RadioButton3->close();
|
||||
|
||||
GroupPoints = new DlgRef_4Sel1Spin2Check( centralWidget() );
|
||||
GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
|
||||
GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
|
||||
GroupPoints->TextLabel2->setText( tr( "GEOM_AXIS" ) );
|
||||
GroupPoints->TextLabel3->setText( tr( "GEOM_ANGLE" ) );
|
||||
GroupPoints->TextLabel4->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
|
||||
GroupPoints->TextLabel5->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
|
||||
GroupPoints = new DlgRef_4Sel1Spin2Check(centralWidget());
|
||||
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS"));
|
||||
GroupPoints->TextLabel2->setText(tr("GEOM_AXIS"));
|
||||
GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE"));
|
||||
GroupPoints->TextLabel4->setText(tr("GEOM_POINT_I").arg(1));
|
||||
GroupPoints->TextLabel5->setText(tr("GEOM_POINT_I").arg(2));
|
||||
|
||||
GroupPoints->LineEdit1->setReadOnly( true );
|
||||
GroupPoints->LineEdit2->setReadOnly( true );
|
||||
GroupPoints->LineEdit4->setReadOnly( true );
|
||||
GroupPoints->LineEdit5->setReadOnly( true );
|
||||
GroupPoints->PushButton1->setIcon( image1 );
|
||||
GroupPoints->PushButton2->setIcon( image1 );
|
||||
GroupPoints->PushButton4->setIcon( image1 );
|
||||
GroupPoints->PushButton5->setIcon( image1 );
|
||||
GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) );
|
||||
GroupPoints->CheckButton2->setText( tr( "GEOM_REVERSE" ) );
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
|
||||
layout->setMargin( 0 ); layout->setSpacing( 6 );
|
||||
layout->addWidget( GroupPoints );
|
||||
GroupPoints->LineEdit1->setReadOnly(true);
|
||||
GroupPoints->LineEdit2->setReadOnly(true);
|
||||
GroupPoints->LineEdit4->setReadOnly(true);
|
||||
GroupPoints->LineEdit5->setReadOnly(true);
|
||||
GroupPoints->PushButton1->setIcon(image1);
|
||||
GroupPoints->PushButton2->setIcon(image1);
|
||||
GroupPoints->PushButton4->setIcon(image1);
|
||||
GroupPoints->PushButton5->setIcon(image1);
|
||||
GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY"));
|
||||
GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE"));
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||
layout->setMargin(0); layout->setSpacing(6);
|
||||
layout->addWidget(GroupPoints);
|
||||
/***************************************************************/
|
||||
double anAngle = 0;
|
||||
double SpecificStep = 5;
|
||||
/* min, max, step and decimals for spin boxes & initial values */
|
||||
initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
GroupPoints->SpinBox_DX->setValue( anAngle );
|
||||
|
||||
setHelpFileName("rotation_operation_page.html");
|
||||
|
||||
// Activate Create a Copy mode
|
||||
GroupPoints->CheckButton1->setChecked( true );
|
||||
CreateCopyModeChanged( true );
|
||||
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
|
||||
/* signals and slots connections */
|
||||
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
|
||||
|
||||
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
|
||||
|
||||
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( GroupPoints->PushButton4, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( GroupPoints->PushButton5, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
|
||||
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
|
||||
connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
|
||||
connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) );
|
||||
connect( GroupPoints->CheckButton2, SIGNAL( toggled( bool ) ), this, SLOT( onReverse() ) );
|
||||
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
setHelpFileName( "rotation_operation_page.html" );
|
||||
GroupPoints->CheckButton1->setChecked(true);
|
||||
CreateCopyModeChanged(true);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~TransformationGUI_RotationDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
@ -140,62 +112,104 @@ TransformationGUI_RotationDlg::~TransformationGUI_RotationDlg()
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_RotationDlg::Init()
|
||||
{
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit2->clear();
|
||||
|
||||
double anAngle = 0;
|
||||
double SpecificStep = 5;
|
||||
|
||||
// min, max, step and decimals for spin boxes & initial values
|
||||
initSpinBox(GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||
GroupPoints->SpinBox_DX->setValue(anAngle);
|
||||
|
||||
// init variables
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
GroupPoints->LineEdit4->setText("");
|
||||
GroupPoints->LineEdit5->setText("");
|
||||
|
||||
myAxis = myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
|
||||
initName( tr( "GEOM_ROTATION" ) );
|
||||
ConstructorsClicked( 0 );
|
||||
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
|
||||
// signals and slots connections
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
|
||||
|
||||
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupPoints->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||
|
||||
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
||||
connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
|
||||
|
||||
initName(tr("GEOM_ROTATION"));
|
||||
|
||||
ConstructorsClicked(0);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void TransformationGUI_RotationDlg::ConstructorsClicked( int constructorId )
|
||||
void TransformationGUI_RotationDlg::ConstructorsClicked (int constructorId)
|
||||
{
|
||||
disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
|
||||
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
globalSelection();
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
|
||||
switch ( constructorId ) {
|
||||
case 0: /* rotation an object angle and axis */
|
||||
GroupPoints->ShowRows( 2, 3, false );
|
||||
GroupPoints->TextLabel2->setText( tr( "GEOM_AXIS" ) );
|
||||
GroupPoints->LineEdit2->clear();
|
||||
GroupPoints->ShowRows( 4, 4, true );
|
||||
myAxis = GEOM::GEOM_Object::_nil();
|
||||
switch (constructorId) {
|
||||
case 0: // rotation an object angle and axis
|
||||
{
|
||||
GroupPoints->ShowRows(2, 3, false);
|
||||
GroupPoints->TextLabel2->setText(tr("GEOM_AXIS"));
|
||||
GroupPoints->LineEdit2->clear();
|
||||
GroupPoints->ShowRows(4, 4, true);
|
||||
|
||||
myAxis = GEOM::GEOM_Object::_nil();
|
||||
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
break;
|
||||
case 1: /* rotation an object by 3 points */
|
||||
GroupPoints->ShowRows( 4, 4, false );
|
||||
GroupPoints->ShowRows( 2, 3, true );
|
||||
GroupPoints->TextLabel2->setText( tr( "GEOM_CENTRAL_POINT" ) );
|
||||
GroupPoints->TextLabel4->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
|
||||
GroupPoints->TextLabel5->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
|
||||
GroupPoints->LineEdit2->clear();
|
||||
GroupPoints->LineEdit4->clear();
|
||||
GroupPoints->LineEdit5->clear();
|
||||
myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
case 1: // rotation an object by 3 points
|
||||
{
|
||||
GroupPoints->ShowRows(4, 4, false);
|
||||
GroupPoints->ShowRows(2, 3, true);
|
||||
GroupPoints->TextLabel2->setText(tr("GEOM_CENTRAL_POINT"));
|
||||
GroupPoints->TextLabel4->setText(tr("GEOM_POINT_I").arg(1));
|
||||
GroupPoints->TextLabel5->setText(tr("GEOM_POINT_I").arg(2));
|
||||
|
||||
GroupPoints->LineEdit2->clear();
|
||||
GroupPoints->LineEdit4->clear();
|
||||
GroupPoints->LineEdit5->clear();
|
||||
|
||||
myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
qApp->processEvents();
|
||||
updateGeometry();
|
||||
resize( minimumSize() );
|
||||
resize(minimumSize());
|
||||
|
||||
myEditCurrentArgument->setFocus();
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
if (myInitial) {
|
||||
myInitial = false;
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
else {
|
||||
displayPreview();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -204,118 +218,147 @@ void TransformationGUI_RotationDlg::ConstructorsClicked( int constructorId )
|
||||
//=================================================================================
|
||||
void TransformationGUI_RotationDlg::ClickOnOk()
|
||||
{
|
||||
if ( ClickOnApply() )
|
||||
if (ClickOnApply())
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_RotationDlg::ClickOnApply()
|
||||
{
|
||||
if ( !onAccept( GroupPoints->CheckButton1->isChecked() ) )
|
||||
if (!onAccept(GroupPoints->CheckButton1->isChecked()))
|
||||
return false;
|
||||
|
||||
|
||||
initName();
|
||||
ConstructorsClicked( getConstructorId() );
|
||||
// activate selection and connect selection manager
|
||||
ConstructorsClicked(getConstructorId());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection as changed or other case
|
||||
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||
//=================================================================================
|
||||
void TransformationGUI_RotationDlg::SelectionIntoArgument()
|
||||
{
|
||||
myEditCurrentArgument->setText( "" );
|
||||
QString aName;
|
||||
|
||||
erasePreview();
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||
myObjects.length(0);
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
|
||||
myAxis = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
|
||||
myCentPoint = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit4)
|
||||
myPoint1 = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit5)
|
||||
myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
QString aName;
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
||||
if (aNbSel < 1) {
|
||||
myObjects.length(0);
|
||||
if (aNbSel < 1)
|
||||
return;
|
||||
}
|
||||
|
||||
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
||||
if (!myObjects.length())
|
||||
return;
|
||||
else
|
||||
myEditCurrentArgument->setText(aName);
|
||||
}
|
||||
else {
|
||||
if (aSelList.Extent() != 1) {
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0 )
|
||||
myAxis = GEOM::GEOM_Object::_nil();
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 )
|
||||
myCentPoint = GEOM::GEOM_Object::_nil();
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit4 )
|
||||
myPoint1 = GEOM::GEOM_Object::_nil();
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit5 )
|
||||
myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
}
|
||||
|
||||
// nbSel == 1
|
||||
Standard_Boolean testResult = Standard_False;
|
||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
||||
if ( !testResult || CORBA::is_nil( aSelectedObject ) )
|
||||
|
||||
if (!testResult || CORBA::is_nil(aSelectedObject))
|
||||
return;
|
||||
|
||||
aName = GEOMBase::GetName( aSelectedObject );
|
||||
|
||||
aName = GEOMBase::GetName(aSelectedObject);
|
||||
|
||||
// Get Selected object if selected subshape
|
||||
TopoDS_Shape aShape;
|
||||
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
|
||||
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
|
||||
{
|
||||
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0 )
|
||||
aNeedType = TopAbs_EDGE;
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
|
||||
aNeedType = TopAbs_EDGE;
|
||||
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
||||
if ( aMap.Extent() == 1 ) {
|
||||
int anIndex = aMap( 1 );
|
||||
if ( aNeedType == TopAbs_EDGE )
|
||||
aName += QString( ":edge_%1" ).arg( anIndex );
|
||||
else
|
||||
aName += QString( ":vertex_%1" ).arg( anIndex );
|
||||
|
||||
//Find SubShape Object in Father
|
||||
GEOM::GEOM_Object_var aFindedObject = findObjectInFather( aSelectedObject, aName );
|
||||
|
||||
if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
|
||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||
getGeomEngine()->GetIShapesOperations( getStudyId() );
|
||||
aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
|
||||
}
|
||||
else {
|
||||
aSelectedObject = aFindedObject; // get Object from study
|
||||
}
|
||||
if (aMap.Extent() == 1)
|
||||
{
|
||||
int anIndex = aMap(1);
|
||||
if (aNeedType == TopAbs_EDGE)
|
||||
aName += QString(":edge_%1").arg(anIndex);
|
||||
else
|
||||
aName += QString(":vertex_%1").arg(anIndex);
|
||||
|
||||
//Find SubShape Object in Father
|
||||
GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
|
||||
|
||||
if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
|
||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||
}
|
||||
else {
|
||||
aSelectedObject = aFindedObject; // get Object from study
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( aShape.ShapeType() != aNeedType ) {
|
||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
}
|
||||
else // Global Selection
|
||||
{
|
||||
if (aShape.ShapeType() != aNeedType) {
|
||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0 )
|
||||
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) {
|
||||
myAxis = aSelectedObject;
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 )
|
||||
if (!myAxis->_is_nil() && !myObjects.length())
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) {
|
||||
myCentPoint = aSelectedObject;
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit4 )
|
||||
if (!myCentPoint->_is_nil() && myPoint1->_is_nil())
|
||||
GroupPoints->PushButton4->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit4) {
|
||||
myPoint1 = aSelectedObject;
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit5 )
|
||||
if (!myPoint1->_is_nil() && myPoint2->_is_nil())
|
||||
GroupPoints->PushButton5->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit5) {
|
||||
myPoint2 = aSelectedObject;
|
||||
if (!myPoint2->_is_nil() && !myObjects.length())
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
}
|
||||
myEditCurrentArgument->setText( aName );
|
||||
|
||||
|
||||
// clear selection
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
@ -323,47 +366,82 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
|
||||
void TransformationGUI_RotationDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
globalSelection();
|
||||
|
||||
if ( send == GroupPoints->PushButton1 ) {
|
||||
|
||||
if (send == GroupPoints->PushButton1) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
|
||||
GroupPoints->PushButton2->setDown(false);
|
||||
GroupPoints->LineEdit2->setEnabled(false);
|
||||
}
|
||||
else if ( send == GroupPoints->PushButton2 ) {
|
||||
else if (send == GroupPoints->PushButton2) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
if ( getConstructorId() == 0 )
|
||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
|
||||
|
||||
GroupPoints->PushButton1->setDown(false);
|
||||
GroupPoints->PushButton4->setDown(false);
|
||||
GroupPoints->PushButton5->setDown(false);
|
||||
GroupPoints->LineEdit1->setEnabled(false);
|
||||
GroupPoints->LineEdit4->setEnabled(false);
|
||||
GroupPoints->LineEdit5->setEnabled(false);
|
||||
|
||||
if (getConstructorId() == 0)
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||
else
|
||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||
}
|
||||
else if ( send == GroupPoints->PushButton4 ) {
|
||||
else if (send == GroupPoints->PushButton4) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit4;
|
||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
||||
|
||||
GroupPoints->PushButton1->setDown(false);
|
||||
GroupPoints->PushButton2->setDown(false);
|
||||
GroupPoints->PushButton5->setDown(false);
|
||||
GroupPoints->LineEdit1->setEnabled(false);
|
||||
GroupPoints->LineEdit2->setEnabled(false);
|
||||
GroupPoints->LineEdit5->setEnabled(false);
|
||||
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||
}
|
||||
else if ( send == GroupPoints->PushButton5 ) {
|
||||
else if (send == GroupPoints->PushButton5) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit5;
|
||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
||||
|
||||
GroupPoints->PushButton1->setDown(false);
|
||||
GroupPoints->PushButton2->setDown(false);
|
||||
GroupPoints->PushButton4->setDown(false);
|
||||
GroupPoints->LineEdit1->setEnabled(false);
|
||||
GroupPoints->LineEdit2->setEnabled(false);
|
||||
GroupPoints->LineEdit4->setEnabled(false);
|
||||
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||
}
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
|
||||
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_RotationDlg::LineEditReturnPressed()
|
||||
{
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if ( send == GroupPoints->LineEdit1 ||
|
||||
send == GroupPoints->LineEdit2 ) {
|
||||
if (send == GroupPoints->LineEdit1 ||
|
||||
send == GroupPoints->LineEdit2) {
|
||||
myEditCurrentArgument = send;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -371,24 +449,21 @@ void TransformationGUI_RotationDlg::LineEditReturnPressed()
|
||||
void TransformationGUI_RotationDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ) , this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
ConstructorsClicked( getConstructorId() );
|
||||
// reinit, because some selected objects could be removed
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_RotationDlg::enterEvent( QEvent* )
|
||||
void TransformationGUI_RotationDlg::enterEvent (QEvent*)
|
||||
{
|
||||
if ( !mainFrame()->GroupConstructors->isEnabled() )
|
||||
if (!mainFrame()->GroupConstructors->isEnabled())
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ValueChangedInSpinBox()
|
||||
// purpose :
|
||||
@ -398,92 +473,96 @@ void TransformationGUI_RotationDlg::ValueChangedInSpinBox()
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : createOperation
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
GEOM::GEOM_IOperations_ptr TransformationGUI_RotationDlg::createOperation()
|
||||
{
|
||||
return getGeomEngine()->GetITransformOperations( getStudyId() );
|
||||
return getGeomEngine()->GetITransformOperations(getStudyId());
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_RotationDlg::isValid( QString& /*msg*/ )
|
||||
bool TransformationGUI_RotationDlg::isValid (QString& /*msg*/)
|
||||
{
|
||||
switch ( getConstructorId() ) {
|
||||
case 0:
|
||||
return !( myObjects.length() == 0 || myAxis->_is_nil() );
|
||||
break;
|
||||
case 1:
|
||||
return !( myObjects.length() == 0 || myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil() );
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (myObjects.length() < 1) return false;
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
return !(myAxis->_is_nil());
|
||||
break;
|
||||
case 1:
|
||||
return !(myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : execute
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_RotationDlg::execute( ObjectList& objects )
|
||||
bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
|
||||
{
|
||||
bool res = false;
|
||||
bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
|
||||
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
switch ( getConstructorId() ) {
|
||||
case 0 :
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
{
|
||||
if ( toCreateCopy ) {
|
||||
for ( int i = 0; i < myObjects.length(); i++ ) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateCopy( myObjects[i], myAxis, GetAngle() * PI180 );
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
}
|
||||
if (toCreateCopy) {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
RotateCopy(myObjects[i], myAxis, GetAngle() * PI180);
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
else {
|
||||
for ( int i = 0; i < myObjects.length(); i++ ) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->Rotate( myObjects[i], myAxis, GetAngle() * PI180 );
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
}
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
Rotate(myObjects[i], myAxis, GetAngle() * PI180);
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
case 1 :
|
||||
case 1:
|
||||
{
|
||||
if ( toCreateCopy ) {
|
||||
for ( int i = 0; i < myObjects.length(); i++ ) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePointsCopy( myObjects[i], myCentPoint, myPoint1, myPoint2 );
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
}
|
||||
if (toCreateCopy) {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
RotateThreePointsCopy(myObjects[i], myCentPoint, myPoint1, myPoint2);
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
else {
|
||||
for ( int i = 0; i < myObjects.length(); i++ ) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePoints( myObjects[i], myCentPoint, myPoint1, myPoint2 );
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
}
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
RotateThreePoints(myObjects[i], myCentPoint, myPoint1, myPoint2);
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -491,19 +570,19 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects )
|
||||
// function : restoreSubShapes
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_RotationDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy,
|
||||
SALOMEDS::SObject_ptr theSObject )
|
||||
void TransformationGUI_RotationDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
||||
SALOMEDS::SObject_ptr theSObject)
|
||||
{
|
||||
if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) {
|
||||
if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
|
||||
// we pass here the first operation argument (object) through the list of arguments
|
||||
// because the rotation operation place its arguments in the data structure in another order,
|
||||
// and we need to point the first argument directly
|
||||
GEOM::ListOfGO_var anArgs = new GEOM::ListOfGO;
|
||||
anArgs->length(1);
|
||||
anArgs[0] = myCurrObject;
|
||||
getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, anArgs,
|
||||
/*theFindMethod=*/GEOM::FSM_Transformed,
|
||||
/*theInheritFirstArg=*/true );
|
||||
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
|
||||
/*theFindMethod=*/GEOM::FSM_Transformed,
|
||||
/*theInheritFirstArg=*/true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -520,9 +599,9 @@ double TransformationGUI_RotationDlg::GetAngle() const
|
||||
// function : CreateCopyModeChanged()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_RotationDlg::CreateCopyModeChanged( bool isCreateCopy )
|
||||
void TransformationGUI_RotationDlg::CreateCopyModeChanged (bool isCreateCopy)
|
||||
{
|
||||
mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
|
||||
mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -532,19 +611,19 @@ void TransformationGUI_RotationDlg::CreateCopyModeChanged( bool isCreateCopy )
|
||||
void TransformationGUI_RotationDlg::onReverse()
|
||||
{
|
||||
double anOldValue = GroupPoints->SpinBox_DX->value();
|
||||
GroupPoints->SpinBox_DX->setValue( -anOldValue );
|
||||
GroupPoints->SpinBox_DX->setValue(-anOldValue);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : addSubshapeToStudy
|
||||
// function : addSubshapesToStudy
|
||||
// purpose : virtual method to add new SubObjects if local selection
|
||||
//=================================================================================
|
||||
void TransformationGUI_RotationDlg::addSubshapesToStudy()
|
||||
{
|
||||
bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
|
||||
if ( toCreateCopy ) {
|
||||
if (toCreateCopy) {
|
||||
QMap<QString, GEOM::GEOM_Object_var> objMap;
|
||||
switch ( getConstructorId() ) {
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
objMap[GroupPoints->LineEdit2->text()] = myAxis;
|
||||
break;
|
||||
@ -554,6 +633,6 @@ void TransformationGUI_RotationDlg::addSubshapesToStudy()
|
||||
objMap[GroupPoints->LineEdit5->text()] = myPoint2;
|
||||
break;
|
||||
}
|
||||
addSubshapesToFather( objMap );
|
||||
addSubshapesToFather(objMap);
|
||||
}
|
||||
}
|
||||
|
@ -60,6 +60,9 @@ private:
|
||||
GEOM::ListOfGO myObjects;
|
||||
GEOM::GEOM_Object_var myCurrObject;
|
||||
GEOM::GEOM_Object_var myAxis, myCentPoint, myPoint1, myPoint2;
|
||||
|
||||
// to initialize the first selection field with a selected object on the dialog creation
|
||||
bool myInitial;
|
||||
|
||||
DlgRef_4Sel1Spin2Check* GroupPoints;
|
||||
|
||||
|
@ -1,22 +1,22 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 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.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : TransformationGUI_ScaleDlg.cxx
|
||||
@ -29,11 +29,12 @@
|
||||
#include <GEOMBase.h>
|
||||
|
||||
#include <QtxDoubleSpinBox.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
// OCCT Includes
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopExp.hxx>
|
||||
@ -44,125 +45,94 @@
|
||||
|
||||
//=================================================================================
|
||||
// class : TransformationGUI_ScaleDlg()
|
||||
// purpose : Constructs a TransformationGUI_ScaleDlg which is a child of 'parent', with the
|
||||
// purpose : Constructs a TransformationGUI_ScaleDlg which is a child of 'parent', with the
|
||||
// name 'name' and widget flags set to 'f'.
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
|
||||
bool modal, Qt::WindowFlags fl )
|
||||
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
|
||||
TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
|
||||
bool modal, Qt::WindowFlags fl)
|
||||
: GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
|
||||
myInitial(true)
|
||||
{
|
||||
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
||||
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_SCALE" ) ) );
|
||||
QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_SCALE_ALONG_AXES" ) ) );
|
||||
QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
|
||||
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_SCALE")));
|
||||
QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_SCALE_ALONG_AXES")));
|
||||
QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||
|
||||
setWindowTitle( tr( "GEOM_SCALE_TITLE" ) );
|
||||
setWindowTitle(tr("GEOM_SCALE_TITLE"));
|
||||
|
||||
// Constructors
|
||||
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_SCALE" ) );
|
||||
mainFrame()->RadioButton1->setIcon( image1 );
|
||||
mainFrame()->RadioButton2->setIcon( image2 );
|
||||
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
|
||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_SCALE"));
|
||||
mainFrame()->RadioButton1->setIcon(image1);
|
||||
mainFrame()->RadioButton2->setIcon(image2);
|
||||
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
|
||||
mainFrame()->RadioButton3->close();
|
||||
|
||||
// Own widgets
|
||||
GroupBox1 = new QGroupBox( tr( "GEOM_ARGUMENTS" ), this );
|
||||
QGridLayout* OwnLayout = new QGridLayout( GroupBox1 );
|
||||
OwnLayout->setSpacing( 6 );
|
||||
OwnLayout->setMargin( 11 );
|
||||
GroupBox1 = new QGroupBox(tr("GEOM_ARGUMENTS"), this);
|
||||
QGridLayout* OwnLayout = new QGridLayout(GroupBox1);
|
||||
OwnLayout->setSpacing(6);
|
||||
OwnLayout->setMargin(11);
|
||||
|
||||
TextLabel1 = new QLabel( tr( "GEOM_OBJECTS" ), GroupBox1 );
|
||||
PushButton1 = new QPushButton( GroupBox1 );
|
||||
PushButton1->setIcon( image3 );
|
||||
PushButton1->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
|
||||
LineEdit1 = new QLineEdit( GroupBox1 );
|
||||
LineEdit1->setReadOnly( true );
|
||||
LineEdit1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
||||
TextLabel1 = new QLabel(tr("GEOM_OBJECTS"), GroupBox1);
|
||||
PushButton1 = new QPushButton(GroupBox1);
|
||||
PushButton1->setIcon(image3);
|
||||
PushButton1->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||
LineEdit1 = new QLineEdit(GroupBox1);
|
||||
LineEdit1->setReadOnly(true);
|
||||
LineEdit1->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
|
||||
|
||||
TextLabel2 = new QLabel( tr( "GEOM_CENTRAL_POINT" ), GroupBox1 );
|
||||
PushButton2 = new QPushButton( GroupBox1 );
|
||||
PushButton2->setIcon( image3 );
|
||||
PushButton2->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
|
||||
LineEdit2 = new QLineEdit( GroupBox1 );
|
||||
LineEdit2->setReadOnly( true );
|
||||
LineEdit2->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
||||
TextLabel2 = new QLabel(tr("GEOM_CENTRAL_POINT"), GroupBox1);
|
||||
PushButton2 = new QPushButton(GroupBox1);
|
||||
PushButton2->setIcon(image3);
|
||||
PushButton2->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||
LineEdit2 = new QLineEdit(GroupBox1);
|
||||
LineEdit2->setReadOnly(true);
|
||||
LineEdit2->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
|
||||
|
||||
TextLabel3 = new QLabel( tr( "GEOM_SCALE_FACTOR" ), GroupBox1 );
|
||||
SpinBox_FX = new QtxDoubleSpinBox( GroupBox1 );
|
||||
TextLabel3 = new QLabel(tr("GEOM_SCALE_FACTOR"), GroupBox1);
|
||||
SpinBox_FX = new QtxDoubleSpinBox(GroupBox1);
|
||||
|
||||
TextLabel4 = new QLabel( tr( "GEOM_SCALE_FACTOR_Y" ), GroupBox1 );
|
||||
SpinBox_FY = new QtxDoubleSpinBox( GroupBox1 );
|
||||
TextLabel4 = new QLabel(tr("GEOM_SCALE_FACTOR_Y"), GroupBox1);
|
||||
SpinBox_FY = new QtxDoubleSpinBox(GroupBox1);
|
||||
|
||||
TextLabel5 = new QLabel( tr( "GEOM_SCALE_FACTOR_Z" ), GroupBox1 );
|
||||
SpinBox_FZ = new QtxDoubleSpinBox( GroupBox1 );
|
||||
TextLabel5 = new QLabel(tr("GEOM_SCALE_FACTOR_Z"), GroupBox1);
|
||||
SpinBox_FZ = new QtxDoubleSpinBox(GroupBox1);
|
||||
|
||||
CheckBoxCopy = new QCheckBox( tr( "GEOM_CREATE_COPY" ), GroupBox1 );
|
||||
CheckBoxCopy->setChecked( true );
|
||||
CheckBoxCopy = new QCheckBox(tr("GEOM_CREATE_COPY"), GroupBox1);
|
||||
CheckBoxCopy->setChecked(true);
|
||||
|
||||
// Layouting
|
||||
OwnLayout->addWidget( TextLabel1, 0, 0 );
|
||||
OwnLayout->addWidget( PushButton1, 0, 1 );
|
||||
OwnLayout->addWidget( LineEdit1, 0, 2, 1, 2 );
|
||||
OwnLayout->addWidget( TextLabel2, 1, 0 );
|
||||
OwnLayout->addWidget( PushButton2, 1, 1 );
|
||||
OwnLayout->addWidget( LineEdit2, 1, 2, 1, 2 );
|
||||
OwnLayout->addWidget( TextLabel3, 2, 0 );
|
||||
OwnLayout->addWidget( SpinBox_FX, 2, 2 );
|
||||
OwnLayout->addWidget( TextLabel4, 3, 0 );
|
||||
OwnLayout->addWidget( SpinBox_FY, 3, 2 );
|
||||
OwnLayout->addWidget( TextLabel5, 4, 0 );
|
||||
OwnLayout->addWidget( SpinBox_FZ, 4, 2 );
|
||||
OwnLayout->addWidget( CheckBoxCopy, 5, 0, 1, 4 );
|
||||
OwnLayout->addWidget(TextLabel1, 0, 0);
|
||||
OwnLayout->addWidget(PushButton1, 0, 1);
|
||||
OwnLayout->addWidget(LineEdit1, 0, 2, 1, 2);
|
||||
OwnLayout->addWidget(TextLabel2, 1, 0);
|
||||
OwnLayout->addWidget(PushButton2, 1, 1);
|
||||
OwnLayout->addWidget(LineEdit2, 1, 2, 1, 2);
|
||||
OwnLayout->addWidget(TextLabel3, 2, 0);
|
||||
OwnLayout->addWidget(SpinBox_FX, 2, 2);
|
||||
OwnLayout->addWidget(TextLabel4, 3, 0);
|
||||
OwnLayout->addWidget(SpinBox_FY, 3, 2);
|
||||
OwnLayout->addWidget(TextLabel5, 4, 0);
|
||||
OwnLayout->addWidget(SpinBox_FZ, 4, 2);
|
||||
OwnLayout->addWidget(CheckBoxCopy, 5, 0, 1, 4);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
|
||||
layout->setMargin( 0 ); layout->setSpacing( 6 );
|
||||
layout->addWidget( GroupBox1 );
|
||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||
layout->setMargin(0); layout->setSpacing(6);
|
||||
layout->addWidget(GroupBox1);
|
||||
|
||||
// Min, max, step and decimals for spin boxes & initial values
|
||||
double aFactor = 2.0;
|
||||
double SpecificStep = 0.5;
|
||||
initSpinBox( SpinBox_FX, COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY );
|
||||
initSpinBox( SpinBox_FY, COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY );
|
||||
initSpinBox( SpinBox_FZ, COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY );
|
||||
SpinBox_FX->setValue( aFactor );
|
||||
SpinBox_FY->setValue( aFactor );
|
||||
SpinBox_FZ->setValue( aFactor );
|
||||
setHelpFileName("scale_operation_page.html");
|
||||
|
||||
// Modification of an existing object by offset is not allowed
|
||||
CheckBoxCopy->hide();
|
||||
|
||||
|
||||
// Activate Create a Copy mode
|
||||
CreateCopyModeChanged( true );
|
||||
CreateCopyModeChanged(true);
|
||||
|
||||
// Allowed inheritance of children and visual properties by the scaling result
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
|
||||
// Signals and slots connections
|
||||
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
|
||||
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
|
||||
|
||||
connect( PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
|
||||
connect( LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
||||
|
||||
connect( SpinBox_FX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
|
||||
connect( SpinBox_FY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
|
||||
connect( SpinBox_FZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
|
||||
|
||||
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
|
||||
|
||||
connect( CheckBoxCopy, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) );
|
||||
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
setHelpFileName( "scale_operation_page.html" );
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
@ -171,7 +141,7 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg( GeometryGUI* theGeometry
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
TransformationGUI_ScaleDlg::~TransformationGUI_ScaleDlg()
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -180,39 +150,73 @@ TransformationGUI_ScaleDlg::~TransformationGUI_ScaleDlg()
|
||||
//=================================================================================
|
||||
void TransformationGUI_ScaleDlg::Init()
|
||||
{
|
||||
myEditCurrentArgument = LineEdit1;
|
||||
LineEdit2->clear();
|
||||
|
||||
myPoint = GEOM::GEOM_Object::_nil();
|
||||
|
||||
initName( tr( "GEOM_SCALE" ) );
|
||||
// Min, max, step and decimals for spin boxes & initial values
|
||||
double aFactor = 2.0;
|
||||
double SpecificStep = 0.5;
|
||||
|
||||
ConstructorsClicked( 0 );
|
||||
initSpinBox(SpinBox_FX, COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
|
||||
initSpinBox(SpinBox_FY, COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
|
||||
initSpinBox(SpinBox_FZ, COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
|
||||
SpinBox_FX->setValue(aFactor);
|
||||
SpinBox_FY->setValue(aFactor);
|
||||
SpinBox_FZ->setValue(aFactor);
|
||||
|
||||
// init variables
|
||||
LineEdit1->setText("");
|
||||
LineEdit2->setText("");
|
||||
|
||||
myPoint = GEOM::GEOM_Object::_nil();
|
||||
|
||||
// Signals and slots connections
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
|
||||
|
||||
connect(PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect(LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
connect(SpinBox_FX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||
connect(SpinBox_FY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||
connect(SpinBox_FZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||
|
||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
|
||||
|
||||
connect(CheckBoxCopy, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
||||
|
||||
initName(tr("GEOM_SCALE"));
|
||||
|
||||
ConstructorsClicked(0);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void TransformationGUI_ScaleDlg::ConstructorsClicked( int constructorId )
|
||||
void TransformationGUI_ScaleDlg::ConstructorsClicked (int constructorId)
|
||||
{
|
||||
erasePreview();
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
|
||||
switch( constructorId )
|
||||
{
|
||||
case 0: /* translation an object by dx, dy, dz */
|
||||
TextLabel3->setText( tr( "GEOM_SCALE_FACTOR" ) );
|
||||
switch (constructorId) {
|
||||
case 0: // translation an object by dx, dy, dz
|
||||
TextLabel3->setText(tr("GEOM_SCALE_FACTOR"));
|
||||
TextLabel4->hide();
|
||||
TextLabel5->hide();
|
||||
SpinBox_FY->hide();
|
||||
SpinBox_FZ->hide();
|
||||
|
||||
PushButton1->click();
|
||||
break;
|
||||
case 1: /* translation an object by 2 points */
|
||||
TextLabel3->setText( tr( "GEOM_SCALE_FACTOR_X" ) );
|
||||
case 1: // translation an object by 2 points
|
||||
TextLabel3->setText(tr("GEOM_SCALE_FACTOR_X"));
|
||||
TextLabel4->show();
|
||||
TextLabel5->show();
|
||||
SpinBox_FY->show();
|
||||
SpinBox_FZ->show();
|
||||
|
||||
PushButton1->click();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -220,9 +224,15 @@ void TransformationGUI_ScaleDlg::ConstructorsClicked( int constructorId )
|
||||
|
||||
qApp->processEvents();
|
||||
updateGeometry();
|
||||
resize( minimumSize() );
|
||||
resize(minimumSize());
|
||||
|
||||
displayPreview();
|
||||
if (myInitial) {
|
||||
myInitial = false;
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
else {
|
||||
displayPreview();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -231,7 +241,7 @@ void TransformationGUI_ScaleDlg::ConstructorsClicked( int constructorId )
|
||||
//=================================================================================
|
||||
void TransformationGUI_ScaleDlg::ClickOnOk()
|
||||
{
|
||||
if ( ClickOnApply() )
|
||||
if (ClickOnApply())
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
@ -241,38 +251,46 @@ void TransformationGUI_ScaleDlg::ClickOnOk()
|
||||
//=================================================================================
|
||||
bool TransformationGUI_ScaleDlg::ClickOnApply()
|
||||
{
|
||||
if ( !onAccept( CheckBoxCopy->isChecked() ) )
|
||||
if (!onAccept(CheckBoxCopy->isChecked()))
|
||||
return false;
|
||||
|
||||
initName( tr( "GEOM_SCALE" ) );
|
||||
initName(tr("GEOM_SCALE"));
|
||||
// activate selection and connect selection manager
|
||||
ConstructorsClicked(getConstructorId());
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection as changed or other case
|
||||
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||
//=================================================================================
|
||||
void TransformationGUI_ScaleDlg::SelectionIntoArgument()
|
||||
{
|
||||
erasePreview();
|
||||
myEditCurrentArgument->setText( "" );
|
||||
QString aName;
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
if (myEditCurrentArgument == LineEdit1)
|
||||
myObjects.length(0);
|
||||
else if (myEditCurrentArgument == LineEdit2)
|
||||
myPoint = GEOM::GEOM_Object::_nil();
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
QString aName;
|
||||
|
||||
if (myEditCurrentArgument == LineEdit1)
|
||||
{
|
||||
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
||||
if (aNbSel < 1)
|
||||
{
|
||||
myObjects.length(0);
|
||||
return;
|
||||
}
|
||||
|
||||
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
||||
if (!myObjects.length())
|
||||
return;
|
||||
else
|
||||
myEditCurrentArgument->setText(aName);
|
||||
}
|
||||
else if (myEditCurrentArgument == LineEdit2)
|
||||
{
|
||||
@ -292,24 +310,23 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
|
||||
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
||||
if (aMap.Extent() == 1)
|
||||
{
|
||||
int anIndex = aMap( 1 );
|
||||
aName += QString( ":vertex_%1" ).arg( anIndex );
|
||||
int anIndex = aMap(1);
|
||||
aName += QString(":vertex_%1").arg(anIndex);
|
||||
|
||||
//Find SubShape Object in Father
|
||||
GEOM::GEOM_Object_var aFindedObject = findObjectInFather( aSelectedObject, aName );
|
||||
GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
|
||||
|
||||
if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
|
||||
if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
|
||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||
getGeomEngine()->GetIShapesOperations( getStudyId() );
|
||||
aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
|
||||
aSelMgr->clearSelected();
|
||||
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||
}
|
||||
else
|
||||
aSelectedObject = aFindedObject; // get Object from study
|
||||
}
|
||||
else
|
||||
else // Global Selection
|
||||
{
|
||||
if ( aShape.ShapeType() != TopAbs_VERTEX ) {
|
||||
if (aShape.ShapeType() != TopAbs_VERTEX) {
|
||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
}
|
||||
@ -319,9 +336,56 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
|
||||
}
|
||||
|
||||
myPoint = aSelectedObject;
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (!myPoint->_is_nil() && !myObjects.length())
|
||||
PushButton1->click();
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setText(aName);
|
||||
// clear selection
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
globalSelection();
|
||||
|
||||
if (send == PushButton1) {
|
||||
myEditCurrentArgument = LineEdit1;
|
||||
|
||||
PushButton2->setDown(false);
|
||||
LineEdit2->setEnabled(false);
|
||||
}
|
||||
else if (send == PushButton2) {
|
||||
myEditCurrentArgument = LineEdit2;
|
||||
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||
|
||||
PushButton1->setDown(false);
|
||||
LineEdit1->setEnabled(false);
|
||||
}
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
// after setFocus(), because it will be setDown(false) when loses focus
|
||||
send->setDown(true);
|
||||
|
||||
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
@ -332,34 +396,13 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
|
||||
void TransformationGUI_ScaleDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if ( send == LineEdit1 || send == LineEdit2 )
|
||||
if (send == LineEdit1 || send == LineEdit2)
|
||||
{
|
||||
myEditCurrentArgument = send;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
globalSelection();
|
||||
|
||||
if ( send == PushButton1 ) {
|
||||
myEditCurrentArgument = LineEdit1;
|
||||
}
|
||||
else if ( send == PushButton2 ) {
|
||||
myEditCurrentArgument = LineEdit2;
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setFocus();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -367,22 +410,18 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
|
||||
void TransformationGUI_ScaleDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
|
||||
this, SLOT( SelectionIntoArgument() ) );
|
||||
globalSelection();
|
||||
myEditCurrentArgument->setFocus();
|
||||
if ( myEditCurrentArgument == LineEdit2 ) {
|
||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
||||
}
|
||||
|
||||
// reinit, because some selected objects could be removed
|
||||
Init();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_ScaleDlg::enterEvent( QEvent* )
|
||||
void TransformationGUI_ScaleDlg::enterEvent (QEvent*)
|
||||
{
|
||||
if ( !mainFrame()->GroupConstructors->isEnabled() )
|
||||
if (!mainFrame()->GroupConstructors->isEnabled())
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
@ -399,11 +438,11 @@ void TransformationGUI_ScaleDlg::ValueChangedInSpinBox()
|
||||
// function : SetDoubleSpinBoxStep()
|
||||
// purpose : Double spin box management
|
||||
//=================================================================================
|
||||
void TransformationGUI_ScaleDlg::SetDoubleSpinBoxStep( double step )
|
||||
void TransformationGUI_ScaleDlg::SetDoubleSpinBoxStep(double step)
|
||||
{
|
||||
SpinBox_FX->setSingleStep( step );
|
||||
SpinBox_FY->setSingleStep( step );
|
||||
SpinBox_FZ->setSingleStep( step );
|
||||
SpinBox_FX->setSingleStep(step);
|
||||
SpinBox_FY->setSingleStep(step);
|
||||
SpinBox_FZ->setSingleStep(step);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -412,22 +451,22 @@ void TransformationGUI_ScaleDlg::SetDoubleSpinBoxStep( double step )
|
||||
//=================================================================================
|
||||
GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation()
|
||||
{
|
||||
return myGeomGUI->GetGeomGen()->GetITransformOperations( getStudyId() );
|
||||
return getGeomEngine()->GetITransformOperations(getStudyId());
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_ScaleDlg::isValid( QString& /*msg*/)
|
||||
bool TransformationGUI_ScaleDlg::isValid (QString& /*msg*/)
|
||||
{
|
||||
if ( myObjects.length() > 0 && fabs( SpinBox_FX->value() ) > 0.00001 )
|
||||
if (myObjects.length() > 0 && fabs(SpinBox_FX->value()) > 0.00001)
|
||||
{
|
||||
// && !myPoint->_is_nil()
|
||||
if ( getConstructorId() == 0 )
|
||||
if (getConstructorId() == 0)
|
||||
return true;
|
||||
if ( fabs( SpinBox_FY->value() ) > 0.00001 &&
|
||||
fabs( SpinBox_FZ->value() ) > 0.00001 )
|
||||
if (fabs(SpinBox_FY->value()) > 0.00001 &&
|
||||
fabs(SpinBox_FZ->value()) > 0.00001)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -437,60 +476,60 @@ bool TransformationGUI_ScaleDlg::isValid( QString& /*msg*/)
|
||||
// function : execute
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_ScaleDlg::execute( ObjectList& objects )
|
||||
bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
|
||||
{
|
||||
bool toCreateCopy = IsPreview() || CheckBoxCopy->isChecked();
|
||||
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
switch ( getConstructorId() )
|
||||
switch (getConstructorId())
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if ( toCreateCopy )
|
||||
if (toCreateCopy)
|
||||
{
|
||||
for ( int i = 0; i < myObjects.length(); i++ )
|
||||
for (int i = 0; i < myObjects.length(); i++)
|
||||
{
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
|
||||
ScaleShapeCopy( myObjects[i], myPoint, SpinBox_FX->value() );
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
ScaleShapeCopy(myObjects[i], myPoint, SpinBox_FX->value());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int i = 0; i < myObjects.length(); i++ )
|
||||
for (int i = 0; i < myObjects.length(); i++)
|
||||
{
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
|
||||
ScaleShape( myObjects[i], myPoint, SpinBox_FX->value() );
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
ScaleShape(myObjects[i], myPoint, SpinBox_FX->value());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if ( toCreateCopy )
|
||||
if (toCreateCopy)
|
||||
{
|
||||
for ( int i = 0; i < myObjects.length(); i++ )
|
||||
for (int i = 0; i < myObjects.length(); i++)
|
||||
{
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
|
||||
ScaleShapeAlongAxesCopy( myObjects[i], myPoint, SpinBox_FX->value(),
|
||||
SpinBox_FY->value(), SpinBox_FZ->value() );
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
ScaleShapeAlongAxesCopy(myObjects[i], myPoint, SpinBox_FX->value(),
|
||||
SpinBox_FY->value(), SpinBox_FZ->value());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int i = 0; i < myObjects.length(); i++ )
|
||||
for (int i = 0; i < myObjects.length(); i++)
|
||||
{
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
|
||||
ScaleShapeAlongAxes( myObjects[i], myPoint, SpinBox_FX->value(),
|
||||
SpinBox_FY->value(), SpinBox_FZ->value() );
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
ScaleShapeAlongAxes(myObjects[i], myPoint, SpinBox_FX->value(),
|
||||
SpinBox_FY->value(), SpinBox_FZ->value());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -506,14 +545,14 @@ bool TransformationGUI_ScaleDlg::execute( ObjectList& objects )
|
||||
// function : restoreSubShapes
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_ScaleDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy,
|
||||
SALOMEDS::SObject_ptr theSObject )
|
||||
void TransformationGUI_ScaleDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
||||
SALOMEDS::SObject_ptr theSObject)
|
||||
{
|
||||
if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) {
|
||||
if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
|
||||
// empty list of arguments means that all arguments should be restored
|
||||
getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(),
|
||||
/*theFindMethod=*/GEOM::FSM_Transformed,
|
||||
/*theInheritFirstArg=*/true );
|
||||
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
|
||||
/*theFindMethod=*/GEOM::FSM_Transformed,
|
||||
/*theInheritFirstArg=*/true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -521,9 +560,9 @@ void TransformationGUI_ScaleDlg::restoreSubShapes( SALOMEDS::Study_ptr theStud
|
||||
// function : CreateCopyModeChanged()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_ScaleDlg::CreateCopyModeChanged( bool isCreateCopy )
|
||||
void TransformationGUI_ScaleDlg::CreateCopyModeChanged (bool isCreateCopy)
|
||||
{
|
||||
mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
|
||||
mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -533,13 +572,13 @@ void TransformationGUI_ScaleDlg::CreateCopyModeChanged( bool isCreateCopy )
|
||||
void TransformationGUI_ScaleDlg::addSubshapesToStudy()
|
||||
{
|
||||
bool toCreateCopy = IsPreview() || CheckBoxCopy->isChecked();
|
||||
if ( toCreateCopy )
|
||||
if (toCreateCopy)
|
||||
{
|
||||
if ( !myPoint->_is_nil() )
|
||||
if (!myPoint->_is_nil())
|
||||
{
|
||||
QMap<QString, GEOM::GEOM_Object_var> objMap;
|
||||
objMap[LineEdit2->text()] = myPoint;
|
||||
addSubshapesToFather( objMap );
|
||||
addSubshapesToFather(objMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,9 @@ private:
|
||||
private:
|
||||
GEOM::ListOfGO myObjects;
|
||||
GEOM::GEOM_Object_var myPoint; /* Central Point */
|
||||
|
||||
// to initialize the first selection field with a selected object on the dialog creation
|
||||
bool myInitial;
|
||||
|
||||
QGroupBox* GroupBox1;
|
||||
QLabel* TextLabel1;
|
||||
|
@ -196,8 +196,8 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked (int constructorId)
|
||||
GroupPoints->CheckBox1->hide();
|
||||
|
||||
GroupPoints->PushButton1->click();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1: // translation an object by 2 points
|
||||
{
|
||||
GroupPoints->ShowRows(3, 5, false);
|
||||
@ -214,8 +214,8 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked (int constructorId)
|
||||
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
|
||||
GroupPoints->PushButton1->click();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2: // translation an object by vector
|
||||
{
|
||||
GroupPoints->ShowRows(0, 1, true);
|
||||
@ -234,8 +234,8 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked (int constructorId)
|
||||
ActivateDistanceChanged(GroupPoints->CheckBox1->isChecked());
|
||||
|
||||
GroupPoints->PushButton1->click();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
qApp->processEvents();
|
||||
|
Loading…
Reference in New Issue
Block a user