GEOS  3.4.2
MonotoneChainEdge.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2005-2006 Refractions Research Inc.
7  * Copyright (C) 2001-2002 Vivid Solutions Inc.
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  *
14  **********************************************************************/
15 
16 #ifndef GEOS_GEOMGRAPH_INDEX_MONOTONECHAINEDGE_H
17 #define GEOS_GEOMGRAPH_INDEX_MONOTONECHAINEDGE_H
18 
19 #include <geos/export.h>
20 #include <geos/geom/Envelope.h> // for composition
21 
22 #ifdef _MSC_VER
23 #pragma warning(push)
24 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
25 #endif
26 
27 // Forward declarations
28 namespace geos {
29  namespace geom {
30  class CoordinateSequence;
31  }
32  namespace geomgraph {
33  class Edge;
34  namespace index {
35  class SegmentIntersector;
36  }
37  }
38 }
39 
40 namespace geos {
41 namespace geomgraph { // geos::geomgraph
42 namespace index { // geos::geomgraph::index
43 
44 class GEOS_DLL MonotoneChainEdge {
45 public:
46  //MonotoneChainEdge();
47  ~MonotoneChainEdge();
48  MonotoneChainEdge(Edge *newE);
49  const geom::CoordinateSequence* getCoordinates();
50  std::vector<int>& getStartIndexes();
51  double getMinX(int chainIndex);
52  double getMaxX(int chainIndex);
53 
54  void computeIntersects(const MonotoneChainEdge &mce,
55  SegmentIntersector &si);
56 
57  void computeIntersectsForChain(int chainIndex0,
58  const MonotoneChainEdge &mce, int chainIndex1,
59  SegmentIntersector &si);
60 
61 protected:
62  Edge *e;
63  const geom::CoordinateSequence* pts; // cache a reference to the coord array, for efficiency
64  // the lists of start/end indexes of the monotone chains.
65  // Includes the end point of the edge as a sentinel
66  std::vector<int> startIndex;
67  // these envelopes are created once and reused
68  geom::Envelope env1;
69  geom::Envelope env2;
70 private:
71  void computeIntersectsForChain(int start0, int end0,
72  const MonotoneChainEdge &mce,
73  int start1, int end1,
74  SegmentIntersector &ei);
75 };
76 
77 } // namespace geos.geomgraph.index
78 } // namespace geos.geomgraph
79 } // namespace geos
80 
81 #ifdef _MSC_VER
82 #pragma warning(pop)
83 #endif
84 
85 #endif
86