*** empty log message ***

This commit is contained in:
vsr 2007-10-17 12:24:45 +00:00
parent 7acd6548a6
commit b6cf20bd37
23 changed files with 1948 additions and 2043 deletions

View File

@ -493,7 +493,7 @@ GEOM::GEOM_IOperations_ptr BasicGUI_PointDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool BasicGUI_PointDlg::isValid( QString& msg ) bool BasicGUI_PointDlg::isValid( QString& /*msg*/ )
{ {
const int id = getConstructorId(); const int id = getConstructorId();
if ( id == 0 ) if ( id == 0 )

View File

@ -20,7 +20,7 @@
<number>6</number> <number>6</number>
</property> </property>
<item row="1" column="0" > <item row="1" column="0" >
<widget class="QGroupBox" name="DlgRef_Skeleton_QTD" > <widget class="QGroupBox" name="GroupBoxName" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy>
<hsizetype>5</hsizetype> <hsizetype>5</hsizetype>

View File

@ -1249,7 +1249,7 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
myLastX1 == myLastX2 && myLastY1 == myLastY2 ) || myIsAllAdded ) { myLastX1 == myLastX2 && myLastY1 == myLastY2 ) || myIsAllAdded ) {
cmd = myCommand.join( "" ); cmd = myCommand.join( "" );
if ( ::qobject_cast<QWidget*>( Group1Sel->gridLayout->parent() )->isVisible() ) { if ( Group1Sel->isVisible() ) {
Group1Sel->buttonApply->setEnabled( false ); Group1Sel->buttonApply->setEnabled( false );
//Group1Sel->buttonApply->setFocus(); //Group1Sel->buttonApply->setFocus();
} }
@ -1273,7 +1273,7 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
else { else {
cmd = myCommand.join( "" ) + GetNewCommand(); cmd = myCommand.join( "" ) + GetNewCommand();
if ( ::qobject_cast<QWidget*>( Group1Sel->gridLayout->parent() )->isVisible() ) { if ( Group1Sel->isVisible() ) {
Group1Sel->buttonApply->setEnabled( true ); Group1Sel->buttonApply->setEnabled( true );
//Group1Sel->buttonApply->setFocus(); //Group1Sel->buttonApply->setFocus();
} }

View File

@ -19,13 +19,10 @@
# #
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
# File : Makefile.am
# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
# Package : BooleanGUI
# #
#
# File : Makefile.in
# Author : Damien COQUERET (OCC)
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
# $Header:
include $(top_srcdir)/adm_local/unix/make_common_starter.am include $(top_srcdir)/adm_local/unix/make_common_starter.am
@ -36,6 +33,16 @@ salomeinclude_HEADERS =
lib_LTLIBRARIES = libTransformationGUI.la lib_LTLIBRARIES = libTransformationGUI.la
dist_libTransformationGUI_la_SOURCES = \ dist_libTransformationGUI_la_SOURCES = \
TransformationGUI.h \
TransformationGUI_MultiTranslationDlg.h \
TransformationGUI_MultiRotationDlg.h \
TransformationGUI_TranslationDlg.h \
TransformationGUI_RotationDlg.h \
TransformationGUI_MirrorDlg.h \
TransformationGUI_ScaleDlg.h \
TransformationGUI_OffsetDlg.h \
TransformationGUI_PositionDlg.h \
\
TransformationGUI.cxx \ TransformationGUI.cxx \
TransformationGUI_MultiTranslationDlg.cxx \ TransformationGUI_MultiTranslationDlg.cxx \
TransformationGUI_MultiRotationDlg.cxx \ TransformationGUI_MultiRotationDlg.cxx \
@ -82,6 +89,7 @@ libTransformationGUI_la_CPPFLAGS = \
-I$(srcdir)/../GEOMClient \ -I$(srcdir)/../GEOMClient \
-I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMImpl \
-I$(srcdir)/../GEOMFiltersSelection \ -I$(srcdir)/../GEOMFiltersSelection \
-I$(top_builddir)/src/DlgRef \
-I$(top_builddir)/idl \ -I$(top_builddir)/idl \
-I$(top_builddir)/salome_adm/unix -I$(top_builddir)/salome_adm/unix

View File

@ -19,19 +19,16 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : TransformationGUI.cxx // File : TransformationGUI.cxx
// Author : Damien COQUERET // Author : Damien COQUERET, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "TransformationGUI.h" #include "TransformationGUI.h"
#include "GeometryGUI.h"
#include "SUIT_Desktop.h" #include <GeometryGUI.h>
#include "SalomeApp_Application.h" #include <SUIT_Desktop.h>
#include <SalomeApp_Application.h>
#include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION #include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION
#include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION #include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION
@ -42,13 +39,12 @@
#include "TransformationGUI_OffsetDlg.h" // Method OFFSET #include "TransformationGUI_OffsetDlg.h" // Method OFFSET
#include "TransformationGUI_PositionDlg.h" // Method POSITION #include "TransformationGUI_PositionDlg.h" // Method POSITION
using namespace std;
//======================================================================= //=======================================================================
// function : TransformationGUI() // function : TransformationGUI()
// purpose : Constructor // purpose : Constructor
//======================================================================= //=======================================================================
TransformationGUI::TransformationGUI(GeometryGUI* parent) : GEOMGUI(parent) TransformationGUI::TransformationGUI( GeometryGUI* parent )
: GEOMGUI( parent )
{ {
} }
@ -73,31 +69,30 @@ bool TransformationGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
getGeometryGUI()->EmitSignalDeactivateDialog(); getGeometryGUI()->EmitSignalDeactivateDialog();
QDialog* aDlg = NULL; QDialog* aDlg = NULL;
switch (theCommandID) switch ( theCommandID ) {
{
case 5021: // TRANSLATION case 5021: // TRANSLATION
aDlg = new TransformationGUI_TranslationDlg( getGeometryGUI(), parent, "" ); aDlg = new TransformationGUI_TranslationDlg( getGeometryGUI(), parent );
break; break;
case 5022: // ROTATION case 5022: // ROTATION
aDlg = new TransformationGUI_RotationDlg( getGeometryGUI(), parent, "" ); aDlg = new TransformationGUI_RotationDlg( getGeometryGUI(), parent );
break; break;
case 5023: // POSITION case 5023: // POSITION
aDlg = new TransformationGUI_PositionDlg( getGeometryGUI(), parent, "" ); aDlg = new TransformationGUI_PositionDlg( getGeometryGUI(), parent );
break; break;
case 5024: // MIRROR case 5024: // MIRROR
aDlg = new TransformationGUI_MirrorDlg( getGeometryGUI(), parent, "" ); aDlg = new TransformationGUI_MirrorDlg( getGeometryGUI(), parent );
break; break;
case 5025: // SCALE case 5025: // SCALE
aDlg = new TransformationGUI_ScaleDlg( getGeometryGUI(), parent, "" ); aDlg = new TransformationGUI_ScaleDlg( getGeometryGUI(), parent );
break; break;
case 5026: // OFFSET case 5026: // OFFSET
aDlg = new TransformationGUI_OffsetDlg( getGeometryGUI(), parent, "" ); aDlg = new TransformationGUI_OffsetDlg( getGeometryGUI(), parent );
break; break;
case 5027: // MULTI TRANSLATION case 5027: // MULTI TRANSLATION
aDlg = new TransformationGUI_MultiTranslationDlg( getGeometryGUI(), parent, "" ); aDlg = new TransformationGUI_MultiTranslationDlg( getGeometryGUI(), parent );
break; break;
case 5028: // MULTI ROTATION case 5028: // MULTI ROTATION
aDlg = new TransformationGUI_MultiRotationDlg( getGeometryGUI(), parent, "" ); aDlg = new TransformationGUI_MultiRotationDlg( getGeometryGUI(), parent );
break; break;
default: default:
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );

View File

@ -19,17 +19,14 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : TransformationGUI.h // File : TransformationGUI.h
// Author : Damien COQUERET // Author : Damien COQUERET, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef TRANSFORMATIONGUI_H #ifndef TRANSFORMATIONGUI_H
#define TRANSFORMATIONGUI_H #define TRANSFORMATIONGUI_H
#include "GEOMGUI.h" #include <GEOMGUI.h>
//================================================================================= //=================================================================================
// class : TransformationGUI // class : TransformationGUI
@ -38,10 +35,10 @@
class TransformationGUI : public GEOMGUI class TransformationGUI : public GEOMGUI
{ {
public: public:
TransformationGUI( GeometryGUI* parent ); TransformationGUI( GeometryGUI* );
~TransformationGUI(); ~TransformationGUI();
bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); bool OnGUIEvent( int, SUIT_Desktop* );
}; };
#endif #endif // TRANSFORMATIONGUI_H

View File

@ -19,28 +19,22 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : TransformationGUI_MirrorDlg.cxx // File : TransformationGUI_MirrorDlg.cxx
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "TransformationGUI_MirrorDlg.h" #include "TransformationGUI_MirrorDlg.h"
#include "DlgRef_2Sel1Spin2Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h" #include <GEOM_DlgRef.h>
#include "GEOMBase.h" #include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h" #include <SUIT_ResourceMgr.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
#include "GEOMImpl_Types.hxx" #include <GEOMImpl_Types.hxx>
using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_MirrorDlg() // class : TransformationGUI_MirrorDlg()
@ -50,8 +44,8 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg( GeometryGUI* theGeometryGUI, QWidget* parent, TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, Qt::WindowFlags fl) bool modal, Qt::WindowFlags fl )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{ {
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_MIRROR_POINT" ) ) ); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_MIRROR_POINT" ) ) );
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_MIRROR_AXE" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_MIRROR_AXE" ) ) );
@ -61,12 +55,12 @@ TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg(GeometryGUI* theGeometr
setWindowTitle( tr( "GEOM_MIRROR_TITLE" ) ); setWindowTitle( tr( "GEOM_MIRROR_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_MIRROR")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_MIRROR" ) );
RadioButton1->setIcon(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setIcon(image1); mainFrame()->RadioButton2->setIcon( image1 );
RadioButton3->setIcon(image2); mainFrame()->RadioButton3->setIcon( image2 );
GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints"); GroupPoints = new DlgRef_2Sel1Spin2Check( centralWidget() );
GroupPoints->SpinBox_DX->hide(); GroupPoints->SpinBox_DX->hide();
GroupPoints->TextLabel3->hide(); GroupPoints->TextLabel3->hide();
GroupPoints->CheckButton2->hide(); GroupPoints->CheckButton2->hide();
@ -77,7 +71,10 @@ TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg(GeometryGUI* theGeometr
GroupPoints->PushButton1->setIcon( image3 ); GroupPoints->PushButton1->setIcon( image3 );
GroupPoints->PushButton2->setIcon( image3 ); GroupPoints->PushButton2->setIcon( image3 );
GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) ); GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) );
gridLayout1->addWidget(GroupPoints, 2, 0);
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
/***************************************************************/ /***************************************************************/
setHelpFileName( "mirror_image.htm" ); setHelpFileName( "mirror_image.htm" );
@ -114,9 +111,10 @@ void TransformationGUI_MirrorDlg::Init()
CreateCopyModeChanged( true ); CreateCopyModeChanged( true );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
@ -129,7 +127,8 @@ void TransformationGUI_MirrorDlg::Init()
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_MIRROR" ).toLatin1().constData() ); initName( tr( "GEOM_MIRROR" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -147,24 +146,18 @@ void TransformationGUI_MirrorDlg::ConstructorsClicked(int constructorId)
GroupPoints->LineEdit2->clear(); GroupPoints->LineEdit2->clear();
myArgument = GEOM::GEOM_Object::_nil(); myArgument = GEOM::GEOM_Object::_nil();
switch (constructorId) switch ( constructorId ) {
{
case 0: /* mirror an object by point */ case 0: /* mirror an object by point */
{
GroupPoints->TextLabel2->setText( tr( "GEOM_POINT_MIRROR" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_POINT_MIRROR" ) );
break; break;
}
case 1: /* mirror an object by axe */ case 1: /* mirror an object by axe */
{
GroupPoints->TextLabel2->setText( tr( "GEOM_AXE_MIRROR" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_AXE_MIRROR" ) );
break; break;
}
case 2: /* mirror an object by plane */ case 2: /* mirror an object by plane */
{
GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE_MIRROR" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE_MIRROR" ) );
break; break;
} }
}
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
} }
@ -206,11 +199,9 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
QString aName; QString aName;
if(myEditCurrentArgument == GroupPoints->LineEdit1) if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
{
int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName ); int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName );
if(aNbSel < 1) if ( aNbSel < 1 ) {
{
myObjects.length( 0 ); myObjects.length( 0 );
return; return;
} }
@ -220,10 +211,8 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
if ( aNbSel != 1 ) if ( aNbSel != 1 )
aName = tr( "%1_objects" ).arg( aNbSel ); aName = tr( "%1_objects" ).arg( aNbSel );
} }
else if(myEditCurrentArgument == GroupPoints->LineEdit2) else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
{ if ( IObjectCount() != 1 ) {
if(IObjectCount() != 1)
{
myArgument = GEOM::GEOM_Object::_nil(); myArgument = GEOM::GEOM_Object::_nil();
return; return;
} }
@ -247,8 +236,7 @@ void TransformationGUI_MirrorDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 || if ( send == GroupPoints->LineEdit1 ||
send == GroupPoints->LineEdit2) send == GroupPoints->LineEdit2 ) {
{
myEditCurrentArgument = send; myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -269,25 +257,18 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
} }
else if ( send == GroupPoints->PushButton2 ) { else if ( send == GroupPoints->PushButton2 ) {
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
switch(getConstructorId()) switch ( getConstructorId() ) {
{
case 0: case 0:
{
globalSelection( GEOM_POINT ); globalSelection( GEOM_POINT );
break; break;
}
case 1: case 1:
{
globalSelection( GEOM_LINE ); globalSelection( GEOM_LINE );
break; break;
}
case 2: case 2:
{
globalSelection( GEOM_PLANE ); globalSelection( GEOM_PLANE );
break; break;
} }
} }
}
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
SelectionIntoArgument(); SelectionIntoArgument();
@ -311,9 +292,9 @@ void TransformationGUI_MirrorDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : when mouse enter onto the QWidget // purpose : when mouse enter onto the QWidget
//================================================================================= //=================================================================================
void TransformationGUI_MirrorDlg::enterEvent(QEvent * e) void TransformationGUI_MirrorDlg::enterEvent( QEvent* )
{ {
if(!GroupConstructors->isEnabled()) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -332,7 +313,7 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MirrorDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool TransformationGUI_MirrorDlg::isValid( QString& msg ) bool TransformationGUI_MirrorDlg::isValid( QString& /*msg*/ )
{ {
return !( myObjects.length() == 0 || myArgument->_is_nil() ); return !( myObjects.length() == 0 || myArgument->_is_nil() );
} }
@ -349,62 +330,61 @@ bool TransformationGUI_MirrorDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() ) {
{
case 0: case 0:
{ {
if (toCreateCopy) if ( toCreateCopy ) {
for (int i = 0; i < myObjects.length(); i++) for ( int i = 0; i < myObjects.length(); i++ ) {
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPointCopy( myObjects[i], myArgument ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPointCopy( myObjects[i], myArgument );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
else }
for (int i = 0; i < myObjects.length(); i++) else {
{ for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPoint( myObjects[i], myArgument ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPoint( myObjects[i], myArgument );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
}
res = true; res = true;
break; break;
} }
case 1: case 1:
{ {
if (toCreateCopy) if ( toCreateCopy ) {
for (int i = 0; i < myObjects.length(); i++) for ( int i = 0; i < myObjects.length(); i++ ) {
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorAxisCopy( myObjects[i], myArgument ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorAxisCopy( myObjects[i], myArgument );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
else }
for (int i = 0; i < myObjects.length(); i++) else {
{ for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorAxis( myObjects[i], myArgument ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorAxis( myObjects[i], myArgument );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
}
res = true; res = true;
break; break;
} }
case 2: case 2:
{ {
if (toCreateCopy) if ( toCreateCopy ) {
for (int i = 0; i < myObjects.length(); i++) for ( int i = 0; i < myObjects.length(); i++ ) {
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlaneCopy( myObjects[i], myArgument ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlaneCopy( myObjects[i], myArgument );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
else }
for (int i = 0; i < myObjects.length(); i++) else {
{ for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlane( myObjects[i], myArgument ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlane( myObjects[i], myArgument );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
}
res = true; res = true;
break; break;
} }
@ -429,5 +409,5 @@ void TransformationGUI_MirrorDlg::closeEvent( QCloseEvent* e )
//================================================================================= //=================================================================================
void TransformationGUI_MirrorDlg::CreateCopyModeChanged( bool isCreateCopy ) void TransformationGUI_MirrorDlg::CreateCopyModeChanged( bool isCreateCopy )
{ {
this->GroupBoxName->setEnabled(isCreateCopy); mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
} }

View File

@ -19,16 +19,14 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : TransformationGUI_MirrorDlg.h // File : TransformationGUI_MirrorDlg.h
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_MIRROR_H #ifndef TRANSFORMATIONGUI_MIRRORDLG_H
#define DIALOGBOX_MIRROR_H #define TRANSFORMATIONGUI_MIRRORDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class DlgRef_2Sel1Spin2Check; class DlgRef_2Sel1Spin2Check;
@ -41,22 +39,23 @@ class TransformationGUI_MirrorDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
TransformationGUI_MirrorDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, TransformationGUI_MirrorDlg( GeometryGUI*, QWidget* = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_MirrorDlg(); ~TransformationGUI_MirrorDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e ); virtual void closeEvent( QCloseEvent* );
private: private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent( QEvent* );
private:
GEOM::GEOM_Object_var myArgument; GEOM::GEOM_Object_var myArgument;
GEOM::ListOfGO myObjects; GEOM::ListOfGO myObjects;
@ -69,8 +68,8 @@ private slots :
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ConstructorsClicked(int constructorId); void ConstructorsClicked( int );
void CreateCopyModeChanged(bool isCreateCopy); void CreateCopyModeChanged( bool );
}; };
#endif // DIALOGBOX_MIRROR_H #endif // TRANSFORMATIONGUI_MIRRORDLG_H

View File

@ -19,29 +19,22 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : TransformationGUI_MultiRotationDlg.cxx // File : TransformationGUI_MultiRotationDlg.cxx
// Author : Damien COQUERET // Author : Damien COQUERET, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "TransformationGUI_MultiRotationDlg.h" #include "TransformationGUI_MultiRotationDlg.h"
#include "DlgRef_2Sel4Spin1Check.h"
#include "DlgRef_2Sel1Spin.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h" #include <GEOM_DlgRef.h>
#include "GEOMBase.h" #include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h" #include <SUIT_ResourceMgr.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
#include "GEOMImpl_Types.hxx" #include <GEOMImpl_Types.hxx>
using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_MultiRotationDlg() // class : TransformationGUI_MultiRotationDlg()
@ -51,8 +44,8 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg
(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) ( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{ {
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_MULTIROTATION_SIMPLE" ) ) ); QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_MULTIROTATION_SIMPLE" ) ) );
@ -62,13 +55,13 @@ TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg
setWindowTitle( tr( "GEOM_MULTIROTATION_TITLE" ) ); setWindowTitle( tr( "GEOM_MULTIROTATION_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_MULTIROTATION")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_MULTIROTATION" ) );
RadioButton1->setIcon(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setIcon(image1); mainFrame()->RadioButton2->setIcon( image1 );
RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close(); mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_2Sel1Spin(this, "GroupPoints"); GroupPoints = new DlgRef_2Sel1Spin( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_MULTIROTATION_SIMPLE" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_MULTIROTATION_SIMPLE" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) );
@ -78,7 +71,7 @@ TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true );
GroupDimensions = new DlgRef_2Sel4Spin1Check(this, "GroupDimensions"); GroupDimensions = new DlgRef_2Sel4Spin1Check( centralWidget() );
GroupDimensions->GroupBox1->setTitle( tr( "GEOM_MULTIROTATION_DOUBLE" ) ); GroupDimensions->GroupBox1->setTitle( tr( "GEOM_MULTIROTATION_DOUBLE" ) );
GroupDimensions->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) ); GroupDimensions->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
GroupDimensions->TextLabel2->setText( tr( "GEOM_VECTOR" ) ); GroupDimensions->TextLabel2->setText( tr( "GEOM_VECTOR" ) );
@ -92,8 +85,10 @@ TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg
GroupDimensions->LineEdit1->setReadOnly( true ); GroupDimensions->LineEdit1->setReadOnly( true );
GroupDimensions->LineEdit2->setReadOnly( true ); GroupDimensions->LineEdit2->setReadOnly( true );
gridLayout1->addWidget(GroupPoints, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
gridLayout1->addWidget(GroupDimensions, 2, 0); layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
layout->addWidget( GroupDimensions );
/***************************************************************/ /***************************************************************/
setHelpFileName( "multi_rotation.htm" ); setHelpFileName( "multi_rotation.htm" );
@ -125,22 +120,23 @@ void TransformationGUI_MultiRotationDlg::Init()
double SpecificStep1 = 5; double SpecificStep1 = 5;
double SpecificStep2 = 1; double SpecificStep2 = 1;
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3); initSpinBox( GroupPoints->SpinBox_DX, 1.0, MAX_NUMBER, SpecificStep2, 3 );
GroupPoints->SpinBox_DX->SetValue(myNbTimes1); GroupPoints->SpinBox_DX->setValue( myNbTimes1 );
GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep1, 3); initSpinBox( GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, 3 );
GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3); initSpinBox( GroupDimensions->SpinBox_DY1, 1.0, MAX_NUMBER, SpecificStep2, 3 );
GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); initSpinBox( GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, 3 );
GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3); initSpinBox( GroupDimensions->SpinBox_DY2, 1.0, MAX_NUMBER, SpecificStep2, 3 );
GroupDimensions->SpinBox_DX1->SetValue(myAng); GroupDimensions->SpinBox_DX1->setValue( myAng );
GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1); GroupDimensions->SpinBox_DY1->setValue( myNbTimes1 );
GroupDimensions->SpinBox_DX2->SetValue(myStep); GroupDimensions->SpinBox_DX2->setValue( myStep );
GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2); GroupDimensions->SpinBox_DY2->setValue( myNbTimes2 );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
@ -158,18 +154,21 @@ void TransformationGUI_MultiRotationDlg::Init()
connect( GroupDimensions->SpinBox_DX2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); connect( GroupDimensions->SpinBox_DX2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( GroupDimensions->SpinBox_DY2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); connect( 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 ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) );
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DX1, 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_DY1, SLOT( SetStep( double ) ) );
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DX2, 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( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DY2, SLOT( SetStep( double ) ) );
// <<-
connect( GroupDimensions->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseAngle() ) ); connect( GroupDimensions->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseAngle() ) );
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_MULTIROTATION" ).toLatin1().constData() ); initName( tr( "GEOM_MULTIROTATION" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -188,41 +187,42 @@ void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId)
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
switch (constructorId) switch ( constructorId ) {
{
case 0: /* Rotate simple */ case 0: /* Rotate simple */
{ {
GroupDimensions->hide(); GroupDimensions->hide();
resize(0, 0);
GroupPoints->show(); GroupPoints->show();
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText( "" ); GroupPoints->LineEdit1->setText( "" );
GroupPoints->LineEdit2->setText( "" ); GroupPoints->LineEdit2->setText( "" );
GroupPoints->SpinBox_DX->SetValue(myNbTimes1); GroupPoints->SpinBox_DX->setValue( myNbTimes1 );
break; break;
} }
case 1: /* Rotate double */ case 1: /* Rotate double */
{ {
GroupPoints->hide(); GroupPoints->hide();
resize(0, 0);
GroupDimensions->show(); GroupDimensions->show();
myEditCurrentArgument = GroupDimensions->LineEdit1; myEditCurrentArgument = GroupDimensions->LineEdit1;
GroupDimensions->LineEdit1->setText( "" ); GroupDimensions->LineEdit1->setText( "" );
GroupDimensions->LineEdit2->setText( "" ); GroupDimensions->LineEdit2->setText( "" );
GroupDimensions->SpinBox_DX1->SetValue(myAng); GroupDimensions->SpinBox_DX1->setValue( myAng );
GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1); GroupDimensions->SpinBox_DY1->setValue( myNbTimes1 );
GroupDimensions->SpinBox_DX2->SetValue(myStep); GroupDimensions->SpinBox_DX2->setValue( myStep );
GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2); GroupDimensions->SpinBox_DY2->setValue( myNbTimes2 );
break; break;
} }
} }
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
myBase = myVector = GEOM::GEOM_Object::_nil(); myBase = myVector = GEOM::GEOM_Object::_nil();
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
@ -333,8 +333,7 @@ void TransformationGUI_MultiRotationDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 || if ( send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 ||
send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2) send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 ) {
{
myEditCurrentArgument = send; myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -359,9 +358,9 @@ void TransformationGUI_MultiRotationDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_MultiRotationDlg::enterEvent(QEvent* e) void TransformationGUI_MultiRotationDlg::enterEvent( QEvent* )
{ {
if(!GroupConstructors->isEnabled()) if( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -398,9 +397,9 @@ void TransformationGUI_MultiRotationDlg::ReverseAngle()
int aConstructorId = getConstructorId(); int aConstructorId = getConstructorId();
if ( aConstructorId == 0 ) if ( aConstructorId == 0 )
GroupPoints->SpinBox_DX->SetValue(myAng); GroupPoints->SpinBox_DX->setValue( myAng );
else if ( aConstructorId == 1 ) else if ( aConstructorId == 1 )
GroupDimensions->SpinBox_DX1->SetValue(myAng); GroupDimensions->SpinBox_DX1->setValue( myAng );
displayPreview(); displayPreview();
} }
@ -420,7 +419,7 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool TransformationGUI_MultiRotationDlg::isValid( QString& msg ) bool TransformationGUI_MultiRotationDlg::isValid( QString& /*msg*/ )
{ {
return !( myBase->_is_nil() || myVector->_is_nil() ); return !( myBase->_is_nil() || myVector->_is_nil() );
} }
@ -435,28 +434,22 @@ bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() ) {
{
case 0 : case 0 :
{
if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) ) { if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
MultiRotate1D( myBase, myVector, myNbTimes1 ); MultiRotate1D( myBase, myVector, myNbTimes1 );
res = true; res = true;
} }
break; break;
}
case 1 : case 1 :
{ if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) ) {
if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) )
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
MultiRotate2D( myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2 ); MultiRotate2D( myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2 );
res = true; res = true;
} }
break; break;
} }
}
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );

