From f123daae62d76214dff2a3c77439339030d7e60a Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 30 Dec 2021 11:57:30 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/school-web
---
src/components/mobileWindow/index.vue | 17
src/components/mobilemap/index.vue | 252 +++++++++++++++--
src/components/mobileCortrolButtom/index.vue | 12
src/components/mobileLeftNav/index.vue | 234 ----------------
src/components/mobilePopupOur/index.vue | 49 +++
src/store/getters.js | 5
src/store/modules/mobile.js | 78 ++++
src/api/mobile/search/index.js | 18 +
src/components/mobileCortrol/index.vue | 60 +++
src/App.vue | 100 ++++--
src/components/mobileCortrolSearch/index.vue | 4
11 files changed, 496 insertions(+), 333 deletions(-)
diff --git a/src/App.vue b/src/App.vue
index 09148a9..f7288bd 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,52 +1,78 @@
<template>
- <div id="app">
- <router-view></router-view>
- </div>
+ <div id="app">
+ <router-view></router-view>
+ </div>
</template>
<script>
-
export default {
- name: 'App',
- data () {
- return {
- }
- },
- mounted () {
- if (this._isMobile()) {
- // 手机端
- this.$router.replace('/mobileLayout')
- } else {
- // pc端
- this.$router.replace('/pcLayout')
- }
- },
- methods: {
- _isMobile () {
- const flag = navigator.userAgent.match(
- /(phone|pad|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows phone)/i
- )
- return flag
- }
+ name: "App",
+ data() {
+ return {
+ // consoles: 1,
+ // consoles1: 1,
+ };
+ },
+ mounted() {
+ let that = this;
+ // console.log(frames, 789456);
+ // setInterval(function () {
+ // check();
+ // }, 4000);
+ // var check = function () {
+ // function doCheck(a) {
+ // if (("" + a / a)["length"] !== 1 || a % 20 === 0) {
+ // // (function () {}["constructor"]("debugger")());
+ // console.log("已打开控制台1");
+ // that.consoles++;
+ // return;
+ // } else {
+ // // (function () {}["constructor"]("debugger")());
+ // // console.log("已打开控制台2");
+ // // return;
+ // that.consoles++;
+ // }
+ // doCheck(++a);
+ // }
+ // try {
+ // doCheck(0);
+ // } catch (err) {}
+ // };
+ // check();
+ if (this._isMobile()) {
+ // 手机端
+ this.$router.replace("/mobileLayout");
+ } else {
+ // pc端
+ this.$router.replace("/pcLayout");
}
-}
+ },
+ methods: {
+ _isMobile() {
+ const flag = navigator.userAgent.match(
+ /(phone|pad|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows phone)/i
+ );
+ return flag;
+ },
+ },
+};
</script>
<style>
html,
body {
- width: 100%;
- height: 100%;
- margin: 0;
- padding: 0;
- overflow: hidden;
+ width: 100%;
+ height: 100%;
+ margin: 0;
+ padding: 0;
+ overflow: hidden;
}
#app {
- font-family: 'Avenir', Helvetica, Arial, sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- color: #2c3e50;
- width: 100%;
- height: 100%;
+ font-family: "Avenir", Helvetica, Arial, sans-serif;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ color: #2c3e50;
+ width: 100%;
+ height: 100%;
}
</style>
diff --git a/src/api/mobile/search/index.js b/src/api/mobile/search/index.js
new file mode 100644
index 0000000..31aa607
--- /dev/null
+++ b/src/api/mobile/search/index.js
@@ -0,0 +1,18 @@
+/*
+ * @Author: Morpheus
+ * @Date: 2021-05-09 15:17:44
+ * @Last Modified by: liu
+ * @Last Modified time: 2021-12-27 09:12:24
+ */
+// 搜索
+import request from '@/router/axios'
+
+//出入-AED-停车场
+export const getListSearch = (params) => {
+ return request({
+ url: 'blade-architecture/architecture/selectLook',
+ method: 'get',
+ params: params
+ })
+}
+
diff --git a/src/components/mobileCortrol/index.vue b/src/components/mobileCortrol/index.vue
index 82a5c80..f4236f4 100644
--- a/src/components/mobileCortrol/index.vue
+++ b/src/components/mobileCortrol/index.vue
@@ -3,6 +3,20 @@
<div class="m-l-inbut zoom-in" @click="zoomIn">
<i class="el-icon-refresh"></i>
</div>
+ <div
+ class="m-l-inbut zoom-in m-l-inbut-2d"
+ :class="{ active: dimension == '2D' }"
+ @click="zoomIn('2D')"
+ >
+ 2D
+ </div>
+ <div
+ class="m-l-inbut zoom-in m-l-inbut-3d"
+ :class="{ active: dimension == '2.5D' }"
+ @click="zoomIn('2.5D')"
+ >
+ 2.5
+ </div>
</div>
</template>
@@ -16,23 +30,28 @@
};
},
computed: {
- ...mapGetters(["mviewer"]),
+ ...mapGetters(["mviewer", "startPointFn", "dimension"]),
},
created() {
this.DC = global.DC;
},
methods: {
zoomIn(val) {
- this.$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,
- });
+ // this.$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,
+ // });
+ if (val) {
+ this.$store.dispatch("MSET_DIMENSIONS", val);
+ return;
+ }
+ this.startPointFn();
},
},
};
@@ -48,6 +67,8 @@
width: 35px;
height: 35px;
background-color: rgb(33, 150, 243);
+ // stroke-width: 10;
+ // stroke: #fff;
display: flex;
align-items: center;
justify-content: center;
@@ -56,5 +77,22 @@
margin-bottom: 12px;
border-radius: 5px;
}
+ .m-l-inbut-2d {
+ position: relative;
+ top: 60px;
+ font-size: 16px;
+ &:hover {
+ background-color: rgb(21, 136, 230);
+ box-shadow: -2px -2px 3px rgb(3, 74, 136) inset;
+ }
+ }
+ .m-l-inbut-3d {
+ @extend .m-l-inbut-2d;
+ top: 55px;
+ }
+ .active {
+ background-color: rgb(72, 157, 226);
+ box-shadow: -2px -2px 3px rgb(16, 93, 161) inset;
+ }
}
</style>
diff --git a/src/components/mobileCortrolButtom/index.vue b/src/components/mobileCortrolButtom/index.vue
index f325322..eed285d 100644
--- a/src/components/mobileCortrolButtom/index.vue
+++ b/src/components/mobileCortrolButtom/index.vue
@@ -36,20 +36,20 @@
tabTable: [],
ccData: [
{
- lnt: 115.87071885,
+ lnt: 115.86471885,
lat: 28.74382592,
},
{
lnt: 115.86711312,
- lat: 28.74615701,
+ lat: 28.74315701,
},
{
- lnt: 115.86972136,
- lat: 28.74609846,
+ lnt: 115.86872136,
+ lat: 28.74009846,
},
{
- lnt: 115.86983129,
- lat: 28.741337,
+ lnt: 115.87413129,
+ lat: 28.743337,
},
],
};
diff --git a/src/components/mobileCortrolSearch/index.vue b/src/components/mobileCortrolSearch/index.vue
index 4b1edab..17948c5 100644
--- a/src/components/mobileCortrolSearch/index.vue
+++ b/src/components/mobileCortrolSearch/index.vue
@@ -5,7 +5,7 @@
><el-button
slot="append"
class="iconSearch"
- icon="el-icon-search"
+ icon="el-icon-search icon"
@click="search"
></el-button>
</el-input>
@@ -63,10 +63,12 @@
height: 30px;
padding-top: 0;
padding-bottom: 0;
+ background-color: rgb(33, 150, 243);
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
+ color: #fff;
}
}
}
diff --git a/src/components/mobileLeftNav/index.vue b/src/components/mobileLeftNav/index.vue
index 2515e3e..5f84749 100644
--- a/src/components/mobileLeftNav/index.vue
+++ b/src/components/mobileLeftNav/index.vue
@@ -56,20 +56,6 @@
imgStyle: {
right: "0",
},
- // coutrolStyle: {
- // position: " absolute",
- // left: "-26px",
- // top: "114px",
- // right: "auto",
- // width: "25px",
- // height: "60px",
- // backgroundColor: "#fff",
- // borderRadius: "10px",
- // display: "flex",
- // alignItems: "center",
- // justifyContent: "center",
- // transition: "left 3s",
- // },
leftNavData: [
{
flag: false,
@@ -106,12 +92,12 @@
{
flag: false,
label: "监控",
- img: "/img/leftnav/scene.png",
- normal: "/img/leftnav/scene.png",
- checked: "/img/leftnav/scene-checked.png",
+ img: "/img/leftnav/monitor.png",
+ normal: "/img/leftnav/monitor.png",
+ checked: "/img/leftnav/monitor-checked.png",
layer: "videoLayer",
methods: getListVideo,
- imgSrc: "img/leftnav/map-panorama.png",
+ imgSrc: "/img/leftnav/map-monitor.png",
// imgSrc: "img/mobile/blue.png",
},
// {
@@ -181,15 +167,6 @@
changeIconHide() {
let isif = this.iconHide;
this.$store.commit("MSET_ICONHIDE", !isif);
- },
- generatePosition(num) {
- const list = [];
- for (let i = 0; i < num; i++) {
- const lng = 121.0493 + Math.random() * 0.5;
- const lat = 31.2583 + Math.random() * 0.5;
- list.push(new this.DC.Position(lng, lat, 0));
- }
- return list;
},
leftNavClick(item) {
//判断并关闭已开启标签
@@ -266,203 +243,6 @@
this.comeLayer = new this.DC.HtmlLayer("comeLayer");
viewer.addLayer(this.comeLayer);
- // const positions1 = this.generatePosition(4);
- // positions1.forEach((item, index) => {
- // const divIcon = new this.DC.DivIcon(
- // item,
- // `
- // <div class="tag-entitys-box">
- // <div class="tag-content">
- // 南门口
- // </div>
- // <div class="tag-angle-content">
- // <img src="https://map.hit.edu.cn/images/tarrow_xq.png">
- // </div>
- // </div>
- // `
- // );
- // // e.overlay._position._lng,
- // // e.overlay._position._lat - 0.012,
- // //订阅事件1
- // divIcon.on(DC.MouseEventType.CLICK, (e) => {
- // // 定制化窗体
- // that.openPopupS(
- // e.position,
- // [e.overlay._position._lng, e.overlay._position._lat],
- // { name: "标签" }
- // );
- // });
- // this.tagLayer.addOverlay(divIcon); //标签
- // });
- // this.tagLayer["positions"] = positions1;
-
- // const positions2 = this.generatePosition(50);
- // positions2.forEach((item, index) => {
- // const divIcon = new this.DC.DivIcon(
- // item,
- // `
- // <div class="way-entitys-box">
- // <div class="way-title" style="border: white 1px solid; padding-left: 2px;font-size: 12px; background: #0066ff; width: 12px;line-height: 13px; padding:2px 1px 2px 1px; color:white;">
- // 工建街
- // </div>
- // <div class="way-sign-box">
- // <img src="https://map.hit.edu.cn/images/roadsign3.png">
- // </div>
- // </div>
- // `
- // );
- // //订阅事件2
- // divIcon.on(DC.MouseEventType.CLICK, (e) => {
- // // 定制化窗体
- // that.openPopupS(
- // e.position,
- // [e.overlay._position._lng, e.overlay._position._lat],
- // { name: "道路" }
- // );
- // });
- // this.wayLayer.addOverlay(divIcon); //道路
- // });
- // this.wayLayer["positions"] = positions2;
-
- // const positions3 = this.generatePosition(50);
- // positions3.forEach((item) => {
- // const billboard = new this.DC.Billboard(
- // item,
- // "/img/leftnav/map-panorama.png"
- // );
- // billboard.size = [16, 16];
- // //订阅事件3
- // billboard.on(DC.MouseEventType.CLICK, (e) => {
- // // 定制化窗体
- // that.openPopupS(
- // e.position,
- // [e.wgs84Position.lng, e.wgs84Position.lat],
- // { name: "实景" }
- // );
- // });
- // this.sceneLayer.addOverlay(billboard); //实景
- // });
- // this.sceneLayer["positions"] = positions3;
-
- // const positions10 = this.generatePosition(50);
- // positions10.forEach((item) => {
- // const label = new this.DC.Label(item, "活动");
- // label.setStyle({
- // fillColor: this.DC.Color.ORANGERED,
- // font: "10px sans-serif",
- // pixelOffset: { x: 0, y: -16 },
- // });
- // this.activityLayer.addOverlay(label);
-
- // const billboard = new this.DC.Billboard(
- // item,
- // "/img/leftnav/map-aed.png"
- // // "/img/leftnav/map-panorama.png"
- // );
- // billboard.size = [16, 16];
- // //订阅事件10
- // billboard.on(DC.MouseEventType.CLICK, (e) => {
- // // 定制化窗体
- // that.openPopupS(
- // e.position,
- // [e.wgs84Position.lng, e.wgs84Position.lat],
- // { name: "活动" }
- // );
- // });
- // this.activityLayer.addOverlay(billboard); //活动
- // });
- // this.activityLayer["positions"] = positions10;
-
- // const positions4 = this.generatePosition(10);
- // positions4.forEach((item, index) => {
- // const label = new this.DC.Label(item, "建筑AED");
- // label.setStyle({
- // fillColor: this.DC.Color.ORANGERED,
- // font: "10px sans-serif",
- // pixelOffset: { x: 0, y: -16 },
- // });
- // this.aedLayer.addOverlay(label);
-
- // const billboard = new this.DC.Billboard(
- // item,
- // "/img/leftnav/map-aed.png"
- // );
- // billboard.size = [16, 16];
- // //订阅事件4
- // billboard.on(DC.MouseEventType.CLICK, (e) => {
- // // 定制化窗体
- // that.openPopupS(
- // e.position,
- // [e.wgs84Position.lng, e.wgs84Position.lat],
- // { name: "建筑AED" }
- // );
- // });
- // this.aedLayer.addOverlay(billboard); //AED
- // });
- // this.aedLayer["positions"] = positions4;
-
- // const positions5 = this.generatePosition(120);
- // positions5.forEach((item, index) => {
- // const divIcon = new this.DC.DivIcon(
- // item,
- // `
- // <div class="park-entitys-box">
- // <div class="park-title" alt="校外街路侧停车场">
- // </div>
- // <div class="park-sign-box">
- // <div>
- // <img src="https://map.hit.edu.cn/images/p-biao.png" width="14" height="14" alt="校外街路侧停车场" title="校外街路侧停车场">
- // </div>
- // <div>
- // <img src="https://map.hit.edu.cn/images/roadsign.png" width="5" height="21">
- // </div>
- // </div>
- // </div>
- // `
- // );
- // //订阅事件5
- // divIcon.on(DC.MouseEventType.CLICK, (e) => {
- // // 定制化窗体
- // that.openPopupS(
- // e.position,
- // [e.overlay._position._lng, e.overlay._position._lat],
- // { name: "校外街路侧停车场" }
- // );
- // });
- // this.parkLayer.addOverlay(divIcon);
- // });
- // this.parkLayer["positions"] = positions5;
-
- // const positions6 = this.generatePosition(10);
-
- // positions6.forEach((item, index) => {
- // const label = new this.DC.Label(item, "123");
- // label.setStyle({
- // fillColor: this.DC.Color.PURPLE,
- // outlineColor: this.DC.Color.WHITE, // 边框颜色
- // outlineWidth: 2, // 边框大小,
- // font: "10px sans-serif",
- // pixelOffset: { x: 0, y: -16 },
- // });
- // this.comeLayer.addOverlay(label);
-
- // const billboard = new this.DC.Billboard(
- // item,
- // "/img/leftnav/map-activity.png"
- // );
- // billboard.size = [16, 16];
- // //订阅事件6
- // billboard.on(DC.MouseEventType.CLICK, (e) => {
- // // 定制化窗体
- // that.openPopupS(
- // e.position,
- // [e.wgs84Position.lng, e.wgs84Position.lat],
- // { name: "123" }
- // );
- // });
- // this.comeLayer.addOverlay(billboard); //出入
- // });
- // this.comeLayer["positions"] = positions6;
let ourNum = that.leftNavData.length;
for (let n = 0; n < ourNum; n++) {
let ourD = this.leftNavData[n];
@@ -566,9 +346,7 @@
name:
data[k].mechanismname ||
data[k].roadname ||
- ourD.label == "监控"
- ? "监控"
- : "无显示名字",
+ (ourD.label == "监控" ? "监控" : "无显示名字"),
bgImg: data[k].tpurl,
video: data[k].videourl || "",
from: "labels",
@@ -629,7 +407,7 @@
.m-left-coutrol {
position: absolute;
left: -24px;
- top: 77px;
+ top: 96px;
width: 25px;
height: 60px;
background-color: #fff;
diff --git a/src/components/mobilePopupOur/index.vue b/src/components/mobilePopupOur/index.vue
index deb1d58..92e36be 100644
--- a/src/components/mobilePopupOur/index.vue
+++ b/src/components/mobilePopupOur/index.vue
@@ -7,7 +7,7 @@
<div class="m_p_h_center">
<div>
<div v-if="mBigPopup.search" style="color: #fff">
- 查询结果{{ searchLabel ? "--" + searchLabel : "" }}
+ 查询结果{{ searchLabel ? " -- " + searchLabel : "" }}
</div>
<el-dropdown trigger="click" @command="choiceIt" v-else>
<span class="el-dropdown-link">
@@ -81,6 +81,8 @@
<script>
import { getListarc } from "@/api/mobile/public/arc"; //头部下标签页数据
import { mapGetters } from "vuex";
+//搜索
+import { getListSearch } from "@/api/mobile/search/index";
export default {
computed: {
...mapGetters(["mBigPopup", "popupOurOpenData"]),
@@ -108,6 +110,7 @@
// console.log("查询搜索结果", this.mBigPopup.value);
this.fullscreenLoading = false;
this.choiceMain = "搜索";
+ this.getListSearchMethod(this.mBigPopup.value);
return;
}
this.choiceMain = this.popupOurOpenData.qurey; // 进入的主题:列:机构单位,校园建筑
@@ -247,6 +250,50 @@
that.tabTable[+campus - 1].child = outList;
});
},
+ //搜索请求
+ getListSearchMethod(name) {
+ let val = {
+ mechanismName: name,
+ },
+ that = this;
+ getListSearch(val).then((res) => {
+ if (res.data.code != 200) {
+ return;
+ }
+ const data = res.data.data;
+ //正常获取全部数据
+ let outList = [];
+ data.forEach((item) => {
+ let icon = item.list.tpurl.split(",");
+ let useData = {
+ name: item.list.mechanismname,
+ lntLat: [item.list.jd, item.list.wd],
+ alt: item.list.gd,
+ heading: item.list.heading,
+ pitch: item.list.pitch,
+ roll: item.list.roll,
+ bgImg: item.list.tpurl,
+ icon: icon,
+ icons: icon + item.list.mechanismname, //图片响应改变
+ from: this.choiceMain,
+ QRImg: item.list.codeurl,
+ websiteUrl: item.list.websiteurl,
+ telePhone: item.list.telephone,
+ address: item.list.address,
+ introduce: item.list.introduce,
+ video: item.list.videourl,
+ buts:
+ that.mBigPopup.name == "校园建筑" ||
+ that.mBigPopup.name == "文化风景"
+ ? ["定位", "实景", "图集"]
+ : ["定位"],
+ };
+ outList.push(useData);
+ });
+ that.fullscreenLoading = false;
+ that.onlyData = outList;
+ });
+ },
},
};
</script>
\ No newline at end of file
diff --git a/src/components/mobileWindow/index.vue b/src/components/mobileWindow/index.vue
index 2b08130..181a564 100644
--- a/src/components/mobileWindow/index.vue
+++ b/src/components/mobileWindow/index.vue
@@ -83,10 +83,7 @@
let queryData = this.query.query;
// console.log(queryData);
this.title = queryData.name;
- if (queryData.bgImg) {
- this.srcList = queryData.bgImg.split(",");
- this.url = this.srcList[0];
- }
+
if (queryData.seebut) {
this.seebut = queryData.seebut;
for (let k in this.seebut) {
@@ -109,6 +106,14 @@
name: "去这",
},
];
+ }
+ if (queryData.bgImg) {
+ this.srcList = queryData.bgImg.split(",");
+ this.url = this.srcList[0];
+ } else {
+ this.seebut = this.seebut.filter((res) => {
+ return res.name != "图集";
+ });
}
if (queryData.video) {
if (queryData.from == "labels") {
@@ -179,7 +184,9 @@
);
} else if (val == "图集") {
let imgsDom = document.getElementById("mobileBigImgs");
- imgsDom.click();
+ if (imgsDom) {
+ imgsDom.click();
+ }
} else if (val == "视频") {
this.seebut[this.seebut.length - 1].name = "返回";
this.video = this.query.query.video;
diff --git a/src/components/mobilemap/index.vue b/src/components/mobilemap/index.vue
index e8486dd..70a3c30 100644
--- a/src/components/mobilemap/index.vue
+++ b/src/components/mobilemap/index.vue
@@ -46,6 +46,7 @@
"iconHide",
"popupsDom",
"MobileWindowsHideFixed",
+ "dimension",
]),
},
watch: {
@@ -138,14 +139,23 @@
});
that.$refs.mobileLeftNav.initialize(viewer);
that.$store.commit("MSET_VIEWER", viewer);
+ // window.mviewer = viewer;
// that.$store.commit("MSET_DC", DC);
const popup = viewer.popup;
popup.hide();
- const baselayer = DC.ImageryLayerFactory.createArcGisImageryLayer({
- url: "http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",
- });
+ // const baselayer = DC.ImageryLayerFactory.createArcGisImageryLayer({
+ // url: "http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",
+ // });
+ const baselayer = that.DC.ImageryLayerFactory.createImageryLayer(
+ that.DC.ImageryType.XYZ,
+ {
+ // url: 'https://webmap-tile.sf-express.com/MapTileService/rt?x={col}&y={row}&z={level}'
+
+ 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: "影像",
@@ -186,9 +196,59 @@
if (!that.MobileWindowsHide) {
// that.$store.dispatch("closeMobileWindowsDom"); //关闭随地图弹窗
}
+ // let height = Math.ceil(viewer.camera.positionCartographic.height);
+ // console.log(height);
});
- //自带白模型↓
+ viewer.on(that.DC.SceneEventType.CAMERA_CHANGED, (e) => {
+ //控制高度
+ const height = Math.ceil(viewer.camera.positionCartographic.height);
+ let orientation = {
+ heading: that.DC.Namespace.Cesium.Math.toRadians(0), // 方向
+ pitch: that.DC.Namespace.Cesium.Math.toRadians(
+ that.dimension == "2D" ? -90 : that.dimension == "2.5D" ? -45 : -45
+ ), // 倾斜角度
+ roll: 0,
+ };
+ if (height < 300) {
+ viewer.camera.setView({
+ destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
+ viewer.camera.positionCartographic.longitude,
+ viewer.camera.positionCartographic.latitude,
+ 300
+ ),
+ orientation: orientation,
+ });
+ }
+ if (height > 2000) {
+ viewer.camera.setView({
+ destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
+ viewer.camera.positionCartographic.longitude,
+ viewer.camera.positionCartographic.latitude,
+ 2000
+ ),
+ orientation: orientation,
+ });
+ }
+ });
+
+ // 地图点击事件
+ viewer.on(DC.MouseEventType.CLICK, (e) => {
+ // console.log(e);
+ // 定制化窗体
+ that.openPopupS(
+ e.position,
+ [e.wgs84SurfacePosition.lng, e.wgs84SurfacePosition.lat],
+ {
+ name: "地图点击",
+ address: [e.wgs84SurfacePosition.lng, e.wgs84SurfacePosition.lat],
+ introduce: [e.windowPosition.x, e.windowPosition.y],
+ from: "地图点击",
+ }
+ );
+ });
+
+ //白模型↓
// const layer = new DC.TilesetLayer("layer");
// viewer.addLayer(layer);
// const tileset = new DC.Tileset(
@@ -213,22 +273,135 @@
// tileset.setStyle(style);
// layer.addOverlay(tileset);
// viewer.flyTo(tileset);
- //自带白模型↑
+ //白模型↑
//精细模型↓
- const tilesetLayer = new that.DC.TilesetLayer("tilesetLayer");
- viewer.addLayer(tilesetLayer);
- const tileset = new that.DC.Tileset(
- "http://data.mars3d.cn/3dtiles/max-shihua/tileset.json",
- {
- luminanceAtZenith: 0.5,
- }
- );
- tilesetLayer.addOverlay(tileset);
- setTimeout((res) => {
- viewer.flyTo(tileset);
- }, 2500);
+ // const tilesetLayer = new that.DC.TilesetLayer("tilesetLayer");
+ // viewer.addLayer(tilesetLayer);
+ // const tileset = new that.DC.Tileset(
+ // "http://data.mars3d.cn/3dtiles/max-shihua/tileset.json",
+ // {
+ // luminanceAtZenith: 0.5,
+ // }
+ // );
+ // tilesetLayer.addOverlay(tileset);
//精细模型↑
+
+ // 2.5D贴图↓
+ var provider =
+ new that.DC.Namespace.Cesium.WebMapTileServiceImageryProvider({
+ url: "http://www.tdtfz.com/OneMapServer/rest/services/fzsw2019/MapServer/WMTS/tile/1.0.0/fzsw2019/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}",
+ layer: "fzsw2019",
+ style: "default",
+ tileMatrixSetID: "default028mm",
+ format: "image/jpgpng",
+ tilingScheme: new that.DC.Namespace.Cesium.GeographicTilingScheme(),
+ maximumLevel: 19,
+ tileMatrixLabels: [
+ "0",
+ "1",
+ "2",
+ "3",
+ "4",
+ "5",
+ "6",
+ "7",
+ "8",
+ "9",
+ "10",
+ "11",
+ "12",
+ "13",
+ "14",
+ "15",
+ "16",
+ "17",
+ "18",
+ "19",
+ ],
+ });
+
+ viewer.imageryLayers.addImageryProvider(provider);
+ // 2.5D贴图↑
+ let startPoint;
+ if (false) {
+ 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.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,
+ });
+ };
+ startPoint();
+ },
+ });
+ // viewer.flyTo(tileset);
+ }, 2500);
+ } else {
+ startPoint = (val) => {
+ console.log(val);
+ // viewer.zoomToPosition(
+ // new DC.Position(115.86798885, 28.72502592, 2100, 0, -45)
+ // );
+ viewer.camera.setView({
+ // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
+ // fromDegrees()方法,将经纬度和高程转换为世界坐标
+ destination: that.DC.Namespace.Cesium.Cartesian3.fromDegrees(
+ 116.390060025,
+ 27.95649473,
+ 2000.0
+ ),
+ orientation: {
+ // 指向
+ heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
+ // 视角
+ pitch: that.DC.Namespace.Cesium.Math.toRadians(
+ val == "2D" ? -90 : val == "2.5D" ? -45 : -45
+ ),
+ roll: 0.0,
+ },
+ });
+ };
+ startPoint(that.dimension);
+ }
+ //传递默认位置
+ that.$store.commit("MSET_MORENWEIZHI", startPoint);
+ // let position = Cesium.Cartesian3.fromDegrees(108, 25, 0); //中心点位置
+ // let cameraLimit = new xt3d.CameraDominate.CameraLimit(
+ // viewer,
+ // position,
+ // {
+ // radius: 2000,
+ // debugExtent: true,
+ // }
+ // );
+
+ // const currentViewRect = viewer.camera.computeViewRectangle();//东南西北数据
+ // console.log(currentViewRect, 78);
//瀑布流↓
const wallLayer = new that.DC.VectorLayer("wallLayer");
@@ -254,7 +427,8 @@
const wall = new that.DC.Wall(arr);
wall.setStyle({
material: new that.DC.WallTrailMaterialProperty({
- color: that.DC.Color.DEEPSKYBLUE,
+ color: that.DC.Namespace.Cesium.Color.fromBytes(0, 142, 255, 150),
+ // color: that.DC.Color.DEEPSKYBLUE,
speed: 4,
}),
});
@@ -274,26 +448,38 @@
//地图渲染完成执行srore中MSET_CREADE
// that.$store.dispatch("MSET_CREADE");
- tileset.on(DC.MouseEventType.CLICK, (e) => {
- viewer.scene.globe.depthTestAgainstTerrain = false;
- // console.log(e);
+ // tileset.on(DC.MouseEventType.CLICK, (e) => {
+ // viewer.scene.globe.depthTestAgainstTerrain = false;
+ // // console.log(e);
- // 定制化窗体
- that.openPopupS(
- e.position,
- [e.wgs84Position.lng, e.wgs84Position.lat],
- {
- name: e.layer._bid,
- address: e.layer.type,
- introduce: e.layer._id,
- }
- );
- });
+ // viewer.flyToPosition(
+ // new that.DC.Position(115.87186406, 28.74449337, 1800, 0, 45, 0)
+ // );
+
+ // // 定制化窗体
+ // that.openPopupS(
+ // e.position,
+ // [e.wgs84Position.lng, e.wgs84Position.lat],
+ // {
+ // name: e.layer._bid,
+ // address: e.layer.type,
+ // introduce: e.layer._id,
+ // }
+ // );
+ // });
viewer.compass.enable = false;
viewer.zoomController.enable = true;
viewer.locationBar.enable = false;
- viewer.distanceLegend.enable = true;
+ viewer.distanceLegend.enable = false;
+ if (true) {
+ // viewer.scene.screenSpaceCameraController.enableZoom = false; //控制视角缩放
+ viewer.scene.screenSpaceCameraController.enableTilt = false; //控制视角旋转
+ // viewer.scene.screenSpaceCameraController.minimumZoomDistance = 200; //最小缩放
+ // viewer.scene.screenSpaceCameraController.maximumZoomDistance = 1900; //最大缩放
+ // 2D和哥伦布视图
+ // 控制视角平移:scene.screenSpaceCameraController.enableTranslate = true;
+ }
}
DC.ready(initViewer);
diff --git a/src/store/getters.js b/src/store/getters.js
index a38b340..e43c4e4 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -14,7 +14,10 @@
ccDataState: state => state.mobile.ccDataState, // 测试
openmobilePanorama: state => state.mobile.openmobilePanorama,
MobileWindowsHideFixed: state => state.mobile.MobileWindowsHideFixed, // 固定窗口
- MobileWindowChangeDataFixed: state => state.mobile.MobileWindowChangeDataFixed // 固定窗口
+ MobileWindowChangeDataFixed: state => state.mobile.MobileWindowChangeDataFixed, // 固定窗口
+ startPointFn: state => state.mobile.startPointFn,// 默认起始点位置
+ dimension: state => state.mobile.dimension,// 维度
+ perspectiveControl: state => state.mobile.perspectiveControl,///视角控制:高度、角度 ()=>{}
}
const navigation = {
diff --git a/src/store/modules/mobile.js b/src/store/modules/mobile.js
index dd9a9c0..2350f45 100644
--- a/src/store/modules/mobile.js
+++ b/src/store/modules/mobile.js
@@ -28,6 +28,10 @@
checked: "/img/leftnav/way-checked.png",
layer: "pointLayer",
},
+ //默认起始点函数
+ startPointFn: '',
+ dimension: "2D",// 维度
+ perspectiveControl: '',//视角控制:高度、角度 ()=>{}
},
mutations: {
MSET_VIEWER(state, viewer) {
@@ -75,6 +79,10 @@
state.MobileWindowsHideFixed = viewer
console.log(state.MobileWindowChangeDataFixed);
},
+ //默认位置
+ MSET_MORENWEIZHI(state, data) {
+ state.startPointFn = data;
+ },
//开关飞入点图标
MSET_OPENPOINTEL(state, val) {
if (val) {
@@ -84,6 +92,14 @@
state.pointLayerData.img = state.pointLayerData.normal;
state[state.pointLayerData.layer].show = false;
}
+ },
+ //切换2D和2.5D
+ MSET_DIMENSION(state, data) {
+ state.dimension = data;
+ },
+ //切换控制
+ MSET_PERSPECTIVECONTROL(state, data) {
+ state.perspectiveControl = data;
}
},
actions: {
@@ -94,16 +110,42 @@
setMobileWindows({ state, commit, dispatch }, data) {//打开随地图移动窗口
// 关闭前一个弹窗?
dispatch("closeMobileWindowsDom");
- let clnt = data.from == "PopupOurOnce" ? +data.lntLat[0] : +data.lntLat[0],
- clat = data.from == "PopupOurOnce" ? +data.lntLat[1] - 0.00008 : +data.lntLat[1] - 0.00048,
- calt = data.from == "PopupOurOnce" ? 0 : 90.648862227;
+ let clas, Flys;
+
+ if (state.dimension == "2D") {
+ Flys = [
+ +data.lntLat[0] + 0.01197,
+ +data.lntLat[1] - 0.0001,
+ 330,
+ ]
+ clas = [
+ data.from == "PopupOurOnce" ? +data.lntLat[0] : +data.lntLat[0],
+ data.from == "PopupOurOnce" ? +data.lntLat[1] - 0.00108 : +data.lntLat[1],
+ data.from == "PopupOurOnce" ? 0 : 0,
+ ]
+
+ } else if (state.dimension == "2.5D") {
+ Flys = [
+ +data.lntLat[0] + 0.01197,
+ +data.lntLat[1] - 0.0022,
+ 330,
+ ]
+ clas = [
+ data.from == "PopupOurOnce" ? +data.lntLat[0] : +data.lntLat[0],
+ data.from == "PopupOurOnce" ? +data.lntLat[1] - 0.00108 : +data.lntLat[1] - 0.00048,
+ data.from == "PopupOurOnce" ? 0 : 90.648862227,
+ ]
+ }
+
+
if (data.useJWD) {
var ellipsoid = state.mviewer.scene.globe.ellipsoid;
var cartographic = global.DC.Namespace.Cesium.Cartographic.fromDegrees(
// data.lntLat[0],
// data.lntLat[1] - 0.00048,//数值增大是下
// "90.648862227"
- clnt, clat, calt
+ // clnt, clat, calt
+ ...clas
);
data.position = ellipsoid.cartographicToCartesian(cartographic);
}
@@ -134,18 +176,21 @@
// h:330
// lnt: + 0.01197 x轴
// Lat: - 0.0021 y轴
- let Flys = [
- data.from == "PopupOurOnce" ? +data.lntLat[0] + 0.01197 : +data.lntLat[0] + 0.01197,
- data.from == "PopupOurOnce" ? +data.lntLat[1] - 0.0021 : +data.lntLat[1] - 0.0021,
- data.from == "PopupOurOnce" ? 330 : 330,
- ]
+ // console.log(data.query.from, 78)
+ // let Flys = [
+ // data.query.from == "地图点击" ? +data.lntLat[0] + 0.01197 : +data.lntLat[0] + 0.01197,
+ // data.query.from == "地图点击" ? +data.lntLat[1] - 0.0021 : +data.lntLat[1] - 0.0021,
+ // data.query.from == "地图点击" ? 330 : 330,
+ // ]
+
+
let Position = new global.DC.Position(//转坐标
// +data.lntLat[0] + 0.01197,
// +data.lntLat[1] - 0.0021,
// 330,
...Flys,
0,
- -45
+ state.dimension == "2D" ? -90 : state.dimension == "2.5D" ? -45 : -45
);
dispatch("mapFlyTo", {//飞入
lntLat: [Position.lng, Position.lat, Position.alt],
@@ -210,6 +255,11 @@
},
duration: 1.6, //定位的时间间隔
complete: () => {//完成后的回调
+ if (data.fn) {//自定义回调
+ setTimeout(() => {
+ data.fn()
+ }, 500);
+ }
if (!data.noOpen) {
setTimeout(() => {
// dispatch("MSET_POINTDATA", data.lntLat);//传入标记点
@@ -275,6 +325,14 @@
state.pointLayer.addOverlay(billboard); //实景
// commit("MSET_OPENPOINTEL", true);
},
+ MSET_LOCKPERSPECTIVEL({ state, commit, dispatch }, val) {
+ //锁定
+ state.mviewer.camera.lookAtTransform(global.DC.Namespace.Cesium.Matrix4.IDENTITY)
+ // console.log(global.DC.Namespace.Cesium.Matrix4.IDENTITY)
+ },
+ MSET_DIMENSIONS({ state, commit, dispatch }, val) {
+ commit("MSET_DIMENSION", val);
+ }
}
}
--
Gitblit v1.9.3