public class MapRenderer
extends java.lang.Object
draw()()在绘图线程中调用外,其他函数必须在主线程中调用,且不能同时在多个线程中调用同一个函数。NdsPoint.NdsPoint(Point)和NdsPoint.toPoint()转换| 限定符和类型 | 类和说明 |
|---|---|
class |
MapRenderer.Animation
地图摄像机动画
|
class |
MapRenderer.CameraSetting
地图摄像机设置参数
|
static interface |
MapRenderer.DrawTransaction
绘图事务接口 所有的对
MapRenderer的操作都将在下一帧同时生效,相当于是一次事务操作。 |
static class |
MapRenderer.FocusedObjType
当前用户焦点所在的类型
|
static class |
MapRenderer.FpsCounter
统计的帧率,帧率简单的看成一秒内绘制的帧数
|
static class |
MapRenderer.LevelCase
缩放级别
|
static interface |
MapRenderer.Listener
监听地图状态修改的接口
|
static class |
MapRenderer.MapLayerType
加载的图层瓦片数据类型
|
static class |
MapRenderer.OptionalGesture
手势
|
class |
MapRenderer.PoiType
是否显示POI的一些选项
可以用位或操作同时设置多个POI类型是否显示 |
static class |
MapRenderer.RenderConfig
配置选项
|
static class |
MapRenderer.RenderMode
|
static class |
MapRenderer.RenderQuality
控制绘图质量 高质量模式下,所有的元素都会渲染
中质量模式和低质量模式下,会尽量的节省内存,中质量会显示重要元素,具体细节如下: 复杂多边形轮廓 较小的粗模建筑物 精模建筑物 粗模建筑物的屋顶轮廓 高质量 显示 显示 显示 显示 中质量 不显示 当缩放等级>0.5时不显示 显示 显示 低质量 不显示 不显示 不显示 不显示 |
static class |
MapRenderer.SatelliteImageSource
新框架卫星图显示资源种类
不同的项目可根据需求选择 |
class |
MapRenderer.SatellitePicProvider
卫星图供应商选择,默认使用
MapRenderer.SatellitePicProvider.Default |
class |
MapRenderer.TextSizeLevel
文字大小
|
class |
MapRenderer.TouchUpType
点击类型
|
static class |
MapRenderer.URasterArea
用户栅格区域
|
static class |
MapRenderer.URasterData
用户栅格数据
|
static class |
MapRenderer.URasterState
用户栅格区域数据状态,说明
MapRenderer.URasterData.areas中栅格区域数组中内容。 |
class |
MapRenderer.UrlType
数据URL类型
用来标识所设置是哪部分数据的URL前缀 |
| 构造器和说明 |
|---|
MapRenderer(MapRenderer.Listener listener) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addAnnotation(Annotation annotation)
添加Annotation到MapRenderer对象
|
void |
addListener(MapRenderer.Listener listener)
添加绘制事件监听
|
void |
addOverlay(Overlay overlay)
添加Overlay到MapRenderer对象
|
void |
beginAnimations()
|
void |
bringOverlayToTop(Overlay overlay)
|
void |
cancelAnimations()
取消动画 当动画进行中,想要打断动画,那么可以使用此函数
|
void |
clearAll()
|
void |
clearCache()
建议当系统内存资源紧缺时使用此函数清理释放内存
|
void |
commitAnimations(int duration,
int type)
提交并开始动画
|
void |
commitDrawTransaction(MapRenderer.DrawTransaction transaction)
|
void |
commitDrawTransaction(MapRenderer.DrawTransaction transaction,
java.lang.Object userData)
提交绘图事务
详细说明参看 MapRenderer.DrawTransaction |
void |
compactCache()
建议在程序切到后台或者接收到操作系统内存紧缺的信号 时使用此函数精简内存使用
|
void |
copyMapState(MapRenderer renderer)
同步地图状态
|
void |
detachAnnotation(Annotation annotation)
从MapRenderer中返回Annotation,与
removeAnnotation(Annotation)类似,
不同的是,不会释放Annotation资源,可再次添加到MapRenderer |
void |
detachOverlay(Overlay overlay)
从MapRenderer中返回Overlay,与
removeOverlay(Overlay)类似,
不同的时,不会释放Overlay资源,可再次添加到MapRenderer |
void |
draw()
绘制地图的方法
|
void |
enableBackground(boolean enable)
设置地图渲染时是否清屏,默认:清屏
|
void |
enableBasicMap(boolean enable)
开启/关闭地图底图
|
void |
enableBuilding(boolean enable)
是否显示建筑物 默认是:true
|
void |
enableCameraEvents(boolean enableOnCameraChanged,
boolean enableOnNeedsDisplay)
|
void |
enableMapLayer(int layerId,
boolean enable)
打开/关闭指定的图层
|
void |
enableMaskDraw(boolean enabled)
开启蒙版绘制模式,需设置绘制使用的蒙版
MapRenderer#setMaskDrawer() |
void |
enableOptionalGesture(int gesture,
boolean enable)
打开/关闭特定的手势
|
void |
enableSatelliteLayer(boolean enable)
开/关新卫星图
|
void |
enableTmc(boolean enable)
TMC开关函数,必须运行于主线程
|
void |
exchangeOverlayIndices(Overlay overlayL,
Overlay overlayR)
交换两个
Overlay的层次顺序 |
void |
fitWorldArea(android.graphics.Rect area)
将地图的中心和比例尺设置为合适的大小 以便能完整地显示区域的内容。
|
void |
fitWorldAreaToRect(android.graphics.Rect area,
android.graphics.Rect fitToRect)
将制定的地图上的矩形区域显示到指定的屏幕矩形区域中
|
void |
fitWorldAreaToRectNds(android.graphics.Rect area,
android.graphics.Rect fitToRect)
将指定的地图上的矩形区域显示到指定的屏幕矩形区域中
|
android.graphics.Rect |
getBoundArea()
获取地图的边界范围
|
float |
getDpiFactor()
获取屏幕DPI大小
|
float |
getElevation()
获取仰角,用于3D模式下的摄像机操作
|
MapRenderer.FpsCounter |
getFpsCounter()
获取统计的帧率
|
float |
getHeading()
获取地图当前方向角
|
float |
getHighestBuildingZoom()
获取绘制建筑物的最大缩放级别
|
int |
getLanguage()
获取地图文字显示语言
|
MapState |
getMapState()
获取当前地图状态,包括摄像机状态,用于动态恢复地图状态
|
int |
getRenderQuality()
获取当前渲染地图的质量
|
float |
getScale()
获取绘图标尺
|
int |
getSkyBottomPosition()
获取天空盒底部位置,单位:像素
|
float |
getSkyFactor()
获取天空盒比例
|
java.lang.String |
getStyleClass()
获取地图的样式类
|
int |
getTmcRefreshInterval()
获取当前实时交通(TMC)数据刷新时间
|
float |
getTraditionalMapScale()
获取当前地图实际比例尺,单位:米。
|
float |
getTraditionalMapScaleOf(float zoomLevel)
获取特定zoomLevel对应的地图实际比例尺,单位:米。
|
android.graphics.Rect |
getViewport()
获取当前地图的大小(矩形表示)
|
float |
getViewShift()
获取当前屏幕的相对位置偏移Y方向的百分比
|
Vector2DF |
getViewShiftXY()
获取地图中心点所在屏幕的相对位置偏移量,使用
Vector2DF来表示,其中Vector2DF.getX()所获取的是X方向的偏移量百分比,Vector2DF.getY()所获取的位Y方向的偏移量百分比
范围:[-1.0, 1.0] |
android.graphics.Point |
getWorldCenter()
获取当前地图中心点坐标
|
NdsPoint |
getWorldCenterNds()
获取当前地图中心点的NDS坐标
|
android.graphics.Rect |
getWorldRect()
获取当前屏幕所覆盖的真实地理包络盒的大小
|
NdsRect |
getWorldRectNds()
获取当前屏幕所覆盖的真实地理包络盒的大小
|
float |
getZoomLevel()
获取当前地图缩放级别
|
static float |
getZoomLevelOf(int levelCase)
获取某些特定情景下的缩放值
|
Vector2DF |
getZoomLevelRange()
获取缩放等级范围。
|
static void |
glReadPixels(int x,
int y,
int width,
int height,
int format,
int type)
一般用于将显存的内容读到PBO,由于GLES30.glReadPixels只有在API level 24后才支持,在低版本的手机上,
需要调用封装的接口读
|
Annotation[] |
hitTestAnnotations(android.graphics.Point clickPoint)
给定一个点,返回此位置可点击到的所有
Annotation。 |
void |
insertOverlayAtIndex(Overlay overlay,
int index)
在指定层次插入Overlay,不同层次会出现压盖关系
|
boolean |
isBackgroundEnabled()
判断当前是否为开启清屏的模式
|
boolean |
isBasicMapEnabled()
判断当前是否开启了地图底图
|
boolean |
isBuildingEnabled()
判断当前是否为现实建筑的状态
|
boolean |
isInAnimation()
判断当前是否正在执行动画的过程中
|
boolean |
isMapLayerEnabled(int layerId)
判断指定的图层是否打开
|
boolean |
isOptionalGestureEnabled(int gesture)
判断特定的手势是否有效
|
boolean |
isPointVisible(android.graphics.Point point)
判断指定的点是否在地图的可见范围内
|
boolean |
isPointVisibleNds(NdsPoint point)
判断指定的点是否在地图的可见范围内
|
boolean |
isRectVisible(android.graphics.Rect rect)
判断指定的矩形是否在地图的可见范围内
所谓可见,就是指定矩形与屏幕矩形有相交 |
boolean |
isRectVisibleNds(NdsRect rect)
判断指定的矩形是否在地图的可见范围内
所谓可见,就是指定矩形与屏幕矩形有相交 |
boolean |
isSatelliteLayerEnabled()
获取是否开启了新卫星图
|
boolean |
isTmcEnabled()
TMC是否开启
|
boolean |
loadStyleSheet(java.lang.String filePath)
加载样式表文件
MapRenderer对象被创建时, 将加载包中的默认样式表文件NaviCoreUtil.buildPathInPacket("map3_style_sheet.json"),
鹰眼地图创建时, 将加载默认样式文件res/small_map3_style_sheet.json |
int |
meter2Pixel(int lenInMeter)
计算实际距离映射到屏幕中的大小
|
void |
monitorDataReadiness()
监测数据准备状态。
|
void |
moveAnnotations(MapRenderer renderer)
将其他MapRenderer中所有
Annotation移动到当前MapRenderer |
void |
moveOverlays(MapRenderer renderer)
将其他MapRenderer中所有
Overlay移动到当前MapRenderer |
void |
onTap(android.graphics.Point touchPoint)
屏幕点击的点
|
void |
onTouchCancelled(int touchCount,
int[] touchIds,
int[] touchXs,
int[] touchYs)
取消屏幕的按下,抬起,拖动等事件
|
void |
onTouchClicked(android.graphics.Point pos)
发生单击,在单击事件里,会判断是否点击到POI、Overlay、Annotation等,若点击到,会触发*Selected、*
DeSelected、*Clicked回调
|
void |
onTouchDoubleClicked(android.graphics.Point pos)
双击,在点击点的位置放大地图,使zoomLevel减一
|
boolean |
onTouchDown(int touchCount,
int[] touchIds,
int[] touchXs,
int[] touchYs)
获取屏幕按下事件
|
void |
onTouchMove(int touchCount,
int[] touchIds,
int[] touchXs,
int[] touchYs)
获取屏幕的拖动事件
|
void |
onTouchUp(int touchCount,
int[] touchIds,
int[] touchXs,
int[] touchYs)
获取屏幕上点击时的抬起事件
|
void |
pan(android.graphics.Point offset)
平移地图到指定的点(跳跃)
|
void |
panTo(android.graphics.Point position)
平移地图到指定的点
|
static int |
registerCustomIcon(android.graphics.Bitmap icon)
为图标分配唯一的ID,图标ID可用于
Annotation和PointsOverlay
中。 |
static int |
registerCustomIcon(java.lang.String iconPath)
为图标分配唯一的ID,图标ID可用于
Annotation和PointsOverlay
中。 |
void |
reload()
重新载入绘图数据 可以在下载完新数据的时候使用此函数来刷新本地数据 避免了下载新数据必须要重启系统的麻烦
|
void |
reloadIfNeeded()
重新加载地图
在新离线数据安装后,用于主动刷新地图。 |
void |
removeAllAnnotations()
移除所有添加到MapRenderer中的
Annotation |
void |
removeAllOverlays()
删除所有添加到MapRenderer中的
Overlay |
void |
removeAnnotation(Annotation annotation)
移除MapRenderer对象中的
Annotation |
void |
removeListener(MapRenderer.Listener listener)
删除绘制事件监听
|
void |
removeOverlay(Overlay overlay)
移除MapRenderer中的Overlay对象,释放Overlay对应的Native资源
|
void |
resetTouch()
设置内部维护的触摸状态为none-touch-down,即无点击状态
|
static float |
scale2ZoomLevel(float scale)
根据给定的绘图标尺获取对应的缩放级别,返回值取决于当前使用的数据是旧格式还是新格式
|
android.graphics.Point |
screen2World(android.graphics.PointF position)
将屏幕坐标转换为对应的世界坐标
|
NdsPoint |
screen2WorldNds(android.graphics.PointF position)
将屏幕坐标转换为对应的世界坐标
|
void |
selectAnnotation(Annotation annotation)
设置选中地图中指定的Annotation
|
void |
sendOverlayToBack(Overlay overlay)
|
void |
setBoundArea(android.graphics.Rect area)
设置地图边界范围,设置后,地图只能在限制的范围内拖动。
|
void |
setClipRect(android.graphics.Rect clipRect)
设置裁剪区域(相对于屏幕),只在设置的区域内绘制地图
|
void |
setConfigBoolean(int configType,
boolean value)
|
void |
setConfigInt(int configType,
int value)
|
void |
setConfigInt(int configType,
int value1,
int value2)
|
void |
setDpiFactor(float factor)
设置屏幕DPI大小
|
void |
setElevation(float elevation)
设置仰角角度,单位:度,范围:(MIN_ELEVATION, 90]
不同比例尺的仰角范围是不同的,但上限相同,比例尺越小,仰角范围的最小值越小 |
void |
setHeading(float heading)
设置地图的朝向
|
void |
setHighestBuildingZoom(float highestZoomLevel)
设置绘制建筑物的最大缩放级别,即当缩放级别不超过设置的值时才绘制建筑物,默认值:3.0f
|
void |
setLanguage(int lang)
设置地图文字显示语言,需要相关数据支持.
|
void |
setMapState(MapState state)
设置地图状态,用于恢复地图状态使用
|
void |
setMaskDrawer(MaskDrawer maskDrawer)
设置渲染地图的蒙版,开启mask后绘制
enableMaskDraw(boolean) |
void |
setRenderQuality(int quality)
设置当前地图渲染的质量
|
void |
setRenderTarget(Texture texture)
设置渲染目标
|
void |
setSatelliteImageType(int sourceType)
设置卫星图资源类型,仅适用于新框架卫星图的显示
|
void |
setScale(float scale)
设置绘图标尺 单位:米/50个像素,默认范围:[20, 1000000]
|
void |
setSkyFactor(float sizeRatioToCenter)
设置天空盒比例
|
boolean |
setStyleClass(java.lang.String styleClass)
设置地图的样式, 样式类中地图的节点名称为"map", 对地图样式的设置不影响其他对象的样式, 例如
RouteOverlay |
void |
setTmcRefreshInterval(int interval)
设置当前实时交通(TMC)数据刷新时间, 单位: ms
也就是如果要设置为10秒钟刷新,那么应该是10 * 1000 同理两分钟刷新就是2 * 60 * 1000 必须运行于主线程 |
void |
setViewport(android.graphics.Rect rct)
重置绘制区域
|
void |
setViewport(android.graphics.Rect rct,
boolean resetRenderSystem)
此方法同
setViewport(Rect),但是允许仅修改地图渲染位置,而不修改画布大小,如设置MapView中SmallMapRenderer的位置。 |
void |
setViewShift(float ratioBelowCenter)
设置地图中心点所在屏幕屏幕的相对位置Y方向的百分比,将中心移动至世界中心 - (ratioBelowCenter * 屏幕高度 / 2)像素的位置
范围:[-1.0, 1.0]
|
void |
setViewShiftXY(float ratioRightToCenter,
float ratioBelowCenter)
设置地图中心点所在屏幕的相对位置偏移量,相当于百分比 将中心移动至世界中心 - (ratioRightToCenter * 屏幕高度 / 2)和世界中心 - (ratioBelowCenter * 屏幕高度 / 2)像素的位置
范围:[-1.0, 1.0]
超出范围会设置无效,不做任何改变 |
void |
setWorldCenter(android.graphics.Point center)
设置地图中心点位置
|
void |
setWorldCenterNds(NdsPoint center)
设置地图中心位置,坐标为NDS坐标
|
void |
setZoomLevel(float zoomLevel)
设置地图缩放级别,值越大,显示的地图越详细。
|
void |
setZoomLevelAtPoint(float level,
android.graphics.Point screenPos)
设置缩放级别,保持缩放过程中保持屏幕中某一点的位置不变
|
void |
setZoomLevelRange(Vector2DF range)
设置缩放等级范围。
|
void |
switchToBackground()
切换到后台
切换到后台后,会停止不必要的数据下载,绘图相关的接口能正常调用,且某些必要设置,例如 #setDataUrlPrefix(int, String)仍会请求网络 |
void |
switchToForeground()
从后台恢复到正常模式
|
float |
unitScreen2World(float unit)
将屏幕坐标下的长度映射到世界坐标系下
|
float |
unitScreen2WorldNds(float unit)
将屏幕坐标下的长度映射到NDS坐标表示世界坐标系下
世界坐标系下经纬度表示的长度和NDS坐标表示的长度间可通过 NaviCoreUtil.len2NdsLen(float)和
NaviCoreUtil.ndsLen2Len(float)转换 |
float |
unitWorld2Screen(float worldUnit)
将世界坐标系下的经纬度表示的长度转换为屏幕坐标系下的长度
一般来说,此方法配合 unitScreen2World(float)使用,来绘制用于显示的比例尺在3D情况下,即,仰角小于90的情况下,计算结果仅在世界中心坐标附近时是准确的 两个尺寸的计算公式如下: screenLength = worldLength / (scaleInMeter / METER_PER_LAT_UNIT / dpiFactor) * 50.0f |
float |
unitWorld2ScreenNds(float worldUnit)
将世界坐标系下的NDS表示的长度转换为屏幕坐标系下的长度
一般来说,此方法配合 unitScreen2WorldNds(float)使用在3D情况下,即,仰角小于90的情况下,计算结果尽在世界中心坐标附近时是准确的 世界坐标系下经纬度表示的长度和NDS坐标表示的长度间可通过 NaviCoreUtil.len2NdsLen(float)和
NaviCoreUtil.ndsLen2Len(float)转换 |
static void |
unregisterCustomIcon(int iconId)
释放图标ID及其对应的资源。
|
android.graphics.PointF |
world2screen(android.graphics.Point position)
将世界坐标转换为对应的屏幕坐标。
|
android.graphics.PointF |
world2screenNds(NdsPoint position)
将世界坐标转换为对应的屏幕坐标。
|
void |
zoomIn(float zoomLevel)
放大地图
|
float |
zoomLevel2MinElevation(float zoomLevel)
计算给定缩放比例尺对应的最小仰角;返回值因地图数据是新格式或旧格式而异
|
static float |
zoomLevel2Scale(float zoomLevel)
根据给定的缩放级别获取对应的放大级别,返回值取决于当前使用的数据是旧格式还是新格式
|
void |
zoomOut(float zoomLevel)
缩小地图
|
public MapRenderer(MapRenderer.Listener listener) throws java.lang.Exception
java.lang.Exceptionpublic void enableMaskDraw(boolean enabled)
MapRenderer#setMaskDrawer()public void setMaskDrawer(MaskDrawer maskDrawer)
enableMaskDraw(boolean)stencil - 要设置的MaskDrawer实例public void clearAll()
public void enableMapLayer(int layerId,
boolean enable)
layerId - 图层IDMapRenderer.MapLayerTypeenable - true时打开图层,false时关闭图层isMapLayerEnabled(int)public boolean isMapLayerEnabled(int layerId)
layerId - 图层IDMapRenderer.MapLayerTypeenableMapLayer(int, boolean)public void enableSatelliteLayer(boolean enable)
enable - true为开启,false为关闭,默认:falsepublic boolean isSatelliteLayerEnabled()
public void setSatelliteImageType(int sourceType)
sourceType - 卫星图资源类型 MapRenderer.SatelliteImageSourcepublic void draw()
#drawWithRefreshingPOI()public void setRenderTarget(Texture texture)
texture - 渲染目标,如果不为null,会渲染到对应的纹理里,为null时渲染到屏幕public void switchToBackground()
#setDataUrlPrefix(int, String)仍会请求网络switchToForeground()MapView.onPause()中调用public void switchToForeground()
switchToBackground()MapView.onResume()中调用public void enableCameraEvents(boolean enableOnCameraChanged,
boolean enableOnNeedsDisplay)
setWorldCenter(Point)、setViewport(Rect)等改变地图状态时引发的
MapRenderer.Listener.onCameraChanged(int)和 MapRenderer.Listener.onNeedsDisplay()
回调enableOnCameraChanged - true时触发MapRenderer.Listener.onCameraChanged(int)回调,false时禁止回调,默认:trueenableOnNeedsDisplay - true时触发MapRenderer.Listener.onCameraChanged(int)回调,false时禁止回调,默认:truepublic boolean loadStyleSheet(java.lang.String filePath)
MapRenderer对象被创建时, 将加载包中的默认样式表文件NaviCoreUtil.buildPathInPacket("map3_style_sheet.json"),
鹰眼地图创建时, 将加载默认样式文件res/small_map3_style_sheet.jsonfilePath - 样式表文件路径RouteOverlay样式.
每个样式表文件中都包含一个默认样式类"DEFAULT", 包含了样式对象的所有属性, 其他样式类可只定义部分属性,
缺少的属性将采用默认属性
"class-DEFAULT": {
"map": {
"textSizeFactor": 1.0,
"color": {
"background": "ffd0d0d0",
"backgroundLines": "ffa0a0a0",
"lines": {
"minor": "fff0f0f0",
"local": "fffff8a4",
"water": "ff94bee5"
},
......
},
"lineWidth": {
"minor": 0.7,
......
},
......
},
"route":{
"width": {
"normal": 8.0,
"tmc" : 8.0,
"tmcWeaker": 8.0
}
}
}public boolean setStyleClass(java.lang.String styleClass)
RouteOverlaystyleClass - 样式类名称getStyleClass()public java.lang.String getStyleClass()
setStyleClass(String)public void setViewport(android.graphics.Rect rct)
rct - 设置画布及渲染区域视图大小及位置MapRenderer调用,MapView中存在的子地图(SmallMapRenderer)不应该调用此方法。public void setViewport(android.graphics.Rect rct,
boolean resetRenderSystem)
setViewport(Rect),但是允许仅修改地图渲染位置,而不修改画布大小,如设置MapView中SmallMapRenderer的位置。rct - 设置绘图区域的位置resetRenderSystem - 是否同时设置画布大小public android.graphics.Rect getViewport()
public void pan(android.graphics.Point offset)
offset - 平移时x,y方向的偏移量,屏幕坐标public void panTo(android.graphics.Point position)
position - 欲平移到的点,屏幕坐标public void setDpiFactor(float factor)
factor - DPI的值public float getDpiFactor()
public void setWorldCenter(android.graphics.Point center)
center - 欲设置的中心点public android.graphics.Point getWorldCenter()
public void setWorldCenterNds(NdsPoint center)
center - 地图中心getWorldCenterNds()public NdsPoint getWorldCenterNds()
setWorldCenterNds(NdsPoint)public void setBoundArea(android.graphics.Rect area)
area - 经纬度范围public android.graphics.Rect getBoundArea()
public void setScale(float scale)
scale - setDpiFactor(float)public float getScale()
public float getZoomLevel()
setZoomLevel(float)public void setZoomLevel(float zoomLevel)
| 等级 | scale(米) |
| 0.0 | 1000000 |
| 1.0 | 500000 |
| 2.0 | 200000 |
| 3.0 | 100000 |
| 4.0 | 50000 |
| 5.0 | 20000 |
| 6.0 | 10000 |
| 7.0 | 5000 |
| 8.0 | 2000 |
| 9.0 | 1000 |
| 10.0 | 500 |
| 11.0 | 200 |
| 12.0 | 100 |
| 13.0 | 50 |
| 14.0 | 20 |
| ----以下应当在室内图模式下使用---- | |
| 15.0 | 10 |
| 16.0 | 5 |
| 17.0 | 2 |
| 等级 | scale(米) |
| 0.0 | 1048576 |
| 1.0 | 524288 |
| 2.0 | 262144 |
| 3.0 | 131072 |
| 4.0 | 65536 |
| 5.0 | 32768 |
| 6.0 | 16384 |
| 7.0 | 8192 |
| 8.0 | 4096 |
| 9.0 | 2048 |
| 10.0 | 1024 |
| 11.0 | 512 |
| 12.0 | 256 |
| 13.0 | 128 |
| 14.0 | 64 |
| 15.0 | 32 |
| 16.0 | 16 |
| ----以下应当在室内图模式下使用---- | |
| 17.0 | 8 |
| 18.0 | 4 |
| 19.0 | 2 |
zoomLevel - 缩放级别getZoomLevel()public void zoomIn(float zoomLevel)
zoomLevel - 放大级别,即在当前getZoomLevel()上放大zoomLevel级zoomOut(float)public void zoomOut(float zoomLevel)
zoomLevel - 缩小级别,即在当前getZoomLevel()上缩小zoomLevel级zoomIn(float)public static float getZoomLevelOf(int levelCase)
levelCase - 指定的情景 MapRenderer.LevelCaseMapRenderer.LevelCase.maxMap 对应的缩放值在使用老数据时为14,新数据时为16; MapRenderer.LevelCase.highest 的缩放值在新老数据中均为0public static float zoomLevel2Scale(float zoomLevel)
zoomLevel - 获取该缩放级别,该值必须位于 getZoomLevelOf(int)取值为
[MapRenderer.LevelCase.highest,MapRenderer.LevelCase.maxIndoor]的返回值之间
否则将会被截入该区间scale2ZoomLevel(float)public static float scale2ZoomLevel(float scale)
scale - 绘图标尺zoomLevel2Scale(float)public void setZoomLevelRange(Vector2DF range)
range - 缩放范围getZoomLevelRange()public Vector2DF getZoomLevelRange()
setZoomLevelRange(Vector2DF)public void setZoomLevelAtPoint(float level,
android.graphics.Point screenPos)
level - 缩放级别screenPos - 屏幕中固定点位置,缩放前后此位置在屏幕中的位置不变。setZoomLevel(float)public float getElevation()
public void setElevation(float elevation)
elevation - 仰角角度public float getHeading()
public void setHeading(float heading)
heading - 方向角,正北为0,取值范围是[0, 360)public float zoomLevel2MinElevation(float zoomLevel)
zoomLevel - 当前缩放比例;该值必须位于 getZoomLevelOf(int)取值为
[MapRenderer.LevelCase.highest,MapRenderer.LevelCase.maxIndoor]的返回值之间public void fitWorldArea(android.graphics.Rect area)
area - 需要显示的区域public void fitWorldAreaToRectNds(android.graphics.Rect area,
android.graphics.Rect fitToRect)
area - 地图上的矩形区域,为Nds坐标fitToRect - 需要显示的屏幕上的矩形区域public void fitWorldAreaToRect(android.graphics.Rect area,
android.graphics.Rect fitToRect)
area - 地图上的矩形区域fitToRect - 需要显示的屏幕上的矩形区域public void setViewShift(float ratioBelowCenter)
ratioBelowCenter - 比率public float getViewShift()
setViewShift(float)public void setViewShiftXY(float ratioRightToCenter,
float ratioBelowCenter)
ratioRightToCenter - 从屏幕横坐标一半的位置向右偏移的距离百分比,范围:[-1.0, 1.0],0表示横轴中心,即,X方向中点,1表示右边缘,-1表示左边缘。ratioBelowCenter - 从屏幕纵坐标一半的位置向下偏移的距离百分比,范围:[-1.0, 1.0]。0表示纵轴中心,即,Y方向中点,1表示下边缘,-1表示上边缘。setViewShift(float),
getViewShiftXY()public Vector2DF getViewShiftXY()
Vector2DF来表示,其中Vector2DF.getX()所获取的是X方向的偏移量百分比,Vector2DF.getY()所获取的位Y方向的偏移量百分比
范围:[-1.0, 1.0]Vector2DF表示的屏幕相对位置偏移量百分比getViewShift(),
setViewShiftXY(float, float)public android.graphics.Rect getWorldRect()
public NdsRect getWorldRectNds()
public MapState getMapState()
setMapState(MapState)public void setMapState(MapState state)
state - 需要恢复的地图状态getMapState()public void copyMapState(MapRenderer renderer)
renderer - MapRenderer对象public void beginAnimations()
MapRenderer.Animation,
commitAnimations(int, int),
cancelAnimations(),
isInAnimation()beginAnimations()和commitAnimations(int, int)之间
// 开始动画 MapRenderer render = mapView.getMapRenderer(); // 注意:要使用动画,那么地图状态的修改只能在beginAnimations和commintAnimations之间 render.beiginAnimations(); // 获取当前地图状态 MapState state = render.getMapState(); // 将地图角度逆时针旋转100度 state.heading += 100; // 设置仰角为60度 state.elevation = 60; // 设置地图中心点偏移 state.worldCenter.x += 1000; state.worldCenter.y -= 1000; render.setMapState(state); // 提交并开始动画,动画间隔时间为500ms,动画类型为线性变化 render.commintAnimations(500, MapRenderer.Animation.linear);
public void commitAnimations(int duration,
int type)
duration - 动画进行时间,单位:毫秒(ms),最小值不能小于100type - 动画类型MapRenderer.AnimationMapRenderer.Animation,
beginAnimations(),
cancelAnimations(),
isInAnimation()cancelAnimations()函数取消动画 直到动画结束后的所有对摄像机的操作均无效
public void cancelAnimations()
public boolean isInAnimation()
MapRenderer.Animation,
beginAnimations(),
commitAnimations(int, int),
cancelAnimations()public boolean onTouchDown(int touchCount,
int[] touchIds,
int[] touchXs,
int[] touchYs)
touchCount - 屏幕当前按下点的个数touchIds - 屏幕按下的点的IDtouchXs - 屏幕按下的X方向坐标touchYs - 屏幕按下的Y方向的坐标Annotation弹出的气泡public void onTouchMove(int touchCount,
int[] touchIds,
int[] touchXs,
int[] touchYs)
touchCount - 拖动的点个数touchIds - 拖动点的IDtouchXs - 拖动点的X方向坐标touchYs - 拖动点的Y方向的坐标public void onTouchUp(int touchCount,
int[] touchIds,
int[] touchXs,
int[] touchYs)
touchCount - 抬起时点的个数touchIds - 抬起时点的IDtouchXs - 抬起时点X方向坐标touchYs - 抬起时点Y方向的坐标public void onTouchCancelled(int touchCount,
int[] touchIds,
int[] touchXs,
int[] touchYs)
touchCount - 取消事件时点的个数touchIds - 取消事件时点的IDtouchXs - 取消事件是点的X方向坐标touchYs - 取消事件是点的Y方向坐标public void onTap(android.graphics.Point touchPoint)
touchPoint - public void resetTouch()
public void onTouchClicked(android.graphics.Point pos)
pos - 点击的屏幕位置public void onTouchDoubleClicked(android.graphics.Point pos)
pos - 点击的屏幕位置public void enableOptionalGesture(int gesture,
boolean enable)
gesture - 手势类型,见MapRenderer.OptionalGestureenable - 手势开关,true表示打开手势,false关闭手势public boolean isOptionalGestureEnabled(int gesture)
gesture - 手势类型,见MapRenderer.OptionalGesturepublic android.graphics.Point screen2World(android.graphics.PointF position)
position - 屏幕坐标public android.graphics.PointF world2screen(android.graphics.Point position)
position - 世界坐标public android.graphics.PointF world2screenNds(NdsPoint position)
position - 世界坐标,Nds坐标点public NdsPoint screen2WorldNds(android.graphics.PointF position)
position - 屏幕坐标public boolean isPointVisible(android.graphics.Point point)
point - 欲判断的点public boolean isRectVisible(android.graphics.Rect rect)
rect - 欲判断的矩形public boolean isPointVisibleNds(NdsPoint point)
point - 欲判断的点public boolean isRectVisibleNds(NdsRect rect)
rect - 欲判断的矩形,Nds坐标public float unitWorld2Screen(float worldUnit)
unitScreen2World(float)使用,来绘制用于显示的比例尺worldUnit - 世界坐标系单位下的长度unitScreen2World(float)public float unitScreen2World(float unit)
unit - 屏幕坐标系下的长度unitWorld2Screen(float)public float unitWorld2ScreenNds(float worldUnit)
unitScreen2WorldNds(float)使用NaviCoreUtil.len2NdsLen(float)和
NaviCoreUtil.ndsLen2Len(float)转换worldUnit - 世界坐标系单位下的长度unitScreen2WorldNds(float)public float unitScreen2WorldNds(float unit)
NaviCoreUtil.len2NdsLen(float)和
NaviCoreUtil.ndsLen2Len(float)转换unit - 屏幕坐标系下的长度unitWorld2ScreenNds(float)public int meter2Pixel(int lenInMeter)
lenInMeter - 实际的距离,单位:米public float getTraditionalMapScale()
public float getTraditionalMapScaleOf(float zoomLevel)
public void addAnnotation(Annotation annotation)
annotation - public void removeAnnotation(Annotation annotation)
Annotationannotation - public void removeAllAnnotations()
Annotationpublic void detachAnnotation(Annotation annotation)
removeAnnotation(Annotation)类似,
不同的是,不会释放Annotation资源,可再次添加到MapRendererpublic void moveAnnotations(MapRenderer renderer)
Annotation移动到当前MapRendererrenderer - MapRenderer对象public void moveOverlays(MapRenderer renderer)
Overlay移动到当前MapRendererrenderer - MapRenderer对象public void selectAnnotation(Annotation annotation)
annotation - 待选中的Annotationpublic Annotation[] hitTestAnnotations(android.graphics.Point clickPoint)
Annotation。 MapRenderer.Listener.onAnnotationClicked(Annotation, int)里使用,获取所有可点击到的
AnnotationclickPoint - 点击位置,屏幕坐标Annotationpublic void addOverlay(Overlay overlay)
overlay - 待添加的OverlayMapRendererOverlay对象,那么应该调用
removeOverlay(Overlay)来清理删除对象public void insertOverlayAtIndex(Overlay overlay, int index)
overlay - 待插入的Overlayindex - 插入位置addOverlay(Overlay)public void removeOverlay(Overlay overlay)
overlay - 需要移除的Overlaypublic void removeAllOverlays()
Overlaypublic void detachOverlay(Overlay overlay)
removeOverlay(Overlay)类似,
不同的时,不会释放Overlay资源,可再次添加到MapRendererpublic void exchangeOverlayIndices(Overlay overlayL, Overlay overlayR)
Overlay的层次顺序public void reload()
public void clearCache()
public void compactCache()
public void enableBasicMap(boolean enable)
enable - true表示开启,false表示关闭enableMapLayer(int, boolean)public boolean isBasicMapEnabled()
isMapLayerEnabled(int)public void enableTmc(boolean enable)
enable - 如果为true表示打开TMC,否则为关闭TMCenableMapLayer(int, boolean)public boolean isTmcEnabled()
isMapLayerEnabled(int)public void setLanguage(int lang)
lang - 语言编码NaviCore.LanguageTypepublic int getLanguage()
NaviCore.LanguageTypepublic void addListener(MapRenderer.Listener listener)
listener - MapRenderer.Listenerpublic void removeListener(MapRenderer.Listener listener)
listener - MapRenderer.Listenerpublic void setConfigInt(int configType,
int value)
MapRenderer.RenderConfig.annotationDropFrameNumMapRenderer.RenderConfig.annotationDropIntervalMapRenderer.RenderConfig.forceRefreshPoiTimeconfigType - 配置类型MapRenderer.RenderConfigvalue - 值public void setConfigInt(int configType,
int value1,
int value2)
configType - 配置类型MapRenderer.RenderConfigvalue1 - 值1value2 - 值2public void setConfigBoolean(int configType,
boolean value)
MapRenderer.RenderConfig.orderAnnotDynamicallyMapRenderer.RenderConfig.keepCurPoiInRefreshingDrawMapRenderer.RenderConfig.enableAnnotationDropconfigType - 配置类型MapRenderer.RenderConfigvalue - boolean值public int getTmcRefreshInterval()
setTmcRefreshInterval(int)public void setTmcRefreshInterval(int interval)
interval - 实时交通(TMC)数据刷新时间getTmcRefreshInterval()public void enableBuilding(boolean enable)
enable - true为显示,否则不显示public boolean isBuildingEnabled()
public int getRenderQuality()
MapRenderer.RenderQualityMapRenderer.RenderQualitypublic void setRenderQuality(int quality)
quality - 渲染质量 RenderQuality.*MapRenderer.RenderQualitypublic void setHighestBuildingZoom(float highestZoomLevel)
highestZoomLevel - 缩放级别public float getHighestBuildingZoom()
setHighestBuildingZoom(float)public MapRenderer.FpsCounter getFpsCounter()
MapRenderer.FpsCounterpublic void setSkyFactor(float sizeRatioToCenter)
sizeRatioToCenter - 天空盒在地图底层图层所占比例,即天空盒高度/地图顶部到地图中心,默认0.25,范围(0,1)public float getSkyFactor()
public int getSkyBottomPosition()
setSkyFactor(float)决定public void enableBackground(boolean enable)
enable - true为清屏,false为不清屏public boolean isBackgroundEnabled()
public void monitorDataReadiness()
MapRenderer.Listener.onLayerTilesReadyForDraw(int[])回调,所有层数据都准备好时,监测结束。public void commitDrawTransaction(MapRenderer.DrawTransaction transaction, java.lang.Object userData)
MapRenderer.DrawTransactiontransaction - MapRenderer.DrawTransaction实例对象userData - 用户自定义数据,用于
MapRenderer.DrawTransaction.doTransaction(MapRenderer, Object)
回调接口中使用public void commitDrawTransaction(MapRenderer.DrawTransaction transaction)
commitDrawTransaction(DrawTransaction, Object)
功能相同,只是在回调
MapRenderer.DrawTransaction.doTransaction(MapRenderer, Object)
时,第二个参数为空。transaction - MapRenderer.DrawTransaction实例对象public static int registerCustomIcon(android.graphics.Bitmap icon)
Annotation和PointsOverlay
中。通过此方法最多可分配800个ID,范围为[200,1000)icon - 图标,必须是Bitmap.Config.ARGB_8888格式的registerCustomIcon(String)public static int registerCustomIcon(java.lang.String iconPath)
Annotation和PointsOverlay
中。通过此方法最多可分配800个ID,范围为[200,1000)iconPath - 图标路径registerCustomIcon(Bitmap)public static void unregisterCustomIcon(int iconId)
iconId - 图标IDregisterCustomIcon(Bitmap),
registerCustomIcon(String)public void setClipRect(android.graphics.Rect clipRect)
clipRect - 裁剪区域(相对于屏幕)public static void glReadPixels(int x,
int y,
int width,
int height,
int format,
int type)
x - 读像素起始位置的横坐标,左下为(0, 0)y - 读像素起始位置的纵坐标,左下为(0, 0)width - 读取区域的像素宽height - 读取区域的像素高format - 像素格式type - 像素数据的类型public void reloadIfNeeded()
©Mapbar Engine Team;All Rights Reserved