mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-04-02 04:24:28 +05:00
0019929: EDF 772 SMESH : script readability
+class _pySelfEraser: public _pyObject
This commit is contained in:
parent
2b1b345532
commit
ef7a7ed667
@ -45,7 +45,7 @@ IMPLEMENT_STANDARD_HANDLE (_pyMesh ,_pyObject);
|
|||||||
IMPLEMENT_STANDARD_HANDLE (_pySubMesh ,_pyObject);
|
IMPLEMENT_STANDARD_HANDLE (_pySubMesh ,_pyObject);
|
||||||
IMPLEMENT_STANDARD_HANDLE (_pyMeshEditor ,_pyObject);
|
IMPLEMENT_STANDARD_HANDLE (_pyMeshEditor ,_pyObject);
|
||||||
IMPLEMENT_STANDARD_HANDLE (_pyHypothesis ,_pyObject);
|
IMPLEMENT_STANDARD_HANDLE (_pyHypothesis ,_pyObject);
|
||||||
IMPLEMENT_STANDARD_HANDLE (_pyFilterManager ,_pyObject);
|
IMPLEMENT_STANDARD_HANDLE (_pySelfEraser ,_pyObject);
|
||||||
IMPLEMENT_STANDARD_HANDLE (_pyAlgorithm ,_pyHypothesis);
|
IMPLEMENT_STANDARD_HANDLE (_pyAlgorithm ,_pyHypothesis);
|
||||||
IMPLEMENT_STANDARD_HANDLE (_pyComplexParamHypo,_pyHypothesis);
|
IMPLEMENT_STANDARD_HANDLE (_pyComplexParamHypo,_pyHypothesis);
|
||||||
IMPLEMENT_STANDARD_HANDLE (_pyNumberOfSegmentsHyp,_pyHypothesis);
|
IMPLEMENT_STANDARD_HANDLE (_pyNumberOfSegmentsHyp,_pyHypothesis);
|
||||||
@ -57,7 +57,7 @@ IMPLEMENT_STANDARD_RTTIEXT(_pyMesh ,_pyObject);
|
|||||||
IMPLEMENT_STANDARD_RTTIEXT(_pySubMesh ,_pyObject);
|
IMPLEMENT_STANDARD_RTTIEXT(_pySubMesh ,_pyObject);
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(_pyMeshEditor ,_pyObject);
|
IMPLEMENT_STANDARD_RTTIEXT(_pyMeshEditor ,_pyObject);
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(_pyHypothesis ,_pyObject);
|
IMPLEMENT_STANDARD_RTTIEXT(_pyHypothesis ,_pyObject);
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(_pyFilterManager ,_pyObject);
|
IMPLEMENT_STANDARD_RTTIEXT(_pySelfEraser ,_pyObject);
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(_pyAlgorithm ,_pyHypothesis);
|
IMPLEMENT_STANDARD_RTTIEXT(_pyAlgorithm ,_pyHypothesis);
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(_pyComplexParamHypo,_pyHypothesis);
|
IMPLEMENT_STANDARD_RTTIEXT(_pyComplexParamHypo,_pyHypothesis);
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(_pyNumberOfSegmentsHyp,_pyHypothesis);
|
IMPLEMENT_STANDARD_RTTIEXT(_pyNumberOfSegmentsHyp,_pyHypothesis);
|
||||||
@ -202,7 +202,6 @@ _pyGen::_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod
|
|||||||
myObjectNames( theObjectNames )
|
myObjectNames( theObjectNames )
|
||||||
{
|
{
|
||||||
myNbCommands = 0;
|
myNbCommands = 0;
|
||||||
myHasPattern = false;
|
|
||||||
// make that GetID() to return TPythonDump::SMESHGenName()
|
// make that GetID() to return TPythonDump::SMESHGenName()
|
||||||
GetCreationCmd()->GetString() += "=";
|
GetCreationCmd()->GetString() += "=";
|
||||||
}
|
}
|
||||||
@ -241,18 +240,11 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
|
|||||||
return aCommand;
|
return aCommand;
|
||||||
|
|
||||||
// SMESH_Gen method?
|
// SMESH_Gen method?
|
||||||
if ( objID == this->GetID() ) {
|
if ( objID == this->GetID() || objID == SMESH_2smeshpy::GenName()) {
|
||||||
this->Process( aCommand );
|
this->Process( aCommand );
|
||||||
return aCommand;
|
return aCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SMESH_subMesh method?
|
|
||||||
map< _pyID, Handle(_pySubMesh) >::iterator id_subMesh = mySubMeshes.find( objID );
|
|
||||||
if ( id_subMesh != mySubMeshes.end() ) {
|
|
||||||
id_subMesh->second->Process( aCommand );
|
|
||||||
return aCommand;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SMESH_Mesh method?
|
// SMESH_Mesh method?
|
||||||
map< _pyID, Handle(_pyMesh) >::iterator id_mesh = myMeshes.find( objID );
|
map< _pyID, Handle(_pyMesh) >::iterator id_mesh = myMeshes.find( objID );
|
||||||
if ( id_mesh != myMeshes.end() ) {
|
if ( id_mesh != myMeshes.end() ) {
|
||||||
@ -267,21 +259,12 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
|
|||||||
else if ( aCommand->GetMethod() == "GetSubMesh" ) { // SubMesh creation
|
else if ( aCommand->GetMethod() == "GetSubMesh" ) { // SubMesh creation
|
||||||
_pyID subMeshID = aCommand->GetResultValue();
|
_pyID subMeshID = aCommand->GetResultValue();
|
||||||
Handle(_pySubMesh) subMesh = new _pySubMesh( aCommand );
|
Handle(_pySubMesh) subMesh = new _pySubMesh( aCommand );
|
||||||
mySubMeshes.insert( make_pair( subMeshID, subMesh ));
|
myObjects.insert( make_pair( subMeshID, subMesh ));
|
||||||
}
|
}
|
||||||
id_mesh->second->Process( aCommand );
|
id_mesh->second->Process( aCommand );
|
||||||
return aCommand;
|
return aCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
//SMESH_FilterManager method?
|
|
||||||
if ( theCommand.Search( "aFilterManager" ) != -1 ) {
|
|
||||||
if ( theCommand.Search( "CreateFilterManager" ) != -1 )
|
|
||||||
myFilterManager = new _pyFilterManager( aCommand );
|
|
||||||
else if ( !myFilterManager.IsNull() )
|
|
||||||
myFilterManager->Process( aCommand );
|
|
||||||
return aCommand;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SMESH_MeshEditor method?
|
// SMESH_MeshEditor method?
|
||||||
map< _pyID, Handle(_pyMeshEditor) >::iterator id_editor = myMeshEditors.find( objID );
|
map< _pyID, Handle(_pyMeshEditor) >::iterator id_editor = myMeshEditors.find( objID );
|
||||||
if ( id_editor != myMeshEditors.end() ) {
|
if ( id_editor != myMeshEditors.end() ) {
|
||||||
@ -303,6 +286,20 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
|
|||||||
return aCommand;
|
return aCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// other object method?
|
||||||
|
map< _pyID, Handle(_pyObject) >::iterator id_obj = myObjects.find( objID );
|
||||||
|
if ( id_obj != myObjects.end() ) {
|
||||||
|
id_obj->second->Process( aCommand );
|
||||||
|
return aCommand;
|
||||||
|
}
|
||||||
|
// if ( theCommand.Search( "aFilterManager" ) != -1 ) {
|
||||||
|
// if ( theCommand.Search( "CreateFilterManager" ) != -1 )
|
||||||
|
// myFilterManager = new _pySelfEraser( aCommand );
|
||||||
|
// else if ( !myFilterManager.IsNull() )
|
||||||
|
// myFilterManager->Process( aCommand );
|
||||||
|
// return aCommand;
|
||||||
|
// }
|
||||||
|
|
||||||
// Add access to a wrapped mesh
|
// Add access to a wrapped mesh
|
||||||
AddMeshAccessorMethod( aCommand );
|
AddMeshAccessorMethod( aCommand );
|
||||||
|
|
||||||
@ -397,13 +394,12 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// leave only one smeshgen.GetPattern() in the script
|
// objects erasing creation command if no more it's commands invoked:
|
||||||
if ( method == "GetPattern" ) {
|
// SMESH_Pattern, FilterManager
|
||||||
if ( myHasPattern ) {
|
if ( method == "GetPattern" || method == "CreateFilterManager" ) {
|
||||||
theCommand->Clear();
|
Handle(_pyObject) obj = new _pySelfEraser( theCommand );
|
||||||
return;
|
if ( !myObjects.insert( make_pair( obj->GetID(), obj )).second )
|
||||||
}
|
theCommand->Clear(); // already created
|
||||||
myHasPattern = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Concatenate( [mesh1, ...], ... )
|
// Concatenate( [mesh1, ...], ... )
|
||||||
@ -448,9 +444,6 @@ void _pyGen::Flush()
|
|||||||
// create empty command
|
// create empty command
|
||||||
myLastCommand = new _pyCommand();
|
myLastCommand = new _pyCommand();
|
||||||
|
|
||||||
if ( !myFilterManager.IsNull() )
|
|
||||||
myFilterManager->Flush();
|
|
||||||
|
|
||||||
map< _pyID, Handle(_pyMesh) >::iterator id_mesh = myMeshes.begin();
|
map< _pyID, Handle(_pyMesh) >::iterator id_mesh = myMeshes.begin();
|
||||||
for ( ; id_mesh != myMeshes.end(); ++id_mesh )
|
for ( ; id_mesh != myMeshes.end(); ++id_mesh )
|
||||||
if ( ! id_mesh->second.IsNull() )
|
if ( ! id_mesh->second.IsNull() )
|
||||||
@ -465,10 +458,10 @@ void _pyGen::Flush()
|
|||||||
(*hyp)->GetCreationCmd()->SetObject( SMESH_2smeshpy::GenName() );
|
(*hyp)->GetCreationCmd()->SetObject( SMESH_2smeshpy::GenName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
map< _pyID, Handle(_pySubMesh) >::iterator id_subMesh = mySubMeshes.begin();
|
map< _pyID, Handle(_pyObject) >::iterator id_obj = myObjects.begin();
|
||||||
for ( ; id_subMesh != mySubMeshes.end(); ++id_subMesh )
|
for ( ; id_obj != myObjects.end(); ++id_obj )
|
||||||
if ( ! id_subMesh->second.IsNull() )
|
if ( ! id_obj->second.IsNull() )
|
||||||
id_subMesh->second->Flush();
|
id_obj->second->Flush();
|
||||||
|
|
||||||
myLastCommand->SetOrderNb( ++myNbCommands );
|
myLastCommand->SetOrderNb( ++myNbCommands );
|
||||||
myCommands.push_back( myLastCommand );
|
myCommands.push_back( myLastCommand );
|
||||||
@ -564,12 +557,9 @@ Handle(_pyHypothesis) _pyGen::FindAlgo( const _pyID& theGeom, const _pyID& theMe
|
|||||||
|
|
||||||
Handle(_pySubMesh) _pyGen::FindSubMesh( const _pyID& theSubMeshID )
|
Handle(_pySubMesh) _pyGen::FindSubMesh( const _pyID& theSubMeshID )
|
||||||
{
|
{
|
||||||
map< _pyID, Handle(_pySubMesh) >::iterator id_subMesh = mySubMeshes.begin();
|
map< _pyID, Handle(_pyObject) >::iterator id_subMesh = myObjects.find(theSubMeshID);
|
||||||
for ( ; id_subMesh != mySubMeshes.end(); ++id_subMesh ) {
|
if ( id_subMesh != myObjects.end() )
|
||||||
Handle(_pySubMesh) sm = id_subMesh->second;
|
return Handle(_pySubMesh)::DownCast( id_subMesh->second );
|
||||||
if ( !id_subMesh->second.IsNull() && theSubMeshID == id_subMesh->second->GetID() )
|
|
||||||
return sm;
|
|
||||||
}
|
|
||||||
return Handle(_pySubMesh)();
|
return Handle(_pySubMesh)();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1279,11 +1269,37 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th
|
|||||||
else if ( hypType == "TrianglePreference" ) {
|
else if ( hypType == "TrianglePreference" ) {
|
||||||
hyp->SetConvMethodAndType( "TrianglePreference", "Quadrangle_2D");
|
hyp->SetConvMethodAndType( "TrianglePreference", "Quadrangle_2D");
|
||||||
}
|
}
|
||||||
|
// BLSURF ----------
|
||||||
|
else if ( hypType == "BLSURF" ) {
|
||||||
|
algo->SetConvMethodAndType( "Triangle", hypType.ToCString());
|
||||||
|
algo->myArgs.Append( "algo=smesh.BLSURF" );
|
||||||
|
}
|
||||||
|
else if ( hypType == "BLSURF_Parameters") {
|
||||||
|
hyp->SetConvMethodAndType( "Parameters", "BLSURF");
|
||||||
|
}
|
||||||
// NETGEN ----------
|
// NETGEN ----------
|
||||||
// else if ( hypType == "NETGEN_2D") { // 1D-2D
|
else if ( hypType == "NETGEN_2D") { // 1D-2D
|
||||||
// algo->SetConvMethodAndType( "Triangle" , hypType.ToCString());
|
algo->SetConvMethodAndType( "Triangle" , hypType.ToCString());
|
||||||
// algo->myArgs.Append( "algo=smesh.NETGEN" );
|
algo->myArgs.Append( "algo=smesh.NETGEN" );
|
||||||
// }
|
}
|
||||||
|
else if ( hypType == "NETGEN_Parameters_2D") {
|
||||||
|
hyp->SetConvMethodAndType( "Parameters", "NETGEN_2D");
|
||||||
|
}
|
||||||
|
else if ( hypType == "NETGEN_SimpleParameters_2D") {
|
||||||
|
hyp->SetConvMethodAndType( "Parameters", "NETGEN_2D");
|
||||||
|
hyp->myArgs.Append( "which=SIMPLE" );
|
||||||
|
}
|
||||||
|
else if ( hypType == "NETGEN_2D3D") { // 1D-2D-3D
|
||||||
|
algo->SetConvMethodAndType( "Tetrahedron" , hypType.ToCString());
|
||||||
|
algo->myArgs.Append( "algo=smesh.FULL_NETGEN" );
|
||||||
|
}
|
||||||
|
else if ( hypType == "NETGEN_Parameters") {
|
||||||
|
hyp->SetConvMethodAndType( "Parameters", "NETGEN_2D3D");
|
||||||
|
}
|
||||||
|
else if ( hypType == "NETGEN_SimpleParameters_3D") {
|
||||||
|
hyp->SetConvMethodAndType( "Parameters", "NETGEN_2D3D");
|
||||||
|
hyp->myArgs.Append( "which=SIMPLE" );
|
||||||
|
}
|
||||||
else if ( hypType == "NETGEN_2D_ONLY") { // 2D
|
else if ( hypType == "NETGEN_2D_ONLY") { // 2D
|
||||||
algo->SetConvMethodAndType( "Triangle" , hypType.ToCString());
|
algo->SetConvMethodAndType( "Triangle" , hypType.ToCString());
|
||||||
algo->myArgs.Append( "algo=smesh.NETGEN_2D" );
|
algo->myArgs.Append( "algo=smesh.NETGEN_2D" );
|
||||||
@ -1301,8 +1317,11 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th
|
|||||||
algo->SetConvMethodAndType( "Tetrahedron", hypType.ToCString());
|
algo->SetConvMethodAndType( "Tetrahedron", hypType.ToCString());
|
||||||
algo->myArgs.Append( "algo=smesh.GHS3D" );
|
algo->myArgs.Append( "algo=smesh.GHS3D" );
|
||||||
}
|
}
|
||||||
|
else if ( hypType == "GHS3D_Parameters") {
|
||||||
|
hyp->SetConvMethodAndType( "Parameters", "GHS3D_3D");
|
||||||
|
}
|
||||||
// Hexa_3D ---------
|
// Hexa_3D ---------
|
||||||
else if ( hypType == "Hexa_3D" ) {
|
else if ( hypType == "BLSURF" ) {
|
||||||
algo->SetConvMethodAndType( "Hexahedron", hypType.ToCString());
|
algo->SetConvMethodAndType( "Hexahedron", hypType.ToCString());
|
||||||
}
|
}
|
||||||
// Repetitive Projection_1D ---------
|
// Repetitive Projection_1D ---------
|
||||||
@ -1944,9 +1963,9 @@ const TCollection_AsciiString & _pyCommand::GetObject()
|
|||||||
int nb1 = 0; // number of ' character at the left of =
|
int nb1 = 0; // number of ' character at the left of =
|
||||||
int nb2 = 0; // number of " character at the left of =
|
int nb2 = 0; // number of " character at the left of =
|
||||||
for ( int i = 1; i < begPos-1; i++ ) {
|
for ( int i = 1; i < begPos-1; i++ ) {
|
||||||
if ( IsEqual(myString.Value( i ), "'" ) )
|
if ( myString.Value( i )=='\'' )
|
||||||
nb1 += 1;
|
nb1 += 1;
|
||||||
else if ( IsEqual( myString.Value( i ), '"' ) )
|
else if ( myString.Value( i )=='"' )
|
||||||
nb2 += 1;
|
nb2 += 1;
|
||||||
}
|
}
|
||||||
// if number of ' or " is not divisible by 2,
|
// if number of ' or " is not divisible by 2,
|
||||||
@ -1954,8 +1973,22 @@ const TCollection_AsciiString & _pyCommand::GetObject()
|
|||||||
if ( nb1 % 2 != 0 || nb2 % 2 != 0 )
|
if ( nb1 % 2 != 0 || nb2 % 2 != 0 )
|
||||||
begPos = 1;
|
begPos = 1;
|
||||||
}
|
}
|
||||||
// store
|
|
||||||
myObj = GetWord( myString, begPos, true );
|
myObj = GetWord( myString, begPos, true );
|
||||||
|
// check if object is complex,
|
||||||
|
// so far consider case like "smesh.smesh.Method()"
|
||||||
|
if ( int bracketPos = myString.Location( "(", begPos, Length() )) {
|
||||||
|
//if ( bracketPos==0 ) bracketPos = Length();
|
||||||
|
int dotPos = begPos+myObj.Length();
|
||||||
|
while ( dotPos+1 < bracketPos ) {
|
||||||
|
if ( int pos = myString.Location( ".", dotPos+1, bracketPos ))
|
||||||
|
dotPos = pos;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ( dotPos > begPos+myObj.Length() )
|
||||||
|
myObj = myString.SubString( begPos, dotPos-1 );
|
||||||
|
}
|
||||||
|
// store
|
||||||
SetBegPos( OBJECT_IND, begPos );
|
SetBegPos( OBJECT_IND, begPos );
|
||||||
}
|
}
|
||||||
//SCRUTE(myObj);
|
//SCRUTE(myObj);
|
||||||
@ -2307,52 +2340,16 @@ _pyID _pyObject::FatherID(const _pyID & childID)
|
|||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief FilterManager creates only if at least one command invoked
|
* \brief SelfEraser erases creation command if no more it's commands invoked
|
||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
_pyFilterManager::_pyFilterManager(const Handle(_pyCommand)& theCreationCmd):
|
void _pySelfEraser::Flush()
|
||||||
_pyObject( theCreationCmd ),
|
|
||||||
myCmdCount( 0 )
|
|
||||||
{
|
{
|
||||||
}
|
if ( GetNbCalls() == 0 )
|
||||||
|
|
||||||
//================================================================================
|
|
||||||
/*!
|
|
||||||
* \brief count invoked commands
|
|
||||||
*/
|
|
||||||
//================================================================================
|
|
||||||
|
|
||||||
void _pyFilterManager::Process( const Handle(_pyCommand)& /*theCommand*/)
|
|
||||||
{
|
|
||||||
myCmdCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//================================================================================
|
|
||||||
/*!
|
|
||||||
* \brief Clear creatin command if no commands invoked
|
|
||||||
*/
|
|
||||||
//================================================================================
|
|
||||||
|
|
||||||
void _pyFilterManager::Flush()
|
|
||||||
{
|
|
||||||
if ( !myCmdCount )
|
|
||||||
GetCreationCmd()->Clear();
|
GetCreationCmd()->Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//================================================================================
|
|
||||||
/*!
|
|
||||||
* \brief SubMesh creation can be moved to the end of engine commands
|
|
||||||
*/
|
|
||||||
//================================================================================
|
|
||||||
|
|
||||||
_pySubMesh::_pySubMesh(const Handle(_pyCommand)& theCreationCmd):
|
|
||||||
_pyObject( theCreationCmd ),
|
|
||||||
myCmdCount( 0 )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief count invoked commands
|
* \brief count invoked commands
|
||||||
@ -2361,7 +2358,7 @@ _pySubMesh::_pySubMesh(const Handle(_pyCommand)& theCreationCmd):
|
|||||||
|
|
||||||
void _pySubMesh::Process( const Handle(_pyCommand)& theCommand )
|
void _pySubMesh::Process( const Handle(_pyCommand)& theCommand )
|
||||||
{
|
{
|
||||||
myCmdCount++;
|
_pyObject::Process(theCommand); // count calls of Process()
|
||||||
GetCreationCmd()->AddDependantCmd( theCommand );
|
GetCreationCmd()->AddDependantCmd( theCommand );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2373,7 +2370,7 @@ void _pySubMesh::Process( const Handle(_pyCommand)& theCommand )
|
|||||||
|
|
||||||
void _pySubMesh::Flush()
|
void _pySubMesh::Flush()
|
||||||
{
|
{
|
||||||
if ( !myCmdCount ) // move to the end of all commands
|
if ( GetNbCalls() == 0 ) // move to the end of all commands
|
||||||
theGen->GetLastCommand()->AddDependantCmd( GetCreationCmd() );
|
theGen->GetLastCommand()->AddDependantCmd( GetCreationCmd() );
|
||||||
else if ( !myCreator.IsNull() )
|
else if ( !myCreator.IsNull() )
|
||||||
// move to be just after creator
|
// move to be just after creator
|
||||||
|
@ -147,21 +147,24 @@ public:
|
|||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/*!
|
/*!
|
||||||
* \brief Root of all objects
|
* \brief Root of all objects. It counts calls of Process()
|
||||||
*/
|
*/
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class _pyObject: public Standard_Transient
|
class _pyObject: public Standard_Transient
|
||||||
{
|
{
|
||||||
Handle(_pyCommand) myCreationCmd;
|
Handle(_pyCommand) myCreationCmd;
|
||||||
|
int myNbCalls;
|
||||||
public:
|
public:
|
||||||
_pyObject(const Handle(_pyCommand)& theCreationCmd): myCreationCmd(theCreationCmd) {}
|
_pyObject(const Handle(_pyCommand)& theCreationCmd)
|
||||||
|
: myCreationCmd(theCreationCmd), myNbCalls(0) {}
|
||||||
const _pyID& GetID() { return myCreationCmd->GetResultValue(); }
|
const _pyID& GetID() { return myCreationCmd->GetResultValue(); }
|
||||||
static _pyID FatherID(const _pyID & childID);
|
static _pyID FatherID(const _pyID & childID);
|
||||||
const Handle(_pyCommand)& GetCreationCmd() { return myCreationCmd; }
|
const Handle(_pyCommand)& GetCreationCmd() { return myCreationCmd; }
|
||||||
|
int GetNbCalls() const { return myNbCalls; }
|
||||||
void SetCreationCmd( Handle(_pyCommand) cmd ) { myCreationCmd = cmd; }
|
void SetCreationCmd( Handle(_pyCommand) cmd ) { myCreationCmd = cmd; }
|
||||||
int GetCommandNb() { return myCreationCmd->GetOrderNb(); }
|
int GetCommandNb() { return myCreationCmd->GetOrderNb(); }
|
||||||
virtual void Process(const Handle(_pyCommand) & theCommand) = 0;
|
virtual void Process(const Handle(_pyCommand) & theCommand) { myNbCalls++; }
|
||||||
virtual void Flush() = 0;
|
virtual void Flush() = 0;
|
||||||
virtual const char* AccessorMethod() const;
|
virtual const char* AccessorMethod() const;
|
||||||
|
|
||||||
@ -205,16 +208,15 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::map< _pyID, Handle(_pyMesh) > myMeshes;
|
std::map< _pyID, Handle(_pyMesh) > myMeshes;
|
||||||
std::map< _pyID, Handle(_pySubMesh) > mySubMeshes;
|
//std::map< _pyID, Handle(_pySubMesh) > mySubMeshes;
|
||||||
std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors;
|
std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors;
|
||||||
|
std::map< _pyID, Handle(_pyObject) > myObjects;
|
||||||
std::list< Handle(_pyHypothesis) > myHypos;
|
std::list< Handle(_pyHypothesis) > myHypos;
|
||||||
std::list< Handle(_pyCommand) > myCommands;
|
std::list< Handle(_pyCommand) > myCommands;
|
||||||
int myNbCommands;
|
int myNbCommands;
|
||||||
bool myHasPattern;
|
|
||||||
Resource_DataMapOfAsciiStringAsciiString& myID2AccessorMethod;
|
Resource_DataMapOfAsciiStringAsciiString& myID2AccessorMethod;
|
||||||
Resource_DataMapOfAsciiStringAsciiString& myObjectNames;
|
Resource_DataMapOfAsciiStringAsciiString& myObjectNames;
|
||||||
Handle(_pyCommand) myLastCommand;
|
Handle(_pyCommand) myLastCommand;
|
||||||
Handle(_pyFilterManager) myFilterManager;
|
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTI (_pyGen)
|
DEFINE_STANDARD_RTTI (_pyGen)
|
||||||
};
|
};
|
||||||
@ -416,20 +418,18 @@ DEFINE_STANDARD_HANDLE (_pySegmentLengthAroundVertexHyp, _pyHypothesis);
|
|||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/*!
|
/*!
|
||||||
* \brief FilterManager creates only if at least one command invoked
|
* \brief SelfEraser erases creation command if no more it's commands invoked
|
||||||
*/
|
*/
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
class _pyFilterManager: public _pyObject
|
class _pySelfEraser: public _pyObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
_pyFilterManager(const Handle(_pyCommand)& theCreationCmd);
|
_pySelfEraser(const Handle(_pyCommand)& theCreationCmd):_pyObject(theCreationCmd) {}
|
||||||
void Process( const Handle(_pyCommand)& theCommand);
|
|
||||||
virtual void Flush();
|
virtual void Flush();
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTI (_pyFilterManager)
|
DEFINE_STANDARD_RTTI (_pySelfEraser)
|
||||||
private:
|
|
||||||
int myCmdCount;
|
|
||||||
};
|
};
|
||||||
|
DEFINE_STANDARD_HANDLE (_pySelfEraser, _pyObject);
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
/*!
|
/*!
|
||||||
@ -439,14 +439,13 @@ private:
|
|||||||
class _pySubMesh: public _pyObject
|
class _pySubMesh: public _pyObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
_pySubMesh(const Handle(_pyCommand)& theCreationCmd);
|
_pySubMesh(const Handle(_pyCommand)& theCreationCmd):_pyObject(theCreationCmd) {}
|
||||||
void Process( const Handle(_pyCommand)& theCommand);
|
void Process( const Handle(_pyCommand)& theCommand);
|
||||||
virtual void Flush();
|
virtual void Flush();
|
||||||
void SetCreator( const Handle(_pyObject)& theCreator ) { myCreator = theCreator; }
|
void SetCreator( const Handle(_pyObject)& theCreator ) { myCreator = theCreator; }
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTI (_pyFilterManager)
|
DEFINE_STANDARD_RTTI (_pySubMesh)
|
||||||
private:
|
private:
|
||||||
int myCmdCount;
|
|
||||||
Handle(_pyObject) myCreator;
|
Handle(_pyObject) myCreator;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user