Procházet zdrojové kódy

解析器 空间接口修改

haojianlong před 4 roky
rodič
revize
1bc110ace0

+ 21 - 0
saga-web-big/src/factories/SItemFactory.ts

@@ -12,6 +12,9 @@ import { SWindowItem } from "../items/floor/SWindowItem";
 import { Casement } from "../types/floor/Casement";
 import { SZoneItem } from "../items/floor/ZoneItem";
 import { Zone } from "../types/floor/Zone";
+import { SImageItem, STextItem } from "..";
+import { ImageData } from "../types/ImageData";
+import { TextData } from "../types/TextData";
 
 /**
  * 拓扑图信息解析器
@@ -94,4 +97,22 @@ export class SItemFactory {
     createZone(data: Zone): SZoneItem {
         return new SZoneItem(null, data);
     } // Function createZone()
+
+    /**
+     * 创建图片item
+     *
+     * @param   data    图片数据
+     * */
+    createImage(data: ImageData): SImageItem {
+        return new SImageItem(null, data);
+    } // Function createImage()
+
+    /**
+     * 创建文本item
+     *
+     * @param   data    文本数据
+     * */
+    createText(data: TextData): STextItem {
+        return new STextItem(null, data);
+    } // Function createImage()
 } // class SItemFactory

+ 2 - 0
saga-web-big/src/types/floor/Space.ts

@@ -43,4 +43,6 @@ export interface Space {
     SourceId: string;
     /** 补充信息    */
     Tag: string;
+    /** 类型  */
+    TypeId: string;
 } // Interface Space

+ 9 - 0
saga-web-fengmap/.editorconfig

@@ -0,0 +1,9 @@
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 4
+end_of_line =lf
+insert_final_newline = true
+trim_trailing_whitespace = true

+ 36 - 0
saga-web-fengmap/.eslintrc.js

@@ -0,0 +1,36 @@
+module.exports = {
+    root: true,
+    parser: "@typescript-eslint/parser",
+    extends: [
+        "plugin:@typescript-eslint/recommended",
+        // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
+        "prettier/@typescript-eslint",
+        // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
+        // 此行必须在最后
+        "plugin:prettier/recommended"
+    ],
+    env: {
+        es6: true,
+        node: true
+    },
+    parserOptions: {
+        // 支持最新 JavaScript
+        ecmaVersion: 2018,
+        sourceType: "module"
+    },
+    rules: {
+        // 注释
+        // 文件
+        "max-classes-per-file": ["error", 1],           // 一个文件中只能定义一个类
+        "max-lines-per-function": ["error", 200],       // 一个函数最多200行代码
+        "max-statements-per-line": ["error", {max: 1}], // 一行只允许有一条语句
+        // 缩进
+        "indent": ["error", 4],                         // 缩进控制4空格
+        "max-len": ["error", 120],                      // 每行字符不超过120
+        "no-mixed-spaces-and-tabs": "error",            // 禁止使用空格和tab混合缩进
+        // 语句
+        "curly": ["error", "multi-line"],               // if、else if、else、for、while强制使用大括号,但允许在单行中省略大括号。
+        "semi": ["error", "always"],                    // 不得省略语句结束的分号
+        "@typescript-eslint/explicit-member-accessibility": ["error", { accessibility: "no-public" }],       // public访问不需加访问修饰符
+    }
+};

+ 12 - 0
saga-web-fengmap/.npmignore

@@ -0,0 +1,12 @@
+# 发布时排除
+__tests__/
+api/
+docs/
+src/
+.editorconfig
+.eslintrc.js
+*.iml
+coverage
+jest.config.js
+tsconfig.json
+typedoc.json

+ 0 - 0
saga-web-fengmap/README.md


+ 12 - 0
saga-web-fengmap/jest.config.js

@@ -0,0 +1,12 @@
+module.exports = {
+    preset: "ts-jest",
+    moduleFileExtensions: ["js", "ts"],
+    transform: {
+        "^.+\\.tsx?$": "ts-jest"
+    },
+    transformIgnorePatterns: ["/node_modules/"],
+    moduleNameMapper: {
+        "^@/(.*)$": "<rootDir>/src/$1"
+    },
+    collectCoverage: true
+};

+ 36 - 0
saga-web-fengmap/package.json

