Complete Note#1 in the http://wiki.osgeo.org/wiki/GEOS_Provenance_Review to get out...
[geos.git] / include / geos / algorithm / InteriorPointLine.h
blob286e7874c56f2ced0fa9355ca5f6426233d46c8f
1 /**********************************************************************
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
6 * Copyright (C) 2005-2006 Refractions Research Inc.
7 * Copyright (C) 2001-2002 Vivid Solutions Inc.
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
14 **********************************************************************
16 * Last port: algorithm/InteriorPointLine.java r317 (JTS-1.12)
18 **********************************************************************/
20 #ifndef GEOS_ALGORITHM_INTERIORPOINTLINE_H
21 #define GEOS_ALGORITHM_INTERIORPOINTLINE_H
23 #include <geos/export.h>
24 #include <geos/geom/Coordinate.h>
26 // Forward declarations
27 namespace geos {
28 namespace geom {
29 class Geometry;
30 class CoordinateSequence;
35 namespace geos {
36 namespace algorithm { // geos::algorithm
38 /** \brief
39 * Computes a point in the interior of an linear geometry.
41 * <h2>Algorithm</h2>
43 * - Find an interior vertex which is closest to
44 * the centroid of the linestring.
45 * - If there is no interior vertex, find the endpoint which is
46 * closest to the centroid.
48 class GEOS_DLL InteriorPointLine {
49 public:
51 InteriorPointLine(const geom::Geometry *g);
53 ~InteriorPointLine();
55 //Coordinate* getInteriorPoint() const;
57 bool getInteriorPoint(geom::Coordinate& ret) const;
59 private:
61 bool hasInterior;
63 geom::Coordinate centroid;
65 double minDistance;
67 geom::Coordinate interiorPoint;
69 void addInterior(const geom::Geometry *geom);
71 void addInterior(const geom::CoordinateSequence *pts);
73 void addEndpoints(const geom::Geometry *geom);
75 void addEndpoints(const geom::CoordinateSequence *pts);
77 void add(const geom::Coordinate& point);
81 } // namespace geos::algorithm
82 } // namespace geos
84 #endif // GEOS_ALGORITHM_INTERIORPOINTLINE_H
86 /**********************************************************************
87 * $Log$
88 * Revision 1.1 2006/03/09 16:46:48 strk
89 * geos::geom namespace definition, first pass at headers split
91 **********************************************************************/