haojianlong 5 years ago
parent
commit
8b1eeedd88
2 changed files with 35 additions and 2 deletions
  1. 3 2
      saga-web-fengmap/package.json
  2. 32 0
      saga-web-fengmap/src/parser/SFengParser.ts

+ 3 - 2
saga-web-fengmap/package.json

@@ -1,6 +1,6 @@
 {
     "name": "@saga-web/feng-map",
-    "version": "1.0.10",
+    "version": "1.0.11",
     "description": "上格云Web平面图。",
     "main": "lib/index.js",
     "types": "lib/index.d.js",
@@ -32,6 +32,7 @@
         "typescript": "^3.9.3"
     },
     "dependencies": {
-        "@saga-web/big": "1.0.39"
+        "@saga-web/big": "1.0.39",
+        "axios": "^0.18.0"
     }
 }

+ 32 - 0
saga-web-fengmap/src/parser/SFengParser.ts

@@ -5,6 +5,7 @@ import { Space } from "@saga-web/big/lib/types/floor/Space";
 import { Column } from "@saga-web/big/lib/types/floor/Column";
 import { VirtualWall } from "@saga-web/big/lib/types/floor/VirtualWall";
 import { Wall } from "@saga-web/big/lib/types/floor/Wall";
+import Axios from "axios";
 
 /**
  * 蜂鸟数据解析器
@@ -211,6 +212,12 @@ export class SFengParser extends SParser {
     ];
     /** 当前地图的楼层list */
     gnameToGid = {};
+    /** 当前底图的主题数据   */
+    mapTheme: any;
+    /** 底图版本号   */
+    version: number | null = null;
+    /** 顶楼地址img */
+    frImg: string = "";
 
     /** 构造体 */
     constructor(
@@ -327,6 +334,31 @@ export class SFengParser extends SParser {
     } // Function loadMap()
 
     /**
+     * 加载主题文件
+     *
+     * @param   url     主题文件url
+     * @return  promise promise对象
+     * */
+    loadTheme(url: string): Promise<void> {
+        return new Promise((resolve, reject): void => {
+            Axios({
+                method: "get",
+                url: url
+            })
+                .then((res: any) => {
+                    this.mapTheme = res.data;
+                    let data = res.data.storetheme;
+                    this.frImg = data[data.length - 1].image;
+                    // @ts-ignore
+                    resolve(this.frImg);
+                })
+                .catch((res: any) => {
+                    console.log(res);
+                });
+        });
+    } // Function loadTheme()
+
+    /**
      * 计算平均值
      *
      * @param   Outline 轮廓线束