|
@@ -9,11 +9,26 @@
|
|
|
<script>
|
|
|
import { SFengParser } from "@saga-web/feng-map";
|
|
|
import { SPoint } from "@saga-web/draw/lib";
|
|
|
-import { SFloorParser, SImageItem, STextItem, SLineItem, SPolylineItem } from "@saga-web/big";
|
|
|
+import {
|
|
|
+ SFloorParser,
|
|
|
+ SImageItem,
|
|
|
+ STextItem,
|
|
|
+ SLineItem,
|
|
|
+ SPolylineItem
|
|
|
+} from "@saga-web/big";
|
|
|
import { SPolygonItem } from "./mapClass/SPolygonItem";
|
|
|
-import { FloorView } from "./../lib/FloorView"
|
|
|
-import { FloorScene } from "./../lib/FloorScene"
|
|
|
+import { FloorView } from "./../lib/FloorView";
|
|
|
+import { FloorScene } from "./../lib/FloorScene";
|
|
|
+import { EditScence } from "./mapClass/EditScence";
|
|
|
+import { SRelationState } from "@saga-web/big/lib/enums/SRelationState";
|
|
|
export default {
|
|
|
+ props: {
|
|
|
+ cmd: {
|
|
|
+ type: Number,
|
|
|
+ default: 0,
|
|
|
+ required: false
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
appName: "万达可视化系统",
|
|
@@ -31,56 +46,42 @@ export default {
|
|
|
mounted() {
|
|
|
this.canvasWidth = this.$refs.graphy.offsetWidth;
|
|
|
this.canvasHeight = this.$refs.graphy.offsetHeight;
|
|
|
- this.init()
|
|
|
+ this.init();
|
|
|
},
|
|
|
methods: {
|
|
|
init() {
|
|
|
- document.getElementById(`canvas`).focus()
|
|
|
+ document.getElementById(`canvas`).focus();
|
|
|
this.clearGraphy();
|
|
|
- this.scene = new FloorScene();
|
|
|
- this.fmap = new SFengParser(
|
|
|
- "fengMap",
|
|
|
- this.mapServerURL,
|
|
|
- this.key,
|
|
|
- this.appName,
|
|
|
- null
|
|
|
- );
|
|
|
- this.fmap.parseData("1001724_29", 6, res => {
|
|
|
- console.log(res);
|
|
|
- this.fParser = new SFloorParser(null);
|
|
|
- console.log(this.fParser);
|
|
|
- this.fParser.parseData(res);
|
|
|
- this.fParser.spaceList.forEach(t => {
|
|
|
- t.connect('click', this, this.spaceClick)
|
|
|
- t.selectable = true;
|
|
|
- this.scene.addItem(t)
|
|
|
- });
|
|
|
- this.fParser.wallList.forEach(t => this.scene.addItem(t));
|
|
|
- this.fParser.virtualWallList.forEach(t => this.scene.addItem(t));
|
|
|
- this.fParser.doorList.forEach(t => this.scene.addItem(t));
|
|
|
- this.fParser.columnList.forEach(t => this.scene.addItem(t));
|
|
|
- this.fParser.casementList.forEach(t => this.scene.addItem(t));
|
|
|
- // this.addPolyLine();
|
|
|
- // this.DirectRelationItem();
|
|
|
- this.view.scene = this.scene;
|
|
|
- this.view.fitSceneToView();
|
|
|
- });
|
|
|
- },
|
|
|
- // 引入构建多边形类
|
|
|
- addPolyLine() {
|
|
|
- const data = {
|
|
|
- PointList: [
|
|
|
- { X: -138.71000000089407, Y: -17.5 },
|
|
|
- { X: -130.31000000052154, Y: -17.5 },
|
|
|
- { X: -130.31000000052154, Y: -25.5 },
|
|
|
- { X: -138.71000000089407, Y: -25.5 }
|
|
|
- ]
|
|
|
- };
|
|
|
- const Polylines = new SPolygonItem(null);
|
|
|
- Polylines.setStatus = 2;
|
|
|
- this.scene.addItem(Polylines);
|
|
|
- this.scene.grabItem = Polylines;
|
|
|
+ // this.scene = new FloorScene();
|
|
|
+ this.scene = new EditScence();
|
|
|
+ // // this.fmap = new SFengParser(
|
|
|
+ // "fengMap",
|
|
|
+ // this.mapServerURL,
|
|
|
+ // this.key,
|
|
|
+ // this.appName,
|
|
|
+ // null
|
|
|
+ // );
|
|
|
+ // this.fmap.parseData("1001724_29", 6, res => {
|
|
|
+ // console.log(res);
|
|
|
+ // this.fParser = new SFloorParser(null);
|
|
|
+ // console.log(this.fParser);
|
|
|
+ // this.fParser.parseData(res);
|
|
|
+ // this.fParser.spaceList.forEach(t => {
|
|
|
+ // t.connect("click", this, this.spaceClick);
|
|
|
+ // t.selectable = true;
|
|
|
+ // this.scene.addItem(t);
|
|
|
+ // });
|
|
|
+ // this.fParser.wallList.forEach(t => this.scene.addItem(t));
|
|
|
+ // this.fParser.virtualWallList.forEach(t => this.scene.addItem(t));
|
|
|
+ // this.fParser.doorList.forEach(t => this.scene.addItem(t));
|
|
|
+ // this.fParser.columnList.forEach(t => this.scene.addItem(t));
|
|
|
+ // this.fParser.casementList.forEach(t => this.scene.addItem(t));
|
|
|
+ // this.addPolyLine();
|
|
|
+ this.view.scene = this.scene;
|
|
|
+ this.view.fitSceneToView();
|
|
|
+ // });
|
|
|
},
|
|
|
+
|
|
|
// 引入折线
|
|
|
// DirectRelationItem() {
|
|
|
// const data = {
|
|
@@ -98,10 +99,10 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
this.view = new FloorView("canvas");
|
|
|
- document.getElementById('canvas').focus()
|
|
|
+ document.getElementById("canvas").focus();
|
|
|
},
|
|
|
spaceClick(space, event) {
|
|
|
- console.log(this.scene.selectContainer)
|
|
|
+ console.log(this.scene.selectContainer);
|
|
|
// const item = new SImageItem(null, {
|
|
|
// Width: 32,
|
|
|
// Height: 32,
|
|
@@ -117,28 +118,39 @@ export default {
|
|
|
// setInterval(() => { item.text += '魔' }, 1000)
|
|
|
},
|
|
|
iconClick(item, event) {
|
|
|
- console.log(2222222222222)
|
|
|
+ console.log(2222222222222);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ cmd: {
|
|
|
+ handler(cmd) {
|
|
|
+ // if (!this.scene) return;
|
|
|
+ // // grabItem !==null 则处在绘制状态
|
|
|
+ // if (this.scene.grabItem) {
|
|
|
+ // const item = this.scene.grabItem;
|
|
|
+ // // 如果为创建状态 cmd发生更改,则删除创建过程种的item
|
|
|
+ // if (item.getStatus == SRelationState.Create) {
|
|
|
+ // this.scene.removeItem(item);
|
|
|
+ // this.scene.grabItem = null;
|
|
|
+ // } else if (item.getStatus == SRelationState.Edit) {
|
|
|
+ // // 如果为编辑状态 cmd发生更改,则该item转换为show状态,grabItem = null
|
|
|
+ // item.setStatus == SRelationState.Normal;
|
|
|
+ // this.scene.grabItem = null;
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // // grabItem == null 则处在选择状态 可以随意切换cmd
|
|
|
+
|
|
|
+ // }
|
|
|
+ // this.view.update();
|
|
|
+ this.scene.setCmd = cmd;
|
|
|
+ },
|
|
|
+ immediate: true
|
|
|
},
|
|
|
- // changeFloor() { },
|
|
|
- changeStatus(name) {
|
|
|
- switch (name) {
|
|
|
- case '选择':
|
|
|
- // test init
|
|
|
- this.init();
|
|
|
- break;
|
|
|
- case '画线':
|
|
|
- this.scene.isLining = true;
|
|
|
- break;
|
|
|
- case '画文字':
|
|
|
- this.scene.isTexting = true;
|
|
|
- break;
|
|
|
- case '画图片':
|
|
|
- this.scene.isImging = true;
|
|
|
- break;
|
|
|
- default:
|
|
|
- console.log(name)
|
|
|
- break;
|
|
|
- }
|
|
|
+ "scene.cmd": {
|
|
|
+ handler(cmd) {
|
|
|
+ this.$emit("setCmd", cmd);
|
|
|
+ },
|
|
|
+ deep: true
|
|
|
}
|
|
|
}
|
|
|
};
|