Class: KMLPoint
- Defined in:
- lib/kamelopard/classes.rb
Overview
Represents a Point in KML.
Instance Attribute Summary collapse
-
#altitude ⇒ Object
Returns the value of attribute altitude.
-
#altitudeMode ⇒ Object
Returns the value of attribute altitudeMode.
-
#extrude ⇒ Object
Returns the value of attribute extrude.
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
Attributes inherited from KMLObject
Instance Method Summary collapse
-
#initialize(long, lat, alt = 0, altmode = :clampToGround, extrude = false) ⇒ KMLPoint
constructor
A new instance of KMLPoint.
- #to_kml(indent = 0, short = false) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(long, lat, alt = 0, altmode = :clampToGround, extrude = false) ⇒ KMLPoint
Returns a new instance of KMLPoint.
109 110 111 112 113 114 115 116 |
# File 'lib/kamelopard/classes.rb', line 109 def initialize(long, lat, alt=0, altmode=:clampToGround, extrude=false) super() @longitude = convert_coord(long) @latitude = convert_coord(lat) @altitude = alt @altitudeMode = altmode @extrude = extrude end |
Instance Attribute Details
#altitude ⇒ Object
Returns the value of attribute altitude.
108 109 110 |
# File 'lib/kamelopard/classes.rb', line 108 def altitude @altitude end |
#altitudeMode ⇒ Object
Returns the value of attribute altitudeMode.
108 109 110 |
# File 'lib/kamelopard/classes.rb', line 108 def altitudeMode @altitudeMode end |
#extrude ⇒ Object
Returns the value of attribute extrude.
108 109 110 |
# File 'lib/kamelopard/classes.rb', line 108 def extrude @extrude end |
#latitude ⇒ Object
Returns the value of attribute latitude.
108 109 110 |
# File 'lib/kamelopard/classes.rb', line 108 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude.
108 109 110 |
# File 'lib/kamelopard/classes.rb', line 108 def longitude @longitude end |
Instance Method Details
#to_kml(indent = 0, short = false) ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/kamelopard/classes.rb', line 122 def to_kml(indent = 0, short = false) # The short form includes only the coordinates tag k = super(indent + 4) + "#{ ' ' * indent }<Point id=\"#{ @id }\">\n" k << "#{ ' ' * indent } <extrude>#{ @extrude ? 1 : 0 }</extrude>\n" unless short if not short then if @altitudeMode == :clampToGround or @altitudeMode == :relativeToGround or @altitudeMode == :absolute then k << "#{ ' ' * indent } <altitudeMode>#{ @altitudeMode }</altitudeMode>\n" else k << "#{ ' ' * indent } <gx:altitudeMode>#{ @altitudeMode }</gx:altitudeMode>\n" end end k << "#{ ' ' * indent } <coordinates>#{ @longitude }, #{ @latitude }, #{ @altitude }</coordinates>\n" k << "#{ ' ' * indent }</Point>\n" k end |
#to_s ⇒ Object
118 119 120 |
# File 'lib/kamelopard/classes.rb', line 118 def to_s "KMLPoint (#{@longitude}, #{@latitude}, #{@altitude}, mode = #{@altitudeMode}, #{ @extrude ? 'extruded' : 'not extruded' })" end |