Skip to content

Commit

Permalink
[fix]mapboxgl l7支持多坐标系,listLayers图层顺序 review by qiw
Browse files Browse the repository at this point in the history
  • Loading branch information
luoxiao-supermap committed Apr 25, 2024
1 parent 1016f0a commit b3b5dce
Show file tree
Hide file tree
Showing 95 changed files with 783 additions and 500 deletions.
2 changes: 0 additions & 2 deletions build/webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ module.exports = {
echarts: 'function(){try{return echarts}catch(e){return {}}}()',
mapv: 'function(){try{return mapv}catch(e){return {}}}()',
'@antv/g6': 'function(){try{return G6}catch(e){return {}}}()',
'@antv/l7': 'function(){try{return L7}catch(e){return {}}}()',
'@antv/l7-three': 'function(){try{return window}catch(e){return {}}}()',
'@tensorflow/tfjs': 'function(){try{return tf}catch(e){return {}}}()'
},

Expand Down
3 changes: 2 additions & 1 deletion build/webpack.config.mapboxgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ module.exports = {
'webgl-debug': '(function(){try{return webgl-debug}catch(e){return {}}})()',
xlsx: 'function(){try{return XLSX}catch(e){return {}}}()',
canvg: 'function(){try{return canvg}catch(e){return {}}}()',
jsonsql: 'function(){try{return jsonsql}catch(e){return {}}}()'
jsonsql: 'function(){try{return jsonsql}catch(e){return {}}}()',
'@supermap/mapboxgl-l7-render': 'function(){try{return L7}catch(e){return {}}}()'
})
],

Expand Down
3 changes: 2 additions & 1 deletion build/webpack.config.maplibregl.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ module.exports = {
xlsx: 'function(){try{return XLSX}catch(e){return {}}}()',
canvg: 'function(){try{return canvg}catch(e){return {}}}()',
jsonsql: 'function(){try{return jsonsql}catch(e){return {}}}()',
'xml-js': 'function(){try{return convert}catch(e){return {}}}()'
'xml-js': 'function(){try{return convert}catch(e){return {}}}()',
'@supermap/maplibregl-l7-render': 'function(){try{return L7}catch(e){return {}}}()'
}),

