shuishen
2022-01-12 acb45c731c3ccd0a67061efb4e7bdf4f56005672
src/components/mobilemap/index.vue
@@ -14,15 +14,18 @@
    <mobileCortrolSearch ref="mobileCortrolSearch"></mobileCortrolSearch>
    <!-- 控制↑ -->
    <!-- 控制大弹窗的弹窗 -->
    <mobilePopupOurAfter v-if="mBigPopupAfter"></mobilePopupOurAfter>
    <!-- v-if="mBigPopupAfter" -->
    <mobilePopupOurAfter></mobilePopupOurAfter>
    <!-- 大弹窗 -->
    <mobilePopupOur :style="[bigPopup]" v-if="mBigPopup"></mobilePopupOur>
    <!-- 测试-跳转位置 -->
    <mobileGoTo></mobileGoTo>
    <!-- 实景窗口 -->
    <mobilePanorama></mobilePanorama>
    <!-- 退出导航 -->
    <mobileCloseRouter></mobileCloseRouter>
    <!-- 盖住左下角 -->
    <div class="cover_mobileMap">智慧校园</div>
    <div class="cover_mobileMap">智慧社区</div>
  </div>
</template>
<script>
@@ -194,11 +197,10 @@
          url: "https://webmap-tile.sf-express.com/MapTileService/rt?fetchtype=static&x={x}&y={y}&z={z}&project=sfmap&pic_size=256&pic_type=png8&data_name=361100&data_format=merged-dat&data_type=normal", // 行政区划
        }
      );
      viewer.addBaseLayer(baselayer, {
        iconUrl: "examples/images/icon/img.png",
        name: "影像",
      });
      // viewer.addBaseLayer(baselayer, {
      //   iconUrl: "examples/images/icon/img.png",
      //   name: "影像",
      // });
      // eslint-disable-next-line camelcase
      // const baselayer_shaded = DC.ImageryLayerFactory.createArcGisImageryLayer({
      //   url: "http://services.arcgisonline.com/arcgis/rest/services/World_Shaded_Relief/MapServer",
@@ -268,11 +270,11 @@
        // if (height > 2000) {
        //   conBack(2000);
        // }
        if (height < 500 && isSet) {
          conBack(500);
        if (height < 0 && isSet) {
          conBack(0);
        }
        if (height > 6000 && isSet) {
          conBack(6000);
        if (height > 4000 && isSet) {
          conBack(4000);
        }
      });
@@ -325,7 +327,8 @@
      const tileset = new that.DC.Tileset("/mx/tileset.json", {
        luminanceAtZenith: 0.5,
      });
      tilesetLayer.addOverlay(tileset);
      // tilesetLayer.addOverlay(tileset);
      // tilesetLayer.show = false;
      let silhouetteBlue =
@@ -367,9 +370,9 @@
          e.position,
          [e.wgs84Position.lng, e.wgs84Position.lat],
          {
            name: e.layer._bid,
            address: e.layer.type,
            introduce: e.layer._id,
            name: e.overlay.attr.name,
            address: e.layer._id,
            introduce: e.overlay.attr.id,
            data: e,
          }
        );
@@ -422,9 +425,9 @@
      //     );
      //   }
      // });
      tilesetLayer["changesilhouetteBlue"] = () => {
        silhouetteBlue.selected = [];
      };
      // tilesetLayer["changesilhouetteBlue"] = () => {
      //   silhouetteBlue.selected = [];
      // };
      // tilesetLayer.show = false;
      //精细模型↑
