mirror of https://gitee.com/antv-l7/antv-l7
Merge branch 'master' of github.com:antvis/L7
This commit is contained in:
commit
1bde10bd33
|
@ -2,6 +2,30 @@
|
|||
title: 发布日志
|
||||
order: 10
|
||||
---
|
||||
## 2020.04.20 2.2 正式版本
|
||||
|
||||
###✨ Features
|
||||
#### [L7-Draw 地图绘制组件发布](../draw/start)
|
||||
支持基础图形绘制、平移、修改、删除
|
||||
- 绘制UI组件支持
|
||||
- 绘制圆形
|
||||
- 绘制矩形
|
||||
- 绘制点
|
||||
- 绘制线
|
||||
- 绘制面
|
||||
|
||||
### 🍏 Improvements
|
||||
- 要素拾取支持添加buffer
|
||||
- 图层拾取支持冒泡机制,默认拾取最上层
|
||||
|
||||
### 🐞 Bug Fixes
|
||||
- pointLayer 聚合支持多种数据格式化
|
||||
- 修复热力图移动端不能正常渲染
|
||||
- 修复3D热力图高德地图正使用
|
||||
- L7 版本锁定
|
||||
- 修复点图层描边模糊问题
|
||||
|
||||
|
||||
|
||||
## 2020.03.12 2.1 正式版
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"message": "chore: publish"
|
||||
}
|
||||
},
|
||||
"version": "2.1.15",
|
||||
"version": "2.2.0",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"publishConfig": {
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
"@commitlint/cli": "^8.1.0",
|
||||
"@commitlint/config-conventional": "^8.1.0",
|
||||
"@rollup/plugin-alias": "^2.2.0",
|
||||
"@rollup/plugin-commonjs": "11.0.1",
|
||||
"@rollup/plugin-commonjs": "11.0.2",
|
||||
"@rollup/plugin-json": "^4.0.0",
|
||||
"@rollup/plugin-node-resolve": "^6.0.0",
|
||||
"@storybook/react": "^5.1.9",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-component",
|
||||
"version": "2.1.15",
|
||||
"version": "2.2.0",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -24,8 +24,8 @@
|
|||
"author": "lzxue",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@antv/l7-core": "^2.1.15",
|
||||
"@antv/l7-utils": "^2.1.15",
|
||||
"@antv/l7-core": "^2.2.0",
|
||||
"@antv/l7-utils": "^2.2.0",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"eventemitter3": "^4.0.0",
|
||||
"inversify": "^5.0.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-core",
|
||||
"version": "2.1.15",
|
||||
"version": "2.2.0",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -23,7 +23,7 @@
|
|||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@antv/async-hook": "^2.1.0",
|
||||
"@antv/l7-utils": "^2.1.15",
|
||||
"@antv/l7-utils": "^2.2.0",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"@mapbox/tiny-sdf": "^1.1.1",
|
||||
"ajv": "^6.10.2",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-draw",
|
||||
"version": "2.1.15",
|
||||
"version": "2.2.0",
|
||||
"description": "L7 Draw moudules",
|
||||
"keywords": [],
|
||||
"author": "thinkinggis <lzx199065@gmail.com>",
|
||||
|
@ -35,8 +35,8 @@
|
|||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@antv/l7": "^2.2.0",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"@antv/l7": "^2.1.15",
|
||||
"@turf/circle": "^6.0.1",
|
||||
"@turf/distance": "^6.0.1",
|
||||
"@turf/helpers": "^6.1.4",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7",
|
||||
"version": "2.1.15",
|
||||
"version": "2.2.0",
|
||||
"description": "A Large-scale WebGL-powered Geospatial Data Visualization",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -24,12 +24,12 @@
|
|||
"author": "antv",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@antv/l7-component": "^2.1.15",
|
||||
"@antv/l7-core": "^2.1.15",
|
||||
"@antv/l7-layers": "^2.1.15",
|
||||
"@antv/l7-maps": "^2.1.15",
|
||||
"@antv/l7-scene": "^2.1.15",
|
||||
"@antv/l7-utils": "^2.1.15",
|
||||
"@antv/l7-component": "^2.2.0",
|
||||
"@antv/l7-core": "^2.2.0",
|
||||
"@antv/l7-layers": "^2.2.0",
|
||||
"@antv/l7-maps": "^2.2.0",
|
||||
"@antv/l7-scene": "^2.2.0",
|
||||
"@antv/l7-utils": "^2.2.0",
|
||||
"@babel/runtime": "^7.7.7"
|
||||
},
|
||||
"gitHead": "a5d354b66873f700730248d015c5e539c54b34b7",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-layers",
|
||||
"version": "2.1.15",
|
||||
"version": "2.2.0",
|
||||
"description": "L7's collection of built-in layers",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -23,9 +23,9 @@
|
|||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@antv/async-hook": "^2.1.0",
|
||||
"@antv/l7-core": "^2.1.15",
|
||||
"@antv/l7-source": "^2.1.15",
|
||||
"@antv/l7-utils": "^2.1.15",
|
||||
"@antv/l7-core": "^2.2.0",
|
||||
"@antv/l7-source": "^2.2.0",
|
||||
"@antv/l7-utils": "^2.2.0",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"@mapbox/martini": "^0.1.0",
|
||||
"@turf/meta": "^6.0.2",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-maps",
|
||||
"version": "2.1.15",
|
||||
"version": "2.2.0",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -25,8 +25,8 @@
|
|||
"author": "xiaoiver",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@antv/l7-core": "^2.1.15",
|
||||
"@antv/l7-utils": "^2.1.15",
|
||||
"@antv/l7-core": "^2.2.0",
|
||||
"@antv/l7-utils": "^2.2.0",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"@types/amap-js-api": "^1.4.6",
|
||||
"gl-matrix": "^3.1.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-react",
|
||||
"version": "2.1.15",
|
||||
"version": "2.2.0",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -24,8 +24,8 @@
|
|||
"author": "lzxue",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@antv/l7": "^2.1.15",
|
||||
"@antv/l7-maps": "^2.1.15",
|
||||
"@antv/l7": "^2.2.0",
|
||||
"@antv/l7-maps": "^2.2.0",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"load-styles": "^2.0.0"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-renderer",
|
||||
"version": "2.1.15",
|
||||
"version": "2.2.0",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -25,7 +25,7 @@
|
|||
"gl": "^4.4.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@antv/l7-core": "^2.1.15",
|
||||
"@antv/l7-core": "^2.2.0",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"inversify": "^5.0.1",
|
||||
"lodash": "^4.17.15",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-scene",
|
||||
"version": "2.1.15",
|
||||
"version": "2.2.0",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -22,11 +22,11 @@
|
|||
"author": "xiaoiver",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@antv/l7-component": "^2.1.15",
|
||||
"@antv/l7-core": "^2.1.15",
|
||||
"@antv/l7-maps": "^2.1.15",
|
||||
"@antv/l7-renderer": "^2.1.15",
|
||||
"@antv/l7-utils": "^2.1.15",
|
||||
"@antv/l7-component": "^2.2.0",
|
||||
"@antv/l7-core": "^2.2.0",
|
||||
"@antv/l7-maps": "^2.2.0",
|
||||
"@antv/l7-renderer": "^2.2.0",
|
||||
"@antv/l7-utils": "^2.2.0",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"inversify": "^5.0.1",
|
||||
"mapbox-gl": "^1.2.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-source",
|
||||
"version": "2.1.15",
|
||||
"version": "2.2.0",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -25,8 +25,8 @@
|
|||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@antv/async-hook": "^2.1.0",
|
||||
"@antv/l7-core": "^2.1.15",
|
||||
"@antv/l7-utils": "^2.1.15",
|
||||
"@antv/l7-core": "^2.2.0",
|
||||
"@antv/l7-utils": "^2.2.0",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"@mapbox/geojson-rewind": "^0.4.0",
|
||||
"@turf/helpers": "^6.1.4",
|
||||
|
|
|
@ -25,6 +25,7 @@ import { cloneDeep, isFunction, isString } from 'lodash';
|
|||
// tslint:disable-next-line:no-submodule-imports
|
||||
import Supercluster from 'supercluster/dist/supercluster';
|
||||
import { getParser, getTransform } from './';
|
||||
import { cluster } from './transform/cluster';
|
||||
import { statMap } from './utils/statistics';
|
||||
import { getColumn } from './utils/util';
|
||||
export default class Source extends EventEmitter {
|
||||
|
@ -100,7 +101,7 @@ export default class Source extends EventEmitter {
|
|||
}
|
||||
public updateClusterData(zoom: number): void {
|
||||
const { method = 'sum', field } = this.clusterOptions;
|
||||
let data = this.clusterIndex.getClusters(this.extent, zoom);
|
||||
let data = this.clusterIndex.getClusters(this.extent, Math.floor(zoom));
|
||||
this.clusterOptions.zoom = zoom;
|
||||
data.forEach((p: any) => {
|
||||
if (!p.id) {
|
||||
|
@ -177,13 +178,15 @@ export default class Source extends EventEmitter {
|
|||
if (!this.cluster) {
|
||||
return;
|
||||
}
|
||||
const { radius, minZoom = 0, maxZoom } = this.clusterOptions;
|
||||
this.clusterIndex = new Supercluster({
|
||||
radius,
|
||||
minZoom,
|
||||
maxZoom,
|
||||
});
|
||||
this.clusterIndex.load(this.rawData.features);
|
||||
|
||||
const clusterOptions = this.clusterOptions || {};
|
||||
this.clusterIndex = cluster(this.data, clusterOptions);
|
||||
// this.clusterIndex = new Supercluster({
|
||||
// radius,
|
||||
// minZoom,
|
||||
// maxZoom,
|
||||
// });
|
||||
// this.clusterIndex.load(this.rawData.features);
|
||||
}
|
||||
|
||||
private init() {
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
import { IParserCfg, IParserData, ISourceCFG, ITransform } from '@antv/l7-core';
|
||||
import {
|
||||
IClusterOptions,
|
||||
IParserData,
|
||||
ISourceCFG,
|
||||
ITransform,
|
||||
} from '@antv/l7-core';
|
||||
// @ts-ignore
|
||||
// tslint:disable-next-line:no-submodule-imports
|
||||
import Supercluster from 'supercluster/dist/supercluster';
|
||||
export function cluster(data: IParserData, option: ITransform): IParserData {
|
||||
const { radius = 80, maxZoom = 18, minZoom = 0, field, zoom = 2 } = option;
|
||||
export function cluster(
|
||||
data: IParserData,
|
||||
option: Partial<IClusterOptions>,
|
||||
): IParserData {
|
||||
const { radius = 40, maxZoom = 18, minZoom = 0, zoom = 2 } = option;
|
||||
if (data.pointIndex) {
|
||||
const clusterData = data.pointIndex.getClusters(
|
||||
data.extent,
|
||||
|
@ -16,10 +24,6 @@ export function cluster(data: IParserData, option: ITransform): IParserData {
|
|||
radius,
|
||||
minZoom,
|
||||
maxZoom,
|
||||
map: (props: any) => ({ sum: props[field] }), // 根据指定字段求和
|
||||
reduce: (accumulated: any, props: any) => {
|
||||
accumulated.sum += props.sum;
|
||||
},
|
||||
});
|
||||
const geojson: {
|
||||
type: string;
|
||||
|
@ -31,27 +35,15 @@ export function cluster(data: IParserData, option: ITransform): IParserData {
|
|||
geojson.features = data.dataArray.map((item) => {
|
||||
return {
|
||||
type: 'Feature',
|
||||
properties: {
|
||||
[field]: item[field],
|
||||
},
|
||||
geometry: {
|
||||
type: 'Point',
|
||||
coordinates: item.coordinates,
|
||||
},
|
||||
properties: {},
|
||||
};
|
||||
});
|
||||
pointIndex.load(geojson.features);
|
||||
const clusterPoint = pointIndex.getClusters(data.extent, zoom);
|
||||
const resultData = clusterPoint.map((point: any, index: number) => {
|
||||
return {
|
||||
coordinates: point.geometry.coordinates,
|
||||
_id: index + 1,
|
||||
...point.properties,
|
||||
};
|
||||
});
|
||||
data.dataArray = resultData;
|
||||
data.pointIndex = pointIndex;
|
||||
return data;
|
||||
return pointIndex;
|
||||
}
|
||||
export function formatData(clusterPoint: any[]) {
|
||||
return clusterPoint.map((point, index) => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@antv/l7-utils",
|
||||
"version": "2.1.15",
|
||||
"version": "2.2.0",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
|
|
@ -4,6 +4,7 @@ import AnimatePoint from './components/AnimatePoint';
|
|||
import Arc2DLineDemo from './components/Arc2DLine';
|
||||
import ArcLineDemo from './components/Arcline';
|
||||
import CityBuildingLayerDemo from './components/citybuilding';
|
||||
import ClusterDemo from './components/cluster';
|
||||
import Column from './components/column';
|
||||
import DashLineDemo from './components/dash';
|
||||
import DataUpdate from './components/data_update';
|
||||
|
@ -27,6 +28,7 @@ import TextLayerDemo from './components/Text';
|
|||
// @ts-ignore
|
||||
storiesOf('图层', module)
|
||||
.add('点图层', () => <PointDemo />)
|
||||
.add('聚合图', () => <ClusterDemo />)
|
||||
.add('数据更新', () => <DataUpdate />)
|
||||
.add('点动画', () => <AnimatePoint />)
|
||||
.add('3D点', () => <Point3D />)
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
import { PointLayer, Scene } from '@antv/l7';
|
||||
import { GaodeMap, Mapbox } from '@antv/l7-maps';
|
||||
import * as React from 'react';
|
||||
// @ts-ignore
|
||||
import data from '../data/data.json';
|
||||
export default class Point3D extends React.Component {
|
||||
// @ts-ignore
|
||||
private scene: Scene;
|
||||
|
||||
public componentWillUnmount() {
|
||||
this.scene.destroy();
|
||||
}
|
||||
|
||||
public async componentDidMount() {
|
||||
const scene = new Scene({
|
||||
id: 'map',
|
||||
pickBufferScale: 3.0,
|
||||
map: new GaodeMap({
|
||||
style: 'light',
|
||||
center: [-121.24357, 37.58264],
|
||||
pitch: 0,
|
||||
zoom: 10.45,
|
||||
}),
|
||||
});
|
||||
scene.on('loaded', () => {
|
||||
fetch(
|
||||
'https://gw.alipayobjects.com/os/basement_prod/6c4bb5f2-850b-419d-afc4-e46032fc9f94.csv',
|
||||
)
|
||||
.then((res) => res.text())
|
||||
.then((data) => {
|
||||
const pointLayer = new PointLayer({})
|
||||
.source(data, {
|
||||
parser: {
|
||||
type: 'csv',
|
||||
x: 'Longitude',
|
||||
y: 'Latitude',
|
||||
},
|
||||
cluster: true,
|
||||
})
|
||||
.shape('circle')
|
||||
.size(8)
|
||||
.active({
|
||||
color: 'red',
|
||||
})
|
||||
.color('point_count', [
|
||||
'#0A3663',
|
||||
'#1558AC',
|
||||
'#3771D9',
|
||||
'#4D89E5',
|
||||
'#64A5D3',
|
||||
'#72BED6',
|
||||
'#83CED6',
|
||||
'#A6E1E0',
|
||||
'#B8EFE2',
|
||||
'#D7F9F0',
|
||||
])
|
||||
.style({
|
||||
opacity: 1,
|
||||
strokeWidth: 0,
|
||||
stroke: '#fff',
|
||||
});
|
||||
|
||||
scene.addLayer(pointLayer);
|
||||
this.scene = scene;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public render() {
|
||||
return (
|
||||
<div
|
||||
id="map"
|
||||
style={{
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
10
yarn.lock
10
yarn.lock
|
@ -2866,13 +2866,13 @@
|
|||
dependencies:
|
||||
slash "^3.0.0"
|
||||
|
||||
"@rollup/plugin-commonjs@11.0.1":
|
||||
version "11.0.1"
|
||||
resolved "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.1.tgz#6056a6757286901cc6c1599123e6680a78cad6c2"
|
||||
integrity sha512-SaVUoaLDg3KnIXC5IBNIspr1APTYDzk05VaYcI6qz+0XX3ZlSCwAkfAhNSOxfd5GAdcm/63Noi4TowOY9MpcDg==
|
||||
"@rollup/plugin-commonjs@11.0.2":
|
||||
version "11.0.2"
|
||||
resolved "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.2.tgz#837cc6950752327cb90177b608f0928a4e60b582"
|
||||
integrity sha512-MPYGZr0qdbV5zZj8/2AuomVpnRVXRU5XKXb3HVniwRoRCreGlf5kOE081isNWeiLIi6IYkwTX9zE0/c7V8g81g==
|
||||
dependencies:
|
||||
"@rollup/pluginutils" "^3.0.0"
|
||||
estree-walker "^0.6.1"
|
||||
estree-walker "^1.0.1"
|
||||
is-reference "^1.1.2"
|
||||
magic-string "^0.25.2"
|
||||
resolve "^1.11.0"
|
||||
|
|
Loading…
Reference in New Issue