mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 08:50:35 +05:00
PAL10953. Add Fineness parameter to Automatic Length hypothesis
This commit is contained in:
parent
236b583d31
commit
5c933ecde0
@ -58,6 +58,16 @@ module StdMeshers
|
|||||||
*/
|
*/
|
||||||
interface StdMeshers_AutomaticLength : SMESH::SMESH_Hypothesis
|
interface StdMeshers_AutomaticLength : SMESH::SMESH_Hypothesis
|
||||||
{
|
{
|
||||||
|
/*!
|
||||||
|
* Sets Fineness parameter value
|
||||||
|
*/
|
||||||
|
void SetFineness(in double theFineness)
|
||||||
|
raises (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Returns <Fineness> parameter value
|
||||||
|
*/
|
||||||
|
double GetFineness();
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -667,6 +667,7 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th
|
|||||||
hyp->myDim = 1;
|
hyp->myDim = 1;
|
||||||
hyp->myCreationMethod = "AutomaticLength";
|
hyp->myCreationMethod = "AutomaticLength";
|
||||||
hyp->myType = "Regular_1D";
|
hyp->myType = "Regular_1D";
|
||||||
|
hyp->myArgMethods.Append( "SetFineness");
|
||||||
}
|
}
|
||||||
// 1D Python_1D ----------
|
// 1D Python_1D ----------
|
||||||
else if ( hypType == "Python_1D" ) {
|
else if ( hypType == "Python_1D" ) {
|
||||||
@ -704,7 +705,7 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th
|
|||||||
else if ( hypType == "QuadranglePreference" ) {
|
else if ( hypType == "QuadranglePreference" ) {
|
||||||
hyp->myDim = 2;
|
hyp->myDim = 2;
|
||||||
hyp->myCreationMethod = "QuadranglePreference";
|
hyp->myCreationMethod = "QuadranglePreference";
|
||||||
hyp->myType = "MEFISTO_2D";
|
hyp->myType = "Quadrangle_2D";
|
||||||
}
|
}
|
||||||
// 3D ----------
|
// 3D ----------
|
||||||
else if ( hypType == "NETGEN_3D") {
|
else if ( hypType == "NETGEN_3D") {
|
||||||
|
@ -206,11 +206,14 @@ class Mesh_Segment(Mesh_Algorithm):
|
|||||||
"""
|
"""
|
||||||
return self.Hypothesis("Propagation")
|
return self.Hypothesis("Propagation")
|
||||||
|
|
||||||
def AutomaticLength(self):
|
def AutomaticLength(self, fineness):
|
||||||
"""
|
"""
|
||||||
Define "AutomaticLength" hypothesis
|
Define "AutomaticLength" hypothesis
|
||||||
|
\param fineness for the fineness [0-1]
|
||||||
"""
|
"""
|
||||||
return self.Hypothesis("AutomaticLength")
|
hyp = self.Hypothesis("AutomaticLength")
|
||||||
|
hyp.SetFineness( fineness )
|
||||||
|
return hyp
|
||||||
|
|
||||||
# Public class: Mesh_Segment_Python
|
# Public class: Mesh_Segment_Python
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
|
@ -54,6 +54,7 @@ StdMeshers_AutomaticLength::StdMeshers_AutomaticLength(int hypId, int studyId,
|
|||||||
_param_algo_dim = 1; // is used by SMESH_Regular_1D
|
_param_algo_dim = 1; // is used by SMESH_Regular_1D
|
||||||
|
|
||||||
_mesh = 0;
|
_mesh = 0;
|
||||||
|
_fineness = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -66,6 +67,32 @@ StdMeshers_AutomaticLength::~StdMeshers_AutomaticLength()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Set Fineness
|
||||||
|
* \param theFineness - The Fineness value [0.0-1.0],
|
||||||
|
* 0 - coarse mesh
|
||||||
|
* 1 - fine mesh
|
||||||
|
*
|
||||||
|
* Raise if theFineness is out of range
|
||||||
|
* The "Initial Number of Elements on the Shortest Edge" (S0)
|
||||||
|
* is divided by (0.5 + 4.5 x theFineness)
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void StdMeshers_AutomaticLength::SetFineness(double theFineness)
|
||||||
|
throw(SALOME_Exception)
|
||||||
|
{
|
||||||
|
if ( theFineness < 0.0 || theFineness > 1.0 )
|
||||||
|
throw SALOME_Exception(LOCALIZED("theFineness is out of range [0.0-1.0]"));
|
||||||
|
|
||||||
|
if ( _fineness != theFineness )
|
||||||
|
{
|
||||||
|
NotifySubMeshesHypothesisModification();
|
||||||
|
_fineness = theFineness;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Return pointer to TopoDS_TShape
|
* \brief Return pointer to TopoDS_TShape
|
||||||
@ -181,7 +208,7 @@ double StdMeshers_AutomaticLength::GetLength(const SMESH_Mesh* theMesh,
|
|||||||
if ( tshape_length == _TShapeToLength.end() )
|
if ( tshape_length == _TShapeToLength.end() )
|
||||||
return 1; // it is a dgenerated edge
|
return 1; // it is a dgenerated edge
|
||||||
|
|
||||||
return tshape_length->second;
|
return tshape_length->second / (0.5 + 4.5 * _fineness);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -192,6 +219,7 @@ double StdMeshers_AutomaticLength::GetLength(const SMESH_Mesh* theMesh,
|
|||||||
|
|
||||||
ostream & StdMeshers_AutomaticLength::SaveTo(ostream & save)
|
ostream & StdMeshers_AutomaticLength::SaveTo(ostream & save)
|
||||||
{
|
{
|
||||||
|
save << _fineness;
|
||||||
return save;
|
return save;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,6 +231,8 @@ ostream & StdMeshers_AutomaticLength::SaveTo(ostream & save)
|
|||||||
|
|
||||||
istream & StdMeshers_AutomaticLength::LoadFrom(istream & load)
|
istream & StdMeshers_AutomaticLength::LoadFrom(istream & load)
|
||||||
{
|
{
|
||||||
|
if ( ! ( load >> _fineness ))
|
||||||
|
load.clear(ios::badbit | load.rdstate());
|
||||||
return load;
|
return load;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +54,25 @@ public:
|
|||||||
double GetLength(const SMESH_Mesh* aMesh, const TopoDS_Shape& anEdge)
|
double GetLength(const SMESH_Mesh* aMesh, const TopoDS_Shape& anEdge)
|
||||||
throw(SALOME_Exception);
|
throw(SALOME_Exception);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Set Fineness
|
||||||
|
* \param theFineness - The Fineness value [0.0-1.0],
|
||||||
|
* 0 - coarse mesh
|
||||||
|
* 1 - fine mesh
|
||||||
|
*
|
||||||
|
* Raise if theFineness is out of range
|
||||||
|
* The "Initial Number of Elements on the Shortest Edge" (S0)
|
||||||
|
* is divided by (0.5 + 4.5 x theFineness)
|
||||||
|
*/
|
||||||
|
void SetFineness(double theFineness)
|
||||||
|
throw(SALOME_Exception);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return mesh Fineness
|
||||||
|
* \retval double - Fineness value [0.0-1.0]
|
||||||
|
*/
|
||||||
|
double GetFineness() const { return _fineness; }
|
||||||
|
|
||||||
virtual std::ostream & SaveTo(std::ostream & save);
|
virtual std::ostream & SaveTo(std::ostream & save);
|
||||||
virtual std::istream & LoadFrom(std::istream & load);
|
virtual std::istream & LoadFrom(std::istream & load);
|
||||||
friend std::ostream & operator <<(std::ostream & save, StdMeshers_AutomaticLength & hyp);
|
friend std::ostream & operator <<(std::ostream & save, StdMeshers_AutomaticLength & hyp);
|
||||||
@ -62,6 +81,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
std::map<const TopoDS_TShape*, double> _TShapeToLength;
|
std::map<const TopoDS_TShape*, double> _TShapeToLength;
|
||||||
const SMESH_Mesh* _mesh;
|
const SMESH_Mesh* _mesh;
|
||||||
|
double _fineness;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -66,6 +66,8 @@ StdMeshersGUI_CreateStdHypothesisDlg::StdMeshersGUI_CreateStdHypothesisDlg (cons
|
|||||||
hypTypeStr = "DEFLECTION1D";
|
hypTypeStr = "DEFLECTION1D";
|
||||||
else if (hypType.compare("Arithmetic1D") == 0)
|
else if (hypType.compare("Arithmetic1D") == 0)
|
||||||
hypTypeStr = "ARITHMETIC_1D";
|
hypTypeStr = "ARITHMETIC_1D";
|
||||||
|
else if (hypType.compare("AutomaticLength") == 0)
|
||||||
|
hypTypeStr = "AUTOMATIC_LENGTH";
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -26,9 +26,13 @@
|
|||||||
|
|
||||||
#include "StdMeshersGUI_Parameters.h"
|
#include "StdMeshersGUI_Parameters.h"
|
||||||
|
|
||||||
//#include "SMESHGUI_SpinBox.h" // for the sake of COORD_MAX, COORD_MIN definition
|
|
||||||
|
|
||||||
#include <qobject.h>
|
#include <qobject.h>
|
||||||
|
#include <qhbox.h>
|
||||||
|
#include <qslider.h>
|
||||||
|
#include <qlabel.h>
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
//#include <float.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -53,6 +57,7 @@ bool StdMeshersGUI_Parameters::HasParameters (const QString& hypType)
|
|||||||
(hypType.compare("MaxElementVolume") == 0) ||
|
(hypType.compare("MaxElementVolume") == 0) ||
|
||||||
(hypType.compare("StartEndLength") == 0) ||
|
(hypType.compare("StartEndLength") == 0) ||
|
||||||
(hypType.compare("Deflection1D") == 0) ||
|
(hypType.compare("Deflection1D") == 0) ||
|
||||||
|
(hypType.compare("AutomaticLength") == 0) ||
|
||||||
(hypType.compare("Arithmetic1D") == 0));
|
(hypType.compare("Arithmetic1D") == 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,10 +130,11 @@ void StdMeshersGUI_Parameters::SetInitValue( SMESHGUI_aParameterPtr param,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//================================================================================
|
||||||
//function : GetParameters
|
/*!
|
||||||
//purpose :
|
* \brief Macros to comfortably create SMESHGUI_aParameterPtr of different types
|
||||||
//=======================================================================
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
// SMESHGUI_doubleParameter( initValue, label, bottom, top, step, decimals )
|
// 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 DOUBLE_PARAM(v,l,b,t,s,d) SMESHGUI_aParameterPtr(new SMESHGUI_doubleParameter(v,l,b,t,s,d))
|
||||||
@ -137,6 +143,14 @@ void StdMeshersGUI_Parameters::SetInitValue( SMESHGUI_aParameterPtr param,
|
|||||||
#define STR_PARAM(i,l,preview) SMESHGUI_aParameterPtr(new SMESHGUI_strParameter(i,l,preview))
|
#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))
|
#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,
|
void StdMeshersGUI_Parameters::GetParameters (const QString& hypType,
|
||||||
list<SMESHGUI_aParameterPtr> & paramList )
|
list<SMESHGUI_aParameterPtr> & paramList )
|
||||||
{
|
{
|
||||||
@ -239,12 +253,23 @@ void StdMeshersGUI_Parameters::GetParameters (const QString& hyp
|
|||||||
QObject::tr("SMESH_DEFLECTION1D_PARAM"),
|
QObject::tr("SMESH_DEFLECTION1D_PARAM"),
|
||||||
VALUE_SMALL, VALUE_MAX, 1, 6));
|
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 ));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//================================================================================
|
||||||
//function : GetParameters
|
/*!
|
||||||
//purpose :
|
* \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,
|
void StdMeshersGUI_Parameters::GetParameters (SMESH::SMESH_Hypothesis_ptr theHyp,
|
||||||
list<SMESHGUI_aParameterPtr> & paramList )
|
list<SMESHGUI_aParameterPtr> & paramList )
|
||||||
@ -330,18 +355,29 @@ void StdMeshersGUI_Parameters::GetParameters (SMESH::SMESH_Hypothesis_ptr the
|
|||||||
StdMeshers::StdMeshers_Deflection1D::_narrow(theHyp);
|
StdMeshers::StdMeshers_Deflection1D::_narrow(theHyp);
|
||||||
SetInitValue( paramList.back(), hyp->GetDeflection()) ;
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//================================================================================
|
||||||
//function : GetParameters
|
/*!
|
||||||
//purpose :
|
* \brief Return parameter values as a string
|
||||||
//=======================================================================
|
* \param hyp - not used
|
||||||
void StdMeshersGUI_Parameters::GetParameters (SMESH::SMESH_Hypothesis_ptr hyp,
|
* \param paramList - list of parameter values
|
||||||
list<SMESHGUI_aParameterPtr> & paramList,
|
* \param params - output string
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void StdMeshersGUI_Parameters::GetParameters (SMESH::SMESH_Hypothesis_ptr ,
|
||||||
|
const list<SMESHGUI_aParameterPtr>& paramList,
|
||||||
QString& params)
|
QString& params)
|
||||||
{
|
{
|
||||||
params = "";
|
params = "";
|
||||||
list<SMESHGUI_aParameterPtr>::iterator paramIt = paramList.begin();
|
list<SMESHGUI_aParameterPtr>::const_iterator paramIt = paramList.begin();
|
||||||
for ( ; paramIt != paramList.end(); paramIt++) {
|
for ( ; paramIt != paramList.end(); paramIt++) {
|
||||||
if (params.compare("")) params += " ; ";
|
if (params.compare("")) params += " ; ";
|
||||||
|
|
||||||
@ -376,6 +412,15 @@ void StdMeshersGUI_Parameters::GetParameters (SMESH::SMESH_Hypothesis_ptr
|
|||||||
//purpose :
|
//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,
|
bool StdMeshersGUI_Parameters::SetParameters(SMESH::SMESH_Hypothesis_ptr theHyp,
|
||||||
const list<SMESHGUI_aParameterPtr> & paramList )
|
const list<SMESHGUI_aParameterPtr> & paramList )
|
||||||
{
|
{
|
||||||
@ -474,6 +519,104 @@ bool StdMeshersGUI_Parameters::SetParameters(SMESH::SMESH_Hypothesis_ptr
|
|||||||
modified = paramList.front()->GetNewDouble( value );
|
modified = paramList.front()->GetNewDouble( value );
|
||||||
hyp->SetDeflection( 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 ;
|
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 );
|
||||||
|
}
|
||||||
|
@ -47,7 +47,7 @@ class StdMeshersGUI_Parameters
|
|||||||
static void GetParameters (SMESH::SMESH_Hypothesis_ptr hyp,
|
static void GetParameters (SMESH::SMESH_Hypothesis_ptr hyp,
|
||||||
std::list<SMESHGUI_aParameterPtr> & params );
|
std::list<SMESHGUI_aParameterPtr> & params );
|
||||||
static void GetParameters (SMESH::SMESH_Hypothesis_ptr hyp,
|
static void GetParameters (SMESH::SMESH_Hypothesis_ptr hyp,
|
||||||
std::list<SMESHGUI_aParameterPtr> & paramList,
|
const std::list<SMESHGUI_aParameterPtr> & paramList,
|
||||||
QString& params);
|
QString& params);
|
||||||
|
|
||||||
static bool SetParameters(SMESH::SMESH_Hypothesis_ptr hyp,
|
static bool SetParameters(SMESH::SMESH_Hypothesis_ptr hyp,
|
||||||
@ -62,4 +62,26 @@ class StdMeshersGUI_Parameters
|
|||||||
static void SetInitValue(SMESHGUI_aParameterPtr param,
|
static void SetInitValue(SMESHGUI_aParameterPtr param,
|
||||||
SMESH::double_array& initValue);
|
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
|
#endif
|
||||||
|
@ -15,9 +15,9 @@ msgid "ICON_SELECT"
|
|||||||
msgstr "select1.png"
|
msgstr "select1.png"
|
||||||
|
|
||||||
|
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
# Hypothesis
|
# Hypothesis creation, see StdMeshersGUI_CreateStdHypothesisDlg()
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
|
|
||||||
#Hypo Local Length
|
#Hypo Local Length
|
||||||
msgid "ICON_DLG_LOCAL_LENGTH"
|
msgid "ICON_DLG_LOCAL_LENGTH"
|
||||||
@ -52,7 +52,7 @@ msgid "ICON_DLG_ARITHMETIC_1D"
|
|||||||
msgstr "mesh_hypo_length.png"
|
msgstr "mesh_hypo_length.png"
|
||||||
|
|
||||||
#Hypo AutomaticLength
|
#Hypo AutomaticLength
|
||||||
msgid "ICON_DLG_AUTOMATICLENGTH"
|
msgid "ICON_DLG_AUTOMATIC_LENGTH"
|
||||||
msgstr "mesh_hypo_length.png"
|
msgstr "mesh_hypo_length.png"
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,3 +117,15 @@ msgstr "Arithmetic Reason"
|
|||||||
|
|
||||||
msgid "SMESH_ARITHMETIC_1D_TITLE"
|
msgid "SMESH_ARITHMETIC_1D_TITLE"
|
||||||
msgstr "Hypothesis Construction"
|
msgstr "Hypothesis Construction"
|
||||||
|
|
||||||
|
|
||||||
|
# -------------- AUTOMATIC_LENGTH --------------
|
||||||
|
|
||||||
|
msgid "SMESH_AUTOMATIC_LENGTH_HYPOTHESIS"
|
||||||
|
msgstr "Automatic Length"
|
||||||
|
|
||||||
|
msgid "SMESH_FINENESS_PARAM"
|
||||||
|
msgstr "Fineness"
|
||||||
|
|
||||||
|
msgid "SMESH_AUTOMATIC_LENGTH_TITLE"
|
||||||
|
msgstr "Hypothesis Construction"
|
||||||
|
@ -30,6 +30,7 @@ using namespace std;
|
|||||||
#include "StdMeshers_AutomaticLength_i.hxx"
|
#include "StdMeshers_AutomaticLength_i.hxx"
|
||||||
#include "SMESH_Gen_i.hxx"
|
#include "SMESH_Gen_i.hxx"
|
||||||
#include "SMESH_Gen.hxx"
|
#include "SMESH_Gen.hxx"
|
||||||
|
#include "SMESH_PythonDump.hxx"
|
||||||
|
|
||||||
#include "Utils_CorbaException.hxx"
|
#include "Utils_CorbaException.hxx"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
@ -71,47 +72,40 @@ StdMeshers_AutomaticLength_i::~StdMeshers_AutomaticLength_i()
|
|||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* StdMeshers_AutomaticLength_i::SetLength
|
* StdMeshers_AutomaticLength_i::SetFineness
|
||||||
*
|
*
|
||||||
* Set length
|
* Set Fineness
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
// void StdMeshers_AutomaticLength_i::SetLength( CORBA::Double theLength )
|
void StdMeshers_AutomaticLength_i::SetFineness( CORBA::Double theFineness )
|
||||||
// throw ( SALOME::SALOME_Exception )
|
throw ( SALOME::SALOME_Exception )
|
||||||
// {
|
{
|
||||||
// MESSAGE( "StdMeshers_AutomaticLength_i::SetLength" );
|
ASSERT( myBaseImpl );
|
||||||
// ASSERT( myBaseImpl );
|
try {
|
||||||
// try {
|
this->GetImpl()->SetFineness( theFineness );
|
||||||
// this->GetImpl()->SetLength( theLength );
|
}
|
||||||
// }
|
catch ( SALOME_Exception& S_ex ) {
|
||||||
// catch ( SALOME_Exception& S_ex ) {
|
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
||||||
// THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
SALOME::BAD_PARAM );
|
||||||
// SALOME::BAD_PARAM );
|
}
|
||||||
// }
|
// Update Python script
|
||||||
|
SMESH::TPythonDump() << _this() << ".SetFineness( " << theFineness << " )";
|
||||||
// // Update Python script
|
}
|
||||||
// TCollection_AsciiString aStr, aStrLen ((double)theLength);
|
|
||||||
// SMESH_Gen_i::AddObject(aStr, _this()) += ".SetLength(";
|
|
||||||
// aStr += aStrLen + ")";
|
|
||||||
|
|
||||||
// SMESH_Gen_i::AddToCurrentPyScript(aStr);
|
|
||||||
// }
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* StdMeshers_AutomaticLength_i::GetLength
|
* StdMeshers_AutomaticLength_i::GetFineness
|
||||||
*
|
*
|
||||||
* Get length
|
* Get Fineness
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
// CORBA::Double StdMeshers_AutomaticLength_i::GetLength()
|
CORBA::Double StdMeshers_AutomaticLength_i::GetFineness()
|
||||||
// {
|
{
|
||||||
// MESSAGE( "StdMeshers_AutomaticLength_i::GetLength" );
|
ASSERT( myBaseImpl );
|
||||||
// ASSERT( myBaseImpl );
|
return this->GetImpl()->GetFineness();
|
||||||
// return this->GetImpl()->GetLength();
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
@ -123,7 +117,6 @@ StdMeshers_AutomaticLength_i::~StdMeshers_AutomaticLength_i()
|
|||||||
|
|
||||||
::StdMeshers_AutomaticLength* StdMeshers_AutomaticLength_i::GetImpl()
|
::StdMeshers_AutomaticLength* StdMeshers_AutomaticLength_i::GetImpl()
|
||||||
{
|
{
|
||||||
MESSAGE( "StdMeshers_AutomaticLength_i::GetImpl" );
|
|
||||||
return ( ::StdMeshers_AutomaticLength* )myBaseImpl;
|
return ( ::StdMeshers_AutomaticLength* )myBaseImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,9 +37,10 @@
|
|||||||
|
|
||||||
class SMESH_Gen;
|
class SMESH_Gen;
|
||||||
|
|
||||||
// ======================================================
|
// =========================================================
|
||||||
// Local Length hypothesis
|
// 1D Hypothesis to compute segment length free of thinking
|
||||||
// ======================================================
|
// =========================================================
|
||||||
|
|
||||||
class StdMeshers_AutomaticLength_i:
|
class StdMeshers_AutomaticLength_i:
|
||||||
public virtual POA_StdMeshers::StdMeshers_AutomaticLength,
|
public virtual POA_StdMeshers::StdMeshers_AutomaticLength,
|
||||||
public virtual SMESH_Hypothesis_i
|
public virtual SMESH_Hypothesis_i
|
||||||
@ -52,11 +53,12 @@ public:
|
|||||||
// Destructor
|
// Destructor
|
||||||
virtual ~StdMeshers_AutomaticLength_i();
|
virtual ~StdMeshers_AutomaticLength_i();
|
||||||
|
|
||||||
// // Set length
|
// Set Fineness
|
||||||
// void SetLength( CORBA::Double theLength )
|
void SetFineness( CORBA::Double theFineness )
|
||||||
// throw ( SALOME::SALOME_Exception );
|
throw ( SALOME::SALOME_Exception );
|
||||||
// // Get length
|
|
||||||
// CORBA::Double GetLength();
|
// Get Fineness
|
||||||
|
CORBA::Double GetFineness();
|
||||||
|
|
||||||
// Get implementation
|
// Get implementation
|
||||||
::StdMeshers_AutomaticLength* GetImpl();
|
::StdMeshers_AutomaticLength* GetImpl();
|
||||||
|
Loading…
Reference in New Issue
Block a user