TencentMapSDK_iOS_3D_v5.7.0
QMapView类 参考

地图view的核心类 更多...

#import <QMapView.h>

类 QMapView 继承关系图:

构造函数

(void) - setStyleType:
 设置底图样式,默认为标准样式. 更多...
 
(void) - setMapStyle:
 改变底图样式 更多...
 
(void) - setCompassOffset:
 设置指南针基于默认位置的偏移. 右下为正
 
(void) - setForeignLanguage:
 指定海外图文字的首选语言 更多...
 
(void) - setWorldMapEnable:
 是否打开世界图
 
(void) - setCenterOffsetY:
 设置中心点偏移,向下为正. 单位:比例值(-0.25 ~ 0.25)默认为0
 
(void) - setCenterOffset:
 设置中心点偏移,向右向下为增长. 单位:屏幕比例值(0.25 ~ 0.75)默认为(0.5, 0.5)
 
(void) - setCenterOffset:animated:
 设置中心点偏移 更多...
 
(void) - setCenterOffsetV2:animated:
 设置中心点偏移 更多...
 
(void) - setLogoOffset:
 设置地图Logo偏移 更多...
 
(void) - setLogoMargin:anchor:
 设置地图Logo位置和大小. 调用后会覆盖默认位置 更多...
 
(void) - setLogoScale:
 设置地图Logo大小. 更多...
 
(void) - setScaleViewOffset:
 设置地图比例尺偏移 更多...
 
(void) - setScaleViewFadeEnable:
 设置比例尺是否淡出,比例尺只在地图级别变化的时候淡入,并在地图级别停止变化后淡出 更多...
 
(void) - setRoadEventVisible:
 设置是否显示封路事件 更多...
 
(void) - setBuildingBlackList:count:
 设置不显示建筑物的区域. 更多...
 
(void) - setCenterCoordinate:animated:
 设置中心点经纬度 更多...
 
(void) - setMinZoomLevel:maxZoomLevel:
 设置最小最大缩放级别, 范围 3 <= minZoomLevel <= maxZoomLevel <= 20 更多...
 
(void) - setZoomLevel:animated:
 设置缩放级别 更多...
 
(void) - setRotation:animated:
 设置旋转角度, 正角度向右转, 单位(角度) 更多...
 
(void) - enableAutoMaxOverlooking:
 允许最大俯仰角跟随缩放级别变化 更多...
 
(void) - setOverlooking:animated:
 设置overlooking, 范围 [0, 45], 单位(角度) 更多...
 
(void) - setVisibleMapRect:animated:
 设置当前地图可见范围的mapRect 更多...
 
(void) - setVisibleMapRect:edgePadding:animated:
 设置当前地图可见范围的mapRect 更多...
 
(void) - setRegion:animated:
 设定当前地图的region 更多...
 
(void) - setRegion:edgePadding:animated:
 设定当前地图的region 更多...
 
