0021308: Remove hard-coded dependency of the external mesh plugins from the SMESH module

Use TVar structure to dump arguments that can be defined via notebook variables
This commit is contained in:
eap 2012-03-07 15:07:13 +00:00
parent f68bcab022
commit 102c101f1c
29 changed files with 189 additions and 60 deletions

View File

@ -24,7 +24,6 @@
// File : StdMeshers_Arithmetic1D_i.cxx // File : StdMeshers_Arithmetic1D_i.cxx
// Author : Damien COQUERET, OCC // Author : Damien COQUERET, OCC
// Module : SMESH // Module : SMESH
// $Header$
// //
#include "StdMeshers_Arithmetic1D_i.hxx" #include "StdMeshers_Arithmetic1D_i.hxx"
#include "SMESH_Gen_i.hxx" #include "SMESH_Gen_i.hxx"
@ -95,7 +94,8 @@ void StdMeshers_Arithmetic1D_i::SetLength(CORBA::Double theLength,
// Update Python script // Update Python script
SMESH::TPythonDump() SMESH::TPythonDump()
<< _this() << ( theIsStart ? ".SetStartLength( " : ".SetEndLength( " ) << theLength << " )"; << _this() << ( theIsStart ? ".SetStartLength( " : ".SetEndLength( " )
<< SMESH::TVar(theLength) << " )";
} }
//============================================================================= //=============================================================================
@ -259,3 +259,14 @@ CORBA::Boolean StdMeshers_Arithmetic1D_i::IsDimSupported( SMESH::Dimension type
return type == SMESH::DIM_1D; return type == SMESH::DIM_1D;
} }
//================================================================================
/*!
* \brief Return method name corresponding to index of variable parameter
*/
//================================================================================
std::string StdMeshers_Arithmetic1D_i::getMethodOfParameter(const int paramIndex,
int nbVars) const
{
return paramIndex == 0 ? "SetStartLength" : "SetEndLength";
}

View File

@ -82,6 +82,9 @@ public:
// Verify whether hypothesis supports given entity type // Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type ); CORBA::Boolean IsDimSupported( SMESH::Dimension type );
protected:
virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
}; };
#endif #endif

View File

@ -151,7 +151,7 @@ void StdMeshers_CartesianParameters3D_i::SetSizeThreshold(CORBA::Double threshol
} }
// Update Python script // Update Python script
SMESH::TPythonDump() << _this() << ".SetSizeThreshold( " << threshold << " )"; SMESH::TPythonDump() << _this() << ".SetSizeThreshold( " << SMESH::TVar(threshold) << " )";
} }
//============================================================================= //=============================================================================

View File

@ -93,7 +93,7 @@ void StdMeshers_Deflection1D_i::SetDeflection( CORBA::Double theValue )
} }
// Update Python script // Update Python script
SMESH::TPythonDump() << _this() << ".SetDeflection( " << theValue << " )"; SMESH::TPythonDump() << _this() << ".SetDeflection( " << SMESH::TVar(theValue) << " )";
} }
//============================================================================= //=============================================================================
@ -139,3 +139,14 @@ CORBA::Boolean StdMeshers_Deflection1D_i::IsDimSupported( SMESH::Dimension type
return type == SMESH::DIM_1D; return type == SMESH::DIM_1D;
} }
//================================================================================
/*!
* \brief Return method name corresponding to index of variable parameter
*/
//================================================================================
std::string StdMeshers_Deflection1D_i::getMethodOfParameter(const int paramIndex,
int /*nbVars*/) const
{
return "SetDeflection";
}

View File

@ -25,7 +25,6 @@
// Moved here from SMESH_LocalLength_i.hxx // Moved here from SMESH_LocalLength_i.hxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
// $Header$
// //
#ifndef _SMESH_Deflection1D_I_HXX_ #ifndef _SMESH_Deflection1D_I_HXX_
#define _SMESH_Deflection1D_I_HXX_ #define _SMESH_Deflection1D_I_HXX_
@ -66,7 +65,9 @@ public:
// Verify whether hypothesis supports given entity type // Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type ); CORBA::Boolean IsDimSupported( SMESH::Dimension type );
protected:
virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
}; };
#endif #endif

