*** 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

@ -1,31 +1,28 @@
# GEOM REPAIRGUI : # GEOM REPAIRGUI :
# #
# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either # License as published by the Free Software Foundation; either
# version 2.1 of the License. # version 2.1 of the License.
# #
# This library is distributed in the hope that it will be useful, # This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details. # Lesser General Public License for more details.
# #
# You should have received a copy of the GNU Lesser General Public # You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software # License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
# File : Makefile.am
# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
# Package : 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
@ -35,34 +32,47 @@ salomeinclude_HEADERS =
# Libraries targets # Libraries targets
lib_LTLIBRARIES = libRepairGUI.la lib_LTLIBRARIES = libRepairGUI.la
dist_libRepairGUI_la_SOURCES = \ dist_libRepairGUI_la_SOURCES = \
RepairGUI.cxx \ RepairGUI.h \
RepairGUI_SewingDlg.cxx \ RepairGUI_SewingDlg.h \
RepairGUI_SuppressFacesDlg.cxx \ RepairGUI_SuppressFacesDlg.h \
RepairGUI_ShapeProcessDlg.cxx \ RepairGUI_ShapeProcessDlg.h \
RepairGUI_CloseContourDlg.cxx \ RepairGUI_CloseContourDlg.h \
RepairGUI_RemoveIntWiresDlg.cxx \ RepairGUI_RemoveIntWiresDlg.h \
RepairGUI_RemoveHolesDlg.cxx \ RepairGUI_RemoveHolesDlg.h \
RepairGUI_DivideEdgeDlg.cxx \ RepairGUI_DivideEdgeDlg.h \
RepairGUI_FreeBoundDlg.cxx \ RepairGUI_FreeBoundDlg.h \
RepairGUI_FreeFacesDlg.cxx \ RepairGUI_FreeFacesDlg.h \
RepairGUI_ChangeOrientationDlg.cxx \ RepairGUI_ChangeOrientationDlg.h \
RepairGUI_GlueDlg.h \
\
RepairGUI.cxx \
RepairGUI_SewingDlg.cxx \
RepairGUI_SuppressFacesDlg.cxx \
RepairGUI_ShapeProcessDlg.cxx \
RepairGUI_CloseContourDlg.cxx \
RepairGUI_RemoveIntWiresDlg.cxx \
RepairGUI_RemoveHolesDlg.cxx \
RepairGUI_DivideEdgeDlg.cxx \
RepairGUI_FreeBoundDlg.cxx \
RepairGUI_FreeFacesDlg.cxx \
RepairGUI_ChangeOrientationDlg.cxx \
RepairGUI_GlueDlg.cxx RepairGUI_GlueDlg.cxx
MOC_FILES = \ MOC_FILES = \
RepairGUI_SewingDlg_moc.cxx \ RepairGUI_SewingDlg_moc.cxx \
RepairGUI_SuppressFacesDlg_moc.cxx \ RepairGUI_SuppressFacesDlg_moc.cxx \
RepairGUI_ShapeProcessDlg_moc.cxx \ RepairGUI_ShapeProcessDlg_moc.cxx \
RepairGUI_CloseContourDlg_moc.cxx \ RepairGUI_CloseContourDlg_moc.cxx \
RepairGUI_RemoveIntWiresDlg_moc.cxx \ RepairGUI_RemoveIntWiresDlg_moc.cxx \
RepairGUI_RemoveHolesDlg_moc.cxx \ RepairGUI_RemoveHolesDlg_moc.cxx \
RepairGUI_DivideEdgeDlg_moc.cxx \ RepairGUI_DivideEdgeDlg_moc.cxx \
RepairGUI_FreeBoundDlg_moc.cxx \ RepairGUI_FreeBoundDlg_moc.cxx \
RepairGUI_FreeFacesDlg_moc.cxx \ RepairGUI_FreeFacesDlg_moc.cxx \
RepairGUI_ChangeOrientationDlg_moc.cxx \ RepairGUI_ChangeOrientationDlg_moc.cxx \
RepairGUI_GlueDlg_moc.cxx RepairGUI_GlueDlg_moc.cxx
nodist_libRepairGUI_la_SOURCES= \ nodist_libRepairGUI_la_SOURCES = \
$(MOC_FILES) $(MOC_FILES)
#LIB_CLIENT_IDL = SALOME_Exception.idl SALOME_GenericObj.idl SALOME_Component.idl #LIB_CLIENT_IDL = SALOME_Exception.idl SALOME_GenericObj.idl SALOME_Component.idl
@ -72,23 +82,24 @@ nodist_libRepairGUI_la_SOURCES= \
# additionnal information to compil and link file # additionnal information to compil and link file
libRepairGUI_la_CPPFLAGS = \ libRepairGUI_la_CPPFLAGS = \
$(QT_INCLUDES) \ $(QT_INCLUDES) \
$(VTK_INCLUDES) \ $(VTK_INCLUDES) \
$(CAS_CPPFLAGS) \ $(CAS_CPPFLAGS) \
$(PYTHON_INCLUDES) \ $(PYTHON_INCLUDES) \
$(BOOST_CPPFLAGS) \ $(BOOST_CPPFLAGS) \
$(KERNEL_CXXFLAGS) \ $(KERNEL_CXXFLAGS) \
$(GUI_CXXFLAGS) \ $(GUI_CXXFLAGS) \
$(CORBA_CXXFLAGS) \ $(CORBA_CXXFLAGS) \
$(CORBA_INCLUDES) \ $(CORBA_INCLUDES) \
-I$(srcdir)/../GEOMGUI \ -I$(srcdir)/../GEOMGUI \
-I$(srcdir)/../DlgRef \ -I$(srcdir)/../DlgRef \
-I$(srcdir)/../GEOMBase \ -I$(srcdir)/../GEOMBase \
-I$(srcdir)/../OBJECT \ -I$(srcdir)/../OBJECT \
-I$(srcdir)/../GEOMClient \ -I$(srcdir)/../GEOMClient \
-I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMImpl \
-I$(top_builddir)/idl \ -I$(top_builddir)/src/DlgRef \
-I$(top_builddir)/idl \
-I$(top_builddir)/salome_adm/unix -I$(top_builddir)/salome_adm/unix
libRepairGUI_la_LDFLAGS = \ libRepairGUI_la_LDFLAGS = \
../GEOMBase/libGEOMBase.la ../GEOMBase/libGEOMBase.la

View File

