diff --git a/source/mxn.(provider).core.js b/source/mxn.(provider).core.js index e1b8c65..417ee70 100644 --- a/source/mxn.(provider).core.js +++ b/source/mxn.(provider).core.js @@ -260,12 +260,24 @@ Marker: { update: function() { // TODO: Add provider code + }, + + updateIcon: function(iconUrl, iconSize) { + // TODO: Add provider code + }, + + updateLocation: function(point) { + // TODO: Add provider code } }, Polyline: { + fromProprietary: function(propPolyline) { + // TODO: Add provider code + }, + toProprietary: function() { // TODO: Add provider code }, @@ -276,8 +288,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..09589d9 100644 --- a/source/mxn.cloudmade.core.js +++ b/source/mxn.cloudmade.core.js @@ -334,8 +334,16 @@ mxn.register('cloudmade', { update: function() { // TODO: Add provider code - } + }, + + updateIcon: function(iconUrl, iconSize) { + // TODO: Add provider code + }, + updateLocation: function(point) { + // TODO: Add provider code + } + }, Polyline: { diff --git a/source/mxn.core.js b/source/mxn.core.js index 2660819..ad9f3a1 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 ]); }; @@ -1449,7 +1451,25 @@ 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', + + /** + * Updates the current Marker to use a different location point. + * @name mxn.Marker#updateLocation + * @function + * @param {LatLonPoint} point The new location + */ + 'updateLocation' + ]); Marker.prototype.setChild = function(some_proprietary_marker) { diff --git a/source/mxn.geocommons.core.js b/source/mxn.geocommons.core.js index 6041458..be13ca2 100644 --- a/source/mxn.geocommons.core.js +++ b/source/mxn.geocommons.core.js @@ -305,6 +305,14 @@ mxn.register('geocommons', { update: function() { // TODO: Add provider code + }, + + 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 598b70c..c728906 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; }, @@ -492,6 +499,17 @@ 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); + } + }, + + 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 b2699a3..fae46d4 100644 --- a/source/mxn.googleearth.core.js +++ b/source/mxn.googleearth.core.js @@ -313,6 +313,14 @@ Marker: { update: function() { // TODO: Add provider code + }, + + 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 44ea72c..2e584a7 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) { @@ -586,6 +595,24 @@ 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); + }, + + 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 fb9c5bb..15f020b 100644 --- a/source/mxn.leaflet.core.js +++ b/source/mxn.leaflet.core.js @@ -338,6 +338,14 @@ Marker: { update: function() { throw 'Not implemented'; + }, + + 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 9b6d820..608ff5c 100644 --- a/source/mxn.microsoft.core.js +++ b/source/mxn.microsoft.core.js @@ -363,6 +363,14 @@ 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 + }, + + updateLocation: function(point) { + // TODO: Add provider code } }, diff --git a/source/mxn.microsoft7.core.js b/source/mxn.microsoft7.core.js index 00adaef..1bd4ba7 100644 --- a/source/mxn.microsoft7.core.js +++ b/source/mxn.microsoft7.core.js @@ -395,6 +395,14 @@ 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 + }, + + updateLocation: function(point) { + // TODO: Add provider code } }, diff --git a/source/mxn.openlayers.core.js b/source/mxn.openlayers.core.js index f65b766..ad17a89 100644 --- a/source/mxn.openlayers.core.js +++ b/source/mxn.openlayers.core.js @@ -565,6 +565,14 @@ mxn.register('openlayers', { update: function() { // TODO: Add provider code + }, + + 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 2befe4c..22ca08f 100644 --- a/source/mxn.openmq.core.js +++ b/source/mxn.openmq.core.js @@ -310,6 +310,14 @@ Marker: { update: function() { // TODO: Add provider code + }, + + 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 83b1c29..d529f65 100644 --- a/source/mxn.openspace.core.js +++ b/source/mxn.openspace.core.js @@ -390,6 +390,14 @@ Marker: { update: function() { // TODO: Add provider code + }, + + 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 690de72..10104ca 100644 --- a/source/mxn.ovi.core.js +++ b/source/mxn.ovi.core.js @@ -438,6 +438,14 @@ Marker: { update: function() { throw 'Not implemented'; + }, + + 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 9c3eeff..d5d76ea 100644 --- a/source/mxn.yahoo.core.js +++ b/source/mxn.yahoo.core.js @@ -363,6 +363,14 @@ Marker: { update: function() { throw 'Not implemented'; + }, + + 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 9284147..cb578bb 100644 --- a/source/mxn.yandex.core.js +++ b/source/mxn.yandex.core.js @@ -466,6 +466,14 @@ Marker: { point = new mxn.LatLonPoint(); point.fromProprietary('yandex', this.proprietary_marker.getGeoPoint()); this.location = point; + }, + + updateIcon: function(iconUrl, iconSize) { + // TODO: Add provider code + }, + + updateLocation: function(point) { + // TODO: Add provider code } },