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
|
# Core calculations in the plane
|
@@ -9,9 +11,9 @@ module RGeo
|
|
9
11
|
# Represents a line segment in the plane.
|
10
12
|
|
11
13
|
class Segment # :nodoc:
|
12
|
-
def initialize(
|
13
|
-
@s =
|
14
|
-
@e =
|
14
|
+
def initialize(start, stop)
|
15
|
+
@s = start
|
16
|
+
@e = stop
|
15
17
|
@sx = @s.x
|
16
18
|
@sy = @s.y
|
17
19
|
@ex = @e.x
|
@@ -30,8 +32,8 @@ module RGeo
|
|
30
32
|
"#{@s} - #{@e}"
|
31
33
|
end
|
32
34
|
|
33
|
-
def eql?(
|
34
|
-
|
35
|
+
def eql?(rhs)
|
36
|
+
rhs.is_a?(Segment) && @s == rhs.s && @e == rhs.e
|
35
37
|
end
|
36
38
|
alias == eql?
|
37
39
|
|
@@ -43,70 +45,70 @@ module RGeo
|
|
43
45
|
# a positive value if the point is to the right, or
|
44
46
|
# 0 if the point is collinear to the segment.
|
45
47
|
|
46
|
-
def side(
|
47
|
-
|
48
|
-
|
49
|
-
(@sx -
|
48
|
+
def side(p)
|
49
|
+
px = p.x
|
50
|
+
py = p.y
|
51
|
+
(@sx - px) * (@ey - py) - (@sy - py) * (@ex - px)
|
50
52
|
end
|
51
53
|
|
52
|
-
def tproj(
|
54
|
+
def tproj(p)
|
53
55
|
if @lensq == 0
|
54
56
|
nil
|
55
57
|
else
|
56
|
-
(@dx * (
|
58
|
+
(@dx * (p.x - @sx) + @dy * (p.y - @sy)) / @lensq
|
57
59
|
end
|
58
60
|
end
|
59
61
|
|
60
|
-
def contains_point?(
|
61
|
-
if side(
|
62
|
-
|
63
|
-
|
62
|
+
def contains_point?(p)
|
63
|
+
if side(p) == 0
|
64
|
+
t = tproj(p)
|
65
|
+
t && t >= 0.0 && t <= 1.0
|
64
66
|
else
|
65
67
|
false
|
66
68
|
end
|
67
69
|
end
|
68
70
|
|
69
|
-
def intersects_segment?(
|
70
|
-
|
71
|
+
def intersects_segment?(seg)
|
72
|
+
s2 = seg.s
|
71
73
|
# Handle degenerate cases
|
72
|
-
if
|
74
|
+
if seg.degenerate?
|
73
75
|
if @lensq == 0
|
74
|
-
return @s ==
|
76
|
+
return @s == s2
|
75
77
|
else
|
76
|
-
return contains_point?(
|
78
|
+
return contains_point?(s2)
|
77
79
|
end
|
78
80
|
elsif @lensq == 0
|
79
|
-
return
|
81
|
+
return seg.contains_point?(@s)
|
80
82
|
end
|
81
83
|
# Both segments have nonzero length.
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
if
|
84
|
+
sx2 = s2.x
|
85
|
+
sy2 = s2.y
|
86
|
+
dx2 = seg.dx
|
87
|
+
dy2 = seg.dy
|
88
|
+
denom = @dx * dy2 - @dy * dx2
|
89
|
+
if denom == 0
|
88
90
|
# Segments are parallel. Make sure they are collinear.
|
89
|
-
return false unless side(
|
91
|
+
return false unless side(s2) == 0
|
90
92
|
# 1-D check.
|
91
|
-
|
92
|
-
|
93
|
-
if
|
94
|
-
|
93
|
+
ts = (@dx * (sx2 - @sx) + @dy * (sy2 - @sy)) / @lensq
|
94
|
+
te = (@dx * (sx2 + dx2 - @sx) + @dy * (sy2 + dy2 - @sy)) / @lensq
|
95
|
+
if ts < te
|
96
|
+
te >= 0.0 && ts <= 1.0
|
95
97
|
else
|
96
|
-
|
98
|
+
ts >= 0.0 && te <= 1.0
|
97
99
|
end
|
98
100
|
else
|
99
101
|
# Segments are not parallel. Check the intersection of their
|
100
102
|
# containing lines.
|
101
|
-
|
102
|
-
return false if
|
103
|
-
|
104
|
-
|
103
|
+
t = (dy2 * (sx2 - @sx) + dx2 * (@sy - sy2)) / denom
|
104
|
+
return false if t < 0.0 || t > 1.0
|
105
|
+
t2 = (@dy * (sx2 - @sx) + @dx * (@sy - sy2)) / denom
|
106
|
+
t2 >= 0.0 && t2 <= 1.0
|
105
107
|
end
|
106
108
|
end
|
107
109
|
|
108
110
|
def length
|
109
|
-
|
111
|
+
Math.sqrt(@lensq)
|
110
112
|
end
|
111
113
|
end
|
112
114
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# -----------------------------------------------------------------------------
|
2
4
|
#
|
3
5
|
# Geographic data factory implementation
|
@@ -11,67 +13,64 @@ module RGeo
|
|
11
13
|
|
12
14
|
class Factory
|
13
15
|
include Feature::Factory::Instance
|
16
|
+
include ImplHelper::Utils
|
14
17
|
|
15
18
|
# Create a new simple cartesian factory.
|
16
19
|
#
|
17
20
|
# See RGeo::Cartesian.simple_factory for a list of supported options.
|
18
21
|
|
19
|
-
def initialize(
|
20
|
-
@has_z =
|
21
|
-
@has_m =
|
22
|
-
@proj4 =
|
22
|
+
def initialize(opts = {})
|
23
|
+
@has_z = opts[:has_z_coordinate] ? true : false
|
24
|
+
@has_m = opts[:has_m_coordinate] ? true : false
|
25
|
+
@proj4 = opts[:proj4]
|
23
26
|
if @proj4 && CoordSys.check!(:proj4)
|
24
|
-
if @proj4.is_a?(
|
27
|
+
if @proj4.is_a?(String) || @proj4.is_a?(Hash)
|
25
28
|
@proj4 = CoordSys::Proj4.create(@proj4)
|
26
29
|
end
|
27
30
|
end
|
28
|
-
|
29
|
-
@coord_sys =
|
30
|
-
if @coord_sys.is_a?(
|
31
|
-
@coord_sys =
|
32
|
-
CoordSys::CS.create_from_wkt(@coord_sys)
|
33
|
-
rescue
|
34
|
-
nil
|
35
|
-
end
|
31
|
+
srid = opts[:srid]
|
32
|
+
@coord_sys = opts[:coord_sys]
|
33
|
+
if @coord_sys.is_a?(String)
|
34
|
+
@coord_sys = CoordSys::CS.create_from_wkt(@coord_sys)
|
36
35
|
end
|
37
|
-
if (!@proj4 || !@coord_sys) &&
|
38
|
-
|
39
|
-
if
|
40
|
-
@proj4 ||=
|
41
|
-
@coord_sys ||=
|
36
|
+
if (!@proj4 || !@coord_sys) && srid && (db = opts[:srs_database])
|
37
|
+
entry = db.get(srid.to_i)
|
38
|
+
if entry
|
39
|
+
@proj4 ||= entry.proj4
|
40
|
+
@coord_sys ||= entry.coord_sys
|
42
41
|
end
|
43
42
|
end
|
44
|
-
|
45
|
-
@srid =
|
46
|
-
@lenient_assertions =
|
47
|
-
@buffer_resolution =
|
43
|
+
srid ||= @coord_sys.authority_code if @coord_sys
|
44
|
+
@srid = srid.to_i
|
45
|
+
@lenient_assertions = opts[:uses_lenient_assertions] ? true : false
|
46
|
+
@buffer_resolution = opts[:buffer_resolution].to_i
|
48
47
|
@buffer_resolution = 1 if @buffer_resolution < 1
|
49
48
|
|
50
|
-
|
51
|
-
case
|
52
|
-
when
|
53
|
-
@wkt_generator = WKRep::WKTGenerator.new(
|
49
|
+
wkt_generator = opts[:wkt_generator]
|
50
|
+
case wkt_generator
|
51
|
+
when Hash
|
52
|
+
@wkt_generator = WKRep::WKTGenerator.new(wkt_generator)
|
54
53
|
else
|
55
54
|
@wkt_generator = WKRep::WKTGenerator.new(convert_case: :upper)
|
56
55
|
end
|
57
|
-
|
58
|
-
case
|
59
|
-
when
|
60
|
-
@wkb_generator = WKRep::WKBGenerator.new(
|
56
|
+
wkb_generator = opts[:wkb_generator]
|
57
|
+
case wkb_generator
|
58
|
+
when Hash
|
59
|
+
@wkb_generator = WKRep::WKBGenerator.new(wkb_generator)
|
61
60
|
else
|
62
61
|
@wkb_generator = WKRep::WKBGenerator.new
|
63
62
|
end
|
64
|
-
|
65
|
-
case
|
66
|
-
when
|
67
|
-
@wkt_parser = WKRep::WKTParser.new(self,
|
63
|
+
wkt_parser = opts[:wkt_parser]
|
64
|
+
case wkt_parser
|
65
|
+
when Hash
|
66
|
+
@wkt_parser = WKRep::WKTParser.new(self, wkt_parser)
|
68
67
|
else
|
69
68
|
@wkt_parser = WKRep::WKTParser.new(self)
|
70
69
|
end
|
71
|
-
|
72
|
-
case
|
73
|
-
when
|
74
|
-
@wkb_parser = WKRep::WKBParser.new(self,
|
70
|
+
wkb_parser = opts[:wkb_parser]
|
71
|
+
case wkb_parser
|
72
|
+
when Hash
|
73
|
+
@wkb_parser = WKRep::WKBParser.new(self, wkb_parser)
|
75
74
|
else
|
76
75
|
@wkb_parser = WKRep::WKBParser.new(self)
|
77
76
|
end
|
@@ -79,11 +78,11 @@ module RGeo
|
|
79
78
|
|
80
79
|
# Equivalence test.
|
81
80
|
|
82
|
-
def eql?(
|
83
|
-
|
84
|
-
@has_z ==
|
85
|
-
@has_m ==
|
86
|
-
@proj4.eql?(
|
81
|
+
def eql?(rhs)
|
82
|
+
rhs.is_a?(self.class) && @srid == rhs.srid &&
|
83
|
+
@has_z == rhs.property(:has_z_coordinate) &&
|
84
|
+
@has_m == rhs.property(:has_m_coordinate) &&
|
85
|
+
@proj4.eql?(rhs.proj4)
|
87
86
|
end
|
88
87
|
alias == eql?
|
89
88
|
|
@@ -100,10 +99,10 @@ module RGeo
|
|
100
99
|
"hasz" => @has_z,
|
101
100
|
"hasm" => @has_m,
|
102
101
|
"srid" => @srid,
|
103
|
-
"wktg" => @wkt_generator.
|
104
|
-
"wkbg" => @wkb_generator.
|
105
|
-
"wktp" => @wkt_parser.
|
106
|
-
"wkbp" => @wkb_parser.
|
102
|
+
"wktg" => @wkt_generator.properties,
|
103
|
+
"wkbg" => @wkb_generator.properties,
|
104
|
+
"wktp" => @wkt_parser.properties,
|
105
|
+
"wkbp" => @wkb_parser.properties,
|
107
106
|
"lena" => @lenient_assertions,
|
108
107
|
"bufr" => @buffer_resolution
|
109
108
|
}
|
@@ -112,79 +111,79 @@ module RGeo
|
|
112
111
|
hash_
|
113
112
|
end
|
114
113
|
|
115
|
-
def marshal_load(
|
116
|
-
if (
|
117
|
-
|
118
|
-
|
114
|
+
def marshal_load(data) # :nodoc:
|
115
|
+
if (proj4_data = data["proj4"]) && CoordSys.check!(:proj4)
|
116
|
+
proj4 = CoordSys::Proj4.allocate
|
117
|
+
proj4.marshal_load(proj4_data)
|
119
118
|
else
|
120
|
-
|
119
|
+
proj4 = nil
|
121
120
|
end
|
122
|
-
if (
|
123
|
-
|
121
|
+
if (coord_sys_data = data["cs"])
|
122
|
+
coord_sys = CoordSys::CS.create_from_wkt(coord_sys_data)
|
124
123
|
else
|
125
|
-
|
124
|
+
coord_sys = nil
|
126
125
|
end
|
127
126
|
initialize(
|
128
|
-
has_z_coordinate:
|
129
|
-
has_m_coordinate:
|
130
|
-
srid:
|
131
|
-
wkt_generator:
|
132
|
-
wkb_generator:
|
133
|
-
wkt_parser:
|
134
|
-
wkb_parser:
|
135
|
-
uses_lenient_assertions:
|
136
|
-
buffer_resolution:
|
137
|
-
proj4:
|
138
|
-
coord_sys:
|
127
|
+
has_z_coordinate: data["hasz"],
|
128
|
+
has_m_coordinate: data["hasm"],
|
129
|
+
srid: data["srid"],
|
130
|
+
wkt_generator: symbolize_hash(data["wktg"]),
|
131
|
+
wkb_generator: symbolize_hash(data["wkbg"]),
|
132
|
+
wkt_parser: symbolize_hash(data["wktp"]),
|
133
|
+
wkb_parser: symbolize_hash(data["wkbp"]),
|
134
|
+
uses_lenient_assertions: data["lena"],
|
135
|
+
buffer_resolution: data["bufr"],
|
136
|
+
proj4: proj4,
|
137
|
+
coord_sys: coord_sys
|
139
138
|
)
|
140
139
|
end
|
141
140
|
|
142
141
|
# Psych support
|
143
142
|
|
144
|
-
def encode_with(
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
143
|
+
def encode_with(coder) # :nodoc:
|
144
|
+
coder["has_z_coordinate"] = @has_z
|
145
|
+
coder["has_m_coordinate"] = @has_m
|
146
|
+
coder["srid"] = @srid
|
147
|
+
coder["lenient_assertions"] = @lenient_assertions
|
148
|
+
coder["buffer_resolution"] = @buffer_resolution
|
149
|
+
coder["wkt_generator"] = @wkt_generator.properties
|
150
|
+
coder["wkb_generator"] = @wkb_generator.properties
|
151
|
+
coder["wkt_parser"] = @wkt_parser.properties
|
152
|
+
coder["wkb_parser"] = @wkb_parser.properties
|
154
153
|
if @proj4
|
155
|
-
|
156
|
-
|
154
|
+
str = @proj4.original_str || @proj4.canonical_str
|
155
|
+
coder["proj4"] = @proj4.radians? ? { "proj4" => str, "radians" => true } : str
|
157
156
|
end
|
158
|
-
|
157
|
+
coder["coord_sys"] = @coord_sys.to_wkt if @coord_sys
|
159
158
|
end
|
160
159
|
|
161
|
-
def init_with(
|
162
|
-
if (
|
163
|
-
if
|
164
|
-
|
160
|
+
def init_with(coder) # :nodoc:
|
161
|
+
if (proj4_data = coder["proj4"]) && CoordSys.check!(:proj4)
|
162
|
+
if proj4_data.is_a?(Hash)
|
163
|
+
proj4 = CoordSys::Proj4.create(proj4_data["proj4"], radians: proj4_data["radians"])
|
165
164
|
else
|
166
|
-
|
165
|
+
proj4 = CoordSys::Proj4.create(proj4_data.to_s)
|
167
166
|
end
|
168
167
|
else
|
169
|
-
|
168
|
+
proj4 = nil
|
170
169
|
end
|
171
|
-
if (
|
172
|
-
|
170
|
+
if (coord_sys_data = coder["cs"])
|
171
|
+
coord_sys = CoordSys::CS.create_from_wkt(coord_sys_data.to_s)
|
173
172
|
else
|
174
|
-
|
173
|
+
coord_sys = nil
|
175
174
|
end
|
176
175
|
initialize(
|
177
|
-
has_z_coordinate:
|
178
|
-
has_m_coordinate:
|
179
|
-
srid:
|
180
|
-
wkt_generator:
|
181
|
-
wkb_generator:
|
182
|
-
wkt_parser:
|
183
|
-
wkb_parser:
|
184
|
-
uses_lenient_assertions:
|
185
|
-
buffer_resolution:
|
186
|
-
proj4:
|
187
|
-
coord_sys:
|
176
|
+
has_z_coordinate: coder["has_z_coordinate"],
|
177
|
+
has_m_coordinate: coder["has_m_coordinate"],
|
178
|
+
srid: coder["srid"],
|
179
|
+
wkt_generator: symbolize_hash(coder["wkt_generator"]),
|
180
|
+
wkb_generator: symbolize_hash(coder["wkb_generator"]),
|
181
|
+
wkt_parser: symbolize_hash(coder["wkt_parser"]),
|
182
|
+
wkb_parser: symbolize_hash(coder["wkb_parser"]),
|
183
|
+
uses_lenient_assertions: coder["lenient_assertions"],
|
184
|
+
buffer_resolution: coder["buffer_resolution"],
|
185
|
+
proj4: proj4,
|
186
|
+
coord_sys: coord_sys
|
188
187
|
)
|
189
188
|
end
|
190
189
|
|
@@ -194,8 +193,8 @@ module RGeo
|
|
194
193
|
|
195
194
|
# See RGeo::Feature::Factory#property
|
196
195
|
|
197
|
-
def property(
|
198
|
-
case
|
196
|
+
def property(name)
|
197
|
+
case name
|
199
198
|
when :has_z_coordinate
|
200
199
|
@has_z
|
201
200
|
when :has_m_coordinate
|
@@ -211,86 +210,68 @@ module RGeo
|
|
211
210
|
|
212
211
|
# See RGeo::Feature::Factory#parse_wkt
|
213
212
|
|
214
|
-
def parse_wkt(
|
215
|
-
@wkt_parser.parse(
|
213
|
+
def parse_wkt(str)
|
214
|
+
@wkt_parser.parse(str)
|
216
215
|
end
|
217
216
|
|
218
217
|
# See RGeo::Feature::Factory#parse_wkb
|
219
218
|
|
220
|
-
def parse_wkb(
|
221
|
-
@wkb_parser.parse(
|
219
|
+
def parse_wkb(str)
|
220
|
+
@wkb_parser.parse(str)
|
222
221
|
end
|
223
222
|
|
224
223
|
# See RGeo::Feature::Factory#point
|
225
224
|
|
226
|
-
def point(
|
227
|
-
PointImpl.new(self,
|
228
|
-
rescue
|
229
|
-
nil
|
225
|
+
def point(x, y, *extra)
|
226
|
+
PointImpl.new(self, x, y, *extra)
|
230
227
|
end
|
231
228
|
|
232
229
|
# See RGeo::Feature::Factory#line_string
|
233
230
|
|
234
|
-
def line_string(
|
235
|
-
LineStringImpl.new(self,
|
236
|
-
rescue
|
237
|
-
nil
|
231
|
+
def line_string(points)
|
232
|
+
LineStringImpl.new(self, points)
|
238
233
|
end
|
239
234
|
|
240
235
|
# See RGeo::Feature::Factory#line
|
241
236
|
|
242
|
-
def line(
|
243
|
-
LineImpl.new(self,
|
244
|
-
rescue
|
245
|
-
nil
|
237
|
+
def line(start, stop)
|
238
|
+
LineImpl.new(self, start, stop)
|
246
239
|
end
|
247
240
|
|
248
241
|
# See RGeo::Feature::Factory#linear_ring
|
249
242
|
|
250
|
-
def linear_ring(
|
251
|
-
LinearRingImpl.new(self,
|
252
|
-
rescue
|
253
|
-
nil
|
243
|
+
def linear_ring(points)
|
244
|
+
LinearRingImpl.new(self, points)
|
254
245
|
end
|
255
246
|
|
256
247
|
# See RGeo::Feature::Factory#polygon
|
257
248
|
|
258
|
-
def polygon(
|
259
|
-
PolygonImpl.new(self,
|
260
|
-
rescue
|
261
|
-
nil
|
249
|
+
def polygon(outer_ring, inner_rings = nil)
|
250
|
+
PolygonImpl.new(self, outer_ring, inner_rings)
|
262
251
|
end
|
263
252
|
|
264
253
|
# See RGeo::Feature::Factory#collection
|
265
254
|
|
266
|
-
def collection(
|
267
|
-
GeometryCollectionImpl.new(self,
|
268
|
-
rescue
|
269
|
-
nil
|
255
|
+
def collection(elems)
|
256
|
+
GeometryCollectionImpl.new(self, elems)
|
270
257
|
end
|
271
258
|
|
272
259
|
# See RGeo::Feature::Factory#multi_point
|
273
260
|
|
274
|
-
def multi_point(
|
275
|
-
MultiPointImpl.new(self,
|
276
|
-
rescue
|
277
|
-
nil
|
261
|
+
def multi_point(elems)
|
262
|
+
MultiPointImpl.new(self, elems)
|
278
263
|
end
|
279
264
|
|
280
265
|
# See RGeo::Feature::Factory#multi_line_string
|
281
266
|
|
282
|
-
def multi_line_string(
|
283
|
-
MultiLineStringImpl.new(self,
|
284
|
-
rescue
|
285
|
-
nil
|
267
|
+
def multi_line_string(elems)
|
268
|
+
MultiLineStringImpl.new(self, elems)
|
286
269
|
end
|
287
270
|
|
288
271
|
# See RGeo::Feature::Factory#multi_polygon
|
289
272
|
|
290
|
-
def multi_polygon(
|
291
|
-
MultiPolygonImpl.new(self,
|
292
|
-
rescue
|
293
|
-
nil
|
273
|
+
def multi_polygon(elems)
|
274
|
+
MultiPolygonImpl.new(self, elems)
|
294
275
|
end
|
295
276
|
|
296
277
|
# See RGeo::Feature::Factory#proj4
|
@@ -301,44 +282,28 @@ module RGeo
|
|
301
282
|
|
302
283
|
attr_reader :coord_sys
|
303
284
|
|
304
|
-
def
|
305
|
-
@wkt_generator.generate(
|
285
|
+
def generate_wkt(obj)
|
286
|
+
@wkt_generator.generate(obj)
|
306
287
|
end
|
307
288
|
|
308
|
-
def
|
309
|
-
@wkb_generator.generate(
|
289
|
+
def generate_wkb(obj)
|
290
|
+
@wkb_generator.generate(obj)
|
310
291
|
end
|
311
292
|
|
312
|
-
def
|
313
|
-
|
314
|
-
@marshal_wkb_generator = RGeo::WKRep::WKBGenerator.new(
|
315
|
-
type_format: :wkb12)
|
316
|
-
end
|
317
|
-
@marshal_wkb_generator
|
293
|
+
def marshal_wkb_generator
|
294
|
+
@marshal_wkb_generator ||= RGeo::WKRep::WKBGenerator.new(type_format: :wkb12)
|
318
295
|
end
|
319
296
|
|
320
|
-
def
|
321
|
-
|
322
|
-
@marshal_wkb_parser = RGeo::WKRep::WKBParser.new(self,
|
323
|
-
support_wkb12: true)
|
324
|
-
end
|
325
|
-
@marshal_wkb_parser
|
297
|
+
def marshal_wkb_parser
|
298
|
+
@marshal_wkb_parser ||= RGeo::WKRep::WKBParser.new(self, support_wkb12: true)
|
326
299
|
end
|
327
300
|
|
328
|
-
def
|
329
|
-
|
330
|
-
@psych_wkt_generator = RGeo::WKRep::WKTGenerator.new(
|
331
|
-
tag_format: :wkt12)
|
332
|
-
end
|
333
|
-
@psych_wkt_generator
|
301
|
+
def psych_wkt_generator
|
302
|
+
@psych_wkt_generator ||= RGeo::WKRep::WKTGenerator.new(tag_format: :wkt12)
|
334
303
|
end
|
335
304
|
|
336
|
-
def
|
337
|
-
|
338
|
-
@psych_wkt_parser = RGeo::WKRep::WKTParser.new(self,
|
339
|
-
support_wkt12: true, support_ewkt: true)
|
340
|
-
end
|
341
|
-
@psych_wkt_parser
|
305
|
+
def psych_wkt_parser
|
306
|
+
@psych_wkt_parser ||= RGeo::WKRep::WKTParser.new(self, support_wkt12: true, support_ewkt: true)
|
342
307
|
end
|
343
308
|
end
|
344
309
|
end
|