GEOS 3.6.2
geomgraph/index/SegmentIntersector.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_GEOMGRAPH_INDEX_SEGMENTINTERSECTOR_H
17#define GEOS_GEOMGRAPH_INDEX_SEGMENTINTERSECTOR_H
18
19#include <geos/export.h>
20#include <vector>
21
22#include <geos/geom/Coordinate.h> // for composition
23
24#ifdef _MSC_VER
25#pragma warning(push)
26#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
27#endif
28
29// Forward declarations
30namespace geos {
31 namespace algorithm {
32 class LineIntersector;
33 }
34 namespace geomgraph {
35 class Node;
36 class Edge;
37 }
38}
39
40namespace geos {
41namespace geomgraph { // geos::geomgraph
42namespace index { // geos::geomgraph::index
43
44
45class GEOS_DLL SegmentIntersector{
46
47private:
48
53 bool hasIntersectionVar;
54
55 bool hasProper;
56
57 bool hasProperInterior;
58
59 bool isDone;
60
61 bool isDoneWhenProperInt;
62
63 // the proper intersection point found
64 geom::Coordinate properIntersectionPoint;
65
66 algorithm::LineIntersector *li;
67
68 bool includeProper;
69
70 bool recordIsolated;
71
72 //bool isSelfIntersection;
73
74 //bool intersectionFound;
75
76 int numIntersections;
77
79 std::vector<std::vector<Node*>*> bdyNodes;
80
81 bool isTrivialIntersection(Edge *e0,int segIndex0,Edge *e1, int segIndex1);
82
83 bool isBoundaryPoint(algorithm::LineIntersector *li,
84 std::vector<std::vector<Node*>*>& tstBdyNodes);
85
86 bool isBoundaryPoint(algorithm::LineIntersector *li,
87 std::vector<Node*> *tstBdyNodes);
88
89public:
90
91 static bool isAdjacentSegments(int i1,int i2);
92
93 // testing only
94 int numTests;
95
96 //SegmentIntersector();
97
98 virtual ~SegmentIntersector() {}
99
100 SegmentIntersector(algorithm::LineIntersector *newLi,
101 bool newIncludeProper, bool newRecordIsolated)
102 :
103 hasIntersectionVar(false),
104 hasProper(false),
105 hasProperInterior(false),
106 isDone(false),
107 isDoneWhenProperInt(false),
108 li(newLi),
109 includeProper(newIncludeProper),
110 recordIsolated(newRecordIsolated),
111 numIntersections(0),
112 bdyNodes(2),
113 numTests(0)
114 {}
115
119 void setBoundaryNodes(std::vector<Node*> *bdyNodes0,
120 std::vector<Node*> *bdyNodes1);
121
122 geom::Coordinate& getProperIntersectionPoint();
123
124 bool hasIntersection();
125
126 bool hasProperIntersection();
127
128 bool hasProperInteriorIntersection();
129
130 void addIntersections(Edge *e0, int segIndex0, Edge *e1, int segIndex1);
131
132 void setIsDoneIfProperInt(bool isDoneWhenProperInt);
133
134 bool getIsDone();
135
136};
137
138} // namespace geos.geomgraph.index
139} // namespace geos.geomgraph
140} // namespace geos
141
142#ifdef _MSC_VER
143#pragma warning(pop)
144#endif
145
146#endif
147
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition LineIntersector.h:49
Definition geomgraph/Edge.h:66
Definition geomgraph/Node.h:62
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:33
Contains classes that implement topology graphs.
Definition IndexedNestedRingTester.h:34
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25