georuby 2.3.0 → 2.5.1

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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -9
  3. data/Rakefile +13 -14
  4. data/lib/geo_ruby/ewk.rb +2 -0
  5. data/lib/geo_ruby/{simple_features → ewk}/ewkb_parser.rb +206 -218
  6. data/lib/geo_ruby/ewk/ewkt_parser.rb +321 -0
  7. data/lib/geo_ruby/geojson.rb +27 -32
  8. data/lib/geo_ruby/georss.rb +88 -66
  9. data/lib/geo_ruby/gpx.rb +113 -1
  10. data/lib/geo_ruby/kml.rb +43 -31
  11. data/lib/geo_ruby/shp.rb +1 -0
  12. data/lib/geo_ruby/shp4r/dbf.rb +7 -3
  13. data/lib/geo_ruby/shp4r/shp.rb +297 -284
  14. data/lib/geo_ruby/simple_features.rb +2 -6
  15. data/lib/geo_ruby/simple_features/circle.rb +15 -13
  16. data/lib/geo_ruby/simple_features/envelope.rb +84 -77
  17. data/lib/geo_ruby/simple_features/geometry.rb +89 -69
  18. data/lib/geo_ruby/simple_features/geometry_collection.rb +46 -43
  19. data/lib/geo_ruby/simple_features/geometry_factory.rb +50 -47
  20. data/lib/geo_ruby/simple_features/helper.rb +14 -14
  21. data/lib/geo_ruby/simple_features/line_string.rb +94 -97
  22. data/lib/geo_ruby/simple_features/linear_ring.rb +4 -9
  23. data/lib/geo_ruby/simple_features/multi_line_string.rb +18 -21
  24. data/lib/geo_ruby/simple_features/multi_point.rb +18 -20
  25. data/lib/geo_ruby/simple_features/multi_polygon.rb +19 -25
  26. data/lib/geo_ruby/simple_features/point.rb +134 -128
  27. data/lib/geo_ruby/simple_features/polygon.rb +60 -59
  28. data/lib/geo_ruby/version.rb +1 -1
  29. data/spec/data/geojson/feature.json +9 -0
  30. data/spec/data/geojson/feature_collection.json +3 -4
  31. data/spec/geo_ruby/{simple_features → ewk}/ewkb_parser_spec.rb +56 -57
  32. data/spec/geo_ruby/{simple_features → ewk}/ewkt_parser_spec.rb +62 -63
  33. data/spec/geo_ruby/geojson_spec.rb +34 -17
  34. data/spec/geo_ruby/georss_spec.rb +76 -64
  35. data/spec/geo_ruby/{gpx4r/gpx_spec.rb → gpx_spec.rb} +25 -25
  36. data/spec/geo_ruby/kml_spec.rb +40 -36
  37. data/spec/geo_ruby/shp4r/shp_spec.rb +51 -51
  38. data/spec/geo_ruby/simple_features/circle_spec.rb +2 -2
  39. data/spec/geo_ruby/simple_features/envelope_spec.rb +8 -8
  40. data/spec/geo_ruby/simple_features/geometry_collection_spec.rb +26 -26
  41. data/spec/geo_ruby/simple_features/geometry_factory_spec.rb +5 -5
  42. data/spec/geo_ruby/simple_features/geometry_spec.rb +8 -8
  43. data/spec/geo_ruby/simple_features/line_string_spec.rb +102 -102
  44. data/spec/geo_ruby/simple_features/linear_ring_spec.rb +7 -7
  45. data/spec/geo_ruby/simple_features/multi_line_string_spec.rb +20 -20
  46. data/spec/geo_ruby/simple_features/multi_point_spec.rb +16 -16
  47. data/spec/geo_ruby/simple_features/multi_polygon_spec.rb +19 -19
  48. data/spec/geo_ruby/simple_features/point_spec.rb +180 -174
  49. data/spec/geo_ruby/simple_features/polygon_spec.rb +55 -56
  50. data/spec/geo_ruby_spec.rb +4 -4
  51. data/spec/spec_helper.rb +19 -13
  52. metadata +10 -9
  53. data/lib/geo_ruby/gpx4r/gpx.rb +0 -118
  54. data/lib/geo_ruby/simple_features/ewkt_parser.rb +0 -336
@@ -3,11 +3,11 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
3
3
 
4
4
  describe GeoRuby::SimpleFeatures::Circle do
5
5
 
6
- it "should instantiate" do
6
+ it 'should instantiate' do
7
7
  expect(subject).to be_kind_of GeoRuby::SimpleFeatures::Geometry
8
8
  end
9
9
 
10
- describe "Instance" do
10
+ describe 'Instance' do
11
11
  let(:circle) { GeoRuby::SimpleFeatures::Circle.new(4326) }
12
12
  end
13
13
 
@@ -3,16 +3,16 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
3
3
  describe GeoRuby::SimpleFeatures::Envelope do
4
4
  before(:each) do
5
5
  @srid = 4269
6
- @env = GeoRuby::SimpleFeatures::Envelope.from_points([GeoRuby::SimpleFeatures::Point.from_x_y(10,20, @srid),GeoRuby::SimpleFeatures::Point.from_x_y(20,30, @srid)], @srid)
6
+ @env = GeoRuby::SimpleFeatures::Envelope.from_points([GeoRuby::SimpleFeatures::Point.from_x_y(10, 20, @srid), GeoRuby::SimpleFeatures::Point.from_x_y(20, 30, @srid)], @srid)
7
7
  end
8
8
 
