X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_Filter_i.cxx;h=b6cde44c68776ac9070eb5bde0332285738eeac2;hp=a5c073f29dd364497cbebc5192633d2e001f88f7;hb=b199783795fbf2181eff59cc7b879ed60459f975;hpb=090aff07266d376ae028ae43434bdea7c0a0f9bb diff --git a/src/SMESH_I/SMESH_Filter_i.cxx b/src/SMESH_I/SMESH_Filter_i.cxx index a5c073f29..b6cde44c6 100644 --- a/src/SMESH_I/SMESH_Filter_i.cxx +++ b/src/SMESH_I/SMESH_Filter_i.cxx @@ -1,34 +1,33 @@ -// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses +// Copyright (C) 2007-2008 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 // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : SMESH_Filter_i.cxx // Author : Alexey Petrov, OCC // Module : SMESH - - +// #include "SMESH_Filter_i.hxx" #include "SMESH_Gen_i.hxx" +#include "SMESH_PythonDump.hxx" #include "SMDS_Mesh.hxx" #include "SMDS_MeshNode.hxx" @@ -36,62 +35,122 @@ #include "SMESHDS_Mesh.hxx" +#include +#include +#include +#include +#include #include #include #include -#include -#include #include -#include +#include #include +#include #include #include -#include #include -#include -#include -#include -#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include +#include +#include using namespace SMESH; using namespace SMESH::Controls; + +namespace SMESH +{ + Predicate_i* + GetPredicate( Predicate_ptr thePredicate ) + { + return DownCast(thePredicate); + } +} + + /* Class : BelongToGeom - Description : Predicate for verifying whether entiy belong to + Description : Predicate for verifying whether entity belongs to specified geometrical support */ Controls::BelongToGeom::BelongToGeom() -: myMeshDS(NULL), - myType(SMDSAbs_All) + : myMeshDS(NULL), + myType(SMDSAbs_All), + myIsSubshape(false), + myTolerance(Precision::Confusion()) {} -void Controls::BelongToGeom::SetMesh( SMDS_Mesh* theMesh ) +void Controls::BelongToGeom::SetMesh( const SMDS_Mesh* theMesh ) { - myMeshDS = dynamic_cast(theMesh); + myMeshDS = dynamic_cast(theMesh); + init(); } void Controls::BelongToGeom::SetGeom( const TopoDS_Shape& theShape ) { myShape = theShape; + init(); +} + +static bool IsSubShape (const TopTools_IndexedMapOfShape& theMap, + const TopoDS_Shape& theShape) +{ + if (theMap.Contains(theShape)) return true; + + if (theShape.ShapeType() == TopAbs_COMPOUND || + theShape.ShapeType() == TopAbs_COMPSOLID) + { + TopoDS_Iterator anIt (theShape, Standard_True, Standard_True); + for (; anIt.More(); anIt.Next()) + { + if (!IsSubShape(theMap, anIt.Value())) { + return false; + } + } + return true; + } + + return false; +} + +void Controls::BelongToGeom::init() +{ + if (!myMeshDS || myShape.IsNull()) return; + + // is subshape of main shape? + TopoDS_Shape aMainShape = myMeshDS->ShapeToMesh(); + if (aMainShape.IsNull()) { + myIsSubshape = false; + } + else { + TopTools_IndexedMapOfShape aMap; + TopExp::MapShapes(aMainShape, aMap); + myIsSubshape = IsSubShape(aMap, myShape); + } + + if (!myIsSubshape) + { + myElementsOnShapePtr.reset(new Controls::ElementsOnShape()); + myElementsOnShapePtr->SetTolerance(myTolerance); + myElementsOnShapePtr->SetAllNodes(true); // belong, while false means "lays on" + myElementsOnShapePtr->SetMesh(myMeshDS); + myElementsOnShapePtr->SetShape(myShape, myType); + } } -static bool IsContains( SMESHDS_Mesh* theMeshDS, +static bool IsContains( const SMESHDS_Mesh* theMeshDS, const TopoDS_Shape& theShape, const SMDS_MeshElement* theElem, TopAbs_ShapeEnum theFindShapeEnum, TopAbs_ShapeEnum theAvoidShapeEnum = TopAbs_SHAPE ) { TopExp_Explorer anExp( theShape,theFindShapeEnum,theAvoidShapeEnum ); - + while( anExp.More() ) { const TopoDS_Shape& aShape = anExp.Current(); @@ -104,12 +163,18 @@ static bool IsContains( SMESHDS_Mesh* theMeshDS, return false; } -bool Controls::BelongToGeom::IsSatisfy( long theId ) +bool Controls::BelongToGeom::IsSatisfy (long theId) { - if ( myMeshDS == 0 || myShape.IsNull() ) + if (myMeshDS == 0 || myShape.IsNull()) return false; - if( myType == SMDSAbs_Node ) + if (!myIsSubshape) + { + return myElementsOnShapePtr->IsSatisfy(theId); + } + + // Case of submesh + if (myType == SMDSAbs_Node) { if( const SMDS_MeshNode* aNode = myMeshDS->FindNode( theId ) ) { @@ -147,13 +212,14 @@ bool Controls::BelongToGeom::IsSatisfy( long theId ) } } } - + return false; } -void Controls::BelongToGeom::SetType( SMDSAbs_ElementType theType ) +void Controls::BelongToGeom::SetType (SMDSAbs_ElementType theType) { myType = theType; + init(); } SMDSAbs_ElementType Controls::BelongToGeom::GetType() const @@ -166,11 +232,23 @@ TopoDS_Shape Controls::BelongToGeom::GetShape() return myShape; } -SMESHDS_Mesh* Controls::BelongToGeom::GetMeshDS() +const SMESHDS_Mesh* Controls::BelongToGeom::GetMeshDS() const { return myMeshDS; } +void Controls::BelongToGeom::SetTolerance (double theTolerance) +{ + myTolerance = theTolerance; + if (!myIsSubshape) + init(); +} + +double Controls::BelongToGeom::GetTolerance() +{ + return myTolerance; +} + /* Class : LyingOnGeom Description : Predicate for verifying whether entiy lying or partially lying on @@ -178,18 +256,47 @@ SMESHDS_Mesh* Controls::BelongToGeom::GetMeshDS() */ Controls::LyingOnGeom::LyingOnGeom() -: myMeshDS(NULL), - myType(SMDSAbs_All) + : myMeshDS(NULL), + myType(SMDSAbs_All), + myIsSubshape(false), + myTolerance(Precision::Confusion()) {} -void Controls::LyingOnGeom::SetMesh( SMDS_Mesh* theMesh ) +void Controls::LyingOnGeom::SetMesh( const SMDS_Mesh* theMesh ) { - myMeshDS = dynamic_cast(theMesh); + myMeshDS = dynamic_cast(theMesh); + init(); } void Controls::LyingOnGeom::SetGeom( const TopoDS_Shape& theShape ) { myShape = theShape; + init(); +} + +void Controls::LyingOnGeom::init() +{ + if (!myMeshDS || myShape.IsNull()) return; + + // is subshape of main shape? + TopoDS_Shape aMainShape = myMeshDS->ShapeToMesh(); + if (aMainShape.IsNull()) { + myIsSubshape = false; + } + else { + TopTools_IndexedMapOfShape aMap; + TopExp::MapShapes(aMainShape, aMap); + myIsSubshape = IsSubShape(aMap, myShape); + } + + if (!myIsSubshape) + { + myElementsOnShapePtr.reset(new Controls::ElementsOnShape()); + myElementsOnShapePtr->SetTolerance(myTolerance); + myElementsOnShapePtr->SetAllNodes(false); // lays on, while true means "belong" + myElementsOnShapePtr->SetMesh(myMeshDS); + myElementsOnShapePtr->SetShape(myShape, myType); + } } bool Controls::LyingOnGeom::IsSatisfy( long theId ) @@ -197,6 +304,12 @@ bool Controls::LyingOnGeom::IsSatisfy( long theId ) if ( myMeshDS == 0 || myShape.IsNull() ) return false; + if (!myIsSubshape) + { + return myElementsOnShapePtr->IsSatisfy(theId); + } + + // Case of submesh if( myType == SMDSAbs_Node ) { if( const SMDS_MeshNode* aNode = myMeshDS->FindNode( theId ) ) @@ -235,13 +348,14 @@ bool Controls::LyingOnGeom::IsSatisfy( long theId ) } } } - + return false; } void Controls::LyingOnGeom::SetType( SMDSAbs_ElementType theType ) { myType = theType; + init(); } SMDSAbs_ElementType Controls::LyingOnGeom::GetType() const @@ -254,56 +368,56 @@ TopoDS_Shape Controls::LyingOnGeom::GetShape() return myShape; } -SMESHDS_Mesh* Controls::LyingOnGeom::GetMeshDS() +const SMESHDS_Mesh* Controls::LyingOnGeom::GetMeshDS() const { return myMeshDS; } -bool Controls::LyingOnGeom::Contains( SMESHDS_Mesh* theMeshDS, - const TopoDS_Shape& theShape, - const SMDS_MeshElement* theElem, - TopAbs_ShapeEnum theFindShapeEnum, - TopAbs_ShapeEnum theAvoidShapeEnum ) +void Controls::LyingOnGeom::SetTolerance (double theTolerance) +{ + myTolerance = theTolerance; + if (!myIsSubshape) + init(); +} + +double Controls::LyingOnGeom::GetTolerance() +{ + return myTolerance; +} + +bool Controls::LyingOnGeom::Contains( const SMESHDS_Mesh* theMeshDS, + const TopoDS_Shape& theShape, + const SMDS_MeshElement* theElem, + TopAbs_ShapeEnum theFindShapeEnum, + TopAbs_ShapeEnum theAvoidShapeEnum ) { if (IsContains(theMeshDS, theShape, theElem, theFindShapeEnum, theAvoidShapeEnum)) return true; - - if ( SMESHDS_SubMesh* aSubMesh = theMeshDS->MeshElements( theShape ) ) - { - SMDS_NodeIteratorPtr aNodeIt = aSubMesh->GetNodes(); - while ( aNodeIt->more() ) - { - const SMDS_MeshNode* aNode = static_cast(aNodeIt->next()); - SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator(); - while ( anElemIt->more() ) - { - const SMDS_MeshElement* anElement = static_cast(anElemIt->next()); - if (anElement == theElem) - return true; - } - } - } - - TopExp_Explorer anExp( theShape,TopAbs_VERTEX,theAvoidShapeEnum ); - while( anExp.More() ) + TopTools_IndexedMapOfShape aSubShapes; + TopExp::MapShapes( theShape, aSubShapes ); + + for (int i = 1; i <= aSubShapes.Extent(); i++) { - const TopoDS_Shape& aShape = anExp.Current(); + const TopoDS_Shape& aShape = aSubShapes.FindKey(i); + if( SMESHDS_SubMesh* aSubMesh = theMeshDS->MeshElements( aShape ) ){ + if( aSubMesh->Contains( theElem ) ) + return true; + SMDS_NodeIteratorPtr aNodeIt = aSubMesh->GetNodes(); while ( aNodeIt->more() ) - { - const SMDS_MeshNode* aNode = static_cast(aNodeIt->next()); - SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator(); - while ( anElemIt->more() ) - { - const SMDS_MeshElement* anElement = static_cast(anElemIt->next()); - if (anElement == theElem) - return true; - } - } + { + const SMDS_MeshNode* aNode = static_cast(aNodeIt->next()); + SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator(); + while ( anElemIt->more() ) + { + const SMDS_MeshElement* anElement = static_cast(anElemIt->next()); + if (anElement == theElem) + return true; + } + } } - anExp.Next(); } return false; } @@ -313,14 +427,17 @@ bool Controls::LyingOnGeom::Contains( SMESHDS_Mesh* theMeshDS, AUXILIARY METHODS */ -static inline SMDS_Mesh* MeshPtr2SMDSMesh( SMESH_Mesh_ptr theMesh ) +inline +const SMDS_Mesh* +MeshPtr2SMDSMesh( SMESH_Mesh_ptr theMesh ) { - SMESH_Mesh_i* anImplPtr = - dynamic_cast( SMESH_Gen_i::GetServant( theMesh ).in() ); + SMESH_Mesh_i* anImplPtr = DownCast(theMesh); return anImplPtr ? anImplPtr->GetImpl().GetMeshDS() : 0; } -static inline SMESH::long_array* toArray( const TColStd_ListOfInteger& aList ) +inline +SMESH::long_array* +toArray( const TColStd_ListOfInteger& aList ) { SMESH::long_array_var anArray = new SMESH::long_array; anArray->length( aList.Extent() ); @@ -332,7 +449,9 @@ static inline SMESH::long_array* toArray( const TColStd_ListOfInteger& aList ) return anArray._retn(); } -static inline SMESH::double_array* toArray( const TColStd_ListOfReal& aList ) +inline +SMESH::double_array* +toArray( const TColStd_ListOfReal& aList ) { SMESH::double_array_var anArray = new SMESH::double_array; anArray->length( aList.Extent() ); @@ -354,6 +473,7 @@ static SMESH::Filter::Criterion createCriterion() aCriterion.UnaryOp = FT_Undefined; aCriterion.BinaryOp = FT_Undefined; aCriterion.ThresholdStr = ""; + aCriterion.ThresholdID = ""; aCriterion.Tolerance = Precision::Confusion(); aCriterion.TypeOfElement = SMESH::ALL; aCriterion.Precision = -1; @@ -367,7 +487,7 @@ static TopoDS_Shape getShapeByName( const char* theName ) { SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy(); - if ( aStudy != 0 ) + if (!CORBA::is_nil(aStudy)) { SALOMEDS::Study::ListOfSObject_var aList = aStudy->FindObjectByName( theName, "GEOM" ); @@ -376,7 +496,32 @@ static TopoDS_Shape getShapeByName( const char* theName ) GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow( aList[ 0 ]->GetObject() ); if ( !aGeomObj->_is_nil() ) { - GEOM::GEOM_Gen_var aGEOMGen = SMESH_Gen_i::GetGeomEngine(); + GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine(); + TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, aGeomObj ); + return aLocShape; + } + } + } + } + return TopoDS_Shape(); +} + +static TopoDS_Shape getShapeByID (const char* theID) +{ + if (theID != 0 && theID != "") { + SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); + SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy(); + if (aStudy != 0) { + SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(theID); + SALOMEDS::GenericAttribute_var anAttr; + if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR")) { + SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + CORBA::String_var aVal = anIOR->Value(); + CORBA::Object_var obj = aStudy->ConvertIORToObject(aVal); + GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(obj); + + if (!aGeomObj->_is_nil()) { + GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine(); TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, aGeomObj ); return aLocShape; } @@ -386,7 +531,26 @@ static TopoDS_Shape getShapeByName( const char* theName ) return TopoDS_Shape(); } +static char* getShapeNameByID (const char* theID) +{ + char* aName = ""; + + if (theID != 0 && theID != "") { + SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); + SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy(); + if (aStudy != 0) { + //SALOMEDS::SObject_var aSObj = aStudy->FindObjectIOR( theID ); + SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(theID); + SALOMEDS::GenericAttribute_var anAttr; + if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeName")) { + SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow(anAttr); + aName = aNameAttr->Value(); + } + } + } + return aName; +} /* FUNCTORS @@ -394,18 +558,25 @@ static TopoDS_Shape getShapeByName( const char* theName ) /* Class : Functor_i - Description : An abstact class for all functors + Description : An abstact class for all functors */ -Functor_i::Functor_i(): +Functor_i::Functor_i(): SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() ) { - SMESH_Gen_i::GetPOA()->activate_object( this ); + //Base class Salome_GenericObject do it inmplicitly by overriding PortableServer::POA_ptr _default_POA() method + //PortableServer::ObjectId_var anObjectId = + // SMESH_Gen_i::GetPOA()->activate_object( this ); +} + +Functor_i::~Functor_i() +{ + //TPythonDump()<SetMesh( MeshPtr2SMDSMesh( theMesh ) ); - INFOS("Functor_i::SetMesh~"); + TPythonDump()<SetPrecision( thePrecision ); + TPythonDump()<GetValues( aValues ); - + long i = 0, iEnd = aValues.size(); SMESH::Length2D::Values_var aResult = new SMESH::Length2D::Values(iEnd); @@ -594,11 +781,10 @@ SMESH::Length2D::Values* Length2D_i::GetValues() { const SMESH::Controls::Length2D::Value& aVal = *anIter; SMESH::Length2D::Value &aValue = aResult[ i ]; - + aValue.myLength = aVal.myLength; aValue.myPnt1 = aVal.myPntId[ 0 ]; aValue.myPnt2 = aVal.myPntId[ 1 ]; - } INFOS("Length2D_i::GetValuess~"); @@ -640,7 +826,7 @@ SMESH::MultiConnection2D::Values* MultiConnection2D_i::GetValues() INFOS("MultiConnection2D_i::GetValues"); SMESH::Controls::MultiConnection2D::MValues aValues; myMulticonnection2DPtr->GetValues( aValues ); - + long i = 0, iEnd = aValues.size(); SMESH::MultiConnection2D::Values_var aResult = new SMESH::MultiConnection2D::Values(iEnd); @@ -650,11 +836,10 @@ SMESH::MultiConnection2D::Values* MultiConnection2D_i::GetValues() { const SMESH::Controls::MultiConnection2D::Value& aVal = (*anIter).first; SMESH::MultiConnection2D::Value &aValue = aResult[ i ]; - + aValue.myPnt1 = aVal.myPntId[ 0 ]; aValue.myPnt2 = aVal.myPntId[ 1 ]; aValue.myNbConnects = (*anIter).second; - } INFOS("Multiconnection2D_i::GetValuess~"); @@ -680,6 +865,21 @@ Controls::PredicatePtr Predicate_i::GetPredicate() return myPredicatePtr; } +/* + Class : BadOrientedVolume_i + Description : Verify whether a mesh volume is incorrectly oriented from + the point of view of MED convention +*/ +BadOrientedVolume_i::BadOrientedVolume_i() +{ + Controls::PredicatePtr control( new Controls::BadOrientedVolume() ); + myFunctorPtr = myPredicatePtr = control; +}; + +FunctorType BadOrientedVolume_i::GetFunctorType() +{ + return SMESH::FT_BadOrientedVolume; +} /* Class : BelongToGeom_i @@ -690,11 +890,13 @@ BelongToGeom_i::BelongToGeom_i() myBelongToGeomPtr.reset( new Controls::BelongToGeom() ); myFunctorPtr = myPredicatePtr = myBelongToGeomPtr; myShapeName = 0; + myShapeID = 0; } BelongToGeom_i::~BelongToGeom_i() { delete myShapeName; + delete myShapeID; } void BelongToGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom ) @@ -702,9 +904,10 @@ void BelongToGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom ) if ( theGeom->_is_nil() ) return; SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); - GEOM::GEOM_Gen_var aGEOMGen = SMESH_Gen_i::GetGeomEngine(); + GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine(); TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom ); myBelongToGeomPtr->SetGeom( aLocShape ); + TPythonDump()<SetType(SMDSAbs_ElementType(theType)); + TPythonDump()<SetGeom( getShapeByName( myShapeName ) ); + TPythonDump()<SetGeom( getShapeByID(myShapeID) ); + else + myBelongToGeomPtr->SetGeom( getShapeByName( myShapeName ) ); } char* BelongToGeom_i::GetShapeName() @@ -733,6 +954,22 @@ char* BelongToGeom_i::GetShapeName() return CORBA::string_dup( myShapeName ); } +char* BelongToGeom_i::GetShapeID() +{ + return CORBA::string_dup( myShapeID ); +} + +void BelongToGeom_i::SetTolerance( CORBA::Double theToler ) +{ + myBelongToGeomPtr->SetTolerance( theToler ); + TPythonDump()<GetTolerance(); +} + /* Class : BelongToSurface_i Description : Predicate for selection on geometrical support @@ -742,12 +979,14 @@ BelongToSurface_i::BelongToSurface_i( const Handle(Standard_Type)& theSurfaceTyp myElementsOnSurfacePtr.reset( new Controls::ElementsOnSurface() ); myFunctorPtr = myPredicatePtr = myElementsOnSurfacePtr; myShapeName = 0; + myShapeID = 0; mySurfaceType = theSurfaceType; } BelongToSurface_i::~BelongToSurface_i() { delete myShapeName; + delete myShapeID; } void BelongToSurface_i::SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType ) @@ -755,7 +994,7 @@ void BelongToSurface_i::SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType t if ( theGeom->_is_nil() ) return; SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); - GEOM::GEOM_Gen_var aGEOMGen = SMESH_Gen_i::GetGeomEngine(); + GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine(); TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom ); if ( aLocShape.ShapeType() == TopAbs_FACE ) @@ -776,6 +1015,23 @@ void BelongToSurface_i::SetShapeName( const char* theName, ElementType theType ) delete myShapeName; myShapeName = strdup( theName ); myElementsOnSurfacePtr->SetSurface( getShapeByName( myShapeName ), (SMDSAbs_ElementType)theType ); + TPythonDump()<SetSurface( getShapeByID(myShapeID), (SMDSAbs_ElementType)theType ); + else + myElementsOnSurfacePtr->SetSurface( getShapeByName( myShapeName ), (SMDSAbs_ElementType)theType ); } char* BelongToSurface_i::GetShapeName() @@ -783,9 +1039,15 @@ char* BelongToSurface_i::GetShapeName() return CORBA::string_dup( myShapeName ); } +char* BelongToSurface_i::GetShapeID() +{ + return CORBA::string_dup( myShapeID ); +} + void BelongToSurface_i::SetTolerance( CORBA::Double theToler ) { myElementsOnSurfacePtr->SetTolerance( theToler ); + TPythonDump()<GetTolerance(); } +void BelongToSurface_i::SetUseBoundaries( CORBA::Boolean theUseBndRestrictions ) +{ + myElementsOnSurfacePtr->SetUseBoundaries( theUseBndRestrictions ); + TPythonDump()<GetUseBoundaries(); +} + + /* Class : BelongToPlane_i Description : Verify whether mesh element lie in pointed Geom planar object @@ -806,6 +1080,7 @@ BelongToPlane_i::BelongToPlane_i() void BelongToPlane_i::SetPlane( GEOM::GEOM_Object_ptr theGeom, ElementType theType ) { BelongToSurface_i::SetSurface( theGeom, theType ); + TPythonDump()<_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()<_is_nil() ) return; SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); - GEOM::GEOM_Gen_var aGEOMGen = SMESH_Gen_i::GetGeomEngine(); + GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine(); TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom ); myLyingOnGeomPtr->SetGeom( aLocShape ); + TPythonDump()<SetType(SMDSAbs_ElementType(theType)); + TPythonDump()<SetGeom( getShapeByName( myShapeName ) ); + TPythonDump()<SetGeom( getShapeByID(myShapeID) ); + else + myLyingOnGeomPtr->SetGeom( getShapeByName( myShapeName ) ); } char* LyingOnGeom_i::GetShapeName() @@ -885,6 +1209,22 @@ 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()<GetTolerance(); +} + /* Class : FreeBorders_i Description : Predicate for free borders @@ -915,17 +1255,18 @@ 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(iEnd); + 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 ]; @@ -940,6 +1281,36 @@ 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 : RangeOfIds_i Description : Predicate for Range of Ids. @@ -960,10 +1331,12 @@ 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()<SetRangeStr( TCollection_AsciiString( (Standard_CString)theRange ) ); } @@ -978,6 +1351,7 @@ char* RangeOfIds_i::GetRangeStr() void RangeOfIds_i::SetElementType( ElementType theType ) { myRangeOfIdsPtr->SetType( SMDSAbs_ElementType( theType ) ); + TPythonDump()<SetType(SMDSAbs_ElementType(theType)); + TPythonDump()<SetColorStr( + TCollection_AsciiString( (Standard_CString)theColor ) ); + TPythonDump()<GetColorStr( aStr ); + return CORBA::string_dup( aStr.ToCString() ); +} + +void GroupColor_i::SetElementType(ElementType theType) +{ + myGroupColorPtr->SetType(SMDSAbs_ElementType(theType)); + TPythonDump()<SetType(SMDSAbs_ElementType(theType)); + TPythonDump()<SetGeomType(SMDSAbs_GeometryType(theType)); + TPythonDump()<GetGeomType();; +} + +FunctorType ElemGeomType_i::GetFunctorType() +{ + return SMESH::FT_ElemGeomType; +} + /* Class : Comparator_i Description : Base class for comparators @@ -1002,6 +1464,7 @@ Comparator_i::~Comparator_i() void Comparator_i::SetMargin( CORBA::Double theValue ) { myComparatorPtr->SetMargin( theValue ); + TPythonDump()<Destroy(); - myNumericalFunctor = dynamic_cast( SMESH_Gen_i::GetServant( theFunct ).in() ); + myNumericalFunctor = DownCast(theFunct); if ( myNumericalFunctor ) { myComparatorPtr->SetNumFunctor( myNumericalFunctor->GetNumericalFunctor() ); myNumericalFunctor->Register(); + TPythonDump()<SetTolerance( theToler ); + TPythonDump()<Destroy(); } -void LogicalNOT_i::SetPredicate( Predicate_ptr thePred ) +void LogicalNOT_i::SetPredicate( Predicate_ptr thePredicate ) { if ( myPredicate ) myPredicate->Destroy(); - myPredicate = dynamic_cast( SMESH_Gen_i::GetServant( thePred ).in() ); + myPredicate = SMESH::GetPredicate(thePredicate); if ( myPredicate ){ myLogicalNOTPtr->SetPredicate(myPredicate->GetPredicate()); myPredicate->Register(); + TPythonDump()<Destroy(); - myPredicate1 = dynamic_cast( SMESH_Gen_i::GetServant( thePredicate ).in() ); + myPredicate1 = SMESH::GetPredicate(thePredicate); if ( myPredicate1 ){ myLogicalBinaryPtr->SetPredicate1(myPredicate1->GetPredicate()); myPredicate1->Register(); + TPythonDump()<Destroy(); - myPredicate2 = dynamic_cast( SMESH_Gen_i::GetServant( thePredicate ).in() ); + myPredicate2 = SMESH::GetPredicate(thePredicate); if ( myPredicate2 ){ myLogicalBinaryPtr->SetPredicate2(myPredicate2->GetPredicate()); myPredicate2->Register(); + TPythonDump()<activate_object( this ); + //Base class Salome_GenericObject do it inmplicitly by overriding PortableServer::POA_ptr _default_POA() method + //PortableServer::ObjectId_var anObjectId = + // SMESH_Gen_i::GetPOA()->activate_object( this ); +} + + +FilterManager_i::~FilterManager_i() +{ + //TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<Destroy(); + + if(!CORBA::is_nil(myMesh)) + myMesh->Destroy(); + + //TPythonDump()<Destroy(); - myPredicate = dynamic_cast( SMESH_Gen_i::GetServant( thePredicate ).in() ); + myPredicate = SMESH::GetPredicate(thePredicate); if ( myPredicate ) { myFilter.SetPredicate( myPredicate->GetPredicate() ); myPredicate->Register(); + TPythonDump()<SetMesh( theMesh ); + if(!CORBA::is_nil(theMesh)) + theMesh->Register(); + + if(!CORBA::is_nil(myMesh)) + myMesh->Destroy(); + + myMesh = theMesh; + TPythonDump()<GetPredicate(),theSequence); +} - anArray->length( iEnd ); - for ( ; i < iEnd; i++ ) - anArray[ i ] = aSequence[i]; +void +Filter_i:: +GetElementsId( Predicate_i* thePredicate, + SMESH_Mesh_ptr theMesh, + Controls::Filter::TIdSequence& theSequence ) +{ + if (thePredicate) + if(const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(theMesh)) + Controls::Filter::GetElementsId(aMesh,thePredicate->GetPredicate(),theSequence); +} +SMESH::long_array* +Filter_i:: +GetElementsId( SMESH_Mesh_ptr theMesh ) +{ + SMESH::long_array_var anArray = new SMESH::long_array; + if(!CORBA::is_nil(theMesh) && myPredicate){ + Controls::Filter::TIdSequence aSequence; + GetElementsId(myPredicate,theMesh,aSequence); + long i = 0, iEnd = aSequence.size(); + anArray->length( iEnd ); + for ( ; i < iEnd; i++ ) + anArray[ i ] = aSequence[i]; + } return anArray._retn(); } @@ -1554,6 +2163,9 @@ static inline bool getCriteria( Predicate_i* thePred, { case FT_FreeBorders: case FT_FreeEdges: + case FT_FreeFaces: + case FT_LinearOrQuadratic: + case FT_FreeNodes: { CORBA::ULong i = theCriteria->length(); theCriteria->length( i + 1 ); @@ -1575,12 +2187,15 @@ static inline bool getCriteria( Predicate_i* thePred, theCriteria[ i ].Type = FT_BelongToGeom; theCriteria[ i ].ThresholdStr = aPred->GetShapeName(); + theCriteria[ i ].ThresholdID = aPred->GetShapeID(); theCriteria[ i ].TypeOfElement = aPred->GetElementType(); + theCriteria[ i ].Tolerance = aPred->GetTolerance(); return true; } case FT_BelongToPlane: case FT_BelongToCylinder: + case FT_BelongToGenSurface: { BelongToSurface_i* aPred = dynamic_cast( thePred ); @@ -1591,6 +2206,7 @@ static inline bool getCriteria( Predicate_i* thePred, theCriteria[ i ].Type = aFType; theCriteria[ i ].ThresholdStr = aPred->GetShapeName(); + theCriteria[ i ].ThresholdID = aPred->GetShapeID(); theCriteria[ i ].TypeOfElement = aPred->GetElementType(); theCriteria[ i ].Tolerance = aPred->GetTolerance(); @@ -1607,7 +2223,9 @@ static inline bool getCriteria( Predicate_i* thePred, theCriteria[ i ].Type = FT_LyingOnGeom; theCriteria[ i ].ThresholdStr = aPred->GetShapeName(); + theCriteria[ i ].ThresholdID = aPred->GetShapeID(); theCriteria[ i ].TypeOfElement = aPred->GetElementType(); + theCriteria[ i ].Tolerance = aPred->GetTolerance(); return true; } @@ -1624,6 +2242,20 @@ static inline bool getCriteria( Predicate_i* thePred, theCriteria[ i ].ThresholdStr = aPred->GetRangeStr(); theCriteria[ i ].TypeOfElement = aPred->GetElementType(); + return true; + } + case FT_BadOrientedVolume: + { + BadOrientedVolume_i* aPred = dynamic_cast( thePred ); + + CORBA::ULong i = theCriteria->length(); + theCriteria->length( i + 1 ); + + theCriteria[ i ] = createCriterion(); + + theCriteria[ i ].Type = FT_BadOrientedVolume; + theCriteria[ i ].TypeOfElement = aPred->GetElementType(); + return true; } case FT_LessThan: @@ -1668,6 +2300,33 @@ static inline bool getCriteria( Predicate_i* thePred, theCriteria[ theCriteria->length() - 1 ].BinaryOp = aFType; return getCriteria( aPred2, theCriteria ); } + case FT_GroupColor: + { + CORBA::ULong i = theCriteria->length(); + theCriteria->length( i + 1 ); + + theCriteria[ i ] = createCriterion(); + + GroupColor_i* aPred = dynamic_cast( thePred ); + theCriteria[ i ].Type = aFType; + theCriteria[ i ].TypeOfElement = aPred->GetElementType(); + theCriteria[ i ].ThresholdStr = aPred->GetColorStr(); + + return true; + } + case FT_ElemGeomType: + { + CORBA::ULong i = theCriteria->length(); + theCriteria->length( i + 1 ); + + theCriteria[ i ] = createCriterion(); + + ElemGeomType_i* aPred = dynamic_cast( thePred ); + theCriteria[ i ].Type = aFType; + theCriteria[ i ].TypeOfElement = aPred->GetElementType(); + theCriteria[ i ].Threshold = (double)aPred->GetGeometryType(); + return true; + } case FT_Undefined: return false; @@ -1695,12 +2354,13 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria if ( myPredicate != 0 ) myPredicate->Destroy(); - SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i(); - FilterManager_ptr aFilterMgr = aFilter->_this(); + SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i(); + FilterManager_ptr aFilterMgr = aFilter->_this(); // CREATE two lists ( PREDICATES and LOG OP ) // Criterion + TPythonDump()<<"aCriteria = []"; std::list aPredicates; std::list aBinaries; for ( int i = 0, n = theCriteria.length(); i < n; i++ ) @@ -1708,26 +2368,40 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria int aCriterion = theCriteria[ i ].Type; int aCompare = theCriteria[ i ].Compare; double aThreshold = theCriteria[ i ].Threshold; + const char* aThresholdStr = theCriteria[ i ].ThresholdStr; + const char* aThresholdID = theCriteria[ i ].ThresholdID; int aUnary = theCriteria[ i ].UnaryOp; int aBinary = theCriteria[ i ].BinaryOp; double aTolerance = theCriteria[ i ].Tolerance; - const char* aThresholdStr = theCriteria[ i ].ThresholdStr; ElementType aTypeOfElem = theCriteria[ i ].TypeOfElement; long aPrecision = theCriteria[ i ].Precision; - + + { + TPythonDump pd; + pd << "aCriterion = SMESH.Filter.Criterion(" << aCriterion << "," << aCompare + << "," << aThreshold << ",'" << aThresholdStr; + if (aThresholdID) + pd << "',salome.ObjectToID(" << aThresholdID + << ")," << aUnary << "," << aBinary << "," << aTolerance + << "," << aTypeOfElem << "," << aPrecision << ")"; + else + pd << "',''," << aUnary << "," << aBinary << "," << aTolerance + << "," << aTypeOfElem << "," << aPrecision << ")"; + } + SMESH::Predicate_ptr aPredicate = SMESH::Predicate::_nil(); SMESH::NumericalFunctor_ptr aFunctor = SMESH::NumericalFunctor::_nil(); switch ( aCriterion ) { // Functors - + case SMESH::FT_MultiConnection: aFunctor = aFilterMgr->CreateMultiConnection(); break; case SMESH::FT_MultiConnection2D: - aFunctor = aFilterMgr->CreateMultiConnection2D(); - break; + aFunctor = aFilterMgr->CreateMultiConnection2D(); + break; case SMESH::FT_Length: aFunctor = aFilterMgr->CreateLength(); break; @@ -1755,6 +2429,9 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria case SMESH::FT_Area: aFunctor = aFilterMgr->CreateArea(); break; + case SMESH::FT_Volume3D: + aFunctor = aFilterMgr->CreateVolume3D(); + break; // Predicates @@ -1764,23 +2441,35 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria case SMESH::FT_FreeEdges: aPredicate = aFilterMgr->CreateFreeEdges(); break; + case SMESH::FT_FreeFaces: + aPredicate = aFilterMgr->CreateFreeFaces(); + break; + case SMESH::FT_FreeNodes: + aPredicate = aFilterMgr->CreateFreeNodes(); + break; case SMESH::FT_BelongToGeom: { SMESH::BelongToGeom_ptr tmpPred = aFilterMgr->CreateBelongToGeom(); tmpPred->SetElementType( aTypeOfElem ); - tmpPred->SetShapeName( aThresholdStr ); + tmpPred->SetShape( aThresholdID, aThresholdStr ); + tmpPred->SetTolerance( aTolerance ); aPredicate = tmpPred; } break; case SMESH::FT_BelongToPlane: case SMESH::FT_BelongToCylinder: + case SMESH::FT_BelongToGenSurface: { SMESH::BelongToSurface_ptr tmpPred; - if ( aCriterion == SMESH::FT_BelongToPlane ) - tmpPred = aFilterMgr->CreateBelongToPlane(); - else - tmpPred = aFilterMgr->CreateBelongToCylinder(); - tmpPred->SetShapeName( aThresholdStr, aTypeOfElem ); + switch ( aCriterion ) { + case SMESH::FT_BelongToPlane: + tmpPred = aFilterMgr->CreateBelongToPlane(); break; + case SMESH::FT_BelongToCylinder: + tmpPred = aFilterMgr->CreateBelongToCylinder(); break; + default: + tmpPred = aFilterMgr->CreateBelongToGenSurface(); + } + tmpPred->SetShape( aThresholdID, aThresholdStr, aTypeOfElem ); tmpPred->SetTolerance( aTolerance ); aPredicate = tmpPred; } @@ -1789,10 +2478,11 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria { SMESH::LyingOnGeom_ptr tmpPred = aFilterMgr->CreateLyingOnGeom(); tmpPred->SetElementType( aTypeOfElem ); - tmpPred->SetShapeName( aThresholdStr ); + tmpPred->SetShape( aThresholdID, aThresholdStr ); + tmpPred->SetTolerance( aTolerance ); aPredicate = tmpPred; } - break; + break; case SMESH::FT_RangeOfIds: { SMESH::RangeOfIds_ptr tmpPred = aFilterMgr->CreateRangeOfIds(); @@ -1801,7 +2491,35 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria aPredicate = tmpPred; } break; - + case SMESH::FT_BadOrientedVolume: + { + aPredicate = aFilterMgr->CreateBadOrientedVolume(); + } + break; + case SMESH::FT_LinearOrQuadratic: + { + SMESH::LinearOrQuadratic_ptr tmpPred = aFilterMgr->CreateLinearOrQuadratic(); + tmpPred->SetElementType( aTypeOfElem ); + aPredicate = tmpPred; + break; + } + case SMESH::FT_GroupColor: + { + SMESH::GroupColor_ptr tmpPred = aFilterMgr->CreateGroupColor(); + tmpPred->SetElementType( aTypeOfElem ); + tmpPred->SetColorStr( aThresholdStr ); + aPredicate = tmpPred; + break; + } + case SMESH::FT_ElemGeomType: + { + SMESH::ElemGeomType_ptr tmpPred = aFilterMgr->CreateElemGeomType(); + tmpPred->SetElementType( aTypeOfElem ); + tmpPred->SetGeometryType( (GeometryType)(aThreshold + 0.5) ); + aPredicate = tmpPred; + break; + } + default: continue; } @@ -1845,8 +2563,10 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria // logical op aPredicates.push_back( aPredicate ); aBinaries.push_back( aBinary ); + TPythonDump()<<"aCriteria.append(aCriterion)"; } // end of for + TPythonDump()<length(); i < n; i++ ) { LDOM_Element aCriterionItem = theDoc.createElement( "criterion" ); - - aCriterionItem.setAttribute( ATTR_TYPE , toString( aCriteria[ i ].Type ) ); - aCriterionItem.setAttribute( ATTR_COMPARE , toString( aCriteria[ i ].Compare ) ); - aCriterionItem.setAttribute( ATTR_THRESHOLD , toString( aCriteria[ i ].Threshold ) ); - aCriterionItem.setAttribute( ATTR_UNARY , toString( aCriteria[ i ].UnaryOp ) ); - aCriterionItem.setAttribute( ATTR_BINARY , toString( aCriteria[ i ].BinaryOp ) ); + aCriterionItem.setAttribute( ATTR_TYPE , toString( aCriteria[ i ].Type) ); + aCriterionItem.setAttribute( ATTR_COMPARE , toString( aCriteria[ i ].Compare ) ); + aCriterionItem.setAttribute( ATTR_THRESHOLD , toString( aCriteria[ i ].Threshold ) ); + aCriterionItem.setAttribute( ATTR_UNARY , toString( aCriteria[ i ].UnaryOp ) ); + aCriterionItem.setAttribute( ATTR_BINARY , toString( aCriteria[ i ].BinaryOp ) ); + aCriterionItem.setAttribute( ATTR_THRESHOLD_STR, (const char*)aCriteria[ i ].ThresholdStr ); aCriterionItem.setAttribute( ATTR_TOLERANCE , toString( aCriteria[ i ].Tolerance ) ); aCriterionItem.setAttribute( ATTR_ELEMENT_TYPE , @@ -2268,6 +3004,7 @@ FilterLibrary_i::FilterLibrary_i() FilterLibrary_i::~FilterLibrary_i() { delete myFileName; + //TPythonDump()< aCriteria; - + for ( LDOM_Node aCritNode = aFilter.getFirstChild(); !aCritNode.isNull() ; aCritNode = aCritNode.getNextSibling() ) { @@ -2294,14 +3031,14 @@ Filter_ptr FilterLibrary_i::Copy( const char* theFilterName ) const char* aUnaryStr = aCrit->getAttribute( ATTR_UNARY ).GetString(); const char* aBinaryStr = aCrit->getAttribute( ATTR_BINARY ).GetString(); const char* anElemTypeStr = aCrit->getAttribute( ATTR_ELEMENT_TYPE ).GetString(); - + SMESH::Filter::Criterion aCriterion = createCriterion(); aCriterion.Type = toFunctorType( aTypeStr ); aCriterion.Compare = toFunctorType( aCompareStr ); aCriterion.UnaryOp = toFunctorType( aUnaryStr ); aCriterion.BinaryOp = toFunctorType( aBinaryStr ); - + aCriterion.TypeOfElement = toElementType( anElemTypeStr ); LDOMString str = aCrit->getAttribute( ATTR_THRESHOLD ); @@ -2328,16 +3065,18 @@ Filter_ptr FilterLibrary_i::Copy( const char* theFilterName ) SMESH::Filter::Criteria_var aCriteriaVar = new SMESH::Filter::Criteria; aCriteriaVar->length( aCriteria.size() ); - + CORBA::ULong i = 0; std::list::iterator anIter = aCriteria.begin(); - + for( ; anIter != aCriteria.end(); ++anIter ) aCriteriaVar[ i++ ] = *anIter; aRes = myFilterMgr->CreateFilter(); aRes->SetCriteria( aCriteriaVar.inout() ); + TPythonDump()<(theFilter)) + TPythonDump()<CreateFilter(); - + LDOM_Element aFilterItem = createFilterItem( theFilterName, aFilter, myDoc ); if ( aFilterItem.isNull() ) return false; else { aSection.appendChild( aFilterItem ); + TPythonDump()<(theFilter)) + TPythonDump()<