Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mdartic committed Sep 8, 2016
1 parent 05c1191 commit 6eec33e
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 37 deletions.
36 changes: 18 additions & 18 deletions docs/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line566">line 566</a>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line581">line 581</a>
</li></ul></dd>


Expand Down Expand Up @@ -994,7 +994,7 @@ <h5>Returns:</h5>


<div class="param-desc">
<p>Closest geographical point</p>
<p>Closest geographical point or null if layer param is incorrect</p>
</div>


Expand Down Expand Up @@ -1166,7 +1166,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line218">line 218</a>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line224">line 224</a>
</li></ul></dd>


Expand Down Expand Up @@ -1495,7 +1495,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line295">line 295</a>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line310">line 310</a>
</li></ul></dd>


Expand Down Expand Up @@ -1907,7 +1907,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line524">line 524</a>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line539">line 539</a>
</li></ul></dd>


Expand Down Expand Up @@ -2083,7 +2083,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line534">line 534</a>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line549">line 549</a>
</li></ul></dd>


Expand Down Expand Up @@ -2283,7 +2283,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line590">line 590</a>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line605">line 605</a>
</li></ul></dd>


Expand Down Expand Up @@ -2936,7 +2936,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line450">line 450</a>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line465">line 465</a>
</li></ul></dd>


Expand Down Expand Up @@ -3138,7 +3138,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line336">line 336</a>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line351">line 351</a>
</li></ul></dd>


Expand Down Expand Up @@ -3338,7 +3338,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line321">line 321</a>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line336">line 336</a>
</li></ul></dd>


Expand Down Expand Up @@ -3514,7 +3514,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line497">line 497</a>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line512">line 512</a>
</li></ul></dd>


Expand Down Expand Up @@ -3686,7 +3686,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line484">line 484</a>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line499">line 499</a>
</li></ul></dd>


Expand Down Expand Up @@ -3962,7 +3962,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line251">line 251</a>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line266">line 266</a>
</li></ul></dd>


Expand Down Expand Up @@ -4329,7 +4329,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line404">line 404</a>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line419">line 419</a>
</li></ul></dd>


Expand Down Expand Up @@ -4658,7 +4658,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line437">line 437</a>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line452">line 452</a>
</li></ul></dd>


Expand Down Expand Up @@ -4857,7 +4857,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line547">line 547</a>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line562">line 562</a>
</li></ul></dd>


Expand Down Expand Up @@ -5033,7 +5033,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line510">line 510</a>
<a href="leaflet.geometryutil.js.html">leaflet.geometryutil.js</a>, <a href="leaflet.geometryutil.js.html#line525">line 525</a>
</li></ul></dd>


Expand Down Expand Up @@ -5095,7 +5095,7 @@ <h5>Returns:</h5>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Sep 07 2016 16:35:52 GMT+0200 (CEST) using the Minami theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Sep 08 2016 12:06:58 GMT+0200 (CEST) using the Minami theme.
</footer>

<script>prettyPrint();</script>
Expand Down
6 changes: 5 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ <h2>Development</h2><h3>Running tests in command-line</h3><ul>
<pre class="prettyprint source"><code> npm test</code></pre><h2>Changelog</h2><h3>master</h3><ul>
<li>Nothing changed yet.</li>
</ul>
<h3>0.5.1</h3><ul>
<li>Fix closestLayer to be able to work with GeoJSON nested layers</li>
<li>Restrict closest method to Array and L.Polyline (L.Polygon extend L.Polyline)</li>
</ul>
<h3>0.5.0</h3><ul>
<li>Add function <code>layersWithin()</code> (#34, thanks @haoliangyu)</li>
<li>Fix safety check on the ratio value in <code>`interpolateOnLine()</code> (#29, thanks @Marcussacapuces91)</li>
Expand Down Expand Up @@ -219,7 +223,7 @@ <h2>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Sep 07 2016 16:35:52 GMT+0200 (CEST) using the Minami theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Sep 08 2016 12:06:58 GMT+0200 (CEST) using the Minami theme.
</footer>

<script>prettyPrint();</script>
Expand Down
47 changes: 31 additions & 16 deletions docs/leaflet.geometryutil.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,18 @@ <h1 class="page-title">leaflet.geometryutil.js</h1>
@param {Array&lt;L.LatLng>|L.PolyLine|L.Polygon} layer - Layer that contains the result
@param {L.LatLng} latlng - The position to search
@param {?boolean} [vertices=false] - Whether to restrict to path vertices.
@returns {L.LatLng} Closest geographical point
@returns {L.LatLng} Closest geographical point or null if layer param is incorrect
*/
closest: function (map, layer, latlng, vertices) {
if (typeof layer.getLatLngs != 'function')

if (layer instanceof Array)
layer = L.polyline(layer);


// if we don't have here a Polyline, that means layer is incorrect
// see https://github.com/makinacorpus/Leaflet.GeometryUtil/issues/23
if (! ( layer instanceof L.Polyline ) )
return null;

var latlngs = layer.getLatLngs().slice(0),
mindist = Infinity,
result = null,
Expand Down Expand Up @@ -263,18 +269,27 @@ <h1 class="page-title">leaflet.geometryutil.js</h1>

for (var i = 0, n = layers.length; i &lt; n; i++) {
var layer = layers[i];
// Single dimension, snap on points, else snap on closest
if (typeof layer.getLatLng == 'function') {
ll = layer.getLatLng();
distance = L.GeometryUtil.distance(map, latlng, ll);
}
else {
ll = L.GeometryUtil.closest(map, layer, latlng);
if (ll) distance = ll.distance; // Can return null if layer has no points.
}
if (distance &lt; mindist) {
mindist = distance;
result = {layer: layer, latlng: ll, distance: distance};
if (layer instanceof L.LayerGroup) {
// recursive
var subResult = L.GeometryUtil.closestLayer(map, layer.getLayers(), latlng);
if (subResult.distance &lt; mindist) {
mindist = subResult.distance;
result = subResult;
}
} else {
// Single dimension, snap on points, else snap on closest
if (typeof layer.getLatLng == 'function') {
ll = layer.getLatLng();
distance = L.GeometryUtil.distance(map, latlng, ll);
}
else {
ll = L.GeometryUtil.closest(map, layer, latlng);
if (ll) distance = ll.distance; // Can return null if layer has no points.
}
if (distance &lt; mindist) {
mindist = distance;
result = {layer: layer, latlng: ll, distance: distance};
}
}
}
return result;
Expand Down Expand Up @@ -664,7 +679,7 @@ <h1 class="page-title">leaflet.geometryutil.js</h1>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Sep 07 2016 16:35:52 GMT+0200 (CEST) using the Minami theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Sep 08 2016 12:06:58 GMT+0200 (CEST) using the Minami theme.
</footer>

<script>prettyPrint();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial-closest.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h2>closest</h2>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Sep 07 2016 16:35:52 GMT+0200 (CEST) using the Minami theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Sep 08 2016 12:06:58 GMT+0200 (CEST) using the Minami theme.
</footer>

<script>prettyPrint();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial-distance-length.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ <h2>distance-length</h2>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Sep 07 2016 16:35:52 GMT+0200 (CEST) using the Minami theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Sep 08 2016 12:06:58 GMT+0200 (CEST) using the Minami theme.
</footer>

<script>prettyPrint();</script>
Expand Down

0 comments on commit 6eec33e

Please sign in to comment.