9
- it "should initialize" do
9
+ it 'should initialize' do
10
10
  expect(@env).to be_instance_of(GeoRuby::SimpleFeatures::Envelope)
11
11
  end
12
12
 
13
- it "converted tu" do
14
- linear_ring = GeoRuby::SimpleFeatures::LinearRing.from_coordinates([[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],256)
15
- polygon = GeoRuby::SimpleFeatures::Polygon.from_linear_rings([linear_ring],256)
13
+ it 'converted tu' do
14
+ linear_ring = GeoRuby::SimpleFeatures::LinearRing.from_coordinates([[12.4, -45.3], [45.4, 41.6], [4.456, 1.0698], [12.4, -45.3]], 256)
15
+ polygon = GeoRuby::SimpleFeatures::Polygon.from_linear_rings([linear_ring], 256)
16
16
  e = polygon.envelope
17
17
 
18
18
  expect(e.lower_corner.class).to eql(GeoRuby::SimpleFeatures::Point)
@@ -23,7 +23,7 @@ describe GeoRuby::SimpleFeatures::Envelope do
23
23
  expect(e.upper_corner.x).to eql(45.4)
24
24
  expect(e.upper_corner.y).to eql(41.6)
25
25
 
26
- line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[13.6,-49.3],[45.4,44.6],[14.2,1.09],[13.6,-49.3]],256)
26
+ line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[13.6, -49.3], [45.4, 44.6], [14.2, 1.09], [13.6, -49.3]], 256)
27
27
  e2 = line_string.envelope
28
28
 
29
29
  e3 = e.extend(e2)
@@ -34,13 +34,13 @@ describe GeoRuby::SimpleFeatures::Envelope do
34
34
  expect(e3.upper_corner.y).to eql(44.6)
35
35
  end
36
36
 
37
- it "should have a center" do
37
+ it 'should have a center' do
38
38
  expect(@env.center.x).to eql(15)
39
39
  expect(@env.center.y).to eql(25)
40
40
  expect(@env.center.srid).to eql(@env.srid)
41
41
  end
42
42
 
43
- it "should print a kml_representation" do
43
+ it 'should print a kml_representation' do
44
44
  expect(@env.as_kml).to eql("<LatLonAltBox>\n<north>30</north>\n<south>20</south>\n<east>20</east>\n<west>10</west>\n</LatLonAltBox>\n")
45
45
  end
46
46
 
@@ -2,54 +2,54 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
3
  describe GeoRuby::SimpleFeatures::GeometryCollection do
4
4
 
5
- it "should test_geometry_collection_creation" do
6
- geometry_collection = GeoRuby::SimpleFeatures::GeometryCollection::new(256)
7
- geometry_collection << GeoRuby::SimpleFeatures::Point.from_x_y(4.67,45.4,256)
5
+ it 'should test_geometry_collection_creation' do
6
+ geometry_collection = GeoRuby::SimpleFeatures::GeometryCollection.new(256)
7
+ geometry_collection << GeoRuby::SimpleFeatures::Point.from_x_y(4.67, 45.4, 256)
8
8
 
9
9
  expect(geometry_collection.length).to eql(1)
10
- expect(geometry_collection[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(4.67,45.4,256))
10
+ expect(geometry_collection[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(4.67, 45.4, 256))
11
11
 
12
- geometry_collection[0]=GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7,12.45],[67.55,54]],256)
13
- geometry_collection << GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)
12
+ geometry_collection[0] = GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7, 12.45], [67.55, 54]], 256)
13
+ geometry_collection << GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]], [[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]], 256)
14
14
  expect(geometry_collection.length).to eql(2)
15
- expect(geometry_collection[0]).to eq(GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7,12.45],[67.55,54]],256))
15
+ expect(geometry_collection[0]).to eq(GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7, 12.45], [67.55, 54]], 256))
16
16
 
17
- geometry_collection = GeoRuby::SimpleFeatures::GeometryCollection.from_geometries([GeoRuby::SimpleFeatures::Point.from_x_y(4.67,45.4,256),GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7,12.45],[67.55,54]],256)],256)
17
+ geometry_collection = GeoRuby::SimpleFeatures::GeometryCollection.from_geometries([GeoRuby::SimpleFeatures::Point.from_x_y(4.67, 45.4, 256), GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7, 12.45], [67.55, 54]], 256)], 256)
18
18
  expect(geometry_collection.class).to eql(GeoRuby::SimpleFeatures::GeometryCollection)
19
19
  expect(geometry_collection.srid).to eql(256)
20
20
  expect(geometry_collection.length).to eql(2)
21
- expect(geometry_collection[1]).to eq(GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7,12.45],[67.55,54]],256))
21
+ expect(geometry_collection[1]).to eq(GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7, 12.45], [67.55, 54]], 256))
22
22
 
23
23
  bbox = geometry_collection.bounding_box
24
24
  expect(bbox.length).to eql(2)