View File

@ -19,16 +19,14 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : TransformationGUI_MultiRotationDlg.h // File : TransformationGUI_MultiRotationDlg.h
// Author : Damien COQUERET // Author : Damien COQUERET, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_MULTIROTATION_H #ifndef TRANSFORMATIONGUI_MULTIROTATIONDLG_H
#define DIALOGBOX_MULTIROTATION_H #define TRANSFORMATIONGUI_MULTIROTATIONDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class DlgRef_2Sel4Spin1Check; class DlgRef_2Sel4Spin1Check;
class DlgRef_2Sel1Spin; class DlgRef_2Sel1Spin;
@ -42,22 +40,23 @@ class TransformationGUI_MultiRotationDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
TransformationGUI_MultiRotationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, TransformationGUI_MultiRotationDlg( GeometryGUI*, QWidget* = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_MultiRotationDlg(); ~TransformationGUI_MultiRotationDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e ); virtual void closeEvent( QCloseEvent* );
private: private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent( QEvent* );
private:
GEOM::GEOM_Object_var myBase, myVector; GEOM::GEOM_Object_var myBase, myVector;
int myNbTimes1; int myNbTimes1;
int myNbTimes2; int myNbTimes2;
@ -75,8 +74,8 @@ private slots:
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ReverseAngle(); void ReverseAngle();
void ValueChangedInSpinBox(double newValue); void ValueChangedInSpinBox( double );
void ConstructorsClicked(int constructorId); void ConstructorsClicked( int );
}; };
#endif // DIALOGBOX_MULTIROTATION_H #endif // TRANSFORMATIONGUI_MULTIROTATIONDLG_H

