index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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="this.mainMenu === 'sandMonitor'"></SandMonitorLeft>
  12. <SandMonitorRight v-if="this.mainMenu === 'sandMonitor'"></SandMonitorRight>
  13. <SafetyInspectionLeft v-if="this.mainMenu === 'safetyInspection'"></SafetyInspectionLeft>
  14. <SafetyInspectionRight v-if="this.mainMenu === 'safetyInspection'"></SafetyInspectionRight>
  15. <AddInspectionTask />
  16. <ComprehensiveOverview v-if="this.mainMenu === 'comprehensiveOverview'"></ComprehensiveOverview>
  17. <HydrologicInfo v-if="this.mainMenu === 'hydrologicInfo'"></HydrologicInfo>
  18. <SmartEarlyWarning v-if="this.mainMenu === 'smartEarlyWarning'" />
  19. <WaterStationPopup />
  20. </div>
  21. </el-main>
  22. </el-container>
  23. </el-container>
  24. </template>
  25. <script>
  26. import menuPanel from '@/views/components/menu'
  27. import MainMap from '@/views/components/map'
  28. import LayerListPanel from '@/views/components/layerList'
  29. import SandMonitorLeft from './sand-monitor/left.vue'
  30. import SandMonitorRight from './sand-monitor/right.vue'
  31. import SafetyInspectionLeft from './safety-inspection/left.vue'
  32. import SafetyInspectionRight from './safety-inspection/right.vue'
  33. import ComprehensiveOverview from '@/views/comprehensive-overview/index'
  34. import HydrologicInfo from '@/views/hydrologic-info/index'
  35. import WaterStationPopup from '@/views/water-station-popup'
  36. import AddInspectionTask from './safety-inspection/addInspectionTask.vue'
  37. import SmartEarlyWarning from '@/views/smart-early-warning/index'
  38. const basePathUrl = window.basePathUrl || ''
  39. export default {
  40. name: 'MainView',
  41. components: {
  42. MainMap,
  43. LayerListPanel,
  44. menuPanel,
  45. SandMonitorLeft,
  46. SandMonitorRight,
  47. SafetyInspectionLeft,
  48. ComprehensiveOverview,
  49. SafetyInspectionRight,
  50. HydrologicInfo,
  51. WaterStationPopup,
  52. AddInspectionTask,
  53. SmartEarlyWarning
  54. },
  55. data() {
  56. return {
  57. mapName: 'cMap',
  58. configUrl: basePathUrl + 'config/config.json',
  59. mapOptions: {
  60. scene: { center: { lat: 34.203789, lng: 108.30656, alt: 36020, heading: 0.8, pitch: -85.9 } },
  61. basemaps: [
  62. // {
  63. // name: "天地图电子",
  64. // type: "group",
  65. // layers: [
  66. // { name: "底图", type: "tdt", layer: "vec_d", key: ["d7077257b0ca8c279c3e1bf92fb437dc"] },
  67. // { name: "注记", type: "tdt", layer: "vec_z", key: ["d7077257b0ca8c279c3e1bf92fb437dc"] },
  68. // ],
  69. // },
  70. {
  71. name: '天地图影像',
  72. type: 'group',
  73. layers: [{ name: '底图', type: 'tdt', layer: 'img_d', key: ['d7077257b0ca8c279c3e1bf92fb437dc'] }],
  74. show: true
  75. },
  76. {
  77. type: 'tdt',
  78. name: '天地图注记',
  79. layer: 'img_z',
  80. key: ['d7077257b0ca8c279c3e1bf92fb437dc'],
  81. show: true
  82. }
  83. ]
  84. },
  85. mainMenu:'comprehensiveOverview',
  86. }
  87. },
  88. created(){
  89. this.mainMenu = this.$route.params.menu
  90. },
  91. methods: {
  92. // 地图加载回调优化
  93. async onMapload(map) {
  94. window.map = map
  95. map.hasTerrain = true
  96. this.addWaterSurface(map)
  97. },
  98. // 添加水面
  99. addWaterSurface(map) {
  100. const geoJsonLayer = new this.mars3d.layer.GeoJsonLayer({
  101. name: '渭河',
  102. url: '/geojson/weihe.geojson',
  103. crs: 'EPSG:4326',
  104. symbol: {
  105. type: 'water',
  106. styleOptions: {
  107. normalMap: '/img/waterNormals.jpg',
  108. addHeight: 120,
  109. frequency: 8000.0, // 控制波数的数字。
  110. animationSpeed: 0.04, // 控制水的动画速度的数字。
  111. amplitude: 5.0, // 控制水波振幅的数字。
  112. specularIntensity: 0.8, // 控制镜面反射强度的数字。
  113. baseWaterColor: '#006ab4', // rgba颜色对象基础颜色的水。#00ffff,#00baff,#006ab4
  114. blendColor: '#006ab4', // 从水中混合到非水域时使用的rgba颜色对象。
  115. opacity: 0.7, // 透明度
  116. clampToGround: true // 是否贴地
  117. }
  118. }
  119. })
  120. map.addLayer(geoJsonLayer)
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="scss">
  126. .main-container {
  127. width: 100%;
  128. flex-direction: column;
  129. .el-main {
  130. padding: 0px;
  131. }
  132. }
  133. .header-container {
  134. z-index: 100;
  135. position: absolute;
  136. width: 100%;
  137. }
  138. .content-container {
  139. height: 100vh;
  140. }
  141. .home-view {
  142. position: relative;
  143. overflow: hidden;
  144. height: 100%;
  145. box-sizing: border-box;
  146. }
  147. </style>