媒体库-图片展示和图片历史路径 完整版

main
滕嵩 2 months ago
parent 027ed36300
commit 01dcf8cdc7

@ -39,7 +39,7 @@
/>
<img
v-if="record.objectKey && record.objectKey.includes('jpeg')"
:src="getImgurl(record.objectKey)"
:src="VITE_MEDIALIBRARY_IMAGE_URL + record.objectKey"
:width="30"
:height="20"
/>
@ -95,7 +95,8 @@
</a-tooltip>
<a-tooltip placement="top">
<template #title>
<span>查看地图图片历史路径</span>
<div>查看地图图片历史路径</div>
<div>只展示在地图上加载的图片</div>
</template>
<a-button
type="text"
@ -156,7 +157,7 @@
/>
<img
v-if="record.objectKey"
:src="getImgurl(record.objectKey)"
:src="VITE_MEDIALIBRARY_IMAGE_URL + record.objectKey"
:width="60"
:height="40"
@click="lookRecord(record)"
@ -210,11 +211,12 @@
@chooseNowPreviewRecord="chooseNowPreviewRecord"
@closeModal="closeModal"
@handleSuccess="handleSuccess"
@openPathModal="openPathModal"
/>
</a-modal>
<!-- 变化检测弹窗 -->
<!-- 路径地图弹窗 -->
<a-modal
v-model:open="comparisonOpen"
v-model:open="pathOpen"
width="100%"
wrap-class-name="full-modal"
:centered="true"
@ -225,11 +227,17 @@
:mask="false"
:maskClosable="false"
>
<Comparison @closeComparisonModal="closeComparisonModal" />
<Path
:allImageDataList="allImageDataList"
:nowShowImageData="nowShowImageData"
:floderName="floderName"
@closePathModal="closePathModal"
@handleSuccessPath="handleSuccessPath"
/>
</a-modal>
<!-- 路径地图弹窗 -->
<!-- 变化检测弹窗 -->
<a-modal
v-model:open="pathOpen"
v-model:open="comparisonOpen"
width="100%"
wrap-class-name="full-modal"
:centered="true"
@ -240,13 +248,7 @@
:mask="false"
:maskClosable="false"
>
<Path
:allImageDataList="allImageDataList"
:nowShowImageData="nowShowImageData"
:floderName="floderName"
@closePathModal="closePathModal"
@handleSuccessPath="handleSuccessPath"
/>
<Comparison @closeComparisonModal="closeComparisonModal" />
</a-modal>
</PageWrapper>
</template>
@ -456,16 +458,6 @@
showTableData.value = res;
});
}
//
function getImgurl(url) {
let uu = VITE_MEDIALIBRARY_IMAGE_URL + url;
// 使
// getImageDimensions(uu, function (dimensions) {
// console.log(': ' + dimensions.width);
// console.log(': ' + dimensions.height);
// });
return uu;
}
function getImageDimensions(url, callback) {
const img = new Image();
@ -734,7 +726,7 @@
arr.graffitiJson = [];
}
});
nowShowImageData.value = allImageDataList.value.filter((item) => item.id == record.id)[0];
nowShowImageData.value = allImageDataList.value.find((item) => item.id == record.id);
floderName.value = floders.value[floders.value.length - 1].name;
pathOpen.value = true;
});
@ -745,9 +737,9 @@
pathOpen.value = false;
}
//
function handleSuccessPath() {
function handleSuccessPath(value) {
setTimeout(() => {
openPathModal(nowShowImageData.value);
openPathModal(value);
reload();
}, 500);
}

@ -130,8 +130,12 @@
pathMapRef.value.handlerLocation([position.lng, position.lat]);
}
//
function handleSuccessPath() {
emits('handleSuccessPath');
function handleSuccessPath(value) {
emits('handleSuccessPath', value);
}
//
function openPathModal(value) {
emits('openPathModal', value);
}
</script>
<style lang="less" scoped>

@ -632,7 +632,7 @@
editNameFlag.value = true;
createMessage.success(res);
emits('funUpdateDisplayOrShowOnMapData', props.nowShowImageData);
emits('handleSuccessPath');
emits('handleSuccessPath', props.nowShowImageData);
});
}
function editNameBlur() {
@ -784,7 +784,7 @@
createMessage.success('在地图上取消加载成功');
}
emits('funUpdateDisplayOrShowOnMapData', props.nowShowImageData);
emits('handleSuccessPath');
emits('handleSuccessPath', props.nowShowImageData);
});
}
@ -848,7 +848,7 @@
}).then((res) => {
addFileTagsFlag.value = true;
newFileTagsName.value = '';
emits('handleSuccessPath');
emits('handleSuccessPath', props.nowShowImageData);
});
} else {
return createMessage.error('此标签已存在!');
@ -875,7 +875,7 @@
display: props.nowShowImageData.display,
showOnMap: props.nowShowImageData.showOnMap,
}).then((res) => {
emits('handleSuccessPath');
emits('handleSuccessPath', props.nowShowImageData);
});
},
onCancel: () => {},
@ -904,7 +904,7 @@
display: props.nowShowImageData.display,
showOnMap: props.nowShowImageData.showOnMap,
}).then((res) => {
emits('handleSuccessPath');
emits('handleSuccessPath', props.nowShowImageData);
});
}
//
@ -921,7 +921,7 @@
display: props.nowShowImageData.display,
showOnMap: props.nowShowImageData.showOnMap,
}).then((res) => {
emits('handleSuccessPath');
emits('handleSuccessPath', props.nowShowImageData);
});
}