View File

@ -19,29 +19,22 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : TransformationGUI_MultiTranslationDlg.cxx // File : TransformationGUI_MultiTranslationDlg.cxx
// Author : Damien COQUERET // Author : Damien COQUERET, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "TransformationGUI_MultiTranslationDlg.h" #include "TransformationGUI_MultiTranslationDlg.h"
#include "DlgRef_2Sel2Spin1Check.h"
#include "DlgRef_3Sel4Spin2Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h" #include <GEOM_DlgRef.h>
#include "GEOMBase.h" #include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h" #include <SUIT_ResourceMgr.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
#include "GEOMImpl_Types.hxx" #include <GEOMImpl_Types.hxx>
using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_MultiTranslationDlg() // class : TransformationGUI_MultiTranslationDlg()
@ -51,8 +44,8 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg
(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) ( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{ {
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_MULTITRANSLATION_SIMPLE" ) ) ); QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_MULTITRANSLATION_SIMPLE" ) ) );
@ -62,13 +55,13 @@ TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg
setWindowTitle( tr( "GEOM_MULTITRANSLATION_TITLE" ) ); setWindowTitle( tr( "GEOM_MULTITRANSLATION_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_MULTITRANSLATION")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_MULTITRANSLATION" ) );
RadioButton1->setIcon(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setIcon(image1); mainFrame()->RadioButton2->setIcon( image1 );
RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close(); mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_2Sel2Spin1Check(this, "GroupPoints"); GroupPoints = new DlgRef_2Sel2Spin1Check( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_MULTITRANSLATION_SIMPLE" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_MULTITRANSLATION_SIMPLE" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR_U" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR_U" ) );
@ -80,7 +73,7 @@ TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true );
GroupDimensions = new DlgRef_3Sel4Spin2Check(this, "GroupDimensions"); GroupDimensions = new DlgRef_3Sel4Spin2Check( centralWidget() );
GroupDimensions->GroupBox1->setTitle( tr( "GEOM_MULTITRANSLATION_DOUBLE" ) ); GroupDimensions->GroupBox1->setTitle( tr( "GEOM_MULTITRANSLATION_DOUBLE" ) );
GroupDimensions->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) ); GroupDimensions->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
GroupDimensions->TextLabel2->setText( tr( "GEOM_VECTOR_U" ) ); GroupDimensions->TextLabel2->setText( tr( "GEOM_VECTOR_U" ) );
@ -98,8 +91,10 @@ TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg
GroupDimensions->LineEdit2->setReadOnly( true ); GroupDimensions->LineEdit2->setReadOnly( true );
GroupDimensions->LineEdit3->setReadOnly( true ); GroupDimensions->LineEdit3->setReadOnly( true );
gridLayout1->addWidget(GroupPoints, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
gridLayout1->addWidget(GroupDimensions, 2, 0); layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
layout->addWidget( GroupDimensions );
/***************************************************************/ /***************************************************************/
setHelpFileName( "multi_translation.htm" ); setHelpFileName( "multi_translation.htm" );
@ -130,24 +125,25 @@ void TransformationGUI_MultiTranslationDlg::Init()
double SpecificStep = 1; double SpecificStep = 1;
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 );
GroupPoints->SpinBox_DY->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); initSpinBox( GroupPoints->SpinBox_DY, 1.0, MAX_NUMBER, SpecificStep, 3 );
GroupPoints->SpinBox_DX->SetValue(myStepU); GroupPoints->SpinBox_DX->setValue( myStepU );
GroupPoints->SpinBox_DY->SetValue(myNbTimesU); GroupPoints->SpinBox_DY->setValue( myNbTimesU );
GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); initSpinBox( GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, step, 3 );
GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); initSpinBox( GroupDimensions->SpinBox_DY1, 1.0, MAX_NUMBER, SpecificStep, 3 );
GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); initSpinBox( GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, 3 );
GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); initSpinBox( GroupDimensions->SpinBox_DY2, 1.0, MAX_NUMBER, SpecificStep, 3 );
GroupDimensions->SpinBox_DX1->SetValue(myStepU); GroupDimensions->SpinBox_DX1->setValue( myStepU );
GroupDimensions->SpinBox_DY1->SetValue(myNbTimesU); GroupDimensions->SpinBox_DY1->setValue( myNbTimesU );
GroupDimensions->SpinBox_DX2->SetValue(myStepV); GroupDimensions->SpinBox_DX2->setValue( myStepV );
GroupDimensions->SpinBox_DY2->SetValue(myNbTimesV); GroupDimensions->SpinBox_DY2->setValue( myNbTimesV );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
@ -168,12 +164,14 @@ void TransformationGUI_MultiTranslationDlg::Init()
connect( GroupDimensions->SpinBox_DX2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); connect( GroupDimensions->SpinBox_DX2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( GroupDimensions->SpinBox_DY2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); connect( 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 ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) );
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DY, SLOT( SetStep( double ) ) ); connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DY, SLOT( SetStep( double ) ) );
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DX1, 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_DY1, SLOT( SetStep( double ) ) );
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DX2, 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( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DY2, SLOT( SetStep( double ) ) );
// <<-
connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseStepU() ) ); connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseStepU() ) );
connect( GroupDimensions->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseStepU() ) ); connect( GroupDimensions->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseStepU() ) );
@ -183,7 +181,8 @@ void TransformationGUI_MultiTranslationDlg::Init()
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_MULTITRANSLATION" ).toLatin1().constData() ); initName( tr( "GEOM_MULTITRANSLATION" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -201,27 +200,24 @@ void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorI
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
switch (constructorId) switch ( constructorId ) {
{
case 0: /* Translate simple */ case 0: /* Translate simple */
{ {
GroupDimensions->hide(); GroupDimensions->hide();
resize(0, 0);
GroupPoints->show(); GroupPoints->show();
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText( "" ); GroupPoints->LineEdit1->setText( "" );
GroupPoints->LineEdit2->setText( "" ); GroupPoints->LineEdit2->setText( "" );
GroupPoints->SpinBox_DX->SetValue(myStepU); GroupPoints->SpinBox_DX->setValue( myStepU );
GroupPoints->SpinBox_DY->SetValue(myNbTimesU); GroupPoints->SpinBox_DY->setValue( myNbTimesU );
break; break;
} }
case 1: /* Translate double */ case 1: /* Translate double */
{ {
GroupPoints->hide(); GroupPoints->hide();
resize(0, 0);
GroupDimensions->show(); GroupDimensions->show();
myEditCurrentArgument = GroupDimensions->LineEdit1; myEditCurrentArgument = GroupDimensions->LineEdit1;
@ -229,16 +225,20 @@ void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorI
GroupDimensions->LineEdit2->setText( "" ); GroupDimensions->LineEdit2->setText( "" );
GroupDimensions->LineEdit3->setText( "" ); GroupDimensions->LineEdit3->setText( "" );
GroupDimensions->SpinBox_DX1->SetValue(myStepU); GroupDimensions->SpinBox_DX1->setValue( myStepU );
GroupDimensions->SpinBox_DY1->SetValue(myNbTimesU); GroupDimensions->SpinBox_DY1->setValue( myNbTimesU );
GroupDimensions->SpinBox_DX2->SetValue(myStepV); GroupDimensions->SpinBox_DX2->setValue( myStepV );
GroupDimensions->SpinBox_DY2->SetValue(myNbTimesV); GroupDimensions->SpinBox_DY2->setValue( myNbTimesV );
myVectorV = GEOM::GEOM_Object::_nil(); myVectorV = GEOM::GEOM_Object::_nil();
break; break;
} }
} }
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
myBase = myVectorU = GEOM::GEOM_Object::_nil(); myBase = myVectorU = GEOM::GEOM_Object::_nil();
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
@ -281,9 +281,11 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
if ( IObjectCount() != 1 ) { if ( IObjectCount() != 1 ) {
if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) if ( myEditCurrentArgument == GroupPoints->LineEdit1 ||
myEditCurrentArgument == GroupDimensions->LineEdit1 )
myBase = GEOM::GEOM_Object::_nil(); myBase = GEOM::GEOM_Object::_nil();
else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
myEditCurrentArgument == GroupDimensions->LineEdit2 )
myVectorU = GEOM::GEOM_Object::_nil(); myVectorU = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == GroupDimensions->LineEdit3 ) else if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
myVectorV = GEOM::GEOM_Object::_nil(); myVectorV = GEOM::GEOM_Object::_nil();
@ -297,9 +299,11 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) ) if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) )
return; return;
if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) if ( myEditCurrentArgument == GroupPoints->LineEdit1 ||
myEditCurrentArgument == GroupDimensions->LineEdit1 )
myBase = aSelectedObject; myBase = aSelectedObject;
else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
myEditCurrentArgument == GroupDimensions->LineEdit2 )
myVectorU = aSelectedObject; myVectorU = aSelectedObject;
else if ( myEditCurrentArgument == GroupDimensions->LineEdit3 ) else if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
myVectorV = aSelectedObject; myVectorV = aSelectedObject;
@ -354,8 +358,7 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed()
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 || if ( send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 ||
send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 || send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 ||
send == GroupDimensions->LineEdit3) send == GroupDimensions->LineEdit3 ) {
{
myEditCurrentArgument = send; myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -380,9 +383,9 @@ void TransformationGUI_MultiTranslationDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_MultiTranslationDlg::enterEvent(QEvent* e) void TransformationGUI_MultiTranslationDlg::enterEvent( QEvent* )
{ {
if(!GroupConstructors->isEnabled()) if( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -395,18 +398,14 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox(double newValu
{ {
QObject* send = (QObject*)sender(); QObject* send = (QObject*)sender();
switch(getConstructorId()) switch ( getConstructorId() ) {
{
case 0: case 0:
{
if ( send == GroupPoints->SpinBox_DX ) if ( send == GroupPoints->SpinBox_DX )
myStepU = newValue; myStepU = newValue;
else if ( send == GroupPoints->SpinBox_DY ) else if ( send == GroupPoints->SpinBox_DY )
myNbTimesU = (int)newValue; myNbTimesU = (int)newValue;
break; break;
}
case 1 : case 1 :
{
if ( send == GroupDimensions->SpinBox_DX1 ) if ( send == GroupDimensions->SpinBox_DX1 )
myStepU = newValue; myStepU = newValue;
else if ( send == GroupDimensions->SpinBox_DY1) else if ( send == GroupDimensions->SpinBox_DY1)
@ -417,7 +416,6 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox(double newValu
myNbTimesV = (int)newValue; myNbTimesV = (int)newValue;
break; break;
} }
}
displayPreview(); displayPreview();
} }
@ -434,9 +432,9 @@ void TransformationGUI_MultiTranslationDlg::ReverseStepU()
int aConstructorId = getConstructorId(); int aConstructorId = getConstructorId();
if ( aConstructorId == 0 ) if ( aConstructorId == 0 )
GroupPoints->SpinBox_DX->SetValue(myStepU); GroupPoints->SpinBox_DX->setValue( myStepU );
else if ( aConstructorId == 1 ) else if ( aConstructorId == 1 )
GroupDimensions->SpinBox_DX1->SetValue(myStepU); GroupDimensions->SpinBox_DX1->setValue( myStepU );
displayPreview(); displayPreview();
} }
@ -450,7 +448,7 @@ void TransformationGUI_MultiTranslationDlg::ReverseStepV()
{ {
myStepV = -myStepV; myStepV = -myStepV;
GroupDimensions->SpinBox_DX2->SetValue(myStepV); GroupDimensions->SpinBox_DX2->setValue( myStepV );
displayPreview(); displayPreview();
} }
@ -470,7 +468,7 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperatio
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool TransformationGUI_MultiTranslationDlg::isValid( QString& msg ) bool TransformationGUI_MultiTranslationDlg::isValid( QString& /*msg*/ )
{ {
int aConstructorId = getConstructorId(); int aConstructorId = getConstructorId();
@ -491,27 +489,22 @@ bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() ) {
{
case 0 : case 0 :
{
if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVectorU ) ) { if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVectorU ) ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate1D( myBase, myVectorU, myStepU, myNbTimesU ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate1D( myBase, myVectorU, myStepU, myNbTimesU );
res = true; res = true;
} }
break; break;
}
case 1 : case 1 :
{ if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVectorU ) &&
if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVectorU ) && !CORBA::is_nil( myVectorV ) ) !CORBA::is_nil( myVectorV ) ) {
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate2D( myBase, myVectorU, myStepU, myNbTimesU, anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate2D( myBase, myVectorU, myStepU, myNbTimesU,
myVectorV, myStepV, myNbTimesV ); myVectorV, myStepV, myNbTimesV );
res = true; res = true;
} }
break; break;
} }
}
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );

