SImageMarkerItem.ts 1.2 KB

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