This commit is contained in:
ouv 2009-12-11 13:43:46 +00:00
parent e5ed5aa5ac
commit 333415e6c9
17 changed files with 137 additions and 61 deletions

View File

@ -1580,3 +1580,20 @@ SMESH_Group* SMESH_Mesh::ConvertToStandalone ( int theGroupID )
return aGroup;
}
//=======================================================================
//function : SetParameters
//purpose :
//=======================================================================
void SMESH_Mesh::SetParameters(const std::list<std::string>& theParameters)
{
_parameters = theParameters;
}
//=======================================================================
//function : GetParameters
//purpose :
//=======================================================================
std::list<std::string> SMESH_Mesh::GetParameters() const
{
return _parameters;
}

View File

@ -248,6 +248,9 @@ public:
SMDSAbs_ElementType GetElementType( const int id, const bool iselem );
void SetParameters(const std::list<std::string>& theParameters);
std::list<std::string> GetParameters() const;
//
ostream& Dump(ostream & save);
@ -274,6 +277,9 @@ protected:
TopTools_IndexedDataMapOfShapeListOfShape _mapAncestors;
private:
std::list<std::string> _parameters;
protected:
SMESH_Mesh() {};
SMESH_Mesh(const SMESH_Mesh&) {};

View File

@ -39,6 +39,7 @@
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Study.h>
#include <SalomeApp_Notebook.h>
#include <SUIT_OverrideCursor.h>
#include <LightApp_Application.h>
@ -293,8 +294,6 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
SMESH::SMESH_Mesh_var aCompoundMesh;
if (!myMesh->_is_nil()) {
QStringList aParameters;
aParameters << (CheckBoxMerge->isChecked() ? SpinBoxTol->text() : QString(" "));
try {
SUIT_OverrideCursor aWaitCursor;
@ -311,7 +310,8 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
CheckBoxMerge->isChecked(),
SpinBoxTol->GetValue());
//asl: aCompoundMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
if( CheckBoxMerge->isChecked() )
getNotebook()->setParameters( aCompoundMesh, 1, SpinBoxTol );
SMESH::SetName( SMESH::FindSObject( aCompoundMesh ), LineEditName->text() );
mySMESHGUI->updateObjBrowser();

View File

@ -54,6 +54,8 @@
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Notebook.h>
#include <SVTK_ViewWindow.h>
// OCCT includes
@ -621,8 +623,8 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
}
//asl: if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK )
//asl: myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK )
getNotebook()->setParameters( myMesh, aParameters );
//wc.stop();
wc.suspend();

View File

@ -53,6 +53,7 @@
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <SalomeApp_Notebook.h>
#include <SalomeApp_IntSpinBox.h>
// OCCT includes
@ -559,7 +560,7 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
}
//asl: myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
getNotebook()->setParameters( myMesh, aParameters );
} catch (...) {
}

View File

@ -46,6 +46,7 @@
#include <SALOME_ListIO.hxx>
#include <SUIT_Desktop.h>
#include <SVTK_ViewModel.h>
#include <SalomeApp_Notebook.h>
#include <SalomeApp_Tools.h>
#include <SalomeApp_TypeFilter.h>
#include <SUIT_ResourceMgr.h>
@ -410,11 +411,7 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
}
if (aResult)
{
QStringList aParameters;
aParameters << myDlg->myX->text();
aParameters << myDlg->myY->text();
aParameters << myDlg->myZ->text();
//asl: aMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
getNotebook()->setParameters( aMesh, 3, myDlg->myX, myDlg->myY, myDlg->myZ );
myDlg->myId->setText("");

View File

@ -49,6 +49,7 @@
#include <SUIT_MessageBox.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Notebook.h>
#include <SalomeApp_Tools.h>
#include <LightApp_Application.h>
#include <SalomeApp_IntSpinBox.h>
@ -475,7 +476,7 @@ bool SMESHGUI_MeshPatternDlg::onApply()
aParameters << myNode1->text();
if(myType == Type_3d )
aParameters << myNode2->text();
//asl: myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
getNotebook()->setParameters( myMesh, aParameters );
} else { // Applying a pattern to geometrical object
if (myType == Type_2d)

View File

@ -39,6 +39,7 @@
// SALOME GUI includes
#include <LightApp_SelectionMgr.h>
#include <LightApp_Application.h>
#include <SalomeApp_Notebook.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
@ -326,12 +327,7 @@ bool SMESHGUI_MoveNodesDlg::onApply()
bool aResult = false;
try {
aResult = aMeshEditor->MoveNode(anId, myX->GetValue(), myY->GetValue(), myZ->GetValue());
QStringList aParameters;
aParameters << myX->text();
aParameters << myY->text();
aParameters << myZ->text();
//asl: aMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
getNotebook()->setParameters( aMesh, 3, myX, myY, myZ );
} catch (...) {
}

View File

@ -46,6 +46,7 @@
#include <LightApp_SelectionMgr.h>
#include <LightApp_Application.h>
#include <SalomeApp_Notebook.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
@ -1184,9 +1185,7 @@ bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEdito
double aMaxAngle = myMaxAngleSpin->GetValue() * PI / 180.0;
bool ok = theEditor->TriToQuad(theIds, aCriterion, aMaxAngle);
if( ok ) {
QStringList aParameters;
aParameters << myMaxAngleSpin->text();
//asl: myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
getNotebook()->setParameters( myMesh, 1, myMaxAngleSpin );
}
return ok;
}

