*** empty log message ***

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

View File

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

View File

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

View File

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

View File

@ -199,7 +199,7 @@ void EntityGUI_SubShapeDlg::SelectionIntoArgument()
QString aString = ""; /* name of selection */ QString aString = ""; /* name of selection */
int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true ); int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true );
if( nbSel != 1 ) if ( nbSel != 1 )
return; return;
TopoDS_Shape S; TopoDS_Shape S;

View File

@ -1,31 +1,28 @@
# GEOM TRANSFORMATIONGUI : # GEOM TRANSFORMATIONGUI :
# #
# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either # License as published by the Free Software Foundation; either
# version 2.1 of the License. # version 2.1 of the License.
# #
# This library is distributed in the hope that it will be useful, # This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details. # Lesser General Public License for more details.
# #
# You should have received a copy of the GNU Lesser General Public # You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software # License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
# File : Makefile.am
# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
# Package : BooleanGUI
# #
#
# File : Makefile.in
# Author : Damien COQUERET (OCC)
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
# $Header:
include $(top_srcdir)/adm_local/unix/make_common_starter.am include $(top_srcdir)/adm_local/unix/make_common_starter.am
@ -35,28 +32,38 @@ salomeinclude_HEADERS =
# Libraries targets # Libraries targets
lib_LTLIBRARIES = libTransformationGUI.la lib_LTLIBRARIES = libTransformationGUI.la
dist_libTransformationGUI_la_SOURCES = \ dist_libTransformationGUI_la_SOURCES = \
TransformationGUI.cxx \ TransformationGUI.h \
TransformationGUI_MultiTranslationDlg.cxx \ TransformationGUI_MultiTranslationDlg.h \
TransformationGUI_MultiRotationDlg.cxx \ TransformationGUI_MultiRotationDlg.h \
TransformationGUI_TranslationDlg.cxx \ TransformationGUI_TranslationDlg.h \
TransformationGUI_RotationDlg.cxx \ TransformationGUI_RotationDlg.h \
TransformationGUI_MirrorDlg.cxx \ TransformationGUI_MirrorDlg.h \
TransformationGUI_ScaleDlg.cxx \ TransformationGUI_ScaleDlg.h \
TransformationGUI_OffsetDlg.cxx \ TransformationGUI_OffsetDlg.h \
TransformationGUI_PositionDlg.h \
\
TransformationGUI.cxx \
TransformationGUI_MultiTranslationDlg.cxx \
TransformationGUI_MultiRotationDlg.cxx \
TransformationGUI_TranslationDlg.cxx \
TransformationGUI_RotationDlg.cxx \
TransformationGUI_MirrorDlg.cxx \
TransformationGUI_ScaleDlg.cxx \
TransformationGUI_OffsetDlg.cxx \
TransformationGUI_PositionDlg.cxx TransformationGUI_PositionDlg.cxx
MOC_FILES = \ MOC_FILES = \
TransformationGUI_MultiTranslationDlg_moc.cxx \ TransformationGUI_MultiTranslationDlg_moc.cxx \
TransformationGUI_MultiRotationDlg_moc.cxx \ TransformationGUI_MultiRotationDlg_moc.cxx \
TransformationGUI_TranslationDlg_moc.cxx \ TransformationGUI_TranslationDlg_moc.cxx \
TransformationGUI_RotationDlg_moc.cxx \ TransformationGUI_RotationDlg_moc.cxx \
TransformationGUI_MirrorDlg_moc.cxx \ TransformationGUI_MirrorDlg_moc.cxx \
TransformationGUI_ScaleDlg_moc.cxx \ TransformationGUI_ScaleDlg_moc.cxx \
TransformationGUI_OffsetDlg_moc.cxx \ TransformationGUI_OffsetDlg_moc.cxx \
TransformationGUI_PositionDlg_moc.cxx TransformationGUI_PositionDlg_moc.cxx
nodist_libTransformationGUI_la_SOURCES= \ nodist_libTransformationGUI_la_SOURCES = \
$(MOC_FILES) $(MOC_FILES)
#LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl SALOME_Exception.idl #LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl SALOME_Exception.idl
@ -65,24 +72,25 @@ nodist_libTransformationGUI_la_SOURCES= \
# additionnal information to compil and link file # additionnal information to compil and link file
libTransformationGUI_la_CPPFLAGS = \ libTransformationGUI_la_CPPFLAGS = \
$(QT_INCLUDES) \ $(QT_INCLUDES) \
$(VTK_INCLUDES) \ $(VTK_INCLUDES) \
$(CAS_CPPFLAGS) \ $(CAS_CPPFLAGS) \
$(PYTHON_INCLUDES) \ $(PYTHON_INCLUDES) \
$(BOOST_CPPFLAGS) \ $(BOOST_CPPFLAGS) \
$(KERNEL_CXXFLAGS) \ $(KERNEL_CXXFLAGS) \
$(GUI_CXXFLAGS) \ $(GUI_CXXFLAGS) \
$(CORBA_CXXFLAGS) \ $(CORBA_CXXFLAGS) \
$(CORBA_INCLUDES) \ $(CORBA_INCLUDES) \
-I$(srcdir)/../GEOMGUI \ -I$(srcdir)/../GEOMGUI \
-I$(srcdir)/../DlgRef \ -I$(srcdir)/../DlgRef \
-I$(srcdir)/../GEOMBase \ -I$(srcdir)/../GEOMBase \
-I$(srcdir)/../OBJECT \ -I$(srcdir)/../OBJECT \
-I$(srcdir)/../GEOMClient \ -I$(srcdir)/../GEOMClient \
-I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMImpl \
-I$(srcdir)/../GEOMFiltersSelection \ -I$(srcdir)/../GEOMFiltersSelection \
-I$(top_builddir)/idl \ -I$(top_builddir)/src/DlgRef \
-I$(top_builddir)/idl \
-I$(top_builddir)/salome_adm/unix -I$(top_builddir)/salome_adm/unix
libTransformationGUI_la_LDFLAGS = \ libTransformationGUI_la_LDFLAGS = \

View File

@ -1,37 +1,34 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : TransformationGUI.cxx
// Author : Damien COQUERET, Open CASCADE S.A.S.
// //
//
// File : TransformationGUI.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header$
#include "TransformationGUI.h" #include "TransformationGUI.h"
#include "GeometryGUI.h"
#include "SUIT_Desktop.h" #include <GeometryGUI.h>
#include "SalomeApp_Application.h" #include <SUIT_Desktop.h>
#include <SalomeApp_Application.h>
#include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION #include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION
#include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION #include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION
@ -42,13 +39,12 @@
#include "TransformationGUI_OffsetDlg.h" // Method OFFSET #include "TransformationGUI_OffsetDlg.h" // Method OFFSET
#include "TransformationGUI_PositionDlg.h" // Method POSITION #include "TransformationGUI_PositionDlg.h" // Method POSITION
using namespace std;
//======================================================================= //=======================================================================
// function : TransformationGUI() // function : TransformationGUI()
// purpose : Constructor // purpose : Constructor
//======================================================================= //=======================================================================
TransformationGUI::TransformationGUI(GeometryGUI* parent) : GEOMGUI(parent) TransformationGUI::TransformationGUI( GeometryGUI* parent )
: GEOMGUI( parent )
{ {
} }
@ -65,46 +61,45 @@ TransformationGUI::~TransformationGUI()
// function : OnGUIEvent() // function : OnGUIEvent()
// purpose : // purpose :
//======================================================================= //=======================================================================
bool TransformationGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) bool TransformationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
{ {
SalomeApp_Application* app = getGeometryGUI()->getApp(); SalomeApp_Application* app = getGeometryGUI()->getApp();
if (!app) return false; if ( !app ) return false;
getGeometryGUI()->EmitSignalDeactivateDialog(); getGeometryGUI()->EmitSignalDeactivateDialog();
QDialog* aDlg = NULL; QDialog* aDlg = NULL;
switch (theCommandID) switch ( theCommandID ) {
{
case 5021: // TRANSLATION case 5021: // TRANSLATION
aDlg = new TransformationGUI_TranslationDlg( getGeometryGUI(), parent, "" ); aDlg = new TransformationGUI_TranslationDlg( getGeometryGUI(), parent );
break; break;
case 5022: // ROTATION case 5022: // ROTATION
aDlg = new TransformationGUI_RotationDlg( getGeometryGUI(), parent, "" ); aDlg = new TransformationGUI_RotationDlg( getGeometryGUI(), parent );
break; break;
case 5023: // POSITION case 5023: // POSITION
aDlg = new TransformationGUI_PositionDlg( getGeometryGUI(), parent, "" ); aDlg = new TransformationGUI_PositionDlg( getGeometryGUI(), parent );
break; break;
case 5024: // MIRROR case 5024: // MIRROR
aDlg = new TransformationGUI_MirrorDlg( getGeometryGUI(), parent, "" ); aDlg = new TransformationGUI_MirrorDlg( getGeometryGUI(), parent );
break; break;
case 5025: // SCALE case 5025: // SCALE
aDlg = new TransformationGUI_ScaleDlg( getGeometryGUI(), parent, "" ); aDlg = new TransformationGUI_ScaleDlg( getGeometryGUI(), parent );
break; break;
case 5026: // OFFSET case 5026: // OFFSET
aDlg = new TransformationGUI_OffsetDlg( getGeometryGUI(), parent, "" ); aDlg = new TransformationGUI_OffsetDlg( getGeometryGUI(), parent );
break; break;
case 5027: // MULTI TRANSLATION case 5027: // MULTI TRANSLATION
aDlg = new TransformationGUI_MultiTranslationDlg( getGeometryGUI(), parent, "" ); aDlg = new TransformationGUI_MultiTranslationDlg( getGeometryGUI(), parent );
break; break;
case 5028: // MULTI ROTATION case 5028: // MULTI ROTATION
aDlg = new TransformationGUI_MultiRotationDlg( getGeometryGUI(), parent, "" ); aDlg = new TransformationGUI_MultiRotationDlg( getGeometryGUI(), parent );
break; break;
default: default:
app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
break; break;
} }
if (aDlg != NULL) if ( aDlg != NULL )
aDlg->show(); aDlg->show();
return true; return true;
@ -117,7 +112,7 @@ bool TransformationGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
extern "C" extern "C"
{ {
#ifdef WNT #ifdef WNT
__declspec( dllexport ) __declspec( dllexport )
#endif #endif
GEOMGUI* GetLibGUI( GeometryGUI* parent ) GEOMGUI* GetLibGUI( GeometryGUI* parent )
{ {

View File

@ -1,35 +1,32 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : TransformationGUI.h
// Author : Damien COQUERET, Open CASCADE S.A.S.
// //
//
// File : TransformationGUI.h
// Author : Damien COQUERET
// Module : GEOM
#ifndef TRANSFORMATIONGUI_H #ifndef TRANSFORMATIONGUI_H
#define TRANSFORMATIONGUI_H #define TRANSFORMATIONGUI_H
#include "GEOMGUI.h" #include <GEOMGUI.h>
//================================================================================= //=================================================================================
// class : TransformationGUI // class : TransformationGUI
@ -38,10 +35,10 @@
class TransformationGUI : public GEOMGUI class TransformationGUI : public GEOMGUI
{ {
public: public:
TransformationGUI( GeometryGUI* parent ); TransformationGUI( GeometryGUI* );
~TransformationGUI(); ~TransformationGUI();
bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); bool OnGUIEvent( int, SUIT_Desktop* );
}; };
#endif #endif // TRANSFORMATIONGUI_H

View File

@ -1,46 +1,40 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : TransformationGUI_MirrorDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : TransformationGUI_MirrorDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#include "TransformationGUI_MirrorDlg.h" #include "TransformationGUI_MirrorDlg.h"
#include "DlgRef_2Sel1Spin2Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h" #include <GEOM_DlgRef.h>
#include "GEOMBase.h" #include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h" #include <SUIT_ResourceMgr.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
#include "GEOMImpl_Types.hxx" #include <GEOMImpl_Types.hxx>
using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_MirrorDlg() // class : TransformationGUI_MirrorDlg()
@ -49,38 +43,41 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg(GeometryGUI* theGeometryGUI, QWidget* parent, TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, Qt::WindowFlags fl) bool modal, Qt::WindowFlags fl )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{ {
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_MIRROR_POINT"))); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_MIRROR_POINT" ) ) );
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_MIRROR_AXE"))); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_MIRROR_AXE" ) ) );
QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_MIRROR_PLANE"))); QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_MIRROR_PLANE" ) ) );
QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setWindowTitle(tr("GEOM_MIRROR_TITLE")); setWindowTitle( tr( "GEOM_MIRROR_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_MIRROR")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_MIRROR" ) );
RadioButton1->setIcon(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setIcon(image1); mainFrame()->RadioButton2->setIcon( image1 );
RadioButton3->setIcon(image2); mainFrame()->RadioButton3->setIcon( image2 );
GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints"); GroupPoints = new DlgRef_2Sel1Spin2Check( centralWidget() );
GroupPoints->SpinBox_DX->hide(); GroupPoints->SpinBox_DX->hide();
GroupPoints->TextLabel3->hide(); GroupPoints->TextLabel3->hide();
GroupPoints->CheckButton2->hide(); GroupPoints->CheckButton2->hide();
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
GroupPoints->TextLabel2->setText(tr("GEOM_POINT_MIRROR")); GroupPoints->TextLabel2->setText( tr( "GEOM_POINT_MIRROR" ) );
GroupPoints->TextLabel2->setFixedWidth(74); GroupPoints->TextLabel2->setFixedWidth( 74 );
GroupPoints->PushButton1->setIcon(image3); GroupPoints->PushButton1->setIcon( image3 );
GroupPoints->PushButton2->setIcon(image3); GroupPoints->PushButton2->setIcon( image3 );
GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY")); GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) );
gridLayout1->addWidget(GroupPoints, 2, 0);
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
/***************************************************************/ /***************************************************************/
setHelpFileName("mirror_image.htm"); setHelpFileName( "mirror_image.htm" );
Init(); Init();
} }
@ -104,32 +101,34 @@ void TransformationGUI_MirrorDlg::Init()
{ {
/* init variables */ /* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setReadOnly(true); GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly(true); GroupPoints->LineEdit2->setReadOnly( true );
myArgument = GEOM::GEOM_Object::_nil(); myArgument = GEOM::GEOM_Object::_nil();
// Activate Create a Copy mode // Activate Create a Copy mode
GroupPoints->CheckButton1->setChecked(true); GroupPoints->CheckButton1->setChecked( true );
CreateCopyModeChanged(true); CreateCopyModeChanged( true );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) );
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_MIRROR" ) );
initName( tr( "GEOM_MIRROR" ).toLatin1().constData() );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -138,7 +137,7 @@ void TransformationGUI_MirrorDlg::Init()
// function : ConstructorsClicked() // function : ConstructorsClicked()
// purpose : Radio button management // purpose : Radio button management
//================================================================================= //=================================================================================
void TransformationGUI_MirrorDlg::ConstructorsClicked(int constructorId) void TransformationGUI_MirrorDlg::ConstructorsClicked( int constructorId )
{ {
disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 ); disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
@ -147,26 +146,20 @@ void TransformationGUI_MirrorDlg::ConstructorsClicked(int constructorId)
GroupPoints->LineEdit2->clear(); GroupPoints->LineEdit2->clear();
myArgument = GEOM::GEOM_Object::_nil(); myArgument = GEOM::GEOM_Object::_nil();
switch (constructorId) switch ( constructorId ) {
{ case 0: /* mirror an object by point */
case 0: /* mirror an object by point */ GroupPoints->TextLabel2->setText( tr( "GEOM_POINT_MIRROR" ) );
{ break;
GroupPoints->TextLabel2->setText(tr("GEOM_POINT_MIRROR")); case 1: /* mirror an object by axe */
break; GroupPoints->TextLabel2->setText( tr( "GEOM_AXE_MIRROR" ) );
} break;
case 1: /* mirror an object by axe */ case 2: /* mirror an object by plane */
{ GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE_MIRROR" ) );
GroupPoints->TextLabel2->setText(tr("GEOM_AXE_MIRROR")); break;
break; }
}
case 2: /* mirror an object by plane */ connect( myGeomGUI->getApp()->selectionMgr(),
{ SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
GroupPoints->TextLabel2->setText(tr("GEOM_PLANE_MIRROR"));
break;
}
}
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
} }
@ -188,7 +181,7 @@ void TransformationGUI_MirrorDlg::ClickOnOk()
//================================================================================= //=================================================================================
bool TransformationGUI_MirrorDlg::ClickOnApply() bool TransformationGUI_MirrorDlg::ClickOnApply()
{ {
if ( !onAccept(GroupPoints->CheckButton1->isChecked()) ) if ( !onAccept( GroupPoints->CheckButton1->isChecked() ) )
return false; return false;
initName(); initName();
@ -203,36 +196,32 @@ bool TransformationGUI_MirrorDlg::ClickOnApply()
//================================================================================= //=================================================================================
void TransformationGUI_MirrorDlg::SelectionIntoArgument() void TransformationGUI_MirrorDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText( "" );
QString aName; QString aName;
if(myEditCurrentArgument == GroupPoints->LineEdit1) if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
{ int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName );
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); if ( aNbSel < 1 ) {
if(aNbSel < 1) myObjects.length( 0 );
{ return;
myObjects.length(0);
return;
}
GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects);
if (!myObjects.length())
return;
if(aNbSel != 1)
aName = tr("%1_objects").arg(aNbSel);
} }
else if(myEditCurrentArgument == GroupPoints->LineEdit2) GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myObjects );
{ if ( !myObjects.length() )
if(IObjectCount() != 1) return;
{ if ( aNbSel != 1 )
myArgument = GEOM::GEOM_Object::_nil(); aName = tr( "%1_objects" ).arg( aNbSel );
return; }
} else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
Standard_Boolean testResult = Standard_False; if ( IObjectCount() != 1 ) {
myArgument = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); myArgument = GEOM::GEOM_Object::_nil();
if(!testResult || CORBA::is_nil( myArgument )) return;
return;
aName = GEOMBase::GetName( myArgument );
} }
Standard_Boolean testResult = Standard_False;
myArgument = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
if ( !testResult || CORBA::is_nil( myArgument ) )
return;
aName = GEOMBase::GetName( myArgument );
}
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText( aName );
displayPreview(); displayPreview();
@ -246,12 +235,11 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
void TransformationGUI_MirrorDlg::LineEditReturnPressed() void TransformationGUI_MirrorDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if(send == GroupPoints->LineEdit1 || if ( send == GroupPoints->LineEdit1 ||
send == GroupPoints->LineEdit2) send == GroupPoints->LineEdit2 ) {
{ myEditCurrentArgument = send;
myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed();
GEOMBase_Skeleton::LineEditReturnPressed(); }
}
} }
@ -263,30 +251,23 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1){ if ( send == GroupPoints->PushButton1 ) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection(); globalSelection();
} }
else if(send == GroupPoints->PushButton2) { else if ( send == GroupPoints->PushButton2 ) {
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
switch(getConstructorId()) switch ( getConstructorId() ) {
{ case 0:
case 0: globalSelection( GEOM_POINT );
{ break;
globalSelection( GEOM_POINT ); case 1:
break; globalSelection( GEOM_LINE );
} break;
case 1: case 2:
{ globalSelection( GEOM_PLANE );
globalSelection( GEOM_LINE ); break;
break; }
}
case 2:
{
globalSelection( GEOM_PLANE );
break;
}
}
} }
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
@ -301,8 +282,8 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
void TransformationGUI_MirrorDlg::ActivateThisDialog() void TransformationGUI_MirrorDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
} }
@ -311,9 +292,9 @@ void TransformationGUI_MirrorDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : when mouse enter onto the QWidget // purpose : when mouse enter onto the QWidget
//================================================================================= //=================================================================================
void TransformationGUI_MirrorDlg::enterEvent(QEvent * e) void TransformationGUI_MirrorDlg::enterEvent( QEvent* )
{ {
if(!GroupConstructors->isEnabled()) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -332,9 +313,9 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MirrorDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool TransformationGUI_MirrorDlg::isValid( QString& msg ) bool TransformationGUI_MirrorDlg::isValid( QString& /*msg*/ )
{ {
return !(myObjects.length() == 0 || myArgument->_is_nil()); return !( myObjects.length() == 0 || myArgument->_is_nil() );
} }
@ -349,66 +330,65 @@ bool TransformationGUI_MirrorDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() ) {
case 0:
{ {
case 0 : if ( toCreateCopy ) {
{ for ( int i = 0; i < myObjects.length(); i++ ) {
if (toCreateCopy) anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPointCopy( myObjects[i], myArgument );
for (int i = 0; i < myObjects.length(); i++) if ( !anObj->_is_nil() )
{ objects.push_back( anObj._retn() );
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++)
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPoint( myObjects[i], myArgument );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
res = true;
break;
} }
case 1 : else {
{ for ( int i = 0; i < myObjects.length(); i++ ) {
if (toCreateCopy) anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPoint( myObjects[i], myArgument );
for (int i = 0; i < myObjects.length(); i++) if ( !anObj->_is_nil() )
{ objects.push_back( anObj._retn() );
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++)
{
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++)
{
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++)
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlane( myObjects[i], myArgument );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
res = true;
break;
} }
res = true;
break;
} }
case 1:
{
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++ ) {
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++ ) {
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++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlane( myObjects[i], myArgument );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
}
res = true;
break;
}
}
return res; return res;
} }
@ -427,7 +407,7 @@ void TransformationGUI_MirrorDlg::closeEvent( QCloseEvent* e )
// function : CreateCopyModeChanged() // function : CreateCopyModeChanged()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_MirrorDlg::CreateCopyModeChanged(bool isCreateCopy) void TransformationGUI_MirrorDlg::CreateCopyModeChanged( bool isCreateCopy )
{ {
this->GroupBoxName->setEnabled(isCreateCopy); mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
} }