View File

@ -21,14 +21,11 @@
// File : StdMeshers_LayerDistribution2D_i.cxx // File : StdMeshers_LayerDistribution2D_i.cxx
// Author : Edward AGAPOV // Author : Edward AGAPOV
// Module : SMESH // Module : SMESH
// $Header$
// //
#include "StdMeshers_LayerDistribution2D_i.hxx" #include "StdMeshers_LayerDistribution2D_i.hxx"
#include "utilities.h" #include "utilities.h"
//using namespace std;
//============================================================================= //=============================================================================
/*! /*!
* StdMeshers_LayerDistribution2D_i::StdMeshers_LayerDistribution2D_i * StdMeshers_LayerDistribution2D_i::StdMeshers_LayerDistribution2D_i

View File

@ -21,7 +21,6 @@
// File : StdMeshers_LayerDistribution2D_i.hxx // File : StdMeshers_LayerDistribution2D_i.hxx
// Author : Edward AGAPOV // Author : Edward AGAPOV
// Module : SMESH // Module : SMESH
// $Header$
// //
#ifndef _SMESH_LayerDistribution2D_I_HXX_ #ifndef _SMESH_LayerDistribution2D_I_HXX_
#define _SMESH_LayerDistribution2D_I_HXX_ #define _SMESH_LayerDistribution2D_I_HXX_

View File

@ -24,7 +24,6 @@
// File : StdMeshers_LayerDistribution_i.cxx // File : StdMeshers_LayerDistribution_i.cxx
// Author : Edward AGAPOV // Author : Edward AGAPOV
// Module : SMESH // Module : SMESH
// $Header$
// //
#include "StdMeshers_LayerDistribution_i.hxx" #include "StdMeshers_LayerDistribution_i.hxx"
#include "SMESH_Gen_i.hxx" #include "SMESH_Gen_i.hxx"
@ -169,9 +168,9 @@ char* StdMeshers_LayerDistribution_i::SaveTo()
else { else {
os << hyp1D->GetName() << " " os << hyp1D->GetName() << " "
<< hyp1D->GetLibName() << " " << hyp1D->GetLibName() << " "
<< hyp1D_i->SaveTo(); << hyp1D_i->SaveTo() << " ";
} }
//myBaseImpl->SaveTo( os ); os << SMESH_Hypothesis_i::SaveTo(); // to have a mark of storage version ("VARS...")
return CORBA::string_dup( os.str().c_str() ); return CORBA::string_dup( os.str().c_str() );
} }
@ -201,11 +200,14 @@ void StdMeshers_LayerDistribution_i::LoadFrom( const char* theStream )
gen->CreateHypothesis( typeName.c_str(), libName.c_str() ); gen->CreateHypothesis( typeName.c_str(), libName.c_str() );
SMESH_Hypothesis_i* hyp1D_i = SMESH::DownCast< SMESH_Hypothesis_i*>( hyp1D ); SMESH_Hypothesis_i* hyp1D_i = SMESH::DownCast< SMESH_Hypothesis_i*>( hyp1D );
if ( hyp1D_i ) { if ( hyp1D_i ) {
hyp1D_i->LoadFrom( & theStream[ is.tellg() ]); hyp1D_i->LoadFrom( & theStream[ (streamoff) is.tellg()+1 ]);
this->GetImpl()->SetLayerDistribution( hyp1D_i->GetImpl() ); this->GetImpl()->SetLayerDistribution( hyp1D_i->GetImpl() );
myHyp = hyp1D; myHyp = hyp1D;
// as hyp1D is not published, its ID changes // as hyp1D is not published, its ID changes
//SMESH::TPythonDump() << _this() << ".SetLayerDistribution( " << hyp1D << " )"; //SMESH::TPythonDump() << _this() << ".SetLayerDistribution( " << hyp1D << " )";
// restore a mark of storage version ("VARS...")
SMESH_Hypothesis_i::LoadFrom( & theStream[ (streamoff)is.tellg()+1 ]);
} }
} }
catch (...) { catch (...) {
@ -214,3 +216,14 @@ void StdMeshers_LayerDistribution_i::LoadFrom( const char* theStream )
} }
} }
//================================================================================
/*!
* \brief Restore myMethod2VarParams by parameters stored in an old study
*/
//================================================================================
void StdMeshers_LayerDistribution_i::setOldParameters (const char* theParameters)
{
if ( SMESH_Hypothesis_i* hyp1D_i = SMESH::DownCast< SMESH_Hypothesis_i*>( myHyp ))
hyp1D_i->setOldParameters( theParameters );
}

