GEOS
3.6.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_GEOMGRAPH_INDEX_MONOTONECHAINEDGE_H 00017 #define GEOS_GEOMGRAPH_INDEX_MONOTONECHAINEDGE_H 00018 00019 #include <geos/export.h> 00020 #include <geos/geom/Envelope.h> // for composition 00021 00022 #ifdef _MSC_VER 00023 #pragma warning(push) 00024 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class 00025 #endif 00026 00027 // Forward declarations 00028 namespace geos { 00029 namespace geom { 00030 class CoordinateSequence; 00031 } 00032 namespace geomgraph { 00033 class Edge; 00034 namespace index { 00035 class SegmentIntersector; 00036 } 00037 } 00038 } 00039 00040 namespace geos { 00041 namespace geomgraph { // geos::geomgraph 00042 namespace index { // geos::geomgraph::index 00043 00044 class GEOS_DLL MonotoneChainEdge { 00045 public: 00046 //MonotoneChainEdge(); 00047 ~MonotoneChainEdge(); 00048 MonotoneChainEdge(Edge *newE); 00049 const geom::CoordinateSequence* getCoordinates(); 00050 std::vector<int>& getStartIndexes(); 00051 double getMinX(int chainIndex); 00052 double getMaxX(int chainIndex); 00053 00054 void computeIntersects(const MonotoneChainEdge &mce, 00055 SegmentIntersector &si); 00056 00057 void computeIntersectsForChain(int chainIndex0, 00058 const MonotoneChainEdge &mce, int chainIndex1, 00059 SegmentIntersector &si); 00060 00061 protected: 00062 Edge *e; 00063 const geom::CoordinateSequence* pts; // cache a reference to the coord array, for efficiency 00064 // the lists of start/end indexes of the monotone chains. 00065 // Includes the end point of the edge as a sentinel 00066 std::vector<int> startIndex; 00067 // these envelopes are created once and reused 00068 geom::Envelope env1; 00069 geom::Envelope env2; 00070 private: 00071 void computeIntersectsForChain(int start0, int end0, 00072 const MonotoneChainEdge &mce, 00073 int start1, int end1, 00074 SegmentIntersector &ei); 00075 }; 00076 00077 } // namespace geos.geomgraph.index 00078 } // namespace geos.geomgraph 00079 } // namespace geos 00080 00081 #ifdef _MSC_VER 00082 #pragma warning(pop) 00083 #endif 00084 00085 #endif 00086