初始化地图var map = new BMap.Map("allmap");var map = new T.Map("allmap");

将覆盖物添加到地图addOverlay(overlay: Overlay)addOverLay(overlay:OverLay)

从 Map 的 click 事件中获取坐标点map.addEventListener("click", function (e) {

Point = e.point;

}map.addEventListener("click", function (e) {

LngLat = e.lnglat;

}

坐标点new BMap.Point(lng: Number, lat: Number)new T.LngLat(lng: Numbe, lat: Number)

像素点new BMap.Pixel(x: Number, y: Number)new T.Point(x: Number, y: Number)

文本标注new BMap.Label(content: String, {

offset: Size,

position: Point

})new T.Label({

text: string,

position: LngLat,

offset: Point

})

设置文本标注样式setStyle(styles: Object)每个样式使用单独的 set 方法实现

图像标注new BMap.Marker(Point, {

offset: Size,

icon: Icon,

enableMassClear: Boolean,

enableDragging: Boolean,

enableClicking: Boolean,

raiseOnDrag: Boolean,

draggingCursor: String,

rotation: Number,

shadow: Icon,

title: String

})new T.Marker(LngLat, {

icon: Icon,

draggable: boolean,

title: string,

zIndexOffset: number,

opacity: number

})

为图像标注添加文本标注Marker.setLabel(label: Label)无。

可借用 title(鼠标掠过显示)属性来实现,并通过 Marker.options.title 来获取值

从图像标注获取坐标点Point = Marker.getPosition();LngLat = Marker.getLngLat();

绘制折线new BMap.Polyline(points: Array, {

strokeColor: String,

strokeWeight: Number,

strokeOpacity: Number,

strokeStyle: String,

enableMassClear: Boolean,

enableEditing: Boolean,

enableClicking: Boolean,

icons: Array

})new T.Polyline(points:Array, {

color: string,

weight: number,

opacity: number,

lineStyle: string

})

绘制多边形new BMap.Polygon(points: Array, {

strokeColor: String,

fillColor: String,

strokeWeight: Number,

strokeOpacity: Number,

fillOpacity: Number,

strokeStyle: String,

enableMassClear: Boolean,

enableEditing: Boolean,

enableClicking: Boolean

})new T.Polygon(points:Array,{

color: string,

weight: number,

opacity: number,

fillColor: String,

fillOpacity: number,

lineStyle: string

})

设置多边形的点数组Polygon.setPath(points: Array)Polyline.setLngLats(lnglats: Array)

设置地图视野Map.setViewport(view: Array | Viewport, viewportOptions: ViewportOptions)Map.setViewport(view: Array)

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