updated the description and documentation of the example. p=marcjansen, r=me (closes #2869)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10973 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2010-12-17 10:02:05 +00:00
parent 697ee375b8
commit 24f233fb30
+35 -21
View File
@@ -1,7 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Simplify LineString</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Simplify a LineString geometry</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css"> <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css"> <link rel="stylesheet" href="style.css" type="text/css">
<style type="text/css"> <style type="text/css">
@@ -15,19 +16,23 @@
width: 300px; width: 300px;
float: left; float: left;
} }
#docs {
clear: both;
}
</style> </style>
</head> </head>
<body> <body>
<h1 id="title">Simplify a LineString</h1> <h1 id="title">Simplify a LineString geometry</h1>
<div id="tags"> <div id="tags">
Douglas-Peucker, Douglas, Peucker, Peuker, tolerance Douglas-Peucker, Douglas, Peucker, Peuker, tolerance
</div> </div>
<p id="shortdesc"> <p id="shortdesc">
Shows the usage of the utility method "simplifyLineString" that Shows the usage of the method &quot;simplify&quot; that implements
implements the Douglas-Peucker algorithm to remove "insignificant" the Douglas-Peucker algorithm to remove &quot;insignificant&quot;
vertices from LineString geometries. vertices from LineString geometries.
</p> </p>
<div id="control-simplify"> <div id="control-simplify">
<label for="tolerance">Tolerance factor:</label>
<input name="tolerance" id="tolerance" type="number" min="0" max="1" step="0.02" value="0.1"> <input name="tolerance" id="tolerance" type="number" min="0" max="1" step="0.02" value="0.1">
<input type="button" id="simplify" value="Simplify LineString"> <input type="button" id="simplify" value="Simplify LineString">
<input type="button" id="animation" value="Start animation"> <input type="button" id="animation" value="Start animation">
@@ -38,20 +43,21 @@
</div> </div>
<div id="info"> <div id="info">
</div> </div>
<div id="docs" style="clear: both;"> <div id="docs">
<p> <p>
The method OpenLayers.Util.simplifyLineString can be used to Instances of OpenLayers.Geometry.LineString have a method simplify,
simplify linestring geometries. Simplification sometimes is that can be used to simplify linestring geometries.
useful to enhance the perfomance of vector rendering or to Simplification sometimes is useful to enhance the perfomance of
reduce complexity of geometries. This might be especially handy vector rendering or to reduce complexity of geometries. This
when viewing geometries a small scales. might be especially handy when viewing geometries a small
scales.
</p> </p>
<p> <p>
OpenLayers.Util.simplifyLineString is a recursive implementation OpenLayers.Geometry.LineString::simplify is a recursive
of the famous Douglas-Peucker algorithm. It implementation of the famous Douglas-Peucker algorithm. It is
is controlled by a tolerance factor that defines the threshold controlled by a tolerance factor that defines the threshold for
for vertices to be considered "insignificant" for the general vertices to be considered &quot;insignificant&quot; for the
structure of the geometry. general structure of the geometry.
</p> </p>
<p> <p>
The LineString on the left map can be simplified according to The LineString on the left map can be simplified according to
@@ -61,10 +67,16 @@
it easier to spot the differeces between the LineStrings. it easier to spot the differeces between the LineStrings.
</p> </p>
<p> <p>
The LineString You can also use the button &quot;Start animation&quot; to get
represents a part of the coastline of results for increasing tolerance-factors from 0.02 to 1.0. The
<a href="http://www.openstreetmap.org/?lat=54.7309684753418&lon=83.1809234619141&zoom=11">this animation can be paused by clicking on the button &quot;Stop
place in Russia</a> &mdash; found via <a href="http://ryba4.com/python/ramer-douglas-peucker">an animation&quot;.
</p>
<p>
The LineString represents a part of the coastline of
<a href="http://www.openstreetmap.org/?lat=54.7309684753418&amp;lon=83.1809234619141&amp;zoom=11">this
place southeast of Novosibirsk in Russia</a> &mdash; found via
<a href="http://ryba4.com/python/ramer-douglas-peucker">an
example implementation of the algorithm in python</a>. example implementation of the algorithm in python</a>.
</p> </p>
<p> <p>
@@ -77,10 +89,12 @@
(<a href="http://dx.doi.org/10.3138/FM57-6770-U75U-7727">DOI: (<a href="http://dx.doi.org/10.3138/FM57-6770-U75U-7727">DOI:
10.3138/FM57-6770-U75U-7727</a>). 10.3138/FM57-6770-U75U-7727</a>).
</p> </p>
<p>See <a href="simplify-linestring.js">simplify-linestring.js</a>
for the source code of this example.</p>
</div> </div>
<script type="text/javascript" src="../lib/OpenLayers.js"> <script type="text/javascript" src="../lib/OpenLayers.js">
</script> </script>
<script type="text/javascript" src="simplify-linestring.js"> <script type="text/javascript" src="./simplify-linestring.js">
</script> </script>
</body> </body>
</html> </html>