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 under
8 // the terms of the GNU Lesser General Public License 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 #include <Precision.hxx>
23 #include <NCollection_CellFilter.hxx>
24 #include <BRepMesh_Vertex.hxx>
25 #include <BRepMesh_VectorOfVertex.hxx>
26 #include <TColStd_Array1OfReal.hxx>
27 #include <BRepMesh_BaseAllocator.hxx>
29 //=======================================================================
30 //! The class to find in the coincidence points
31 //=======================================================================
33 class BRepMesh_VertexInspector : public NCollection_CellFilter_InspectorXY
36 typedef Standard_Integer Target;
37 //! Constructor; remembers tolerance and collector data structure.
38 //! theTol can be Real or Array1OfReal with two elements which describe
39 //! tolerance for each dimension.
40 BRepMesh_VertexInspector (const Standard_Integer nbComp,
41 const BRepMesh_BaseAllocator& theAlloc);
43 BRepMesh_VertexInspector (const Standard_Integer nbComp,
44 const Standard_Real theTol,
45 const BRepMesh_BaseAllocator& theAlloc);
47 BRepMesh_VertexInspector (const Standard_Integer nbComp,
48 const Standard_Real aTolX,
49 const Standard_Real aTolY,
50 const BRepMesh_BaseAllocator& theAlloc);
52 Standard_Integer Add(const BRepMesh_Vertex& theVertex);
54 void SetTolerance(const Standard_Real theTol)
56 myTol(0) = theTol*theTol;
60 void SetTolerance(const Standard_Real theTolX, const Standard_Real theTolY)
62 myTol(0) = theTolX*theTolX;
63 myTol(1) = theTolY*theTolY;
72 void Delete(const Standard_Integer theIndex)
74 myVertices(theIndex-1).SetMovability(BRepMesh_Deleted);
75 myDelNodes.Append(theIndex);
78 Standard_Integer GetNbVertices() const
80 return myVertices.Length();
83 BRepMesh_Vertex& GetVertex(Standard_Integer theInd)
85 return myVertices(theInd-1);
88 //! Set current node to be checked
89 void SetCurrent (const gp_XY& theCurVertex, const Standard_Boolean)
92 myCurrent = theCurVertex;
95 //!Get result index of node
96 const Standard_Integer GetCoincidentInd() const
98 if ( myResInd.Size() > 0 )
100 return myResInd.First();
105 const BRepMesh_ListOfInteger& GetListOfDelNodes() const
110 //! Implementation of inspection method
111 NCollection_CellFilter_Action Inspect (const Standard_Integer theTarget);
113 static Standard_Boolean IsEqual (Standard_Integer theIdx, const Standard_Integer theTarget)
115 return (theIdx == theTarget);
119 TColStd_Array1OfReal myTol;
120 BRepMesh_ListOfInteger myResInd;
121 BRepMesh_VectorOfVertex myVertices;
122 BRepMesh_ListOfInteger myDelNodes;