View File

@ -24,7 +24,6 @@
// File : StdMeshers_LayerDistribution_i.hxx // File : StdMeshers_LayerDistribution_i.hxx
// Author : Edward AGAPOV // Author : Edward AGAPOV
// Module : SMESH // Module : SMESH
// $Header$
// //
#ifndef _SMESH_LayerDistribution_I_HXX_ #ifndef _SMESH_LayerDistribution_I_HXX_
#define _SMESH_LayerDistribution_I_HXX_ #define _SMESH_LayerDistribution_I_HXX_
@ -80,9 +79,12 @@ public:
virtual char* SaveTo(); virtual char* SaveTo();
virtual void LoadFrom( const char* theStream ); virtual void LoadFrom( const char* theStream );
protected:
// restore myMethod2VarParams by parameters stored in an old study
virtual void setOldParameters (const char* theParameters);
private: private:
SMESH::SMESH_Hypothesis_var myHyp; SMESH::SMESH_Hypothesis_var myHyp;
}; };
#endif #endif

View File

@ -25,7 +25,6 @@
// Moved here from SMESH_LocalLength_i.cxx // Moved here from SMESH_LocalLength_i.cxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
// $Header$
// //
#include "StdMeshers_LocalLength_i.hxx" #include "StdMeshers_LocalLength_i.hxx"
#include "SMESH_Gen_i.hxx" #include "SMESH_Gen_i.hxx"
@ -93,7 +92,7 @@ void StdMeshers_LocalLength_i::SetLength( CORBA::Double theLength )
} }
// Update Python script // Update Python script
SMESH::TPythonDump() << _this() << ".SetLength( " << theLength << " )"; SMESH::TPythonDump() << _this() << ".SetLength( " << SMESH::TVar(theLength) << " )";
} }
//============================================================================= //=============================================================================
@ -117,7 +116,7 @@ void StdMeshers_LocalLength_i::SetPrecision( CORBA::Double thePrecision )
} }
// Update Python script // Update Python script
SMESH::TPythonDump() << _this() << ".SetPrecision( " << thePrecision << " )"; SMESH::TPythonDump() << _this() << ".SetPrecision( " << SMESH::TVar(thePrecision) << " )";
} }
//============================================================================= //=============================================================================
@ -174,3 +173,9 @@ CORBA::Boolean StdMeshers_LocalLength_i::IsDimSupported( SMESH::Dimension type )
{ {
return type == SMESH::DIM_1D; return type == SMESH::DIM_1D;
} }
std::string StdMeshers_LocalLength_i::getMethodOfParameter(const int paramIndex,
int /*nbVars*/) const
{
return paramIndex == 0 ? "SetLength" : "SetPrecision";
}

View File

@ -25,7 +25,6 @@
// Moved here from SMESH_LocalLength_i.hxx // Moved here from SMESH_LocalLength_i.hxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
// $Header$
// //
#ifndef _SMESH_LOCALLENGTH_I_HXX_ #ifndef _SMESH_LOCALLENGTH_I_HXX_
#define _SMESH_LOCALLENGTH_I_HXX_ #define _SMESH_LOCALLENGTH_I_HXX_
@ -72,6 +71,9 @@ public:
// Verify whether hypothesis supports given entity type // Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type ); CORBA::Boolean IsDimSupported( SMESH::Dimension type );
protected:
virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
}; };
#endif #endif

