Class: KML::Point
- Inherits:
-
Object
- Object
- KML::Point
- Defined in:
- lib/gpx_kml/kml/point.rb
Overview
Docu
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#elevation ⇒ Object
readonly
Returns the value of attribute elevation.
-
#father ⇒ Object
readonly
Returns the value of attribute father.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(coord, father, node) ⇒ Point
constructor
A new instance of Point.
Constructor Details
#initialize(coord, father, node) ⇒ Point
Returns a new instance of Point.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gpx_kml/kml/point.rb', line 11 def initialize(coord, father, node) re = Regexp.new('^ ?[0-9]+\.[0-9]+,[0-9]+\.[0-9]+(,[0-9]+\.[0-9]+)? ?$') return unless valid_father?(father) && re.match?(coord) && node.is_a?(Nokogiri::XML::Element) return if node.xpath('self::*[self::xmlns:LineString or self::xmlns:Point or self::xmlns:LinearRing]').empty? @father = father coord = coord.split(',') @longitude = coord[0] @latitude = coord[1] @elevation = coord[2] if coord.length == 3 @node = node # Name is looked up in the ancestor of the node that compose this point @name = _name return if node.xpath('self::xmlns:Point').empty? @author = @link = _link end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
31 32 33 |
# File 'lib/gpx_kml/kml/point.rb', line 31 def @author end |
#elevation ⇒ Object (readonly)
Returns the value of attribute elevation.
31 32 33 |
# File 'lib/gpx_kml/kml/point.rb', line 31 def elevation @elevation end |
#father ⇒ Object (readonly)
Returns the value of attribute father.
31 32 33 |
# File 'lib/gpx_kml/kml/point.rb', line 31 def father @father end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
31 32 33 |
# File 'lib/gpx_kml/kml/point.rb', line 31 def latitude @latitude end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
31 32 33 |
# File 'lib/gpx_kml/kml/point.rb', line 31 def link @link end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
31 32 33 |
# File 'lib/gpx_kml/kml/point.rb', line 31 def longitude @longitude end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
31 32 33 |
# File 'lib/gpx_kml/kml/point.rb', line 31 def name @name end |