more map
This commit is contained in:
parent
b7e236f056
commit
0fc4338bfd
6 changed files with 3719 additions and 218 deletions
|
@ -14,16 +14,16 @@ Ox.COUNTRIES = [
|
|||
{code: 'DZ', continent: 'Africa', name: 'Algeria', region: 'Northern Africa', type: 'sovereign'},
|
||||
{code: 'AD', continent: 'Europe', name: 'Andorra', region: 'Southern Europe', type: 'sovereign'},
|
||||
{code: 'AO', continent: 'Africa', name: 'Angola', region: 'Middle Africa', type: 'sovereign'},
|
||||
{code: 'AG', continent: 'North America', name: 'Antigua and Barbuda', region: 'Carribean', type: 'sovereign'},
|
||||
{code: 'AG', continent: 'North America', name: 'Antigua and Barbuda', region: 'Caribbean', type: 'sovereign'},
|
||||
{code: 'AR', continent: 'South America', name: 'Argentina', type: 'sovereign'},
|
||||
{code: 'AM', continent: 'Asia', name: 'Armenia', region: 'Western Asia', type: 'sovereign'},
|
||||
{code: 'AU', continent: 'Oceania', name: 'Australia', region: 'Australia and New Zealand', type: 'sovereign'},
|
||||
{code: 'AT', continent: 'Europe', name: 'Austria', region: 'Western Europe', type: 'sovereign'},
|
||||
{code: 'AZ', continent: 'Asia', name: 'Azerbaijan', region: 'Western Asia', type: 'sovereign'},
|
||||
{code: 'BS', continent: 'North America', name: 'Bahamas', region: 'Carribean', type: 'sovereign'},
|
||||
{code: 'BS', continent: 'North America', name: 'Bahamas', region: 'Caribbean', type: 'sovereign'},
|
||||
{code: 'BH', continent: 'Asia', name: 'Bahrain', region: 'Western Asia', type: 'sovereign'},
|
||||
{code: 'BD', continent: 'Asia', name: 'Bangladesh', region: 'Southern Asia', type: 'sovereign'},
|
||||
{code: 'BB', continent: 'North America', name: 'Barbados', region: 'Carribean', type: 'sovereign'},
|
||||
{code: 'BB', continent: 'North America', name: 'Barbados', region: 'Caribbean', type: 'sovereign'},
|
||||
{code: 'BY', continent: 'Europe', name: 'Belarus', region: 'Eastern Europe', type: 'sovereign'},
|
||||
{code: 'BE', continent: 'Europe', name: 'Belgium', region: 'Western Europe', type: 'sovereign'},
|
||||
{code: 'BZ', continent: 'North America', name: 'Belize', region: 'Central America', type: 'sovereign'},
|
||||
|
@ -50,14 +50,14 @@ Ox.COUNTRIES = [
|
|||
{code: 'CR', continent: 'North America', name: 'Costa Rica', region: 'Central America', type: 'sovereign'},
|
||||
{code: 'CI', continent: 'Africa', name: 'Côte d\'Ivoire', region: 'Western Africa', type: 'sovereign'},
|
||||
{code: 'HR', continent: 'Europe', name: 'Croatia', region: 'Southern Europe', type: 'sovereign'},
|
||||
{code: 'CU', continent: 'North America', name: 'Cuba', region: 'Carribean', type: 'sovereign'},
|
||||
{code: 'CU', continent: 'North America', name: 'Cuba', region: 'Caribbean', type: 'sovereign'},
|
||||
{code: 'CY', continent: 'Asia', name: 'Cyprus', region: 'Western Asia', type: 'sovereign'},
|
||||
{code: 'CZ', continent: 'Europe', name: 'Czech Republic', region: 'Eastern Europe', type: 'sovereign'},
|
||||
{code: 'CD', continent: 'Africa', name: 'Democratic Republic of the Congo', region: 'Middle Africa', type: 'sovereign'},
|
||||
{code: 'DK', continent: 'Europe', name: 'Denmark', region: 'Northern Europe', type: 'sovereign'},
|
||||
{code: 'DJ', continent: 'Africa', name: 'Djibouti', region: 'Eastern Africa', type: 'sovereign'},
|
||||
{code: 'DM', continent: 'North America', name: 'Dominica', region: 'Carribean', type: 'sovereign'},
|
||||
{code: 'DO', continent: 'North America', name: 'Dominican Republic', region: 'Carribean', type: 'sovereign'},
|
||||
{code: 'DM', continent: 'North America', name: 'Dominica', region: 'Caribbean', type: 'sovereign'},
|
||||
{code: 'DO', continent: 'North America', name: 'Dominican Republic', region: 'Caribbean', type: 'sovereign'},
|
||||
{code: 'EC', continent: 'South America', name: 'Ecuador', type: 'sovereign'},
|
||||
{code: 'EG', continent: 'Africa', name: 'Egypt', region: 'Northern Africa', type: 'sovereign'},
|
||||
{code: 'SV', continent: 'North America', name: 'El Salvador', region: 'Central America', type: 'sovereign'},
|
||||
|
@ -74,12 +74,12 @@ Ox.COUNTRIES = [
|
|||
{code: 'DE', continent: 'Europe', name: 'Germany', region: 'Western Europe', type: 'sovereign'},
|
||||
{code: 'GH', continent: 'Africa', name: 'Ghana', region: 'Western Africa', type: 'sovereign'},
|
||||
{code: 'GR', continent: 'Europe', name: 'Greece', region: 'Southern Europe', type: 'sovereign'},
|
||||
{code: 'GD', continent: 'North America', name: 'Grenada', region: 'Carribean', type: 'sovereign'},
|
||||
{code: 'GD', continent: 'North America', name: 'Grenada', region: 'Caribbean', type: 'sovereign'},
|
||||
{code: 'GT', continent: 'North America', name: 'Guatemala', region: 'Central America', type: 'sovereign'},
|
||||
{code: 'GN', continent: 'Africa', name: 'Guinea', region: 'Western Africa', type: 'sovereign'},
|
||||
{code: 'GW', continent: 'Africa', name: 'Guinea-Bissau', region: 'Western Africa', type: 'sovereign'},
|
||||
{code: 'GY', continent: 'South America', name: 'Guyana', type: 'sovereign'},
|
||||
{code: 'HT', continent: 'North America', name: 'Haiti', region: 'Carribean', type: 'sovereign'},
|
||||
{code: 'HT', continent: 'North America', name: 'Haiti', region: 'Caribbean', type: 'sovereign'},
|
||||
{code: 'VA', continent: 'Europe', name: 'Holy See', region: 'Southern Europe', type: 'sovereign'},
|
||||
{code: 'HN', continent: 'North America', name: 'Honduras', region: 'Central America', type: 'sovereign'},
|
||||
{code: 'HU', continent: 'Europe', name: 'Hungary', region: 'Eastern Europe', type: 'sovereign'},
|
||||
|
@ -91,7 +91,7 @@ Ox.COUNTRIES = [
|
|||
{code: 'IE', continent: 'Europe', name: 'Ireland', region: 'Northern Europe', type: 'sovereign'},
|
||||
{code: 'IL', continent: 'Asia', name: 'Israel', region: 'Western Asia', type: 'sovereign'},
|
||||
{code: 'IT', continent: 'Europe', name: 'Italy', region: 'Southern Europe', type: 'sovereign'},
|
||||
{code: 'JM', continent: 'North America', name: 'Jamaica', region: 'Carribean', type: 'sovereign'},
|
||||
{code: 'JM', continent: 'North America', name: 'Jamaica', region: 'Caribbean', type: 'sovereign'},
|
||||
{code: 'JP', continent: 'Asia', name: 'Japan', region: 'Eastern Asia', type: 'sovereign'},
|
||||
{code: 'JO', continent: 'Asia', name: 'Jordan', region: 'Western Asia', type: 'sovereign'},
|
||||
{code: 'KZ', continent: 'Asia', name: 'Kazakhstan', region: 'Central Asia', type: 'sovereign'},
|
||||
|
@ -152,9 +152,9 @@ Ox.COUNTRIES = [
|
|||
{code: 'RO', continent: 'Europe', name: 'Romania', region: 'Eastern Europe', type: 'sovereign'},
|
||||
{code: 'RU', continent: 'Europe', name: 'Russia', region: 'Eastern Europe', type: 'sovereign'},
|
||||
{code: 'RW', continent: 'Africa', name: 'Rwanda', region: 'Eastern Africa', type: 'sovereign'},
|
||||
{code: 'KN', continent: 'North America', name: 'Saint Kitts and Nevis', region: 'Carribean', type: 'sovereign'},
|
||||
{code: 'LC', continent: 'North America', name: 'Saint Lucia', region: 'Carribean', type: 'sovereign'},
|
||||
{code: 'VC', continent: 'North America', name: 'Saint Vincent and the Grenadines', region: 'Carribean', type: 'sovereign'},
|
||||
{code: 'KN', continent: 'North America', name: 'Saint Kitts and Nevis', region: 'Caribbean', type: 'sovereign'},
|
||||
{code: 'LC', continent: 'North America', name: 'Saint Lucia', region: 'Caribbean', type: 'sovereign'},
|
||||
{code: 'VC', continent: 'North America', name: 'Saint Vincent and the Grenadines', region: 'Caribbean', type: 'sovereign'},
|
||||
{code: 'WS', continent: 'Oceania', name: 'Samoa', region: 'Polynesia', type: 'sovereign'},
|
||||
{code: 'SM', continent: 'Europe', name: 'San Marino', region: 'Southern Europe', type: 'sovereign'},
|
||||
{code: 'ST', continent: 'Africa', name: 'São Tomé and Príncipe', region: 'Middle Africa', type: 'sovereign'},
|
||||
|
@ -184,7 +184,7 @@ Ox.COUNTRIES = [
|
|||
{code: 'TL', continent: 'Asia', name: 'Timor-Leste', region: 'South-Eastern Asia', type: 'sovereign'},
|
||||
{code: 'TG', continent: 'Africa', name: 'Togo', region: 'Western Africa', type: 'sovereign'},
|
||||
{code: 'TO', continent: 'Oceania', name: 'Tonga', region: 'Polynesia', type: 'sovereign'},
|
||||
{code: 'TT', continent: 'North America', name: 'Trinidad and Tobago', region: 'Carribean', type: 'sovereign'},
|
||||
{code: 'TT', continent: 'North America', name: 'Trinidad and Tobago', region: 'Caribbean', type: 'sovereign'},
|
||||
{code: 'TN', continent: 'Africa', name: 'Tunisia', region: 'Northern Africa', type: 'sovereign'},
|
||||
{code: 'TR', continent: 'Asia', name: 'Turkey', region: 'Western Asia', type: 'sovereign'},
|
||||
{code: 'TM', continent: 'Asia', name: 'Turkmenistan', region: 'Central Asia', type: 'sovereign'},
|
||||
|
@ -229,19 +229,19 @@ Ox.COUNTRIES = [
|
|||
{code: 'GF', continent: 'South America', country: 'France', name: 'French Guiana', type: 'dependent'},
|
||||
{code: 'PF', continent: 'Oceania', country: 'France', name: 'French Polynesia', region: 'Polynesia', type: 'dependent'},
|
||||
{code: 'TF', country: 'France', name: 'French Southern Territories', type: 'dependent'},
|
||||
{code: 'GP', continent: 'North America', country: 'France', name: 'Guadeloupe', region: 'Carribean', type: 'dependent'},
|
||||
{code: 'MQ', continent: 'North America', country: 'France', name: 'Martinique', region: 'Carribean', type: 'dependent'},
|
||||
{code: 'GP', continent: 'North America', country: 'France', name: 'Guadeloupe', region: 'Caribbean', type: 'dependent'},
|
||||
{code: 'MQ', continent: 'North America', country: 'France', name: 'Martinique', region: 'Caribbean', type: 'dependent'},
|
||||
{code: 'YT', continent: 'Africa', country: 'France', name: 'Mayotte', region: 'Eastern Africa', type: 'dependent'},
|
||||
{code: 'NC', continent: 'Oceania', country: 'France', name: 'New Caledonia', region: 'Melanesia', type: 'dependent'},
|
||||
{code: 'RE', continent: 'Africa', country: 'France', name: 'Réunion', region: 'Eastern Africa', type: 'dependent', flag: 'png'},
|
||||
{code: 'BL', continent: 'North America', country: 'France', name: 'Saint Barthélemy', region: 'Carribean', type: 'dependent'},
|
||||
{code: 'MF', continent: 'North America', country: 'France', name: 'Saint Martin', region: 'Carribean', type: 'dependent'},
|
||||
{code: 'BL', continent: 'North America', country: 'France', name: 'Saint Barthélemy', region: 'Caribbean', type: 'dependent'},
|
||||
{code: 'MF', continent: 'North America', country: 'France', name: 'Saint Martin', region: 'Caribbean', type: 'dependent'},
|
||||
{code: 'PM', continent: 'North America', country: 'France', name: 'Saint Pierre and Miquelon', region: 'Northern America', type: 'dependent'},
|
||||
{code: 'WF', continent: 'Oceania', country: 'France', name: 'Wallis and Futuna', region: 'Polynesia', type: 'dependent'},
|
||||
{code: 'AW', continent: 'North America', country: 'Netherlands', name: 'Aruba', region: 'Carribean', type: 'dependent'},
|
||||
{code: 'BQ', continent: 'North America', country: 'Netherlands', name: 'Bonaire, Saint Eustatius and Saba', region: 'Carribean', type: 'dependent'},
|
||||
{code: 'CW', continent: 'North America', country: 'Netherlands', name: 'Curaçao', region: 'Carribean', type: 'dependent'},
|
||||
{code: 'SX', continent: 'North America', country: 'Netherlands', name: 'Sint Maarten', region: 'Carribean', type: 'dependent'},
|
||||
{code: 'AW', continent: 'North America', country: 'Netherlands', name: 'Aruba', region: 'Caribbean', type: 'dependent'},
|
||||
{code: 'BQ', continent: 'North America', country: 'Netherlands', name: 'Bonaire, Saint Eustatius and Saba', region: 'Caribbean', type: 'dependent'},
|
||||
{code: 'CW', continent: 'North America', country: 'Netherlands', name: 'Curaçao', region: 'Caribbean', type: 'dependent'},
|
||||
{code: 'SX', continent: 'North America', country: 'Netherlands', name: 'Sint Maarten', region: 'Caribbean', type: 'dependent'},
|
||||
{code: 'CK', continent: 'Oceania', country: 'New Zealand', name: 'Cook Islands', region: 'Polynesia', type: 'dependent'},
|
||||
{code: 'NU', continent: 'Oceania', country: 'New Zealand', name: 'Niue', region: 'Polynesia', type: 'dependent'},
|
||||
{code: 'TK', continent: 'Oceania', country: 'New Zealand', name: 'Tokelau', region: 'Polynesia', type: 'dependent'},
|
||||
|
@ -249,12 +249,12 @@ Ox.COUNTRIES = [
|
|||
{code: 'SJ', continent: 'Europe', country: 'Norway', name: 'Svalbard and Jan Mayen', region: 'Northern Europe', type: 'dependent'},
|
||||
{code: 'IC', continent: 'Africa', country: 'Spain', name: 'Canary Islands', region: 'Northern Africa', type: 'dependent'},
|
||||
{code: 'EA', continent: 'Africa', country: 'Spain', name: 'Ceuta and Melilla', region: 'Northern Africa', type: 'dependent'},
|
||||
{code: 'AI', continent: 'North America', country: 'United Kingdom', name: 'Anguilla', region: 'Carribean', type: 'dependent'},
|
||||
{code: 'AI', continent: 'North America', country: 'United Kingdom', name: 'Anguilla', region: 'Caribbean', type: 'dependent'},
|
||||
{code: 'AC', continent: 'Africa', country: 'United Kingdom', name: 'Ascension', region: 'Western Africa', type: 'dependent'},
|
||||
{code: 'BM', continent: 'North America', country: 'United Kingdom', name: 'Bermuda', region: 'Northern America', type: 'dependent'},
|
||||
{code: 'IO', country: 'United Kingdom', name: 'British Indian Ocean Territory', type: 'dependent'},
|
||||
{code: 'VG', continent: 'North America', country: 'United Kingdom', name: 'British Virgin Islands', region: 'Carribean', type: 'dependent'},
|
||||
{code: 'KY', continent: 'North America', country: 'United Kingdom', name: 'Cayman Islands', region: 'Carribean', type: 'dependent'},
|
||||
{code: 'VG', continent: 'North America', country: 'United Kingdom', name: 'British Virgin Islands', region: 'Caribbean', type: 'dependent'},
|
||||
{code: 'KY', continent: 'North America', country: 'United Kingdom', name: 'Cayman Islands', region: 'Caribbean', type: 'dependent'},
|
||||
{code: 'DG', country: 'United Kingdom', name: 'Diego Garcia', type: 'dependent'},
|
||||
{code: 'GB-ENG', continent: 'Europe', country: 'United Kingdom', name: 'England', region: 'Northern Europe', type: 'dependent'},
|
||||
{code: 'FK', continent: 'South America', country: 'United Kingdom', name: 'Falkland Islands', type: 'dependent'},
|
||||
|
@ -262,21 +262,21 @@ Ox.COUNTRIES = [
|
|||
{code: 'GG', continent: 'Europe', country: 'United Kingdom', name: 'Guernsey', region: 'Northern Europe', type: 'dependent'},
|
||||
{code: 'IM', continent: 'Europe', country: 'United Kingdom', name: 'Isle of Man', region: 'Northern Europe', type: 'dependent'},
|
||||
{code: 'JE', continent: 'Europe', country: 'United Kingdom', name: 'Jersey', region: 'Northern Europe', type: 'dependent'},
|
||||
{code: 'MS', continent: 'North America', country: 'United Kingdom', name: 'Montserrat', region: 'Carribean', type: 'dependent'},
|
||||
{code: 'MS', continent: 'North America', country: 'United Kingdom', name: 'Montserrat', region: 'Caribbean', type: 'dependent'},
|
||||
{code: 'GB-NIR', continent: 'Europe', country: 'United Kingdom', name: 'Northern Ireland', region: 'Northern Europe', type: 'dependent'},
|
||||
{code: 'PN', continent: 'Oceania', country: 'United Kingdom', name: 'Pitcairn', region: 'Polynesia', type: 'dependent'},
|
||||
{code: 'SH', continent: 'Africa', country: 'United Kingdom', name: 'Saint Helena', region: 'Western Africa', type: 'dependent'},
|
||||
{code: 'GB-SCT', continent: 'Europe', country: 'United Kingdom', name: 'Scotland', region: 'Northern Europe', type: 'dependent'},
|
||||
{code: 'GS', continent: 'South America', country: 'United Kingdom', name: 'South Georgia and the South Sandwich Islands', type: 'dependent'},
|
||||
{code: 'TA', continent: 'Africa', country: 'United Kingdom', name: 'Tristan da Cunha', region: 'Western Africa', type: 'dependent'},
|
||||
{code: 'TC', continent: 'Oceania', country: 'United Kingdom', name: 'Turks and Caicos Islands', region: 'Carribean', type: 'dependent'},
|
||||
{code: 'TC', continent: 'Oceania', country: 'United Kingdom', name: 'Turks and Caicos Islands', region: 'Caribbean', type: 'dependent'},
|
||||
{code: 'GB-WLS', continent: 'Europe', country: 'United Kingdom', name: 'Wales', region: 'Northern Europe', type: 'dependent'},
|
||||
{code: 'AS', continent: 'Oceania', country: 'United States', name: 'American Samoa', region: 'Polynesia', type: 'dependent'},
|
||||
{code: 'GU', continent: 'Oceania', country: 'United States', name: 'Guam', region: 'Micronesia', type: 'dependent'},
|
||||
{code: 'MP', continent: 'Oceania', country: 'United States', name: 'Northern Mariana Islands', region: 'Micronesia', type: 'dependent'},
|
||||
{code: 'PR', continent: 'North America', country: 'United States', name: 'Puerto Rico', region: 'Carribean', type: 'dependent'},
|
||||
{code: 'PR', continent: 'North America', country: 'United States', name: 'Puerto Rico', region: 'Caribbean', type: 'dependent'},
|
||||
{code: 'UM', country: 'United States', name: 'United States Minor Outlying Islands', type: 'dependent'},
|
||||
{code: 'VI', continent: 'North America', country: 'United States', name: 'United States Virgin Islands', region: 'Carribean', type: 'dependent'},
|
||||
{code: 'VI', continent: 'North America', country: 'United States', name: 'United States Virgin Islands', region: 'Caribbean', type: 'dependent'},
|
||||
{code: 'BUMM', continent: 'Asia', name: 'Burma', region: 'South-Eastern Asia', type: 'former'},
|
||||
{code: 'BYAA', continent: 'Europe', name: 'Byelorussian Soviet Socialist Republic', region: 'Eastern Europe', type: 'former'},
|
||||
{code: 'CTKI', continent: 'Oceania', name: 'Canton and Enderbury Islands', region: 'Micronesia', type: 'former'},
|
||||
|
@ -302,7 +302,7 @@ Ox.COUNTRIES = [
|
|||
{code: 'FQHH', continent: 'Antarctica', country: 'France', name: 'French Southern and Antarctic Territories', type: 'former'},
|
||||
{code: 'FXFR', continent: 'Europe', country: 'France', name: 'Metropolitan France', type: 'former'},
|
||||
{code: 'NHVU', country: ['France', 'United Kingdom'], name: 'New Hebrides', region: 'Melanesia', type: 'former'},
|
||||
{code: 'ANHH', continent: 'North America', country: 'Netherlands', name: 'Netherlands Antilles', region: 'Carribean', type: 'former'},
|
||||
{code: 'ANHH', continent: 'North America', country: 'Netherlands', name: 'Netherlands Antilles', region: 'Caribbean', type: 'former'},
|
||||
{code: 'NQAQ', continent: 'Antarctica', country: 'Norway', name: 'Dronning Maud Land', type: 'former'},
|
||||
{code: 'BQAQ', continent: 'Antarctica', country: 'United Kingdom', name: 'British Antarctic Territory', type: 'former'},
|
||||
{code: 'JTUM', continent: 'Oceania', country: 'United States', name: 'Johnston Island', region: 'Mictonesia', type: 'former'},
|
||||
|
|
|
@ -9208,13 +9208,9 @@ requires
|
|||
Ox.print('PLACES', places)
|
||||
self.$map = new Ox.Map({
|
||||
clickable: true,
|
||||
editable: true,
|
||||
height: self.options.height,
|
||||
// fixme: place can still be string, and maybe shouldn't be array at all
|
||||
places: places.map(function(place) {
|
||||
return Ox.extend({}, place, {
|
||||
name: place.name.length == 0 ? '' : place.name[0]
|
||||
});
|
||||
}),
|
||||
places: places,
|
||||
statusbar: true,
|
||||
toolbar: true,
|
||||
width: self.mapResize[1],
|
||||
|
@ -9429,7 +9425,7 @@ requires
|
|||
.appendTo(that);
|
||||
self.$labelsButton = new Ox.Button({
|
||||
title: 'Show Labels',
|
||||
width: 80
|
||||
width: 96
|
||||
})
|
||||
.css({float: 'left', margin: '4px'})
|
||||
.bindEvent({
|
||||
|
@ -9470,19 +9466,19 @@ requires
|
|||
.appendTo(that);
|
||||
self.$placeNameInput = new Ox.Input({
|
||||
placeholder: 'Name',
|
||||
width: Math.floor((self.options.width - 96) / 2)
|
||||
width: Math.floor((self.options.width - 112) / 2)
|
||||
})
|
||||
.css({float: 'left', margin: '2px'})
|
||||
.appendTo(self.$statusbar);
|
||||
self.$placeGeonameInput = new Ox.Input({
|
||||
placeholder: 'Geoname',
|
||||
width: Math.ceil((self.options.width - 96) / 2)
|
||||
width: Math.ceil((self.options.width - 112) / 2)
|
||||
})
|
||||
.css({float: 'left', margin: '2px'})
|
||||
.appendTo(self.$statusbar)
|
||||
self.$placeButton = new Ox.Button({
|
||||
title: 'New Place',
|
||||
width: 80
|
||||
width: 96
|
||||
})
|
||||
.css({float: 'left', margin: '2px'})
|
||||
.bindEvent({
|
||||
|
@ -9550,37 +9546,54 @@ requires
|
|||
initMap();
|
||||
}
|
||||
|
||||
function addNewPlace() {
|
||||
var bounds = self.map.getBounds(),
|
||||
center = self.map.getCenter(),
|
||||
southwest = new google.maps.LatLngBounds(
|
||||
bounds.getSouthWest(), center
|
||||
).getCenter(),
|
||||
northeast = new google.maps.LatLngBounds(
|
||||
center, bounds.getNorthEast()
|
||||
).getCenter(),
|
||||
place = new Place({
|
||||
countryCode: '',
|
||||
geoname: '',
|
||||
id: '_' + Ox.uid(), // fixme: stupid
|
||||
name: '',
|
||||
south: southwest.lat(),
|
||||
west: southwest.lng(),
|
||||
north: northeast.lat(),
|
||||
east: northeast.lng()
|
||||
});
|
||||
addPlace(place);
|
||||
selectPlace(place.name);
|
||||
}
|
||||
|
||||
function addPlace(place) {
|
||||
Ox.print('addPlace', place)
|
||||
function addPlaceToMap(place) {
|
||||
if (!place) {
|
||||
var bounds = self.map.getBounds(),
|
||||
center = self.map.getCenter(),
|
||||
southwest = new google.maps.LatLngBounds(
|
||||
bounds.getSouthWest(), center
|
||||
).getCenter(),
|
||||
northeast = new google.maps.LatLngBounds(
|
||||
center, bounds.getNorthEast()
|
||||
).getCenter(),
|
||||
place = new Ox.MapPlace({
|
||||
countryCode: '',
|
||||
editable: true,
|
||||
geoname: '',
|
||||
id: '_' + Ox.uid(), // fixme: stupid
|
||||
lat: center.lat(),
|
||||
lng: center.lng(),
|
||||
map: that,
|
||||
name: '',
|
||||
south: southwest.lat(),
|
||||
west: southwest.lng(),
|
||||
north: northeast.lat(),
|
||||
east: northeast.lng()
|
||||
});
|
||||
}
|
||||
Ox.print('addPlaceToMap', place)
|
||||
Ox.print('self.resultPlace', self.resultPlace)
|
||||
self.resultPlace && self.resultPlace.remove();
|
||||
if (place.id[0] == '_') {
|
||||
self.resultPlace = place;
|
||||
}
|
||||
self.resultPlace = place;
|
||||
place.add();
|
||||
selectPlace(place.id);
|
||||
}
|
||||
|
||||
function addPlaceToPlaces() {
|
||||
var place = getSelectedPlace();
|
||||
if (self.options.selected == place.id) {
|
||||
self.options.selected = place.id.substr(1);
|
||||
self.selected = self.options.selected;
|
||||
}
|
||||
place.id = place.id.substr(1); // fixme: NOT SAFE!
|
||||
place.name = self.$placeNameInput.value();
|
||||
place.geoname = self.$placeGeonameInput.value();
|
||||
place.countryCode = Ox.getCountryCode(place.geoname);
|
||||
place.marker.update();
|
||||
self.places.push(place);
|
||||
self.resultPlace = null;
|
||||
that.triggerEvent('addplace', place)
|
||||
Ox.print('SSSS', self.options.selected)
|
||||
}
|
||||
|
||||
function boundsChanged() {
|
||||
|
@ -9610,7 +9623,7 @@ requires
|
|||
if (self.options.clickable/* && !editing()*/) {
|
||||
getPlaceByLatLng(event.latLng, self.map.getBounds(), function(place) {
|
||||
if (place) {
|
||||
addPlace(place);
|
||||
addPlaceToMap(place);
|
||||
selectPlace(place.id);
|
||||
}
|
||||
});
|
||||
|
@ -9618,22 +9631,14 @@ requires
|
|||
}
|
||||
|
||||
function clickPlaceButton() {
|
||||
if (self.$placeButton.options('title') == 'New Place') {
|
||||
addNewPlace();
|
||||
} else {
|
||||
var place = getSelectedPlace(),
|
||||
data = {
|
||||
place: {}
|
||||
};
|
||||
data.place.name = self.$placeNameInput.value();
|
||||
data.place.geoname = self.$placeGeonameInput.value();
|
||||
data.place.countryCode = Ox.getCountryCode(data.place.geoname);
|
||||
[
|
||||
'lat', 'lng', 'south', 'west', 'north', 'east', 'size'
|
||||
].forEach(function(key) {
|
||||
data.place[key] = place[key];
|
||||
});
|
||||
that.triggerEvent('addplace', data)
|
||||
var place = getSelectedPlace(),
|
||||
title = self.$placeButton.options('title');
|
||||
if (title == 'New Place') {
|
||||
addPlaceToMap();
|
||||
} else if (title == 'Add Place') {
|
||||
addPlaceToPlaces();
|
||||
} else if (title == 'Remove Place') {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9658,7 +9663,21 @@ requires
|
|||
}
|
||||
|
||||
function editing() {
|
||||
return self.selected && getSelectedPlace().editing;
|
||||
var place = getSelectedPlace();
|
||||
return place && place.editing;
|
||||
}
|
||||
|
||||
function getElevation(point, callback) {
|
||||
// fixme: unused
|
||||
if (arguments.length == 1) {
|
||||
callback = point;
|
||||
point = self.map.getCenter();
|
||||
}
|
||||
self.elevationService.getElevationForLocations({
|
||||
locations: [point]
|
||||
}, function(data) {
|
||||
callback(data.elevation);
|
||||
});
|
||||
}
|
||||
|
||||
function getMapHeight() {
|
||||
|
@ -9678,7 +9697,7 @@ requires
|
|||
point = self.map.getCenter();
|
||||
}
|
||||
self.maxZoomService.getMaxZoomAtLatLng(point, function(data) {
|
||||
callback(data.status == 'OK' ? data.zoom : -1);
|
||||
callback(data.status == 'OK' ? data.zoom : null);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -9761,11 +9780,13 @@ requires
|
|||
}
|
||||
|
||||
function getSelectedPlace() {
|
||||
return self.selected ? getPlaceById(self.selected) : null;
|
||||
return self.options.selected ?
|
||||
getPlaceById(self.options.selected) : null;
|
||||
}
|
||||
|
||||
function initMap() {
|
||||
var mapBounds;
|
||||
self.elevationService = new google.maps.ElevationService();
|
||||
self.geocoder = new google.maps.Geocoder();
|
||||
self.maxZoomService = new google.maps.MaxZoomService();
|
||||
self.places = [];
|
||||
|
@ -9841,6 +9862,7 @@ requires
|
|||
components: data.address_components,
|
||||
countryCode: getCountryCode(data.address_components),
|
||||
east: bounds.getNorthEast().lng(),
|
||||
editable: self.options.editable,
|
||||
fullGeoname: getFullGeoname(data.address_components),
|
||||
geoname: data.formatted_address,
|
||||
id: '_' + Ox.uid(),
|
||||
|
@ -9937,10 +9959,14 @@ requires
|
|||
Ox.print('Ox.Map selectPlace()', id, self.selected)
|
||||
var place;
|
||||
if (id != self.selected) {
|
||||
place = getSelectedPlace();
|
||||
place = getPlaceById(self.selected);
|
||||
place && place.deselect();
|
||||
place = getPlaceById(id);
|
||||
place && place.select();
|
||||
self.selected = id;
|
||||
self.options.selected = id;
|
||||
setStatus();
|
||||
that.triggerEvent('selectplace', place);
|
||||
}
|
||||
if (id) {
|
||||
//self.map.setCenter(place.center);
|
||||
|
@ -9954,32 +9980,31 @@ requires
|
|||
}
|
||||
*/
|
||||
}
|
||||
self.options.selected = id;
|
||||
self.selected = id;
|
||||
setStatus();
|
||||
that.triggerEvent('selectplace', place);
|
||||
/*
|
||||
that.triggerEvent('select', {
|
||||
id: self.options.selected
|
||||
});
|
||||
*/
|
||||
//Ox.print('????', place)
|
||||
};
|
||||
|
||||
function setStatus() {
|
||||
Ox.print('setStatus()', self.options.selected)
|
||||
var place;
|
||||
var disabled, place, title;
|
||||
if (self.options.statusbar) {
|
||||
if (self.options.selected) {
|
||||
place = getPlaceById(self.options.selected);
|
||||
place = getSelectedPlace();
|
||||
title = place.id[0] == '_' ? 'Add Place' : 'Remove Place';
|
||||
} else {
|
||||
title = 'New Place';
|
||||
}
|
||||
disabled = place && !place.editable;
|
||||
self.$placeNameInput.options({
|
||||
disabled: disabled,
|
||||
value: self.options.selected ? place.name : ''
|
||||
});
|
||||
self.$placeGeonameInput.options({
|
||||
disabled: disabled,
|
||||
value: self.options.selected ? place.geoname : ''
|
||||
});
|
||||
self.$placeButton.options({
|
||||
title: self.options.selected ? 'Add Place' : 'New Place'
|
||||
disabled: disabled,
|
||||
title: title
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -10094,12 +10119,13 @@ requires
|
|||
|
||||
that.editPlace = function() {
|
||||
getPlaceById(self.options.selected).edit();
|
||||
return that;
|
||||
}
|
||||
|
||||
that.findPlace = function(name, callback) {
|
||||
getPlaceByName(name, function(place) {
|
||||
if (place) {
|
||||
addPlace(place);
|
||||
addPlaceToMap(place);
|
||||
self.resultPlace = place;
|
||||
selectPlace(place.id);
|
||||
self.bounds = place.bounds;
|
||||
|
@ -10112,13 +10138,13 @@ requires
|
|||
|
||||
that.panToPlace = function() {
|
||||
Ox.print('panToPlace:', self.options.selected)
|
||||
if (self.options.selected !== null) {
|
||||
self.map.panTo(getPlaceById(self.options.selected).center);
|
||||
}
|
||||
var place = getSelectedPlace();
|
||||
place && self.map.panTo(place.center);
|
||||
return that;
|
||||
};
|
||||
|
||||
that.removePlace = function(id) {
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
that.resizeMap = function() {
|
||||
|
@ -10136,17 +10162,19 @@ requires
|
|||
self.options.zoombar && self.$zoomInput.options({
|
||||
size: self.options.width
|
||||
});
|
||||
return that;
|
||||
}
|
||||
|
||||
that.zoomToPlace = function() {
|
||||
Ox.print('zoomToPlace')
|
||||
if (self.options.selected !== null) {
|
||||
self.map.fitBounds(getPlaceById(self.options.selected).bounds);
|
||||
}
|
||||
var place = getSelectedPlace();
|
||||
place && self.map.fitBounds(place.bounds);
|
||||
return that;
|
||||
};
|
||||
|
||||
that.zoom = function(value) {
|
||||
self.map.setZoom(value);
|
||||
return that;
|
||||
};
|
||||
|
||||
return that;
|
||||
|
@ -10193,6 +10221,7 @@ requires
|
|||
nw: new google.maps.LatLng(that.north, that.west),
|
||||
w: new google.maps.LatLng(that.lat, that.west),
|
||||
});
|
||||
// fixme: use bounds.toSpan()
|
||||
that.sizeNorthSouth = (that.north - that.south) *
|
||||
Ox.EARTH_CIRCUMFERENCE / 360;
|
||||
that.sizeEastWest = (that.east + (that.west > that.east ? 360 : 0) - that.west) *
|
||||
|
@ -10214,6 +10243,10 @@ requires
|
|||
//Ox.print('PLACE', that)
|
||||
}
|
||||
|
||||
function editable() {
|
||||
return that.map.options('editable') && that.editable;
|
||||
}
|
||||
|
||||
that.add = function() {
|
||||
Ox.print('MapPlace add', that)
|
||||
that.marker.add();
|
||||
|
@ -10221,10 +10254,12 @@ requires
|
|||
};
|
||||
|
||||
that.cancel = function() {
|
||||
that.undo();
|
||||
that.editing = false;
|
||||
that.marker.update();
|
||||
that.rectangle.deselect();
|
||||
if (editable()) {
|
||||
that.undo();
|
||||
that.editing = false;
|
||||
that.marker.update();
|
||||
that.rectangle.deselect();
|
||||
}
|
||||
return that;
|
||||
};
|
||||
|
||||
|
@ -10241,15 +10276,17 @@ requires
|
|||
};
|
||||
|
||||
that.edit = function() {
|
||||
that.editing = true;
|
||||
that.original = {
|
||||
east: that.east,
|
||||
north: that.north,
|
||||
south: that.south,
|
||||
west: that.west
|
||||
};
|
||||
that.marker.edit();
|
||||
that.rectangle.select();
|
||||
if (editable()) {
|
||||
that.editing = true;
|
||||
that.original = {
|
||||
east: that.east,
|
||||
north: that.north,
|
||||
south: that.south,
|
||||
west: that.west
|
||||
};
|
||||
that.marker.edit();
|
||||
that.rectangle.select();
|
||||
}
|
||||
return that;
|
||||
}
|
||||
|
||||
|
@ -10269,24 +10306,30 @@ requires
|
|||
};
|
||||
|
||||
that.submit = function() {
|
||||
Ox.print('submit')
|
||||
that.editing = false;
|
||||
that.marker.update();
|
||||
that.rectangle.deselect();
|
||||
if (editable()) {
|
||||
Ox.print('submit')
|
||||
that.editing = false;
|
||||
that.marker.update();
|
||||
that.rectangle.deselect();
|
||||
}
|
||||
return that;
|
||||
};
|
||||
|
||||
that.update = function() {
|
||||
update();
|
||||
return that;
|
||||
};
|
||||
|
||||
that.undo = function() {
|
||||
Ox.forEach(that.original, function(v, k) {
|
||||
that[k] = v;
|
||||
});
|
||||
that.update();
|
||||
that.marker.update();
|
||||
that.rectangle.update();
|
||||
if (editable()) {
|
||||
Ox.forEach(that.original, function(v, k) {
|
||||
that[k] = v;
|
||||
});
|
||||
that.update();
|
||||
that.marker.update();
|
||||
that.rectangle.update();
|
||||
}
|
||||
return that;
|
||||
};
|
||||
|
||||
return that;
|
||||
|
@ -10455,7 +10498,7 @@ requires
|
|||
setOptions();
|
||||
|
||||
function click() {
|
||||
if (!that.place.editing) {
|
||||
if (that.map.options('editable') && that.place.editable && !that.place.editing) {
|
||||
that.place.edit();
|
||||
} else if (that.map.getKey() == 'meta') {
|
||||
that.place.submit();
|
||||
|
@ -10553,6 +10596,7 @@ requires
|
|||
}
|
||||
|
||||
function drag(e) {
|
||||
// fixme: implement shift+drag (center stays the same)
|
||||
Ox.print(e.pixel.x, e.pixel.y)
|
||||
var lat = Ox.limit(e.latLng.lat(), Ox.MIN_LATITUDE, Ox.MAX_LATITUDE),
|
||||
lng = e.latLng.lng();
|
||||
|
|
15
demos/listmap/index.html
Normal file
15
demos/listmap/index.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>ox.js listmap demo</title
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../build/css/ox.ui.css"/>
|
||||
<script src="../../build/js/jquery-1.5.js"></script>
|
||||
<script src="../../build/js/ox.js"></script>
|
||||
<script src="../../build/js/ox.map.js"></script>
|
||||
<script src="../../build/js/ox.ui.js"></script>
|
||||
<script src="js/listmap.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
48
demos/listmap/js/listmap.js
Normal file
48
demos/listmap/js/listmap.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
$(function() {
|
||||
Ox.theme('modern');
|
||||
var listmap = new Ox.ListMap({
|
||||
height: window.innerHeight,
|
||||
places: [
|
||||
{
|
||||
editable: true,
|
||||
flag: 'UK',
|
||||
geoname: 'Westminster, London, UK',
|
||||
id: '0',
|
||||
name: 'London',
|
||||
//lat: 51.5001524,
|
||||
lat: 51.52670875,
|
||||
lng: -0.1262362,
|
||||
south: 51.3493528,
|
||||
west: -0.378358,
|
||||
north: 51.7040647,
|
||||
east: 0.1502295
|
||||
},
|
||||
{
|
||||
editable: false,
|
||||
flag: 'FR',
|
||||
geoname: 'Paris, France',
|
||||
id: '1',
|
||||
name: 'Paris',
|
||||
lat: 48.8566667,
|
||||
lng: 2.3509871,
|
||||
south: 48.8155414,
|
||||
west: 2.2241006,
|
||||
north: 48.9021461,
|
||||
east: 2.4699099,
|
||||
}
|
||||
],
|
||||
width: window.innerWidth
|
||||
})
|
||||
.appendTo($('body'));
|
||||
|
||||
$(window).resize(function() {
|
||||
Ox.print('RESIZE', window.innerHeight)
|
||||
listmap.options({
|
||||
height: window.innerHeight,
|
||||
width: window.innerWidth
|
||||
});
|
||||
});
|
||||
|
||||
window.listmap = listmap;
|
||||
|
||||
});
|
|
@ -1,95 +1,110 @@
|
|||
$(function() {
|
||||
|
||||
var width = window.innerWidth - 256,
|
||||
height = window.innerHeight,
|
||||
map = new Ox.Map({
|
||||
clickable: true,
|
||||
height: height,
|
||||
/*
|
||||
places: Ox.COUNTRIES.map(function(country) {
|
||||
return country.name;
|
||||
}),
|
||||
*/
|
||||
places: [
|
||||
{
|
||||
flag: 'UK',
|
||||
geoname: 'Westminster, London, UK',
|
||||
name: 'London',
|
||||
//lat: 51.5001524,
|
||||
lat: 51.52670875,
|
||||
lng: -0.1262362,
|
||||
south: 51.3493528,
|
||||
west: -0.378358,
|
||||
north: 51.7040647,
|
||||
east: 0.1502295
|
||||
},
|
||||
{
|
||||
flag: 'FR',
|
||||
geoname: 'Paris, France',
|
||||
name: 'Paris',
|
||||
lat: 48.8566667,
|
||||
lng: 2.3509871,
|
||||
south: 48.8155414,
|
||||
west: 2.2241006,
|
||||
north: 48.9021461,
|
||||
east: 2.4699099,
|
||||
}
|
||||
],
|
||||
statusbar: true,
|
||||
toolbar: true,
|
||||
width: width,
|
||||
zoombar: true
|
||||
})
|
||||
.bindEvent({
|
||||
selectplace: function(event, data) {
|
||||
Ox.print('DATA', data)
|
||||
panel.replaceElement(1, list = new Ox.TreeList({
|
||||
data: Ox.isEmpty(data) ? [] : {
|
||||
components: data.components,
|
||||
countryCode: data.countryCode,
|
||||
crossesDateline: data.crossesDateline(),
|
||||
east: data.east,
|
||||
fullGeoname: data.fullGeoname,
|
||||
geoname: data.geoname,
|
||||
lat: data.lat,
|
||||
lng: data.lng,
|
||||
name: data.name,
|
||||
north: data.north,
|
||||
size: data.size,
|
||||
sizeEastWest: data.sizeEastWest,
|
||||
sizeNorthSouth: data.sizeNorthSouth,
|
||||
south: data.south,
|
||||
west: data.west,
|
||||
types: data.types
|
||||
$.getJSON('json/countries.json', function(data) {
|
||||
|
||||
var width = window.innerWidth - 256,
|
||||
height = window.innerHeight,
|
||||
map = new Ox.Map({
|
||||
clickable: true,
|
||||
editable: true,
|
||||
height: height,
|
||||
places: data.map(function(place) {
|
||||
return Ox.extend({
|
||||
editable: true,
|
||||
geoname: place.name,
|
||||
name: place.name,
|
||||
south: place.south,
|
||||
west: place.west,
|
||||
north: place.north,
|
||||
east: place.east
|
||||
});
|
||||
}),
|
||||
/*
|
||||
[
|
||||
{
|
||||
editable: true,
|
||||
flag: 'UK',
|
||||
geoname: 'Westminster, London, UK',
|
||||
name: 'London',
|
||||
//lat: 51.5001524,
|
||||
lat: 51.52670875,
|
||||
lng: -0.1262362,
|
||||
south: 51.3493528,
|
||||
west: -0.378358,
|
||||
north: 51.7040647,
|
||||
east: 0.1502295
|
||||
},
|
||||
{
|
||||
editable: false,
|
||||
flag: 'FR',
|
||||
geoname: 'Paris, France',
|
||||
name: 'Paris',
|
||||
lat: 48.8566667,
|
||||
lng: 2.3509871,
|
||||
south: 48.8155414,
|
||||
west: 2.2241006,
|
||||
north: 48.9021461,
|
||||
east: 2.4699099,
|
||||
}
|
||||
}));
|
||||
}
|
||||
}),
|
||||
list = new Ox.TreeList({
|
||||
data: [],
|
||||
width: 256
|
||||
})
|
||||
panel = new Ox.SplitPanel({
|
||||
elements: [
|
||||
{
|
||||
element: map
|
||||
},
|
||||
{
|
||||
element: list,
|
||||
size: 256
|
||||
],
|
||||
*/
|
||||
statusbar: true,
|
||||
toolbar: true,
|
||||
width: width,
|
||||
zoombar: true
|
||||
})
|
||||
.bindEvent({
|
||||
selectplace: function(event, data) {
|
||||
Ox.print('DATA', data)
|
||||
panel.replaceElement(1, list = new Ox.TreeList({
|
||||
data: Ox.isEmpty(data) ? [] : {
|
||||
components: data.components,
|
||||
countryCode: data.countryCode,
|
||||
crossesDateline: data.crossesDateline(),
|
||||
east: data.east,
|
||||
fullGeoname: data.fullGeoname,
|
||||
geoname: data.geoname,
|
||||
lat: data.lat,
|
||||
lng: data.lng,
|
||||
name: data.name,
|
||||
north: data.north,
|
||||
size: data.size,
|
||||
sizeEastWest: data.sizeEastWest,
|
||||
sizeNorthSouth: data.sizeNorthSouth,
|
||||
south: data.south,
|
||||
west: data.west,
|
||||
types: data.types
|
||||
}
|
||||
}));
|
||||
}
|
||||
],
|
||||
orientation: 'horizontal'
|
||||
})
|
||||
.appendTo($('body'));
|
||||
|
||||
map.gainFocus();
|
||||
}),
|
||||
list = new Ox.TreeList({
|
||||
data: [],
|
||||
width: 256
|
||||
})
|
||||
panel = new Ox.SplitPanel({
|
||||
elements: [
|
||||
{
|
||||
element: map
|
||||
},
|
||||
{
|
||||
element: list,
|
||||
size: 256
|
||||
}
|
||||
],
|
||||
orientation: 'horizontal'
|
||||
})
|
||||
.appendTo($('body'));
|
||||
|
||||
$(window).resize(function() {
|
||||
map.options({
|
||||
height: window.innerHeight,
|
||||
width: window.innerWidth - 256
|
||||
map.gainFocus();
|
||||
|
||||
$(window).resize(function() {
|
||||
map.options({
|
||||
height: window.innerHeight,
|
||||
width: window.innerWidth - 256
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
3379
demos/map/json/countries.json
Normal file
3379
demos/map/json/countries.json
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue