Class: Kamelopard::LatLonQuad

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

Overview

Corresponds to KML's gx:LatLonQuad object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lowerLeft, lowerRight, upperRight, upperLeft) ⇒ LatLonQuad

Returns a new instance of LatLonQuad.


2222
2223
2224
2225
2226
2227
# File 'lib/kamelopard/classes.rb', line 2222

def initialize(lowerLeft, lowerRight, upperRight, upperLeft)
    @lowerLeft = lowerLeft
    @lowerRight = lowerRight
    @upperRight = upperRight
    @upperLeft = upperLeft
end

Instance Attribute Details

#lowerLeftObject

Returns the value of attribute lowerLeft


2221
2222
2223
# File 'lib/kamelopard/classes.rb', line 2221

def lowerLeft
  @lowerLeft
end

#lowerRightObject

Returns the value of attribute lowerRight


2221
2222
2223
# File 'lib/kamelopard/classes.rb', line 2221

def lowerRight
  @lowerRight
end

#upperLeftObject

Returns the value of attribute upperLeft


2221
2222
2223
# File 'lib/kamelopard/classes.rb', line 2221

def upperLeft
  @upperLeft
end

#upperRightObject

Returns the value of attribute upperRight


2221
2222
2223
# File 'lib/kamelopard/classes.rb', line 2221

def upperRight
  @upperRight
end

Instance Method Details

#to_kml(elem = nil) ⇒ Object


2229
2230
2231
2232
2233
2234
2235
2236
# File 'lib/kamelopard/classes.rb', line 2229

def to_kml(elem = nil)
    k = XML::Node.new 'gx:LatLonQuad'
    d = XML::Node.new 'coordinates'
    d << "#{ @lowerLeft.longitude },#{ @lowerLeft.latitude } #{ @lowerRight.longitude },#{ @lowerRight.latitude } #{ @upperRight.longitude },#{ @upperRight.latitude } #{ @upperLeft.longitude },#{ @upperLeft.latitude }"
    k << d
    elem << k unless elem.nil?
    k
end