Commit | Line | Data |
---|---|---|
b311480e | 1 | // Created on: 2005-02-14 |
2 | // Created by: Alexey MORENOV | |
973c2be1 | 3 | // Copyright (c) 2005-2014 OPEN CASCADE SAS |
b311480e | 4 | // |
973c2be1 | 5 | // This file is part of Open CASCADE Technology software library. |
b311480e | 6 | // |
d5f74e42 | 7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published | |
973c2be1 | 9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT | |
11 | // distribution for complete text of the license and disclaimer of any warranty. | |
b311480e | 12 | // |
973c2be1 | 13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. | |
7fd59977 | 15 | |
16 | #ifndef ShapeAnalysis_BoxBndTree_HeaderFile | |
17 | #define ShapeAnalysis_BoxBndTree_HeaderFile | |
18 | ||
19 | #include <NCollection_UBTree.hxx> | |
20 | #include <Bnd_Box.hxx> | |
21 | #include <gp_Pnt.hxx> | |
22 | #include <MMgt_TShared.hxx> | |
23 | #include <TopTools_HArray1OfShape.hxx> | |
24 | ||
25 | #include <ShapeExtend.hxx> | |
26 | #include <ShapeExtend_Status.hxx> | |
27 | #include <TopoDS_Vertex.hxx> | |
28 | #include <TColStd_MapOfInteger.hxx> | |
974c25ed | 29 | #include <TColStd_Array1OfInteger.hxx> |
7fd59977 | 30 | |
31 | typedef NCollection_UBTree <Standard_Integer , Bnd_Box> ShapeAnalysis_BoxBndTree; | |
32 | ||
33 | class ShapeAnalysis_BoxBndTreeSelector | |
34 | : public ShapeAnalysis_BoxBndTree::Selector | |
35 | { | |
36 | public: | |
37 | ShapeAnalysis_BoxBndTreeSelector | |
38 | (Handle (TopTools_HArray1OfShape) theSeq, | |
39 | Standard_Boolean theShared) | |
974c25ed G |
40 | : mySeq(theSeq), myShared(theShared), myNb(0), myTol(1e-7), myMin3d(1e-7),myArrIndices(1,2), |
41 | myStatus(ShapeExtend::EncodeStatus (ShapeExtend_OK)) | |
42 | { | |
43 | myArrIndices.Init(0); | |
44 | } | |
7fd59977 | 45 | |
46 | void DefineBoxes (const Bnd_Box& theFBox, const Bnd_Box& theLBox) | |
47 | { myFBox = theFBox; | |
974c25ed G |
48 | myLBox = theLBox; |
49 | myArrIndices.Init(0); | |
50 | ||
51 | } | |
7fd59977 | 52 | |
53 | void DefineVertexes (TopoDS_Vertex theVf, TopoDS_Vertex theVl) | |
54 | { myFVertex = theVf; | |
55 | myLVertex = theVl; | |
56 | myStatus=ShapeExtend::EncodeStatus (ShapeExtend_OK); | |
57 | } | |
58 | ||
59 | void DefinePnt (gp_Pnt theFPnt, gp_Pnt theLPnt) | |
60 | { myFPnt = theFPnt; | |
61 | myLPnt = theLPnt; | |
62 | myStatus =ShapeExtend::EncodeStatus (ShapeExtend_OK); | |
63 | } | |
64 | ||
65 | Standard_Integer GetNb () | |
66 | { return myNb; } | |
67 | ||
68 | void SetNb (Standard_Integer theNb) | |
69 | { myNb = theNb; } | |
70 | ||
71 | void LoadList(Standard_Integer elem) | |
72 | { myList.Add(elem); } | |
73 | ||
74 | void SetStop () | |
75 | { myStop = Standard_False; } | |
76 | ||
77 | void SetTolerance (Standard_Real theTol) | |
78 | { | |
79 | myTol = theTol; | |
80 | myMin3d = theTol; | |
81 | myStatus=ShapeExtend::EncodeStatus (ShapeExtend_OK); | |
82 | } | |
83 | ||
84 | Standard_Boolean ContWire(Standard_Integer nbWire) | |
85 | { return myList.Contains(nbWire); } | |
86 | ||
9fd2d2c3 | 87 | inline Standard_Boolean LastCheckStatus (const ShapeExtend_Status theStatus) const |
88 | { return ShapeExtend::DecodeStatus ( myStatus, theStatus ); } | |
7fd59977 | 89 | |
90 | Standard_Boolean Reject (const Bnd_Box& theBnd) const; | |
91 | Standard_Boolean Accept (const Standard_Integer &); | |
92 | ||
93 | private: | |
94 | Bnd_Box myFBox; | |
95 | Bnd_Box myLBox; | |
96 | Handle (TopTools_HArray1OfShape) mySeq; | |
97 | Standard_Boolean myShared; | |
7fd59977 | 98 | Standard_Integer myNb; |
99 | TopoDS_Vertex myFVertex; | |
100 | TopoDS_Vertex myLVertex; | |
101 | gp_Pnt myFPnt; | |
102 | gp_Pnt myLPnt; | |
103 | TColStd_MapOfInteger myList; | |
104 | Standard_Real myTol; | |
105 | Standard_Real myMin3d; | |
974c25ed | 106 | TColStd_Array1OfInteger myArrIndices; |
eafb234b | 107 | Standard_Integer myStatus; |
108 | ||
7fd59977 | 109 | }; |
110 | ||
111 | #endif |