"use strict";
|
|
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
Object.defineProperty(exports, "__esModule", {
|
value: true
|
});
|
exports["default"] = void 0;
|
|
var turf = _interopRequireWildcard(require("@turf/turf"));
|
|
var _wq = _interopRequireDefault(require("./json/wq.json"));
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
var json2md = require("json2md");
|
|
var mapConfig = {
|
flyToImageryLayer: function flyToImageryLayer(res) {
|
earthCtrl.userScene.flyTo(res);
|
},
|
getModelMatrix: function getModelMatrix(res) {
|
var headingPitchRoll = new Cesium.HeadingPitchRoll(res.heading, res.pitch, res.roll);
|
var position = Cesium.Cartesian3.fromDegrees(res.longitude, res.latitude, res.altitude);
|
var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(position, headingPitchRoll, Cesium.Ellipsoid.WGS84, Cesium.Transforms.eastNorthUpToFixedFrame, new Cesium.Matrix4());
|
return modelMatrix;
|
},
|
setCartesian3To84: function setCartesian3To84(x, y, z) {
|
var positionCartesian = new Cesium.Cartesian3(x, y, z); // 本地坐标
|
|
var positionWGS84 = Viewer.scene.globe.ellipsoid.cartesianToCartographic(positionCartesian);
|
var longitude = Cesium.Math.toDegrees(positionWGS84.longitude);
|
var latitude = Cesium.Math.toDegrees(positionWGS84.latitude);
|
return [longitude, latitude];
|
},
|
setPointToCrical: function setPointToCrical(lon, lat, distance) {
|
var buffered = turf.circle([lon, lat], distance, {
|
units: "kilometers",
|
steps: 10,
|
properties: {
|
foo: "bar"
|
}
|
});
|
var coord = buffered.geometry.coordinates[0];
|
var std = coord.map(function (item) {
|
var rs = turf.toMercator(turf.point(item));
|
return rs.geometry.coordinates;
|
});
|
buffered.geometry.coordinates[0] = std;
|
return buffered;
|
},
|
setScanList: function setScanList(response, filed, headers) {
|
var obj = [];
|
|
var _loop = function _loop() {
|
var item = response[i];
|
var std = [];
|
|
if (item[filed]) {
|
var count = "count_" + filed;
|
std.push(item[filed]);
|
std.push(item[count]);
|
|
var _obj = _wq["default"].features.filter(function (res) {
|
if (res.properties.weaponname == item[filed]) {
|
return res;
|
}
|
});
|
|
if (_obj.length > 0) {
|
std.push(_obj[0].properties.time);
|
}
|
}
|
|
obj.push(std);
|
};
|
|
for (var i in response) {
|
_loop();
|
}
|
|
console.log(_wq["default"]); // if (filed == "weaponname") {
|
// return "发现疑似 " + obj.toString().replaceAll(",", "个; ");
|
// }else if(filed==='targettype'){
|
// return "发现 " + obj.toString().replaceAll(",", "个; ");
|
// }
|
|
return [{
|
type: "table",
|
val: [headers, obj]
|
}];
|
},
|
setArrList: function setArrList(list, flag) {
|
var result = [];
|
var 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: function 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: "代码块" },
|
// { p: "下面你可以看到一个代码块示例。" },
|
// {
|
// code: {
|
// language: "js",
|
// content: [
|
// "function sum (a, b) {",
|
// " return a + b",
|
// "}",
|
// "sum(1, 2)"
|
// ]
|
// }
|
// }
|
// ]);
|
}
|
};
|
var _default = mapConfig;
|
exports["default"] = _default;
|