GEOS  3.9.1dev
SegmentIntersectionDetector.h
Go to the documentation of this file.
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 
16 #ifndef GEOS_GEOM_PREP_SEGMENTINTERSECTIONDETECTOR_H
17 #define GEOS_GEOM_PREP_SEGMENTINTERSECTIONDETECTOR_H
18 
19 #include <cstddef>
22 #include <geos/geom/Coordinate.h>
25 
26 namespace geos {
27 namespace noding { // geos::noding
28 
43 private:
45 
46  bool findProper;
48 
52 
55 
56 protected:
57 public:
59  :
60  li(p_li),
61  findProper(false),
62  findAllTypes(false),
63  _hasIntersection(false),
64  _hasProperIntersection(false),
65  _hasNonProperIntersection(false),
66  intPt(nullptr),
67  intSegments(nullptr)
68  { }
69 
71  {
72  //delete intPt;
73  delete intSegments;
74  }
75 
76 
77  void
78  setFindProper(bool p_findProper)
79  {
80  this->findProper = p_findProper;
81  }
82 
83  void
84  setFindAllIntersectionTypes(bool p_findAllTypes)
85  {
86  this->findAllTypes = p_findAllTypes;
87  }
88 
94  bool
96  {
97  return _hasIntersection;
98  }
99 
105  bool
107  {
108  return _hasProperIntersection;
109  }
110 
116  bool
118  {
120  }
121 
128  const geom::Coordinate*
130  {
131  return intPt;
132  }
133 
134 
142  {
143  return intSegments;
144  }
145 
146  bool
147  isDone() const override
148  {
149  // If finding all types, we can stop
150  // when both possible types have been found.
151  if(findAllTypes) {
152  return _hasProperIntersection && _hasNonProperIntersection;
153  }
154 
155  // If searching for a proper intersection, only stop if one is found
156  if(findProper) {
157  return _hasProperIntersection;
158  }
159 
160  return _hasIntersection;
161  }
162 
171  void processIntersections(noding::SegmentString* e0, size_t segIndex0,
172  noding::SegmentString* e1, size_t segIndex1) override;
173 
174 };
175 
176 } // namespace geos::noding
177 } // namespace geos
178 
179 #endif // GEOS_GEOM_PREP_SEGMENTINTERSECTIONDETECTOR_H
Detects and records an intersection between two SegmentStrings, if one exists.
The default implementation of CoordinateSequence.
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
An interface for classes which represent a sequence of contiguous line segments.
Definition: SegmentString.h:46
bool hasNonProperIntersection() const
Tests whether a non-proper intersection was found.
SegmentIntersectionDetector(algorithm::LineIntersector *p_li)
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
const geom::Coordinate * getIntersection() const
Gets the computed location of the intersection. Due to round-off, the location may not be exact...
Basic namespace for all GEOS functionalities.
const geom::CoordinateSequence * getIntersectionSegments() const
Gets the endpoints of the intersecting segments.
Processes possible intersections detected by a Noder.
The internal representation of a list of coordinates inside a Geometry.
bool isDone() const override
Reports whether the client of this class needs to continue testing all intersections in an arrangemen...
bool hasIntersection() const
Tests whether an intersection was found.
bool hasProperIntersection() const
Tests whether a proper intersection was found.
void processIntersections(noding::SegmentString *e0, size_t segIndex0, noding::SegmentString *e1, size_t segIndex1) override
This method is called by clients of the SegmentIntersector class to process intersections for two seg...