[fusion-commits] r2265 - in trunk: . layers/Generic lib/OpenLayers
templates/mapguide/standard
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Thu Oct 28 15:22:14 EDT 2010
Author: madair
Date: 2010-10-28 12:22:14 -0700 (Thu, 28 Oct 2010)
New Revision: 2265
Modified:
trunk/fusion.cfg
trunk/layers/Generic/Generic.js
trunk/lib/OpenLayers/OpenLayers.js
trunk/templates/mapguide/standard/ApplicationDefinition.xml
trunk/templates/mapguide/standard/index.html
Log:
re #411: updating the Google layer to use v3 of Google API applied to trunk
Modified: trunk/fusion.cfg
===================================================================
--- trunk/fusion.cfg 2010-10-28 18:30:18 UTC (rev 2264)
+++ trunk/fusion.cfg 2010-10-28 19:22:14 UTC (rev 2265)
@@ -28,6 +28,7 @@
OpenLayers/Layer/MapGuide.js
OpenLayers/Layer/MapServer.js
OpenLayers/Layer/Google.js
+OpenLayers/Layer/Google/v3.js
OpenLayers/Layer/VirtualEarth.js
OpenLayers/Layer/Yahoo.js
OpenLayers/Layer/Vector.js
Modified: trunk/layers/Generic/Generic.js
===================================================================
--- trunk/layers/Generic/Generic.js 2010-10-28 18:30:18 UTC (rev 2264)
+++ trunk/layers/Generic/Generic.js 2010-10-28 19:22:14 UTC (rev 2265)
@@ -99,26 +99,30 @@
case 'Google':
switch (this.mapTag.layerOptions.type) { //Google layer types are actual objects
case 'G_PHYSICAL_MAP': //defined by gmap, not a string
- this.mapTag.layerOptions.type = G_PHYSICAL_MAP;
+ case 'TERRAIN':
+ this.mapTag.layerOptions.type = google.maps.MapTypeId.TERRAIN;
break;
case 'G_HYBRID_MAP':
- this.mapTag.layerOptions.type = G_HYBRID_MAP;
+ case 'HYBRID':
+ this.mapTag.layerOptions.type = google.maps.MapTypeId.HYBRID;
break;
case 'G_SATELLITE_MAP':
- this.mapTag.layerOptions.type = G_SATELLITE_MAP;
+ case 'SATELLITE':
+ this.mapTag.layerOptions.type = google.maps.MapTypeId.SATELLITE;
break;
case 'G_NORMAL_MAP':
- this.mapTag.layerOptions.type = G_NORMAL_MAP;
+ case 'ROADMAP':
+ this.mapTag.layerOptions.type = google.maps.MapTypeId.ROADMAP;
default:
// For the re-loaded Google layers
- if(this.mapTag.layerOptions.type == G_PHYSICAL_MAP)
- this.mapTag.layerOptions.type = G_PHYSICAL_MAP;
- else if(this.mapTag.layerOptions.type == G_HYBRID_MAP)
- this.mapTag.layerOptions.type = G_HYBRID_MAP;
- else if(this.mapTag.layerOptions.type == G_SATELLITE_MAP)
- this.mapTag.layerOptions.type = G_SATELLITE_MAP;
+ if(this.mapTag.layerOptions.type == google.maps.MapTypeId.TERRAIN)
+ this.mapTag.layerOptions.type = google.maps.MapTypeId.TERRAIN;
+ else if(this.mapTag.layerOptions.type == google.maps.MapTypeId.HYBRID)
+ this.mapTag.layerOptions.type = google.maps.MapTypeId.HYBRID;
+ else if(this.mapTag.layerOptions.type == google.maps.MapTypeId.SATELLITE)
+ this.mapTag.layerOptions.type = google.maps.MapTypeId.SATELLITE;
else
- this.mapTag.layerOptions.type = G_NORMAL_MAP;
+ this.mapTag.layerOptions.type = google.maps.MapTypeId.ROADMAP;
break;
}
break;
Modified: trunk/lib/OpenLayers/OpenLayers.js
===================================================================
--- trunk/lib/OpenLayers/OpenLayers.js 2010-10-28 18:30:18 UTC (rev 2264)
+++ trunk/lib/OpenLayers/OpenLayers.js 2010-10-28 19:22:14 UTC (rev 2265)
@@ -1,95 +1,95 @@
-/*
-
- OpenLayers.js -- OpenLayers Map Viewer Library
-
- Copyright 2005-2010 OpenLayers Contributors, released under the Clear BSD
- license. Please see http://svn.openlayers.org/trunk/openlayers/license.txt
- for the full text of the license.
-
- Includes compressed code under the following licenses:
-
- (For uncompressed versions of the code used please see the
- OpenLayers SVN repository: <http://openlayers.org/>)
-
-*/
-
-/* Contains portions of Prototype.js:
- *
- * Prototype JavaScript framework, version 1.4.0
- * (c) 2005 Sam Stephenson <sam at conio.net>
- *
- * Prototype is freely distributable under the terms of an MIT-style license.
- * For details, see the Prototype web site: http://prototype.conio.net/
- *
- *--------------------------------------------------------------------------*/
-
-/**
-*
-* Contains portions of Rico <http://openrico.org/>
-*
-* Copyright 2005 Sabre Airline Solutions
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you
-* may not use this file except in compliance with the License. You
-* may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-* implied. See the License for the specific language governing
-* permissions and limitations under the License.
-*
-**/
-
-/**
- * Contains XMLHttpRequest.js <http://code.google.com/p/xmlhttprequest/>
- * Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- */
-
-/**
- * Contains portions of Gears <http://code.google.com/apis/gears/>
- *
- * Copyright 2007, Google Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of Google Inc. nor the names of its contributors may be
- * used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Sets up google.gears.*, which is *the only* supported way to access Gears.
- *
- * Circumvent this file at your own risk!
- *
- * In the future, Gears may automatically define google.gears.* without this
- * file. Gears may use these objects to transparently fix bugs and compatibility
- * issues. Applications that use the code below will continue to work seamlessly
- * when that happens.
- */
+/*
+
+ OpenLayers.js -- OpenLayers Map Viewer Library
+
+ Copyright 2005-2010 OpenLayers Contributors, released under the Clear BSD
+ license. Please see http://svn.openlayers.org/trunk/openlayers/license.txt
+ for the full text of the license.
+
+ Includes compressed code under the following licenses:
+
+ (For uncompressed versions of the code used please see the
+ OpenLayers SVN repository: <http://openlayers.org/>)
+
+*/
+
+/* Contains portions of Prototype.js:
+ *
+ * Prototype JavaScript framework, version 1.4.0
+ * (c) 2005 Sam Stephenson <sam at conio.net>
+ *
+ * Prototype is freely distributable under the terms of an MIT-style license.
+ * For details, see the Prototype web site: http://prototype.conio.net/
+ *
+ *--------------------------------------------------------------------------*/
+
+/**
+*
+* Contains portions of Rico <http://openrico.org/>
+*
+* Copyright 2005 Sabre Airline Solutions
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you
+* may not use this file except in compliance with the License. You
+* may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* permissions and limitations under the License.
+*
+**/
+
+/**
+ * Contains XMLHttpRequest.js <http://code.google.com/p/xmlhttprequest/>
+ * Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+/**
+ * Contains portions of Gears <http://code.google.com/apis/gears/>
+ *
+ * Copyright 2007, Google Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of Google Inc. nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Sets up google.gears.*, which is *the only* supported way to access Gears.
+ *
+ * Circumvent this file at your own risk!
+ *
+ * In the future, Gears may automatically define google.gears.* without this
+ * file. Gears may use these objects to transparently fix bugs and compatibility
+ * issues. Applications that use the code below will continue to work seamlessly
+ * when that happens.
+ */
/* ======================================================================
OpenLayers/SingleFile.js
====================================================================== */
@@ -121,9 +121,19 @@
* {String} Path to this script
*/
_getScriptLocation: (function() {
- var s = document.getElementsByTagName('script');
- var m = s[s.length-1].getAttribute("src").match(/(^|(.*?\/))(OpenLayers\.js)(\?|$)/);
- var l = m ? m[1] : "";
+ var r = new RegExp("(^|(.*?\\/))(OpenLayers\.js)(\\?|$)"),
+ s = document.getElementsByTagName('script'),
+ src, m, l = "";
+ for(var i=0, len=s.length; i<len; i++) {
+ src = s[i].getAttribute('src');
+ if(src) {
+ var m = src.match(r);
+ if(m) {
+ l = m[1];
+ break;
+ }
+ }
+ }
return (function() { return l; });
})()
};
@@ -177,10 +187,19 @@
* {String} Path to this script
*/
_getScriptLocation: (function() {
- var r = new RegExp("(^|(.*?\\/))(" + scriptName + ")(\\?|$)");
- var s = document.getElementsByTagName('script');
- var m = s[s.length-1].getAttribute("src").match(r);
- var l = m ? m[1] : "";
+ var r = new RegExp("(^|(.*?\\/))(" + scriptName + ")(\\?|$)"),
+ s = document.getElementsByTagName('script'),
+ src, m, l = "";
+ for(var i=0, len=s.length; i<len; i++) {
+ src = s[i].getAttribute('src');
+ if(src) {
+ var m = src.match(r);
+ if(m) {
+ l = m[1];
+ break;
+ }
+ }
+ }
return (function() { return l; });
})()
};
@@ -3130,7 +3149,7 @@
if ("toISOString" in Date.prototype) {
return function(date) {
return date.toISOString();
- }
+ };
} else {
function pad(num, len) {
var str = num + "";
@@ -3156,7 +3175,7 @@
pad(date.getUTCMilliseconds(), 3) + "Z";
}
return str;
- }
+ };
}
})(),
@@ -3186,7 +3205,6 @@
date = new Date(elapsed);
} else {
var match = str.match(/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))?$/);
- var date;
if (match && (match[1] || match[7])) { // must have at least year or time
var year = parseInt(match[1], 10) || 0;
var month = (parseInt(match[2], 10) - 1) || 0;
@@ -7646,22 +7664,6 @@
},
/**
- * Method: setExtent
- * Set the visible part of the layer.
- *
- * Resolution has probably changed, so we nullify the resolution
- * cache (this.resolution), then redraw.
- *
- * Parameters:
- * extent - {<OpenLayers.Bounds>}
- */
- setExtent: function(extent) {
- this.extent = extent.clone();
- this.resolution = null;
- this.redraw();
- },
-
- /**
* Method: setSize
* Sets the size of the drawing surface.
*
@@ -29202,14 +29204,14 @@
callbacks: null,
/**
- * Property: displaySystem
+ * APIProperty: displaySystem
* {String} Display system for output measurements. Supported values
* are 'english', 'metric', and 'geographic'. Default is 'metric'.
*/
displaySystem: 'metric',
/**
- * Property: geodesic
+ * APIProperty: geodesic
* {Boolean} Calculate geodesic metrics instead of planar metrics. This
* requires that geometries can be transformed into Geographic/WGS84
* (if that is not already the map projection). Default is false.
@@ -29217,7 +29219,7 @@
geodesic: false,
/**
- * Property: displaySystemUnits
+ * APIProperty: displaySystemUnits
* {Object} Units for various measurement systems. Values are arrays
* of unit abbreviations (from OpenLayers.INCHES_PER_UNIT) in decreasing
* order of length.
@@ -33814,6 +33816,430 @@
};
};
/* ======================================================================
+ OpenLayers/Layer/Google/v3.js
+ ====================================================================== */
+
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the Clear BSD license.
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+
+/**
+ * @requires OpenLayers/Layer/Google.js
+ */
+
+/**
+ * Constant: OpenLayers.Layer.Google.v3
+ *
+ * Mixin providing functionality specific to the Google Maps API v3. Note that
+ * this layer configures the google.maps.map object with the "disableDefaultUI"
+ * option set to true. Using UI controls that the Google Maps API provides is
+ * not supported by the OpenLayers API.
+ */
+OpenLayers.Layer.Google.v3 = {
+
+ /**
+ * Constant: DEFAULTS
+ * {Object} It is not recommended to change the properties set here. Note
+ * that Google.v3 layers only work when sphericalMercator is set to true.
+ *
+ * (code)
+ * {
+ * maxExtent: new OpenLayers.Bounds(
+ * -128 * 156543.0339,
+ * -128 * 156543.0339,
+ * 128 * 156543.0339,
+ * 128 * 156543.0339
+ * ),
+ * sphericalMercator: true,
+ * maxResolution: 156543.0339,
+ * units: "m",
+ * projection: "EPSG:900913"
+ * }
+ * (end)
+ */
+ DEFAULTS: {
+ maxExtent: new OpenLayers.Bounds(
+ -128 * 156543.0339,
+ -128 * 156543.0339,
+ 128 * 156543.0339,
+ 128 * 156543.0339
+ ),
+ sphericalMercator: true,
+ maxResolution: 156543.0339,
+ units: "m",
+ projection: "EPSG:900913"
+ },
+
+ /**
+ * Method: loadMapObject
+ * Load the GMap and register appropriate event listeners. If we can't
+ * load GMap2, then display a warning message.
+ */
+ loadMapObject:function() {
+ if (!this.type) {
+ this.type = google.maps.MapTypeId.ROADMAP;
+ }
+ var mapObject;
+ var cache = OpenLayers.Layer.Google.cache[this.map.id];
+ if (cache) {
+ // there are already Google layers added to this map
+ mapObject = cache.mapObject;
+ // increment the layer count
+ ++cache.count;
+ } else {
+ // this is the first Google layer for this map
+
+ var container = this.map.viewPortDiv;
+ var div = document.createElement("div");
+ div.id = this.map.id + "_GMapContainer";
+ div.style.position = "absolute";
+ div.style.width = "100%";
+ div.style.height = "100%";
+ container.appendChild(div);
+
+ // create GMap and shuffle elements
+ var center = this.map.getCenter();
+ mapObject = new google.maps.Map(div, {
+ center: center ?
+ new google.maps.LatLng(center.lat, center.lon) :
+ new google.maps.LatLng(0, 0),
+ zoom: this.map.getZoom() || 0,
+ mapTypeId: this.type,
+ disableDefaultUI: true,
+ keyboardShortcuts: false,
+ draggable: false,
+ disableDoubleClickZoom: true,
+ scrollwheel: false,
+ streetViewControl: false
+ });
+
+ // cache elements for use by any other google layers added to
+ // this same map
+ cache = {
+ mapObject: mapObject,
+ count: 1
+ };
+ OpenLayers.Layer.Google.cache[this.map.id] = cache;
+ this.repositionListener = google.maps.event.addListenerOnce(
+ mapObject,
+ "center_changed",
+ OpenLayers.Function.bind(this.repositionMapElements, this)
+ );
+ }
+ this.mapObject = mapObject;
+ this.setGMapVisibility(this.visibility);
+ },
+
+ /**
+ * Method: repositionMapElements
+ *
+ * Waits until powered by and terms of use elements are available and then
+ * moves them so they are clickable.
+ */
+ repositionMapElements: function() {
+
+ // This is the first time any Google layer in this mapObject has been
+ // made visible. The mapObject needs to know the container size.
+ google.maps.event.trigger(this.mapObject, "resize");
+
+ var div = this.mapObject.getDiv().firstChild;
+ if (!div || div.childNodes.length < 3) {
+ this.repositionTimer = window.setTimeout(
+ OpenLayers.Function.bind(this.repositionMapElements, this),
+ 250
+ );
+ return false;
+ }
+
+ var cache = OpenLayers.Layer.Google.cache[this.map.id];
+ var container = this.map.viewPortDiv;
+
+ // move the ToS and branding stuff up to the container div
+ var termsOfUse = div.lastChild;
+ container.appendChild(termsOfUse);
+ termsOfUse.style.zIndex = "1100";
+ termsOfUse.style.bottom = "";
+ termsOfUse.className = "olLayerGoogleCopyright olLayerGoogleV3";
+ termsOfUse.style.display = "";
+ cache.termsOfUse = termsOfUse;
+
+ var poweredBy = div.lastChild;
+ container.appendChild(poweredBy);
+ poweredBy.style.zIndex = "1100";
+ poweredBy.style.bottom = "";
+ poweredBy.className = "olLayerGooglePoweredBy olLayerGoogleV3 gmnoprint";
+ poweredBy.style.display = "";
+ cache.poweredBy = poweredBy;
+
+ this.setGMapVisibility(this.visibility);
+
+ },
+
+ /**
+ * APIMethod: onMapResize
+ */
+ onMapResize: function() {
+ if (this.visibility) {
+ google.maps.event.trigger(this.mapObject, "resize");
+ } else {
+ if (!this._resized) {
+ var layer = this;
+ google.maps.event.addListenerOnce(this.mapObject, "tilesloaded", function() {
+ delete layer._resized;
+ google.maps.event.trigger(layer.mapObject, "resize");
+ layer.moveTo(layer.map.getCenter(), layer.map.getZoom());
+ });
+ }
+ this._resized = true;
+ }
+ },
+
+ /**
+ * Method: setGMapVisibility
+ * Display the GMap container and associated elements.
+ *
+ * Parameters:
+ * visible - {Boolean} Display the GMap elements.
+ */
+ setGMapVisibility: function(visible) {
+ var cache = OpenLayers.Layer.Google.cache[this.map.id];
+ if (cache) {
+ var type = this.type;
+ var layers = this.map.layers;
+ var layer;
+ for (var i=layers.length-1; i>=0; --i) {
+ layer = layers[i];
+ if (layer instanceof OpenLayers.Layer.Google &&
+ layer.visibility === true && layer.inRange === true) {
+ type = layer.type;
+ visible = true;
+ break;
+ }
+ }
+ var container = this.mapObject.getDiv();
+ if (visible === true) {
+ this.mapObject.setMapTypeId(type);
+ container.style.left = "";
+ if (cache.termsOfUse && cache.termsOfUse.style) {
+ cache.termsOfUse.style.left = "";
+ cache.termsOfUse.style.display = "";
+ cache.poweredBy.style.display = "";
+ }
+ cache.displayed = this.id;
+ } else {
+ delete cache.displayed;
+ container.style.left = "-9999px";
+ if (cache.termsOfUse && cache.termsOfUse.style) {
+ cache.termsOfUse.style.display = "none";
+ // move ToU far to the left in addition to setting
+ // display to "none", because at the end of the GMap
+ // load sequence, display: none will be unset and ToU
+ // would be visible after loading a map with a google
+ // layer that is initially hidden.
+ cache.termsOfUse.style.left = "-9999px";
+ cache.poweredBy.style.display = "none";
+ }
+ }
+ }
+ },
+
+ /**
+ * Method: getMapContainer
+ *
+ * Returns:
+ * {DOMElement} the GMap container's div
+ */
+ getMapContainer: function() {
+ return this.mapObject.getDiv();
+ },
+
+ //
+ // TRANSLATION: MapObject Bounds <-> OpenLayers.Bounds
+ //
+
+ /**
+ * APIMethod: getMapObjectBoundsFromOLBounds
+ *
+ * Parameters:
+ * olBounds - {<OpenLayers.Bounds>}
+ *
+ * Returns:
+ * {Object} A MapObject Bounds, translated from olBounds
+ * Returns null if null value is passed in
+ */
+ getMapObjectBoundsFromOLBounds: function(olBounds) {
+ var moBounds = null;
+ if (olBounds != null) {
+ var sw = this.sphericalMercator ?
+ this.inverseMercator(olBounds.bottom, olBounds.left) :
+ new OpenLayers.LonLat(olBounds.bottom, olBounds.left);
+ var ne = this.sphericalMercator ?
+ this.inverseMercator(olBounds.top, olBounds.right) :
+ new OpenLayers.LonLat(olBounds.top, olBounds.right);
+ moBounds = new google.maps.LatLngBounds(
+ new google.maps.LatLng(sw.lat, sw.lon),
+ new google.maps.LatLng(ne.lat, ne.lon)
+ );
+ }
+ return moBounds;
+ },
+
+
+ /************************************
+ * *
+ * MapObject Interface Controls *
+ * *
+ ************************************/
+
+
+ // LonLat - Pixel Translation
+
+ /**
+ * APIMethod: getMapObjectLonLatFromMapObjectPixel
+ *
+ * Parameters:
+ * moPixel - {Object} MapObject Pixel format
+ *
+ * Returns:
+ * {Object} MapObject LonLat translated from MapObject Pixel
+ */
+ getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
+ var size = this.map.getSize();
+ var lon = this.getLongitudeFromMapObjectLonLat(this.mapObject.center);
+ var lat = this.getLatitudeFromMapObjectLonLat(this.mapObject.center);
+ var res = this.map.getResolution();
+
+ var delta_x = moPixel.x - (size.w / 2);
+ var delta_y = moPixel.y - (size.h / 2);
+
+ var lonlat = new OpenLayers.LonLat(
+ lon + delta_x * res,
+ lat - delta_y * res
+ );
+
+ if (this.wrapDateLine) {
+ lonlat = lonlat.wrapDateLine(this.maxExtent);
+ }
+ return this.getMapObjectLonLatFromLonLat(lonlat.lon, lonlat.lat);
+ },
+
+ /**
+ * APIMethod: getMapObjectPixelFromMapObjectLonLat
+ *
+ * Parameters:
+ * moLonLat - {Object} MapObject LonLat format
+ *
+ * Returns:
+ * {Object} MapObject Pixel transtlated from MapObject LonLat
+ */
+ getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
+ var lon = this.getLongitudeFromMapObjectLonLat(moLonLat);
+ var lat = this.getLatitudeFromMapObjectLonLat(moLonLat);
+ var res = this.map.getResolution();
+ var extent = this.map.getExtent();
+ var px = new OpenLayers.Pixel(
+ (1/res * (lon - extent.left)),
+ (1/res * (extent.top - lat))
+ );
+ return this.getMapObjectPixelFromXY(px.x, px.y);
+ },
+
+
+ /**
+ * APIMethod: setMapObjectCenter
+ * Set the mapObject to the specified center and zoom
+ *
+ * Parameters:
+ * center - {Object} MapObject LonLat format
+ * zoom - {int} MapObject zoom format
+ */
+ setMapObjectCenter: function(center, zoom) {
+ this.mapObject.setOptions({
+ center: center,
+ zoom: zoom
+ });
+ },
+
+
+ // Bounds
+
+ /**
+ * APIMethod: getMapObjectZoomFromMapObjectBounds
+ *
+ * Parameters:
+ * moBounds - {Object} MapObject Bounds format
+ *
+ * Returns:
+ * {Object} MapObject Zoom for specified MapObject Bounds
+ */
+ getMapObjectZoomFromMapObjectBounds: function(moBounds) {
+ return this.mapObject.getBoundsZoomLevel(moBounds);
+ },
+
+ /************************************
+ * *
+ * MapObject Primitives *
+ * *
+ ************************************/
+
+
+ // LonLat
+
+ /**
+ * APIMethod: getMapObjectLonLatFromLonLat
+ *
+ * Parameters:
+ * lon - {Float}
+ * lat - {Float}
+ *
+ * Returns:
+ * {Object} MapObject LonLat built from lon and lat params
+ */
+ getMapObjectLonLatFromLonLat: function(lon, lat) {
+ var gLatLng;
+ if(this.sphericalMercator) {
+ var lonlat = this.inverseMercator(lon, lat);
+ gLatLng = new google.maps.LatLng(lonlat.lat, lonlat.lon);
+ } else {
+ gLatLng = new google.maps.LatLng(lat, lon);
+ }
+ return gLatLng;
+ },
+
+ // Pixel
+
+ /**
+ * APIMethod: getMapObjectPixelFromXY
+ *
+ * Parameters:
+ * x - {Integer}
+ * y - {Integer}
+ *
+ * Returns:
+ * {Object} MapObject Pixel from x and y parameters
+ */
+ getMapObjectPixelFromXY: function(x, y) {
+ return new google.maps.Point(x, y);
+ },
+
+ /**
+ * APIMethod: destroy
+ * Clean up this layer.
+ */
+ destroy: function() {
+ if (this.repositionListener) {
+ google.maps.event.removeListener(this.repositionListener);
+ }
+ if (this.repositionTimer) {
+ window.clearTimeout(this.repositionTimer);
+ }
+ OpenLayers.Layer.Google.prototype.destroy.apply(this, arguments);
+ }
+
+};
+/* ======================================================================
OpenLayers/Layer/MapGuide.js
====================================================================== */
Modified: trunk/templates/mapguide/standard/ApplicationDefinition.xml
===================================================================
--- trunk/templates/mapguide/standard/ApplicationDefinition.xml 2010-10-28 18:30:18 UTC (rev 2264)
+++ trunk/templates/mapguide/standard/ApplicationDefinition.xml 2010-10-28 19:22:14 UTC (rev 2265)
@@ -102,6 +102,58 @@
</Extension>
</Map>
</MapGroup>
+ <MapGroup id="bing">
+ <InitialView>
+ <MinX>-9774168</MinX>
+ <MinY>5415995</MinY>
+ <MaxX>-9754637</MaxX>
+ <MaxY>5434757</MaxY>
+ </InitialView>
+ <Map>
+ <Type>VirtualEarth</Type>
+ <Extension>
+ <ResourceId>ve</ResourceId>
+ </Extension>
+ </Map>
+ <Map xsi:type="MapGuideLayerType">
+ <Type>MapGuide</Type>
+ <SingleTile>true</SingleTile>
+ <Extension>
+ <ResourceId>Library://Samples/Sheboygan/Maps/SheboyganMercator.MapDefinition</ResourceId>
+ <Options>
+ <isBaseLayer>false</isBaseLayer>
+ <useOverlay>true</useOverlay>
+ <projection>EPSG:900913</projection>
+ </Options>
+ </Extension>
+ </Map>
+ </MapGroup>
+ <MapGroup id="google2">
+ <InitialView>
+ <MinX>-9774168</MinX>
+ <MinY>5415995</MinY>
+ <MaxX>-9754637</MaxX>
+ <MaxY>5434757</MaxY>
+ </InitialView>
+ <Map>
+ <Type>Google</Type>
+ <Extension>
+ <ResourceId>google</ResourceId>
+ </Extension>
+ </Map>
+ <Map xsi:type="MapGuideLayerType">
+ <Type>MapGuide</Type>
+ <SingleTile>true</SingleTile>
+ <Extension>
+ <ResourceId>Library://Samples/Sheboygan/Maps/SheboyganMercator.MapDefinition</ResourceId>
+ <Options>
+ <isBaseLayer>false</isBaseLayer>
+ <useOverlay>true</useOverlay>
+ <projection>EPSG:900913</projection>
+ </Options>
+ </Extension>
+ </Map>
+ </MapGroup>
<MapGroup id="google" xsi:type="MapType">
<Map xsi:type="WMSLayerType">
<Type>Google</Type>
Modified: trunk/templates/mapguide/standard/index.html
===================================================================
--- trunk/templates/mapguide/standard/index.html 2010-10-28 18:30:18 UTC (rev 2264)
+++ trunk/templates/mapguide/standard/index.html 2010-10-28 19:22:14 UTC (rev 2265)
@@ -3,6 +3,10 @@
<html>
<head>
<title>Sample Fusion Application</title>
+<!-- uncomment for Google layers -->
+<!-- script type="text/javascript" src='http://maps.google.com/maps/api/js?sensor=false'></script-->
+<!-- uncomment for Bing layers -->
+<!-- script src='http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1'></script-->
<!-- change the source of the following tag to point to your fusion installation -->
<script type="text/javascript" src="../../../lib/fusion.js"></script>
<link rel="stylesheet" href="themes/delicious/jxtheme.css" type="text/css" media="screen" charset="utf-8">
@@ -75,9 +79,9 @@
var pm = new Jx.PanelSet({parent:'PanelPane', panels:[p1, p2, p3]});
Fusion.registerForEvent(Fusion.Event.FUSION_INITIALIZED, function() {
- $('thePage').resize({forceResize: true});
$('thePage').style.visibility = 'visible';
mainPanel.layoutContent();
+ $('thePage').resize({forceResize: true});
});
Fusion.registerForEvent(Fusion.Event.FUSION_ERROR, fusionError);
Fusion.initialize();
More information about the fusion-commits
mailing list