Pārlūkot izejas kodu

'update_2020.12.15.17:55'

zhangyu 4 gadi atpakaļ
vecāks
revīzija
33d61377ab

+ 4 - 0
src/lib/SPlanDecorator.ts

@@ -51,5 +51,9 @@ export class SPlanDecorator {
         }
         // 设置设备公式
         if (style.formula) equipItem.formula = style.formula;
+        // 设置设备图标宽度
+        if (style.width) equipItem.sWidth = style.width;
+        // 设置设备图标高度
+        if (style.height) equipItem.sHeight = style.height;
     }
 }

+ 2 - 1
src/lib/index.ts

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

+ 8 - 7
src/lib/item/SPlanEquipment.ts

@@ -26,7 +26,7 @@
 
 import { SGraphItem, SAnchorItem } from "@persagy-web/graph/lib";
 import { Legend } from "@persagy-web/big-edit";
-import { ItemOrder } from "@persagy-web/big";
+import { Example } from "../index";
 import { SBaseIconTextEdit, SBaseTextEdit } from "@persagy-web/edit";
 import { svgTobase64, uuid } from "@persagy-web/big-edit/lib/until";
 /**
@@ -36,12 +36,12 @@ import { svgTobase64, uuid } from "@persagy-web/big-edit/lib/until";
  */
 export class SPlanEquipment extends SBaseIconTextEdit {
     /** 设备图例 */
-    private _legendData: Legend | null = null;
+    private _legendData: Example | null = null;
     set legendData(val) {
         this._legendData = val;
         this.initData();
     } // set legendData()
-    get legendData(): Legend | null {
+    get legendData(): Example | null {
         return this._legendData;
     } // get legendData()
 
@@ -61,8 +61,6 @@ export class SPlanEquipment extends SBaseIconTextEdit {
     private _formula: string = "";
     set formula(val) {
         this._formula = val;
-        this.textItemList[0].text = val;
-        this.update();
     } // set formula()
     get formula(): string {
         return this._formula;
@@ -77,10 +75,12 @@ export class SPlanEquipment extends SBaseIconTextEdit {
      * @param parent    指向父对象
      * @param data      数据
      */
-    constructor(parent: SGraphItem | null, data: Legend) {
+    constructor(parent: SGraphItem | null, data: Example) {
         super(parent);
-        this.zOrder =  9800;
+        this.zOrder = 9800;
         this.isTransform = false;
+        this.sWidth = 32;
+        this.sHeight = 32;
         const textItem = new SBaseTextEdit(this, null);
         textItem.text = "";
         textItem.font.size = 12;
@@ -123,6 +123,7 @@ export class SPlanEquipment extends SBaseIconTextEdit {
         }
 
         this.id = this.legendData.id ? this.legendData.id : "";
+        // this.textItemList[0].text = this.legendData.codeName ? this.legendData.codeName : "";
         this.showAnchor = false;
         this.anotherMsg = this.legendData.properties?.anotherMsg ? this.legendData.properties.anotherMsg : "";
         this.x = this.legendData.pos.x;

+ 80 - 0
src/lib/style/Example.ts

@@ -0,0 +1,80 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .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.
+ *
+ * *********************************************************************************************************************
+ */
+
+import { Anchor } from "@persagy-web/big-edit";
+import { Point } from "@persagy-web/edit/lib/type/Point";
+import { Size } from "@persagy-web/big/lib/types/Size";
+import { SPoint } from '@persagy-web/draw/';
+
+/**
+ * 实例接口
+ *
+ * @author 张宇 <taohuzy@163.com>
+ */
+export interface Example {
+    /** 实例id */
+    id: string;
+    /** 实例名称 */
+    name: string;
+    /** 位置 */
+    pos: Point;
+    /** 实例类型 */
+    classCode: string;
+    /** 实例名称 */
+    codeName: string;
+    /** bim坐标字符串 */
+    bimLocation?: string;
+    /** bim坐标对象 */
+    locationJson?: Point;
+    /** 建筑id */
+    buildingId?: string;
+    /** 楼层id */
+    floorId?: string;
+    /** 实例本地编码 */
+    localId?: string;
+    /** 实例本地名称 */
+    localName?: string;
+    /** 图 id */
+    graphId?: string;
+    /** 图例实例 id */
+    nodeId?: string;
+    /** 返回物理世界对象 ID 列表 */
+    attachObjectIds?: any[];
+    /** 对应的图元 ID */
+    graphElementId?: string;
+    /** 缩放 */
+    scale?: Point;
+    /** 旋转 */
+    rolate?: Point;
+    /** 大小 */
+    size?: Size;
+    /** 锚点 List */
+    anchorList?: Anchor[];
+    /** 轮廓线 */
+    outLine?: Point[] | SPoint[];
+    /** 由应用自己定义 */
+    properties?: any;
+}

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

@@ -38,4 +38,8 @@ export interface Style {
     url?: string;
     /** 规则 */
     formula?: string;
+    /** 宽 */
+    width?: number;
+    /** 高 */
+    height?: number;
 }