View File

@ -1,34 +1,32 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : TransformationGUI_MirrorDlg.h
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : TransformationGUI_MirrorDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
#ifndef DIALOGBOX_MIRROR_H #ifndef TRANSFORMATIONGUI_MIRRORDLG_H
#define DIALOGBOX_MIRROR_H #define TRANSFORMATIONGUI_MIRRORDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class DlgRef_2Sel1Spin2Check; class DlgRef_2Sel1Spin2Check;
@ -38,39 +36,40 @@ class DlgRef_2Sel1Spin2Check;
//================================================================================= //=================================================================================
class TransformationGUI_MirrorDlg : public GEOMBase_Skeleton class TransformationGUI_MirrorDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
TransformationGUI_MirrorDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, TransformationGUI_MirrorDlg( GeometryGUI*, QWidget* = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_MirrorDlg(); ~TransformationGUI_MirrorDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e ); virtual void closeEvent( QCloseEvent* );
private: private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent( QEvent* );
GEOM::GEOM_Object_var myArgument; private:
GEOM::ListOfGO myObjects; GEOM::GEOM_Object_var myArgument;
GEOM::ListOfGO myObjects;
DlgRef_2Sel1Spin2Check* GroupPoints;
DlgRef_2Sel1Spin2Check* GroupPoints;
private slots : private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ConstructorsClicked(int constructorId); void ConstructorsClicked( int );
void CreateCopyModeChanged(bool isCreateCopy); void CreateCopyModeChanged( bool );
}; };
#endif // DIALOGBOX_MIRROR_H #endif // TRANSFORMATIONGUI_MIRRORDLG_H

View File

