rgeo 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/History.rdoc +9 -7
  2. data/README.rdoc +7 -5
  3. data/Version +1 -1
  4. data/ext/geos_c_impl/factory.c +12 -19
  5. data/ext/geos_c_impl/factory.h +15 -21
  6. data/ext/geos_c_impl/geometry.c +19 -36
  7. data/ext/geos_c_impl/geometry.h +2 -12
  8. data/ext/geos_c_impl/geometry_collection.c +38 -157
  9. data/ext/geos_c_impl/geometry_collection.h +2 -12
  10. data/ext/geos_c_impl/line_string.c +83 -80
  11. data/ext/geos_c_impl/line_string.h +2 -12
  12. data/ext/geos_c_impl/main.c +5 -0
  13. data/ext/geos_c_impl/point.c +2 -12
  14. data/ext/geos_c_impl/point.h +2 -12
  15. data/ext/geos_c_impl/polygon.c +5 -14
  16. data/ext/geos_c_impl/polygon.h +2 -12
  17. data/ext/geos_c_impl/preface.h +8 -0
  18. data/lib/rgeo.rb +34 -16
  19. data/lib/rgeo/{geography/simple_spherical/geometry_collection_impl.rb → cartesian.rb} +19 -26
  20. data/lib/rgeo/cartesian/calculations.rb +129 -0
  21. data/lib/rgeo/cartesian/interface.rb +85 -0
  22. data/lib/rgeo/cartesian/simple_factory.rb +159 -0
  23. data/lib/rgeo/cartesian/simple_feature_classes.rb +187 -0
  24. data/lib/rgeo/cartesian/simple_feature_methods.rb +97 -0
  25. data/lib/rgeo/features.rb +1 -0
  26. data/lib/rgeo/features/curve.rb +3 -2
  27. data/lib/rgeo/features/factory.rb +62 -37
  28. data/lib/rgeo/features/geometry.rb +10 -32
  29. data/lib/rgeo/features/geometry_collection.rb +3 -2
  30. data/lib/rgeo/features/line.rb +3 -2
  31. data/lib/rgeo/features/line_string.rb +3 -2
  32. data/lib/rgeo/features/linear_ring.rb +3 -2
  33. data/lib/rgeo/features/multi_curve.rb +3 -2
  34. data/lib/rgeo/features/multi_line_string.rb +3 -2
  35. data/lib/rgeo/features/multi_point.rb +3 -2
  36. data/lib/rgeo/features/multi_polygon.rb +3 -2
  37. data/lib/rgeo/features/multi_surface.rb +3 -2
  38. data/lib/rgeo/features/point.rb +3 -2
  39. data/lib/rgeo/features/polygon.rb +3 -2
  40. data/lib/rgeo/features/surface.rb +3 -2
  41. data/lib/rgeo/features/types.rb +198 -0
  42. data/lib/rgeo/geography.rb +4 -14
  43. data/lib/rgeo/geography/factory.rb +7 -64
  44. data/lib/rgeo/geography/{simple_spherical/geometry_methods.rb → helper.rb} +4 -13
  45. data/lib/rgeo/geography/simple_mercator/feature_classes.rb +35 -89
  46. data/lib/rgeo/geography/simple_mercator/feature_methods.rb +22 -31
  47. data/lib/rgeo/geography/simple_mercator/projector.rb +4 -8
  48. data/lib/rgeo/geography/simple_spherical/calculations.rb +11 -9
  49. data/lib/rgeo/geography/simple_spherical/feature_classes.rb +189 -0
  50. data/lib/rgeo/geography/simple_spherical/{line_string_impl.rb → feature_methods.rb} +16 -64
  51. data/lib/rgeo/geos/factory.rb +26 -40
  52. data/lib/rgeo/geos/impl_additions.rb +3 -5
  53. data/lib/rgeo/{geography/simple_spherical/polygon_impl.rb → impl_helpers.rb} +16 -26
  54. data/lib/rgeo/impl_helpers/basic_geometry_collection_methods.rb +186 -0
  55. data/lib/rgeo/impl_helpers/basic_geometry_methods.rb +90 -0
  56. data/lib/rgeo/impl_helpers/basic_line_string_methods.rb +188 -0
  57. data/lib/rgeo/impl_helpers/basic_point_methods.rb +149 -0
  58. data/lib/rgeo/{geography/common/helper.rb → impl_helpers/basic_polygon_methods.rb} +62 -53
  59. data/lib/rgeo/{geography/common/polygon_methods.rb → impl_helpers/serialization.rb} +50 -42
  60. data/tests/common/geometry_collection_tests.rb +9 -7
  61. data/tests/common/multi_line_string_tests.rb +16 -13
  62. data/tests/common/multi_point_tests.rb +16 -13
  63. data/tests/common/multi_polygon_tests.rb +8 -6
  64. data/tests/common/point_tests.rb +1 -2
  65. data/tests/common/polygon_tests.rb +9 -9
  66. data/tests/geos/tc_multi_line_string.rb +2 -2
  67. data/tests/simple_cartesian/tc_calculations.rb +138 -0
  68. data/tests/simple_cartesian/tc_geometry_collection.rb +68 -0
  69. data/tests/simple_cartesian/tc_line_string.rb +70 -0
  70. data/{lib/rgeo/geography/simple_spherical/multi_line_string_impl.rb → tests/simple_cartesian/tc_multi_line_string.rb} +19 -19
  71. data/{lib/rgeo/geography/simple_spherical/multi_polygon_impl.rb → tests/simple_cartesian/tc_multi_point.rb} +19 -19
  72. data/{lib/rgeo/geography/common/geometry_methods.rb → tests/simple_cartesian/tc_multi_polygon.rb} +19 -41
  73. data/{lib/rgeo/geography/simple_spherical/point_impl.rb → tests/simple_cartesian/tc_point.rb} +33 -35
  74. data/tests/simple_cartesian/tc_polygon.rb +67 -0
  75. data/tests/simple_spherical/tc_geometry_collection.rb +68 -0
  76. data/tests/simple_spherical/tc_line_string.rb +10 -171
  77. data/tests/simple_spherical/tc_multi_line_string.rb +67 -0
  78. data/{lib/rgeo/geography/simple_spherical/multi_point_impl.rb → tests/simple_spherical/tc_multi_point.rb} +19 -19
  79. data/tests/simple_spherical/tc_multi_polygon.rb +70 -0
  80. data/tests/simple_spherical/tc_point.rb +17 -115
  81. data/tests/simple_spherical/tc_polygon.rb +67 -0
  82. metadata +46 -18
  83. data/ext/geos_c_impl/globals.h +0 -58
  84. data/lib/rgeo/geography/common/geometry_collection_methods.rb +0 -217
  85. data/lib/rgeo/geography/common/line_string_methods.rb +0 -201
  86. data/lib/rgeo/geography/common/point_methods.rb +0 -153
