|
@@ -16,6 +16,7 @@ import { Relation } from '@/lib/types/Relation';
|
|
|
import { uuid } from "@/components/mapClass/until";
|
|
|
import { STextMarkerItem } from '@/lib/items/STextMarkerItem';
|
|
|
import { SLineMarkerItem } from '@/lib/items/SLineMarkerItem';
|
|
|
+import { SSpaceItem } from '@saga-web/big/lib/items/floor/SSpaceItem';
|
|
|
/**
|
|
|
* 在线绘图
|
|
|
*
|
|
@@ -47,6 +48,8 @@ export class EditScence extends SGraphScene {
|
|
|
this.view.update();
|
|
|
}
|
|
|
};
|
|
|
+ /** 绘制区域时 是否为点选 */
|
|
|
+ isSelecting: boolean = false;
|
|
|
|
|
|
/** 当前选中焦点Item */
|
|
|
focusItem: SGraphItem | null = null;
|
|
@@ -94,6 +97,9 @@ export class EditScence extends SGraphScene {
|
|
|
itemType = 'Image'
|
|
|
} else if (obj.itemList[0] instanceof TipelineItem) {
|
|
|
itemType = 'Line'
|
|
|
+ } else if (obj.itemList[0] instanceof SSpaceItem) { // 点选
|
|
|
+ this.clickToAddArea(obj.itemList[0]);
|
|
|
+ return
|
|
|
} else {
|
|
|
itemType = ''
|
|
|
};
|
|
@@ -137,7 +143,8 @@ export class EditScence extends SGraphScene {
|
|
|
this.addItem(item);
|
|
|
item.connect("finishCreated", this, this.finishCreated);
|
|
|
this.grabItem = item;
|
|
|
- this.Markers.push(item)
|
|
|
+ this.Markers.push(item);
|
|
|
+ this.scenceUpdate(this);
|
|
|
// this.undoStack.push(new SGraphAddCommand(this, item));
|
|
|
// item.connect("onMove", this, this.onItemMove.bind(this));
|
|
|
return true
|
|
@@ -190,6 +197,7 @@ export class EditScence extends SGraphScene {
|
|
|
// this.undoStack.push(new SGraphAddCommand(this, item));
|
|
|
this.grabItem = item;
|
|
|
this.focusItem = item;
|
|
|
+ this.scenceUpdate(this);
|
|
|
return true
|
|
|
}
|
|
|
|
|
@@ -238,6 +246,58 @@ export class EditScence extends SGraphScene {
|
|
|
this.grabItem = Polylines;
|
|
|
this.focusItem = Polylines;
|
|
|
this.Nodes.push(Polylines);
|
|
|
+ this.scenceUpdate(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 点选创建区域
|
|
|
+ */
|
|
|
+ clickToAddArea(item: SSpaceItem): void {
|
|
|
+ console.log(item)
|
|
|
+ if (this.cmd != 'Zone') {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.isSelecting && this._legend) {
|
|
|
+ const SubType = this._legend.SubType ? this._legend.SubType : ''
|
|
|
+ const LegendData: Legend = {
|
|
|
+ ID: uuid(),
|
|
|
+ Name: this._legend.Name,
|
|
|
+ GraphElementType: this._legend.Type,
|
|
|
+ Num: 1,
|
|
|
+ GraphElementId: this._legend.Id,
|
|
|
+ AttachObjectIds: [],
|
|
|
+ Type: "Zone",
|
|
|
+ Pos: { X: item.x, Y: item.y },
|
|
|
+ OutLine: item.pointArr[0],
|
|
|
+ SubType: SubType,
|
|
|
+ Properties: {
|
|
|
+ IconUrl: '/serve/topology-wanda/Picture/query/' + this._legend.Url,
|
|
|
+ StrokeColor: this._legend.Color,
|
|
|
+ FillColor: this._legend.FillColor,
|
|
|
+ LineDash: this._legend.LineDash,
|
|
|
+ LineWidth: this._legend.LineWidth,
|
|
|
+ font: 0,
|
|
|
+ color: '',
|
|
|
+ TextPos: { X: item.data.Location.Points[0].X, Y: -item.data.Location.Points[0].Y }
|
|
|
+ },
|
|
|
+ }
|
|
|
+ let Polylines = null;
|
|
|
+ if (SubType == "SCPZ") {
|
|
|
+ Polylines = new SSCPZZoneLegendItem(null, LegendData);
|
|
|
+ } else if (SubType == "FHFQ") {
|
|
|
+ Polylines = new SFHFQZoneLegendItem(null, LegendData);
|
|
|
+ } else {
|
|
|
+ Polylines = new SZoneLegendItem(null, LegendData);
|
|
|
+ }
|
|
|
+ Polylines.selectable = true;
|
|
|
+ //设置状态
|
|
|
+ Polylines.status = SItemStatus.Normal;
|
|
|
+ this.addItem(Polylines);
|
|
|
+ Polylines.connect("finishCreated", this, this.finishCreated);
|
|
|
+ this.focusItem = Polylines;
|
|
|
+ this.Nodes.push(Polylines);
|
|
|
+ this.scenceUpdate(this);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -268,7 +328,8 @@ export class EditScence extends SGraphScene {
|
|
|
this.grabItem == null;
|
|
|
this.focusItem = item;
|
|
|
this.cmd = 'choice';
|
|
|
- this.Markers.push(item)
|
|
|
+ this.Markers.push(item);
|
|
|
+ this.scenceUpdate(this);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -301,7 +362,8 @@ export class EditScence extends SGraphScene {
|
|
|
this.addItem(item);
|
|
|
this.grabItem == null
|
|
|
this.cmd = 'choice';
|
|
|
- this.Markers.push(item)
|
|
|
+ this.Markers.push(item);
|
|
|
+ this.scenceUpdate(this);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -338,6 +400,7 @@ export class EditScence extends SGraphScene {
|
|
|
// item.moveTo(event.x, event.y);
|
|
|
this.addItem(item);
|
|
|
this.Nodes.push(item);
|
|
|
+ this.scenceUpdate(this);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -355,6 +418,7 @@ export class EditScence extends SGraphScene {
|
|
|
if (this.focusItem) {
|
|
|
const old = this.focusItem.text;
|
|
|
this.focusItem.text = str;
|
|
|
+ this.scenceUpdate(this);
|
|
|
// this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "text", old, str));
|
|
|
}
|
|
|
}
|
|
@@ -510,7 +574,8 @@ export class EditScence extends SGraphScene {
|
|
|
*/
|
|
|
upadataLengedName(val: string): void {
|
|
|
if (this.focusItem && this.focusItem.data) {
|
|
|
- this.focusItem.text = val
|
|
|
+ this.focusItem.text = val;
|
|
|
+ this.scenceUpdate(this);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -520,7 +585,7 @@ export class EditScence extends SGraphScene {
|
|
|
*/
|
|
|
upadatImageNum(num: number): void {
|
|
|
if (this.focusItem && this.focusItem.num) {
|
|
|
- this.focusItem.num = num
|
|
|
+ this.focusItem.num = num;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -555,27 +620,35 @@ export class EditScence extends SGraphScene {
|
|
|
a = index
|
|
|
}
|
|
|
});
|
|
|
- this.Nodes.splice(a, 1);
|
|
|
+ if(a > -1) {
|
|
|
+ this.Nodes.splice(a, 1);
|
|
|
+ }
|
|
|
let b = -1;
|
|
|
this.Markers.forEach((item: any, index: number) => {
|
|
|
if (item.id == this.focusItem.id) {
|
|
|
b = index
|
|
|
}
|
|
|
});
|
|
|
- this.Markers.splice(b, 1);
|
|
|
+ if (b > -1) {
|
|
|
+ this.Markers.splice(b, 1);
|
|
|
+ }
|
|
|
let c = -1;
|
|
|
this.Relations.forEach((item: any, index: number) => {
|
|
|
if (item.id == this.focusItem.id) {
|
|
|
c = index
|
|
|
}
|
|
|
});
|
|
|
- this.Relations.splice(c, 1);
|
|
|
+ if (c > -1) {
|
|
|
+ this.Relations.splice(c, 1);
|
|
|
+ }
|
|
|
this.focusItem = null;
|
|
|
}
|
|
|
if (this.view) {
|
|
|
this.view.update();
|
|
|
}
|
|
|
+ this.scenceUpdate(this);
|
|
|
}
|
|
|
+ scenceUpdate(scence: any) {}
|
|
|
|
|
|
/**
|
|
|
* 对齐指定item
|
|
@@ -657,7 +730,12 @@ export class EditScence extends SGraphScene {
|
|
|
this.addImgItem(event)
|
|
|
break;
|
|
|
case 'Zone':
|
|
|
- this.addPolygonItem(event);
|
|
|
+ if (!this.isSelecting) {
|
|
|
+ this.addPolygonItem(event);
|
|
|
+ } else {
|
|
|
+ // 点选创建区域
|
|
|
+ return super.onMouseDown(event)
|
|
|
+ }
|
|
|
break;
|
|
|
case 'Image':
|
|
|
this.addIconItem(event);
|