25
- expect(bbox[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(4.67,12.45))
26
- expect(bbox[1]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(67.55,54))
25
+ expect(bbox[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(4.67, 12.45))
26
+ expect(bbox[1]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(67.55, 54))
27
27
  end
28
28
 
29
- it "test_geometry_collection_equal" do
30
- geometry_collection1 = GeoRuby::SimpleFeatures::GeometryCollection.from_geometries([GeoRuby::SimpleFeatures::Point.from_x_y(4.67,45.4,256),GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7,12.45],[67.55,54]],256)],256)
31
- geometry_collection2 = GeoRuby::SimpleFeatures::GeometryCollection.from_geometries([GeoRuby::SimpleFeatures::Point.from_x_y(4.67,45.4,256),GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7,12.45],[67.55,54]],256),GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0,0,2],[4,0,2],[4,4,2],[0,4,2],[0,0,2]],[[1,1,2],[3,1,2],[3,3,2],[1,3,2],[1,1,2]]],256)],256,true)
32
- line_string=GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7,12.45],[67.55,54]],256)
29
+ it 'test_geometry_collection_equal' do
30
+ geometry_collection1 = GeoRuby::SimpleFeatures::GeometryCollection.from_geometries([GeoRuby::SimpleFeatures::Point.from_x_y(4.67, 45.4, 256), GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7, 12.45], [67.55, 54]], 256)], 256)
31
+ geometry_collection2 = GeoRuby::SimpleFeatures::GeometryCollection.from_geometries([GeoRuby::SimpleFeatures::Point.from_x_y(4.67, 45.4, 256), GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7, 12.45], [67.55, 54]], 256), GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0, 0, 2], [4, 0, 2], [4, 4, 2], [0, 4, 2], [0, 0, 2]], [[1, 1, 2], [3, 1, 2], [3, 3, 2], [1, 3, 2], [1, 1, 2]]], 256)], 256, true)
32
+ line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7, 12.45], [67.55, 54]], 256)
33
33
 
34
- expect(geometry_collection1).to eq(GeoRuby::SimpleFeatures::GeometryCollection.from_geometries([GeoRuby::SimpleFeatures::Point.from_x_y(4.67,45.4,256),GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7,12.45],[67.55,54]],256)],256))
34
+ expect(geometry_collection1).to eq(GeoRuby::SimpleFeatures::GeometryCollection.from_geometries([GeoRuby::SimpleFeatures::Point.from_x_y(4.67, 45.4, 256), GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7, 12.45], [67.55, 54]], 256)], 256))
35
35
  expect(geometry_collection2).not_to eq(geometry_collection1)
36
36
  expect(line_string).not_to eq(geometry_collection1)
37
37
  end
38
38
 
39
- it "test_geometry_collection_binary" do
40
- geometry_collection = GeoRuby::SimpleFeatures::GeometryCollection.from_geometries([GeoRuby::SimpleFeatures::Point.from_x_y(4.67,45.4,256),GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7,12.45],[67.55,54]],256)],256)
41
- expect(geometry_collection.as_hex_ewkb).to eql("010700002000010000020000000101000000AE47E17A14AE12403333333333B34640010200000002000000CDCCCCCCCCCC16406666666666E628403333333333E350400000000000004B40")
39
+ it 'test_geometry_collection_binary' do
40
+ geometry_collection = GeoRuby::SimpleFeatures::GeometryCollection.from_geometries([GeoRuby::SimpleFeatures::Point.from_x_y(4.67, 45.4, 256), GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7, 12.45], [67.55, 54]], 256)], 256)
41
+ expect(geometry_collection.as_hex_ewkb).to eql('010700002000010000020000000101000000AE47E17A14AE12403333333333B34640010200000002000000CDCCCCCCCCCC16406666666666E628403333333333E350400000000000004B40')
42
42
 
43
- geometry_collection = GeoRuby::SimpleFeatures::GeometryCollection.from_geometries([GeoRuby::SimpleFeatures::Point.from_x_y_z_m(4.67,45.4,45.67,2.3,256),GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7,12.45,4.56,98.3],[67.55,54,12.2,3.4]],256,true, true)],256,true, true)
44
- expect(geometry_collection.as_hex_ewkb).to eql("01070000E0000100000200000001010000C0AE47E17A14AE12403333333333B34640F6285C8FC2D54640666666666666024001020000C002000000CDCCCCCCCCCC16406666666666E628403D0AD7A3703D124033333333339358403333333333E350400000000000004B4066666666666628403333333333330B40")
43
+ geometry_collection = GeoRuby::SimpleFeatures::GeometryCollection.from_geometries([GeoRuby::SimpleFeatures::Point.from_x_y_z_m(4.67, 45.4, 45.67, 2.3, 256), GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7, 12.45, 4.56, 98.3], [67.55, 54, 12.2, 3.4]], 256, true, true)], 256, true, true)
44
+ expect(geometry_collection.as_hex_ewkb).to eql('01070000E0000100000200000001010000C0AE47E17A14AE12403333333333B34640F6285C8FC2D54640666666666666024001020000C002000000CDCCCCCCCCCC16406666666666E628403D0AD7A3703D124033333333339358403333333333E350400000000000004B4066666666666628403333333333330B40')
45
45
  end
46
46
 
47
- it "should test_geometry_collection_text" do
48
- geometry_collection = GeoRuby::SimpleFeatures::GeometryCollection.from_geometries([GeoRuby::SimpleFeatures::Point.from_x_y(4.67,45.4,256),GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7,12.45],[67.55,54]],256)],256)
49
- expect(geometry_collection.as_ewkt).to eql("SRID=256;GEOMETRYCOLLECTION(POINT(4.67 45.4),LINESTRING(5.7 12.45,67.55 54))")
47
+ it 'should test_geometry_collection_text' do
48
+ geometry_collection = GeoRuby::SimpleFeatures::GeometryCollection.from_geometries([GeoRuby::SimpleFeatures::Point.from_x_y(4.67, 45.4, 256), GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7, 12.45], [67.55, 54]], 256)], 256)
49
+ expect(geometry_collection.as_ewkt).to eql('SRID=256;GEOMETRYCOLLECTION(POINT(4.67 45.4),LINESTRING(5.7 12.45,67.55 54))')
50
50
 
