mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-12 00:29:17 +05:00
IPAL52867: Crash at attempt to create group by 'Color of Group' filter
This commit is contained in:
parent
6f7386be59
commit
07589de92e
@ -31,9 +31,10 @@
|
||||
#include "SMDS_QuadraticFaceOfNodes.hxx"
|
||||
#include "SMDS_VolumeTool.hxx"
|
||||
#include "SMESHDS_GroupBase.hxx"
|
||||
#include "SMESHDS_GroupOnFilter.hxx"
|
||||
#include "SMESHDS_Mesh.hxx"
|
||||
#include "SMESH_OctreeNode.hxx"
|
||||
#include "SMESH_MeshAlgos.hxx"
|
||||
#include "SMESH_OctreeNode.hxx"
|
||||
|
||||
#include <Basics_Utils.hxx>
|
||||
|
||||
@ -2650,7 +2651,7 @@ GroupColor::GroupColor()
|
||||
|
||||
bool GroupColor::IsSatisfy( long theId )
|
||||
{
|
||||
return (myIDs.find( theId ) != myIDs.end());
|
||||
return myIDs.count( theId );
|
||||
}
|
||||
|
||||
void GroupColor::SetType( SMDSAbs_ElementType theType )
|
||||
@ -2688,16 +2689,20 @@ void GroupColor::SetMesh( const SMDS_Mesh* theMesh )
|
||||
// iterates on groups and find necessary elements ids
|
||||
const std::set<SMESHDS_GroupBase*>& aGroups = aMesh->GetGroups();
|
||||
set<SMESHDS_GroupBase*>::const_iterator GrIt = aGroups.begin();
|
||||
for (; GrIt != aGroups.end(); GrIt++) {
|
||||
for (; GrIt != aGroups.end(); GrIt++)
|
||||
{
|
||||
SMESHDS_GroupBase* aGrp = (*GrIt);
|
||||
if ( !aGrp )
|
||||
continue;
|
||||
// check type and color of group
|
||||
if ( !isEqual( myColor, aGrp->GetColor() ) )
|
||||
continue;
|
||||
if ( myType != SMDSAbs_All && myType != (SMDSAbs_ElementType)aGrp->GetType() )
|
||||
if ( !isEqual( myColor, aGrp->GetColor() ))
|
||||
continue;
|
||||
|
||||
// IPAL52867 (prevent infinite recursion via GroupOnFilter)
|
||||
if ( SMESHDS_GroupOnFilter * gof = dynamic_cast< SMESHDS_GroupOnFilter* >( aGrp ))
|
||||
if ( gof->GetPredicate().get() == this )
|
||||
continue;
|
||||
|
||||
SMDSAbs_ElementType aGrpElType = (SMDSAbs_ElementType)aGrp->GetType();
|
||||
if ( myType == aGrpElType || (myType == SMDSAbs_All && aGrpElType != SMDSAbs_Node) ) {
|
||||
// add elements IDS into control
|
||||
|
@ -839,8 +839,8 @@ BelongToGeom_i::BelongToGeom_i()
|
||||
|
||||
BelongToGeom_i::~BelongToGeom_i()
|
||||
{
|
||||
delete myShapeName;
|
||||
delete myShapeID;
|
||||
CORBA::string_free( myShapeName );
|
||||
CORBA::string_free( myShapeID );
|
||||
}
|
||||
|
||||
void BelongToGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
|
||||
@ -872,18 +872,18 @@ FunctorType BelongToGeom_i::GetFunctorType()
|
||||
|
||||
void BelongToGeom_i::SetShapeName( const char* theName )
|
||||
{
|
||||
delete myShapeName;
|
||||
myShapeName = strdup( theName );
|
||||
CORBA::string_free( myShapeName );
|
||||
myShapeName = CORBA::string_dup( theName );
|
||||
myBelongToGeomPtr->SetGeom( getShapeByName( myShapeName ) );
|
||||
TPythonDump()<<this<<".SetShapeName('"<<theName<<"')";
|
||||
}
|
||||
|
||||
void BelongToGeom_i::SetShape( const char* theID, const char* theName )
|
||||
{
|
||||
delete myShapeName;
|
||||
delete myShapeID;
|
||||
myShapeName = strdup( theName );
|
||||
myShapeID = strdup( theID );
|
||||
CORBA::string_free( myShapeName );
|
||||
CORBA::string_free( myShapeID );
|
||||
myShapeName = CORBA::string_dup( theName );
|
||||
myShapeID = CORBA::string_dup( theID );
|
||||
bool hasName = ( theName && theName[0] );
|
||||
bool hasID = ( theID && theID[0] );
|
||||
|
||||
@ -937,8 +937,8 @@ BelongToSurface_i::BelongToSurface_i( const Handle(Standard_Type)& theSurfaceTyp
|
||||
|
||||
BelongToSurface_i::~BelongToSurface_i()
|
||||
{
|
||||
delete myShapeName;
|
||||
delete myShapeID;
|
||||
CORBA::string_free( myShapeName );
|
||||
CORBA::string_free( myShapeID );
|
||||
}
|
||||
|
||||
void BelongToSurface_i::SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType )
|
||||
@ -964,18 +964,18 @@ void BelongToSurface_i::SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType t
|
||||
|
||||
void BelongToSurface_i::SetShapeName( const char* theName, ElementType theType )
|
||||
{
|
||||
delete myShapeName;
|
||||
myShapeName = strdup( theName );
|
||||
CORBA::string_free( myShapeName );
|
||||
myShapeName = CORBA::string_dup( theName );
|
||||
myElementsOnSurfacePtr->SetSurface( getShapeByName( myShapeName ), (SMDSAbs_ElementType)theType );
|
||||
TPythonDump()<<this<<".SetShapeName('"<<theName<<"',"<<theType<<")";
|
||||
}
|
||||
|
||||
void BelongToSurface_i::SetShape( const char* theID, const char* theName, ElementType theType )
|
||||
{
|
||||
delete myShapeName;
|
||||
delete myShapeID;
|
||||
myShapeName = strdup( theName );
|
||||
myShapeID = strdup( theID );
|
||||
CORBA::string_free( myShapeName );
|
||||
CORBA::string_free( myShapeID );
|
||||
myShapeName = CORBA::string_dup( theName );
|
||||
myShapeID = CORBA::string_dup( theID );
|
||||
bool hasName = ( theName && theName[0] );
|
||||
bool hasID = ( theID && theID[0] );
|
||||
|
||||
@ -1109,8 +1109,8 @@ LyingOnGeom_i::LyingOnGeom_i()
|
||||
|
||||
LyingOnGeom_i::~LyingOnGeom_i()
|
||||
{
|
||||
delete myShapeName;
|
||||
delete myShapeID;
|
||||
CORBA::string_free( myShapeName );
|
||||
CORBA::string_free( myShapeID );
|
||||
}
|
||||
|
||||
void LyingOnGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
|
||||
@ -1141,20 +1141,20 @@ FunctorType LyingOnGeom_i::GetFunctorType()
|
||||
|
||||
void LyingOnGeom_i::SetShapeName( const char* theName )
|
||||
{
|
||||
delete myShapeName;
|
||||
myShapeName = strdup( theName );
|
||||
CORBA::string_free( myShapeName );
|
||||
myShapeName = CORBA::string_dup( theName );
|
||||
myLyingOnGeomPtr->SetGeom( getShapeByName( myShapeName ) );
|
||||
TPythonDump()<<this<<".SetShapeName('"<<theName<<"')";
|
||||
}
|
||||
|
||||
void LyingOnGeom_i::SetShape( const char* theID, const char* theName )
|
||||
{
|
||||
delete myShapeName;
|
||||
delete myShapeID;
|
||||
myShapeName = strdup( theName );
|
||||
myShapeID = strdup( theID );
|
||||
CORBA::string_free( myShapeName );
|
||||
CORBA::string_free( myShapeID );
|
||||
myShapeName = CORBA::string_dup( theName );
|
||||
myShapeID = CORBA::string_dup( theID );
|
||||
bool hasName = ( theName && theName[0] );
|
||||
bool hasID = ( theID && theID[0] );
|
||||
bool hasID = ( theID && theID[0] );
|
||||
|
||||
TopoDS_Shape S;
|
||||
if ( hasName && hasID )
|
||||
@ -3672,7 +3672,7 @@ static LDOM_Element createFilterItem( const char* theName,
|
||||
//=======================================================================
|
||||
FilterLibrary_i::FilterLibrary_i( const char* theFileName )
|
||||
{
|
||||
myFileName = strdup( theFileName );
|
||||
myFileName = CORBA::string_dup( theFileName );
|
||||
SMESH::FilterManager_i* aFilterMgr = new SMESH::FilterManager_i();
|
||||
myFilterMgr = aFilterMgr->_this();
|
||||
|
||||
@ -3713,7 +3713,7 @@ FilterLibrary_i::FilterLibrary_i()
|
||||
|
||||
FilterLibrary_i::~FilterLibrary_i()
|
||||
{
|
||||
delete myFileName;
|
||||
CORBA::string_free( myFileName );
|
||||
//TPythonDump()<<this<<".UnRegister()";
|
||||
}
|
||||
|
||||
@ -3765,7 +3765,7 @@ Filter_ptr FilterLibrary_i::Copy( const char* theFilterName )
|
||||
{
|
||||
char a[ 255 ];
|
||||
sprintf( a, "%d", val );
|
||||
aCriterion.ThresholdStr = strdup( a );
|
||||
aCriterion.ThresholdStr = CORBA::string_dup( a );
|
||||
}
|
||||
else
|
||||
aCriterion.ThresholdStr = str.GetString();
|
||||
@ -3796,8 +3796,8 @@ Filter_ptr FilterLibrary_i::Copy( const char* theFilterName )
|
||||
//=======================================================================
|
||||
void FilterLibrary_i::SetFileName( const char* theFileName )
|
||||
{
|
||||
delete myFileName;
|
||||
myFileName = strdup( theFileName );
|
||||
CORBA::string_free( myFileName );
|
||||
myFileName = CORBA::string_dup( theFileName );
|
||||
TPythonDump()<<this<<".SetFileName('"<<theFileName<<"')";
|
||||
}
|
||||
|
||||
|
@ -4981,6 +4981,13 @@ omniORB.registerObjref(SMESH._objref_SMESH_MeshEditor._NP_RepositoryId, meshEdit
|
||||
#
|
||||
class Pattern(SMESH._objref_SMESH_Pattern):
|
||||
|
||||
def LoadFromFile(self, patternTextOrFile ):
|
||||
text = patternTextOrFile
|
||||
if os.path.exists( text ):
|
||||
text = open( patternTextOrFile ).read()
|
||||
pass
|
||||
return SMESH._objref_SMESH_Pattern.LoadFromFile( self, text )
|
||||
|
||||
def ApplyToMeshFaces(self, theMesh, theFacesIDs, theNodeIndexOnKeyPoint1, theReverse):
|
||||
decrFun = lambda i: i-1
|
||||
theNodeIndexOnKeyPoint1,Parameters,hasVars = ParseParameters(theNodeIndexOnKeyPoint1, decrFun)
|
||||
@ -4993,6 +5000,11 @@ class Pattern(SMESH._objref_SMESH_Pattern):
|
||||
theMesh.SetParameters(Parameters)
|
||||
return SMESH._objref_SMESH_Pattern.ApplyToHexahedrons( self, theMesh, theVolumesIDs, theNode000Index, theNode001Index )
|
||||
|
||||
def MakeMesh(self, mesh, CreatePolygons=False, CreatePolyhedra=False):
|
||||
if isinstance( mesh, Mesh ):
|
||||
mesh = mesh.GetMesh()
|
||||
return SMESH._objref_SMESH_Pattern.MakeMesh( self, mesh, CreatePolygons, CreatePolyhedra )
|
||||
|
||||
# Registering the new proxy for Pattern
|
||||
omniORB.registerObjref(SMESH._objref_SMESH_Pattern._NP_RepositoryId, Pattern)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user