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:
+126
-69
@@ -4,35 +4,51 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer/EventPane.js
|
||||
* @requires OpenLayers/Layer/FixedZoomLevels.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.Yahoo
|
||||
*
|
||||
* Inherits:
|
||||
* - <OpenLayers.Layer.EventPane>
|
||||
* - <OpenLayers.Layer.FixedZoomLevels>v
|
||||
*/
|
||||
OpenLayers.Layer.Yahoo = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.Yahoo.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} 15
|
||||
*/
|
||||
MAX_ZOOM_LEVEL: 15,
|
||||
|
||||
/** 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],
|
||||
|
||||
/** @type YahooMapType */
|
||||
/**
|
||||
* APIProperty: type
|
||||
* {YahooMapType}
|
||||
*/
|
||||
type: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Layer.Yahoo
|
||||
*
|
||||
* @param {String} name
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* options - {Object}
|
||||
*/
|
||||
initialize: function(name, options) {
|
||||
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
|
||||
@@ -41,7 +57,7 @@ OpenLayers.Layer.Yahoo.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* Method: loadMapObject
|
||||
*/
|
||||
loadMapObject:function() {
|
||||
try { //do not crash!
|
||||
@@ -50,11 +66,14 @@ OpenLayers.Layer.Yahoo.prototype =
|
||||
},
|
||||
|
||||
|
||||
/** Overridden from EventPane because we need to remove this yahoo event
|
||||
* pane which prohibits our drag and drop, and we can only do this
|
||||
* once the map has been loaded and centered.
|
||||
/**
|
||||
* APIMethod: setMap
|
||||
* Overridden from EventPane because we need to remove this yahoo event
|
||||
* pane which prohibits our drag and drop, and we can only do this
|
||||
* once the map has been loaded and centered.
|
||||
*
|
||||
* @param {OpenLayers.Map} map
|
||||
* Parameters:
|
||||
* map - {<OpenLayers.Map>}
|
||||
*/
|
||||
setMap: function(map) {
|
||||
OpenLayers.Layer.EventPane.prototype.setMap.apply(this, arguments);
|
||||
@@ -62,10 +81,10 @@ OpenLayers.Layer.Yahoo.prototype =
|
||||
this.map.events.register("moveend", this, this.fixYahooEventPane);
|
||||
},
|
||||
|
||||
/** The map has been centered, so the mysterious yahoo eventpane has been
|
||||
* added. we remove it so that it doesnt mess with *our* event pane.
|
||||
*
|
||||
* @private
|
||||
/**
|
||||
* Method: fixYahooEventPane
|
||||
* The map has been centered, so the mysterious yahoo eventpane has been
|
||||
* added. we remove it so that it doesnt mess with *our* event pane.
|
||||
*/
|
||||
fixYahooEventPane: function() {
|
||||
var yahooEventPane = OpenLayers.Util.getElement("ygddfdiv");
|
||||
@@ -79,9 +98,11 @@ OpenLayers.Layer.Yahoo.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() {
|
||||
|
||||
@@ -118,11 +139,14 @@ OpenLayers.Layer.Yahoo.prototype =
|
||||
//
|
||||
|
||||
/**
|
||||
* @param {int} gZoom
|
||||
* APIMethod: getOLZoomFromMapObjectZoom
|
||||
*
|
||||
* @returns An OpenLayers Zoom level, translated from the passed in gZoom
|
||||
* Returns null if null value is passed in
|
||||
* @type int
|
||||
* Parameters:
|
||||
* gZoom - {Integer}
|
||||
*
|
||||
* Return:
|
||||
* {Integer} An OpenLayers Zoom level, translated from the passed in gZoom
|
||||
* Returns null if null value is passed in.
|
||||
*/
|
||||
getOLZoomFromMapObjectZoom: function(moZoom) {
|
||||
var zoom = null;
|
||||
@@ -134,11 +158,14 @@ OpenLayers.Layer.Yahoo.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {int} olZoom
|
||||
* APIMethod: getMapObjectZoomFromOLZoom
|
||||
*
|
||||
* @returns A MapObject level, translated from the passed in olZoom
|
||||
* Returns null if null value is passed in
|
||||
* @type int
|
||||
* Parameters:
|
||||
* olZoom - {Integer}
|
||||
*
|
||||
* Return:
|
||||
* {Integer} A MapObject level, translated from the passed in olZoom
|
||||
* Returns null if null value is passed in
|
||||
*/
|
||||
getMapObjectZoomFromOLZoom: function(olZoom) {
|
||||
var zoom = null;
|
||||
@@ -158,26 +185,33 @@ OpenLayers.Layer.Yahoo.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.drawZoomAndCenter(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.getCenterLatLon();
|
||||
},
|
||||
|
||||
/**
|
||||
* @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.getZoomLevel();
|
||||
@@ -186,21 +220,27 @@ OpenLayers.Layer.Yahoo.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.convertXYLatLon(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.convertLatLonXY(moLonLat);
|
||||
@@ -217,31 +257,40 @@ OpenLayers.Layer.Yahoo.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.Lon;
|
||||
},
|
||||
|
||||
/**
|
||||
* @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 YGeoPoint(lat, lon);
|
||||
@@ -249,38 +298,46 @@ OpenLayers.Layer.Yahoo.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 YCoordPoint(x, y);
|
||||
},
|
||||
|
||||
|
||||
/** @final @type String */
|
||||
CLASS_NAME: "OpenLayers.Layer.Yahoo"
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user