TencentMapSDK_iOS_3D_v4.3.4
QMapView.h
1 //
2 // QMapView.h
3 // QMapKit
4 //
5 // Created by tabsong on 17/5/15.
6 // Copyright © 2017年 tencent. All rights reserved.
7 //
8 
9 #import <UIKit/UIKit.h>
10 #import "QGeometry.h"
11 #import "QAnnotation.h"
12 #import "QAnnotationView.h"
13 #import "QOverlayView.h"
14 #import "QBasicMapViewLayer.h"
15 #import "QTypes.h"
16 #import "QUserLocationPresentation.h"
17 #import "QTileOverlay.h"
18 #import "QCustomLayer.h"
19 #import "QText.h"
20 
21 typedef NS_ENUM(NSInteger, QUserTrackingMode)
22 {
23  QUserTrackingModeNone = 0,
24  QUserTrackingModeFollow = 1,
25  QUserTrackingModeFollowWithHeading = 2
26 };
27 
28 typedef NS_ENUM(NSUInteger, QMapLogoAnchor)
29 {
30  QMapLogoAnchorRightBottom = 0,
31  QMapLogoAnchorLeftBottom,
32  QMapLogoAnchorLeftTop,
33  QMapLogoAnchorRightTop,
34  QMapLogoAnchorMax
35 };
36 
37 @class QUserLocation;
38 @protocol QMapViewDelegate;
39 
40 
41 #pragma mark - QMapView
42 
46 @interface QMapView : UIView
47 
48 #pragma mark - TileOverlay
49 
55 @property (nonatomic, assign, getter = isHandDrawMapEnabled) BOOL handDrawMapEnabled;
56 
60 @property (nonatomic, assign) BOOL showsTraffic;
61 
62 #pragma mark - Resources
63 
69 + (void)loadPrefferedResourceFilesFromDirectory:(NSString *)path DEPRECATED_ATTRIBUTE;
70 
71 #pragma mark - Basic
72 
76 @property (nonatomic, weak) id<QMapViewDelegate> delegate;
77 
78 /*@
79  * @brief 地图类型
80  */
81 @property (nonatomic, assign) QMapType mapType;
82 
83 
91 - (void)setStyleType:(QMapStyleType)styleType DEPRECATED_ATTRIBUTE;
92 
98 - (void)setMapStyle:(int)styleType;
99 
103 @property (nonatomic) BOOL showsScale;
104 
108 @property (nonatomic) BOOL showsBuildings;
109 
113 @property (nonatomic) BOOL shows3DBuildings;
114 
118 @property (nonatomic) BOOL showsPoi;
119 
123 @property (nonatomic) BOOL showsCompass;
124 
128 - (void)setCompassOffset:(CGPoint)offset;
129 
138 - (void)setForeignLanguage:(QMapLanguage)language;
139 
143 - (void)setCenterOffsetY:(float)offset DEPRECATED_ATTRIBUTE;
144 
148 - (void)setCenterOffset:(CGPoint)offset;
149 
156 - (void)setCenterOffset:(CGPoint)offset animated:(BOOL)animated;
157 
163 - (void)setLogoOffset:(CGPoint)offset DEPRECATED_ATTRIBUTE;
164 
171 - (void)setLogoMargin:(CGPoint)margin anchor:(QMapLogoAnchor)anchor;
172 
178 - (void)setLogoScale:(CGFloat)scale;
179 
185 - (void)setScaleViewOffset:(CGPoint)offset;
186 
192 - (void)setRoadEventVisible:(BOOL)visible DEPRECATED_ATTRIBUTE;
193 
199 @property (nonatomic, readonly) QBasicMapViewLayer *animationLayer;
200 
201 #pragma mark - MapStatus
202 
206 @property (nonatomic, assign) CLLocationCoordinate2D centerCoordinate;
207 
214 - (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated;
215 
219 @property (nonatomic, assign) CGFloat zoomLevel;
220 
224 @property (nonatomic, readonly) CGFloat minZoomLevel;
225 
229 @property (nonatomic, readonly) CGFloat maxZoomLevel;
230 
237 - (void)setMinZoomLevel:(CGFloat)minZoomLevel maxZoomLevel:(CGFloat)maxZoomLevel;
238 
245 - (void)setZoomLevel:(CGFloat)zoomLevel animated:(BOOL)animated;
246 
250 @property (nonatomic, assign) CGFloat rotation;
251 
258 - (void)setRotation:(CGFloat)rotation animated:(BOOL)animated;
259 
263 @property (nonatomic, assign) CGFloat overlooking;
264 
271 - (void)setOverlooking:(CGFloat)overlooking animated:(BOOL)animated;
272 
276 @property (nonatomic) QMapRect visibleMapRect;
277 
284 - (void)setVisibleMapRect:(QMapRect)mapRect animated:(BOOL)animated;
285 
293 - (void)setVisibleMapRect:(QMapRect)mapRect edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated;
294 
298 @property (nonatomic) QCoordinateRegion region;
299 
306 - (void)setRegion:(QCoordinateRegion)region animated:(BOOL)animated;
307 
315 - (void)setRegion:(QCoordinateRegion)region edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated;
316 
322 - (QMapRect)mapRectThatFits:(QMapRect)mapRect edgePadding:(UIEdgeInsets)insets;
323 
332 - (QMapRect)mapRectThatFits: (QMapRect)mapRect
333  containsCalloutView:(BOOL)bContainsCalloutView
334  annotations:(NSArray<id<QAnnotation> >*)annotations
335  edgePadding:(UIEdgeInsets)insets;
336 
343 - (CGFloat)zoomLevelThatFits:(QMapRect)mapRect edgePadding:(UIEdgeInsets)insets outCenterCoordinate:(CLLocationCoordinate2D *)outCoordinate;
344 
351 -(void)setLimitMapRect:(QMapRect)mapRect mode:(QMapLimitRectFitMode)mode;
352 
357 - (float *)glViewMatrix;
358 
363 - (float *)glProjectionMatrix;
364 
370 - (CGPoint)glVertexForCoordinate:(CLLocationCoordinate2D)coordinate;
371 
376 - (CGFloat)glPointRatio;
377 
378 #pragma mark - Gesture Control
379 
383 @property(nonatomic, getter=isZoomEnabled) BOOL zoomEnabled;
384 
388 @property (nonatomic, assign, getter = isKeepCenterDuringZoom) BOOL keepCenterDuringZoom;
389 
393 @property(nonatomic, getter=isScrollEnabled) BOOL scrollEnabled;
394 
398 @property (nonatomic, assign, getter=isOverlookingEnabled) BOOL overlookingEnabled;
399 
403 @property (nonatomic, assign, getter=isRotateEnabled) BOOL rotateEnabled;
404 
405 #pragma mark - Coordinate Convert
406 
413 - (CGPoint)convertCoordinate:(CLLocationCoordinate2D)coordinate toPointToView:(UIView *)view;
414 
421 - (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view;
422 
429 - (CGRect)convertRegion:(QCoordinateRegion)region toRectToView:(UIView *)view;
430 
437 - (QCoordinateRegion)convertRect:(CGRect)rect toRegionFromView:(UIView *)view;
438 
439 @end
440 
445 
451 - (void)configureUserLocationPresentation:(QUserLocationPresentation *)presentation;
452 
456 @property (nonatomic, assign) BOOL showsUserLocation;
457 
461 @property (nonatomic, readonly) QUserLocation *userLocation;
462 
466 @property (nonatomic) CLLocationAccuracy desiredAccuracy;
467 
471 @property (nonatomic) CLLocationDistance distanceFilter;
472 
473 
477 @property (nonatomic) CLLocationDegrees headingFilter;
478 
482 @property(assign, nonatomic) BOOL allowsBackgroundLocationUpdates;
483 
487 @property(assign, nonatomic) BOOL pausesLocationUpdatesAutomatically;
488 
492 @property (nonatomic) QUserTrackingMode userTrackingMode;
493 
500 - (void)setUserTrackingMode:(QUserTrackingMode)mode animated:(BOOL)animated;
501 
505 @property (nonatomic, readonly, getter=isUserLocationVisible) BOOL userLocationVisible;
506 
510 - (void)setUserLocationHidden:(BOOL)hidden;
511 
512 
513 @end
514 
519 
523 @property(nonatomic, readonly) NSArray *annotations;
524 
528 @property (nonatomic, readonly) NSArray<id<QAnnotation>> *selectedAnnotations;
529 
535 - (void)addAnnotation:(id <QAnnotation>)annotation;
536 
541 - (void)addAnnotations:(NSArray *)annotations;
542 
547 - (void)removeAnnotation:(id <QAnnotation>)annotation;
548 
553 - (void)removeAnnotations:(NSArray *)annotations;
554 
560 - (QAnnotationView *)viewForAnnotation:(id <QAnnotation>)annotation;
561 
567 - (QAnnotationView *)dequeueReusableAnnotationViewWithIdentifier:(NSString *)identifier;
568 
575 - (void)bringAnnotationToFront:(id <QAnnotation>)annotation DEPRECATED_ATTRIBUTE;
576 
582 - (void)selectAnnotation:(id <QAnnotation>)annotation animated:(BOOL)animated;
583 
589 - (void)deselectAnnotation:(id <QAnnotation>)annotation animated:(BOOL)animated;
590 
591 @end
592 
593 
594 #pragma mark - Overlay
595 
600 
604 @property (nonatomic, readonly) NSArray *overlays;
605 
610 - (void)addOverlay:(id <QOverlay>)overlay;
611 
616 - (void)addOverlays:(NSArray<id <QOverlay>> *)overlays;
617 
622 - (void)removeOverlay:(id <QOverlay>)overlay;
623 
628 - (void)removeOverlays:(NSArray<id <QOverlay>> *)overlays;
629 
635 - (QOverlayView *)viewForOverlay:(id <QOverlay>)overlay;
636 
637 @end
638 
639 
640 #pragma mark - CustomLayer
641 
646 
651 - (void)addCustomLayer:(QCustomLayer *)layer;
652 
657 - (void)removeCustomLayer:(QCustomLayer *)layer;
658 
659 @end
660 
661 #pragma mark - Snapshot
662 
666 
672 - (UIImage *)takeSnapshot __attribute__ ((deprecated("use - (void)takeSnapshotInRect:(CGRect)rect completion:(void (^)(UIImage *resultImage))completion instead")));
673 
680 - (void)takeSnapshotInRect:(CGRect)rect completion:(void (^)(UIImage *resultImage))completion;
681 
689 - (void)takeSnapshotInRect:(CGRect)rect timeout:(CFTimeInterval)timeout completion:(void (^)(UIImage *resultImage))completion;
690 
691 @end
692 
693 #pragma mark - QPoiInfo
694 
698 @interface QPoiInfo : NSObject
699 
703 @property (nonatomic, copy) NSString *uid;
704 
708 @property (nonatomic, copy) NSString *name;
709 
713 @property (nonatomic, assign) CLLocationCoordinate2D coordinate;
714 
715 @end
716 
721 
725 @property (nonatomic, copy) NSString *levelName;
726 
730 @property (nonatomic, copy) NSString *buildingGUID;
731 
735 @property (nonatomic, copy) NSString *buildingName;
736 
737 @end
738 
744 
748 @property (nonatomic, copy) NSString *source;
749 
753 @property (nonatomic, copy) NSString *eventName;
754 
758 @property (nonatomic, copy) NSString *road;
759 
763 @property (nonatomic, copy) NSString *detail;
764 
768 @property (nonatomic, assign) NSTimeInterval startTime;
769 
773 @property (nonatomic, assign) NSTimeInterval endTime;
774 
778 @property (nonatomic, assign) NSTimeInterval updateTime;
779 
780 @end
781 
786 
790 - (NSString *)getDebugError;
791 
792 @end
793 
794 #pragma mark - QMapViewDelegate
795 
799 @protocol QMapViewDelegate <NSObject>
800 
801 @optional
802 
808 - (void)mapViewInitComplete:(QMapView *)mapView;
809 
816 - (void)mapViewDidFailLoadingMap:(QMapView *)mapView withError:(NSError *)error;
817 
824 - (void)mapView:(QMapView *)mapView regionWillChangeAnimated:(BOOL)animated gesture:(BOOL)bGesture;
825 
830 - (void)mapViewRegionChange:(QMapView *)mapView;
831 
838 - (void)mapView:(QMapView *)mapView regionDidChangeAnimated:(BOOL)animated gesture:(BOOL)bGesture;
839 
844 - (void)mapViewDrawFrame:(QMapView *)mapView;
845 
851 - (void)mapView:(QMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D)coordinate;
852 
858 - (void)mapView:(QMapView *)mapView didTapPoi:(QPoiInfo *)poi;
859 
865 - (void)mapView:(QMapView *)mapView didTapOverlay:(id<QOverlay>)overlay;
866 
873 - (QAnnotationView *)mapView:(QMapView *)mapView viewForAnnotation:(id <QAnnotation>)annotation;
874 
881 - (UIView *)mapView:(QMapView *)mapView customCalloutForAnnotationView:(QAnnotationView *)annotationView;
882 
888 - (void)mapView:(QMapView *)mapView didAddAnnotationViews:(NSArray<QAnnotationView *> *)views;
889 
895 - (void)mapView:(QMapView *)mapView didSelectAnnotationView:(QAnnotationView *)view;
896 
902 - (void)mapView:(QMapView *)mapView didDeselectAnnotationView:(QAnnotationView *)view;
903 
912 - (void)mapView:(QMapView *)mapView annotationView:(QAnnotationView *)view didChangeDragState:(QAnnotationViewDragState)newState
913  fromOldState:(QAnnotationViewDragState)oldState;
914 
922 - (void)mapView:(QMapView *)mapView annotationView:(QAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control;
923 
929 - (void)mapView:(QMapView *)mapView annotationViewCalloutTapped:(QAnnotationView *)view;
930 
937 - (QOverlayView *)mapView:(QMapView *)mapView viewForOverlay:(id <QOverlay>)overlay;
938 
944 - (void)mapView:(QMapView *)mapView didAddOverlayViews:(NSArray *)overlayViews;
945 
950 - (void)mapViewWillStartLocatingUser:(QMapView *)mapView;
951 
956 - (void)mapViewDidStopLocatingUser:(QMapView *)mapView;
957 
964 - (void)mapView:(QMapView *)mapView didUpdateUserLocation:(QUserLocation *)userLocation fromHeading:(BOOL)fromHeading;
970 - (void)mapView:(QMapView *)mapView didFailToLocateUserWithError:(NSError *)error;
971 
978 - (void)mapView:(QMapView *)mapView didChangeUserTrackingMode:(QUserTrackingMode)mode animated:(BOOL)animated;
979 
980 @end
BOOL userLocationVisible
当前位置在地图中是否可见
Definition: QMapView.h:505
BOOL showsUserLocation
开启定位并展示位置图标.
Definition: QMapView.h:456
CGFloat minZoomLevel
最小缩放级别, 默认 minZoomLevel = 3
Definition: QMapView.h:224
点击底图上文字图标的数据信息
Definition: QMapView.h:698
地图view的定位相关的API
Definition: QMapView.h:444
BOOL overlookingEnabled
是否支持俯视. 默认为YES.
Definition: QMapView.h:398
NSString * getDebugError()
地图view的错误信息, 用于定位问题
NSArray< id< QAnnotation > > * selectedAnnotations
当前选中的annotations
Definition: QMapView.h:528
该类是地图覆盖物View的基类, 提供了绘制overlay的接口, 但是没有实际实现。希望不要直接实例化
Definition: QOverlayView.h:16
CGFloat overlooking
Overlooking, 范围 [0, 45], 单位(角度)
Definition: QMapView.h:263
BOOL pausesLocationUpdatesAutomatically
Definition: QMapView.h:487
BOOL allowsBackgroundLocationUpdates
以上是否允许后台定位。ios9以上可用. 请参考CLLocationManager.allowsBackgroundLocationUpdates
Definition: QMapView.h:482
BOOL handDrawMapEnabled
是否开启手绘图,默认为 NO
Definition: QMapView.h:55
用户定位图标自定义样式类
Definition: QUserLocationPresentation.h:15
CGFloat zoomLevel
缩放级别, 范围 [minZoomLevel, maxZoomLevel]
Definition: QMapView.h:219
地图view的错误信息, 用于定位问题
Definition: QMapView.h:785
BOOL showsBuildings
是否显示建筑物,默认为YES
Definition: QMapView.h:108
截图相关API
Definition: QMapView.h:665
该类为标注点的protocol,提供了标注类的基本信息函数
Definition: QAnnotation.h:16
BOOL showsScale
是否显示比例尺,默认为YES
Definition: QMapView.h:103
float * glViewMatrix()
获取当前地图view矩阵
个性化图层相关的API
Definition: QMapView.h:645
BOOL showsCompass
是否显示指南针,默认为NO
Definition: QMapView.h:123
CLLocationDegrees headingFilter
设定最小更新角度。默认为1度,设定为kCLHeadingFilterNone会提示任何角度改变
Definition: QMapView.h:477
NSArray * annotations
当前地图View的已经添加的标注数组
Definition: QMapView.h:523
点击室内图上文字图标的数据信息
Definition: QMapView.h:720
BOOL scrollEnabled
Definition: QMapView.h:393
id< QMapViewDelegate > delegate
地图回调
Definition: QMapView.h:76
QMapRect visibleMapRect
当前地图可见范围的mapRect
Definition: QMapView.h:276
NSArray * overlays
当前mapView中已经添加的Overlay数组
Definition: QMapView.h:604
QUserTrackingMode userTrackingMode
定位用户位置的模式
Definition: QMapView.h:492
annotation数据的内容展示View
Definition: QAnnotationView.h:30
CGFloat maxZoomLevel
最大缩放级别, 默认 maxZoomLevel = 20
Definition: QMapView.h:229
平面投影矩形结构定义
Definition: QGeometry.h:84
CGFloat glPointRatio()
返回每屏幕Point单位对应的OpenGL坐标系下的长度
定义了地图的某一部份的数据结构
Definition: QGeometry.h:30
QBasicMapViewLayer * animationLayer
地图动画Layer. 使用该layer 可以更灵活的组合 {centerCoordinate, zoomLevel, rotation, overlooking} 动画, 并且可以自定义其duratio...
Definition: QMapView.h:199
BOOL keepCenterDuringZoom
pinch时保持中心点, 默认为YES
Definition: QMapView.h:388
地图view的点覆盖物相关的API
Definition: QMapView.h:518
QMapViewDelegate:MapView的Delegate,mapView通过此类来通知用户对应的事件
Definition: QMapView.h:799
用于自定义图层的类
Definition: QCustomLayer.h:16
CGFloat rotation
旋转角度, 正角度向右转, 单位(角度)
Definition: QMapView.h:250
BOOL zoomEnabled
Definition: QMapView.h:383
定位信息类
Definition: QUserLocation.h:15
地图view的线面覆盖物相关的API
Definition: QMapView.h:599
QOverlay:地图覆盖物的基类,所有地图的覆盖物需要继承自此类
Definition: QOverlay.h:15
点击点事件图标的数据信息 可通过 discription 获取快捷点事件简介
Definition: QMapView.h:743
BOOL showsPoi
是否显示底图上的标注及名称,默认为YES
Definition: QMapView.h:118
CLLocationAccuracy desiredAccuracy
设定定位精度。默认为kCLLocationAccuracyBest
Definition: QMapView.h:466
float * glProjectionMatrix()
获取当前地图projection矩阵
BOOL rotateEnabled
是否支持旋转. 默认为YES.
Definition: QMapView.h:403
BOOL shows3DBuildings
是否显示建筑物样式为3D效果,默认为YES
Definition: QMapView.h:113
CLLocationCoordinate2D centerCoordinate
中心点经纬度
Definition: QMapView.h:206
QUserLocation * userLocation
当前位置信息
Definition: QMapView.h:461
QCoordinateRegion region
当前地图的经纬度范围,设定的该范围可能会被调整为适合地图窗口显示的范围
Definition: QMapView.h:298
地图view的核心类
Definition: QMapView.h:46
执行地图动画对应的layer.
Definition: QBasicMapViewLayer.h:36
BOOL showsTraffic
是否开启路况图,默认为 NO
Definition: QMapView.h:60
CLLocationDistance distanceFilter
设定定位的最小更新距离。默认为kCLDistanceFilterNone,会提示任何移动
Definition: QMapView.h:471