Updating Changelog and fixing some indentation in waypoint.rb.

master
Doug Fales 2010-02-28 08:41:58 -07:00
parent bc994b9fa2
commit 7cf19bfd70
2 changed files with 105 additions and 177 deletions

160
ChangeLog
View File

@ -1,132 +1,60 @@
2009-07-07 02:51 dougfales 2010-02-27 Doug Fales <doug@falesafeconsulting.com>
* Putting the gem building stuff into a gemspec.
* Fixing some tests since git does not believe in empty directories.
* Fixing README formatting.
* lib/gpx/gpx.rb: Revving to version 0.5. 2010-02-27 Doug Fales <doug@falesafeconsulting.com>
* README edits.
* More rdoc tweaks.
* Changing README to rdoc ext for github.
2009-07-07 02:43 dougfales 2009-10-13 Doug Fales <doug@falesafeconsulting.com>
* Adding the ability to write GPX to a string in addition to a file. Thanks to Douglas Robertson for the patch.
* README: Changing my contact email address. 2009-09-27 Doug Fales <doug@falesafeconsulting.com>
* Adding a patch from Douglas Robertson that allows using version 1.0 of the schema for output.
2009-07-07 02:41 dougfales 2009-07-07 Doug Fales <doug@falesafeconsulting.com>
* Adding changelog.
* Revving to version 0.5.
* Changing my contact email address.
* Patches from Tom Verbeure (mtbguru.com) to work with libxml-ruby 1.x.
* lib/gpx/gpx_file.rb, tests/gpx_file_test.rb, 2009-06-17 Doug Fales <doug@falesafeconsulting.com>
tests/gpx_files/with_or_without_elev.gpx: Patches from Tom * Patch from Kang-min Liu to support speed element.
Verbeure (mtbguru.com) to work with libxml-ruby 1.x.
2009-06-17 14:20 dougfales 2008-02-19 Doug Fales <doug@falesafeconsulting.com>
* Revving to 0.4.
* Adding some new unit tests and fixing several file export bugs reported by Jochen Topf. New unit tests also uncovered a bug where the number of trackpoints reported in a file was twice the actual number.
* lib/gpx/point.rb: Patch from Kang-min Liu to support speed 2008-02-11 Doug Fales <doug@falesafeconsulting.com>
element. * Going to version 0.3.
* Updating unit tests in light of recent fixes to routes and waypoints code.
2008-02-19 04:09 dougfales 2008-02-08 Doug Fales <doug@falesafeconsulting.com>
* Thanks to Mike Gauland for discovering some route- and waypoint-related bugs. I've fixed them and also added #to_s on Waypoint so it's easier to debug.
* lib/gpx/gpx.rb: Revving to 0.4. 2007-12-04 Doug Fales <doug@falesafeconsulting.com>
* Thanks to Christian Koerner for finding and fixing these bugs in the waypoint code.
* Another patch from Gaku Ueda. This one allows you to pass in a string of GPX data using the :gpx_date => option. Thanks Gaku!
2008-02-19 04:06 dougfales 2007-11-30 Doug Fales <doug@falesafeconsulting.com>
* Updating the version #.
* Updates courtesy of Gaku Ueda: * Adding support for GPX 1.0 as well as 1.1 (since libxml namespace parsing was hard-coded to 1.1. previously). * Adding a GPX 1.0 unit test file. * Miscellaneous updates to make it work with Ruby 1.8.6.
* lib/gpx/gpx.rb, lib/gpx/gpx_file.rb, lib/gpx/point.rb, 2006-12-04 Doug Fales <doug@falesafeconsulting.com>
lib/gpx/route.rb, lib/gpx/track.rb, lib/gpx/waypoint.rb, * First stab at using libxml-ruby instead of REXML. I'm seeing the unit tests finish in under 14 seconds. That is compared to 2 minutes using REXML.
tests/gpx_file_test.rb, tests/gpx_files, tests/gpx_files/big.gpx,
tests/output, tests/output_test.rb, tests/track_test.rb: Adding
some new unit tests and fixing several file export bugs reported
by Jochen Topf.
New unit tests also uncovered a bug where the number of
trackpoints reported in a file was twice the actual number.
2008-02-11 21:20 dougfales 2006-12-03 Doug Fales <doug@falesafeconsulting.com>
* Fixing more nil time exceptions.
* Fixing an exception in contains_time?.
* lib/gpx/gpx.rb: Going to version 0.3. 2006-11-28 Doug Fales <doug@falesafeconsulting.com>
* A couple of fixes to make the library comply with the different attribute names possible on the bounds element.
2008-02-11 21:13 dougfales 2006-10-28 Doug Fales <doug@falesafeconsulting.com>
* Fixing nil time bug.
* tests/gpx10_test.rb, tests/gpx_files/routes.gpx, 2006-10-14 Doug Fales <doug@falesafeconsulting.com>
tests/gpx_files/waypoints.gpx, tests/magellan_test.rb, * Initial import of gpx gem.
tests/route_test.rb, tests/segment_test.rb,
tests/track_file_test.rb, tests/track_test.rb,
tests/waypoint_test.rb: Updating unit tests in light of recent
fixes to routes and waypoints code.
2008-02-08 23:26 dougfales
* lib/gpx/gpx.rb, lib/gpx/point.rb, lib/gpx/route.rb,
lib/gpx/waypoint.rb: Thanks to Mike Gauland for discovering some
route- and waypoint-related bugs. I've fixed them and also added
#to_s on Waypoint so it's easier to debug.
2007-12-04 17:58 dougfales
* lib/gpx/waypoint.rb: Thanks to Christian Koerner for finding and
fixing these bugs in the waypoint
code.
2007-12-04 17:52 dougfales
* lib/gpx/gpx_file.rb, tests/gpx_file_test.rb: Another patch from
Gaku Ueda. This one allows you to pass in a string of GPX
data using the :gpx_date => option. Thanks Gaku!
2007-11-30 06:29 dougfales
* lib/gpx/gpx.rb: Updating the version #.
2007-11-30 06:26 dougfales
* lib/gpx/gpx.rb, lib/gpx/gpx_file.rb, lib/gpx/point.rb,
lib/gpx/route.rb, lib/gpx/segment.rb, lib/gpx/track.rb,
tests/gpx10_test.rb, tests/gpx_files/gpx10.gpx: Updates courtesy
of Gaku Ueda:
* Adding support for GPX 1.0 as well as 1.1 (since libxml
namespace parsing
was hard-coded to 1.1. previously).
* Adding a GPX 1.0 unit test file.
* Miscellaneous updates to make it work with Ruby 1.8.6.
2006-12-04 06:47 dougfales
* README, lib/gpx.rb, lib/gpx/bounds.rb, lib/gpx/gpx.rb,
lib/gpx/gpx_file.rb, lib/gpx/point.rb, lib/gpx/route.rb,
lib/gpx/segment.rb, lib/gpx/track.rb, lib/gpx/waypoint.rb,
tests/segment_test.rb: First stab at using libxml-ruby instead of
REXML. I'm seeing the unit tests
finish in under 14 seconds. That is compared to 2 minutes using
REXML.
2006-12-03 07:31 dougfales
* lib/gpx/point.rb, lib/gpx/segment.rb: Fixing more nil time
exceptions.
2006-12-03 06:59 dougfales
* lib/gpx/segment.rb: Fixing an exception in contains_time?.
2006-11-28 15:35 dougfales
* lib/gpx/bounds.rb, lib/gpx/gpx_file.rb: A couple of fixes to make
the library comply with the different attribute names
possible on the bounds element.
Formerly, a bounds element with a minlat or minLat attribute
(instead of
min_lat) would not be properly parsed. Now all three styles of
attribute name
are accepted.
2006-10-28 22:09 dougfales
* lib/gpx/segment.rb: Fixing nil time bug.
2006-10-14 13:20 dougfales
* ., README, Rakefile, bin, docs, lib, lib/gpx, lib/gpx.rb,
lib/gpx/bounds.rb, lib/gpx/gpx.rb, lib/gpx/gpx_file.rb,
lib/gpx/magellan_track_log.rb, lib/gpx/point.rb,
lib/gpx/route.rb, lib/gpx/segment.rb, lib/gpx/track.rb,
lib/gpx/trackpoint.rb, lib/gpx/waypoint.rb, tests,
tests/gpx_files, tests/gpx_files/arches.gpx,
tests/gpx_files/magellan_track.log,
tests/gpx_files/one_segment.gpx, tests/gpx_files/one_track.gpx,
tests/gpx_files/routes.gpx, tests/gpx_files/tracks.gpx,
tests/gpx_files/waypoints.gpx, tests/magellan_test.rb,
tests/segment_test.rb, tests/track_file_test.rb,
tests/track_test.rb: Initial import of gpx gem.

