b311480e |
1 | // Created on: 2011-11-24 |
2 | // Created by: ANNA MASALSKAYA |
973c2be1 |
3 | // Copyright (c) 2011-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. |
82192477 |
15 | |
16 | #ifndef _BRepBuilderAPI_VertexInspector_Header |
17 | #define _BRepBuilderAPI_VertexInspector_Header |
18 | |
19 | #ifndef _TColStd_ListOfInteger_HeaderFile |
20 | #include <TColStd_ListOfInteger.hxx> |
21 | #endif |
22 | #ifndef NCollection_Vector_HeaderFile |
23 | #include <NCollection_Vector.hxx> |
24 | #endif |
25 | #ifndef _gp_XY_HeaderFile |
26 | #include <gp_XY.hxx> |
27 | #endif |
28 | #ifndef _gp_XYZ_HeaderFile |
29 | #include <gp_XYZ.hxx> |
30 | #endif |
31 | |
32 | #ifndef NCollection_CellFilter_HeaderFile |
33 | #include <NCollection_CellFilter.hxx> |
34 | #endif |
35 | |
36 | typedef NCollection_Vector<gp_XYZ> VectorOfPoint; |
37 | |
38 | //======================================================================= |
39 | //! Class BRepBuilderAPI_VertexInspector |
40 | //! derived from NCollection_CellFilter_InspectorXYZ |
41 | //! This class define the Inspector interface for CellFilter algorithm, |
42 | //! working with gp_XYZ points in 3d space. |
43 | //! Used in search of coincidence points with a certain tolerance. |
44 | //======================================================================= |
45 | |
46 | class BRepBuilderAPI_VertexInspector : public NCollection_CellFilter_InspectorXYZ |
47 | { |
48 | public: |
49 | typedef Standard_Integer Target; |
50 | //! Constructor; remembers the tolerance |
51 | BRepBuilderAPI_VertexInspector (const Standard_Real theTol) |
52 | : myTol(theTol*theTol) |
53 | {} |
54 | |
55 | //! Keep the points used for comparison |
56 | void Add (const gp_XYZ& thePnt) |
57 | { |
58 | myPoints.Append (thePnt); |
59 | } |
60 | |
61 | //! Clear the list of adjacent points |
62 | void ClearResList() |
63 | { |
64 | myResInd.Clear(); |
65 | } |
66 | |
67 | //! Set current point to search for coincidence |
68 | void SetCurrent (const gp_XYZ& theCurPnt) |
69 | { |
70 | myCurrent = theCurPnt; |
71 | } |
72 | |
73 | //! Get list of indexes of points adjacent with the current |
74 | const TColStd_ListOfInteger& ResInd() |
75 | { |
76 | return myResInd; |
77 | } |
78 | |
79 | //! Implementation of inspection method |
80 | NCollection_CellFilter_Action Inspect (const Standard_Integer theTarget); |
81 | |
82 | private: |
83 | Standard_Real myTol; |
84 | TColStd_ListOfInteger myResInd; |
85 | VectorOfPoint myPoints; |
86 | gp_XYZ myCurrent; |
87 | }; |
88 | |
89 | #endif |