GEOS: RayCrossingCounter.h Source File

GEOS 3.5.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

RayCrossingCounter.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 *
16 * Last port: algorithm/RayCrossingCounter.java rev. 1.2 (JTS-1.9)
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_ALGORITHM_RAYCROSSINGCOUNTER_H
21 #define GEOS_ALGORITHM_RAYCROSSINGCOUNTER_H
22
23 #include <geos/export.h>
24
25 #include <vector>
26
27 // forward declarations
28 namespace geos {
29 namespace geom {
30 class Coordinate;
31 class CoordinateSequence;
32 }
33 }
34
35
36 namespace geos {
37 namespace algorithm {
38
66 class GEOS_DLL RayCrossingCounter
67 {
68 private:
69 const geom::Coordinate& point;
70
71 int crossingCount;
72
73 // true if the test point lies on an input segment
74 bool isPointOnSegment;
75
76 // Declare type as noncopyable
77 RayCrossingCounter(const RayCrossingCounter& other);
78 RayCrossingCounter& operator=(const RayCrossingCounter& rhs);
79
80 public:
89 static int locatePointInRing(const geom::Coordinate& p,
90 const geom::CoordinateSequence& ring);
91
93 static int locatePointInRing(const geom::Coordinate& p,
94 const std::vector<const geom::Coordinate*>& ring);
95
108 static int orientationIndex(const geom::Coordinate& p1,
109 const geom::Coordinate& p2,
110 const geom::Coordinate& q);
111
112 RayCrossingCounter(const geom::Coordinate& point)
113 : point( point),
114 crossingCount( 0),
115 isPointOnSegment( false)
116 { }
117
124 void countSegment(const geom::Coordinate& p1,
125 const geom::Coordinate& p2);
126
136 bool isOnSegment()
137 {
138 return isPointOnSegment;
139 }
140
151 int getLocation();
152
163 bool isPointInPolygon();
164
165 };
166
167 } // geos::algorithm
168 } // geos
169
170 #endif // GEOS_ALGORITHM_RAYCROSSINGCOUNTER_H
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
geos::algorithm::RayCrossingCounter::isOnSegment
bool isOnSegment()
Definition: RayCrossingCounter.h:136
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::geom::CoordinateSequence
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:59
geos::algorithm::RayCrossingCounter
Counts the number of segments crossed by a horizontal ray extending to the right from a given point...
Definition: RayCrossingCounter.h:66