北京经济技术开发区经开区虚拟城市项目-【前端】-移动端Web
少年
2024-03-06 a18adf9f3b30a5ff51c163059e4af9ffcd2af536
src/components/viewer2.vue
@@ -4,9 +4,9 @@
    <div id="openlayerContainer" @click="clicktoclose"></div>
    <!-- 页面标题 -->
    <div class="titleBg">
    <!-- <div class="titleBg">
      <img src="@/assets/img/title/title.png" />
    </div>
    </div> -->
    <!-- 历史影像 -->
    <my-history v-if="state.show"></my-history>
    <!-- 历史影像关闭按钮 -->
@@ -24,7 +24,7 @@
    <!-- 原左下菜单 -->
    <!-- <my-menu v-on:getshowsta="datafromchild" ref="menu"></my-menu> -->
    <!-- 左下快捷区域(复位、指北等) -->
    <my-left-bottom :test="childrendata"></my-left-bottom>
    <!-- <my-left-bottom :test="childrendata"></my-left-bottom> -->
    <!-- 右下快捷区域(放大缩小) -->
    <my-right-bottom :test="childrendata"></my-right-bottom>
@@ -34,7 +34,7 @@
    <!-- 位置面板 -->
    <my-collection-panel></my-collection-panel>
    <!-- 指北针面板 -->
    <my-direction-panel></my-direction-panel>
    <!-- <my-direction-panel></my-direction-panel> -->
    <!-- 新增收藏面板 -->
    <my-add-collection-panel></my-add-collection-panel>
    <!-- 窨井、摄像头统计面板 -->
@@ -57,7 +57,7 @@
</template>
<script>
import store from "@/utils/store2.js";
import { setClick, leftClick } from "@/utils/map2.js";
import { setClick, leftClick,touchClick } from "@/utils/map2.js";
import _GLOBAL from "@/assets/GLOBAL2";
// import { leftClick, loadLayer } from "@/utils/map.js";
import leftBottom from "@/components/leftMenu/bottom2.vue";
@@ -87,7 +87,8 @@
  addHxLayer,
  addYzLayer,
  loadBaseMap,
  getCurrentPosition,
  listenDirection,
  getCurrentPosition
} from "@/utils/tool";
// import Map from "ol/Map.js";
// import TileLayer from "ol/layer/Tile.js";
@@ -260,19 +261,21 @@
          projection: "EPSG:4326",
          zoom: 12,
          minZoom: 9.5,
          enableRotation: false,
        }),
        // events: ["singleclick", "pointermove"],
      });
      window.mapapi = map;
      addImageLayer();
      addAnnotationLayer();
      addHxLayer();
      addYzLayer();
      setClick(true);
      touchClick();
      getCurrentPosition();
      listenDirection();
      // leftClick()
      window.layerOpen = function (name, options) {
@@ -331,34 +334,34 @@
  },
  methods: {
    clicktoclose() {
      clearTimeout(this.timer);
      this.timer = setTimeout(() => {
        this.count++;
        if (this.count == 2) {
          // console.log("单击事件");
          // 关闭所有弹窗
          //this.$refs.menu.closeall();
          // 清除定位中的位置标记
          //this.$refs.menu.clearFlyPoint();
        } else {
          // 执行放大操作
          // console.log("双击");
          // Viewer.camera.zoomIn();
          // console.log(window.clickPOI);
          // let p = sgworld.Navigate.getDegrees();
          // console.log(p);
          // Viewer.camera.flyTo({
          //   destination: Cesium.Cartesian3.fromDegrees(
          //     window.clickPOI.lon,
          //     window.clickPOI.lat,
          //     p.height / 1.8
          //   ),
          //   duration: 1.0,
          // });
        }
        this.count = 0;
      }, 300);
      this.count++;
      // clearTimeout(this.timer);
      // this.timer = setTimeout(() => {
      //   this.count++;
      //   if (this.count == 2) {
      //     // console.log("单击事件");
      //     // 关闭所有弹窗
      //     //this.$refs.menu.closeall();
      //     // 清除定位中的位置标记
      //     //this.$refs.menu.clearFlyPoint();
      //   } else {
      //     // 执行放大操作
      //     // console.log("双击");
      //     // Viewer.camera.zoomIn();
      //     // console.log(window.clickPOI);
      //     // let p = sgworld.Navigate.getDegrees();
      //     // console.log(p);
      //     // Viewer.camera.flyTo({
      //     //   destination: Cesium.Cartesian3.fromDegrees(
      //     //     window.clickPOI.lon,
      //     //     window.clickPOI.lat,
      //     //     p.height / 1.8
      //     //   ),
      //     //   duration: 1.0,
      //     // });
      //   }
      //   this.count = 0;
      // }, 300);
      // this.count++;
    },
    datafromchild(data) {
      for (var i in data) {