影像缩略图更新-选择表格弹窗优化、影响先叠加总缩略图、再叠加分割好的

dianlixunjian
滕嵩 2024-12-10 16:06:00 +08:00
parent f685ae67d7
commit 41e2a6391c
3 changed files with 76 additions and 21 deletions

View File

@ -1,6 +1,6 @@
<template>
<div>
<BasicTable @register="chooseUpdateRegisterTable">
<BasicTable @register="chooseUpdateRegisterTable" :loading="loading">
<template #toolbar>
<a-button type="success" @click="updateGeoTiff"></a-button>
</template>
@ -8,7 +8,7 @@
</div>
</template>
<script lang="ts" setup>
import { defineProps, defineEmits } from 'vue';
import { ref, defineProps, defineEmits, defineExpose } from 'vue';
import { BasicTable, useTable } from '@/components/Table';
import { chooseUpdateColumns } from './util';
import { useMessage } from '@/hooks/web/useMessage';
@ -18,12 +18,12 @@
const emit = defineEmits(['generateThumbnail']);
//
const [chooseUpdateRegisterTable, { reload, getSelectRows }] = useTable({
const [chooseUpdateRegisterTable, { reload, getSelectRows, clearSelectedRowKeys }] = useTable({
columns: chooseUpdateColumns,
dataSource: props.chooseUpdateData,
showIndexColumn: true,
rowSelection: {
type: 'radio',
type: 'checkbox',
},
canResize: true,
useSearchForm: false,
@ -54,9 +54,21 @@
};
//
const loading = ref(false);
function updateThumbnail(layerNames) {
loading.value = true;
emit('generateThumbnail', layerNames);
}
//
function clearSelect() {
clearSelectedRowKeys();
}
defineExpose({
loading,
clearSelect,
});
</script>
<style lang="less">
.content-full {

View File

@ -78,7 +78,11 @@
:footer="null"
@cancel="chooseUpdateClose"
>
<ChooseUpdate :chooseUpdateData="chooseUpdateData" @generateThumbnail="generateThumbnail" />
<ChooseUpdate
ref="chooseUpdateRef"
:chooseUpdateData="chooseUpdateData"
@generateThumbnail="generateThumbnail"
/>
</a-modal>
</div>
</template>
@ -230,12 +234,14 @@
}
// -------------------------------------------------------------------------------
// open
// refopen
const chooseUpdateRef = ref();
const chooseUpdateOpen = ref(false);
const chooseUpdateData: any = ref([]);
//
function chooseUpdateClose() {
chooseUpdateOpen.value = false;
chooseUpdateRef.value.clearSelect();
}
//
async function updateYearWeekThumbnail() {
@ -246,7 +252,9 @@
//
let uniqueKeysArray = [...new Set(res.items.map((item) => item.dateDir))];
// (-)
uniqueKeysArray = [...new Set(uniqueKeysArray.map(convertToYearWeek))];
uniqueKeysArray = [...new Set(uniqueKeysArray.map(convertToYearWeek))].sort(
(a, b) => dayjs(a) - dayjs(b),
);
// -
chooseUpdateData.value = [];
uniqueKeysArray.forEach((item, index) => {
@ -268,12 +276,18 @@
//
async function generateThumbnail(layerNames) {
GeoTiffManagerUpdateLayerGroupThumb({ layerGroups: layerNames, num: 10 }).then((res) => {
//
GeoTiffManagerUpdateLayerGroupThumb({ layerGroups: layerNames, num: 5 }).then((res) => {
if (res) {
createMessage.success('生成新的缩略图成功!');
chooseUpdateRef.value.clearSelect();
chooseUpdateRef.value.loading = false;
chooseUpdateOpen.value = false;
//
GeoTiffManagerUpdateLayerGroupThumb({ layerGroups: layerNames, num: 1 });
} else {
createMessage.error('生成新的缩略图失败!');
chooseUpdateRef.value.loading = false;
}
});
}

View File

@ -332,26 +332,47 @@
}
// -
const splitNum = 5;
function GeoTiffManagerRaster(chooseRows, lngLat, zoom, isMove, fillOpacity = 1) {
//
if (isMove) {
handlerLocation(lngLat, zoom);
}
chooseRows?.forEach((chooseRow, index) => {
if (
6 <= chooseRow.layerName.length &&
chooseRow.layerName.length <= 7 &&
chooseRow.layerName.charAt(4) == '-'
) {
//
//
const NUM = 10;
const LNG = Number(((119.27763051149853 - 117.34046403513817) / NUM).toFixed(5));
const LAT = Number(((36.263686454243626 - 34.331716698906675) / NUM).toFixed(5));
//
let fourpoint = [
[117.34046403513817, 36.263686454243626],
[119.27763051149853, 36.263686454243626],
[119.27763051149853, 34.331716698906675],
[117.34046403513817, 34.331716698906675],
];
map.addSource(chooseRow.layerName + '-image', {
type: 'image',
url: '/geoserver/group/' + chooseRow.layerName + '.png',
coordinates: fourpoint,
});
map.addLayer({
id: chooseRow.layerName + '-image',
type: 'raster',
source: chooseRow.layerName + '-image',
minzoom: 0,
maxzoom: 14,
});
if (map.getLayer('streetLayer')) {
map.moveLayer(chooseRow.layerName + '-image', 'streetLayer');
}
for (let x = 0; x < NUM; x++) {
for (let y = 0; y < NUM; y++) {
//
//
const LNG = Number(((119.27763051149853 - 117.34046403513817) / splitNum).toFixed(4));
const LAT = Number(((36.263686454243626 - 34.331716698906675) / splitNum).toFixed(4));
for (let x = 0; x < splitNum; x++) {
for (let y = 0; y < splitNum; y++) {
let fourpoint = [
[Number(117.34046403513817 + x * LNG), Number(34.331716698906675 + (y + 1) * LAT)],
[
@ -371,7 +392,7 @@
type: 'raster',
source: chooseRow.layerName + '-image-' + x + '-' + y,
minzoom: 0,
maxzoom: 15,
maxzoom: 16,
});
if (map.getLayer('streetLayer')) {
map.moveLayer(chooseRow.layerName + '-image-' + x + '-' + y, 'streetLayer');
@ -405,7 +426,7 @@
id: chooseRow.layerName,
type: 'raster',
source: chooseRow.layerName,
minzoom: 14,
minzoom: 13,
});
if (map.getLayer('streetLayer')) {
map.moveLayer(chooseRow.layerName, 'streetLayer');
@ -556,9 +577,14 @@
map.removeImage('diagonal-stripe');
}
//
const NUM = 10;
for (let x = 0; x < NUM; x++) {
for (let y = 0; y < NUM; y++) {
if (map.getLayer(layerName + '-image')) {
map.removeLayer(layerName + '-image');
}
if (map.getSource(layerName + '-image')) {
map.removeSource(layerName + '-image');
}
for (let x = 0; x < splitNum; x++) {
for (let y = 0; y < splitNum; y++) {
if (map.getLayer(layerName + '-image-' + x + '-' + y)) {
map.removeLayer(layerName + '-image-' + x + '-' + y);
}
@ -608,8 +634,11 @@
// map.on('click', function (e) {
// const zoom = map.getZoom();
// alert(':' + zoom);
// console.log(':', zoom);
// alert(':' + e.lngLat.lng + ',' + e.lngLat.lat);
// console.log(':', e.lngLat.lng, e.lngLat.lat);
// });
});
});