source: branches/PublicaMundi_David_integration_01-devel/docs/api/zoo-geometry-linestring.txt @ 726

Last change on this file since 726 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.9 KB
Line 
1.. _api-zoo-geometry-linestring:
2
3ZOO.Geometry.LineString
4=======================
5
6A LineString is a Curve which, once two points have been added to it, can never be less than two points long.
7
8Inherits from
9
10- :ref:`ZOO.Geometry.Curve <api-zoo-geometry-curve>`
11
12Functions       
13---------
14
15.. list-table::
16   :widths: 15 50
17   :header-rows: 1
18
19   * - NAME
20     - DESCRIPTION   
21   * - :ref:`ZOO.Geometry.LineString <ZOO.Geometry.LineString>`
22     - Create a new LineString geometry
23   * - :ref:`removeComponent <removeComponent>`
24     - Only allows removal of a point if there are three or more points in the linestring. 
25   * - :ref:`intersects <intersects>`
26     - Test for instersection between two geometries.
27   * - :ref:`getSortedSegments <getSortedSegments>`
28     - {Array} An array of segment objects. 
29   * - :ref:`splitWithSegment <splitWithSegment>`
30     - Split this geometry with the given segment.
31   * - :ref:`split <split>`
32     - Use this geometry (the source) to attempt to split a target geometry.
33   * - :ref:`splitWith <splitWith>`
34     - Split this geometry (the target) with the given geometry (the source).
35   * - :ref:`getVertices <getVertices>`
36     - Return a list of all points in this geometry.       
37     
38.. _ZOO.Geometry.LineString:
39
40ZOO.Geometry.LineString
41  Create a new LineString geometry
42
43  *Parameters*
44 
45  ``points`` {Array(:ref:`ZOO.Geometry.Point <api-zoo-geometry-point>`)} An array of points used to generate the linestring 
46
47.. _removeComponent: 
48 
49removeComponent
50  ::
51 
52    removeComponent: function(point)
53
54  Only allows removal of a point if there are three or more points in the linestring. (otherwise
55  the result would be just a single point)
56
57  *Parameters*
58 
59  ``point`` :ref:`{ZOO.Geometry.Point} <api-zoo-geometry-point>` The point to be removed 
60 
61.. _intersects: 
62 
63intersects     
64  ::
65 
66    intersects: function(geometry)
67
68  Test for instersection between two geometries.  This is a cheapo implementation of the
69  Bently-Ottmann algorigithm.  It doesn't really keep track of a sweep line data structure. 
70  It is closer to the brute force method, except that segments are sorted and potential intersections
71  are only calculated when bounding boxes intersect.
72 
73  *Parameters*
74 
75  ``geometry`` :ref:`{ZOO.Geometry} <api-zoo-geometry>`
76 
77  *Returns*
78
79  ``{Boolean}`` The input geometry intersects this geometry. 
80 
81.. _getSortedSegments:   
82 
83getSortedSegments       
84  ::
85 
86    getSortedSegments: function()
87
88  *Returns*
89
90  ``{Array}`` An array of segment objects.  Segment objects have properties x1, y1, x2, and y2. 
91  The start point is represented by x1 and y1.  The end point is represented by x2 and y2. 
92  Start and end are ordered so that x1 < x2. 
93 
94.. _splitWithSegment:     
95 
96splitWithSegment       
97  ::
98 
99    splitWithSegment: function(seg,options)
100
101  Split this geometry with the given segment.
102 
103  *Parameters*
104 
105  | ``seg {Object}`` An object with x1, y1, x2, and y2 properties referencing segment endpoint coordinates.
106  | ``options {Object}`` Properties of this object will be used to determine how the split is conducted.
107
108  *Valid options*
109 
110  | ``edge {Boolean}`` Allow splitting when only edges intersect.  Default is true.  If false, a vertex on the source segment must be within the tolerance distance of the intersection to be considered a split.
111  | ``tolerance {Number}`` If a non-null value is provided, intersections within the tolerance distance of one of the source segment's endpoints will be assumed to occur at the endpoint.
112
113  *Returns*
114
115  ``{Object}`` An object with lines and points properties.  If the given segment intersects this linestring, the lines array will reference geometries that result from the split.  The points array will contain all intersection points.  Intersection points are sorted along the segment (in order from x1,y1 to x2,y2). 
116
117.. _split:       
118 
119split   
120  ::
121 
122    split: function(target,options)
123
124  Use this geometry (the source) to attempt to split a target geometry.
125 
126  *Parameters*
127 
128  | ``target`` :ref:`{ZOO.Geometry} <api-zoo-geometry>` The target geometry.
129  | ``options {Object}`` Properties of this object will be used to determine how the split is conducted.
130
131  *Valid options*
132 
133  | ``mutual {Boolean}`` Split the source geometry in addition to the target geometry.  Default is false.
134  | ``edge {Boolean}`` Allow splitting when only edges intersect.  Default is true.  If false, a vertex on the source must be within the tolerance distance of the intersection to be considered a split.
135  | ``tolerance {Number}`` If a non-null value is provided, intersections within the tolerance distance of an existing vertex on the source will be assumed to occur at the vertex.
136
137  *Returns*
138
139  ``{Array}`` A list of geometries (of this same type as the target) that result from splitting the target with the source geometry.  The source and target geometry will remain unmodified.  If no split results, null will be returned.  If mutual is true and a split results, return will be an array of two arrays - the first will be all geometries that result from splitting the source geometry and the second will be all geometries that result from splitting the target geometry. 
140
141.. _splitWith:         
142 
143splitWith       
144  ::
145 
146    splitWith: function(geometry,options)
147
148  Split this geometry (the target) with the given geometry (the source).
149 
150  *Parameters*
151 
152  | ``geometry`` :ref:`{ZOO.Geometry} <api-zoo-geometry>` A geometry used to split this geometry (the source).
153  | ``options {Object}`` Properties of this object will be used to determine how the split is conducted.
154
155  *Valid options*
156 
157  | ``mutual {Boolean}`` Split the source geometry in addition to the target geometry.  Default is false.
158  | ``edge {Boolean}`` Allow splitting when only edges intersect.  Default is true.  If false, a vertex on the source must be within the tolerance distance of the intersection to be considered a split.
159  | ``tolerance {Number}`` If a non-null value is provided, intersections within the tolerance distance of an existing vertex on the source will be assumed to occur at the vertex.
160
161  *Returns*
162
163  ``{Array}`` A list of geometries (of this same type as the target) that result from splitting the target with the source geometry.  The source and target geometry will remain unmodified.  If no split results, null will be returned.  If mutual is true and a split results, return will be an array of two arrays - the first will be all geometries that result from splitting the source geometry and the second will be all geometries that result from splitting the target geometry. 
164
165.. _getVertices:           
166 
167getVertices     
168  ::
169 
170    getVertices: function(nodes)
171
172  Return a list of all points in this geometry.
173 
174  *Parameters*
175 
176  ``nodes {Boolean}`` For lines, only return vertices that are endpoints.  If false, for lines, only vertices that are not endpoints will be returned.  If not provided, all vertices will be returned.
177
178  *Returns*
179
180  ``{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