From 16c659a42d8177f9ccee6e8558bf3ed2768dda3e Mon Sep 17 00:00:00 2001 From: fengyarnom Date: Mon, 30 Jun 2025 10:14:31 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feature:=20=E6=96=B0=E5=A2=9E=E5=9C=B0?= =?UTF-8?q?=E5=BD=A2=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/page/device_overview.html | 96 ++++++++++++++----- 1 file changed, 70 insertions(+), 26 deletions(-) diff --git a/sec-beidou/src/main/resources/templates/page/device_overview.html b/sec-beidou/src/main/resources/templates/page/device_overview.html index 1cbd0819..4da48244 100644 --- a/sec-beidou/src/main/resources/templates/page/device_overview.html +++ b/sec-beidou/src/main/resources/templates/page/device_overview.html @@ -231,6 +231,8 @@ @@ -371,15 +373,10 @@ imageTile.getImage().onerror = function() { // 天地图加载失败时切换到高德地图 var mapTypeSelect = document.getElementById('mapTypeSelect'); - if(mapTypeSelect.value === 'tianditu_satellite') { - mapTypeSelect.value = 'amap_satellite'; - switchMapType('amap_satellite'); - layer.msg('天地图卫星图加载失败,已自动切换到高德卫星图'); - layui.form.render('select'); - } else if(mapTypeSelect.value === 'tianditu_normal') { + if(mapTypeSelect.value.startsWith('tianditu_')) { mapTypeSelect.value = 'amap'; switchMapType('amap'); - layer.msg('天地图矢量图加载失败,已自动切换到高德矢量图'); + layer.msg('天地图加载失败,已自动切换到高德地图'); layui.form.render('select'); } }; @@ -394,15 +391,10 @@ imageTile.getImage().onerror = function() { // 天地图加载失败时切换到高德地图 var mapTypeSelect = document.getElementById('mapTypeSelect'); - if(mapTypeSelect.value === 'tianditu_satellite') { - mapTypeSelect.value = 'amap_satellite'; - switchMapType('amap_satellite'); - layer.msg('天地图卫星图加载失败,已自动切换到高德卫星图'); - layui.form.render('select'); - } else if(mapTypeSelect.value === 'tianditu_normal') { + if(mapTypeSelect.value.startsWith('tianditu_')) { mapTypeSelect.value = 'amap'; switchMapType('amap'); - layer.msg('天地图矢量图加载失败,已自动切换到高德矢量图'); + layer.msg('天地图加载失败,已自动切换到高德地图'); layui.form.render('select'); } }; @@ -421,15 +413,10 @@ imageTile.getImage().onerror = function() { // 天地图加载失败时切换到高德地图 var mapTypeSelect = document.getElementById('mapTypeSelect'); - if(mapTypeSelect.value === 'tianditu_satellite') { - mapTypeSelect.value = 'amap_satellite'; - switchMapType('amap_satellite'); - layer.msg('天地图卫星图加载失败,已自动切换到高德卫星图'); - layui.form.render('select'); - } else if(mapTypeSelect.value === 'tianditu_normal') { + if(mapTypeSelect.value.startsWith('tianditu_')) { mapTypeSelect.value = 'amap'; switchMapType('amap'); - layer.msg('天地图矢量图加载失败,已自动切换到高德矢量图'); + layer.msg('天地图加载失败,已自动切换到高德地图'); layui.form.render('select'); } }; @@ -444,12 +431,29 @@ imageTile.getImage().onerror = function() { // 天地图加载失败时切换到高德地图 var mapTypeSelect = document.getElementById('mapTypeSelect'); - if(mapTypeSelect.value === 'tianditu_satellite') { - mapTypeSelect.value = 'amap_satellite'; - switchMapType('amap_satellite'); - layer.msg('天地图卫星图加载失败,已自动切换到高德卫星图'); + if(mapTypeSelect.value.startsWith('tianditu_')) { + mapTypeSelect.value = 'amap'; + switchMapType('amap'); + layer.msg('天地图加载失败,已自动切换到高德地图'); layui.form.render('select'); - } else if(mapTypeSelect.value === 'tianditu_normal') { + } + }; + } + }) + }) + ] + }), + tianditu_terrain: new ol.layer.Group({ + layers: [ + new ol.layer.Tile({ + source: new ol.source.XYZ({ + url: 'https://t{0-7}.tianditu.gov.cn/ter_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ter&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=' + TIANDITU_KEY, + tileLoadFunction: function(imageTile, src) { + imageTile.getImage().src = src; + imageTile.getImage().onerror = function() { + // 天地图加载失败时切换到高德地图 + var mapTypeSelect = document.getElementById('mapTypeSelect'); + if(mapTypeSelect.value.startsWith('tianditu_')) { mapTypeSelect.value = 'amap'; switchMapType('amap'); layer.msg('天地图矢量图加载失败,已自动切换到高德矢量图'); @@ -460,6 +464,46 @@ }) }) ] + }), + tianditu_terrain_hybrid: new ol.layer.Group({ + layers: [ + new ol.layer.Tile({ + source: new ol.source.XYZ({ + url: 'https://t{0-7}.tianditu.gov.cn/ter_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ter&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=' + TIANDITU_KEY, + tileLoadFunction: function(imageTile, src) { + imageTile.getImage().src = src; + imageTile.getImage().onerror = function() { + // 天地图加载失败时切换到高德地图 + var mapTypeSelect = document.getElementById('mapTypeSelect'); + if(mapTypeSelect.value.startsWith('tianditu_')) { + mapTypeSelect.value = 'amap'; + switchMapType('amap'); + layer.msg('天地图加载失败,已自动切换到高德地图'); + layui.form.render('select'); + } + }; + } + }) + }), + new ol.layer.Tile({ + source: new ol.source.XYZ({ + url: 'https://t{0-7}.tianditu.gov.cn/cta_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cta&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=' + TIANDITU_KEY, + tileLoadFunction: function(imageTile, src) { + imageTile.getImage().src = src; + imageTile.getImage().onerror = function() { + // 天地图加载失败时切换到高德地图 + var mapTypeSelect = document.getElementById('mapTypeSelect'); + if(mapTypeSelect.value.startsWith('tianditu_')) { + mapTypeSelect.value = 'amap'; + switchMapType('amap'); + layer.msg('天地图加载失败,已自动切换到高德地图'); + layui.form.render('select'); + } + }; + } + }) + }) + ] }) }; From 0d21c8c6f3f877b7c88f7732a7f43c91b28cd117 Mon Sep 17 00:00:00 2001 From: fengyarnom Date: Mon, 30 Jun 2025 10:18:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feature:=20=E4=BC=98=E5=85=88=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E5=9C=B0=E5=BD=A2=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/templates/page/device_overview.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sec-beidou/src/main/resources/templates/page/device_overview.html b/sec-beidou/src/main/resources/templates/page/device_overview.html index 4da48244..e7965680 100644 --- a/sec-beidou/src/main/resources/templates/page/device_overview.html +++ b/sec-beidou/src/main/resources/templates/page/device_overview.html @@ -229,10 +229,10 @@