Merge pull request #497 from ParryQiu/master

fix: 修复去除重复点计算逻辑的 bug
This commit is contained in:
@thinkinggis 2020-08-28 16:38:54 +08:00 committed by GitHub
commit a371768cee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 9 deletions

View File

@ -1,5 +1,10 @@
import { Scene, LineLayer } from '@antv/l7'; import {
import { Mapbox } from '@antv/l7-maps'; Scene,
LineLayer
} from '@antv/l7';
import {
Mapbox
} from '@antv/l7-maps';
const scene = new Scene({ const scene = new Scene({
id: 'map', id: 'map',

View File

@ -18,6 +18,6 @@ describe('extrude polyline', () => {
coord[1] = lat; coord[1] = lat;
}); });
const mesh = extrude.extrude(coords); const mesh = extrude.extrude(coords);
expect(mesh.indices.length).toBe(12); expect(mesh.indices.length).toBe(6);
}); });
}); });

View File

@ -34,12 +34,17 @@ function isPointEqual(a: vec2, b: vec2) {
} }
function getArrayUnique(matrix: number[][]) { function getArrayUnique(matrix: number[][]) {
const result: number[][] = []; const map = new Map();
matrix.map((item) => { for (let i = 0; i < matrix.length; i++) {
item.sort((a, b) => b - a); const key = matrix[0].toString() + '-' + matrix[1].toString();
result.push(item); if (map.get(key)) {
}); matrix.splice(i, 1);
return result; i++;
} else {
map.set(key, key);
}
}
return matrix;
} }
export interface IExtrudeLineOption { export interface IExtrudeLineOption {