BaiduMap_IOSSDK_v6.6.2_Docs 6.6.2
载入中...
搜索中...
未找到
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"
14#import "BMKHeatMap.h"
15#import "BMKHexagonHeatMap.h"
20
21NS_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
47
57
65
72
77
79typedef enum : NSInteger {
80 BMKMapParticleEffectUnknow = -1, // 未知,关闭粒子效果时传入该值将关闭所有粒子效果
86 BMKMapParticleEffectFlower = 9 // 花瓣
88
89
97
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
123@property (nonatomic, assign) BMKMapLanguageType languageType;
124
127@property (nonatomic, strong) UIColor *backgroundColor;
128
132@property (nonatomic, strong) UIImage *backgroundImage;
133
135@property (nonatomic, assign) BMKCoordinateRegion region;
136
138@property (nonatomic, assign) BMKCoordinateRegion limitMapRegion;
139
141@property (nonatomic, assign) CGPoint compassPosition;
142
144@property (nonatomic, readonly) CGSize compassSize;
145
147@property (nonatomic, assign) CLLocationCoordinate2D centerCoordinate;
148
152@property (nonatomic, assign) NSInteger fontSizeLevel;
153
155@property (nonatomic, assign) float zoomLevel;
156
158@property (nonatomic, assign) float minZoomLevel;
159
161@property (nonatomic, assign) float maxZoomLevel;
162
164@property (nonatomic, assign) int rotation;
165
167@property (nonatomic, assign) int overlooking;
168
170@property (nonatomic, assign) int minOverlooking;
171
173@property(nonatomic, getter = isBuildingsEnabled) BOOL buildingsEnabled;
174
176@property(nonatomic, assign) BOOL showMapPoi;
177
179@property(nonatomic, getter = isTrafficEnabled) BOOL trafficEnabled;
180
182@property(nonatomic, getter = isBaiduHeatMapEnabled) BOOL baiduHeatMapEnabled;
183
185@property(nonatomic) BOOL gesturesEnabled;
186
188@property(nonatomic, getter = isZoomEnabled) BOOL zoomEnabled;
189
191@property(nonatomic, getter = isZoomEnabledWithTap) BOOL zoomEnabledWithTap;
192
194@property(nonatomic, getter = isScrollEnabled) BOOL scrollEnabled;
195
197@property(nonatomic, getter = isOverlookEnabled) BOOL overlookEnabled;
198
200@property(nonatomic, getter = isRotateEnabled) BOOL rotateEnabled;
201
203@property(nonatomic, assign) BOOL forceTouchEnabled;
204
206@property(nonatomic, assign) BOOL gestureZoomAnimationEnabled;
207
209@property (nonatomic, assign) BOOL showMapScaleBar;
210
212@property (nonatomic, assign) CGPoint mapScaleBarPosition;
213
215@property (nonatomic, readonly) CGSize mapScaleBarSize;
216
218@property (nonatomic, assign) BMKLogoPosition logoPosition;
219
221@property (nonatomic, assign) BMKMapRect visibleMapRect;
222
226@property (nonatomic, assign) UIEdgeInsets mapPadding;
227
229@property (nonatomic, assign) BOOL updateTargetScreenPtWhenMapPaddingChanged;
230
235@property(nonatomic, getter = isChangeWithTouchPointCenterEnabled) BOOL ChangeWithTouchPointCenterEnabled;
236
241@property(nonatomic, getter = isChangeCenterWithDoubleTouchPointEnabled) BOOL ChangeCenterWithDoubleTouchPointEnabled;
242
244@property(nonatomic, assign) BOOL supportBackgroundDraw;
245
249+ (void)customMapStyle:(NSString *)customMapStyleJsonFilePath __deprecated_msg("Please use - (void)setCustomMapStyleEnable:(BOOL)enable");
250
253+ (void)enableCustomMapStyle:(BOOL)enable __deprecated_msg("Please use - (void)setCustomMapStylePath:(NSString *)customMapStyleFilePath");
254
257+ (void)willBackGround __deprecated_msg("废弃方法(空实现),逻辑由地图SDK控制");
258
261+ (void)didForeGround __deprecated_msg("废弃方法(空实现),逻辑由地图SDK控制");
262
265+ (BOOL)setBaiduMapSDKMetalEnable:(BOOL)metalEnable;
266
269+ (BOOL)setBaiduMapSDKOverlayNewVersionEnable:(BOOL)newVersionEnable;
270
278- (BOOL)setCustomTrafficColorForSmooth:(UIColor *)smooth
279 slow:(UIColor *)slow
280 congestion:(UIColor *)congestion
281 severeCongestion:(UIColor *)severeCongestion;
282
284- (void)viewWillAppear;
285
287- (void)viewWillDisappear;
288
290- (void)cleanCacheWithMapType:(BMKMapType)type;
291
293- (void)mapForceRefresh;
294
297- (BOOL)zoomIn;
298
301- (BOOL)zoomOut;
302
304- (BMKCoordinateRegion)regionThatFits:(BMKCoordinateRegion)region __deprecated_msg("此方法已废弃");
305
309- (void)setRegion:(BMKCoordinateRegion)region animated:(BOOL)animated;
310
314- (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated;
315
320- (nullable UIImage *)takeSnapshot;
321
326- (nullable UIImage *)takeSnapshot:(CGRect)rect;
327
330- (void)setCompassImage:(UIImage *)image;
331
335- (void)setVisibleMapRect:(BMKMapRect)mapRect animated:(BOOL)animate;
336
338- (BMKMapRect)mapRectThatFits:(BMKMapRect)mapRect __deprecated_msg("此方法已废弃");
339
344- (void)setVisibleMapRect:(BMKMapRect)mapRect edgePadding:(UIEdgeInsets)insets animated:(BOOL)animate;
345
350- (void)fitVisibleMapRect:(BMKMapRect)mapRect edgePadding:(UIEdgeInsets)insets withAnimated:(BOOL)animate;
351
356- (BMKMapRect)mapRectThatFits:(BMKMapRect)mapRect edgePadding:(UIEdgeInsets)insets;
357
362- (CGPoint)convertCoordinate:(CLLocationCoordinate2D)coordinate toPointToView:(UIView *)view;
363
368- (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view;
369
374- (CGRect)convertRegion:(BMKCoordinateRegion)region toRectToView:(UIView *)view;
375
380- (BMKCoordinateRegion)convertRect:(CGRect)rect toRegionFromView:(UIView *)view;
381
386- (CGRect)convertMapRect:(BMKMapRect)mapRect toRectToView:(UIView *)view;
387
392- (BMKMapRect)convertRect:(CGRect)rect toMapRectFromView:(UIView *)view;
393
397- (CGPoint)screenPointFromMapPoint3:(BMKMapPoint3)mapPoint3;
398
402- (CGPoint)glPointForMapPoint:(BMKMapPoint)mapPoint;
403
408- (CGPoint *)glPointsForMapPoints:(BMKMapPoint *)mapPoints count:(NSUInteger)count;
409
410
413- (void)setMapCenterToScreenPt:(CGPoint)ptInScreen;
414
419- (BMKMapStatus *)getMapStatusFromCoordinateRegion:(BMKCoordinateRegion)region edgePadding:(UIEdgeInsets)insets;
420
423- (BMKMapStatus *)getMapStatus;
424
427- (void)setMapStatus:(BMKMapStatus *)mapStatus;
428
432- (void)setMapStatus:(BMKMapStatus *)mapStatus withAnimation:(BOOL)bAnimation;
433
438- (void)setMapStatus:(BMKMapStatus *)mapStatus withAnimation:(BOOL)bAnimation withAnimationTime:(int)ulDuration;
439
442- (BOOL)isSurpportBaiduHeatMap;
443
447- (float *)getProjectionMatrix;
448
452- (float *)getViewMatrix;
453
454@end
455
456@interface BMKMapView (CustomMapAPI)
457
461- (BOOL)setCustomMapStylePath:(NSString *)customMapStyleFilePath;
462
467- (BOOL)setCustomMapStylePath:(NSString *)customMapStyleFilePath mode:(int)mode;
468
472- (BOOL)setCustomMapStyleEnable:(BOOL)enable;
473
486- (BOOL)setCustomMapStyleWithOption:(BMKCustomMapStyleOption *)option
487 preLoad:(void (^ _Nullable)(NSString * _Nullable path))preLoad
488 success:(void (^ _Nullable)(NSString * path))success
489 failure:(void (^ _Nullable)(NSError * error, NSString * _Nullable path))failure;
490
491
492@end
493
494@interface BMKMapView (IndoorMapAPI)
495
497@property (nonatomic, assign) BOOL baseIndoorMapEnabled;
498
500@property (nonatomic, assign) BOOL showIndoorMapPoi;
501
506- (BMKSwitchIndoorFloorError)switchBaseIndoorMapFloor:(NSString *)strFloor withID:(NSString *)strID;
507
510- (nullable BMKBaseIndoorMapInfo *)getFocusedBaseIndoorMapInfo;
511
512@end
513
514@interface BMKMapView (LocationViewAPI)
515
517@property (nonatomic, assign) BOOL showsUserLocation;
518
520@property (nonatomic, assign) BMKUserTrackingMode userTrackingMode;
521
523@property (nonatomic, readonly, getter = isUserLocationVisible) BOOL userLocationVisible;
524
527- (void)updateLocationViewWithParam:(BMKLocationViewDisplayParam *)locationViewDisplayParam;
528
531- (void)updateLocationData:(BMKUserLocation *)userLocation;
532@end
533
534@interface BMKMapView (AnnotationAPI)
535
537@property (nonatomic, copy, readonly, nullable) NSArray<id <BMKAnnotation>> *annotations;
538
540@property (nonatomic, assign) BOOL isSelectedAnnotationViewFront;
541
544- (void)addAnnotation:(id <BMKAnnotation>)annotation;
545
548- (void)addAnnotations:(NSArray<id <BMKAnnotation>> *)annotations;
549
552- (void)removeAnnotation:(id <BMKAnnotation>)annotation;
553
556- (void)removeAnnotations:(NSArray<id <BMKAnnotation> > *)annotations;
557
561- (nullable BMKAnnotationView *)viewForAnnotation:(id <BMKAnnotation>)annotation;
562
566- (nullable BMKAnnotationView *)dequeueReusableAnnotationViewWithIdentifier:(NSString *)identifier;
567
571- (void)selectAnnotation:(id <BMKAnnotation>)annotation animated:(BOOL)animated;
572
576- (void)deselectAnnotation:(id <BMKAnnotation>)annotation animated:(BOOL)animated;
577
581- (void)showAnnotations:(NSArray<id <BMKAnnotation>> *)annotations animated:(BOOL)animated;
582
589- (void)showAnnotations:(NSArray<id <BMKAnnotation>> *)annotations padding:(UIEdgeInsets)padding animated:(BOOL)animated;
590
593- (nullable NSArray<id <BMKAnnotation>> *)annotationsInCoordinateBounds:(BMKCoordinateBounds)bounds;
594
595@end
596
598@interface BMKMapView (OverlaysAPI)
599
602- (void)addOverlay:(id <BMKOverlay>)overlay;
603
606- (void)addOverlays:(NSArray<id <BMKOverlay>> *)overlays;
607
610- (void)removeOverlay:(id <BMKOverlay>)overlay;
611
614- (void)removeOverlays:(NSArray<id <BMKOverlay>> *)overlays;
615
619- (void)insertOverlay:(id <BMKOverlay>)overlay atIndex:(NSUInteger)index;
620
624- (void)exchangeOverlayAtIndex:(NSUInteger)index1 withOverlayAtIndex:(NSUInteger)index2;
625
629- (void)insertOverlay:(id <BMKOverlay>)overlay aboveOverlay:(id <BMKOverlay>)sibling;
630
634- (void)insertOverlay:(id <BMKOverlay>)overlay belowOverlay:(id <BMKOverlay>)sibling;
635
637@property (nonatomic, copy, readonly, nullable) NSArray<id <BMKOverlay>> *overlays;
638
642- (nullable BMKOverlayView *)viewForOverlay:(id <BMKOverlay>)overlay;
643
644@end
645
646@interface BMKMapView (HeatMapAPI)
647
650- (void)addHeatMap:(BMKHeatMap *)heatMap;
651
655- (void)updateHeatMap:(BMKHeatMap *)heatMap;
656
658- (void)removeHeatMap;
659
661- (void)startHeatMapFrameAnimation;
662
664- (void)stopHeatMapFrameAnimation;
665
667- (void)setHeatMapFrameAnimationIndex:(NSInteger)index;
668
669@end
670
671@interface BMKMapView (HexagonHeatMapAPI)
673@property (nonatomic, assign) BOOL showHexagonHeatMap;
675- (void)addHexagonHeatMap:(BMKHexagonHeatMap *)hexagonHeatMap;
677- (void)removeHexagonHeatMap;
678@end
679
680@interface BMKMapView (MapLayerAPI)
681
683@property (nonatomic, assign) BOOL showOperateLayer;
688- (BOOL)switchLayerOrder:(BMKLayerType)layer otherLayer:(BMKLayerType)otherLayer;
689
691@property (nonatomic, assign) BOOL showDEMLayer;
692
696- (BOOL)switchOverlayLayerAndNavigationLayer:(BOOL)isSwitch;
697
703- (BOOL)switchOverlayLayerAndPOILayer:(BOOL)isSwitch;
704
707- (BOOL)getPoiTagEnable:(BMKPoiTagType)poiTagType;
708
712- (void)setPoiTagEnable:(BOOL)enable poiTagType:(BMKPoiTagType)poiTagType;
713@end
714
715@interface BMKMapView (ParticleEffect)
722- (BOOL)showParticleEffect:(BMKMapParticleEffect)effect;
723
729- (void)closeParticleEffect:(BMKMapParticleEffect)effect;
730
737- (BOOL)customParticleEffect:(BMKMapParticleEffect)effect option:(BMKParticleEffectOption *)option;
738@end
739
741@protocol BMKMapViewDelegate <NSObject>
742@optional
743
746- (void)mapViewDidFinishLoading:(BMKMapView *)mapView;
747
751- (void)mapViewDidRenderValidData:(BMKMapView *)mapView withError:(NSError *)error;
752
755- (void)mapViewDidFinishRendering:(BMKMapView *)mapView;
756
760- (void)mapView:(BMKMapView *)mapView onDrawMapFrame:(BMKMapStatus *)status;
761
765- (void)mapView:(BMKMapView *)mapView regionWillChangeAnimated:(BOOL)animated;
766
771- (void)mapView:(BMKMapView *)mapView regionWillChangeAnimated:(BOOL)animated reason:(BMKRegionChangeReason)reason;
772
776- (void)mapView:(BMKMapView *)mapView regionDidChangeAnimated:(BOOL)animated;
777
782- (void)mapView:(BMKMapView *)mapView regionDidChangeAnimated:(BOOL)animated reason:(BMKRegionChangeReason)reason;
783
788- (nullable __kindof BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id <BMKAnnotation>)annotation;
789
793- (void)mapView:(BMKMapView *)mapView didAddAnnotationViews:(NSArray *)views;
794
799- (void)mapView:(BMKMapView *)mapView clickAnnotationView:(BMKAnnotationView *)view;
800
806- (void)mapView:(BMKMapView *)mapView didSelectAnnotationView:(BMKAnnotationView *)view;
807
811- (void)mapView:(BMKMapView *)mapView didDeselectAnnotationView:(BMKAnnotationView *)view;
812
818- (void)mapView:(BMKMapView *)mapView annotationView:(BMKAnnotationView *)view didChangeDragState:(BMKAnnotationViewDragState)newState
819 fromOldState:(BMKAnnotationViewDragState)oldState;
820
824- (void)mapView:(BMKMapView *)mapView annotationViewForBubble:(BMKAnnotationView *)view;
825
830- (nullable __kindof BMKOverlayView *)mapView:(BMKMapView *)mapView viewForOverlay:(id <BMKOverlay>)overlay;
831
835- (void)mapView:(BMKMapView *)mapView didAddOverlayViews:(NSArray *)overlayViews;
836
840- (void)mapView:(BMKMapView *)mapView onClickedBMKOverlayView:(BMKOverlayView *)overlayView;
841
845- (void)mapView:(BMKMapView *)mapView onClickedMapPoi:(BMKMapPoi *)mapPoi;
846
850- (void)mapView:(BMKMapView *)mapView onClickedMapBlank:(CLLocationCoordinate2D)coordinate;
851
855- (void)mapview:(BMKMapView *)mapView onDoubleClick:(CLLocationCoordinate2D)coordinate;
856
860- (void)mapview:(BMKMapView *)mapView onLongClick:(CLLocationCoordinate2D)coordinate;
861
867- (void)mapview:(BMKMapView *)mapView onForceTouch:(CLLocationCoordinate2D)coordinate force:(CGFloat)force maximumPossibleForce:(CGFloat)maximumPossibleForce;
868
871- (void)mapStatusDidChanged:(BMKMapView *)mapView;
872
877- (void)mapview:(BMKMapView *)mapView baseIndoorMapWithIn:(BOOL)flag baseIndoorMapInfo:(nullable BMKBaseIndoorMapInfo *)info;
878
882- (void)mapView:(BMKMapView *)mapView didChangeUserTrackingMode:(BMKUserTrackingMode)mode;
883
884@end
885NS_ASSUME_NONNULL_END
NSUInteger BMKAnnotationViewDragState
Definition BMKAnnotationView.h:22
BMKSwitchIndoorFloorError
枚举:室内图切换楼层结果
Definition BMKMapView.h:59
@ BMKSwitchIndoorFloorFailed
切换楼层成功
Definition BMKMapView.h:61
@ BMKSwitchIndoorFloorSuccess
Definition BMKMapView.h:60
@ BMKSwitchIndoorFloorNotFocused
切换楼层失败
Definition BMKMapView.h:62
@ BMKSwitchIndoorFloorNotExist
地图还未聚焦到传入的室内图
Definition BMKMapView.h:63
BMKLogoPosition
枚举:logo位置
Definition BMKMapView.h:49
@ BMKLogoPositionCenterTop
地图中下方
Definition BMKMapView.h:53
@ BMKLogoPositionCenterBottom
地图左上方
Definition BMKMapView.h:52
@ BMKLogoPositionRightTop
地图右下方
Definition BMKMapView.h:55
@ BMKLogoPositionLeftBottom
Definition BMKMapView.h:50
@ BMKLogoPositionLeftTop
地图左下方
Definition BMKMapView.h:51
@ BMKLogoPositionRightBottom
地图中上方
Definition BMKMapView.h:54
BMKMapParticleEffect
枚举:粒子效果
Definition BMKMapView.h:79
@ BMKMapParticleEffectSnow
Definition BMKMapView.h:81
@ BMKMapParticleEffectFlower
Definition BMKMapView.h:86
@ BMKMapParticleEffectFireworks
Definition BMKMapView.h:85
@ BMKMapParticleEffectRainStorm
Definition BMKMapView.h:82
@ BMKMapParticleEffectUnknow
Definition BMKMapView.h:80
@ BMKMapParticleEffectSmog
Definition BMKMapView.h:83
@ BMKMapParticleEffectSandStorm
Definition BMKMapView.h:84
BMKUserTrackingMode
Definition BMKMapView.h:41
@ BMKUserTrackingModeNone
Definition BMKMapView.h:42
@ BMKUserTrackingModeFollowWithHeading
定位跟随模式
Definition BMKMapView.h:45
@ BMKUserTrackingModeFollow
定位方向模式
Definition BMKMapView.h:44
@ BMKUserTrackingModeHeading
普通定位模式
Definition BMKMapView.h:43
BMKLayerType
Definition BMKMapView.h:98
@ kBMKLayerSDKHeatMap
SDK覆盖物图层
Definition BMKMapView.h:100
@ kBMKLayerNewSDKDefaultOverlay
SDK蜂窝热力图图层
Definition BMKMapView.h:102
@ kBMKLayerSDKHexagonHeatMap
SDK热力图图层
Definition BMKMapView.h:101
@ kBMKLayerSDKOverlay
Definition BMKMapView.h:99
BMKPoiTagType
用于控制poi标签显示的类别枚举
Definition BMKMapView.h:91
@ kBMKPoiTagTypeShop
店铺标签
Definition BMKMapView.h:95
@ kBMKPoiTagTypeTravel
旅游出行标签
Definition BMKMapView.h:94
@ kBMKPoiTagTypeAll
显示poi标签 / 屏蔽所有poi标签
Definition BMKMapView.h:92
@ kBMKPoiTagTypeEpidemic
疫情标签
Definition BMKMapView.h:93
BMKRegionChangeReason
枚举:地图区域改变原因
Definition BMKMapView.h:67
@ BMKRegionChangeReasonGesture
Definition BMKMapView.h:68
@ BMKRegionChangeReasonAPIs
地图上控件事件,如点击指南针返回2D地图。
Definition BMKMapView.h:70
@ BMKRegionChangeReasonEvent
手势触发导致地图区域变化,如双击、拖拽、滑动地图
Definition BMKMapView.h:69
BMKMapLanguageType
Definition BMKMapView.h:73
@ kBMKMapLanguageTypeChinese
Definition BMKMapView.h:74
@ kBMKMapLanguageTypeEnglish
中文地图
Definition BMKMapView.h:75
Definition BMKAnnotationView.h:43
此类表示室内图基础信息
Definition BMKBaseIndoorMapInfo.h:16
Definition BMKCustomMapStyleOption.h:13
热力图的绘制数据和显示样式类
Definition BMKHeatMap.h:35
蜂窝热力图的绘制数据和显示样式类
Definition BMKHexagonHeatMap.h:32
此类表示定位图层自定义样式参数
Definition BMKLocationViewDisplayParam.h:24
点击地图标注返回数据结构
Definition BMKMapView.h:29
NSString * text
点标注的名称
Definition BMKMapView.h:31
CLLocationCoordinate2D pt
点标注的经纬度坐标
Definition BMKMapView.h:34
NSString * uid
点标注的uid,可能为空
Definition BMKMapView.h:37
此类表示地图状态信息
Definition BMKMapStatus.h:16
地图View类,使用此View可以显示地图窗口,并且对地图进行相关的操作
Definition BMKMapView.h:108
该类是地图覆盖物View的基类,提供绘制overlay的接口但本身并无实现,所有地图覆盖物View需要继承自此类
Definition BMKOverlayView.h:15
Definition BMKParticleEffectOption.h:15
Definition BMKUserLocation.h:14
表示一个经纬度区域
Definition BMKTypes.h:159
表示一个经纬度区域
Definition BMKTypes.h:166
三维地理坐标点,用空间坐标表示
Definition BMKTypes.h:203
地理坐标点,用直角地理坐标表示
Definition BMKTypes.h:189
矩形,用直角地理坐标表示
Definition BMKTypes.h:233