GEOS  3.8.0dev
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 #ifndef GEOS_ALGORITHM_RAYCROSSINGCOUNTERDD_H
21 #define GEOS_ALGORITHM_RAYCROSSINGCOUNTERDD_H
22 
23 #include <geos/export.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 
64 class GEOS_DLL RayCrossingCounterDD {
65 private:
66  const geom::Coordinate& point;
67 
68  int crossingCount;
69 
70  // true if the test point lies on an input segment
71  bool isPointOnSegment;
72 
73  // Declare type as noncopyable
74  RayCrossingCounterDD(const RayCrossingCounterDD& other) = delete;
75  RayCrossingCounterDD& operator=(const RayCrossingCounterDD& rhs) = delete;
76 
77 public:
86  static int locatePointInRing(const geom::Coordinate& p,
87  const geom::CoordinateSequence& ring);
88 
90  static int 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 
109  RayCrossingCounterDD(const geom::Coordinate& p_point):
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 
149  int getLocation();
150 
161  bool isPointInPolygon();
162 
163 };
164 
165 } // geos::algorithm
166 } // geos
167 
168 #endif // GEOS_ALGORITHM_RAYCROSSINGCOUNTERDD_H
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
bool isOnSegment()
Definition: RayCrossingCounterDD.h:134
Mathematics functions.
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
Definition: RayCrossingCounterDD.h:64