Patch from Kang-min Liu to support speed element.
parent
9250b0ce45
commit
73ea9e6309
|
@ -25,7 +25,7 @@ module GPX
|
|||
# The base class for all points. Trackpoint and Waypoint both descend from this base class.
|
||||
class Point < Base
|
||||
D_TO_R = PI/180.0;
|
||||
attr_accessor :lat, :lon, :time, :elevation, :gpx_file
|
||||
attr_accessor :lat, :lon, :time, :elevation, :gpx_file, :speed
|
||||
|
||||
# When you need to manipulate individual points, you can create a Point
|
||||
# object with a latitude, a longitude, an elevation, and a time. In
|
||||
|
@ -40,11 +40,13 @@ module GPX
|
|||
#'-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?
|
||||
@time = (Time.xmlschema(elem.find("gpx:time", @gpx_file.ns).first.content) rescue nil)
|
||||
@elevation = elem.find("gpx:ele", @gpx_file.ns).first.content.to_f unless elem.find("gpx:ele", @gpx_file.ns).empty?
|
||||
@speed = elem.find("gpx:speed", @gpx_file.ns).first.content.to_f unless elem.find("gpx:speed", @gpx_file.ns).empty?
|
||||
else
|
||||
@lat = opts[:lat]
|
||||
@lon = opts[:lon]
|
||||
@elevation = opts[:elevation]
|
||||
@time = opts[:time]
|
||||
@speed = opts[:speed]
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue