-
fetchTile
(level, row, col, options)
{Promise<(HTMLImageElement|HTMLCanvasElement)>}
inherited
此方法獲取視圖中存在的給定級別、行和列的圖塊。如果從服務器返回的數據或圖像需要經過處理才能顯示,則覆蓋此方法。
參數:
類型 說明 level Number要獲取的圖塊的詳細程度。該值由 LayerView 提供。
row Number瓦片提取的行 (y) 位置。該值由 LayerView 提供。
col Number要獲取的圖塊的列 (x) 位置。該值由 LayerView 提供。
options Object可選的 磁貼請求的可選設置。這些選項具有以下屬性。
規格:signal可選的 AbortSignal 用於中止請求。覆蓋 fetchTile 時,應處理
signal
,例如將其傳遞給 request 或中止掛起的操作。對 fetchTile 的中止調用應該使用 Error 的實例拒絕其返回的承諾。返回:
類型 說明 Promise<(HTMLImageElement|HTMLCanvasElement)> 返回解析為 HTMLImageElement 或 HTMLCanvasElement 的承諾。 例子:
// Process the image returned from the server before // it is displayed. fetchTile: function (level, row, col, options) { // call getTileUrl method to construct the URL for // the image for the given level, row and col let url = this.getTileUrl(level, row, col); // request for the tile based on the generated url. // the signal option ensures that obsolete requests are aborted. return esriRequest(url, { responseType: "image", signal: options && options.signal }) .then(function (response) { // get the image from the response let image = response.data; let width = this.tileInfo.size[0]; let height = this.tileInfo.size[0]; let canvas = document.createElement("canvas"); canvas.width = width; canvas.height = height; let context = canvas.getContext("2d"); // tint is a custom property of this layer // Apply the tint color provided by the application // to the canvas if (this.tint) { context.fillStyle = this.tint.toCss(); context.fillRect(0, 0, width, height); // The pixels of the top layer are multiplied by the corresponding // pixel of the bottom layer. A darker picture is the result. context.globalCompositeOperation = "multiply"; } context.drawImage(image, 0, 0, width, height); return canvas; }.bind(this)); }
基本信息
以下是所在類或對象的基本信息。
AMD:
require(["esri/layers/BingMapsLayer"], (BingMapsLayer) => { /* code goes here */ });
ESM:
import BingMapsLayer from "@arcgis/core/layers/BingMapsLayer";
類:
esri/layers/BingMapsLayer
繼承: BingMapsLayer > BaseTileLayer > Layer > Accessor
自從:用於 JavaScript 4.8 的 ArcGIS API
用法說明
BingMapsLayer.fetchTile
函數(或屬性)的定義如下:
相關用法
- JavaScript ArcGIS BingMapsLayer.fullExtent用法及代碼示例
- JavaScript ArcGIS BingMapsLayer.region用法及代碼示例
- JavaScript ArcGIS BingMapsLayer.when用法及代碼示例
- JavaScript ArcGIS BingMapsLayer.opacity用法及代碼示例
- JavaScript ArcGIS BingMapsLayer.culture用法及代碼示例
- JavaScript ArcGIS BingMapsLayer.effect用法及代碼示例
- JavaScript ArcGIS BingMapsLayer.minScale用法及代碼示例
- JavaScript ArcGIS BingMapsLayer.addResolvingPromise用法及代碼示例
- JavaScript ArcGIS BingMapsLayer.refreshInterval用法及代碼示例
- JavaScript ArcGIS BingMapsLayer.getTileUrl用法及代碼示例
- JavaScript ArcGIS BingMapsLayer.visible用法及代碼示例
- JavaScript ArcGIS BingMapsLayer.maxScale用法及代碼示例
- JavaScript ArcGIS BingMapsLayer.key用法及代碼示例
- JavaScript ArcGIS BingMapsLayer.style用法及代碼示例
- JavaScript ArcGIS BingMapsLayer.on用法及代碼示例
- JavaScript ArcGIS BingMapsLayer refresh事件用法及代碼示例
- JavaScript ArcGIS BingMapsLayer layerview-create-error事件用法及代碼示例
- JavaScript ArcGIS BingMapsLayer layerview-create事件用法及代碼示例
- JavaScript ArcGIS BingMapsLayer用法及代碼示例
- JavaScript BigInt.prototype.toString()用法及代碼示例
- JavaScript BigInt.prototype.toLocaleString()用法及代碼示例
- JavaScript BigInt.prototype.valueOf()用法及代碼示例
- JavaScript ArcGIS BuildingFilter用法及代碼示例
- JavaScript ArcGIS BuildingSceneLayer.url用法及代碼示例
- JavaScript ArcGIS BuildingSceneLayer用法及代碼示例
注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 BingMapsLayer.fetchTile。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。