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 =
%q{ 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, #lat, #lon, #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 REXML::Element.
-
#to_xml ⇒ Object
Converts a waypoint to a REXML::Element.
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 REXML::Element.
43 44 45 46 47 48 |
# File 'lib/gpx/waypoint.rb', line 43 def initialize(opts = {}) wpt_elem = opts[:element] super(:element => wpt_elem) instantiate_with_text_elements(wpt_elem, SUB_ELEMENTS) @gpx_file = opts[:gpx_file] end |
Instance Attribute Details
#gpx_file ⇒ Object (readonly)
Returns the value of attribute gpx_file.
32 33 34 |
# File 'lib/gpx/waypoint.rb', line 32 def gpx_file @gpx_file end |
Instance Method Details
#crop(area) ⇒ Object
Not implemented
35 36 |
# File 'lib/gpx/waypoint.rb', line 35 def crop(area) end |
#delete_area(area) ⇒ Object
Not implemented
39 40 |
# File 'lib/gpx/waypoint.rb', line 39 def delete_area(area) end |
#to_xml ⇒ Object
Converts a waypoint to a REXML::Element.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/gpx/waypoint.rb', line 51 def to_xml wpt = Element.new('wpt') wpt.attributes['lat'] = lat wpt.attributes['lon'] = lon if self.respond_to? :name name_elem = Element.new('name') name_elem.text = self.name wpt.elements << name_elem end if self.respond_to? :sym sym_elem = Element.new('sym') sym_elem.text = self.sym wpt.elements << sym_elem end if self.respond_to? :ele elev_elem = Element.new('ele') elev_elem.text = self.ele wpt.elements << elev_elem end wpt end |