123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <template>
- <div id="ThreeJS" class="three_div"></div>
- </template>
- <script>
- import {
- getStdMapMixin
- } from "@/mixin/workManagement/getStdMapMixin.js"
- import {
- openDriveMixin
- } from "@/mixin/workManagement/openDriveMixin.js"
- export default {
- name: "OpenDrive",
- mixins: [getStdMapMixin, openDriveMixin],
- components: {
- // vueQr,
- // glHome,
- },
- data() {
- return {
- isLoaded: false,
- lineArr:[]
- };
- },
- props: {
- mapId: {
- type: String,
- default: () => ""
- },
- startPoint: {
- type: Object,
- default: () => {}
- },
- endPoint: {
- type: Object,
- default: () => {}
- },
- sections: {
- type: Array,
- default: () =>[]
- }
- },
- methods: {
- changeMap(fileUrl) {
- this.onFileSelect(fileUrl);
- this.reloadOdrMap();
- },
- getMapDetails(mapId) {
- if(mapId == "2"){
- if(this.isLoaded == true){
- this.reloadNewMap("/map/mine4.xodr");
- }else{
- this.loadMap("/map/mine4.xodr");
- this.isLoaded = true;
- }
- return;
- }
-
- this.$axios({
- method: "post",
- url: this.$api.workManagement.mapDetails,
- data: {
- mapId
- }
- }).then((res) => {
- if (res.code == 200) {
- if(this.isLoaded == true){
- this.reloadNewMap(res.info.mapPath);
- }else{
- this.loadMap(res.info.mapPath);
- this.isLoaded = true;
- }
-
- }
- })
- }
- },
- mounted() {
- },
- updated() {
- },
- watch: {
- mapId: {
- handler(newVal, oldVal) {
- this.getMapDetails(newVal);
- }
- },
- startPoint: {
- handler(newVal, oldVal) {
- newVal.type="start";
- this.drawPoint(newVal);
- }
- },
- endPoint: {
- handler(newVal, oldVal) {
- newVal.type="end";
- this.drawPoint(newVal);
- }
- },
- sections: {
- handler(newVal, oldVal) {
- if(this.lineArr && this.lineArr.length > 0){
- this.lineArr.forEach((elem, index) => {
- this.clearColorLine(elem.roadId, elem.laneId);
- })
- this.clearPoint();
- }
- newVal.forEach((elem, index) => {
- this.fillColorLine(elem.roadId, elem.laneId);
- })
- this.lineArr = newVal;
- }
- }
- }
- };
- </script>
- <style scoped lang="less">
- .three_div {
- width: 100% !important;
- height: 100% !important;
- }
- /deep/ canvas {
- width: 100% !important;
- height: 100% !important;
- }
- </style>
|