rgeo 0.5.3 → 0.6.0
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.
- checksums.yaml +4 -4
- data/ext/geos_c_impl/extconf.rb +1 -0
- data/ext/geos_c_impl/factory.c +10 -1
- data/ext/geos_c_impl/geometry.c +25 -3
- data/ext/geos_c_impl/line_string.c +1 -12
- data/ext/geos_c_impl/polygon.c +0 -3
- data/ext/geos_c_impl/preface.h +3 -0
- data/lib/rgeo.rb +0 -1
- data/lib/rgeo/feature/geometry.rb +17 -0
- data/lib/rgeo/feature/types.rb +4 -4
- data/lib/rgeo/geographic/projected_feature_methods.rb +1 -22
- data/lib/rgeo/geos/ffi_feature_methods.rb +5 -0
- data/lib/rgeo/geos/utils.rb +2 -0
- data/lib/rgeo/impl_helper/basic_line_string_methods.rb +1 -0
- data/lib/rgeo/version.rb +1 -1
- metadata +11 -171
- data/lib/rgeo/yaml.rb +0 -23
- data/test/cartesian_analysis_test.rb +0 -65
- data/test/cartesian_bbox_test.rb +0 -123
- data/test/common/factory_tests.rb +0 -78
- data/test/common/geometry_collection_tests.rb +0 -237
- data/test/common/line_string_tests.rb +0 -330
- data/test/common/multi_line_string_tests.rb +0 -182
- data/test/common/multi_point_tests.rb +0 -200
- data/test/common/multi_polygon_tests.rb +0 -191
- data/test/common/point_tests.rb +0 -370
- data/test/common/polygon_tests.rb +0 -228
- data/test/coord_sys/ogc_cs_test.rb +0 -342
- data/test/coord_sys/proj4_srs_data_test.rb +0 -41
- data/test/coord_sys/proj4_test.rb +0 -150
- data/test/coord_sys/sr_org_test.rb +0 -32
- data/test/coord_sys/url_reader_test.rb +0 -42
- data/test/geos_capi/factory_test.rb +0 -31
- data/test/geos_capi/geometry_collection_test.rb +0 -24
- data/test/geos_capi/line_string_test.rb +0 -24
- data/test/geos_capi/misc_test.rb +0 -116
- data/test/geos_capi/multi_line_string_test.rb +0 -24
- data/test/geos_capi/multi_point_test.rb +0 -24
- data/test/geos_capi/multi_polygon_test.rb +0 -39
- data/test/geos_capi/parsing_unparsing_test.rb +0 -40
- data/test/geos_capi/point_test.rb +0 -72
- data/test/geos_capi/polygon_test.rb +0 -154
- data/test/geos_capi/zmfactory_test.rb +0 -57
- data/test/geos_ffi/factory_test.rb +0 -31
- data/test/geos_ffi/geometry_collection_test.rb +0 -24
- data/test/geos_ffi/line_string_test.rb +0 -24
- data/test/geos_ffi/misc_test.rb +0 -63
- data/test/geos_ffi/multi_line_string_test.rb +0 -24
- data/test/geos_ffi/multi_point_test.rb +0 -24
- data/test/geos_ffi/multi_polygon_test.rb +0 -33
- data/test/geos_ffi/parsing_unparsing_test.rb +0 -41
- data/test/geos_ffi/point_test.rb +0 -77
- data/test/geos_ffi/polygon_test.rb +0 -46
- data/test/geos_ffi/zmfactory_test.rb +0 -58
- data/test/mixins_test.rb +0 -141
- data/test/oneoff_test.rb +0 -26
- data/test/projected_geographic/factory_test.rb +0 -25
- data/test/projected_geographic/geometry_collection_test.rb +0 -24
- data/test/projected_geographic/line_string_test.rb +0 -24
- data/test/projected_geographic/multi_line_string_test.rb +0 -26
- data/test/projected_geographic/multi_point_test.rb +0 -30
- data/test/projected_geographic/multi_polygon_test.rb +0 -25
- data/test/projected_geographic/point_test.rb +0 -51
- data/test/projected_geographic/polygon_test.rb +0 -24
- data/test/simple_cartesian/calculations_test.rb +0 -99
- data/test/simple_cartesian/factory_test.rb +0 -27
- data/test/simple_cartesian/geometry_collection_test.rb +0 -30
- data/test/simple_cartesian/line_string_test.rb +0 -31
- data/test/simple_cartesian/multi_line_string_test.rb +0 -28
- data/test/simple_cartesian/multi_point_test.rb +0 -31
- data/test/simple_cartesian/multi_polygon_test.rb +0 -31
- data/test/simple_cartesian/point_test.rb +0 -50
- data/test/simple_cartesian/polygon_test.rb +0 -28
- data/test/simple_mercator/factory_test.rb +0 -25
- data/test/simple_mercator/geometry_collection_test.rb +0 -24
- data/test/simple_mercator/line_string_test.rb +0 -24
- data/test/simple_mercator/multi_line_string_test.rb +0 -26
- data/test/simple_mercator/multi_point_test.rb +0 -29
- data/test/simple_mercator/multi_polygon_test.rb +0 -25
- data/test/simple_mercator/point_test.rb +0 -55
- data/test/simple_mercator/polygon_test.rb +0 -24
- data/test/simple_mercator/window_test.rb +0 -173
- data/test/spherical_geographic/calculations_test.rb +0 -167
- data/test/spherical_geographic/factory_test.rb +0 -27
- data/test/spherical_geographic/geometry_collection_test.rb +0 -31
- data/test/spherical_geographic/line_string_test.rb +0 -31
- data/test/spherical_geographic/multi_line_string_test.rb +0 -29
- data/test/spherical_geographic/multi_point_test.rb +0 -31
- data/test/spherical_geographic/multi_polygon_test.rb +0 -31
- data/test/spherical_geographic/point_test.rb +0 -78
- data/test/spherical_geographic/polygon_test.rb +0 -28
- data/test/types_test.rb +0 -42
- data/test/wkrep/wkb_generator_test.rb +0 -185
- data/test/wkrep/wkb_parser_test.rb +0 -293
- data/test/wkrep/wkt_generator_test.rb +0 -294
- data/test/wkrep/wkt_parser_test.rb +0 -412
data/test/oneoff_test.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# A container file for one-off tests
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
require "test/unit"
|
8
|
-
require "rgeo"
|
9
|
-
require "ffi-geos"
|
10
|
-
|
11
|
-
module RGeo
|
12
|
-
module Tests # :nodoc:
|
13
|
-
class TestOneOff < ::Test::Unit::TestCase # :nodoc:
|
14
|
-
def setup
|
15
|
-
# @mercator_factory = ::RGeo::Geographic.simple_mercator_factory
|
16
|
-
# @spherical_factory = ::RGeo::Geographic.spherical_factory(:buffer_resolution => 2)
|
17
|
-
# @projected_factory = ::RGeo::Geographic.projected_factory(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857, :has_z_coordinate => true)
|
18
|
-
# @geos_factory = ::RGeo::Geos.factory(:buffer_resolution => 2)
|
19
|
-
# @cartesian_factory = ::RGeo::Cartesian.simple_factory(:buffer_resolution => 2)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_dummy
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Tests for the GEOS factory
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
require "test/unit"
|
8
|
-
require "rgeo"
|
9
|
-
|
10
|
-
require ::File.expand_path("../common/factory_tests.rb", ::File.dirname(__FILE__))
|
11
|
-
|
12
|
-
module RGeo
|
13
|
-
module Tests # :nodoc:
|
14
|
-
module ProjectedGeographic # :nodoc:
|
15
|
-
class TestFactory < ::Test::Unit::TestCase # :nodoc:
|
16
|
-
def setup
|
17
|
-
@factory = ::RGeo::Geographic.projected_factory(projection_proj4: "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs", projection_srid: 3857)
|
18
|
-
@srid = 4326
|
19
|
-
end
|
20
|
-
|
21
|
-
include ::RGeo::Tests::Common::FactoryTests
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end if ::RGeo::CoordSys::Proj4.supported?
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Tests for the simple mercator geometry collection implementation
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
require "test/unit"
|
8
|
-
require "rgeo"
|
9
|
-
|
10
|
-
require ::File.expand_path("../common/geometry_collection_tests.rb", ::File.dirname(__FILE__))
|
11
|
-
|
12
|
-
module RGeo
|
13
|
-
module Tests # :nodoc:
|
14
|
-
module ProjectedGeographic # :nodoc:
|
15
|
-
class TestGeometryCollection < ::Test::Unit::TestCase # :nodoc:
|
16
|
-
def create_factory
|
17
|
-
::RGeo::Geographic.projected_factory(projection_proj4: "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs", projection_srid: 3857)
|
18
|
-
end
|
19
|
-
|
20
|
-
include ::RGeo::Tests::Common::GeometryCollectionTests
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end if ::RGeo::CoordSys::Proj4.supported?
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Tests for the simple mercator line string implementation
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
require "test/unit"
|
8
|
-
require "rgeo"
|
9
|
-
|
10
|
-
require ::File.expand_path("../common/line_string_tests.rb", ::File.dirname(__FILE__))
|
11
|
-
|
12
|
-
module RGeo
|
13
|
-
module Tests # :nodoc:
|
14
|
-
module ProjectedGeographic # :nodoc:
|
15
|
-
class TestLineString < ::Test::Unit::TestCase # :nodoc:
|
16
|
-
def setup
|
17
|
-
@factory = ::RGeo::Geographic.projected_factory(projection_proj4: "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs", projection_srid: 3857)
|
18
|
-
end
|
19
|
-
|
20
|
-
include ::RGeo::Tests::Common::LineStringTests
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end if ::RGeo::CoordSys::Proj4.supported?
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Tests for the simple mercator multi line string implementation
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
require "test/unit"
|
8
|
-
require "rgeo"
|
9
|
-
|
10
|
-
require ::File.expand_path("../common/multi_line_string_tests.rb", ::File.dirname(__FILE__))
|
11
|
-
|
12
|
-
module RGeo
|
13
|
-
module Tests # :nodoc:
|
14
|
-
module ProjectedGeographic # :nodoc:
|
15
|
-
class TestMultiLineString < ::Test::Unit::TestCase # :nodoc:
|
16
|
-
def create_factory
|
17
|
-
::RGeo::Geographic.projected_factory(projection_proj4: "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs", projection_srid: 3857)
|
18
|
-
end
|
19
|
-
|
20
|
-
include ::RGeo::Tests::Common::MultiLineStringTests
|
21
|
-
|
22
|
-
undef_method :test_length
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end if ::RGeo::CoordSys::Proj4.supported?
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Tests for the simple mercator multi point implementation
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
require "test/unit"
|
8
|
-
require "rgeo"
|
9
|
-
|
10
|
-
require ::File.expand_path("../common/multi_point_tests.rb", ::File.dirname(__FILE__))
|
11
|
-
|
12
|
-
module RGeo
|
13
|
-
module Tests # :nodoc:
|
14
|
-
module ProjectedGeographic # :nodoc:
|
15
|
-
class TestMultiPoint < ::Test::Unit::TestCase # :nodoc:
|
16
|
-
def create_factory(opts_ = {})
|
17
|
-
::RGeo::Geographic.projected_factory(opts_.merge(
|
18
|
-
projection_proj4: "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs", projection_srid: 3857))
|
19
|
-
end
|
20
|
-
|
21
|
-
include ::RGeo::Tests::Common::MultiPointTests
|
22
|
-
|
23
|
-
# These tests suffer from floating point issues
|
24
|
-
undef_method :test_union
|
25
|
-
undef_method :test_difference
|
26
|
-
undef_method :test_intersection
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end if ::RGeo::CoordSys::Proj4.supported?
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Tests for the simple mercator multi polygon implementation
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
require "test/unit"
|
8
|
-
require "rgeo"
|
9
|
-
|
10
|
-
require ::File.expand_path("../common/multi_polygon_tests.rb", ::File.dirname(__FILE__))
|
11
|
-
|
12
|
-
module RGeo
|
13
|
-
module Tests # :nodoc:
|
14
|
-
module ProjectedGeographic # :nodoc:
|
15
|
-
class TestMultiPolygon < ::Test::Unit::TestCase # :nodoc:
|
16
|
-
def create_factories
|
17
|
-
@factory = ::RGeo::Geographic.projected_factory(projection_proj4: "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs", projection_srid: 3857)
|
18
|
-
@lenient_factory = ::RGeo::Geographic.projected_factory(projection_proj4: "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs", projection_srid: 3857, lenient_multi_polygon_assertions: true)
|
19
|
-
end
|
20
|
-
|
21
|
-
include ::RGeo::Tests::Common::MultiPolygonTests
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end if ::RGeo::CoordSys::Proj4.supported?
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Tests for the simple mercator point implementation
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
require "test/unit"
|
8
|
-
require "rgeo"
|
9
|
-
|
10
|
-
require ::File.expand_path("../common/point_tests.rb", ::File.dirname(__FILE__))
|
11
|
-
|
12
|
-
module RGeo
|
13
|
-
module Tests # :nodoc:
|
14
|
-
module ProjectedGeographic # :nodoc:
|
15
|
-
class TestPoint < ::Test::Unit::TestCase # :nodoc:
|
16
|
-
def setup
|
17
|
-
@factory = ::RGeo::Geographic.projected_factory(buffer_resolution: 8, projection_proj4: "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs", projection_srid: 3857)
|
18
|
-
@zfactory = ::RGeo::Geographic.projected_factory(has_z_coordinate: true, projection_proj4: "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs", projection_srid: 3857)
|
19
|
-
@mfactory = ::RGeo::Geographic.projected_factory(has_m_coordinate: true, projection_proj4: "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs", projection_srid: 3857)
|
20
|
-
@zmfactory = ::RGeo::Geographic.projected_factory(has_z_coordinate: true, has_m_coordinate: true, projection_proj4: "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs", projection_srid: 3857)
|
21
|
-
end
|
22
|
-
|
23
|
-
include ::RGeo::Tests::Common::PointTests
|
24
|
-
|
25
|
-
def test_has_projection
|
26
|
-
point_ = @factory.point(21, -22)
|
27
|
-
assert(point_.respond_to?(:projection))
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_latlon
|
31
|
-
point_ = @factory.point(21, -22)
|
32
|
-
assert_equal(21, point_.longitude)
|
33
|
-
assert_equal(-22, point_.latitude)
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_srid
|
37
|
-
point_ = @factory.point(11, 12)
|
38
|
-
assert_equal(4326, point_.srid)
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_distance
|
42
|
-
point1_ = @factory.point(11, 12)
|
43
|
-
point2_ = @factory.point(11, 12)
|
44
|
-
point3_ = @factory.point(13, 12)
|
45
|
-
assert_in_delta(0, point1_.distance(point2_), 0.0001)
|
46
|
-
assert_in_delta(222_638, point1_.distance(point3_), 1)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end if ::RGeo::CoordSys::Proj4.supported?
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Tests for the simple mercator polygon implementation
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
require "test/unit"
|
8
|
-
require "rgeo"
|
9
|
-
|
10
|
-
require ::File.expand_path("../common/polygon_tests.rb", ::File.dirname(__FILE__))
|
11
|
-
|
12
|
-
module RGeo
|
13
|
-
module Tests # :nodoc:
|
14
|
-
module ProjectedGeographic # :nodoc:
|
15
|
-
class TestPolygon < ::Test::Unit::TestCase # :nodoc:
|
16
|
-
def setup
|
17
|
-
@factory = ::RGeo::Geographic.projected_factory(projection_proj4: "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs", projection_srid: 3857)
|
18
|
-
end
|
19
|
-
|
20
|
-
include ::RGeo::Tests::Common::PolygonTests
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end if ::RGeo::CoordSys::Proj4.supported?
|
@@ -1,99 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Tests for the internal calculations for simple cartesian
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
require "test/unit"
|
8
|
-
require "rgeo"
|
9
|
-
|
10
|
-
module RGeo
|
11
|
-
module Tests # :nodoc:
|
12
|
-
module Cartesian # :nodoc:
|
13
|
-
class TestCalculations < ::Test::Unit::TestCase # :nodoc:
|
14
|
-
def setup
|
15
|
-
@factory = ::RGeo::Cartesian.simple_factory
|
16
|
-
@point1 = @factory.point(3, 4)
|
17
|
-
@point2 = @factory.point(5, 5)
|
18
|
-
@point3 = @factory.point(6, 4)
|
19
|
-
@point4 = @factory.point(3, 5)
|
20
|
-
@point5 = @factory.point(-1, 2)
|
21
|
-
@point6 = @factory.point(-1, 1)
|
22
|
-
@point7 = @factory.point(5, 4)
|
23
|
-
@point8 = @factory.point(1, 3)
|
24
|
-
@horiz_seg = ::RGeo::Cartesian::Segment.new(@point1, @point3)
|
25
|
-
@vert_seg = ::RGeo::Cartesian::Segment.new(@point4, @point1)
|
26
|
-
@short_rising_seg = ::RGeo::Cartesian::Segment.new(@point1, @point2)
|
27
|
-
@long_rising_seg = ::RGeo::Cartesian::Segment.new(@point5, @point2)
|
28
|
-
@collinear_rising_seg = ::RGeo::Cartesian::Segment.new(@point5, @point8)
|
29
|
-
@touching_collinear_rising_seg = ::RGeo::Cartesian::Segment.new(@point1, @point8)
|
30
|
-
@parallel_rising_seg = ::RGeo::Cartesian::Segment.new(@point6, @point7)
|
31
|
-
@steep_rising_seg = ::RGeo::Cartesian::Segment.new(@point6, @point4)
|
32
|
-
@degenerate_seg = ::RGeo::Cartesian::Segment.new(@point5, @point5)
|
33
|
-
end
|
34
|
-
|
35
|
-
def assert_close_enough(v1_, v2_)
|
36
|
-
diff_ = (v1_ - v2_).abs
|
37
|
-
# denom_ = (v1_ + v2_).abs
|
38
|
-
# diff_ /= denom_ if denom_ > 0.01
|
39
|
-
assert(diff_ < 0.00000001, "#{v1_} is not close to #{v2_}")
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_segment_degenerate
|
43
|
-
assert(@degenerate_seg.degenerate?)
|
44
|
-
assert_equal(0, @degenerate_seg.dx)
|
45
|
-
assert_equal(0, @degenerate_seg.dy)
|
46
|
-
assert_equal(@point5, @degenerate_seg.s)
|
47
|
-
assert_equal(@point5, @degenerate_seg.e)
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_segment_basic
|
51
|
-
assert(!@short_rising_seg.degenerate?)
|
52
|
-
assert_equal(2, @short_rising_seg.dx)
|
53
|
-
assert_equal(1, @short_rising_seg.dy)
|
54
|
-
assert_equal(@point1, @short_rising_seg.s)
|
55
|
-
assert_equal(@point2, @short_rising_seg.e)
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_segment_side_basic
|
59
|
-
assert_equal(0.0, @short_rising_seg.side(@point5))
|
60
|
-
assert(@short_rising_seg.side(@point4) > 0.0)
|
61
|
-
assert(@short_rising_seg.side(@point6) < 0.0)
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_segment_tproj_basic
|
65
|
-
assert_equal(-2, @short_rising_seg.tproj(@point5))
|
66
|
-
assert_close_enough(2.0 / 3.0, @long_rising_seg.tproj(@point1))
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_segment_contains_point
|
70
|
-
assert(@long_rising_seg.contains_point?(@point1))
|
71
|
-
assert(@long_rising_seg.contains_point?(@point2))
|
72
|
-
assert(!@long_rising_seg.contains_point?(@point3))
|
73
|
-
assert(!@short_rising_seg.contains_point?(@point5))
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_segment_intersects_parallel
|
77
|
-
assert(@long_rising_seg.intersects_segment?(@long_rising_seg))
|
78
|
-
assert(!@long_rising_seg.intersects_segment?(@parallel_rising_seg))
|
79
|
-
assert(!@short_rising_seg.intersects_segment?(@collinear_rising_seg))
|
80
|
-
assert(@touching_collinear_rising_seg.intersects_segment?(@short_rising_seg))
|
81
|
-
assert(@touching_collinear_rising_seg.intersects_segment?(@long_rising_seg))
|
82
|
-
assert(@long_rising_seg.intersects_segment?(@touching_collinear_rising_seg))
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_segment_intersects_basic
|
86
|
-
assert(@long_rising_seg.intersects_segment?(@steep_rising_seg))
|
87
|
-
assert(@steep_rising_seg.intersects_segment?(@long_rising_seg))
|
88
|
-
assert(!@short_rising_seg.intersects_segment?(@steep_rising_seg))
|
89
|
-
assert(!@steep_rising_seg.intersects_segment?(@short_rising_seg))
|
90
|
-
end
|
91
|
-
|
92
|
-
def test_segment_intersects_endpoints
|
93
|
-
assert(@horiz_seg.intersects_segment?(@vert_seg))
|
94
|
-
assert(@vert_seg.intersects_segment?(@horiz_seg))
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Tests for the GEOS factory
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
require "test/unit"
|
8
|
-
require "rgeo"
|
9
|
-
|
10
|
-
require ::File.expand_path("../common/factory_tests.rb", ::File.dirname(__FILE__))
|
11
|
-
|
12
|
-
module RGeo
|
13
|
-
module Tests # :nodoc:
|
14
|
-
module SimpleCartesian # :nodoc:
|
15
|
-
class TestFactory < ::Test::Unit::TestCase # :nodoc:
|
16
|
-
def setup
|
17
|
-
@factory = ::RGeo::Cartesian.simple_factory(srid: 1000)
|
18
|
-
@srid = 1000
|
19
|
-
end
|
20
|
-
|
21
|
-
include ::RGeo::Tests::Common::FactoryTests
|
22
|
-
|
23
|
-
undef_method :test_srid_preserved_through_geom_operations
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Tests for the simple cartesian geometry collection implementation
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
require "test/unit"
|
8
|
-
require "rgeo"
|
9
|
-
|
10
|
-
require ::File.expand_path("../common/geometry_collection_tests.rb", ::File.dirname(__FILE__))
|
11
|
-
|
12
|
-
module RGeo
|
13
|
-
module Tests # :nodoc:
|
14
|
-
module SimpleCartesian # :nodoc:
|
15
|
-
class TestGeometryCollection < ::Test::Unit::TestCase # :nodoc:
|
16
|
-
def create_factory
|
17
|
-
@factory = ::RGeo::Cartesian.simple_factory
|
18
|
-
end
|
19
|
-
|
20
|
-
include ::RGeo::Tests::Common::GeometryCollectionTests
|
21
|
-
|
22
|
-
undef_method :test_fully_equal
|
23
|
-
undef_method :test_geometrically_equal
|
24
|
-
undef_method :test_empty_equal
|
25
|
-
undef_method :test_not_equal
|
26
|
-
undef_method :test_empty_collection_boundary
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Tests for the simple cartesian line string implementation
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
require "test/unit"
|
8
|
-
require "rgeo"
|
9
|
-
|
10
|
-
require ::File.expand_path("../common/line_string_tests.rb", ::File.dirname(__FILE__))
|
11
|
-
|
12
|
-
module RGeo
|
13
|
-
module Tests # :nodoc:
|
14
|
-
module SimpleCartesian # :nodoc:
|
15
|
-
class TestLineString < ::Test::Unit::TestCase # :nodoc:
|
16
|
-
def setup
|
17
|
-
@factory = ::RGeo::Cartesian.simple_factory
|
18
|
-
end
|
19
|
-
|
20
|
-
include ::RGeo::Tests::Common::LineStringTests
|
21
|
-
|
22
|
-
undef_method :test_fully_equal
|
23
|
-
undef_method :test_geometrically_equal_but_different_type
|
24
|
-
undef_method :test_geometrically_equal_but_different_type2
|
25
|
-
undef_method :test_geometrically_equal_but_different_overlap
|
26
|
-
undef_method :test_empty_equal
|
27
|
-
undef_method :test_not_equal
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|