You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1026 lines
37 KiB

//
// MAMapView.h
// MAMapKit
//
// Created by 翁乐 on 3/17/16.
// Copyright © 2016 Amap. All rights reserved.
//
#import "MAConfig.h"
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "MAOverlay.h"
#import "MAOverlayRenderer.h"
#import "MAAnnotationView.h"
#import "MACircle.h"
#import "MAUserLocation.h"
#import "MAMapStatus.h"
#import "MAIndoorInfo.h"
#import "MAUserLocationRepresentation.h"
#import "MAMapCustomStyleOptions.h"
///地图类型
typedef NS_ENUM(NSInteger, MAMapType)
{
MAMapTypeStandard = 0, ///< 普通地图
MAMapTypeSatellite, ///< 卫星地图
MAMapTypeStandardNight, ///< 夜间视图
MAMapTypeNavi, ///< 导航视图
MAMapTypeBus ///< 公交视图
};
///用户跟踪模式
typedef NS_ENUM(NSInteger, MAUserTrackingMode)
{
MAUserTrackingModeNone = 0, ///< 不追踪用户的location更新
MAUserTrackingModeFollow = 1, ///< 追踪用户的location更新
MAUserTrackingModeFollowWithHeading = 2 ///< 追踪用户的location与heading更新
};
///交通拥堵状态
typedef NS_ENUM(NSInteger, MATrafficStatus)
{
MATrafficStatusSmooth = 1, ///< 1 通畅
MATrafficStatusSlow, ///< 2 缓行
MATrafficStatusJam, ///< 3 阻塞
MATrafficStatusSeriousJam, ///< 4 严重阻塞
};
///绘制overlay的层级
typedef NS_ENUM(NSInteger, MAOverlayLevel) {
MAOverlayLevelAboveRoads = 0, ///< 在地图底图标注和兴趣点图标之下绘制overlay
MAOverlayLevelAboveLabels ///< 在地图底图标注和兴趣点图标之上绘制overlay
};
#pragma mark - 动画相关的key
///中心点(MAMapPoint)key, 封装成[NSValue valueWithMAMapPoint:]
extern NSString * const kMAMapLayerCenterMapPointKey;
///缩放级别key, 范围[minZoomLevel, maxZoomLevel], 封装成NSNumber
extern NSString * const kMAMapLayerZoomLevelKey;
///旋转角度key, 范围[0, 360), 封装成NSNumber
extern NSString * const kMAMapLayerRotationDegreeKey;
///摄像机俯视角度, 范围[0, 45], 封装成NSNumber
extern NSString * const kMAMapLayerCameraDegreeKey;
@protocol MAMapViewDelegate;
@interface MAMapView : UIView
///地图view的delegate
@property (nonatomic, weak) id<MAMapViewDelegate> delegate;
///地图类型
@property (nonatomic) MAMapType mapType;
///当前地图的中心点,改变该值时,地图的比例尺级别不会发生变化
@property (nonatomic) CLLocationCoordinate2D centerCoordinate;
///当前地图的经纬度范围,设定的该范围可能会被调整为适合地图窗口显示的范围
@property (nonatomic) MACoordinateRegion region;
///可见区域, 设定的该范围可能会被调整为适合地图窗口显示的范围
@property (nonatomic) MAMapRect visibleMapRect;
///设置可见地图区域的矩形边界,如限制地图只显示北京市范围
@property (nonatomic, assign) MACoordinateRegion limitRegion;
///设置可见地图区域的矩形边界,如限制地图只显示北京市范围
@property (nonatomic, assign) MAMapRect limitMapRect;
///缩放级别(默认3-19,有室内地图时为3-20)
@property (nonatomic) CGFloat zoomLevel;
///最小缩放级别
@property (nonatomic) CGFloat minZoomLevel;
///最大缩放级别(有室内地图时最大为20,否则为19)
@property (nonatomic) CGFloat maxZoomLevel;
///设置地图旋转角度(逆时针为正向)
@property (nonatomic) CGFloat rotationDegree;
///设置地图相机角度(范围为[0.f, 60.f],但高于40度的角度需要在16级以上才能生效)
@property (nonatomic) CGFloat cameraDegree;
///是否以screenAnchor点作为锚点进行缩放,默认为YES。如果为NO,则以手势中心点作为锚点
@property (nonatomic, assign) BOOL zoomingInPivotsAroundAnchorPoint;
///是否支持缩放, 默认YES
@property (nonatomic, getter = isZoomEnabled) BOOL zoomEnabled;
///是否支持平移, 默认YES
@property (nonatomic, getter = isScrollEnabled) BOOL scrollEnabled;
///是否支持旋转, 默认YES
@property (nonatomic, getter = isRotateEnabled) BOOL rotateEnabled;
///是否支持camera旋转, 默认YES
@property (nonatomic, getter = isRotateCameraEnabled) BOOL rotateCameraEnabled;
///是否支持天空模式,默认为YES. 开启后,进入天空模式后,annotation重用可视范围会缩减
@property (nonatomic, getter = isSkyModelEnabled) BOOL skyModelEnable __attribute((deprecated("已废弃 since 6.0.0")));
///是否显示楼块,默认为YES
@property (nonatomic, getter = isShowsBuildings) BOOL showsBuildings;
///是否显示底图标注, 默认为YES
@property (nonatomic, assign, getter = isShowsLabels) BOOL showsLabels;
///是否显示交通路况图层, 默认为NO
@property (nonatomic, getter = isShowTraffic) BOOL showTraffic;
///设置实时交通颜色,key为 MATrafficStatus
@property (nonatomic, copy) NSDictionary <NSNumber *, UIColor *> *trafficStatus;
///设置实时交通线宽系数,默认线宽系数为0.8,范围为[0 - 1] (since 5.3.0)
@property (nonatomic, assign) CGFloat trafficRatio __attribute((deprecated("已废弃 since 6.0.0, 不再支持修改实时交通线宽")));
///是否支持单击地图获取POI信息(默认为YES), 对应的回调是 -(void)mapView:(MAMapView *) didTouchPois:(NSArray *)
@property (nonatomic, assign) BOOL touchPOIEnabled;
///是否显示指南针, 默认YES
@property (nonatomic, assign) BOOL showsCompass;
///指南针原点位置
@property (nonatomic, assign) CGPoint compassOrigin;
///指南针的宽高
@property (nonatomic, readonly) CGSize compassSize;
///是否显示比例尺, 默认YES
@property (nonatomic, assign) BOOL showsScale;
///比例尺原点位置
@property (nonatomic, assign) CGPoint scaleOrigin;
///比例尺的最大宽高
@property (nonatomic, readonly) CGSize scaleSize;
///logo位置, 必须在mapView.bounds之内,否则会被忽略
@property (nonatomic, assign) CGPoint logoCenter;
///logo的宽高
@property (nonatomic, readonly) CGSize logoSize;
///在当前缩放级别下, 基于地图中心点, 1 screen point 对应的距离(单位是米)
@property (nonatomic, readonly) double metersPerPointForCurrentZoom;
///标识当前地图中心位置是否在中国范围外。此属性不是精确判断,不能用于边界区域
@property (nonatomic, readonly) BOOL isAbroad;
///最大帧数,有效的帧数为:60、30、20、10等能被60整除的数。默认为60
@property (nonatomic, assign) NSUInteger maxRenderFrame;
///是否允许降帧,默认为YES
@property (nonatomic, assign) BOOL isAllowDecreaseFrame;
///停止/开启 OpenGLES绘制, 默认NO. 对应回调是 - (void)mapView:(MAMapView *) didChangeOpenGLESDisabled:(BOOL)
@property (nonatomic, assign) BOOL openGLESDisabled;
///地图的视图锚点。坐标系归一化,(0, 0)为MAMapView左上角,(1, 1)为右下角。默认为(0.5, 0.5),即当前地图的视图中心 (since 5.0.0)
@property (nonatomic, assign) CGPoint screenAnchor;
///地图渲染的runloop mode,默认为NSRunLoopCommonModes。如果是和UIScrollView一起使用且不希望地图在scrollView拖动时渲染,请设置此值为NSDefaultRunLoopMode。(since 5.1.0)
@property (nonatomic, copy) NSRunLoopMode runLoopMode;
///是否显示海外地图,默认为@NO. 注意:必须先在官网申请开通海外权限
@property (nonatomic, getter=isShowsWorldMap) NSNumber *showsWorldMap;
///设置语言。中文:@0: 英文:@1. 英文使用注意事项:1、不能和自定义地图样式同时使用;2、英文状态只在MAMapTypeStandard生效
@property (nonatomic, strong) NSNumber *mapLanguage;
/**
* @brief
* @param region
* @param animated
*/
- (void)setRegion:(MACoordinateRegion)region animated:(BOOL)animated;
/**
* @brief frame的大小调整region范围
* @param region
* @return
*/
- (MACoordinateRegion)regionThatFits:(MACoordinateRegion)region;
/**
* @brief
* @param mapRect
* @param animated
*/
- (void)setVisibleMapRect:(MAMapRect)mapRect animated:(BOOL)animated;
/**
* @brief ,使mapview长宽比
* @param mapRect
* @return
*/
- (MAMapRect)mapRectThatFits:(MAMapRect)mapRect;
/**
* @brief 使mapview加insets后的长宽比
* @param mapRect
* @param insets
* @return
*/
- (MAMapRect)mapRectThatFits:(MAMapRect)mapRect edgePadding:(UIEdgeInsets)insets;
/**
* @brief
* @param insets
* @param mapRect
* @param animated
*/
- (void)setVisibleMapRect:(MAMapRect)mapRect edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated;
/**
* @brief
* @param coordinate
* @param animated
*/
- (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated;
/**
* @brief 3-193-20
* @param zoomLevel
* @param animated
*/
- (void)setZoomLevel:(CGFloat)zoomLevel animated:(BOOL)animated;
/**
* @brief
* @param zoomLevel
* @param pivot (view的坐标系)
* @param animated
*/
- (void)setZoomLevel:(CGFloat)zoomLevel atPivot:(CGPoint)pivot animated:(BOOL)animated;
/**
* @brief ()
* @param rotationDegree , 07202-7202
* @param animated
* @param duration
*/
- (void)setRotationDegree:(CGFloat)rotationDegree animated:(BOOL)animated duration:(CFTimeInterval)duration;
/**
* @brief ([0.f, 60.f]4016)
* @param cameraDegree
* @param animated
* @param duration
*/
- (void)setCameraDegree:(CGFloat)cameraDegree animated:(BOOL)animated duration:(CFTimeInterval)duration;
/**
* @brief
* @return
*/
- (MAMapStatus *)getMapStatus;
/**
* @brief
* @param status
* @param animated
*/
- (void)setMapStatus:(MAMapStatus *)status animated:(BOOL)animated;
/**
* @brief
* @param status
* @param animated
* @param duration 0.35s
*/
- (void)setMapStatus:(MAMapStatus *)status
animated:(BOOL)animated
duration:(CFTimeInterval)duration;
/**
* @brief
* @param image
*/
- (void)setCompassImage:(UIImage *)image;
/**
* @brief (annotationView),
* @param rect
* @return image
*/
- (UIImage *)takeSnapshotInRect:(CGRect)rect __attribute((deprecated("已废弃,请使用takeSnapshotInRect:withCompletionBlock:方法 since 6.0.0")));
/**
* @brief (annotationView),
* @param rect
* @param block block(resultImage:,state01
*/
- (void)takeSnapshotInRect:(CGRect)rect withCompletionBlock:(void (^)(UIImage *resultImage, NSInteger state))block;
/**
* @brief , , 1 screen point ().
* @param zoomLevel , [minZoomLevel, maxZoomLevel].
* @return ()
*/
- (double)metersPerPointForZoomLevel:(CGFloat)zoomLevel;
/**
* @brief view坐标系的坐标
* @param coordinate
* @param view view
* @return view坐标系的坐标
*/
- (CGPoint)convertCoordinate:(CLLocationCoordinate2D)coordinate toPointToView:(UIView *)view;
/**
* @brief view坐标系的坐标转换为经纬度
* @param point view坐标系的坐标
* @param view view
* @return
*/
- (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view;
/**
* @brief region转换为指定view坐标系的rect
* @param region region
* @param view view
* @return view坐标系的rect
*/
- (CGRect)convertRegion:(MACoordinateRegion)region toRectToView:(UIView *)view;
/**
* @brief view坐标系的rect转换为经纬度region
* @param rect view坐标系的rect
* @param view view
* @return region
*/
- (MACoordinateRegion)convertRect:(CGRect)rect toRegionFromView:(UIView *)view;
/**
* @brief
*
* 线 Documents/3dvmap/ 使线,
* offlineDataWillReload:(MAMapView *)mapView, offlineDataDidReload:(MAMapView *)mapView.
*/
- (void)reloadMap;
/**
* @brief (线)
*/
- (void)clearDisk;
/**
* @brief since 5.4.0
*/
- (void)reloadInternalTexture;
/**
* @brief (customMapStyleEnabled YES)nilsince 5.4.0
* @return
*/
- (NSString *)mapContentApprovalNumber;
/**
* @brief since 5.4.0
* @return
*/
- (NSString *)satelliteImageApprovalNumber;
/**
* @brief CAKeyframeAnimation动画since 6.0.0
* @param mapCenterAnimation
* @param zoomAnimation
* @param rotateAnimation
* @param cameraDegreeAnimation
*/
- (void)addAnimationWith:(CAKeyframeAnimation *)mapCenterAnimation
zoomAnimation:(CAKeyframeAnimation *)zoomAnimation
rotateAnimation:(CAKeyframeAnimation *)rotateAnimation
cameraDegreeAnimation:(CAKeyframeAnimation *)cameraDegreeAnimation;
/**
* @brief since 6.0.0
*/
- (void)forceRefresh;
@end
@interface MAMapView (Annotation)
///所有添加的标注, 注意从5.3.0开始返回数组内不再包含定位蓝点userLocation
@property (nonatomic, readonly) NSArray *annotations;
///处于选中状态的标注数据数据(其count == 0 或 1)
@property (nonatomic, copy) NSArray *selectedAnnotations;
///annotation 可见区域
@property (nonatomic, readonly) CGRect annotationVisibleRect;
///是否允许对annotationView根据zIndex进行排序,默认为NO 注意:如果设置为YES,慎重重载MAAnnoationView的willMoveToSuperview:,内部排序时会调用removeFromSuperView. 注:从5.3.0版本开启此属性废弃,如果添加的annotationView有zIndex不为0的,则自动开启为YES,否则为NO。删除所有annotation后会重置。zIndex属性只有在viewForAnnotation或者didAddAnnotationViews回调中设置有效。
@property (nonatomic, assign) BOOL allowsAnnotationViewSorting __attribute((deprecated("已废弃 since 5.3.0")));
/**
* @brief MAMapViewDelegate的-mapView:viewForAnnotation:View
* @param annotation
*/
- (void)addAnnotation:(id <MAAnnotation>)annotation;
/**
* @brief MAMapViewDelegate的-mapView:viewForAnnotation:View
* @param annotations
*/
- (void)addAnnotations:(NSArray *)annotations;
/**
* @brief
* @param annotation
*/
- (void)removeAnnotation:(id <MAAnnotation>)annotation;
/**
* @brief
* @param annotations
*/
- (void)removeAnnotations:(NSArray *)annotations;
/**
* @brief
* @param mapRect
* @return
*/
- (NSSet *)annotationsInMapRect:(MAMapRect)mapRect;
/**
* @brief view
* @param annotation
* @return view
*/
- (MAAnnotationView *)viewForAnnotation:(id <MAAnnotation>)annotation;
/**
* @brief annotation view
* @param identifier
* @return annotation view
*/
- (MAAnnotationView *)dequeueReusableAnnotationViewWithIdentifier:(NSString *)identifier;
/**
* @brief viewannotation对应的annotationView因不在屏幕范围内而被移入复用池annotationView添加到地图上annotation.coordinate的位置
* @param annotation
* @param animated
*/
- (void)selectAnnotation:(id <MAAnnotation>)annotation animated:(BOOL)animated;
/**
* @brief view
* @param annotation
* @param animated
*/
- (void)deselectAnnotation:(id <MAAnnotation>)annotation animated:(BOOL)animated;
/**
* @brief 使annotation, annotation的位置
* @param annotations annotation
* @param animated
*/
- (void)showAnnotations:(NSArray *)annotations animated:(BOOL)animated;
/**
* @brief 使annotation, annotation的位置
* @param annotations annotation
* @param insets insets
* @param animated
*/
- (void)showAnnotations:(NSArray *)annotations edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated;
@end
@interface MAMapView (UserLocation)
///是否显示用户位置
@property (nonatomic) BOOL showsUserLocation;
///当前的位置数据
@property (nonatomic, readonly) MAUserLocation *userLocation;
///是否自定义用户位置精度圈(userLocationAccuracyCircle)对应的 view, 默认为 NO.\n 如果为YES: 会调用 - (MAOverlayRenderer *)mapView (MAMapView *)mapView rendererForOverlay:(id <MAOverlay>)overlay 若返回nil, 则不加载.\n 如果为NO : 会使用默认的样式.
@property (nonatomic) BOOL customizeUserLocationAccuracyCircleRepresentation;
///用户位置精度圈 对应的overlay
@property (nonatomic, readonly) MACircle *userLocationAccuracyCircle;
///定位用户位置的模式, 注意:在follow模式下,设置地图中心点、设置可见区域、滑动手势、选择annotation操作会取消follow模式,并触发 - (void)mapView:(MAMapView *)mapView didChangeUserTrackingMode:(MAUserTrackingMode)mode animated:(BOOL)animated;
@property (nonatomic) MAUserTrackingMode userTrackingMode;
///当前位置再地图中是否可见
@property (nonatomic, readonly, getter=isUserLocationVisible) BOOL userLocationVisible;
///设定定位的最小更新距离。默认为kCLDistanceFilterNone,会提示任何移动
@property (nonatomic) CLLocationDistance distanceFilter;
///设定定位精度。默认为kCLLocationAccuracyBest
@property (nonatomic) CLLocationAccuracy desiredAccuracy;
///设定最小更新角度。默认为1度,设定为kCLHeadingFilterNone会提示任何角度改变
@property (nonatomic) CLLocationDegrees headingFilter;
///指定定位是否会被系统自动暂停
@property (nonatomic) BOOL pausesLocationUpdatesAutomatically;
///是否允许后台定位。默认为NO。只在iOS 9.0之后起作用。\n 设置为YES的时候必须保证 Background Modes 中的 Location updates处于选中状态,否则会抛出异常。\n 注意:定位必须在停止的状态下设置(showsUserLocation = NO),否则无效
@property (nonatomic) BOOL allowsBackgroundLocationUpdates;
/**
* @brief
* @param mode
* @param animated
*/
- (void)setUserTrackingMode:(MAUserTrackingMode)mode animated:(BOOL)animated;
/**
* @brief UserLocationView样式userlocation的annotationViewannotationView还未添加到地图上
* @param representation
*/
- (void)updateUserLocationRepresentation:(MAUserLocationRepresentation *)representation;
@end
@interface MAMapView (Overlay)
///所有添加的Overlay
@property (nonatomic, readonly) NSArray *overlays;
/**
* @brief level下的overlays
* @param level
*/
- (NSArray *)overlaysInLevel:(MAOverlayLevel)level;
/**
* @brief Overlay
* MAMapViewDelegate的-mapView:rendererForOverlay:Renderer
* MAGroundOverlay默认层级为MAOverlayLevelAboveRoadsoverlay类型默认层级为MAOverlayLevelAboveLabels
* @param overlay overlay
*/
- (void)addOverlay:(id <MAOverlay>)overlay;
/**
* @brief OverlayMAMapViewDelegate的-mapView:rendererForOverlay:Renderer
* MAOverlayLevelAboveLabels
* @param overlays overlay数组
*/
- (void)addOverlays:(NSArray *)overlays;
/**
* @brief OverlayMAMapViewDelegate的-mapView:rendererForOverlay:Renderer
* @param overlay overlay
* @param level overlay所在层级
*/
- (void)addOverlay:(id <MAOverlay>)overlay level:(MAOverlayLevel)level;
/**
* @brief OverlayMAMapViewDelegate的-mapView:rendererForOverlay:Renderer
* @param overlays overlay数组
* @param level overlay所在层级
*/
- (void)addOverlays:(NSArray *)overlays level:(MAOverlayLevel)level;
/**
* @brief Overlay
* @param overlay overlay
*/
- (void)removeOverlay:(id <MAOverlay>)overlay;
/**
* @brief Overlay
* @param overlays overlay数组
*/
- (void)removeOverlays:(NSArray *)overlays;
/**
* @brief Overlay
* @param overlay overlay
* @param index
* @param level
*
* index大于level层级的最大索引level层级的最大索引之后
*/
- (void)insertOverlay:(id <MAOverlay>)overlay atIndex:(NSUInteger)index level:(MAOverlayLevel)level;
/**
* @brief Overlay之上插入一个overlay
* @param overlay Overlay
* @param sibling Overlay
*/
- (void)insertOverlay:(id <MAOverlay>)overlay aboveOverlay:(id <MAOverlay>)sibling;
/**
* @brief Overlay之下插入一个overlay
* @param overlay Overlay
* @param sibling Overlay
*/
- (void)insertOverlay:(id <MAOverlay>)overlay belowOverlay:(id <MAOverlay>)sibling;
/**
* @brief Overlay
* @param overlay overlay
* @param index
*/
- (void)insertOverlay:(id <MAOverlay>)overlay atIndex:(NSUInteger)index;
/**
* @brief MAOverlayLevelAboveLabels上交换指定索引处的Overlay
* @param index1 1
* @param index2 2
*/
- (void)exchangeOverlayAtIndex:(NSUInteger)index1 withOverlayAtIndex:(NSUInteger)index2;
/**
* @brief Overlay
* @param index1 1
* @param index2 2
* @param level
*/
- (void)exchangeOverlayAtIndex:(NSUInteger)index1 withOverlayAtIndex:(NSUInteger)index2 atLevel:(MAOverlayLevel)level;
/**
* @brief overlay
* @param overlay1 overlay1
* @param overlay2 overlay2
*/
- (void)exchangeOverlay:(id <MAOverlay>)overlay1 withOverlay:(id <MAOverlay>)overlay2;
/**
* @brief overlay对应的RendererView尚未创建nil
* @param overlay overlay
* @return overlay对应的Renderer
*/
- (MAOverlayRenderer *)rendererForOverlay:(id <MAOverlay>)overlay;
/**
* @brief 使overlay, overlay的位置
* @param overlays overlays
* @param animated
*/
- (void)showOverlays:(NSArray *)overlays animated:(BOOL)animated;
/**
* @brief 使overlay, overlay的位置
* @param overlays overlays
* @param insets insets
* @param animated
*/
- (void)showOverlays:(NSArray *)overlays edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated;
/**
* @brief polylineRenderer, polylineRenderer的点击选中功能userInteractionEnabled=YESsince 7.1.0
* @param tappedCoord
* @param traverseAll polyline重合情况NO: YES:
* @return polylineRenderer数组
* */
- (NSArray*)getHittedPolylinesWith:(CLLocationCoordinate2D)tappedCoord traverseAll:(BOOL)traverseAll;
@end
#if MA_INCLUDE_INDOOR
@interface MAMapView (Indoor)
///是否显示室内地图, 默认NO
@property (nonatomic, getter = isShowsIndoorMap) BOOL showsIndoorMap;
///是否显示室内地图默认控件, 默认YES
@property (nonatomic, getter = isShowsIndoorMapControl) BOOL showsIndoorMapControl;
///默认室内地图控件的最大宽高
@property (nonatomic, readonly) CGSize indoorMapControlSize;
/**
* @brief
* @param origin
*/
- (void)setIndoorMapControlOrigin:(CGPoint)origin;
/**
* @brief
* @param floorIndex
*/
- (void)setCurrentIndoorMapFloorIndex:(NSInteger)floorIndex;
/**
* @brief
*/
- (void)clearIndoorMapCache;
@end
#endif
///自定义样式
@interface MAMapView (CustomMapStyle)
///是否开启自定义样式, 默认NO. since 5.0.0
@property (nonatomic, assign) BOOL customMapStyleEnabled;
/**
* @brief web导出数据设置地图样式, . customMapStyleEnabled=YES使生效. since 5.2.0
* @param data web端工具导出的地图样式数据.
*/
- (void)setCustomMapStyleWithWebData:(NSData *)data __attribute((deprecated("已废弃, 请使用 setCustomMapStyleOptions: since 6.6.0")));
/**
* @brief . since 5.7.0
* @param customTextureResourcePath .
*/
- (void)setCustomTextureResourcePath:(NSString *)customTextureResourcePath __attribute((deprecated("已废弃, 请使用 setCustomMapStyleOptions: since 6.6.0")));
/**
* @brief id, 便. customMapStyleEnabled=YES使生效. since 6.0.0
* @param customMapStyleID ID
*/
- (void)setCustomMapStyleID:(NSString *)customMapStyleID __attribute((deprecated("已废弃, 请使用 setCustomMapStyleOptions: since 6.6.0")));
/**
* @brief ,(7.0.0使 6.6.0使setCustomMapStyleOptions:(MAMapCustomStyleOptions *)styleOptions中使用(lbs.amap.com).)
* @param styleOptions options. since 6.6.0
*/
- (void)setCustomMapStyleOptions:(MAMapCustomStyleOptions *)styleOptions;
@end
#pragma mark - MAMapViewDelegate
@protocol MAMapViewDelegate <NSObject>
@optional
/**
* @brief since 4.6.0
* @param mapView View
*/
- (void)mapViewRegionChanged:(MAMapView *)mapView;
/**
* @brief
* @param mapView View
* @param animated
*/
- (void)mapView:(MAMapView *)mapView regionWillChangeAnimated:(BOOL)animated;
/**
* @brief
* @param mapView View
* @param animated
*/
- (void)mapView:(MAMapView *)mapView regionDidChangeAnimated:(BOOL)animated;
/**
* @brief
* @param mapView view
* @param wasUserAction
*/
- (void)mapView:(MAMapView *)mapView mapWillMoveByUser:(BOOL)wasUserAction;
/**
* @brief
* @param mapView view
* @param wasUserAction
*/
- (void)mapView:(MAMapView *)mapView mapDidMoveByUser:(BOOL)wasUserAction;
/**
* @brief
* @param mapView view
* @param wasUserAction
*/
- (void)mapView:(MAMapView *)mapView mapWillZoomByUser:(BOOL)wasUserAction;
/**
* @brief
* @param mapView view
* @param wasUserAction
*/
- (void)mapView:(MAMapView *)mapView mapDidZoomByUser:(BOOL)wasUserAction;
/**
* @brief
* @param mapView View
*/
- (void)mapViewWillStartLoadingMap:(MAMapView *)mapView;
/**
* @brief
* @param mapView View
*/
- (void)mapViewDidFinishLoadingMap:(MAMapView *)mapView;
/**
* @brief
* @param mapView View
* @param error
*/
- (void)mapViewDidFailLoadingMap:(MAMapView *)mapView withError:(NSError *)error;
/**
* @brief anntation生成对应的View
15.1.0annotationannotation是否为MAUserLocationView
if ([annotation isKindOfClass:[MAUserLocation class]]) {
return nil;
}
2annotation进行select和deselect操作annotationView还未添加到mapview
* @param mapView View
* @param annotation
* @return View
*/
- (MAAnnotationView *)mapView:(MAMapView *)mapView viewForAnnotation:(id <MAAnnotation>)annotation;
/**
* @brief mapView新添加annotation views时
* @param mapView View
* @param views annotation views
*/
- (void)mapView:(MAMapView *)mapView didAddAnnotationViews:(NSArray *)views;
/**
* @brief annotation view时. -(void)deselectAnnotation:animated:
* @param mapView View
* @param view annotation view
*/
- (void)mapView:(MAMapView *)mapView didSelectAnnotationView:(MAAnnotationView *)view;
/**
* @brief annotation view时
* @param mapView View
* @param view annotation view
*/
- (void)mapView:(MAMapView *)mapView didDeselectAnnotationView:(MAAnnotationView *)view;
/**
* @brief View将要启动定位时
* @param mapView View
*/
- (void)mapViewWillStartLocatingUser:(MAMapView *)mapView;
/**
* @brief View停止定位后
* @param mapView View
*/
- (void)mapViewDidStopLocatingUser:(MAMapView *)mapView;
/**
* @brief
* @param mapView View
* @param userLocation ()
* @param updatingLocation location数据更新, YES:location数据更新 NO:heading数据更新
*/
- (void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation updatingLocation:(BOOL)updatingLocation;
/**
* @brief plist配置NSLocationAlwaysUsageDescription或者NSLocationAlwaysAndWhenInUseUsageDescription[CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined
API即可 [locationManager requestAlwaysAuthorization] ; since 6.8.0
* @param locationManager CLLocationManager
*/
- (void)mapViewRequireLocationAuth:(CLLocationManager *)locationManager;
/**
* @brief
* @param mapView View
* @param error CLError.h中定义的错误号
*/
- (void)mapView:(MAMapView *)mapView didFailToLocateUserWithError:(NSError *)error;
/**
* @brief annotation view时view的状态变化
* @param mapView View
* @param view annotation view
* @param newState
* @param oldState
*/
- (void)mapView:(MAMapView *)mapView annotationView:(MAAnnotationView *)view didChangeDragState:(MAAnnotationViewDragState)newState
fromOldState:(MAAnnotationViewDragState)oldState;
/**
* @brief overlay生成对应的Renderer
* @param mapView View
* @param overlay overlay
* @return Renderer
*/
- (MAOverlayRenderer *)mapView:(MAMapView *)mapView rendererForOverlay:(id <MAOverlay>)overlay;
/**
* @brief mapView新添加overlay renderers时
* @param mapView View
* @param overlayRenderers overlay renderers
*/
- (void)mapView:(MAMapView *)mapView didAddOverlayRenderers:(NSArray *)overlayRenderers;
/**
* @brief view的accessory view(UIControl)
* @param mapView View
* @param view callout所属的标注view
* @param control control
*/
- (void)mapView:(MAMapView *)mapView annotationView:(MAAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control;
/**
* @brief view的calloutview整体点击时使calloutview时才生效
* @param mapView view
* @param view calloutView所属的annotationView
*/
- (void)mapView:(MAMapView *)mapView didAnnotationViewCalloutTapped:(MAAnnotationView *)view;
/**
* @brief view被点击时since 5.7.0
* @param mapView view
* @param view annotationView
*/
- (void)mapView:(MAMapView *)mapView didAnnotationViewTapped:(MAAnnotationView *)view;
/**
* @brief userTrackingMode改变时
* @param mapView View
* @param mode mode
* @param animated
*/
- (void)mapView:(MAMapView *)mapView didChangeUserTrackingMode:(MAUserTrackingMode)mode animated:(BOOL)animated;
/**
* @brief openGLESDisabled变量改变时
* @param mapView View
* @param openGLESDisabled openGLESDisabled
*/
- (void)mapView:(MAMapView *)mapView didChangeOpenGLESDisabled:(BOOL)openGLESDisabled;
/**
* @brief touchPOIEnabled == YES时使POI信息
* @param mapView View
* @param pois poi数组(MATouchPoi组成)
*/
- (void)mapView:(MAMapView *)mapView didTouchPois:(NSArray *)pois;
/**
* @brief
* @param mapView View
* @param coordinate
*/
- (void)mapView:(MAMapView *)mapView didSingleTappedAtCoordinate:(CLLocationCoordinate2D)coordinate;
/**
* @brief
* @param mapView View
* @param coordinate
*/
- (void)mapView:(MAMapView *)mapView didLongPressedAtCoordinate:(CLLocationCoordinate2D)coordinate;
/**
* @brief
* @param mapView View
*/
- (void)mapInitComplete:(MAMapView *)mapView;
#if MA_INCLUDE_INDOOR
/**
* @brief ,
*
* @param mapView View
* @param indoorInfo
*/
- (void)mapView:(MAMapView *)mapView didIndoorMapShowed:(MAIndoorInfo *)indoorInfo;
/**
* @brief ,
*
* @param mapView View
* @param indoorInfo
*/
- (void)mapView:(MAMapView *)mapView didIndoorMapFloorIndexChanged:(MAIndoorInfo *)indoorInfo;
/**
* @brief ,
*
* @param mapView View
* @param indoorInfo
*/
- (void)mapView:(MAMapView *)mapView didIndoorMapHidden:(MAIndoorInfo *)indoorInfo;
#endif //end of MA_INCLUDE_INDOOR
/**
* @brief 线, reloadMap会触发该回调线.
* @param mapView View
*/
- (void)offlineDataWillReload:(MAMapView *)mapView;
/**
* @brief 线, reloadMap会触发该回调线.
* @param mapView View
*/
- (void)offlineDataDidReload:(MAMapView *)mapView;
@end