gpx 0.5 → 0.6

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.
@@ -1,8 +1,8 @@
1
1
  <?xml version="1.0"?>
2
- <gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/1" version="1.1" creator="GPX RubyGem 0.1 Copyright 2006 Doug Fales -- http://walkingboss.com" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
2
+ <gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/1" version="1.1" creator="GPX RubyGem 0.6 Copyright 2006-2009 Doug Fales -- http://gpx.rubyforge.org/" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
3
3
  <metadata>
4
4
  <name>new_gpx_file_from_scratch.gpx</name>
5
- <time>2009-07-06T20:37:26-06:00</time>
5
+ <time>2010-02-28T08:35:34-07:00</time>
6
6
  <bounds minlat="90.0" minlon="180.0" maxlat="-90.0" maxlon="-180.0"/>
7
7
  </metadata>
8
8
  <trk>
@@ -1,10 +1,15 @@
1
1
  require 'test/unit'
2
+ require 'fileutils'
2
3
  require File.dirname(__FILE__) + '/../lib/gpx'
3
4
 
4
5
  class OutputTest < Test::Unit::TestCase
5
6
 
6
7
  include GPX
7
8
 
9
+ def setup
10
+ FileUtils.mkdir_p(File.join(File.dirname(__FILE__), "output"))
11
+ end
12
+
8
13
  def test_new_gpx_file_from_scratch
9
14
  gpx_file = GPXFile.new
10
15
 
@@ -25,24 +30,24 @@ class OutputTest < Test::Unit::TestCase
25
30
 
26
31
  track_point_data.each do |trk_pt_hash|
27
32
  segment.points << TrackPoint.new(trk_pt_hash)
28
- end
33
+ end
29
34
 
30
35
  track.segments << segment
31
36
  gpx_file.tracks << track
32
37
 
33
38
  waypoint_data = [
34
39
  {:lat => 39.997298, :lon => -105.292674, :name => 'GRG-CA', :sym => 'Waypoint', :elevation => 1766.535},
35
- {:lat => 33.330190, :lon => -111.946110, :name => 'GRMPHX', :sym => 'Waypoint', :elevation => 361.0981,
40
+ {:lat => 33.330190, :lon => -111.946110, :name => 'GRMPHX', :sym => 'Waypoint', :elevation => 361.0981,
36
41
  :cmt => "Hey here's a comment.", :desc => "Somewhere in my backyard.", :fix => '3d', :sat => "8", :hdop => "50.5", :vdop => "6.8", :pdop => "7.6"},
37
- {:lat => 25.061783, :lon => 121.640267, :name => 'GRMTWN', :sym => 'Waypoint', :elevation => 38.09766},
38
- {:lat => 39.999840, :lon => -105.214696, :name => 'SBDR', :sym => 'Waypoint', :elevation => 1612.965},
39
- {:lat => 39.989739, :lon => -105.295285, :name => 'TO', :sym => 'Waypoint', :elevation => 2163.556},
40
- {:lat => 40.035301, :lon => -105.254443, :name => 'VICS', :sym => 'Waypoint', :elevation => 1535.34}
41
- ]
42
+ {:lat => 25.061783, :lon => 121.640267, :name => 'GRMTWN', :sym => 'Waypoint', :elevation => 38.09766},
43
+ {:lat => 39.999840, :lon => -105.214696, :name => 'SBDR', :sym => 'Waypoint', :elevation => 1612.965},
44
+ {:lat => 39.989739, :lon => -105.295285, :name => 'TO', :sym => 'Waypoint', :elevation => 2163.556},
45
+ {:lat => 40.035301, :lon => -105.254443, :name => 'VICS', :sym => 'Waypoint', :elevation => 1535.34}
46
+ ]
42
47
 
43
48
  waypoint_data.each do |wpt_hash|
44
49
  gpx_file.waypoints << Waypoint.new(wpt_hash)
45
- end
50
+ end
46
51
 