@ -1,37 +1,35 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI.cxx
// Author : Damien COQUERET, Open CASCADE S.A.S.
// //
//
// File : RepairGUI.cxx
// Author : Damien COQUERET
// 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 )
{ {
} }
@ -70,28 +65,28 @@ RepairGUI::~RepairGUI()
// function : OnGUIEvent() // function : OnGUIEvent()
// purpose : // purpose :
//======================================================================= //=======================================================================
bool RepairGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) bool RepairGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
{ {
SalomeApp_Application* app = getGeometryGUI()->getApp(); SalomeApp_Application* app = getGeometryGUI()->getApp();
if (!app) return false; if ( !app ) return false;
getGeometryGUI()->EmitSignalDeactivateDialog(); getGeometryGUI()->EmitSignalDeactivateDialog();
QDialog* aDlg = NULL; QDialog* aDlg = NULL;
switch (theCommandID) { switch ( theCommandID ) {
case 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;
} }
@ -108,7 +103,7 @@ bool RepairGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
extern "C" extern "C"
{ {
#ifdef WNT #ifdef WNT
__declspec( dllexport ) __declspec( dllexport )
#endif #endif
GEOMGUI* GetLibGUI( GeometryGUI* parent ) GEOMGUI* GetLibGUI( GeometryGUI* parent )
{ {

View File

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

@ -1,45 +1,43 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_ChangeOrientationDlg.cxx
// Author : Sergey KUUL, Open CASCADE S.A.S. (sergey.kuul@opencascade.com)
// //
//
// File : RepairGUI_ChangeOrientationDlg.cxx
// Author : Sergey KUUL
// 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',
@ -47,34 +45,37 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
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" );
Init(); Init();
} }
@ -98,21 +99,21 @@ void RepairGUI_ChangeOrientationDlg::Init()
/* init variables */ /* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->CheckButton1->setChecked(true); GroupPoints->CheckButton1->setChecked( true );
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() ) );
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) );
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() ) );
initName( tr( "CHANGE_ORIENTATION_NEW_OBJ_NAME" ) ); initName( tr( "CHANGE_ORIENTATION_NEW_OBJ_NAME" ) );
} }
@ -136,12 +137,12 @@ void RepairGUI_ChangeOrientationDlg::ClickOnOk()
bool RepairGUI_ChangeOrientationDlg::ClickOnApply() bool RepairGUI_ChangeOrientationDlg::ClickOnApply()
{ {
// if ( !onAccept() ) // if ( !onAccept() )
if ( !onAccept(GroupPoints->CheckButton1->isChecked()) ) if ( !onAccept( GroupPoints->CheckButton1->isChecked() ) )
return false; return false;
initName(); initName();
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText( "" );
return true; return true;
} }
@ -153,12 +154,12 @@ bool RepairGUI_ChangeOrientationDlg::ClickOnApply()
//================================================================================= //=================================================================================
void RepairGUI_ChangeOrientationDlg::SelectionIntoArgument() void RepairGUI_ChangeOrientationDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText( "" );
QString aName; QString aName;
if(myEditCurrentArgument == GroupPoints->LineEdit1) { if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
if (IObjectCount() != 1) { if ( IObjectCount() != 1 ) {
if (myEditCurrentArgument == GroupPoints->LineEdit1) if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
myOkObject = false; myOkObject = false;
return; return;
} }
@ -169,16 +170,15 @@ void RepairGUI_ChangeOrientationDlg::SelectionIntoArgument()
GEOM::GEOM_Object_ptr aSelectedObject = GEOM::GEOM_Object_ptr aSelectedObject =
GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
if (!testResult) if ( !testResult )
return; return;
if (myEditCurrentArgument == GroupPoints->LineEdit1) { if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
myObject = aSelectedObject; myObject = aSelectedObject;
myOkObject = true; myOkObject = true;
} }
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;
} }
@ -206,7 +205,7 @@ void RepairGUI_ChangeOrientationDlg::SetEditCurrentArgument()
void RepairGUI_ChangeOrientationDlg::LineEditReturnPressed() void RepairGUI_ChangeOrientationDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if( send == GroupPoints->LineEdit1 ) { if ( send == GroupPoints->LineEdit1 ) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -220,9 +219,8 @@ void RepairGUI_ChangeOrientationDlg::LineEditReturnPressed()
void RepairGUI_ChangeOrientationDlg::ActivateThisDialog() 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();
} }
@ -241,7 +239,7 @@ void RepairGUI_ChangeOrientationDlg::enterEvent(QEvent* e)
// function : closeEvent() // function : closeEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void RepairGUI_ChangeOrientationDlg::closeEvent(QCloseEvent* e) void RepairGUI_ChangeOrientationDlg::closeEvent( QCloseEvent* e )
{ {
//myGeomGUI->SetState( -1 ); //myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e ); GEOMBase_Skeleton::closeEvent( e );
@ -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;
} }
@ -277,11 +275,11 @@ bool RepairGUI_ChangeOrientationDlg::execute( ObjectList& objects )
bool toCreateCopy = GroupPoints->CheckButton1->isChecked(); bool toCreateCopy = GroupPoints->CheckButton1->isChecked();
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
if(toCreateCopy) { if ( toCreateCopy ) {
anObj = GEOM::GEOM_IHealingOperations::_narrow(getOperation())->ChangeOrientationCopy(myObject); anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->ChangeOrientationCopy( myObject );
} }
else { else {
anObj = GEOM::GEOM_IHealingOperations::_narrow(getOperation())->ChangeOrientation(myObject); anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->ChangeOrientation( myObject );
} }
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
@ -295,7 +293,7 @@ bool RepairGUI_ChangeOrientationDlg::execute( ObjectList& objects )
// function : CreateCopyModeChanged() // function : CreateCopyModeChanged()
// purpose : // purpose :
//================================================================================= //=================================================================================
void RepairGUI_ChangeOrientationDlg::CreateCopyModeChanged(bool isCreateCopy) void RepairGUI_ChangeOrientationDlg::CreateCopyModeChanged( bool isCreateCopy )
{ {
GroupBoxName->setEnabled(isCreateCopy); mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
} }

View File

@ -1,38 +1,34 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_ChangeOrientationDlg.h
// Author : Sergey KUUL, Open CASCADE S.A.S. (sergey.kuul@opencascade.com)
// //
//
// File : RepairGUI_ChangeOrientationDlg.h
// Author : Sergey KUUL
// 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
@ -40,38 +36,37 @@
//================================================================================= //=================================================================================
class RepairGUI_ChangeOrientationDlg : public GEOMBase_Skeleton 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* );
GEOM::GEOM_Object_var myObject; private:
bool myOkObject; GEOM::GEOM_Object_var myObject;
bool myOkObject;
DlgRef_1Sel1Check_QTD* GroupPoints;
DlgRef_1Sel1Check* GroupPoints;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void CreateCopyModeChanged(bool isCreateCopy); void CreateCopyModeChanged( bool );
}; };
#endif // DIALOGBOX_SUPPRESSFACES_H #endif // REPAIRGUI_CHANGEORIENTATIONDLG_H

View File

@ -1,48 +1,45 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_CloseContourDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : RepairGUI_CloseContourDlg.cxx
// Author : Lucien PIGNOLONI
// 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
@ -50,60 +47,53 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
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" );
Init(); Init();
} }
@ -135,16 +125,16 @@ 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->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(mySelectWiresBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(mySelectWiresEdt, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "CLOSE_CONTOUR_NEW_OBJ_NAME" ) ); initName( tr( "CLOSE_CONTOUR_NEW_OBJ_NAME" ) );
} }
@ -174,7 +164,7 @@ bool RepairGUI_CloseContourDlg::ClickOnApply()
initName(); initName();
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText( "" );
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
myWiresInd->length( 0 ); myWiresInd->length( 0 );
@ -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();
} }
@ -273,12 +257,12 @@ void RepairGUI_CloseContourDlg::LineEditReturnPressed()
void RepairGUI_CloseContourDlg::ActivateThisDialog() void RepairGUI_CloseContourDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
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();
} }
@ -302,7 +286,7 @@ void RepairGUI_CloseContourDlg::enterEvent(QEvent* e)
// function : closeEvent() // function : closeEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void RepairGUI_CloseContourDlg::closeEvent(QCloseEvent* e) void RepairGUI_CloseContourDlg::closeEvent( QCloseEvent* e )
{ {
//myGeomGUI->SetState( -1 ); //myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e ); GEOMBase_Skeleton::closeEvent( e );
@ -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

@ -1,40 +1,35 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_CloseContourDlg.h
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : RepairGUI_CloseContourDlg.h
// Author : Lucien PIGNOLONI
// 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
@ -42,45 +37,42 @@
//================================================================================= //=================================================================================
class RepairGUI_CloseContourDlg : public GEOMBase_Skeleton 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;
GEOM::GEOM_Object_var myObject; private:
GEOM::short_array_var myWiresInd; GEOM::GEOM_Object_var myObject;
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();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
}; };
#endif // DIALOGBOX_CloseContour_H #endif // REPAIRGUI_CLOSECONTOURDLG_H

View File

@ -1,45 +1,43 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_DivideEdgeDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : RepairGUI_DivideEdgeDlg.cxx
// Author : Lucien PIGNOLONI
// 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()
@ -48,49 +46,56 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
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" );
Init(); Init();
} }
@ -119,14 +124,14 @@ 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() ) );
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() ) );
initName( tr( "DEVIDE_EDGE_NEW_OBJECT_NAME" ) ); initName( tr( "DEVIDE_EDGE_NEW_OBJECT_NAME" ) );
} }
@ -154,7 +159,7 @@ bool RepairGUI_DivideEdgeDlg::ClickOnApply()
initName(); initName();
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText( "" );
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
myIndex = -1; myIndex = -1;
@ -171,24 +176,21 @@ bool RepairGUI_DivideEdgeDlg::ClickOnApply()
//================================================================================= //=================================================================================
void RepairGUI_DivideEdgeDlg::SelectionIntoArgument() void RepairGUI_DivideEdgeDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText( "" );
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();
} }
@ -255,8 +255,8 @@ void RepairGUI_DivideEdgeDlg::LineEditReturnPressed()
void RepairGUI_DivideEdgeDlg::ActivateThisDialog() void RepairGUI_DivideEdgeDlg::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() ) );
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
myIndex = -1; myIndex = -1;
@ -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();
} }
@ -279,7 +279,7 @@ void RepairGUI_DivideEdgeDlg::enterEvent(QEvent* e)
// function : closeEvent() // function : closeEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void RepairGUI_DivideEdgeDlg::closeEvent(QCloseEvent* e) void RepairGUI_DivideEdgeDlg::closeEvent( QCloseEvent* e )
{ {
//myGeomGUI->SetState( -1 ); //myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e ); GEOMBase_Skeleton::closeEvent( e );
@ -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

@ -1,41 +1,36 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_DivideEdgeDlg.h
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : RepairGUI_DivideEdgeDlg.h
// Author : Lucien PIGNOLONI
// 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
@ -43,43 +38,43 @@
//================================================================================= //=================================================================================
class RepairGUI_DivideEdgeDlg : public GEOMBase_Skeleton 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;
GEOM::GEOM_Object_var myObject; private:
int myIndex; GEOM::GEOM_Object_var myObject;
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();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
}; };
#endif // DIALOGBOX_DivideEdge_H #endif // REPAIRGUI_DIVIDEEDGEDLG_H

View File

@ -1,53 +1,56 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_FreeBoundDlg.cxx
// Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com)
// //
//
// File : RepairGUI_FreeBoundDlg.cxx
// Author : Sergey LITONIN
// 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 );
QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); setWindowTitle( tr( "CAPTION" ) );
QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, tr( "FREE_BOUND" ), this ); QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
QGroupBox* aSelGrp = new QGroupBox( 1, Qt::Vertical, aMainGrp ); QGroupBox* aMainGrp = new QGroupBox( tr( "FREE_BOUND" ), this );
aSelGrp->setInsideMargin( 0 );
aSelGrp->setFrameStyle( QFrame::NoFrame ); QLabel* lab = new QLabel( tr( "GEOM_OBJECT" ), aMainGrp );
new QLabel( tr( "GEOM_OBJECT" ), aSelGrp ); QPushButton* btn = new QPushButton( aMainGrp );
( new QPushButton( aSelGrp ) )->setPixmap( iconSelect ); btn->setIcon( iconSelect );
myEdit = new QLineEdit( aSelGrp ); myEdit = new QLineEdit( aMainGrp );
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 );
@ -100,7 +113,7 @@ RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg(GeometryGUI* theGUI, QWidget* the
myHelpFileName = "check_free_boundaries.htm"; myHelpFileName = "check_free_boundaries.htm";
connect( aCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ); connect( aCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) );
connect( aHelpBtn, SIGNAL( clicked() ), SLOT( onHelp() ) ); connect( aHelpBtn, SIGNAL( clicked() ), SLOT( onHelp() ) );
Init(); Init();
} }
@ -120,7 +133,7 @@ RepairGUI_FreeBoundDlg::~RepairGUI_FreeBoundDlg()
void RepairGUI_FreeBoundDlg::onClose() void RepairGUI_FreeBoundDlg::onClose()
{ {
globalSelection(); globalSelection();
disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 0, this, 0 );
myGeomGUI->SetActiveDialogBox( 0 ); myGeomGUI->SetActiveDialogBox( 0 );
reject(); reject();
erasePreview(); erasePreview();
@ -132,20 +145,21 @@ void RepairGUI_FreeBoundDlg::onClose()
//================================================================================= //=================================================================================
void RepairGUI_FreeBoundDlg::onHelp() void RepairGUI_FreeBoundDlg::onHelp()
{ {
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
if (app) if ( app )
app->onHelpContextModule(myGeomGUI ? app->moduleName(myGeomGUI->moduleName()) : QString(""), myHelpFileName); app->onHelpContextModule( myGeomGUI ? app->moduleName( myGeomGUI->moduleName() ) : QString(""), myHelpFileName );
else { else {
QString platform; QString platform;
#ifdef WIN32 #ifdef WIN32
platform = "winapplication"; platform = "winapplication";
#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 ) );
} }
} }
@ -155,9 +169,9 @@ void RepairGUI_FreeBoundDlg::onHelp()
//================================================================================= //=================================================================================
void RepairGUI_FreeBoundDlg::onDeactivate() void RepairGUI_FreeBoundDlg::onDeactivate()
{ {
setEnabled(false); setEnabled( false );
globalSelection(); globalSelection();
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
myGeomGUI->SetActiveDialogBox( 0 ); myGeomGUI->SetActiveDialogBox( 0 );
} }
@ -170,7 +184,7 @@ void RepairGUI_FreeBoundDlg::onActivate()
myGeomGUI->EmitSignalDeactivateDialog(); myGeomGUI->EmitSignalDeactivateDialog();
setEnabled( true ); setEnabled( true );
myGeomGUI->SetActiveDialogBox( this ); myGeomGUI->SetActiveDialogBox( this );
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) ); SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
activateSelection(); activateSelection();
onSelectionDone(); onSelectionDone();
@ -182,7 +196,7 @@ void RepairGUI_FreeBoundDlg::onActivate()
//================================================================================= //=================================================================================
void RepairGUI_FreeBoundDlg::onSelectionDone() void RepairGUI_FreeBoundDlg::onSelectionDone()
{ {
if( IObjectCount() != 1 ) if ( IObjectCount() != 1 )
return; return;
Standard_Boolean isOk = Standard_False; Standard_Boolean isOk = Standard_False;
@ -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 );
} }
@ -208,7 +221,7 @@ void RepairGUI_FreeBoundDlg::Init()
myObj = GEOM::GEOM_Object::_nil(); myObj = GEOM::GEOM_Object::_nil();
connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT ( onDeactivate() ) ); connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT ( onDeactivate() ) );
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) ); SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
activateSelection(); activateSelection();
@ -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,9 +326,8 @@ 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

@ -1,39 +1,36 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_FreeBoundDlg.h
// Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com)
// //
//
// File : RepairGUI_FreeBoundDlg.h
// Author : Sergey LITONIN
// 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;
//================================================================================= //=================================================================================
@ -43,11 +40,11 @@ class GeometryGUI;
class RepairGUI_FreeBoundDlg : public QDialog, class RepairGUI_FreeBoundDlg : public QDialog,
public GEOMBase_Helper public GEOMBase_Helper
{ {
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:
void onClose(); void onClose();
@ -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

@ -1,64 +1,63 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_FreeFacesDlg.cxx
// Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com)
// //
//
// File : RepairGUI_FreeFacesDlg.cxx
// Author : VKN
// 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
@ -66,59 +65,66 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
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")));
setCaption(tr("GEOM_FREE_FACES_TITLE")); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
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";
connect( aCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ); connect( aCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) );
connect( aHelpBtn, SIGNAL( clicked() ), SLOT( onHelp() ) ); connect( aHelpBtn, SIGNAL( clicked() ), SLOT( onHelp() ) );
connect( mySelBtn, SIGNAL( clicked() ), connect( mySelBtn, SIGNAL( clicked() ),
this, SLOT ( onSetEditCurrentArgument() ) ); this, SLOT ( onSetEditCurrentArgument() ) );
/***************************************************************/ /***************************************************************/
Init(); Init();
@ -141,7 +147,7 @@ RepairGUI_FreeFacesDlg::~RepairGUI_FreeFacesDlg()
void RepairGUI_FreeFacesDlg::onClose() void RepairGUI_FreeFacesDlg::onClose()
{ {
globalSelection(); globalSelection();
disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 0, this, 0 );
myGeomGUI->SetActiveDialogBox( 0 ); myGeomGUI->SetActiveDialogBox( 0 );
reject(); reject();
erasePreview(); erasePreview();
@ -153,20 +159,22 @@ void RepairGUI_FreeFacesDlg::onClose()
//================================================================================= //=================================================================================
void RepairGUI_FreeFacesDlg::onHelp() void RepairGUI_FreeFacesDlg::onHelp()
{ {
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
if (app) if ( app )
app->onHelpContextModule(myGeomGUI ? app->moduleName(myGeomGUI->moduleName()) : QString(""), myHelpFileName); app->onHelpContextModule( myGeomGUI ? app->moduleName( myGeomGUI->moduleName() ) : QString(""), myHelpFileName );
else { else {
QString platform; QString platform;
#ifdef WIN32 #ifdef WIN32
platform = "winapplication"; platform = "winapplication";
#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 ) );
} }
} }
@ -176,9 +184,9 @@ void RepairGUI_FreeFacesDlg::onHelp()
//================================================================================= //=================================================================================
void RepairGUI_FreeFacesDlg::onDeactivate() void RepairGUI_FreeFacesDlg::onDeactivate()
{ {
setEnabled(false); setEnabled( false );
globalSelection(); globalSelection();
disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 0, this, 0 );
myGeomGUI->SetActiveDialogBox( 0 ); myGeomGUI->SetActiveDialogBox( 0 );
} }
@ -191,8 +199,8 @@ void RepairGUI_FreeFacesDlg::onActivate()
myGeomGUI->EmitSignalDeactivateDialog(); myGeomGUI->EmitSignalDeactivateDialog();
setEnabled( true ); setEnabled( true );
myGeomGUI->SetActiveDialogBox( this ); myGeomGUI->SetActiveDialogBox( this );
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), SLOT ( onSelectionDone() ) ); SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
activateSelection(); activateSelection();
} }
@ -206,7 +214,7 @@ void RepairGUI_FreeFacesDlg::Init()
/* signals and slots connections */ /* signals and slots connections */
connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT ( onDeactivate() ) ); connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT ( onDeactivate() ) );
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), SLOT ( onSelectionDone() ) ); SIGNAL( currentSelectionChanged() ), SLOT ( onSelectionDone() ) );
activateSelection(); activateSelection();
@ -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,9 +369,8 @@ 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

