BaiduMap_IOSSDK_v6.5.9_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 "BMKBaseIndoorMapInfo.h"
16#import "BMKCustomMapStyleOption.h"
17#import "BMKMapGestureDelegate.h"
18#import "BMKParticleEffectOption.h"
19
20NS_ASSUME_NONNULL_BEGIN
21@class BMMapControl;
22@class CompassOverlay;
23@class BMKUserLocation;
24@protocol BMKMapViewDelegate;
25
27@interface BMKMapPoi : NSObject
28
30@property (nonatomic, copy, nullable) NSString *text;
31
33@property (nonatomic, assign) CLLocationCoordinate2D pt;
34
36@property (nonatomic, copy, nullable) NSString *uid;
37
38@end
39
40typedef enum {
41 BMKUserTrackingModeNone = 0,
42 BMKUserTrackingModeHeading,
43 BMKUserTrackingModeFollow,
44 BMKUserTrackingModeFollowWithHeading,
45} BMKUserTrackingMode;
46
48typedef enum {
49 BMKLogoPositionLeftBottom = 0,
50 BMKLogoPositionLeftTop,
51 BMKLogoPositionCenterBottom,
52 BMKLogoPositionCenterTop,
53 BMKLogoPositionRightBottom,
54 BMKLogoPositionRightTop,
55} BMKLogoPosition;
56
58typedef enum {
59 BMKSwitchIndoorFloorSuccess = 0,
60 BMKSwitchIndoorFloorFailed,
61 BMKSwitchIndoorFloorNotFocused,
62 BMKSwitchIndoorFloorNotExist,
63} BMKSwitchIndoorFloorError;
64
66typedef enum {
67 BMKRegionChangeReasonGesture = 0,
68 BMKRegionChangeReasonEvent,
69 BMKRegionChangeReasonAPIs,
70} BMKRegionChangeReason;
71
72typedef enum {
73 kBMKMapLanguageTypeChinese = 0,
74 kBMKMapLanguageTypeEnglish
75} BMKMapLanguageType;
76
78typedef enum : NSInteger {
79 BMKMapParticleEffectUnknow = -1, // 未知,关闭粒子效果时传入该值将关闭所有粒子效果
80 BMKMapParticleEffectSnow = 0, // 雪
81 BMKMapParticleEffectRainStorm = 4, // 雨
82 BMKMapParticleEffectSmog = 5, // 雾霾
83 BMKMapParticleEffectSandStorm = 7, // 沙尘暴
84 BMKMapParticleEffectFireworks = 8, // 烟花
85 BMKMapParticleEffectFlower = 9 // 花瓣
86} BMKMapParticleEffect;
87
88
90typedef enum {
91 kBMKPoiTagTypeAll,
92 kBMKPoiTagTypeEpidemic,
93 kBMKPoiTagTypeTravel,
94 kBMKPoiTagTypeShop
95}BMKPoiTagType;
96
97typedef enum {
98 kBMKLayerSDKOverlay,
99 kBMKLayerSDKHeatMap,
100 kBMKLayerNewSDKDefaultOverlay
101} BMKLayerType;
102
103
105@interface BMKMapView : UIView
106
108@property (nonatomic, weak, nullable) id<BMKMapViewDelegate> delegate;
109
111@property (nonatomic, weak, nullable) id<BMKMapGestureDelegate> gestureDelegate;
112
114@property (nonatomic, assign) BMKMapType mapType;
115
120@property (nonatomic, assign) BMKMapLanguageType languageType;
121
124@property (nonatomic, strong) UIColor *backgroundColor;
125
129@property (nonatomic, strong) UIImage *backgroundImage;
130
132@property (nonatomic, assign) BMKCoordinateRegion region;
133
135@property (nonatomic, assign) BMKCoordinateRegion limitMapRegion;
136
138@property (nonatomic, assign) CGPoint compassPosition;
139
141@property (nonatomic, readonly) CGSize compassSize;
142
144@property (nonatomic, assign) CLLocationCoordinate2D centerCoordinate;
145
149@property (nonatomic, assign) NSInteger fontSizeLevel;
150
152@property (nonatomic, assign) float zoomLevel;
153
155@property (nonatomic, assign) float minZoomLevel;
156
158@property (nonatomic, assign) float maxZoomLevel;
159
161@property (nonatomic, assign) int rotation;
162
164@property (nonatomic, assign) int overlooking;
165
167@property (nonatomic, assign) int minOverlooking;
168
170@property(nonatomic, getter = isBuildingsEnabled) BOOL buildingsEnabled;
171
173@property(nonatomic, assign) BOOL showMapPoi;
174
176@property(nonatomic, getter = isTrafficEnabled) BOOL trafficEnabled;
177
179@property(nonatomic, getter = isBaiduHeatMapEnabled) BOOL baiduHeatMapEnabled;
180
182@property(nonatomic) BOOL gesturesEnabled;
183
185@property(nonatomic, getter = isZoomEnabled) BOOL zoomEnabled;
186
188@property(nonatomic, getter = isZoomEnabledWithTap) BOOL zoomEnabledWithTap;
189
191@property(nonatomic, getter = isScrollEnabled) BOOL scrollEnabled;
192
194@property(nonatomic, getter = isOverlookEnabled) BOOL overlookEnabled;
195
197@property(nonatomic, getter = isRotateEnabled) BOOL rotateEnabled;
198
200@property(nonatomic, assign) BOOL forceTouchEnabled;
201
203@property(nonatomic, assign) BOOL gestureZoomAnimationEnabled;
204
206@property (nonatomic, assign) BOOL showMapScaleBar;
207
209@property (nonatomic, assign) CGPoint mapScaleBarPosition;
210
212@property (nonatomic, readonly) CGSize mapScaleBarSize;
213
215@property (nonatomic, assign) BMKLogoPosition logoPosition;
216
218@property (nonatomic, assign) BMKMapRect visibleMapRect;
219
223@property (nonatomic, assign) UIEdgeInsets mapPadding;
224
226@property (nonatomic, assign) BOOL updateTargetScreenPtWhenMapPaddingChanged;
227
232@property(nonatomic, getter = isChangeWithTouchPointCenterEnabled) BOOL ChangeWithTouchPointCenterEnabled;
233
238@property(nonatomic, getter = isChangeCenterWithDoubleTouchPointEnabled) BOOL ChangeCenterWithDoubleTouchPointEnabled;
239
243+ (void)customMapStyle:(NSString *)customMapStyleJsonFilePath __deprecated_msg("Please use - (void)setCustomMapStyleEnable:(BOOL)enable");
244
247+ (void)enableCustomMapStyle:(BOOL)enable __deprecated_msg("Please use - (void)setCustomMapStylePath:(NSString *)customMapStyleFilePath");
248
251+ (void)willBackGround __deprecated_msg("废弃方法(空实现),逻辑由地图SDK控制");
252
255+ (void)didForeGround __deprecated_msg("废弃方法(空实现),逻辑由地图SDK控制");
256
259+ (BOOL)setBaiduMapSDKMetalEnable:(BOOL)metalEnable;
260
263+ (BOOL)setBaiduMapSDKOverlayNewVersionEnable:(BOOL)newVersionEnable;
264
272- (BOOL)setCustomTrafficColorForSmooth:(UIColor *)smooth
273 slow:(UIColor *)slow
274 congestion:(UIColor *)congestion
275 severeCongestion:(UIColor *)severeCongestion;
276
278- (void)viewWillAppear;
279
281- (void)viewWillDisappear;
282
284- (void)cleanCacheWithMapType:(BMKMapType)type;
285
287- (void)mapForceRefresh;
288
291- (BOOL)zoomIn;
292
295- (BOOL)zoomOut;
296
298- (BMKCoordinateRegion)regionThatFits:(BMKCoordinateRegion)region __deprecated_msg("此方法已废弃");
299
303- (void)setRegion:(BMKCoordinateRegion)region animated:(BOOL)animated;
304
308- (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated;
309
314- (nullable UIImage *)takeSnapshot;
315
320- (nullable UIImage *)takeSnapshot:(CGRect)rect;
321
324- (void)setCompassImage:(UIImage *)image;
325
329- (void)setVisibleMapRect:(BMKMapRect)mapRect animated:(BOOL)animate;
330
332- (BMKMapRect)mapRectThatFits:(BMKMapRect)mapRect __deprecated_msg("此方法已废弃");
333
338- (void)setVisibleMapRect:(BMKMapRect)mapRect edgePadding:(UIEdgeInsets)insets animated:(BOOL)animate;
339
344- (void)fitVisibleMapRect:(BMKMapRect)mapRect edgePadding:(UIEdgeInsets)insets withAnimated:(BOOL)animate;
345
350- (BMKMapRect)mapRectThatFits:(BMKMapRect)mapRect edgePadding:(UIEdgeInsets)insets;
351
356- (CGPoint)convertCoordinate:(CLLocationCoordinate2D)coordinate toPointToView:(UIView *)view;
357
362- (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view;
363
368- (CGRect)convertRegion:(BMKCoordinateRegion)region toRectToView:(UIView *)view;
369
374- (BMKCoordinateRegion)convertRect:(CGRect)rect toRegionFromView:(UIView *)view;
375
380- (CGRect)convertMapRect:(BMKMapRect)mapRect toRectToView:(UIView *)view;
381
386- (BMKMapRect)convertRect:(CGRect)rect toMapRectFromView:(UIView *)view;
387
391- (CGPoint)screenPointFromMapPoint3:(BMKMapPoint3)mapPoint3;
392
396- (CGPoint)glPointForMapPoint:(BMKMapPoint)mapPoint;
397
402- (CGPoint *)glPointsForMapPoints:(BMKMapPoint *)mapPoints count:(NSUInteger)count;
403
404
407- (void)setMapCenterToScreenPt:(CGPoint)ptInScreen;
408
413- (BMKMapStatus *)getMapStatusFromCoordinateRegion:(BMKCoordinateRegion)region edgePadding:(UIEdgeInsets)insets;
414
417- (BMKMapStatus *)getMapStatus;
418
421- (void)setMapStatus:(BMKMapStatus *)mapStatus;
422
426- (void)setMapStatus:(BMKMapStatus *)mapStatus withAnimation:(BOOL)bAnimation;
427
432- (void)setMapStatus:(BMKMapStatus *)mapStatus withAnimation:(BOOL)bAnimation withAnimationTime:(int)ulDuration;
433
436- (BOOL)isSurpportBaiduHeatMap;
437
441- (float *)getProjectionMatrix;
442
446- (float *)getViewMatrix;
447
448@end
449
451
455- (void)setCustomMapStylePath:(NSString *)customMapStyleFilePath;
456
461- (void)setCustomMapStylePath:(NSString *)customMapStyleFilePath mode:(int)mode;
462
466- (void)setCustomMapStyleEnable:(BOOL)enable;
467
480- (void)setCustomMapStyleWithOption:(BMKCustomMapStyleOption *)option
481 preLoad:(void (^ _Nullable)(NSString * _Nullable path))preLoad
482 success:(void (^ _Nullable)(NSString * path))success
483 failure:(void (^ _Nullable)(NSError * error, NSString * _Nullable path))failure;
484
485
486@end
487
489
491@property (nonatomic, assign) BOOL baseIndoorMapEnabled;
492
494@property (nonatomic, assign) BOOL showIndoorMapPoi;
495
500- (BMKSwitchIndoorFloorError)switchBaseIndoorMapFloor:(NSString *)strFloor withID:(NSString *)strID;
501
504- (nullable BMKBaseIndoorMapInfo *)getFocusedBaseIndoorMapInfo;
505
506@end
507
509
511@property (nonatomic, assign) BOOL showsUserLocation;
512
514@property (nonatomic, assign) BMKUserTrackingMode userTrackingMode;
515
517@property (nonatomic, readonly, getter = isUserLocationVisible) BOOL userLocationVisible;
518
521- (void)updateLocationViewWithParam:(BMKLocationViewDisplayParam *)locationViewDisplayParam;
522
525- (void)updateLocationData:(BMKUserLocation *)userLocation;
526@end
527
529
531@property (nonatomic, copy, readonly, nullable) NSArray<id <BMKAnnotation>> *annotations;
532
534@property (nonatomic, assign) BOOL isSelectedAnnotationViewFront;
535
538- (void)addAnnotation:(id <BMKAnnotation>)annotation;
539
542- (void)addAnnotations:(NSArray<id <BMKAnnotation>> *)annotations;
543
546- (void)removeAnnotation:(id <BMKAnnotation>)annotation;
547
550- (void)removeAnnotations:(NSArray<id <BMKAnnotation> > *)annotations;
551
555- (nullable BMKAnnotationView *)viewForAnnotation:(id <BMKAnnotation>)annotation;
556
560- (nullable BMKAnnotationView *)dequeueReusableAnnotationViewWithIdentifier:(NSString *)identifier;
561
565- (void)selectAnnotation:(id <BMKAnnotation>)annotation animated:(BOOL)animated;
566
570- (void)deselectAnnotation:(id <BMKAnnotation>)annotation animated:(BOOL)animated;
571
575- (void)showAnnotations:(NSArray<id <BMKAnnotation>> *)annotations animated:(BOOL)animated;
576
583- (void)showAnnotations:(NSArray<id <BMKAnnotation>> *)annotations padding:(UIEdgeInsets)padding animated:(BOOL)animated;
584
587- (nullable NSArray<id <BMKAnnotation>> *)annotationsInCoordinateBounds:(BMKCoordinateBounds)bounds;
588
589@end
590
593
596- (void)addOverlay:(id <BMKOverlay>)overlay;
597
600- (void)addOverlays:(NSArray<id <BMKOverlay>> *)overlays;
601
604- (void)removeOverlay:(id <BMKOverlay>)overlay;
605
608- (void)removeOverlays:(NSArray<id <BMKOverlay>> *)overlays;
609
613- (void)insertOverlay:(id <BMKOverlay>)overlay atIndex:(NSUInteger)index;
614
618- (void)exchangeOverlayAtIndex:(NSUInteger)index1 withOverlayAtIndex:(NSUInteger)index2;
619
623- (void)insertOverlay:(id <BMKOverlay>)overlay aboveOverlay:(id <BMKOverlay>)sibling;
624
628- (void)insertOverlay:(id <BMKOverlay>)overlay belowOverlay:(id <BMKOverlay>)sibling;
629
631@property (nonatomic, copy, readonly, nullable) NSArray<id <BMKOverlay>> *overlays;
632
636- (nullable BMKOverlayView *)viewForOverlay:(id <BMKOverlay>)overlay;
637
638@end
639
641
644- (void)addHeatMap:(BMKHeatMap *)heatMap;
645
649- (void)updateHeatMap:(BMKHeatMap *)heatMap;
650
652- (void)removeHeatMap;
653
655- (void)startHeatMapFrameAnimation;
656
658- (void)stopHeatMapFrameAnimation;
659
661- (void)setHeatMapFrameAnimationIndex:(NSInteger)index;
662
663@end
664
666
668@property (nonatomic, assign) BOOL showOperateLayer;
673- (BOOL)switchLayerOrder:(BMKLayerType)layer otherLayer:(BMKLayerType)otherLayer;
674
676@property (nonatomic, assign) BOOL showDEMLayer;
677
681- (BOOL)switchOverlayLayerAndNavigationLayer:(BOOL)isSwitch;
682
688- (BOOL)switchOverlayLayerAndPOILayer:(BOOL)isSwitch;
689
692- (BOOL)getPoiTagEnable:(BMKPoiTagType)poiTagType;
693
697- (void)setPoiTagEnable:(BOOL)enable poiTagType:(BMKPoiTagType)poiTagType;
698@end
699
707- (BOOL)showParticleEffect:(BMKMapParticleEffect)effect;
708
714- (void)closeParticleEffect:(BMKMapParticleEffect)effect;
715
722- (BOOL)customParticleEffect:(BMKMapParticleEffect)effect option:(BMKParticleEffectOption *)option;
723@end
724
726@protocol BMKMapViewDelegate <NSObject>
727@optional
728
731- (void)mapViewDidFinishLoading:(BMKMapView *)mapView;
732
736- (void)mapViewDidRenderValidData:(BMKMapView *)mapView withError:(NSError *)error;
737
740- (void)mapViewDidFinishRendering:(BMKMapView *)mapView;
741
745- (void)mapView:(BMKMapView *)mapView onDrawMapFrame:(BMKMapStatus *)status;
746
750- (void)mapView:(BMKMapView *)mapView regionWillChangeAnimated:(BOOL)animated;
751
756- (void)mapView:(BMKMapView *)mapView regionWillChangeAnimated:(BOOL)animated reason:(BMKRegionChangeReason)reason;
757
761- (void)mapView:(BMKMapView *)mapView regionDidChangeAnimated:(BOOL)animated;
762
767- (void)mapView:(BMKMapView *)mapView regionDidChangeAnimated:(BOOL)animated reason:(BMKRegionChangeReason)reason;
768
773- (nullable __kindof BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id <BMKAnnotation>)annotation;
774
778- (void)mapView:(BMKMapView *)mapView didAddAnnotationViews:(NSArray *)views;
779
784- (void)mapView:(BMKMapView *)mapView clickAnnotationView:(BMKAnnotationView *)view;
785
791- (void)mapView:(BMKMapView *)mapView didSelectAnnotationView:(BMKAnnotationView *)view;
792
796- (void)mapView:(BMKMapView *)mapView didDeselectAnnotationView:(BMKAnnotationView *)view;
797
803- (void)mapView:(BMKMapView *)mapView annotationView:(BMKAnnotationView *)view didChangeDragState:(BMKAnnotationViewDragState)newState
804 fromOldState:(BMKAnnotationViewDragState)oldState;
805
809- (void)mapView:(BMKMapView *)mapView annotationViewForBubble:(BMKAnnotationView *)view;
810
815- (nullable __kindof BMKOverlayView *)mapView:(BMKMapView *)mapView viewForOverlay:(id <BMKOverlay>)overlay;
816
820- (void)mapView:(BMKMapView *)mapView didAddOverlayViews:(NSArray *)overlayViews;
821
826- (void)mapView:(BMKMapView *)mapView onClickedBMKOverlayView:(BMKOverlayView *)overlayView;
827
831- (void)mapView:(BMKMapView *)mapView onClickedMapPoi:(BMKMapPoi *)mapPoi;
832
836- (void)mapView:(BMKMapView *)mapView onClickedMapBlank:(CLLocationCoordinate2D)coordinate;
837
841- (void)mapview:(BMKMapView *)mapView onDoubleClick:(CLLocationCoordinate2D)coordinate;
842
846- (void)mapview:(BMKMapView *)mapView onLongClick:(CLLocationCoordinate2D)coordinate;
847
853- (void)mapview:(BMKMapView *)mapView onForceTouch:(CLLocationCoordinate2D)coordinate force:(CGFloat)force maximumPossibleForce:(CGFloat)maximumPossibleForce;
854
857- (void)mapStatusDidChanged:(BMKMapView *)mapView;
858
863- (void)mapview:(BMKMapView *)mapView baseIndoorMapWithIn:(BOOL)flag baseIndoorMapInfo:(nullable BMKBaseIndoorMapInfo *)info;
864
868- (void)mapView:(BMKMapView *)mapView didChangeUserTrackingMode:(BMKUserTrackingMode)mode;
869
870@end
871NS_ASSUME_NONNULL_END
Definition: BMKMapView.h:528
Definition: BMKMapView.h:450
Definition: BMKMapView.h:640
Definition: BMKMapView.h:488
Definition: BMKMapView.h:508
Definition: BMKMapView.h:665
地图View类(和Overlay操作相关的接口)
Definition: BMKMapView.h:592
Definition: BMKMapView.h:700
Definition: BMKAnnotationView.h:43
此类表示室内图基础信息
Definition: BMKBaseIndoorMapInfo.h:16
Definition: BMKCustomMapStyleOption.h:13
热力图的绘制数据和显示样式类
Definition: BMKHeatMap.h:35
此类表示定位图层自定义样式参数
Definition: BMKLocationViewDisplayParam.h:24
点击地图标注返回数据结构
Definition: BMKMapView.h:28
NSString * text
点标注的名称
Definition: BMKMapView.h:30
CLLocationCoordinate2D pt
点标注的经纬度坐标
Definition: BMKMapView.h:33
NSString * uid
点标注的uid,可能为空
Definition: BMKMapView.h:36
此类表示地图状态信息
Definition: BMKMapStatus.h:16
地图View类,使用此View可以显示地图窗口,并且对地图进行相关的操作
Definition: BMKMapView.h:106
该类是地图覆盖物View的基类,提供绘制overlay的接口但本身并无实现,所有地图覆盖物View需要继承自此类
Definition: BMKOverlayView.h:15
Definition: BMKParticleEffectOption.h:15
Definition: BMKUserLocation.h:14
该类为标注点的protocol,提供了标注类的基本信息函数
Definition: BMKAnnotation.h:12
MapView的Delegate,mapView通过此类来通知用户对应的事件
Definition: BMKMapView.h:726
该类是地图覆盖物的基类,所有地图的覆盖物需要继承自此类
Definition: BMKOverlay.h:17
表示一个经纬度区域
Definition: BMKTypes.h:157
表示一个经纬度区域
Definition: BMKTypes.h:164
三维地理坐标点,用空间坐标表示
Definition: BMKTypes.h:201
地理坐标点,用直角地理坐标表示
Definition: BMKTypes.h:187
矩形,用直角地理坐标表示
Definition: BMKTypes.h:231