@ -1,47 +1,40 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : TransformationGUI_MultiRotationDlg.cxx
// Author : Damien COQUERET, Open CASCADE S.A.S.
// //
//
// File : TransformationGUI_MultiRotationDlg.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header$
#include "TransformationGUI_MultiRotationDlg.h" #include "TransformationGUI_MultiRotationDlg.h"
#include "DlgRef_2Sel4Spin1Check.h"
#include "DlgRef_2Sel1Spin.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h" #include <GEOM_DlgRef.h>
#include "GEOMBase.h" #include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h" #include <SUIT_ResourceMgr.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
#include "GEOMImpl_Types.hxx" #include <GEOMImpl_Types.hxx>
using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_MultiRotationDlg() // class : TransformationGUI_MultiRotationDlg()
@ -51,52 +44,54 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg
(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) ( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{ {
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0(aResMgr->loadPixmap("GEOM",tr("ICON_DLG_MULTIROTATION_SIMPLE"))); QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_MULTIROTATION_SIMPLE" ) ) );
QPixmap image1(aResMgr->loadPixmap("GEOM",tr("ICON_DLG_MULTIROTATION_DOUBLE"))); QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_MULTIROTATION_DOUBLE" ) ) );
QPixmap image2(aResMgr->loadPixmap("GEOM",tr("ICON_SELECT"))); QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setWindowTitle(tr("GEOM_MULTIROTATION_TITLE")); setWindowTitle( tr( "GEOM_MULTIROTATION_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_MULTIROTATION")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_MULTIROTATION" ) );
RadioButton1->setIcon(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setIcon(image1); mainFrame()->RadioButton2->setIcon( image1 );
RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close(); mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_2Sel1Spin(this, "GroupPoints"); GroupPoints = new DlgRef_2Sel1Spin( centralWidget() );
GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_SIMPLE")); GroupPoints->GroupBox1->setTitle( tr( "GEOM_MULTIROTATION_SIMPLE" ) );
GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); GroupPoints->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) );
GroupPoints->TextLabel3->setText(tr("GEOM_NB_TIMES")); GroupPoints->TextLabel3->setText( tr( "GEOM_NB_TIMES" ) );
GroupPoints->PushButton1->setIcon(image2); GroupPoints->PushButton1->setIcon( image2 );
GroupPoints->PushButton2->setIcon(image2); GroupPoints->PushButton2->setIcon( image2 );
GroupPoints->LineEdit1->setReadOnly(true); GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly(true); GroupPoints->LineEdit2->setReadOnly( true );
GroupDimensions = new DlgRef_2Sel4Spin1Check(this, "GroupDimensions"); GroupDimensions = new DlgRef_2Sel4Spin1Check( centralWidget() );
GroupDimensions->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_DOUBLE")); GroupDimensions->GroupBox1->setTitle( tr( "GEOM_MULTIROTATION_DOUBLE" ) );
GroupDimensions->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); GroupDimensions->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
GroupDimensions->TextLabel2->setText(tr("GEOM_VECTOR")); GroupDimensions->TextLabel2->setText( tr( "GEOM_VECTOR" ) );
GroupDimensions->TextLabel3->setText(tr("GEOM_ANGLE")); GroupDimensions->TextLabel3->setText( tr( "GEOM_ANGLE" ) );
GroupDimensions->TextLabel4->setText(tr("GEOM_NB_TIMES")); GroupDimensions->TextLabel4->setText( tr( "GEOM_NB_TIMES" ) );
GroupDimensions->TextLabel5->setText(tr("GEOM_STEP")); GroupDimensions->TextLabel5->setText( tr( "GEOM_STEP" ) );
GroupDimensions->TextLabel6->setText(tr("GEOM_NB_TIMES")); GroupDimensions->TextLabel6->setText( tr( "GEOM_NB_TIMES" ) );
GroupDimensions->CheckButton1->setText(tr("GEOM_REVERSE")); GroupDimensions->CheckButton1->setText( tr( "GEOM_REVERSE" ) );
GroupDimensions->PushButton1->setIcon(image2); GroupDimensions->PushButton1->setIcon( image2 );
GroupDimensions->PushButton2->setIcon(image2); GroupDimensions->PushButton2->setIcon( image2 );
GroupDimensions->LineEdit1->setReadOnly(true); GroupDimensions->LineEdit1->setReadOnly( true );
GroupDimensions->LineEdit2->setReadOnly(true); GroupDimensions->LineEdit2->setReadOnly( true );
gridLayout1->addWidget(GroupPoints, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
gridLayout1->addWidget(GroupDimensions, 2, 0); layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
layout->addWidget( GroupDimensions );
/***************************************************************/ /***************************************************************/
setHelpFileName("multi_rotation.htm"); setHelpFileName( "multi_rotation.htm" );
Init(); Init();
} }
@ -120,56 +115,60 @@ void TransformationGUI_MultiRotationDlg::Init()
{ {
/* Get setting of step value from file configuration */ /* Get setting of step value from file configuration */
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
double SpecificStep1 = 5; double SpecificStep1 = 5;
double SpecificStep2 = 1; double SpecificStep2 = 1;
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3); initSpinBox( GroupPoints->SpinBox_DX, 1.0, MAX_NUMBER, SpecificStep2, 3 );
GroupPoints->SpinBox_DX->SetValue(myNbTimes1); GroupPoints->SpinBox_DX->setValue( myNbTimes1 );
GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep1, 3); initSpinBox( GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, 3 );
GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3); initSpinBox( GroupDimensions->SpinBox_DY1, 1.0, MAX_NUMBER, SpecificStep2, 3 );
GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); initSpinBox( GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, 3 );
GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3); initSpinBox( GroupDimensions->SpinBox_DY2, 1.0, MAX_NUMBER, SpecificStep2, 3 );
GroupDimensions->SpinBox_DX1->SetValue(myAng); GroupDimensions->SpinBox_DX1->setValue( myAng );
GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1); GroupDimensions->SpinBox_DY1->setValue( myNbTimes1 );
GroupDimensions->SpinBox_DX2->SetValue(myStep); GroupDimensions->SpinBox_DX2->setValue( myStep );
GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2); GroupDimensions->SpinBox_DY2->setValue( myNbTimes2 );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupDimensions->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupDimensions->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect( GroupDimensions->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect( GroupDimensions->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX1, SLOT(SetStep(double))); connect( GroupDimensions->SpinBox_DX1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY1, SLOT(SetStep(double))); connect( GroupDimensions->SpinBox_DY1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX2, SLOT(SetStep(double))); connect( GroupDimensions->SpinBox_DX2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY2, SLOT(SetStep(double))); connect( GroupDimensions->SpinBox_DY2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle())); // 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(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_MULTIROTATION" ) );
initName( tr( "GEOM_MULTIROTATION" ).toLatin1().constData() );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -178,9 +177,9 @@ void TransformationGUI_MultiRotationDlg::Init()
// function : ConstructorsClicked() // function : ConstructorsClicked()
// purpose : Radio button management // purpose : Radio button management
//================================================================================= //=================================================================================
void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId) void TransformationGUI_MultiRotationDlg::ConstructorsClicked( int constructorId )
{ {
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
myAng = 45.0; myAng = 45.0;
myStep = 50.0; myStep = 50.0;
@ -188,45 +187,46 @@ void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId)
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
switch (constructorId) switch ( constructorId ) {
case 0: /* Rotate simple */
{ {
case 0: /* Rotate simple */ GroupDimensions->hide();
{ GroupPoints->show();
GroupDimensions->hide();
resize(0, 0);
GroupPoints->show();
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit1->setText( "" );
GroupPoints->LineEdit2->setText(""); GroupPoints->LineEdit2->setText( "" );
GroupPoints->SpinBox_DX->SetValue(myNbTimes1); GroupPoints->SpinBox_DX->setValue( myNbTimes1 );
break; break;
}
case 1: /* Rotate double */
{
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);
break;
}
} }
case 1: /* Rotate double */
{
GroupPoints->hide();
GroupDimensions->show();
myEditCurrentArgument = GroupDimensions->LineEdit1;
GroupDimensions->LineEdit1->setText( "" );
GroupDimensions->LineEdit2->setText( "" );
GroupDimensions->SpinBox_DX1->setValue( myAng );
GroupDimensions->SpinBox_DY1->setValue( myNbTimes1 );
GroupDimensions->SpinBox_DX2->setValue( myStep );
GroupDimensions->SpinBox_DY2->setValue( myNbTimes2 );
break;
}
}
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
myBase = myVector = GEOM::GEOM_Object::_nil(); myBase = myVector = GEOM::GEOM_Object::_nil();
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
this, SLOT(SelectionIntoArgument())); this, SLOT( SelectionIntoArgument() ) );
} }
@ -262,14 +262,14 @@ bool TransformationGUI_MultiRotationDlg::ClickOnApply()
//================================================================================= //=================================================================================
void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText( "" );
if (IObjectCount() != 1) { if ( IObjectCount() != 1 ) {
if (myEditCurrentArgument == GroupPoints->LineEdit1 || if ( myEditCurrentArgument == GroupPoints->LineEdit1 ||
myEditCurrentArgument == GroupDimensions->LineEdit1) myEditCurrentArgument == GroupDimensions->LineEdit1 )
myBase = GEOM::GEOM_Object::_nil(); myBase = GEOM::GEOM_Object::_nil();
else if (myEditCurrentArgument == GroupPoints->LineEdit2 || else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
myEditCurrentArgument == GroupDimensions->LineEdit2) myEditCurrentArgument == GroupDimensions->LineEdit2 )
myVector = GEOM::GEOM_Object::_nil(); myVector = GEOM::GEOM_Object::_nil();
return; return;
} }
@ -277,16 +277,16 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False;; Standard_Boolean testResult = Standard_False;;
GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object_var aSelectedObject =
GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
if (!testResult || CORBA::is_nil(aSelectedObject) || !GEOMBase::IsShape(aSelectedObject)) if ( !testResult || CORBA::is_nil( aSelectedObject) || !GEOMBase::IsShape( aSelectedObject ) )
return; return;
if (myEditCurrentArgument == GroupPoints->LineEdit1 || if ( myEditCurrentArgument == GroupPoints->LineEdit1 ||
myEditCurrentArgument == GroupDimensions->LineEdit1) myEditCurrentArgument == GroupDimensions->LineEdit1 )
myBase = aSelectedObject; myBase = aSelectedObject;
else if (myEditCurrentArgument == GroupPoints->LineEdit2 || else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
myEditCurrentArgument == GroupDimensions->LineEdit2) myEditCurrentArgument == GroupDimensions->LineEdit2 )
myVector = aSelectedObject; myVector = aSelectedObject;
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
@ -303,19 +303,19 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) { if ( send == GroupPoints->PushButton1 ) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
} }
else if(send == GroupPoints->PushButton2) { else if ( send == GroupPoints->PushButton2 ) {
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
globalSelection( GEOM_LINE ); globalSelection( GEOM_LINE );
} }
else if(send == GroupDimensions->PushButton1) { else if ( send == GroupDimensions->PushButton1 ) {
myEditCurrentArgument = GroupDimensions->LineEdit1; myEditCurrentArgument = GroupDimensions->LineEdit1;
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
} }
else if(send == GroupDimensions->PushButton2) { else if ( send == GroupDimensions->PushButton2 ) {
myEditCurrentArgument = GroupDimensions->LineEdit2; myEditCurrentArgument = GroupDimensions->LineEdit2;
globalSelection( GEOM_LINE ); globalSelection( GEOM_LINE );
} }
@ -332,12 +332,11 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
void TransformationGUI_MultiRotationDlg::LineEditReturnPressed() void TransformationGUI_MultiRotationDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if(send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 || if ( send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 ||
send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2) send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 ) {
{ myEditCurrentArgument = send;
myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed();
GEOMBase_Skeleton::LineEditReturnPressed(); }
}
} }
@ -348,8 +347,8 @@ void TransformationGUI_MultiRotationDlg::LineEditReturnPressed()
void TransformationGUI_MultiRotationDlg::ActivateThisDialog() void TransformationGUI_MultiRotationDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
} }
@ -359,9 +358,9 @@ void TransformationGUI_MultiRotationDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_MultiRotationDlg::enterEvent(QEvent* e) void TransformationGUI_MultiRotationDlg::enterEvent( QEvent* )
{ {
if(!GroupConstructors->isEnabled()) if( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -370,17 +369,17 @@ void TransformationGUI_MultiRotationDlg::enterEvent(QEvent* e)
// function : ValueChangedInSpinBox() // function : ValueChangedInSpinBox()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox(double newValue) void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox( double newValue )
{ {
QObject* send = (QObject*)sender(); QObject* send = (QObject*)sender();
if(send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1) if ( send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1 )
myNbTimes1 = (int)newValue; myNbTimes1 = (int)newValue;
else if(send == GroupDimensions->SpinBox_DX1) else if ( send == GroupDimensions->SpinBox_DX1 )
myAng = newValue; myAng = newValue;
else if(send == GroupDimensions->SpinBox_DX2) else if ( send == GroupDimensions->SpinBox_DX2 )
myStep = newValue; myStep = newValue;
else if(send == GroupDimensions->SpinBox_DY2) else if ( send == GroupDimensions->SpinBox_DY2 )
myNbTimes2 = (int)newValue; myNbTimes2 = (int)newValue;
displayPreview(); displayPreview();
@ -397,10 +396,10 @@ void TransformationGUI_MultiRotationDlg::ReverseAngle()
int aConstructorId = getConstructorId(); int aConstructorId = getConstructorId();
if(aConstructorId == 0) if ( aConstructorId == 0 )
GroupPoints->SpinBox_DX->SetValue(myAng); GroupPoints->SpinBox_DX->setValue( myAng );
else if(aConstructorId == 1) else if ( aConstructorId == 1 )
GroupDimensions->SpinBox_DX1->SetValue(myAng); GroupDimensions->SpinBox_DX1->setValue( myAng );
displayPreview(); displayPreview();
} }
@ -420,9 +419,9 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool TransformationGUI_MultiRotationDlg::isValid( QString& msg ) bool TransformationGUI_MultiRotationDlg::isValid( QString& /*msg*/ )
{ {
return !(myBase->_is_nil() || myVector->_is_nil()); return !( myBase->_is_nil() || myVector->_is_nil() );
} }
//================================================================================= //=================================================================================
@ -435,28 +434,22 @@ bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() ) {
{ case 0 :
case 0 : if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) ) {
{ anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) ) { MultiRotate1D( myBase, myVector, myNbTimes1 );
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> res = true;
MultiRotate1D( myBase, myVector, myNbTimes1 );
res = true;
}
break;
}
case 1 :
{
if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) )
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
MultiRotate2D( myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2 );
res = true;
}
break;
}
} }
break;
case 1 :
if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
MultiRotate2D( myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2 );
res = true;
}
break;
}
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
@ -469,7 +462,7 @@ bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects )
// function : closeEvent // function : closeEvent
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_MultiRotationDlg::closeEvent( QCloseEvent* e ) void TransformationGUI_MultiRotationDlg::closeEvent( QCloseEvent* e )
{ {
// myGeomGUI->SetState( -1 ); // myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e ); GEOMBase_Skeleton::closeEvent( e );

View File

@ -1,34 +1,32 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : TransformationGUI_MultiRotationDlg.h
// Author : Damien COQUERET, Open CASCADE S.A.S.
// //
//
// File : TransformationGUI_MultiRotationDlg.h
// Author : Damien COQUERET
// Module : GEOM
#ifndef DIALOGBOX_MULTIROTATION_H #ifndef TRANSFORMATIONGUI_MULTIROTATIONDLG_H
#define DIALOGBOX_MULTIROTATION_H #define TRANSFORMATIONGUI_MULTIROTATIONDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class DlgRef_2Sel4Spin1Check; class DlgRef_2Sel4Spin1Check;
class DlgRef_2Sel1Spin; class DlgRef_2Sel1Spin;
@ -39,44 +37,45 @@ class DlgRef_2Sel1Spin;
//================================================================================= //=================================================================================
class TransformationGUI_MultiRotationDlg : public GEOMBase_Skeleton class TransformationGUI_MultiRotationDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
TransformationGUI_MultiRotationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, TransformationGUI_MultiRotationDlg( GeometryGUI*, QWidget* = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_MultiRotationDlg(); ~TransformationGUI_MultiRotationDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e ); virtual void closeEvent( QCloseEvent* );
private : private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent( QEvent* );
GEOM::GEOM_Object_var myBase, myVector; private:
int myNbTimes1; GEOM::GEOM_Object_var myBase, myVector;
int myNbTimes2; int myNbTimes1;
Standard_Real myAng; int myNbTimes2;
Standard_Real myStep; Standard_Real myAng;
Standard_Real myStep;
DlgRef_2Sel1Spin* GroupPoints;
DlgRef_2Sel4Spin1Check* GroupDimensions; DlgRef_2Sel1Spin* GroupPoints;
DlgRef_2Sel4Spin1Check* GroupDimensions;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ReverseAngle(); void ReverseAngle();
void ValueChangedInSpinBox(double newValue); void ValueChangedInSpinBox( double );
void ConstructorsClicked(int constructorId); void ConstructorsClicked( int );
}; };
#endif // DIALOGBOX_MULTIROTATION_H #endif // TRANSFORMATIONGUI_MULTIROTATIONDLG_H

View File

