From 02a181a4066eee10243275d6fd9ad9bb4e579194 Mon Sep 17 00:00:00 2001 From: ParryQiu Date: Fri, 28 Aug 2020 15:26:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8E=BB=E9=99=A4?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E7=82=B9=E8=AE=A1=E7=AE=97=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/line/path/demo/road_light.js | 92 +++++++-------------------- 1 file changed, 22 insertions(+), 70 deletions(-) diff --git a/examples/line/path/demo/road_light.js b/examples/line/path/demo/road_light.js index 83d0af9a52..779ac51a8d 100644 --- a/examples/line/path/demo/road_light.js +++ b/examples/line/path/demo/road_light.js @@ -5,76 +5,28 @@ import { import { Mapbox } from '@antv/l7-maps'; -import { - GaodeMap -} from "@antv/l7-maps"; -let mapData = [{ - path: [ - [118.186546, 39.666597], - [118.186546, 39.666597], - [118.186546, 39.666597], - [118.186546, 39.666597], - [118.186747, 39.664297], - [118.186751, 39.664301], - [118.186751, 39.664301], - [118.186751, 39.664301], - [118.186751, 39.664301], - [118.186751, 39.664301], - [118.195929, 39.670589], - [118.195929, 39.670589], - [118.195929, 39.670589], - [118.195929, 39.670589], - [118.142168, 39.646454], - [118.142168, 39.646453], - [118.142168, 39.646453], - [118.142168, 39.646453], - [118.437412, 39.88825], - [118.437412, 39.88825], - [118.437412, 39.88825], - [118.437412, 39.88825], - [118.437412, 39.88825], - [118.437412, 39.88825], - [118.437412, 39.88825], - [118.437412, 39.88825], - [118.437412, 39.88825], - [118.437412, 39.88825], - [118.437412, 39.88825], - [118.437412, 39.88825], - [118.437412, 39.88825], - [118.437412, 39.88825], - [118.437412, 39.88825], - [118.437412, 39.88825] - ] -}]; - -let map = new Scene({ - id: "map", - map: new GaodeMap({ - center: [118.142858, 39.674508], - zoom: 14, - type: "amap", - style: "light", - pitch: 0 +const scene = new Scene({ + id: 'map', + map: new Mapbox({ + center: [116.3956, 39.9392], + pitch: 0, + zoom: 10, + rotation: 0, + style: 'light' }) }); -let line = new LineLayer() - .source(mapData, { - parser: { - type: "json", - coordinates: "path" - } - }) - .size(5, 10) - .shape("line") - .color("#25d8b7") - .select({ - color: "#eb4c44", - zIndex: 999 - }) - .animate({ - interval: 1, - duration: 5, - trailLength: 2 - }); -map.addLayer(line); +scene.on('loaded', () => { + fetch( + 'https://gw.alipayobjects.com/os/basement_prod/0d2f0113-f48b-4db9-8adc-a3937243d5a3.json' + ) + .then(res => res.json()) + .then(data => { + const layer = new LineLayer({}) + .source(data) + .size(1.5) + .shape('line') + .color('标准名称', ['#5B8FF9', '#5CCEA1', '#5D7092']); + scene.addLayer(layer); + }); +});