View File

@ -25,7 +25,6 @@
// Moved here from SMESH_MaxElementArea_i.cxx // Moved here from SMESH_MaxElementArea_i.cxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
// $Header$
// //
#include "StdMeshers_MaxElementArea_i.hxx" #include "StdMeshers_MaxElementArea_i.hxx"
#include "SMESH_Gen_i.hxx" #include "SMESH_Gen_i.hxx"
@ -94,7 +93,7 @@ void StdMeshers_MaxElementArea_i::SetMaxElementArea( CORBA::Double theArea )
} }
// Update Python script // Update Python script
SMESH::TPythonDump() << _this() << ".SetMaxElementArea( " << theArea << " )"; SMESH::TPythonDump() << _this() << ".SetMaxElementArea( " << SMESH::TVar(theArea) << " )";
} }
//============================================================================= //=============================================================================
@ -140,3 +139,14 @@ CORBA::Boolean StdMeshers_MaxElementArea_i::IsDimSupported( SMESH::Dimension typ
return type == SMESH::DIM_2D; return type == SMESH::DIM_2D;
} }
//================================================================================
/*!
* \brief Return method name corresponding to index of variable parameter
*/
//================================================================================
std::string StdMeshers_MaxElementArea_i::getMethodOfParameter(const int paramIndex,
int /*nbVars*/) const
{
return "SetMaxElementArea";
}

View File

@ -25,7 +25,6 @@
// Moved here from SMESH_MaxElementArea_i.hxx // Moved here from SMESH_MaxElementArea_i.hxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
// $Header$
// //
#ifndef _SMESH_MAXELEMENTAREA_I_HXX_ #ifndef _SMESH_MAXELEMENTAREA_I_HXX_
#define _SMESH_MAXELEMENTAREA_I_HXX_ #define _SMESH_MAXELEMENTAREA_I_HXX_
@ -64,6 +63,9 @@ public:
// Verify whether hypothesis supports given entity type // Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type ); CORBA::Boolean IsDimSupported( SMESH::Dimension type );
protected:
virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
}; };
#endif #endif

View File

@ -25,7 +25,6 @@
// Moved here from SMESH_MaxElementVolume_i.cxx // Moved here from SMESH_MaxElementVolume_i.cxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
// $Header$
// //
#include "StdMeshers_MaxElementVolume_i.hxx" #include "StdMeshers_MaxElementVolume_i.hxx"
#include "SMESH_Gen_i.hxx" #include "SMESH_Gen_i.hxx"
@ -94,7 +93,7 @@ void StdMeshers_MaxElementVolume_i::SetMaxElementVolume( CORBA::Double theVolume
} }
// Update Python script // Update Python script
SMESH::TPythonDump() << _this() << ".SetMaxElementVolume( " << theVolume << " )"; SMESH::TPythonDump() << _this() << ".SetMaxElementVolume( " << SMESH::TVar(theVolume) << " )";
} }
//============================================================================= //=============================================================================
@ -140,3 +139,13 @@ CORBA::Boolean StdMeshers_MaxElementVolume_i::IsDimSupported( SMESH::Dimension t
return type == SMESH::DIM_3D; return type == SMESH::DIM_3D;
} }
//================================================================================
/*!
* \brief Return method name corresponding to index of variable parameter
*/
//================================================================================
std::string StdMeshers_MaxElementVolume_i::getMethodOfParameter(const int, int) const
{
return "SetMaxElementVolume";
}

View File

@ -25,7 +25,6 @@
// Moved here from SMESH_MaxElementVolume_i.hxx // Moved here from SMESH_MaxElementVolume_i.hxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
// $Header$
// //
#ifndef _SMESH_MAXELEMENTVOLUME_I_HXX_ #ifndef _SMESH_MAXELEMENTVOLUME_I_HXX_
#define _SMESH_MAXELEMENTVOLUME_I_HXX_ #define _SMESH_MAXELEMENTVOLUME_I_HXX_
@ -64,6 +63,9 @@ public:
// Verify whether hypothesis supports given entity type // Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type ); CORBA::Boolean IsDimSupported( SMESH::Dimension type );
protected:
virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
}; };
#endif #endif