@@ -0,0 +1,36 @@
+{
+    "name": "@saga-web/feng-map",
+    "version": "1.0.4",
+    "description": "上格云Web平面图。",
+    "main": "lib/index.js",
+    "types": "lib/index.d.js",
+    "scripts": {
+        "build": "tsc",
+        "publish": "npm publish",
+        "lint": "eslint src/**/*.{js,ts,tsx}",
+        "test": "jest",
+        "typedoc": "typedoc --hideGenerator src"
+    },
+    "keywords": [
+        "feng-map"
+    ],
+    "author": "郝建龙 (1061851420@qq.com)",
+    "license": "ISC",
+    "publishConfig": {
+        "registry": "http://dev.dp.sagacloud.cn:8082/repository/npm-hosted/"
+    },
+    "devDependencies": {
+        "@typescript-eslint/eslint-plugin": "^1.12.0",
+        "@typescript-eslint/parser": "^1.12.0",
+        "eslint": "^6.0.1",
+        "eslint-config-prettier": "^6.0.0",
+        "eslint-plugin-prettier": "^3.1.0",
+        "prettier": "^1.18.2",
+        "@types/jest": "^24.0.15",
+        "ts-jest": "^24.0.2",
+        "typescript": "^3.5.3"
+    },
+    "dependencies": {
+        "@saga-web/big": "1.0.4"
+    }
+}

+ 3 - 0
saga-web-fengmap/src/index.ts

@@ -0,0 +1,3 @@
+import { SFengParser } from "./parser/SFengParser";
+
+export { SFengParser };

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

@@ -0,0 +1,63 @@
+import { SParser } from "@saga-web/big/lib/parser/SParser";
+
+/**
+ * 蜂鸟数据解析器
+ *
+ */
+
+export class SFengParser extends SParser {
+    /** typeId对应的类型 */
+    static typeIdMap = {
+        100000: "Pavement",
+        200000: "FrontagePavement",
+        900000: "AuxiliarySurface",
+        300000: "SolidWall",
+        300001: "GlassWall",
+        300003: "PartitionWall",
+        300002: "BearingColumn",
+        800000: "ParkingSpace",
+        200004: "StraightLadder",
+        200003: "Escalator",
+        200103: "UplinkOnly",
+        200203: "DownOnly",
+        200005: "Stairs",
+        200002: "Toilet",
+        200001: "EntranceAndExit",
+        200006: "Cashier",
+        200007: "ATM",
+        200017: "AlarmPoint",
+        200018: "DressModification",
+        200019: "JewelryRepair",
+        200020: "Checkroom",
+        200014: "InformationDesk",
+        200009: "PublicPhone",
+        200008: "ServiceCentre",
+        200010: "Exit",
+        200011: "CargoLift",
+        200012: "Lounge",
+        200013: "CarPark",
+        200015: "MotherBabyRoom",
+        200016: "VIP",
+        200021: "WheelchairAccessible",
+        170006: "StraightLadder",
+        170008: "UpEscalator",
+        170007: "DownEscalator",
+        170003: "Escalator",
+        170001: "Stairs",
+        110001: "EntranceAndExit",
+        100001: "Restroom",
+        100004: "MenRestroom",
+        100005: "WomenRestroom",
+        100007: "AccessibleToilet",
+        140002: "ServiceCentre",
+        170002: "CargoLift",
+        150010: "Lounge",
+        100003: "MotherBabyRoom",
+        140004: "VIP",
+        170005: "WheelchairAccessible",
+        120001: "CarPark",
+        120008: "ParkingExit",
+        120009: "ParkingEntrance",
+        120010: "ParkingExitAndEntrance"
+     };
+} // class SEquipParser

+ 16 - 0
saga-web-fengmap/tsconfig.json

@@ -0,0 +1,16 @@
+{
+    "compilerOptions": {
+        "target": "es2015",                         // Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'.
+        "module": "es2015",                         // Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'.
+        "outDir": "./lib",                          // 编译后生成的文件目录
+        "strict": true,                             // 开启严格的类型检测
+        "declaration": true,                        // 生成 `.d.ts` 文件
+        "experimentalDecorators": true,             // 开启装饰器
+        "removeComments": true,                     // 去除注释
+        "noImplicitAny": true,                      // 在表达式和声明上有隐含的 any类型时报错。
+        "esModuleInterop": true,                    // 支持别名导入
+        "moduleResolution": "node"                  // 此处设置为node,才能解析import xx from 'xx'
+    },
+    "include": ["./src"],
+    "exclude": ["node_modules"]
+}

+ 6 - 0
saga-web-fengmap/typedoc.json

@@ -0,0 +1,6 @@
+{
+    "name": "上格云Web基础库",
+    "mode": "file",
+    "out": "doc",
+    "exclude": ["**/*+(index|.test).ts"]
+}