Skip to content

Commit

Permalink
docstrings: Correct polygon & polyline examples (#5161)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonoverland authored and IvanSanchez committed Dec 7, 2016
1 parent 240918d commit b1c2e99
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 45 deletions.
30 changes: 15 additions & 15 deletions docs/reference-1.0.0.html
Expand Up @@ -7031,9 +7031,9 @@ <h3 id='polyline-example'>Usage example</h3>

<pre><code class="lang-js">// create a red polyline from an array of LatLng points
var latlngs = [
[-122.68, 45.51],
[-122.43, 37.77],
[-118.2, 34.04]
[45.51, -122.68],
[37.77, -122.43],
[34.04, -118.2]
];
var polyline = L.polyline(latlngs, {color: &#39;red&#39;}).addTo(map);
// zoom the map to the polyline
Expand All @@ -7042,12 +7042,12 @@ <h3 id='polyline-example'>Usage example</h3>
<p>You can also pass a multi-dimensional array to represent a <code>MultiPolyline</code> shape:</p>
<pre><code class="lang-js">// create a red polyline from an array of arrays of LatLng points
var latlngs = [
[[-122.68, 45.51],
[-122.43, 37.77],
[-118.2, 34.04]],
[[-73.91, 40.78],
[-87.62, 41.83],
[-96.72, 32.76]]
[[45.51, -122.68],
[37.77, -122.43],
[34.04, -118.2]],
[[40.78, -73.91],
[41.83, -87.62],
[32.76, -96.72]]
];
</code></pre>

Expand Down Expand Up @@ -7860,25 +7860,25 @@ <h3 id='polygon-example'>Usage example</h3>


<pre><code class="lang-js">// create a red polygon from an array of LatLng points
var latlngs = [[-111.03, 41],[-111.04, 45],[-104.05, 45],[-104.05, 41]];
var latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]];
var polygon = L.polygon(latlngs, {color: &#39;red&#39;}).addTo(map);
// zoom the map to the polygon
map.fitBounds(polygon.getBounds());
</code></pre>
<p>You can also pass an array of arrays of latlngs, with the first array representing the outer shape and the other arrays representing holes in the outer shape:</p>
<pre><code class="lang-js">var latlngs = [
[[-111.03, 41],[-111.04, 45],[-104.05, 45],[-104.05, 41]], // outer ring
[[-108.58,37.29],[-108.58,40.71],[-102.50,40.71],[-102.50,37.29]] // hole
[[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
[[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
];
</code></pre>
<p>Additionally, you can pass a multi-dimensional array to represent a MultiPolygon shape.</p>
<pre><code class="lang-js">var latlngs = [
[ // first polygon
[[-111.03, 41],[-111.04, 45],[-104.05, 45],[-104.05, 41]], // outer ring
[[-108.58,37.29],[-108.58,40.71],[-102.50,40.71],[-102.50,37.29]] // hole
[[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
[[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
],
[ // second polygon
[[-109.05, 37],[-109.03, 41],[-102.05, 41],[-102.04, 37],[-109.05, 38]]
[[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]]
]
];
</code></pre>
Expand Down
30 changes: 15 additions & 15 deletions docs/reference-1.0.2.html
Expand Up @@ -7217,9 +7217,9 @@ <h3 id='polyline-example'>Usage example</h3>

<pre><code class="lang-js">// create a red polyline from an array of LatLng points
var latlngs = [
[-122.68, 45.51],
[-122.43, 37.77],
[-118.2, 34.04]
[45.51, -122.68],
[37.77, -122.43],
[34.04, -118.2]
];
var polyline = L.polyline(latlngs, {color: &#39;red&#39;}).addTo(map);
// zoom the map to the polyline
Expand All @@ -7228,12 +7228,12 @@ <h3 id='polyline-example'>Usage example</h3>
<p>You can also pass a multi-dimensional array to represent a <code>MultiPolyline</code> shape:</p>
<pre><code class="lang-js">// create a red polyline from an array of arrays of LatLng points
var latlngs = [
[[-122.68, 45.51],
[-122.43, 37.77],
[-118.2, 34.04]],
[[-73.91, 40.78],
[-87.62, 41.83],
[-96.72, 32.76]]
[[45.51, -122.68],
[37.77, -122.43],
[34.04, -118.2]],
[[40.78, -73.91],
[41.83, -87.62],
[32.76, -96.72]]
];
</code></pre>

Expand Down Expand Up @@ -8058,25 +8058,25 @@ <h3 id='polygon-example'>Usage example</h3>


<pre><code class="lang-js">// create a red polygon from an array of LatLng points
var latlngs = [[-111.03, 41],[-111.04, 45],[-104.05, 45],[-104.05, 41]];
var latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]];
var polygon = L.polygon(latlngs, {color: &#39;red&#39;}).addTo(map);
// zoom the map to the polygon
map.fitBounds(polygon.getBounds());
</code></pre>
<p>You can also pass an array of arrays of latlngs, with the first array representing the outer shape and the other arrays representing holes in the outer shape:</p>
<pre><code class="lang-js">var latlngs = [
[[-111.03, 41],[-111.04, 45],[-104.05, 45],[-104.05, 41]], // outer ring
[[-108.58,37.29],[-108.58,40.71],[-102.50,40.71],[-102.50,37.29]] // hole
[[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
[[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
];
</code></pre>
<p>Additionally, you can pass a multi-dimensional array to represent a MultiPolygon shape.</p>
<pre><code class="lang-js">var latlngs = [
[ // first polygon
[[-111.03, 41],[-111.04, 45],[-104.05, 45],[-104.05, 41]], // outer ring
[[-108.58,37.29],[-108.58,40.71],[-102.50,40.71],[-102.50,37.29]] // hole
[[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
[[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
],
[ // second polygon
[[-109.05, 37],[-109.03, 41],[-102.05, 41],[-102.04, 37],[-109.05, 38]]
[[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]]
]
];
</code></pre>
Expand Down
12 changes: 6 additions & 6 deletions src/layer/vector/Polygon.js
Expand Up @@ -12,7 +12,7 @@
*
* ```js
* // create a red polygon from an array of LatLng points
* var latlngs = [[-111.03, 41],[-111.04, 45],[-104.05, 45],[-104.05, 41]];
* var latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]];
*
* var polygon = L.polygon(latlngs, {color: 'red'}).addTo(map);
*
Expand All @@ -24,8 +24,8 @@
*
* ```js
* var latlngs = [
* [[-111.03, 41],[-111.04, 45],[-104.05, 45],[-104.05, 41]], // outer ring
* [[-108.58,37.29],[-108.58,40.71],[-102.50,40.71],[-102.50,37.29]] // hole
* [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
* [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
* ];
* ```
*
Expand All @@ -34,11 +34,11 @@
* ```js
* var latlngs = [
* [ // first polygon
* [[-111.03, 41],[-111.04, 45],[-104.05, 45],[-104.05, 41]], // outer ring
* [[-108.58,37.29],[-108.58,40.71],[-102.50,40.71],[-102.50,37.29]] // hole
* [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
* [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
* ],
* [ // second polygon
* [[-109.05, 37],[-109.03, 41],[-102.05, 41],[-102.04, 37],[-109.05, 38]]
* [[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]]
* ]
* ];
* ```
Expand Down
18 changes: 9 additions & 9 deletions src/layer/vector/Polyline.js
Expand Up @@ -10,9 +10,9 @@
* ```js
* // create a red polyline from an array of LatLng points
* var latlngs = [
* [-122.68, 45.51],
* [-122.43, 37.77],
* [-118.2, 34.04]
* [45.51, -122.68],
* [37.77, -122.43],
* [34.04, -118.2]
* ];
*
* var polyline = L.polyline(latlngs, {color: 'red'}).addTo(map);
Expand All @@ -26,12 +26,12 @@
* ```js
* // create a red polyline from an array of arrays of LatLng points
* var latlngs = [
* [[-122.68, 45.51],
* [-122.43, 37.77],
* [-118.2, 34.04]],
* [[-73.91, 40.78],
* [-87.62, 41.83],
* [-96.72, 32.76]]
* [[45.51, -122.68],
* [37.77, -122.43],
* [34.04, -118.2]],
* [[40.78, -73.91],
* [41.83, -87.62],
* [32.76, -96.72]]
* ];
* ```
*/
Expand Down

0 comments on commit b1c2e99

Please sign in to comment.