rgeo 0.1.10 → 0.1.11
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 +13 -0
- data/README.rdoc +6 -0
- data/Version +1 -1
- data/ext/geos_c_impl/factory.c +2 -2
- data/lib/rgeo/features/factory.rb +2 -2
- data/lib/rgeo/features/geometry.rb +26 -4
- data/lib/rgeo/features/geometry_collection.rb +12 -2
- data/lib/rgeo/geography/common/geometry_collection_methods.rb +12 -1
- data/lib/rgeo/geography/common/helper.rb +4 -4
- data/lib/rgeo/geography/common/line_string_methods.rb +1 -1
- data/lib/rgeo/geography/common/point_methods.rb +1 -1
- data/lib/rgeo/geography/common/polygon_methods.rb +1 -1
- data/lib/rgeo/geography/factories.rb +19 -6
- data/lib/rgeo/geography/factory.rb +31 -10
- data/lib/rgeo/geography/simple_mercator/feature_classes.rb +26 -26
- data/lib/rgeo/geography/simple_mercator/feature_methods.rb +14 -14
- data/lib/rgeo/geography/simple_mercator/projector.rb +1 -1
- data/lib/rgeo/geography/simple_spherical/calculations.rb +61 -0
- data/lib/rgeo/geography/simple_spherical/point_impl.rb +5 -0
- data/lib/rgeo/geos/factory.rb +12 -11
- data/tests/common/geometry_collection_tests.rb +220 -0
- data/tests/common/line_string_tests.rb +300 -0
- data/tests/common/multi_line_string_tests.rb +206 -0
- data/tests/common/multi_point_tests.rb +198 -0
- data/tests/common/multi_polygon_tests.rb +206 -0
- data/tests/common/point_tests.rb +281 -0
- data/tests/common/polygon_tests.rb +232 -0
- data/tests/geos/tc_geometry_collection.rb +5 -169
- data/tests/geos/tc_line_string.rb +4 -252
- data/tests/geos/tc_multi_line_string.rb +5 -154
- data/tests/geos/tc_multi_point.rb +5 -145
- data/tests/geos/tc_multi_polygon.rb +4 -151
- data/tests/geos/tc_point.rb +11 -213
- data/tests/geos/tc_polygon.rb +4 -182
- data/tests/simple_mercator/tc_geometry_collection.rb +62 -0
- data/tests/simple_mercator/tc_line_string.rb +62 -0
- data/tests/simple_mercator/tc_multi_line_string.rb +62 -0
- data/tests/simple_mercator/tc_multi_point.rb +62 -0
- data/tests/simple_mercator/tc_multi_polygon.rb +63 -0
- data/tests/simple_mercator/tc_point.rb +7 -220
- data/tests/simple_mercator/tc_polygon.rb +62 -0
- data/tests/simple_spherical/tc_point.rb +165 -0
- metadata +48 -9
| @@ -37,6 +37,8 @@ | |
| 37 37 | 
             
            require 'test/unit'
         | 
| 38 38 | 
             
            require 'rgeo'
         | 
| 39 39 |  | 
| 40 | 
            +
            require ::File.expand_path('../common/multi_polygon_tests.rb', ::File.dirname(__FILE__))
         | 
| 41 | 
            +
             | 
| 40 42 |  | 
| 41 43 | 
             
            module RGeo
         | 
| 42 44 | 
             
              module Tests  # :nodoc:
         | 
| @@ -45,162 +47,13 @@ module RGeo | |
| 45 47 | 
             
                  class TestMultiPolygon < ::Test::Unit::TestCase  # :nodoc:
         | 
| 46 48 |  | 
| 47 49 |  | 
| 48 | 
            -
                    def  | 
| 50 | 
            +
                    def create_factories
         | 
| 49 51 | 
             
                      @factory = ::RGeo::Geos.factory
         | 
| 50 52 | 
             
                      @lenient_factory = ::RGeo::Geos.factory(:lenient_multi_polygon_assertions => true)
         | 
| 51 | 
            -
                      point1_ = @factory.point(0, 0)
         | 
| 52 | 
            -
                      point2_ = @factory.point(0, 10)
         | 
| 53 | 
            -
                      point3_ = @factory.point(10, 10)
         | 
| 54 | 
            -
                      point4_ = @factory.point(10, 0)
         | 
| 55 | 
            -
                      point5_ = @factory.point(4, 4)
         | 
| 56 | 
            -
                      point6_ = @factory.point(5, 6)
         | 
| 57 | 
            -
                      point7_ = @factory.point(6, 4)
         | 
| 58 | 
            -
                      point8_ = @factory.point(0, -10)
         | 
| 59 | 
            -
                      point9_ = @factory.point(-10, 0)
         | 
| 60 | 
            -
                      exterior1_ = @factory.linear_ring([point1_, point8_, point9_, point1_])
         | 
| 61 | 
            -
                      exterior2_ = @factory.linear_ring([point1_, point2_, point3_, point4_, point1_])
         | 
| 62 | 
            -
                      exterior3_ = @factory.linear_ring([point1_, point2_, point3_, point1_])
         | 
| 63 | 
            -
                      exterior4_ = @factory.linear_ring([point1_, point3_, point4_, point1_])
         | 
| 64 | 
            -
                      interior1_ = @factory.linear_ring([point5_, point6_, point7_, point5_])
         | 
| 65 | 
            -
                      @poly1 = @factory.polygon(exterior1_)
         | 
| 66 | 
            -
                      @poly2 = @factory.polygon(exterior2_, [interior1_])
         | 
| 67 | 
            -
                      @poly3 = @factory.polygon(exterior3_)
         | 
| 68 | 
            -
                      @poly4 = @factory.polygon(exterior4_)
         | 
| 69 | 
            -
                      @line1 = interior1_
         | 
| 70 | 
            -
                    end
         | 
| 71 | 
            -
                    
         | 
| 72 | 
            -
                    
         | 
| 73 | 
            -
                    def test_creation_simple
         | 
| 74 | 
            -
                      geom_ = @factory.multi_polygon([@poly1, @poly2])
         | 
| 75 | 
            -
                      assert_not_nil(geom_)
         | 
| 76 | 
            -
                      assert_kind_of(::RGeo::Geos::MultiPolygonImpl, geom_)
         | 
| 77 | 
            -
                      assert(::RGeo::Features::MultiPolygon === geom_)
         | 
