Module: NSWTopo::Formats::Kmz
Constant Summary collapse
- TILE_SIZE =
512- EARTH_RADIUS =
6378137.0- TILT =
40 * Math::PI / 180.0
- FOV =
25 * Math::PI / 180.0
Instance Method Summary collapse
- #lat_lon_box(bounds) ⇒ Object
- #network_link(bounds, path) ⇒ Object
- #region(bounds, topmost = false) ⇒ Object
- #style ⇒ Object
Instance Method Details
#lat_lon_box(bounds) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/nswtopo/formats/kmz.rb', line 18 def lat_lon_box(bounds) lambda do |box| [%w[west east south north], bounds.flatten].transpose.each do |limit, value| box.add_element(limit).text = value end end end |
#network_link(bounds, path) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/nswtopo/formats/kmz.rb', line 36 def network_link(bounds, path) lambda do |network| network.add_element("Region").tap(®ion(bounds)) network.add_element("Link").tap do |link| link.add_element("href").text = path link.add_element("viewRefreshMode").text = "onRegion" link.add_element("viewFormat") end end end |
#region(bounds, topmost = false) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/nswtopo/formats/kmz.rb', line 26 def region(bounds, topmost = false) lambda do |region| region.add_element("Lod").tap do |lod| lod.add_element("minLodPixels").text = topmost ? 0 : TILE_SIZE / 2 lod.add_element("maxLodPixels").text = -1 end region.add_element("LatLonAltBox").tap(&lat_lon_box(bounds)) end end |
#style ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/nswtopo/formats/kmz.rb', line 10 def style lambda do |style| style.add_element("ListStyle", "id" => "hideChildren").tap do |list_style| list_style.add_element("listItemType").text = "checkHideChildren" end end end |