@@ -37,7 +37,7 @@
37
37
  require 'test/unit'
38
38
  require 'rgeo'
39
39
 
40
- require ::File.expand_path('../common/multi_point_tests.rb', ::File.dirname(__FILE__))
40
+ require ::File.expand_path('../common/multi_line_string_tests.rb', ::File.dirname(__FILE__))
41
41
 
42
42
 
43
43
  module RGeo
@@ -52,7 +52,7 @@ module RGeo
52
52
  end
53
53
 
54
54
 
55
- include ::RGeo::Tests::Common::MultiPointTests
55
+ include ::RGeo::Tests::Common::MultiLineStringTests
56
56
 
57
57
 
58
58
  end
@@ -0,0 +1,138 @@
1
+ # -----------------------------------------------------------------------------
2
+ #
3
+ # Tests for the internal calculations for simple cartesian
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 SimpleCartesian # :nodoc:
44
+
45
+ class TestCalculations < ::Test::Unit::TestCase # :nodoc:
46
+
47
+
48
+ def setup
49
+ @factory = ::RGeo::Geos.factory
50
+ @point1 = @factory.point(3, 4)
51
+ @point2 = @factory.point(5, 5)
52
+ @point3 = @factory.point(6, 4)
53
+ @point4 = @factory.point(3, 5)
54
+ @point5 = @factory.point(-1, 2)
55
+ @point6 = @factory.point(-1, 1)
56
+ @point7 = @factory.point(5, 4)
57
+ @horiz_seg = Cartesian::Segment.new(@point1, @point3)
58
+ @vert_seg = Cartesian::Segment.new(@point4, @point1)
59
+ @short_rising_seg = Cartesian::Segment.new(@point1, @point2)
60
+ @long_rising_seg = Cartesian::Segment.new(@point5, @point2)
61
+ @parallel_rising_seg = Cartesian::Segment.new(@point6, @point7)
62
+ @steep_rising_seg = Cartesian::Segment.new(@point6, @point4)
63
+ @degenerate_seg = Cartesian::Segment.new(@point5, @point5)
64
+ end
65
+
66
+
67
+ def assert_close_enough(v1_, v2_)
68
+ diff_ = (v1_ - v2_).abs
69
+ # denom_ = (v1_ + v2_).abs
70
+ # diff_ /= denom_ if denom_ > 0.01
71
+ assert(diff_ < 0.00000001, "#{v1_} is not close to #{v2_}")
72
+ end
73
+
74
+
75
+ def test_segment_degenerate
76
+ assert(@degenerate_seg.degenerate?)
77
+ assert_equal(0, @degenerate_seg.dx)
78
+ assert_equal(0, @degenerate_seg.dy)
79
+ assert_equal(@point5, @degenerate_seg.s)
80
+ assert_equal(@point5, @degenerate_seg.e)
81
+ end
82
+
83
+
84
+ def test_segment_basic
85
+ assert(!@short_rising_seg.degenerate?)
86
+ assert_equal(2, @short_rising_seg.dx)
87
+ assert_equal(1, @short_rising_seg.dy)
88
+ assert_equal(@point1, @short_rising_seg.s)
89
+ assert_equal(@point2, @short_rising_seg.e)
90
+ end
91
+
92
+
93
+ def test_segment_side_basic
94
+ assert_equal(0.0, @short_rising_seg.side(@point5))
95
+ assert(@short_rising_seg.side(@point4) > 0.0)
96
+ assert(@short_rising_seg.side(@point6) < 0.0)
97
+ end
98
+
99
+
100
+ def test_segment_tproj_basic
101
+ assert_equal(-2, @short_rising_seg.tproj(@point5))
102
+ assert_close_enough(2.0/3.0, @long_rising_seg.tproj(@point1))
103
+ end
104
+
105
+
106
+ def test_segment_contains_point
107
+ assert(@long_rising_seg.contains_point?(@point1))
108
+ assert(@long_rising_seg.contains_point?(@point2))
109
+ assert(!@long_rising_seg.contains_point?(@point3))
110
+ assert(!@short_rising_seg.contains_point?(@point5))
111
+ end
112
+
113
+
114
+ def test_segment_intersects_parallel
115
+ assert(@long_rising_seg.intersects_segment?(@long_rising_seg))
116
+ assert(!@long_rising_seg.intersects_segment?(@parallel_rising_seg))
117
+ end
118
+
119
+
120
+ def test_segment_intersects_basic
121
+ assert(@long_rising_seg.intersects_segment?(@steep_rising_seg))
122
+ assert(@steep_rising_seg.intersects_segment?(@long_rising_seg))
123
+ assert(!@short_rising_seg.intersects_segment?(@steep_rising_seg))
124
+ assert(!@steep_rising_seg.intersects_segment?(@short_rising_seg))
125
+ end
126
+
127
+
128
+ def test_segment_intersects_endpoints
129
+ assert(@horiz_seg.intersects_segment?(@vert_seg))
130
+ assert(@vert_seg.intersects_segment?(@horiz_seg))
131
+ end
132
+
133
+
134
+ end
135
+
136
+ end
137
+ end
138
+ end
@@ -0,0 +1,68 @@
1
+ # -----------------------------------------------------------------------------
2
+ #
3
+ # Tests for the simple cartesian 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 SimpleCartesian # :nodoc:
46
+
47
+ class TestGeometryCollection < ::Test::Unit::TestCase # :nodoc:
48
+
49
+
50
+ def create_factory
51
+ @factory = ::RGeo::Cartesian.simple_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
+
63
+
64
+ end
65
+
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,70 @@
1
+ # -----------------------------------------------------------------------------
2
+ #
3
+ # Tests for the simple cartesian 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 SimpleCartesian # :nodoc:
46
+
47
+ class TestLineString < ::Test::Unit::TestCase # :nodoc:
48
+
49
+
50
+ def setup
51
+ @factory = ::RGeo::Cartesian.simple_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
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------
2
2
  #