| 78 | 
            -
                      assert_equal(::RGeo::Features::MultiPolygon, geom_.geometry_type)
         | 
| 79 | 
            -
                      assert_equal(2, geom_.num_geometries)
         | 
| 80 | 
            -
                      assert_equal([@poly1, @poly2], geom_.to_a)
         | 
| 81 | 
            -
                    end
         | 
| 82 | 
            -
                    
         | 
| 83 | 
            -
                    
         | 
| 84 | 
            -
                    def test_creation_empty
         | 
| 85 | 
            -
                      geom_ = @factory.multi_polygon([])
         | 
| 86 | 
            -
                      assert_not_nil(geom_)
         | 
| 87 | 
            -
                      assert_kind_of(::RGeo::Geos::MultiPolygonImpl, geom_)
         | 
| 88 | 
            -
                      assert(::RGeo::Features::MultiPolygon === geom_)
         | 
| 89 | 
            -
                      assert_equal(::RGeo::Features::MultiPolygon, geom_.geometry_type)
         | 
| 90 | 
            -
                      assert_equal(0, geom_.num_geometries)
         | 
| 91 | 
            -
                      assert_equal([], geom_.to_a)
         | 
| 92 | 
            -
                    end
         | 
| 93 | 
            -
                    
         | 
| 94 | 
            -
                    
         | 
| 95 | 
            -
                    def test_creation_wrong_type
         | 
| 96 | 
            -
                      geom_ = @factory.multi_polygon([@poly1, @line1])
         | 
| 97 | 
            -
                      assert_nil(geom_)
         | 
| 98 | 
            -
                    end
         | 
| 99 | 
            -
                    
         | 
| 100 | 
            -
                    
         | 
| 101 | 
            -
                    def test_creation_overlapping
         | 
| 102 | 
            -
                      geom_ = @factory.multi_polygon([@poly1, @poly1])
         | 
| 103 | 
            -
                      assert_nil(geom_)
         | 
| 104 | 
            -
                      geom2_ = @lenient_factory.multi_polygon([@poly1, @poly1])
         | 
| 105 | 
            -
                      assert_not_nil(geom2_)
         | 
| 106 | 
            -
                    end
         | 
| 107 | 
            -
                    
         | 
| 108 | 
            -
                    
         | 
| 109 | 
            -
                    def test_creation_connected
         | 
| 110 | 
            -
                      geom_ = @factory.multi_polygon([@poly3, @poly4])
         | 
| 111 | 
            -
                      assert_nil(geom_)
         | 
| 112 | 
            -
                      geom2_ = @lenient_factory.multi_polygon([@poly3, @poly4])
         | 
| 113 | 
            -
                      assert_not_nil(geom2_)
         | 
| 114 | 
            -
                    end
         | 
| 115 | 
            -
                    
         | 
| 116 | 
            -
                    
         | 
| 117 | 
            -
                    def test_equal
         | 
| 118 | 
            -
                      geom1_ = @factory.multi_polygon([@poly1, @poly2])
         | 
| 119 | 
            -
                      geom2_ = @factory.multi_polygon([@poly1, @poly2])
         | 
| 120 | 
            -
                      assert(geom1_.eql?(geom2_))
         | 
| 121 | 
            -
                      assert(geom1_.equals?(geom2_))
         | 
| 122 | 
            -
                    end
         | 
| 123 | 
            -
                    
         | 
| 124 | 
            -
                    
         | 
| 125 | 
            -
                    def test_not_equal
         | 
| 126 | 
            -
                      geom1_ = @factory.multi_polygon([@poly1])
         | 
| 127 | 
            -
                      geom2_ = @factory.multi_polygon([@poly2])
         | 
| 128 | 
            -
                      assert(!geom1_.eql?(geom2_))
         | 
| 129 | 
            -
                      assert(!geom1_.equals?(geom2_))
         | 
| 130 53 | 
             
                    end
         | 
| 131 54 |  | 
| 132 55 |  | 
| 133 | 
            -
                     | 
| 134 | 
            -
                      parsed_geom_ = @factory.parse_wkt('MULTIPOLYGON(((0 0, 0 -10, -10 0, 0 0)), ((0 0, 0 10, 10 10, 10 0, 0 0), (4 4, 5 6, 6 4, 4 4)))')
         | 
| 135 | 
            -
                      built_geom_ = @factory.multi_polygon([@poly1, @poly2])
         | 
| 136 | 
            -
                      assert_equal(built_geom_, parsed_geom_)
         | 
| 137 | 
            -
                    end
         | 
| 138 | 
            -
                    
         | 
| 139 | 
            -
                    
         | 
| 140 | 
            -
                    def test_wkt_creation_empty
         | 
| 141 | 
            -
                      parsed_geom_ = @factory.parse_wkt('MULTIPOLYGON EMPTY')
         | 
| 142 | 
            -
                      assert_equal(::RGeo::Features::MultiPolygon, parsed_geom_.geometry_type)
         | 
| 143 | 
            -
                      assert_equal(0, parsed_geom_.num_geometries)
         | 
| 144 | 
            -
                      assert_equal([], parsed_geom_.to_a)
         | 
| 145 | 
            -
                    end
         | 
| 146 | 
            -
                    
         | 
| 147 | 
            -
                    
         | 
| 148 | 
            -
                    def test_clone
         | 
| 149 | 
            -
                      geom1_ = @factory.multi_polygon([@poly1, @poly2])
         | 
| 150 | 
            -
                      geom2_ = geom1_.clone
         | 
| 151 | 
            -
                      assert_equal(geom1_, geom2_)
         | 
| 152 | 
            -
                      assert_equal(::RGeo::Features::MultiPolygon, geom2_.geometry_type)
         | 
| 153 | 
            -
                      assert_equal(2, geom2_.num_geometries)
         | 
| 154 | 
            -
                      assert_equal([@poly1, @poly2], geom2_.to_a)
         | 
| 155 | 
            -
                    end
         | 
| 156 | 
            -
                    
         | 
| 157 | 
            -
                    
         | 
| 158 | 
            -
                    def test_type_check
         | 
| 159 | 
            -
                      geom1_ = @factory.multi_polygon([@poly1, @poly2])
         | 
| 160 | 
            -
                      assert(::RGeo::Features::Geometry.check_type(geom1_))
         | 
| 161 | 
            -
                      assert(!::RGeo::Features::Polygon.check_type(geom1_))
         | 
