GEOS  3.13.1
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
20 namespace geos {
21 namespace geom {
22 class Coordinate;
23 class Envelope;
24 class Polygon;
25 }
26 }
27 
28 using geos::geom::CoordinateXY;
32 
33 namespace geos { // geos
34 namespace coverage { // geos::coverage
35 
36 class GEOS_DLL CoveragePolygon {
37 
38  // Members
39  const Polygon* m_polygon;
40  Envelope polyEnv;
41  mutable std::unique_ptr<IndexedPointInAreaLocator> m_locator;
42 
43 public:
44  CoveragePolygon(const Polygon* poly);
45 
46  bool intersectsEnv(const Envelope& env) const;
47  bool intersectsEnv(const CoordinateXY& p) const;
48  bool contains(const CoordinateXY& p) const;
49 
50 private:
51  IndexedPointInAreaLocator& getLocator() const;
52 
53 };
54 
55 } // namespace geos::coverage
56 } // namespace geos
57 
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: Angle.h:25