rgeo 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. data/History.rdoc +6 -0
  2. data/README.rdoc +1 -1
  3. data/Version +1 -1
  4. data/ext/geos_c_impl/extconf.rb +13 -13
  5. data/ext/geos_c_impl/factory.c +30 -18
  6. data/ext/geos_c_impl/factory.h +18 -12
  7. data/ext/geos_c_impl/geometry.c +11 -11
  8. data/ext/geos_c_impl/geometry.h +7 -7
  9. data/ext/geos_c_impl/geometry_collection.c +15 -15
  10. data/ext/geos_c_impl/geometry_collection.h +8 -8
  11. data/ext/geos_c_impl/line_string.c +14 -14
  12. data/ext/geos_c_impl/line_string.h +7 -7
  13. data/ext/geos_c_impl/main.c +7 -7
  14. data/ext/geos_c_impl/point.c +9 -9
  15. data/ext/geos_c_impl/point.h +7 -7
  16. data/ext/geos_c_impl/polygon.c +9 -9
  17. data/ext/geos_c_impl/polygon.h +7 -7
  18. data/ext/geos_c_impl/preface.h +7 -7
  19. data/ext/proj4_c_impl/extconf.rb +13 -13
  20. data/ext/proj4_c_impl/main.c +12 -12
  21. data/lib/rgeo.rb +26 -26
  22. data/lib/rgeo/cartesian.rb +12 -12
  23. data/lib/rgeo/cartesian/analysis.rb +26 -26
  24. data/lib/rgeo/cartesian/bounding_box.rb +83 -83
  25. data/lib/rgeo/cartesian/calculations.rb +36 -36
  26. data/lib/rgeo/cartesian/factory.rb +78 -78
  27. data/lib/rgeo/cartesian/feature_classes.rb +74 -74
  28. data/lib/rgeo/cartesian/feature_methods.rb +34 -34
  29. data/lib/rgeo/cartesian/interface.rb +33 -33
  30. data/lib/rgeo/coord_sys.rb +15 -15
  31. data/lib/rgeo/coord_sys/cs/entities.rb +533 -534
  32. data/lib/rgeo/coord_sys/cs/factories.rb +69 -69
  33. data/lib/rgeo/coord_sys/cs/wkt_parser.rb +44 -44
  34. data/lib/rgeo/coord_sys/proj4.rb +85 -85
  35. data/lib/rgeo/coord_sys/srs_database/active_record_table.rb +31 -31
  36. data/lib/rgeo/coord_sys/srs_database/interface.rb +44 -44
  37. data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +31 -31
  38. data/lib/rgeo/coord_sys/srs_database/sr_org.rb +31 -31
  39. data/lib/rgeo/coord_sys/srs_database/url_reader.rb +29 -29
  40. data/lib/rgeo/error.rb +17 -17
  41. data/lib/rgeo/feature.rb +15 -15
  42. data/lib/rgeo/feature/curve.rb +58 -58
  43. data/lib/rgeo/feature/factory.rb +84 -84
  44. data/lib/rgeo/feature/factory_generator.rb +32 -32
  45. data/lib/rgeo/feature/geometry.rb +215 -215
  46. data/lib/rgeo/feature/geometry_collection.rb +46 -46
  47. data/lib/rgeo/feature/line.rb +21 -21
  48. data/lib/rgeo/feature/line_string.rb +35 -35
  49. data/lib/rgeo/feature/linear_ring.rb +20 -20
  50. data/lib/rgeo/feature/mixins.rb +61 -61
  51. data/lib/rgeo/feature/multi_curve.rb +37 -37
  52. data/lib/rgeo/feature/multi_line_string.rb +20 -20
  53. data/lib/rgeo/feature/multi_point.rb +22 -22
  54. data/lib/rgeo/feature/multi_polygon.rb +28 -28
  55. data/lib/rgeo/feature/multi_surface.rb +39 -39
  56. data/lib/rgeo/feature/point.rb +42 -42
  57. data/lib/rgeo/feature/polygon.rb +50 -50
  58. data/lib/rgeo/feature/surface.rb +42 -42
  59. data/lib/rgeo/feature/types.rb +58 -58
  60. data/lib/rgeo/geographic.rb +14 -14
  61. data/lib/rgeo/geographic/factory.rb +87 -87
  62. data/lib/rgeo/geographic/interface.rb +55 -55
  63. data/lib/rgeo/geographic/proj4_projector.rb +35 -35
  64. data/lib/rgeo/geographic/projected_feature_classes.rb +95 -95
  65. data/lib/rgeo/geographic/projected_feature_methods.rb +81 -81
  66. data/lib/rgeo/geographic/projected_window.rb +103 -103
  67. data/lib/rgeo/geographic/simple_mercator_projector.rb +32 -32
  68. data/lib/rgeo/geographic/spherical_feature_classes.rb +93 -93
  69. data/lib/rgeo/geographic/spherical_feature_methods.rb +25 -25
  70. data/lib/rgeo/geographic/spherical_math.rb +58 -58
  71. data/lib/rgeo/geos.rb +22 -17
  72. data/lib/rgeo/geos/factory.rb +93 -93
  73. data/lib/rgeo/geos/ffi_classes.rb +306 -231
  74. data/lib/rgeo/geos/ffi_factory.rb +100 -96
  75. data/lib/rgeo/geos/impl_additions.rb +22 -22
  76. data/lib/rgeo/geos/interface.rb +45 -45
  77. data/lib/rgeo/geos/zm_factory.rb +90 -90
  78. data/lib/rgeo/geos/zm_impl.rb +167 -167
  79. data/lib/rgeo/impl_helper.rb +11 -11
  80. data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +71 -71
  81. data/lib/rgeo/impl_helper/basic_geometry_methods.rb +29 -29
  82. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +61 -61
  83. data/lib/rgeo/impl_helper/basic_point_methods.rb +43 -43
  84. data/lib/rgeo/impl_helper/basic_polygon_methods.rb +35 -35
  85. data/lib/rgeo/impl_helper/math.rb +13 -13
  86. data/lib/rgeo/version.rb +10 -10
  87. data/lib/rgeo/wkrep.rb +16 -16
  88. data/lib/rgeo/wkrep/wkb_generator.rb +51 -51
  89. data/lib/rgeo/wkrep/wkb_parser.rb +52 -52
  90. data/lib/rgeo/wkrep/wkt_generator.rb +51 -51
  91. data/lib/rgeo/wkrep/wkt_parser.rb +66 -66
  92. data/lib/rgeo/yaml.rb +14 -14
  93. data/test/common/geometry_collection_tests.rb +53 -53
  94. data/test/common/line_string_tests.rb +57 -57
  95. data/test/common/multi_line_string_tests.rb +43 -43
  96. data/test/common/multi_point_tests.rb +43 -43
  97. data/test/common/multi_polygon_tests.rb +43 -43
  98. data/test/common/point_tests.rb +75 -75
  99. data/test/common/polygon_tests.rb +37 -37
  100. data/test/coord_sys/tc_active_record_table.rb +25 -25
  101. data/test/coord_sys/tc_ogc_cs.rb +72 -72
  102. data/test/coord_sys/tc_proj4.rb +51 -51
  103. data/test/coord_sys/tc_proj4_srs_data.rb +17 -17
  104. data/test/coord_sys/tc_sr_org.rb +15 -15
  105. data/test/coord_sys/tc_url_reader.rb +19 -19
  106. data/test/geos_capi/tc_factory.rb +21 -21
  107. data/test/geos_capi/tc_geometry_collection.rb +15 -15
  108. data/test/geos_capi/tc_line_string.rb +15 -15
  109. data/test/geos_capi/tc_misc.rb +33 -22
  110. data/test/geos_capi/tc_multi_line_string.rb +15 -15
  111. data/test/geos_capi/tc_multi_point.rb +15 -15
  112. data/test/geos_capi/tc_multi_polygon.rb +15 -15
  113. data/test/geos_capi/tc_parsing_unparsing.rb +19 -19
  114. data/test/geos_capi/tc_point.rb +21 -21
  115. data/test/geos_capi/tc_polygon.rb +19 -19
  116. data/test/geos_capi/tc_zmfactory.rb +17 -17
  117. data/test/geos_ffi/tc_factory.rb +21 -21
  118. data/test/geos_ffi/tc_geometry_collection.rb +15 -15
  119. data/test/geos_ffi/tc_line_string.rb +15 -15
  120. data/test/geos_ffi/tc_misc.rb +49 -15
  121. data/test/geos_ffi/tc_multi_line_string.rb +15 -15
  122. data/test/geos_ffi/tc_multi_point.rb +15 -15
  123. data/test/geos_ffi/tc_multi_polygon.rb +15 -15
  124. data/test/geos_ffi/tc_parsing_unparsing.rb +19 -19
  125. data/test/geos_ffi/tc_point.rb +21 -21
  126. data/test/geos_ffi/tc_polygon.rb +19 -19
  127. data/test/geos_ffi/tc_zmfactory.rb +17 -17
  128. data/test/projected_geographic/tc_geometry_collection.rb +15 -15
  129. data/test/projected_geographic/tc_line_string.rb +15 -15
  130. data/test/projected_geographic/tc_multi_line_string.rb +15 -15
  131. data/test/projected_geographic/tc_multi_point.rb +15 -15
  132. data/test/projected_geographic/tc_multi_polygon.rb +15 -15
  133. data/test/projected_geographic/tc_point.rb +23 -23
  134. data/test/projected_geographic/tc_polygon.rb +15 -15
  135. data/test/simple_cartesian/tc_calculations.rb +31 -31
  136. data/test/simple_cartesian/tc_geometry_collection.rb +17 -17
  137. data/test/simple_cartesian/tc_line_string.rb +17 -17
  138. data/test/simple_cartesian/tc_multi_line_string.rb +17 -17
  139. data/test/simple_cartesian/tc_multi_point.rb +17 -17
  140. data/test/simple_cartesian/tc_multi_polygon.rb +17 -17
  141. data/test/simple_cartesian/tc_point.rb +21 -21
  142. data/test/simple_cartesian/tc_polygon.rb +17 -17
  143. data/test/simple_mercator/tc_geometry_collection.rb +15 -15
  144. data/test/simple_mercator/tc_line_string.rb +15 -15
  145. data/test/simple_mercator/tc_multi_line_string.rb +15 -15
  146. data/test/simple_mercator/tc_multi_point.rb +15 -15
  147. data/test/simple_mercator/tc_multi_polygon.rb +15 -15
  148. data/test/simple_mercator/tc_point.rb +23 -23
  149. data/test/simple_mercator/tc_polygon.rb +15 -15
  150. data/test/simple_mercator/tc_window.rb +50 -50
  151. data/test/spherical_geographic/tc_calculations.rb +47 -47
  152. data/test/spherical_geographic/tc_geometry_collection.rb +17 -17
  153. data/test/spherical_geographic/tc_line_string.rb +17 -17
  154. data/test/spherical_geographic/tc_multi_line_string.rb +17 -17
  155. data/test/spherical_geographic/tc_multi_point.rb +17 -17
  156. data/test/spherical_geographic/tc_multi_polygon.rb +17 -17
  157. data/test/spherical_geographic/tc_point.rb +23 -23
  158. data/test/spherical_geographic/tc_polygon.rb +17 -17
  159. data/test/tc_cartesian_analysis.rb +23 -23
  160. data/test/tc_mixins.rb +39 -39
  161. data/test/tc_oneoff.rb +15 -15
  162. data/test/tc_types.rb +17 -17
  163. data/test/wkrep/tc_wkb_generator.rb +67 -67
  164. data/test/wkrep/tc_wkb_parser.rb +73 -73
  165. data/test/wkrep/tc_wkt_generator.rb +75 -75
  166. data/test/wkrep/tc_wkt_parser.rb +97 -97
  167. metadata +3 -3
