GEOS  3.6.1
MCPointInRing.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2005-2006 Refractions Research Inc.
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 #ifndef GEOS_ALGORITHM_MCPOINTINRING_H
17 #define GEOS_ALGORITHM_MCPOINTINRING_H
18 
19 #include <geos/export.h>
20 #include <geos/index/chain/MonotoneChainSelectAction.h> // for inheritance
21 #include <geos/algorithm/PointInRing.h> // for inheritance
22 #include <geos/geom/Coordinate.h> // for composition
23 #include <geos/index/bintree/Interval.h> // for composition
24 
25 #include <vector>
26 
27 // Forward declarations
28 namespace geos {
29  namespace geom {
30  class Coordinate;
31  class LineSegment;
32  class LinearRing;
33  class CoordinateSequence;
34  class CoordinateSequence;
35  }
36  namespace index {
37  namespace bintree {
38  class Bintree;
39  class Interval;
40  }
41  namespace chain {
42  class MonotoneChain;
43  }
44  }
45 }
46 
47 namespace geos {
48 namespace algorithm { // geos::algorithm
49 
50 class GEOS_DLL MCPointInRing: public PointInRing {
51 public:
52  MCPointInRing(const geom::LinearRing *newRing);
53  ~MCPointInRing();
54  bool isInside(const geom::Coordinate& pt);
55 
56  void testLineSegment(const geom::Coordinate& p,
57  const geom::LineSegment& seg);
58 
59  class MCSelecter: public index::chain::MonotoneChainSelectAction {
60  using MonotoneChainSelectAction::select;
61  private:
62  geom::Coordinate p;
63  MCPointInRing *parent;
64  public:
65  MCSelecter(const geom::Coordinate& newP, MCPointInRing *prt);
66  void select(const geom::LineSegment& ls);
67  };
68 
69 private:
70  const geom::LinearRing *ring;
71  index::bintree::Interval interval;
72  geom::CoordinateSequence *pts;
73  index::bintree::Bintree *tree;
74  int crossings; // number of segment/ray crossings
75  void buildIndex();
76  void testMonotoneChain(geom::Envelope *rayEnv,
77  MCSelecter *mcSelecter,
78  index::chain::MonotoneChain *mc);
79 };
80 
81 } // namespace geos::algorithm
82 } // namespace geos
83 
84 #endif // GEOS_ALGORITHM_MCPOINTINRING_H
85 
Represents an (1-dimensional) closed interval on the Real number line.
Definition: bintree/Interval.h:25
An BinTree (or "Binary Interval Tree") is a 1-dimensional version of a quadtree.
Definition: Bintree.h:56
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Monotone Chains are a way of partitioning the segments of a linestring to allow for fast searching of...
Definition: index/chain/MonotoneChain.h:85