@ -1,35 +1,33 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_FreeFacesDlg.h
// Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com)
// //
//
// File : RepairGUI_FreeFacesDlg.h
// Author : VKN
// 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;
@ -43,42 +41,41 @@ class GeometryGUI;
class RepairGUI_FreeFacesDlg : public QDialog, class RepairGUI_FreeFacesDlg : public QDialog,
public GEOMBase_Helper public GEOMBase_Helper
{ {
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();
private slots: private slots:
void onClose(); void onClose();
void onHelp(); void onHelp();
void onDeactivate(); void onDeactivate();
void onActivate(); void onActivate();
void onSelectionDone(); void onSelectionDone();
void onSetEditCurrentArgument(); void onSetEditCurrentArgument();
private: private:
GEOM_Displayer* myDisplayer; GEOM_Displayer* myDisplayer;
GEOM::GEOM_Object_var myObj; GEOM::GEOM_Object_var myObj;
QPushButton* mySelBtn; QPushButton* mySelBtn;
QLineEdit* myEdit; QLineEdit* myEdit;
GeometryGUI* myGeomGUI; GeometryGUI* myGeomGUI;
QString myHelpFileName; QString myHelpFileName;
}; };
#endif // DIALOGBOX_FreeFaces_H #endif // REPAIRGUI_FREEFACESDLG_H

View File

