Class: GPX::Point

Inherits:
Object
  • Object
show all
Defined in:
lib/gpx_kml/gpx/point.rb

Overview

Docu

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(point, father) ⇒ Point

Returns a new instance of Point.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



23
24
25
# File 'lib/gpx_kml/gpx/point.rb', line 23

def description
  @description
end

#elevationObject (readonly)

Returns the value of attribute elevation.



23
24
25
# File 'lib/gpx_kml/gpx/point.rb', line 23

def elevation
  @elevation
end

#fatherObject (readonly)

Returns the value of attribute father.



23
24
25
# File 'lib/gpx_kml/gpx/point.rb', line 23

def father
  @father
end

#latitudeObject (readonly)

Returns the value of attribute latitude.



23
24
25
# File 'lib/gpx_kml/gpx/point.rb', line 23

def latitude
  @latitude
end

Returns the value of attribute link.



23
24
25
# File 'lib/gpx_kml/gpx/point.rb', line 23

def link
  @link
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



23
24
25
# File 'lib/gpx_kml/gpx/point.rb', line 23

def longitude
  @longitude
end

#nameObject (readonly)

Returns the value of attribute name.



23
24
25
# File 'lib/gpx_kml/gpx/point.rb', line 23

def name
  @name
end