NPAL 12483 Translate an object given a vector and a length

This commit is contained in:
dmv 2008-03-11 13:48:56 +00:00
parent 86019a6c24
commit bc48fafff3
16 changed files with 966 additions and 34 deletions

View File

@ -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 <DlgRef_3Sel3Spin2Check.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlineedit.h>
#include <qcheckbox.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qgroupbox.h>
/*
* 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)();
}
}

View File

@ -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

View File

@ -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 <qvariant.h>
#include <qgroupbox.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qspinbox.h>
#include <qlineedit.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* 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" ) );
}

View File

@ -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 <qvariant.h>
#include <qwidget.h>
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

View File

@ -67,6 +67,7 @@ dist_libDlgRef_la_SOURCES = \
DlgRef_3Spin_QTD.cxx \ DlgRef_3Spin_QTD.cxx \
DlgRef_3Spin1Check_QTD.cxx \ DlgRef_3Spin1Check_QTD.cxx \
DlgRef_3Sel3Spin1Check_QTD.cxx \ DlgRef_3Sel3Spin1Check_QTD.cxx \
DlgRef_3Sel3Spin2Check_QTD.cxx \
DlgRef_4Sel1Spin2Check_QTD.cxx \ DlgRef_4Sel1Spin2Check_QTD.cxx \
DlgRef_SpinBox.cxx \ DlgRef_SpinBox.cxx \
DlgRef_1Sel1Spin.cxx \ DlgRef_1Sel1Spin.cxx \
@ -84,6 +85,7 @@ dist_libDlgRef_la_SOURCES = \
DlgRef_2Sel4Spin1Check.cxx \ DlgRef_2Sel4Spin1Check.cxx \
DlgRef_3Sel4Spin2Check.cxx \ DlgRef_3Sel4Spin2Check.cxx \
DlgRef_3Sel3Spin1Check.cxx \ DlgRef_3Sel3Spin1Check.cxx \
DlgRef_3Sel3Spin2Check.cxx \
DlgRef_1Spin.cxx \ DlgRef_1Spin.cxx \
DlgRef_2Spin.cxx \ DlgRef_2Spin.cxx \
DlgRef_3Spin.cxx \ DlgRef_3Spin.cxx \
@ -128,6 +130,7 @@ MOC_FILES = \
DlgRef_3Spin_QTD_moc.cxx \ DlgRef_3Spin_QTD_moc.cxx \
DlgRef_3Spin1Check_QTD_moc.cxx \ DlgRef_3Spin1Check_QTD_moc.cxx \
DlgRef_3Sel3Spin1Check_QTD_moc.cxx \ DlgRef_3Sel3Spin1Check_QTD_moc.cxx \
DlgRef_3Sel3Spin2Check_QTD_moc.cxx \
DlgRef_4Sel1Spin2Check_QTD_moc.cxx \ DlgRef_4Sel1Spin2Check_QTD_moc.cxx \
DlgRef_SpinBox_moc.cxx \ DlgRef_SpinBox_moc.cxx \
DlgRef_1Sel1Spin_moc.cxx \ DlgRef_1Sel1Spin_moc.cxx \
@ -145,6 +148,7 @@ MOC_FILES = \
DlgRef_2Sel4Spin1Check_moc.cxx \ DlgRef_2Sel4Spin1Check_moc.cxx \
DlgRef_3Sel4Spin2Check_moc.cxx \ DlgRef_3Sel4Spin2Check_moc.cxx \
DlgRef_3Sel3Spin1Check_moc.cxx \ DlgRef_3Sel3Spin1Check_moc.cxx \
DlgRef_3Sel3Spin2Check_moc.cxx \
DlgRef_1Spin_moc.cxx \ DlgRef_1Spin_moc.cxx \
DlgRef_2Spin_moc.cxx \ DlgRef_2Spin_moc.cxx \
DlgRef_3Spin_moc.cxx \ DlgRef_3Spin_moc.cxx \
@ -191,6 +195,7 @@ salomeinclude_HEADERS = \
DlgRef_3Spin_QTD.h \ DlgRef_3Spin_QTD.h \
DlgRef_3Spin1Check_QTD.h \ DlgRef_3Spin1Check_QTD.h \
DlgRef_3Sel3Spin1Check_QTD.h \ DlgRef_3Sel3Spin1Check_QTD.h \
DlgRef_3Sel3Spin2Check_QTD.h \
DlgRef_4Sel1Spin2Check_QTD.h \ DlgRef_4Sel1Spin2Check_QTD.h \
DlgRef_SpinBox.h \ DlgRef_SpinBox.h \
DlgRef_1Sel1Spin.h \ DlgRef_1Sel1Spin.h \
@ -208,6 +213,7 @@ salomeinclude_HEADERS = \
DlgRef_2Sel4Spin1Check.h \ DlgRef_2Sel4Spin1Check.h \
DlgRef_3Sel4Spin2Check.h \ DlgRef_3Sel4Spin2Check.h \
DlgRef_3Sel3Spin1Check.h \ DlgRef_3Sel3Spin1Check.h \
DlgRef_3Sel3Spin2Check.h \
DlgRef_1Spin.h \ DlgRef_1Spin.h \
DlgRef_2Spin.h \ DlgRef_2Spin.h \
DlgRef_3Spin.h \ DlgRef_3Spin.h \

View File

@ -0,0 +1,319 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>DlgRef_3Sel3Spin2Check_QTD</class>
<widget class="QWidget">
<property name="name">
<cstring>DlgRef_3Sel3Spin2Check_QTD</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>338</width>
<height>274</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="caption">
<string>DlgRef_3Sel3Spin2Check_QTD</string>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QGroupBox">
<property name="name">
<cstring>GroupBox1</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string></string>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>11</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout1</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<spacer row="8" column="3">
<property name="name">
<cstring>Spacer3</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>130</height>
</size>
</property>
</spacer>
<widget class="QPushButton" row="0" column="1">
<property name="name">
<cstring>PushButton1</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string></string>
</property>
</widget>
<widget class="QLabel" row="2" column="0">
<property name="name">
<cstring>TextLabel3</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TL3</string>
</property>
</widget>
<widget class="QCheckBox" row="6" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>CheckBox1</cstring>
</property>
<property name="text">
<string></string>
</property>
</widget>
<widget class="QLabel" row="5" column="0">
<property name="name">
<cstring>TextLabel6</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TL6</string>
</property>
</widget>
<widget class="QSpinBox" row="4" column="2" rowspan="1" colspan="2">
<property name="name">
<cstring>SpinBox_2</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLineEdit" row="1" column="2" rowspan="1" colspan="2">
<property name="name">
<cstring>LineEdit2</cstring>
</property>
</widget>
<widget class="QLineEdit" row="0" column="2" rowspan="1" colspan="2">
<property name="name">
<cstring>LineEdit1</cstring>
</property>
</widget>
<widget class="QLineEdit" row="2" column="2" rowspan="1" colspan="2">
<property name="name">
<cstring>LineEdit3</cstring>
</property>
</widget>
<widget class="QPushButton" row="1" column="1">
<property name="name">
<cstring>PushButton2</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string></string>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>TextLabel2</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TL2</string>
</property>
</widget>
<widget class="QCheckBox" row="7" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>CheckBox2</cstring>
</property>
<property name="text">
<string></string>
</property>
</widget>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>TextLabel1</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TL1</string>
</property>
</widget>
<widget class="QPushButton" row="2" column="1">
<property name="name">
<cstring>PushButton3</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string></string>
</property>
</widget>
<widget class="QLabel" row="4" column="0">
<property name="name">
<cstring>TextLabel5</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TL5</string>
</property>
</widget>
<widget class="QSpinBox" row="3" column="2" rowspan="1" colspan="2">
<property name="name">
<cstring>SpinBox_1</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QSpinBox" row="5" column="2" rowspan="1" colspan="2">
<property name="name">
<cstring>SpinBox_3</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLabel" row="3" column="0">
<property name="name">
<cstring>TextLabel4</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TL4</string>
</property>
</widget>
</grid>
</widget>
</hbox>
</widget>
</vbox>
</widget>
<tabstops>
<tabstop>PushButton1</tabstop>
<tabstop>LineEdit1</tabstop>
<tabstop>PushButton2</tabstop>
<tabstop>LineEdit2</tabstop>
<tabstop>PushButton3</tabstop>
<tabstop>LineEdit3</tabstop>
<tabstop>SpinBox_1</tabstop>
<tabstop>SpinBox_2</tabstop>
<tabstop>SpinBox_3</tabstop>
<tabstop>CheckBox1</tabstop>
</tabstops>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View File

@ -18,8 +18,8 @@
# #
#!/bin/sh #!/bin/sh
#uic -o 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_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.h DlgRef_1Sel_QTD.ui
#uic -o DlgRef_1Sel_QTD.cxx -impl 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.h DlgRef_2Sel3Spin2Rb_QTD.ui
#uic -o DlgRef_2Sel3Spin2Rb_QTD.cxx -impl 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.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_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

View File

@ -350,7 +350,6 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVector
SetErrorCode(OK); SetErrorCode(OK);
return theObject; return theObject;
} }
//============================================================================= //=============================================================================
/*! /*!
* TranslateVectorCopy * TranslateVectorCopy
@ -405,6 +404,73 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorCopy
return aCopy; 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 * Translate1D

View File

@ -50,6 +50,9 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations {
Standard_EXPORT Handle(GEOM_Object) TranslateVectorCopy (Handle(GEOM_Object) theObject, Standard_EXPORT Handle(GEOM_Object) TranslateVectorCopy (Handle(GEOM_Object) theObject,
Handle(GEOM_Object) theVector); 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) 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, Standard_EXPORT Handle(GEOM_Object) Translate2D (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector, double theStep1, Standard_Integer theNbTimes1,

View File

@ -34,6 +34,7 @@
#define TRANSLATE_ARG_DX 12 #define TRANSLATE_ARG_DX 12
#define TRANSLATE_ARG_DY 13 #define TRANSLATE_ARG_DY 13
#define TRANSLATE_ARG_DZ 14 #define TRANSLATE_ARG_DZ 14
#define TRANSLATE_ARG_DISTANCE 15
class GEOMImpl_ITranslate class GEOMImpl_ITranslate
{ {
@ -81,6 +82,10 @@ class GEOMImpl_ITranslate
double GetDX() { return _func->GetReal(TRANSLATE_ARG_DX); } 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); } void SetDY(double theDY) { return _func->SetReal(TRANSLATE_ARG_DY, theDY); }
double GetDY() { return _func->GetReal(TRANSLATE_ARG_DY); } double GetDY() { return _func->GetReal(TRANSLATE_ARG_DY); }

View File

@ -122,6 +122,26 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const
TopLoc_Location aLocRes (aTrsf * aTrsfOrig); TopLoc_Location aLocRes (aTrsf * aTrsfOrig);
aShape = anOriginal.Located(aLocRes); 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) { else if (aType == TRANSLATE_XYZ || aType == TRANSLATE_XYZ_COPY) {
gp_Vec aVec (TI.GetDX(), TI.GetDY(), TI.GetDZ()); gp_Vec aVec (TI.GetDX(), TI.GetDY(), TI.GetDZ());
aTrsf.SetTranslation(aVec); aTrsf.SetTranslation(aVec);

View File

@ -111,6 +111,7 @@
#define TRANSLATE_TWO_POINTS 1 #define TRANSLATE_TWO_POINTS 1
#define TRANSLATE_VECTOR 2 #define TRANSLATE_VECTOR 2
#define TRANSLATE_VECTOR_DISTANCE 9
#define TRANSLATE_TWO_POINTS_COPY 3 #define TRANSLATE_TWO_POINTS_COPY 3
#define TRANSLATE_VECTOR_COPY 4 #define TRANSLATE_VECTOR_COPY 4
#define TRANSLATE_1D 5 #define TRANSLATE_1D 5

View File

@ -284,6 +284,53 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorCopy
return GetObject(anObject); 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();
}
//============================================================================= //=============================================================================
/*! /*!

View File

@ -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 TranslateVectorCopy (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr theVector); 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 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, GEOM::GEOM_Object_ptr MultiTranslate2D (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr theVector1, CORBA::Double theStep1, CORBA::Long theNbTimes1,
@ -73,7 +78,6 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i :
GEOM::GEOM_Object_ptr theVector, GEOM::GEOM_Object_ptr theVector,
CORBA::Long theNbTimes); CORBA::Long theNbTimes);
GEOM::GEOM_Object_ptr MultiRotate2D (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr MultiRotate2D (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr theVector, GEOM::GEOM_Object_ptr theVector,
CORBA::Double theAngle, CORBA::Double theAngle,

View File

@ -42,6 +42,7 @@
#include <qlabel.h> #include <qlabel.h>
#include <qcheckbox.h> #include <qcheckbox.h>
#include <qapplication.h>
#include "GEOMImpl_Types.hxx" #include "GEOMImpl_Types.hxx"
@ -77,7 +78,7 @@ TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg
RadioButton1->setChecked(true); RadioButton1->setChecked(true);
GroupPoints = new DlgRef_3Sel3Spin1Check(this, "GroupPoints"); GroupPoints = new DlgRef_3Sel3Spin2Check(this, "GroupPoints");
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS"));
GroupPoints->TextLabel3->setText(tr("GEOM_POINT_I").arg("2")); GroupPoints->TextLabel3->setText(tr("GEOM_POINT_I").arg("2"));
@ -87,7 +88,8 @@ TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg
GroupPoints->PushButton1->setPixmap(image3); GroupPoints->PushButton1->setPixmap(image3);
GroupPoints->PushButton2->setPixmap(image3); GroupPoints->PushButton2->setPixmap(image3);
GroupPoints->PushButton3->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); Layout1->addWidget(GroupPoints, 2, 0);
/***************************************************************/ /***************************************************************/
@ -123,7 +125,7 @@ void TransformationGUI_TranslationDlg::Init()
myVector = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); myVector = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
// Activate Create a Copy mode // Activate Create a Copy mode
GroupPoints->CheckBox1->setChecked(true); GroupPoints->CheckBox2->setChecked(true);
CreateCopyModeChanged(true); CreateCopyModeChanged(true);
/* Get setting of step value from file configuration */ /* 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->SpinBox2, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox3, 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(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName( tr( "GEOM_TRANSLATION" ) ); initName( tr( "GEOM_TRANSLATION" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -185,29 +190,41 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId)
case 0: /* translation an object by dx, dy, dz */ case 0: /* translation an object by dx, dy, dz */
{ {
GroupPoints->ShowRows(1,2,false); GroupPoints->ShowRows(1,2,false);
GroupPoints->TextLabel6->setText(tr("GEOM_DZ"));
GroupPoints->CheckBox1->hide();
resize(0,0); resize(0,0);
GroupPoints->ShowRows(3,5,true); GroupPoints->ShowRows(3,5,true);
GroupPoints->SpinBox3->setEnabled(true);
break; break;
} }
case 1: /* translation an object by 2 points */ case 1: /* translation an object by 2 points */
{ {
GroupPoints->ShowRows(3,5,false); GroupPoints->ShowRows(3,5,false);
GroupPoints->CheckBox1->hide();
GroupPoints->TextLabel6->setText(tr("GEOM_DZ"));
resize(0,0); resize(0,0);
GroupPoints->ShowRows(0,2,true); GroupPoints->ShowRows(0,2,true);
GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("1")); GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("1"));
GroupPoints->LineEdit2->clear(); GroupPoints->LineEdit2->clear();
GroupPoints->LineEdit3->clear(); GroupPoints->LineEdit3->clear();
GroupPoints->SpinBox3->setEnabled(true);
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
break; break;
} }
case 2: /* translation an object by vector */ 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); resize(0,0);
GroupPoints->ShowRows(0,1,true); GroupPoints->ShowRows(0,1,true);
GroupPoints->ShowRows(5,5,true);
GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
GroupPoints->LineEdit2->clear(); GroupPoints->LineEdit2->clear();
myVector = GEOM::GEOM_Object::_nil(); myVector = GEOM::GEOM_Object::_nil();
ActivateDistanceChanged(GroupPoints->CheckBox1->isChecked());
break; break;
} }
} }
@ -215,6 +232,10 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId)
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
qApp->processEvents();
updateGeometry();
resize(minimumSize());
} }
@ -235,7 +256,7 @@ void TransformationGUI_TranslationDlg::ClickOnOk()
//================================================================================= //=================================================================================
bool TransformationGUI_TranslationDlg::ClickOnApply() bool TransformationGUI_TranslationDlg::ClickOnApply()
{ {
if ( !onAccept(GroupPoints->CheckBox1->isChecked()) ) if ( !onAccept(GroupPoints->CheckBox2->isChecked()) )
return false; return false;
initName(); initName();
@ -436,6 +457,12 @@ bool TransformationGUI_TranslationDlg::isValid( QString& msg )
{ {
case 0: 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 ); return !(myObjects.length() == 0 );
break; break;
} }
@ -460,7 +487,7 @@ bool TransformationGUI_TranslationDlg::isValid( QString& msg )
bool TransformationGUI_TranslationDlg::execute( ObjectList& objects ) bool TransformationGUI_TranslationDlg::execute( ObjectList& objects )
{ {
bool res = false; bool res = false;
bool toCreateCopy = IsPreview() || GroupPoints->CheckBox1->isChecked(); bool toCreateCopy = IsPreview() || GroupPoints->CheckBox2->isChecked();
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
@ -514,27 +541,40 @@ bool TransformationGUI_TranslationDlg::execute( ObjectList& objects )
} }
case 2: case 2:
{ {
if (toCreateCopy) bool byDistance = GroupPoints->CheckBox1->isChecked();
for (int i = 0; i < myObjects.length(); i++) if (byDistance) {
{ bool withCopy = GroupPoints->CheckBox2->isChecked();
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> double aDistance = GroupPoints->SpinBox3->GetValue();
TranslateVectorCopy( myObjects[i], myVector ); for (int i = 0; i < myObjects.length(); i++) {
if ( !anObj->_is_nil() ) anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
objects.push_back( anObj._retn() ); TranslateVectorDistance( myObjects[i], myVector, aDistance, toCreateCopy );
} if ( !anObj->_is_nil() )
else objects.push_back( anObj._retn() );
for (int i = 0; i < myObjects.length(); i++) }
{ }
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> else {
TranslateVector( myObjects[i], myVector ); if (toCreateCopy)
if ( !anObj->_is_nil() ) for (int i = 0; i < myObjects.length(); i++)
objects.push_back( anObj._retn() ); {
} 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; res = true;
break; break;
} }
} }
return res; return res;
} }
@ -548,13 +588,23 @@ void TransformationGUI_TranslationDlg::CreateCopyModeChanged(bool isCreateCopy)
GroupBoxName->setEnabled(isCreateCopy); GroupBoxName->setEnabled(isCreateCopy);
} }
//=================================================================================
// function : ActivateDistanceChanged()
// purpose :
//=================================================================================
void TransformationGUI_TranslationDlg::ActivateDistanceChanged(bool theEnable)
{
GroupPoints->SpinBox3->setEnabled(theEnable);
displayPreview();
}
//================================================================================= //=================================================================================
// function : addSubshapeToStudy // function : addSubshapeToStudy
// purpose : virtual method to add new SubObjects if local selection // purpose : virtual method to add new SubObjects if local selection
//================================================================================= //=================================================================================
void TransformationGUI_TranslationDlg::addSubshapesToStudy() void TransformationGUI_TranslationDlg::addSubshapesToStudy()
{ {
bool toCreateCopy = IsPreview() || GroupPoints->CheckBox1->isChecked(); bool toCreateCopy = IsPreview() || GroupPoints->CheckBox2->isChecked();
if (toCreateCopy) { if (toCreateCopy) {
QMap<QString, GEOM::GEOM_Object_var> objMap; QMap<QString, GEOM::GEOM_Object_var> objMap;

View File

@ -29,7 +29,7 @@
#define DIALOGBOX_TRANSLATION_H #define DIALOGBOX_TRANSLATION_H
#include "GEOMBase_Skeleton.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::GEOM_Object_var myVector, myPoint1, myPoint2;
GEOM::ListOfGO myObjects; GEOM::ListOfGO myObjects;
double myTranslateDistance;
DlgRef_3Sel3Spin1Check* GroupPoints; DlgRef_3Sel3Spin2Check* GroupPoints;
private slots : private slots :
void ClickOnOk(); void ClickOnOk();
@ -71,6 +72,7 @@ private slots :
void ConstructorsClicked(int constructorId); void ConstructorsClicked(int constructorId);
void ValueChangedInSpinBox(); void ValueChangedInSpinBox();
void CreateCopyModeChanged(bool isCreateCopy); void CreateCopyModeChanged(bool isCreateCopy);
void ActivateDistanceChanged(bool isEnable);
}; };
#endif // DIALOGBOX_TRANSLATION_H #endif // DIALOGBOX_TRANSLATION_H