@ -1,59 +1,52 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_GlueDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : RepairGUI_GlueDlg.cxx
// Author : Lucien PIGNOLONI
// 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
//================================================================================= //=================================================================================
@ -63,75 +56,76 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
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" );
// 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,26 +155,27 @@ 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(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(GroupPoints2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPoints2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( myTolEdt2, SIGNAL( valueChanged( double ) ), this, SLOT( onTolerChanged( double ) ) ); connect( myTolEdt2, SIGNAL( valueChanged( double ) ), this, SLOT( onTolerChanged( double ) ) );
connect( mySubShapesChk, SIGNAL( stateChanged( int ) ), this, SLOT( onSubShapesChk() ) ); connect( mySubShapesChk, SIGNAL( stateChanged( int ) ), this, SLOT( onSubShapesChk() ) );
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(myDetectBtn, SIGNAL(clicked()), this, SLOT(onDetect())); connect( myDetectBtn, SIGNAL( clicked() ), this, SLOT( onDetect() ) );
initName( tr( "GLUE_NEW_OBJ_NAME" ) ); initName( tr( "GLUE_NEW_OBJ_NAME" ) );
ConstructorsClicked(0); ConstructorsClicked( 0 );
activateSelection(); activateSelection();
updateButtonState(); updateButtonState();
@ -196,57 +191,47 @@ void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
if ( myCurrConstrId == constructorId ) if ( myCurrConstrId == constructorId )
return; return;
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();
{ GroupPoints->show();
GroupPoints2->hide(); GroupPoints->LineEdit1->setText( "" );
resize( 0, 0 ); myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->show();
GroupPoints->LineEdit1->setText( "" );
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;
}
case 1:
{
GroupPoints->hide();
resize(0, 0);
GroupPoints2->show();
GroupPoints->LineEdit1->setText("");
myEditCurrentArgument = GroupPoints2->LineEdit1;
if ( myCurrConstrId >= 0 ) // i.e. it is not initialisation
{
// copy tolerance from previous tolerance field
myTolEdt2->setValue( myTolEdt->value() );
mySubShapesChk->setChecked( false );
clearTemporary();
}
break;
}
} }
break;
case 1:
GroupPoints->hide();
GroupPoints2->show();
GroupPoints->LineEdit1->setText( "" );
myEditCurrentArgument = GroupPoints2->LineEdit1;
myCurrConstrId = constructorId; if ( myCurrConstrId >= 0 ) {
// i.e. it is not initialisation
// copy tolerance from previous tolerance field
myTolEdt2->setValue( myTolEdt->value() );
mySubShapesChk->setChecked( false );
clearTemporary();
}
break;
}
myCurrConstrId = constructorId;
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
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() ) );
qApp->processEvents(); qApp->processEvents();
updateGeometry(); updateGeometry();
QSize aSize = minimumSizeHint(); resize( minimumSize() );
resize( width(), aSize.height() );
displayPreview(); displayPreview();
updateButtonState(); updateButtonState();
@ -298,7 +283,7 @@ void RepairGUI_GlueDlg::SelectionIntoArgument()
return; return;
erasePreview(); erasePreview();
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText( "" );
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
if ( IObjectCount() == 1 ) { if ( IObjectCount() == 1 ) {
@ -332,11 +317,11 @@ void RepairGUI_GlueDlg::SetEditCurrentArgument()
void RepairGUI_GlueDlg::LineEditReturnPressed() void RepairGUI_GlueDlg::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();
} }
else if( send == GroupPoints2->LineEdit1 ) { else if ( send == GroupPoints2->LineEdit1 ) {
myEditCurrentArgument = GroupPoints2->LineEdit1; myEditCurrentArgument = GroupPoints2->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -350,8 +335,8 @@ void RepairGUI_GlueDlg::LineEditReturnPressed()
void RepairGUI_GlueDlg::ActivateThisDialog() void RepairGUI_GlueDlg::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() ) );
//GroupPoints->LineEdit1->setText(""); //GroupPoints->LineEdit1->setText("");
//GroupPoints2->LineEdit1->setText(""); //GroupPoints2->LineEdit1->setText("");
@ -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();
} }
@ -377,7 +362,7 @@ void RepairGUI_GlueDlg::enterEvent(QEvent* e)
// function : closeEvent() // function : closeEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void RepairGUI_GlueDlg::closeEvent(QCloseEvent* e) void RepairGUI_GlueDlg::closeEvent( QCloseEvent* e )
{ {
//myGeomGUI->SetState( -1 ); //myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e ); GEOMBase_Skeleton::closeEvent( e );
@ -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,67 +396,64 @@ 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
( getOperation() )->MakeGlueFaces( myObject, myTolEdt2->value() ); ( getOperation() )->MakeGlueFaces( myObject, myTolEdt2->value() );
aResult = !anObj->_is_nil(); aResult = !anObj->_is_nil();
if ( aResult ) if ( aResult )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
break;
}
case 1 :
if ( IsPreview() )
{
// if this method is used for displaying preview then we must detect glue faces only
ObjectList::iterator anIter;
for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter)
objects.push_back( GEOM::GEOM_Object::_duplicate( *anIter ) );
return myTmpObjs.size() ? true : false;
} // IsPreview
// Make glue face by list.
// Iterate through myTmpObjs and verifies where each object is currently selected or not.
QMap<QString, char> selected;
// Get names of selected objects
SALOME_ListIteratorOfListIO it ( selectedIO() );
for (; it.More(); it.Next())
selected.insert( it.Value()->getName(), 0 );
// Iterate through result and select objects with names from selection
// ObjectList toRemoveFromEnggine;
ObjectList toGlue;
ObjectList::iterator anIter;
for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter)
{
if ( selected.contains( myGeomGUI->getApp()->orb()->object_to_string(*anIter) ) )
toGlue.push_back(*anIter);
}
// make glue faces
GEOM::ListOfGO_var aListForGlue = new GEOM::ListOfGO();
aListForGlue->length( toGlue.size() );
ObjectList::iterator anIter3 = toGlue.begin();
for ( int i = 0; anIter3 != toGlue.end(); ++anIter3, ++i )
aListForGlue[ i ] = *anIter3;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow
( getOperation() )->MakeGlueFacesByList( myObject, myTolEdt2->value(), aListForGlue );
aResult = !anObj->_is_nil();
if ( aResult )
objects.push_back( anObj._retn() );
// Remove from engine useless objects
clearTemporary();
updateButtonState();
break; break;
} // case }
case 1 :
if ( IsPreview() ) {
// if this method is used for displaying preview then we must detect glue faces only
ObjectList::iterator anIter;
for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter)
objects.push_back( GEOM::GEOM_Object::_duplicate( *anIter ) );
return myTmpObjs.size() ? true : false;
} // IsPreview
// Make glue face by list.
// Iterate through myTmpObjs and verifies where each object is currently selected or not.
QMap<QString, char> selected;
// Get names of selected objects
SALOME_ListIteratorOfListIO it ( selectedIO() );
for ( ; it.More(); it.Next() )
selected.insert( it.Value()->getName(), 0 );
// Iterate through result and select objects with names from selection
// ObjectList toRemoveFromEnggine;
ObjectList toGlue;
ObjectList::iterator anIter;
for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter ) {
if ( selected.contains( myGeomGUI->getApp()->orb()->object_to_string(*anIter) ) )
toGlue.push_back(*anIter);
}
// make glue faces
GEOM::ListOfGO_var aListForGlue = new GEOM::ListOfGO();
aListForGlue->length( toGlue.size() );
ObjectList::iterator anIter3 = toGlue.begin();
for ( int i = 0; anIter3 != toGlue.end(); ++anIter3, ++i )
aListForGlue[ i ] = *anIter3;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow
( getOperation() )->MakeGlueFacesByList( myObject, myTolEdt2->value(), aListForGlue );
aResult = !anObj->_is_nil();
if ( aResult )
objects.push_back( anObj._retn() );
// Remove from engine useless objects
clearTemporary();
updateButtonState();
break;
} // case
return aResult; return aResult;
} }
@ -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();
} }
@ -636,20 +600,18 @@ void RepairGUI_GlueDlg::onDetect()
GEOM::ListOfGO_var aList = GEOM::GEOM_IShapesOperations::_narrow GEOM::ListOfGO_var aList = GEOM::GEOM_IShapesOperations::_narrow
( getOperation() )->GetGlueFaces( myObject, myTolEdt2->value() ); ( getOperation() )->GetGlueFaces( myObject, myTolEdt2->value() );
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();
} }
@ -660,27 +622,26 @@ void RepairGUI_GlueDlg::onDetect()
//================================================================================= //=================================================================================
void RepairGUI_GlueDlg::activateSelection() 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() ) );
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
if (myObject->_is_nil()) if ( myObject->_is_nil())
SelectionIntoArgument(); SelectionIntoArgument();
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 )
@ -721,7 +681,7 @@ void RepairGUI_GlueDlg::updateButtonState()
void RepairGUI_GlueDlg::clearTemporary() void RepairGUI_GlueDlg::clearTemporary()
{ {
ObjectList::iterator anIter; ObjectList::iterator anIter;
for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter) for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter )
getGeomEngine()->RemoveObject(*anIter); getGeomEngine()->RemoveObject(*anIter);
myTmpObjs.clear(); myTmpObjs.clear();
@ -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

