class GPX::Segment

Attributes

points[R]
track[R]

Public Class Methods

new(segment, track) click to toggle source
# File lib/gpx_kml/gpx/segment.rb, line 9
def initialize(segment, track)
  return unless segment.is_a?(Nokogiri::XML::Element) && track.is_a?(GPX::Track)
  return if segment.xpath('self::xmlns:trkseg').empty?

  @points = _points segment
  @track = track
end

Private Instance Methods

_points(segment) click to toggle source
# File lib/gpx_kml/gpx/segment.rb, line 21
def _points(segment)
  p = []
  segment.xpath('./xmlns:trkpt').each_with_index do |tp, i|
    p[i] = Point.new(tp, self)
  end
  p
end