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" &&
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() )
aStates->IncrementState();
}
}
+
// Case for LayerDistribution hypothesis (not finished yet)
else if(aStates->GetObjectType() == "LayerDistribution") {
if(aMethod == "SetLayerDistribution"){
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();
//================================================================================
void SMESH_NoteBook::AddCommand(const TCollection_AsciiString& theString)
{
+ if(MYDEBUG)
+ cout<<theString<<endl;
Handle(_pyCommand) aCommand = new _pyCommand( theString, -1);
_commands.push_back(aCommand);
#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)
#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)
#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):
#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)
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):
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)
#include "StdMeshersGUI_DistrTable.h"
#include "StdMeshersGUI_DistrPreview.h"
+#include <SMESHGUI.h>
#include <SMESHGUI_Utils.h>
#include <SMESHGUI_HypothesesUtils.h>
#include <SMESHGUI_SpinBox.h>
// SALOME GUI includes
#include <SalomeApp_Tools.h>
-#include <QtxIntSpinBox.h>
+#include <SalomeApp_IntSpinBox.h>
#include <QtxComboBox.h>
// Qt includes
{
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;
}
// 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 );
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 );
NbSegmentsHypothesisData data;
readParamsFromWidgets( data );
storeParamsToHypo( data );
-
+
QString valStr = QString::number( data.myNbSeg ) += "; ";
enum DistrType
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");
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();
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 );
//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)
{
{
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();
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
-class QtxIntSpinBox;
+class SalomeApp_IntSpinBox;
class QtxComboBox;
class SMESHGUI_SpinBox;
class StdMeshersGUI_DistrTableFrame;
double myScale;
SMESH::double_array myTable;
QString myName, myExpr;
+ QString myNbSegVarName, myScaleVarName;
} NbSegmentsHypothesisData;
bool storeParamsToHypo( const NbSegmentsHypothesisData& ) const;
private:
- QtxIntSpinBox* myNbSeg;
+ SalomeApp_IntSpinBox* myNbSeg;
QtxComboBox* myDistr;
SMESHGUI_SpinBox* myScale;
StdMeshersGUI_DistrTableFrame* myTable;
{
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" )
StdMeshers::StdMeshers_NumberOfLayers::_narrow( hypothesis() );
h->SetNumberOfLayers( params[0].myValue.toInt() );
+ h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
}
else if( hypType()=="LayerDistribution" )
{
SMESH::SMESH_Hypothesis_var hyp = initParamsHypothesis();
SMESH::ListOfParameters_var aParameters = hyp->GetLastParameters();
- QString aVaribaleName;
if( hypType()=="LocalLength" )
{
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 );
}
{
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
+ item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
+ if(!initVariableName(aParameters,item,0))
item.myValue = h->GetLength();
+
p.append( item );
}
else if( hypType()=="Arithmetic1D" )
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 );
}
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" )
{
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" )
{
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 );
}
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" )
//================================================================================
/*!
- * \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;
}
-*/
// SMESH includes
#include "SMESH_StdMeshersGUI.hxx"
-
#include <SMESHGUI_Hypotheses.h>
+
/*!
* \brief Class for creation of standard hypotheses
*/
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 {