| 162 | 
            -
                      assert(::RGeo::Features::GeometryCollection.check_type(geom1_))
         | 
| 163 | 
            -
                      assert(!::RGeo::Features::MultiPoint.check_type(geom1_))
         | 
| 164 | 
            -
                      assert(::RGeo::Features::MultiPolygon.check_type(geom1_))
         | 
| 165 | 
            -
                      geom2_ = @factory.multi_polygon([])
         | 
| 166 | 
            -
                      assert(::RGeo::Features::Geometry.check_type(geom2_))
         | 
| 167 | 
            -
                      assert(!::RGeo::Features::Polygon.check_type(geom2_))
         | 
| 168 | 
            -
                      assert(::RGeo::Features::GeometryCollection.check_type(geom2_))
         | 
| 169 | 
            -
                      assert(!::RGeo::Features::MultiPoint.check_type(geom2_))
         | 
| 170 | 
            -
                      assert(::RGeo::Features::MultiPolygon.check_type(geom2_))
         | 
| 171 | 
            -
                    end
         | 
| 172 | 
            -
                    
         | 
| 173 | 
            -
                    
         | 
| 174 | 
            -
                    def test_as_text_wkt_round_trip
         | 
| 175 | 
            -
                      geom1_ = @factory.multi_polygon([@poly1, @poly2])
         | 
| 176 | 
            -
                      text_ = geom1_.as_text
         | 
| 177 | 
            -
                      geom2_ = @factory.parse_wkt(text_)
         | 
| 178 | 
            -
                      assert_equal(geom1_, geom2_)
         | 
| 179 | 
            -
                    end
         | 
| 180 | 
            -
                    
         | 
| 181 | 
            -
                    
         | 
| 182 | 
            -
                    def test_as_binary_wkb_round_trip
         | 
| 183 | 
            -
                      geom1_ = @factory.multi_polygon([@poly1, @poly2])
         | 
| 184 | 
            -
                      binary_ = geom1_.as_binary
         | 
| 185 | 
            -
                      geom2_ = @factory.parse_wkb(binary_)
         | 
| 186 | 
            -
                      assert_equal(geom1_, geom2_)
         | 
| 187 | 
            -
                    end
         | 
| 188 | 
            -
                    
         | 
| 189 | 
            -
                    
         | 
| 190 | 
            -
                    def test_dimension
         | 
| 191 | 
            -
                      geom1_ = @factory.multi_polygon([@poly1, @poly2])
         | 
| 192 | 
            -
                      assert_equal(2, geom1_.dimension)
         | 
| 193 | 
            -
                      geom2_ = @factory.multi_polygon([])
         | 
| 194 | 
            -
                      assert_equal(-1, geom2_.dimension)
         | 
| 195 | 
            -
                    end
         | 
| 196 | 
            -
                    
         | 
| 197 | 
            -
                    
         | 
| 198 | 
            -
                    def test_is_empty
         | 
| 199 | 
            -
                      geom1_ = @factory.multi_polygon([@poly1, @poly2])
         | 
| 200 | 
            -
                      assert(!geom1_.is_empty?)
         | 
| 201 | 
            -
                      geom2_ = @factory.multi_polygon([])
         | 
| 202 | 
            -
                      assert(geom2_.is_empty?)
         | 
| 203 | 
            -
                    end
         | 
| 56 | 
            +
                    include ::RGeo::Tests::Common::MultiPolygonTests
         | 
| 204 57 |  | 
| 205 58 |  | 
| 206 59 | 
             
                  end
         | 
    
        data/tests/geos/tc_point.rb
    CHANGED
    
    | @@ -37,6 +37,8 @@ | |
| 37 37 | 
             
            require 'test/unit'
         | 
| 38 38 | 
             
            require 'rgeo'
         | 
| 39 39 |  | 
| 40 | 
            +
            require ::File.expand_path('../common/point_tests.rb', ::File.dirname(__FILE__))
         | 
| 41 | 
            +
             | 
| 40 42 |  | 
| 41 43 | 
             
            module RGeo
         | 
| 42 44 | 
             
              module Tests  # :nodoc:
         | 
| @@ -50,11 +52,12 @@ module RGeo | |
| 50 52 | 
             
                    end
         | 
| 51 53 |  | 
| 52 54 |  | 
| 53 | 
            -
                     | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
                       | 
| 55 | 
            +
                    include ::RGeo::Tests::Common::PointTests
         | 
| 56 | 
            +
                    
         | 
| 57 | 
            +
                    
         | 
| 58 | 
            +
                    def test_has_no_projection
         | 
| 59 | 
            +
                      point_ = @factory.point(21, -22)
         | 
| 60 | 
            +
                      assert(!point_.respond_to?(:projection))
         | 
| 58 61 | 
             
                    end
         | 
| 59 62 |  | 
| 60 63 |  | 
| @@ -63,13 +66,13 @@ module RGeo | |
| 63 66 | 
             
                      assert_equal(11, point_.x)
         | 
| 64 67 | 
             
                      assert_equal(12, point_.y)
         | 
| 65 68 | 
             
                      assert_equal(13, point_.z)
         | 
| 69 | 
            +
                      point2_ = @factory.point(21, 22)
         | 
| 70 | 
            +
                      assert_nil(point2_.z)
         | 
| 66 71 | 
             
                    end
         | 
| 67 72 |  | 
| 68 73 |  | 
| 69 | 
            -
                    def  | 
| 74 | 
            +
                    def test_wkt_creation_3d
         | 
| 70 75 | 
             
                      point1_ = @factory.parse_wkt('POINT(21 22)')
         | 
| 71 | 
            -
                      assert_equal(21, point1_.x)
         | 
| 72 | 
            -
                      assert_equal(22, point1_.y)
         | 
| 73 76 | 
             
                      assert_nil(point1_.z)
         | 
| 74 77 | 
             
                      point2_ = @factory.parse_wkt('POINT(11 12 13)')
         | 
| 75 78 | 
             
                      assert_equal(11, point2_.x)
         | 
| @@ -78,160 +81,12 @@ module RGeo | |
| 78 81 | 
             
                    end
         | 
| 79 82 |  | 
| 80 83 |  | 
| 81 | 
            -
                    def test_clone
         | 
| 82 | 
            -
                      point1_ = @factory.point(11, 12)
         | 
| 83 | 
            -
                      point2_ = point1_.clone
         | 
