|
@@ -0,0 +1,97 @@
|
|
|
+/*
|
|
|
+ * ********************************************************************************************************************
|
|
|
+ *
|
|
|
+ * :*$@@%$*: ;: ;; ;;
|
|
|
+ * :@@%! :!@@%: %! ;%%@@%$ =@@@@@@@%; @%@@@%%%%@@@@@
|
|
|
+ * :@%; :$= %%$$$%$$ ;$$ ;$@= !@$
|
|
|
+ * =@! %! @ $=;% !@@@%: !$$$$$$$$$$$$$$=
|
|
|
+ * =@* %! @ $= % %@= =%@! %=
|
|
|
+ * *$%%! @@= ;=$%%%$*: %! @ $= % =%%%%%%@$ *%: =%
|
|
|
+ * %@@!: !@@@%=$@@@@%! :*@@$: %! @ $= % $* ;@ @* :%*
|
|
|
+ * ;@@! ;!!!;: ;@%: =======@%========* @ $$ % $%*****$@ :@$=*********=@$
|
|
|
+ * $@* ;@@@%=!: *@*
|
|
|
+ * =@$ ;;;!=%@@@@=! =@!
|
|
|
+ * %@$: =@%: :*@@@* %@= Copyright (c) 2016-2019. 北京上格云技术有限公司
|
|
|
+ * ;%@@$=$@@%* *@@@$=%@@%;
|
|
|
+ * ::;:: ::;:: All rights reserved.
|
|
|
+ *
|
|
|
+ * ********************************************************************************************************************
|
|
|
+ */
|
|
|
+
|
|
|
+import { SPainter, SPath2D, SPoint, SColor } from "@saga-web/draw/lib";
|
|
|
+import { Zone } from "../../types/floor/Zone";
|
|
|
+import { ItemColor, ItemOrder } from "../..";
|
|
|
+import { SGraphItem } from "@saga-web/graph/lib";
|
|
|
+
|
|
|
+/**
|
|
|
+ * 业务空间item
|
|
|
+ *
|
|
|
+ * @author 郝建龙
|
|
|
+ */
|
|
|
+export class SBoardItem extends SGraphItem {
|
|
|
+ /** 空间所有数据 */
|
|
|
+ data: Zone;
|
|
|
+ /** 空间轮廓线坐标list */
|
|
|
+ readonly pointArr: SPoint[][][] = [];
|
|
|
+ /** path */
|
|
|
+ private pathList: SPath2D[] = [];
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 构造函数
|
|
|
+ *
|
|
|
+ * @param parent 指向父对象
|
|
|
+ * @param data 空间数据
|
|
|
+ */
|
|
|
+ constructor(parent: SGraphItem | null, data: Zone) {
|
|
|
+ super(parent);
|
|
|
+ this.data = data;
|
|
|
+ this.zOrder = ItemOrder.zoneOrder;
|
|
|
+ if (
|
|
|
+ this.data.OutLine.length &&
|
|
|
+ this.data.OutLine[0] &&
|
|
|
+ this.data.OutLine[0].length
|
|
|
+ ) {
|
|
|
+ let tempArr = this.data.OutLine;
|
|
|
+ this.pointArr = tempArr.map((t): SPoint[][] => {
|
|
|
+ let sPath = new SPath2D();
|
|
|
+ let tempArr = t.map((it): SPoint[] => {
|
|
|
+ let array = it.map(
|
|
|
+ (item): SPoint => {
|
|
|
+ let x = item.X,
|
|
|
+ y = -item.Y;
|
|
|
+ return new SPoint(x, y);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ sPath.polygon(array);
|
|
|
+ return array;
|
|
|
+ });
|
|
|
+ this.pathList.push(sPath);
|
|
|
+ return tempArr;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } // Constructor
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 判断点是否在区域内
|
|
|
+ *
|
|
|
+ * @param x
|
|
|
+ * @param y
|
|
|
+ */
|
|
|
+ contains(x: number, y: number): boolean {
|
|
|
+ return false;
|
|
|
+ } // Function contains()
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Item绘制操作
|
|
|
+ *
|
|
|
+ * @param painter painter对象
|
|
|
+ */
|
|
|
+ onDraw(painter: SPainter): void {
|
|
|
+ painter.pen.lineWidth = painter.toPx(1);
|
|
|
+ painter.brush.color = ItemColor.spaceColor;
|
|
|
+ painter.pen.color = ItemColor.spaceBorderColor;
|
|
|
+ this.pathList.forEach((t): void => {
|
|
|
+ painter.drawPath(t);
|
|
|
+ });
|
|
|
+ } // Function onDraw()
|
|
|
+} // Class SBoardItem
|