PAL10953. Remove obsolete files

This commit is contained in:
eap 2005-12-29 14:02:08 +00:00
parent de927c692f
commit 852100292a
4 changed files with 0 additions and 933 deletions

View File

@ -1,111 +0,0 @@
// SMESH StdMeshersGUI : GUI for StdMeshers plugin
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : StdMeshersGUI_CreateStdHypothesisDlg.cxx
// Moved here from SMESHGUI_CreateStdHypothesisDlg.cxx
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
using namespace std;
#include "StdMeshersGUI_CreateStdHypothesisDlg.h"
#include "StdMeshersGUI_Parameters.h"
#include "SMESHGUI.h"
#include "SMESHGUI_Hypotheses.h"
#include "utilities.h"
#include "SUIT_MessageBox.h"
#include "SUIT_ResourceMgr.h"
#include "SUIT_OverrideCursor.h"
#include "SUIT_Desktop.h"
//=================================================================================
// class : StdMeshersGUI_CreateStdHypothesisDlg()
// purpose :
//=================================================================================
StdMeshersGUI_CreateStdHypothesisDlg::StdMeshersGUI_CreateStdHypothesisDlg (const QString& hypType,
QWidget* parent,
const char* name,
bool /*modal*/,
WFlags fl)
: StdMeshersGUI_CreateHypothesisDlg (hypType, parent, name, true, fl)
{
QString hypTypeStr;
if (hypType.compare("LocalLength") == 0)
hypTypeStr = "LOCAL_LENGTH";
else if (hypType.compare("NumberOfSegments") == 0)
hypTypeStr = "NB_SEGMENTS";
else if (hypType.compare("MaxElementArea") == 0)
hypTypeStr = "MAX_ELEMENT_AREA";
else if (hypType.compare("MaxElementVolume") == 0)
hypTypeStr = "MAX_ELEMENT_VOLUME";
else if (hypType.compare("StartEndLength") == 0)
hypTypeStr = "START_END_LENGTH";
else if (hypType.compare("Deflection1D") == 0)
hypTypeStr = "DEFLECTION1D";
else if (hypType.compare("Arithmetic1D") == 0)
hypTypeStr = "ARITHMETIC_1D";
else if (hypType.compare("AutomaticLength") == 0)
hypTypeStr = "AUTOMATIC_LENGTH";
else
return;
QString caption( tr ( QString( "SMESH_%1_TITLE" ).arg( hypTypeStr )));
QString hypTypeName( tr ( QString( "SMESH_%1_HYPOTHESIS" ).arg( hypTypeStr )));
QString hypIconName( tr ( QString( "ICON_DLG_%1" ).arg( hypTypeStr )));
CreateDlgLayout(caption,
SMESHGUI::resourceMgr()->loadPixmap( "SMESH", hypIconName ),
hypTypeName);
}
//=================================================================================
// function : ~StdMeshersGUI_CreateStdHypothesisDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
StdMeshersGUI_CreateStdHypothesisDlg::~StdMeshersGUI_CreateStdHypothesisDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : FillParameters()
// purpose :
//=================================================================================
void StdMeshersGUI_CreateStdHypothesisDlg::GetParameters
(const QString & hypType,
std::list<SMESHGUI_aParameterPtr> & params)
{
StdMeshersGUI_Parameters::GetParameters( hypType, params );
}
//=================================================================================
// function : SetParameters()
// purpose :
//=================================================================================
bool StdMeshersGUI_CreateStdHypothesisDlg::SetParameters
(SMESH::SMESH_Hypothesis_ptr theHyp, const list<SMESHGUI_aParameterPtr> & params)
{
StdMeshersGUI_Parameters::SetParameters( theHyp, params );
return true;
}

View File

