Map Doc
1.0
iOS-引擎SDK-开放平台
|
#import <MBMapView.h>
类方法 | |
(MBNdsPoint) | + ndsPointFromMBPoint: |
(MBPoint) | + ndsPointToMBPoint: |
(MBNdsPoint) | + ndsPointFrom: |
(CLLocationCoordinate2D) | + ndsPointToXY: |
(MBRect) | + getFitRect:num: |
属性 | |
MBSdkAuthError | authErrorType |
MBPoint | worldCenter |
MBNdsPoint | centerNds |
MBRect | boundArea |
float | zoomLevel |
float | scale |
float | elevation |
float | heading |
float | viewShift |
MBPoint | centerOffset |
MBRect | viewport |
float | fovy |
MBRect | worldRect |
MBRect | worldRectNds |
MBPoint | shiftXY |
BOOL | nightMode |
NSArray * | annotations |
NSArray * | overlays |
BOOL | suspendDisplay |
id< MBMapViewDelegate > | delegate |
NSString * | styleClass |
MBDataPreference | dataPreference |
BOOL | enableBackground |
BOOL | enableBasicMap |
BOOL | enableSatelliteMap |
BOOL | enableTrafficEvent |
BOOL | enableBuilding |
BOOL | enableTmc |
BOOL | enableUpdateTmc |
float | dpiFactor |
MBRenderQuality | renderQuality |
MBMapState * | mapState |
MBRangeF | zoomLevelRange |
int | tmcRefreshInterval |
BOOL | enableUserRasterMap |
float | highestBuildingZoom |
BOOL | highlightTmc |
- (void) addAnnotation: | (MBAnnotation *) | annotation |
添加Annotation到MapRenderer对象
annotation | 标注 |
- (void) addOverlay: | (MBOverlay *) | overlay |
添加Overlay到MapRenderer对象 注意:调用addOverlay之后,会将Native的资源托管给MapRenderer 此时如果要删除相应的Overlay对象,那么应该调用MapRenderer#removeOverlay(Overlay)来清理删除对象 删除后的对象将不再可用,客户端需手动将对应的Java对象置空。
overlay | 层 |
- (void) beginAnimations |
开始动画
- (void) bringOverlayToTop: | (MBOverlay *) | overlay |
将指定的Overlay提到所有Overlay最顶端
overlay | 待操作Overlay |
- (void) cancelAnimations |
取消动画
- (void) clearCache |
建议当系统内存资源紧缺时使用此函数清理释放内存
- (void) commitAnimations: | (int) | duration | |
type: | (MBAnimationType) | type | |
提交动画
duration | 秒数 |
type | 动画类型 |
- (void) compactCache |
建议在程序切到后台或者接收到操作系统内存紧缺的信号 时使用此函数精简内存使用
- (NSInteger) detachAllAnnotations |
- (NSInteger) detachAllOverlays |
- (void) detachAnnotation: | (MBAnnotation *) | annotation |
- (void) detachOverlay: | (MBOverlay *) | overlay |
- (void) drawView |
- (void) endZoom |
结束连续动画
- (void) fitWorldArea: | (MBRect) | area |
Set the world center and scale, so that the specified world area is totally shown in screen. Equal to MBMapView fitWorldArea:rect:.
area | world coordinate |
- (void) fitWorldArea: | (MBRect) | area | |
rect: | (CGRect) | rect | |
Set the world center and scale, so that the specified world area is totally shown in specified screen rectangle.
area | world coordinate |
rect | screen coordinate |
- (void) getConfigType: | (MBRenderConfig) | type | |
values: | (int *) | values | |
num: | (NSInteger) | num | |
- (BOOL) getConfigTypeEnable: | (MBRenderConfig) | type |
根据传入点得到包含这些点的包络盒
points | 点数组 |
poiNum | 点数组个数 |
- (NSString *) getImagePostfix |
获取地图使用的图片的后缀,如@2x
- (float) getTraditionalMapScale |
A shortcut of calculating current map scale in the traditional sense in geography, i.e. the value of x in scale-expression "1:x" of traditional map on paper. It means the length in real world which are represented by a length of 1 unit in the map view. It is the 100 times of the value, in meter, typically annotated on a 1cm long map scale line. Given the dpiFactor of this MBMapView is set as the device's DPI divided by 160 (i.e. REFERENCE_DPI), this value equals to: 1.0f * (dpiFactor*REFERENCE_DPI) / 50.0f * (scale / dpiFactor) * (100/2.54f) = 125.984 * scale; (Note REFERENCE_DPI is now 160)
- (float) getZoomLevelOf: | (MBLevelCase) | levelCase |
不同案例下的缩放级别,不论新老数据,zoom_maxIndoor > zoom_maxMap > zoom_lowestProvince > zoom_lowestWorld > zoom_highest. 其中 zoom_maxMap 对于老数据 14,新数据 16,新老数据下的 zoom_highest 为 0
levelCase | 案例 |
- (void) insertOverlayAtIndex: | (MBOverlay *) | overlay | |
index: | (NSInteger) | index | |
在指定层次插入Overlay,不同层次会出现压盖关系
overlay | 待插入的Overlay |
index | 插入位置 |
- (BOOL) isBuildingOpaque |
建筑物是否透明,默认 false
- (BOOL) isInAnimation |
是否在动画中
- (BOOL) isOptionalGestureEnabled: | (MBOptionalGesture) | gesture |
Default value: OptionalGesture_singleTouchZoom - true.
gesture | 手势类型 |
- (BOOL) isPointVisible: | (MBPoint) | pos |
判断指定的点是否在地图的可见范围内
pos | 判断的点 |
- (BOOL) isRectVisible: | (MBRect) | rect |
判断指定的矩形是否在地图的可见范围内
rect | 欲判断的矩形 |
- (BOOL) isRectVisibleNds: | (MBRect) | rect |
- (void) loadStyleSheet: | (NSString *) | filename |
加载样式
filename | 样式文件名臣 |
- (CGFloat) maxScale |
支持的最大比例尺
- (NSInteger) meter2Pixel: | (int) | meter |
A shortcut to calculate the scale length to show to user. It's equal to: (int)((float)lenInMeter / (float)getScale() * getDpiFactor() * 50.0f) Usually when you want to use this function, getTraditionalMapScale will be a better choice. So it'll be deprecated in future.
meter | 米 |
- (CGFloat) minScale |
支持的最小比例尺
+ (MBNdsPoint) ndsPointFrom: | (CLLocationCoordinate2D) | location |
苹果API对象转化成地图需要的高精度坐标
location | 位置坐标 |
+ (MBNdsPoint) ndsPointFromMBPoint: | (MBPoint) | pos |
+ (MBPoint) ndsPointToMBPoint: | (MBNdsPoint) | pos |
+ (CLLocationCoordinate2D) ndsPointToXY: | (MBNdsPoint) | pos |
高精度坐标转换成苹果API对象
pos | 高精度坐标 |
- (void) onTap: | (const MBPoint *) | pos |
- (void) onTouchCancelled: | (int) | touchCount | |
touchIds: | (ssize_t *) | touchIds | |
pos: | (const MBPoint *) | positions | |
- (void) onTouchClicked: | (const MBPoint *) | pos |
- (void) onTouchDoubleClicked: | (const MBPoint *) | pos |
- (BOOL) onTouchDown: | (int) | touchCount | |
touchIds: | (ssize_t *) | touchIds | |
pos: | (const MBPoint *) | positions | |
- (void) onTouchMove: | (int) | touchCount | |
touchIds: | (ssize_t *) | touchIds | |
pos: | (const MBPoint *) | positions | |
- (void) onTouchUp: | (int) | touchCount | |
touchIds: | (ssize_t *) | touchIds | |
pos: | (const MBPoint *) | positions | |
- (void) optionalGesture: | (MBOptionalGesture) | gesture | |
enable: | (BOOL) | enable | |
手势类型的开启和关闭
gesture | 手势类型 |
enable | YES 表示开启识别 |
- (void) reloadMapData |
刷新数据。使用新下载的离线地图数据,而无需重新启动程序。
- (void) removeAnnotation: | (MBAnnotation *) | annotation |
移除Annotation
annotation | 标注 |
- (void) removeAnnotations: | (NSArray *) | annotations |
移除Annotations
annotations | 标注集合 |
- (void) removeOverlay: | (MBOverlay *) | overlay |
移除MapRenderer中的Overlay对象,释放Overlay对应的Native资源 注意:此方法将释放Overlay对应的Native资源,此时Overlay已经失效,不可用,任何对其操作都将引起崩溃。
overlay | 待插入的Overlay |
- (void) removeOverlays: | (NSArray *) | overlays |
移除MapRenderer中的Overlay对象,释放Overlay对应的Native资源 注意:此方法将释放Overlay对应的Native资源,此时Overlay已经失效,不可用,任何对其操作都将引起崩溃。
overlays | 删除的Overlay集合 |
- (void) resetTouch |
coordinate converting methods
pt | screen point |
- (MBNdsPoint) screen2WorldNds: | (MBPoint) | pt |
coordinate converting methods
pt | screen point |
- (UIImage *) screenshot |
屏幕截图功能
- (UIImage *) screenshotWithRect: | (MBRect) | rect | |
dpiFactor: | (float) | dpi | |
- (void) selectAnnotation: | (MBAnnotation *) | annotation |
设置选中地图中指定的Annotation
annotation | 待选中的Annotation标注 |
- (void) sendOverlayToBack: | (MBOverlay *) | overlay |
将指定的Overlay放入所有Overlay最下方
overlay | 待操作Overlay |
- (void) setClipRect: | (MBRect) | clipRect |
设置裁剪区域;若不设置,viewport默认指定了裁剪范围
- (void) setConfigType: | (MBRenderConfig) | type | |
enable: | (BOOL) | enable | |
Set/Get configurable parameters of boolean type. The meaning of value for possible types at present:
type | MBRenderConfig |
enable | enable or not |
- (void) setConfigType: | (MBRenderConfig) | type | |
values: | (int *) | values | |
num: | (NSInteger) | num | |
Set/Get configurable parameters of integer types. The meaning of values for possible types at present:
type | The number of configure values in values. |
values | width,height |
num | number of values |
- (void) setDataUrlPrefix: | (MBUrlType) | type | |
urlPrefix: | (NSString *) | url | |
设置数据URL前缀,主要用于请求在线数据
type | url类型 |
url | url |
- (void) setHeading: | (CGFloat) | heading | |
animated: | (BOOL) | animated | |
设置地图的朝向
heading | 方向角,正北为0,取值范围是[0, 360) |
animated | 是否使用动画效果 |
- (void) setSatelliteImageSource: | (MBSatelliteImageSource) | dataSource |
设置卫星图资源
dataSource | 卫星图资源 |
- (void) setScale: | (CGFloat) | scale | |
animated: | (BOOL) | animated | |
设置地图比例
scale | 缩放比例 |
animated | 是否使用动画效果 |
- (void) setTiServerUrl: | (NSString *) | url |
设置TI时间戳服务器地址
- (void) setViewShiftX: | (float) | rx | |
y: | (float) | ry | |
设置X和Y方向偏移比例,默认为0
rx | x轴偏移量 |
ry | y轴偏移量 |
- (void) setWorldCenter: | (MBPoint) | worldCenter | |
animated: | (BOOL) | animated | |
设置地图中心点位置
worldCenter | 欲设置的中心点 |
animated | 是否使用动画效果 |
- (void) setZoomLevel: | (CGFloat) | zoomLevel | |
animated: | (BOOL) | animated | |
设置地图缩放级别
zoomLevel | 缩放级别,取值范围[1.0, 14.0] |
animated | 是否使用动画效果 |
- (void) startZoom: | (BOOL) | toZoomIn |
连续动画
toZoomIn | YES,连续ZoomIn |
- (void) switchToBackground |
- (void) switchToForeground |
- (float) unitScreen2World: | (float) | screenUnit |
- (float) unitScreen2WorldNds: | (float) | screenUnit |
- (float) unitWorld2Screen: | (float) | worldUnit |
- (float) unitWorld2ScreenNds: | (float) | worldUnit |
- (MBPoint) world2ScreenNds: | (MBNdsPoint) | pt |
- (float) zoomLevel2Scale: | (float) | zoomLevel |
A facility to get the scale value of specified zoom level. The returned value depends on whether the map data in use is of old- or new- format.
zoomLevel | Should be in [getZoomLevelOf(LevelCase_highest), getZoomLevelOf(LevelCase_maxIndoor)]. Values out of it will be truncated into it in this function. |
|
readnonatomiccopy |
标注集合
|
readnonatomicassign |
授权判断
|
readwritenonatomicassign |
区域范围
|
readwritenonatomicassign |
当前地图中心点经纬度坐标,Nds表示形式
|
readwritenonatomicassign |
中心点偏移
|
readwritenonatomicassign |
设置地图的显示方式(自动,在线,离线)。
|
readwritenonatomicweak |
代理
|
readwritenonatomicassign |
获取屏幕DPI大小
|
readwritenonatomicassign |
仰角角度,单位:度,范围:(MIN_ELEVATION, 90],不同比例尺的仰角范围是不同的,但上限相同,比例尺越小,仰角范围的最小值越小
|
readwritenonatomicassign |
设置地图渲染时是否清屏,默认:清屏
|
readwritenonatomicassign |
开启/关闭地图底图,默认开启
|
readwritenonatomicassign |
enableBuilding
是否显示建筑,默认true值
|
readwritenonatomicassign |
开启/关闭卫星图
|
readwritenonatomicassign |
是否显示TMC,默认不显示,如果为YES表示打开TMC,否则为关闭TMC
|
readwritenonatomicassign |
开启/关闭交通事件
|
readwritenonatomicassign |
是否打开 TMC 更新
|
readwritenonatomicassign |
是否打开室内图,默认 false
|
readwritenonatomicassign |
广角,默认30,范围【15,75】
|
readwritenonatomicassign |
地图的朝向,方向角,正北为0,取值范围是[0, 360)
|
readwritenonatomicassign |
最高的建筑缩放比例,默认 3.0
|
readwritenonatomicassign |
Tmc 高亮模式,如果设置成 True,该模式下基础地图的元素减少,同时让 Tmc 高亮,客户端同时需要 self.enableTmc = True,必要时候可以打开夜间模式增强效果。默认 False。[废弃,改用配置文件配置]
|
readwritenonatomicstrong |
获取当前地图状态,包括摄像机状态,用于动态恢复地图状态
|
readwritenonatomicassign |
nightMode
判断当前是否开启夜间模式 如果为true表示开启夜间模式,否则表示开启白天模式
|
readnonatomiccopy |
覆盖层集合
|
readwritenonatomicassign |
获取当前渲染地图的质量
|
readwritenonatomicassign |
当前地图绘图标尺,会触发didChanged
|
readnonatomicassign |
相当于中心点的比例
|
readwritenonatomiccopy |
设置地图样式:客户端将默认 map3_style_sheet.json 文件放在APP的res目录下,系统自动读取,客户端也可以根据需要更改其中配置。MBMapView styleClass:;比如[MBMapView setStyleClass:"route.weaker"];等
|
readwritenonatomicassign |
当前是否延迟显示状态
|
readwritenonatomicassign |
当前实时交通(TMC)数据刷新时间, 单位: ms。也就是如果要设置为10秒钟刷新,那么应该是10 * 1000。同理两分钟刷新就是2 * 60 * 1000
|
readwritenonatomicassign |
可视范围
|
readwritenonatomicassign |
当前屏幕的相对位置偏移,屏幕的相对位置,相当于百分比,范围:[-1.0, 1.0]
|
readwritenonatomicassign |
当前地图中心点经纬度坐标
|
readnonatomicassign |
mapView覆盖的范围
|
readnonatomicassign |
|
readwritenonatomicassign |
Set and get the zoom level. Bigger the level, more detailed the map. None-integer values are possible. The level ranges in the range returned by MBMapView zoomLevelRange. Note the MBMapView scale also changes this zoom level.
|
readwritenonatomicassign |
获取缩放等级范围,触发地图回调,该方法不能在 beginAnimations 和 commitAnimations 中使用。在老地图数据中的范围是[0,14],新数据是[0,16],可以使用 getZoomLevelOf 函数得到缩放大小