1 // Created by: Peter KURNEV
2 // Copyright (c) 2010-2014 OPEN CASCADE SAS
3 // Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
4 // Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
5 //                         EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 //
7 // This file is part of Open CASCADE Technology software library.
8 //
9 // This library is free software; you can redistribute it and/or modify it under
10 // the terms of the GNU Lesser General Public License version 2.1 as published
11 // by the Free Software Foundation, with special exception defined in the file
12 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
13 // distribution for complete text of the license and disclaimer of any warranty.
14 //
15 // Alternatively, this file may be used under the terms of Open CASCADE
16 // commercial license or contractual agreement.
17 
18 #ifndef _BOPAlgo_BuilderArea_HeaderFile
19 #define _BOPAlgo_BuilderArea_HeaderFile
20 
21 #include <Standard.hxx>
22 #include <Standard_DefineAlloc.hxx>
23 #include <Standard_Handle.hxx>
24 
25 #include <BOPAlgo_Algo.hxx>
26 #include <NCollection_BaseAllocator.hxx>
27 #include <TopTools_ListOfShape.hxx>
28 #include <TopTools_IndexedMapOfOrientedShape.hxx>
29 class IntTools_Context;
30 
31 
32 //! The root class for algorithms to build
33 //! faces/solids from set of edges/faces
34 class BOPAlgo_BuilderArea  : public BOPAlgo_Algo
35 {
36 public:
37 
38   DEFINE_STANDARD_ALLOC
39 
40   //! Sets the context for the algorithms
SetContext(const Handle (IntTools_Context)& theContext)41   void SetContext (const Handle(IntTools_Context)& theContext) {
42     myContext = theContext;
43   }
44 
45   //! Returns the input shapes
Shapes() const46   const TopTools_ListOfShape& Shapes() const {
47     return myShapes;
48   }
49 
50   //! Sets the shapes for building areas
SetShapes(const TopTools_ListOfShape & theLS)51   void SetShapes(const TopTools_ListOfShape& theLS) {
52     myShapes = theLS;
53   }
54 
55   //! Returns the found loops
Loops() const56   const TopTools_ListOfShape& Loops() const {
57     return myLoops;
58   }
59 
60   //! Returns the found areas
Areas() const61   const TopTools_ListOfShape& Areas() const {
62     return myAreas;
63   }
64 
65   //! Defines the preventing of addition of internal parts into result.
66   //! The default value is FALSE, i.e. the internal parts are added into result.
SetAvoidInternalShapes(const Standard_Boolean theAvoidInternal)67   void SetAvoidInternalShapes(const Standard_Boolean theAvoidInternal) {
68     myAvoidInternalShapes = theAvoidInternal;
69   }
70 
71   //! Returns the AvoidInternalShapes flag
IsAvoidInternalShapes() const72   Standard_Boolean IsAvoidInternalShapes() const {
73     return myAvoidInternalShapes;
74   }
75 
76 protected:
77 
78   Standard_EXPORT BOPAlgo_BuilderArea();
79   Standard_EXPORT virtual ~BOPAlgo_BuilderArea();
80 
81   Standard_EXPORT BOPAlgo_BuilderArea(const Handle(NCollection_BaseAllocator)& theAllocator);
82 
83   virtual void PerformShapesToAvoid() = 0;
84 
85   virtual void PerformLoops() = 0;
86 
87   virtual void PerformAreas() = 0;
88 
89   virtual void PerformInternalShapes() = 0;
90 
91 
92   Handle(IntTools_Context) myContext;
93   TopTools_ListOfShape myShapes;
94   TopTools_ListOfShape myLoops;
95   TopTools_ListOfShape myLoopsInternal;
96   TopTools_ListOfShape myAreas;
97   TopTools_IndexedMapOfOrientedShape myShapesToAvoid;
98   Standard_Boolean myAvoidInternalShapes;
99 
100 private:
101 
102 };
103 
104 #endif // _BOPAlgo_BuilderArea_HeaderFile
105