| | |
| | | <template> |
| | | <el-row class="wrap"> |
| | | <el-col span="2"> |
| | | <!-- <div class="p-events-auto"> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | @click="previousGrid" |
| | | > |
| | | 上一个 |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | @click="nextGrid" |
| | | > |
| | | 下一个 |
| | | </el-button> |
| | | </div> --> |
| | | <el-row> |
| | | <SatelliteManage |
| | | v-show="show" |
| | |
| | | @show-rank="handleRankClick" |
| | | @show-data="handleDataClick" |
| | | @change-color="handleColorClick" |
| | | @change-opacity="handleOpacityClick" |
| | | ></SatelliteManage> |
| | | </el-row> |
| | | </el-col> |
| | |
| | | </el-row> |
| | | <SatelliteDataMix class="data-mix" @mix-data="handleMixDataClick"> |
| | | </SatelliteDataMix> |
| | | <SatelliteMixTool :group-id="3"></SatelliteMixTool> |
| | | |
| | | <!-- <el-row class="historical" justify="center"> |
| | | <SatelliteAnimation |
| | | :loading="animaLoading" |
| | |
| | | import marks from '@/utils/map/marks'; |
| | | import grid from '@/utils/map/grid'; |
| | | |
| | | import { ref } from 'vue'; |
| | | import { ref, onMounted } from 'vue'; |
| | | import gridApi from '@/api/gridApi'; |
| | | import SatelliteManage from './component/SatelliteManage.vue'; |
| | | import SatelliteDataMix from './component/SatelliteDataMix.vue'; |
| | | import SatelliteMixTool from './component/SatelliteMixTool.vue'; |
| | | import SatelliteProxy from './SatelliteProxy'; |
| | | import { useFetchData } from '@/composables/fetchData'; |
| | | import { useSatelliteGridStore } from '@/stores/satellite-grid'; |
| | | |
| | | // 查询长宁区行政区划 |
| | | function initDistrict() { |
| | | onMapMounted(() => { |
| | | // eslint-disable-next-line no-undef |
| | | var district = new AMap.DistrictSearch({ |
| | | extensions: 'all', //返回行政区边界坐标等具体信息 |
| | | level: 'district' //设置查询行政区级别为区 |
| | | }); |
| | | district.search('长宁区', function (status, result) { |
| | | var bounds = result.districtList[0].boundaries; //获取朝阳区的边界信息 |
| | | if (bounds) { |
| | | for (var i = 0; i < bounds.length; i++) { |
| | | //生成行政区划 polygon |
| | | // eslint-disable-next-line no-undef |
| | | var polygon = new AMap.Polygon({ |
| | | map: map, //显示该覆盖物的地图对象 |
| | | strokeWeight: 3, //轮廓线宽度 |
| | | path: bounds[i], //多边形轮廓线的节点坐标数组 |
| | | fillOpacity: 0.1, //多边形填充透明度 |
| | | fillColor: '#CCF3FF', //多边形填充颜色 |
| | | // strokeColor: '#ffffff' //线条颜色 |
| | | strokeColor: '#0077ff' //线条颜色 |
| | | }); |
| | | } |
| | | map.setFitView(); //将覆盖物调整到合适视野 |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | import { useSceneStore } from '@/stores/scene'; |
| | | |
| | | const satelliteGridStore = useSatelliteGridStore(); |
| | | const { loading, fetchData } = useFetchData(10000); |
| | | const sceneStore = useSceneStore(); |
| | | const animaLoading = ref(true); |
| | | const show = ref(true); |
| | | |
| | |
| | | // 查询网格信息和遥感数据组 |
| | | function onSearch(options) { |
| | | satelliteGridStore.fetchGridCell(options.id).then(() => { |
| | | SatelliteProxy.clearText(mapViews); |
| | | drawGrid(satelliteGridStore.gridInfo); |
| | | initDistrict(); |
| | | // initDistrict(); |
| | | SatelliteProxy.drawDistrict('长宁区'); |
| | | }); |
| | | satelliteGridStore.fetchGridData(options.id).then(() => { |
| | | max = satelliteGridStore.gridDataList.length; |
| | |
| | | |
| | | function drawGrid(gridInfo) { |
| | | SatelliteProxy.clearAll(mapViews); |
| | | mapViews = SatelliteProxy.drawPolyline(gridInfo); |
| | | mapViews = SatelliteProxy.drawPolyline(gridInfo, (polygon) => { |
| | | //鼠标移入事件 |
| | | polygon.on('mouseover', () => { |
| | | polygon.setOptions({ |
| | | //修改多边形属性的方法 |
| | | strokeWeight: 2, |
| | | strokeColor: 'red' |
| | | }); |
| | | }); |
| | | //鼠标移出事件 |
| | | polygon.on('mouseout', () => { |
| | | polygon.setOptions({ |
| | | strokeWeight: 1, |
| | | strokeColor: 'white' |
| | | }); |
| | | }); |
| | | //鼠标点击事件 |
| | | polygon.on('click', () => { |
| | | const [lng, lat] = polygon.getExtData(); |
| | | sceneStore.radius = 0.5; |
| | | sceneStore.searchScene(lng, lat); |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | // 绘制网格遥感数据值和网格颜色 |
| | | function drawTextAndColor(gridData) { |
| | | // SatelliteProxy.clearText(mapViews); |
| | | const { resGridViews, pointsRes } = SatelliteProxy.drawColor({ |
| | | gridViews: mapViews.gridViews, |
| | | points: mapViews.points, |
| | | gridDataDetail: gridData, |
| | | lastGridViews: mapViews.lastGridViews |
| | | }); |
| | | mapViews.lastGridViews = resGridViews; |
| | | mapViews.lastPoints = pointsRes; |
| | | // 文本标记 |
| | | const { textViews: dataTxt, labelsLayer: dataLayer } = |
| | | SatelliteProxy.drawDataText( |
| | | mapViews.points, |
| | | mapViews.lastPoints, |
| | | gridData, |
| | | mapViews.dataTxt, |
| | | mapViews.dataLayer |
| | |
| | | mapViews.dataLayer = dataLayer; |
| | | const { textViews: rankTxt, labelsLayer: rankLayer } = |
| | | SatelliteProxy.drawRankText( |
| | | mapViews.points, |
| | | mapViews.lastPoints, |
| | | gridData, |
| | | mapViews.rankTxt, |
| | | mapViews.rankLayer |
| | | ); |
| | | mapViews.rankTxt = rankTxt; |
| | | mapViews.rankLayer = rankLayer; |
| | | SatelliteProxy.drawColor(mapViews.gridViews, gridData); |
| | | } |
| | | |
| | | let selectedGridData; |
| | |
| | | } |
| | | |
| | | function handleColorClick(isStandardColor) { |
| | | SatelliteProxy.drawColor( |
| | | mapViews.gridViews, |
| | | selectedGridData, |
| | | !isStandardColor |
| | | ); |
| | | const { resGridViews, pointsRes } = SatelliteProxy.drawColor({ |
| | | gridViews: mapViews.gridViews, |
| | | points: mapViews.points, |
| | | gridDataDetail: selectedGridData, |
| | | lastGridViews: mapViews.lastGridViews, |
| | | customColor: !isStandardColor |
| | | }); |
| | | mapViews.lastGridViews = resGridViews; |
| | | mapViews.lastPoints = pointsRes; |
| | | } |
| | | |
| | | function handleOpacityClick(isOpacity) { |
| | | mapViews.lastGridViews.forEach((e) => { |
| | | e.setOptions({ |
| | | fillOpacity: isOpacity ? 0.1 : 0.7 |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | function handleMixDataClick(gridData) { |
| | |
| | | position: absolute; |
| | | right: 0; |
| | | top: 60px; |
| | | /* color: #0552f7; */ |
| | | } |
| | | </style> |