51
- geometry_collection = GeoRuby::SimpleFeatures::GeometryCollection.from_geometries([GeoRuby::SimpleFeatures::Point.from_x_y_m(4.67,45.4,45.6,256),GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7,12.45,5.6],[67.55,54,6.7]],256,false,true)],256,false,true)
52
- expect(geometry_collection.as_ewkt).to eql("SRID=256;GEOMETRYCOLLECTIONM(POINTM(4.67 45.4 45.6),LINESTRINGM(5.7 12.45 5.6,67.55 54 6.7))")
51
+ geometry_collection = GeoRuby::SimpleFeatures::GeometryCollection.from_geometries([GeoRuby::SimpleFeatures::Point.from_x_y_m(4.67, 45.4, 45.6, 256), GeoRuby::SimpleFeatures::LineString.from_coordinates([[5.7, 12.45, 5.6], [67.55, 54, 6.7]], 256, false, true)], 256, false, true)
52
+ expect(geometry_collection.as_ewkt).to eql('SRID=256;GEOMETRYCOLLECTIONM(POINTM(4.67 45.4 45.6),LINESTRINGM(5.7 12.45 5.6,67.55 54 6.7))')
53
53
  end
54
54
 
55
55
  end
@@ -1,11 +1,11 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
3
  describe GeoRuby::SimpleFeatures::GeometryFactory do
4
- # before(:each) do
5
- # @po = GeoRuby::SimpleFeatures::MultiPolygon.new
6
- # end
4
+ # before(:each) do
5
+ # @po = GeoRuby::SimpleFeatures::MultiPolygon.new
6
+ # end
7
7
 
8
- #it "should f" do
8
+ # it "should f" do
9
9
  # violated
10
- #end
10
+ # end
11
11
  end
@@ -4,32 +4,32 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
4
4
 
5
5
  describe GeoRuby::SimpleFeatures::Geometry do
6
6
 
7
- it "should instantiate" do
7
+ it 'should instantiate' do
8
8
  violated unless subject
9
9
  end
10
10
 
11
- it "should have a default srid" do
12
- expect(subject.srid).to eql(4326) #Geometry.default_srid)
11
+ it 'should have a default srid' do
12
+ expect(subject.srid).to eql(4326) # Geometry.default_srid)
13
13
  end
14
14
 
15
- it "should change srid" do
15
+ it 'should change srid' do
16
16
  geo = GeoRuby::SimpleFeatures::Geometry.new(225)
17
17
  expect(geo.srid).to eql(225)
18
18
  end
19
19
 
20
- it "should instantiate from hex ewkb" do
21
- point = GeoRuby::SimpleFeatures::Geometry.from_hex_ewkb("01010000207B000000CDCCCCCCCCCC28406666666666A64640")
20
+ it 'should instantiate from hex ewkb' do
21
+ point = GeoRuby::SimpleFeatures::Geometry.from_hex_ewkb('01010000207B000000CDCCCCCCCCCC28406666666666A64640')
22
22
  expect(point.class).to eq(GeoRuby::SimpleFeatures::Point)
23
23
  expect(point.x).to be_within(0.1).of(12.4)
24
24
  end
25
25
 
26
- it "should output as_ewkb" do
26
+ it 'should output as_ewkb' do
27
27
  allow(subject).to receive(:binary_geometry_type).and_return(1)
28
28
  allow(subject).to receive(:binary_representation).and_return(1)
29
29
  expect(subject.as_ewkb).to eql("\001\001\000\000 \346\020\000\000\001")
30
30
  end
31
31
 
32
- it "should output as_ewkb (utf8 issue)" do
32
+ it 'should output as_ewkb (utf8 issue)' do
33
33
  allow(subject).to receive(:binary_geometry_type).and_return(1)
34
34
  allow(subject).to receive(:binary_representation).and_return(1)
35
35
  expect(subject.as_ewkb).to eql("\x01\x01\x00\x00 \xE6\x10\x00\x00\x01")
@@ -2,12 +2,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
3
  module LineSpecHelper
4
4
  def mock_points(num)
5
- # @point = mock(GeoRuby::SimpleFeatures::Point, :x => 1.0, :y => 2.0)
6
- Array.new(num) { |i| mock_point(i,i) }
5
+ # @point = mock(GeoRuby::SimpleFeatures::Point, :x => 1.0, :y => 2.0)
6
+ Array.new(num) { |i| mock_point(i, i) }
7
7
  end
8
8
 
9
- def mock_point(x=1, y=2)
10
- double(GeoRuby::SimpleFeatures::Point, :x => x, :y => y, :text_representation => "#{x} #{y}", :to_coordinates => [x, y])
9
+ def mock_point(x = 1, y = 2)
10
+ double(GeoRuby::SimpleFeatures::Point, x: x, y: y, text_representation: "#{x} #{y}", to_coordinates: [x, y])
11
11
  end
12
12
  end
13
13
 
@@ -15,250 +15,250 @@ describe GeoRuby::SimpleFeatures::LineString do
15
15
 
16
16
  include LineSpecHelper
17
17
 
18
- describe "Instance Methods" do
18
+ describe 'Instance Methods' do
19
19
 
20
20
  let(:line) { GeoRuby::SimpleFeatures::LineString.from_points([double(GeoRuby::SimpleFeatures::Point)]) }
21
21
 
22
- it "should instantiate" do
22
+ it 'should instantiate' do
23
23
  violated unless line
24
24
  end
25
25
 
26
- it "should have binary_geometry_type 2" do
26
+ it 'should have binary_geometry_type 2' do
27
27
  expect(line.binary_geometry_type).to eql(2)
