GEOS  3.9.1dev
RayCrossingCounterDD.h
Go to the documentation of this file.
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 #ifndef GEOS_ALGORITHM_RAYCROSSINGCOUNTERDD_H
21 #define GEOS_ALGORITHM_RAYCROSSINGCOUNTERDD_H
22 
23 #include <geos/export.h>
24 #include <geos/geom/Location.h>
25 
26 #include <vector>
27 
28 // forward declarations
29 namespace geos {
30 namespace geom {
31 class Coordinate;
32 class CoordinateSequence;
33 }
34 }
35 
36 
37 namespace geos {
38 namespace algorithm {
39 
65 private:
67 
69 
70  // true if the test point lies on an input segment
72 
73  // Declare type as noncopyable
74  RayCrossingCounterDD(const RayCrossingCounterDD& other) = delete;
75  RayCrossingCounterDD& operator=(const RayCrossingCounterDD& rhs) = delete;
76 
77 public:
86  static geom::Location locatePointInRing(const geom::Coordinate& p,
87  const geom::CoordinateSequence& ring);
88 
90  static geom::Location locatePointInRing(const geom::Coordinate& p,
91  const std::vector<const geom::Coordinate*>& ring);
92 
105  static int orientationIndex(const geom::Coordinate& p1,
106  const geom::Coordinate& p2,
107  const geom::Coordinate& q);
108 
110  point(p_point),
111  crossingCount(0),
112  isPointOnSegment(false)
113  { }
114 
121  void countSegment(const geom::Coordinate& p1,
122  const geom::Coordinate& p2);
123 
133  bool
135  {
136  return isPointOnSegment;
137  }
138 
148  geom::Location getLocation();
149 
159  bool isPointInPolygon();
160 
161 };
162 
163 } // geos::algorithm
164 } // geos
165 
166 #endif // GEOS_ALGORITHM_RAYCROSSINGCOUNTERDD_H
#define GEOS_DLL
Definition: export.h:28
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Location
Constants representing the location of a point relative to a geometry.
Definition: Location.h:34
Basic namespace for all GEOS functionalities.
bool isOnSegment()
Reports whether the point lies exactly on one of the supplied segments.
RayCrossingCounterDD(const geom::Coordinate &p_point)
The internal representation of a list of coordinates inside a Geometry.
Counts the number of segments crossed by a horizontal ray extending to the right from a given point...