@@ -1,15 +1,15 @@
1
1
  # -----------------------------------------------------------------------------
2
- #
2
+ #
3
3
  # SRS database interface
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,10 +35,10 @@
35
35
 
36
36
 
37
37
  module RGeo
38
-
38
+
39
39
  module CoordSys
40
-
41
-
40
+
41
+
42
42
  # This module contains tools for accessing spatial reference
43
43
  # databases. These are databases (either local or remote) from which
44
44
  # you can look up coordinate system specifications, typically in
@@ -47,51 +47,51 @@ module RGeo
47
47
  # such as PostGIS. You can also read the database files provided with
48
48
  # the proj4 library, or access online databases such as the
49
49
  # spatialreference.org site.
50
-
50
+
51
51
  module SRSDatabase
52
-
53
-
52
+
53
+
54
54
  # Interface specification for spatial reference system databases.
55
55
  # This module exists primarily for the sake of documentation.
56
56
  # Database implementations need not actually include this module,
57
57
  # but at least need to duck-type its methods.
58
-
58
+
59
59
  module Interface
60
-
61
-
60
+
61
+
62
62
  # Retrieve an Entry given an identifier. The identifier is usually
63
63
  # a numeric spatial reference ID (SRID), but could be a string
64
64
  # value for certain database types.
