class GPX::Point

Docu

Attributes

description[R]
elevation[R]
father[R]
latitude[R]
longitude[R]
name[R]

Public Class Methods

new(point, father) click to toggle source
# File lib/gpx_kml/gpx/point.rb, line 7
def initialize(point, father)
  return unless point.is_a? Nokogiri::XML::Element
  return if point.xpath('self::*[self::xmlns:wpt or self::xmlns:rtept or self::xmlns:trkpt]').empty?

  @longitude = point.xpath('@lon').to_s
  @latitude = point.xpath('@lat').to_s
  @elevation = point.xpath('./xmlns:ele/text()').to_s
  @name = point.xpath('./xmlns:name/text()').to_s
  @description = point.xpath('./xmlns:desc/text()').to_s
  @link = point.xpath('./xmlns:link/@href').to_s
  return unless valid_father? father

  @father = father
end

Private Instance Methods

valid_father?(father) click to toggle source
# File lib/gpx_kml/gpx/point.rb, line 27
def valid_father?(father)
  father.is_a?(GPX::Segment) || father.is_a?(GPX::Route) || father.is_a?(GPXKML::Gpx)
end