百度地图API学习笔记(三)

本文详细介绍了百度地图API中的GroundOverlay类,该类用于在地图上绘制覆盖物。文章涵盖了如何设置覆盖物的位置、尺寸及透明度等关键属性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

com.baidu.mapapi.map.GroundOverlay,定义在地图上绘制一个 Ground 覆盖物,继承自com.baidu.mapapi.map.Overlay

字段概要

方法概要

方法  
限定符和类型方法和说明
floatgetAnchorX()
获取 ground 覆盖物水平方向锚点比例
floatgetAnchorY()
获取 ground 覆盖物垂直方向锚点比例
LatLngBoundsgetBounds()
获取 ground 覆盖物地理坐标范围
intgetHeight()
获取 ground 覆盖物的高度,单位:米
BitmapDescriptorgetImage()
获取 ground 覆盖物的图片信息
LatLnggetPosition()
获取 ground 覆盖物位置信息
floatgetTransparency()
获取 ground 覆盖物透明度
intgetWidth()
获取 ground 覆盖物的宽度,单位:米
voidsetAnchor(float anchorX, float anchorY)
当使用 setPosition() 方式设置覆盖物地理位置时,设置 ground 覆盖物的锚点比例,默认为 0.5f,水平与垂直方向都居中对齐
voidsetDimensions(int width)
设置 ground 覆盖物的宽度,单位:米, 高度按图片宽高比例
voidsetDimensions(int width, int height)
设置 ground 覆盖物的宽度和高度,单位:米
voidsetImage(BitmapDescriptor image)
设置 Ground 覆盖物的图片信息
voidsetPosition(LatLng latLng)
设置 Ground 覆盖物位置信息方式一,与 setDimensions(int, int)配合使用
voidsetPositionFromBounds(LatLngBounds bounds)
设置 ground 覆盖物的位置信息方式二,设置西南与东北坐标范围
voidsetTransparency(float transparency)
设置 ground 覆盖物透明度,默认为 1.0f

从类继承的方法 com.baidu.mapapi.map.Overlay

getExtraInfo, getZIndex, isVisible, remove, setExtraInfo, setVisible, setZIndex

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值