SImageMarkerItem.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { SImageItem } from "@saga-web/graph/lib";
  2. import { ItemOrder } from '@saga-web/big/lib';
  3. /**
  4. * 标识对象Item(图标类型)
  5. *
  6. * * @author 张宇(taohuzy@163.com)
  7. */
  8. export class SImageMarkerItem extends SImageItem {
  9. /**
  10. * 构造函数
  11. *
  12. * @param parent 指向父对象
  13. * @param data 标识对象数据
  14. */
  15. constructor(parent, data) {
  16. super(parent);
  17. this.zOrder = ItemOrder.imageOrder;
  18. this.isTransform = false;
  19. this.data = data;
  20. this.id = data.ID;
  21. this.name = data.Name;
  22. this.moveTo(data.Pos.X, data.Pos.Y);
  23. if (data.Size) {
  24. this.width = data.Size.Width;
  25. this.height = data.Size.Height;
  26. }
  27. if (data.Properties && data.Properties.Url) {
  28. this.url = data.Properties.Url;
  29. }
  30. } // Constructor
  31. toData() {
  32. this.data.Pos = { X: this.x, Y: this.y };
  33. this.data.Size = { Width: this.width, Height: this.height };
  34. this.data.Properties.Url = this.url;
  35. return this.data;
  36. }
  37. } // Class SImageMarkerItem