*** empty log message ***

This commit is contained in:
vsr 2007-10-22 07:54:30 +00:00
parent f70f07e7db
commit 5e1fa70bbf
25 changed files with 2176 additions and 2368 deletions

View File

@ -19,13 +19,10 @@
# #
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
# File : Makefile.am
# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
# Package : RepairGUI
# #
#
# File : Makefile.in
# Author : Damien COQUERET (OCC)
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
# $Header:
include $(top_srcdir)/adm_local/unix/make_common_starter.am include $(top_srcdir)/adm_local/unix/make_common_starter.am
@ -36,6 +33,19 @@ salomeinclude_HEADERS =
lib_LTLIBRARIES = libRepairGUI.la lib_LTLIBRARIES = libRepairGUI.la
dist_libRepairGUI_la_SOURCES = \ dist_libRepairGUI_la_SOURCES = \
RepairGUI.h \
RepairGUI_SewingDlg.h \
RepairGUI_SuppressFacesDlg.h \
RepairGUI_ShapeProcessDlg.h \
RepairGUI_CloseContourDlg.h \
RepairGUI_RemoveIntWiresDlg.h \
RepairGUI_RemoveHolesDlg.h \
RepairGUI_DivideEdgeDlg.h \
RepairGUI_FreeBoundDlg.h \
RepairGUI_FreeFacesDlg.h \
RepairGUI_ChangeOrientationDlg.h \
RepairGUI_GlueDlg.h \
\
RepairGUI.cxx \ RepairGUI.cxx \
RepairGUI_SewingDlg.cxx \ RepairGUI_SewingDlg.cxx \
RepairGUI_SuppressFacesDlg.cxx \ RepairGUI_SuppressFacesDlg.cxx \
@ -87,6 +97,7 @@ libRepairGUI_la_CPPFLAGS = \
-I$(srcdir)/../OBJECT \ -I$(srcdir)/../OBJECT \
-I$(srcdir)/../GEOMClient \ -I$(srcdir)/../GEOMClient \
-I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMImpl \
-I$(top_builddir)/src/DlgRef \
-I$(top_builddir)/idl \ -I$(top_builddir)/idl \
-I$(top_builddir)/salome_adm/unix -I$(top_builddir)/salome_adm/unix

View File

@ -19,19 +19,17 @@
// //
// 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 : RepairGUI.cxx // File : RepairGUI.cxx
// Author : Damien COQUERET // Author : Damien COQUERET, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "RepairGUI.h" #include "RepairGUI.h"
#include "SUIT_Desktop.h" #include <GeometryGUI.h>
#include "SUIT_Session.h"
#include "SalomeApp_Application.h" #include <SUIT_Desktop.h>
#include <SUIT_Session.h>
#include <SalomeApp_Application.h>
#include "RepairGUI_SewingDlg.h" // Method SEWING #include "RepairGUI_SewingDlg.h" // Method SEWING
#include "RepairGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES #include "RepairGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES
@ -45,15 +43,12 @@
#include "RepairGUI_GlueDlg.h" // Method GLUE FACES #include "RepairGUI_GlueDlg.h" // Method GLUE FACES
#include "RepairGUI_ChangeOrientationDlg.h" // Method CHANGE ORIENTATION #include "RepairGUI_ChangeOrientationDlg.h" // Method CHANGE ORIENTATION
#include "utilities.h"
using namespace std;
//======================================================================= //=======================================================================
// function : RepairGUI() // function : RepairGUI()
// purpose : Constructor // purpose : Constructor
//======================================================================= //=======================================================================
RepairGUI::RepairGUI( GeometryGUI* parent ) : GEOMGUI( parent ) RepairGUI::RepairGUI( GeometryGUI* parent )
: GEOMGUI( parent )
{ {
} }
@ -79,17 +74,17 @@ bool RepairGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
QDialog* aDlg = NULL; QDialog* aDlg = NULL;
switch ( theCommandID ) { switch ( theCommandID ) {
case 601: aDlg = new RepairGUI_SewingDlg (getGeometryGUI(), parent, ""); break; case 601: aDlg = new RepairGUI_SewingDlg ( getGeometryGUI(), parent ); break;
case 602: aDlg = new RepairGUI_GlueDlg (getGeometryGUI(), parent, ""); break; case 602: aDlg = new RepairGUI_GlueDlg ( getGeometryGUI(), parent ); break;
case 603: aDlg = new RepairGUI_SuppressFacesDlg (getGeometryGUI(), parent, ""); break; case 603: aDlg = new RepairGUI_SuppressFacesDlg ( getGeometryGUI(), parent ); break;
case 604: aDlg = new RepairGUI_RemoveHolesDlg (getGeometryGUI(), parent, ""); break; case 604: aDlg = new RepairGUI_RemoveHolesDlg ( getGeometryGUI(), parent ); break;
case 605: aDlg = new RepairGUI_ShapeProcessDlg (getGeometryGUI(), parent, ""); break; case 605: aDlg = new RepairGUI_ShapeProcessDlg ( getGeometryGUI(), parent ); break;
case 606: aDlg = new RepairGUI_CloseContourDlg (getGeometryGUI(), parent, ""); break; case 606: aDlg = new RepairGUI_CloseContourDlg ( getGeometryGUI(), parent ); break;
case 607: aDlg = new RepairGUI_RemoveIntWiresDlg(getGeometryGUI(), parent, ""); break; case 607: aDlg = new RepairGUI_RemoveIntWiresDlg ( getGeometryGUI(), parent ); break;
case 608: aDlg = new RepairGUI_DivideEdgeDlg (getGeometryGUI(), parent, ""); break; case 608: aDlg = new RepairGUI_DivideEdgeDlg ( getGeometryGUI(), parent ); break;
case 609: aDlg = new RepairGUI_FreeBoundDlg (getGeometryGUI(), parent, ""); break; case 609: aDlg = new RepairGUI_FreeBoundDlg ( getGeometryGUI(), parent ); break;
case 610: aDlg = new RepairGUI_FreeFacesDlg (getGeometryGUI(), parent, ""); break; case 610: aDlg = new RepairGUI_FreeFacesDlg ( getGeometryGUI(), parent ); break;
case 611: aDlg = new RepairGUI_ChangeOrientationDlg (getGeometryGUI(), parent, ""); break; case 611: aDlg = new RepairGUI_ChangeOrientationDlg ( getGeometryGUI(), parent ); break;
default: default:
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
break; break;

View File

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

View File

@ -19,27 +19,25 @@
// //
// 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 : RepairGUI_ChangeOrientationDlg.cxx // File : RepairGUI_ChangeOrientationDlg.cxx
// Author : Sergey KUUL // Author : Sergey KUUL, Open CASCADE S.A.S. (sergey.kuul@opencascade.com)
// Module : GEOM //
#include "RepairGUI_ChangeOrientationDlg.h" #include "RepairGUI_ChangeOrientationDlg.h"
#include "SalomeApp_Application.h" #include <GEOM_DlgRef.h>
#include "LightApp_SelectionMgr.h" #include <GeometryGUI.h>
#include "SUIT_Session.h" #include <GEOMBase.h>
#include "SALOME_ListIteratorOfListIO.hxx"
#include "GEOMImpl_Types.hxx" #include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <GEOMImpl_Types.hxx>
#include <TopAbs.hxx> #include <TopAbs.hxx>
#include <qlabel.h>
using namespace std;
//================================================================================= //=================================================================================
// class : RepairGUI_ChangeOrientationDlg() // class : RepairGUI_ChangeOrientationDlg()
// purpose : Constructs a RepairGUI_ChangeOrientationDlg which is a child of 'parent', // purpose : Constructs a RepairGUI_ChangeOrientationDlg which is a child of 'parent',
@ -48,31 +46,34 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
RepairGUI_ChangeOrientationDlg::RepairGUI_ChangeOrientationDlg( GeometryGUI* theGeometryGUI, RepairGUI_ChangeOrientationDlg::RepairGUI_ChangeOrientationDlg( GeometryGUI* theGeometryGUI,
QWidget* parent, const char* name, QWidget* parent,
bool modal, WFlags fl) bool modal )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | : GEOMBase_Skeleton( theGeometryGUI, parent, modal )
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
//QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SUPRESS_FACE"))); //QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SUPRESS_FACE")));
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CHANGE_ORIENTATION" ) )); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CHANGE_ORIENTATION" ) ));
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_CHANGE_ORIENTATION_TITLE")); setWindowTitle( tr( "GEOM_CHANGE_ORIENTATION_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_CHANGE_ORIENTATION_TITLE")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_CHANGE_ORIENTATION_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();
GroupPoints = new DlgRef_1Sel1Check_QTD(this, "GroupPoints"); GroupPoints = new DlgRef_1Sel1Check( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_CHANGE_ORIENTATION" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_CHANGE_ORIENTATION" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) ); GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) );
GroupPoints->PushButton1->setPixmap(image1); GroupPoints->PushButton1->setIcon( image1 );
// GroupPoints->LineEdit1->setReadOnly( true ); // GroupPoints->LineEdit1->setReadOnly( true );
Layout1->addWidget(GroupPoints, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
setHelpFileName( "change_orientation.htm" ); setHelpFileName( "change_orientation.htm" );
@ -103,8 +104,8 @@ void RepairGUI_ChangeOrientationDlg::Init()
myOkObject = false; myOkObject = 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( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
@ -178,7 +179,6 @@ void RepairGUI_ChangeOrientationDlg::SelectionIntoArgument()
} }
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
} }
@ -190,8 +190,7 @@ void RepairGUI_ChangeOrientationDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if( send == GroupPoints->PushButton1 ) if ( send == GroupPoints->PushButton1 ) {
{
GroupPoints->LineEdit1->setFocus(); GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
} }
@ -222,7 +221,6 @@ void RepairGUI_ChangeOrientationDlg::ActivateThisDialog()
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
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() ) );
} }
@ -230,9 +228,9 @@ void RepairGUI_ChangeOrientationDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it // purpose : Mouse enter onto the dialog to activate it
//================================================================================= //=================================================================================
void RepairGUI_ChangeOrientationDlg::enterEvent(QEvent* e) void RepairGUI_ChangeOrientationDlg::enterEvent( QEvent* )
{ {
if ( !GroupConstructors->isEnabled() ) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -262,7 +260,7 @@ GEOM::GEOM_IOperations_ptr RepairGUI_ChangeOrientationDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool RepairGUI_ChangeOrientationDlg::isValid( QString& msg ) bool RepairGUI_ChangeOrientationDlg::isValid( QString& )
{ {
return myOkObject; return myOkObject;
} }
@ -297,5 +295,5 @@ bool RepairGUI_ChangeOrientationDlg::execute( ObjectList& objects )
//================================================================================= //=================================================================================
void RepairGUI_ChangeOrientationDlg::CreateCopyModeChanged( bool isCreateCopy ) void RepairGUI_ChangeOrientationDlg::CreateCopyModeChanged( bool isCreateCopy )
{ {
GroupBoxName->setEnabled(isCreateCopy); mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
} }

View File

@ -19,20 +19,16 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : RepairGUI_ChangeOrientationDlg.h // File : RepairGUI_ChangeOrientationDlg.h
// Author : Sergey KUUL // Author : Sergey KUUL, Open CASCADE S.A.S. (sergey.kuul@opencascade.com)
// Module : GEOM //
#ifndef DIALOGBOX_CHANGEORIENTATION_H #ifndef REPAIRGUI_CHANGEORIENTATIONDLG_H
#define DIALOGBOX_CHANGEORIENTATION_H #define REPAIRGUI_CHANGEORIENTATIONDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
#include "DlgRef_1Sel1Check_QTD.h"
#include <qcheckbox.h>
//#include <TColStd_IndexedMapOfInteger.hxx> class DlgRef_1Sel1Check;
//================================================================================= //=================================================================================
// class : RepairGUI_ChangeOrientationDlg // class : RepairGUI_ChangeOrientationDlg
@ -43,26 +39,25 @@ class RepairGUI_ChangeOrientationDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
RepairGUI_ChangeOrientationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, RepairGUI_ChangeOrientationDlg( GeometryGUI*, QWidget* = 0, bool = false );
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_ChangeOrientationDlg(); ~RepairGUI_ChangeOrientationDlg();
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* );
void closeEvent(QCloseEvent* e); void closeEvent( QCloseEvent* );
private:
GEOM::GEOM_Object_var myObject; GEOM::GEOM_Object_var myObject;
bool myOkObject; bool myOkObject;
DlgRef_1Sel1Check_QTD* GroupPoints; DlgRef_1Sel1Check* GroupPoints;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
@ -71,7 +66,7 @@ private slots:
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void CreateCopyModeChanged(bool isCreateCopy); void CreateCopyModeChanged( bool );
}; };
#endif // DIALOGBOX_SUPPRESSFACES_H #endif // REPAIRGUI_CHANGEORIENTATIONDLG_H

View File

