GEOS  3.13.0dev
GeometryLocation.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2006 Refractions Research Inc.
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  * Last port: operation/distance/GeometryLocation.java rev. 1.7 (JTS-1.10)
16  *
17  **********************************************************************/
18 
19 #pragma once
20 
21 #include <geos/export.h>
22 
23 #include <geos/geom/Coordinate.h> // for composition
24 
25 // Forward declarations
26 namespace geos {
27 namespace geom {
28 class Geometry;
29 }
30 }
31 
32 
33 namespace geos {
34 namespace operation { // geos::operation
35 namespace distance { // geos::operation::distance
36 
37 
49 class GEOS_DLL GeometryLocation {
50 private:
51  const geom::Geometry* component;
52  std::size_t segIndex;
53  bool inside_area;
54  geom::CoordinateXY pt;
55 public:
63  static const int INSIDE_AREA = -1;
64 
66  component(nullptr),
67  segIndex(0),
68  inside_area(false),
69  pt()
70  {}
71 
81  GeometryLocation(const geom::Geometry* component,
82  std::size_t segIndex, const geom::CoordinateXY& pt);
83 
91  GeometryLocation(const geom::Geometry* component,
92  const geom::CoordinateXY& pt);
93 
98 
107  std::size_t getSegmentIndex();
108 
112  geom::CoordinateXY& getCoordinate();
113 
118  bool isInsideArea();
119 
120  std::string toString();
121 };
122 
123 } // namespace geos::operation::distance
124 } // namespace geos::operation
125 } // namespace geos
126 
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:186
Represents the location of a point on a Geometry.
Definition: GeometryLocation.h:49
const geom::Geometry * getGeometryComponent()
bool isInsideArea()
Tests whether this location represents a point inside an area geometry.
GeometryLocation(const geom::Geometry *component, const geom::CoordinateXY &pt)
Constructs a GeometryLocation specifying a point inside an area geometry.
GeometryLocation(const geom::Geometry *component, std::size_t segIndex, const geom::CoordinateXY &pt)
Constructs a GeometryLocation specifying a point on a geometry, as well as the segment that the point...
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25