File Coverage

/usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/CPP/geos.x/i/geos/noding/SingleInteriorIntersectionFinder.h
Criterion Covered Total %
statement 7 9 77.7
branch 1 2 50.0
condition n/a
subroutine n/a
pod n/a
total 8 11 72.7


line stmt bran cond sub pod time code
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             #ifndef GEOS_NODING_SINGLEINTERIORINTERSECTIONFINDER_H
16             #define GEOS_NODING_SINGLEINTERIORINTERSECTIONFINDER_H
17              
18             #include // for inheritance
19             #include // for composition
20              
21             #include
22              
23             // Forward declarations
24             namespace geos {
25             namespace algorithm {
26             class LineIntersector;
27             }
28             namespace noding {
29             class SegmentString;
30             }
31             }
32              
33             namespace geos {
34             namespace noding { // geos.noding
35              
36             /**
37             * \brief
38             * Finds an interior intersection in a set of SegmentString,
39             * if one exists. Only the first intersection found is reported.
40             *
41             * @version 1.7
42             */
43             class SingleInteriorIntersectionFinder: public SegmentIntersector
44             {
45              
46             public:
47              
48             /** \brief
49             * Creates an intersection finder which finds an interior intersection
50             * if one exists
51             *
52             * @param li the LineIntersector to use
53             */
54 1           SingleInteriorIntersectionFinder(algorithm::LineIntersector& newLi)
55             :
56             li(newLi),
57 1 50         interiorIntersection(geom::Coordinate::getNull())
58             {
59 1           }
60              
61             /** \brief
62             * Tests whether an intersection was found.
63             *
64             * @return true if an intersection was found
65             */
66 0           bool hasIntersection() const
67             {
68 0           return !interiorIntersection.isNull();
69             }
70              
71             /** \brief
72             * Gets the computed location of the intersection.
73             * Due to round-off, the location may not be exact.
74             *
75             * @return the coordinate for the intersection location
76             */
77 1           const geom::Coordinate& getInteriorIntersection() const
78             {
79 1           return interiorIntersection;
80             }
81              
82             /** \brief
83             * Gets the endpoints of the intersecting segments.
84             *
85             * @return an array of the segment endpoints (p00, p01, p10, p11)
86             */
87 1           const std::vector& getIntersectionSegments() const
88             {
89 1           return intSegments;
90             }
91              
92             /** \brief
93             * This method is called by clients
94             * of the {@link SegmentIntersector} class to process
95             * intersections for two segments of the {@link SegmentStrings} being intersected.
96             *
97             * Note that some clients (such as {@link MonotoneChain}s) may optimize away
98             * this call for segment pairs which they have determined do not intersect
99             * (e.g. by an disjoint envelope test).
100             */
101             void processIntersections(
102             SegmentString* e0, int segIndex0,
103             SegmentString* e1, int segIndex1) override;
104              
105             bool isDone() const override
106             {
107             return !interiorIntersection.isNull();
108             }
109              
110             private:
111             algorithm::LineIntersector& li;
112             geom::Coordinate interiorIntersection;
113             std::vector intSegments;
114              
115             // Declare type as noncopyable
116             SingleInteriorIntersectionFinder(const SingleInteriorIntersectionFinder& other) = delete;
117             SingleInteriorIntersectionFinder& operator=(const SingleInteriorIntersectionFinder& rhs) = delete;
118             };
119              
120             } // namespace geos.noding
121             } // namespace geos
122              
123             #endif // GEOS_NODING_SINGLEINTERIORINTERSECTIONFINDER_H