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 { Mapbox } from '@antv/l7-maps';
import {
Scene,
LineLayer
} from '@antv/l7';
import {
Mapbox
} from '@antv/l7-maps';
const scene = new Scene({
id: 'map',

View File

@ -18,6 +18,6 @@ describe('extrude polyline', () => {
coord[1] = lat;
});
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[][]) {
const result: number[][] = [];
matrix.map((item) => {
item.sort((a, b) => b - a);
result.push(item);
});
return result;
const map = new Map();
for (let i = 0; i < matrix.length; i++) {
const key = matrix[0].toString() + '-' + matrix[1].toString();
if (map.get(key)) {
matrix.splice(i, 1);
i++;
} else {
map.set(key, key);
}
}
return matrix;
}
export interface IExtrudeLineOption {