123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <template>
- <div>
- <canvas id="wall" width="800" height="400" tabindex="0"/>
- </div>
- </template>
- <script lang="ts">
- import { SGraphScene, SGraphView } from "@persagy-web/graph/";
- import { SVirtualWallItem } from "@persagy-web/big/lib/items/floor/SVirtualWallItem";
- import { Component, Vue } from "vue-property-decorator";
- /**
- * 虚拟墙对象示例
- *
- * @author 郝洁 <haojie@persagy.com>
- */
- @Component
- export default class VirtualWallCanvas extends Vue {
- /** 实例化 view */
- view: SGraphView | undefined;
- /** 图中靠上位置的黑色矩形轮廓 */
- outline1 = [[{X: 12000, Y: 1000}, {X: 12000, Y: 3000}, {X: 1000, Y: 3000}, {X: 1000, Y: 1000}]];
- /** 图中靠下位置的,中间掏洞 */
- outline2 = [
- [{X: 12000, Y: -3000}, {X: 12000, Y: -5000}, {X: 1000, Y: -5000}, {X: 10, Y: -3000}],
- [{X: 2000, Y: -4000}, {X: 2000, Y: -4500}, {X: 10000, Y: -4500}, {X: 10000, Y: -4000}]
- ];
- /**
- * 页面挂载
- */
- mounted() {
- this.init();
- };
- /**
- * 初始化加载
- */
- init() {
- this.view = new SGraphView('wall');
- const scene = new SGraphScene();
- this.view.scene = scene;
- // 只模拟了轮廓数据
- const item = new SVirtualWallItem(null, {OutLine: this.outline1});
- scene.addItem(item);
- // 只模拟了轮廓数据
- const item2 = new SVirtualWallItem(null, {OutLine: this.outline2});
- scene.addItem(item2);
- this.view.fitSceneToView();
- this.view.scalable = false;
- }
- }
- </script>
- <style scoped>
- </style>
|