*** empty log message ***

This commit is contained in:
vsr 2007-10-23 14:08:53 +00:00
parent c115a0bf0c
commit 652535d466
14 changed files with 1163 additions and 1215 deletions

View File

@ -18,12 +18,9 @@
// //
// 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 : BooleanGUI.cxx // File : BooleanGUI.cxx
// Author : Julia DOOVSKIKH // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
// Module : GEOM //
// $Header$
#include "BlocksGUI.h" #include "BlocksGUI.h"
@ -33,13 +30,12 @@
#include "BlocksGUI_ExplodeDlg.h" #include "BlocksGUI_ExplodeDlg.h"
#include "BlocksGUI_PropagateDlg.h" #include "BlocksGUI_PropagateDlg.h"
#include "GeometryGUI.h" #include <GeometryGUI.h>
#include "SUIT_Desktop.h" #include <SUIT_Desktop.h>
#include "SUIT_MessageBox.h" #include <SUIT_MessageBox.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include <SalomeApp_Application.h>
#include "SalomeApp_Application.h"
//======================================================================= //=======================================================================
// function : BlocksGUI() // function : BlocksGUI()
@ -66,10 +62,9 @@ bool BlocksGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
{ {
getGeometryGUI()->EmitSignalDeactivateDialog(); getGeometryGUI()->EmitSignalDeactivateDialog();
QDialog* aDlg = NULL; QDialog* aDlg = 0;
switch (theCommandID) switch ( theCommandID ) {
{
case 9999: aDlg = new BlocksGUI_BlockDlg ( getGeometryGUI(), parent ); break; case 9999: aDlg = new BlocksGUI_BlockDlg ( getGeometryGUI(), parent ); break;
case 9998: aDlg = new BlocksGUI_TrsfDlg ( getGeometryGUI(), parent ); break; case 9998: aDlg = new BlocksGUI_TrsfDlg ( getGeometryGUI(), parent ); break;
case 9997: aDlg = new BlocksGUI_QuadFaceDlg ( getGeometryGUI(), parent ); break; case 9997: aDlg = new BlocksGUI_QuadFaceDlg ( getGeometryGUI(), parent ); break;
@ -80,8 +75,11 @@ bool BlocksGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
break; break;
} }
if (aDlg != NULL) if ( aDlg ) {
aDlg->updateGeometry();
aDlg->resize( aDlg->minimumSize() );
aDlg->show(); aDlg->show();
}
return true; return true;
} }
@ -91,7 +89,9 @@ bool BlocksGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
//===================================================================================== //=====================================================================================
extern "C" extern "C"
{ {
GEOM_BLOCKSGUI_EXPORT #ifdef WIN32
__declspec( dllexport )
#endif
GEOMGUI* GetLibGUI( GeometryGUI* parent ) GEOMGUI* GetLibGUI( GeometryGUI* parent )
{ {
return new BlocksGUI( parent ); return new BlocksGUI( parent );

View File

@ -18,30 +18,26 @@
// //
// 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 : BuildGUI.h // File : BuildGUI.h
// Author : Julia DOROVSKIKH // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
// Module : GEOM //
#ifndef BLOCKSGUI_H #ifndef BLOCKSGUI_H
#define BLOCKSGUI_H #define BLOCKSGUI_H
#include "GEOM_BlocksGUI.hxx" #include <GEOMGUI.h>
#include "GEOMGUI.h"
//================================================================================= //=================================================================================
// class : BlocksGUI // class : BlocksGUI
// purpose : // purpose :
//================================================================================= //=================================================================================
class GEOM_BLOCKSGUI_EXPORT BlocksGUI : public GEOMGUI class BlocksGUI : public GEOMGUI
{ {
public: public:
BlocksGUI( GeometryGUI* parent ); BlocksGUI( GeometryGUI* );
~BlocksGUI(); ~BlocksGUI();
bool OnGUIEvent (int theCommandID, SUIT_Desktop* parent); bool OnGUIEvent( int, SUIT_Desktop* );
}; };
#endif #endif // BLOCKSGUI_H

View File

@ -18,56 +18,54 @@
// //
// 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 : BlocksGUI_BlockDlg.cxx // File : BlocksGUI_BlockDlg.cxx
// Author : Julia DOROVSKIKH // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
// Module : GEOM //
// $Header$
#include "BlocksGUI_BlockDlg.h" #include "BlocksGUI_BlockDlg.h"
#include "SUIT_Session.h" #include <GEOM_DlgRef.h>
#include "SalomeApp_Application.h" #include <GeometryGUI.h>
#include "LightApp_SelectionMgr.h" #include <GEOMBase.h>
#include "GEOMImpl_Types.hxx" #include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
using namespace std; #include <GEOMImpl_Types.hxx>
#include <qlabel.h>
//================================================================================= //=================================================================================
// class : BlocksGUI_BlockDlg() // class : BlocksGUI_BlockDlg()
// purpose : Constructs a BlocksGUI_BlockDlg which is a child of 'parent'. // purpose : Constructs a BlocksGUI_BlockDlg which is a child of 'parent'.
//================================================================================= //=================================================================================
BlocksGUI_BlockDlg::BlocksGUI_BlockDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal) BlocksGUI_BlockDlg::BlocksGUI_BlockDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
: GEOMBase_Skeleton(theGeometryGUI, parent, "BlockDlg", modal, : GEOMBase_Skeleton( theGeometryGUI, parent )
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_2F" ) ) ); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_2F" ) ) );
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_6F" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_6F" ) ) );
QPixmap imageS( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap imageS( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setCaption(tr("GEOM_BLOCK_TITLE")); setWindowTitle( tr( "GEOM_BLOCK_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_BLOCK")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_BLOCK" ) );
RadioButton1->setPixmap(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setPixmap(image1); mainFrame()->RadioButton2->setIcon( image1 );
RadioButton3->close(TRUE); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
// Create first group // Create first group
Group2F = new DlgRef_2Sel_QTD(this, "Group2F"); Group2F = new DlgRef_2Sel( centralWidget() );
Group2F->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); Group2F->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
Group2F->TextLabel1->setText( tr( "FACE_1" ) ); Group2F->TextLabel1->setText( tr( "FACE_1" ) );
Group2F->TextLabel2->setText( tr( "FACE_2" ) ); Group2F->TextLabel2->setText( tr( "FACE_2" ) );
Group2F->PushButton1->setPixmap(imageS); Group2F->PushButton1->setIcon( imageS );
Group2F->PushButton2->setPixmap(imageS); Group2F->PushButton2->setIcon( imageS );
// Create second group // Create second group
Group6F = new DlgRef_6Sel_QTD(this, "Group2F"); Group6F = new DlgRef_6Sel( centralWidget() );
Group6F->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); Group6F->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
Group6F->TextLabel1->setText( tr( "FACE_1" ) ); Group6F->TextLabel1->setText( tr( "FACE_1" ) );
Group6F->TextLabel2->setText( tr( "FACE_2" ) ); Group6F->TextLabel2->setText( tr( "FACE_2" ) );
@ -75,16 +73,18 @@ BlocksGUI_BlockDlg::BlocksGUI_BlockDlg (GeometryGUI* theGeometryGUI, QWidget* pa
Group6F->TextLabel4->setText( tr( "FACE_4" ) ); Group6F->TextLabel4->setText( tr( "FACE_4" ) );
Group6F->TextLabel5->setText( tr( "FACE_5" ) ); Group6F->TextLabel5->setText( tr( "FACE_5" ) );
Group6F->TextLabel6->setText( tr( "FACE_6" ) ); Group6F->TextLabel6->setText( tr( "FACE_6" ) );
Group6F->PushButton1->setPixmap(imageS); Group6F->PushButton1->setIcon( imageS );
Group6F->PushButton2->setPixmap(imageS); Group6F->PushButton2->setIcon( imageS );
Group6F->PushButton3->setPixmap(imageS); Group6F->PushButton3->setIcon( imageS );
Group6F->PushButton4->setPixmap(imageS); Group6F->PushButton4->setIcon( imageS );
Group6F->PushButton5->setPixmap(imageS); Group6F->PushButton5->setIcon( imageS );
Group6F->PushButton6->setPixmap(imageS); Group6F->PushButton6->setIcon( imageS );
// Add groups to layout // Add groups to layout
Layout1->addWidget(Group2F, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
Layout1->addWidget(Group6F, 2, 0); layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( Group2F );
layout->addWidget( Group6F );
/***************************************************************/ /***************************************************************/
setHelpFileName( "newentity_blocks.htm#HexahedralSolid" ); setHelpFileName( "newentity_blocks.htm#HexahedralSolid" );
@ -119,9 +119,11 @@ void BlocksGUI_BlockDlg::Init()
Group6F->LineEdit6->setReadOnly( true ); Group6F->LineEdit6->setReadOnly( 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)), this, SLOT(ConstructorsClicked(int)));
connect( this, SIGNAL( constructorsClicked( int ) ),
this, SLOT( ConstructorsClicked( int ) ) );
connect( Group2F->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( Group2F->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( Group2F->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( Group2F->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
@ -157,7 +159,6 @@ void BlocksGUI_BlockDlg::ConstructorsClicked (int constructorId)
switch ( constructorId ) { switch ( constructorId ) {
case 0: case 0:
Group6F->hide(); Group6F->hide();
resize(0, 0);
Group2F->show(); Group2F->show();
myEditCurrentArgument = Group2F->LineEdit1; myEditCurrentArgument = Group2F->LineEdit1;
@ -166,7 +167,6 @@ void BlocksGUI_BlockDlg::ConstructorsClicked (int constructorId)
break; break;
case 1: case 1:
Group2F->hide(); Group2F->hide();
resize(0, 0);
Group6F->show(); Group6F->show();
myEditCurrentArgument = Group6F->LineEdit1; myEditCurrentArgument = Group6F->LineEdit1;
@ -185,6 +185,10 @@ void BlocksGUI_BlockDlg::ConstructorsClicked (int constructorId)
myFace1 = myFace2 = GEOM::GEOM_Object::_nil(); myFace1 = myFace2 = GEOM::GEOM_Object::_nil();
myFace3 = myFace4 = myFace5 = myFace6 = myFace1; myFace3 = myFace4 = myFace5 = myFace6 = myFace1;
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
globalSelection( GEOM_FACE ); globalSelection( GEOM_FACE );
SelectionIntoArgument(); SelectionIntoArgument();
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
@ -223,8 +227,7 @@ void BlocksGUI_BlockDlg::SelectionIntoArgument()
erasePreview(); erasePreview();
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
if (IObjectCount() != 1) if ( IObjectCount() != 1 ) {
{
if ( myEditCurrentArgument == Group2F->LineEdit1 || if ( myEditCurrentArgument == Group2F->LineEdit1 ||
myEditCurrentArgument == Group6F->LineEdit1 ) myEditCurrentArgument == Group6F->LineEdit1 )
myFace1 = GEOM::GEOM_Object::_nil(); myFace1 = GEOM::GEOM_Object::_nil();
@ -280,20 +283,26 @@ void BlocksGUI_BlockDlg::SetEditCurrentArgument()
if ( aSender == Group2F->PushButton1 ) { if ( aSender == Group2F->PushButton1 ) {
myEditCurrentArgument = Group2F->LineEdit1; myEditCurrentArgument = Group2F->LineEdit1;
} else if (aSender == Group2F->PushButton2) { }
else if ( aSender == Group2F->PushButton2 ) {
myEditCurrentArgument = Group2F->LineEdit2; myEditCurrentArgument = Group2F->LineEdit2;
}
} else if (aSender == Group6F->PushButton1) { else if ( aSender == Group6F->PushButton1 ) {
myEditCurrentArgument = Group6F->LineEdit1; myEditCurrentArgument = Group6F->LineEdit1;
} else if (aSender == Group6F->PushButton2) { }
else if ( aSender == Group6F->PushButton2 ) {
myEditCurrentArgument = Group6F->LineEdit2; myEditCurrentArgument = Group6F->LineEdit2;
} else if (aSender == Group6F->PushButton3) { }
else if ( aSender == Group6F->PushButton3 ) {
myEditCurrentArgument = Group6F->LineEdit3; myEditCurrentArgument = Group6F->LineEdit3;
} else if (aSender == Group6F->PushButton4) { }
else if ( aSender == Group6F->PushButton4 ) {
myEditCurrentArgument = Group6F->LineEdit4; myEditCurrentArgument = Group6F->LineEdit4;
} else if (aSender == Group6F->PushButton5) { }
else if ( aSender == Group6F->PushButton5 ) {
myEditCurrentArgument = Group6F->LineEdit5; myEditCurrentArgument = Group6F->LineEdit5;
} else if (aSender == Group6F->PushButton6) { }
else if ( aSender == Group6F->PushButton6 ) {
myEditCurrentArgument = Group6F->LineEdit6; myEditCurrentArgument = Group6F->LineEdit6;
} }
@ -322,9 +331,9 @@ void BlocksGUI_BlockDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void BlocksGUI_BlockDlg::enterEvent (QEvent* e) void BlocksGUI_BlockDlg::enterEvent( QEvent* )
{ {
if (!GroupConstructors->isEnabled()) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -343,17 +352,20 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_BlockDlg::createOperation()
//================================================================================= //=================================================================================
bool BlocksGUI_BlockDlg::isValid (QString&) bool BlocksGUI_BlockDlg::isValid (QString&)
{ {
bool ok = false;
switch ( getConstructorId() ) { switch ( getConstructorId() ) {
case 0: case 0:
return !(myFace1->_is_nil() || myFace2->_is_nil()); ok = !( myFace1->_is_nil() || myFace2->_is_nil() );
break;
case 1: case 1:
return !(myFace1->_is_nil() || myFace2->_is_nil() || ok = !( myFace1->_is_nil() || myFace2->_is_nil() ||
myFace3->_is_nil() || myFace4->_is_nil() || myFace3->_is_nil() || myFace4->_is_nil() ||
myFace5->_is_nil() || myFace6->_is_nil() ); myFace5->_is_nil() || myFace6->_is_nil() );
break;
default: default:
return false; break;
} }
return false; return ok;
} }
//================================================================================= //=================================================================================

View File

@ -18,44 +18,39 @@
// //
// 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 : BlocksGUI_BlockDlg.h // File : BlocksGUI_BlockDlg.h
// Author : Julia DOROVSKIKH // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
// Module : GEOM //
#ifndef DIALOGBOX_BLOCK_H #ifndef BLOCKSGUI_BLOCKDLG_H
#define DIALOGBOX_BLOCK_H #define BLOCKSGUI_BLOCKDLG_H
#include "GEOM_BlocksGUI.hxx" #include <GEOMBase_Skeleton.h>
#include "GEOMBase_Skeleton.h"
#include "DlgRef_2Sel_QTD.h"
#include "DlgRef_6Sel_QTD.h"
class DlgRef_2Sel;
class DlgRef_6Sel;
//================================================================================= //=================================================================================
// class : BlocksGUI_BlockDlg // class : BlocksGUI_BlockDlg
// purpose : // purpose :
//================================================================================= //=================================================================================
class GEOM_BLOCKSGUI_EXPORT BlocksGUI_BlockDlg : public GEOMBase_Skeleton class BlocksGUI_BlockDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
BlocksGUI_BlockDlg (GeometryGUI* theGeometryGUI, QWidget* parent, BlocksGUI_BlockDlg( GeometryGUI*, QWidget* );
bool modal = FALSE);
~BlocksGUI_BlockDlg(); ~BlocksGUI_BlockDlg();
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&);
private: private:
void Init(); void Init();
void enterEvent (QEvent* e); void enterEvent( QEvent* );
private: private:
int myConstructorId; int myConstructorId;
@ -63,17 +58,17 @@ private:
GEOM::GEOM_Object_var myFace1, myFace2; GEOM::GEOM_Object_var myFace1, myFace2;
GEOM::GEOM_Object_var myFace3, myFace4, myFace5, myFace6; GEOM::GEOM_Object_var myFace3, myFace4, myFace5, myFace6;
DlgRef_2Sel_QTD* Group2F; DlgRef_2Sel* Group2F;
DlgRef_6Sel_QTD* Group6F; DlgRef_6Sel* Group6F;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void ConstructorsClicked (int constructorId); void ConstructorsClicked( int );
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
}; };
#endif // DIALOGBOX_BLOCK_H #endif // BLOCKSGUI_BLOCKDLG_H

View File

@ -18,93 +18,62 @@
// //
// 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 : BlocksGUI_ExplodeDlg.cxx // File : BlocksGUI_ExplodeDlg.cxx
// Author : Julia DOROVSKIKH // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
// Module : GEOM //
// $Header$
#include "BlocksGUI_ExplodeDlg.h" #include "BlocksGUI_ExplodeDlg.h"
#include "DlgRef_SpinBox.h" #include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include "GEOM_Displayer.h" #include <SUIT_Session.h>
#include <SUIT_Desktop.h>
#include "SUIT_Session.h" #include <SUIT_ResourceMgr.h>
#include "SalomeApp_Application.h" #include <SUIT_ViewWindow.h>
#include "LightApp_SelectionMgr.h" #include <SUIT_ViewManager.h>
#include "OCCViewer_ViewModel.h" #include <SUIT_MessageBox.h>
#include "SALOME_ListIteratorOfListIO.hxx" #include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include "utilities.h" #include <OCCViewer_ViewModel.h>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <qmessagebox.h>
#include <qtextedit.h>
#include <qcheckbox.h>
#include <qlabel.h>
//================================================================================= //=================================================================================
// class : BlocksGUI_ExplodeDlg() // class : BlocksGUI_ExplodeDlg()
// purpose : Constructs a BlocksGUI_ExplodeDlg which is a child of 'parent'. // purpose : Constructs a BlocksGUI_ExplodeDlg which is a child of 'parent'.
//================================================================================= //=================================================================================
BlocksGUI_ExplodeDlg::BlocksGUI_ExplodeDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal) BlocksGUI_ExplodeDlg::BlocksGUI_ExplodeDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
: GEOMBase_Skeleton(theGeometryGUI, parent, "ExplodeDlg", modal, : GEOMBase_Skeleton( theGeometryGUI, parent )
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_EXPLODE" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_EXPLODE" ) ) );
QPixmap imageS( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap imageS( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setCaption(tr("GEOM_BLOCK_EXPLODE_TITLE")); setWindowTitle( tr( "GEOM_BLOCK_EXPLODE_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_BLOCK_EXPLODE")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_BLOCK_EXPLODE" ) );
RadioButton1->setPixmap(image1); mainFrame()->RadioButton1->setIcon( image1 );
RadioButton2->close(TRUE); mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close(TRUE); mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
// Create first group // Create first group
myGrp1 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_ARGUMENTS"), this); myGrp1 = new DlgRef_1Sel2Spin1View1Check( centralWidget() );
myGrp1->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
QGroupBox* aSelGrp = new QGroupBox(3, Qt::Horizontal, myGrp1); myGrp1->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
aSelGrp->setFrameStyle(QFrame::NoFrame); myGrp1->PushButton1->setIcon( imageS );
aSelGrp->setInsideMargin(0); myGrp1->LineEdit1->setReadOnly( true );
myGrp1->TextLabel2->setText( tr( "NB_FACES_MIN" ) );
new QLabel(tr("GEOM_MAIN_OBJECT"), aSelGrp); myGrp1->TextLabel3->setText( tr( "NB_FACES_MAX" ) );
mySelBtn = new QPushButton(aSelGrp); myGrp1->CheckBox1->setText( tr( "GEOM_SUBSHAPE_SELECT" ) );
mySelBtn->setPixmap(imageS);
mySelName = new QLineEdit(aSelGrp);
mySelName->setReadOnly(true);
QGroupBox* aSpinGrp = new QGroupBox(2, Qt::Horizontal, myGrp1);
aSpinGrp->setFrameStyle(QFrame::NoFrame);
aSpinGrp->setInsideMargin(0);
new QLabel(tr("NB_FACES_MIN"), aSpinGrp);
mySpinBoxMin = new DlgRef_SpinBox(aSpinGrp);
new QLabel(tr("NB_FACES_MAX"), aSpinGrp);
mySpinBoxMax = new DlgRef_SpinBox(aSpinGrp);
QGroupBox* anInfoGrp = new QGroupBox(2, Qt::Horizontal, myGrp1);
anInfoGrp->setFrameStyle(QFrame::NoFrame);
anInfoGrp->setInsideMargin(0);
myBlocksNb = new QTextEdit(anInfoGrp);
myBlocksNb->setReadOnly(true);
QGroupBox* aCheckGrp = new QGroupBox(3, Qt::Horizontal, myGrp1);
aCheckGrp->setFrameStyle(QFrame::NoFrame);
aCheckGrp->setInsideMargin(0);
myCheckBtn = new QCheckBox(aCheckGrp, "CheckButton1");
myCheckBtn->setText(tr("GEOM_SUBSHAPE_SELECT"));
// Add groups to layout // Add groups to layout
Layout1->addWidget(myGrp1, 1, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( myGrp1 );
/***************************************************************/ /***************************************************************/
setHelpFileName( "explode_on_blocks.htm" ); setHelpFileName( "explode_on_blocks.htm" );
@ -129,24 +98,24 @@ BlocksGUI_ExplodeDlg::~BlocksGUI_ExplodeDlg()
void BlocksGUI_ExplodeDlg::Init() void BlocksGUI_ExplodeDlg::Init()
{ {
// Set range of spinboxes // Set range of spinboxes
double SpecificStep = 1.0; int SpecificStep = 1;
mySpinBoxMin->RangeStepAndValidator(0.0, 999.0, SpecificStep, 3); initSpinBox( myGrp1->SpinBox1, 0, 999, SpecificStep );
mySpinBoxMax->RangeStepAndValidator(0.0, 999.0, SpecificStep, 3); initSpinBox( myGrp1->SpinBox2, 0, 999, SpecificStep );
if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
!= OCCViewer_Viewer::Type() ) != OCCViewer_Viewer::Type() )
myCheckBtn->setEnabled(false); myGrp1->CheckBox1->setEnabled( false );
// 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(mySelBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( myGrp1->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(mySpinBoxMin, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect( myGrp1->SpinBox1, SIGNAL( valueChanged( int ) ), this, SLOT( ValueChangedInSpinBox( int ) ) );
connect(mySpinBoxMax, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect( myGrp1->SpinBox2, SIGNAL( valueChanged( int ) ), this, SLOT( ValueChangedInSpinBox( int ) ) );
connect(myCheckBtn, SIGNAL(stateChanged(int)), this, SLOT(SubShapeToggled())); connect( myGrp1->CheckBox1, SIGNAL( stateChanged( int ) ), this, SLOT( SubShapeToggled() ) );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
@ -169,16 +138,16 @@ void BlocksGUI_ExplodeDlg::ConstructorsClicked (int constructorId)
switch ( constructorId ) { switch ( constructorId ) {
case 0: case 0:
myGrp1->show(); myGrp1->show();
mySpinBoxMin->SetValue(6.0); myGrp1->SpinBox1->setValue( 6 );
mySpinBoxMax->SetValue(6.0); myGrp1->SpinBox2->setValue( 6 );
myCheckBtn->setChecked(FALSE); myGrp1->CheckBox1->setChecked( false );
break; break;
default: default:
break; break;
} }
// init fields // init fields
myEditCurrentArgument = mySelName; myEditCurrentArgument = myGrp1->LineEdit1;
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
activateSelection(); activateSelection();
@ -206,12 +175,11 @@ bool BlocksGUI_ExplodeDlg::ClickOnApply()
if ( isAllSubShapes() ) { if ( isAllSubShapes() ) {
// More than 30 subshapes : ask confirmation // More than 30 subshapes : ask confirmation
if ( myNbBlocks > 30 ) { if ( myNbBlocks > 30 ) {
const QString caption = tr("GEOM_CONFIRM"); if ( SUIT_MessageBox::warning( this,
const QString text = tr("GEOM_CONFIRM_INFO").arg(myNbBlocks); tr( "GEOM_CONFIRM" ),
const QString button0 = tr("GEOM_BUT_EXPLODE"); tr( "GEOM_CONFIRM_INFO" ).arg( myNbBlocks ),
const QString button1 = tr("GEOM_BUT_CANCEL"); tr( "GEOM_BUT_EXPLODE" ),
tr( "GEOM_BUT_CANCEL" ) ) != 0 )
if (QMessageBox::warning(this, caption, text, button0, button1) != 0)
return false; /* aborted */ return false; /* aborted */
} }
} }
@ -234,7 +202,7 @@ void BlocksGUI_ExplodeDlg::SelectionIntoArgument()
return; return;
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
mySelName->setText(""); myGrp1->LineEdit1->setText( "" );
if ( IObjectCount() == 1 ) { if ( IObjectCount() == 1 ) {
Standard_Boolean aResult = Standard_False; Standard_Boolean aResult = Standard_False;
@ -243,7 +211,7 @@ void BlocksGUI_ExplodeDlg::SelectionIntoArgument()
if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) { if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) {
myObject = anObj; myObject = anObj;
mySelName->setText(GEOMBase::GetName(anObj)); myGrp1->LineEdit1->setText( GEOMBase::GetName( anObj ) );
} }
} }
@ -258,10 +226,10 @@ void BlocksGUI_ExplodeDlg::SetEditCurrentArgument()
{ {
QPushButton* aSender = (QPushButton*)sender(); QPushButton* aSender = (QPushButton*)sender();
if (mySelBtn == aSender) { if ( myGrp1->PushButton1 == aSender ) {
mySelName->setFocus(); myGrp1->LineEdit1->setFocus();
myEditCurrentArgument = mySelName; myEditCurrentArgument = myGrp1->LineEdit1;
myCheckBtn->setChecked(FALSE); myGrp1->CheckBox1->setChecked( false );
} }
activateSelection(); activateSelection();
@ -284,9 +252,9 @@ void BlocksGUI_ExplodeDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void BlocksGUI_ExplodeDlg::enterEvent (QEvent* e) void BlocksGUI_ExplodeDlg::enterEvent( QEvent* )
{ {
if (!GroupConstructors->isEnabled()) if ( !mainFrame()->GroupConstructors->isEnabled() )
this->ActivateThisDialog(); this->ActivateThisDialog();
} }
@ -294,7 +262,7 @@ void BlocksGUI_ExplodeDlg::enterEvent (QEvent* e)
// function : ValueChangedInSpinBox() // function : ValueChangedInSpinBox()
// purpose : // purpose :
//================================================================================= //=================================================================================
void BlocksGUI_ExplodeDlg::ValueChangedInSpinBox (double newValue) void BlocksGUI_ExplodeDlg::ValueChangedInSpinBox()
{ {
if ( !isAllSubShapes() ) if ( !isAllSubShapes() )
activateSelection(); activateSelection();
@ -305,7 +273,7 @@ void BlocksGUI_ExplodeDlg::ValueChangedInSpinBox (double newValue)
//================================================================================= //=================================================================================
// function : SubShapeToggled() // function : SubShapeToggled()
// purpose : Allow user selection of all or only selected sub shapes // purpose : Allow user selection of all or only selected sub shapes
// : Called when 'myCheckBtn' state change // : Called when 'myGrp1->CheckBox1' state change
//================================================================================= //=================================================================================
void BlocksGUI_ExplodeDlg::SubShapeToggled() void BlocksGUI_ExplodeDlg::SubShapeToggled()
{ {
@ -330,7 +298,8 @@ void BlocksGUI_ExplodeDlg::activateSelection()
} }
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
} else { }
else {
displayPreview( true, true, false ); displayPreview( true, true, false );
globalSelection( GEOM_PREVIEW ); globalSelection( GEOM_PREVIEW );
} }
@ -344,26 +313,28 @@ void BlocksGUI_ExplodeDlg::updateButtonState()
{ {
if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
!= OCCViewer_Viewer::Type() || myObject->_is_nil() ) { != OCCViewer_Viewer::Type() || myObject->_is_nil() ) {
myCheckBtn->setChecked(FALSE); myGrp1->CheckBox1->setChecked( false );
myCheckBtn->setEnabled(FALSE); myGrp1->CheckBox1->setEnabled( false );
} else { }
myCheckBtn->setEnabled(TRUE); else {
myGrp1->CheckBox1->setEnabled( true );
} }
myNbBlocks = 0; myNbBlocks = 0;
if ( myObject->_is_nil() ) { if ( myObject->_is_nil() ) {
myBlocksNb->setText(""); myGrp1->TextBrowser1->setText( "" );
} else { }
else {
bool isOnlyBlocks = GEOM::GEOM_IBlocksOperations::_narrow bool isOnlyBlocks = GEOM::GEOM_IBlocksOperations::_narrow
( getOperation() )->IsCompoundOfBlocks( myObject, ( getOperation() )->IsCompoundOfBlocks( myObject,
(int)mySpinBoxMin->GetValue(), myGrp1->SpinBox1->value(),
(int)mySpinBoxMax->GetValue(), myGrp1->SpinBox2->value(),
myNbBlocks ); myNbBlocks );
if ( isOnlyBlocks ) if ( isOnlyBlocks )
myBlocksNb->setText(tr("GEOM_NB_BLOCKS_NO_OTHERS").arg(myNbBlocks)); myGrp1->TextBrowser1->setText( tr( "GEOM_NB_BLOCKS_NO_OTHERS" ).arg( myNbBlocks ) );
else else
myBlocksNb->setText(tr("GEOM_NB_BLOCKS_SOME_OTHERS").arg(myNbBlocks)); myGrp1->TextBrowser1->setText( tr( "GEOM_NB_BLOCKS_SOME_OTHERS" ).arg( myNbBlocks ) );
} }
} }
@ -373,7 +344,7 @@ void BlocksGUI_ExplodeDlg::updateButtonState()
//================================================================================= //=================================================================================
bool BlocksGUI_ExplodeDlg::isAllSubShapes() const bool BlocksGUI_ExplodeDlg::isAllSubShapes() const
{ {
return !myCheckBtn->isChecked() || !myCheckBtn->isEnabled(); return !myGrp1->CheckBox1->isChecked() || !myGrp1->CheckBox1->isEnabled();
} }
//================================================================================= //=================================================================================
@ -391,14 +362,16 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_ExplodeDlg::createOperation()
//================================================================================= //=================================================================================
bool BlocksGUI_ExplodeDlg::isValid( QString& ) bool BlocksGUI_ExplodeDlg::isValid( QString& )
{ {
bool ok = false;
switch ( getConstructorId() ) { switch ( getConstructorId() ) {
case 0: case 0:
if ( IsPreview() ) if ( IsPreview() )
return !myObject->_is_nil(); ok = !myObject->_is_nil();
else else
return !myObject->_is_nil() && (isAllSubShapes() || IObjectCount()); ok = !myObject->_is_nil() && ( isAllSubShapes() || IObjectCount() );
break;
default: default:
return false; break;
} }
return false; return false;
@ -416,8 +389,8 @@ bool BlocksGUI_ExplodeDlg::execute (ObjectList& objects)
case 0: case 0:
aList = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->ExplodeCompoundOfBlocks aList = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->ExplodeCompoundOfBlocks
( myObject, ( myObject,
(int)mySpinBoxMin->GetValue(), myGrp1->SpinBox1->value(),
(int)mySpinBoxMax->GetValue()); myGrp1->SpinBox2->value() );
break; break;
} }
@ -433,13 +406,12 @@ bool BlocksGUI_ExplodeDlg::execute (ObjectList& objects)
myTmpObjs.push_back( GEOM::GEOM_Object::_duplicate( aList[i] ) ); myTmpObjs.push_back( GEOM::GEOM_Object::_duplicate( aList[i] ) );
} }
return objects.size() ? true : false; return objects.size() > 0;
} }
// Throw away sub-shapes not selected by user if not in preview mode // Throw away sub-shapes not selected by user if not in preview mode
// and manual selection is active // and manual selection is active
if (!isAllSubShapes()) if ( !isAllSubShapes() ) {
{
QMap<QString, char> selected; QMap<QString, char> selected;
// Get names of selected objects // Get names of selected objects
@ -466,7 +438,8 @@ bool BlocksGUI_ExplodeDlg::execute (ObjectList& objects)
myTmpObjs.clear(); myTmpObjs.clear();
} else { }
else {
for ( int i = 0, n = aList->length(); i < n; i++ ) for ( int i = 0, n = aList->length(); i < n; i++ )
objects.push_back( GEOM::GEOM_Object::_duplicate( aList[i] ) ); objects.push_back( GEOM::GEOM_Object::_duplicate( aList[i] ) );
} }

View File

@ -18,47 +18,41 @@
// //
// 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 : BlocksGUI_ExplodeDlg.h // File : BlocksGUI_ExplodeDlg.h
// Author : Julia DOROVSKIKH // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
// Module : GEOM //
#ifndef DIALOGBOX_BLOCK_EXPLODE_H #ifndef BLOCKSGUI_EXPLODEDLG_H
#define DIALOGBOX_BLOCK_EXPLODE_H #define BLOCKSGUI_EXPLODEDLG_H
#include "GEOM_BlocksGUI.hxx" #include <GEOMBase_Skeleton.h>
#include "GEOMBase_Skeleton.h" class DlgRef_1Sel2Spin1View1Check;
class DlgRef_SpinBox;
class QTextEdit;
class QCheckBox;
//================================================================================= //=================================================================================
// class : BlocksGUI_ExplodeDlg // class : BlocksGUI_ExplodeDlg
// purpose : // purpose :
//================================================================================= //=================================================================================
class GEOM_BLOCKSGUI_EXPORT BlocksGUI_ExplodeDlg : public GEOMBase_Skeleton class BlocksGUI_ExplodeDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
BlocksGUI_ExplodeDlg (GeometryGUI*, QWidget* parent, bool modal = FALSE); BlocksGUI_ExplodeDlg( GeometryGUI*, QWidget* );
~BlocksGUI_ExplodeDlg(); ~BlocksGUI_ExplodeDlg();
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& msg); virtual bool isValid( QString& );
virtual bool execute (ObjectList& objects); virtual bool execute( ObjectList& );
virtual GEOM::GEOM_Object_ptr getFather(GEOM::GEOM_Object_ptr theObj); virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr );
virtual const char* getNewObjectName() const; virtual const char* getNewObjectName() const;
private: private:
void Init(); void Init();
void enterEvent (QEvent* e); void enterEvent( QEvent* );
void activateSelection(); void activateSelection();
@ -76,30 +70,20 @@ private:
ObjectList myTmpObjs; ObjectList myTmpObjs;
QFrame* myGrp1; DlgRef_1Sel2Spin1View1Check* myGrp1;
QPushButton* mySelBtn;
QLineEdit* mySelName;
DlgRef_SpinBox* mySpinBoxMin;
DlgRef_SpinBox* mySpinBoxMax;
QTextEdit* myBlocksNb;
QCheckBox* myCheckBtn;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void ConstructorsClicked (int constructorId); void ConstructorsClicked( int );
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void SubShapeToggled(); void SubShapeToggled();
void ValueChangedInSpinBox (double newValue); void ValueChangedInSpinBox();
}; };
#endif // DIALOGBOX_BLOCK_EXPLODE_H #endif // BLOCKSGUI_EXPLODEDLG_H

View File

@ -19,26 +19,24 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : BlocksGUI_PropagateDlg.cxx // File : BlocksGUI_PropagateDlg.cxx
// Author : VKN // Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com)
// Module : GEOM //
// $Header$
#include "BlocksGUI_PropagateDlg.h" #include "BlocksGUI_PropagateDlg.h"
#include "GEOMImpl_Types.hxx"
#include "SUIT_Session.h" #include <GEOM_DlgRef.h>
#include "SalomeApp_Application.h" #include <GeometryGUI.h>
#include "LightApp_SelectionMgr.h" #include <GEOMBase.h>
#include <GEOMImpl_Types.hxx>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#include <qlabel.h>
using namespace std;
//================================================================================= //=================================================================================
// class : BlocksGUI_PropagateDlg() // class : BlocksGUI_PropagateDlg()
// purpose : Constructs a BlocksGUI_PropagateDlg which is a child of 'parent', with the // purpose : Constructs a BlocksGUI_PropagateDlg which is a child of 'parent', with the
@ -46,34 +44,31 @@ 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.
//================================================================================= //=================================================================================
BlocksGUI_PropagateDlg::BlocksGUI_PropagateDlg(GeometryGUI* theGeometryGUI, QWidget* parent, BlocksGUI_PropagateDlg::BlocksGUI_PropagateDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
const char* name, bool modal, WFlags fl) : GEOMBase_Skeleton( theGeometryGUI, parent )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PROPAGATE" ) ) ); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PROPAGATE" ) ) );
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setCaption(tr("GEOM_PROPAGATE_TITLE")); setWindowTitle( tr( "GEOM_PROPAGATE_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_PROPAGATE_TITLE")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_PROPAGATE_TITLE" ) );
RadioButton1->setPixmap(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->close(TRUE); mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close(TRUE); mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_SELECTED_SHAPE" ), this ); myGrp = new DlgRef_1Sel( centralWidget() );
QGroupBox* aSelGrp = new QGroupBox(3, Qt::Horizontal, aMainGrp); myGrp->GroupBox1->setTitle( tr( "GEOM_SELECTED_SHAPE" ) );
aSelGrp->setFrameStyle(QFrame::NoFrame); myGrp->TextLabel1->setText( tr( "GEOM_OBJECT" ) );
aSelGrp->setInsideMargin(0); myGrp->PushButton1->setIcon( image1 );
myGrp->LineEdit1->setReadOnly( true );
new QLabel(tr("GEOM_OBJECT"), aSelGrp); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
mySelBtn = new QPushButton(aSelGrp); layout->setMargin( 0 ); layout->setSpacing( 6 );
mySelBtn->setPixmap(image1); layout->addWidget( myGrp );
mySelName = new QLineEdit(aSelGrp);
mySelName->setReadOnly(true);
Layout1->addWidget(aMainGrp, 1, 0);
/***************************************************************/ /***************************************************************/
@ -99,16 +94,16 @@ void BlocksGUI_PropagateDlg::Init()
/* init variables */ /* init variables */
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
ResultName->setText( "" ); mainFrame()->ResultName->setText( "" );
//myGeomGUI->SetState( 0 ); //myGeomGUI->SetState( 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(mySelBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( myGrp->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(mySelName, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( myGrp->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
activateSelection(); activateSelection();
} }
@ -135,7 +130,7 @@ bool BlocksGUI_PropagateDlg::ClickOnApply()
initName(); initName();
mySelName->setText(""); myGrp->LineEdit1->setText( "" );
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
activateSelection(); activateSelection();
@ -150,7 +145,7 @@ bool BlocksGUI_PropagateDlg::ClickOnApply()
//================================================================================= //=================================================================================
void BlocksGUI_PropagateDlg::SelectionIntoArgument() void BlocksGUI_PropagateDlg::SelectionIntoArgument()
{ {
mySelName->setText(""); myGrp->LineEdit1->setText( "" );
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
if ( IObjectCount() == 1 ) { if ( IObjectCount() == 1 ) {
@ -158,7 +153,7 @@ void BlocksGUI_PropagateDlg::SelectionIntoArgument()
Standard_Boolean aRes; Standard_Boolean aRes;
myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( aRes ) if ( aRes )
mySelName->setText( GEOMBase::GetName( myObject ) ); myGrp->LineEdit1->setText( GEOMBase::GetName( myObject ) );
} }
} }
@ -169,8 +164,8 @@ void BlocksGUI_PropagateDlg::SelectionIntoArgument()
void BlocksGUI_PropagateDlg::SetEditCurrentArgument() void BlocksGUI_PropagateDlg::SetEditCurrentArgument()
{ {
const QObject* send = sender(); const QObject* send = sender();
if ( send == mySelBtn ) { if ( send == myGrp->PushButton1 ) {
mySelName->setFocus(); myGrp->LineEdit1->setFocus();
} }
activateSelection(); activateSelection();
} }
@ -183,7 +178,7 @@ void BlocksGUI_PropagateDlg::SetEditCurrentArgument()
void BlocksGUI_PropagateDlg::LineEditReturnPressed() void BlocksGUI_PropagateDlg::LineEditReturnPressed()
{ {
const QObject* send = sender(); const QObject* send = sender();
if( send == mySelName ) { if ( send == myGrp->LineEdit1 ) {
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
} }
@ -197,7 +192,7 @@ void BlocksGUI_PropagateDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
mySelName->setText(""); myGrp->LineEdit1->setText( "" );
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
//myGeomGUI->SetState( 0 ); //myGeomGUI->SetState( 0 );
@ -209,9 +204,9 @@ void BlocksGUI_PropagateDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it // purpose : Mouse enter onto the dialog to activate it
//================================================================================= //=================================================================================
void BlocksGUI_PropagateDlg::enterEvent(QEvent* e) void BlocksGUI_PropagateDlg::enterEvent( QEvent* )
{ {
if ( !GroupConstructors->isEnabled() ) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -239,7 +234,7 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_PropagateDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool BlocksGUI_PropagateDlg::isValid( QString& msg ) bool BlocksGUI_PropagateDlg::isValid( QString& )
{ {
return !myObject->_is_nil() ; return !myObject->_is_nil() ;
} }
@ -250,19 +245,17 @@ bool BlocksGUI_PropagateDlg::isValid( QString& msg )
//================================================================================= //=================================================================================
bool BlocksGUI_PropagateDlg::execute( ObjectList& objects ) bool BlocksGUI_PropagateDlg::execute( ObjectList& objects )
{ {
GEOM::ListOfGO_var aList = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->Propagate( myObject ); GEOM::ListOfGO_var aList = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->Propagate( myObject );
ResultName->setText( "" ); mainFrame()->ResultName->setText( "" );
if ( !aList->length() ) if ( !aList->length() )
return false; return false;
for ( int i = 0, n = aList->length(); i < n; i++ ) for ( int i = 0, n = aList->length(); i < n; i++ ) {
{
objects.push_back( aList[i]._retn() ); objects.push_back( aList[i]._retn() );
} }
return objects.size() ? true : false; return objects.size() > 0;
} }
//================================================================================= //=================================================================================

View File

@ -19,39 +19,35 @@
// //
// 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 : BlocksGUI_PropagateDlg.h // File : BlocksGUI_PropagateDlg.h
// Author : VKN // Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com)
// Module : GEOM //
#ifndef DIALOGBOX_BlocksGUI_PropagateDlg_H #ifndef BLOCKSGUI_PROPAGATEDLG_H
#define DIALOGBOX_BlocksGUI_PropagateDlg_H #define BLOCKSGUI_PROPAGATEDLG_H
#include "GEOM_BlocksGUI.hxx" #include <GEOMBase_Skeleton.h>
#include "GEOMBase_Skeleton.h"
class DlgRef_1Sel;
//================================================================================= //=================================================================================
// class : BlocksGUI_PropagateDlg // class : BlocksGUI_PropagateDlg
// purpose : // purpose :
//================================================================================= //=================================================================================
class GEOM_BLOCKSGUI_EXPORT BlocksGUI_PropagateDlg : public GEOMBase_Skeleton class BlocksGUI_PropagateDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
BlocksGUI_PropagateDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, BlocksGUI_PropagateDlg( GeometryGUI*, QWidget* = 0 );
const char* name = "", bool modal = FALSE, WFlags fl = 0);
~BlocksGUI_PropagateDlg(); ~BlocksGUI_PropagateDlg();
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 GEOM::GEOM_Object_ptr getFather(GEOM::GEOM_Object_ptr theObj); virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr );
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
@ -65,14 +61,13 @@ private slots:
private: private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent( QEvent* );
void closeEvent(QCloseEvent* e); void closeEvent( QCloseEvent* );
void activateSelection(); void activateSelection();
private: private:
GEOM::GEOM_Object_var myObject; GEOM::GEOM_Object_var myObject;
QPushButton* mySelBtn; DlgRef_1Sel* myGrp;
QLineEdit* mySelName;
}; };
#endif // DIALOGBOX_BlocksGUI_PropagateDlg_H #endif // BLOCKSGUI_PROPAGATEDLG_H

