made metadata api parameters configurable. p="Jeff Maki",me r=me (closes #3013)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11032 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -42,6 +42,13 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, {
|
||||
* used. Default is "Road".
|
||||
*/
|
||||
type: "Road",
|
||||
|
||||
/**
|
||||
* APIProperty: metadataParams
|
||||
* {Object} Optional url parameters for the Get Imagery Metadata request
|
||||
* as described here: http://msdn.microsoft.com/en-us/library/ff701716.aspx
|
||||
*/
|
||||
metadataParams: null,
|
||||
|
||||
/**
|
||||
* Constant: EVENT_TYPES
|
||||
@@ -106,25 +113,26 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, {
|
||||
|
||||
var newArgs = [name, null, options];
|
||||
OpenLayers.Layer.XYZ.prototype.initialize.apply(this, newArgs);
|
||||
this.loadMetadata(this.type);
|
||||
this.loadMetadata();
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: loadMetadata
|
||||
*
|
||||
* Parameters:
|
||||
* imageryType - {String}
|
||||
*/
|
||||
loadMetadata: function(imageryType) {
|
||||
loadMetadata: function() {
|
||||
this._callbackId = "_callback_" + this.id.replace(/\./g, "_");
|
||||
// link the processMetadata method to the global scope and bind it
|
||||
// to this instance
|
||||
window[this._callbackId] = OpenLayers.Function.bind(
|
||||
OpenLayers.Layer.Bing.processMetadata, this
|
||||
);
|
||||
var params = OpenLayers.Util.applyDefaults({
|
||||
key: this.key,
|
||||
jsonp: this._callbackId,
|
||||
include: "ImageryProviders"
|
||||
}, this.metadataParams);
|
||||
var url = "http://dev.virtualearth.net/REST/v1/Imagery/Metadata/" +
|
||||
imageryType + "?key=" + this.key + "&jsonp=" + this._callbackId +
|
||||
"&include=ImageryProviders";
|
||||
this.type + "?" + OpenLayers.Util.getParameterString(params);
|
||||
var script = document.createElement("script");
|
||||
script.type = "text/javascript";
|
||||
script.src = url;
|
||||
|
||||
Reference in New Issue
Block a user