65
-
65
+
66
66
  def get(ident_)
67
67
  nil
68
68
  end
69
-
70
-
69
+
70
+
71
71
  # Clears any cache utilized by this database.
72
-
72
+
73
73
  def clear_cache
74
74
  nil
75
75
  end
76
-
77
-
76
+
77
+
78
78
  end
79
-
80
-
79
+
80
+
81
81
  # An entry in a spatial reference system database.
82
82
  # Every entry has an identifier, but all the other attributes are
83
83
  # optional and may or may not be present depending on the database.
84
-
84
+
85
85
  class Entry
86
-
87
-
86
+
87
+
88
88
  # Create an entry.
89
89
  # You must provide an identifier, which may be numeric or a
90
90
  # string. The data hash should contain any other attributes,
91
91
  # keyed by symbol.
92
- #
92
+ #
93
93
  # Some attribute inputs have special behaviors:
94
- #
94
+ #
95
95
  # [<tt>:coord_sys</tt>]
96
96
  # You can pass a CS coordinate system object, or a string in
97
97
  # WKT format.
@@ -106,7 +106,7 @@ module RGeo
106
106
  # [<tt>:authority_code</tt>]
107
107
  # If the authority code is not provided directly, it is taken
108
108
  # from the coord_sys.
109
-
109
+
110
110
  def initialize(ident_, data_={})
