rgeo 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/lib/rgeo/geos.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# GEOS wrapper for RGeo
|
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,8 +35,8 @@
|
|
35
35
|
|
36
36
|
|
37
37
|
module RGeo
|
38
|
-
|
39
|
-
|
38
|
+
|
39
|
+
|
40
40
|
# The Geos module provides general tools for creating and manipulating
|
41
41
|
# a GEOS-backed implementation of the SFS. This is a full implementation
|
42
42
|
# of the SFS using a Cartesian coordinate system. It uses the GEOS C++
|
@@ -45,22 +45,24 @@ module RGeo
|
|
45
45
|
# gem is installed. RGeo feature calls are translated into appropriate
|
46
46
|
# GEOS calls and directed to the library's C api. RGeo also corrects a
|
47
47
|
# few cases of missing or non-standard behavior in GEOS.
|
48
|
-
#
|
48
|
+
#
|
49
49
|
# This module also provides a namespace for the implementation classes
|
50
50
|
# themselves; however, those classes are meant to be opaque and are
|
51
51
|
# therefore not documented.
|
52
|
-
#
|
52
|
+
#
|
53
53
|
# To use the Geos implementation, first obtain a factory using the
|
54
54
|
# ::RGeo::Geos.factory method. You may then call any of the standard
|
55
55
|
# factory methods on the resulting object.
|
56
|
-
|
56
|
+
|
57
57
|
module Geos
|
58
58
|
end
|
59
|
-
|
60
|
-
|
59
|
+
|
60
|
+
|
61
61
|
end
|
62
62
|
|
63
63
|
|
64
|
+
# :stopdoc:
|
65
|
+
|
64
66
|
# Implementation files
|
65
67
|
require 'rgeo/geos/factory'
|
66
68
|
require 'rgeo/geos/interface'
|
@@ -73,18 +75,21 @@ require 'rgeo/geos/ffi_classes'
|
|
73
75
|
require 'rgeo/geos/zm_factory'
|
74
76
|
require 'rgeo/geos/zm_impl'
|
75
77
|
|
76
|
-
#
|
77
|
-
|
78
|
-
# Determine native interface support.
|
78
|
+
# Determine ffi support.
|
79
79
|
begin
|
80
80
|
require 'ffi-geos'
|
81
81
|
::RGeo::Geos::FFI_SUPPORTED = true
|
82
|
+
::RGeo::Geos::FFIUtils._init
|
82
83
|
rescue ::LoadError
|
83
84
|
::RGeo::Geos::FFI_SUPPORTED = false
|
84
85
|
rescue
|
85
86
|
::RGeo::Geos::FFI_SUPPORTED = false
|
86
87
|
end
|
88
|
+
|
89
|
+
# Determine capi support.
|
87
90
|
::RGeo::Geos::CAPI_SUPPORTED = ::RGeo::Geos::Factory.respond_to?(:_create) ? true : false
|
91
|
+
|
92
|
+
# Determine preferred native interface
|
88
93
|
if ::RGeo::Geos::CAPI_SUPPORTED
|
89
94
|
::RGeo::Geos.preferred_native_interface = :capi
|
90
95
|
elsif ::RGeo::Geos::FFI_SUPPORTED
|
data/lib/rgeo/geos/factory.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# GEOS 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,30 +35,30 @@
|
|
35
35
|
|
36
36
|
|
37
37
|
module RGeo
|
38
|
-
|
38
|
+
|
39
39
|
module Geos
|
40
|
-
|
41
|
-
|
40
|
+
|
41
|
+
|
42
42
|
# This the GEOS CAPI implementation of ::RGeo::Feature::Factory.
|
43
|
-
|
43
|
+
|
44
44
|
class Factory
|
45
|
-
|
46
|
-
|
45
|
+
|
46
|
+
|
47
47
|
include Feature::Factory::Instance
|
48
|
-
|
49
|
-
|
48
|
+
|
49
|
+
|
50
50
|
class << self
|
51
|
-
|
52
|
-
|
51
|
+
|
52
|
+
|
53
53
|
# Create a new factory. Returns nil if the GEOS CAPI implementation
|
54
54
|
# is not supported.
|
55
|
-
#
|
55
|
+
#
|
56
56
|
# See ::RGeo::Geos.factory for a list of supported options.
|
57
|
-
|
57
|
+
|
58
58
|
def create(opts_={})
|
59
59
|
# Make sure GEOS is available
|
60
60
|
return nil unless respond_to?(:_create)
|
61
|
-
|
61
|
+
|
62
62
|
# Get flags to pass to the C extension
|
63
63
|
flags_ = 0
|
64
64
|
flags_ |= 1 if opts_[:lenient_multi_polygon_assertions] || opts_[:uses_lenient_multi_polygon_assertions]
|
@@ -68,11 +68,11 @@ module RGeo
|
|
68
68
|
raise Error::UnsupportedOperation, "GEOS cannot support both Z and M coordinates at the same time."
|
69
69
|
end
|
70
70
|
flags_ |= 8 unless opts_[:auto_prepare] == :disabled
|
71
|
-
|
71
|
+
|
72
72
|
# Buffer resolution
|
73
73
|
buffer_resolution_ = opts_[:buffer_resolution].to_i
|
74
74
|
buffer_resolution_ = 1 if buffer_resolution_ < 1
|
75
|
-
|
75
|
+
|
76
76
|
# Interpret the generator options
|
77
77
|
wkt_generator_ = opts_[:wkt_generator]
|
78
78
|
case wkt_generator_
|
@@ -92,7 +92,7 @@ module RGeo
|
|
92
92
|
else
|
93
93
|
wkb_generator_ = WKRep::WKBGenerator.new
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
# Coordinate system (srid, proj4, and coord_sys)
|
97
97
|
srid_ = opts_[:srid]
|
98
98
|
proj4_ = opts_[:proj4]
|
@@ -115,10 +115,10 @@ module RGeo
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
srid_ ||= coord_sys_.authority_code if coord_sys_
|
118
|
-
|
118
|
+
|
119
119
|
# Create the factory and set instance variables
|
120
120
|
result_ = _create(flags_, srid_.to_i, buffer_resolution_, wkt_generator_, wkb_generator_)
|
121
|
-
|
121
|
+
|
122
122
|
# Interpret parser options
|
123
123
|
wkt_parser_ = opts_[:wkt_parser]
|
124
124
|
case wkt_parser_
|
@@ -138,7 +138,7 @@ module RGeo
|
|
138
138
|
else
|
139
139
|
wkb_parser_ = WKRep::WKBParser.new(result_)
|
140
140
|
end
|
141
|
-
|
141
|
+
|
142
142
|
# Set instance variables
|
143
143
|
result_.instance_variable_set(:@proj4, proj4_)
|
144
144
|
result_.instance_variable_set(:@coord_sys, coord_sys_)
|
@@ -146,55 +146,55 @@ module RGeo
|
|
146
146
|
result_.instance_variable_set(:@wkb_parser, wkb_parser_)
|
147
147
|
result_.instance_variable_set(:@wkt_generator, wkt_generator_)
|
148
148
|
result_.instance_variable_set(:@wkb_generator, wkb_generator_)
|
149
|
-
|
149
|
+
|
150
150
|
# Return the result
|
151
151
|
result_
|
152
152
|
end
|
153
153
|
alias_method :new, :create
|
154
|
-
|
155
|
-
|
154
|
+
|
155
|
+
|
156
156
|
end
|
157
|
-
|
158
|
-
|
157
|
+
|
158
|
+
|
159
159
|
def inspect # :nodoc:
|
160
160
|
"#<#{self.class}:0x#{object_id.to_s(16)} srid=#{_srid} bufres=#{_buffer_resolution} flags=#{_flags}>"
|
161
161
|
end
|
162
|
-
|
163
|
-
|
162
|
+
|
163
|
+
|
164
164
|
# Factory equivalence test.
|
165
|
-
|
165
|
+
|
166
166
|
def eql?(rhs_)
|
167
167
|
rhs_.is_a?(Factory) && rhs_.srid == _srid &&
|
168
168
|
rhs_._buffer_resolution == _buffer_resolution && rhs_._flags == _flags &&
|
169
169
|
rhs_.proj4 == @proj4
|
170
170
|
end
|
171
171
|
alias_method :==, :eql?
|
172
|
-
|
173
|
-
|
172
|
+
|
173
|
+
|
174
174
|
# Returns the SRID of geometries created by this factory.
|
175
|
-
|
175
|
+
|
176
176
|
def srid
|
177
177
|
_srid
|
178
178
|
end
|
179
|
-
|
180
|
-
|
179
|
+
|
180
|
+
|
181
181
|
# Returns the resolution used by buffer calculations on geometries
|
182
182
|
# created by this factory
|
183
|
-
|
183
|
+
|
184
184
|
def buffer_resolution
|
185
185
|
_buffer_resolution
|
186
186
|
end
|
187
|
-
|
188
|
-
|
187
|
+
|
188
|
+
|
189
189
|
# Returns true if this factory is lenient with MultiPolygon assertions
|
190
|
-
|
190
|
+
|
191
191
|
def lenient_multi_polygon_assertions?
|
192
192
|
_flags & 0x1 != 0
|
193
193
|
end
|
194
|
-
|
195
|
-
|
194
|
+
|
195
|
+
|
196
196
|
# See ::RGeo::Feature::Factory#property
|
197
|
-
|
197
|
+
|
198
198
|
def property(name_)
|
199
199
|
case name_
|
200
200
|
when :has_z_coordinate
|
@@ -213,10 +213,10 @@ module RGeo
|
|
213
213
|
nil
|
214
214
|
end
|
215
215
|
end
|
216
|
-
|
217
|
-
|
216
|
+
|
217
|
+
|
218
218
|
# See ::RGeo::Feature::Factory#parse_wkt
|
219
|
-
|
219
|
+
|
220
220
|
def parse_wkt(str_)
|
221
221
|
if @wkt_parser
|
222
222
|
@wkt_parser.parse(str_)
|
@@ -224,10 +224,10 @@ module RGeo
|
|
224
224
|
_parse_wkt_impl(str_)
|
225
225
|
end
|
226
226
|
end
|
227
|
-
|
228
|
-
|
227
|
+
|
228
|
+
|
229
229
|
# See ::RGeo::Feature::Factory#parse_wkb
|
230
|
-
|
230
|
+
|
231
231
|
def parse_wkb(str_)
|
232
232
|
if @wkb_parser
|
233
233
|
@wkb_parser.parse(str_)
|
@@ -235,10 +235,10 @@ module RGeo
|
|
235
235
|
_parse_wkb_impl(str_)
|
236
236
|
end
|
237
237
|
end
|
238
|
-
|
239
|
-
|
238
|
+
|
239
|
+
|
240
240
|
# See ::RGeo::Feature::Factory#point
|
241
|
-
|
241
|
+
|
242
242
|
def point(x_, y_, *extra_)
|
243
243
|
if extra_.length > (_flags & 6 == 0 ? 0 : 1)
|
244
244
|
nil
|
@@ -246,87 +246,87 @@ module RGeo
|
|
246
246
|
PointImpl.create(self, x_, y_, extra_[0].to_f) rescue nil
|
247
247
|
end
|
248
248
|
end
|
249
|
-
|
250
|
-
|
249
|
+
|
250
|
+
|
251
251
|
# See ::RGeo::Feature::Factory#line_string
|
252
|
-
|
252
|
+
|
253
253
|
def line_string(points_)
|
254
254
|
points_ = points_.to_a unless points_.kind_of?(::Array)
|
255
255
|
LineStringImpl.create(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.create(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
|
points_ = points_.to_a unless points_.kind_of?(::Array)
|
270
270
|
LinearRingImpl.create(self, points_) rescue nil
|
271
271
|
end
|
272
|
-
|
273
|
-
|
272
|
+
|
273
|
+
|
274
274
|
# See ::RGeo::Feature::Factory#polygon
|
275
|
-
|
275
|
+
|
276
276
|
def polygon(outer_ring_, inner_rings_=nil)
|
277
277
|
inner_rings_ = inner_rings_.to_a unless inner_rings_.kind_of?(::Array)
|
278
278
|
PolygonImpl.create(self, outer_ring_, inner_rings_) rescue nil
|
279
279
|
end
|
280
|
-
|
281
|
-
|
280
|
+
|
281
|
+
|
282
282
|
# See ::RGeo::Feature::Factory#collection
|
283
|
-
|
283
|
+
|
284
284
|
def collection(elems_)
|
285
285
|
elems_ = elems_.to_a unless elems_.kind_of?(::Array)
|
286
286
|
GeometryCollectionImpl.create(self, elems_) rescue nil
|
287
287
|
end
|
288
|
-
|
289
|
-
|
288
|
+
|
289
|
+
|
290
290
|
# See ::RGeo::Feature::Factory#multi_point
|
291
|
-
|
291
|
+
|
292
292
|
def multi_point(elems_)
|
293
293
|
elems_ = elems_.to_a unless elems_.kind_of?(::Array)
|
294
294
|
MultiPointImpl.create(self, elems_) rescue nil
|
295
295
|
end
|
296
|
-
|
297
|
-
|
296
|
+
|
297
|
+
|
298
298
|
# See ::RGeo::Feature::Factory#multi_line_string
|
299
|
-
|
299
|
+
|
300
300
|
def multi_line_string(elems_)
|
301
301
|
elems_ = elems_.to_a unless elems_.kind_of?(::Array)
|
302
302
|
MultiLineStringImpl.create(self, elems_) rescue nil
|
303
303
|
end
|
304
|
-
|
305
|
-
|
304
|
+
|
305
|
+
|
306
306
|
# See ::RGeo::Feature::Factory#multi_polygon
|
307
|
-
|
307
|
+
|
308
308
|
def multi_polygon(elems_)
|
309
309
|
elems_ = elems_.to_a unless elems_.kind_of?(::Array)
|
310
310
|
MultiPolygonImpl.create(self, elems_) rescue nil
|
311
311
|
end
|
312
|
-
|
313
|
-
|
312
|
+
|
313
|
+
|
314
314
|
# See ::RGeo::Feature::Factory#proj4
|
315
|
-
|
315
|
+
|
316
316
|
def proj4
|
317
317
|
@proj4
|
318
318
|
end
|
319
|
-
|
320
|
-
|
319
|
+
|
320
|
+
|
321
321
|
# See ::RGeo::Feature::Factory#coord_sys
|
322
|
-
|
322
|
+
|
323
323
|
def coord_sys
|
324
324
|
@coord_sys
|
325
325
|
end
|
326
|
-
|
327
|
-
|
326
|
+
|
327
|
+
|
328
328
|
# See ::RGeo::Feature::Factory#override_cast
|
329
|
-
|
329
|
+
|
330
330
|
def override_cast(original_, ntype_, flags_)
|
331
331
|
return nil unless Geos.supported?
|
332
332
|
keep_subtype_ = flags_[:keep_subtype]
|
@@ -365,11 +365,11 @@ module RGeo
|
|
365
365
|
end
|
366
366
|
false
|
367
367
|
end
|
368
|
-
|
369
|
-
|
368
|
+
|
369
|
+
|
370
370
|
end
|
371
|
-
|
372
|
-
|
371
|
+
|
372
|
+
|
373
373
|
end
|
374
|
-
|
374
|
+
|
375
375
|
end
|