rgeo 0.3.3 → 0.3.4
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 +6 -0
- data/README.rdoc +1 -1
- data/Version +1 -1
- data/ext/geos_c_impl/extconf.rb +13 -13
- data/ext/geos_c_impl/factory.c +30 -18
- data/ext/geos_c_impl/factory.h +18 -12
- data/ext/geos_c_impl/geometry.c +11 -11
- data/ext/geos_c_impl/geometry.h +7 -7
- data/ext/geos_c_impl/geometry_collection.c +15 -15
- data/ext/geos_c_impl/geometry_collection.h +8 -8
- data/ext/geos_c_impl/line_string.c +14 -14
- data/ext/geos_c_impl/line_string.h +7 -7
- data/ext/geos_c_impl/main.c +7 -7
- data/ext/geos_c_impl/point.c +9 -9
- data/ext/geos_c_impl/point.h +7 -7
- data/ext/geos_c_impl/polygon.c +9 -9
- data/ext/geos_c_impl/polygon.h +7 -7
- data/ext/geos_c_impl/preface.h +7 -7
- data/ext/proj4_c_impl/extconf.rb +13 -13
- data/ext/proj4_c_impl/main.c +12 -12
- data/lib/rgeo.rb +26 -26
- data/lib/rgeo/cartesian.rb +12 -12
- data/lib/rgeo/cartesian/analysis.rb +26 -26
- data/lib/rgeo/cartesian/bounding_box.rb +83 -83
- data/lib/rgeo/cartesian/calculations.rb +36 -36
- data/lib/rgeo/cartesian/factory.rb +78 -78
- data/lib/rgeo/cartesian/feature_classes.rb +74 -74
- data/lib/rgeo/cartesian/feature_methods.rb +34 -34
- data/lib/rgeo/cartesian/interface.rb +33 -33
- data/lib/rgeo/coord_sys.rb +15 -15
- data/lib/rgeo/coord_sys/cs/entities.rb +533 -534
- data/lib/rgeo/coord_sys/cs/factories.rb +69 -69
- data/lib/rgeo/coord_sys/cs/wkt_parser.rb +44 -44
- data/lib/rgeo/coord_sys/proj4.rb +85 -85
- data/lib/rgeo/coord_sys/srs_database/active_record_table.rb +31 -31
- data/lib/rgeo/coord_sys/srs_database/interface.rb +44 -44
- data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +31 -31
- data/lib/rgeo/coord_sys/srs_database/sr_org.rb +31 -31
- data/lib/rgeo/coord_sys/srs_database/url_reader.rb +29 -29
- data/lib/rgeo/error.rb +17 -17
- data/lib/rgeo/feature.rb +15 -15
- data/lib/rgeo/feature/curve.rb +58 -58
- data/lib/rgeo/feature/factory.rb +84 -84
- data/lib/rgeo/feature/factory_generator.rb +32 -32
- data/lib/rgeo/feature/geometry.rb +215 -215
- data/lib/rgeo/feature/geometry_collection.rb +46 -46
- data/lib/rgeo/feature/line.rb +21 -21
- data/lib/rgeo/feature/line_string.rb +35 -35
- data/lib/rgeo/feature/linear_ring.rb +20 -20
- data/lib/rgeo/feature/mixins.rb +61 -61
- data/lib/rgeo/feature/multi_curve.rb +37 -37
- data/lib/rgeo/feature/multi_line_string.rb +20 -20
- data/lib/rgeo/feature/multi_point.rb +22 -22
- data/lib/rgeo/feature/multi_polygon.rb +28 -28
- data/lib/rgeo/feature/multi_surface.rb +39 -39
- data/lib/rgeo/feature/point.rb +42 -42
- data/lib/rgeo/feature/polygon.rb +50 -50
- data/lib/rgeo/feature/surface.rb +42 -42
- data/lib/rgeo/feature/types.rb +58 -58
- data/lib/rgeo/geographic.rb +14 -14
- data/lib/rgeo/geographic/factory.rb +87 -87
- data/lib/rgeo/geographic/interface.rb +55 -55
- data/lib/rgeo/geographic/proj4_projector.rb +35 -35
- data/lib/rgeo/geographic/projected_feature_classes.rb +95 -95
- data/lib/rgeo/geographic/projected_feature_methods.rb +81 -81
- data/lib/rgeo/geographic/projected_window.rb +103 -103
- data/lib/rgeo/geographic/simple_mercator_projector.rb +32 -32
- data/lib/rgeo/geographic/spherical_feature_classes.rb +93 -93
- data/lib/rgeo/geographic/spherical_feature_methods.rb +25 -25
- data/lib/rgeo/geographic/spherical_math.rb +58 -58
- data/lib/rgeo/geos.rb +22 -17
- data/lib/rgeo/geos/factory.rb +93 -93
- data/lib/rgeo/geos/ffi_classes.rb +306 -231
- data/lib/rgeo/geos/ffi_factory.rb +100 -96
- data/lib/rgeo/geos/impl_additions.rb +22 -22
- data/lib/rgeo/geos/interface.rb +45 -45
- data/lib/rgeo/geos/zm_factory.rb +90 -90
- data/lib/rgeo/geos/zm_impl.rb +167 -167
- data/lib/rgeo/impl_helper.rb +11 -11
- data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +71 -71
- data/lib/rgeo/impl_helper/basic_geometry_methods.rb +29 -29
- data/lib/rgeo/impl_helper/basic_line_string_methods.rb +61 -61
- data/lib/rgeo/impl_helper/basic_point_methods.rb +43 -43
- data/lib/rgeo/impl_helper/basic_polygon_methods.rb +35 -35
- data/lib/rgeo/impl_helper/math.rb +13 -13
- data/lib/rgeo/version.rb +10 -10
- data/lib/rgeo/wkrep.rb +16 -16
- data/lib/rgeo/wkrep/wkb_generator.rb +51 -51
- data/lib/rgeo/wkrep/wkb_parser.rb +52 -52
- data/lib/rgeo/wkrep/wkt_generator.rb +51 -51
- data/lib/rgeo/wkrep/wkt_parser.rb +66 -66
- data/lib/rgeo/yaml.rb +14 -14
- data/test/common/geometry_collection_tests.rb +53 -53
- data/test/common/line_string_tests.rb +57 -57
- data/test/common/multi_line_string_tests.rb +43 -43
- data/test/common/multi_point_tests.rb +43 -43
- data/test/common/multi_polygon_tests.rb +43 -43
- data/test/common/point_tests.rb +75 -75
- data/test/common/polygon_tests.rb +37 -37
- data/test/coord_sys/tc_active_record_table.rb +25 -25
- data/test/coord_sys/tc_ogc_cs.rb +72 -72
- data/test/coord_sys/tc_proj4.rb +51 -51
- data/test/coord_sys/tc_proj4_srs_data.rb +17 -17
- data/test/coord_sys/tc_sr_org.rb +15 -15
- data/test/coord_sys/tc_url_reader.rb +19 -19
- data/test/geos_capi/tc_factory.rb +21 -21
- data/test/geos_capi/tc_geometry_collection.rb +15 -15
- data/test/geos_capi/tc_line_string.rb +15 -15
- data/test/geos_capi/tc_misc.rb +33 -22
- data/test/geos_capi/tc_multi_line_string.rb +15 -15
- data/test/geos_capi/tc_multi_point.rb +15 -15
- data/test/geos_capi/tc_multi_polygon.rb +15 -15
- data/test/geos_capi/tc_parsing_unparsing.rb +19 -19
- data/test/geos_capi/tc_point.rb +21 -21
- data/test/geos_capi/tc_polygon.rb +19 -19
- data/test/geos_capi/tc_zmfactory.rb +17 -17
- data/test/geos_ffi/tc_factory.rb +21 -21
- data/test/geos_ffi/tc_geometry_collection.rb +15 -15
- data/test/geos_ffi/tc_line_string.rb +15 -15
- data/test/geos_ffi/tc_misc.rb +49 -15
- data/test/geos_ffi/tc_multi_line_string.rb +15 -15
- data/test/geos_ffi/tc_multi_point.rb +15 -15
- data/test/geos_ffi/tc_multi_polygon.rb +15 -15
- data/test/geos_ffi/tc_parsing_unparsing.rb +19 -19
- data/test/geos_ffi/tc_point.rb +21 -21
- data/test/geos_ffi/tc_polygon.rb +19 -19
- data/test/geos_ffi/tc_zmfactory.rb +17 -17
- data/test/projected_geographic/tc_geometry_collection.rb +15 -15
- data/test/projected_geographic/tc_line_string.rb +15 -15
- data/test/projected_geographic/tc_multi_line_string.rb +15 -15
- data/test/projected_geographic/tc_multi_point.rb +15 -15
- data/test/projected_geographic/tc_multi_polygon.rb +15 -15
- data/test/projected_geographic/tc_point.rb +23 -23
- data/test/projected_geographic/tc_polygon.rb +15 -15
- data/test/simple_cartesian/tc_calculations.rb +31 -31
- data/test/simple_cartesian/tc_geometry_collection.rb +17 -17
- data/test/simple_cartesian/tc_line_string.rb +17 -17
- data/test/simple_cartesian/tc_multi_line_string.rb +17 -17
- data/test/simple_cartesian/tc_multi_point.rb +17 -17
- data/test/simple_cartesian/tc_multi_polygon.rb +17 -17
- data/test/simple_cartesian/tc_point.rb +21 -21
- data/test/simple_cartesian/tc_polygon.rb +17 -17
- data/test/simple_mercator/tc_geometry_collection.rb +15 -15
- data/test/simple_mercator/tc_line_string.rb +15 -15
- data/test/simple_mercator/tc_multi_line_string.rb +15 -15
- data/test/simple_mercator/tc_multi_point.rb +15 -15
- data/test/simple_mercator/tc_multi_polygon.rb +15 -15
- data/test/simple_mercator/tc_point.rb +23 -23
- data/test/simple_mercator/tc_polygon.rb +15 -15
- data/test/simple_mercator/tc_window.rb +50 -50
- data/test/spherical_geographic/tc_calculations.rb +47 -47
- data/test/spherical_geographic/tc_geometry_collection.rb +17 -17
- data/test/spherical_geographic/tc_line_string.rb +17 -17
- data/test/spherical_geographic/tc_multi_line_string.rb +17 -17
- data/test/spherical_geographic/tc_multi_point.rb +17 -17
- data/test/spherical_geographic/tc_multi_polygon.rb +17 -17
- data/test/spherical_geographic/tc_point.rb +23 -23
- data/test/spherical_geographic/tc_polygon.rb +17 -17
- data/test/tc_cartesian_analysis.rb +23 -23
- data/test/tc_mixins.rb +39 -39
- data/test/tc_oneoff.rb +15 -15
- data/test/tc_types.rb +17 -17
- data/test/wkrep/tc_wkb_generator.rb +67 -67
- data/test/wkrep/tc_wkb_parser.rb +73 -73
- data/test/wkrep/tc_wkt_generator.rb +75 -75
- data/test/wkrep/tc_wkt_parser.rb +97 -97
- metadata +3 -3
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Core calculations in the plane
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010 Daniel Azuma
|
7
|
-
#
|
6
|
+
# Copyright 2010-2012 Daniel Azuma
|
7
|
+
#
|
8
8
|
# All rights reserved.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# Redistribution and use in source and binary forms, with or without
|
11
11
|
# modification, are permitted provided that the following conditions are met:
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# * Redistributions of source code must retain the above copyright notice,
|
14
14
|
# this list of conditions and the following disclaimer.
|
15
15
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
@@ -18,7 +18,7 @@
|
|
18
18
|
# * Neither the name of the copyright holder, nor the names of any other
|
19
19
|
# contributors to this software, may be used to endorse or promote products
|
20
20
|
# derived from this software without specific prior written permission.
|
21
|
-
#
|
21
|
+
#
|
22
22
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
23
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
24
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
@@ -35,14 +35,14 @@
|
|
35
35
|
|
36
36
|
|
37
37
|
module RGeo
|
38
|
-
|
38
|
+
|
39
39
|
module Cartesian
|
40
|
-
|
41
|
-
|
40
|
+
|
41
|
+
|
42
42
|
# Represents a line segment in the plane.
|
43
|
-
|
43
|
+
|
44
44
|
class Segment # :nodoc:
|
45
|
-
|
45
|
+
|
46
46
|
def initialize(start_, end_)
|
47
47
|
@s = start_
|
48
48
|
@e = end_
|
@@ -54,41 +54,41 @@ module RGeo
|
|
54
54
|
@dy = @ey - @sy
|
55
55
|
@lensq = @dx * @dx + @dy * @dy
|
56
56
|
end
|
57
|
-
|
58
|
-
|
57
|
+
|
58
|
+
|
59
59
|
attr_reader :s
|
60
60
|
attr_reader :e
|
61
61
|
attr_reader :dx
|
62
62
|
attr_reader :dy
|
63
|
-
|
64
|
-
|
63
|
+
|
64
|
+
|
65
65
|
def to_s
|
66
66
|
"#{@s} - #{@e}"
|
67
67
|
end
|
68
|
-
|
69
|
-
|
68
|
+
|
69
|
+
|
70
70
|
def eql?(rhs_)
|
71
71
|
rhs_.kind_of?(Segment) && @s == rhs_.s && @e == rhs_.e
|
72
72
|
end
|
73
73
|
alias_method :==, :eql?
|
74
|
-
|
75
|
-
|
74
|
+
|
75
|
+
|
76
76
|
def degenerate?
|
77
77
|
@lensq == 0
|
78
78
|
end
|
79
|
-
|
80
|
-
|
79
|
+
|
80
|
+
|
81
81
|
# Returns a negative value if the point is to the left,
|
82
82
|
# a positive value if the point is to the right, or
|
83
83
|
# 0 if the point is collinear to the segment.
|
84
|
-
|
84
|
+
|
85
85
|
def side(p_)
|
86
86
|
px_ = p_.x
|
87
87
|
py_ = p_.y
|
88
88
|
(@sx - px_) * (@ey - py_) - (@sy - py_) * (@ex - px_)
|
89
89
|
end
|
90
|
-
|
91
|
-
|
90
|
+
|
91
|
+
|
92
92
|
def tproj(p_)
|
93
93
|
if @lensq == 0
|
94
94
|
nil
|
@@ -96,8 +96,8 @@ module RGeo
|
|
96
96
|
(@dx * (p_.x - @sx) + @dy * (p_.y - @sy)) / @lensq
|
97
97
|
end
|
98
98
|
end
|
99
|
-
|
100
|
-
|
99
|
+
|
100
|
+
|
101
101
|
def contains_point?(p_)
|
102
102
|
if side(p_) == 0
|
103
103
|
t_ = tproj(p_)
|
@@ -106,8 +106,8 @@ module RGeo
|
|
106
106
|
false
|
107
107
|
end
|
108
108
|
end
|
109
|
-
|
110
|
-
|
109
|
+
|
110
|
+
|
111
111
|
def intersects_segment?(seg_)
|
112
112
|
s2_ = seg_.s
|
113
113
|
# Handle degenerate cases
|
@@ -146,16 +146,16 @@ module RGeo
|
|
146
146
|
t2_ >= 0.0 && t2_ <= 1.0
|
147
147
|
end
|
148
148
|
end
|
149
|
-
|
150
|
-
|
149
|
+
|
150
|
+
|
151
151
|
def length
|
152
152
|
::Math.sqrt(@lensq)
|
153
153
|
end
|
154
|
-
|
155
|
-
|
154
|
+
|
155
|
+
|
156
156
|
end
|
157
|
-
|
158
|
-
|
157
|
+
|
158
|
+
|
159
159
|
end
|
160
|
-
|
160
|
+
|
161
161
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Geographic data factory implementation
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010 Daniel Azuma
|
7
|
-
#
|
6
|
+
# Copyright 2010-2012 Daniel Azuma
|
7
|
+
#
|
8
8
|
# All rights reserved.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# Redistribution and use in source and binary forms, with or without
|
11
11
|
# modification, are permitted provided that the following conditions are met:
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# * Redistributions of source code must retain the above copyright notice,
|
14
14
|
# this list of conditions and the following disclaimer.
|
15
15
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
@@ -18,7 +18,7 @@
|
|
18
18
|
# * Neither the name of the copyright holder, nor the names of any other
|
19
19
|
# contributors to this software, may be used to endorse or promote products
|
20
20
|
# derived from this software without specific prior written permission.
|
21
|
-
#
|
21
|
+
#
|
22
22
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
23
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
24
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
@@ -35,22 +35,22 @@
|
|
35
35
|
|
36
36
|
|
37
37
|
module RGeo
|
38
|
-
|
38
|
+
|
39
39
|
module Cartesian
|
40
|
-
|
41
|
-
|
40
|
+
|
41
|
+
|
42
42
|
# This class implements the factory for the simple cartesian
|
43
43
|
# implementation.
|
44
|
-
|
44
|
+
|
45
45
|
class Factory
|
46
|
-
|
46
|
+
|
47
47
|
include Feature::Factory::Instance
|
48
|
-
|
49
|
-
|
48
|
+
|
49
|
+
|
50
50
|
# Create a new simple cartesian factory.
|
51
|
-
#
|
51
|
+
#
|
52
52
|
# See ::RGeo::Cartesian.simple_factory for a list of supported options.
|
53
|
-
|
53
|
+
|
54
54
|
def initialize(opts_={})
|
55
55
|
@has_z = opts_[:has_z_coordinate] ? true : false
|
56
56
|
@has_m = opts_[:has_m_coordinate] ? true : false
|
@@ -76,7 +76,7 @@ module RGeo
|
|
76
76
|
end
|
77
77
|
srid_ ||= @coord_sys.authority_code if @coord_sys
|
78
78
|
@srid = srid_.to_i
|
79
|
-
|
79
|
+
|
80
80
|
wkt_generator_ = opts_[:wkt_generator]
|
81
81
|
case wkt_generator_
|
82
82
|
when ::Hash
|
@@ -106,18 +106,18 @@ module RGeo
|
|
106
106
|
@wkb_parser = WKRep::WKBParser.new(self)
|
107
107
|
end
|
108
108
|
end
|
109
|
-
|
110
|
-
|
109
|
+
|
110
|
+
|
111
111
|
# Equivalence test.
|
112
|
-
|
112
|
+
|
113
113
|
def eql?(rhs_)
|
114
114
|
rhs_.is_a?(self.class) && @srid == rhs_.srid && @has_z == rhs_.property(:has_z_coordinate) && @has_m == rhs_.property(:has_m_coordinate)
|
115
115
|
end
|
116
116
|
alias_method :==, :eql?
|
117
|
-
|
118
|
-
|
117
|
+
|
118
|
+
|
119
119
|
# Marshal support
|
120
|
-
|
120
|
+
|
121
121
|
def marshal_dump # :nodoc:
|
122
122
|
hash_ = {
|
123
123
|
'hasz' => @has_z,
|
@@ -132,7 +132,7 @@ module RGeo
|
|
132
132
|
hash_['cs'] = @coord_sys.to_wkt if @coord_sys
|
133
133
|
hash_
|
134
134
|
end
|
135
|
-
|
135
|
+
|
136
136
|
def marshal_load(data_) # :nodoc:
|
137
137
|
if CoordSys::Proj4.supported? && (proj4_data_ = data_['proj4'])
|
138
138
|
proj4_ = CoordSys::Proj4.allocate
|
@@ -157,10 +157,10 @@ module RGeo
|
|
157
157
|
:coord_sys => coord_sys_,
|
158
158
|
})
|
159
159
|
end
|
160
|
-
|
161
|
-
|
160
|
+
|
161
|
+
|
162
162
|
# Psych support
|
163
|
-
|
163
|
+
|
164
164
|
def init_with(coder_) # :nodoc:
|
165
165
|
if (proj4_data_ = coder_['proj4'])
|
166
166
|
if proj4_data_.is_a?(::Hash)
|
@@ -188,7 +188,7 @@ module RGeo
|
|
188
188
|
:coord_sys => coord_sys_,
|
189
189
|
})
|
190
190
|
end
|
191
|
-
|
191
|
+
|
192
192
|
def encode_with(coder_) # :nodoc:
|
193
193
|
coder_['has_z_coordinate'] = @has_z
|
194
194
|
coder_['has_m_coordinate'] = @has_m
|
@@ -203,17 +203,17 @@ module RGeo
|
|
203
203
|
end
|
204
204
|
coder_['coord_sys'] = @coord_sys.to_wkt if @coord_sys
|
205
205
|
end
|
206
|
-
|
207
|
-
|
206
|
+
|
207
|
+
|
208
208
|
# Returns the SRID.
|
209
|
-
|
209
|
+
|
210
210
|
def srid
|
211
211
|
@srid
|
212
212
|
end
|
213
|
-
|
214
|
-
|
213
|
+
|
214
|
+
|
215
215
|
# See ::RGeo::Feature::Factory#property
|
216
|
-
|
216
|
+
|
217
217
|
def property(name_)
|
218
218
|
case name_
|
219
219
|
when :has_z_coordinate
|
@@ -226,102 +226,102 @@ module RGeo
|
|
226
226
|
nil
|
227
227
|
end
|
228
228
|
end
|
229
|
-
|
230
|
-
|
229
|
+
|
230
|
+
|
231
231
|
# See ::RGeo::Feature::Factory#parse_wkt
|
232
|
-
|
232
|
+
|
233
233
|
def parse_wkt(str_)
|
234
234
|
@wkt_parser.parse(str_)
|
235
235
|
end
|
236
|
-
|
237
|
-
|
236
|
+
|
237
|
+
|
238
238
|
# See ::RGeo::Feature::Factory#parse_wkb
|
239
|
-
|
239
|
+
|
240
240
|
def parse_wkb(str_)
|
241
241
|
@wkb_parser.parse(str_)
|
242
242
|
end
|
243
|
-
|
244
|
-
|
243
|
+
|
244
|
+
|
245
245
|
# See ::RGeo::Feature::Factory#point
|
246
|
-
|
246
|
+
|
247
247
|
def point(x_, y_, *extra_)
|
248
248
|
PointImpl.new(self, x_, y_, *extra_) rescue nil
|
249
249
|
end
|
250
|
-
|
251
|
-
|
250
|
+
|
251
|
+
|
252
252
|
# See ::RGeo::Feature::Factory#line_string
|
253
|
-
|
253
|
+
|
254
254
|
def line_string(points_)
|
255
255
|
LineStringImpl.new(self, points_) rescue nil
|
256
256
|
end
|
257
|
-
|
258
|
-
|
257
|
+
|
258
|
+
|
259
259
|
# See ::RGeo::Feature::Factory#line
|
260
|
-
|
260
|
+
|
261
261
|
def line(start_, end_)
|
262
262
|
LineImpl.new(self, start_, end_) rescue nil
|
263
263
|
end
|
264
|
-
|
265
|
-
|
264
|
+
|
265
|
+
|
266
266
|
# See ::RGeo::Feature::Factory#linear_ring
|
267
|
-
|
267
|
+
|
268
268
|
def linear_ring(points_)
|
269
269
|
LinearRingImpl.new(self, points_) rescue nil
|
270
270
|
end
|
271
|
-
|
272
|
-
|
271
|
+
|
272
|
+
|
273
273
|
# See ::RGeo::Feature::Factory#polygon
|
274
|
-
|
274
|
+
|
275
275
|
def polygon(outer_ring_, inner_rings_=nil)
|
276
276
|
PolygonImpl.new(self, outer_ring_, inner_rings_) rescue nil
|
277
277
|
end
|
278
|
-
|
279
|
-
|
278
|
+
|
279
|
+
|
280
280
|
# See ::RGeo::Feature::Factory#collection
|
281
|
-
|
281
|
+
|
282
282
|
def collection(elems_)
|
283
283
|
GeometryCollectionImpl.new(self, elems_) rescue nil
|
284
284
|
end
|
285
|
-
|
286
|
-
|
285
|
+
|
286
|
+
|
287
287
|
# See ::RGeo::Feature::Factory#multi_point
|
288
|
-
|
288
|
+
|
289
289
|
def multi_point(elems_)
|
290
290
|
MultiPointImpl.new(self, elems_) rescue nil
|
291
291
|
end
|
292
|
-
|
293
|
-
|
292
|
+
|
293
|
+
|
294
294
|
# See ::RGeo::Feature::Factory#multi_line_string
|
295
|
-
|
295
|
+
|
296
296
|
def multi_line_string(elems_)
|
297
297
|
MultiLineStringImpl.new(self, elems_) rescue nil
|
298
298
|
end
|
299
|
-
|
300
|
-
|
299
|
+
|
300
|
+
|
301
301
|
# See ::RGeo::Feature::Factory#multi_polygon
|
302
|
-
|
302
|
+
|
303
303
|
def multi_polygon(elems_)
|
304
304
|
MultiPolygonImpl.new(self, elems_) rescue nil
|
305
305
|
end
|
306
|
-
|
307
|
-
|
306
|
+
|
307
|
+
|
308
308
|
# See ::RGeo::Feature::Factory#proj4
|
309
|
-
|
309
|
+
|
310
310
|
def proj4
|
311
311
|
@proj4
|
312
312
|
end
|
313
|
-
|
314
|
-
|
313
|
+
|
314
|
+
|
315
315
|
# See ::RGeo::Feature::Factory#coord_sys
|
316
|
-
|
316
|
+
|
317
317
|
def coord_sys
|
318
318
|
@coord_sys
|
319
319
|
end
|
320
|
-
|
321
|
-
|
320
|
+
|
321
|
+
|
322
322
|
end
|
323
|
-
|
324
|
-
|
323
|
+
|
324
|
+
|
325
325
|
end
|
326
|
-
|
326
|
+
|
327
327
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Cartesian feature classes
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010 Daniel Azuma
|
7
|
-
#
|
6
|
+
# Copyright 2010-2012 Daniel Azuma
|
7
|
+
#
|
8
8
|
# All rights reserved.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# Redistribution and use in source and binary forms, with or without
|
11
11
|
# modification, are permitted provided that the following conditions are met:
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# * Redistributions of source code must retain the above copyright notice,
|
14
14
|
# this list of conditions and the following disclaimer.
|
15
15
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
@@ -18,7 +18,7 @@
|
|
18
18
|
# * Neither the name of the copyright holder, nor the names of any other
|
19
19
|
# contributors to this software, may be used to endorse or promote products
|
20
20
|
# derived from this software without specific prior written permission.
|
21
|
-
#
|
21
|
+
#
|
22
22
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
23
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
24
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
@@ -35,145 +35,145 @@
|
|
35
35
|
|
36
36
|
|
37
37
|
module RGeo
|
38
|
-
|
38
|
+
|
39
39
|
module Cartesian
|
40
|
-
|
41
|
-
|
40
|
+
|
41
|
+
|
42
42
|
class PointImpl # :nodoc:
|
43
|
-
|
44
|
-
|
43
|
+
|
44
|
+
|
45
45
|
include ::RGeo::Feature::Point
|
46
46
|
include ::RGeo::ImplHelper::BasicGeometryMethods
|
47
47
|
include ::RGeo::ImplHelper::BasicPointMethods
|
48
48
|
include ::RGeo::Cartesian::GeometryMethods
|
49
49
|
include ::RGeo::Cartesian::PointMethods
|
50
|
-
|
50
|
+
|
51
51
|
Feature::MixinCollection::GLOBAL.for_type(Feature::Point).include_in_class(self, true)
|
52
|
-
|
53
|
-
|
52
|
+
|
53
|
+
|
54
54
|
end
|
55
|
-
|
56
|
-
|
55
|
+
|
56
|
+
|
57
57
|
class LineStringImpl # :nodoc:
|
58
|
-
|
59
|
-
|
58
|
+
|
59
|
+
|
60
60
|
include ::RGeo::Feature::LineString
|
61
61
|
include ::RGeo::ImplHelper::BasicGeometryMethods
|
62
62
|
include ::RGeo::ImplHelper::BasicLineStringMethods
|
63
63
|
include ::RGeo::Cartesian::GeometryMethods
|
64
64
|
include ::RGeo::Cartesian::LineStringMethods
|
65
|
-
|
65
|
+
|
66
66
|
Feature::MixinCollection::GLOBAL.for_type(Feature::LineString).include_in_class(self, true)
|
67
|
-
|
68
|
-
|
67
|
+
|
68
|
+
|
69
69
|
end
|
70
|
-
|
71
|
-
|
70
|
+
|
71
|
+
|
72
72
|
class LineImpl # :nodoc:
|
73
|
-
|
74
|
-
|
73
|
+
|
74
|
+
|
75
75
|
include ::RGeo::Feature::Line
|
76
76
|
include ::RGeo::ImplHelper::BasicGeometryMethods
|
77
77
|
include ::RGeo::ImplHelper::BasicLineStringMethods
|
78
78
|
include ::RGeo::ImplHelper::BasicLineMethods
|
79
79
|
include ::RGeo::Cartesian::GeometryMethods
|
80
80
|
include ::RGeo::Cartesian::LineStringMethods
|
81
|
-
|
81
|
+
|
82
82
|
Feature::MixinCollection::GLOBAL.for_type(Feature::Line).include_in_class(self, true)
|
83
|
-
|
84
|
-
|
83
|
+
|
84
|
+
|
85
85
|
end
|
86
|
-
|
87
|
-
|
86
|
+
|
87
|
+
|
88
88
|
class LinearRingImpl # :nodoc:
|
89
|
-
|
90
|
-
|
89
|
+
|
90
|
+
|
91
91
|
include ::RGeo::Feature::LinearRing
|
92
92
|
include ::RGeo::ImplHelper::BasicGeometryMethods
|
93
93
|
include ::RGeo::ImplHelper::BasicLineStringMethods
|
94
94
|
include ::RGeo::ImplHelper::BasicLinearRingMethods
|
95
95
|
include ::RGeo::Cartesian::GeometryMethods
|
96
96
|
include ::RGeo::Cartesian::LineStringMethods
|
97
|
-
|
97
|
+
|
98
98
|
Feature::MixinCollection::GLOBAL.for_type(Feature::LinearRing).include_in_class(self, true)
|
99
|
-
|
100
|
-
|
99
|
+
|
100
|
+
|
101
101
|
end
|
102
|
-
|
103
|
-
|
102
|
+
|
103
|
+
|
104
104
|
class PolygonImpl # :nodoc:
|
105
|
-
|
106
|
-
|
105
|
+
|
106
|
+
|
107
107
|
include ::RGeo::Feature::Polygon
|
108
108
|
include ::RGeo::ImplHelper::BasicGeometryMethods
|
109
109
|
include ::RGeo::ImplHelper::BasicPolygonMethods
|
110
110
|
include ::RGeo::Cartesian::GeometryMethods
|
111
|
-
|
111
|
+
|
112
112
|
Feature::MixinCollection::GLOBAL.for_type(Feature::Polygon).include_in_class(self, true)
|
113
|
-
|
114
|
-
|
113
|
+
|
114
|
+
|
115
115
|
end
|
116
|
-
|
117
|
-
|
116
|
+
|
117
|
+
|
118
118
|
class GeometryCollectionImpl # :nodoc:
|
119
|
-
|
120
|
-
|
119
|
+
|
120
|
+
|
121
121
|
include ::RGeo::Feature::GeometryCollection
|
122
122
|
include ::RGeo::ImplHelper::BasicGeometryMethods
|
123
123
|
include ::RGeo::ImplHelper::BasicGeometryCollectionMethods
|
124
124
|
include ::RGeo::Cartesian::GeometryMethods
|
125
|
-
|
125
|
+
|
126
126
|
Feature::MixinCollection::GLOBAL.for_type(Feature::GeometryCollection).include_in_class(self, true)
|
127
|
-
|
128
|
-
|
127
|
+
|
128
|
+
|
129
129
|
end
|
130
|
-
|
131
|
-
|
130
|
+
|
131
|
+
|
132
132
|
class MultiPointImpl # :nodoc:
|
133
|
-
|
134
|
-
|
133
|
+
|
134
|
+
|
135
135
|
include ::RGeo::Feature::MultiPoint
|
136
136
|
include ::RGeo::ImplHelper::BasicGeometryMethods
|
137
137
|
include ::RGeo::ImplHelper::BasicGeometryCollectionMethods
|
138
138
|
include ::RGeo::ImplHelper::BasicMultiPointMethods
|
139
139
|
include ::RGeo::Cartesian::GeometryMethods
|
140
|
-
|
140
|
+
|
141
141
|
Feature::MixinCollection::GLOBAL.for_type(Feature::MultiPoint).include_in_class(self, true)
|
142
|
-
|
143
|
-
|
142
|
+
|
143
|
+
|
144
144
|
end
|
145
|
-
|
146
|
-
|
145
|
+
|
146
|
+
|
147
147
|
class MultiLineStringImpl # :nodoc:
|
148
|
-
|
149
|
-
|
148
|
+
|
149
|
+
|
150
150
|
include ::RGeo::Feature::MultiLineString
|
151
151
|
include ::RGeo::ImplHelper::BasicGeometryMethods
|
152
152
|
include ::RGeo::ImplHelper::BasicGeometryCollectionMethods
|
153
153
|
include ::RGeo::ImplHelper::BasicMultiLineStringMethods
|
154
154
|
include ::RGeo::Cartesian::GeometryMethods
|
155
|
-
|
155
|
+
|
156
156
|
Feature::MixinCollection::GLOBAL.for_type(Feature::MultiLineString).include_in_class(self, true)
|
157
|
-
|
158
|
-
|
157
|
+
|
158
|
+
|
159
159
|
end
|
160
|
-
|
161
|
-
|
160
|
+
|
161
|
+
|
162
162
|
class MultiPolygonImpl # :nodoc:
|
163
|
-
|
164
|
-
|
163
|
+
|
164
|
+
|
165
165
|
include ::RGeo::Feature::MultiPolygon
|
166
166
|
include ::RGeo::ImplHelper::BasicGeometryMethods
|
167
167
|
include ::RGeo::ImplHelper::BasicGeometryCollectionMethods
|
168
168
|
include ::RGeo::ImplHelper::BasicMultiPolygonMethods
|
169
169
|
include ::RGeo::Cartesian::GeometryMethods
|
170
|
-
|
170
|
+
|
171
171
|
Feature::MixinCollection::GLOBAL.for_type(Feature::MultiPolygon).include_in_class(self, true)
|
172
|
-
|
173
|
-
|
172
|
+
|
173
|
+
|
174
174
|
end
|
175
|
-
|
176
|
-
|
175
|
+
|
176
|
+
|
177
177
|
end
|
178
|
-
|
178
|
+
|
179
179
|
end
|