2007-10-17 12:24:45 +00:00
|
|
|
// GEOM GEOMGUI : GUI for Geometry component
|
2004-01-07 15:46:21 +00:00
|
|
|
//
|
2007-10-17 12:24:45 +00:00
|
|
|
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
|
|
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
2004-01-07 15:46:21 +00:00
|
|
|
//
|
2007-10-17 12:24:45 +00:00
|
|
|
// 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.
|
2004-01-07 15:46:21 +00:00
|
|
|
//
|
2007-10-17 12:24:45 +00:00
|
|
|
// 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.
|
2004-01-07 15:46:21 +00:00
|
|
|
//
|
2007-10-17 12:24:45 +00:00
|
|
|
// 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
|
2004-01-07 15:46:21 +00:00
|
|
|
//
|
2006-06-01 11:32:40 +00:00
|
|
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
2004-01-07 15:46:21 +00:00
|
|
|
//
|
2007-10-17 12:24:45 +00:00
|
|
|
// File : TransformationGUI_MultiRotationDlg.cxx
|
|
|
|
// Author : Damien COQUERET, Open CASCADE S.A.S.
|
2004-01-07 15:46:21 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#include "TransformationGUI_MultiRotationDlg.h"
|
2007-07-11 06:23:48 +00:00
|
|
|
|
2007-10-17 12:24:45 +00:00
|
|
|
#include <GEOM_DlgRef.h>
|
|
|
|
#include <GeometryGUI.h>
|
|
|
|
#include <GEOMBase.h>
|
2004-12-01 10:39:14 +00:00
|
|
|
|
2007-10-17 12:24:45 +00:00
|
|
|
#include <SUIT_ResourceMgr.h>
|
|
|
|
#include <SUIT_Session.h>
|
|
|
|
#include <SalomeApp_Application.h>
|
|
|
|
#include <LightApp_SelectionMgr.h>
|
2004-01-07 15:46:21 +00:00
|
|
|
|
2007-10-17 12:24:45 +00:00
|
|
|
#include <GEOMImpl_Types.hxx>
|
2004-06-16 15:24:55 +00:00
|
|
|
|
2004-01-07 15:46:21 +00:00
|
|
|
//=================================================================================
|
|
|
|
// class : TransformationGUI_MultiRotationDlg()
|
|
|
|
// 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.
|
|
|
|
//=================================================================================
|
2006-05-06 08:44:32 +00:00
|
|
|
TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg
|
2007-10-17 12:24:45 +00:00
|
|
|
( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
|
|
|
|
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
|
2004-01-07 15:46:21 +00:00
|
|
|
{
|
2006-05-06 08:44:32 +00:00
|
|
|
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
|
2007-10-17 12:24:45 +00:00
|
|
|
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" ) ) );
|
2004-01-07 15:46:21 +00:00
|
|
|
|
2007-10-17 12:24:45 +00:00
|
|
|
setWindowTitle( tr( "GEOM_MULTIROTATION_TITLE" ) );
|
2004-01-07 15:46:21 +00:00
|
|
|
|
|
|
|
/***************************************************************/
|
2007-10-17 12:24:45 +00:00
|
|
|
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 );
|
|
|
|
|
|
|
|
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 );
|
2004-01-07 15:46:21 +00:00
|
|
|
/***************************************************************/
|
|
|
|
|
2007-10-17 12:24:45 +00:00
|
|
|
setHelpFileName( "multi_rotation.htm" );
|
2006-05-06 08:44:32 +00:00
|
|
|
|
2004-01-07 15:46:21 +00:00
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ~TransformationGUI_MultiRotationDlg()
|
|
|
|
// purpose : Destroys the object and frees any allocated resources
|
|
|
|
//=================================================================================
|
|
|
|
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 */
|
2005-06-02 07:17:09 +00:00
|
|
|
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
2007-10-17 12:24:45 +00:00
|
|
|
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
|
2004-01-07 15:46:21 +00:00
|
|
|
|
|
|
|
double SpecificStep1 = 5;
|
|
|
|
double SpecificStep2 = 1;
|
|
|
|
/* min, max, step and decimals for spin boxes & initial values */
|
2007-10-17 12:24:45 +00:00
|
|
|
initSpinBox( GroupPoints->SpinBox_DX, 1.0, MAX_NUMBER, SpecificStep2, 3 );
|
|
|
|
GroupPoints->SpinBox_DX->setValue( myNbTimes1 );
|
|
|
|
|
|
|
|
initSpinBox( GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, 3 );
|
|
|
|
initSpinBox( GroupDimensions->SpinBox_DY1, 1.0, MAX_NUMBER, SpecificStep2, 3 );
|
|
|
|
initSpinBox( GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, 3 );
|
|
|
|
initSpinBox( GroupDimensions->SpinBox_DY2, 1.0, MAX_NUMBER, SpecificStep2, 3 );
|
|
|
|
GroupDimensions->SpinBox_DX1->setValue( myAng );
|
|
|
|
GroupDimensions->SpinBox_DY1->setValue( myNbTimes1 );
|
|
|
|
GroupDimensions->SpinBox_DX2->setValue( myStep );
|
|
|
|
GroupDimensions->SpinBox_DY2->setValue( myNbTimes2 );
|
2004-01-07 15:46:21 +00:00
|
|
|
|
|
|
|
/* signals and slots connections */
|
2007-10-17 12:24:45 +00:00
|
|
|
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( GroupDimensions->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
|
|
|
connect( GroupDimensions->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
|
|
|
|
|
|
|
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( 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 ) ) );
|
|
|
|
|
|
|
|
// VSR: TODO ->>
|
|
|
|
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) );
|
|
|
|
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DX1, SLOT( SetStep( double ) ) );
|
|
|
|
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DY1, SLOT( SetStep( double ) ) );
|
|
|
|
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DX2, SLOT( SetStep( double ) ) );
|
|
|
|
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DY2, SLOT( SetStep( double ) ) );
|
|
|
|
// <<-
|
|
|
|
|
|
|
|
connect( GroupDimensions->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseAngle() ) );
|
2004-01-07 15:46:21 +00:00
|
|
|
|
2007-10-17 12:24:45 +00:00
|
|
|
connect( myGeomGUI->getApp()->selectionMgr(),
|
|
|
|
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
|
|
|
|
|
|
initName( tr( "GEOM_MULTIROTATION" ) );
|
2004-01-07 15:46:21 +00:00
|
|
|
|
2004-12-01 10:39:14 +00:00
|
|
|
ConstructorsClicked( 0 );
|
2004-01-07 15:46:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ConstructorsClicked()
|
|
|
|
// purpose : Radio button management
|
|
|
|
//=================================================================================
|
2007-10-17 12:24:45 +00:00
|
|
|
void TransformationGUI_MultiRotationDlg::ConstructorsClicked( int constructorId )
|
2004-01-07 15:46:21 +00:00
|
|
|
{
|
2007-10-17 12:24:45 +00:00
|
|
|
disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
|
2006-05-06 08:44:32 +00:00
|
|
|
|
2004-01-07 15:46:21 +00:00
|
|
|
myAng = 45.0;
|
|
|
|
myStep = 50.0;
|
2004-12-01 10:39:14 +00:00
|
|
|
myNbTimes1 = myNbTimes2 = 2;
|
2006-05-06 08:44:32 +00:00
|
|
|
|
2004-12-01 10:39:14 +00:00
|
|
|
globalSelection( GEOM_ALLSHAPES );
|
2004-01-07 15:46:21 +00:00
|
|
|
|
2007-10-17 12:24:45 +00:00
|
|
|
switch ( constructorId ) {
|
|
|
|
case 0: /* Rotate simple */
|
2004-01-07 15:46:21 +00:00
|
|
|
{
|
2007-10-17 12:24:45 +00:00
|
|
|
GroupDimensions->hide();
|
|
|
|
GroupPoints->show();
|
|
|
|
|
|
|
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
|
|
|
GroupPoints->LineEdit1->setText( "" );
|
|
|
|
GroupPoints->LineEdit2->setText( "" );
|
|
|
|
|
|
|
|
GroupPoints->SpinBox_DX->setValue( myNbTimes1 );
|
|
|
|
|
|
|
|
break;
|
2004-01-07 15:46:21 +00:00
|
|
|
}
|
2007-10-17 12:24:45 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
qApp->processEvents();
|
|
|
|
updateGeometry();
|
|
|
|
resize( minimumSize() );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
|
|
|
myEditCurrentArgument->setFocus();
|
|
|
|
myBase = myVector = GEOM::GEOM_Object::_nil();
|
2007-10-17 12:24:45 +00:00
|
|
|
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
|
|
|
|
this, SLOT( SelectionIntoArgument() ) );
|
2004-01-07 15:46:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ClickOnOk()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void TransformationGUI_MultiRotationDlg::ClickOnOk()
|
|
|
|
{
|
2004-12-01 10:39:14 +00:00
|
|
|
if ( ClickOnApply() )
|
|
|
|
ClickOnCancel();
|
2004-01-07 15:46:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ClickOnApply()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
2004-12-01 10:39:14 +00:00
|
|
|
bool TransformationGUI_MultiRotationDlg::ClickOnApply()
|
2004-01-07 15:46:21 +00:00
|
|
|
{
|
2004-12-01 10:39:14 +00:00
|
|
|
if ( !onAccept() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
initName();
|
|
|
|
ConstructorsClicked( getConstructorId() );
|
|
|
|
return true;
|
|
|
|
}
|
2004-01-07 15:46:21 +00:00
|
|
|
|
2004-12-01 10:39:14 +00:00
|
|
|
|
2004-01-07 15:46:21 +00:00
|
|
|
//=================================================================================
|
|
|
|
// function : SelectionIntoArgument()
|
|
|
|
// purpose : Called when selection as changed or other case
|
|
|
|
//=================================================================================
|
|
|
|
void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
|
|
|
|
{
|
2007-10-17 12:24:45 +00:00
|
|
|
myEditCurrentArgument->setText( "" );
|
2006-05-06 08:44:32 +00:00
|
|
|
|
2007-10-17 12:24:45 +00:00
|
|
|
if ( IObjectCount() != 1 ) {
|
|
|
|
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
|
|
|
myEditCurrentArgument == GroupDimensions->LineEdit1 )
|
2004-12-01 10:39:14 +00:00
|
|
|
myBase = GEOM::GEOM_Object::_nil();
|
2007-10-17 12:24:45 +00:00
|
|
|
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
|
|
|
myEditCurrentArgument == GroupDimensions->LineEdit2 )
|
2004-12-01 10:39:14 +00:00
|
|
|
myVector = GEOM::GEOM_Object::_nil();
|
2004-01-07 15:46:21 +00:00
|
|
|
return;
|
|
|
|
}
|
2006-05-06 08:44:32 +00:00
|
|
|
|
2004-01-07 15:46:21 +00:00
|
|
|
// nbSel == 1
|
2004-12-01 10:39:14 +00:00
|
|
|
Standard_Boolean testResult = Standard_False;;
|
2006-05-06 08:44:32 +00:00
|
|
|
GEOM::GEOM_Object_var aSelectedObject =
|
2007-10-17 12:24:45 +00:00
|
|
|
GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
2007-10-17 12:24:45 +00:00
|
|
|
if ( !testResult || CORBA::is_nil( aSelectedObject) || !GEOMBase::IsShape( aSelectedObject ) )
|
2004-01-07 15:46:21 +00:00
|
|
|
return;
|
|
|
|
|
2007-10-17 12:24:45 +00:00
|
|
|
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
|
|
|
myEditCurrentArgument == GroupDimensions->LineEdit1 )
|
2004-12-01 10:39:14 +00:00
|
|
|
myBase = aSelectedObject;
|
2007-10-17 12:24:45 +00:00
|
|
|
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
|
|
|
myEditCurrentArgument == GroupDimensions->LineEdit2 )
|
2004-12-01 10:39:14 +00:00
|
|
|
myVector = aSelectedObject;
|
2006-05-06 08:44:32 +00:00
|
|
|
|
2004-12-01 10:39:14 +00:00
|
|
|
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
|
|
|
|
|
|
|
|
displayPreview();
|
2004-01-07 15:46:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : SetEditCurrentArgument()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
|
|
|
|
{
|
|
|
|
QPushButton* send = (QPushButton*)sender();
|
2004-12-01 10:39:14 +00:00
|
|
|
|
2007-10-17 12:24:45 +00:00
|
|
|
if ( send == GroupPoints->PushButton1 ) {
|
2004-01-07 15:46:21 +00:00
|
|
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
2004-12-01 10:39:14 +00:00
|
|
|
globalSelection( GEOM_ALLSHAPES );
|
2004-01-07 15:46:21 +00:00
|
|
|
}
|
2007-10-17 12:24:45 +00:00
|
|
|
else if ( send == GroupPoints->PushButton2 ) {
|
2004-01-07 15:46:21 +00:00
|
|
|
myEditCurrentArgument = GroupPoints->LineEdit2;
|
2004-12-01 10:39:14 +00:00
|
|
|
globalSelection( GEOM_LINE );
|
2004-01-07 15:46:21 +00:00
|
|
|
}
|
2007-10-17 12:24:45 +00:00
|
|
|
else if ( send == GroupDimensions->PushButton1 ) {
|
2004-01-07 15:46:21 +00:00
|
|
|
myEditCurrentArgument = GroupDimensions->LineEdit1;
|
2004-12-01 10:39:14 +00:00
|
|
|
globalSelection( GEOM_ALLSHAPES );
|
2004-01-07 15:46:21 +00:00
|
|
|
}
|
2007-10-17 12:24:45 +00:00
|
|
|
else if ( send == GroupDimensions->PushButton2 ) {
|
2004-01-07 15:46:21 +00:00
|
|
|
myEditCurrentArgument = GroupDimensions->LineEdit2;
|
2004-12-01 10:39:14 +00:00
|
|
|
globalSelection( GEOM_LINE );
|
2004-01-07 15:46:21 +00:00
|
|
|
}
|
|
|
|
|
2004-12-01 10:39:14 +00:00
|
|
|
myEditCurrentArgument->setFocus();
|
|
|
|
SelectionIntoArgument();
|
2004-01-07 15:46:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : LineEditReturnPressed()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void TransformationGUI_MultiRotationDlg::LineEditReturnPressed()
|
|
|
|
{
|
|
|
|
QLineEdit* send = (QLineEdit*)sender();
|
2007-10-17 12:24:45 +00:00
|
|
|
if ( send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 ||
|
|
|
|
send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 ) {
|
|
|
|
myEditCurrentArgument = send;
|
|
|
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
|
|
|
}
|
2004-01-07 15:46:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ActivateThisDialog()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void TransformationGUI_MultiRotationDlg::ActivateThisDialog()
|
|
|
|
{
|
|
|
|
GEOMBase_Skeleton::ActivateThisDialog();
|
2007-10-17 12:24:45 +00:00
|
|
|
connect( myGeomGUI->getApp()->selectionMgr(),
|
|
|
|
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
2004-12-01 10:39:14 +00:00
|
|
|
|
|
|
|
ConstructorsClicked( getConstructorId() );
|
|
|
|
}
|
2004-01-07 15:46:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : enterEvent()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
2007-10-17 12:24:45 +00:00
|
|
|
void TransformationGUI_MultiRotationDlg::enterEvent( QEvent* )
|
2004-01-07 15:46:21 +00:00
|
|
|
{
|
2007-10-17 12:24:45 +00:00
|
|
|
if( !mainFrame()->GroupConstructors->isEnabled() )
|
2004-12-01 10:39:14 +00:00
|
|
|
ActivateThisDialog();
|
2004-01-07 15:46:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ValueChangedInSpinBox()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
2007-10-17 12:24:45 +00:00
|
|
|
void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox( double newValue )
|
2004-01-07 15:46:21 +00:00
|
|
|
{
|
|
|
|
QObject* send = (QObject*)sender();
|
|
|
|
|
2007-10-17 12:24:45 +00:00
|
|
|
if ( send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1 )
|
2004-06-16 15:24:55 +00:00
|
|
|
myNbTimes1 = (int)newValue;
|
2007-10-17 12:24:45 +00:00
|
|
|
else if ( send == GroupDimensions->SpinBox_DX1 )
|
2004-01-07 15:46:21 +00:00
|
|
|
myAng = newValue;
|
2007-10-17 12:24:45 +00:00
|
|
|
else if ( send == GroupDimensions->SpinBox_DX2 )
|
2004-01-07 15:46:21 +00:00
|
|
|
myStep = newValue;
|
2007-10-17 12:24:45 +00:00
|
|
|
else if ( send == GroupDimensions->SpinBox_DY2 )
|
2004-06-16 15:24:55 +00:00
|
|
|
myNbTimes2 = (int)newValue;
|
2004-12-01 10:39:14 +00:00
|
|
|
|
|
|
|
displayPreview();
|
2004-01-07 15:46:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ReverseAngle()
|
|
|
|
// purpose : 'state' not used here
|
|
|
|
//=================================================================================
|
2004-12-01 10:39:14 +00:00
|
|
|
void TransformationGUI_MultiRotationDlg::ReverseAngle()
|
2004-01-07 15:46:21 +00:00
|
|
|
{
|
|
|
|
myAng = -myAng;
|
2004-12-01 10:39:14 +00:00
|
|
|
|
|
|
|
int aConstructorId = getConstructorId();
|
|
|
|
|
2007-10-17 12:24:45 +00:00
|
|
|
if ( aConstructorId == 0 )
|
|
|
|
GroupPoints->SpinBox_DX->setValue( myAng );
|
|
|
|
else if ( aConstructorId == 1 )
|
|
|
|
GroupDimensions->SpinBox_DX1->setValue( myAng );
|
2004-01-07 15:46:21 +00:00
|
|
|
|
2004-12-01 10:39:14 +00:00
|
|
|
displayPreview();
|
2004-01-07 15:46:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
2004-12-01 10:39:14 +00:00
|
|
|
// function : createOperation
|
2004-01-07 15:46:21 +00:00
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
2004-12-01 10:39:14 +00:00
|
|
|
GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation()
|
2004-01-07 15:46:21 +00:00
|
|
|
{
|
2006-05-06 08:44:32 +00:00
|
|
|
return myGeomGUI->GetGeomGen()->GetITransformOperations( getStudyId() );
|
2004-12-01 10:39:14 +00:00
|
|
|
}
|
2004-01-07 15:46:21 +00:00
|
|
|
|
|
|
|
|
2004-12-01 10:39:14 +00:00
|
|
|
//=================================================================================
|
|
|
|
// function : isValid
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
2007-10-17 12:24:45 +00:00
|
|
|
bool TransformationGUI_MultiRotationDlg::isValid( QString& /*msg*/ )
|
2004-12-01 10:39:14 +00:00
|
|
|
{
|
2007-10-17 12:24:45 +00:00
|
|
|
return !( myBase->_is_nil() || myVector->_is_nil() );
|
2004-12-01 10:39:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : execute
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects )
|
|
|
|
{
|
|
|
|
bool res = false;
|
|
|
|
|
|
|
|
GEOM::GEOM_Object_var anObj;
|
|
|
|
|
2007-10-17 12:24:45 +00:00
|
|
|
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 );
|
|
|
|
res = true;
|
2004-12-01 10:39:14 +00:00
|
|
|
}
|
2007-10-17 12:24:45 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-12-01 10:39:14 +00:00
|
|
|
|
|
|
|
if ( !anObj->_is_nil() )
|
|
|
|
objects.push_back( anObj._retn() );
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : closeEvent
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
2007-10-17 12:24:45 +00:00
|
|
|
void TransformationGUI_MultiRotationDlg::closeEvent( QCloseEvent* e )
|
2004-12-01 10:39:14 +00:00
|
|
|
{
|
2005-06-02 07:17:09 +00:00
|
|
|
// myGeomGUI->SetState( -1 );
|
2004-12-01 10:39:14 +00:00
|
|
|
GEOMBase_Skeleton::closeEvent( e );
|
2004-01-07 15:46:21 +00:00
|
|
|
}
|