/src/geos/include/geos/algorithm/InteriorPointPoint.h
Line | Count | Source |
1 | | /********************************************************************** |
2 | | * |
3 | | * GEOS - Geometry Engine Open Source |
4 | | * http://geos.osgeo.org |
5 | | * |
6 | | * Copyright (C) 2005-2006 Refractions Research Inc. |
7 | | * Copyright (C) 2001-2002 Vivid Solutions Inc. |
8 | | * |
9 | | * This is free software; you can redistribute and/or modify it under |
10 | | * the terms of the GNU Lesser General Public Licence as published |
11 | | * by the Free Software Foundation. |
12 | | * See the COPYING file for more information. |
13 | | * |
14 | | **********************************************************************/ |
15 | | |
16 | | #pragma once |
17 | | |
18 | | #include <geos/export.h> |
19 | | #include <geos/geom/Coordinate.h> |
20 | | |
21 | | // Forward declarations |
22 | | namespace geos { |
23 | | namespace geom { |
24 | | class Geometry; |
25 | | } |
26 | | } |
27 | | |
28 | | namespace geos { |
29 | | namespace algorithm { // geos::algorithm |
30 | | |
31 | | /** |
32 | | * \class InteriorPointPoint |
33 | | * \brief |
34 | | * Computes a point in the interior of an point geometry. |
35 | | * |
36 | | * Algorithm: |
37 | | * |
38 | | * Find a point which is closest to the centroid of the geometry. |
39 | | */ |
40 | | class GEOS_DLL InteriorPointPoint { |
41 | | private: |
42 | | |
43 | | bool hasInterior; |
44 | | |
45 | | geom::CoordinateXY centroid; |
46 | | |
47 | | double minDistance; |
48 | | |
49 | | geom::Coordinate interiorPoint; |
50 | | |
51 | | /** |
52 | | * Tests the point(s) defined by a Geometry for the best inside point. |
53 | | * If a Geometry is not of dimension 0 it is not tested. |
54 | | * @param geom the geometry to add |
55 | | */ |
56 | | void add(const geom::Geometry* geom); |
57 | | |
58 | | void add(const geom::CoordinateXY* point); |
59 | | |
60 | | public: |
61 | | |
62 | | InteriorPointPoint(const geom::Geometry* g); |
63 | | |
64 | 0 | ~InteriorPointPoint() {} |
65 | | |
66 | | bool getInteriorPoint(geom::CoordinateXY& ret) const; |
67 | | |
68 | | }; |
69 | | |
70 | | } // namespace geos::algorithm |
71 | | } // namespace geos |
72 | | |
73 | | |