2.0_beta sync to rsa
[framework/web/web-ui-fw.git] / libs / js / jquery-geo-1.0a4 / docs / geo / centroid.html
1 <!doctype html>  
2
3 <html lang="en" class="no-js">
4 <head>
5   <meta charset="utf-8">
6
7   <title>centroid | $.geo</title>
8   <meta name="description" content="jQuery Geo centroid method">
9   <meta name="author" content="Ryan Westphal">
10
11   <meta name="viewport" content="width=device-width, initial-scale=1.0">
12
13   <link rel="stylesheet" href="../css/style.css?v=2">
14   <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
15 </head>
16
17 <body>
18
19   <div id="centroid" data-role="page">
20     <div data-role="header" data-theme="b">
21       <h1>centroid</h1>
22     </div>
23     
24     <div data-role="content">
25       <table>
26         <tr>
27           <th>return type</th>
28           <td>Object ( <a href="http://geojson.org/geojson-spec.html#point" rel="external">GeoJSON Point</a> )</td>
29         </tr>
30         <tr>
31           <th>syntax</th>
32           <td>$.geo.centroid( Object shape ( <a href="http://geojson.org/geojson-spec.html" rel="external">GeoJSON object</a> ) )</td>
33         </tr>
34         <tr>
35           <th>usage</th>
36           <td><pre><code>var centroid = $.geo.centroid( {
37       type: &quot;Polygon&quot;,
38       coordinates: [[
39         [-75, 39.7],
40         [-74.8, 39.3],
41         [-75.2, 39.3],
42         [-75, 39.7]
43       ]]
44 } )</code></pre></td>
45         </tr>
46       </table>
47       <p>The centroid method calculates the <b>center of mass</b> for the passed-in basic GeoJSON geometry object. The basic geometry types are Point, LineString and Polygon.</p>
48       <p>Technically, only Polygons can be considered to have mass. However, a centroid can be calculated for other geometry types. This method operates on LineStrings as if they were closed polygons and the centroid will likely not lie along the line. The centroid of a Point is a clone of the Point.</p>
49       <!--<p>With GeometryCollections containing multiple geometry types, the centroid of the geometries of highest dimension will be returned. In other words, one Polygon will override any number of LineStrings in the collection and the centroid will simply be the centroid of that Polygon.</p>-->
50       <p>If the argument is not a basic GeoJSON geometry object, this function returns undefined.</p>
51       <p>This function is similar to Geometry.getCentroid in JTS.</p>
52      </div>
53   </div> <!-- end of #container -->
54
55   <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
56   <script src="http://code.jquerygeo.com/jquery.geo-1.0a4.min.js"></script>
57   <script src="../js/script.js"></script>
58   <script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
59 </body>
60 </html>
61