优化贴地svg编辑点颜色显示

This commit is contained in:
zh
2025-08-15 16:19:03 +08:00
parent 7be9a6a41d
commit 6729b60806

View File

@ -1279,6 +1279,9 @@ class GroundSvg extends Base {
// 中心点到鼠标的距离
let distance = turf.rhumbDistance(pointC, point2, options);
let flag = false
let flag2 = false
switch (this.pickPoint.id) {
case 'svg-control-points_0':
angle = bearing2_0 - bearing1
@ -1290,12 +1293,39 @@ class GroundSvg extends Base {
bearingH = (((turf.rhumbBearing(pointC, turf.point(controlPoints[2])) + 360) - this.angle) % 360)
angleW = bearing2 - bearingW
angleH = bearing2 - bearingH
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
angleW = angleW + 180
flag=true
}
if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) {
angleH = angleH + 180
flag2=true
}
if(flag && flag2) {
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#ff0000')
}
else {
if(flag) {
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#ff0000')
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
}
else if(flag2) {
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#ff0000')
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
}
else {
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#ff0000')
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
}
}
radiansW = (Math.PI / 180) * angleW
@ -1314,6 +1344,12 @@ class GroundSvg extends Base {
if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) {
angleH = angleH + 180
this.pointEntityCollection.values[2].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[8].point.color = Cesium.Color.fromCssColorString('#ff0000')
}
else {
this.pointEntityCollection.values[2].point.color = Cesium.Color.fromCssColorString('#ff0000')
this.pointEntityCollection.values[8].point.color = Cesium.Color.fromCssColorString('#00ff0a')
}
radiansH = (Math.PI / 180) * angleH
@ -1331,9 +1367,37 @@ class GroundSvg extends Base {
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
angleW = angleW + 180
flag=true
}
if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) {
angleH = angleH + 180
flag2=true
}
if(flag && flag2) {
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#ff0000')
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
}
else {
if(flag) {
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#ff0000')
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
}
else if(flag2) {
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#ff0000')
}
else {
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#ff0000')
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
}
}
radiansW = (Math.PI / 180) * angleW
@ -1351,6 +1415,12 @@ class GroundSvg extends Base {
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
angleW = angleW + 180
this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#ff0000')
}
else {
this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#ff0000')
}
radiansW = (Math.PI / 180) * angleW
@ -1381,6 +1451,12 @@ class GroundSvg extends Base {
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
angleW = angleW + 180
this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#ff0000')
}
else {
this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#ff0000')
}
radiansW = (Math.PI / 180) * angleW