ColumnItem.ts 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * ********************************************************************************************************************
  3. *
  4. * :*$@@%$*: ;: ;; ;;
  5. * :@@%! :!@@%: %! ;%%@@%$ =@@@@@@@%; @%@@@%%%%@@@@@
  6. * :@%; :$= %%$$$%$$ ;$$ ;$@= !@$
  7. * =@! %! @ $=;% !@@@%: !$$$$$$$$$$$$$$=
  8. * =@* %! @ $= % %@= =%@! %=
  9. * *$%%! @@= ;=$%%%$*: %! @ $= % =%%%%%%@$ *%: =%
  10. * %@@!: !@@@%=$@@@@%! :*@@$: %! @ $= % $* ;@ @* :%*
  11. * ;@@! ;!!!;: ;@%: =======@%========* @ $$ % $%*****$@ :@$=*********=@$
  12. * $@* ;@@@%=!: *@*
  13. * =@$ ;;;!=%@@@@=! =@!
  14. * %@$: =@%: :*@@@* %@= Copyright (c) 2016-2019. 北京上格云技术有限公司
  15. * ;%@@$=$@@%* *@@@$=%@@%;
  16. * ::;:: ::;:: All rights reserved.
  17. *
  18. * ********************************************************************************************************************
  19. */
  20. import { SGraphyItem, SMouseEvent } from "@sybotan-web/graphy/lib";
  21. import { SColor, SPainter, SPoint, SRect } from "@sybotan-web/draw/lib";
  22. import { Column } from "../types/Column";
  23. import { Opt } from "../types/Opt";
  24. /**
  25. * 柱子item
  26. *
  27. * @author 郝建龙
  28. */
  29. export class ColumnItem extends SGraphyItem {
  30. /** 柱子数据 */
  31. data: Column;
  32. /** 柱子轮廓线坐标list */
  33. private readonly pointArr: SPoint[] = [];
  34. /**
  35. * 构造函数
  36. *
  37. * @param parent 指向父对象
  38. * @param data 柱子数据
  39. */
  40. constructor(parent: SGraphyItem | null, data: Column) {
  41. super(parent);
  42. this.data = data;
  43. if (this.data.OutLine.length) {
  44. this.pointArr = this.data.OutLine[0].map(t => {
  45. return new SPoint(t.X, -t.Y);
  46. });
  47. }
  48. } // Constructor
  49. /**
  50. * Item绘制操作
  51. *
  52. * @param painter painter对象
  53. * @param rect 绘制区域
  54. */
  55. onDraw(painter: SPainter, rect?: SRect): void {
  56. if (this.visible) {
  57. painter.pen.color = Opt.columnColor;
  58. painter.pen.lineWidth = 10;
  59. painter.brush.color = Opt.columnColor;
  60. painter.drawPolygon(this.pointArr);
  61. }
  62. } // Function onDraw()
  63. } // Class ColumnItem