View File

@ -84,7 +84,7 @@ void StdMeshers_MaxLength_i::SetLength( CORBA::Double theLength )
} }
// Update Python script // Update Python script
SMESH::TPythonDump() << _this() << ".SetLength( " << theLength << " )"; SMESH::TPythonDump() << _this() << ".SetLength( " << SMESH::TVar(theLength) << " )";
} }
//============================================================================= //=============================================================================
@ -201,3 +201,14 @@ CORBA::Boolean StdMeshers_MaxLength_i::IsDimSupported( SMESH::Dimension type )
{ {
return type == SMESH::DIM_1D; return type == SMESH::DIM_1D;
} }
//================================================================================
/*!
* \brief Return method name corresponding to index of variable parameter
*/
//================================================================================
std::string StdMeshers_MaxLength_i::getMethodOfParameter(const int, int) const
{
return "SetLength";
}

View File

@ -77,6 +77,9 @@ public:
// Verify whether hypothesis supports given entity type // Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type ); CORBA::Boolean IsDimSupported( SMESH::Dimension type );
protected:
virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
}; };
#endif #endif

View File

@ -21,14 +21,11 @@
// File : StdMeshers_NumberOfLayers2D_i.cxx // File : StdMeshers_NumberOfLayers2D_i.cxx
// Author : Edward AGAPOV // Author : Edward AGAPOV
// Module : SMESH // Module : SMESH
// $Header$
// //
#include "StdMeshers_NumberOfLayers2D_i.hxx" #include "StdMeshers_NumberOfLayers2D_i.hxx"
#include "utilities.h" #include "utilities.h"
//using namespace std;
//============================================================================= //=============================================================================
/*! /*!
* StdMeshers_NumberOfLayers2D_i::StdMeshers_NumberOfLayers2D_i * StdMeshers_NumberOfLayers2D_i::StdMeshers_NumberOfLayers2D_i
@ -89,4 +86,3 @@ CORBA::Boolean StdMeshers_NumberOfLayers2D_i::IsDimSupported( SMESH::Dimension t
{ {
return type == SMESH::DIM_2D; return type == SMESH::DIM_2D;
} }

View File

@ -21,7 +21,6 @@
// File : StdMeshers_NumberOfLayers2D_i.hxx // File : StdMeshers_NumberOfLayers2D_i.hxx
// Author : Edward AGAPOV // Author : Edward AGAPOV
// Module : SMESH // Module : SMESH
// $Header$
// //
#ifndef _SMESH_NumberOfLayers2D_I_HXX_ #ifndef _SMESH_NumberOfLayers2D_I_HXX_
#define _SMESH_NumberOfLayers2D_I_HXX_ #define _SMESH_NumberOfLayers2D_I_HXX_
@ -57,4 +56,3 @@ public:
}; };
#endif #endif

View File

@ -24,7 +24,6 @@
// File : StdMeshers_NumberOfLayers_i.cxx // File : StdMeshers_NumberOfLayers_i.cxx
// Author : Edward AGAPOV // Author : Edward AGAPOV
// Module : SMESH // Module : SMESH
// $Header$
// //
#include "StdMeshers_NumberOfLayers_i.hxx" #include "StdMeshers_NumberOfLayers_i.hxx"
#include "SMESH_Gen_i.hxx" #include "SMESH_Gen_i.hxx"
@ -90,7 +89,7 @@ void StdMeshers_NumberOfLayers_i::SetNumberOfLayers(CORBA::Long numberOfLayers)
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM ); THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
} }
// Update Python script // Update Python script
SMESH::TPythonDump() << _this() << ".SetNumberOfLayers( " << numberOfLayers << " )"; SMESH::TPythonDump() << _this() << ".SetNumberOfLayers( " << SMESH::TVar(numberOfLayers) << " )";
} }
//============================================================================= //=============================================================================
@ -134,3 +133,13 @@ CORBA::Boolean StdMeshers_NumberOfLayers_i::IsDimSupported( SMESH::Dimension typ
return type == SMESH::DIM_3D; return type == SMESH::DIM_3D;
} }
//================================================================================
/*!
* \brief Return method name corresponding to index of variable parameter
*/
//================================================================================
std::string StdMeshers_NumberOfLayers_i::getMethodOfParameter(const int, int) const
{
return "SetNumberOfLayers";
}

