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.
|
# The base class for all points. Trackpoint and Waypoint both descend from this base class.
|
||||||
class Point < Base
|
class Point < Base
|
||||||
D_TO_R = PI/180.0;
|
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
|
# When you need to manipulate individual points, you can create a Point
|
||||||
# object with a latitude, a longitude, an elevation, and a time. In
|
# 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)?
|
#'-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?
|
||||||
@time = (Time.xmlschema(elem.find("gpx:time", @gpx_file.ns).first.content) rescue nil)
|
@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?
|
@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
|
else
|
||||||
@lat = opts[:lat]
|
@lat = opts[:lat]
|
||||||
@lon = opts[:lon]
|
@lon = opts[:lon]
|
||||||
@elevation = opts[:elevation]
|
@elevation = opts[:elevation]
|
||||||
@time = opts[:time]
|
@time = opts[:time]
|
||||||
|
@speed = opts[:speed]
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue