Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_SketchBuilder.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAlgoAPI_SketchBuilder.h
4 // Created:     02 Jun 2014
5 // Author:      Artem ZHIDKOV
6
7 #ifndef GeomAlgoAPI_SketchBuilder_H_
8 #define GeomAlgoAPI_SketchBuilder_H_
9
10 #include <GeomAlgoAPI.h>
11
12 #include <memory>
13 #include <list>
14
15 #include <GeomAPI_Dir.h>
16 #include <GeomAPI_Pnt.h>
17 #include <GeomAPI_Shape.h>
18
19 /** \class GeomAlgoAPI_SketchBuilder
20  *  \ingroup DataAlgo
21  *  \brief Creates planar faces based on the list of Sketch features
22  */
23 class GEOMALGOAPI_EXPORT GeomAlgoAPI_SketchBuilder
24 {
25  public:
26   /** \brief Creates list of faces and unclosed wires on basis of the features of the sketch
27    *  \param[in]  theOrigin      origin point of the sketch
28    *  \param[in]  theDirX        x-direction of the sketch
29    *  \param[in]  theDirY        y-direction of the sketch
30    *  \param[in]  theNorm        normal of the sketch
31    *  \param[in]  theFeatures    initial features of the sketch
32    *  \param[out] theResultFaces faces based on closed wires
33    *  \param[out] theResultWires unclosed wires of the sketch
34    *
35    *  The algorithm searches all loops of edges surrounding lesser squares.
36    *  It finds the vertex with minimal coordinates along X axis (theDirX) and then 
37    *  goes through the edges passing the surrounding area on the left.
38    */
39   static void createFaces(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
40                           const std::shared_ptr<GeomAPI_Dir>& theDirX,
41                           const std::shared_ptr<GeomAPI_Dir>& theNorm,
42                           const std::list<std::shared_ptr<GeomAPI_Shape> >& theFeatures,
43                           std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces,
44                           std::list<std::shared_ptr<GeomAPI_Shape> >& theResultWires);
45
46   /** \brief Creates list of faces and unclosed wires on basis of the features of the sketch
47    *  \param[in]  theOrigin      origin point of the sketch
48    *  \param[in]  theDirX        x-direction of the sketch
49    *  \param[in]  theDirY        y-direction of the sketch
50    *  \param[in]  theNorm        normal of the sketch
51    *  \param[in]  theWire        a wire which contains all edges
52    *  \param[out] theResultFaces faces based on closed wires
53    *
54    *  The algorithm searches all loops of edges surrounding lesser squares.
55    *  It finds the vertex with minimal coordinates along X axis (theDirX) and then
56    *  goes through the edges passing the surrounding area on the left.
57    */
58   static void createFaces(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
59                           const std::shared_ptr<GeomAPI_Dir>& theDirX,
60                           const std::shared_ptr<GeomAPI_Dir>& theNorm,
61                           const std::shared_ptr<GeomAPI_Shape>& theWire,
62                           std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces);
63
64   /** \brief Searches intersections between the faces in the list 
65    *         and make holes in the faces to avoid intersections
66    *  \param[in,out] theFaces list of faces to proccess
67    */
68   static void fixIntersections(std::list<std::shared_ptr<GeomAPI_Shape> >& theFaces);
69 };
70
71 #endif