|
TencentMapSDK_iOS_3D_v4.3.4
|
地图view的核心类 更多...
#import <QMapView.h>
构造函数 | |
| (void) | - setStyleType: |
| 设置底图样式,默认为标准样式. 更多... | |
| (void) | - setMapStyle: |
| 改变底图样式 更多... | |
| (void) | - setCompassOffset: |
| 设置指南针基于默认位置的偏移. 右下为正 | |
| (void) | - setForeignLanguage: |
| 指定底图文字的首选语言 更多... | |
| (void) | - setCenterOffsetY: |
| 设置中心点偏移,向下为正. 单位:比例值(-0.25 ~ 0.25)默认为0 | |
| (void) | - setCenterOffset: |
| 设置中心点偏移,向右向下为增长. 单位:屏幕比例值(0.25 ~ 0.75)默认为(0.5, 0.5) | |
| (void) | - setCenterOffset:animated: |
| 设置中心点偏移 更多... | |
| (void) | - setLogoOffset: |
| 设置地图Logo偏移 更多... | |
| (void) | - setLogoMargin:anchor: |
| 设置地图Logo位置和大小. 调用后会覆盖默认位置 更多... | |
| (void) | - setLogoScale: |
| 设置地图Logo大小. 更多... | |
| (void) | - setScaleViewOffset: |
| 设置地图比例尺偏移 更多... | |
| (void) | - setRoadEventVisible: |
| 设置是否显示封路事件 更多... | |
| (void) | - setCenterCoordinate:animated: |
| 设置中心点经纬度 更多... | |
| (void) | - setMinZoomLevel:maxZoomLevel: |
| 设置最小最大缩放级别, 范围 3 <= minZoomLevel <= maxZoomLevel <= 20 更多... | |
| (void) | - setZoomLevel:animated: |
| 设置缩放级别 更多... | |
| (void) | - setRotation:animated: |
| 设置旋转角度, 正角度向右转, 单位(角度) 更多... | |
| (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坐标系下的长度 更多... | |
| (CGPoint) | - convertCoordinate:toPointToView: |
| 将经纬度坐标转换为View坐标 更多... | |
| (CLLocationCoordinate2D) | - convertPoint:toCoordinateFromView: |
| 将View坐标转换成经纬度坐标 更多... | |
| (CGRect) | - convertRegion:toRectToView: |
| 将经纬度矩形区域转换为View矩形区域 更多... | |
| (QCoordinateRegion) | - convertRect:toRegionFromView: |
| 将View矩形区域转换成经纬度矩形区域 更多... | |
| (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: |
| 取消指定的标注的选中状态 更多... | |
| (instancetype) | - initWithFrame:config: |
| 初始化 QMapView 更多... | |
| (void) | - addCustomLayer: |
| 向地图添加一个图层 更多... | |
| (void) | - removeCustomLayer: |
| 从地图移除一个个性化图层 更多... | |
| (NSString *) | - getDebugError |
| 地图view的错误信息, 用于定位问题 | |
| (void) | - setIndoorEnabled: |
| 室内图开关. | |
| (void) | - setActiveIndoorInfo: |
| 手动切换到指定的室内图及楼层 | |
| (void) | - addOverlay: |
| 向地图窗口添加Overlay,需要实现QMapViewDelegate的-mapView:viewForOverlay:函数来生成标注对应的View 更多... | |
| (void) | - addOverlays: |
| 批量向地图窗口添加Overlay,需要实现QMapViewDelegate的-mapView:viewForOverlay:函数来生成标注对应的View 更多... | |
| (void) | - removeOverlay: |
| 移除Overlay 更多... | |
| (void) | - removeOverlays: |
| 移除Overlay 更多... | |
| (QOverlayView *) | - viewForOverlay: |
| 返回指定overlay对象的OverlayView 更多... | |
| ((deprecated("use - (void) | - takeSnapshotInRect:completion: |
| 截图 更多... | |
| (void) | - takeSnapshotInRect:completion: |
| 异步截图 (默认超时时间为2.5秒) 更多... | |
| (void) | - takeSnapshotInRect:timeout:completion: |
| 异步截图 更多... | |
| (void) | - configureUserLocationPresentation: |
| 配置当前位置UI属性 (必须在QMapView 初始化以后, 定位开启之前调用) 更多... | |
| (void) | - setUserTrackingMode:animated: |
| 设置追踪用户位置的模式 更多... | |
| (void) | - setUserLocationHidden: |
| 在地图中隐藏位置图标 | |
类方法 | |
| (void) | + loadPrefferedResourceFilesFromDirectory: |
| 使用用户传入的地图资源文件(在地图初始化前调用) 更多... | |
属性 | |
| BOOL | handDrawMapEnabled |
| 是否开启手绘图,默认为 NO 更多... | |
| BOOL | showsTraffic |
| 是否开启路况图,默认为 NO | |
| id< QMapViewDelegate > | delegate |
| 地图回调 | |
| QMapType | mapType |
| BOOL | showsScale |
| 是否显示比例尺,默认为YES | |
| BOOL | showsBuildings |
| 是否显示建筑物,默认为YES | |
| BOOL | shows3DBuildings |
| 是否显示建筑物样式为3D效果,默认为YES | |
| BOOL | showsPoi |
| 是否显示底图上的标注及名称,默认为YES | |
| BOOL | showsCompass |
| 是否显示指南针,默认为NO | |
| QBasicMapViewLayer * | animationLayer |
| 地图动画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 |
| 当前地图的经纬度范围,设定的该范围可能会被调整为适合地图窗口显示的范围 | |
| BOOL | zoomEnabled |
| BOOL | keepCenterDuringZoom |
| pinch时保持中心点, 默认为YES | |
| BOOL | scrollEnabled |
| BOOL | overlookingEnabled |
| 是否支持俯视. 默认为YES. | |
| BOOL | rotateEnabled |
| 是否支持旋转. 默认为YES. | |
| NSString * | userLocationAccessibilityLabel |
| 定位图标对应的无障碍label. | |
| BOOL | annotationAccessibilityFrameClipToBounds |
| 标注view的accessibilityFrame是否会包含其子view. 默认为YES | |
| NSArray * | annotations |
| 当前地图View的已经添加的标注数组 | |
| NSArray< id< QAnnotation > > * | selectedAnnotations |
| 当前选中的annotations | |
| BOOL | indoorPicker |
| 是否使用内置的楼层选择控件. 默认为YES. | |
| CGPoint | indoorPickerOffset |
| 默认的楼层选择控件偏移位置. 向右下增长 | |
| QIndoorBuilding * | activeBuilding |
| 当前处于激活态的整个室内图数据 | |
| QIndoorLevel * | activeLevel |
| 当前正在展示的室内楼层. | |
| NSArray * | overlays |
| 当前mapView中已经添加的Overlay数组 | |
| BOOL | showsUserLocation |
| 开启定位并展示位置图标. | |
| QUserLocation * | userLocation |
| 当前位置信息 | |
| CLLocationAccuracy | desiredAccuracy |
| 设定定位精度。默认为kCLLocationAccuracyBest | |
| CLLocationDistance | distanceFilter |
| 设定定位的最小更新距离。默认为kCLDistanceFilterNone,会提示任何移动 | |
| CLLocationDegrees | headingFilter |
| 设定最小更新角度。默认为1度,设定为kCLHeadingFilterNone会提示任何角度改变 | |
| BOOL | allowsBackgroundLocationUpdates |
| 以上是否允许后台定位。ios9以上可用. 请参考CLLocationManager.allowsBackgroundLocationUpdates | |
| BOOL | pausesLocationUpdatesAutomatically |
| QUserTrackingMode | userTrackingMode |
| 定位用户位置的模式 | |
| BOOL | userLocationVisible |
| 当前位置在地图中是否可见 | |
地图view的核心类
| - (void) addAnnotation: | (id< QAnnotation >) | annotation |
向地图窗口添加标注,需要实现QMapViewDelegate的-mapView:viewForAnnotation:函数来生成标注对应的View
| annotation | 要添加的标注 |
由 category QMapView(Annotation) 提供.
| - (void) addAnnotations: | (NSArray *) | annotations |
向地图窗口添加一组标注,需要实现QMapViewDelegate的-mapView:viewForAnnotation:函数来生成标注对应的View
| annotations | 要添加的标注数组 |
由 category QMapView(Annotation) 提供.
| - (void) addCustomLayer: | (QCustomLayer *) | layer |
| - (void) addOverlay: | (id< QOverlay >) | overlay |
向地图窗口添加Overlay,需要实现QMapViewDelegate的-mapView:viewForOverlay:函数来生成标注对应的View
| overlay | 要添加的overlay |
由 category QMapView(Overlay) 提供.
| - (void) addOverlays: | (NSArray< id< QOverlay >> *) | overlays |
批量向地图窗口添加Overlay,需要实现QMapViewDelegate的-mapView:viewForOverlay:函数来生成标注对应的View
| overlays | 要添加的overlay列表 |
由 category QMapView(Overlay) 提供.
| - (void) bringAnnotationToFront: | (id< QAnnotation >) | DEPRECATED_ATTRIBUTE |
将制定的annotation放在最上层渲染.
| annotation | 指定的annotation |
由 category QMapView(Annotation) 提供.
| - (void) configureUserLocationPresentation: | (QUserLocationPresentation *) | presentation |
配置当前位置UI属性 (必须在QMapView 初始化以后, 定位开启之前调用)
| presentation | 位置UI属性 |
由 category QMapView(UserLocation) 提供.
| - (CGPoint) convertCoordinate: | (CLLocationCoordinate2D) | coordinate | |
| toPointToView: | (UIView *) | view | |
将经纬度坐标转换为View坐标
| coordinate | 待转换的经纬度坐标 |
| view | 指定相对的View |
| - (CLLocationCoordinate2D) convertPoint: | (CGPoint) | point | |
| toCoordinateFromView: | (UIView *) | view | |
将View坐标转换成经纬度坐标
| point | 待转换的View坐标 |
| view | point坐标所在的view |
| - (QCoordinateRegion) convertRect: | (CGRect) | rect | |
| toRegionFromView: | (UIView *) | view | |
将View矩形区域转换成经纬度矩形区域
| rect | 待转换的View矩形区域 |
| view | rect坐标所在的view |
| - (CGRect) convertRegion: | (QCoordinateRegion) | region | |
| toRectToView: | (UIView *) | view | |
将经纬度矩形区域转换为View矩形区域
| region | 待转换的经纬度矩形 |
| view | 指定相对的View |
| - (QAnnotationView *) dequeueReusableAnnotationViewWithIdentifier: | (NSString *) | identifier |
根据指定标识查找一个可被复用的标注View,一般在delegate中使用,用此函数来代替新申请一个View
| identifier | 指定标识 |
由 category QMapView(Annotation) 提供.
| - (void) deselectAnnotation: | (id< QAnnotation >) | annotation | |
| animated: | (BOOL) | animated | |
| - (CGFloat) glPointRatio |
返回每屏幕Point单位对应的OpenGL坐标系下的长度
| - (float *) glProjectionMatrix |
获取当前地图projection矩阵
| - (CGPoint) glVertexForCoordinate: | (CLLocationCoordinate2D) | coordinate |
将经纬度坐标转换为OpenGL使用的坐标
| coordinate | 经纬度坐标 |
| - (float *) glViewMatrix |
获取当前地图view矩阵
| - (instancetype) initWithFrame: | (CGRect) | frame | |
| config: | (QMapConfig *) | config | |
| + (void) loadPrefferedResourceFilesFromDirectory: | (NSString *) | DEPRECATED_ATTRIBUTE |
使用用户传入的地图资源文件(在地图初始化前调用)
| path | 资源文件存放目录的全路径 |
| - (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 数组 |
| insets | mapRect四周要预留的边界大小 |
根据边界留宽计算合适的地理范围
| mapRect | 待调整的地理范围 |
| - (void) removeAnnotation: | (id< QAnnotation >) | annotation |
| - (void) removeAnnotations: | (NSArray *) | annotations |
| - (void) removeCustomLayer: | (QCustomLayer *) | layer |
| - (void) removeOverlay: | (id< QOverlay >) | overlay |
| - (void) removeOverlays: | (NSArray< id< QOverlay >> *) | overlays |
| - (void) selectAnnotation: | (id< QAnnotation >) | annotation | |
| animated: | (BOOL) | animated | |
| - (void) setCenterCoordinate: | (CLLocationCoordinate2D) | coordinate | |
| animated: | (BOOL) | animated | |
设置中心点经纬度
| coordinate | 中心点经纬度 |
| animated | 是否采用动画 |
| - (void) setCenterOffset: | (CGPoint) | offset | |
| animated: | (BOOL) | animated | |
设置中心点偏移
| offset | 中心点偏移,向右向下为正. 单位:屏幕比例值(0.25 ~ 0.75)默认为(0.5, 0.5) |
| animated | 是否采用动画 |
| - (void) setForeignLanguage: | (QMapLanguage) | language |
指定底图文字的首选语言
指定底图文字的语言,默认采用中文
| language | 指定的语言 |
| - (void) setLimitMapRect: | (QMapRect) | mapRect | |
| mode: | (QMapLimitRectFitMode) | mode | |
根据边界留宽显示限制地图区域范围(2D北朝上场景时)
| mapRect | 待调整的地理范围 |
| mode | 限制地区区域的对齐方式,分等宽对齐和等高对齐 当传入的mapRect的值都为0时,取消区域限制 |
| - (void) setLogoMargin: | (CGPoint) | margin | |
| anchor: | (QMapLogoAnchor) | anchor | |
设置地图Logo位置和大小. 调用后会覆盖默认位置
| margin | 基于指定锚点(近边之间)的边距长度值. 单位Point, 默认为(6, 3) |
| anchor | Logo基于mapview的位置的基准锚点. |
| - (void) setLogoOffset: | (CGPoint) | DEPRECATED_ATTRIBUTE |
设置地图Logo偏移
| offset | Logo中心的偏移量. 如果offset为CGPointZero则为默认位置 |
| - (void) setLogoScale: | (CGFloat) | scale |
设置地图Logo大小.
| scale | Logo大小. 基于原始大小的比例值, 默认为1.0. 有效区间[0.7, 1.3] |
| - (void) setMapStyle: | (int) | styleType |
改变底图样式
@notes 值为在官网配置的自定义样式列表中的顺序, 从1开始
| - (void) setMinZoomLevel: | (CGFloat) | minZoomLevel | |
| maxZoomLevel: | (CGFloat) | maxZoomLevel | |
设置最小最大缩放级别, 范围 3 <= minZoomLevel <= maxZoomLevel <= 20
| minZoomLevel | 最小缩放级别 |
| maxZoomLevel | 最大缩放级别 |
| - (void) setOverlooking: | (CGFloat) | overlooking | |
| animated: | (BOOL) | animated | |
设置overlooking, 范围 [0, 45], 单位(角度)
| overlooking | overlooking |
| animated | 是否采用动画 |
| - (void) setRegion: | (QCoordinateRegion) | region | |
| animated: | (BOOL) | animated | |
设定当前地图的region
| region | 要设定的地图范围,用经纬度的方式表示 |
| animated | 是否采用动画 |
| - (void) setRegion: | (QCoordinateRegion) | region | |
| edgePadding: | (UIEdgeInsets) | insets | |
| animated: | (BOOL) | animated | |
设定当前地图的region
| region | 要设定的地图范围,用经纬度的方式表示 |
| insets | 要嵌入的边界 |
| animated | 是否采用动画 |
| - (void) setRoadEventVisible: | (BOOL) | DEPRECATED_ATTRIBUTE |
设置是否显示封路事件
| visible | yes为显示,否则不显示 |
| - (void) setRotation: | (CGFloat) | rotation | |
| animated: | (BOOL) | animated | |
设置旋转角度, 正角度向右转, 单位(角度)
| rotation | overlooking |
| animated | 是否采用动画 |
| - (void) setScaleViewOffset: | (CGPoint) | offset |
设置地图比例尺偏移
| offset | 比例尺的偏移量. 如果offset为CGPointZero则为默认位置 |
| - (void) setStyleType: | (QMapStyleType) | DEPRECATED_ATTRIBUTE |
设置底图样式,默认为标准样式.
| styleType | 用户自定义配置的样式序号. |
@notes 已弃用, 请使用setMapStyle
| - (void) setUserTrackingMode: | (QUserTrackingMode) | mode | |
| animated: | (BOOL) | animated | |
| - (void) setVisibleMapRect: | (QMapRect) | mapRect | |
| animated: | (BOOL) | animated | |
设置当前地图可见范围的mapRect
| mapRect | 目标mapRect |
| animated | 是否采用动画 |
| - (void) setVisibleMapRect: | (QMapRect) | mapRect | |
| edgePadding: | (UIEdgeInsets) | insets | |
| animated: | (BOOL) | animated | |
设置当前地图可见范围的mapRect
| mapRect | 目标mapRect |
| insets | 要嵌入的边界 |
| animated | 是否采用动画 |
| - (void) setZoomLevel: | (CGFloat) | zoomLevel | |
| animated: | (BOOL) | animated | |
设置缩放级别
| zoomLevel | 缩放级别 |
| animated | 是否采用动画 |
| - ((deprecated("use - (void) takeSnapshotInRect: | (CGRect) | rect | |
| completion: | (void(^)(UIImage *resultImage)) | instead | |
| - (void) takeSnapshotInRect: | (CGRect) | rect | |
| completion: | (void(^)(UIImage *resultImage)) | completion | |
| - (void) takeSnapshotInRect: | (CGRect) | rect | |
| timeout: | (CFTimeInterval) | timeout | |
| completion: | (void(^)(UIImage *resultImage)) | completion | |
| - (QAnnotationView *) viewForAnnotation: | (id< QAnnotation >) | annotation |
| - (QOverlayView *) viewForOverlay: | (id< QOverlay >) | overlay |
| - (CGFloat) zoomLevelThatFits: | (QMapRect) | mapRect | |
| edgePadding: | (UIEdgeInsets) | insets | |
| outCenterCoordinate: | (CLLocationCoordinate2D *) | outCoordinate | |
根据边界留宽及地理范围计算合适的级别(2D北朝上场景时)
| mapRect | 待调整的地理范围 |
| outCoordinate | 合适的中心点经纬度. |
|
readwritenonatomicassign |
是否开启手绘图,默认为 NO
@notes 打开手绘图会将最大级别限制为19
|
readwritenonatomicassign |
指定定位是否会被系统自动暂停. 默认为YES.
由 category QMapView(UserLocation) 提供.
|
readwritenonatomicassign |
设定地图View能否支持用户移动地图, 默认为YES.
|
readwritenonatomicassign |
设定地图View能否支持用户多点缩放, 默认为YES.