View File

@ -24,7 +24,6 @@
// File : StdMeshers_NumberOfLayers_i.hxx // File : StdMeshers_NumberOfLayers_i.hxx
// Author : Edward AGAPOV // Author : Edward AGAPOV
// Module : SMESH // Module : SMESH
// $Header$
// //
#ifndef _SMESH_NumberOfLayers_I_HXX_ #ifndef _SMESH_NumberOfLayers_I_HXX_
#define _SMESH_NumberOfLayers_I_HXX_ #define _SMESH_NumberOfLayers_I_HXX_
@ -69,7 +68,9 @@ public:
// Verify whether hypothesis supports given entity type // Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type ); CORBA::Boolean IsDimSupported( SMESH::Dimension type );
protected:
virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
}; };
#endif #endif

View File

@ -25,7 +25,6 @@
// Moved here from SMESH_NumberOfSegments_i.cxx // Moved here from SMESH_NumberOfSegments_i.cxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
// $Header$
// //
#include "StdMeshers_NumberOfSegments_i.hxx" #include "StdMeshers_NumberOfSegments_i.hxx"
#include "SMESH_Gen_i.hxx" #include "SMESH_Gen_i.hxx"
@ -146,7 +145,7 @@ void StdMeshers_NumberOfSegments_i::SetNumberOfSegments( CORBA::Long theSegments
} }
// Update Python script // Update Python script
SMESH::TPythonDump() << _this() << ".SetNumberOfSegments( " << theSegmentsNumber << " )"; SMESH::TPythonDump() << _this() << ".SetNumberOfSegments( " << SMESH::TVar(theSegmentsNumber) << " )";
} }
//============================================================================= //=============================================================================
@ -305,7 +304,7 @@ void StdMeshers_NumberOfSegments_i::SetScaleFactor( CORBA::Double theScaleFactor
try { try {
this->GetImpl()->SetScaleFactor( theScaleFactor ); this->GetImpl()->SetScaleFactor( theScaleFactor );
// Update Python script // Update Python script
SMESH::TPythonDump() << _this() << ".SetScaleFactor( " << theScaleFactor << " )"; SMESH::TPythonDump() << _this() << ".SetScaleFactor( " << SMESH::TVar(theScaleFactor) << " )";
} }
catch ( SALOME_Exception& S_ex ) { catch ( SALOME_Exception& S_ex ) {
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
@ -490,3 +489,13 @@ CORBA::Boolean StdMeshers_NumberOfSegments_i::IsDimSupported( SMESH::Dimension t
return type == SMESH::DIM_1D; return type == SMESH::DIM_1D;
} }
//================================================================================
/*!
* \brief Return method name corresponding to index of variable parameter
*/
//================================================================================
std::string StdMeshers_NumberOfSegments_i::getMethodOfParameter(const int paramIndex, int ) const
{
return paramIndex == 0 ? "SetNumberOfSegments" : "SetScaleFactor";
}

View File

@ -25,7 +25,6 @@
// Moved here from SMESH_NumberOfSegments_i.hxx // Moved here from SMESH_NumberOfSegments_i.hxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
// $Header$
// //
#ifndef _SMESH_NUMBEROFSEGMENTS_I_HXX_ #ifndef _SMESH_NUMBEROFSEGMENTS_I_HXX_
#define _SMESH_NUMBEROFSEGMENTS_I_HXX_ #define _SMESH_NUMBEROFSEGMENTS_I_HXX_
@ -117,6 +116,9 @@ public:
//Get Object Entry //Get Object Entry
char* GetObjectEntry(); char* GetObjectEntry();
protected:
virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
}; };
#endif #endif

