diff --git a/src/DlgRef/DlgRef_3Sel3Spin2Check.cxx b/src/DlgRef/DlgRef_3Sel3Spin2Check.cxx new file mode 100644 index 000000000..fa43e01c2 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel3Spin2Check.cxx @@ -0,0 +1,116 @@ +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : DlgRef_3Sel3Spin2Check.cxx +// Author : Michael Zorin +// Module : GEOM +// $Header: + +#include +#include +#include +#include +#include +#include +#include +#include + + +/* + * Constructs a DlgRef_3Sel3Spin2Check which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgRef_3Sel3Spin2Check::DlgRef_3Sel3Spin2Check(QWidget* parent, const char* name, WFlags fl) + :DlgRef_3Sel3Spin2Check_QTD(parent, name, fl) +{ + SpinBox_1->close(TRUE); + SpinBox_2->close(TRUE); + SpinBox_3->close(TRUE); + SpinBox1 = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + SpinBox2 = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY"); + SpinBox3 = new DlgRef_SpinBox(GroupBox1, "SpinBox_DZ"); + layout1->addWidget(SpinBox1, 3, 2); + layout1->addWidget(SpinBox2, 4, 2); + layout1->addWidget(SpinBox3, 5, 2); +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Sel3Spin2Check::~DlgRef_3Sel3Spin2Check() +{ + // no need to delete child widgets, Qt does it all for us +} + +void DlgRef_3Sel3Spin2Check:: ShowRows(int fromRow, int toRow, bool toShow) +{ + typedef void (QWidget::* ShowFun)(); + ShowFun pShowFun; + + if (toShow) + pShowFun = &QWidget::show; + else + pShowFun = &QWidget::hide; + + if (fromRow >= 0 && toRow>=0 && toRow >= fromRow) + { + if ( fromRow == 0) + { + (TextLabel1->*pShowFun)(); + (PushButton1->*pShowFun)(); + (LineEdit1->*pShowFun)(); + } + if ( fromRow <= 1 && 1 <= toRow) + { + (TextLabel2->*pShowFun)(); + (PushButton2->*pShowFun)(); + (LineEdit2->*pShowFun)(); + } + if ( fromRow <= 2 && 2 <= toRow) + { + (TextLabel3->*pShowFun)(); + (PushButton3->*pShowFun)(); + (LineEdit3->*pShowFun)(); + } + if ( fromRow <= 3 && 3 <= toRow) + { + (TextLabel4->*pShowFun)(); + (SpinBox1->*pShowFun)(); + } + if ( fromRow <= 4 && 4 <= toRow) + { + (TextLabel5->*pShowFun)(); + (SpinBox2->*pShowFun)(); + } + if ( fromRow <= 5 && 5 <= toRow) + { + (TextLabel6->*pShowFun)(); + (SpinBox3->*pShowFun)(); + } + if ( fromRow <= 6 && 6 <= toRow) + (CheckBox1->*pShowFun)(); + if ( fromRow <= 7 && 7 <= toRow) + (CheckBox2->*pShowFun)(); + } +} diff --git a/src/DlgRef/DlgRef_3Sel3Spin2Check.h b/src/DlgRef/DlgRef_3Sel3Spin2Check.h new file mode 100644 index 000000000..7c463f014 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel3Spin2Check.h @@ -0,0 +1,53 @@ +// 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : DlgRef_3Sel3Spin2Check.h +// Author : Michael ZORIN +// Module : GEOM +// $Header: + +#ifndef DLGREF_3SEL3SPIN2CHECK_H +#define DLGREF_3SEL3SPIN2CHECK_H + +#include "GEOM_DlgRef.hxx" + +#include "DlgRef_3Sel3Spin2Check_QTD.h" +#include "DlgRef_SpinBox.h" + +class GEOM_DLGREF_EXPORT DlgRef_3Sel3Spin2Check : public DlgRef_3Sel3Spin2Check_QTD +{ + Q_OBJECT + +public: + DlgRef_3Sel3Spin2Check( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_3Sel3Spin2Check(); + + DlgRef_SpinBox* SpinBox1; + DlgRef_SpinBox* SpinBox2; + DlgRef_SpinBox* SpinBox3; + + void ShowRows(int fromRow, int toRow, bool toShow = true); + +}; + +#endif // DLGREF_3SEL3SPIN2CHECK_H diff --git a/src/DlgRef/DlgRef_3Sel3Spin2Check_QTD.cxx b/src/DlgRef/DlgRef_3Sel3Spin2Check_QTD.cxx new file mode 100644 index 000000000..62a38f066 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel3Spin2Check_QTD.cxx @@ -0,0 +1,172 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_3Sel3Spin2Check_QTD.ui' +** +** Created: Tue Feb 12 16:21:38 2008 +** by: The User Interface Compiler ($Id$) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ + +#include "DlgRef_3Sel3Spin2Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_3Sel3Spin2Check_QTD as a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_3Sel3Spin2Check_QTD::DlgRef_3Sel3Spin2Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_3Sel3Spin2Check_QTD" ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) ); + DlgRef_3Sel3Spin2Check_QTDLayout = new QVBoxLayout( this, 0, 6, "DlgRef_3Sel3Spin2Check_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QHBoxLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + layout1 = new QGridLayout( 0, 1, 1, 0, 6, "layout1"); + Spacer3 = new QSpacerItem( 20, 130, QSizePolicy::Minimum, QSizePolicy::Expanding ); + layout1->addItem( Spacer3, 8, 3 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + + layout1->addWidget( PushButton1, 0, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + + layout1->addWidget( TextLabel3, 2, 0 ); + + CheckBox1 = new QCheckBox( GroupBox1, "CheckBox1" ); + + layout1->addMultiCellWidget( CheckBox1, 6, 6, 0, 1 ); + + TextLabel6 = new QLabel( GroupBox1, "TextLabel6" ); + TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) ); + + layout1->addWidget( TextLabel6, 5, 0 ); + + SpinBox_2 = new QSpinBox( GroupBox1, "SpinBox_2" ); + SpinBox_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox_2->sizePolicy().hasHeightForWidth() ) ); + + layout1->addMultiCellWidget( SpinBox_2, 4, 4, 2, 3 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + layout1->addMultiCellWidget( LineEdit2, 1, 1, 2, 3 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + layout1->addMultiCellWidget( LineEdit1, 0, 0, 2, 3 ); + + LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); + + layout1->addMultiCellWidget( LineEdit3, 2, 2, 2, 3 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + + layout1->addWidget( PushButton2, 1, 1 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + + layout1->addWidget( TextLabel2, 1, 0 ); + + CheckBox2 = new QCheckBox( GroupBox1, "CheckBox2" ); + + layout1->addMultiCellWidget( CheckBox2, 7, 7, 0, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + + layout1->addWidget( TextLabel1, 0, 0 ); + + PushButton3 = new QPushButton( GroupBox1, "PushButton3" ); + PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); + + layout1->addWidget( PushButton3, 2, 1 ); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + + layout1->addWidget( TextLabel5, 4, 0 ); + + SpinBox_1 = new QSpinBox( GroupBox1, "SpinBox_1" ); + SpinBox_1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox_1->sizePolicy().hasHeightForWidth() ) ); + + layout1->addMultiCellWidget( SpinBox_1, 3, 3, 2, 3 ); + + SpinBox_3 = new QSpinBox( GroupBox1, "SpinBox_3" ); + SpinBox_3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox_3->sizePolicy().hasHeightForWidth() ) ); + + layout1->addMultiCellWidget( SpinBox_3, 5, 5, 2, 3 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + + layout1->addWidget( TextLabel4, 3, 0 ); + GroupBox1Layout->addLayout( layout1 ); + DlgRef_3Sel3Spin2Check_QTDLayout->addWidget( GroupBox1 ); + languageChange(); + resize( QSize(338, 274).expandedTo(minimumSizeHint()) ); + clearWState( WState_Polished ); + + // tab order + setTabOrder( PushButton1, LineEdit1 ); + setTabOrder( LineEdit1, PushButton2 ); + setTabOrder( PushButton2, LineEdit2 ); + setTabOrder( LineEdit2, PushButton3 ); + setTabOrder( PushButton3, LineEdit3 ); + setTabOrder( LineEdit3, SpinBox_1 ); + setTabOrder( SpinBox_1, SpinBox_2 ); + setTabOrder( SpinBox_2, SpinBox_3 ); + setTabOrder( SpinBox_3, CheckBox1 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Sel3Spin2Check_QTD::~DlgRef_3Sel3Spin2Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + +/* + * Sets the strings of the subwidgets using the current + * language. + */ +void DlgRef_3Sel3Spin2Check_QTD::languageChange() +{ + setCaption( tr( "DlgRef_3Sel3Spin2Check_QTD" ) ); + GroupBox1->setTitle( QString::null ); + PushButton1->setText( QString::null ); + TextLabel3->setText( tr( "TL3" ) ); + CheckBox1->setText( QString::null ); + TextLabel6->setText( tr( "TL6" ) ); + PushButton2->setText( QString::null ); + TextLabel2->setText( tr( "TL2" ) ); + CheckBox2->setText( QString::null ); + TextLabel1->setText( tr( "TL1" ) ); + PushButton3->setText( QString::null ); + TextLabel5->setText( tr( "TL5" ) ); + TextLabel4->setText( tr( "TL4" ) ); +} + diff --git a/src/DlgRef/DlgRef_3Sel3Spin2Check_QTD.h b/src/DlgRef/DlgRef_3Sel3Spin2Check_QTD.h new file mode 100644 index 000000000..f04ad90af --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel3Spin2Check_QTD.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_3Sel3Spin2Check_QTD.ui' +** +** Created: Tue Feb 12 16:21:38 2008 +** by: The User Interface Compiler ($Id$) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ + +#ifndef DLGREF_3SEL3SPIN2CHECK_QTD_H +#define DLGREF_3SEL3SPIN2CHECK_QTD_H + +#include +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QSpacerItem; +class QGroupBox; +class QPushButton; +class QLabel; +class QCheckBox; +class QSpinBox; +class QLineEdit; + +class DlgRef_3Sel3Spin2Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_3Sel3Spin2Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_3Sel3Spin2Check_QTD(); + + QGroupBox* GroupBox1; + QPushButton* PushButton1; + QLabel* TextLabel3; + QCheckBox* CheckBox1; + QLabel* TextLabel6; + QSpinBox* SpinBox_2; + QLineEdit* LineEdit2; + QLineEdit* LineEdit1; + QLineEdit* LineEdit3; + QPushButton* PushButton2; + QLabel* TextLabel2; + QCheckBox* CheckBox2; + QLabel* TextLabel1; + QPushButton* PushButton3; + QLabel* TextLabel5; + QSpinBox* SpinBox_1; + QSpinBox* SpinBox_3; + QLabel* TextLabel4; + +protected: + QVBoxLayout* DlgRef_3Sel3Spin2Check_QTDLayout; + QHBoxLayout* GroupBox1Layout; + QGridLayout* layout1; + QSpacerItem* Spacer3; + +protected slots: + virtual void languageChange(); + +}; + +#endif // DLGREF_3SEL3SPIN2CHECK_QTD_H diff --git a/src/DlgRef/Makefile.am b/src/DlgRef/Makefile.am index 960a9ad06..4568d53a9 100644 --- a/src/DlgRef/Makefile.am +++ b/src/DlgRef/Makefile.am @@ -67,6 +67,7 @@ dist_libDlgRef_la_SOURCES = \ DlgRef_3Spin_QTD.cxx \ DlgRef_3Spin1Check_QTD.cxx \ DlgRef_3Sel3Spin1Check_QTD.cxx \ + DlgRef_3Sel3Spin2Check_QTD.cxx \ DlgRef_4Sel1Spin2Check_QTD.cxx \ DlgRef_SpinBox.cxx \ DlgRef_1Sel1Spin.cxx \ @@ -84,6 +85,7 @@ dist_libDlgRef_la_SOURCES = \ DlgRef_2Sel4Spin1Check.cxx \ DlgRef_3Sel4Spin2Check.cxx \ DlgRef_3Sel3Spin1Check.cxx \ + DlgRef_3Sel3Spin2Check.cxx \ DlgRef_1Spin.cxx \ DlgRef_2Spin.cxx \ DlgRef_3Spin.cxx \ @@ -128,6 +130,7 @@ MOC_FILES = \ DlgRef_3Spin_QTD_moc.cxx \ DlgRef_3Spin1Check_QTD_moc.cxx \ DlgRef_3Sel3Spin1Check_QTD_moc.cxx \ + DlgRef_3Sel3Spin2Check_QTD_moc.cxx \ DlgRef_4Sel1Spin2Check_QTD_moc.cxx \ DlgRef_SpinBox_moc.cxx \ DlgRef_1Sel1Spin_moc.cxx \ @@ -145,6 +148,7 @@ MOC_FILES = \ DlgRef_2Sel4Spin1Check_moc.cxx \ DlgRef_3Sel4Spin2Check_moc.cxx \ DlgRef_3Sel3Spin1Check_moc.cxx \ + DlgRef_3Sel3Spin2Check_moc.cxx \ DlgRef_1Spin_moc.cxx \ DlgRef_2Spin_moc.cxx \ DlgRef_3Spin_moc.cxx \ @@ -191,6 +195,7 @@ salomeinclude_HEADERS = \ DlgRef_3Spin_QTD.h \ DlgRef_3Spin1Check_QTD.h \ DlgRef_3Sel3Spin1Check_QTD.h \ + DlgRef_3Sel3Spin2Check_QTD.h \ DlgRef_4Sel1Spin2Check_QTD.h \ DlgRef_SpinBox.h \ DlgRef_1Sel1Spin.h \ @@ -208,6 +213,7 @@ salomeinclude_HEADERS = \ DlgRef_2Sel4Spin1Check.h \ DlgRef_3Sel4Spin2Check.h \ DlgRef_3Sel3Spin1Check.h \ + DlgRef_3Sel3Spin2Check.h \ DlgRef_1Spin.h \ DlgRef_2Spin.h \ DlgRef_3Spin.h \ diff --git a/src/DlgRef/UIFiles/DlgRef_3Sel3Spin2Check_QTD.ui b/src/DlgRef/UIFiles/DlgRef_3Sel3Spin2Check_QTD.ui new file mode 100644 index 000000000..55c0b280c --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_3Sel3Spin2Check_QTD.ui @@ -0,0 +1,319 @@ + +DlgRef_3Sel3Spin2Check_QTD + + + DlgRef_3Sel3Spin2Check_QTD + + + + 0 + 0 + 338 + 274 + + + + + 5 + 5 + 0 + 0 + + + + DlgRef_3Sel3Spin2Check_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + 5 + 5 + 0 + 0 + + + + + + + + unnamed + + + 11 + + + 6 + + + + layout1 + + + + unnamed + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 130 + + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + CheckBox1 + + + + + + + + TextLabel6 + + + + 0 + 0 + 0 + 0 + + + + TL6 + + + + + SpinBox_2 + + + + 7 + 0 + 0 + 0 + + + + + + LineEdit2 + + + + + LineEdit1 + + + + + LineEdit3 + + + + + PushButton2 + + + + 0 + 0 + 0 + 0 + + + + + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + CheckBox2 + + + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + PushButton3 + + + + 0 + 0 + 0 + 0 + + + + + + + + + TextLabel5 + + + + 0 + 0 + 0 + 0 + + + + TL5 + + + + + SpinBox_1 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox_3 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel4 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + + + + + + PushButton1 + LineEdit1 + PushButton2 + LineEdit2 + PushButton3 + LineEdit3 + SpinBox_1 + SpinBox_2 + SpinBox_3 + CheckBox1 + + + diff --git a/src/DlgRef/UIFiles/ui_to_cxx b/src/DlgRef/UIFiles/ui_to_cxx index 60e5b024d..3e611c628 100755 --- a/src/DlgRef/UIFiles/ui_to_cxx +++ b/src/DlgRef/UIFiles/ui_to_cxx @@ -18,8 +18,8 @@ # #!/bin/sh -#uic -o DlgRef_Skeleton_QTD.h DlgRef_Skeleton_QTD.ui -#uic -o DlgRef_Skeleton_QTD.cxx -impl DlgRef_Skeleton_QTD.h DlgRef_Skeleton_QTD.ui +uic -o DlgRef_Skeleton_QTD.h DlgRef_Skeleton_QTD.ui +uic -o DlgRef_Skeleton_QTD.cxx -impl DlgRef_Skeleton_QTD.h DlgRef_Skeleton_QTD.ui #uic -o DlgRef_1Sel_QTD.h DlgRef_1Sel_QTD.ui #uic -o DlgRef_1Sel_QTD.cxx -impl DlgRef_1Sel_QTD.h DlgRef_1Sel_QTD.ui @@ -114,5 +114,8 @@ #uic -o DlgRef_2Sel3Spin2Rb_QTD.h DlgRef_2Sel3Spin2Rb_QTD.ui #uic -o DlgRef_2Sel3Spin2Rb_QTD.cxx -impl DlgRef_2Sel3Spin2Rb_QTD.h DlgRef_2Sel3Spin2Rb_QTD.ui -uic -o DlgRef_3Sel1Check_QTD.h DlgRef_3Sel1Check_QTD.ui -uic -o DlgRef_3Sel1Check_QTD.cxx -impl DlgRef_3Sel1Check_QTD.h DlgRef_3Sel1Check_QTD.ui>>>>>>> 1.6.2.3 +#uic -o DlgRef_3Sel1Check_QTD.h DlgRef_3Sel3Spin2Check_QTD.ui +#uic -o DlgRef_3Sel1Check_QTD.cxx -impl DlgRef_3Sel1Check_QTD.h DlgRef_3Sel1Check_QTD.ui>>>>>>> 1.6.2.3 + +#uic -o DlgRef_3Sel3Spin2Check_QTD.h DlgRef_3Sel3Spin2Check_QTD.ui +#uic -o DlgRef_3Sel3Spin2Check_QTD.cxx -impl DlgRef_3Sel3Spin2Check_QTD.h DlgRef_3Sel3Spin2Check_QTD.ui \ No newline at end of file diff --git a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx index 9bf0da1bf..19bd62a1f 100644 --- a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx @@ -350,7 +350,6 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVector SetErrorCode(OK); return theObject; } - //============================================================================= /*! * TranslateVectorCopy @@ -405,6 +404,73 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorCopy return aCopy; } +//============================================================================= +/*! + * TranslateVectorDistance + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorDistance + (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector, double theDistance, bool theCopy) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || theVector.IsNull()) return NULL; + + Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved + + Handle(GEOM_Object) aCopy; //Add a new Copy object + Handle(GEOM_Function) aFunction; + + //Add a translate function + if (theCopy) { + aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + aFunction = aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_DISTANCE); + } + else { + aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_DISTANCE); + } + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL; + + GEOMImpl_ITranslate aTI(aFunction); + aTI.SetVector(theVector->GetLastFunction()); + aTI.SetDistance(theDistance); +// aTI.SetShape(theObject->GetValue()); + aTI.SetOriginal(aLastFunction); + + //Compute the translation + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Translation driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + if (theCopy) { + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationVectorDistance(" + << theObject << ", " << theVector << ", " << theDistance << ")"; + SetErrorCode(OK); + return aCopy; + } + + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateVectorDistance(" + << theObject << ", " << theVector << ", " << theDistance << ", " << theCopy << ")"; + SetErrorCode(OK); + return theObject; +} + //============================================================================= /*! * Translate1D diff --git a/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx b/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx index 843c8a12a..ad2a6f510 100644 --- a/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx @@ -50,6 +50,9 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) TranslateVectorCopy (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector); + Standard_EXPORT Handle(GEOM_Object) TranslateVectorDistance (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) theVector, double theDistance, bool theCopy); + Standard_EXPORT Handle(GEOM_Object) Translate1D (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector, double theStep, Standard_Integer theNbTimes); Standard_EXPORT Handle(GEOM_Object) Translate2D (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector, double theStep1, Standard_Integer theNbTimes1, diff --git a/src/GEOMImpl/GEOMImpl_ITranslate.hxx b/src/GEOMImpl/GEOMImpl_ITranslate.hxx index 0ca4201e4..10fa24480 100755 --- a/src/GEOMImpl/GEOMImpl_ITranslate.hxx +++ b/src/GEOMImpl/GEOMImpl_ITranslate.hxx @@ -33,7 +33,8 @@ #define TRANSLATE_ARG_VECTOR2 11 #define TRANSLATE_ARG_DX 12 #define TRANSLATE_ARG_DY 13 -#define TRANSLATE_ARG_DZ 14 +#define TRANSLATE_ARG_DZ 14 +#define TRANSLATE_ARG_DISTANCE 15 class GEOMImpl_ITranslate { @@ -81,6 +82,10 @@ class GEOMImpl_ITranslate double GetDX() { return _func->GetReal(TRANSLATE_ARG_DX); } + void SetDistance(double theDistance) { return _func->SetReal(TRANSLATE_ARG_DISTANCE, theDistance); } + + double GetDistance() { return _func->GetReal(TRANSLATE_ARG_DISTANCE); } + void SetDY(double theDY) { return _func->SetReal(TRANSLATE_ARG_DY, theDY); } double GetDY() { return _func->GetReal(TRANSLATE_ARG_DY); } diff --git a/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx b/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx index ad967865b..fba11c209 100644 --- a/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx @@ -122,6 +122,26 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const TopLoc_Location aLocRes (aTrsf * aTrsfOrig); aShape = anOriginal.Located(aLocRes); } + else if (aType == TRANSLATE_VECTOR_DISTANCE) { + Handle(GEOM_Function) aVector = TI.GetVector(); + double aDistance = TI.GetDistance(); + if(aVector.IsNull()) return 0; + TopoDS_Shape aV = aVector->GetValue(); + if(aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0; + TopoDS_Edge anEdge = TopoDS::Edge(aV); + + aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)); + aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge)); + + gp_Vec aVec (aP1, aP2); + aVec.Normalize(); + aTrsf.SetTranslation(aVec * aDistance); + + TopLoc_Location aLocOrig = anOriginal.Location(); + gp_Trsf aTrsfOrig = aLocOrig.Transformation(); + TopLoc_Location aLocRes (aTrsf * aTrsfOrig); + aShape = anOriginal.Located(aLocRes); + } else if (aType == TRANSLATE_XYZ || aType == TRANSLATE_XYZ_COPY) { gp_Vec aVec (TI.GetDX(), TI.GetDY(), TI.GetDZ()); aTrsf.SetTranslation(aVec); diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index be924b3f7..b2d1ddf84 100755 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -111,6 +111,7 @@ #define TRANSLATE_TWO_POINTS 1 #define TRANSLATE_VECTOR 2 +#define TRANSLATE_VECTOR_DISTANCE 9 #define TRANSLATE_TWO_POINTS_COPY 3 #define TRANSLATE_VECTOR_COPY 4 #define TRANSLATE_1D 5 diff --git a/src/GEOM_I/GEOM_ITransformOperations_i.cc b/src/GEOM_I/GEOM_ITransformOperations_i.cc index e914733f6..3c40ba73a 100644 --- a/src/GEOM_I/GEOM_ITransformOperations_i.cc +++ b/src/GEOM_I/GEOM_ITransformOperations_i.cc @@ -284,6 +284,53 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorCopy return GetObject(anObject); } +//============================================================================= +/*! + * TranslateVectorDistance + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorDistance + (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theDistance, + CORBA::Boolean theCopy) +{ + GEOM::GEOM_Object_var aGEOMObject; + GetOperations()->SetNotDone(); //Set a not done flag + + if (theObject == NULL || theVector == NULL || theDistance == 0) return aGEOMObject._retn(); + + //check if the object is a subshape + if(!theObject->IsMainShape()) { + GetOperations()->SetErrorCode(SUBSHAPE_ERROR); + return aGEOMObject._retn(); + } + + if (!theCopy) + aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); + + //Get the object itself + Handle(GEOM_Object) aBasicObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Get the vector of translation + Handle(GEOM_Object) aVector = + GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), theVector->GetEntry()); + if (aVector.IsNull()) return aGEOMObject._retn(); + + //Perform the translation + if (theCopy) { + Handle(GEOM_Object) anObject = GetOperations()->TranslateVectorDistance(aBasicObject, aVector, theDistance, theCopy); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); + } + + GetOperations()->TranslateVectorDistance(aBasicObject, aVector, theDistance, theCopy); + return aGEOMObject._retn(); +} //============================================================================= /*! diff --git a/src/GEOM_I/GEOM_ITransformOperations_i.hh b/src/GEOM_I/GEOM_ITransformOperations_i.hh index 3f49b17b7..87b375c12 100644 --- a/src/GEOM_I/GEOM_ITransformOperations_i.hh +++ b/src/GEOM_I/GEOM_ITransformOperations_i.hh @@ -60,6 +60,11 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i : GEOM::GEOM_Object_ptr TranslateVectorCopy (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr theVector); + GEOM::GEOM_Object_ptr TranslateVectorDistance (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theDistance, + CORBA::Boolean theCopy); + GEOM::GEOM_Object_ptr MultiTranslate1D (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr theVector, CORBA::Double theStep, CORBA::Long theNbTimes); GEOM::GEOM_Object_ptr MultiTranslate2D (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr theVector1, CORBA::Double theStep1, CORBA::Long theNbTimes1, @@ -72,7 +77,6 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i : GEOM::GEOM_Object_ptr MultiRotate1D (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr theVector, CORBA::Long theNbTimes); - GEOM::GEOM_Object_ptr MultiRotate2D (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr theVector, diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx index e5f0f183a..86b57cb84 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx @@ -42,6 +42,7 @@ #include #include +#include #include "GEOMImpl_Types.hxx" @@ -77,7 +78,7 @@ TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg RadioButton1->setChecked(true); - GroupPoints = new DlgRef_3Sel3Spin1Check(this, "GroupPoints"); + GroupPoints = new DlgRef_3Sel3Spin2Check(this, "GroupPoints"); GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); GroupPoints->TextLabel3->setText(tr("GEOM_POINT_I").arg("2")); @@ -87,7 +88,8 @@ TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg GroupPoints->PushButton1->setPixmap(image3); GroupPoints->PushButton2->setPixmap(image3); GroupPoints->PushButton3->setPixmap(image3); - GroupPoints->CheckBox1->setText(tr("GEOM_CREATE_COPY")); + GroupPoints->CheckBox1->setText(tr("Activate Distance")); + GroupPoints->CheckBox2->setText(tr("GEOM_CREATE_COPY")); Layout1->addWidget(GroupPoints, 2, 0); /***************************************************************/ @@ -123,7 +125,7 @@ void TransformationGUI_TranslationDlg::Init() myVector = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); // Activate Create a Copy mode - GroupPoints->CheckBox1->setChecked(true); + GroupPoints->CheckBox2->setChecked(true); CreateCopyModeChanged(true); /* Get setting of step value from file configuration */ @@ -158,13 +160,16 @@ void TransformationGUI_TranslationDlg::Init() connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox2, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox3, SLOT(SetStep(double))); - connect(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); + connect(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(ActivateDistanceChanged(bool))); + connect(GroupPoints->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "GEOM_TRANSLATION" ) ); + ConstructorsClicked( 0 ); + } @@ -185,29 +190,41 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId) case 0: /* translation an object by dx, dy, dz */ { GroupPoints->ShowRows(1,2,false); + GroupPoints->TextLabel6->setText(tr("GEOM_DZ")); + GroupPoints->CheckBox1->hide(); resize(0,0); GroupPoints->ShowRows(3,5,true); + GroupPoints->SpinBox3->setEnabled(true); break; } case 1: /* translation an object by 2 points */ { GroupPoints->ShowRows(3,5,false); + GroupPoints->CheckBox1->hide(); + GroupPoints->TextLabel6->setText(tr("GEOM_DZ")); resize(0,0); GroupPoints->ShowRows(0,2,true); GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("1")); GroupPoints->LineEdit2->clear(); GroupPoints->LineEdit3->clear(); + GroupPoints->SpinBox3->setEnabled(true); myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); break; } case 2: /* translation an object by vector */ { - GroupPoints->ShowRows(2,5,false); + GroupPoints->CheckBox1->show(); + GroupPoints->TextLabel6->setText(tr("GEOM_DISTANCE")); + GroupPoints->ShowRows(2,4,false); + GroupPoints->SpinBox3->SetValue(0.0); + GroupPoints->SpinBox3->setEnabled(false); resize(0,0); GroupPoints->ShowRows(0,1,true); + GroupPoints->ShowRows(5,5,true); GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); GroupPoints->LineEdit2->clear(); myVector = GEOM::GEOM_Object::_nil(); + ActivateDistanceChanged(GroupPoints->CheckBox1->isChecked()); break; } } @@ -215,6 +232,10 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId) myEditCurrentArgument->setFocus(); connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + qApp->processEvents(); + updateGeometry(); + resize(minimumSize()); } @@ -235,7 +256,7 @@ void TransformationGUI_TranslationDlg::ClickOnOk() //================================================================================= bool TransformationGUI_TranslationDlg::ClickOnApply() { - if ( !onAccept(GroupPoints->CheckBox1->isChecked()) ) + if ( !onAccept(GroupPoints->CheckBox2->isChecked()) ) return false; initName(); @@ -436,6 +457,12 @@ bool TransformationGUI_TranslationDlg::isValid( QString& msg ) { case 0: { + Handle(SALOME_InteractiveObject) IO = firstIObject(); + Standard_Boolean testResult; + GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject( IO, testResult ); + if ( !testResult || anObject->_is_nil() ) + return false; + return !(myObjects.length() == 0 ); break; } @@ -460,7 +487,7 @@ bool TransformationGUI_TranslationDlg::isValid( QString& msg ) bool TransformationGUI_TranslationDlg::execute( ObjectList& objects ) { bool res = false; - bool toCreateCopy = IsPreview() || GroupPoints->CheckBox1->isChecked(); + bool toCreateCopy = IsPreview() || GroupPoints->CheckBox2->isChecked(); GEOM::GEOM_Object_var anObj; @@ -514,27 +541,40 @@ bool TransformationGUI_TranslationDlg::execute( ObjectList& objects ) } case 2: { - if (toCreateCopy) - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> - TranslateVectorCopy( myObjects[i], myVector ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - else - for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> - TranslateVector( myObjects[i], myVector ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } + bool byDistance = GroupPoints->CheckBox1->isChecked(); + if (byDistance) { + bool withCopy = GroupPoints->CheckBox2->isChecked(); + double aDistance = GroupPoints->SpinBox3->GetValue(); + for (int i = 0; i < myObjects.length(); i++) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + TranslateVectorDistance( myObjects[i], myVector, aDistance, toCreateCopy ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + } + else { + if (toCreateCopy) + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + TranslateVectorCopy( myObjects[i], myVector ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + } + else + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + TranslateVector( myObjects[i], myVector ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + } res = true; break; } } - return res; } @@ -548,13 +588,23 @@ void TransformationGUI_TranslationDlg::CreateCopyModeChanged(bool isCreateCopy) GroupBoxName->setEnabled(isCreateCopy); } +//================================================================================= +// function : ActivateDistanceChanged() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::ActivateDistanceChanged(bool theEnable) +{ + GroupPoints->SpinBox3->setEnabled(theEnable); + displayPreview(); +} + //================================================================================= // function : addSubshapeToStudy // purpose : virtual method to add new SubObjects if local selection //================================================================================= void TransformationGUI_TranslationDlg::addSubshapesToStudy() { - bool toCreateCopy = IsPreview() || GroupPoints->CheckBox1->isChecked(); + bool toCreateCopy = IsPreview() || GroupPoints->CheckBox2->isChecked(); if (toCreateCopy) { QMap objMap; diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.h b/src/TransformationGUI/TransformationGUI_TranslationDlg.h index 11975c136..ea612c6be 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.h +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.h @@ -29,7 +29,7 @@ #define DIALOGBOX_TRANSLATION_H #include "GEOMBase_Skeleton.h" -#include "DlgRef_3Sel3Spin1Check.h" +#include "DlgRef_3Sel3Spin2Check.h" //================================================================================= @@ -58,8 +58,9 @@ private: GEOM::GEOM_Object_var myVector, myPoint1, myPoint2; GEOM::ListOfGO myObjects; + double myTranslateDistance; - DlgRef_3Sel3Spin1Check* GroupPoints; + DlgRef_3Sel3Spin2Check* GroupPoints; private slots : void ClickOnOk(); @@ -71,6 +72,7 @@ private slots : void ConstructorsClicked(int constructorId); void ValueChangedInSpinBox(); void CreateCopyModeChanged(bool isCreateCopy); + void ActivateDistanceChanged(bool isEnable); }; #endif // DIALOGBOX_TRANSLATION_H