AMapSearchAPI.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. //
  2. // AMapSearchAPI.h
  3. // AMapSearchKit
  4. //
  5. // Created by xiaoming han on 15/7/22.
  6. // Copyright (c) 2015年 AutoNavi. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "AMapSearchObj.h"
  10. #import "AMapCommonObj.h"
  11. @protocol AMapSearchDelegate;
  12. /// 搜索结果语言
  13. typedef NS_ENUM(NSInteger, AMapSearchLanguage)
  14. {
  15. AMapSearchLanguageZhCN = 0, //!< 中文
  16. AMapSearchLanguageEn = 1 //!< 英文
  17. };
  18. /// 搜索类
  19. @interface AMapSearchAPI : NSObject
  20. /// 实现了AMapSearchDelegate协议的类指针
  21. @property (nonatomic, weak) id<AMapSearchDelegate> delegate;
  22. /// 查询超时时间,单位秒,默认为20秒
  23. @property (nonatomic, assign) NSInteger timeout;
  24. /// 查询结果返回语言, 默认为中文
  25. @property (nonatomic, assign) AMapSearchLanguage language;
  26. /**
  27. * AMapSearch的初始化函数。
  28. *
  29. * 初始化之前请设置 AMapSearchServices 中的APIKey,否则将无法正常使用搜索服务.
  30. * @return AMapSearch类对象实例
  31. */
  32. - (instancetype)init;
  33. /**
  34. * POI ID查询接口
  35. *
  36. * @param request 查询选项。具体属性字段请参考 AMapPOIIDSearchRequest 类。
  37. */
  38. - (void)AMapPOIIDSearch:(AMapPOIIDSearchRequest *)request;
  39. /**
  40. * POI 关键字查询接口
  41. *
  42. * @param request 查询选项。具体属性字段请参考 AMapPOIKeywordsSearchRequest 类。
  43. */
  44. - (void)AMapPOIKeywordsSearch:(AMapPOIKeywordsSearchRequest *)request;
  45. /**
  46. * POI 周边查询接口
  47. *
  48. * @param request 查询选项。具体属性字段请参考 AMapPOIAroundSearchRequest 类。
  49. */
  50. - (void)AMapPOIAroundSearch:(AMapPOIAroundSearchRequest *)request;
  51. /**
  52. * POI 多边形查询接口
  53. *
  54. * @param request 查询选项。具体属性字段请参考 AMapPOIPolygonSearchRequest 类。
  55. */
  56. - (void)AMapPOIPolygonSearch:(AMapPOIPolygonSearchRequest *)request;
  57. /**
  58. * 地址编码查询接口
  59. *
  60. * @param request 查询选项。具体属性字段请参考 AMapGeocodeSearchRequest 类。
  61. */
  62. - (void)AMapGeocodeSearch:(AMapGeocodeSearchRequest *)request;
  63. /**
  64. * 逆地址编码查询接口
  65. *
  66. * @param request 查询选项。具体属性字段请参考 AMapReGeocodeSearchRequest 类。
  67. */
  68. - (void)AMapReGoecodeSearch:(AMapReGeocodeSearchRequest *)request;
  69. /**
  70. * 输入提示查询接口
  71. *
  72. * @param request 查询选项。具体属性字段请参考 AMapInputTipsSearchRequest 类。
  73. */
  74. - (void)AMapInputTipsSearch:(AMapInputTipsSearchRequest *)request;
  75. /**
  76. * 公交站点查询接口
  77. *
  78. * @param request 查询选项。具体属性字段请参考 AMapBusStopSearchRequest 类。
  79. */
  80. - (void)AMapBusStopSearch:(AMapBusStopSearchRequest *)request;
  81. /**
  82. * 公交线路关键字查询
  83. *
  84. * @param request 查询选项。具体属性字段请参考 AMapBusLineIDSearchRequest 类。
  85. */
  86. - (void)AMapBusLineIDSearch:(AMapBusLineIDSearchRequest *)request;
  87. /**
  88. * 公交线路关键字查询
  89. *
  90. * @param request 查询选项。具体属性字段请参考 AMapBusLineIDSearchRequest 类。
  91. */
  92. - (void)AMapBusLineNameSearch:(AMapBusLineNameSearchRequest *)request;
  93. /**
  94. * 行政区域查询接口
  95. *
  96. * @param request 查询选项。具体属性字段请参考 AMapDistrictSearchRequest 类。
  97. */
  98. - (void)AMapDistrictSearch:(AMapDistrictSearchRequest *)request;
  99. /**
  100. * 驾车路径规划查询接口
  101. *
  102. * @param request 查询选项。具体属性字段请参考 AMapDrivingRouteSearchRequest 类。
  103. */
  104. - (void)AMapDrivingRouteSearch:(AMapDrivingRouteSearchRequest *)request;
  105. /**
  106. * 步行路径规划查询接口
  107. *
  108. * @param request 查询选项。具体属性字段请参考 AMapWalkingRouteSearchRequest 类。
  109. */
  110. - (void)AMapWalkingRouteSearch:(AMapWalkingRouteSearchRequest *)request;
  111. /**
  112. * 公交路径规划查询接口
  113. *
  114. * @param request 查询选项。具体属性字段请参考 AMapTransitRouteSearchRequest 类。
  115. */
  116. - (void)AMapTransitRouteSearch:(AMapTransitRouteSearchRequest *)request;
  117. /**
  118. * 天气查询接口
  119. *
  120. * @param request 查询选项。具体属性字段请参考 AMapWeatherSearchRequest 类。
  121. */
  122. - (void)AMapWeatherSearch:(AMapWeatherSearchRequest *)request;
  123. #pragma mark - 周边搜索相关
  124. /**
  125. * 附近搜索查询接口
  126. *
  127. * @param request 查询选项。具体属性字段请参考 AMapNearbySearchRequest 类。
  128. */
  129. - (void)AMapNearbySearch:(AMapNearbySearchRequest *)request;
  130. @end
  131. #pragma mark - AMapSearchDelegate
  132. /**
  133. * AMapSearchDelegate协议
  134. * 定义了搜索结果的回调方法,发生错误时的错误回调方法。
  135. */
  136. @protocol AMapSearchDelegate<NSObject>
  137. @optional
  138. /**
  139. * 当请求发生错误时,会调用代理的此方法.
  140. *
  141. * @param request 发生错误的请求.
  142. * @param error 返回的错误.
  143. */
  144. - (void)AMapSearchRequest:(id)request didFailWithError:(NSError *)error;
  145. /**
  146. * POI查询回调函数
  147. *
  148. * @param request 发起的请求,具体字段参考 AMapPOISearchBaseRequest 及其子类。
  149. * @param response 响应结果,具体字段参考 AMapPOISearchResponse 。
  150. */
  151. - (void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response;
  152. /**
  153. * 地理编码查询回调函数
  154. *
  155. * @param request 发起的请求,具体字段参考 AMapGeocodeSearchRequest 。
  156. * @param response 响应结果,具体字段参考 AMapGeocodeSearchResponse 。
  157. */
  158. - (void)onGeocodeSearchDone:(AMapGeocodeSearchRequest *)request response:(AMapGeocodeSearchResponse *)response;
  159. /**
  160. * 逆地理编码查询回调函数
  161. *
  162. * @param request 发起的请求,具体字段参考 AMapReGeocodeSearchRequest 。
  163. * @param response 响应结果,具体字段参考 AMapReGeocodeSearchResponse 。
  164. */
  165. - (void)onReGeocodeSearchDone:(AMapReGeocodeSearchRequest *)request response:(AMapReGeocodeSearchResponse *)response;
  166. /**
  167. * 输入提示查询回调函数
  168. *
  169. * @param request 发起的请求,具体字段参考 AMapInputTipsSearchRequest 。
  170. * @param response 响应结果,具体字段参考 AMapInputTipsSearchResponse 。
  171. */
  172. - (void)onInputTipsSearchDone:(AMapInputTipsSearchRequest *)request response:(AMapInputTipsSearchResponse *)response;
  173. /**
  174. * 公交站查询回调函数
  175. *
  176. * @param request 发起的请求,具体字段参考 AMapBusStopSearchRequest 。
  177. * @param response 响应结果,具体字段参考 AMapBusStopSearchResponse 。
  178. */
  179. - (void)onBusStopSearchDone:(AMapBusStopSearchRequest *)request response:(AMapBusStopSearchResponse *)response;
  180. /**
  181. * 公交线路关键字查询回调
  182. *
  183. * @param request 发起的请求,具体字段参考 AMapBusLineSearchRequest 。
  184. * @param response 响应结果,具体字段参考 AMapBusLineSearchResponse 。
  185. */
  186. - (void)onBusLineSearchDone:(AMapBusLineBaseSearchRequest *)request response:(AMapBusLineSearchResponse *)response;
  187. /**
  188. * 行政区域查询回调函数
  189. *
  190. * @param request 发起的请求,具体字段参考 AMapDistrictSearchRequest 。
  191. * @param response 响应结果,具体字段参考 AMapDistrictSearchResponse 。
  192. */
  193. - (void)onDistrictSearchDone:(AMapDistrictSearchRequest *)request response:(AMapDistrictSearchResponse *)response;
  194. /**
  195. * 路径规划查询回调
  196. *
  197. * @param request 发起的请求,具体字段参考 AMapRouteSearchBaseRequest 及其子类。
  198. * @param response 响应结果,具体字段参考 AMapRouteSearchResponse 。
  199. */
  200. - (void)onRouteSearchDone:(AMapRouteSearchBaseRequest *)request response:(AMapRouteSearchResponse *)response;
  201. /**
  202. * 天气查询回调
  203. *
  204. * @param request 发起的请求,具体字段参考 AMapWeatherSearchRequest 。
  205. * @param response 响应结果,具体字段参考 AMapWeatherSearchResponse 。
  206. */
  207. - (void)onWeatherSearchDone:(AMapWeatherSearchRequest *)request response:(AMapWeatherSearchResponse *)response;
  208. /**
  209. * 周边搜索回调
  210. *
  211. * @param request 发起的请求,具体字段参考 AMapNearbySearchRequest 。
  212. * @param response 响应结果,具体字段参考 AMapNearbySearchResponse 。
  213. */
  214. - (void)onNearbySearchDone:(AMapNearbySearchRequest *)request response:(AMapNearbySearchResponse *)response;
  215. @end