rgeo 0.1.19 → 0.1.20
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +11 -0
- data/README.rdoc +23 -7
- data/Version +1 -1
- data/ext/geos_c_impl/factory.c +1 -1
- data/{lib/rgeo/geography/simple_mercator.rb → ext/proj4_c_impl/extconf.rb} +35 -30
- data/ext/proj4_c_impl/main.c +256 -0
- data/lib/rgeo.rb +54 -42
- data/lib/rgeo/active_record/arel_modifications.rb +2 -2
- data/lib/rgeo/active_record/base_modifications.rb +1 -1
- data/lib/rgeo/active_record/mysql_common.rb +12 -12
- data/lib/rgeo/all.rb +5 -4
- data/lib/rgeo/cartesian.rb +3 -2
- data/lib/rgeo/cartesian/bounding_box.rb +9 -9
- data/lib/rgeo/cartesian/factory.rb +30 -13
- data/lib/rgeo/cartesian/feature_classes.rb +33 -33
- data/lib/rgeo/cartesian/interface.rb +2 -2
- data/lib/rgeo/{geography/all.rb → coord_sys.rb} +22 -4
- data/lib/rgeo/coord_sys/proj4.rb +275 -0
- data/lib/rgeo/{errors.rb → error.rb} +5 -6
- data/lib/rgeo/{features.rb → feature.rb} +22 -20
- data/lib/rgeo/{features → feature}/curve.rb +6 -6
- data/lib/rgeo/{features → feature}/factory.rb +19 -3
- data/lib/rgeo/{features → feature}/factory_generator.rb +1 -1
- data/lib/rgeo/{features → feature}/geometry.rb +34 -34
- data/lib/rgeo/{features → feature}/geometry_collection.rb +4 -4
- data/lib/rgeo/{features → feature}/line.rb +1 -1
- data/lib/rgeo/{features → feature}/line_string.rb +4 -4
- data/lib/rgeo/{features → feature}/linear_ring.rb +1 -1
- data/lib/rgeo/{features → feature}/multi_curve.rb +3 -3
- data/lib/rgeo/{features → feature}/multi_line_string.rb +1 -1
- data/lib/rgeo/{features → feature}/multi_point.rb +1 -1
- data/lib/rgeo/{features → feature}/multi_polygon.rb +1 -1
- data/lib/rgeo/{features → feature}/multi_surface.rb +4 -4
- data/lib/rgeo/{features → feature}/point.rb +5 -5
- data/lib/rgeo/{features → feature}/polygon.rb +5 -5
- data/lib/rgeo/{features → feature}/surface.rb +4 -4
- data/lib/rgeo/feature/types.rb +301 -0
- data/lib/rgeo/geo_json.rb +1 -1
- data/lib/rgeo/geo_json/coder.rb +13 -13
- data/lib/rgeo/geo_json/interface.rb +2 -2
- data/lib/rgeo/geography.rb +33 -6
- data/lib/rgeo/geography/factory.rb +82 -39
- data/lib/rgeo/geography/interface.rb +135 -89
- data/lib/rgeo/geography/proj4_projector.rb +98 -0
- data/lib/rgeo/geography/projected_feature_classes.rb +213 -0
- data/lib/rgeo/geography/projected_feature_methods.rb +228 -0
- data/lib/rgeo/geography/projected_window.rb +7 -7
- data/lib/rgeo/geography/simple_mercator_projector.rb +133 -0
- data/lib/rgeo/geography/spherical_feature_classes.rb +212 -0
- data/lib/rgeo/geography/{simple_spherical/feature_methods.rb → spherical_feature_methods.rb} +39 -43
- data/lib/rgeo/geography/{simple_spherical/calculations.rb → spherical_math.rb} +7 -7
- data/lib/rgeo/geos.rb +1 -1
- data/lib/rgeo/geos/factory.rb +37 -19
- data/lib/rgeo/geos/impl_additions.rb +10 -11
- data/lib/rgeo/geos/interface.rb +1 -1
- data/lib/rgeo/geos/zm_factory.rb +15 -15
- data/lib/rgeo/geos/zm_impl.rb +10 -10
- data/lib/rgeo/{impl_helpers.rb → impl_helper.rb} +8 -8
- data/lib/rgeo/{impl_helpers → impl_helper}/basic_geometry_collection_methods.rb +13 -13
- data/lib/rgeo/{impl_helpers → impl_helper}/basic_geometry_methods.rb +2 -2
- data/lib/rgeo/{impl_helpers → impl_helper}/basic_line_string_methods.rb +13 -13
- data/lib/rgeo/{impl_helpers → impl_helper}/basic_point_methods.rb +5 -5
- data/lib/rgeo/{impl_helpers → impl_helper}/basic_polygon_methods.rb +6 -6
- data/lib/rgeo/{impl_helpers → impl_helper}/math.rb +1 -1
- data/lib/rgeo/shapefile.rb +1 -1
- data/lib/rgeo/shapefile/reader.rb +3 -3
- data/lib/rgeo/wkrep.rb +1 -1
- data/lib/rgeo/wkrep/wkb_generator.rb +17 -17
- data/lib/rgeo/wkrep/wkb_parser.rb +12 -12
- data/lib/rgeo/wkrep/wkt_generator.rb +8 -8
- data/lib/rgeo/wkrep/wkt_parser.rb +10 -10
- data/{tests → test}/active_record/readme.txt +0 -0
- data/{tests → test}/active_record/tc_mysqlspatial.rb +2 -2
- data/{tests → test}/common/geometry_collection_tests.rb +22 -22
- data/{tests → test}/common/line_string_tests.rb +20 -20
- data/{tests → test}/common/multi_line_string_tests.rb +19 -19
- data/{tests → test}/common/multi_point_tests.rb +17 -17
- data/{tests → test}/common/multi_polygon_tests.rb +16 -16
- data/{tests → test}/common/point_tests.rb +9 -9
- data/{tests → test}/common/polygon_tests.rb +9 -9
- data/test/coord_sys/tc_proj4.rb +111 -0
- data/{tests → test}/geos/tc_factory.rb +1 -1
- data/{tests → test}/geos/tc_geometry_collection.rb +1 -1
- data/{tests → test}/geos/tc_line_string.rb +0 -0
- data/{tests → test}/geos/tc_misc.rb +1 -1
- data/{tests → test}/geos/tc_multi_line_string.rb +1 -1
- data/{tests → test}/geos/tc_multi_point.rb +1 -1
- data/{tests → test}/geos/tc_multi_polygon.rb +1 -1
- data/{tests → test}/geos/tc_point.rb +1 -1
- data/{tests → test}/geos/tc_polygon.rb +0 -0
- data/{tests → test}/geos/tc_zmfactory.rb +2 -2
- data/test/projected_geography/tc_geometry_collection.rb +62 -0
- data/test/projected_geography/tc_line_string.rb +62 -0
- data/test/projected_geography/tc_multi_line_string.rb +62 -0
- data/test/projected_geography/tc_multi_point.rb +62 -0
- data/test/projected_geography/tc_multi_polygon.rb +63 -0
- data/test/projected_geography/tc_point.rb +93 -0
- data/test/projected_geography/tc_polygon.rb +62 -0
- data/{tests → test}/shapefile/shapelib_testcases/readme.txt +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test.dbf +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test0.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test0.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test1.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test1.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test10.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test10.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test11.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test11.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test12.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test12.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test13.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test13.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test2.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test2.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test3.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test3.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test4.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test4.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test5.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test5.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test6.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test6.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test7.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test7.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test8.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test8.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test9.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test9.shx +0 -0
- data/{tests → test}/shapefile/tc_shapelib_tests.rb +17 -17
- data/{tests → test}/simple_cartesian/tc_calculations.rb +0 -0
- data/{tests → test}/simple_cartesian/tc_geometry_collection.rb +0 -0
- data/{tests → test}/simple_cartesian/tc_line_string.rb +0 -0
- data/{tests → test}/simple_cartesian/tc_multi_line_string.rb +0 -0
- data/{tests → test}/simple_cartesian/tc_multi_point.rb +0 -0
- data/{tests → test}/simple_cartesian/tc_multi_polygon.rb +0 -0
- data/{tests → test}/simple_cartesian/tc_point.rb +0 -0
- data/{tests → test}/simple_cartesian/tc_polygon.rb +0 -0
- data/{tests → test}/simple_mercator/tc_geometry_collection.rb +1 -1
- data/{tests → test}/simple_mercator/tc_line_string.rb +0 -0
- data/{tests → test}/simple_mercator/tc_multi_line_string.rb +1 -1
- data/{tests → test}/simple_mercator/tc_multi_point.rb +1 -1
- data/{tests → test}/simple_mercator/tc_multi_polygon.rb +1 -1
- data/{tests → test}/simple_mercator/tc_point.rb +2 -2
- data/{tests → test}/simple_mercator/tc_polygon.rb +0 -0
- data/{tests → test}/simple_mercator/tc_window.rb +1 -1
- data/test/spherical_geography/tc_calculations.rb +203 -0
- data/{tests/simple_spherical → test/spherical_geography}/tc_geometry_collection.rb +2 -2
- data/{tests/simple_spherical → test/spherical_geography}/tc_line_string.rb +2 -2
- data/{tests/simple_spherical → test/spherical_geography}/tc_multi_line_string.rb +2 -2
- data/{tests/simple_spherical → test/spherical_geography}/tc_multi_point.rb +2 -2
- data/{tests/simple_spherical → test/spherical_geography}/tc_multi_polygon.rb +3 -3
- data/{tests/simple_spherical → test/spherical_geography}/tc_point.rb +7 -7
- data/{tests/simple_spherical → test/spherical_geography}/tc_polygon.rb +2 -2
- data/{tests → test}/tc_cartesian_analysis.rb +0 -0
- data/{tests → test}/tc_geojson.rb +0 -0
- data/{tests → test}/tc_oneoff.rb +2 -1
- data/{tests → test}/wkrep/tc_wkb_generator.rb +0 -0
- data/{tests → test}/wkrep/tc_wkb_parser.rb +32 -32
- data/{tests → test}/wkrep/tc_wkt_generator.rb +0 -0
- data/{tests → test}/wkrep/tc_wkt_parser.rb +46 -46
- metadata +183 -164
- data/lib/rgeo/features/types.rb +0 -272
- data/lib/rgeo/geography/simple_mercator/feature_classes.rb +0 -279
- data/lib/rgeo/geography/simple_mercator/feature_methods.rb +0 -278
- data/lib/rgeo/geography/simple_mercator/projector.rb +0 -112
- data/lib/rgeo/geography/simple_spherical.rb +0 -68
- data/lib/rgeo/geography/simple_spherical/feature_classes.rb +0 -216
- data/tests/simple_spherical/tc_calculations.rb +0 -203
@@ -58,12 +58,12 @@ module Arel
|
|
58
58
|
|
59
59
|
class Dot
|
60
60
|
alias :visit_Arel_Attributes_Geometry :visit_Arel_Attribute
|
61
|
-
alias :
|
61
|
+
alias :visit_RGeo_Feature_Geometry :visit_String
|
62
62
|
end
|
63
63
|
|
64
64
|
class ToSql
|
65
65
|
alias :visit_Arel_Attributes_Geometry :visit_Arel_Attributes_Attribute
|
66
|
-
alias :
|
66
|
+
alias :visit_RGeo_Feature_Geometry :visit_String
|
67
67
|
end
|
68
68
|
|
69
69
|
VISITORS['postgis'] = ::Arel::Visitors::PostgreSQL
|
@@ -50,7 +50,7 @@ module ActiveRecord
|
|
50
50
|
#
|
51
51
|
# === ActiveRecord::Base::rgeo_factory_generator
|
52
52
|
#
|
53
|
-
# The value of this attribute is a RGeo::
|
53
|
+
# The value of this attribute is a RGeo::Feature::FactoryGenerator
|
54
54
|
# that is used to generate the proper factory when loading geometry
|
55
55
|
# objects from the database. For example, if the data being loaded
|
56
56
|
# has M but not Z coordinates, and an embedded SRID, then this
|
@@ -34,7 +34,7 @@
|
|
34
34
|
;
|
35
35
|
|
36
36
|
|
37
|
-
require 'rgeo/
|
37
|
+
require 'rgeo/feature'
|
38
38
|
require 'rgeo/cartesian'
|
39
39
|
require 'rgeo/wkrep'
|
40
40
|
require 'rgeo/active_record/common'
|
@@ -52,7 +52,7 @@ module RGeo
|
|
52
52
|
|
53
53
|
|
54
54
|
def quote(value_, column_=nil)
|
55
|
-
if ::RGeo::
|
55
|
+
if ::RGeo::Feature::Geometry.check_type(value_)
|
56
56
|
"GeomFromWKB(0x#{::RGeo::WKRep::WKBGenerator.new(:hex_format => true).generate(value_)},#{value_.srid})"
|
57
57
|
else
|
58
58
|
super
|
@@ -104,7 +104,7 @@ module RGeo
|
|
104
104
|
|
105
105
|
|
106
106
|
def klass
|
107
|
-
type == :geometry ? ::RGeo::
|
107
|
+
type == :geometry ? ::RGeo::Feature::Geometry : super
|
108
108
|
end
|
109
109
|
|
110
110
|
|
@@ -122,14 +122,14 @@ module RGeo
|
|
122
122
|
|
123
123
|
def extract_geometric_type(sql_type_)
|
124
124
|
case sql_type_
|
125
|
-
when /^geometry$/i then ::RGeo::
|
126
|
-
when /^point$/i then ::RGeo::
|
127
|
-
when /^linestring$/i then ::RGeo::
|
128
|
-
when /^polygon$/i then ::RGeo::
|
129
|
-
when /^geometrycollection$/i then ::RGeo::
|
130
|
-
when /^multipoint$/i then ::RGeo::
|
131
|
-
when /^multilinestring$/i then ::RGeo::
|
132
|
-
when /^multipolygon$/i then ::RGeo::
|
125
|
+
when /^geometry$/i then ::RGeo::Feature::Geometry
|
126
|
+
when /^point$/i then ::RGeo::Feature::Point
|
127
|
+
when /^linestring$/i then ::RGeo::Feature::LineString
|
128
|
+
when /^polygon$/i then ::RGeo::Feature::Polygon
|
129
|
+
when /^geometrycollection$/i then ::RGeo::Feature::GeometryCollection
|
130
|
+
when /^multipoint$/i then ::RGeo::Feature::MultiPoint
|
131
|
+
when /^multilinestring$/i then ::RGeo::Feature::MultiLineString
|
132
|
+
when /^multipolygon$/i then ::RGeo::Feature::MultiPolygon
|
133
133
|
else nil
|
134
134
|
end
|
135
135
|
end
|
@@ -142,7 +142,7 @@ module RGeo
|
|
142
142
|
|
143
143
|
def self.string_to_geometry(str_, ar_class_)
|
144
144
|
case str_
|
145
|
-
when ::RGeo::
|
145
|
+
when ::RGeo::Feature::Geometry
|
146
146
|
str_
|
147
147
|
when ::String
|
148
148
|
marker_ = str_[4,1]
|
data/lib/rgeo/all.rb
CHANGED
@@ -38,11 +38,12 @@
|
|
38
38
|
require 'rgeo'
|
39
39
|
|
40
40
|
# Implementation files
|
41
|
-
require 'rgeo/
|
42
|
-
require 'rgeo/
|
43
|
-
require 'rgeo/
|
41
|
+
require 'rgeo/error'
|
42
|
+
require 'rgeo/feature'
|
43
|
+
require 'rgeo/impl_helper'
|
44
44
|
require 'rgeo/wkrep'
|
45
45
|
require 'rgeo/geos'
|
46
46
|
require 'rgeo/cartesian'
|
47
|
-
require 'rgeo/geography
|
47
|
+
require 'rgeo/geography'
|
48
48
|
require 'rgeo/geo_json'
|
49
|
+
require 'rgeo/shapefile'
|
data/lib/rgeo/cartesian.rb
CHANGED
@@ -55,9 +55,10 @@ end
|
|
55
55
|
|
56
56
|
|
57
57
|
# Dependency files.
|
58
|
-
require 'rgeo/
|
58
|
+
require 'rgeo/feature'
|
59
|
+
require 'rgeo/geos'
|
59
60
|
require 'rgeo/wkrep'
|
60
|
-
require 'rgeo/
|
61
|
+
require 'rgeo/impl_helper'
|
61
62
|
|
62
63
|
# Implementation files.
|
63
64
|
require 'rgeo/cartesian/calculations'
|
@@ -212,7 +212,7 @@ module RGeo
|
|
212
212
|
when BoundingBox
|
213
213
|
add(geometry_.min_point)
|
214
214
|
add(geometry_.max_point)
|
215
|
-
when
|
215
|
+
when Feature::Geometry
|
216
216
|
if geometry_.factory == @factory
|
217
217
|
_add_geometry(geometry_)
|
218
218
|
else
|
@@ -264,7 +264,7 @@ module RGeo
|
|
264
264
|
# have M. Default is false.
|
265
265
|
|
266
266
|
def contains?(rhs_, opts_={})
|
267
|
-
if
|
267
|
+
if Feature::Geometry === rhs_
|
268
268
|
contains?(BoundingBox.new(@factory).add(rhs_))
|
269
269
|
elsif rhs_.empty?
|
270
270
|
true
|
@@ -284,19 +284,19 @@ module RGeo
|
|
284
284
|
|
285
285
|
def _add_geometry(geometry_) # :nodoc:
|
286
286
|
case geometry_
|
287
|
-
when
|
287
|
+
when Feature::Point
|
288
288
|
_add_point(geometry_)
|
289
|
-
when
|
289
|
+
when Feature::LineString
|
290
290
|
geometry_.points.each{ |p_| _add_point(p_) }
|
291
|
-
when
|
291
|
+
when Feature::Polygon
|
292
292
|
geometry_.exterior_ring.points.each{ |p_| _add_point(p_) }
|
293
|
-
when
|
293
|
+
when Feature::MultiPoint
|
294
294
|
geometry_.each{ |p_| _add_point(p_) }
|
295
|
-
when
|
295
|
+
when Feature::MultiLineString
|
296
296
|
geometry_.each{ |line_| line_.points.each{ |p_| _add_point(p_) } }
|
297
|
-
when
|
297
|
+
when Feature::MultiPolygon
|
298
298
|
geometry_.each{ |poly_| poly_.exterior_ring.points.each{ |p_| _add_point(p_) } }
|
299
|
-
when
|
299
|
+
when Feature::GeometryCollection
|
300
300
|
geometry_.each{ |g_| _add_geometry(g_) }
|
301
301
|
end
|
302
302
|
end
|
@@ -44,7 +44,7 @@ module RGeo
|
|
44
44
|
|
45
45
|
class Factory
|
46
46
|
|
47
|
-
include
|
47
|
+
include Feature::Factory::Instance
|
48
48
|
|
49
49
|
|
50
50
|
# Create a new simple cartesian factory.
|
@@ -55,6 +55,14 @@ module RGeo
|
|
55
55
|
@srid = opts_[:srid].to_i
|
56
56
|
@support_z = opts_[:support_z_coordinate] ? true : false
|
57
57
|
@support_m = opts_[:support_m_coordinate] ? true : false
|
58
|
+
@proj4 = opts_[:proj4]
|
59
|
+
if CoordSys::Proj4.supported?
|
60
|
+
if @proj4.kind_of?(::String) || @proj4.kind_of?(::Hash)
|
61
|
+
@proj4 = CoordSys::Proj4.create(@proj4)
|
62
|
+
end
|
63
|
+
else
|
64
|
+
@proj4 = nil
|
65
|
+
end
|
58
66
|
end
|
59
67
|
|
60
68
|
|
@@ -73,7 +81,7 @@ module RGeo
|
|
73
81
|
end
|
74
82
|
|
75
83
|
|
76
|
-
# See ::RGeo::
|
84
|
+
# See ::RGeo::Feature::Factory#has_capability?
|
77
85
|
|
78
86
|
def has_capability?(name_)
|
79
87
|
case name_
|
@@ -81,89 +89,98 @@ module RGeo
|
|
81
89
|
@support_z
|
82
90
|
when :m_coordinate
|
83
91
|
@support_m
|
92
|
+
when :proj4
|
93
|
+
!@proj4.nil?
|
84
94
|
else
|
85
95
|
nil
|
86
96
|
end
|
87
97
|
end
|
88
98
|
|
89
99
|
|
90
|
-
# See ::RGeo::
|
100
|
+
# See ::RGeo::Feature::Factory#parse_wkt
|
91
101
|
|
92
102
|
def parse_wkt(str_)
|
93
103
|
WKRep::WKTParser.new(:default_factory => self).parse(str_)
|
94
104
|
end
|
95
105
|
|
96
106
|
|
97
|
-
# See ::RGeo::
|
107
|
+
# See ::RGeo::Feature::Factory#parse_wkb
|
98
108
|
|
99
109
|
def parse_wkb(str_)
|
100
110
|
WKRep::WKBParser.new(:default_factory => self).parse(str_)
|
101
111
|
end
|
102
112
|
|
103
113
|
|
104
|
-
# See ::RGeo::
|
114
|
+
# See ::RGeo::Feature::Factory#point
|
105
115
|
|
106
116
|
def point(x_, y_, *extra_)
|
107
117
|
PointImpl.new(self, x_, y_, *extra_) rescue nil
|
108
118
|
end
|
109
119
|
|
110
120
|
|
111
|
-
# See ::RGeo::
|
121
|
+
# See ::RGeo::Feature::Factory#line_string
|
112
122
|
|
113
123
|
def line_string(points_)
|
114
124
|
LineStringImpl.new(self, points_) rescue nil
|
115
125
|
end
|
116
126
|
|
117
127
|
|
118
|
-
# See ::RGeo::
|
128
|
+
# See ::RGeo::Feature::Factory#line
|
119
129
|
|
120
130
|
def line(start_, end_)
|
121
131
|
LineImpl.new(self, start_, end_) rescue nil
|
122
132
|
end
|
123
133
|
|
124
134
|
|
125
|
-
# See ::RGeo::
|
135
|
+
# See ::RGeo::Feature::Factory#linear_ring
|
126
136
|
|
127
137
|
def linear_ring(points_)
|
128
138
|
LinearRingImpl.new(self, points_) rescue nil
|
129
139
|
end
|
130
140
|
|
131
141
|
|
132
|
-
# See ::RGeo::
|
142
|
+
# See ::RGeo::Feature::Factory#polygon
|
133
143
|
|
134
144
|
def polygon(outer_ring_, inner_rings_=nil)
|
135
145
|
PolygonImpl.new(self, outer_ring_, inner_rings_) rescue nil
|
136
146
|
end
|
137
147
|
|
138
148
|
|
139
|
-
# See ::RGeo::
|
149
|
+
# See ::RGeo::Feature::Factory#collection
|
140
150
|
|
141
151
|
def collection(elems_)
|
142
152
|
GeometryCollectionImpl.new(self, elems_) rescue nil
|
143
153
|
end
|
144
154
|
|
145
155
|
|
146
|
-
# See ::RGeo::
|
156
|
+
# See ::RGeo::Feature::Factory#multi_point
|
147
157
|
|
148
158
|
def multi_point(elems_)
|
149
159
|
MultiPointImpl.new(self, elems_) rescue nil
|
150
160
|
end
|
151
161
|
|
152
162
|
|
153
|
-
# See ::RGeo::
|
163
|
+
# See ::RGeo::Feature::Factory#multi_line_string
|
154
164
|
|
155
165
|
def multi_line_string(elems_)
|
156
166
|
MultiLineStringImpl.new(self, elems_) rescue nil
|
157
167
|
end
|
158
168
|
|
159
169
|
|
160
|
-
# See ::RGeo::
|
170
|
+
# See ::RGeo::Feature::Factory#multi_polygon
|
161
171
|
|
162
172
|
def multi_polygon(elems_)
|
163
173
|
MultiPolygonImpl.new(self, elems_) rescue nil
|
164
174
|
end
|
165
175
|
|
166
176
|
|
177
|
+
# See ::RGeo::Feature::Factory#proj4
|
178
|
+
|
179
|
+
def proj4
|
180
|
+
@proj4
|
181
|
+
end
|
182
|
+
|
183
|
+
|
167
184
|
end
|
168
185
|
|
169
186
|
|
@@ -42,14 +42,14 @@ module RGeo
|
|
42
42
|
class PointImpl # :nodoc:
|
43
43
|
|
44
44
|
|
45
|
-
include ::RGeo::
|
46
|
-
include ::RGeo::
|
47
|
-
include ::RGeo::
|
45
|
+
include ::RGeo::Feature::Point
|
46
|
+
include ::RGeo::ImplHelper::BasicGeometryMethods
|
47
|
+
include ::RGeo::ImplHelper::BasicPointMethods
|
48
48
|
include ::RGeo::Cartesian::GeometryMethods
|
49
49
|
|
50
50
|
|
51
51
|
def distance(rhs_)
|
52
|
-
rhs_ = ::RGeo::
|
52
|
+
rhs_ = ::RGeo::Feature.cast(rhs_, @factory)
|
53
53
|
case rhs_
|
54
54
|
when PointImpl
|
55
55
|
dx_ = @x - rhs_.x
|
@@ -67,9 +67,9 @@ module RGeo
|
|
67
67
|
class LineStringImpl # :nodoc:
|
68
68
|
|
69
69
|
|
70
|
-
include ::RGeo::
|
71
|
-
include ::RGeo::
|
72
|
-
include ::RGeo::
|
70
|
+
include ::RGeo::Feature::LineString
|
71
|
+
include ::RGeo::ImplHelper::BasicGeometryMethods
|
72
|
+
include ::RGeo::ImplHelper::BasicLineStringMethods
|
73
73
|
include ::RGeo::Cartesian::GeometryMethods
|
74
74
|
include ::RGeo::Cartesian::LineStringMethods
|
75
75
|
|
@@ -80,10 +80,10 @@ module RGeo
|
|
80
80
|
class LineImpl # :nodoc:
|
81
81
|
|
82
82
|
|
83
|
-
include ::RGeo::
|
84
|
-
include ::RGeo::
|
85
|
-
include ::RGeo::
|
86
|
-
include ::RGeo::
|
83
|
+
include ::RGeo::Feature::Line
|
84
|
+
include ::RGeo::ImplHelper::BasicGeometryMethods
|
85
|
+
include ::RGeo::ImplHelper::BasicLineStringMethods
|
86
|
+
include ::RGeo::ImplHelper::BasicLineMethods
|
87
87
|
include ::RGeo::Cartesian::GeometryMethods
|
88
88
|
include ::RGeo::Cartesian::LineStringMethods
|
89
89
|
|
@@ -94,10 +94,10 @@ module RGeo
|
|
94
94
|
class LinearRingImpl # :nodoc:
|
95
95
|
|
96
96
|
|
97
|
-
include ::RGeo::
|
98
|
-
include ::RGeo::
|
99
|
-
include ::RGeo::
|
100
|
-
include ::RGeo::
|
97
|
+
include ::RGeo::Feature::Line
|
98
|
+
include ::RGeo::ImplHelper::BasicGeometryMethods
|
99
|
+
include ::RGeo::ImplHelper::BasicLineStringMethods
|
100
|
+
include ::RGeo::ImplHelper::BasicLinearRingMethods
|
101
101
|
include ::RGeo::Cartesian::GeometryMethods
|
102
102
|
include ::RGeo::Cartesian::LineStringMethods
|
103
103
|
|
@@ -108,9 +108,9 @@ module RGeo
|
|
108
108
|
class PolygonImpl # :nodoc:
|
109
109
|
|
110
110
|
|
111
|
-
include ::RGeo::
|
112
|
-
include ::RGeo::
|
113
|
-
include ::RGeo::
|
111
|
+
include ::RGeo::Feature::Polygon
|
112
|
+
include ::RGeo::ImplHelper::BasicGeometryMethods
|
113
|
+
include ::RGeo::ImplHelper::BasicPolygonMethods
|
114
114
|
include ::RGeo::Cartesian::GeometryMethods
|
115
115
|
|
116
116
|
|
@@ -120,9 +120,9 @@ module RGeo
|
|
120
120
|
class GeometryCollectionImpl # :nodoc:
|
121
121
|
|
122
122
|
|
123
|
-
include ::RGeo::
|
124
|
-
include ::RGeo::
|
125
|
-
include ::RGeo::
|
123
|
+
include ::RGeo::Feature::GeometryCollection
|
124
|
+
include ::RGeo::ImplHelper::BasicGeometryMethods
|
125
|
+
include ::RGeo::ImplHelper::BasicGeometryCollectionMethods
|
126
126
|
include ::RGeo::Cartesian::GeometryMethods
|
127
127
|
|
128
128
|
|
@@ -132,10 +132,10 @@ module RGeo
|
|
132
132
|
class MultiPointImpl # :nodoc:
|
133
133
|
|
134
134
|
|
135
|
-
include ::RGeo::
|
136
|
-
include ::RGeo::
|
137
|
-
include ::RGeo::
|
138
|
-
include ::RGeo::
|
135
|
+
include ::RGeo::Feature::GeometryCollection
|
136
|
+
include ::RGeo::ImplHelper::BasicGeometryMethods
|
137
|
+
include ::RGeo::ImplHelper::BasicGeometryCollectionMethods
|
138
|
+
include ::RGeo::ImplHelper::BasicMultiPointMethods
|
139
139
|
include ::RGeo::Cartesian::GeometryMethods
|
140
140
|
|
141
141
|
|
@@ -145,10 +145,10 @@ module RGeo
|
|
145
145
|
class MultiLineStringImpl # :nodoc:
|
146
146
|
|
147
147
|
|
148
|
-
include ::RGeo::
|
149
|
-
include ::RGeo::
|
150
|
-
include ::RGeo::
|
151
|
-
include ::RGeo::
|
148
|
+
include ::RGeo::Feature::GeometryCollection
|
149
|
+
include ::RGeo::ImplHelper::BasicGeometryMethods
|
150
|
+
include ::RGeo::ImplHelper::BasicGeometryCollectionMethods
|
151
|
+
include ::RGeo::ImplHelper::BasicMultiLineStringMethods
|
152
152
|
include ::RGeo::Cartesian::GeometryMethods
|
153
153
|
|
154
154
|
|
@@ -158,10 +158,10 @@ module RGeo
|
|
158
158
|
class MultiPolygonImpl # :nodoc:
|
159
159
|
|
160
160
|
|
161
|
-
include ::RGeo::
|
162
|
-
include ::RGeo::
|
163
|
-
include ::RGeo::
|
164
|
-
include ::RGeo::
|
161
|
+
include ::RGeo::Feature::GeometryCollection
|
162
|
+
include ::RGeo::ImplHelper::BasicGeometryMethods
|
163
|
+
include ::RGeo::ImplHelper::BasicGeometryCollectionMethods
|
164
|
+
include ::RGeo::ImplHelper::BasicMultiPolygonMethods
|
165
165
|
include ::RGeo::Cartesian::GeometryMethods
|
166
166
|
|
167
167
|
|
@@ -70,9 +70,9 @@ module RGeo
|
|
70
70
|
# thus always available, but it does not implement many of the more
|
71
71
|
# advanced geometric operations. These limitations are:
|
72
72
|
#
|
73
|
-
# * Relational operators such as
|
73
|
+
# * Relational operators such as Feature::Geometry#intersects? are
|
74
74
|
# not implemented for most types.
|
75
|
-
# * Relational constructors such as
|
75
|
+
# * Relational constructors such as Feature::Geometry#union are
|
76
76
|
# not implemented for most types.
|
77
77
|
# * Buffer and convex hull calculations are not implemented for most
|
78
78
|
# types. Boundaries are available except for GeometryCollection.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
2
|
#
|
3
|
-
#
|
3
|
+
# GEOS wrapper for RGeo
|
4
4
|
#
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
# Copyright 2010 Daniel Azuma
|
@@ -34,7 +34,25 @@
|
|
34
34
|
;
|
35
35
|
|
36
36
|
|
37
|
-
|
37
|
+
# Parent file
|
38
|
+
require 'rgeo'
|
38
39
|
|
39
|
-
|
40
|
-
|
40
|
+
|
41
|
+
module RGeo
|
42
|
+
|
43
|
+
|
44
|
+
# Coordinate reference systems.
|
45
|
+
|
46
|
+
module CoordSys
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
# Dependency files
|
54
|
+
require 'rgeo/feature'
|
55
|
+
|
56
|
+
# Implementation files
|
57
|
+
require 'rgeo/coord_sys/proj4_c_impl'
|
58
|
+
require 'rgeo/coord_sys/proj4'
|