@ -1,37 +1,36 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_GlueDlg.h
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : RepairGUI_GlueDlg.h
// Author : Lucien PIGNOLONI
// 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;
//================================================================================= //=================================================================================
@ -40,68 +39,66 @@ class QCheckBox;
//================================================================================= //=================================================================================
class RepairGUI_GlueDlg : public GEOMBase_Skeleton 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();
bool onAcceptLocal(); bool onAcceptLocal();
void clearShapeBufferLocal( GEOM::GEOM_Object_ptr ); void clearShapeBufferLocal( GEOM::GEOM_Object_ptr );
// Reimplementation of onAccept for local case of this class. // Reimplementation of onAccept for local case of this class.
void activateSelection(); void activateSelection();
void updateButtonState(); void updateButtonState();
void selectTmpInViewer(); void selectTmpInViewer();
private: private:
GEOM::GEOM_Object_var myObject;
ObjectList myTmpObjs;
GEOM::GEOM_Object_var myObject; DlgRef_1SelExt* GroupPoints;
ObjectList myTmpObjs; DlgRef_1SelExt* GroupPoints2;
QDoubleSpinBox* myTolEdt;
QDoubleSpinBox* myTolEdt2;
QPushButton* myDetectBtn;
QCheckBox* mySubShapesChk;
DlgRef_1Sel_Ext* GroupPoints; int myCurrConstrId;
DlgRef_1Sel_Ext* GroupPoints2;
QtxDblSpinBox* myTolEdt;
QtxDblSpinBox* myTolEdt2;
QPushButton* myDetectBtn;
QCheckBox* mySubShapesChk;
int myCurrConstrId;
protected slots: protected slots:
virtual void ClickOnCancel(); virtual void ClickOnCancel();
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ConstructorsClicked(int); void ConstructorsClicked( int );
//void ValueChangedInSpinBox(); //void ValueChangedInSpinBox();
void onDetect(); void onDetect();
void onTolerChanged( double ); void onTolerChanged( double );
void onSubShapesChk(); void onSubShapesChk();
}; };
#endif // DIALOGBOX_Glue_H #endif // REPAIRGUI_GLUEDLG_H

View File

@ -1,46 +1,45 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_RemoveHolesDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : RepairGUI_RemoveHolesDlg.cxx
// Author : Lucien PIGNOLONI
// 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()
@ -49,63 +48,46 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
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" );
Init(); Init();
} }
@ -140,19 +122,19 @@ 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->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(mySelectWiresBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(mySelectWiresEdt, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupPoints->LineEdit2, 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" ) );
} }
@ -180,8 +162,8 @@ bool RepairGUI_RemoveHolesDlg::ClickOnApply()
initName(); initName();
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 );
@ -198,16 +180,14 @@ bool RepairGUI_RemoveHolesDlg::ClickOnApply()
void RepairGUI_RemoveHolesDlg::SelectionIntoArgument() 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,10 +195,10 @@ 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();
myWiresInd->length( n ); myWiresInd->length( n );
for ( int i = 1; i <= n; i++ ) for ( int i = 1; i <= n; i++ )
@ -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();
} }
@ -271,12 +249,12 @@ void RepairGUI_RemoveHolesDlg::LineEditReturnPressed()
void RepairGUI_RemoveHolesDlg::ActivateThisDialog() void RepairGUI_RemoveHolesDlg::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() ) );
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();
} }
@ -303,7 +281,7 @@ void RepairGUI_RemoveHolesDlg::enterEvent(QEvent* e)
// function : closeEvent() // function : closeEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void RepairGUI_RemoveHolesDlg::closeEvent(QCloseEvent* e) void RepairGUI_RemoveHolesDlg::closeEvent( QCloseEvent* e )
{ {
//myGeomGUI->SetState( -1 ); //myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e ); GEOMBase_Skeleton::closeEvent( e );
@ -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

@ -1,42 +1,35 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_RemoveHolesDlg.h
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : RepairGUI_RemoveHolesDlg.h
// Author : Lucien PIGNOLONI
// 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
@ -44,50 +37,46 @@
//================================================================================= //=================================================================================
class RepairGUI_RemoveHolesDlg : public GEOMBase_Skeleton 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();
GEOM::GEOM_Object_var myObject; private:
GEOM::short_array_var myWiresInd; GEOM::GEOM_Object_var myObject;
GEOM::short_array_var myWiresInd;
DlgRef_1Sel_Ext* GroupPoints; DlgRef_1Sel1Check1Sel* GroupPoints;
QCheckBox* myAllChk; QPushButton* myFreeBoundBtn;
QLabel* mySelectWiresLbl;
QPushButton* mySelectWiresBtn;
QLineEdit* mySelectWiresEdt;
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().
int myOpen; // Number of free open boundaries detected. Calculated in execute(), used in onDetect(). int myOpen; // Number of free open boundaries detected. Calculated in execute(), used in onDetect().
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void onRemoveAllClicked(); void onRemoveAllClicked();
void onDetect(); void onDetect();
}; };
#endif // DIALOGBOX_RemoveHoles_H #endif // REPAIRGUI_REMOVEHOLESDLG_H

View File

@ -1,44 +1,44 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_RemoveIntWiresDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : RepairGUI_RemoveIntWiresDlg.cxx
// Author : Lucien PIGNOLONI
// 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()
@ -47,56 +47,40 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
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" );
Init(); Init();
} }
@ -121,25 +105,25 @@ void RepairGUI_RemoveIntWiresDlg::Init()
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
myWiresInd = new GEOM::short_array(); myWiresInd = new GEOM::short_array();
myWiresInd->length( 0 ); myWiresInd->length( 0 );
//myGeomGUI->SetState( 0 ); //myGeomGUI->SetState( 0 );
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->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(mySelectWiresBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(mySelectWiresEdt, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( GroupPoints->LineEdit2, 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" ) );
} }
@ -162,17 +146,17 @@ void RepairGUI_RemoveIntWiresDlg::ClickOnOk()
bool RepairGUI_RemoveIntWiresDlg::ClickOnApply() bool RepairGUI_RemoveIntWiresDlg::ClickOnApply()
{ {
if ( !onAccept() ) if ( !onAccept() )
return false; return false;
initName(); initName();
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 );
initSelection(); initSelection();
return true; return true;
} }
@ -184,35 +168,33 @@ bool RepairGUI_RemoveIntWiresDlg::ClickOnApply()
//================================================================================= //=================================================================================
void RepairGUI_RemoveIntWiresDlg::SelectionIntoArgument() 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 ) ) myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); else
else myObject = GEOM::GEOM_Object::_nil();
myObject = GEOM::GEOM_Object::_nil();
}
else if ( myEditCurrentArgument == mySelectWiresEdt && !myAllChk->isChecked() )
{
TColStd_IndexedMapOfInteger aMap;
((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap );
const int n = aMap.Extent();
myWiresInd->length( n );
for ( int i = 1; i <= n; i++ )
myWiresInd[i-1] = aMap( i );
if ( n )
myEditCurrentArgument->setText( QString::number( n ) + "_" + tr( "GEOM_WIRE" ) + tr( "_S_" ) );
}
} }
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 &&
!GroupPoints->CheckButton1->isChecked() ) {
TColStd_IndexedMapOfInteger aMap;
( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr()->GetIndexes( anIO, aMap );
const int n = aMap.Extent();
myWiresInd->length( n );
for ( int i = 1; i <= n; i++ )
myWiresInd[i-1] = aMap( i );
if ( n )
myEditCurrentArgument->setText( QString::number( n ) + "_" + tr( "GEOM_WIRE" ) + tr( "_S_" ) );
}
}
} }
//================================================================================= //=================================================================================
@ -221,17 +203,16 @@ void RepairGUI_RemoveIntWiresDlg::SelectionIntoArgument()
//================================================================================= //=================================================================================
void RepairGUI_RemoveIntWiresDlg::SetEditCurrentArgument() 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();
} }
} }
@ -242,12 +223,11 @@ 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();
} }
} }
@ -258,12 +238,12 @@ void RepairGUI_RemoveIntWiresDlg::LineEditReturnPressed()
void RepairGUI_RemoveIntWiresDlg::ActivateThisDialog() void RepairGUI_RemoveIntWiresDlg::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() ) );
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();
} }
@ -285,7 +265,7 @@ void RepairGUI_RemoveIntWiresDlg::enterEvent(QEvent* e)
// function : closeEvent() // function : closeEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void RepairGUI_RemoveIntWiresDlg::closeEvent(QCloseEvent* e) void RepairGUI_RemoveIntWiresDlg::closeEvent( QCloseEvent* e )
{ {
//myGeomGUI->SetState( -1 ); //myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e ); GEOMBase_Skeleton::closeEvent( e );
@ -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,18 +326,16 @@ 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 ); aTypes.Add( GEOM_SHELL );
aTypes.Add( GEOM_SHELL ); aTypes.Add( GEOM_FACE );
aTypes.Add( GEOM_FACE );
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

@ -1,42 +1,34 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_RemoveIntWiresDlg.h
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : RepairGUI_RemoveIntWiresDlg.h
// Author : Lucien PIGNOLONI
// 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
@ -44,45 +36,41 @@
//================================================================================= //=================================================================================
class RepairGUI_RemoveIntWiresDlg : public GEOMBase_Skeleton 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();
GEOM::GEOM_Object_var myObject; private:
GEOM::short_array_var myWiresInd; GEOM::GEOM_Object_var myObject;
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();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void onRemoveAllClicked(); void onRemoveAllClicked();
}; };
#endif // DIALOGBOX_RemoveIntWires_H #endif // REPAIRGUI_REMOVEINTWIRESDLG_H

