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.

116 lines
3.9 KiB

//
// MATraceManager.h
// MAMapKit
//
// Created by shaobin on 16/9/1.
// Copyright © 2016年 Amap. All rights reserved.
//
#import "MAConfig.h"
#if MA_INCLUDE_TRACE_CORRECT
#import <Foundation/Foundation.h>
#import <AMapFoundationKit/AMapFoundationKit.h>
#import "MATraceLocation.h"
@class MATraceManager;
///处理中回调, index: 批次编号,0 based
typedef void(^MAProcessingCallback)(int index, NSArray<MATracePoint *> *points);
///成功回调,distance:距离,单位米
typedef void(^MAFinishCallback)(NSArray<MATracePoint *> *points, double distance);
///失败回调
typedef void(^MAFailedCallback)(int errorCode, NSString *errorDesc);
///定位回调, locations: 原始定位点; tracePoints: 纠偏后的点,如果纠偏失败返回nil; distance:距离; error: 纠偏失败时的错误信息
typedef void(^MATraceLocationCallback)(NSArray<CLLocation *> *locations, NSArray<MATracePoint *> *tracePoints, double distance, NSError *error);
/**
* @brief since v6.2.0
*/
@protocol MATraceDelegate <NSObject>
@required
/**
* @brief since v6.2.0
* @param manager
* @param locations
* @param tracePoints
* @param distance
* @param error nil
*/
- (void)traceManager:(MATraceManager *)manager
didTrace:(NSArray<CLLocation *> *)locations
correct:(NSArray<MATracePoint *> *)tracePoints
distance:(double)distance
withError:(NSError *)error;
@optional
/**
* @brief plist配置NSLocationAlwaysUsageDescription或者NSLocationAlwaysAndWhenInUseUsageDescription[CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined
API即可 [locationManager requestAlwaysAuthorization] ; since 6.8.1
* @param locationManager CLLocationManager
*/
- (void)mapViewRequireLocationAuth:(CLLocationManager *)locationManager;
@end
///轨迹纠偏管理类
@interface MATraceManager : NSObject
/**
* @brief
*/
+ (instancetype)sharedInstance;
/**
* @brief
* @param locations ,
* @param type loctions经纬度坐标的类型, -1
* @param processingCallback
* @param finishCallback
* @param failedCallback
* @return NSOperation对象cancel取消
*/
- (NSOperation *)queryProcessedTraceWith:(NSArray<MATraceLocation *>*)locations
type:(AMapCoordinateType)type
processingCallback:(MAProcessingCallback)processingCallback
finishCallback:(MAFinishCallback)finishCallback
failedCallback:(MAFailedCallback)failedCallback;
/**
* @brief , 使CLLocationManagerdistanceFilterdesiredAccuracy均为系统默认值
* @param locCallback , AMapCoordinateTypeGPS
*/
- (void)startTraceWith:(MATraceLocationCallback)locCallback __attribute__((deprecated("use start instead")));
/**
* @brief
*/
- (void)stopTrace __attribute__((deprecated("use stop instead")));
/**
* @brief start和stop方法使用since v6.2.0
*/
@property (nonatomic, weak) id<MATraceDelegate> delegate;
/**
* @brief , 使CLLocationManagerdistanceFilterdesiredAccuracy均为系统默认值since v6.2.0
*/
- (void)start;
/**
* @brief since v6.2.0
*/
- (void)stop;
@end
#endif