AMapLocationCommonObj.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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. };
  27. ///AMapLocation Region State
  28. typedef NS_ENUM(NSInteger, AMapLocationRegionState)
  29. {
  30. AMapLocationRegionStateUnknow = 0, ///<未知
  31. AMapLocationRegionStateInside = 1, ///<在范围内
  32. AMapLocationRegionStateOutside = 2, ///<在范围外
  33. };
  34. ///逆地理信息
  35. @interface AMapLocationReGeocode : NSObject<NSCopying,NSCoding>
  36. ///格式化地址
  37. @property (nonatomic, copy) NSString *formattedAddress;
  38. ///国家
  39. @property (nonatomic, copy) NSString *country;
  40. ///省/直辖市
  41. @property (nonatomic, copy) NSString *province;
  42. ///市
  43. @property (nonatomic, copy) NSString *city;
  44. ///区
  45. @property (nonatomic, copy) NSString *district;
  46. ///乡镇
  47. @property (nonatomic, copy) NSString *township __attribute((deprecated("该字段从v2.2.0版本起不再返回数据,建议您使用AMapSearchKit的逆地理功能获取.")));
  48. ///社区
  49. @property (nonatomic, copy) NSString *neighborhood __attribute((deprecated("该字段从v2.2.0版本起不再返回数据,建议您使用AMapSearchKit的逆地理功能获取.")));
  50. ///建筑
  51. @property (nonatomic, copy) NSString *building __attribute((deprecated("该字段从v2.2.0版本起不再返回数据,建议您使用AMapSearchKit的逆地理功能获取.")));
  52. ///城市编码
  53. @property (nonatomic, copy) NSString *citycode;
  54. ///区域编码
  55. @property (nonatomic, copy) NSString *adcode;
  56. ///街道名称
  57. @property (nonatomic, copy) NSString *street;
  58. ///门牌号
  59. @property (nonatomic, copy) NSString *number;
  60. ///兴趣点名称
  61. @property (nonatomic, copy) NSString *POIName;
  62. ///所属兴趣点名称
  63. @property (nonatomic, copy) NSString *AOIName;
  64. @end
  65. #pragma mark - AMapLocationPoint
  66. ///经纬度坐标点对象
  67. @interface AMapLocationPoint : NSObject<NSCopying,NSCoding>
  68. ///纬度
  69. @property (nonatomic, assign) CGFloat latitude;
  70. ///经度
  71. @property (nonatomic, assign) CGFloat longitude;
  72. /**
  73. * @brief AMapNaviPoint类对象的初始化函数
  74. * @param lat 纬度
  75. * @param lon 经度
  76. * @return AMapNaviPoint类对象id
  77. */
  78. + (AMapLocationPoint *)locationWithLatitude:(CGFloat)lat longitude:(CGFloat)lon;
  79. @end
  80. ///POI信息
  81. @interface AMapLocationPOIItem : NSObject <NSCopying, NSCoding>
  82. ///id
  83. @property (nonatomic, copy) NSString *pId;
  84. ///名称
  85. @property (nonatomic, copy) NSString *name;
  86. ///类型
  87. @property (nonatomic, copy) NSString *type;
  88. ///类型编码
  89. @property (nonatomic, copy) NSString *typeCode;
  90. ///地址信息
  91. @property (nonatomic, copy) NSString *address;
  92. ///经纬度
  93. @property (nonatomic, strong) AMapLocationPoint *location;
  94. ///电话号码
  95. @property (nonatomic, copy) NSString *tel;
  96. ///省份
  97. @property (nonatomic, copy) NSString *province;
  98. ///城市
  99. @property (nonatomic, copy) NSString *city;
  100. ///区
  101. @property (nonatomic, copy) NSString *district;
  102. @end
  103. ///行政区域信息
  104. @interface AMapLocationDistrictItem : NSObject <NSCopying, NSCoding>
  105. ///城市编码
  106. @property (nonatomic, copy) NSString *cityCode;
  107. ///区域编码
  108. @property (nonatomic, copy) NSString *districtCode;
  109. ///区名
  110. @property (nonatomic, copy) NSString *district;
  111. ///行政区域轮廓坐标点,每个行政区可能有多个模块,每个模块的坐标点数组由AMapLocationPoint构成
  112. @property (nonatomic, copy) NSArray <NSArray<AMapLocationPoint *> *> *polylinePoints;
  113. @end
  114. ///AMapLocation CoordinateType
  115. typedef NS_ENUM(NSUInteger, AMapLocationCoordinateType)
  116. {
  117. AMapLocationCoordinateTypeBaidu = 0, ///<Baidu
  118. AMapLocationCoordinateTypeMapBar, ///<MapBar
  119. AMapLocationCoordinateTypeMapABC, ///<MapABC
  120. AMapLocationCoordinateTypeSoSoMap, ///<SoSoMap
  121. AMapLocationCoordinateTypeAliYun, ///<AliYun
  122. AMapLocationCoordinateTypeGoogle, ///<Google
  123. AMapLocationCoordinateTypeGPS, ///<GPS
  124. };
  125. /**
  126. * @brief 转换目标经纬度为高德坐标系
  127. * @param coordinate 待转换的经纬度
  128. * @param type 坐标系类型
  129. * @return 高德坐标系经纬度
  130. */
  131. FOUNDATION_EXTERN CLLocationCoordinate2D AMapLocationCoordinateConvert(CLLocationCoordinate2D coordinate, AMapLocationCoordinateType type);
  132. /**
  133. * @brief 判断目标经纬度是否在大陆以及港、澳地区。输入参数为高德坐标系。
  134. * @param coordinate 待判断的目标经纬度
  135. * @return 是否在大陆以及港、澳地区
  136. */
  137. FOUNDATION_EXTERN BOOL AMapLocationDataAvailableForCoordinate(CLLocationCoordinate2D coordinate);