GEOS  3.6.2
FacetSequence.h
00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2016 Daniel Baston
00007  *
00008  * This is free software; you can redistribute and/or modify it under
00009  * the terms of the GNU Lesser General Public Licence as published
00010  * by the Free Software Foundation.
00011  * See the COPYING file for more information.
00012  *
00013  **********************************************************************
00014  *
00015  * Last port: operation/distance/FacetSequence.java (f6187ee2 JTS-1.14)
00016  *
00017  **********************************************************************/
00018 
00019 #ifndef GEOS_OPERATION_DISTANCE_FACETSEQUENCE_H
00020 #define GEOS_OPERATION_DISTANCE_FACETSEQUENCE_H
00021 
00022 #include <geos/geom/CoordinateSequence.h>
00023 #include <geos/geom/Envelope.h>
00024 #include <geos/geom/Coordinate.h>
00025 
00026 using namespace geos::geom;
00027 
00028 namespace geos {
00029     namespace operation {
00030         namespace distance {
00031             class FacetSequence {
00032             private:
00033                 const CoordinateSequence *pts;
00034                 const size_t start;
00035                 const size_t end;
00036 
00037                 /* Unlike JTS, we store the envelope in the FacetSequence so that it has a clear owner.  This is
00038                  * helpful when making a tree of FacetSequence objects (FacetSequenceTreeBuilder)
00039                  * */
00040                 Envelope env;
00041 
00042                 double computeLineLineDistance(const FacetSequence & facetSeq) const;
00043 
00044                 double computePointLineDistance(const Coordinate & pt, const FacetSequence & facetSeq) const;
00045 
00046                 void computeEnvelope();
00047 
00048             public:
00049                 const Envelope * getEnvelope() const;
00050 
00051                 const Coordinate * getCoordinate(size_t index) const;
00052 
00053                 size_t size() const;
00054 
00055                 bool isPoint() const;
00056 
00057                 double distance(const FacetSequence & facetSeq);
00058 
00059                 FacetSequence(const CoordinateSequence *pts, size_t start, size_t end);
00060             };
00061 
00062         }
00063     }
00064 }
00065 
00066 #endif //GEOS_OPERATION_DISTANCE_FACETSEQUENCE_H