2 * Copyright (c) 2012, Intel Corporation.
4 * This program is licensed under the terms and conditions of the
5 * Apache License, version 2.0. The full text of the Apache License is at
6 * http://www.apache.org/licenses/LICENSE-2.0
16 state = stateEnum.NOT_NAVIGATING;
21 this.extents_to_viewbox = function() {
22 var extents = map.extent();
23 return extents[0].lon //left
24 + "," + extents[1].lat //top
25 + "," + extents[1].lon //right
26 + "," + extents[0].lat //bottom
30 this.search = function(searchphrase) {
32 url: 'http://nominatim.openstreetmap.org/search',
36 jsonpCallback: 'json_callback' + escape(searchphrase),
40 viewbox: this.extents_to_viewbox(),
41 json_callback: 'json_callback' + searchphrase,
44 success: function(data, textStatus, xhr) {
45 geojson = data.map(function(o) {
59 geojson_layer.features(geojson);
65 jQuery(document).ready(function() {
67 //FIXME: do this on resize and do something smarter
68 var height = $("body").height();
69 var width = $("body").width();
71 console.log("display ratio: " + width / height);
73 var footer_height = height * 0.10;
74 // $("footer").height(footer_height);
75 // $("#map").height(height - footer_height);
77 console.log("screen height: " + height);
78 console.log("footer height: " + footer_height);
81 var po = org.polymaps;
84 .container(document.getElementById("map").appendChild(po.svg("svg")))
88 .url(po.url("http://{S}tile.openstreetmap.org/{Z}/{X}/{Y}.png")
89 .hosts(["a.", "b.", "c.", ""])));
92 geojson_layer = po.geoJson();
93 geojson_layer.features(geojson);
94 geojson_layer.on("show", po.stylist());
95 map.add(geojson_layer);
98 $("#state_lable").hide();
99 time = $("#time").hide().detach();
100 arrival_time = $("#arrival_time").hide().detach();
103 $(":button").on("click", function(e) {
104 var searchtext = $("input[type='text']").val();
106 s.search(searchtext);