/src/geos/include/geos/geom/prep/PreparedLineString.h
Line | Count | Source |
1 | | /********************************************************************** |
2 | | * |
3 | | * GEOS - Geometry Engine Open Source |
4 | | * http://geos.osgeo.org |
5 | | * |
6 | | * Copyright (C) 2020 Sandro Santilli <strk@kbt.io> |
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 | | * |
17 | | * Last port: geom/prep/PreparedLineString.java rev 1.3 (JTS-1.10) |
18 | | * |
19 | | **********************************************************************/ |
20 | | |
21 | | #pragma once |
22 | | |
23 | | #include <geos/geom/prep/BasicPreparedGeometry.h> // for inheritance |
24 | | #include <geos/noding/SegmentString.h> |
25 | | #include <geos/noding/FastSegmentSetIntersectionFinder.h> |
26 | | #include <geos/operation/distance/IndexedFacetDistance.h> |
27 | | |
28 | | #include <memory> |
29 | | |
30 | | namespace geos { |
31 | | namespace geom { // geos::geom |
32 | | namespace prep { // geos::geom::prep |
33 | | |
34 | | /** |
35 | | * \brief |
36 | | * A prepared version of {@link LinearRing}, {@link LineString} or {@link MultiLineString} geometries. |
37 | | * |
38 | | * @author mbdavis |
39 | | * |
40 | | */ |
41 | | class PreparedLineString : public BasicPreparedGeometry { |
42 | | private: |
43 | | std::unique_ptr<noding::FastSegmentSetIntersectionFinder> segIntFinder; |
44 | | mutable noding::SegmentString::ConstVect segStrings; |
45 | | mutable std::unique_ptr<operation::distance::IndexedFacetDistance> indexedDistance; |
46 | | |
47 | | protected: |
48 | | public: |
49 | | PreparedLineString(const Geometry* geom) |
50 | | : |
51 | 0 | BasicPreparedGeometry(geom), |
52 | 0 | segIntFinder(nullptr) |
53 | 0 | { } |
54 | | |
55 | | ~PreparedLineString() override; |
56 | | |
57 | | noding::FastSegmentSetIntersectionFinder* getIntersectionFinder(); |
58 | | |
59 | | bool intersects(const geom::Geometry* g) const override; |
60 | | std::unique_ptr<geom::CoordinateSequence> nearestPoints(const geom::Geometry* g) const override; |
61 | | double distance(const geom::Geometry* g) const override; |
62 | | bool isWithinDistance(const geom::Geometry* g, double d) const override; |
63 | | operation::distance::IndexedFacetDistance* getIndexedFacetDistance() const; |
64 | | |
65 | | }; |
66 | | |
67 | | } // namespace geos::geom::prep |
68 | | } // namespace geos::geom |
69 | | } // namespace geos |
70 | | |