Browse Source

'依赖包升级'

zhangyu 4 years ago
parent
commit
08f12cc8d0
4 changed files with 62 additions and 9 deletions
  1. 4 4
      package.json
  2. 14 4
      src/lib/SPlanDecorator.ts
  3. 3 1
      src/lib/index.ts
  4. 41 0
      src/lib/style/Style.ts

+ 4 - 4
package.json

@@ -18,11 +18,11 @@
   },
   "dependencies": {
     "@persagy-web/base": "2.2.1",
-    "@persagy-web/big": "2.2.30",
+    "@persagy-web/big": "2.2.33",
     "@persagy-web/draw": "2.2.8",
-    "@persagy-web/graph": "2.2.31",
-    "@persagy-web/big-edit": "2.2.4",
-    "@persagy-web/edit": "2.2.3",
+    "@persagy-web/graph": "2.2.34",
+    "@persagy-web/big-edit": "2.2.5",
+    "@persagy-web/edit": "2.2.4",
     "@types/uuid": "^8.0.0",
     "ant-design-vue": "^1.6.5",
     "axios": "^0.20.0",

+ 14 - 4
src/lib/SPlanDecorator.ts

@@ -23,7 +23,8 @@
  *
  * ****/
 
-import { BigEditFactory, Legend, Marker, Relation, ElementData } from "@persagy-web/big-edit";
+import { SColor, SFont } from "@persagy-web/draw";
+import { SPlanEquipment, Style } from ".";
 
 /**
  * 平面图装饰器
@@ -32,11 +33,20 @@ import { BigEditFactory, Legend, Marker, Relation, ElementData } from "@persagy-
  */
 export class SPlanDecorator {
     /**
-     * 解析拓扑图绘制数据
+     * 设备元素装饰器
      *
-     * @param data    业务空间数据
+     * @param equipItem    设备元素
+     * @param style    样式数据
      */
-    parseData(data: ElementData): void {
+    equipDecorator(equipItem: SPlanEquipment, style: Style): void {
+        // 设置设备字体颜色
+        if (style.color) equipItem.color = new SColor(style.color);
+        // 设置设备字体大小
+        if (style.size) equipItem.font = new SFont("sans-serif", style.size);
+        // 设置图片地址
+        if (style.url) equipItem.url = style.url;
+        // 设置设备公式
+        if (style.formula) equipItem.formula = style.formula;
         
     }
 }

+ 3 - 1
src/lib/index.ts

@@ -1,5 +1,7 @@
 import { SPlanScene } from "./SPlanScene";
 import { SPlanParser } from "./SPlanParser";
 import { SPlanView } from "./SPlanView";
+import { SPlanDecorator } from "./SPlanDecorator";
 import { SPlanEquipment } from "./item/SPlanEquipment";
-export { SPlanParser, SPlanScene, SPlanView, SPlanEquipment };
+import { Style } from "./style/Style";
+export { SPlanParser, SPlanScene, SPlanView, SPlanDecorator, SPlanEquipment, Style };

+ 41 - 0
src/lib/style/Style.ts

@@ -0,0 +1,41 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2016-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+/**
+ * 样式接口
+ *
+ * @author 张宇 <taohuzy@163.com>
+ */
+export interface Style {
+    /** 字体颜色 */
+    color?: string;
+    /** 字体大小 */
+    size?: number;
+    /** 图片地址 */
+    url?: string;
+    /** 规则 */
+    formula?: string;
+}