2011-04-27 19:24:33 +00:00
|
|
|
Ox.load('UI', {
|
|
|
|
debug: true,
|
|
|
|
theme: 'modern'
|
|
|
|
}, function() {
|
|
|
|
|
2011-05-21 17:56:15 +00:00
|
|
|
Ox.load('Geo', function() {
|
|
|
|
|
2011-05-22 17:12:21 +00:00
|
|
|
Ox.getJSON('json/cities100000.json', function(cities) {
|
2011-04-27 19:24:33 +00:00
|
|
|
|
|
|
|
var listmap = new Ox.ListMap({
|
|
|
|
height: window.innerHeight,
|
2011-05-22 17:12:21 +00:00
|
|
|
places: Ox.map(cities, function(city, id) {
|
2011-05-21 17:56:15 +00:00
|
|
|
var countryCode = city.country_code == 'XK' ? 'RS-KO' : city.country_code,
|
|
|
|
marker = city.population > 20000000 ? {size: 24, color: [255, 0, 0]} :
|
2011-04-27 19:24:33 +00:00
|
|
|
city.population > 10000000 ? {size: 22, color: [255, 32, 0]} :
|
|
|
|
city.population > 5000000 ? {size: 20, color: [255, 64, 0]} :
|
|
|
|
city.population > 2000000 ? {size: 18, color: [255, 96, 0]} :
|
|
|
|
city.population > 1000000 ? {size: 16, color: [255, 128, 0]} :
|
|
|
|
city.population > 500000 ? {size: 14, color: [255, 160, 0]} :
|
|
|
|
city.population > 200000 ? {size: 12, color: [255, 192, 0]} :
|
|
|
|
city.population > 100000 ? {size: 10, color: [255, 224, 0]} :
|
|
|
|
{size: 8, color: [255, 255, 0]},
|
2011-05-23 19:38:52 +00:00
|
|
|
area = Math.sqrt(city.population * 100),
|
|
|
|
latSize = area / Ox.EARTH_CIRCUMFERENCE * 360,
|
|
|
|
lngSize = area * Ox.getDegreesPerMeter(city.latitude);
|
|
|
|
return city.population > 600000/*400000*/ ? {
|
|
|
|
area: city.population * 100,
|
2011-05-21 17:56:15 +00:00
|
|
|
countryCode: countryCode,
|
2011-04-27 19:24:33 +00:00
|
|
|
editable: true,
|
2011-05-21 17:56:15 +00:00
|
|
|
flag: countryCode,
|
|
|
|
geoname: city.name + ', ' + Ox.getCountryByCode(countryCode).name,
|
2011-05-22 17:12:21 +00:00
|
|
|
id: Ox.encodeBase32(id),
|
2011-04-27 19:24:33 +00:00
|
|
|
markerColor: marker.color,
|
|
|
|
markerSize: marker.size,
|
|
|
|
name: city.name,
|
|
|
|
type: 'city',
|
|
|
|
lat: city.latitude,
|
|
|
|
lng: city.longitude,
|
|
|
|
south: city.latitude - latSize / 2,
|
|
|
|
west: city.longitude - lngSize / 2,
|
|
|
|
north: city.latitude + latSize / 2,
|
|
|
|
east: city.longitude + lngSize / 2
|
2011-05-22 17:12:21 +00:00
|
|
|
} : null;
|
2011-04-27 19:24:33 +00:00
|
|
|
}),
|
|
|
|
width: window.innerWidth
|
|
|
|
})
|
2011-04-29 14:56:40 +00:00
|
|
|
.bindEvent({
|
|
|
|
geocode: function(event, data) {
|
2011-04-29 22:07:23 +00:00
|
|
|
Ox.print(event)
|
2011-04-29 14:56:40 +00:00
|
|
|
Ox.print(JSON.stringify(data))
|
|
|
|
}
|
|
|
|
})
|
2011-04-27 19:24:33 +00:00
|
|
|
.appendTo(Ox.UI.$body);
|
2011-05-21 17:56:15 +00:00
|
|
|
|
2011-04-27 19:24:33 +00:00
|
|
|
$(window).resize(function() {
|
|
|
|
Ox.print('RESIZE', window.innerHeight)
|
|
|
|
listmap.options({
|
|
|
|
height: window.innerHeight,
|
|
|
|
width: window.innerWidth
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
window.listmap = listmap;
|
2011-05-21 17:56:15 +00:00
|
|
|
|
2011-04-27 19:24:33 +00:00
|
|
|
});
|
2011-05-21 17:56:15 +00:00
|
|
|
|
|
|
|
});
|
2011-04-27 19:24:33 +00:00
|
|
|
});
|