GEOS 3.15.0dev
FacetSequence.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2016 Daniel Baston
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: operation/distance/FacetSequence.java (f6187ee2 JTS-1.14)
16 *
17 **********************************************************************/
18
19#pragma once
20
21#include <geos/geom/Envelope.h>
22#include <geos/geom/Coordinate.h>
23
24namespace geos {
25namespace geom {
26class CoordinateSequence;
27}
28}
29
30namespace geos {
31namespace operation {
32namespace distance {
33
34class FacetSequence {
35
36private:
37
38 const geom::CoordinateSequence* pts;
39 const std::size_t start;
40 const std::size_t end;
41
42 /*
43 * Unlike JTS, we store the envelope in the FacetSequence so
44 * that it has a clear owner. This is helpful when making a
45 * tree of FacetSequence objects (FacetSequenceTreeBuilder)
46 */
47 geom::Envelope env;
48
49 double computeDistanceLineLine(const FacetSequence& facetSeq,
50 std::vector<geom::Coordinate> *locs) const;
51
52 double computeDistancePointLine(const geom::Coordinate& pt,
53 const FacetSequence& facetSeq,
54 std::vector<geom::Coordinate> *locs) const;
55
56 void updateNearestLocationsPointLine(const geom::Coordinate& pt,
57 const geom::Coordinate& q0, const geom::Coordinate &q1,
58 std::vector<geom::Coordinate> *locs) const;
59
60 void updateNearestLocationsLineLine(const geom::Coordinate& p0, const geom::Coordinate& p1,
61 const geom::Coordinate& q0, const geom::Coordinate &q1,
62 std::vector<geom::Coordinate> *locs) const;
63
64 void computeEnvelope();
65
66public:
67
68 const geom::Envelope* getEnvelope() const;
69
70 const geom::Coordinate* getCoordinate(std::size_t index) const;
71
72 std::size_t size() const;
73
74 bool isPoint() const;
75
76 double distance(const FacetSequence& facetSeq) const;
77
78 FacetSequence(const geom::CoordinateSequence* pts, std::size_t start, std::size_t end);
79
87 std::vector<geom::Coordinate> nearestLocations(const FacetSequence& facetSeq) const;
88
89};
90
91}
92}
93}
94
Basic namespace for all GEOS functionalities.
Definition geos.h:38