schleyfox-rgeo 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.rdoc +199 -0
- data/README.rdoc +172 -0
- data/Spatial_Programming_With_RGeo.rdoc +440 -0
- data/Version +1 -0
- data/ext/geos_c_impl/extconf.rb +84 -0
- data/ext/geos_c_impl/factory.c +468 -0
- data/ext/geos_c_impl/factory.h +224 -0
- data/ext/geos_c_impl/geometry.c +705 -0
- data/ext/geos_c_impl/geometry.h +55 -0
- data/ext/geos_c_impl/geometry_collection.c +482 -0
- data/ext/geos_c_impl/geometry_collection.h +69 -0
- data/ext/geos_c_impl/line_string.c +509 -0
- data/ext/geos_c_impl/line_string.h +64 -0
- data/ext/geos_c_impl/main.c +70 -0
- data/ext/geos_c_impl/point.c +193 -0
- data/ext/geos_c_impl/point.h +62 -0
- data/ext/geos_c_impl/polygon.c +265 -0
- data/ext/geos_c_impl/polygon.h +66 -0
- data/ext/geos_c_impl/preface.h +50 -0
- data/ext/proj4_c_impl/extconf.rb +88 -0
- data/ext/proj4_c_impl/main.c +271 -0
- data/lib/rgeo.rb +124 -0
- data/lib/rgeo/cartesian.rb +60 -0
- data/lib/rgeo/cartesian/analysis.rb +118 -0
- data/lib/rgeo/cartesian/bounding_box.rb +337 -0
- data/lib/rgeo/cartesian/calculations.rb +161 -0
- data/lib/rgeo/cartesian/factory.rb +209 -0
- data/lib/rgeo/cartesian/feature_classes.rb +173 -0
- data/lib/rgeo/cartesian/feature_methods.rb +106 -0
- data/lib/rgeo/cartesian/interface.rb +150 -0
- data/lib/rgeo/coord_sys.rb +79 -0
- data/lib/rgeo/coord_sys/cs/entities.rb +1524 -0
- data/lib/rgeo/coord_sys/cs/factories.rb +208 -0
- data/lib/rgeo/coord_sys/cs/wkt_parser.rb +308 -0
- data/lib/rgeo/coord_sys/proj4.rb +312 -0
- data/lib/rgeo/coord_sys/srs_database/active_record_table.rb +194 -0
- data/lib/rgeo/coord_sys/srs_database/interface.rb +165 -0
- data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +188 -0
- data/lib/rgeo/coord_sys/srs_database/sr_org.rb +108 -0
- data/lib/rgeo/coord_sys/srs_database/url_reader.rb +108 -0
- data/lib/rgeo/error.rb +63 -0
- data/lib/rgeo/feature.rb +88 -0
- data/lib/rgeo/feature/curve.rb +156 -0
- data/lib/rgeo/feature/factory.rb +332 -0
- data/lib/rgeo/feature/factory_generator.rb +138 -0
- data/lib/rgeo/feature/geometry.rb +614 -0
- data/lib/rgeo/feature/geometry_collection.rb +129 -0
- data/lib/rgeo/feature/line.rb +66 -0
- data/lib/rgeo/feature/line_string.rb +102 -0
- data/lib/rgeo/feature/linear_ring.rb +66 -0
- data/lib/rgeo/feature/multi_curve.rb +113 -0
- data/lib/rgeo/feature/multi_line_string.rb +66 -0
- data/lib/rgeo/feature/multi_point.rb +73 -0
- data/lib/rgeo/feature/multi_polygon.rb +97 -0
- data/lib/rgeo/feature/multi_surface.rb +116 -0
- data/lib/rgeo/feature/point.rb +120 -0
- data/lib/rgeo/feature/polygon.rb +141 -0
- data/lib/rgeo/feature/surface.rb +122 -0
- data/lib/rgeo/feature/types.rb +305 -0
- data/lib/rgeo/geographic.rb +75 -0
- data/lib/rgeo/geographic/factory.rb +287 -0
- data/lib/rgeo/geographic/interface.rb +410 -0
- data/lib/rgeo/geographic/proj4_projector.rb +98 -0
- data/lib/rgeo/geographic/projected_feature_classes.rb +213 -0
- data/lib/rgeo/geographic/projected_feature_methods.rb +228 -0
- data/lib/rgeo/geographic/projected_window.rb +467 -0
- data/lib/rgeo/geographic/simple_mercator_projector.rb +157 -0
- data/lib/rgeo/geographic/spherical_feature_classes.rb +212 -0
- data/lib/rgeo/geographic/spherical_feature_methods.rb +97 -0
- data/lib/rgeo/geographic/spherical_math.rb +206 -0
- data/lib/rgeo/geos.rb +72 -0
- data/lib/rgeo/geos/factory.rb +301 -0
- data/lib/rgeo/geos/impl_additions.rb +76 -0
- data/lib/rgeo/geos/interface.rb +139 -0
- data/lib/rgeo/geos/zm_factory.rb +275 -0
- data/lib/rgeo/geos/zm_impl.rb +432 -0
- data/lib/rgeo/impl_helper.rb +53 -0
- data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +235 -0
- data/lib/rgeo/impl_helper/basic_geometry_methods.rb +85 -0
- data/lib/rgeo/impl_helper/basic_line_string_methods.rb +197 -0
- data/lib/rgeo/impl_helper/basic_point_methods.rb +138 -0
- data/lib/rgeo/impl_helper/basic_polygon_methods.rb +121 -0
- data/lib/rgeo/impl_helper/math.rb +50 -0
- data/lib/rgeo/version.rb +52 -0
- data/lib/rgeo/wkrep.rb +72 -0
- data/lib/rgeo/wkrep/wkb_generator.rb +267 -0
- data/lib/rgeo/wkrep/wkb_parser.rb +315 -0
- data/lib/rgeo/wkrep/wkt_generator.rb +275 -0
- data/lib/rgeo/wkrep/wkt_parser.rb +496 -0
- data/test/common/geometry_collection_tests.rb +238 -0
- data/test/common/line_string_tests.rb +324 -0
- data/test/common/multi_line_string_tests.rb +209 -0
- data/test/common/multi_point_tests.rb +201 -0
- data/test/common/multi_polygon_tests.rb +208 -0
- data/test/common/point_tests.rb +331 -0
- data/test/common/polygon_tests.rb +232 -0
- data/test/coord_sys/tc_active_record_table.rb +102 -0
- data/test/coord_sys/tc_ogc_cs.rb +356 -0
- data/test/coord_sys/tc_proj4.rb +138 -0
- data/test/coord_sys/tc_proj4_srs_data.rb +76 -0
- data/test/coord_sys/tc_sr_org.rb +70 -0
- data/test/coord_sys/tc_url_reader.rb +82 -0
- data/test/geos/tc_factory.rb +91 -0
- data/test/geos/tc_geometry_collection.rb +62 -0
- data/test/geos/tc_line_string.rb +62 -0
- data/test/geos/tc_misc.rb +72 -0
- data/test/geos/tc_multi_line_string.rb +62 -0
- data/test/geos/tc_multi_point.rb +62 -0
- data/test/geos/tc_multi_polygon.rb +63 -0
- data/test/geos/tc_point.rb +86 -0
- data/test/geos/tc_polygon.rb +86 -0
- data/test/geos/tc_zmfactory.rb +85 -0
- data/test/projected_geographic/tc_geometry_collection.rb +62 -0
- data/test/projected_geographic/tc_line_string.rb +62 -0
- data/test/projected_geographic/tc_multi_line_string.rb +62 -0
- data/test/projected_geographic/tc_multi_point.rb +62 -0
- data/test/projected_geographic/tc_multi_polygon.rb +63 -0
- data/test/projected_geographic/tc_point.rb +93 -0
- data/test/projected_geographic/tc_polygon.rb +62 -0
- data/test/simple_cartesian/tc_calculations.rb +145 -0
- data/test/simple_cartesian/tc_geometry_collection.rb +69 -0
- data/test/simple_cartesian/tc_line_string.rb +70 -0
- data/test/simple_cartesian/tc_multi_line_string.rb +67 -0
- data/test/simple_cartesian/tc_multi_point.rb +67 -0
- data/test/simple_cartesian/tc_multi_polygon.rb +70 -0
- data/test/simple_cartesian/tc_point.rb +91 -0
- data/test/simple_cartesian/tc_polygon.rb +67 -0
- data/test/simple_mercator/tc_geometry_collection.rb +62 -0
- data/test/simple_mercator/tc_line_string.rb +62 -0
- data/test/simple_mercator/tc_multi_line_string.rb +62 -0
- data/test/simple_mercator/tc_multi_point.rb +62 -0
- data/test/simple_mercator/tc_multi_polygon.rb +63 -0
- data/test/simple_mercator/tc_point.rb +93 -0
- data/test/simple_mercator/tc_polygon.rb +62 -0
- data/test/simple_mercator/tc_window.rb +219 -0
- data/test/spherical_geographic/tc_calculations.rb +203 -0
- data/test/spherical_geographic/tc_geometry_collection.rb +70 -0
- data/test/spherical_geographic/tc_line_string.rb +70 -0
- data/test/spherical_geographic/tc_multi_line_string.rb +67 -0
- data/test/spherical_geographic/tc_multi_point.rb +67 -0
- data/test/spherical_geographic/tc_multi_polygon.rb +70 -0
- data/test/spherical_geographic/tc_point.rb +100 -0
- data/test/spherical_geographic/tc_polygon.rb +67 -0
- data/test/tc_cartesian_analysis.rb +107 -0
- data/test/tc_oneoff.rb +63 -0
- data/test/wkrep/tc_wkb_generator.rb +249 -0
- data/test/wkrep/tc_wkb_parser.rb +353 -0
- data/test/wkrep/tc_wkt_generator.rb +362 -0
- data/test/wkrep/tc_wkt_parser.rb +480 -0
- metadata +267 -0
@@ -0,0 +1,203 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# Tests for the internal calculations for simple spherical
|
4
|
+
#
|
5
|
+
# -----------------------------------------------------------------------------
|
6
|
+
# Copyright 2010 Daniel Azuma
|
7
|
+
#
|
8
|
+
# All rights reserved.
|
9
|
+
#
|
10
|
+
# Redistribution and use in source and binary forms, with or without
|
11
|
+
# modification, are permitted provided that the following conditions are met:
|
12
|
+
#
|
13
|
+
# * Redistributions of source code must retain the above copyright notice,
|
14
|
+
# this list of conditions and the following disclaimer.
|
15
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
16
|
+
# this list of conditions and the following disclaimer in the documentation
|
17
|
+
# and/or other materials provided with the distribution.
|
18
|
+
# * Neither the name of the copyright holder, nor the names of any other
|
19
|
+
# contributors to this software, may be used to endorse or promote products
|
20
|
+
# derived from this software without specific prior written permission.
|
21
|
+
#
|
22
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
26
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
27
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
33
|
+
# -----------------------------------------------------------------------------
|
34
|
+
;
|
35
|
+
|
36
|
+
|
37
|
+
require 'test/unit'
|
38
|
+
require 'rgeo'
|
39
|
+
|
40
|
+
|
41
|
+
module RGeo
|
42
|
+
module Tests # :nodoc:
|
43
|
+
module SphericalGeographic # :nodoc:
|
44
|
+
|
45
|
+
class TestCalculations < ::Test::Unit::TestCase # :nodoc:
|
46
|
+
|
47
|
+
|
48
|
+
def assert_close_enough(v1_, v2_)
|
49
|
+
diff_ = (v1_ - v2_).abs
|
50
|
+
# denom_ = (v1_ + v2_).abs
|
51
|
+
# diff_ /= denom_ if denom_ > 0.01
|
52
|
+
assert(diff_ < 0.00000001, "#{v1_} is not close to #{v2_}")
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
def test_point_eql
|
57
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
|
58
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
|
59
|
+
assert_equal(point1_, point2_)
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def test_point_from_latlng
|
64
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.from_latlon(45, -45)
|
65
|
+
assert_close_enough(0.5, point1_.x)
|
66
|
+
assert_close_enough(-0.5, point1_.y)
|
67
|
+
assert_close_enough(::Math.sqrt(2) * 0.5, point1_.z)
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
def test_point_dot_one
|
72
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 1)
|
73
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 1)
|
74
|
+
assert_close_enough(1.0, point1_ * point2_)
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
def test_point_dot_minusone
|
79
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 1)
|
80
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(-1, -1, -1)
|
81
|
+
assert_close_enough(-1.0, point1_ * point2_)
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
def test_point_dot_zero
|
86
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 0)
|
87
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, -1, 0)
|
88
|
+
assert_close_enough(0.0, point1_ * point2_)
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
def test_point_cross
|
93
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 0)
|
94
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, -1, 0)
|
95
|
+
assert_close_enough(-1.0, (point1_ % point2_).z)
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
def test_point_cross_coincident
|
100
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
|
101
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
|
102
|
+
assert_nil(point1_ % point2_)
|
103
|
+
end
|
104
|
+
|
105
|
+
|
106
|
+
def test_point_cross_opposite
|
107
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
|
108
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(-1, 0, 0)
|
109
|
+
assert_nil(point1_ % point2_)
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
def test_arc_axis
|
114
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 0)
|
115
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, -1, 0)
|
116
|
+
arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
|
117
|
+
assert_close_enough(-1.0, arc1_.axis.z)
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
def test_arc_axis2
|
122
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
|
123
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0.000001, 0)
|
124
|
+
arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
|
125
|
+
assert_close_enough(1.0, arc1_.axis.z)
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
def test_arc_intersects_point_off
|
130
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
|
131
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0.000002, 0)
|
132
|
+
point3_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0.000001, 0.1)
|
133
|
+
arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
|
134
|
+
assert_equal(false, arc1_.contains_point?(point3_))
|
135
|
+
end
|
136
|
+
|
137
|
+
|
138
|
+
def test_arc_intersects_point_between
|
139
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
|
140
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0.000002, 0)
|
141
|
+
point3_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0.000001, 0)
|
142
|
+
arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
|
143
|
+
assert_equal(true, arc1_.contains_point?(point3_))
|
144
|
+
end
|
145
|
+
|
146
|
+
|
147
|
+
def test_arc_intersects_point_endpoint
|
148
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
|
149
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0.000002, 0)
|
150
|
+
arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
|
151
|
+
assert_equal(true, arc1_.contains_point?(point1_))
|
152
|
+
end
|
153
|
+
|
154
|
+
|
155
|
+
def test_arc_intersects_arc_true
|
156
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, 0.1, 1)
|
157
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, -0.1, 1)
|
158
|
+
point3_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(-0.1, 0, 1)
|
159
|
+
point4_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0.1, 0, 1)
|
160
|
+
arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
|
161
|
+
arc2_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point3_, point4_)
|
162
|
+
assert_equal(true, arc1_.intersects_arc?(arc2_))
|
163
|
+
end
|
164
|
+
|
165
|
+
|
166
|
+
def test_arc_intersects_arc_parallel
|
167
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, 0.1, 1)
|
168
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, -0.1, 1)
|
169
|
+
point3_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0.1, 0.1, 1)
|
170
|
+
point4_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0.1, -0.1, 1)
|
171
|
+
arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
|
172
|
+
arc2_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point3_, point4_)
|
173
|
+
assert_equal(false, arc1_.intersects_arc?(arc2_))
|
174
|
+
end
|
175
|
+
|
176
|
+
|
177
|
+
def test_arc_intersects_arc_separated_tee
|
178
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, 0.1, 1)
|
179
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, -0.1, 1)
|
180
|
+
point3_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0.1, 0, 1)
|
181
|
+
point4_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0.2, 0, 1)
|
182
|
+
arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
|
183
|
+
arc2_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point3_, point4_)
|
184
|
+
assert_equal(false, arc1_.intersects_arc?(arc2_))
|
185
|
+
end
|
186
|
+
|
187
|
+
|
188
|
+
def test_arc_intersects_arc_connected_tee
|
189
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, 0.1, 1)
|
190
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, -0.1, 1)
|
191
|
+
point3_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, 0, 1)
|
192
|
+
point4_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0.1, 0, 1)
|
193
|
+
arc1_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point1_, point2_)
|
194
|
+
arc2_ = ::RGeo::Geographic::SphericalMath::ArcXYZ.new(point3_, point4_)
|
195
|
+
assert_equal(true, arc1_.intersects_arc?(arc2_))
|
196
|
+
end
|
197
|
+
|
198
|
+
|
199
|
+
end
|
200
|
+
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# Tests for the simple spherical geometry collection implementation
|
4
|
+
#
|
5
|
+
# -----------------------------------------------------------------------------
|
6
|
+
# Copyright 2010 Daniel Azuma
|
7
|
+
#
|
8
|
+
# All rights reserved.
|
9
|
+
#
|
10
|
+
# Redistribution and use in source and binary forms, with or without
|
11
|
+
# modification, are permitted provided that the following conditions are met:
|
12
|
+
#
|
13
|
+
# * Redistributions of source code must retain the above copyright notice,
|
14
|
+
# this list of conditions and the following disclaimer.
|
15
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
16
|
+
# this list of conditions and the following disclaimer in the documentation
|
17
|
+
# and/or other materials provided with the distribution.
|
18
|
+
# * Neither the name of the copyright holder, nor the names of any other
|
19
|
+
# contributors to this software, may be used to endorse or promote products
|
20
|
+
# derived from this software without specific prior written permission.
|
21
|
+
#
|
22
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
26
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
27
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
33
|
+
# -----------------------------------------------------------------------------
|
34
|
+
;
|
35
|
+
|
36
|
+
|
37
|
+
require 'test/unit'
|
38
|
+
require 'rgeo'
|
39
|
+
|
40
|
+
require ::File.expand_path('../common/geometry_collection_tests.rb', ::File.dirname(__FILE__))
|
41
|
+
|
42
|
+
|
43
|
+
module RGeo
|
44
|
+
module Tests # :nodoc:
|
45
|
+
module SphericalGeographic # :nodoc:
|
46
|
+
|
47
|
+
class TestGeometryCollection < ::Test::Unit::TestCase # :nodoc:
|
48
|
+
|
49
|
+
|
50
|
+
def create_factory
|
51
|
+
@factory = ::RGeo::Geographic.spherical_factory
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
include ::RGeo::Tests::Common::GeometryCollectionTests
|
56
|
+
|
57
|
+
|
58
|
+
undef_method :test_fully_equal
|
59
|
+
undef_method :test_geometrically_equal
|
60
|
+
undef_method :test_empty_equal
|
61
|
+
undef_method :test_not_equal
|
62
|
+
undef_method :test_empty_collection_envelope
|
63
|
+
undef_method :test_empty_collection_boundary
|
64
|
+
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# Tests for the simple spherical line string implementation
|
4
|
+
#
|
5
|
+
# -----------------------------------------------------------------------------
|
6
|
+
# Copyright 2010 Daniel Azuma
|
7
|
+
#
|
8
|
+
# All rights reserved.
|
9
|
+
#
|
10
|
+
# Redistribution and use in source and binary forms, with or without
|
11
|
+
# modification, are permitted provided that the following conditions are met:
|
12
|
+
#
|
13
|
+
# * Redistributions of source code must retain the above copyright notice,
|
14
|
+
# this list of conditions and the following disclaimer.
|
15
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
16
|
+
# this list of conditions and the following disclaimer in the documentation
|
17
|
+
# and/or other materials provided with the distribution.
|
18
|
+
# * Neither the name of the copyright holder, nor the names of any other
|
19
|
+
# contributors to this software, may be used to endorse or promote products
|
20
|
+
# derived from this software without specific prior written permission.
|
21
|
+
#
|
22
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
26
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
27
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
33
|
+
# -----------------------------------------------------------------------------
|
34
|
+
;
|
35
|
+
|
36
|
+
|
37
|
+
require 'test/unit'
|
38
|
+
require 'rgeo'
|
39
|
+
|
40
|
+
require ::File.expand_path('../common/line_string_tests.rb', ::File.dirname(__FILE__))
|
41
|
+
|
42
|
+
|
43
|
+
module RGeo
|
44
|
+
module Tests # :nodoc:
|
45
|
+
module SphericalGeographic # :nodoc:
|
46
|
+
|
47
|
+
class TestLineString < ::Test::Unit::TestCase # :nodoc:
|
48
|
+
|
49
|
+
|
50
|
+
def setup
|
51
|
+
@factory = ::RGeo::Geographic.spherical_factory
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
include ::RGeo::Tests::Common::LineStringTests
|
56
|
+
|
57
|
+
|
58
|
+
undef_method :test_fully_equal
|
59
|
+
undef_method :test_geometrically_equal_but_different_type
|
60
|
+
undef_method :test_geometrically_equal_but_different_type2
|
61
|
+
undef_method :test_geometrically_equal_but_different_overlap
|
62
|
+
undef_method :test_empty_equal
|
63
|
+
undef_method :test_not_equal
|
64
|
+
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# Tests for the simple spherical multi line string implementation
|
4
|
+
#
|
5
|
+
# -----------------------------------------------------------------------------
|
6
|
+
# Copyright 2010 Daniel Azuma
|
7
|
+
#
|
8
|
+
# All rights reserved.
|
9
|
+
#
|
10
|
+
# Redistribution and use in source and binary forms, with or without
|
11
|
+
# modification, are permitted provided that the following conditions are met:
|
12
|
+
#
|
13
|
+
# * Redistributions of source code must retain the above copyright notice,
|
14
|
+
# this list of conditions and the following disclaimer.
|
15
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
16
|
+
# this list of conditions and the following disclaimer in the documentation
|
17
|
+
# and/or other materials provided with the distribution.
|
18
|
+
# * Neither the name of the copyright holder, nor the names of any other
|
19
|
+
# contributors to this software, may be used to endorse or promote products
|
20
|
+
# derived from this software without specific prior written permission.
|
21
|
+
#
|
22
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
26
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
27
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
33
|
+
# -----------------------------------------------------------------------------
|
34
|
+
;
|
35
|
+
|
36
|
+
|
37
|
+
require 'test/unit'
|
38
|
+
require 'rgeo'
|
39
|
+
|
40
|
+
require ::File.expand_path('../common/multi_line_string_tests.rb', ::File.dirname(__FILE__))
|
41
|
+
|
42
|
+
|
43
|
+
module RGeo
|
44
|
+
module Tests # :nodoc:
|
45
|
+
module SphericalGeographic # :nodoc:
|
46
|
+
|
47
|
+
class TestMultiLineString < ::Test::Unit::TestCase # :nodoc:
|
48
|
+
|
49
|
+
|
50
|
+
def create_factory
|
51
|
+
@factory = ::RGeo::Geographic.spherical_factory
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
include ::RGeo::Tests::Common::MultiLineStringTests
|
56
|
+
|
57
|
+
|
58
|
+
undef_method :test_fully_equal
|
59
|
+
undef_method :test_geometrically_equal
|
60
|
+
undef_method :test_not_equal
|
61
|
+
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# Tests for the simple spherical multi point implementation
|
4
|
+
#
|
5
|
+
# -----------------------------------------------------------------------------
|
6
|
+
# Copyright 2010 Daniel Azuma
|
7
|
+
#
|
8
|
+
# All rights reserved.
|
9
|
+
#
|
10
|
+
# Redistribution and use in source and binary forms, with or without
|
11
|
+
# modification, are permitted provided that the following conditions are met:
|
12
|
+
#
|
13
|
+
# * Redistributions of source code must retain the above copyright notice,
|
14
|
+
# this list of conditions and the following disclaimer.
|
15
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
16
|
+
# this list of conditions and the following disclaimer in the documentation
|
17
|
+
# and/or other materials provided with the distribution.
|
18
|
+
# * Neither the name of the copyright holder, nor the names of any other
|
19
|
+
# contributors to this software, may be used to endorse or promote products
|
20
|
+
# derived from this software without specific prior written permission.
|
21
|
+
#
|
22
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
26
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
27
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
33
|
+
# -----------------------------------------------------------------------------
|
34
|
+
;
|
35
|
+
|
36
|
+
|
37
|
+
require 'test/unit'
|
38
|
+
require 'rgeo'
|
39
|
+
|
40
|
+
require ::File.expand_path('../common/multi_point_tests.rb', ::File.dirname(__FILE__))
|
41
|
+
|
42
|
+
|
43
|
+
module RGeo
|
44
|
+
module Tests # :nodoc:
|
45
|
+
module SphericalGeographic # :nodoc:
|
46
|
+
|
47
|
+
class TestMultiPoint < ::Test::Unit::TestCase # :nodoc:
|
48
|
+
|
49
|
+
|
50
|
+
def create_factory
|
51
|
+
@factory = ::RGeo::Geographic.spherical_factory
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
include ::RGeo::Tests::Common::MultiPointTests
|
56
|
+
|
57
|
+
|
58
|
+
undef_method :test_fully_equal
|
59
|
+
undef_method :test_geometrically_equal
|
60
|
+
undef_method :test_not_equal
|
61
|
+
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|