Salome HOME
Fix regression in unit tests
[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]  theNorm        normal of the sketch
30    *  \param[in]  theFeatures    initial features of the sketch
31    *  \param[out] theResultFaces faces based on closed wires
32    *  \param[out] theResultWires unclosed wires of the sketch
33    *
34    *  The algorithm searches all loops of edges surrounding lesser squares.
35    *  It finds the vertex with minimal coordinates along X axis (theDirX) and then 
36    *  goes through the edges passing the surrounding area on the left.
37    */
38   static void createFaces(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
39                           const std::shared_ptr<GeomAPI_Dir>& theDirX,
40                           const std::shared_ptr<GeomAPI_Dir>& theNorm,
41                           const std::list<std::shared_ptr<GeomAPI_Shape> >& theFeatures,
42                           std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces,
43                           std::list<std::shared_ptr<GeomAPI_Shape> >& theResultWires);
44
45   /** \brief Creates list of faces and unclosed wires on basis of the features of the sketch
46    *  \param[in]  theOrigin      origin point of the sketch
47    *  \param[in]  theDirX        x-direction of the sketch
48    *  \param[in]  theNorm        normal of the sketch
49    *  \param[in]  theWire        a wire which contains all edges
50    *  \param[out] theResultFaces faces based on closed wires
51    *
52    *  The algorithm searches all loops of edges surrounding lesser squares.
53    *  It finds the vertex with minimal coordinates along X axis (theDirX) and then
54    *  goes through the edges passing the surrounding area on the left.
55    */
56   static void createFaces(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
57                           const std::shared_ptr<GeomAPI_Dir>& theDirX,
58                           const std::shared_ptr<GeomAPI_Dir>& theNorm,
59                           const std::shared_ptr<GeomAPI_Shape>& theWire,
60                           std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces);
61
62   /** \brief Searches intersections between the faces in the list 
63    *         and make holes in the faces to avoid intersections
64    *  \param[in,out] theFaces list of faces to proccess
65    */
66   static void fixIntersections(std::list<std::shared_ptr<GeomAPI_Shape> >& theFaces);
67 };
68
69 #endif