View File

@ -18,19 +18,21 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : BlocksGUI_QuadFaceDlg.cxx // File : BlocksGUI_QuadFaceDlg.cxx
// Author : Julia DOROVSKIKH // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
// Module : GEOM //
// $Header$
#include "BlocksGUI_QuadFaceDlg.h" #include "BlocksGUI_QuadFaceDlg.h"
#include "GEOMImpl_Types.hxx"
#include "SUIT_Session.h" #include <GEOM_DlgRef.h>
#include "SalomeApp_Application.h" #include <GeometryGUI.h>
#include "LightApp_SelectionMgr.h" #include <GEOMBase.h>
#include <GEOMImpl_Types.hxx>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <qlabel.h> #include <qlabel.h>
@ -38,9 +40,8 @@
// class : BlocksGUI_QuadFaceDlg() // class : BlocksGUI_QuadFaceDlg()
// purpose : Constructs a BlocksGUI_QuadFaceDlg which is a child of 'parent'. // purpose : Constructs a BlocksGUI_QuadFaceDlg which is a child of 'parent'.
//================================================================================= //=================================================================================
BlocksGUI_QuadFaceDlg::BlocksGUI_QuadFaceDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal) BlocksGUI_QuadFaceDlg::BlocksGUI_QuadFaceDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
: GEOMBase_Skeleton(theGeometryGUI, parent, "QuadFaceDlg", modal, : GEOMBase_Skeleton( theGeometryGUI, parent )
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_QUAD_FACE_4_VERT" ) ) ); QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_QUAD_FACE_4_VERT" ) ) );
@ -48,56 +49,44 @@ BlocksGUI_QuadFaceDlg::BlocksGUI_QuadFaceDlg (GeometryGUI* theGeometryGUI, QWidg
QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_QUAD_FACE_4_EDGE" ) ) ); QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_QUAD_FACE_4_EDGE" ) ) );
QPixmap imageS( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap imageS( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setCaption(tr("GEOM_QUAD_FACE_TITLE")); setWindowTitle( tr( "GEOM_QUAD_FACE_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_QUAD_FACE")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_QUAD_FACE" ) );
RadioButton1->setPixmap(image1); mainFrame()->RadioButton1->setIcon( image1 );
RadioButton2->setPixmap(image2); mainFrame()->RadioButton2->setIcon( image2 );
RadioButton3->setPixmap(image3); mainFrame()->RadioButton3->setIcon( image3 );
// Create first group // Create first group
myGrp1 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_ARGUMENTS"), this); myGrp1 = new QGroupBox( tr( "GEOM_ARGUMENTS" ), centralWidget() );
QGroupBox* aSelGrp1 = new QGroupBox(3, Qt::Horizontal, myGrp1); createSelWg( tr( "VERTEX_1" ), imageS, myGrp1, Vertex1 );
aSelGrp1->setFrameStyle(QFrame::NoFrame); createSelWg( tr( "VERTEX_2" ), imageS, myGrp1, Vertex2 );
aSelGrp1->setInsideMargin(0); createSelWg( tr( "VERTEX_3" ), imageS, myGrp1, Vertex3 );
createSelWg( tr( "VERTEX_4" ), imageS, myGrp1, Vertex4 );
createSelWg(tr("VERTEX_1"), imageS, aSelGrp1, Vertex1);
createSelWg(tr("VERTEX_2"), imageS, aSelGrp1, Vertex2);
createSelWg(tr("VERTEX_3"), imageS, aSelGrp1, Vertex3);
createSelWg(tr("VERTEX_4"), imageS, aSelGrp1, Vertex4);
// Create second group // Create second group
myGrp2 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_ARGUMENTS"), this); myGrp2 = new QGroupBox( tr( "GEOM_ARGUMENTS" ), centralWidget() );
QGroupBox* aSelGrp2 = new QGroupBox(3, Qt::Horizontal, myGrp2); createSelWg( tr( "EDGE_1" ), imageS, myGrp2, Edge12 );
aSelGrp2->setFrameStyle(QFrame::NoFrame); createSelWg( tr( "EDGE_2" ), imageS, myGrp2, Edge22 );
aSelGrp2->setInsideMargin(0);
createSelWg(tr("EDGE_1"), imageS, aSelGrp2, Edge12);
createSelWg(tr("EDGE_2"), imageS, aSelGrp2, Edge22);
// Create fird group // Create fird group
myGrp3 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_ARGUMENTS"), this); myGrp3 = new QGroupBox( tr( "GEOM_ARGUMENTS" ), centralWidget() );
QGroupBox* aSelGrp3 = new QGroupBox(3, Qt::Horizontal, myGrp3); createSelWg( tr( "EDGE_1" ), imageS, myGrp3, Edge14 );
aSelGrp3->setFrameStyle(QFrame::NoFrame); createSelWg( tr( "EDGE_2" ), imageS, myGrp3, Edge24 );
aSelGrp3->setInsideMargin(0); createSelWg( tr( "EDGE_3" ), imageS, myGrp3, Edge34 );
createSelWg( tr( "EDGE_4" ), imageS, myGrp3, Edge44 );
createSelWg(tr("EDGE_1"), imageS, aSelGrp3, Edge14);
createSelWg(tr("EDGE_2"), imageS, aSelGrp3, Edge24);
createSelWg(tr("EDGE_3"), imageS, aSelGrp3, Edge34);
createSelWg(tr("EDGE_4"), imageS, aSelGrp3, Edge44);
(new QLabel(myGrp3))->setSizePolicy(
QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
// Add groups to layout // Add groups to layout
Layout1->addWidget(myGrp1, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
Layout1->addWidget(myGrp2, 2, 0); layout->setMargin( 0 ); layout->setSpacing( 6 );
Layout1->addWidget(myGrp3, 2, 0); layout->addWidget( myGrp1 );
layout->addWidget( myGrp2 );
layout->addWidget( myGrp3 );
/***************************************************************/ /***************************************************************/
setHelpFileName( "newentity_blocks.htm#QuadrangleFace" ); setHelpFileName( "newentity_blocks.htm#QuadrangleFace" );
@ -121,13 +110,15 @@ BlocksGUI_QuadFaceDlg::~BlocksGUI_QuadFaceDlg()
void BlocksGUI_QuadFaceDlg::Init() void BlocksGUI_QuadFaceDlg::Init()
{ {
// signals and slots connections // signals and slots connections
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( this, SIGNAL( constructorsClicked( int ) ),
this, SLOT( ConstructorsClicked( int ) ) );
QMap<int, QPushButton*>::iterator anIterBtn; QMap<int, QPushButton*>::iterator anIterBtn;
for ( anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn ) for ( anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn )
connect(anIterBtn.data(), SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( anIterBtn.value(), SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
@ -176,12 +167,16 @@ void BlocksGUI_QuadFaceDlg::ConstructorsClicked (int constructorId)
// clear line edits // clear line edits
QMap<int, QLineEdit*>::iterator anIterLE; QMap<int, QLineEdit*>::iterator anIterLE;
for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE ) for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )
anIterLE.data()->setText(""); anIterLE.value()->setText( "" );
// init fields // init fields
myShape1 = myShape2 = GEOM::GEOM_Object::_nil(); myShape1 = myShape2 = GEOM::GEOM_Object::_nil();
myShape3 = myShape4 = myShape1; myShape3 = myShape4 = myShape1;
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
activateSelection(); activateSelection();
} }
@ -221,7 +216,7 @@ void BlocksGUI_QuadFaceDlg::SelectionIntoArgument()
int aCurrFocus = -1; int aCurrFocus = -1;
QMap<int, QLineEdit*>::iterator anIter; QMap<int, QLineEdit*>::iterator anIter;
for ( anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter ) { for ( anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter ) {
if (myEditCurrentArgument == anIter.data()) { if ( myEditCurrentArgument == anIter.value() ) {
aCurrFocus = anIter.key(); aCurrFocus = anIter.key();
break; break;
} }
@ -234,26 +229,34 @@ void BlocksGUI_QuadFaceDlg::SelectionIntoArgument()
if ( aResult ) { if ( aResult ) {
if (anObj->_is_nil()) { if (anObj->_is_nil()) {
aResult = Standard_False; aResult = Standard_False;
} else { }
else {
mySelName[aCurrFocus]->setText( GEOMBase::GetName( anObj ) ); mySelName[aCurrFocus]->setText( GEOMBase::GetName( anObj ) );
} }
} else { }
else {
anObj = GEOM::GEOM_Object::_nil(); anObj = GEOM::GEOM_Object::_nil();
} }
} }
if (aCurrFocus == Vertex1 || aCurrFocus == Edge12 || aCurrFocus == Edge14) { switch ( aCurrFocus ) {
myShape1 = anObj; case Vertex1:
} else if (aCurrFocus == Vertex2 || aCurrFocus == Edge22 || aCurrFocus == Edge24) { case Edge12:
myShape2 = anObj; case Edge14:
} else if (aCurrFocus == Vertex3 || aCurrFocus == Edge34) { myShape1 = anObj; break;
myShape3 = anObj; case Vertex2:
} else if (aCurrFocus == Vertex4 || aCurrFocus == Edge44) { case Edge22:
myShape4 = anObj; case Edge24:
} else { myShape2 = anObj; break;
case Vertex3:
case Edge34:
myShape3 = anObj; break;
case Vertex4:
case Edge44:
myShape4 = anObj; break;
default:
return; return;
} }
displayPreview(); displayPreview();
} }
@ -267,7 +270,7 @@ void BlocksGUI_QuadFaceDlg::SetEditCurrentArgument()
QMap<int, QPushButton*>::iterator anIter; QMap<int, QPushButton*>::iterator anIter;
for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter ) { for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter ) {
if (anIter.data() == aSender) { if ( anIter.value() == aSender ) {
mySelName[anIter.key()]->setFocus(); mySelName[anIter.key()]->setFocus();
myEditCurrentArgument = mySelName[anIter.key()]; myEditCurrentArgument = mySelName[anIter.key()];
} }
@ -294,9 +297,9 @@ void BlocksGUI_QuadFaceDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void BlocksGUI_QuadFaceDlg::enterEvent (QEvent* e) void BlocksGUI_QuadFaceDlg::enterEvent( QEvent* )
{ {
if (!GroupConstructors->isEnabled()) if ( !mainFrame()->GroupConstructors->isEnabled() )
this->ActivateThisDialog(); this->ActivateThisDialog();
} }
@ -319,11 +322,24 @@ void BlocksGUI_QuadFaceDlg::createSelWg (const QString& theLbl,
QWidget* theParent, QWidget* theParent,
const int theId ) const int theId )
{ {
new QLabel(theLbl, theParent); QLabel* lab = new QLabel( theLbl, theParent );
mySelBtn[theId] = new QPushButton( theParent ); mySelBtn[theId] = new QPushButton( theParent );
mySelBtn[theId]->setPixmap(thePix); mySelBtn[theId]->setIcon( thePix );
mySelBtn[theId]->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
mySelName[theId] = new QLineEdit( theParent ); mySelName[theId] = new QLineEdit( theParent );
mySelName[theId]->setReadOnly( true ); mySelName[theId]->setReadOnly( true );
QGridLayout* l = 0;
if ( !theParent->layout() ) {
l = new QGridLayout( theParent );
l->setMargin( 9 ); l->setSpacing( 6 );
}
else {
l = qobject_cast<QGridLayout*>( theParent->layout() );
}
int row = l->rowCount();
l->addWidget( lab, row, 0 );
l->addWidget( mySelBtn[theId], row, 1 );
l->addWidget( mySelName[theId], row, 2 );
} }
//================================================================================= //=================================================================================
@ -336,10 +352,9 @@ void BlocksGUI_QuadFaceDlg::activateSelection()
myEditCurrentArgument == mySelName[Vertex2] || myEditCurrentArgument == mySelName[Vertex2] ||
myEditCurrentArgument == mySelName[Vertex3] || myEditCurrentArgument == mySelName[Vertex3] ||
myEditCurrentArgument == mySelName[Vertex4] ) { myEditCurrentArgument == mySelName[Vertex4] ) {
globalSelection( GEOM_POINT ); globalSelection( GEOM_POINT );
}
} else { else {
globalSelection( GEOM_EDGE ); globalSelection( GEOM_EDGE );
} }
@ -361,19 +376,23 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_QuadFaceDlg::createOperation()
//================================================================================= //=================================================================================
bool BlocksGUI_QuadFaceDlg::isValid( QString& ) bool BlocksGUI_QuadFaceDlg::isValid( QString& )
{ {
bool ok = false;
switch ( getConstructorId() ) { switch ( getConstructorId() ) {
case 0: case 0:
return (!myShape1->_is_nil() && !myShape2->_is_nil() && ok = ( !myShape1->_is_nil() && !myShape2->_is_nil() &&
!myShape3->_is_nil() && !myShape4->_is_nil() ); !myShape3->_is_nil() && !myShape4->_is_nil() );
break;
case 1: case 1:
return (!myShape1->_is_nil() && !myShape2->_is_nil()); ok = ( !myShape1->_is_nil() && !myShape2->_is_nil() );
break;
case 2: case 2:
return (!myShape1->_is_nil() && !myShape2->_is_nil() && ok = ( !myShape1->_is_nil() && !myShape2->_is_nil() &&
!myShape3->_is_nil() && !myShape4->_is_nil() ); !myShape3->_is_nil() && !myShape4->_is_nil() );
break;
default: default:
return false; break;
} }
return false; return ok;
} }
//================================================================================= //=================================================================================

