Skip to content

Commit 1016f0a

Browse files
[fix]修改l7例子
1 parent d0f608b commit 1016f0a

8 files changed

Lines changed: 18630 additions & 22709 deletions

File tree

‎dist/mapboxgl/include-mapboxgl.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
inputScript(libsurl + '/mapbox-gl-js-enhance/1.12.1-3/mapbox-gl-enhance.js');
6464
}
6565
if (inArray(includes, 'L7')) {
66-
inputScript('../../dist/maplibregl/l7-dev.js');
66+
inputScript(disturl + '/mapboxgl/l7-dev.js');
6767
}
6868
if (inArray(includes, 'g2')) {
6969
inputScript('https://cdnjs.cloudflare.com/ajax/libs/antv-g2/4.2.8/g2.min.js');

‎dist/mapboxgl/l7-dev.js‎

Lines changed: 8356 additions & 10567 deletions
Large diffs are not rendered by default.

‎dist/maplibregl/l7-dev.js‎

Lines changed: 10139 additions & 11996 deletions
Large diffs are not rendered by default.

‎examples/mapboxgl/l7_grid_map.html‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@
3131
<div id="map"></div>
3232
<script type="text/javascript" include="L7" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
3333
<script type="text/javascript">
34-
var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
35-
var attribution =
36-
"<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" +
37-
" with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" +
38-
" Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> ";
39-
40-
var tileURL = host + '/iserver/services/map-china400/rest/maps/ChinaDark/zxyTileImage.png?z={z}&x={x}&y={y}';
4134
var map = new mapboxgl.Map({
4235
container: 'map',
4336
center: [113, 29],

‎examples/mapboxgl/l7_temperature_icon_annotation.html‎

Lines changed: 67 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -88,77 +88,79 @@
8888
];
8989

9090
scene.addFontFace(fontFamily, fontPath);
91-
fetch('../data/94763191-2816-4c1a-8d0d-8bcf4181056a.json')
92-
.then((res) => res.json())
93-
.then((data) => {
94-
var layer = new mapboxgl.supermap.L7Layer({
95-
type: 'PolygonLayer',
96-
options: { name: 'fill' }
97-
});
98-
var l7Layer = layer.getL7Layer();
99-
l7Layer
100-
.source(data)
101-
.shape('fill')
102-
.color('count', ['#f2f0f7', '#dadaeb', '#bcbddc', '#9e9ac8', '#756bb1', '#54278f'])
103-
.style({
104-
opacity: 0.6,
105-
opacityLinear: {
106-
enable: true,
107-
dir: 'out' // in - out
108-
}
91+
scene.once('fontloaded', () => {
92+
fetch('../data/94763191-2816-4c1a-8d0d-8bcf4181056a.json')
93+
.then((res) => res.json())
94+
.then((data) => {
95+
var layer = new mapboxgl.supermap.L7Layer({
96+
type: 'PolygonLayer',
97+
options: { name: 'fill' }
10998
});
110-
map.addLayer(layer);
99+
var l7Layer = layer.getL7Layer();
100+
l7Layer
101+
.source(data)
102+
.shape('fill')
103+
.color('count', ['#f2f0f7', '#dadaeb', '#bcbddc', '#9e9ac8', '#756bb1', '#54278f'])
104+
.style({
105+
opacity: 0.6,
106+
opacityLinear: {
107+
enable: true,
108+
dir: 'out' // in - out
109+
}
110+
});
111+
map.addLayer(layer);
111112

112-
const linelayer = new mapboxgl.supermap.L7Layer({
113-
type: 'LineLayer',
114-
options: { name: 'line2' }
115-
});
116-
linelayer.getL7Layer().source(data).shape('line').size(1).color('#fff').style({
117-
opacity: 0.3
118-
});
119-
map.addLayer(linelayer);
113+
const linelayer = new mapboxgl.supermap.L7Layer({
114+
type: 'LineLayer',
115+
options: { name: 'line2' }
116+
});
117+
linelayer.getL7Layer().source(data).shape('line').size(1).color('#fff').style({
118+
opacity: 0.3
119+
});
120+
map.addLayer(linelayer);
120121

121-
const pointLayer = new mapboxgl.supermap.L7Layer({
122-
type: 'PointLayer'
123-
});
124-
pointLayer
125-
.getL7Layer()
126-
.source(data)
127-
.shape('icon', 'text')
128-
.size(25)
129-
.color('count', (t) => {
130-
const c = Number(t.replace('℃', ''));
131-
return colors[Math.floor(((c - 18) / 16) * 10)];
132-
})
133-
.style({
134-
textAnchor: 'center',
135-
textOffset: [-25, 15],
136-
padding: [2, 2],
137-
fontFamily,
138-
iconfont: true,
139-
textAllowOverlap: true
122+
const pointLayer = new mapboxgl.supermap.L7Layer({
123+
type: 'PointLayer'
140124
});
141-
map.addLayer(pointLayer);
125+
pointLayer
126+
.getL7Layer()
127+
.source(data)
128+
.shape('icon', 'text')
129+
.size(25)
130+
.color('count', (t) => {
131+
const c = Number(t.replace('℃', ''));
132+
return colors[Math.floor(((c - 18) / 16) * 10)];
133+
})
134+
.style({
135+
textAnchor: 'center',
136+
textOffset: [-25, 15],
137+
padding: [2, 2],
138+
fontFamily,
139+
iconfont: true,
140+
textAllowOverlap: true
141+
});
142+
map.addLayer(pointLayer);
142143

143-
const tempertureLayer = new mapboxgl.supermap.L7Layer({
144-
type: 'PointLayer'
145-
});
146-
tempertureLayer
147-
.getL7Layer()
148-
.source(data)
149-
.shape('count', 'text')
150-
.size(12)
151-
.color('count', (t) => {
152-
const c = Number(t.replace('℃', ''));
153-
return colors[Math.floor(((c - 18) / 16) * 10)];
154-
})
155-
.style({
156-
textAnchor: 'center',
157-
textOffset: [35, 30],
158-
padding: [1, 1]
144+
const tempertureLayer = new mapboxgl.supermap.L7Layer({
145+
type: 'PointLayer'
159146
});
160-
map.addLayer(tempertureLayer);
161-
});
147+
tempertureLayer
148+
.getL7Layer()
149+
.source(data)
150+
.shape('count', 'text')
151+
.size(12)
152+
.color('count', (t) => {
153+
const c = Number(t.replace('℃', ''));
154+
return colors[Math.floor(((c - 18) / 16) * 10)];
155+
})
156+
.style({
157+
textAnchor: 'center',
158+
textOffset: [35, 30],
159+
padding: [1, 1]
160+
});
161+
map.addLayer(tempertureLayer);
162+
});
163+
});
162164
});
163165
});
164166
</script>

‎examples/maplibregl/l7_grid_map.html‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@
3131
<div id="map"></div>
3232
<script type="text/javascript" include="L7" src="../../dist/maplibregl/include-maplibregl.js"></script>
3333
<script type="text/javascript">
34-
var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
35-
var attribution =
36-
"<a href='https://maplibre.org/' target='_blank'>© MapLibre </a>" +
37-
" with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" +
38-
" Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> ";
39-
40-
var tileURL = host + '/iserver/services/map-china400/rest/maps/ChinaDark/zxyTileImage.png?z={z}&x={x}&y={y}';
4134
var map = new maplibregl.Map({
4235
container: 'map',
4336
center: [113, 29],

‎examples/maplibregl/l7_temperature_icon_annotation.html‎

Lines changed: 67 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -88,77 +88,79 @@
8888
];
8989

9090
scene.addFontFace(fontFamily, fontPath);
91-
fetch('../data/94763191-2816-4c1a-8d0d-8bcf4181056a.json')
92-
.then((res) => res.json())
93-
.then((data) => {
94-
var layer = new maplibregl.supermap.L7Layer({
95-
type: 'PolygonLayer',
96-
options: { name: 'fill' }
97-
});
98-
var l7Layer = layer.getL7Layer();
99-
l7Layer
100-
.source(data)
101-
.shape('fill')
102-
.color('count', ['#f2f0f7', '#dadaeb', '#bcbddc', '#9e9ac8', '#756bb1', '#54278f'])
103-
.style({
104-
opacity: 0.6,
105-
opacityLinear: {
106-
enable: true,
107-
dir: 'out' // in - out
108-
}
91+
scene.once('fontloaded', () => {
92+
fetch('../data/94763191-2816-4c1a-8d0d-8bcf4181056a.json')
93+
.then((res) => res.json())
94+
.then((data) => {
95+
var layer = new maplibregl.supermap.L7Layer({
96+
type: 'PolygonLayer',
97+
options: { name: 'fill' }
10998
});
110-
map.addLayer(layer);
99+
var l7Layer = layer.getL7Layer();
100+
l7Layer
101+
.source(data)
102+
.shape('fill')
103+
.color('count', ['#f2f0f7', '#dadaeb', '#bcbddc', '#9e9ac8', '#756bb1', '#54278f'])
104+
.style({
105+
opacity: 0.6,
106+
opacityLinear: {
107+
enable: true,
108+
dir: 'out' // in - out
109+
}
110+
});
111+
map.addLayer(layer);
111112

112-
const linelayer = new maplibregl.supermap.L7Layer({
113-
type: 'LineLayer',
114-
options: { name: 'line2' }
115-
});
116-
linelayer.getL7Layer().source(data).shape('line').size(1).color('#fff').style({
117-
opacity: 0.3
118-
});
119-
map.addLayer(linelayer);
113+
const linelayer = new maplibregl.supermap.L7Layer({
114+
type: 'LineLayer',
115+
options: { name: 'line2' }
116+
});
117+
linelayer.getL7Layer().source(data).shape('line').size(1).color('#fff').style({
118+
opacity: 0.3
119+
});
120+
map.addLayer(linelayer);
120121

121-
const pointLayer = new maplibregl.supermap.L7Layer({
122-
type: 'PointLayer'
123-
});
124-
pointLayer
125-
.getL7Layer()
126-
.source(data)
127-
.shape('icon', 'text')
128-
.size(25)
129-
.color('count', (t) => {
130-
const c = Number(t.replace('℃', ''));
131-
return colors[Math.floor(((c - 18) / 16) * 10)];
132-
})
133-
.style({
134-
textAnchor: 'center',
135-
textOffset: [-25, 15],
136-
padding: [2, 2],
137-
fontFamily,
138-
iconfont: true,
139-
textAllowOverlap: true
122+
const pointLayer = new maplibregl.supermap.L7Layer({
123+
type: 'PointLayer'
140124
});
141-
map.addLayer(pointLayer);
125+
pointLayer
126+
.getL7Layer()
127+
.source(data)
128+
.shape('icon', 'text')
129+
.size(25)
130+
.color('count', (t) => {
131+
const c = Number(t.replace('℃', ''));
132+
return colors[Math.floor(((c - 18) / 16) * 10)];
133+
})
134+
.style({
135+
textAnchor: 'center',
136+
textOffset: [-25, 15],
137+
padding: [2, 2],
138+
fontFamily,
139+
iconfont: true,
140+
textAllowOverlap: true
141+
});
142+
map.addLayer(pointLayer);
142143

143-
const tempertureLayer = new maplibregl.supermap.L7Layer({
144-
type: 'PointLayer'
145-
});
146-
tempertureLayer
147-
.getL7Layer()
148-
.source(data)
149-
.shape('count', 'text')
150-
.size(12)
151-
.color('count', (t) => {
152-
const c = Number(t.replace('℃', ''));
153-
return colors[Math.floor(((c - 18) / 16) * 10)];
154-
})
155-
.style({
156-
textAnchor: 'center',
157-
textOffset: [35, 30],
158-
padding: [1, 1]
144+
const tempertureLayer = new maplibregl.supermap.L7Layer({
145+
type: 'PointLayer'
159146
});
160-
map.addLayer(tempertureLayer);
161-
});
147+
tempertureLayer
148+
.getL7Layer()
149+
.source(data)
150+
.shape('count', 'text')
151+
.size(12)
152+
.color('count', (t) => {
153+
const c = Number(t.replace('℃', ''));
154+
return colors[Math.floor(((c - 18) / 16) * 10)];
155+
})
156+
.style({
157+
textAnchor: 'center',
158+
textOffset: [35, 30],
159+
padding: [1, 1]
160+
});
161+
map.addLayer(tempertureLayer);
162+
});
163+
});
162164
});
163165
});
164166
</script>

‎src/common/overlay/l7/L7Extend.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export function getL7Scene(map, type = 'Maplibre') {
88
return new L7.Scene({
99
id: map.getContainer().id,
1010
pickBufferScale: 1.0,
11-
isIClient: true,
1211
map: new L7[type]({
1312
mapInstance: map
1413
})

0 commit comments

Comments
 (0)