GEOS  3.3.3
MonotoneChainEdge.h
1 /**********************************************************************
2  * $Id: MonotoneChainEdge.h 3255 2011-03-01 17:56:10Z mloskot $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2005-2006 Refractions Research Inc.
8  * Copyright (C) 2001-2002 Vivid Solutions Inc.
9  *
10  * This is free software; you can redistribute and/or modify it under
11  * the terms of the GNU Lesser General Public Licence as published
12  * by the Free Software Foundation.
13  * See the COPYING file for more information.
14  *
15  **********************************************************************/
16 
17 #ifndef GEOS_GEOMGRAPH_INDEX_MONOTONECHAINEDGE_H
18 #define GEOS_GEOMGRAPH_INDEX_MONOTONECHAINEDGE_H
19 
20 #include <geos/export.h>
21 #include <geos/geom/Envelope.h> // for composition
22 
23 #ifdef _MSC_VER
24 #pragma warning(push)
25 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
26 #endif
27 
28 // Forward declarations
29 namespace geos {
30  namespace geom {
31  class CoordinateSequence;
32  }
33  namespace geomgraph {
34  class Edge;
35  namespace index {
36  class SegmentIntersector;
37  }
38  }
39 }
40 
41 namespace geos {
42 namespace geomgraph { // geos::geomgraph
43 namespace index { // geos::geomgraph::index
44 
45 class GEOS_DLL MonotoneChainEdge {
46 public:
47  //MonotoneChainEdge();
48  ~MonotoneChainEdge();
49  MonotoneChainEdge(Edge *newE);
50  const geom::CoordinateSequence* getCoordinates();
51  std::vector<int>& getStartIndexes();
52  double getMinX(int chainIndex);
53  double getMaxX(int chainIndex);
54 
55  void computeIntersects(const MonotoneChainEdge &mce,
56  SegmentIntersector &si);
57 
58  void computeIntersectsForChain(int chainIndex0,
59  const MonotoneChainEdge &mce, int chainIndex1,
60  SegmentIntersector &si);
61 
62 protected:
63  Edge *e;
64  const geom::CoordinateSequence* pts; // cache a reference to the coord array, for efficiency
65  // the lists of start/end indexes of the monotone chains.
66  // Includes the end point of the edge as a sentinel
67  std::vector<int> startIndex;
68  // these envelopes are created once and reused
69  geom::Envelope env1;
70  geom::Envelope env2;
71 private:
72  void computeIntersectsForChain(int start0, int end0,
73  const MonotoneChainEdge &mce,
74  int start1, int end1,
75  SegmentIntersector &ei);
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 
88 /**********************************************************************
89  * $Log$
90  * Revision 1.1 2006/03/14 12:55:55 strk
91  * Headers split: geomgraphindex.h, nodingSnapround.h
92  *
93  **********************************************************************/
94