@navaramap/core 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +3 -0
  3. package/dist/index.d.ts +605 -0
  4. package/dist/index.js +3042 -0
  5. package/dist/index.umd.cjs +1 -0
  6. package/package.json +38 -0
  7. package/src/abstracts/index.ts +1 -0
  8. package/src/abstracts/vec3.ts +15 -0
  9. package/src/assertions.ts +15 -0
  10. package/src/batch/attribute.test.ts +20 -0
  11. package/src/batch/attribute.ts +14 -0
  12. package/src/batch/index.ts +1 -0
  13. package/src/color/Color.ts +10 -0
  14. package/src/color/ColorMap.ts +86 -0
  15. package/src/color/index.ts +3 -0
  16. package/src/color/types.ts +4 -0
  17. package/src/constants/image.ts +1 -0
  18. package/src/constants/index.ts +1 -0
  19. package/src/error.ts +11 -0
  20. package/src/event/EventManager.test.ts +539 -0
  21. package/src/event/EventManager.ts +387 -0
  22. package/src/event/TransactionManager.test.ts +126 -0
  23. package/src/event/TransactionManager.ts +78 -0
  24. package/src/event/index.ts +2 -0
  25. package/src/event/mock.ts +36 -0
  26. package/src/eventHandler.ts +52 -0
  27. package/src/globe/Globe.ts +156 -0
  28. package/src/globe/index.ts +1 -0
  29. package/src/id.ts +9 -0
  30. package/src/index.ts +15 -0
  31. package/src/namedIndexMap.test.ts +268 -0
  32. package/src/namedIndexMap.ts +50 -0
  33. package/src/observed.ts +30 -0
  34. package/src/plugin.ts +15 -0
  35. package/src/time.ts +3 -0
  36. package/src/types/buffer.ts +4 -0
  37. package/src/types/camera.ts +16 -0
  38. package/src/types/cameraFrustum.ts +5 -0
  39. package/src/types/feature.ts +1 -0
  40. package/src/types/index.ts +13 -0
  41. package/src/types/layer.ts +1 -0
  42. package/src/types/plane.ts +5 -0
  43. package/src/types/ray.ts +5 -0
  44. package/src/types/tile.ts +1 -0
  45. package/src/types/transform.ts +5 -0
  46. package/src/types/unit.ts +7 -0
  47. package/src/types/utils.ts +20 -0
  48. package/src/types/vec.ts +9 -0
  49. package/src/types/window.ts +5 -0
  50. package/src/utils/ExtentRadianF32Like.ts +17 -0
  51. package/src/utils/FloatAttributeLike.ts +17 -0
  52. package/src/utils/ReturnedConstructedTerrainMeshLike.ts +92 -0
  53. package/src/utils/TransferableMartiniLike.ts +21 -0
  54. package/src/utils/TransferableRasterDEMDataLike.ts +36 -0
  55. package/src/utils/TransferableTileLike.ts +53 -0
  56. package/src/utils/UpsamplableTerrainGeometryLike.ts +26 -0
  57. package/src/utils/Vec3Like.ts +15 -0
  58. package/src/utils/index.ts +9 -0
  59. package/src/utils/polygon/ConstructedPolygonGeometryLike.ts +70 -0
  60. package/src/utils/polygon/PolygonMaterialLike.ts +37 -0
  61. package/src/utils/polygon/TransferablePolygonBatchedFeatureLike.ts +73 -0
  62. package/src/utils/polygon/index.ts +3 -0
  63. package/src/utils/polyline/ConstructedPolylineGeometryLike.ts +77 -0
  64. package/src/utils/polyline/PolylineMaterialLike.ts +31 -0
  65. package/src/utils/polyline/TransferablePolylineBatchedFeatureLike.ts +43 -0
  66. package/src/utils/polyline/index.ts +3 -0
  67. package/src/vite-env.d.ts +1 -0
