Salome HOME
Updated copyright comment
[modules/hexablock.git] / src / HEXABLOCK / HexKas_functions.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 683c59f..6c43b32
@@ -1,12 +1,12 @@
 //
 // CC++ : Fonctions Interface Cascade
 //
-// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2009-2024  CEA, EDF
 //
 // 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.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // 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 "HexKas_functions.hxx"
-
-#ifndef NO_CASCADE
+//  #include "HexEdge.hxx"
 
 #include <TopoDS.hxx>
 #include <TopoDS_Shape.hxx>
@@ -34,6 +32,8 @@
 
 #include <gp_Pnt.hxx>
 
+#include <sstream>
+
 BEGIN_NAMESPACE_HEXA
 
 // ====================================================== same_coords
@@ -44,13 +44,13 @@ bool same_coords (gp_Pnt& pa, gp_Pnt& pb, double epsilon)
    return d2 < epsilon;
 }
 // ====================================================== save_brep
-void save_brep (cpchar nom, string brep, int& compteur)
+void save_brep (cpchar nom, std::string brep, int& compteur)
 {
     char buff[8];
     compteur ++;
     sprintf (buff ,"%d", compteur);
 
-    string name (nom);
+    std::string name (nom);
     name += buff;
     name += ".brep";
     FILE*    fic = fopen (name.c_str(), "w");
@@ -58,9 +58,9 @@ void save_brep (cpchar nom, string brep, int& compteur)
     fclose  (fic);
 }
 // ====================================================== geom_make_brep
-void geom_make_brep (TopoDS_Shape& shape, string& brep)
+void geom_make_brep (TopoDS_Shape& shape, std::string& brep)
 {
-   ostringstream  stream_shape;
+   std::ostringstream  stream_shape;
    BRepTools::Write (shape, stream_shape);
    brep = stream_shape.str();
 }
@@ -68,7 +68,7 @@ void geom_make_brep (TopoDS_Shape& shape, string& brep)
 TopoDS_Shape geom_brep2shape (rcstring brep)
 {
    TopoDS_Shape topo;
-   istringstream streamBrep(brep);
+   std::istringstream streamBrep(brep);
    BRep_Builder aBuilder;
    BRepTools::Read (topo, streamBrep, aBuilder);
    return topo;
@@ -76,7 +76,7 @@ TopoDS_Shape geom_brep2shape (rcstring brep)
 // ====================================================== geom_brep2shape
 int geom_brep2shape (rcstring brep, TopoDS_Shape& shape)
 {
-   istringstream streamBrep(brep);
+   std::istringstream streamBrep(brep);
    BRep_Builder  aBuilder;
    BRepTools::Read (shape, streamBrep, aBuilder);
    return HOK;
@@ -98,13 +98,25 @@ int geom_brep2point (rcstring brep, double& px, double& py, double& pz)
    pz = g_point.Z();
    return HOK;
 }
-END_NAMESPACE_HEXA
+// ====================================================== clear_associations
+//  void clear_associations (Edge* edge)
+//  {
+   //  edge->clearAssociation();
+   //  edge->getVertex(V_AMONT)->clearAssociation();
+   //  edge->getVertex(V_AVAL )->clearAssociation();
+//  }
+// ====================================================== clean_brep
+void clean_brep (std::string& brep)
+{
+   TopoDS_Shape  shape;
+   BRep_Builder  builder;
+   std::istringstream stream_brep (brep);
 
-#else // *************************************************** NO_CASCADE
+   BRepTools::Read  (shape, stream_brep, builder);
+   BRepTools::Clean (shape);
 
-BEGIN_NAMESPACE_HEXA
-int geom_brep2point (rcstring b, double& x, double& y, double& z) {return HOK;}
-int geom_brep2shape (rcstring brep, TopoDS_Shape& shape) {return HOK ; }
-TopoDS_Shape geom_brep2shape (rcstring brep)             {return O ; }
+   std::ostringstream    stream_shape;
+   BRepTools::Write (shape, stream_shape);
+   brep = stream_shape.str();
+}
 END_NAMESPACE_HEXA
-#endif