index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <el-container class="main-container">
  3. <div class="header-container">
  4. <menu-panel></menu-panel>
  5. </div>
  6. <el-container class="content-container">
  7. <el-main>
  8. <div class="home-view">
  9. <MainMap :mapKey="mapName" :url="configUrl" :options="mapOptions" @onload="onMapload" />
  10. <LayerListPanel></LayerListPanel>
  11. <SandMonitorLeft v-if="mainMenu === '采砂监控'"></SandMonitorLeft>
  12. <SandMonitorRight v-if="mainMenu === '采砂监控'"></SandMonitorRight>
  13. <ComprehensiveOverview v-if="mainMenu === '综合概览'"></ComprehensiveOverview>
  14. </div>
  15. </el-main>
  16. </el-container>
  17. </el-container>
  18. </template>
  19. <script>
  20. import menuPanel from '@/views/components/menu'
  21. import { mapState } from 'vuex'
  22. import MainMap from '@/views/components/map'
  23. import LayerListPanel from '@/views/components/layerList'
  24. import SandMonitorLeft from './sand-monitor/left.vue'
  25. import SandMonitorRight from './sand-monitor/right.vue'
  26. import ComprehensiveOverview from '@/views/comprehensive-overview/index'
  27. const basePathUrl = window.basePathUrl || ''
  28. export default {
  29. name: 'MainView',
  30. components: { MainMap, LayerListPanel, menuPanel, SandMonitorLeft, SandMonitorRight, ComprehensiveOverview },
  31. computed: {
  32. ...mapState({
  33. mainMenu: (state) => state.home.mainMenu
  34. })
  35. },
  36. data() {
  37. return {
  38. mapName: 'cMap',
  39. configUrl: basePathUrl + 'config/config.json',
  40. mapOptions: {
  41. scene: { center: { lat: 34.227875, lng: 108.364403, alt: 35586.8, heading: 359.7, pitch: -88.6 } },
  42. basemaps: [
  43. // {
  44. // name: "天地图电子",
  45. // type: "group",
  46. // layers: [
  47. // { name: "底图", type: "tdt", layer: "vec_d", key: ["d7077257b0ca8c279c3e1bf92fb437dc"] },
  48. // { name: "注记", type: "tdt", layer: "vec_z", key: ["d7077257b0ca8c279c3e1bf92fb437dc"] },
  49. // ],
  50. // },
  51. {
  52. name: '天地图影像',
  53. type: 'group',
  54. layers: [{ name: '底图', type: 'tdt', layer: 'img_d', key: ['d7077257b0ca8c279c3e1bf92fb437dc'] }],
  55. show: true
  56. },
  57. {
  58. type: 'tdt',
  59. name: '天地图注记',
  60. layer: 'img_z',
  61. key: ['d7077257b0ca8c279c3e1bf92fb437dc'],
  62. show: true
  63. }
  64. ]
  65. }
  66. }
  67. },
  68. methods: {
  69. // 地图加载回调优化
  70. async onMapload(map) {
  71. window.map = map
  72. map.hasTerrain = true
  73. this.addWaterSurface(map)
  74. },
  75. // 添加水面
  76. addWaterSurface(map) {
  77. const geoJsonLayer = new this.mars3d.layer.GeoJsonLayer({
  78. name: '渭河',
  79. url: './geojson/weihe.geojson',
  80. crs: 'EPSG:4326',
  81. symbol: {
  82. type: 'water',
  83. styleOptions: {
  84. normalMap: '//data.mars3d.cn/img/textures/waterNormals.jpg',
  85. addHeight: 120,
  86. frequency: 8000.0, // 控制波数的数字。
  87. animationSpeed: 0.04, // 控制水的动画速度的数字。
  88. amplitude: 5.0, // 控制水波振幅的数字。
  89. specularIntensity: 0.8, // 控制镜面反射强度的数字。
  90. baseWaterColor: '#006ab4', // rgba颜色对象基础颜色的水。#00ffff,#00baff,#006ab4
  91. blendColor: '#006ab4', // 从水中混合到非水域时使用的rgba颜色对象。
  92. opacity: 0.7, // 透明度
  93. clampToGround: true // 是否贴地
  94. }
  95. }
  96. })
  97. map.addLayer(geoJsonLayer)
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="scss">
  103. .main-container {
  104. width: 100%;
  105. flex-direction: column;
  106. .el-main {
  107. padding: 0px;
  108. }
  109. }
  110. .header-container {
  111. z-index: 100;
  112. position: absolute;
  113. width: 100%;
  114. }
  115. .content-container {
  116. height: 100vh;
  117. }
  118. .home-view {
  119. position: relative;
  120. overflow: hidden;
  121. height: 100%;
  122. box-sizing: border-box;
  123. }
  124. </style>