1 /**********************************************************************
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
7 * Copyright (C) 2006 Refractions Research Inc.
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
14 **********************************************************************
16 * Last port: simplify/TopologyPreservingSimplifier.java r536 (JTS-1.12+)
18 **********************************************************************
22 **********************************************************************/
24 #ifndef GEOS_SIMPLIFY_TOPOLOGYPRESERVINGSIMPLIFIER_H
25 #define GEOS_SIMPLIFY_TOPOLOGYPRESERVINGSIMPLIFIER_H
27 #include <geos/export.h>
28 #include <geos/geom/Geometry.h>
29 #include <geos/simplify/TaggedLinesSimplifier.h>
30 #include <memory> // for auto_ptr
35 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
39 namespace simplify
{ // geos::simplify
43 * Simplifies a geometry, ensuring that
44 * the result is a valid geometry having the
45 * same dimension and number of components as the input.
47 * The simplification uses a maximum distance difference algorithm
48 * similar to the one used in the Douglas-Peucker algorithm.
50 * In particular, if the input is an areal geometry
51 * ( Polygon or MultiPolygon )
53 * - The result has the same number of shells and holes (rings) as the input,
55 * - The result rings touch at <b>no more</b> than the number of touching point in the input
56 * (although they may touch at fewer points)
59 class GEOS_DLL TopologyPreservingSimplifier
64 static std::auto_ptr
<geom::Geometry
> simplify(
65 const geom::Geometry
* geom
,
68 TopologyPreservingSimplifier(const geom::Geometry
* geom
);
71 * Sets the distance tolerance for the simplification.
73 * All vertices in the simplified geometry will be within this
74 * distance of the original geometry.
75 * The tolerance value must be non-negative. A tolerance value
76 * of zero is effectively a no-op.
78 * @param distanceTolerance the approximation tolerance to use
80 void setDistanceTolerance(double tolerance
);
82 std::auto_ptr
<geom::Geometry
> getResultGeometry();
86 const geom::Geometry
* inputGeom
;
88 std::auto_ptr
<TaggedLinesSimplifier
> lineSimplifier
;
92 } // namespace geos::simplify
99 #endif // GEOS_SIMPLIFY_TOPOLOGYPRESERVINGSIMPLIFIER_H
101 /**********************************************************************
103 * Revision 1.3 2006/04/13 16:04:10 strk
104 * Made TopologyPreservingSimplifier implementation successfully build
106 * Revision 1.2 2006/04/13 14:25:17 strk
107 * TopologyPreservingSimplifier initial port
109 **********************************************************************/