View File

@ -49,6 +49,8 @@
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Notebook.h>
#include <SVTK_ViewWindow.h>
#include <VTKViewer_Algorithm.h>
#include <VTKViewer_CellLocationsArray.h>
@ -88,14 +90,15 @@
namespace SMESH
{
void AddNode( SMESH::SMESH_Mesh_ptr theMesh, float x, float y, float z, const QStringList& theParameters )
void AddNode( SMESH::SMESH_Mesh_ptr theMesh, float x, float y, float z,
SalomeApp_Notebook* theNotebook, const QStringList& theParameters )
{
SUIT_OverrideCursor wc;
try {
_PTR(SObject) aSobj = SMESH::FindSObject( theMesh );
SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
aMeshEditor->AddNode( x, y, z );
//asl: theMesh->SetParameters( theParameters.join(":").toLatin1().constData() );
theNotebook->setParameters( theMesh, theParameters );
_PTR(Study) aStudy = GetActiveStudyDocument();
CORBA::Long anId = aStudy->StudyId();
if (TVisualObjPtr aVisualObj = SMESH::GetVisualObj( anId, aSobj->GetID().c_str() ) ) {
@ -417,7 +420,7 @@ bool SMESHGUI_NodesDlg::ClickOnApply()
aParameters << SpinBox_Z->text();
mySimulation->SetVisibility( false );
SMESH::AddNode( myMesh, x, y, z, aParameters );
SMESH::AddNode( myMesh, x, y, z, getNotebook(), aParameters );
SMESH::SetPointRepresentation( true );
// select myMesh

View File

@ -50,6 +50,7 @@
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_Notebook.h>
#include <SalomeApp_IntSpinBox.h>
#include <SVTK_ViewWindow.h>
@ -503,17 +504,6 @@ bool SMESHGUI_RevolutionDlg::ClickOnApply()
if ( GroupAngle->checkedId() == 1 )
anAngle = anAngle/aNbSteps;
QStringList aParameters;
aParameters << SpinBox_X->text();
aParameters << SpinBox_Y->text();
aParameters << SpinBox_Z->text();
aParameters << SpinBox_DX->text();
aParameters << SpinBox_DY->text();
aParameters << SpinBox_DZ->text();
aParameters << SpinBox_Angle->text();
aParameters << SpinBox_NbSteps->text();
aParameters << SpinBox_Tolerance->text();
try {
SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
@ -545,7 +535,10 @@ bool SMESHGUI_RevolutionDlg::ClickOnApply()
aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
}
//asl: myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
getNotebook()->setParameters( myMesh, 9,
SpinBox_X, SpinBox_Y, SpinBox_Z,
SpinBox_DX, SpinBox_DY, SpinBox_DZ,
SpinBox_Angle, SpinBox_NbSteps, SpinBox_Tolerance );
} catch (...) {
}

View File

@ -49,6 +49,8 @@
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Notebook.h>
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <SALOME_ListIO.hxx>
@ -415,8 +417,8 @@ bool SMESHGUI_RotationDlg::ClickOnApply()
aMeshEditor->RotateObject(mySelectedObject, anAxis, anAngle, false);
else
aMeshEditor->Rotate(anElementsId, anAxis, anAngle, false);
//asl: if( !myMesh->_is_nil())
//asl: myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
if( !myMesh->_is_nil())
getNotebook()->setParameters( myMesh, aParameters );
break;
case COPY_ELEMS_BUTTON:
if ( makeGroups ) {
@ -432,8 +434,8 @@ bool SMESHGUI_RotationDlg::ClickOnApply()
else
aMeshEditor->Rotate(anElementsId, anAxis, anAngle, true);
}
//asl: if( !myMesh->_is_nil())
//asl: myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
if( !myMesh->_is_nil())
getNotebook()->setParameters( myMesh, aParameters );
break;
case MAKE_MESH_BUTTON:
SMESH::SMESH_Mesh_var mesh;
@ -443,8 +445,8 @@ bool SMESHGUI_RotationDlg::ClickOnApply()
else
mesh = aMeshEditor->RotateMakeMesh(anElementsId, anAxis, anAngle, makeGroups,
LineEditNewMesh->text().toLatin1().data());
//asl: if( !mesh->_is_nil())
//asl: mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
if( !mesh->_is_nil())
getNotebook()->setParameters( mesh, aParameters );
}
} catch (...) {
}

View File

@ -50,6 +50,7 @@
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Notebook.h>
#include <SalomeApp_IntSpinBox.h>
#include <SVTK_ViewModel.h>
@ -351,10 +352,6 @@ bool SMESHGUI_SmoothingDlg::ClickOnApply()
long anIterationLimit = (long)SpinBox_IterationLimit->value();
double aMaxAspectRatio = SpinBox_AspectRatio->GetValue();
QStringList aParameters;
aParameters << SpinBox_IterationLimit->text();
aParameters << SpinBox_AspectRatio->text();
SMESH::SMESH_MeshEditor::Smooth_Method aMethod = SMESH::SMESH_MeshEditor::LAPLACIAN_SMOOTH;
if (ComboBoxMethod->currentIndex() > 0)
aMethod = SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH;
@ -381,7 +378,7 @@ bool SMESHGUI_SmoothingDlg::ClickOnApply()
anIterationLimit, aMaxAspectRatio, aMethod);
}
//asl: myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
getNotebook()->setParameters( myMesh, 2, SpinBox_IterationLimit, SpinBox_AspectRatio );
} catch (...) {
}

