|
@@ -1,10 +1,11 @@
|
|
|
import proj4 from "proj4";
|
|
|
import { Notification, MessageBox, Message, Loading } from "element-ui";
|
|
|
-
|
|
|
+import { tansParams, blobValidate } from "@/utils/ruoyi";
|
|
|
const CTservice = axios.create({
|
|
|
// 超时
|
|
|
timeout: 60000,
|
|
|
});
|
|
|
+
|
|
|
// 响应拦截器
|
|
|
CTservice.interceptors.response.use(
|
|
|
(res) => {
|
|
@@ -18,21 +19,22 @@ CTservice.interceptors.response.use(
|
|
|
return res.data;
|
|
|
}
|
|
|
if (code !== 200) {
|
|
|
- Message({
|
|
|
- message: "模型服务获取失败,请检查服务",
|
|
|
- type: "warning",
|
|
|
- });
|
|
|
+ console.log("err:模型服务获取失败,请检查服务!!" + error);
|
|
|
+ // Message({
|
|
|
+ // message: "模型服务获取失败,请检查服务",
|
|
|
+ // type: "warning",
|
|
|
+ // });
|
|
|
return null;
|
|
|
} else {
|
|
|
return res;
|
|
|
}
|
|
|
},
|
|
|
(error) => {
|
|
|
- console.log("err" + error);
|
|
|
- Message({
|
|
|
- message: "模型服务获取失败,请检查服务",
|
|
|
- type: "warning",
|
|
|
- });
|
|
|
+ console.log("err:模型服务获取失败,请检查服务!!" + error);
|
|
|
+ // Message({
|
|
|
+ // message: "模型服务获取失败,请检查服务",
|
|
|
+ // type: "warning",
|
|
|
+ // });
|
|
|
return null;
|
|
|
}
|
|
|
);
|
|
@@ -66,6 +68,42 @@ export const mapanalyze = async (url, params) => {
|
|
|
return null;
|
|
|
}
|
|
|
};
|
|
|
+/**
|
|
|
+ * 获取面积
|
|
|
+ * @param {Array} points [
|
|
|
+ { x: 109.513901747847, y: 18.3138227456355 },
|
|
|
+ { x: 109.513756340215, y: 18.313823538585 },
|
|
|
+ { x: 109.513301924234, y: 18.3138260150956 },
|
|
|
+ { x: 109.513159896168, y: 18.313962267038 },
|
|
|
+ { x: 109.513158251941, y: 18.3151722832427 },
|
|
|
+ { x: 109.513299913524, y: 18.3153069903435 },
|
|
|
+ { x: 109.513907590019, y: 18.3153036780715 },
|
|
|
+ { x: 109.513901747847, y: 18.3138227456355 },
|
|
|
+ ]
|
|
|
+ * @returns Number
|
|
|
+ */
|
|
|
+export const mapArea = async (points) => {
|
|
|
+ if (!points) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ let response = await CTservice({
|
|
|
+ url:
|
|
|
+ window.supermapIServerUrl +
|
|
|
+ "/iserver/services/geometry/restjsr/v1/geometry/area",
|
|
|
+ method: "get",
|
|
|
+ params: {
|
|
|
+ point2Ds: JSON.stringify(points),
|
|
|
+ unit: window.unit || "METER",
|
|
|
+ prjCoordSys: "{ epsgcode: " + (window.epsgcode || "4490") + " }",
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ if (response && response.area) {
|
|
|
+ return response.area;
|
|
|
+ } else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
/**
|
|
|
* 墨卡托转经纬度
|