28
28
  end
29
29
 
30
- it "should have text_geometry_type" do
31
- expect(line.text_geometry_type).to eql("LINESTRING")
30
+ it 'should have text_geometry_type' do
31
+ expect(line.text_geometry_type).to eql('LINESTRING')
32
32
  end
33
33
 
34
- it "should have a points array" do
34
+ it 'should have a points array' do
35
35
  expect(line.points).to be_instance_of(Array)
36
36
  end
37
37
 
38
38
  end
39
39
 
40
- describe "Valid GeoRuby::SimpleFeatures::LineString" do
40
+ describe 'Valid GeoRuby::SimpleFeatures::LineString' do
41
41
 
42
- let(:line) { GeoRuby::SimpleFeatures::LineString.from_points([GeoRuby::SimpleFeatures::Point.xy(1,1), GeoRuby::SimpleFeatures::Point.xy(2,2), GeoRuby::SimpleFeatures::Point.xy(3,3)]) }
42
+ let(:line) { GeoRuby::SimpleFeatures::LineString.from_points([GeoRuby::SimpleFeatures::Point.xy(1, 1), GeoRuby::SimpleFeatures::Point.xy(2, 2), GeoRuby::SimpleFeatures::Point.xy(3, 3)]) }
43
43
 
44
- it "should check orientation" do
44
+ it 'should check orientation' do
45
45
  expect(line).not_to be_clockwise
46
46
  end
47
47
 
48
- it "should check orientation" do
49
- l = GeoRuby::SimpleFeatures::LineString.from_points([GeoRuby::SimpleFeatures::Point.from_x_y(20,20), GeoRuby::SimpleFeatures::Point.from_x_y(10,10), GeoRuby::SimpleFeatures::Point.from_x_y(-10,10)])
48
+ it 'should check orientation' do
49
+ l = GeoRuby::SimpleFeatures::LineString.from_points([GeoRuby::SimpleFeatures::Point.from_x_y(20, 20), GeoRuby::SimpleFeatures::Point.from_x_y(10, 10), GeoRuby::SimpleFeatures::Point.from_x_y(-10, 10)])
50
50
  expect(l).to be_clockwise
51
51
  end
52
52
 
53
53
  end
54
54
 
55
- describe "tu converted" do
55
+ describe 'tu converted' do
56
56
 
57
- it "should concat points" do
58
- line_string = GeoRuby::SimpleFeatures::LineString::new
59
- line_string.concat([GeoRuby::SimpleFeatures::Point.from_x_y(12.4,45.3),GeoRuby::SimpleFeatures::Point.from_x_y(45.4,41.6)])
57
+ it 'should concat points' do
58
+ line_string = GeoRuby::SimpleFeatures::LineString.new
59
+ line_string.concat([GeoRuby::SimpleFeatures::Point.from_x_y(12.4, 45.3), GeoRuby::SimpleFeatures::Point.from_x_y(45.4, 41.6)])
60
60
 
61
61
  expect(line_string.length).to eql(2)
62
- expect(line_string[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(12.4,45.3))
62
+ expect(line_string[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(12.4, 45.3))
63
63
 
64
- point=GeoRuby::SimpleFeatures::Point.from_x_y(123,45.8777)
65
- line_string[0]=point
64
+ point = GeoRuby::SimpleFeatures::Point.from_x_y(123, 45.8777)
65
+ line_string[0] = point
66
66
  expect(line_string[0]).to eq(point)
67
67
 
68
- points=[GeoRuby::SimpleFeatures::Point.from_x_y(123,45.8777),GeoRuby::SimpleFeatures::Point.from_x_y(45.4,41.6)]
69
- line_string.each_index {|i| expect(line_string[i]).to eq(points[i]) }
68
+ points = [GeoRuby::SimpleFeatures::Point.from_x_y(123, 45.8777), GeoRuby::SimpleFeatures::Point.from_x_y(45.4, 41.6)]
69
+ line_string.each_index { |i| expect(line_string[i]).to eq(points[i]) }
70
70
 
71
- point=GeoRuby::SimpleFeatures::Point.from_x_y(22.4,13.56)
71
+ point = GeoRuby::SimpleFeatures::Point.from_x_y(22.4, 13.56)
72
72
  line_string << point
73
73
  expect(line_string.length).to eql(3)
74
74
  expect(line_string[2]).to eql(point)
75
75
  end
76
76
 
77
- it "should create" do
78
- line_string = GeoRuby::SimpleFeatures::LineString.from_points([GeoRuby::SimpleFeatures::Point.from_x_y(12.4,-45.3),GeoRuby::SimpleFeatures::Point.from_x_y(45.4,41.6)],123)
77
+ it 'should create' do
78
+ line_string = GeoRuby::SimpleFeatures::LineString.from_points([GeoRuby::SimpleFeatures::Point.from_x_y(12.4, -45.3), GeoRuby::SimpleFeatures::Point.from_x_y(45.4, 41.6)], 123)
79
79
  expect(line_string.class).to eql(GeoRuby::SimpleFeatures::LineString)
80
80
  expect(line_string.length).to eql(2)
81
- expect(line_string[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(12.4,-45.3))
82
- expect(line_string[1]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(45.4,41.6))
81
+ expect(line_string[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(12.4, -45.3))
82
+ expect(line_string[1]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(45.4, 41.6))
83
83
 
84
- line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4,-45.3],[45.4,41.6],[4.456,1.0698]],123)
84
+ line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4, -45.3], [45.4, 41.6], [4.456, 1.0698]], 123)
85
85
  expect(line_string.class).to eql(GeoRuby::SimpleFeatures::LineString)