View File

@ -1,48 +1,47 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_SewingDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : RepairGUI_SewingDlg.cxx
// Author : Lucien PIGNOLONI
// 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
@ -50,46 +49,47 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
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" );
Init(); Init();
} }
@ -122,16 +122,16 @@ 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() ) );
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(myFreeBoundBtn, SIGNAL(clicked()), this, SLOT(onDetect())); connect( myFreeBoundBtn, SIGNAL( clicked() ), this, SLOT( onDetect() ) );
initName( tr( "SEWING_NEW_OBJ_NAME" ) ); initName( tr( "SEWING_NEW_OBJ_NAME" ) );
} }
@ -158,7 +158,7 @@ bool RepairGUI_SewingDlg::ClickOnApply()
initName(); initName();
GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit1->setText( "" );
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
initSelection(); initSelection();
@ -174,11 +174,10 @@ bool RepairGUI_SewingDlg::ClickOnApply()
void RepairGUI_SewingDlg::SelectionIntoArgument() void RepairGUI_SewingDlg::SelectionIntoArgument()
{ {
erasePreview(); erasePreview();
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();
} }
@ -224,10 +221,10 @@ void RepairGUI_SewingDlg::LineEditReturnPressed()
void RepairGUI_SewingDlg::ActivateThisDialog() void RepairGUI_SewingDlg::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() ) );
GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit1->setText( "" );
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
myClosed = -1; myClosed = -1;
@ -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();
} }
@ -253,7 +250,7 @@ void RepairGUI_SewingDlg::enterEvent(QEvent* e)
// function : closeEvent() // function : closeEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void RepairGUI_SewingDlg::closeEvent(QCloseEvent* e) void RepairGUI_SewingDlg::closeEvent( QCloseEvent* e )
{ {
//myGeomGUI->SetState( -1 ); //myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e ); GEOMBase_Skeleton::closeEvent( e );
@ -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

@ -1,43 +1,36 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_SewingDlg.h
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : RepairGUI_SewingDlg.h
// Author : Lucien PIGNOLONI
// 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
@ -45,45 +38,45 @@
//================================================================================= //=================================================================================
class RepairGUI_SewingDlg : public GEOMBase_Skeleton 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();
GEOM::GEOM_Object_var myObject; private:
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().
int myOpen; // Number of free open boundaries detected. Calculated in execute(), used in onDetect(). int myOpen; // Number of free open boundaries detected. Calculated in execute(), used in onDetect().
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void onDetect(); void onDetect();
}; };
#endif // DIALOGBOX_Sewing_H #endif // REPAIRGUI_SEWINGDLG_H

View File

