Class: GPX::Waypoint
Overview
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.
Constant Summary collapse
- SUB_ELEMENTS =
%w{ele magvar geoidheight name cmt desc src link sym type fix sat hdop vdop pdop ageofdgpsdata dgpsid extensions}
Constants inherited from Point
Instance Attribute Summary collapse
-
#gpx_file ⇒ Object
readonly
Returns the value of attribute gpx_file.
Attributes inherited from Point
#elevation, #extensions, #lat, #lon, #speed, #time
Instance Method Summary collapse
-
#crop(area) ⇒ Object
Not implemented.
-
#delete_area(area) ⇒ Object
Not implemented.
-
#initialize(opts = {}) ⇒ Waypoint
constructor
Initializes a waypoint from a XML::Node.
-
#to_s ⇒ Object
Prints out a friendly summary of this track (sans points).
Methods inherited from Point
#lat_lon, #latr, #lon_lat, #lonr
Methods inherited from Base
#instantiate_with_text_elements
Constructor Details
#initialize(opts = {}) ⇒ Waypoint
Initializes a waypoint from a XML::Node.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/gpx/waypoint.rb', line 42 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) else opts.each do |key, value| assignment_method = "#{key}=" if self.respond_to?(assignment_method) self.send(assignment_method, value) end end end end |
Instance Attribute Details
#gpx_file ⇒ Object (readonly)
Returns the value of attribute gpx_file.
30 31 32 |
# File 'lib/gpx/waypoint.rb', line 30 def gpx_file @gpx_file end |
Instance Method Details
#crop(area) ⇒ Object
Not implemented
34 35 |
# File 'lib/gpx/waypoint.rb', line 34 def crop(area) end |
#delete_area(area) ⇒ Object
Not implemented
38 39 |
# File 'lib/gpx/waypoint.rb', line 38 def delete_area(area) end |
#to_s ⇒ Object
Prints out a friendly summary of this track (sans points). Useful for debugging and sanity checks.
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/gpx/waypoint.rb', line 60 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 result end |