提交 46c3f95e authored 作者: 袁静春's avatar 袁静春

提交:修改获取距离的代码;

上级 de1d0264
#import "ClxMapPoiSearchPlugin.h"
#import <AMapFoundationKit/AMapFoundationKit.h>
#import <AMapSearchKit/AMapSearchKit.h>
//#import <MAMapKit/MAGeometry.h>
@interface ClxMapPoiSearchPlugin ()<AMapSearchDelegate>
......@@ -78,6 +79,13 @@
} @catch(FlutterError *e) {
result(e);
}
} else if ([@"searchPOI#getDistance" isEqualToString:call.method]) {
@try {
NSLog(@"---searchPOI#getDistance--- arguments:%@", arguments);
[weakSelf getDistance:arguments];
} @catch(FlutterError *e) {
result(e);
}
} else if ([@"getPlatformVersion" isEqualToString:call.method]) {
result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
} else {
......@@ -142,18 +150,37 @@
//是否返回扩展信息
//request.requireExtension = YES;
[self.search AMapPOIKeywordsSearch:request];
//1.将两个经纬度点转成投影点
MAMapPoint point1 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(39.989612,116.480972));
MAMapPoint point2 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(39.990347,116.480441));
//2.计算距离
CLLocationDistance distance = MAMetersBetweenMapPoints(point1,point2);
}
}
- (void)getDistance:(NSDictionary *)arguments {
// NSArray *pointF = arguments[@"pointF"];
// NSArray *pointT = arguments[@"pointT"];
//
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
// if (pointF.count == 2 && pointT.count == 2) {
// double latitudeF = [[pointF firstObject] doubleValue];
// double longitudeF = [[pointF lastObject] doubleValue];
//
// double latitudeT = [[pointT firstObject] doubleValue];
// double longitudeT = [[pointT lastObject] doubleValue];
//
// //1.将两个经纬度点转成投影点
// MAMapPoint point1 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(latitudeF,longitudeF));
// MAMapPoint point2 = MAMapPointForCoordinate(CLLocationCoordinate2DMake(latitudeT,longitudeT));
// //2.计算距离
// CLLocationDistance distance = MAMetersBetweenMapPoints(point1, point2);
// NSNumber *numDistance = [NSNumber numberWithDouble:distance];
// [dict setValue:numDistance forKey:@"distance"];
//
// NSLog(@"getDistance: dict = %@", dict);
// self.resultM(dict);
// }
[dict setValue:@(0.0) forKey:@"distance"];
self.resultM(dict);
}
#pragma mark -
#pragma mark - AMapSearchDelegate
......
......@@ -17,6 +17,7 @@ A new Flutter project.
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.dependency 'AMapSearch', '9.3.1'
# s.dependency 'AMap3DMap', '9.5.0'
s.platform = :ios, '9.0'
s.static_framework = true
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论