File indexing completed on 2026-09-18 09:19:44
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef _BRepClass3d_BndBoxTree_HeaderFile
0016 #define _BRepClass3d_BndBoxTree_HeaderFile
0017
0018 #include <NCollection_Sequence.hxx>
0019 #include <NCollection_UBTreeFiller.hxx>
0020 #include <NCollection_UBTree.hxx>
0021 #include <TopTools_ShapeMapHasher.hxx>
0022 #include <NCollection_IndexedMap.hxx>
0023 #include <TopoDS_Edge.hxx>
0024 #include <TopoDS_Vertex.hxx>
0025 #include <Geom_Line.hxx>
0026 #include <Bnd_Box.hxx>
0027 #include <GeomAdaptor_Curve.hxx>
0028 #include <Precision.hxx>
0029
0030
0031
0032
0033 class BRepClass3d_BndBoxTreeSelectorPoint : public NCollection_UBTree<int, Bnd_Box>::Selector
0034 {
0035 public:
0036 BRepClass3d_BndBoxTreeSelectorPoint(
0037 const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& theMapOfShape)
0038 : myMapOfShape(theMapOfShape)
0039 {
0040 }
0041
0042 bool Reject(const Bnd_Box& theBox) const override { return (theBox.IsOut(myP)); }
0043
0044 bool Accept(const int& theObj) override;
0045
0046
0047 void SetCurrentPoint(const gp_Pnt& theP) { myP = theP; }
0048
0049 private:
0050 BRepClass3d_BndBoxTreeSelectorPoint(const BRepClass3d_BndBoxTreeSelectorPoint&) = delete;
0051 BRepClass3d_BndBoxTreeSelectorPoint& operator=(const BRepClass3d_BndBoxTreeSelectorPoint&) =
0052 delete;
0053
0054 private:
0055 const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>&
0056 myMapOfShape;
0057 gp_Pnt myP;
0058 };
0059
0060
0061 class BRepClass3d_BndBoxTreeSelectorLine : public NCollection_UBTree<int, Bnd_Box>::Selector
0062 {
0063 public:
0064 struct EdgeParam
0065 {
0066 TopoDS_Edge myE;
0067 double myParam;
0068 double myLParam;
0069 };
0070
0071 struct VertParam
0072 {
0073 TopoDS_Vertex myV;
0074 double myLParam;
0075 };
0076
0077 public:
0078 BRepClass3d_BndBoxTreeSelectorLine(
0079 const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& theMapOfShape)
0080 : myMapOfShape(theMapOfShape),
0081 myIsValid(true)
0082 {
0083 }
0084
0085 bool Reject(const Bnd_Box& theBox) const override { return (theBox.IsOut(myL)); }
0086
0087 bool Accept(const int& theObj) override;
0088
0089
0090 void SetCurrentLine(const gp_Lin& theL, const double theMaxParam)
0091 {
0092 myL = theL;
0093 myLC.Load(new Geom_Line(theL), -Precision::PConfusion(), theMaxParam);
0094 }
0095
0096 void GetEdgeParam(const int i, TopoDS_Edge& theOutE, double& theOutParam, double& outLParam) const
0097 {
0098 const EdgeParam& EP = myEP.Value(i);
0099 theOutE = EP.myE;
0100 theOutParam = EP.myParam;
0101 outLParam = EP.myLParam;
0102 }
0103
0104 void GetVertParam(const int i, TopoDS_Vertex& theOutV, double& outLParam) const
0105 {
0106 const VertParam& VP = myVP.Value(i);
0107 theOutV = VP.myV;
0108 outLParam = VP.myLParam;
0109 }
0110
0111 int GetNbEdgeParam() const { return myEP.Length(); }
0112
0113 int GetNbVertParam() const { return myVP.Length(); }
0114
0115 void ClearResults()
0116 {
0117 myEP.Clear();
0118 myVP.Clear();
0119 myIsValid = true;
0120 }
0121
0122
0123 bool IsCorrect() const { return myIsValid; }
0124
0125 private:
0126 BRepClass3d_BndBoxTreeSelectorLine(const BRepClass3d_BndBoxTreeSelectorLine&) = delete;
0127 BRepClass3d_BndBoxTreeSelectorLine& operator=(const BRepClass3d_BndBoxTreeSelectorLine&) = delete;
0128
0129 private:
0130 const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>&
0131 myMapOfShape;
0132 gp_Lin myL;
0133 NCollection_Sequence<EdgeParam> myEP;
0134 NCollection_Sequence<VertParam> myVP;
0135 GeomAdaptor_Curve myLC;
0136 bool myIsValid;
0137 };
0138
0139 #endif