File indexing completed on 2026-09-26 09:02:29
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef _BOPAlgo_Tools_HeaderFile
0016 #define _BOPAlgo_Tools_HeaderFile
0017
0018 #include <Standard.hxx>
0019 #include <Standard_DefineAlloc.hxx>
0020
0021 #include <NCollection_IndexedDataMap.hxx>
0022 #include <Standard_Integer.hxx>
0023 #include <NCollection_List.hxx>
0024 #include <BOPDS_PaveBlock.hxx>
0025 #include <Standard_Handle.hxx>
0026 #include <BOPDS_PDS.hxx>
0027 #include <NCollection_BaseAllocator.hxx>
0028 #include <Bnd_Box.hxx>
0029 #include <TopoDS_Shape.hxx>
0030 #include <TopTools_ShapeMapHasher.hxx>
0031 #include <NCollection_DataMap.hxx>
0032 #include <NCollection_Map.hxx>
0033 #include <Message_ProgressRange.hxx>
0034
0035 class BOPDS_PaveBlock;
0036 class BOPDS_CommonBlock;
0037 class IntTools_Context;
0038 class TopoDS_Shape;
0039
0040
0041 class BOPAlgo_Tools
0042 {
0043 public:
0044
0045 template <class TheMap, class TheList>
0046 static void MakeBlocks(const TheMap& theMILI,
0047 TheList& theMBlocks,
0048 const occ::handle<NCollection_BaseAllocator>& theAllocator)
0049 {
0050 NCollection_Map<typename TheMap::key_type, typename TheMap::hasher> aMFence;
0051 int i, aNb = theMILI.Extent();
0052 for (i = 1; i <= aNb; ++i)
0053 {
0054 const typename TheMap::key_type& n = theMILI.FindKey(i);
0055 if (!aMFence.Add(n))
0056 continue;
0057
0058
0059 typename TheList::value_type& aChain =
0060 theMBlocks.Append(typename TheList::value_type(theAllocator));
0061 aChain.Append(n);
0062
0063 typename TheList::value_type::Iterator aItLChain(aChain);
0064 for (; aItLChain.More(); aItLChain.Next())
0065 {
0066 const typename TheMap::key_type& n1 = aItLChain.Value();
0067 const typename TheList::value_type& aLI = theMILI.FindFromKey(n1);
0068
0069 typename TheList::value_type::Iterator aItLI(aLI);
0070 for (; aItLI.More(); aItLI.Next())
0071 {
0072 const typename TheMap::key_type& n2 = aItLI.Value();
0073 if (aMFence.Add(n2))
0074 {
0075 aChain.Append(n2);
0076 }
0077 }
0078 }
0079 }
0080 }
0081
0082
0083 template <class TheType, class TheMap>
0084 static void FillMap(const TheType& n1,
0085 const TheType& n2,
0086 TheMap& theMILI,
0087 const occ::handle<NCollection_BaseAllocator>& theAllocator)
0088 {
0089 typename TheMap::value_type* pList1 = theMILI.ChangeSeek(n1);
0090 if (!pList1)
0091 {
0092 pList1 = &theMILI(theMILI.Add(n1, NCollection_List<TheType>(theAllocator)));
0093 }
0094 pList1->Append(n2);
0095
0096 typename TheMap::value_type* pList2 = theMILI.ChangeSeek(n2);
0097 if (!pList2)
0098 {
0099 pList2 = &theMILI(theMILI.Add(n2, typename TheMap::value_type(theAllocator)));
0100 }
0101 pList2->Append(n1);
0102 }
0103
0104 Standard_EXPORT static void FillMap(
0105 const occ::handle<BOPDS_PaveBlock>& thePB1,
0106 const int theF,
0107 NCollection_IndexedDataMap<occ::handle<BOPDS_PaveBlock>, NCollection_List<int>>& theMILI,
0108 const occ::handle<NCollection_BaseAllocator>& theAllocator);
0109
0110
0111
0112 Standard_EXPORT static void PerformCommonBlocks(
0113 NCollection_IndexedDataMap<occ::handle<BOPDS_PaveBlock>,
0114 NCollection_List<occ::handle<BOPDS_PaveBlock>>>& theMBlocks,
0115 const occ::handle<NCollection_BaseAllocator>& theAllocator,
0116 BOPDS_PDS& theDS,
0117 const occ::handle<IntTools_Context>& theContext = occ::handle<IntTools_Context>());
0118
0119
0120 Standard_EXPORT static void PerformCommonBlocks(
0121 const NCollection_IndexedDataMap<occ::handle<BOPDS_PaveBlock>, NCollection_List<int>>&
0122 theMBlocks,
0123 const occ::handle<NCollection_BaseAllocator>& theAllocator,
0124 BOPDS_PDS& pDS,
0125 const occ::handle<IntTools_Context>& theContext = occ::handle<IntTools_Context>());
0126
0127 Standard_EXPORT static double ComputeToleranceOfCB(
0128 const occ::handle<BOPDS_CommonBlock>& theCB,
0129 const BOPDS_PDS theDS,
0130 const occ::handle<IntTools_Context>& theContext);
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151 Standard_EXPORT static int EdgesToWires(const TopoDS_Shape& theEdges,
0152 TopoDS_Shape& theWires,
0153 const bool theShared = false,
0154 const double theAngTol = 1.e-8);
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170 Standard_EXPORT static bool WiresToFaces(const TopoDS_Shape& theWires,
0171 TopoDS_Shape& theFaces,
0172 const double theAngTol = 1.e-8);
0173
0174
0175 Standard_EXPORT static void IntersectVertices(
0176 const NCollection_IndexedDataMap<TopoDS_Shape, double, TopTools_ShapeMapHasher>& theVertices,
0177 const double theFuzzyValue,
0178 NCollection_List<NCollection_List<TopoDS_Shape>>& theChains);
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193 Standard_EXPORT static void ClassifyFaces(
0194 const NCollection_List<TopoDS_Shape>& theFaces,
0195 const NCollection_List<TopoDS_Shape>& theSolids,
0196 const bool theRunParallel,
0197 occ::handle<IntTools_Context>& theContext,
0198 NCollection_IndexedDataMap<TopoDS_Shape,
0199 NCollection_List<TopoDS_Shape>,
0200 TopTools_ShapeMapHasher>& theInParts,
0201 const NCollection_DataMap<TopoDS_Shape, Bnd_Box, TopTools_ShapeMapHasher>& theShapeBoxMap =
0202 NCollection_DataMap<TopoDS_Shape, Bnd_Box, TopTools_ShapeMapHasher>(),
0203 const NCollection_DataMap<TopoDS_Shape,
0204 NCollection_List<TopoDS_Shape>,
0205 TopTools_ShapeMapHasher>& theSolidsIF =
0206 NCollection_DataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher>(),
0207 const Message_ProgressRange& theRange = Message_ProgressRange());
0208
0209
0210
0211
0212
0213
0214
0215
0216 Standard_EXPORT static void FillInternals(
0217 const NCollection_List<TopoDS_Shape>& theSolids,
0218 const NCollection_List<TopoDS_Shape>& theParts,
0219 const NCollection_DataMap<TopoDS_Shape,
0220 NCollection_List<TopoDS_Shape>,
0221 TopTools_ShapeMapHasher>& theImages,
0222 const occ::handle<IntTools_Context>& theContext);
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233 Standard_EXPORT static bool TrsfToPoint(const Bnd_Box& theBox1,
0234 const Bnd_Box& theBox2,
0235 gp_Trsf& theTrsf,
0236 const gp_Pnt& thePoint = gp_Pnt(0.0, 0.0, 0.0),
0237 const double theCriteria = 1.e+5);
0238 };
0239
0240 #endif