View File

@ -49,6 +49,8 @@
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Notebook.h>
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <SALOME_ListIO.hxx>
@ -500,8 +502,8 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply()
else
aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, false );
//asl: if( !myMesh->_is_nil())
//asl: myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
if( !myMesh->_is_nil())
getNotebook()->setParameters( myMesh, aParameters );
break;
}
case COPY_ELEMS_BUTTON: {
@ -518,8 +520,8 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply()
else
aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, true);
}
//asl: if( !myMesh->_is_nil())
//asl: myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
if( !myMesh->_is_nil())
getNotebook()->setParameters( myMesh, aParameters );
break;
}
case MAKE_MESH_BUTTON: {
@ -530,8 +532,8 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply()
else
mesh = aMeshEditor->MirrorMakeMesh(anElementsId, aMirror, aMirrorType, makeGroups,
LineEditNewMesh->text().toLatin1().data());
//asl: if( !mesh->_is_nil())
//asl: mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
if( !mesh->_is_nil())
getNotebook()->setParameters( mesh, aParameters );
break;
}
}

View File

@ -49,6 +49,8 @@
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Notebook.h>
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <SALOME_ListIO.hxx>
@ -488,8 +490,8 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
aMeshEditor->TranslateObject(mySelectedObject, aVector, false);
else
aMeshEditor->Translate(anElementsId, aVector, false);
//asl: if( !myMesh->_is_nil())
//asl: myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
if( !myMesh->_is_nil())
getNotebook()->setParameters( myMesh, aParameters );
break;
case COPY_ELEMS_BUTTON:
if ( makeGroups ) {
@ -505,8 +507,8 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
else
aMeshEditor->Translate(anElementsId, aVector, true);
}
//asl: if( !myMesh->_is_nil())
//asl: myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
if( !myMesh->_is_nil())
getNotebook()->setParameters( myMesh, aParameters );
break;
case MAKE_MESH_BUTTON:
SMESH::SMESH_Mesh_var mesh;
@ -516,8 +518,8 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
else
mesh = aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups,
LineEditNewMesh->text().toLatin1().data());
//asl: if( !mesh->_is_nil())
//asl: mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
if( !mesh->_is_nil())
getNotebook()->setParameters( mesh, aParameters );
}
} catch (...) {
}

