GEOS  3.3.3
MCPointInRing.h
1 /**********************************************************************
2  * $Id: MCPointInRing.h 2556 2009-06-06 22:22:28Z strk $
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_ALGORITHM_MCPOINTINRING_H
18 #define GEOS_ALGORITHM_MCPOINTINRING_H
19 
20 #include <geos/export.h>
21 #include <geos/index/chain/MonotoneChainSelectAction.h> // for inheritance
22 #include <geos/algorithm/PointInRing.h> // for inheritance
23 #include <geos/geom/Coordinate.h> // for composition
24 #include <geos/index/bintree/Interval.h> // for composition
25 
26 #include <vector>
27 
28 // Forward declarations
29 namespace geos {
30  namespace geom {
31  class Coordinate;
32  class LineSegment;
33  class LinearRing;
34  class CoordinateSequence;
35  class CoordinateSequence;
36  }
37  namespace index {
38  namespace bintree {
39  class Bintree;
40  class Interval;
41  }
42  namespace chain {
43  class MonotoneChain;
44  }
45  }
46 }
47 
48 namespace geos {
49 namespace algorithm { // geos::algorithm
50 
51 class GEOS_DLL MCPointInRing: public PointInRing {
52 public:
53  MCPointInRing(const geom::LinearRing *newRing);
54  ~MCPointInRing();
55  bool isInside(const geom::Coordinate& pt);
56 
57  void testLineSegment(const geom::Coordinate& p,
58  const geom::LineSegment& seg);
59 
60  class MCSelecter: public index::chain::MonotoneChainSelectAction {
61  using MonotoneChainSelectAction::select;
62  private:
63  geom::Coordinate p;
64  MCPointInRing *parent;
65  public:
66  MCSelecter(const geom::Coordinate& newP, MCPointInRing *prt);
67  void select(const geom::LineSegment& ls);
68  };
69 
70 private:
71  const geom::LinearRing *ring;
72  index::bintree::Interval interval;
73  geom::CoordinateSequence *pts;
74  index::bintree::Bintree *tree;
75  int crossings; // number of segment/ray crossings
76  void buildIndex();
77  void testMonotoneChain(geom::Envelope *rayEnv,
78  MCSelecter *mcSelecter,
79  index::chain::MonotoneChain *mc);
80 };
81 
82 } // namespace geos::algorithm
83 } // namespace geos
84 
85 #endif // GEOS_ALGORITHM_MCPOINTINRING_H
86 
87 /**********************************************************************
88  * $Log$
89  * Revision 1.4 2006/03/29 11:52:00 strk
90  * const correctness, useless heap allocations removal
91  *
92  * Revision 1.3 2006/03/22 18:12:31 strk
93  * indexChain.h header split.
94  *
95  * Revision 1.2 2006/03/22 16:01:33 strk
96  * indexBintree.h header split, classes renamed to match JTS
97  *
98  * Revision 1.1 2006/03/09 16:46:48 strk
99  * geos::geom namespace definition, first pass at headers split
100  *
101  **********************************************************************/
102