source: trunk/docs/api/zoo-geometry-collection.txt @ 190

Last change on this file since 190 was 190, checked in by jmckenna, 13 years ago

add ZOO.Geometry.Collection doc

File size: 8.7 KB
Line 
1.. _api-zoo-geometry-collection:
2
3ZOO.Geometry.Collection
4=======================
5
6A Collection is exactly what it sounds like: A collection of different Geometries.
7
8Properties     
9----------
10
11.. list-table::
12   :widths: 12 50
13   :header-rows: 1
14
15   * - NAME
16     - DESCRIPTION
17   * - :ref:`components <components>`
18     - {Array(ZOO.Geometry)} The component parts of this geometry
19   * - :ref:`componentTypes <componentTypes>`
20     - {Array(String)} An array of class names representing the types of components that the collection can include.
21
22Functions       
23---------
24
25.. list-table::
26   :widths: 15 50
27   :header-rows: 1
28
29   * - NAME
30     - DESCRIPTION
31   * - :ref:`ZOO.Geometry.Collection <ZOO.Geometry.Collection>`
32     - Creates a Geometry Collection -- a list of geoms.
33   * - :ref:`destroy <destroy>`
34     - Destroy this geometry.
35   * - :ref:`clone <clone>`
36     - Clone this geometry.
37   * - :ref:`getComponentsString <getComponentsString>`
38     - Get a string representing the components for this collection.
39   * - :ref:`calculateBounds <calculateBounds>`
40     - Recalculate the bounds by iterating through the components and calling extendBounds() on each item.
41   * - :ref:`addComponent <addComponent>`
42     - Add a new component (geometry) to the collection.
43   * - :ref:`removeComponents <removeComponents>`
44     - Remove components from this geometry.
45   * - :ref:`removeComponent <removeComponent>`
46     - Remove a component from this geometry.
47   * - :ref:`getLength <getLength>`
48     - Calculate the length of this geometry.
49   * - :ref:`getCentroid <getCentroid>`
50     - {ZOO.Geometry.Point} The centroid of the collection.
51   * - :ref:`getGeodesicLength <getGeodesicLength>`
52     - Calculate the approximate length of the geometry were it projected onto the earth.
53   * - :ref:`move <move>`
54     - Moves a geometry by the given displacement along positive x and y axes.
55   * - :ref:`rotate <rotate>`
56     - Rotate a geometry around some origin.
57   * - :ref:`resize <resize>`
58     - Resize a geometry relative to some origin.
59   * - :ref:`equals <equals>`
60     - Determine whether another geometry is equivalent to this one.
61   * - :ref:`transform <transform>`
62     - Reproject the components geometry from source to dest.
63   * - :ref:`intersects <intersects>`
64     - Determine if the input geometry intersects this one.
65   * - :ref:`getVertices <getVertices>`
66     - Return a list of all points in this geometry.     
67   
68     
69**Properties**
70       
71.. _components:
72
73components     
74  {Array(:ref:`ZOO.Geometry <api-zoo-geometry>`)} The component parts of this geometry
75 
76.. _componentTypes:   
77 
78componentTypes 
79  ``{Array(String)}`` An array of class names representing the types of components that the collection can include.
80  A null value means the component types are not restricted.
81
82**Functions**
83       
84.. _ZOO.Geometry.Collection:
85
86ZOO.Geometry.Collection
87  Creates a Geometry Collection -- a list of geoms.
88
89  *Parameters*
90 
91  ``components`` {Array(:ref:`ZOO.Geometry <api-zoo-geometry>`)} Optional array of geometries
92 
93.. _destroy:
94 
95destroy
96  ::
97 
98    destroy: function ()
99
100Destroy this geometry.
101
102.. _clone:   
103 
104clone   
105  ::
106 
107    clone: function()
108
109  Clone this geometry.
110 
111  *Returns*
112
113  :ref:`{ZOO.Geometry.Collection} <api-zoo-geometry-collection>` An exact clone of this collection.
114 
115.. _getComponentsString:     
116 
117getComponentsString     
118  ::
119 
120    getComponentsString: function()
121
122  Get a string representing the components for this collection.
123 
124  *Returns*
125
126  ``{String}`` A string representation of the components of this geometry.
127 
128.. _calculateBounds: 
129 
130calculateBounds
131  ::
132 
133    calculateBounds: function()
134
135  Recalculate the bounds by iterating through the components and calling extendBounds() on each item.
136 
137.. _addComponent:   
138 
139addComponent   
140  ::
141 
142    addComponent: function(component,index)
143
144  Add a new component (geometry) to the collection.  If this.componentTypes is set, then the
145  component class name must be in the componentTypes array.  The bounds cache is reset.
146 
147  *Parameters*
148 
149  | ``component`` :ref:`{ZOO.Geometry} <api-zoo-geometry>` A geometry to add
150  | ``index {int}`` Optional index into the array to insert the component
151 
152  *Returns*
153
154  ``{Boolean}`` The component geometry was successfully added
155 
156.. _removeComponents:     
157 
158removeComponents       
159  ::
160 
161    removeComponents: function(components)
162
163  Remove components from this geometry.\
164 
165  *Parameters*
166 
167  ``components`` {Array(:ref:`ZOO.Geometry <api-zoo-geometry>`)} The components to be removed 
168 
169.. _removeComponent: 
170 
171removeComponent
172  ::
173 
174    removeComponent: function(component)
175
176  Remove a component from this geometry.
177 
178  *Parameters*
179 
180  ``component`` :ref:`{ZOO.Geometry} <api-zoo-geometry>`
181 
182.. _getLength:   
183 
184getLength       
185  ::
186 
187    getLength: function()
188
189  Calculate the length of this geometry
190 
191  *Returns*
192
193  ``{Float}`` The length of the geometry 
194 
195.. _getCentroid:     
196 
197getCentroid     
198  ::
199 
200    getCentroid: function()
201
202  *Returns*
203
204  :ref:`{ZOO.Geometry.Point} <api-zoo-geometry-point>` The centroid of the collection
205 
206.. _getGeodesicLength:       
207 
208getGeodesicLength       
209  ::
210 
211    getGeodesicLength: function(projection)
212
213  Calculate the approximate length of the geometry were it projected onto the earth.
214
215  *Parameters*
216 
217  ``projection`` :ref:`{ZOO.Projection} <api-zoo-projection>` The spatial
218  reference system for the geometry coordinates.  If not provided, Geographic/WGS84 is assumed.
219 
220  *Returns*
221
222  ``{Float}`` The appoximate geodesic length of the geometry in meters.
223 
224.. _move:         
225 
226move   
227  ::
228 
229    move: function(x,y)
230
231  Moves a geometry by the given displacement along positive x and y axes.  This modifies the
232  position of the geometry and clears the cached bounds.
233 
234  *Parameters*
235 
236  | ``x {Float}`` Distance to move geometry in positive x direction.
237  | ``y {Float}`` Distance to move geometry in positive y direction. 
238 
239.. _rotate:           
240 
241rotate 
242  ::
243 
244    rotate: function(angle,origin)
245
246  Rotate a geometry around some origin
247 
248  *Parameters*
249 
250  | ``angle {Float}`` Rotation angle in degrees (measured counterclockwise from the positive x-axis)
251  | ``origin`` :ref:`{ZOO.Geometry.Point} <api-zoo-geometry-point>` Center point for the rotation
252 
253.. _resize:             
254 
255resize 
256  ::
257 
258    resize: function(scale,origin,ratio)
259
260  Resize a geometry relative to some origin.  Use this method to apply a uniform scaling to a geometry.
261
262  *Parameters*
263 
264  | ``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).
265  | ``origin`` :ref:`{ZOO.Geometry.Point} <api-zoo-geometry-point>` Point of origin for resizing
266  | ``ratio {Float}`` Optional x:y ratio for resizing.  Default ratio is 1.
267
268  *Returns*
269 
270  :ref:`{ZOO.Geometry} <api-zoo-geometry>`  The current geometry. 
271
272.. _equals:               
273 
274equals 
275  ::
276 
277    equals: function(geometry)
278
279  Determine whether another geometry is equivalent to this one.  Geometries are considered equivalent if
280  all components have the same coordinates.
281 
282  *Parameters*
283 
284  ``geom`` :ref:`{ZOO.Geometry} <api-zoo-geometry>` The geometry to test.
285
286  *Returns*
287
288  ``{Boolean}`` The supplied geometry is equivalent to this geometry.
289 
290.. _transform:                 
291 
292transform       
293  ::
294 
295    transform: function(source,dest)
296
297  Reproject the components geometry from source to dest.
298
299  *Parameters*
300 
301  | ``source`` :ref:`{ZOO.Projection} <api-zoo-projection>`
302  | ``dest`` :ref:`{ZOO.Projection} <api-zoo-projection>`
303 
304  *Returns*
305
306  :ref:`{ZOO.Geometry} <api-zoo-geometry>`
307 
308.. _intersects:                   
309 
310intersects     
311  ::
312 
313    intersects: function(geometry)
314
315  Determine if the input geometry intersects this one.
316
317  *Parameters*
318 
319  ``geometry`` :ref:`{ZOO.Geometry} <api-zoo-geometry>` Any type of geometry.
320
321  *Returns*
322
323  ``{Boolean}`` The input geometry intersects this one.
324 
325.. _getVertices:                     
326 
327getVertices     
328  ::
329 
330    getVertices: function(nodes)
331
332  Return a list of all points in this geometry.
333 
334  *Parameters*
335 
336  ``nodes {Boolean}`` For lines, only return vertices that are endpoints.  If false, for lines,
337  only vertices that are not endpoints will be returned.  If not provided, all vertices will be returned.
338
339  *Returns*
340
341  ``{Array}`` A list of all vertices in the geometry.
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