View File

@ -18,24 +18,26 @@
// //
// 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 : BlocksGUI_QuadFaceDlg.h // File : BlocksGUI_QuadFaceDlg.h
// Author : Julia DOROVSKIKH // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
// Module : GEOM //
#ifndef DIALOGBOX_QUAD_FACE_H #ifndef BLOCKSGUI_QUADFACEDLG_H
#define DIALOGBOX_QUAD_FACE_H #define BLOCKSGUI_QUADFACEDLG_H
#include "GEOM_BlocksGUI.hxx" #include <GEOMBase_Skeleton.h>
#include "GEOMBase_Skeleton.h" #include <QMap>
class QGroupBox;
class QPushButton;
class QLineEdit;
//================================================================================= //=================================================================================
// class : BlocksGUI_QuadFaceDlg // class : BlocksGUI_QuadFaceDlg
// purpose : // purpose :
//================================================================================= //=================================================================================
class GEOM_BLOCKSGUI_EXPORT BlocksGUI_QuadFaceDlg : public GEOMBase_Skeleton class BlocksGUI_QuadFaceDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
@ -44,20 +46,21 @@ class GEOM_BLOCKSGUI_EXPORT BlocksGUI_QuadFaceDlg : public GEOMBase_Skeleton
Edge14, Edge24, Edge34, Edge44 }; Edge14, Edge24, Edge34, Edge44 };
public: public:
BlocksGUI_QuadFaceDlg (GeometryGUI*, QWidget* parent, bool modal = FALSE); BlocksGUI_QuadFaceDlg( GeometryGUI*, QWidget* );
~BlocksGUI_QuadFaceDlg(); ~BlocksGUI_QuadFaceDlg();
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& msg); virtual bool isValid( QString& );
virtual bool execute (ObjectList& objects); virtual bool execute( ObjectList& );
private: private:
void Init(); void Init();
void enterEvent (QEvent* e); void enterEvent( QEvent* );
void createSelWg (const QString&, QPixmap&, QWidget*, const int); void createSelWg( const QString&, QPixmap&,
QWidget*, const int );
void activateSelection(); void activateSelection();
private: private:
@ -68,9 +71,9 @@ private:
GEOM::GEOM_Object_var myShape3; GEOM::GEOM_Object_var myShape3;
GEOM::GEOM_Object_var myShape4; GEOM::GEOM_Object_var myShape4;
QFrame* myGrp1; QGroupBox* myGrp1;
QFrame* myGrp2; QGroupBox* myGrp2;
QFrame* myGrp3; QGroupBox* myGrp3;
QMap<int, QPushButton*> mySelBtn; QMap<int, QPushButton*> mySelBtn;
QMap<int, QLineEdit*> mySelName; QMap<int, QLineEdit*> mySelName;
@ -79,10 +82,10 @@ private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void ConstructorsClicked( int constructorId ); void ConstructorsClicked( int );
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
}; };
#endif // DIALOGBOX_QUAD_FACE_H #endif // BLOCKSGUI_QUADFACEDLG_H

