AMapLocationCommonObj.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. //
  2. // AMapLocationCommonObj.h
  3. // AMapLocationKit
  4. //
  5. // Created by AutoNavi on 15/10/22.
  6. // Copyright © 2015年 Amap. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <CoreLocation/CoreLocation.h>
  10. #import <UIKit/UIKit.h>
  11. ///AMapLocation errorDomain
  12. extern NSString * const AMapLocationErrorDomain;
  13. ///AMapLocation errorCode
  14. typedef NS_ENUM(NSInteger, AMapLocationErrorCode)
  15. {
  16. AMapLocationErrorUnknown = 1, ///<未知错误
  17. AMapLocationErrorLocateFailed = 2, ///<定位错误
  18. AMapLocationErrorReGeocodeFailed = 3, ///<逆地理错误
  19. AMapLocationErrorTimeOut = 4, ///<超时
  20. AMapLocationErrorCanceled = 5, ///<取消
  21. AMapLocationErrorCannotFindHost = 6, ///<找不到主机
  22. AMapLocationErrorBadURL = 7, ///<URL异常
  23. AMapLocationErrorNotConnectedToInternet = 8,///<连接异常
  24. AMapLocationErrorCannotConnectToHost = 9, ///<服务器连接失败
  25. AMapLocationErrorRegionMonitoringFailure=10,///<地理围栏错误
  26. AMapLocationErrorRiskOfFakeLocation = 11, ///<存在虚拟定位风险
  27. AMapLocationErrorNoFullAccuracyAuth = 12, ///<精确定位权限异常
  28. };
  29. ///AMapLocation Region State
  30. typedef NS_ENUM(NSInteger, AMapLocationRegionState)
  31. {
  32. AMapLocationRegionStateUnknow = 0, ///<未知
  33. AMapLocationRegionStateInside = 1, ///<在范围内
  34. AMapLocationRegionStateOutside = 2, ///<在范围外
  35. };
  36. ///AMapLocation Region Language
  37. typedef NS_ENUM(NSInteger, AMapLocationReGeocodeLanguage)
  38. {
  39. AMapLocationReGeocodeLanguageDefault = 0, ///<默认,根据地区选择语言
  40. AMapLocationReGeocodeLanguageChinse = 1, ///<中文
  41. AMapLocationReGeocodeLanguageEnglish = 2, ///<英文
  42. };
  43. ///AMapLocation Accuracy Mode
  44. typedef NS_ENUM(NSInteger, AMapLocationAccuracyMode) {
  45. AMapLocationFullAndReduceAccuracy = 0, ///<默认模式,该模式下会申请临时精确定位权限,如果用户拒绝,则依然开启定位,回调模糊定位数据;
  46. AMapLocationFullAccuracy, ///<高精度模式,该模式下会申请临时精确定位权限,如果用户拒绝,则回调error;
  47. AMapLocationReduceAccuracy ///<低精度模式,该模式下不会申请临时精确定位权限,根据当前定位权限回调定位数据;
  48. };
  49. ///逆地理信息
  50. @interface AMapLocationReGeocode : NSObject<NSCopying,NSCoding>
  51. ///格式化地址
  52. @property (nonatomic, copy) NSString *formattedAddress;
  53. ///国家
  54. @property (nonatomic, copy) NSString *country;
  55. ///省/直辖市
  56. @property (nonatomic, copy) NSString *province;
  57. ///市
  58. @property (nonatomic, copy) NSString *city;
  59. ///区
  60. @property (nonatomic, copy) NSString *district;
  61. ///乡镇
  62. @property (nonatomic, copy) NSString *township __attribute__((deprecated("该字段从v2.2.0版本起不再返回数据,建议您使用AMapSearchKit的逆地理功能获取.")));
  63. ///社区
  64. @property (nonatomic, copy) NSString *neighborhood __attribute__((deprecated("该字段从v2.2.0版本起不再返回数据,建议您使用AMapSearchKit的逆地理功能获取.")));
  65. ///建筑
  66. @property (nonatomic, copy) NSString *building __attribute__((deprecated("该字段从v2.2.0版本起不再返回数据,建议您使用AMapSearchKit的逆地理功能获取.")));
  67. ///城市编码
  68. @property (nonatomic, copy) NSString *citycode;
  69. ///区域编码
  70. @property (nonatomic, copy) NSString *adcode;
  71. ///街道名称
  72. @property (nonatomic, copy) NSString *street;
  73. ///门牌号
  74. @property (nonatomic, copy) NSString *number;
  75. ///兴趣点名称
  76. @property (nonatomic, copy) NSString *POIName;
  77. ///所属兴趣点名称
  78. @property (nonatomic, copy) NSString *AOIName;
  79. @end
  80. #pragma mark - AMapLocationPoint
  81. ///经纬度坐标点对象
  82. @interface AMapLocationPoint : NSObject<NSCopying,NSCoding>
  83. ///纬度
  84. @property (nonatomic, assign) CGFloat latitude;
  85. ///经度
  86. @property (nonatomic, assign) CGFloat longitude;
  87. /**
  88. * @brief AMapNaviPoint类对象的初始化函数
  89. * @param lat 纬度
  90. * @param lon 经度
  91. * @return AMapNaviPoint类对象id
  92. */
  93. + (AMapLocationPoint *)locationWithLatitude:(CGFloat)lat longitude:(CGFloat)lon;
  94. @end
  95. ///POI信息
  96. @interface AMapLocationPOIItem : NSObject <NSCopying, NSCoding>
  97. ///id
  98. @property (nonatomic, copy) NSString *pId;
  99. ///名称
  100. @property (nonatomic, copy) NSString *name;
  101. ///类型
  102. @property (nonatomic, copy) NSString *type;
  103. ///类型编码
  104. @property (nonatomic, copy) NSString *typeCode;
  105. ///地址信息
  106. @property (nonatomic, copy) NSString *address;
  107. ///经纬度
  108. @property (nonatomic, strong) AMapLocationPoint *location;
  109. ///电话号码
  110. @property (nonatomic, copy) NSString *tel;
  111. ///省份
  112. @property (nonatomic, copy) NSString *province;
  113. ///城市
  114. @property (nonatomic, copy) NSString *city;
  115. ///区
  116. @property (nonatomic, copy) NSString *district;
  117. @end
  118. ///行政区域信息
  119. @interface AMapLocationDistrictItem : NSObject <NSCopying, NSCoding>
  120. ///城市编码
  121. @property (nonatomic, copy) NSString *cityCode;
  122. ///区域编码
  123. @property (nonatomic, copy) NSString *districtCode;
  124. ///区名
  125. @property (nonatomic, copy) NSString *district;
  126. ///行政区域轮廓坐标点,每个行政区可能有多个模块,每个模块的坐标点数组由AMapLocationPoint构成
  127. @property (nonatomic, copy) NSArray <NSArray<AMapLocationPoint *> *> *polylinePoints;
  128. @end
  129. ///AMapLocation CoordinateType
  130. typedef NS_ENUM(NSUInteger, AMapLocationCoordinateType)
  131. {
  132. AMapLocationCoordinateTypeBaidu = 0, ///<Baidu
  133. AMapLocationCoordinateTypeMapBar, ///<MapBar
  134. AMapLocationCoordinateTypeMapABC, ///<MapABC
  135. AMapLocationCoordinateTypeSoSoMap, ///<SoSoMap
  136. AMapLocationCoordinateTypeAliYun, ///<AliYun
  137. AMapLocationCoordinateTypeGoogle, ///<Google
  138. AMapLocationCoordinateTypeGPS, ///<GPS
  139. };
  140. /**
  141. * @brief 转换目标经纬度为高德坐标系
  142. * @param coordinate 待转换的经纬度
  143. * @param type 坐标系类型
  144. * @return 高德坐标系经纬度
  145. */
  146. FOUNDATION_EXTERN CLLocationCoordinate2D AMapLocationCoordinateConvert(CLLocationCoordinate2D coordinate, AMapLocationCoordinateType type);
  147. /**
  148. * @brief 判断目标经纬度是否在大陆以及港、澳地区。输入参数为高德坐标系。
  149. * @param coordinate 待判断的目标经纬度
  150. * @return 是否在大陆以及港、澳地区
  151. */
  152. FOUNDATION_EXTERN BOOL AMapLocationDataAvailableForCoordinate(CLLocationCoordinate2D coordinate);