1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- import { SGraphyItem } from '@sybotan-web/graphy';
- import { SRect } from "@sybotan-web/base";
- import { SColor } from "@sybotan-web/draw";
- /**
- * 墙Item类
- *
- */
- var SGraphyWallItem = /** @class */ (function (_super) {
- __extends(SGraphyWallItem, _super);
- /**
- * 构造函数
- *
- * @param pointArr 点坐标list
- * @param isVirtual 墙类型(实体墙-虚拟墙)
- * @param color 墙的颜色
- * @param fillColor 墙的填充颜色
- * @param width 墙的宽度
- * @param parent
- */
- function SGraphyWallItem(parent, pointArr, isVirtual, fillColor, color, width) {
- if (isVirtual === void 0) { isVirtual = false; }
- if (fillColor === void 0) { fillColor = SColor.White; }
- if (color === void 0) { color = SColor.Black; }
- if (width === void 0) { width = 1; }
- var _this = _super.call(this, parent) || this;
- _this.isVirtual = false;
- _this.fillColor = SColor.White;
- _this.color = SColor.Black;
- _this.width = 1;
- _this.isVirtual = isVirtual;
- _this.pointArr = pointArr;
- _this.color = color;
- _this.fillColor = fillColor;
- _this.width = width;
- return _this;
- } // Constructor()
- /**
- * Item对象边界区域
- *
- * @return SRect
- */
- SGraphyWallItem.prototype.boundingRect = function () {
- var minX = this.pointArr[0].x;
- var maxX = minX;
- var minY = this.pointArr[0].y;
- var maxY = minY;
- for (var i = 1; i < this.pointArr.length; i++) {
- if (this.pointArr[i].x < minX) {
- minX = this.pointArr[i].x;
- }
- if (this.pointArr[i].y < minY) {
- minY = this.pointArr[i].y;
- }
- if (this.pointArr[i].x > maxX) {
- maxX = this.pointArr[i].x;
- }
- if (this.pointArr[i].y > maxY) {
- maxY = this.pointArr[i].y;
- }
- }
- return new SRect(minX, minY, maxX - minX, maxY - minY);
- }; // Function boundingRect()
- /**
- * Item绘制操作
- *
- * @param painter painter对象
- * @param rect 绘制区域
- */
- SGraphyWallItem.prototype.onDraw = function (painter, rect) {
- if (this.pointArr.length) {
- // painter.pen = new SPen(this.color, this.width);
- painter.pen.color = this.color;
- painter.brush.color = this.fillColor;
- painter.drawPolyline(this.pointArr);
- }
- };
- return SGraphyWallItem;
- }(SGraphyItem)); // Class SGraphyPolygonItem
- export default SGraphyWallItem;
|