2 // class : Gestion des formes associees (Hexa 5)
4 // Copyright (C) 2009-2014 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, or (at your option) any later version.
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 HexaExport 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 NewShape (Document* dad, EnumShape type=SH_NONE);
57 const TopoDS_Shape& getShape ();
59 EnumShape getOrigin () { return sh_origin ; }
60 VertexShape* getVertexShape (int nro);
61 EdgeShape* getEdgeShape (int nro);
62 FaceShape* getFaceShape (int nro);
64 public : // for Others
65 void setShape (const TopoDS_Shape& shape, EnumShape type=SH_IMPORT);
66 void setBrep (rcstring brep);
67 int addPoint (double* coord);
68 void addAssociation (Vertex* elt, int subid, double param);
69 void addAssociation (Edge* elt, int subid, double pmin, double pmax);
70 void addAssociation (Quad* elt, int subid);
72 VertexShape* findVertex (int subid);
73 VertexShape* findVertex (double point[]);
74 EdgeShape* findEdge (int subid);
75 EdgeShape* findEdge (double p1[], double p2[]);
76 FaceShape* findFace (int subid);
78 SubShape* findSubShape (int subid);
81 const TopoDS_Shape& getGeoShape (int subid);
84 void saveXml (XmlWriter* xml);
87 int addCircle (double* center, double rad, double* norm, double* base);
88 int addSphere (double* center, double radius);
89 int transfoShape (Matrix& matrix, SubShape* shape);
90 int translateShape (double dir[], SubShape* shape);
96 // ---------------------------- Parcours
97 void parseShape (const TopoDS_Shape& shape);
98 void push_level () { sh_level ++ ; }
99 void pop_level () { sh_level -- ; }
100 void addSubShape (const TopoDS_Shape& shape);
102 private : // ________________________________________________________
103 TopoDS_Shape geo_shape;
107 bool brep_defined, shape_defined;
109 TopTools_IndexedMapOfShape map_shape;
110 std::vector <FaceShape*> tab_face;
111 std::vector <EdgeShape*> tab_edge;
112 std::vector <VertexShape*> tab_vertex;
114 // Pour Construire les shapes internes
116 TopoDS_Compound geo_compound;
117 BRep_Builder geo_builder;
119 std::vector <Vertex*> asso_vertex;
122 RealVector asso_pmin, asso_pmax, asso_param;
123 IntVector asso_edid, asso_quid, asso_vxid;