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