GEOS 3.11.1
RayCrossingCounterDD.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2018 Paul Ramsey <pramsey@cleverelephant.ca>
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 *
16 * Last port: algorithm/RayCrossingCounterDD.java rev. 1.2 (JTS-1.9)
17 *
18 **********************************************************************/
19
20#pragma once
21
22#include <geos/export.h>
23#include <geos/geom/Location.h>
24
25#include <vector>
26
27// forward declarations
28namespace geos {
29namespace geom {
30class Coordinate;
31class CoordinateSequence;
32}
33}
34
35
36namespace geos {
37namespace algorithm {
38
63class GEOS_DLL RayCrossingCounterDD {
64private:
65 const geom::Coordinate& point;
66
67 int crossingCount;
68
69 // true if the test point lies on an input segment
70 bool isPointOnSegment;
71
72 // Declare type as noncopyable
73 RayCrossingCounterDD(const RayCrossingCounterDD& other) = delete;
74 RayCrossingCounterDD& operator=(const RayCrossingCounterDD& rhs) = delete;
75
76public:
86 const geom::CoordinateSequence& ring);
87
90 const std::vector<const geom::Coordinate*>& ring);
91
104 static int orientationIndex(const geom::Coordinate& p1,
105 const geom::Coordinate& p2,
106 const geom::Coordinate& q);
107
109 point(p_point),
110 crossingCount(0),
111 isPointOnSegment(false)
112 { }
113
121 const geom::Coordinate& p2);
122
132 bool
134 {
135 return isPointOnSegment;
136 }
137
148
159
160};
161
162} // geos::algorithm
163} // geos
164
Counts the number of segments crossed by a horizontal ray extending to the right from a given point,...
Definition: RayCrossingCounterDD.h:63
static geom::Location locatePointInRing(const geom::Coordinate &p, const std::vector< const geom::Coordinate * > &ring)
Semantically equal to the above, just different args encoding.
bool isPointInPolygon()
Tests whether the point lies in or on the ring, polygon or multipolygon from which the processed segm...
geom::Location getLocation()
Gets the Location of the point relative to the ring, polygon or multipolygon from which the processed...
bool isOnSegment()
Reports whether the point lies exactly on one of the supplied segments.
Definition: RayCrossingCounterDD.h:133
void countSegment(const geom::Coordinate &p1, const geom::Coordinate &p2)
Counts a segment.
static geom::Location locatePointInRing(const geom::Coordinate &p, const geom::CoordinateSequence &ring)
Determines the Location of a point in a ring. This method is an exemplar of how to use this class.
static int orientationIndex(const geom::Coordinate &p1, const geom::Coordinate &p2, const geom::Coordinate &q)
Returns the index of the direction of the point q relative to a vector specified by p1-p2.
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:44
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
Location
Constants representing the location of a point relative to a geometry.
Definition: Location.h:32
Basic namespace for all GEOS functionalities.
Definition: geos.h:39