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
|
# Tests for OGC CS classes
|
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
|
@@ -41,36 +41,36 @@ require 'rgeo'
|
|
41
41
|
module RGeo
|
42
42
|
module Tests # :nodoc:
|
43
43
|
module CoordSys # :nodoc:
|
44
|
-
|
44
|
+
|
45
45
|
class TestProj4SRSData < ::Test::Unit::TestCase # :nodoc:
|
46
|
-
|
47
|
-
|
46
|
+
|
47
|
+
|
48
48
|
def test_epsg_4326
|
49
49
|
db_ = ::RGeo::CoordSys::SRSDatabase::Proj4Data.new('epsg')
|
50
50
|
entry_ = db_.get(4326)
|
51
51
|
assert_equal('+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', entry_.proj4.original_str)
|
52
52
|
assert_equal('WGS 84', entry_.name)
|
53
53
|
end
|
54
|
-
|
55
|
-
|
54
|
+
|
55
|
+
|
56
56
|
def test_epsg_3785
|
57
57
|
db_ = ::RGeo::CoordSys::SRSDatabase::Proj4Data.new('epsg')
|
58
58
|
entry_ = db_.get(3785)
|
59
59
|
assert_equal('+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', entry_.proj4.original_str)
|
60
60
|
assert_equal('Popular Visualisation CRS / Mercator (deprecated)', entry_.name)
|
61
61
|
end
|
62
|
-
|
63
|
-
|
62
|
+
|
63
|
+
|
64
64
|
def test_nad83_4601
|
65
65
|
db_ = ::RGeo::CoordSys::SRSDatabase::Proj4Data.new('nad83')
|
66
66
|
entry_ = db_.get(4601)
|
67
67
|
assert_equal('+proj=lcc +datum=NAD83 +lon_0=-120d50 +lat_1=48d44 +lat_2=47d30 +lat_0=47 +x_0=500000 +y_0=0 +no_defs', entry_.proj4.original_str)
|
68
68
|
assert_equal('4601: washington north: nad83', entry_.name)
|
69
69
|
end
|
70
|
-
|
71
|
-
|
70
|
+
|
71
|
+
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end if ::RGeo::CoordSys::Proj4.supported?
|
data/test/coord_sys/tc_sr_org.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Tests for OGC CS classes
|
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
|
@@ -41,10 +41,10 @@ require 'rgeo'
|
|
41
41
|
module RGeo
|
42
42
|
module Tests # :nodoc:
|
43
43
|
module CoordSys # :nodoc:
|
44
|
-
|
44
|
+
|
45
45
|
class TestSrOrg < ::Test::Unit::TestCase # :nodoc:
|
46
|
-
|
47
|
-
|
46
|
+
|
47
|
+
|
48
48
|
def test_epsg_4326
|
49
49
|
db_ = ::RGeo::CoordSys::SRSDatabase::SrOrg.new('epsg')
|
50
50
|
entry_ = db_.get(4326)
|
@@ -52,8 +52,8 @@ module RGeo
|
|
52
52
|
assert_kind_of(::RGeo::CoordSys::CS::GeographicCoordinateSystem, entry_.coord_sys)
|
53
53
|
assert_equal('WGS 84', entry_.name)
|
54
54
|
end
|
55
|
-
|
56
|
-
|
55
|
+
|
56
|
+
|
57
57
|
def test_epsg_3785
|
58
58
|
db_ = ::RGeo::CoordSys::SRSDatabase::SrOrg.new('epsg')
|
59
59
|
entry_ = db_.get(3785)
|
@@ -61,10 +61,10 @@ module RGeo
|
|
61
61
|
assert_kind_of(::RGeo::CoordSys::CS::ProjectedCoordinateSystem, entry_.coord_sys)
|
62
62
|
assert_equal('Popular Visualisation CRS / Mercator', entry_.name)
|
63
63
|
end
|
64
|
-
|
65
|
-
|
64
|
+
|
65
|
+
|
66
66
|
end if false
|
67
|
-
|
67
|
+
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Tests for OGC CS classes
|
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
|
@@ -41,42 +41,42 @@ require 'rgeo'
|
|
41
41
|
module RGeo
|
42
42
|
module Tests # :nodoc:
|
43
43
|
module CoordSys # :nodoc:
|
44
|
-
|
44
|
+
|
45
45
|
class TestUrlReader < ::Test::Unit::TestCase # :nodoc:
|
46
|
-
|
47
|
-
|
46
|
+
|
47
|
+
|
48
48
|
def test_sr_org_epsg_4326_ogcwkt
|
49
49
|
db_ = ::RGeo::CoordSys::SRSDatabase::UrlReader.new
|
50
50
|
entry_ = db_.get('http://spatialreference.org/ref/epsg/4326/ogcwkt/')
|
51
51
|
assert_kind_of(::RGeo::CoordSys::CS::GeographicCoordinateSystem, entry_.coord_sys)
|
52
52
|
assert_equal('WGS 84', entry_.name)
|
53
53
|
end
|
54
|
-
|
55
|
-
|
54
|
+
|
55
|
+
|
56
56
|
def test_sr_org_epsg_4326_proj4
|
57
57
|
db_ = ::RGeo::CoordSys::SRSDatabase::UrlReader.new
|
58
58
|
entry_ = db_.get('http://spatialreference.org/ref/epsg/4326/proj4/')
|
59
59
|
assert_equal('+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', entry_.proj4.original_str)
|
60
60
|
end
|
61
|
-
|
62
|
-
|
61
|
+
|
62
|
+
|
63
63
|
def test_sr_org_epsg_3785_ogcwkt
|
64
64
|
db_ = ::RGeo::CoordSys::SRSDatabase::UrlReader.new
|
65
65
|
entry_ = db_.get('http://spatialreference.org/ref/epsg/3785/ogcwkt/')
|
66
66
|
assert_kind_of(::RGeo::CoordSys::CS::ProjectedCoordinateSystem, entry_.coord_sys)
|
67
67
|
assert_equal('Popular Visualisation CRS / Mercator', entry_.name)
|
68
68
|
end
|
69
|
-
|
70
|
-
|
69
|
+
|
70
|
+
|
71
71
|
def test_sr_org_epsg_3785_proj4
|
72
72
|
db_ = ::RGeo::CoordSys::SRSDatabase::UrlReader.new
|
73
73
|
entry_ = db_.get('http://spatialreference.org/ref/epsg/3785/proj4/')
|
74
74
|
assert_equal('+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', entry_.proj4.original_str)
|
75
75
|
end
|
76
|
-
|
77
|
-
|
76
|
+
|
77
|
+
|
78
78
|
end if false
|
79
|
-
|
79
|
+
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Tests for the GEOS factory
|
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
|
@@ -41,15 +41,15 @@ require 'rgeo'
|
|
41
41
|
module RGeo
|
42
42
|
module Tests # :nodoc:
|
43
43
|
module GeosCAPI # :nodoc:
|
44
|
-
|
44
|
+
|
45
45
|
class TestFactory < ::Test::Unit::TestCase # :nodoc:
|
46
|
-
|
47
|
-
|
46
|
+
|
47
|
+
|
48
48
|
def setup
|
49
49
|
@factory = ::RGeo::Geos.factory(:srid => 4326)
|
50
50
|
end
|
51
|
-
|
52
|
-
|
51
|
+
|
52
|
+
|
53
53
|
def test_srid_preserved_through_factory
|
54
54
|
geom_ = @factory.point(-10, 20)
|
55
55
|
assert_equal(4326, geom_.srid)
|
@@ -58,8 +58,8 @@ module RGeo
|
|
58
58
|
geom2_ = factory_.point(-20, 25)
|
59
59
|
assert_equal(4326, geom2_.srid)
|
60
60
|
end
|
61
|
-
|
62
|
-
|
61
|
+
|
62
|
+
|
63
63
|
def test_srid_preserved_through_geom_operations
|
64
64
|
geom1_ = @factory.point(-10, 20)
|
65
65
|
geom2_ = @factory.point(-20, 25)
|
@@ -68,24 +68,24 @@ module RGeo
|
|
68
68
|
assert_equal(4326, geom3_.geometry_n(0).srid)
|
69
69
|
assert_equal(4326, geom3_.geometry_n(1).srid)
|
70
70
|
end
|
71
|
-
|
72
|
-
|
71
|
+
|
72
|
+
|
73
73
|
def test_srid_preserved_through_geom_functions
|
74
74
|
geom1_ = @factory.point(-10, 20)
|
75
75
|
geom2_ = geom1_.boundary
|
76
76
|
assert_equal(4326, geom2_.srid)
|
77
77
|
end
|
78
|
-
|
79
|
-
|
78
|
+
|
79
|
+
|
80
80
|
def test_srid_preserved_through_dup
|
81
81
|
geom1_ = @factory.point(-10, 20)
|
82
82
|
geom2_ = geom1_.clone
|
83
83
|
assert_equal(4326, geom2_.srid)
|
84
84
|
end
|
85
|
-
|
86
|
-
|
85
|
+
|
86
|
+
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end if ::RGeo::Geos.capi_supported?
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Tests for the GEOS geometry collection implementation
|
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
|
@@ -43,20 +43,20 @@ require ::File.expand_path('../common/geometry_collection_tests.rb', ::File.dirn
|
|
43
43
|
module RGeo
|
44
44
|
module Tests # :nodoc:
|
45
45
|
module GeosCAPI # :nodoc:
|
46
|
-
|
46
|
+
|
47
47
|
class TestGeometryCollection < ::Test::Unit::TestCase # :nodoc:
|
48
|
-
|
49
|
-
|
48
|
+
|
49
|
+
|
50
50
|
def create_factory
|
51
51
|
::RGeo::Geos.factory
|
52
52
|
end
|
53
|
-
|
54
|
-
|
53
|
+
|
54
|
+
|
55
55
|
include ::RGeo::Tests::Common::GeometryCollectionTests
|
56
|
-
|
57
|
-
|
56
|
+
|
57
|
+
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end if ::RGeo::Geos.capi_supported?
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Tests for the GEOS line string implementation
|
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
|
@@ -43,20 +43,20 @@ require ::File.expand_path('../common/line_string_tests.rb', ::File.dirname(__FI
|
|
43
43
|
module RGeo
|
44
44
|
module Tests # :nodoc:
|
45
45
|
module GeosCAPI # :nodoc:
|
46
|
-
|
46
|
+
|
47
47
|
class TestLineString < ::Test::Unit::TestCase # :nodoc:
|
48
|
-
|
49
|
-
|
48
|
+
|
49
|
+
|
50
50
|
def setup
|
51
51
|
@factory = ::RGeo::Geos.factory
|
52
52
|
end
|
53
|
-
|
54
|
-
|
53
|
+
|
54
|
+
|
55
55
|
include ::RGeo::Tests::Common::LineStringTests
|
56
|
-
|
57
|
-
|
56
|
+
|
57
|
+
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end if ::RGeo::Geos.capi_supported?
|
data/test/geos_capi/tc_misc.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Tests for miscellaneous GEOS stuff
|
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
|
@@ -41,30 +41,30 @@ require 'rgeo'
|
|
41
41
|
module RGeo
|
42
42
|
module Tests # :nodoc:
|
43
43
|
module GeosCAPI # :nodoc:
|
44
|
-
|
44
|
+
|
45
45
|
class TestMisc < ::Test::Unit::TestCase # :nodoc:
|
46
|
-
|
47
|
-
|
46
|
+
|
47
|
+
|
48
48
|
def setup
|
49
49
|
@factory = ::RGeo::Geos.factory(:srid => 4326)
|
50
50
|
end
|
51
|
-
|
52
|
-
|
51
|
+
|
52
|
+
|
53
53
|
def test_uninitialized
|
54
54
|
geom_ = ::RGeo::Geos::GeometryImpl.new
|
55
55
|
assert_equal(false, geom_.initialized?)
|
56
56
|
assert_nil(geom_.geometry_type)
|
57
57
|
end
|
58
|
-
|
59
|
-
|
58
|
+
|
59
|
+
|
60
60
|
def test_empty_geometries_equal
|
61
61
|
geom1_ = @factory.collection([])
|
62
62
|
geom2_ = @factory.line_string([])
|
63
63
|
assert(!geom1_.eql?(geom2_))
|
64
64
|
assert(geom1_.equals?(geom2_))
|
65
65
|
end
|
66
|
-
|
67
|
-
|
66
|
+
|
67
|
+
|
68
68
|
def test_prepare
|
69
69
|
p1_ = @factory.point(1, 2)
|
70
70
|
p2_ = @factory.point(3, 4)
|
@@ -74,8 +74,8 @@ module RGeo
|
|
74
74
|
polygon_.prepare!
|
75
75
|
assert_equal(true, polygon_.prepared?)
|
76
76
|
end
|
77
|
-
|
78
|
-
|
77
|
+
|
78
|
+
|
79
79
|
def test_auto_prepare
|
80
80
|
p1_ = @factory.point(1, 2)
|
81
81
|
p2_ = @factory.point(3, 4)
|
@@ -86,7 +86,7 @@ module RGeo
|
|
86
86
|
assert_equal(false, polygon_.prepared?)
|
87
87
|
polygon_.intersects?(p2_)
|
88
88
|
assert_equal(true, polygon_.prepared?)
|
89
|
-
|
89
|
+
|
90
90
|
factory_no_auto_prepare_ = ::RGeo::Geos.factory(:srid => 4326, :auto_prepare => :disabled)
|
91
91
|
polygon2_ = factory_no_auto_prepare_.polygon(
|
92
92
|
factory_no_auto_prepare_.linear_ring([p1_, p2_, p3_, p1_]))
|
@@ -96,10 +96,21 @@ module RGeo
|
|
96
96
|
polygon2_.intersects?(p2_)
|
97
97
|
assert_equal(false, polygon2_.prepared?)
|
98
98
|
end
|
99
|
-
|
100
|
-
|
99
|
+
|
100
|
+
|
101
|
+
def test_gh_21
|
102
|
+
# Test for GH-21 (seg fault in rgeo_convert_to_geos_geometry)
|
103
|
+
# This seemed to fail under Ruby 1.8.7 only.
|
104
|
+
f_ = RGeo::Geographic.simple_mercator_factory
|
105
|
+
loc_ = f_.line_string([f_.point(-123, 37), f_.point(-122, 38)])
|
106
|
+
f2_ = f_.projection_factory
|
107
|
+
loc2_ = f2_.line_string([f2_.point(-123, 37), f2_.point(-122, 38)])
|
108
|
+
loc2_.intersection(loc_)
|
109
|
+
end
|
110
|
+
|
111
|
+
|
101
112
|
end
|
102
|
-
|
113
|
+
|
103
114
|
end
|
104
115
|
end
|
105
116
|
end if ::RGeo::Geos.capi_supported?
|