mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-28 18:30:35 +05:00
PAL13473 (Build repetitive mesh):
fix problem with 1) not wrapped mesh as hypo parameter 2) removal of repeated settings of "Nb.Segments" hypo
This commit is contained in:
parent
cd861753b0
commit
b25e607851
@ -188,17 +188,10 @@ void _pyGen::AddCommand( const TCollection_AsciiString& theCommand)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add access to a wrapped mesh
|
// Add access to a wrapped mesh
|
||||||
for ( id_mesh = myMeshes.begin(); id_mesh != myMeshes.end(); ++id_mesh ) {
|
AddMeshAccessorMethod( aCommand );
|
||||||
if ( aCommand->AddAccessorMethod( id_mesh->first, id_mesh->second->AccessorMethod() ))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add access to a wrapped algorithm
|
// Add access to a wrapped algorithm
|
||||||
for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp ) {
|
AddAlgoAccessorMethod( aCommand );
|
||||||
if ( (*hyp)->IsAlgo() &&
|
|
||||||
aCommand->AddAccessorMethod( (*hyp)->GetID(), (*hyp)->AccessorMethod() ))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// PAL12227. PythonDump was not updated at proper time; result is
|
// PAL12227. PythonDump was not updated at proper time; result is
|
||||||
// aCriteria.append(SMESH.Filter.Criterion(17,26,0,'L1',26,25,1e-07,SMESH.EDGE,-1))
|
// aCriteria.append(SMESH.Filter.Criterion(17,26,0,'L1',26,25,1e-07,SMESH.EDGE,-1))
|
||||||
@ -297,6 +290,43 @@ void _pyGen::Flush()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Add access method to mesh that is object or arg
|
||||||
|
* \param theCmd - command to add access method
|
||||||
|
* \retval bool - true if added
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
bool _pyGen::AddMeshAccessorMethod( Handle(_pyCommand) theCmd ) const
|
||||||
|
{
|
||||||
|
map< _pyID, Handle(_pyMesh) >::const_iterator id_mesh = myMeshes.begin();
|
||||||
|
for ( ; id_mesh != myMeshes.end(); ++id_mesh ) {
|
||||||
|
if ( theCmd->AddAccessorMethod( id_mesh->first, id_mesh->second->AccessorMethod() ))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Add access method to algo that is object or arg
|
||||||
|
* \param theCmd - command to add access method
|
||||||
|
* \retval bool - true if added
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
bool _pyGen::AddAlgoAccessorMethod( Handle(_pyCommand) theCmd ) const
|
||||||
|
{
|
||||||
|
list< Handle(_pyHypothesis) >::const_iterator hyp = myHypos.begin();
|
||||||
|
for ( ; hyp != myHypos.end(); ++hyp ) {
|
||||||
|
if ( (*hyp)->IsAlgo() &&
|
||||||
|
theCmd->AddAccessorMethod( (*hyp)->GetID(), (*hyp)->AccessorMethod() ))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Find hypothesis by ID (entry)
|
* \brief Find hypothesis by ID (entry)
|
||||||
@ -945,10 +975,26 @@ void _pyHypothesis::Process( const Handle(_pyCommand)& theCommand)
|
|||||||
void _pyHypothesis::Flush()
|
void _pyHypothesis::Flush()
|
||||||
{
|
{
|
||||||
if ( IsWrapped() ) {
|
if ( IsWrapped() ) {
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
list < Handle(_pyCommand) >::iterator cmd = myArgCommands.begin();
|
||||||
|
for ( ; cmd != myArgCommands.end(); ++cmd ) {
|
||||||
|
// Add access to a wrapped mesh
|
||||||
|
theGen->AddMeshAccessorMethod( *cmd );
|
||||||
|
// Add access to a wrapped algorithm
|
||||||
|
theGen->AddAlgoAccessorMethod( *cmd );
|
||||||
|
}
|
||||||
|
cmd = myUnknownCommands.begin();
|
||||||
|
for ( ; cmd != myUnknownCommands.end(); ++cmd ) {
|
||||||
|
// Add access to a wrapped mesh
|
||||||
|
theGen->AddMeshAccessorMethod( *cmd );
|
||||||
|
// Add access to a wrapped algorithm
|
||||||
|
theGen->AddAlgoAccessorMethod( *cmd );
|
||||||
|
}
|
||||||
|
}
|
||||||
// forget previous hypothesis modifications
|
// forget previous hypothesis modifications
|
||||||
myArgCommands.clear();
|
myArgCommands.clear();
|
||||||
myUnknownCommands.clear();
|
myUnknownCommands.clear();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -1150,15 +1196,27 @@ bool _pyNumberOfSegmentsHyp::Addition2Creation( const Handle(_pyCommand)& theCmd
|
|||||||
|
|
||||||
void _pyNumberOfSegmentsHyp::Flush()
|
void _pyNumberOfSegmentsHyp::Flush()
|
||||||
{
|
{
|
||||||
const int nbCmdLists = 2;
|
// find number of the last SetDistrType() command
|
||||||
list<Handle(_pyCommand)> * cmds[nbCmdLists] = { &myArgCommands, &myUnknownCommands };
|
list<Handle(_pyCommand)>::reverse_iterator cmd = myUnknownCommands.rbegin();
|
||||||
for ( int i = 0; i < nbCmdLists; ++i ) {
|
int distrTypeNb = 0;
|
||||||
|
for ( ; !distrTypeNb && cmd != myUnknownCommands.rend(); ++cmd )
|
||||||
|
if ( (*cmd)->GetMethod() == "SetDistrType" )
|
||||||
|
distrTypeNb = (*cmd)->GetOrderNb();
|
||||||
|
|
||||||
|
// clear commands before the last SetDistrType()
|
||||||
|
list<Handle(_pyCommand)> * cmds[2] = { &myArgCommands, &myUnknownCommands };
|
||||||
|
for ( int i = 0; i < 2; ++i ) {
|
||||||
set<TCollection_AsciiString> uniqueMethods;
|
set<TCollection_AsciiString> uniqueMethods;
|
||||||
list<Handle(_pyCommand)> & cmdList = *cmds[i];
|
list<Handle(_pyCommand)> & cmdList = *cmds[i];
|
||||||
list<Handle(_pyCommand)>::reverse_iterator cmd = cmdList.rbegin();
|
for ( cmd = cmdList.rbegin(); cmd != cmdList.rend(); ++cmd )
|
||||||
for ( ; cmd != cmdList.rend(); ++cmd ) {
|
{
|
||||||
bool isNewInSet = uniqueMethods.insert( (*cmd)->GetMethod() ).second;
|
bool clear = ( (*cmd)->GetOrderNb() < distrTypeNb );
|
||||||
if ( ! isNewInSet )
|
const TCollection_AsciiString& method = (*cmd)->GetMethod();
|
||||||
|
if ( !clear || method == "SetNumberOfSegments" ) {
|
||||||
|
bool isNewInSet = uniqueMethods.insert( method ).second;
|
||||||
|
clear = !isNewInSet;
|
||||||
|
}
|
||||||
|
if ( clear )
|
||||||
(*cmd)->Clear();
|
(*cmd)->Clear();
|
||||||
}
|
}
|
||||||
cmdList.clear();
|
cmdList.clear();
|
||||||
|
@ -201,6 +201,8 @@ public:
|
|||||||
void SetCommandAfter( Handle(_pyCommand) theCmd, Handle(_pyCommand) theAfterCmd );
|
void SetCommandAfter( Handle(_pyCommand) theCmd, Handle(_pyCommand) theAfterCmd );
|
||||||
std::list< Handle(_pyCommand) >& GetCommands() { return myCommands; }
|
std::list< Handle(_pyCommand) >& GetCommands() { return myCommands; }
|
||||||
void SetAccessorMethod(const _pyID& theID, const char* theMethod );
|
void SetAccessorMethod(const _pyID& theID, const char* theMethod );
|
||||||
|
bool AddMeshAccessorMethod( Handle(_pyCommand) theCmd ) const;
|
||||||
|
bool AddAlgoAccessorMethod( Handle(_pyCommand) theCmd ) const;
|
||||||
const char* AccessorMethod() const { return SMESH_2smeshpy::GenName(); }
|
const char* AccessorMethod() const { return SMESH_2smeshpy::GenName(); }
|
||||||
private:
|
private:
|
||||||
std::map< _pyID, Handle(_pyMesh) > myMeshes;
|
std::map< _pyID, Handle(_pyMesh) > myMeshes;
|
||||||
|
Loading…
Reference in New Issue
Block a user