提交 4215f538 authored 作者: 袁静春's avatar 袁静春

提交:增加综合搜索的方法;

上级 fcc475e2
......@@ -68,6 +68,13 @@
} @catch(FlutterError *e) {
result(e);
}
} else if ([@"searchPOI#around#all" isEqualToString:call.method]) {
@try {
NSLog(@"---handleMethodCall--- arguments:%@", arguments);
[weakSelf aroundSearchAll:arguments];
} @catch(FlutterError *e) {
result(e);
}
} else if ([@"getPlatformVersion" isEqualToString:call.method]) {
result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
} else {
......@@ -94,6 +101,26 @@
[self.search AMapPOIAroundSearch:request];
}
- (void)aroundSearchAll:(NSDictionary *)arguments {
NSString *latitude = arguments[@"latitude"];
NSString *longitude = arguments[@"longitude"];
NSString *keywords = arguments[@"keywords"];
NSString *city = arguments[@"city"];
AMapPOIAroundSearchRequest *request = [[AMapPOIAroundSearchRequest alloc] init];
request.location = [AMapGeoPoint locationWithLatitude:[latitude floatValue] longitude:[longitude floatValue]];
request.page = 1;
request.offset = 20;
request.radius = 1000;
if (keywords.length != 0) {
request.keywords = keywords;
}
if (city.length != 0) {
request.city = city;
}
[self.search AMapPOIAroundSearch:request];
}
#pragma mark -
#pragma mark - AMapSearchDelegate
......
......@@ -26,4 +26,9 @@ class ClxMapPoiSearch {
Future<PoiResult?> aroundSearch(double latitude, double longitude) {
return ClxMapPoiSearchPlatform.instance.aroundSearch(latitude, longitude);
}
/// 周边搜索
Future<PoiResult?> aroundSearchAll(String keywords, double latitude, double longitude, String city) {
return ClxMapPoiSearchPlatform.instance.aroundSearch(latitude, longitude);
}
}
......@@ -41,4 +41,15 @@ class MethodChannelClxMapPoiSearch extends ClxMapPoiSearchPlatform {
return PoiResult.toPoiResult(searchPOIResult);
}
/// 周边搜索
Future<PoiResult?> aroundSearchAll(String keywords, double latitude, double longitude, String city) async {
var searchPOIResult = await methodChannel.invokeMethod<dynamic>('searchPOI#around#all', <String, dynamic>{
'keywords': keywords,
'latitude': latitude,
'longitude': longitude,
'city': city,
});
return PoiResult.toPoiResult(searchPOIResult);
}
}
......@@ -47,4 +47,9 @@ abstract class ClxMapPoiSearchPlatform extends PlatformInterface {
Future<PoiResult?> aroundSearch(double latitude, double longitude) async {
throw UnimplementedError('aroundSearch() has not been implemented.');
}
/// 周边搜索
Future<PoiResult?> aroundSearchAll(String keywords, double latitude, double longitude, String city) async {
throw UnimplementedError('aroundSearchAll() has not been implemented.');
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论