GEOS 3.6.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
28namespace geos {
29 namespace geom {
30 class Envelope;
31 class LineSegment;
33 }
34 namespace index {
35 namespace chain {
38 }
39 }
40}
41
42namespace geos {
43namespace index { // geos::index
44namespace chain { // geos::index::chain
45
85class GEOS_DLL MonotoneChain
86{
87public:
88
100 std::size_t start, std::size_t end, void* context);
101
103
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
140private:
141
142 void computeSelect(const geom::Envelope& searchEnv,
143 size_t start0,
144 size_t end0,
145 MonotoneChainSelectAction& mcs);
146
147 void computeOverlaps(std::size_t start0, std::size_t end0, MonotoneChain& mc,
148 std::size_t start1, std::size_t end1,
149 MonotoneChainOverlapAction& mco);
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
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:59
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition Envelope.h:53
Definition LineSegment.h:57
Definition MonotoneChainOverlapAction.h:44
Definition MonotoneChainSelectAction.h:45
MonotoneChain(const geom::CoordinateSequence &pts, std::size_t start, std::size_t end, void *context)
const geom::Envelope & getEnvelope() const
Returned envelope is owned by this class.
void getLineSegment(std::size_t index, geom::LineSegment &ls) const
Set given LineSegment with points of the segment starting at the given index.
void select(const geom::Envelope &searchEnv, MonotoneChainSelectAction &mcs)
std::auto_ptr< geom::CoordinateSequence > getCoordinates() const
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Contains classes that implement Monotone Chains.
Definition MCPointInRing.h:41
Provides classes for various kinds of spatial indexes.
Definition IndexedNestedRingTester.h:31
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25