@@ -0,0 +1,17 @@
1
+ import type { ExtentRadianF32 } from "@navaramap/engine";
2
+
3
+ import type { RemoveFreeRecursively } from "../types";
4
+
5
+ export class ExtentRadianF32Like implements RemoveFreeRecursively<ExtentRadianF32> {
6
+ east: number;
7
+ north: number;
8
+ south: number;
9
+ west: number;
10
+
11
+ constructor(t: ExtentRadianF32) {
12
+ this.east = t.east;
13
+ this.north = t.north;
14
+ this.south = t.south;
15
+ this.west = t.west;
16
+ }
17
+ }
@@ -0,0 +1,17 @@
1
+ import type { FloatAttribute } from "@navaramap/engine";
2
+
3
+ import type { RemoveFreeRecursively } from "../types";
4
+
5
+ export class FloatAttributeLike implements RemoveFreeRecursively<FloatAttribute> {
6
+ data: Float32Array;
7
+ size: number;
8
+
9
+ constructor(t: FloatAttribute) {
10
+ this.data = t.transferData();
11
+ this.size = t.size;
12
+ }
13
+
14
+ transferData(): Float32Array {
15
+ throw new Error();
16
+ }
17
+ }
@@ -0,0 +1,92 @@
1
+ import type { ReturnedConstructedTerrainMesh } from "@navaramap/engine";
2
+
3
+ import type { RemoveFreeRecursively } from "../types";
4
+
5
+ import { Vec3Like } from "./Vec3Like";
6
+
7
+ export class ReturnedConstructedTerrainMeshLike implements RemoveFreeRecursively<ReturnedConstructedTerrainMesh> {
8
+ vertices: Float32Array;
9
+ uvs: Float32Array;
10
+ indices: Uint32Array;
11
+ heights: Float32Array;
12
+ max_height: number;
13
+ min_height: number;
14
+ rtc_translation: Vec3Like | undefined;
15
+ normals: Float32Array | undefined;
16
+ skirt_vertices: Float32Array | undefined;
17
+ skirt_uvs: Float32Array | undefined;
18
+ skirt_indices: Uint32Array | undefined;
19
+ skirt_normals: Float32Array | undefined;
20
+ watermask: Uint8Array | undefined;
21
+
22
+ // The transfer* methods return arrays copied out of WASM memory (owned by
23
+ // JS, backed by their own ArrayBuffer), so they are retained and transferred
24
+ // as-is — a further copy (`.slice()`) would be redundant.
25
+ constructor(t: ReturnedConstructedTerrainMesh) {
26
+ this.vertices = t.transferVertices();
27
+ this.uvs = t.transferUvs();
28
+ this.indices = t.transferIndices();
29
+ this.heights = t.transferHeights();
30
+ this.max_height = t.max_height;
31
+ this.min_height = t.min_height;
32
+ this.rtc_translation = t.rtc_translation
33
+ ? new Vec3Like(t.rtc_translation)
34
+ : undefined;
35
+ if (t.hasNormals()) {
36
+ this.normals = t.transferNormals();
37
+ }
38
+ if (t.hasSkirt()) {
39
+ this.skirt_vertices = t.transferSkirtVertices();
40
+ this.skirt_uvs = t.transferSkirtUvs();
41
+ this.skirt_indices = t.transferSkirtIndices();
42
+ this.skirt_normals = t.transferSkirtNormals();
43
+ }
44
+ if (t.hasWatermask()) {
45
+ this.watermask = t.transferWatermask();
46
+ }
47
+ }
48
+
49
+ transferVertices(): Float32Array {
50
+ throw new Error();
51
+ }
52
+ transferUvs(): Float32Array {
53
+ throw new Error();
54
+ }
55
+ transferIndices(): Uint32Array {
56
+ throw new Error();
57
+ }
58
+ transferHeights(): Float32Array {
59
+ throw new Error();
60
+ }
61
+ transferNormals(): Float32Array | undefined {
62
+ throw new Error();
63
+ }
64
+ transferSkirtVertices(): Float32Array | undefined {
65
+ throw new Error();
66
+ }
67
+ transferSkirtUvs(): Float32Array | undefined {
68
+ throw new Error();
69
+ }
70
+ transferSkirtIndices(): Uint32Array | undefined {
71
+ throw new Error();
72
+ }
73
+ transferSkirtNormals(): Float32Array | undefined {
74
+ throw new Error();
75
+ }
76
+ transferWatermask(): Uint8Array | undefined {
77
+ throw new Error();
78
+ }
79
+ hasSkirt(): boolean {
80
+ return (
81
+ this.skirt_vertices !== undefined &&
82
+ this.skirt_uvs !== undefined &&
83
+ this.skirt_indices !== undefined
84
+ );
85
+ }
86
+ hasNormals(): boolean {
87
+ return this.normals !== undefined;
88
+ }
89
+ hasWatermask(): boolean {
90
+ return this.watermask !== undefined;
91
+ }
92
+ }
@@ -0,0 +1,21 @@
1
+ import type { TransferableMartini } from "@navaramap/engine";
2
+
3
+ import type { RemoveFreeRecursively } from "../types";
4
+
5
+ export class TransferableMartiniLike implements RemoveFreeRecursively<TransferableMartini> {
6
+ coords: Uint32Array;
7
+ size: number;
8
+
9
+ constructor(coords: Uint32Array, size: number) {
10
+ this.coords = coords;
11
+ this.size = size;
12
+ }
13
+
14
+ transfer_coords(): Uint32Array {
15
+ return this.coords;
16
+ }
17
+
18
+ clone() {
19
+ return new TransferableMartiniLike(this.coords.slice(), this.size);
20
+ }
21
+ }
@@ -0,0 +1,36 @@
1
+ import type {
2
+ ElevationDecoder,
3
+ TransferableRasterDEMData,
4
+ } from "@navaramap/engine";
5
+
6
+ import type { RemoveFreeRecursively } from "../types";
7
+
8
+ export class TransferableRasterDEMDataLike implements RemoveFreeRecursively<TransferableRasterDEMData> {
9
+ decoder: ElevationDecoderLike;
10
+
11
+ constructor(decoder: ElevationDecoder) {
12
+ this.decoder = new ElevationDecoderLike(decoder);
13
+ }
14
+ }
15
+
16
+ export class ElevationDecoderLike implements RemoveFreeRecursively<ElevationDecoder> {
17
+ b_scaler: number;
18
+ boundary: number;
19
+ epsilon: number;
20
+ g_scaler: number;
21
+ max_offset: number;
22
+ min_offset: number;
23
+ offset: number;
24
+ r_scaler: number;
25
+
26
+ constructor(t: ElevationDecoder) {
27
+ this.b_scaler = t.b_scaler;
28
+ this.boundary = t.boundary;
29
+ this.epsilon = t.epsilon;
30
+ this.g_scaler = t.g_scaler;
31
+ this.max_offset = t.max_offset;
32
+ this.min_offset = t.min_offset;
33
+ this.offset = t.offset;
34
+ this.r_scaler = t.r_scaler;
35
+ }
36
+ }
@@ -0,0 +1,53 @@
1
+ import type {
2
+ CachedMeshHandle,
3
+ TileXYZ,
4
+ TransferableTile,
5
+ } from "@navaramap/engine";
6
+
7
+ import type { RemoveFreeRecursively } from "../types";
8
+
9
+ export class TransferableTileLike {
10
+ cached_mesh_handle?: CachedMeshHandleLike | undefined;
11
+ coords: TileXYZLike;
12
+ max_height: number;
13
+ min_height: number;
14
+
15
+ constructor(t: TransferableTile) {
16
+ this.cached_mesh_handle = t.cached_mesh_handle
17
+ ? new CachedMeshHandleLike(t.cached_mesh_handle)
18
+ : undefined;
19
+ this.coords = new TileXYZLike(t.coords);
20
+ this.max_height = t.max_height;
21
+ this.min_height = t.min_height;
22
+ }
23
+
24
+ free(): void {}
25
+ }
26
+
27
+ export class TileXYZLike implements RemoveFreeRecursively<TileXYZ> {
28
+ x: number;
29
+ y: number;
30
+ z: number;
31
+
32
+ constructor(t: TileXYZ) {
33
+ this.x = t.x;
34
+ this.y = t.y;
35
+ this.z = t.z;
36
+ }
37
+ }
38
+
39
+ export class CachedMeshHandleLike {
40
+ vertices: number;
41
+ uvs: number;
42
+ indices: number;
43
+ heights?: number | undefined;
44
+
45
+ constructor(t: CachedMeshHandle) {
46
+ this.vertices = t.vertices;
47
+ this.uvs = t.uvs;
48
+ this.indices = t.indices;
49
+ this.heights = t.heights;
50
+ }
51
+
52
+ free(): void {}
53
+ }
@@ -0,0 +1,26 @@
1
+ import type { UpsamplableTerrainGeometry } from "@navaramap/engine";
2
+
3
+ import type { RemoveFreeRecursively } from "../types";
4
+
5
+ export class UpsamplableTerrainGeometryLike implements RemoveFreeRecursively<UpsamplableTerrainGeometry> {
6
+ uvs: Float32Array;
7
+ indices: Uint32Array;
8
+ heights: Float32Array;
9
+ normals: Float32Array | undefined;
10
+ /** Parent quantized-mesh watermask (1 byte uniform or 65536 byte 256x256 grid). */
11
+ watermask: Uint8Array | undefined;
12
+
13
+ constructor(
14
+ uvs: Float32Array,
15
+ indices: Uint32Array,
16
+ heights: Float32Array,
17
+ normals?: Float32Array,
18
+ watermask?: Uint8Array,
19
+ ) {
20
+ this.uvs = uvs;
21
+ this.indices = indices;
22
+ this.heights = heights;
23
+ this.normals = normals;
24
+ this.watermask = watermask;
25
+ }
26
+ }
@@ -0,0 +1,15 @@
1
+ import type { Vec3 } from "@navaramap/engine";
2
+
3
+ import type { RemoveFreeRecursively } from "../types";
4
+
5
+ export class Vec3Like implements RemoveFreeRecursively<Vec3> {
6
+ x: number;
7
+ y: number;
8
+ z: number;
9
+
10
+ constructor(t: Vec3) {
11
+ this.x = t.x;
12
+ this.y = t.y;
13
+ this.z = t.z;
14
+ }
15
+ }
@@ -0,0 +1,9 @@
1
+ export * from "./TransferableTileLike";
2
+ export * from "./TransferableMartiniLike";
3
+ export * from "./UpsamplableTerrainGeometryLike";
4
+ export * from "./TransferableRasterDEMDataLike";
5
+ export * from "./ReturnedConstructedTerrainMeshLike";
6
+ export * from "./polygon";
7
+ export * from "./polyline";
8
+ export * from "./ExtentRadianF32Like";
9
+ export * from "./Vec3Like";
@@ -0,0 +1,70 @@
1
+ import type { ConstructedPolygonGeometry } from "@navaramap/engine";
2
+
3
+ import { ExtentRadianF32Like } from "../ExtentRadianF32Like";
4
+ import { Vec3Like } from "../Vec3Like";
5
+
6
+ export class ConstructedPolygonGeometryLike {
7
+ extent: ExtentRadianF32Like | undefined;
8
+ position_3d_high: Float32Array | undefined;
9
+ position_3d_high_size: number | undefined;
10
+ position_3d_low: Float32Array | undefined;
11
+ position_3d_low_size: number | undefined;
12
+ position: Float32Array | undefined;
13
+ position_size: number | undefined;
14
+ normal: Float32Array | undefined;
15
+ normal_size: number | undefined;
16
+ scale_normal_and_cap: Float32Array | undefined;
17
+ scale_normal_and_cap_size: number | undefined;
18
+ batch_id: Float32Array | undefined;
19
+ batch_id_size: number | undefined;
20
+ batch_index: Uint32Array | undefined;
21
+ batch_index_size: number | undefined;
22
+ indices: Uint32Array;
23
+ /** RTC (Relative-To-Center) translation vector in world-space ECEF coordinates */
24
+ rtc_translation: Vec3Like | undefined;
25
+ outline_position: Float32Array | undefined;
26
+ outline_position_size: number | undefined;
27
+ outline_scale_normal_and_cap: Float32Array | undefined;
28
+ outline_scale_normal_and_cap_size: number | undefined;
29
+ outline_skip_indices: Uint32Array | undefined;
30
+ outline_batch_index: Float32Array | undefined;
31
+ outline_batch_index_size: number | undefined;
32
+
33
+ constructor(t: ConstructedPolygonGeometry) {
34
+ const extent = t.extent;
35
+ this.extent = extent ? new ExtentRadianF32Like(extent) : undefined;
36
+ // Need to make a slice to avoid memory leak due to it's transferred.
37
+ this.position_3d_high = t.position_3d_high()?.slice();
38
+ this.position_3d_high_size = t.position_3d_high_size();
39
+ this.position_3d_low = t.position_3d_low()?.slice();
40
+ this.position_3d_low_size = t.position_3d_low_size();
41
+ this.position = t.position()?.slice();
42
+ this.position_size = t.position_size();
43
+ this.normal = t.normal()?.slice();
44
+ this.normal_size = t.normal_size();
45
+ this.scale_normal_and_cap = t.scale_normal_and_cap()?.slice();
46
+ this.scale_normal_and_cap_size = t.scale_normal_and_cap_size();
47
+ this.batch_id = t.batch_id()?.slice();
48
+ this.batch_id_size = t.batch_id_size();
49
+ this.batch_index = t.batch_index()?.slice();
50
+ this.batch_index_size = t.batch_index_size();
51
+ this.indices = t.indices().slice();
52
+ this.rtc_translation = t.rtc_translation
53
+ ? new Vec3Like(t.rtc_translation)
54
+ : undefined;
55
+ const outline = t.outline();
56
+ if (outline) {
57
+ this.outline_position = outline.position()?.slice();
58
+ this.outline_position_size = outline.position_size();
59
+ this.outline_scale_normal_and_cap = outline
60
+ .scale_normal_and_cap()
61
+ ?.slice();
62
+ this.outline_scale_normal_and_cap_size =
63
+ outline.scale_normal_and_cap_size();
64
+ this.outline_skip_indices = outline.skip_indices()?.slice();
65
+ this.outline_batch_index = outline.batch_index()?.slice();
66
+ this.outline_batch_index_size = outline.batch_index_size();
67
+ outline.free();
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,37 @@
1
+ import type {
2
+ PolygonInternalMaterial,
3
+ PolygonMaterial,
4
+ } from "@navaramap/engine";
5
+
6
+ export class PolygonMaterialLike {
7
+ clampToGround?: boolean;
8
+ tiled?: boolean;
9
+ castShadow?: boolean;
10
+ receiveShadow?: boolean;
11
+ color?: number;
12
+ extrudedHeight?: number;
13
+ height?: number;
14
+ show?: boolean;
15
+ perPositionHeight?: boolean;
16
+ wireframe?: boolean;
17
+ outline?: boolean;
18
+ __internal__?: PolygonInternalMaterial | undefined;
19
+
20
+ constructor(material: PolygonMaterial) {
21
+ this.clampToGround = material.clampToGround;
22
+ this.tiled = material.tiled;
23
+ this.receiveShadow = material.receiveShadow;
24
+ this.castShadow = material.castShadow;
25
+ this.color = material.color;
26
+ this.extrudedHeight = material.extrudedHeight;
27
+ this.height = material.height;
28
+ this.show = material.show;
29
+
30
+ this.perPositionHeight = material.perPositionHeight;
31
+
32
+ this.wireframe = material.wireframe;
33
+ this.outline = material.outline;
34
+ }
35
+
36
+ free(): void {}
37
+ }
@@ -0,0 +1,73 @@
1
+ import type {
2
+ CRS,
3
+ ReturnedTransferablePolygonBatchedFeature,
4
+ TransferablePolygonBatchedFeature,
5
+ } from "@navaramap/engine";
6
+
7
+ import type { RemoveFreeRecursively } from "../../types";
8
+
9
+ export class TransferablePolygonBatchedFeatureLike implements RemoveFreeRecursively<TransferablePolygonBatchedFeature> {
10
+ batch_ids: Uint32Array;
11
+ batch_indices: Uint32Array;
12
+ crs: CRS;
13
+ expected_winding_orders: Uint8Array;
14
+ holes: Float64Array;
15
+ holes_boundaries: Uint32Array;
16
+ holes_sizes: Uint32Array;
17
+ holes_total_sizes: Uint32Array;
18
+ length: number;
19
+ outer_ring: Float64Array;
20
+ outer_ring_sizes: Uint32Array;
21
+
22
+ constructor(t: ReturnedTransferablePolygonBatchedFeature) {
23
+ this.batch_ids = t.transferBatchIds();
24
+ this.batch_indices = t.transferBatchIndices();
25
+ this.crs = t.crs();
26
+ this.expected_winding_orders = t.transferExpectedWindingOrders();
27
+ this.holes = t.transferHoles();
28
+ this.holes_boundaries = t.transferHolesBoundaries();
29
+ this.holes_sizes = t.transferHolesSizes();
30
+ this.holes_total_sizes = t.transferHolesTotalSizes();
31
+ this.length = t.length();
32
+ this.outer_ring = t.transferOuterRing();
33
+ this.outer_ring_sizes = t.transferOuterRingSizes();
34
+ }
35
+
36
+ setBatchIds(_length: number, _f: () => void) {}
37
+ setBatchIndices(_length: number, _f: () => void) {}
38
+ setExpectedWindingOrders(_length: number, _f: () => void) {}
39
+ setOuterRing(_length: number, _f: () => void) {}
40
+ setOuterRingSizes(_length: number, _f: () => void) {}
41
+ setHoles(_length: number, _f: () => void) {}
42
+ setHolesBoundaries(_length: number, _f: () => void) {}
43
+ setHolesSizes(_length: number, _f: () => void) {}
44
+ setHolesTotalSizes(_length: number, _f: () => void) {}
45
+
46
+ transferBatchIds(): Uint32Array {
47
+ throw new Error();
48
+ }
49
+ transferBatchIndices(): Uint32Array {
50
+ throw new Error();
51
+ }
52
+ transferExpectedWindingOrders(): Uint8Array {
53
+ throw new Error();
54
+ }
55
+ transferOuterRing(): Float64Array {
56
+ throw new Error();
57
+ }
58
+ transferOuterRingSizes(): Uint32Array {
59
+ throw new Error();
60
+ }
61
+ transferHoles(): Float64Array {
62
+ throw new Error();
63
+ }
64
+ transferHolesBoundaries(): Uint32Array {
65
+ throw new Error();
66
+ }
67
+ transferHolesSizes(): Uint32Array {
68
+ throw new Error();
69
+ }
70
+ transferHolesTotalSizes(): Uint32Array {
71
+ throw new Error();
72
+ }
73
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./TransferablePolygonBatchedFeatureLike";
2
+ export * from "./PolygonMaterialLike";
3
+ export * from "./ConstructedPolygonGeometryLike";
@@ -0,0 +1,77 @@
1
+ import type { ConstructedPolylineGeometry } from "@navaramap/engine";
2
+
3
+ import { ExtentRadianF32Like } from "../ExtentRadianF32Like";
4
+
5
+ export class ConstructedPolylineGeometryLike {
6
+ extent: ExtentRadianF32Like | undefined;
7
+ position: Float32Array;
8
+ position_size: number;
9
+ position_high: Float32Array | undefined;
10
+ position_high_size: number | undefined;
11
+ position_low: Float32Array | undefined;
12
+ position_low_size: number | undefined;
13
+ start: Float32Array | undefined;
14
+ start_size: number | undefined;
15
+ start_high: Float32Array | undefined;
16
+ start_high_size: number | undefined;
17
+ start_low: Float32Array | undefined;
18
+ start_low_size: number | undefined;
19
+ forward_offset: Float32Array | undefined;
20
+ forward_offset_size: number | undefined;
21
+ end_high: Float32Array | undefined;
22
+ end_high_size: number | undefined;
23
+ end_low: Float32Array | undefined;
24
+ end_low_size: number | undefined;
25
+ start_normals: Float32Array | undefined;
26
+ start_normals_size: number | undefined;
27
+ end_normal_and_texture_coordinate_normalization_x: Float32Array | undefined;
28
+ end_normal_and_texture_coordinate_normalization_x_size: number | undefined;
29
+ right_normal_and_texture_coordinate_normalization_y: Float32Array;
30
+ right_normal_and_texture_coordinate_normalization_y_size: number;
31
+ batch_id: Float32Array | undefined;
32
+ batch_id_size: number | undefined;
33
+ batch_index: Uint32Array | undefined;
34
+ batch_index_size: number | undefined;
35
+ indices: Uint32Array;
36
+
37
+ constructor(t: ConstructedPolylineGeometry) {
38
+ const extent = t.extent;
39
+ this.extent = extent ? new ExtentRadianF32Like(extent) : undefined;
40
+ // Need to make a slice to avoid memory leak due to it's transferred.
41
+ this.position = t.position().slice();
42
+ this.position_size = t.position_size();
43
+ this.position_high = t.position_high()?.slice();
44
+ this.position_high_size = t.position_high_size();
45
+ this.position_low = t.position_low()?.slice();
46
+ this.position_low_size = t.position_low_size();
47
+ this.start = t.start()?.slice();
48
+ this.start_size = t.start_size();
49
+ this.start_high = t.start_high()?.slice();
50
+ this.start_high_size = t.start_high_size();
51
+ this.start_low = t.start_low()?.slice();
52
+ this.start_low_size = t.start_low_size();
53
+ this.forward_offset = t.forward_offset()?.slice();
54
+ this.forward_offset_size = t.forward_offset_size();
55
+ this.end_high = t.end_high()?.slice();
56
+ this.end_high_size = t.end_high_size();
57
+ this.end_low = t.end_low()?.slice();
58
+ this.end_low_size = t.end_low_size();
59
+ this.start_normals = t.start_normals()?.slice();
60
+ this.start_normals_size = t.start_normals_size();
61
+ this.end_normal_and_texture_coordinate_normalization_x = t
62
+ .end_normal_and_texture_coordinate_normalization_x()
63
+ ?.slice();
64
+ this.end_normal_and_texture_coordinate_normalization_x_size =
65
+ t.end_normal_and_texture_coordinate_normalization_x_size();
66
+ this.right_normal_and_texture_coordinate_normalization_y = t
67
+ .right_normal_and_texture_coordinate_normalization_y()
68
+ .slice();
69
+ this.right_normal_and_texture_coordinate_normalization_y_size =
70
+ t.right_normal_and_texture_coordinate_normalization_y_size();
71
+ this.batch_id = t.batch_id()?.slice();
72
+ this.batch_id_size = t.batch_id_size();
73
+ this.batch_index = t.batch_index()?.slice();
74
+ this.batch_index_size = t.batch_index_size();
75
+ this.indices = t.indices().slice();
76
+ }
77
+ }
@@ -0,0 +1,31 @@
1
+ import type {
2
+ PolylineInternalMaterial,
3
+ PolylineMaterial,
4
+ } from "@navaramap/engine";
5
+
6
+ export class PolylineMaterialLike {
7
+ clampToGround?: boolean;
8
+ tiled?: boolean;
9
+ castShadow?: boolean;
10
+ receiveShadow?: boolean;
11
+ color?: number;
12
+ height?: number;
13
+ width?: number;
14
+ maxWidth?: number;
15
+ show?: boolean;
16
+ __internal__?: PolylineInternalMaterial;
17
+
18
+ constructor(material: PolylineMaterial) {
19
+ this.clampToGround = material.clampToGround;
20
+ this.tiled = material.tiled;
21
+ this.receiveShadow = material.receiveShadow;
22
+ this.castShadow = material.castShadow;
23
+ this.color = material.color;
24
+ this.width = material.width;
25
+ this.maxWidth = material.maxWidth;
26
+ this.height = material.height;
27
+ this.show = material.show;
28
+ }
29
+
30
+ free(): void {}
31
+ }
@@ -0,0 +1,43 @@
1
+ import type {
2
+ CRS,
3
+ ReturnedTransferablePolylineBatchedFeature,
4
+ TransferablePolylineBatchedFeature,
5
+ } from "@navaramap/engine";
6
+
7
+ import type { RemoveFreeRecursively } from "../../types";
8
+
9
+ export class TransferablePolylineBatchedFeatureLike implements RemoveFreeRecursively<TransferablePolylineBatchedFeature> {
10
+ points: Float64Array;
11
+ points_sizes: Uint32Array;
12
+ batch_ids: Uint32Array;
13
+ batch_indices: Uint32Array;
14
+ crs: CRS;
15
+ length: number;
16
+
17
+ constructor(t: ReturnedTransferablePolylineBatchedFeature) {
18
+ this.points = t.transferPoints();
19
+ this.points_sizes = t.transferPointsSizes();
20
+ this.batch_ids = t.transferBatchIds();
21
+ this.batch_indices = t.transferBatchIndices();
22
+ this.crs = t.crs();
23
+ this.length = t.length();
24
+ }
25
+
26
+ setPoints(_byte_length: number, _f: () => void): void {}
27
+ setPointsSizes(_byte_length: number, _f: () => void): void {}
28
+ setBatchIds(_byte_length: number, _f: () => void): void {}
29
+ setBatchIndices(_length: number, _f: () => void) {}
30
+
31
+ transferPoints(): Float64Array {
32
+ throw new Error();
33
+ }
34
+ transferPointsSizes(): Uint32Array {
35
+ throw new Error();
36
+ }
37
+ transferBatchIds(): Uint32Array {
38
+ throw new Error();
39
+ }
40
+ transferBatchIndices(): Uint32Array {
41
+ throw new Error();
42
+ }
43
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./TransferablePolylineBatchedFeatureLike";
2
+ export * from "./PolylineMaterialLike";
3
+ export * from "./ConstructedPolylineGeometryLike";
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />