"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SWallItem = void 0; const lib_1 = require("@persagy-web/draw/lib"); const __1 = require("../.."); const __2 = require("../.."); const lib_2 = require("@persagy-web/graph/lib"); class SWallItem extends lib_2.SGraphItem { constructor(parent, data) { super(parent); this.minX = Number.MAX_SAFE_INTEGER; this.maxX = Number.MIN_SAFE_INTEGER; this.minY = Number.MAX_SAFE_INTEGER; this.maxY = Number.MIN_SAFE_INTEGER; this.pointArr = []; this.holesArr = []; this.path = new lib_1.SPath2D(); this.data = data; this.zOrder = __1.ItemOrder.wallOrder; let tempArr = this.data.OutLine; let holes = data.Holes; if (tempArr && tempArr.length) { this.minX = tempArr[0][0].X; this.maxX = this.minX; this.minY = -tempArr[0][0].Y; this.maxY = this.minY; this.pointArr = []; let WLine = tempArr[0].map((it) => { let x = it.X, y = -it.Y; if (x < this.minX) { this.minX = x; } if (y < this.minY) { this.minY = y; } if (x > this.maxX) { this.maxX = x; } if (y > this.maxY) { this.maxY = y; } return new lib_1.SPoint(x, y); }); this.path.polygon(WLine); this.pointArr.push(WLine); if (holes && holes.length) { this.holesArr = holes.map(t => { let temp = t.map((it) => { let x = it.X, y = -it.Y; if (x < this.minX) { this.minX = x; } if (y < this.minY) { this.minY = y; } if (x > this.maxX) { this.maxX = x; } if (y > this.maxY) { this.maxY = y; } return new lib_1.SPoint(x, y); }); this.path.polygon(temp); return temp; }); } } } boundingRect() { return new lib_1.SRect(this.minX, this.minY, this.maxX - this.minX, this.maxY - this.minY); } onDraw(painter) { painter.pen.color = __2.ItemColor.wallColor; painter.pen.lineWidth = painter.toPx(1); painter.brush.color = __2.ItemColor.wallColor; painter.drawPath(this.path); } } exports.SWallItem = SWallItem;