@@ -462,8 +465,12 @@
          //     "19",
          //   ],
          // });
          new that.DC.Namespace.Cesium.ArcGisMapServerImageryProvider({
            url: "http://arcgis.jxpskj.com:6080/arcgis/rest/services/PingXiang25DMapDN/MapServer",
          // new that.DC.Namespace.Cesium.ArcGisMapServerImageryProvider({
          //   url: "http://arcgis.jxpskj.com:6080/arcgis/rest/services/PingXiang25DMapDN/MapServer",
          // });
          new that.DC.Namespace.Cesium.UrlTemplateImageryProvider({
            url: "/wp/{z}/{x}/{y}.png",
            fileExtension: "png",
          });
        return viewer.imageryLayers.addImageryProvider(provider);
      };
@@ -471,45 +478,42 @@
      const newLayer = usetowpointfive();
      // 2.5D贴图↑
      let startPoint;
      if (false) {
      if (true) {
        startPoint = () => {
          viewer.flyTo(tileset);
          // that.$store.dispatch("mapFlyTo", {
          //   //飞入
          //   lntLat: [115.87988885, 28.72502592, 2100],
          //   // lntLat: [115.87186406, 28.74449337, 1200],
          //   // lntLat: [121.50492752204283, 31.21567802276832, 2530],
          //   heading: 0,
          //   pitch: -45,
          //   roll: 0,
          //   noOpen: true,
          // });
          let doit2 = (int, h) => {
            viewer.camera.setView({
              // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
              // fromDegrees()方法,将经纬度和高程转换为世界坐标
              destination: that.DC.Namespace.Cesium.Cartesian3.fromDegrees(
                // 114.0351,
                // 27.6314,
                // 200.0
                int[0],
                int[1],
                int[2]
              ),
              orientation: {
                // 指向
                heading: that.DC.Namespace.Cesium.Math.toRadians(h[0]),
                // 视角
                pitch: that.DC.Namespace.Cesium.Math.toRadians(h[1]),
                roll: h[2],
              },
            });
          };
          that.dimension == "2.5D"
            ? doit2(
                [114.03928791, 27.62954732, 360.0],
                [
                  that.dimensionData.heading,
                  that.dimensionData.pitch,
                  that.dimensionData.roll,
                ]
              )
            : // : doit([116.39038494750986, 39.902393222208644, 330.0]);
              // doit("建模");
              doit2([114.0351, 27.6314, 300.0], [108, -26.46, 0.0]);
        };
        setTimeout((res) => {
          //转圈
          that.$store.dispatch("mapFlyTo", {
            lntLat: [111.25036579, 34.83767277, 11443175.85],
            heading: 0,
            pitch: -90,
            roll: 0,
            noOpen: true,
            fn: function () {
              // viewer.flyTo(tileset);
              // viewer.flyTo(provider);
              //飞入起始点
              // that.$store.dispatch("mapFlyTo", {
              //   lntLat: [115.87186406, 28.74449337, 1200],
              //   heading: 0,
              //   pitch: -45,
              //   roll: 0,
              //   noOpen: true,
              // });
              startPoint();
            },
          });
          // viewer.flyTo(tileset);
        }, 2500);
      } else {
        startPoint = (val) => {
          // viewer.zoomToPosition(
@@ -543,6 +547,7 @@
                },
              });
            } else {
              // console.log(123456);
              that.$store.dispatch("mapFlyTo", {
                lntLat: [+int[0] + 0.012, int[1], int[2]],
                // 指向
@@ -559,6 +564,7 @@
            ? doit([114.03928791, 27.62954732, 360.0])
            : // : doit([116.39038494750986, 39.902393222208644, 330.0]);
              doit("建模");
          // doit(114.03925, 27.6265, 360.0);
        };
        // startPoint(1);
      }
@@ -579,29 +585,29 @@
      //瀑布流↓
      const wallLayer = new that.DC.VectorLayer("wallLayer");
      viewer.addLayer(wallLayer);
      var arr = that.wallArr;
      arr.forEach((item) => {
        item = item.join(",");
      });
      arr = arr.join(";");
      const wall = new that.DC.Wall(arr);
      wall.setStyle({
        material: new that.DC.WallTrailMaterialProperty({
          color: that.DC.Namespace.Cesium.Color.fromBytes(0, 142, 255, 150),
          // color: that.DC.Color.DEEPSKYBLUE,
          speed: 4,
        }),
      });
      wallLayer.addOverlay(wall);
      // viewer.addLayer(wallLayer);
      // var arr = that.wallArr;
      // arr.forEach((item) => {
      //   item = item.join(",");
      // });
      // arr = arr.join(";");
      // const wall = new that.DC.Wall(arr);
      // wall.setStyle({
      //   material: new that.DC.WallTrailMaterialProperty({
      //     color: that.DC.Namespace.Cesium.Color.fromBytes(0, 142, 255, 150),
      //     // color: that.DC.Color.DEEPSKYBLUE,
      //     speed: 4,
      //   }),
      // });
      // wallLayer.addOverlay(wall);
      viewer.use(new that.DC.Measure());
      // viewer.use(new that.DC.Measure());
      //瀑布流↑
      // 传入store
      that.$store.commit("MSET_MODEOLS", {
        tilesetLayer: tilesetLayer,
        tileset: tileset,
        // tileset: tileset,
        newLayer: newLayer,
        wallLayer: wallLayer,
        usetowpointfive: usetowpointfive,
@@ -627,7 +633,30 @@
      if (that.dimension == "2.5D") {
        that.$store.commit("MSET_DIMENSION", "2.5D"); //切换2.5D设置
      } else if (that.dimension == "3D") {
        // setTimeout((res) => {
        //   that.$store.dispatch("mapFlyTo", {
        //     lntLat: [111.25036579, 34.83767277, 11443175.85],
        //     heading: 0,
        //     pitch: -90,
        //     roll: 0,
        //     noOpen: true,
        //     fn: function () {
        // viewer.flyTo(tileset);
        // viewer.flyTo(provider);
        //飞入起始点
        // that.$store.dispatch("mapFlyTo", {
        //   lntLat: [115.87186406, 28.74449337, 1200],
        //   heading: 0,
        //   pitch: -45,
        //   roll: 0,
        //   noOpen: true,
        // });
        // startPoint();
        that.$store.commit("MSET_DIMENSION", "3D"); //切换3D设置
        //     },
        //   });
        // }, 2000);
      }
      if (false) {
        //镜头改变示例