1 // Created on: 2011-06-01
2 // Created by: Oleg AGASHIN
3 // Copyright (c) 2011-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and / or modify it
8 // under the terms of the GNU Lesser General Public version 2.1 as published
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _BRepMesh_VertexInspector_HeaderFile
17 #define _BRepMesh_VertexInspector_HeaderFile
19 #include <BRepMesh_ListOfInteger.hxx>
20 #ifndef _Precision_HeaderFile
21 #include <Precision.hxx>
23 #ifndef _gp_XY_HeaderFile
26 #ifndef _gp_XYZ_HeaderFile
30 #ifndef NCollection_CellFilter_HeaderFile
31 #include <NCollection_CellFilter.hxx>
33 #ifndef _BRepMesh_Vertex_HeaderFile
34 #include <BRepMesh_Vertex.hxx>
36 #ifndef _BRepMesh_VectorOfVertex_HeaderFile
37 #include <BRepMesh_VectorOfVertex.hxx>
39 #ifndef _TColStd_Array1OfReal_HeaderFile
40 #include <TColStd_Array1OfReal.hxx>
42 #include <BRepMesh_BaseAllocator.hxx>
44 //=======================================================================
45 //! The class to find in the coincidence points
46 //=======================================================================
48 class BRepMesh_VertexInspector : public NCollection_CellFilter_InspectorXY
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);
58 BRepMesh_VertexInspector (const Standard_Integer nbComp,
59 const Standard_Real theTol,
60 const BRepMesh_BaseAllocator& theAlloc);
62 BRepMesh_VertexInspector (const Standard_Integer nbComp,
63 const Standard_Real aTolX,
64 const Standard_Real aTolY,
65 const BRepMesh_BaseAllocator& theAlloc);
67 Standard_Integer Add(const BRepMesh_Vertex& theVertex);
69 void SetTolerance(const Standard_Real theTol)
71 myTol(0) = theTol*theTol;
75 void SetTolerance(const Standard_Real theTolX, const Standard_Real theTolY)
77 myTol(0) = theTolX*theTolX;
78 myTol(1) = theTolY*theTolY;
87 void Delete(const Standard_Integer theIndex)
89 myVertices(theIndex-1).SetMovability(BRepMesh_Deleted);
90 myDelNodes.Append(theIndex);
93 Standard_Integer GetNbVertices() const
95 return myVertices.Length();
98 BRepMesh_Vertex& GetVertex(Standard_Integer theInd)
100 return myVertices(theInd-1);
103 //! Set current node to be checked
104 void SetCurrent (const gp_XY& theCurVertex, const Standard_Boolean)
107 myCurrent = theCurVertex;
110 //!Get result index of node
111 const Standard_Integer GetCoincidentInd() const
113 if ( myResInd.Size() > 0 )
115 return myResInd.First();
120 const BRepMesh_ListOfInteger& GetListOfDelNodes() const
125 //! Implementation of inspection method
126 NCollection_CellFilter_Action Inspect (const Standard_Integer theTarget);
128 static Standard_Boolean IsEqual (Standard_Integer theIdx, const Standard_Integer theTarget)
130 return (theIdx == theTarget);
134 TColStd_Array1OfReal myTol;
135 BRepMesh_ListOfInteger myResInd;
136 BRepMesh_VectorOfVertex myVertices;
137 BRepMesh_ListOfInteger myDelNodes;