GEOS  3.3.3
SingleInteriorIntersectionFinder.h
1 /**********************************************************************
2  * $Id: SingleInteriorIntersectionFinder.h 2778 2009-12-03 19:44:00Z mloskot $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2006 Refractions Research 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_NODING_SINGLEINTERIORINTERSECTIONFINDER_H
17 #define GEOS_NODING_SINGLEINTERIORINTERSECTIONFINDER_H
18 
19 #include <geos/noding/SegmentIntersector.h> // for inheritance
20 #include <geos/geom/Coordinate.h> // for composition
21 
22 #include <vector>
23 
24 // Forward declarations
25 namespace geos {
26  namespace algorithm {
27  class LineIntersector;
28  }
29  namespace noding {
30  class SegmentString;
31  }
32 }
33 
34 namespace geos {
35 namespace noding { // geos.noding
36 
45 {
46 
47 public:
48 
56  :
57  li(newLi),
58  interiorIntersection(geom::Coordinate::getNull())
59  {
60  }
61 
67  bool hasIntersection() const
68  {
69  return !interiorIntersection.isNull();
70  }
71 
79  {
80  return interiorIntersection;
81  }
82 
88  const std::vector<geom::Coordinate>& getIntersectionSegments() const
89  {
90  return intSegments;
91  }
92 
103  SegmentString* e0, int segIndex0,
104  SegmentString* e1, int segIndex1);
105 
106  bool isDone() const
107  {
108  return !interiorIntersection.isNull();
109  }
110 
111 private:
113  geom::Coordinate interiorIntersection;
114  std::vector<geom::Coordinate> intSegments;
115 
116  // Declare type as noncopyable
119 };
120 
121 } // namespace geos.noding
122 } // namespace geos
123 
124 #endif // GEOS_NODING_SINGLEINTERIORINTERSECTIONFINDER_H
125 
126 /**********************************************************************
127  * $Log$
128  **********************************************************************/
void processIntersections(SegmentString *e0, int segIndex0, SegmentString *e1, int segIndex1)
This method is called by clients of the SegmentIntersector class to process intersections for two seg...
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:61
bool isDone() const
Reports whether the client of this class needs to continue testing all intersections in an arrangemen...
Definition: SingleInteriorIntersectionFinder.h:106
An interface for classes which represent a sequence of contiguous line segments.
Definition: SegmentString.h:46
bool hasIntersection() const
Tests whether an intersection was found.
Definition: SingleInteriorIntersectionFinder.h:67
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition: LineIntersector.h:50
Processes possible intersections detected by a Noder.
Definition: noding/SegmentIntersector.h:48
const geom::Coordinate & getInteriorIntersection() const
Gets the computed location of the intersection. Due to round-off, the location may not be exact...
Definition: SingleInteriorIntersectionFinder.h:78
const std::vector< geom::Coordinate > & getIntersectionSegments() const
Gets the endpoints of the intersecting segments.
Definition: SingleInteriorIntersectionFinder.h:88
Finds an interior intersection in a set of SegmentString, if one exists. Only the first intersection ...
Definition: SingleInteriorIntersectionFinder.h:44
SingleInteriorIntersectionFinder(algorithm::LineIntersector &newLi)
Creates an intersection finder which finds an interior intersection if one exists.
Definition: SingleInteriorIntersectionFinder.h:55