labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simo...@apache.org
Subject svn commit: r903363 - in /labs/magma/trunk/website-maps-google/src/main/resources/org/apache/magma/website/maps: mapDisplay.js mapEditor.js
Date Tue, 26 Jan 2010 18:54:01 GMT
Author: simoneg
Date: Tue Jan 26 18:54:01 2010
New Revision: 903363

URL: http://svn.apache.org/viewvc?rev=903363&view=rev
Log:
Compatibility with ie/safari

Modified:
    labs/magma/trunk/website-maps-google/src/main/resources/org/apache/magma/website/maps/mapDisplay.js
    labs/magma/trunk/website-maps-google/src/main/resources/org/apache/magma/website/maps/mapEditor.js

Modified: labs/magma/trunk/website-maps-google/src/main/resources/org/apache/magma/website/maps/mapDisplay.js
URL: http://svn.apache.org/viewvc/labs/magma/trunk/website-maps-google/src/main/resources/org/apache/magma/website/maps/mapDisplay.js?rev=903363&r1=903362&r2=903363&view=diff
==============================================================================
--- labs/magma/trunk/website-maps-google/src/main/resources/org/apache/magma/website/maps/mapDisplay.js
(original)
+++ labs/magma/trunk/website-maps-google/src/main/resources/org/apache/magma/website/maps/mapDisplay.js
Tue Jan 26 18:54:01 2010
@@ -321,6 +321,16 @@
 DirectionsPolyline.prototype.initialize = function(map) {
 	if (!this.map && this.delegateOverlay) {
 		map.addOverlay(this.delegateOverlay);
+		var me = this;
+		GEvent.addListener(this.delegateOverlay, 'click', function(latlng) {
+			GEvent.trigger(me, 'click', latlng);
+		});
+		GEvent.addListener(this.delegateOverlay, 'mouseover', function() {
+			GEvent.trigger(me, 'mouseover');
+		});
+		GEvent.addListener(this.delegateOverlay, 'mouseout', function() {
+			GEvent.trigger(me, 'mouseout');
+		});
 	}
 	this.map = map;
 }

Modified: labs/magma/trunk/website-maps-google/src/main/resources/org/apache/magma/website/maps/mapEditor.js
URL: http://svn.apache.org/viewvc/labs/magma/trunk/website-maps-google/src/main/resources/org/apache/magma/website/maps/mapEditor.js?rev=903363&r1=903362&r2=903363&view=diff
==============================================================================
--- labs/magma/trunk/website-maps-google/src/main/resources/org/apache/magma/website/maps/mapEditor.js
(original)
+++ labs/magma/trunk/website-maps-google/src/main/resources/org/apache/magma/website/maps/mapEditor.js
Tue Jan 26 18:54:01 2010
@@ -35,6 +35,7 @@
 	  this.counters = { line:0, poly: 0, point: 0, route: 0};
 	  
 	  this.editingNow = false;
+	  this.editShape = null;
 	  this.mode = '';
 	  
 	  if (this.dom.field) this.parseGeometries(this.dom.field.value);
@@ -67,7 +68,10 @@
 		me.addGeometry(new_geometry);
 		me.map.addOverlay(new_geometry.overlay);
 		new_geometry.startEditing();
-		if (me.mode != 'point') me.editingNow = true;
+		if (me.mode != 'point') {
+			me.editShape = new_geometry;
+			me.editingNow = true;
+		}
 	});
 	me.addEditingUI();
 }
@@ -97,7 +101,7 @@
 		actionCell.setAttribute("class", "actioncell");
 		actionCell.setAttribute("className", "actioncell"); 		
 		
-		var closelink = $('<a class="ui-icon ui-icon-closethick"></a>');
+		var closelink = $('<span class="ui-icon ui-icon-closethick"></span>');
 		closelink[0].geometry = geometry;
 		closelink.click(function () {
 			GEvent.trigger(this.geometry, 'delete');
@@ -171,6 +175,10 @@
 				geometry.overlay.disableEditing();
 			});
 		}
+		
+		if (geometry.type == 'route') {
+			geometry.overlay.setupListeners();
+		}
 	  
 }
 
@@ -238,6 +246,13 @@
 	  
 	}
 
+MapEditor.prototype.endEdit = function() {
+	if (this.editShape != null) {
+		GEvent.trigger(this.editShape.overlay, 'endline');
+		this.editShape.overlay.disableEditing();
+	}
+	this.editShape = null;
+}
 
 MapEditor.prototype.addEditingUI = function() {
 	  var me = this;
@@ -255,28 +270,28 @@
 	  this.map.enableGoogleBar();
 
 	  GEvent.addListener(edit_control, 'view', function() {
+		  me.endEdit();
 	    me.mode = 'view';
-	    me.editingNow = false;
 	    status_control.setText('Select geometries by clicking on them.');
 	  });
 	  GEvent.addListener(edit_control, 'point', function() {
+		  me.endEdit();
 	    me.mode = 'point';
-	    me.editingNow = false;
 	    status_control.setText('Click on the map to create a new marker.');
 	  });
 	  GEvent.addListener(edit_control, 'line', function() {
+		  me.endEdit();
 	    me.mode = 'line';
-	    me.editingNow = false;
 	    status_control.setText('Click on the map to start creating a new line.');
 	  });
 	  GEvent.addListener(edit_control, 'route', function() {
+		  me.endEdit();
 		    me.mode = 'route';
-		    me.editingNow = false;
 		    status_control.setText('Click on the map to start creating a new route line.');
 		  });
 	  GEvent.addListener(edit_control, 'poly', function() {
+		  me.endEdit();
 	    me.mode = 'poly';
-	    me.editingNow = false;
 	    status_control.setText('Click on the map to start creating a new filled poly.');
 	  });
 }
@@ -520,11 +535,13 @@
 		this.markers.push(mark);
 		var coords = this.geometry.coordinates[i];
 		mark.coordindex = i;
-		var route = this.directions.getRoute(i);
-		if (route) {
-			var step = route.getStep(0);
-			mark.vertexindex = step.getPolylineIndex() + 1;
-		}
+		try {
+			var route = this.directions.getRoute(i);
+			if (route) {
+				var step = route.getStep(0);
+				mark.vertexindex = step.getPolylineIndex() + 1;
+			}
+		} catch (e) {}
 		this.addEditMarkerListeners(mark);
 	}	
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message