Class: LatLonBox
- Inherits:
-
Object
- Object
- 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(indent = 0, 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.
1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 |
# File 'lib/kamelopard/classes.rb', line 1420 def initialize(north, south, east, west, rotation = 0, minAltitude = nil, maxAltitude = nil, altitudeMode = :clampToGround) @north = convert_coord north @south = convert_coord south @east = convert_coord east @west = convert_coord west @minAltitude = minAltitude @maxAltitude = maxAltitude @altitudeMode = altitudeMode @rotation = rotation end |
Instance Attribute Details
#altitudeMode ⇒ Object
Returns the value of attribute altitudeMode.
1418 1419 1420 |
# File 'lib/kamelopard/classes.rb', line 1418 def altitudeMode @altitudeMode end |
#east ⇒ Object
Returns the value of attribute east.
1417 1418 1419 |
# File 'lib/kamelopard/classes.rb', line 1417 def east @east end |
#maxAltitude ⇒ Object
Returns the value of attribute maxAltitude.
1418 1419 1420 |
# File 'lib/kamelopard/classes.rb', line 1418 def maxAltitude @maxAltitude end |
#minAltitude ⇒ Object
Returns the value of attribute minAltitude.
1418 1419 1420 |
# File 'lib/kamelopard/classes.rb', line 1418 def minAltitude @minAltitude end |
#north ⇒ Object
Returns the value of attribute north.
1417 1418 1419 |
# File 'lib/kamelopard/classes.rb', line 1417 def north @north end |
#rotation ⇒ Object
Returns the value of attribute rotation.
1418 1419 1420 |
# File 'lib/kamelopard/classes.rb', line 1418 def rotation @rotation end |
#south ⇒ Object
Returns the value of attribute south.
1417 1418 1419 |
# File 'lib/kamelopard/classes.rb', line 1417 def south @south end |
#west ⇒ Object
Returns the value of attribute west.
1417 1418 1419 |
# File 'lib/kamelopard/classes.rb', line 1417 def west @west end |
Instance Method Details
#to_kml(indent = 0, alt = false) ⇒ Object
1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 |
# File 'lib/kamelopard/classes.rb', line 1447 def to_kml(indent = 0, alt = false) name = alt ? 'LatLonAltBox' : 'LatLonBox' k = <<-latlonbox #{ ' ' * indent }<#{ name }> #{ ' ' * indent } <north>#{ @north }</north> #{ ' ' * indent } <south>#{ @south }</south> #{ ' ' * indent } <east>#{ @east }</east> #{ ' ' * indent } <west>#{ @west }</west> latlonbox k << "#{ ' ' * indent } <minAltitude>#{ @minAltitude }</minAltitude>\n" unless @minAltitude.nil? k << "#{ ' ' * indent } <maxAltitude>#{ @maxAltitude }</maxAltitude>\n" unless @maxAltitude.nil? if (not @minAltitude.nil? or not @maxAltitude.nil?) then if @altitudeMode == :clampToGround or @altitudeMode == :relativeToGround or @altitudeMode == :absolute then altitudeModeString = "#{ ' ' * indent } <altitudeMode>#{ @altitudeMode }</altitudeMode>\n" else altitudeModeString = "#{ ' ' * indent } <gx:altitudeMode>#{ @altitudeMode }</gx:altitudeMode>\n" end end k << <<-latlonbox2 #{ ' ' * indent } <rotation>#{ @rotation }</rotation> #{ ' ' * indent }</#{ name }> latlonbox2 end |