姜玉琦 2023-10-26 10:25:31 +08:00
commit 5ea5ce7940
5 changed files with 62 additions and 18 deletions

View File

@ -20,6 +20,7 @@
<script src="/cesium/Cesium.js?v=20230913"></script>
<script src="/cesium/BIMGISEngine.js?v=20230920"></script>
<script src="/cesium/initApi.js?v=20230920"></script>
<!--<script src="./maps/initApi.js"></script> -->
<script src="./js/mapmodle.js"></script>
<!-- <script type="text/javascript" src="https://api.map.baidu.com/api?v=1.0&&type=webgl&ak=6zAD8CIavtzWnkGg0a7roush5maGMIPn"></script> -->
<script src="https://cdn.makalu.cc/js/echarts/china.js"></script>

View File

@ -10,7 +10,7 @@ window.mapDefault={
"imageryprovider": "tianditu_image",
"terrainProvider": "http://106.12.253.67:9304/",
"mapworldkey": "6215132e0336a3db28ce73f8c9ff6db6",
"openearth": false,
"openearth": true,
"maxspaceerror": 2000,
"loading": false,
"bgcolor": "#87CEFA",

View File

@ -187,8 +187,9 @@ export default {
it.id = it.deptId;
return it;
})]
}
this.deptChange((()=>{}));
}
this.setScreenLiSel1(this.localStorage1);
this.deptChange();
});
}
this.$root.isTypeBuser = this.isTypeBuser;
@ -343,10 +344,14 @@ export default {
this.data = [{ id: 0, text: '所有项目' }, ...objs];
this.$bus.$emit("loadProjects", this.data);
this.$root.projects = this.data;
if (this.data.length > 0) {
this.setScreenLiSel2(this.data[0], init);
} else {
this.setScreenLiSel2(null);
if(this.data.find(it=>it.id==this.localStorage2.id)){
this.setScreenLiSel2(this.localStorage2)
}else{
if (this.data.length > 0) {
this.setScreenLiSel2(this.data[0], init);
} else {
this.setScreenLiSel2(null);
}
}
if(cb){
cb();
@ -357,7 +362,7 @@ export default {
if (item) {
this.showSel2 = false;
if (!init||!this.dept2) {
localStorage.setItem("data2", JSON.stringify(item))
localStorage.setItem("data2", JSON.stringify(item))
this.localStorage2 = JSON.parse(localStorage.getItem("data2"))
this.$emit('itemdata', item);
this.dept2 = item.text;

View File

@ -1,12 +1,19 @@
<template>
<div style="height: 100%;">
<div style="height: 100%;position: relative;">
<div style="height: 100%;" v-loading="loading">
<div id="cesiumContainer" style="height: 100%;"></div>
</div>
<div class="toolbar" style="position: absolute;z-index: 100;bottom: 30px;right:12px;">
<el-switch @change="toggleGis"
v-model="showGis" active-text="GIS">
</el-switch>
</div>
</div>
</template>
<script>
import { setToken } from '@/utils/auth';
export default {
name: 'JhbigscreenMapModle',
@ -14,6 +21,7 @@ export default {
},
data() {
return {
showGis:true,
images: [],
loading: false,
mapInfo: null,
@ -26,20 +34,28 @@ export default {
},
methods: {
toggleGis(){
window.mapApi.Public.setGisState(this.showGis);
},
initMe() {
this.project = this.$root.project||{};
this.reloadMap();
},
reloadMap() {
this.mapInfo = {
root: "http://szgc.jhncidg.com:808/mapmodel/Tools/output/model/202308292207450987/root.glt",
modelId: '3a0d53cc-ad56-688c-e38d-f907088c2882'
root: "http://szgc.jhncidg.com:808/mapmodel/tools/output/model/202310241728566044/root.glt",
modelId: '3a0e7366-ad7b-3dc3-1d86-2331fc1e8578',
view:{"heading":4.8798740228358,"pitch":-0.22637630756730465,"position":[1.9366836920898733,0.5884137486301345,31809.670937187617],"headingDegrees":279.59618606401807,"pitchDegrees":-12.970407005361997,"positionWC":{"x":-1909610.0164615875,"y":4984113.66041506,"z":3537723.8441370176}}
};
this.showMap = true;
this.loading = true;
setTimeout(this.initMap, 200);
},
setView(){
let v=this.mapInfo.view;
window.mapApi.Camera.setViewPort(v.position,v.heading,v.pitch);
},
initMap() {
const func = () => {
if (!document.getElementById("cesiumContainer")) {
@ -51,20 +67,38 @@ export default {
return;
}
this.loading = false;
let v=this.mapInfo.view;
window.initMap();
window.mapApi.Model.add(
let time=+new Date();
console.log('%c开始加载模型','color:green')
window.mapApi.Model.AddModel(
this.mapInfo.root,
this.mapInfo.modelId,
null,
(data) => {
window.mapApi.Public.setGisState(true);
let ts=(+new Date() - time)/1000;
console.log('%c模型加载完成,用时'+ts+'s','color:green')
setTimeout(()=>{
let v=this.mapInfo.view;
window.mapApi.Camera.setViewPort(v.position,v.heading,v.pitch);
},400);
/*
if (Cesium.defined(data)) {
setTimeout(()=>{
},3000)
if (Cesium.defined(data.obj) && data.obj instanceof Cesium.Cesium3DTileset) {
setTimeout(()=>{
let v=this.mapInfo.view;
window.mapApi.Camera.setViewPort(v.position,v.heading,v.pitch);
},3000);
}
}
},
(data) => {
}*/
$("#box,#LoadingShadow").hide()
});
},
{
});
window.mapApi.Public.Event("LEFT_CLICK", function (click) {
window.mapApi.Feature.GetFeatureByEvent(click.position, function (json) {
});
@ -84,9 +118,13 @@ export default {
padding: 0;
overflow: hidden;
position: relative;
.cesium-viewer-toolbar{
display: none !important;
}
}
#cesium-plugin-cube_cesiumContainer {
transform: scale(0.6);
}
</style>

View File

@ -30,8 +30,8 @@ module.exports = defineConfig({
}
},
'/jhapi':{
//target: `http://62.234.3.186/jhapi/`,
target: `http://127.0.0.1:8090/jhapi/`,
target: `http://62.234.3.186/jhapi/`,
//target: `http://127.0.0.1:8090/jhapi/`,
changeOrigin: true,
pathRewrite: {
'^/jhapi':'/'