Salome HOME
OCCT 6.8.0 (dev) porting
[modules/hexablock.git] / src / HEXABLOCK / HexNewShape.cxx
index 6f9e6f3363a6648134a33fea3228a649b71ea492..ee0a18b9ba8009c5b1a06aa57682fa4559fddea9 100755 (executable)
@@ -1,12 +1,12 @@
 
 // C++ : Gestion des Shapes (Hexa v5)
 
-// Copyright (C) 2009-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2009-2014  CEA/DEN, EDF R&D
 //
 // 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
@@ -17,8 +17,8 @@
 // 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 "HexNewShape.hxx"
 #include "HexSubShape.hxx"
 #include <gp_Lin.hxx>
 #include <gp_Circ.hxx>
 
+#include <Basics_OCCTVersion.hxx>
 
 BEGIN_NAMESPACE_HEXA
 
 static bool db  = on_debug ();  // == getenv ("HEXA_DB") > 0
-static bool db0 = true;
+static bool db0 = db;
 
 // ====================================================== Constructeur
 NewShape::NewShape (Document* dad, EnumShape type)
@@ -178,8 +179,12 @@ int NewShape::transfoShape (Matrix& matrice, SubShape* shape)
    gp_Trsf transfo;
    double             a11,a12,a13,a14, a21,a22,a23,a24, a31,a32,a33,a34;
    matrice.getCoeff  (a11,a12,a13,a14, a21,a22,a23,a24, a31,a32,a33,a34);
+#if OCC_VERSION_LARGE > 0x06070100
+   transfo.SetValues (a11,a12,a13,a14, a21,a22,a23,a24, a31,a32,a33,a34);
+#else
    transfo.SetValues (a11,a12,a13,a14, a21,a22,a23,a24, a31,a32,a33,a34,
                       Epsil2, Epsil2);
+#endif
 
    TopoDS_Shape shape_orig = shape->getShape ();
    BRepBuilderAPI_Transform builder (shape_orig, transfo, Standard_True);
@@ -224,6 +229,15 @@ void NewShape::addAssociation (Edge* edge, int subid, double pmin, double pmax)
    if (edge==NULL)
       return;
 
+   if (db0) 
+      {
+      cout << edge->getName() 
+           << " = (" << edge->getVertex(0)->getName() 
+           << ", "   << edge->getVertex(1)->getName() 
+           << ") --> subid= " << subid << " [ " 
+           << pmin << ", " << pmax << "]" << endl;
+      }
+
    asso_edge.push_back (edge);
    asso_pmin.push_back (pmin);
    asso_pmax.push_back (pmax);
@@ -282,6 +296,18 @@ VertexShape* NewShape::findVertex (int shid)
        }
    return NULL;
 }
+// ====================================================== findVertex
+VertexShape* NewShape::findVertex (double point[])
+{
+   int nbre = tab_vertex.size ();
+   for (int nro=0 ; nro < nbre ; nro++)
+       {
+       VertexShape* shape = tab_vertex [nro];
+       if (shape->definedBy (point))
+          return shape;
+       }
+   return NULL;
+}
 // ====================================================== findEdge
 EdgeShape* NewShape::findEdge (int shid)
 {
@@ -294,6 +320,18 @@ EdgeShape* NewShape::findEdge (int shid)
        }
    return NULL;
 }
+// ====================================================== findEdge
+EdgeShape* NewShape::findEdge (double p1[], double p2[])
+{
+   int nbre = tab_edge.size ();
+   for (int nro=0 ; nro < nbre ; nro++)
+       {
+       EdgeShape* shape = tab_edge [nro];
+       if (shape->definedBy (p1, p2))
+          return shape;
+       }
+   return NULL;
+}
 // ====================================================== findFace
 FaceShape* NewShape::findFace (int shid)
 {
@@ -430,6 +468,14 @@ int NewShape::saveBrep ()
    fclose  (fic);
    return HOK;
 }
+// ===================================================== getBrep
+cpchar NewShape::getBrep ()
+{
+   int ier   = updateBrep ();
+   if (ier != HOK)
+      return NULL;
+   return geo_brep.c_str();
+}
 // ====================================================== saveXml
 void NewShape::saveXml (XmlWriter* xml)
 {