|
@@ -6,6 +6,7 @@ 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";
|
|
|
+import { Door } from "@saga-web/big/lib/types/floor/Door";
|
|
|
|
|
|
/**
|
|
|
* 蜂鸟数据解析器
|
|
@@ -107,15 +108,17 @@ export class SFengParser extends SParser {
|
|
|
/** 蜂鸟:底图应用名称 */
|
|
|
appName: string = "";
|
|
|
/** 当前蜂鸟map的id */
|
|
|
- mapId: string = "";
|
|
|
+ mapId: string = "1000423_";
|
|
|
/** 蜂鸟map绑定dom的id */
|
|
|
domId: string = "";
|
|
|
/** 蜂鸟:底图应用秘钥 */
|
|
|
key: string = "";
|
|
|
/** 底图服务器地址 */
|
|
|
serverUrl: string = "./data/";
|
|
|
+ /** 底图主题 */
|
|
|
+ mapThemeURL: string = "./";
|
|
|
/** 蜂鸟图 */
|
|
|
- private readonly fmap: fengmap.FMMap;
|
|
|
+ private fmap: fengmap.FMMap;
|
|
|
/** 属于空间类型typeid */
|
|
|
spaceType: number[] = [
|
|
|
100000,
|
|
@@ -143,22 +146,6 @@ export class SFengParser extends SParser {
|
|
|
200015,
|
|
|
200016,
|
|
|
200021,
|
|
|
- 170006,
|
|
|
- 170008,
|
|
|
- 170007,
|
|
|
- 170003,
|
|
|
- 170001,
|
|
|
- 100001,
|
|
|
- 100004,
|
|
|
- 100005,
|
|
|
- 100007,
|
|
|
- 140002,
|
|
|
- 170002,
|
|
|
- 150010,
|
|
|
- 100003,
|
|
|
- 140004,
|
|
|
- 170005,
|
|
|
- 120001,
|
|
|
300005,
|
|
|
300006,
|
|
|
300007,
|
|
@@ -202,10 +189,25 @@ export class SFengParser extends SParser {
|
|
|
/** 属于墙类型的typeid */
|
|
|
wallType: number[] = [300000, 300001];
|
|
|
/** 属于虚拟墙类型的typeid */
|
|
|
- virtualWallType: number[] = [
|
|
|
- 200001,
|
|
|
- 110001,
|
|
|
- 200010,
|
|
|
+ virtualWallType: number[] = [200001, 110001, 200010];
|
|
|
+ /** poi类型 */
|
|
|
+ poiList: number[] = [
|
|
|
+ 170006,
|
|
|
+ 170008,
|
|
|
+ 170007,
|
|
|
+ 170003,
|
|
|
+ 170001,
|
|
|
+ 100001,
|
|
|
+ 100004,
|
|
|
+ 100005,
|
|
|
+ 100007,
|
|
|
+ 140002,
|
|
|
+ 170002,
|
|
|
+ 150010,
|
|
|
+ 100003,
|
|
|
+ 140004,
|
|
|
+ 170005,
|
|
|
+ 120001,
|
|
|
120008,
|
|
|
120009,
|
|
|
120010
|
|
@@ -225,19 +227,15 @@ export class SFengParser extends SParser {
|
|
|
mapServerURL: string,
|
|
|
key: string,
|
|
|
appName: string,
|
|
|
- factory: SItemFactory
|
|
|
+ factory: SItemFactory,
|
|
|
+ mapThemeURL: string
|
|
|
) {
|
|
|
super(factory);
|
|
|
this.domId = domId;
|
|
|
this.key = key;
|
|
|
this.serverUrl = mapServerURL;
|
|
|
+ this.mapThemeURL = mapThemeURL;
|
|
|
this.appName = appName;
|
|
|
- this.fmap = new fengmap.FMMap({
|
|
|
- container: document.getElementById(this.domId),
|
|
|
- mapServerURL: this.serverUrl,
|
|
|
- appName: this.appName,
|
|
|
- key: this.key
|
|
|
- });
|
|
|
} // Constructor
|
|
|
|
|
|
/**
|
|
@@ -254,49 +252,56 @@ export class SFengParser extends SParser {
|
|
|
let searchAnalyser = new fengmap.FMSearchAnalyser(this.fmap);
|
|
|
// 创建搜索请求体对象
|
|
|
let searchReq = new fengmap.FMSearchRequest();
|
|
|
+ const maxx = this.fmap.maxX;
|
|
|
+ const maxy = this.fmap.maxY;
|
|
|
searchReq.groupID = groupId;
|
|
|
searchReq.type = "Model";
|
|
|
searchAnalyser.query(searchReq, (result: any) => {
|
|
|
let spaces: Space[] = [],
|
|
|
columns: Column[] = [],
|
|
|
walls: Wall[] = [],
|
|
|
- virtualWall: VirtualWall[] = [];
|
|
|
+ virtualWall: VirtualWall[] = [],
|
|
|
+ doors: Door[] = [];
|
|
|
result = result
|
|
|
.map((t: any) => {
|
|
|
- if (t.target && t.target._data && t.target._data.vertices) {
|
|
|
- let arr = t.target._data.vertices,
|
|
|
- type = t.typeID,
|
|
|
- outline = [];
|
|
|
- for (let i = 0; i < arr.length - 1; i += 2) {
|
|
|
- outline.push({
|
|
|
- X: arr[i] - 12982584.99,
|
|
|
- Y: arr[i + 1] - 4911901.56
|
|
|
- });
|
|
|
- }
|
|
|
- if (this.spaceType.indexOf(type) > -1) {
|
|
|
- spaces.push({
|
|
|
- // @ts-ignore
|
|
|
- OutLine: [outline],
|
|
|
- Name: t.target.name,
|
|
|
- Location: {
|
|
|
+ if (t.target) {
|
|
|
+ if (t.target._data && t.target._data.vertices) {
|
|
|
+ let arr = t.target._data.vertices,
|
|
|
+ type = t.typeID,
|
|
|
+ outline = [];
|
|
|
+ for (let i = 0; i < arr.length - 1; i += 2) {
|
|
|
+ outline.push({
|
|
|
+ X: arr[i] - maxx,
|
|
|
+ Y: arr[i + 1] - maxy
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this.spaceType.indexOf(type) > -1) {
|
|
|
+ spaces.push({
|
|
|
// @ts-ignore
|
|
|
- Points: [this.getAverageVal([outline])]
|
|
|
- },
|
|
|
- Type: t.typeID,
|
|
|
+ OutLine: [outline],
|
|
|
+ Name: t.target.name,
|
|
|
+ Location: {
|
|
|
+ // @ts-ignore
|
|
|
+ Points: [this.getAverageVal([outline])]
|
|
|
+ },
|
|
|
+ Type: t.typeID,
|
|
|
+ // @ts-ignore
|
|
|
+ Tag: SFengParser.typeIdMap[t.typeID],
|
|
|
+ SourceId: t.FID,
|
|
|
+ Height: t.target.height
|
|
|
+ });
|
|
|
+ } else if (this.columnType.indexOf(type) > -1) {
|
|
|
+ // @ts-ignore
|
|
|
+ columns.push({ OutLine: [outline] });
|
|
|
+ } else if (this.wallType.indexOf(type) > -1) {
|
|
|
+ // @ts-ignore
|
|
|
+ walls.push({ OutLine: [outline] });
|
|
|
+ } else if (
|
|
|
+ this.virtualWallType.indexOf(type) > -1
|
|
|
+ ) {
|
|
|
// @ts-ignore
|
|
|
- Tag: SFengParser.typeIdMap[t.typeID],
|
|
|
- SourceId: t.FID,
|
|
|
- Height: t.target.height
|
|
|
- });
|
|
|
- } else if (this.columnType.indexOf(type) > -1) {
|
|
|
- // @ts-ignore
|
|
|
- columns.push({ OutLine: [outline] });
|
|
|
- } else if (this.wallType.indexOf(type) > -1) {
|
|
|
- // @ts-ignore
|
|
|
- walls.push({ OutLine: [outline] });
|
|
|
- } else if (this.virtualWallType.indexOf(type) > -1) {
|
|
|
- // @ts-ignore
|
|
|
- virtualWall.push({ OutLine: [outline] });
|
|
|
+ virtualWall.push({ OutLine: [outline] });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -318,6 +323,14 @@ export class SFengParser extends SParser {
|
|
|
* @param _fn load成功回调
|
|
|
* */
|
|
|
loadMap(mapId: string, _fn: Function): void {
|
|
|
+ this.fmap = new fengmap.FMMap({
|
|
|
+ container: document.getElementById(this.domId),
|
|
|
+ mapServerURL: this.serverUrl,
|
|
|
+ appName: this.appName,
|
|
|
+ key: this.key,
|
|
|
+ mapThemeURL: this.mapThemeURL,
|
|
|
+ defaultThemeName: mapId
|
|
|
+ });
|
|
|
this.fmap.openMapById(mapId, (err: any): void => {
|
|
|
console.log("错误信息", err);
|
|
|
});
|