00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GEOS_ALGORITHM_RAYCROSSINGCOUNTER_H
00021 #define GEOS_ALGORITHM_RAYCROSSINGCOUNTER_H
00022
00023 #include <geos/export.h>
00024
00025 #include <vector>
00026
00027
00028 namespace geos {
00029 namespace geom {
00030 class Coordinate;
00031 class CoordinateSequence;
00032 }
00033 }
00034
00035
00036 namespace geos {
00037 namespace algorithm {
00038
00066 class GEOS_DLL RayCrossingCounter
00067 {
00068 private:
00069 const geom::Coordinate& point;
00070
00071 int crossingCount;
00072
00073
00074 bool isPointOnSegment;
00075
00076
00077 RayCrossingCounter(const RayCrossingCounter& other);
00078 RayCrossingCounter& operator=(const RayCrossingCounter& rhs);
00079
00080 public:
00089 static int locatePointInRing(const geom::Coordinate& p,
00090 const geom::CoordinateSequence& ring);
00091
00093 static int locatePointInRing(const geom::Coordinate& p,
00094 const std::vector<const geom::Coordinate*>& ring);
00095
00096 RayCrossingCounter(const geom::Coordinate& point)
00097 : point( point),
00098 crossingCount( 0),
00099 isPointOnSegment( false)
00100 { }
00101
00108 void countSegment(const geom::Coordinate& p1,
00109 const geom::Coordinate& p2);
00110
00120 bool isOnSegment()
00121 {
00122 return isPointOnSegment;
00123 }
00124
00135 int getLocation();
00136
00147 bool isPointInPolygon();
00148
00149 };
00150
00151 }
00152 }
00153
00154 #endif // GEOS_ALGORITHM_RAYCROSSINGCOUNTER_H