12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import { SGraphItem, SImageItem } from "@saga-web/graph/lib";
- import { SPainter, SColor } from "@saga-web/draw";
- import { Marker } from '../types/Marker';
- import { ItemOrder } from '@saga-web/big/lib';
- import { hexify } from "@/components/mapClass/until";
- /**
- * 标识对象Item(图标类型)
- *
- * * @author 张宇(taohuzy@163.com)
- */
- export class SImageMarkerItem extends SImageItem {
- /** 标识对象数据 */
- data: Marker;
- /**
- * 构造函数
- *
- * @param parent 指向父对象
- * @param data 标识对象数据
- */
- constructor(parent: SGraphItem | null, data: Marker) {
- super(parent);
- this.zOrder = ItemOrder.imageOrder;
- this.isTransform = false;
- this.url = "";
- this.data = data;
- this.id = data.ID;
- this.name = data.Name;
- this.moveTo(data.Pos.X, data.Pos.Y);
- if (data.Size) {
- this.width = data.Size.Width;
- this.height = data.Size.Height;
- }
- if (data.Properties && data.Properties.Url) {
- this.url = data.Properties.Url;
- }
- if (data.Properties.LineWidth) {
- this.lineWidth = data.Properties.LineWidth;
- }
- if (data.Properties.StrokeColor) {
- this.strokeColor = data.Properties.StrokeColor.includes('#') ? new SColor(data.Properties.StrokeColor) : new SColor(hexify(data.Properties.StrokeColor));
- }
- } // Constructor
- toData(): Marker {
- this.data.Pos = {X: this.x, Y: this.y};
- this.data.Size = {Width: this.width, Height: this.height};
- this.data.Properties.Url = this.url;
- this.data.Properties.StrokeColor = this.strokeColor.value;
- this.data.Properties.LineWidth = this.lineWidth;
- return this.data;
- }
- } // Class SImageMarkerItem
|