|
@@ -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 = ''
|
|
|
};
|
|
@@ -243,6 +249,54 @@ export class EditScence extends SGraphScene {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 点选创建区域
|
|
|
+ */
|
|
|
+ clickToAddArea(item: SSpaceItem): void {
|
|
|
+ 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: {
|
|
|
+ StrokeColor: this._legend.Color,
|
|
|
+ FillColor: this._legend.FillColor,
|
|
|
+ LineDash: this._legend.LineDash,
|
|
|
+ LineWidth: this._legend.LineWidth,
|
|
|
+ font: 0,
|
|
|
+ color: '',
|
|
|
+ TextPos: { X: 0, Y: 0 }
|
|
|
+ },
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 增加图片Item mark
|
|
|
*/
|
|
|
addImgItem(event: SMouseEvent) {
|
|
@@ -656,7 +710,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);
|