*** 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
// purpose :
//=================================================================================
bool BasicGUI_PointDlg::isValid( QString& msg )
bool BasicGUI_PointDlg::isValid( QString& /*msg*/ )
{
const int id = getConstructorId();
if ( id == 0 )

View File

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

View File

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

View File

@ -19,13 +19,10 @@
#
# 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
@ -36,6 +33,16 @@ salomeinclude_HEADERS =
lib_LTLIBRARIES = libTransformationGUI.la
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_MultiTranslationDlg.cxx \
TransformationGUI_MultiRotationDlg.cxx \
@ -82,6 +89,7 @@ libTransformationGUI_la_CPPFLAGS = \
-I$(srcdir)/../GEOMClient \
-I$(srcdir)/../GEOMImpl \
-I$(srcdir)/../GEOMFiltersSelection \
-I$(top_builddir)/src/DlgRef \
-I$(top_builddir)/idl \
-I$(top_builddir)/salome_adm/unix

View File

@ -19,19 +19,16 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : TransformationGUI.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header$
// Author : Damien COQUERET, Open CASCADE S.A.S.
//
#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_MultiRotationDlg.h" // Method MULTI ROTATION
@ -42,13 +39,12 @@
#include "TransformationGUI_OffsetDlg.h" // Method OFFSET
#include "TransformationGUI_PositionDlg.h" // Method POSITION
using namespace std;
//=======================================================================
// function : TransformationGUI()
// 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();
QDialog* aDlg = NULL;
switch (theCommandID)
{
switch ( theCommandID ) {
case 5021: // TRANSLATION
aDlg = new TransformationGUI_TranslationDlg( getGeometryGUI(), parent, "" );
aDlg = new TransformationGUI_TranslationDlg( getGeometryGUI(), parent );
break;
case 5022: // ROTATION
aDlg = new TransformationGUI_RotationDlg( getGeometryGUI(), parent, "" );
aDlg = new TransformationGUI_RotationDlg( getGeometryGUI(), parent );
break;
case 5023: // POSITION
aDlg = new TransformationGUI_PositionDlg( getGeometryGUI(), parent, "" );
aDlg = new TransformationGUI_PositionDlg( getGeometryGUI(), parent );
break;
case 5024: // MIRROR
aDlg = new TransformationGUI_MirrorDlg( getGeometryGUI(), parent, "" );
aDlg = new TransformationGUI_MirrorDlg( getGeometryGUI(), parent );
break;
case 5025: // SCALE
aDlg = new TransformationGUI_ScaleDlg( getGeometryGUI(), parent, "" );
aDlg = new TransformationGUI_ScaleDlg( getGeometryGUI(), parent );
break;
case 5026: // OFFSET
aDlg = new TransformationGUI_OffsetDlg( getGeometryGUI(), parent, "" );
aDlg = new TransformationGUI_OffsetDlg( getGeometryGUI(), parent );
break;
case 5027: // MULTI TRANSLATION
aDlg = new TransformationGUI_MultiTranslationDlg( getGeometryGUI(), parent, "" );
aDlg = new TransformationGUI_MultiTranslationDlg( getGeometryGUI(), parent );
break;
case 5028: // MULTI ROTATION
aDlg = new TransformationGUI_MultiRotationDlg( getGeometryGUI(), parent, "" );
aDlg = new TransformationGUI_MultiRotationDlg( getGeometryGUI(), parent );
break;
default:
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
//
//
//
// File : TransformationGUI.h
// Author : Damien COQUERET
// Module : GEOM
// Author : Damien COQUERET, Open CASCADE S.A.S.
//
#ifndef TRANSFORMATIONGUI_H
#define TRANSFORMATIONGUI_H
#include "GEOMGUI.h"
#include <GEOMGUI.h>
//=================================================================================
// class : TransformationGUI
@ -38,10 +35,10 @@
class TransformationGUI : public GEOMGUI
{
public:
TransformationGUI( GeometryGUI* parent );
TransformationGUI( GeometryGUI* );
~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
//
//
//
// File : TransformationGUI_MirrorDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
//
#include "TransformationGUI_MirrorDlg.h"
#include "DlgRef_2Sel1Spin2Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h"
#include "GEOMBase.h"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h"
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include "GEOMImpl_Types.hxx"
using namespace std;
#include <GEOMImpl_Types.hxx>
//=================================================================================
// class : TransformationGUI_MirrorDlg()
@ -50,8 +44,8 @@ using namespace std;
// TRUE to construct a modal dialog.
//=================================================================================
TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, Qt::WindowFlags fl)
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
bool modal, Qt::WindowFlags fl )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{
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" ) ) );
@ -61,12 +55,12 @@ TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg(GeometryGUI* theGeometr
setWindowTitle( tr( "GEOM_MIRROR_TITLE" ) );
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_MIRROR"));
RadioButton1->setIcon(image0);
RadioButton2->setIcon(image1);
RadioButton3->setIcon(image2);
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_MIRROR" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setIcon( image1 );
mainFrame()->RadioButton3->setIcon( image2 );
GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints");
GroupPoints = new DlgRef_2Sel1Spin2Check( centralWidget() );
GroupPoints->SpinBox_DX->hide();
GroupPoints->TextLabel3->hide();
GroupPoints->CheckButton2->hide();
@ -77,7 +71,10 @@ TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg(GeometryGUI* theGeometr
GroupPoints->PushButton1->setIcon( image3 );
GroupPoints->PushButton2->setIcon( image3 );
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" );
@ -114,9 +111,10 @@ void TransformationGUI_MirrorDlg::Init()
CreateCopyModeChanged( true );
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
@ -129,7 +127,8 @@ void TransformationGUI_MirrorDlg::Init()
connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_MIRROR" ).toLatin1().constData() );
initName( tr( "GEOM_MIRROR" ) );
ConstructorsClicked( 0 );
}
@ -147,24 +146,18 @@ void TransformationGUI_MirrorDlg::ConstructorsClicked(int constructorId)
GroupPoints->LineEdit2->clear();
myArgument = GEOM::GEOM_Object::_nil();
switch (constructorId)
{
switch ( constructorId ) {
case 0: /* mirror an object by point */
{
GroupPoints->TextLabel2->setText( tr( "GEOM_POINT_MIRROR" ) );
break;
}
case 1: /* mirror an object by axe */
{
GroupPoints->TextLabel2->setText( tr( "GEOM_AXE_MIRROR" ) );
break;
}
case 2: /* mirror an object by plane */
{
GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE_MIRROR" ) );
break;
}
}
connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
}
@ -206,11 +199,9 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
myEditCurrentArgument->setText( "" );
QString aName;
if(myEditCurrentArgument == GroupPoints->LineEdit1)
{
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName );
if(aNbSel < 1)
{
if ( aNbSel < 1 ) {
myObjects.length( 0 );
return;
}
@ -220,10 +211,8 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
if ( aNbSel != 1 )
aName = tr( "%1_objects" ).arg( aNbSel );
}
else if(myEditCurrentArgument == GroupPoints->LineEdit2)
{
if(IObjectCount() != 1)
{
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
if ( IObjectCount() != 1 ) {
myArgument = GEOM::GEOM_Object::_nil();
return;
}
@ -247,8 +236,7 @@ void TransformationGUI_MirrorDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 ||
send == GroupPoints->LineEdit2)
{
send == GroupPoints->LineEdit2 ) {
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
@ -269,25 +257,18 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
}
else if ( send == GroupPoints->PushButton2 ) {
myEditCurrentArgument = GroupPoints->LineEdit2;
switch(getConstructorId())
{
switch ( getConstructorId() ) {
case 0:
{
globalSelection( GEOM_POINT );
break;
}
case 1:
{
globalSelection( GEOM_LINE );
break;
}
case 2:
{
globalSelection( GEOM_PLANE );
break;
}
}
}
myEditCurrentArgument->setFocus();
SelectionIntoArgument();
@ -311,9 +292,9 @@ void TransformationGUI_MirrorDlg::ActivateThisDialog()
// function : enterEvent()
// 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();
}
@ -332,7 +313,7 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MirrorDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool TransformationGUI_MirrorDlg::isValid( QString& msg )
bool TransformationGUI_MirrorDlg::isValid( QString& /*msg*/ )
{
return !( myObjects.length() == 0 || myArgument->_is_nil() );
}
@ -349,62 +330,61 @@ bool TransformationGUI_MirrorDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() )
{
switch ( getConstructorId() ) {
case 0:
{
if (toCreateCopy)
for (int i = 0; i < myObjects.length(); i++)
{
if ( toCreateCopy ) {
for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPointCopy( myObjects[i], myArgument );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
else
for (int i = 0; i < myObjects.length(); i++)
{
}
else {
for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPoint( myObjects[i], myArgument );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
}
res = true;
break;
}
case 1:
{
if (toCreateCopy)
for (int i = 0; i < myObjects.length(); i++)
{
if ( toCreateCopy ) {
for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorAxisCopy( myObjects[i], myArgument );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
else
for (int i = 0; i < myObjects.length(); i++)
{
}
else {
for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorAxis( myObjects[i], myArgument );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
}
res = true;
break;
}
case 2:
{
if (toCreateCopy)
for (int i = 0; i < myObjects.length(); i++)
{
if ( toCreateCopy ) {
for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlaneCopy( myObjects[i], myArgument );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
else
for (int i = 0; i < myObjects.length(); i++)
{
}
else {
for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlane( myObjects[i], myArgument );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
}
res = true;
break;
}
@ -429,5 +409,5 @@ void TransformationGUI_MirrorDlg::closeEvent( QCloseEvent* e )
//=================================================================================
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
//
//
//
// File : TransformationGUI_MirrorDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
//
#ifndef DIALOGBOX_MIRROR_H
#define DIALOGBOX_MIRROR_H
#ifndef TRANSFORMATIONGUI_MIRRORDLG_H
#define TRANSFORMATIONGUI_MIRRORDLG_H
#include "GEOMBase_Skeleton.h"
#include <GEOMBase_Skeleton.h>
class DlgRef_2Sel1Spin2Check;
@ -41,22 +39,23 @@ class TransformationGUI_MirrorDlg : public GEOMBase_Skeleton
Q_OBJECT
public:
TransformationGUI_MirrorDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
TransformationGUI_MirrorDlg( GeometryGUI*, QWidget* = 0,
bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_MirrorDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e );
virtual void closeEvent( QCloseEvent* );
private:
void Init();
void enterEvent(QEvent* e);
void enterEvent( QEvent* );
private:
GEOM::GEOM_Object_var myArgument;
GEOM::ListOfGO myObjects;
@ -69,8 +68,8 @@ private slots :
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ConstructorsClicked(int constructorId);
void CreateCopyModeChanged(bool isCreateCopy);
void ConstructorsClicked( int );
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
//
//
//
// File : TransformationGUI_MultiRotationDlg.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header$
// Author : Damien COQUERET, Open CASCADE S.A.S.
//
#include "TransformationGUI_MultiRotationDlg.h"
#include "DlgRef_2Sel4Spin1Check.h"
#include "DlgRef_2Sel1Spin.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h"
#include "GEOMBase.h"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h"
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include "GEOMImpl_Types.hxx"
using namespace std;
#include <GEOMImpl_Types.hxx>
//=================================================================================
// class : TransformationGUI_MultiRotationDlg()
@ -51,8 +44,8 @@ using namespace std;
// TRUE to construct a modal dialog.
//=================================================================================
TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg
(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_MULTIROTATION_SIMPLE" ) ) );
@ -62,13 +55,13 @@ TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg
setWindowTitle( tr( "GEOM_MULTIROTATION_TITLE" ) );
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_MULTIROTATION"));
RadioButton1->setIcon(image0);
RadioButton2->setIcon(image1);
RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close();
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_MULTIROTATION" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setIcon( image1 );
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_2Sel1Spin(this, "GroupPoints");
GroupPoints = new DlgRef_2Sel1Spin( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_MULTIROTATION_SIMPLE" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) );
@ -78,7 +71,7 @@ TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg
GroupPoints->LineEdit1->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->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
GroupDimensions->TextLabel2->setText( tr( "GEOM_VECTOR" ) );
@ -92,8 +85,10 @@ TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg
GroupDimensions->LineEdit1->setReadOnly( true );
GroupDimensions->LineEdit2->setReadOnly( true );
gridLayout1->addWidget(GroupPoints, 2, 0);
gridLayout1->addWidget(GroupDimensions, 2, 0);
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
layout->addWidget( GroupDimensions );
/***************************************************************/
setHelpFileName( "multi_rotation.htm" );
@ -125,22 +120,23 @@ void TransformationGUI_MultiRotationDlg::Init()
double SpecificStep1 = 5;
double SpecificStep2 = 1;
/* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3);
GroupPoints->SpinBox_DX->SetValue(myNbTimes1);
initSpinBox( GroupPoints->SpinBox_DX, 1.0, MAX_NUMBER, SpecificStep2, 3 );
GroupPoints->SpinBox_DX->setValue( myNbTimes1 );
GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep1, 3);
GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3);
GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3);
GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3);
GroupDimensions->SpinBox_DX1->SetValue(myAng);
GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1);
GroupDimensions->SpinBox_DX2->SetValue(myStep);
GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2);
initSpinBox( GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, 3 );
initSpinBox( GroupDimensions->SpinBox_DY1, 1.0, MAX_NUMBER, SpecificStep2, 3 );
initSpinBox( GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, 3 );
initSpinBox( GroupDimensions->SpinBox_DY2, 1.0, MAX_NUMBER, SpecificStep2, 3 );
GroupDimensions->SpinBox_DX1->setValue( myAng );
GroupDimensions->SpinBox_DY1->setValue( myNbTimes1 );
GroupDimensions->SpinBox_DX2->setValue( myStep );
GroupDimensions->SpinBox_DY2->setValue( myNbTimes2 );
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
@ -158,18 +154,21 @@ void TransformationGUI_MultiRotationDlg::Init()
connect( GroupDimensions->SpinBox_DX2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( GroupDimensions->SpinBox_DY2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
// VSR: TODO ->>
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) );
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DX1, SLOT( SetStep( double ) ) );
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DY1, SLOT( SetStep( double ) ) );
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DX2, SLOT( SetStep( double ) ) );
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupDimensions->SpinBox_DY2, SLOT( SetStep( double ) ) );
// <<-
connect( GroupDimensions->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseAngle() ) );
connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_MULTIROTATION" ).toLatin1().constData() );
initName( tr( "GEOM_MULTIROTATION" ) );
ConstructorsClicked( 0 );
}
@ -188,41 +187,42 @@ void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId)
globalSelection( GEOM_ALLSHAPES );
switch (constructorId)
{
switch ( constructorId ) {
case 0: /* Rotate simple */
{
GroupDimensions->hide();
resize(0, 0);
GroupPoints->show();
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText( "" );
GroupPoints->LineEdit2->setText( "" );
GroupPoints->SpinBox_DX->SetValue(myNbTimes1);
GroupPoints->SpinBox_DX->setValue( myNbTimes1 );
break;
}
case 1: /* Rotate double */
{
GroupPoints->hide();
resize(0, 0);
GroupDimensions->show();
myEditCurrentArgument = GroupDimensions->LineEdit1;
GroupDimensions->LineEdit1->setText( "" );
GroupDimensions->LineEdit2->setText( "" );
GroupDimensions->SpinBox_DX1->SetValue(myAng);
GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1);
GroupDimensions->SpinBox_DX2->SetValue(myStep);
GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2);
GroupDimensions->SpinBox_DX1->setValue( myAng );
GroupDimensions->SpinBox_DY1->setValue( myNbTimes1 );
GroupDimensions->SpinBox_DX2->setValue( myStep );
GroupDimensions->SpinBox_DY2->setValue( myNbTimes2 );
break;
}
}
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
myEditCurrentArgument->setFocus();
myBase = myVector = GEOM::GEOM_Object::_nil();
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
@ -333,8 +333,7 @@ void TransformationGUI_MultiRotationDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 ||
send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2)
{
send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 ) {
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
@ -359,9 +358,9 @@ void TransformationGUI_MultiRotationDlg::ActivateThisDialog()
// function : enterEvent()
// purpose :
//=================================================================================
void TransformationGUI_MultiRotationDlg::enterEvent(QEvent* e)
void TransformationGUI_MultiRotationDlg::enterEvent( QEvent* )
{
if(!GroupConstructors->isEnabled())
if( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog();
}
@ -398,9 +397,9 @@ void TransformationGUI_MultiRotationDlg::ReverseAngle()
int aConstructorId = getConstructorId();
if ( aConstructorId == 0 )
GroupPoints->SpinBox_DX->SetValue(myAng);
GroupPoints->SpinBox_DX->setValue( myAng );
else if ( aConstructorId == 1 )
GroupDimensions->SpinBox_DX1->SetValue(myAng);
GroupDimensions->SpinBox_DX1->setValue( myAng );
displayPreview();
}
@ -420,7 +419,7 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool TransformationGUI_MultiRotationDlg::isValid( QString& msg )
bool TransformationGUI_MultiRotationDlg::isValid( QString& /*msg*/ )
{
return !( myBase->_is_nil() || myVector->_is_nil() );
}
@ -435,28 +434,22 @@ bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() )
{
switch ( getConstructorId() ) {
case 0 :
{
if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
MultiRotate1D( myBase, myVector, myNbTimes1 );
res = true;
}
break;
}
case 1 :
{
if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) )
{
if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
MultiRotate2D( myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2 );
res = true;
}
break;
}
}
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );

View File

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

View File

@ -19,16 +19,14 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : TransformationGUI_MultiTranslationDlg.h
// Author : Damien COQUERET
// Module : GEOM
// Author : Damien COQUERET, Open CASCADE S.A.S.
//
#ifndef DIALOGBOX_MULTITRANSLATION_H
#define DIALOGBOX_MULTITRANSLATION_H
#ifndef TRANSFORMATIONGUI_MULTITRANSLATIONDLG_H
#define TRANSFORMATIONGUI_MULTITRANSLATIONDLG_H
#include "GEOMBase_Skeleton.h"
#include <GEOMBase_Skeleton.h>
class DlgRef_2Sel2Spin1Check;
class DlgRef_3Sel4Spin2Check;
@ -42,22 +40,23 @@ class TransformationGUI_MultiTranslationDlg : public GEOMBase_Skeleton
Q_OBJECT
public:
TransformationGUI_MultiTranslationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
TransformationGUI_MultiTranslationDlg( GeometryGUI*, QWidget* = 0,
bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_MultiTranslationDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e );
virtual void closeEvent( QCloseEvent* );
private:
void Init();
void enterEvent(QEvent* e);
void enterEvent( QEvent* );
private:
GEOM::GEOM_Object_var myBase, myVectorU, myVectorV;
int myNbTimesU;
int myNbTimesV;
@ -76,8 +75,8 @@ private slots:
void SetEditCurrentArgument();
void ReverseStepU();
void ReverseStepV();
void ValueChangedInSpinBox(double newValue);
void ConstructorsClicked(int constructorId);
void ValueChangedInSpinBox( double );
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
//
//
//
// File : TransformationGUI_OffsetDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
//
#include "TransformationGUI_OffsetDlg.h"
#include "DlgRef_1Sel1Spin1Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h"
#include "GEOMBase.h"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h"
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
using namespace std;
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
//=================================================================================
// class : TransformationGUI_OffsetDlg()
@ -48,8 +42,8 @@ using namespace std;
// TRUE to construct a modal dialog.
//=================================================================================
TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, Qt::WindowFlags fl)
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
bool modal, Qt::WindowFlags fl )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_OFFSET" ) ) );
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" ) );
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_OFFSET"));
RadioButton1->setIcon(image0);
RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
RadioButton2->close();
RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close();
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_OFFSET" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_1Sel1Spin1Check(this, "GroupPoints");
GroupPoints = new DlgRef_1Sel1Spin1Check( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
GroupPoints->TextLabel2->setText( tr( "GEOM_OFFSET" ) );
@ -75,7 +69,9 @@ TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg(GeometryGUI* theGeometr
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;
/* 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->setDblPrecision(1e-05);
GroupPoints->SpinBox_DX->SetValue(1e-05);
GroupPoints->SpinBox_DX->setValue( 1e-05 );
// Activate Create a Copy mode
GroupPoints->CheckButton1->setChecked( true );
CreateCopyModeChanged( true );
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( myGeomGUI->getApp()->selectionMgr(),
@ -129,7 +125,7 @@ void TransformationGUI_OffsetDlg::Init()
connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) );
initName( tr( "GEOM_OFFSET" ).toLatin1().constData() );
initName( tr( "GEOM_OFFSET" ) );
globalSelection( GEOM_ALLSHAPES );
@ -171,8 +167,7 @@ void TransformationGUI_OffsetDlg::SelectionIntoArgument()
QString aName;
int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName );
if(aNbSel < 1)
{
if ( aNbSel < 1 ) {
myObjects.length( 0 );
return;
}
@ -195,8 +190,7 @@ void TransformationGUI_OffsetDlg::SelectionIntoArgument()
void TransformationGUI_OffsetDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 )
{
if ( send == GroupPoints->LineEdit1 ) {
myEditCurrentArgument = GroupPoints->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed();
}
@ -211,8 +205,7 @@ void TransformationGUI_OffsetDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1)
{
if ( send == GroupPoints->PushButton1 ) {
myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setFocus();
SelectionIntoArgument();
@ -224,9 +217,9 @@ void TransformationGUI_OffsetDlg::SetEditCurrentArgument()
// function : enterEvent()
// 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();
}
@ -274,8 +267,7 @@ bool TransformationGUI_OffsetDlg::isValid( QString& msg )
//return !(myObjects.length() == 0);
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();
if ( aType != GEOM::FACE && aType != GEOM::SHELL && aType != GEOM::SOLID ) {
msg = tr( "ERROR_SHAPE_TYPE" );
@ -296,23 +288,21 @@ bool TransformationGUI_OffsetDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj;
if (GroupPoints->CheckButton1->isChecked() || IsPreview())
for (int i = 0; i < myObjects.length(); i++)
{
if ( GroupPoints->CheckButton1->isChecked() || IsPreview() ) {
for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() );
if ( !anObj->_is_nil() )
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() );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
}
res = true;
return res;
@ -335,7 +325,7 @@ void TransformationGUI_OffsetDlg::closeEvent( QCloseEvent* e )
//=================================================================================
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 )
{
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
//
//
//
// File : TransformationGUI_OffsetDlg.h
// Author : Michael Zorin
// Module : GEOM
// Author : Michael ZORIN, Open CASCADE S.A.S. (mikhail.zorin@opencascade.com)
//
#ifndef DIALOGBOX_OFFSET_H
#define DIALOGBOX_OFFSET_H
#ifndef TRANSFORMATIONGUI_OFFSETDLG_H
#define TRANSFORMATIONGUI_OFFSETDLG_H
#include "GEOMBase_Skeleton.h"
#include <GEOMBase_Skeleton.h>
class DlgRef_1Sel1Spin1Check;
@ -41,23 +39,24 @@ class TransformationGUI_OffsetDlg : public GEOMBase_Skeleton
Q_OBJECT
public:
TransformationGUI_OffsetDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
TransformationGUI_OffsetDlg( GeometryGUI*, QWidget* = 0,
bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_OffsetDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e );
virtual void closeEvent( QCloseEvent* );
private:
void Init();
void enterEvent(QEvent* e);
void enterEvent( QEvent* );
double GetOffset() const;
private:
GEOM::ListOfGO myObjects;
DlgRef_1Sel1Spin1Check* GroupPoints;
@ -70,7 +69,7 @@ private slots:
void LineEditReturnPressed();
void SetEditCurrentArgument();
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
//
//
//
// File : TransformationGUI_PositionDlg.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header$
// Author : Damien COQUERET, Open CASCADE S.A.S.
//
#include "TransformationGUI_PositionDlg.h"
#include "DlgRef_3Sel3Spin1Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h"
#include "GEOMBase.h"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h"
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include "TColStd_MapOfInteger.hxx"
#include <TColStd_MapOfInteger.hxx>
#include "GEOMImpl_Types.hxx"
using namespace std;
#include <GEOMImpl_Types.hxx>
//=================================================================================
// class : TransformationGUI_PositionDlg()
@ -52,8 +46,8 @@ using namespace std;
// TRUE to construct a modal dialog.
//=================================================================================
TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
: GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_POSITION" ) ) );
@ -63,13 +57,13 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
setWindowTitle( tr( "GEOM_POSITION_TITLE" ) );
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_POSITION"));
RadioButton1->setIcon(image0);
RadioButton2->setIcon(image1);
RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close();
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_POSITION" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setIcon( image1 );
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
Group1 = new DlgRef_3Sel3Spin1Check(this, "Group1");
Group1 = new DlgRef_3Sel3Spin1Check( centralWidget() );
Group1->SpinBox1->hide();
Group1->SpinBox2->hide();
Group1->SpinBox3->hide();
@ -85,7 +79,9 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
Group1->PushButton3->setIcon( imageselect );
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 );
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect( Group1->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( Group1->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
@ -141,7 +138,8 @@ void TransformationGUI_PositionDlg::Init()
connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_POSITION" ).toLatin1().constData() );
initName( tr( "GEOM_POSITION" ) );
ConstructorsClicked( 0 );
}
@ -162,23 +160,23 @@ void TransformationGUI_PositionDlg::ConstructorsClicked(int constructorId)
myStartLCS = GEOM::GEOM_Object::_nil();
myEndLCS = GEOM::GEOM_Object::_nil();
switch (constructorId)
{
switch ( constructorId ) {
case 0:
{
Group1->LineEdit2->hide();
Group1->TextLabel2->hide();
Group1->PushButton2->hide();
break;
}
case 1:
{
Group1->LineEdit2->show();
Group1->TextLabel2->show();
Group1->PushButton2->show();
break;
}
}
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT(SelectionIntoArgument() ) );
SelectionIntoArgument();
@ -276,7 +274,8 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
void TransformationGUI_PositionDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if(send == Group1->LineEdit1 || send == Group1->LineEdit2 || send == Group1->LineEdit3) {
if ( send == Group1->LineEdit1 || send == Group1->LineEdit2 ||
send == Group1->LineEdit3 ) {
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
@ -332,9 +331,9 @@ void TransformationGUI_PositionDlg::ActivateThisDialog()
// function : enterEvent()
// 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();
}
@ -353,7 +352,7 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_PositionDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool TransformationGUI_PositionDlg::isValid( QString& msg )
bool TransformationGUI_PositionDlg::isValid( QString& /*msg*/ )
{
bool res;
if ( getConstructorId() == 0 )
@ -375,8 +374,7 @@ bool TransformationGUI_PositionDlg::execute( ObjectList& objects )
bool toCreateCopy = IsPreview() || Group1->CheckBox1->isChecked();
GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() )
{
switch ( getConstructorId() ) {
case 0:
{
for ( int i = 0; i < myObjects.length(); i++ ) {
@ -425,5 +423,5 @@ void TransformationGUI_PositionDlg::closeEvent( QCloseEvent* e )
//=================================================================================
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
//
//
//
// File : TransformationGUI_PositionDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
//
#ifndef DIALOGBOX_POSITION_H
#define DIALOGBOX_POSITION_H
#ifndef TRANSFORMATIONGUI_POSITIONDLG_H
#define TRANSFORMATIONGUI_POSITIONDLG_H
#include "GEOMBase_Skeleton.h"
#include <GEOMBase_Skeleton.h>
class DlgRef_3Sel3Spin1Check;
@ -41,22 +39,23 @@ class TransformationGUI_PositionDlg : public GEOMBase_Skeleton
Q_OBJECT
public:
TransformationGUI_PositionDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
TransformationGUI_PositionDlg( GeometryGUI*, QWidget* = 0,
bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_PositionDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e );
virtual void closeEvent( QCloseEvent* );
private:
void Init();
void enterEvent(QEvent* e);
void enterEvent( QEvent* );
private:
GEOM::GEOM_Object_var myStartLCS;
GEOM::GEOM_Object_var myEndLCS;
GEOM::ListOfGO myObjects;
@ -70,8 +69,8 @@ private slots:
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ConstructorsClicked(int constructorId);
void CreateCopyModeChanged(bool isCreateCopy);
void ConstructorsClicked( int );
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
//
//
//
// File : TransformationGUI_RotationDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
//
#include "TransformationGUI_RotationDlg.h"
#include "DlgRef_4Sel1Spin2Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h"
#include "GEOMBase.h"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h"
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include "GEOMImpl_Types.hxx"
using namespace std;
#include <GEOMImpl_Types.hxx>
//=================================================================================
// class : TransformationGUI_RotationDlg()
@ -50,8 +44,8 @@ using namespace std;
// TRUE to construct a modal dialog.
//=================================================================================
TransformationGUI_RotationDlg::TransformationGUI_RotationDlg
(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ROTATION" ) ) );
@ -61,19 +55,19 @@ TransformationGUI_RotationDlg::TransformationGUI_RotationDlg
setWindowTitle( tr( "GEOM_ROTATION_TITLE" ) );
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_ROTATION"));
RadioButton1->setIcon(image0);
RadioButton2->setIcon(image2);
RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close();
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_ROTATION" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setIcon( image2 );
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_4Sel1Spin2Check(this, "GroupPoints");
GroupPoints = new DlgRef_4Sel1Spin2Check( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
GroupPoints->TextLabel2->setText( tr( "GEOM_AXIS" ) );
GroupPoints->TextLabel3->setText( tr( "GEOM_ANGLE" ) );
GroupPoints->TextLabel4->setText(tr("GEOM_POINT_I").arg("1"));
GroupPoints->TextLabel5->setText(tr("GEOM_POINT_I").arg("2"));
GroupPoints->TextLabel4->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
GroupPoints->TextLabel5->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly( true );
@ -86,22 +80,26 @@ TransformationGUI_RotationDlg::TransformationGUI_RotationDlg
GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) );
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 SpecificStep = 5;
/* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, 3);
GroupPoints->SpinBox_DX->SetValue(anAngle);
initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, 3 );
GroupPoints->SpinBox_DX->setValue( anAngle );
// Activate Create a Copy mode
GroupPoints->CheckButton1->setChecked( true );
CreateCopyModeChanged( true );
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
@ -146,7 +144,7 @@ void TransformationGUI_RotationDlg::Init()
myAxis = myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
initName( tr( "GEOM_ROTATION" ).toLatin1().constData() );
initName( tr( "GEOM_ROTATION" ) );
ConstructorsClicked( 0 );
}
@ -161,33 +159,30 @@ void TransformationGUI_RotationDlg::ConstructorsClicked(int constructorId)
myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection();
switch (constructorId)
{
switch ( constructorId ) {
case 0: /* rotation an object angle and axis */
{
GroupPoints->ShowRows( 2, 3, false );
resize(0,0);
GroupPoints->TextLabel2->setText( tr( "GEOM_AXIS" ) );
GroupPoints->LineEdit2->clear();
GroupPoints->ShowRows( 4, 4, true );
myAxis = GEOM::GEOM_Object::_nil();
break;
}
case 1: /* rotation an object by 3 points */
{
GroupPoints->ShowRows( 4, 4, false );
resize(0,0);
GroupPoints->ShowRows( 2, 3, true );
GroupPoints->TextLabel2->setText( tr( "GEOM_CENTRAL_POINT" ) );
GroupPoints->TextLabel4->setText(tr("GEOM_POINT_I").arg("1"));
GroupPoints->TextLabel5->setText(tr("GEOM_POINT_I").arg("2"));
GroupPoints->TextLabel4->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
GroupPoints->TextLabel5->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
GroupPoints->LineEdit2->clear();
GroupPoints->LineEdit4->clear();
GroupPoints->LineEdit5->clear();
myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
break;
}
}
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
myEditCurrentArgument->setFocus();
connect( myGeomGUI->getApp()->selectionMgr(),
@ -229,11 +224,9 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
myEditCurrentArgument->setText( "" );
QString aName;
if(myEditCurrentArgument == GroupPoints->LineEdit1)
{
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName );
if(aNbSel < 1)
{
if ( aNbSel < 1) {
myObjects.length( 0 );
return;
}
@ -241,10 +234,8 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
if ( !myObjects.length() )
return;
}
else
{
if(IObjectCount() != 1)
{
else {
if ( IObjectCount() != 1 ) {
if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0 )
myAxis = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 )
@ -295,13 +286,11 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument()
getConstructorId() == 0 ? globalSelection( GEOM_LINE ) :
globalSelection( GEOM_POINT );
}
else if (send == GroupPoints->PushButton4)
{
else if ( send == GroupPoints->PushButton4 ) {
myEditCurrentArgument = GroupPoints->LineEdit4;
globalSelection( GEOM_POINT );
}
else if (send == GroupPoints->PushButton5)
{
else if ( send == GroupPoints->PushButton5 ) {
myEditCurrentArgument = GroupPoints->LineEdit5;
globalSelection( GEOM_POINT );
}
@ -319,8 +308,7 @@ void TransformationGUI_RotationDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 ||
send == GroupPoints->LineEdit2)
{
send == GroupPoints->LineEdit2 ) {
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
@ -345,9 +333,9 @@ void TransformationGUI_RotationDlg::ActivateThisDialog()
// function : enterEvent()
// purpose :
//=================================================================================
void TransformationGUI_RotationDlg::enterEvent(QEvent* e)
void TransformationGUI_RotationDlg::enterEvent( QEvent* )
{
if (!GroupConstructors->isEnabled())
if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog();
}
@ -376,21 +364,17 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_RotationDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool TransformationGUI_RotationDlg::isValid( QString& msg )
{
switch (getConstructorId())
bool TransformationGUI_RotationDlg::isValid( QString& /*msg*/ )
{
switch ( getConstructorId() ) {
case 0:
{
return !( myObjects.length() == 0 || myAxis->_is_nil() );
break;
}
case 1:
{
return !( myObjects.length() == 0 || myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil() );
break;
}
default: return false;
default:
return false;
}
}
@ -406,43 +390,42 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() )
{
switch ( getConstructorId() ) {
case 0 :
{
if (toCreateCopy)
for (int i = 0; i < myObjects.length(); i++)
{
if ( toCreateCopy ) {
for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateCopy( myObjects[i], myAxis, GetAngle() * PI180 );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
else
for (int i = 0; i < myObjects.length(); i++)
{
}
else {
for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->Rotate( myObjects[i], myAxis, GetAngle() * PI180 );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
}
res = true;
break;
}
case 1 :
{
if (toCreateCopy)
for (int i = 0; i < myObjects.length(); i++)
{
if ( toCreateCopy ) {
for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePointsCopy( myObjects[i], myCentPoint, myPoint1, myPoint2 );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
else
for (int i = 0; i < myObjects.length(); i++)
{
}
else {
for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePoints( myObjects[i], myCentPoint, myPoint1, myPoint2 );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
}
res = true;
break;
}
@ -468,7 +451,7 @@ void TransformationGUI_RotationDlg::closeEvent( QCloseEvent* e )
//=================================================================================
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 )
{
this->GroupBoxName->setEnabled(isCreateCopy);
mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
}
@ -488,6 +471,6 @@ void TransformationGUI_RotationDlg::CreateCopyModeChanged(bool isCreateCopy)
//=================================================================================
void TransformationGUI_RotationDlg::onReverse()
{
double anOldValue = GroupPoints->SpinBox_DX->GetValue();
GroupPoints->SpinBox_DX->SetValue( -anOldValue );
double anOldValue = GroupPoints->SpinBox_DX->value();
GroupPoints->SpinBox_DX->setValue( -anOldValue );
}

View File

@ -19,16 +19,14 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : TransformationGUI_RotationDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
//
#ifndef DIALOGBOX_ROTATION_H
#define DIALOGBOX_ROTATION_H
#ifndef TRANSFORMATIONGUI_ROTATIONDLG_H
#define TRANSFORMATIONGUI_ROTATIONDLG_H
#include "GEOMBase_Skeleton.h"
#include <GEOMBase_Skeleton.h>
class DlgRef_4Sel1Spin2Check;
@ -41,23 +39,24 @@ class TransformationGUI_RotationDlg : public GEOMBase_Skeleton
Q_OBJECT
public:
TransformationGUI_RotationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
TransformationGUI_RotationDlg( GeometryGUI*, QWidget* = 0,
bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_RotationDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e );
virtual void closeEvent( QCloseEvent* );
private:
void Init();
void enterEvent(QEvent* e);
void enterEvent( QEvent* );
double GetAngle() const;
private:
GEOM::ListOfGO myObjects;
GEOM::GEOM_Object_var myAxis, myCentPoint, myPoint1, myPoint2;
@ -71,9 +70,9 @@ private slots:
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ValueChangedInSpinBox();
void CreateCopyModeChanged(bool isCreateCopy);
void ConstructorsClicked(int constructorId);
void CreateCopyModeChanged( bool );
void ConstructorsClicked( int );
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
//
//
//
// File : TransformationGUI_ScaleDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
#include "TransformationGUI_ScaleDlg.h"
#include "DlgRef_2Sel1Spin2Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h"
#include "GEOMBase.h"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h"
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include "GEOMImpl_Types.hxx"
using namespace std;
#include <GEOMImpl_Types.hxx>
//=================================================================================
// class : TransformationGUI_ScaleDlg()
@ -50,8 +43,8 @@ using namespace std;
// TRUE to construct a modal dialog.
//=================================================================================
TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, Qt::WindowFlags fl)
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
bool modal, Qt::WindowFlags fl )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SCALE" ) ) );
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" ) );
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_SCALE"));
RadioButton1->setIcon(image0);
RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
RadioButton2->close();
RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close();
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_SCALE" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints");
GroupPoints = new DlgRef_2Sel1Spin2Check( centralWidget() );
GroupPoints->CheckButton2->hide();
GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
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
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 SpecificStep = 0.5;
/* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, 3);
GroupPoints->SpinBox_DX->SetValue(aFactor);
initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, 3 );
GroupPoints->SpinBox_DX->setValue( aFactor );
// Activate Create a Copy mode
GroupPoints->CheckButton1->setChecked( true );
CreateCopyModeChanged( true );
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( GroupPoints->PushButton1, 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->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
// VSR: TODO ->>
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) );
// <<-
connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) );
connect( myGeomGUI->getApp()->selectionMgr(),
@ -137,7 +135,7 @@ void TransformationGUI_ScaleDlg::Init()
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( "" );
QString aName;
if(myEditCurrentArgument == GroupPoints->LineEdit1)
{
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName );
if(aNbSel < 1)
{
if ( aNbSel < 1 ) {
myObjects.length( 0 );
return;
}
@ -187,10 +183,8 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
if ( !myObjects.length() )
return;
}
else if(myEditCurrentArgument == GroupPoints->LineEdit2)
{
if(IObjectCount() != 1)
{
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
if ( IObjectCount() != 1 ) {
myPoint = GEOM::GEOM_Object::_nil();
return;
}
@ -214,8 +208,7 @@ void TransformationGUI_ScaleDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 ||
send == GroupPoints->LineEdit2)
{
send == GroupPoints->LineEdit2 ) {
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
@ -263,9 +256,9 @@ void TransformationGUI_ScaleDlg::ActivateThisDialog()
// function : enterEvent()
// purpose :
//=================================================================================
void TransformationGUI_ScaleDlg::enterEvent(QEvent* e)
void TransformationGUI_ScaleDlg::enterEvent( QEvent* )
{
if( !GroupConstructors->isEnabled() )
if( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog();
}
@ -293,7 +286,7 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool TransformationGUI_ScaleDlg::isValid( QString& msg )
bool TransformationGUI_ScaleDlg::isValid( QString& /*msg*/)
{
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 res = false;
GEOM::GEOM_Object_var anObj;
if (GroupPoints->CheckButton1->isChecked() || IsPreview())
for (int i = 0; i < myObjects.length(); i++)
{
if ( GroupPoints->CheckButton1->isChecked() || IsPreview() ) {
for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShapeCopy( myObjects[i], myPoint, GetFactor() );
if ( !anObj->_is_nil() )
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() );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
res = true;
return res;
}
return true;
}
@ -345,7 +334,7 @@ void TransformationGUI_ScaleDlg::closeEvent( QCloseEvent* e )
//=================================================================================
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 )
{
this->GroupBoxName->setEnabled(isCreateCopy);
mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
}

View File

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