GEOS  3.3.3
geomgraph/index/SegmentIntersector.h
1 /**********************************************************************
2  * $Id: SegmentIntersector.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_SEGMENTINTERSECTOR_H
18 #define GEOS_GEOMGRAPH_INDEX_SEGMENTINTERSECTOR_H
19 
20 #include <geos/export.h>
21 #include <vector>
22 
23 #include <geos/geom/Coordinate.h> // for composition
24 
25 #ifdef _MSC_VER
26 #pragma warning(push)
27 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
28 #endif
29 
30 // Forward declarations
31 namespace geos {
32  namespace algorithm {
33  class LineIntersector;
34  }
35  namespace geomgraph {
36  class Node;
37  class Edge;
38  }
39 }
40 
41 namespace geos {
42 namespace geomgraph { // geos::geomgraph
43 namespace index { // geos::geomgraph::index
44 
45 
46 class GEOS_DLL SegmentIntersector{
47 
48 private:
49 
54  bool hasIntersectionVar;
55 
56  bool hasProper;
57 
58  bool hasProperInterior;
59 
60  // the proper intersection point found
61  geom::Coordinate properIntersectionPoint;
62 
63  algorithm::LineIntersector *li;
64 
65  bool includeProper;
66 
67  bool recordIsolated;
68 
69  //bool isSelfIntersection;
70 
71  //bool intersectionFound;
72 
73  int numIntersections;
74 
76  std::vector<std::vector<Node*>*> bdyNodes;
77 
78  bool isTrivialIntersection(Edge *e0,int segIndex0,Edge *e1, int segIndex1);
79 
80  bool isBoundaryPoint(algorithm::LineIntersector *li,
81  std::vector<std::vector<Node*>*>& tstBdyNodes);
82 
83  bool isBoundaryPoint(algorithm::LineIntersector *li,
84  std::vector<Node*> *tstBdyNodes);
85 
86 public:
87 
88  static bool isAdjacentSegments(int i1,int i2);
89 
90  // testing only
91  int numTests;
92 
93  //SegmentIntersector();
94 
95  virtual ~SegmentIntersector() {}
96 
97  SegmentIntersector(algorithm::LineIntersector *newLi,
98  bool newIncludeProper, bool newRecordIsolated)
99  :
100  hasIntersectionVar(false),
101  hasProper(false),
102  hasProperInterior(false),
103  li(newLi),
104  includeProper(newIncludeProper),
105  recordIsolated(newRecordIsolated),
106  numIntersections(0),
107  bdyNodes(2),
108  numTests(0)
109  {}
110 
114  void setBoundaryNodes(std::vector<Node*> *bdyNodes0,
115  std::vector<Node*> *bdyNodes1);
116 
117  geom::Coordinate& getProperIntersectionPoint();
118 
119  bool hasIntersection();
120 
121  bool hasProperIntersection();
122 
123  bool hasProperInteriorIntersection();
124 
125  void addIntersections(Edge *e0, int segIndex0, Edge *e1, int segIndex1);
126 
127 };
128 
129 } // namespace geos.geomgraph.index
130 } // namespace geos.geomgraph
131 } // namespace geos
132 
133 #ifdef _MSC_VER
134 #pragma warning(pop)
135 #endif
136 
137 #endif
138 
139 /**********************************************************************
140  * $Log$
141  * Revision 1.1 2006/03/14 12:55:55 strk
142  * Headers split: geomgraphindex.h, nodingSnapround.h
143  *
144  **********************************************************************/
145