Appearance
覆盖物
所有覆盖物通过 map.addXxx(XxxOptions, callback?) 添加,回调返回对应对象用于后续属性更新。Options 类采用链式 builder 风格。map.clear() 清除全部覆盖物。
FTMapMarker
点标记。
| 方法 | 说明 |
|---|---|
getPosition() / setPosition(coord) | 位置(程序化移动,InfoWindow 跟随) |
getTitle() / setTitle(title) | 标题 |
getSnippet() / setSnippet(snippet) | 副标题 |
setIcon(icon: FTMapBitmapDescriptor) | 图标 |
getAnchorU() / getAnchorV() / setAnchor(u, v) | 锚点(0~1,InfoWindow 偏移联动) |
isDraggable() / setDraggable(d) | 可拖拽 |
isVisible() / setVisible(visible) | 可见性(隐藏时 InfoWindow 联动隐藏) |
getRotateAngle() / setRotateAngle(angle) | 旋转 |
getZIndex() / setZIndex(z) | 层级 |
setInfoWindowEnable(b) / isInfoWindowEnable() | 点击弹窗开关 |
setClickable(b) / isClickable() | Marker 是否可点击 |
showInfoWindow() / hideInfoWindow() / isInfoWindowShown() | InfoWindow 显隐 |
remove() / destroy() / isRemoved() | 移除 |
FTMapMarkerOptions(链式)
position / title / snippet / icon / anchor(u, v) / draggable / visible / rotateAngle / zIndex / infoWindowEnable / clickable
FTMapBitmapDescriptorFactory(图标六种来源)
| 方法 | 说明 |
|---|---|
static defaultMarker() / static defaultMarkerWithColor(color) | 默认气泡 |
static fromUrl(url) | 远程图片 URL(http/https) |
static fromAsset(name) | rawfile 资源(含 / → 完整相对路径;纯名称 → SDK 内置目录 + 自动补 .png) |
static fromBase64(base64) | base64 字符串或完整 data URI |
static fromPixelMap(pm): Promise<FTMapBitmapDescriptor> | 内存像素图(异步,转 PNG data URI) |
static fromMediaResource(ctx, resId): Promise<...> | $r('app.media.x') 资源(异步) |
FTMapPolyline
| 方法 | 说明 |
|---|---|
setPoints(points) | 重新设置点列表 |
setColor(c) / setWidth(w) / setDotted(d) | 样式(setPolylineDottedLine(d) 等价别名) |
setVisible(v) / setZIndex(z) / remove() | 通用 |
点的追加通过
FTMapPolylineOptions链式addPoint(point) / addPoints(points)完成(对象上无增量追加接口)。Options 链式另支持points([...]) / geodesic(b) / clickable(b)。
FTMapArcOptions → FTMapArc
三点圆弧(起点/途经点/终点,途经点必经;共线退化折线)。
points([p0, p1, p2]) / strokeColor(c) / strokeWidth(w) / zIndex(z) / interpolationCount(n)(默认 64,越大越圆滑)
FTMapPolygon / FTMapCircle
FTMapPolygonOptions: points([...]) / fillColor(c) / strokeColor(c) / strokeWidth(w) / clickable(b)FTMapCircleOptions: center(c) / radius(米) / fillColor(c) / strokeColor(c) / strokeWidth(w) / clickable(b)
FTMapText → FTMapTextOptions
| Options 方法 | 说明 |
|---|---|
text(s) | 文字内容 |
position(c) | 位置 |
fontSize(n) / fontWeight('normal'|'bold') | 字号/字重 |
color(argb) / bgColor(argb) / strokeColor(argb) | 颜色/背景/描边 |
rotate(deg) | 旋转(逆时针) |
offsetX(px) / offsetY(px) | 偏移 |
运行时:setText / setPosition / setColor / setRotate / setVisible / remove
FTMapTileOverlay → FTMapTileOverlayOptions
| Options / 方法 | 说明 |
|---|---|
tileUrl(url) | 瓦片模板 URL(含 {x}/{y}/{z} 占位符) |
tileSize(px) | 瓦片尺寸(默认 256) |
transparency(0~1) | 透明度 |
setTransparency / setVisible / remove | 运行时更新 |
FTMapGroundOverlay → FTMapGroundOverlayOptions
| Options / 方法 | 说明 |
|---|---|
image(httpUrl) | 图片 URL(仅 http(s),mapbox fetch 加载,resource:// 与 data URI 不可用) |
position(bounds: FTMapCoordinateBounds) | 贴地范围 |
transparency(0~1) | 透明度 |
static fromPixelMap(pm) / fromRawFile(ctx, name) / fromMediaResource(ctx, id) | 本地图片异步工厂(转 data URI) |
setTransparency / setImage / setVisible / remove | 运行时更新 |
FTMapHeatmap → FTMapHeatmapOptions
| Options / 方法 | 说明 |
|---|---|
data(FTMapHeatmapPoint[]) | 数据点(lat/lng/weight 0~1) |
radius(px) | 热力半径(默认 20) |
opacity(0~1) | 透明度 |
gradient(FTMapHeatmapGradientStop[]) | 渐变色带 |
setData / setRadius / setOpacity / setVisible / remove | 运行时更新 |
FTMapGridHeatmap → FTMapGridHeatmapOptions
| Options / 方法 | 说明 |
|---|---|
data(FTMapHeatmapPoint[]) | 数据点 |
gridType(FTMapGridType.GRID | FTMapGridType.HEX) | 方格/蜂窝 |
cellSize(米) | 网格尺寸(默认 500) |
opacity / gradient | 同热力图 |
setData / setOpacity / setVisible / remove | 运行时更新 |
FTMapImageUtil
| 方法 | 说明 |
|---|---|
static fromPixelMap(pm): Promise<string> | PixelMap → PNG data URI |
static fromRawFile(ctx, name): Promise<string> | rawfile → data URI |
static fromMediaResource(ctx, resId): Promise<string> | $r 资源 → data URI |
static fromBase64(b64, mime?) / static toDataUri(bytes, mime) | base64 转换 |
