+ myElementsOnSurfacePtr->SetTolerance( theToler );
+ TPythonDump()<<this<<".SetTolerance("<<theToler<<")";
+}
+
+CORBA::Double BelongToSurface_i::GetTolerance()
+{
+ return myElementsOnSurfacePtr->GetTolerance();
+}
+
+void BelongToSurface_i::SetUseBoundaries( CORBA::Boolean theUseBndRestrictions )
+{
+ myElementsOnSurfacePtr->SetUseBoundaries( theUseBndRestrictions );
+ TPythonDump()<<this<<".SetUseBoundaries( " << theUseBndRestrictions << " )";
+}
+
+CORBA::Boolean BelongToSurface_i::GetUseBoundaries()
+{
+ return myElementsOnSurfacePtr->GetUseBoundaries();
+}
+
+
+/*
+ Class : BelongToPlane_i
+ Description : Verify whether mesh element lie in pointed Geom planar object
+*/
+
+BelongToPlane_i::BelongToPlane_i()
+: BelongToSurface_i( STANDARD_TYPE( Geom_Plane ) )
+{
+}
+
+void BelongToPlane_i::SetPlane( GEOM::GEOM_Object_ptr theGeom, ElementType theType )
+{
+ BelongToSurface_i::SetSurface( theGeom, theType );
+ TPythonDump()<<this<<".SetPlane("<<theGeom<<","<<theType<<")";
+}
+
+FunctorType BelongToPlane_i::GetFunctorType()
+{
+ return FT_BelongToPlane;
+}
+
+/*
+ Class : BelongToCylinder_i
+ Description : Verify whether mesh element lie in pointed Geom planar object
+*/
+
+BelongToCylinder_i::BelongToCylinder_i()
+: BelongToSurface_i( STANDARD_TYPE( Geom_CylindricalSurface ) )
+{
+}
+
+void BelongToCylinder_i::SetCylinder( GEOM::GEOM_Object_ptr theGeom, ElementType theType )
+{
+ BelongToSurface_i::SetSurface( theGeom, theType );
+ TPythonDump()<<this<<".SetCylinder("<<theGeom<<","<<theType<<")";
+}
+
+FunctorType BelongToCylinder_i::GetFunctorType()
+{
+ return FT_BelongToCylinder;
+}
+
+/*
+ Class : BelongToGenSurface_i
+ Description : Verify whether mesh element lie in pointed Geom planar object
+*/
+
+BelongToGenSurface_i::BelongToGenSurface_i()
+: BelongToSurface_i( STANDARD_TYPE( Geom_CylindricalSurface ) )
+{
+}
+
+void BelongToGenSurface_i::SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType )
+{
+ if ( theGeom->_is_nil() )
+ return;
+ TopoDS_Shape aLocShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theGeom );
+ if ( !aLocShape.IsNull() && aLocShape.ShapeType() != TopAbs_FACE )
+ aLocShape.Nullify();
+
+ BelongToSurface_i::myElementsOnSurfacePtr->SetSurface( aLocShape, (SMDSAbs_ElementType)theType );
+ TPythonDump()<<this<<".SetGenSurface("<<theGeom<<","<<theType<<")";
+}
+
+FunctorType BelongToGenSurface_i::GetFunctorType()
+{
+ return FT_BelongToGenSurface;
+}
+
+/*
+ Class : LyingOnGeom_i
+ Description : Predicate for selection on geometrical support
+*/
+LyingOnGeom_i::LyingOnGeom_i()
+{
+ myLyingOnGeomPtr.reset( new Controls::LyingOnGeom() );
+ myFunctorPtr = myPredicatePtr = myLyingOnGeomPtr;
+ myShapeName = 0;
+ myShapeID = 0;
+}
+
+LyingOnGeom_i::~LyingOnGeom_i()
+{
+ delete myShapeName;
+ delete myShapeID;
+}
+
+void LyingOnGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
+{
+ if ( theGeom->_is_nil() )
+ return;
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+ GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine();
+ TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
+ myLyingOnGeomPtr->SetGeom( aLocShape );
+ TPythonDump()<<this<<".SetGeom("<<theGeom<<")";
+}
+
+void LyingOnGeom_i::SetGeom( const TopoDS_Shape& theShape )
+{
+ myLyingOnGeomPtr->SetGeom( theShape );
+}
+
+void LyingOnGeom_i::SetElementType(ElementType theType){
+ myLyingOnGeomPtr->SetType(SMDSAbs_ElementType(theType));
+ TPythonDump()<<this<<".SetElementType("<<theType<<")";
+}
+
+FunctorType LyingOnGeom_i::GetFunctorType()
+{
+ return SMESH::FT_LyingOnGeom;
+}
+
+void LyingOnGeom_i::SetShapeName( const char* theName )
+{
+ delete myShapeName;
+ myShapeName = strdup( theName );
+ myLyingOnGeomPtr->SetGeom( getShapeByName( myShapeName ) );
+ TPythonDump()<<this<<".SetShapeName('"<<theName<<"')";
+}
+
+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) );
+ else
+ myLyingOnGeomPtr->SetGeom( getShapeByName( myShapeName ) );
+}
+
+char* LyingOnGeom_i::GetShapeName()
+{
+ return CORBA::string_dup( myShapeName );
+}
+
+char* LyingOnGeom_i::GetShapeID()
+{
+ return CORBA::string_dup( myShapeID );
+}
+
+void LyingOnGeom_i::SetTolerance( CORBA::Double theToler )
+{
+ myLyingOnGeomPtr->SetTolerance( theToler );
+ TPythonDump()<<this<<".SetTolerance("<<theToler<<")";
+}
+
+CORBA::Double LyingOnGeom_i::GetTolerance()
+{
+ return myLyingOnGeomPtr->GetTolerance();
+}
+
+/*
+ Class : FreeBorders_i
+ Description : Predicate for free borders
+*/
+FreeBorders_i::FreeBorders_i()
+{
+ myPredicatePtr.reset(new Controls::FreeBorders());
+ myFunctorPtr = myPredicatePtr;
+}
+
+FunctorType FreeBorders_i::GetFunctorType()
+{
+ return SMESH::FT_FreeBorders;
+}
+
+/*
+ Class : FreeEdges_i
+ Description : Predicate for free borders
+*/
+FreeEdges_i::FreeEdges_i()
+: myFreeEdgesPtr( new Controls::FreeEdges() )
+{
+ myFunctorPtr = myPredicatePtr = myFreeEdgesPtr;
+}
+
+SMESH::FreeEdges::Borders* FreeEdges_i::GetBorders()
+{
+ INFOS("FreeEdges_i::GetBorders");
+ SMESH::Controls::FreeEdges::TBorders aBorders;
+ myFreeEdgesPtr->GetBoreders( aBorders );
+
+ long i = 0, iEnd = aBorders.size();
+
+ SMESH::FreeEdges::Borders_var aResult = new SMESH::FreeEdges::Borders;
+ aResult->length(iEnd);
+
+ SMESH::Controls::FreeEdges::TBorders::const_iterator anIter;
+ for ( anIter = aBorders.begin() ; anIter != aBorders.end(); anIter++, i++ )
+ {
+ const SMESH::Controls::FreeEdges::Border& aBord = *anIter;
+ SMESH::FreeEdges::Border &aBorder = aResult[ i ];
+
+ aBorder.myElemId = aBord.myElemId;
+ aBorder.myPnt1 = aBord.myPntId[ 0 ];
+ aBorder.myPnt2 = aBord.myPntId[ 1 ];
+ }
+
+ INFOS("FreeEdges_i::GetBorders~");
+ return aResult._retn();
+}
+
+FunctorType FreeEdges_i::GetFunctorType()
+{
+ return SMESH::FT_FreeEdges;
+}
+
+/*
+ Class : FreeFaces_i
+ Description : Predicate for free faces
+*/
+FreeFaces_i::FreeFaces_i()
+{
+ myPredicatePtr.reset(new Controls::FreeFaces());
+ myFunctorPtr = myPredicatePtr;
+}
+
+FunctorType FreeFaces_i::GetFunctorType()
+{
+ return SMESH::FT_FreeFaces;
+}
+
+/*
+ Class : FreeNodes_i
+ Description : Predicate for free nodes
+*/
+FreeNodes_i::FreeNodes_i()
+{
+ myPredicatePtr.reset(new Controls::FreeNodes());
+ myFunctorPtr = myPredicatePtr;
+}
+
+FunctorType FreeNodes_i::GetFunctorType()
+{
+ return SMESH::FT_FreeNodes;
+}
+
+/*
+ Class : EqualNodes_i
+ Description : Predicate for Equal nodes
+*/
+EqualNodes_i::EqualNodes_i()
+{
+ myCoincidentNodesPtr.reset(new Controls::CoincidentNodes());
+ myFunctorPtr = myPredicatePtr = myCoincidentNodesPtr;
+}
+
+FunctorType EqualNodes_i::GetFunctorType()
+{
+ return SMESH::FT_EqualNodes;
+}
+
+void EqualNodes_i::SetTolerance( double tol )
+{
+ myCoincidentNodesPtr->SetTolerance( tol );
+}
+
+double EqualNodes_i::GetTolerance()
+{
+ return myCoincidentNodesPtr->GetTolerance();
+}
+
+/*
+ Class : EqualEdges_i
+ Description : Predicate for Equal Edges
+*/
+EqualEdges_i::EqualEdges_i()
+{
+ myPredicatePtr.reset(new Controls::CoincidentElements1D());
+ myFunctorPtr = myPredicatePtr;
+}
+
+FunctorType EqualEdges_i::GetFunctorType()
+{
+ return SMESH::FT_EqualEdges;
+}
+
+/*
+ Class : EqualFaces_i
+ Description : Predicate for Equal Faces
+*/
+EqualFaces_i::EqualFaces_i()
+{
+ myPredicatePtr.reset(new Controls::CoincidentElements2D());
+ myFunctorPtr = myPredicatePtr;
+}
+
+FunctorType EqualFaces_i::GetFunctorType()
+{
+ return SMESH::FT_EqualFaces;
+}
+
+/*
+ Class : EqualVolumes_i
+ Description : Predicate for Equal Volumes
+*/
+EqualVolumes_i::EqualVolumes_i()
+{
+ myPredicatePtr.reset(new Controls::CoincidentElements3D());
+ myFunctorPtr = myPredicatePtr;
+}
+
+FunctorType EqualVolumes_i::GetFunctorType()
+{
+ return SMESH::FT_EqualVolumes;
+}
+
+
+/*
+ Class : RangeOfIds_i
+ Description : Predicate for Range of Ids.
+ Range may be specified with two ways.
+ 1. Using AddToRange method
+ 2. With SetRangeStr method. Parameter of this method is a string
+ like as "1,2,3,50-60,63,67,70-"
+*/
+
+RangeOfIds_i::RangeOfIds_i()
+{
+ myRangeOfIdsPtr.reset( new Controls::RangeOfIds() );
+ myFunctorPtr = myPredicatePtr = myRangeOfIdsPtr;
+}
+
+void RangeOfIds_i::SetRange( const SMESH::long_array& theIds )
+{
+ CORBA::Long iEnd = theIds.length();
+ for ( CORBA::Long i = 0; i < iEnd; i++ )
+ myRangeOfIdsPtr->AddToRange( theIds[ i ] );
+ TPythonDump()<<this<<".SetRange("<<theIds<<")";
+}
+
+CORBA::Boolean RangeOfIds_i::SetRangeStr( const char* theRange )
+{
+ TPythonDump()<<this<<".SetRangeStr('"<<theRange<<"')";
+ return myRangeOfIdsPtr->SetRangeStr(
+ TCollection_AsciiString( (Standard_CString)theRange ) );
+}
+
+char* RangeOfIds_i::GetRangeStr()
+{
+ TCollection_AsciiString aStr;
+ myRangeOfIdsPtr->GetRangeStr( aStr );
+ return CORBA::string_dup( aStr.ToCString() );
+}
+
+void RangeOfIds_i::SetElementType( ElementType theType )
+{
+ myRangeOfIdsPtr->SetType( SMDSAbs_ElementType( theType ) );
+ TPythonDump()<<this<<".SetElementType("<<theType<<")";