@ -1,47 +1,40 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : TransformationGUI_MultiTranslationDlg.cxx
// Author : Damien COQUERET, Open CASCADE S.A.S.
// //
//
// File : TransformationGUI_MultiTranslationDlg.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header$
#include "TransformationGUI_MultiTranslationDlg.h" #include "TransformationGUI_MultiTranslationDlg.h"
#include "DlgRef_2Sel2Spin1Check.h"
#include "DlgRef_3Sel4Spin2Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h" #include <GEOM_DlgRef.h>
#include "GEOMBase.h" #include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h" #include <SUIT_ResourceMgr.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
#include "GEOMImpl_Types.hxx" #include <GEOMImpl_Types.hxx>
using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_MultiTranslationDlg() // class : TransformationGUI_MultiTranslationDlg()
@ -51,58 +44,60 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg
(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) ( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{ {
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTITRANSLATION_SIMPLE"))); QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_MULTITRANSLATION_SIMPLE" ) ) );
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MULTITRANSLATION_DOUBLE"))); QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_MULTITRANSLATION_DOUBLE" ) ) );
QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setWindowTitle(tr("GEOM_MULTITRANSLATION_TITLE")); setWindowTitle( tr( "GEOM_MULTITRANSLATION_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_MULTITRANSLATION")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_MULTITRANSLATION" ) );
RadioButton1->setIcon(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setIcon(image1); mainFrame()->RadioButton2->setIcon( image1 );
RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close(); mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_2Sel2Spin1Check(this, "GroupPoints"); GroupPoints = new DlgRef_2Sel2Spin1Check( centralWidget() );
GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_SIMPLE")); GroupPoints->GroupBox1->setTitle( tr( "GEOM_MULTITRANSLATION_SIMPLE" ) );
GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); GroupPoints->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR_U")); GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR_U" ) );
GroupPoints->TextLabel3->setText(tr("GEOM_STEP_U")); GroupPoints->TextLabel3->setText( tr( "GEOM_STEP_U" ) );
GroupPoints->TextLabel4->setText(tr("GEOM_NB_TIMES_U")); GroupPoints->TextLabel4->setText( tr( "GEOM_NB_TIMES_U" ) );
GroupPoints->CheckButton1->setText(tr("GEOM_REVERSE_U")); GroupPoints->CheckButton1->setText( tr( "GEOM_REVERSE_U" ) );
GroupPoints->PushButton1->setIcon(image2); GroupPoints->PushButton1->setIcon( image2 );
GroupPoints->PushButton2->setIcon(image2); GroupPoints->PushButton2->setIcon( image2 );
GroupPoints->LineEdit1->setReadOnly(true); GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly(true); GroupPoints->LineEdit2->setReadOnly( true );
GroupDimensions = new DlgRef_3Sel4Spin2Check(this, "GroupDimensions"); GroupDimensions = new DlgRef_3Sel4Spin2Check( centralWidget() );
GroupDimensions->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_DOUBLE")); GroupDimensions->GroupBox1->setTitle( tr( "GEOM_MULTITRANSLATION_DOUBLE" ) );
GroupDimensions->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); GroupDimensions->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
GroupDimensions->TextLabel2->setText(tr("GEOM_VECTOR_U")); GroupDimensions->TextLabel2->setText( tr( "GEOM_VECTOR_U" ) );
GroupDimensions->TextLabel3->setText(tr("GEOM_VECTOR_V")); GroupDimensions->TextLabel3->setText( tr( "GEOM_VECTOR_V" ) );
GroupDimensions->TextLabel4->setText(tr("GEOM_STEP_U")); GroupDimensions->TextLabel4->setText( tr( "GEOM_STEP_U" ) );
GroupDimensions->TextLabel5->setText(tr("GEOM_NB_TIMES_U")); GroupDimensions->TextLabel5->setText( tr( "GEOM_NB_TIMES_U" ) );
GroupDimensions->TextLabel6->setText(tr("GEOM_STEP_V")); GroupDimensions->TextLabel6->setText( tr( "GEOM_STEP_V" ) );
GroupDimensions->TextLabel7->setText(tr("GEOM_NB_TIMES_V")); GroupDimensions->TextLabel7->setText( tr( "GEOM_NB_TIMES_V" ) );
GroupDimensions->CheckButton1->setText(tr("GEOM_REVERSE_U")); GroupDimensions->CheckButton1->setText( tr( "GEOM_REVERSE_U" ) );
GroupDimensions->CheckButton2->setText(tr("GEOM_REVERSE_V")); GroupDimensions->CheckButton2->setText( tr( "GEOM_REVERSE_V" ) );
GroupDimensions->PushButton1->setIcon(image2); GroupDimensions->PushButton1->setIcon( image2 );
GroupDimensions->PushButton2->setIcon(image2); GroupDimensions->PushButton2->setIcon( image2 );
GroupDimensions->PushButton3->setIcon(image2); GroupDimensions->PushButton3->setIcon( image2 );
GroupDimensions->LineEdit1->setReadOnly(true); GroupDimensions->LineEdit1->setReadOnly( true );
GroupDimensions->LineEdit2->setReadOnly(true); GroupDimensions->LineEdit2->setReadOnly( true );
GroupDimensions->LineEdit3->setReadOnly(true); GroupDimensions->LineEdit3->setReadOnly( true );
gridLayout1->addWidget(GroupPoints, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
gridLayout1->addWidget(GroupDimensions, 2, 0); layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
layout->addWidget( GroupDimensions );
/***************************************************************/ /***************************************************************/
setHelpFileName("multi_translation.htm"); setHelpFileName( "multi_translation.htm" );
Init(); Init();
} }
@ -126,64 +121,68 @@ void TransformationGUI_MultiTranslationDlg::Init()
{ {
/* Get setting of step value from file configuration */ /* Get setting of step value from file configuration */
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
double SpecificStep = 1; double SpecificStep = 1;
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 );
GroupPoints->SpinBox_DY->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); initSpinBox( GroupPoints->SpinBox_DY, 1.0, MAX_NUMBER, SpecificStep, 3 );
GroupPoints->SpinBox_DX->SetValue(myStepU); GroupPoints->SpinBox_DX->setValue( myStepU );
GroupPoints->SpinBox_DY->SetValue(myNbTimesU); GroupPoints->SpinBox_DY->setValue( myNbTimesU );
GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); initSpinBox( GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, step, 3 );
GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); initSpinBox( GroupDimensions->SpinBox_DY1, 1.0, MAX_NUMBER, SpecificStep, 3 );
GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); initSpinBox( GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, 3 );
GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); initSpinBox( GroupDimensions->SpinBox_DY2, 1.0, MAX_NUMBER, SpecificStep, 3 );
GroupDimensions->SpinBox_DX1->SetValue(myStepU); GroupDimensions->SpinBox_DX1->setValue( myStepU );
GroupDimensions->SpinBox_DY1->SetValue(myNbTimesU); GroupDimensions->SpinBox_DY1->setValue( myNbTimesU );
GroupDimensions->SpinBox_DX2->SetValue(myStepV); GroupDimensions->SpinBox_DX2->setValue( myStepV );
GroupDimensions->SpinBox_DY2->SetValue(myNbTimesV); GroupDimensions->SpinBox_DY2->setValue( myNbTimesV );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupDimensions->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupDimensions->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupDimensions->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(GroupDimensions->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupDimensions->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect( GroupDimensions->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect( GroupDimensions->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect( GroupDimensions->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); connect( GroupPoints->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX1, SLOT(SetStep(double))); connect( GroupDimensions->SpinBox_DX1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY1, SLOT(SetStep(double))); connect( GroupDimensions->SpinBox_DY1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX2, SLOT(SetStep(double))); connect( GroupDimensions->SpinBox_DX2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY2, SLOT(SetStep(double))); connect( GroupDimensions->SpinBox_DY2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU())); // VSR: TODO ->>
connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU())); connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) );
connect(GroupDimensions->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(ReverseStepV())); 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() ) );
connect( GroupDimensions->CheckButton2, SIGNAL( toggled( bool ) ), this, SLOT( ReverseStepV() ) );
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_MULTITRANSLATION" ).toLatin1().constData() ); initName( tr( "GEOM_MULTITRANSLATION" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -192,57 +191,58 @@ void TransformationGUI_MultiTranslationDlg::Init()
// function : ConstructorsClicked() // function : ConstructorsClicked()
// purpose : Radio button management // purpose : Radio button management
//================================================================================= //=================================================================================
void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId) void TransformationGUI_MultiTranslationDlg::ConstructorsClicked( int constructorId )
{ {
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
myStepU = myStepV = 50.0; myStepU = myStepV = 50.0;
myNbTimesU = myNbTimesV = 2; myNbTimesU = myNbTimesV = 2;
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
switch (constructorId) switch ( constructorId ) {
case 0: /* Translate simple */
{ {
case 0: /* Translate simple */ GroupDimensions->hide();
{ GroupPoints->show();
GroupDimensions->hide();
resize(0, 0); myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->show(); GroupPoints->LineEdit1->setText( "" );
GroupPoints->LineEdit2->setText( "" );
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText(""); GroupPoints->SpinBox_DX->setValue( myStepU );
GroupPoints->LineEdit2->setText(""); GroupPoints->SpinBox_DY->setValue( myNbTimesU );
GroupPoints->SpinBox_DX->SetValue(myStepU);
GroupPoints->SpinBox_DY->SetValue(myNbTimesU);
break; break;
}
case 1: /* Translate double */
{
GroupPoints->hide();
resize(0, 0);
GroupDimensions->show();
myEditCurrentArgument = GroupDimensions->LineEdit1;
GroupDimensions->LineEdit1->setText("");
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);
myVectorV = GEOM::GEOM_Object::_nil();
break;
}
} }
case 1: /* Translate double */
{
GroupPoints->hide();
GroupDimensions->show();
myEditCurrentArgument = GroupDimensions->LineEdit1;
GroupDimensions->LineEdit1->setText( "" );
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 );
myVectorV = GEOM::GEOM_Object::_nil();
break;
}
}
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
myBase = myVectorU = GEOM::GEOM_Object::_nil(); myBase = myVectorU = GEOM::GEOM_Object::_nil();
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
} }
@ -278,30 +278,34 @@ bool TransformationGUI_MultiTranslationDlg::ClickOnApply()
//================================================================================= //=================================================================================
void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText( "" );
if(IObjectCount() != 1) { if ( IObjectCount() != 1 ) {
if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) if ( myEditCurrentArgument == GroupPoints->LineEdit1 ||
myEditCurrentArgument == GroupDimensions->LineEdit1 )
myBase = GEOM::GEOM_Object::_nil(); myBase = GEOM::GEOM_Object::_nil();
else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
myEditCurrentArgument == GroupDimensions->LineEdit2 )
myVectorU = GEOM::GEOM_Object::_nil(); myVectorU = GEOM::GEOM_Object::_nil();
else if(myEditCurrentArgument == GroupDimensions->LineEdit3) else if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
myVectorV = GEOM::GEOM_Object::_nil(); myVectorV = GEOM::GEOM_Object::_nil();
return; return;
} }
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False;; Standard_Boolean testResult = Standard_False;;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) ) if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) )
return; return;
if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) if ( myEditCurrentArgument == GroupPoints->LineEdit1 ||
myEditCurrentArgument == GroupDimensions->LineEdit1 )
myBase = aSelectedObject; myBase = aSelectedObject;
else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
myEditCurrentArgument == GroupDimensions->LineEdit2 )
myVectorU = aSelectedObject; myVectorU = aSelectedObject;
else if(myEditCurrentArgument == GroupDimensions->LineEdit3) else if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
myVectorV = aSelectedObject; myVectorV = aSelectedObject;
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
@ -319,23 +323,23 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) { if ( send == GroupPoints->PushButton1 ) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
} }
else if(send == GroupPoints->PushButton2) { else if ( send == GroupPoints->PushButton2 ) {
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
globalSelection( GEOM_LINE ); globalSelection( GEOM_LINE );
} }
else if(send == GroupDimensions->PushButton1) { else if ( send == GroupDimensions->PushButton1 ) {
myEditCurrentArgument = GroupDimensions->LineEdit1; myEditCurrentArgument = GroupDimensions->LineEdit1;
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
} }
else if(send == GroupDimensions->PushButton2) { else if ( send == GroupDimensions->PushButton2 ) {
myEditCurrentArgument = GroupDimensions->LineEdit2; myEditCurrentArgument = GroupDimensions->LineEdit2;
globalSelection( GEOM_LINE ); globalSelection( GEOM_LINE );
} }
else if(send == GroupDimensions->PushButton3) { else if ( send == GroupDimensions->PushButton3 ) {
myEditCurrentArgument = GroupDimensions->LineEdit3; myEditCurrentArgument = GroupDimensions->LineEdit3;
globalSelection( GEOM_LINE ); globalSelection( GEOM_LINE );
} }
@ -352,13 +356,12 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed() void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if(send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 || if ( send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 ||
send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 || send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 ||
send == GroupDimensions->LineEdit3) send == GroupDimensions->LineEdit3 ) {
{ myEditCurrentArgument = send;
myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed();
GEOMBase_Skeleton::LineEditReturnPressed(); }
}
} }
@ -369,8 +372,8 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed()
void TransformationGUI_MultiTranslationDlg::ActivateThisDialog() void TransformationGUI_MultiTranslationDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
} }
@ -380,9 +383,9 @@ void TransformationGUI_MultiTranslationDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_MultiTranslationDlg::enterEvent(QEvent* e) void TransformationGUI_MultiTranslationDlg::enterEvent( QEvent* )
{ {
if(!GroupConstructors->isEnabled()) if( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -391,33 +394,28 @@ void TransformationGUI_MultiTranslationDlg::enterEvent(QEvent* e)
// function : ValueChangedInSpinBox() // function : ValueChangedInSpinBox()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox(double newValue) void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox( double newValue )
{ {
QObject* send = (QObject*)sender(); QObject* send = (QObject*)sender();
switch(getConstructorId()) switch ( getConstructorId() ) {
{ case 0:
case 0 : if ( send == GroupPoints->SpinBox_DX )
{ myStepU = newValue;
if(send == GroupPoints->SpinBox_DX) else if ( send == GroupPoints->SpinBox_DY )
myStepU = newValue; myNbTimesU = (int)newValue;
else if(send == GroupPoints->SpinBox_DY) break;
myNbTimesU = (int)newValue; case 1 :
break; if ( send == GroupDimensions->SpinBox_DX1 )
} myStepU = newValue;
case 1 : else if ( send == GroupDimensions->SpinBox_DY1)
{ myNbTimesU = (int)newValue;
if(send == GroupDimensions->SpinBox_DX1) else if ( send == GroupDimensions->SpinBox_DX2 )
myStepU = newValue; myStepV = newValue;
else if(send == GroupDimensions->SpinBox_DY1) else if ( send == GroupDimensions->SpinBox_DY2 )
myNbTimesU = (int)newValue; myNbTimesV = (int)newValue;
else if(send == GroupDimensions->SpinBox_DX2) break;
myStepV = newValue; }
else if(send == GroupDimensions->SpinBox_DY2)
myNbTimesV = (int)newValue;
break;
}
}
displayPreview(); displayPreview();
} }
@ -433,10 +431,10 @@ void TransformationGUI_MultiTranslationDlg::ReverseStepU()
int aConstructorId = getConstructorId(); int aConstructorId = getConstructorId();
if(aConstructorId == 0) if ( aConstructorId == 0 )
GroupPoints->SpinBox_DX->SetValue(myStepU); GroupPoints->SpinBox_DX->setValue( myStepU );
else if(aConstructorId == 1) else if ( aConstructorId == 1 )
GroupDimensions->SpinBox_DX1->SetValue(myStepU); GroupDimensions->SpinBox_DX1->setValue( myStepU );
displayPreview(); displayPreview();
} }
@ -450,7 +448,7 @@ void TransformationGUI_MultiTranslationDlg::ReverseStepV()
{ {
myStepV = -myStepV; myStepV = -myStepV;
GroupDimensions->SpinBox_DX2->SetValue(myStepV); GroupDimensions->SpinBox_DX2->setValue( myStepV );
displayPreview(); displayPreview();
} }
@ -470,14 +468,14 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperatio
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool TransformationGUI_MultiTranslationDlg::isValid( QString& msg ) bool TransformationGUI_MultiTranslationDlg::isValid( QString& /*msg*/ )
{ {
int aConstructorId = getConstructorId(); int aConstructorId = getConstructorId();
if(aConstructorId == 0) if ( aConstructorId == 0 )
return !(myBase->_is_nil() || myVectorU->_is_nil()); return !( myBase->_is_nil() || myVectorU->_is_nil() );
else if(aConstructorId == 1) else if ( aConstructorId == 1 )
return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil()); return !( myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil() );
return 0; return 0;
} }
@ -491,27 +489,22 @@ bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() ) {
{ case 0 :
case 0 : if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVectorU ) ) {
{ anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate1D( myBase, myVectorU, myStepU, myNbTimesU );
if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVectorU ) ) { res = true;
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 ) )
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate2D( myBase, myVectorU, myStepU, myNbTimesU,
myVectorV, myStepV, myNbTimesV );
res = true;
}
break;
}
} }
break;
case 1 :
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() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
@ -524,7 +517,7 @@ bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects )
// function : closeEvent // function : closeEvent
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_MultiTranslationDlg::closeEvent( QCloseEvent* e ) void TransformationGUI_MultiTranslationDlg::closeEvent( QCloseEvent* e )
{ {
// myGeomGUI->SetState( -1 ); // myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e ); GEOMBase_Skeleton::closeEvent( e );

View File

@ -1,34 +1,32 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : TransformationGUI_MultiTranslationDlg.h
// Author : Damien COQUERET, Open CASCADE S.A.S.
// //
//
// File : TransformationGUI_MultiTranslationDlg.h
// Author : Damien COQUERET
// Module : GEOM
#ifndef DIALOGBOX_MULTITRANSLATION_H #ifndef TRANSFORMATIONGUI_MULTITRANSLATIONDLG_H
#define DIALOGBOX_MULTITRANSLATION_H #define TRANSFORMATIONGUI_MULTITRANSLATIONDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class DlgRef_2Sel2Spin1Check; class DlgRef_2Sel2Spin1Check;
class DlgRef_3Sel4Spin2Check; class DlgRef_3Sel4Spin2Check;
@ -39,45 +37,46 @@ class DlgRef_3Sel4Spin2Check;
//================================================================================= //=================================================================================
class TransformationGUI_MultiTranslationDlg : public GEOMBase_Skeleton class TransformationGUI_MultiTranslationDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
TransformationGUI_MultiTranslationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, TransformationGUI_MultiTranslationDlg( GeometryGUI*, QWidget* = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_MultiTranslationDlg(); ~TransformationGUI_MultiTranslationDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e ); virtual void closeEvent( QCloseEvent* );
private :
void Init();
void enterEvent(QEvent* e);
GEOM::GEOM_Object_var myBase, myVectorU, myVectorV ;
int myNbTimesU;
int myNbTimesV;
Standard_Real myStepU;
Standard_Real myStepV;
DlgRef_2Sel2Spin1Check* GroupPoints;
DlgRef_3Sel4Spin2Check* GroupDimensions;
private:
void Init();
void enterEvent( QEvent* );
private:
GEOM::GEOM_Object_var myBase, myVectorU, myVectorV;
int myNbTimesU;
int myNbTimesV;
Standard_Real myStepU;
Standard_Real myStepV;
DlgRef_2Sel2Spin1Check* GroupPoints;
DlgRef_3Sel4Spin2Check* GroupDimensions;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ReverseStepU(); void ReverseStepU();
void ReverseStepV(); void ReverseStepV();
void ValueChangedInSpinBox(double newValue); void ValueChangedInSpinBox( double );
void ConstructorsClicked(int constructorId); void ConstructorsClicked( int );
}; };
#endif // DIALOGBOX_MULTITRANSLATION_H #endif // TRANSFORMATIONGUI_MULTITRANSLATIONDLG_H

View File

