// C++ : Gestion des Shapes (Hexa v5)
-// Copyright (C) 2009-2013 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 "HexNewShape.hxx"
#include "HexSubShape.hxx"
#include <gp_Lin.hxx>
#include <gp_Circ.hxx>
-
BEGIN_NAMESPACE_HEXA
static bool db = on_debug (); // == getenv ("HEXA_DB") > 0
sh_face_max = sh_edge_max = sh_vertex_max = 0;
if (db)
- cout << " ------------------- setShape " << el_name << endl;
+ std::cout << " ------------------- setShape " << el_name << std::endl;
parseShape (geo_shape);
}
// ====================================================== setBrep
geo_builder.Add (geo_compound, geom_circ);
if (db)
- cout << " .... AddCircle subid " << curr_subid << " : rayon=" << rayon
- << " centre = " << milieu[dir_x] << "," << milieu[dir_y]
- << "," << milieu[dir_z]
- << " norm = " << normale[dir_x] << "," << normale[dir_y]
- << "," << normale[dir_z]
- << endl;
+ std::cout << " .... AddCircle subid " << curr_subid << " : rayon=" << rayon
+ << " centre = " << milieu[dir_x] << "," << milieu[dir_y]
+ << "," << milieu[dir_z]
+ << " norm = " << normale[dir_x] << "," << normale[dir_y]
+ << "," << normale[dir_z]
+ << std::endl;
int subid = curr_subid;
curr_subid += 2;
geo_builder.Add (geo_compound, geom_sphere);
if (db)
- cout << " .... AddSphere subid " << curr_subid << " : rayon=" << radius
- << " centre = " << milieu[dir_x] << "," << milieu[dir_y]
- << "," << milieu[dir_z] << endl;
+ std::cout << " .... AddSphere subid " << curr_subid << " : rayon=" << radius
+ << " centre = " << milieu[dir_x] << "," << milieu[dir_y]
+ << "," << milieu[dir_z] << std::endl;
int subid = curr_subid;
curr_subid += 7;
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);
- transfo.SetValues (a11,a12,a13,a14, a21,a22,a23,a24, a31,a32,a33,a34,
- Epsil2, Epsil2);
+ transfo.SetValues (a11,a12,a13,a14, a21,a22,a23,a24, a31,a32,a33,a34);
TopoDS_Shape shape_orig = shape->getShape ();
BRepBuilderAPI_Transform builder (shape_orig, transfo, Standard_True);
if (db0)
{
- cout << edge->getName()
- << " = (" << edge->getVertex(0)->getName()
- << ", " << edge->getVertex(1)->getName()
- << ") --> subid= " << subid << " [ "
- << pmin << ", " << pmax << "]" << endl;
+ std::cout << edge->getName()
+ << " = (" << edge->getVertex(0)->getName()
+ << ", " << edge->getVertex(1)->getName()
+ << ") --> subid= " << subid << " [ "
+ << pmin << ", " << pmax << "]" << std::endl;
}
asso_edge.push_back (edge);
geo_shape = geo_compound;
shape_defined = true;
if (db)
- cout << " ------------------- closeShape " << el_name << endl;
+ std::cout << " ------------------- closeShape " << el_name << std::endl;
parseShape (geo_shape);
int nombre = asso_edge.size ();
}
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)
{
}
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)
{
int subid = tab_vertex.size() + 2;
sprintf (suffix, ":vertex_%02d", subid);
- string name = el_name + suffix;
+ std::string name = el_name + suffix;
VertexShape* sub_shape = new VertexShape (this, subid, point);
sub_shape->setName (name);
// ===================================================== saveBrep
int NewShape::saveBrep ()
{
- string filename = el_name + ".brep";
+ std::string filename = el_name + ".brep";
int ier = updateBrep ();
if (ier != HOK)
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)
{
void NewShape::addSubShape (const TopoDS_Shape& shape)
{
char chnum [32];
- string name;
+ std::string name;
sh_indice ++;
int subid = map_shape.Add (shape);
if (db0)
{
sprintf (chnum, "%4d : ", sh_indice);
- cout << chnum;
- for (int nro=1; nro<sh_level; nro++) cout << " | ";
- cout << name;
+ std::cout << chnum;
+ for (int nro=1; nro<sh_level; nro++) std::cout << " | ";
+ std::cout << name;
if (type == TopAbs_VERTEX)
{
TopoDS_Vertex gver = TopoDS::Vertex (shape);
gp_Pnt gpoint = BRep_Tool::Pnt (gver);
- cout << " = (" << gpoint.X()
- << "," << gpoint.Y()
- << "," << gpoint.Z() << ")";
+ std::cout << " = (" << gpoint.X()
+ << "," << gpoint.Y()
+ << "," << gpoint.Z() << ")";
}
- cout << endl;
+ std::cout << std::endl;
}
}
// ===================================================== updateShape
shape_defined = true;
geom_brep2shape (geo_brep, geo_shape);
- cout << " ------------------- updateShape " << el_name << endl;
+ std::cout << " ------------------- updateShape " << el_name << std::endl;
parseShape (geo_shape);
return HOK;
}