@ -1,49 +1,48 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_ShapeProcessDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : RepairGUI_ShapeProcessDlg.cxx
// Author : Lucien PIGNOLONI
// 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()
@ -52,12 +51,11 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
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,265 +78,256 @@ 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( "," );
// FixShape // fill in the widgets
QFrame* aFrame = new QFrame( myStack ); for ( int i = 0; i < myOpLst.count(); i++ ) {
QGridLayout* aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); QListWidgetItem* item = new QListWidgetItem( myOpLst[i] );
item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable );
item->setCheckState( Qt::Unchecked );
myOpList->addItem( item );
myFixShapeTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); QWidget* w;
myFixShapeTol3D->setPrecision( 10 ); if ( myOpLst[i] == "FixShape" ) {
myFixShapeMaxTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); // FixShape
myFixShapeMaxTol3D->setPrecision( 10 ); w = new QWidget( aParamsGr );
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 ); myFixShapeTol3D = new QDoubleSpinBox( w );
aLay->addWidget( myFixShapeTol3D, 0, 1 ); initSpinBox( myFixShapeTol3D, 0, 100, 1e-7, 10 );
aLay->addWidget( new QLabel( tr("GEOM_MAX_3D_TOLERANCE"), aFrame ), 1, 0 ); myFixShapeMaxTol3D = new QDoubleSpinBox( w );
aLay->addWidget( myFixShapeMaxTol3D, 1, 1 ); initSpinBox( myFixShapeMaxTol3D, 0, 100, 1e-7, 10 );
aLay->setRowStretch( 9, 2 );
myStack->addWidget( aFrame, myOpLst.findIndex( "FixShape" ) ); aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 );
aLay->addWidget( myFixShapeTol3D, 0, 1 );
aLay->addWidget( new QLabel( tr( "GEOM_MAX_3D_TOLERANCE" ), w ), 1, 0 );
aLay->addWidget( myFixShapeMaxTol3D, 1, 1 );
aLay->setRowStretch( aLay->rowCount(), 5 );
}
else if ( myOpLst[i] == "FixFaceSize" ) {
// FixFaceSize
w = new QWidget( aParamsGr );
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
// FixFaceSize myFixFaceSizeTol = new QDoubleSpinBox( w );
aFrame = new QFrame( myStack ); initSpinBox( myFixFaceSizeTol, 0, 100, 1e-7, 10 );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 );
myFixFaceSizeTol = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); aLay->addWidget( new QLabel( tr( "GEOM_TOLERANCE" ), w ), 0, 0 );
myFixFaceSizeTol->setPrecision( 10 ); aLay->addWidget( myFixFaceSizeTol, 0, 1 );
aLay->setRowStretch( aLay->rowCount(), 5 );
}
else if ( myOpLst[i] == "DropSmallEdges" ) {
// DropSmallEdges
w = new QWidget( aParamsGr );
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
aLay->addWidget( new QLabel( tr("GEOM_TOLERANCE"), aFrame ), 0, 0 ); myDropSmallEdgesTol3D = new QDoubleSpinBox( w );
aLay->addWidget( myFixFaceSizeTol, 0, 1 ); initSpinBox( myDropSmallEdgesTol3D, 0, 100, 1e-7, 10 );
aLay->setRowStretch( 9, 2 );
myStack->addWidget( aFrame, myOpLst.findIndex( "FixFaceSize" ) ); aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 );
aLay->addWidget( myDropSmallEdgesTol3D, 0, 1 );
aLay->setRowStretch( aLay->rowCount(), 5 );
}
else if ( myOpLst[i] == "SplitAngle" ) {
// SplitAngle
w = new QWidget( aParamsGr );
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
// DropSmallEdges mySplitAngleAngle = new QDoubleSpinBox( w );
aFrame = new QFrame( myStack ); initSpinBox( mySplitAngleAngle, 0, 360, 1 );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); mySplitAngleMaxTol = new QDoubleSpinBox( w );
initSpinBox( mySplitAngleMaxTol, 0, 100, 1e-7, 10 );
myDropSmallEdgesTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); aLay->addWidget( new QLabel( tr( "GEOM_ANGLE_1" ), w ), 0, 0 );
myDropSmallEdgesTol3D->setPrecision( 10 ); aLay->addWidget( mySplitAngleAngle, 0, 1 );
aLay->addWidget( new QLabel( tr( "GEOM_MAX_TOLERANCE" ), w ), 1, 0 );
aLay->addWidget( mySplitAngleMaxTol, 1, 1 );
aLay->setRowStretch( aLay->rowCount(), 5 );
}
else if ( myOpLst[i] == "SplitClosedFaces" ) {
// SplitClosedFaces
w = new QWidget( aParamsGr );
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 ); mySplitClosedFacesNum = new QSpinBox( w );
aLay->addWidget( myDropSmallEdgesTol3D, 0, 1 );
aLay->setRowStretch( 9, 2 );
myStack->addWidget( aFrame, myOpLst.findIndex( "DropSmallEdges" ) ); aLay->addWidget( new QLabel( tr( "GEOM_NUM_SPLIT_POINTS" ), w ), 0, 0 );
aLay->addWidget( mySplitClosedFacesNum, 0, 1 );
aLay->setRowStretch( aLay->rowCount(), 5 );
}
else if ( myOpLst[i] == "SplitContinuity" ) {
// SplitContinuity
w = new QWidget( aParamsGr );
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
// SplitAngle mySplitContTol3D = new QDoubleSpinBox( w );
aFrame = new QFrame( myStack ); initSpinBox( mySplitContTol3D, 0, 100, 1e-7, 10 );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); mySplitContSurfCont = new QComboBox( w );
mySplitContSurfCont->addItems( aContinueties );
mySplitContCurvCont = new QComboBox( w );
mySplitContCurvCont->addItems( aContinueties );
mySplitAngleAngle = new QtxDblSpinBox( 0, 360, 1, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 360, 1 ); aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 );
mySplitAngleMaxTol = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); aLay->addWidget( mySplitContTol3D, 0, 1 );
mySplitAngleMaxTol->setPrecision( 10 ); aLay->addWidget( new QLabel( tr( "GEOM_SURFACE_CONTINUTY" ), w ), 1, 0 );
aLay->addWidget( mySplitContSurfCont, 1, 1 );
aLay->addWidget( new QLabel( tr( "GEOM_CURVE_CONTINUTY" ), w ), 2, 0 );
aLay->addWidget( mySplitContCurvCont, 2, 1 );
aLay->setRowStretch( aLay->rowCount(), 5 );
}
else if ( myOpLst[i] == "BSplineRestriction" ) {
// BSplineRestriction
w = new QWidget( aParamsGr );
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
aLay->addWidget( new QLabel( tr("GEOM_ANGLE_1"), aFrame ), 0, 0 ); myBSplineSurfModeChk = new QCheckBox( tr("GEOM_SURFACE_MODE"), w );
aLay->addWidget( mySplitAngleAngle, 0, 1 ); myBSpline3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), w );
aLay->addWidget( new QLabel( tr("GEOM_MAX_TOLERANCE"), aFrame ), 1, 0 ); myBSpline2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), w );
aLay->addWidget( mySplitAngleMaxTol, 1, 1 );
aLay->setRowStretch( 9, 2 );
myStack->addWidget( aFrame, myOpLst.findIndex( "SplitAngle" ) ); myBSplineTol3D = new QDoubleSpinBox( w );
initSpinBox( myBSplineTol3D, 0, 100, 1e-7, 10 );
// SplitClosedFaces myBSplineTol2D = new QDoubleSpinBox( w );
aFrame = new QFrame( myStack ); initSpinBox( myBSplineTol2D, 0, 100, 1e-7, 10 );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 );
mySplitClosedFacesNum = new QSpinBox( aFrame ); myBSplineDegree = new QSpinBox( w );
myBSplineSegments = new QSpinBox( w );
myBSpline2DCont = new QComboBox( w );
myBSpline2DCont->addItems( aContinueties );
myBSpline3DCont = new QComboBox( w );
myBSpline3DCont->addItems( aContinueties );
aLay->addWidget( new QLabel( tr("GEOM_NUM_SPLIT_POINTS"), aFrame ), 0, 0 ); myBSplineSurfModeChk->setChecked( true );
aLay->addWidget( mySplitClosedFacesNum, 0, 1 ); myBSpline3DCurveChk->setChecked( true );
aLay->setRowStretch( 9, 2 ); myBSpline2DCurveChk->setChecked( true );
myStack->addWidget( aFrame, myOpLst.findIndex( "SplitClosedFaces" ) ); aLay->addWidget( myBSplineSurfModeChk, 0, 0 );
aLay->addWidget( myBSpline3DCurveChk, 1, 0 );
aLay->addWidget( myBSpline2DCurveChk, 2, 0 );
aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 3, 0 );
aLay->addWidget( myBSplineTol3D, 3, 1 );
aLay->addWidget( new QLabel( tr( "GEOM_2D_TOLERANCE" ), w ), 4, 0 );
aLay->addWidget( myBSplineTol2D, 4, 1 );
aLay->addWidget( new QLabel( tr( "GEOM_REQUIRED_DEGREE" ), w ), 5, 0 );
aLay->addWidget( myBSplineDegree, 5, 1 );
aLay->addWidget( new QLabel( tr( "GEOM_REQUIRED_NUM_SEGMENTS" ), w ), 6, 0 );
aLay->addWidget( myBSplineSegments, 6, 1 );
aLay->addWidget( new QLabel( tr( "GEOM_3D_CONTINUTY" ), w ), 7, 0 );
aLay->addWidget( myBSpline3DCont, 7, 1 );
aLay->addWidget( new QLabel( tr( "GEOM_2D_CONTINUTY" ), w ), 8, 0 );
aLay->addWidget( myBSpline2DCont, 8, 1 );
aLay->setRowStretch( aLay->rowCount(), 5 );
}
else if ( myOpLst[i] == "ToBezier" ) {
// ToBezier
w = new QWidget( aParamsGr );
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
// SplitContinuity myToBezierSurfModeChk = new QCheckBox( tr("GEOM_SURFACE_MODE"), w );
aFrame = new QFrame( myStack ); myToBezier3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), w );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); myToBezier2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), w );
mySplitContTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); myToBezierMaxTol = new QDoubleSpinBox( w );
mySplitContTol3D->setPrecision( 10 ); initSpinBox( myToBezierMaxTol, 0, 100, 1e-7, 10 );
mySplitContSurfCont = new QComboBox( aFrame );
mySplitContSurfCont->insertStringList( aContinueties );
mySplitContCurvCont = new QComboBox( aFrame );
mySplitContCurvCont->insertStringList( aContinueties );
aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 ); aLay->addWidget( myToBezierSurfModeChk, 0, 0 );
aLay->addWidget( mySplitContTol3D, 0, 1 ); aLay->addWidget( myToBezier3DCurveChk, 1, 0 );
aLay->addWidget( new QLabel( tr("GEOM_SURFACE_CONTINUTY"), aFrame ), 1, 0 ); aLay->addWidget( myToBezier2DCurveChk, 2, 0 );
aLay->addWidget( mySplitContSurfCont, 1, 1 ); aLay->addWidget( new QLabel( tr( "GEOM_MAX_TOLERANCE" ), w ), 3, 0 );
aLay->addWidget( new QLabel( tr("GEOM_CURVE_CONTINUTY"), aFrame ), 2, 0 ); aLay->addWidget( myToBezierMaxTol, 3, 1 );
aLay->addWidget( mySplitContCurvCont, 2, 1 ); aLay->setRowStretch( aLay->rowCount(), 5 );
aLay->setRowStretch( 9, 2 ); }
else if ( myOpLst[i] == "SameParameter" ) {
// SameParameter
w = new QWidget( aParamsGr );
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
myStack->addWidget( aFrame, myOpLst.findIndex( "SplitContinuity" ) ); mySameParameterTol3D = new QDoubleSpinBox( w );
initSpinBox( mySameParameterTol3D, 0, 100, 1e-7, 10 );
// BSplineRestriction aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 );
aFrame = new QFrame( myStack ); aLay->addWidget( mySameParameterTol3D, 0, 1 );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); aLay->setRowStretch( aLay->rowCount(), 5 );
}
else {
w = new QWidget( aParamsGr ); // dumb widget
}
aStack->insertWidget( i, w );
}
myBSplineSurfModeChk = new QCheckBox( tr("GEOM_SURFACE_MODE"), aFrame ); QGridLayout* layout = new QGridLayout( centralWidget() );
myBSpline3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), aFrame ); layout->setMargin( 0 ); layout->setSpacing( 6 );
myBSpline2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), aFrame ); layout->addWidget( mySelectWdgt, 0, 0, 1, 2 );
layout->addWidget( anOperGr, 1, 0 );
myBSplineTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); layout->addWidget( aParamsGr, 1, 1 );
myBSplineTol3D->setPrecision( 10 );
myBSplineTol2D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 );
myBSplineTol2D->setPrecision( 10 );
myBSplineDegree = new QSpinBox( aFrame );
myBSplineSegments = new QSpinBox( aFrame );
myBSpline2DCont = new QComboBox( aFrame );
myBSpline2DCont->insertStringList( aContinueties );
myBSpline3DCont = new QComboBox( aFrame );
myBSpline3DCont->insertStringList( aContinueties );
myBSplineSurfModeChk->setChecked( true );
myBSpline3DCurveChk->setChecked( true );
myBSpline2DCurveChk->setChecked( true );
aLay->addWidget( myBSplineSurfModeChk, 0, 0 );
aLay->addWidget( myBSpline3DCurveChk, 1, 0 );
aLay->addWidget( myBSpline2DCurveChk, 2, 0 );
aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame), 3, 0 );
aLay->addWidget( myBSplineTol3D, 3, 1 );
aLay->addWidget( new QLabel( tr("GEOM_2D_TOLERANCE"), aFrame), 4, 0 );
aLay->addWidget( myBSplineTol2D, 4, 1 );
aLay->addWidget( new QLabel( tr("GEOM_REQUIRED_DEGREE"), aFrame), 5, 0 );
aLay->addWidget( myBSplineDegree, 5, 1 );
aLay->addWidget( new QLabel( tr("GEOM_REQUIRED_NUM_SEGMENTS"), aFrame), 6, 0 );
aLay->addWidget( myBSplineSegments, 6, 1 );
aLay->addWidget( new QLabel( tr("GEOM_3D_CONTINUTY"), aFrame), 7, 0 );
aLay->addWidget( myBSpline3DCont, 7, 1 );
aLay->addWidget( new QLabel( tr("GEOM_2D_CONTINUTY"), aFrame), 8, 0 );
aLay->addWidget( myBSpline2DCont, 8, 1 );
aLay->setRowStretch( 9, 2 );
myStack->addWidget( aFrame, myOpLst.findIndex( "BSplineRestriction" ) );
// ToBezier
aFrame = new QFrame( myStack );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 );
myToBezierSurfModeChk = new QCheckBox( tr("GEOM_SURFACE_MODE"), aFrame );
myToBezier3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), aFrame );
myToBezier2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), aFrame );
myToBezierMaxTol = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 );
myToBezierMaxTol->setPrecision( 10 );
aLay->addWidget( myToBezierSurfModeChk, 0, 0 );
aLay->addWidget( myToBezier3DCurveChk, 1, 0 );
aLay->addWidget( myToBezier2DCurveChk, 2, 0 );
aLay->addWidget( new QLabel( tr("GEOM_MAX_TOLERANCE"), aFrame), 3, 0 );
aLay->addWidget( myToBezierMaxTol, 3, 1 );
aLay->setRowStretch( 9, 2 );
myStack->addWidget( aFrame, myOpLst.findIndex( "ToBezier" ) );
// SameParameter
aFrame = new QFrame( myStack );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 );
mySameParameterTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 );
mySameParameterTol3D->setPrecision( 10 );
aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 );
aLay->addWidget( mySameParameterTol3D, 0, 1 );
aLay->setRowStretch( 9, 2 );
myStack->addWidget( aFrame, myOpLst.findIndex( "SameParameter" ) );
// 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.
//================================================================================= //=================================================================================
void RepairGUI_ShapeProcessDlg::onOk() void RepairGUI_ShapeProcessDlg::onOk()
{ {
if (onApply()) if ( onApply() )
ClickOnCancel(); ClickOnCancel();
} }
@ -367,13 +356,12 @@ bool RepairGUI_ShapeProcessDlg::onApply()
//================================================================================= //=================================================================================
void RepairGUI_ShapeProcessDlg::selectionChanged() void RepairGUI_ShapeProcessDlg::selectionChanged()
{ {
reset(); reset();
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;
@ -415,8 +403,8 @@ void RepairGUI_ShapeProcessDlg::lineEditReturnPressed()
void RepairGUI_ShapeProcessDlg::activate() void RepairGUI_ShapeProcessDlg::activate()
{ {
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(selectionChanged())); SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ) );
reset(); reset();
//myGeomGUI->SetState( 0 ); //myGeomGUI->SetState( 0 );
@ -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();
} }
@ -439,7 +427,7 @@ void RepairGUI_ShapeProcessDlg::enterEvent(QEvent* e)
// function : closeEvent() // function : closeEvent()
// purpose : same than click on cancel button // purpose : same than click on cancel button
//================================================================================= //=================================================================================
void RepairGUI_ShapeProcessDlg::closeEvent(QCloseEvent* e) void RepairGUI_ShapeProcessDlg::closeEvent( QCloseEvent* e )
{ {
//myGeomGUI->SetState( -1 ); //myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e ); GEOMBase_Skeleton::closeEvent( e );
@ -454,7 +442,7 @@ void RepairGUI_ShapeProcessDlg::reset()
{ {
myObjects = new GEOM::ListOfGO(); myObjects = new GEOM::ListOfGO();
myObjects->length( 0 ); myObjects->length( 0 );
mySelectWdgt->LineEdit1->setText(""); mySelectWdgt->LineEdit1->setText( "" );
} }
@ -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.
} }
@ -648,15 +626,17 @@ bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects )
GEOM::string_array* RepairGUI_ShapeProcessDlg::getActiveOperators() 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";
@ -750,25 +732,24 @@ 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).toLatin1().constData() );
aParams[j++] = CORBA::string_dup( (*it).latin1() ); }
}
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

