Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.1 #244

Open
wants to merge 5 commits into
base: release-2.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions source/mxn.googlev3.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ Mapstraction: {
myOptions.overviewMapControlOptions = {opened: true};
}
}

var map = new google.maps.Map(element, myOptions);

var fireOnNextIdle = [];

google.maps.event.addListener(map, 'idle', function() {
var fireListCount = fireOnNextIdle.length;
if (fireListCount > 0) {
Expand All @@ -72,16 +72,16 @@ Mapstraction: {
}
}
});

// deal with click
google.maps.event.addListener(map, 'click', function(location){
me.click.fire({'location':
new mxn.LatLonPoint(location.latLng.lat(),location.latLng.lng())
});
google.maps.event.addListener(map, 'click', function(event) {
me.click.fire({'location': new mxn.LatLonPoint(event.latLng.lat(),event.latLng.lng()),
'event' : event
});
});

// deal with zoom change
google.maps.event.addListener(map, 'zoom_changed', function(){
google.maps.event.addListener(map, 'zoom_changed', function() {
// zoom_changed fires before the zooming has finished so we
// wait for the next idle event before firing our changezoom
// so that method calls report the correct values
Expand Down
44 changes: 23 additions & 21 deletions source/mxn.googlev3.geocoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ Geocoder: {
if (query.hasOwnProperty('lat') && query.hasOwnProperty('lon')) {
geocode_request_object.latLng = query.toProprietary(this.api);
}
// query is an address object
else{
else {
// query is an address object
geocode_request_object.address = [ query.street, query.locality, query.region, query.country ].join(', ');
}
}

// query is an address string
else {
// query is an address string
geocode_request_object.address = query;
}

Expand All @@ -33,8 +32,7 @@ Geocoder: {
geocode_callback: function(results, status){
if (status != google.maps.GeocoderStatus.OK) {
this.error_callback(status);
}

}
else {
var places = [];

Expand All @@ -44,45 +42,49 @@ Geocoder: {
// lookups; multiple values 'may' be returned but only where there is ambiguity
// See https://developers.google.com/maps/documentation/geocoding/#JSON

for (i=0; i<results.length; i++) {
place = results[i];
var streetparts = [];
var return_location = {};
for (var i = 0; i < results.length; i++) {
var place = results[i],
streetparts = [],
return_location = {};

for (var k = 0; k < place.address_components.length; k++) {
var addressComponent = place.address_components[k];
for (var j = 0; j < addressComponent.types.length; j++) {
var componentType = addressComponent.types[j];
switch (componentType) {
case 'country':
return_location.country = addressComponent.long_name;
break;
case 'administrative_area_level_1':
return_location.region = addressComponent.long_name;
break;
case 'country':
return_location.country = addressComponent.long_name;
break;
case 'locality':
return_location.locality = addressComponent.long_name;
break;
case 'street_address':
return_location.street = addressComponent.long_name;
break;
case 'postal_code':
return_location.postcode = addressComponent.long_name;
break;
case 'route':
streetparts.push(addressComponent.long_name);
break;
case 'street_address':
return_location.street = addressComponent.long_name;
break;
case 'street_number':
streetparts.unshift(addressComponent.long_name);
break;
case 'route':
streetparts.push(addressComponent.long_name);
// ----------------------
case 'administrative_area_level_3':
case 'political':
default:
break;
}
}
}

if (return_location.street === '' && streetparts.length > 0) {
if ((return_location.street === undefined) && (streetparts.length > 0)) {
return_location.street = streetparts.join(' ');
}

return_location.point = new mxn.LatLonPoint(place.geometry.location.lat(), place.geometry.location.lng());

places.push(return_location);
Expand All @@ -101,4 +103,4 @@ Geocoder: {
}
}

});
});
13 changes: 7 additions & 6 deletions source/mxn.openlayers.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,32 +66,33 @@ mxn.register('openlayers', {
displayOutsideMaxExtent: true
}
);

// deal with click
map.events.register('click', map, function(evt){
var lonlat = map.getLonLatFromViewPortPx(evt.xy);
var point = new mxn.LatLonPoint();
point.fromProprietary(api, lonlat);
me.click.fire({'location': point });
me.click.fire({'location': point,
'event' : evt});
});

// deal with zoom change
map.events.register('zoomend', map, function(evt){
me.changeZoom.fire();
});

// deal with map movement
map.events.register('moveend', map, function(evt){
me.moveendHandler(me);
me.endPan.fire();
});

// deal with initial tile loading
var loadfire = function(e) {
me.load.fire();
this.events.unregister('loadend', this, loadfire);
};

for (var layerName in this.layers) {
if (this.layers.hasOwnProperty(layerName)) {
if (this.layers[layerName].visibility === true) {
Expand Down Expand Up @@ -726,7 +727,7 @@ mxn.register('openlayers', {
this.popup.autoSize = true;
this.popup.panMapIfOutOfView = true;
this.popup.fixedRelativePosition = false;
this.popup.feature = this.propriety_marker;
this.popup.feature = this.proprietary_marker;
}

if (!!this.popup) {
Expand Down
7 changes: 4 additions & 3 deletions source/mxn.ovi.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ Mapstraction: {
// Handle click event
ovi_map.addListener('click', function(event){
coords = ovi_map.pixelToGeo(event.targetX, event.targetY);
me.click.fire({'location': new mxn.LatLonPoint(coords.latitude, coords.longitude)});
me.click.fire({'location': new mxn.LatLonPoint(coords.latitude, coords.longitude),
'event' : event});
}, false);

// Handle endPan (via centre change) and zoom events
Expand Down Expand Up @@ -402,7 +403,7 @@ Marker: {
toProprietary: function() {
var properties = {};
var self = this;

if (this.iconAnchor) {
properties.anchor = [this.iconAnchor[0], this.iconAnchor[1]];
}
Expand Down Expand Up @@ -537,7 +538,7 @@ Polyline: {
else {
var polyline_options = {
'visibility' : true,
'color' : this.color,
'color' : (this.color + (this.opacity * 255).toString(16)),
'stroke' : 'solid',
'width' : this.width
};
Expand Down