SUnknowItem.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.SUnknowItem = void 0;
  4. const lib_1 = require("@persagy-web/graph/lib");
  5. const lib_2 = require("@persagy-web/draw/lib");
  6. const __1 = require("../..");
  7. const __2 = require("../..");
  8. class SUnknowItem extends lib_1.SGraphItem {
  9. constructor(parent, data) {
  10. super(parent);
  11. this.minX = Number.MAX_SAFE_INTEGER;
  12. this.maxX = Number.MIN_SAFE_INTEGER;
  13. this.minY = Number.MAX_SAFE_INTEGER;
  14. this.maxY = Number.MIN_SAFE_INTEGER;
  15. this.pointArr = [];
  16. this.data = data;
  17. this.zOrder = __1.ItemOrder.columnOrder;
  18. let tempArr = this.data.OutLine;
  19. if (tempArr && tempArr.length) {
  20. this.minX = tempArr[0][0].X;
  21. this.maxX = this.minX;
  22. this.minY = -tempArr[0][0].Y;
  23. this.maxY = this.minY;
  24. this.pointArr = tempArr.map((t) => {
  25. return t.map((it) => {
  26. let x = it.X, y = -it.Y;
  27. if (x < this.minX) {
  28. this.minX = x;
  29. }
  30. if (y < this.minY) {
  31. this.minY = y;
  32. }
  33. if (x > this.maxX) {
  34. this.maxX = x;
  35. }
  36. if (y > this.maxY) {
  37. this.maxY = y;
  38. }
  39. return new lib_2.SPoint(x, y);
  40. });
  41. });
  42. }
  43. }
  44. boundingRect() {
  45. return new lib_2.SRect(this.minX, this.minY, this.maxX - this.minX, this.maxY - this.minY);
  46. }
  47. onDraw(painter) {
  48. painter.pen.color = __2.ItemColor.columnColor;
  49. painter.pen.lineWidth = painter.toPx(1);
  50. painter.brush.color = __2.ItemColor.columnColor;
  51. this.pointArr.forEach((t) => {
  52. painter.drawPolygon(t);
  53. });
  54. }
  55. }
  56. exports.SUnknowItem = SUnknowItem;