First compilable version

This commit is contained in:
ouv 2009-12-09 10:02:02 +00:00
parent 6d66c9caa8
commit 44a2277a1a
39 changed files with 320 additions and 240 deletions

View File

@ -41,6 +41,7 @@ salomeinclude_HEADERS = \
SMESHGUI_PatternUtils.h \
SMESHGUI_GroupUtils.h \
SMESHGUI_PatternWidget.h \
SMESHGUI_Helper.h \
SMESHGUI_CreatePatternDlg.h \
SMESHGUI_MeshPatternDlg.h \
SMESHGUI_NodesDlg.h \
@ -99,6 +100,7 @@ lib_LTLIBRARIES = libSMESH.la
dist_libSMESH_la_SOURCES = \
SMESHGUI.cxx \
SMESHGUI_PatternWidget.cxx \
SMESHGUI_Helper.cxx \
SMESHGUI_CreatePatternDlg.cxx \
SMESHGUI_MeshPatternDlg.cxx \
SMESHGUI_SpinBox.cxx \

View File

@ -72,6 +72,7 @@
//=================================================================================
SMESHGUI_BuildCompoundDlg::SMESHGUI_BuildCompoundDlg( SMESHGUI* theModule )
: QDialog(SMESH::GetDesktop(theModule)),
SMESHGUI_Helper(theModule),
mySMESHGUI(theModule),
mySelectionMgr(SMESH::GetSelectionMgr(theModule))
{
@ -513,17 +514,7 @@ void SMESHGUI_BuildCompoundDlg::onSelectMerge(bool toMerge)
//=================================================================================
bool SMESHGUI_BuildCompoundDlg::isValid()
{
QString msg;
bool ok=true;
if(CheckBoxMerge->isChecked())
ok = SpinBoxTol->isValid( msg, true );
if( !ok ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
return false;
}
if( CheckBoxMerge->isChecked() )
return checkParameters( true, 1, SpinBoxTol );
return true;
}

View File

@ -28,6 +28,7 @@
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
@ -53,7 +54,7 @@ class SUIT_SelectionFilter;
// class : SMESHGUI_BuildCompoundDlg
// purpose :
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI_BuildCompoundDlg : public QDialog
class SMESHGUI_EXPORT SMESHGUI_BuildCompoundDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT;

View File

@ -109,6 +109,7 @@ private:
//=================================================================================
SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
SMESHGUI_Helper( theModule ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myFilterDlg( 0 )
@ -1132,14 +1133,9 @@ int SMESHGUI_ExtrusionAlongPathDlg::GetConstructorId()
//=======================================================================
void SMESHGUI_ExtrusionAlongPathDlg::OnAngleAdded()
{
QString msg;
if( !AngleSpin->isValid( msg, true ) ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
if( !checkParameters( true, 1, AngleSpin ) )
return;
}
AnglesList->addItem(AngleSpin->text());
myAnglesList.append(AngleSpin->GetValue());
@ -1242,20 +1238,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::setFilters()
//=================================================================================
bool SMESHGUI_ExtrusionAlongPathDlg::isValid()
{
QString msg;
bool ok = true;
ok = XSpin->isValid( msg, true ) && ok;
ok = YSpin->isValid( msg, true ) && ok;
ok = ZSpin->isValid( msg, true ) && ok;
if( !ok ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
return false;
}
return true;
return checkParameters( true, 3, XSpin, YSpin, ZSpin );
}
//=================================================================================

View File

@ -28,6 +28,7 @@
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
@ -59,7 +60,7 @@ class SUIT_SelectionFilter;
// class : SMESHGUI_ExtrusionAlongPathDlg
// purpose :
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI_ExtrusionAlongPathDlg : public QDialog
class SMESHGUI_EXPORT SMESHGUI_ExtrusionAlongPathDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT

View File

@ -88,6 +88,7 @@
//=================================================================================
SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
: QDialog( SMESH::GetDesktop( theModule ) ),
SMESHGUI_Helper( theModule ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myFilterDlg( 0 ),
@ -1009,26 +1010,11 @@ void SMESHGUI_ExtrusionDlg::setFilters()
//=================================================================================
bool SMESHGUI_ExtrusionDlg::isValid()
{
QString msg;
bool ok = true;
if ( RadioButton3->isChecked() ) {
ok = SpinBox_Dx->isValid( msg, true ) && ok;
ok = SpinBox_Dy->isValid( msg, true ) && ok;
ok = SpinBox_Dz->isValid( msg, true ) && ok;
} else if ( RadioButton4->isChecked() ) {
ok = SpinBox_Vx->isValid( msg, true ) && ok;
ok = SpinBox_Vy->isValid( msg, true ) && ok;
ok = SpinBox_Vz->isValid( msg, true ) && ok;
ok = SpinBox_VDist->isValid( msg, true ) && ok;
}
ok = SpinBox_NbSteps->isValid( msg, true ) && ok;
if( !ok ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
return false;
}
return true;
QList<QAbstractSpinBox*> aSpinBoxList;
if ( RadioButton3->isChecked() )
aSpinBoxList << SpinBox_Dx << SpinBox_Dy << SpinBox_Dz;
else if ( RadioButton4->isChecked() )
aSpinBoxList << SpinBox_Vx << SpinBox_Vy << SpinBox_Vz;
aSpinBoxList << SpinBox_NbSteps;
return checkParameters( true, aSpinBoxList );
}

View File

@ -28,6 +28,7 @@
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_Helper.h"
// SALOME GUI includes
#include <SALOME_InteractiveObject.hxx>
@ -61,7 +62,7 @@ class SalomeApp_IntSpinBox;
// class : SMESHGUI_ExtrusionDlg
// purpose :
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public QDialog
class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT

View File

@ -0,0 +1,137 @@
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 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 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
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_Helper.cxx
// Author : Oleg UVAROV
// SMESH includes
//
#include "SMESHGUI_Helper.h"
#include "SMESHGUI.h"
// SALOME GUI includes
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
#include <SUIT_Session.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_DoubleSpinBox.h>
#include <SalomeApp_IntSpinBox.h>
#include <SalomeApp_Notebook.h>
// IDL includes
//#include <SALOMEconfig.h>
//#include CORBA_SERVER_HEADER(SMESH_Mesh)
//#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
//=================================================================================
// name : SMESHGUI_Helper::SMESHGUI_Helper
// Purpose :
//=================================================================================
SMESHGUI_Helper::SMESHGUI_Helper( SMESHGUI* theModule ) :
mySMESHGUI( theModule ),
myNotebook( 0 )
{
}
//=======================================================================
// name : SMESHGUI_Helper::~SMESHGUI_Helper
// Purpose :
//=======================================================================
SMESHGUI_Helper::~SMESHGUI_Helper()
{
if( myNotebook )
{
delete myNotebook;
myNotebook = 0;
}
}
//================================================================
// Function : checkParameters
// Purpose :
//================================================================
bool SMESHGUI_Helper::checkParameters( bool theMess, int theCount, QAbstractSpinBox* theFirstSpinBox, ... )
{
va_list aSpins;
va_start( aSpins, theFirstSpinBox );
int aCounter = 0;
QList<QAbstractSpinBox*> aSpinBoxList;
QAbstractSpinBox* aSpinBox = theFirstSpinBox;
while( aSpinBox && aCounter < theCount )
{
aSpinBoxList.append( aSpinBox );
aSpinBox = va_arg( aSpins, QAbstractSpinBox* );
aCounter++;
}
return checkParameters( theMess, aSpinBoxList );
}
//================================================================
// Function : checkParameters
// Purpose :
//================================================================
bool SMESHGUI_Helper::checkParameters( bool theMess, const QList<QAbstractSpinBox*>& theSpinBoxList )
{
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
if ( !app )
return false;
QString msg;
QStringList absentParams;
bool ok = true;
QListIterator<QAbstractSpinBox*> anIter( theSpinBoxList );
while( anIter.hasNext() )
{
QAbstractSpinBox* aSpinBox = anIter.next();
if( SalomeApp_DoubleSpinBox* aDoubleSpinBox = dynamic_cast<SalomeApp_DoubleSpinBox*>( aSpinBox ) )
ok = aDoubleSpinBox->isValid( msg, absentParams, theMess ) && ok;
else if( SalomeApp_IntSpinBox* anIntSpinBox = dynamic_cast<SalomeApp_IntSpinBox*>( aSpinBox ) )
ok = anIntSpinBox->isValid( msg, absentParams, theMess ) && ok;
}
if( !ok && theMess )
{
if( !absentParams.isEmpty() )
app->defineAbsentParameters( absentParams );
else
{
QString str( QObject::tr( "SMESH_INCORRECT_INPUT" ) );
if( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( mySMESHGUI->desktop(), QObject::tr( "SMESH_ERROR" ), str );
}
}
return ok;
}
//================================================================
// Function : getNotebook
// Purpose :
//================================================================
SalomeApp_Notebook* SMESHGUI_Helper::getNotebook()
{
if ( !myNotebook )
myNotebook = new SalomeApp_Notebook( mySMESHGUI->activeStudy() );
return myNotebook;
}

View File

@ -0,0 +1,62 @@
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 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 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
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_Helper.h
// Author : Oleg UVAROV
//
#ifndef SMESHGUI_HELPER_H
#define SMESHGUI_HELPER_H
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
// Qt includes
#include <QList>
class SMESHGUI;
class SalomeApp_Notebook;
class QAbstractSpinBox;
//=================================================================================
// class : SMESHGUI_Helper
// purpose : Helper class for dialog box development, can be used as the second
// base class for dialog box (or for corresponding operation, if exists).
// Contains methods performing operations with SALOME Notebook parameters.
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI_Helper
{
public:
SMESHGUI_Helper( SMESHGUI* );
virtual ~SMESHGUI_Helper();
protected:
bool checkParameters( bool, int, QAbstractSpinBox*, ... );
bool checkParameters( bool, const QList<QAbstractSpinBox*>& );
SalomeApp_Notebook* getNotebook();
private:
SMESHGUI* mySMESHGUI;
SalomeApp_Notebook* myNotebook;
};
#endif // SMESHGUI_HELPER_H

View File

@ -40,6 +40,7 @@
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <LightApp_Application.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_IntSpinBox.h>
// Qt includes
@ -192,6 +193,7 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
break;
case QVariant::String:
{
/* ouv: temporarily disabled
if((*anIt).isVariable) {
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
QString aVar = (*anIt).myValue.toString();
@ -213,13 +215,14 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
}
}
else {
*/
QLineEdit* le = new QLineEdit( GroupC1 );
le->setObjectName( (*anIt).myName );
attuneStdWidget( le, i );
le->setText( (*anIt).myValue.toString() );
connect( le, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
w = le;
}
//}
}
break;
}
@ -476,7 +479,7 @@ bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam&, QWi
return false;
}
bool SMESHGUI_GenericHypothesisCreator::checkParams( QString& msg ) const
bool SMESHGUI_GenericHypothesisCreator::checkParams( QString& msg, QStringList& absentParams ) const
{
bool ok = true;
ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
@ -485,12 +488,12 @@ bool SMESHGUI_GenericHypothesisCreator::checkParams( QString& msg ) const
if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
{
SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
ok = sb->isValid( msg, true ) && ok;
ok = sb->isValid( msg, absentParams, true ) && ok;
}
else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
{
SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
ok = sb->isValid( msg, true ) && ok;
ok = sb->isValid( msg, absentParams, true ) && ok;
}
}
return ok;
@ -599,8 +602,17 @@ void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
void SMESHGUI_HypothesisDlg::accept()
{
QString msg;
if ( myCreator && !myCreator->checkParams( msg ) )
QStringList absentParams;
if ( myCreator && !myCreator->checkParams( msg, absentParams ) )
{
if( !absentParams.isEmpty() )
{
SalomeApp_Application* app =
dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
if( app )
app->defineAbsentParameters( absentParams );
return;
}
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;

View File

@ -57,7 +57,7 @@ public:
void edit( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*, QObject*, const QString& );
void setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr);
virtual bool checkParams( QString& ) const;
virtual bool checkParams( QString&, QStringList& ) const;
virtual void onReject();
virtual QString helpPage() const;

View File

@ -267,6 +267,7 @@ void SMESHGUI_MakeNodeAtPointDlg::ButtonToggled (bool on)
//================================================================================
SMESHGUI_MakeNodeAtPointOp::SMESHGUI_MakeNodeAtPointOp()
: SMESHGUI_Helper( getSMESHGUI() )
{
mySimulation = 0;
myDlg = new SMESHGUI_MakeNodeAtPointDlg;
@ -375,8 +376,7 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
QString msg;
if ( !isValid( msg ) ) { // node id is invalid
if( !msg.isEmpty() )
SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ),
tr("INVALID_ID") );
SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ), msg );
dlg()->show();
return false;
}
@ -442,6 +442,9 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
bool SMESHGUI_MakeNodeAtPointOp::isValid( QString& msg )
{
if( !checkParameters( !myNoPreview, 3, myDlg->myX, myDlg->myY, myDlg->myZ ) )
return false;
bool ok = true;
if ( myMeshActor &&
myDlg->myMoveRBtn->isChecked() &&
@ -455,11 +458,6 @@ bool SMESHGUI_MakeNodeAtPointOp::isValid( QString& msg )
if( !ok )
msg += tr("INVALID_ID") + "\n";
}
ok = myDlg->myX->isValid( msg, !myNoPreview ) && ok;
ok = myDlg->myY->isValid( msg, !myNoPreview ) && ok;
ok = myDlg->myZ->isValid( msg, !myNoPreview ) && ok;
return ok;
}

View File

@ -27,6 +27,7 @@
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_Helper.h"
#include "SMESHGUI_Dialog.h"
#include "SMESHGUI_SelectionOp.h"
@ -43,7 +44,7 @@ class SMESHGUI_MakeNodeAtPointDlg;
/*!
* \brief Operation to make a mesh pass through a point
*/
class SMESHGUI_EXPORT SMESHGUI_MakeNodeAtPointOp: public SMESHGUI_SelectionOp
class SMESHGUI_EXPORT SMESHGUI_MakeNodeAtPointOp: public SMESHGUI_SelectionOp, public SMESHGUI_Helper
{
Q_OBJECT

View File

@ -106,6 +106,7 @@
//=======================================================================
SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
SMESHGUI_Helper( theModule ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myBusy( false ),
@ -413,21 +414,13 @@ bool SMESHGUI_MeshPatternDlg::isValid (const bool theMess)
{
if (isRefine())
{
QString msg;
bool ok = true;
ok = myNode1->isValid( msg, theMess ) && ok;
if (myType == Type_3d)
ok = myNode2->isValid( msg, theMess ) && ok;
if( !ok ) {
if( theMess ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
}
QList<QAbstractSpinBox*> aSpinBoxList;
aSpinBoxList << myNode1;
if( myType == Type_3d )
aSpinBoxList << myNode2;
if( !checkParameters( theMess, aSpinBoxList ) )
return false;
}
}
QList<int> ids;
if ((isRefine() &&

View File

@ -27,6 +27,7 @@
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
@ -58,7 +59,7 @@ class SMESHGUI_PatternWidget;
Description : Dialog to specify filters for VTK viewer
*/
class SMESHGUI_EXPORT SMESHGUI_MeshPatternDlg : public QDialog
class SMESHGUI_EXPORT SMESHGUI_MeshPatternDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT

View File

@ -86,6 +86,7 @@
//=================================================================================
SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg(SMESHGUI* theModule):
QDialog(SMESH::GetDesktop(theModule)),
SMESHGUI_Helper(theModule),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
mySMESHGUI(theModule)
{
@ -281,23 +282,7 @@ bool SMESHGUI_MoveNodesDlg::isValid (const bool theMess)
tr("NODE_ID_IS_NOT_DEFINED"));
return false;
}
QString msg;
bool ok = true;
ok = myX->isValid( msg, theMess ) && ok;
ok = myY->isValid( msg, theMess ) && ok;
ok = myZ->isValid( msg, theMess ) && ok;
if( !ok ) {
if( theMess ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
}
return false;
}
return true;
return checkParameters( theMess, 3, myX, myY, myZ );
}
//=======================================================================

View File

@ -28,6 +28,7 @@
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
@ -46,7 +47,7 @@ class LightApp_SelectionMgr;
// class : SMESHGUI_MoveNodesDlg
// purpose :
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI_MoveNodesDlg : public QDialog
class SMESHGUI_EXPORT SMESHGUI_MoveNodesDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT

View File

@ -103,6 +103,7 @@ SMESHGUI_MultiEditDlg
const int theMode,
const bool the3d2d):
QDialog(SMESH::GetDesktop(theModule)),
SMESHGUI_Helper(theModule),
mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
mySMESHGUI(theModule)
@ -1173,20 +1174,7 @@ bool SMESHGUI_UnionOfTrianglesDlg::isValid (const bool theMess)
bool ok = SMESHGUI_MultiEditDlg::isValid( theMess );
if( !ok )
return false;
QString msg;
ok = myMaxAngleSpin->isValid( msg, theMess );
if( !ok ) {
if( theMess ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
}
return false;
}
return ok;
return checkParameters( theMess, 1, myMaxAngleSpin );
}
bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,

View File

@ -27,6 +27,7 @@
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
@ -63,7 +64,7 @@ class QButtonGroup;
* union of two neighboring triangles
*/
class SMESHGUI_EXPORT SMESHGUI_MultiEditDlg : public QDialog
class SMESHGUI_EXPORT SMESHGUI_MultiEditDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT

View File

@ -223,6 +223,7 @@ namespace SMESH
//=================================================================================
SMESHGUI_NodesDlg::SMESHGUI_NodesDlg( SMESHGUI* theModule ):
QDialog( SMESH::GetDesktop( theModule ) ),
SMESHGUI_Helper( theModule ),
mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
mySMESHGUI( theModule )
@ -610,18 +611,5 @@ void SMESHGUI_NodesDlg::keyPressEvent( QKeyEvent* e )
//=================================================================================
bool SMESHGUI_NodesDlg::isValid()
{
QString msg;
bool ok = true;
ok = SpinBox_X->isValid( msg, true ) && ok;
ok = SpinBox_Y->isValid( msg, true ) && ok;
ok = SpinBox_Z->isValid( msg, true ) && ok;
if( !ok ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
return false;
}
return true;
return checkParameters( true, 3, SpinBox_X, SpinBox_Y, SpinBox_Z );
}

View File

@ -28,6 +28,7 @@
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
@ -55,7 +56,7 @@ namespace SMESH
// class : SMESHGUI_NodesDlg
// purpose :
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI_NodesDlg : public QDialog
class SMESHGUI_EXPORT SMESHGUI_NodesDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT

View File

@ -89,6 +89,7 @@
//=================================================================================
SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
SMESHGUI_Helper( theModule ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myVectorDefinition(NONE_SELECT),
@ -1181,24 +1182,8 @@ void SMESHGUI_RevolutionDlg::setFilters()
//=================================================================================
bool SMESHGUI_RevolutionDlg::isValid()
{
QString msg;
bool ok = true;
ok = SpinBox_X->isValid( msg, true ) && ok;
ok = SpinBox_Y->isValid( msg, true ) && ok;
ok = SpinBox_Z->isValid( msg, true ) && ok;
ok = SpinBox_DX->isValid( msg, true ) && ok;
ok = SpinBox_DY->isValid( msg, true ) && ok;
ok = SpinBox_DZ->isValid( msg, true ) && ok;
ok = SpinBox_Angle->isValid( msg, true ) && ok;
ok = SpinBox_NbSteps->isValid( msg, true ) && ok;
ok = SpinBox_Tolerance->isValid( msg, true ) && ok;
if( !ok ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
return false;
}
return true;
return checkParameters( true, 9,
SpinBox_X, SpinBox_Y, SpinBox_Z,
SpinBox_DX, SpinBox_DY, SpinBox_DZ,
SpinBox_Angle, SpinBox_NbSteps, SpinBox_Tolerance );
}

View File

@ -28,6 +28,7 @@
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_Helper.h"
// SALOME GUI includes
#include <SALOME_InteractiveObject.hxx>
@ -65,7 +66,7 @@ class QAction;
// class : SMESHGUI_RevolutionDlg
// purpose :
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI_RevolutionDlg : public QDialog
class SMESHGUI_EXPORT SMESHGUI_RevolutionDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT

View File

@ -89,6 +89,7 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action
//=================================================================================
SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
SMESHGUI_Helper( theModule ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myFilterDlg(0),
@ -997,23 +998,8 @@ void SMESHGUI_RotationDlg::setFilters()
//=================================================================================
bool SMESHGUI_RotationDlg::isValid()
{
bool ok = true;
QString msg;
ok = SpinBox_X->isValid( msg, true ) && ok;
ok = SpinBox_Y->isValid( msg, true ) && ok;
ok = SpinBox_Z->isValid( msg, true ) && ok;
ok = SpinBox_DX->isValid( msg, true ) && ok;
ok = SpinBox_DY->isValid( msg, true ) && ok;
ok = SpinBox_DZ->isValid( msg, true ) && ok;
ok = SpinBox_Angle->isValid( msg, true ) && ok;
if( !ok ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
return false;
}
return true;
return checkParameters( true, 7,
SpinBox_X, SpinBox_Y, SpinBox_Z,
SpinBox_DX, SpinBox_DY, SpinBox_DZ,
SpinBox_Angle );
}

View File

@ -28,6 +28,7 @@
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
@ -56,7 +57,7 @@ class SMESH_LogicalFilter;
// class : SMESHGUI_RotationDlg
// purpose :
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI_RotationDlg : public QDialog
class SMESHGUI_EXPORT SMESHGUI_RotationDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT

View File

@ -90,6 +90,7 @@
//=================================================================================
SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
SMESHGUI_Helper( theModule ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myFilterDlg(0),
@ -826,17 +827,5 @@ void SMESHGUI_SmoothingDlg::setNodeFilters()
//=================================================================================
bool SMESHGUI_SmoothingDlg::isValid()
{
QString msg;
bool ok = true;
ok = SpinBox_IterationLimit->isValid( msg, true ) && ok;
ok = SpinBox_AspectRatio->isValid( msg, true ) && ok;
if( !ok ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
return false;
}
return true;
return checkParameters( true, 2, SpinBox_IterationLimit, SpinBox_AspectRatio );
}

View File

@ -28,6 +28,7 @@
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
@ -57,7 +58,7 @@ class SMESH_LogicalFilter;
// class : SMESHGUI_SmoothingDlg
// purpose :
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI_SmoothingDlg : public QDialog
class SMESHGUI_EXPORT SMESHGUI_SmoothingDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT

View File

@ -90,6 +90,7 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action
SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
SMESHGUI_Helper( theModule ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myFilterDlg(0),
@ -1096,24 +1097,9 @@ void SMESHGUI_SymmetryDlg::setFilters()
//=================================================================================
bool SMESHGUI_SymmetryDlg::isValid()
{
bool ok = true;
QString msg;
ok = SpinBox_X->isValid( msg, true ) && ok;
ok = SpinBox_Y->isValid( msg, true ) && ok;
ok = SpinBox_Z->isValid( msg, true ) && ok;
if (GetConstructorId() != 0) {
ok = SpinBox_DX->isValid( msg, true ) && ok;
ok = SpinBox_DY->isValid( msg, true ) && ok;
ok = SpinBox_DZ->isValid( msg, true ) && ok;
}
if( !ok ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
return false;
}
return true;
QList<QAbstractSpinBox*> aSpinBoxList;
aSpinBoxList << SpinBox_X << SpinBox_Y << SpinBox_Z;
if( GetConstructorId() != 0 )
aSpinBoxList << SpinBox_DX << SpinBox_DY << SpinBox_DZ;
return checkParameters( true, aSpinBoxList );
}

View File

@ -28,6 +28,7 @@
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
@ -56,7 +57,7 @@ class SMESH_LogicalFilter;
// class : SMESHGUI_SymmetryDlg
// purpose :
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI_SymmetryDlg : public QDialog
class SMESHGUI_EXPORT SMESHGUI_SymmetryDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT

View File

@ -107,6 +107,7 @@ private:
//=================================================================================
SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
SMESHGUI_Helper( theModule ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myFilterDlg(0),
@ -1044,24 +1045,9 @@ void SMESHGUI_TranslationDlg::setFilters()
//=================================================================================
bool SMESHGUI_TranslationDlg::isValid()
{
bool ok = true;
QString msg;
ok = SpinBox1_1->isValid( msg, true ) && ok;
ok = SpinBox1_2->isValid( msg, true ) && ok;
ok = SpinBox1_3->isValid( msg, true ) && ok;
if (GetConstructorId() == 0) {
ok = SpinBox2_1->isValid( msg, true ) && ok;
ok = SpinBox2_2->isValid( msg, true ) && ok;
ok = SpinBox2_3->isValid( msg, true ) && ok;
}
if( !ok ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
return false;
}
return true;
QList<QAbstractSpinBox*> aSpinBoxList;
aSpinBoxList << SpinBox1_1 << SpinBox1_2 << SpinBox1_3;
if( GetConstructorId() == 0 )
aSpinBoxList << SpinBox2_1 << SpinBox2_2 << SpinBox2_3;
return checkParameters( true, aSpinBoxList );
}

View File

@ -28,6 +28,7 @@
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
@ -56,7 +57,7 @@ class SMESH_LogicalFilter;
// class : SMESHGUI_TranslationDlg
// purpose :
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI_TranslationDlg : public QDialog
class SMESHGUI_EXPORT SMESHGUI_TranslationDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT

View File

@ -940,6 +940,7 @@ void SMESH_Gen_i::UpdateParameters(CORBA::Object_ptr theObject, const char* theP
//=======================================================================
char* SMESH_Gen_i::ParseParameters(const char* theParameters)
{
/* ouv: temporarily disabled
//const char* aParameters = theParameters;
// const char* aParameters = CORBA::string_dup(theParameters);
TCollection_AsciiString anInputParams;
@ -982,6 +983,8 @@ char* SMESH_Gen_i::ParseParameters(const char* theParameters)
}
}
return CORBA::string_dup(anInputParams.ToCString());
*/
return NULL;
}
//=======================================================================

View File

@ -188,6 +188,7 @@ char* SMESH_Hypothesis_i::GetParameters()
SMESH::ListOfParameters* SMESH_Hypothesis_i::GetLastParameters()
{
SMESH::ListOfParameters_var aResult = new SMESH::ListOfParameters();
/* ouv: temporarily disabled
SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
if(gen) {
char *aParameters;
@ -207,6 +208,7 @@ SMESH::ListOfParameters* SMESH_Hypothesis_i::GetLastParameters()
}
}
}
*/
return aResult._retn();
}

View File

@ -3408,6 +3408,7 @@ char* SMESH_Mesh_i::GetParameters()
SMESH::string_array* SMESH_Mesh_i::GetLastParameters()
{
SMESH::string_array_var aResult = new SMESH::string_array();
/* ouv: temporarily disabled
SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
if(gen) {
char *aParameters = GetParameters();
@ -3422,6 +3423,7 @@ SMESH::string_array* SMESH_Mesh_i::GetLastParameters()
}
}
}
*/
return aResult._retn();
}

View File

@ -639,6 +639,7 @@ void SMESH_NoteBook::ReplaceVariables()
//================================================================================
void SMESH_NoteBook::InitObjectMap()
{
/* ouv: temporarily disabled
SMESH_Gen_i *aGen = SMESH_Gen_i::GetSMESHGen();
if(!aGen)
return;
@ -700,6 +701,7 @@ void SMESH_NoteBook::InitObjectMap()
_objectMap.insert(pair<TCollection_AsciiString,ObjectStates*>(TCollection_AsciiString(aSObject->GetID()),aState));
}
}
*/
}
//================================================================================
@ -825,6 +827,7 @@ bool SMESH_NoteBook::GetReal(const TCollection_AsciiString& theVarName, double&
{
bool ok = false;
/* ouv: temporarily disabled
SMESH_Gen_i *aGen = SMESH_Gen_i::GetSMESHGen();
if(!aGen)
return ok;
@ -844,7 +847,7 @@ bool SMESH_NoteBook::GetReal(const TCollection_AsciiString& theVarName, double&
theValue = aStudy->GetReal(aVarName.ToCString());
ok = true;
}
*/
return ok;
}

View File

@ -80,17 +80,17 @@ StdMeshersGUI_NbSegmentsCreator::~StdMeshersGUI_NbSegmentsCreator()
{
}
bool StdMeshersGUI_NbSegmentsCreator::checkParams( QString& msg ) const
bool StdMeshersGUI_NbSegmentsCreator::checkParams( QString& msg, QStringList& absentParams ) const
{
if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg ) )
if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg, absentParams ) )
return false;
NbSegmentsHypothesisData data_old, data_new;
readParamsFromHypo( data_old );
readParamsFromWidgets( data_new );
bool res = storeParamsToHypo( data_new );
storeParamsToHypo( data_old );
res = myNbSeg->isValid( msg, true ) && res;
res = myScale->isValid( msg, true ) && res;
res = myNbSeg->isValid( msg, absentParams, true ) && res;
res = myScale->isValid( msg, absentParams, true ) && res;
return res;
}

View File

@ -64,7 +64,7 @@ public:
StdMeshersGUI_NbSegmentsCreator();
virtual ~StdMeshersGUI_NbSegmentsCreator();
virtual bool checkParams( QString& ) const;
virtual bool checkParams( QString&, QStringList& ) const;
protected:
virtual QFrame* buildFrame();

View File

@ -343,9 +343,9 @@ namespace {
*/
//================================================================================
bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const
bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg, QStringList& absentParams ) const
{
if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg ) )
if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg, absentParams ) )
return false;
// check if object reference parameter is set, as it has no default value

View File

@ -41,7 +41,7 @@ public:
StdMeshersGUI_StdHypothesisCreator( const QString& );
virtual ~StdMeshersGUI_StdHypothesisCreator();
virtual bool checkParams( QString& ) const;
virtual bool checkParams( QString&, QStringList& ) const;
protected:
virtual QFrame* buildFrame ();