111
111
  @identifier = ident_
112
112
  @authority = data_[:authority]
@@ -131,35 +131,35 @@ module RGeo
131
131
  @authority_code = @coord_sys.authority unless @authority_code
132
132
  end
133
133
  end
134
-
135
-
134
+
135
+
136
136
  # The database key or identifier.
137
137
  attr_reader :identifier
138
-
138
+
139
139
  # The authority name, if present. Example: "epsg".
140
140
  attr_reader :authority
141
-
141
+
142
142
  # The authority code, e.g. an EPSG code.
143
143
  attr_reader :authority_code
144
-
144
+
145
145
  # A human-readable name for this coordinate system.
146
146
  attr_reader :name
147
-
147
+
148
148
  # A human-readable description for this coordinate system.
149
149
  attr_reader :description
150
-
150
+
151
151
  # The CS::CoordinateSystem object.
152
152
  attr_reader :coord_sys
153
-
153
+
154
154
  # The Proj4 object.
155
155
  attr_reader :proj4
156
-
157
-
156
+
157
+
158
158
  end
159
-
160
-
159
+
160
+
161
161
  end
162
-
162
+
163
163
  end
164
-
164
+
165
165
  end
@@ -1,15 +1,15 @@
1
1
  # -----------------------------------------------------------------------------
2
- #
2
+ #
3
3
  # SRS database interface
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,26 +35,26 @@
35
35
 
36
36
 
37
37
  module RGeo
38
-
38
+
39
39
  module CoordSys
40
-
40
+
41
41
  module SRSDatabase
42
-
43
-
42
+
43
+
44
44
  # A spatial reference database implementation backed by coordinate
45
45
  # system files installed as part of the proj4 library. For a given
46
46
  # Proj4Data object, you specify a single file (e.g. the epsg data
47
47
  # file), and you can retrieve records by ID number.
48
-
48
+
49
49
  class Proj4Data
50
-
51
-
50
+
51
+
52
52
  # Connect to one of the proj4 data files. You should provide the
53
53
  # file name, optionally the installation directory if it is not
54
54
  # in a typical location, and several additional options.
55
- #
55
+ #
56
56
  # These options are recognized:
57
- #
57
+ #
58
58
  # [<tt>:dir</tt>]
59
59
  # The path for the share/proj directory that contains the
60
60
  # requested data file. By default, the Proj4Data class will
@@ -77,7 +77,7 @@ module RGeo
77
77
  # If set, its value is taken as the authority name for all
78
78
  # entries. The authority code will be set to the identifier. If
79
79
  # not set, then the authority fields of entries will be blank.
80
-
80
+
81
81
  def initialize(filename_, opts_={})
82
82
  dir_ = nil
83
83
  if opts_.include?(:dir)
@@ -108,10 +108,10 @@ module RGeo
108
108
  @populate_state = 0
109
109
  end
110
110
  end
111
-
112
-
111
+
112
+
113
113
  # Retrieve the Entry for the given ID number.
114
-
114
+
115
115
  def get(ident_)
116
116
  ident_ = ident_.to_s
117
117
  return @cache[ident_] if @cache && @cache.include?(ident_)
@@ -127,16 +127,16 @@ module RGeo
127
127
  end
128
128
  result_
129
129
  end
130
-
131
-
130
+
131
+
132
132
  # Clear the cache if one exists.
133
-
133
+
134
134
  def clear_cache
135
135
  @cache.clear if @cache
136
136
  @populate_state = 1 if @populate_state == 2
137
137
  end
138
-
139
-
138
+
139
+
140
140
  def _search_file(ident_) # :nodoc:
141
141
  ::File.open(@path) do |file_|
142
142
  cur_name_ = nil
@@ -176,13 +176,13 @@ module RGeo
176
176
  end
