Mantis issue 0021852: EDF 1680 GEOM: Publish 'Check free boundaries' results in the Object Browser

This commit is contained in:
jfa 2012-12-21 13:13:33 +00:00
parent 9023c3cda7
commit d45b760938
14 changed files with 227 additions and 252 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -2,8 +2,10 @@
\page boundaries_page Check Free Boundaries \page boundaries_page Check Free Boundaries
Detects and highlights wires and edges that are not shared between Detects and highlights wires and edges that are not shared between
two faces and are considered a shape's boundary. two faces and are considered a shape's boundary.
<br>Creates corresponding objects and publishes them into the study on
"Apply" or "Apply and Close".
<b>TUI Command:</b> <em>(NoError, ClosedWires, OpenWires) = <b>TUI Command:</b> <em>(NoError, ClosedWires, OpenWires) =
geompy.GetFreeBoundary(Shape),</em> where \em Shape is a shape to be geompy.GetFreeBoundary(Shape),</em> where \em Shape is a shape to be

View File

@ -509,7 +509,7 @@ GEOM::GEOM_Object_ptr BlocksGUI_ExplodeDlg::getFather( GEOM::GEOM_Object_ptr )
// Function : getNewObjectName // Function : getNewObjectName
// Purpose : Redefine this method to return proper name for a new object // Purpose : Redefine this method to return proper name for a new object
//================================================================ //================================================================
QString BlocksGUI_ExplodeDlg::getNewObjectName() const QString BlocksGUI_ExplodeDlg::getNewObjectName (int) const
{ {
return QString::null; return QString::null;
} }

View File

@ -50,7 +50,7 @@ protected:
virtual bool execute( ObjectList& ); virtual bool execute( ObjectList& );
virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr ); virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr );
virtual QString getNewObjectName() const; virtual QString getNewObjectName (int CurrObj = -1) const;
private: private:
void Init(); void Init();

View File

@ -831,7 +831,7 @@ GEOM::GEOM_Object_ptr EntityGUI_SubShapeDlg::getFather(GEOM::GEOM_Object_ptr)
// Function : getNewObjectName // Function : getNewObjectName
// Purpose : // Purpose :
//================================================================ //================================================================
QString EntityGUI_SubShapeDlg::getNewObjectName() const QString EntityGUI_SubShapeDlg::getNewObjectName (int) const
{ {
return QString::null; return QString::null;
} }

View File

@ -51,7 +51,7 @@ protected:
virtual bool isValid (QString&); virtual bool isValid (QString&);
virtual bool execute (ObjectList&); virtual bool execute (ObjectList&);
virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr); virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
virtual QString getNewObjectName() const; virtual QString getNewObjectName (int CurrObj = -1) const;
void closeEvent (QCloseEvent*); void closeEvent (QCloseEvent*);

View File

