some more work on map/listmap

This commit is contained in:
rolux 2011-05-22 19:12:21 +02:00
commit 4d9a8537ef
9 changed files with 140 additions and 77 deletions

View file

@ -5,11 +5,11 @@ Ox.load('UI', {
Ox.load('Geo', function() {
Ox.getJSON('json/cities1000000.json', function(data) {
Ox.getJSON('json/cities100000.json', function(cities) {
var listmap = new Ox.ListMap({
height: window.innerHeight,
places: data.map(function(city, id) {
places: Ox.map(cities, function(city, id) {
var countryCode = city.country_code == 'XK' ? 'RS-KO' : city.country_code,
marker = city.population > 20000000 ? {size: 24, color: [255, 0, 0]} :
city.population > 10000000 ? {size: 22, color: [255, 32, 0]} :
@ -23,12 +23,12 @@ Ox.load('Geo', function() {
size = Math.sqrt(city.population * 100),
latSize = size / Ox.EARTH_CIRCUMFERENCE * 360,
lngSize = size * Ox.getDegreesPerMeter(city.latitude);
return {
return city.population > 400000 ? {
countryCode: countryCode,
editable: true,
flag: countryCode,
geoname: city.name + ', ' + Ox.getCountryByCode(countryCode).name,
id: id,
id: Ox.encodeBase32(id),
markerColor: marker.color,
markerSize: marker.size,
name: city.name,
@ -40,7 +40,7 @@ Ox.load('Geo', function() {
west: city.longitude - lngSize / 2,
north: city.latitude + latSize / 2,
east: city.longitude + lngSize / 2
};
} : null;
}),
width: window.innerWidth
})

View file

@ -1,4 +1,5 @@
Ox.load('UI', {debug: true}, function() {
Ox.load('Geo', function() {
$.getJSON('json/countries.json', function(data) {
@ -126,4 +127,5 @@ Ox.load('UI', {debug: true}, function() {
});
});
});