View File

@ -18,105 +18,73 @@
// //
// 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 : BlocksGUI_TrsfDlg.cxx // File : BlocksGUI_TrsfDlg.cxx
// Author : Julia DOROVSKIKH // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
// Module : GEOM //
// $Header$
#include "BlocksGUI_TrsfDlg.h" #include "BlocksGUI_TrsfDlg.h"
#include "DlgRef_SpinBox.h" #include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SalomeApp_Application.h" #include <SUIT_Desktop.h>
#include "LightApp_SelectionMgr.h" #include <SUIT_ResourceMgr.h>
#include "OCCViewer_ViewModel.h" #include <SUIT_ViewWindow.h>
#include <SUIT_ViewManager.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <OCCViewer_ViewModel.h>
#include <TColStd_IndexedMapOfInteger.hxx> #include <TColStd_IndexedMapOfInteger.hxx>
#include <qlabel.h>
//================================================================================= //=================================================================================
// class : BlocksGUI_TrsfDlg() // class : BlocksGUI_TrsfDlg()
// purpose : Constructs a BlocksGUI_TrsfDlg which is a child of 'parent'. // purpose : Constructs a BlocksGUI_TrsfDlg which is a child of 'parent'.
//================================================================================= //=================================================================================
BlocksGUI_TrsfDlg::BlocksGUI_TrsfDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal) BlocksGUI_TrsfDlg::BlocksGUI_TrsfDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
: GEOMBase_Skeleton(theGeometryGUI, parent, "TrsfDlg", modal, : GEOMBase_Skeleton( theGeometryGUI, parent )
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_MULTITRSF_SIMPLE" ) ) ); QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_MULTITRSF_SIMPLE" ) ) );
QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_MULTITRSF_DOUBLE" ) ) ); QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_MULTITRSF_DOUBLE" ) ) );
QPixmap imageS( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap imageS( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setCaption(tr("GEOM_BLOCK_MULTITRSF_TITLE")); setWindowTitle( tr( "GEOM_BLOCK_MULTITRSF_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_BLOCK_MULTITRSF")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_BLOCK_MULTITRSF" ) );
RadioButton1->setPixmap(image1); mainFrame()->RadioButton1->setIcon( image1 );
RadioButton2->setPixmap(image2); mainFrame()->RadioButton2->setIcon( image2 );
RadioButton3->close(TRUE); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
// Create first group // Create first group
myGrp1 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_BLOCK_MULTITRSF_SIMPLE"), this); myGrp1 = new QGroupBox( tr( "GEOM_BLOCK_MULTITRSF_SIMPLE" ), centralWidget() );
QGroupBox* aSelGrp1 = new QGroupBox(3, Qt::Horizontal, myGrp1); createSelWg( tr( "GEOM_MAIN_OBJECT" ), imageS, myGrp1, MainObj1 );
aSelGrp1->setFrameStyle(QFrame::NoFrame); createSelWg( tr( "FACE_1" ), imageS, myGrp1, Face1 );
aSelGrp1->setInsideMargin(0); createSelWg( tr( "FACE_2" ), imageS, myGrp1, Face2 );
createSpinWg( tr( "GEOM_NB_TIMES" ), myGrp1, SpinBox1 );
createSelWg(tr("GEOM_MAIN_OBJECT"), imageS, aSelGrp1, MainObj1);
createSelWg(tr("FACE_1"), imageS, aSelGrp1, Face1);
createSelWg(tr("FACE_2"), imageS, aSelGrp1, Face2);
QGroupBox* aSpinGrp1 = new QGroupBox(1, Qt::Vertical, myGrp1);
aSpinGrp1->setFrameStyle(QFrame::NoFrame);
aSpinGrp1->setInsideMargin(0);
new QLabel(tr("GEOM_NB_TIMES"), aSpinGrp1);
mySpinBox[SpinBox1] = new DlgRef_SpinBox(aSpinGrp1);
// Create second group // Create second group
myGrp2 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_BLOCK_MULTITRSF_DOUBLE"), this); myGrp2 = new QGroupBox( tr( "GEOM_BLOCK_MULTITRSF_DOUBLE" ), centralWidget() );
// U trsf createSelWg( tr( "GEOM_MAIN_OBJECT"), imageS, myGrp2, MainObj2 );
QGroupBox* aSelGrp2U = new QGroupBox(3, Qt::Horizontal, myGrp2); createSelWg( tr( "FACE_1U"), imageS, myGrp2, Face1U );
aSelGrp2U->setFrameStyle(QFrame::NoFrame); createSelWg( tr( "FACE_2U"), imageS, myGrp2, Face2U );
aSelGrp2U->setInsideMargin(0); createSpinWg( tr( "GEOM_NB_TIMES_U" ), myGrp2, SpinBox2U );
createSelWg( tr( "FACE_1V" ), imageS, myGrp2, Face1V );
createSelWg(tr("GEOM_MAIN_OBJECT"), imageS, aSelGrp2U, MainObj2); createSelWg( tr( "FACE_2V" ), imageS, myGrp2, Face2V );
createSelWg(tr("FACE_1U"), imageS, aSelGrp2U, Face1U); createSpinWg( tr( "GEOM_NB_TIMES_V" ), myGrp2, SpinBox2V );
createSelWg(tr("FACE_2U"), imageS, aSelGrp2U, Face2U);
QGroupBox* aSpinGrp2U = new QGroupBox(1, Qt::Vertical, myGrp2);
aSpinGrp2U->setFrameStyle(QFrame::NoFrame);
aSpinGrp2U->setInsideMargin(0);
new QLabel(tr("GEOM_NB_TIMES_U"), aSpinGrp2U);
mySpinBox[SpinBox2U] = new DlgRef_SpinBox(aSpinGrp2U);
// V trsf
QGroupBox* aSelGrp2V = new QGroupBox(3, Qt::Horizontal, myGrp2);
aSelGrp2V->setFrameStyle(QFrame::NoFrame);
aSelGrp2V->setInsideMargin(0);
createSelWg(tr("FACE_1V"), imageS, aSelGrp2V, Face1V);
createSelWg(tr("FACE_2V"), imageS, aSelGrp2V, Face2V);
QGroupBox* aSpinGrp2V = new QGroupBox(1, Qt::Vertical, myGrp2);
aSpinGrp2V->setFrameStyle(QFrame::NoFrame);
aSpinGrp2V->setInsideMargin(0);
new QLabel(tr("GEOM_NB_TIMES_V"), aSpinGrp2V);
mySpinBox[SpinBox2V] = new DlgRef_SpinBox(aSpinGrp2V);
(new QLabel(myGrp2))->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
// Add groups to layout // Add groups to layout
Layout1->addWidget( myGrp1, 2, 0 ); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
Layout1->addWidget( myGrp2, 2, 0 ); layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( myGrp1 );
layout->addWidget( myGrp2 );
/***************************************************************/ /***************************************************************/
setHelpFileName( "multi_transformation.htm" ); setHelpFileName( "multi_transformation.htm" );
@ -141,24 +109,26 @@ void BlocksGUI_TrsfDlg::Init()
{ {
// Set range of spinboxes // Set range of spinboxes
double SpecificStep = 1.0; double SpecificStep = 1.0;
QMap<int, DlgRef_SpinBox*>::iterator anIter; QMap<int, QDoubleSpinBox*>::iterator anIter;
for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter ) { for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter ) {
//anIter.data()->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3); //anIter.data()->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3);
anIter.data()->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); initSpinBox( anIter.value(), 1.0, MAX_NUMBER, SpecificStep, 3 );
} }
// signals and slots connections // signals and slots connections
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( this, SIGNAL( constructorsClicked( int ) ),
this, SLOT( ConstructorsClicked( int ) ) );
QMap<int, QPushButton*>::iterator anIterBtn; QMap<int, QPushButton*>::iterator anIterBtn;
for ( anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn ) for ( anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn )
connect(anIterBtn.data(), SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( anIterBtn.value(), SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
QMap<int, DlgRef_SpinBox*>::iterator anIterSpin; QMap<int, QDoubleSpinBox*>::iterator anIterSpin;
for ( anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin ) for ( anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin )
connect(anIterSpin.data(), SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect( anIterSpin.value(), SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ) ; SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ) ;
@ -185,7 +155,7 @@ void BlocksGUI_TrsfDlg::ConstructorsClicked (int constructorId)
case 0: case 0:
myGrp2->hide(); myGrp2->hide();
myGrp1->show(); myGrp1->show();
mySpinBox[SpinBox1]->SetValue(2.0); mySpinBox[SpinBox1]->setValue( 2.0 );
myEditCurrentArgument = mySelName[MainObj1]; myEditCurrentArgument = mySelName[MainObj1];
myFaces[Face1] = -1; myFaces[Face1] = -1;
myFaces[Face2] = -1; myFaces[Face2] = -1;
@ -193,8 +163,8 @@ void BlocksGUI_TrsfDlg::ConstructorsClicked (int constructorId)
case 1: case 1:
myGrp1->hide(); myGrp1->hide();
myGrp2->show(); myGrp2->show();
mySpinBox[SpinBox2U]->SetValue(2.0); mySpinBox[SpinBox2U]->setValue( 2.0 );
mySpinBox[SpinBox2V]->SetValue(2.0); mySpinBox[SpinBox2V]->setValue( 2.0 );
myEditCurrentArgument = mySelName[MainObj2]; myEditCurrentArgument = mySelName[MainObj2];
myFaces[Face1U] = -1; myFaces[Face1U] = -1;
myFaces[Face2U] = -1; myFaces[Face2U] = -1;
@ -208,11 +178,15 @@ void BlocksGUI_TrsfDlg::ConstructorsClicked (int constructorId)
// clear line edits // clear line edits
QMap<int, QLineEdit*>::iterator anIterLE; QMap<int, QLineEdit*>::iterator anIterLE;
for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE ) for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )
anIterLE.data()->setText(""); anIterLE.value()->setText( "" );
// init fields // init fields
myShape = GEOM::GEOM_Object::_nil(); myShape = GEOM::GEOM_Object::_nil();
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
activateSelection(); activateSelection();
// enableWidgets(); // enableWidgets();
// displayPreview(); // displayPreview();
@ -254,7 +228,7 @@ void BlocksGUI_TrsfDlg::SelectionIntoArgument()
int aCurrFocus = -1; int aCurrFocus = -1;
QMap<int, QLineEdit*>::iterator anIter; QMap<int, QLineEdit*>::iterator anIter;
for ( anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter ) { for ( anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter ) {
if (myEditCurrentArgument == anIter.data()) { if ( myEditCurrentArgument == anIter.value() ) {
aCurrFocus = anIter.key(); aCurrFocus = anIter.key();
break; break;
} }
@ -316,7 +290,7 @@ void BlocksGUI_TrsfDlg::SetEditCurrentArgument()
QMap<int, QPushButton*>::iterator anIter; QMap<int, QPushButton*>::iterator anIter;
for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter ) { for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter ) {
if (anIter.data() == aSender) { if ( anIter.value() == aSender ) {
mySelName[anIter.key()]->setFocus(); mySelName[anIter.key()]->setFocus();
myEditCurrentArgument = mySelName[anIter.key()]; myEditCurrentArgument = mySelName[anIter.key()];
break; break;
@ -344,9 +318,9 @@ void BlocksGUI_TrsfDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void BlocksGUI_TrsfDlg::enterEvent (QEvent* e) void BlocksGUI_TrsfDlg::enterEvent( QEvent* )
{ {
if (!GroupConstructors->isEnabled()) if ( !mainFrame()->GroupConstructors->isEnabled() )
this->ActivateThisDialog(); this->ActivateThisDialog();
} }
@ -354,7 +328,7 @@ void BlocksGUI_TrsfDlg::enterEvent (QEvent* e)
// function : ValueChangedInSpinBox() // function : ValueChangedInSpinBox()
// purpose : // purpose :
//================================================================================= //=================================================================================
void BlocksGUI_TrsfDlg::ValueChangedInSpinBox (double newValue) void BlocksGUI_TrsfDlg::ValueChangedInSpinBox( double )
{ {
displayPreview(); displayPreview();
} }
@ -368,11 +342,47 @@ void BlocksGUI_TrsfDlg::createSelWg (const QString& theLbl,
QWidget* theParent, QWidget* theParent,
const int theId ) const int theId )
{ {
new QLabel(theLbl, theParent); QLabel* lab = new QLabel( theLbl, theParent );
mySelBtn[theId] = new QPushButton( theParent ); mySelBtn[theId] = new QPushButton( theParent );
mySelBtn[theId]->setPixmap(thePix); mySelBtn[theId]->setIcon( thePix );
mySelBtn[theId]->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
mySelName[theId] = new QLineEdit( theParent ); mySelName[theId] = new QLineEdit( theParent );
mySelName[theId]->setReadOnly( true ); mySelName[theId]->setReadOnly( true );
QGridLayout* l = 0;
if ( !theParent->layout() ) {
l = new QGridLayout( theParent );
l->setMargin( 9 ); l->setSpacing( 6 );
}
else {
l = qobject_cast<QGridLayout*>( theParent->layout() );
}
int row = l->rowCount();
l->addWidget( lab, row, 0 );
l->addWidget( mySelBtn[theId], row, 1 );
l->addWidget( mySelName[theId], row, 2 );
}
//=================================================================================
// function : createSpinWg()
// purpose :
//=================================================================================
void BlocksGUI_TrsfDlg::createSpinWg( const QString& theLbl,
QWidget* theParent,
const int theId )
{
QLabel* lab = new QLabel( theLbl, theParent );
mySpinBox[theId] = new QDoubleSpinBox( theParent );
QGridLayout* l = 0;
if ( !theParent->layout() ) {
l = new QGridLayout( theParent );
l->setMargin( 9 ); l->setSpacing( 6 );
}
else {
l = qobject_cast<QGridLayout*>( theParent->layout() );
}
int row = l->rowCount();
l->addWidget( lab, row, 0 );
l->addWidget( mySpinBox[theId], row, 2 );
} }
//================================================================================= //=================================================================================
@ -393,10 +403,12 @@ void BlocksGUI_TrsfDlg::activateSelection()
if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
== OCCViewer_Viewer::Type() ) { == OCCViewer_Viewer::Type() ) {
localSelection( myShape, TopAbs_FACE ); localSelection( myShape, TopAbs_FACE );
} else { }
else {
return; return;
} }
} else { }
else {
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
} }
@ -425,7 +437,8 @@ void BlocksGUI_TrsfDlg::enableWidgets()
myFaces[Face1] = -1; myFaces[Face1] = -1;
myFaces[Face2] = -1; myFaces[Face2] = -1;
} }
} else if (anId == 1) { }
else if ( anId == 1 ) {
mySelName[Face1U]->setEnabled( toEnable ); mySelName[Face1U]->setEnabled( toEnable );
mySelName[Face2U]->setEnabled( toEnable ); mySelName[Face2U]->setEnabled( toEnable );
mySelName[Face1V]->setEnabled( toEnable ); mySelName[Face1V]->setEnabled( toEnable );
@ -463,15 +476,18 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_TrsfDlg::createOperation()
//================================================================================= //=================================================================================
bool BlocksGUI_TrsfDlg::isValid( QString& ) bool BlocksGUI_TrsfDlg::isValid( QString& )
{ {
bool ok = false;
switch ( getConstructorId() ) { switch ( getConstructorId() ) {
case 0: case 0:
return !myShape->_is_nil() && myFaces[Face1] > 0; ok = !myShape->_is_nil() && myFaces[Face1] > 0;
break;
case 1: case 1:
return !myShape->_is_nil() && myFaces[Face1U] > 0 && myFaces[Face1V] > 0; ok = !myShape->_is_nil() && myFaces[Face1U] > 0 && myFaces[Face1V] > 0;
break;
default: default:
return false; break;
} }
return false; return ok;
} }
//================================================================================= //=================================================================================
@ -490,7 +506,7 @@ bool BlocksGUI_TrsfDlg::execute (ObjectList& objects)
( myShape, ( myShape,
myFaces[Face1], myFaces[Face1],
myFaces[Face2], myFaces[Face2],
(int)mySpinBox[SpinBox1]->GetValue()); (int)mySpinBox[SpinBox1]->value() );
res = true; res = true;
break; break;
case 1: case 1:
@ -498,10 +514,10 @@ bool BlocksGUI_TrsfDlg::execute (ObjectList& objects)
( myShape, ( myShape,
myFaces[Face1U], myFaces[Face1U],
myFaces[Face2U], myFaces[Face2U],
(int)mySpinBox[SpinBox2U]->GetValue(), (int)mySpinBox[SpinBox2U]->value(),
myFaces[Face1V], myFaces[Face1V],
myFaces[Face2V], myFaces[Face2V],
(int)mySpinBox[SpinBox2V]->GetValue()); (int)mySpinBox[SpinBox2V]->value() );
res = true; res = true;
break; break;
} }

