diff --git a/google.html b/google.html new file mode 100644 index 0000000000..17fb22024d --- /dev/null +++ b/google.html @@ -0,0 +1,40 @@ + + + + + + + + + +

OpenLayers Example

+
+ + diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js index a9047f9ec9..ecdd363d7a 100644 --- a/lib/OpenLayers.js +++ b/lib/OpenLayers.js @@ -41,6 +41,7 @@ catch(e){ "OpenLayers/Layer.js", "OpenLayers/Tile.js", "OpenLayers/Tile/Image.js", + "OpenLayers/Layer/Google.js", "OpenLayers/Layer/Grid.js", "OpenLayers/Layer/WMS.js", "OpenLayers/Control.js", diff --git a/lib/OpenLayers/Layer.js b/lib/OpenLayers/Layer.js index 56119d863d..b5426f0682 100644 --- a/lib/OpenLayers/Layer.js +++ b/lib/OpenLayers/Layer.js @@ -15,6 +15,9 @@ OpenLayers.Layer.prototype = { */ initialize: function(name) { this.name = name; + this.div = OpenLayers.Util.createDiv(); + this.div.style.width="100%"; + this.div.style.height="100%"; }, /** diff --git a/lib/OpenLayers/Layer/Google.js b/lib/OpenLayers/Layer/Google.js new file mode 100644 index 0000000000..d304c5351f --- /dev/null +++ b/lib/OpenLayers/Layer/Google.js @@ -0,0 +1,17 @@ +OpenLayers.Layer.Google = Class.create(); +OpenLayers.Layer.Google.prototype = Object.extend( new OpenLayers.Layer(), { + // gmap stores the Google Map element + gmap:null, + initialize: function(name) { + OpenLayers.Layer.prototype.initialize.apply(this, [name]); + this.gmap = new GMap2(this.div); + }, + moveTo: function() { + center = this.map.getCenter(); + this.gmap.setCenter( + new GLatLng(center.lat, center.lon), + this.map.getZoom() + ); + } + +}); diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 767da7b8a8..23fbc04932 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -108,8 +108,7 @@ OpenLayers.Map.prototype = { */ addLayer: function (layer) { layer.map = this; - layer.div = OpenLayers.Util.createDiv(); - //layer.div.style.overflow = "hidden"; + layer.div.style.overflow = ""; layer.div.style.zIndex = this.Z_INDEX_BASE['Layer'] + this.layers.length; this.layerContainerDiv.appendChild(layer.div); this.layers.push(layer);