View File

@ -19,16 +19,14 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : TransformationGUI_MultiTranslationDlg.h // File : TransformationGUI_MultiTranslationDlg.h
// Author : Damien COQUERET // Author : Damien COQUERET, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_MULTITRANSLATION_H #ifndef TRANSFORMATIONGUI_MULTITRANSLATIONDLG_H
#define DIALOGBOX_MULTITRANSLATION_H #define TRANSFORMATIONGUI_MULTITRANSLATIONDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class DlgRef_2Sel2Spin1Check; class DlgRef_2Sel2Spin1Check;
class DlgRef_3Sel4Spin2Check; class DlgRef_3Sel4Spin2Check;
@ -42,22 +40,23 @@ class TransformationGUI_MultiTranslationDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
TransformationGUI_MultiTranslationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, TransformationGUI_MultiTranslationDlg( GeometryGUI*, QWidget* = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_MultiTranslationDlg(); ~TransformationGUI_MultiTranslationDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e ); virtual void closeEvent( QCloseEvent* );
private: private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent( QEvent* );
private:
GEOM::GEOM_Object_var myBase, myVectorU, myVectorV; GEOM::GEOM_Object_var myBase, myVectorU, myVectorV;
int myNbTimesU; int myNbTimesU;
int myNbTimesV; int myNbTimesV;
@ -76,8 +75,8 @@ private slots:
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ReverseStepU(); void ReverseStepU();
void ReverseStepV(); void ReverseStepV();
void ValueChangedInSpinBox(double newValue); void ValueChangedInSpinBox( double );
void ConstructorsClicked(int constructorId); void ConstructorsClicked( int );
}; };
#endif // DIALOGBOX_MULTITRANSLATION_H #endif // TRANSFORMATIONGUI_MULTITRANSLATIONDLG_H

View File

