forked from libgeos/geos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSnappingPointIndex.cpp
43 lines (34 loc) · 1.18 KB
/
SnappingPointIndex.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2020 Paul Ramsey <[email protected]>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************/
#include <geos/noding/snap/SnappingPointIndex.h>
using namespace geos::geom;
namespace geos {
namespace noding { // geos.noding
namespace snap { // geos.noding.snap
SnappingPointIndex::SnappingPointIndex(double p_snapTolerance) :
// snapTolerance(p_snapTolerance),
snapPointIndex(new index::kdtree::KdTree(p_snapTolerance)) {}
const Coordinate&
SnappingPointIndex::snap(const Coordinate& p)
{
/**
* Inserting the coordinate snaps it to any existing
* one within tolerance, or adds it if not.
*/
index::kdtree::KdNode* node = snapPointIndex->insert(p);
return node->getCoordinate();
}
} // namespace geos.noding.snap
} // namespace geos.noding
} // namespace geos