@ -1,46 +1,41 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_ShapeProcessDlg.h
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : RepairGUI_ShapeProcessDlg.h
// Author : Lucien PIGNOLONI
// 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
@ -48,93 +43,92 @@
//================================================================================= //=================================================================================
class RepairGUI_ShapeProcessDlg : public GEOMBase_Skeleton 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();
void reset(); void reset();
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 //QDict<QString,QWidget*> myCtrlMap; // map of controls (values) of parameters
QMap<QString,QStringList> myValMap; // map of parameters of operators void initParamsValues(); // initialize the data structures
//QDict<QString,QWidget*> myCtrlMap; // map of controls (values) of parameters void initSelection();
void initParamsValues(); // initialize the data structures
void initSelection();
GEOM::ListOfGO_var myObjects; // selected objects private:
QStringList myOpLst; // list of available Shape Healing Operators
QMap<QString,QStringList> myValMap; // map of parameters of operators
DlgRef_1Sel_QTD* mySelectWdgt; GEOM::ListOfGO_var myObjects; // selected objects
QListView* myOpList;
QWidgetStack* myStack;
QtxDblSpinBox* myFixShapeTol3D; DlgRef_1Sel* mySelectWdgt;
QtxDblSpinBox* myFixShapeMaxTol3D; QListWidget* myOpList;
QtxDblSpinBox* myFixFaceSizeTol; QDoubleSpinBox* myFixShapeTol3D;
QDoubleSpinBox* myFixShapeMaxTol3D;
QtxDblSpinBox* myDropSmallEdgesTol3D; QDoubleSpinBox* myFixFaceSizeTol;
QtxDblSpinBox* mySplitAngleAngle; QDoubleSpinBox* myDropSmallEdgesTol3D;
QtxDblSpinBox* mySplitAngleMaxTol;
QSpinBox* mySplitClosedFacesNum; QDoubleSpinBox* mySplitAngleAngle;
QDoubleSpinBox* mySplitAngleMaxTol;
QtxDblSpinBox* mySplitContTol3D; QSpinBox* mySplitClosedFacesNum;
QComboBox* mySplitContSurfCont;
QComboBox* mySplitContCurvCont;
QCheckBox* myBSplineSurfModeChk; QDoubleSpinBox* mySplitContTol3D;
QCheckBox* myBSpline3DCurveChk; QComboBox* mySplitContSurfCont;
QCheckBox* myBSpline2DCurveChk; QComboBox* mySplitContCurvCont;
QtxDblSpinBox* myBSplineTol3D;
QtxDblSpinBox* myBSplineTol2D;
QSpinBox* myBSplineDegree;
QSpinBox* myBSplineSegments;
QComboBox* myBSpline2DCont;
QComboBox* myBSpline3DCont;
QCheckBox* myToBezierSurfModeChk; QCheckBox* myBSplineSurfModeChk;
QCheckBox* myToBezier3DCurveChk; QCheckBox* myBSpline3DCurveChk;
QCheckBox* myToBezier2DCurveChk; QCheckBox* myBSpline2DCurveChk;
QtxDblSpinBox* myToBezierMaxTol; QDoubleSpinBox* myBSplineTol3D;
QDoubleSpinBox* myBSplineTol2D;
QSpinBox* myBSplineDegree;
QSpinBox* myBSplineSegments;
QComboBox* myBSpline2DCont;
QComboBox* myBSpline3DCont;
QtxDblSpinBox* mySameParameterTol3D; QCheckBox* myToBezierSurfModeChk;
QCheckBox* myToBezier3DCurveChk;
QCheckBox* myToBezier2DCurveChk;
QDoubleSpinBox* myToBezierMaxTol;
QDoubleSpinBox* mySameParameterTol3D;
private slots: private slots:
void onOk(); void onOk();
bool onApply(); bool onApply();
void activate(); void activate();
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

@ -1,45 +1,46 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_SuppressFacesDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : RepairGUI_SuppressFacesDlg.cxx
// Author : Lucien PIGNOLONI
// 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()
@ -48,32 +49,35 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
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" );
Init(); Init();
} }
@ -104,14 +108,14 @@ 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() ) );
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() ) );
initName( tr( "SUPRESS_FACE_NEW_OBJ_NAME" ) ); initName( tr( "SUPRESS_FACE_NEW_OBJ_NAME" ) );
} }
@ -138,7 +142,7 @@ bool RepairGUI_SuppressFacesDlg::ClickOnApply()
initName(); initName();
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText( "" );
myObjects->length( 0 ); myObjects->length( 0 );
myFaces.clear(); myFaces.clear();
@ -155,31 +159,26 @@ bool RepairGUI_SuppressFacesDlg::ClickOnApply()
//================================================================================= //=================================================================================
void RepairGUI_SuppressFacesDlg::SelectionIntoArgument() void RepairGUI_SuppressFacesDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText( "" );
Standard_Boolean aRes = Standard_False; Standard_Boolean aRes = Standard_False;
int i = 0; int i = 0;
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();
} }
@ -242,8 +239,8 @@ void RepairGUI_SuppressFacesDlg::LineEditReturnPressed()
void RepairGUI_SuppressFacesDlg::ActivateThisDialog() void RepairGUI_SuppressFacesDlg::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() ) );
//myGeomGUI->SetState( 0 ); //myGeomGUI->SetState( 0 );
initSelection(); initSelection();
@ -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();
} }
@ -265,7 +262,7 @@ void RepairGUI_SuppressFacesDlg::enterEvent(QEvent* e)
// function : closeEvent() // function : closeEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void RepairGUI_SuppressFacesDlg::closeEvent(QCloseEvent* e) void RepairGUI_SuppressFacesDlg::closeEvent( QCloseEvent* e )
{ {
//myGeomGUI->SetState( -1 ); //myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e ); GEOMBase_Skeleton::closeEvent( e );
@ -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

@ -1,37 +1,37 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : RepairGUI_SuppressFacesDlg.h
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// //
//
// File : RepairGUI_SuppressFacesDlg.h
// Author : Lucien PIGNOLONI
// 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
@ -39,45 +39,46 @@
//================================================================================= //=================================================================================
class RepairGUI_SuppressFacesDlg : public GEOMBase_Skeleton 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* );
GEOM::ListOfGO_var myObjects; void Convert( const TColStd_IndexedMapOfInteger&,
QValueList<GEOM::short_array> myFaces; GEOM::short_array& );
// GEOM::short_array-s contain indexes of selected faces,
// 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.
void Convert( const TColStd_IndexedMapOfInteger&, GEOM::short_array& ); void initSelection();
void initSelection(); private:
GEOM::ListOfGO_var myObjects;
QList<GEOM::short_array> myFaces;
// GEOM::short_array-s contain indexes of selected faces,
// 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.
DlgRef_1Sel_QTD* GroupPoints; DlgRef_1Sel* GroupPoints;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
}; };
#endif // DIALOGBOX_SUPPRESSFACES_H #endif // REPAIRGUI_SUPPRESSFACESDLG_H