(name, options)
| 20 | */ |
| 21 | export class MapVLayer extends SuperMap.Layer { |
| 22 | constructor(name, options) { |
| 23 | super(name, options); |
| 24 | |
| 25 | /** |
| 26 | * @member {Mapv.DataSet} SuperMap.Layer.MapVLayer.prototype.dataSet |
| 27 | * @description MapV 的 dataset 对象。 |
| 28 | */ |
| 29 | this.dataSet = null; |
| 30 | |
| 31 | /** |
| 32 | * @member {Object} SuperMap.Layer.MapVLayer.prototype.options |
| 33 | * @description MapV 绘图风格配置信息。 |
| 34 | */ |
| 35 | this.options = null; |
| 36 | |
| 37 | /** |
| 38 | * @member {boolean} [SuperMap.Layer.MapVLayer.prototype.supported=false] |
| 39 | * @description 当前浏览器是否支持 canvas 绘制。决定了 MapV 图是否可用,内部判断使用。 |
| 40 | */ |
| 41 | this.supported = false; |
| 42 | |
| 43 | /** |
| 44 | * @member {HTMLCanvasElement} SuperMap.Layer.MapVLayer.prototype.canvas |
| 45 | * @description MapV 图主绘制面板。 |
| 46 | */ |
| 47 | this.canvas = null; |
| 48 | |
| 49 | /** |
| 50 | * @private |
| 51 | * @member {CanvasContext} SuperMap.Layer.MapVLayer.prototype.canvasContext |
| 52 | * @description MapV 图主绘制对象。 |
| 53 | */ |
| 54 | this.canvasContext = null; |
| 55 | |
| 56 | if (options) { |
| 57 | SuperMap.Util.extend(this, options); |
| 58 | } |
| 59 | |
| 60 | //MapV图要求使用canvas绘制,判断是否支持 |
| 61 | this.canvas = document.createElement('canvas'); |
| 62 | if (!this.canvas.getContext) { |
| 63 | return; |
| 64 | } |
| 65 | this.supported = true; |
| 66 | //构建绘图面板 |
| 67 | this.canvas.style.position = 'absolute'; |
| 68 | this.canvas.style.top = 0 + 'px'; |
| 69 | this.canvas.style.left = 0 + 'px'; |
| 70 | this.div.appendChild(this.canvas); |
| 71 | var context = (this.options && this.options.context) || '2d'; |
| 72 | this.canvasContext = this.canvas.getContext(context); |
| 73 | var global$2 = typeof window === 'undefined' ? {} : window; |
| 74 | var devicePixelRatio = this.devicePixelRatio = global$2.devicePixelRatio || 1; |
| 75 | if (context === '2d') { |
| 76 | this.canvasContext.scale(devicePixelRatio, devicePixelRatio); |
| 77 | } |
| 78 | this.attribution = |
| 79 | "© 2018 百度 <a href='https://mapv.baidu.com' target='_blank'>MapV</a> with <span>© <a target='_blank' href='https://iclient.supermap.io' " + |
no test coverage detected