@ -1,44 +1,38 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : TransformationGUI_OffsetDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : TransformationGUI_OffsetDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#include "TransformationGUI_OffsetDlg.h" #include "TransformationGUI_OffsetDlg.h"
#include "DlgRef_1Sel1Spin1Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h" #include <GEOM_DlgRef.h>
#include "GEOMBase.h" #include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h" #include <SUIT_ResourceMgr.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_OffsetDlg() // class : TransformationGUI_OffsetDlg()
@ -47,39 +41,41 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg(GeometryGUI* theGeometryGUI, QWidget* parent, TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, Qt::WindowFlags fl) bool modal, Qt::WindowFlags fl )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{ {
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_OFFSET"))); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_OFFSET" ) ) );
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setWindowTitle(tr("GEOM_OFFSET_TITLE")); setWindowTitle( tr( "GEOM_OFFSET_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_OFFSET")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_OFFSET" ) );
RadioButton1->setIcon(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
RadioButton2->close(); mainFrame()->RadioButton2->close();
RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close(); mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_1Sel1Spin1Check(this, "GroupPoints"); GroupPoints = new DlgRef_1Sel1Spin1Check( centralWidget() );
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
GroupPoints->TextLabel2->setText(tr("GEOM_OFFSET")); GroupPoints->TextLabel2->setText( tr( "GEOM_OFFSET" ) );
GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY")); GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) );
// san -- modification of an exisitng object by offset is not allowed // san -- modification of an exisitng object by offset is not allowed
GroupPoints->CheckButton1->hide(); GroupPoints->CheckButton1->hide();
GroupPoints->PushButton1->setIcon(image1); GroupPoints->PushButton1->setIcon( image1 );
gridLayout1->addWidget(GroupPoints, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
/***************************************************************/ /***************************************************************/
setHelpFileName("offset_surface.htm"); setHelpFileName( "offset_surface.htm" );
Init(); Init();
} }
@ -109,27 +105,27 @@ void TransformationGUI_OffsetDlg::Init()
double step = 1; double step = 1;
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 );
GroupPoints->SpinBox_DX->setDecimals(5); GroupPoints->SpinBox_DX->setDecimals( 5 );
//@ GroupPoints->SpinBox_DX->setDblPrecision(1e-05); //@ GroupPoints->SpinBox_DX->setDblPrecision(1e-05);
GroupPoints->SpinBox_DX->SetValue(1e-05); GroupPoints->SpinBox_DX->setValue( 1e-05 );
// Activate Create a Copy mode // Activate Create a Copy mode
GroupPoints->CheckButton1->setChecked(true); GroupPoints->CheckButton1->setChecked( true );
CreateCopyModeChanged(true); CreateCopyModeChanged( true );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) );
initName( tr( "GEOM_OFFSET" ).toLatin1().constData() ); initName( tr( "GEOM_OFFSET" ) );
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
@ -167,19 +163,18 @@ bool TransformationGUI_OffsetDlg::ClickOnApply()
//================================================================================= //=================================================================================
void TransformationGUI_OffsetDlg::SelectionIntoArgument() void TransformationGUI_OffsetDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText( "" );
QString aName; QString aName;
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName );
if(aNbSel < 1) if ( aNbSel < 1 ) {
{ myObjects.length( 0 );
myObjects.length(0); return;
return; }
}
// nbSel > 0 // nbSel > 0
GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myObjects );
if (!myObjects.length()) if ( !myObjects.length() )
return; return;
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText( aName );
@ -195,8 +190,7 @@ void TransformationGUI_OffsetDlg::SelectionIntoArgument()
void TransformationGUI_OffsetDlg::LineEditReturnPressed() void TransformationGUI_OffsetDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 ) if ( send == GroupPoints->LineEdit1 ) {
{
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -211,12 +205,11 @@ void TransformationGUI_OffsetDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) if ( send == GroupPoints->PushButton1 ) {
{ myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument->setFocus();
myEditCurrentArgument->setFocus(); SelectionIntoArgument();
SelectionIntoArgument(); }
}
} }
@ -224,9 +217,9 @@ void TransformationGUI_OffsetDlg::SetEditCurrentArgument()
// function : enterEvent() // function : enterEvent()
// purpose : when mouse enter onto the QWidget // purpose : when mouse enter onto the QWidget
//================================================================================= //=================================================================================
void TransformationGUI_OffsetDlg::enterEvent(QEvent * e) void TransformationGUI_OffsetDlg::enterEvent( QEvent* )
{ {
if ( !GroupConstructors->isEnabled() ) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -238,8 +231,8 @@ void TransformationGUI_OffsetDlg::enterEvent(QEvent * e)
void TransformationGUI_OffsetDlg::ActivateThisDialog() void TransformationGUI_OffsetDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
@ -272,14 +265,13 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_OffsetDlg::createOperation()
bool TransformationGUI_OffsetDlg::isValid( QString& msg ) bool TransformationGUI_OffsetDlg::isValid( QString& msg )
{ {
//return !(myObjects.length() == 0); //return !(myObjects.length() == 0);
if (myObjects.length() == 0) return false; if ( myObjects.length() == 0 ) return false;
for (int i = 0; i < myObjects.length(); i++) for ( int i = 0; i < myObjects.length(); i++ ) {
{
GEOM::shape_type aType = myObjects[i]->GetShapeType(); GEOM::shape_type aType = myObjects[i]->GetShapeType();
if( aType != GEOM::FACE && aType != GEOM::SHELL && aType != GEOM::SOLID ){ if ( aType != GEOM::FACE && aType != GEOM::SHELL && aType != GEOM::SOLID ) {
msg = tr("ERROR_SHAPE_TYPE"); msg = tr( "ERROR_SHAPE_TYPE" );
return false; return false;
} }
} }
return true; return true;
@ -296,23 +288,21 @@ bool TransformationGUI_OffsetDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
if ( GroupPoints->CheckButton1->isChecked() || IsPreview() ) {
if (GroupPoints->CheckButton1->isChecked() || IsPreview()) for ( int i = 0; i < myObjects.length(); i++ ) {
for (int i = 0; i < myObjects.length(); i++)
{ anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() );
if ( !anObj->_is_nil() )
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() ); objects.push_back( anObj._retn() );
if ( !anObj->_is_nil() ) }
objects.push_back( anObj._retn() ); }
} else {
else for ( int i = 0; i < myObjects.length(); i++ ) {
for (int i = 0; i < myObjects.length(); i++) anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShape( myObjects[i], GetOffset() );
{ if ( !anObj->_is_nil() )
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShape( myObjects[i], GetOffset() ); objects.push_back( anObj._retn() );
if ( !anObj->_is_nil() ) }
objects.push_back( anObj._retn() ); }
}
res = true; res = true;
return res; return res;
@ -335,7 +325,7 @@ void TransformationGUI_OffsetDlg::closeEvent( QCloseEvent* e )
//================================================================================= //=================================================================================
double TransformationGUI_OffsetDlg::GetOffset() const double TransformationGUI_OffsetDlg::GetOffset() const
{ {
return GroupPoints->SpinBox_DX->GetValue(); return GroupPoints->SpinBox_DX->value();
} }
@ -343,7 +333,7 @@ double TransformationGUI_OffsetDlg::GetOffset() const
// function : CreateCopyModeChanged() // function : CreateCopyModeChanged()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_OffsetDlg::CreateCopyModeChanged(bool isCreateCopy) void TransformationGUI_OffsetDlg::CreateCopyModeChanged( bool isCreateCopy )
{ {
this->GroupBoxName->setEnabled(isCreateCopy); mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
} }

View File

@ -1,34 +1,32 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : TransformationGUI_OffsetDlg.h
// Author : Michael ZORIN, Open CASCADE S.A.S. (mikhail.zorin@opencascade.com)
// //
//
// File : TransformationGUI_OffsetDlg.h
// Author : Michael Zorin
// Module : GEOM
#ifndef DIALOGBOX_OFFSET_H #ifndef TRANSFORMATIONGUI_OFFSETDLG_H
#define DIALOGBOX_OFFSET_H #define TRANSFORMATIONGUI_OFFSETDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class DlgRef_1Sel1Spin1Check; class DlgRef_1Sel1Spin1Check;
@ -38,39 +36,40 @@ class DlgRef_1Sel1Spin1Check;
//================================================================================= //=================================================================================
class TransformationGUI_OffsetDlg : public GEOMBase_Skeleton class TransformationGUI_OffsetDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
TransformationGUI_OffsetDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, TransformationGUI_OffsetDlg( GeometryGUI*, QWidget* = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_OffsetDlg(); ~TransformationGUI_OffsetDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e ); virtual void closeEvent( QCloseEvent* );
private: private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent( QEvent* );
double GetOffset() const; double GetOffset() const;
GEOM::ListOfGO myObjects; private:
GEOM::ListOfGO myObjects;
DlgRef_1Sel1Spin1Check* GroupPoints; DlgRef_1Sel1Spin1Check* GroupPoints;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void SelectionIntoArgument(); void SelectionIntoArgument();
void LineEditReturnPressed(); void LineEditReturnPressed();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ValueChangedInSpinBox(); void ValueChangedInSpinBox();
void CreateCopyModeChanged(bool isCreateCopy); void CreateCopyModeChanged( bool );
}; };
#endif // DIALOGBOX_OFFSET_H #endif // TRANSFORMATIONGUI_OFFSETDLG_H

View File