86
86
  expect(line_string.length).to eql(3)
87
- expect(line_string[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(12.4,-45.3))
88
- expect(line_string[1]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(45.4,41.6))
87
+ expect(line_string[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(12.4, -45.3))
88
+ expect(line_string[1]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(45.4, 41.6))
89
89
 
90
- line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4,-45.3,123],[45.4,41.6,333],[4.456,1.0698,987]],123,true)
90
+ line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4, -45.3, 123], [45.4, 41.6, 333], [4.456, 1.0698, 987]], 123, true)
91
91
  expect(line_string.class).to eql(GeoRuby::SimpleFeatures::LineString)
92
92
  expect(line_string.length).to eql(3)
93
- expect(line_string[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y_z(12.4,-45.3,123,123))
93
+ expect(line_string[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y_z(12.4, -45.3, 123, 123))
94
94
 
95
- line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4,-45.3,123],[45.4,41.6,333],[4.456,1.0698,987]],123,true)
95
+ line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4, -45.3, 123], [45.4, 41.6, 333], [4.456, 1.0698, 987]], 123, true)
96
96
  expect(line_string.class).to eql(GeoRuby::SimpleFeatures::LineString)
97
97
  expect(line_string.length).to eql(3)
98
- expect(line_string[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y_z(12.4,-45.3,123,123))
98
+ expect(line_string[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y_z(12.4, -45.3, 123, 123))
99
99
  end
100
100
 
101
- it "should bbox it" do
102
- bbox = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4,-45.3,123],[45.4,41.6,333],[4.456,1.0698,987]],123,true).bounding_box
101
+ it 'should bbox it' do
102
+ bbox = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4, -45.3, 123], [45.4, 41.6, 333], [4.456, 1.0698, 987]], 123, true).bounding_box
103
103
  expect(bbox.length).to eql(2)
104
- expect(bbox[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y_z(4.456,-45.3,123))
105
- expect(bbox[1]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y_z(45.4,41.6,987))
104
+ expect(bbox[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y_z(4.456, -45.3, 123))
105
+ expect(bbox[1]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y_z(45.4, 41.6, 987))
106
106
  end
107
107
 
108
- it "should test_line_string_equal" do
109
- line_string1 = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4,-45.3],[45.4,41.6],[4.456,1.0698]],123)
110
- line_string2 = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4,-45.3],[45.4,41.6]],123)
111
- point = GeoRuby::SimpleFeatures::Point.from_x_y(12.4,-45.3,123)
108
+ it 'should test_line_string_equal' do
109
+ line_string1 = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4, -45.3], [45.4, 41.6], [4.456, 1.0698]], 123)
110
+ line_string2 = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4, -45.3], [45.4, 41.6]], 123)
111
+ point = GeoRuby::SimpleFeatures::Point.from_x_y(12.4, -45.3, 123)
112
112
 
113
- expect(line_string1).to eq(GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4,-45.3],[45.4,41.6],[4.456,1.0698]],123))
113
+ expect(line_string1).to eq(GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4, -45.3], [45.4, 41.6], [4.456, 1.0698]], 123))
114
114
  expect(line_string1).not_to eq(line_string2)
115
115
  expect(line_string1).not_to eq(point)
116
116
  end
117
117
 
118
- it "should test_line_string_binary" do
119
- line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4,-45.3],[45.4,41.6]],256)
120
- expect(line_string.as_hex_ewkb).to eql("01020000200001000002000000CDCCCCCCCCCC28406666666666A646C03333333333B34640CDCCCCCCCCCC4440")
118
+ it 'should test_line_string_binary' do
119
+ line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4, -45.3], [45.4, 41.6]], 256)
120
+ expect(line_string.as_hex_ewkb).to eql('01020000200001000002000000CDCCCCCCCCCC28406666666666A646C03333333333B34640CDCCCCCCCCCC4440')
121
121
 
122
- line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4,-45.3,35.3],[45.4,41.6,12.3]],256,true)
123
- expect(line_string.as_hex_ewkb).to eql("01020000A00001000002000000CDCCCCCCCCCC28406666666666A646C06666666666A641403333333333B34640CDCCCCCCCCCC44409A99999999992840")
122
+ line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4, -45.3, 35.3], [45.4, 41.6, 12.3]], 256, true)
123
+ expect(line_string.as_hex_ewkb).to eql('01020000A00001000002000000CDCCCCCCCCCC28406666666666A646C06666666666A641403333333333B34640CDCCCCCCCCCC44409A99999999992840')
124
124
 
125
- line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4,-45.3,35.3,45.1],[45.4,41.6,12.3,40.23]],256,true,true)
126
- expect(line_string.as_hex_ewkb).to eql("01020000E00001000002000000CDCCCCCCCCCC28406666666666A646C06666666666A64140CDCCCCCCCC8C46403333333333B34640CDCCCCCCCCCC44409A999999999928403D0AD7A3701D4440")
125
+ line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4, -45.3, 35.3, 45.1], [45.4, 41.6, 12.3, 40.23]], 256, true, true)
126
+ expect(line_string.as_hex_ewkb).to eql('01020000E00001000002000000CDCCCCCCCCCC28406666666666A646C06666666666A64140CDCCCCCCCC8C46403333333333B34640CDCCCCCCCCCC44409A999999999928403D0AD7A3701D4440')
127
127
  end
128
128
 
