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

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