module: {
Expand Down
2 changes: 1 addition & 1 deletion dist/mapboxgl/include-mapboxgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
inputScript(libsurl + '/mapbox-gl-js-enhance/1.12.1-3/mapbox-gl-enhance.js');
}
if (inArray(includes, 'L7')) {
inputScript(disturl + '/mapboxgl/l7-dev.js');
inputScript(libsurl+ '/mapboxgl-l7-render/index.js');
}
if (inArray(includes, 'g2')) {
inputScript('https://cdnjs.cloudflare.com/ajax/libs/antv-g2/4.2.8/g2.min.js');
Expand Down
14 changes: 3 additions & 11 deletions dist/maplibregl/include-maplibregl.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,15 @@
var includes = (targetScript.getAttribute('include') || '').split(',');
var excludes = (targetScript.getAttribute('exclude') || '').split(',');
if (!inArray(excludes, 'maplibregl')) {
// inputCSS(libsurl + '/maplibre-gl-js/3.1.0/maplibre-gl.css');
// inputScript(libsurl + '/maplibre-gl-js/3.1.0/maplibre-gl.js');
inputCSS('https://unpkg.com/[email protected]/dist/maplibre-gl.css');
inputScript('https://unpkg.com/[email protected]/dist/maplibre-gl.js');
inputCSS(libsurl + '/maplibre-gl-js/3.1.0/maplibre-gl.css');
inputScript(libsurl + '/maplibre-gl-js/3.1.0/maplibre-gl.js');
}
if (inArray(includes, 'L7')) {
inputScript('../../dist/maplibregl/l7-dev.js');
inputScript(libsurl + '/maplibregl-l7-render/index.js');
}
if (inArray(includes, 'g2')) {
inputScript('https://cdnjs.cloudflare.com/ajax/libs/antv-g2/4.2.8/g2.min.js');
}
if (inArray(includes, 'L7Three')) {
// inputScript('https://cdnjs.cloudflare.com/ajax/libs/three.js/r115/three.min.js');
inputScript(libsurl + '/three/0.115.0/three.min.js');
inputScript(libsurl + '/three/0.115.0/examples/js/loaders/GLTFLoader.js');
inputScript('../../dist/maplibregl/l7-three.min.js');
}
if (inArray(includes, 'turf')) {
inputScript(libsurl + '/turf/6.5.0/turf.min.js');
}
Expand Down
14 changes: 7 additions & 7 deletions examples/mapboxgl/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ var exampleConfig = {
L7: {
name: 'L7',
name_en: 'L7',
version: '11.1.1',
version: '11.2.0',
content: [
{
name: '网格地图',
Expand Down Expand Up @@ -1623,12 +1623,12 @@ var exampleConfig = {
thumbnail: 'l7_heatmap_hexagon3.png',
fileName: 'l7_heatmap_hexagon3'
},
{
name: '平面图层',
name_en: 'Flat layer',
thumbnail: 'l7_flat_layer.png',
fileName: 'l7_flat_layer'
},
// {
// name: '平面图层',
// name_en: 'Flat layer',
// thumbnail: 'l7_flat_layer.png',
// fileName: 'l7_flat_layer'
// },
// {
// name: '自定义3D地形(LOD)',
// name_en: 'Customize 3D Terrain (LOD)',
Expand Down
92 changes: 0 additions & 92 deletions examples/mapboxgl/demo-l7layer.html

This file was deleted.

2 changes: 1 addition & 1 deletion examples/mapboxgl/l7_3d_column.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<body>
<div id="map"></div>
<script type="text/javascript" include="L7" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
<script type="text/javascript" include="mapbox-gl-enhance,L7" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
<script type="text/javascript">
var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
var attribution =
Expand Down
2 changes: 1 addition & 1 deletion examples/mapboxgl/l7_3d_geometry.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<body>
<div id="map"></div>
<script type="text/javascript" include="L7" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
<script type="text/javascript" include="mapbox-gl-enhance,L7" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
<script type="text/javascript">
var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
var attribution =
Expand Down
2 changes: 1 addition & 1 deletion examples/mapboxgl/l7_3d_honeycomb.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<body>
<div id="map"></div>
<script type="text/javascript" include="L7" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
<script type="text/javascript" include="mapbox-gl-enhance,L7" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
<script type="text/javascript">
var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
var attribution =
Expand Down
2 changes: 1 addition & 1 deletion examples/mapboxgl/l7_3d_terrain.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<body>
<div id="map"></div>
<script type="text/javascript" include="L7" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
<script type="text/javascript" include="mapbox-gl-enhance,L7" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
<script type="text/javascript">
var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
var attribution =
Expand Down
2 changes: 1 addition & 1 deletion examples/mapboxgl/l7_bar_chart.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<body>
<div id="map"></div>
<script type="text/javascript" include="L7,g2" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
<script type="text/javascript" include="mapbox-gl-enhance,L7,g2" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
<script type="text/javascript">
var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
var attribution =
Expand Down
2 changes: 1 addition & 1 deletion examples/mapboxgl/l7_brightness_map.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<body>
<div id="map"></div>
<script type="text/javascript" include="L7" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
<script type="text/javascript" include="mapbox-gl-enhance,L7" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
<script type="text/javascript">
var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
var attribution =
Expand Down
2 changes: 1 addition & 1 deletion examples/mapboxgl/l7_bus_line_wall.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<body>
<div id="map"></div>
<script type="text/javascript" include="L7" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
<script type="text/javascript" include="mapbox-gl-enhance,L7" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
<script type="text/javascript">
var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
var attribution =
Expand Down
128 changes: 64 additions & 64 deletions examples/mapboxgl/l7_circular_sweeping_city.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<body>
<div id="map"></div>
<script type="text/javascript" include="L7" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
<script type="text/javascript" include="mapbox-gl-enhance,L7" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
<script type="text/javascript">
var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
var attribution =
Expand Down Expand Up @@ -94,71 +94,71 @@
sweepCenter: [120.145319, 30.238915]
}
});
map.addLayer(pointLayer);
});
fetch('../data/67130c6c-7f49-4680-915c-54e69730861d.json')
.then((res) => res.json())
.then(({ lakeBorderData, lakeData, landData }) => {
var lakeLayer = new mapboxgl.supermap.L7Layer({ type: 'PolygonLayer' });
lakeLayer
.getL7Layer()
.source(lakeData)
.shape('fill')
.color('#1E90FF')
.style({
opacity: 0.4,
opacityLinear: {
enable: true,
dir: 'out' // in - out
}
});
var landLayer = new mapboxgl.supermap.L7Layer({ type: 'PolygonLayer' });
landLayer
.getL7Layer()
.source(landData)
.shape('fill')
.color('#3CB371')
.style({
opacity: 0.4,
opacityLinear: {
enable: true,
dir: 'in' // in - out
}
});
var lakeBorderLayer = new mapboxgl.supermap.L7Layer({ type: 'PolygonLayer' });
lakeBorderLayer
.getL7Layer()
.source(lakeBorderData)
.shape('fill')
.color('#ccc')
.style({
opacity: 0.5,
opacityLinear: {
enable: true,
dir: 'in' // in - out
}
});
fetch('../data/67130c6c-7f49-4680-915c-54e69730861d.json')
.then((res) => res.json())
.then(({ lakeBorderData, lakeData, landData }) => {
var lakeLayer = new mapboxgl.supermap.L7Layer({ type: 'PolygonLayer' });
lakeLayer
.getL7Layer()
.source(lakeData)
.shape('fill')
.color('#1E90FF')
.style({
opacity: 0.4,
opacityLinear: {
enable: true,
dir: 'out' // in - out
}
});
var landLayer = new mapboxgl.supermap.L7Layer({ type: 'PolygonLayer' });
landLayer
.getL7Layer()
.source(landData)
.shape('fill')
.color('#3CB371')
.style({
opacity: 0.4,
opacityLinear: {
enable: true,
dir: 'in' // in - out
}
});
var lakeBorderLayer = new mapboxgl.supermap.L7Layer({ type: 'PolygonLayer' });
lakeBorderLayer
.getL7Layer()
.source(lakeBorderData)
.shape('fill')
.color('#ccc')
.style({
opacity: 0.5,
opacityLinear: {
enable: true,
dir: 'in' // in - out
}
});

map.addLayer(lakeLayer);
map.addLayer(lakeBorderLayer);
map.addLayer(landLayer);
});
fetch('../data/40ef2173-df66-4154-a8c0-785e93a5f18e.json')
.then((res) => res.json())
.then((data) => {
var layer = new mapboxgl.supermap.L7Layer(
{ type: 'LineLayer' },
{
depth: true
}
);
layer.getL7Layer().source(data).size(1).shape('line').color('#1990FF').animate({
interval: 1, // 间隔
duration: 2, // 持续时间,延时
trailLength: 2 // 流线长度
fetch('../data/40ef2173-df66-4154-a8c0-785e93a5f18e.json')
.then((res) => res.json())
.then((data) => {
var layer = new mapboxgl.supermap.L7Layer(
{ type: 'LineLayer' },
{
depth: true
}
);
layer.getL7Layer().source(data).size(1).shape('line').color('#1990FF').animate({
interval: 1, // 间隔
duration: 2, // 持续时间,延时
trailLength: 2 // 流线长度
});
map.addLayer(pointLayer);
map.addLayer(lakeLayer);
map.addLayer(lakeBorderLayer);
map.addLayer(landLayer);
map.addLayer(layer);
});
});
map.addLayer(layer);
});
});
});
</script>
</body>
Expand Down
Loading

0 comments on commit b3b5dce

Please sign in to comment.