47
52
  route_point_data = [
48
53
  {:lat => 40.035467, :lon =>-105.254366, :time => Time.parse("2005-12-31T22:02:29Z"), :elevation => 1735.798},
@@ -52,7 +57,7 @@ class OutputTest < Test::Unit::TestCase
52
57
  route = Route.new()
53
58
  route_point_data.each do |rte_pt_hash|
54
59
  route.points << Point.new(rte_pt_hash)
55
- end
60
+ end
56
61
 
57
62
  gpx_file.routes << route
58
63
 
@@ -73,19 +78,19 @@ class OutputTest < Test::Unit::TestCase
73
78
  trk_pt_hash.each do |key, value|
74
79
  assert_equal(value, written_segment.points[index].send(key))
75
80
  end
76
- end
81
+ end
77
82
 
78
83
 
79
84
 
80
85
  # Make sure the one route has the attributes we initialized it with
81
86
  assert_equal(1, written_gpx_file.routes.size)
82
- written_route = written_gpx_file.routes[0]
87
+ written_route = written_gpx_file.routes[0]
83
88
  assert_equal(route_point_data.size, written_route.points.size)
84
89
  route_point_data.each_with_index do |rte_pt_hash, index|
85
90
  rte_pt_hash.each do |key, value|
86
91
  assert_equal(value, written_route.points[index].send(key))
87
92
  end
88
- end
93
+ end
89
94
 
90
95
  # Make sure the waypoints have all of the attributes we initialized them with
91
96
  written_waypoints = written_gpx_file.waypoints
@@ -93,7 +98,7 @@ class OutputTest < Test::Unit::TestCase
93
98
  waypoint_data.each_with_index do |wpt_hash, index|
94
99
  wpt_hash.each do |key, value|
95
100
  assert_equal(value, written_waypoints[index].send(key.to_s), key)
96
- end
101
+ end
97
102
  end
98
103
 
99
104
  expected_value = sprintf(THE_WORKS, gpx_file.time.xmlschema)
@@ -109,6 +114,6 @@ class OutputTest < Test::Unit::TestCase
109
114
  File.join(File.dirname(__FILE__), "output/#{test_name}.gpx")
110
115
  end
111
116
 
112
- THE_WORKS = "<?xml version=\"1.0\"?>\n<gpx xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.topografix.com/GPX/1/1\" version=\"1.1\" creator=\"GPX RubyGem 0.1 Copyright 2006 Doug Fales -- http://walkingboss.com\" xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd\">\n <metadata>\n <name>new_gpx_file_from_scratch.gpx</name>\n <time>%s</time>\n <bounds minlat=\"90.0\" minlon=\"180.0\" maxlat=\"-90.0\" maxlon=\"-180.0\"/>\n </metadata>\n <trk>\n <name/>\n <trkseg>\n <trkpt lat=\"40.036926\" lon=\"-105.253487\">\n <time>2005-12-31T22:01:24Z</time>\n <ele>1737.24</ele>\n </trkpt>\n <trkpt lat=\"40.036604\" lon=\"-105.253487\">\n <time>2005-12-31T22:02:01Z</time>\n <ele>1738.682</ele>\n </trkpt>\n <trkpt lat=\"40.036347\" lon=\"-105.25383\">\n <time>2005-12-31T22:02:08Z</time>\n <ele>1738.682</ele>\n </trkpt>\n <trkpt lat=\"40.035574\" lon=\"-105.254045\">\n <time>2005-12-31T22:02:20Z</time>\n <ele>1737.24</ele>\n </trkpt>\n <trkpt lat=\"40.035467\" lon=\"-105.254366\">\n <time>2005-12-31T22:02:29Z</time>\n <ele>1735.798</ele>\n </trkpt>\n <trkpt lat=\"40.035317\" lon=\"-105.254388\">\n <time>2005-12-31T22:02:33Z</time>\n <ele>1735.798</ele>\n </trkpt>\n <trkpt lat=\"40.035274\" lon=\"-105.254431\">\n <time>2005-12-31T22:02:49Z</time>\n <ele>1736.278</ele>\n </trkpt>\n <trkpt lat=\"40.035274\" lon=\"-105.254431\">\n <time>2005-12-31T22:02:54Z</time>\n <ele>1739.643</ele>\n </trkpt>\n <trkpt lat=\"40.035317\" lon=\"-105.254431\">\n <time>2005-12-31T22:05:08Z</time>\n <ele>1732.433</ele>\n </trkpt>\n <trkpt lat=\"40.035317\" lon=\"-105.254431\">\n <time>2005-12-31T22:05:09Z</time>\n <ele>1726.665</ele>\n </trkpt>\n </trkseg>\n </trk>\n <wpt lat=\"39.997298\" lon=\"-105.292674\">\n <name>GRG-CA</name>\n <sym>Waypoint</sym>\n <ele>1766.535</ele>\n </wpt>\n <wpt lat=\"33.33019\" lon=\"-111.94611\">\n <name>GRMPHX</name>\n <cmt>Hey here's a comment.</cmt>\n <desc>Somewhere in my backyard.</desc>\n <sym>Waypoint</sym>\n <fix>3d</fix>\n <sat>8</sat>\n <hdop>50.5</hdop>\n <vdop>6.8</vdop>\n <pdop>7.6</pdop>\n <ele>361.0981</ele>\n </wpt>\n <wpt lat=\"25.061783\" lon=\"121.640267\">\n <name>GRMTWN</name>\n <sym>Waypoint</sym>\n <ele>38.09766</ele>\n </wpt>\n <wpt lat=\"39.99984\" lon=\"-105.214696\">\n <name>SBDR</name>\n <sym>Waypoint</sym>\n <ele>1612.965</ele>\n </wpt>\n <wpt lat=\"39.989739\" lon=\"-105.295285\">\n <name>TO</name>\n <sym>Waypoint</sym>\n <ele>2163.556</ele>\n </wpt>\n <wpt lat=\"40.035301\" lon=\"-105.254443\">\n <name>VICS</name>\n <sym>Waypoint</sym>\n <ele>1535.34</ele>\n </wpt>\n <rte>\n <name/>\n <rtept lat=\"40.035467\" lon=\"-105.254366\">\n <time>2005-12-31T22:02:29Z</time>\n <ele>1735.798</ele>\n </rtept>\n <rtept lat=\"40.035317\" lon=\"-105.254388\">\n <time>2005-12-31T22:02:33Z</time>\n <ele>1735.798</ele>\n </rtept>\n <rtept lat=\"40.035274\" lon=\"-105.254431\">\n <time>2005-12-31T22:02:49Z</time>\n <ele>1736.278</ele>\n </rtept>\n </rte>\n</gpx>\n"
117
+ THE_WORKS = "<?xml version=\"1.0\"?>\n<gpx xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.topografix.com/GPX/1/1\" version=\"1.1\" creator=\"GPX RubyGem #{GPX::VERSION} Copyright 2006-2009 Doug Fales -- http://gpx.rubyforge.org/\" xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd\">\n <metadata>\n <name>new_gpx_file_from_scratch.gpx</name>\n <time>%s</time>\n <bounds minlat=\"90.0\" minlon=\"180.0\" maxlat=\"-90.0\" maxlon=\"-180.0\"/>\n </metadata>\n <trk>\n <name/>\n <trkseg>\n <trkpt lat=\"40.036926\" lon=\"-105.253487\">\n <time>2005-12-31T22:01:24Z</time>\n <ele>1737.24</ele>\n </trkpt>\n <trkpt lat=\"40.036604\" lon=\"-105.253487\">\n <time>2005-12-31T22:02:01Z</time>\n <ele>1738.682</ele>\n </trkpt>\n <trkpt lat=\"40.036347\" lon=\"-105.25383\">\n <time>2005-12-31T22:02:08Z</time>\n <ele>1738.682</ele>\n </trkpt>\n <trkpt lat=\"40.035574\" lon=\"-105.254045\">\n <time>2005-12-31T22:02:20Z</time>\n <ele>1737.24</ele>\n </trkpt>\n <trkpt lat=\"40.035467\" lon=\"-105.254366\">\n <time>2005-12-31T22:02:29Z</time>\n <ele>1735.798</ele>\n </trkpt>\n <trkpt lat=\"40.035317\" lon=\"-105.254388\">\n <time>2005-12-31T22:02:33Z</time>\n <ele>1735.798</ele>\n </trkpt>\n <trkpt lat=\"40.035274\" lon=\"-105.254431\">\n <time>2005-12-31T22:02:49Z</time>\n <ele>1736.278</ele>\n </trkpt>\n <trkpt lat=\"40.035274\" lon=\"-105.254431\">\n <time>2005-12-31T22:02:54Z</time>\n <ele>1739.643</ele>\n </trkpt>\n <trkpt lat=\"40.035317\" lon=\"-105.254431\">\n <time>2005-12-31T22:05:08Z</time>\n <ele>1732.433</ele>\n </trkpt>\n <trkpt lat=\"40.035317\" lon=\"-105.254431\">\n <time>2005-12-31T22:05:09Z</time>\n <ele>1726.665</ele>\n </trkpt>\n </trkseg>\n </trk>\n <wpt lat=\"39.997298\" lon=\"-105.292674\">\n <name>GRG-CA</name>\n <sym>Waypoint</sym>\n <ele>1766.535</ele>\n </wpt>\n <wpt lat=\"33.33019\" lon=\"-111.94611\">\n <name>GRMPHX</name>\n <cmt>Hey here's a comment.</cmt>\n <desc>Somewhere in my backyard.</desc>\n <sym>Waypoint</sym>\n <fix>3d</fix>\n <sat>8</sat>\n <hdop>50.5</hdop>\n <vdop>6.8</vdop>\n <pdop>7.6</pdop>\n <ele>361.0981</ele>\n </wpt>\n <wpt lat=\"25.061783\" lon=\"121.640267\">\n <name>GRMTWN</name>\n <sym>Waypoint</sym>\n <ele>38.09766</ele>\n </wpt>\n <wpt lat=\"39.99984\" lon=\"-105.214696\">\n <name>SBDR</name>\n <sym>Waypoint</sym>\n <ele>1612.965</ele>\n </wpt>\n <wpt lat=\"39.989739\" lon=\"-105.295285\">\n <name>TO</name>\n <sym>Waypoint</sym>\n <ele>2163.556</ele>\n </wpt>\n <wpt lat=\"40.035301\" lon=\"-105.254443\">\n <name>VICS</name>\n <sym>Waypoint</sym>\n <ele>1535.34</ele>\n </wpt>\n <rte>\n <name/>\n <rtept lat=\"40.035467\" lon=\"-105.254366\">\n <time>2005-12-31T22:02:29Z</time>\n <ele>1735.798</ele>\n </rtept>\n <rtept lat=\"40.035317\" lon=\"-105.254388\">\n <time>2005-12-31T22:02:33Z</time>\n <ele>1735.798</ele>\n </rtept>\n <rtept lat=\"40.035274\" lon=\"-105.254431\">\n <time>2005-12-31T22:02:49Z</time>\n <ele>1736.278</ele>\n </rtept>\n </rte>\n</gpx>\n"
113
118
 
114
119
  end
@@ -69,7 +69,7 @@ class TrackFileTest < Test::Unit::TestCase
69
69
  end
70
70
 
71
71
  def test_write
72
- @other_track_file.write("myoutput.gpx")
72
+ @other_track_file.write("tests/output/myoutput.gpx")
73
73
  end
74
74
 
75
75
  end
metadata CHANGED
@@ -1,19 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gpx
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.5"
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 6
8
+ version: "0.6"
5
9
  platform: ruby
6
10
  authors:
7
11
  - Doug Fales
8
- autorequire: gpx
12
+ autorequire:
9
13
  bindir: bin
10
14
  cert_chain: []
11
15
 
12
- date: 2009-07-06 00:00:00 -06:00
16
+ date: 2010-02-28 00:00:00 -07:00
13
17
  default_executable:
14
18
  dependencies: []
15
19
 
16
- description: " A basic API for reading and writing GPX files.\n"
20
+ description: A basic API for reading and writing GPX files.
17
21
  email: doug.fales@gmail.com
18
22
  executables: []
19
23
 
@@ -46,6 +50,7 @@ files:
46
50
  - tests/gpx_files/waypoints.gpx
47
51
  - tests/gpx_files/with_or_without_elev.gpx
48
52
  - tests/magellan_test.rb
53
+ - tests/output/myoutput.gpx
49
54
  - tests/output/new_gpx_file_from_scratch.gpx
50
55
  - tests/output_test.rb
51
56
  - tests/route_test.rb
@@ -55,9 +60,9 @@ files:
55
60
  - tests/waypoint_test.rb
56
61
  - ChangeLog
57
62
  - Rakefile
58
- - README
63
+ - README.rdoc
59
64
  has_rdoc: true
60
- homepage: http://gpx.rubyforge.com/
65
+ homepage: http://dougfales.github.com/gpx/
61
66
  licenses: []
62
67
 
63
68
  post_install_message:
@@ -69,18 +74,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
69
74
  requirements:
70
75
  - - ">="
71
76
  - !ruby/object:Gem::Version
77
+ segments:
78
+ - 0
72
79
  version: "0"
73
- version:
74
80
  required_rubygems_version: !ruby/object:Gem::Requirement
75
81
  requirements:
76
82
  - - ">="
77
83
  - !ruby/object:Gem::Version
84
+ segments:
85
+ - 0
78
86
  version: "0"
79
- version:
80
87
  requirements: []
81
88
 
82
- rubyforge_project:
83
- rubygems_version: 1.3.2
89
+ rubyforge_project: gpx
90
+ rubygems_version: 1.3.6
84
91
  signing_key:
85
92
  specification_version: 3
86
93
  summary: A basic API for reading and writing GPX files.