Class: CanvasSource

.Source. CanvasSource

Canvas数据源

new CanvasSource(options)

Parameters:
Name Type Description
options Object 源相关选项设置。
Deprecated:
  • Yes
Source:
View2D/Source/CanvasSource.js
Example
map.addSource('some id', {
  type: 'canvas',
  canvas: 'idOfMyHTMLCanvas',
  animate: true,
   coordinates: [
    [-76.54, 39.18],
    [-76.52, 39.18],
    [-76.52, 39.17],
    [-76.54, 39.17]
    ]
     });
 var mySource = map.getSource('some id');
 mySource.setCoordinates([
  [-76.54335737228394, 39.18579907229748],
  [-76.52803659439087, 39.1838364847587],
  [-76.5295386314392, 39.17683392507606],
  [-76.54520273208618, 39.17876344106642]
   ]);
   map.removeSource('some id');  // remove

Members


animate :boolean

判断Canvas是否是动态的,如果canvas是静态的,则设置为false
Type:
  • boolean
Default Value:
  • true
Source:
View2D/Source/CanvasSource.js

canvas :string

canvas的id
Type:
  • string
Default Value:
  • null
Source:
View2D/Source/CanvasSource.js

coordinates :array

canvas 指定的坐标
Type:
  • array
Default Value:
  • null
Source:
View2D/Source/CanvasSource.js