|
@@ -1,7 +1,7 @@
|
|
|
import { SMouseEvent, SUndoStack } from "@saga-web/base";
|
|
|
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 { SGraphItem, SLineStyle, 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";
|
|
@@ -12,7 +12,6 @@ import { Legend } from '@/lib/types/Legend';
|
|
|
import { uuid } from "@/components/mapClass/until";
|
|
|
import { STextMarkerItem } from '@/lib/items/STextMarkerItem';
|
|
|
import { SLineMarkerItem } from '@/lib/items/SLineMarkerItem';
|
|
|
-
|
|
|
/**
|
|
|
* 在线绘图
|
|
|
*
|
|
@@ -72,6 +71,7 @@ export class EditScence extends SGraphScene {
|
|
|
* @param obj 变化后的对象
|
|
|
*/
|
|
|
listChange(obj: any) {
|
|
|
+ console.log('obj', obj)
|
|
|
let itemType: string = 'equipment'
|
|
|
if (obj.itemList[0] instanceof STextMarkerItem) {
|
|
|
itemType = 'text'
|
|
@@ -108,16 +108,16 @@ export class EditScence extends SGraphScene {
|
|
|
addLine(event: SMouseEvent): boolean {
|
|
|
const data = {
|
|
|
/** ID */
|
|
|
- ID:'789',
|
|
|
+ ID: uuid(),
|
|
|
/** 名称 */
|
|
|
Name: '直线',
|
|
|
/** 图标(Image),线类型(Line) */
|
|
|
Type: "Line",
|
|
|
/** 位置 */
|
|
|
- Pos: {X: 0, Y: 0},
|
|
|
+ Pos: { X: 0, Y: 0 },
|
|
|
/** 由应用自己定义 */
|
|
|
- Properties:{
|
|
|
- Line: [{x:event.x, y:event.y}]
|
|
|
+ Properties: {
|
|
|
+ Line: [{ x: event.x, y: event.y }]
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -156,7 +156,6 @@ export class EditScence extends SGraphScene {
|
|
|
* 增加多边形item
|
|
|
*/
|
|
|
addPolygonItem(event: SMouseEvent): void {
|
|
|
-
|
|
|
const LegendData: Legend = {
|
|
|
ID: uuid(),
|
|
|
Name: this._legend.Name,
|
|
@@ -164,14 +163,14 @@ export class EditScence extends SGraphScene {
|
|
|
Num: 0,
|
|
|
GraphElementId: this._legend.Id,
|
|
|
AttachObjectIds: [],
|
|
|
- Pos: { x: 0, y: 0 },
|
|
|
+ Type: "Zone",
|
|
|
+ Pos: { X: event.x, Y: event.y },
|
|
|
OutLine: [[new SPoint(event.x, event.y)]],
|
|
|
- Scale: { X: 1, Y: 1, Z: 1 }, // 缩放
|
|
|
- Rolate: { X: 0, Y: 0, Z: 0 },
|
|
|
- Size: { Width: 0, Height: 0 }, // 大小
|
|
|
Properties: {
|
|
|
strokeColor: this._legend.Color,
|
|
|
fillColor: this._legend.FillColor,
|
|
|
+ LineDash: this._legend.LineDash,
|
|
|
+ LineWidth: this._legend.LineWidth,
|
|
|
},
|
|
|
}
|
|
|
|
|
@@ -179,10 +178,8 @@ export class EditScence extends SGraphScene {
|
|
|
Polylines.selectable = true;
|
|
|
//设置状态
|
|
|
Polylines.setStatus = SItemStatus.Create;
|
|
|
- const point = new SPoint(event.x, event.y);
|
|
|
Polylines.zOrder = ItemOrder.polygonOrder;
|
|
|
- Polylines.setPointList = [point];
|
|
|
- Polylines.moveable = true;
|
|
|
+ // Polylines.moveable = true;
|
|
|
this.addItem(Polylines);
|
|
|
Polylines.connect("finishCreated", this, this.finishCreated);
|
|
|
this.grabItem = Polylines;
|
|
@@ -196,9 +193,9 @@ export class EditScence extends SGraphScene {
|
|
|
addImgItem(event: SMouseEvent) {
|
|
|
const data = {
|
|
|
/** ID */
|
|
|
- ID: '123',
|
|
|
+ ID: uuid(),
|
|
|
/** 名称 */
|
|
|
- Name: '嗡嗡嗡',
|
|
|
+ Name: '图片',
|
|
|
/** 图标(Image),线类型(Line) */
|
|
|
Type: "Image",
|
|
|
/** 位置 */
|
|
@@ -227,16 +224,19 @@ export class EditScence extends SGraphScene {
|
|
|
addTextItem(event: SMouseEvent): void {
|
|
|
const data = {
|
|
|
/** ID */
|
|
|
- ID: '456',
|
|
|
+ ID: uuid(),
|
|
|
/** 名称 */
|
|
|
Name: '文本',
|
|
|
- /** 图标(Image),线类型(Line) */
|
|
|
+ /** 图标 */
|
|
|
Type: "Text",
|
|
|
/** 位置 */
|
|
|
Pos: { X: event.x, Y: event.y },
|
|
|
/** 由应用自己定义 */
|
|
|
Properties: {
|
|
|
- Text: '请在右侧属性栏输入文字!'
|
|
|
+ Text: '请在右侧属性栏输入文字!',
|
|
|
+ color: '',
|
|
|
+ font: 0,
|
|
|
+ backgroundColor: ''
|
|
|
}
|
|
|
}
|
|
|
const item = new STextMarkerItem(null, data);
|
|
@@ -264,9 +264,9 @@ export class EditScence extends SGraphScene {
|
|
|
Pos: { X: event.x, Y: event.y },
|
|
|
Scale: { X: 1, Y: 1, Z: 1 }, // 缩放
|
|
|
Rolate: { X: 0, Y: 0, Z: 0 },
|
|
|
- // Size: { Width: 0, Height: 0 }, // 大小
|
|
|
+ Size: { Width: 0, Height: 0 }, // 大小
|
|
|
Properties: {
|
|
|
- url:this._legend.url
|
|
|
+ url: '/serve/topology-wanda/Picture/query/' + this._legend.url;
|
|
|
},
|
|
|
}
|
|
|
const item = new SImageLegendItem(null, LegendData);
|
|
@@ -411,12 +411,50 @@ export class EditScence extends SGraphScene {
|
|
|
this.focusItem.url = '/serve/topology-wanda/Picture/query/' + url;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更改item border
|
|
|
+ * @param val string border类型
|
|
|
+ */
|
|
|
+ upadataBorder(val: string): void {
|
|
|
+ if (this.focusItem) {
|
|
|
+ let borderStyle = null
|
|
|
+ if (val == 'dashed') {
|
|
|
+ borderStyle = SLineStyle.Dashed
|
|
|
+ } else if (val == 'dotted') {
|
|
|
+ borderStyle = SLineStyle.Dotted
|
|
|
+ } else if (val == 'solid') {
|
|
|
+ borderStyle = SLineStyle.Soild
|
|
|
+ }
|
|
|
+ this.focusItem.lineStyle = borderStyle;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 删除指定item
|
|
|
*/
|
|
|
deleiteItem(): void {
|
|
|
if (this.focusItem) {
|
|
|
this.removeItem(this.focusItem);
|
|
|
+ let i = -1
|
|
|
+ this.Nodes.forEach((item: any, index: number) => {
|
|
|
+ if (item.id == this.focusItem.id) {
|
|
|
+ i = index
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.Nodes.splice(i, 1);
|
|
|
+ this.Markers.forEach((item: any, index: number) => {
|
|
|
+ if (item.id == this.focusItem.id) {
|
|
|
+ i = index
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.Markers.splice(i, 1);
|
|
|
+ this.Relations.forEach((item: any, index: number) => {
|
|
|
+ if (item.id == this.focusItem.id) {
|
|
|
+ i = index
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.Relations.splice(i, 1);
|
|
|
this.focusItem = null;
|
|
|
}
|
|
|
if (this.view) {
|