0024624: Lost word in license statement in source files
[occt.git] / src / BRepMesh / BRepMesh_VertexInspector.hxx
CommitLineData
b311480e 1// Created on: 2011-06-01
2// Created by: Oleg AGASHIN
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.
51c3cc5f
O
15
16#ifndef _BRepMesh_VertexInspector_HeaderFile
17#define _BRepMesh_VertexInspector_HeaderFile
18
19#include <BRepMesh_ListOfInteger.hxx>
20#ifndef _Precision_HeaderFile
21#include <Precision.hxx>
22#endif
23#ifndef _gp_XY_HeaderFile
24#include <gp_XY.hxx>
25#endif
26#ifndef _gp_XYZ_HeaderFile
27#include <gp_XYZ.hxx>
28#endif
29
30#ifndef NCollection_CellFilter_HeaderFile
31#include <NCollection_CellFilter.hxx>
32#endif
33#ifndef _BRepMesh_Vertex_HeaderFile
34#include <BRepMesh_Vertex.hxx>
35#endif
36#ifndef _BRepMesh_VectorOfVertex_HeaderFile
37#include <BRepMesh_VectorOfVertex.hxx>
38#endif
39#ifndef _TColStd_Array1OfReal_HeaderFile
40#include <TColStd_Array1OfReal.hxx>
41#endif
42#include <BRepMesh_BaseAllocator.hxx>
43
44//=======================================================================
45//! The class to find in the coincidence points
46//=======================================================================
47
48class BRepMesh_VertexInspector : public NCollection_CellFilter_InspectorXY
49{
50public:
51 typedef Standard_Integer Target;
52 //! Constructor; remembers tolerance and collector data structure.
53 //! theTol can be Real or Array1OfReal with two elements which describe
54 //! tolerance for each dimension.
55 BRepMesh_VertexInspector (const Standard_Integer nbComp,
56 const BRepMesh_BaseAllocator& theAlloc);
57
58 BRepMesh_VertexInspector (const Standard_Integer nbComp,
59 const Standard_Real theTol,
60 const BRepMesh_BaseAllocator& theAlloc);
61
62 BRepMesh_VertexInspector (const Standard_Integer nbComp,
63 const Standard_Real aTolX,
64 const Standard_Real aTolY,
65 const BRepMesh_BaseAllocator& theAlloc);
66
67 Standard_Integer Add(const BRepMesh_Vertex& theVertex);
68
69 void SetTolerance(const Standard_Real theTol)
70 {
71 myTol(0) = theTol*theTol;
72 myTol(1) = 0.;
73 }
74
75 void SetTolerance(const Standard_Real theTolX, const Standard_Real theTolY)
76 {
77 myTol(0) = theTolX*theTolX;
78 myTol(1) = theTolY*theTolY;
79 }
80
81 void Clear()
82 {
83 myVertices.Clear();
84 myDelNodes.Clear();
85 }
86
87 void Delete(const Standard_Integer theIndex)
88 {
89 myVertices(theIndex-1).SetMovability(BRepMesh_Deleted);
90 myDelNodes.Append(theIndex);
91 }
92
93 Standard_Integer GetNbVertices() const
94 {
95 return myVertices.Length();
96 }
97
98 BRepMesh_Vertex& GetVertex(Standard_Integer theInd)
99 {
100 return myVertices(theInd-1);
101 }
102
103 //! Set current node to be checked
35e08fe8 104 void SetCurrent (const gp_XY& theCurVertex, const Standard_Boolean)
51c3cc5f
O
105 {
106 myResInd.Clear();
107 myCurrent = theCurVertex;
108 }
109
110 //!Get result index of node
111 const Standard_Integer GetCoincidentInd() const
112 {
113 if ( myResInd.Size() > 0 )
114 {
115 return myResInd.First();
116 }
117 return 0;
118 }
119
120 const BRepMesh_ListOfInteger& GetListOfDelNodes() const
121 {
122 return myDelNodes;
123 }
124
125 //! Implementation of inspection method
126 NCollection_CellFilter_Action Inspect (const Standard_Integer theTarget);
127
128 static Standard_Boolean IsEqual (Standard_Integer theIdx, const Standard_Integer theTarget)
129 {
130 return (theIdx == theTarget);
131 }
132
133private:
134 TColStd_Array1OfReal myTol;
135 BRepMesh_ListOfInteger myResInd;
136 BRepMesh_VectorOfVertex myVertices;
137 BRepMesh_ListOfInteger myDelNodes;
138 gp_XY myCurrent;
139};
140
141#endif