Class: TF1Converter::Gpx::Track
- Inherits:
-
Object
- Object
- TF1Converter::Gpx::Track
- Defined in:
- lib/tf1_converter/gpx/track.rb
Instance Method Summary collapse
- #coordinate_string ⇒ Object
- #display_color ⇒ Object
-
#initialize(xml_node, color_map = TF1Converter::Config.colors) ⇒ Track
constructor
A new instance of Track.
- #name ⇒ Object
Constructor Details
#initialize(xml_node, color_map = TF1Converter::Config.colors) ⇒ Track
Returns a new instance of Track.
6 7 8 9 |
# File 'lib/tf1_converter/gpx/track.rb', line 6 def initialize(xml_node, color_map = TF1Converter::Config.colors) @node = xml_node @color_map = color_map end |
Instance Method Details
#coordinate_string ⇒ Object
24 25 26 27 |
# File 'lib/tf1_converter/gpx/track.rb', line 24 def coordinate_string trackpoints = @node.xpath('trkseg/trkpt').map{ |node| Trackpoint.new(node) } trackpoints.inject([]) { |points, tp| points << tp.to_s }.join(' ') end |
#display_color ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/tf1_converter/gpx/track.rb', line 15 def display_color color_node = @node.xpath('extensions/TrackExtension/DisplayColor').first if color_node @color_map[color_node.text] else 'f0000080' end end |
#name ⇒ Object
11 12 13 |
# File 'lib/tf1_converter/gpx/track.rb', line 11 def name @node.xpath('name').first.text end |