3
- # Spherical MultiLineString implementation
3
+ # Tests for the simple cartesian multi line string implementation
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
6
  # Copyright 2010 Daniel Azuma
@@ -34,34 +34,34 @@
34
34
  ;
35
35
 
36
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
+
37
43
  module RGeo
38
-
39
- module Geography
40
-
41
- module SimpleSpherical
44
+ module Tests # :nodoc:
45
+ module SimpleCartesian # :nodoc:
42
46
 
43
-
44
- class MultiLineStringImpl
47
+ class TestMultiLineString < ::Test::Unit::TestCase # :nodoc:
45
48
 
46
49
 
47
- include Features::GeometryCollection
48
- include Common::GeometryMethods
49
- include GeometryMethods
50
- include Common::GeometryCollectionMethods
51
- include Common::MultiLineStringMethods
50
+ def create_factory
51
+ @factory = ::RGeo::Cartesian.simple_factory
52
+ end
52
53
 
53
54
 
54
- def initialize(factory_, elements_)
55
- _set_factory(factory_)
56
- _setup(elements_)
57
- end
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
58
61
 
59
62
 
60
63
  end
61
64
 
62
-
63
65
  end
64
-
65
66
  end
66
-
67
67
  end
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------
2
2
  #
3
- # Spherical MultiPolygon implementation
3
+ # Tests for the simple cartesian multi point implementation
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
6
  # Copyright 2010 Daniel Azuma
