Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/smesh.git] / src / SMESH_I / SMESH_Filter_i.cxx
index 05d5f38482a1137aeee5e536db301aca76912719..bfb52b21802a22e640e09a1d0ed9d5beb3f3811f 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
 //
 //  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 
+//  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
 //  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
 //
 //
 //
 
 #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;
@@ -67,7 +65,7 @@ using namespace SMESH::Controls;
 
 namespace SMESH
 {
-  Predicate_i* 
+  Predicate_i*
   GetPredicate( Predicate_ptr thePredicate )
   {
     return DownCast<Predicate_i*>(thePredicate);
@@ -103,7 +101,7 @@ static bool IsContains( const SMESHDS_Mesh*     theMeshDS,
                         TopAbs_ShapeEnum        theAvoidShapeEnum = TopAbs_SHAPE )
 {
   TopExp_Explorer anExp( theShape,theFindShapeEnum,theAvoidShapeEnum );
-  
+
   while( anExp.More() )
   {
     const TopoDS_Shape& aShape = anExp.Current();
@@ -159,7 +157,7 @@ bool Controls::BelongToGeom::IsSatisfy( long theId )
       }
     }
   }
-    
+
   return false;
 }
 
@@ -178,7 +176,7 @@ TopoDS_Shape Controls::BelongToGeom::GetShape()
   return myShape;
 }
 
-const SMESHDS_Mesh* 
+const SMESHDS_Mesh*
 Controls::BelongToGeom::
 GetMeshDS() const
 {
@@ -249,7 +247,7 @@ bool Controls::LyingOnGeom::IsSatisfy( long theId )
       }
     }
   }
-    
+
   return false;
 }
 
@@ -268,7 +266,7 @@ TopoDS_Shape Controls::LyingOnGeom::GetShape()
   return myShape;
 }
 
-const SMESHDS_Mesh* 
+const SMESHDS_Mesh*
 Controls::LyingOnGeom::
 GetMeshDS() const
 {
@@ -276,39 +274,39 @@ GetMeshDS() const
 }
 
 bool Controls::LyingOnGeom::Contains( const SMESHDS_Mesh*     theMeshDS,
-                                     const TopoDS_Shape&     theShape,
-                                     const SMDS_MeshElement* theElem,
-                                     TopAbs_ShapeEnum        theFindShapeEnum,
-                                     TopAbs_ShapeEnum        theAvoidShapeEnum )
+                                      const TopoDS_Shape&     theShape,
+                                      const SMDS_MeshElement* theElem,
+                                      TopAbs_ShapeEnum        theFindShapeEnum,
+                                      TopAbs_ShapeEnum        theAvoidShapeEnum )
 {
   if (IsContains(theMeshDS, theShape, theElem, theFindShapeEnum, theAvoidShapeEnum))
     return true;
-  
+
   TopTools_IndexedMapOfShape aSubShapes;
   TopExp::MapShapes( theShape, aSubShapes );
-  
+
   for (int i = 1; i <= aSubShapes.Extent(); i++)
-    {
-      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<const SMDS_MeshNode*>(aNodeIt->next());
-           SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator();
-           while ( anElemIt->more() )
-             {
-               const SMDS_MeshElement* anElement = static_cast<const SMDS_MeshElement*>(anElemIt->next());
-               if (anElement == theElem)
-                 return true;
-             }
-         }
+  {
+    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<const SMDS_MeshNode*>(aNodeIt->next());
+        SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator();
+        while ( anElemIt->more() )
+        {
+          const SMDS_MeshElement* anElement = static_cast<const SMDS_MeshElement*>(anElemIt->next());
+          if (anElement == theElem)
+            return true;
+        }
       }
     }
+  }
   return false;
 }
 