@ -1,622 +0,0 @@
// SMESH StdMeshersGUI : GUI for standard meshers
//
// Copyright (C) 2003 CEA
//
// 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.org
//
//
//
// File : StdMeshersGUI_Parameters.cxx
// Module : SMESH
// $Header$
#include "StdMeshersGUI_Parameters.h"
#include <qobject.h>
#include <qhbox.h>
#include <qslider.h>
#include <qlabel.h>
#include <math.h>
//#include <float.h>
using namespace std;
#define VALUE_MAX 1.0e+15 // COORD_MAX
#define VALUE_MAX_2 (VALUE_MAX*VALUE_MAX)
#define VALUE_MAX_3 (VALUE_MAX*VALUE_MAX*VALUE_MAX)
#define VALUE_SMALL 1.0e-15
#define VALUE_SMALL_2 (VALUE_SMALL*VALUE_SMALL)
#define VALUE_SMALL_3 (VALUE_SMALL*VALUE_SMALL*VALUE_SMALL)
//=======================================================================
//function : HasParameters
//purpose :
//=======================================================================
bool StdMeshersGUI_Parameters::HasParameters (const QString& hypType)
{
return ((hypType.compare("LocalLength") == 0) ||
(hypType.compare("NumberOfSegments") == 0) ||
(hypType.compare("MaxElementArea") == 0) ||
(hypType.compare("MaxElementVolume") == 0) ||
(hypType.compare("StartEndLength") == 0) ||
(hypType.compare("Deflection1D") == 0) ||
(hypType.compare("AutomaticLength") == 0) ||
(hypType.compare("Arithmetic1D") == 0));
}
//=======================================================================
//function : SetInitValue
//purpose :
//=======================================================================
void StdMeshersGUI_Parameters::SetInitValue(SMESHGUI_aParameterPtr param,
int initValue)
{
SMESHGUI_intParameter* p = dynamic_cast<SMESHGUI_intParameter*>(param.get());
if ( p )
{
p->InitValue() = initValue;
return;
}
SMESHGUI_enumParameter* q = dynamic_cast<SMESHGUI_enumParameter*>(param.get());
if( q )
{
q->InitValue() = initValue;
return;
}
SMESHGUI_boolParameter* b = dynamic_cast<SMESHGUI_boolParameter*>(param.get());
if( b )
{
b->InitValue() = (bool)initValue;
return;
}
}
//=======================================================================
//function : SetInitValue
//purpose :
//=======================================================================
void StdMeshersGUI_Parameters::SetInitValue(SMESHGUI_aParameterPtr param,
double initValue)
{
SMESHGUI_doubleParameter* p = dynamic_cast<SMESHGUI_doubleParameter*>(param.get());
if ( p ) p->InitValue() = initValue;
}
//=======================================================================
//function : SetInitValue
//purpose :
//=======================================================================
void StdMeshersGUI_Parameters::SetInitValue(SMESHGUI_aParameterPtr param,
const char* initValue)
{
SMESHGUI_strParameter* p = dynamic_cast<SMESHGUI_strParameter*>(param.get());
if ( p ) p->InitValue() = initValue;
}
//=======================================================================
//function : SetInitValue
//purpose :
//=======================================================================
void StdMeshersGUI_Parameters::SetInitValue( SMESHGUI_aParameterPtr param,
SMESH::double_array& initValue)
{
SMESHGUI_tableParameter* p = dynamic_cast<SMESHGUI_tableParameter*>(param.get());
if( p )
{
p->setRowCount( initValue.length()/2 );
p->setData( initValue );
}
}
//================================================================================
/*!
* \brief Macros to comfortably create SMESHGUI_aParameterPtr of different types
*/
//================================================================================
// SMESHGUI_doubleParameter( initValue, label, bottom, top, step, decimals )
#define DOUBLE_PARAM(v,l,b,t,s,d) SMESHGUI_aParameterPtr(new SMESHGUI_doubleParameter(v,l,b,t,s,d))
#define INT_PARAM(v,l,b,t) SMESHGUI_aParameterPtr(new SMESHGUI_intParameter(v,l,b,t))
#define ENUM_PARAM(v,i,l) SMESHGUI_aParameterPtr(new SMESHGUI_enumParameter(v,i,l))
#define STR_PARAM(i,l,preview) SMESHGUI_aParameterPtr(new SMESHGUI_strParameter(i,l,preview))
#define BOOL_PARAM(i,l,preview) SMESHGUI_aParameterPtr(new SMESHGUI_boolParameter(i,l,preview))
//================================================================================
/*!
* \brief Fill parameter list with default values
* \param hypType - The name of hypothesis type
* \param paramList - The list to fill
*/
//================================================================================
void StdMeshersGUI_Parameters::GetParameters (const QString& hypType,
list<SMESHGUI_aParameterPtr> & paramList )
{
paramList.clear();
if (hypType.compare("LocalLength") == 0)
{
paramList.push_back( DOUBLE_PARAM (1.0,
QObject::tr("SMESH_LOCAL_LENGTH_PARAM"),
VALUE_SMALL, VALUE_MAX, 1.0, 6));
}
else if (hypType.compare("NumberOfSegments") == 0)
{
//0-th parameter in list
paramList.push_back ( INT_PARAM (3,
QObject::tr("SMESH_NB_SEGMENTS_PARAM"),
1, 9999 ));
QStringList types;
types.append( QObject::tr( "SMESH_DISTR_REGULAR" ) );
types.append( QObject::tr( "SMESH_DISTR_SCALE" ) );
types.append( QObject::tr( "SMESH_DISTR_TAB" ) );
types.append( QObject::tr( "SMESH_DISTR_EXPR" ) );
//string description of distribution types
SMESHGUI_enumParameter* type = new SMESHGUI_enumParameter( types, 0, QObject::tr( "SMESH_DISTR_TYPE" ) );
SMESHGUI_dependParameter::ShownMap& aMap = type->shownMap();
aMap[0].append( 0 ); // if DistrType=0 (regular), then number of segments and types are shown (0-th and 1-th)
aMap[0].append( 1 );
aMap[1].append( 0 ); // if DistrType=1 (scale), then number of segments, types and scale are shown
aMap[1].append( 1 );
aMap[1].append( 2 );
aMap[2].append( 0 ); // if DistrType=2 (table), then number of segments, types, table and exponent are shown
aMap[2].append( 1 );
aMap[2].append( 3 );
aMap[2].append( 5 );
aMap[3].append( 0 ); // if DistrType=3 (expression), then number of segments, types, expression and exponent are shown
aMap[3].append( 1 );
aMap[3].append( 4 );
aMap[3].append( 5 );
//1-th parameter in list
paramList.push_back ( SMESHGUI_aParameterPtr( type ) );
//2-th parameter in list
paramList.push_back ( DOUBLE_PARAM (1.0,
QObject::tr("SMESH_NB_SEGMENTS_SCALE_PARAM"),
VALUE_SMALL, VALUE_MAX, 0.1, 6 ));
SMESHGUI_tableParameter* tab = new SMESHGUI_tableParameter( 0.0, QObject::tr( "SMESH_TAB_FUNC" ), true );
tab->setRowCount( 5 );
tab->setColCount( 2 );
//default size of table: 5x2
tab->setColName( 0, "t" );
tab->setColName( 1, "f(t)" );
tab->setValidator( 0, 0.0, 1.0, 3 );
tab->setValidator( 1, 1E-7, 1E+300, 3 );
tab->setEditRows( true );
//3-th parameter in list
paramList.push_back ( SMESHGUI_aParameterPtr( tab ) );
//4-th parameter in list
paramList.push_back ( STR_PARAM ( "", QObject::tr( "SMESH_EXPR_FUNC" ), true ) );
//5-th parameter in list
paramList.push_back ( BOOL_PARAM ( false, QObject::tr( "SMESH_EXP_MODE" ), true ) );
}
else if (hypType.compare("Arithmetic1D") == 0)
{
paramList.push_back( DOUBLE_PARAM ( 1.0,
QObject::tr("SMESH_START_LENGTH_PARAM"),
VALUE_SMALL, VALUE_MAX, 1, 6));
paramList.push_back( DOUBLE_PARAM ( 10.0,
QObject::tr("SMESH_END_LENGTH_PARAM"),
VALUE_SMALL, VALUE_MAX, 1, 6));
}
else if (hypType.compare("MaxElementArea") == 0)
{
paramList.push_back( DOUBLE_PARAM (1.0,
QObject::tr("SMESH_MAX_ELEMENT_AREA_PARAM"),
VALUE_SMALL_2, VALUE_MAX_2, 1.0, 6));
}
else if (hypType.compare("MaxElementVolume") == 0)
{
paramList.push_back( DOUBLE_PARAM ( 1.0,
QObject::tr("SMESH_MAX_ELEMENT_VOLUME_PARAM"),
VALUE_SMALL_3, VALUE_MAX_3, 1.0, 6));
}
else if (hypType.compare("StartEndLength") == 0)
{
paramList.push_back( DOUBLE_PARAM ( 1.0,
QObject::tr("SMESH_START_LENGTH_PARAM"),
VALUE_SMALL, VALUE_MAX, 1, 6));
paramList.push_back( DOUBLE_PARAM ( 10.0,
QObject::tr("SMESH_END_LENGTH_PARAM"),
VALUE_SMALL, VALUE_MAX, 1, 6));
}
else if (hypType.compare("Deflection1D") == 0)
{
paramList.push_back( DOUBLE_PARAM ( 1.0,
QObject::tr("SMESH_DEFLECTION1D_PARAM"),
VALUE_SMALL, VALUE_MAX, 1, 6));
}
else if (hypType.compare("AutomaticLength") == 0)
{
SMESHGUI_aParameter * param =
new StdMeshersGUI_doubleSliderParameter ( QObject::tr("SMESH_FINENESS_PARAM"),
"0 ", " 1",
0.0, 0.0, 1.0, 0.05);
paramList.push_back( SMESHGUI_aParameterPtr( param ));
}
}
//================================================================================
/*!
* \brief Fill parameter list with real values the hypothesis has
* \param theHyp - The hypothesis to retrieve parameter values from
* \param paramList - The list to fill
*/
//================================================================================
void StdMeshersGUI_Parameters::GetParameters (SMESH::SMESH_Hypothesis_ptr theHyp,
list<SMESHGUI_aParameterPtr> & paramList )
{
paramList.clear();
if (theHyp->_is_nil()) return;
QString hypType = theHyp->GetName();
GetParameters( hypType, paramList ); // get default parameters
if ( paramList.empty() )
return;
// set current values
if (hypType.compare("LocalLength") == 0)
{
StdMeshers::StdMeshers_LocalLength_var LL =
StdMeshers::StdMeshers_LocalLength::_narrow(theHyp);
SetInitValue( paramList.front(), LL->GetLength() );
}
else if (hypType.compare("NumberOfSegments") == 0)
{
StdMeshers::StdMeshers_NumberOfSegments_var NOS =
StdMeshers::StdMeshers_NumberOfSegments::_narrow(theHyp);
list<SMESHGUI_aParameterPtr>::iterator anIt = paramList.begin();
SetInitValue( *anIt, (int) NOS->GetNumberOfSegments()); anIt++;
int DType = (int) NOS->GetDistrType();
SetInitValue( *anIt, DType ); anIt++;
if( DType==1 )
SetInitValue( *anIt, NOS->GetScaleFactor());
anIt++;
if( DType==2 )
{
SMESH::double_array* tab_func = NOS->GetTableFunction();
SetInitValue( *anIt, *tab_func );
delete tab_func;
}
anIt++;
if( DType==3 )
{
char* expr_func = NOS->GetExpressionFunction();
SetInitValue( *anIt, expr_func );
//delete expr_func;
}
anIt++;
if( DType==2 || DType==3 )
SetInitValue( *anIt, (bool)NOS->IsExponentMode());
}
else if (hypType.compare("Arithmetic1D") == 0)
{
StdMeshers::StdMeshers_Arithmetic1D_var hyp =
StdMeshers::StdMeshers_Arithmetic1D::_narrow(theHyp);
SetInitValue( paramList.front(), hyp->GetLength( true )) ;
SetInitValue( paramList.back(), hyp->GetLength( false )) ;
}
else if (hypType.compare("MaxElementArea") == 0)
{
StdMeshers::StdMeshers_MaxElementArea_var MEA =
StdMeshers::StdMeshers_MaxElementArea::_narrow(theHyp);
SetInitValue( paramList.front(), MEA->GetMaxElementArea() );
}
else if (hypType.compare("MaxElementVolume") == 0)
{
StdMeshers::StdMeshers_MaxElementVolume_var MEV =
StdMeshers::StdMeshers_MaxElementVolume::_narrow(theHyp);
SetInitValue( paramList.front(), MEV->GetMaxElementVolume() );
}
else if (hypType.compare("StartEndLength") == 0)
{
StdMeshers::StdMeshers_StartEndLength_var hyp =
StdMeshers::StdMeshers_StartEndLength::_narrow(theHyp);
SetInitValue( paramList.front(), hyp->GetLength( true ));
SetInitValue( paramList.back(), hyp->GetLength( false ));
}
else if (hypType.compare("Deflection1D") == 0)
{
StdMeshers::StdMeshers_Deflection1D_var hyp =
StdMeshers::StdMeshers_Deflection1D::_narrow(theHyp);
SetInitValue( paramList.back(), hyp->GetDeflection()) ;
}
else if (hypType.compare("AutomaticLength") == 0)
{
StdMeshers::StdMeshers_AutomaticLength_var hyp =
StdMeshers::StdMeshers_AutomaticLength::_narrow(theHyp);
SetInitValue( paramList.back(), hyp->GetFineness());
}
}
//================================================================================
/*!
* \brief Return parameter values as a string
* \param hyp - not used
* \param paramList - list of parameter values
* \param params - output string
*/
//================================================================================
void StdMeshersGUI_Parameters::GetParameters (SMESH::SMESH_Hypothesis_ptr ,
const list<SMESHGUI_aParameterPtr>& paramList,
QString& params)
{
params = "";
list<SMESHGUI_aParameterPtr>::const_iterator paramIt = paramList.begin();
for ( ; paramIt != paramList.end(); paramIt++) {
if (params.compare("")) params += " ; ";
SMESHGUI_aParameter::Type t = (*paramIt)->GetType();
if( t==SMESHGUI_aParameter::DOUBLE )
{
double aDoubleValue = 0.;
(*paramIt)->GetNewDouble(aDoubleValue);
params += QString::number(aDoubleValue);
}
else if( t==SMESHGUI_aParameter::STRING || t==SMESHGUI_aParameter::ENUM )
{
QString aStrValue( "" );
(*paramIt)->GetNewText(aStrValue);
params += aStrValue.simplifyWhiteSpace();
}
else if( t==SMESHGUI_aParameter::TABLE )
{
params += "TABLE";
}
else
{
int aIntValue = 0;
(*paramIt)->GetNewInt(aIntValue);
params += QString::number(aIntValue);
}
}
}
//=======================================================================
//function : SetParameters
//purpose :
//=======================================================================
//================================================================================
/*!
* \brief Set parameter values from the list into a hypothesis
* \param theHyp - The hypothesis to modify
* \param paramList - list of parameter values
* \retval bool - true if any parameter value changed
*/
//================================================================================
bool StdMeshersGUI_Parameters::SetParameters(SMESH::SMESH_Hypothesis_ptr theHyp,
const list<SMESHGUI_aParameterPtr> & paramList )
{
if (theHyp->_is_nil() || paramList.empty()) return false;
bool modified = false;
QString hypType = theHyp->GetName();
if (hypType.compare("LocalLength") == 0)
{
StdMeshers::StdMeshers_LocalLength_var LL =
StdMeshers::StdMeshers_LocalLength::_narrow(theHyp);
double length = LL->GetLength();
modified = paramList.front()->GetNewDouble( length );
LL->SetLength(length);
}
else if (hypType.compare("NumberOfSegments") == 0)
{
StdMeshers::StdMeshers_NumberOfSegments_var NOS =
StdMeshers::StdMeshers_NumberOfSegments::_narrow(theHyp);
list<SMESHGUI_aParameterPtr>::const_iterator anIt = paramList.begin();
int NbSeg, DType;
double Scale;
SMESH::double_array TabF;
QString exprF;
int expType;
modified = (*anIt)->GetNewInt( NbSeg ); anIt++;
modified = (*anIt)->GetNewInt( DType ) || modified; anIt++;
modified = (*anIt)->GetNewDouble( Scale ) || modified; anIt++;
SMESHGUI_aParameterPtr p = *anIt;
((SMESHGUI_tableParameter*)p.get())->data( TabF ); anIt++; modified = true;
modified = (*anIt)->GetNewText( exprF ) || modified; anIt++;
modified = (*anIt)->GetNewInt( expType ) || modified;
NOS->SetNumberOfSegments( NbSeg );
NOS->SetDistrType( DType );
if( DType==1 )
NOS->SetScaleFactor( Scale );
if( DType==2 )
NOS->SetTableFunction( TabF );
if( DType==3 )
NOS->SetExpressionFunction( CORBA::string_dup( exprF.latin1() ) );
if( DType==2 || DType==3 )
NOS->SetExponentMode( (bool)expType );
}
else if (hypType.compare("Arithmetic1D") == 0)
{
if ( paramList.size() != 2 )
return false;
StdMeshers::StdMeshers_Arithmetic1D_var hyp =
StdMeshers::StdMeshers_Arithmetic1D::_narrow(theHyp);
double begLength = hyp->GetLength( true ) ;
double endLength = hyp->GetLength( false ) ;
modified = paramList.front()->GetNewDouble( begLength );
modified = paramList.back()->GetNewDouble( endLength ) || modified;
hyp->SetLength( begLength, true );
hyp->SetLength( endLength, false );
}
else if (hypType.compare("MaxElementArea") == 0)
{
StdMeshers::StdMeshers_MaxElementArea_var MEA =
StdMeshers::StdMeshers_MaxElementArea::_narrow(theHyp);
double MaxArea = MEA->GetMaxElementArea();
modified = paramList.front()->GetNewDouble( MaxArea );
MEA->SetMaxElementArea(MaxArea);
}
else if (hypType.compare("MaxElementVolume") == 0)
{
StdMeshers::StdMeshers_MaxElementVolume_var MEV =
StdMeshers::StdMeshers_MaxElementVolume::_narrow(theHyp);
double MaxVolume = MEV->GetMaxElementVolume() ;
modified = paramList.front()->GetNewDouble( MaxVolume );
MEV->SetMaxElementVolume(MaxVolume);
}
else if (hypType.compare("StartEndLength") == 0)
{
if ( paramList.size() != 2 )
return false;
StdMeshers::StdMeshers_StartEndLength_var hyp =
StdMeshers::StdMeshers_StartEndLength::_narrow(theHyp);
double begLength = hyp->GetLength( true ) ;
double endLength = hyp->GetLength( false ) ;
modified = paramList.front()->GetNewDouble( begLength );
modified = paramList.back()->GetNewDouble( endLength ) || modified;
hyp->SetLength( begLength, true );
hyp->SetLength( endLength, false );
}
else if (hypType.compare("Deflection1D") == 0)
{
StdMeshers::StdMeshers_Deflection1D_var hyp =
StdMeshers::StdMeshers_Deflection1D::_narrow(theHyp);
double value = hyp->GetDeflection() ;
modified = paramList.front()->GetNewDouble( value );
hyp->SetDeflection( value );
}
else if (hypType.compare("AutomaticLength") == 0)
{
StdMeshers::StdMeshers_AutomaticLength_var hyp =
StdMeshers::StdMeshers_AutomaticLength::_narrow(theHyp);
double value = hyp->GetFineness() ;
modified = paramList.front()->GetNewDouble( value );
hyp->SetFineness( value );
}
return modified ;
}
//================================================================================
/*!
* \brief Widget: slider with left and right labels
*/
//================================================================================
class StdMeshersGUI_SliderWith2Lables: public QHBox
{
public:
StdMeshersGUI_SliderWith2Lables( const QString& leftLabel,
const QString& rightLabel,
QWidget * parent =0,
const char * name=0 );
QSlider * getSlider() const { return _slider; }
private:
QSlider * _slider;
};
StdMeshersGUI_SliderWith2Lables::StdMeshersGUI_SliderWith2Lables( const QString& leftLabel,
const QString& rightLabel,
QWidget * parent,
const char * name )
:QHBox(parent,name)
{
if ( !leftLabel.isEmpty() )
(new QLabel( this ))->setText( leftLabel );
_slider = new QSlider( Horizontal, this );
if ( !rightLabel.isEmpty() )
(new QLabel( this ))->setText( rightLabel );
}
//================================================================================
/*!
* \brief Constructor
* \param label - main label
* \param leftLabel - label to the left of slider
* \param rightLabel - label to the right of slider
* \param initValue - initial slider value
* \param bottom - least slider value
* \param top - maximal slider value
* \param precision - slider value precision
*/
//================================================================================
StdMeshersGUI_doubleSliderParameter::
StdMeshersGUI_doubleSliderParameter (const QString& label,
const QString& leftLabel,
const QString& rightLabel,
const double initValue,
const double bottom,
const double top ,
const double precision)
:SMESHGUI_doubleParameter(initValue,label,bottom,top,precision),
_leftLabel(leftLabel), _rightLabel(rightLabel)
{
}
QWidget* StdMeshersGUI_doubleSliderParameter::CreateWidget( QWidget* parent ) const
{
return new StdMeshersGUI_SliderWith2Lables( _leftLabel, _rightLabel, parent );
}
void StdMeshersGUI_doubleSliderParameter::InitializeWidget( QWidget* aWidget) const
{
StdMeshersGUI_SliderWith2Lables * paramWidget =
dynamic_cast<StdMeshersGUI_SliderWith2Lables*> (aWidget);
if ( paramWidget && paramWidget->getSlider() )
{
QSlider * slider = paramWidget->getSlider();
slider->setRange( 0, toInt( _top ));
slider->setValue( toInt( _initValue ));
}
}
void StdMeshersGUI_doubleSliderParameter::TakeValue( QWidget* aWidget)
{
StdMeshersGUI_SliderWith2Lables * paramWidget =
dynamic_cast<StdMeshersGUI_SliderWith2Lables*> (aWidget);
if ( paramWidget && paramWidget->getSlider() )
{
int val = paramWidget->getSlider()->value();
_newValue = Bottom() + val * Step();
}
}
int StdMeshersGUI_doubleSliderParameter::toInt( double val ) const
{
return (int) ceil(( val - _bottom ) / _step );
}

