|
|
@@ -565,14 +565,56 @@ export function getShapes(airspaceInfos, style, currentAirspaceIndex) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-export function circleContent(airspaceInfo) {
|
|
|
+// 总共 5 种格式, http://git.corp.brilliantaero.com/BA/Coco/issues/99#note_6358
|
|
|
+// 1. 全输出格式
|
|
|
+// 2. 简化格式
|
|
|
+// 3. 传真格式
|
|
|
+// 4. 用户端用的简化格式
|
|
|
+// 5. 极简格式
|
|
|
+
|
|
|
+function getHeight(num, unit, type) {
|
|
|
+ let shortNum
|
|
|
+ if(num >= 100) {
|
|
|
+ shortNum = parseInt(num/100).toString()
|
|
|
+ if(shortNum.length <2) {
|
|
|
+ shortNum = '0' + shortNum
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ let heightStandard = Global.heightStandardsById.get(unit)
|
|
|
+ if(!heightStandard) {
|
|
|
+ heightStandard = unit
|
|
|
+ }
|
|
|
+
|
|
|
+ if(shortNum && (type == 1 || type == 2)) {
|
|
|
+ return `H${shortNum}` + heightStandard.slice(0, 1)
|
|
|
+ } else {
|
|
|
+ return `${heightStandard}${num}米`
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function getAirspaceName(airspaceInfo) {
|
|
|
+ if(airspaceInfo.airspace_name) {
|
|
|
+ return airspaceInfo.airspace_name
|
|
|
+ } else {
|
|
|
+ return airspaceInfo.name
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export function circleContent(airspaceInfo, type=3) {
|
|
|
+ if(type == 5)
|
|
|
+ return getAirspaceName(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})为中心`);
|
|
|
+ let loc = `以${airspaceInfo.center_loc}`
|
|
|
+ if(type == 1 || type == 3)
|
|
|
+ loc += `(E${lng}, N${lat})`;
|
|
|
+ content.push(`${loc}为中心`)
|
|
|
content.push(`半径${airspaceInfo.radius_of_flying}米`);
|
|
|
- content.push(`${Global.heightStandardsById.get(airspaceInfo.unit)}${airspaceInfo.altitude}米`)
|
|
|
+ content.push(getHeight(airspaceInfo.altitude, airspaceInfo.unit, type))
|
|
|
if (airspaceInfo.note)
|
|
|
content.push(`备注:${airspaceInfo.note}`)
|
|
|
|
|
|
@@ -580,9 +622,12 @@ export function circleContent(airspaceInfo) {
|
|
|
return result;
|
|
|
} else {
|
|
|
let content = []
|
|
|
- content.push(`以${airspaceInfo.addr}(E${airspaceInfo.lng}, N${airspaceInfo.lat})为中心`);
|
|
|
+ let loc = `以${airspaceInfo.addr}`
|
|
|
+ if(type == 1 || type == 3)
|
|
|
+ loc += `(E${airspaceInfo.lng}, N${airspaceInfo.lat})`;
|
|
|
+ content.push(`${loc}为中心`)
|
|
|
content.push(`半径${airspaceInfo.radius}米`);
|
|
|
- content.push(`${airspaceInfo.heightStandard}${airspaceInfo.height}米`);
|
|
|
+ content.push(getHeight(airspaceInfo.height, airspaceInfo.heightStandard, type))
|
|
|
if (airspaceInfo.note)
|
|
|
content.push(`备注:${airspaceInfo.note}`)
|
|
|
content = content.join(', ');
|
|
|
@@ -602,11 +647,17 @@ function flyingCenter(item = {}){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-export function lineContent(airspaceInfo) {
|
|
|
+export function lineContent(airspaceInfo, type=3) {
|
|
|
+ if(type == 5)
|
|
|
+ return getAirspaceName(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}米`)
|
|
|
+ content.push(`${airspaceInfo.start_loc}`)
|
|
|
+ if(type == 1 || type == 3)
|
|
|
+ content.push(`${flyingCenter(airspaceInfo.start_point)}`)
|
|
|
+ content.push(` - `)
|
|
|
+ content.push(getHeight(airspaceInfo.start_point.altitude, airspaceInfo.start_point.unit, type))
|
|
|
|
|
|
const passing_points = airspaceInfo.passing_points;
|
|
|
|
|
|
@@ -616,20 +667,27 @@ export function lineContent(airspaceInfo) {
|
|
|
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})`)
|
|
|
+ content.push(` - ${obj.point_name}`)
|
|
|
+ if(type == 1 || type == 3)
|
|
|
+ content.push(`(E${lng}, N${lat})`)
|
|
|
} else if (obj.point_type == Global.pointTypes.nav) {
|
|
|
- content.push(` - ${obj.point_code}(E${lng}, N${lat})`)
|
|
|
+ content.push(` - ${obj.point_code}`)
|
|
|
+ if(type == 1 || type == 3)
|
|
|
+ content.push(`(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(` - ${getHeight(obj.altitude, obj.unit, type)}`)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- content.push(` - ${airspaceInfo.end_loc}${flyingCenter(airspaceInfo.start_point)}`)
|
|
|
+ content.push(` - ${airspaceInfo.end_loc}`)
|
|
|
+ if(type == 1 || type == 3)
|
|
|
+ content.push(`${flyingCenter(airspaceInfo.start_point)}`)
|
|
|
+
|
|
|
if(isSafeString(airspaceInfo.airline_width)) {
|
|
|
content.push(`,宽度:${airspaceInfo.airline_width}米`)
|
|
|
}
|
|
|
@@ -642,25 +700,35 @@ export function lineContent(airspaceInfo) {
|
|
|
return result;
|
|
|
} else {
|
|
|
let content = [];
|
|
|
- content.push(`${airspaceInfo.dep.addr}(E${airspaceInfo.dep.lng}, N${airspaceInfo.dep.lat}) - ${airspaceInfo.dep.heightStandard}${airspaceInfo.dep.height}米`);
|
|
|
+ content.push(`${airspaceInfo.dep.addr}`)
|
|
|
+ if(type == 1 || type == 3)
|
|
|
+ content.push(`(E${airspaceInfo.dep.lng}, N${airspaceInfo.dep.lat})`)
|
|
|
+ content.push(` - ${getHeight(airspaceInfo.dep.height, airspaceInfo.dep.heightStandard, type)}`);
|
|
|
+
|
|
|
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})`);
|
|
|
+ content.push(` - ${obj.addr}`)
|
|
|
+ if(type == 1 || type == 3)
|
|
|
+ content.push(`(E${obj.lng}, N${obj.lat})`);
|
|
|
} else if (obj.pointType == Global.pointTypes.nav) {
|
|
|
- content.push(` - ${obj.pointCode}(E${obj.lng}, N${obj.lat})`);
|
|
|
+ content.push(` - ${obj.pointCode}`)
|
|
|
+ if(type == 1 || type == 3)
|
|
|
+ content.push(`(E${obj.lng}, N${obj.lat})`);
|
|
|
} else {
|
|
|
content.push(` - ${obj.airlineCode}`);
|
|
|
}
|
|
|
|
|
|
if(obj.height) {
|
|
|
- content.push(` - ${obj.heightStandard}${obj.height}米`)
|
|
|
+ content.push(` - ${getHeight(obj.height, obj.heightStandard, type)}`)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- content.push(` - ${airspaceInfo.arrive.addr}(E${airspaceInfo.arrive.lng}, N${airspaceInfo.arrive.lat})`);
|
|
|
+ content.push(` - ${airspaceInfo.arrive.addr}`)
|
|
|
+ if(type == 1 || type == 3)
|
|
|
+ content.push(`(E${airspaceInfo.arrive.lng}, N${airspaceInfo.arrive.lat})`);
|
|
|
if(airspaceInfo.airlineWidth) {
|
|
|
content.push(`,宽度:${airspaceInfo.airlineWidth}米`)
|
|
|
}
|
|
|
@@ -672,35 +740,36 @@ export function lineContent(airspaceInfo) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-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)})`);
|
|
|
- }
|
|
|
- }
|
|
|
+export function polygonContent(airspaceInfo, type=3) {
|
|
|
+ if(type == 5)
|
|
|
+ return getAirspaceName(airspaceInfo)
|
|
|
|
|
|
- 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}米`
|
|
|
+ let res = []
|
|
|
+ let points = airspaceInfo.points
|
|
|
+ for (let i = 0; i < points.length; i++) {
|
|
|
+ let c = `${points[i].addr}`
|
|
|
+ if(type == 1 || type == 3)
|
|
|
+ c += `(E${latLngDecimalToDegrees(points[i].lng)}, N${latLngDecimalToDegrees(points[i].lat)})`;
|
|
|
+ res.push(c)
|
|
|
+ }
|
|
|
+
|
|
|
+ let content = [res.join('、')]
|
|
|
+ content.push(`${airspaceInfo.points.length}点连线范围内`)
|
|
|
+ content.push(`, ${getHeight(airspaceInfo.altitude, airspaceInfo.unit, type)}`)
|
|
|
if(isSafeString(airspaceInfo.note)) {
|
|
|
- result += `, 备注:${airspaceInfo.note}`
|
|
|
+ content.push(`, 备注:${airspaceInfo.note}`)
|
|
|
}
|
|
|
|
|
|
- return result;
|
|
|
+ return content.join('');
|
|
|
} 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})`);
|
|
|
+ let c = `${obj.addr}`
|
|
|
+ c += `(E${obj.lng}, N${obj.lat})`
|
|
|
+ content.push(c)
|
|
|
}
|
|
|
content = content.join('、') + `${length}点连线范围内,${airspaceInfo.heightStandard}${airspaceInfo.height}米`
|
|
|
if (airspaceInfo.note)
|