From 7dca63c594a3dc67581803ed29166c708bcec57e Mon Sep 17 00:00:00 2001 From: thegecko Date: Fri, 3 Jan 2014 19:53:16 +0000 Subject: [PATCH 1/3] Added drastart and dragend events to google and googlev3 --- source/mxn.core.js | 4 +++- source/mxn.google.core.js | 7 +++++++ source/mxn.googlev3.core.js | 11 ++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/source/mxn.core.js b/source/mxn.core.js index 2660819..cba8cba 100644 --- a/source/mxn.core.js +++ b/source/mxn.core.js @@ -1393,7 +1393,9 @@ var Marker = mxn.Marker = function(point) { mxn.addEvents(this, [ 'openInfoBubble', // Info bubble opened 'closeInfoBubble', // Info bubble closed - 'click' // Marker clicked + 'click', // Marker clicked + 'dragstart', // Marker drag begin + 'dragend' // Marker drag end ]); }; diff --git a/source/mxn.google.core.js b/source/mxn.google.core.js index 598b70c..d5666b0 100644 --- a/source/mxn.google.core.js +++ b/source/mxn.google.core.js @@ -147,6 +147,13 @@ Mapstraction: { GEvent.addListener(gpin, 'infowindowclose', function() { marker.closeInfoBubble.fire(); }); + GEvent.addListener(gpin, 'dragstart', function() { + marker.dragstart.fire(); + }); + GEvent.addListener(gpin, 'dragend', function() { + marker.dragend.fire(); + }); + return gpin; }, diff --git a/source/mxn.googlev3.core.js b/source/mxn.googlev3.core.js index 44ea72c..0864586 100644 --- a/source/mxn.googlev3.core.js +++ b/source/mxn.googlev3.core.js @@ -214,7 +214,16 @@ Mapstraction: { }, addMarker: function(marker, old) { - return marker.toProprietary(this.api); + var gpin = marker.toProprietary(this.api); + + google.maps.event.addListener(gpin, 'dragstart', function() { + marker.dragstart.fire(); + }); + google.maps.event.addListener(gpin, 'dragend', function() { + marker.dragend.fire(); + }); + + return gpin; }, removeMarker: function(marker) { From 8aab8284b832c9e742f00a0394f0a50778ab1cf1 Mon Sep 17 00:00:00 2001 From: thegecko Date: Fri, 3 Jan 2014 21:37:17 +0000 Subject: [PATCH 2/3] Added Marker.updateIcon() functionality to google and googlev3 --- source/mxn.(provider).core.js | 11 +++++++++-- source/mxn.cloudmade.core.js | 6 +++++- source/mxn.core.js | 12 +++++++++++- source/mxn.geocommons.core.js | 4 ++++ source/mxn.google.core.js | 6 ++++++ source/mxn.googleearth.core.js | 4 ++++ source/mxn.googlev3.core.js | 13 +++++++++++++ source/mxn.leaflet.core.js | 4 ++++ source/mxn.microsoft.core.js | 4 ++++ source/mxn.microsoft7.core.js | 4 ++++ source/mxn.openlayers.core.js | 4 ++++ source/mxn.openmq.core.js | 4 ++++ source/mxn.openspace.core.js | 4 ++++ source/mxn.ovi.core.js | 4 ++++ source/mxn.yahoo.core.js | 4 ++++ source/mxn.yandex.core.js | 4 ++++ 16 files changed, 88 insertions(+), 4 deletions(-) diff --git a/source/mxn.(provider).core.js b/source/mxn.(provider).core.js index e1b8c65..e74f88b 100644 --- a/source/mxn.(provider).core.js +++ b/source/mxn.(provider).core.js @@ -260,12 +260,20 @@ Marker: { update: function() { // TODO: Add provider code + }, + + updateIcon: function(iconUrl, iconSize) { + // TODO: Add provider code } }, Polyline: { + fromProprietary: function(propPolyline) { + // TODO: Add provider code + }, + toProprietary: function() { // TODO: Add provider code }, @@ -276,8 +284,7 @@ Polyline: { hide: function() { // TODO: Add provider code - } - + } } }); \ No newline at end of file diff --git a/source/mxn.cloudmade.core.js b/source/mxn.cloudmade.core.js index 6254f36..1cacd8c 100644 --- a/source/mxn.cloudmade.core.js +++ b/source/mxn.cloudmade.core.js @@ -334,8 +334,12 @@ mxn.register('cloudmade', { update: function() { // TODO: Add provider code - } + }, + updateIcon: function(iconUrl, iconSize) { + // TODO: Add provider code + } + }, Polyline: { diff --git a/source/mxn.core.js b/source/mxn.core.js index cba8cba..7687289 100644 --- a/source/mxn.core.js +++ b/source/mxn.core.js @@ -1451,7 +1451,17 @@ mxn.addProxyMethods(Marker, [ * @name mxn.Marker#update * @function */ - 'update' + 'update', + + /** + * Updates the current Marker to use a different image. + * @name mxn.Marker#updateIcon + * @function + * @param {String} iconUrl The URL of the image you want to be the icon + * @param {String} iconSize The size of the icon image + */ + 'updateIcon' + ]); Marker.prototype.setChild = function(some_proprietary_marker) { diff --git a/source/mxn.geocommons.core.js b/source/mxn.geocommons.core.js index 6041458..dc4644d 100644 --- a/source/mxn.geocommons.core.js +++ b/source/mxn.geocommons.core.js @@ -305,6 +305,10 @@ mxn.register('geocommons', { update: function() { // TODO: Add provider code + }, + + updateIcon: function(iconUrl, iconSize) { + // TODO: Add provider code } }, diff --git a/source/mxn.google.core.js b/source/mxn.google.core.js index d5666b0..3c70228 100644 --- a/source/mxn.google.core.js +++ b/source/mxn.google.core.js @@ -499,6 +499,12 @@ Marker: { point = new mxn.LatLonPoint(); point.fromProprietary('google', this.proprietary_marker.getPoint()); this.location = point; + }, + + updateIcon: function(iconUrl, iconSize) { + if (iconUrl) { + this.proprietary_marker.setImage(iconUrl); + } } }, diff --git a/source/mxn.googleearth.core.js b/source/mxn.googleearth.core.js index b2699a3..8081ea4 100644 --- a/source/mxn.googleearth.core.js +++ b/source/mxn.googleearth.core.js @@ -313,6 +313,10 @@ Marker: { update: function() { // TODO: Add provider code + }, + + updateIcon: function(iconUrl, iconSize) { + // TODO: Add provider code } }, diff --git a/source/mxn.googlev3.core.js b/source/mxn.googlev3.core.js index 0864586..1b0121b 100644 --- a/source/mxn.googlev3.core.js +++ b/source/mxn.googlev3.core.js @@ -595,6 +595,19 @@ Marker: { var point = new mxn.LatLonPoint(); point.fromProprietary('googlev3', this.proprietary_marker.getPosition()); this.location = point; + }, + + updateIcon: function(iconUrl, iconSize) { + var icon = this.proprietary_marker.getIcon(); + + if (iconUrl) { + icon.url = iconUrl; + } + if (iconSize) { + icon.size = new google.maps.Size(iconSize[0], iconSize[1]); + } + + this.proprietary_marker.setIcon(icon); } }, diff --git a/source/mxn.leaflet.core.js b/source/mxn.leaflet.core.js index fb9c5bb..f05957f 100644 --- a/source/mxn.leaflet.core.js +++ b/source/mxn.leaflet.core.js @@ -338,6 +338,10 @@ Marker: { update: function() { throw 'Not implemented'; + }, + + updateIcon: function(iconUrl, iconSize) { + throw 'Not implemented'; } }, diff --git a/source/mxn.microsoft.core.js b/source/mxn.microsoft.core.js index 9b6d820..5396d48 100644 --- a/source/mxn.microsoft.core.js +++ b/source/mxn.microsoft.core.js @@ -363,6 +363,10 @@ Marker: { var point = new mxn.LatLonPoint(this.proprietary_marker.Latitude,this.proprietary_marker.Longitude); this.location = point; + }, + + updateIcon: function(iconUrl, iconSize) { + // TODO: Add provider code } }, diff --git a/source/mxn.microsoft7.core.js b/source/mxn.microsoft7.core.js index 00adaef..779dc71 100644 --- a/source/mxn.microsoft7.core.js +++ b/source/mxn.microsoft7.core.js @@ -395,6 +395,10 @@ Marker: { var loc = this.proprietary_marker.getLocation(); var point = new mxn.LatLonPoint(loc.latitude, loc.longitude); this.location = point; + }, + + updateIcon: function(iconUrl, iconSize) { + // TODO: Add provider code } }, diff --git a/source/mxn.openlayers.core.js b/source/mxn.openlayers.core.js index f65b766..22e6fd8 100644 --- a/source/mxn.openlayers.core.js +++ b/source/mxn.openlayers.core.js @@ -565,6 +565,10 @@ mxn.register('openlayers', { update: function() { // TODO: Add provider code + }, + + updateIcon: function(iconUrl, iconSize) { + // TODO: Add provider code } }, diff --git a/source/mxn.openmq.core.js b/source/mxn.openmq.core.js index 2befe4c..9aefbe7 100644 --- a/source/mxn.openmq.core.js +++ b/source/mxn.openmq.core.js @@ -310,6 +310,10 @@ Marker: { update: function() { // TODO: Add provider code + }, + + updateIcon: function(iconUrl, iconSize) { + // TODO: Add provider code } }, diff --git a/source/mxn.openspace.core.js b/source/mxn.openspace.core.js index 83b1c29..0e2ac98 100644 --- a/source/mxn.openspace.core.js +++ b/source/mxn.openspace.core.js @@ -390,6 +390,10 @@ Marker: { update: function() { // TODO: Add provider code + }, + + updateIcon: function(iconUrl, iconSize) { + // TODO: Add provider code } }, diff --git a/source/mxn.ovi.core.js b/source/mxn.ovi.core.js index 690de72..290d83b 100644 --- a/source/mxn.ovi.core.js +++ b/source/mxn.ovi.core.js @@ -438,6 +438,10 @@ Marker: { update: function() { throw 'Not implemented'; + }, + + updateIcon: function(iconUrl, iconSize) { + throw 'Not implemented'; } }, diff --git a/source/mxn.yahoo.core.js b/source/mxn.yahoo.core.js index 9c3eeff..91e3603 100644 --- a/source/mxn.yahoo.core.js +++ b/source/mxn.yahoo.core.js @@ -363,6 +363,10 @@ Marker: { update: function() { throw 'Not implemented'; + }, + + updateIcon: function(iconUrl, iconSize) { + throw 'Not implemented'; } }, diff --git a/source/mxn.yandex.core.js b/source/mxn.yandex.core.js index 9284147..94f4c74 100644 --- a/source/mxn.yandex.core.js +++ b/source/mxn.yandex.core.js @@ -466,6 +466,10 @@ Marker: { point = new mxn.LatLonPoint(); point.fromProprietary('yandex', this.proprietary_marker.getGeoPoint()); this.location = point; + }, + + updateIcon: function(iconUrl, iconSize) { + // TODO: Add provider code } }, From 465cd09cf85cad72bb9fa433f329162c9a729c81 Mon Sep 17 00:00:00 2001 From: thegecko Date: Sat, 11 Jan 2014 13:48:29 +0000 Subject: [PATCH 3/3] Added Marker.updateLocation() to be able to move the marker, includes google/googlev3 implementation --- source/mxn.(provider).core.js | 4 ++++ source/mxn.cloudmade.core.js | 4 ++++ source/mxn.core.js | 10 +++++++++- source/mxn.geocommons.core.js | 4 ++++ source/mxn.google.core.js | 5 +++++ source/mxn.googleearth.core.js | 4 ++++ source/mxn.googlev3.core.js | 5 +++++ source/mxn.leaflet.core.js | 4 ++++ source/mxn.microsoft.core.js | 4 ++++ source/mxn.microsoft7.core.js | 4 ++++ source/mxn.openlayers.core.js | 4 ++++ source/mxn.openmq.core.js | 4 ++++ source/mxn.openspace.core.js | 4 ++++ source/mxn.ovi.core.js | 4 ++++ source/mxn.yahoo.core.js | 4 ++++ source/mxn.yandex.core.js | 4 ++++ 16 files changed, 71 insertions(+), 1 deletion(-) diff --git a/source/mxn.(provider).core.js b/source/mxn.(provider).core.js index e74f88b..417ee70 100644 --- a/source/mxn.(provider).core.js +++ b/source/mxn.(provider).core.js @@ -264,6 +264,10 @@ Marker: { updateIcon: function(iconUrl, iconSize) { // TODO: Add provider code + }, + + updateLocation: function(point) { + // TODO: Add provider code } }, diff --git a/source/mxn.cloudmade.core.js b/source/mxn.cloudmade.core.js index 1cacd8c..09589d9 100644 --- a/source/mxn.cloudmade.core.js +++ b/source/mxn.cloudmade.core.js @@ -338,6 +338,10 @@ mxn.register('cloudmade', { updateIcon: function(iconUrl, iconSize) { // TODO: Add provider code + }, + + updateLocation: function(point) { + // TODO: Add provider code } }, diff --git a/source/mxn.core.js b/source/mxn.core.js index 7687289..ad9f3a1 100644 --- a/source/mxn.core.js +++ b/source/mxn.core.js @@ -1460,7 +1460,15 @@ mxn.addProxyMethods(Marker, [ * @param {String} iconUrl The URL of the image you want to be the icon * @param {String} iconSize The size of the icon image */ - 'updateIcon' + 'updateIcon', + + /** + * Updates the current Marker to use a different location point. + * @name mxn.Marker#updateLocation + * @function + * @param {LatLonPoint} point The new location + */ + 'updateLocation' ]); diff --git a/source/mxn.geocommons.core.js b/source/mxn.geocommons.core.js index dc4644d..be13ca2 100644 --- a/source/mxn.geocommons.core.js +++ b/source/mxn.geocommons.core.js @@ -309,6 +309,10 @@ mxn.register('geocommons', { updateIcon: function(iconUrl, iconSize) { // TODO: Add provider code + }, + + updateLocation: function(point) { + // TODO: Add provider code } }, diff --git a/source/mxn.google.core.js b/source/mxn.google.core.js index 3c70228..c728906 100644 --- a/source/mxn.google.core.js +++ b/source/mxn.google.core.js @@ -505,6 +505,11 @@ Marker: { if (iconUrl) { this.proprietary_marker.setImage(iconUrl); } + }, + + updateLocation: function(point) { + this.location = point; + this.proprietary_marker.setPoint(point.toProprietary('google')); } }, diff --git a/source/mxn.googleearth.core.js b/source/mxn.googleearth.core.js index 8081ea4..fae46d4 100644 --- a/source/mxn.googleearth.core.js +++ b/source/mxn.googleearth.core.js @@ -317,6 +317,10 @@ Marker: { updateIcon: function(iconUrl, iconSize) { // TODO: Add provider code + }, + + updateLocation: function(point) { + // TODO: Add provider code } }, diff --git a/source/mxn.googlev3.core.js b/source/mxn.googlev3.core.js index 1b0121b..2e584a7 100644 --- a/source/mxn.googlev3.core.js +++ b/source/mxn.googlev3.core.js @@ -608,6 +608,11 @@ Marker: { } this.proprietary_marker.setIcon(icon); + }, + + updateLocation: function(point) { + this.location = point; + this.proprietary_marker.setPosition(point.toProprietary('googlev3')); } }, diff --git a/source/mxn.leaflet.core.js b/source/mxn.leaflet.core.js index f05957f..15f020b 100644 --- a/source/mxn.leaflet.core.js +++ b/source/mxn.leaflet.core.js @@ -342,6 +342,10 @@ Marker: { updateIcon: function(iconUrl, iconSize) { throw 'Not implemented'; + }, + + updateLocation: function(point) { + throw 'Not implemented'; } }, diff --git a/source/mxn.microsoft.core.js b/source/mxn.microsoft.core.js index 5396d48..608ff5c 100644 --- a/source/mxn.microsoft.core.js +++ b/source/mxn.microsoft.core.js @@ -367,6 +367,10 @@ Marker: { updateIcon: function(iconUrl, iconSize) { // TODO: Add provider code + }, + + updateLocation: function(point) { + // TODO: Add provider code } }, diff --git a/source/mxn.microsoft7.core.js b/source/mxn.microsoft7.core.js index 779dc71..1bd4ba7 100644 --- a/source/mxn.microsoft7.core.js +++ b/source/mxn.microsoft7.core.js @@ -399,6 +399,10 @@ Marker: { updateIcon: function(iconUrl, iconSize) { // TODO: Add provider code + }, + + updateLocation: function(point) { + // TODO: Add provider code } }, diff --git a/source/mxn.openlayers.core.js b/source/mxn.openlayers.core.js index 22e6fd8..ad17a89 100644 --- a/source/mxn.openlayers.core.js +++ b/source/mxn.openlayers.core.js @@ -569,6 +569,10 @@ mxn.register('openlayers', { updateIcon: function(iconUrl, iconSize) { // TODO: Add provider code + }, + + updateLocation: function(point) { + // TODO: Add provider code } }, diff --git a/source/mxn.openmq.core.js b/source/mxn.openmq.core.js index 9aefbe7..22ca08f 100644 --- a/source/mxn.openmq.core.js +++ b/source/mxn.openmq.core.js @@ -314,6 +314,10 @@ Marker: { updateIcon: function(iconUrl, iconSize) { // TODO: Add provider code + }, + + updateLocation: function(point) { + // TODO: Add provider code } }, diff --git a/source/mxn.openspace.core.js b/source/mxn.openspace.core.js index 0e2ac98..d529f65 100644 --- a/source/mxn.openspace.core.js +++ b/source/mxn.openspace.core.js @@ -394,6 +394,10 @@ Marker: { updateIcon: function(iconUrl, iconSize) { // TODO: Add provider code + }, + + updateLocation: function(point) { + // TODO: Add provider code } }, diff --git a/source/mxn.ovi.core.js b/source/mxn.ovi.core.js index 290d83b..10104ca 100644 --- a/source/mxn.ovi.core.js +++ b/source/mxn.ovi.core.js @@ -442,6 +442,10 @@ Marker: { updateIcon: function(iconUrl, iconSize) { throw 'Not implemented'; + }, + + updateLocation: function(point) { + throw 'Not implemented'; } }, diff --git a/source/mxn.yahoo.core.js b/source/mxn.yahoo.core.js index 91e3603..d5d76ea 100644 --- a/source/mxn.yahoo.core.js +++ b/source/mxn.yahoo.core.js @@ -367,6 +367,10 @@ Marker: { updateIcon: function(iconUrl, iconSize) { throw 'Not implemented'; + }, + + updateLocation: function(point) { + throw 'Not implemented'; } }, diff --git a/source/mxn.yandex.core.js b/source/mxn.yandex.core.js index 94f4c74..cb578bb 100644 --- a/source/mxn.yandex.core.js +++ b/source/mxn.yandex.core.js @@ -470,6 +470,10 @@ Marker: { updateIcon: function(iconUrl, iconSize) { // TODO: Add provider code + }, + + updateLocation: function(point) { + // TODO: Add provider code } },