From 81f92eb9fb83ed5d8ac0b0a5c206315416f10df0 Mon Sep 17 00:00:00 2001
From: suerprisePlus <15810472099@163.com>
Date: 星期四, 04 七月 2024 10:14:06 +0800
Subject: [PATCH] 系统更新

---
 src/assets/js/map/mapConfig.js |  118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 118 insertions(+), 0 deletions(-)

diff --git a/src/assets/js/map/mapConfig.js b/src/assets/js/map/mapConfig.js
index 6f03c8a..435e9df 100644
--- a/src/assets/js/map/mapConfig.js
+++ b/src/assets/js/map/mapConfig.js
@@ -1,6 +1,124 @@
+import * as turf from "@turf/turf";
+import wqJosn from "./json/wq.json";
+const json2md = require("json2md");
 const mapConfig = {
   flyToImageryLayer(res) {
     earthCtrl.userScene.flyTo(res);
+  },
+  setPointToCrical(lon, lat, distance) {
+    var buffered = turf.circle([lon, lat], distance, {
+      units: "kilometers",
+      steps: 10,
+      properties: { foo: "bar" }
+    });
+    const coord = buffered.geometry.coordinates[0];
+    const std = coord.map((item) => {
+      const rs = turf.toMercator(turf.point(item));
+      return rs.geometry.coordinates;
+    });
+    buffered.geometry.coordinates[0] = std;
+    return buffered;
+  },
+  setScanList(response, filed, headers) {
+    const obj = [];
+    for (var i in response) {
+      const item = response[i];
+      const std = [];
+      if (item[filed]) {
+        const count = "count_" + filed;
+        std.push(item[filed]);
+        std.push(item[count]);
+        const obj = wqJosn.features.filter((res) => {
+          if (res.properties.weaponname == item[filed]) {
+            return res;
+          }
+        });
+        if (obj.length > 0) {
+          std.push(obj[0].properties.time);
+        }
+      }
+
+      obj.push(std);
+    }
+    console.log(wqJosn);
+    // if (filed == "weaponname") {
+    //   return "鍙戠幇鐤戜技 " + obj.toString().replaceAll(",", "涓�; ");
+    // }else if(filed==='targettype'){
+    //   return "鍙戠幇 " + obj.toString().replaceAll(",", "涓�; ");
+    // }
+
+    return [
+      {
+        type: "table",
+        val: [headers, obj]
+      }
+    ];
+  },
+  setArrList(list, flag) {
+    var result = [];
+    const item = list.split("{");
+    for (var i in item) {
+      if (item[i]) {
+        if (item[i].indexOf(",") > -1) {
+          result.push({
+            p: item[i].replaceAll('"', "").replaceAll("}", "")
+          });
+        } else {
+          result.push({
+            h6: item[i].replaceAll('"', "")
+          });
+        }
+      }
+    }
+    return result;
+  },
+  setJsonToMd(res) {
+    // const data = {
+    //     "name": "John Doe",
+    //     "age": 30,
+    //     "hobbies": ["reading", "programming"]
+    // }
+    return json2md(res);
+
+    // return json2md([
+    //   { h1: "JSON To Markdown" },
+    //   { blockquote: "A JSON to Markdown converter." },
+    //   {
+    //     img: [
+    //       {
+    //         title: "Some image",
+    //         source: "https://www.bizhigq.com/pc-img/2023-05/g2246.jpg"
+    //       },
+    //       {
+    //         title: "Another image",
+    //         source:
+    //           "https://desk-fd.zol-img.com.cn/t_s960x600c5/g2/M00/0B/08/Cg-4WlUwdDWIZ7zKAAqGM6NxoXkAABuAQPwTs0ACoZL265.jpg"
+    //       },
+    //       {
+    //         title: "Yet another image",
+    //         source:
+    //           "https://pic4.zhimg.com/v2-f72106aeb21976228c3f0dff703cbc35_r.jpg"
+    //       }
+    //     ]
+    //   },
+    //   { h2: "鐗规��" },
+    //   { ul: ["鏄撲簬浣跨敤", "鎮ㄥ彲浠ョ▼搴忓寲鍦扮敓鎴� Markdown 鍐呭", "..."] },
+    //   { h2: "濡備綍璐$尞" },
+    //   { ol: ["鍒涘缓椤圭洰鍒嗘敮", "寮�濮嬩綘鐨勫伐浣�", "鎻愬嚭 pull request"] },
+    //   { h2: "浠g爜鍧�" },
+    //   { p: "涓嬮潰浣犲彲浠ョ湅鍒颁竴涓唬鐮佸潡绀轰緥銆�" },
+    //   {
+    //     code: {
+    //       language: "js",
+    //       content: [
+    //         "function sum (a, b) {",
+    //         "   return a + b",
+    //         "}",
+    //         "sum(1, 2)"
+    //       ]
+    //     }
+    //   }
+    // ]);
   }
 };
 export default mapConfig;

--
Gitblit v1.9.3