@ -18,12 +18,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// File : GEOMBase_Helper.cxx // File : GEOMBase_Helper.cxx
// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
//
#include "GEOMBase_Helper.h" #include "GEOMBase_Helper.h"
#include "GEOMBase.h" #include "GEOMBase.h"
#include "GEOM_Operation.h" #include "GEOM_Operation.h"
@ -858,11 +857,11 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction, b
addSubshapesToStudy(); // add Sub-shapes if local selection addSubshapesToStudy(); // add Sub-shapes if local selection
const int nbObjs = objects.size(); const int nbObjs = objects.size();
QStringList anEntryList; QStringList anEntryList;
int aNumber = 1; int currObj = 1, aNumber = 1;
for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) { for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it, currObj++ ) {
GEOM::GEOM_Object_var obj=*it; GEOM::GEOM_Object_var obj=*it;
if ( publish ) { if ( publish ) {
QString aName = getNewObjectName(); QString aName = getNewObjectName(currObj);
if ( nbObjs > 1 ) { if ( nbObjs > 1 ) {
if (aName.isEmpty()) if (aName.isEmpty())
aName = getPrefix(obj); aName = getPrefix(obj);
@ -1006,7 +1005,7 @@ GEOM::GEOM_Object_ptr GEOMBase_Helper::getFather( GEOM::GEOM_Object_ptr theObj )
// Function : getNewObjectName // Function : getNewObjectName
// Purpose : Redefine this method to return proper name for a new object // Purpose : Redefine this method to return proper name for a new object
//================================================================ //================================================================
QString GEOMBase_Helper::getNewObjectName() const QString GEOMBase_Helper::getNewObjectName (int) const
{ {
return QString::null; return QString::null;
} }

View File

@ -18,12 +18,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// File : GEOMBase_Helper.h // File : GEOMBase_Helper.h
// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
//
#ifndef GEOMBASE_HELPER_H #ifndef GEOMBASE_HELPER_H
#define GEOMBASE_HELPER_H #define GEOMBASE_HELPER_H
@ -163,7 +162,7 @@ protected:
// for <theObj> or a nil reference if <theObj> should be published // for <theObj> or a nil reference if <theObj> should be published
// as a top-level object. // as a top-level object.
virtual QString getNewObjectName() const; virtual QString getNewObjectName (int CurrObj = -1) const;
virtual bool extractPrefix() const; virtual bool extractPrefix() const;
virtual void addSubshapesToStudy(); virtual void addSubshapesToStudy();
@ -193,7 +192,6 @@ protected:
virtual void setIsDisableBrowsing( const bool theFlag ) { myIsDisableBrowsing = theFlag; } virtual void setIsDisableBrowsing( const bool theFlag ) { myIsDisableBrowsing = theFlag; }
virtual bool isDisableBrowsing() const { return myIsDisableBrowsing; } virtual bool isDisableBrowsing() const { return myIsDisableBrowsing; }
private: private:
QString getEntry( GEOM::GEOM_Object_ptr ) const; QString getEntry( GEOM::GEOM_Object_ptr ) const;
void clearShapeBuffer( GEOM::GEOM_Object_ptr ); void clearShapeBuffer( GEOM::GEOM_Object_ptr );
@ -215,7 +213,6 @@ private:
bool myIsWaitCursorEnabled; bool myIsWaitCursorEnabled;
bool myIsDisableBrowsing; //This flag enable/disable selection bool myIsDisableBrowsing; //This flag enable/disable selection
//in the Object Browser newly created objects. //in the Object Browser newly created objects.
}; };
#endif // GEOMBASE_HELPER_H #endif // GEOMBASE_HELPER_H

View File

@ -18,12 +18,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// File : GEOMBase_Skeleton.cxx // File : GEOMBase_Skeleton.cxx
// Author : Damien COQUERET, Open CASCADE S.A.S. // Author : Damien COQUERET, Open CASCADE S.A.S.
//
#include "GEOMBase_Skeleton.h" #include "GEOMBase_Skeleton.h"
#include "GEOMBase.h" #include "GEOMBase.h"
@ -293,7 +292,7 @@ void GEOMBase_Skeleton::initName( const QString& thePrefix )
// function : getNewObjectName() // function : getNewObjectName()
// purpose : returns contents of Name field // purpose : returns contents of Name field
//================================================================================= //=================================================================================
QString GEOMBase_Skeleton::getNewObjectName() const QString GEOMBase_Skeleton::getNewObjectName (int) const
{ {
return myMainFrame->ResultName->text(); return myMainFrame->ResultName->text();
} }

View File

@ -18,12 +18,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// File : GEOMBase_Skeleton.h // File : GEOMBase_Skeleton.h
// Author : Damine COQUERET, Open CASCADE S.A.S. // Author : Damine COQUERET, Open CASCADE S.A.S.
//
#ifndef GEOMBASE_SKELETON_H #ifndef GEOMBASE_SKELETON_H
#define GEOMBASE_SKELETON_H #define GEOMBASE_SKELETON_H
@ -74,7 +73,7 @@ protected:
/*! returns contents of "Name" field /*! returns contents of "Name" field
*/ */
virtual QString getNewObjectName() const; virtual QString getNewObjectName (int CurrObj = -1) const;
/*! returns id of a selected "constructor" radio button or '-1' in case of error /*! returns id of a selected "constructor" radio button or '-1' in case of error
*/ */

View File

@ -259,6 +259,10 @@
<source>ICON_DLG_FREE_FACES</source> <source>ICON_DLG_FREE_FACES</source>
<translation>free_faces.png</translation> <translation>free_faces.png</translation>
</message> </message>
<message>
<source>ICON_DLG_FREE_BOUNDS</source>
<translation>free_bound.png</translation>
</message>
<message> <message>
<source>ICON_DLG_FUSE</source> <source>ICON_DLG_FUSE</source>
<translation>fuse.png</translation> <translation>fuse.png</translation>

View File

@ -5414,6 +5414,14 @@ Number of sketch points too small</translation>
<source>NUMBER_OPEN</source> <source>NUMBER_OPEN</source>
<translation>Number of open free boundaries: </translation> <translation>Number of open free boundaries: </translation>
</message> </message>
<message>
<source>NAME_CLOSED</source>
<translation>Closed_Free_Boundary_%1</translation>
</message>
<message>
<source>NAME_OPEN</source>
<translation>Open_Free_Boundary_%1</translation>
</message>
</context> </context>
<context> <context>
<name>RepairGUI_GlueDlg</name> <name>RepairGUI_GlueDlg</name>

View File

@ -18,15 +18,16 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// File : RepairGUI_FreeBoundDlg.cxx // File : RepairGUI_FreeBoundDlg.cxx
// Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com) // Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com)
//
#include "RepairGUI_FreeBoundDlg.h" #include "RepairGUI_FreeBoundDlg.h"
#include <GEOMBase.h> #include <GEOMBase.h>
#include <DlgRef.h>
#include <GeometryGUI.h> #include <GeometryGUI.h>
#include <GEOM_Displayer.h> #include <GEOM_Displayer.h>
#include <GEOMImpl_Types.hxx> #include <GEOMImpl_Types.hxx>
@ -51,7 +52,7 @@
#include <QKeyEvent> #include <QKeyEvent>
#define SPACING 6 #define SPACING 6
#define MARGIN 9 #define MARGIN 0
/*! /*!
Class : RepairGUI_FreeBoundDlg Class : RepairGUI_FreeBoundDlg
@ -62,59 +63,55 @@
// function : RepairGUI_FreeBoundDlg // function : RepairGUI_FreeBoundDlg
// purpose : Constructor // purpose : Constructor
//================================================================================= //=================================================================================
RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg( GeometryGUI* theGUI, QWidget* theParent ) RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg (GeometryGUI* theGUI, QWidget* theParent)
: QDialog( theParent, 0 ), : GEOMBase_Skeleton(theGUI, theParent)
GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( theParent ) ),
myGeomGUI( theGUI )
{ {
setAttribute( Qt::WA_DeleteOnClose ); QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_FREE_BOUNDS")));
QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
setWindowTitle( tr( "CAPTION" ) ); setWindowTitle(tr("CAPTION"));
QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); /***************************************************************/
QGroupBox* aMainGrp = new QGroupBox( tr( "FREE_BOUND" ), this ); mainFrame()->GroupConstructors->setTitle(tr("FREE_BOUND"));
mainFrame()->RadioButton1->setIcon(image0);
mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close();
QLabel* lab = new QLabel( tr( "GEOM_OBJECT" ), aMainGrp ); mainFrame()->GroupBoxName->hide();
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 ); QGroupBox* aMainGrp = new QGroupBox (tr("FREE_BOUND"), this);
myOpenLbl = new QLabel( tr( "NUMBER_OPEN" ), aMainGrp );
myClosedLbl->setMinimumWidth( 150 );
myOpenLbl->setMinimumWidth( 150 );
QGridLayout* aMainGrpLayout = new QGridLayout( aMainGrp ); QLabel* lab = new QLabel (tr("GEOM_OBJECT"), aMainGrp);
aMainGrpLayout->setMargin( MARGIN ); aMainGrpLayout->setSpacing( SPACING ); QPushButton* btn = new QPushButton (aMainGrp);
aMainGrpLayout->addWidget( lab, 0, 0 ); btn->setIcon(image1);
aMainGrpLayout->addWidget( btn, 0, 1 ); myEdit = new QLineEdit (aMainGrp);
aMainGrpLayout->addWidget( myEdit, 0, 2 ); myEdit->setReadOnly(true);
aMainGrpLayout->addWidget( myClosedLbl, 1, 0, 1, 3 ); myEdit->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
aMainGrpLayout->addWidget( myOpenLbl, 2, 0, 1, 3 );
QFrame* aFrame = new QFrame( this ); myClosedLbl = new QLabel (tr("NUMBER_CLOSED"), aMainGrp);
aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken ); myOpenLbl = new QLabel (tr("NUMBER_OPEN"), aMainGrp);
QPushButton* aCloseBtn = new QPushButton( tr( "GEOM_BUT_CLOSE" ), aFrame ); myClosedLbl->setMinimumWidth(150);
QPushButton* aHelpBtn = new QPushButton( tr( "GEOM_BUT_HELP" ), aFrame ); myOpenLbl->setMinimumWidth(150);
QHBoxLayout* aBtnLay = new QHBoxLayout( aFrame );
aBtnLay->setMargin( MARGIN ); aBtnLay->setSpacing( SPACING );
aBtnLay->addWidget( aCloseBtn );
aBtnLay->addSpacing( SPACING ); aBtnLay->addStretch();
aBtnLay->addWidget( aHelpBtn );
QVBoxLayout* aLay = new QVBoxLayout( this ); QGridLayout* aMainGrpLayout = new QGridLayout (aMainGrp);
aLay->setSpacing( SPACING ); aMainGrpLayout->addWidget(lab, 0, 0);
aLay->setMargin( MARGIN ); aMainGrpLayout->addWidget(btn, 0, 1);
aLay->addWidget( aMainGrp ); aMainGrpLayout->addWidget(myEdit, 0, 2);
aLay->addWidget( aFrame ); aMainGrpLayout->addWidget(myClosedLbl, 1, 0, 1, 3);
aMainGrpLayout->addWidget(myOpenLbl, 2, 0, 1, 3);
myHelpFileName = "using_measurement_tools_page.html#boundaries_anchor"; QVBoxLayout* aLay = new QVBoxLayout (centralWidget());
aLay->setSpacing(SPACING);
aLay->setMargin(MARGIN);
aLay->addWidget(aMainGrp);
connect( aCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ); resize(minimumSizeHint());
connect( aHelpBtn, SIGNAL( clicked() ), SLOT( onHelp() ) ); /***************************************************************/
myHelpFileName = "boundaries_page.html";
Init(); Init();
} }
@ -127,94 +124,6 @@ RepairGUI_FreeBoundDlg::~RepairGUI_FreeBoundDlg()
{ {
} }
//=================================================================================
// function : onClose
// purpose : SLOT. Called when "close" button pressed. Close dialog
//=================================================================================
void RepairGUI_FreeBoundDlg::onClose()
{
globalSelection();
disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 0, this, 0 );
myGeomGUI->SetActiveDialogBox( 0 );
reject();
erasePreview();
}
//=================================================================================
// function : onHelp()
// purpose :
//=================================================================================
void RepairGUI_FreeBoundDlg::onHelp()
{
LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
if ( app )
app->onHelpContextModule( myGeomGUI ? app->moduleName( myGeomGUI->moduleName() ) : QString(""), myHelpFileName );
else {
QString platform;
#ifdef WIN32
platform = "winapplication";
#else
platform = "application";
#endif
SUIT_MessageBox::warning( this,
tr( "WRN_WARNING" ),
tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
arg( app->resourceMgr()->stringValue( "ExternalBrowser",
platform ) ).arg( myHelpFileName ) );
}
}
//=================================================================================
// function : onDeactivate
// purpose : Deactivate this dialog
//=================================================================================
void RepairGUI_FreeBoundDlg::onDeactivate()
{
setEnabled( false );
globalSelection();
disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
myGeomGUI->SetActiveDialogBox( 0 );
}
//=================================================================================
// function : onActivate
// purpose : Activate this dialog
//=================================================================================
void RepairGUI_FreeBoundDlg::onActivate()
{
myGeomGUI->EmitSignalDeactivateDialog();
setEnabled( true );
myGeomGUI->SetActiveDialogBox( this );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
activateSelection();
onSelectionDone();
}
//=================================================================================
// function : onSelectionDone
// purpose : SLOT. Called when selection changed.
//=================================================================================
void RepairGUI_FreeBoundDlg::onSelectionDone()
{
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
if ( aSelList.Extent() != 1 )
return;
GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( !GEOMBase::IsShape( anObj ) )
return;
else {
myObj = anObj;
displayPreview( true, false, true, true, 3 );
}
}
//================================================================================= //=================================================================================
// function : Init // function : Init
// purpose : Initialize dialog fields // purpose : Initialize dialog fields
@ -224,30 +133,91 @@ void RepairGUI_FreeBoundDlg::Init()
myNbClosed = myNbOpen = 0; myNbClosed = myNbOpen = 0;
myObj = GEOM::GEOM_Object::_nil(); myObj = GEOM::GEOM_Object::_nil();
connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT ( onDeactivate() ) ); myEditCurrentArgument = myEdit;
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) ); connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
activateSelection(); activateSelection();
onSelectionDone(); SelectionIntoArgument();
} }
//================================================================================= //=================================================================================
// function : enterEvent // function : ClickOnOk()
// purpose : Activate dialog // purpose :
//================================================================================= //=================================================================================
void RepairGUI_FreeBoundDlg::enterEvent( QEvent* ) void RepairGUI_FreeBoundDlg::ClickOnOk()
{ {
onActivate(); if (ClickOnApply())
ClickOnCancel();
} }
//================================================================================= //=================================================================================
// function : closeEvent // function : ClickOnApply()
// purpose : Close dialog // purpose :
//================================================================================= //=================================================================================
void RepairGUI_FreeBoundDlg::closeEvent( QCloseEvent* ) bool RepairGUI_FreeBoundDlg::ClickOnApply()
{ {
onClose(); if (!onAccept())
return false;
return true;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void RepairGUI_FreeBoundDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
activateSelection();
displayPreview(true);
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void RepairGUI_FreeBoundDlg::enterEvent(QEvent*)
{
if (!mainFrame()->GroupConstructors->isEnabled())
ActivateThisDialog();
}
//=================================================================================
// function : SelectionIntoArgument
// purpose : SLOT. Called when selection changed.
//=================================================================================
void RepairGUI_FreeBoundDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("");
myClosedLbl->setText(tr("NUMBER_CLOSED"));
myOpenLbl->setText(tr("NUMBER_OPEN"));
myObj = GEOM::GEOM_Object::_nil();
erasePreview();
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() != 1)
return;
GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First());
if (!GEOMBase::IsShape(anObj))
return;
myObj = anObj;
myEditCurrentArgument->setText(GEOMBase::GetName(myObj));
displayPreview(true, false, true, true, 3);
} }
//================================================================================= //=================================================================================
@ -257,11 +227,11 @@ void RepairGUI_FreeBoundDlg::closeEvent( QCloseEvent* )
void RepairGUI_FreeBoundDlg::activateSelection() void RepairGUI_FreeBoundDlg::activateSelection()
{ {
TColStd_MapOfInteger aMap; TColStd_MapOfInteger aMap;
aMap.Add( GEOM_FACE ); aMap.Add(GEOM_FACE);
aMap.Add( GEOM_SHELL ); aMap.Add(GEOM_SHELL);
aMap.Add( GEOM_SOLID ); aMap.Add(GEOM_SOLID);
aMap.Add( GEOM_COMPOUND ); aMap.Add(GEOM_COMPOUND);
globalSelection( aMap ); globalSelection(aMap);
} }
//================================================================================= //=================================================================================
@ -270,14 +240,14 @@ void RepairGUI_FreeBoundDlg::activateSelection()
//================================================================================= //=================================================================================
GEOM::GEOM_IOperations_ptr RepairGUI_FreeBoundDlg::createOperation() GEOM::GEOM_IOperations_ptr RepairGUI_FreeBoundDlg::createOperation()
{ {
return getGeomEngine()->GetIHealingOperations( getStudyId() ); return getGeomEngine()->GetIHealingOperations(getStudyId());
} }
//================================================================================= //=================================================================================
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool RepairGUI_FreeBoundDlg::isValid( QString& ) bool RepairGUI_FreeBoundDlg::isValid (QString&)
{ {
return !myObj->_is_nil(); return !myObj->_is_nil();
} }
@ -286,52 +256,50 @@ bool RepairGUI_FreeBoundDlg::isValid( QString& )
// function : execute // function : execute
// purpose : Get free boundaries // purpose : Get free boundaries
//================================================================================= //=================================================================================
bool RepairGUI_FreeBoundDlg::execute( ObjectList& objects ) bool RepairGUI_FreeBoundDlg::execute (ObjectList& objects)
{ {
if ( !IsPreview() || myObj->_is_nil() )
return false;
GEOM::ListOfGO_var aClosed, anOpen; GEOM::ListOfGO_var aClosed, anOpen;
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() ); GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation());
bool result = anOper->GetFreeBoundary( myObj, aClosed, anOpen ); bool result = anOper->GetFreeBoundary(myObj, aClosed, anOpen);
if ( result ) { if (result) {
myNbClosed = aClosed->length(); myNbClosed = aClosed->length();
myNbOpen = anOpen->length(); myNbOpen = anOpen->length();
int i; int i;
for ( i = 0; i < myNbClosed; i++ ) for (i = 0; i < myNbClosed; i++)
objects.push_back( aClosed[i]._retn() ); objects.push_back(aClosed[i]._retn());
for ( i = 0; i < myNbOpen; i++ ) for (i = 0; i < myNbOpen; i++)
objects.push_back( anOpen[i]._retn() ); objects.push_back(anOpen[i]._retn());
myEdit->setText( GEOMBase::GetName( myObj ) ); QString aLabelText = tr("NUMBER_CLOSED") + QString("%1").arg(myNbClosed);
QString aLabelText = tr( "NUMBER_CLOSED" ) + QString( "%1" ).arg( myNbClosed ); myClosedLbl->setText(aLabelText);
myClosedLbl->setText( aLabelText ); aLabelText = tr("NUMBER_OPEN") + QString("%1").arg(myNbOpen);
aLabelText = tr( "NUMBER_OPEN" ) + QString( "%1" ).arg( myNbOpen ); myOpenLbl->setText(aLabelText);
myOpenLbl->setText( aLabelText );
}
else {
myEdit->setText( GEOMBase::GetName( myObj ) );
myClosedLbl->setText( tr( "NUMBER_CLOSED" ) );
myOpenLbl->setText( tr( "NUMBER_OPEN" ) );
} }
myCurrObj = 1;
return result; return result;
} }
//================================================================================= //================================================================
// function : keyPressEvent() // Function : getNewObjectName
// purpose : // Purpose : Redefine this method to return proper name for a new object
//================================================================================= //================================================================
void RepairGUI_FreeBoundDlg::keyPressEvent( QKeyEvent* e ) QString RepairGUI_FreeBoundDlg::getNewObjectName (int currObj) const
{ {
QDialog::keyPressEvent( e ); QString aName = tr("NAME_CLOSED").arg(currObj);
if ( e->isAccepted() ) if (currObj > myNbClosed)
return; aName = tr("NAME_OPEN").arg(currObj);
return aName;
if ( e->key() == Qt::Key_F1 ) { }
e->accept();
onHelp(); //================================================================
} // Function : getFather
// Purpose : Get father object for object to be added in study
// (called with addInStudy method)
//================================================================
GEOM::GEOM_Object_ptr RepairGUI_FreeBoundDlg::getFather (GEOM::GEOM_Object_ptr)
{
return myObj;
} }