177
177
  nil
178
178
  end
179
-
180
-
179
+
180
+
181
181
  end
182
-
183
-
182
+
183
+
184
184
  end
185
-
185
+
186
186
  end
187
-
187
+
188
188
  end
@@ -1,15 +1,15 @@
1
1
  # -----------------------------------------------------------------------------
2
- #
2
+ #
3
3
  # SRS database interface
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
@@ -38,42 +38,42 @@ require 'net/http'
38
38
 
39
39
 
40
40
  module RGeo
41
-
41
+
42
42
  module CoordSys
43
-
43
+
44
44
  module SRSDatabase
45
-
46
-
45
+
46
+
47
47
  # A spatial reference database implementation that fetches data
48
48
  # from the spatialreference.org website.
49
-
49
+
50
50
  class SrOrg
51
-
52
-
51
+
52
+
53
53
  # Create a database backed by the given catalog of the
54
54
  # spatialreference.org website. Catalogs currently supported by
55
55
  # spatialreference.org are "epsg", "esri", "iau2000" and "sr-org".
56
- #
56
+ #
57
57
  # Options:
58
- #
58
+ #
59
59
  # [<tt>:cache</tt>]
60
60
  # If set to true, lookup results are cached so if the same URL
61
61
  # is requested again, the result is served from cache rather
62
62
  # than issuing another HTTP request. Default is false.
63
-
63
+
64
64
  def initialize(catalog_, opts_={})
65
65
  @catalog = catalog_.to_s.downcase
66
66
  @cache = opts_[:cache] ? {} : nil
67
67
  end
68
-
69
-
68
+
69
+
70
70
  # The spatialreference.org catalog used by this database.
71
71
  attr_reader :catalog
72
-
73
-
72
+
73
+
74
74
  # Retrieve the Entry from a spatialreference.org catalog given an
75
75
  # integer ID.
76
-
76
+
77
77
  def get(ident_)
78
78
  ident_ = ident_.to_s
79
79
  return @cache[ident_] if @cache && @cache.include?(ident_)
@@ -89,20 +89,20 @@ module RGeo
89
89
  @cache[ident_] = result_ if @cache
90
90
  result_
91
91
  end
92
-
93
-
92
+
93
+
94
94
  # Clear the cache if one exists.
95
-
95
+
96
96
  def clear_cache
97
97
  @cache.clear if @cache
98
98
  end
99
-
100
-
99
+
100
+
101
101
  end
102
-
103
-
102
+
103
+
104
104
  end
105
-
105
+
106
106
  end
107
-
107
+
108
108
  end
@@ -1,15 +1,15 @@
1
1
  # -----------------------------------------------------------------------------
2
- #
2
+ #
3
3
  # SRS database interface
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
@@ -38,36 +38,36 @@ require 'net/http'
38
38
 
39
39
 
40
40
  module RGeo
41
-
41
+
42
42
  module CoordSys
43
-
43
+
44
44
  module SRSDatabase
45
-
46
-
45
+
46
+
47
47
  # A spatial reference database implementation that fetches data from
48
48
  # internet URLs.
49
-
49
+
50
50
  class UrlReader
51
-
52
-
51
+
52
+
53
53
  # Create a URL-based spatial reference database.
54
- #
54
+ #
55
55
  # Options:
56
- #
56
+ #
57
57
  # [<tt>:cache</tt>]
58
58
  # If set to true, lookup results are cached so if the same URL
59
59
  # is requested again, the result is served from cache rather
60
60
  # than issuing another HTTP request. Default is false.
61
-
61
+
62
62
  def initialize(opts_={})
63
63
  @cache = opts_[:cache] ? {} : nil
64
64
  end
65
-
66
-
65
+
66
+
67
67
  # Retrieve the given URL and return an Entry.
68
68
  # Returns nil if the URL cannot be read as an OGC WKT or Proj4
69
69
  # coordinate system
70
-
70
+
71
71
  def get(ident_)
72
72
  ident_ = ident_.to_s
73
73
  return @cache[ident_] if @cache && @cache.include?(ident_)
@@ -89,20 +89,20 @@ module RGeo
89
89
  @cache[ident_] = result_ if @cache
90
90
  result_
91
91
  end
92
-
93
-
92
+
93
+
94
94
  # Clear the cache if one is present.
95
-
95
+
96
96
  def clear_cache
97
97
  @cache.clear if @cache
98
98
  end
99
-
100
-
99
+
100
+
101
101
  end
102
-
103
-
102
+
103
+
104
104
  end
105
-
105
+
106
106
  end
107
-
107
+
108
108
  end