GEOS
3.4.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2005-2006 Refractions Research Inc. 00007 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00008 * 00009 * This is free software; you can redistribute and/or modify it under 00010 * the terms of the GNU Lesser General Public Licence as published 00011 * by the Free Software Foundation. 00012 * See the COPYING file for more information. 00013 * 00014 **********************************************************************/ 00015 00016 #ifndef GEOS_ALGORITHM_MCPOINTINRING_H 00017 #define GEOS_ALGORITHM_MCPOINTINRING_H 00018 00019 #include <geos/export.h> 00020 #include <geos/index/chain/MonotoneChainSelectAction.h> // for inheritance 00021 #include <geos/algorithm/PointInRing.h> // for inheritance 00022 #include <geos/geom/Coordinate.h> // for composition 00023 #include <geos/index/bintree/Interval.h> // for composition 00024 00025 #include <vector> 00026 00027 // Forward declarations 00028 namespace geos { 00029 namespace geom { 00030 class Coordinate; 00031 class LineSegment; 00032 class LinearRing; 00033 class CoordinateSequence; 00034 class CoordinateSequence; 00035 } 00036 namespace index { 00037 namespace bintree { 00038 class Bintree; 00039 class Interval; 00040 } 00041 namespace chain { 00042 class MonotoneChain; 00043 } 00044 } 00045 } 00046 00047 namespace geos { 00048 namespace algorithm { // geos::algorithm 00049 00050 class GEOS_DLL MCPointInRing: public PointInRing { 00051 public: 00052 MCPointInRing(const geom::LinearRing *newRing); 00053 ~MCPointInRing(); 00054 bool isInside(const geom::Coordinate& pt); 00055 00056 void testLineSegment(const geom::Coordinate& p, 00057 const geom::LineSegment& seg); 00058 00059 class MCSelecter: public index::chain::MonotoneChainSelectAction { 00060 using MonotoneChainSelectAction::select; 00061 private: 00062 geom::Coordinate p; 00063 MCPointInRing *parent; 00064 public: 00065 MCSelecter(const geom::Coordinate& newP, MCPointInRing *prt); 00066 void select(const geom::LineSegment& ls); 00067 }; 00068 00069 private: 00070 const geom::LinearRing *ring; 00071 index::bintree::Interval interval; 00072 geom::CoordinateSequence *pts; 00073 index::bintree::Bintree *tree; 00074 int crossings; // number of segment/ray crossings 00075 void buildIndex(); 00076 void testMonotoneChain(geom::Envelope *rayEnv, 00077 MCSelecter *mcSelecter, 00078 index::chain::MonotoneChain *mc); 00079 }; 00080 00081 } // namespace geos::algorithm 00082 } // namespace geos 00083 00084 #endif // GEOS_ALGORITHM_MCPOINTINRING_H 00085