View File

@ -1,87 +0,0 @@
// SMESH StdMeshersGUI : GUI for standard meshers
//
// Copyright (C) 2003 CEA
//
// 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.org
//
//
//
// File : StdMeshersGUI_Parameters.h
// Module : SMESH
// $Header$
#ifndef STDMESHERSGUI_PARAMETERS_H
#define STDMESHERSGUI_PARAMETERS_H
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include "SMESHGUI_aParameter.h"
#include <list>
#include <vector>
class StdMeshersGUI_Parameters
{
public:
static bool HasParameters (const QString& hypType);
static void GetParameters (const QString& hypType,
std::list<SMESHGUI_aParameterPtr> & params );
static void GetParameters (SMESH::SMESH_Hypothesis_ptr hyp,
std::list<SMESHGUI_aParameterPtr> & params );
static void GetParameters (SMESH::SMESH_Hypothesis_ptr hyp,
const std::list<SMESHGUI_aParameterPtr> & paramList,
QString& params);
static bool SetParameters(SMESH::SMESH_Hypothesis_ptr hyp,
const std::list<SMESHGUI_aParameterPtr> & params );
static void SetInitValue(SMESHGUI_aParameterPtr param,
int initValue);
static void SetInitValue(SMESHGUI_aParameterPtr param,
double initValue);
static void SetInitValue(SMESHGUI_aParameterPtr param,
const char* initValue);
static void SetInitValue(SMESHGUI_aParameterPtr param,
SMESH::double_array& initValue);
};
/*!
* \brief This class provides double parameter with slider control
*/
class StdMeshersGUI_doubleSliderParameter: public SMESHGUI_doubleParameter
{
public:
StdMeshersGUI_doubleSliderParameter(const QString& label = QString::null,
const QString& leftLabel = QString::null,
const QString& rightLabel = QString::null,
const double initValue = 0.0,
const double bottom = 0,
const double top = 1,
const double precision = 0.1);
virtual QWidget* CreateWidget( QWidget* ) const;
virtual void InitializeWidget( QWidget* ) const;
virtual void TakeValue( QWidget* );
int toInt( double val ) const;
private:
QString _leftLabel, _rightLabel;
};
#endif

