2 // class : Gestion des formes associees (Hexa 5)
7 #include "HexEltBase.hxx"
10 #include <TopTools_IndexedMapOfShape.hxx>
11 #include <TopoDS_Shape.hxx>
12 #include <TopoDS_Compound.hxx>
13 #include <BRep_Builder.hxx>
18 class HexaExport NewShape : public EltBase
21 virtual int countVertex () { return tab_vertex.size (); }
22 virtual int countEdge () { return tab_edge.size (); }
23 virtual int countFace () { return tab_face.size (); }
25 int getVertex (int nro);
26 int getEdge (int nro);
27 int getFace (int nro);
29 cpchar getNameVertex (int nro);
30 cpchar getNameEdge (int nro);
31 cpchar getNameFace (int nro);
33 NewShape (Document* dad, EnumShape type=SH_NONE);
37 const string& getBrep ();
38 const TopoDS_Shape& getShape ();
40 EnumShape getOrigin () { return sh_origin ; }
41 VertexShape* getVertexShape (int nro);
42 EdgeShape* getEdgeShape (int nro);
43 FaceShape* getFaceShape (int nro);
45 public : // for Others
46 void setShape (const TopoDS_Shape& shape, EnumShape type=SH_IMPORT);
47 void setBrep (rcstring brep);
48 int addPoint (double* coord);
49 void addAssociation (Vertex* elt, int subid, double param);
50 void addAssociation (Edge* elt, int subid, double pmin, double pmax);
51 void addAssociation (Quad* elt, int subid);
53 VertexShape* findVertex (int subid);
54 VertexShape* findVertex (double point[]);
55 EdgeShape* findEdge (int subid);
56 EdgeShape* findEdge (double p1[], double p2[]);
57 FaceShape* findFace (int subid);
59 SubShape* findSubShape (int subid);
62 const TopoDS_Shape& getGeoShape (int subid);
65 void saveXml (XmlWriter* xml);
68 int addCircle (double* center, double rad, double* norm, double* base);
69 int addSphere (double* center, double radius);
70 int transfoShape (Matrix& matrix, SubShape* shape);
71 int translateShape (double dir[], SubShape* shape);
77 // ---------------------------- Parcours
78 void parseShape (const TopoDS_Shape& shape);
79 void push_level () { sh_level ++ ; }
80 void pop_level () { sh_level -- ; }
81 void addSubShape (const TopoDS_Shape& shape);
83 private : // ________________________________________________________
84 TopoDS_Shape geo_shape;
88 bool brep_defined, shape_defined;
90 TopTools_IndexedMapOfShape map_shape;
91 std::vector <FaceShape*> tab_face;
92 std::vector <EdgeShape*> tab_edge;
93 std::vector <VertexShape*> tab_vertex;
95 // Pour Construire les shapes internes
97 TopoDS_Compound geo_compound;
98 BRep_Builder geo_builder;
100 std::vector <Vertex*> asso_vertex;
103 RealVector asso_pmin, asso_pmax, asso_param;
104 IntVector asso_edid, asso_quid, asso_vxid;