(QMapRect- mapRectThatFits:edgePadding:
 根据边界留宽计算合适的地理范围 更多...
 
(QMapRect- mapRectThatFits:containsCalloutView:annotations:edgePadding:
 根据当前地图View的窗口大小调整传入的mapRect,返回适合当前地图窗口显示的mapRect(2D北朝上场景时) 更多...
 
(CGFloat) - zoomLevelThatFits:edgePadding:outCenterCoordinate:
 根据边界留宽及地理范围计算合适的级别(2D北朝上场景时) 更多...
 
(void) - setLimitMapRect:mode:
 根据边界留宽显示限制地图区域范围(2D北朝上场景时) 更多...
 
(float *) - glViewMatrix
 获取当前地图view矩阵 更多...
 
(float *) - glProjectionMatrix
 获取当前地图projection矩阵 更多...
 
(CGPoint) - glVertexForCoordinate:
 将经纬度坐标转换为OpenGL使用的坐标 更多...
 
(CGFloat) - glPointRatio
 返回每屏幕Point单位对应的OpenGL坐标系下的长度 更多...
 
(double) - metersPerPointAtLatitude:zoomLevel:
 在指定的缩放级别和指定纬度下, 1 screen point 对应的距离(单位是米). 更多...
 
(CGPoint) - convertCoordinate:toPointToView:
 将经纬度坐标转换为View坐标 更多...
 
(CLLocationCoordinate2D) - convertPoint:toCoordinateFromView:
 将View坐标转换成经纬度坐标 更多...
 
(CGRect) - convertRegion:toRectToView:
 将经纬度矩形区域转换为View矩形区域 更多...
 
(QCoordinateRegion- convertRect:toRegionFromView:
 将View矩形区域转换成经纬度矩形区域 更多...
 
(NSSet< id< QAnnotation >> *) - annotationsInMapRect:
 获取指定投影矩形范围内的标注 更多...
 
(void) - addAnnotation:
 向地图窗口添加标注,需要实现QMapViewDelegate的-mapView:viewForAnnotation:函数来生成标注对应的View 更多...
 
(void) - addAnnotations:
 向地图窗口添加一组标注,需要实现QMapViewDelegate的-mapView:viewForAnnotation:函数来生成标注对应的View 更多...
 
(void) - removeAnnotation:
 移除标注 更多...
 
(void) - removeAnnotations:
 移除一组标注 更多...
 
(QAnnotationView *) - viewForAnnotation:
 查找指定标注对应的View,如果该标注尚未显示,返回nil 更多...
 
(QAnnotationView *) - dequeueReusableAnnotationViewWithIdentifier:
 根据指定标识查找一个可被复用的标注View,一般在delegate中使用,用此函数来代替新申请一个View 更多...
 
(void) - bringAnnotationToFront:
 将制定的annotation放在最上层渲染. 更多...
 
(void) - selectAnnotation:animated:
 选中指定的标注 更多...
 
(void) - deselectAnnotation:animated:
 取消指定的标注的选中状态 更多...
 
(void) - showAnnotations:edgePadding:animated:
 设置地图使其可以显示数组中所有的annotation, 当只有一个时,则将其作为地图的中心点. 更多...
 
(void) - addAOILayer:callback:
 向地图添加一个 AOI 图层 更多...
 
(void) - removeAOILayer:
 从地图移除一个 AOI 图层 更多...
 
(instancetype) - initWithFrame:config:
 初始化 QMapView 更多...
 
(void) - setOverseaSource:
 切换自定义图源 更多...
 
(void) - addCustomLayer:
 向地图添加一个图层 更多...
 
(void) - removeCustomLayer:
 从地图移除一个个性化图层 更多...
 
(NSString *) - getDebugError
 地图view的错误信息, 用于定位问题
 
(void) - setIndoorEnabled:
 室内图开关.
 
(void) - setActiveIndoorInfo:
 手动切换到指定的室内图及楼层
 
(void) - setIndoorMaskColor:
 设置显示室内图时的蒙层颜色. alpha=0时不显示,默认不显示
 
(void) - setIndoorCell:
 设置面样式, 需要在面所在室内图激活后再进行设置
 
(void) - resetIndoorCell
 清除自定义面样式(恢复默认样式), 需在面所在室内图激活时调用
 
(void) - addOverlay:
 向地图窗口添加Overlay,需要实现QMapViewDelegate的-mapView:viewForOverlay:函数来生成标注对应的View 更多...
 
(void) - addOverlays:
 批量向地图窗口添加Overlay,需要实现QMapViewDelegate的-mapView:viewForOverlay:函数来生成标注对应的View 更多...
 
(void) - removeOverlay:
 移除Overlay 更多...
 
(void) - removeOverlays:
 移除Overlay 更多...
 
(QOverlayView *) - viewForOverlay:
 返回指定overlay对象的OverlayView 更多...
 
(void) - showOverlays:edgePadding:animated:
 设置地图使其可以显示数组中所有的overlay, 更多...
 
(void) - showQMarkers:edgePadding:animated:
 设置地图使其可以显示数组中所有的QMarker覆盖物, 更多...
 
((deprecated("use - (void) - takeSnapshotInRect:completion:
 截图 更多...
 
(void) - takeSnapshotInRect:completion:
 异步截图 (默认超时时间为2.5秒) 更多...
 
(void) - takeSnapshotInRect:timeout:completion:
 异步截图 更多...
 
(void) - takeSnapshotInRect:timeout:afterScreenUpdates:completion:
 异步截图 更多...
 
(void) - configureUserLocationPresentation:
 配置当前位置UI属性 (必须在QMapView 初始化以后, 定位开启之前调用) 更多...
 
(CLAccuracyAuthorization accuracyAuthorization) - API_AVAILABLE
 定位精度权限状态
 
(CLAuthorizationStatus authorizationStatus) - API_AVAILABLE
 定位权限状态
 
(void) - setUserTrackingMode:animated:
 设置追踪用户位置的模式 更多...
 
(void) - setUserLocationHidden:
 在地图中隐藏位置图标
 
(void) - setUserLocationCompassHidden:
 展示/隐藏位置图标罗盘.
 
(void) - setUserLocationNavigationGravitylineHidden:
 展示/隐藏位置图标红线.
 
(void) - requestTempPrecisedLocation:purposeKey:completion:
 申请临时精确定位权限 更多...
 
(void) - addVisualLayer:
 向地图添加一个可视化数据图层 更多...
 
(void) - removeVisualLayer:
 从地图移除一个个性化图层 更多...
 

类方法

(void) + loadPrefferedResourceFilesFromDirectory:
 使用用户传入的地图资源文件(在地图初始化前调用) 更多...
 
(void) + clearMapCache
 清理地图缓存数据。注: 此接口必须在地图初始化前调用
 

属性

BOOL handDrawMapEnabled
 是否开启手绘图,默认为 NO 更多...
 
BOOL showsTraffic
 是否开启路况图,默认为 NO
 
id< QMapViewDelegatedelegate
 地图回调
 
QMapType mapType
 
BOOL showsScale
 是否显示比例尺,默认为YES
 
BOOL showsBuildings
 是否显示建筑物,默认为YES
 
BOOL shows3DBuildings
 是否显示建筑物样式为3D效果,默认为YES
 
BOOL showsPoi
 是否显示底图上的标注及名称,默认为YES
 
QMapLabelSize labelSize
 设置底图上的标注的字体大小 更多...
 
BOOL showsBaseMap
 是否显示底图,默认为YES
 
BOOL showsCompass
 是否显示指南针,默认为NO
 
NSInteger preferredFramesPerSecond
 当前地图最大渲染帧数,默认为60
 
CGPoint centerOffsetV2
 设置中心点偏移,向右向下为正,默认为(0.5, 0.5),范围是 [0.05, 0.95]。若超出范围,则被裁减到 [0.05, 0.95]。
 
CGPoint logoCenter
 logo位置,需设置在地图的bounds里
 
CGSize logoSize
 logo的宽高
 
CGPoint scaleOrigin
 比例尺原点位置
 
CGSize scaleSize
 比例尺的尺寸
 
QBasicMapViewLayeranimationLayer
 地图动画Layer. 使用该layer 可以更灵活的组合 {centerCoordinate, zoomLevel, rotation, overlooking} 动画, 并且可以自定义其duration, timingFunction 等CoreAnimation所支持的一切动画属性.
 
CLLocationCoordinate2D centerCoordinate
 中心点经纬度
 
CGFloat zoomLevel
 缩放级别, 范围 [minZoomLevel, maxZoomLevel]
 
CGFloat minZoomLevel
 最小缩放级别, 默认 minZoomLevel = 3
 
CGFloat maxZoomLevel
 最大缩放级别, 默认 maxZoomLevel = 20
 
CGFloat rotation
 旋转角度, 正角度向右转, 单位(角度)
 
CGFloat overlooking
 Overlooking, 范围 [0, 45], 单位(角度)
 
QMapRect visibleMapRect
 当前地图可见范围的mapRect
 
QCoordinateRegion region
 当前地图的经纬度范围,设定的该范围可能会被调整为适合地图窗口显示的范围
 
double metersPerPointAtCurrentZoomLevel
 在当前缩放级别下, 基于地图中心点, 1 screen point 对应的距离(单位是米)
 
BOOL zoomEnabled
 
BOOL keepCenterDuringZoom
 pinch时保持中心点, 默认为YES
 
BOOL scrollEnabled
 
BOOL overlookingEnabled
 是否支持俯视. 默认为YES.
 
BOOL rotateEnabled
 是否支持旋转. 默认为YES.
 
BOOL alwaysTriggerDidTapCoordinateEnabled
 当地图被单击时,是否总是触发 "地图点击回调",默认为NO. 地图点击回调: 更多...
 
NSString * userLocationAccessibilityLabel
 定位图标对应的无障碍label.
 
NSString * mapViewAccessibilityLabel
 QMapView对应的无障碍label. 默认为地图
 
CGPoint mapViewAccessibilityAcitivePoint
 QMapView无障碍对应激活点
 
NSString * mapViewZoomAccessibiltyAnouncement
 QMapView缩放时自定义播报内容.
 
BOOL annotationAccessibilityFrameClipToBounds
 标注view的accessibilityFrame是否会包含其子view. 默认为YES
 
NSArray * annotations
 当前地图View的已经添加的标注数组
 
NSArray< id< QAnnotation > > * selectedAnnotations
 当前选中的annotations get: 处于选中的标注数组,其count == 0 或者 1 set: 数组中的第一个annotation会被选中 (index = 0),其他则忽略. 若数组为空则取消当前选中的annotation.
 
BOOL indoorPicker
 是否使用内置的楼层选择控件. 默认为YES.
 
CGPoint indoorPickerOffset
 默认的楼层选择控件偏移位置. 向右下增长
 
QIndoorBuildingactiveBuilding
 当前处于激活态的整个室内图数据
 
QIndoorLevelactiveLevel
 当前正在展示的室内楼层.
 
BOOL offlineMapEnable
 离线地图开关, 默认为 NO
 
NSArray * overlays
 当前mapView中已经添加的Overlay数组
 
QUserLocationPresentationuserLocatorPresentation
 地图view的定位标对象
 
BOOL showsUserLocation
 开启定位并展示位置图标.
 
QOverlayLevel locatorDisplayLevel
 位置图标的展示层级. 默认 QOverlayLevelAboveLabels
 
int locatorZIndex
 位置图标的显示顺序,决定了它与其它QOverlayView的压盖关系. 默认为10000000. 更多...
 
QUserLocationuserLocation
 当前位置信息
 
CLLocationAccuracy desiredAccuracy
 设定定位精度。默认为kCLLocationAccuracyBest
 
CLLocationDistance distanceFilter
 设定定位的最小更新距离。默认为kCLDistanceFilterNone,会提示任何移动
 
CLLocationDegrees headingFilter
 设定最小更新角度。默认为2度,设定为kCLHeadingFilterNone会提示任何角度改变
 
BOOL allowsBackgroundLocationUpdates
 以上是否允许后台定位。ios9以上可用. 请参考CLLocationManager.allowsBackgroundLocationUpdates
 
BOOL pausesLocationUpdatesAutomatically
 
QUserTrackingMode userTrackingMode
 定位用户位置的模式
 
BOOL userLocationVisible
 当前位置在地图中是否可见
 

详细描述

地图view的核心类

函数文档

◆ addAnnotation:

- (void) addAnnotation: (id< QAnnotation >)  annotation

向地图窗口添加标注,需要实现QMapViewDelegate的-mapView:viewForAnnotation:函数来生成标注对应的View

参数
annotation要添加的标注

由 category QMapView(Annotation) 提供.

◆ addAnnotations:

- (void) addAnnotations: (NSArray *)  annotations

向地图窗口添加一组标注,需要实现QMapViewDelegate的-mapView:viewForAnnotation:函数来生成标注对应的View

参数
annotations要添加的标注数组

由 category QMapView(Annotation) 提供.

◆ addAOILayer:callback:

- (void) addAOILayer: (QAOILayer *)  layer
callback: (void(^)(BOOL success))  callback 

向地图添加一个 AOI 图层

参数
layer需要添加的图层 回调中返回添加图层的状态: 成功或失败

由 category QMapView(AOILayer) 提供.

◆ addCustomLayer:

- (void) addCustomLayer: (QCustomLayer *)  layer

向地图添加一个图层

参数
layer要添加的图层

由 category QMapView(CustomLayer) 提供.

◆ addOverlay:

- (void) addOverlay: (id< QOverlay >)  overlay

向地图窗口添加Overlay,需要实现QMapViewDelegate的-mapView:viewForOverlay:函数来生成标注对应的View

参数
overlay要添加的overlay

由 category QMapView(Overlay) 提供.

◆ addOverlays:

- (void) addOverlays: (NSArray< id< QOverlay >> *)  overlays

批量向地图窗口添加Overlay,需要实现QMapViewDelegate的-mapView:viewForOverlay:函数来生成标注对应的View

参数
overlays要添加的overlay列表

由 category QMapView(Overlay) 提供.

◆ addVisualLayer:

- (void) addVisualLayer: (QVisualLayer *)  visualOverlay

向地图添加一个可视化数据图层

参数
visualOverlay要添加的图层

由 category QMapView(VisualLayer) 提供.

◆ annotationsInMapRect:

- (NSSet<id <QAnnotation>> *) annotationsInMapRect: (QMapRect mapRect

获取指定投影矩形范围内的标注

参数
mapRect投影矩形范围,当mapRect 为空时(QMapRectIsEmpty) 会返回 nil.
返回
标注集合

由 category QMapView(Annotation) 提供.

◆ bringAnnotationToFront:

- (void) bringAnnotationToFront: (id< QAnnotation >)  DEPRECATED_ATTRIBUTE

将制定的annotation放在最上层渲染.

参数
annotation指定的annotation
注解
Deprecated 请使用QAnnotationView.zIndex管理顺序(默认会将本annotationView.zIndex设置为当前顶部的zIndex+1)

由 category QMapView(Annotation) 提供.

◆ configureUserLocationPresentation:

- (void) configureUserLocationPresentation: (QUserLocationPresentation *)  presentation

配置当前位置UI属性 (必须在QMapView 初始化以后, 定位开启之前调用)

参数
presentation位置UI属性

由 category QMapView(UserLocation) 提供.

◆ convertCoordinate:toPointToView:

- (CGPoint) convertCoordinate: (CLLocationCoordinate2D)  coordinate
toPointToView: (UIView *)  view 

将经纬度坐标转换为View坐标

参数
coordinate待转换的经纬度坐标
view指定相对的View
返回
转换后的View坐标

◆ convertPoint:toCoordinateFromView:

- (CLLocationCoordinate2D) convertPoint: (CGPoint)  point
toCoordinateFromView: (UIView *)  view 

将View坐标转换成经纬度坐标

参数
point待转换的View坐标
viewpoint坐标所在的view
返回
转换后的经纬度坐标

◆ convertRect:toRegionFromView:

- (QCoordinateRegion) convertRect: (CGRect)  rect
toRegionFromView: (UIView *)  view 

将View矩形区域转换成经纬度矩形区域

参数
rect待转换的View矩形区域
viewrect坐标所在的view
返回
转换后的经纬度矩形区域

◆ convertRegion:toRectToView:

- (CGRect) convertRegion: (QCoordinateRegion region
toRectToView: (UIView *)  view 

将经纬度矩形区域转换为View矩形区域

参数
region待转换的经纬度矩形
view指定相对的View
返回
转换后的View矩形区域

◆ dequeueReusableAnnotationViewWithIdentifier:

- (QAnnotationView *) dequeueReusableAnnotationViewWithIdentifier: (NSString *)  identifier

根据指定标识查找一个可被复用的标注View,一般在delegate中使用,用此函数来代替新申请一个View

参数
identifier指定标识
返回
返回可被复用的标注View

由 category QMapView(Annotation) 提供.

◆ deselectAnnotation:animated:

- (void) deselectAnnotation: (id< QAnnotation >)  annotation
animated: (BOOL)  animated 

取消指定的标注的选中状态

参数
annotation指定的标注
animated是否支持动画

由 category QMapView(Annotation) 提供.

◆ enableAutoMaxOverlooking:

- (void) enableAutoMaxOverlooking: (BOOL)  enable

允许最大俯仰角跟随缩放级别变化

参数
enable是否打开

◆ glPointRatio

- (CGFloat) glPointRatio

返回每屏幕Point单位对应的OpenGL坐标系下的长度

返回
OpenGL/屏幕Point 的比例关系

◆ glProjectionMatrix

- (float *) glProjectionMatrix

获取当前地图projection矩阵

返回
矩阵数组(长度为16)

◆ glVertexForCoordinate:

- (CGPoint) glVertexForCoordinate: (CLLocationCoordinate2D)  coordinate

将经纬度坐标转换为OpenGL使用的坐标

参数
coordinate经纬度坐标
返回
OpenGL坐标系下的坐标

◆ glViewMatrix

- (float *) glViewMatrix

获取当前地图view矩阵

返回
矩阵数组(长度为16)

◆ initWithFrame:config:

- (instancetype) initWithFrame: (CGRect)  frame
config: (QMapConfig *)  config 

初始化 QMapView

参数
frameQMapView 的 frame 矩形.
configQMapView 的配置属性.
返回
QMapView 对象.

由 category QMapView(Config) 提供.

◆ loadPrefferedResourceFilesFromDirectory:

+ (void) loadPrefferedResourceFilesFromDirectory: (NSString *)  DEPRECATED_ATTRIBUTE

使用用户传入的地图资源文件(在地图初始化前调用)

参数
path资源文件存放目录的全路径

◆ mapRectThatFits:containsCalloutView:annotations:edgePadding:

- (QMapRect) mapRectThatFits: (QMapRect mapRect
containsCalloutView: (BOOL)  bContainsCalloutView
annotations: (NSArray< id< QAnnotation > > *)  annotations
edgePadding: (UIEdgeInsets)  insets 

根据当前地图View的窗口大小调整传入的mapRect,返回适合当前地图窗口显示的mapRect(2D北朝上场景时)

参数
mapRect待调整的地理范围
bContainsCalloutView计算的maprect是否需要包含calloutView
annotations要包含的annotation 数组
insetsmapRect四周要预留的边界大小
返回
调整后适合当前地图窗口显示的地图范围

◆ mapRectThatFits:edgePadding:

- (QMapRect) mapRectThatFits: (QMapRect mapRect
edgePadding: (UIEdgeInsets)  insets 

根据边界留宽计算合适的地理范围

参数
mapRect待调整的地理范围
返回
调整后的地图范围

◆ metersPerPointAtLatitude:zoomLevel:

- (double) metersPerPointAtLatitude: (CLLocationDegrees)  latitude
zoomLevel: (CGFloat)  zoomLevel 

在指定的缩放级别和指定纬度下, 1 screen point 对应的距离(单位是米).

参数
latitude指定纬度下
zoomLevel指定的缩放级别
返回
对应的距离(单位是米)

◆ removeAnnotation:

- (void) removeAnnotation: (id< QAnnotation >)  annotation

移除标注

参数
annotation要移除的标注

由 category QMapView(Annotation) 提供.

◆ removeAnnotations:

- (void) removeAnnotations: (NSArray *)  annotations

移除一组标注

参数
annotations要移除的标注数组

由 category QMapView(Annotation) 提供.

◆ removeAOILayer:

- (void) removeAOILayer: (QAOILayer *)  layer

从地图移除一个 AOI 图层

参数
layer要移除的图层

由 category QMapView(AOILayer) 提供.

◆ removeCustomLayer:

- (void) removeCustomLayer: (QCustomLayer *)  layer

从地图移除一个个性化图层

参数
layer要移除的图层

由 category QMapView(CustomLayer) 提供.

◆ removeOverlay:

- (void) removeOverlay: (id< QOverlay >)  overlay

移除Overlay

参数
overlay要移除的overlay

由 category QMapView(Overlay) 提供.

◆ removeOverlays:

- (void) removeOverlays: (NSArray< id< QOverlay >> *)  overlays

移除Overlay

参数
overlays要移除的overlay列表

由 category QMapView(Overlay) 提供.

◆ removeVisualLayer:

- (void) removeVisualLayer: (QVisualLayer *)  visualOverlay

从地图移除一个个性化图层

参数
visualOverlay要移除的图层

由 category QMapView(VisualLayer) 提供.

◆ requestTempPrecisedLocation:purposeKey:completion:

- (void) requestTempPrecisedLocation: (QMapView *)  mapView
purposeKey: (NSString *)  key
completion: (ios(14))  API_AVAILABLE 

申请临时精确定位权限

参数
keyinfo.plist中 NSLocationTemporaryUsageDescriptionDictionary 设置的 key

由 category QMapView(UserLocation) 提供.

◆ selectAnnotation:animated:

- (void) selectAnnotation: (id< QAnnotation >)  annotation
animated: (BOOL)  animated 

选中指定的标注

参数
annotation指定的标注
animated是否支持动画

由 category QMapView(Annotation) 提供.

◆ setBuildingBlackList:count:

- (void) setBuildingBlackList: (QMapRect *)  noBuildingList
count: (int)  count 

设置不显示建筑物的区域.

参数
noBuildingListyes为显示,否则不显示
count区域个数

◆ setCenterCoordinate:animated:

- (void) setCenterCoordinate: (CLLocationCoordinate2D)  coordinate
animated: (BOOL)  animated 

设置中心点经纬度

参数
coordinate中心点经纬度
animated是否采用动画

◆ setCenterOffset:animated:

- (void) setCenterOffset: (CGPoint)  offset
animated: ((deprecated("use -(void)setCenterOffsetV2:(CGPoint)offset animated:(BOOL)animated instead")))  __attribute__ 

设置中心点偏移

参数
offset中心点偏移,向右向下为正. 单位:屏幕比例值(0.25 ~ 0.75)默认为(0.5, 0.5)
animated是否采用动画

◆ setCenterOffsetV2:animated:

- (void) setCenterOffsetV2: (CGPoint)  offset
animated: (BOOL)  animated 

设置中心点偏移

参数
offset中心点偏移,向右向下为正,默认为(0.5, 0.5),范围是 [0.05, 0.95]。若超出范围,则被裁减到 [0.05, 0.95]。
animated是否采用动画

◆ setForeignLanguage:

- (void) setForeignLanguage: (QMapLanguage)  language

指定海外图文字的首选语言

指定海外图文字的语言,默认采用中文

参数
language指定的语言
参见
QMapLanguage

◆ setLimitMapRect:mode:

- (void) setLimitMapRect: (QMapRect mapRect
mode: (QMapLimitRectFitMode)  mode 

根据边界留宽显示限制地图区域范围(2D北朝上场景时)

参数
mapRect待调整的地理范围
mode限制地区区域的对齐方式,分等宽对齐和等高对齐 当传入的mapRect的值都为0时,取消区域限制

◆ setLogoMargin:anchor:

- (void) setLogoMargin: (CGPoint)  margin
anchor: (QMapLogoAnchor)  anchor 

设置地图Logo位置和大小. 调用后会覆盖默认位置

参数
margin基于指定锚点(近边之间)的边距长度值. 单位Point, 默认为(6, 3)
anchorLogo基于mapview的位置的基准锚点.

◆ setLogoOffset:

- (void) setLogoOffset: (CGPoint)  DEPRECATED_ATTRIBUTE

设置地图Logo偏移

参数
offsetLogo中心的偏移量. 如果offset为CGPointZero则为默认位置

◆ setLogoScale:

- (void) setLogoScale: (CGFloat)  scale

设置地图Logo大小.

参数
scaleLogo大小. 基于原始大小的比例值, 默认为1.0. 有效区间[0.7, 1.3]

◆ setMapStyle:

- (void) setMapStyle: (int)  styleType

改变底图样式

@notes 值为在官网配置的自定义样式列表中的顺序, 从1开始

◆ setMinZoomLevel:maxZoomLevel:

- (void) setMinZoomLevel: (CGFloat)  minZoomLevel
maxZoomLevel: (CGFloat)  maxZoomLevel 

设置最小最大缩放级别, 范围 3 <= minZoomLevel <= maxZoomLevel <= 20

参数
minZoomLevel最小缩放级别
maxZoomLevel最大缩放级别

◆ setOverlooking:animated:

- (void) setOverlooking: (CGFloat)  overlooking
animated: (BOOL)  animated 

设置overlooking, 范围 [0, 45], 单位(角度)

参数
overlookingoverlooking
animated是否采用动画

◆ setOverseaSource:

- (void) setOverseaSource: (QOverseaProvider *)  provider

切换自定义图源

参数
provider自定义的图源

由 category QMapView(Config) 提供.

◆ setRegion:animated:

- (void) setRegion: (QCoordinateRegion region
animated: (BOOL)  animated 

设定当前地图的region

参数
region要设定的地图范围,用经纬度的方式表示
animated是否采用动画

◆ setRegion:edgePadding:animated:

- (void) setRegion: (QCoordinateRegion region
edgePadding: (UIEdgeInsets)  insets
animated: (BOOL)  animated 

设定当前地图的region

参数
region要设定的地图范围,用经纬度的方式表示
insets要嵌入的边界
animated是否采用动画

◆ setRoadEventVisible:

- (void) setRoadEventVisible: (BOOL)  DEPRECATED_ATTRIBUTE

设置是否显示封路事件

参数
visibleyes为显示,否则不显示

◆ setRotation:animated:

- (void) setRotation: (CGFloat)  rotation
animated: (BOOL)  animated 

设置旋转角度, 正角度向右转, 单位(角度)

参数
rotation旋转角度
animated是否采用动画

◆ setScaleViewFadeEnable:

- (void) setScaleViewFadeEnable: (BOOL)  enable

设置比例尺是否淡出,比例尺只在地图级别变化的时候淡入,并在地图级别停止变化后淡出

参数
enable为true时,比例尺会淡出;为false时,比例尺常驻

◆ setScaleViewOffset:

- (void) setScaleViewOffset: (CGPoint)  offset

设置地图比例尺偏移

参数
offset比例尺的偏移量. 如果offset为CGPointZero则为默认位置

◆ setStyleType:

- (void) setStyleType: (QMapStyleType)  DEPRECATED_ATTRIBUTE

设置底图样式,默认为标准样式.

参数
styleType用户自定义配置的样式序号.

@notes 已弃用, 请使用setMapStyle

◆ setUserTrackingMode:animated:

- (void) setUserTrackingMode: (QUserTrackingMode)  mode
animated: (BOOL)  animated 

设置追踪用户位置的模式

参数
mode要使用的模式
animated是否采用动画

由 category QMapView(UserLocation) 提供.

◆ setVisibleMapRect:animated:

- (void) setVisibleMapRect: (QMapRect mapRect
animated: (BOOL)  animated 

设置当前地图可见范围的mapRect

参数
mapRect目标mapRect
animated是否采用动画

◆ setVisibleMapRect:edgePadding:animated:

- (void) setVisibleMapRect: (QMapRect mapRect
edgePadding: (UIEdgeInsets)  insets
animated: (BOOL)  animated 

设置当前地图可见范围的mapRect

参数
mapRect目标mapRect
insets要嵌入的边界
animated是否采用动画

◆ setZoomLevel:animated:

- (void) setZoomLevel: (CGFloat)  zoomLevel
animated: (BOOL)  animated 

设置缩放级别

参数
zoomLevel缩放级别
animated是否采用动画

◆ showAnnotations:edgePadding:animated:

- (void) showAnnotations: (NSArray< id< QAnnotation >> *)  annotations
edgePadding: (UIEdgeInsets)  insets
animated: (BOOL)  animated 

设置地图使其可以显示数组中所有的annotation, 当只有一个时,则将其作为地图的中心点.

参数
annotations需要显示的annotations
insetsinsets 嵌入边界
animated是否执行动画

由 category QMapView(Annotation) 提供.

◆ showOverlays:edgePadding:animated:

- (void) showOverlays: (NSArray< id< QOverlay >> *)  overlays
edgePadding: (UIEdgeInsets)  insets
animated: (BOOL)  animated 

设置地图使其可以显示数组中所有的overlay,

参数
overlays需要显示的overlays
insetsinsets 嵌入边界
animated是否执行动画

由 category QMapView(Overlay) 提供.

◆ showQMarkers:edgePadding:animated:

- (void) showQMarkers: (NSArray< QMarker * > *)  markers
edgePadding: (UIEdgeInsets)  insets
animated: (BOOL)  animated 

设置地图使其可以显示数组中所有的QMarker覆盖物,

参数
markers需要显示的markers
insetsinsets 嵌入边界
animated是否执行动画

由 category QMapView(Overlay) 提供.

◆ takeSnapshotInRect:completion: [1/2]

- (void) takeSnapshotInRect: (CGRect)  rect
completion: (void(^)(UIImage *resultImage))  completion 

异步截图 (默认超时时间为2.5秒)

参数
rect范围
completion异步block结果

由 category QMapView(Snapshot) 提供.

◆ takeSnapshotInRect:completion: [2/2]

- ((deprecated("use - (void) takeSnapshotInRect: (CGRect)  rect
completion: (void(^)(UIImage *resultImage))  instead 

截图

返回
截图image

由 category QMapView(Snapshot) 提供.

◆ takeSnapshotInRect:timeout:afterScreenUpdates:completion:

- (void) takeSnapshotInRect: (CGRect)  rect
timeout: (CFTimeInterval)  timeout
afterScreenUpdates: (BOOL)  afterUpdates
completion: (void(^)(UIImage *resultImage))  completion 

异步截图

参数
rect范围
timeout超时时间.
afterUpdates是否等待当前内容更新完.
completion异步block结果

由 category QMapView(Snapshot) 提供.

◆ takeSnapshotInRect:timeout:completion:

- (void) takeSnapshotInRect: (CGRect)  rect
timeout: (CFTimeInterval)  timeout
completion: (void(^)(UIImage *resultImage))  completion 

异步截图

参数
rect范围
timeout超时时间.
completion异步block结果

由 category QMapView(Snapshot) 提供.

◆ viewForAnnotation:

- (QAnnotationView *) viewForAnnotation: (id< QAnnotation >)  annotation

查找指定标注对应的View,如果该标注尚未显示,返回nil

参数
annotation指定的标注
返回
指定标注对应的View

由 category QMapView(Annotation) 提供.

◆ viewForOverlay:

- (QOverlayView *) viewForOverlay: (id< QOverlay >)  overlay

返回指定overlay对象的OverlayView

参数
overlay待查询的overlay
返回
对应的OverlayView

由 category QMapView(Overlay) 提供.

◆ zoomLevelThatFits:edgePadding:outCenterCoordinate:

- (CGFloat) zoomLevelThatFits: (QMapRect mapRect
edgePadding: (UIEdgeInsets)  insets
outCenterCoordinate: (CLLocationCoordinate2D *)  outCoordinate 

根据边界留宽及地理范围计算合适的级别(2D北朝上场景时)

参数
mapRect待调整的地理范围
outCoordinate合适的中心点经纬度.
返回
合适的级别

属性说明

◆ alwaysTriggerDidTapCoordinateEnabled

- (BOOL) alwaysTriggerDidTapCoordinateEnabled
readwritenonatomicassign

当地图被单击时,是否总是触发 "地图点击回调",默认为NO. 地图点击回调:

  • (void)mapView:(QMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D)coordinate;

当设置为NO时:只有当点击到地图空白处(即未点击到 Annotation, POI,Polyline,Polygon,定位标) 才会触发回调。 当设置为YES时:只要点击到地图(未点击到 Annotation),就会触发回调。

◆ handDrawMapEnabled

- (BOOL) handDrawMapEnabled
readwritenonatomicassign

是否开启手绘图,默认为 NO

@notes 打开手绘图会将最大级别限制为19

◆ labelSize

- (QMapLabelSize) labelSize
readwritenonatomicassign

设置底图上的标注的字体大小

默认QMapLabelSize_Normal.

◆ locatorZIndex

- (int) locatorZIndex
readwritenonatomicassign

位置图标的显示顺序,决定了它与其它QOverlayView的压盖关系. 默认为10000000.

大值压盖小值. 只有同displayLevel的QOverlayView才会比较zIndex

由 category QMapView(UserLocation) 提供.

◆ pausesLocationUpdatesAutomatically

- (BOOL) pausesLocationUpdatesAutomatically
readwritenonatomicassign

指定定位是否会被系统自动暂停. 默认为YES.

由 category QMapView(UserLocation) 提供.

◆ scrollEnabled

- (BOOL) scrollEnabled
readwritenonatomicassign

设定地图View能否支持用户移动地图, 默认为YES.

◆ zoomEnabled

- (BOOL) zoomEnabled
readwritenonatomicassign

设定地图View能否支持用户多点缩放, 默认为YES.


该类的文档由以下文件生成: