2 // class : Gestion des formes associees (Hexa 5)
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 #ifndef __NEW_SHAPE_H_
24 #define __NEW_SHAPE_H_
26 #include "HexEltBase.hxx"
29 #include <TopTools_IndexedMapOfShape.hxx>
30 #include <TopoDS_Shape.hxx>
31 #include <TopoDS_Compound.hxx>
32 #include <BRep_Builder.hxx>
37 class NewShape : public EltBase
40 virtual int countVertex () { return tab_vertex.size (); }
41 virtual int countEdge () { return tab_edge.size (); }
42 virtual int countFace () { return tab_face.size (); }
44 int getVertex (int nro);
45 int getEdge (int nro);
46 int getFace (int nro);
48 cpchar getNameVertex (int nro);
49 cpchar getNameEdge (int nro);
50 cpchar getNameFace (int nro);
52 const string& getBrep ();
53 const TopoDS_Shape& getShape ();
56 EnumShape getOrigin () { return sh_origin ; }
57 VertexShape* getVertexShape (int nro);
58 EdgeShape* getEdgeShape (int nro);
59 FaceShape* getFaceShape (int nro);
61 public : // for Others
62 NewShape (Document* dad, EnumShape type=SH_NONE);
63 void setShape (const TopoDS_Shape& shape, EnumShape type=SH_IMPORT);
64 void setBrep (rcstring brep);
65 int addPoint (double* coord);
66 void addAssociation (Vertex* elt, int subid, double param);
67 void addAssociation (Edge* elt, int subid, double pmin, double pmax);
68 void addAssociation (Quad* elt, int subid);
70 VertexShape* findVertex (int subid);
71 EdgeShape* findEdge (int subid);
72 FaceShape* findFace (int subid);
74 SubShape* findSubShape (int subid);
76 const TopoDS_Shape& getGeoShape (int subid);
79 void saveXml (XmlWriter* xml);
82 int addCircle (double* center, double rad, double* norm, double* base);
83 int addSphere (double* center, double radius);
89 // ---------------------------- Parcours
90 void parseShape (const TopoDS_Shape& shape);
91 void push_level () { sh_level ++ ; }
92 void pop_level () { sh_level -- ; }
93 void addSubShape (const TopoDS_Shape& shape);
95 private : // ________________________________________________________
96 TopoDS_Shape geo_shape;
100 bool brep_defined, shape_defined;
102 TopTools_IndexedMapOfShape map_shape;
103 std::vector <FaceShape*> tab_face;
104 std::vector <EdgeShape*> tab_edge;
105 std::vector <VertexShape*> tab_vertex;
107 // Pour Construire les shapes internes
109 TopoDS_Compound geo_compound;
110 BRep_Builder geo_builder;
112 std::vector <Vertex*> asso_vertex;
115 RealVector asso_pmin, asso_pmax, asso_param;
116 IntVector asso_edid, asso_quid, asso_vxid;