]> SALOME platform Git repositories - modules/hexablock.git/blob - src/HEXABLOCK/HexNewShape.hxx
Salome HOME
cb38a614615743905f72ac93abb46e51a3609815
[modules/hexablock.git] / src / HEXABLOCK / HexNewShape.hxx
1
2 // class : Gestion des formes associees (Hexa 5)
3
4 #ifndef __NEW_SHAPE_H_
5 #define __NEW_SHAPE_H_
6
7 #include "HexEltBase.hxx"
8
9 #ifndef NO_CASCADE
10 #include <TopTools_IndexedMapOfShape.hxx>
11 #include <TopoDS_Shape.hxx>
12 #include <TopoDS_Compound.hxx>
13 #include <BRep_Builder.hxx>
14 #endif
15
16 BEGIN_NAMESPACE_HEXA
17
18 class NewShape : public EltBase
19 {
20 public :         // for TUI
21    virtual int countVertex ()   { return tab_vertex.size ();  }
22    virtual int countEdge   ()   { return tab_edge.size ();    }
23    virtual int countFace   ()   { return tab_face.size ();    }
24
25    int getVertex (int nro);
26    int getEdge   (int nro);
27    int getFace   (int nro);
28
29    cpchar getNameVertex  (int nro);
30    cpchar getNameEdge    (int nro);
31    cpchar getNameFace    (int nro);
32
33    const string&       getBrep ();
34    const TopoDS_Shape& getShape ();
35
36 public :         // for GUI
37    EnumShape    getOrigin ()        { return sh_origin ; }
38    VertexShape* getVertexShape (int nro);
39    EdgeShape*   getEdgeShape (int nro);
40    FaceShape*   getFaceShape (int nro);
41
42 public :         // for Others
43    NewShape (Document* dad, EnumShape type=SH_NONE);
44    void  setShape (const TopoDS_Shape& shape, EnumShape type=SH_IMPORT);
45    void  setBrep  (rcstring brep);
46    int   addPoint (double* coord);
47    void  addAssociation (Vertex* elt, int subid, double param);
48    void  addAssociation (Edge*   elt, int subid, double pmin, double pmax);
49    void  addAssociation (Quad*   elt, int subid);
50
51    VertexShape* findVertex   (int subid);
52    EdgeShape*   findEdge     (int subid);
53    FaceShape*   findFace     (int subid);
54
55    SubShape*    findSubShape (int subid);
56
57    const TopoDS_Shape& getGeoShape (int subid);
58
59    int   saveBrep ();
60    void  saveXml  (XmlWriter* xml);
61
62    void openShape ();
63    int  addCircle (double* center, double rad, double* norm, double* base);
64    int  addSphere (double* center, double radius);
65    void closeShape();
66
67 private :
68    int  updateShape ();
69    int  updateBrep  ();
70                                 // ---------------------------- Parcours
71    void parseShape  (const TopoDS_Shape& shape);
72    void push_level  ()     { sh_level ++ ; }
73    void pop_level   ()     { sh_level -- ; }
74    void addSubShape (const TopoDS_Shape& shape);
75
76 private :     // ________________________________________________________
77    TopoDS_Shape    geo_shape;
78
79    EnumShape    sh_origin;
80    string       geo_brep;
81    bool         brep_defined, shape_defined;
82
83    TopTools_IndexedMapOfShape map_shape;
84    std::vector <FaceShape*>    tab_face;
85    std::vector <EdgeShape*>    tab_edge;
86    std::vector <VertexShape*>  tab_vertex;
87
88                          // Pour Construire les shapes internes
89    int curr_subid;
90    TopoDS_Compound geo_compound;
91    BRep_Builder    geo_builder;
92
93    std::vector <Vertex*>  asso_vertex;
94    Quads      asso_quad;
95    Edges      asso_edge;
96    RealVector asso_pmin, asso_pmax, asso_param;
97    IntVector  asso_edid, asso_quid, asso_vxid;
98                          // Pour le parsing
99    int sh_level;
100    int sh_indice;
101    int sh_face_max;
102    int sh_edge_max;
103    int sh_vertex_max;
104 };
105 END_NAMESPACE_HEXA
106 #endif