View File

@ -23,7 +23,6 @@
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
// File : StdMeshers_SegmentLengthAroundVertex_i.cxx // File : StdMeshers_SegmentLengthAroundVertex_i.cxx
// Module : SMESH // Module : SMESH
// $Header$
// //
#include "StdMeshers_SegmentLengthAroundVertex_i.hxx" #include "StdMeshers_SegmentLengthAroundVertex_i.hxx"
#include "SMESH_Gen.hxx" #include "SMESH_Gen.hxx"
@ -91,7 +90,7 @@ void StdMeshers_SegmentLengthAroundVertex_i::SetLength( CORBA::Double theLength
} }
// Update Python script // Update Python script
SMESH::TPythonDump() << _this() << ".SetLength( " << theLength << " )"; SMESH::TPythonDump() << _this() << ".SetLength( " << SMESH::TVar(theLength) << " )";
} }
//============================================================================= //=============================================================================
@ -138,3 +137,13 @@ CORBA::Boolean StdMeshers_SegmentLengthAroundVertex_i::IsDimSupported( SMESH::Di
return type == SMESH::DIM_1D; return type == SMESH::DIM_1D;
} }
//================================================================================
/*!
* \brief Return method name corresponding to index of variable parameter
*/
//================================================================================
std::string StdMeshers_SegmentLengthAroundVertex_i::getMethodOfParameter(const int, int ) const
{
return "SetLength";
}

View File

@ -23,7 +23,6 @@
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
// File : StdMeshers_SegmentLengthAroundVertex_i.hxx // File : StdMeshers_SegmentLengthAroundVertex_i.hxx
// Module : SMESH // Module : SMESH
// $Header$
// //
#ifndef _SMESH_SegmentLengthAroundVertex_I_HXX_ #ifndef _SMESH_SegmentLengthAroundVertex_I_HXX_
#define _SMESH_SegmentLengthAroundVertex_I_HXX_ #define _SMESH_SegmentLengthAroundVertex_I_HXX_
@ -64,6 +63,9 @@ public:
// Verify whether hypothesis supports given entity type // Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type ); CORBA::Boolean IsDimSupported( SMESH::Dimension type );
protected:
virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
}; };
#endif #endif

View File

@ -25,7 +25,6 @@
// Moved here from SMESH_LocalLength_i.cxx // Moved here from SMESH_LocalLength_i.cxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
// $Header$
// //
#include "StdMeshers_StartEndLength_i.hxx" #include "StdMeshers_StartEndLength_i.hxx"
#include "SMESH_Gen_i.hxx" #include "SMESH_Gen_i.hxx"
@ -96,7 +95,8 @@ void StdMeshers_StartEndLength_i::SetLength(CORBA::Double theLength,
// Update Python script // Update Python script
SMESH::TPythonDump() << SMESH::TPythonDump() <<
_this() << ( theIsStart ? ".SetStartLength( " : ".SetEndLength( " ) << theLength << " )"; _this() << ( theIsStart ? ".SetStartLength( " : ".SetEndLength( " ) <<
SMESH::TVar(theLength) << " )";
} }
//============================================================================= //=============================================================================
@ -257,3 +257,14 @@ CORBA::Boolean StdMeshers_StartEndLength_i::IsDimSupported( SMESH::Dimension typ
return type == SMESH::DIM_1D; return type == SMESH::DIM_1D;
} }
//================================================================================
/*!
* \brief Return method name corresponding to index of variable parameter
*/
//================================================================================
std::string StdMeshers_StartEndLength_i::getMethodOfParameter(const int paramIndex,
int /*nbVars*/) const
{
return paramIndex == 0 ? "SetStartLength" : "SetEndLength";
}

View File

@ -85,7 +85,9 @@ public:
//Get Object Entry //Get Object Entry
char* GetObjectEntry(); char* GetObjectEntry();
protected:
virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
}; };
#endif #endif

View File

