Pārlūkot izejas kodu

attempt to modify the cylinder.

Haobin Luo 1 gadu atpakaļ
vecāks
revīzija
0437043d0b
1 mainītis faili ar 39 papildinājumiem un 14 dzēšanām
  1. 39 14
      src/views/simulation/index.vue

+ 39 - 14
src/views/simulation/index.vue

@@ -805,6 +805,7 @@ export default {
               let z = parseFloat(data[key].z) * 1000
               //终点位置
               let position = new this.Cesium.Cartesian3(x, y, z);
+              let cylinderposition = new this.Cesium.Cartesian3(x,y,z/2.0);
               this.$data._viewer2D.entities.add({
                 id: this.id,
                 position: position,
@@ -812,14 +813,14 @@ export default {
                   pixelSize: 12, // 调整点的大小,可以增大点的像素大小
                   color: this.Cesium.Color.fromCssColorString('Blue')
                 },
-                cylinder: {
-                  length: range, // 锥形的高度,可以根据需要调整
-                  topRadius: 0,
-                  bottomRadius: range / 2,
-                  material: this.Cesium.Color.BLUE.withAlpha(0.5), // 设置锥形的颜色和透明度
-                  outline: true,
-                  outlineColor: this.Cesium.Color.BLUE,
-                },
+                // cylinder: {
+                //   length: range, // 锥形的高度,可以根据需要调整
+                //   topRadius: 0,
+                //   bottomRadius: range / 2,
+                //   material: this.Cesium.Color.BLUE.withAlpha(0.5), // 设置锥形的颜色和透明度
+                //   outline: true,
+                //   outlineColor: this.Cesium.Color.BLUE,
+                // },
                 model: {
                   uri: satelliteModel, // 替换为你的3D模型文件路径
                   scale: 1.0, // 调整3D模型的缩放大小
@@ -832,13 +833,9 @@ export default {
                   pixelOffset: new this.Cesium.Cartesian2(0, 20) // 调整标签的像素偏移,向下偏移20像素
                 }
               });
-              this.$data._viewer3D.entities.add({
+              this.$data._viewer2D.entities.add({
                 id: this.id,
-                position: position,
-                point: {
-                  pixelSize: 12, // 调整点的大小,可以增大点的像素大小
-                  color: this.Cesium.Color.fromCssColorString('Blue')
-                },
+                position: cylinderposition,
                 cylinder: {
                   length: range, // 锥形的高度,可以根据需要调整
                   topRadius: 0,
@@ -847,6 +844,22 @@ export default {
                   outline: true,
                   outlineColor: this.Cesium.Color.BLUE,
                 },
+              });
+              this.$data._viewer3D.entities.add({
+                id: this.id,
+                position: position,
+                point: {
+                  pixelSize: 12, // 调整点的大小,可以增大点的像素大小
+                  color: this.Cesium.Color.fromCssColorString('Blue')
+                },
+                // cylinder: {
+                //   length: range, // 锥形的高度,可以根据需要调整
+                //   topRadius: 0,
+                //   bottomRadius: range / 2,
+                //   material: this.Cesium.Color.BLUE.withAlpha(0.5), // 设置锥形的颜色和透明度
+                //   outline: true,
+                //   outlineColor: this.Cesium.Color.BLUE,
+                // },
                 model: {
                   uri: satelliteModel, // 替换为你的3D模型文件路径
                   scale: 1.0, // 调整3D模型的缩放大小
@@ -859,6 +872,18 @@ export default {
                   pixelOffset: new this.Cesium.Cartesian2(0, 20) // 调整标签的像素偏移,向下偏移20像素
                 },
               });
+              this.$data._viewer3D.entities.add({
+                id: this.id,
+                position: cylinderposition,
+                cylinder: {
+                  length: range, // 锥形的高度,可以根据需要调整
+                  topRadius: 0,
+                  bottomRadius: range / 2,
+                  material: this.Cesium.Color.BLUE.withAlpha(0.5), // 设置锥形的颜色和透明度
+                  outline: true,
+                  outlineColor: this.Cesium.Color.BLUE,
+                },
+              });
               this.nameIdList.push({
                 id: this.id,
                 name: key