Merge all changes from the naturaldocs sandbox. This brings all the work that

has been done in the NaturalDocs branch back to trunk. Thanks to everyone who
helped out in making this happen. (I could list people, but the list would
be long, and I'm already mentally on vacation.)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@3545 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-06-29 15:59:20 +00:00
parent f1c61fd0d6
commit 3948913bfc
107 changed files with 8658 additions and 4011 deletions
+157 -87
View File
@@ -4,35 +4,51 @@
/**
* @class
*
* @requires OpenLayers/Layer/EventPane.js
* @requires OpenLayers/Layer/FixedZoomLevels.js
*
* Class: OpenLayers.Layer.Gooogle
*
* Inherits:
* - <OpenLayers.Layer.EventPane>
* - <OpenLayers.Layer.FixedZoomLevels>
*/
OpenLayers.Layer.Google = OpenLayers.Class.create();
OpenLayers.Layer.Google.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.EventPane,
OpenLayers.Layer.FixedZoomLevels, {
/** @final @type int */
/**
* Constant: MIN_ZOOM_LEVEL
* {Integer} 0
*/
MIN_ZOOM_LEVEL: 0,
/** @final @type int */
/**
* Constant: MAX_ZOOM_LEVEL
* {Integer} 19
*/
MAX_ZOOM_LEVEL: 19,
/** Hardcode these resolutions so that they are more closely
* tied with the standard wms projection
*
* @final @type Array(float) */
/**
* Constant: RESOLUTIONS
* {Array(Float)} Hardcode these resolutions so that they are more closely
* tied with the standard wms projection
*/
RESOLUTIONS: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,.00002145767211914062,.00001072883605957031,.00000536441802978515,.00000268220901489257],
/** @type GMapType */
/**
* APIProperty: type
* {GMapType}
*/
type: null,
/**
* @constructor
* Constructor: OpenLayers.Layer.Google
*
* @param {String} name
* Parameters:
* name - {String}
* options - {Object}
*/
initialize: function(name, options) {
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
@@ -41,10 +57,10 @@ OpenLayers.Layer.Google.prototype =
this.addContainerPxFunction();
},
/** Load the GMap and register appropriate event listeners. If we can't
* load GMap2, then display a warning message.
*
* @private
/**
* Method: loadMapObject
* Load the GMap and register appropriate event listeners. If we can't
* load GMap2, then display a warning message.
*/
loadMapObject:function() {
@@ -75,12 +91,15 @@ OpenLayers.Layer.Google.prototype =
},
/** Overridden from EventPane because if a map type has been specified,
* we need to attach a listener for the first moveend -- this is how
* we will know that the map has been centered. Only once the map has
* been centered is it safe to change the gmap object's map type.
/**
* APIMethod: setMap
* Overridden from EventPane because if a map type has been specified,
* we need to attach a listener for the first moveend -- this is how
* we will know that the map has been centered. Only once the map has
* been centered is it safe to change the gmap object's map type.
*
* @param {OpenLayers.Map} map
* Parameters:
* map - {<OpenLayers.Map>}
*/
setMap: function(map) {
OpenLayers.Layer.EventPane.prototype.setMap.apply(this, arguments);
@@ -90,11 +109,11 @@ OpenLayers.Layer.Google.prototype =
}
},
/** The map has been centered, and a map type was specified, so we
* set the map type on the gmap object, then unregister the listener
* so that we dont keep doing this every time the map moves.
*
* @private
/**
* Method: setMapType
* The map has been centered, and a map type was specified, so we
* set the map type on the gmap object, then unregister the listener
* so that we dont keep doing this every time the map moves.
*/
setMapType: function() {
if (this.mapObject.getCenter() != null) {
@@ -104,7 +123,10 @@ OpenLayers.Layer.Google.prototype =
},
/**
* @param {Event} evt
* APIMethod: onMapResize
*
* Parameters:
* evt - {Event}
*/
onMapResize: function() {
this.mapObject.checkResize();
@@ -112,11 +134,14 @@ OpenLayers.Layer.Google.prototype =
/**
* @param {OpenLayers.Bounds} bounds
*
* @returns Corresponding zoom level for a specified Bounds.
* If mapObject is not loaded or not centered, returns null
* @type int
* APIMethod: getZoomForExtent
*
* Parameters:
* bounds - {<OpenLayers.Bounds>}
*
* Return:
* {Integer} Corresponding zoom level for a specified Bounds.
* If mapObject is not loaded or not centered, returns null
*
getZoomForExtent: function (bounds) {
var zoom = null;
@@ -140,12 +165,15 @@ OpenLayers.Layer.Google.prototype =
//
/**
* @param {Object} moBounds
* APIMethod: getOLBoundsFromMapObjectBounds
*
* @returns An OpenLayers.Bounds, translated from the passed-in
* MapObject Bounds
* Returns null if null value is passed in
* @type OpenLayers.Bounds
* Parameters:
* moBounds - {Object}
*
* Return:
* {<OpenLayers.Bounds>} An <OpenLayers.Bounds>, translated from the
* passed-in MapObject Bounds.
* Returns null if null value is passed in.
*/
getOLBoundsFromMapObjectBounds: function(moBounds) {
var olBounds = null;
@@ -161,11 +189,14 @@ OpenLayers.Layer.Google.prototype =
},
/**
* @param {OpenLayers.Bounds} olBounds
* APIMethod: getMapObjectBoundsFromOLBounds
*
* @returns A MapObject Bounds, translated from olBounds
* Parameters:
* olBounds - {<OpenLayers.Bounds>}
*
* Return:
* {Object} A MapObject Bounds, translated from olBounds
* Returns null if null value is passed in
* @type Object
*/
getMapObjectBoundsFromOLBounds: function(olBounds) {
var moBounds = null;
@@ -181,12 +212,15 @@ OpenLayers.Layer.Google.prototype =
/** Hack-on function because GMAPS does not give it to us
/**
* Method: addContainerPxFunction
* Hack-on function because GMAPS does not give it to us
*
* @param {GLatLng} gLatLng
*
* @returns A GPoint specifying gLatLng translated into "Container" coords
* @type GPoint
* Parameters:
* gLatLng - {GLatLng}
*
* Return:
* {GPoint} A GPoint specifying gLatLng translated into "Container" coords
*/
addContainerPxFunction: function() {
if (typeof GMap2 != "undefined" && !GMap2.fromLatLngToContainerPixel) {
@@ -210,9 +244,11 @@ OpenLayers.Layer.Google.prototype =
},
/**
* @return String with information on why layer is broken, how to get
* APIMethod: getWarningHTML
*
* Return:
* {String} String with information on why layer is broken, how to get
* it working.
* @type String
*/
getWarningHTML:function() {
@@ -245,26 +281,33 @@ OpenLayers.Layer.Google.prototype =
// Get&Set Center, Zoom
/** Set the mapObject to the specified center and zoom
/**
* APIMethod: setMapObjectCenter
* Set the mapObject to the specified center and zoom
*
* @param {Object} center MapObject LonLat format
* @param {int} zoom MapObject zoom format
* Parameters:
* center - {Object} MapObject LonLat format
* zoom - {int} MapObject zoom format
*/
setMapObjectCenter: function(center, zoom) {
this.mapObject.setCenter(center, zoom);
},
/**
* @returns the mapObject's current center in Map Object format
* @type Object
* APIMethod: getMapObjectCenter
*
* Return:
* {Object} The mapObject's current center in Map Object format
*/
getMapObjectCenter: function() {
return this.mapObject.getCenter();
},
/**
* @returns the mapObject's current zoom, in Map Object format
* @type int
* APIMethod: getMapObjectZoom
*
* Return:
* {Integer} The mapObject's current zoom, in Map Object format
*/
getMapObjectZoom: function() {
return this.mapObject.getZoom();
@@ -273,21 +316,27 @@ OpenLayers.Layer.Google.prototype =
// LonLat - Pixel Translation
/**
* @param {Object} moPixel MapObject Pixel format
/**
* APIMethod: getMapObjectLonLatFromMapObjectPixel
*
* @returns MapObject LonLat translated from MapObject Pixel
* @type Object
* Parameters:
* moPixel - {Object} MapObject Pixel format
*
* Return:
* {Object} MapObject LonLat translated from MapObject Pixel
*/
getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
return this.mapObject.fromContainerPixelToLatLng(moPixel);
},
/**
* @param {Object} moPixel MapObject Pixel format
/**
* APIMethod: getMapObjectPixelFromMapObjectLonLat
*
* @returns MapObject Pixel translated from MapObject LonLat
* @type Object
* Parameters:
* moLonLat - {Object} MapObject LonLat format
*
* Return:
* {Object} MapObject Pixel transtlated from MapObject LonLat
*/
getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
return this.mapObject.fromLatLngToContainerPixel(moLonLat);
@@ -297,10 +346,13 @@ OpenLayers.Layer.Google.prototype =
// Bounds
/**
* @param {Object} moBounds MapObject Bounds format
* APIMethod: getMapObjectZoomFromMapObjectBounds
*
* @returns MapObject Zoom for specified MapObject Bounds
* @type Object
* Parameters:
* moBounds - {Object} MapObject Bounds format
*
* Return:
* {Object} MapObject Zoom for specified MapObject Bounds
*/
getMapObjectZoomFromMapObjectBounds: function(moBounds) {
return this.mapObject.getBoundsZoomLevel(moBounds);
@@ -316,31 +368,40 @@ OpenLayers.Layer.Google.prototype =
// LonLat
/**
* @param {Object} moLonLat MapObject LonLat format
* APIMethod: getLongitudeFromMapObjectLonLat
*
* @returns Longitude of the given MapObject LonLat
* @type float
* Parameters:
* moLonLat - {Object} MapObject LonLat format
*
* Return:
* {Float} Longitude of the given MapObject LonLat
*/
getLongitudeFromMapObjectLonLat: function(moLonLat) {
return moLonLat.lng();
},
/**
* @param {Object} moLonLat MapObject LonLat format
* APIMethod: getLatitudeFromMapObjectLonLat
*
* @returns Latitude of the given MapObject LonLat
* @type float
* Parameters:
* moLonLat - {Object} MapObject LonLat format
*
* Return:
* {Float} Latitude of the given MapObject LonLat
*/
getLatitudeFromMapObjectLonLat: function(moLonLat) {
return moLonLat.lat();
},
/**
* @param {int} lon float
* @param {int} lat float
* APIMethod: getMapObjectLonLatFromLonLat
*
* @returns MapObject LonLat built from lon and lat params
* @type Object
* Parameters:
* lon - {Float}
* lat - {Float}
*
* Return:
* {Object} MapObject LonLat built from lon and lat params
*/
getMapObjectLonLatFromLonLat: function(lon, lat) {
return new GLatLng(lat, lon);
@@ -348,32 +409,41 @@ OpenLayers.Layer.Google.prototype =
// Pixel
/**
* @param {Object} moPixel MapObject Pixel format
/**
* APIMethod: getXFromMapObjectPixel
*
* @returns X value of the MapObject Pixel
* @type int
* Parameters:
* moPixel - {Object} MapObject Pixel format
*
* Return:
* {Integer} X value of the MapObject Pixel
*/
getXFromMapObjectPixel: function(moPixel) {
return moPixel.x;
},
/**
* @param {Object} moPixel MapObject Pixel format
/**
* APIMethod: getYFromMapObjectPixel
*
* @returns Y value of the MapObject Pixel
* @type int
* Parameters:
* moPixel - {Object} MapObject Pixel format
*
* Return:
* {Integer} Y value of the MapObject Pixel
*/
getYFromMapObjectPixel: function(moPixel) {
return moPixel.y;
},
/**
* @param {int} x
* @param {int} y
/**
* APIMethod: getMapObjectPixelFromXY
*
* @returns MapObject Pixel from x and y parameters
* @type Object
* Parameters:
* x - {Integer}
* y - {Integer}
*
* Return:
* {Object} MapObject Pixel from x and y parameters
*/
getMapObjectPixelFromXY: function(x, y) {
return new GPoint(x, y);