|
@@ -2,7 +2,9 @@ import { createSelector } from 'reselect';
|
|
|
import Global from './Common';
|
|
import Global from './Common';
|
|
|
import {
|
|
import {
|
|
|
latLngDegreesToDecimal,
|
|
latLngDegreesToDecimal,
|
|
|
- isObject
|
|
|
|
|
|
|
+ latLngDecimalToDegrees,
|
|
|
|
|
+ isObject,
|
|
|
|
|
+ isSafeString
|
|
|
} from './Utils'
|
|
} from './Utils'
|
|
|
let LatLon = require('geodesy').LatLonSpherical;
|
|
let LatLon = require('geodesy').LatLonSpherical;
|
|
|
|
|
|
|
@@ -451,3 +453,139 @@ export function getShapes(airspaceInfos, style, currentAirspaceIndex) {
|
|
|
regionPoints: regionPoints(airspaceInfos)
|
|
regionPoints: regionPoints(airspaceInfos)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+export function circleContent(airspaceInfo) {
|
|
|
|
|
+ if(airspaceInfo.airspace_name) {
|
|
|
|
|
+ const lat = latLngDecimalToDegrees(airspaceInfo.center_point_of_flying.lat);
|
|
|
|
|
+ const lng = latLngDecimalToDegrees(airspaceInfo.center_point_of_flying.lng);
|
|
|
|
|
+ let content = [];
|
|
|
|
|
+ content.push(`以${airspaceInfo.center_loc}(E${lng}, N${lat})为中心`);
|
|
|
|
|
+ content.push(`半径${airspaceInfo.radius_of_flying}米`);
|
|
|
|
|
+ content.push(`${Global.heightStandardsById.get(airspaceInfo.unit)}${airspaceInfo.altitude}米`)
|
|
|
|
|
+ if (airspaceInfo.note)
|
|
|
|
|
+ content.push(`备注:${airspaceInfo.note}`)
|
|
|
|
|
+
|
|
|
|
|
+ let result = content = content.join(', ');
|
|
|
|
|
+ return result;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ let content = []
|
|
|
|
|
+ content.push(`以${airspaceInfo.addr}(E${airspaceInfo.lng}, N${airspaceInfo.lat})为中心`);
|
|
|
|
|
+ content.push(`半径${airspaceInfo.radius}米`);
|
|
|
|
|
+ content.push(`${airspaceInfo.heightStandard}${airspaceInfo.height}米`);
|
|
|
|
|
+ if (airspaceInfo.note)
|
|
|
|
|
+ content.push(`备注:${airspaceInfo.note}`)
|
|
|
|
|
+ content = content.join(', ');
|
|
|
|
|
+ return content;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function flyingCenter(item = {}){
|
|
|
|
|
+ if(item == {}){
|
|
|
|
|
+ return ;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return (
|
|
|
|
|
+ "(E" + latLngDecimalToDegrees(item.lng) +
|
|
|
|
|
+ ', ' +
|
|
|
|
|
+ "N" + latLngDecimalToDegrees(item.lat) + ")"
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+export function lineContent(airspaceInfo) {
|
|
|
|
|
+
|
|
|
|
|
+ if(airspaceInfo.airspace_name) {
|
|
|
|
|
+ let content = [];
|
|
|
|
|
+ content.push(`${airspaceInfo.start_loc}${flyingCenter(airspaceInfo.start_point)} - ${Global.heightStandardsById.get(airspaceInfo.start_point.unit)}${airspaceInfo.start_point.altitude}米`)
|
|
|
|
|
+
|
|
|
|
|
+ const passing_points = airspaceInfo.passing_points;
|
|
|
|
|
+
|
|
|
|
|
+ if(Array.isArray(passing_points)) {
|
|
|
|
|
+ for(let i = 0; i < passing_points.length; i++) {
|
|
|
|
|
+ const obj = passing_points[i];
|
|
|
|
|
+ const lat = latLngDecimalToDegrees(obj.lat)
|
|
|
|
|
+ const lng = latLngDecimalToDegrees(obj.lng)
|
|
|
|
|
+ if (obj.point_type == Global.pointTypes.point) {
|
|
|
|
|
+ content.push(` - ${obj.point_name ? obj.point_name : ''}(E${lng}, N${lat})`)
|
|
|
|
|
+ } else if (obj.point_type == Global.pointTypes.nav) {
|
|
|
|
|
+ content.push(` - ${obj.point_code}(E${lng}, N${lat})`)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ content.push(` - ${obj.air_route_code}`)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(obj.altitude) {
|
|
|
|
|
+ content.push(` - ${Global.heightStandardsById.get(obj.unit)}${obj.altitude}米`)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ content.push(` - ${airspaceInfo.end_loc}${flyingCenter(airspaceInfo.start_point)}`)
|
|
|
|
|
+ if(isSafeString(airspaceInfo.note)) {
|
|
|
|
|
+ content.push(`, 备注: ${airspaceInfo.note}`)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ let result = content.join("")
|
|
|
|
|
+ return result;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ let content = [];
|
|
|
|
|
+ content.push(`${airspaceInfo.dep.addr}(E${airspaceInfo.dep.lng}, N${airspaceInfo.dep.lat}) - ${airspaceInfo.dep.heightStandard}${airspaceInfo.dep.height}米`);
|
|
|
|
|
+ if (Array.isArray(airspaceInfo.passPoints)) {
|
|
|
|
|
+ let length = airspaceInfo.passPoints.length;
|
|
|
|
|
+ for (let i = 0; i < length; i++) {
|
|
|
|
|
+ let obj = airspaceInfo.passPoints[i];
|
|
|
|
|
+ if (obj.pointType == Global.pointTypes.point) {
|
|
|
|
|
+ content.push(` - ${obj.addr}(E${obj.lng}, N${obj.lat})`);
|
|
|
|
|
+ } else if (obj.pointType == Global.pointTypes.nav) {
|
|
|
|
|
+ content.push(` - ${obj.pointCode}(E${obj.lng}, N${obj.lat})`);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ content.push(` - ${obj.airlineCode}`);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(obj.height) {
|
|
|
|
|
+ content.push(` - ${obj.heightStandard}${obj.height}米`)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ content.push(` - ${airspaceInfo.arrive.addr}(E${airspaceInfo.arrive.lng}, N${airspaceInfo.arrive.lat})`);
|
|
|
|
|
+ if (airspaceInfo.note)
|
|
|
|
|
+ content.push(`, 备注:${airspaceInfo.note}`)
|
|
|
|
|
+ content = content.join('');
|
|
|
|
|
+ return content;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function passingPoints(points = []){
|
|
|
|
|
+ let content = [];
|
|
|
|
|
+ for (let i = 0; i < points.length; i++) {
|
|
|
|
|
+ if(points[i].addr) {
|
|
|
|
|
+ content.push(`${points[i].addr}(E${latLngDecimalToDegrees(points[i].lng)}, N${latLngDecimalToDegrees(points[i].lat)})`);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ content.push(`(E${latLngDecimalToDegrees(points[i].lng)}, N${latLngDecimalToDegrees(points[i].lat)})`);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ let result = content.join('、');
|
|
|
|
|
+ return result;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+export function polygonContent(airspaceInfo) {
|
|
|
|
|
+ if(airspaceInfo.airspace_name) {
|
|
|
|
|
+ let result = passingPoints(airspaceInfo.points);
|
|
|
|
|
+ result += `${airspaceInfo.points.length}点连线范围内, ${Global.heightStandardsById.get(airspaceInfo.unit)}${airspaceInfo.altitude}米`
|
|
|
|
|
+ if(isSafeString(airspaceInfo.note)) {
|
|
|
|
|
+ result += `, 备注:${airspaceInfo.note}`
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return result;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ let content = [];
|
|
|
|
|
+ let length = airspaceInfo.polygonPoints.length;
|
|
|
|
|
+ for (let i = 0; i < length; i++) {
|
|
|
|
|
+ let obj = airspaceInfo.polygonPoints[i];
|
|
|
|
|
+ content.push(`${obj.addr? obj.addr: ""}(E${obj.lng}, N${obj.lat})`);
|
|
|
|
|
+ }
|
|
|
|
|
+ content = content.join('、') + `${length}点连线范围内,${airspaceInfo.heightStandard}${airspaceInfo.height}米`
|
|
|
|
|
+ if (airspaceInfo.note)
|
|
|
|
|
+ content = `${content},备注:${airspaceInfo.note}`
|
|
|
|
|
+ return content;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|