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: precision/MinimumClearance.java (f6187ee2 JTS-1.14)
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_PRECISION_MINIMUMCLEARANCE_H
20 #define GEOS_PRECISION_MINIMUMCLEARANCE_H
21 
22 #include <geos/geom/Geometry.h>
23 #include <geos/geom/LineString.h>
24 #include <geos/geom/CoordinateSequence.h>
25 
26 namespace geos {
27 namespace precision {
28 
29 /// Computes the Minimum Clearance of a Geometry.
30 class GEOS_DLL MinimumClearance {
31 private:
32     const geom::Geometry* inputGeom;
33     double minClearance;
34     std::unique_ptr<geom::CoordinateSequence> minClearancePts;
35 
36     void compute();
37 public:
38     MinimumClearance(const geom::Geometry* g);
39 
40     /**
41      * Gets the Minimum Clearance distance.
42      *
43      * @return the value of the minimum clearance distance
44      * or <tt>DBL_MAX</tt> if no Minimum Clearance distance exists
45      */
46     double getDistance();
47 
48     /**
49      * Gets a LineString containing two points
50      * which are at the Minimum Clearance distance.
51      *
52      * @return the value of the minimum clearance distance
53      * or <tt>LINESTRING EMPTY</tt> if no Minimum Clearance distance exists
54      */
55     std::unique_ptr<geom::LineString> getLine();
56 };
57 }
58 }
59 
60 #endif
61 
62 
63