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;
+}
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);
TopTools_IndexedDataMapOfShapeListOfShape _mapAncestors;
+private:
+ std::list<std::string> _parameters;
+
protected:
SMESH_Mesh() {};
SMESH_Mesh(const SMESH_Mesh&) {};
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Study.h>
+#include <SalomeApp_Notebook.h>
#include <SUIT_OverrideCursor.h>
#include <LightApp_Application.h>
SMESH::SMESH_Mesh_var aCompoundMesh;
if (!myMesh->_is_nil()) {
- QStringList aParameters;
- aParameters << (CheckBoxMerge->isChecked() ? SpinBoxTol->text() : QString(" "));
try {
SUIT_OverrideCursor aWaitCursor;
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();
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Notebook.h>
+
#include <SVTK_ViewWindow.h>
// OCCT includes
}
- //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();
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
+#include <SalomeApp_Notebook.h>
#include <SalomeApp_IntSpinBox.h>
// OCCT includes
aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
}
- //asl: myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
+ getNotebook()->setParameters( myMesh, aParameters );
} catch (...) {
}
#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>
}
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("");
#include <SUIT_MessageBox.h>
#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Notebook.h>
#include <SalomeApp_Tools.h>
#include <LightApp_Application.h>
#include <SalomeApp_IntSpinBox.h>
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)
// 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>
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 (...) {
}
#include <LightApp_SelectionMgr.h>
#include <LightApp_Application.h>
+#include <SalomeApp_Notebook.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
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;
}
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Notebook.h>
+
#include <SVTK_ViewWindow.h>
#include <VTKViewer_Algorithm.h>
#include <VTKViewer_CellLocationsArray.h>
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() ) ) {
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
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Application.h>
+#include <SalomeApp_Notebook.h>
#include <SalomeApp_IntSpinBox.h>
#include <SVTK_ViewWindow.h>
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();
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 (...) {
}
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Notebook.h>
+
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <SALOME_ListIO.hxx>
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 ) {
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;
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 (...) {
}
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Notebook.h>
#include <SalomeApp_IntSpinBox.h>
#include <SVTK_ViewModel.h>
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;
anIterationLimit, aMaxAspectRatio, aMethod);
}
- //asl: myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
+ getNotebook()->setParameters( myMesh, 2, SpinBox_IterationLimit, SpinBox_AspectRatio );
} catch (...) {
}
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Notebook.h>
+
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <SALOME_ListIO.hxx>
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: {
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: {
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;
}
}
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Notebook.h>
+
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <SALOME_ListIO.hxx>
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 ) {
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;
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 (...) {
}
}
}
+ // 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();
}
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();
//=============================================================================
char* SMESH_Mesh_i::GetEntry()
{
- return NULL;
+ char aBuf[100];
+ sprintf( aBuf, "%i", GetId() );
+ return CORBA::string_dup( aBuf );
}
//=============================================================================
//=============================================================================
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();
}
//=============================================================================
//=============================================================================
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();
}
//=============================================================================
//=============================================================================
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();
}
//=============================================================================