-
render
(renderParameters)
负责绘制图层内容的实现方法。每当 MapView 的状态发生变化或调用 requestRender() 时,都会调用此方法。
参数:
规格:类型 说明 renderParameters Object规格:context绘制内容的canvas 2D context。
stationaryMapView
的静止状态。state说明视图状态的对象。
例子:
// Example of a render implementation that draws tile boundaries render(renderParameters) { let tileSize = this.layer.tileInfo.size[0]; let state = renderParameters.state; let pixelRatio = state.pixelRatio; let width = state.size[0]; let height = state.size[1]; let context = renderParameters.context; let coords = [0, 0]; context.fillStyle = "rgba(0,0,0,0.25)"; context.fillRect(0, 0, width * pixelRatio, height * pixelRatio); // apply rotation for everything that will be applied to the canvas if (state.rotation !== 0) { context.translate(width * pixelRatio * 0.5, height * pixelRatio * 0.5); context.rotate((state.rotation * Math.PI) / 180); context.translate(- width * pixelRatio * 0.5, -height * pixelRatio * 0.5); } // Set the style for all the text. context.font = "24px monospace"; context.fillStyle = "black"; context.shadowBlur = 1; for (const tile of this.tiles) { let screenScale = tile.resolution / state.resolution * pixelRatio; state.toScreenNoRotation(coords, tile.coords); // Draw the tile boundaries context.strokeRect(coords[0], coords[1], tileSize * screenScale, tileSize * screenScale); // Draw the tile information context.shadowColor = "white"; context.fillText( tile.level + "/" + tile.row + "/" + tile.col + "/" + tile.world, coords[0] + 12, coords[1] + 24, tileSize * screenScale ); context.shadowColor = "transparent"; } }
基本信息
以下是所在类或对象的基本信息。
AMD:
require(["esri/views/2d/layers/BaseLayerView2D"], (BaseLayerView2D) => { /* code goes here */ });
ESM:
import BaseLayerView2D from "@arcgis/core/views/2d/layers/BaseLayerView2D";
类:
esri/views/2d/layers/BaseLayerView2D
继承: BaseLayerView2D > LayerView > Accessor
自从:用于 JavaScript 4.8 的 ArcGIS API
用法说明
BaseLayerView2D.render
函数(或属性)的定义如下:
相关用法
- JavaScript ArcGIS BaseLayerView2D.requestRender用法及代码示例
- JavaScript ArcGIS BaseLayerView2D.attach用法及代码示例
- JavaScript ArcGIS BaseLayerView2D.detach用法及代码示例
- JavaScript ArcGIS BaseLayerView2D.when用法及代码示例
- JavaScript ArcGIS BaseLayerView2D用法及代码示例
- JavaScript ArcGIS BaseLayerViewGL2D.render用法及代码示例
- JavaScript ArcGIS BaseLayerViewGL2D.requestRender用法及代码示例
- JavaScript ArcGIS BaseLayerViewGL2D.attach用法及代码示例
- JavaScript ArcGIS BaseLayerViewGL2D.bindRenderTarget用法及代码示例
- JavaScript ArcGIS BaseLayerViewGL2D.tessellatePoint用法及代码示例
- JavaScript ArcGIS BaseLayerViewGL2D.tessellateExtent用法及代码示例
- JavaScript ArcGIS BaseLayerViewGL2D.tessellateMultipoint用法及代码示例
- JavaScript ArcGIS BaseLayerViewGL2D.tessellatePolyline用法及代码示例
- JavaScript ArcGIS BaseLayerViewGL2D.tessellatePolygon用法及代码示例
- JavaScript ArcGIS BaseLayerViewGL2D.detach用法及代码示例
- JavaScript ArcGIS BaseLayerViewGL2D.when用法及代码示例
- JavaScript ArcGIS BaseLayerViewGL2D用法及代码示例
- JavaScript ArcGIS BaseElevationLayer.when用法及代码示例
- JavaScript ArcGIS BasemapGallery.visible用法及代码示例
- JavaScript ArcGIS BaseElevationLayer.addResolvingPromise用法及代码示例
- JavaScript ArcGIS BaseTileLayer.maxScale用法及代码示例
- JavaScript ArcGIS Basemap.fromId用法及代码示例
- JavaScript ArcGIS BaseDynamicLayer layerview-create事件用法及代码示例
- JavaScript ArcGIS BasemapToggle.visibleElements用法及代码示例
- JavaScript ArcGIS BaseElevationLayer layerview-create事件用法及代码示例
注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 BaseLayerView2D.render。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。