| 84 | 
            -
                      assert_equal(point1_, point2_)
         | 
| 85 | 
            -
                      point3_ = @factory.point(13, 12)
         | 
| 86 | 
            -
                      point4_ = point3_.dup
         | 
| 87 | 
            -
                      assert_equal(point3_, point4_)
         | 
| 88 | 
            -
                      assert_not_equal(point2_, point4_)
         | 
| 89 | 
            -
                    end
         | 
| 90 | 
            -
                    
         | 
| 91 | 
            -
                    
         | 
| 92 | 
            -
                    def test_type_check
         | 
| 93 | 
            -
                      point_ = @factory.point(21, 22)
         | 
| 94 | 
            -
                      assert(::RGeo::Features::Geometry.check_type(point_))
         | 
| 95 | 
            -
                      assert(::RGeo::Features::Point.check_type(point_))
         | 
| 96 | 
            -
                      assert(!::RGeo::Features::GeometryCollection.check_type(point_))
         | 
| 97 | 
            -
                      assert(!::RGeo::Features::Curve.check_type(point_))
         | 
| 98 | 
            -
                    end
         | 
| 99 | 
            -
                    
         | 
| 100 | 
            -
                    
         | 
| 101 | 
            -
                    def test_geometry_type
         | 
| 102 | 
            -
                      point_ = @factory.point(11, 12)
         | 
| 103 | 
            -
                      assert_equal(::RGeo::Features::Point, point_.geometry_type)
         | 
| 104 | 
            -
                    end
         | 
| 105 | 
            -
                    
         | 
| 106 | 
            -
                    
         | 
| 107 84 | 
             
                    def test_srid
         | 
| 108 85 | 
             
                      point_ = @factory.point(11, 12)
         | 
| 109 86 | 
             
                      assert_equal(0, point_.srid)
         | 
| 110 87 | 
             
                    end
         | 
| 111 88 |  | 
| 112 89 |  | 
| 113 | 
            -
                    def test_dimension
         | 
| 114 | 
            -
                      point_ = @factory.point(11, 12)
         | 
| 115 | 
            -
                      assert_equal(0, point_.dimension)
         | 
| 116 | 
            -
                    end
         | 
| 117 | 
            -
                    
         | 
| 118 | 
            -
                    
         | 
| 119 | 
            -
                    def test_envelope
         | 
| 120 | 
            -
                      point_ = @factory.point(11, 12)
         | 
| 121 | 
            -
                      assert_equal(point_, point_.envelope)
         | 
| 122 | 
            -
                    end
         | 
| 123 | 
            -
                    
         | 
| 124 | 
            -
                    
         | 
| 125 | 
            -
                    def test_as_text_wkt_round_trip
         | 
| 126 | 
            -
                      point1_ = @factory.point(11, 12)
         | 
| 127 | 
            -
                      text_ = point1_.as_text
         | 
| 128 | 
            -
                      point2_ = @factory.parse_wkt(text_)
         | 
| 129 | 
            -
                      assert(point2_.eql?(point1_))
         | 
| 130 | 
            -
                    end
         | 
| 131 | 
            -
                    
         | 
| 132 | 
            -
                    
         | 
| 133 | 
            -
                    def test_as_binary_wkb_round_trip
         | 
| 134 | 
            -
                      point1_ = @factory.point(211, 12)
         | 
| 135 | 
            -
                      binary_ = point1_.as_binary
         | 
| 136 | 
            -
                      point2_ = @factory.parse_wkb(binary_)
         | 
| 137 | 
            -
                      assert(point2_.eql?(point1_))
         | 
| 138 | 
            -
                    end
         | 
| 139 | 
            -
                    
         | 
| 140 | 
            -
                    
         | 
| 141 | 
            -
                    def test_is_empty
         | 
| 142 | 
            -
                      point1_ = @factory.point(0, 0)
         | 
| 143 | 
            -
                      assert(!point1_.is_empty?)
         | 
| 144 | 
            -
                    end
         | 
| 145 | 
            -
                    
         | 
| 146 | 
            -
                    
         | 
| 147 | 
            -
                    def test_is_simple
         | 
| 148 | 
            -
                      point1_ = @factory.point(0, 0)
         | 
| 149 | 
            -
                      assert(point1_.is_simple?)
         | 
| 150 | 
            -
                    end
         | 
| 151 | 
            -
                    
         | 
| 152 | 
            -
                    
         | 
| 153 | 
            -
                    def test_boundary
         | 
| 154 | 
            -
                      point_ = @factory.point(11, 12)
         | 
| 155 | 
            -
                      boundary_ = point_.boundary
         | 
| 156 | 
            -
                      assert_kind_of(::RGeo::Geos::GeometryCollectionImpl, boundary_)
         | 
| 157 | 
            -
                      assert(boundary_.is_empty?)
         | 
| 158 | 
            -
                    end
         | 
| 159 | 
            -
                    
         | 
| 160 | 
            -
                    
         | 
| 161 | 
            -
                    def test_equals
         | 
| 162 | 
            -
                      point1_ = @factory.point(11, 12)
         | 
| 163 | 
            -
                      point2_ = @factory.point(11, 12)
         | 
| 164 | 
            -
                      point3_ = @factory.point(13, 12)
         | 
| 165 | 
            -
                      assert(point1_.equals?(point2_))
         | 
| 166 | 
            -
                      assert(point1_.eql?(point2_))
         | 
| 167 | 
            -
                      assert(!point1_.equals?(point3_))
         | 
| 168 | 
            -
                      assert(!point1_.eql?(point3_))
         | 
| 169 | 
            -
                    end
         | 
| 170 | 
            -
                    
         | 
| 171 | 
            -
                    
         | 
| 172 | 
            -
                    def test_disjoint
         | 
| 173 | 
            -
                      point1_ = @factory.point(11, 12)
         | 
| 174 | 
            -
                      point2_ = @factory.point(11, 12)
         | 
| 175 | 
            -
                      point3_ = @factory.point(12, 12)
         | 
| 176 | 
            -
                      assert(!point1_.disjoint?(point2_))
         | 
| 177 | 
            -
                      assert(point1_.disjoint?(point3_))
         | 
| 178 | 
            -
                    end
         | 
| 179 | 
            -
                    
         | 
| 180 | 
            -
                    
         | 
| 181 | 
            -
                    def test_intersects
         | 
