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 #ifndef GEOS_ALGORITHM_INTERIORPOINTAREA_H
17 #define GEOS_ALGORITHM_INTERIORPOINTAREA_H
19 #include <geos/export.h>
20 #include <geos/geom/Coordinate.h>
22 // Forward declarations
27 class GeometryFactory
;
28 class GeometryCollection
;
34 namespace algorithm
{ // geos::algorithm
37 * Computes a point in the interior of an area geometry.
41 * <li>Find the intersections between the geometry
42 * and the horizontal bisector of the area's envelope
43 * <li>Pick the midpoint of the largest intersection (the intersections
44 * will be lines and points)
48 * Note: If a fixed precision model is used,
49 * in some cases this method may return a point
50 * which does not lie in the interior.
53 class GEOS_DLL InteriorPointArea
{
59 const geom::GeometryFactory
*factory
;
61 geom::Coordinate interiorPoint
;
65 void add(const geom::Geometry
*geom
);
67 const geom::Geometry
*widestGeometry(const geom::Geometry
*geometry
);
69 const geom::Geometry
*widestGeometry(const geom::GeometryCollection
*gc
);
71 geom::LineString
*horizontalBisector(const geom::Geometry
*geometry
);
75 InteriorPointArea(const geom::Geometry
*g
);
79 bool getInteriorPoint(geom::Coordinate
& ret
) const;
82 * Finds a reasonable point at which to label a Geometry.
84 * @param geometry the geometry to analyze
85 * @return the midpoint of the largest intersection between the geometry and
86 * a line halfway down its envelope
88 void addPolygon(const geom::Geometry
*geometry
);
92 } // namespace geos::algorithm
95 #endif // GEOS_ALGORITHM_INTERIORPOINTAREA_H
97 /**********************************************************************
99 * Revision 1.1 2006/03/09 16:46:48 strk
100 * geos::geom namespace definition, first pass at headers split
102 **********************************************************************/