GEOS 3.11.1
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/CoordinateSequence.h>
22#include <geos/geom/Envelope.h>
23#include <geos/geom/Coordinate.h>
24#include <geos/geom/LineSegment.h>
25#include <geos/operation/distance/GeometryLocation.h>
26
27namespace geos {
28namespace operation {
29namespace distance {
30class FacetSequence {
31private:
32 const geom::CoordinateSequence* pts;
33 const std::size_t start;
34 const std::size_t end;
35 const geom::Geometry* geom;
36 /*
37 * Unlike JTS, we store the envelope in the FacetSequence so
38 * that it has a clear owner. This is helpful when making a
39 * tree of FacetSequence objects (FacetSequenceTreeBuilder)
40 */
41 geom::Envelope env;
42
43 double computeDistanceLineLine(const FacetSequence& facetSeq,
44 std::vector<GeometryLocation> *locs) const;
45
46 double computeDistancePointLine(const geom::Coordinate& pt,
47 const FacetSequence& facetSeq,
48 std::vector<GeometryLocation> *locs) const;
49
50 void updateNearestLocationsPointLine(const geom::Coordinate& pt,
51 const FacetSequence& facetSeq, std::size_t i,
52 const geom::Coordinate& q0, const geom::Coordinate &q1,
53 std::vector<GeometryLocation> *locs) const;
54
55 void updateNearestLocationsLineLine(std::size_t i, const geom::Coordinate& p0, const geom::Coordinate& p1,
56 const FacetSequence& facetSeq,
57 std::size_t j, const geom::Coordinate& q0, const geom::Coordinate &q1,
58 std::vector<GeometryLocation> *locs) const;
59
60 void computeEnvelope();
61
62public:
63 const geom::Envelope* getEnvelope() const;
64
65 const geom::Coordinate* getCoordinate(std::size_t index) const;
66
67 std::size_t size() const;
68
69 bool isPoint() const;
70
71 double distance(const FacetSequence& facetSeq) const;
72
73 FacetSequence(const geom::CoordinateSequence* pts, std::size_t start, std::size_t end);
74
75 FacetSequence(const geom::Geometry* geom, const geom::CoordinateSequence* pts, std::size_t start, std::size_t end);
76
77 std::vector<GeometryLocation> nearestLocations(const FacetSequence& facetSeq) const;
78
79};
80
81}
82}
83}
84
Basic namespace for all GEOS functionalities.
Definition: geos.h:39