Salome HOME
Merge branch 'SketchSolver'
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_SketchBuilder.h
1 // File:        GeomAlgoAPI_SketchBuilder.h
2 // Created:     02 Jun 2014
3 // Author:      Artem ZHIDKOV
4
5 #ifndef GeomAlgoAPI_SketchBuilder_HeaderFile
6 #define GeomAlgoAPI_SketchBuilder_HeaderFile
7
8 #include <GeomAlgoAPI.h>
9
10 #include <boost/shared_ptr.hpp>
11 #include <list>
12
13 #include <GeomAPI_Dir.h>
14 #include <GeomAPI_Shape.h>
15
16 /** \class GeomAlgoAPI_SketchBuilder
17  *  \ingroup DataAlgo
18  *  \brief Creates planar faces based on the list of Sketch features
19  */
20 class GEOMALGOAPI_EXPORT GeomAlgoAPI_SketchBuilder
21 {
22 public:
23   /** \brief Creates list of faces and unclosed wires on basis of the features of the sketch
24    *  \param[in]  theDirX        x-direction of the sketch
25    *  \param[in]  theDirY        y-direction of the sketch
26    *  \param[in]  theNorm        normal of the sketch
27    *  \param[in]  theFeatures    initial features of the sketch
28    *  \param[out] theResultFaces faces based on closed wires
29    *  \param[out] theResultWires unclosed wires of the sketch
30    *
31    *  The algorithm searches all loops of edges surrounding lesser squares.
32    *  It finds the vertex with minimal coordinates along X axis (theDirX) and then 
33    *  goes through the edges passing the surrounding area on the left.
34    */
35   static void createFaces(const boost::shared_ptr<GeomAPI_Dir>&                theDirX,
36                           const boost::shared_ptr<GeomAPI_Dir>&                theDirY,
37                           const boost::shared_ptr<GeomAPI_Dir>&                theNorm,
38                           const std::list< boost::shared_ptr<GeomAPI_Shape> >& theFeatures,
39                                 std::list< boost::shared_ptr<GeomAPI_Shape> >& theResultFaces,
40                                 std::list< boost::shared_ptr<GeomAPI_Shape> >& theResultWires);
41
42   /** \brief Searches intersections between the faces in the list 
43    *         and make holes in the faces to avoid intersections
44    *  \param[in,out] theFaces list of faces to proccess
45    */
46   static void fixIntersections(std::list< boost::shared_ptr<GeomAPI_Shape> >& theFaces);
47 };
48
49 #endif