@@ -317,16 +315,16 @@ bool Controls::LyingOnGeom::Contains( const SMESHDS_Mesh*     theMeshDS,
                             AUXILIARY METHODS
 */
 
-inline 
-const SMDS_Mesh* 
+inline
+const SMDS_Mesh*
 MeshPtr2SMDSMesh( SMESH_Mesh_ptr theMesh )
 {
   SMESH_Mesh_i* anImplPtr = DownCast<SMESH_Mesh_i*>(theMesh);
   return anImplPtr ? anImplPtr->GetImpl().GetMeshDS() : 0;
 }
 
-inline 
-SMESH::long_array* 
+inline
+SMESH::long_array*
 toArray( const TColStd_ListOfInteger& aList )
 {
   SMESH::long_array_var anArray = new SMESH::long_array;
@@ -339,8 +337,8 @@ toArray( const TColStd_ListOfInteger& aList )
   return anArray._retn();
 }
 
-inline 
-SMESH::double_array* 
+inline
+SMESH::double_array*
 toArray( const TColStd_ListOfReal& aList )
 {
   SMESH::double_array_var anArray = new SMESH::double_array;
@@ -363,6 +361,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;
@@ -376,7 +375,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" );
@@ -385,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;
         }
@@ -395,7 +394,51 @@ static TopoDS_Shape getShapeByName( const char* theName )
   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;
+        }
+      }
+    }
+  }
+  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
@@ -403,18 +446,19 @@ 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() )
 {
-  PortableServer::ObjectId_var anObjectId = 
-    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()<<this<<".Destroy()";
+  //TPythonDump()<<this<<".Destroy()";
 }
 
 void Functor_i::SetMesh( SMESH_Mesh_ptr theMesh )
@@ -565,6 +609,21 @@ FunctorType Area_i::GetFunctorType()
   return SMESH::FT_Area;
 }
 
