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
00108 static int orientationIndex(const geom::Coordinate& p1,
00109 const geom::Coordinate& p2,
00110 const geom::Coordinate& q);
00111
00112 RayCrossingCounter(const geom::Coordinate& point)
00113 : point( point),
00114 crossingCount( 0),
00115 isPointOnSegment( false)
00116 { }
00117
00124 void countSegment(const geom::Coordinate& p1,
00125 const geom::Coordinate& p2);
00126
00136 bool isOnSegment()
00137 {
00138 return isPointOnSegment;
00139 }
00140
00151 int getLocation();
00152
00163 bool isPointInPolygon();
00164
00165 };
00166
00167 }
00168 }
00169
00170 #endif // GEOS_ALGORITHM_RAYCROSSINGCOUNTER_H