BaiduMap_IOSSDK_v6.6.1_Docs
BMKMapView.h
1 /*
2  * BMKMapView.h
3  * BMapKit
4  *
5  * Copyright 2011 Baidu Inc. All rights reserved.
6  *
7  */
8 
9 #import "BMKAnnotation.h"
10 #import "BMKAnnotationView.h"
11 #import "BMKOverlayView.h"
12 #import "BMKMapStatus.h"
13 #import "BMKLocationViewDisplayParam.h"
14 #import "BMKHeatMap.h"
15 #import "BMKHexagonHeatMap.h"
16 #import "BMKBaseIndoorMapInfo.h"
17 #import "BMKCustomMapStyleOption.h"
18 #import "BMKMapGestureDelegate.h"
19 #import "BMKParticleEffectOption.h"
20 
21 NS_ASSUME_NONNULL_BEGIN
22 @class BMMapControl;
23 @class CompassOverlay;
24 @class BMKUserLocation;
25 @protocol BMKMapViewDelegate;
26 
28 @interface BMKMapPoi : NSObject
29 
31 @property (nonatomic, copy, nullable) NSString *text;
32 
34 @property (nonatomic, assign) CLLocationCoordinate2D pt;
35 
37 @property (nonatomic, copy, nullable) NSString *uid;
38 
39 @end
40 
41 typedef enum {
42  BMKUserTrackingModeNone = 0,
43  BMKUserTrackingModeHeading,
44  BMKUserTrackingModeFollow,
45  BMKUserTrackingModeFollowWithHeading,
46 } BMKUserTrackingMode;
47 
49 typedef enum {
50  BMKLogoPositionLeftBottom = 0,
51  BMKLogoPositionLeftTop,
52  BMKLogoPositionCenterBottom,
53  BMKLogoPositionCenterTop,
54  BMKLogoPositionRightBottom,
55  BMKLogoPositionRightTop,
56 } BMKLogoPosition;
57 
59 typedef enum {
60  BMKSwitchIndoorFloorSuccess = 0,
61  BMKSwitchIndoorFloorFailed,
62  BMKSwitchIndoorFloorNotFocused,
63  BMKSwitchIndoorFloorNotExist,
64 } BMKSwitchIndoorFloorError;
65 
67 typedef enum {
68  BMKRegionChangeReasonGesture = 0,
69  BMKRegionChangeReasonEvent,
70  BMKRegionChangeReasonAPIs,
71 } BMKRegionChangeReason;
72 
73 typedef enum {
74  kBMKMapLanguageTypeChinese = 0,
75  kBMKMapLanguageTypeEnglish
76 } BMKMapLanguageType;
77 
79 typedef enum : NSInteger {
80  BMKMapParticleEffectUnknow = -1, // 未知,关闭粒子效果时传入该值将关闭所有粒子效果
81  BMKMapParticleEffectSnow = 0, // 雪
82  BMKMapParticleEffectRainStorm = 4, // 雨
83  BMKMapParticleEffectSmog = 5, // 雾霾
84  BMKMapParticleEffectSandStorm = 7, // 沙尘暴
85  BMKMapParticleEffectFireworks = 8, // 烟花
86  BMKMapParticleEffectFlower = 9 // 花瓣
87 } BMKMapParticleEffect;
88 
89 
91 typedef enum {
92  kBMKPoiTagTypeAll,
93  kBMKPoiTagTypeEpidemic,
94  kBMKPoiTagTypeTravel,
95  kBMKPoiTagTypeShop
96 }BMKPoiTagType;
97 
98 typedef enum {
99  kBMKLayerSDKOverlay,
100  kBMKLayerSDKHeatMap,
101  kBMKLayerSDKHexagonHeatMap,
102  kBMKLayerNewSDKDefaultOverlay
103 } BMKLayerType;
104 
105 
107 @interface BMKMapView : UIView
108 
110 @property (nonatomic, weak, nullable) id<BMKMapViewDelegate> delegate;
111 
113 @property (nonatomic, weak, nullable) id<BMKMapGestureDelegate> gestureDelegate;
114 
116 @property (nonatomic, assign) BMKMapType mapType;
117 
122 @property (nonatomic, assign) BMKMapLanguageType languageType;
123 
126 @property (nonatomic, strong) UIColor *backgroundColor;
127 
131 @property (nonatomic, strong) UIImage *backgroundImage;
132 
134 @property (nonatomic, assign) BMKCoordinateRegion region;
135 
137 @property (nonatomic, assign) BMKCoordinateRegion limitMapRegion;
138 
140 @property (nonatomic, assign) CGPoint compassPosition;
141 
143 @property (nonatomic, readonly) CGSize compassSize;
144 
146 @property (nonatomic, assign) CLLocationCoordinate2D centerCoordinate;
147 
151 @property (nonatomic, assign) NSInteger fontSizeLevel;
152 
154 @property (nonatomic, assign) float zoomLevel;
155 
157 @property (nonatomic, assign) float minZoomLevel;
158 
160 @property (nonatomic, assign) float maxZoomLevel;
161 
163 @property (nonatomic, assign) int rotation;
164 
166 @property (nonatomic, assign) int overlooking;
167 
169 @property (nonatomic, assign) int minOverlooking;
170 
172 @property(nonatomic, getter = isBuildingsEnabled) BOOL buildingsEnabled;
173 
175 @property(nonatomic, assign) BOOL showMapPoi;
176 
178 @property(nonatomic, getter = isTrafficEnabled) BOOL trafficEnabled;
179 
181 @property(nonatomic, getter = isBaiduHeatMapEnabled) BOOL baiduHeatMapEnabled;
182 
184 @property(nonatomic) BOOL gesturesEnabled;
185 
187 @property(nonatomic, getter = isZoomEnabled) BOOL zoomEnabled;
188 
190 @property(nonatomic, getter = isZoomEnabledWithTap) BOOL zoomEnabledWithTap;
191 
193 @property(nonatomic, getter = isScrollEnabled) BOOL scrollEnabled;
194 
196 @property(nonatomic, getter = isOverlookEnabled) BOOL overlookEnabled;
197 
199 @property(nonatomic, getter = isRotateEnabled) BOOL rotateEnabled;
200 
202 @property(nonatomic, assign) BOOL forceTouchEnabled;
203 
205 @property(nonatomic, assign) BOOL gestureZoomAnimationEnabled;
206 
208 @property (nonatomic, assign) BOOL showMapScaleBar;
209 
211 @property (nonatomic, assign) CGPoint mapScaleBarPosition;
212 
214 @property (nonatomic, readonly) CGSize mapScaleBarSize;
215 
217 @property (nonatomic, assign) BMKLogoPosition logoPosition;
218 
220 @property (nonatomic, assign) BMKMapRect visibleMapRect;
221 
225 @property (nonatomic, assign) UIEdgeInsets mapPadding;
226 
228 @property (nonatomic, assign) BOOL updateTargetScreenPtWhenMapPaddingChanged;
229 
234 @property(nonatomic, getter = isChangeWithTouchPointCenterEnabled) BOOL ChangeWithTouchPointCenterEnabled;
235 
240 @property(nonatomic, getter = isChangeCenterWithDoubleTouchPointEnabled) BOOL ChangeCenterWithDoubleTouchPointEnabled;
241 
245 + (void)customMapStyle:(NSString *)customMapStyleJsonFilePath __deprecated_msg("Please use - (void)setCustomMapStyleEnable:(BOOL)enable");
246 
249 + (void)enableCustomMapStyle:(BOOL)enable __deprecated_msg("Please use - (void)setCustomMapStylePath:(NSString *)customMapStyleFilePath");
250 
253 + (void)willBackGround __deprecated_msg("废弃方法(空实现),逻辑由地图SDK控制");
254 
257 + (void)didForeGround __deprecated_msg("废弃方法(空实现),逻辑由地图SDK控制");
258 
261 + (BOOL)setBaiduMapSDKMetalEnable:(BOOL)metalEnable;
262 
265 + (BOOL)setBaiduMapSDKOverlayNewVersionEnable:(BOOL)newVersionEnable;
266 
274 - (BOOL)setCustomTrafficColorForSmooth:(UIColor *)smooth
275  slow:(UIColor *)slow
276  congestion:(UIColor *)congestion
277  severeCongestion:(UIColor *)severeCongestion;
278 
280 - (void)viewWillAppear;
281 
283 - (void)viewWillDisappear;
284 
286 - (void)cleanCacheWithMapType:(BMKMapType)type;
287 
289 - (void)mapForceRefresh;
290 
293 - (BOOL)zoomIn;
294 
297 - (BOOL)zoomOut;
298 
300 - (BMKCoordinateRegion)regionThatFits:(BMKCoordinateRegion)region __deprecated_msg("此方法已废弃");
301 
305 - (void)setRegion:(BMKCoordinateRegion)region animated:(BOOL)animated;
306 
310 - (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated;
311 
316 - (nullable UIImage *)takeSnapshot;
317 
322 - (nullable UIImage *)takeSnapshot:(CGRect)rect;
323 
326 - (void)setCompassImage:(UIImage *)image;
327 
331 - (void)setVisibleMapRect:(BMKMapRect)mapRect animated:(BOOL)animate;
332 
334 - (BMKMapRect)mapRectThatFits:(BMKMapRect)mapRect __deprecated_msg("此方法已废弃");
335 
340 - (void)setVisibleMapRect:(BMKMapRect)mapRect edgePadding:(UIEdgeInsets)insets animated:(BOOL)animate;
341 
346 - (void)fitVisibleMapRect:(BMKMapRect)mapRect edgePadding:(UIEdgeInsets)insets withAnimated:(BOOL)animate;
347 
352 - (BMKMapRect)mapRectThatFits:(BMKMapRect)mapRect edgePadding:(UIEdgeInsets)insets;
353 
358 - (CGPoint)convertCoordinate:(CLLocationCoordinate2D)coordinate toPointToView:(UIView *)view;
359 
364 - (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view;
365 
370 - (CGRect)convertRegion:(BMKCoordinateRegion)region toRectToView:(UIView *)view;
371 
376 - (BMKCoordinateRegion)convertRect:(CGRect)rect toRegionFromView:(UIView *)view;
377 
382 - (CGRect)convertMapRect:(BMKMapRect)mapRect toRectToView:(UIView *)view;
383 
388 - (BMKMapRect)convertRect:(CGRect)rect toMapRectFromView:(UIView *)view;
389 
393 - (CGPoint)screenPointFromMapPoint3:(BMKMapPoint3)mapPoint3;
394 
398 - (CGPoint)glPointForMapPoint:(BMKMapPoint)mapPoint;
399 
404 - (CGPoint *)glPointsForMapPoints:(BMKMapPoint *)mapPoints count:(NSUInteger)count;
405 
406 
409 - (void)setMapCenterToScreenPt:(CGPoint)ptInScreen;
410 
415 - (BMKMapStatus *)getMapStatusFromCoordinateRegion:(BMKCoordinateRegion)region edgePadding:(UIEdgeInsets)insets;
416 
419 - (BMKMapStatus *)getMapStatus;
420 
423 - (void)setMapStatus:(BMKMapStatus *)mapStatus;
424 
428 - (void)setMapStatus:(BMKMapStatus *)mapStatus withAnimation:(BOOL)bAnimation;
429 
434 - (void)setMapStatus:(BMKMapStatus *)mapStatus withAnimation:(BOOL)bAnimation withAnimationTime:(int)ulDuration;
435 
438 - (BOOL)isSurpportBaiduHeatMap;
439 
443 - (float *)getProjectionMatrix;
444 
448 - (float *)getViewMatrix;
449 
450 @end
451 
453 
457 - (void)setCustomMapStylePath:(NSString *)customMapStyleFilePath;
458 
463 - (void)setCustomMapStylePath:(NSString *)customMapStyleFilePath mode:(int)mode;
464 
468 - (void)setCustomMapStyleEnable:(BOOL)enable;
469 
482 - (void)setCustomMapStyleWithOption:(BMKCustomMapStyleOption *)option
483  preLoad:(void (^ _Nullable)(NSString * _Nullable path))preLoad
484  success:(void (^ _Nullable)(NSString * path))success
485  failure:(void (^ _Nullable)(NSError * error, NSString * _Nullable path))failure;
486 
487 
488 @end
489 
491 
493 @property (nonatomic, assign) BOOL baseIndoorMapEnabled;
494 
496 @property (nonatomic, assign) BOOL showIndoorMapPoi;
497 
502 - (BMKSwitchIndoorFloorError)switchBaseIndoorMapFloor:(NSString *)strFloor withID:(NSString *)strID;
503 
506 - (nullable BMKBaseIndoorMapInfo *)getFocusedBaseIndoorMapInfo;
507 
508 @end
509 
511 
513 @property (nonatomic, assign) BOOL showsUserLocation;
514 
516 @property (nonatomic, assign) BMKUserTrackingMode userTrackingMode;
517 
519 @property (nonatomic, readonly, getter = isUserLocationVisible) BOOL userLocationVisible;
520 
523 - (void)updateLocationViewWithParam:(BMKLocationViewDisplayParam *)locationViewDisplayParam;
524 
527 - (void)updateLocationData:(BMKUserLocation *)userLocation;
528 @end
529 
531 
533 @property (nonatomic, copy, readonly, nullable) NSArray<id <BMKAnnotation>> *annotations;
534 
536 @property (nonatomic, assign) BOOL isSelectedAnnotationViewFront;
537 
540 - (void)addAnnotation:(id <BMKAnnotation>)annotation;
541 
544 - (void)addAnnotations:(NSArray<id <BMKAnnotation>> *)annotations;
545 
548 - (void)removeAnnotation:(id <BMKAnnotation>)annotation;
549 
552 - (void)removeAnnotations:(NSArray<id <BMKAnnotation> > *)annotations;
553 
557 - (nullable BMKAnnotationView *)viewForAnnotation:(id <BMKAnnotation>)annotation;
558 
562 - (nullable BMKAnnotationView *)dequeueReusableAnnotationViewWithIdentifier:(NSString *)identifier;
563 
567 - (void)selectAnnotation:(id <BMKAnnotation>)annotation animated:(BOOL)animated;
568 
572 - (void)deselectAnnotation:(id <BMKAnnotation>)annotation animated:(BOOL)animated;
573 
577 - (void)showAnnotations:(NSArray<id <BMKAnnotation>> *)annotations animated:(BOOL)animated;
578 
585 - (void)showAnnotations:(NSArray<id <BMKAnnotation>> *)annotations padding:(UIEdgeInsets)padding animated:(BOOL)animated;
586 
589 - (nullable NSArray<id <BMKAnnotation>> *)annotationsInCoordinateBounds:(BMKCoordinateBounds)bounds;
590 
591 @end
592 
595 
598 - (void)addOverlay:(id <BMKOverlay>)overlay;
599 
602 - (void)addOverlays:(NSArray<id <BMKOverlay>> *)overlays;
603 
606 - (void)removeOverlay:(id <BMKOverlay>)overlay;
607 
610 - (void)removeOverlays:(NSArray<id <BMKOverlay>> *)overlays;
611 
615 - (void)insertOverlay:(id <BMKOverlay>)overlay atIndex:(NSUInteger)index;
616 
620 - (void)exchangeOverlayAtIndex:(NSUInteger)index1 withOverlayAtIndex:(NSUInteger)index2;
621 
625 - (void)insertOverlay:(id <BMKOverlay>)overlay aboveOverlay:(id <BMKOverlay>)sibling;
626 
630 - (void)insertOverlay:(id <BMKOverlay>)overlay belowOverlay:(id <BMKOverlay>)sibling;
631 
633 @property (nonatomic, copy, readonly, nullable) NSArray<id <BMKOverlay>> *overlays;
634 
638 - (nullable BMKOverlayView *)viewForOverlay:(id <BMKOverlay>)overlay;
639 
640 @end
641 
643 
646 - (void)addHeatMap:(BMKHeatMap *)heatMap;
647 
651 - (void)updateHeatMap:(BMKHeatMap *)heatMap;
652 
654 - (void)removeHeatMap;
655 
657 - (void)startHeatMapFrameAnimation;
658 
660 - (void)stopHeatMapFrameAnimation;
661 
663 - (void)setHeatMapFrameAnimationIndex:(NSInteger)index;
664 
665 @end
666 
669 @property (nonatomic, assign) BOOL showHexagonHeatMap;
671 - (void)addHexagonHeatMap:(BMKHexagonHeatMap *)hexagonHeatMap;
673 - (void)removeHexagonHeatMap;
674 @end
675 
677 
679 @property (nonatomic, assign) BOOL showOperateLayer;
684 - (BOOL)switchLayerOrder:(BMKLayerType)layer otherLayer:(BMKLayerType)otherLayer;
685 
687 @property (nonatomic, assign) BOOL showDEMLayer;
688 
692 - (BOOL)switchOverlayLayerAndNavigationLayer:(BOOL)isSwitch;
693 
699 - (BOOL)switchOverlayLayerAndPOILayer:(BOOL)isSwitch;
700 
703 - (BOOL)getPoiTagEnable:(BMKPoiTagType)poiTagType;
704 
708 - (void)setPoiTagEnable:(BOOL)enable poiTagType:(BMKPoiTagType)poiTagType;
709 @end
710 
718 - (BOOL)showParticleEffect:(BMKMapParticleEffect)effect;
719 
725 - (void)closeParticleEffect:(BMKMapParticleEffect)effect;
726 
733 - (BOOL)customParticleEffect:(BMKMapParticleEffect)effect option:(BMKParticleEffectOption *)option;
734 @end
735 
737 @protocol BMKMapViewDelegate <NSObject>
738 @optional
739 
742 - (void)mapViewDidFinishLoading:(BMKMapView *)mapView;
743 
747 - (void)mapViewDidRenderValidData:(BMKMapView *)mapView withError:(NSError *)error;
748 
751 - (void)mapViewDidFinishRendering:(BMKMapView *)mapView;
752 
756 - (void)mapView:(BMKMapView *)mapView onDrawMapFrame:(BMKMapStatus *)status;
757 
761 - (void)mapView:(BMKMapView *)mapView regionWillChangeAnimated:(BOOL)animated;
762 
767 - (void)mapView:(BMKMapView *)mapView regionWillChangeAnimated:(BOOL)animated reason:(BMKRegionChangeReason)reason;
768 
772 - (void)mapView:(BMKMapView *)mapView regionDidChangeAnimated:(BOOL)animated;
773 
778 - (void)mapView:(BMKMapView *)mapView regionDidChangeAnimated:(BOOL)animated reason:(BMKRegionChangeReason)reason;
779 
784 - (nullable __kindof BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id <BMKAnnotation>)annotation;
785 
789 - (void)mapView:(BMKMapView *)mapView didAddAnnotationViews:(NSArray *)views;
790 
795 - (void)mapView:(BMKMapView *)mapView clickAnnotationView:(BMKAnnotationView *)view;
796 
802 - (void)mapView:(BMKMapView *)mapView didSelectAnnotationView:(BMKAnnotationView *)view;
803 
807 - (void)mapView:(BMKMapView *)mapView didDeselectAnnotationView:(BMKAnnotationView *)view;
808 
814 - (void)mapView:(BMKMapView *)mapView annotationView:(BMKAnnotationView *)view didChangeDragState:(BMKAnnotationViewDragState)newState
815  fromOldState:(BMKAnnotationViewDragState)oldState;
816 
820 - (void)mapView:(BMKMapView *)mapView annotationViewForBubble:(BMKAnnotationView *)view;
821 
826 - (nullable __kindof BMKOverlayView *)mapView:(BMKMapView *)mapView viewForOverlay:(id <BMKOverlay>)overlay;
827 
831 - (void)mapView:(BMKMapView *)mapView didAddOverlayViews:(NSArray *)overlayViews;
832 
837 - (void)mapView:(BMKMapView *)mapView onClickedBMKOverlayView:(BMKOverlayView *)overlayView;
838 
842 - (void)mapView:(BMKMapView *)mapView onClickedMapPoi:(BMKMapPoi *)mapPoi;
843 
847 - (void)mapView:(BMKMapView *)mapView onClickedMapBlank:(CLLocationCoordinate2D)coordinate;
848 
852 - (void)mapview:(BMKMapView *)mapView onDoubleClick:(CLLocationCoordinate2D)coordinate;
853 
857 - (void)mapview:(BMKMapView *)mapView onLongClick:(CLLocationCoordinate2D)coordinate;
858 
864 - (void)mapview:(BMKMapView *)mapView onForceTouch:(CLLocationCoordinate2D)coordinate force:(CGFloat)force maximumPossibleForce:(CGFloat)maximumPossibleForce;
865 
868 - (void)mapStatusDidChanged:(BMKMapView *)mapView;
869 
874 - (void)mapview:(BMKMapView *)mapView baseIndoorMapWithIn:(BOOL)flag baseIndoorMapInfo:(nullable BMKBaseIndoorMapInfo *)info;
875 
879 - (void)mapView:(BMKMapView *)mapView didChangeUserTrackingMode:(BMKUserTrackingMode)mode;
880 
881 @end
882 NS_ASSUME_NONNULL_END
BMKMapStatus
此类表示地图状态信息
Definition: BMKMapStatus.h:16
BMKMapPoint3
三维地理坐标点,用空间坐标表示
Definition: BMKTypes.h:203
BMKMapView(LocationViewAPI)
Definition: BMKMapView.h:510
BMKMapView
地图View类,使用此View可以显示地图窗口,并且对地图进行相关的操作
Definition: BMKMapView.h:108
BMKMapView(ParticleEffect)
Definition: BMKMapView.h:711
BMKMapView(CustomMapAPI)
Definition: BMKMapView.h:452
BMKMapPoint
地理坐标点,用直角地理坐标表示
Definition: BMKTypes.h:189
BMKHexagonHeatMap
蜂窝热力图的绘制数据和显示样式类
Definition: BMKHexagonHeatMap.h:32
BMKMapView(MapLayerAPI)
Definition: BMKMapView.h:676
BMKCustomMapStyleOption
Definition: BMKCustomMapStyleOption.h:13
BMKMapView(AnnotationAPI)
Definition: BMKMapView.h:530
BMKMapPoi::pt
CLLocationCoordinate2D pt
点标注的经纬度坐标
Definition: BMKMapView.h:34
BMKOverlay-p
该类是地图覆盖物的基类,所有地图的覆盖物需要继承自此类
Definition: BMKOverlay.h:17
BMKHeatMap
热力图的绘制数据和显示样式类
Definition: BMKHeatMap.h:35
BMKAnnotation-p
该类为标注点的protocol,提供了标注类的基本信息函数
Definition: BMKAnnotation.h:12
BMKBaseIndoorMapInfo
此类表示室内图基础信息
Definition: BMKBaseIndoorMapInfo.h:16
BMKMapView(HexagonHeatMapAPI)
Definition: BMKMapView.h:667
BMKMapPoi
点击地图标注返回数据结构
Definition: BMKMapView.h:29
BMKCoordinateRegion
表示一个经纬度区域
Definition: BMKTypes.h:166
BMKMapPoi::uid
NSString * uid
点标注的uid,可能为空
Definition: BMKMapView.h:37
BMKMapPoi::text
NSString * text
点标注的名称
Definition: BMKMapView.h:31
BMKMapViewDelegate-p
MapView的Delegate,mapView通过此类来通知用户对应的事件
Definition: BMKMapView.h:737
BMKMapView(OverlaysAPI)
地图View类(和Overlay操作相关的接口)
Definition: BMKMapView.h:594
BMKMapView(IndoorMapAPI)
Definition: BMKMapView.h:490
BMKMapView(HeatMapAPI)
Definition: BMKMapView.h:642
BMKMapRect
矩形,用直角地理坐标表示
Definition: BMKTypes.h:233
BMKParticleEffectOption
Definition: BMKParticleEffectOption.h:15
BMKCoordinateBounds
表示一个经纬度区域
Definition: BMKTypes.h:159
BMKLocationViewDisplayParam
此类表示定位图层自定义样式参数
Definition: BMKLocationViewDisplayParam.h:24
BMKAnnotationView
Definition: BMKAnnotationView.h:43
BMKUserLocation
Definition: BMKUserLocation.h:14
BMKOverlayView
该类是地图覆盖物View的基类,提供绘制overlay的接口但本身并无实现,所有地图覆盖物View需要继承自此类
Definition: BMKOverlayView.h:15