@ -1,48 +1,42 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : TransformationGUI_PositionDlg.cxx
// Author : Damien COQUERET, Open CASCADE S.A.S.
// //
//
// File : TransformationGUI_PositionDlg.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header$
#include "TransformationGUI_PositionDlg.h" #include "TransformationGUI_PositionDlg.h"
#include "DlgRef_3Sel3Spin1Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h" #include <GEOM_DlgRef.h>
#include "GEOMBase.h" #include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h" #include <SUIT_ResourceMgr.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
#include "TColStd_MapOfInteger.hxx" #include <TColStd_MapOfInteger.hxx>
#include "GEOMImpl_Types.hxx" #include <GEOMImpl_Types.hxx>
using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_PositionDlg() // class : TransformationGUI_PositionDlg()
@ -52,44 +46,46 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
TransformationGUI_PositionDlg::TransformationGUI_PositionDlg TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) ( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
: GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{ {
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0(aResMgr->loadPixmap("GEOM",tr("ICON_DLG_POSITION"))); QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_POSITION" ) ) );
QPixmap image1(aResMgr->loadPixmap("GEOM",tr("ICON_DLG_POSITION2"))); QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_POSITION2" ) ) );
QPixmap imageselect(aResMgr->loadPixmap("GEOM",tr("ICON_SELECT"))); QPixmap imageselect( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT") ) );
setWindowTitle(tr("GEOM_POSITION_TITLE")); setWindowTitle( tr( "GEOM_POSITION_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_POSITION")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_POSITION" ) );
RadioButton1->setIcon(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setIcon(image1); mainFrame()->RadioButton2->setIcon( image1 );
RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close(); mainFrame()->RadioButton3->close();
Group1 = new DlgRef_3Sel3Spin1Check(this, "Group1"); Group1 = new DlgRef_3Sel3Spin1Check( centralWidget() );
Group1->SpinBox1->hide(); Group1->SpinBox1->hide();
Group1->SpinBox2->hide(); Group1->SpinBox2->hide();
Group1->SpinBox3->hide(); Group1->SpinBox3->hide();
Group1->TextLabel4->hide(); Group1->TextLabel4->hide();
Group1->TextLabel5->hide(); Group1->TextLabel5->hide();
Group1->TextLabel6->hide(); Group1->TextLabel6->hide();
Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); Group1->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
Group1->TextLabel1->setText(tr("GEOM_OBJECTS")); Group1->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
Group1->TextLabel2->setText(tr("GEOM_START_LCS")); Group1->TextLabel2->setText( tr( "GEOM_START_LCS" ) );
Group1->TextLabel3->setText(tr("GEOM_END_LCS")); Group1->TextLabel3->setText( tr( "GEOM_END_LCS" ) );
Group1->PushButton1->setIcon(imageselect); Group1->PushButton1->setIcon( imageselect );
Group1->PushButton2->setIcon(imageselect); Group1->PushButton2->setIcon( imageselect );
Group1->PushButton3->setIcon(imageselect); Group1->PushButton3->setIcon( imageselect );
Group1->CheckBox1->setText(tr("GEOM_CREATE_COPY")); Group1->CheckBox1->setText( tr( "GEOM_CREATE_COPY" ) );
gridLayout1->addWidget(Group1, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( Group1 );
/***************************************************************/ /***************************************************************/
setHelpFileName("modify_the_location.htm"); setHelpFileName( "modify_the_location.htm" );
Init(); Init();
} }
@ -112,36 +108,38 @@ TransformationGUI_PositionDlg::~TransformationGUI_PositionDlg()
void TransformationGUI_PositionDlg::Init() void TransformationGUI_PositionDlg::Init()
{ {
/* init variables */ /* init variables */
Group1->LineEdit1->setReadOnly(true); Group1->LineEdit1->setReadOnly( true );
Group1->LineEdit2->setReadOnly(true); Group1->LineEdit2->setReadOnly( true );
Group1->LineEdit3->setReadOnly(true); Group1->LineEdit3->setReadOnly( true );
myStartLCS = GEOM::GEOM_Object::_nil(); myStartLCS = GEOM::GEOM_Object::_nil();
myEndLCS = GEOM::GEOM_Object::_nil(); myEndLCS = GEOM::GEOM_Object::_nil();
// Activate Create a Copy mode // Activate Create a Copy mode
Group1->CheckBox1->setChecked(true); Group1->CheckBox1->setChecked( true );
CreateCopyModeChanged(true); CreateCopyModeChanged( true );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect(Group1->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group1->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( Group1->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(Group1->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( Group1->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(Group1->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( Group1->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( Group1->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( Group1->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( Group1->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(Group1->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); connect( Group1->CheckBox1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) );
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_POSITION" ) );
initName( tr( "GEOM_POSITION" ).toLatin1().constData() );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -151,9 +149,9 @@ void TransformationGUI_PositionDlg::Init()
// function : ConstructorsClicked() // function : ConstructorsClicked()
// purpose : Radio button management // purpose : Radio button management
//================================================================================= //=================================================================================
void TransformationGUI_PositionDlg::ConstructorsClicked(int constructorId) void TransformationGUI_PositionDlg::ConstructorsClicked( int constructorId )
{ {
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
globalSelection(); globalSelection();
myEditCurrentArgument = Group1->LineEdit1; myEditCurrentArgument = Group1->LineEdit1;
@ -162,25 +160,25 @@ void TransformationGUI_PositionDlg::ConstructorsClicked(int constructorId)
myStartLCS = GEOM::GEOM_Object::_nil(); myStartLCS = GEOM::GEOM_Object::_nil();
myEndLCS = GEOM::GEOM_Object::_nil(); myEndLCS = GEOM::GEOM_Object::_nil();
switch (constructorId) switch ( constructorId ) {
{ case 0:
case 0: Group1->LineEdit2->hide();
{ Group1->TextLabel2->hide();
Group1->LineEdit2->hide(); Group1->PushButton2->hide();
Group1->TextLabel2->hide(); break;
Group1->PushButton2->hide(); case 1:
break; Group1->LineEdit2->show();
} Group1->TextLabel2->show();
case 1: Group1->PushButton2->show();
{ break;
Group1->LineEdit2->show(); }
Group1->TextLabel2->show();
Group1->PushButton2->show(); qApp->processEvents();
break; updateGeometry();
} resize( minimumSize() );
}
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT(SelectionIntoArgument() ) );
SelectionIntoArgument(); SelectionIntoArgument();
} }
@ -202,7 +200,7 @@ void TransformationGUI_PositionDlg::ClickOnOk()
//================================================================================= //=================================================================================
bool TransformationGUI_PositionDlg::ClickOnApply() bool TransformationGUI_PositionDlg::ClickOnApply()
{ {
if ( !onAccept(Group1->CheckBox1->isChecked()) ) if ( !onAccept( Group1->CheckBox1->isChecked() ) )
return false; return false;
initName(); initName();
@ -217,47 +215,47 @@ bool TransformationGUI_PositionDlg::ClickOnApply()
//================================================================================= //=================================================================================
void TransformationGUI_PositionDlg::SelectionIntoArgument() void TransformationGUI_PositionDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText( "" );
QString aName; QString aName;
if(myEditCurrentArgument == Group1->LineEdit1) { if ( myEditCurrentArgument == Group1->LineEdit1 ) {
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName );
if(aNbSel < 1) { if ( aNbSel < 1 ) {
myObjects.length(0); myObjects.length( 0 );
displayPreview(); displayPreview();
return; return;
} }
GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myObjects );
if (!myObjects.length()) { if ( !myObjects.length() ) {
displayPreview(); displayPreview();
return; return;
} }
} }
else if(myEditCurrentArgument == Group1->LineEdit2) { else if ( myEditCurrentArgument == Group1->LineEdit2 ) {
myStartLCS = GEOM::GEOM_Object::_nil(); myStartLCS = GEOM::GEOM_Object::_nil();
if(IObjectCount() != 1) { if ( IObjectCount() != 1 ) {
displayPreview(); displayPreview();
return; return;
} }
Standard_Boolean testResult = Standard_False; Standard_Boolean testResult = Standard_False;
myStartLCS = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); myStartLCS = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
if(!testResult || CORBA::is_nil( myStartLCS )) { if ( !testResult || CORBA::is_nil( myStartLCS ) ) {
displayPreview(); displayPreview();
return; return;
} }
aName = GEOMBase::GetName( myStartLCS ); aName = GEOMBase::GetName( myStartLCS );
} }
else if(myEditCurrentArgument == Group1->LineEdit3) { else if ( myEditCurrentArgument == Group1->LineEdit3 ) {
myEndLCS = GEOM::GEOM_Object::_nil(); myEndLCS = GEOM::GEOM_Object::_nil();
if(IObjectCount() != 1) { if ( IObjectCount() != 1 ) {
displayPreview(); displayPreview();
return; return;
} }
Standard_Boolean testResult = Standard_False; Standard_Boolean testResult = Standard_False;
myEndLCS = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); myEndLCS = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
if(!testResult || CORBA::is_nil( myEndLCS )) { if ( !testResult || CORBA::is_nil( myEndLCS ) ) {
displayPreview(); displayPreview();
return; return;
} }
@ -276,7 +274,8 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
void TransformationGUI_PositionDlg::LineEditReturnPressed() void TransformationGUI_PositionDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if(send == Group1->LineEdit1 || send == Group1->LineEdit2 || send == Group1->LineEdit3) { if ( send == Group1->LineEdit1 || send == Group1->LineEdit2 ||
send == Group1->LineEdit3 ) {
myEditCurrentArgument = send; myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -291,18 +290,18 @@ void TransformationGUI_PositionDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == Group1->PushButton1){ if ( send == Group1->PushButton1 ) {
myEditCurrentArgument = Group1->LineEdit1; myEditCurrentArgument = Group1->LineEdit1;
globalSelection(); globalSelection();
} }
else if(send == Group1->PushButton2) { else if ( send == Group1->PushButton2 ) {
myEditCurrentArgument = Group1->LineEdit2; myEditCurrentArgument = Group1->LineEdit2;
TColStd_MapOfInteger aMap; TColStd_MapOfInteger aMap;
aMap.Add( GEOM_PLANE ); aMap.Add( GEOM_PLANE );
aMap.Add( GEOM_MARKER ); aMap.Add( GEOM_MARKER );
globalSelection( aMap ); globalSelection( aMap );
} }
else if(send == Group1->PushButton3) { else if ( send == Group1->PushButton3 ) {
myEditCurrentArgument = Group1->LineEdit3; myEditCurrentArgument = Group1->LineEdit3;
TColStd_MapOfInteger aMap; TColStd_MapOfInteger aMap;
aMap.Add( GEOM_PLANE ); aMap.Add( GEOM_PLANE );
@ -322,8 +321,8 @@ void TransformationGUI_PositionDlg::SetEditCurrentArgument()
void TransformationGUI_PositionDlg::ActivateThisDialog() void TransformationGUI_PositionDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
} }
@ -332,9 +331,9 @@ void TransformationGUI_PositionDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : when mouse enter onto the QWidget // purpose : when mouse enter onto the QWidget
//================================================================================= //=================================================================================
void TransformationGUI_PositionDlg::enterEvent(QEvent * e) void TransformationGUI_PositionDlg::enterEvent( QEvent* )
{ {
if(!GroupConstructors->isEnabled()) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -353,13 +352,13 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_PositionDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool TransformationGUI_PositionDlg::isValid( QString& msg ) bool TransformationGUI_PositionDlg::isValid( QString& /*msg*/ )
{ {
bool res; bool res;
if (getConstructorId() == 0) if ( getConstructorId() == 0 )
res = !(myObjects.length() == 0 || myEndLCS->_is_nil()); res = !( myObjects.length() == 0 || myEndLCS->_is_nil() );
else else
res = !(myObjects.length() == 0 || myStartLCS->_is_nil() || myEndLCS->_is_nil()); res = !( myObjects.length() == 0 || myStartLCS->_is_nil() || myEndLCS->_is_nil() );
return res; return res;
} }
@ -369,42 +368,41 @@ bool TransformationGUI_PositionDlg::isValid( QString& msg )
// function : execute // function : execute
// purpose : // purpose :
//================================================================================= //=================================================================================
bool TransformationGUI_PositionDlg::execute( ObjectList& objects ) bool TransformationGUI_PositionDlg::execute( ObjectList& objects )
{ {
bool res = false; bool res = false;
bool toCreateCopy = IsPreview() || Group1->CheckBox1->isChecked(); bool toCreateCopy = IsPreview() || Group1->CheckBox1->isChecked();
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() ) {
case 0:
{ {
case 0 : for ( int i = 0; i < myObjects.length(); i++ ) {
{ if ( toCreateCopy )
for (int i = 0; i < myObjects.length(); i++) { anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShapeCopy( myObjects[i], myObjects[i], myEndLCS );
if (toCreateCopy) else
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShapeCopy( myObjects[i], myObjects[i], myEndLCS ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShape( myObjects[i], myObjects[i], myEndLCS );
else
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShape( myObjects[i], myObjects[i], myEndLCS ); if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
res = true;
break;
}
case 1 :
{
for (int i = 0; i < myObjects.length(); i++) {
if (toCreateCopy)
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShapeCopy( myObjects[i], myStartLCS, myEndLCS );
else
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShape( myObjects[i], myStartLCS, myEndLCS );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
res = true;
break;
} }
res = true;
break;
} }
case 1:
{
for ( int i = 0; i < myObjects.length(); i++ ) {
if ( toCreateCopy )
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShapeCopy( myObjects[i], myStartLCS, myEndLCS );
else
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShape( myObjects[i], myStartLCS, myEndLCS );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
res = true;
break;
}
}
return res; return res;
} }
@ -423,7 +421,7 @@ void TransformationGUI_PositionDlg::closeEvent( QCloseEvent* e )
// function : CreateCopyModeChanged() // function : CreateCopyModeChanged()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_PositionDlg::CreateCopyModeChanged(bool isCreateCopy) void TransformationGUI_PositionDlg::CreateCopyModeChanged( bool isCreateCopy )
{ {
this->GroupBoxName->setEnabled(isCreateCopy); mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
} }

View File

@ -1,34 +1,32 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : TransformationGUI_PositionDlg.h
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : TransformationGUI_PositionDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
#ifndef DIALOGBOX_POSITION_H #ifndef TRANSFORMATIONGUI_POSITIONDLG_H
#define DIALOGBOX_POSITION_H #define TRANSFORMATIONGUI_POSITIONDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class DlgRef_3Sel3Spin1Check; class DlgRef_3Sel3Spin1Check;
@ -38,40 +36,41 @@ class DlgRef_3Sel3Spin1Check;
//================================================================================= //=================================================================================
class TransformationGUI_PositionDlg : public GEOMBase_Skeleton class TransformationGUI_PositionDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
TransformationGUI_PositionDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, TransformationGUI_PositionDlg( GeometryGUI*, QWidget* = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_PositionDlg(); ~TransformationGUI_PositionDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e ); virtual void closeEvent( QCloseEvent* );
private: private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent( QEvent* );
GEOM::GEOM_Object_var myStartLCS; private:
GEOM::GEOM_Object_var myEndLCS; GEOM::GEOM_Object_var myStartLCS;
GEOM::ListOfGO myObjects; GEOM::GEOM_Object_var myEndLCS;
GEOM::ListOfGO myObjects;
DlgRef_3Sel3Spin1Check* Group1;
DlgRef_3Sel3Spin1Check* Group1;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ConstructorsClicked(int constructorId); void ConstructorsClicked( int );
void CreateCopyModeChanged(bool isCreateCopy); void CreateCopyModeChanged( bool );
}; };
#endif // DIALOGBOX_MIRROR_H #endif // TRANSFORMATIONGUI_POSITIONDLG_H

View File

@ -1,46 +1,40 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : TransformationGUI_RotationDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : TransformationGUI_RotationDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#include "TransformationGUI_RotationDlg.h" #include "TransformationGUI_RotationDlg.h"
#include "DlgRef_4Sel1Spin2Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h" #include <GEOM_DlgRef.h>
#include "GEOMBase.h" #include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h" #include <SUIT_ResourceMgr.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
#include "GEOMImpl_Types.hxx" #include <GEOMImpl_Types.hxx>
using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_RotationDlg() // class : TransformationGUI_RotationDlg()
@ -50,75 +44,79 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
TransformationGUI_RotationDlg::TransformationGUI_RotationDlg TransformationGUI_RotationDlg::TransformationGUI_RotationDlg
(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) ( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{ {
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0 (aResMgr->loadPixmap("GEOM",tr("ICON_DLG_ROTATION"))); QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ROTATION" ) ) );
QPixmap image1 (aResMgr->loadPixmap("GEOM",tr("ICON_SELECT"))); QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
QPixmap image2 (aResMgr->loadPixmap("GEOM",tr("ICON_DLG_ROTATION_THREE_POINTS"))); QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ROTATION_THREE_POINTS" ) ) );
setWindowTitle(tr("GEOM_ROTATION_TITLE")); setWindowTitle( tr( "GEOM_ROTATION_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_ROTATION")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_ROTATION" ) );
RadioButton1->setIcon(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setIcon(image2); mainFrame()->RadioButton2->setIcon( image2 );
RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close(); mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_4Sel1Spin2Check(this, "GroupPoints"); GroupPoints = new DlgRef_4Sel1Spin2Check( centralWidget() );
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
GroupPoints->TextLabel2->setText(tr("GEOM_AXIS")); GroupPoints->TextLabel2->setText( tr( "GEOM_AXIS" ) );
GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE")); GroupPoints->TextLabel3->setText( tr( "GEOM_ANGLE" ) );
GroupPoints->TextLabel4->setText(tr("GEOM_POINT_I").arg("1")); GroupPoints->TextLabel4->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
GroupPoints->TextLabel5->setText(tr("GEOM_POINT_I").arg("2")); GroupPoints->TextLabel5->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
GroupPoints->LineEdit1->setReadOnly(true); GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly(true); GroupPoints->LineEdit2->setReadOnly( true );
GroupPoints->LineEdit4->setReadOnly(true); GroupPoints->LineEdit4->setReadOnly( true );
GroupPoints->LineEdit5->setReadOnly(true); GroupPoints->LineEdit5->setReadOnly( true );
GroupPoints->PushButton1->setIcon(image1); GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->PushButton2->setIcon(image1); GroupPoints->PushButton2->setIcon( image1 );
GroupPoints->PushButton4->setIcon(image1); GroupPoints->PushButton4->setIcon( image1 );
GroupPoints->PushButton5->setIcon(image1); GroupPoints->PushButton5->setIcon( image1 );
GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY")); GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) );
GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE")); GroupPoints->CheckButton2->setText( tr( "GEOM_REVERSE" ) );
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
gridLayout1->addWidget(GroupPoints, 2, 0);
/***************************************************************/ /***************************************************************/
double anAngle = 0; double anAngle = 0;
double SpecificStep = 5; double SpecificStep = 5;
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, 3); initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, 3 );
GroupPoints->SpinBox_DX->SetValue(anAngle); GroupPoints->SpinBox_DX->setValue( anAngle );
// Activate Create a Copy mode // Activate Create a Copy mode
GroupPoints->CheckButton1->setChecked(true); GroupPoints->CheckButton1->setChecked( true );
CreateCopyModeChanged(true); CreateCopyModeChanged( true );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(GroupPoints->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton4, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton5, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) );
connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); connect( GroupPoints->CheckButton2, SIGNAL( toggled( bool ) ), this, SLOT( onReverse() ) );
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
setHelpFileName("rotation.htm"); setHelpFileName( "rotation.htm" );
Init(); Init();
} }
@ -146,7 +144,7 @@ void TransformationGUI_RotationDlg::Init()
myAxis = myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); myAxis = myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
initName( tr( "GEOM_ROTATION" ).toLatin1().constData() ); initName( tr( "GEOM_ROTATION" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -154,44 +152,41 @@ void TransformationGUI_RotationDlg::Init()
// function : ConstructorsClicked() // function : ConstructorsClicked()
// purpose : Radio button management // purpose : Radio button management
//================================================================================= //=================================================================================
void TransformationGUI_RotationDlg::ConstructorsClicked(int constructorId) void TransformationGUI_RotationDlg::ConstructorsClicked( int constructorId )
{ {
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection(); globalSelection();
switch (constructorId) switch ( constructorId ) {
{ case 0: /* rotation an object angle and axis */
case 0: /* rotation an object angle and axis */ GroupPoints->ShowRows( 2, 3, false );
{ GroupPoints->TextLabel2->setText( tr( "GEOM_AXIS" ) );
GroupPoints->ShowRows(2,3,false); GroupPoints->LineEdit2->clear();
resize(0,0); GroupPoints->ShowRows( 4, 4, true );
GroupPoints->TextLabel2->setText(tr("GEOM_AXIS")); myAxis = GEOM::GEOM_Object::_nil();
GroupPoints->LineEdit2->clear(); break;
GroupPoints->ShowRows(4,4,true); case 1: /* rotation an object by 3 points */
myAxis = GEOM::GEOM_Object::_nil(); GroupPoints->ShowRows( 4, 4, false );
break; GroupPoints->ShowRows( 2, 3, true );
} GroupPoints->TextLabel2->setText( tr( "GEOM_CENTRAL_POINT" ) );
case 1: /* rotation an object by 3 points */ GroupPoints->TextLabel4->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
{ GroupPoints->TextLabel5->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
GroupPoints->ShowRows(4,4,false); GroupPoints->LineEdit2->clear();
resize(0,0); GroupPoints->LineEdit4->clear();
GroupPoints->ShowRows(2,3,true); GroupPoints->LineEdit5->clear();
GroupPoints->TextLabel2->setText(tr("GEOM_CENTRAL_POINT")); myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
GroupPoints->TextLabel4->setText(tr("GEOM_POINT_I").arg("1")); break;
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(); myEditCurrentArgument->setFocus();
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
} }
//================================================================================= //=================================================================================
@ -211,7 +206,7 @@ void TransformationGUI_RotationDlg::ClickOnOk()
//================================================================================= //=================================================================================
bool TransformationGUI_RotationDlg::ClickOnApply() bool TransformationGUI_RotationDlg::ClickOnApply()
{ {
if ( !onAccept( GroupPoints->CheckButton1->isChecked()) ) if ( !onAccept( GroupPoints->CheckButton1->isChecked() ) )
return false; return false;
initName(); initName();
@ -226,52 +221,48 @@ bool TransformationGUI_RotationDlg::ClickOnApply()
//================================================================================= //=================================================================================
void TransformationGUI_RotationDlg::SelectionIntoArgument() void TransformationGUI_RotationDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText( "" );
QString aName; QString aName;
if(myEditCurrentArgument == GroupPoints->LineEdit1) if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
{ int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName );
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); if ( aNbSel < 1) {
if(aNbSel < 1) myObjects.length( 0 );
{ return;
myObjects.length(0);
return;
}
GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects);
if (!myObjects.length())
return;
} }
else GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myObjects );
{ if ( !myObjects.length() )
if(IObjectCount() != 1) return;
{ }
if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) else {
myAxis = GEOM::GEOM_Object::_nil(); if ( IObjectCount() != 1 ) {
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0 )
myCentPoint = GEOM::GEOM_Object::_nil(); myAxis = GEOM::GEOM_Object::_nil();
else if(myEditCurrentArgument == GroupPoints->LineEdit4) else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 )
myPoint1 = GEOM::GEOM_Object::_nil(); myCentPoint = GEOM::GEOM_Object::_nil();
else if(myEditCurrentArgument == GroupPoints->LineEdit5) else if ( myEditCurrentArgument == GroupPoints->LineEdit4 )
myPoint2 = GEOM::GEOM_Object::_nil(); myPoint1 = GEOM::GEOM_Object::_nil();
return; else if ( myEditCurrentArgument == GroupPoints->LineEdit5 )
} myPoint2 = GEOM::GEOM_Object::_nil();
return;
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
if(!testResult || CORBA::is_nil( aSelectedObject ))
return;
if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
myAxis = aSelectedObject;
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
myCentPoint = aSelectedObject;
else if(myEditCurrentArgument == GroupPoints->LineEdit4)
myPoint1 = aSelectedObject;
else if(myEditCurrentArgument == GroupPoints->LineEdit5)
myPoint2 = aSelectedObject;
aName = GEOMBase::GetName( aSelectedObject );
} }
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
if ( !testResult || CORBA::is_nil( aSelectedObject ) )
return;
if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0 )
myAxis = aSelectedObject;
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 )
myCentPoint = aSelectedObject;
else if ( myEditCurrentArgument == GroupPoints->LineEdit4 )
myPoint1 = aSelectedObject;
else if ( myEditCurrentArgument == GroupPoints->LineEdit5 )
myPoint2 = aSelectedObject;
aName = GEOMBase::GetName( aSelectedObject );
}
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText( aName );
displayPreview(); displayPreview();
@ -286,25 +277,23 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) { if ( send == GroupPoints->PushButton1 ) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection(); globalSelection();
} }
else if(send == GroupPoints->PushButton2) { else if ( send == GroupPoints->PushButton2 ) {
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
getConstructorId() == 0 ? globalSelection( GEOM_LINE ) : getConstructorId() == 0 ? globalSelection( GEOM_LINE ) :
globalSelection( GEOM_POINT ); globalSelection( GEOM_POINT );
} }
else if (send == GroupPoints->PushButton4) else if ( send == GroupPoints->PushButton4 ) {
{ myEditCurrentArgument = GroupPoints->LineEdit4;
myEditCurrentArgument = GroupPoints->LineEdit4; globalSelection( GEOM_POINT );
globalSelection( GEOM_POINT ); }
} else if ( send == GroupPoints->PushButton5 ) {
else if (send == GroupPoints->PushButton5) myEditCurrentArgument = GroupPoints->LineEdit5;
{ globalSelection( GEOM_POINT );
myEditCurrentArgument = GroupPoints->LineEdit5; }
globalSelection( GEOM_POINT );
}
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
SelectionIntoArgument(); SelectionIntoArgument();
@ -318,12 +307,11 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument()
void TransformationGUI_RotationDlg::LineEditReturnPressed() void TransformationGUI_RotationDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if(send == GroupPoints->LineEdit1 || if ( send == GroupPoints->LineEdit1 ||
send == GroupPoints->LineEdit2) send == GroupPoints->LineEdit2 ) {
{ myEditCurrentArgument = send;
myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed();
GEOMBase_Skeleton::LineEditReturnPressed(); }
}
} }
@ -334,8 +322,8 @@ void TransformationGUI_RotationDlg::LineEditReturnPressed()
void TransformationGUI_RotationDlg::ActivateThisDialog() void TransformationGUI_RotationDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ) , this, SLOT( SelectionIntoArgument() ) );
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
} }
@ -345,9 +333,9 @@ void TransformationGUI_RotationDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_RotationDlg::enterEvent(QEvent* e) void TransformationGUI_RotationDlg::enterEvent( QEvent* )
{ {
if (!GroupConstructors->isEnabled()) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -376,22 +364,18 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_RotationDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool TransformationGUI_RotationDlg::isValid( QString& msg ) bool TransformationGUI_RotationDlg::isValid( QString& /*msg*/ )
{ {
switch (getConstructorId()) switch ( getConstructorId() ) {
{ case 0:
case 0: return !( myObjects.length() == 0 || myAxis->_is_nil() );
{ break;
return !(myObjects.length() == 0 || myAxis->_is_nil()); case 1:
break; return !( myObjects.length() == 0 || myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil() );
} break;
case 1: default:
{ return false;
return !(myObjects.length() == 0 || myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil() ); }
break;
}
default: return false;
}
} }
@ -406,47 +390,46 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() ) {
case 0 :
{ {
case 0 : if ( toCreateCopy ) {
{ for ( int i = 0; i < myObjects.length(); i++ ) {
if (toCreateCopy) anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateCopy( myObjects[i], myAxis, GetAngle() * PI180 );
for (int i = 0; i < myObjects.length(); i++) if ( !anObj->_is_nil() )
{ objects.push_back( anObj._retn() );
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++)
{
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 : else {
{ for ( int i = 0; i < myObjects.length(); i++ ) {
if (toCreateCopy) anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->Rotate( myObjects[i], myAxis, GetAngle() * PI180 );
for (int i = 0; i < myObjects.length(); i++) if ( !anObj->_is_nil() )
{ objects.push_back( anObj._retn() );
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++)
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePoints( myObjects[i], myCentPoint, myPoint1, myPoint2 );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
res = true;
break;
} }
res = true;
break;
} }
case 1 :
{
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++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePoints( myObjects[i], myCentPoint, myPoint1, myPoint2 );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
}
res = true;
break;
}
}
return res; return res;
} }
@ -468,7 +451,7 @@ void TransformationGUI_RotationDlg::closeEvent( QCloseEvent* e )
//================================================================================= //=================================================================================
double TransformationGUI_RotationDlg::GetAngle() const double TransformationGUI_RotationDlg::GetAngle() const
{ {
return GroupPoints->SpinBox_DX->GetValue(); return GroupPoints->SpinBox_DX->value();
} }
@ -476,9 +459,9 @@ double TransformationGUI_RotationDlg::GetAngle() const
// function : CreateCopyModeChanged() // function : CreateCopyModeChanged()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_RotationDlg::CreateCopyModeChanged(bool isCreateCopy) void TransformationGUI_RotationDlg::CreateCopyModeChanged( bool isCreateCopy )
{ {
this->GroupBoxName->setEnabled(isCreateCopy); mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
} }
@ -488,6 +471,6 @@ void TransformationGUI_RotationDlg::CreateCopyModeChanged(bool isCreateCopy)
//================================================================================= //=================================================================================
void TransformationGUI_RotationDlg::onReverse() void TransformationGUI_RotationDlg::onReverse()
{ {
double anOldValue = GroupPoints->SpinBox_DX->GetValue(); double anOldValue = GroupPoints->SpinBox_DX->value();
GroupPoints->SpinBox_DX->SetValue( -anOldValue ); GroupPoints->SpinBox_DX->setValue( -anOldValue );
} }

View File

@ -1,34 +1,32 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : TransformationGUI_RotationDlg.h
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : TransformationGUI_RotationDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
#ifndef DIALOGBOX_ROTATION_H #ifndef TRANSFORMATIONGUI_ROTATIONDLG_H
#define DIALOGBOX_ROTATION_H #define TRANSFORMATIONGUI_ROTATIONDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class DlgRef_4Sel1Spin2Check; class DlgRef_4Sel1Spin2Check;
@ -38,42 +36,43 @@ class DlgRef_4Sel1Spin2Check;
//================================================================================= //=================================================================================
class TransformationGUI_RotationDlg : public GEOMBase_Skeleton class TransformationGUI_RotationDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
TransformationGUI_RotationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, TransformationGUI_RotationDlg( GeometryGUI*, QWidget* = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_RotationDlg(); ~TransformationGUI_RotationDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e ); virtual void closeEvent( QCloseEvent* );
private: private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent( QEvent* );
double GetAngle() const; double GetAngle() const;
private:
GEOM::ListOfGO myObjects;
GEOM::GEOM_Object_var myAxis, myCentPoint, myPoint1, myPoint2;
GEOM::ListOfGO myObjects; DlgRef_4Sel1Spin2Check* GroupPoints;
GEOM::GEOM_Object_var myAxis, myCentPoint, myPoint1, myPoint2;
DlgRef_4Sel1Spin2Check* GroupPoints;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ValueChangedInSpinBox(); void ValueChangedInSpinBox();
void CreateCopyModeChanged(bool isCreateCopy); void CreateCopyModeChanged( bool );
void ConstructorsClicked(int constructorId); void ConstructorsClicked( int );
void onReverse(); void onReverse();
}; };
#endif // DIALOGBOX_ROTATION_H #endif // TRANSFORMATIONGUI_ROTATIONDLG_H

View File

@ -1,46 +1,39 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// // File : TransformationGUI_ScaleDlg.cxx
// // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// File : TransformationGUI_ScaleDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#include "TransformationGUI_ScaleDlg.h" #include "TransformationGUI_ScaleDlg.h"
#include "DlgRef_2Sel1Spin2Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h" #include <GEOM_DlgRef.h>
#include "GEOMBase.h" #include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h" #include <SUIT_ResourceMgr.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
#include "GEOMImpl_Types.hxx" #include <GEOMImpl_Types.hxx>
using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_ScaleDlg() // class : TransformationGUI_ScaleDlg()
@ -49,68 +42,73 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryGUI, QWidget* parent, TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, Qt::WindowFlags fl) bool modal, Qt::WindowFlags fl )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{ {
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SCALE"))); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SCALE" ) ) );
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setWindowTitle(tr("GEOM_SCALE_TITLE")); setWindowTitle( tr( "GEOM_SCALE_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_SCALE")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_SCALE" ) );
RadioButton1->setIcon(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
RadioButton2->close(); mainFrame()->RadioButton2->close();
RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close(); mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints"); GroupPoints = new DlgRef_2Sel1Spin2Check( centralWidget() );
GroupPoints->CheckButton2->hide(); GroupPoints->CheckButton2->hide();
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
GroupPoints->TextLabel2->setText(tr("GEOM_CENTRAL_POINT")); GroupPoints->TextLabel2->setText( tr( "GEOM_CENTRAL_POINT" ) );
GroupPoints->TextLabel3->setText(tr("GEOM_SCALE_FACTOR")); GroupPoints->TextLabel3->setText( tr( "GEOM_SCALE_FACTOR" ) );
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true );
GroupPoints->PushButton1->setIcon(image1); GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->PushButton2->setIcon(image1); GroupPoints->PushButton2->setIcon( image1 );
GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY")); GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) );
// san -- modification of an exisitng object by offset is not allowed // san -- modification of an exisitng object by offset is not allowed
GroupPoints->CheckButton1->hide(); GroupPoints->CheckButton1->hide();
gridLayout1->addWidget(GroupPoints, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
/***************************************************************/ /***************************************************************/
double aFactor = 2.0; double aFactor = 2.0;
double SpecificStep = 0.5; double SpecificStep = 0.5;
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, 3); initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, 3 );
GroupPoints->SpinBox_DX->SetValue(aFactor); GroupPoints->SpinBox_DX->setValue( aFactor );
// Activate Create a Copy mode // Activate Create a Copy mode
GroupPoints->CheckButton1->setChecked(true); GroupPoints->CheckButton1->setChecked( true );
CreateCopyModeChanged(true); CreateCopyModeChanged( true );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); // VSR: TODO ->>
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); 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(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
setHelpFileName("scale_transform.htm"); setHelpFileName( "scale_transform.htm" );
Init(); Init();
} }
@ -137,7 +135,7 @@ void TransformationGUI_ScaleDlg::Init()
myPoint = GEOM::GEOM_Object::_nil(); myPoint = GEOM::GEOM_Object::_nil();
initName( tr( "GEOM_SCALE" ).toLatin1().constData() ); initName( tr( "GEOM_SCALE" ) );
} }
@ -158,7 +156,7 @@ void TransformationGUI_ScaleDlg::ClickOnOk()
//================================================================================= //=================================================================================
bool TransformationGUI_ScaleDlg::ClickOnApply() bool TransformationGUI_ScaleDlg::ClickOnApply()
{ {
if ( !onAccept(GroupPoints->CheckButton1->isChecked()) ) if ( !onAccept( GroupPoints->CheckButton1->isChecked() ) )
return false; return false;
Init(); Init();
@ -172,34 +170,30 @@ bool TransformationGUI_ScaleDlg::ClickOnApply()
//================================================================================= //=================================================================================
void TransformationGUI_ScaleDlg::SelectionIntoArgument() void TransformationGUI_ScaleDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText( "" );
QString aName; QString aName;
if(myEditCurrentArgument == GroupPoints->LineEdit1) if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
{ int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName );
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); if ( aNbSel < 1 ) {
if(aNbSel < 1) myObjects.length( 0 );
{ return;
myObjects.length(0);
return;
}
GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects);
if (!myObjects.length())
return;
} }
else if(myEditCurrentArgument == GroupPoints->LineEdit2) GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myObjects );
{ if ( !myObjects.length() )
if(IObjectCount() != 1) return;
{ }
myPoint = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
return; if ( IObjectCount() != 1 ) {
} myPoint = GEOM::GEOM_Object::_nil();
Standard_Boolean testResult = Standard_False; return;
myPoint = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
if(!testResult || CORBA::is_nil( myPoint ))
return;
aName = GEOMBase::GetName( myPoint );
} }
Standard_Boolean testResult = Standard_False;
myPoint = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
if ( !testResult || CORBA::is_nil( myPoint ) )
return;
aName = GEOMBase::GetName( myPoint );
}
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText( aName );
displayPreview(); displayPreview();
@ -213,12 +207,11 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
void TransformationGUI_ScaleDlg::LineEditReturnPressed() void TransformationGUI_ScaleDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if(send == GroupPoints->LineEdit1 || if ( send == GroupPoints->LineEdit1 ||
send == GroupPoints->LineEdit2) send == GroupPoints->LineEdit2 ) {
{ myEditCurrentArgument = send;
myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed();
GEOMBase_Skeleton::LineEditReturnPressed(); }
}
} }
@ -230,11 +223,11 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) { if ( send == GroupPoints->PushButton1 ) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection(); globalSelection();
} }
else if(send == GroupPoints->PushButton2) { else if ( send == GroupPoints->PushButton2 ) {
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
globalSelection( GEOM_POINT ); globalSelection( GEOM_POINT );
} }
@ -251,8 +244,8 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
void TransformationGUI_ScaleDlg::ActivateThisDialog() void TransformationGUI_ScaleDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
globalSelection(); globalSelection();
GroupPoints->LineEdit1->setFocus(); GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
@ -263,9 +256,9 @@ void TransformationGUI_ScaleDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_ScaleDlg::enterEvent(QEvent* e) void TransformationGUI_ScaleDlg::enterEvent( QEvent* )
{ {
if( !GroupConstructors->isEnabled() ) if( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -284,7 +277,7 @@ void TransformationGUI_ScaleDlg::ValueChangedInSpinBox()
// function : createOperation // function : createOperation
// purpose : // purpose :
//================================================================================= //=================================================================================
GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation() GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation()
{ {
return myGeomGUI->GetGeomGen()->GetITransformOperations( getStudyId() ); return myGeomGUI->GetGeomGen()->GetITransformOperations( getStudyId() );
} }
@ -293,9 +286,9 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool TransformationGUI_ScaleDlg::isValid( QString& msg ) bool TransformationGUI_ScaleDlg::isValid( QString& /*msg*/)
{ {
return !(myObjects.length() == 0 || myPoint->_is_nil() || fabs(GetFactor()) <= 0.00001); return !( myObjects.length() == 0 || myPoint->_is_nil() || fabs( GetFactor()) <= 0.00001 );
} }
@ -305,27 +298,23 @@ bool TransformationGUI_ScaleDlg::isValid( QString& msg )
//================================================================================= //=================================================================================
bool TransformationGUI_ScaleDlg::execute( ObjectList& objects ) bool TransformationGUI_ScaleDlg::execute( ObjectList& objects )
{ {
bool res = false;
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
if (GroupPoints->CheckButton1->isChecked() || IsPreview()) if ( GroupPoints->CheckButton1->isChecked() || IsPreview() ) {
for (int i = 0; i < myObjects.length(); i++) for ( int i = 0; i < myObjects.length(); i++ ) {
{ anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShapeCopy( myObjects[i], myPoint, GetFactor() );
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShapeCopy( myObjects[i], myPoint, GetFactor() ); if ( !anObj->_is_nil() )
if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() );
objects.push_back( anObj._retn() ); }
} }
else else {
for (int i = 0; i < myObjects.length(); i++) for ( int i = 0; i < myObjects.length(); i++ ) {
{ anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShape( myObjects[i], myPoint, GetFactor() );
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShape( myObjects[i], myPoint, GetFactor() ); if ( !anObj->_is_nil() )
if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() );
objects.push_back( anObj._retn() ); }
} }
res = true; return true;
return res;
} }
@ -345,7 +334,7 @@ void TransformationGUI_ScaleDlg::closeEvent( QCloseEvent* e )
//================================================================================= //=================================================================================
double TransformationGUI_ScaleDlg::GetFactor() const double TransformationGUI_ScaleDlg::GetFactor() const
{ {
return GroupPoints->SpinBox_DX->GetValue(); return GroupPoints->SpinBox_DX->value();
} }
@ -353,7 +342,7 @@ double TransformationGUI_ScaleDlg::GetFactor() const
// function : CreateCopyModeChanged() // function : CreateCopyModeChanged()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_ScaleDlg::CreateCopyModeChanged(bool isCreateCopy) void TransformationGUI_ScaleDlg::CreateCopyModeChanged( bool isCreateCopy )
{ {
this->GroupBoxName->setEnabled(isCreateCopy); mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
} }

View File

@ -1,34 +1,34 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// //
// //
// File : TransformationGUI_ScaleDlg.h // File : TransformationGUI_ScaleDlg.h
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_SCALE_H #ifndef TRANSFORMATIONGUI_SCALEDLG_H
#define DIALOGBOX_SCALE_H #define TRANSFORMATIONGUI_SCALEDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class DlgRef_2Sel1Spin2Check; class DlgRef_2Sel1Spin2Check;
@ -38,40 +38,41 @@ class DlgRef_2Sel1Spin2Check;
//================================================================================= //=================================================================================
class TransformationGUI_ScaleDlg : public GEOMBase_Skeleton class TransformationGUI_ScaleDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
TransformationGUI_ScaleDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, TransformationGUI_ScaleDlg( GeometryGUI*, QWidget* = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_ScaleDlg(); ~TransformationGUI_ScaleDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* );
virtual void closeEvent( QCloseEvent* e ); private:
void Init();
void enterEvent( QEvent* );
double GetFactor() const;
private : private:
void Init(); GEOM::ListOfGO myObjects;
void enterEvent(QEvent* e); GEOM::GEOM_Object_var myPoint; /* Central Point */
double GetFactor() const;
GEOM::ListOfGO myObjects;
GEOM::GEOM_Object_var myPoint; /* Central Point */
DlgRef_2Sel1Spin2Check* GroupPoints; DlgRef_2Sel1Spin2Check* GroupPoints;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ValueChangedInSpinBox(); void ValueChangedInSpinBox();
void CreateCopyModeChanged(bool isCreateCopy); void CreateCopyModeChanged( bool );
}; };
#endif // DIALOGBOX_SCALE_H #endif // TRANSFORMATIONGUI_SCALEDLG_H

