|
@@ -9,6 +9,8 @@ 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 { Relation } from '@/lib/types/Legend';
|
|
|
+
|
|
|
import { uuid } from "@/components/mapClass/until";
|
|
|
import { STextMarkerItem } from '@/lib/items/STextMarkerItem';
|
|
|
import { SLineMarkerItem } from '@/lib/items/SLineMarkerItem';
|
|
@@ -154,7 +156,42 @@ export class EditScence extends SGraphScene {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 增加多边形item
|
|
|
+ * 增加管道 lenged
|
|
|
+ */
|
|
|
+ addTipelineItem(event: SMouseEvent): boolean {
|
|
|
+ const LegendData: Relation = {
|
|
|
+ ID: uuid(),
|
|
|
+ Name: this._legend.Name,
|
|
|
+ GraphElementType: this._legend.Type,
|
|
|
+ Num: 0,
|
|
|
+ GraphElementId: this._legend.Id,
|
|
|
+ AttachObjectIds: [],
|
|
|
+ Type: "Line",
|
|
|
+ PointList: [{ X: event.x, Y: event.y }],
|
|
|
+ LineType: 0,
|
|
|
+ Properties: {
|
|
|
+ LineDash: this._legend.LineDash,
|
|
|
+ LineWidth: this._legend.LineWidth,
|
|
|
+ Color: this._legend.Color,
|
|
|
+ },
|
|
|
+ }
|
|
|
+
|
|
|
+ const item = new TipelineItem(null, LegendData);
|
|
|
+ //设置状态
|
|
|
+ item.selectable = true;
|
|
|
+ item.status = SItemStatus.Create;
|
|
|
+ item.zOrder = ItemOrder.polylineOrder
|
|
|
+ this.addItem(item);
|
|
|
+ this.Relations.push(item);
|
|
|
+ item.connect("finishCreated", this, this.finishCreated);
|
|
|
+ // this.undoStack.push(new SGraphAddCommand(this, item));
|
|
|
+ this.grabItem = item;
|
|
|
+ this.focusItem = item;
|
|
|
+ return true
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 增加多边形item lenged
|
|
|
*/
|
|
|
addPolygonItem(event: SMouseEvent): void {
|
|
|
const LegendData: Legend = {
|
|
@@ -172,6 +209,7 @@ export class EditScence extends SGraphScene {
|
|
|
fillColor: this._legend.FillColor,
|
|
|
LineDash: this._legend.LineDash,
|
|
|
LineWidth: this._legend.LineWidth,
|
|
|
+ Text:this._legend.Name
|
|
|
},
|
|
|
}
|
|
|
|
|
@@ -189,7 +227,7 @@ export class EditScence extends SGraphScene {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 增加图片Item
|
|
|
+ * 增加图片Item mark
|
|
|
*/
|
|
|
addImgItem(event: SMouseEvent) {
|
|
|
const data = {
|
|
@@ -203,8 +241,8 @@ export class EditScence extends SGraphScene {
|
|
|
Pos: { X: event.x, Y: event.y },
|
|
|
/** 由应用自己定义 */
|
|
|
Properties: {
|
|
|
- Url: '/serve/topology-wanda/Picture/query/' + '1bcff19d6f3547488673dcba7dd9507f',
|
|
|
- Name: '嗡嗡嗡',
|
|
|
+ Url: '',
|
|
|
+ Name: '',
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -252,7 +290,7 @@ export class EditScence extends SGraphScene {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 增加图标
|
|
|
+ * 增加图标lenged图标
|
|
|
*/
|
|
|
addIconItem(event: SMouseEvent): void {
|
|
|
console.log('this._legend.url', this._legend)
|
|
@@ -268,7 +306,7 @@ export class EditScence extends SGraphScene {
|
|
|
Rolate: { X: 0, Y: 0, Z: 0 },
|
|
|
Size: { Width: 0, Height: 0 }, // 大小
|
|
|
Properties: {
|
|
|
- Url: '/serve/topology-wanda/Picture/query/' + this._legend.url
|
|
|
+ Url: '/serve/topology-wanda/Picture/query/' + this._legend.Url
|
|
|
},
|
|
|
}
|
|
|
const item = new SImageLegendItem(null, LegendData);
|
|
@@ -277,8 +315,9 @@ export class EditScence extends SGraphScene {
|
|
|
item.selectable = true;
|
|
|
item.moveable = true;
|
|
|
item.zOrder = ItemOrder.markOrder;
|
|
|
- item.moveTo(event.x, event.y);
|
|
|
+ // item.moveTo(event.x, event.y);
|
|
|
this.addItem(item);
|
|
|
+ this.Nodes.push(item);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -433,6 +472,17 @@ export class EditScence extends SGraphScene {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 更改item 名称
|
|
|
+ * @param val string border类型
|
|
|
+ */
|
|
|
+ upadataLengedName(val: string): void {
|
|
|
+ console.log('xxxxxxx',val)
|
|
|
+ if (this.focusItem && this.focusItem.data) {
|
|
|
+ this.focusItem.data.Name = val
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 删除指定item
|
|
|
*/
|
|
|
deleiteItem(): void {
|
|
@@ -460,7 +510,6 @@ export class EditScence extends SGraphScene {
|
|
|
});
|
|
|
this.Relations.splice(c, 1);
|
|
|
this.focusItem = null;
|
|
|
- console.log('this.Nodes',this.Nodes)
|
|
|
}
|
|
|
if (this.view) {
|
|
|
this.view.update();
|
|
@@ -488,14 +537,19 @@ export class EditScence extends SGraphScene {
|
|
|
saveMsgItem(): any {
|
|
|
const Nodes: any = [];
|
|
|
const Markers: any = [];
|
|
|
+ const Relations: any = [];
|
|
|
this.Nodes.forEach(e => {
|
|
|
Nodes.push(e.toData())
|
|
|
});
|
|
|
this.Markers.forEach(e => {
|
|
|
Markers.push(e.toData())
|
|
|
});
|
|
|
+ this.Relations.forEach(e => {
|
|
|
+ Relations.push(e.toData())
|
|
|
+ });
|
|
|
+
|
|
|
let element = {
|
|
|
- Nodes, Markers
|
|
|
+ Nodes, Markers, Relations
|
|
|
}
|
|
|
return element
|
|
|
}
|
|
@@ -549,7 +603,7 @@ export class EditScence extends SGraphScene {
|
|
|
this.addIconItem(event);
|
|
|
break;
|
|
|
case 'Line':
|
|
|
- this.addPolylineItem(event);
|
|
|
+ this.addTipelineItem(event);
|
|
|
break;
|
|
|
default:
|
|
|
return super.onMouseDown(event);
|