View File

@ -18,26 +18,27 @@
// //
// 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 : BlocksGUI_TrsfDlg.h // File : BlocksGUI_TrsfDlg.h
// Author : Julia DOROVSKIKH // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
// Module : GEOM //
#ifndef DIALOGBOX_BLOCK_MULTITRSF_H #ifndef BLOCKSGUI_TRSFDLG_H
#define DIALOGBOX_BLOCK_MULTITRSF_H #define BLOCKSGUI_TRSFDLG_H
#include "GEOM_BlocksGUI.hxx" #include <GEOMBase_Skeleton.h>
#include "GEOMBase_Skeleton.h" #include <QMap>
class DlgRef_SpinBox; class QDoubleSpinBox;
class QGroupBox;
class QPushButton;
class QLineEdit;
//================================================================================= //=================================================================================
// class : BlocksGUI_TrsfDlg // class : BlocksGUI_TrsfDlg
// purpose : // purpose :
//================================================================================= //=================================================================================
class GEOM_BLOCKSGUI_EXPORT BlocksGUI_TrsfDlg : public GEOMBase_Skeleton class BlocksGUI_TrsfDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
@ -45,20 +46,23 @@ class GEOM_BLOCKSGUI_EXPORT BlocksGUI_TrsfDlg : public GEOMBase_Skeleton
enum { SpinBox1, SpinBox2U, SpinBox2V }; enum { SpinBox1, SpinBox2U, SpinBox2V };
public: public:
BlocksGUI_TrsfDlg (GeometryGUI*, QWidget* parent, bool modal = FALSE); BlocksGUI_TrsfDlg( GeometryGUI*, QWidget* );
~BlocksGUI_TrsfDlg(); ~BlocksGUI_TrsfDlg();
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& msg); virtual bool isValid( QString& );
virtual bool execute (ObjectList& objects); virtual bool execute( ObjectList& );
private: private:
void Init(); void Init();
void enterEvent (QEvent* e); void enterEvent( QEvent* );
void createSelWg (const QString&, QPixmap&, QWidget*, const int); void createSelWg( const QString&, QPixmap&,
QWidget*, const int );
void createSpinWg( const QString&, QWidget*,
const int );
void activateSelection(); void activateSelection();
void enableWidgets(); void enableWidgets();
@ -68,23 +72,23 @@ private:
GEOM::GEOM_Object_var myShape; GEOM::GEOM_Object_var myShape;
QMap<int, int> myFaces; QMap<int, int> myFaces;
QFrame* myGrp1; QGroupBox* myGrp1;
QFrame* myGrp2; QGroupBox* myGrp2;
QMap<int, QPushButton*> mySelBtn; QMap<int, QPushButton*> mySelBtn;
QMap<int, QLineEdit*> mySelName; QMap<int, QLineEdit*> mySelName;
QMap<int, DlgRef_SpinBox*> mySpinBox; QMap<int, QDoubleSpinBox*> mySpinBox;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void ConstructorsClicked (int constructorId); void ConstructorsClicked( int );
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ValueChangedInSpinBox (double newValue); void ValueChangedInSpinBox( double );
}; };
#endif // DIALOGBOX_BLOCK_MULTITRSF_H #endif // BLOCKSGUI_TRSFDLG_H

