GEOS  3.9.1dev
MonotoneChainEdge.h
Go to the documentation of this file.
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 
47 public:
48  //MonotoneChainEdge();
49  ~MonotoneChainEdge() = default;
50  MonotoneChainEdge(Edge* newE);
51  const geom::CoordinateSequence* getCoordinates();
52  std::vector<size_t>& getStartIndexes();
53  double getMinX(size_t chainIndex);
54  double getMaxX(size_t chainIndex);
55 
56  void computeIntersects(const MonotoneChainEdge& mce,
57  SegmentIntersector& si);
58 
59  void computeIntersectsForChain(size_t chainIndex0,
60  const MonotoneChainEdge& mce, size_t chainIndex1,
61  SegmentIntersector& si);
62 
63 protected:
64  Edge* e;
65  const geom::CoordinateSequence* pts; // cache a reference to the coord array, for efficiency
66  // the lists of start/end indexes of the monotone chains.
67  // Includes the end point of the edge as a sentinel
68  std::vector<size_t> startIndex;
69  // these envelopes are created once and reused
70 private:
71  void computeIntersectsForChain(size_t start0, size_t end0,
72  const MonotoneChainEdge& mce,
73  size_t start1, size_t end1,
74  SegmentIntersector& ei);
75 
76  bool overlaps(size_t start0, size_t end0, const MonotoneChainEdge& mce, size_t start1, size_t end1);
77 
78 };
79 
80 } // namespace geos.geomgraph.index
81 } // namespace geos.geomgraph
82 } // namespace geos
83 
84 #ifdef _MSC_VER
85 #pragma warning(pop)
86 #endif
87 
88 #endif
89 
MonotoneChains are a way of partitioning the segments of an edge to allow for fast searching of inter...
#define GEOS_DLL
Definition: export.h:28
Computes the intersection of line segments, and adds the intersection to the edges containing the seg...
const geom::CoordinateSequence * pts
Basic namespace for all GEOS functionalities.
The internal representation of a list of coordinates inside a Geometry.