File Coverage

/usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/XS/libgeos.x/i/geos/algorithm/locate/SimplePointInAreaLocator.h
Criterion Covered Total %
statement 4 6 66.6
branch 1 2 50.0
condition n/a
subroutine n/a
pod n/a
total 5 8 62.5


line stmt bran cond sub pod time code
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             #ifndef GEOS_ALGORITHM_LOCATE_SIMPLEPOINTINAREALOCATOR_H
17             #define GEOS_ALGORITHM_LOCATE_SIMPLEPOINTINAREALOCATOR_H
18              
19             #include // inherited
20              
21             // Forward declarations
22             namespace geos {
23             namespace geom {
24             class Geometry;
25             class Coordinate;
26             class Polygon;
27             }
28             }
29              
30             namespace geos {
31             namespace algorithm { // geos::algorithm
32             namespace locate { // geos::algorithm::locate
33              
34             /** \brief
35             * Computes the location of points
36             * relative to an areal {@link Geometry},
37             * using a simple O(n) algorithm.
38             *
39             * This algorithm is suitable for use in cases where
40             * only one or a few points will be tested against a given area.
41             *
42             * The algorithm used is only guaranteed to return correct results
43             * for points which are not on the boundary of the Geometry.
44             *
45             * @version 1.7
46             */
47 2 50         class SimplePointInAreaLocator : public PointOnGeometryLocator
48             {
49              
50             public:
51              
52             static int locate(const geom::Coordinate& p,
53             const geom::Geometry *geom);
54              
55             static bool containsPointInPolygon(const geom::Coordinate& p,
56             const geom::Polygon *poly);
57              
58 1           SimplePointInAreaLocator( const geom::Geometry * g)
59 1           : g( g)
60 1           { }
61              
62 0           int locate( const geom::Coordinate * p) override
63             {
64 0           return locate( *p, g);
65             }
66              
67             private:
68              
69             static bool containsPoint(const geom::Coordinate& p,
70             const geom::Geometry *geom);
71              
72             const geom::Geometry * g;
73              
74             };
75              
76             } // geos::algorithm::locate
77             } // geos::algorithm
78             } // geos
79              
80              
81             #endif // GEOS_ALGORITHM_LOCATE_SIMPLEPOINTINAREALOCATOR_H