mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-27 22:10:34 +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_QuadraticFaceOfNodes.hxx"
|
||||||
#include "SMDS_VolumeTool.hxx"
|
#include "SMDS_VolumeTool.hxx"
|
||||||
#include "SMESHDS_GroupBase.hxx"
|
#include "SMESHDS_GroupBase.hxx"
|
||||||
|
#include "SMESHDS_GroupOnFilter.hxx"
|
||||||
#include "SMESHDS_Mesh.hxx"
|
#include "SMESHDS_Mesh.hxx"
|
||||||
#include "SMESH_OctreeNode.hxx"
|
|
||||||
#include "SMESH_MeshAlgos.hxx"
|
#include "SMESH_MeshAlgos.hxx"
|
||||||
|
#include "SMESH_OctreeNode.hxx"
|
||||||
|
|
||||||
#include <Basics_Utils.hxx>
|
#include <Basics_Utils.hxx>
|
||||||
|
|
||||||
@ -2650,7 +2651,7 @@ GroupColor::GroupColor()
|
|||||||
|
|
||||||
bool GroupColor::IsSatisfy( long theId )
|
bool GroupColor::IsSatisfy( long theId )
|
||||||
{
|
{
|
||||||
return (myIDs.find( theId ) != myIDs.end());
|
return myIDs.count( theId );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupColor::SetType( SMDSAbs_ElementType theType )
|
void GroupColor::SetType( SMDSAbs_ElementType theType )
|
||||||
@ -2676,7 +2677,7 @@ static bool isEqual( const Quantity_Color& theColor1,
|
|||||||
void GroupColor::SetMesh( const SMDS_Mesh* theMesh )
|
void GroupColor::SetMesh( const SMDS_Mesh* theMesh )
|
||||||
{
|
{
|
||||||
myIDs.clear();
|
myIDs.clear();
|
||||||
|
|
||||||
const SMESHDS_Mesh* aMesh = dynamic_cast<const SMESHDS_Mesh*>(theMesh);
|
const SMESHDS_Mesh* aMesh = dynamic_cast<const SMESHDS_Mesh*>(theMesh);
|
||||||
if ( !aMesh )
|
if ( !aMesh )
|
||||||
return;
|
return;
|
||||||
@ -2684,20 +2685,24 @@ void GroupColor::SetMesh( const SMDS_Mesh* theMesh )
|
|||||||
int nbGrp = aMesh->GetNbGroups();
|
int nbGrp = aMesh->GetNbGroups();
|
||||||
if ( !nbGrp )
|
if ( !nbGrp )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// iterates on groups and find necessary elements ids
|
// iterates on groups and find necessary elements ids
|
||||||
const std::set<SMESHDS_GroupBase*>& aGroups = aMesh->GetGroups();
|
const std::set<SMESHDS_GroupBase*>& aGroups = aMesh->GetGroups();
|
||||||
set<SMESHDS_GroupBase*>::const_iterator GrIt = aGroups.begin();
|
set<SMESHDS_GroupBase*>::const_iterator GrIt = aGroups.begin();
|
||||||
for (; GrIt != aGroups.end(); GrIt++) {
|
for (; GrIt != aGroups.end(); GrIt++)
|
||||||
|
{
|
||||||
SMESHDS_GroupBase* aGrp = (*GrIt);
|
SMESHDS_GroupBase* aGrp = (*GrIt);
|
||||||
if ( !aGrp )
|
if ( !aGrp )
|
||||||
continue;
|
continue;
|
||||||
// check type and color of group
|
// check type and color of group
|
||||||
if ( !isEqual( myColor, aGrp->GetColor() ) )
|
if ( !isEqual( myColor, aGrp->GetColor() ))
|
||||||
continue;
|
|
||||||
if ( myType != SMDSAbs_All && myType != (SMDSAbs_ElementType)aGrp->GetType() )
|
|
||||||
continue;
|
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();
|
SMDSAbs_ElementType aGrpElType = (SMDSAbs_ElementType)aGrp->GetType();
|
||||||
if ( myType == aGrpElType || (myType == SMDSAbs_All && aGrpElType != SMDSAbs_Node) ) {
|
if ( myType == aGrpElType || (myType == SMDSAbs_All && aGrpElType != SMDSAbs_Node) ) {
|
||||||
// add elements IDS into control
|
// add elements IDS into control
|
||||||
|
@ -839,8 +839,8 @@ BelongToGeom_i::BelongToGeom_i()
|
|||||||
|
|
||||||
BelongToGeom_i::~BelongToGeom_i()
|
BelongToGeom_i::~BelongToGeom_i()
|
||||||
{
|
{
|
||||||
delete myShapeName;
|
CORBA::string_free( myShapeName );
|
||||||
delete myShapeID;
|
CORBA::string_free( myShapeID );
|
||||||
}
|
}
|
||||||
|
|
||||||
void BelongToGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
|
void BelongToGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
|
||||||
@ -872,18 +872,18 @@ FunctorType BelongToGeom_i::GetFunctorType()
|
|||||||
|
|
||||||
void BelongToGeom_i::SetShapeName( const char* theName )
|
void BelongToGeom_i::SetShapeName( const char* theName )
|
||||||
{
|
{
|
||||||
delete myShapeName;
|
CORBA::string_free( myShapeName );
|
||||||
myShapeName = strdup( theName );
|
myShapeName = CORBA::string_dup( theName );
|
||||||
myBelongToGeomPtr->SetGeom( getShapeByName( myShapeName ) );
|
myBelongToGeomPtr->SetGeom( getShapeByName( myShapeName ) );
|
||||||
TPythonDump()<<this<<".SetShapeName('"<<theName<<"')";
|
TPythonDump()<<this<<".SetShapeName('"<<theName<<"')";
|
||||||
}
|
}
|
||||||
|
|
||||||
void BelongToGeom_i::SetShape( const char* theID, const char* theName )
|
void BelongToGeom_i::SetShape( const char* theID, const char* theName )
|
||||||
{
|
{
|
||||||
delete myShapeName;
|
CORBA::string_free( myShapeName );
|
||||||
delete myShapeID;
|
CORBA::string_free( myShapeID );
|
||||||
myShapeName = strdup( theName );
|
myShapeName = CORBA::string_dup( theName );
|
||||||
myShapeID = strdup( theID );
|
myShapeID = CORBA::string_dup( theID );
|
||||||
bool hasName = ( theName && theName[0] );
|
bool hasName = ( theName && theName[0] );
|
||||||
bool hasID = ( theID && theID[0] );
|
bool hasID = ( theID && theID[0] );
|
||||||
|
|
||||||
@ -937,8 +937,8 @@ BelongToSurface_i::BelongToSurface_i( const Handle(Standard_Type)& theSurfaceTyp
|
|||||||
|
|
||||||
BelongToSurface_i::~BelongToSurface_i()
|
BelongToSurface_i::~BelongToSurface_i()
|
||||||
{
|
{
|
||||||
delete myShapeName;
|
CORBA::string_free( myShapeName );
|
||||||
delete myShapeID;
|
CORBA::string_free( myShapeID );
|
||||||
}
|
}
|
||||||
|
|
||||||
void BelongToSurface_i::SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType )
|
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 )
|
void BelongToSurface_i::SetShapeName( const char* theName, ElementType theType )
|
||||||
{
|
{
|
||||||
delete myShapeName;
|
CORBA::string_free( myShapeName );
|
||||||
myShapeName = strdup( theName );
|
myShapeName = CORBA::string_dup( theName );
|
||||||
myElementsOnSurfacePtr->SetSurface( getShapeByName( myShapeName ), (SMDSAbs_ElementType)theType );
|
myElementsOnSurfacePtr->SetSurface( getShapeByName( myShapeName ), (SMDSAbs_ElementType)theType );
|
||||||
TPythonDump()<<this<<".SetShapeName('"<<theName<<"',"<<theType<<")";
|
TPythonDump()<<this<<".SetShapeName('"<<theName<<"',"<<theType<<")";
|
||||||
}
|
}
|
||||||
|
|
||||||
void BelongToSurface_i::SetShape( const char* theID, const char* theName, ElementType theType )
|
void BelongToSurface_i::SetShape( const char* theID, const char* theName, ElementType theType )
|
||||||
{
|
{
|
||||||
delete myShapeName;
|
CORBA::string_free( myShapeName );
|
||||||
delete myShapeID;
|
CORBA::string_free( myShapeID );
|
||||||
myShapeName = strdup( theName );
|
myShapeName = CORBA::string_dup( theName );
|
||||||
myShapeID = strdup( theID );
|
myShapeID = CORBA::string_dup( theID );
|
||||||
bool hasName = ( theName && theName[0] );
|
bool hasName = ( theName && theName[0] );
|
||||||
bool hasID = ( theID && theID[0] );
|
bool hasID = ( theID && theID[0] );
|
||||||
|
|
||||||
@ -1109,8 +1109,8 @@ LyingOnGeom_i::LyingOnGeom_i()
|
|||||||
|
|
||||||
LyingOnGeom_i::~LyingOnGeom_i()
|
LyingOnGeom_i::~LyingOnGeom_i()
|
||||||
{
|
{
|
||||||
delete myShapeName;
|
CORBA::string_free( myShapeName );
|
||||||
delete myShapeID;
|
CORBA::string_free( myShapeID );
|
||||||
}
|
}
|
||||||
|
|
||||||
void LyingOnGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
|
void LyingOnGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
|
||||||
@ -1141,20 +1141,20 @@ FunctorType LyingOnGeom_i::GetFunctorType()
|
|||||||
|
|
||||||
void LyingOnGeom_i::SetShapeName( const char* theName )
|
void LyingOnGeom_i::SetShapeName( const char* theName )
|
||||||
{
|
{
|
||||||
delete myShapeName;
|
CORBA::string_free( myShapeName );
|
||||||
myShapeName = strdup( theName );
|
myShapeName = CORBA::string_dup( theName );
|
||||||
myLyingOnGeomPtr->SetGeom( getShapeByName( myShapeName ) );
|
myLyingOnGeomPtr->SetGeom( getShapeByName( myShapeName ) );
|
||||||
TPythonDump()<<this<<".SetShapeName('"<<theName<<"')";
|
TPythonDump()<<this<<".SetShapeName('"<<theName<<"')";
|
||||||
}
|
}
|
||||||
|
|
||||||
void LyingOnGeom_i::SetShape( const char* theID, const char* theName )
|
void LyingOnGeom_i::SetShape( const char* theID, const char* theName )
|
||||||
{
|
{
|
||||||
delete myShapeName;
|
CORBA::string_free( myShapeName );
|
||||||
delete myShapeID;
|
CORBA::string_free( myShapeID );
|
||||||
myShapeName = strdup( theName );
|
myShapeName = CORBA::string_dup( theName );
|
||||||
myShapeID = strdup( theID );
|
myShapeID = CORBA::string_dup( theID );
|
||||||
bool hasName = ( theName && theName[0] );
|
bool hasName = ( theName && theName[0] );
|
||||||
bool hasID = ( theID && theID[0] );
|
bool hasID = ( theID && theID[0] );
|
||||||
|
|
||||||
TopoDS_Shape S;
|
TopoDS_Shape S;
|
||||||
if ( hasName && hasID )
|
if ( hasName && hasID )
|
||||||
@ -3672,7 +3672,7 @@ static LDOM_Element createFilterItem( const char* theName,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
FilterLibrary_i::FilterLibrary_i( const char* theFileName )
|
FilterLibrary_i::FilterLibrary_i( const char* theFileName )
|
||||||
{
|
{
|
||||||
myFileName = strdup( theFileName );
|
myFileName = CORBA::string_dup( theFileName );
|
||||||
SMESH::FilterManager_i* aFilterMgr = new SMESH::FilterManager_i();
|
SMESH::FilterManager_i* aFilterMgr = new SMESH::FilterManager_i();
|
||||||
myFilterMgr = aFilterMgr->_this();
|
myFilterMgr = aFilterMgr->_this();
|
||||||
|
|
||||||
@ -3713,7 +3713,7 @@ FilterLibrary_i::FilterLibrary_i()
|
|||||||
|
|
||||||
FilterLibrary_i::~FilterLibrary_i()
|
FilterLibrary_i::~FilterLibrary_i()
|
||||||
{
|
{
|
||||||
delete myFileName;
|
CORBA::string_free( myFileName );
|
||||||
//TPythonDump()<<this<<".UnRegister()";
|
//TPythonDump()<<this<<".UnRegister()";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3765,7 +3765,7 @@ Filter_ptr FilterLibrary_i::Copy( const char* theFilterName )
|
|||||||
{
|
{
|
||||||
char a[ 255 ];
|
char a[ 255 ];
|
||||||
sprintf( a, "%d", val );
|
sprintf( a, "%d", val );
|
||||||
aCriterion.ThresholdStr = strdup( a );
|
aCriterion.ThresholdStr = CORBA::string_dup( a );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
aCriterion.ThresholdStr = str.GetString();
|
aCriterion.ThresholdStr = str.GetString();
|
||||||
@ -3796,8 +3796,8 @@ Filter_ptr FilterLibrary_i::Copy( const char* theFilterName )
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void FilterLibrary_i::SetFileName( const char* theFileName )
|
void FilterLibrary_i::SetFileName( const char* theFileName )
|
||||||
{
|
{
|
||||||
delete myFileName;
|
CORBA::string_free( myFileName );
|
||||||
myFileName = strdup( theFileName );
|
myFileName = CORBA::string_dup( theFileName );
|
||||||
TPythonDump()<<this<<".SetFileName('"<<theFileName<<"')";
|
TPythonDump()<<this<<".SetFileName('"<<theFileName<<"')";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4981,6 +4981,13 @@ omniORB.registerObjref(SMESH._objref_SMESH_MeshEditor._NP_RepositoryId, meshEdit
|
|||||||
#
|
#
|
||||||
class Pattern(SMESH._objref_SMESH_Pattern):
|
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):
|
def ApplyToMeshFaces(self, theMesh, theFacesIDs, theNodeIndexOnKeyPoint1, theReverse):
|
||||||
decrFun = lambda i: i-1
|
decrFun = lambda i: i-1
|
||||||
theNodeIndexOnKeyPoint1,Parameters,hasVars = ParseParameters(theNodeIndexOnKeyPoint1, decrFun)
|
theNodeIndexOnKeyPoint1,Parameters,hasVars = ParseParameters(theNodeIndexOnKeyPoint1, decrFun)
|
||||||
@ -4993,6 +5000,11 @@ class Pattern(SMESH._objref_SMESH_Pattern):
|
|||||||
theMesh.SetParameters(Parameters)
|
theMesh.SetParameters(Parameters)
|
||||||
return SMESH._objref_SMESH_Pattern.ApplyToHexahedrons( self, theMesh, theVolumesIDs, theNode000Index, theNode001Index )
|
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
|
# Registering the new proxy for Pattern
|
||||||
omniORB.registerObjref(SMESH._objref_SMESH_Pattern._NP_RepositoryId, Pattern)
|
omniORB.registerObjref(SMESH._objref_SMESH_Pattern._NP_RepositoryId, Pattern)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user