129
- it "test_line_string_text" do
130
- line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4,-45.3],[45.4,41.6]],256)
131
- expect(line_string.as_ewkt).to eql("SRID=256;LINESTRING(12.4 -45.3,45.4 41.6)")
129
+ it 'test_line_string_text' do
130
+ line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4, -45.3], [45.4, 41.6]], 256)
131
+ expect(line_string.as_ewkt).to eql('SRID=256;LINESTRING(12.4 -45.3,45.4 41.6)')
132
132
 
133
- line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4,-45.3,35.3],[45.4,41.6,12.3]],256,true)
134
- expect(line_string.as_ewkt).to eql("SRID=256;LINESTRING(12.4 -45.3 35.3,45.4 41.6 12.3)")
133
+ line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4, -45.3, 35.3], [45.4, 41.6, 12.3]], 256, true)
134
+ expect(line_string.as_ewkt).to eql('SRID=256;LINESTRING(12.4 -45.3 35.3,45.4 41.6 12.3)')
135
135
 
136
- line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4,-45.3,35.3],[45.4,41.6,12.3]],256,false,true)
137
- expect(line_string.as_ewkt).to eql("SRID=256;LINESTRINGM(12.4 -45.3 35.3,45.4 41.6 12.3)")
136
+ line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4, -45.3, 35.3], [45.4, 41.6, 12.3]], 256, false, true)
137
+ expect(line_string.as_ewkt).to eql('SRID=256;LINESTRINGM(12.4 -45.3 35.3,45.4 41.6 12.3)')
138
138
 
139
- line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4,-45.3,35.3,25.2],[45.4,41.6,12.3,13.75]],256,true,true)
140
- expect(line_string.as_ewkt).to eql("SRID=256;LINESTRING(12.4 -45.3 35.3 25.2,45.4 41.6 12.3 13.75)")
139
+ line_string = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12.4, -45.3, 35.3, 25.2], [45.4, 41.6, 12.3, 13.75]], 256, true, true)
140
+ expect(line_string.as_ewkt).to eql('SRID=256;LINESTRING(12.4 -45.3 35.3 25.2,45.4 41.6 12.3 13.75)')
141
141
  end
142
142
 
143
- it "should test_linear_ring_creation" do
144
- #testing just the constructor helpers since the rest is the same as for line_string
145
- linear_ring = GeoRuby::SimpleFeatures::LinearRing.from_coordinates([[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],345)
143
+ it 'should test_linear_ring_creation' do
144
+ # testing just the constructor helpers since the rest is the same as for line_string
145
+ linear_ring = GeoRuby::SimpleFeatures::LinearRing.from_coordinates([[12.4, -45.3], [45.4, 41.6], [4.456, 1.0698], [12.4, -45.3]], 345)
146
146
  expect(linear_ring.class).to eql(GeoRuby::SimpleFeatures::LinearRing)
147
147
  expect(linear_ring.length).to eql(4)
148
148
  expect(linear_ring).to be_closed
149
- expect(linear_ring[1]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(45.4,41.6,345))
149
+ expect(linear_ring[1]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(45.4, 41.6, 345))
150
150
  end
151
151
  end
152
152
 
153
- describe "> Coordinates" do
153
+ describe '> Coordinates' do
154
154
 
155
155
  before(:each) do
156
- expect(GeoRuby::SimpleFeatures::Point).to receive(:from_coordinates).
157
- exactly(4).with(anything, 4326, false, false).and_return(mock_point)
158
- @line = GeoRuby::SimpleFeatures::LineString.from_coordinates([1.2,2.5,2.2,4.5])
156
+ expect(GeoRuby::SimpleFeatures::Point).to receive(:from_coordinates)
157
+ .exactly(4).with(anything, 4326, false, false).and_return(mock_point)
158
+ @line = GeoRuby::SimpleFeatures::LineString.from_coordinates([1.2, 2.5, 2.2, 4.5])
159
159
  end
160
160
 
161
- it "should instantiate from coordinates" do
161
+ it 'should instantiate from coordinates' do
162
162
  expect(@line.points.length).to eql(4)
163
163
  end
164
164
 
165
165
  end
166
166
 
167
- describe "> Instantiated" do
167
+ describe '> Instantiated' do
168
168
 
169
169
  let (:line) { GeoRuby::SimpleFeatures::LineString.from_points(mock_points(7)) }
170
170
 
171
- it "should be closed if the last point equals the first" do
171
+ it 'should be closed if the last point equals the first' do
172
172
  line.push(line.first)
173
173
  expect(line).to be_closed
174
174
  expect(line.length).to eql(8)
175
175
  end
176
176
 
177
- it "should print the text representation" do
178
- expect(line.text_representation).to eql("0 0,1 1,2 2,3 3,4 4,5 5,6 6")
177
+ it 'should print the text representation' do
178
+ expect(line.text_representation).to eql('0 0,1 1,2 2,3 3,4 4,5 5,6 6')
179
179
  end
180
180
 
181
- it "should print the georss_simple_representation" do
182
- expect(line.georss_simple_representation({:geom_attr => nil})).
183
- to eql("<georss:line>0 0 1 1 2 2 3 3 4 4 5 5 6 6</georss:line>\n")
181
+ it 'should print the georss_simple_representation' do
182
+ expect(line.georss_simple_representation(geom_attr: nil))
183
+ .to eql("<georss:line>0 0 1 1 2 2 3 3 4 4 5 5 6 6</georss:line>\n")
184
184
  end
185
185
 
186
- it "should map the georss_poslist" do
187
- expect(line.georss_poslist).to eql("0 0 1 1 2 2 3 3 4 4 5 5 6 6")
186
+ it 'should map the georss_poslist' do
187
+ expect(line.georss_poslist).to eql('0 0 1 1 2 2 3 3 4 4 5 5 6 6')
188
188
  end
189
189
 
190
- it "should print the kml_representation" do
191
- expect(line.kml_representation).
192
- to eql("<LineString>\n<coordinates>0,0 1,1 2,2 3,3 4,4 5,5 6,6</coordinates>\n</LineString>\n")
190
+ it 'should print the kml_representation' do
191
+ expect(line.kml_representation)
192
+ .to eql("<LineString>\n<coordinates>0,0 1,1 2,2 3,3 4,4 5,5 6,6</coordinates>\n</LineString>\n")
193
193
  end
194
194
 
195
- it "should print the kml_poslist without reverse or z" do
196
- expect(line.kml_poslist({})).to eql("0,0 1,1 2,2 3,3 4,4 5,5 6,6")
195
+ it 'should print the kml_poslist without reverse or z' do
196
+ expect(line.kml_poslist({})).to eql('0,0 1,1 2,2 3,3 4,4 5,5 6,6')
197
197
  end
198
198
 
199
- it "should print the kml_poslist reverse" do
200
- expect(line.kml_poslist({:reverse => true})).to eql("6,6 5,5 4,4 3,3 2,2 1,1 0,0")
199
+ it 'should print the kml_poslist reverse' do
200
+ expect(line.kml_poslist(reverse: true)).to eql('6,6 5,5 4,4 3,3 2,2 1,1 0,0')
201
201
  end
202
202
 
203
- it "should print out nicely as json/geojson" do
204
- expect(line.as_json).to eql({:type=>"LineString", :coordinates=>[[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]]})
203
+ it 'should print out nicely as json/geojson' do
204
+ expect(line.as_json).to eql(type: 'LineString', coordinates: [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]])
205
205
  end
