door.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <template>
  2. <div>
  3. <canvas id="wall" width="800" height="400" tabindex="0"/>
  4. </div>
  5. </template>
  6. <script lang="ts">
  7. import { SGraphScene, SGraphView } from "@persagy-web/graph/";
  8. import { SDoorItem } from "@persagy-web/big/lib/items/floor/SDoorItem";
  9. import { Component, Vue } from "vue-property-decorator";
  10. /**
  11. * 门对象示例
  12. *
  13. * @author 郝洁 <haojie@persagy.com>
  14. */
  15. @Component
  16. export default class WallCanvas extends Vue {
  17. /** 实例化 view */
  18. view: SGraphView | undefined;
  19. /** 图中靠上位置的黑色矩形轮廓 */
  20. outline1 = [[{X: 12000, Y: 10000}, {X: 12000, Y: 30000}]];
  21. /**
  22. * 页面挂载
  23. */
  24. mounted(): void {
  25. this.init();
  26. };
  27. /**
  28. * 初始化加载
  29. */
  30. init(): void {
  31. this.view = new SGraphView('wall');
  32. const scene = new SGraphScene();
  33. this.view.scene = scene;
  34. // 只模拟了轮廓数据
  35. // @ts-ignore
  36. const item = new SDoorItem(null,
  37. // @ts-ignore
  38. {
  39. OutLine: this.outline1,
  40. FaceDirection: {X: 0, Y: -1, Z: 0},
  41. HandDirection: {X: 1, Y: 0, Z: 0}
  42. }
  43. );
  44. scene.addItem(item);
  45. this.view.fitSceneToView();
  46. }
  47. }
  48. </script>
  49. <style scoped>
  50. </style>