File indexing completed on 2025-01-18 10:03:10
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
0019 #include <NCollection_Sequence.hxx>
0020 #include <NCollection_UBTreeFiller.hxx>
0021 #include <NCollection_UBTree.hxx>
0022 #include <TopTools_IndexedMapOfShape.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 typedef NCollection_UBTree <Standard_Integer, Bnd_Box> BRepClass3d_BndBoxTree;
0032
0033
0034 class BRepClass3d_BndBoxTreeSelectorPoint : public BRepClass3d_BndBoxTree::Selector
0035 {
0036 public:
0037 BRepClass3d_BndBoxTreeSelectorPoint(const TopTools_IndexedMapOfShape& theMapOfShape)
0038 : BRepClass3d_BndBoxTreeSelectorPoint::Selector(), myMapOfShape (theMapOfShape)
0039 {}
0040
0041 Standard_Boolean Reject (const Bnd_Box& theBox) const
0042 {
0043 return (theBox.IsOut (myP));
0044 }
0045
0046 Standard_Boolean Accept (const Standard_Integer& theObj);
0047
0048
0049 void SetCurrentPoint (const gp_Pnt& theP)
0050 {
0051 myP = theP;
0052 }
0053
0054 private:
0055 BRepClass3d_BndBoxTreeSelectorPoint(const BRepClass3d_BndBoxTreeSelectorPoint& );
0056 BRepClass3d_BndBoxTreeSelectorPoint& operator=(const BRepClass3d_BndBoxTreeSelectorPoint& );
0057
0058 private:
0059 const TopTools_IndexedMapOfShape& myMapOfShape;
0060 gp_Pnt myP;
0061 };
0062
0063
0064 class BRepClass3d_BndBoxTreeSelectorLine : public BRepClass3d_BndBoxTree::Selector
0065 {
0066 public:
0067
0068 struct EdgeParam
0069 {
0070 TopoDS_Edge myE;
0071 Standard_Real myParam;
0072 Standard_Real myLParam;
0073 };
0074
0075 struct VertParam
0076 {
0077 TopoDS_Vertex myV;
0078 Standard_Real myLParam;
0079 };
0080
0081
0082 public:
0083 BRepClass3d_BndBoxTreeSelectorLine(const TopTools_IndexedMapOfShape& theMapOfShape)
0084 : BRepClass3d_BndBoxTreeSelectorLine::Selector(),
0085 myMapOfShape(theMapOfShape),
0086 myIsValid(Standard_True)
0087 {}
0088
0089 Standard_Boolean Reject (const Bnd_Box& theBox) const
0090 {
0091 return (theBox.IsOut (myL));
0092 }
0093
0094 Standard_Boolean Accept (const Standard_Integer& theObj);
0095
0096
0097 void SetCurrentLine (const gp_Lin& theL,
0098 const Standard_Real theMaxParam)
0099 {
0100 myL = theL;
0101 myLC.Load(new Geom_Line(theL), -Precision::PConfusion(), theMaxParam);
0102 }
0103
0104 void GetEdgeParam(const Standard_Integer i,
0105 TopoDS_Edge& theOutE,
0106 Standard_Real &theOutParam,
0107 Standard_Real &outLParam ) const
0108 {
0109 const EdgeParam& EP = myEP.Value(i);
0110 theOutE = EP.myE;
0111 theOutParam = EP.myParam;
0112 outLParam = EP.myLParam;
0113 }
0114
0115 void GetVertParam(const Standard_Integer i,
0116 TopoDS_Vertex& theOutV,
0117 Standard_Real &outLParam ) const
0118 {
0119 const VertParam& VP = myVP.Value(i);
0120 theOutV = VP.myV;
0121 outLParam = VP.myLParam;
0122 }
0123
0124 Standard_Integer GetNbEdgeParam() const
0125 {
0126 return myEP.Length();
0127 }
0128
0129 Standard_Integer GetNbVertParam() const
0130 {
0131 return myVP.Length();
0132 }
0133
0134 void ClearResults()
0135 {
0136 myEP.Clear();
0137 myVP.Clear();
0138 myIsValid = Standard_True;
0139 }
0140
0141
0142 Standard_Boolean IsCorrect() const
0143 {
0144 return myIsValid;
0145 }
0146
0147 private:
0148 BRepClass3d_BndBoxTreeSelectorLine(const BRepClass3d_BndBoxTreeSelectorLine& );
0149 BRepClass3d_BndBoxTreeSelectorLine& operator=(const BRepClass3d_BndBoxTreeSelectorLine& );
0150
0151 private:
0152 const TopTools_IndexedMapOfShape& myMapOfShape;
0153 gp_Lin myL;
0154 NCollection_Sequence<EdgeParam> myEP;
0155 NCollection_Sequence<VertParam> myVP;
0156 GeomAdaptor_Curve myLC;
0157 Standard_Boolean myIsValid;
0158 };
0159
0160 #endif