Class: KML::LatLonBox

Inherits:
Object
  • Object
show all
Defined in:
lib/kml/lat_lon_box.rb

Overview

Specifies where the top, bottom, right, and left sides of a bounding box for the ground overlay are aligned. Values for north, south, east, and west are required.

  • north (required) Specifies the latitude of the north edge of the bounding box, in decimal degrees from 0 to ±90.

  • south (required) Specifies the latitude of the south edge of the bounding box, in decimal degrees from 0 to ±90.

  • east (required) Specifies the longitude of the east edge of the bounding box, in decimal degrees from 0 to ±180. (For overlays that overlap the meridian of 180° longitude, values can extend beyond that range.)

  • west (required) Specifies the longitude of the west edge of the bounding box, in decimal degrees from 0 to ±180. (For overlays that overlap the meridian of 180° longitude, values can extend beyond that range.)

  • rotation (optional) specifies a rotation of the overlay about its center, in degrees. Values can be ±180. The default is 0 (north). Rotations are specified in a clockwise direction.

Instance Attribute Summary collapse

Attributes inherited from Object

#id

Instance Method Summary collapse

Methods inherited from Object

#initialize, #parse

Constructor Details

This class inherits a constructor from KML::Object

Instance Attribute Details

#eastObject

Returns the value of attribute east.



17
18
19
# File 'lib/kml/lat_lon_box.rb', line 17

def east
  @east
end

#northObject

Returns the value of attribute north.



15
16
17
# File 'lib/kml/lat_lon_box.rb', line 15

def north
  @north
end

#rotationObject

Returns the value of attribute rotation.



19
20
21
# File 'lib/kml/lat_lon_box.rb', line 19

def rotation
  @rotation
end

#southObject

Returns the value of attribute south.



16
17
18
# File 'lib/kml/lat_lon_box.rb', line 16

def south
  @south
end

#westObject

Returns the value of attribute west.



18
19
20
# File 'lib/kml/lat_lon_box.rb', line 18

def west
  @west
end

Instance Method Details

#render(xm = Builder::XmlMarkup.new(:indent => 2)) ⇒ Object

Raises:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/kml/lat_lon_box.rb', line 21

def render(xm=Builder::XmlMarkup.new(:indent => 2))
  raise InvalidKMLError, "LatLonBox.north is required" if north.nil?
  raise InvalidKMLError, "LatLonBox.south is required" if south.nil?
  raise InvalidKMLError, "LatLonBox.east is required" if east.nil?
  raise InvalidKMLError, "LatLonBox.west is required" if west.nil?
  
  xm.LatLonBox {
    xm.north(north)
    xm.south(south)
    xm.east(east)
    xm.west(west)
    xm.rotation unless rotation.nil?
  }
end