Salome HOME
NPAL18095: Pb. with dump python and mesh group by filter.
[modules/smesh.git] / src / SMESH_I / SMESH_Filter_i.cxx
index f639b5e8a76ecb744afb1c38dbe148b39b4d5e61..98ae207dec57ab53a1f73e58128b6a82c681138d 100644 (file)
 
 #include "SMESHDS_Mesh.hxx"
 
+#include <BRep_Tool.hxx>
+#include <Geom_CylindricalSurface.hxx>
+#include <Geom_Plane.hxx>
+#include <LDOMParser.hxx>
+#include <LDOMString.hxx>
 #include <LDOM_Document.hxx>
 #include <LDOM_Element.hxx>
 #include <LDOM_Node.hxx>
-#include <LDOMString.hxx>
-#include <LDOMParser.hxx>
 #include <LDOM_XmlWriter.hxx>
-#include <TCollection_HAsciiString.hxx>
+#include <Precision.hxx>
 #include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfReal.hxx>
 #include <TColStd_ListOfInteger.hxx>
 #include <TColStd_ListOfReal.hxx>
-#include <TColStd_MapOfInteger.hxx>
 #include <TColStd_SequenceOfHAsciiString.hxx>
-#include <TColStd_ListIteratorOfListOfReal.hxx>
-#include <Precision.hxx>
-#include <BRep_Tool.hxx>
-#include <TopoDS_Shape.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Face.hxx>
-#include <Geom_Plane.hxx>
-#include <Geom_CylindricalSurface.hxx>
-#include <TopExp_Explorer.hxx>
-#include <OSD_Path.hxx>
-#include <OSD_File.hxx>
+#include <TopoDS_Shape.hxx>
 
 using namespace SMESH;
 using namespace SMESH::Controls;
@@ -386,7 +384,7 @@ 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;
         }
@@ -411,7 +409,7 @@ static TopoDS_Shape getShapeByID (const char* theID)
         GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(obj);
       
         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;
         }
@@ -793,7 +791,7 @@ 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()<<this<<".SetGeom("<<theGeom<<")";
@@ -872,7 +870,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 )
@@ -1037,7 +1035,7 @@ 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_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()<<this<<".SetGeom("<<theGeom<<")";
@@ -2054,10 +2052,18 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
     ElementType aTypeOfElem   = theCriteria[ i ].TypeOfElement;
     long        aPrecision    = theCriteria[ i ].Precision;
 
-    TPythonDump() << "aCriterion = SMESH.Filter.Criterion(" << aCriterion << "," << aCompare
-                  << "," << aThreshold << ",'" << aThresholdStr << "',salome.ObjectToID("
-                  << aThresholdID << ")," << aUnary << "," << aBinary << "," << aTolerance
-                  << "," << aTypeOfElem << "," << aPrecision << ")";
+    {
+      TPythonDump pd;
+      pd << "aCriterion = SMESH.Filter.Criterion(" << aCriterion << "," << aCompare
+         << "," << aThreshold << ",'" << aThresholdStr;
+      if (strlen(aThresholdID) > 0)
+        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();