Class: Kamelopard::LatLonBox
- Inherits:
-
Object
- Object
- Kamelopard::LatLonBox
- Defined in:
- lib/kamelopard/classes.rb
Overview
Corresponds to KML’s LatLonBox and LatLonAltBox
Instance Attribute Summary collapse
-
#altitudeMode ⇒ Object
Returns the value of attribute altitudeMode.
-
#east ⇒ Object
Returns the value of attribute east.
-
#maxAltitude ⇒ Object
Returns the value of attribute maxAltitude.
-
#minAltitude ⇒ Object
Returns the value of attribute minAltitude.
-
#north ⇒ Object
Returns the value of attribute north.
-
#rotation ⇒ Object
Returns the value of attribute rotation.
-
#south ⇒ Object
Returns the value of attribute south.
-
#west ⇒ Object
Returns the value of attribute west.
Instance Method Summary collapse
-
#initialize(north, south, east, west, rotation = 0, minAltitude = nil, maxAltitude = nil, altitudeMode = :clampToGround) ⇒ LatLonBox
constructor
A new instance of LatLonBox.
- #to_kml(elem = nil, alt = false) ⇒ Object
Constructor Details
#initialize(north, south, east, west, rotation = 0, minAltitude = nil, maxAltitude = nil, altitudeMode = :clampToGround) ⇒ LatLonBox
Returns a new instance of LatLonBox.
2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 |
# File 'lib/kamelopard/classes.rb', line 2104 def initialize(north, south, east, west, rotation = 0, minAltitude = nil, maxAltitude = nil, altitudeMode = :clampToGround) @north = Kamelopard.convert_coord north @south = Kamelopard.convert_coord south @east = Kamelopard.convert_coord east @west = Kamelopard.convert_coord west @minAltitude = minAltitude @maxAltitude = maxAltitude @altitudeMode = altitudeMode @rotation = rotation end |
Instance Attribute Details
#altitudeMode ⇒ Object
Returns the value of attribute altitudeMode.
2102 2103 2104 |
# File 'lib/kamelopard/classes.rb', line 2102 def altitudeMode @altitudeMode end |
#east ⇒ Object
Returns the value of attribute east.
2101 2102 2103 |
# File 'lib/kamelopard/classes.rb', line 2101 def east @east end |
#maxAltitude ⇒ Object
Returns the value of attribute maxAltitude.
2102 2103 2104 |
# File 'lib/kamelopard/classes.rb', line 2102 def maxAltitude @maxAltitude end |
#minAltitude ⇒ Object
Returns the value of attribute minAltitude.
2102 2103 2104 |
# File 'lib/kamelopard/classes.rb', line 2102 def minAltitude @minAltitude end |
#north ⇒ Object
Returns the value of attribute north.
2101 2102 2103 |
# File 'lib/kamelopard/classes.rb', line 2101 def north @north end |
#rotation ⇒ Object
Returns the value of attribute rotation.
2102 2103 2104 |
# File 'lib/kamelopard/classes.rb', line 2102 def rotation @rotation end |
#south ⇒ Object
Returns the value of attribute south.
2101 2102 2103 |
# File 'lib/kamelopard/classes.rb', line 2101 def south @south end |
#west ⇒ Object
Returns the value of attribute west.
2101 2102 2103 |
# File 'lib/kamelopard/classes.rb', line 2101 def west @west end |
Instance Method Details
#to_kml(elem = nil, alt = false) ⇒ Object
2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 |
# File 'lib/kamelopard/classes.rb', line 2131 def to_kml(elem = nil, alt = false) name = alt ? 'LatLonAltBox' : 'LatLonBox' k = XML::Node.new name [ ['north', @north], ['south', @south], ['east', @east], ['west', @west], ['minAltitude', @minAltitude], ['maxAltitude', @maxAltitude] ].each do |a| if not a[1].nil? then m = XML::Node.new a[0] m << a[1].to_s k << m end end if (not @minAltitude.nil? or not @maxAltitude.nil?) then Kamelopard.add_altitudeMode(@altitudeMode, k) end m = XML::Node.new 'rotation' m << @rotation.to_s k << m elem << k unless elem.nil? k end |