View File

@ -18,17 +18,16 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// File : RepairGUI_FreeBoundDlg.h // File : RepairGUI_FreeBoundDlg.h
// Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com) // Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com)
//
#ifndef REPAIRGUI_FREEBOUNDDLG_H #ifndef REPAIRGUI_FREEBOUNDDLG_H
#define REPAIRGUI_FREEBOUNDDLG_H #define REPAIRGUI_FREEBOUNDDLG_H
#include <QDialog> #include <QDialog>
#include <GEOMBase_Helper.h> #include <GEOMBase_Skeleton.h>
class QLineEdit; class QLineEdit;
class QLabel; class QLabel;
@ -38,42 +37,42 @@ class GeometryGUI;
// class : RepairGUI_FreeBoundDlg // class : RepairGUI_FreeBoundDlg
// purpose : Dialog for displaying free boundaries of selected face, shell or solid // purpose : Dialog for displaying free boundaries of selected face, shell or solid
//================================================================================= //=================================================================================
class RepairGUI_FreeBoundDlg : public QDialog, class RepairGUI_FreeBoundDlg : public GEOMBase_Skeleton
public GEOMBase_Helper
{ {
Q_OBJECT Q_OBJECT
public: public:
RepairGUI_FreeBoundDlg( GeometryGUI*, QWidget* ); RepairGUI_FreeBoundDlg (GeometryGUI*, QWidget*);
~RepairGUI_FreeBoundDlg(); ~RepairGUI_FreeBoundDlg();
private slots: protected:
void onClose(); // redefined from GEOMBase_Helper
void onHelp(); virtual GEOM::GEOM_IOperations_ptr createOperation();
void onDeactivate(); virtual bool isValid (QString&);
void onActivate(); virtual bool execute (ObjectList&);
void onSelectionDone(); virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
virtual QString getNewObjectName (int CurrObj = -1) const;
private: private:
void Init(); void Init();
void enterEvent( QEvent* ); void enterEvent (QEvent*);
void closeEvent( QCloseEvent* );
void keyPressEvent( QKeyEvent* );
void activateSelection(); void activateSelection();
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool execute( ObjectList& );
virtual bool isValid( QString& );
private: private:
QLineEdit* myEdit; QLineEdit* myEdit;
QLabel* myClosedLbl; QLabel* myClosedLbl;
QLabel* myOpenLbl; QLabel* myOpenLbl;
GEOM::GEOM_Object_var myObj; GEOM::GEOM_Object_var myObj;
GeometryGUI* myGeomGUI;
int myNbClosed; int myNbClosed;
int myNbOpen; int myNbOpen;
QString myHelpFileName; int myCurrObj;
private slots:
void ClickOnOk();
bool ClickOnApply();
void SelectionIntoArgument();
void ActivateThisDialog();
}; };
#endif // REPAIRGUI_FREEBOUNDDLG_H #endif // REPAIRGUI_FREEBOUNDDLG_H