+/*
+  Class       : Volume3D_i
+  Description : Functor for calculating volume of 3D element
+*/
+Volume3D_i::Volume3D_i()
+{
+  myNumericalFunctorPtr.reset( new Controls::Volume() );
+  myFunctorPtr = myNumericalFunctorPtr;
+}
+
+FunctorType Volume3D_i::GetFunctorType()
+{
+  return SMESH::FT_Volume3D;
+}
+
 /*
   Class       : Length_i
   Description : Functor for calculating length off edge
@@ -600,7 +659,7 @@ SMESH::Length2D::Values* Length2D_i::GetValues()
   INFOS("Length2D_i::GetValues");
   SMESH::Controls::Length2D::TValues aValues;
   myLength2DPtr->GetValues( aValues );
-  
+
   long i = 0, iEnd = aValues.size();
 
   SMESH::Length2D::Values_var aResult = new SMESH::Length2D::Values(iEnd);
@@ -610,11 +669,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~");
@@ -656,7 +714,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);
@@ -666,11 +724,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~");
@@ -721,11 +778,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 )
@@ -733,7 +792,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<<")";
@@ -762,11 +821,32 @@ void BelongToGeom_i::SetShapeName( const char* theName )
   TPythonDump()<<this<<".SetShapeName('"<<theName<<"')";
 }
 
+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;
+
+  if ( myShapeID && strcmp(myShapeName, getShapeNameByID(myShapeID)) == 0 )
+    myBelongToGeomPtr->SetGeom( getShapeByID(myShapeID) );
+  else
+    myBelongToGeomPtr->SetGeom( getShapeByName( myShapeName ) );
+}
+
 char* BelongToGeom_i::GetShapeName()
 {
   return CORBA::string_dup( myShapeName );
 }
 
+char* BelongToGeom_i::GetShapeID()
+{
+  return CORBA::string_dup( myShapeID );
+}
+
 /*
   Class       : BelongToSurface_i
   Description : Predicate for selection on geometrical support
@@ -776,12 +856,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 )
@@ -789,7 +871,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 )
@@ -803,7 +885,6 @@ void BelongToSurface_i::SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType t
   }
 
   myElementsOnSurfacePtr->SetSurface( TopoDS_Shape(), (SMDSAbs_ElementType)theType );
-  TPythonDump()<<this<<".SetSurface("<<theGeom<<",'"<<theType<<"')";
 }
 
 void BelongToSurface_i::SetShapeName( const char* theName, ElementType theType )
@@ -814,11 +895,32 @@ void BelongToSurface_i::SetShapeName( const char* theName, ElementType theType )
   TPythonDump()<<this<<".SetShapeName('"<<theName<<"',"<<theType<<")";
 }
 
+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 && strcmp(myShapeName, getShapeNameByID(myShapeID)) == 0 )
+    myElementsOnSurfacePtr->SetSurface( getShapeByID(myShapeID), (SMDSAbs_ElementType)theType );
+  else
+    myElementsOnSurfacePtr->SetSurface( getShapeByName( myShapeName ), (SMDSAbs_ElementType)theType );
+}
+
 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 );
@@ -830,6 +932,18 @@ 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
@@ -872,6 +986,33 @@ 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
@@ -881,11 +1022,13 @@ 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 )
@@ -893,7 +1036,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<<")";
@@ -922,11 +1065,32 @@ void LyingOnGeom_i::SetShapeName( const char* theName )
   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 && strcmp(myShapeName, getShapeNameByID(myShapeID)) == 0 )
+    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 );
+}
+
 /*
   Class       : FreeBorders_i
   Description : Predicate for free borders
@@ -957,17 +1121,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 ];
@@ -1290,14 +1455,15 @@ FunctorType LogicalOR_i::GetFunctorType()
 FilterManager_i::FilterManager_i()
 : SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
 {
-  PortableServer::ObjectId_var anObjectId = 
-    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 );
 }
 
 
 FilterManager_i::~FilterManager_i()
 {
-  TPythonDump()<<this<<".Destroy()";
+  //TPythonDump()<<this<<".Destroy()";
 }
 
 
@@ -1364,6 +1530,15 @@ Area_ptr FilterManager_i::CreateArea()
 }
 
 
+Volume3D_ptr FilterManager_i::CreateVolume3D()
+{
+  SMESH::Volume3D_i* aServant = new SMESH::Volume3D_i();
+  SMESH::Volume3D_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateVolume3D()";
+  return anObj._retn();
+}
+
+
 Length_ptr FilterManager_i::CreateLength()
 {
   SMESH::Length_i* aServant = new SMESH::Length_i();
@@ -1420,6 +1595,14 @@ BelongToCylinder_ptr FilterManager_i::CreateBelongToCylinder()
   return anObj._retn();
 }
 
+BelongToGenSurface_ptr FilterManager_i::CreateBelongToGenSurface()
+{
+  SMESH::BelongToGenSurface_i* aServant = new SMESH::BelongToGenSurface_i();
+  SMESH::BelongToGenSurface_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateBelongToGenSurface()";
+  return anObj._retn();
+}
+
 LyingOnGeom_ptr FilterManager_i::CreateLyingOnGeom()
 {
   SMESH::LyingOnGeom_i* aServant = new SMESH::LyingOnGeom_i();
@@ -1582,7 +1765,7 @@ Filter_i::~Filter_i()
   if(!CORBA::is_nil(myMesh))
     myMesh->Destroy();
 
-  TPythonDump()<<this<<".Destroy()";
+  //TPythonDump()<<this<<".Destroy()";
 }
 
 //=======================================================================
@@ -1617,7 +1800,7 @@ SMESH::ElementType Filter_i::GetElementType()
 // name    : Filter_i::SetMesh
 // Purpose : Set mesh
 //=======================================================================
-void 
+void
 Filter_i::
 SetMesh( SMESH_Mesh_ptr theMesh )
 {
@@ -1631,7 +1814,7 @@ SetMesh( SMESH_Mesh_ptr theMesh )
   TPythonDump()<<this<<".SetMesh("<<theMesh<<")";
 }
 
-SMESH::long_array* 
+SMESH::long_array*
 Filter_i::
 GetIDs()
 {
@@ -1645,28 +1828,30 @@ GetIDs()
 void
 Filter_i::
 GetElementsId( Predicate_i* thePredicate,
-              const SMDS_Mesh* theMesh,
-              Controls::Filter::TIdSequence& theSequence )
+               const SMDS_Mesh* theMesh,
+               Controls::Filter::TIdSequence& theSequence )
 {
-  Controls::Filter::GetElementsId(theMesh,thePredicate->GetPredicate(),theSequence);
+  if (thePredicate)
+    Controls::Filter::GetElementsId(theMesh,thePredicate->GetPredicate(),theSequence);
 }
 
 void
 Filter_i::
 GetElementsId( Predicate_i* thePredicate,
-              SMESH_Mesh_ptr theMesh,
-              Controls::Filter::TIdSequence& theSequence )
+               SMESH_Mesh_ptr theMesh,
+               Controls::Filter::TIdSequence& theSequence )
 {
-  if(const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(theMesh))
-    Controls::Filter::GetElementsId(aMesh,thePredicate->GetPredicate(),theSequence);
+  if (thePredicate) 
+    if(const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(theMesh))
+      Controls::Filter::GetElementsId(aMesh,thePredicate->GetPredicate(),theSequence);
 }
 
-SMESH::long_array* 
+SMESH::long_array*
 Filter_i::
 GetElementsId( SMESH_Mesh_ptr theMesh )
 {
   SMESH::long_array_var anArray = new SMESH::long_array;
-  if(!CORBA::is_nil(theMesh)){
+  if(!CORBA::is_nil(theMesh) && myPredicate){
     Controls::Filter::TIdSequence aSequence;
     GetElementsId(myPredicate,theMesh,aSequence);
     long i = 0, iEnd = aSequence.size();
@@ -1711,12 +1896,14 @@ 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();
 
       return true;
     }
   case FT_BelongToPlane:
   case FT_BelongToCylinder:
+  case FT_BelongToGenSurface:
     {
       BelongToSurface_i* aPred = dynamic_cast<BelongToSurface_i*>( thePred );
 
@@ -1727,6 +1914,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();
 
@@ -1743,6 +1931,7 @@ 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();
 
       return true;
@@ -1847,7 +2036,7 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
 
   SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i();
   FilterManager_ptr aFilterMgr = aFilter->_this();
-  
+
   // CREATE two lists ( PREDICATES  and LOG OP )
 
   // Criterion
@@ -1859,30 +2048,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()<<"aCriteria.append(SMESH.Filter.Criterion("<<
-      aCriterion<<","<<aCompare<<","<<aThreshold<<",'"<<aThresholdStr<<"',"<<
-      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();
 
     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;
@@ -1910,6 +2109,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
 
@@ -1923,19 +2125,24 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
         {
           SMESH::BelongToGeom_ptr tmpPred = aFilterMgr->CreateBelongToGeom();
           tmpPred->SetElementType( aTypeOfElem );
-          tmpPred->SetShapeName( aThresholdStr );
+          tmpPred->SetShape( aThresholdID, aThresholdStr );
           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;
         }
@@ -1944,10 +2151,10 @@ 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 );
           aPredicate = tmpPred;
         }
-        break; 
+        break;
       case SMESH::FT_RangeOfIds:
         {
           SMESH::RangeOfIds_ptr tmpPred = aFilterMgr->CreateRangeOfIds();
@@ -1961,7 +2168,7 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
           aPredicate = aFilterMgr->CreateBadOrientedVolume();
         }
         break;
-              
+
       default:
         continue;
     }
@@ -2005,6 +2212,7 @@ 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()<<this<<".SetCriteria(aCriteria)";
@@ -2113,7 +2321,7 @@ Predicate_ptr Filter_i::GetPredicate()
 // name    : toString
 // Purpose : Convert bool to LDOMString
 //=======================================================================
-static inline LDOMString toString( const bool val )
+static inline LDOMString toString( CORBA::Boolean val )
 {
   return val ? "logical not" : "";
 }
@@ -2131,7 +2339,7 @@ static inline bool toBool( const LDOMString& theStr )
 // name    : toString
 // Purpose : Convert double to LDOMString
 //=======================================================================
-static inline LDOMString toString( const double val )
+static inline LDOMString toString( CORBA::Double val )
 {
   char a[ 255 ];
   sprintf( a, "%e", val );
@@ -2151,7 +2359,7 @@ static inline double toDouble( const LDOMString& theStr )
 // name    : toString
 // Purpose : Convert functor type to LDOMString
 //=======================================================================
-static inline LDOMString toString( const long theType )
+static inline LDOMString toString( CORBA::Long theType )
 {
   switch ( theType )
   {
@@ -2161,9 +2369,11 @@ static inline LDOMString toString( const long theType )
     case FT_Taper           : return "Taper";
     case FT_Skew            : return "Skew";
     case FT_Area            : return "Area";
+    case FT_Volume3D        : return "Volume3D";
     case FT_BelongToGeom    : return "Belong to Geom";
     case FT_BelongToPlane   : return "Belong to Plane";
     case FT_BelongToCylinder: return "Belong to Cylinder";
+    case FT_BelongToGenSurface: return "Belong to Generic Surface";
     case FT_LyingOnGeom     : return "Lying on Geom";
     case FT_BadOrientedVolume: return "Bad Oriented Volume";
     case FT_RangeOfIds      : return "Range of IDs";
@@ -2196,9 +2406,11 @@ static inline SMESH::FunctorType toFunctorType( const LDOMString& theStr )
   else if ( theStr.equals( "Taper"                        ) ) return FT_Taper;
   else if ( theStr.equals( "Skew"                         ) ) return FT_Skew;
   else if ( theStr.equals( "Area"                         ) ) return FT_Area;
+  else if ( theStr.equals( "Volume3D"                     ) ) return FT_Volume3D;
   else if ( theStr.equals( "Belong to Geom"               ) ) return FT_BelongToGeom;
   else if ( theStr.equals( "Belong to Plane"              ) ) return FT_BelongToPlane;
   else if ( theStr.equals( "Belong to Cylinder"           ) ) return FT_BelongToCylinder;
+  else if ( theStr.equals( "Belong to Generic Surface"    ) ) return FT_BelongToGenSurface;
   else if ( theStr.equals( "Lying on Geom"                ) ) return FT_LyingOnGeom;
   else if ( theStr.equals( "Free borders"                 ) ) return FT_FreeBorders;
   else if ( theStr.equals( "Free edges"                   ) ) return FT_FreeEdges;
@@ -2313,7 +2525,7 @@ static LDOM_Node getSection( const ElementType theType,
   const char* aSectionName = getSectionName( theType );
   if ( strcmp( aSectionName, "" ) == 0 )
     return LDOM_Node();
-  
+
   LDOM_NodeList aSections = theDoc.getElementsByTagName( "section" );
   LDOM_Node aNode;
   for ( int i = 0, n = aSections.getLength(); i < n; i++ )
@@ -2365,13 +2577,13 @@ static LDOM_Element createFilterItem( const char*       theName,
   for ( CORBA::ULong i = 0, n = aCriteria->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 ,
@@ -2431,7 +2643,7 @@ FilterLibrary_i::FilterLibrary_i()
 FilterLibrary_i::~FilterLibrary_i()
 {
   delete myFileName;
-  TPythonDump()<<this<<".Destroy()";
+  //TPythonDump()<<this<<".Destroy()";
 }
 
 //=======================================================================
@@ -2447,7 +2659,7 @@ Filter_ptr FilterLibrary_i::Copy( const char* theFilterName )
     return aRes;
 
   std::list<SMESH::Filter::Criterion> aCriteria;
-    
+
   for ( LDOM_Node aCritNode = aFilter.getFirstChild();
         !aCritNode.isNull() ; aCritNode = aCritNode.getNextSibling() )
   {
@@ -2458,14 +2670,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 );
@@ -2486,24 +2698,24 @@ Filter_ptr FilterLibrary_i::Copy( const char* theFilterName )
     }
     else
       aCriterion.ThresholdStr = str.GetString();
-
+    
     aCriteria.push_back( aCriterion );
   }
 
   SMESH::Filter::Criteria_var aCriteriaVar = new SMESH::Filter::Criteria;
   aCriteriaVar->length( aCriteria.size() );
-  
+
   CORBA::ULong i = 0;
   std::list<SMESH::Filter::Criterion>::iterator anIter = aCriteria.begin();
-  
+
   for( ; anIter != aCriteria.end(); ++anIter )
     aCriteriaVar[ i++ ] = *anIter;
 
   aRes = myFilterMgr->CreateFilter();
   aRes->SetCriteria( aCriteriaVar.inout() );
-  
+
   TPythonDump()<<this<<".Copy('"<<theFilterName<<"')";
-  
+
   return aRes;
 }
 
@@ -2575,7 +2787,7 @@ CORBA::Boolean FilterLibrary_i::AddEmpty( const char* theFilterName, ElementType
 
   // create filter item
   Filter_var aFilter = myFilterMgr->CreateFilter();
-  
+
   LDOM_Element aFilterItem = createFilterItem( theFilterName, aFilter, myDoc );
   if ( aFilterItem.isNull() )
     return false;
@@ -2604,12 +2816,12 @@ CORBA::Boolean FilterLibrary_i::Delete ( const char* theFilterName )
 }
 
 //=======================================================================
-// name      : FilterLibrary_i::Replace 
+// name      : FilterLibrary_i::Replace
 // Purpose   : Replace existing filter with entry filter.
 // IMPORTANT : If filter does not exist it is not created
 //=======================================================================
 CORBA::Boolean FilterLibrary_i::Replace( const char* theFilterName,
-                                         const char* theNewName,                 
+                                         const char* theNewName,
                                          Filter_ptr  theFilter )
 {
   LDOM_Element aFilterItem = findFilter( theFilterName, myDoc );
@@ -2619,7 +2831,7 @@ CORBA::Boolean FilterLibrary_i::Replace( const char* theFilterName,
   LDOM_Element aNewItem = createFilterItem( theNewName, theFilter, myDoc );
   if ( aNewItem.isNull() )
     return false;
-  else                                                                                          
+  else
   {
     aFilterItem.ReplaceElement( aNewItem );
     if(Filter_i* aFilter = DownCast<Filter_i*>(theFilter))
@@ -2636,7 +2848,7 @@ CORBA::Boolean FilterLibrary_i::Save()
 {
   if ( myFileName == 0 || strlen( myFileName ) == 0 )
     return false;
-          
+
   FILE* aOutFile = fopen( myFileName, "wt" );
   if ( !aOutFile )
     return false;