This commit is contained in:
DDIsFriend
2023-08-18 17:28:57 +08:00
commit f0e8a1709d
4282 changed files with 192396 additions and 0 deletions
@@ -0,0 +1,154 @@
//
// DDMAMapView.h
// DDMAMapKit_Private
// Created by DDIsFriend on 2023/1/30.
#import <UIKit/UIKit.h>
#import <AMapNaviKit/MAMapKit.h>
#import <DDMAMapKit_Private/MATraceReplayOverlay.h>
#import <DDMAMapKit_Private/MATraceReplayOverlayRender.h>
NS_ASSUME_NONNULL_BEGIN
@protocol DDMAMapViewDelegate;
@class DDAnnotationView;
@class DDAnnotation;
@interface DDMAMapView : UIView
@property (nonatomic, strong, nonnull)MAMapView *maMapView;
@property (nonatomic, weak)id<DDMAMapViewDelegate> delegate;
// 请在使用该类前先设置appkey
+ (void)startWithAppKey:(nullable NSString *)appKey;
// 在创建该类实例前调用
+ (void)agreePrivacy;
- (MAOverlayRenderer *)dd_rendererForOverlay:(id <MAOverlay>)overlay;
@end
@interface DDMAMapView (Location)
/// @brief 用户当前位置的属性
@property (nonatomic, readonly)MAUserLocation *maUserLocation;
/// @brief 调用此方法来自定义当前位置小蓝点
- (void)updateLocationViewWithParam:(MAUserLocationRepresentation *)representation;
@end
@interface DDMAMapView (Trace)
@property (nonatomic, strong)MATraceReplayOverlay *traceReplayOverlay;
@property (nonatomic, strong)MATraceReplayOverlayRenderer *traceReplayOverlayRenderer;
@end
@protocol DDMAMapViewDelegate <NSObject>
@optional
/**
* @brief 地图开始加载
* @param mapView 地图View
*/
- (void)dd_mapViewWillStartLoadingMap:(MAMapView *)mapView;
/**
* @brief 地图加载成功
* @param mapView 地图View
*/
- (void)dd_mapViewDidFinishLoadingMap:(MAMapView *)mapView;
/**
* @brief 地图加载失败
* @param mapView 地图View
* @param error 错误信息
*/
- (void)dd_mapViewDidFailLoadingMap:(MAMapView *)mapView withError:(NSError *)error;
/**
* @brief 地形图加载失败
* @param mapView 地图View
* @param error 错误信息
*/
- (void)dd_mapView:(MAMapView *)mapView didFailLoadTerrainWithError:(NSError *)error;
/**
* @brief 在地图View将要启动定位时,会调用此函数
* @param mapView 地图View
*/
- (void)dd_mapViewWillStartLocatingUser:(MAMapView *)mapView;
/**
* @brief 在地图View停止定位后,会调用此函数
* @param mapView 地图View
*/
- (void)dd_mapViewDidStopLocatingUser:(MAMapView *)mapView;
/**
* @brief 位置或者设备方向更新后,会调用此函数
* @param mapView 地图View
* @param userLocation 用户定位信息(包括位置与设备方向等数据)
* @param updatingLocation 标示是否是location数据更新, YES:location数据更新 NO:heading数据更新
*/
- (void)dd_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)dd_mapViewRequireLocationAuth:(CLLocationManager *)locationManager;
/**
* @brief 定位失败后,会调用此函数
* @param mapView 地图View
* @param error 错误号,参考CLError.h中定义的错误号
*/
- (void)dd_mapView:(MAMapView *)mapView didFailToLocateUserWithError:(NSError *)error;
/**
* @brief 根据anntation生成对应的View。
注意:
1、5.1.0后由于定位蓝点增加了平滑移动功能,如果在开启定位的情况先添加annotation,需要在此回调方法中判断annotation是否为MAUserLocation,从而返回正确的View。
if ([annotation isKindOfClass:[MAUserLocation class]]) {
return nil;
}
2、请不要在此回调中对annotation进行select和deselect操作,此时annotationView还未添加到mapview。
* @param mapView 地图View
* @param annotation 指定的标注
* @return 生成的标注View
*/
- (MAAnnotationView *)dd_mapView:(MAMapView *)mapView viewForAnnotation:(id <MAAnnotation>)annotation;
/**
* @brief 根据overlay生成对应的Renderer
* @param mapView 地图View
* @param overlay 指定的overlay
* @return 生成的覆盖物Renderer
*/
- (MAOverlayRenderer *)dd_mapView:(MAMapView *)mapView rendererForOverlay:(id <MAOverlay>)overlay;
/**
* @brief 标注view被点击时,触发该回调。(since 5.7.0
* @param mapView 地图的view
* @param view annotationView
*/
- (void)dd_mapView:(MAMapView *)mapView didAnnotationViewTapped:(MAAnnotationView *)view;
/**
* @brief 当mapView新添加overlay renderers时,调用此接口
* @param mapView 地图View
* @param overlayRenderers 新添加的overlay renderers
*/
- (void)dd_mapView:(MAMapView *)mapView didAddOverlayRenderers:(NSArray *)overlayRenderers;
@end
NS_ASSUME_NONNULL_END