Salome HOME
6b9b396e45970612f4454aef9c9b392e9ccfa862
[modules/shaper.git] / src / GeomAlgoImpl / GEOMAlgo_Splitter.hxx
1 // Copyright (C) 2007-2022  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef GEOMAlgo_Splitter_HeaderFile
21 #define GEOMAlgo_Splitter_HeaderFile
22
23 #include <GeomAlgoImpl.h>
24
25 #include <Standard.hxx>
26 #include <Standard_Macro.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <Standard_Integer.hxx>
29
30 #include <NCollection_BaseAllocator.hxx>
31
32 #include <TopAbs_ShapeEnum.hxx>
33
34 #include <TopoDS_Shape.hxx>
35
36 #include <BOPAlgo_Builder.hxx>
37
38 //=======================================================================
39 //class    : GEOMAlgo_Splitter
40 //purpose  :
41 //=======================================================================
42 /*!
43  * \class GEOMAlgo_Splitter
44  * \ingroup DataAlgo
45  * A class for shapes partitioning
46  */
47  class GEOMAlgo_Splitter : public BOPAlgo_Builder
48 {
49  public:
50   /// Constructor
51   GEOMALGOIMPL_EXPORT GEOMAlgo_Splitter();
52
53   /// Constructor
54   /// \param theAllocator an allocator object
55   GEOMALGOIMPL_EXPORT GEOMAlgo_Splitter(const Handle(NCollection_BaseAllocator)& theAllocator);
56   
57   GEOMALGOIMPL_EXPORT virtual ~GEOMAlgo_Splitter();
58
59   /// Add a tool shape
60   /// \param theShape a tool shape
61   GEOMALGOIMPL_EXPORT void AddTool(const TopoDS_Shape& theShape);
62
63   /// Returns list of tool shapes
64   GEOMALGOIMPL_EXPORT const NCollection_List<TopoDS_Shape>& Tools()const;
65
66   /// Set type of used shapes
67   /// \param aLimit a shape type
68   GEOMALGOIMPL_EXPORT void SetLimit(const TopAbs_ShapeEnum aLimit);
69
70   /// Returns defined limit type
71   GEOMALGOIMPL_EXPORT TopAbs_ShapeEnum Limit()const;
72
73   /// Set mode (0 or 1) of limit
74   /// \param aMode the mode value
75   GEOMALGOIMPL_EXPORT void SetLimitMode(const Standard_Integer aMode);
76
77   /// Returns mode of limit
78   GEOMALGOIMPL_EXPORT Standard_Integer LimitMode()const;
79
80   /// Clears all tool shapes
81   GEOMALGOIMPL_EXPORT virtual void Clear();
82
83  protected:
84    /// Build result.
85    /// \param theType a type of limit
86   GEOMALGOIMPL_EXPORT virtual void BuildResult(const TopAbs_ShapeEnum theType);
87
88   /// Post processing of the calculation
89   GEOMALGOIMPL_EXPORT virtual void PostTreat();
90   
91  protected:
92    /// List of tools
93   NCollection_List<TopoDS_Shape> myTools;
94
95   /// Map of tools
96   NCollection_Map<TopoDS_Shape> myMapTools;
97
98   /// A limit type
99   TopAbs_ShapeEnum myLimit;   
100
101   /// A limit mode
102   Standard_Integer myLimitMode;  
103 };
104
105 #endif