style: lint style

This commit is contained in:
shihui 2022-01-10 11:05:39 +08:00
parent 48aea03473
commit 5e64adeb29
1 changed files with 84 additions and 85 deletions

View File

@ -4,7 +4,7 @@ import { GaodeMap } from '@antv/l7-maps';
const scene = new Scene({ const scene = new Scene({
id: 'map', id: 'map',
map: new GaodeMap({ map: new GaodeMap({
center: [120.15, 30.246], center: [ 120.15, 30.246 ],
pitch: 0, pitch: 0,
zoom: 13.5, zoom: 13.5,
style: 'dark', style: 'dark',
@ -17,130 +17,129 @@ scene.on('loaded', () => {
scene.addImage( scene.addImage(
'westLakeBuilding', 'westLakeBuilding',
'https://gw.alipayobjects.com/zos/bmw-prod/8c3f6415-c1ca-4f7e-8ac6-89571ac75309.svg', 'https://gw.alipayobjects.com/zos/bmw-prod/8c3f6415-c1ca-4f7e-8ac6-89571ac75309.svg'
); );
scene.addImage( scene.addImage(
'arrow', 'arrow',
'https://gw.alipayobjects.com/zos/bmw-prod/ce83fc30-701f-415b-9750-4b146f4b3dd6.svg', 'https://gw.alipayobjects.com/zos/bmw-prod/ce83fc30-701f-415b-9750-4b146f4b3dd6.svg'
); );
scene.addImage( scene.addImage(
'shop', 'shop',
'https://gw.alipayobjects.com/zos/bmw-prod/238e7c7c-c26c-454c-9341-35d466c4b991.svg', 'https://gw.alipayobjects.com/zos/bmw-prod/238e7c7c-c26c-454c-9341-35d466c4b991.svg'
); );
scene.addImage( scene.addImage(
'hospital', 'hospital',
'https://gw.alipayobjects.com/zos/bmw-prod/fd08bf28-f73e-4b9c-ba8d-2c73d4fca6dc.svg', 'https://gw.alipayobjects.com/zos/bmw-prod/fd08bf28-f73e-4b9c-ba8d-2c73d4fca6dc.svg'
); );
scene.addImage( scene.addImage(
'westlake', 'westlake',
'https://gw.alipayobjects.com/zos/bmw-prod/7b011298-454d-431b-9637-ab23a752e731.svg', 'https://gw.alipayobjects.com/zos/bmw-prod/7b011298-454d-431b-9637-ab23a752e731.svg'
); );
scene.addImage( scene.addImage(
'ship', 'ship',
'https://gw.alipayobjects.com/zos/bmw-prod/104cfca2-f3c5-49e8-b084-d339f4ba1adc.svg', 'https://gw.alipayobjects.com/zos/bmw-prod/104cfca2-f3c5-49e8-b084-d339f4ba1adc.svg'
); );
scene.addImage( scene.addImage(
'travel', 'travel',
'https://gw.alipayobjects.com/zos/bmw-prod/904d047a-16a5-461b-a921-98fa537fc04a.svg', 'https://gw.alipayobjects.com/zos/bmw-prod/904d047a-16a5-461b-a921-98fa537fc04a.svg'
); );
scene.addImage( scene.addImage(
'pavilion', 'pavilion',
'https://gw.alipayobjects.com/zos/bmw-prod/8839795d-43d9-46c5-a5b1-95bf9a1146a0.svg', 'https://gw.alipayobjects.com/zos/bmw-prod/8839795d-43d9-46c5-a5b1-95bf9a1146a0.svg'
); );
scene.addImage( scene.addImage(
'museum', 'museum',
'https://gw.alipayobjects.com/zos/bmw-prod/5436a335-8ec3-40e4-9c93-16d0f844b0e7.svg', 'https://gw.alipayobjects.com/zos/bmw-prod/5436a335-8ec3-40e4-9c93-16d0f844b0e7.svg'
); );
scene.addImage( scene.addImage(
'bridge', 'bridge',
'https://gw.alipayobjects.com/zos/bmw-prod/b88e6f2f-ad12-4980-969e-3849cbcd28c6.svg', 'https://gw.alipayobjects.com/zos/bmw-prod/b88e6f2f-ad12-4980-969e-3849cbcd28c6.svg'
); );
scene.addImage( scene.addImage(
'school', 'school',
'https://gw.alipayobjects.com/zos/bmw-prod/948e665d-ab1e-4010-b75a-236057837bec.svg', 'https://gw.alipayobjects.com/zos/bmw-prod/948e665d-ab1e-4010-b75a-236057837bec.svg'
); );
fetch('https://gw.alipayobjects.com/os/bmw-prod/67130c6c-7f49-4680-915c-54e69730861d.json') fetch('https://gw.alipayobjects.com/os/bmw-prod/67130c6c-7f49-4680-915c-54e69730861d.json')
.then(data => data.json()) .then(data => data.json())
.then(({lakeBorderData, lakeData, landData, westLakePoiData, poiData}) => { .then(({ lakeBorderData, lakeData, landData, westLakePoiData, poiData }) => {
const lakeLayer = new PolygonLayer() const lakeLayer = new PolygonLayer()
.source(lakeData) .source(lakeData)
.shape('fill') .shape('fill')
.color('#1E90FF') .color('#1E90FF')
.style({ .style({
opacity: 0.4, opacity: 0.4,
opacityLinear: { opacityLinear: {
enable: true, enable: true,
dir: 'out', // in - out dir: 'out' // in - out
}, }
}); });
const landLayer = new PolygonLayer() const landLayer = new PolygonLayer()
.source(landData) .source(landData)
.shape('fill') .shape('fill')
.color('#3CB371') .color('#3CB371')
.style({ .style({
opacity: 0.4, opacity: 0.4,
opacityLinear: { opacityLinear: {
enable: true, enable: true,
dir: 'in', // in - out dir: 'in' // in - out
}, }
});
const lakeBorderLayer = new PolygonLayer()
.source(lakeBorderData)
.shape('fill')
.color('#ccc')
.style({
opacity: 0.5,
opacityLinear: {
enable: true,
dir: 'in' // in - out
}
});
const westLakePoiLayer = new PointLayer({ zIndex: 1 })
.source(westLakePoiData, {
parser: {
type: 'json',
x: 'lng',
y: 'lat'
}
})
.shape('type', v => v)
.size(40);
const poiLayer = new PointLayer({ zIndex: 1 })
.source(
poiData, {
parser: {
type: 'json',
x: 'lng',
y: 'lat'
}
})
.shape('type', v => v)
.size(10);
scene.addLayer(lakeLayer);
scene.addLayer(lakeBorderLayer);
scene.addLayer(landLayer);
scene.addLayer(westLakePoiLayer);
scene.addLayer(poiLayer);
}); });
const lakeBorderLayer = new PolygonLayer()
.source(lakeBorderData)
.shape('fill')
.color('#ccc')
.style({
opacity: 0.5,
opacityLinear: {
enable: true,
dir: 'in', // in - out
},
});
const westLakePoiLayer = new PointLayer({zIndex: 1})
.source(westLakePoiData, {
parser: {
type: 'json',
x: 'lng',
y: 'lat'
}
})
.shape('type', v => v)
.size(40)
const poiLayer = new PointLayer({zIndex: 1})
.source(
poiData, {
parser: {
type: 'json',
x: 'lng',
y: 'lat'
}
})
.shape('type', v => v)
.size(10)
scene.addLayer(lakeLayer);
scene.addLayer(lakeBorderLayer);
scene.addLayer(landLayer);
scene.addLayer(westLakePoiLayer);
scene.addLayer(poiLayer);
})
fetch( fetch(
'https://gw.alipayobjects.com/os/basement_prod/40ef2173-df66-4154-a8c0-785e93a5f18e.json', 'https://gw.alipayobjects.com/os/basement_prod/40ef2173-df66-4154-a8c0-785e93a5f18e.json'
) )
.then((res) => res.json()) .then(res => res.json())
.then((data) => { .then(data => {
const colors = [ const colors = [
'#66c2a4', '#66c2a4',
'#2ca25f', '#2ca25f',
'#006d2c' '#006d2c'
] ];
// @ts-ignore // @ts-ignore
const layer = new LineLayer({}) const layer = new LineLayer({})
.source(data) .source(data)
@ -153,14 +152,14 @@ scene.on('loaded', () => {
.animate({ .animate({
interval: 1, // 间隔 interval: 1, // 间隔
duration: 1, // 持续时间,延时 duration: 1, // 持续时间,延时
trailLength: 2, // 流线长度 trailLength: 2 // 流线长度
}) })
.style({ .style({
opacity: 0.6, opacity: 0.6,
lineTexture: true, // 开启线的贴图功能 lineTexture: true, // 开启线的贴图功能
iconStep: 20, // 设置贴图纹理的间距 iconStep: 20, // 设置贴图纹理的间距
borderWidth: 0.4, // 默认文 0最大有效值为 0.5 borderWidth: 0.4, // 默认文 0最大有效值为 0.5
borderColor: '#fff', // 默认为 #ccc borderColor: '#fff' // 默认为 #ccc
}); });
scene.addLayer(layer); scene.addLayer(layer);
}); });