GEOS  3.7.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 
26 namespace geos {
27  namespace operation {
28  namespace distance {
29  class FacetSequence {
30  private:
31  const geom::CoordinateSequence *pts;
32  const size_t start;
33  const size_t end;
34 
35  /* Unlike JTS, we store the envelope in the FacetSequence so that it has a clear owner. This is
36  * helpful when making a tree of FacetSequence objects (FacetSequenceTreeBuilder)
37  * */
38  geom::Envelope env;
39 
40  double computeLineLineDistance(const FacetSequence & facetSeq) const;
41 
42  double computePointLineDistance(const geom::Coordinate & pt, const FacetSequence & facetSeq) const;
43 
44  void computeEnvelope();
45 
46  public:
47  const geom::Envelope * getEnvelope() const;
48 
49  const geom::Coordinate * getCoordinate(size_t index) const;
50 
51  size_t size() const;
52 
53  bool isPoint() const;
54 
55  double distance(const FacetSequence & facetSeq) const;
56 
57  FacetSequence(const geom::CoordinateSequence *pts, size_t start, size_t end);
58  };
59 
60  }
61  }
62 }
63 
64 #endif //GEOS_OPERATION_DISTANCE_FACETSEQUENCE_H
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25