Class: LatLonBox

Inherits:
Object
  • Object
show all
Defined in:
lib/kamelopard/classes.rb

Overview

Corresponds to KML's LatLonBox and LatLonAltBox

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (LatLonBox) initialize(north, south, east, west, rotation = 0, minAltitude = nil, maxAltitude = nil, altitudeMode = :clampToGround)

A new instance of LatLonBox



1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
# File 'lib/kamelopard/classes.rb', line 1348

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

- (Object) altitudeMode

Returns the value of attribute altitudeMode



1346
1347
1348
# File 'lib/kamelopard/classes.rb', line 1346

def altitudeMode
  @altitudeMode
end

- (Object) east

Returns the value of attribute east



1345
1346
1347
# File 'lib/kamelopard/classes.rb', line 1345

def east
  @east
end

- (Object) maxAltitude

Returns the value of attribute maxAltitude



1346
1347
1348
# File 'lib/kamelopard/classes.rb', line 1346

def maxAltitude
  @maxAltitude
end

- (Object) minAltitude

Returns the value of attribute minAltitude



1346
1347
1348
# File 'lib/kamelopard/classes.rb', line 1346

def minAltitude
  @minAltitude
end

- (Object) north

Returns the value of attribute north



1345
1346
1347
# File 'lib/kamelopard/classes.rb', line 1345

def north
  @north
end

- (Object) rotation

Returns the value of attribute rotation



1346
1347
1348
# File 'lib/kamelopard/classes.rb', line 1346

def rotation
  @rotation
end

- (Object) south

Returns the value of attribute south



1345
1346
1347
# File 'lib/kamelopard/classes.rb', line 1345

def south
  @south
end

- (Object) west

Returns the value of attribute west



1345
1346
1347
# File 'lib/kamelopard/classes.rb', line 1345

def west
  @west
end

Instance Method Details

- (Object) to_kml(indent = 0, alt = false)



1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
# File 'lib/kamelopard/classes.rb', line 1375

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 == :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