fix: 更新相关依赖 (#903)

Co-authored-by: 象数 <zhengxue.lzx@antgroup.com>
This commit is contained in:
@thinkinggis 2021-12-31 16:29:07 +08:00 committed by GitHub
parent 294142e936
commit 7a588e4ecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 8167 additions and 8384 deletions

1
.gitignore vendored
View File

@ -8,6 +8,7 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
# Runtime data
pids

View File

@ -6,8 +6,6 @@
"url": "https://github.com/antvis/L7"
},
"devDependencies": {
"@antv/dipper": "0.0.6",
"@antv/dipper-widgets": "0.0.6",
"@antv/g2": "^3.5.9",
"@antv/g2plot": "^2.3.40",
"@antv/gatsby-theme-antv": "^1.1.15",
@ -40,11 +38,13 @@
"@types/enzyme": "^3.1.14",
"@types/enzyme-adapter-react-16": "^1.0.3",
"@types/gl": "^4.1.0",
"@types/hoist-non-react-statics": "^3.3.1",
"@types/jest": "^25.2.1",
"@types/node": "13.11.1",
"@types/react-router-dom": "^5.3.2",
"@types/storybook__react": "^5.2.1",
"@types/supercluster": "^5.0.1",
"antd": "^4.12.3",
"antd": "4.12.3",
"awesome-typescript-loader": "^5.2.1",
"babel-eslint": "8.2.5",
"babel-jest": "^24.9.0",
@ -197,7 +197,10 @@
"resolutions": {
"d3-array": "1",
"monaco-editor-webpack-plugin": "2.0.0",
"monaco-editor": "0.21.0"
"monaco-editor": "0.21.0",
"electron": "11.4.6",
"react-router": "6.0.0",
"react-router-dom": "6.0.0"
},
"tnpm": {
"mode": "yarn"

View File

@ -73,19 +73,6 @@ container
.bind<IGlobalConfigService>(TYPES.IGlobalConfigService)
.to(GlobalConfigService)
.inSingletonScope();
// container
// .bind<IIconService>(TYPES.IIconService)
// .to(IconService)
// .inSingletonScope();
container
.bind<IShaderModuleService>(TYPES.IShaderModuleService)
.to(ShaderModuleService)
.inSingletonScope();
// container
// .bind<IFontService>(TYPES.IFontService)
// .to(FontService)
// .inSingletonScope();
// @see https://github.com/inversify/InversifyJS/blob/master/wiki/inheritance.md#what-can-i-do-when-my-base-class-is-provided-by-a-third-party-module
decorate(injectable(), EventEmitter);
container.bind(TYPES.IEventEmitter).to(EventEmitter);
@ -156,6 +143,10 @@ export function createSceneContainer() {
sceneContainer
.bind<string>(TYPES.SceneID)
.toConstantValue(`${sceneIdCounter++}`);
sceneContainer
.bind<IShaderModuleService>(TYPES.IShaderModuleService)
.to(ShaderModuleService)
.inSingletonScope();
sceneContainer
.bind<ILayerService>(TYPES.ILayerService)
.to(LayerService)

View File

@ -15,8 +15,8 @@ import { IRendererService } from '../IRendererService';
@injectable()
export default class BaseNormalPass<InitializationOptions = {}>
implements IPass<InitializationOptions> {
@inject(TYPES.IShaderModuleService)
protected readonly shaderModuleService: IShaderModuleService;
// @inject(TYPES.IShaderModuleService)
protected shaderModuleService: IShaderModuleService;
protected rendererService: IRendererService;
protected cameraService: ICameraService;
@ -49,6 +49,9 @@ export default class BaseNormalPass<InitializationOptions = {}>
this.layerService = layer
.getContainer()
.get<ILayerService>(TYPES.ILayerService);
this.shaderModuleService = layer
.getContainer()
.get<IShaderModuleService>(TYPES.IShaderModuleService);
}
public render(layer: ILayer) {

View File

@ -20,8 +20,8 @@ import { IUniform } from '../IUniform';
@injectable()
export default class BasePostProcessingPass<InitializationOptions = {}>
implements IPostProcessingPass<InitializationOptions> {
@inject(TYPES.IShaderModuleService)
protected readonly shaderModuleService: IShaderModuleService;
// @inject(TYPES.IShaderModuleService)
protected shaderModuleService: IShaderModuleService;
protected rendererService: IRendererService;
@ -68,6 +68,9 @@ export default class BasePostProcessingPass<InitializationOptions = {}>
this.rendererService = layer
.getContainer()
.get<IRendererService>(TYPES.IRendererService);
this.shaderModuleService = layer
.getContainer()
.get<IShaderModuleService>(TYPES.IShaderModuleService);
const { createAttribute, createBuffer, createModel } = this.rendererService;
const { vs, fs, uniforms } = this.setupShaders();

View File

@ -126,7 +126,6 @@ export default class Scene extends EventEmitter implements ISceneService {
public init(sceneConfig: ISceneConfig) {
// 设置场景配置项
this.configService.setSceneConfig(this.id, sceneConfig);
// 初始化 ShaderModule
this.shaderModuleService.registerBuiltinModules();

View File

@ -122,9 +122,10 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
@lazyInject(TYPES.IGlobalConfigService)
protected readonly configService: IGlobalConfigService;
@lazyInject(TYPES.IShaderModuleService)
protected readonly shaderModuleService: IShaderModuleService;
// @lazyInject(TYPES.IShaderModuleService)
// protected readonly shaderModuleService: IShaderModuleService;
protected shaderModuleService: IShaderModuleService;
protected cameraService: ICameraService;
protected coordinateService: ICoordinateSystemService;
@ -293,6 +294,9 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
this.coordinateService = this.container.get<ICoordinateSystemService>(
TYPES.ICoordinateSystemService,
);
this.shaderModuleService = this.container.get<IShaderModuleService>(
TYPES.IShaderModuleService,
);
this.postProcessingPassFactory = this.container.get(
TYPES.IFactoryPostProcessingPass,
);

View File

@ -100,8 +100,8 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
// @lazyInject(TYPES.IFontService)
// protected readonly fontService: IFontService;
@lazyInject(TYPES.IShaderModuleService)
protected readonly shaderModuleService: IShaderModuleService;
// @lazyInject(TYPES.IShaderModuleService)
protected shaderModuleService: IShaderModuleService;
protected rendererService: IRendererService;
protected iconService: IIconService;
@ -118,6 +118,10 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
this.rendererService = layer
.getContainer()
.get<IRendererService>(TYPES.IRendererService);
this.shaderModuleService = layer
.getContainer()
.get<IShaderModuleService>(TYPES.IShaderModuleService);
this.styleAttributeService = layer
.getContainer()
.get<IStyleAttributeService>(TYPES.IStyleAttributeService);

View File

@ -7,7 +7,7 @@ import {
IUniform,
} from '@antv/l7-core';
import regl from 'l7regl';
import { cloneDeep, isPlainObject, isTypedArray } from 'lodash';
import { cloneDeep, extend, isPlainObject, isTypedArray } from 'lodash';
import {
blendEquationMap,
blendFuncMap,
@ -72,6 +72,7 @@ export default class ReglModel implements IModel {
frag: fs,
uniforms: reglUniforms,
vert: vs,
blend: {},
primitive:
primitiveMap[primitive === undefined ? gl.TRIANGLES : primitive],
};
@ -96,15 +97,12 @@ export default class ReglModel implements IModel {
this.drawCommand = reGl(drawParams);
const pickDrawParams = cloneDeep(drawParams);
// @ts-ignore
pickDrawParams.blend.enable = false;
// @ts-ignore
pickDrawParams.blend.func = {
dstAlpha: 'one',
dstRGB: 'one minus src alpha',
srcAlpha: 'one',
srcRGB: 'src alpha',
pickDrawParams.blend = {
...pickDrawParams.blend,
enable: false,
};
this.drawPickCommand = reGl(pickDrawParams);
this.drawParams = drawParams;
}

View File

@ -1,4 +1,4 @@
import Source from '../src/source';
import Source from '../src/';
import Point from './data/point';
import Polygon from './data/polygon';

View File

@ -11,7 +11,6 @@ import { aggregatorToGrid } from './transform/grid';
import { pointToHexbin } from './transform/hexagon';
import { join } from './transform/join';
import { map } from './transform/map';
export default Source;
registerParser('geojson', geojson);
registerParser('image', image);
registerParser('csv', csv);
@ -34,3 +33,4 @@ export * from './interface';
export const DEFAULT_DATA = defaultData;
export const DEFAULT_PARSER = defaultParser;
export default Source;

View File

@ -1,64 +0,0 @@
import { Scene } from '@antv/l7';
import { DrawControl } from '@antv/l7-draw';
import { GaodeMap, Mapbox } from '@antv/l7-maps';
import * as React from 'react';
export default class AMapDraw extends React.Component {
private scene: Scene;
public componentWillUnmount() {
this.scene.destroy();
}
public async componentDidMount() {
const scene = new Scene({
id: 'map',
map: new GaodeMap({
pitch: 0,
style: 'dark', // hosted style id
center: [112.874, 32.76], // starting position
zoom: 12, // starting zoom
}),
});
this.scene = scene;
scene.on('loaded', () => {
const drawControl = new DrawControl(scene, {
position: 'topright',
layout: 'horizontal', // horizontal vertical
controls: {
point: true,
polygon: true,
line: true,
circle: true,
rect: true,
delete: true,
},
});
// @ts-ignore
window.drawControl = drawControl;
drawControl.on('draw.create', (e) => {
console.log(e);
});
scene.on('dblclick', () => {
drawControl.removeAllData();
});
scene.addControl(drawControl);
});
}
public render() {
return (
<div
id="map"
style={{
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
}}
/>
);
}
}

View File

@ -1,52 +0,0 @@
// @ts-ignore
import { LineLayer, PointLayer, PolygonLayer, Popup, Scene } from '@antv/l7';
import { DrawPolygon, DrawCircle } from '@antv/l7-draw';
import { GaodeMap, Mapbox } from '@antv/l7-maps';
import * as React from 'react';
export default class Circle extends React.Component {
private scene: Scene;
public componentWillUnmount() {
this.scene.destroy();
}
public async componentDidMount() {
const scene = new Scene({
id: 'map',
map: new Mapbox({
pitch: 0,
style: 'light',
center: [113.775374, 28.31067],
zoom: 12,
}),
});
this.scene = scene;
scene.on('loaded', () => {
const drawCircle = new DrawCircle(scene);
drawCircle.enable();
drawCircle.on('draw.create', (e: any) => {
console.log(e);
});
drawCircle.on('draw.update', (e: any) => {
console.log('update', e);
});
});
}
public render() {
return (
<div
id="map"
style={{
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
}}
/>
);
}
}

View File

@ -1,119 +0,0 @@
import { LineLayer, PointLayer, PolygonLayer, Popup, Scene } from '@antv/l7';
import { GaodeMap, Mapbox } from '@antv/l7-maps';
import { lnglatDistance } from '@antv/l7-utils';
// import turfCircle from '@turf/circle';
import * as React from 'react';
const createGeoJSONCircle = (
center: [number, number],
radiusInKm: number,
points: number = 64,
) => {
const options = { steps: 64 };
// const circle = turfCircle(center, radiusInKm, options);
return {
type: 'geojson',
data: {
type: 'FeatureCollection',
features: [],
},
};
};
export default class MultiPolygon extends React.Component {
private gui: dat.GUI;
private $stats: Node;
private scene: Scene;
public componentWillUnmount() {
this.scene.destroy();
}
public async componentDidMount() {
const scene = new Scene({
id: 'map',
map: new Mapbox({
pitch: 0,
style: 'normal',
center: [121.775374, 31.31067],
zoom: 15,
}),
});
this.scene = scene;
scene.on('loaded', () => {
let startPoint = {};
const circleLayer = new PolygonLayer()
.source({
type: 'FeatureCollection',
features: [],
})
.color('#fbb03b')
.shape('fill')
.style({
opacity: 0.6,
});
scene.addLayer(circleLayer);
scene.on('dragstart', (e: any) => {
// @ts-ignore
scene.getMapService().setMapStatus({ dragEnable: false });
startPoint = e.lngLat;
const layer = new PointLayer()
.source([startPoint], {
parser: {
type: 'json',
x: 'lng',
y: 'lat',
},
})
.shape('circle')
.color('#fbb03b')
.size(5)
.style({
stroke: '#fff',
strokeWidth: 2,
});
scene.addLayer(layer);
});
scene.on('dragging', (e: any) => {
//dragging - drag
// console.log('drag', startPoint, e.lngLat)
// @ts-ignore
const start = [startPoint.lng, startPoint.lat];
const dis = lnglatDistance(
// @ts-ignore
start,
[e.lngLat.lng, e.lngLat.lat],
);
// console.log('dis', dis)
const circleData = createGeoJSONCircle(
start as [number, number],
dis / 1000,
);
circleLayer.setData(circleData.data);
// console.log('circleData.data', circleData.data)
const popup = new Popup().setText(`${dis}`).setLnglat(e.lngLat);
scene.addPopup(popup);
});
scene.on('dragend', (e: any) => {
console.log('dragend');
// @ts-ignore
scene.getMapService().setMapStatus({ dragEnable: true });
});
});
}
public render() {
return (
<div
id="map"
style={{
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
}}
/>
);
}
}

View File

@ -1,60 +0,0 @@
import { Scene } from '@antv/l7';
import { DrawControl } from '@antv/l7-draw';
import { GaodeMap, Mapbox } from '@antv/l7-maps';
import * as React from 'react';
export default class Circle extends React.Component {
private scene: Scene;
public componentWillUnmount() {
this.scene.destroy();
}
public async componentDidMount() {
const scene = new Scene({
id: 'map',
map: new Mapbox({
pitch: 0,
style: 'mapbox://styles/mapbox/satellite-v9', // hosted style id
center: [-91.874, 42.76], // starting position
zoom: 12, // starting zoom
}),
});
this.scene = scene;
scene.on('loaded', () => {
const drawControl = new DrawControl(scene, {
position: 'topright',
layout: 'horizontal', // horizontal vertical
controls: {
point: true,
polygon: true,
line: true,
circle: true,
rect: true,
delete: true,
},
});
scene.on('click', () => {});
drawControl.on('draw.update', (e: any) => {
console.log('update', e);
});
scene.addControl(drawControl);
});
}
public render() {
return (
<div
id="map"
style={{
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
}}
/>
);
}
}

View File

@ -1,68 +0,0 @@
import { LineLayer, PointLayer, PolygonLayer, Popup, Scene } from '@antv/l7';
import { DrawLine } from '@antv/l7-draw';
import { GaodeMap, Mapbox } from '@antv/l7-maps';
import * as React from 'react';
export default class Circle extends React.Component {
private scene: Scene;
public componentWillUnmount() {
this.scene.destroy();
}
public async componentDidMount() {
const scene = new Scene({
id: 'map',
map: new Mapbox({
pitch: 0,
style: 'light',
center: [79.8046875, 52.482780222078226],
zoom: 4,
}),
});
this.scene = scene;
const line = scene.on('loaded', () => {
const drawLine = new DrawLine(scene, {
data: {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
properties: {},
geometry: {
type: 'LineString',
coordinates: [
[79.8046875, 52.482780222078226],
[110.74218749999999, 36.87962060502676],
[111.4453125, 19.973348786110602],
[112.8515625, 9.795677582829743],
[95.2734375, -6.664607562172573],
[82.265625, -14.264383087562637],
[74.53125, -25.799891182088306],
[68.203125, -30.145127183376115],
[41.484375, -16.63619187839765],
],
},
},
],
},
});
drawLine.enable();
});
}
public render() {
return (
<div
id="map"
style={{
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
}}
/>
);
}
}

View File

@ -1,75 +0,0 @@
import { LineLayer, PointLayer, PolygonLayer, Popup, Scene } from '@antv/l7';
import { DrawPoint } from '@antv/l7-draw';
import { GaodeMap, Mapbox } from '@antv/l7-maps';
import * as React from 'react';
export default class Circle extends React.Component {
private scene: Scene;
public componentWillUnmount() {
this.scene.destroy();
}
public async componentDidMount() {
const scene = new Scene({
id: 'map',
map: new Mapbox({
pitch: 0,
style: 'light',
center: [113.775374, 28.31067],
zoom: 12,
}),
});
this.scene = scene;
scene.on('loaded', () => {
const drawPoint = new DrawPoint(scene, {
data: {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
properties: {},
geometry: {
type: 'Point',
coordinates: [88.9453125, 53.330872983017066],
},
},
{
type: 'Feature',
properties: {},
geometry: {
type: 'Point',
coordinates: [109.3359375, 28.613459424004414],
},
},
{
type: 'Feature',
properties: {},
geometry: {
type: 'Point',
coordinates: [97.734375, 35.460669951495305],
},
},
],
},
});
drawPoint.enable();
});
}
public render() {
return (
<div
id="map"
style={{
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
}}
/>
);
}
}

View File

@ -1,48 +0,0 @@
import { LineLayer, PointLayer, PolygonLayer, Popup, Scene } from '@antv/l7';
import { DrawRect } from '@antv/l7-draw';
import { GaodeMap, Mapbox } from '@antv/l7-maps';
import * as React from 'react';
export default class Circle extends React.Component {
private scene: Scene;
public componentWillUnmount() {
this.scene.destroy();
}
public async componentDidMount() {
const scene = new Scene({
id: 'map',
map: new Mapbox({
pitch: 0,
style: 'light',
center: [113.775374, 28.31067],
zoom: 12,
}),
});
this.scene = scene;
scene.on('loaded', () => {
const drawRect = new DrawRect(scene, {
editEnable: false,
selectEnable: false,
});
drawRect.enable();
});
}
public render() {
return (
<div
id="map"
style={{
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
}}
/>
);
}
}

View File

@ -1,70 +0,0 @@
import { Scene } from '@antv/l7';
import { DrawPolygon } from '@antv/l7-draw';
import { GaodeMap, Mapbox } from '@antv/l7-maps';
import * as React from 'react';
export default class Circle extends React.Component {
private scene: Scene;
public componentWillUnmount() {
this.scene.destroy();
}
public async componentDidMount() {
const scene = new Scene({
id: 'map',
map: new Mapbox({
pitch: 0,
style: 'light',
center: [44.29687499999999, 55.3791104480105],
zoom: 3,
}),
});
this.scene = scene;
scene.on('loaded', () => {
const drawPolygon = new DrawPolygon(scene, {
data: {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
properties: {},
geometry: {
type: 'Polygon',
coordinates: [
[
[44.29687499999999, 55.3791104480105],
[28.4765625, 47.754097979680026],
[27.0703125, 38.8225909761771],
[42.890625, 33.43144133557529],
[73.47656249999999, 37.43997405227057],
[85.4296875, 47.989921667414194],
[79.1015625, 60.58696734225869],
[44.29687499999999, 55.3791104480105],
],
],
},
},
],
},
});
// drawPolygon.enable();
});
}
public render() {
return (
<div
id="map"
style={{
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
}}
/>
);
}
}

View File

@ -1,20 +0,0 @@
import { storiesOf } from '@storybook/react';
import * as React from 'react';
import AMapDraw from './Components/AmapDraw';
import Circle from './Components/Circle';
import DrawCircle from './Components/DrawCircle';
import DrawControl from './Components/DrawControl';
import Line from './Components/DrawLine';
import Point from './Components/DrawPoint';
import DrawRect from './Components/DrawRect';
import Polygon from './Components/Polygon';
storiesOf('绘制', module)
.add('圆', () => <Circle />, {})
.add('矩形', () => <DrawRect />, {})
.add('多边形', () => <Polygon />, {})
.add('点', () => <Point />, {})
.add('路径', () => <Line />, {})
.add('绘制组件', () => <DrawControl />, {})
.add('绘制圆', () => <DrawCircle />, {})
.add('高德地图', () => <AMapDraw />, {});

15895
yarn.lock

File diff suppressed because it is too large Load Diff