@@ -34,34 +34,34 @@
34
34
  ;
35
35
 
36
36
 
37
+ require 'test/unit'
38
+ require 'rgeo'
39
+
40
+ require ::File.expand_path('../common/multi_point_tests.rb', ::File.dirname(__FILE__))
41
+
42
+
37
43
  module RGeo
38
-
39
- module Geography
40
-
41
- module SimpleSpherical
44
+ module Tests # :nodoc:
45
+ module SimpleCartesian # :nodoc:
42
46
 
43
-
44
- class MultiPolygonImpl
47
+ class TestMultiPoint < ::Test::Unit::TestCase # :nodoc:
45
48
 
46
49
 
47
- include Features::GeometryCollection
48
- include Common::GeometryMethods
49
- include GeometryMethods
50
- include Common::GeometryCollectionMethods
51
- include Common::MultiPolygonMethods
50
+ def create_factory
51
+ @factory = ::RGeo::Cartesian.simple_factory
52
+ end
52
53
 
53
54
 
54
- def initialize(factory_, elements_)
55
- _set_factory(factory_)
56
- _setup(elements_)
57
- end
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
58
61
 
59
62
 
60
63
  end
61
64
 
62
-
63
65
  end
64
-
65
66
  end
66
-
67
67
  end
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------
2
2
  #
3
- # Basic methods used by all geography features
3
+ # Tests for the simple cartesian multi polygon implementation
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
6
  # Copyright 2010 Daniel Azuma
@@ -34,59 +34,37 @@
34
34
  ;
35
35
 
36
36
 
37
+ require 'test/unit'
38
+ require 'rgeo'
39
+
40
+ require ::File.expand_path('../common/multi_polygon_tests.rb', ::File.dirname(__FILE__))
41
+
42
+
37
43
  module RGeo
38
-
39
- module Geography
40
-
41
- module Common
44
+ module Tests # :nodoc:
45
+ module SimpleCartesian # :nodoc:
42
46
 
43
-
44
- module GeometryMethods
47
+ class TestMultiPolygon < ::Test::Unit::TestCase # :nodoc:
45
48
 
46
49
 
47
- def inspect # :nodoc:
48
- "#<#{self.class}:0x#{object_id.to_s(16)} #{as_text.inspect}>"
50
+ def create_factories
51
+ @factory = ::RGeo::Cartesian.simple_factory
52
+ @lenient_factory = ::RGeo::Cartesian.simple_factory(:lenient_multi_polygon_assertions => true)
49
53
  end
50
54
 
51
- def to_s # :nodoc:
52
- as_text
53
- end
54
55
 
56
+ include ::RGeo::Tests::Common::MultiPolygonTests
55
57
 
56
- def _validate_geometry # :nodoc:
57
- end
58
58
 
59
-
60
- def _set_factory(factory_) # :nodoc:
61
- @factory = factory_
62
- end
63
-
64
-
65
- def factory
66
- @factory
67
- end
68
-
69
-
70
- def cast(type_)
71
- type_ == geometry_type ? self : nil
72
- end
73
-
74
-
75
- def as_text
76
- Helper.unparse_wkt(self)
77
- end
78
-
79
-
80
- def as_binary
81
- Helper.unparse_wkb(self)
82
- end
59
+ undef_method :test_creation_wrong_type
60
+ undef_method :test_creation_overlapping
61
+ undef_method :test_creation_connected
62
+ undef_method :test_equal
63
+ undef_method :test_not_equal
83
64
 
84
65
 
85
66
  end
86
67
 
87
-
88
68
  end
89
-
90
69
  end
91
-
92
70
  end