GEOS 3.14.0dev
CoveragePolygon.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2024 Martin Davis <mtnclimb@gmail.com>
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************/
14
15#pragma once
16
17#include <geos/algorithm/locate/IndexedPointInAreaLocator.h>
18
19// Forward declarations
20namespace geos {
21namespace geom {
22class Coordinate;
23class Envelope;
24class Polygon;
25}
26}
27
28namespace geos { // geos
29namespace coverage { // geos::coverage
30
31class GEOS_DLL CoveragePolygon {
32 using CoordinateXY = geos::geom::CoordinateXY;
33 using Envelope = geos::geom::Envelope;
34 using Polygon = geos::geom::Polygon;
35 using IndexedPointInAreaLocator = geos::algorithm::locate::IndexedPointInAreaLocator;
36
37 // Members
38 const Polygon* m_polygon;
39 Envelope polyEnv;
40 mutable std::unique_ptr<IndexedPointInAreaLocator> m_locator;
41
42public:
43 CoveragePolygon(const Polygon* poly);
44
45 bool intersectsEnv(const Envelope& env) const;
46 bool intersectsEnv(const CoordinateXY& p) const;
47 bool contains(const CoordinateXY& p) const;
48
49private:
50 IndexedPointInAreaLocator& getLocator() const;
51
52};
53
54} // namespace geos::coverage
55} // namespace geos
56
Determines the location of Coordinates relative to an areal geometry, using indexing for efficiency.
Definition IndexedPointInAreaLocator.h:54
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition Envelope.h:59
Represents a linear polygon, which may include holes.
Definition Polygon.h:61
Basic namespace for all GEOS functionalities.
Definition geos.h:39