GEOS  3.8.0dev
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<size_t>& getStartIndexes();
51  double getMinX(size_t chainIndex);
52  double getMaxX(size_t chainIndex);
53 
54  void computeIntersects(const MonotoneChainEdge& mce,
55  SegmentIntersector& si);
56 
57  void computeIntersectsForChain(size_t chainIndex0,
58  const MonotoneChainEdge& mce, size_t 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<size_t> startIndex;
67  // these envelopes are created once and reused
68 private:
69  void computeIntersectsForChain(size_t start0, size_t end0,
70  const MonotoneChainEdge& mce,
71  size_t start1, size_t end1,
72  SegmentIntersector& ei);
73 
74  bool overlaps(size_t start0, size_t end0, const MonotoneChainEdge& mce, size_t start1, size_t end1);
75 
76 };
77 
78 } // namespace geos.geomgraph.index
79 } // namespace geos.geomgraph
80 } // namespace geos
81 
82 #ifdef _MSC_VER
83 #pragma warning(pop)
84 #endif
85 
86 #endif
87 
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25