| 182 | 
            -
                      point1_ = @factory.point(11, 12)
         | 
| 183 | 
            -
                      point2_ = @factory.point(11, 12)
         | 
| 184 | 
            -
                      point3_ = @factory.point(12, 12)
         | 
| 185 | 
            -
                      assert(point1_.intersects?(point2_))
         | 
| 186 | 
            -
                      assert(!point1_.intersects?(point3_))
         | 
| 187 | 
            -
                    end
         | 
| 188 | 
            -
                    
         | 
| 189 | 
            -
                    
         | 
| 190 | 
            -
                    def test_touches
         | 
| 191 | 
            -
                      point1_ = @factory.point(11, 12)
         | 
| 192 | 
            -
                      point2_ = @factory.point(11, 12)
         | 
| 193 | 
            -
                      point3_ = @factory.point(12, 12)
         | 
| 194 | 
            -
                      assert(!point1_.touches?(point2_))
         | 
| 195 | 
            -
                      assert(!point1_.touches?(point3_))
         | 
| 196 | 
            -
                    end
         | 
| 197 | 
            -
                    
         | 
| 198 | 
            -
                    
         | 
| 199 | 
            -
                    def test_crosses
         | 
| 200 | 
            -
                      point1_ = @factory.point(11, 12)
         | 
| 201 | 
            -
                      point2_ = @factory.point(11, 12)
         | 
| 202 | 
            -
                      point3_ = @factory.point(12, 12)
         | 
| 203 | 
            -
                      assert(!point1_.crosses?(point2_))
         | 
| 204 | 
            -
                      assert(!point1_.crosses?(point3_))
         | 
| 205 | 
            -
                    end
         | 
| 206 | 
            -
                    
         | 
| 207 | 
            -
                    
         | 
| 208 | 
            -
                    def test_within
         | 
| 209 | 
            -
                      point1_ = @factory.point(11, 12)
         | 
| 210 | 
            -
                      point2_ = @factory.point(11, 12)
         | 
| 211 | 
            -
                      point3_ = @factory.point(12, 12)
         | 
| 212 | 
            -
                      assert(point1_.within?(point2_))
         | 
| 213 | 
            -
                      assert(!point1_.within?(point3_))
         | 
| 214 | 
            -
                    end
         | 
| 215 | 
            -
                    
         | 
| 216 | 
            -
                    
         | 
| 217 | 
            -
                    def test_contains
         | 
| 218 | 
            -
                      point1_ = @factory.point(11, 12)
         | 
| 219 | 
            -
                      point2_ = @factory.point(11, 12)
         | 
| 220 | 
            -
                      point3_ = @factory.point(12, 12)
         | 
| 221 | 
            -
                      assert(point1_.contains?(point2_))
         | 
| 222 | 
            -
                      assert(!point1_.contains?(point3_))
         | 
| 223 | 
            -
                    end
         | 
| 224 | 
            -
                    
         | 
| 225 | 
            -
                    
         | 
| 226 | 
            -
                    def test_overlaps
         | 
| 227 | 
            -
                      point1_ = @factory.point(11, 12)
         | 
| 228 | 
            -
                      point2_ = @factory.point(11, 12)
         | 
| 229 | 
            -
                      point3_ = @factory.point(12, 12)
         | 
| 230 | 
            -
                      assert(!point1_.overlaps?(point2_))
         | 
| 231 | 
            -
                      assert(!point1_.overlaps?(point3_))
         | 
| 232 | 
            -
                    end
         | 
| 233 | 
            -
                    
         | 
| 234 | 
            -
                    
         | 
| 235 90 | 
             
                    def test_distance
         | 
| 236 91 | 
             
                      point1_ = @factory.point(11, 12)
         | 
| 237 92 | 
             
                      point2_ = @factory.point(11, 12)
         | 
| @@ -241,63 +96,6 @@ module RGeo | |
| 241 96 | 
             
                    end
         | 
| 242 97 |  | 
| 243 98 |  | 
| 244 | 
            -
                    def test_convex_hull
         | 
| 245 | 
            -
                      point_ = @factory.point(11, 12)
         | 
| 246 | 
            -
                      hull_ = point_.convex_hull
         | 
| 247 | 
            -
                      assert_equal(point_, hull_)
         | 
| 248 | 
            -
                    end
         | 
| 249 | 
            -
                    
         | 
| 250 | 
            -
                    
         | 
| 251 | 
            -
                    def test_intersection
         | 
| 252 | 
            -
                      point1_ = @factory.point(11, 12)
         | 
| 253 | 
            -
                      point2_ = @factory.point(11, 12)
         | 
| 254 | 
            -
                      point3_ = @factory.point(12, 12)
         | 
| 255 | 
            -
                      assert_equal(point1_, point1_.intersection(point2_))
         | 
| 256 | 
            -
                      int13_ = point1_.intersection(point3_)
         | 
| 257 | 
            -
                      assert_kind_of(::RGeo::Geos::GeometryCollectionImpl, int13_)
         | 
| 258 | 
            -
                      assert(int13_.is_empty?)
         | 
| 259 | 
            -
                    end
         | 
| 260 | 
            -
                    
         | 
| 261 | 
            -
                    
         | 
| 262 | 
            -
                    def test_union
         | 
| 263 | 
            -
                      point1_ = @factory.point(11, 12)
         | 
| 264 | 
            -
                      point2_ = @factory.point(11, 12)
         | 
| 265 | 
            -
                      point3_ = @factory.point(12, 12)
         | 
| 266 | 
            -
                      union12_ = point1_.union(point2_)
         | 
| 267 | 
            -
                      union13_ = point1_.union(point3_)
         | 
| 268 | 
            -
                      assert_equal(point1_, union12_)
         | 
| 269 | 
            -
                      assert_kind_of(::RGeo::Geos::MultiPointImpl, union13_)
         | 
| 270 | 
            -
                      assert(union13_.contains?(point1_))
         | 
| 271 | 
            -
                      assert(union13_.contains?(point3_))
         | 
| 272 | 
            -
                    end
         | 
| 273 | 
            -
                    
         | 
| 274 | 
            -
                    
         | 
| 275 | 
            -
                    def test_difference
         | 
| 276 | 
            -
                      point1_ = @factory.point(11, 12)
         | 
| 277 | 
            -
                      point2_ = @factory.point(11, 12)
         | 
| 278 | 
            -
                      point3_ = @factory.point(12, 12)
         | 
