Skip to content

Commit a206a1d

Browse files
committed
2 parents ba9399a + 430abb7 commit a206a1d

File tree

26 files changed

+1962
-770
lines changed

26 files changed

+1962
-770
lines changed

dist/leaflet/include-leaflet.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@
147147
inputCSS(disturl + '/leaflet/iclient-leaflet.min.css');
148148
}
149149
if (inArray(includes, 'iclient-plot-leaflet')) {
150-
inputCSS(libsurl + '/plotting/leaflet/11.2.0/iclient-plot-leaflet.css');
150+
inputCSS(libsurl + '/plotting/leaflet/11.2.1/iclient-plot-leaflet.css');
151151
if (supportES6()) {
152-
inputScript(libsurl + '/plotting/leaflet/11.2.0/iclient-plot-leaflet-es6.min.js');
152+
inputScript(libsurl + '/plotting/leaflet/11.2.1/iclient-plot-leaflet-es6.min.js');
153153
} else {
154-
inputScript(libsurl + '/plotting/leaflet/11.2.0/iclient-plot-leaflet.min.js');
154+
inputScript(libsurl + '/plotting/leaflet/11.2.1/iclient-plot-leaflet.min.js');
155155
}
156156
}
157157
if (inArray(includes, 'ant-design-vue')) {

examples/js/plottingPanel/PlotMapPanel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ L.supermap.plotting.initPlotMapPanel = function(div, plotMapManager){
8787

8888
var activePlottingLayer = document.createElement("li");
8989
activePlottingLayer.id="activePlottingLayer";
90-
activePlottingLayer.innerText = resource.text_active;
90+
activePlottingLayer.innerText = resources.text_active;
9191
activePlottingLayer.style.margin = '1px 0';
9292
activePlottingLayer.style.padding = '0 5px';
9393
activePlottingLayer.style.cursor = 'pointer';
@@ -105,7 +105,7 @@ L.supermap.plotting.initPlotMapPanel = function(div, plotMapManager){
105105

106106
var activeChildPlotLayer = document.createElement("li");
107107
activeChildPlotLayer.id="activeChildPlotLayer";
108-
activeChildPlotLayer.innerText = resource.text_active;
108+
activeChildPlotLayer.innerText = resources.text_active;
109109
activeChildPlotLayer.style.margin = '1px 0';
110110
activeChildPlotLayer.style.padding = '0 5px';
111111
activeChildPlotLayer.style.cursor = 'pointer';

examples/js/plottingPanel/PublicStyleFunction.js

Lines changed: 259 additions & 92 deletions
Large diffs are not rendered by default.

examples/js/plottingPanel/StylePanel.js

Lines changed: 683 additions & 567 deletions
Large diffs are not rendered by default.

examples/leaflet/plot_filetransfer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ <h5 class='panel-title text-center' data-i18n="resources.title_filetransfer" sty
6767
function getSMLInfosSucess(evt){
6868
L.supermap.plotting.initSMLInfosPanel("filetree", evt.smlInfoList, function(clickSmlFileName){
6969
var result = sitDataManager.downloadSmlFileURL(clickSmlFileName);
70-
document.getElementById("downloadUrl").value = serverUrl + result;
70+
document.getElementById("downloadUrl").value = result;
7171
document.getElementById("smlFileName").value =clickSmlFileName;
7272
sitDataManager.openSmlFileOnServer(clickSmlFileName);
7373
})

examples/locales/en-US/resources.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2514,7 +2514,8 @@ window.examplesResources = {
25142514
"text_subLayer":"subLayer",
25152515
"text_setCurrentMapScaleToMintVisibleScale":"set current map scale to min visible scale",
25162516
"text_setCurrentMapScaleToMaxVisibleScale":"set current map scale to max visible scale",
2517-
"text_clearVisibleScaleSet":"clear visible scale set"
2517+
"text_clearVisibleScaleSet":"clear visible scale set",
2518+
"text_symbolAnnotations":"symbolAnnotations"
25182519
}
25192520
};
25202521

examples/locales/zh-CN/resources.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2489,7 +2489,8 @@ window.examplesResources = {
24892489
"text_subLayer":"子图层",
24902490
"text_setCurrentMapScaleToMintVisibleScale":"设置当前地图比例尺为最小可见比例尺",
24912491
"text_setCurrentMapScaleToMaxVisibleScale":"设置当前地图比例尺为最大可见比例尺",
2492-
"text_clearVisibleScaleSet":"清除可见比例尺设置"
2492+
"text_clearVisibleScaleSet":"清除可见比例尺设置",
2493+
"text_symbolAnnotations":"多注记"
24932494

24942495

24952496
}

src/common/mapping/MapStyle.js

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { WebMapService } from './WebMapService';
22
import { SourceListModelV2 } from './utils/SourceListModelV2';
3+
import { createAppreciableLayerId, isSameRasterLayer } from './utils/util';
34

45
export function createMapStyleExtending(SuperClass, { MapManager, mapRepo }) {
56
return class MapStyle extends SuperClass {
@@ -70,6 +71,10 @@ export function createMapStyleExtending(SuperClass, { MapManager, mapRepo }) {
7071
_addLayersToMap() {
7172
const { sources, layers, layerIdMapList } = this._setUniqueId(this.mapOptions.style);
7273
layers.forEach((layer) => {
74+
const matchRenameLayer = layerIdMapList.find(sub => sub.renderId === layer.id);
75+
if (matchRenameLayer && matchRenameLayer.reused) {
76+
return;
77+
}
7378
layer.source && !this.map.getSource(layer.source) && this.map.addSource(layer.source, sources[layer.source]);
7479
this.map.addLayer(layer);
7580
});
@@ -81,13 +86,15 @@ export function createMapStyleExtending(SuperClass, { MapManager, mapRepo }) {
8186
_setUniqueId(style) {
8287
const layersToMap = JSON.parse(JSON.stringify(style.layers));
8388
const nextSources = {};
89+
const sourcesIdChangedMap = {};
8490
const layerIdToChange = [];
8591
const timestamp = `_${+new Date()}`;
8692
for (const sourceId in style.sources) {
8793
let nextSourceId = sourceId;
8894
if (this.map.getSource(sourceId)) {
8995
nextSourceId = sourceId + timestamp;
9096
}
97+
sourcesIdChangedMap[nextSourceId] = sourceId;
9198
nextSources[nextSourceId] = style.sources[sourceId];
9299
for (const layer of layersToMap) {
93100
if (layer.source === sourceId) {
@@ -97,11 +104,22 @@ export function createMapStyleExtending(SuperClass, { MapManager, mapRepo }) {
97104
}
98105
for (const layer of layersToMap) {
99106
const originId = layer.id;
100-
if (this.map.getLayer(layer.id)) {
101-
const layerId = layer.id + timestamp;
102-
layer.id = layerId;
107+
let reused;
108+
const existLayer = this.map.getLayer(layer.id);
109+
if (existLayer) {
110+
// 此时用 getSource(xx).tiles 为空
111+
if (
112+
this.options.checkSameLayer &&
113+
isSameRasterLayer(nextSources[layer.source], this.map.getStyle().sources[existLayer.source])
114+
) {
115+
reused = true;
116+
layer.source = sourcesIdChangedMap[layer.source];
117+
} else {
118+
const layerId = layer.id + timestamp;
119+
layer.id = layerId;
120+
}
103121
}
104-
layerIdToChange.push({ originId: originId, renderId: layer.id });
122+
layerIdToChange.push({ originId: originId, renderId: layer.id, reused });
105123
}
106124
return {
107125
sources: nextSources,
@@ -112,7 +130,8 @@ export function createMapStyleExtending(SuperClass, { MapManager, mapRepo }) {
112130

113131
_generateAppreciableLayers() {
114132
return this.mapOptions.style.layers.reduce((layers, layer) => {
115-
const id = layer['source-layer'] || layer.source || layer.id;
133+
const nameLayer = layer['source-layer'] ? layer : { ...layer, layerInfo: { id: layer.id } };
134+
const id = createAppreciableLayerId(nameLayer);
116135
const matchLayer = layers.find(item => item.id === id);
117136
if (matchLayer) {
118137
matchLayer.renderLayers.push(layer.id);
@@ -122,7 +141,8 @@ export function createMapStyleExtending(SuperClass, { MapManager, mapRepo }) {
122141
...layer,
123142
id,
124143
name: matchRenameLayer && matchRenameLayer.originId,
125-
renderLayers: [layer.id]
144+
renderLayers: [layer.id],
145+
reused: matchRenameLayer && matchRenameLayer.reused
126146
});
127147
}
128148
return layers;

src/common/mapping/WebMapBase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@
266266
}
267267

268268
/**
269-
* @function WebMapBase.prototype.setRasterTileSize
269+
* @function WebMapBase.prototype.setStyle
270270
* @description 更新地图样式。
271271
* @param {Object} style - 地图 style 样式
272272
*/

src/common/mapping/WebMapService.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,12 +1200,8 @@ export class WebMapService {
12001200
maxFeatures: -1,
12011201
returnContent: true
12021202
});
1203-
if (baseProjection) {
1204-
if (baseProjection === 'EPSG:3857' || baseProjection === 'EPSG:-1000') {
1205-
getFeatureBySQLParams.targetEpsgCode = 4326;
1206-
} else {
1207-
getFeatureBySQLParams.targetEpsgCode = +baseProjection.split(':')[1];
1208-
}
1203+
if (baseProjection && baseProjection !== 'EPSG:4326') {
1204+
getFeatureBySQLParams.targetEpsgCode = 4326;
12091205
}
12101206
const proxy = this.handleProxy();
12111207
let options = {

0 commit comments

Comments
 (0)