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].freeze
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.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gpx/waypoint.rb', line 17 def initialize(opts = {}) if opts[:element] && 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}=" send(assignment_method, value) if respond_to?(assignment_method) end end end |
Instance Attribute Details
#gpx_file ⇒ Object (readonly)
Returns the value of attribute gpx_file.
7 8 9 |
# File 'lib/gpx/waypoint.rb', line 7 def gpx_file @gpx_file end |
Instance Method Details
#crop(area) ⇒ Object
Not implemented
11 |
# File 'lib/gpx/waypoint.rb', line 11 def crop(area); end |
#delete_area(area) ⇒ Object
Not implemented
14 |
# File 'lib/gpx/waypoint.rb', line 14 def delete_area(area); end |
#to_s ⇒ Object
Prints out a friendly summary of this track (sans points). Useful for debugging and sanity checks.
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/gpx/waypoint.rb', line 33 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 = send(sub_element_attribute) result << "\t#{sub_element_attribute}: #{val}\n" unless val.nil? end result end |