| 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_Builder_HeaderFile |
| 19 | #define _BOPAlgo_Builder_HeaderFile |
| 20 | |
| 21 | #include <Standard.hxx> |
| 22 | #include <Standard_DefineAlloc.hxx> |
| 23 | #include <Standard_Handle.hxx> |
| 24 | |
| 25 | #include <BOPCol_ListOfShape.hxx> |
| 26 | #include <BOPCol_MapOfShape.hxx> |
| 27 | #include <BOPAlgo_PPaveFiller.hxx> |
| 28 | #include <BOPDS_PDS.hxx> |
| 29 | #include <Standard_Integer.hxx> |
| 30 | #include <BOPCol_DataMapOfShapeListOfShape.hxx> |
| 31 | #include <BOPCol_DataMapOfShapeShape.hxx> |
| 32 | #include <Standard_Real.hxx> |
| 33 | #include <BOPAlgo_BuilderShape.hxx> |
| 34 | #include <BOPCol_BaseAllocator.hxx> |
| 35 | #include <TopTools_ListOfShape.hxx> |
| 36 | #include <Standard_Boolean.hxx> |
| 37 | #include <TopAbs_ShapeEnum.hxx> |
| 38 | class IntTools_Context; |
| 39 | class TopoDS_Shape; |
| 40 | class BOPAlgo_PaveFiller; |
| 41 | |
| 42 | |
| 43 | |
| 44 | class BOPAlgo_Builder : public BOPAlgo_BuilderShape |
| 45 | { |
| 46 | public: |
| 47 | |
| 48 | DEFINE_STANDARD_ALLOC |
| 49 | |
| 50 | |
| 51 | Standard_EXPORT BOPAlgo_Builder(); |
| 52 | Standard_EXPORT virtual ~BOPAlgo_Builder(); |
| 53 | |
| 54 | Standard_EXPORT BOPAlgo_Builder(const BOPCol_BaseAllocator& theAllocator); |
| 55 | |
| 56 | Standard_EXPORT virtual void Clear(); |
| 57 | |
| 58 | Standard_EXPORT BOPAlgo_PPaveFiller PPaveFiller(); |
| 59 | |
| 60 | Standard_EXPORT BOPDS_PDS PDS(); |
| 61 | |
| 62 | Standard_EXPORT virtual void AddArgument (const TopoDS_Shape& theShape); |
| 63 | |
| 64 | Standard_EXPORT virtual void SetArguments (const BOPCol_ListOfShape& theLS); |
| 65 | |
| 66 | Standard_EXPORT const BOPCol_ListOfShape& Arguments() const; |
| 67 | |
| 68 | Standard_EXPORT virtual void Perform() Standard_OVERRIDE; |
| 69 | |
| 70 | Standard_EXPORT virtual void PerformWithFiller (const BOPAlgo_PaveFiller& theFiller); |
| 71 | |
| 72 | //! Returns the list of shapes generated from the |
| 73 | //! shape theS. |
| 74 | Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& theS) Standard_OVERRIDE; |
| 75 | |
| 76 | //! Returns the list of shapes modified from the shape |
| 77 | //! theS. |
| 78 | Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& theS) Standard_OVERRIDE; |
| 79 | |
| 80 | //! Returns true if the shape theS has been deleted. |
| 81 | Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& theS) Standard_OVERRIDE; |
| 82 | |
| 83 | Standard_EXPORT const BOPCol_DataMapOfShapeListOfShape& Images() const; |
| 84 | |
| 85 | Standard_EXPORT Standard_Boolean IsInterferred (const TopoDS_Shape& theS) const; |
| 86 | |
| 87 | //! Returns myOrigins. |
| 88 | Standard_EXPORT const BOPCol_DataMapOfShapeShape& Origins() const; |
| 89 | |
| 90 | //! Returns myShapesSD. |
| 91 | Standard_EXPORT const BOPCol_DataMapOfShapeShape& ShapesSD() const; |
| 92 | |
| 93 | //! Returns mySplits. |
| 94 | Standard_EXPORT const BOPCol_DataMapOfShapeListOfShape& Splits() const; |
| 95 | |
| 96 | //! Sets the additional tolerance |
| 97 | Standard_EXPORT void SetFuzzyValue (const Standard_Real theFuzz); |
| 98 | |
| 99 | //! Returns the additional tolerance |
| 100 | Standard_EXPORT Standard_Real FuzzyValue() const; |
| 101 | |
| 102 | //! Sets the flag that defines the mode of treatment. |
| 103 | //! In non-destructive mode the argument shapes are not modified. Instead |
| 104 | //! a copy of a sub-shape is created in the result if it is needed to be updated. |
| 105 | //! This flag is taken into account if internal PaveFiller is used only. |
| 106 | //! In the case of calling PerformWithFiller the corresponding flag of that PaveFiller |
| 107 | //! is in force. |
| 108 | Standard_EXPORT void SetNonDestructive(const Standard_Boolean theFlag); |
| 109 | |
| 110 | //! Returns the flag that defines the mode of treatment. |
| 111 | //! In non-destructive mode the argument shapes are not modified. Instead |
| 112 | //! a copy of a sub-shape is created in the result if it is needed to be updated. |
| 113 | Standard_EXPORT Standard_Boolean NonDestructive() const; |
| 114 | |
| 115 | |
| 116 | protected: |
| 117 | |
| 118 | |
| 119 | //! Prepare information for history support |
| 120 | Standard_EXPORT virtual void PrepareHistory() Standard_OVERRIDE; |
| 121 | |
| 122 | Standard_EXPORT virtual void PerformInternal (const BOPAlgo_PaveFiller& thePF); |
| 123 | |
| 124 | Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF); |
| 125 | |
| 126 | Standard_EXPORT virtual void CheckData() Standard_OVERRIDE; |
| 127 | |
| 128 | Standard_EXPORT virtual void Prepare(); |
| 129 | |
| 130 | Standard_EXPORT void FillImagesVertices(); |
| 131 | |
| 132 | Standard_EXPORT void FillImagesEdges(); |
| 133 | |
| 134 | Standard_EXPORT virtual void BuildResult (const TopAbs_ShapeEnum theType); |
| 135 | |
| 136 | Standard_EXPORT void FillImagesContainers (const TopAbs_ShapeEnum theType); |
| 137 | |
| 138 | Standard_EXPORT void FillImagesCompounds(); |
| 139 | |
| 140 | Standard_EXPORT void FillImagesContainer (const TopoDS_Shape& theS, const TopAbs_ShapeEnum theType); |
| 141 | |
| 142 | Standard_EXPORT void FillImagesCompound (const TopoDS_Shape& theS, BOPCol_MapOfShape& theMF); |
| 143 | |
| 144 | Standard_EXPORT void FillImagesFaces(); |
| 145 | |
| 146 | Standard_EXPORT virtual void BuildSplitFaces(); |
| 147 | |
| 148 | Standard_EXPORT void FillSameDomainFaces(); |
| 149 | |
| 150 | Standard_EXPORT void FillImagesFaces1(); |
| 151 | |
| 152 | Standard_EXPORT void FillImagesSolids(); |
| 153 | |
| 154 | Standard_EXPORT void BuildDraftSolid (const TopoDS_Shape& theSolid, TopoDS_Shape& theDraftSolid, BOPCol_ListOfShape& theLIF); |
| 155 | |
| 156 | Standard_EXPORT virtual void FillIn3DParts (BOPCol_DataMapOfShapeListOfShape& theInParts, BOPCol_DataMapOfShapeShape& theDraftSolids, const BOPCol_BaseAllocator& theAllocator); |
| 157 | |
| 158 | Standard_EXPORT void BuildSplitSolids (BOPCol_DataMapOfShapeListOfShape& theInParts, BOPCol_DataMapOfShapeShape& theDraftSolids, const BOPCol_BaseAllocator& theAllocator); |
| 159 | |
| 160 | Standard_EXPORT void FillInternalShapes(); |
| 161 | |
| 162 | Standard_EXPORT virtual void PostTreat(); |
| 163 | |
| 164 | |
| 165 | BOPCol_ListOfShape myArguments; |
| 166 | BOPCol_MapOfShape myMapFence; |
| 167 | BOPAlgo_PPaveFiller myPaveFiller; |
| 168 | BOPDS_PDS myDS; |
| 169 | Handle(IntTools_Context) myContext; |
| 170 | Standard_Integer myEntryPoint; |
| 171 | BOPCol_DataMapOfShapeListOfShape myImages; |
| 172 | BOPCol_DataMapOfShapeShape myShapesSD; |
| 173 | BOPCol_DataMapOfShapeListOfShape mySplits; |
| 174 | BOPCol_DataMapOfShapeShape myOrigins; |
| 175 | Standard_Real myFuzzyValue; |
| 176 | Standard_Boolean myNonDestructive; |
| 177 | |
| 178 | private: |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | }; |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | #endif // _BOPAlgo_Builder_HeaderFile |