206
206
 
207
- it "should print out nicely to json/geojson" do
207
+ it 'should print out nicely to json/geojson' do
208
208
  expect(line.to_json).to eql("{\"type\":\"LineString\",\"coordinates\":[[0,0],[1,1],[2,2],[3,3],[4,4],[5,5],[6,6]]}")
209
209
  end
210
210
 
211
211
  end
212
212
 
213
- describe "> Distances..." do
213
+ describe '> Distances...' do
214
214
  before(:each) do
215
215
  @p1 = double(GeoRuby::SimpleFeatures::Point)
216
216
  @p2 = double(GeoRuby::SimpleFeatures::Point)
217
217
  @p3 = double(GeoRuby::SimpleFeatures::Point)
218
- @line = GeoRuby::SimpleFeatures::LineString.from_points([@p1,@p2,@p3])
218
+ @line = GeoRuby::SimpleFeatures::LineString.from_points([@p1, @p2, @p3])
219
219
  end
220
220
 
221
- it "should print the length with haversine" do
221
+ it 'should print the length with haversine' do
222
222
  expect(@p1).to receive(:spherical_distance).with(@p2).and_return(10)
223
223
  expect(@p2).to receive(:spherical_distance).with(@p3).and_return(10)
224
224
  expect(@line.spherical_distance).to eql(20)
225
225
  end
226
226
 
227
- it "should print lenght as euclidian" do
227
+ it 'should print lenght as euclidian' do
228
228
  expect(@p1).to receive(:euclidian_distance).with(@p2).and_return(10)
229
229
  expect(@p2).to receive(:euclidian_distance).with(@p3).and_return(10)
230
230
  expect(@line.euclidian_distance).to eql(20)
231
231
  end
232
232
  end
233
233
 
234
- describe "Simplify" do
234
+ describe 'Simplify' do
235
235
 
236
- let(:line) { GeoRuby::SimpleFeatures::LineString.from_coordinates([[6,0],[4,1],[3,4],[4,6],[5,8],[5,9],[4,10],[6,15]], 4326) }
236
+ let(:line) { GeoRuby::SimpleFeatures::LineString.from_coordinates([[6, 0], [4, 1], [3, 4], [4, 6], [5, 8], [5, 9], [4, 10], [6, 15]], 4326) }
237
237
 
238
- it "should simplify a simple linestring" do
239
- line = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12,15],[14,17],[17, 20]], 4326)
238
+ it 'should simplify a simple linestring' do
239
+ line = GeoRuby::SimpleFeatures::LineString.from_coordinates([[12, 15], [14, 17], [17, 20]], 4326)
240
240
  expect(line.simplify.points.size).to eq(2)
241
241
  end
242
242
 
243
- it "should simplify a harder linestring" do
243
+ it 'should simplify a harder linestring' do
244
244
  expect(line.simplify(6).points.size).to eq(6)
245
245
  expect(line.simplify(9).size).to eq(4)
246
246
  expect(line.simplify(10).size).to eq(3)
247
247
  end
248
248
 
249
- it "should barely touch it" do
249
+ it 'should barely touch it' do
250
250
  expect(line.simplify(1).points.size).to eq(7)
251
251
  end
252
252
 
253
- it "should simplify to five points" do
253
+ it 'should simplify to five points' do
254
254
  expect(line.simplify(7).points.size).to eq(5)
255
255
  end
256
256
 
257
- it "should flatten it" do
257
+ it 'should flatten it' do
258
258
  expect(line.simplify(11).points.size).to eq(2)
259
259
  end
260
260
 
261
- it "should be the first and last in a flatten" do
261
+ it 'should be the first and last in a flatten' do
262
262
  l = line.simplify(11)
263
263
  expect(l[0]).to be_a_point(6, 0)
264
264
  expect(l[1]).to be_a_point(6, 15)