-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
myBelongToGeomPtr->SetGeom( theShape );
}
-void BelongToGeom_i::SetElementType(ElementType theType){
+void BelongToGeom_i::SetElementType(ElementType theType)
+{
myBelongToGeomPtr->SetType(SMDSAbs_ElementType(theType));
TPythonDump()<<this<<".SetElementType("<<theType<<")";
}
void BelongToGeom_i::SetShape( const char* theID, const char* theName )
{
delete myShapeName;
- myShapeName = strdup( theName );
delete myShapeID;
- if ( theID )
- myShapeID = strdup( theID );
- else
- myShapeID = 0;
+ myShapeName = strdup( theName );
+ myShapeID = strdup( theID );
+ bool hasName = ( theName && theName[0] );
+ bool hasID = ( theID && theID[0] );
- if ( myShapeID && myShapeName == getShapeNameByID(myShapeID))
- myBelongToGeomPtr->SetGeom( getShapeByID(myShapeID) );
+ TopoDS_Shape S;
+ if ( hasName && hasID )
+ {
+ S = getShapeByID( myShapeID );
+ if ( S.IsNull() )
+ S = getShapeByName( myShapeName );
+ }
else
- myBelongToGeomPtr->SetGeom( getShapeByName( myShapeName ) );
+ {
+ S = hasID ? getShapeByID( myShapeID ) : getShapeByName( myShapeName );
+ }
+ myBelongToGeomPtr->SetGeom( S );
}
char* BelongToGeom_i::GetShapeName()
void BelongToSurface_i::SetShape( const char* theID, const char* theName, ElementType theType )
{
delete myShapeName;
- myShapeName = strdup( theName );
delete myShapeID;
- if ( theID )
- myShapeID = strdup( theID );
- else
- myShapeID = 0;
-
- if ( myShapeID && myShapeName == getShapeNameByID(myShapeID))
- myElementsOnSurfacePtr->SetSurface( getShapeByID(myShapeID), (SMDSAbs_ElementType)theType );
+ myShapeName = strdup( theName );
+ myShapeID = strdup( theID );
+ bool hasName = ( theName && theName[0] );
+ bool hasID = ( theID && theID[0] );
+
+ TopoDS_Shape S;
+ if ( hasName && hasID )
+ {
+ S = getShapeByID( myShapeID );
+ if ( S.IsNull() )
+ S = getShapeByName( myShapeName );
+ }
else
- myElementsOnSurfacePtr->SetSurface( getShapeByName( myShapeName ), (SMDSAbs_ElementType)theType );
+ {
+ S = hasID ? getShapeByID( myShapeID ) : getShapeByName( myShapeName );
+ }
+ myElementsOnSurfacePtr->SetSurface( S, (SMDSAbs_ElementType)theType );
}
char* BelongToSurface_i::GetShapeName()
void LyingOnGeom_i::SetShape( const char* theID, const char* theName )
{
delete myShapeName;
- myShapeName = strdup( theName );
delete myShapeID;
- if ( theID )
- myShapeID = strdup( theID );
- else
- myShapeID = 0;
-
- if ( myShapeID && myShapeName == getShapeNameByID(myShapeID))
- myLyingOnGeomPtr->SetGeom( getShapeByID(myShapeID) );
+ myShapeName = strdup( theName );
+ myShapeID = strdup( theID );
+ bool hasName = ( theName && theName[0] );
+ bool hasID = ( theID && theID[0] );
+
+ TopoDS_Shape S;
+ if ( hasName && hasID )
+ {
+ S = getShapeByID( myShapeID );
+ if ( S.IsNull() )
+ S = getShapeByName( myShapeName );
+ }
else
- myLyingOnGeomPtr->SetGeom( getShapeByName( myShapeName ) );
+ {
+ S = hasID ? getShapeByID( myShapeID ) : getShapeByName( myShapeName );
+ }
+ myLyingOnGeomPtr->SetGeom( S );
}
char* LyingOnGeom_i::GetShapeName()
{
SMESH::long_array_var anArray = new SMESH::long_array;
if(!CORBA::is_nil(theMesh) && myPredicate){
+ theMesh->Load();
Controls::Filter::TIdSequence aSequence;
GetElementsId(myPredicate,theMesh,aSequence);
long i = 0, iEnd = aSequence.size();
static const char** getFunctNames()
{
- static const char* functName[ SMESH::FT_Undefined + 1 ] = {
+ static const char* functName[] = {
// IT's necessary to update this array according to enum FunctorType (SMESH_Filter.idl)
// The order is IMPORTANT !!!
"FT_AspectRatio",
"FT_LogicalAND",
"FT_LogicalOR",
"FT_Undefined"};
+
+#ifdef _DEBUG_
+ // check if functName is complete, compilation failure mains that enum FunctorType changed
+ const int nbFunctors = sizeof(functName) / sizeof(const char*);
+ int _assert[( nbFunctors == SMESH::FT_Undefined + 1 ) ? 1 : -1 ];
+#endif
+
return functName;
}