Salome HOME
rnc:
[modules/geom.git] / src / GEOM_I / GEOM_IBlocksOperations_i.cc
index 9372c6698996f930c01d1b151d5e2fc029622ce1..9ecf62a22b374ae2c7505c807877103d513902dc 100644 (file)
@@ -1,23 +1,24 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011  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-2007  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
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// 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,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// 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
+// 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
+// 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
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 
 #include <Standard_Stream.hxx>
 
@@ -268,6 +269,34 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetPoint (GEOM::GEOM_Object_ptr
   return GetObject(anObject);
 }
 
+//=============================================================================
+/*!
+ *  GetVertexNearPoint
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetVertexNearPoint
+                                                (GEOM::GEOM_Object_ptr theShape,
+                                                 GEOM::GEOM_Object_ptr thePoint)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  // Set a not done flag
+  GetOperations()->SetNotDone();
+
+  // Get the reference Objects
+  Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+  Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint);
+  if (aShape.IsNull() || aPoint.IsNull()) return aGEOMObject._retn();
+
+  // Create the Point
+  Handle(GEOM_Object) anObject =
+    GetOperations()->GetVertexNearPoint(aShape, aPoint);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
 //=============================================================================
 /*!
  *  GetEdge
@@ -480,6 +509,37 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByNormale (GEOM::GEOM_Obj
   return GetObject(anObject);
 }
 
+//=============================================================================
+/*!
+ *  GetShapesNearPoint
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetShapesNearPoint
+                      (GEOM::GEOM_Object_ptr theShape,
+                       GEOM::GEOM_Object_ptr thePoint,
+                       CORBA::Long           theShapeType,
+                       CORBA::Double         theTolerance)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  // Set a not done flag
+  GetOperations()->SetNotDone();
+
+  // Get the reference Objects
+  Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+  Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint);
+
+  if (aShape.IsNull() || aPoint.IsNull()) return aGEOMObject._retn();
+
+  // Create the Shape
+  Handle(GEOM_Object) anObject =
+    GetOperations()->GetShapesNearPoint(aShape, aPoint, theShapeType, theTolerance);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
 //=============================================================================
 /*!
  *  ExplodeCompoundOfBlocks
@@ -566,7 +626,7 @@ CORBA::Boolean GEOM_IBlocksOperations_i::CheckCompoundOfBlocks
   if (aCompound.IsNull()) return isComp;
 
   //Check
-  list<GEOMImpl_IBlocksOperations::BCError> errList;
+  std::list<GEOMImpl_IBlocksOperations::BCError> errList;
   isComp = GetOperations()->CheckCompoundOfBlocks(aCompound, errList);
   if (!GetOperations()->IsDone())
     return isComp;
@@ -577,7 +637,7 @@ CORBA::Boolean GEOM_IBlocksOperations_i::CheckCompoundOfBlocks
   anErrArray->length(nbErr);
 
   // fill the local CORBA array with values from lists
-  list<GEOMImpl_IBlocksOperations::BCError>::iterator errIt = errList.begin();
+  std::list<GEOMImpl_IBlocksOperations::BCError>::iterator errIt = errList.begin();
   int i = 0;
   for (; errIt != errList.end(); i++, errIt++) {
     GEOM::GEOM_IBlocksOperations::BCError_var anError =
@@ -605,11 +665,11 @@ CORBA::Boolean GEOM_IBlocksOperations_i::CheckCompoundOfBlocks
       break;
     }
 
-    list<int> sshList = errStruct.incriminated;
+    std::list<int> sshList = errStruct.incriminated;
     GEOM::ListOfLong_var anIncrims = new GEOM::ListOfLong();
     anIncrims->length(sshList.size());
 
-    list<int>::iterator sshIt = sshList.begin();
+    std::list<int>::iterator sshIt = sshList.begin();
     int jj = 0;
     for (; sshIt != sshList.end(); jj++, sshIt++) {
       anIncrims[jj] = *sshIt;
@@ -640,7 +700,7 @@ char* GEOM_IBlocksOperations_i::PrintBCErrors
   if (aCompound.IsNull()) return NULL;
 
   // Convert the errors sequence
-  list<GEOMImpl_IBlocksOperations::BCError> anErrors;
+  std::list<GEOMImpl_IBlocksOperations::BCError> anErrors;
   int nbErr = theErrors.length();
   int ie = 0;
   for (; ie < nbErr; ie++) {
@@ -687,7 +747,9 @@ char* GEOM_IBlocksOperations_i::PrintBCErrors
  *  RemoveExtraEdges
  */
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::RemoveExtraEdges (GEOM::GEOM_Object_ptr theShape)
+GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::RemoveExtraEdges
+                                      (GEOM::GEOM_Object_ptr theShape,
+                                       CORBA::Long           theOptimumNbFaces)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -699,8 +761,7 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::RemoveExtraEdges (GEOM::GEOM_Obj
   if (aShape.IsNull()) return aGEOMObject._retn();
 
   //Get the result
-  Handle(GEOM_Object) anObject =
-    GetOperations()->RemoveExtraEdges(aShape);
+  Handle(GEOM_Object) anObject = GetOperations()->RemoveExtraEdges(aShape, theOptimumNbFaces);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();