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