Class: Kamelopard::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

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

Returns a new instance of LatLonBox.



1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
# File 'lib/kamelopard/classes.rb', line 1982

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

#altitudeModeObject

Returns the value of attribute altitudeMode.



1980
1981
1982
# File 'lib/kamelopard/classes.rb', line 1980

def altitudeMode
  @altitudeMode
end

#eastObject

Returns the value of attribute east.



1979
1980
1981
# File 'lib/kamelopard/classes.rb', line 1979

def east
  @east
end

#maxAltitudeObject

Returns the value of attribute maxAltitude.



1980
1981
1982
# File 'lib/kamelopard/classes.rb', line 1980

def maxAltitude
  @maxAltitude
end

#minAltitudeObject

Returns the value of attribute minAltitude.



1980
1981
1982
# File 'lib/kamelopard/classes.rb', line 1980

def minAltitude
  @minAltitude
end

#northObject

Returns the value of attribute north.



1979
1980
1981
# File 'lib/kamelopard/classes.rb', line 1979

def north
  @north
end

#rotationObject

Returns the value of attribute rotation.



1980
1981
1982
# File 'lib/kamelopard/classes.rb', line 1980

def rotation
  @rotation
end

#southObject

Returns the value of attribute south.



1979
1980
1981
# File 'lib/kamelopard/classes.rb', line 1979

def south
  @south
end

#westObject

Returns the value of attribute west.



1979
1980
1981
# File 'lib/kamelopard/classes.rb', line 1979

def west
  @west
end

Instance Method Details

#to_kml(elem = nil, alt = false) ⇒ Object



2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
# File 'lib/kamelopard/classes.rb', line 2009

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