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