@ -19,30 +19,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 : RepairGUI_CloseContourDlg.cxx // File : RepairGUI_CloseContourDlg.cxx
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "RepairGUI_CloseContourDlg.h" #include "RepairGUI_CloseContourDlg.h"
#include "SalomeApp_Application.h" #include <GEOM_DlgRef.h>
#include "LightApp_SelectionMgr.h" #include <GeometryGUI.h>
#include "SUIT_Session.h" #include <GEOMBase.h>
#include "SALOME_ListIteratorOfListIO.hxx"
#include "GEOMImpl_Types.hxx" #include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <GEOMImpl_Types.hxx>
#include <TopAbs.hxx> #include <TopAbs.hxx>
#include <TColStd_IndexedMapOfInteger.hxx> #include <TColStd_IndexedMapOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#include <qlabel.h>
using namespace std;
//================================================================================= //=================================================================================
// class : RepairGUI_CloseContourDlg() // class : RepairGUI_CloseContourDlg()
// purpose : Constructs a RepairGUI_CloseContourDlg which is a child of 'parent', with the // purpose : Constructs a RepairGUI_CloseContourDlg which is a child of 'parent', with the
@ -51,56 +48,49 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
RepairGUI_CloseContourDlg::RepairGUI_CloseContourDlg( GeometryGUI* theGeometryGUI, QWidget* parent, RepairGUI_CloseContourDlg::RepairGUI_CloseContourDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl) bool modal )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | : GEOMBase_Skeleton( theGeometryGUI, parent, modal )
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CLOSECONTOUR" ) ) ); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CLOSECONTOUR" ) ) );
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_CLOSECONTOUR_TITLE")); setWindowTitle( tr( "GEOM_CLOSECONTOUR_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_CLOSECONTOUR_TITLE")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_CLOSECONTOUR_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();
GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints"); GroupPoints = new DlgRef_2SelExt( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "Contour to close" ) ); GroupPoints->GroupBox1->setTitle( tr( "Contour to close" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
GroupPoints->PushButton1->setPixmap(image1); GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly( true );
QGridLayout* aSelectWiresLay = new QGridLayout( 0, 1, 1, 0, 6, "aSelectWiresLay"); GroupPoints->TextLabel2->setText( tr( "Contour to close" ) );
GroupPoints->PushButton2->setIcon( image1 );
GroupPoints->LineEdit2->setReadOnly( true );
mySelectWiresBtn = new QPushButton( GroupPoints->GroupBox1, "mySelectWiresBtn" ); QRadioButton* rb1 = new QRadioButton( tr( "Close by common vertex" ), GroupPoints->Box );
mySelectWiresBtn->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, mySelectWiresBtn->sizePolicy().hasHeightForWidth() ) ); QRadioButton* rb2 = new QRadioButton( tr( "Close by new edge" ), GroupPoints->Box );
mySelectWiresBtn->setText( trUtf8( "" ) );
mySelectWiresBtn->setPixmap(image1);
mySelectWiresEdt = new QLineEdit( GroupPoints->GroupBox1, "mySelectWiresEdt" ); myIsVertexGr = new QButtonGroup( GroupPoints->Box );
mySelectWiresEdt->setReadOnly( true ); myIsVertexGr->addButton( rb1, 0 );
myIsVertexGr->addButton( rb2, 1 );
rb1->setChecked( true );
mySelectWiresLbl = new QLabel( tr( "Contour to close" ), GroupPoints->GroupBox1, "ContourLbl" ); QVBoxLayout* l = new QVBoxLayout( GroupPoints->Box );
mySelectWiresLbl->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, mySelectWiresLbl->sizePolicy().hasHeightForWidth() ) ); l->setMargin( 0 ); l->setSpacing( 6 );
l->addWidget( rb1 );
l->addWidget( rb2 );
aSelectWiresLay->addWidget( mySelectWiresLbl, 0, 0 ); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
aSelectWiresLay->addWidget( mySelectWiresBtn, 0, 1 ); layout->setMargin( 0 ); layout->setSpacing( 6 );
aSelectWiresLay->addWidget( mySelectWiresEdt, 0, 2 ); layout->addWidget( GroupPoints );
QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
aSelectWiresLay->addItem( spacer, 1, 2 );
myIsVertexGr = new QButtonGroup( 2, Qt::Vertical, GroupPoints );
myIsVertexGr->setFrameStyle( QFrame::NoFrame );
myIsVertexGr->setRadioButtonExclusive( true );
myIsVertexGr->insert( new QRadioButton( tr( "Close by common vertex" ), myIsVertexGr ), 0 );
myIsVertexGr->insert( new QRadioButton( tr( "Close by new edge" ), myIsVertexGr ), 1 );
myIsVertexGr->find( 0 )->toggle();
Layout1->addWidget(GroupPoints, 2, 0);
GroupPoints->getGroupBoxLayout()->addLayout( aSelectWiresLay, 1, 0 );
GroupPoints->getGroupBoxLayout()->addMultiCellWidget(myIsVertexGr, 2, 2, 0, 2);
/***************************************************************/ /***************************************************************/
setHelpFileName( "close_contour.htm" ); setHelpFileName( "close_contour.htm" );
@ -135,13 +125,13 @@ void RepairGUI_CloseContourDlg::Init()
initSelection(); initSelection();
/* 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->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(mySelectWiresBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(mySelectWiresEdt, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
@ -192,33 +182,29 @@ void RepairGUI_CloseContourDlg::SelectionIntoArgument()
{ {
erasePreview(); erasePreview();
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
mySelectWiresEdt->setText( "" ); GroupPoints->LineEdit2->setText( "" );
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == mySelectWiresEdt ) else if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
myWiresInd->length( 0 ); myWiresInd->length( 0 );
if ( IObjectCount() == 1 ) if ( IObjectCount() == 1 ) {
{
Handle(SALOME_InteractiveObject) anIO = firstIObject(); Handle(SALOME_InteractiveObject) anIO = firstIObject();
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) // face selection if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { // face selection
{
Standard_Boolean aRes; Standard_Boolean aRes;
myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( aRes && GEOMBase::IsShape( myObject ) ) if ( aRes && GEOMBase::IsShape( myObject ) ) {
{
myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
TopoDS_Shape aShape; TopoDS_Shape aShape;
if ( GEOMBase::GetShape( myObject, aShape, TopAbs_WIRE ) ) if ( GEOMBase::GetShape( myObject, aShape, TopAbs_WIRE ) )
mySelectWiresEdt->setText( myEditCurrentArgument->text() ); GroupPoints->LineEdit2->setText( myEditCurrentArgument->text() );
} }
else else
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
} }
else if ( myEditCurrentArgument == mySelectWiresEdt ) else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
{
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
myGeomGUI->getApp()->selectionMgr()->GetIndexes( anIO, aMap ); myGeomGUI->getApp()->selectionMgr()->GetIndexes( anIO, aMap );
const int n = aMap.Extent(); const int n = aMap.Extent();
@ -240,10 +226,9 @@ void RepairGUI_CloseContourDlg::SetEditCurrentArgument()
const QObject* send = sender(); const QObject* send = sender();
if ( send == GroupPoints->PushButton1 ) if ( send == GroupPoints->PushButton1 )
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
else if ( send == mySelectWiresBtn && !myObject->_is_nil() ) else if ( send == GroupPoints->PushButton2 && !myObject->_is_nil() )
myEditCurrentArgument = mySelectWiresEdt; myEditCurrentArgument = GroupPoints->LineEdit2;
if ( myEditCurrentArgument ) if ( myEditCurrentArgument ) {
{
initSelection(); initSelection();
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
SelectionIntoArgument(); SelectionIntoArgument();
@ -258,8 +243,7 @@ void RepairGUI_CloseContourDlg::SetEditCurrentArgument()
void RepairGUI_CloseContourDlg::LineEditReturnPressed() void RepairGUI_CloseContourDlg::LineEditReturnPressed()
{ {
const QObject* send = sender(); const QObject* send = sender();
if( send == GroupPoints->LineEdit1 || send == mySelectWiresEdt ) if ( send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2 ) {
{
myEditCurrentArgument = (QLineEdit*)send; myEditCurrentArgument = (QLineEdit*)send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -278,7 +262,7 @@ void RepairGUI_CloseContourDlg::ActivateThisDialog()
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
mySelectWiresEdt->setText(""); GroupPoints->LineEdit2->setText( "" );
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
myWiresInd->length( 0 ); myWiresInd->length( 0 );
@ -291,9 +275,9 @@ void RepairGUI_CloseContourDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it // purpose : Mouse enter onto the dialog to activate it
//================================================================================= //=================================================================================
void RepairGUI_CloseContourDlg::enterEvent(QEvent* e) void RepairGUI_CloseContourDlg::enterEvent( QEvent* )
{ {
if ( !GroupConstructors->isEnabled() ) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -321,7 +305,7 @@ GEOM::GEOM_IOperations_ptr RepairGUI_CloseContourDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool RepairGUI_CloseContourDlg::isValid( QString& msg ) bool RepairGUI_CloseContourDlg::isValid( QString& )
{ {
TopoDS_Shape aTmpShape; TopoDS_Shape aTmpShape;
return !myObject->_is_nil() && ( myWiresInd->length() || GEOMBase::GetShape( myObject, aTmpShape, TopAbs_WIRE ) ); return !myObject->_is_nil() && ( myWiresInd->length() || GEOMBase::GetShape( myObject, aTmpShape, TopAbs_WIRE ) );
@ -347,7 +331,7 @@ bool RepairGUI_CloseContourDlg::execute( ObjectList& objects )
//================================================================================= //=================================================================================
bool RepairGUI_CloseContourDlg::getIsByVertex() const bool RepairGUI_CloseContourDlg::getIsByVertex() const
{ {
return myIsVertexGr->find( 0 )->isOn(); return myIsVertexGr->button( 0 )->isChecked();
} }
//================================================================================= //=================================================================================
@ -356,8 +340,7 @@ bool RepairGUI_CloseContourDlg::getIsByVertex() const
//================================================================================= //=================================================================================
void RepairGUI_CloseContourDlg::initSelection() void RepairGUI_CloseContourDlg::initSelection()
{ {
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
{
TColStd_MapOfInteger aTypes; TColStd_MapOfInteger aTypes;
aTypes.Add( GEOM_COMPOUND ); aTypes.Add( GEOM_COMPOUND );
aTypes.Add( GEOM_SOLID ); aTypes.Add( GEOM_SOLID );
@ -367,8 +350,7 @@ void RepairGUI_CloseContourDlg::initSelection()
globalSelection( aTypes ); globalSelection( aTypes );
} }
else if ( myEditCurrentArgument == mySelectWiresEdt ) else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
{
localSelection( myObject, TopAbs_EDGE ); localSelection( myObject, TopAbs_EDGE );
localSelection( myObject, TopAbs_WIRE ); localSelection( myObject, TopAbs_WIRE );
} }

View File

@ -19,22 +19,17 @@
// //
// 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 : RepairGUI_CloseContourDlg.h // File : RepairGUI_CloseContourDlg.h
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_CloseContour_H #ifndef REPAIRGUI_CLOSECONTOURDLG_H
#define DIALOGBOX_CloseContour_H #define REPAIRGUI_CLOSECONTOURDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
#include "DlgRef_1Sel_Ext.h"
#include <TColStd_IndexedMapOfInteger.hxx> class DlgRef_2SelExt;
class QButtonGroup;
#include <qradiobutton.h>
#include <qbuttongroup.h>
//================================================================================= //=================================================================================
// class : RepairGUI_CloseContourDlg // class : RepairGUI_CloseContourDlg
@ -45,32 +40,29 @@ class RepairGUI_CloseContourDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
RepairGUI_CloseContourDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, RepairGUI_CloseContourDlg( GeometryGUI*, QWidget* = 0, bool = false );
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_CloseContourDlg(); ~RepairGUI_CloseContourDlg();
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* );
void closeEvent(QCloseEvent* e); void closeEvent( QCloseEvent* );
void initSelection(); void initSelection();
bool getIsByVertex() const; bool getIsByVertex() const;
private:
GEOM::GEOM_Object_var myObject; GEOM::GEOM_Object_var myObject;
GEOM::short_array_var myWiresInd; GEOM::short_array_var myWiresInd;
DlgRef_1Sel_Ext* GroupPoints; DlgRef_2SelExt* GroupPoints;
QButtonGroup* myIsVertexGr; QButtonGroup* myIsVertexGr;
QLabel* mySelectWiresLbl;
QPushButton* mySelectWiresBtn;
QLineEdit* mySelectWiresEdt;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
@ -83,4 +75,4 @@ private slots:
void SetEditCurrentArgument(); void SetEditCurrentArgument();
}; };
#endif // DIALOGBOX_CloseContour_H #endif // REPAIRGUI_CLOSECONTOURDLG_H

View File

@ -19,27 +19,25 @@
// //
// 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 : RepairGUI_DivideEdgeDlg.cxx // File : RepairGUI_DivideEdgeDlg.cxx
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "RepairGUI_DivideEdgeDlg.h" #include "RepairGUI_DivideEdgeDlg.h"
#include "SalomeApp_Application.h" #include <GEOM_DlgRef.h>
#include "LightApp_SelectionMgr.h" #include <GeometryGUI.h>
#include "SUIT_Session.h" #include <GEOMBase.h>
#include "SALOME_ListIteratorOfListIO.hxx"
#include "GEOMImpl_Types.hxx" #include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <GEOMImpl_Types.hxx>
#include <TopAbs.hxx> #include <TopAbs.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <qlabel.h>
using namespace std;
//================================================================================= //=================================================================================
// class : RepairGUI_DivideEdgeDlg() // class : RepairGUI_DivideEdgeDlg()
@ -49,45 +47,52 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
RepairGUI_DivideEdgeDlg::RepairGUI_DivideEdgeDlg( GeometryGUI* theGeometryGUI, QWidget* parent, RepairGUI_DivideEdgeDlg::RepairGUI_DivideEdgeDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl) bool modal )
: GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | : GEOMBase_Skeleton( theGeometryGUI, parent, modal )
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_DIVIDE_EDGE" ) ) ); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_DIVIDE_EDGE" ) ) );
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_DIVIDE_EDGE_TITLE")); setWindowTitle( tr( "GEOM_DIVIDE_EDGE_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_DIVIDE_EDGE_TITLE")); mainFrame()->GroupConstructors->setTitle(tr("GEOM_DIVIDE_EDGE_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();
GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints"); GroupPoints = new DlgRef_1SelExt( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_ADD_POINT" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_ADD_POINT" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_EDGE" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_EDGE" ) );
GroupPoints->PushButton1->setPixmap(image1); GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly( true );
myIsParameterGr = new QButtonGroup( 2, Qt::Vertical, GroupPoints ); QRadioButton* rb1 = new QRadioButton( tr( "GEOM_BY_PARAMETER" ), GroupPoints->Box );
myIsParameterGr->setFrameStyle( QFrame::NoFrame ); QRadioButton* rb2 = new QRadioButton( tr( "GEOM_BY_LENGTH" ), GroupPoints->Box );
myIsParameterGr->setRadioButtonExclusive( true );
myIsParameterGr->insert( new QRadioButton( tr( "GEOM_BY_PARAMETER" ), myIsParameterGr ), 0 );
myIsParameterGr->insert( new QRadioButton( tr( "GEOM_BY_LENGTH" ), myIsParameterGr ), 1 );
myIsParameterGr->find( 0 )->toggle();
QGridLayout* aLay = new QGridLayout( 0, 1, 2, 0, 6, "aLay" ); myIsParameterGr = new QButtonGroup( GroupPoints->Box );
myValEdt = new QtxDblSpinBox(0., 1., 0.1, GroupPoints->GroupBox1); myIsParameterGr->addButton( rb1, 0 );
myValEdt->setPrecision( 3 ); myIsParameterGr->addButton( rb2, 1 );
rb1->setChecked( true );
myValEdt = new QDoubleSpinBox( GroupPoints->Box );
initSpinBox( myValEdt, 0., 1., 0.1, 3 );
myValEdt->setValue( 0.5 ); myValEdt->setValue( 0.5 );
QLabel* aLbl1 = new QLabel( tr( "GEOM_VALUE" ), GroupPoints->GroupBox1 ); QLabel* aLbl1 = new QLabel( tr( "GEOM_VALUE" ), GroupPoints->Box );
aLay->addWidget( aLbl1, 0, 0 );
aLay->addWidget( myValEdt, 0, 1 ); QGridLayout* l = new QGridLayout( GroupPoints->Box );
l->setMargin( 0 ); l->setSpacing( 6 );
l->addWidget( rb1, 0, 0, 1, 2 );
l->addWidget( rb2, 1, 0, 1, 2 );
l->addWidget( aLbl1, 2, 0 );
l->addWidget( myValEdt, 2, 1 );
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
Layout1->addWidget(GroupPoints, 2, 0);
GroupPoints->getGroupBoxLayout()->addMultiCellWidget(myIsParameterGr, 1, 1, 0, 2);
GroupPoints->getGroupBoxLayout()->addLayout( aLay, 2, 0 );
/***************************************************************/ /***************************************************************/
setHelpFileName( "add_point_on_edge.htm" ); setHelpFileName( "add_point_on_edge.htm" );
@ -119,8 +124,8 @@ void RepairGUI_DivideEdgeDlg::Init()
initSelection(); initSelection();
/* 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->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
@ -176,19 +181,16 @@ void RepairGUI_DivideEdgeDlg::SelectionIntoArgument()
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
myIndex = -1; myIndex = -1;
if ( IObjectCount() == 1 ) if ( IObjectCount() == 1 ) {
{
Handle(SALOME_InteractiveObject) anIO = firstIObject(); Handle(SALOME_InteractiveObject) anIO = firstIObject();
Standard_Boolean aRes; Standard_Boolean aRes;
GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( !CORBA::is_nil( aSelectedObj ) && aRes ) if ( !CORBA::is_nil( aSelectedObj ) && aRes ) {
{
TopoDS_Shape aShape; TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) {
{
const int aType = aShape.ShapeType(); const int aType = aShape.ShapeType();
if ( aType <= TopAbs_EDGE ) // edge, wire, face, shell, solid, compound if ( aType <= TopAbs_EDGE ) {
{ // edge, wire, face, shell, solid, compound
GEOM::short_array anIndexes; GEOM::short_array anIndexes;
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
@ -196,20 +198,20 @@ void RepairGUI_DivideEdgeDlg::SelectionIntoArgument()
(SalomeApp_Application*)(SUIT_Session::session()->activeApplication()); (SalomeApp_Application*)(SUIT_Session::session()->activeApplication());
anApp->selectionMgr()->GetIndexes( anIO, aMap ); anApp->selectionMgr()->GetIndexes( anIO, aMap );
if ( !aMap.IsEmpty() ) // subshape selection if ( !aMap.IsEmpty() ) {
{ // subshape selection
myIndex = aMap( 1 ); myIndex = aMap( 1 );
myObject = aSelectedObj; myObject = aSelectedObj;
myEditCurrentArgument->setText( tr( "GEOM_EDGE" ) + "_1" ); myEditCurrentArgument->setText( tr( "GEOM_EDGE" ) + "_1" );
} }
else if ( aType == TopAbs_EDGE ) // single shape selection else if ( aType == TopAbs_EDGE ) {
{ // single shape selection
myIndex = -1; myIndex = -1;
myObject = aSelectedObj; myObject = aSelectedObj;
myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
} }
else // face, shell, solid or compound was selected, and NOT its subshape. else {
{ // face, shell, solid or compound was selected, and NOT its subshape.
myIndex = -1; myIndex = -1;
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
} }
@ -225,8 +227,7 @@ void RepairGUI_DivideEdgeDlg::SelectionIntoArgument()
//================================================================================= //=================================================================================
void RepairGUI_DivideEdgeDlg::SetEditCurrentArgument() void RepairGUI_DivideEdgeDlg::SetEditCurrentArgument()
{ {
if( sender() == GroupPoints->PushButton1 ) if ( sender() == GroupPoints->PushButton1 ) {
{
GroupPoints->LineEdit1->setFocus(); GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
} }
@ -240,8 +241,7 @@ void RepairGUI_DivideEdgeDlg::SetEditCurrentArgument()
//================================================================================= //=================================================================================
void RepairGUI_DivideEdgeDlg::LineEditReturnPressed() void RepairGUI_DivideEdgeDlg::LineEditReturnPressed()
{ {
if( sender() == GroupPoints->LineEdit1 ) if ( sender() == GroupPoints->LineEdit1 ) {
{
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -269,9 +269,9 @@ void RepairGUI_DivideEdgeDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it // purpose : Mouse enter onto the dialog to activate it
//================================================================================= //=================================================================================
void RepairGUI_DivideEdgeDlg::enterEvent(QEvent* e) void RepairGUI_DivideEdgeDlg::enterEvent( QEvent* )
{ {
if ( !GroupConstructors->isEnabled() ) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -299,7 +299,7 @@ GEOM::GEOM_IOperations_ptr RepairGUI_DivideEdgeDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool RepairGUI_DivideEdgeDlg::isValid( QString& msg ) bool RepairGUI_DivideEdgeDlg::isValid( QString& )
{ {
return !myObject->_is_nil(); return !myObject->_is_nil();
} }
@ -325,7 +325,7 @@ bool RepairGUI_DivideEdgeDlg::execute( ObjectList& objects )
//================================================================================= //=================================================================================
bool RepairGUI_DivideEdgeDlg::getIsByParameter() const bool RepairGUI_DivideEdgeDlg::getIsByParameter() const
{ {
return myIsParameterGr->find( 0 )->isOn(); return myIsParameterGr->button( 0 )->isChecked();
} }
//================================================================================= //=================================================================================

View File

@ -19,23 +19,18 @@
// //
// 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 : RepairGUI_DivideEdgeDlg.h // File : RepairGUI_DivideEdgeDlg.h
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_DivideEdge_H #ifndef REPAIRGUI_DIVIDEEDGEDLG_H
#define DIALOGBOX_DivideEdge_H #define REPAIRGUI_DIVIDEEDGEDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
#include "DlgRef_1Sel_Ext.h"
#include "QtxDblSpinBox.h"
#include <TColStd_IndexedMapOfInteger.hxx> class DlgRef_1SelExt;
class QDoubleSpinBox;
#include <qradiobutton.h> class QButtonGroup;
#include <qbuttongroup.h>
//================================================================================= //=================================================================================
// class : RepairGUI_DivideEdgeDlg // class : RepairGUI_DivideEdgeDlg
@ -46,30 +41,30 @@ class RepairGUI_DivideEdgeDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
RepairGUI_DivideEdgeDlg (GeometryGUI* theGeometryGUI, QWidget* parent = 0, RepairGUI_DivideEdgeDlg( GeometryGUI*, QWidget* = 0, bool = false );
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_DivideEdgeDlg(); ~RepairGUI_DivideEdgeDlg();
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* );
void closeEvent(QCloseEvent* e); void closeEvent( QCloseEvent* );
void initSelection(); void initSelection();
bool getIsByParameter() const; bool getIsByParameter() const;
private:
GEOM::GEOM_Object_var myObject; GEOM::GEOM_Object_var myObject;
int myIndex; int myIndex;
DlgRef_1Sel_Ext* GroupPoints; DlgRef_1SelExt* GroupPoints;
QButtonGroup* myIsParameterGr; QButtonGroup* myIsParameterGr;
QtxDblSpinBox* myValEdt; QDoubleSpinBox* myValEdt;
protected slots: protected slots:
void ClickOnOk(); void ClickOnOk();
@ -82,4 +77,4 @@ protected slots:
void SetEditCurrentArgument(); void SetEditCurrentArgument();
}; };
#endif // DIALOGBOX_DivideEdge_H #endif // REPAIRGUI_DIVIDEEDGEDLG_H

View File

@ -19,35 +19,38 @@
// //
// 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 : RepairGUI_FreeBoundDlg.cxx // File : RepairGUI_FreeBoundDlg.cxx
// Author : Sergey LITONIN // Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com)
// Module : GEOM //
// $Header$
#include "RepairGUI_FreeBoundDlg.h" #include "RepairGUI_FreeBoundDlg.h"
#include "GEOMBase.h"
#include "GeometryGUI.h"
#include "GEOM_Displayer.h"
#include "GEOMImpl_Types.hxx"
#include "SalomeApp_Application.h" #include <GEOMBase.h>
#include "LightApp_Application.h" #include <GeometryGUI.h>
#include "LightApp_SelectionMgr.h" #include <GEOM_Displayer.h>
#include "SUIT_MessageBox.h" #include <GEOMImpl_Types.hxx>
#include "SUIT_Session.h"
#include <SalomeApp_Application.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_MessageBox.h>
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#include <qlineedit.h> #include <QLineEdit>
#include <qlabel.h> #include <QLabel>
#include <qlayout.h> #include <QHBoxLayout>
#include <qgroupbox.h> #include <QVBoxLayout>
#include <qpushbutton.h> #include <QGridLayout>
#include <QGroupBox>
#include <QPushButton>
#include <QKeyEvent>
#define SPACING 5 #define SPACING 6
#define MARGIN 10 #define MARGIN 9
/*! /*!
Class : RepairGUI_FreeBoundDlg Class : RepairGUI_FreeBoundDlg
@ -58,37 +61,47 @@
// function : RepairGUI_FreeBoundDlg // function : RepairGUI_FreeBoundDlg
// purpose : Constructor // purpose : Constructor
//================================================================================= //=================================================================================
RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg(GeometryGUI* theGUI, QWidget* theParent, const char*) RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg( GeometryGUI* theGUI, QWidget* theParent )
: QDialog( theParent, "RepairGUI_FreeBoundDlg", false, : QDialog( theParent, false ),
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( theParent ) ), GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( theParent ) ),
myGeomGUI( theGUI ) myGeomGUI( theGUI )
{ {
setCaption( tr( "CAPTION" ) ); setAttribute( Qt::WA_DeleteOnClose );
setWindowTitle( tr( "CAPTION" ) );
QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, tr( "FREE_BOUND" ), this ); QGroupBox* aMainGrp = new QGroupBox( tr( "FREE_BOUND" ), this );
QGroupBox* aSelGrp = new QGroupBox( 1, Qt::Vertical, aMainGrp ); QLabel* lab = new QLabel( tr( "GEOM_OBJECT" ), aMainGrp );
aSelGrp->setInsideMargin( 0 ); QPushButton* btn = new QPushButton( aMainGrp );
aSelGrp->setFrameStyle( QFrame::NoFrame ); btn->setIcon( iconSelect );
new QLabel( tr( "GEOM_OBJECT" ), aSelGrp ); myEdit = new QLineEdit( aMainGrp );
( new QPushButton( aSelGrp ) )->setPixmap( iconSelect );
myEdit = new QLineEdit( aSelGrp );
myEdit->setReadOnly( true ); myEdit->setReadOnly( true );
myEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myClosedLbl = new QLabel( tr( "NUMBER_CLOSED" ), aMainGrp ); myClosedLbl = new QLabel( tr( "NUMBER_CLOSED" ), aMainGrp );
myOpenLbl = new QLabel( tr( "NUMBER_OPEN" ), aMainGrp ); myOpenLbl = new QLabel( tr( "NUMBER_OPEN" ), aMainGrp );
myClosedLbl->setMinimumWidth( 150 );
myOpenLbl->setMinimumWidth( 150 );
QGridLayout* aMainGrpLayout = new QGridLayout( aMainGrp );
aMainGrpLayout->setMargin( MARGIN ); aMainGrpLayout->setSpacing( SPACING );
aMainGrpLayout->addWidget( lab, 0, 0 );
aMainGrpLayout->addWidget( btn, 0, 1 );
aMainGrpLayout->addWidget( myEdit, 0, 2 );
aMainGrpLayout->addWidget( myClosedLbl, 1, 0, 1, 3 );
aMainGrpLayout->addWidget( myOpenLbl, 2, 0, 1, 3 );
QFrame* aFrame = new QFrame( this ); QFrame* aFrame = new QFrame( this );
aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken ); aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
QPushButton* aCloseBtn = new QPushButton( tr( "GEOM_BUT_CLOSE" ), aFrame ); QPushButton* aCloseBtn = new QPushButton( tr( "GEOM_BUT_CLOSE" ), aFrame );
QPushButton* aHelpBtn = new QPushButton( tr( "GEOM_BUT_HELP" ), aFrame ); QPushButton* aHelpBtn = new QPushButton( tr( "GEOM_BUT_HELP" ), aFrame );
QHBoxLayout* aBtnLay = new QHBoxLayout( aFrame, MARGIN, SPACING ); QHBoxLayout* aBtnLay = new QHBoxLayout( aFrame );
aBtnLay->setMargin( MARGIN ); aBtnLay->setSpacing( SPACING );
aBtnLay->addWidget( aCloseBtn ); aBtnLay->addWidget( aCloseBtn );
aBtnLay->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) ); aBtnLay->addSpacing( SPACING ); aBtnLay->addStretch();
aBtnLay->addWidget( aHelpBtn ); aBtnLay->addWidget( aHelpBtn );
QVBoxLayout* aLay = new QVBoxLayout( this ); QVBoxLayout* aLay = new QVBoxLayout( this );
@ -142,10 +155,11 @@ void RepairGUI_FreeBoundDlg::onHelp()
#else #else
platform = "application"; platform = "application";
#endif #endif
SUIT_MessageBox::warn1 SUIT_MessageBox::warning( this,
(0, tr("WRN_WARNING"), tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). tr( "WRN_WARNING" ),
arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
tr("BUT_OK")); arg( app->resourceMgr()->stringValue( "ExternalBrowser",
platform ) ).arg( myHelpFileName ) );
} }
} }
@ -191,8 +205,7 @@ void RepairGUI_FreeBoundDlg::onSelectionDone()
if ( !isOk || anObj->_is_nil() || !GEOMBase::IsShape( anObj ) ) if ( !isOk || anObj->_is_nil() || !GEOMBase::IsShape( anObj ) )
return; return;
else else {
{
myObj = anObj; myObj = anObj;
displayPreview( false, true, true, 3 ); displayPreview( false, true, true, 3 );
} }
@ -219,7 +232,7 @@ void RepairGUI_FreeBoundDlg::Init()
// function : enterEvent // function : enterEvent
// purpose : Activate dialog // purpose : Activate dialog
//================================================================================= //=================================================================================
void RepairGUI_FreeBoundDlg::enterEvent( QEvent* e ) void RepairGUI_FreeBoundDlg::enterEvent( QEvent* )
{ {
onActivate(); onActivate();
} }
@ -228,7 +241,7 @@ void RepairGUI_FreeBoundDlg::enterEvent( QEvent* e )
// function : closeEvent // function : closeEvent
// purpose : Close dialog // purpose : Close dialog
//================================================================================= //=================================================================================
void RepairGUI_FreeBoundDlg::closeEvent( QCloseEvent* e ) void RepairGUI_FreeBoundDlg::closeEvent( QCloseEvent* )
{ {
onClose(); onClose();
} }
@ -260,7 +273,7 @@ GEOM::GEOM_IOperations_ptr RepairGUI_FreeBoundDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool RepairGUI_FreeBoundDlg::isValid( QString& msg ) bool RepairGUI_FreeBoundDlg::isValid( QString& )
{ {
return !myObj->_is_nil(); return !myObj->_is_nil();
} }
@ -279,8 +292,7 @@ bool RepairGUI_FreeBoundDlg::execute( ObjectList& objects )
bool result = GEOM::GEOM_IHealingOperations::_narrow( bool result = GEOM::GEOM_IHealingOperations::_narrow(
getOperation() )->GetFreeBoundary( myObj, aClosed, anOpen ); getOperation() )->GetFreeBoundary( myObj, aClosed, anOpen );
if ( result ) if ( result ) {
{
myNbClosed = aClosed->length(); myNbClosed = aClosed->length();
myNbOpen = anOpen->length(); myNbOpen = anOpen->length();
int i; int i;
@ -295,8 +307,7 @@ bool RepairGUI_FreeBoundDlg::execute( ObjectList& objects )
aLabelText = tr( "NUMBER_OPEN" ) + QString( "%1" ).arg( myNbOpen ); aLabelText = tr( "NUMBER_OPEN" ) + QString( "%1" ).arg( myNbOpen );
myOpenLbl->setText( aLabelText ); myOpenLbl->setText( aLabelText );
} }
else else {
{
myEdit->setText( GEOMBase::GetName( myObj ) ); myEdit->setText( GEOMBase::GetName( myObj ) );
myClosedLbl->setText( tr( "NUMBER_CLOSED" ) ); myClosedLbl->setText( tr( "NUMBER_CLOSED" ) );
myOpenLbl->setText( tr( "NUMBER_OPEN" ) ); myOpenLbl->setText( tr( "NUMBER_OPEN" ) );
@ -315,8 +326,7 @@ void RepairGUI_FreeBoundDlg::keyPressEvent( QKeyEvent* e )
if ( e->isAccepted() ) if ( e->isAccepted() )
return; return;
if ( e->key() == Key_F1 ) if ( e->key() == Qt::Key_F1 ) {
{
e->accept(); e->accept();
onHelp(); onHelp();
} }

View File

@ -19,21 +19,18 @@
// //
// 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 : RepairGUI_FreeBoundDlg.h // File : RepairGUI_FreeBoundDlg.h
// Author : Sergey LITONIN // Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com)
// Module : GEOM //
#ifndef DIALOGBOX_WHATIS_H #ifndef REPAIRGUI_FREEBOUNDDLG_H
#define DIALOGBOX_WHATIS_H #define REPAIRGUI_FREEBOUNDDLG_H
#include <qdialog.h> #include <QDialog>
#include "GEOMBase_Helper.h" #include <GEOMBase_Helper.h>
class QLineEdit; class QLineEdit;
class QLabel; class QLabel;
class GEOM_Displayer;
class GeometryGUI; class GeometryGUI;
//================================================================================= //=================================================================================
@ -46,7 +43,7 @@ class RepairGUI_FreeBoundDlg : public QDialog,
Q_OBJECT Q_OBJECT
public: public:
RepairGUI_FreeBoundDlg(GeometryGUI*, QWidget*, const char* name = 0); RepairGUI_FreeBoundDlg( GeometryGUI*, QWidget* );
~RepairGUI_FreeBoundDlg(); ~RepairGUI_FreeBoundDlg();
private slots: private slots:
@ -58,13 +55,13 @@ private slots:
private: private:
void Init(); void Init();
void enterEvent( QEvent* e ); void enterEvent( QEvent* );
void closeEvent( QCloseEvent* e ); void closeEvent( QCloseEvent* );
void keyPressEvent( QKeyEvent* e ); void keyPressEvent( QKeyEvent* );
void activateSelection(); void activateSelection();
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual bool isValid( QString& ); virtual bool isValid( QString& );
private: private:
@ -78,4 +75,4 @@ private:
QString myHelpFileName; QString myHelpFileName;
}; };
#endif // DIALOGBOX_WHATIS_H #endif // REPAIRGUI_FREEBOUNDDLG_H

View File

@ -19,46 +19,45 @@
// //
// 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 : RepairGUI_FreeFacesDlg.cxx // File : RepairGUI_FreeFacesDlg.cxx
// Author : VKN // Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com)
// Module : GEOM //
// $Header$
#include "RepairGUI_FreeFacesDlg.h" #include "RepairGUI_FreeFacesDlg.h"
#include "LightApp_Application.h" #include <LightApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "SalomeApp_Tools.h" #include <SalomeApp_Tools.h>
#include "SUIT_MessageBox.h" #include <SUIT_MessageBox.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SUIT_OverrideCursor.h" #include <SUIT_OverrideCursor.h>
#include <SUIT_Desktop.h>
#include <SUIT_ResourceMgr.h>
#include "SALOME_ListIteratorOfListIO.hxx" #include <GEOMImpl_Types.hxx>
#include "GEOMImpl_Types.hxx"
#include <TopTools_IndexedMapOfShape.hxx> #include <TopTools_IndexedMapOfShape.hxx>
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#include <TopExp.hxx> #include <TopExp.hxx>
#include "GEOMBase.h"
#include "GeometryGUI.h"
#include "GEOM_Displayer.h"
#include <qapplication.h> #include <GEOMBase.h>
#include <qlineedit.h> #include <GeometryGUI.h>
#include <qlabel.h> #include <GEOM_Displayer.h>
#include <qlayout.h>
#include <qgroupbox.h> #include <QLineEdit>
#include <qpushbutton.h> #include <QLabel>
#define SPACING 5 #include <QGroupBox>
#define MARGIN 10 #include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QKeyEvent>
#define SPACING 6
#define MARGIN 9
#define MIN_WIDTH 200 #define MIN_WIDTH 200
using namespace std;
//================================================================================= //=================================================================================
// class : RepairGUI_FreeFacesDlg() // class : RepairGUI_FreeFacesDlg()
// purpose : Constructs a RepairGUI_FreeFacesDlg which is a child of 'parent', with the // purpose : Constructs a RepairGUI_FreeFacesDlg which is a child of 'parent', with the
@ -67,50 +66,57 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
RepairGUI_FreeFacesDlg::RepairGUI_FreeFacesDlg( GeometryGUI* GUI, QWidget* parent, RepairGUI_FreeFacesDlg::RepairGUI_FreeFacesDlg( GeometryGUI* GUI, QWidget* parent,
const char* name, bool modal, WFlags fl) bool modal )
:QDialog(parent, "RepairGUI_FreeBoundDlg", false, : QDialog( parent, false ),
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) ), GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) ),
myGeomGUI(GUI) myGeomGUI( GUI ),
myDisplayer( 0 )
{ {
myDisplayer = 0; setAttribute( Qt::WA_DeleteOnClose );
setSizeGripEnabled( true );
setSizeGripEnabled( TRUE );
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_FREE_FACES_TITLE")); setWindowTitle( tr( "GEOM_FREE_FACES_TITLE" ) );
/***************************************************************/ /***************************************************************/
QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_SELECTED_SHAPE" ), this ); QGroupBox* aMainGrp = new QGroupBox( tr( "GEOM_SELECTED_SHAPE" ), this );
QLabel* lab = new QLabel( tr( "GEOM_OBJECT" ), aMainGrp );
QGroupBox* aSelGrp = new QGroupBox( 1, Qt::Vertical, aMainGrp ); mySelBtn = new QPushButton( aMainGrp );
mySelBtn->setIcon( image1 );
aSelGrp->setInsideMargin( 0 ); myEdit = new QLineEdit( aMainGrp );
aSelGrp->setFrameStyle( QFrame::NoFrame );
new QLabel( tr( "GEOM_OBJECT" ), aSelGrp );
mySelBtn = new QPushButton( aSelGrp );
mySelBtn->setPixmap( image1 );
myEdit = new QLineEdit( aSelGrp );
myEdit->setReadOnly( true ); myEdit->setReadOnly( true );
myEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myEdit->setMinimumWidth( MIN_WIDTH ); myEdit->setMinimumWidth( MIN_WIDTH );
QHBoxLayout* aMainLay = new QHBoxLayout( aMainGrp );
aMainLay->setSpacing( SPACING );
aMainLay->setMargin( MARGIN );
aMainLay->addWidget( lab );
aMainLay->addWidget( mySelBtn );
aMainLay->addWidget( myEdit );
QFrame* aFrame = new QFrame( this ); QFrame* aFrame = new QFrame( this );
aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken ); aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
QPushButton* aCloseBtn = new QPushButton( tr( "GEOM_BUT_CLOSE" ), aFrame ); QPushButton* aCloseBtn = new QPushButton( tr( "GEOM_BUT_CLOSE" ), aFrame );
QPushButton* aHelpBtn = new QPushButton( tr( "GEOM_BUT_HELP" ), aFrame ); QPushButton* aHelpBtn = new QPushButton( tr( "GEOM_BUT_HELP" ), aFrame );
QHBoxLayout* aBtnLay = new QHBoxLayout( aFrame, MARGIN, SPACING );
QHBoxLayout* aBtnLay = new QHBoxLayout( aFrame );
aBtnLay->setSpacing( SPACING );
aBtnLay->setMargin( MARGIN );
aBtnLay->addWidget( aCloseBtn ); aBtnLay->addWidget( aCloseBtn );
aBtnLay->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) ); aBtnLay->addSpacing( SPACING );
aBtnLay->addStretch();
aBtnLay->addWidget( aHelpBtn ); aBtnLay->addWidget( aHelpBtn );
QVBoxLayout* aLay = new QVBoxLayout( this ); QVBoxLayout* aLay = new QVBoxLayout( this );
aLay->setSpacing( SPACING ); aLay->setSpacing( SPACING );
aLay->setMargin( MARGIN ); aLay->setMargin( MARGIN );
aLay->addWidget( aMainGrp ); aLay->addWidget( aMainGrp );
aLay->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) ); aLay->addStretch();
aLay->addWidget( aFrame ); aLay->addWidget( aFrame );
myHelpFileName = "check_free_faces.htm"; myHelpFileName = "check_free_faces.htm";
@ -163,10 +169,12 @@ void RepairGUI_FreeFacesDlg::onHelp()
#else #else
platform = "application"; platform = "application";
#endif #endif
SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), SUIT_MessageBox::warning( this,
QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). tr( "WRN_WARNING" ),
arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
QObject::tr("BUT_OK")); arg( app->resourceMgr()->stringValue( "ExternalBrowser",
platform ) ).
arg( myHelpFileName ) );
} }
} }
@ -220,8 +228,7 @@ void RepairGUI_FreeFacesDlg::Init()
void RepairGUI_FreeFacesDlg::onSelectionDone() void RepairGUI_FreeFacesDlg::onSelectionDone()
{ {
erasePreview(); erasePreview();
if( IObjectCount() != 1 ) if ( IObjectCount() != 1 ) {
{
myEdit->setText( "" ); myEdit->setText( "" );
return; return;
} }
@ -230,13 +237,11 @@ void RepairGUI_FreeFacesDlg::onSelectionDone()
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject( firstIObject(), isOk ); GEOMBase::ConvertIOinGEOMObject( firstIObject(), isOk );
if ( !isOk || anObj->_is_nil() || !GEOMBase::IsShape( anObj ) ) if ( !isOk || anObj->_is_nil() || !GEOMBase::IsShape( anObj ) ) {
{
myEdit->setText( "" ); myEdit->setText( "" );
return; return;
} }
else else {
{
myObj = anObj; myObj = anObj;
displayPreview( false, true, true, 3 ); displayPreview( false, true, true, 3 );
} }
@ -246,7 +251,7 @@ void RepairGUI_FreeFacesDlg::onSelectionDone()
// function : enterEvent() // function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it // purpose : Mouse enter onto the dialog to activate it
//================================================================================= //=================================================================================
void RepairGUI_FreeFacesDlg::enterEvent(QEvent* e) void RepairGUI_FreeFacesDlg::enterEvent( QEvent* )
{ {
onActivate(); onActivate();
} }
@ -267,7 +272,7 @@ void RepairGUI_FreeFacesDlg::activateSelection()
// function : closeEvent() // function : closeEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void RepairGUI_FreeFacesDlg::closeEvent(QCloseEvent* e) void RepairGUI_FreeFacesDlg::closeEvent( QCloseEvent* )
{ {
onClose(); onClose();
} }
@ -285,7 +290,7 @@ GEOM::GEOM_IOperations_ptr RepairGUI_FreeFacesDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool RepairGUI_FreeFacesDlg::isValid( QString& msg ) bool RepairGUI_FreeFacesDlg::isValid( QString& )
{ {
return !myObj->_is_nil() ; return !myObj->_is_nil() ;
} }
@ -302,12 +307,10 @@ bool RepairGUI_FreeFacesDlg::execute( ObjectList& objects )
TopoDS_Shape aSelShape; TopoDS_Shape aSelShape;
TopoDS_Shape aFace; TopoDS_Shape aFace;
TopTools_IndexedMapOfShape anIndices; TopTools_IndexedMapOfShape anIndices;
if ( !myObj->_is_nil() && GEOMBase::GetShape( myObj, aSelShape ) ) if ( !myObj->_is_nil() && GEOMBase::GetShape( myObj, aSelShape ) ) {
{
myEdit->setText( GEOMBase::GetName( myObj ) ); myEdit->setText( GEOMBase::GetName( myObj ) );
QString aMess; QString aMess;
if ( !isValid( aMess ) ) if ( !isValid( aMess ) ) {
{
erasePreview( true ); erasePreview( true );
return false; return false;
} }
@ -317,11 +320,9 @@ bool RepairGUI_FreeFacesDlg::execute( ObjectList& objects )
TopExp::MapShapes( aSelShape, anIndices); TopExp::MapShapes( aSelShape, anIndices);
SALOME_Prs* aPrs = 0; SALOME_Prs* aPrs = 0;
for ( int i = 0, n = aFaceLst->length(); i < n; i++ ) for ( int i = 0, n = aFaceLst->length(); i < n; i++ ) {
{
aFace = anIndices.FindKey( aFaceLst[i] ); aFace = anIndices.FindKey( aFaceLst[i] );
try try {
{
getDisplayer()->SetColor( Quantity_NOC_RED ); getDisplayer()->SetColor( Quantity_NOC_RED );
getDisplayer()->SetToActivate( false ); getDisplayer()->SetToActivate( false );
aPrs = !aFace.IsNull() ? getDisplayer()->BuildPrs( aFace ) : 0; aPrs = !aFace.IsNull() ? getDisplayer()->BuildPrs( aFace ) : 0;
@ -368,8 +369,7 @@ void RepairGUI_FreeFacesDlg::keyPressEvent( QKeyEvent* e )
if ( e->isAccepted() ) if ( e->isAccepted() )
return; return;
if ( e->key() == Key_F1 ) if ( e->key() == Qt::Key_F1 ) {
{
e->accept(); e->accept();
onHelp(); onHelp();
} }

View File

@ -19,17 +19,15 @@
// //
// 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 : RepairGUI_FreeFacesDlg.h // File : RepairGUI_FreeFacesDlg.h
// Author : VKN // Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com)
// Module : GEOM //
#ifndef DIALOGBOX_FreeFaces_H #ifndef REPAIRGUI_FREEFACESDLG_H
#define DIALOGBOX_FreeFaces_H #define REPAIRGUI_FREEFACESDLG_H
#include <qdialog.h> #include <QDialog>
#include "GEOMBase_Helper.h" #include <GEOMBase_Helper.h>
class GEOM_Displayer; class GEOM_Displayer;
class QPushButton; class QPushButton;
@ -46,21 +44,20 @@ class RepairGUI_FreeFacesDlg : public QDialog,
Q_OBJECT Q_OBJECT
public: public:
RepairGUI_FreeFacesDlg(GeometryGUI* GUI, QWidget* parent = 0, RepairGUI_FreeFacesDlg( GeometryGUI*, QWidget* = 0, bool = false );
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_FreeFacesDlg(); ~RepairGUI_FreeFacesDlg();
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* );
void closeEvent(QCloseEvent* e); void closeEvent( QCloseEvent* );
void keyPressEvent(QKeyEvent* e); void keyPressEvent( QKeyEvent* );
void activateSelection(); void activateSelection();
GEOM_Displayer* getDisplayer(); GEOM_Displayer* getDisplayer();
@ -81,4 +78,4 @@ private:
QString myHelpFileName; QString myHelpFileName;
}; };
#endif // DIALOGBOX_FreeFaces_H #endif // REPAIRGUI_FREEFACESDLG_H

View File

@ -19,41 +19,34 @@
// //
// 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 : RepairGUI_GlueDlg.cxx // File : RepairGUI_GlueDlg.cxx
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "OCCViewer_ViewModel.h"
#include "RepairGUI_GlueDlg.h" #include "RepairGUI_GlueDlg.h"
#include "DlgRef_1Sel_Ext.h"
#include "GEOMImpl_Types.hxx"
#include "QtxDblSpinBox.h" #include <GEOM_DlgRef.h>
#include "SalomeApp_Application.h" #include <GeometryGUI.h>
#include "LightApp_SelectionMgr.h" #include <GEOMBase.h>
#include "SalomeApp_Study.h"
#include "SalomeApp_Tools.h"
#include "SUIT_Session.h" #include <SalomeApp_Application.h>
#include "SUIT_MessageBox.h" #include <LightApp_SelectionMgr.h>
#include "SUIT_OverrideCursor.h" #include <SalomeApp_Study.h>
#include <SalomeApp_Tools.h>
#include <SUIT_Session.h>
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_ViewWindow.h>
#include <SUIT_ViewManager.h>
#include <OCCViewer_ViewModel.h>
#include <SALOME_ListIteratorOfListIO.hxx>
#include "SALOME_ListIteratorOfListIO.hxx" #include <GEOMImpl_Types.hxx>
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
#include <qapplication.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qhbox.h>
#include <qgrid.h>
using namespace std;
#define DEFAULT_TOLERANCE_VALUE 1e-07 #define DEFAULT_TOLERANCE_VALUE 1e-07
//================================================================================= //=================================================================================
@ -64,66 +57,67 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
RepairGUI_GlueDlg::RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* parent, RepairGUI_GlueDlg::RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl) bool modal )
: GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | : GEOMBase_Skeleton( theGeometryGUI, parent, modal ),
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
myCurrConstrId( -1 ) myCurrConstrId( -1 )
{ {
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_GLUE_FACES" ) ) ); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_GLUE_FACES" ) ) );
QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_GLUE_FACES2" ) )); QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_GLUE_FACES2" ) ));
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_GLUE_TITLE")); setWindowTitle( tr( "GEOM_GLUE_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_GLUE_TITLE")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_GLUE_TITLE" ) );
RadioButton1->setPixmap(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setPixmap(image2); mainFrame()->RadioButton2->setIcon( image2 );
//RadioButton2->close(TRUE); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close(TRUE); mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints"); GroupPoints = new DlgRef_1SelExt( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_GLUE" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_GLUE" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
GroupPoints->PushButton1->setPixmap(image1); GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly( true );
int aWidth = GroupPoints->TextLabel1->sizeHint().width() + QLabel* aTolLab = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box );
GroupPoints->PushButton1->sizeHint().width() + myTolEdt = new QDoubleSpinBox( GroupPoints->Box );
GroupPoints->getGroupBoxLayout()->spacing(); initSpinBox( myTolEdt, 0, 100, 1e-7, 10 );
Layout1->addWidget(GroupPoints, 2, 0);
QHBox* aHBox = new QHBox( GroupPoints->GroupBox1 );
aHBox->setSpacing( 5 );
(new QLabel( tr( "GEOM_TOLERANCE" ), aHBox ))->setFixedWidth( aWidth );
myTolEdt = new QtxDblSpinBox( 0, 100, 1e-7, aHBox );
myTolEdt->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myTolEdt->setPrecision( 10 );
myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE ); myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE );
GroupPoints->getGroupBoxLayout()->addWidget( aHBox, 3, 0 );
QGridLayout* boxLayout = new QGridLayout( GroupPoints->Box );
boxLayout->setMargin( 0 ); boxLayout->setSpacing( 6 );
boxLayout->addWidget( aTolLab, 0, 0 );
boxLayout->addWidget( myTolEdt, 0, 2 );
/***************************************************************/ /***************************************************************/
GroupPoints2 = new DlgRef_1Sel_Ext(this, "GroupPoints2"); GroupPoints2 = new DlgRef_1SelExt( centralWidget() );
GroupPoints2->GroupBox1->setTitle( tr( "GEOM_GLUE" ) ); GroupPoints2->GroupBox1->setTitle( tr( "GEOM_GLUE" ) );
GroupPoints2->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) ); GroupPoints2->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
GroupPoints2->PushButton1->setPixmap(image1); GroupPoints2->PushButton1->setIcon( image1 );
GroupPoints2->LineEdit1->setReadOnly( true ); GroupPoints2->LineEdit1->setReadOnly( true );
Layout1->addWidget(GroupPoints2, 2, 0);
QGrid* aGrid = new QGrid( 2, Qt::Horizontal, GroupPoints2->GroupBox1 ); QLabel* aTolLab2 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints2->Box );
aGrid->setSpacing( 5 ); myTolEdt2 = new QDoubleSpinBox( GroupPoints2->Box );
(new QLabel( tr( "GEOM_TOLERANCE" ), aGrid ))->setFixedWidth( aWidth );; initSpinBox( myTolEdt2, 0, 100, 1e-7, 10 );
myTolEdt2 = new QtxDblSpinBox( 0, 100, 1e-7, aGrid );
myTolEdt2->setPrecision( 10 );
myTolEdt2->setValue( DEFAULT_TOLERANCE_VALUE ); myTolEdt2->setValue( DEFAULT_TOLERANCE_VALUE );
myTolEdt2->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
(new QLabel( tr( "GLUE_FACES" ), aGrid ))->setFixedWidth( aWidth );; myDetectBtn = new QPushButton( tr( "GEOM_DETECT" ) + QString( " [%1]" ).arg( tr( "GLUE_FACES" ) ),
myDetectBtn = new QPushButton( tr( "GEOM_DETECT" ), aGrid ); GroupPoints2->Box );
myDetectBtn->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); mySubShapesChk = new QCheckBox( tr( "SELECT_FACES" ), GroupPoints2->Box );
mySubShapesChk = new QCheckBox( tr( "SELECT_FACES" ), aGrid );
GroupPoints2->getGroupBoxLayout()->addWidget( aGrid, 3, 0 ); boxLayout = new QGridLayout( GroupPoints2->Box );
boxLayout->setMargin( 0 ); boxLayout->setSpacing( 6 );
boxLayout->addWidget( aTolLab2, 0, 0 );
boxLayout->addWidget( myTolEdt2, 0, 2 );
boxLayout->addWidget( myDetectBtn, 1, 0, 1, 3 );
boxLayout->addWidget( mySubShapesChk, 2, 0, 1, 3 );
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
layout->addWidget( GroupPoints2 );
/***************************************************************/ /***************************************************************/
setHelpFileName( "glue_faces.htm" ); setHelpFileName( "glue_faces.htm" );
@ -131,7 +125,7 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* paren
// Disable second way of gluing if OCC viewer is not active one // Disable second way of gluing if OCC viewer is not active one
if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
!= OCCViewer_Viewer::Type() ) != OCCViewer_Viewer::Type() )
RadioButton2->setEnabled(false); mainFrame()->RadioButton2->setEnabled( false );
Init(); Init();
} }
@ -161,9 +155,10 @@ void RepairGUI_GlueDlg::Init()
//globalSelection( GEOM_COMPOUND ); //globalSelection( GEOM_COMPOUND );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
@ -198,43 +193,34 @@ void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 0, this, 0 ); disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 0, this, 0 );
switch ( constructorId ) switch ( constructorId ) {
{
case 0: case 0:
{
GroupPoints2->hide(); GroupPoints2->hide();
resize( 0, 0 );
GroupPoints->show(); GroupPoints->show();
GroupPoints->LineEdit1->setText( "" ); GroupPoints->LineEdit1->setText( "" );
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
if ( myCurrConstrId >= 0 ) // i.e. it is not initialisation if ( myCurrConstrId >= 0 ) {
{ // i.e. it is not initialisation
// copy tolerance from previous tolerance field // copy tolerance from previous tolerance field
myTolEdt->setValue( myTolEdt2->value() ); myTolEdt->setValue( myTolEdt2->value() );
} }
break; break;
}
case 1: case 1:
{
GroupPoints->hide(); GroupPoints->hide();
resize(0, 0);
GroupPoints2->show(); GroupPoints2->show();
GroupPoints->LineEdit1->setText( "" ); GroupPoints->LineEdit1->setText( "" );
myEditCurrentArgument = GroupPoints2->LineEdit1; myEditCurrentArgument = GroupPoints2->LineEdit1;
if ( myCurrConstrId >= 0 ) // i.e. it is not initialisation if ( myCurrConstrId >= 0 ) {
{ // i.e. it is not initialisation
// copy tolerance from previous tolerance field // copy tolerance from previous tolerance field
myTolEdt2->setValue( myTolEdt->value() ); myTolEdt2->setValue( myTolEdt->value() );
mySubShapesChk->setChecked( false ); mySubShapesChk->setChecked( false );
clearTemporary(); clearTemporary();
} }
break; break;
} }
}
myCurrConstrId = constructorId; myCurrConstrId = constructorId;
@ -245,8 +231,7 @@ void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
qApp->processEvents(); qApp->processEvents();
updateGeometry(); updateGeometry();
QSize aSize = minimumSizeHint(); resize( minimumSize() );
resize( width(), aSize.height() );
displayPreview(); displayPreview();
updateButtonState(); updateButtonState();
@ -367,9 +352,9 @@ void RepairGUI_GlueDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it // purpose : Mouse enter onto the dialog to activate it
//================================================================================= //=================================================================================
void RepairGUI_GlueDlg::enterEvent(QEvent* e) void RepairGUI_GlueDlg::enterEvent( QEvent* )
{ {
if ( !GroupConstructors->isEnabled() ) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -397,7 +382,7 @@ GEOM::GEOM_IOperations_ptr RepairGUI_GlueDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool RepairGUI_GlueDlg::isValid( QString& msg ) bool RepairGUI_GlueDlg::isValid( QString& )
{ {
return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. ); return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. );
} }
@ -411,8 +396,7 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
bool aResult = false; bool aResult = false;
objects.clear(); objects.clear();
switch ( getConstructorId() ) switch ( getConstructorId() ) {
{
case 0 : case 0 :
{ {
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow
@ -423,8 +407,7 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
break; break;
} }
case 1 : case 1 :
if ( IsPreview() ) if ( IsPreview() ) {
{
// if this method is used for displaying preview then we must detect glue faces only // if this method is used for displaying preview then we must detect glue faces only
ObjectList::iterator anIter; ObjectList::iterator anIter;
for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter) for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter)
@ -445,8 +428,7 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
// ObjectList toRemoveFromEnggine; // ObjectList toRemoveFromEnggine;
ObjectList toGlue; ObjectList toGlue;
ObjectList::iterator anIter; ObjectList::iterator anIter;
for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter) for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter ) {
{
if ( selected.contains( myGeomGUI->getApp()->orb()->object_to_string(*anIter) ) ) if ( selected.contains( myGeomGUI->getApp()->orb()->object_to_string(*anIter) ) )
toGlue.push_back(*anIter); toGlue.push_back(*anIter);
} }
@ -523,91 +505,73 @@ bool RepairGUI_GlueDlg::onAcceptLocal()
_PTR(Study) aStudy = getStudy()->studyDS(); _PTR(Study) aStudy = getStudy()->studyDS();
bool aLocked = aStudy->GetProperties()->IsLocked(); bool aLocked = aStudy->GetProperties()->IsLocked();
if ( aLocked ) if ( aLocked ) {
{
MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked"); MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked");
SUIT_MessageBox::warn1 ( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), tr( "WRN_STUDY_LOCKED" ), tr( "BUT_OK" ) );
QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED"), QObject::tr("BUT_OK") );
return false; return false;
} }
QString msg; QString msg;
if ( !isValid( msg ) ) if ( !isValid( msg ) ) {
{
showError( msg ); showError( msg );
return false; return false;
} }
erasePreview( false ); erasePreview( false );
try try {
{ if ( openCommand() ) {
if ( openCommand() )
{
SUIT_OverrideCursor wc; SUIT_OverrideCursor wc;
SUIT_Session::session()->activeApplication()->putInfo( "" ); SUIT_Session::session()->activeApplication()->putInfo( "" );
ObjectList objects; ObjectList objects;
if ( !execute( objects ) ) if ( !execute( objects ) ) {
{
wc.suspend(); wc.suspend();
abortCommand(); abortCommand();
showError(); showError();
} }
else else {
{
const int nbObjs = objects.size(); const int nbObjs = objects.size();
bool withChildren = false; bool withChildren = false;
for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
{
QString aName( "" ); QString aName( "" );
if ( nbObjs > 1 ) if ( nbObjs > 1 ) {
{
aName = strlen( getNewObjectName() ) ? GEOMBase::GetDefaultName( getNewObjectName() ) : GEOMBase::GetDefaultName( getPrefix( *it ) ); aName = strlen( getNewObjectName() ) ? GEOMBase::GetDefaultName( getNewObjectName() ) : GEOMBase::GetDefaultName( getPrefix( *it ) );
} }
else else {
{
aName = getNewObjectName(); aName = getNewObjectName();
// PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName() // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
if ( aName.isEmpty() ) if ( aName.isEmpty() )
aName = GEOMBase::GetDefaultName( getPrefix( *it ) ); aName = GEOMBase::GetDefaultName( getPrefix( *it ) );
} }
addInStudy( *it, aName.latin1() ); addInStudy( *it, aName.toLatin1().data() );
withChildren = false; withChildren = false;
display( *it, false ); display( *it, false );
} }
if ( nbObjs ) if ( nbObjs ) {
{
commitCommand(); commitCommand();
updateObjBrowser(); updateObjBrowser();
SUIT_Session::session()->activeApplication()->putInfo( QObject::tr("GEOM_PRP_DONE") ); SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_DONE" ) );
} }
else else {
{
abortCommand(); abortCommand();
} }
// JFA 28.12.2004 BEGIN // To enable warnings // JFA 28.12.2004 BEGIN // To enable warnings
if ( !getOperation()->_is_nil() ) if ( !getOperation()->_is_nil() ) {
{ if ( !getOperation()->IsDone() ) {
if ( !getOperation()->IsDone() )
{
wc.suspend(); wc.suspend();
QString msgw = QObject::tr( getOperation()->GetErrorCode() ); QString msgw = QObject::tr( getOperation()->GetErrorCode() );
SUIT_MessageBox::warn1((QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), msgw, tr( "BUT_OK" ) );
QObject::tr( "WRN_WARNING" ),
msgw,
QObject::tr( "BUT_OK" ));
} }
} }
// JFA 28.12.2004 END // JFA 28.12.2004 END
} }
} }
} }
catch( const SALOME::SALOME_Exception& e ) catch( const SALOME::SALOME_Exception& e ) {
{
SalomeApp_Tools::QtCatchCorbaException( e ); SalomeApp_Tools::QtCatchCorbaException( e );
abortCommand(); abortCommand();
} }
@ -639,17 +603,15 @@ void RepairGUI_GlueDlg::onDetect()
for ( int i = 0, n = aList->length(); i < n; i++ ) for ( int i = 0, n = aList->length(); i < n; i++ )
myTmpObjs.push_back(GEOM::GEOM_Object::_duplicate(aList[i])); myTmpObjs.push_back(GEOM::GEOM_Object::_duplicate(aList[i]));
if ( myTmpObjs.size() > 0 ) if ( myTmpObjs.size() > 0 ) {
{
msg = tr( "FACES_FOR_GLUING_ARE_DETECTED" ).arg( myTmpObjs.size() ); msg = tr( "FACES_FOR_GLUING_ARE_DETECTED" ).arg( myTmpObjs.size() );
mySubShapesChk->setChecked( true ); mySubShapesChk->setChecked( true );
} }
else else {
{
msg = tr( "THERE_ARE_NO_FACES_FOR_GLUING" ); msg = tr( "THERE_ARE_NO_FACES_FOR_GLUING" );
} }
SUIT_MessageBox::info1( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, "Close" ); SUIT_MessageBox::information( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, tr( "Close" ) );
updateButtonState(); updateButtonState();
activateSelection(); activateSelection();
} }
@ -663,8 +625,8 @@ void RepairGUI_GlueDlg::activateSelection()
erasePreview( false ); erasePreview( false );
int anId = getConstructorId(); int anId = getConstructorId();
if ( anId == 0 ) // Case of whole gluing if ( anId == 0 ) {
{ // Case of whole gluing
disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
@ -675,12 +637,11 @@ void RepairGUI_GlueDlg::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 // Second case of gluing else {
{ // Second case of gluing
if ( !mySubShapesChk->isChecked() ) if ( !mySubShapesChk->isChecked() )
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
else else {
{
displayPreview( true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED ); displayPreview( true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED );
globalSelection( GEOM_PREVIEW ); globalSelection( GEOM_PREVIEW );
} }
@ -697,16 +658,15 @@ void RepairGUI_GlueDlg::updateButtonState()
{ {
int anId = getConstructorId(); int anId = getConstructorId();
bool hasMainObj = !myObject->_is_nil(); bool hasMainObj = !myObject->_is_nil();
if ( anId == 0 ) if ( anId == 0 ) {
{ buttonOk()->setEnabled( hasMainObj );
buttonOk->setEnabled( hasMainObj ); buttonApply()->setEnabled( hasMainObj );
buttonApply->setEnabled( hasMainObj );
} }
else else
{ {
bool wasDetected = myTmpObjs.size() ? true : false; bool wasDetected = myTmpObjs.size() ? true : false;
buttonOk->setEnabled( hasMainObj && wasDetected ); buttonOk()->setEnabled( hasMainObj && wasDetected );
buttonApply->setEnabled( hasMainObj && wasDetected ); buttonApply()->setEnabled( hasMainObj && wasDetected );
mySubShapesChk->setEnabled( hasMainObj && wasDetected ); mySubShapesChk->setEnabled( hasMainObj && wasDetected );
myDetectBtn->setEnabled( hasMainObj ); myDetectBtn->setEnabled( hasMainObj );
if ( !hasMainObj || !wasDetected ) if ( !hasMainObj || !wasDetected )
@ -768,11 +728,9 @@ static string getEntry( GEOM::GEOM_Object_ptr object )
{ {
SUIT_Session* session = SUIT_Session::session(); SUIT_Session* session = SUIT_Session::session();
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() ); SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
if ( app ) if ( app ) {
{
string IOR = app->orb()->object_to_string( object ); string IOR = app->orb()->object_to_string( object );
if ( IOR != "" ) if ( IOR != "" ) {
{
SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy(); SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy();
_PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) ); _PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) );
if ( SO ) if ( SO )

View File

@ -19,19 +19,18 @@
// //
// 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 : RepairGUI_GlueDlg.h // File : RepairGUI_GlueDlg.h
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_Glue_H #ifndef REPAIRGUI_GLUEDLG_H
#define DIALOGBOX_Glue_H #define REPAIRGUI_GLUEDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class QtxDblSpinBox; class DlgRef_1SelExt;
class DlgRef_1Sel_Ext; class QDoubleSpinBox;
class QPushButton;
class QCheckBox; class QCheckBox;
//================================================================================= //=================================================================================
@ -43,20 +42,19 @@ class RepairGUI_GlueDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* parent = 0, RepairGUI_GlueDlg( GeometryGUI*, QWidget* = 0, bool = false );
const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~RepairGUI_GlueDlg(); ~RepairGUI_GlueDlg();
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* );
void closeEvent(QCloseEvent* e); void closeEvent( QCloseEvent* );
void initSelection(); void initSelection();
void clearTemporary(); void clearTemporary();
@ -70,14 +68,13 @@ private:
void selectTmpInViewer(); void selectTmpInViewer();
private: private:
GEOM::GEOM_Object_var myObject; GEOM::GEOM_Object_var myObject;
ObjectList myTmpObjs; ObjectList myTmpObjs;
DlgRef_1Sel_Ext* GroupPoints; DlgRef_1SelExt* GroupPoints;
DlgRef_1Sel_Ext* GroupPoints2; DlgRef_1SelExt* GroupPoints2;
QtxDblSpinBox* myTolEdt; QDoubleSpinBox* myTolEdt;
QtxDblSpinBox* myTolEdt2; QDoubleSpinBox* myTolEdt2;
QPushButton* myDetectBtn; QPushButton* myDetectBtn;
QCheckBox* mySubShapesChk; QCheckBox* mySubShapesChk;
@ -104,4 +101,4 @@ private slots:
void onSubShapesChk(); void onSubShapesChk();
}; };
#endif // DIALOGBOX_Glue_H #endif // REPAIRGUI_GLUEDLG_H

View File

@ -19,28 +19,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 : RepairGUI_RemoveHolesDlg.cxx // File : RepairGUI_RemoveHolesDlg.cxx
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "RepairGUI_RemoveHolesDlg.h" #include "RepairGUI_RemoveHolesDlg.h"
#include "SalomeApp_Application.h" #include <GEOM_DlgRef.h>
#include "LightApp_SelectionMgr.h" #include <GeometryGUI.h>
#include "SUIT_MessageBox.h" #include <GEOMBase.h>
#include "SUIT_Session.h"
#include "SALOME_ListIteratorOfListIO.hxx" #include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_MessageBox.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include "GEOMImpl_Types.hxx" #include <GEOMImpl_Types.hxx>
#include <TopAbs.hxx> #include <TopAbs.hxx>
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
using namespace std;
//================================================================================= //=================================================================================
// class : RepairGUI_RemoveHolesDlg() // class : RepairGUI_RemoveHolesDlg()
@ -50,59 +49,42 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
RepairGUI_RemoveHolesDlg::RepairGUI_RemoveHolesDlg( GeometryGUI* theGeometryGUI, QWidget* parent, RepairGUI_RemoveHolesDlg::RepairGUI_RemoveHolesDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl) bool modal )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | : GEOMBase_Skeleton( theGeometryGUI, parent, modal )
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SUPPRESS_HOLES" ) ) ); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SUPPRESS_HOLES" ) ) );
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_REMOVE_HOLES_TITLE")); setWindowTitle( tr( "GEOM_REMOVE_HOLES_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_REMOVE_HOLES_TITLE")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_REMOVE_HOLES_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();
GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints"); GroupPoints = new DlgRef_1Sel1Check1Sel( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_HOLES" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_HOLES" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
GroupPoints->PushButton1->setPixmap(image1); GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->CheckButton1->setText( tr( "GEOM_REMOVE_ALL_HOLES" ) );
GroupPoints->TextLabel2->setText( tr( "GEOM_SELECTED_SHAPE" ) );
GroupPoints->PushButton2->setIcon( image1 );
GroupPoints->LineEdit2->setReadOnly( true );
Layout1->addWidget(GroupPoints, 2, 0); myFreeBoundBtn = new QPushButton( tr( "GEOM_DETECT" ) + QString( " [%1]" ).arg( tr( "GEOM_FREE_BOUNDARIES" ) ),
GroupPoints->Box );
QVBoxLayout* l = new QVBoxLayout( GroupPoints->Box );
l->setMargin( 0 ); l->setSpacing( 0 );
l->addWidget( myFreeBoundBtn );
myAllChk = new QCheckBox( tr( "GEOM_REMOVE_ALL_HOLES" ), GroupPoints->GroupBox1 ); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
QGridLayout* aSelectWiresLay = new QGridLayout( 0, 1, 1, 0, 6, "aSelectWiresLay");
mySelectWiresBtn = new QPushButton( GroupPoints->GroupBox1, "mySelectWiresBtn" );
mySelectWiresBtn->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, mySelectWiresBtn->sizePolicy().hasHeightForWidth() ) );
mySelectWiresBtn->setText( trUtf8( "" ) );
mySelectWiresBtn->setPixmap(image1);
mySelectWiresEdt = new QLineEdit( GroupPoints->GroupBox1, "mySelectWiresEdt" );
mySelectWiresEdt->setReadOnly( true );
mySelectWiresLbl = new QLabel( tr( "GEOM_WIRES_TO_REMOVE" ), GroupPoints->GroupBox1, "TextLabel1" );
mySelectWiresLbl->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, mySelectWiresLbl->sizePolicy().hasHeightForWidth() ) );
aSelectWiresLay->addWidget( mySelectWiresLbl, 0, 0 );
aSelectWiresLay->addWidget( mySelectWiresBtn, 0, 1 );
aSelectWiresLay->addWidget( mySelectWiresEdt, 0, 2 );
QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
aSelectWiresLay->addItem( spacer, 1, 2 );
QGridLayout* aDetectLay = new QGridLayout( 0, 1, 1, 0, 6, "aDetectLay" );
myFreeBoundBtn = new QPushButton( tr( "GEOM_DETECT" ), GroupPoints->GroupBox1 );
QLabel* aLbl = new QLabel( tr( "GEOM_FREE_BOUNDARIES" ), GroupPoints->GroupBox1 );
aDetectLay->addWidget( aLbl, 0, 0 );
aDetectLay->addWidget( myFreeBoundBtn, 0, 1 );
GroupPoints->getGroupBoxLayout()->addMultiCellWidget( myAllChk, 1, 1, 0, 2 );
GroupPoints->getGroupBoxLayout()->addLayout( aSelectWiresLay, 2, 0 );
GroupPoints->getGroupBoxLayout()->addLayout( aDetectLay, 3, 0 );
/***************************************************************/ /***************************************************************/
setHelpFileName( "suppress_holes.htm" ); setHelpFileName( "suppress_holes.htm" );
@ -140,18 +122,18 @@ void RepairGUI_RemoveHolesDlg::Init()
myOpen = -1; myOpen = -1;
/* 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->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(mySelectWiresBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(mySelectWiresEdt, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
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() ) );
connect( myAllChk, SIGNAL( clicked() ), this, SLOT( onRemoveAllClicked() ) ); connect( GroupPoints->CheckButton1, SIGNAL( clicked() ), this, SLOT( onRemoveAllClicked() ) );
connect( myFreeBoundBtn, SIGNAL( clicked() ), this, SLOT( onDetect() ) ); connect( myFreeBoundBtn, SIGNAL( clicked() ), this, SLOT( onDetect() ) );
initName( tr( "REMOVE_HOLES_NEW_OBJ_NAME" ) ); initName( tr( "REMOVE_HOLES_NEW_OBJ_NAME" ) );
@ -181,7 +163,7 @@ bool RepairGUI_RemoveHolesDlg::ClickOnApply()
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
mySelectWiresEdt->setText(""); GroupPoints->LineEdit2->setText( "" );
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
myWiresInd->length( 0 ); myWiresInd->length( 0 );
@ -200,14 +182,12 @@ void RepairGUI_RemoveHolesDlg::SelectionIntoArgument()
erasePreview(); erasePreview();
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myObject = GEOM::GEOM_Object::_nil(); if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myObject = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == mySelectWiresEdt ) myWiresInd->length( 0 ); else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myWiresInd->length( 0 );
if ( IObjectCount() == 1 ) if ( IObjectCount() == 1 ) {
{
Handle(SALOME_InteractiveObject) anIO = firstIObject(); Handle(SALOME_InteractiveObject) anIO = firstIObject();
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) // face selection if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { // face selection
{
Standard_Boolean aRes; Standard_Boolean aRes;
myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( aRes && GEOMBase::IsShape( myObject ) ) if ( aRes && GEOMBase::IsShape( myObject ) )
@ -215,8 +195,8 @@ void RepairGUI_RemoveHolesDlg::SelectionIntoArgument()
else else
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
} }
else if ( myEditCurrentArgument == mySelectWiresEdt && !myAllChk->isChecked() ) else if ( myEditCurrentArgument == GroupPoints->LineEdit2 &&
{ !GroupPoints->CheckButton1->isChecked() ) {
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr()->GetIndexes( anIO, aMap ); ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr()->GetIndexes( anIO, aMap );
const int n = aMap.Extent(); const int n = aMap.Extent();
@ -238,10 +218,9 @@ void RepairGUI_RemoveHolesDlg::SetEditCurrentArgument()
const QObject* send = sender(); const QObject* send = sender();
if ( send == GroupPoints->PushButton1 ) if ( send == GroupPoints->PushButton1 )
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
else if ( send == mySelectWiresBtn && !myObject->_is_nil() ) else if ( send == GroupPoints->PushButton2 && !myObject->_is_nil() )
myEditCurrentArgument = mySelectWiresEdt; myEditCurrentArgument = GroupPoints->LineEdit2;
if ( myEditCurrentArgument ) if ( myEditCurrentArgument ) {
{
initSelection(); initSelection();
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
SelectionIntoArgument(); SelectionIntoArgument();
@ -256,8 +235,7 @@ void RepairGUI_RemoveHolesDlg::SetEditCurrentArgument()
void RepairGUI_RemoveHolesDlg::LineEditReturnPressed() void RepairGUI_RemoveHolesDlg::LineEditReturnPressed()
{ {
const QObject* send = sender(); const QObject* send = sender();
if( send == GroupPoints->LineEdit1 || send == mySelectWiresEdt ) if ( send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2 ) {
{
myEditCurrentArgument = (QLineEdit*)send; myEditCurrentArgument = (QLineEdit*)send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -276,7 +254,7 @@ void RepairGUI_RemoveHolesDlg::ActivateThisDialog()
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
mySelectWiresEdt->setText(""); GroupPoints->LineEdit2->setText( "" );
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
myWiresInd->length( 0 ); myWiresInd->length( 0 );
@ -292,9 +270,9 @@ void RepairGUI_RemoveHolesDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it // purpose : Mouse enter onto the dialog to activate it
//================================================================================= //=================================================================================
void RepairGUI_RemoveHolesDlg::enterEvent(QEvent* e) void RepairGUI_RemoveHolesDlg::enterEvent( QEvent* )
{ {
if ( !GroupConstructors->isEnabled() ) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -322,10 +300,10 @@ GEOM::GEOM_IOperations_ptr RepairGUI_RemoveHolesDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool RepairGUI_RemoveHolesDlg::isValid( QString& msg ) bool RepairGUI_RemoveHolesDlg::isValid( QString& )
{ {
myClosed = -1; myClosed = -1;
return !myObject->_is_nil() && ( IsPreview() || myAllChk->isChecked() || myWiresInd->length() ); return !myObject->_is_nil() && ( IsPreview() || GroupPoints->CheckButton1->isChecked() || myWiresInd->length() );
} }
//================================================================================= //=================================================================================
@ -335,14 +313,12 @@ bool RepairGUI_RemoveHolesDlg::isValid( QString& msg )
bool RepairGUI_RemoveHolesDlg::execute( ObjectList& objects ) bool RepairGUI_RemoveHolesDlg::execute( ObjectList& objects )
{ {
bool aResult = false; bool aResult = false;
if ( IsPreview() ) // called from onDetect(): detect free boundary edges, highlight them (add to objects), display message dialog if ( IsPreview() ) { // called from onDetect(): detect free boundary edges, highlight them (add to objects), display message dialog
{
GEOM::ListOfGO_var aClosed, anOpen; GEOM::ListOfGO_var aClosed, anOpen;
aResult = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->GetFreeBoundary( myObject, aClosed, anOpen ); aResult = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->GetFreeBoundary( myObject, aClosed, anOpen );
if ( aResult ) if ( aResult ) {
{
myClosed = aClosed->length(); myClosed = aClosed->length();
myOpen = anOpen->length(); myOpen = anOpen->length();
int i; int i;
@ -354,8 +330,7 @@ bool RepairGUI_RemoveHolesDlg::execute( ObjectList& objects )
else else
myClosed = -1; myClosed = -1;
} }
else else {
{
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->FillHoles( myObject, myWiresInd ); GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->FillHoles( myObject, myWiresInd );
aResult = !anObj->_is_nil(); aResult = !anObj->_is_nil();
if ( aResult ) if ( aResult )
@ -371,13 +346,12 @@ bool RepairGUI_RemoveHolesDlg::execute( ObjectList& objects )
//================================================================================= //=================================================================================
void RepairGUI_RemoveHolesDlg::onRemoveAllClicked() void RepairGUI_RemoveHolesDlg::onRemoveAllClicked()
{ {
bool b = myAllChk->isOn(); bool b = GroupPoints->CheckButton1->isChecked();
mySelectWiresLbl->setEnabled( !b ); GroupPoints->TextLabel2->setEnabled( !b );
mySelectWiresBtn->setEnabled( !b ); GroupPoints->PushButton2->setEnabled( !b );
mySelectWiresEdt->setEnabled( !b ); GroupPoints->LineEdit2->setEnabled( !b );
if ( b ) if ( b ) {
{ GroupPoints->LineEdit2->setText( "" );
mySelectWiresEdt->setText( "" );
myWiresInd->length( 0 ); myWiresInd->length( 0 );
} }
} }
@ -388,8 +362,7 @@ void RepairGUI_RemoveHolesDlg::onRemoveAllClicked()
//================================================================================= //=================================================================================
void RepairGUI_RemoveHolesDlg::initSelection() void RepairGUI_RemoveHolesDlg::initSelection()
{ {
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
{
TColStd_MapOfInteger aTypes; TColStd_MapOfInteger aTypes;
aTypes.Add( GEOM_COMPOUND ); aTypes.Add( GEOM_COMPOUND );
aTypes.Add( GEOM_SOLID ); aTypes.Add( GEOM_SOLID );
@ -398,8 +371,7 @@ void RepairGUI_RemoveHolesDlg::initSelection()
globalSelection( aTypes ); globalSelection( aTypes );
} }
else if ( myEditCurrentArgument == mySelectWiresEdt ) else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
{
localSelection( myObject, TopAbs_EDGE ); localSelection( myObject, TopAbs_EDGE );
localSelection( myObject, TopAbs_WIRE ); localSelection( myObject, TopAbs_WIRE );
} }
@ -420,6 +392,6 @@ void RepairGUI_RemoveHolesDlg::onDetect()
msg = tr( "GEOM_FREE_BOUNDS_MSG" ).arg( myClosed + myOpen ).arg( myClosed ).arg( myOpen ); msg = tr( "GEOM_FREE_BOUNDS_MSG" ).arg( myClosed + myOpen ).arg( myClosed ).arg( myOpen );
else else
msg = tr( "GEOM_FREE_BOUNDS_ERROR" ); msg = tr( "GEOM_FREE_BOUNDS_ERROR" );
SUIT_MessageBox::info1( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, "Close" ); SUIT_MessageBox::information( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg );
} }

View File

@ -19,24 +19,17 @@
// //
// 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 : RepairGUI_RemoveHolesDlg.h // File : RepairGUI_RemoveHolesDlg.h
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_RemoveHoles_H #ifndef REPAIRGUI_REMOVEHOLESDLG_H
#define DIALOGBOX_RemoveHoles_H #define REPAIRGUI_REMOVEHOLESDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
#include "DlgRef_1Sel_Ext.h"
#include <TColStd_IndexedMapOfInteger.hxx> class DlgRef_1Sel1Check1Sel;
class QPushButton;
#include <qcheckbox.h>
#include <qbuttongroup.h>
#include <qlineedit.h>
#include <qlabel.h>
//================================================================================= //=================================================================================
// class : RepairGUI_RemoveHolesDlg // class : RepairGUI_RemoveHolesDlg
@ -47,30 +40,26 @@ class RepairGUI_RemoveHolesDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
RepairGUI_RemoveHolesDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, RepairGUI_RemoveHolesDlg( GeometryGUI*, QWidget* = 0, bool = false );
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_RemoveHolesDlg(); ~RepairGUI_RemoveHolesDlg();
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* );
void closeEvent(QCloseEvent* e); void closeEvent( QCloseEvent* );
void initSelection(); void initSelection();
private:
GEOM::GEOM_Object_var myObject; GEOM::GEOM_Object_var myObject;
GEOM::short_array_var myWiresInd; GEOM::short_array_var myWiresInd;
DlgRef_1Sel_Ext* GroupPoints; DlgRef_1Sel1Check1Sel* GroupPoints;
QCheckBox* myAllChk;
QLabel* mySelectWiresLbl;
QPushButton* mySelectWiresBtn;
QLineEdit* mySelectWiresEdt;
QPushButton* myFreeBoundBtn; QPushButton* myFreeBoundBtn;
int myClosed; // Number of free closed boundaries detected. Calculated in execute(), used in onDetect(). int myClosed; // Number of free closed boundaries detected. Calculated in execute(), used in onDetect().
@ -90,4 +79,4 @@ private slots:
void onDetect(); void onDetect();
}; };
#endif // DIALOGBOX_RemoveHoles_H #endif // REPAIRGUI_REMOVEHOLESDLG_H

View File

@ -19,26 +19,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 : RepairGUI_RemoveIntWiresDlg.cxx // File : RepairGUI_RemoveIntWiresDlg.cxx
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "RepairGUI_RemoveIntWiresDlg.h" #include "RepairGUI_RemoveIntWiresDlg.h"
#include "SalomeApp_Application.h" #include <GEOM_DlgRef.h>
#include "LightApp_SelectionMgr.h" #include <GeometryGUI.h>
#include "SUIT_Session.h" #include <GEOMBase.h>
#include "SALOME_ListIteratorOfListIO.hxx"
#include "GEOMImpl_Types.hxx" #include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <GEOMImpl_Types.hxx>
#include <TopAbs.hxx> #include <TopAbs.hxx>
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
using namespace std;
//================================================================================= //=================================================================================
// class : RepairGUI_RemoveIntWiresDlg() // class : RepairGUI_RemoveIntWiresDlg()
@ -48,52 +48,36 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
RepairGUI_RemoveIntWiresDlg::RepairGUI_RemoveIntWiresDlg( GeometryGUI* theGeometryGUI, QWidget* parent, RepairGUI_RemoveIntWiresDlg::RepairGUI_RemoveIntWiresDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl) bool modal )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | : GEOMBase_Skeleton( theGeometryGUI, parent, modal )
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0( myGeomGUI->getApp()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SUPPRESS_INT_WIRES" ) ) ); QPixmap image0( myGeomGUI->getApp()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SUPPRESS_INT_WIRES" ) ) );
QPixmap image1( myGeomGUI->getApp()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap image1( myGeomGUI->getApp()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setCaption(tr("GEOM_REMOVE_INTERNAL_WIRES_TITLE")); setWindowTitle( tr( "GEOM_REMOVE_INTERNAL_WIRES_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_REMOVE_INTERNAL_WIRES_TITLE")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_REMOVE_INTERNAL_WIRES_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();
GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints"); GroupPoints = new DlgRef_1Sel1Check1Sel( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_INTERNAL_WIRES" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_INTERNAL_WIRES" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_FACE" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_FACE" ) );
GroupPoints->PushButton1->setPixmap(image1); GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->CheckButton1->setText( tr( "GEOM_REMOVE_ALL_INT_WIRES" ) );
GroupPoints->TextLabel2->setText( tr( "GEOM_WIRES_TO_REMOVE" ) );
GroupPoints->PushButton2->setIcon( image1 );
GroupPoints->LineEdit2->setReadOnly( true );
Layout1->addWidget(GroupPoints, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
myAllChk = new QCheckBox( tr( "GEOM_REMOVE_ALL_INT_WIRES" ), GroupPoints->GroupBox1 );
QGridLayout* aSelectWiresLay = new QGridLayout( 0, 1, 1, 0, 6, "aSelectWiresLay");
mySelectWiresBtn = new QPushButton( GroupPoints->GroupBox1, "mySelectWiresBtn" );
mySelectWiresBtn->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, mySelectWiresBtn->sizePolicy().hasHeightForWidth() ) );
mySelectWiresBtn->setText( trUtf8( "" ) );
mySelectWiresBtn->setPixmap(image1);
mySelectWiresEdt = new QLineEdit( GroupPoints->GroupBox1, "mySelectWiresEdt" );
mySelectWiresEdt->setReadOnly( true );
mySelectWiresLbl = new QLabel( tr( "GEOM_WIRES_TO_REMOVE" ), GroupPoints->GroupBox1, "TextLabel1" );
mySelectWiresLbl->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, mySelectWiresLbl->sizePolicy().hasHeightForWidth() ) );
aSelectWiresLay->addWidget( mySelectWiresLbl, 0, 0 );
aSelectWiresLay->addWidget( mySelectWiresBtn, 0, 1 );
aSelectWiresLay->addWidget( mySelectWiresEdt, 0, 2 );
QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
aSelectWiresLay->addItem( spacer, 1, 2 );
GroupPoints->getGroupBoxLayout()->addMultiCellWidget( myAllChk, 1, 1, 0, 2 );
GroupPoints->getGroupBoxLayout()->addLayout( aSelectWiresLay, 2, 0 );
/***************************************************************/ /***************************************************************/
setHelpFileName( "suppress_internal_wires.htm" ); setHelpFileName( "suppress_internal_wires.htm" );
@ -128,18 +112,18 @@ void RepairGUI_RemoveIntWiresDlg::Init()
initSelection(); initSelection();
/* 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->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(mySelectWiresBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(mySelectWiresEdt, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
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() ) );
connect( myAllChk, SIGNAL( clicked() ), this, SLOT( onRemoveAllClicked() ) ); connect( GroupPoints->CheckButton1, SIGNAL( clicked() ), this, SLOT( onRemoveAllClicked() ) );
initName( tr( "REMOVE_INT_WIRES_NEW_OBJ_NAME" ) ); initName( tr( "REMOVE_INT_WIRES_NEW_OBJ_NAME" ) );
} }
@ -168,7 +152,7 @@ bool RepairGUI_RemoveIntWiresDlg::ClickOnApply()
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
mySelectWiresEdt->setText(""); GroupPoints->LineEdit2->setText( "" );
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
myWiresInd->length( 0 ); myWiresInd->length( 0 );
@ -186,14 +170,12 @@ void RepairGUI_RemoveIntWiresDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myObject = GEOM::GEOM_Object::_nil(); if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myObject = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == mySelectWiresEdt ) myWiresInd->length( 0 ); else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myWiresInd->length( 0 );
if ( IObjectCount() == 1 ) if ( IObjectCount() == 1 ) {
{
Handle(SALOME_InteractiveObject) anIO = firstIObject(); Handle(SALOME_InteractiveObject) anIO = firstIObject();
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) // face selection if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { // face selection
{
Standard_Boolean aRes; Standard_Boolean aRes;
myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( aRes && GEOMBase::IsShape( myObject ) ) if ( aRes && GEOMBase::IsShape( myObject ) )
@ -201,8 +183,8 @@ void RepairGUI_RemoveIntWiresDlg::SelectionIntoArgument()
else else
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
} }
else if ( myEditCurrentArgument == mySelectWiresEdt && !myAllChk->isChecked() ) else if ( myEditCurrentArgument == GroupPoints->LineEdit2 &&
{ !GroupPoints->CheckButton1->isChecked() ) {
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr()->GetIndexes( anIO, aMap ); ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr()->GetIndexes( anIO, aMap );
const int n = aMap.Extent(); const int n = aMap.Extent();
@ -224,11 +206,10 @@ void RepairGUI_RemoveIntWiresDlg::SetEditCurrentArgument()
const QObject* send = sender(); const QObject* send = sender();
if ( send == GroupPoints->PushButton1 ) if ( send == GroupPoints->PushButton1 )
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
else if ( send == mySelectWiresBtn && !myObject->_is_nil() ) else if ( send == GroupPoints->PushButton2 && !myObject->_is_nil() )
myEditCurrentArgument = mySelectWiresEdt; myEditCurrentArgument = GroupPoints->LineEdit2;
if ( myEditCurrentArgument ) if ( myEditCurrentArgument ) {
{
initSelection(); initSelection();
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
SelectionIntoArgument(); SelectionIntoArgument();
@ -243,8 +224,7 @@ void RepairGUI_RemoveIntWiresDlg::SetEditCurrentArgument()
void RepairGUI_RemoveIntWiresDlg::LineEditReturnPressed() void RepairGUI_RemoveIntWiresDlg::LineEditReturnPressed()
{ {
const QObject* send = sender(); const QObject* send = sender();
if( send == GroupPoints->LineEdit1 || send == mySelectWiresEdt ) if ( send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2 ) {
{
myEditCurrentArgument = (QLineEdit*)send; myEditCurrentArgument = (QLineEdit*)send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -263,7 +243,7 @@ void RepairGUI_RemoveIntWiresDlg::ActivateThisDialog()
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
mySelectWiresEdt->setText(""); GroupPoints->LineEdit2->setText( "" );
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
myWiresInd->length( 0 ); myWiresInd->length( 0 );
@ -275,9 +255,9 @@ void RepairGUI_RemoveIntWiresDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it // purpose : Mouse enter onto the dialog to activate it
//================================================================================= //=================================================================================
void RepairGUI_RemoveIntWiresDlg::enterEvent(QEvent* e) void RepairGUI_RemoveIntWiresDlg::enterEvent( QEvent* )
{ {
if ( !GroupConstructors->isEnabled() ) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -304,9 +284,9 @@ GEOM::GEOM_IOperations_ptr RepairGUI_RemoveIntWiresDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool RepairGUI_RemoveIntWiresDlg::isValid( QString& msg ) bool RepairGUI_RemoveIntWiresDlg::isValid( QString& )
{ {
return !myObject->_is_nil() && ( myAllChk->isChecked() || myWiresInd->length() ); return !myObject->_is_nil() && ( GroupPoints->CheckButton1->isChecked() || myWiresInd->length() );
} }
//================================================================================= //=================================================================================
@ -330,13 +310,12 @@ bool RepairGUI_RemoveIntWiresDlg::execute( ObjectList& objects )
//================================================================================= //=================================================================================
void RepairGUI_RemoveIntWiresDlg::onRemoveAllClicked() void RepairGUI_RemoveIntWiresDlg::onRemoveAllClicked()
{ {
bool b = myAllChk->isOn(); bool b = GroupPoints->CheckButton1->isChecked();
mySelectWiresLbl->setEnabled( !b ); GroupPoints->TextLabel2->setEnabled( !b );
mySelectWiresBtn->setEnabled( !b ); GroupPoints->PushButton2->setEnabled( !b );
mySelectWiresEdt->setEnabled( !b ); GroupPoints->LineEdit2->setEnabled( !b );
if ( b ) if ( b ) {
{ GroupPoints->LineEdit2->setText( "" );
mySelectWiresEdt->setText( "" );
myWiresInd->length( 0 ); myWiresInd->length( 0 );
} }
} }
@ -347,8 +326,7 @@ void RepairGUI_RemoveIntWiresDlg::onRemoveAllClicked()
//================================================================================= //=================================================================================
void RepairGUI_RemoveIntWiresDlg::initSelection() void RepairGUI_RemoveIntWiresDlg::initSelection()
{ {
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
{
TColStd_MapOfInteger aTypes; TColStd_MapOfInteger aTypes;
aTypes.Add( GEOM_COMPOUND ); aTypes.Add( GEOM_COMPOUND );
aTypes.Add( GEOM_SOLID ); aTypes.Add( GEOM_SOLID );
@ -357,8 +335,7 @@ void RepairGUI_RemoveIntWiresDlg::initSelection()
globalSelection( aTypes ); globalSelection( aTypes );
} }
else if ( myEditCurrentArgument == mySelectWiresEdt ) else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
{
//localSelection( myObject, TopAbs_EDGE ); //localSelection( myObject, TopAbs_EDGE );
localSelection( myObject, TopAbs_WIRE ); localSelection( myObject, TopAbs_WIRE );
} }

View File

@ -19,24 +19,16 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : RepairGUI_RemoveIntWiresDlg.h // File : RepairGUI_RemoveIntWiresDlg.h
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_RemoveIntWires_H #ifndef REPAIRGUI_REMOVEINTWIRESDLG_H
#define DIALOGBOX_RemoveIntWires_H #define REPAIRGUI_REMOVEINTWIRESDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
#include "DlgRef_1Sel_Ext.h"
#include <TColStd_IndexedMapOfInteger.hxx> class DlgRef_1Sel1Check1Sel;
#include <qcheckbox.h>
#include <qbuttongroup.h>
#include <qlineedit.h>
#include <qlabel.h>
//================================================================================= //=================================================================================
// class : RepairGUI_RemoveIntWiresDlg // class : RepairGUI_RemoveIntWiresDlg
@ -47,30 +39,26 @@ class RepairGUI_RemoveIntWiresDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
RepairGUI_RemoveIntWiresDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, RepairGUI_RemoveIntWiresDlg( GeometryGUI*, QWidget* = 0, bool = false );
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_RemoveIntWiresDlg(); ~RepairGUI_RemoveIntWiresDlg();
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* );
void closeEvent(QCloseEvent* e); void closeEvent( QCloseEvent* );
void initSelection(); void initSelection();
private:
GEOM::GEOM_Object_var myObject; GEOM::GEOM_Object_var myObject;
GEOM::short_array_var myWiresInd; GEOM::short_array_var myWiresInd;
DlgRef_1Sel_Ext* GroupPoints; DlgRef_1Sel1Check1Sel* GroupPoints;
QCheckBox* myAllChk;
QLabel* mySelectWiresLbl;
QPushButton* mySelectWiresBtn;
QLineEdit* mySelectWiresEdt;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
@ -85,4 +73,4 @@ private slots:
void onRemoveAllClicked(); void onRemoveAllClicked();
}; };
#endif // DIALOGBOX_RemoveIntWires_H #endif // REPAIRGUI_REMOVEINTWIRESDLG_H

View File

@ -19,30 +19,29 @@
// //
// 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 : RepairGUI_SewingDlg.cxx // File : RepairGUI_SewingDlg.cxx
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "RepairGUI_SewingDlg.h" #include "RepairGUI_SewingDlg.h"
#include "SalomeApp_Application.h" #include <GEOM_DlgRef.h>
#include "LightApp_SelectionMgr.h" #include <GeometryGUI.h>
#include "SUIT_Session.h" #include <GEOMBase.h>
#include "SUIT_MessageBox.h"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "GEOMImpl_Types.hxx" #include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <GEOMImpl_Types.hxx>
#include <TopAbs.hxx> #include <TopAbs.hxx>
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#define DEFAULT_TOLERANCE_VALUE 1e-07 #define DEFAULT_TOLERANCE_VALUE 1e-07
using namespace std;
//================================================================================= //=================================================================================
// class : RepairGUI_SewingDlg() // class : RepairGUI_SewingDlg()
// purpose : Constructs a RepairGUI_SewingDlg which is a child of 'parent', with the // purpose : Constructs a RepairGUI_SewingDlg which is a child of 'parent', with the
@ -51,42 +50,43 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
RepairGUI_SewingDlg::RepairGUI_SewingDlg( GeometryGUI* theGeometryGUI, QWidget* parent, RepairGUI_SewingDlg::RepairGUI_SewingDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl) bool modal )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | : GEOMBase_Skeleton( theGeometryGUI, parent, modal )
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SEWING" ) ) ); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SEWING" ) ) );
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_SEWING_TITLE")); setWindowTitle( tr( "GEOM_SEWING_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_SEWING_TITLE")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_SEWING_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();
GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints"); GroupPoints = new DlgRef_1SelExt( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_SEWING" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_SEWING" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
GroupPoints->PushButton1->setPixmap(image1); GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly( true );
Layout1->addWidget(GroupPoints, 2, 0); QGridLayout* aLay = new QGridLayout( GroupPoints->Box );
aLay->setMargin( 0 ); aLay->setSpacing( 6 );
QGridLayout* aLay = new QGridLayout( 0, 2, 2, 0, 6, "aLay" ); myTolEdt = new QDoubleSpinBox( GroupPoints->Box );
myTolEdt = new QtxDblSpinBox( 0, 100, 1e-7, GroupPoints->GroupBox1 );//QAD_SpinBoxDbl( GroupPoints->GroupBox1, 0, 100, 1e-7, 10, 1e-10 ); initSpinBox( myTolEdt, 0, 100, 1e-7, 10 );
myTolEdt->setPrecision( 10 );
myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE ); myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE );
QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->GroupBox1 ); QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box );
myFreeBoundBtn = new QPushButton( tr( "GEOM_DETECT" ), GroupPoints->GroupBox1 ); myFreeBoundBtn = new QPushButton( tr( "GEOM_DETECT" ) + QString( " [%1]" ).arg( tr( "GEOM_FREE_BOUNDARIES" ) ),
QLabel* aLbl2 = new QLabel( tr( "GEOM_FREE_BOUNDARIES" ), GroupPoints->GroupBox1 ); GroupPoints->Box );
aLay->addWidget( aLbl1, 0, 0 ); aLay->addWidget( aLbl1, 0, 0 );
aLay->addWidget( myTolEdt, 0, 1 ); aLay->addWidget( myTolEdt, 0, 1 );
aLay->addWidget( aLbl2, 1, 0 ); aLay->addWidget( myFreeBoundBtn, 1, 0, 1, 2 );
aLay->addWidget( myFreeBoundBtn, 1, 1 );
GroupPoints->getGroupBoxLayout()->addLayout( aLay, 3, 0 ); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
/***************************************************************/ /***************************************************************/
setHelpFileName( "sewing.htm" ); setHelpFileName( "sewing.htm" );
@ -122,8 +122,8 @@ void RepairGUI_SewingDlg::Init()
myOpen = -1; myOpen = -1;
/* 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->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
@ -177,8 +177,7 @@ void RepairGUI_SewingDlg::SelectionIntoArgument()
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
if ( IObjectCount() == 1 ) if ( IObjectCount() == 1 ) {
{
Handle(SALOME_InteractiveObject) anIO = firstIObject(); Handle(SALOME_InteractiveObject) anIO = firstIObject();
Standard_Boolean aRes; Standard_Boolean aRes;
myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
@ -194,8 +193,7 @@ void RepairGUI_SewingDlg::SelectionIntoArgument()
void RepairGUI_SewingDlg::SetEditCurrentArgument() void RepairGUI_SewingDlg::SetEditCurrentArgument()
{ {
const QObject* send = sender(); const QObject* send = sender();
if ( send == GroupPoints->PushButton1 ) if ( send == GroupPoints->PushButton1 ) {
{
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
SelectionIntoArgument(); SelectionIntoArgument();
} }
@ -209,8 +207,7 @@ void RepairGUI_SewingDlg::SetEditCurrentArgument()
void RepairGUI_SewingDlg::LineEditReturnPressed() void RepairGUI_SewingDlg::LineEditReturnPressed()
{ {
const QObject* send = sender(); const QObject* send = sender();
if( send == GroupPoints->LineEdit1 ) if( send == GroupPoints->LineEdit1 ) {
{
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -242,9 +239,9 @@ void RepairGUI_SewingDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it // purpose : Mouse enter onto the dialog to activate it
//================================================================================= //=================================================================================
void RepairGUI_SewingDlg::enterEvent(QEvent* e) void RepairGUI_SewingDlg::enterEvent( QEvent* )
{ {
if ( !GroupConstructors->isEnabled() ) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -272,7 +269,7 @@ GEOM::GEOM_IOperations_ptr RepairGUI_SewingDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool RepairGUI_SewingDlg::isValid( QString& msg ) bool RepairGUI_SewingDlg::isValid( QString& )
{ {
myClosed = -1; myClosed = -1;
return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. ); return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. );
@ -285,14 +282,12 @@ bool RepairGUI_SewingDlg::isValid( QString& msg )
bool RepairGUI_SewingDlg::execute( ObjectList& objects ) bool RepairGUI_SewingDlg::execute( ObjectList& objects )
{ {
bool aResult = false; bool aResult = false;
if ( IsPreview() ) // called from onDetect(): detect free boundary edges, highlight them (add to objects), display message dialog if ( IsPreview() ) { // called from onDetect(): detect free boundary edges, highlight them (add to objects), display message dialog
{
GEOM::ListOfGO_var aClosed, anOpen; GEOM::ListOfGO_var aClosed, anOpen;
aResult = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->GetFreeBoundary( myObject, aClosed, anOpen ); aResult = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->GetFreeBoundary( myObject, aClosed, anOpen );
if ( aResult ) if ( aResult ) {
{
myClosed = aClosed->length(); myClosed = aClosed->length();
myOpen = anOpen->length(); myOpen = anOpen->length();
int i; int i;
@ -304,8 +299,7 @@ bool RepairGUI_SewingDlg::execute( ObjectList& objects )
else else
myClosed = -1; myClosed = -1;
} }
else else {
{
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->Sew( myObject, myTolEdt->value() ); GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->Sew( myObject, myTolEdt->value() );
aResult = !anObj->_is_nil(); aResult = !anObj->_is_nil();
if ( aResult ) if ( aResult )
@ -342,5 +336,5 @@ void RepairGUI_SewingDlg::onDetect()
msg = tr( "GEOM_FREE_BOUNDS_MSG" ).arg( myClosed + myOpen ).arg( myClosed ).arg( myOpen ); msg = tr( "GEOM_FREE_BOUNDS_MSG" ).arg( myClosed + myOpen ).arg( myClosed ).arg( myOpen );
else else
msg = tr( "GEOM_FREE_BOUNDS_ERROR" ); msg = tr( "GEOM_FREE_BOUNDS_ERROR" );
SUIT_MessageBox::info1( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, "Close" ); SUIT_MessageBox::information( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg );
} }

View File

@ -19,25 +19,18 @@
// //
// 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 : RepairGUI_SewingDlg.h // File : RepairGUI_SewingDlg.h
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_Sewing_H #ifndef REPAIRGUI_SEWINGDLG_H
#define DIALOGBOX_Sewing_H #define REPAIRGUI_SEWINGDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
#include "DlgRef_1Sel_Ext.h"
#include "QtxDblSpinBox.h"
#include <TColStd_IndexedMapOfInteger.hxx> class DlgRef_1SelExt;
class QDoubleSpinBox;
#include <qcheckbox.h> class QPushButton;
#include <qbuttongroup.h>
#include <qlineedit.h>
#include <qlabel.h>
//================================================================================= //=================================================================================
// class : RepairGUI_SewingDlg // class : RepairGUI_SewingDlg
@ -48,26 +41,26 @@ class RepairGUI_SewingDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
RepairGUI_SewingDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, RepairGUI_SewingDlg( GeometryGUI*, QWidget* = 0, bool = false );
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_SewingDlg(); ~RepairGUI_SewingDlg();
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* );
void closeEvent(QCloseEvent* e); void closeEvent( QCloseEvent* );
void initSelection(); void initSelection();
private:
GEOM::GEOM_Object_var myObject; GEOM::GEOM_Object_var myObject;
DlgRef_1Sel_Ext* GroupPoints; DlgRef_1SelExt* GroupPoints;
QtxDblSpinBox* myTolEdt; QDoubleSpinBox* myTolEdt;
QPushButton* myFreeBoundBtn; QPushButton* myFreeBoundBtn;
int myClosed; // Number of free closed boundaries detected. Calculated in execute(), used in onDetect(). int myClosed; // Number of free closed boundaries detected. Calculated in execute(), used in onDetect().
@ -86,4 +79,4 @@ private slots:
void onDetect(); void onDetect();
}; };
#endif // DIALOGBOX_Sewing_H #endif // REPAIRGUI_SEWINGDLG_H

View File

@ -19,31 +19,30 @@
// //
// 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 : RepairGUI_ShapeProcessDlg.cxx // File : RepairGUI_ShapeProcessDlg.cxx
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "RepairGUI_ShapeProcessDlg.h" #include "RepairGUI_ShapeProcessDlg.h"
#include "GEOMImpl_Types.hxx" #include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include <GEOMImpl_Types.hxx>
#include "SalomeApp_Application.h" #include <SalomeApp_Application.h>
#include "LightApp_SelectionMgr.h" #include <LightApp_SelectionMgr.h>
#include "SUIT_Session.h" #include <SUIT_Session.h>
#include "SALOME_ListIteratorOfListIO.hxx" #include <SUIT_ResourceMgr.h>
#include "SALOME_ListIO.hxx" #include <SUIT_MessageBox.h>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SALOME_ListIO.hxx>
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#include <qheader.h> #include <QListWidget>
#include <qlabel.h> #include <QStackedLayout>
#include <qmessagebox.h>
using namespace std;
//================================================================================= //=================================================================================
// class : RepairGUI_ShapeProcessDlg() // class : RepairGUI_ShapeProcessDlg()
@ -53,9 +52,8 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
RepairGUI_ShapeProcessDlg::RepairGUI_ShapeProcessDlg( GeometryGUI* theGeometryGUI, QWidget* parent, RepairGUI_ShapeProcessDlg::RepairGUI_ShapeProcessDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl) bool modal )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | : GEOMBase_Skeleton( theGeometryGUI, parent, modal )
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
setHelpFileName( "shape_processing.htm" ); setHelpFileName( "shape_processing.htm" );
init(); init();
@ -80,165 +78,160 @@ void RepairGUI_ShapeProcessDlg::init()
initParamsValues(); initParamsValues();
initSelection(); initSelection();
setCaption(tr("GEOM_SHAPEPROCESS_TITLE")); setWindowTitle( tr( "GEOM_SHAPEPROCESS_TITLE" ) );
GroupConstructors->hide(); mainFrame()->GroupConstructors->hide();
// select widget on the top // select widget on the top
mySelectWdgt = new DlgRef_1Sel_QTD( this, "SelectedObjects" ); mySelectWdgt = new DlgRef_1Sel( centralWidget() );
mySelectWdgt->GroupBox1->setTitle( tr( "GEOM_SHAPE" ) ); mySelectWdgt->GroupBox1->setTitle( tr( "GEOM_SHAPE" ) );
mySelectWdgt->TextLabel1->setText( tr( "GEOM_SELECTED_OBJECTS" ) ); mySelectWdgt->TextLabel1->setText( tr( "GEOM_SELECTED_OBJECTS" ) );
mySelectWdgt->PushButton1->setPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")) ); mySelectWdgt->PushButton1->setIcon( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
mySelectWdgt->LineEdit1->setReadOnly( true ); mySelectWdgt->LineEdit1->setReadOnly( true );
Layout1->addWidget( mySelectWdgt, 0, 0 );
// layout the two group boxes in the middle, add a list of operations // layout the two group boxes in the middle, add a list of operations
QFrame* aMidFrame = new QFrame( this ); QGroupBox* anOperGr = new QGroupBox( tr( "GEOM_OPERATIONS" ), centralWidget() );
QGridLayout* aMidLay = new QGridLayout( aMidFrame, 1, 3, 0, 5 );
QGroupBox* anOperGr = new QGroupBox( tr("GEOM_OPERATIONS"), aMidFrame );
QVBoxLayout* aOperLay = new QVBoxLayout( anOperGr, 0, 0 );
myOpList = new QListView( anOperGr ); // operations list widget
myOpList->setSorting( -1 ); myOpList = new QListWidget( anOperGr );
myOpList->addColumn( "Operations" ); myOpList->setSortingEnabled( false );
myOpList->header()->hide(); myOpList->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) );
QVBoxLayout* aOperLay = new QVBoxLayout( anOperGr );
aOperLay->setMargin( 9 );
aOperLay->addWidget( myOpList ); aOperLay->addWidget( myOpList );
QStringList::ConstIterator it = myOpLst.end();
do // iterating from end to begin so to keep the order of items in the listview.
new QCheckListItem ( myOpList, *(--it), QCheckListItem::CheckBox );
while ( it != myOpLst.begin() );
QGroupBox* aParamsGr = new QGroupBox( tr("GEOM_PARAMETERS"), aMidFrame ); QGroupBox* aParamsGr = new QGroupBox( tr( "GEOM_PARAMETERS" ), centralWidget() );
aMidLay->addWidget( anOperGr, 0, 0 );
aMidLay->addMultiCellWidget( aParamsGr, 0, 0, 1, 3 );
aMidLay->setColStretch( 0, 1 );
aMidLay->setColStretch( 1, 2 );
Layout1->addWidget( aMidFrame, 2, 0 );
Layout1->setRowStretch( 0, 0 );
Layout1->setRowStretch( 1, 1 );
// add a widget stack to the parameters group box // add a widget stack to the parameters group box
myStack = new QWidgetStack( aParamsGr ); QStackedLayout* aStack = new QStackedLayout( aParamsGr );
QVBoxLayout* aVParamsLay = new QVBoxLayout( aParamsGr );
aVParamsLay->addWidget( myStack );
// continueties values.. // continueties values..
QStringList aContinueties = QStringList::split( ",", "C0,G1,C1,G2,C2,C3,CN" ); QStringList aContinueties = QString( "C0,G1,C1,G2,C2,C3,CN" ).split( "," );
// fill in the widgets
for ( int i = 0; i < myOpLst.count(); i++ ) {
QListWidgetItem* item = new QListWidgetItem( myOpLst[i] );
item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable );
item->setCheckState( Qt::Unchecked );
myOpList->addItem( item );
QWidget* w;
if ( myOpLst[i] == "FixShape" ) {
// FixShape // FixShape
QFrame* aFrame = new QFrame( myStack ); w = new QWidget( aParamsGr );
QGridLayout* aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
myFixShapeTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); myFixShapeTol3D = new QDoubleSpinBox( w );
myFixShapeTol3D->setPrecision( 10 ); initSpinBox( myFixShapeTol3D, 0, 100, 1e-7, 10 );
myFixShapeMaxTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); myFixShapeMaxTol3D = new QDoubleSpinBox( w );
myFixShapeMaxTol3D->setPrecision( 10 ); initSpinBox( myFixShapeMaxTol3D, 0, 100, 1e-7, 10 );
aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 );
aLay->addWidget( myFixShapeTol3D, 0, 1 ); aLay->addWidget( myFixShapeTol3D, 0, 1 );
aLay->addWidget( new QLabel( tr("GEOM_MAX_3D_TOLERANCE"), aFrame ), 1, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_MAX_3D_TOLERANCE" ), w ), 1, 0 );
aLay->addWidget( myFixShapeMaxTol3D, 1, 1 ); aLay->addWidget( myFixShapeMaxTol3D, 1, 1 );
aLay->setRowStretch( 9, 2 ); aLay->setRowStretch( aLay->rowCount(), 5 );
}
myStack->addWidget( aFrame, myOpLst.findIndex( "FixShape" ) ); else if ( myOpLst[i] == "FixFaceSize" ) {
// FixFaceSize // FixFaceSize
aFrame = new QFrame( myStack ); w = new QWidget( aParamsGr );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
myFixFaceSizeTol = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); myFixFaceSizeTol = new QDoubleSpinBox( w );
myFixFaceSizeTol->setPrecision( 10 ); initSpinBox( myFixFaceSizeTol, 0, 100, 1e-7, 10 );
aLay->addWidget( new QLabel( tr("GEOM_TOLERANCE"), aFrame ), 0, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_TOLERANCE" ), w ), 0, 0 );
aLay->addWidget( myFixFaceSizeTol, 0, 1 ); aLay->addWidget( myFixFaceSizeTol, 0, 1 );
aLay->setRowStretch( 9, 2 ); aLay->setRowStretch( aLay->rowCount(), 5 );
}
myStack->addWidget( aFrame, myOpLst.findIndex( "FixFaceSize" ) ); else if ( myOpLst[i] == "DropSmallEdges" ) {
// DropSmallEdges // DropSmallEdges
aFrame = new QFrame( myStack ); w = new QWidget( aParamsGr );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
myDropSmallEdgesTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); myDropSmallEdgesTol3D = new QDoubleSpinBox( w );
myDropSmallEdgesTol3D->setPrecision( 10 ); initSpinBox( myDropSmallEdgesTol3D, 0, 100, 1e-7, 10 );
aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 );
aLay->addWidget( myDropSmallEdgesTol3D, 0, 1 ); aLay->addWidget( myDropSmallEdgesTol3D, 0, 1 );
aLay->setRowStretch( 9, 2 ); aLay->setRowStretch( aLay->rowCount(), 5 );
}
myStack->addWidget( aFrame, myOpLst.findIndex( "DropSmallEdges" ) ); else if ( myOpLst[i] == "SplitAngle" ) {
// SplitAngle // SplitAngle
aFrame = new QFrame( myStack ); w = new QWidget( aParamsGr );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
mySplitAngleAngle = new QtxDblSpinBox( 0, 360, 1, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 360, 1 ); mySplitAngleAngle = new QDoubleSpinBox( w );
mySplitAngleMaxTol = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); initSpinBox( mySplitAngleAngle, 0, 360, 1 );
mySplitAngleMaxTol->setPrecision( 10 ); mySplitAngleMaxTol = new QDoubleSpinBox( w );
initSpinBox( mySplitAngleMaxTol, 0, 100, 1e-7, 10 );
aLay->addWidget( new QLabel( tr("GEOM_ANGLE_1"), aFrame ), 0, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_ANGLE_1" ), w ), 0, 0 );
aLay->addWidget( mySplitAngleAngle, 0, 1 ); aLay->addWidget( mySplitAngleAngle, 0, 1 );
aLay->addWidget( new QLabel( tr("GEOM_MAX_TOLERANCE"), aFrame ), 1, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_MAX_TOLERANCE" ), w ), 1, 0 );
aLay->addWidget( mySplitAngleMaxTol, 1, 1 ); aLay->addWidget( mySplitAngleMaxTol, 1, 1 );
aLay->setRowStretch( 9, 2 ); aLay->setRowStretch( aLay->rowCount(), 5 );
}
myStack->addWidget( aFrame, myOpLst.findIndex( "SplitAngle" ) ); else if ( myOpLst[i] == "SplitClosedFaces" ) {
// SplitClosedFaces // SplitClosedFaces
aFrame = new QFrame( myStack ); w = new QWidget( aParamsGr );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
mySplitClosedFacesNum = new QSpinBox( aFrame ); mySplitClosedFacesNum = new QSpinBox( w );
aLay->addWidget( new QLabel( tr("GEOM_NUM_SPLIT_POINTS"), aFrame ), 0, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_NUM_SPLIT_POINTS" ), w ), 0, 0 );
aLay->addWidget( mySplitClosedFacesNum, 0, 1 ); aLay->addWidget( mySplitClosedFacesNum, 0, 1 );
aLay->setRowStretch( 9, 2 ); aLay->setRowStretch( aLay->rowCount(), 5 );
}
myStack->addWidget( aFrame, myOpLst.findIndex( "SplitClosedFaces" ) ); else if ( myOpLst[i] == "SplitContinuity" ) {
// SplitContinuity // SplitContinuity
aFrame = new QFrame( myStack ); w = new QWidget( aParamsGr );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
mySplitContTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); mySplitContTol3D = new QDoubleSpinBox( w );
mySplitContTol3D->setPrecision( 10 ); initSpinBox( mySplitContTol3D, 0, 100, 1e-7, 10 );
mySplitContSurfCont = new QComboBox( aFrame ); mySplitContSurfCont = new QComboBox( w );
mySplitContSurfCont->insertStringList( aContinueties ); mySplitContSurfCont->addItems( aContinueties );
mySplitContCurvCont = new QComboBox( aFrame ); mySplitContCurvCont = new QComboBox( w );
mySplitContCurvCont->insertStringList( aContinueties ); mySplitContCurvCont->addItems( aContinueties );
aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 );
aLay->addWidget( mySplitContTol3D, 0, 1 ); aLay->addWidget( mySplitContTol3D, 0, 1 );
aLay->addWidget( new QLabel( tr("GEOM_SURFACE_CONTINUTY"), aFrame ), 1, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_SURFACE_CONTINUTY" ), w ), 1, 0 );
aLay->addWidget( mySplitContSurfCont, 1, 1 ); aLay->addWidget( mySplitContSurfCont, 1, 1 );
aLay->addWidget( new QLabel( tr("GEOM_CURVE_CONTINUTY"), aFrame ), 2, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_CURVE_CONTINUTY" ), w ), 2, 0 );
aLay->addWidget( mySplitContCurvCont, 2, 1 ); aLay->addWidget( mySplitContCurvCont, 2, 1 );
aLay->setRowStretch( 9, 2 ); aLay->setRowStretch( aLay->rowCount(), 5 );
}
myStack->addWidget( aFrame, myOpLst.findIndex( "SplitContinuity" ) ); else if ( myOpLst[i] == "BSplineRestriction" ) {
// BSplineRestriction // BSplineRestriction
aFrame = new QFrame( myStack ); w = new QWidget( aParamsGr );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
myBSplineSurfModeChk = new QCheckBox( tr("GEOM_SURFACE_MODE"), aFrame ); myBSplineSurfModeChk = new QCheckBox( tr("GEOM_SURFACE_MODE"), w );
myBSpline3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), aFrame ); myBSpline3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), w );
myBSpline2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), aFrame ); myBSpline2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), w );
myBSplineTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); myBSplineTol3D = new QDoubleSpinBox( w );
myBSplineTol3D->setPrecision( 10 ); initSpinBox( myBSplineTol3D, 0, 100, 1e-7, 10 );
myBSplineTol2D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); myBSplineTol2D = new QDoubleSpinBox( w );
myBSplineTol2D->setPrecision( 10 ); initSpinBox( myBSplineTol2D, 0, 100, 1e-7, 10 );
myBSplineDegree = new QSpinBox( aFrame ); myBSplineDegree = new QSpinBox( w );
myBSplineSegments = new QSpinBox( aFrame ); myBSplineSegments = new QSpinBox( w );
myBSpline2DCont = new QComboBox( aFrame ); myBSpline2DCont = new QComboBox( w );
myBSpline2DCont->insertStringList( aContinueties ); myBSpline2DCont->addItems( aContinueties );
myBSpline3DCont = new QComboBox( aFrame ); myBSpline3DCont = new QComboBox( w );
myBSpline3DCont->insertStringList( aContinueties ); myBSpline3DCont->addItems( aContinueties );
myBSplineSurfModeChk->setChecked( true ); myBSplineSurfModeChk->setChecked( true );
myBSpline3DCurveChk->setChecked( true ); myBSpline3DCurveChk->setChecked( true );
@ -247,91 +240,87 @@ void RepairGUI_ShapeProcessDlg::init()
aLay->addWidget( myBSplineSurfModeChk, 0, 0 ); aLay->addWidget( myBSplineSurfModeChk, 0, 0 );
aLay->addWidget( myBSpline3DCurveChk, 1, 0 ); aLay->addWidget( myBSpline3DCurveChk, 1, 0 );
aLay->addWidget( myBSpline2DCurveChk, 2, 0 ); aLay->addWidget( myBSpline2DCurveChk, 2, 0 );
aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame), 3, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 3, 0 );
aLay->addWidget( myBSplineTol3D, 3, 1 ); aLay->addWidget( myBSplineTol3D, 3, 1 );
aLay->addWidget( new QLabel( tr("GEOM_2D_TOLERANCE"), aFrame), 4, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_2D_TOLERANCE" ), w ), 4, 0 );
aLay->addWidget( myBSplineTol2D, 4, 1 ); aLay->addWidget( myBSplineTol2D, 4, 1 );
aLay->addWidget( new QLabel( tr("GEOM_REQUIRED_DEGREE"), aFrame), 5, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_REQUIRED_DEGREE" ), w ), 5, 0 );
aLay->addWidget( myBSplineDegree, 5, 1 ); aLay->addWidget( myBSplineDegree, 5, 1 );
aLay->addWidget( new QLabel( tr("GEOM_REQUIRED_NUM_SEGMENTS"), aFrame), 6, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_REQUIRED_NUM_SEGMENTS" ), w ), 6, 0 );
aLay->addWidget( myBSplineSegments, 6, 1 ); aLay->addWidget( myBSplineSegments, 6, 1 );
aLay->addWidget( new QLabel( tr("GEOM_3D_CONTINUTY"), aFrame), 7, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_3D_CONTINUTY" ), w ), 7, 0 );
aLay->addWidget( myBSpline3DCont, 7, 1 ); aLay->addWidget( myBSpline3DCont, 7, 1 );
aLay->addWidget( new QLabel( tr("GEOM_2D_CONTINUTY"), aFrame), 8, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_2D_CONTINUTY" ), w ), 8, 0 );
aLay->addWidget( myBSpline2DCont, 8, 1 ); aLay->addWidget( myBSpline2DCont, 8, 1 );
aLay->setRowStretch( 9, 2 ); aLay->setRowStretch( aLay->rowCount(), 5 );
}
myStack->addWidget( aFrame, myOpLst.findIndex( "BSplineRestriction" ) ); else if ( myOpLst[i] == "ToBezier" ) {
// ToBezier // ToBezier
aFrame = new QFrame( myStack ); w = new QWidget( aParamsGr );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
myToBezierSurfModeChk = new QCheckBox( tr("GEOM_SURFACE_MODE"), aFrame ); myToBezierSurfModeChk = new QCheckBox( tr("GEOM_SURFACE_MODE"), w );
myToBezier3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), aFrame ); myToBezier3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), w );
myToBezier2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), aFrame ); myToBezier2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), w );
myToBezierMaxTol = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); myToBezierMaxTol = new QDoubleSpinBox( w );
myToBezierMaxTol->setPrecision( 10 ); initSpinBox( myToBezierMaxTol, 0, 100, 1e-7, 10 );
aLay->addWidget( myToBezierSurfModeChk, 0, 0 ); aLay->addWidget( myToBezierSurfModeChk, 0, 0 );
aLay->addWidget( myToBezier3DCurveChk, 1, 0 ); aLay->addWidget( myToBezier3DCurveChk, 1, 0 );
aLay->addWidget( myToBezier2DCurveChk, 2, 0 ); aLay->addWidget( myToBezier2DCurveChk, 2, 0 );
aLay->addWidget( new QLabel( tr("GEOM_MAX_TOLERANCE"), aFrame), 3, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_MAX_TOLERANCE" ), w ), 3, 0 );
aLay->addWidget( myToBezierMaxTol, 3, 1 ); aLay->addWidget( myToBezierMaxTol, 3, 1 );
aLay->setRowStretch( 9, 2 ); aLay->setRowStretch( aLay->rowCount(), 5 );
}
myStack->addWidget( aFrame, myOpLst.findIndex( "ToBezier" ) ); else if ( myOpLst[i] == "SameParameter" ) {
// SameParameter // SameParameter
aFrame = new QFrame( myStack ); w = new QWidget( aParamsGr );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
mySameParameterTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); mySameParameterTol3D = new QDoubleSpinBox( w );
mySameParameterTol3D->setPrecision( 10 ); initSpinBox( mySameParameterTol3D, 0, 100, 1e-7, 10 );
aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 ); aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 );
aLay->addWidget( mySameParameterTol3D, 0, 1 ); aLay->addWidget( mySameParameterTol3D, 0, 1 );
aLay->setRowStretch( 9, 2 ); aLay->setRowStretch( aLay->rowCount(), 5 );
}
else {
w = new QWidget( aParamsGr ); // dumb widget
}
aStack->insertWidget( i, w );
}
myStack->addWidget( aFrame, myOpLst.findIndex( "SameParameter" ) ); QGridLayout* layout = new QGridLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( mySelectWdgt, 0, 0, 1, 2 );
layout->addWidget( anOperGr, 1, 0 );
layout->addWidget( aParamsGr, 1, 1 );
// signals and slots connections // signals and slots connections
connect( buttonOk, SIGNAL(clicked()), this, SLOT(onOk()) ); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( onOk() ) );
connect( buttonApply, SIGNAL(clicked()), this, SLOT(onApply()) ); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( onApply() ) );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ) );
connect( myOpList, SIGNAL(selectionChanged()), this, SLOT(operationChanged()) );
connect( mySelectWdgt->PushButton1, SIGNAL( clicked() ), this, SLOT( selectClicked() ) ); connect( mySelectWdgt->PushButton1, SIGNAL( clicked() ), this, SLOT( selectClicked() ) );
connect( mySelectWdgt->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( lineEditReturnPressed() ) ); connect( mySelectWdgt->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( lineEditReturnPressed() ) );
connect( myToBezierSurfModeChk, SIGNAL(toggled(bool)), SLOT(advOptionToggled(bool)) ); connect( myToBezierSurfModeChk, SIGNAL( toggled( bool ) ), this, SLOT( advOptionToggled( bool ) ) );
connect( myOpList, SIGNAL( currentRowChanged( int ) ), aStack, SLOT( setCurrentIndex( int ) ) );
adjustSize(); adjustSize();
loadDefaults(); // init dialog fields with values from resource file loadDefaults(); // init dialog fields with values from resource file
myOpList->setSelected( myOpList->findItem( "FixShape", 0 ), true ); //myOpList->setCurrentRow( myOpList->findItem( 0 );
reset(); reset();
initName( tr( "PROCESS_SHAPE_NEW_OBJ_NAME" ) ); initName( tr( "PROCESS_SHAPE_NEW_OBJ_NAME" ) );
} }
//=================================================================================
// function : operationChanged()
// purpose :
//=================================================================================
void RepairGUI_ShapeProcessDlg::operationChanged()
{
QListViewItem* anItem = myOpList->selectedItem();
if ( anItem )
{
int id = myOpLst.findIndex( anItem->text(0) );
if ( id > -1 )
myStack->raiseWidget( id );
}
}
//================================================================================= //=================================================================================
// function : onOk() // function : onOk()
// purpose : Same than click on apply but close this dialog. // purpose : Same than click on apply but close this dialog.
@ -372,8 +361,7 @@ void RepairGUI_ShapeProcessDlg::selectionChanged()
Standard_Boolean aRes = Standard_False; Standard_Boolean aRes = Standard_False;
int i = 0; int i = 0;
myObjects->length( IObjectCount() ); myObjects->length( IObjectCount() );
for ( SALOME_ListIteratorOfListIO anIt( selectedIO() ); anIt.More(); anIt.Next() ) for ( SALOME_ListIteratorOfListIO anIt( selectedIO() ); anIt.More(); anIt.Next() ) {
{
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value(), aRes ); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value(), aRes );
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) if ( !CORBA::is_nil( aSelectedObject ) && aRes )
myObjects[i++] = aSelectedObject; myObjects[i++] = aSelectedObject;
@ -428,9 +416,9 @@ void RepairGUI_ShapeProcessDlg::activate()
// function : enterEvent() // function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it // purpose : Mouse enter onto the dialog to activate it
//================================================================================= //=================================================================================
void RepairGUI_ShapeProcessDlg::enterEvent(QEvent* e) void RepairGUI_ShapeProcessDlg::enterEvent( QEvent* )
{ {
if ( !GroupConstructors->isEnabled() ) if ( !mainFrame()->GroupBoxName->isEnabled() )
activate(); activate();
} }
@ -462,15 +450,13 @@ void RepairGUI_ShapeProcessDlg::reset()
// function : get_convert // function : get_convert
// purpose : conversion of angle values to radians (non-angle values are not converted) // purpose : conversion of angle values to radians (non-angle values are not converted)
//================================================================================= //=================================================================================
const char* get_convert( const char* theParam, const char* theValue ) const char* get_convert( const char* theParam, const QString& theValue )
{ {
if ( !strcmp( theParam, "SplitAngle.Angle" ) ) if ( !strcmp( theParam, "SplitAngle.Angle" ) ) {
{ double doubleValue = theValue.toDouble() * PI / 180;
double doubleValue = atof( theValue ) * PI / 180; return CORBA::string_dup( QString::number( doubleValue ).toLatin1().constData() );
TCollection_AsciiString str( doubleValue );
return CORBA::string_dup( str.ToCString() );
} }
return CORBA::string_dup( theValue ); return CORBA::string_dup( theValue.toLatin1().constData() );
} }
//================================================================================= //=================================================================================
@ -479,8 +465,7 @@ const char* get_convert( const char* theParam, const char* theValue )
//================================================================================= //=================================================================================
const char* set_convert( const char* theParam, const char* theValue ) const char* set_convert( const char* theParam, const char* theValue )
{ {
if ( !strcmp( theParam, "SplitAngle.Angle" ) ) if ( !strcmp( theParam, "SplitAngle.Angle" ) ) {
{
double doubleValue = atof( theValue ) * 180 / PI; double doubleValue = atof( theValue ) * 180 / PI;
TCollection_AsciiString str( doubleValue ); TCollection_AsciiString str( doubleValue );
return CORBA::string_dup( str.ToCString() ); return CORBA::string_dup( str.ToCString() );
@ -499,26 +484,25 @@ void RepairGUI_ShapeProcessDlg::loadDefaults()
anOp->GetShapeProcessParameters( anOperators, aParams, aValues ); anOp->GetShapeProcessParameters( anOperators, aParams, aValues );
// check the default items-operators // check the default items-operators
int i; for ( int i = 0; i < anOperators->length(); i++ ) {
for ( i = 0; i < anOperators->length(); i++ )
{
//MESSAGE("-->"<<(const char*)anOperators[i]); //MESSAGE("-->"<<(const char*)anOperators[i]);
QListViewItem* anItem = myOpList->findItem( (const char*)anOperators[i], 0 ); QList<QListWidgetItem*> items = myOpList->findItems ( (const char*)anOperators[i], Qt::MatchFixedString );
if ( anItem /*&& anItem->inherits( "QCheckListItem" )*/ ) if ( items.count() )
((QCheckListItem*) anItem)->setOn( true ); ( items[0] )->setCheckState( Qt::Checked );
} }
// Retrieve default parameters for ALL operators // Retrieve default parameters for ALL operators
for ( QListViewItemIterator it(myOpList); it.current(); ++it ) { for ( int i = 0; i < myOpList->count(); i++ ) {
CORBA::String_var anOperator = CORBA::string_dup( it.current()->text( 0 ).latin1() ); CORBA::String_var anOperator = CORBA::string_dup( myOpList->item( i )->text().toLatin1().constData() );
anOp->GetOperatorParameters( anOperator.in(), aParams, aValues ); anOp->GetOperatorParameters( anOperator.in(), aParams, aValues );
// set default values of parameters // set default values of parameters
if ( aParams->length() != aValues->length() ) if ( aParams->length() != aValues->length() )
continue; continue;
for ( i = 0; i < aParams->length(); i++ ) {
QWidget* aCtrl = getControl( (const char*)aParams[i] ); for ( int j = 0; j < aParams->length(); j++ ) {
const char* aValue = set_convert( (const char*)aParams[i], aValues[i] ); QWidget* aCtrl = getControl( (const char*)aParams[j] );
const char* aValue = set_convert( (const char*)aParams[j], aValues[j] );
setValue( aCtrl, aValue ); setValue( aCtrl, aValue );
} }
} }
@ -528,40 +512,37 @@ void RepairGUI_ShapeProcessDlg::loadDefaults()
// function : setValue() // function : setValue()
// purpose : set value in the proper way // purpose : set value in the proper way
//================================================================================= //=================================================================================
void RepairGUI_ShapeProcessDlg::setValue( QWidget* theControl, const char* theValue ) void RepairGUI_ShapeProcessDlg::setValue( QWidget* theControl, const QString& theValue )
{ {
if ( theControl == NULL || theValue == NULL ) if ( theControl && !theValue.isNull() ) {
return; if ( qobject_cast<QDoubleSpinBox*>( theControl ) )
qobject_cast<QDoubleSpinBox*>( theControl )->setValue( theValue.toDouble() );
if ( theControl->isA( "QtxDblSpinBox" ) ) else if ( qobject_cast<QSpinBox*>( theControl ) )
((QtxDblSpinBox*)theControl)->setValue( QString( theValue ).toDouble() ); qobject_cast<QSpinBox*>( theControl )->setValue( theValue.toInt() );
else if ( theControl->isA( "QSpinBox" ) ) else if ( qobject_cast<QComboBox*>( theControl ) )
((QSpinBox*)theControl)->setValue( QString( theValue ).toInt() ); qobject_cast<QComboBox*>( theControl )->setEditText( theValue );
else if ( theControl->isA( "QComboBox" ) ) else if ( qobject_cast<QCheckBox*>( theControl ) )
((QComboBox*)theControl)->setCurrentText( QString( theValue ) ); qobject_cast<QCheckBox*>( theControl )->setChecked( theValue.toInt() != 0 );
else if ( theControl->isA( "QCheckBox" ) ) }
((QCheckBox*)theControl)->setChecked( QString( theValue ).toInt() != 0 );
} }
//================================================================================= //=================================================================================
// function : getValue() // function : getValue()
// purpose : get value in the proper way // purpose : get value in the proper way
//================================================================================= //=================================================================================
const char* RepairGUI_ShapeProcessDlg::getValue( QWidget* theControl ) const QString RepairGUI_ShapeProcessDlg::getValue( QWidget* theControl ) const
{ {
if ( theControl == NULL ) if ( theControl ) {
return ""; if ( qobject_cast<QDoubleSpinBox*>( theControl ) )
return QString::number( qobject_cast<QDoubleSpinBox*>( theControl )->value() );
if ( theControl->isA( "QtxDblSpinBox" ) ) else if ( qobject_cast<QSpinBox*>( theControl ) )
return ((QtxDblSpinBox*)theControl)->text().latin1(); return QString::number( qobject_cast<QSpinBox*>( theControl )->value() );
else if ( theControl->isA( "QSpinBox" ) ) else if ( qobject_cast<QComboBox*>( theControl ) )
return ((QSpinBox*)theControl)->text().latin1(); return qobject_cast<QComboBox*>( theControl )->currentText();
else if ( theControl->isA( "QComboBox" ) ) else if ( qobject_cast<QCheckBox*>( theControl ) )
return ((QComboBox*)theControl)->currentText().latin1(); return qobject_cast<QCheckBox*>( theControl )->isChecked() ? "1" : "0";
else if ( theControl->isA( "QCheckBox" ) ) }
return ((QCheckBox*)theControl)->isChecked() ? "1" : "0"; return 0;
return "";
} }
//================================================================================= //=================================================================================
@ -581,13 +562,11 @@ bool RepairGUI_ShapeProcessDlg::isValid( QString& msg )
{ {
bool error = false; bool error = false;
GEOM::string_array_var anOperators = getActiveOperators(); GEOM::string_array_var anOperators = getActiveOperators();
if ( !myObjects->length() ) if ( !myObjects->length() ) {
{
msg += tr( "ERROR_NO_OBJECTS" ); msg += tr( "ERROR_NO_OBJECTS" );
error = true; error = true;
} }
if ( !anOperators->length() ) if ( !anOperators->length() ) {
{
if ( error ) if ( error )
msg += "\n"; msg += "\n";
msg += tr( "ERROR_NO_OPERATORS" ); msg += tr( "ERROR_NO_OPERATORS" );
@ -624,11 +603,10 @@ bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects )
*/// ----------- */// -----------
QStringList anErrorObjNames; QStringList anErrorObjNames;
for ( int i = 0; i < myObjects->length(); i++ ) for ( int i = 0; i < myObjects->length(); i++ ) {
{
GEOM::GEOM_Object_var obj = myObjects[i]; GEOM::GEOM_Object_var obj = myObjects[i];
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->ProcessShape( GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->
obj, anOperators, aParams, aValues ); ProcessShape( obj, anOperators, aParams, aValues );
if ( anObj->_is_nil() ) if ( anObj->_is_nil() )
anErrorObjNames << GEOMBase::GetName( obj ); anErrorObjNames << GEOMBase::GetName( obj );
else else
@ -636,7 +614,7 @@ bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects )
} }
if ( !anErrorObjNames.empty() ) if ( !anErrorObjNames.empty() )
MESSAGE("ERRORS occured while processing the following objects: " << anErrorObjNames.join( " " )); MESSAGE( "ERRORS occured while processing the following objects: " << anErrorObjNames.join( " " ).toLatin1().data() );
return anErrorObjNames.size() < myObjects->length(); // true if at least one object was OK, false if ALL objects were nil after Healing. return anErrorObjNames.size() < myObjects->length(); // true if at least one object was OK, false if ALL objects were nil after Healing.
} }
@ -649,14 +627,16 @@ GEOM::string_array* RepairGUI_ShapeProcessDlg::getActiveOperators()
{ {
GEOM::string_array_var anOperators = new GEOM::string_array(); GEOM::string_array_var anOperators = new GEOM::string_array();
QStringList aCheckedList; QStringList aCheckedList;
QStringList::Iterator it;
for ( it = myOpLst.begin(); it != myOpLst.end(); ++it ) for ( int i = 0; i < myOpList->count(); i++ ) {
if ( ((QCheckListItem*)myOpList->findItem( *it, 0 ))->isOn() ) if ( myOpList->item( i )->checkState() == Qt::Checked )
aCheckedList << *it; aCheckedList << myOpList->item( i )->text();
anOperators->length( aCheckedList.size() ); }
int i = 0;
for ( it = aCheckedList.begin(); it != aCheckedList.end(); ++it ) anOperators->length( aCheckedList.count() );
anOperators[i++] = CORBA::string_dup( (*it).latin1() );
for ( int i = 0; i < aCheckedList.count(); i++ )
anOperators[i] = CORBA::string_dup( aCheckedList[i].toLatin1().constData() );
return anOperators._retn(); return anOperators._retn();
} }
@ -665,34 +645,33 @@ GEOM::string_array* RepairGUI_ShapeProcessDlg::getActiveOperators()
// function : getcontrol // function : getcontrol
// purpose : // purpose :
//================================================================================= //=================================================================================
QWidget* RepairGUI_ShapeProcessDlg::getControl( const char* theParam ) QWidget* RepairGUI_ShapeProcessDlg::getControl( const QString& theParam )
{ {
string aParam = theParam; if ( theParam == "SplitAngle.Angle" ) return mySplitAngleAngle;
if ( aParam == "SplitAngle.Angle" ) return mySplitAngleAngle; else if ( theParam == "SplitAngle.MaxTolerance" ) return mySplitAngleMaxTol;
else if ( aParam == "SplitAngle.MaxTolerance" ) return mySplitAngleMaxTol; else if ( theParam == "SplitClosedFaces.NbSplitPoints" ) return mySplitClosedFacesNum;
else if ( aParam == "SplitClosedFaces.NbSplitPoints" ) return mySplitClosedFacesNum; else if ( theParam == "FixFaceSize.Tolerance" ) return myFixFaceSizeTol;
else if ( aParam == "FixFaceSize.Tolerance" ) return myFixFaceSizeTol; else if ( theParam == "DropSmallEdges.Tolerance3d" ) return myDropSmallEdgesTol3D;
else if ( aParam == "DropSmallEdges.Tolerance3d" ) return myDropSmallEdgesTol3D; else if ( theParam == "BSplineRestriction.SurfaceMode" ) return myBSplineSurfModeChk;
else if ( aParam == "BSplineRestriction.SurfaceMode" ) return myBSplineSurfModeChk; else if ( theParam == "BSplineRestriction.Curve3dMode" ) return myBSpline3DCurveChk;
else if ( aParam == "BSplineRestriction.Curve3dMode" ) return myBSpline3DCurveChk; else if ( theParam == "BSplineRestriction.Curve2dMode" ) return myBSpline2DCurveChk;
else if ( aParam == "BSplineRestriction.Curve2dMode" ) return myBSpline2DCurveChk; else if ( theParam == "BSplineRestriction.Tolerance3d" ) return myBSplineTol3D;
else if ( aParam == "BSplineRestriction.Tolerance3d" ) return myBSplineTol3D; else if ( theParam == "BSplineRestriction.Tolerance2d" ) return myBSplineTol2D;
else if ( aParam == "BSplineRestriction.Tolerance2d" ) return myBSplineTol2D; else if ( theParam == "BSplineRestriction.RequiredDegree" ) return myBSplineDegree;
else if ( aParam == "BSplineRestriction.RequiredDegree" ) return myBSplineDegree; else if ( theParam == "BSplineRestriction.RequiredNbSegments" ) return myBSplineSegments;
else if ( aParam == "BSplineRestriction.RequiredNbSegments" ) return myBSplineSegments; else if ( theParam == "BSplineRestriction.Continuity3d" ) return myBSpline3DCont;
else if ( aParam == "BSplineRestriction.Continuity3d" ) return myBSpline3DCont; else if ( theParam == "BSplineRestriction.Continuity2d" ) return myBSpline2DCont;
else if ( aParam == "BSplineRestriction.Continuity2d" ) return myBSpline2DCont; else if ( theParam == "SplitContinuity.Tolerance3d" ) return mySplitContTol3D;
else if ( aParam == "SplitContinuity.Tolerance3d" ) return mySplitContTol3D; else if ( theParam == "SplitContinuity.SurfaceContinuity" ) return mySplitContSurfCont;
else if ( aParam == "SplitContinuity.SurfaceContinuity" ) return mySplitContSurfCont; else if ( theParam == "SplitContinuity.CurveContinuity" ) return mySplitContCurvCont;
else if ( aParam == "SplitContinuity.CurveContinuity" ) return mySplitContCurvCont; else if ( theParam == "ToBezier.SurfaceMode" ) return myToBezierSurfModeChk;
else if ( aParam == "ToBezier.SurfaceMode" ) return myToBezierSurfModeChk; else if ( theParam == "ToBezier.Curve3dMode" ) return myToBezier3DCurveChk;
else if ( aParam == "ToBezier.Curve3dMode" ) return myToBezier3DCurveChk; else if ( theParam == "ToBezier.Curve2dMode" ) return myToBezier2DCurveChk;
else if ( aParam == "ToBezier.Curve2dMode" ) return myToBezier2DCurveChk; else if ( theParam == "ToBezier.MaxTolerance" ) return myToBezierMaxTol;
else if ( aParam == "ToBezier.MaxTolerance" ) return myToBezierMaxTol; else if ( theParam == "SameParameter.Tolerance3d" ) return mySameParameterTol3D;
else if ( aParam == "SameParameter.Tolerance3d" ) return mySameParameterTol3D; else if ( theParam == "FixShape.Tolerance3d" ) return myFixShapeTol3D;
else if ( aParam == "FixShape.Tolerance3d" ) return myFixShapeTol3D; else if ( theParam == "FixShape.MaxTolerance3d" ) return myFixShapeMaxTol3D;
else if ( aParam == "FixShape.MaxTolerance3d" ) return myFixShapeMaxTol3D; return 0;
return NULL;
} }
//================================================================================= //=================================================================================
@ -701,6 +680,9 @@ QWidget* RepairGUI_ShapeProcessDlg::getControl( const char* theParam )
//================================================================================= //=================================================================================
void RepairGUI_ShapeProcessDlg::initParamsValues() void RepairGUI_ShapeProcessDlg::initParamsValues()
{ {
if ( myOpLst.count() )
return; // already filled
myOpLst << "FixShape"; myOpLst << "FixShape";
myValMap["FixShape"] << "FixShape.Tolerance3d"; myValMap["FixShape"] << "FixShape.Tolerance3d";
myValMap["FixShape"] << "FixShape.MaxTolerance3d"; myValMap["FixShape"] << "FixShape.MaxTolerance3d";
@ -751,21 +733,20 @@ void RepairGUI_ShapeProcessDlg::initParamsValues()
GEOM::string_array* RepairGUI_ShapeProcessDlg::getParameters( const GEOM::string_array& theOperators ) GEOM::string_array* RepairGUI_ShapeProcessDlg::getParameters( const GEOM::string_array& theOperators )
{ {
GEOM::string_array_var aParams = new GEOM::string_array(); GEOM::string_array_var aParams = new GEOM::string_array();
int i( 0 ), j( 0 ); int i = 0, j = 0;
// calculate the length of parameters // calculate the length of parameters
for ( i = 0, j = 0; i < theOperators.length(); i++ ) for ( i = 0, j = 0; i < theOperators.length(); i++ )
j+= myValMap[QString((const char*)theOperators[i])].size(); j += myValMap[ QString( theOperators[i] ) ].size();
// set the new length of paremeters // set the new length of paremeters
aParams->length( j ); aParams->length( j );
// fill the parameters // fill the parameters
for ( i = 0, j = 0; i < theOperators.length(); i++ ) for ( i = 0, j = 0; i < theOperators.length(); i++ ) {
{ QStringList aValLst = myValMap[ QString( theOperators[i] ) ];
QStringList aValLst = myValMap[QString( (const char*)theOperators[i] )];
for ( QStringList::Iterator it = aValLst.begin(); it != aValLst.end(); ++it ) for ( QStringList::Iterator it = aValLst.begin(); it != aValLst.end(); ++it )
aParams[j++] = CORBA::string_dup( (*it).latin1() ); aParams[j++] = CORBA::string_dup( (*it).toLatin1().constData() );
} }
return aParams._retn(); return aParams._retn();
@ -781,8 +762,7 @@ GEOM::string_array* RepairGUI_ShapeProcessDlg::getValues( const GEOM::string_arr
GEOM::string_array_var aValues = new GEOM::string_array(); GEOM::string_array_var aValues = new GEOM::string_array();
aValues->length( theParams.length() ); aValues->length( theParams.length() );
for ( int i = 0; i < theParams.length(); i++ ) for ( int i = 0; i < theParams.length(); i++ ) {
{
QWidget* aCtrl = getControl( (const char*)theParams[i] ); QWidget* aCtrl = getControl( (const char*)theParams[i] );
if ( aCtrl ) if ( aCtrl )
aValues[i] = get_convert( (const char*)theParams[i], getValue( aCtrl ) ); aValues[i] = get_convert( (const char*)theParams[i], getValue( aCtrl ) );
@ -814,10 +794,10 @@ void RepairGUI_ShapeProcessDlg::initSelection()
//================================================================================= //=================================================================================
void RepairGUI_ShapeProcessDlg::advOptionToggled( bool on ) void RepairGUI_ShapeProcessDlg::advOptionToggled( bool on )
{ {
QButton* btn = (QButton*)sender(); QAbstractButton* btn = (QAbstractButton*)sender();
if ( on && btn->isToggleButton() && if ( on && btn->isCheckable() &&
QMessageBox::warning(myGeomGUI->getApp()->desktop(), SUIT_MessageBox::warning( this,
tr( "GEOM_WRN_WARNING" ), tr( "TIME_CONSUMING" ), tr( "GEOM_WRN_WARNING" ), tr( "TIME_CONSUMING" ),
QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) SUIT_MessageBox::Yes | SUIT_MessageBox::No ) == SUIT_MessageBox::No )
btn->toggle(); btn->toggle();
} }

View File

@ -19,28 +19,23 @@
// //
// 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 : RepairGUI_ShapeProcessDlg.h // File : RepairGUI_ShapeProcessDlg.h
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_ShapeProcess_H #ifndef REPAIRGUI_SHAPEPROCESSDLG_H
#define DIALOGBOX_ShapeProcess_H #define REPAIRGUI_SHAPEPROCESSDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
#include "DlgRef_1Sel_QTD.h"
#include "RepairGUI.h"
#include "QtxDblSpinBox.h"
#include <qspinbox.h> #include <QMap>
#include <qcombobox.h>
#include <qcheckbox.h> class DlgRef_1Sel;
#include <qlistview.h> class QSpinBox;
#include <qwidgetstack.h> class QDoubleSpinBox;
#include <qvaluelist.h> class QComboBox;
#include <qdict.h> class QCheckBox;
#include <qmap.h> class QListWidget;
//================================================================================= //=================================================================================
// class : RepairGUI_ShapeProcessDlg // class : RepairGUI_ShapeProcessDlg
@ -51,17 +46,16 @@ class RepairGUI_ShapeProcessDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
RepairGUI_ShapeProcessDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, RepairGUI_ShapeProcessDlg( GeometryGUI*, QWidget* = 0, bool = false );
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_ShapeProcessDlg(); ~RepairGUI_ShapeProcessDlg();
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();
@ -69,49 +63,50 @@ private:
void loadDefaults(); // initialize all controls with default values (from resource file) void loadDefaults(); // initialize all controls with default values (from resource file)
GEOM::string_array* getActiveOperators(); GEOM::string_array* getActiveOperators();
GEOM::string_array* getParameters( const GEOM::string_array& theOperators ); GEOM::string_array* getParameters( const GEOM::string_array& );
GEOM::string_array* getValues( const GEOM::string_array& theParameters ); GEOM::string_array* getValues( const GEOM::string_array& );
void enterEvent(QEvent* e); void enterEvent( QEvent* );
QWidget* getControl( const char* ); QWidget* getControl( const QString& );
void setValue( QWidget*, const char* ); // initialize the given control in the proper way void setValue( QWidget*, const QString& ); // initialize the given control in the proper way
// (analize its class and convert the value string) // (analize its class and convert the value string)
const char* getValue( QWidget* theControl ) const; // retrieve value of the control in the proper way QString getValue( QWidget* ) const; // retrieve value of the control in the proper way
QStringList myOpLst; // list of available Shape Healing Operators
QMap<QString,QStringList> myValMap; // map of parameters of operators
//QDict<QString,QWidget*> myCtrlMap; // map of controls (values) of parameters //QDict<QString,QWidget*> myCtrlMap; // map of controls (values) of parameters
void initParamsValues(); // initialize the data structures void initParamsValues(); // initialize the data structures
void initSelection(); void initSelection();
private:
QStringList myOpLst; // list of available Shape Healing Operators
QMap<QString,QStringList> myValMap; // map of parameters of operators
GEOM::ListOfGO_var myObjects; // selected objects GEOM::ListOfGO_var myObjects; // selected objects
DlgRef_1Sel_QTD* mySelectWdgt; DlgRef_1Sel* mySelectWdgt;
QListView* myOpList; QListWidget* myOpList;
QWidgetStack* myStack;
QtxDblSpinBox* myFixShapeTol3D; QDoubleSpinBox* myFixShapeTol3D;
QtxDblSpinBox* myFixShapeMaxTol3D; QDoubleSpinBox* myFixShapeMaxTol3D;
QtxDblSpinBox* myFixFaceSizeTol; QDoubleSpinBox* myFixFaceSizeTol;
QtxDblSpinBox* myDropSmallEdgesTol3D; QDoubleSpinBox* myDropSmallEdgesTol3D;
QtxDblSpinBox* mySplitAngleAngle; QDoubleSpinBox* mySplitAngleAngle;
QtxDblSpinBox* mySplitAngleMaxTol; QDoubleSpinBox* mySplitAngleMaxTol;
QSpinBox* mySplitClosedFacesNum; QSpinBox* mySplitClosedFacesNum;
QtxDblSpinBox* mySplitContTol3D; QDoubleSpinBox* mySplitContTol3D;
QComboBox* mySplitContSurfCont; QComboBox* mySplitContSurfCont;
QComboBox* mySplitContCurvCont; QComboBox* mySplitContCurvCont;
QCheckBox* myBSplineSurfModeChk; QCheckBox* myBSplineSurfModeChk;
QCheckBox* myBSpline3DCurveChk; QCheckBox* myBSpline3DCurveChk;
QCheckBox* myBSpline2DCurveChk; QCheckBox* myBSpline2DCurveChk;
QtxDblSpinBox* myBSplineTol3D; QDoubleSpinBox* myBSplineTol3D;
QtxDblSpinBox* myBSplineTol2D; QDoubleSpinBox* myBSplineTol2D;
QSpinBox* myBSplineDegree; QSpinBox* myBSplineDegree;
QSpinBox* myBSplineSegments; QSpinBox* myBSplineSegments;
QComboBox* myBSpline2DCont; QComboBox* myBSpline2DCont;
@ -120,9 +115,9 @@ private:
QCheckBox* myToBezierSurfModeChk; QCheckBox* myToBezierSurfModeChk;
QCheckBox* myToBezier3DCurveChk; QCheckBox* myToBezier3DCurveChk;
QCheckBox* myToBezier2DCurveChk; QCheckBox* myToBezier2DCurveChk;
QtxDblSpinBox* myToBezierMaxTol; QDoubleSpinBox* myToBezierMaxTol;
QtxDblSpinBox* mySameParameterTol3D; QDoubleSpinBox* mySameParameterTol3D;
private slots: private slots:
void onOk(); void onOk();
@ -133,8 +128,7 @@ private slots:
void lineEditReturnPressed(); void lineEditReturnPressed();
void selectionChanged(); void selectionChanged();
void selectClicked(); void selectClicked();
void operationChanged();
void advOptionToggled( bool ); void advOptionToggled( bool );
}; };
#endif // DIALOGBOX_ShapeProcess_H #endif // REPAIRGUI_SHAPEPROCESSDLG_H

View File

@ -19,27 +19,28 @@
// //
// 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 : RepairGUI_SuppressFacesDlg.cxx // File : RepairGUI_SuppressFacesDlg.cxx
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "RepairGUI_SuppressFacesDlg.h" #include "RepairGUI_SuppressFacesDlg.h"
#include "SalomeApp_Application.h" #include <GEOM_DlgRef.h>
#include "LightApp_SelectionMgr.h" #include <GeometryGUI.h>
#include "SUIT_Session.h" #include <GEOMBase.h>
#include "SALOME_ListIteratorOfListIO.hxx"
#include "GEOMImpl_Types.hxx" #include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <GEOMImpl_Types.hxx>
#include <TopAbs.hxx> #include <TopAbs.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <qlabel.h> #include <utilities.h>
using namespace std;
//================================================================================= //=================================================================================
// class : RepairGUI_SuppressFacesDlg() // class : RepairGUI_SuppressFacesDlg()
@ -49,28 +50,31 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
RepairGUI_SuppressFacesDlg::RepairGUI_SuppressFacesDlg( GeometryGUI* theGeometryGUI, QWidget* parent, RepairGUI_SuppressFacesDlg::RepairGUI_SuppressFacesDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl) bool modal )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | : GEOMBase_Skeleton( theGeometryGUI, parent, modal )
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SUPRESS_FACE" ) ) ); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SUPRESS_FACE" ) ) );
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_SUPRESSFACE_TITLE")); setWindowTitle( tr("GEOM_SUPRESSFACE_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_SUPRESSFACE")); mainFrame()->GroupConstructors->setTitle(tr("GEOM_SUPRESSFACE"));
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();
GroupPoints = new DlgRef_1Sel_QTD(this, "GroupPoints"); GroupPoints = new DlgRef_1Sel( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "Faces to remove" ) ); GroupPoints->GroupBox1->setTitle( tr( "Faces to remove" ) );
GroupPoints->TextLabel1->setText( tr( "Faces" ) ); GroupPoints->TextLabel1->setText( tr( "Faces" ) );
GroupPoints->PushButton1->setPixmap(image1); GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly( true );
Layout1->addWidget(GroupPoints, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
/***************************************************************/ /***************************************************************/
setHelpFileName( "suppress_faces.htm" ); setHelpFileName( "suppress_faces.htm" );
@ -104,8 +108,8 @@ void RepairGUI_SuppressFacesDlg::Init()
initSelection(); initSelection();
/* 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->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
@ -162,24 +166,19 @@ void RepairGUI_SuppressFacesDlg::SelectionIntoArgument()
int numFaces = 0; int numFaces = 0;
myObjects->length( IObjectCount() ); myObjects->length( IObjectCount() );
myFaces.clear(); myFaces.clear();
for ( SALOME_ListIteratorOfListIO anIt( selectedIO() ); anIt.More(); anIt.Next() ) for ( SALOME_ListIteratorOfListIO anIt( selectedIO() ); anIt.More(); anIt.Next() ) {
{
Handle(SALOME_InteractiveObject) anIO = anIt.Value(); Handle(SALOME_InteractiveObject) anIO = anIt.Value();
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
{
TopoDS_Shape aShape; TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) ) if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) ) {
{ if ( aShape.ShapeType() <= TopAbs_FACE ) { // FACE, SHELL, SOLID, COMPOUND
if ( aShape.ShapeType() <= TopAbs_FACE ) // FACE, SHELL, SOLID, COMPOUND
{
GEOM::short_array anIndexes; GEOM::short_array anIndexes;
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
myGeomGUI->getApp()->selectionMgr()->GetIndexes( anIO, aMap ); myGeomGUI->getApp()->selectionMgr()->GetIndexes( anIO, aMap );
if ( !aMap.IsEmpty() ) if ( !aMap.IsEmpty() ) {
{
Convert( aMap, anIndexes ); Convert( aMap, anIndexes );
myObjects[i++] = aSelectedObject; // append the object myObjects[i++] = aSelectedObject; // append the object
myFaces.append( anIndexes ); // append faces' indexes myFaces.append( anIndexes ); // append faces' indexes
@ -212,8 +211,7 @@ void RepairGUI_SuppressFacesDlg::Convert( const TColStd_IndexedMapOfInteger& the
//================================================================================= //=================================================================================
void RepairGUI_SuppressFacesDlg::SetEditCurrentArgument() void RepairGUI_SuppressFacesDlg::SetEditCurrentArgument()
{ {
if( sender() == GroupPoints->PushButton1 ) if ( sender() == GroupPoints->PushButton1 ) {
{
GroupPoints->LineEdit1->setFocus(); GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
} }
@ -227,8 +225,7 @@ void RepairGUI_SuppressFacesDlg::SetEditCurrentArgument()
//================================================================================= //=================================================================================
void RepairGUI_SuppressFacesDlg::LineEditReturnPressed() void RepairGUI_SuppressFacesDlg::LineEditReturnPressed()
{ {
if( sender() == GroupPoints->LineEdit1 ) if ( sender() == GroupPoints->LineEdit1 ) {
{
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -254,9 +251,9 @@ void RepairGUI_SuppressFacesDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it // purpose : Mouse enter onto the dialog to activate it
//================================================================================= //=================================================================================
void RepairGUI_SuppressFacesDlg::enterEvent(QEvent* e) void RepairGUI_SuppressFacesDlg::enterEvent( QEvent* )
{ {
if ( !GroupConstructors->isEnabled() ) if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog(); ActivateThisDialog();
} }
@ -284,7 +281,7 @@ GEOM::GEOM_IOperations_ptr RepairGUI_SuppressFacesDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool RepairGUI_SuppressFacesDlg::isValid( QString& msg ) bool RepairGUI_SuppressFacesDlg::isValid( QString& )
{ {
const int objL = myObjects->length(), facesL = myFaces.size(); const int objL = myObjects->length(), facesL = myFaces.size();
return ( objL && objL == facesL ); return ( objL && objL == facesL );
@ -297,8 +294,7 @@ bool RepairGUI_SuppressFacesDlg::isValid( QString& msg )
bool RepairGUI_SuppressFacesDlg::execute( ObjectList& objects ) bool RepairGUI_SuppressFacesDlg::execute( ObjectList& objects )
{ {
QStringList anErrorObjNames; QStringList anErrorObjNames;
for ( int i = 0; i < myObjects->length(); i++ ) for ( int i = 0; i < myObjects->length(); i++ ) {
{
GEOM::GEOM_Object_var obj = myObjects[i]; GEOM::GEOM_Object_var obj = myObjects[i];
GEOM::short_array faces = myFaces[i]; GEOM::short_array faces = myFaces[i];
//MESSAGE(">>>> Dlg, passing faces.. len = " << faces.length()); //MESSAGE(">>>> Dlg, passing faces.. len = " << faces.length());
@ -310,7 +306,7 @@ bool RepairGUI_SuppressFacesDlg::execute( ObjectList& objects )
} }
if ( !anErrorObjNames.empty() ) if ( !anErrorObjNames.empty() )
MESSAGE("ERRORS occured while processing the following objects: " << anErrorObjNames.join( " " )); MESSAGE( "ERRORS occured while processing the following objects: " << anErrorObjNames.join( " " ).toLatin1().data() );
return anErrorObjNames.size() < myObjects->length(); // true if at least one object was OK, false if ALL objects were nil after Healing. return anErrorObjNames.size() < myObjects->length(); // true if at least one object was OK, false if ALL objects were nil after Healing.
} }

View File

@ -19,19 +19,19 @@
// //
// 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 : RepairGUI_SuppressFacesDlg.h // File : RepairGUI_SuppressFacesDlg.h
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_SUPPRESSFACES_H #ifndef REPAIRGUI_SUPPRESSFACESDLG_H
#define DIALOGBOX_SUPPRESSFACES_H #define REPAIRGUI_SUPPRESSFACESDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
#include "DlgRef_1Sel_QTD.h"
#include <TColStd_IndexedMapOfInteger.hxx> #include <QList>
class DlgRef_1Sel;
class TColStd_IndexedMapOfInteger;
//================================================================================= //=================================================================================
// class : RepairGUI_SuppressFacesDlg // class : RepairGUI_SuppressFacesDlg
@ -42,32 +42,33 @@ class RepairGUI_SuppressFacesDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
RepairGUI_SuppressFacesDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, RepairGUI_SuppressFacesDlg( GeometryGUI*, QWidget* = 0, bool = false );
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_SuppressFacesDlg(); ~RepairGUI_SuppressFacesDlg();
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* );
void closeEvent(QCloseEvent* e); void closeEvent( QCloseEvent* );
void Convert( const TColStd_IndexedMapOfInteger&,
GEOM::short_array& );
void initSelection();
private:
GEOM::ListOfGO_var myObjects; GEOM::ListOfGO_var myObjects;
QValueList<GEOM::short_array> myFaces; QList<GEOM::short_array> myFaces;
// GEOM::short_array-s contain indexes of selected faces, // GEOM::short_array-s contain indexes of selected faces,
// index of a GEOM::short_array in myFaces list equals to index of // index of a GEOM::short_array in myFaces list equals to index of
// GEOM::GEOM_Object in myObjects list to which the faces belong to. // GEOM::GEOM_Object in myObjects list to which the faces belong to.
void Convert( const TColStd_IndexedMapOfInteger&, GEOM::short_array& ); DlgRef_1Sel* GroupPoints;
void initSelection();
DlgRef_1Sel_QTD* GroupPoints;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
@ -80,4 +81,4 @@ private slots:
void SetEditCurrentArgument(); void SetEditCurrentArgument();
}; };
#endif // DIALOGBOX_SUPPRESSFACES_H #endif // REPAIRGUI_SUPPRESSFACESDLG_H