rgeo 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.rdoc +9 -7
- data/README.rdoc +7 -5
- data/Version +1 -1
- data/ext/geos_c_impl/factory.c +12 -19
- data/ext/geos_c_impl/factory.h +15 -21
- data/ext/geos_c_impl/geometry.c +19 -36
- data/ext/geos_c_impl/geometry.h +2 -12
- data/ext/geos_c_impl/geometry_collection.c +38 -157
- data/ext/geos_c_impl/geometry_collection.h +2 -12
- data/ext/geos_c_impl/line_string.c +83 -80
- data/ext/geos_c_impl/line_string.h +2 -12
- data/ext/geos_c_impl/main.c +5 -0
- data/ext/geos_c_impl/point.c +2 -12
- data/ext/geos_c_impl/point.h +2 -12
- data/ext/geos_c_impl/polygon.c +5 -14
- data/ext/geos_c_impl/polygon.h +2 -12
- data/ext/geos_c_impl/preface.h +8 -0
- data/lib/rgeo.rb +34 -16
- data/lib/rgeo/{geography/simple_spherical/geometry_collection_impl.rb → cartesian.rb} +19 -26
- data/lib/rgeo/cartesian/calculations.rb +129 -0
- data/lib/rgeo/cartesian/interface.rb +85 -0
- data/lib/rgeo/cartesian/simple_factory.rb +159 -0
- data/lib/rgeo/cartesian/simple_feature_classes.rb +187 -0
- data/lib/rgeo/cartesian/simple_feature_methods.rb +97 -0
- data/lib/rgeo/features.rb +1 -0
- data/lib/rgeo/features/curve.rb +3 -2
- data/lib/rgeo/features/factory.rb +62 -37
- data/lib/rgeo/features/geometry.rb +10 -32
- data/lib/rgeo/features/geometry_collection.rb +3 -2
- data/lib/rgeo/features/line.rb +3 -2
- data/lib/rgeo/features/line_string.rb +3 -2
- data/lib/rgeo/features/linear_ring.rb +3 -2
- data/lib/rgeo/features/multi_curve.rb +3 -2
- data/lib/rgeo/features/multi_line_string.rb +3 -2
- data/lib/rgeo/features/multi_point.rb +3 -2
- data/lib/rgeo/features/multi_polygon.rb +3 -2
- data/lib/rgeo/features/multi_surface.rb +3 -2
- data/lib/rgeo/features/point.rb +3 -2
- data/lib/rgeo/features/polygon.rb +3 -2
- data/lib/rgeo/features/surface.rb +3 -2
- data/lib/rgeo/features/types.rb +198 -0
- data/lib/rgeo/geography.rb +4 -14
- data/lib/rgeo/geography/factory.rb +7 -64
- data/lib/rgeo/geography/{simple_spherical/geometry_methods.rb → helper.rb} +4 -13
- data/lib/rgeo/geography/simple_mercator/feature_classes.rb +35 -89
- data/lib/rgeo/geography/simple_mercator/feature_methods.rb +22 -31
- data/lib/rgeo/geography/simple_mercator/projector.rb +4 -8
- data/lib/rgeo/geography/simple_spherical/calculations.rb +11 -9
- data/lib/rgeo/geography/simple_spherical/feature_classes.rb +189 -0
- data/lib/rgeo/geography/simple_spherical/{line_string_impl.rb → feature_methods.rb} +16 -64
- data/lib/rgeo/geos/factory.rb +26 -40
- data/lib/rgeo/geos/impl_additions.rb +3 -5
- data/lib/rgeo/{geography/simple_spherical/polygon_impl.rb → impl_helpers.rb} +16 -26
- data/lib/rgeo/impl_helpers/basic_geometry_collection_methods.rb +186 -0
- data/lib/rgeo/impl_helpers/basic_geometry_methods.rb +90 -0
- data/lib/rgeo/impl_helpers/basic_line_string_methods.rb +188 -0
- data/lib/rgeo/impl_helpers/basic_point_methods.rb +149 -0
- data/lib/rgeo/{geography/common/helper.rb → impl_helpers/basic_polygon_methods.rb} +62 -53
- data/lib/rgeo/{geography/common/polygon_methods.rb → impl_helpers/serialization.rb} +50 -42
- data/tests/common/geometry_collection_tests.rb +9 -7
- data/tests/common/multi_line_string_tests.rb +16 -13
- data/tests/common/multi_point_tests.rb +16 -13
- data/tests/common/multi_polygon_tests.rb +8 -6
- data/tests/common/point_tests.rb +1 -2
- data/tests/common/polygon_tests.rb +9 -9
- data/tests/geos/tc_multi_line_string.rb +2 -2
- data/tests/simple_cartesian/tc_calculations.rb +138 -0
- data/tests/simple_cartesian/tc_geometry_collection.rb +68 -0
- data/tests/simple_cartesian/tc_line_string.rb +70 -0
- data/{lib/rgeo/geography/simple_spherical/multi_line_string_impl.rb → tests/simple_cartesian/tc_multi_line_string.rb} +19 -19
- data/{lib/rgeo/geography/simple_spherical/multi_polygon_impl.rb → tests/simple_cartesian/tc_multi_point.rb} +19 -19
- data/{lib/rgeo/geography/common/geometry_methods.rb → tests/simple_cartesian/tc_multi_polygon.rb} +19 -41
- data/{lib/rgeo/geography/simple_spherical/point_impl.rb → tests/simple_cartesian/tc_point.rb} +33 -35
- data/tests/simple_cartesian/tc_polygon.rb +67 -0
- data/tests/simple_spherical/tc_geometry_collection.rb +68 -0
- data/tests/simple_spherical/tc_line_string.rb +10 -171
- data/tests/simple_spherical/tc_multi_line_string.rb +67 -0
- data/{lib/rgeo/geography/simple_spherical/multi_point_impl.rb → tests/simple_spherical/tc_multi_point.rb} +19 -19
- data/tests/simple_spherical/tc_multi_polygon.rb +70 -0
- data/tests/simple_spherical/tc_point.rb +17 -115
- data/tests/simple_spherical/tc_polygon.rb +67 -0
- metadata +46 -18
- data/ext/geos_c_impl/globals.h +0 -58
- data/lib/rgeo/geography/common/geometry_collection_methods.rb +0 -217
- data/lib/rgeo/geography/common/line_string_methods.rb +0 -201
- data/lib/rgeo/geography/common/point_methods.rb +0 -153
data/ext/geos_c_impl/globals.h
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
-----------------------------------------------------------------------------
|
3
|
-
|
4
|
-
Global data structure for GEOS wrapper
|
5
|
-
|
6
|
-
-----------------------------------------------------------------------------
|
7
|
-
Copyright 2010 Daniel Azuma
|
8
|
-
|
9
|
-
All rights reserved.
|
10
|
-
|
11
|
-
Redistribution and use in source and binary forms, with or without
|
12
|
-
modification, are permitted provided that the following conditions are met:
|
13
|
-
|
14
|
-
* Redistributions of source code must retain the above copyright notice,
|
15
|
-
this list of conditions and the following disclaimer.
|
16
|
-
* Redistributions in binary form must reproduce the above copyright notice,
|
17
|
-
this list of conditions and the following disclaimer in the documentation
|
18
|
-
and/or other materials provided with the distribution.
|
19
|
-
* Neither the name of the copyright holder, nor the names of any other
|
20
|
-
contributors to this software, may be used to endorse or promote products
|
21
|
-
derived from this software without specific prior written permission.
|
22
|
-
|
23
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
24
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
25
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
26
|
-
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
27
|
-
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
28
|
-
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
29
|
-
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
30
|
-
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
31
|
-
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
32
|
-
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
33
|
-
POSSIBILITY OF SUCH DAMAGE.
|
34
|
-
-----------------------------------------------------------------------------
|
35
|
-
*/
|
36
|
-
|
37
|
-
|
38
|
-
#ifndef RGEO_GEOS_GLOBALS_INCLUDED
|
39
|
-
#define RGEO_GEOS_GLOBALS_INCLUDED
|
40
|
-
|
41
|
-
#include <ruby.h>
|
42
|
-
|
43
|
-
#ifdef __cplusplus
|
44
|
-
extern "C" {
|
45
|
-
#if 0
|
46
|
-
}
|
47
|
-
#endif
|
48
|
-
#endif
|
49
|
-
|
50
|
-
|
51
|
-
#ifdef __cplusplus
|
52
|
-
#if 0
|
53
|
-
{
|
54
|
-
#endif
|
55
|
-
}
|
56
|
-
#endif
|
57
|
-
|
58
|
-
#endif
|
@@ -1,217 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Common methods for GeometryCollection geography features
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010 Daniel Azuma
|
7
|
-
#
|
8
|
-
# All rights reserved.
|
9
|
-
#
|
10
|
-
# Redistribution and use in source and binary forms, with or without
|
11
|
-
# modification, are permitted provided that the following conditions are met:
|
12
|
-
#
|
13
|
-
# * Redistributions of source code must retain the above copyright notice,
|
14
|
-
# this list of conditions and the following disclaimer.
|
15
|
-
# * Redistributions in binary form must reproduce the above copyright notice,
|
16
|
-
# this list of conditions and the following disclaimer in the documentation
|
17
|
-
# and/or other materials provided with the distribution.
|
18
|
-
# * Neither the name of the copyright holder, nor the names of any other
|
19
|
-
# contributors to this software, may be used to endorse or promote products
|
20
|
-
# derived from this software without specific prior written permission.
|
21
|
-
#
|
22
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
-
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
26
|
-
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
27
|
-
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
-
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
-
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
-
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
-
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
-
# POSSIBILITY OF SUCH DAMAGE.
|
33
|
-
# -----------------------------------------------------------------------------
|
34
|
-
;
|
35
|
-
|
36
|
-
|
37
|
-
module RGeo
|
38
|
-
|
39
|
-
module Geography
|
40
|
-
|
41
|
-
module Common
|
42
|
-
|
43
|
-
|
44
|
-
module GeometryCollectionMethods
|
45
|
-
|
46
|
-
|
47
|
-
def self._check_types(enum_, type_)
|
48
|
-
enum_.all? do |elem_|
|
49
|
-
case elem_
|
50
|
-
when type_ then true
|
51
|
-
when Features::GeometryCollection then _check_types(elem_, type_)
|
52
|
-
else false
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
def _setup(elements_)
|
59
|
-
@elements = elements_.map{ |elem_| factory.cast(elem_) }
|
60
|
-
_validate_geometry
|
61
|
-
end
|
62
|
-
|
63
|
-
|
64
|
-
def num_geometries
|
65
|
-
@elements.size
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
|
-
def geometry_n(n_)
|
70
|
-
@elements[n_]
|
71
|
-
end
|
72
|
-
|
73
|
-
|
74
|
-
def each(&block_)
|
75
|
-
@elements.each(&block_)
|
76
|
-
end
|
77
|
-
|
78
|
-
|
79
|
-
def dimension
|
80
|
-
unless @dimension
|
81
|
-
@dimension = -1
|
82
|
-
@elements.each do |elem_|
|
83
|
-
dim_ = elem_.dimension
|
84
|
-
@dimension = dim_ if @dimension < dim_
|
85
|
-
end
|
86
|
-
end
|
87
|
-
@dimension
|
88
|
-
end
|
89
|
-
|
90
|
-
|
91
|
-
def geometry_type
|
92
|
-
Features::GeometryCollection
|
93
|
-
end
|
94
|
-
|
95
|
-
|
96
|
-
def is_empty?
|
97
|
-
@elements.size == 0
|
98
|
-
end
|
99
|
-
|
100
|
-
|
101
|
-
def cast(type_)
|
102
|
-
if type_ == self.geometry_type
|
103
|
-
self
|
104
|
-
else
|
105
|
-
case type_
|
106
|
-
when Features::MultiPoint
|
107
|
-
factory.multi_point(@elements) rescue nil
|
108
|
-
when Features::MultiLineString
|
109
|
-
factory.multi_line_string(@elements) rescue nil
|
110
|
-
when Features::MultiPolygon
|
111
|
-
factory.multi_polygon(@elements) rescue nil
|
112
|
-
when Features::GeometryCollection
|
113
|
-
factory.collection(@elements) rescue nil
|
114
|
-
else
|
115
|
-
@elements.size == 1 ? @elements[0].cast(type_) : nil
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
|
121
|
-
end
|
122
|
-
|
123
|
-
|
124
|
-
module MultiLineStringMethods
|
125
|
-
|
126
|
-
|
127
|
-
def _validate_geometry # :nodoc:
|
128
|
-
super
|
129
|
-
if any?{ |elem_| !Features::LineString.check_type(elem_) }
|
130
|
-
raise Errors::InvalidGeometry, 'Collection element is not a LineString'
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
|
135
|
-
def geometry_type
|
136
|
-
Features::MultiLineString
|
137
|
-
end
|
138
|
-
|
139
|
-
|
140
|
-
def is_closed?
|
141
|
-
all?{ |elem_| elem_.is_closed? }
|
142
|
-
end
|
143
|
-
|
144
|
-
|
145
|
-
def cast(type_)
|
146
|
-
if type_ == Features::LineString && @elements.size == 1
|
147
|
-
@elements[0]
|
148
|
-
else
|
149
|
-
super
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
|
154
|
-
end
|
155
|
-
|
156
|
-
|
157
|
-
module MultiPointMethods
|
158
|
-
|
159
|
-
|
160
|
-
def _validate_geometry # :nodoc:
|
161
|
-
super
|
162
|
-
if any?{ |elem_| !Features::Point.check_type(elem_) }
|
163
|
-
raise Errors::InvalidGeometry, "Collection element is not a Point"
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
|
168
|
-
def geometry_type
|
169
|
-
Features::MultiPoint
|
170
|
-
end
|
171
|
-
|
172
|
-
|
173
|
-
def cast(type_)
|
174
|
-
if type_.name == Features::Point && @elements.size == 1
|
175
|
-
@elements[0]
|
176
|
-
else
|
177
|
-
super
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
|
182
|
-
end
|
183
|
-
|
184
|
-
|
185
|
-
module MultiPolygonMethods
|
186
|
-
|
187
|
-
|
188
|
-
def _validate_geometry # :nodoc:
|
189
|
-
super
|
190
|
-
if any?{ |elem_| !Features::Polygon.check_type(elem_) }
|
191
|
-
raise Errors::InvalidGeometry, 'Collection element is not a Polygon'
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
|
196
|
-
def geometry_type
|
197
|
-
Features::MultiPolygon
|
198
|
-
end
|
199
|
-
|
200
|
-
|
201
|
-
def cast(type_)
|
202
|
-
if type_ == Features::Polygon && @elements.size == 1
|
203
|
-
@elements[0]
|
204
|
-
else
|
205
|
-
super
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
|
210
|
-
end
|
211
|
-
|
212
|
-
|
213
|
-
end
|
214
|
-
|
215
|
-
end
|
216
|
-
|
217
|
-
end
|
@@ -1,201 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Common methods for LineString geography features
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010 Daniel Azuma
|
7
|
-
#
|
8
|
-
# All rights reserved.
|
9
|
-
#
|
10
|
-
# Redistribution and use in source and binary forms, with or without
|
11
|
-
# modification, are permitted provided that the following conditions are met:
|
12
|
-
#
|
13
|
-
# * Redistributions of source code must retain the above copyright notice,
|
14
|
-
# this list of conditions and the following disclaimer.
|
15
|
-
# * Redistributions in binary form must reproduce the above copyright notice,
|
16
|
-
# this list of conditions and the following disclaimer in the documentation
|
17
|
-
# and/or other materials provided with the distribution.
|
18
|
-
# * Neither the name of the copyright holder, nor the names of any other
|
19
|
-
# contributors to this software, may be used to endorse or promote products
|
20
|
-
# derived from this software without specific prior written permission.
|
21
|
-
#
|
22
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
-
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
26
|
-
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
27
|
-
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
-
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
-
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
-
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
-
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
-
# POSSIBILITY OF SUCH DAMAGE.
|
33
|
-
# -----------------------------------------------------------------------------
|
34
|
-
;
|
35
|
-
|
36
|
-
|
37
|
-
module RGeo
|
38
|
-
|
39
|
-
module Geography
|
40
|
-
|
41
|
-
module Common
|
42
|
-
|
43
|
-
|
44
|
-
module LineStringMethods
|
45
|
-
|
46
|
-
|
47
|
-
def _setup(points_)
|
48
|
-
@points = points_.map do |elem_|
|
49
|
-
unless Features::Point.check_type(elem_)
|
50
|
-
raise Errors::InvalidGeometry, 'Element #{elem_} is not a point'
|
51
|
-
end
|
52
|
-
factory.cast(elem_)
|
53
|
-
end
|
54
|
-
_validate_geometry
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
def _validate_geometry
|
59
|
-
if @points.size == 1
|
60
|
-
raise Errors::InvalidGeometry, 'LineString cannot have 1 point'
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
|
65
|
-
def eql?(rhs_)
|
66
|
-
if rhs_.is_a?(self.class) && rhs_.factory.eql?(@factory) && @points.size == rhs_.num_points
|
67
|
-
rhs_.points.each_with_index{ |p_, i_| return false unless @points[i_].eql?(p_) }
|
68
|
-
else
|
69
|
-
false
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
|
74
|
-
def cast(type_)
|
75
|
-
if type_ == self.geometry_type
|
76
|
-
self
|
77
|
-
else
|
78
|
-
case type_
|
79
|
-
when Features::Line
|
80
|
-
if @points.size == 0 || @points.size == 2
|
81
|
-
factory.line(@points.first, @points.last) rescue nil
|
82
|
-
else
|
83
|
-
nil
|
84
|
-
end
|
85
|
-
when Features::LinearRing
|
86
|
-
factory.linear_ring(@points) rescue nil
|
87
|
-
when Features::LineString
|
88
|
-
factory.line_string(@points) rescue nil
|
89
|
-
when Features::GeometryCollection
|
90
|
-
factory.collection([self]) rescue nil
|
91
|
-
when Features::MultiLineString
|
92
|
-
factory.multi_line_string([self]) rescue nil
|
93
|
-
when Features::Polygon
|
94
|
-
ring_ = factory.linear_ring(@points) rescue nil
|
95
|
-
ring_ ? factory.polygon(ring_, nil) : nil rescue nil
|
96
|
-
else
|
97
|
-
super
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
|
103
|
-
def num_points
|
104
|
-
@points.size
|
105
|
-
end
|
106
|
-
|
107
|
-
|
108
|
-
def point_n(n_)
|
109
|
-
@points[n_]
|
110
|
-
end
|
111
|
-
|
112
|
-
|
113
|
-
def points
|
114
|
-
@points.dup
|
115
|
-
end
|
116
|
-
|
117
|
-
|
118
|
-
def dimension
|
119
|
-
1
|
120
|
-
end
|
121
|
-
|
122
|
-
|
123
|
-
def geometry_type
|
124
|
-
Features::LineString
|
125
|
-
end
|
126
|
-
|
127
|
-
|
128
|
-
def is_empty?
|
129
|
-
@points.size == 0
|
130
|
-
end
|
131
|
-
|
132
|
-
|
133
|
-
def start_point
|
134
|
-
@points.first
|
135
|
-
end
|
136
|
-
|
137
|
-
|
138
|
-
def end_point
|
139
|
-
@points.last
|
140
|
-
end
|
141
|
-
|
142
|
-
|
143
|
-
def is_closed?
|
144
|
-
if @is_closed.nil?
|
145
|
-
@is_closed = @points.size > 2 && @points.first == @points.last
|
146
|
-
end
|
147
|
-
@is_closed
|
148
|
-
end
|
149
|
-
|
150
|
-
|
151
|
-
def is_ring?
|
152
|
-
is_closed? && is_simple?
|
153
|
-
end
|
154
|
-
|
155
|
-
|
156
|
-
end
|
157
|
-
|
158
|
-
|
159
|
-
module LineMethods
|
160
|
-
|
161
|
-
|
162
|
-
def _validate_geometry # :nodoc:
|
163
|
-
super
|
164
|
-
if @points.size > 2
|
165
|
-
raise Errors::InvalidGeometry, 'Line must have 0 or 2 points'
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
|
170
|
-
def geometry_type
|
171
|
-
Features::Line
|
172
|
-
end
|
173
|
-
|
174
|
-
|
175
|
-
end
|
176
|
-
|
177
|
-
|
178
|
-
module LinearRingMethods
|
179
|
-
|
180
|
-
|
181
|
-
def _validate_geometry # :nodoc:
|
182
|
-
super
|
183
|
-
if @points.size > 0 && !is_ring?
|
184
|
-
raise Errors::InvalidGeometry, 'LinearRing failed ring test'
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
|
189
|
-
def geometry_type
|
190
|
-
Features::LinearRing
|
191
|
-
end
|
192
|
-
|
193
|
-
|
194
|
-
end
|
195
|
-
|
196
|
-
|
197
|
-
end
|
198
|
-
|
199
|
-
end
|
200
|
-
|
201
|
-
end
|