Răsfoiți Sursa

支持新的高度表示

wd 7 ani în urmă
părinte
comite
cba299803c
2 a modificat fișierele cu 30 adăugiri și 10 ștergeri
  1. 5 3
      Common.js
  2. 25 7
      index.js

+ 5 - 3
Common.js

@@ -19,12 +19,14 @@ Global.amapStrokeColor = "#58A8F5";
 Global.amapFillColor = "#58A8F511";
 
 Global.heightStandards = new Map([
-    ["标高", 0],
-    ["真高", 1]
+    ["米/标高", 0],
+    ["米/真高", 1],
+    ["米(含以内)/标高", 2],
+    ["米(含以内)/真高", 3]
 ]);
 Global.heightStandardsById = new Map();
 for (let [k, v] of Global.heightStandards) {
     Global.heightStandardsById.set(v, k);
 }
 
-module.exports = Global;
+module.exports = Global;

+ 25 - 7
index.js

@@ -586,10 +586,28 @@ function getHeight(num, unit, type) {
         heightStandard = unit
     }
 
+    // 这里统一使用数字判断
+    let standardUnit = Global.heightStandards.get(heightStandard)
+    let heightDesc
+    switch(standardUnit) {
+        case 1:
+            heightDesc = ['H*真', '真高*米']
+            break;
+        case 2:
+            heightDesc = ['H*标(含以下)', '标高*米(含以下)']
+            break;
+        case 3:
+            heightDesc = ['H*真(含以下)', '标高*米(含以下)']
+            break;
+        default:
+            heightDesc = ['H*标', '标高*米']
+    }
     if(shortNum && (type == 1 || type == 2)) {
-        return `H${shortNum}` + heightStandard.slice(0, 1)
+        // H02真,H02真(含以下)
+        return heightDesc[0].replace('*', shortNum)
     } else {
-        return `${heightStandard}${num}米`
+        // 真高200米,真高200米(含以下)
+        return heightDesc[1].replace('*', num)
     }
 }
 
@@ -618,7 +636,7 @@ export function circleContent(airspaceInfo, type=3) {
         if (airspaceInfo.note)
             content.push(`备注:${airspaceInfo.note}`)
 
-        let result = content = content.join(', ');
+        let result = content = content.join('');
         return result;
     } else {
         let content = []
@@ -630,7 +648,7 @@ export function circleContent(airspaceInfo, type=3) {
         content.push(getHeight(airspaceInfo.height, airspaceInfo.heightStandard, type))
         if (airspaceInfo.note)
             content.push(`备注:${airspaceInfo.note}`)
-        content = content.join(', ');
+        content = content.join('');
         return content;
     }
 }
@@ -693,7 +711,7 @@ export function lineContent(airspaceInfo, type=3) {
         }
 
         if(isSafeString(airspaceInfo.note)) {
-            content.push(`, 备注: ${airspaceInfo.note}`)
+            content.push(`备注: ${airspaceInfo.note}`)
         }
 
         let result = content.join("")
@@ -734,7 +752,7 @@ export function lineContent(airspaceInfo, type=3) {
         }
 
         if (airspaceInfo.note)
-            content.push(`, 备注:${airspaceInfo.note}`)
+            content.push(`备注:${airspaceInfo.note}`)
         content = content.join('');
         return content;
     }
@@ -758,7 +776,7 @@ export function polygonContent(airspaceInfo, type=3) {
         content.push(`${airspaceInfo.points.length}点连线范围内`)
         content.push(`, ${getHeight(airspaceInfo.altitude, airspaceInfo.unit, type)}`)
         if(isSafeString(airspaceInfo.note)) {
-            content.push(`, 备注:${airspaceInfo.note}`)
+            content.push(`备注:${airspaceInfo.note}`)
         }
 
         return content.join('');