| 279 | 
            -
                      diff12_ = point1_.difference(point2_)
         | 
| 280 | 
            -
                      diff13_ = point1_.difference(point3_)
         | 
| 281 | 
            -
                      assert_kind_of(::RGeo::Geos::GeometryCollectionImpl, diff12_)
         | 
| 282 | 
            -
                      assert(diff12_.is_empty?)
         | 
| 283 | 
            -
                      assert_equal(point1_, diff13_)
         | 
| 284 | 
            -
                    end
         | 
| 285 | 
            -
                    
         | 
| 286 | 
            -
                    
         | 
| 287 | 
            -
                    def test_sym_difference
         | 
| 288 | 
            -
                      point1_ = @factory.point(11, 12)
         | 
| 289 | 
            -
                      point2_ = @factory.point(11, 12)
         | 
| 290 | 
            -
                      point3_ = @factory.point(12, 12)
         | 
| 291 | 
            -
                      diff12_ = point1_.sym_difference(point2_)
         | 
| 292 | 
            -
                      diff13_ = point1_.sym_difference(point3_)
         | 
| 293 | 
            -
                      assert_kind_of(::RGeo::Geos::GeometryCollectionImpl, diff12_)
         | 
| 294 | 
            -
                      assert(diff12_.is_empty?)
         | 
| 295 | 
            -
                      assert_kind_of(::RGeo::Geos::MultiPointImpl, diff13_)
         | 
| 296 | 
            -
                      assert(diff13_.contains?(point1_))
         | 
| 297 | 
            -
                      assert(diff13_.contains?(point3_))
         | 
| 298 | 
            -
                    end
         | 
| 299 | 
            -
                    
         | 
| 300 | 
            -
                    
         | 
| 301 99 | 
             
                  end
         | 
| 302 100 |  | 
| 303 101 | 
             
                end
         | 
    
        data/tests/geos/tc_polygon.rb
    CHANGED
    
    | @@ -37,10 +37,12 @@ | |
| 37 37 | 
             
            require 'test/unit'
         | 
| 38 38 | 
             
            require 'rgeo'
         | 
| 39 39 |  | 
| 40 | 
            +
            require ::File.expand_path('../common/polygon_tests.rb', ::File.dirname(__FILE__))
         | 
| 41 | 
            +
             | 
| 40 42 |  | 
| 41 43 | 
             
            module RGeo
         | 
| 42 44 | 
             
              module Tests  # :nodoc:
         | 
| 43 | 
            -
                module Geos
         | 
| 45 | 
            +
                module Geos  # :nodoc:
         | 
| 44 46 |  | 
| 45 47 | 
             
                  class TestPolygon < ::Test::Unit::TestCase  # :nodoc:
         | 
| 46 48 |  | 
| @@ -50,187 +52,7 @@ module RGeo | |
| 50 52 | 
             
                    end
         | 
| 51 53 |  | 
| 52 54 |  | 
| 53 | 
            -
                     | 
| 54 | 
            -
                      point1_ = @factory.point(0, 0)
         | 
| 55 | 
            -
                      point2_ = @factory.point(0, 1)
         | 
| 56 | 
            -
                      point3_ = @factory.point(1, 0)
         | 
| 57 | 
            -
                      exterior_ = @factory.linear_ring([point1_, point2_, point3_, point1_])
         | 
| 58 | 
            -
                      polygon_ = @factory.polygon(exterior_)
         | 
| 59 | 
            -
                      assert_not_nil(polygon_)
         | 
| 60 | 
            -
                      assert_kind_of(::RGeo::Geos::PolygonImpl, polygon_)
         | 
| 61 | 
            -
                      assert(::RGeo::Features::Polygon === polygon_)
         | 
| 62 | 
            -
                      assert_equal(::RGeo::Features::Polygon, polygon_.geometry_type)
         | 
| 63 | 
            -
                      assert_equal(exterior_, polygon_.exterior_ring)
         | 
| 64 | 
            -
                      assert_equal(0, polygon_.num_interior_rings)
         | 
| 65 | 
            -
                    end
         | 
| 66 | 
            -
                    
         | 
| 67 | 
            -
                    
         | 
| 68 | 
            -
                    def test_creation_one_hole
         | 
| 69 | 
            -
                      point1_ = @factory.point(0, 0)
         | 
| 70 | 
            -
                      point2_ = @factory.point(0, 10)
         | 
| 71 | 
            -
                      point3_ = @factory.point(10, 10)
         | 
| 72 | 
            -
                      point4_ = @factory.point(10, 0)
         | 
| 73 | 
            -
                      point5_ = @factory.point(4, 4)
         | 
| 74 | 
            -
                      point6_ = @factory.point(5, 6)
         | 
| 75 | 
            -
                      point7_ = @factory.point(6, 4)
         | 
| 76 | 
            -
                      exterior_ = @factory.linear_ring([point1_, point2_, point3_, point4_, point1_])
         | 
| 77 | 
            -
                      interior_ = @factory.linear_ring([point5_, point6_, point7_, point5_])
         | 
| 78 | 
            -
                      polygon_ = @factory.polygon(exterior_, [interior_])
         | 
| 79 | 
            -
                      assert_not_nil(polygon_)
         | 
| 80 | 
            -
                      assert_kind_of(::RGeo::Geos::PolygonImpl, polygon_)
         | 
| 81 | 
            -
                      assert(::RGeo::Features::Polygon === polygon_)
         | 
| 82 | 
            -
                      assert_equal(::RGeo::Features::Polygon, polygon_.geometry_type)
         | 
| 83 | 
            -
                      assert_equal(exterior_, polygon_.exterior_ring)
         | 
| 84 | 
            -
                      assert_equal(1, polygon_.num_interior_rings)
         | 
| 85 | 
            -
                      assert_equal([interior_], polygon_.interior_rings)
         | 
| 86 | 
            -
                    end
         | 
| 87 | 
            -
                    
         | 
| 88 | 
            -
                    
         | 
| 89 | 
            -
                    def test_fully_equal
         | 
| 90 | 
            -
                      point1_ = @factory.point(0, 0)
         | 
| 91 | 
            -
                      point2_ = @factory.point(0, 1)
         | 
| 92 | 
            -
                      point3_ = @factory.point(1, 0)
         | 
| 93 | 
            -
                      exterior1_ = @factory.linear_ring([point1_, point2_, point3_, point1_])
         | 