View File

@ -1,46 +1,40 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : TransformationGUI_TranslationDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : TransformationGUI_TranslationDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#include "TransformationGUI_TranslationDlg.h" #include "TransformationGUI_TranslationDlg.h"
#include "DlgRef_3Sel3Spin1Check.h"
#include "DlgRef_SpinBox.h"
#include "GeometryGUI.h" #include <GEOM_DlgRef.h>
#include "GEOMBase.h" #include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_ResourceMgr.h" #include <SUIT_ResourceMgr.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
#include "GEOMImpl_Types.hxx" #include <GEOMImpl_Types.hxx>
using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_TranslationDlg() // class : TransformationGUI_TranslationDlg()
@ -50,41 +44,42 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg
(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) ( GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{ {
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSLATION_DXYZ"))); QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_TRANSLATION_DXYZ" ) ) );
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSLATION_POINTS"))); QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_TRANSLATION_POINTS" ) ) );
QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TRANSLATION_VECTOR"))); QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_TRANSLATION_VECTOR" ) ) );
QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setWindowTitle(tr("GEOM_TRANSLATION_TITLE")); setWindowTitle( tr( "GEOM_TRANSLATION_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_TRANSLATION")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_TRANSLATION" ) );
RadioButton1->setIcon(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setIcon(image1); mainFrame()->RadioButton2->setIcon( image1 );
RadioButton3->setIcon(image2); mainFrame()->RadioButton3->setIcon( image2 );
mainFrame()->RadioButton1->setChecked( true );
RadioButton1->setChecked(true); GroupPoints = new DlgRef_3Sel3Spin1Check( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
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" ) );
GroupPoints->PushButton1->setIcon( image3 );
GroupPoints->PushButton2->setIcon( image3 );
GroupPoints->PushButton3->setIcon( image3 );
GroupPoints->CheckBox1->setText( tr( "GEOM_CREATE_COPY" ) );
GroupPoints = new DlgRef_3Sel3Spin1Check(this, "GroupPoints"); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); layout->setMargin( 0 ); layout->setSpacing( 6 );
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); layout->addWidget( GroupPoints );
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"));
GroupPoints->PushButton1->setIcon(image3);
GroupPoints->PushButton2->setIcon(image3);
GroupPoints->PushButton3->setIcon(image3);
GroupPoints->CheckBox1->setText(tr("GEOM_CREATE_COPY"));
gridLayout1->addWidget(GroupPoints, 2, 0);
/***************************************************************/ /***************************************************************/
setHelpFileName("translation.htm"); setHelpFileName( "translation.htm" );
Init(); Init();
} }
@ -108,54 +103,58 @@ void TransformationGUI_TranslationDlg::Init()
{ {
/* init variables */ /* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setReadOnly(true); GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly(true); GroupPoints->LineEdit2->setReadOnly( true );
GroupPoints->LineEdit3->setReadOnly(true); GroupPoints->LineEdit3->setReadOnly( true );
myVector = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); myVector = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
// Activate Create a Copy mode // Activate Create a Copy mode
GroupPoints->CheckBox1->setChecked(true); GroupPoints->CheckBox1->setChecked( true );
CreateCopyModeChanged(true); CreateCopyModeChanged( true );
/* Get setting of step value from file configuration */ /* Get setting of step value from file configuration */
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); initSpinBox( GroupPoints->SpinBox1, COORD_MIN, COORD_MAX, step, 3 );
GroupPoints->SpinBox2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); initSpinBox( GroupPoints->SpinBox2, COORD_MIN, COORD_MAX, step, 3 );
GroupPoints->SpinBox3->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); initSpinBox( GroupPoints->SpinBox3, COORD_MIN, COORD_MAX, step, 3 );
GroupPoints->SpinBox1->SetValue(0.0); GroupPoints->SpinBox1->setValue( 0.0 );
GroupPoints->SpinBox2->SetValue(0.0); GroupPoints->SpinBox2->setValue( 0.0 );
GroupPoints->SpinBox3->SetValue(0.0); GroupPoints->SpinBox3->setValue( 0.0 );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); //@ Delete ? connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(GroupPoints->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); //@ Delete ?
connect(GroupPoints->SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
connect(GroupPoints->SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect( GroupPoints->SpinBox1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
connect( GroupPoints->SpinBox2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
connect( GroupPoints->SpinBox3, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox1, SLOT(SetStep(double))); // VSR: TODO ->>
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox2, SLOT(SetStep(double))); connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox1, SLOT( SetStep( double ) ) );
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox3, 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( GroupPoints->CheckBox1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) );
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_TRANSLATION" ) );
initName( tr( "GEOM_TRANSLATION" ).toLatin1().constData() );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -164,48 +163,48 @@ void TransformationGUI_TranslationDlg::Init()
// function : ConstructorsClicked() // function : ConstructorsClicked()
// purpose : Radio button management // purpose : Radio button management
//================================================================================= //=================================================================================
void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId) void TransformationGUI_TranslationDlg::ConstructorsClicked( int constructorId )
{ {
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection(); globalSelection();
switch (constructorId) switch ( constructorId ) {
{ case 0: /* translation an object by dx, dy, dz */
case 0: /* translation an object by dx, dy, dz */ {
{ GroupPoints->ShowRows( 1, 2, false );
GroupPoints->ShowRows(1,2,false); GroupPoints->ShowRows( 3, 5, true );
resize(0,0); break;
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->LineEdit2->clear();
GroupPoints->LineEdit3->clear();
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
break;
}
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();
myVector = GEOM::GEOM_Object::_nil();
break;
}
} }
case 1: /* translation an object by 2 points */
{
GroupPoints->ShowRows( 3, 5, false );
GroupPoints->ShowRows( 0, 2, true );
GroupPoints->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
GroupPoints->LineEdit2->clear();
GroupPoints->LineEdit3->clear();
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
break;
}
case 2: /* translation an object by vector */
{
GroupPoints->ShowRows( 2, 5, false );
GroupPoints->ShowRows( 0, 1, true );
GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) );
GroupPoints->LineEdit2->clear();
myVector = GEOM::GEOM_Object::_nil();
break;
}
}
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
} }
@ -241,49 +240,46 @@ bool TransformationGUI_TranslationDlg::ClickOnApply()
//================================================================================= //=================================================================================
void TransformationGUI_TranslationDlg::SelectionIntoArgument() void TransformationGUI_TranslationDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText( "" );
QString aName; QString aName;
if(myEditCurrentArgument == GroupPoints->LineEdit1) if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
{ int aNbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aName );
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName);
if ( aNbSel < 1 ) {
if(aNbSel < 1) myObjects.length( 0 );
{
myObjects.length(0);
return; return;
}
GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects);
if (!myObjects.length())
return;
} }
else GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myObjects );
{ if ( !myObjects.length() )
if (IObjectCount() != 1) { return;
if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) }
myPoint1 = GEOM::GEOM_Object::_nil(); else {
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) if ( IObjectCount() != 1 ) {
myVector = GEOM::GEOM_Object::_nil(); if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 )
else if(myEditCurrentArgument == GroupPoints->LineEdit3) myPoint1 = GEOM::GEOM_Object::_nil();
myPoint2 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2 )
return; myVector = GEOM::GEOM_Object::_nil();
} else if ( myEditCurrentArgument == GroupPoints->LineEdit3 )
myPoint2 = GEOM::GEOM_Object::_nil();
Standard_Boolean testResult = Standard_False;; return;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
if (!testResult || CORBA::is_nil( aSelectedObject ))
return;
if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
myPoint1 = aSelectedObject;
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
myVector = aSelectedObject;
else if(myEditCurrentArgument == GroupPoints->LineEdit3)
myPoint2 = aSelectedObject;
aName = GEOMBase::GetName( aSelectedObject );
} }
Standard_Boolean testResult = Standard_False;;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
if ( !testResult || CORBA::is_nil( aSelectedObject ) )
return;
if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1 )
myPoint1 = aSelectedObject;
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2 )
myVector = aSelectedObject;
else if ( myEditCurrentArgument == GroupPoints->LineEdit3 )
myPoint2 = aSelectedObject;
aName = GEOMBase::GetName( aSelectedObject );
}
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText( aName );
@ -298,11 +294,10 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
void TransformationGUI_TranslationDlg::LineEditReturnPressed() void TransformationGUI_TranslationDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if(send == GroupPoints->LineEdit1) if ( send == GroupPoints->LineEdit1 ) {
{ myEditCurrentArgument = send;
myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed();
GEOMBase_Skeleton::LineEditReturnPressed(); }
}
} }
@ -314,22 +309,19 @@ void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) if ( send == GroupPoints->PushButton1 ) {
{ myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection();
globalSelection(); }
} else if ( send == GroupPoints->PushButton2 ) {
else if (send == GroupPoints->PushButton2) myEditCurrentArgument = GroupPoints->LineEdit2;
{ getConstructorId() == 1 ? globalSelection( GEOM_POINT ) :
myEditCurrentArgument = GroupPoints->LineEdit2; globalSelection( GEOM_LINE );
getConstructorId() == 1 ? globalSelection( GEOM_POINT ) : }
globalSelection( GEOM_LINE ); else if ( send == GroupPoints->PushButton3 ) {
} myEditCurrentArgument = GroupPoints->LineEdit3;
else if (send == GroupPoints->PushButton3) globalSelection( GEOM_POINT );
{ }
myEditCurrentArgument = GroupPoints->LineEdit3;
globalSelection( GEOM_POINT );
}
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
SelectionIntoArgument(); SelectionIntoArgument();
@ -343,8 +335,8 @@ void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
void TransformationGUI_TranslationDlg::ActivateThisDialog() void TransformationGUI_TranslationDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
} }
@ -354,9 +346,9 @@ void TransformationGUI_TranslationDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_TranslationDlg::enterEvent(QEvent* e) void TransformationGUI_TranslationDlg::enterEvent( QEvent* )
{ {
if(!GroupConstructors->isEnabled()) if( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -375,7 +367,7 @@ void TransformationGUI_TranslationDlg::ValueChangedInSpinBox()
// function : createOperation // function : createOperation
// purpose : // purpose :
//================================================================================= //=================================================================================
GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation() GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation()
{ {
return myGeomGUI->GetGeomGen()->GetITransformOperations( getStudyId() ); return myGeomGUI->GetGeomGen()->GetITransformOperations( getStudyId() );
} }
@ -385,29 +377,23 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool TransformationGUI_TranslationDlg::isValid( QString& msg ) bool TransformationGUI_TranslationDlg::isValid( QString& /*msg*/ )
{ {
int aConstructorId = getConstructorId(); int aConstructorId = getConstructorId();
switch (aConstructorId) switch ( aConstructorId ) {
{ case 0:
case 0: return !( myObjects.length() == 0 );
{ break;
return !(myObjects.length() == 0 ); case 1:
break; return !( myObjects.length() == 0 || myPoint1->_is_nil() || myPoint2->_is_nil() );
} break;
case 1: case 2:
{ return !( myObjects.length() == 0 || myVector->_is_nil() );
return !(myObjects.length() == 0 || myPoint1->_is_nil() || myPoint2->_is_nil() ); break;
break; default:
} return false;
case 2: }
{
return !(myObjects.length() == 0 || myVector->_is_nil());
break;
}
default: return false;
}
} }
//================================================================================= //=================================================================================
@ -421,70 +407,69 @@ bool TransformationGUI_TranslationDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() ) {
case 0:
{ {
case 0 : double dx = GroupPoints->SpinBox1->value();
{ double dy = GroupPoints->SpinBox2->value();
double dx = GroupPoints->SpinBox1->GetValue(); double dz = GroupPoints->SpinBox3->value();
double dy = GroupPoints->SpinBox2->GetValue();
double dz = GroupPoints->SpinBox3->GetValue(); if ( toCreateCopy ) {
for ( int i = 0; i < myObjects.length(); i++ ) {
if (toCreateCopy) anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateDXDYDZCopy( myObjects[i], dx, dy, dz );
for (int i = 0; i < myObjects.length(); i++) if ( !anObj->_is_nil() )
{ objects.push_back( anObj._retn() );
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++)
{
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 : else {
{ for ( int i = 0; i < myObjects.length(); i++ ) {
if (toCreateCopy) anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateDXDYDZ( myObjects[i], dx, dy, dz );
for (int i = 0; i < myObjects.length(); i++) if ( !anObj->_is_nil() )
{ objects.push_back( anObj._retn() );
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++)
{
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++)
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVectorCopy( myObjects[i], myVector );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
else
for (int i = 0; i < myObjects.length(); i++)
{
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVector( myObjects[i], myVector );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
res = true;
break;
} }
res = true;
break;
} }
case 1:
{
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++ ) {
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++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVectorCopy( myObjects[i], myVector );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
}
else {
for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVector( myObjects[i], myVector );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}
}
res = true;
break;
}
}
return res; return res;
} }
@ -505,7 +490,7 @@ void TransformationGUI_TranslationDlg::closeEvent( QCloseEvent* e )
// function : CreateCopyModeChanged() // function : CreateCopyModeChanged()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_TranslationDlg::CreateCopyModeChanged(bool isCreateCopy) void TransformationGUI_TranslationDlg::CreateCopyModeChanged( bool isCreateCopy )
{ {
GroupBoxName->setEnabled(isCreateCopy); mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
} }

View File

@ -1,34 +1,32 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : TransformationGUI_TranslationDlg.h
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : TransformationGUI_TranslationDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
#ifndef DIALOGBOX_TRANSLATION_H #ifndef TRANSFORMATIONGUI_TRANSLATIONDLG_H
#define DIALOGBOX_TRANSLATION_H #define TRANSFORMATIONGUI_TRANSLATIONDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class DlgRef_3Sel3Spin1Check; class DlgRef_3Sel3Spin1Check;
@ -38,40 +36,41 @@ class DlgRef_3Sel3Spin1Check;
//================================================================================= //=================================================================================
class TransformationGUI_TranslationDlg : public GEOMBase_Skeleton class TransformationGUI_TranslationDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
TransformationGUI_TranslationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, TransformationGUI_TranslationDlg( GeometryGUI*, QWidget* = 0,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); bool = false, Qt::WindowFlags = 0 );
~TransformationGUI_TranslationDlg(); ~TransformationGUI_TranslationDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* );
virtual void closeEvent( QCloseEvent* e ); private:
void Init();
void enterEvent( QEvent* );
private : private:
void Init(); GEOM::GEOM_Object_var myVector, myPoint1, myPoint2;
void enterEvent(QEvent* e); GEOM::ListOfGO myObjects;
GEOM::GEOM_Object_var myVector, myPoint1, myPoint2; DlgRef_3Sel3Spin1Check* GroupPoints;
GEOM::ListOfGO myObjects;
private slots:
DlgRef_3Sel3Spin1Check* GroupPoints; void ClickOnOk();
bool ClickOnApply();
private slots : void ActivateThisDialog();
void ClickOnOk(); void LineEditReturnPressed();
bool ClickOnApply(); void SelectionIntoArgument();
void ActivateThisDialog(); void SetEditCurrentArgument();
void LineEditReturnPressed(); void ValueChangedInSpinBox();
void SelectionIntoArgument(); void ConstructorsClicked( int );
void SetEditCurrentArgument(); void CreateCopyModeChanged( bool );
void ValueChangedInSpinBox();
void ConstructorsClicked(int constructorId);
void CreateCopyModeChanged(bool isCreateCopy);
}; };
#endif // DIALOGBOX_TRANSLATION_H #endif // TRANSFORMATIONGUI_TRANSLATIONDLG_H