View File

@ -1,47 +0,0 @@
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GEOM_BlocksGUI.hxx
// Author : Alexander A. BORODIN
// Module : GEOM
#ifndef _GEOM_BlocksGUI_HXX_
#define _GEOM_BlocksGUI_HXX_
#ifdef WNT
#if defined BLOCKSGUI_EXPORTS
#if defined WIN32
#define GEOM_BLOCKSGUI_EXPORT __declspec( dllexport )
#else
#define GEOM_BLOCKSGUI_EXPORT
#endif
#else
#if defined WIN32
#define GEOM_BLOCKSGUI_EXPORT __declspec( dllimport )
#else
#define GEOM_BLOCKSGUI_EXPORT
#endif
#endif
#else
#define GEOM_BLOCKSGUI_EXPORT
#endif
#endif

View File

@ -18,13 +18,10 @@
# #
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
# File : Makefile.am
# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
# Package : BlockGUI
# #
#
# File : Makefile.in
# Author : Julia DOROVSKIKH (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,6 +32,13 @@ lib_LTLIBRARIES = libBlocksGUI.la
# Sources files # Sources files
dist_libBlocksGUI_la_SOURCES = \ dist_libBlocksGUI_la_SOURCES = \
BlocksGUI.h \
BlocksGUI_QuadFaceDlg.h \
BlocksGUI_BlockDlg.h \
BlocksGUI_ExplodeDlg.h \
BlocksGUI_PropagateDlg.h \
BlocksGUI_TrsfDlg.h \
\
BlocksGUI.cxx \ BlocksGUI.cxx \
BlocksGUI_QuadFaceDlg.cxx \ BlocksGUI_QuadFaceDlg.cxx \
BlocksGUI_BlockDlg.cxx \ BlocksGUI_BlockDlg.cxx \
@ -75,6 +79,7 @@ libBlocksGUI_la_CPPFLAGS = \
-I$(srcdir)/../GEOMClient \ -I$(srcdir)/../GEOMClient \
-I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMImpl \
-I$(srcdir)/../GEOMFiltersSelection \ -I$(srcdir)/../GEOMFiltersSelection \
-I$(top_builddir)/src/DlgRef \
-I$(top_builddir)/idl \ -I$(top_builddir)/idl \
-I$(top_builddir)/salome_adm/unix -I$(top_builddir)/salome_adm/unix