| 94 | 
            -
                      poly1_ = @factory.polygon(exterior1_)
         | 
| 95 | 
            -
                      point4_ = @factory.point(0, 0)
         | 
| 96 | 
            -
                      point5_ = @factory.point(0, 1)
         | 
| 97 | 
            -
                      point6_ = @factory.point(1, 0)
         | 
| 98 | 
            -
                      exterior2_ = @factory.linear_ring([point4_, point5_, point6_, point4_])
         | 
| 99 | 
            -
                      poly2_ = @factory.polygon(exterior2_)
         | 
| 100 | 
            -
                      assert(poly1_.eql?(poly2_))
         | 
| 101 | 
            -
                      assert(poly1_.equals?(poly2_))
         | 
| 102 | 
            -
                    end
         | 
| 103 | 
            -
                    
         | 
| 104 | 
            -
                    
         | 
| 105 | 
            -
                    def test_geometrically_equal_but_ordered_different
         | 
| 106 | 
            -
                      point1_ = @factory.point(0, 0)
         | 
| 107 | 
            -
                      point2_ = @factory.point(0, 1)
         | 
| 108 | 
            -
                      point3_ = @factory.point(1, 0)
         | 
| 109 | 
            -
                      exterior1_ = @factory.linear_ring([point1_, point2_, point3_, point1_])
         | 
| 110 | 
            -
                      poly1_ = @factory.polygon(exterior1_)
         | 
| 111 | 
            -
                      exterior2_ = @factory.linear_ring([point2_, point3_, point1_, point2_])
         | 
| 112 | 
            -
                      poly2_ = @factory.polygon(exterior2_)
         | 
| 113 | 
            -
                      assert(!poly1_.eql?(poly2_))
         | 
| 114 | 
            -
                      assert(poly1_.equals?(poly2_))
         | 
| 115 | 
            -
                    end
         | 
| 116 | 
            -
                    
         | 
| 117 | 
            -
                    
         | 
| 118 | 
            -
                    def test_geometrically_equal_but_different_directions
         | 
| 119 | 
            -
                      point1_ = @factory.point(0, 0)
         | 
| 120 | 
            -
                      point2_ = @factory.point(0, 1)
         | 
| 121 | 
            -
                      point3_ = @factory.point(1, 0)
         | 
| 122 | 
            -
                      exterior1_ = @factory.linear_ring([point1_, point2_, point3_, point1_])
         | 
| 123 | 
            -
                      poly1_ = @factory.polygon(exterior1_)
         | 
| 124 | 
            -
                      exterior2_ = @factory.linear_ring([point1_, point3_, point2_, point1_])
         | 
| 125 | 
            -
                      poly2_ = @factory.polygon(exterior2_)
         | 
| 126 | 
            -
                      assert(!poly1_.eql?(poly2_))
         | 
| 127 | 
            -
                      assert(poly1_.equals?(poly2_))
         | 
| 128 | 
            -
                    end
         | 
| 129 | 
            -
                    
         | 
| 130 | 
            -
                    
         | 
| 131 | 
            -
                    def test_wkt_creation_simple
         | 
| 132 | 
            -
                      parsed_poly_ = @factory.parse_wkt('POLYGON((0 0, 0 1, 1 0, 0 0))')
         | 
| 133 | 
            -
                      point1_ = @factory.point(0, 0)
         | 
| 134 | 
            -
                      point2_ = @factory.point(0, 1)
         | 
| 135 | 
            -
                      point3_ = @factory.point(1, 0)
         | 
| 136 | 
            -
                      exterior_ = @factory.linear_ring([point1_, point2_, point3_, point1_])
         | 
| 137 | 
            -
                      built_poly_ = @factory.polygon(exterior_)
         | 
| 138 | 
            -
                      assert_equal(built_poly_, parsed_poly_)
         | 
| 139 | 
            -
                    end
         | 
| 140 | 
            -
                    
         | 
| 141 | 
            -
                    
         | 
| 142 | 
            -
                    def test_wkt_creation_one_hole
         | 
| 143 | 
            -
                      parsed_poly_ = @factory.parse_wkt('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0), (4 4, 5 6, 6 4, 4 4))')
         | 
| 144 | 
            -
                      point1_ = @factory.point(0, 0)
         | 
| 145 | 
            -
                      point2_ = @factory.point(0, 10)
         | 
| 146 | 
            -
                      point3_ = @factory.point(10, 10)
         | 
| 147 | 
            -
                      point4_ = @factory.point(10, 0)
         | 
| 148 | 
            -
                      point5_ = @factory.point(4, 4)
         | 
| 149 | 
            -
                      point6_ = @factory.point(5, 6)
         | 
| 150 | 
            -
                      point7_ = @factory.point(6, 4)
         | 
| 151 | 
            -
                      exterior_ = @factory.linear_ring([point1_, point2_, point3_, point4_, point1_])
         | 
| 152 | 
            -
                      interior_ = @factory.linear_ring([point5_, point6_, point7_, point5_])
         | 
| 153 | 
            -
                      built_poly_ = @factory.polygon(exterior_, [interior_])
         | 
| 154 | 
            -
                      assert_equal(built_poly_, parsed_poly_)
         | 
| 155 | 
            -
                    end
         | 
| 156 | 
            -
                    
         | 
| 157 | 
            -
                    
         | 
| 158 | 
            -
                    def test_clone
         | 
| 159 | 
            -
                      point1_ = @factory.point(0, 0)
         | 
| 160 | 
            -
                      point2_ = @factory.point(0, 1)
         | 
| 161 | 
            -
                      point3_ = @factory.point(1, 0)
         | 
| 162 | 
            -
                      exterior_ = @factory.linear_ring([point1_, point2_, point3_, point1_])
         | 
| 163 | 
            -
                      poly1_ = @factory.polygon(exterior_)
         | 
| 164 | 
            -
                      poly2_ = poly1_.clone
         | 
| 165 | 
            -
                      assert_equal(poly1_, poly2_)
         | 
| 166 | 
            -
                      assert_equal(exterior_, poly2_.exterior_ring)
         | 
| 167 | 
            -
                      assert_equal(0, poly2_.num_interior_rings)
         | 
| 168 | 
            -
                    end
         | 
| 169 | 
            -
                    
         | 
| 170 | 
            -
                    
         | 
| 171 | 
            -
                    def test_type_check
         | 
