2 // class : Gestion des formes associees (Hexa 5)
7 #include "Hex_defines.hxx"
8 #include "HexEltBase.hxx"
11 #include <TopTools_IndexedMapOfShape.hxx>
12 #include <TopoDS_Shape.hxx>
13 #include <TopoDS_Compound.hxx>
14 #include <BRep_Builder.hxx>
19 class HEXABLOCKENGINE_EXPORT NewShape : public EltBase
22 virtual int countVertex () { return tab_vertex.size (); }
23 virtual int countEdge () { return tab_edge.size (); }
24 virtual int countFace () { return tab_face.size (); }
26 int getVertex (int nro);
27 int getEdge (int nro);
28 int getFace (int nro);
30 cpchar getNameVertex (int nro);
31 cpchar getNameEdge (int nro);
32 cpchar getNameFace (int nro);
34 NewShape (Document* dad, EnumShape type=SH_NONE);
38 const string& getBrep ();
39 const TopoDS_Shape& getShape ();
41 EnumShape getOrigin () { return sh_origin ; }
42 VertexShape* getVertexShape (int nro);
43 EdgeShape* getEdgeShape (int nro);
44 FaceShape* getFaceShape (int nro);
46 public : // for Others
47 void setShape (const TopoDS_Shape& shape, EnumShape type=SH_IMPORT);
48 void setBrep (rcstring brep);
49 int addPoint (double* coord);
50 void addAssociation (Vertex* elt, int subid, double param);
51 void addAssociation (Edge* elt, int subid, double pmin, double pmax);
52 void addAssociation (Quad* elt, int subid);
54 VertexShape* findVertex (int subid);
55 EdgeShape* findEdge (int subid);
56 FaceShape* findFace (int subid);
58 SubShape* findSubShape (int subid);
60 const TopoDS_Shape& getGeoShape (int subid);
63 void saveXml (XmlWriter* xml);
66 int addCircle (double* center, double rad, double* norm, double* base);
67 int addSphere (double* center, double radius);
68 int transfoShape (Matrix& matrix, SubShape* shape);
69 int translateShape (double dir[], SubShape* shape);
75 // ---------------------------- Parcours
76 void parseShape (const TopoDS_Shape& shape);
77 void push_level () { sh_level ++ ; }
78 void pop_level () { sh_level -- ; }
79 void addSubShape (const TopoDS_Shape& shape);
81 private : // ________________________________________________________
82 TopoDS_Shape geo_shape;
86 bool brep_defined, shape_defined;
88 TopTools_IndexedMapOfShape map_shape;
89 std::vector <FaceShape*> tab_face;
90 std::vector <EdgeShape*> tab_edge;
91 std::vector <VertexShape*> tab_vertex;
93 // Pour Construire les shapes internes
95 TopoDS_Compound geo_compound;
96 BRep_Builder geo_builder;
98 std::vector <Vertex*> asso_vertex;
101 RealVector asso_pmin, asso_pmax, asso_param;
102 IntVector asso_edid, asso_quid, asso_vxid;