rgeo 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +29 -0
- data/ext/geos_c_impl/Makefile_2.2.3 +260 -0
- data/ext/geos_c_impl/coordinates.c +65 -0
- data/ext/geos_c_impl/coordinates.h +2 -0
- data/ext/geos_c_impl/extconf.rb +19 -43
- data/ext/geos_c_impl/geometry.c +24 -0
- data/ext/geos_c_impl/geometry_collection.c +99 -1
- data/ext/geos_c_impl/geos_c_impl_2.2.3.bundle +0 -0
- data/ext/geos_c_impl/line_string.c +38 -0
- data/ext/geos_c_impl/mkmf.log +123 -0
- data/ext/geos_c_impl/point.c +27 -0
- data/ext/geos_c_impl/polygon.c +26 -0
- data/ext/proj4_c_impl/Makefile_2.2.3 +260 -0
- data/ext/proj4_c_impl/extconf.rb +32 -32
- data/ext/proj4_c_impl/mkmf.log +47 -0
- data/ext/proj4_c_impl/proj4_c_impl_2.2.3.bundle +0 -0
- data/lib/rgeo.rb +10 -11
- data/lib/rgeo/cartesian.rb +7 -12
- data/lib/rgeo/cartesian/analysis.rb +13 -26
- data/lib/rgeo/cartesian/bounding_box.rb +45 -114
- data/lib/rgeo/cartesian/calculations.rb +3 -21
- data/lib/rgeo/cartesian/factory.rb +101 -122
- data/lib/rgeo/cartesian/feature_classes.rb +9 -59
- data/lib/rgeo/cartesian/feature_methods.rb +15 -45
- data/lib/rgeo/cartesian/interface.rb +6 -17
- data/lib/rgeo/coord_sys.rb +9 -15
- data/lib/rgeo/coord_sys/cs/entities.rb +84 -330
- data/lib/rgeo/coord_sys/cs/factories.rb +2 -32
- data/lib/rgeo/coord_sys/cs/wkt_parser.rb +52 -80
- data/lib/rgeo/coord_sys/proj4.rb +28 -67
- data/lib/rgeo/coord_sys/proj4_c_impl.bundle +0 -0
- data/lib/rgeo/coord_sys/srs_database/interface.rb +4 -24
- data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +20 -38
- data/lib/rgeo/coord_sys/srs_database/sr_org.rb +6 -22
- data/lib/rgeo/coord_sys/srs_database/url_reader.rb +6 -21
- data/lib/rgeo/error.rb +0 -6
- data/lib/rgeo/feature.rb +18 -23
- data/lib/rgeo/feature/curve.rb +0 -14
- data/lib/rgeo/feature/factory.rb +13 -38
- data/lib/rgeo/feature/factory_generator.rb +4 -16
- data/lib/rgeo/feature/geometry.rb +18 -60
- data/lib/rgeo/feature/geometry_collection.rb +3 -17
- data/lib/rgeo/feature/line.rb +0 -10
- data/lib/rgeo/feature/line_string.rb +1 -13
- data/lib/rgeo/feature/linear_ring.rb +0 -9
- data/lib/rgeo/feature/mixins.rb +11 -36
- data/lib/rgeo/feature/multi_curve.rb +0 -11
- data/lib/rgeo/feature/multi_line_string.rb +0 -9
- data/lib/rgeo/feature/multi_point.rb +0 -9
- data/lib/rgeo/feature/multi_polygon.rb +0 -9
- data/lib/rgeo/feature/multi_surface.rb +0 -12
- data/lib/rgeo/feature/point.rb +0 -13
- data/lib/rgeo/feature/polygon.rb +1 -14
- data/lib/rgeo/feature/surface.rb +0 -12
- data/lib/rgeo/feature/types.rb +19 -61
- data/lib/rgeo/geographic.rb +10 -15
- data/lib/rgeo/geographic/factory.rb +126 -147
- data/lib/rgeo/geographic/interface.rb +67 -81
- data/lib/rgeo/geographic/proj4_projector.rb +13 -37
- data/lib/rgeo/geographic/projected_feature_classes.rb +7 -66
- data/lib/rgeo/geographic/projected_feature_methods.rb +15 -80
- data/lib/rgeo/geographic/projected_window.rb +15 -67
- data/lib/rgeo/geographic/simple_mercator_projector.rb +32 -56
- data/lib/rgeo/geographic/spherical_feature_classes.rb +9 -68
- data/lib/rgeo/geographic/spherical_feature_methods.rb +18 -51
- data/lib/rgeo/geographic/spherical_math.rb +26 -51
- data/lib/rgeo/geos.rb +23 -20
- data/lib/rgeo/geos/capi_factory.rb +125 -131
- data/lib/rgeo/geos/capi_feature_classes.rb +21 -88
- data/lib/rgeo/geos/ffi_factory.rb +90 -143
- data/lib/rgeo/geos/ffi_feature_classes.rb +8 -63
- data/lib/rgeo/geos/ffi_feature_methods.rb +46 -162
- data/lib/rgeo/geos/geos_c_impl.bundle +0 -0
- data/lib/rgeo/geos/interface.rb +4 -23
- data/lib/rgeo/geos/utils.rb +4 -19
- data/lib/rgeo/geos/zm_factory.rb +82 -131
- data/lib/rgeo/geos/zm_feature_classes.rb +8 -63
- data/lib/rgeo/geos/zm_feature_methods.rb +34 -107
- data/lib/rgeo/impl_helper.rb +8 -13
- data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +27 -71
- data/lib/rgeo/impl_helper/basic_geometry_methods.rb +10 -28
- data/lib/rgeo/impl_helper/basic_line_string_methods.rb +21 -57
- data/lib/rgeo/impl_helper/basic_point_methods.rb +12 -30
- data/lib/rgeo/impl_helper/basic_polygon_methods.rb +9 -28
- data/lib/rgeo/impl_helper/math.rb +4 -10
- data/lib/rgeo/impl_helper/utils.rb +2 -10
- data/lib/rgeo/version.rb +1 -1
- data/lib/rgeo/wkrep.rb +4 -9
- data/lib/rgeo/wkrep/wkb_generator.rb +22 -46
- data/lib/rgeo/wkrep/wkb_parser.rb +25 -52
- data/lib/rgeo/wkrep/wkt_generator.rb +39 -69
- data/lib/rgeo/wkrep/wkt_parser.rb +52 -89
- data/lib/rgeo/yaml.rb +1 -7
- data/test/common/factory_tests.rb +4 -19
- data/test/common/geometry_collection_tests.rb +6 -39
- data/test/common/line_string_tests.rb +10 -39
- data/test/common/multi_line_string_tests.rb +10 -30
- data/test/common/multi_point_tests.rb +15 -34
- data/test/common/multi_polygon_tests.rb +26 -28
- data/test/common/point_tests.rb +37 -59
- data/test/common/polygon_tests.rb +16 -25
- data/test/coord_sys/tc_ogc_cs.rb +151 -186
- data/test/coord_sys/tc_proj4.rb +35 -60
- data/test/coord_sys/tc_proj4_srs_data.rb +15 -24
- data/test/coord_sys/tc_sr_org.rb +11 -19
- data/test/coord_sys/tc_url_reader.rb +13 -23
- data/test/geos_capi/tc_factory.rb +7 -16
- data/test/geos_capi/tc_geometry_collection.rb +6 -14
- data/test/geos_capi/tc_line_string.rb +7 -15
- data/test/geos_capi/tc_misc.rb +26 -41
- data/test/geos_capi/tc_multi_line_string.rb +6 -14
- data/test/geos_capi/tc_multi_point.rb +7 -15
- data/test/geos_capi/tc_multi_polygon.rb +8 -18
- data/test/geos_capi/tc_parsing_unparsing.rb +11 -21
- data/test/geos_capi/tc_point.rb +12 -26
- data/test/geos_capi/tc_polygon.rb +52 -17
- data/test/geos_capi/tc_zmfactory.rb +7 -18
- data/test/geos_ffi/tc_factory.rb +7 -16
- data/test/geos_ffi/tc_geometry_collection.rb +7 -15
- data/test/geos_ffi/tc_line_string.rb +7 -15
- data/test/geos_ffi/tc_misc.rb +8 -18
- data/test/geos_ffi/tc_multi_line_string.rb +7 -15
- data/test/geos_ffi/tc_multi_point.rb +8 -16
- data/test/geos_ffi/tc_multi_polygon.rb +9 -18
- data/test/geos_ffi/tc_parsing_unparsing.rb +14 -24
- data/test/geos_ffi/tc_point.rb +13 -28
- data/test/geos_ffi/tc_polygon.rb +7 -17
- data/test/geos_ffi/tc_zmfactory.rb +8 -19
- data/test/projected_geographic/tc_factory.rb +7 -15
- data/test/projected_geographic/tc_geometry_collection.rb +7 -15
- data/test/projected_geographic/tc_line_string.rb +7 -15
- data/test/projected_geographic/tc_multi_line_string.rb +7 -16
- data/test/projected_geographic/tc_multi_point.rb +8 -17
- data/test/projected_geographic/tc_multi_polygon.rb +8 -16
- data/test/projected_geographic/tc_point.rb +11 -23
- data/test/projected_geographic/tc_polygon.rb +7 -15
- data/test/simple_cartesian/tc_calculations.rb +6 -22
- data/test/simple_cartesian/tc_factory.rb +7 -16
- data/test/simple_cartesian/tc_geometry_collection.rb +6 -15
- data/test/simple_cartesian/tc_line_string.rb +6 -15
- data/test/simple_cartesian/tc_multi_line_string.rb +6 -15
- data/test/simple_cartesian/tc_multi_point.rb +7 -16
- data/test/simple_cartesian/tc_multi_polygon.rb +7 -16
- data/test/simple_cartesian/tc_point.rb +10 -21
- data/test/simple_cartesian/tc_polygon.rb +6 -15
- data/test/simple_mercator/tc_factory.rb +6 -14
- data/test/simple_mercator/tc_geometry_collection.rb +6 -14
- data/test/simple_mercator/tc_line_string.rb +6 -14
- data/test/simple_mercator/tc_multi_line_string.rb +6 -15
- data/test/simple_mercator/tc_multi_point.rb +7 -16
- data/test/simple_mercator/tc_multi_polygon.rb +7 -15
- data/test/simple_mercator/tc_point.rb +11 -24
- data/test/simple_mercator/tc_polygon.rb +6 -14
- data/test/simple_mercator/tc_window.rb +10 -34
- data/test/spherical_geographic/tc_calculations.rb +5 -32
- data/test/spherical_geographic/tc_factory.rb +6 -15
- data/test/spherical_geographic/tc_geometry_collection.rb +6 -15
- data/test/spherical_geographic/tc_line_string.rb +6 -15
- data/test/spherical_geographic/tc_multi_line_string.rb +6 -15
- data/test/spherical_geographic/tc_multi_point.rb +7 -16
- data/test/spherical_geographic/tc_multi_polygon.rb +7 -16
- data/test/spherical_geographic/tc_point.rb +10 -22
- data/test/spherical_geographic/tc_polygon.rb +6 -15
- data/test/tc_cartesian_analysis.rb +4 -16
- data/test/tc_cartesian_bbox.rb +7 -21
- data/test/tc_mixins.rb +8 -25
- data/test/tc_oneoff.rb +5 -13
- data/test/tc_types.rb +7 -16
- data/test/wkrep/tc_wkb_generator.rb +63 -97
- data/test/wkrep/tc_wkb_parser.rb +63 -100
- data/test/wkrep/tc_wkt_generator.rb +54 -92
- data/test/wkrep/tc_wkt_parser.rb +84 -133
- metadata +39 -9
- data/lib/rgeo/coord_sys/srs_database/active_record_table.rb +0 -166
- data/test/coord_sys/tc_active_record_table.rb +0 -79
@@ -5,131 +5,76 @@
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
7
|
module RGeo
|
8
|
-
|
9
8
|
module Geos
|
10
|
-
|
11
|
-
|
12
|
-
class ZMPointImpl # :nodoc:
|
13
|
-
|
14
|
-
|
9
|
+
class ZMPointImpl # :nodoc:
|
15
10
|
include ZMGeometryMethods
|
16
11
|
include ZMPointMethods
|
17
12
|
|
18
13
|
Feature::MixinCollection::GLOBAL.for_type(Feature::Point).include_in_class(self, true)
|
19
|
-
|
20
|
-
|
21
14
|
end
|
22
15
|
|
23
|
-
|
24
16
|
class ZMLineStringImpl # :nodoc:
|
25
|
-
|
26
|
-
|
27
17
|
include ZMGeometryMethods
|
28
18
|
include ZMLineStringMethods
|
29
19
|
|
30
20
|
Feature::MixinCollection::GLOBAL.for_type(Feature::LineString).include_in_class(self, true)
|
31
|
-
|
32
|
-
|
33
21
|
end
|
34
22
|
|
35
|
-
|
36
23
|
class ZMLinearRingImpl # :nodoc:
|
37
|
-
|
38
|
-
|
39
24
|
include ZMGeometryMethods
|
40
25
|
include ZMLineStringMethods
|
41
26
|
|
42
27
|
Feature::MixinCollection::GLOBAL.for_type(Feature::LinearRing).include_in_class(self, true)
|
43
|
-
|
44
|
-
|
45
28
|
end
|
46
29
|
|
47
|
-
|
48
|
-
class ZMLineImpl # :nodoc:
|
49
|
-
|
50
|
-
|
30
|
+
class ZMLineImpl # :nodoc:
|
51
31
|
include ZMGeometryMethods
|
52
32
|
include ZMLineStringMethods
|
53
33
|
|
54
34
|
Feature::MixinCollection::GLOBAL.for_type(Feature::Line).include_in_class(self, true)
|
55
|
-
|
56
|
-
|
57
35
|
end
|
58
36
|
|
59
|
-
|
60
|
-
class ZMPolygonImpl # :nodoc:
|
61
|
-
|
62
|
-
|
37
|
+
class ZMPolygonImpl # :nodoc:
|
63
38
|
include ZMGeometryMethods
|
64
39
|
include ZMPolygonMethods
|
65
40
|
|
66
41
|
Feature::MixinCollection::GLOBAL.for_type(Feature::Polygon).include_in_class(self, true)
|
67
|
-
|
68
|
-
|
69
42
|
end
|
70
43
|
|
71
|
-
|
72
|
-
class ZMGeometryCollectionImpl # :nodoc:
|
73
|
-
|
74
|
-
|
44
|
+
class ZMGeometryCollectionImpl # :nodoc:
|
75
45
|
include ZMGeometryMethods
|
76
46
|
include ZMGeometryCollectionMethods
|
77
47
|
|
78
48
|
Feature::MixinCollection::GLOBAL.for_type(Feature::GeometryCollection).include_in_class(self, true)
|
79
|
-
|
80
|
-
|
81
49
|
end
|
82
50
|
|
83
|
-
|
84
|
-
class ZMMultiPointImpl # :nodoc:
|
85
|
-
|
86
|
-
|
51
|
+
class ZMMultiPointImpl # :nodoc:
|
87
52
|
include ZMGeometryMethods
|
88
53
|
include ZMGeometryCollectionMethods
|
89
54
|
|
90
55
|
Feature::MixinCollection::GLOBAL.for_type(Feature::MultiPoint).include_in_class(self, true)
|
91
|
-
|
92
|
-
|
93
56
|
end
|
94
57
|
|
95
|
-
|
96
|
-
class ZMMultiLineStringImpl # :nodoc:
|
97
|
-
|
98
|
-
|
58
|
+
class ZMMultiLineStringImpl # :nodoc:
|
99
59
|
include ZMGeometryMethods
|
100
60
|
include ZMGeometryCollectionMethods
|
101
61
|
include ZMMultiLineStringMethods
|
102
62
|
|
103
63
|
Feature::MixinCollection::GLOBAL.for_type(Feature::MultiLineString).include_in_class(self, true)
|
104
|
-
|
105
|
-
|
106
64
|
end
|
107
65
|
|
108
|
-
|
109
|
-
class ZMMultiPolygonImpl # :nodoc:
|
110
|
-
|
111
|
-
|
66
|
+
class ZMMultiPolygonImpl # :nodoc:
|
112
67
|
include ZMGeometryMethods
|
113
68
|
include ZMGeometryCollectionMethods
|
114
69
|
include ZMMultiPolygonMethods
|
115
70
|
|
116
71
|
Feature::MixinCollection::GLOBAL.for_type(Feature::MultiPolygon).include_in_class(self, true)
|
117
|
-
|
118
|
-
|
119
72
|
end
|
120
73
|
|
121
|
-
|
122
|
-
class ZMGeometryImpl # :nodoc:
|
123
|
-
|
124
|
-
|
74
|
+
class ZMGeometryImpl # :nodoc:
|
125
75
|
include ZMGeometryMethods
|
126
76
|
|
127
77
|
Feature::MixinCollection::GLOBAL.for_type(Feature::Geometry).include_in_class(self, true)
|
128
|
-
|
129
|
-
|
130
78
|
end
|
131
|
-
|
132
|
-
|
133
79
|
end
|
134
|
-
|
135
80
|
end
|
@@ -5,187 +5,150 @@
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
7
|
module RGeo
|
8
|
-
|
9
8
|
module Geos
|
10
|
-
|
11
|
-
|
12
|
-
module ZMGeometryMethods # :nodoc:
|
13
|
-
|
9
|
+
module ZMGeometryMethods # :nodoc:
|
14
10
|
include Feature::Instance
|
15
11
|
|
16
|
-
|
17
12
|
def initialize(factory_, zgeometry_, mgeometry_)
|
18
13
|
@factory = factory_
|
19
14
|
@zgeometry = zgeometry_
|
20
15
|
@mgeometry = mgeometry_
|
21
16
|
end
|
22
17
|
|
23
|
-
|
24
|
-
def inspect # :nodoc:
|
18
|
+
def inspect # :nodoc:
|
25
19
|
"#<#{self.class}:0x#{object_id.to_s(16)} #{as_text.inspect}>"
|
26
20
|
end
|
27
21
|
|
28
|
-
def to_s
|
22
|
+
def to_s # :nodoc:
|
29
23
|
as_text
|
30
24
|
end
|
31
25
|
|
32
|
-
|
33
26
|
def hash
|
34
27
|
@factory.hash ^ @zgeometry.hash ^ @mgeometry.hash
|
35
28
|
end
|
36
29
|
|
37
|
-
|
38
30
|
def factory
|
39
31
|
@factory
|
40
32
|
end
|
41
33
|
|
42
|
-
|
43
34
|
def z_geometry
|
44
35
|
@zgeometry
|
45
36
|
end
|
46
37
|
|
47
|
-
|
48
38
|
def m_geometry
|
49
39
|
@mgeometry
|
50
40
|
end
|
51
41
|
|
52
|
-
|
53
42
|
def dimension
|
54
43
|
@zgeometry.dimension
|
55
44
|
end
|
56
45
|
|
57
|
-
|
58
46
|
def geometry_type
|
59
47
|
@zgeometry.geometry_type
|
60
48
|
end
|
61
49
|
|
62
|
-
|
63
50
|
def srid
|
64
51
|
@factory.srid
|
65
52
|
end
|
66
53
|
|
67
|
-
|
68
54
|
def envelope
|
69
55
|
@factory._create_feature(nil, @zgeometry.envelope, @mgeometry.envelope)
|
70
56
|
end
|
71
57
|
|
72
|
-
|
73
58
|
def as_text
|
74
59
|
@factory.instance_variable_get(:@wkt_generator).generate(self)
|
75
60
|
end
|
76
61
|
|
77
|
-
|
78
62
|
def as_binary
|
79
63
|
@factory.instance_variable_get(:@wkb_generator).generate(self)
|
80
64
|
end
|
81
65
|
|
82
|
-
|
83
66
|
def is_empty?
|
84
67
|
@zgeometry.is_empty?
|
85
68
|
end
|
86
69
|
|
87
|
-
|
88
70
|
def is_simple?
|
89
71
|
@zgeometry.is_simple?
|
90
72
|
end
|
91
73
|
|
92
|
-
|
93
74
|
def boundary
|
94
75
|
@factory._create_feature(nil, @zgeometry.boundary, @mgeometry.boundary)
|
95
76
|
end
|
96
77
|
|
97
|
-
|
98
78
|
def equals?(rhs_)
|
99
79
|
@zgeometry.equals?(::RGeo::Feature.cast(rhs_, self).z_geometry)
|
100
80
|
end
|
101
81
|
|
102
|
-
|
103
82
|
def disjoint?(rhs_)
|
104
83
|
@zgeometry.disjoint?(::RGeo::Feature.cast(rhs_, self).z_geometry)
|
105
84
|
end
|
106
85
|
|
107
|
-
|
108
86
|
def intersects?(rhs_)
|
109
87
|
@zgeometry.intersects?(::RGeo::Feature.cast(rhs_, self).z_geometry)
|
110
88
|
end
|
111
89
|
|
112
|
-
|
113
90
|
def touches?(rhs_)
|
114
91
|
@zgeometry.touches?(::RGeo::Feature.cast(rhs_, self).z_geometry)
|
115
92
|
end
|
116
93
|
|
117
|
-
|
118
94
|
def crosses?(rhs_)
|
119
95
|
@zgeometry.crosses?(::RGeo::Feature.cast(rhs_, self).z_geometry)
|
120
96
|
end
|
121
97
|
|
122
|
-
|
123
98
|
def within?(rhs_)
|
124
99
|
@zgeometry.within?(::RGeo::Feature.cast(rhs_, self).z_geometry)
|
125
100
|
end
|
126
101
|
|
127
|
-
|
128
102
|
def contains?(rhs_)
|
129
103
|
@zgeometry.contains?(::RGeo::Feature.cast(rhs_, self).z_geometry)
|
130
104
|
end
|
131
105
|
|
132
|
-
|
133
106
|
def overlaps?(rhs_)
|
134
107
|
@zgeometry.overlaps?(::RGeo::Feature.cast(rhs_, self).z_geometry)
|
135
108
|
end
|
136
109
|
|
137
|
-
|
138
110
|
def relate?(rhs_, pattern_)
|
139
111
|
@zgeometry.relate?(::RGeo::Feature.cast(rhs_, self).z_geometry, pattern_)
|
140
112
|
end
|
141
|
-
alias_method :relate, :relate?
|
142
|
-
|
113
|
+
alias_method :relate, :relate? # DEPRECATED
|
143
114
|
|
144
115
|
def distance(rhs_)
|
145
116
|
@zgeometry.distance(::RGeo::Feature.cast(rhs_, self).z_geometry)
|
146
117
|
end
|
147
118
|
|
148
|
-
|
149
119
|
def buffer(distance_)
|
150
120
|
@factory._create_feature(nil, @zgeometry.buffer(distance_), @mgeometry.buffer(distance_))
|
151
121
|
end
|
152
122
|
|
153
|
-
|
154
123
|
def convex_hull
|
155
124
|
@factory._create_feature(nil, @zgeometry.convex_hull, @mgeometry.convex_hull)
|
156
125
|
end
|
157
126
|
|
158
|
-
|
159
127
|
def intersection(rhs_)
|
160
128
|
rhs_ = ::RGeo::Feature.cast(rhs_, self)
|
161
129
|
@factory._create_feature(nil, @zgeometry.intersection(rhs_.z_geometry), @mgeometry.intersection(rhs_.m_geometry))
|
162
130
|
end
|
163
131
|
|
164
|
-
|
165
132
|
def union(rhs_)
|
166
133
|
rhs_ = ::RGeo::Feature.cast(rhs_, self)
|
167
134
|
@factory._create_feature(nil, @zgeometry.union(rhs_.z_geometry), @mgeometry.union(rhs_.m_geometry))
|
168
135
|
end
|
169
136
|
|
170
|
-
|
171
137
|
def difference(rhs_)
|
172
138
|
rhs_ = ::RGeo::Feature.cast(rhs_, self)
|
173
139
|
@factory._create_feature(nil, @zgeometry.difference(rhs_.z_geometry), @mgeometry.difference(rhs_.m_geometry))
|
174
140
|
end
|
175
141
|
|
176
|
-
|
177
142
|
def sym_difference(rhs_)
|
178
143
|
rhs_ = ::RGeo::Feature.cast(rhs_, self)
|
179
144
|
@factory._create_feature(nil, @zgeometry.sym_difference(rhs_.z_geometry), @mgeometry.sym_difference(rhs_.m_geometry))
|
180
145
|
end
|
181
146
|
|
182
|
-
|
183
147
|
def rep_equals?(rhs_)
|
184
148
|
rhs_ = ::RGeo::Feature.cast(rhs_, self)
|
185
149
|
rhs_.is_a?(self.class) && @factory.eql?(rhs_.factory) && @zgeometry.rep_equals?(rhs_.z_geometry) && @mgeometry.rep_equals?(rhs_.m_geometry)
|
186
150
|
end
|
187
151
|
|
188
|
-
|
189
152
|
alias_method :eql?, :rep_equals?
|
190
153
|
alias_method :==, :equals?
|
191
154
|
|
@@ -193,15 +156,13 @@ module RGeo
|
|
193
156
|
alias_method :+, :union
|
194
157
|
alias_method :*, :intersection
|
195
158
|
|
196
|
-
|
197
|
-
def _copy_state_from(obj_) # :nodoc:
|
159
|
+
def _copy_state_from(obj_) # :nodoc:
|
198
160
|
@factory = obj_.factory
|
199
161
|
@zgeometry = obj_.z_geometry
|
200
162
|
@mgeometry = obj_.m_geometry
|
201
163
|
end
|
202
164
|
|
203
|
-
|
204
|
-
def marshal_dump # :nodoc:
|
165
|
+
def marshal_dump # :nodoc:
|
205
166
|
[@factory, @factory._marshal_wkb_generator.generate(self)]
|
206
167
|
end
|
207
168
|
|
@@ -209,83 +170,70 @@ module RGeo
|
|
209
170
|
_copy_state_from(data_[0]._marshal_wkb_parser.parse(data_[1]))
|
210
171
|
end
|
211
172
|
|
212
|
-
|
213
173
|
def encode_with(coder_) # :nodoc:
|
214
|
-
coder_[
|
215
|
-
coder_[
|
174
|
+
coder_["factory"] = @factory
|
175
|
+
coder_["wkt"] = @factory._psych_wkt_generator.generate(self)
|
216
176
|
end
|
217
177
|
|
218
|
-
def init_with(coder_)
|
219
|
-
_copy_state_from(coder_[
|
178
|
+
def init_with(coder_) # :nodoc:
|
179
|
+
_copy_state_from(coder_["factory"]._psych_wkt_parser.parse(coder_["wkt"]))
|
220
180
|
end
|
221
|
-
|
222
181
|
end
|
223
182
|
|
224
|
-
|
225
|
-
module ZMPointMethods # :nodoc:
|
226
|
-
|
227
|
-
|
183
|
+
module ZMPointMethods # :nodoc:
|
228
184
|
def x
|
229
185
|
@zgeometry.x
|
230
186
|
end
|
231
187
|
|
232
|
-
|
233
188
|
def y
|
234
189
|
@zgeometry.y
|
235
190
|
end
|
236
191
|
|
237
|
-
|
238
192
|
def z
|
239
193
|
@zgeometry.z
|
240
194
|
end
|
241
195
|
|
242
|
-
|
243
196
|
def m
|
244
197
|
@mgeometry.m
|
245
198
|
end
|
246
199
|
|
247
|
-
|
200
|
+
def coordinates
|
201
|
+
[x, y].tap do |coords|
|
202
|
+
coords << z if @factory.property(:has_z_coordinate)
|
203
|
+
coords << m if @factory.property(:has_m_coordinate)
|
204
|
+
end
|
205
|
+
end
|
248
206
|
end
|
249
207
|
|
250
|
-
|
251
|
-
module ZMLineStringMethods # :nodoc:
|
252
|
-
|
253
|
-
|
208
|
+
module ZMLineStringMethods # :nodoc:
|
254
209
|
def length
|
255
210
|
@zgeometry.length
|
256
211
|
end
|
257
212
|
|
258
|
-
|
259
213
|
def start_point
|
260
214
|
point_n(0)
|
261
215
|
end
|
262
216
|
|
263
|
-
|
264
217
|
def end_point
|
265
218
|
point_n(num_points - 1)
|
266
219
|
end
|
267
220
|
|
268
|
-
|
269
221
|
def is_closed?
|
270
222
|
@zgeometry.is_closed?
|
271
223
|
end
|
272
224
|
|
273
|
-
|
274
225
|
def is_ring?
|
275
226
|
@zgeometry.is_ring?
|
276
227
|
end
|
277
228
|
|
278
|
-
|
279
229
|
def num_points
|
280
230
|
@zgeometry.num_points
|
281
231
|
end
|
282
232
|
|
283
|
-
|
284
233
|
def point_n(n_)
|
285
234
|
@factory._create_feature(ZMPointImpl, @zgeometry.point_n(n_), @mgeometry.point_n(n_))
|
286
235
|
end
|
287
236
|
|
288
|
-
|
289
237
|
def points
|
290
238
|
result_ = []
|
291
239
|
zpoints_ = @zgeometry.points
|
@@ -296,43 +244,36 @@ module RGeo
|
|
296
244
|
result_
|
297
245
|
end
|
298
246
|
|
299
|
-
|
247
|
+
def coordinates
|
248
|
+
points.map(&:coordinates)
|
249
|
+
end
|
300
250
|
end
|
301
251
|
|
302
|
-
|
303
|
-
module ZMPolygonMethods # :nodoc:
|
304
|
-
|
305
|
-
|
252
|
+
module ZMPolygonMethods # :nodoc:
|
306
253
|
def area
|
307
254
|
@zgeometry.area
|
308
255
|
end
|
309
256
|
|
310
|
-
|
311
257
|
def centroid
|
312
258
|
@factory._create_feature(ZMPointImpl, @zgeometry.centroid, @mgeometry.centroid)
|
313
259
|
end
|
314
260
|
|
315
|
-
|
316
261
|
def point_on_surface
|
317
262
|
@factory._create_feature(ZMPointImpl, @zgeometry.centroid, @mgeometry.centroid)
|
318
263
|
end
|
319
264
|
|
320
|
-
|
321
265
|
def exterior_ring
|
322
266
|
@factory._create_feature(ZMLineStringImpl, @zgeometry.exterior_ring, @mgeometry.exterior_ring)
|
323
267
|
end
|
324
268
|
|
325
|
-
|
326
269
|
def num_interior_rings
|
327
270
|
@zgeometry.num_interior_rings
|
328
271
|
end
|
329
272
|
|
330
|
-
|
331
273
|
def interior_ring_n(n_)
|
332
274
|
@factory._create_feature(ZMLineStringImpl, @zgeometry.interior_ring_n(n_), @mgeometry.interior_ring_n(n_))
|
333
275
|
end
|
334
276
|
|
335
|
-
|
336
277
|
def interior_rings
|
337
278
|
result_ = []
|
338
279
|
zrings_ = @zgeometry.interior_rings
|
@@ -343,75 +284,61 @@ module RGeo
|
|
343
284
|
result_
|
344
285
|
end
|
345
286
|
|
346
|
-
|
287
|
+
def coordinates
|
288
|
+
([exterior_ring] + interior_rings).map(&:coordinates)
|
289
|
+
end
|
347
290
|
end
|
348
291
|
|
349
|
-
|
350
|
-
module ZMGeometryCollectionMethods # :nodoc:
|
351
|
-
|
352
|
-
|
292
|
+
module ZMGeometryCollectionMethods # :nodoc:
|
353
293
|
def num_geometries
|
354
294
|
@zgeometry.num_geometries
|
355
295
|
end
|
356
296
|
alias_method :size, :num_geometries
|
357
297
|
|
358
|
-
|
359
298
|
def geometry_n(n_)
|
360
299
|
@factory._create_feature(nil, @zgeometry.geometry_n(n_), @mgeometry.geometry_n(n_))
|
361
300
|
end
|
362
301
|
alias_method :[], :geometry_n
|
363
302
|
|
364
|
-
|
365
303
|
def each
|
366
304
|
num_geometries.times do |i_|
|
367
305
|
yield geometry_n(i_)
|
368
306
|
end
|
369
307
|
end
|
370
308
|
|
371
|
-
|
372
309
|
include ::Enumerable
|
373
|
-
|
374
|
-
|
375
310
|
end
|
376
311
|
|
377
|
-
|
378
|
-
module ZMMultiLineStringMethods # :nodoc:
|
379
|
-
|
380
|
-
|
312
|
+
module ZMMultiLineStringMethods # :nodoc:
|
381
313
|
def length
|
382
314
|
@zgeometry.length
|
383
315
|
end
|
384
316
|
|
385
|
-
|
386
317
|
def is_closed?
|
387
318
|
@zgeometry.is_closed?
|
388
319
|
end
|
389
320
|
|
390
|
-
|
321
|
+
def coordinates
|
322
|
+
each.map(&:coordinates)
|
323
|
+
end
|
391
324
|
end
|
392
325
|
|
393
|
-
|
394
|
-
module ZMMultiPolygonMethods # :nodoc:
|
395
|
-
|
396
|
-
|
326
|
+
module ZMMultiPolygonMethods # :nodoc:
|
397
327
|
def area
|
398
328
|
@zgeometry.area
|
399
329
|
end
|
400
330
|
|
401
|
-
|
402
331
|
def centroid
|
403
332
|
@factory._create_feature(ZMPointImpl, @zgeometry.centroid, @mgeometry.centroid)
|
404
333
|
end
|
405
334
|
|
406
|
-
|
407
335
|
def point_on_surface
|
408
336
|
@factory._create_feature(ZMPointImpl, @zgeometry.centroid, @mgeometry.centroid)
|
409
337
|
end
|
410
338
|
|
411
|
-
|
339
|
+
def coordinates
|
340
|
+
each.map(&:coordinates)
|
341
|
+
end
|
412
342
|
end
|
413
|
-
|
414
|
-
|
415
343
|
end
|
416
|
-
|
417
344
|
end
|