SLineLegendItem.ts 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. import { SGraphItem } from "@saga-web/graph/lib";
  2. import { SPoint } from "@saga-web/draw/lib";
  3. import { SPolylineItem } from '@saga-web/big/lib';
  4. import { Legend } from '../types/Legend';
  5. /**
  6. * 图例节点Item(线类型)
  7. *
  8. * * @author 张宇(taohuzy@163.com)
  9. */
  10. export class SLineLegendItem extends SPolylineItem {
  11. /** 图例节点对象数据 */
  12. data: Legend;
  13. /** x轴缩放属性 */
  14. // _scaleX: number = 1;
  15. // get scaleX(): number {
  16. // return this._scaleX;
  17. // }
  18. // set scaleX(v: number) {
  19. // this._scaleX = v;
  20. // if (this.data.Scale) {
  21. // this.data.Scale.X = v;
  22. // }
  23. // this.update();
  24. // }
  25. /** y轴缩放属性 */
  26. // _scaleY: number = 1;
  27. // get scaleY(): number {
  28. // return this._scaleY;
  29. // }
  30. // set scaleY(v: number) {
  31. // this._scaleY = v;
  32. // if (this.data.Scale) {
  33. // this.data.Scale.Y = v;
  34. // }
  35. // this.update();
  36. // }
  37. /** y轴旋转属性 */
  38. // _rolate: number = 0;
  39. // get rolate(): number {
  40. // return this._rolate;
  41. // }
  42. // set rolate(v: number) {
  43. // this._rolate = v;
  44. // if (this.data.Rolate) {
  45. // this.data.Rolate.Z = v;
  46. // }
  47. // this.update();
  48. // }
  49. set name(v: string) {
  50. this.data.Name = v;
  51. }
  52. set line(arr: SPoint[]) {
  53. if (this.data.Properties) {
  54. this.data.Properties.Line = arr;
  55. }
  56. }
  57. set x(v: number) {
  58. this.data.Pos.X = v;
  59. }
  60. set y(v: number) {
  61. this.data.Pos.Y = v;
  62. }
  63. set width(v: number) {
  64. if (this.data.Size) {
  65. this.data.Size.Width = v;
  66. }
  67. }
  68. set height(v: number) {
  69. if (this.data.Size) {
  70. this.data.Size.Height = v;
  71. }
  72. }
  73. /**
  74. * 构造函数
  75. *
  76. * @param parent 指向父对象
  77. * @param data 图例节点对象数据
  78. */
  79. constructor(parent: SGraphItem | null, data: Legend) {
  80. super(parent,[]);
  81. this.data = data;
  82. this.id = data.ID;
  83. this.moveTo(data.Pos.X, data.Pos.Y);
  84. // if (data.Scale) {
  85. // this.scaleX = data.Scale.X;
  86. // this.scaleY = data.Scale.Y;
  87. // }
  88. // if (data.Rolate && this.data.Rolate.Z) {
  89. // this.rolate = data.Rolate.Z;
  90. // }
  91. if (data.Size) {
  92. this.width = data.Size.Width;
  93. this.height = data.Size.Height;
  94. }
  95. if (data.Properties && data.Properties.Line) {
  96. this.line = data.Properties.Line;
  97. }
  98. }
  99. } // Class SLineLegendItem