@ -29,7 +29,6 @@
#include "SMESH_Gen.hxx" #include "SMESH_Gen.hxx"
#include "SMESH_Gen_i.hxx" #include "SMESH_Gen_i.hxx"
#include "SMESH_PythonDump.hxx" #include "SMESH_PythonDump.hxx"
//#include "StdMeshers_ObjRefUlils.hxx"
#include "Utils_CorbaException.hxx" #include "Utils_CorbaException.hxx"
#include "utilities.h" #include "utilities.h"
@ -118,7 +117,7 @@ throw ( SALOME::SALOME_Exception )
if ( thickness < 1e-100 ) if ( thickness < 1e-100 )
THROW_SALOME_CORBA_EXCEPTION( "Invalid thickness", SALOME::BAD_PARAM ); THROW_SALOME_CORBA_EXCEPTION( "Invalid thickness", SALOME::BAD_PARAM );
GetImpl()->SetTotalThickness(thickness); GetImpl()->SetTotalThickness(thickness);
SMESH::TPythonDump() << _this() << ".SetTotalThickness( " << thickness << " )"; SMESH::TPythonDump() << _this() << ".SetTotalThickness( " << SMESH::TVar(thickness) << " )";
} }
//================================================================================ //================================================================================
@ -145,7 +144,7 @@ throw ( SALOME::SALOME_Exception )
if ( nb < 1 ) if ( nb < 1 )
THROW_SALOME_CORBA_EXCEPTION( "Invalid number of layers", SALOME::BAD_PARAM ); THROW_SALOME_CORBA_EXCEPTION( "Invalid number of layers", SALOME::BAD_PARAM );
GetImpl()->SetNumberLayers( nb ); GetImpl()->SetNumberLayers( nb );
SMESH::TPythonDump() << _this() << ".SetNumberLayers( " << nb << " )"; SMESH::TPythonDump() << _this() << ".SetNumberLayers( " << SMESH::TVar(nb) << " )";
} }
//================================================================================ //================================================================================
@ -172,7 +171,7 @@ throw ( SALOME::SALOME_Exception )
if ( factor < 1 ) if ( factor < 1 )
THROW_SALOME_CORBA_EXCEPTION( "Invalid stretch factor, it must be >= 1.0", SALOME::BAD_PARAM ); THROW_SALOME_CORBA_EXCEPTION( "Invalid stretch factor, it must be >= 1.0", SALOME::BAD_PARAM );
GetImpl()->SetStretchFactor(factor); GetImpl()->SetStretchFactor(factor);
SMESH::TPythonDump() << _this() << ".SetStretchFactor( " << factor << " )"; SMESH::TPythonDump() << _this() << ".SetStretchFactor( " << SMESH::TVar(factor) << " )";
} }
//================================================================================ //================================================================================
@ -213,3 +212,20 @@ CORBA::Boolean StdMeshers_ViscousLayers_i::IsDimSupported( SMESH::Dimension type
return type == SMESH::DIM_3D; return type == SMESH::DIM_3D;
} }
//================================================================================
/*!
* \brief Return method name corresponding to index of variable parameter
*/
//================================================================================
std::string StdMeshers_ViscousLayers_i::getMethodOfParameter(const int paramIndex, int ) const
{
// order of methods was defined by StdMeshersGUI_StdHypothesisCreator::storeParams()
switch ( paramIndex )
{
case 0: return "SetTotalThickness";
case 1: return "SetNumberLayers";
case 2: return "SetStretchFactor";
}
return "";
}

View File

@ -67,15 +67,8 @@ class STDMESHERS_I_EXPORT StdMeshers_ViscousLayers_i:
// Verify whether hypothesis supports given entity type // Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type ); CORBA::Boolean IsDimSupported( SMESH::Dimension type );
// Redefined Persistence protected:
// virtual char* SaveTo(); virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
// virtual void LoadFrom( const char* theStream );
// virtual void UpdateAsMeshesRestored();
private:
//SMESH::string_array_var _groupEntries;
//std::vector< std::string > _groupIDs;
}; };
#endif #endif