From 7d7c2cf4dda25db67a60665e54ac98958500f38e Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Sat, 22 Nov 2025 11:10:32 +0800
Subject: [PATCH] feat:中心控制器显示优化。翻转测区处理

---
 js/modules/axis-manager.js |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/js/modules/axis-manager.js b/js/modules/axis-manager.js
index 5be9609..0d75cfc 100644
--- a/js/modules/axis-manager.js
+++ b/js/modules/axis-manager.js
@@ -33,6 +33,7 @@
     this.centerVectorYC = null
     this.centerVectorZC = null
     this.dashLineList = []
+    this.flip = { x: false, y: false, z: false }
 
     this.planeCtx = { activeShape: null, polygonPositionList: [], centerPoint: null }
     this.axisModelUris = { axisX: 'gltf/green-arrows.gltf', axisY: 'gltf/red-arrows.gltf', axisZ: 'gltf/blue-arrows.gltf' }
@@ -129,9 +130,11 @@
     if (this.dashLineList[1]) { this.dashLineList[1].polyline.positions = g.dashY } else { this.dashLineList[1] = this.entityFactory.drawDashLine(g.dashY, 'dashY') }
     if (this.dashLineList[2]) { this.dashLineList[2].polyline.positions = g.dashZ } else { this.dashLineList[2] = this.entityFactory.drawDashLine(g.dashZ, 'dashZ') }
 
-    const qX = this._getAxisOrientation(g.centerPoint, g.centerVectorXC, this.axisLocalBasis.axisX)
+    const xDir = this.flip.x ? Cesium.Cartesian3.multiplyByScalar(g.centerVectorXC, -1, new Cesium.Cartesian3()) : g.centerVectorXC
+    const qX = this._getAxisOrientation(g.centerPoint, xDir, this.axisLocalBasis.axisX)
     const qY = this._getAxisOrientation(g.centerPoint, g.rotationNormalY, this.axisLocalBasis.axisY)
-    const qZ = this._getAxisOrientation(g.centerPoint, g.rotationNormalZ, this.axisLocalBasis.axisZ)
+    const zDir = this.flip.z ? Cesium.Cartesian3.multiplyByScalar(g.rotationNormalZ, -1, new Cesium.Cartesian3()) : g.rotationNormalZ
+    const qZ = this._getAxisOrientation(g.centerPoint, zDir, this.axisLocalBasis.axisZ)
     this.lastOrientation.axisX = qX
     this.lastOrientation.axisY = qY
     this.lastOrientation.axisZ = qZ
@@ -155,7 +158,8 @@
     }
     const qsX = this._getOrientationWithUp(g.centerPoint, g.refDirX, g.rotationNormalX, this.circleLocalBasis.sphereX)
     const qsY = this._getOrientationWithUp(g.centerPoint, g.refDirY, g.rotationNormalY, this.circleLocalBasis.sphereY)
-    const qsZ = this._getOrientationWithUp(g.centerPoint, g.refDirZ, g.rotationNormalZ, this.circleLocalBasis.sphereZ)
+    const zUp = this.flip.z ? Cesium.Cartesian3.multiplyByScalar(g.rotationNormalZ, -1, new Cesium.Cartesian3()) : g.rotationNormalZ
+    const qsZ = this._getOrientationWithUp(g.centerPoint, g.refDirZ, zUp, this.circleLocalBasis.sphereZ)
     this.lastOrientation.sphereX = qsX
     this.lastOrientation.sphereY = qsY
     this.lastOrientation.sphereZ = qsZ
@@ -198,6 +202,13 @@
     this.applyAxisGeometry(g)
   }
 
+  setReversalMode (flag) {
+    this.flip.z = !!flag
+    this.flip.x = !!flag
+    const p = this.planeCtx.polygonPositionList
+    if (Array.isArray(p) && p.length >= 4) this.createAxisEntity(p[0], p[1], p[2], p[3])
+  }
+
   /**
    * 生成围绕指定法向的圆轴折线点集合
    * @param {Cesium.Cartesian3} normalize 单位法向量

--
Gitblit v1.9.3