View File

@ -1,113 +0,0 @@
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
# would be translated to "Pub", not "Foo::Pub".
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n"
"PO-Revision-Date: YYYY-MM-DD\n"
"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
#Select Icon
msgid "ICON_SELECT"
msgstr "select1.png"
#-----------------------------------------------------------
# Hypothesis
#-----------------------------------------------------------
#Hypo Local Length
msgid "ICON_DLG_LOCAL_LENGTH"
msgstr "mesh_hypo_length.png"
#Hypo Nb Segments
msgid "ICON_DLG_NB_SEGMENTS"
msgstr "mesh_hypo_segment.png"
#Hypo Max Area
msgid "ICON_DLG_MAX_ELEMENT_AREA"
msgstr "mesh_hypo_area.png"
#Hypo Max Volume
msgid "ICON_DLG_MAX_ELEMENT_VOLUME"
msgstr "mesh_hypo_volume.png"
#Hypo Start End Length
msgid "ICON_DLG_START_END_LENGTH"
msgstr "mesh_hypo_length.png"
#Hypo deflection 1D
msgid "ICON_DLG_DEFLECTION1D"
msgstr "mesh_hypo_length.png"
#Hypo Geometric 1D
msgid "ICON_DLG_GEOMETRIC_1D"
msgstr "mesh_hypo_length.png"
#Hypo Arithmetic 1D
msgid "ICON_DLG_ARITHMETIC_1D"
msgstr "mesh_hypo_length.png"
#-----------------------------------------------------------
# ObjectBrowser
#-----------------------------------------------------------
#mesh_tree_algo_regular
msgid "ICON_SMESH_TREE_ALGO_Regular_1D"
msgstr "mesh_tree_algo_regular.png"
#mesh_tree_algo_hexa
msgid "ICON_SMESH_TREE_ALGO_Hexa_3D"
msgstr "mesh_tree_algo_hexa.png"
#mesh_tree_algo_mefisto
msgid "ICON_SMESH_TREE_ALGO_MEFISTO_2D"
msgstr "mesh_tree_algo_mefisto.png"
#mesh_tree_algo_quad
msgid "ICON_SMESH_TREE_ALGO_Quadrangle_2D"
msgstr "mesh_tree_algo_quad.png"
#mesh_tree_hypo_area
msgid "ICON_SMESH_TREE_HYPO_MaxElementArea"
msgstr "mesh_tree_hypo_area.png"
#mesh_tree_hypo_length
msgid "ICON_SMESH_TREE_HYPO_LocalLength"
msgstr "mesh_tree_hypo_length.png"
#mesh_tree_hypo_segment
msgid "ICON_SMESH_TREE_HYPO_NumberOfSegments"
msgstr "mesh_tree_hypo_segment.png"
#mesh_tree_hypo_volume
msgid "ICON_SMESH_TREE_HYPO_MaxElementVolume"
msgstr "mesh_tree_hypo_volume.png"
#mesh_tree_hypo_length
msgid "ICON_SMESH_TREE_HYPO_LengthFromEdges"
msgstr "mesh_tree_hypo_length.png"
#mesh_tree_hypo_nonconform
msgid "ICON_SMESH_TREE_HYPO_NotConformAllowed"
msgstr "mesh_tree_hypo_length.png"
#mesh_tree_hypo_start_end_length
msgid "ICON_SMESH_TREE_HYPO_StartEndLength"
msgstr "mesh_tree_hypo_length.png"
#mesh_tree_hypo_deflection1d
msgid "ICON_SMESH_TREE_HYPO_Deflection1D"
msgstr "mesh_tree_hypo_length.png"
#mesh_tree_hypo_Arithmetic1d
msgid "ICON_SMESH_TREE_HYPO_Arithmetic1D"
msgstr "mesh_tree_hypo_length.png"
#mesh_tree_hypo_propagation
msgid "ICON_SMESH_TREE_HYPO_Propagation"
msgstr "mesh_tree_hypo_length.png"