GEOS  3.9.1dev
FacetSequence.h
Go to the documentation of this file.
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 
23 #include <geos/geom/Envelope.h>
24 #include <geos/geom/Coordinate.h>
25 #include <geos/geom/LineSegment.h>
27 
28 namespace geos {
29 namespace operation {
30 namespace distance {
32 private:
34  const size_t start;
35  const size_t end;
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  */
43 
44  double computeDistanceLineLine(const FacetSequence& facetSeq,
45  std::vector<GeometryLocation> *locs) const;
46 
48  const FacetSequence& facetSeq,
49  std::vector<GeometryLocation> *locs) const;
50 
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 
63 public:
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
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
const geom::Coordinate * getCoordinate(size_t index) const
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
double distance(const FacetSequence &facetSeq) const
double computeDistancePointLine(const geom::Coordinate &pt, const FacetSequence &facetSeq, std::vector< GeometryLocation > *locs) const
void updateNearestLocationsPointLine(const geom::Coordinate &pt, const FacetSequence &facetSeq, size_t i, const geom::Coordinate &q0, const geom::Coordinate &q1, std::vector< GeometryLocation > *locs) const
void updateNearestLocationsLineLine(size_t i, const geom::Coordinate &p0, const geom::Coordinate &p1, const FacetSequence &facetSeq, size_t j, const geom::Coordinate &q0, const geom::Coordinate &q1, std::vector< GeometryLocation > *locs) const
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
Basic namespace for all GEOS functionalities.
FacetSequence(const geom::CoordinateSequence *pts, size_t start, size_t end)
const geom::Envelope * getEnvelope() const
The internal representation of a list of coordinates inside a Geometry.
std::vector< GeometryLocation > nearestLocations(const FacetSequence &facetSeq) const
double computeDistanceLineLine(const FacetSequence &facetSeq, std::vector< GeometryLocation > *locs) const
const geom::CoordinateSequence * pts
Definition: FacetSequence.h:33