2 // CC++ : Interface Cascade de la classe Elements
4 // Copyright (C) 2009-2013 CEA/DEN, EDF R&D
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "HexKasPoint.hxx"
24 #include "HexVertex.hxx"
25 #include "HexOldShape.hxx"
29 #include <BRepTools.hxx>
30 #include <BRep_Builder.hxx>
31 #include <BRepBuilderAPI_MakeVertex.hxx>
33 #include <GCPnts_AbscissaPoint.hxx>
36 #include <TopoDS_Shape.hxx>
37 #include <TopoDS_Vertex.hxx>
43 static bool db = false;
45 // ======================================================= Constructeur
51 // ======================================================= razPoint
52 void KasPoint::razPoint ()
56 for (int nc=0; nc <DIM3 ; nc++) g_coord [nc] = 0;
58 // ======================================================= definePoint (vertex)
59 int KasPoint::definePoint (Vertex* node)
68 Shape* asso = node->getAssociation();
72 b_rep = asso->getBrep ();
75 istringstream streamBrep(b_rep);
76 BRep_Builder aBuilder;
77 BRepTools::Read(topo, streamBrep, aBuilder);
79 if (topo.ShapeType() != TopAbs_VERTEX)
83 g_vertex = TopoDS::Vertex (topo);
84 g_point = BRep_Tool::Pnt( g_vertex );
86 g_coord [dir_x] = g_point.X();
87 g_coord [dir_y] = g_point.Y();
88 g_coord [dir_z] = g_point.Z();
92 // ======================================================= definePoint (xyz)
93 void KasPoint::definePoint (Real3 coord)
95 gp_Pnt gpoint (coord[dir_x], coord[dir_y], coord[dir_z]);
98 // ======================================================= definePoint (g_pnt)
99 void KasPoint::definePoint (gp_Pnt& gpoint)
104 ostringstream stream_shape;
106 BRepBuilderAPI_MakeVertex mkVertex (g_point);
107 TopoDS_Shape aShape = mkVertex.Shape();
108 BRepTools::Write(aShape, stream_shape);
110 g_vertex = TopoDS::Vertex( aShape );
111 b_rep = stream_shape.str();
113 g_coord [dir_x] = g_point.X();
114 g_coord [dir_y] = g_point.Y();
115 g_coord [dir_z] = g_point.Z();
119 cout << " KasPoint::definePoint :" << endl;
123 // ======================================================= associate
124 void KasPoint::associate (Vertex* node)
127 if (db) cout << " ++ KasPoint::associate " << endl;
128 if (db) PutName (node);
132 Shape* vshape = new Shape (b_rep);
133 node->setAssociation (vshape);
135 *********************/