• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

visgl / loaders.gl / 24112850045

08 Apr 2026 01:31AM UTC coverage: 35.137% (+0.003%) from 35.134%
24112850045

push

github

web-flow
chore: biome replaces eslint/prettier (#3349)

1225 of 2057 branches covered (59.55%)

Branch coverage included in aggregate %.

55 of 603 new or added lines in 172 files covered. (9.12%)

1 existing line in 1 file now uncovered.

39942 of 115105 relevant lines covered (34.7%)

0.77 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

26.58
/modules/gis/src/lib/binary-geometry-api/concat-binary-geometry.ts
1
// loaders.gl
1✔
2
// SPDX-License-Identifier: MIT
1✔
3
// Copyright (c) vis.gl contributors
1✔
4

1✔
5
import type {
1✔
6
  TypedArray,
1✔
7
  BinaryPointGeometry,
1✔
8
  BinaryLineGeometry,
1✔
9
  BinaryPolygonGeometry
1✔
10
} from '@loaders.gl/schema';
1✔
11
import {concatTypedArrays} from '../utils/concat-typed-arrays';
1✔
12

1✔
13
export function concatenateBinaryPointGeometries(
1✔
14
  binaryPointGeometries: BinaryPointGeometry[],
×
15
  dimension: number
×
16
): BinaryPointGeometry {
×
NEW
17
  const positions: TypedArray[] = binaryPointGeometries.map(geometry => geometry.positions.value);
×
18
  const concatenatedPositions = new Float64Array(concatTypedArrays(positions).buffer);
×
19

×
20
  return {
×
21
    type: 'Point',
×
22
    positions: {value: concatenatedPositions, size: dimension}
×
23
  };
×
24
}
×
25

1✔
26
export function concatenateBinaryLineGeometries(
1✔
27
  binaryLineGeometries: BinaryLineGeometry[],
×
28
  dimension: number
×
29
): BinaryLineGeometry {
×
NEW
30
  const lines: TypedArray[] = binaryLineGeometries.map(geometry => geometry.positions.value);
×
31
  const concatenatedPositions = new Float64Array(concatTypedArrays(lines).buffer);
×
NEW
32
  const pathIndices = lines.map(line => line.length / dimension).map(cumulativeSum(0));
×
33
  pathIndices.unshift(0);
×
34

×
35
  return {
×
36
    type: 'LineString',
×
37
    positions: {value: concatenatedPositions, size: dimension},
×
38
    pathIndices: {value: new Uint32Array(pathIndices), size: 1}
×
39
  };
×
40
}
×
41

1✔
42
export function concatenateBinaryPolygonGeometries(
1✔
43
  binaryPolygonGeometries: BinaryPolygonGeometry[],
×
44
  dimension: number
×
45
): BinaryPolygonGeometry {
×
46
  const polygons: TypedArray[] = [];
×
47
  const primitivePolygons: TypedArray[] = [];
×
48

×
49
  for (const binaryPolygon of binaryPolygonGeometries) {
×
50
    const {positions, primitivePolygonIndices} = binaryPolygon;
×
51
    polygons.push(positions.value);
×
52
    primitivePolygons.push(primitivePolygonIndices.value);
×
53
  }
×
54

×
55
  const concatenatedPositions = new Float64Array(concatTypedArrays(polygons).buffer);
×
NEW
56
  const polygonIndices = polygons.map(p => p.length / dimension).map(cumulativeSum(0));
×
57
  polygonIndices.unshift(0);
×
58

×
59
  // Combine primitivePolygonIndices from each individual polygon
×
60
  const primitivePolygonIndices = [0];
×
61
  for (const primitivePolygon of primitivePolygons) {
×
62
    primitivePolygonIndices.push(
×
63
      ...primitivePolygon
×
64
        .filter((x: number) => x > 0)
×
65
        .map((x: number) => x + primitivePolygonIndices[primitivePolygonIndices.length - 1])
×
66
    );
×
67
  }
×
68

×
69
  return {
×
70
    type: 'Polygon',
×
71
    positions: {value: concatenatedPositions, size: dimension},
×
72
    polygonIndices: {value: new Uint32Array(polygonIndices), size: 1},
×
73
    primitivePolygonIndices: {value: new Uint32Array(primitivePolygonIndices), size: 1}
×
74
  };
×
75
}
×
76

1✔
77
// https://stackoverflow.com/a/55261098
1✔
78
const cumulativeSum = (sum: number) => (value: number) => (sum += value);
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc