update map (for arctic/antartic results)

This commit is contained in:
rolux 2011-06-14 11:29:31 +02:00
parent 8acccb5cd1
commit 23c50a1d01
2 changed files with 14 additions and 6 deletions

View file

@ -851,22 +851,30 @@ Ox.Map = function(options, self) {
function parseGeodata(data) { function parseGeodata(data) {
var bounds = data.geometry.bounds || data.geometry.viewport, var bounds = data.geometry.bounds || data.geometry.viewport,
northEast = bounds.getNorthEast(),
southWest = bounds.getSouthWest(),
place = { place = {
alternativeNames: [], alternativeNames: [],
components: data.address_components, components: data.address_components,
countryCode: getCountryCode(data.address_components), countryCode: getCountryCode(data.address_components),
east: bounds.getNorthEast().lng(), east: northEast.lng(),
editable: self.options.editable, editable: self.options.editable,
fullGeoname: getFullGeoname(data.address_components), fullGeoname: getFullGeoname(data.address_components),
geoname: data.formatted_address, geoname: data.formatted_address,
id: '_' + Ox.encodeBase32(Ox.uid()), id: '_' + Ox.encodeBase32(Ox.uid()),
map: that, map: that,
name: data.formatted_address.split(', ')[0], name: data.formatted_address.split(', ')[0],
north: bounds.getNorthEast().lat(), north: northEast.lat(),
south: bounds.getSouthWest().lat(), south: southWest.lat(),
type: getType(data.address_components[0].types), type: getType(data.address_components[0].types),
west: bounds.getSouthWest().lng() west: southWest.lng()
}; };
if (place.west == -180 && place.east == 180) {
place.west = -179.99999999;
place.east = 179.99999999;
}
place.south = Ox.limit(place.south, Ox.MIN_LATITUDE, Ox.MAX_LATITUDE);
place.north = Ox.limit(place.north, Ox.MIN_LATITUDE, Ox.MAX_LATITUDE);
function getCountryCode(components) { function getCountryCode(components) {
countryCode = ''; countryCode = '';
Ox.forEach(components, function(component) { Ox.forEach(components, function(component) {

View file

@ -2388,8 +2388,8 @@ Ox.formatDateRange = function(start, end, utc) {
/*@ /*@
Ox.formatDateRangeDuration <f> Formats the duration of a date range as a string Ox.formatDateRangeDuration <f> Formats the duration of a date range as a string
A date range is a pair of arbitrary-presicion date strings A date range is a pair of arbitrary-presicion date strings
> Ox.formatDateRangeDuration('2000-01-01 00:00:00', '2001-01-03 03:04:05') > Ox.formatDateRangeDuration('2000-01-01 00:00:00', '2001-03-04 04:05:06')
'1 year 2 days 3 hours 4 minutes 5 seconds' '1 year 2 months 3 days 4 hours 5 minutes 6 seconds'
> Ox.formatDateRangeDuration('1999', '2000', true) > Ox.formatDateRangeDuration('1999', '2000', true)
'1 year' '1 year'
> Ox.formatDateRangeDuration('2000', '2001', true) > Ox.formatDateRangeDuration('2000', '2001', true)