| 172 | 
            -
                      point1_ = @factory.point(0, 0)
         | 
| 173 | 
            -
                      point2_ = @factory.point(0, 1)
         | 
| 174 | 
            -
                      point3_ = @factory.point(1, 0)
         | 
| 175 | 
            -
                      exterior_ = @factory.linear_ring([point1_, point2_, point3_, point1_])
         | 
| 176 | 
            -
                      poly_ = @factory.polygon(exterior_)
         | 
| 177 | 
            -
                      assert(::RGeo::Features::Geometry.check_type(poly_))
         | 
| 178 | 
            -
                      assert(!::RGeo::Features::Point.check_type(poly_))
         | 
| 179 | 
            -
                      assert(!::RGeo::Features::GeometryCollection.check_type(poly_))
         | 
| 180 | 
            -
                      assert(::RGeo::Features::Surface.check_type(poly_))
         | 
| 181 | 
            -
                      assert(::RGeo::Features::Polygon.check_type(poly_))
         | 
| 182 | 
            -
                    end
         | 
| 183 | 
            -
                    
         | 
| 184 | 
            -
                    
         | 
| 185 | 
            -
                    def test_as_text_wkt_round_trip
         | 
| 186 | 
            -
                      point1_ = @factory.point(0, 0)
         | 
| 187 | 
            -
                      point2_ = @factory.point(0, 1)
         | 
| 188 | 
            -
                      point3_ = @factory.point(1, 0)
         | 
| 189 | 
            -
                      exterior_ = @factory.linear_ring([point1_, point2_, point3_, point1_])
         | 
| 190 | 
            -
                      poly1_ = @factory.polygon(exterior_)
         | 
| 191 | 
            -
                      text_ = poly1_.as_text
         | 
| 192 | 
            -
                      poly2_ = @factory.parse_wkt(text_)
         | 
| 193 | 
            -
                      assert_equal(poly1_, poly2_)
         | 
| 194 | 
            -
                    end
         | 
| 195 | 
            -
                    
         | 
| 196 | 
            -
                    
         | 
| 197 | 
            -
                    def test_as_binary_wkb_round_trip
         | 
| 198 | 
            -
                      point1_ = @factory.point(0, 0)
         | 
| 199 | 
            -
                      point2_ = @factory.point(0, 1)
         | 
| 200 | 
            -
                      point3_ = @factory.point(1, 0)
         | 
| 201 | 
            -
                      exterior_ = @factory.linear_ring([point1_, point2_, point3_, point1_])
         | 
| 202 | 
            -
                      poly1_ = @factory.polygon(exterior_)
         | 
| 203 | 
            -
                      binary_ = poly1_.as_binary
         | 
| 204 | 
            -
                      poly2_ = @factory.parse_wkb(binary_)
         | 
| 205 | 
            -
                      assert_equal(poly1_, poly2_)
         | 
| 206 | 
            -
                    end
         | 
| 207 | 
            -
                    
         | 
| 208 | 
            -
                    
         | 
| 209 | 
            -
                    def test_dimension
         | 
| 210 | 
            -
                      point1_ = @factory.point(0, 0)
         | 
| 211 | 
            -
                      point2_ = @factory.point(0, 10)
         | 
| 212 | 
            -
                      point3_ = @factory.point(10, 10)
         | 
| 213 | 
            -
                      point4_ = @factory.point(10, 0)
         | 
| 214 | 
            -
                      point5_ = @factory.point(4, 4)
         | 
| 215 | 
            -
                      point6_ = @factory.point(5, 6)
         | 
| 216 | 
            -
                      point7_ = @factory.point(6, 4)
         | 
| 217 | 
            -
                      exterior_ = @factory.linear_ring([point1_, point2_, point3_, point4_, point1_])
         | 
| 218 | 
            -
                      interior_ = @factory.linear_ring([point5_, point6_, point7_, point5_])
         | 
| 219 | 
            -
                      poly_ = @factory.polygon(exterior_, [interior_])
         | 
| 220 | 
            -
                      assert_equal(2, poly_.dimension)
         | 
| 221 | 
            -
                    end
         | 
| 222 | 
            -
                    
         | 
| 223 | 
            -
                    
         | 
| 224 | 
            -
                    def test_is_empty
         | 
| 225 | 
            -
                      point1_ = @factory.point(0, 0)
         | 
| 226 | 
            -
                      point2_ = @factory.point(0, 1)
         | 
| 227 | 
            -
                      point3_ = @factory.point(1, 0)
         | 
| 228 | 
            -
                      exterior_ = @factory.linear_ring([point1_, point2_, point3_, point1_])
         | 
| 229 | 
            -
                      poly1_ = @factory.polygon(exterior_)
         | 
| 230 | 
            -
                      assert(!poly1_.is_empty?)
         | 
| 231 | 
            -
                      poly2_ = @factory.polygon(@factory.linear_ring([]))
         | 
| 232 | 
            -
                      assert(poly2_.is_empty?)
         | 
| 233 | 
            -
                    end
         | 
| 55 | 
            +
                    include ::RGeo::Tests::Common::PolygonTests
         | 
| 234 56 |  | 
| 235 57 |  | 
| 236 58 | 
             
                  end
         | 
| @@ -0,0 +1,62 @@ | |
| 1 | 
            +
            # -----------------------------------------------------------------------------
         | 
| 2 | 
            +
            # 
         | 
| 3 | 
            +
            # Tests for the simple mercator 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 SimpleMercator
         | 
| 46 | 
            +
                  
         | 
| 47 | 
            +
                  class TestGeometryCollection < ::Test::Unit::TestCase  # :nodoc:
         | 
| 48 | 
            +
                    
         | 
| 49 | 
            +
                    
         | 
| 50 | 
            +
                    def create_factory
         | 
| 51 | 
            +
                      ::RGeo::Geography.simple_mercator
         | 
| 52 | 
            +
                    end
         | 
| 53 | 
            +
                    
         | 
| 54 | 
            +
                    
         | 
| 55 | 
            +
                    include ::RGeo::Tests::Common::GeometryCollectionTests
         | 
| 56 | 
            +
                    
         | 
| 57 | 
            +
                    
         | 
| 58 | 
            +
                  end
         | 
| 59 | 
            +
                  
         | 
| 60 | 
            +
                end
         | 
| 61 | 
            +
              end
         | 
| 62 | 
            +
            end
         |