GEOS  3.3.3
index/chain/MonotoneChain.h
1 /**********************************************************************
2  * $Id: MonotoneChain.h 2961 2010-03-29 12:17:37Z mloskot $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
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  * Last port: index/chain/MonotoneChain.java rev. 1.15 (JTS-1.10)
17  *
18  **********************************************************************/
19 
20 #ifndef GEOS_IDX_CHAIN_MONOTONECHAIN_H
21 #define GEOS_IDX_CHAIN_MONOTONECHAIN_H
22 
23 #include <geos/export.h>
24 #include <geos/geom/Envelope.h> // for inline
25 
26 #include <memory> // for auto_ptr
27 
28 // Forward declarations
29 namespace geos {
30  namespace geom {
31  class Envelope;
32  class LineSegment;
33  class CoordinateSequence;
34  }
35  namespace index {
36  namespace chain {
37  class MonotoneChainSelectAction;
38  class MonotoneChainOverlapAction;
39  }
40  }
41 }
42 
43 namespace geos {
44 namespace index { // geos::index
45 namespace chain { // geos::index::chain
46 
86 class GEOS_DLL MonotoneChain
87 {
88 public:
89 
101  std::size_t start, std::size_t end, void* context);
102 
103  ~MonotoneChain();
104 
106  const geom::Envelope& getEnvelope() const;
107 
108  size_t getStartIndex() const { return start; }
109 
110  size_t getEndIndex() const { return end; }
111 
116  void getLineSegment(std::size_t index, geom::LineSegment& ls) const;
117 
123  std::auto_ptr<geom::CoordinateSequence> getCoordinates() const;
124 
129  void select(const geom::Envelope& searchEnv,
131 
132  void computeOverlaps(MonotoneChain *mc,
134 
135  void setId(int nId) { id=nId; }
136 
137  inline int getId() const { return id; }
138 
139  void* getContext() { return context; }
140 
141 private:
142 
143  void computeSelect(const geom::Envelope& searchEnv,
144  size_t start0,
145  size_t end0,
147 
148  void computeOverlaps(std::size_t start0, std::size_t end0, MonotoneChain& mc,
149  std::size_t start1, std::size_t end1,
151 
153  const geom::CoordinateSequence& pts;
154 
156  mutable geom::Envelope* env;
157 
159  void* context;
160 
162  size_t start;
163 
165  size_t end;
166 
168  int id;
169 
170  // Declare type as noncopyable
171  MonotoneChain(const MonotoneChain& other);
172  MonotoneChain& operator=(const MonotoneChain& rhs);
173 };
174 
175 } // namespace geos::index::chain
176 } // namespace geos::index
177 } // namespace geos
178 
179 #endif // GEOS_IDX_CHAIN_MONOTONECHAIN_H
180 
181 /**********************************************************************
182  * $Log$
183  * Revision 1.1 2006/03/22 18:12:31 strk
184  * indexChain.h header split.
185  *
186  **********************************************************************/
187