From dc86a5c53ea7d8f58dfe95aaea728f9f416686bc Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sat, 5 Mar 2011 10:48:01 +0000 Subject: [PATCH] more map --- build/js/ox.ui.js | 37 ++++-- demos/map/json/countries.json | 214 +++++++++++++++++----------------- 2 files changed, 137 insertions(+), 114 deletions(-) diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index e0be86ee..ea892301 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -9462,25 +9462,24 @@ requires self.$statusbar = new Ox.Bar({ size: 24 }) - .css({padding: '2px'}) .appendTo(that); self.$placeNameInput = new Ox.Input({ placeholder: 'Name', width: Math.floor((self.options.width - 112) / 2) }) - .css({float: 'left', margin: '2px'}) + .css({float: 'left', margin: '4px 2px 4px 4px'}) .appendTo(self.$statusbar); self.$placeGeonameInput = new Ox.Input({ placeholder: 'Geoname', width: Math.ceil((self.options.width - 112) / 2) }) - .css({float: 'left', margin: '2px'}) + .css({float: 'left', margin: '4px 2px 4px 2px'}) .appendTo(self.$statusbar) self.$placeButton = new Ox.Button({ title: 'New Place', width: 96 }) - .css({float: 'left', margin: '2px'}) + .css({float: 'left', margin: '4px 4px 4px 2px'}) .bindEvent({ click: clickPlaceButton }) @@ -9839,6 +9838,29 @@ requires function mapChanged() { // gets called after panning or zooming Ox.print('mapChanged'); + var bounds, places + if (self.boundsChanged) { + /* + bounds = self.map.getBounds(); + places = Ox.clone(self.places).filter(function(place) { + return bounds.contains(place.center); + }); + if (places.length > 100) { + places.sort(function(a, b) { + return a.size < b.size ? 1 : (a.size > b.size ? -1 : 0); + }); + } + self.places.forEach(function(place) { + place.remove(); + }); + places.forEach(function(place, i) { + if (i < 100) { + place.add(); + } + }); + */ + self.boundsChanged = false; + } if (self.centerChanged) { getMaxZoom(function(zoom) { if (zoom != self.maxZoom) { @@ -9846,10 +9868,11 @@ requires constructZoomInput(); } }); + self.centerChanged = false; + } + if (self.zoomChanged) { + self.zoomChanged = false; } - self.boundsChanged = false; - self.centerChanged = false; - self.zoomChanged = false; } function pan(x, y) { diff --git a/demos/map/json/countries.json b/demos/map/json/countries.json index ce20ba0e..355ea5be 100644 --- a/demos/map/json/countries.json +++ b/demos/map/json/countries.json @@ -70,7 +70,7 @@ "code": "AI", "name": "Anguilla", "country": "United Kingdom", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "dependent", "south": 18.1465043, @@ -99,7 +99,7 @@ { "code": "AG", "name": "Antigua and Barbuda", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "sovereign", "south": 16.9018, @@ -132,7 +132,7 @@ "code": "AW", "name": "Aruba", "country": "Netherlands", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "dependent", "south": 12.406093, @@ -198,7 +198,7 @@ { "code": "BS", "name": "Bahamas", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "sovereign", "south": 20.8536786, @@ -231,7 +231,7 @@ { "code": "BB", "name": "Barbados", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "sovereign", "south": 13.039844, @@ -320,7 +320,7 @@ "code": "BQ", "name": "Bonaire, Saint Eustatius and Saba", "country": "Netherlands", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "dependent", "south": 12.0255536, @@ -396,7 +396,7 @@ "code": "VG", "name": "British Virgin Islands", "country": "United Kingdom", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "dependent", "south": 18.312737, @@ -541,7 +541,7 @@ "code": "KY", "name": "Cayman Islands", "country": "United Kingdom", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "dependent", "south": 19.2604285, @@ -633,10 +633,10 @@ "region": "South-Eastern Asia", "continent": "Asia", "type": "dependent", - "south": -0.1709691, - "west": -95.262501, - "north": 11.1831224, - "east": -78.870899 + "south": -12.2118513, + "west": 96.8134117, + "north": -11.819973, + "east": 96.9327164 }, { "code": "CO", @@ -706,7 +706,7 @@ { "code": "CU", "name": "Cuba", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "sovereign", "south": 19.6529, @@ -718,7 +718,7 @@ "code": "CW", "name": "Curaçao", "country": "Netherlands", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "dependent", "south": 12.0379775, @@ -754,10 +754,10 @@ "region": "Eastern Europe", "continent": "Europe", "type": "former", - "south": 14.4799532, - "west": 121.0386376, - "north": 14.4807586, - "east": 121.0394941 + "south": 47.7313888, + "west": 12.090991199999962, + "north": 51.055648, + "east": 22.55893370000001 }, { "code": "CI", @@ -776,10 +776,10 @@ "region": "Western Africa", "continent": "Africa", "type": "former", - "south": 29.280647, - "west": -81.0608512, - "north": 29.281923, - "east": -81.0589702 + "south": 6.2061, + "west": 0.7766672, + "north": 12.4084434, + "east": 3.843343 }, { "code": "CD", @@ -787,10 +787,10 @@ "region": "Middle Africa", "continent": "Africa", "type": "sovereign", - "south": -13.4580558, - "west": 12.1454, - "north": 5.3813889, - "east": 31.3208323 + "south": -5.0964, + "west": 11.1182, + "north": 3.7130558, + "east": 18.6436111 }, { "code": "DK", @@ -827,7 +827,7 @@ { "code": "DM", "name": "Dominica", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "sovereign", "south": 15.20169, @@ -838,7 +838,7 @@ { "code": "DO", "name": "Dominican Republic", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "sovereign", "south": 17.3611, @@ -972,10 +972,10 @@ "name": "European Union", "continent": "Europe", "type": "other", - "south": 0.3065863, - "west": 32.5726145, - "north": 0.3289019, - "east": 32.6046293 + "south": 33.8978, + "west": -28.0371, + "north": 82.7021697, + "east": 74.1357 }, { "code": "FK", @@ -1191,7 +1191,7 @@ { "code": "GD", "name": "Grenada", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "sovereign", "south": 11.9829051, @@ -1203,7 +1203,7 @@ "code": "GP", "name": "Guadeloupe", "country": "France", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "dependent", "south": 15.742032, @@ -1281,7 +1281,7 @@ { "code": "HT", "name": "Haiti", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "sovereign", "south": 17.9422, @@ -1448,7 +1448,7 @@ { "code": "JM", "name": "Jamaica", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "sovereign", "south": 17.6688854, @@ -1486,10 +1486,10 @@ "region": "Mictonesia", "continent": "Oceania", "type": "former", - "south": 41.8674326, - "west": -71.4951191, - "north": 41.8685585, - "east": -71.4934976 + "south": 16.726549, + "west": -169.543488, + "north": 16.741133, + "east": -169.517105 }, { "code": "JO", @@ -1542,8 +1542,8 @@ "continent": "Asia", "type": "former", "south": 33.0041, - "west": 124.8541, - "north": 38.634, + "west": 124.10159999999996, + "north": 43.01159, "east": 131.1603 }, { @@ -1782,7 +1782,7 @@ "code": "MQ", "name": "Martinique", "country": "France", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "dependent", "south": 14.370834, @@ -1830,10 +1830,10 @@ "country": "France", "continent": "Europe", "type": "former", - "south": 40.7456521, - "west": -74.0027104, - "north": 40.7625568, - "east": -73.9706956 + "south": 41.3253, + "west": -5.5591, + "north": 51.1242, + "east": 9.6625 }, { "code": "MX", @@ -1916,7 +1916,7 @@ "code": "MS", "name": "Montserrat", "country": "United Kingdom", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "dependent", "south": 16.671007, @@ -2016,7 +2016,7 @@ "code": "ANHH", "name": "Netherlands Antilles", "country": "Netherlands", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "former", "south": 11.8996035, @@ -2030,10 +2030,10 @@ "region": "Western Asia", "continent": "Asia", "type": "former", - "south": 41.7662061, - "west": -88.0093504, - "north": 41.7828488, - "east": -87.9773356 + "south": 28.7778378, + "west": 44.7373584, + "north": 29.1965989, + "east": 46.5157382 }, { "code": "NC", @@ -2215,10 +2215,10 @@ "region": "Micronesia", "continent": "Oceania", "type": "former", - "south": 34.1376871, - "west": -118.2719774, - "north": 34.1561559, - "east": -118.2399626 + "south": 0.1538084, + "west": 131.8579102, + "north": 20.6584862, + "east": 172.57324219999998 }, { "code": "PK", @@ -2248,10 +2248,10 @@ "region": "Western Asia", "continent": "Asia", "type": "unrecognized", - "south": 41.6066805, - "west": -93.8545674, - "north": 41.6233644, - "east": -93.8225526 + "south": 39.0213318, + "west": -81.4229474, + "north": 39.0386672, + "east": -81.3909326 }, { "code": "PA", @@ -2356,7 +2356,7 @@ "code": "PR", "name": "Puerto Rico", "country": "United States", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "dependent", "south": 17.831509, @@ -2381,10 +2381,10 @@ "region": "Middle Africa", "continent": "Africa", "type": "sovereign", - "south": -13.4580558, - "west": 12.1454, - "north": 5.3813889, - "east": 31.3208323 + "south": -5.0964, + "west": 11.1182, + "north": 3.7130558, + "east": 18.6436111 }, { "code": "RHZW", @@ -2448,16 +2448,16 @@ "region": "Northern Africa", "continent": "Aftica", "type": "unrecognized", - "south": 31.0703727, - "west": 29.7417067, - "north": 31.0755357, - "east": 29.7507411 + "south": 20.427, + "west": -17.4573, + "north": 27.7224, + "east": -8.6666659 }, { "code": "BL", "name": "Saint Barthélemy", "country": "France", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "dependent", "south": 17.878453, @@ -2480,7 +2480,7 @@ { "code": "KN", "name": "Saint Kitts and Nevis", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "sovereign", "south": 17.0786101, @@ -2491,7 +2491,7 @@ { "code": "LC", "name": "Saint Lucia", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "sovereign", "south": 13.704778, @@ -2503,7 +2503,7 @@ "code": "MF", "name": "Saint Martin", "country": "France", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "dependent", "south": 18.047626, @@ -2526,7 +2526,7 @@ { "code": "VC", "name": "Saint Vincent and the Grenadines", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "sovereign", "south": 12.5143467, @@ -2606,10 +2606,10 @@ "name": "Serbia and Montenegro", "continent": "Europe", "type": "former", - "south": 28.5906624, - "west": 77.1884148, - "north": 28.5934162, - "east": 77.1918455 + "south": 41.8297, + "west": 18.43398000000002, + "north": 46.189446, + "east": 23.006391500000063 }, { "code": "SC", @@ -2628,10 +2628,10 @@ "region": "South-Eastern Asia", "continent": "Asia", "type": "former", - "south": 36.3389019, - "west": -82.1661361, - "north": 36.3568759, - "east": -82.1341213 + "south": 5.612787, + "west": 97.343396, + "north": 20.465143, + "east": 105.636812 }, { "code": "SL", @@ -2670,7 +2670,7 @@ "code": "SX", "name": "Sint Maarten", "country": "Netherlands", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "dependent", "south": 18.047626, @@ -2805,10 +2805,10 @@ "region": "Eastern Europe", "continent": "Europe", "type": "former", - "south": 51.2136541, - "west": 51.347512, - "north": 51.2276311, - "east": 51.3795268 + "south": 35.12876, + "west": 19.61609999999996, + "north": 82.1673907, + "east": -168.97788000000003 }, { "code": "ES", @@ -3023,7 +3023,7 @@ { "code": "TT", "name": "Trinidad and Tobago", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "sovereign", "south": 10.0422188, @@ -3080,7 +3080,7 @@ "code": "TC", "name": "Turks and Caicos Islands", "country": "United Kingdom", - "region": "Carribean", + "region": "Caribbean", "continent": "Oceania", "type": "dependent", "south": 21.1459922, @@ -3138,10 +3138,10 @@ "region": "Northern Europe", "continent": "Europe", "type": "sovereign", - "south": 34.5614, - "west": -8.8989, - "north": 60.9157, - "east": 33.916555 + "south": 49.8825312, + "west": -8.662663000000066, + "north": 60.86165, + "east": 1.768925999999965 }, { "code": "UK", @@ -3149,10 +3149,10 @@ "region": "Northern Europe", "continent": "Europe", "type": "other", - "south": 34.5614, - "west": -8.8989, - "north": 60.9157, - "east": 33.916555 + "south": 49.8825312, + "west": -8.662663000000066, + "north": 60.86165, + "east": 1.768925999999965 }, { "code": "US", @@ -3170,10 +3170,10 @@ "name": "United States Minor Outlying Islands", "country": "United States", "type": "dependent", - "south": 17.831509, - "west": -67.998751, - "north": 18.568002, - "east": -65.168503 + "south": -0.389006, + "west": 166.593323, + "north": 28.398027, + "east": -75 }, { "code": "PUUM", @@ -3190,7 +3190,7 @@ "code": "VI", "name": "United States Virgin Islands", "country": "United States", - "region": "Carribean", + "region": "Caribbean", "continent": "North America", "type": "dependent", "south": 17.623468, @@ -3326,10 +3326,10 @@ "region": "Southern Europe", "continent": "Europe", "type": "former", - "south": 42.231503, - "west": 18.850952, - "north": 46.189446, - "east": 23.0063915 + "south": 40.855222, + "west": 13.364900000000034, + "north": 46.8766467, + "east": 23.034092999999984 }, { "code": "ZRCD",