View File

@ -23,74 +23,74 @@
module GPX module GPX
# This class supports the concept of a waypoint. Beware that this class has # This class supports the concept of a waypoint. Beware that this class has
# not seen much use yet, since WalkingBoss does not use waypoints right now. # not seen much use yet, since WalkingBoss does not use waypoints right now.
class Waypoint < Point class Waypoint < Point
SUB_ELEMENTS = %w{ magvar geoidheight name cmt desc src link sym type fix sat hdop vdop pdop ageofdgpsdata dgpsid extensions } SUB_ELEMENTS = %w{ magvar geoidheight name cmt desc src link sym type fix sat hdop vdop pdop ageofdgpsdata dgpsid extensions }
attr_reader :gpx_file attr_reader :gpx_file
SUB_ELEMENTS.each { |sub_el| attr_accessor sub_el.to_sym } SUB_ELEMENTS.each { |sub_el| attr_accessor sub_el.to_sym }
# Not implemented # Not implemented
def crop(area) def crop(area)
end
# Not implemented
def delete_area(area)
end
# Initializes a waypoint from a XML::Node.
def initialize(opts = {})
if(opts[:element] and opts[:gpx_file])
wpt_elem = opts[:element]
@gpx_file = opts[:gpx_file]
super(:element => wpt_elem, :gpx_file => @gpx_file)
instantiate_with_text_elements(wpt_elem, SUB_ELEMENTS, @gpx_file.ns)
else
opts.each do |key, value|
assignment_method = "#{key}="
if self.respond_to?(assignment_method)
self.send(assignment_method, value)
end
end
end end
end
# Not implemented # Prints out a friendly summary of this track (sans points). Useful for
def delete_area(area) # debugging and sanity checks.
def to_s
result = "Waypoint \n"
result << "\tName: #{name}\n"
result << "\tLatitude: #{lat} \n"
result << "\tLongitude: #{lon} \n"
result << "\tElevation: #{elevation}\n "
result << "\tTime: #{time}\n"
SUB_ELEMENTS.each do |sub_element_attribute|
val = self.send(sub_element_attribute)
result << "\t#{sub_element_attribute}: #{val}\n" unless val.nil?
end end
result
end
# Initializes a waypoint from a XML::Node. # Converts a waypoint to a XML::Node.
def initialize(opts = {}) def to_xml(elem_name = 'wpt')
if(opts[:element] and opts[:gpx_file]) wpt = Node.new(elem_name)
wpt_elem = opts[:element] wpt['lat'] = lat.to_s
@gpx_file = opts[:gpx_file] wpt['lon'] = lon.to_s
super(:element => wpt_elem, :gpx_file => @gpx_file) SUB_ELEMENTS.each do |sub_element_name|
instantiate_with_text_elements(wpt_elem, SUB_ELEMENTS, @gpx_file.ns) if(self.respond_to?(sub_element_name) and (!self.send(sub_element_name).nil?))
else sub_elem_node = Node.new(sub_element_name)
opts.each do |key, value| sub_elem_node << self.send(sub_element_name)
assignment_method = "#{key}=" wpt << sub_elem_node
if self.respond_to?(assignment_method) end
self.send(assignment_method, value)
end
end
end
end end
unless(self.elevation.nil?)
# Prints out a friendly summary of this track (sans points). Useful for ele_node = Node.new('ele')
# debugging and sanity checks. ele_node << self.elevation
def to_s wpt << ele_node
result = "Waypoint \n"
result << "\tName: #{name}\n"
result << "\tLatitude: #{lat} \n"
result << "\tLongitude: #{lon} \n"
result << "\tElevation: #{elevation}\n "
result << "\tTime: #{time}\n"
SUB_ELEMENTS.each do |sub_element_attribute|
val = self.send(sub_element_attribute)
result << "\t#{sub_element_attribute}: #{val}\n" unless val.nil?
end
result
end end
wpt
# Converts a waypoint to a XML::Node. end
def to_xml(elem_name = 'wpt') end
wpt = Node.new(elem_name)
wpt['lat'] = lat.to_s
wpt['lon'] = lon.to_s
SUB_ELEMENTS.each do |sub_element_name|
if(self.respond_to?(sub_element_name) and (!self.send(sub_element_name).nil?))
sub_elem_node = Node.new(sub_element_name)
sub_elem_node << self.send(sub_element_name)
wpt << sub_elem_node
end
end
unless(self.elevation.nil?)
ele_node = Node.new('ele')
ele_node << self.elevation
wpt << ele_node
end
wpt
end
end
end end