[Dojo-checkins] ttrenka - r3606 - in trunk: src/widget/html tests/widget

dojo-checkins-admin at dojotoolkit.org dojo-checkins-admin at dojotoolkit.org
Tue Apr 18 15:25:16 MDT 2006


Author: ttrenka
Date: Tue Apr 18 15:25:15 2006
New Revision: 3606

Modified:
   trunk/src/widget/html/GoogleMap.js
   trunk/tests/widget/test_GoogleMap.html
Log:
Tweaks.

Modified: trunk/src/widget/html/GoogleMap.js
==============================================================================
--- trunk/src/widget/html/GoogleMap.js	(original)
+++ trunk/src/widget/html/GoogleMap.js	Tue Apr 18 15:25:15 2006
@@ -12,8 +12,6 @@
 	var gm=dojo.widget.GoogleMap;
 
 	this.map=null;
-	this.center="";
-	this.zoom="12";
 	this.bounds=null;
 	this.plot=[];
 	this.points=[];
@@ -26,9 +24,6 @@
 	templateCssPath:null,
 
 	setControls:function(){
-		if(!this.map){
-			return;
-		}
 		var c=dojo.widget.GoogleMap.Controls;
 		for(var i=0; i<this.controls.length; i++){
 			var type=this.controls[i];
@@ -64,9 +59,6 @@
 		}
 	},
 	setMarkers:function(){
-		if(!this.map){
-			return;
-		}
 		for(var i=0; i<this.points.length; i++){
 			this.map.addOverlay(new GMarker(this.points[i]));
 		}
@@ -75,27 +67,17 @@
 		return new GLatLng(parseFloat(lat), parseFloat(long));
 	},
 	center:function(point, zoom){
-		if(this.map){
-			this.map.setCenter(point, zoom);
-		}
+		this.map.setCenter(point, zoom);
 	},
 	panTo:function(point){
-		if(this.map){
-			this.map.panTo(point);
-		}
+		this.map.panTo(point);
 	},
 	findCenter:function(){
-		if(!this.bounds){
-			this.bounds=new GLatLngBounds();
-		}
 		var clat=(this.bounds.getNorthEast().lat()+this.bounds.getSouthWest().lat())/2;
 		var clng=(this.bounds.getNorthEast().lng()+this.bounds.getSouthWest().lng())/2;
 		return new GLatLng(clat,clng);
 	},
 	findZoom:function(){
-		if(!this.bounds){
-			this.bounds=new GLatLngBounds();
-		}
 		return this.map.getBoundsZoomLevel(this.bounds);
 	},
 
@@ -103,17 +85,13 @@
 		if(!GMap2){
 			dojo.raise("dojo.widget.GoogleMap: The Google Map script must be included (with a proper API key) in order to use this widget.");
 		}
-		if(!this.bounds){
-			this.bounds=new GLatLngBounds();
-		}
+		this.bounds=new GLatLngBounds();
 		for(var i=0; i<this.plot.length; i++){
 			var a=this.plot[i].split(",");
 			var p=new GLatLng(parseFloat(a[0]),parseFloat(a[1]));
 			this.points.push(p);
 			this.bounds.extend(p);
 		}
-		this.domNode.style.position="relative";
-		
 		this.map=new GMap2(this.domNode);
 		this.setControls();
 		this.map.setCenter(this.findCenter(), this.findZoom());

Modified: trunk/tests/widget/test_GoogleMap.html
==============================================================================
--- trunk/tests/widget/test_GoogleMap.html	(original)
+++ trunk/tests/widget/test_GoogleMap.html	Tue Apr 18 15:25:15 2006
@@ -13,19 +13,18 @@
 	</script>
 	<style type="text/css">
 		#mapTest{
-			width:400px;
-			height:400px;
+			width:100%;
+			height:480px;
 			border:1px solid black;
 		}
 	</style>
 </head>
-<body style="padding: 50px;">
+<body>
+	<h1>Dojo Google Map Widget</h1>
 	<p>This is an example of the Dojo Google Map widget. Note that you have to include your own Google Map API script tag at the top of your document, with your own API key.</p>
 	<div dojoType="googlemap" 
-		plot="37.421890,-122.084692;37.331800,-122.029009;37.832912,-122.284055;37.688643,-121.703753;37.413775,-122.060369;37.434529,-122.161102"
-		center="37.4419,-122.1419"
-		zoom="12"
-		controls="smallmap;scale"
+		plot="37.4419,-122.14193;37.421890,-122.084692;37.331800,-122.029009;37.832912,-122.284055;37.688643,-121.703753;37.413775,-122.060369;37.434529,-122.161102"
+		controls="largemap;scale;maptype"
 		id="mapTest">
 	</div>
 	<p>HTML after</p>


More information about the Dojo-checkins mailing list