index.d.ts 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. import { OutputSelector } from 'reselect';
  2. import { Marker, Circle, Line, Polygon } from 'react-native-amap-kit';
  3. import { latLngDegreesToDecimal, latLngDecimalToDegrees } from './Utils';
  4. export { Marker, Circle, Line, Polygon };
  5. export interface CoordinateShort {
  6. lat: number;
  7. lng: number;
  8. }
  9. export interface CoordinateLong {
  10. latitude: number;
  11. longitude: number;
  12. }
  13. export interface LatLngAddrServer extends CoordinateShort {
  14. addr: string;
  15. }
  16. export interface LatLngPointServer extends LatLngAddrServer {
  17. altitude: number;
  18. unit: 0 | 1 | 2 | 3;
  19. }
  20. export interface StartPointServer extends CoordinateShort {
  21. altitude: number;
  22. unit: 0 | 1 | 2 | 3;
  23. }
  24. export interface AirRoutePoint extends CoordinateShort {
  25. point_id: number;
  26. point_name: string;
  27. point_code: string;
  28. }
  29. export interface PassingPointNavServer extends CoordinateShort {
  30. point_type: 1;
  31. altitude: number;
  32. unit: 0 | 1 | 2 | 3;
  33. point_id: number;
  34. point_code: string;
  35. point_name: string;
  36. }
  37. export interface PassingPointAirlineServer {
  38. point_type: 2;
  39. altitude: number;
  40. unit: 0 | 1 | 2 | 3;
  41. airway?: number;
  42. air_route_code: string;
  43. points: Array<AirRoutePoint>;
  44. }
  45. export interface PassingPointNormalServer extends CoordinateShort {
  46. point_type: 3;
  47. altitude: number;
  48. unit: 0 | 1 | 2 | 3;
  49. point_name: string;
  50. }
  51. export interface AirspaceInfoCircleServer {
  52. airspace_name: string;
  53. airspace_type: 1;
  54. airspace_id: string;
  55. note: string;
  56. center_loc: string;
  57. center_point_of_flying: CoordinateShort;
  58. radius_of_flying: number;
  59. altitude: number;
  60. unit: number;
  61. }
  62. export interface AirspaceInfoLineServer {
  63. airspace_name: string;
  64. airspace_type: 2;
  65. airspace_id: string;
  66. note: string;
  67. start_loc: string;
  68. start_point: StartPointServer;
  69. end_loc: string;
  70. end_point: CoordinateShort;
  71. passing_points: Array<PassingPointServer>;
  72. airline_width?: number;
  73. }
  74. export interface AirspaceInfoPolygonServer {
  75. airspace_name: string;
  76. airspace_type: 3;
  77. airspace_id: string;
  78. note: string;
  79. points: Array<LatLngAddrServer>;
  80. altitude: number;
  81. unit: number;
  82. }
  83. export interface CoordinateShortString {
  84. lat: string;
  85. lng: string;
  86. }
  87. export interface LatLngAddrLocal extends CoordinateShortString {
  88. addr: string;
  89. }
  90. export interface LatLngPointLocal extends LatLngAddrLocal {
  91. height: string;
  92. heightStandard: string;
  93. }
  94. export interface PassingPointNavLocal extends CoordinateShortString {
  95. pointType: 1;
  96. height: string;
  97. heightStandard: string;
  98. pointId: number;
  99. pointCode: string;
  100. pointName: string;
  101. }
  102. export interface PassingPointAirlineLocal {
  103. pointType: 2;
  104. height: string;
  105. heightStandard: string;
  106. airRouteId: number;
  107. airlineCode: string;
  108. airlines: Array<AirRoutePoint>;
  109. }
  110. export interface PassingPointNormalLocal extends CoordinateShortString {
  111. pointType: 3;
  112. height: string;
  113. heightStandard: string;
  114. addr: string;
  115. }
  116. export interface AirspaceInfoCircleLocal {
  117. airspaceType: 1;
  118. airspaceId: string;
  119. name: string;
  120. note: string;
  121. addr: string;
  122. lat: string;
  123. lng: string;
  124. radius: number;
  125. height: string;
  126. heightStandard: string;
  127. }
  128. export interface AirspaceInfoLineLocal {
  129. airspaceType: 2;
  130. airspaceId: string;
  131. name: string;
  132. note: string;
  133. dep: LatLngPointLocal;
  134. arrive: LatLngAddrLocal;
  135. passPoints: Array<PassingPointLocal>;
  136. airlineWidth?: number;
  137. }
  138. export interface AirspaceInfoPolygonLocal {
  139. airspaceType: 3;
  140. airspaceId: string;
  141. name: string;
  142. note: string;
  143. polygonPoints: Array<LatLngAddrLocal>;
  144. height: string;
  145. heightStandard: string;
  146. }
  147. declare type AirspaceInfoCircle = AirspaceInfoCircleLocal | AirspaceInfoCircleServer;
  148. declare type AirspaceInfoLine = AirspaceInfoLineLocal | AirspaceInfoLineServer;
  149. declare type AirspaceInfoPolygon = AirspaceInfoPolygonLocal | AirspaceInfoPolygonServer;
  150. declare type AirspaceInfoLocal = AirspaceInfoCircleLocal | AirspaceInfoLineLocal | AirspaceInfoPolygonLocal;
  151. declare type AirspaceInfoServer = AirspaceInfoCircleServer | AirspaceInfoLineServer | AirspaceInfoPolygonServer;
  152. declare type AirspaceInfo = AirspaceInfoLocal | AirspaceInfoServer;
  153. declare type PassingPointLocal = PassingPointNavLocal | PassingPointNormalLocal | PassingPointAirlineLocal;
  154. declare type PassingPointServer = PassingPointNavServer | PassingPointNormalServer | PassingPointAirlineServer;
  155. export declare type Coordinate = CoordinateLong | CoordinateShort;
  156. export interface CirclesAndMarkers {
  157. circles: Circle[];
  158. markers: Marker[];
  159. }
  160. export interface LinesAndMarkes {
  161. lines: Line[];
  162. markers: Marker[];
  163. }
  164. export interface LinesPolygonsAndMarkers {
  165. polygons: Polygon[];
  166. markers: Marker[];
  167. lines: Line[];
  168. }
  169. export interface PolygonsAndMarkers {
  170. polygons: Polygon[];
  171. markers: Marker[];
  172. }
  173. export interface ShapeStyle {
  174. imageName: string;
  175. lineWidth: number;
  176. strokeColor: string;
  177. fillColor: string;
  178. }
  179. export interface ShapeStyles {
  180. [styleName: string]: ShapeStyle;
  181. }
  182. export declare function convertAirspaceInfoServerToLocal(airspaceInfo: AirspaceInfoCircleServer | AirspaceInfoLineServer | AirspaceInfoPolygonServer): AirspaceInfoCircleLocal | AirspaceInfoLineLocal | AirspaceInfoPolygonLocal | null;
  183. export declare function convertAirspaceInfoLocalToServer(airspace: AirspaceInfoCircleLocal | AirspaceInfoLineLocal | AirspaceInfoPolygonLocal): AirspaceInfoCircleServer | AirspaceInfoLineServer | AirspaceInfoPolygonServer;
  184. export declare type FnSetStyle = (styleName: string) => null | ShapeStyle;
  185. export declare function getShapesSelector(airspaceInfos: () => AirspaceInfo[], style?: ShapeStyles, currentAirspaceIndex?: () => number | undefined): {
  186. markers: OutputSelector<any, Marker[], (res1: any, res2: any, res3: any) => Marker[]>;
  187. circles: OutputSelector<any, Circle[], (res: any) => Circle[]>;
  188. lines: OutputSelector<any, Line[], (res: any) => Line[]>;
  189. polygons: OutputSelector<any, Polygon[], (res1: any, res2: any) => Polygon[]>;
  190. regionPoints: OutputSelector<any, Coordinate[], (res1: any, res2: any, res3: any) => Coordinate[]>;
  191. };
  192. export declare function getShapes(airspaceInfos: AirspaceInfo[], style?: ShapeStyles, currentAirspaceIndex?: number): {
  193. markers: Marker[];
  194. circles: Circle[];
  195. lines: Line[];
  196. polygons: Polygon[];
  197. regionPoints: Coordinate[];
  198. };
  199. export declare function circleContent(airspaceInfo: AirspaceInfoCircle, type?: number): string;
  200. export declare function lineContent(airspaceInfo: AirspaceInfoLine, type?: number): string;
  201. export declare function polygonContent(airspaceInfo: AirspaceInfoPolygon, type?: number): string;
  202. export { latLngDegreesToDecimal, latLngDecimalToDegrees };