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
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.
<br>Creates corresponding objects and publishes them into the study on
"Apply" or "Apply and Close".
<b>TUI Command:</b> <em>(NoError, ClosedWires, OpenWires) =
geompy.GetFreeBoundary(Shape),</em> where \em Shape is a shape to be
@ -15,4 +17,4 @@ See also a \ref tui_free_boundaries_page "TUI example".
\image html repair9.png
*/
*/

View File

@ -509,7 +509,7 @@ GEOM::GEOM_Object_ptr BlocksGUI_ExplodeDlg::getFather( GEOM::GEOM_Object_ptr )
// Function : getNewObjectName
// 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;
}

View File

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

View File

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

View File

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

View File

@ -18,12 +18,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component
// File : GEOMBase_Helper.cxx
// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
//
#include "GEOMBase_Helper.h"
#include "GEOMBase.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
const int nbObjs = objects.size();
QStringList anEntryList;
int aNumber = 1;
for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
int currObj = 1, aNumber = 1;
for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it, currObj++ ) {
GEOM::GEOM_Object_var obj=*it;
if ( publish ) {
QString aName = getNewObjectName();
QString aName = getNewObjectName(currObj);
if ( nbObjs > 1 ) {
if (aName.isEmpty())
aName = getPrefix(obj);
@ -1006,7 +1005,7 @@ GEOM::GEOM_Object_ptr GEOMBase_Helper::getFather( GEOM::GEOM_Object_ptr theObj )
// Function : getNewObjectName
// 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;
}

View File

@ -18,12 +18,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component
// File : GEOMBase_Helper.h
// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
//
#ifndef GEOMBASE_HELPER_H
#define GEOMBASE_HELPER_H
@ -51,7 +50,7 @@ class TColStd_MapOfInteger;
//================================================================
// Class : GEOMBase_Helper
// Description : Helper class for dialog box development, can be used as
// Description : Helper class for dialog box development, can be used as
// the second base class for dialog boxes. Contains convenient methods
// performing common operations (display/erase, selection activation,
// publication in a study, transaction management)
@ -73,24 +72,24 @@ protected:
void redisplay ( GEOM::GEOM_Object_ptr, const bool = true, const bool = true );
virtual void displayPreview ( const bool display,
const bool activate = false,
const bool activate = false,
const bool update = true,
const bool toRemoveFromEngine = true,
const double lineWidth = -1,
const double lineWidth = -1,
const int displayMode = -1,
const int color = -1 );
// This is the easiest way to show preview. It is based on execute() method.
// It removes temporary GEOM::GEOM_Objects automatically.
virtual void displayPreview ( GEOM::GEOM_Object_ptr obj,
const bool append = false,
const bool activate = false,
virtual void displayPreview ( GEOM::GEOM_Object_ptr obj,
const bool append = false,
const bool activate = false,
const bool update = true,
const double lineWidth = -1,
const double lineWidth = -1,
const int displayMode = -1,
const int color = -1 );
void displayPreview ( const SALOME_Prs* prs,
const bool append = false,
void displayPreview ( const SALOME_Prs* prs,
const bool append = false,
const bool = true );
void erasePreview ( const bool = true );
@ -105,7 +104,7 @@ protected:
void prepareSelection( const ObjectList&, const int );
void prepareSelection( GEOM::GEOM_Object_ptr, const int );
QString addInStudy ( GEOM::GEOM_Object_ptr, const char* theName );
QString addInStudy ( GEOM::GEOM_Object_ptr, const char* theName );
bool openCommand ();
bool abortCommand ();
@ -119,7 +118,7 @@ protected:
bool onAccept( const bool publish = true, const bool useTransaction = true, bool erasePreviewFlag = true);
// This method should be called from "OK" button handler.
// <publish> == true means that objects returned by execute()
// <publish> == true means that objects returned by execute()
// should be published in a study.
void showError();
@ -134,16 +133,16 @@ protected:
inline void setPrefix( const QString& prefix ) { myPrefix = prefix; }
QString getPrefix( GEOM::GEOM_Object_ptr = GEOM::GEOM_Object::_nil() ) const;
bool selectObjects( ObjectList& objects );
// Selects list of objects
// Selects list of objects
////////////////////////////////////////////////////////////////////////////
// Virtual methods, to be redefined in dialog classes
////////////////////////////////////////////////////////////////////////////
virtual GEOM::GEOM_IOperations_ptr createOperation();
// This method should be redefined in dialog boxes so as to return
// This method should be redefined in dialog boxes so as to return
// proper GEOM_IOperation interface.
// Returns nil reference by default
@ -151,9 +150,9 @@ protected:
// Called by onAccept(). Redefine this method to check validity of user input in dialog boxes.
virtual bool execute( ObjectList& objects );
// This method is called by onAccept().
// It should perform the required operation and put all new or modified objects into
// <objects> argument.Should return <false> if some error occurs during its execution.
// This method is called by onAccept().
// It should perform the required operation and put all new or modified objects into
// <objects> argument.Should return <false> if some error occurs during its execution.
virtual void restoreSubShapes( SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr theSObject );
// This method is called by addInStudy().
@ -163,7 +162,7 @@ protected:
// for <theObj> or a nil reference if <theObj> should be published
// as a top-level object.
virtual QString getNewObjectName() const;
virtual QString getNewObjectName (int CurrObj = -1) const;
virtual bool extractPrefix() const;
virtual void addSubshapesToStudy();
@ -187,12 +186,11 @@ protected:
virtual void setIsOptimizedBrowsing( const bool theFlag );
virtual bool isOptimizedBrowsing() const;
virtual void setIsWaitCursorEnabled( const bool theFlag ) {myIsWaitCursorEnabled = theFlag;}
virtual bool isWaitCursorEnabled() const {return myIsWaitCursorEnabled ;}
virtual void setIsDisableBrowsing( const bool theFlag ) { myIsDisableBrowsing = theFlag; }
virtual bool isDisableBrowsing() const { return myIsDisableBrowsing; }
private:
QString getEntry( GEOM::GEOM_Object_ptr ) const;
@ -213,9 +211,8 @@ private:
bool myIsApplyAndClose;
bool myIsOptimizedBrowsing;
bool myIsWaitCursorEnabled;
bool myIsDisableBrowsing; //This flag enable/disable selection
bool myIsDisableBrowsing; //This flag enable/disable selection
//in the Object Browser newly created objects.
};
#endif // GEOMBASE_HELPER_H

View File

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

View File

@ -18,12 +18,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component
// File : GEOMBase_Skeleton.h
// Author : Damine COQUERET, Open CASCADE S.A.S.
//
#ifndef GEOMBASE_SKELETON_H
#define GEOMBASE_SKELETON_H
@ -74,7 +73,7 @@ protected:
/*! 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
*/

View File

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

View File

@ -5414,6 +5414,14 @@ Number of sketch points too small</translation>
<source>NUMBER_OPEN</source>
<translation>Number of open free boundaries: </translation>
</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>
<name>RepairGUI_GlueDlg</name>

View File

@ -18,15 +18,16 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component
// File : RepairGUI_FreeBoundDlg.cxx
// Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com)
//
#include "RepairGUI_FreeBoundDlg.h"
#include <GEOMBase.h>
#include <DlgRef.h>
#include <GeometryGUI.h>
#include <GEOM_Displayer.h>
#include <GEOMImpl_Types.hxx>
@ -51,7 +52,7 @@
#include <QKeyEvent>
#define SPACING 6
#define MARGIN 9
#define MARGIN 0
/*!
Class : RepairGUI_FreeBoundDlg
@ -62,59 +63,55 @@
// function : RepairGUI_FreeBoundDlg
// purpose : Constructor
//=================================================================================
RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg( GeometryGUI* theGUI, QWidget* theParent )
: QDialog( theParent, 0 ),
GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( theParent ) ),
myGeomGUI( theGUI )
RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg (GeometryGUI* theGUI, QWidget* theParent)
: GEOMBase_Skeleton(theGUI, theParent)
{
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 );
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 );
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 );
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();
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 );
aBtnLay->setMargin( MARGIN ); aBtnLay->setSpacing( SPACING );
aBtnLay->addWidget( aCloseBtn );
aBtnLay->addSpacing( SPACING ); aBtnLay->addStretch();
aBtnLay->addWidget( aHelpBtn );
mainFrame()->GroupBoxName->hide();
QVBoxLayout* aLay = new QVBoxLayout( this );
aLay->setSpacing( SPACING );
aLay->setMargin( MARGIN );
aLay->addWidget( aMainGrp );
aLay->addWidget( aFrame );
QGroupBox* aMainGrp = new QGroupBox (tr("FREE_BOUND"), this);
myHelpFileName = "using_measurement_tools_page.html#boundaries_anchor";
QLabel* lab = new QLabel (tr("GEOM_OBJECT"), aMainGrp);
QPushButton* btn = new QPushButton (aMainGrp);
btn->setIcon(image1);
myEdit = new QLineEdit (aMainGrp);
myEdit->setReadOnly(true);
myEdit->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
connect( aCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) );
connect( aHelpBtn, SIGNAL( clicked() ), SLOT( onHelp() ) );
myClosedLbl = new QLabel (tr("NUMBER_CLOSED"), aMainGrp);
myOpenLbl = new QLabel (tr("NUMBER_OPEN"), aMainGrp);
myClosedLbl->setMinimumWidth(150);
myOpenLbl->setMinimumWidth(150);
QGridLayout* aMainGrpLayout = new QGridLayout (aMainGrp);
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);
QVBoxLayout* aLay = new QVBoxLayout (centralWidget());
aLay->setSpacing(SPACING);
aLay->setMargin(MARGIN);
aLay->addWidget(aMainGrp);
resize(minimumSizeHint());
/***************************************************************/
myHelpFileName = "boundaries_page.html";
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
// purpose : Initialize dialog fields
@ -224,30 +133,91 @@ void RepairGUI_FreeBoundDlg::Init()
myNbClosed = myNbOpen = 0;
myObj = GEOM::GEOM_Object::_nil();
connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT ( onDeactivate() ) );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
myEditCurrentArgument = myEdit;
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
activateSelection();
onSelectionDone();
SelectionIntoArgument();
}
//=================================================================================
// function : enterEvent
// purpose : Activate dialog
// function : ClickOnOk()
// purpose :
//=================================================================================
void RepairGUI_FreeBoundDlg::enterEvent( QEvent* )
void RepairGUI_FreeBoundDlg::ClickOnOk()
{
onActivate();
if (ClickOnApply())
ClickOnCancel();
}
//=================================================================================
// function : closeEvent
// purpose : Close dialog
// function : ClickOnApply()
// 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()
{
TColStd_MapOfInteger aMap;
aMap.Add( GEOM_FACE );
aMap.Add( GEOM_SHELL );
aMap.Add( GEOM_SOLID );
aMap.Add( GEOM_COMPOUND );
globalSelection( aMap );
aMap.Add(GEOM_FACE);
aMap.Add(GEOM_SHELL);
aMap.Add(GEOM_SOLID);
aMap.Add(GEOM_COMPOUND);
globalSelection(aMap);
}
//=================================================================================
@ -270,14 +240,14 @@ void RepairGUI_FreeBoundDlg::activateSelection()
//=================================================================================
GEOM::GEOM_IOperations_ptr RepairGUI_FreeBoundDlg::createOperation()
{
return getGeomEngine()->GetIHealingOperations( getStudyId() );
return getGeomEngine()->GetIHealingOperations(getStudyId());
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
bool RepairGUI_FreeBoundDlg::isValid( QString& )
bool RepairGUI_FreeBoundDlg::isValid (QString&)
{
return !myObj->_is_nil();
}
@ -286,52 +256,50 @@ bool RepairGUI_FreeBoundDlg::isValid( QString& )
// function : execute
// 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::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() );
bool result = anOper->GetFreeBoundary( myObj, aClosed, anOpen );
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation());
bool result = anOper->GetFreeBoundary(myObj, aClosed, anOpen);
if ( result ) {
if (result) {
myNbClosed = aClosed->length();
myNbOpen = anOpen->length();
int i;
for ( i = 0; i < myNbClosed; i++ )
objects.push_back( aClosed[i]._retn() );
for ( i = 0; i < myNbOpen; i++ )
objects.push_back( anOpen[i]._retn() );
for (i = 0; i < myNbClosed; i++)
objects.push_back(aClosed[i]._retn());
for (i = 0; i < myNbOpen; i++)
objects.push_back(anOpen[i]._retn());
myEdit->setText( GEOMBase::GetName( myObj ) );
QString aLabelText = tr( "NUMBER_CLOSED" ) + QString( "%1" ).arg( myNbClosed );
myClosedLbl->setText( aLabelText );
aLabelText = tr( "NUMBER_OPEN" ) + QString( "%1" ).arg( myNbOpen );
myOpenLbl->setText( aLabelText );
}
else {
myEdit->setText( GEOMBase::GetName( myObj ) );
myClosedLbl->setText( tr( "NUMBER_CLOSED" ) );
myOpenLbl->setText( tr( "NUMBER_OPEN" ) );
QString aLabelText = tr("NUMBER_CLOSED") + QString("%1").arg(myNbClosed);
myClosedLbl->setText(aLabelText);
aLabelText = tr("NUMBER_OPEN") + QString("%1").arg(myNbOpen);
myOpenLbl->setText(aLabelText);
}
myCurrObj = 1;
return result;
}
//=================================================================================
// function : keyPressEvent()
// purpose :
//=================================================================================
void RepairGUI_FreeBoundDlg::keyPressEvent( QKeyEvent* e )
//================================================================
// Function : getNewObjectName
// Purpose : Redefine this method to return proper name for a new object
//================================================================
QString RepairGUI_FreeBoundDlg::getNewObjectName (int currObj) const
{
QDialog::keyPressEvent( e );
if ( e->isAccepted() )
return;
if ( e->key() == Qt::Key_F1 ) {
e->accept();
onHelp();
}
QString aName = tr("NAME_CLOSED").arg(currObj);
if (currObj > myNbClosed)
aName = tr("NAME_OPEN").arg(currObj);
return aName;
}
//================================================================
// 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
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component
// File : RepairGUI_FreeBoundDlg.h
// Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com)
//
#ifndef REPAIRGUI_FREEBOUNDDLG_H
#define REPAIRGUI_FREEBOUNDDLG_H
#include <QDialog>
#include <GEOMBase_Helper.h>
#include <GEOMBase_Skeleton.h>
class QLineEdit;
class QLabel;
@ -38,42 +37,42 @@ class GeometryGUI;
// class : RepairGUI_FreeBoundDlg
// purpose : Dialog for displaying free boundaries of selected face, shell or solid
//=================================================================================
class RepairGUI_FreeBoundDlg : public QDialog,
public GEOMBase_Helper
class RepairGUI_FreeBoundDlg : public GEOMBase_Skeleton
{
Q_OBJECT
public:
RepairGUI_FreeBoundDlg( GeometryGUI*, QWidget* );
RepairGUI_FreeBoundDlg (GeometryGUI*, QWidget*);
~RepairGUI_FreeBoundDlg();
private slots:
void onClose();
void onHelp();
void onDeactivate();
void onActivate();
void onSelectionDone();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
virtual QString getNewObjectName (int CurrObj = -1) const;
private:
void Init();
void enterEvent( QEvent* );
void closeEvent( QCloseEvent* );
void keyPressEvent( QKeyEvent* );
void enterEvent (QEvent*);
void activateSelection();
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool execute( ObjectList& );
virtual bool isValid( QString& );
private:
QLineEdit* myEdit;
QLabel* myClosedLbl;
QLabel* myOpenLbl;
GEOM::GEOM_Object_var myObj;
GeometryGUI* myGeomGUI;
int myNbClosed;
int myNbOpen;
QString myHelpFileName;
int myCurrObj;
private slots:
void ClickOnOk();
bool ClickOnApply();
void SelectionIntoArgument();
void ActivateThisDialog();
};
#endif // REPAIRGUI_FREEBOUNDDLG_H