|
@@ -3,12 +3,15 @@ import { SGraphScene, SGraphLayoutType } from '@saga-web/graph/lib';
|
|
|
import { SFloorParser, SLineItem, SPolylineItem, SItemStatus, ItemOrder } from "@saga-web/big";
|
|
|
import { SGraphItem, SImageItem, STextItem, SGraphPointListInsert, SGraphPointListDelete, SGraphPointListUpdate, SGraphAddCommand } from "@saga-web/graph/lib";
|
|
|
import { SZoneLegendItem } from "@/lib/items/SZoneLegendItem";
|
|
|
+import { SImageLegendItem } from "@/lib/items/SImageLegendItem";
|
|
|
import { TipelineItem } from "@/lib/items/TipelineItem";
|
|
|
import { SImgTextItem } from "@/lib/items/SImgTextItem";
|
|
|
import { SImageMarkerItem } from "@/lib/items/SImageMarkerItem"
|
|
|
import { SPoint, SFont } from '@saga-web/draw/lib';
|
|
|
import { Legend } from '@/lib/types/Legend';
|
|
|
import { uuid } from "@/components/mapClass/until";
|
|
|
+import { STextMarkerItem } from '@/lib/items/STextMarkerItem';
|
|
|
+import { SLineMarkerItem } from '@/lib/items/SLineMarkerItem';
|
|
|
|
|
|
/**
|
|
|
* 在线绘图
|
|
@@ -70,11 +73,11 @@ export class EditScence extends SGraphScene {
|
|
|
*/
|
|
|
listChange(obj: any) {
|
|
|
let itemType: string = 'equipment'
|
|
|
- if (obj.itemList[0] instanceof STextItem) {
|
|
|
+ if (obj.itemList[0] instanceof STextMarkerItem) {
|
|
|
itemType = 'text'
|
|
|
- } else if (obj.itemList[0] instanceof SImageItem) {
|
|
|
+ } else if (obj.itemList[0] instanceof SImageMarkerItem) {
|
|
|
itemType = 'images'
|
|
|
- } else if (obj.itemList[0] instanceof SLineItem) {
|
|
|
+ } else if (obj.itemList[0] instanceof SLineMarkerItem) {
|
|
|
itemType = 'line'
|
|
|
} else if (obj.itemList[0] instanceof SPolylineItem) {
|
|
|
itemType = 'pipeline'
|
|
@@ -103,15 +106,30 @@ export class EditScence extends SGraphScene {
|
|
|
* 增加线段item
|
|
|
*/
|
|
|
addLine(event: SMouseEvent): boolean {
|
|
|
+ const data = {
|
|
|
+ /** ID */
|
|
|
+ ID:'789',
|
|
|
+ /** 名称 */
|
|
|
+ Name: '直线',
|
|
|
+ /** 图标(Image),线类型(Line) */
|
|
|
+ Type: "Line",
|
|
|
+ /** 位置 */
|
|
|
+ Pos: {X: 0, Y: 0},
|
|
|
+ /** 由应用自己定义 */
|
|
|
+ Properties:{
|
|
|
+ Line: [{x:event.x, y:event.y}]
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- const item = new SLineItem(null, new SPoint(event.x, event.y));
|
|
|
+ const item = new SLineMarkerItem(null, data);
|
|
|
item.status = SItemStatus.Create;
|
|
|
item.zOrder = ItemOrder.lineOrder;
|
|
|
item.selectable = true;
|
|
|
this.addItem(item);
|
|
|
item.connect("finishCreated", this, this.finishCreated);
|
|
|
this.grabItem = item;
|
|
|
- this.undoStack.push(new SGraphAddCommand(this, item));
|
|
|
+ this.Markers.push(item)
|
|
|
+ // this.undoStack.push(new SGraphAddCommand(this, item));
|
|
|
// item.connect("onMove", this, this.onItemMove.bind(this));
|
|
|
return true
|
|
|
}
|
|
@@ -138,19 +156,7 @@ export class EditScence extends SGraphScene {
|
|
|
* 增加多边形item
|
|
|
*/
|
|
|
addPolygonItem(event: SMouseEvent): void {
|
|
|
- //创建item
|
|
|
- const Legend = {
|
|
|
- Name: "哈哈",
|
|
|
- GraphElementType: 'Zone',
|
|
|
- GraphElementId: '123',
|
|
|
- Pos: { x: 0, y: 0 },
|
|
|
- OutLine: [[new SPoint(event.x, event.y)]],
|
|
|
- Properties: {
|
|
|
- strokeColor: '#3d73c0',
|
|
|
- fillColor: '#eda986'
|
|
|
- },
|
|
|
- Num: 123
|
|
|
- }
|
|
|
+
|
|
|
const LegendData: Legend = {
|
|
|
ID: uuid(),
|
|
|
Name: this._legend.Name,
|
|
@@ -181,7 +187,7 @@ export class EditScence extends SGraphScene {
|
|
|
Polylines.connect("finishCreated", this, this.finishCreated);
|
|
|
this.grabItem = Polylines;
|
|
|
this.focusItem = Polylines;
|
|
|
- this.Nodes.push(Polylines)
|
|
|
+ this.Nodes.push(Polylines);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -190,16 +196,16 @@ export class EditScence extends SGraphScene {
|
|
|
addImgItem(event: SMouseEvent) {
|
|
|
const data = {
|
|
|
/** ID */
|
|
|
- ID:'123',
|
|
|
+ ID: '123',
|
|
|
/** 名称 */
|
|
|
Name: '嗡嗡嗡',
|
|
|
/** 图标(Image),线类型(Line) */
|
|
|
Type: "Image",
|
|
|
/** 位置 */
|
|
|
- Pos: {X: event.x, Y: event.y},
|
|
|
+ Pos: { X: event.x, Y: event.y },
|
|
|
/** 由应用自己定义 */
|
|
|
- Properties:{
|
|
|
- Url:require('./../../assets/logo.png'),
|
|
|
+ Properties: {
|
|
|
+ Url: '/serve/topology-wanda/Picture/query/' + '1bcff19d6f3547488673dcba7dd9507f',
|
|
|
Name: '嗡嗡嗡',
|
|
|
}
|
|
|
}
|
|
@@ -212,13 +218,28 @@ export class EditScence extends SGraphScene {
|
|
|
this.grabItem == null;
|
|
|
this.focusItem = item;
|
|
|
this.cmd = 'choice';
|
|
|
+ this.Markers.push(item)
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 增加文字item
|
|
|
*/
|
|
|
addTextItem(event: SMouseEvent): void {
|
|
|
- const item = new STextItem(null, '请在右侧属性栏输入文字!');
|
|
|
+ const data = {
|
|
|
+ /** ID */
|
|
|
+ ID: '456',
|
|
|
+ /** 名称 */
|
|
|
+ Name: '文本',
|
|
|
+ /** 图标(Image),线类型(Line) */
|
|
|
+ Type: "Text",
|
|
|
+ /** 位置 */
|
|
|
+ Pos: { X: event.x, Y: event.y },
|
|
|
+ /** 由应用自己定义 */
|
|
|
+ Properties: {
|
|
|
+ Text: '请在右侧属性栏输入文字!'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const item = new STextMarkerItem(null, data);
|
|
|
item.moveTo(event.x, event.y);
|
|
|
item.selectable = true;
|
|
|
item.moveable = true;
|
|
@@ -226,13 +247,21 @@ export class EditScence extends SGraphScene {
|
|
|
this.addItem(item);
|
|
|
this.grabItem == null
|
|
|
this.cmd = 'choice';
|
|
|
+ this.Markers.push(item)
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 增加图标
|
|
|
*/
|
|
|
- addIconItem(): void {
|
|
|
-
|
|
|
+ addIconItem(event: SMouseEvent): void {
|
|
|
+ const item = new SImageLegendItem(null, '请在右侧属性栏输入文字!');
|
|
|
+ this.grabItem == null
|
|
|
+ this.cmd = 'choice';
|
|
|
+ item.selectable = true;
|
|
|
+ item.moveable = true;
|
|
|
+ item.zOrder = ItemOrder.markOrder;
|
|
|
+ item.moveTo(event.x, event.y);
|
|
|
+ this.addItem(item);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -359,6 +388,15 @@ export class EditScence extends SGraphScene {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 更改item Url
|
|
|
+ * @param url string 图片key
|
|
|
+ */
|
|
|
+ upadataImageUrl(url: string): void {
|
|
|
+ if (this.focusItem) {
|
|
|
+ this.focusItem.url = '/serve/topology-wanda/Picture/query/' + url;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
* 删除指定item
|
|
|
*/
|
|
|
deleiteItem(): void {
|
|
@@ -391,12 +429,16 @@ export class EditScence extends SGraphScene {
|
|
|
* 保存数据
|
|
|
*/
|
|
|
saveMsgItem(): any {
|
|
|
- const Nodes: any = []
|
|
|
+ const Nodes: any = [];
|
|
|
+ const Markers: any = [];
|
|
|
this.Nodes.forEach(e => {
|
|
|
Nodes.push(e.toData())
|
|
|
});
|
|
|
+ this.Markers.forEach(e => {
|
|
|
+ Markers.push(e.toData())
|
|
|
+ });
|
|
|
let element = {
|
|
|
- Nodes
|
|
|
+ Nodes, Markers
|
|
|
}
|
|
|
return element
|
|
|
}
|
|
@@ -446,9 +488,9 @@ export class EditScence extends SGraphScene {
|
|
|
case 'Zone':
|
|
|
this.addPolygonItem(event);
|
|
|
break;
|
|
|
- // case 'Image':
|
|
|
- // this.addPolylineItem(event);
|
|
|
- // break;
|
|
|
+ case 'Image':
|
|
|
+ this.addIconItem(event);
|
|
|
+ break;
|
|
|
case 'Line':
|
|
|
this.addPolylineItem(event);
|
|
|
break;
|