DIM_3D
};
- typedef sequence<string> ListOfParameters;
-
interface SMESH_Hypothesis : SALOME::ParameterizedObject
{
#include <SalomeApp_IntSpinBox.h>
#include <SalomeApp_Notebook.h>
-// IDL includes
-//#include <SALOMEconfig.h>
-//#include CORBA_SERVER_HEADER(SMESH_Mesh)
-//#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
-
//=================================================================================
// name : SMESHGUI_Helper::SMESHGUI_Helper
// Purpose :
//=================================================================================
SMESHGUI_Helper::SMESHGUI_Helper( SMESHGUI* theModule ) :
- mySMESHGUI( theModule ),
- myNotebook( 0 )
+ mySMESHGUI( theModule )
{
+ myNotebook = new SalomeApp_Notebook( mySMESHGUI->activeStudy() );
}
//=======================================================================
// Function : getNotebook
// Purpose :
//================================================================
-SalomeApp_Notebook* SMESHGUI_Helper::getNotebook()
+SalomeApp_Notebook* SMESHGUI_Helper::getNotebook() const
{
- if ( !myNotebook )
- myNotebook = new SalomeApp_Notebook( mySMESHGUI->activeStudy() );
return myNotebook;
}
bool checkParameters( bool, int, QAbstractSpinBox*, ... );
bool checkParameters( bool, const QList<QAbstractSpinBox*>& );
- SalomeApp_Notebook* getNotebook();
+ SalomeApp_Notebook* getNotebook() const;
private:
SMESHGUI* mySMESHGUI;
return myCurrentStudy->_is_nil() || myCurrentStudy->_non_existent() ? -1 : myCurrentStudy->StudyId();
}
+//=================================================================================
+// function : GetStudy()
+// purpose : Returns a pointer to SALOMEDS Study object by its id
+//=================================================================================
+SALOMEDS::Study_ptr SMESH_Gen_i::GetStudy(CORBA::Long theStudyID)
+{
+ CORBA::Object_var aSMObject = GetNS()->Resolve( "/myStudyManager" );
+ SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject );
+ SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( theStudyID );
+ return aStudy._retn();
+}
+
+//=================================================================================
+// function : GetNotebook()
+// purpose : Returns a pointer to SALOME Notebook object by an id of the study
+//=================================================================================
+SALOME::Notebook_ptr SMESH_Gen_i::GetNotebook( CORBA::Long theStudyID )
+{
+ SALOMEDS::Study_ptr aStudy = GetStudy( theStudyID );
+ SALOME::Notebook_var aNotebook = aStudy->GetNotebook();
+ return aNotebook._retn();
+}
+
//=============================================================================
/*!
* SMESHEngine_factory
*/
SALOMEDS::SObject_ptr GetAlgoSO(const ::SMESH_Algo* algo);
+ SALOMEDS::Study_ptr GetStudy(CORBA::Long theStudyID);
+ SALOME::Notebook_ptr GetNotebook(CORBA::Long theStudyID);
+
private:
// Create hypothesis of given type
SMESH::SMESH_Hypothesis_ptr createHypothesis( const char* theHypName,
SetName( aHypSO, theName, aHypName );
}
+ if( SMESH_Hypothesis_i* aServant = dynamic_cast<SMESH_Hypothesis_i*>( GetServant( theHyp ).in() ) )
+ aServant->UpdateStringAttribute();
+
if(MYDEBUG) MESSAGE("PublishHypothesis--END")
return aHypSO._retn();
}
theNotebook->AddDependency( _this(), aParamPtr );
}
myBaseImpl->SetParameters( aParams );
+
+ UpdateStringAttribute();
}
//=============================================================================
*
*/
//=============================================================================
-//char* SMESH_Hypothesis_i::GetParameters()
SALOME::StringArray* SMESH_Hypothesis_i::GetParameters()
{
std::list<std::string> aParams = myBaseImpl->GetParameters();
{
}
+//=============================================================================
+/*!
+ * SMESH_Hypothesis_i::UpdateStringAttribute()
+ *
+ */
+//=============================================================================
+void SMESH_Hypothesis_i::UpdateStringAttribute()
+{
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+
+ SALOME::Notebook_ptr aNotebook = aSMESHGen->GetNotebook( myBaseImpl->GetStudyId() );
+
+ SALOME::StringArray* anObjectParameters = aNotebook->GetObjectParameters( GetComponent(), GetEntry() );
+ int aParametersLength = anObjectParameters ? anObjectParameters->length() : 0;
+ if( aParametersLength == 0 )
+ return;
+
+ SALOMEDS::Study_ptr aStudy = aSMESHGen->GetStudy( myBaseImpl->GetStudyId() );
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+ SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject( aStudy, SMESH::SMESH_Hypothesis::_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();
+}
+
//=============================================================================
/*!
* SMESH_Hypothesis_i::GetImpl
// Get unique id of hypothesis
CORBA::Long GetId();
- // ...
+ // Get internal entry of hypothesis
virtual char* GetEntry();
- // ...
+ // Get name of the component
virtual char* GetComponent();
- // ...
+ // Get validity status of hypothesis
virtual CORBA::Boolean IsValid();
// Set list of parameters, used for Hypothesis creation
// Return list of notebook variables used for Hypothesis creation
virtual SALOME::StringArray* GetParameters();
- // ...
+ // Update hypothesis according to the SALOME Notebook
virtual void Update( SALOME::Notebook_ptr theNotebook );
+ // Update string attribute of hypothesis
+ virtual void UpdateStringAttribute();
+
//Return true if hypothesis was published in study
bool IsPublished();
//=============================================================================
/*!
- * \brief ...
+ * \brief Get internal entry of mesh
*/
//=============================================================================
char* SMESH_Mesh_i::GetEntry()
//=============================================================================
/*!
- * \brief ...
+ * \brief Get name of the component
*/
//=============================================================================
char* SMESH_Mesh_i::GetComponent()
//=============================================================================
/*!
- * \brief ...
+ * \brief Get validity status of mesh
*/
//=============================================================================
CORBA::Boolean SMESH_Mesh_i::IsValid()
//=============================================================================
/*!
- * \brief ...
+ * \brief Update mesh according to the SALOME Notebook
*/
//=============================================================================
void SMESH_Mesh_i::Update( SALOME::Notebook_ptr theNotebook )
{
}
+//=============================================================================
+/*!
+ * \brief Update string attribute of mesh
+ */
+//=============================================================================
+void SMESH_Mesh_i::UpdateStringAttribute()
+{
+}
+
//=============================================================================
/*!
* \brief Returns statistic of mesh elements
virtual SALOME_MED::MedFileInfo* GetMEDFileInfo();
/*!
- * ...
+ * Get internal entry of mesh
*/
virtual char* GetEntry();
/*!
- * ...
+ * Get name of the component
*/
virtual char* GetComponent();
/*!
- * ...
+ * Get validity status of mesh
*/
virtual CORBA::Boolean IsValid();
virtual SALOME::StringArray* GetParameters();
/*!
- * ...
+ * Update mesh according to the SALOME Notebook
*/
virtual void Update( SALOME::Notebook_ptr theNotebook );
+ /*!
+ * Update string attribute of mesh
+ */
+ virtual void UpdateStringAttribute();
+
/*!
* Returns statistic of mesh elements
* Result array of number enityties
bool res = true;
res = myNbSeg->isValid( msg, absentParams, true ) && res;
res = myScale->isValid( msg, absentParams, true ) && res;
- res = res && storeParamsToHypo( data_new );
- res = res && storeParamsToHypo( data_old );
+ res = res && storeParamsToHypo( data_new, true );
+ storeParamsToHypo( data_old, true );
return res;
}
return true;
}
-bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo( const NbSegmentsHypothesisData& h_data ) const
+bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo( const NbSegmentsHypothesisData& h_data, bool isOnlyCheck ) const
{
StdMeshers::StdMeshers_NumberOfSegments_var h =
StdMeshers::StdMeshers_NumberOfSegments::_narrow( hypothesis() );
//the function will be checked with old conversion mode, so that it may occurs
//unexpected errors for user
- // temporal workaround
- StdMeshersGUI_NbSegmentsCreator* that = const_cast<StdMeshersGUI_NbSegmentsCreator*>( this );
- that->getNotebook()->setParameters( h, aVariablesList );
+ if( !isOnlyCheck )
+ getNotebook()->setParameters( h, aVariablesList );
}
catch(const SALOME::SALOME_Exception& ex)
{
private:
bool readParamsFromHypo( NbSegmentsHypothesisData& ) const;
bool readParamsFromWidgets( NbSegmentsHypothesisData& ) const;
- bool storeParamsToHypo( const NbSegmentsHypothesisData& ) const;
+ bool storeParamsToHypo( const NbSegmentsHypothesisData&, bool = false ) const;
private:
SalomeApp_IntSpinBox* myNbSeg;
// SALOME GUI includes
#include <SUIT_ResourceMgr.h>
+#include <SalomeApp_Notebook.h>
// IDL includes
#include <SALOMEconfig.h>
StdMeshers::StdMeshers_LocalLength::_narrow( hypothesis() );
h->SetLength( params[0].myValue.toDouble() );
- //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetPrecision( params[1].myValue.toDouble() );
- //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
+ getNotebook()->setParameters( h, aVariablesList );
}
else if( hypType()=="MaxLength" )
{
StdMeshers::StdMeshers_MaxLength::_narrow( hypothesis() );
h->SetLength( params[0].myValue.toDouble() );
- //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetUsePreestimatedLength( widget< QCheckBox >( 1 )->isChecked() );
if ( !h->HavePreestimatedLength() && !h->_is_equivalent( initParamsHypothesis() )) {
StdMeshers::StdMeshers_MaxLength_var hInit =
StdMeshers::StdMeshers_MaxLength::_narrow( initParamsHypothesis() );
h->SetPreestimatedLength( hInit->GetPreestimatedLength() );
}
+ getNotebook()->setParameters( h, aVariablesList );
}
else if( hypType()=="SegmentLengthAroundVertex" )
{
StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hypothesis() );
h->SetLength( params[0].myValue.toDouble() );
- //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
+ getNotebook()->setParameters( h, aVariablesList );
}
else if( hypType()=="Arithmetic1D" )
{
widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 );
h->SetStartLength( params[0].myValue.toDouble() );
- //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetEndLength( params[1].myValue.toDouble() );
- //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
if (w) {
h->SetReversedEdges( w->GetListOfIDs() );
h->SetObjectEntry( w->GetMainShapeEntry() );
}
+ getNotebook()->setParameters( h, aVariablesList );
}
else if( hypType()=="FixedPoints1D" )
{
widget< StdMeshersGUI_SubShapeSelectorWdg >( 1 );
if (w1) {
- //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetPoints( w1->GetListOfPoints() );
h->SetNbSegments( w1->GetListOfSegments() );
+ getNotebook()->setParameters( h, aVariablesList );
}
if (w2) {
h->SetReversedEdges( w2->GetListOfIDs() );
{
StdMeshers::StdMeshers_MaxElementArea_var h =
StdMeshers::StdMeshers_MaxElementArea::_narrow( hypothesis() );
- //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetMaxElementArea( params[0].myValue.toDouble() );
+ getNotebook()->setParameters( h, aVariablesList );
}
else if( hypType()=="MaxElementVolume" )
{
StdMeshers::StdMeshers_MaxElementVolume::_narrow( hypothesis() );
h->SetMaxElementVolume( params[0].myValue.toDouble() );
- //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
+ getNotebook()->setParameters( h, aVariablesList );
}
else if( hypType()=="StartEndLength" )
{
widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 );
h->SetStartLength( params[0].myValue.toDouble() );
- //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetEndLength( params[1].myValue.toDouble() );
- //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
if (w) {
h->SetReversedEdges( w->GetListOfIDs() );
h->SetObjectEntry( w->GetMainShapeEntry() );
}
+ getNotebook()->setParameters( h, aVariablesList );
}
else if( hypType()=="Deflection1D" )
{
StdMeshers::StdMeshers_Deflection1D_var h =
StdMeshers::StdMeshers_Deflection1D::_narrow( hypothesis() );
- //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetDeflection( params[0].myValue.toDouble() );
+ getNotebook()->setParameters( h, aVariablesList );
}
else if( hypType()=="AutomaticLength" )
{
StdMeshers::StdMeshers_NumberOfLayers::_narrow( hypothesis() );
h->SetNumberOfLayers( params[0].myValue.toInt() );
- //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
+ getNotebook()->setParameters( h, aVariablesList );
}
else if( hypType()=="LayerDistribution" )
{
widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
h->SetLayerDistribution( w->GetHypothesis() );
- //h->SetParameters(w->GetHypothesis()->GetParameters());
- //w->GetHypothesis()->ClearParameters();
+ /* ouv: temporarily disabled
+ h->SetParameters(w->GetHypothesis()->GetParameters());
+ w->GetHypothesis()->ClearParameters();
+ */
}
else if( hypType()=="NumberOfLayers2D" )
{
StdMeshers::StdMeshers_NumberOfLayers2D::_narrow( hypothesis() );
h->SetNumberOfLayers( params[0].myValue.toInt() );
- //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
+ getNotebook()->setParameters( h, aVariablesList );
}
else if( hypType()=="LayerDistribution2D" )
{
widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
h->SetLayerDistribution( w->GetHypothesis() );
- //h->SetParameters(w->GetHypothesis()->GetParameters());
- //w->GetHypothesis()->ClearParameters();
+ /* ouv: temporarily disabled
+ h->SetParameters(w->GetHypothesis()->GetParameters());
+ w->GetHypothesis()->ClearParameters();
+ */
}
else if( hypType()=="ProjectionSource1D" )
{
}
SMESH::SMESH_Hypothesis_var hyp = initParamsHypothesis();
- //SMESH::ListOfParameters_var aParameters = hyp->GetLastParameters();
SALOME::StringArray* aParameters = hyp->GetParameters();
if( hypType()=="LocalLength" )