View File

@ -560,6 +560,10 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishMesh (SALOMEDS::Study_ptr theStudy,
}
}
// Update string attribute (to display used variables)
if( SMESH_Mesh_i* aServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( theMesh ).in() ) )
aServant->UpdateStringAttribute();
if(MYDEBUG) MESSAGE("PublishMesh_END");
return aMeshSO._retn();
}
@ -749,6 +753,7 @@ SALOMEDS::SObject_ptr
SetName( aHypSO, theName, aHypName );
}
// Update string attribute (to display used variables)
if( SMESH_Hypothesis_i* aServant = dynamic_cast<SMESH_Hypothesis_i*>( GetServant( theHyp ).in() ) )
aServant->UpdateStringAttribute();

View File

@ -3385,7 +3385,9 @@ void SMESH_Mesh_i::checkGroupNames()
//=============================================================================
char* SMESH_Mesh_i::GetEntry()
{
return NULL;
char aBuf[100];
sprintf( aBuf, "%i", GetId() );
return CORBA::string_dup( aBuf );
}
//=============================================================================
@ -3415,6 +3417,21 @@ CORBA::Boolean SMESH_Mesh_i::IsValid()
//=============================================================================
void SMESH_Mesh_i::SetParameters( SALOME::Notebook_ptr theNotebook, const SALOME::StringArray& theParameters )
{
theNotebook->ClearDependencies( _this(), SALOME::Parameters );
std::list<std::string> aParams;
int n = theParameters.length();
for( int i=0; i<n; i++ )
{
std::string aParam = CORBA::string_dup( theParameters[i] );
aParams.push_back( aParam );
SALOME::Parameter_ptr aParamPtr = theNotebook->GetParameter( aParam.c_str() );
if( !CORBA::is_nil( aParamPtr ) )
theNotebook->AddDependency( _this(), aParamPtr );
}
_impl->SetParameters( aParams );
UpdateStringAttribute();
}
//=============================================================================
@ -3424,7 +3441,13 @@ void SMESH_Mesh_i::SetParameters( SALOME::Notebook_ptr theNotebook, const SALOME
//=============================================================================
SALOME::StringArray* SMESH_Mesh_i::GetParameters()
{
return NULL;
std::list<std::string> aParams = _impl->GetParameters();
SALOME::StringArray_var aRes = new SALOME::StringArray();
aRes->length( aParams.size() );
std::list<std::string>::const_iterator it = aParams.begin(), last = aParams.end();
for( int i=0; it!=last; it++, i++ )
aRes[i] = CORBA::string_dup( it->c_str() );
return aRes._retn();
}
//=============================================================================
@ -3443,6 +3466,36 @@ void SMESH_Mesh_i::Update( SALOME::Notebook_ptr theNotebook )
//=============================================================================
void SMESH_Mesh_i::UpdateStringAttribute()
{
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
SALOME::Notebook_ptr aNotebook = aSMESHGen->GetNotebook( GetStudyId() );
SALOME::StringArray* anObjectParameters = aNotebook->GetObjectParameters( GetComponent(), GetEntry() );
int aParametersLength = anObjectParameters ? anObjectParameters->length() : 0;
if( aParametersLength == 0 )
return;
SALOMEDS::Study_ptr aStudy = aSMESHGen->GetStudy( GetStudyId() );
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject( aStudy, SMESH::SMESH_Mesh::_narrow( _this() ) );
if( CORBA::is_nil( aSObject ) )
return;
SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute( aSObject, "AttributeString" );
SALOMEDS::AttributeString_var aStringAttrib = SALOMEDS::AttributeString::_narrow( anAttr );
std::string aString;
for( int i = 0, n = anObjectParameters->length(); i < n; i++ ) {
std::string aParameter = anObjectParameters->operator[](i).in();
if( aParameter != "" )
{
if( aString != "" )
aString += ", ";
aString += aParameter;
}
}
aStringAttrib->SetValue( aString.c_str() );
aStringAttrib->Destroy();
}
//=============================================================================