BaiduMap_IOSSDK_v4.4.2_Docs
BMKMapView.h
1 /*
2  * BMKMapView.h
3  * BMapKit
4  *
5  * Copyright 2011 Baidu Inc. All rights reserved.
6  *
7  */
8 #import <BaiduMapAPI_Base/BMKBaseComponent.h>
9 #import "BMKAnnotation.h"
10 #import "BMKAnnotationView.h"
11 #import "BMKOverlayView.h"
12 #import "UIKit/UIKit.h"
13 #import "BMKMapStatus.h"
14 #import "BMKLocationViewDisplayParam.h"
15 #import "BMKHeatMap.h"
16 #import "BMKBaseIndoorMapInfo.h"
17 
18 @protocol BMKMapViewDelegate;
19 
21 @interface BMKMapPoi : NSObject
23 @property (nonatomic,strong) NSString* text;
25 @property (nonatomic,assign) CLLocationCoordinate2D pt;
27 @property (nonatomic,strong) NSString* uid;
28 @end
29 
30 typedef enum {
31  BMKUserTrackingModeNone = 0,
32  BMKUserTrackingModeHeading,
33  BMKUserTrackingModeFollow,
34  BMKUserTrackingModeFollowWithHeading,
35 } BMKUserTrackingMode;
36 
38 typedef enum {
39  BMKLogoPositionLeftBottom = 0,
40  BMKLogoPositionLeftTop,
41  BMKLogoPositionCenterBottom,
42  BMKLogoPositionCenterTop,
43  BMKLogoPositionRightBottom,
44  BMKLogoPositionRightTop,
45 } BMKLogoPosition;
46 
48 typedef enum {
49  BMKSwitchIndoorFloorSuccess = 0,
50  BMKSwitchIndoorFloorFailed,
51  BMKSwitchIndoorFloorNotFocused,
52  BMKSwitchIndoorFloorNotExist,
53 } BMKSwitchIndoorFloorError;
54 
56 typedef enum {
57  BMKRegionChangeReasonGesture = 0,
58  BMKRegionChangeReasonEvent,
59  BMKRegionChangeReasonAPIs,
60 } BMKRegionChangeReason;
61 
63 @interface BMKMapView : UIView
64 
66 @property (nonatomic, weak) id<BMKMapViewDelegate> delegate;
67 
69 @property (nonatomic) BMKMapType mapType;
70 
72 @property (nonatomic) BMKCoordinateRegion region;
73 
75 @property (nonatomic) BMKCoordinateRegion limitMapRegion;
76 
78 @property (nonatomic) CGPoint compassPosition;
80 @property (nonatomic, readonly) CGSize compassSize;
81 
83 @property (nonatomic) CLLocationCoordinate2D centerCoordinate;
84 
86 @property (nonatomic) float zoomLevel;
88 @property (nonatomic) float minZoomLevel;
90 @property (nonatomic) float maxZoomLevel;
91 
93 @property (nonatomic) int rotation;
94 
96 @property (nonatomic) int overlooking;
98 @property (nonatomic) int minOverlooking;
99 
101 @property(nonatomic, getter=isBuildingsEnabled) BOOL buildingsEnabled;
103 @property(nonatomic, assign) BOOL showMapPoi;
105 @property(nonatomic, getter=isTrafficEnabled) BOOL trafficEnabled;
107 @property(nonatomic, getter=isBaiduHeatMapEnabled) BOOL baiduHeatMapEnabled;
108 
110 @property(nonatomic) BOOL gesturesEnabled;
112 @property(nonatomic, getter=isZoomEnabled) BOOL zoomEnabled;
114 @property(nonatomic, getter=isZoomEnabledWithTap) BOOL zoomEnabledWithTap;
116 @property(nonatomic, getter=isScrollEnabled) BOOL scrollEnabled;
118 @property(nonatomic, getter=isOverlookEnabled) BOOL overlookEnabled;
120 @property(nonatomic, getter=isRotateEnabled) BOOL rotateEnabled;
121 
123 @property(nonatomic) BOOL forceTouchEnabled;
124 
126 @property (nonatomic) BOOL showMapScaleBar;
127 
129 @property (nonatomic) CGPoint mapScaleBarPosition;
130 
132 @property (nonatomic, readonly) CGSize mapScaleBarSize;
133 
135 @property (nonatomic) BMKLogoPosition logoPosition;
136 
138 @property (nonatomic) BMKMapRect visibleMapRect;
139 
145 @property (nonatomic) UIEdgeInsets mapPadding;
147 @property (nonatomic) BOOL updateTargetScreenPtWhenMapPaddingChanged;
148 
155 @property(nonatomic, getter=isChangeWithTouchPointCenterEnabled) BOOL ChangeWithTouchPointCenterEnabled;
156 
163 @property(nonatomic, getter=isChangeCenterWithDoubleTouchPointEnabled) BOOL ChangeCenterWithDoubleTouchPointEnabled;
164 
170 + (void)customMapStyle:(NSString*) customMapStyleJsonFilePath;
175 + (void)enableCustomMapStyle:(BOOL) enable;
176 
186 - (BOOL)setCustomTrafficColorForSmooth:(UIColor *)smooth slow:(UIColor *)slow congestion:(UIColor *)congestion severeCongestion:(UIColor *)severeCongestion;
187 
193 +(void)willBackGround __deprecated_msg("废弃方法(空实现),逻辑由地图SDK控制");
199 +(void)didForeGround __deprecated_msg("废弃方法(空实现),逻辑由地图SDK控制");
203 -(void)viewWillAppear;
204 
208 -(void)viewWillDisappear;
209 
213 - (void)mapForceRefresh;
214 
219 - (BOOL)zoomIn;
220 
225 - (BOOL)zoomOut;
226 
230 - (BMKCoordinateRegion)regionThatFits:(BMKCoordinateRegion)region __deprecated_msg("此方法已废弃");
231 
237 - (void)setRegion:(BMKCoordinateRegion)region animated:(BOOL)animated;
238 
244 - (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated;
245 
250 -(UIImage*) takeSnapshot;
251 
256 -(UIImage*) takeSnapshot:(CGRect)rect;
257 
262 - (void)setCompassImage:(UIImage *)image;
263 
269 - (void)setVisibleMapRect:(BMKMapRect)mapRect animated:(BOOL)animate;
270 
274 - (BMKMapRect)mapRectThatFits:(BMKMapRect)mapRect __deprecated_msg("此方法已废弃");
275 
282 - (void)setVisibleMapRect:(BMKMapRect)mapRect edgePadding:(UIEdgeInsets)insets animated:(BOOL)animate;
283 
290 - (void)fitVisibleMapRect:(BMKMapRect)mapRect edgePadding:(UIEdgeInsets)insets withAnimated:(BOOL)animate;
291 
298 - (BMKMapRect)mapRectThatFits:(BMKMapRect)mapRect edgePadding:(UIEdgeInsets)insets;
299 
306 - (CGPoint)convertCoordinate:(CLLocationCoordinate2D)coordinate toPointToView:(UIView *)view;
307 
314 - (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view;
315 
322 - (CGRect)convertRegion:(BMKCoordinateRegion)region toRectToView:(UIView *)view;
323 
330 - (BMKCoordinateRegion)convertRect:(CGRect)rect toRegionFromView:(UIView *)view;
331 
338 - (CGRect)convertMapRect:(BMKMapRect)mapRect toRectToView:(UIView *)view;
339 
346 - (BMKMapRect)convertRect:(CGRect)rect toMapRectFromView:(UIView *)view;
347 
353 - (CGPoint)glPointForMapPoint:(BMKMapPoint)mapPoint;
354 
361 - (CGPoint *)glPointsForMapPoints:(BMKMapPoint *)mapPoints count:(NSUInteger)count;
362 
367 - (void)setMapCenterToScreenPt:(CGPoint)ptInScreen;
368 
376 - (BMKMapStatus *)getMapStatusFromCoordinateRegion:(BMKCoordinateRegion)region edgePadding:(UIEdgeInsets)insets;
377 
382 - (BMKMapStatus*)getMapStatus;
383 
388 - (void)setMapStatus:(BMKMapStatus*)mapStatus;
389 
395 - (void)setMapStatus:(BMKMapStatus*)mapStatus withAnimation:(BOOL)bAnimation;
396 
403 - (void)setMapStatus:(BMKMapStatus*)mapStatus withAnimation:(BOOL)bAnimation withAnimationTime:(int)ulDuration;
404 
409 - (BOOL)isSurpportBaiduHeatMap;
410 
411 @end
412 
414 
416 @property (nonatomic, assign) BOOL baseIndoorMapEnabled;
417 
419 @property (nonatomic, assign) BOOL showIndoorMapPoi;
420 
427 - (BMKSwitchIndoorFloorError)switchBaseIndoorMapFloor:(NSString*)strFloor withID:(NSString*)strID;
428 
433 - (BMKBaseIndoorMapInfo*)getFocusedBaseIndoorMapInfo;
434 
435 @end
436 
438 
440 @property (nonatomic) BOOL showsUserLocation;
441 
443 @property (nonatomic) BMKUserTrackingMode userTrackingMode;
444 
446 @property (nonatomic, readonly, getter=isUserLocationVisible) BOOL userLocationVisible;
447 
452 - (void)updateLocationViewWithParam:(BMKLocationViewDisplayParam*)locationViewDisplayParam;
453 
458 -(void)updateLocationData:(BMKUserLocation *)userLocation;
459 @end
460 
462 
464 @property (nonatomic, readonly) NSArray *annotations;
465 
466 //设定是否总让选中的annotaion置于最前面
467 @property (nonatomic, assign) BOOL isSelectedAnnotationViewFront;
468 
473 - (void)addAnnotation:(id <BMKAnnotation>)annotation;
474 
479 - (void)addAnnotations:(NSArray *)annotations;
480 
485 - (void)removeAnnotation:(id <BMKAnnotation>)annotation;
486 
491 - (void)removeAnnotations:(NSArray *)annotations;
492 
498 - (BMKAnnotationView *)viewForAnnotation:(id <BMKAnnotation>)annotation;
499 
505 - (BMKAnnotationView *)dequeueReusableAnnotationViewWithIdentifier:(NSString *)identifier;
506 
512 - (void)selectAnnotation:(id <BMKAnnotation>)annotation animated:(BOOL)animated;
513 
519 - (void)deselectAnnotation:(id <BMKAnnotation>)annotation animated:(BOOL)animated;
520 
526 - (void)showAnnotations:(NSArray *)annotations animated:(BOOL)animated;
527 
533 - (NSArray *)annotationsInCoordinateBounds:(BMKCoordinateBounds) bounds;
534 
535 @end
538 
543 - (void)addOverlay:(id <BMKOverlay>)overlay;
544 
549 - (void)addOverlays:(NSArray *)overlays;
550 
555 - (void)removeOverlay:(id <BMKOverlay>)overlay;
556 
561 - (void)removeOverlays:(NSArray *)overlays;
562 
568 - (void)insertOverlay:(id <BMKOverlay>)overlay atIndex:(NSUInteger)index;
569 
575 - (void)exchangeOverlayAtIndex:(NSUInteger)index1 withOverlayAtIndex:(NSUInteger)index2;
576 
582 - (void)insertOverlay:(id <BMKOverlay>)overlay aboveOverlay:(id <BMKOverlay>)sibling;
583 
589 - (void)insertOverlay:(id <BMKOverlay>)overlay belowOverlay:(id <BMKOverlay>)sibling;
590 
592 @property (nonatomic, readonly) NSArray *overlays;
593 
599 - (BMKOverlayView *)viewForOverlay:(id <BMKOverlay>)overlay;
600 
601 @end
603 
608 - (void)addHeatMap:(BMKHeatMap*)heatMap;
609 
613 - (void)removeHeatMap;
614 
615 @end
616 
618 @protocol BMKMapViewDelegate <NSObject>
619 @optional
620 
625 - (void)mapViewDidFinishLoading:(BMKMapView *)mapView;
626 
631 - (void)mapViewDidFinishRendering:(BMKMapView *)mapView;
632 
638 - (void)mapView:(BMKMapView *)mapView onDrawMapFrame:(BMKMapStatus*)status;
639 
645 - (void)mapView:(BMKMapView *)mapView regionWillChangeAnimated:(BOOL)animated;
646 
653 - (void)mapView:(BMKMapView *)mapView regionWillChangeAnimated:(BOOL)animated reason:(BMKRegionChangeReason)reason;
654 
660 - (void)mapView:(BMKMapView *)mapView regionDidChangeAnimated:(BOOL)animated;
661 
668 - (void)mapView:(BMKMapView *)mapView regionDidChangeAnimated:(BOOL)animated reason:(BMKRegionChangeReason)reason;
669 
676 - (BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id <BMKAnnotation>)annotation;
677 
683 - (void)mapView:(BMKMapView *)mapView didAddAnnotationViews:(NSArray *)views;
684 
691 - (void)mapView:(BMKMapView *)mapView clickAnnotationView:(BMKAnnotationView *)view;
692 
700 - (void)mapView:(BMKMapView *)mapView didSelectAnnotationView:(BMKAnnotationView *)view;
701 
707 - (void)mapView:(BMKMapView *)mapView didDeselectAnnotationView:(BMKAnnotationView *)view;
708 
716 - (void)mapView:(BMKMapView *)mapView annotationView:(BMKAnnotationView *)view didChangeDragState:(BMKAnnotationViewDragState)newState
717  fromOldState:(BMKAnnotationViewDragState)oldState;
718 
724 - (void)mapView:(BMKMapView *)mapView annotationViewForBubble:(BMKAnnotationView *)view;
725 
732 - (BMKOverlayView *)mapView:(BMKMapView *)mapView viewForOverlay:(id <BMKOverlay>)overlay;
733 
739 - (void)mapView:(BMKMapView *)mapView didAddOverlayViews:(NSArray *)overlayViews;
740 
746 - (void)mapView:(BMKMapView *)mapView onClickedBMKOverlayView:(BMKOverlayView *)overlayView;
747 
753 - (void)mapView:(BMKMapView *)mapView onClickedMapPoi:(BMKMapPoi*)mapPoi;
754 
760 - (void)mapView:(BMKMapView *)mapView onClickedMapBlank:(CLLocationCoordinate2D)coordinate;
761 
767 - (void)mapview:(BMKMapView *)mapView onDoubleClick:(CLLocationCoordinate2D)coordinate;
768 
774 - (void)mapview:(BMKMapView *)mapView onLongClick:(CLLocationCoordinate2D)coordinate;
775 
783 - (void)mapview:(BMKMapView *)mapView onForceTouch:(CLLocationCoordinate2D)coordinate force:(CGFloat)force maximumPossibleForce:(CGFloat)maximumPossibleForce;
784 
789 - (void)mapStatusDidChanged:(BMKMapView *)mapView;
790 
797 - (void)mapview:(BMKMapView *)mapView baseIndoorMapWithIn:(BOOL)flag baseIndoorMapInfo:(BMKBaseIndoorMapInfo *)info;
798 
799 @end
该类为标注点的protocol,提供了标注类的基本信息函数
Definition: BMKAnnotation.h:13
此类表示地图状态信息
Definition: BMKMapStatus.h:15
该类是地图覆盖物View的基类,提供绘制overlay的接口但本身并无实现,所有地图覆盖物View需要继承自此类
Definition: BMKOverlayView.h:12
该类是地图覆盖物的基类,所有地图的覆盖物需要继承自此类
Definition: BMKOverlay.h:13
矩形,用直角地理坐标表示
Definition: BMKTypes.h:200
此类表示定位图层自定义样式参数
Definition: BMKLocationViewDisplayParam.h:24
NSString * uid
点标注的uid,可能为空
Definition: BMKMapView.h:27
表示一个经纬度区域
Definition: BMKTypes.h:134
Definition: BMKMapView.h:413
热力图的绘制数据和显示样式类
Definition: BMKHeatMap.h:28
点击地图标注返回数据结构
Definition: BMKMapView.h:21
此类表示室内图基础信息
Definition: BMKBaseIndoorMapInfo.h:17
Definition: BMKAnnotationView.h:43
地图View类,使用此View可以显示地图窗口,并且对地图进行相关的操作
Definition: BMKMapView.h:63
MapView的Delegate,mapView通过此类来通知用户对应的事件
Definition: BMKMapView.h:618
Definition: BMKMapView.h:437
地图View类(和Overlay操作相关的接口)
Definition: BMKMapView.h:537
CLLocationCoordinate2D pt
点标注的经纬度坐标
Definition: BMKMapView.h:25
Definition: BMKMapView.h:602
Definition: BMKUserLocation.h:13
Definition: BMKMapView.h:461
NSString * text
点标注的名称
Definition: BMKMapView.h:23
表示一个经纬度区域
Definition: BMKTypes.h:141
地理坐标点,用直角地理坐标表示
Definition: BMKTypes.h:166