Merge branch 'master' into l7-draw

This commit is contained in:
thinkinggis 2020-04-07 11:27:21 +08:00
commit a0d9561209
19 changed files with 55 additions and 52 deletions

View File

@ -14,7 +14,7 @@
"message": "chore: publish"
}
},
"version": "2.1.9",
"version": "2.1.10",
"npmClient": "yarn",
"useWorkspaces": true,
"publishConfig": {

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-component",
"version": "2.1.9",
"version": "2.1.10",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
@ -24,8 +24,8 @@
"author": "lzxue",
"license": "ISC",
"dependencies": {
"@antv/l7-core": "^2.1.9",
"@antv/l7-utils": "^2.1.9",
"@antv/l7-core": "^2.1.10",
"@antv/l7-utils": "^2.1.10",
"@babel/runtime": "^7.7.7",
"eventemitter3": "^4.0.0",
"inversify": "^5.0.1",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-core",
"version": "2.1.9",
"version": "2.1.10",
"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.9",
"@antv/l7-utils": "^2.1.10",
"@babel/runtime": "^7.7.7",
"@mapbox/tiny-sdf": "^1.1.1",
"ajv": "^6.10.2",

View File

@ -51,13 +51,13 @@ describe('moveFeature', () => {
const res = moveFeature([pointFeature], delta) as Array<
Feature<Geometry, Properties>
>;
expect(res[0].geometry.coordinates).toEqual([131, 48]);
expect(res[0]?.geometry?.coordinates).toEqual([131, 48]);
});
it('move BBox', () => {
const res = moveFeature([polyon], delta) as Array<
Feature<Geometry, Properties>
>;
expect(res[0].geometry.coordinates).toEqual([
expect(res[0]?.geometry?.coordinates).toEqual([
[
[50.5703125, 46.583289756006316],
[72.3671875, 46.583289756006316],
@ -71,7 +71,7 @@ describe('moveFeature', () => {
const res = moveFeature([line], delta) as Array<
Feature<Geometry, Properties>
>;
expect(res[0].geometry.coordinates).toEqual([
expect(res[0]?.geometry?.coordinates).toEqual([
[55.31640625, 63.91523303947614],
[72.015625, 63.59334083012024],
[71.48828125, 59.07787626787517],

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-draw",
"version": "2.1.9",
"version": "2.1.10",
"description": "L7 Draw moudules",
"keywords": [],
"author": "thinkinggis <lzx199065@gmail.com>",
@ -33,13 +33,13 @@
"test": "jest"
},
"dependencies": {
"@turf/midpoint": "^5.1.5",
"@antv/l7-component": "^2.1.9",
"@antv/l7": "^2.1.9",
"@antv/l7": "^2.1.10",
"@antv/l7-component": "^2.1.10",
"@babel/runtime": "^7.7.7",
"@turf/circle": "^6.0.1",
"@turf/distance": "^6.0.1",
"@turf/helpers": "^6.1.4",
"@turf/midpoint": "^5.1.5",
"lodash": "^4.6.2"
},
"bugs": {

View File

@ -83,7 +83,7 @@ export default abstract class DrawMode extends EventEmitter {
throw new Error('子类未实现该方法');
}
public getCurrentVertex(feature: Feature) {
public getCurrentVertex() {
return this.currentVertex;
}
public getCurrentFeature() {

View File

@ -59,12 +59,12 @@ export default class DrawPolygon extends DrawFeature {
public addVertex(vertex: Feature<Geometries, Properties>) {
// @ts-ignore
const id = vertex.properties.id;
const coord = vertex.geometry.coordinates as Position;
const coord = vertex?.geometry?.coordinates as Position;
const feature = this.currentFeature as Feature<Geometries, Properties>;
const type = feature.geometry.type;
const type = feature?.geometry?.type;
const points = [];
if (type === 'Polygon') {
const coords = feature.geometry.coordinates as Position[][];
const coords = feature?.geometry?.coordinates as Position[][];
coords[0].splice(id + 1, 0, coord);
for (let i = 0; i < coords[0].length - 1; i++) {
points.push({
@ -73,7 +73,7 @@ export default class DrawPolygon extends DrawFeature {
});
}
} else {
const coords = feature.geometry.coordinates as Position[];
const coords = feature?.geometry?.coordinates as Position[];
coords.splice(id + 1, 0, coord);
for (const coor of coords) {
points.push({
@ -176,6 +176,7 @@ export default class DrawPolygon extends DrawFeature {
} else {
// @ts-ignore
const id = selectVertexed.properties.id * 1;
// @ts-ignore
selectVertexed.geometry.coordinates = [vertex.lng, vertex.lat];
// @ts-ignore
this.pointFeatures[id].geometry.coordinates = [vertex.lng, vertex.lat];
@ -233,15 +234,15 @@ export default class DrawPolygon extends DrawFeature {
private editPolygonVertex(id: number, vertex: ILngLat) {
const feature = this.currentFeature as Feature<Geometries, Properties>;
const type = feature.geometry.type;
const type = feature?.geometry?.type;
if (type === 'Polygon') {
const coords = feature.geometry.coordinates as Position[][];
const coords = feature?.geometry?.coordinates as Position[][];
coords[0][id] = [vertex.lng, vertex.lat];
if (-id === 0) {
coords[0][coords[0].length - 1] = [vertex.lng, vertex.lat];
}
} else {
const coords = feature.geometry.coordinates as Position[];
const coords = feature?.geometry?.coordinates as Position[];
coords[id] = [vertex.lng, vertex.lat];
}
this.setCurrentFeature(feature);

View File

@ -1,7 +1,7 @@
import { ILayer, LineLayer, PointLayer, PolygonLayer } from '@antv/l7';
import { FeatureCollection } from '@turf/helpers';
export function renderFeature(fe: FeatureCollection, style: any): ILayer[] {
const type = fe.features[0].geometry.type;
const type = fe.features[0]?.geometry?.type;
let layers;
switch (type) {
case 'Point':

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7",
"version": "2.1.9",
"version": "2.1.10",
"description": "A Large-scale WebGL-powered Geospatial Data Visualization",
"main": "lib/index.js",
"module": "es/index.js",
@ -24,11 +24,11 @@
"author": "antv",
"license": "MIT",
"dependencies": {
"@antv/l7-component": "^2.1.9",
"@antv/l7-core": "^2.1.9",
"@antv/l7-layers": "^2.1.9",
"@antv/l7-maps": "^2.1.9",
"@antv/l7-scene": "^2.1.9",
"@antv/l7-component": "^2.1.10",
"@antv/l7-core": "^2.1.10",
"@antv/l7-layers": "^2.1.10",
"@antv/l7-maps": "^2.1.10",
"@antv/l7-scene": "^2.1.10",
"@babel/runtime": "^7.7.7"
},
"gitHead": "a5d354b66873f700730248d015c5e539c54b34b7",

View File

@ -3,4 +3,4 @@ export * from '@antv/l7-scene';
export * from '@antv/l7-maps';
export * from '@antv/l7-layers';
export * from '@antv/l7-component';
export const version = '2.1.9';
export const version = '2.1.10';

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-layers",
"version": "2.1.9",
"version": "2.1.10",
"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.9",
"@antv/l7-source": "^2.1.9",
"@antv/l7-utils": "^2.1.9",
"@antv/l7-core": "^2.1.10",
"@antv/l7-source": "^2.1.10",
"@antv/l7-utils": "^2.1.10",
"@babel/runtime": "^7.7.7",
"@mapbox/martini": "^0.1.0",
"@turf/meta": "^6.0.2",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-maps",
"version": "2.1.9",
"version": "2.1.10",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
@ -25,8 +25,8 @@
"author": "xiaoiver",
"license": "ISC",
"dependencies": {
"@antv/l7-core": "^2.1.9",
"@antv/l7-utils": "^2.1.9",
"@antv/l7-core": "^2.1.10",
"@antv/l7-utils": "^2.1.10",
"@babel/runtime": "^7.7.7",
"@types/amap-js-api": "^1.4.6",
"gl-matrix": "^3.1.0",

View File

@ -91,8 +91,9 @@ export default class MapboxService
public getContainer(): HTMLElement | null {
return this.map.getContainer();
}
public getMapCanvasContainer(): HTMLElement {
return this.map.getCanvasContainer();
return this.map.getCanvasContainer() as HTMLElement;
}
public getSize(): [number, number] {

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-react",
"version": "2.1.9",
"version": "2.1.10",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
@ -24,8 +24,8 @@
"author": "lzxue",
"license": "ISC",
"dependencies": {
"@antv/l7": "^2.1.9",
"@antv/l7-maps": "^2.1.9",
"@antv/l7": "^2.1.10",
"@antv/l7-maps": "^2.1.10",
"@babel/runtime": "^7.7.7",
"load-styles": "^2.0.0"
},

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-renderer",
"version": "2.1.9",
"version": "2.1.10",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
@ -25,7 +25,7 @@
"gl": "^4.4.0"
},
"dependencies": {
"@antv/l7-core": "^2.1.9",
"@antv/l7-core": "^2.1.10",
"@babel/runtime": "^7.7.7",
"inversify": "^5.0.1",
"lodash": "^4.17.15",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-scene",
"version": "2.1.9",
"version": "2.1.10",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
@ -22,11 +22,11 @@
"author": "xiaoiver",
"license": "ISC",
"dependencies": {
"@antv/l7-component": "^2.1.9",
"@antv/l7-core": "^2.1.9",
"@antv/l7-maps": "^2.1.9",
"@antv/l7-renderer": "^2.1.9",
"@antv/l7-utils": "^2.1.9",
"@antv/l7-component": "^2.1.10",
"@antv/l7-core": "^2.1.10",
"@antv/l7-maps": "^2.1.10",
"@antv/l7-renderer": "^2.1.10",
"@antv/l7-utils": "^2.1.10",
"@babel/runtime": "^7.7.7",
"inversify": "^5.0.1",
"mapbox-gl": "^1.2.1",

View File

@ -59,6 +59,7 @@ export default interface IMapController {
// get map params
getType(): string;
getMapContainer(): HTMLElement | null;
getMapCanvasContainer(): HTMLElement;
// control with raw map
setRotation(rotation: number): void;

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-source",
"version": "2.1.9",
"version": "2.1.10",
"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.9",
"@antv/l7-utils": "^2.1.9",
"@antv/l7-core": "^2.1.10",
"@antv/l7-utils": "^2.1.10",
"@babel/runtime": "^7.7.7",
"@mapbox/geojson-rewind": "^0.4.0",
"@turf/helpers": "^6.1.4",

View File

@ -1,6 +1,6 @@
{
"name": "@antv/l7-utils",
"version": "2.1.9",
"version": "2.1.10",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",