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
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# OGC CS factory 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,89 +35,89 @@
|
|
35
35
|
|
36
36
|
|
37
37
|
module RGeo
|
38
|
-
|
38
|
+
|
39
39
|
module CoordSys
|
40
|
-
|
41
|
-
|
40
|
+
|
41
|
+
|
42
42
|
# This module contains an implementation of the CS (coordinate
|
43
43
|
# systems) package of the OGC Coordinate Transform spec. It provides
|
44
44
|
# classes for representing ellipsoids, datums, coordinate systems,
|
45
45
|
# and other related concepts, as well as a parser for the WKT format
|
46
46
|
# for specifying coordinate systems.
|
47
|
-
#
|
47
|
+
#
|
48
48
|
# Generally, the easiest way to create coordinate system objects is
|
49
49
|
# to use RGeo::CoordSys::CS.create_from_wkt, which parses the WKT
|
50
50
|
# format. You can also use the create methods available for each
|
51
51
|
# object class.
|
52
|
-
#
|
52
|
+
#
|
53
53
|
# Most but not all of the spec is implemented here.
|
54
54
|
# Currently missing are:
|
55
|
-
#
|
55
|
+
#
|
56
56
|
# * XML format is not implemented. We're assuming that WKT is the
|
57
57
|
# preferred format.
|
58
58
|
# * The PT and CT packages are not implemented.
|
59
59
|
# * FittedCoordinateSystem is not implemented.
|
60
60
|
# * The defaultEnvelope attribute of CS_CoordinateSystem is not
|
61
61
|
# implemented.
|
62
|
-
|
62
|
+
|
63
63
|
module CS
|
64
|
-
|
65
|
-
|
64
|
+
|
65
|
+
|
66
66
|
# A class implementing the CS_CoordinateSystemFactory interface.
|
67
67
|
# It provides methods for building up complex objects from simpler
|
68
68
|
# objects or values.
|
69
|
-
#
|
69
|
+
#
|
70
70
|
# Note that the methods of CS_CoordinateSystemFactory do not provide
|
71
71
|
# facilities for setting the authority. If you need to set authority
|
72
72
|
# values, use the create methods for the object classes themselves.
|
73
|
-
|
73
|
+
|
74
74
|
class CoordinateSystemFactory
|
75
|
-
|
76
|
-
|
75
|
+
|
76
|
+
|
77
77
|
# Create a CompoundCoordinateSystem from a name, and two
|
78
78
|
# constituent coordinate systems.
|
79
|
-
|
79
|
+
|
80
80
|
def create_compound_coordinate_system(name_, head_, tail_)
|
81
81
|
CompoundCoordinateSystem.create(name_, head_, tail_)
|
82
82
|
end
|
83
|
-
|
84
|
-
|
83
|
+
|
84
|
+
|
85
85
|
# Create an Ellipsoid from a name, semi-major axis, and semi-minor
|
86
86
|
# axis. You can also provide a LinearUnit, but this is optional
|
87
87
|
# and may be set to nil.
|
88
|
-
|
88
|
+
|
89
89
|
def create_ellipsoid(name_, semi_major_axis_, semi_minor_axis_, linear_unit_)
|
90
90
|
Ellipsoid.create_ellipsoid(name_, semi_major_axis_, semi_minor_axis_, linear_unit_)
|
91
91
|
end
|
92
|
-
|
93
|
-
|
92
|
+
|
93
|
+
|
94
94
|
# Create an Ellipsoid from a name, semi-major axis, and an inverse
|
95
95
|
# flattening factor. You can also provide a LinearUnit, but this
|
96
96
|
# is optional and may be set to nil.
|
97
|
-
|
97
|
+
|
98
98
|
def create_flattened_sphere(name_, semi_major_axis_, inverse_flattening_, linear_unit_)
|
99
99
|
Ellipsoid.create_flattened_sphere(name_, semi_major_axis_, inverse_flattening_, linear_unit_)
|
100
100
|
end
|
101
|
-
|
102
|
-
|
101
|
+
|
102
|
+
|
103
103
|
# Create any object given the OGC WKT format. Raises
|
104
104
|
# Error::ParseError if a syntax error is encounterred.
|
105
|
-
|
105
|
+
|
106
106
|
def create_from_wkt(str_)
|
107
107
|
WKTParser.new(str_).parse
|
108
108
|
end
|
109
|
-
|
110
|
-
|
109
|
+
|
110
|
+
|
111
111
|
# Create a GeographicCoordinateSystem, given a name, an
|
112
112
|
# AngularUnit, a HorizontalDatum, a PrimeMeridian, and two
|
113
113
|
# AxisInfo objects. The AxisInfo objects are optional and may be
|
114
114
|
# set to nil.
|
115
|
-
|
115
|
+
|
116
116
|
def create_geographic_coordinate_system(name_, angular_unit_, horizontal_datum_, prime_meridian_, axis0_, axis1_)
|
117
117
|
GeographicCoordinateSystem.create(name_, angular_unit_, horizontal_datum_, prime_meridian_, axis0_, axis1_)
|
118
118
|
end
|
119
|
-
|
120
|
-
|
119
|
+
|
120
|
+
|
121
121
|
# Create a HorizontalDatum given a name, a horizontal datum type
|
122
122
|
# code, an Ellipsoid, and a WGS84ConversionInfo. The
|
123
123
|
# WGS84ConversionInfo is optional and may be set to nil.
|
@@ -125,84 +125,84 @@ module RGeo
|
|
125
125
|
def create_horizontal_datum(name_, horizontal_datum_type_, ellipsoid_, to_wgs84_)
|
126
126
|
HorizontalDatum.create(name_, horizontal_datum_type_, ellipsoid_, to_wgs84_)
|
127
127
|
end
|
128
|
-
|
129
|
-
|
128
|
+
|
129
|
+
|
130
130
|
# Create a LocalCoordinateSystem given a name, a LocalDatum, a
|
131
131
|
# Unit, and an array of at least one AxisInfo.
|
132
|
-
|
132
|
+
|
133
133
|
def create_local_coordinate_system(name_, datum_, unit_, axes_)
|
134
134
|
LocalCoordinateSystem.create(name_, datum_, unit_, axes_)
|
135
135
|
end
|
136
|
-
|
137
|
-
|
136
|
+
|
137
|
+
|
138
138
|
# Create a LocalDatum given a name and a local datum type code.
|
139
|
-
|
139
|
+
|
140
140
|
def create_local_datum(name_, local_datum_type_)
|
141
141
|
LocalDatum.create(name, local_datum_type_)
|
142
142
|
end
|
143
|
-
|
144
|
-
|
143
|
+
|
144
|
+
|
145
145
|
# Create a PrimeMeridian given a name, an AngularUnit, and a
|
146
146
|
# longitude offset.
|
147
|
-
|
147
|
+
|
148
148
|
def create_prime_meridian(name_, angular_unit_, longitude_)
|
149
149
|
PrimeMeridian.create(name, angular_unit_, longitude_)
|
150
150
|
end
|
151
|
-
|
152
|
-
|
151
|
+
|
152
|
+
|
153
153
|
# Create a ProjectedCoordinateSystem given a name, a
|
154
154
|
# GeographicCoordinateSystem, and Projection, a LinearUnit, and
|
155
155
|
# two AxisInfo objects. The AxisInfo objects are optional and may
|
156
156
|
# be set to nil.
|
157
|
-
|
157
|
+
|
158
158
|
def create_projected_coordinate_system(name_, gcs_, projection_, linear_unit_, axis0_, axis1_)
|
159
159
|
ProjectedCoordinateSystem.create(name_, gcs_, projection_, linear_unit_, axis0_, axis1_)
|
160
160
|
end
|
161
|
-
|
162
|
-
|
161
|
+
|
162
|
+
|
163
163
|
# Create a Projection given a name, a projection class, and an
|
164
164
|
# array of ProjectionParameter.
|
165
|
-
|
165
|
+
|
166
166
|
def create_projection(name_, wkt_projection_class_, parameters_)
|
167
167
|
Projection.create(name_, wkt_projection_class_, parameters_)
|
168
168
|
end
|
169
|
-
|
170
|
-
|
169
|
+
|
170
|
+
|
171
171
|
# Create a VerticalCoordinateSystem given a name, a VerticalDatum,
|
172
172
|
# a VerticalUnit, and an AxisInfo. The AxisInfo is optional and
|
173
173
|
# may be nil.
|
174
|
-
|
174
|
+
|
175
175
|
def create_vertical_coordinate_system(name_, vertical_datum_, vertical_unit_, axis_)
|
176
176
|
VerticalCoordinateSystem.create(name_, vertical_datum_, vertical_unit_, axis_)
|
177
177
|
end
|
178
|
-
|
179
|
-
|
178
|
+
|
179
|
+
|
180
180
|
# Create a VerticalDatum given a name ane a datum type code.
|
181
|
-
|
181
|
+
|
182
182
|
def create_vertical_datum(name_, vertical_datum_type_)
|
183
183
|
VerticalDatum.create(name_, vertical_datum_type_)
|
184
184
|
end
|
185
|
-
|
186
|
-
|
185
|
+
|
186
|
+
|
187
187
|
end
|
188
|
-
|
189
|
-
|
188
|
+
|
189
|
+
|
190
190
|
class << self
|
191
|
-
|
192
|
-
|
191
|
+
|
192
|
+
|
193
193
|
# Parsees OGC WKT format and returns the object created. Raises
|
194
194
|
# Error::ParseError if a syntax error is encounterred.
|
195
|
-
|
195
|
+
|
196
196
|
def create_from_wkt(str_)
|
197
197
|
WKTParser.new(str_).parse
|
198
198
|
end
|
199
|
-
|
200
|
-
|
199
|
+
|
200
|
+
|
201
201
|
end
|
202
|
-
|
203
|
-
|
202
|
+
|
203
|
+
|
204
204
|
end
|
205
|
-
|
205
|
+
|
206
206
|
end
|
207
|
-
|
207
|
+
|
208
208
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# OGC CS wkt parser 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,21 +35,21 @@
|
|
35
35
|
|
36
36
|
|
37
37
|
module RGeo
|
38
|
-
|
38
|
+
|
39
39
|
module CoordSys
|
40
|
-
|
41
|
-
|
40
|
+
|
41
|
+
|
42
42
|
module CS
|
43
|
-
|
44
|
-
|
43
|
+
|
44
|
+
|
45
45
|
class WKTParser # :nodoc:
|
46
|
-
|
46
|
+
|
47
47
|
def initialize(str_)
|
48
48
|
@scanner = ::StringScanner.new(str_)
|
49
49
|
next_token
|
50
50
|
end
|
51
|
-
|
52
|
-
|
51
|
+
|
52
|
+
|
53
53
|
def parse(containing_type_=nil)
|
54
54
|
if @cur_token.kind_of?(QuotedString) ||
|
55
55
|
@cur_token.kind_of?(::Numeric) ||
|
@@ -167,21 +167,21 @@ module RGeo
|
|
167
167
|
args_.assert_empty
|
168
168
|
obj_
|
169
169
|
end
|
170
|
-
|
171
|
-
|
170
|
+
|
171
|
+
|
172
172
|
def consume_token_type(type_) # :nodoc:
|
173
173
|
expect_token_type(type_)
|
174
174
|
tok_ = @cur_token
|
175
175
|
next_token
|
176
176
|
tok_
|
177
177
|
end
|
178
|
-
|
178
|
+
|
179
179
|
def expect_token_type(type_) # :nodoc:
|
180
180
|
unless type_ === @cur_token
|
181
181
|
raise Error::ParseError, "#{type_.inspect} expected but #{@cur_token.inspect} found."
|
182
182
|
end
|
183
183
|
end
|
184
|
-
|
184
|
+
|
185
185
|
def next_token # :nodoc:
|
186
186
|
@scanner.skip(/\s+/)
|
187
187
|
case @scanner.peek(1)
|
@@ -213,43 +213,43 @@ module RGeo
|
|
213
213
|
end
|
214
214
|
@cur_token
|
215
215
|
end
|
216
|
-
|
216
|
+
|
217
217
|
def cur_token # :nodoc:
|
218
218
|
@cur_token
|
219
219
|
end
|
220
|
-
|
221
|
-
|
220
|
+
|
221
|
+
|
222
222
|
class QuotedString < ::String # :nodoc:
|
223
223
|
end
|
224
|
-
|
224
|
+
|
225
225
|
class TypeString < ::String # :nodoc:
|
226
226
|
end
|
227
|
-
|
228
|
-
|
227
|
+
|
228
|
+
|
229
229
|
class AuthorityClause # :nodoc:
|
230
|
-
|
230
|
+
|
231
231
|
def initialize(name_, code_)
|
232
232
|
@name = name_
|
233
233
|
@code = code_
|
234
234
|
end
|
235
|
-
|
235
|
+
|
236
236
|
def to_a
|
237
237
|
[@name, @code]
|
238
238
|
end
|
239
|
-
|
239
|
+
|
240
240
|
end
|
241
|
-
|
242
|
-
|
241
|
+
|
242
|
+
|
243
243
|
class ArgumentList # :nodoc:
|
244
|
-
|
244
|
+
|
245
245
|
def initialize
|
246
246
|
@values = []
|
247
247
|
end
|
248
|
-
|
248
|
+
|
249
249
|
def <<(value_)
|
250
250
|
@values << value_
|
251
251
|
end
|
252
|
-
|
252
|
+
|
253
253
|
def assert_empty
|
254
254
|
if @values.size > 0
|
255
255
|
names_ = @values.map do |val_|
|
@@ -258,7 +258,7 @@ module RGeo
|
|
258
258
|
raise Error::ParseError, "#{@remaining} unexpected arguments: #{names_.join(', ')}"
|
259
259
|
end
|
260
260
|
end
|
261
|
-
|
261
|
+
|
262
262
|
def find_first(klass_)
|
263
263
|
@values.each_with_index do |val_, index_|
|
264
264
|
if val_.kind_of?(klass_)
|
@@ -268,7 +268,7 @@ module RGeo
|
|
268
268
|
end
|
269
269
|
nil
|
270
270
|
end
|
271
|
-
|
271
|
+
|
272
272
|
def find_all(klass_)
|
273
273
|
results_ = []
|
274
274
|
nvalues_ = []
|
@@ -282,7 +282,7 @@ module RGeo
|
|
282
282
|
@values = nvalues_
|
283
283
|
results_
|
284
284
|
end
|
285
|
-
|
285
|
+
|
286
286
|
def shift(klass_=nil)
|
287
287
|
val_ = @values.shift
|
288
288
|
unless val_
|
@@ -293,16 +293,16 @@ module RGeo
|
|
293
293
|
end
|
294
294
|
val_
|
295
295
|
end
|
296
|
-
|
296
|
+
|
297
297
|
end
|
298
|
-
|
299
|
-
|
298
|
+
|
299
|
+
|
300
300
|
end
|
301
|
-
|
302
|
-
|
301
|
+
|
302
|
+
|
303
303
|
end
|
304
|
-
|
305
|
-
|
304
|
+
|
305
|
+
|
306
306
|
end
|
307
|
-
|
307
|
+
|
308
308
|
end
|