diff --git a/src/pages/modules/build/gl-map.vue b/src/pages/modules/build/gl-map.vue index 171fc0b..3e374d5 100644 --- a/src/pages/modules/build/gl-map.vue +++ b/src/pages/modules/build/gl-map.vue @@ -217,6 +217,9 @@ export default { this.initPathSystem(); // 初始化路径系统 this.setupEventListeners(); this.animate(); + + this.updateCarPosition(this.carPosition) + this.addPathPoint(this.carPosition) }, createPointCloud() { this.pointGeometry = new THREE.BufferGeometry(); @@ -255,6 +258,10 @@ export default { this.carMesh.position.set(this.carPosition.x, this.carPosition.y, 5); this.carMesh.rotation.z = this.carPosition.angle; this.scene.add(this.carMesh); + + if (this.yellowDotSprite) { + this.yellowDotSprite.scale.set(carScale * 1.5, carScale * 1.5, 1); + } }); }, createYellowDot(initialX, initialY) { @@ -282,18 +289,36 @@ export default { }); this.yellowDotSprite = new THREE.Sprite(dotMaterial); - // 设置圆点大小(根据场景比例调整) - const actualRangeY = this.pointCloudRange.maxY - this.pointCloudRange.minY; - const carScale = actualRangeY / 5; - this.yellowDotSprite.scale.set(carScale * 1.5, carScale * 1.5, 1); + + let dotScale + if (this.carMesh) { + dotScale = this.carMesh.scale.x; + } else { + const actualRangeY = this.pointCloudRange.maxY - this.pointCloudRange.minY; + dotScale = actualRangeY / 5 * 1.5; + } + + + this.yellowDotSprite.scale.set(dotScale, dotScale, 1); // 固定在小车初始位置 - this.yellowDotSprite.position.set(initialX, initialY, 5); // z轴4,在点云之上、小车之下 + this.yellowDotSprite.position.set(initialX, initialY, 4); this.scene.add(this.yellowDotSprite); if (this.renderer && this.scene && this.camera) { this.renderer.render(this.scene, this.camera); } }, + updateAllSpritesScale() { + const actualRangeY = this.pointCloudRange.maxY - this.pointCloudRange.minY; + const newScale = actualRangeY / 5 * 1.5; + if (this.carMesh) { + this.carMesh.scale.set(newScale, newScale, 1); + } + if (this.yellowDotSprite) { + this.yellowDotSprite.scale.set(newScale, newScale, 1); + } + }, + updatePointCloud(points) { if (!points || !Array.isArray(points) || points.length === 0) return; @@ -383,6 +408,11 @@ export default { this.pointCloudRange.maxY = newRange.maxY; expanded = true; } + + if (expanded) { + this.updateAllSpritesScale(); + this.adjustCameraToNewRange(); + } return expanded; }, @@ -661,6 +691,7 @@ export default { // this.isLoading = false; // const pointData = points.data // this.updatePointCloud(pointData); + // this.createYellowDot(this.carPosition.x, this.carPosition.y) // setTimeout(() => { // const arr = points1.data // this.updatePointCloud(arr); diff --git a/src/pages/modules/build/index.vue b/src/pages/modules/build/index.vue index 03d555b..701cfa6 100644 --- a/src/pages/modules/build/index.vue +++ b/src/pages/modules/build/index.vue @@ -504,13 +504,17 @@ export default { let res = await teachingStartingPointRelocate() this.$message({ type: 'success', - message: res.message, - duration: 0 + message: res.message }) this.needsConfirmation = false this.$router.push('/index/home') } catch (e) { - console.log(e) + this.$message({ + type: 'success', + message: e + }) + this.needsConfirmation = false + this.$router.push('/index/home') } }, closeCloud () { diff --git a/src/pages/shells/index.vue b/src/pages/shells/index.vue index c0330bf..706eb2b 100644 --- a/src/pages/shells/index.vue +++ b/src/pages/shells/index.vue @@ -221,16 +221,16 @@ export default { this.websocket.onmessage = (event) => { try { const res = JSON.parse(event.data) - if (!res.data.rcsConnected && !res.data.vehicleConnected) { + if (!res.rcsConnected && !res.vehicleConnected) { this.showConnectionError(this.$t('Dispatchvehiclenotconnected')) - } else if (!res.data.rcsConnected && res.data.vehicleConnected) { + } else if (!res.rcsConnected && res.vehicleConnected) { this.showConnectionError(this.$t('Dispatchnotconnected')) - } else if (!res.data.vehicleConnected && res.data.rcsConnected) { + } else if (!res.vehicleConnected && res.rcsConnected) { this.showConnectionError(this.$t('Vehiclenotconnected')) } else { this.hideConnectionError() } - if (res.data.rcsConnected && res.data.vehicleConnected) { + if (res.rcsConnected && res.vehicleConnected) { this.loading.close() this.hideConnectionError() }