*** 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,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.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
@ -35,34 +32,47 @@ salomeinclude_HEADERS =
# Libraries targets
lib_LTLIBRARIES = libRepairGUI.la
dist_libRepairGUI_la_SOURCES = \
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 \
dist_libRepairGUI_la_SOURCES = \
RepairGUI.h \
RepairGUI_SewingDlg.h \
RepairGUI_SuppressFacesDlg.h \
RepairGUI_ShapeProcessDlg.h \
RepairGUI_CloseContourDlg.h \
RepairGUI_RemoveIntWiresDlg.h \
RepairGUI_RemoveHolesDlg.h \
RepairGUI_DivideEdgeDlg.h \
RepairGUI_FreeBoundDlg.h \
RepairGUI_FreeFacesDlg.h \
RepairGUI_ChangeOrientationDlg.h \
RepairGUI_GlueDlg.h \
\
RepairGUI.cxx \
RepairGUI_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
MOC_FILES = \
RepairGUI_SewingDlg_moc.cxx \
RepairGUI_SuppressFacesDlg_moc.cxx \
RepairGUI_ShapeProcessDlg_moc.cxx \
RepairGUI_CloseContourDlg_moc.cxx \
RepairGUI_RemoveIntWiresDlg_moc.cxx \
RepairGUI_RemoveHolesDlg_moc.cxx \
RepairGUI_DivideEdgeDlg_moc.cxx \
RepairGUI_FreeBoundDlg_moc.cxx \
RepairGUI_FreeFacesDlg_moc.cxx \
RepairGUI_ChangeOrientationDlg_moc.cxx \
RepairGUI_SewingDlg_moc.cxx \
RepairGUI_SuppressFacesDlg_moc.cxx \
RepairGUI_ShapeProcessDlg_moc.cxx \
RepairGUI_CloseContourDlg_moc.cxx \
RepairGUI_RemoveIntWiresDlg_moc.cxx \
RepairGUI_RemoveHolesDlg_moc.cxx \
RepairGUI_DivideEdgeDlg_moc.cxx \
RepairGUI_FreeBoundDlg_moc.cxx \
RepairGUI_FreeFacesDlg_moc.cxx \
RepairGUI_ChangeOrientationDlg_moc.cxx \
RepairGUI_GlueDlg_moc.cxx
nodist_libRepairGUI_la_SOURCES= \
nodist_libRepairGUI_la_SOURCES = \
$(MOC_FILES)
#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
libRepairGUI_la_CPPFLAGS = \
$(QT_INCLUDES) \
$(VTK_INCLUDES) \
$(CAS_CPPFLAGS) \
$(PYTHON_INCLUDES) \
$(BOOST_CPPFLAGS) \
$(KERNEL_CXXFLAGS) \
$(GUI_CXXFLAGS) \
$(CORBA_CXXFLAGS) \
$(CORBA_INCLUDES) \
-I$(srcdir)/../GEOMGUI \
-I$(srcdir)/../DlgRef \
-I$(srcdir)/../GEOMBase \
-I$(srcdir)/../OBJECT \
-I$(srcdir)/../GEOMClient \
-I$(srcdir)/../GEOMImpl \
-I$(top_builddir)/idl \
$(QT_INCLUDES) \
$(VTK_INCLUDES) \
$(CAS_CPPFLAGS) \
$(PYTHON_INCLUDES) \
$(BOOST_CPPFLAGS) \
$(KERNEL_CXXFLAGS) \
$(GUI_CXXFLAGS) \
$(CORBA_CXXFLAGS) \
$(CORBA_INCLUDES) \
-I$(srcdir)/../GEOMGUI \
-I$(srcdir)/../DlgRef \
-I$(srcdir)/../GEOMBase \
-I$(srcdir)/../OBJECT \
-I$(srcdir)/../GEOMClient \
-I$(srcdir)/../GEOMImpl \
-I$(top_builddir)/src/DlgRef \
-I$(top_builddir)/idl \
-I$(top_builddir)/salome_adm/unix
libRepairGUI_la_LDFLAGS = \
libRepairGUI_la_LDFLAGS = \
../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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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 "SUIT_Desktop.h"
#include "SUIT_Session.h"
#include <GeometryGUI.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_SuppressFacesDlg.h" // Method SUPPRESS FACES
@ -45,15 +43,12 @@
#include "RepairGUI_GlueDlg.h" // Method GLUE FACES
#include "RepairGUI_ChangeOrientationDlg.h" // Method CHANGE ORIENTATION
#include "utilities.h"
using namespace std;
//=======================================================================
// function : RepairGUI()
// purpose : Constructor
//=======================================================================
RepairGUI::RepairGUI( GeometryGUI* parent ) : GEOMGUI( parent )
RepairGUI::RepairGUI( GeometryGUI* parent )
: GEOMGUI( parent )
{
}
@ -70,28 +65,28 @@ RepairGUI::~RepairGUI()
// function : OnGUIEvent()
// purpose :
//=======================================================================
bool RepairGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
bool RepairGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
{
SalomeApp_Application* app = getGeometryGUI()->getApp();
if (!app) return false;
if ( !app ) return false;
getGeometryGUI()->EmitSignalDeactivateDialog();
QDialog* aDlg = NULL;
switch (theCommandID) {
case 601: aDlg = new RepairGUI_SewingDlg (getGeometryGUI(), parent, ""); break;
case 602: aDlg = new RepairGUI_GlueDlg (getGeometryGUI(), parent, ""); break;
case 603: aDlg = new RepairGUI_SuppressFacesDlg (getGeometryGUI(), parent, ""); break;
case 604: aDlg = new RepairGUI_RemoveHolesDlg (getGeometryGUI(), parent, ""); break;
case 605: aDlg = new RepairGUI_ShapeProcessDlg (getGeometryGUI(), parent, ""); break;
case 606: aDlg = new RepairGUI_CloseContourDlg (getGeometryGUI(), parent, ""); break;
case 607: aDlg = new RepairGUI_RemoveIntWiresDlg(getGeometryGUI(), parent, ""); break;
case 608: aDlg = new RepairGUI_DivideEdgeDlg (getGeometryGUI(), parent, ""); break;
case 609: aDlg = new RepairGUI_FreeBoundDlg (getGeometryGUI(), parent, ""); break;
case 610: aDlg = new RepairGUI_FreeFacesDlg (getGeometryGUI(), parent, ""); break;
case 611: aDlg = new RepairGUI_ChangeOrientationDlg (getGeometryGUI(), parent, ""); break;
switch ( theCommandID ) {
case 601: aDlg = new RepairGUI_SewingDlg ( getGeometryGUI(), parent ); break;
case 602: aDlg = new RepairGUI_GlueDlg ( getGeometryGUI(), parent ); break;
case 603: aDlg = new RepairGUI_SuppressFacesDlg ( getGeometryGUI(), parent ); break;
case 604: aDlg = new RepairGUI_RemoveHolesDlg ( getGeometryGUI(), parent ); break;
case 605: aDlg = new RepairGUI_ShapeProcessDlg ( getGeometryGUI(), parent ); break;
case 606: aDlg = new RepairGUI_CloseContourDlg ( getGeometryGUI(), parent ); break;
case 607: aDlg = new RepairGUI_RemoveIntWiresDlg ( getGeometryGUI(), parent ); break;
case 608: aDlg = new RepairGUI_DivideEdgeDlg ( getGeometryGUI(), parent ); break;
case 609: aDlg = new RepairGUI_FreeBoundDlg ( getGeometryGUI(), parent ); break;
case 610: aDlg = new RepairGUI_FreeFacesDlg ( getGeometryGUI(), parent ); break;
case 611: aDlg = new RepairGUI_ChangeOrientationDlg ( getGeometryGUI(), parent ); break;
default:
app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
break;
}
@ -108,7 +103,7 @@ bool RepairGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
extern "C"
{
#ifdef WNT
__declspec( dllexport )
__declspec( dllexport )
#endif
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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
#define REPAIRGUI_H
#include "GEOMGUI.h"
#include "GEOMBase.h"
#include <GEOMGUI.h>
//=================================================================================
// class : RepairGUI
@ -38,10 +35,10 @@
class RepairGUI : public GEOMGUI
{
public:
RepairGUI( GeometryGUI* parent );
RepairGUI( GeometryGUI* );
~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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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 "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include "SUIT_Session.h"
#include "SALOME_ListIteratorOfListIO.hxx"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#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 <qlabel.h>
using namespace std;
//=================================================================================
// class : RepairGUI_ChangeOrientationDlg()
// 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
// TRUE to construct a modal dialog.
//=================================================================================
RepairGUI_ChangeOrientationDlg::RepairGUI_ChangeOrientationDlg(GeometryGUI* theGeometryGUI,
QWidget* parent, const char* name,
bool modal, WFlags fl)
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
RepairGUI_ChangeOrientationDlg::RepairGUI_ChangeOrientationDlg( GeometryGUI* theGeometryGUI,
QWidget* parent,
bool modal )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal )
{
//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 image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CHANGE_ORIENTATION" ) ));
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"));
RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_CHANGE_ORIENTATION_TITLE" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_1Sel1Check_QTD(this, "GroupPoints");
GroupPoints->GroupBox1->setTitle(tr("GEOM_CHANGE_ORIENTATION"));
GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY"));
GroupPoints->PushButton1->setPixmap(image1);
GroupPoints = new DlgRef_1Sel1Check( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_CHANGE_ORIENTATION" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) );
GroupPoints->PushButton1->setIcon( image1 );
// GroupPoints->LineEdit1->setReadOnly( true );
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
Layout1->addWidget(GroupPoints, 2, 0);
setHelpFileName("change_orientation.htm");
setHelpFileName( "change_orientation.htm" );
Init();
}
@ -98,21 +99,21 @@ void RepairGUI_ChangeOrientationDlg::Init()
/* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->CheckButton1->setChecked(true);
GroupPoints->CheckButton1->setChecked( true );
myOkObject = false;
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
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(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "CHANGE_ORIENTATION_NEW_OBJ_NAME" ) );
}
@ -136,12 +137,12 @@ void RepairGUI_ChangeOrientationDlg::ClickOnOk()
bool RepairGUI_ChangeOrientationDlg::ClickOnApply()
{
// if ( !onAccept() )
if ( !onAccept(GroupPoints->CheckButton1->isChecked()) )
if ( !onAccept( GroupPoints->CheckButton1->isChecked() ) )
return false;
initName();
myEditCurrentArgument->setText("");
myEditCurrentArgument->setText( "" );
return true;
}
@ -153,12 +154,12 @@ bool RepairGUI_ChangeOrientationDlg::ClickOnApply()
//=================================================================================
void RepairGUI_ChangeOrientationDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("");
myEditCurrentArgument->setText( "" );
QString aName;
if(myEditCurrentArgument == GroupPoints->LineEdit1) {
if (IObjectCount() != 1) {
if (myEditCurrentArgument == GroupPoints->LineEdit1)
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
if ( IObjectCount() != 1 ) {
if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
myOkObject = false;
return;
}
@ -168,17 +169,16 @@ void RepairGUI_ChangeOrientationDlg::SelectionIntoArgument()
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_ptr aSelectedObject =
GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
if (!testResult)
if ( !testResult )
return;
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
myObject = aSelectedObject;
myOkObject = true;
}
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
}
@ -190,8 +190,7 @@ void RepairGUI_ChangeOrientationDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
if( send == GroupPoints->PushButton1 )
{
if ( send == GroupPoints->PushButton1 ) {
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
}
@ -206,7 +205,7 @@ void RepairGUI_ChangeOrientationDlg::SetEditCurrentArgument()
void RepairGUI_ChangeOrientationDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == GroupPoints->LineEdit1 ) {
if ( send == GroupPoints->LineEdit1 ) {
myEditCurrentArgument = GroupPoints->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed();
}
@ -220,9 +219,8 @@ void RepairGUI_ChangeOrientationDlg::LineEditReturnPressed()
void RepairGUI_ChangeOrientationDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
}
@ -230,9 +228,9 @@ void RepairGUI_ChangeOrientationDlg::ActivateThisDialog()
// function : enterEvent()
// 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();
}
@ -241,7 +239,7 @@ void RepairGUI_ChangeOrientationDlg::enterEvent(QEvent* e)
// function : closeEvent()
// purpose :
//=================================================================================
void RepairGUI_ChangeOrientationDlg::closeEvent(QCloseEvent* e)
void RepairGUI_ChangeOrientationDlg::closeEvent( QCloseEvent* e )
{
//myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
@ -262,7 +260,7 @@ GEOM::GEOM_IOperations_ptr RepairGUI_ChangeOrientationDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool RepairGUI_ChangeOrientationDlg::isValid( QString& msg )
bool RepairGUI_ChangeOrientationDlg::isValid( QString& )
{
return myOkObject;
}
@ -277,11 +275,11 @@ bool RepairGUI_ChangeOrientationDlg::execute( ObjectList& objects )
bool toCreateCopy = GroupPoints->CheckButton1->isChecked();
GEOM::GEOM_Object_var anObj;
if(toCreateCopy) {
anObj = GEOM::GEOM_IHealingOperations::_narrow(getOperation())->ChangeOrientationCopy(myObject);
if ( toCreateCopy ) {
anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->ChangeOrientationCopy( myObject );
}
else {
anObj = GEOM::GEOM_IHealingOperations::_narrow(getOperation())->ChangeOrientation(myObject);
anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->ChangeOrientation( myObject );
}
if ( !anObj->_is_nil() )
@ -295,7 +293,7 @@ bool RepairGUI_ChangeOrientationDlg::execute( ObjectList& objects )
// function : CreateCopyModeChanged()
// 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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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
#define DIALOGBOX_CHANGEORIENTATION_H
#ifndef REPAIRGUI_CHANGEORIENTATIONDLG_H
#define REPAIRGUI_CHANGEORIENTATIONDLG_H
#include "GEOMBase_Skeleton.h"
#include "DlgRef_1Sel1Check_QTD.h"
#include <qcheckbox.h>
#include <GEOMBase_Skeleton.h>
//#include <TColStd_IndexedMapOfInteger.hxx>
class DlgRef_1Sel1Check;
//=================================================================================
// class : RepairGUI_ChangeOrientationDlg
@ -40,38 +36,37 @@
//=================================================================================
class RepairGUI_ChangeOrientationDlg : public GEOMBase_Skeleton
{
Q_OBJECT
Q_OBJECT
public:
RepairGUI_ChangeOrientationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0,
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_ChangeOrientationDlg();
RepairGUI_ChangeOrientationDlg( GeometryGUI*, QWidget* = 0, bool = false );
~RepairGUI_ChangeOrientationDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
private :
void Init();
void enterEvent(QEvent* e);
void closeEvent(QCloseEvent* e);
GEOM::GEOM_Object_var myObject;
bool myOkObject;
DlgRef_1Sel1Check_QTD* GroupPoints;
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
private:
void Init();
void enterEvent( QEvent* );
void closeEvent( QCloseEvent* );
private:
GEOM::GEOM_Object_var myObject;
bool myOkObject;
DlgRef_1Sel1Check* GroupPoints;
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void CreateCopyModeChanged(bool isCreateCopy);
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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 "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include "SUIT_Session.h"
#include "SALOME_ListIteratorOfListIO.hxx"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#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 <TColStd_IndexedMapOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <qlabel.h>
using namespace std;
//=================================================================================
// class : RepairGUI_CloseContourDlg()
// 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
// TRUE to construct a modal dialog.
//=================================================================================
RepairGUI_CloseContourDlg::RepairGUI_CloseContourDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl)
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
RepairGUI_CloseContourDlg::RepairGUI_CloseContourDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
bool modal )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal )
{
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CLOSECONTOUR")));
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CLOSECONTOUR" ) ) );
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"));
RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_CLOSECONTOUR_TITLE" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints");
GroupPoints->GroupBox1->setTitle(tr("Contour to close"));
GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
GroupPoints->PushButton1->setPixmap(image1);
GroupPoints = new DlgRef_2SelExt( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "Contour to close" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
GroupPoints->PushButton1->setIcon( image1 );
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" );
mySelectWiresBtn->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, mySelectWiresBtn->sizePolicy().hasHeightForWidth() ) );
mySelectWiresBtn->setText( trUtf8( "" ) );
mySelectWiresBtn->setPixmap(image1);
QRadioButton* rb1 = new QRadioButton( tr( "Close by common vertex" ), GroupPoints->Box );
QRadioButton* rb2 = new QRadioButton( tr( "Close by new edge" ), GroupPoints->Box );
mySelectWiresEdt = new QLineEdit( GroupPoints->GroupBox1, "mySelectWiresEdt" );
mySelectWiresEdt->setReadOnly( true );
myIsVertexGr = new QButtonGroup( GroupPoints->Box );
myIsVertexGr->addButton( rb1, 0 );
myIsVertexGr->addButton( rb2, 1 );
rb1->setChecked( true );
mySelectWiresLbl = new QLabel( tr( "Contour to close" ), GroupPoints->GroupBox1, "ContourLbl" );
mySelectWiresLbl->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, mySelectWiresLbl->sizePolicy().hasHeightForWidth() ) );
QVBoxLayout* l = new QVBoxLayout( GroupPoints->Box );
l->setMargin( 0 ); l->setSpacing( 6 );
l->addWidget( rb1 );
l->addWidget( rb2 );
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 );
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
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();
}
@ -135,16 +125,16 @@ void RepairGUI_CloseContourDlg::Init()
initSelection();
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(mySelectWiresBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(mySelectWiresEdt, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "CLOSE_CONTOUR_NEW_OBJ_NAME" ) );
}
@ -174,7 +164,7 @@ bool RepairGUI_CloseContourDlg::ClickOnApply()
initName();
myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setText("");
myEditCurrentArgument->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
myWiresInd->length( 0 );
@ -192,33 +182,29 @@ void RepairGUI_CloseContourDlg::SelectionIntoArgument()
{
erasePreview();
myEditCurrentArgument->setText( "" );
mySelectWiresEdt->setText( "" );
GroupPoints->LineEdit2->setText( "" );
if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
myObject = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == mySelectWiresEdt )
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
myWiresInd->length( 0 );
if ( IObjectCount() == 1 )
{
if ( IObjectCount() == 1 ) {
Handle(SALOME_InteractiveObject) anIO = firstIObject();
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) // face selection
{
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { // face selection
Standard_Boolean aRes;
myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( aRes && GEOMBase::IsShape( myObject ) )
{
if ( aRes && GEOMBase::IsShape( myObject ) ) {
myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
TopoDS_Shape aShape;
if ( GEOMBase::GetShape( myObject, aShape, TopAbs_WIRE ) )
mySelectWiresEdt->setText( myEditCurrentArgument->text() );
GroupPoints->LineEdit2->setText( myEditCurrentArgument->text() );
}
else
myObject = GEOM::GEOM_Object::_nil();
}
else if ( myEditCurrentArgument == mySelectWiresEdt )
{
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
TColStd_IndexedMapOfInteger aMap;
myGeomGUI->getApp()->selectionMgr()->GetIndexes( anIO, aMap );
const int n = aMap.Extent();
@ -240,10 +226,9 @@ void RepairGUI_CloseContourDlg::SetEditCurrentArgument()
const QObject* send = sender();
if ( send == GroupPoints->PushButton1 )
myEditCurrentArgument = GroupPoints->LineEdit1;
else if ( send == mySelectWiresBtn && !myObject->_is_nil() )
myEditCurrentArgument = mySelectWiresEdt;
if ( myEditCurrentArgument )
{
else if ( send == GroupPoints->PushButton2 && !myObject->_is_nil() )
myEditCurrentArgument = GroupPoints->LineEdit2;
if ( myEditCurrentArgument ) {
initSelection();
myEditCurrentArgument->setFocus();
SelectionIntoArgument();
@ -258,8 +243,7 @@ void RepairGUI_CloseContourDlg::SetEditCurrentArgument()
void RepairGUI_CloseContourDlg::LineEditReturnPressed()
{
const QObject* send = sender();
if( send == GroupPoints->LineEdit1 || send == mySelectWiresEdt )
{
if ( send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2 ) {
myEditCurrentArgument = (QLineEdit*)send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
@ -273,12 +257,12 @@ void RepairGUI_CloseContourDlg::LineEditReturnPressed()
void RepairGUI_CloseContourDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setText("");
mySelectWiresEdt->setText("");
myEditCurrentArgument->setText( "" );
GroupPoints->LineEdit2->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
myWiresInd->length( 0 );
@ -291,9 +275,9 @@ void RepairGUI_CloseContourDlg::ActivateThisDialog()
// function : enterEvent()
// 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();
}
@ -302,7 +286,7 @@ void RepairGUI_CloseContourDlg::enterEvent(QEvent* e)
// function : closeEvent()
// purpose :
//=================================================================================
void RepairGUI_CloseContourDlg::closeEvent(QCloseEvent* e)
void RepairGUI_CloseContourDlg::closeEvent( QCloseEvent* e )
{
//myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
@ -321,7 +305,7 @@ GEOM::GEOM_IOperations_ptr RepairGUI_CloseContourDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool RepairGUI_CloseContourDlg::isValid( QString& msg )
bool RepairGUI_CloseContourDlg::isValid( QString& )
{
TopoDS_Shape aTmpShape;
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
{
return myIsVertexGr->find( 0 )->isOn();
return myIsVertexGr->button( 0 )->isChecked();
}
//=================================================================================
@ -356,8 +340,7 @@ bool RepairGUI_CloseContourDlg::getIsByVertex() const
//=================================================================================
void RepairGUI_CloseContourDlg::initSelection()
{
if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
{
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
TColStd_MapOfInteger aTypes;
aTypes.Add( GEOM_COMPOUND );
aTypes.Add( GEOM_SOLID );
@ -367,8 +350,7 @@ void RepairGUI_CloseContourDlg::initSelection()
globalSelection( aTypes );
}
else if ( myEditCurrentArgument == mySelectWiresEdt )
{
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
localSelection( myObject, TopAbs_EDGE );
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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
#define DIALOGBOX_CloseContour_H
#ifndef REPAIRGUI_CLOSECONTOURDLG_H
#define REPAIRGUI_CLOSECONTOURDLG_H
#include "GEOMBase_Skeleton.h"
#include "DlgRef_1Sel_Ext.h"
#include <GEOMBase_Skeleton.h>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <qradiobutton.h>
#include <qbuttongroup.h>
class DlgRef_2SelExt;
class QButtonGroup;
//=================================================================================
// class : RepairGUI_CloseContourDlg
@ -42,45 +37,42 @@
//=================================================================================
class RepairGUI_CloseContourDlg : public GEOMBase_Skeleton
{
Q_OBJECT
Q_OBJECT
public:
RepairGUI_CloseContourDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0,
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_CloseContourDlg();
RepairGUI_CloseContourDlg( GeometryGUI*, QWidget* = 0, bool = false );
~RepairGUI_CloseContourDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
private:
void Init();
void enterEvent( QEvent* );
void closeEvent( QCloseEvent* );
void initSelection();
bool getIsByVertex() const;
private:
void Init();
void enterEvent(QEvent* e);
void closeEvent(QCloseEvent* e);
void initSelection();
bool getIsByVertex() const;
GEOM::GEOM_Object_var myObject;
GEOM::short_array_var myWiresInd;
DlgRef_1Sel_Ext* GroupPoints;
QButtonGroup* myIsVertexGr;
QLabel* mySelectWiresLbl;
QPushButton* mySelectWiresBtn;
QLineEdit* mySelectWiresEdt;
GEOM::GEOM_Object_var myObject;
GEOM::short_array_var myWiresInd;
DlgRef_2SelExt* GroupPoints;
QButtonGroup* myIsVertexGr;
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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 "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include "SUIT_Session.h"
#include "SALOME_ListIteratorOfListIO.hxx"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#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 <qlabel.h>
using namespace std;
#include <TColStd_IndexedMapOfInteger.hxx>
//=================================================================================
// class : RepairGUI_DivideEdgeDlg()
@ -48,49 +46,56 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
RepairGUI_DivideEdgeDlg::RepairGUI_DivideEdgeDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl)
: GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
RepairGUI_DivideEdgeDlg::RepairGUI_DivideEdgeDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
bool modal )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal )
{
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 image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_DIVIDE_EDGE" ) ) );
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"));
RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
mainFrame()->GroupConstructors->setTitle(tr("GEOM_DIVIDE_EDGE_TITLE"));
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints");
GroupPoints->GroupBox1->setTitle(tr("GEOM_ADD_POINT"));
GroupPoints->TextLabel1->setText(tr("GEOM_EDGE"));
GroupPoints->PushButton1->setPixmap(image1);
GroupPoints = new DlgRef_1SelExt( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_ADD_POINT" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_EDGE" ) );
GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true );
myIsParameterGr = new QButtonGroup( 2, Qt::Vertical, GroupPoints );
myIsParameterGr->setFrameStyle( QFrame::NoFrame );
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();
QRadioButton* rb1 = new QRadioButton( tr( "GEOM_BY_PARAMETER" ), GroupPoints->Box );
QRadioButton* rb2 = new QRadioButton( tr( "GEOM_BY_LENGTH" ), GroupPoints->Box );
QGridLayout* aLay = new QGridLayout( 0, 1, 2, 0, 6, "aLay" );
myValEdt = new QtxDblSpinBox(0., 1., 0.1, GroupPoints->GroupBox1);
myValEdt->setPrecision( 3 );
myIsParameterGr = new QButtonGroup( GroupPoints->Box );
myIsParameterGr->addButton( rb1, 0 );
myIsParameterGr->addButton( rb2, 1 );
rb1->setChecked( true );
myValEdt = new QDoubleSpinBox( GroupPoints->Box );
initSpinBox( myValEdt, 0., 1., 0.1, 3 );
myValEdt->setValue( 0.5 );
QLabel* aLbl1 = new QLabel( tr( "GEOM_VALUE" ), GroupPoints->GroupBox1 );
aLay->addWidget( aLbl1, 0, 0 );
aLay->addWidget( myValEdt, 0, 1 );
QLabel* aLbl1 = new QLabel( tr( "GEOM_VALUE" ), GroupPoints->Box );
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();
}
@ -119,14 +124,14 @@ void RepairGUI_DivideEdgeDlg::Init()
initSelection();
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "DEVIDE_EDGE_NEW_OBJECT_NAME" ) );
}
@ -154,7 +159,7 @@ bool RepairGUI_DivideEdgeDlg::ClickOnApply()
initName();
myEditCurrentArgument->setText("");
myEditCurrentArgument->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
myIndex = -1;
@ -171,24 +176,21 @@ bool RepairGUI_DivideEdgeDlg::ClickOnApply()
//=================================================================================
void RepairGUI_DivideEdgeDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("");
myEditCurrentArgument->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
myIndex = -1;
if ( IObjectCount() == 1 )
{
if ( IObjectCount() == 1 ) {
Handle(SALOME_InteractiveObject) anIO = firstIObject();
Standard_Boolean 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;
if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) )
{
if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) {
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;
TColStd_IndexedMapOfInteger aMap;
@ -196,20 +198,20 @@ void RepairGUI_DivideEdgeDlg::SelectionIntoArgument()
(SalomeApp_Application*)(SUIT_Session::session()->activeApplication());
anApp->selectionMgr()->GetIndexes( anIO, aMap );
if ( !aMap.IsEmpty() ) // subshape selection
{
if ( !aMap.IsEmpty() ) {
// subshape selection
myIndex = aMap( 1 );
myObject = aSelectedObj;
myEditCurrentArgument->setText( tr( "GEOM_EDGE" ) + "_1" );
}
else if ( aType == TopAbs_EDGE ) // single shape selection
{
else if ( aType == TopAbs_EDGE ) {
// single shape selection
myIndex = -1;
myObject = aSelectedObj;
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;
myObject = GEOM::GEOM_Object::_nil();
}
@ -225,8 +227,7 @@ void RepairGUI_DivideEdgeDlg::SelectionIntoArgument()
//=================================================================================
void RepairGUI_DivideEdgeDlg::SetEditCurrentArgument()
{
if( sender() == GroupPoints->PushButton1 )
{
if ( sender() == GroupPoints->PushButton1 ) {
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
}
@ -240,8 +241,7 @@ void RepairGUI_DivideEdgeDlg::SetEditCurrentArgument()
//=================================================================================
void RepairGUI_DivideEdgeDlg::LineEditReturnPressed()
{
if( sender() == GroupPoints->LineEdit1 )
{
if ( sender() == GroupPoints->LineEdit1 ) {
myEditCurrentArgument = GroupPoints->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed();
}
@ -255,8 +255,8 @@ void RepairGUI_DivideEdgeDlg::LineEditReturnPressed()
void RepairGUI_DivideEdgeDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
myObject = GEOM::GEOM_Object::_nil();
myIndex = -1;
@ -269,9 +269,9 @@ void RepairGUI_DivideEdgeDlg::ActivateThisDialog()
// function : enterEvent()
// 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();
}
@ -279,7 +279,7 @@ void RepairGUI_DivideEdgeDlg::enterEvent(QEvent* e)
// function : closeEvent()
// purpose :
//=================================================================================
void RepairGUI_DivideEdgeDlg::closeEvent(QCloseEvent* e)
void RepairGUI_DivideEdgeDlg::closeEvent( QCloseEvent* e )
{
//myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
@ -299,7 +299,7 @@ GEOM::GEOM_IOperations_ptr RepairGUI_DivideEdgeDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool RepairGUI_DivideEdgeDlg::isValid( QString& msg )
bool RepairGUI_DivideEdgeDlg::isValid( QString& )
{
return !myObject->_is_nil();
}
@ -325,7 +325,7 @@ bool RepairGUI_DivideEdgeDlg::execute( ObjectList& objects )
//=================================================================================
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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
#define DIALOGBOX_DivideEdge_H
#ifndef REPAIRGUI_DIVIDEEDGEDLG_H
#define REPAIRGUI_DIVIDEEDGEDLG_H
#include "GEOMBase_Skeleton.h"
#include "DlgRef_1Sel_Ext.h"
#include "QtxDblSpinBox.h"
#include <GEOMBase_Skeleton.h>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <qradiobutton.h>
#include <qbuttongroup.h>
class DlgRef_1SelExt;
class QDoubleSpinBox;
class QButtonGroup;
//=================================================================================
// class : RepairGUI_DivideEdgeDlg
@ -43,43 +38,43 @@
//=================================================================================
class RepairGUI_DivideEdgeDlg : public GEOMBase_Skeleton
{
Q_OBJECT
Q_OBJECT
public:
RepairGUI_DivideEdgeDlg (GeometryGUI* theGeometryGUI, QWidget* parent = 0,
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_DivideEdgeDlg();
RepairGUI_DivideEdgeDlg( GeometryGUI*, QWidget* = 0, bool = false );
~RepairGUI_DivideEdgeDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
private:
void Init();
void enterEvent(QEvent* e);
void closeEvent(QCloseEvent* e);
void initSelection();
bool getIsByParameter() const;
GEOM::GEOM_Object_var myObject;
int myIndex;
DlgRef_1Sel_Ext* GroupPoints;
QButtonGroup* myIsParameterGr;
QtxDblSpinBox* myValEdt;
void Init();
void enterEvent( QEvent* );
void closeEvent( QCloseEvent* );
void initSelection();
bool getIsByParameter() const;
private:
GEOM::GEOM_Object_var myObject;
int myIndex;
DlgRef_1SelExt* GroupPoints;
QButtonGroup* myIsParameterGr;
QDoubleSpinBox* myValEdt;
protected slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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 "GEOMBase.h"
#include "GeometryGUI.h"
#include "GEOM_Displayer.h"
#include "GEOMImpl_Types.hxx"
#include "SalomeApp_Application.h"
#include "LightApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include "SUIT_MessageBox.h"
#include "SUIT_Session.h"
#include <GEOMBase.h>
#include <GeometryGUI.h>
#include <GEOM_Displayer.h>
#include <GEOMImpl_Types.hxx>
#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 <qlineedit.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qgroupbox.h>
#include <qpushbutton.h>
#include <QLineEdit>
#include <QLabel>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QGridLayout>
#include <QGroupBox>
#include <QPushButton>
#include <QKeyEvent>
#define SPACING 5
#define MARGIN 10
#define SPACING 6
#define MARGIN 9
/*!
Class : RepairGUI_FreeBoundDlg
@ -58,37 +61,47 @@
// function : RepairGUI_FreeBoundDlg
// purpose : Constructor
//=================================================================================
RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg(GeometryGUI* theGUI, QWidget* theParent, const char*)
: QDialog( theParent, "RepairGUI_FreeBoundDlg", false,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( theParent ) ),
myGeomGUI( theGUI )
RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg( GeometryGUI* theGUI, QWidget* theParent )
: QDialog( theParent, false ),
GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( theParent ) ),
myGeomGUI( theGUI )
{
setCaption( tr( "CAPTION" ) );
setAttribute( Qt::WA_DeleteOnClose );
QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) );
setWindowTitle( tr( "CAPTION" ) );
QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, tr( "FREE_BOUND" ), this );
QGroupBox* aMainGrp = new QGroupBox( tr( "FREE_BOUND" ), this );
QGroupBox* aSelGrp = new QGroupBox( 1, Qt::Vertical, aMainGrp );
aSelGrp->setInsideMargin( 0 );
aSelGrp->setFrameStyle( QFrame::NoFrame );
new QLabel( tr( "GEOM_OBJECT" ), aSelGrp );
( new QPushButton( aSelGrp ) )->setPixmap( iconSelect );
myEdit = new QLineEdit( aSelGrp );
QLabel* lab = new QLabel( tr( "GEOM_OBJECT" ), aMainGrp );
QPushButton* btn = new QPushButton( aMainGrp );
btn->setIcon( iconSelect );
myEdit = new QLineEdit( aMainGrp );
myEdit->setReadOnly( true );
myEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
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 );
aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
QPushButton* aCloseBtn = new QPushButton( tr( "GEOM_BUT_CLOSE" ), 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->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
aBtnLay->addSpacing( SPACING ); aBtnLay->addStretch();
aBtnLay->addWidget( aHelpBtn );
QVBoxLayout* aLay = new QVBoxLayout( this );
@ -100,7 +113,7 @@ RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg(GeometryGUI* theGUI, QWidget* the
myHelpFileName = "check_free_boundaries.htm";
connect( aCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) );
connect( aHelpBtn, SIGNAL( clicked() ), SLOT( onHelp() ) );
connect( aHelpBtn, SIGNAL( clicked() ), SLOT( onHelp() ) );
Init();
}
@ -120,7 +133,7 @@ RepairGUI_FreeBoundDlg::~RepairGUI_FreeBoundDlg()
void RepairGUI_FreeBoundDlg::onClose()
{
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 );
reject();
erasePreview();
@ -132,20 +145,21 @@ void RepairGUI_FreeBoundDlg::onClose()
//=================================================================================
void RepairGUI_FreeBoundDlg::onHelp()
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
app->onHelpContextModule(myGeomGUI ? app->moduleName(myGeomGUI->moduleName()) : QString(""), myHelpFileName);
LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
if ( app )
app->onHelpContextModule( myGeomGUI ? app->moduleName( myGeomGUI->moduleName() ) : QString(""), myHelpFileName );
else {
QString platform;
QString platform;
#ifdef WIN32
platform = "winapplication";
platform = "winapplication";
#else
platform = "application";
platform = "application";
#endif
SUIT_MessageBox::warn1
(0, tr("WRN_WARNING"), tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
tr("BUT_OK"));
SUIT_MessageBox::warning( this,
tr( "WRN_WARNING" ),
tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
arg( app->resourceMgr()->stringValue( "ExternalBrowser",
platform ) ).arg( myHelpFileName ) );
}
}
@ -155,9 +169,9 @@ void RepairGUI_FreeBoundDlg::onHelp()
//=================================================================================
void RepairGUI_FreeBoundDlg::onDeactivate()
{
setEnabled(false);
setEnabled( false );
globalSelection();
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
myGeomGUI->SetActiveDialogBox( 0 );
}
@ -170,7 +184,7 @@ void RepairGUI_FreeBoundDlg::onActivate()
myGeomGUI->EmitSignalDeactivateDialog();
setEnabled( true );
myGeomGUI->SetActiveDialogBox( this );
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
activateSelection();
onSelectionDone();
@ -182,7 +196,7 @@ void RepairGUI_FreeBoundDlg::onActivate()
//=================================================================================
void RepairGUI_FreeBoundDlg::onSelectionDone()
{
if( IObjectCount() != 1 )
if ( IObjectCount() != 1 )
return;
Standard_Boolean isOk = Standard_False;
@ -191,8 +205,7 @@ void RepairGUI_FreeBoundDlg::onSelectionDone()
if ( !isOk || anObj->_is_nil() || !GEOMBase::IsShape( anObj ) )
return;
else
{
else {
myObj = anObj;
displayPreview( false, true, true, 3 );
}
@ -208,7 +221,7 @@ void RepairGUI_FreeBoundDlg::Init()
myObj = GEOM::GEOM_Object::_nil();
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() ) );
activateSelection();
@ -219,7 +232,7 @@ void RepairGUI_FreeBoundDlg::Init()
// function : enterEvent
// purpose : Activate dialog
//=================================================================================
void RepairGUI_FreeBoundDlg::enterEvent( QEvent* e )
void RepairGUI_FreeBoundDlg::enterEvent( QEvent* )
{
onActivate();
}
@ -228,7 +241,7 @@ void RepairGUI_FreeBoundDlg::enterEvent( QEvent* e )
// function : closeEvent
// purpose : Close dialog
//=================================================================================
void RepairGUI_FreeBoundDlg::closeEvent( QCloseEvent* e )
void RepairGUI_FreeBoundDlg::closeEvent( QCloseEvent* )
{
onClose();
}
@ -260,7 +273,7 @@ GEOM::GEOM_IOperations_ptr RepairGUI_FreeBoundDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool RepairGUI_FreeBoundDlg::isValid( QString& msg )
bool RepairGUI_FreeBoundDlg::isValid( QString& )
{
return !myObj->_is_nil();
}
@ -279,8 +292,7 @@ bool RepairGUI_FreeBoundDlg::execute( ObjectList& objects )
bool result = GEOM::GEOM_IHealingOperations::_narrow(
getOperation() )->GetFreeBoundary( myObj, aClosed, anOpen );
if ( result )
{
if ( result ) {
myNbClosed = aClosed->length();
myNbOpen = anOpen->length();
int i;
@ -295,8 +307,7 @@ bool RepairGUI_FreeBoundDlg::execute( ObjectList& objects )
aLabelText = tr( "NUMBER_OPEN" ) + QString( "%1" ).arg( myNbOpen );
myOpenLbl->setText( aLabelText );
}
else
{
else {
myEdit->setText( GEOMBase::GetName( myObj ) );
myClosedLbl->setText( tr( "NUMBER_CLOSED" ) );
myOpenLbl->setText( tr( "NUMBER_OPEN" ) );
@ -315,9 +326,8 @@ void RepairGUI_FreeBoundDlg::keyPressEvent( QKeyEvent* e )
if ( e->isAccepted() )
return;
if ( e->key() == Key_F1 )
{
e->accept();
onHelp();
}
if ( e->key() == Qt::Key_F1 ) {
e->accept();
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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
#define DIALOGBOX_WHATIS_H
#ifndef REPAIRGUI_FREEBOUNDDLG_H
#define REPAIRGUI_FREEBOUNDDLG_H
#include <qdialog.h>
#include "GEOMBase_Helper.h"
#include <QDialog>
#include <GEOMBase_Helper.h>
class QLineEdit;
class QLabel;
class GEOM_Displayer;
class GeometryGUI;
//=================================================================================
@ -43,11 +40,11 @@ class GeometryGUI;
class RepairGUI_FreeBoundDlg : public QDialog,
public GEOMBase_Helper
{
Q_OBJECT
Q_OBJECT
public:
RepairGUI_FreeBoundDlg(GeometryGUI*, QWidget*, const char* name = 0);
~RepairGUI_FreeBoundDlg();
RepairGUI_FreeBoundDlg( GeometryGUI*, QWidget* );
~RepairGUI_FreeBoundDlg();
private slots:
void onClose();
@ -58,13 +55,13 @@ private slots:
private:
void Init();
void enterEvent( QEvent* e );
void closeEvent( QCloseEvent* e );
void keyPressEvent( QKeyEvent* e );
void enterEvent( QEvent* );
void closeEvent( QCloseEvent* );
void keyPressEvent( QKeyEvent* );
void activateSelection();
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool execute( ObjectList& objects );
virtual bool execute( ObjectList& );
virtual bool isValid( QString& );
private:
@ -78,4 +75,4 @@ private:
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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 "LightApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include "SalomeApp_Application.h"
#include "SalomeApp_Tools.h"
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_Tools.h>
#include "SUIT_MessageBox.h"
#include "SUIT_Session.h"
#include "SUIT_OverrideCursor.h"
#include <SUIT_MessageBox.h>
#include <SUIT_Session.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 <TColStd_MapOfInteger.hxx>
#include <TopExp.hxx>
#include "GEOMBase.h"
#include "GeometryGUI.h"
#include "GEOM_Displayer.h"
#include <qapplication.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qgroupbox.h>
#include <qpushbutton.h>
#define SPACING 5
#define MARGIN 10
#include <GEOMBase.h>
#include <GeometryGUI.h>
#include <GEOM_Displayer.h>
#include <QLineEdit>
#include <QLabel>
#include <QGroupBox>
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QKeyEvent>
#define SPACING 6
#define MARGIN 9
#define MIN_WIDTH 200
using namespace std;
//=================================================================================
// class : RepairGUI_FreeFacesDlg()
// 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
// TRUE to construct a modal dialog.
//=================================================================================
RepairGUI_FreeFacesDlg::RepairGUI_FreeFacesDlg(GeometryGUI* GUI, QWidget* parent,
const char* name, bool modal, WFlags fl)
:QDialog(parent, "RepairGUI_FreeBoundDlg", false,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
GEOMBase_Helper(dynamic_cast<SUIT_Desktop*>(parent)),
myGeomGUI(GUI)
RepairGUI_FreeFacesDlg::RepairGUI_FreeFacesDlg( GeometryGUI* GUI, QWidget* parent,
bool modal )
: QDialog( parent, false ),
GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) ),
myGeomGUI( GUI ),
myDisplayer( 0 )
{
myDisplayer = 0;
setAttribute( Qt::WA_DeleteOnClose );
setSizeGripEnabled( TRUE );
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
setSizeGripEnabled( true );
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 );
QGroupBox* aSelGrp = new QGroupBox( 1, Qt::Vertical, aMainGrp );
aSelGrp->setInsideMargin( 0 );
aSelGrp->setFrameStyle( QFrame::NoFrame );
new QLabel( tr( "GEOM_OBJECT" ), aSelGrp );
mySelBtn = new QPushButton( aSelGrp );
mySelBtn->setPixmap( image1 );
myEdit = new QLineEdit( aSelGrp );
QLabel* lab = new QLabel( tr( "GEOM_OBJECT" ), aMainGrp );
mySelBtn = new QPushButton( aMainGrp );
mySelBtn->setIcon( image1 );
myEdit = new QLineEdit( aMainGrp );
myEdit->setReadOnly( true );
myEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
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 );
aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
QPushButton* aCloseBtn = new QPushButton( tr( "GEOM_BUT_CLOSE" ), 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->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
aBtnLay->addSpacing( SPACING );
aBtnLay->addStretch();
aBtnLay->addWidget( aHelpBtn );
QVBoxLayout* aLay = new QVBoxLayout( this );
aLay->setSpacing( SPACING );
aLay->setMargin( MARGIN );
aLay->addWidget( aMainGrp );
aLay->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
aLay->addStretch();
aLay->addWidget( aFrame );
myHelpFileName = "check_free_faces.htm";
connect( aCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) );
connect( aHelpBtn, SIGNAL( clicked() ), SLOT( onHelp() ) );
connect( mySelBtn, SIGNAL( clicked() ),
this, SLOT ( onSetEditCurrentArgument() ) );
connect( aHelpBtn, SIGNAL( clicked() ), SLOT( onHelp() ) );
connect( mySelBtn, SIGNAL( clicked() ),
this, SLOT ( onSetEditCurrentArgument() ) );
/***************************************************************/
Init();
@ -141,7 +147,7 @@ RepairGUI_FreeFacesDlg::~RepairGUI_FreeFacesDlg()
void RepairGUI_FreeFacesDlg::onClose()
{
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 );
reject();
erasePreview();
@ -153,20 +159,22 @@ void RepairGUI_FreeFacesDlg::onClose()
//=================================================================================
void RepairGUI_FreeFacesDlg::onHelp()
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
app->onHelpContextModule(myGeomGUI ? app->moduleName(myGeomGUI->moduleName()) : QString(""), myHelpFileName);
LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
if ( app )
app->onHelpContextModule( myGeomGUI ? app->moduleName( myGeomGUI->moduleName() ) : QString(""), myHelpFileName );
else {
QString platform;
QString platform;
#ifdef WIN32
platform = "winapplication";
platform = "winapplication";
#else
platform = "application";
platform = "application";
#endif
SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
QObject::tr("BUT_OK"));
SUIT_MessageBox::warning( this,
tr( "WRN_WARNING" ),
tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
arg( app->resourceMgr()->stringValue( "ExternalBrowser",
platform ) ).
arg( myHelpFileName ) );
}
}
@ -176,9 +184,9 @@ void RepairGUI_FreeFacesDlg::onHelp()
//=================================================================================
void RepairGUI_FreeFacesDlg::onDeactivate()
{
setEnabled(false);
setEnabled( false );
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 );
}
@ -191,8 +199,8 @@ void RepairGUI_FreeFacesDlg::onActivate()
myGeomGUI->EmitSignalDeactivateDialog();
setEnabled( true );
myGeomGUI->SetActiveDialogBox( this );
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL( currentSelectionChanged() ), SLOT ( onSelectionDone() ) );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
activateSelection();
}
@ -206,7 +214,7 @@ void RepairGUI_FreeFacesDlg::Init()
/* signals and slots connections */
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() ) );
activateSelection();
@ -220,8 +228,7 @@ void RepairGUI_FreeFacesDlg::Init()
void RepairGUI_FreeFacesDlg::onSelectionDone()
{
erasePreview();
if( IObjectCount() != 1 )
{
if ( IObjectCount() != 1 ) {
myEdit->setText( "" );
return;
}
@ -230,13 +237,11 @@ void RepairGUI_FreeFacesDlg::onSelectionDone()
GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject( firstIObject(), isOk );
if ( !isOk || anObj->_is_nil() || !GEOMBase::IsShape( anObj ) )
{
if ( !isOk || anObj->_is_nil() || !GEOMBase::IsShape( anObj ) ) {
myEdit->setText( "" );
return;
}
else
{
else {
myObj = anObj;
displayPreview( false, true, true, 3 );
}
@ -246,7 +251,7 @@ void RepairGUI_FreeFacesDlg::onSelectionDone()
// function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it
//=================================================================================
void RepairGUI_FreeFacesDlg::enterEvent(QEvent* e)
void RepairGUI_FreeFacesDlg::enterEvent( QEvent* )
{
onActivate();
}
@ -267,7 +272,7 @@ void RepairGUI_FreeFacesDlg::activateSelection()
// function : closeEvent()
// purpose :
//=================================================================================
void RepairGUI_FreeFacesDlg::closeEvent(QCloseEvent* e)
void RepairGUI_FreeFacesDlg::closeEvent( QCloseEvent* )
{
onClose();
}
@ -285,7 +290,7 @@ GEOM::GEOM_IOperations_ptr RepairGUI_FreeFacesDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool RepairGUI_FreeFacesDlg::isValid( QString& msg )
bool RepairGUI_FreeFacesDlg::isValid( QString& )
{
return !myObj->_is_nil() ;
}
@ -302,12 +307,10 @@ bool RepairGUI_FreeFacesDlg::execute( ObjectList& objects )
TopoDS_Shape aSelShape;
TopoDS_Shape aFace;
TopTools_IndexedMapOfShape anIndices;
if ( !myObj->_is_nil() && GEOMBase::GetShape( myObj, aSelShape ) )
{
if ( !myObj->_is_nil() && GEOMBase::GetShape( myObj, aSelShape ) ) {
myEdit->setText( GEOMBase::GetName( myObj ) );
QString aMess;
if ( !isValid( aMess ) )
{
if ( !isValid( aMess ) ) {
erasePreview( true );
return false;
}
@ -317,11 +320,9 @@ bool RepairGUI_FreeFacesDlg::execute( ObjectList& objects )
TopExp::MapShapes( aSelShape, anIndices);
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] );
try
{
try {
getDisplayer()->SetColor( Quantity_NOC_RED );
getDisplayer()->SetToActivate( false );
aPrs = !aFace.IsNull() ? getDisplayer()->BuildPrs( aFace ) : 0;
@ -368,9 +369,8 @@ void RepairGUI_FreeFacesDlg::keyPressEvent( QKeyEvent* e )
if ( e->isAccepted() )
return;
if ( e->key() == Key_F1 )
{
e->accept();
onHelp();
}
if ( e->key() == Qt::Key_F1 ) {
e->accept();
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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
#define DIALOGBOX_FreeFaces_H
#ifndef REPAIRGUI_FREEFACESDLG_H
#define REPAIRGUI_FREEFACESDLG_H
#include <qdialog.h>
#include "GEOMBase_Helper.h"
#include <QDialog>
#include <GEOMBase_Helper.h>
class GEOM_Displayer;
class QPushButton;
@ -43,42 +41,41 @@ class GeometryGUI;
class RepairGUI_FreeFacesDlg : public QDialog,
public GEOMBase_Helper
{
Q_OBJECT
Q_OBJECT
public:
RepairGUI_FreeFacesDlg(GeometryGUI* GUI, QWidget* parent = 0,
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_FreeFacesDlg();
RepairGUI_FreeFacesDlg( GeometryGUI*, QWidget* = 0, bool = false );
~RepairGUI_FreeFacesDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
private:
void Init();
void enterEvent(QEvent* e);
void closeEvent(QCloseEvent* e);
void keyPressEvent(QKeyEvent* e);
void activateSelection();
GEOM_Displayer* getDisplayer();
void Init();
void enterEvent( QEvent* );
void closeEvent( QCloseEvent* );
void keyPressEvent( QKeyEvent* );
void activateSelection();
GEOM_Displayer* getDisplayer();
private slots:
void onClose();
void onHelp();
void onDeactivate();
void onActivate();
void onSelectionDone();
void onSetEditCurrentArgument();
void onClose();
void onHelp();
void onDeactivate();
void onActivate();
void onSelectionDone();
void onSetEditCurrentArgument();
private:
GEOM_Displayer* myDisplayer;
GEOM::GEOM_Object_var myObj;
QPushButton* mySelBtn;
QLineEdit* myEdit;
GeometryGUI* myGeomGUI;
QString myHelpFileName;
GEOM_Displayer* myDisplayer;
GEOM::GEOM_Object_var myObj;
QPushButton* mySelBtn;
QLineEdit* myEdit;
GeometryGUI* myGeomGUI;
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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 "DlgRef_1Sel_Ext.h"
#include "GEOMImpl_Types.hxx"
#include "QtxDblSpinBox.h"
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include "SalomeApp_Study.h"
#include "SalomeApp_Tools.h"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_Session.h"
#include "SUIT_MessageBox.h"
#include "SUIT_OverrideCursor.h"
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.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 <qapplication.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qhbox.h>
#include <qgrid.h>
using namespace std;
#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
// TRUE to construct a modal dialog.
//=================================================================================
RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl)
: GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
myCurrConstrId( -1 )
RepairGUI_GlueDlg::RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
bool modal )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal ),
myCurrConstrId( -1 )
{
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 image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
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 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"));
RadioButton1->setPixmap(image0);
RadioButton2->setPixmap(image2);
//RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_GLUE_TITLE" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setIcon( image2 );
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints");
GroupPoints->GroupBox1->setTitle(tr("GEOM_GLUE"));
GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
GroupPoints->PushButton1->setPixmap(image1);
GroupPoints = new DlgRef_1SelExt( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_GLUE" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true );
int aWidth = GroupPoints->TextLabel1->sizeHint().width() +
GroupPoints->PushButton1->sizeHint().width() +
GroupPoints->getGroupBoxLayout()->spacing();
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 );
QLabel* aTolLab = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box );
myTolEdt = new QDoubleSpinBox( GroupPoints->Box );
initSpinBox( myTolEdt, 0, 100, 1e-7, 10 );
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->GroupBox1->setTitle(tr("GEOM_GLUE"));
GroupPoints2->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
GroupPoints2->PushButton1->setPixmap(image1);
GroupPoints2 = new DlgRef_1SelExt( centralWidget() );
GroupPoints2->GroupBox1->setTitle( tr( "GEOM_GLUE" ) );
GroupPoints2->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
GroupPoints2->PushButton1->setIcon( image1 );
GroupPoints2->LineEdit1->setReadOnly( true );
Layout1->addWidget(GroupPoints2, 2, 0);
QGrid* aGrid = new QGrid( 2, Qt::Horizontal, GroupPoints2->GroupBox1 );
aGrid->setSpacing( 5 );
(new QLabel( tr( "GEOM_TOLERANCE" ), aGrid ))->setFixedWidth( aWidth );;
myTolEdt2 = new QtxDblSpinBox( 0, 100, 1e-7, aGrid );
myTolEdt2->setPrecision( 10 );
QLabel* aTolLab2 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints2->Box );
myTolEdt2 = new QDoubleSpinBox( GroupPoints2->Box );
initSpinBox( myTolEdt2, 0, 100, 1e-7, 10 );
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" ), aGrid );
myDetectBtn->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
mySubShapesChk = new QCheckBox( tr( "SELECT_FACES" ), aGrid );
GroupPoints2->getGroupBoxLayout()->addWidget( aGrid, 3, 0 );
myDetectBtn = new QPushButton( tr( "GEOM_DETECT" ) + QString( " [%1]" ).arg( tr( "GLUE_FACES" ) ),
GroupPoints2->Box );
mySubShapesChk = new QCheckBox( tr( "SELECT_FACES" ), GroupPoints2->Box );
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
if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
!= OCCViewer_Viewer::Type())
RadioButton2->setEnabled(false);
if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
!= OCCViewer_Viewer::Type() )
mainFrame()->RadioButton2->setEnabled( false );
Init();
}
@ -161,26 +155,27 @@ void RepairGUI_GlueDlg::Init()
//globalSelection( GEOM_COMPOUND );
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect( buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect(GroupPoints2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
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( mySubShapesChk, SIGNAL( stateChanged( int ) ), this, SLOT( onSubShapesChk() ) );
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
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" ) );
ConstructorsClicked(0);
ConstructorsClicked( 0 );
activateSelection();
updateButtonState();
@ -196,58 +191,48 @@ void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
if ( myCurrConstrId == constructorId )
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 )
{
case 0:
{
GroupPoints2->hide();
resize( 0, 0 );
GroupPoints->show();
GroupPoints->LineEdit1->setText( "" );
myEditCurrentArgument = GroupPoints->LineEdit1;
if ( myCurrConstrId >= 0 ) // i.e. it is not initialisation
{
// copy tolerance from previous tolerance field
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;
}
}
switch ( constructorId ) {
case 0:
GroupPoints2->hide();
GroupPoints->show();
GroupPoints->LineEdit1->setText( "" );
myEditCurrentArgument = GroupPoints->LineEdit1;
myCurrConstrId = constructorId;
if ( myCurrConstrId >= 0 ) {
// i.e. it is not initialisation
// copy tolerance from previous tolerance field
myTolEdt->setValue( myTolEdt2->value() );
}
break;
case 1:
GroupPoints->hide();
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;
}
myCurrConstrId = constructorId;
myEditCurrentArgument->setFocus();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
qApp->processEvents();
updateGeometry();
QSize aSize = minimumSizeHint();
resize( width(), aSize.height() );
resize( minimumSize() );
displayPreview();
updateButtonState();
activateSelection();
@ -298,7 +283,7 @@ void RepairGUI_GlueDlg::SelectionIntoArgument()
return;
erasePreview();
myEditCurrentArgument->setText("");
myEditCurrentArgument->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
if ( IObjectCount() == 1 ) {
@ -332,11 +317,11 @@ void RepairGUI_GlueDlg::SetEditCurrentArgument()
void RepairGUI_GlueDlg::LineEditReturnPressed()
{
const QObject* send = sender();
if( send == GroupPoints->LineEdit1 ) {
if ( send == GroupPoints->LineEdit1 ) {
myEditCurrentArgument = GroupPoints->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed();
}
else if( send == GroupPoints2->LineEdit1 ) {
else if ( send == GroupPoints2->LineEdit1 ) {
myEditCurrentArgument = GroupPoints2->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed();
}
@ -350,8 +335,8 @@ void RepairGUI_GlueDlg::LineEditReturnPressed()
void RepairGUI_GlueDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
//GroupPoints->LineEdit1->setText("");
//GroupPoints2->LineEdit1->setText("");
@ -367,9 +352,9 @@ void RepairGUI_GlueDlg::ActivateThisDialog()
// function : enterEvent()
// 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();
}
@ -377,7 +362,7 @@ void RepairGUI_GlueDlg::enterEvent(QEvent* e)
// function : closeEvent()
// purpose :
//=================================================================================
void RepairGUI_GlueDlg::closeEvent(QCloseEvent* e)
void RepairGUI_GlueDlg::closeEvent( QCloseEvent* e )
{
//myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
@ -397,7 +382,7 @@ GEOM::GEOM_IOperations_ptr RepairGUI_GlueDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool RepairGUI_GlueDlg::isValid( QString& msg )
bool RepairGUI_GlueDlg::isValid( QString& )
{
return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. );
}
@ -411,67 +396,64 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
bool aResult = false;
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() );
aResult = !anObj->_is_nil();
if ( aResult )
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();
aResult = !anObj->_is_nil();
if ( aResult )
objects.push_back( anObj._retn() );
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;
}
@ -523,91 +505,73 @@ bool RepairGUI_GlueDlg::onAcceptLocal()
_PTR(Study) aStudy = getStudy()->studyDS();
bool aLocked = aStudy->GetProperties()->IsLocked();
if ( aLocked )
{
if ( aLocked ) {
MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked");
SUIT_MessageBox::warn1 ( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()),
QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED"), QObject::tr("BUT_OK") );
SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), tr( "WRN_STUDY_LOCKED" ), tr( "BUT_OK" ) );
return false;
}
QString msg;
if ( !isValid( msg ) )
{
if ( !isValid( msg ) ) {
showError( msg );
return false;
}
erasePreview( false );
try
{
if ( openCommand() )
{
try {
if ( openCommand() ) {
SUIT_OverrideCursor wc;
SUIT_Session::session()->activeApplication()->putInfo( "" );
ObjectList objects;
if ( !execute( objects ) )
{
if ( !execute( objects ) ) {
wc.suspend();
abortCommand();
showError();
}
else
{
else {
const int nbObjs = objects.size();
bool withChildren = false;
for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it )
{
QString aName("");
if ( nbObjs > 1 )
{
aName = strlen( getNewObjectName() ) ? GEOMBase::GetDefaultName( getNewObjectName() ) : GEOMBase::GetDefaultName( getPrefix( *it ) );
for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
QString aName( "" );
if ( nbObjs > 1 ) {
aName = strlen( getNewObjectName() ) ? GEOMBase::GetDefaultName( getNewObjectName() ) : GEOMBase::GetDefaultName( getPrefix( *it ) );
}
else
{
else {
aName = getNewObjectName();
// PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
if ( aName.isEmpty() )
aName = GEOMBase::GetDefaultName( getPrefix( *it ) );
}
addInStudy( *it, aName.latin1() );
addInStudy( *it, aName.toLatin1().data() );
withChildren = false;
display( *it, false );
}
if ( nbObjs )
{
if ( nbObjs ) {
commitCommand();
updateObjBrowser();
SUIT_Session::session()->activeApplication()->putInfo( QObject::tr("GEOM_PRP_DONE") );
SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_DONE" ) );
}
else
{
else {
abortCommand();
}
// JFA 28.12.2004 BEGIN // To enable warnings
if ( !getOperation()->_is_nil() )
{
if ( !getOperation()->IsDone() )
{
if ( !getOperation()->_is_nil() ) {
if ( !getOperation()->IsDone() ) {
wc.suspend();
QString msgw = QObject::tr( getOperation()->GetErrorCode() );
SUIT_MessageBox::warn1((QWidget*)(SUIT_Session::session()->activeApplication()->desktop()),
QObject::tr( "WRN_WARNING" ),
msgw,
QObject::tr( "BUT_OK" ));
SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), msgw, tr( "BUT_OK" ) );
}
}
// JFA 28.12.2004 END
}
}
}
catch( const SALOME::SALOME_Exception& e )
{
catch( const SALOME::SALOME_Exception& e ) {
SalomeApp_Tools::QtCatchCorbaException( e );
abortCommand();
}
@ -636,20 +600,18 @@ void RepairGUI_GlueDlg::onDetect()
GEOM::ListOfGO_var aList = GEOM::GEOM_IShapesOperations::_narrow
( 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]));
if ( myTmpObjs.size() > 0 )
{
if ( myTmpObjs.size() > 0 ) {
msg = tr( "FACES_FOR_GLUING_ARE_DETECTED" ).arg( myTmpObjs.size() );
mySubShapesChk->setChecked( true );
}
else
{
else {
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();
activateSelection();
}
@ -660,27 +622,26 @@ void RepairGUI_GlueDlg::onDetect()
//=================================================================================
void RepairGUI_GlueDlg::activateSelection()
{
erasePreview(false);
erasePreview( false );
int anId = getConstructorId();
if ( anId == 0 ) // Case of whole gluing
{
disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
if ( anId == 0 ) {
// Case of whole gluing
disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
globalSelection( GEOM_ALLSHAPES );
if (myObject->_is_nil())
if ( myObject->_is_nil())
SelectionIntoArgument();
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
}
else // Second case of gluing
{
else {
// Second case of gluing
if ( !mySubShapesChk->isChecked() )
globalSelection( GEOM_ALLSHAPES );
else
{
else {
displayPreview( true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED );
globalSelection( GEOM_PREVIEW );
}
@ -697,16 +658,15 @@ void RepairGUI_GlueDlg::updateButtonState()
{
int anId = getConstructorId();
bool hasMainObj = !myObject->_is_nil();
if ( anId == 0 )
{
buttonOk->setEnabled( hasMainObj );
buttonApply->setEnabled( hasMainObj );
if ( anId == 0 ) {
buttonOk()->setEnabled( hasMainObj );
buttonApply()->setEnabled( hasMainObj );
}
else
{
bool wasDetected = myTmpObjs.size() ? true : false;
buttonOk->setEnabled( hasMainObj && wasDetected );
buttonApply->setEnabled( hasMainObj && wasDetected );
buttonOk()->setEnabled( hasMainObj && wasDetected );
buttonApply()->setEnabled( hasMainObj && wasDetected );
mySubShapesChk->setEnabled( hasMainObj && wasDetected );
myDetectBtn->setEnabled( hasMainObj );
if ( !hasMainObj || !wasDetected )
@ -721,7 +681,7 @@ void RepairGUI_GlueDlg::updateButtonState()
void RepairGUI_GlueDlg::clearTemporary()
{
ObjectList::iterator anIter;
for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter)
for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter )
getGeomEngine()->RemoveObject(*anIter);
myTmpObjs.clear();
@ -768,11 +728,9 @@ static string getEntry( GEOM::GEOM_Object_ptr object )
{
SUIT_Session* session = SUIT_Session::session();
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
if ( app )
{
if ( app ) {
string IOR = app->orb()->object_to_string( object );
if ( IOR != "" )
{
if ( IOR != "" ) {
SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy();
_PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) );
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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
#define DIALOGBOX_Glue_H
#ifndef REPAIRGUI_GLUEDLG_H
#define REPAIRGUI_GLUEDLG_H
#include "GEOMBase_Skeleton.h"
#include <GEOMBase_Skeleton.h>
class QtxDblSpinBox;
class DlgRef_1Sel_Ext;
class DlgRef_1SelExt;
class QDoubleSpinBox;
class QPushButton;
class QCheckBox;
//=================================================================================
@ -40,68 +39,66 @@ class QCheckBox;
//=================================================================================
class RepairGUI_GlueDlg : public GEOMBase_Skeleton
{
Q_OBJECT
Q_OBJECT
public:
RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* parent = 0,
const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~RepairGUI_GlueDlg();
RepairGUI_GlueDlg( GeometryGUI*, QWidget* = 0, bool = false );
~RepairGUI_GlueDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
private:
void Init();
void enterEvent(QEvent* e);
void closeEvent(QCloseEvent* e);
void initSelection();
void clearTemporary();
bool onAcceptLocal();
void clearShapeBufferLocal( GEOM::GEOM_Object_ptr );
// Reimplementation of onAccept for local case of this class.
void activateSelection();
void updateButtonState();
void selectTmpInViewer();
void Init();
void enterEvent( QEvent* );
void closeEvent( QCloseEvent* );
void initSelection();
void clearTemporary();
bool onAcceptLocal();
void clearShapeBufferLocal( GEOM::GEOM_Object_ptr );
// Reimplementation of onAccept for local case of this class.
void activateSelection();
void updateButtonState();
void selectTmpInViewer();
private:
GEOM::GEOM_Object_var myObject;
ObjectList myTmpObjs;
GEOM::GEOM_Object_var myObject;
ObjectList myTmpObjs;
DlgRef_1Sel_Ext* GroupPoints;
DlgRef_1Sel_Ext* GroupPoints2;
QtxDblSpinBox* myTolEdt;
QtxDblSpinBox* myTolEdt2;
QPushButton* myDetectBtn;
QCheckBox* mySubShapesChk;
int myCurrConstrId;
DlgRef_1SelExt* GroupPoints;
DlgRef_1SelExt* GroupPoints2;
QDoubleSpinBox* myTolEdt;
QDoubleSpinBox* myTolEdt2;
QPushButton* myDetectBtn;
QCheckBox* mySubShapesChk;
int myCurrConstrId;
protected slots:
virtual void ClickOnCancel();
virtual void ClickOnCancel();
private slots:
void ClickOnOk();
bool ClickOnApply();
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ConstructorsClicked(int);
//void ValueChangedInSpinBox();
void onDetect();
void onTolerChanged( double );
void onSubShapesChk();
void ConstructorsClicked( int );
//void ValueChangedInSpinBox();
void onDetect();
void onTolerChanged( double );
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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 "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include "SUIT_MessageBox.h"
#include "SUIT_Session.h"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.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 <TColStd_MapOfInteger.hxx>
using namespace std;
#include <TColStd_IndexedMapOfInteger.hxx>
//=================================================================================
// class : RepairGUI_RemoveHolesDlg()
@ -49,63 +48,46 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
RepairGUI_RemoveHolesDlg::RepairGUI_RemoveHolesDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl)
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
RepairGUI_RemoveHolesDlg::RepairGUI_RemoveHolesDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
bool modal )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal )
{
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 image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SUPPRESS_HOLES" ) ) );
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"));
RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_REMOVE_HOLES_TITLE" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints");
GroupPoints->GroupBox1->setTitle(tr("GEOM_HOLES"));
GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
GroupPoints->PushButton1->setPixmap(image1);
GroupPoints = new DlgRef_1Sel1Check1Sel( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_HOLES" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true );
Layout1->addWidget(GroupPoints, 2, 0);
myAllChk = new QCheckBox( tr( "GEOM_REMOVE_ALL_HOLES" ), 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 );
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->CheckButton1->setText( tr( "GEOM_REMOVE_ALL_HOLES" ) );
GroupPoints->TextLabel2->setText( tr( "GEOM_SELECTED_SHAPE" ) );
GroupPoints->PushButton2->setIcon( image1 );
GroupPoints->LineEdit2->setReadOnly( true );
GroupPoints->getGroupBoxLayout()->addMultiCellWidget( myAllChk, 1, 1, 0, 2 );
GroupPoints->getGroupBoxLayout()->addLayout( aSelectWiresLay, 2, 0 );
GroupPoints->getGroupBoxLayout()->addLayout( aDetectLay, 3, 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 );
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
/***************************************************************/
setHelpFileName("suppress_holes.htm");
setHelpFileName( "suppress_holes.htm" );
Init();
}
@ -140,19 +122,19 @@ void RepairGUI_RemoveHolesDlg::Init()
myOpen = -1;
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(mySelectWiresBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(mySelectWiresEdt, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
connect( myAllChk, SIGNAL( clicked() ), this, SLOT( onRemoveAllClicked() ) );
connect( myFreeBoundBtn, SIGNAL(clicked()), this, SLOT(onDetect()) );
connect( GroupPoints->CheckButton1, SIGNAL( clicked() ), this, SLOT( onRemoveAllClicked() ) );
connect( myFreeBoundBtn, SIGNAL( clicked() ), this, SLOT( onDetect() ) );
initName( tr( "REMOVE_HOLES_NEW_OBJ_NAME" ) );
}
@ -180,8 +162,8 @@ bool RepairGUI_RemoveHolesDlg::ClickOnApply()
initName();
myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setText("");
mySelectWiresEdt->setText("");
myEditCurrentArgument->setText( "" );
GroupPoints->LineEdit2->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
myWiresInd->length( 0 );
@ -198,16 +180,14 @@ bool RepairGUI_RemoveHolesDlg::ClickOnApply()
void RepairGUI_RemoveHolesDlg::SelectionIntoArgument()
{
erasePreview();
myEditCurrentArgument->setText("");
myEditCurrentArgument->setText( "" );
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();
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) // face selection
{
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { // face selection
Standard_Boolean aRes;
myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( aRes && GEOMBase::IsShape( myObject ) )
@ -215,10 +195,10 @@ void RepairGUI_RemoveHolesDlg::SelectionIntoArgument()
else
myObject = GEOM::GEOM_Object::_nil();
}
else if ( myEditCurrentArgument == mySelectWiresEdt && !myAllChk->isChecked() )
{
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 &&
!GroupPoints->CheckButton1->isChecked() ) {
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();
myWiresInd->length( n );
for ( int i = 1; i <= n; i++ )
@ -238,10 +218,9 @@ void RepairGUI_RemoveHolesDlg::SetEditCurrentArgument()
const QObject* send = sender();
if ( send == GroupPoints->PushButton1 )
myEditCurrentArgument = GroupPoints->LineEdit1;
else if ( send == mySelectWiresBtn && !myObject->_is_nil() )
myEditCurrentArgument = mySelectWiresEdt;
if ( myEditCurrentArgument )
{
else if ( send == GroupPoints->PushButton2 && !myObject->_is_nil() )
myEditCurrentArgument = GroupPoints->LineEdit2;
if ( myEditCurrentArgument ) {
initSelection();
myEditCurrentArgument->setFocus();
SelectionIntoArgument();
@ -256,8 +235,7 @@ void RepairGUI_RemoveHolesDlg::SetEditCurrentArgument()
void RepairGUI_RemoveHolesDlg::LineEditReturnPressed()
{
const QObject* send = sender();
if( send == GroupPoints->LineEdit1 || send == mySelectWiresEdt )
{
if ( send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2 ) {
myEditCurrentArgument = (QLineEdit*)send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
@ -271,12 +249,12 @@ void RepairGUI_RemoveHolesDlg::LineEditReturnPressed()
void RepairGUI_RemoveHolesDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setText("");
mySelectWiresEdt->setText("");
myEditCurrentArgument->setText( "" );
GroupPoints->LineEdit2->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
myWiresInd->length( 0 );
@ -292,9 +270,9 @@ void RepairGUI_RemoveHolesDlg::ActivateThisDialog()
// function : enterEvent()
// 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();
}
@ -303,7 +281,7 @@ void RepairGUI_RemoveHolesDlg::enterEvent(QEvent* e)
// function : closeEvent()
// purpose :
//=================================================================================
void RepairGUI_RemoveHolesDlg::closeEvent(QCloseEvent* e)
void RepairGUI_RemoveHolesDlg::closeEvent( QCloseEvent* e )
{
//myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
@ -322,10 +300,10 @@ GEOM::GEOM_IOperations_ptr RepairGUI_RemoveHolesDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool RepairGUI_RemoveHolesDlg::isValid( QString& msg )
bool RepairGUI_RemoveHolesDlg::isValid( QString& )
{
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 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;
aResult = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->GetFreeBoundary( myObject, aClosed, anOpen );
if ( aResult )
{
if ( aResult ) {
myClosed = aClosed->length();
myOpen = anOpen->length();
int i;
@ -354,8 +330,7 @@ bool RepairGUI_RemoveHolesDlg::execute( ObjectList& objects )
else
myClosed = -1;
}
else
{
else {
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->FillHoles( myObject, myWiresInd );
aResult = !anObj->_is_nil();
if ( aResult )
@ -371,13 +346,12 @@ bool RepairGUI_RemoveHolesDlg::execute( ObjectList& objects )
//=================================================================================
void RepairGUI_RemoveHolesDlg::onRemoveAllClicked()
{
bool b = myAllChk->isOn();
mySelectWiresLbl->setEnabled( !b );
mySelectWiresBtn->setEnabled( !b );
mySelectWiresEdt->setEnabled( !b );
if ( b )
{
mySelectWiresEdt->setText( "" );
bool b = GroupPoints->CheckButton1->isChecked();
GroupPoints->TextLabel2->setEnabled( !b );
GroupPoints->PushButton2->setEnabled( !b );
GroupPoints->LineEdit2->setEnabled( !b );
if ( b ) {
GroupPoints->LineEdit2->setText( "" );
myWiresInd->length( 0 );
}
}
@ -388,8 +362,7 @@ void RepairGUI_RemoveHolesDlg::onRemoveAllClicked()
//=================================================================================
void RepairGUI_RemoveHolesDlg::initSelection()
{
if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
{
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
TColStd_MapOfInteger aTypes;
aTypes.Add( GEOM_COMPOUND );
aTypes.Add( GEOM_SOLID );
@ -398,8 +371,7 @@ void RepairGUI_RemoveHolesDlg::initSelection()
globalSelection( aTypes );
}
else if ( myEditCurrentArgument == mySelectWiresEdt )
{
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
localSelection( myObject, TopAbs_EDGE );
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 );
else
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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
#define DIALOGBOX_RemoveHoles_H
#ifndef REPAIRGUI_REMOVEHOLESDLG_H
#define REPAIRGUI_REMOVEHOLESDLG_H
#include "GEOMBase_Skeleton.h"
#include "DlgRef_1Sel_Ext.h"
#include <GEOMBase_Skeleton.h>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <qcheckbox.h>
#include <qbuttongroup.h>
#include <qlineedit.h>
#include <qlabel.h>
class DlgRef_1Sel1Check1Sel;
class QPushButton;
//=================================================================================
// class : RepairGUI_RemoveHolesDlg
@ -44,50 +37,46 @@
//=================================================================================
class RepairGUI_RemoveHolesDlg : public GEOMBase_Skeleton
{
Q_OBJECT
Q_OBJECT
public:
RepairGUI_RemoveHolesDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0,
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_RemoveHolesDlg();
RepairGUI_RemoveHolesDlg( GeometryGUI*, QWidget* = 0, bool = false );
~RepairGUI_RemoveHolesDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
private:
void Init();
void enterEvent(QEvent* e);
void closeEvent(QCloseEvent* e);
void initSelection();
GEOM::GEOM_Object_var myObject;
GEOM::short_array_var myWiresInd;
DlgRef_1Sel_Ext* GroupPoints;
QCheckBox* myAllChk;
QLabel* mySelectWiresLbl;
QPushButton* mySelectWiresBtn;
QLineEdit* mySelectWiresEdt;
QPushButton* myFreeBoundBtn;
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().
void Init();
void enterEvent( QEvent* );
void closeEvent( QCloseEvent* );
void initSelection();
private:
GEOM::GEOM_Object_var myObject;
GEOM::short_array_var myWiresInd;
DlgRef_1Sel1Check1Sel* GroupPoints;
QPushButton* myFreeBoundBtn;
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().
private slots:
void ClickOnOk();
bool ClickOnApply();
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void onRemoveAllClicked();
void onDetect();
void onRemoveAllClicked();
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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 "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include "SUIT_Session.h"
#include "SALOME_ListIteratorOfListIO.hxx"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#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 <TColStd_MapOfInteger.hxx>
using namespace std;
#include <TColStd_IndexedMapOfInteger.hxx>
//=================================================================================
// class : RepairGUI_RemoveIntWiresDlg()
@ -47,56 +47,40 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
RepairGUI_RemoveIntWiresDlg::RepairGUI_RemoveIntWiresDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl)
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
RepairGUI_RemoveIntWiresDlg::RepairGUI_RemoveIntWiresDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
bool modal )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal )
{
QPixmap image0 (myGeomGUI->getApp()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SUPPRESS_INT_WIRES")));
QPixmap image1 (myGeomGUI->getApp()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
QPixmap image0( myGeomGUI->getApp()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SUPPRESS_INT_WIRES" ) ) );
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"));
RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_REMOVE_INTERNAL_WIRES_TITLE" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints");
GroupPoints->GroupBox1->setTitle(tr("GEOM_INTERNAL_WIRES"));
GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_FACE"));
GroupPoints->PushButton1->setPixmap(image1);
GroupPoints = new DlgRef_1Sel1Check1Sel( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_INTERNAL_WIRES" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_FACE" ) );
GroupPoints->PushButton1->setIcon( image1 );
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();
}
@ -121,25 +105,25 @@ void RepairGUI_RemoveIntWiresDlg::Init()
myEditCurrentArgument = GroupPoints->LineEdit1;
myObject = GEOM::GEOM_Object::_nil();
myWiresInd = new GEOM::short_array();
myWiresInd->length( 0 );
myWiresInd = new GEOM::short_array();
myWiresInd->length( 0 );
//myGeomGUI->SetState( 0 );
initSelection();
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(mySelectWiresBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(mySelectWiresEdt, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
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" ) );
}
@ -162,18 +146,18 @@ void RepairGUI_RemoveIntWiresDlg::ClickOnOk()
bool RepairGUI_RemoveIntWiresDlg::ClickOnApply()
{
if ( !onAccept() )
return false;
return false;
initName();
myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setText("");
mySelectWiresEdt->setText("");
myEditCurrentArgument->setText( "" );
GroupPoints->LineEdit2->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
myWiresInd->length( 0 );
initSelection();
myWiresInd->length( 0 );
initSelection();
return true;
}
@ -184,35 +168,33 @@ bool RepairGUI_RemoveIntWiresDlg::ClickOnApply()
//=================================================================================
void RepairGUI_RemoveIntWiresDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("");
myEditCurrentArgument->setText( "" );
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 )
{
Handle(SALOME_InteractiveObject) anIO = firstIObject();
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) // face selection
{
Standard_Boolean aRes;
myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( aRes && GEOMBase::IsShape( myObject ) )
myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
else
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_" ) );
}
if ( IObjectCount() == 1 ) {
Handle(SALOME_InteractiveObject) anIO = firstIObject();
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { // face selection
Standard_Boolean aRes;
myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( aRes && GEOMBase::IsShape( myObject ) )
myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
else
myObject = GEOM::GEOM_Object::_nil();
}
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()
{
const QObject* send = sender();
const QObject* send = sender();
if ( send == GroupPoints->PushButton1 )
myEditCurrentArgument = GroupPoints->LineEdit1;
else if ( send == mySelectWiresBtn && !myObject->_is_nil() )
myEditCurrentArgument = mySelectWiresEdt;
myEditCurrentArgument = GroupPoints->LineEdit1;
else if ( send == GroupPoints->PushButton2 && !myObject->_is_nil() )
myEditCurrentArgument = GroupPoints->LineEdit2;
if ( myEditCurrentArgument )
{
initSelection();
myEditCurrentArgument->setFocus();
SelectionIntoArgument();
if ( myEditCurrentArgument ) {
initSelection();
myEditCurrentArgument->setFocus();
SelectionIntoArgument();
}
}
@ -242,12 +223,11 @@ void RepairGUI_RemoveIntWiresDlg::SetEditCurrentArgument()
//=================================================================================
void RepairGUI_RemoveIntWiresDlg::LineEditReturnPressed()
{
const QObject* send = sender();
if( send == GroupPoints->LineEdit1 || send == mySelectWiresEdt )
{
const QObject* send = sender();
if ( send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2 ) {
myEditCurrentArgument = (QLineEdit*)send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
@ -258,12 +238,12 @@ void RepairGUI_RemoveIntWiresDlg::LineEditReturnPressed()
void RepairGUI_RemoveIntWiresDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setText("");
mySelectWiresEdt->setText("");
myEditCurrentArgument->setText( "" );
GroupPoints->LineEdit2->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
myWiresInd->length( 0 );
@ -275,9 +255,9 @@ void RepairGUI_RemoveIntWiresDlg::ActivateThisDialog()
// function : enterEvent()
// 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();
}
@ -285,7 +265,7 @@ void RepairGUI_RemoveIntWiresDlg::enterEvent(QEvent* e)
// function : closeEvent()
// purpose :
//=================================================================================
void RepairGUI_RemoveIntWiresDlg::closeEvent(QCloseEvent* e)
void RepairGUI_RemoveIntWiresDlg::closeEvent( QCloseEvent* e )
{
//myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
@ -304,9 +284,9 @@ GEOM::GEOM_IOperations_ptr RepairGUI_RemoveIntWiresDlg::createOperation()
// function : isValid
// 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()
{
bool b = myAllChk->isOn();
mySelectWiresLbl->setEnabled( !b );
mySelectWiresBtn->setEnabled( !b );
mySelectWiresEdt->setEnabled( !b );
if ( b )
{
mySelectWiresEdt->setText( "" );
bool b = GroupPoints->CheckButton1->isChecked();
GroupPoints->TextLabel2->setEnabled( !b );
GroupPoints->PushButton2->setEnabled( !b );
GroupPoints->LineEdit2->setEnabled( !b );
if ( b ) {
GroupPoints->LineEdit2->setText( "" );
myWiresInd->length( 0 );
}
}
@ -347,18 +326,16 @@ void RepairGUI_RemoveIntWiresDlg::onRemoveAllClicked()
//=================================================================================
void RepairGUI_RemoveIntWiresDlg::initSelection()
{
if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
{
TColStd_MapOfInteger aTypes;
aTypes.Add( GEOM_COMPOUND );
aTypes.Add( GEOM_SOLID );
aTypes.Add( GEOM_SHELL );
aTypes.Add( GEOM_FACE );
globalSelection( aTypes );
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
TColStd_MapOfInteger aTypes;
aTypes.Add( GEOM_COMPOUND );
aTypes.Add( GEOM_SOLID );
aTypes.Add( GEOM_SHELL );
aTypes.Add( GEOM_FACE );
globalSelection( aTypes );
}
else if ( myEditCurrentArgument == mySelectWiresEdt )
{
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
//localSelection( myObject, TopAbs_EDGE );
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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
#define DIALOGBOX_RemoveIntWires_H
#ifndef REPAIRGUI_REMOVEINTWIRESDLG_H
#define REPAIRGUI_REMOVEINTWIRESDLG_H
#include "GEOMBase_Skeleton.h"
#include "DlgRef_1Sel_Ext.h"
#include <GEOMBase_Skeleton.h>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <qcheckbox.h>
#include <qbuttongroup.h>
#include <qlineedit.h>
#include <qlabel.h>
class DlgRef_1Sel1Check1Sel;
//=================================================================================
// class : RepairGUI_RemoveIntWiresDlg
@ -44,45 +36,41 @@
//=================================================================================
class RepairGUI_RemoveIntWiresDlg : public GEOMBase_Skeleton
{
Q_OBJECT
Q_OBJECT
public:
RepairGUI_RemoveIntWiresDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0,
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_RemoveIntWiresDlg();
RepairGUI_RemoveIntWiresDlg( GeometryGUI*, QWidget* = 0, bool = false );
~RepairGUI_RemoveIntWiresDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
private:
void Init();
void enterEvent(QEvent* e);
void closeEvent(QCloseEvent* e);
void initSelection();
GEOM::GEOM_Object_var myObject;
GEOM::short_array_var myWiresInd;
DlgRef_1Sel_Ext* GroupPoints;
QCheckBox* myAllChk;
QLabel* mySelectWiresLbl;
QPushButton* mySelectWiresBtn;
QLineEdit* mySelectWiresEdt;
void Init();
void enterEvent( QEvent* );
void closeEvent( QCloseEvent* );
void initSelection();
private:
GEOM::GEOM_Object_var myObject;
GEOM::short_array_var myWiresInd;
DlgRef_1Sel1Check1Sel* GroupPoints;
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void onRemoveAllClicked();
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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 "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include "SUIT_Session.h"
#include "SUIT_MessageBox.h"
#include "SALOME_ListIteratorOfListIO.hxx"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#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 <TColStd_MapOfInteger.hxx>
#define DEFAULT_TOLERANCE_VALUE 1e-07
using namespace std;
//=================================================================================
// class : RepairGUI_SewingDlg()
// 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
// TRUE to construct a modal dialog.
//=================================================================================
RepairGUI_SewingDlg::RepairGUI_SewingDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl)
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
RepairGUI_SewingDlg::RepairGUI_SewingDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
bool modal )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal )
{
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SEWING")));
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SEWING" ) ) );
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"));
RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_SEWING_TITLE" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints");
GroupPoints->GroupBox1->setTitle(tr("GEOM_SEWING"));
GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
GroupPoints->PushButton1->setPixmap(image1);
GroupPoints = new DlgRef_1SelExt( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_SEWING" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true );
Layout1->addWidget(GroupPoints, 2, 0);
QGridLayout* aLay = new QGridLayout( 0, 2, 2, 0, 6, "aLay" );
myTolEdt = new QtxDblSpinBox( 0, 100, 1e-7, GroupPoints->GroupBox1 );//QAD_SpinBoxDbl( GroupPoints->GroupBox1, 0, 100, 1e-7, 10, 1e-10 );
myTolEdt->setPrecision( 10 );
QGridLayout* aLay = new QGridLayout( GroupPoints->Box );
aLay->setMargin( 0 ); aLay->setSpacing( 6 );
myTolEdt = new QDoubleSpinBox( GroupPoints->Box );
initSpinBox( myTolEdt, 0, 100, 1e-7, 10 );
myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE );
QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->GroupBox1 );
myFreeBoundBtn = new QPushButton( tr( "GEOM_DETECT" ), GroupPoints->GroupBox1 );
QLabel* aLbl2 = new QLabel( tr( "GEOM_FREE_BOUNDARIES" ), GroupPoints->GroupBox1 );
aLay->addWidget( aLbl1, 0, 0 );
aLay->addWidget( myTolEdt, 0, 1 );
aLay->addWidget( aLbl2, 1, 0 );
aLay->addWidget( myFreeBoundBtn, 1, 1 );
QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box );
myFreeBoundBtn = new QPushButton( tr( "GEOM_DETECT" ) + QString( " [%1]" ).arg( tr( "GEOM_FREE_BOUNDARIES" ) ),
GroupPoints->Box );
aLay->addWidget( aLbl1, 0, 0 );
aLay->addWidget( myTolEdt, 0, 1 );
aLay->addWidget( myFreeBoundBtn, 1, 0, 1, 2 );
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();
}
@ -122,16 +122,16 @@ void RepairGUI_SewingDlg::Init()
myOpen = -1;
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
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" ) );
}
@ -158,7 +158,7 @@ bool RepairGUI_SewingDlg::ClickOnApply()
initName();
GroupPoints->LineEdit1->setText("");
GroupPoints->LineEdit1->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
initSelection();
@ -174,11 +174,10 @@ bool RepairGUI_SewingDlg::ClickOnApply()
void RepairGUI_SewingDlg::SelectionIntoArgument()
{
erasePreview();
myEditCurrentArgument->setText("");
myEditCurrentArgument->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
if ( IObjectCount() == 1 )
{
if ( IObjectCount() == 1 ) {
Handle(SALOME_InteractiveObject) anIO = firstIObject();
Standard_Boolean aRes;
myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
@ -194,8 +193,7 @@ void RepairGUI_SewingDlg::SelectionIntoArgument()
void RepairGUI_SewingDlg::SetEditCurrentArgument()
{
const QObject* send = sender();
if ( send == GroupPoints->PushButton1 )
{
if ( send == GroupPoints->PushButton1 ) {
myEditCurrentArgument->setFocus();
SelectionIntoArgument();
}
@ -209,8 +207,7 @@ void RepairGUI_SewingDlg::SetEditCurrentArgument()
void RepairGUI_SewingDlg::LineEditReturnPressed()
{
const QObject* send = sender();
if( send == GroupPoints->LineEdit1 )
{
if( send == GroupPoints->LineEdit1 ) {
myEditCurrentArgument = GroupPoints->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed();
}
@ -224,10 +221,10 @@ void RepairGUI_SewingDlg::LineEditReturnPressed()
void RepairGUI_SewingDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
GroupPoints->LineEdit1->setText("");
GroupPoints->LineEdit1->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
myClosed = -1;
@ -242,9 +239,9 @@ void RepairGUI_SewingDlg::ActivateThisDialog()
// function : enterEvent()
// 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();
}
@ -253,7 +250,7 @@ void RepairGUI_SewingDlg::enterEvent(QEvent* e)
// function : closeEvent()
// purpose :
//=================================================================================
void RepairGUI_SewingDlg::closeEvent(QCloseEvent* e)
void RepairGUI_SewingDlg::closeEvent( QCloseEvent* e )
{
//myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
@ -272,7 +269,7 @@ GEOM::GEOM_IOperations_ptr RepairGUI_SewingDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool RepairGUI_SewingDlg::isValid( QString& msg )
bool RepairGUI_SewingDlg::isValid( QString& )
{
myClosed = -1;
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 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;
aResult = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->GetFreeBoundary( myObject, aClosed, anOpen );
if ( aResult )
{
if ( aResult ) {
myClosed = aClosed->length();
myOpen = anOpen->length();
int i;
@ -304,8 +299,7 @@ bool RepairGUI_SewingDlg::execute( ObjectList& objects )
else
myClosed = -1;
}
else
{
else {
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->Sew( myObject, myTolEdt->value() );
aResult = !anObj->_is_nil();
if ( aResult )
@ -342,5 +336,5 @@ void RepairGUI_SewingDlg::onDetect()
msg = tr( "GEOM_FREE_BOUNDS_MSG" ).arg( myClosed + myOpen ).arg( myClosed ).arg( myOpen );
else
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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
#define DIALOGBOX_Sewing_H
#ifndef REPAIRGUI_SEWINGDLG_H
#define REPAIRGUI_SEWINGDLG_H
#include "GEOMBase_Skeleton.h"
#include "DlgRef_1Sel_Ext.h"
#include "QtxDblSpinBox.h"
#include <GEOMBase_Skeleton.h>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <qcheckbox.h>
#include <qbuttongroup.h>
#include <qlineedit.h>
#include <qlabel.h>
class DlgRef_1SelExt;
class QDoubleSpinBox;
class QPushButton;
//=================================================================================
// class : RepairGUI_SewingDlg
@ -45,45 +38,45 @@
//=================================================================================
class RepairGUI_SewingDlg : public GEOMBase_Skeleton
{
Q_OBJECT
Q_OBJECT
public:
RepairGUI_SewingDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0,
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_SewingDlg();
RepairGUI_SewingDlg( GeometryGUI*, QWidget* = 0, bool = false );
~RepairGUI_SewingDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
private:
void Init();
void enterEvent( QEvent* );
void closeEvent( QCloseEvent* );
void initSelection();
private:
void Init();
void enterEvent(QEvent* e);
void closeEvent(QCloseEvent* e);
void initSelection();
GEOM::GEOM_Object_var myObject;
DlgRef_1Sel_Ext* GroupPoints;
QtxDblSpinBox* myTolEdt;
QPushButton* myFreeBoundBtn;
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().
GEOM::GEOM_Object_var myObject;
DlgRef_1SelExt* GroupPoints;
QDoubleSpinBox* myTolEdt;
QPushButton* myFreeBoundBtn;
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().
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void onDetect();
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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 "GEOMImpl_Types.hxx"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include <GEOMImpl_Types.hxx>
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include "SUIT_Session.h"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SALOME_ListIO.hxx"
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_MessageBox.h>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SALOME_ListIO.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <qheader.h>
#include <qlabel.h>
#include <qmessagebox.h>
using namespace std;
#include <QListWidget>
#include <QStackedLayout>
//=================================================================================
// class : RepairGUI_ShapeProcessDlg()
@ -52,12 +51,11 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
RepairGUI_ShapeProcessDlg::RepairGUI_ShapeProcessDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl)
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
RepairGUI_ShapeProcessDlg::RepairGUI_ShapeProcessDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
bool modal )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal )
{
setHelpFileName("shape_processing.htm");
setHelpFileName( "shape_processing.htm" );
init();
}
@ -80,265 +78,256 @@ void RepairGUI_ShapeProcessDlg::init()
initParamsValues();
initSelection();
setCaption(tr("GEOM_SHAPEPROCESS_TITLE"));
setWindowTitle( tr( "GEOM_SHAPEPROCESS_TITLE" ) );
GroupConstructors->hide();
mainFrame()->GroupConstructors->hide();
// select widget on the top
mySelectWdgt = new DlgRef_1Sel_QTD( this, "SelectedObjects" );
mySelectWdgt->GroupBox1->setTitle( tr("GEOM_SHAPE") );
mySelectWdgt->TextLabel1->setText( tr("GEOM_SELECTED_OBJECTS") );
mySelectWdgt->PushButton1->setPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")) );
mySelectWdgt = new DlgRef_1Sel( centralWidget() );
mySelectWdgt->GroupBox1->setTitle( tr( "GEOM_SHAPE" ) );
mySelectWdgt->TextLabel1->setText( tr( "GEOM_SELECTED_OBJECTS" ) );
mySelectWdgt->PushButton1->setIcon( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
mySelectWdgt->LineEdit1->setReadOnly( true );
Layout1->addWidget( mySelectWdgt, 0, 0 );
// layout the two group boxes in the middle, add a list of operations
QFrame* aMidFrame = new QFrame( this );
QGridLayout* aMidLay = new QGridLayout( aMidFrame, 1, 3, 0, 5 );
QGroupBox* anOperGr = new QGroupBox( tr("GEOM_OPERATIONS"), aMidFrame );
QVBoxLayout* aOperLay = new QVBoxLayout( anOperGr, 0, 0 );
QGroupBox* anOperGr = new QGroupBox( tr( "GEOM_OPERATIONS" ), centralWidget() );
myOpList = new QListView( anOperGr );
myOpList->setSorting( -1 );
myOpList->addColumn( "Operations" );
myOpList->header()->hide();
// operations list widget
myOpList = new QListWidget( anOperGr );
myOpList->setSortingEnabled( false );
myOpList->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) );
QVBoxLayout* aOperLay = new QVBoxLayout( anOperGr );
aOperLay->setMargin( 9 );
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 );
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 );
QGroupBox* aParamsGr = new QGroupBox( tr( "GEOM_PARAMETERS" ), centralWidget() );
// add a widget stack to the parameters group box
myStack = new QWidgetStack( aParamsGr );
QVBoxLayout* aVParamsLay = new QVBoxLayout( aParamsGr );
aVParamsLay->addWidget( myStack );
QStackedLayout* aStack = new QStackedLayout( aParamsGr );
// 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
QFrame* aFrame = new QFrame( myStack );
QGridLayout* aLay = new QGridLayout( aFrame, 10, 2, 0, 5 );
// fill in the widgets
for ( int i = 0; i < myOpLst.count(); i++ ) {
QListWidgetItem* item = new QListWidgetItem( myOpLst[i] );
item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable );
item->setCheckState( Qt::Unchecked );
myOpList->addItem( item );
myFixShapeTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 );
myFixShapeTol3D->setPrecision( 10 );
myFixShapeMaxTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 );
myFixShapeMaxTol3D->setPrecision( 10 );
aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 );
aLay->addWidget( myFixShapeTol3D, 0, 1 );
aLay->addWidget( new QLabel( tr("GEOM_MAX_3D_TOLERANCE"), aFrame ), 1, 0 );
aLay->addWidget( myFixShapeMaxTol3D, 1, 1 );
aLay->setRowStretch( 9, 2 );
myStack->addWidget( aFrame, myOpLst.findIndex( "FixShape" ) );
// FixFaceSize
aFrame = new QFrame( myStack );
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 );
myFixFaceSizeTol->setPrecision( 10 );
aLay->addWidget( new QLabel( tr("GEOM_TOLERANCE"), aFrame ), 0, 0 );
aLay->addWidget( myFixFaceSizeTol, 0, 1 );
aLay->setRowStretch( 9, 2 );
myStack->addWidget( aFrame, myOpLst.findIndex( "FixFaceSize" ) );
// DropSmallEdges
aFrame = new QFrame( myStack );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 );
myDropSmallEdgesTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 );
myDropSmallEdgesTol3D->setPrecision( 10 );
QWidget* w;
if ( myOpLst[i] == "FixShape" ) {
// FixShape
w = new QWidget( aParamsGr );
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
myFixShapeTol3D = new QDoubleSpinBox( w );
initSpinBox( myFixShapeTol3D, 0, 100, 1e-7, 10 );
myFixShapeMaxTol3D = new QDoubleSpinBox( w );
initSpinBox( myFixShapeMaxTol3D, 0, 100, 1e-7, 10 );
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 );
myFixFaceSizeTol = new QDoubleSpinBox( w );
initSpinBox( myFixFaceSizeTol, 0, 100, 1e-7, 10 );
aLay->addWidget( new QLabel( tr( "GEOM_TOLERANCE" ), w ), 0, 0 );
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 );
myDropSmallEdgesTol3D = new QDoubleSpinBox( w );
initSpinBox( myDropSmallEdgesTol3D, 0, 100, 1e-7, 10 );
aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 );
aLay->addWidget( myDropSmallEdgesTol3D, 0, 1 );
aLay->setRowStretch( 9, 2 );
myStack->addWidget( aFrame, myOpLst.findIndex( "DropSmallEdges" ) );
// SplitAngle
aFrame = new QFrame( myStack );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 );
mySplitAngleAngle = new QtxDblSpinBox( 0, 360, 1, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 360, 1 );
mySplitAngleMaxTol = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 );
mySplitAngleMaxTol->setPrecision( 10 );
aLay->addWidget( new QLabel( tr("GEOM_ANGLE_1"), aFrame ), 0, 0 );
aLay->addWidget( mySplitAngleAngle, 0, 1 );
aLay->addWidget( new QLabel( tr("GEOM_MAX_TOLERANCE"), aFrame ), 1, 0 );
aLay->addWidget( mySplitAngleMaxTol, 1, 1 );
aLay->setRowStretch( 9, 2 );
myStack->addWidget( aFrame, myOpLst.findIndex( "SplitAngle" ) );
// SplitClosedFaces
aFrame = new QFrame( myStack );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 );
mySplitClosedFacesNum = new QSpinBox( aFrame );
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 );
mySplitAngleAngle = new QDoubleSpinBox( w );
initSpinBox( mySplitAngleAngle, 0, 360, 1 );
mySplitAngleMaxTol = new QDoubleSpinBox( w );
initSpinBox( mySplitAngleMaxTol, 0, 100, 1e-7, 10 );
aLay->addWidget( new QLabel( tr( "GEOM_ANGLE_1" ), w ), 0, 0 );
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 );
mySplitClosedFacesNum = new QSpinBox( w );
aLay->addWidget( new QLabel( tr("GEOM_NUM_SPLIT_POINTS"), aFrame ), 0, 0 );
aLay->addWidget( mySplitClosedFacesNum, 0, 1 );
aLay->setRowStretch( 9, 2 );
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 );
myStack->addWidget( aFrame, myOpLst.findIndex( "SplitClosedFaces" ) );
mySplitContTol3D = new QDoubleSpinBox( w );
initSpinBox( mySplitContTol3D, 0, 100, 1e-7, 10 );
mySplitContSurfCont = new QComboBox( w );
mySplitContSurfCont->addItems( aContinueties );
mySplitContCurvCont = new QComboBox( w );
mySplitContCurvCont->addItems( aContinueties );
aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 );
aLay->addWidget( mySplitContTol3D, 0, 1 );
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 );
// SplitContinuity
aFrame = new QFrame( myStack );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 );
myBSplineSurfModeChk = new QCheckBox( tr("GEOM_SURFACE_MODE"), w );
myBSpline3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), w );
myBSpline2DCurveChk = 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 );
mySplitContTol3D->setPrecision( 10 );
mySplitContSurfCont = new QComboBox( aFrame );
mySplitContSurfCont->insertStringList( aContinueties );
mySplitContCurvCont = new QComboBox( aFrame );
mySplitContCurvCont->insertStringList( aContinueties );
myBSplineTol3D = new QDoubleSpinBox( w );
initSpinBox( myBSplineTol3D, 0, 100, 1e-7, 10 );
myBSplineTol2D = new QDoubleSpinBox( w );
initSpinBox( myBSplineTol2D, 0, 100, 1e-7, 10 );
aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 );
aLay->addWidget( mySplitContTol3D, 0, 1 );
aLay->addWidget( new QLabel( tr("GEOM_SURFACE_CONTINUTY"), aFrame ), 1, 0 );
aLay->addWidget( mySplitContSurfCont, 1, 1 );
aLay->addWidget( new QLabel( tr("GEOM_CURVE_CONTINUTY"), aFrame ), 2, 0 );
aLay->addWidget( mySplitContCurvCont, 2, 1 );
aLay->setRowStretch( 9, 2 );
myBSplineDegree = new QSpinBox( w );
myBSplineSegments = new QSpinBox( w );
myBSpline2DCont = new QComboBox( w );
myBSpline2DCont->addItems( aContinueties );
myBSpline3DCont = new QComboBox( w );
myBSpline3DCont->addItems( 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" ), 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 );
myToBezierSurfModeChk = new QCheckBox( tr("GEOM_SURFACE_MODE"), w );
myToBezier3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), w );
myToBezier2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), w );
myStack->addWidget( aFrame, myOpLst.findIndex( "SplitContinuity" ) );
myToBezierMaxTol = new QDoubleSpinBox( w );
initSpinBox( myToBezierMaxTol, 0, 100, 1e-7, 10 );
// BSplineRestriction
aFrame = new QFrame( myStack );
aLay = new QGridLayout( aFrame, 10, 2, 0, 5 );
aLay->addWidget( myToBezierSurfModeChk, 0, 0 );
aLay->addWidget( myToBezier3DCurveChk, 1, 0 );
aLay->addWidget( myToBezier2DCurveChk, 2, 0 );
aLay->addWidget( new QLabel( tr( "GEOM_MAX_TOLERANCE" ), w ), 3, 0 );
aLay->addWidget( myToBezierMaxTol, 3, 1 );
aLay->setRowStretch( aLay->rowCount(), 5 );
}
else if ( myOpLst[i] == "SameParameter" ) {
// SameParameter
w = new QWidget( aParamsGr );
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
myBSplineSurfModeChk = new QCheckBox( tr("GEOM_SURFACE_MODE"), aFrame );
myBSpline3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), aFrame );
myBSpline2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), aFrame );
mySameParameterTol3D = new QDoubleSpinBox( w );
initSpinBox( mySameParameterTol3D, 0, 100, 1e-7, 10 );
aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 );
aLay->addWidget( mySameParameterTol3D, 0, 1 );
aLay->setRowStretch( aLay->rowCount(), 5 );
}
else {
w = new QWidget( aParamsGr ); // dumb widget
}
aStack->insertWidget( i, w );
}
myBSplineTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 );
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" ) );
QGridLayout* layout = new QGridLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( mySelectWdgt, 0, 0, 1, 2 );
layout->addWidget( anOperGr, 1, 0 );
layout->addWidget( aParamsGr, 1, 1 );
// signals and slots connections
connect( buttonOk, SIGNAL(clicked()), this, SLOT(onOk()) );
connect( buttonApply, SIGNAL(clicked()), this, SLOT(onApply()) );
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( onOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( onApply() ) );
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(selectionChanged()) );
connect( myOpList, SIGNAL(selectionChanged()), this, SLOT(operationChanged()) );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ) );
connect( mySelectWdgt->PushButton1, SIGNAL(clicked()), this, SLOT(selectClicked()) );
connect( mySelectWdgt->LineEdit1, SIGNAL(returnPressed()), this, SLOT(lineEditReturnPressed()) );
connect( mySelectWdgt->PushButton1, SIGNAL( clicked() ), this, SLOT( selectClicked() ) );
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();
loadDefaults(); // init dialog fields with values from resource file
myOpList->setSelected( myOpList->findItem( "FixShape", 0 ), true );
//myOpList->setCurrentRow( myOpList->findItem( 0 );
reset();
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()
// purpose : Same than click on apply but close this dialog.
//=================================================================================
void RepairGUI_ShapeProcessDlg::onOk()
{
if (onApply())
if ( onApply() )
ClickOnCancel();
}
@ -367,13 +356,12 @@ bool RepairGUI_ShapeProcessDlg::onApply()
//=================================================================================
void RepairGUI_ShapeProcessDlg::selectionChanged()
{
reset();
reset();
Standard_Boolean aRes = Standard_False;
int i = 0;
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 );
if ( !CORBA::is_nil( aSelectedObject ) && aRes )
myObjects[i++] = aSelectedObject;
@ -415,8 +403,8 @@ void RepairGUI_ShapeProcessDlg::lineEditReturnPressed()
void RepairGUI_ShapeProcessDlg::activate()
{
GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(selectionChanged()));
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication( ) ))->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ) );
reset();
//myGeomGUI->SetState( 0 );
@ -428,9 +416,9 @@ void RepairGUI_ShapeProcessDlg::activate()
// function : enterEvent()
// 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();
}
@ -439,7 +427,7 @@ void RepairGUI_ShapeProcessDlg::enterEvent(QEvent* e)
// function : closeEvent()
// purpose : same than click on cancel button
//=================================================================================
void RepairGUI_ShapeProcessDlg::closeEvent(QCloseEvent* e)
void RepairGUI_ShapeProcessDlg::closeEvent( QCloseEvent* e )
{
//myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
@ -454,7 +442,7 @@ void RepairGUI_ShapeProcessDlg::reset()
{
myObjects = new GEOM::ListOfGO();
myObjects->length( 0 );
mySelectWdgt->LineEdit1->setText("");
mySelectWdgt->LineEdit1->setText( "" );
}
@ -462,15 +450,13 @@ void RepairGUI_ShapeProcessDlg::reset()
// function : get_convert
// 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" ) )
{
double doubleValue = atof( theValue ) * PI / 180;
TCollection_AsciiString str( doubleValue );
return CORBA::string_dup( str.ToCString() );
if ( !strcmp( theParam, "SplitAngle.Angle" ) ) {
double doubleValue = theValue.toDouble() * PI / 180;
return CORBA::string_dup( QString::number( doubleValue ).toLatin1().constData() );
}
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 )
{
if ( !strcmp( theParam, "SplitAngle.Angle" ) )
{
if ( !strcmp( theParam, "SplitAngle.Angle" ) ) {
double doubleValue = atof( theValue ) * 180 / PI;
TCollection_AsciiString str( doubleValue );
return CORBA::string_dup( str.ToCString() );
@ -499,26 +484,25 @@ void RepairGUI_ShapeProcessDlg::loadDefaults()
anOp->GetShapeProcessParameters( anOperators, aParams, aValues );
// check the default items-operators
int i;
for ( i = 0; i < anOperators->length(); i++ )
{
for ( int i = 0; i < anOperators->length(); i++ ) {
//MESSAGE("-->"<<(const char*)anOperators[i]);
QListViewItem* anItem = myOpList->findItem( (const char*)anOperators[i], 0 );
if ( anItem /*&& anItem->inherits( "QCheckListItem" )*/ )
((QCheckListItem*) anItem)->setOn( true );
QList<QListWidgetItem*> items = myOpList->findItems ( (const char*)anOperators[i], Qt::MatchFixedString );
if ( items.count() )
( items[0] )->setCheckState( Qt::Checked );
}
// Retrieve default parameters for ALL operators
for ( QListViewItemIterator it(myOpList); it.current(); ++it ) {
CORBA::String_var anOperator = CORBA::string_dup( it.current()->text( 0 ).latin1() );
for ( int i = 0; i < myOpList->count(); i++ ) {
CORBA::String_var anOperator = CORBA::string_dup( myOpList->item( i )->text().toLatin1().constData() );
anOp->GetOperatorParameters( anOperator.in(), aParams, aValues );
// set default values of parameters
if ( aParams->length() != aValues->length() )
continue;
for ( i = 0; i < aParams->length(); i++ ) {
QWidget* aCtrl = getControl( (const char*)aParams[i] );
const char* aValue = set_convert( (const char*)aParams[i], aValues[i] );
for ( int j = 0; j < aParams->length(); j++ ) {
QWidget* aCtrl = getControl( (const char*)aParams[j] );
const char* aValue = set_convert( (const char*)aParams[j], aValues[j] );
setValue( aCtrl, aValue );
}
}
@ -528,40 +512,37 @@ void RepairGUI_ShapeProcessDlg::loadDefaults()
// function : setValue()
// 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 )
return;
if ( theControl->isA( "QtxDblSpinBox" ) )
((QtxDblSpinBox*)theControl)->setValue( QString( theValue ).toDouble() );
else if ( theControl->isA( "QSpinBox" ) )
((QSpinBox*)theControl)->setValue( QString( theValue ).toInt() );
else if ( theControl->isA( "QComboBox" ) )
((QComboBox*)theControl)->setCurrentText( QString( theValue ) );
else if ( theControl->isA( "QCheckBox" ) )
((QCheckBox*)theControl)->setChecked( QString( theValue ).toInt() != 0 );
if ( theControl && !theValue.isNull() ) {
if ( qobject_cast<QDoubleSpinBox*>( theControl ) )
qobject_cast<QDoubleSpinBox*>( theControl )->setValue( theValue.toDouble() );
else if ( qobject_cast<QSpinBox*>( theControl ) )
qobject_cast<QSpinBox*>( theControl )->setValue( theValue.toInt() );
else if ( qobject_cast<QComboBox*>( theControl ) )
qobject_cast<QComboBox*>( theControl )->setEditText( theValue );
else if ( qobject_cast<QCheckBox*>( theControl ) )
qobject_cast<QCheckBox*>( theControl )->setChecked( theValue.toInt() != 0 );
}
}
//=================================================================================
// function : getValue()
// 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 )
return "";
if ( theControl->isA( "QtxDblSpinBox" ) )
return ((QtxDblSpinBox*)theControl)->text().latin1();
else if ( theControl->isA( "QSpinBox" ) )
return ((QSpinBox*)theControl)->text().latin1();
else if ( theControl->isA( "QComboBox" ) )
return ((QComboBox*)theControl)->currentText().latin1();
else if ( theControl->isA( "QCheckBox" ) )
return ((QCheckBox*)theControl)->isChecked() ? "1" : "0";
return "";
if ( theControl ) {
if ( qobject_cast<QDoubleSpinBox*>( theControl ) )
return QString::number( qobject_cast<QDoubleSpinBox*>( theControl )->value() );
else if ( qobject_cast<QSpinBox*>( theControl ) )
return QString::number( qobject_cast<QSpinBox*>( theControl )->value() );
else if ( qobject_cast<QComboBox*>( theControl ) )
return qobject_cast<QComboBox*>( theControl )->currentText();
else if ( qobject_cast<QCheckBox*>( theControl ) )
return qobject_cast<QCheckBox*>( theControl )->isChecked() ? "1" : "0";
}
return 0;
}
//=================================================================================
@ -581,13 +562,11 @@ bool RepairGUI_ShapeProcessDlg::isValid( QString& msg )
{
bool error = false;
GEOM::string_array_var anOperators = getActiveOperators();
if ( !myObjects->length() )
{
if ( !myObjects->length() ) {
msg += tr( "ERROR_NO_OBJECTS" );
error = true;
}
if ( !anOperators->length() )
{
if ( !anOperators->length() ) {
if ( error )
msg += "\n";
msg += tr( "ERROR_NO_OPERATORS" );
@ -624,11 +603,10 @@ bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects )
*/// -----------
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 anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->ProcessShape(
obj, anOperators, aParams, aValues );
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->
ProcessShape( obj, anOperators, aParams, aValues );
if ( anObj->_is_nil() )
anErrorObjNames << GEOMBase::GetName( obj );
else
@ -636,7 +614,7 @@ bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects )
}
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.
}
@ -648,15 +626,17 @@ bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects )
GEOM::string_array* RepairGUI_ShapeProcessDlg::getActiveOperators()
{
GEOM::string_array_var anOperators = new GEOM::string_array();
QStringList aCheckedList;
QStringList::Iterator it;
for ( it = myOpLst.begin(); it != myOpLst.end(); ++it )
if ( ((QCheckListItem*)myOpList->findItem( *it, 0 ))->isOn() )
aCheckedList << *it;
anOperators->length( aCheckedList.size() );
int i = 0;
for ( it = aCheckedList.begin(); it != aCheckedList.end(); ++it )
anOperators[i++] = CORBA::string_dup( (*it).latin1() );
QStringList aCheckedList;
for ( int i = 0; i < myOpList->count(); i++ ) {
if ( myOpList->item( i )->checkState() == Qt::Checked )
aCheckedList << myOpList->item( i )->text();
}
anOperators->length( aCheckedList.count() );
for ( int i = 0; i < aCheckedList.count(); i++ )
anOperators[i] = CORBA::string_dup( aCheckedList[i].toLatin1().constData() );
return anOperators._retn();
}
@ -665,34 +645,33 @@ GEOM::string_array* RepairGUI_ShapeProcessDlg::getActiveOperators()
// function : getcontrol
// purpose :
//=================================================================================
QWidget* RepairGUI_ShapeProcessDlg::getControl( const char* theParam )
QWidget* RepairGUI_ShapeProcessDlg::getControl( const QString& theParam )
{
string aParam = theParam;
if ( aParam == "SplitAngle.Angle" ) return mySplitAngleAngle;
else if ( aParam == "SplitAngle.MaxTolerance" ) return mySplitAngleMaxTol;
else if ( aParam == "SplitClosedFaces.NbSplitPoints" ) return mySplitClosedFacesNum;
else if ( aParam == "FixFaceSize.Tolerance" ) return myFixFaceSizeTol;
else if ( aParam == "DropSmallEdges.Tolerance3d" ) return myDropSmallEdgesTol3D;
else if ( aParam == "BSplineRestriction.SurfaceMode" ) return myBSplineSurfModeChk;
else if ( aParam == "BSplineRestriction.Curve3dMode" ) return myBSpline3DCurveChk;
else if ( aParam == "BSplineRestriction.Curve2dMode" ) return myBSpline2DCurveChk;
else if ( aParam == "BSplineRestriction.Tolerance3d" ) return myBSplineTol3D;
else if ( aParam == "BSplineRestriction.Tolerance2d" ) return myBSplineTol2D;
else if ( aParam == "BSplineRestriction.RequiredDegree" ) return myBSplineDegree;
else if ( aParam == "BSplineRestriction.RequiredNbSegments" ) return myBSplineSegments;
else if ( aParam == "BSplineRestriction.Continuity3d" ) return myBSpline3DCont;
else if ( aParam == "BSplineRestriction.Continuity2d" ) return myBSpline2DCont;
else if ( aParam == "SplitContinuity.Tolerance3d" ) return mySplitContTol3D;
else if ( aParam == "SplitContinuity.SurfaceContinuity" ) return mySplitContSurfCont;
else if ( aParam == "SplitContinuity.CurveContinuity" ) return mySplitContCurvCont;
else if ( aParam == "ToBezier.SurfaceMode" ) return myToBezierSurfModeChk;
else if ( aParam == "ToBezier.Curve3dMode" ) return myToBezier3DCurveChk;
else if ( aParam == "ToBezier.Curve2dMode" ) return myToBezier2DCurveChk;
else if ( aParam == "ToBezier.MaxTolerance" ) return myToBezierMaxTol;
else if ( aParam == "SameParameter.Tolerance3d" ) return mySameParameterTol3D;
else if ( aParam == "FixShape.Tolerance3d" ) return myFixShapeTol3D;
else if ( aParam == "FixShape.MaxTolerance3d" ) return myFixShapeMaxTol3D;
return NULL;
if ( theParam == "SplitAngle.Angle" ) return mySplitAngleAngle;
else if ( theParam == "SplitAngle.MaxTolerance" ) return mySplitAngleMaxTol;
else if ( theParam == "SplitClosedFaces.NbSplitPoints" ) return mySplitClosedFacesNum;
else if ( theParam == "FixFaceSize.Tolerance" ) return myFixFaceSizeTol;
else if ( theParam == "DropSmallEdges.Tolerance3d" ) return myDropSmallEdgesTol3D;
else if ( theParam == "BSplineRestriction.SurfaceMode" ) return myBSplineSurfModeChk;
else if ( theParam == "BSplineRestriction.Curve3dMode" ) return myBSpline3DCurveChk;
else if ( theParam == "BSplineRestriction.Curve2dMode" ) return myBSpline2DCurveChk;
else if ( theParam == "BSplineRestriction.Tolerance3d" ) return myBSplineTol3D;
else if ( theParam == "BSplineRestriction.Tolerance2d" ) return myBSplineTol2D;
else if ( theParam == "BSplineRestriction.RequiredDegree" ) return myBSplineDegree;
else if ( theParam == "BSplineRestriction.RequiredNbSegments" ) return myBSplineSegments;
else if ( theParam == "BSplineRestriction.Continuity3d" ) return myBSpline3DCont;
else if ( theParam == "BSplineRestriction.Continuity2d" ) return myBSpline2DCont;
else if ( theParam == "SplitContinuity.Tolerance3d" ) return mySplitContTol3D;
else if ( theParam == "SplitContinuity.SurfaceContinuity" ) return mySplitContSurfCont;
else if ( theParam == "SplitContinuity.CurveContinuity" ) return mySplitContCurvCont;
else if ( theParam == "ToBezier.SurfaceMode" ) return myToBezierSurfModeChk;
else if ( theParam == "ToBezier.Curve3dMode" ) return myToBezier3DCurveChk;
else if ( theParam == "ToBezier.Curve2dMode" ) return myToBezier2DCurveChk;
else if ( theParam == "ToBezier.MaxTolerance" ) return myToBezierMaxTol;
else if ( theParam == "SameParameter.Tolerance3d" ) return mySameParameterTol3D;
else if ( theParam == "FixShape.Tolerance3d" ) return myFixShapeTol3D;
else if ( theParam == "FixShape.MaxTolerance3d" ) return myFixShapeMaxTol3D;
return 0;
}
//=================================================================================
@ -701,6 +680,9 @@ QWidget* RepairGUI_ShapeProcessDlg::getControl( const char* theParam )
//=================================================================================
void RepairGUI_ShapeProcessDlg::initParamsValues()
{
if ( myOpLst.count() )
return; // already filled
myOpLst << "FixShape";
myValMap["FixShape"] << "FixShape.Tolerance3d";
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_var aParams = new GEOM::string_array();
int i( 0 ), j( 0 );
GEOM::string_array_var aParams = new GEOM::string_array();
int i = 0, j = 0;
// calculate the length of parameters
for ( i = 0, j = 0; i < theOperators.length(); i++ )
j+= myValMap[QString((const char*)theOperators[i])].size();
// calculate the length of parameters
for ( i = 0, j = 0; i < theOperators.length(); i++ )
j += myValMap[ QString( theOperators[i] ) ].size();
// set the new length of paremeters
aParams->length( j );
// set the new length of paremeters
aParams->length( j );
// fill the parameters
for ( i = 0, j = 0; i < theOperators.length(); i++ ) {
QStringList aValLst = myValMap[ QString( theOperators[i] ) ];
for ( QStringList::Iterator it = aValLst.begin(); it != aValLst.end(); ++it )
aParams[j++] = CORBA::string_dup( (*it).toLatin1().constData() );
}
// fill the parameters
for ( i = 0, j = 0; i < theOperators.length(); i++ )
{
QStringList aValLst = myValMap[QString( (const char*)theOperators[i] )];
for ( QStringList::Iterator it = aValLst.begin(); it != aValLst.end(); ++it )
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();
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] );
if ( 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 )
{
QButton* btn = (QButton*)sender();
if ( on && btn->isToggleButton() &&
QMessageBox::warning(myGeomGUI->getApp()->desktop(),
tr( "GEOM_WRN_WARNING" ), tr( "TIME_CONSUMING" ),
QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
QAbstractButton* btn = (QAbstractButton*)sender();
if ( on && btn->isCheckable() &&
SUIT_MessageBox::warning( this,
tr( "GEOM_WRN_WARNING" ), tr( "TIME_CONSUMING" ),
SUIT_MessageBox::Yes | SUIT_MessageBox::No ) == SUIT_MessageBox::No )
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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
#define DIALOGBOX_ShapeProcess_H
#ifndef REPAIRGUI_SHAPEPROCESSDLG_H
#define REPAIRGUI_SHAPEPROCESSDLG_H
#include "GEOMBase_Skeleton.h"
#include "DlgRef_1Sel_QTD.h"
#include "RepairGUI.h"
#include "QtxDblSpinBox.h"
#include <GEOMBase_Skeleton.h>
#include <qspinbox.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qlistview.h>
#include <qwidgetstack.h>
#include <qvaluelist.h>
#include <qdict.h>
#include <qmap.h>
#include <QMap>
class DlgRef_1Sel;
class QSpinBox;
class QDoubleSpinBox;
class QComboBox;
class QCheckBox;
class QListWidget;
//=================================================================================
// class : RepairGUI_ShapeProcessDlg
@ -48,93 +43,92 @@
//=================================================================================
class RepairGUI_ShapeProcessDlg : public GEOMBase_Skeleton
{
Q_OBJECT
Q_OBJECT
public:
RepairGUI_ShapeProcessDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0,
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_ShapeProcessDlg();
RepairGUI_ShapeProcessDlg( GeometryGUI*, QWidget* = 0, bool = false );
~RepairGUI_ShapeProcessDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
virtual void closeEvent( QCloseEvent* e );
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* );
private:
void init();
void reset();
void loadDefaults(); // initialize all controls with default values (from resource file)
GEOM::string_array* getActiveOperators();
GEOM::string_array* getParameters( const GEOM::string_array& theOperators );
GEOM::string_array* getValues( const GEOM::string_array& theParameters );
void enterEvent(QEvent* e);
QWidget* getControl( const char* );
void setValue( QWidget*, const char* ); // initialize the given control in the proper way
// (analize its class and convert the value string)
const char* getValue( QWidget* theControl ) const; // retrieve value of the control in the proper way
QStringList myOpLst; // list of available Shape Healing Operators
QMap<QString,QStringList> myValMap; // map of parameters of operators
//QDict<QString,QWidget*> myCtrlMap; // map of controls (values) of parameters
void initParamsValues(); // initialize the data structures
void initSelection();
GEOM::ListOfGO_var myObjects; // selected objects
DlgRef_1Sel_QTD* mySelectWdgt;
QListView* myOpList;
QWidgetStack* myStack;
QtxDblSpinBox* myFixShapeTol3D;
QtxDblSpinBox* myFixShapeMaxTol3D;
QtxDblSpinBox* myFixFaceSizeTol;
QtxDblSpinBox* myDropSmallEdgesTol3D;
QtxDblSpinBox* mySplitAngleAngle;
QtxDblSpinBox* mySplitAngleMaxTol;
QSpinBox* mySplitClosedFacesNum;
QtxDblSpinBox* mySplitContTol3D;
QComboBox* mySplitContSurfCont;
QComboBox* mySplitContCurvCont;
QCheckBox* myBSplineSurfModeChk;
QCheckBox* myBSpline3DCurveChk;
QCheckBox* myBSpline2DCurveChk;
QtxDblSpinBox* myBSplineTol3D;
QtxDblSpinBox* myBSplineTol2D;
QSpinBox* myBSplineDegree;
QSpinBox* myBSplineSegments;
QComboBox* myBSpline2DCont;
QComboBox* myBSpline3DCont;
QCheckBox* myToBezierSurfModeChk;
QCheckBox* myToBezier3DCurveChk;
QCheckBox* myToBezier2DCurveChk;
QtxDblSpinBox* myToBezierMaxTol;
QtxDblSpinBox* mySameParameterTol3D;
void init();
void reset();
void loadDefaults(); // initialize all controls with default values (from resource file)
GEOM::string_array* getActiveOperators();
GEOM::string_array* getParameters( const GEOM::string_array& );
GEOM::string_array* getValues( const GEOM::string_array& );
void enterEvent( QEvent* );
QWidget* getControl( const QString& );
void setValue( QWidget*, const QString& ); // initialize the given control in the proper way
// (analize its class and convert the value string)
QString getValue( QWidget* ) const; // retrieve value of the control in the proper way
//QDict<QString,QWidget*> myCtrlMap; // map of controls (values) of parameters
void initParamsValues(); // initialize the data structures
void initSelection();
private:
QStringList myOpLst; // list of available Shape Healing Operators
QMap<QString,QStringList> myValMap; // map of parameters of operators
GEOM::ListOfGO_var myObjects; // selected objects
DlgRef_1Sel* mySelectWdgt;
QListWidget* myOpList;
QDoubleSpinBox* myFixShapeTol3D;
QDoubleSpinBox* myFixShapeMaxTol3D;
QDoubleSpinBox* myFixFaceSizeTol;
QDoubleSpinBox* myDropSmallEdgesTol3D;
QDoubleSpinBox* mySplitAngleAngle;
QDoubleSpinBox* mySplitAngleMaxTol;
QSpinBox* mySplitClosedFacesNum;
QDoubleSpinBox* mySplitContTol3D;
QComboBox* mySplitContSurfCont;
QComboBox* mySplitContCurvCont;
QCheckBox* myBSplineSurfModeChk;
QCheckBox* myBSpline3DCurveChk;
QCheckBox* myBSpline2DCurveChk;
QDoubleSpinBox* myBSplineTol3D;
QDoubleSpinBox* myBSplineTol2D;
QSpinBox* myBSplineDegree;
QSpinBox* myBSplineSegments;
QComboBox* myBSpline2DCont;
QComboBox* myBSpline3DCont;
QCheckBox* myToBezierSurfModeChk;
QCheckBox* myToBezier3DCurveChk;
QCheckBox* myToBezier2DCurveChk;
QDoubleSpinBox* myToBezierMaxTol;
QDoubleSpinBox* mySameParameterTol3D;
private slots:
void onOk();
bool onApply();
void onOk();
bool onApply();
void activate();
void lineEditReturnPressed();
void selectionChanged();
void selectClicked();
void operationChanged();
void advOptionToggled(bool);
void activate();
void lineEditReturnPressed();
void selectionChanged();
void selectClicked();
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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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 "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include "SUIT_Session.h"
#include "SALOME_ListIteratorOfListIO.hxx"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#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 <TColStd_IndexedMapOfInteger.hxx>
#include <qlabel.h>
using namespace std;
#include <utilities.h>
//=================================================================================
// class : RepairGUI_SuppressFacesDlg()
@ -48,32 +49,35 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
RepairGUI_SuppressFacesDlg::RepairGUI_SuppressFacesDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl)
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
RepairGUI_SuppressFacesDlg::RepairGUI_SuppressFacesDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
bool modal )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal )
{
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 image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SUPRESS_FACE" ) ) );
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"));
RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
mainFrame()->GroupConstructors->setTitle(tr("GEOM_SUPRESSFACE"));
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_1Sel_QTD(this, "GroupPoints");
GroupPoints->GroupBox1->setTitle(tr("Faces to remove"));
GroupPoints->TextLabel1->setText(tr("Faces"));
GroupPoints->PushButton1->setPixmap(image1);
GroupPoints = new DlgRef_1Sel( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "Faces to remove" ) );
GroupPoints->TextLabel1->setText( tr( "Faces" ) );
GroupPoints->PushButton1->setIcon( image1 );
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();
}
@ -104,14 +108,14 @@ void RepairGUI_SuppressFacesDlg::Init()
initSelection();
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "SUPRESS_FACE_NEW_OBJ_NAME" ) );
}
@ -138,7 +142,7 @@ bool RepairGUI_SuppressFacesDlg::ClickOnApply()
initName();
myEditCurrentArgument->setText("");
myEditCurrentArgument->setText( "" );
myObjects->length( 0 );
myFaces.clear();
@ -155,31 +159,26 @@ bool RepairGUI_SuppressFacesDlg::ClickOnApply()
//=================================================================================
void RepairGUI_SuppressFacesDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("");
myEditCurrentArgument->setText( "" );
Standard_Boolean aRes = Standard_False;
int i = 0;
int numFaces = 0;
myObjects->length( IObjectCount() );
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();
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( !CORBA::is_nil( aSelectedObject ) && aRes )
{
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) )
{
if ( aShape.ShapeType() <= TopAbs_FACE ) // FACE, SHELL, SOLID, COMPOUND
{
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) ) {
if ( aShape.ShapeType() <= TopAbs_FACE ) { // FACE, SHELL, SOLID, COMPOUND
GEOM::short_array anIndexes;
TColStd_IndexedMapOfInteger aMap;
myGeomGUI->getApp()->selectionMgr()->GetIndexes( anIO, aMap );
if ( !aMap.IsEmpty() )
{
if ( !aMap.IsEmpty() ) {
Convert( aMap, anIndexes );
myObjects[i++] = aSelectedObject; // append the object
myFaces.append( anIndexes ); // append faces' indexes
@ -212,8 +211,7 @@ void RepairGUI_SuppressFacesDlg::Convert( const TColStd_IndexedMapOfInteger& the
//=================================================================================
void RepairGUI_SuppressFacesDlg::SetEditCurrentArgument()
{
if( sender() == GroupPoints->PushButton1 )
{
if ( sender() == GroupPoints->PushButton1 ) {
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
}
@ -227,8 +225,7 @@ void RepairGUI_SuppressFacesDlg::SetEditCurrentArgument()
//=================================================================================
void RepairGUI_SuppressFacesDlg::LineEditReturnPressed()
{
if( sender() == GroupPoints->LineEdit1 )
{
if ( sender() == GroupPoints->LineEdit1 ) {
myEditCurrentArgument = GroupPoints->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed();
}
@ -242,8 +239,8 @@ void RepairGUI_SuppressFacesDlg::LineEditReturnPressed()
void RepairGUI_SuppressFacesDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
//myGeomGUI->SetState( 0 );
initSelection();
@ -254,9 +251,9 @@ void RepairGUI_SuppressFacesDlg::ActivateThisDialog()
// function : enterEvent()
// 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();
}
@ -265,7 +262,7 @@ void RepairGUI_SuppressFacesDlg::enterEvent(QEvent* e)
// function : closeEvent()
// purpose :
//=================================================================================
void RepairGUI_SuppressFacesDlg::closeEvent(QCloseEvent* e)
void RepairGUI_SuppressFacesDlg::closeEvent( QCloseEvent* e )
{
//myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
@ -284,7 +281,7 @@ GEOM::GEOM_IOperations_ptr RepairGUI_SuppressFacesDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool RepairGUI_SuppressFacesDlg::isValid( QString& msg )
bool RepairGUI_SuppressFacesDlg::isValid( QString& )
{
const int objL = myObjects->length(), facesL = myFaces.size();
return ( objL && objL == facesL );
@ -297,8 +294,7 @@ bool RepairGUI_SuppressFacesDlg::isValid( QString& msg )
bool RepairGUI_SuppressFacesDlg::execute( ObjectList& objects )
{
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::short_array faces = myFaces[i];
//MESSAGE(">>>> Dlg, passing faces.. len = " << faces.length());
@ -310,7 +306,7 @@ bool RepairGUI_SuppressFacesDlg::execute( ObjectList& objects )
}
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.
}

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,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.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
#define DIALOGBOX_SUPPRESSFACES_H
#ifndef REPAIRGUI_SUPPRESSFACESDLG_H
#define REPAIRGUI_SUPPRESSFACESDLG_H
#include "GEOMBase_Skeleton.h"
#include "DlgRef_1Sel_QTD.h"
#include <GEOMBase_Skeleton.h>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <QList>
class DlgRef_1Sel;
class TColStd_IndexedMapOfInteger;
//=================================================================================
// class : RepairGUI_SuppressFacesDlg
@ -39,45 +39,46 @@
//=================================================================================
class RepairGUI_SuppressFacesDlg : public GEOMBase_Skeleton
{
Q_OBJECT
Q_OBJECT
public:
RepairGUI_SuppressFacesDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0,
const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~RepairGUI_SuppressFacesDlg();
RepairGUI_SuppressFacesDlg( GeometryGUI*, QWidget* = 0, bool = false );
~RepairGUI_SuppressFacesDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
private :
void Init();
void enterEvent(QEvent* e);
void closeEvent(QCloseEvent* e);
GEOM::ListOfGO_var myObjects;
QValueList<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.
void Convert( const TColStd_IndexedMapOfInteger&, GEOM::short_array& );
void initSelection();
DlgRef_1Sel_QTD* GroupPoints;
private:
void Init();
void enterEvent( QEvent* );
void closeEvent( QCloseEvent* );
void Convert( const TColStd_IndexedMapOfInteger&,
GEOM::short_array& );
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* GroupPoints;
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
};
#endif // DIALOGBOX_SUPPRESSFACES_H
#endif // REPAIRGUI_SUPPRESSFACESDLG_H