index.d.ts 7.0 KB

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