GEOS 3.6.2
IntersectionAdder.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2006 Refractions Research Inc.
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************
14 *
15 * Last port: noding/IntersectionAdder.java rev. 1.6 (JTS-1.9)
16 *
17 **********************************************************************/
18
19#ifndef GEOS_NODING_INTERSECTIONADDER_H
20#define GEOS_NODING_INTERSECTIONADDER_H
21
22#include <geos/export.h>
23
24#include <vector>
25#include <iostream>
26#include <cstdlib> // for abs()
27
28#include <geos/inline.h>
29
30#include <geos/geom/Coordinate.h>
31#include <geos/noding/SegmentIntersector.h> // for inheritance
32
33// Forward declarations
34namespace geos {
35 namespace geom {
36 class Coordinate;
37 }
38 namespace noding {
39 class SegmentString;
40 }
41 namespace algorithm {
42 class LineIntersector;
43 }
44}
45
46namespace geos {
47namespace noding { // geos.noding
48
58class GEOS_DLL IntersectionAdder: public SegmentIntersector {
59
60private:
61
66 bool hasIntersectionVar;
67 bool hasProper;
68 bool hasProperInterior;
69 bool hasInterior;
70
71 // the proper intersection point found
72 const geom::Coordinate* properIntersectionPoint;
73
75 bool isSelfIntersection;
76 //bool intersectionFound;
77
84 bool isTrivialIntersection(const SegmentString* e0, int segIndex0,
85 const SegmentString* e1, int segIndex1);
86
87 // Declare type as noncopyable
88 IntersectionAdder(const IntersectionAdder& other);
89 IntersectionAdder& operator=(const IntersectionAdder& rhs);
90
91public:
92
93 int numIntersections;
94 int numInteriorIntersections;
95 int numProperIntersections;
96
97 // testing only
98 int numTests;
99
100 IntersectionAdder(algorithm::LineIntersector& newLi)
101 :
102 hasIntersectionVar(false),
103 hasProper(false),
104 hasProperInterior(false),
105 hasInterior(false),
106 properIntersectionPoint(NULL),
107 li(newLi),
108 numIntersections(0),
109 numInteriorIntersections(0),
110 numProperIntersections(0),
111 numTests(0)
112 {}
113
114 algorithm::LineIntersector& getLineIntersector() { return li; }
115
121 return properIntersectionPoint;
122 }
123
124 bool hasIntersection() { return hasIntersectionVar; }
125
134 bool hasProperIntersection() { return hasProper; }
135
141 bool hasProperInteriorIntersection() { return hasProperInterior; }
142
147 bool hasInteriorIntersection() { return hasInterior; }
148
149
160 SegmentString* e0, int segIndex0,
161 SegmentString* e1, int segIndex1);
162
163
164 static bool isAdjacentSegments(int i1, int i2) {
165 return std::abs(i1 - i2) == 1;
166 }
167
173 virtual bool isDone() const {
174 return false;
175 }
176};
177
178
179} // namespace geos.noding
180} // namespace geos
181
182#endif // GEOS_NODING_INTERSECTIONADDER_H
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition LineIntersector.h:49
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
bool hasInteriorIntersection()
Definition IntersectionAdder.h:147
const geom::Coordinate * getProperIntersectionPoint()
Definition IntersectionAdder.h:120
void processIntersections(SegmentString *e0, int segIndex0, SegmentString *e1, int segIndex1)
virtual bool isDone() const
Definition IntersectionAdder.h:173
bool hasProperInteriorIntersection()
Definition IntersectionAdder.h:141
bool hasProperIntersection()
Definition IntersectionAdder.h:134
An interface for classes which represent a sequence of contiguous line segments.
Definition SegmentString.h:46
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:33
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Classes to compute nodings for arrangements of line segments and line segment sequences.
Definition PreparedLineString.h:27
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25