GEOS  3.4.2
index/chain/MonotoneChain.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2001-2002 Vivid Solutions Inc.
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  **********************************************************************
14  *
15  * Last port: index/chain/MonotoneChain.java rev. 1.15 (JTS-1.10)
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_IDX_CHAIN_MONOTONECHAIN_H
20 #define GEOS_IDX_CHAIN_MONOTONECHAIN_H
21 
22 #include <geos/export.h>
23 #include <geos/geom/Envelope.h> // for inline
24 
25 #include <memory> // for auto_ptr
26 
27 // Forward declarations
28 namespace geos {
29  namespace geom {
30  class Envelope;
31  class LineSegment;
32  class CoordinateSequence;
33  }
34  namespace index {
35  namespace chain {
36  class MonotoneChainSelectAction;
37  class MonotoneChainOverlapAction;
38  }
39  }
40 }
41 
42 namespace geos {
43 namespace index { // geos::index
44 namespace chain { // geos::index::chain
45 
85 class GEOS_DLL MonotoneChain
86 {
87 public:
88 
100  std::size_t start, std::size_t end, void* context);
101 
102  ~MonotoneChain();
103 
105  const geom::Envelope& getEnvelope() const;
106 
107  size_t getStartIndex() const { return start; }
108 
109  size_t getEndIndex() const { return end; }
110 
115  void getLineSegment(std::size_t index, geom::LineSegment& ls) const;
116 
122  std::auto_ptr<geom::CoordinateSequence> getCoordinates() const;
123 
128  void select(const geom::Envelope& searchEnv,
130 
131  void computeOverlaps(MonotoneChain *mc,
133 
134  void setId(int nId) { id=nId; }
135 
136  inline int getId() const { return id; }
137 
138  void* getContext() { return context; }
139 
140 private:
141 
142  void computeSelect(const geom::Envelope& searchEnv,
143  size_t start0,
144  size_t end0,
146 
147  void computeOverlaps(std::size_t start0, std::size_t end0, MonotoneChain& mc,
148  std::size_t start1, std::size_t end1,
150 
152  const geom::CoordinateSequence& pts;
153 
155  mutable geom::Envelope* env;
156 
158  void* context;
159 
161  size_t start;
162 
164  size_t end;
165 
167  int id;
168 
169  // Declare type as noncopyable
170  MonotoneChain(const MonotoneChain& other);
171  MonotoneChain& operator=(const MonotoneChain& rhs);
172 };
173 
174 } // namespace geos::index::chain
175 } // namespace geos::index
176 } // namespace geos
177 
178 #endif // GEOS_IDX_CHAIN_MONOTONECHAIN_H
179 
Definition: LineSegment.h:57
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:53
Definition: MonotoneChainOverlapAction.h:44
Definition: MonotoneChainSelectAction.h:45
Monotone Chains are a way of partitioning the segments of a linestring to allow for fast searching of...
Definition: index/chain/MonotoneChain.h:85
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:59