01a6e62b |
1 | // Created on: 2014-06-03 |
2 | // Created by: Oleg AGASHIN |
3 | // Copyright (c) 1997-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _BRepMesh_WireChecker_HeaderFile |
18 | #define _BRepMesh_WireChecker_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <TopoDS_Face.hxx> |
22 | #include <BRepMesh_Status.hxx> |
fc9b36d6 |
23 | #include <BRepMesh_DataStructureOfDelaun.hxx> |
24 | #include <BRepMesh_Collections.hxx> |
01a6e62b |
25 | #include <TopoDS_Edge.hxx> |
26 | #include <Bnd_Box2d.hxx> |
27 | #include <gp_Pnt2d.hxx> |
28 | #include <gp_XY.hxx> |
29 | |
30 | #include <vector> |
31 | |
32 | class BRepMesh_DataMapOfShapePairOfPolygon; |
33 | class TColStd_IndexedMapOfInteger; |
01a6e62b |
34 | |
35 | //! Auxilary class intended to check correctness of discretized face. |
36 | //! In particular, checks boundaries of discretized face for self |
37 | //! intersections and gaps. |
38 | class BRepMesh_WireChecker |
39 | { |
40 | public: |
41 | |
01a6e62b |
42 | //! Selector. |
43 | //! Used to identify segments with overlapped bounding boxes. |
44 | //! Note that instance of selector can be used only once due to |
45 | //! unextentable array of indices. |
fc9b36d6 |
46 | class BndBox2dTreeSelector : public BRepMeshCol::BndBox2dTree::Selector |
01a6e62b |
47 | { |
48 | public: |
49 | Standard_EXPORT BndBox2dTreeSelector(const Standard_Integer theReservedSize); |
50 | Standard_EXPORT virtual Standard_Boolean Reject(const Bnd_Box2d& theBox2D) const; |
51 | Standard_EXPORT virtual Standard_Boolean Accept(const Standard_Integer& theIndex); |
52 | |
53 | Standard_EXPORT void Clear(); |
54 | Standard_EXPORT void SetBox(const Bnd_Box2d& theBox2D); |
55 | Standard_EXPORT void SetSkippedIndex(const Standard_Integer theIndex); |
fc9b36d6 |
56 | Standard_EXPORT const BRepMeshCol::Array1OfInteger& Indices() const; |
01a6e62b |
57 | Standard_EXPORT Standard_Integer IndicesNb() const; |
58 | |
59 | protected: |
fc9b36d6 |
60 | Bnd_Box2d myBox2D; |
61 | Standard_Integer mySkippedIndex; |
62 | BRepMeshCol::Array1OfInteger myIndices; |
63 | Standard_Integer myIndicesNb; |
01a6e62b |
64 | }; |
65 | |
66 | private: |
67 | |
68 | typedef NCollection_List<TopoDS_Edge> ListOfEdges; |
69 | typedef std::vector<ListOfEdges> SeqOfWireEdges; |
70 | typedef NCollection_Sequence<gp_Pnt2d> SeqOfPnt2d; |
71 | typedef std::vector<SeqOfPnt2d> SeqOfDWires; |
72 | typedef NCollection_DataMap<Standard_Integer, Standard_Integer> DataMapIntInt; |
73 | typedef std::pair<Standard_Integer, gp_XY> PairIntPnt; |
74 | |
75 | public: |
76 | |
77 | //! Constructor. |
78 | //! \param theFace Face to be checked. |
79 | //! \param theTolUV Tolerance to be used for calculations in parametric space. |
80 | //! \param theEdges Map of edges with associated polygon on triangulation. |
81 | //! \param theVertexMap Map of face vertices. |
82 | //! \param theStructure Discretized representation of face in parametric space. |
83 | //! \param theUmin Lower U boundary of the face in parametric space. |
84 | //! \param theUmax Upper U boundary of the face in parametric space. |
85 | //! \param theVmin Lower V boundary of the face in parametric space. |
86 | //! \param theVmax Upper V boundary of the face in parametric space. |
87 | Standard_EXPORT BRepMesh_WireChecker( |
88 | const TopoDS_Face& theFace, |
89 | const Standard_Real theTolUV, |
fc9b36d6 |
90 | const BRepMeshCol::DMapOfShapePairOfPolygon& theEdges, |
01a6e62b |
91 | const TColStd_IndexedMapOfInteger& theVertexMap, |
92 | const Handle(BRepMesh_DataStructureOfDelaun)& theStructure, |
93 | const Standard_Real theUmin, |
94 | const Standard_Real theUmax, |
95 | const Standard_Real theVmin, |
96 | const Standard_Real theVmax, |
97 | const Standard_Boolean isInParallel); |
98 | |
99 | //! Recompute data using parameters passed in constructor. |
100 | //! \param[out] theClassifier Classifier to be updated using calculated data. |
fc9b36d6 |
101 | Standard_EXPORT void ReCompute(BRepMeshCol::HClassifier& theClassifier); |
01a6e62b |
102 | |
103 | //! Returns status of the check. |
104 | inline BRepMesh_Status Status() const |
105 | { |
106 | return myStatus; |
107 | } |
108 | |
109 | private: |
110 | |
111 |