source: trunk/docs/api/zoo-geometry-linearring.txt @ 870

Last change on this file since 870 was 348, checked in by neteler, 13 years ago

set correctly svn propset

  • Property svn:eol-style set to native
  • Property svn:keywords set to HeadURL Date Author Id Rev
  • Property svn:mime-type set to text/plain
File size: 6.6 KB
RevLine 
[348]1.. _api-zoo-geometry-linearring:
2
3ZOO.Geometry.LinearRing
4=======================
5
6A Linear Ring is a special LineString which is closed.  It closes itself automatically
7on every addPoint/removePoint by adding a copy of the first point as the last point.
8
9Also, as it is the first in the line family to close itself, a getArea() function is
10defined to calculate the enclosed area of the linearRing
11
12Inherits from
13
14- :ref:`ZOO.Geometry.LineString <api-zoo-geometry-linestring>`
15
16Properties     
17----------
18
19.. list-table::
20   :widths: 12 50
21   :header-rows: 1
22
23   * - NAME
24     - DESCRIPTION
25   * - :ref:`componentTypes <componentTypes>`
26     - {Array(String)} An array of class names representing the types of components that the collection can include.
27
28Functions       
29---------
30
31.. list-table::
32   :widths: 15 50
33   :header-rows: 1
34
35   * - NAME
36     - DESCRIPTION   
37   * - :ref:`ZOO.Geometry.LinearRing <ZOO.Geometry.LinearRing>`
38     - Linear rings are constructed with an array of points.
39   * - :ref:`addComponent <addComponent>`
40     - Adds a point to geometry components. 
41   * - :ref:`move <move>`
42     - Moves a geometry by the given displacement along positive x and y axes.
43   * - :ref:`rotate <rotate>`
44     - Rotate a geometry around some origin   
45   * - :ref:`resize <resize>`
46     - Resize a geometry relative to some origin.
47   * - :ref:`transform <transform>`
48     - Reproject the components geometry from source to dest.
49   * - :ref:`getCentroid <getCentroid>`
50     - {ZOO.Geometry.Point} The centroid of the ring
51   * - :ref:`getArea <getArea>`
52     -     
53   * - :ref:`getGeodesicArea <getGeodesicArea>`
54     - Calculate the approximate area of the polygon were it projected onto the earth.   
55   * - :ref:`containsPoint <containsPoint>`
56     - Test if a point is inside a linear ring.     
57     
58**Properties**
59       
60.. _componentTypes:
61
62componentTypes 
63  ``{Array(String)}`` An array of class names representing the types of components that the
64  collection can include.  A null value means the component types are not restricted. 
65 
66**Functions**
67
68.. _ZOO.Geometry.LinearRing:
69
70ZOO.Geometry.LinearRing
71  Linear rings are constructed with an array of points.  This array can represent a closed
72  or open ring.  If the ring is open (the last point does not equal the first point),
73  the constructor will close the ring.  If the ring is already closed (the last point does
74  equal the first point), it will be left closed.
75 
76  *Parameters*
77 
78  ``points`` {Array(:ref:`ZOO.Geometry.Point <api-zoo-geometry-point>`)} points 
79 
80.. _addComponent:   
81 
82addComponent   
83  ::
84 
85    addComponent: function(point,index)
86
87  Adds a point to geometry components.  If the point is to be added to the end of the
88  components array and it is the same as the last point already in that array, the
89  duplicate point is not added.  This has the effect of closing the ring if it is not
90  already closed, and doing the right thing if it is already closed.  This behavior can be
91  overridden by calling the method with a non-null index as the second argument.
92 
93  *Parameter*
94 
95  | ``point`` :ref:`{ZOO.Geometry.Point} <api-zoo-geometry-point>`
96  | ``index {Integer}`` Index into the array to insert the component
97
98  *Returns*
99
100  ``{Boolean}`` Was the Point successfully added? 
101 
102.. _move:     
103 
104move   
105  ::
106 
107    move: function(x,y)
108
109  Moves a geometry by the given displacement along positive x and y axes.  This
110  modifies the position of the geometry and clears the cached bounds.
111 
112  *Parameters*
113 
114  | ``x {Float}`` Distance to move geometry in positive x direction.
115  | ``y {Float}`` Distance to move geometry in positive y direction. 
116
117.. _rotate:       
118 
119rotate 
120  ::
121 
122    rotate: function(angle,origin)
123
124  Rotate a geometry around some origin
125
126  *Parameters*
127 
128  | ``angle {Float}`` Rotation angle in degrees (measured counterclockwise from the positive x-axis)
129  | ``origin`` :ref:`{ZOO.Geometry.Point} <api-zoo-geometry-point>` Center point for the rotation 
130
131.. _resize:         
132 
133resize 
134  ::
135 
136    resize: function(scale,origin,ratio)
137
138  Resize a geometry relative to some origin.  Use this method to apply a uniform scaling to a geometry.
139
140  *Parameters*
141 
142  | ``scale {Float}`` Factor by which to scale the geometry.  A scale of 2 doubles the size of the geometry in each dimension (lines, for example, will be twice as long, and polygons will have four times the area).
143  | ``origin`` :ref:`{ZOO.Geometry.Point} <api-zoo-geometry-point>` Point of origin for resizing
144  | ``ratio {Float}`` Optional x:y ratio for resizing.  Default ratio is 1.
145
146  *Returns*
147 
148  ``{ZOO.Geometry}`` The current geometry.
149 
150.. _transform:           
151 
152transform       
153  ::
154 
155    transform: function(source,dest)
156
157  Reproject the components geometry from source to dest.
158
159  *Parameters*
160 
161  | ``source`` :ref:`{ZOO.Projection} <api-zoo-projection>`
162  | ``dest`` :ref:`{ZOO.Projection} <api-zoo-projection>`
163
164  *Returns*
165
166  :ref:`{ZOO.Geometry} <api-zoo-geometry>`
167 
168.. _getCentroid:             
169 
170getCentroid     
171  ::
172 
173    getCentroid: function()
174
175  *Returns*
176
177  :ref:`{ZOO.Geometry.Point} <api-zoo-geometry-point>` The centroid of the ring 
178
179.. _getArea:               
180 
181getArea
182  ::
183 
184    getArea: function()
185
186  .. note:: The area is positive if the ring is oriented CW, otherwise it will be negative.
187
188  *Returns*
189
190  ``{Float}`` The signed area for a ring.
191
192.. _getGeodesicArea:               
193
194getGeodesicArea
195  ::
196 
197    getGeodesicArea: function(projection)
198
199  Calculate the approximate area of the polygon were it projected onto the earth.  Note that
200  this area will be positive if ring is oriented clockwise, otherwise it will be negative.
201
202  *Parameters*
203 
204  ``projection`` :ref:`{ZOO.Projection} <api-zoo-projection>` The spatial reference system for the geometry coordinates.  If not provided, Geographic/WGS84 is assumed.
205
206  *Reference*
207
208  Robert.  G. Chamberlain and William H.  Duquette, "Some Algorithms for Polygons on a Sphere",
209  JPL Publication 07-03, Jet Propulsion Laboratory, Pasadena, CA, June 2007 http://trs-new.jpl.nasa.gov/dspace/handle/2014/40409
210
211  *Returns*
212
213  ``{float}`` The approximate signed geodesic area of the polygon in square meters. 
214
215.. _containsPoint:                 
216 
217containsPoint   
218  ::
219 
220    containsPoint: function(point)
221
222  Test if a point is inside a linear ring.  For the case where a point is coincident with a
223  linear ring edge, returns 1.  Otherwise, returns boolean.
224
225  *Parameters*
226
227  ``point`` :ref:`{ZOO.Geometry.Point} <api-zoo-geometry-point>`
228
229  *Returns*
230
[197]231  ``{Boolean | Number}`` The point is inside the linear ring.  Returns 1 if the point is coincident with an edge.  Returns boolean otherwise.
Note: See TracBrowser for help on using the repository browser.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png