@ -19,26 +19,20 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : TransformationGUI_OffsetDlg.cxx // File : TransformationGUI_OffsetDlg.cxx
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "TransformationGUI_OffsetDlg.h" #include "TransformationGUI_OffsetDlg.h"
#include "DlgRef_1Sel1Spin1Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h" #include <GEOM_DlgRef.h>
#include "GEOMBase.h" #include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h" #include <SUIT_ResourceMgr.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_OffsetDlg() // class : TransformationGUI_OffsetDlg()
@ -48,8 +42,8 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg( GeometryGUI* theGeometryGUI, QWidget* parent, TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, Qt::WindowFlags fl) bool modal, Qt::WindowFlags fl )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{ {
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_OFFSET" ) ) ); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_OFFSET" ) ) );
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
@ -57,14 +51,14 @@ TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg(GeometryGUI* theGeometr
setWindowTitle( tr( "GEOM_OFFSET_TITLE" ) ); setWindowTitle( tr( "GEOM_OFFSET_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_OFFSET")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_OFFSET" ) );
RadioButton1->setIcon(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
RadioButton2->close(); mainFrame()->RadioButton2->close();
RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close(); mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_1Sel1Spin1Check(this, "GroupPoints"); GroupPoints = new DlgRef_1Sel1Spin1Check( centralWidget() );
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->TextLabel2->setText( tr( "GEOM_OFFSET" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_OFFSET" ) );
@ -75,7 +69,9 @@ TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg(GeometryGUI* theGeometr
GroupPoints->PushButton1->setIcon( image1 ); GroupPoints->PushButton1->setIcon( image1 );
gridLayout1->addWidget(GroupPoints, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
/***************************************************************/ /***************************************************************/
@ -109,18 +105,18 @@ void TransformationGUI_OffsetDlg::Init()
double step = 1; double step = 1;
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 );
GroupPoints->SpinBox_DX->setDecimals( 5 ); GroupPoints->SpinBox_DX->setDecimals( 5 );
//@ GroupPoints->SpinBox_DX->setDblPrecision(1e-05); //@ GroupPoints->SpinBox_DX->setDblPrecision(1e-05);
GroupPoints->SpinBox_DX->SetValue(1e-05); GroupPoints->SpinBox_DX->setValue( 1e-05 );
// Activate Create a Copy mode // Activate Create a Copy mode
GroupPoints->CheckButton1->setChecked( true ); GroupPoints->CheckButton1->setChecked( true );
CreateCopyModeChanged( true ); CreateCopyModeChanged( true );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
@ -129,7 +125,7 @@ void TransformationGUI_OffsetDlg::Init()
connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) ); connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) );
initName( tr( "GEOM_OFFSET" ).toLatin1().constData() ); initName( tr( "GEOM_OFFSET" ) );
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
@ -171,8 +167,7 @@ void TransformationGUI_OffsetDlg::SelectionIntoArgument()
QString aName; QString aName;
int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName ); int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName );
if(aNbSel < 1) if ( aNbSel < 1 ) {
{
myObjects.length( 0 ); myObjects.length( 0 );
return; return;
} }
@ -195,8 +190,7 @@ void TransformationGUI_OffsetDlg::SelectionIntoArgument()
void TransformationGUI_OffsetDlg::LineEditReturnPressed() void TransformationGUI_OffsetDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 ) if ( send == GroupPoints->LineEdit1 ) {
{
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -211,8 +205,7 @@ void TransformationGUI_OffsetDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) if ( send == GroupPoints->PushButton1 ) {
{
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
SelectionIntoArgument(); SelectionIntoArgument();
@ -224,9 +217,9 @@ void TransformationGUI_OffsetDlg::SetEditCurrentArgument()
// function : enterEvent() // function : enterEvent()
// purpose : when mouse enter onto the QWidget // purpose : when mouse enter onto the QWidget
//================================================================================= //=================================================================================
void TransformationGUI_OffsetDlg::enterEvent(QEvent * e) void TransformationGUI_OffsetDlg::enterEvent( QEvent* )
{ {
if ( !GroupConstructors->isEnabled() ) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -274,8 +267,7 @@ bool TransformationGUI_OffsetDlg::isValid( QString& msg )
//return !(myObjects.length() == 0); //return !(myObjects.length() == 0);
if ( myObjects.length() == 0 ) return false; if ( myObjects.length() == 0 ) return false;
for (int i = 0; i < myObjects.length(); i++) for ( int i = 0; i < myObjects.length(); i++ ) {
{
GEOM::shape_type aType = myObjects[i]->GetShapeType(); GEOM::shape_type aType = myObjects[i]->GetShapeType();
if ( aType != GEOM::FACE && aType != GEOM::SHELL && aType != GEOM::SOLID ) { if ( aType != GEOM::FACE && aType != GEOM::SHELL && aType != GEOM::SOLID ) {
msg = tr( "ERROR_SHAPE_TYPE" ); msg = tr( "ERROR_SHAPE_TYPE" );
@ -296,23 +288,21 @@ bool TransformationGUI_OffsetDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
if ( GroupPoints->CheckButton1->isChecked() || IsPreview() ) {
if (GroupPoints->CheckButton1->isChecked() || IsPreview()) for ( int i = 0; i < myObjects.length(); i++ ) {
for (int i = 0; i < myObjects.length(); i++)
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
else }
for (int i = 0; i < myObjects.length(); i++) else {
{ for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShape( myObjects[i], GetOffset() ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShape( myObjects[i], GetOffset() );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
}
res = true; res = true;
return res; return res;
@ -335,7 +325,7 @@ void TransformationGUI_OffsetDlg::closeEvent( QCloseEvent* e )
//================================================================================= //=================================================================================
double TransformationGUI_OffsetDlg::GetOffset() const double TransformationGUI_OffsetDlg::GetOffset() const
{ {
return GroupPoints->SpinBox_DX->GetValue(); return GroupPoints->SpinBox_DX->value();
} }
@ -345,5 +335,5 @@ double TransformationGUI_OffsetDlg::GetOffset() const
//================================================================================= //=================================================================================
void TransformationGUI_OffsetDlg::CreateCopyModeChanged( bool isCreateCopy ) void TransformationGUI_OffsetDlg::CreateCopyModeChanged( bool isCreateCopy )
{ {
this->GroupBoxName->setEnabled(isCreateCopy); mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
} }

View File

@ -19,16 +19,14 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : TransformationGUI_OffsetDlg.h // File : TransformationGUI_OffsetDlg.h
// Author : Michael Zorin // Author : Michael ZORIN, Open CASCADE S.A.S. (mikhail.zorin@opencascade.com)
// Module : GEOM //
#ifndef DIALOGBOX_OFFSET_H #ifndef TRANSFORMATIONGUI_OFFSETDLG_H
#define DIALOGBOX_OFFSET_H #define TRANSFORMATIONGUI_OFFSETDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class DlgRef_1Sel1Spin1Check; class DlgRef_1Sel1Spin1Check;
@ -41,23 +39,24 @@ class TransformationGUI_OffsetDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
TransformationGUI_OffsetDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, TransformationGUI_OffsetDlg( GeometryGUI*, QWidget* = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_OffsetDlg(); ~TransformationGUI_OffsetDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e ); virtual void closeEvent( QCloseEvent* );
private: private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent( QEvent* );
double GetOffset() const; double GetOffset() const;
private:
GEOM::ListOfGO myObjects; GEOM::ListOfGO myObjects;
DlgRef_1Sel1Spin1Check* GroupPoints; DlgRef_1Sel1Spin1Check* GroupPoints;
@ -70,7 +69,7 @@ private slots:
void LineEditReturnPressed(); void LineEditReturnPressed();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ValueChangedInSpinBox(); void ValueChangedInSpinBox();
void CreateCopyModeChanged(bool isCreateCopy); void CreateCopyModeChanged( bool );
}; };
#endif // DIALOGBOX_OFFSET_H #endif // TRANSFORMATIONGUI_OFFSETDLG_H

View File

@ -19,30 +19,24 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : TransformationGUI_PositionDlg.cxx // File : TransformationGUI_PositionDlg.cxx
// Author : Damien COQUERET // Author : Damien COQUERET, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "TransformationGUI_PositionDlg.h" #include "TransformationGUI_PositionDlg.h"
#include "DlgRef_3Sel3Spin1Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h" #include <GEOM_DlgRef.h>
#include "GEOMBase.h" #include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h" #include <SUIT_ResourceMgr.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
#include "TColStd_MapOfInteger.hxx" #include <TColStd_MapOfInteger.hxx>
#include "GEOMImpl_Types.hxx" #include <GEOMImpl_Types.hxx>
using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_PositionDlg() // class : TransformationGUI_PositionDlg()
@ -52,8 +46,8 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
TransformationGUI_PositionDlg::TransformationGUI_PositionDlg TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) ( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
: GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{ {
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_POSITION" ) ) ); QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_POSITION" ) ) );
@ -63,13 +57,13 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
setWindowTitle( tr( "GEOM_POSITION_TITLE" ) ); setWindowTitle( tr( "GEOM_POSITION_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_POSITION")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_POSITION" ) );
RadioButton1->setIcon(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setIcon(image1); mainFrame()->RadioButton2->setIcon( image1 );
RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close(); mainFrame()->RadioButton3->close();
Group1 = new DlgRef_3Sel3Spin1Check(this, "Group1"); Group1 = new DlgRef_3Sel3Spin1Check( centralWidget() );
Group1->SpinBox1->hide(); Group1->SpinBox1->hide();
Group1->SpinBox2->hide(); Group1->SpinBox2->hide();
Group1->SpinBox3->hide(); Group1->SpinBox3->hide();
@ -85,7 +79,9 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
Group1->PushButton3->setIcon( imageselect ); Group1->PushButton3->setIcon( imageselect );
Group1->CheckBox1->setText( tr( "GEOM_CREATE_COPY" ) ); Group1->CheckBox1->setText( tr( "GEOM_CREATE_COPY" ) );
gridLayout1->addWidget(Group1, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( Group1 );
/***************************************************************/ /***************************************************************/
@ -124,9 +120,10 @@ void TransformationGUI_PositionDlg::Init()
CreateCopyModeChanged( true ); CreateCopyModeChanged( true );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect( Group1->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( Group1->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( Group1->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( Group1->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
@ -141,7 +138,8 @@ void TransformationGUI_PositionDlg::Init()
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_POSITION" ).toLatin1().constData() ); initName( tr( "GEOM_POSITION" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -162,23 +160,23 @@ void TransformationGUI_PositionDlg::ConstructorsClicked(int constructorId)
myStartLCS = GEOM::GEOM_Object::_nil(); myStartLCS = GEOM::GEOM_Object::_nil();
myEndLCS = GEOM::GEOM_Object::_nil(); myEndLCS = GEOM::GEOM_Object::_nil();
switch (constructorId) switch ( constructorId ) {
{
case 0: case 0:
{
Group1->LineEdit2->hide(); Group1->LineEdit2->hide();
Group1->TextLabel2->hide(); Group1->TextLabel2->hide();
Group1->PushButton2->hide(); Group1->PushButton2->hide();
break; break;
}
case 1: case 1:
{
Group1->LineEdit2->show(); Group1->LineEdit2->show();
Group1->TextLabel2->show(); Group1->TextLabel2->show();
Group1->PushButton2->show(); Group1->PushButton2->show();
break; break;
} }
}
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT(SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT(SelectionIntoArgument() ) );
SelectionIntoArgument(); SelectionIntoArgument();
@ -276,7 +274,8 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
void TransformationGUI_PositionDlg::LineEditReturnPressed() void TransformationGUI_PositionDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if(send == Group1->LineEdit1 || send == Group1->LineEdit2 || send == Group1->LineEdit3) { if ( send == Group1->LineEdit1 || send == Group1->LineEdit2 ||
send == Group1->LineEdit3 ) {
myEditCurrentArgument = send; myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -332,9 +331,9 @@ void TransformationGUI_PositionDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : when mouse enter onto the QWidget // purpose : when mouse enter onto the QWidget
//================================================================================= //=================================================================================
void TransformationGUI_PositionDlg::enterEvent(QEvent * e) void TransformationGUI_PositionDlg::enterEvent( QEvent* )
{ {
if(!GroupConstructors->isEnabled()) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -353,7 +352,7 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_PositionDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool TransformationGUI_PositionDlg::isValid( QString& msg ) bool TransformationGUI_PositionDlg::isValid( QString& /*msg*/ )
{ {
bool res; bool res;
if ( getConstructorId() == 0 ) if ( getConstructorId() == 0 )
@ -375,8 +374,7 @@ bool TransformationGUI_PositionDlg::execute( ObjectList& objects )
bool toCreateCopy = IsPreview() || Group1->CheckBox1->isChecked(); bool toCreateCopy = IsPreview() || Group1->CheckBox1->isChecked();
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() ) {
{
case 0: case 0:
{ {
for ( int i = 0; i < myObjects.length(); i++ ) { for ( int i = 0; i < myObjects.length(); i++ ) {
@ -425,5 +423,5 @@ void TransformationGUI_PositionDlg::closeEvent( QCloseEvent* e )
//================================================================================= //=================================================================================
void TransformationGUI_PositionDlg::CreateCopyModeChanged( bool isCreateCopy ) void TransformationGUI_PositionDlg::CreateCopyModeChanged( bool isCreateCopy )
{ {
this->GroupBoxName->setEnabled(isCreateCopy); mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
} }

View File

@ -19,16 +19,14 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : TransformationGUI_PositionDlg.h // File : TransformationGUI_PositionDlg.h
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_POSITION_H #ifndef TRANSFORMATIONGUI_POSITIONDLG_H
#define DIALOGBOX_POSITION_H #define TRANSFORMATIONGUI_POSITIONDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class DlgRef_3Sel3Spin1Check; class DlgRef_3Sel3Spin1Check;
@ -41,22 +39,23 @@ class TransformationGUI_PositionDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
TransformationGUI_PositionDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, TransformationGUI_PositionDlg( GeometryGUI*, QWidget* = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_PositionDlg(); ~TransformationGUI_PositionDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e ); virtual void closeEvent( QCloseEvent* );
private: private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent( QEvent* );
private:
GEOM::GEOM_Object_var myStartLCS; GEOM::GEOM_Object_var myStartLCS;
GEOM::GEOM_Object_var myEndLCS; GEOM::GEOM_Object_var myEndLCS;
GEOM::ListOfGO myObjects; GEOM::ListOfGO myObjects;
@ -70,8 +69,8 @@ private slots:
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ConstructorsClicked(int constructorId); void ConstructorsClicked( int );
void CreateCopyModeChanged(bool isCreateCopy); void CreateCopyModeChanged( bool );
}; };
#endif // DIALOGBOX_MIRROR_H #endif // TRANSFORMATIONGUI_POSITIONDLG_H

View File

@ -19,28 +19,22 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : TransformationGUI_RotationDlg.cxx // File : TransformationGUI_RotationDlg.cxx
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "TransformationGUI_RotationDlg.h" #include "TransformationGUI_RotationDlg.h"
#include "DlgRef_4Sel1Spin2Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h" #include <GEOM_DlgRef.h>
#include "GEOMBase.h" #include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h" #include <SUIT_ResourceMgr.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
#include "GEOMImpl_Types.hxx" #include <GEOMImpl_Types.hxx>
using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_RotationDlg() // class : TransformationGUI_RotationDlg()
@ -50,8 +44,8 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
TransformationGUI_RotationDlg::TransformationGUI_RotationDlg TransformationGUI_RotationDlg::TransformationGUI_RotationDlg
(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) ( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{ {
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ROTATION" ) ) ); QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ROTATION" ) ) );
@ -61,19 +55,19 @@ TransformationGUI_RotationDlg::TransformationGUI_RotationDlg
setWindowTitle( tr( "GEOM_ROTATION_TITLE" ) ); setWindowTitle( tr( "GEOM_ROTATION_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_ROTATION")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_ROTATION" ) );
RadioButton1->setIcon(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setIcon(image2); mainFrame()->RadioButton2->setIcon( image2 );
RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close(); mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_4Sel1Spin2Check(this, "GroupPoints"); GroupPoints = new DlgRef_4Sel1Spin2Check( centralWidget() );
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->TextLabel2->setText( tr( "GEOM_AXIS" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_AXIS" ) );
GroupPoints->TextLabel3->setText( tr( "GEOM_ANGLE" ) ); GroupPoints->TextLabel3->setText( tr( "GEOM_ANGLE" ) );
GroupPoints->TextLabel4->setText(tr("GEOM_POINT_I").arg("1")); GroupPoints->TextLabel4->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
GroupPoints->TextLabel5->setText(tr("GEOM_POINT_I").arg("2")); GroupPoints->TextLabel5->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true );
@ -86,22 +80,26 @@ TransformationGUI_RotationDlg::TransformationGUI_RotationDlg
GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) ); GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) );
GroupPoints->CheckButton2->setText( tr( "GEOM_REVERSE" ) ); GroupPoints->CheckButton2->setText( tr( "GEOM_REVERSE" ) );
gridLayout1->addWidget(GroupPoints, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
/***************************************************************/ /***************************************************************/
double anAngle = 0; double anAngle = 0;
double SpecificStep = 5; double SpecificStep = 5;
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, 3); initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, 3 );
GroupPoints->SpinBox_DX->SetValue(anAngle); GroupPoints->SpinBox_DX->setValue( anAngle );
// Activate Create a Copy mode // Activate Create a Copy mode
GroupPoints->CheckButton1->setChecked( true ); GroupPoints->CheckButton1->setChecked( true );
CreateCopyModeChanged( true ); CreateCopyModeChanged( true );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
@ -146,7 +144,7 @@ void TransformationGUI_RotationDlg::Init()
myAxis = myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); myAxis = myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
initName( tr( "GEOM_ROTATION" ).toLatin1().constData() ); initName( tr( "GEOM_ROTATION" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -161,33 +159,30 @@ void TransformationGUI_RotationDlg::ConstructorsClicked(int constructorId)
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection(); globalSelection();
switch (constructorId) switch ( constructorId ) {
{
case 0: /* rotation an object angle and axis */ case 0: /* rotation an object angle and axis */
{
GroupPoints->ShowRows( 2, 3, false ); GroupPoints->ShowRows( 2, 3, false );
resize(0,0);
GroupPoints->TextLabel2->setText( tr( "GEOM_AXIS" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_AXIS" ) );
GroupPoints->LineEdit2->clear(); GroupPoints->LineEdit2->clear();
GroupPoints->ShowRows( 4, 4, true ); GroupPoints->ShowRows( 4, 4, true );
myAxis = GEOM::GEOM_Object::_nil(); myAxis = GEOM::GEOM_Object::_nil();
break; break;
}
case 1: /* rotation an object by 3 points */ case 1: /* rotation an object by 3 points */
{
GroupPoints->ShowRows( 4, 4, false ); GroupPoints->ShowRows( 4, 4, false );
resize(0,0);
GroupPoints->ShowRows( 2, 3, true ); GroupPoints->ShowRows( 2, 3, true );
GroupPoints->TextLabel2->setText( tr( "GEOM_CENTRAL_POINT" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_CENTRAL_POINT" ) );
GroupPoints->TextLabel4->setText(tr("GEOM_POINT_I").arg("1")); GroupPoints->TextLabel4->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
GroupPoints->TextLabel5->setText(tr("GEOM_POINT_I").arg("2")); GroupPoints->TextLabel5->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
GroupPoints->LineEdit2->clear(); GroupPoints->LineEdit2->clear();
GroupPoints->LineEdit4->clear(); GroupPoints->LineEdit4->clear();
GroupPoints->LineEdit5->clear(); GroupPoints->LineEdit5->clear();
myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
break; break;
} }
}
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
@ -229,11 +224,9 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
QString aName; QString aName;
if(myEditCurrentArgument == GroupPoints->LineEdit1) if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
{
int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName ); int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName );
if(aNbSel < 1) if ( aNbSel < 1) {
{
myObjects.length( 0 ); myObjects.length( 0 );
return; return;
} }
@ -241,10 +234,8 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
if ( !myObjects.length() ) if ( !myObjects.length() )
return; return;
} }
else else {
{ if ( IObjectCount() != 1 ) {
if(IObjectCount() != 1)
{
if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0 ) if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0 )
myAxis = GEOM::GEOM_Object::_nil(); myAxis = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 ) else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 )
@ -295,13 +286,11 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument()
getConstructorId() == 0 ? globalSelection( GEOM_LINE ) : getConstructorId() == 0 ? globalSelection( GEOM_LINE ) :
globalSelection( GEOM_POINT ); globalSelection( GEOM_POINT );
} }
else if (send == GroupPoints->PushButton4) else if ( send == GroupPoints->PushButton4 ) {
{
myEditCurrentArgument = GroupPoints->LineEdit4; myEditCurrentArgument = GroupPoints->LineEdit4;
globalSelection( GEOM_POINT ); globalSelection( GEOM_POINT );
} }
else if (send == GroupPoints->PushButton5) else if ( send == GroupPoints->PushButton5 ) {
{
myEditCurrentArgument = GroupPoints->LineEdit5; myEditCurrentArgument = GroupPoints->LineEdit5;
globalSelection( GEOM_POINT ); globalSelection( GEOM_POINT );
} }
@ -319,8 +308,7 @@ void TransformationGUI_RotationDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 || if ( send == GroupPoints->LineEdit1 ||
send == GroupPoints->LineEdit2) send == GroupPoints->LineEdit2 ) {
{
myEditCurrentArgument = send; myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -345,9 +333,9 @@ void TransformationGUI_RotationDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_RotationDlg::enterEvent(QEvent* e) void TransformationGUI_RotationDlg::enterEvent( QEvent* )
{ {
if (!GroupConstructors->isEnabled()) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -376,21 +364,17 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_RotationDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool TransformationGUI_RotationDlg::isValid( QString& msg ) bool TransformationGUI_RotationDlg::isValid( QString& /*msg*/ )
{
switch (getConstructorId())
{ {
switch ( getConstructorId() ) {
case 0: case 0:
{
return !( myObjects.length() == 0 || myAxis->_is_nil() ); return !( myObjects.length() == 0 || myAxis->_is_nil() );
break; break;
}
case 1: case 1:
{
return !( myObjects.length() == 0 || myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil() ); return !( myObjects.length() == 0 || myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil() );
break; break;
} default:
default: return false; return false;
} }
} }
@ -406,43 +390,42 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() ) {
{
case 0 : case 0 :
{ {
if (toCreateCopy) if ( toCreateCopy ) {
for (int i = 0; i < myObjects.length(); i++) for ( int i = 0; i < myObjects.length(); i++ ) {
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateCopy( myObjects[i], myAxis, GetAngle() * PI180 ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateCopy( myObjects[i], myAxis, GetAngle() * PI180 );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
else }
for (int i = 0; i < myObjects.length(); i++) else {
{ for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->Rotate( myObjects[i], myAxis, GetAngle() * PI180 ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->Rotate( myObjects[i], myAxis, GetAngle() * PI180 );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
}
res = true; res = true;
break; break;
} }
case 1 : case 1 :
{ {
if (toCreateCopy) if ( toCreateCopy ) {
for (int i = 0; i < myObjects.length(); i++) for ( int i = 0; i < myObjects.length(); i++ ) {
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePointsCopy( myObjects[i], myCentPoint, myPoint1, myPoint2 ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePointsCopy( myObjects[i], myCentPoint, myPoint1, myPoint2 );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
else }
for (int i = 0; i < myObjects.length(); i++) else {
{ for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePoints( myObjects[i], myCentPoint, myPoint1, myPoint2 ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePoints( myObjects[i], myCentPoint, myPoint1, myPoint2 );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
}
res = true; res = true;
break; break;
} }
@ -468,7 +451,7 @@ void TransformationGUI_RotationDlg::closeEvent( QCloseEvent* e )
//================================================================================= //=================================================================================
double TransformationGUI_RotationDlg::GetAngle() const double TransformationGUI_RotationDlg::GetAngle() const
{ {
return GroupPoints->SpinBox_DX->GetValue(); return GroupPoints->SpinBox_DX->value();
} }
@ -478,7 +461,7 @@ double TransformationGUI_RotationDlg::GetAngle() const
//================================================================================= //=================================================================================
void TransformationGUI_RotationDlg::CreateCopyModeChanged( bool isCreateCopy ) void TransformationGUI_RotationDlg::CreateCopyModeChanged( bool isCreateCopy )
{ {
this->GroupBoxName->setEnabled(isCreateCopy); mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
} }
@ -488,6 +471,6 @@ void TransformationGUI_RotationDlg::CreateCopyModeChanged(bool isCreateCopy)
//================================================================================= //=================================================================================
void TransformationGUI_RotationDlg::onReverse() void TransformationGUI_RotationDlg::onReverse()
{ {
double anOldValue = GroupPoints->SpinBox_DX->GetValue(); double anOldValue = GroupPoints->SpinBox_DX->value();
GroupPoints->SpinBox_DX->SetValue( -anOldValue ); GroupPoints->SpinBox_DX->setValue( -anOldValue );
} }

View File

@ -19,16 +19,14 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : TransformationGUI_RotationDlg.h // File : TransformationGUI_RotationDlg.h
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_ROTATION_H #ifndef TRANSFORMATIONGUI_ROTATIONDLG_H
#define DIALOGBOX_ROTATION_H #define TRANSFORMATIONGUI_ROTATIONDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class DlgRef_4Sel1Spin2Check; class DlgRef_4Sel1Spin2Check;
@ -41,23 +39,24 @@ class TransformationGUI_RotationDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
TransformationGUI_RotationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, TransformationGUI_RotationDlg( GeometryGUI*, QWidget* = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_RotationDlg(); ~TransformationGUI_RotationDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e ); virtual void closeEvent( QCloseEvent* );
private: private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent( QEvent* );
double GetAngle() const; double GetAngle() const;
private:
GEOM::ListOfGO myObjects; GEOM::ListOfGO myObjects;
GEOM::GEOM_Object_var myAxis, myCentPoint, myPoint1, myPoint2; GEOM::GEOM_Object_var myAxis, myCentPoint, myPoint1, myPoint2;
@ -71,9 +70,9 @@ private slots:
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ValueChangedInSpinBox(); void ValueChangedInSpinBox();
void CreateCopyModeChanged(bool isCreateCopy); void CreateCopyModeChanged( bool );
void ConstructorsClicked(int constructorId); void ConstructorsClicked( int );
void onReverse(); void onReverse();
}; };
#endif // DIALOGBOX_ROTATION_H #endif // TRANSFORMATIONGUI_ROTATIONDLG_H

View File

@ -19,28 +19,21 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : TransformationGUI_ScaleDlg.cxx // File : TransformationGUI_ScaleDlg.cxx
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM
// $Header$
#include "TransformationGUI_ScaleDlg.h" #include "TransformationGUI_ScaleDlg.h"
#include "DlgRef_2Sel1Spin2Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h" #include <GEOM_DlgRef.h>
#include "GEOMBase.h" #include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h" #include <SUIT_ResourceMgr.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
#include "GEOMImpl_Types.hxx" #include <GEOMImpl_Types.hxx>
using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_ScaleDlg() // class : TransformationGUI_ScaleDlg()
@ -50,8 +43,8 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg( GeometryGUI* theGeometryGUI, QWidget* parent, TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, Qt::WindowFlags fl) bool modal, Qt::WindowFlags fl )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{ {
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SCALE" ) ) ); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SCALE" ) ) );
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
@ -59,14 +52,14 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryG
setWindowTitle( tr( "GEOM_SCALE_TITLE" ) ); setWindowTitle( tr( "GEOM_SCALE_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_SCALE")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_SCALE" ) );
RadioButton1->setIcon(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
RadioButton2->close(); mainFrame()->RadioButton2->close();
RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close(); mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints"); GroupPoints = new DlgRef_2Sel1Spin2Check( centralWidget() );
GroupPoints->CheckButton2->hide(); GroupPoints->CheckButton2->hide();
GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
@ -81,21 +74,24 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryG
// san -- modification of an exisitng object by offset is not allowed // san -- modification of an exisitng object by offset is not allowed
GroupPoints->CheckButton1->hide(); GroupPoints->CheckButton1->hide();
gridLayout1->addWidget(GroupPoints, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
/***************************************************************/ /***************************************************************/
double aFactor = 2.0; double aFactor = 2.0;
double SpecificStep = 0.5; double SpecificStep = 0.5;
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, 3); initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, 3 );
GroupPoints->SpinBox_DX->SetValue(aFactor); GroupPoints->SpinBox_DX->setValue( aFactor );
// Activate Create a Copy mode // Activate Create a Copy mode
GroupPoints->CheckButton1->setChecked( true ); GroupPoints->CheckButton1->setChecked( true );
CreateCopyModeChanged( true ); CreateCopyModeChanged( true );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
@ -104,7 +100,9 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryG
connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
// VSR: TODO ->>
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) ); connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) );
// <<-
connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) ); connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) );
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
@ -137,7 +135,7 @@ void TransformationGUI_ScaleDlg::Init()
myPoint = GEOM::GEOM_Object::_nil(); myPoint = GEOM::GEOM_Object::_nil();
initName( tr( "GEOM_SCALE" ).toLatin1().constData() ); initName( tr( "GEOM_SCALE" ) );
} }
@ -175,11 +173,9 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
QString aName; QString aName;
if(myEditCurrentArgument == GroupPoints->LineEdit1) if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
{
int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName ); int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName );
if(aNbSel < 1) if ( aNbSel < 1 ) {
{
myObjects.length( 0 ); myObjects.length( 0 );
return; return;
} }
@ -187,10 +183,8 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
if ( !myObjects.length() ) if ( !myObjects.length() )
return; return;
} }
else if(myEditCurrentArgument == GroupPoints->LineEdit2) else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
{ if ( IObjectCount() != 1 ) {
if(IObjectCount() != 1)
{
myPoint = GEOM::GEOM_Object::_nil(); myPoint = GEOM::GEOM_Object::_nil();
return; return;
} }
@ -214,8 +208,7 @@ void TransformationGUI_ScaleDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 || if ( send == GroupPoints->LineEdit1 ||
send == GroupPoints->LineEdit2) send == GroupPoints->LineEdit2 ) {
{
myEditCurrentArgument = send; myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -263,9 +256,9 @@ void TransformationGUI_ScaleDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_ScaleDlg::enterEvent(QEvent* e) void TransformationGUI_ScaleDlg::enterEvent( QEvent* )
{ {
if( !GroupConstructors->isEnabled() ) if( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -293,7 +286,7 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool TransformationGUI_ScaleDlg::isValid( QString& msg ) bool TransformationGUI_ScaleDlg::isValid( QString& /*msg*/)
{ {
return !( myObjects.length() == 0 || myPoint->_is_nil() || fabs( GetFactor()) <= 0.00001 ); return !( myObjects.length() == 0 || myPoint->_is_nil() || fabs( GetFactor()) <= 0.00001 );
} }
@ -305,27 +298,23 @@ bool TransformationGUI_ScaleDlg::isValid( QString& msg )
//================================================================================= //=================================================================================
bool TransformationGUI_ScaleDlg::execute( ObjectList& objects ) bool TransformationGUI_ScaleDlg::execute( ObjectList& objects )
{ {
bool res = false;
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
if (GroupPoints->CheckButton1->isChecked() || IsPreview()) if ( GroupPoints->CheckButton1->isChecked() || IsPreview() ) {
for (int i = 0; i < myObjects.length(); i++) for ( int i = 0; i < myObjects.length(); i++ ) {
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShapeCopy( myObjects[i], myPoint, GetFactor() ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShapeCopy( myObjects[i], myPoint, GetFactor() );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
else }
for (int i = 0; i < myObjects.length(); i++) else {
{ for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShape( myObjects[i], myPoint, GetFactor() ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShape( myObjects[i], myPoint, GetFactor() );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
res = true; }
return true;
return res;
} }
@ -345,7 +334,7 @@ void TransformationGUI_ScaleDlg::closeEvent( QCloseEvent* e )
//================================================================================= //=================================================================================
double TransformationGUI_ScaleDlg::GetFactor() const double TransformationGUI_ScaleDlg::GetFactor() const
{ {
return GroupPoints->SpinBox_DX->GetValue(); return GroupPoints->SpinBox_DX->value();
} }
@ -355,5 +344,5 @@ double TransformationGUI_ScaleDlg::GetFactor() const
//================================================================================= //=================================================================================
void TransformationGUI_ScaleDlg::CreateCopyModeChanged( bool isCreateCopy ) void TransformationGUI_ScaleDlg::CreateCopyModeChanged( bool isCreateCopy )
{ {
this->GroupBoxName->setEnabled(isCreateCopy); mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
} }

View File

@ -22,13 +22,13 @@
// //
// //
// File : TransformationGUI_ScaleDlg.h // File : TransformationGUI_ScaleDlg.h
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_SCALE_H #ifndef TRANSFORMATIONGUI_SCALEDLG_H
#define DIALOGBOX_SCALE_H #define TRANSFORMATIONGUI_SCALEDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class DlgRef_2Sel1Spin2Check; class DlgRef_2Sel1Spin2Check;
@ -41,23 +41,24 @@ class TransformationGUI_ScaleDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
TransformationGUI_ScaleDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, TransformationGUI_ScaleDlg( GeometryGUI*, QWidget* = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_ScaleDlg(); ~TransformationGUI_ScaleDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e ); virtual void closeEvent( QCloseEvent* );
private: private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent( QEvent* );
double GetFactor() const; double GetFactor() const;
private:
GEOM::ListOfGO myObjects; GEOM::ListOfGO myObjects;
GEOM::GEOM_Object_var myPoint; /* Central Point */ GEOM::GEOM_Object_var myPoint; /* Central Point */
@ -71,7 +72,7 @@ private slots:
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ValueChangedInSpinBox(); void ValueChangedInSpinBox();
void CreateCopyModeChanged(bool isCreateCopy); void CreateCopyModeChanged( bool );
}; };
#endif // DIALOGBOX_SCALE_H #endif // TRANSFORMATIONGUI_SCALEDLG_H

View File

@ -19,28 +19,22 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : TransformationGUI_TranslationDlg.cxx // File : TransformationGUI_TranslationDlg.cxx
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "TransformationGUI_TranslationDlg.h" #include "TransformationGUI_TranslationDlg.h"
#include "DlgRef_3Sel3Spin1Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h" #include <GEOM_DlgRef.h>
#include "GEOMBase.h" #include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h" #include <SUIT_ResourceMgr.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
#include "GEOMImpl_Types.hxx" #include <GEOMImpl_Types.hxx>
using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_TranslationDlg() // class : TransformationGUI_TranslationDlg()
@ -50,8 +44,8 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg
(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) ( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{ {
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_TRANSLATION_DXYZ" ) ) ); QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_TRANSLATION_DXYZ" ) ) );
@ -62,17 +56,16 @@ TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg
setWindowTitle( tr( "GEOM_TRANSLATION_TITLE" ) ); setWindowTitle( tr( "GEOM_TRANSLATION_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_TRANSLATION")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_TRANSLATION" ) );
RadioButton1->setIcon(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setIcon(image1); mainFrame()->RadioButton2->setIcon( image1 );
RadioButton3->setIcon(image2); mainFrame()->RadioButton3->setIcon( image2 );
mainFrame()->RadioButton1->setChecked( true );
RadioButton1->setChecked(true); GroupPoints = new DlgRef_3Sel3Spin1Check( centralWidget() );
GroupPoints = new DlgRef_3Sel3Spin1Check(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 ) );
GroupPoints->TextLabel4->setText( tr( "GEOM_DX" ) ); GroupPoints->TextLabel4->setText( tr( "GEOM_DX" ) );
GroupPoints->TextLabel5->setText( tr( "GEOM_DY" ) ); GroupPoints->TextLabel5->setText( tr( "GEOM_DY" ) );
GroupPoints->TextLabel6->setText( tr( "GEOM_DZ" ) ); GroupPoints->TextLabel6->setText( tr( "GEOM_DZ" ) );
@ -81,7 +74,9 @@ TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg
GroupPoints->PushButton3->setIcon( image3 ); GroupPoints->PushButton3->setIcon( image3 );
GroupPoints->CheckBox1->setText( tr( "GEOM_CREATE_COPY" ) ); GroupPoints->CheckBox1->setText( tr( "GEOM_CREATE_COPY" ) );
gridLayout1->addWidget(GroupPoints, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
/***************************************************************/ /***************************************************************/
setHelpFileName( "translation.htm" ); setHelpFileName( "translation.htm" );
@ -123,18 +118,19 @@ void TransformationGUI_TranslationDlg::Init()
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); initSpinBox( GroupPoints->SpinBox1, COORD_MIN, COORD_MAX, step, 3 );
GroupPoints->SpinBox2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); initSpinBox( GroupPoints->SpinBox2, COORD_MIN, COORD_MAX, step, 3 );
GroupPoints->SpinBox3->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); initSpinBox( GroupPoints->SpinBox3, COORD_MIN, COORD_MAX, step, 3 );
GroupPoints->SpinBox1->SetValue(0.0); GroupPoints->SpinBox1->setValue( 0.0 );
GroupPoints->SpinBox2->SetValue(0.0); GroupPoints->SpinBox2->setValue( 0.0 );
GroupPoints->SpinBox3->SetValue(0.0); GroupPoints->SpinBox3->setValue( 0.0 );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
@ -146,16 +142,19 @@ void TransformationGUI_TranslationDlg::Init()
connect( GroupPoints->SpinBox2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); connect( GroupPoints->SpinBox2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
connect( GroupPoints->SpinBox3, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); connect( GroupPoints->SpinBox3, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
// VSR: TODO ->>
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox1, SLOT( SetStep( double ) ) ); connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox1, SLOT( SetStep( double ) ) );
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( CreateCopyModeChanged( bool ) ) );
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_TRANSLATION" ).toLatin1().constData() ); initName( tr( "GEOM_TRANSLATION" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -171,21 +170,18 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId)
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection(); globalSelection();
switch (constructorId) switch ( 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 );
resize(0,0);
GroupPoints->ShowRows( 3, 5, true ); GroupPoints->ShowRows( 3, 5, 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 );
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();
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
@ -194,7 +190,6 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId)
case 2: /* translation an object by vector */ case 2: /* translation an object by vector */
{ {
GroupPoints->ShowRows( 2, 5, false ); GroupPoints->ShowRows( 2, 5, false );
resize(0,0);
GroupPoints->ShowRows( 0, 1, true ); GroupPoints->ShowRows( 0, 1, true );
GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) );
GroupPoints->LineEdit2->clear(); GroupPoints->LineEdit2->clear();
@ -203,6 +198,10 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId)
} }
} }
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
@ -244,12 +243,10 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
QString aName; QString aName;
if(myEditCurrentArgument == GroupPoints->LineEdit1) if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
{
int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName ); int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName );
if(aNbSel < 1) if ( aNbSel < 1 ) {
{
myObjects.length( 0 ); myObjects.length( 0 );
return; return;
} }
@ -257,8 +254,7 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
if ( !myObjects.length() ) if ( !myObjects.length() )
return; return;
} }
else else {
{
if ( IObjectCount() != 1 ) { if ( IObjectCount() != 1 ) {
if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 ) if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 )
myPoint1 = GEOM::GEOM_Object::_nil(); myPoint1 = GEOM::GEOM_Object::_nil();
@ -298,8 +294,7 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
void TransformationGUI_TranslationDlg::LineEditReturnPressed() void TransformationGUI_TranslationDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if(send == GroupPoints->LineEdit1) if ( send == GroupPoints->LineEdit1 ) {
{
myEditCurrentArgument = send; myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -314,19 +309,16 @@ void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) if ( send == GroupPoints->PushButton1 ) {
{
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection(); globalSelection();
} }
else if (send == GroupPoints->PushButton2) else if ( send == GroupPoints->PushButton2 ) {
{
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
getConstructorId() == 1 ? globalSelection( GEOM_POINT ) : getConstructorId() == 1 ? globalSelection( GEOM_POINT ) :
globalSelection( GEOM_LINE ); globalSelection( GEOM_LINE );
} }
else if (send == GroupPoints->PushButton3) else if ( send == GroupPoints->PushButton3 ) {
{
myEditCurrentArgument = GroupPoints->LineEdit3; myEditCurrentArgument = GroupPoints->LineEdit3;
globalSelection( GEOM_POINT ); globalSelection( GEOM_POINT );
} }
@ -354,9 +346,9 @@ void TransformationGUI_TranslationDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_TranslationDlg::enterEvent(QEvent* e) void TransformationGUI_TranslationDlg::enterEvent( QEvent* )
{ {
if(!GroupConstructors->isEnabled()) if( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -385,28 +377,22 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool TransformationGUI_TranslationDlg::isValid( QString& msg ) bool TransformationGUI_TranslationDlg::isValid( QString& /*msg*/ )
{ {
int aConstructorId = getConstructorId(); int aConstructorId = getConstructorId();
switch (aConstructorId) switch ( aConstructorId ) {
{
case 0: case 0:
{
return !( myObjects.length() == 0 ); return !( myObjects.length() == 0 );
break; break;
}
case 1: case 1:
{
return !( myObjects.length() == 0 || myPoint1->_is_nil() || myPoint2->_is_nil() ); return !( myObjects.length() == 0 || myPoint1->_is_nil() || myPoint2->_is_nil() );
break; break;
}
case 2: case 2:
{
return !( myObjects.length() == 0 || myVector->_is_nil() ); return !( myObjects.length() == 0 || myVector->_is_nil() );
break; break;
} default:
default: return false; return false;
} }
} }
@ -421,66 +407,65 @@ bool TransformationGUI_TranslationDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() ) {
{
case 0: case 0:
{ {
double dx = GroupPoints->SpinBox1->GetValue(); double dx = GroupPoints->SpinBox1->value();
double dy = GroupPoints->SpinBox2->GetValue(); double dy = GroupPoints->SpinBox2->value();
double dz = GroupPoints->SpinBox3->GetValue(); double dz = GroupPoints->SpinBox3->value();
if (toCreateCopy) if ( toCreateCopy ) {
for (int i = 0; i < myObjects.length(); i++) for ( int i = 0; i < myObjects.length(); i++ ) {
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateDXDYDZCopy( myObjects[i], dx, dy, dz ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateDXDYDZCopy( myObjects[i], dx, dy, dz );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
else }
for (int i = 0; i < myObjects.length(); i++) else {
{ for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateDXDYDZ( myObjects[i], dx, dy, dz ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateDXDYDZ( myObjects[i], dx, dy, dz );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
}
res = true; res = true;
break; break;
} }
case 1: case 1:
{ {
if (toCreateCopy) if ( toCreateCopy ) {
for (int i = 0; i < myObjects.length(); i++) for ( int i = 0; i < myObjects.length(); i++ ) {
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateTwoPointsCopy( myObjects[i], myPoint1, myPoint2 ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateTwoPointsCopy( myObjects[i], myPoint1, myPoint2 );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
else }
for (int i = 0; i < myObjects.length(); i++) else {
{ for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateTwoPoints( myObjects[i], myPoint1, myPoint2 ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateTwoPoints( myObjects[i], myPoint1, myPoint2 );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
}
res = true; res = true;
break; break;
} }
case 2: case 2:
{ {
if (toCreateCopy) if ( toCreateCopy ) {
for (int i = 0; i < myObjects.length(); i++) for ( int i = 0; i < myObjects.length(); i++ ) {
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVectorCopy( myObjects[i], myVector ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVectorCopy( myObjects[i], myVector );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
else }
for (int i = 0; i < myObjects.length(); i++) else {
{ for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVector( myObjects[i], myVector ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVector( myObjects[i], myVector );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
}
res = true; res = true;
break; break;
} }
@ -507,5 +492,5 @@ void TransformationGUI_TranslationDlg::closeEvent( QCloseEvent* e )
//================================================================================= //=================================================================================
void TransformationGUI_TranslationDlg::CreateCopyModeChanged( bool isCreateCopy ) void TransformationGUI_TranslationDlg::CreateCopyModeChanged( bool isCreateCopy )
{ {
GroupBoxName->setEnabled(isCreateCopy); mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
} }

View File

@ -19,16 +19,14 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : TransformationGUI_TranslationDlg.h // File : TransformationGUI_TranslationDlg.h
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_TRANSLATION_H #ifndef TRANSFORMATIONGUI_TRANSLATIONDLG_H
#define DIALOGBOX_TRANSLATION_H #define TRANSFORMATIONGUI_TRANSLATIONDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class DlgRef_3Sel3Spin1Check; class DlgRef_3Sel3Spin1Check;
@ -41,22 +39,23 @@ class TransformationGUI_TranslationDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
TransformationGUI_TranslationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, TransformationGUI_TranslationDlg( GeometryGUI*, QWidget* = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_TranslationDlg(); ~TransformationGUI_TranslationDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e ); virtual void closeEvent( QCloseEvent* );
private: private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent( QEvent* );
private:
GEOM::GEOM_Object_var myVector, myPoint1, myPoint2; GEOM::GEOM_Object_var myVector, myPoint1, myPoint2;
GEOM::ListOfGO myObjects; GEOM::ListOfGO myObjects;
@ -70,8 +69,8 @@ private slots :
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ValueChangedInSpinBox(); void ValueChangedInSpinBox();
void ConstructorsClicked(int constructorId); void ConstructorsClicked( int );
void CreateCopyModeChanged(bool isCreateCopy); void CreateCopyModeChanged( bool );
}; };
#endif // DIALOGBOX_TRANSLATION_H #endif // TRANSFORMATIONGUI_TRANSLATIONDLG_H