mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-28 21:40:33 +05:00
Implementation notebook in the SMESH module.
This commit is contained in:
parent
d3b48c6524
commit
472ffc5908
@ -267,7 +267,8 @@ void SMESH_NoteBook::ReplaceVariables()
|
||||
aStates->IncrementState();
|
||||
}
|
||||
}
|
||||
// Case for Arithmetic1D or StartEndLength hypothesis
|
||||
|
||||
// Case for Arithmetic1D and StartEndLength hypothesis
|
||||
else if(aStates->GetObjectType().IsEqual("Arithmetic1D") ||
|
||||
aStates->GetObjectType().IsEqual("StartEndLength")) {
|
||||
if(aMethod == "SetLength" &&
|
||||
@ -279,6 +280,8 @@ void SMESH_NoteBook::ReplaceVariables()
|
||||
aStates->IncrementState();
|
||||
}
|
||||
}
|
||||
|
||||
//Case for Deflection1D hypothesis
|
||||
else if(aStates->GetObjectType().IsEqual("Deflection1D")){
|
||||
if(aMethod == "SetDeflection" && aStates->GetCurrectState().size() >= 1) {
|
||||
if(!aStates->GetCurrectState().at(0).IsEmpty() )
|
||||
@ -286,6 +289,7 @@ void SMESH_NoteBook::ReplaceVariables()
|
||||
aStates->IncrementState();
|
||||
}
|
||||
}
|
||||
|
||||
// Case for LayerDistribution hypothesis (not finished yet)
|
||||
else if(aStates->GetObjectType() == "LayerDistribution") {
|
||||
if(aMethod == "SetLayerDistribution"){
|
||||
@ -293,7 +297,40 @@ void SMESH_NoteBook::ReplaceVariables()
|
||||
aLDStates->AddDistribution(aCmd->GetArg(1));
|
||||
}
|
||||
}
|
||||
|
||||
// Case for MaxElementArea hypothesis
|
||||
else if(aStates->GetObjectType().IsEqual("MaxElementArea")){
|
||||
if(aMethod == "SetMaxElementArea" && aStates->GetCurrectState().size() >= 1) {
|
||||
if(!aStates->GetCurrectState().at(0).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(0));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
}
|
||||
|
||||
// Case for NumberOfLayers hypothesis
|
||||
else if(aStates->GetObjectType().IsEqual("NumberOfLayers")){
|
||||
if(aMethod == "SetNumberOfLayers" && aStates->GetCurrectState().size() >= 1) {
|
||||
if(!aStates->GetCurrectState().at(0).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(0));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
}
|
||||
|
||||
// Case for NumberOfSegments hypothesis
|
||||
else if(aStates->GetObjectType().IsEqual("NumberOfSegments")){
|
||||
if(aMethod == "SetNumberOfSegments" && aStates->GetCurrectState().size() >= 1) {
|
||||
if(!aStates->GetCurrectState().at(0).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(0));
|
||||
if(aStates->GetCurrectState().size()==1)
|
||||
aStates->IncrementState();
|
||||
}
|
||||
else if (aMethod == "SetScaleFactor" && aStates->GetCurrectState().size() >= 2) {
|
||||
if(!aStates->GetCurrectState().at(1).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(1));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
}
|
||||
|
||||
else if(aStates->GetObjectType().IsEqual("Mesh")) {
|
||||
TState aCurrentState = aStates->GetCurrectState();
|
||||
int aCurrentStateSize = aCurrentState.size();
|
||||
@ -494,6 +531,8 @@ void SMESH_NoteBook::InitObjectMap()
|
||||
//================================================================================
|
||||
void SMESH_NoteBook::AddCommand(const TCollection_AsciiString& theString)
|
||||
{
|
||||
if(MYDEBUG)
|
||||
cout<<theString<<endl;
|
||||
Handle(_pyCommand) aCommand = new _pyCommand( theString, -1);
|
||||
_commands.push_back(aCommand);
|
||||
|
||||
|
@ -4243,14 +4243,14 @@ def ParseParameters(last, nbParams,nbParam, value):
|
||||
#Wrapper class for StdMeshers_LocalLength hypothesis
|
||||
class LocalLength(StdMeshers._objref_StdMeshers_LocalLength):
|
||||
|
||||
## Set length parameter value
|
||||
## Set Length parameter value
|
||||
# @param length numerical value or name of variable from notebook
|
||||
def SetLength(self, length):
|
||||
length,parameters = ParseParameters(StdMeshers._objref_StdMeshers_LocalLength.GetLastParameters(self),2,1,length)
|
||||
StdMeshers._objref_StdMeshers_LocalLength.SetParameters(self,parameters)
|
||||
StdMeshers._objref_StdMeshers_LocalLength.SetLength(self,length)
|
||||
|
||||
## Set precision parameter value
|
||||
## Set Precision parameter value
|
||||
# @param precision numerical value or name of variable from notebook
|
||||
def SetPrecision(self, precision):
|
||||
precision,parameters = ParseParameters(StdMeshers._objref_StdMeshers_LocalLength.GetLastParameters(self),2,2,precision)
|
||||
@ -4264,7 +4264,7 @@ omniORB.registerObjref(StdMeshers._objref_StdMeshers_LocalLength._NP_RepositoryI
|
||||
#Wrapper class for StdMeshers_SegmentLengthAroundVertex hypothesis
|
||||
class SegmentLengthAroundVertex(StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex):
|
||||
|
||||
## Set length parameter value
|
||||
## Set Length parameter value
|
||||
# @param length numerical value or name of variable from notebook
|
||||
def SetLength(self, length):
|
||||
length,parameters = ParseParameters(StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex.GetLastParameters(self),1,1,length)
|
||||
@ -4278,7 +4278,7 @@ omniORB.registerObjref(StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex._
|
||||
#Wrapper class for StdMeshers_Arithmetic1D hypothesis
|
||||
class Arithmetic1D(StdMeshers._objref_StdMeshers_Arithmetic1D):
|
||||
|
||||
## Set length parameter value
|
||||
## Set Length parameter value
|
||||
# @param length numerical value or name of variable from notebook
|
||||
# @param isStart true is length is Start Length, otherwise false
|
||||
def SetLength(self, length, isStart):
|
||||
@ -4295,7 +4295,7 @@ omniORB.registerObjref(StdMeshers._objref_StdMeshers_Arithmetic1D._NP_Repository
|
||||
#Wrapper class for StdMeshers_Deflection1D hypothesis
|
||||
class Deflection1D(StdMeshers._objref_StdMeshers_Deflection1D):
|
||||
|
||||
## Set deflection parameter value
|
||||
## Set Deflection parameter value
|
||||
# @param deflection numerical value or name of variable from notebook
|
||||
def SetDeflection(self, deflection):
|
||||
deflection,parameters = ParseParameters(StdMeshers._objref_StdMeshers_Deflection1D.GetLastParameters(self),1,1,deflection)
|
||||
@ -4303,12 +4303,12 @@ class Deflection1D(StdMeshers._objref_StdMeshers_Deflection1D):
|
||||
StdMeshers._objref_StdMeshers_Deflection1D.SetDeflection(self,deflection)
|
||||
|
||||
#Registering the new proxy for Deflection1D
|
||||
omniORB.registerObjref(StdMeshers._objref_StdMeshers_StartEndLength._NP_RepositoryId, Deflection1D)
|
||||
omniORB.registerObjref(StdMeshers._objref_StdMeshers_Deflection1D._NP_RepositoryId, Deflection1D)
|
||||
|
||||
#Wrapper class for StdMeshers_StartEndLength hypothesis
|
||||
class StartEndLength(StdMeshers._objref_StdMeshers_StartEndLength):
|
||||
|
||||
## Set length parameter value
|
||||
## Set Length parameter value
|
||||
# @param length numerical value or name of variable from notebook
|
||||
# @param isStart true is length is Start Length, otherwise false
|
||||
def SetLength(self, length, isStart):
|
||||
@ -4319,5 +4319,52 @@ class StartEndLength(StdMeshers._objref_StdMeshers_StartEndLength):
|
||||
StdMeshers._objref_StdMeshers_StartEndLength.SetParameters(self,parameters)
|
||||
StdMeshers._objref_StdMeshers_StartEndLength.SetLength(self,length,isStart)
|
||||
|
||||
#Registering the new proxy for Arithmetic1D
|
||||
#Registering the new proxy for StartEndLength
|
||||
omniORB.registerObjref(StdMeshers._objref_StdMeshers_StartEndLength._NP_RepositoryId, StartEndLength)
|
||||
|
||||
#Wrapper class for StdMeshers_MaxElementArea hypothesis
|
||||
class MaxElementArea(StdMeshers._objref_StdMeshers_MaxElementArea):
|
||||
|
||||
## Set Max Element Area parameter value
|
||||
# @param area numerical value or name of variable from notebook
|
||||
def SetMaxElementArea(self, area):
|
||||
area ,parameters = ParseParameters(StdMeshers._objref_StdMeshers_MaxElementArea.GetLastParameters(self),1,1,area)
|
||||
StdMeshers._objref_StdMeshers_MaxElementArea.SetParameters(self,parameters)
|
||||
StdMeshers._objref_StdMeshers_MaxElementArea.SetMaxElementArea(self,area)
|
||||
|
||||
#Registering the new proxy for MaxElementArea
|
||||
omniORB.registerObjref(StdMeshers._objref_StdMeshers_MaxElementArea._NP_RepositoryId, MaxElementArea)
|
||||
|
||||
#Wrapper class for StdMeshers_NumberOfLayers hypothesis
|
||||
class NumberOfLayers(StdMeshers._objref_StdMeshers_NumberOfLayers):
|
||||
|
||||
## Set Number Of Layers parameter value
|
||||
# @param nbLayers numerical value or name of variable from notebook
|
||||
def SetNumberOfLayers(self, nbLayers):
|
||||
nbLayers ,parameters = ParseParameters(StdMeshers._objref_StdMeshers_NumberOfLayers.GetLastParameters(self),1,1,nbLayers)
|
||||
StdMeshers._objref_StdMeshers_NumberOfLayers.SetParameters(self,parameters)
|
||||
StdMeshers._objref_StdMeshers_NumberOfLayers.SetNumberOfLayers(self,nbLayers)
|
||||
|
||||
#Registering the new proxy for NumberOfLayers
|
||||
omniORB.registerObjref(StdMeshers._objref_StdMeshers_NumberOfLayers._NP_RepositoryId, NumberOfLayers)
|
||||
|
||||
#Wrapper class for StdMeshers_NumberOfSegments hypothesis
|
||||
class NumberOfSegments(StdMeshers._objref_StdMeshers_NumberOfSegments):
|
||||
|
||||
## Set Number Of Segments parameter value
|
||||
# @param nbSeg numerical value or name of variable from notebook
|
||||
def SetNumberOfSegments(self, nbSeg):
|
||||
lastParameters = StdMeshers._objref_StdMeshers_NumberOfSegments.GetLastParameters(self)
|
||||
nbSeg , parameters = ParseParameters(lastParameters,1,1,nbSeg)
|
||||
StdMeshers._objref_StdMeshers_NumberOfSegments.SetParameters(self,parameters)
|
||||
StdMeshers._objref_StdMeshers_NumberOfSegments.SetNumberOfSegments(self,nbSeg)
|
||||
|
||||
## Set Scale Factor parameter value
|
||||
# @param factor numerical value or name of variable from notebook
|
||||
def SetScaleFactor(self, factor):
|
||||
factor, parameters = ParseParameters(StdMeshers._objref_StdMeshers_NumberOfSegments.GetLastParameters(self),2,2,factor)
|
||||
StdMeshers._objref_StdMeshers_NumberOfSegments.SetParameters(self,parameters)
|
||||
StdMeshers._objref_StdMeshers_NumberOfSegments.SetScaleFactor(self,factor)
|
||||
|
||||
#Registering the new proxy for NumberOfSegments
|
||||
omniORB.registerObjref(StdMeshers._objref_StdMeshers_NumberOfSegments._NP_RepositoryId, NumberOfSegments)
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "StdMeshersGUI_DistrTable.h"
|
||||
#include "StdMeshersGUI_DistrPreview.h"
|
||||
|
||||
#include <SMESHGUI.h>
|
||||
#include <SMESHGUI_Utils.h>
|
||||
#include <SMESHGUI_HypothesesUtils.h>
|
||||
#include <SMESHGUI_SpinBox.h>
|
||||
@ -35,7 +36,7 @@
|
||||
|
||||
// SALOME GUI includes
|
||||
#include <SalomeApp_Tools.h>
|
||||
#include <QtxIntSpinBox.h>
|
||||
#include <SalomeApp_IntSpinBox.h>
|
||||
#include <QtxComboBox.h>
|
||||
|
||||
// Qt includes
|
||||
@ -81,12 +82,13 @@ bool StdMeshersGUI_NbSegmentsCreator::checkParams( QString& msg ) const
|
||||
{
|
||||
if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg ) )
|
||||
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;
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -124,7 +126,7 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame()
|
||||
|
||||
// 1) number of segments
|
||||
myGroupLayout->addWidget( new QLabel( tr( "SMESH_NB_SEGMENTS_PARAM" ), GroupC1 ), row, 0 );
|
||||
myNbSeg = new QtxIntSpinBox( GroupC1 );
|
||||
myNbSeg = new SalomeApp_IntSpinBox( GroupC1 );
|
||||
myNbSeg->setMinimum( 1 );
|
||||
myNbSeg->setMaximum( 9999 );
|
||||
myGroupLayout->addWidget( myNbSeg, row, 1 );
|
||||
@ -208,9 +210,16 @@ void StdMeshersGUI_NbSegmentsCreator::retrieveParams() const
|
||||
|
||||
if( myName )
|
||||
myName->setText( data.myName );
|
||||
myNbSeg->setValue( data.myNbSeg );
|
||||
if(data.myNbSegVarName.isEmpty())
|
||||
myNbSeg->setValue( data.myNbSeg );
|
||||
else
|
||||
myNbSeg->setText( data.myNbSegVarName );
|
||||
|
||||
myDistr->setCurrentIndex( data.myDistrType );
|
||||
myScale->setValue( data.myScale );
|
||||
if(data.myScaleVarName.isEmpty())
|
||||
myScale->setValue( data.myScale );
|
||||
else
|
||||
myScale->setText( data.myScaleVarName );
|
||||
myConv->button( data.myConv )->setChecked( true );
|
||||
myTable->setFuncMinValue(myConv->checkedId()==0 ? -1E20 : 0);
|
||||
myTable->setData( data.myTable );
|
||||
@ -225,7 +234,7 @@ QString StdMeshersGUI_NbSegmentsCreator::storeParams() const
|
||||
NbSegmentsHypothesisData data;
|
||||
readParamsFromWidgets( data );
|
||||
storeParamsToHypo( data );
|
||||
|
||||
|
||||
QString valStr = QString::number( data.myNbSeg ) += "; ";
|
||||
|
||||
enum DistrType
|
||||
@ -240,8 +249,8 @@ QString StdMeshersGUI_NbSegmentsCreator::storeParams() const
|
||||
case Regular :
|
||||
valStr += tr("SMESH_DISTR_REGULAR");
|
||||
break;
|
||||
case Scale :
|
||||
valStr += tr("SMESH_NB_SEGMENTS_SCALE_PARAM") + " = " + QString::number( data.myScale );
|
||||
case Scale :
|
||||
valStr += tr("SMESH_NB_SEGMENTS_SCALE_PARAM") + " = " + QString::number( data.myScale );\
|
||||
break;
|
||||
case TabFunc : {
|
||||
//valStr += tr("SMESH_TAB_FUNC");
|
||||
@ -277,9 +286,21 @@ bool StdMeshersGUI_NbSegmentsCreator::readParamsFromHypo( NbSegmentsHypothesisDa
|
||||
h_data.myName = hypName();
|
||||
|
||||
h_data.myNbSeg = (int) h->GetNumberOfSegments();
|
||||
|
||||
SMESH::ListOfParameters_var aParameters = h->GetLastParameters();
|
||||
|
||||
h_data.myNbSegVarName = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
|
||||
|
||||
int distr = (int) h->GetDistrType();
|
||||
h_data.myDistrType = distr;
|
||||
h_data.myScale = distr==1 ? h->GetScaleFactor() : 1.0;
|
||||
|
||||
if(distr==1){
|
||||
h_data.myScaleVarName = (aParameters->length() > 1) ? QString(aParameters[1].in()) : QString("");
|
||||
}
|
||||
else
|
||||
h_data.myScaleVarName = QString("");
|
||||
|
||||
if( distr==2 )
|
||||
{
|
||||
SMESH::double_array* a = h->GetTableFunction();
|
||||
@ -312,13 +333,17 @@ bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo( const NbSegmentsHypothe
|
||||
if( isCreation() )
|
||||
SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().data() );
|
||||
|
||||
QStringList aVariablesList;
|
||||
aVariablesList.append(h_data.myNbSegVarName);
|
||||
|
||||
h->SetNumberOfSegments( h_data.myNbSeg );
|
||||
int distr = h_data.myDistrType;
|
||||
h->SetDistrType( distr );
|
||||
|
||||
if( distr==1 )
|
||||
|
||||
if( distr==1 ) {
|
||||
h->SetScaleFactor( h_data.myScale );
|
||||
|
||||
aVariablesList.append(h_data.myScaleVarName);
|
||||
}
|
||||
if( distr==2 || distr==3 )
|
||||
h->SetConversionMode( h_data.myConv );
|
||||
|
||||
@ -330,6 +355,8 @@ bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo( const NbSegmentsHypothe
|
||||
//setting of function must follow after setConversionMode, because otherwise
|
||||
//the function will be checked with old conversion mode, so that it may occurs
|
||||
//unexpected errors for user
|
||||
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& ex)
|
||||
{
|
||||
@ -343,6 +370,8 @@ bool StdMeshersGUI_NbSegmentsCreator::readParamsFromWidgets( NbSegmentsHypothesi
|
||||
{
|
||||
h_data.myName = myName ? myName->text() : "";
|
||||
h_data.myNbSeg = myNbSeg->value();
|
||||
h_data.myNbSegVarName = myNbSeg->text();
|
||||
h_data.myScaleVarName = myScale->text();
|
||||
h_data.myDistrType = myDistr->currentIndex();
|
||||
h_data.myConv = myConv->checkedId();
|
||||
h_data.myScale = myScale->value();
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
|
||||
class QtxIntSpinBox;
|
||||
class SalomeApp_IntSpinBox;
|
||||
class QtxComboBox;
|
||||
class SMESHGUI_SpinBox;
|
||||
class StdMeshersGUI_DistrTableFrame;
|
||||
@ -50,6 +50,7 @@ typedef struct
|
||||
double myScale;
|
||||
SMESH::double_array myTable;
|
||||
QString myName, myExpr;
|
||||
QString myNbSegVarName, myScaleVarName;
|
||||
|
||||
} NbSegmentsHypothesisData;
|
||||
|
||||
@ -77,7 +78,7 @@ private:
|
||||
bool storeParamsToHypo( const NbSegmentsHypothesisData& ) const;
|
||||
|
||||
private:
|
||||
QtxIntSpinBox* myNbSeg;
|
||||
SalomeApp_IntSpinBox* myNbSeg;
|
||||
QtxComboBox* myDistr;
|
||||
SMESHGUI_SpinBox* myScale;
|
||||
StdMeshersGUI_DistrTableFrame* myTable;
|
||||
|
@ -437,7 +437,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
||||
{
|
||||
StdMeshers::StdMeshers_MaxElementArea_var h =
|
||||
StdMeshers::StdMeshers_MaxElementArea::_narrow( hypothesis() );
|
||||
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
h->SetMaxElementArea( params[0].myValue.toDouble() );
|
||||
}
|
||||
else if( hypType()=="MaxElementVolume" )
|
||||
@ -477,6 +477,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
||||
StdMeshers::StdMeshers_NumberOfLayers::_narrow( hypothesis() );
|
||||
|
||||
h->SetNumberOfLayers( params[0].myValue.toInt() );
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
}
|
||||
else if( hypType()=="LayerDistribution" )
|
||||
{
|
||||
@ -562,7 +563,6 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
|
||||
SMESH::SMESH_Hypothesis_var hyp = initParamsHypothesis();
|
||||
SMESH::ListOfParameters_var aParameters = hyp->GetLastParameters();
|
||||
QString aVaribaleName;
|
||||
|
||||
if( hypType()=="LocalLength" )
|
||||
{
|
||||
@ -570,22 +570,13 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
StdMeshers::StdMeshers_LocalLength::_narrow( hyp );
|
||||
|
||||
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
|
||||
|
||||
aVaribaleName = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
|
||||
item.isVariable = !aVaribaleName.isEmpty();
|
||||
if(item.isVariable)
|
||||
item.myValue = aVaribaleName;
|
||||
else
|
||||
if(!initVariableName(aParameters,item,0))
|
||||
item.myValue = h->GetLength();
|
||||
p.append( item );
|
||||
|
||||
p.append( item );
|
||||
|
||||
item.myName = tr("SMESH_LOCAL_LENGTH_PRECISION");
|
||||
aVaribaleName = (aParameters->length() > 1) ? QString(aParameters[1].in()) : QString("");
|
||||
item.isVariable = !aVaribaleName.isEmpty();
|
||||
if(item.isVariable)
|
||||
item.myValue = aVaribaleName;
|
||||
else
|
||||
item.myValue = h->GetPrecision();
|
||||
if(!initVariableName(aParameters,item,1))
|
||||
item.myValue = h->GetPrecision();
|
||||
p.append( item );
|
||||
|
||||
}
|
||||
@ -593,15 +584,11 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
{
|
||||
StdMeshers::StdMeshers_SegmentLengthAroundVertex_var h =
|
||||
StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hyp );
|
||||
|
||||
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
|
||||
|
||||
aVaribaleName = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
|
||||
item.isVariable = !aVaribaleName.isEmpty();
|
||||
|
||||
if(item.isVariable)
|
||||
item.myValue = aVaribaleName;
|
||||
else
|
||||
if(!initVariableName(aParameters,item,0))
|
||||
item.myValue = h->GetLength();
|
||||
|
||||
p.append( item );
|
||||
}
|
||||
else if( hypType()=="Arithmetic1D" )
|
||||
@ -609,24 +596,13 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
StdMeshers::StdMeshers_Arithmetic1D_var h =
|
||||
StdMeshers::StdMeshers_Arithmetic1D::_narrow( hyp );
|
||||
|
||||
aVaribaleName = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
|
||||
|
||||
item.isVariable = !aVaribaleName.isEmpty();
|
||||
|
||||
item.myName = tr( "SMESH_START_LENGTH_PARAM" );
|
||||
if(item.isVariable)
|
||||
item.myValue = aVaribaleName;
|
||||
else
|
||||
if(!initVariableName(aParameters,item,0))
|
||||
item.myValue = h->GetLength( true );
|
||||
p.append( item );
|
||||
|
||||
aVaribaleName = (aParameters->length() > 1) ? QString(aParameters[1].in()) : QString("");
|
||||
|
||||
item.myName = tr( "SMESH_END_LENGTH_PARAM" );
|
||||
|
||||
if(item.isVariable)
|
||||
item.myValue = aVaribaleName;
|
||||
else
|
||||
if(!initVariableName(aParameters,item,1))
|
||||
item.myValue = h->GetLength( false );
|
||||
p.append( item );
|
||||
}
|
||||
@ -636,8 +612,10 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
StdMeshers::StdMeshers_MaxElementArea::_narrow( hyp );
|
||||
|
||||
item.myName = tr( "SMESH_MAX_ELEMENT_AREA_PARAM" );
|
||||
item.myValue = h->GetMaxElementArea();
|
||||
if(!initVariableName(aParameters,item,0))
|
||||
item.myValue = h->GetMaxElementArea();
|
||||
p.append( item );
|
||||
|
||||
}
|
||||
else if( hypType()=="MaxElementVolume" )
|
||||
{
|
||||
@ -655,23 +633,15 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
|
||||
item.myName = tr( "SMESH_START_LENGTH_PARAM" );
|
||||
|
||||
aVaribaleName = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
|
||||
item.isVariable = !aVaribaleName.isEmpty();
|
||||
if(item.isVariable)
|
||||
item.myValue = aVaribaleName;
|
||||
else
|
||||
if(!initVariableName(aParameters,item,0))
|
||||
item.myValue = h->GetLength( true );
|
||||
p.append( item );
|
||||
|
||||
item.myName = tr( "SMESH_END_LENGTH_PARAM" );
|
||||
aVaribaleName = (aParameters->length() > 1) ? QString(aParameters[1].in()) : QString("");
|
||||
item.isVariable = !aVaribaleName.isEmpty();
|
||||
if(item.isVariable)
|
||||
item.myValue = aVaribaleName;
|
||||
else
|
||||
item.myValue = h->GetLength( false );
|
||||
|
||||
if(!initVariableName(aParameters,item,1))
|
||||
item.myValue = h->GetLength( false );
|
||||
p.append( item );
|
||||
|
||||
}
|
||||
else if( hypType()=="Deflection1D" )
|
||||
{
|
||||
@ -679,11 +649,7 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
StdMeshers::StdMeshers_Deflection1D::_narrow( hyp );
|
||||
|
||||
item.myName = tr( "SMESH_DEFLECTION1D_PARAM" );
|
||||
aVaribaleName = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
|
||||
item.isVariable = !aVaribaleName.isEmpty();
|
||||
if(item.isVariable)
|
||||
item.myValue = aVaribaleName;
|
||||
else
|
||||
if(!initVariableName(aParameters,item,0))
|
||||
item.myValue = h->GetDeflection();
|
||||
p.append( item );
|
||||
}
|
||||
@ -704,7 +670,8 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
StdMeshers::StdMeshers_NumberOfLayers::_narrow( hyp );
|
||||
|
||||
item.myName = tr( "SMESH_NUMBER_OF_LAYERS" );
|
||||
item.myValue = (int) h->GetNumberOfLayers();
|
||||
if(!initVariableName(aParameters,item,0))
|
||||
item.myValue = (int) h->GetNumberOfLayers();
|
||||
p.append( item );
|
||||
}
|
||||
else if( hypType()=="LayerDistribution" )
|
||||
@ -993,33 +960,18 @@ void StdMeshersGUI_StdHypothesisCreator::onReject()
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief
|
||||
*
|
||||
*/
|
||||
//================================================================================
|
||||
/*QVariant StdMeshersGUI_StdHypothesisCreator::
|
||||
parseParameter(const QStringList& theList, int theNbParam) const
|
||||
|
||||
bool StdMeshersGUI_StdHypothesisCreator::initVariableName(SMESH::ListOfParameters_var theParameters,
|
||||
StdParam &theParams,
|
||||
int order) const
|
||||
{
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
QVariant aResult;
|
||||
if(theList.size() > theNbParam) {
|
||||
QString aParameter = theList[theNbParam];
|
||||
if(QString::compare(QString(""),aParameter) !=0 ) {
|
||||
if(aStudy->IsVariable(aParameter.toLatin1().constData())) {
|
||||
aResult=aParameter;
|
||||
}
|
||||
else {
|
||||
bool aResult = false;
|
||||
int anIResult = aParameter.toInt(&aResult);
|
||||
if(aResult)
|
||||
aResult = anIResult;
|
||||
else {
|
||||
double aDResult = aParameter.toDouble(&aResult);
|
||||
if(aResult)
|
||||
aResult = aDResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return aResult;
|
||||
QString aVaribaleName = (theParameters->length() > order) ? QString(theParameters[order].in()) : QString("");
|
||||
theParams.isVariable = !aVaribaleName.isEmpty();
|
||||
if(theParams.isVariable)
|
||||
theParams.myValue = aVaribaleName;
|
||||
|
||||
return theParams.isVariable;
|
||||
}
|
||||
*/
|
||||
|
@ -26,9 +26,9 @@
|
||||
|
||||
// SMESH includes
|
||||
#include "SMESH_StdMeshersGUI.hxx"
|
||||
|
||||
#include <SMESHGUI_Hypotheses.h>
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Class for creation of standard hypotheses
|
||||
*/
|
||||
@ -58,7 +58,7 @@ protected:
|
||||
virtual QWidget* getWidgetForParam( int paramIndex ) const;
|
||||
virtual ListOfWidgets* customWidgets() const;
|
||||
virtual void onReject();
|
||||
// virtual QVariant parseParameter(const QStringList& theList, int theNbParam) const;
|
||||
virtual bool initVariableName(SMESH::ListOfParameters_var theParameters, StdParam& theParams, int order) const;
|
||||
|
||||
template<class T>
|
||||
T* widget(int i) const {
|
||||
|
Loading…
Reference in New Issue
Block a user