@ -345,45 +345,6 @@
},
);
// watch(
// () => props.nowShowImageData,
// (newValue) => {
// if (newValue) {
// // -
// bottomPointGraphicData.forEach((graphicLayer) => {
// if (graphicLayer.options.id == newValue.id + '_bottom') {
// graphicLayer.show = newValue.display == 1 ? true : false;
// }
// });
// // -
// // flightointGraphicData.forEach((graphicLayer) => {
// // if (graphicLayer.options.id == newValue.id + '_flight') {
// // }
// // });
// // -线
// bottomImagePolylineGraphicData.forEach((graphicLayer) => {
// if (graphicLayer.options.id == newValue.id + '_polyline') {
// graphicLayer.show = newValue.display == 1 ? true : false;
// }
// });
// // -
// imageGraphicData.forEach((graphicLayer) => {
// if (graphicLayer.options.id == newValue.id + '_image') {
// graphicLayer.show = newValue.display == 1 ? true : false;
// graphicLayer.setStyle({
// label: {
// text: `${newValue.name}`,
// },
// });
// }
// });
// }
// },
// {
// deep: true,
// },
// );
// --------------------------------------------------------------------
// --
const showAllImageDataList = async () => {
@ -412,8 +373,7 @@
if (item.lng && item.lat && item.absoluteAltitude && item.showOnMap == 1) {
const image = new Image();
image.crossOrigin = 'Anonymous';
// image.src = item.preview_url;
// image.src = VITE_MEDIALIBRARY_IMAGE_URL + item.objectKey;
// image.src = VITE_MEDIALIBRARY_IMAGE_URL + item.minipic;
image.src =
'https://m.tuniucdn.com/fb2/t1/G5/M00/44/52/Cii-s1soezyIF2UxABn76u-yKl8AAIwBgB34jAAGfwC3020871';
image.onload = () => {

@ -1,210 +1,438 @@
<template>
<div :id="mapId" class="map">
<div ref="vChartRef" id="mars3d-container" class="mars3d-container">
<div class="mapInfo">
<span> {{ props.nowPreviewRecord.lat }}°N</span>
<span> {{ props.nowPreviewRecord.lng }}°E</span>
</div>
</div>
</template>
<script setup lang="ts">
import { defineProps, ref, onMounted, onUnmounted, defineEmits, watch } from 'vue';
import { v4 as uuidv4 } from 'uuid';
import mapboxgl, { Map } from 'mapbox-gl';
import { MapboxConfig, MapboxDefaultStyle } from '@/components/MapboxMaps/src/config';
import axios from 'axios';
import {
ExpandOutlined,
CompressOutlined,
PlusOutlined,
MinusOutlined,
HeatMapOutlined,
} from '@ant-design/icons-vue';
import { cloneDeep } from 'lodash-es';
<script lang="ts" setup>
import { ref, watch, onMounted, defineEmits } from 'vue';
import * as mars3d from 'mars3d';
import * as Cesium from 'mars3d-cesium';
import { getAppEnvConfig } from '@/utils/env';
const { VITE_MEDIALIBRARY_IMAGE_URL } = getAppEnvConfig();
const props = defineProps(['nowPreviewRecord', 'previewRecordList', 'hideOrShowTextboxFlag']);
const emit = defineEmits(['chooseNowPreviewRecord', 'reloadTable']);
const emits = defineEmits(['chooseNowPreviewRecord']);
let map: mars3d.Map; //
let graphicLayers = new mars3d.layer.GraphicLayer();
// -线
let bottomImagePolylineGraphicData: any = [];
// -
let imageGraphicData: any = [];
const vChartRef: any = ref<HTMLElement>();
onMounted(() => {
initMap();
});
// or
watch(
() => props.hideOrShowTextboxFlag,
(newValue) => {
imageGraphicData.forEach((graphic) => {
if (graphic.options.id !== props.nowPreviewRecord.id) {
graphic.setStyle({
show: newValue,
});
}
});
bottomImagePolylineGraphicData.forEach((graphic) => {
if (graphic.options.id !== props.nowPreviewRecord.id + '_polyline') {
graphic.setStyle({
show: newValue,
});
}
});
},
);
const mapId = `modal-map-${uuidv4()}`;
const networkType = ref('WAN');
let map: Map;
// or
watch(
() => props.nowPreviewRecord,
() => {
imageGraphicData.forEach((graphic) => {
if (graphic.options.id !== props.nowPreviewRecord.id) {
graphic.setStyle({
image: graphic.options.defaultImage,
show: props.hideOrShowTextboxFlag,
});
} else {
graphic.setStyle({
image: graphic.options.chooseImage,
show: true,
});
}
});
bottomImagePolylineGraphicData.forEach((graphic) => {
if (graphic.options.id !== props.nowPreviewRecord.id + '_polyline') {
graphic.setStyle({
show: props.hideOrShowTextboxFlag,
});
} else {
graphic.setStyle({
show: true,
});
}
});
},
);
const initMap = () => {
let mapDataSources: any = {
'raster-tiles': {
type: 'raster',
tiles: [
`http://t0.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${MapboxConfig.TDT_TOKEN}`,
],
tileSize: 256,
minzoom: 1,
maxzoom: 17,
map = new mars3d.Map(vChartRef.value, {
scene: {
center: {
lat: parseFloat(props.nowPreviewRecord.lat),
lng: parseFloat(props.nowPreviewRecord.lng),
alt: 8306.3,
heading: 360,
pitch: -45,
},
scene3DOnly: false,
shadows: false,
removeDblClick: true,
sceneMode: 3,
showSun: true,
showMoon: true,
showSkyBox: true,
showSkyAtmosphere: true,
fog: true,
fxaa: true,
requestRenderMode: true,
contextOptions: {
requestWebgl1: false,
webgl: {
preserveDrawingBuffer: true,
alpha: false,
stencil: true,
powerPreference: 'high-performance',
},
},
globe: {
depthTestAgainstTerrain: false,
baseColor: '#546a53',
showGroundAtmosphere: true,
enableLighting: false,
},
cameraController: {
zoomFactor: 3,
minimumZoomDistance: 1,
maximumZoomDistance: 50000000,
enableRotate: true,
enableTranslate: true,
enableTilt: true,
enableZoom: true,
enableCollisionDetection: true,
minimumCollisionTerrainHeight: 15000,
},
},
'raster-tiles-font': {
type: 'raster',
tiles: [
`https://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${MapboxConfig.TDT_TOKEN}`,
],
tileSize: 256,
control: {
homeButton: true,
baseLayerPicker: false,
sceneModePicker: false,
vrButton: false,
fullscreenButton: false,
navigationHelpButton: false,
animation: false,
timeline: false,
infoBox: false,
geocoder: false,
selectionIndicator: false,
showRenderLoopErrors: false,
contextmenu: {
hasDefault: false,
},
mouseDownView: false,
zoom: false,
compass: false,
distanceLegend: false,
},
};
let mapDataLayers: any = [
{
id: 'tdt-vec-tiles',
type: 'raster',
source: 'raster-tiles-font',
method: {
templateValues: {
dataServer: '//data.mars3d.cn',
gltfServerUrl: '//data.mars3d.cn/gltf',
},
},
{
id: 'tdt-img-tiles',
type: 'raster',
source: 'raster-tiles',
terrain: {
url: '//data.mars3d.cn/terrain',
show: true,
clip: true,
},
];
map = new mapboxgl.Map({
container: mapId,
language: 'zh-cmn',
projection: 'equirectangular', // wgs84
style: {
glyphs: 'mapbox://fonts/mapbox/{fontstack}/{range}.pbf',
version: 8,
sources: mapDataSources,
layers: mapDataLayers,
},
maxZoom: 22,
minZoom: 8,
pitch: 0,
zoom: 14,
center: [parseFloat(props.nowPreviewRecord.lng), parseFloat(props.nowPreviewRecord.lat)],
basemaps: [
{
id: 10,
name: '地图底图',
type: 'group',
opacity: 1,
},
{
id: 2021,
pid: 10,
name: '天地图影像',
icon: 'https://data.mars3d.cn/img/thumbnail/basemap/tdt_img.png',
type: 'group',
layers: [
{
name: '底图',
type: 'tdt',
layer: 'img_d',
eventParent: {
id: 2021,
pid: 10,
name: '天地图影像',
icon: 'https://data.mars3d.cn/img/thumbnail/basemap/tdt_img.png',
type: 'group',
layers: [
{
name: '底图',
type: 'tdt',
layer: 'img_d',
show: true,
},
{
name: '注记',
type: 'tdt',
layer: 'img_z',
show: true,
},
],
show: true,
},
private: false,
id: 'm-770c35e7-9054-4259-b5ee-c15f108becd0',
opacity: 1,
pid: 2021,
parent: {
id: 2021,
pid: 10,
name: '天地图影像',
icon: 'https://data.mars3d.cn/img/thumbnail/basemap/tdt_img.png',
type: 'group',
layers: [
{
name: '底图',
type: 'tdt',
layer: 'img_d',
show: true,
},
{
name: '注记',
type: 'tdt',
layer: 'img_z',
show: true,
},
],
show: true,
},
zIndex: 1,
},
{
name: '注记',
type: 'tdt',
layer: 'img_z',
eventParent: {
id: 2021,
pid: 10,
name: '天地图影像',
icon: 'https://data.mars3d.cn/img/thumbnail/basemap/tdt_img.png',
type: 'group',
layers: [
{
name: '底图',
type: 'tdt',
layer: 'img_d',
show: true,
},
{
name: '注记',
type: 'tdt',
layer: 'img_z',
show: true,
},
],
show: true,
},
private: false,
id: 'm-3b881368-574b-48a5-88b2-8b3c2c48fd62',
opacity: 1,
pid: 2021,
parent: {
id: 2021,
pid: 10,
name: '天地图影像',
icon: 'https://data.mars3d.cn/img/thumbnail/basemap/tdt_img.png',
type: 'group',
layers: [
{
name: '底图',
type: 'tdt',
layer: 'img_d',
show: true,
},
{
name: '注记',
type: 'tdt',
layer: 'img_z',
show: true,
},
],
show: true,
},
zIndex: 2,
},
],
show: true,
opacity: 1,
},
],
layers: [],
});
setImage();
if (map) {
map.addLayer(graphicLayers);
//
showAllImageDataList();
const position = Cesium.Cartesian3.fromDegrees(
parseFloat(props.nowPreviewRecord.lng),
parseFloat(props.nowPreviewRecord.lat),
);
map.flyToPoint(position);
}
};
watch(
() => props.hideOrShowTextboxFlag,
(newValue) => {
if (newValue) {
props.previewRecordList.forEach((item) => {
if (!map.getLayer(item.id)) {
const coordinates = [parseFloat(item.lng), parseFloat(item.lat)];
//
map.addLayer({
id: item.id,
type: 'symbol',
source: {
type: 'geojson',
data: {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: coordinates,
},
},
],
},
},
layout: {
'icon-image': item.id,
'icon-size': 40 / item.width,
//
'icon-allow-overlap': true, //
'icon-ignore-placement': true, //
visibility: 'visible', //
// --
const showAllImageDataList = async () => {
//
imageGraphicData?.forEach((graphicLayer) => {
graphicLayers.removeGraphic(graphicLayer);
});
bottomImagePolylineGraphicData?.forEach((graphicLayer) => {
graphicLayers.removeGraphic(graphicLayer);
});
//
imageGraphicData = [];
bottomImagePolylineGraphicData = [];
props.previewRecordList.forEach((item, index) => {
if (item.lng && item.lat && item.absoluteAltitude) {
const image = new Image();
image.crossOrigin = 'Anonymous';
// image.src = VITE_MEDIALIBRARY_IMAGE_URL + item.minipic;
image.src =
'https://m.tuniucdn.com/fb2/t1/G5/M00/44/52/Cii-s1soezyIF2UxABn76u-yKl8AAIwBgB34jAAGfwC3020871';
image.onload = () => {
// Canvas
const canvas = document.createElement('canvas');
canvas.width = 30;
canvas.height = 30;
// Canvas
const ctx = canvas.getContext('2d');
//
ctx.beginPath();
ctx.arc(15, 15, 20, 0, Math.PI * 2, true);
ctx.closePath();
ctx.clip(); //
ctx.fillStyle = '#ffffff00';
ctx?.fillRect(0, 0, canvas.width, canvas.height);
// Canvas
ctx.drawImage(image, 2, 2, 26, 26);
//
ctx.strokeStyle = '#ffffff';
ctx.lineWidth = 2;
ctx.strokeRect(1, 1, canvas.width - 2, canvas.height - 2);
// CanvasURL
const dataURL1 = canvas.toDataURL('image/png');
// CanvasimageImage
ctx.drawImage(image, 2, 2, 26, 26);
//
ctx.strokeStyle = '#2d8cef'; //
ctx.lineWidth = 2; //
//
ctx.strokeRect(1, 1, canvas.width - 2, canvas.height - 2); //
// CanvasURL
const dataURL2 = canvas.toDataURL('image/png');
//
let position = [
parseFloat(item.lng),
parseFloat(item.lat),
parseFloat(item.absoluteAltitude),
];
//
mars3d.PointUtil.getSurfaceHeight(
map.scene,
Cesium.Cartesian3.fromDegrees(position[0], position[1]),
).then((point) => {
// 线
let bottomImagePolylineGraphic = new mars3d.graphic.PolylineEntity({
id: item.id + '_polyline',
positions: [
Cesium.Cartesian3.fromDegrees(position[0], position[1], point.height),
Cesium.Cartesian3.fromDegrees(position[0], position[1], position[2]),
],
style: {
color: '#ffffff',
width: 1, // 线
clampToGround: false,
},
hasEdit: false,
});
}
});
} else {
let filters = cloneDeep(props.previewRecordList).filter(
(item) => item.id != props.nowPreviewRecord.id,
);
filters.forEach((fl) => {
if (map.getLayer(fl.id)) {
map.removeLayer(fl.id);
}
if (map.getSource(fl.id)) {
map.removeSource(fl.id);
}
});
}
},
);
function setImage() {
props.previewRecordList.forEach((item) => {
map.on('style.load', () => {
map.loadImage(item.url, (error, image) => {
if (error) {
console.error('加载图片失败:', error.message);
return;
}
if (!map.hasImage(item.id)) {
map.addImage(item.id, image);
}
const coordinates = [parseFloat(item.lng), parseFloat(item.lat)];
if (!map.getLayer(item.id)) {
//
map.addLayer({
//
let imageGraphic = new mars3d.graphic.BillboardEntity({
id: item.id,
type: 'symbol',
source: {
type: 'geojson',
data: {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: coordinates,
},
},
],
},
},
layout: {
'icon-image': item.id,
'icon-size': 40 / item.width,
//
'icon-allow-overlap': true, //
'icon-ignore-placement': true, //
visibility: 'visible', //
position: [position[0], position[1], position[2]],
style: {
image: item.id == props.nowPreviewRecord.id ? dataURL2 : dataURL1,
clampToGround: false,
scale: 1,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
},
hasEdit: false,
//
defaultImage: dataURL1,
//
chooseImage: dataURL2,
});
map.on('click', item.id, function (e) {
clickHandler(item);
//
imageGraphic.on(mars3d.EventType.click, function () {
if (props.nowPreviewRecord.id !== item.id) {
clickSetImage(item);
}
});
}
});
});
});
}
onMounted(() => {
mapboxgl.accessToken = MapboxConfig.ACCESS_TOKEN;
//
initMap();
});
onUnmounted(() => {
map && map.remove();
props.previewRecordList.forEach((item) => {
map.off('click', item.id, function (e) {
clickHandler(item);
});
//
graphicLayers.addGraphic(bottomImagePolylineGraphic);
graphicLayers.addGraphic(imageGraphic);
//
bottomImagePolylineGraphicData.push(bottomImagePolylineGraphic);
imageGraphicData.push(imageGraphic);
});
};
}
});
});
};
//
function clickHandler(item) {
emit('chooseNowPreviewRecord', item);
function clickSetImage(item) {
imageGraphicData.forEach((graphic) => {
if (graphic.options.id == item.id) {
graphic.setStyle({
image: graphic.options.chooseImage,
});
emits('chooseNowPreviewRecord', item);
} else {
graphic.setStyle({
image: graphic.options.defaultImage,
});
}
});
}
</script>
<style lang="less" scoped>
.map {
.mars3d-container {
position: relative;
width: 100%;
height: 100%;
@ -233,8 +461,4 @@
margin-left: 10px;
}
}
::v-deep .mapboxgl-ctrl {
display: none !important;
}
</style>

@ -45,6 +45,7 @@
@chooseNowPreviewRecord="chooseNowPreviewRecord"
@handleSuccess="handleSuccess"
:hideOrShowTextboxFlag="hideOrShowTextboxFlag"
@openPathModal="openPathModal"
/>
<PreviewVideoInformation
v-if="props.nowPreviewRecord.type == 'video'"
@ -68,7 +69,12 @@
} from './preview';
const props = defineProps(['nowPreviewRecord', 'previewRecordList']);
const emit = defineEmits(['closeModal', 'chooseNowPreviewRecord', 'handleSuccess']);
const emits = defineEmits([
'closeModal',
'chooseNowPreviewRecord',
'handleSuccess',
'openPathModal',
]);
const hideOrShowTextboxFlag = ref(true);
function setHideOrShowTextboxFlag(value) {
@ -77,16 +83,20 @@
//
function chooseNowPreviewRecord(value) {
emit('chooseNowPreviewRecord', value);
emits('chooseNowPreviewRecord', value);
}
//
function handleSuccess(record = null) {
emit('handleSuccess', record);
emits('handleSuccess', record);
}
//
function closeModal() {
document.body.style.cursor = 'default';
emit('closeModal');
emits('closeModal');
}
//
function openPathModal(value) {
emits('openPathModal', value);
}
</script>
<style lang="less" scoped>

@ -1,321 +0,0 @@
<template>
<div ref="vChartRef" id="mars3d-container" class="mars3d-container">
<div class="mapInfo">
<span> {{ props.nowPreviewRecord.lat }}°N</span>
<span> {{ props.nowPreviewRecord.lng }}°E</span>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref, onMounted, defineEmits } from 'vue';
import * as mars3d from 'mars3d';
import * as Cesium from 'mars3d-cesium';
const props = defineProps(['nowPreviewRecord', 'previewRecordList', 'hideOrShowTextboxFlag']);
const emits = defineEmits(['chooseNowPreviewRecord', 'reloadTable', 'mapOnLoad']);
let map: mars3d.Map; //
let graphicData: any = [];
let graphicLayers = new mars3d.layer.GraphicLayer();
const vChartRef: any = ref<HTMLElement>();
onMounted(() => {
initMap();
addImage();
});
const initMap = () => {
map = new mars3d.Map(vChartRef.value, {
scene: {
center: {
lat: parseFloat(props.nowPreviewRecord.lat),
lng: parseFloat(props.nowPreviewRecord.lng),
alt: 8306.3,
heading: 360,
pitch: -45,
},
scene3DOnly: false,
shadows: false,
removeDblClick: true,
sceneMode: 3,
showSun: true,
showMoon: true,
showSkyBox: true,
showSkyAtmosphere: true,
fog: true,
fxaa: true,
requestRenderMode: true,
contextOptions: {
requestWebgl1: false,
webgl: {
preserveDrawingBuffer: true,
alpha: false,
stencil: true,
powerPreference: 'high-performance',
},
},
globe: {
depthTestAgainstTerrain: false,
baseColor: '#546a53',
showGroundAtmosphere: true,
enableLighting: false,
},
cameraController: {
zoomFactor: 3,
minimumZoomDistance: 1,
maximumZoomDistance: 50000000,
enableRotate: true,
enableTranslate: true,
enableTilt: true,
enableZoom: true,
enableCollisionDetection: true,
minimumCollisionTerrainHeight: 15000,
},
},
control: {
homeButton: true,
baseLayerPicker: false,
sceneModePicker: false,
vrButton: false,
fullscreenButton: false,
navigationHelpButton: false,
animation: false,
timeline: false,
infoBox: false,
geocoder: false,
selectionIndicator: false,
showRenderLoopErrors: false,
contextmenu: {
hasDefault: false,
},
mouseDownView: false,
zoom: false,
compass: false,
distanceLegend: false,
},
method: {
templateValues: {
dataServer: '//data.mars3d.cn',
gltfServerUrl: '//data.mars3d.cn/gltf',
},
},
terrain: {
url: '//data.mars3d.cn/terrain',
show: true,
clip: true,
},
basemaps: [
{
id: 10,
name: '地图底图',
type: 'group',
opacity: 1,
},
{
id: 2021,
pid: 10,
name: '天地图影像',
icon: 'https://data.mars3d.cn/img/thumbnail/basemap/tdt_img.png',
type: 'group',
layers: [
{
name: '底图',
type: 'tdt',
layer: 'img_d',
eventParent: {
id: 2021,
pid: 10,
name: '天地图影像',
icon: 'https://data.mars3d.cn/img/thumbnail/basemap/tdt_img.png',
type: 'group',
layers: [
{
name: '底图',
type: 'tdt',
layer: 'img_d',
show: true,
},
{
name: '注记',
type: 'tdt',
layer: 'img_z',
show: true,
},
],
show: true,
},
private: false,
id: 'm-770c35e7-9054-4259-b5ee-c15f108becd0',
opacity: 1,
pid: 2021,
parent: {
id: 2021,
pid: 10,
name: '天地图影像',
icon: 'https://data.mars3d.cn/img/thumbnail/basemap/tdt_img.png',
type: 'group',
layers: [
{
name: '底图',
type: 'tdt',
layer: 'img_d',
show: true,
},
{
name: '注记',
type: 'tdt',
layer: 'img_z',
show: true,
},
],
show: true,
},
zIndex: 1,
},
{
name: '注记',
type: 'tdt',
layer: 'img_z',
eventParent: {
id: 2021,
pid: 10,
name: '天地图影像',
icon: 'https://data.mars3d.cn/img/thumbnail/basemap/tdt_img.png',
type: 'group',
layers: [
{
name: '底图',
type: 'tdt',
layer: 'img_d',
show: true,
},
{
name: '注记',
type: 'tdt',
layer: 'img_z',
show: true,
},
],
show: true,
},
private: false,
id: 'm-3b881368-574b-48a5-88b2-8b3c2c48fd62',
opacity: 1,
pid: 2021,
parent: {
id: 2021,
pid: 10,
name: '天地图影像',
icon: 'https://data.mars3d.cn/img/thumbnail/basemap/tdt_img.png',
type: 'group',
layers: [
{
name: '底图',
type: 'tdt',
layer: 'img_d',
show: true,
},
{
name: '注记',
type: 'tdt',
layer: 'img_z',
show: true,
},
],
show: true,
},
zIndex: 2,
},
],
show: true,
opacity: 1,
},
],
layers: [],
});
emits('mapOnLoad', map);
};
const addImage = () => {
//
graphicData?.forEach((graphicLayer) => {
graphicLayers.removeGraphic(graphicLayer);
});
//
map.addLayer(graphicLayers);
//
graphicData = [];
props.previewRecordList.forEach((item) => {
let graphic = new mars3d.graphic.BillboardEntity({
id: item.id,
position: [parseFloat(item.lng), parseFloat(item.lat)],
style: {
// image: '@/assets/images/point.png',
image: '../point.png',
clampToGround: true,
scale: 1,
label: {
text: item.name,
font_size: 12,
color: '#ffffff',
pixelOffsetY: -30,
pixelOffsetX: 0,
distanceDisplayCondition: true,
distanceDisplayCondition_far: 6000,
distanceDisplayCondition_near: 0,
},
},
popup: `<div class="marsTiltPanel marsTiltPanel-theme-green">
<div style="postion: relative; padding: 60px; max-width: 500px; overflow: hidden;">
</div>
<div style="position: absolute; bottom: 0; left: 0; width: 85px; height: 2px; transform: rotate(-45deg) translate(15px, -25px); background-color: #15babc;" ></div>
</div>`,
popupOptions: {
offsetY: 0,
offsetX: 0,
template: '{content}',
horizontalOrigin: 'Cesium.HorizontalOrigin.LEFT',
verticalOrigin: 'Cesium.VerticalOrigin.CENTER',
},
pointerEvents: true,
});
//
graphicLayers.addGraphic(graphic);
graphicData.push(graphic);
});
};
</script>
<style lang="less" scoped>
.mars3d-container {
position: relative;
width: 100%;
height: 100%;
}
.mapInfo {
position: absolute;
width: 100%;
height: 30px;
bottom: 0px;
left: 0px;
background: #3d3f3aaa;
z-index: 1000;
display: flex;
justify-content: flex-start;
span {
height: 100%;
width: 30%;
color: #ffffff;
display: flex;
align-items: center;
justify-content: flex-start;
font-size: 15px;
margin-left: 10px;
}
}
</style>

@ -2,5 +2,4 @@ export { default as PreviewImage } from './previewImage.vue';
export { default as PreviewVideo } from './previewVideo.vue';
export { default as PreviewImageInformation } from './previewImageInformation.vue';
export { default as PreviewVideoInformation } from './previewVideoInformation.vue';
// export { default as Map } from './Map.vue';
export { default as Map } from './map2.vue';
export { default as Map } from './map.vue';

@ -189,17 +189,22 @@
</a-col>
<a-col :span="17">
<span class="infobutton">
<EnvironmentOutlined
v-if="props.nowPreviewRecord.showOnMap == 1"
style="font-size: 20px; color: #07aaed"
@click="flyPoint"
/>
<a-tooltip placement="top">
<template #title>
<div>查看地图图片历史路径</div>
<div>只展示在地图上加载的图片</div>
</template>
<EnvironmentOutlined
v-if="props.nowPreviewRecord.showOnMap == 1"
style="font-size: 20px; color: #07aaed"
@click="openPathModal"
/>
</a-tooltip>
</span>
</a-col>
<a-col :span="24">
<div class="map">
<Map
ref="mapRef"
:nowPreviewRecord="props.nowPreviewRecord"
:previewRecordList="props.previewRecordList"
@chooseNowPreviewRecord="chooseNowPreviewRecord"
@ -231,7 +236,7 @@
const { createMessage, createConfirm } = useMessage();
const props = defineProps(['nowPreviewRecord', 'previewRecordList', 'hideOrShowTextboxFlag']);
const emits = defineEmits(['chooseNowPreviewRecord', 'handleSuccess']);
const emits = defineEmits(['chooseNowPreviewRecord', 'handleSuccess', 'openPathModal']);
// --------------------------------
const editNameFlag = ref(true);
@ -359,10 +364,9 @@
emits('chooseNowPreviewRecord', value);
}
// --------------------------------
const mapRef = ref();
function flyPoint() {
mapRef.value?.flyToPoint([props.nowPreviewRecord.lng, props.nowPreviewRecord.lat]);
//
function openPathModal() {
emits('openPathModal', props.nowPreviewRecord);
}
</script>
<style lang="less" scoped>

Loading…
Cancel
Save