rgeo 1.1.2 → 2.0.0
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.
- checksums.yaml +4 -4
- data/ext/geos_c_impl/extconf.rb +5 -3
- data/ext/geos_c_impl/factory.c +4 -4
- data/ext/geos_c_impl/geometry.c +1 -1
- data/lib/rgeo.rb +2 -4
- data/lib/rgeo/cartesian.rb +6 -16
- data/lib/rgeo/cartesian/analysis.rb +22 -20
- data/lib/rgeo/cartesian/bounding_box.rb +83 -79
- data/lib/rgeo/cartesian/calculations.rb +40 -38
- data/lib/rgeo/cartesian/factory.rb +134 -169
- data/lib/rgeo/cartesian/feature_classes.rb +2 -18
- data/lib/rgeo/cartesian/feature_methods.rb +37 -39
- data/lib/rgeo/cartesian/interface.rb +11 -9
- data/lib/rgeo/coord_sys.rb +9 -8
- data/lib/rgeo/coord_sys/cs/entities.rb +345 -303
- data/lib/rgeo/coord_sys/cs/factories.rb +30 -28
- data/lib/rgeo/coord_sys/cs/wkt_parser.rb +128 -126
- data/lib/rgeo/coord_sys/srs_database/{interface.rb → entry.rb} +26 -32
- data/lib/rgeo/coord_sys/srs_database/sr_org.rb +19 -17
- data/lib/rgeo/coord_sys/srs_database/url_reader.rb +21 -19
- data/lib/rgeo/error.rb +3 -1
- data/lib/rgeo/feature.rb +23 -34
- data/lib/rgeo/feature/curve.rb +2 -0
- data/lib/rgeo/feature/factory.rb +15 -13
- data/lib/rgeo/feature/factory_generator.rb +7 -5
- data/lib/rgeo/feature/geometry.rb +31 -29
- data/lib/rgeo/feature/geometry_collection.rb +6 -4
- data/lib/rgeo/feature/line.rb +2 -0
- data/lib/rgeo/feature/line_string.rb +3 -1
- data/lib/rgeo/feature/linear_ring.rb +2 -0
- data/lib/rgeo/feature/multi_curve.rb +2 -0
- data/lib/rgeo/feature/multi_line_string.rb +2 -0
- data/lib/rgeo/feature/multi_point.rb +2 -0
- data/lib/rgeo/feature/multi_polygon.rb +2 -0
- data/lib/rgeo/feature/multi_surface.rb +2 -0
- data/lib/rgeo/feature/point.rb +2 -0
- data/lib/rgeo/feature/polygon.rb +3 -1
- data/lib/rgeo/feature/surface.rb +2 -0
- data/lib/rgeo/feature/types.rb +107 -103
- data/lib/rgeo/geographic.rb +17 -27
- data/lib/rgeo/geographic/factory.rb +154 -199
- data/lib/rgeo/geographic/interface.rb +141 -137
- data/lib/rgeo/geographic/proj4_projector.rb +28 -23
- data/lib/rgeo/geographic/projected_feature_classes.rb +2 -18
- data/lib/rgeo/geographic/projected_feature_methods.rb +59 -49
- data/lib/rgeo/geographic/projected_window.rb +4 -2
- data/lib/rgeo/geographic/simple_mercator_projector.rb +41 -39
- data/lib/rgeo/geographic/spherical_feature_classes.rb +2 -18
- data/lib/rgeo/geographic/spherical_feature_methods.rb +67 -67
- data/lib/rgeo/geographic/spherical_math.rb +81 -87
- data/lib/rgeo/geos.rb +23 -34
- data/lib/rgeo/geos/capi_factory.rb +106 -135
- data/lib/rgeo/geos/capi_feature_classes.rb +19 -37
- data/lib/rgeo/geos/ffi_factory.rb +276 -297
- data/lib/rgeo/geos/ffi_feature_classes.rb +2 -20
- data/lib/rgeo/geos/ffi_feature_methods.rb +170 -166
- data/lib/rgeo/geos/interface.rb +25 -23
- data/lib/rgeo/geos/utils.rb +47 -39
- data/lib/rgeo/geos/zm_factory.rb +171 -185
- data/lib/rgeo/geos/zm_feature_classes.rb +2 -20
- data/lib/rgeo/geos/zm_feature_methods.rb +76 -72
- data/lib/rgeo/impl_helper.rb +1 -11
- data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +72 -75
- data/lib/rgeo/impl_helper/basic_geometry_methods.rb +21 -23
- data/lib/rgeo/impl_helper/basic_line_string_methods.rb +57 -49
- data/lib/rgeo/impl_helper/basic_point_methods.rb +29 -25
- data/lib/rgeo/impl_helper/basic_polygon_methods.rb +31 -27
- data/lib/rgeo/impl_helper/math.rb +2 -0
- data/lib/rgeo/impl_helper/utils.rb +9 -15
- data/lib/rgeo/version.rb +3 -1
- data/lib/rgeo/wkrep.rb +20 -30
- data/lib/rgeo/wkrep/wkb_generator.rb +87 -84
- data/lib/rgeo/wkrep/wkb_parser.rb +93 -93
- data/lib/rgeo/wkrep/wkt_generator.rb +67 -63
- data/lib/rgeo/wkrep/wkt_parser.rb +172 -168
- metadata +17 -32
- data/lib/rgeo/feature/mixins.rb +0 -143
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# -----------------------------------------------------------------------------
|
2
4
|
#
|
3
5
|
# SRS database interface
|
@@ -15,32 +17,24 @@ module RGeo
|
|
15
17
|
# the proj4 library, or access online databases such as the
|
16
18
|
# spatialreference.org site.
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
# Clears any cache utilized by this database.
|
34
|
-
|
35
|
-
def clear_cache
|
36
|
-
nil
|
37
|
-
end
|
38
|
-
end
|
20
|
+
# Spatial reference system database classes must implement these methods:
|
21
|
+
# get
|
22
|
+
# clear_cache
|
23
|
+
#
|
24
|
+
# See SrOrg and UrlReader for implementations of SRSDatabase classes.
|
25
|
+
#
|
26
|
+
# Retrieve an Entry given an identifier. The identifier is usually
|
27
|
+
# a numeric spatial reference ID (SRID), but could be a string
|
28
|
+
# value for certain database types.
|
29
|
+
# get(identifier)
|
30
|
+
#
|
31
|
+
# Clear any cache utilized by this database.
|
32
|
+
# clear_cache
|
39
33
|
|
34
|
+
module SRSDatabase
|
40
35
|
# An entry in a spatial reference system database.
|
41
36
|
# Every entry has an identifier, but all the other attributes are
|
42
37
|
# optional and may or may not be present depending on the database.
|
43
|
-
|
44
38
|
class Entry
|
45
39
|
# Create an entry.
|
46
40
|
# You must provide an identifier, which may be numeric or a
|
@@ -64,19 +58,19 @@ module RGeo
|
|
64
58
|
# If the authority code is not provided directly, it is taken
|
65
59
|
# from the coord_sys.
|
66
60
|
|
67
|
-
def initialize(
|
68
|
-
@identifier =
|
69
|
-
@authority =
|
70
|
-
@authority_code =
|
71
|
-
@name =
|
72
|
-
@description =
|
73
|
-
@coord_sys =
|
74
|
-
if @coord_sys.is_a?(
|
61
|
+
def initialize(ident, data = {})
|
62
|
+
@identifier = ident
|
63
|
+
@authority = data[:authority]
|
64
|
+
@authority_code = data[:authority_code]
|
65
|
+
@name = data[:name]
|
66
|
+
@description = data[:description]
|
67
|
+
@coord_sys = data[:coord_sys]
|
68
|
+
if @coord_sys.is_a?(String)
|
75
69
|
@coord_sys = CS.create_from_wkt(@coord_sys)
|
76
70
|
end
|
77
|
-
@proj4 =
|
71
|
+
@proj4 = data[:proj4]
|
78
72
|
if @proj4 && CoordSys.check!(:proj4)
|
79
|
-
if @proj4.is_a?(
|
73
|
+
if @proj4.is_a?(String) || @proj4.is_a?(Hash)
|
80
74
|
@proj4 = Proj4.create(@proj4)
|
81
75
|
end
|
82
76
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# -----------------------------------------------------------------------------
|
2
4
|
#
|
3
5
|
# SRS database interface
|
@@ -24,9 +26,9 @@ module RGeo
|
|
24
26
|
# is requested again, the result is served from cache rather
|
25
27
|
# than issuing another HTTP request. Default is false.
|
26
28
|
|
27
|
-
def initialize(
|
28
|
-
@catalog =
|
29
|
-
@cache =
|
29
|
+
def initialize(catalog, opts = {})
|
30
|
+
@catalog = catalog.to_s.downcase
|
31
|
+
@cache = opts[:cache] ? {} : nil
|
30
32
|
end
|
31
33
|
|
32
34
|
# The spatialreference.org catalog used by this database.
|
@@ -35,26 +37,26 @@ module RGeo
|
|
35
37
|
# Retrieve the Entry from a spatialreference.org catalog given an
|
36
38
|
# integer ID.
|
37
39
|
|
38
|
-
def get(
|
39
|
-
|
40
|
-
return @cache[
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
40
|
+
def get(ident)
|
41
|
+
ident = ident.to_s
|
42
|
+
return @cache[ident] if @cache&.include?(ident)
|
43
|
+
coord_sys = nil
|
44
|
+
proj4 = nil
|
45
|
+
Net::HTTP.start("spatialreference.org") do |http|
|
46
|
+
response = http.request_get("/ref/#{@catalog}/#{ident}/ogcwkt/")
|
47
|
+
coord_sys = response.body if response.is_a?(Net::HTTPSuccess)
|
48
|
+
response = http.request_get("/ref/#{@catalog}/#{ident}/proj4/")
|
49
|
+
proj4 = response.body if response.is_a?(Net::HTTPSuccess)
|
48
50
|
end
|
49
|
-
|
50
|
-
@cache[
|
51
|
-
|
51
|
+
result = Entry.new(ident, coord_sys: coord_sys.strip, proj4: proj4.strip)
|
52
|
+
@cache[ident] = result if @cache
|
53
|
+
result
|
52
54
|
end
|
53
55
|
|
54
56
|
# Clear the cache if one exists.
|
55
57
|
|
56
58
|
def clear_cache
|
57
|
-
@cache
|
59
|
+
@cache&.clear
|
58
60
|
end
|
59
61
|
end
|
60
62
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# -----------------------------------------------------------------------------
|
2
4
|
#
|
3
5
|
# SRS database interface
|
@@ -22,40 +24,40 @@ module RGeo
|
|
22
24
|
# is requested again, the result is served from cache rather
|
23
25
|
# than issuing another HTTP request. Default is false.
|
24
26
|
|
25
|
-
def initialize(
|
26
|
-
@cache =
|
27
|
+
def initialize(opts = {})
|
28
|
+
@cache = opts[:cache] ? {} : nil
|
27
29
|
end
|
28
30
|
|
29
31
|
# Retrieve the given URL and return an Entry.
|
30
32
|
# Returns nil if the URL cannot be read as an OGC WKT or Proj4
|
31
33
|
# coordinate system
|
32
34
|
|
33
|
-
def get(
|
34
|
-
|
35
|
-
return @cache[
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
if
|
43
|
-
|
44
|
-
if
|
45
|
-
|
35
|
+
def get(ident)
|
36
|
+
ident = ident.to_s
|
37
|
+
return @cache[ident] if @cache&.include?(ident)
|
38
|
+
uri = URI.parse(ident)
|
39
|
+
result = nil
|
40
|
+
Net::HTTP.start(uri.host, uri.port) do |http|
|
41
|
+
request = uri.path
|
42
|
+
request = "#{request}?#{uri.query}" if uri.query
|
43
|
+
response = http.requestget(request)
|
44
|
+
if response.is_a?(Net::HTTPSuccess)
|
45
|
+
response = response.body.strip
|
46
|
+
if response[0, 1] == "+"
|
47
|
+
result = Entry.new(ident, proj4: response)
|
46
48
|
else
|
47
|
-
|
49
|
+
result = Entry.new(ident, coord_sys: response)
|
48
50
|
end
|
49
51
|
end
|
50
52
|
end
|
51
|
-
@cache[
|
52
|
-
|
53
|
+
@cache[ident] = result if @cache
|
54
|
+
result
|
53
55
|
end
|
54
56
|
|
55
57
|
# Clear the cache if one is present.
|
56
58
|
|
57
59
|
def clear_cache
|
58
|
-
@cache
|
60
|
+
@cache&.clear
|
59
61
|
end
|
60
62
|
end
|
61
63
|
end
|
data/lib/rgeo/error.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# -----------------------------------------------------------------------------
|
2
4
|
#
|
3
5
|
# Error classes for RGeo
|
@@ -9,7 +11,7 @@ module RGeo
|
|
9
11
|
|
10
12
|
module Error
|
11
13
|
# Base class for all RGeo-related exceptions
|
12
|
-
class RGeoError <
|
14
|
+
class RGeoError < RuntimeError
|
13
15
|
end
|
14
16
|
|
15
17
|
# The specified geometry is invalid
|
data/lib/rgeo/feature.rb
CHANGED
@@ -1,41 +1,30 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The Feature module contains interfaces and general tools for
|
4
|
+
# implementations of the Open Geospatial Consortium Simple Features
|
5
|
+
# Specification (SFS), version 1.1.0.
|
2
6
|
#
|
3
|
-
#
|
7
|
+
# Each interface is defined as a module, and is provided primarily for
|
8
|
+
# the sake of documentation. Implementations do not necessarily include
|
9
|
+
# the modules themselves. Therefore, you should not depend on the
|
10
|
+
# kind_of? method to check type. Instead, each interface module will
|
11
|
+
# provide a check_type class method (and a corresponding === operator
|
12
|
+
# to support case-when constructs).
|
4
13
|
#
|
5
|
-
#
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
# to support case-when constructs).
|
18
|
-
#
|
19
|
-
# In addition, a Factory interface is defined here. A factory is an
|
20
|
-
# object that knows how to construct geometry instances for a given
|
21
|
-
# implementation. Each implementation's front-end consists of a way to
|
22
|
-
# create factories. Those factories, in turn, provide the api for
|
23
|
-
# building the features themselves. Note that, like the geometry
|
24
|
-
# modules, the Factory module itself may not actually be included in a
|
25
|
-
# factory implementation.
|
26
|
-
#
|
27
|
-
# Any particular implementation may extend these interfaces to provide
|
28
|
-
# implementation-specific features beyond what is stated in the SFS
|
29
|
-
# itself. The implementation should separately document any such
|
30
|
-
# extensions that it may provide.
|
31
|
-
|
32
|
-
module Feature
|
33
|
-
end
|
34
|
-
end
|
14
|
+
# In addition, a Factory interface is defined here. A factory is an
|
15
|
+
# object that knows how to construct geometry instances for a given
|
16
|
+
# implementation. Each implementation's front-end consists of a way to
|
17
|
+
# create factories. Those factories, in turn, provide the api for
|
18
|
+
# building the features themselves. Note that, like the geometry
|
19
|
+
# modules, the Factory module itself may not actually be included in a
|
20
|
+
# factory implementation.
|
21
|
+
#
|
22
|
+
# Any particular implementation may extend these interfaces to provide
|
23
|
+
# implementation-specific features beyond what is stated in the SFS
|
24
|
+
# itself. The implementation should separately document any such
|
25
|
+
# extensions that it may provide.
|
35
26
|
|
36
|
-
# Implementation files
|
37
27
|
require "rgeo/feature/factory"
|
38
|
-
require "rgeo/feature/mixins"
|
39
28
|
require "rgeo/feature/types"
|
40
29
|
require "rgeo/feature/geometry"
|
41
30
|
require "rgeo/feature/point"
|
data/lib/rgeo/feature/curve.rb
CHANGED
data/lib/rgeo/feature/factory.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# -----------------------------------------------------------------------------
|
2
4
|
#
|
3
5
|
# Feature factory interface
|
@@ -72,21 +74,21 @@ module RGeo
|
|
72
74
|
# information is present about whether the coordinate system is
|
73
75
|
# meant to be so interpreted.
|
74
76
|
|
75
|
-
def property(
|
77
|
+
def property(name)
|
76
78
|
nil
|
77
79
|
end
|
78
80
|
|
79
81
|
# Parse the given string in well-known-text format and return the
|
80
82
|
# resulting feature. Returns nil if the string couldn't be parsed.
|
81
83
|
|
82
|
-
def parse_wkt(
|
84
|
+
def parse_wkt(str)
|
83
85
|
nil
|
84
86
|
end
|
85
87
|
|
86
88
|
# Parse the given string in well-known-binary format and return the
|
87
89
|
# resulting feature. Returns nil if the string couldn't be parsed.
|
88
90
|
|
89
|
-
def parse_wkb(
|
91
|
+
def parse_wkb(str)
|
90
92
|
nil
|
91
93
|
end
|
92
94
|
|
@@ -97,7 +99,7 @@ module RGeo
|
|
97
99
|
# supported. If both Z and M coordinates are supported, Z should
|
98
100
|
# be passed first.
|
99
101
|
|
100
|
-
def point(
|
102
|
+
def point(x, y, *extra)
|
101
103
|
nil
|
102
104
|
end
|
103
105
|
|
@@ -110,7 +112,7 @@ module RGeo
|
|
110
112
|
# result of building geometries from objects of the wrong factory
|
111
113
|
# is undefined.
|
112
114
|
|
113
|
-
def line_string(
|
115
|
+
def line_string(points)
|
114
116
|
nil
|
115
117
|
end
|
116
118
|
|
@@ -123,7 +125,7 @@ module RGeo
|
|
123
125
|
# result of building geometries from objects of the wrong factory
|
124
126
|
# is undefined.
|
125
127
|
|
126
|
-
def line(
|
128
|
+
def line(start, stop)
|
127
129
|
nil
|
128
130
|
end
|
129
131
|
|
@@ -139,7 +141,7 @@ module RGeo
|
|
139
141
|
# result of building geometries from objects of the wrong factory
|
140
142
|
# is undefined.
|
141
143
|
|
142
|
-
def linear_ring(
|
144
|
+
def linear_ring(points)
|
143
145
|
nil
|
144
146
|
end
|
145
147
|
|
@@ -155,7 +157,7 @@ module RGeo
|
|
155
157
|
# result of building geometries from objects of the wrong factory
|
156
158
|
# is undefined.
|
157
159
|
|
158
|
-
def polygon(
|
160
|
+
def polygon(outer_ring, inner_rings = nil)
|
159
161
|
nil
|
160
162
|
end
|
161
163
|
|
@@ -167,7 +169,7 @@ module RGeo
|
|
167
169
|
# result of building geometries from objects of the wrong factory
|
168
170
|
# is undefined.
|
169
171
|
|
170
|
-
def collection(
|
172
|
+
def collection(elems)
|
171
173
|
nil
|
172
174
|
end
|
173
175
|
|
@@ -182,7 +184,7 @@ module RGeo
|
|
182
184
|
# result of building geometries from objects of the wrong factory
|
183
185
|
# is undefined.
|
184
186
|
|
185
|
-
def multi_point(
|
187
|
+
def multi_point(elems)
|
186
188
|
nil
|
187
189
|
end
|
188
190
|
|
@@ -197,7 +199,7 @@ module RGeo
|
|
197
199
|
# result of building geometries from objects of the wrong factory
|
198
200
|
# is undefined.
|
199
201
|
|
200
|
-
def multi_line_string(
|
202
|
+
def multi_line_string(elems)
|
201
203
|
nil
|
202
204
|
end
|
203
205
|
|
@@ -214,7 +216,7 @@ module RGeo
|
|
214
216
|
# result of building geometries from objects of the wrong factory
|
215
217
|
# is undefined.
|
216
218
|
|
217
|
-
def multi_polygon(
|
219
|
+
def multi_polygon(elems)
|
218
220
|
nil
|
219
221
|
end
|
220
222
|
|
@@ -270,7 +272,7 @@ module RGeo
|
|
270
272
|
# algorithm to cast the object. Therefore, by default, you should
|
271
273
|
# return false.
|
272
274
|
|
273
|
-
def override_cast(
|
275
|
+
def override_cast(original, type, flags)
|
274
276
|
false
|
275
277
|
end
|
276
278
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# -----------------------------------------------------------------------------
|
2
4
|
#
|
3
5
|
# Feature factory interface
|
@@ -72,15 +74,15 @@ module RGeo
|
|
72
74
|
# [<tt>:has_m_coordinate</tt>]
|
73
75
|
# Support M coordinates. Default is usually false.
|
74
76
|
|
75
|
-
def call(
|
77
|
+
def call(config = {})
|
76
78
|
nil
|
77
79
|
end
|
78
80
|
|
79
81
|
# Return a new FactoryGenerator that always returns the given
|
80
82
|
# factory.
|
81
83
|
|
82
|
-
def self.single(
|
83
|
-
|
84
|
+
def self.single(factory)
|
85
|
+
proc { |c| factory }
|
84
86
|
end
|
85
87
|
|
86
88
|
# Return a new FactoryGenerator that calls the given delegate, but
|
@@ -88,8 +90,8 @@ module RGeo
|
|
88
90
|
# for configuration values not explicitly specified, and you can
|
89
91
|
# force certain values to override the given configuration.
|
90
92
|
|
91
|
-
def self.decorate(
|
92
|
-
|
93
|
+
def self.decorate(delegate, default_config = {}, force_config = {})
|
94
|
+
proc { |c| delegate_.call(default_config.merge(c).merge(force_config)) }
|
93
95
|
end
|
94
96
|
end
|
95
97
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# -----------------------------------------------------------------------------
|
2
4
|
#
|
3
5
|
# Geometry feature interface
|
@@ -240,7 +242,7 @@ module RGeo
|
|
240
242
|
# this geometry, strictly speaking, the result of comparing objects
|
241
243
|
# from different factories is undefined.
|
242
244
|
|
243
|
-
def equals?(
|
245
|
+
def equals?(another_geometry)
|
244
246
|
raise Error::UnsupportedOperation, "Method Geometry#equals? not defined."
|
245
247
|
end
|
246
248
|
|
@@ -259,7 +261,7 @@ module RGeo
|
|
259
261
|
# this geometry, strictly speaking, the result of comparing objects
|
260
262
|
# from different factories is undefined.
|
261
263
|
|
262
|
-
def disjoint?(
|
264
|
+
def disjoint?(another_geometry)
|
263
265
|
raise Error::UnsupportedOperation, "Method Geometry#disjoint? not defined."
|
264
266
|
end
|
265
267
|
|
@@ -278,7 +280,7 @@ module RGeo
|
|
278
280
|
# this geometry, strictly speaking, the result of comparing objects
|
279
281
|
# from different factories is undefined.
|
280
282
|
|
281
|
-
def intersects?(
|
283
|
+
def intersects?(another_geometry)
|
282
284
|
raise Error::UnsupportedOperation, "Method Geometry#intersects? not defined."
|
283
285
|
end
|
284
286
|
|
@@ -297,7 +299,7 @@ module RGeo
|
|
297
299
|
# this geometry, strictly speaking, the result of comparing objects
|
298
300
|
# from different factories is undefined.
|
299
301
|
|
300
|
-
def touches?(
|
302
|
+
def touches?(another_geometry)
|
301
303
|
raise Error::UnsupportedOperation, "Method Geometry#touches? not defined."
|
302
304
|
end
|
303
305
|
|
@@ -316,7 +318,7 @@ module RGeo
|
|
316
318
|
# this geometry, strictly speaking, the result of comparing objects
|
317
319
|
# from different factories is undefined.
|
318
320
|
|
319
|
-
def crosses?(
|
321
|
+
def crosses?(another_geometry)
|
320
322
|
raise Error::UnsupportedOperation, "Method Geometry#crosses? not defined."
|
321
323
|
end
|
322
324
|
|
@@ -335,7 +337,7 @@ module RGeo
|
|
335
337
|
# this geometry, strictly speaking, the result of comparing objects
|
336
338
|
# from different factories is undefined.
|
337
339
|
|
338
|
-
def within?(
|
340
|
+
def within?(another_geometry)
|
339
341
|
raise Error::UnsupportedOperation, "Method Geometry#within? not defined."
|
340
342
|
end
|
341
343
|
|
@@ -354,7 +356,7 @@ module RGeo
|
|
354
356
|
# this geometry, strictly speaking, the result of comparing objects
|
355
357
|
# from different factories is undefined.
|
356
358
|
|
357
|
-
def contains?(
|
359
|
+
def contains?(another_geometry)
|
358
360
|
raise Error::UnsupportedOperation, "Method Geometry#contains? not defined."
|
359
361
|
end
|
360
362
|
|
@@ -373,7 +375,7 @@ module RGeo
|
|
373
375
|
# this geometry, strictly speaking, the result of comparing objects
|
374
376
|
# from different factories is undefined.
|
375
377
|
|
376
|
-
def overlaps?(
|
378
|
+
def overlaps?(another_geometry)
|
377
379
|
raise Error::UnsupportedOperation, "Method Geometry#overlaps? not defined."
|
378
380
|
end
|
379
381
|
|
@@ -399,7 +401,7 @@ module RGeo
|
|
399
401
|
# this geometry, strictly speaking, the result of comparing objects
|
400
402
|
# from different factories is undefined.
|
401
403
|
|
402
|
-
def relate?(
|
404
|
+
def relate?(another_geometry, _intersection_pattern_matrix_)
|
403
405
|
raise Error::UnsupportedOperation, "Method Geometry#relate not defined."
|
404
406
|
end
|
405
407
|
|
@@ -418,7 +420,7 @@ module RGeo
|
|
418
420
|
# this geometry, strictly speaking, the result of measuring the
|
419
421
|
# distance between objects from different factories is undefined.
|
420
422
|
|
421
|
-
def distance(
|
423
|
+
def distance(another_geometry)
|
422
424
|
raise Error::UnsupportedOperation, "Method Geometry#distance not defined."
|
423
425
|
end
|
424
426
|
|
@@ -464,7 +466,7 @@ module RGeo
|
|
464
466
|
# this geometry, strictly speaking, the result of performing
|
465
467
|
# operations on objects from different factories is undefined.
|
466
468
|
|
467
|
-
def intersection(
|
469
|
+
def intersection(another_geometry)
|
468
470
|
raise Error::UnsupportedOperation, "Method Geometry#intersection not defined."
|
469
471
|
end
|
470
472
|
|
@@ -482,7 +484,7 @@ module RGeo
|
|
482
484
|
# this geometry, strictly speaking, the result of performing
|
483
485
|
# operations on objects from different factories is undefined.
|
484
486
|
|
485
|
-
def union(
|
487
|
+
def union(another_geometry)
|
486
488
|
raise Error::UnsupportedOperation, "Method Geometry#union not defined."
|
487
489
|
end
|
488
490
|
|
@@ -500,7 +502,7 @@ module RGeo
|
|
500
502
|
# this geometry, strictly speaking, the result of performing
|
501
503
|
# operations on objects from different factories is undefined.
|
502
504
|
|
503
|
-
def difference(
|
505
|
+
def difference(another_geometry)
|
504
506
|
raise Error::UnsupportedOperation, "Method Geometry#difference not defined."
|
505
507
|
end
|
506
508
|
|
@@ -518,7 +520,7 @@ module RGeo
|
|
518
520
|
# this geometry, strictly speaking, the result of performing
|
519
521
|
# operations on objects from different factories is undefined.
|
520
522
|
|
521
|
-
def sym_difference(
|
523
|
+
def sym_difference(another_geometry)
|
522
524
|
raise Error::UnsupportedOperation, "Method Geometry#sym_difference not defined."
|
523
525
|
end
|
524
526
|
|
@@ -530,7 +532,7 @@ module RGeo
|
|
530
532
|
# this geometry, strictly speaking, the result of comparing objects
|
531
533
|
# from different factories is undefined.
|
532
534
|
|
533
|
-
def rep_equals?(
|
535
|
+
def rep_equals?(another_geometry)
|
534
536
|
raise Error::UnsupportedOperation, "Method Geometry#rep_equals? not defined."
|
535
537
|
end
|
536
538
|
|
@@ -566,12 +568,12 @@ module RGeo
|
|
566
568
|
# representational equivalence test, this method must fall back on
|
567
569
|
# objective equivalence.
|
568
570
|
|
569
|
-
def eql?(
|
570
|
-
if
|
571
|
+
def eql?(rhs)
|
572
|
+
if rhs.is_a?(RGeo::Feature::Instance)
|
571
573
|
begin
|
572
|
-
rep_equals?(
|
574
|
+
rep_equals?(rhs)
|
573
575
|
rescue Error::UnsupportedOperation
|
574
|
-
equal?(
|
576
|
+
equal?(rhs)
|
575
577
|
end
|
576
578
|
else
|
577
579
|
false
|
@@ -592,12 +594,12 @@ module RGeo
|
|
592
594
|
# test, the == operator must fall back on representational or
|
593
595
|
# objective equivalence.
|
594
596
|
|
595
|
-
def ==(
|
596
|
-
if
|
597
|
+
def ==(rhs)
|
598
|
+
if rhs.is_a?(RGeo::Feature::Instance)
|
597
599
|
begin
|
598
|
-
equals?(
|
600
|
+
equals?(rhs)
|
599
601
|
rescue Error::UnsupportedOperation
|
600
|
-
eql?(
|
602
|
+
eql?(rhs)
|
601
603
|
end
|
602
604
|
else
|
603
605
|
false
|
@@ -609,8 +611,8 @@ module RGeo
|
|
609
611
|
# types is not specified; an implementation may choose to provide
|
610
612
|
# additional capabilities as appropriate.
|
611
613
|
|
612
|
-
def -(
|
613
|
-
difference(
|
614
|
+
def -(rhs)
|
615
|
+
difference(rhs)
|
614
616
|
end
|
615
617
|
|
616
618
|
# If the given rhs is a geometry object, this operator must behave
|
@@ -618,8 +620,8 @@ module RGeo
|
|
618
620
|
# is not specified; an implementation may choose to provide
|
619
621
|
# additional capabilities as appropriate.
|
620
622
|
|
621
|
-
def +(
|
622
|
-
union(
|
623
|
+
def +(rhs)
|
624
|
+
union(rhs)
|
623
625
|
end
|
624
626
|
|
625
627
|
# If the given rhs is a geometry object, this operator must behave
|
@@ -627,8 +629,8 @@ module RGeo
|
|
627
629
|
# types is not specified; an implementation may choose to provide
|
628
630
|
# additional capabilities as appropriate.
|
629
631
|
|
630
|
-
def *(
|
631
|
-
intersection(
|
632
|
+
def *(rhs)
|
633
|
+
intersection(rhs)
|
632
634
|
end
|
633
635
|
end
|
634
636
|
end
|