@mappable-world/mappable-types 0.0.14 → 0.0.16
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.
- package/common/types/data-source-description.d.ts +12 -3
- package/common/types/index.d.ts +1 -0
- package/common/types/tilt-range.d.ts +8 -0
- package/imperative/Entities.d.ts +12 -0
- package/imperative/MMap/index.d.ts +14 -3
- package/imperative/MMapControl/MMapControl.d.ts +20 -6
- package/imperative/MMapControls/index.d.ts +13 -2
- package/imperative/MMapCopyrights/index.d.ts +8 -1
- package/imperative/MMapCoverage/index.d.ts +1 -1
- package/imperative/MMapDefaultFeaturesLayer/index.d.ts +2 -0
- package/imperative/MMapDefaultSchemeLayer/index.d.ts +22 -11
- package/imperative/MMapFeature/index.d.ts +3 -1
- package/{modules/controls-extra → imperative}/MMapScaleControl/index.d.ts +4 -4
- package/imperative/MMapTileDataSource/index.d.ts +4 -1
- package/imperative/index.d.ts +2 -1
- package/imperative/route/index.d.ts +2 -2
- package/import.d.ts +7 -0
- package/modules/analytics/index.d.ts +4 -0
- package/modules/analytics/src/DataProviders/BaseDataProvider.d.ts +40 -0
- package/modules/analytics/src/DataProviders/JSONDataProvider.d.ts +27 -0
- package/modules/analytics/src/DataProviders/JSONLinesDataProvider.d.ts +41 -0
- package/modules/analytics/src/DataProviders/StaticDataProvider.d.ts +18 -0
- package/modules/analytics/src/DataProviders/index.d.ts +4 -0
- package/modules/analytics/src/DataProviders/utils/loadByChunk.d.ts +1 -0
- package/modules/analytics/src/MMapDataAnalyticsLayer/MMapDataAnalyticsLayer.d.ts +90 -0
- package/modules/analytics/src/MMapDefaultVectorLayerImplementation/MMapDefaultVectorLayerImplementation.d.ts +95 -0
- package/modules/analytics/src/MMapDefaultVectorLayerImplementation/utils/atlas.d.ts +27 -0
- package/modules/analytics/src/MMapDefaultVectorLayerImplementation/utils/calculateNormalsForVertices.d.ts +5 -0
- package/modules/analytics/src/MMapDefaultVectorLayerImplementation/utils/frameBuffer.d.ts +29 -0
- package/modules/analytics/src/MMapDefaultVectorLayerImplementation/utils/memoryManager.d.ts +49 -0
- package/modules/analytics/src/MMapDefaultVectorLayerImplementation/utils/program.d.ts +10 -0
- package/modules/analytics/src/MMapDefaultVectorLayerImplementation/utils/scheduleManager.d.ts +44 -0
- package/modules/analytics/src/MMapDefaultVectorLayerImplementation/utils/utils.d.ts +35 -0
- package/modules/analytics/src/MMapGeoJsonLayer/MMapGeoJsonImplementation.d.ts +3 -0
- package/modules/analytics/src/MMapGeoJsonLayer/MMapGeoJsonLayer.d.ts +64 -0
- package/modules/analytics/src/MMapGeoJsonLayer/renders/geojson.d.ts +3 -0
- package/modules/analytics/src/MMapGeoJsonLayer/utils/constants.d.ts +17 -0
- package/modules/analytics/src/MMapGeoJsonLayer/utils/generateGeometryBuffers.d.ts +17 -0
- package/modules/analytics/src/MMapGeoJsonLayer/utils/generateLineGeometry.d.ts +6 -0
- package/modules/analytics/src/MMapGeoJsonLayer/utils/generatePointGeometry.d.ts +4 -0
- package/modules/analytics/src/MMapGeoJsonLayer/utils/generatePolygonGeometry.d.ts +2 -0
- package/modules/analytics/src/MMapGeoJsonLayer/utils/utils.d.ts +37 -0
- package/modules/analytics/src/MMapHeatmapLayer/MMapHeatmapLayer.d.ts +38 -0
- package/modules/analytics/src/MMapHeatmapLayer/MMapHeatmapLayerImplementation.d.ts +3 -0
- package/modules/analytics/src/MMapHeatmapLayer/renders/gradient.d.ts +3 -0
- package/modules/analytics/src/MMapHeatmapLayer/renders/heatmap.d.ts +3 -0
- package/modules/analytics/src/interface.d.ts +42 -0
- package/modules/analytics/src/types.d.ts +8 -0
- package/modules/types.d.ts +1 -0
- package/package.json +1 -1
- package/packages/clusterer/MMapClusterer/MMapClusterer.d.ts +4 -3
- package/packages/controls/MMapZoomControl/index.d.ts +5 -17
- /package/{modules/controls-extra → imperative}/MMapScaleControl/distance-utils.d.ts +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { LngLat, VectorLayerImplementationConstructor, Projection, TileCoordinates } from "../../../../common/types";
|
|
2
|
+
import type { DomEventHandler, MMapLayerProps } from "../../../../imperative";
|
|
3
|
+
import type { GlTile } from "../MMapDefaultVectorLayerImplementation/MMapDefaultVectorLayerImplementation";
|
|
4
|
+
interface MMapDataAnalyticsLayerProps<ItemType> extends Omit<MMapLayerProps, "type" | "implementation" | "source"> {
|
|
5
|
+
tileSize?: number;
|
|
6
|
+
hitTestTimeout?: number;
|
|
7
|
+
tileReconciliationTimeout?: number;
|
|
8
|
+
tileRemoveTimeout?: number;
|
|
9
|
+
/**
|
|
10
|
+
* @param itemId - result of getUniqueId
|
|
11
|
+
*/
|
|
12
|
+
onMouseEnterItem?: (itemId: unknown, coordinates: LngLat) => void;
|
|
13
|
+
onMouseLeaveItem?: (itemId: unknown, coordinates: LngLat) => void;
|
|
14
|
+
onClickItem?: (itemId: unknown, coordinates: LngLat) => void;
|
|
15
|
+
dataProvider?: {
|
|
16
|
+
off?(event: "update", clb: Function): void;
|
|
17
|
+
on?(event: "update", clb: Function): void;
|
|
18
|
+
fetchTile(tx: number, ty: number, tz: number, signal: AbortSignal): Promise<{
|
|
19
|
+
data: ItemType[];
|
|
20
|
+
total?: number;
|
|
21
|
+
version?: number | string;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Unique data for identify item. it can be id, or object
|
|
26
|
+
* @param item
|
|
27
|
+
*/
|
|
28
|
+
getUniqueId(item: ItemType): string | number | object;
|
|
29
|
+
}
|
|
30
|
+
export interface AnalyticsImplProxy<OutputData, Props> {
|
|
31
|
+
props: () => Props;
|
|
32
|
+
projection: () => Projection;
|
|
33
|
+
requestRender: () => void;
|
|
34
|
+
getIdByScreen?: (coordinates: {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
}) => unknown | undefined;
|
|
38
|
+
getUniqueId: (item: OutputData) => string | number | object;
|
|
39
|
+
getTiles: () => GlTile[];
|
|
40
|
+
convertData: (tileCoordinates: TileCoordinates, zoom: number, data: unknown, signal: AbortSignal) => Promise<unknown>;
|
|
41
|
+
implReady: {
|
|
42
|
+
promise: Promise<void>;
|
|
43
|
+
resolve: () => void;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
declare const defaultLayerProps: {
|
|
47
|
+
tileSize: number;
|
|
48
|
+
hitTestTimeout: number;
|
|
49
|
+
tileReconciliationTimeout: number;
|
|
50
|
+
tileRemoveTimeout: number;
|
|
51
|
+
};
|
|
52
|
+
export type DefaultProps = typeof defaultLayerProps;
|
|
53
|
+
export declare abstract class MMapDataAnalyticsLayer<ItemType, Props, Default extends DefaultProps> extends mappable.MMapComplexEntity<MMapDataAnalyticsLayerProps<ItemType> & Props, Default> {
|
|
54
|
+
PROPS: MMapDataAnalyticsLayerProps<ItemType> & Props;
|
|
55
|
+
static defaultProps: {
|
|
56
|
+
tileSize: number;
|
|
57
|
+
hitTestTimeout: number;
|
|
58
|
+
tileReconciliationTimeout: number;
|
|
59
|
+
tileRemoveTimeout: number;
|
|
60
|
+
};
|
|
61
|
+
private __virtualTileDataSource;
|
|
62
|
+
private readonly __virtualTileLayer;
|
|
63
|
+
private readonly __vectorLayer;
|
|
64
|
+
private readonly __listener;
|
|
65
|
+
private __dataCache;
|
|
66
|
+
private __tileCache;
|
|
67
|
+
private __tiles;
|
|
68
|
+
PROXY: AnalyticsImplProxy<ItemType, MMapDataAnalyticsLayerProps<ItemType> & Props>;
|
|
69
|
+
protected __proxy: this["PROXY"];
|
|
70
|
+
private __mapInAction;
|
|
71
|
+
constructor(props: MMapDataAnalyticsLayerProps<ItemType> & Props);
|
|
72
|
+
protected abstract _getImplementation(): VectorLayerImplementationConstructor;
|
|
73
|
+
protected _onAttach(): void;
|
|
74
|
+
protected _onUpdate(props: Partial<this["PROPS"]>, oldProps: Partial<this["PROPS"]>): void;
|
|
75
|
+
protected _onDetach(): void;
|
|
76
|
+
protected _stateVersion: number;
|
|
77
|
+
protected _requestTileRecalculation(): void;
|
|
78
|
+
private _requestTileRecalculationImd;
|
|
79
|
+
private __previousSelected;
|
|
80
|
+
protected _onMouseMoveHitTest: DomEventHandler;
|
|
81
|
+
private __removedTiles;
|
|
82
|
+
private __requestRemoveTiles;
|
|
83
|
+
private __requestRemoveTilesImd;
|
|
84
|
+
/**
|
|
85
|
+
* TODO The concept of virtual layers is now used. It's redundant, MAPSAPI-17151
|
|
86
|
+
* @private
|
|
87
|
+
*/
|
|
88
|
+
private _getRasterOptions;
|
|
89
|
+
}
|
|
90
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { TileCoordinates, VectorLayerImplementation, VectorLayerImplementationRenderProps, WorldCoordinates } from "../../../../common/types";
|
|
2
|
+
import type { DefaultProps, MMapDataAnalyticsLayer } from "../MMapDataAnalyticsLayer/MMapDataAnalyticsLayer";
|
|
3
|
+
import { MemoryManager } from "./utils/memoryManager";
|
|
4
|
+
import { Atlas } from "./utils/atlas";
|
|
5
|
+
import { FrameBuffer } from "./utils/frameBuffer";
|
|
6
|
+
export interface Program {
|
|
7
|
+
program: WebGLProgram;
|
|
8
|
+
uniforms: Record<string, WebGLUniformLocation>;
|
|
9
|
+
locations: Record<string, number>;
|
|
10
|
+
shaders: {
|
|
11
|
+
vertex: WebGLShader;
|
|
12
|
+
fragment: WebGLShader;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
type RenderWorldsProps = VectorLayerImplementationRenderProps;
|
|
16
|
+
export type RenderWorldProps = Omit<RenderWorldsProps, "worlds"> & {
|
|
17
|
+
world: RenderWorldsProps["worlds"][0];
|
|
18
|
+
};
|
|
19
|
+
export interface AnalyticsRenderUnit {
|
|
20
|
+
program: Program;
|
|
21
|
+
setup?: (this: MMapDefaultVectorLayerImplementation, props: RenderWorldProps) => void;
|
|
22
|
+
beforeRender?: (this: MMapDefaultVectorLayerImplementation, props: RenderWorldProps) => void;
|
|
23
|
+
render: (this: MMapDefaultVectorLayerImplementation, props: RenderWorldProps) => void;
|
|
24
|
+
afterRender?: (this: MMapDefaultVectorLayerImplementation, props: RenderWorldProps) => void;
|
|
25
|
+
textures?: Record<string, WebGLTexture>;
|
|
26
|
+
}
|
|
27
|
+
export interface BufferStore {
|
|
28
|
+
bufferType: number;
|
|
29
|
+
bufferLength: number;
|
|
30
|
+
buffer: WebGLBuffer;
|
|
31
|
+
drawType: number;
|
|
32
|
+
valueType: number;
|
|
33
|
+
size: number;
|
|
34
|
+
attribute: number;
|
|
35
|
+
data: Float32Array | Uint32Array | null;
|
|
36
|
+
}
|
|
37
|
+
export interface GlTile {
|
|
38
|
+
readonly coordinates: TileCoordinates;
|
|
39
|
+
readonly tileBound: [
|
|
40
|
+
WorldCoordinates,
|
|
41
|
+
WorldCoordinates
|
|
42
|
+
];
|
|
43
|
+
readonly zoom: number;
|
|
44
|
+
setup?(): void;
|
|
45
|
+
render(): void;
|
|
46
|
+
destroy(): void;
|
|
47
|
+
getObjectByIndex(id: number): unknown;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Size of hit test texture
|
|
51
|
+
*/
|
|
52
|
+
export declare const HIT_SIZE = 256;
|
|
53
|
+
export declare abstract class MMapDefaultVectorLayerImplementation implements VectorLayerImplementation {
|
|
54
|
+
readonly _proxy: MMapDataAnalyticsLayer<unknown, unknown, DefaultProps>["PROXY"];
|
|
55
|
+
readonly gl: WebGLRenderingContext;
|
|
56
|
+
readonly options: {
|
|
57
|
+
requestRender: () => void;
|
|
58
|
+
};
|
|
59
|
+
protected readonly _atlas: Atlas;
|
|
60
|
+
protected readonly _memoryManager: MemoryManager;
|
|
61
|
+
protected _frameBuffers: Record<"main" | "hit" | string, FrameBuffer>;
|
|
62
|
+
protected _renderUnits: Record<"main" | string, AnalyticsRenderUnit>;
|
|
63
|
+
protected _extVertexArrayObject: OES_vertex_array_object;
|
|
64
|
+
protected _angleExt: ANGLE_instanced_arrays;
|
|
65
|
+
protected _indexUnitExt: OES_element_index_uint;
|
|
66
|
+
protected _isReadyForRender: boolean;
|
|
67
|
+
protected abstract _createRenderUnits(): Record<"main" | string, AnalyticsRenderUnit>;
|
|
68
|
+
protected abstract _renderWorld(props: RenderWorldProps): void;
|
|
69
|
+
constructor(_proxy: MMapDataAnalyticsLayer<unknown, unknown, DefaultProps>["PROXY"], gl: WebGLRenderingContext, options: {
|
|
70
|
+
requestRender: () => void;
|
|
71
|
+
});
|
|
72
|
+
private __selectedId;
|
|
73
|
+
protected set _selectedId(value: number);
|
|
74
|
+
protected get _selectedId(): number;
|
|
75
|
+
/**
|
|
76
|
+
* Read pixel from hit test frame buffer and find object by id
|
|
77
|
+
*/
|
|
78
|
+
private __getIdByScreen;
|
|
79
|
+
destroy(): void;
|
|
80
|
+
protected _createBuffer(location: number, data: number[] | Float32Array | Uint32Array, size?: number): BufferStore;
|
|
81
|
+
protected _enableAttributeBuffer(attr: BufferStore): void;
|
|
82
|
+
private __bindBufferData;
|
|
83
|
+
private _renderRequested;
|
|
84
|
+
protected _requestLayerRender(): void;
|
|
85
|
+
render(props: RenderWorldsProps): {
|
|
86
|
+
color: WebGLTexture;
|
|
87
|
+
depth: WebGLTexture;
|
|
88
|
+
};
|
|
89
|
+
protected _renderUnit(unit: AnalyticsRenderUnit, props: RenderWorldProps): void;
|
|
90
|
+
private __renderWorlds;
|
|
91
|
+
protected _renderTiles(tiles: GlTile[], cb?: (tile: GlTile) => void): void;
|
|
92
|
+
protected __clearGlobalState(): void;
|
|
93
|
+
protected _convertData(tileCoordinates: TileCoordinates, zoom: number, data: unknown, _: AbortSignal): Promise<unknown>;
|
|
94
|
+
}
|
|
95
|
+
export * from "./utils/utils";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { PixelCoordinates } from "../../../../../common/types";
|
|
2
|
+
export interface IconResource {
|
|
3
|
+
url: string;
|
|
4
|
+
size: PixelCoordinates;
|
|
5
|
+
offset: PixelCoordinates;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Texture atlas for storing icons.
|
|
9
|
+
* ```js
|
|
10
|
+
* const atlas = new Atlas(gl, 1024, 64);
|
|
11
|
+
* const icon = atlas.loadAndGetOffset('icon.png');
|
|
12
|
+
* console.log(icon); // {url: 'icon.png', size: {x: 0.5, y: 0.5}, offset: {x: 0, y: 0}}
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class Atlas {
|
|
16
|
+
private readonly gl;
|
|
17
|
+
private readonly size;
|
|
18
|
+
private readonly iconSize;
|
|
19
|
+
readonly texture: WebGLTexture;
|
|
20
|
+
private readonly __cells;
|
|
21
|
+
constructor(gl: WebGLRenderingContext, size: number, iconSize: number);
|
|
22
|
+
private __isDestroyed;
|
|
23
|
+
destroy(): void;
|
|
24
|
+
private __cache;
|
|
25
|
+
loadAndGetOffset(urlOrImage: string): IconResource;
|
|
26
|
+
private __putImage;
|
|
27
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates normals for vertices. Used for calculating normals for every triangle.
|
|
3
|
+
* Normals are used for lighting.
|
|
4
|
+
*/
|
|
5
|
+
export declare function calculateNormalsForVertices(vertices: Float32Array, size: number, normals: Float32Array, featureVertexOffset: number, vertexCount: number): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encapsulate work with WebGL frame buffer object
|
|
3
|
+
*/
|
|
4
|
+
export declare class FrameBuffer {
|
|
5
|
+
private gl;
|
|
6
|
+
private options;
|
|
7
|
+
readonly color: WebGLTexture;
|
|
8
|
+
readonly depth: WebGLTexture;
|
|
9
|
+
private readonly __buffer;
|
|
10
|
+
private readonly __size;
|
|
11
|
+
constructor(gl: WebGLRenderingContext, options?: {
|
|
12
|
+
w?: number;
|
|
13
|
+
h?: number;
|
|
14
|
+
depth?: boolean;
|
|
15
|
+
});
|
|
16
|
+
destroy(): void;
|
|
17
|
+
clear(): this;
|
|
18
|
+
private static __current;
|
|
19
|
+
static bind(frameBuffer: FrameBuffer): void;
|
|
20
|
+
static unbind(frameBuffer: FrameBuffer): void;
|
|
21
|
+
static unbindCurrent(gl: WebGLRenderingContext): void;
|
|
22
|
+
private __needReadPixel;
|
|
23
|
+
private __pixelStore;
|
|
24
|
+
/**
|
|
25
|
+
* FIXME Optimize read pixel MAPSAPI-17272
|
|
26
|
+
*/
|
|
27
|
+
readPixel(rx: number, ry: number): Uint8Array;
|
|
28
|
+
resize(w: number, h?: number): this;
|
|
29
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
type ArrayType = {
|
|
2
|
+
length: number;
|
|
3
|
+
type: typeof Float32Array | typeof Uint32Array;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Memory manager for managing memory allocation for typed arrays.
|
|
7
|
+
* ```js
|
|
8
|
+
* const memoryManager = new MemoryManager(1024, 10); // 1024 bytes per buffer, 10 buffers max
|
|
9
|
+
* const [array] = await memoryManager.allocates([{length: 2, type: Float32Array}]); // 2 elements, 4 bytes each
|
|
10
|
+
* array[0] = 1;
|
|
11
|
+
* const newArray = memoryManager.resize(array, 1);
|
|
12
|
+
* memoryManager.free(newArray);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class MemoryManager {
|
|
16
|
+
private readonly allocateBufferSize;
|
|
17
|
+
private readonly maxBuffersCount;
|
|
18
|
+
private __buffers;
|
|
19
|
+
private __allocatedArrays;
|
|
20
|
+
private __waitFreeMemory;
|
|
21
|
+
constructor(allocateBufferSize: number, maxBuffersCount: number);
|
|
22
|
+
destroy(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Asynchronously allocates memory for an arrays of the specified length and type.
|
|
25
|
+
* Allocate memory only if there is enough free memory for all requested arrays.
|
|
26
|
+
*/
|
|
27
|
+
allocateArrays<T extends ArrayType[]>(requestedArrays: [
|
|
28
|
+
...T
|
|
29
|
+
], signal?: AbortSignal): Promise<{
|
|
30
|
+
[K in keyof T]: InstanceType<T[K]["type"]>;
|
|
31
|
+
}>;
|
|
32
|
+
private __canAllocate;
|
|
33
|
+
/**
|
|
34
|
+
* Synchronously allocates memory for an array of the specified length and type.
|
|
35
|
+
*/
|
|
36
|
+
private __allocate;
|
|
37
|
+
/**
|
|
38
|
+
* Synchronously resizes the memory allocated for the array. Allow only shrinking the array.
|
|
39
|
+
*/
|
|
40
|
+
resize<T extends Float32Array | Uint32Array>(array: T, newSize: number): T;
|
|
41
|
+
/**
|
|
42
|
+
* Synchronously frees the memory allocated for the array.
|
|
43
|
+
*/
|
|
44
|
+
free(array: Float32Array | Uint32Array): void;
|
|
45
|
+
private __createNewBigBuffer;
|
|
46
|
+
private __makeTypedArray;
|
|
47
|
+
private __findHole;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Program } from "../MMapDefaultVectorLayerImplementation";
|
|
2
|
+
interface ProgramOptions {
|
|
3
|
+
vertexShader: string;
|
|
4
|
+
fragmentShader: string;
|
|
5
|
+
uniforms: string[];
|
|
6
|
+
attributes: string[];
|
|
7
|
+
setupBeforeRender?: (program: Program) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function createProgram(gl: WebGLRenderingContext, options: ProgramOptions): Program;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
interface AsyncRunnerOptions {
|
|
2
|
+
timeout: number;
|
|
3
|
+
minCountPerFrame: number;
|
|
4
|
+
}
|
|
5
|
+
interface AsyncRunnerEvent {
|
|
6
|
+
timeRemaining(): DOMHighResTimeStamp;
|
|
7
|
+
}
|
|
8
|
+
interface AsyncRunner<Opt extends Partial<AsyncRunnerOptions>> {
|
|
9
|
+
(callback: (e: AsyncRunnerEvent) => unknown, options?: Opt): void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The class is designed to schedule tasks for execution in the browser's event loop.
|
|
13
|
+
* When `asyncRunner` fires, it launches `__runner`, which executes tasks from the queue.
|
|
14
|
+
* Tasks can be added to the queue using the add method.
|
|
15
|
+
* Tasks will be completed until all tasks are completed or until the time allotted for the chunk is completed.
|
|
16
|
+
* There is also a limit on the number of tasks that can be completed at one time.
|
|
17
|
+
*/
|
|
18
|
+
declare class ScheduleTaskManager {
|
|
19
|
+
private readonly asyncRunner;
|
|
20
|
+
private readonly __options;
|
|
21
|
+
private readonly __taskIterator;
|
|
22
|
+
private readonly __tasks;
|
|
23
|
+
private __runnerRequested;
|
|
24
|
+
constructor(asyncRunner?: AsyncRunner<AsyncScheduleOptions>, options?: Partial<AsyncScheduleOptions>);
|
|
25
|
+
/**
|
|
26
|
+
* Add a task to the queue.
|
|
27
|
+
* ```javascript
|
|
28
|
+
* const manager = new ScheduleTaskManager();
|
|
29
|
+
* const result = await manager.add([1, 2, 3], (item) => item * 2, new AbortController().signal);
|
|
30
|
+
* console.log(result); // [2, 4, 6]
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
add<I, O>(part: I[], processor: (item: I, index: number) => O, signal?: AbortSignal): Promise<O[]>;
|
|
34
|
+
private __runner;
|
|
35
|
+
private __getNewTask;
|
|
36
|
+
private __hasNewTask;
|
|
37
|
+
private __requestRunner;
|
|
38
|
+
}
|
|
39
|
+
interface AsyncScheduleOptions extends AsyncRunnerOptions {
|
|
40
|
+
remainingTime: number;
|
|
41
|
+
asyncStarter: (cb: Function) => unknown;
|
|
42
|
+
}
|
|
43
|
+
export declare const scheduleManager: ScheduleTaskManager;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* We use only rgb since alpha does not fit into highp float
|
|
3
|
+
*/
|
|
4
|
+
export declare function getColorId(colorComponents: [
|
|
5
|
+
number,
|
|
6
|
+
number,
|
|
7
|
+
number,
|
|
8
|
+
number
|
|
9
|
+
] | Uint8Array): number;
|
|
10
|
+
export declare function isPowerOf2(value: number): boolean;
|
|
11
|
+
export declare function checkRequiredExtensions(supportedExtensions: string[]): void;
|
|
12
|
+
/**
|
|
13
|
+
* Generates a new ID for baking to color in a hit test
|
|
14
|
+
*/
|
|
15
|
+
export declare function getIncrementalId(): number;
|
|
16
|
+
/**
|
|
17
|
+
* Parse color from string to [r, g, b, a]
|
|
18
|
+
* Allow formats #RRGGBB, #RRGGBBAA, rgb(r, g, b), rgba(r, g, b, a)
|
|
19
|
+
* @returns [r, g, b, a] - a is in range [0, 1], r, g, b in range [0, 255]
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseColor(input: string | [
|
|
22
|
+
number,
|
|
23
|
+
number,
|
|
24
|
+
number
|
|
25
|
+
] | [
|
|
26
|
+
number,
|
|
27
|
+
number,
|
|
28
|
+
number,
|
|
29
|
+
number
|
|
30
|
+
]): [
|
|
31
|
+
number,
|
|
32
|
+
number,
|
|
33
|
+
number,
|
|
34
|
+
number
|
|
35
|
+
];
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { LngLat, VectorLayerImplementationConstructor } from "../../../..";
|
|
2
|
+
import { type DefaultProps, MMapDataAnalyticsLayer } from "../MMapDataAnalyticsLayer/MMapDataAnalyticsLayer";
|
|
3
|
+
import type { GeoJSONFeature, GeoJsonLineStringFeature, GeoJsonPointFeature, GeoJsonPolygonFeature, LineStringDrawingStyle, PointDrawingStyle, PolygonDrawingStyle } from "../interface";
|
|
4
|
+
interface MMapGeoJsonLayerProps {
|
|
5
|
+
opacity?: number;
|
|
6
|
+
extruded?: boolean;
|
|
7
|
+
extrudeMultiplier?: number;
|
|
8
|
+
wireframe?: boolean | {
|
|
9
|
+
/**
|
|
10
|
+
* Width of the wireframe. In pixels.
|
|
11
|
+
*/
|
|
12
|
+
width: number;
|
|
13
|
+
/**
|
|
14
|
+
* Color of the wireframe
|
|
15
|
+
* @default #808080
|
|
16
|
+
*/
|
|
17
|
+
color: string;
|
|
18
|
+
};
|
|
19
|
+
lightPosition?: LngLat;
|
|
20
|
+
getDrawingStyle(f: GeoJsonPolygonFeature): PolygonDrawingStyle;
|
|
21
|
+
getDrawingStyle(f: GeoJsonLineStringFeature): LineStringDrawingStyle;
|
|
22
|
+
getDrawingStyle(f: GeoJsonPointFeature): PointDrawingStyle;
|
|
23
|
+
getDrawingStyle(f: GeoJSONFeature): PolygonDrawingStyle | LineStringDrawingStyle | PointDrawingStyle;
|
|
24
|
+
}
|
|
25
|
+
declare const defaultProps: {
|
|
26
|
+
opacity: number;
|
|
27
|
+
extruded: boolean;
|
|
28
|
+
extrudeMultiplier: number;
|
|
29
|
+
wireframe: boolean;
|
|
30
|
+
lightPosition: number[];
|
|
31
|
+
getDrawingStyle: (_: GeoJSONFeature) => {
|
|
32
|
+
fill: string;
|
|
33
|
+
elevation: number;
|
|
34
|
+
dash: number;
|
|
35
|
+
zOffset: number;
|
|
36
|
+
opacity: number;
|
|
37
|
+
width: number;
|
|
38
|
+
iconSize: number;
|
|
39
|
+
simplificationRate: number;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
type DefaultPropsGeo = typeof defaultProps;
|
|
43
|
+
export declare class MMapGeoJsonLayer extends MMapDataAnalyticsLayer<GeoJSONFeature, MMapGeoJsonLayerProps, DefaultPropsGeo & DefaultProps> {
|
|
44
|
+
static defaultPropsJson: {
|
|
45
|
+
opacity: number;
|
|
46
|
+
extruded: boolean;
|
|
47
|
+
extrudeMultiplier: number;
|
|
48
|
+
wireframe: boolean;
|
|
49
|
+
lightPosition: number[];
|
|
50
|
+
getDrawingStyle: (_: GeoJSONFeature) => {
|
|
51
|
+
fill: string;
|
|
52
|
+
elevation: number;
|
|
53
|
+
dash: number;
|
|
54
|
+
zOffset: number;
|
|
55
|
+
opacity: number;
|
|
56
|
+
width: number;
|
|
57
|
+
iconSize: number;
|
|
58
|
+
simplificationRate: number;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
protected _getImplementation(): VectorLayerImplementationConstructor;
|
|
62
|
+
protected _onUpdate(props: Partial<this["PROPS"]>, oldProps: Partial<this["PROPS"]>): void;
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type MMapDefaultVectorLayerImplementation, type AnalyticsRenderUnit } from "../../MMapDefaultVectorLayerImplementation/MMapDefaultVectorLayerImplementation";
|
|
2
|
+
import type { MMapGeoJsonLayer } from "../MMapGeoJsonLayer";
|
|
3
|
+
export declare function createGeoJsonRenderUnit(this: MMapDefaultVectorLayerImplementation, proxy: MMapGeoJsonLayer["PROXY"]): AnalyticsRenderUnit;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Value to compare floating point numbers with zero
|
|
3
|
+
*/
|
|
4
|
+
export declare const EPSILON = 1e-16;
|
|
5
|
+
/**
|
|
6
|
+
* Maximum number of features to process tile clip geometry
|
|
7
|
+
*/
|
|
8
|
+
export declare const CLIP_GEOMETRY_BY_COUNT = 1000;
|
|
9
|
+
/**
|
|
10
|
+
* Number of components per vertex (x,y,z)
|
|
11
|
+
*/
|
|
12
|
+
export declare const COMPONENT_PER_VERTEX = 3;
|
|
13
|
+
/**
|
|
14
|
+
* Number of vertices per edge. 2 triangles with 3 vertices each. 2 vertices are shared
|
|
15
|
+
* [p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y]
|
|
16
|
+
*/
|
|
17
|
+
export declare const VERTEX_PER_EDGE = 6;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { WorldCoordinates } from "../../../../../common/types";
|
|
2
|
+
import type { GeoJSONFeature } from "../../interface";
|
|
3
|
+
import type { MemoryManager } from "../../MMapDefaultVectorLayerImplementation/utils/memoryManager";
|
|
4
|
+
import type { Atlas } from "../../MMapDefaultVectorLayerImplementation/utils/atlas";
|
|
5
|
+
import { MMapGeoJsonLayer } from "../MMapGeoJsonLayer";
|
|
6
|
+
export interface ConversionResult {
|
|
7
|
+
vertices: Float32Array;
|
|
8
|
+
barycentric: Float32Array;
|
|
9
|
+
normals: Float32Array;
|
|
10
|
+
colors: Float32Array;
|
|
11
|
+
ids: Float32Array;
|
|
12
|
+
texCoord: Float32Array;
|
|
13
|
+
}
|
|
14
|
+
export declare function generateGeometryBuffers(features: GeoJSONFeature[], proxy: MMapGeoJsonLayer["PROXY"], memoryManager: MemoryManager, atlas: Atlas, signal: AbortSignal, tileBounds: [
|
|
15
|
+
WorldCoordinates,
|
|
16
|
+
WorldCoordinates
|
|
17
|
+
], mapId: Map<number, unknown>, mapIid: Map<unknown, number>, zoom: number): Promise<ConversionResult>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GenericLineStringGeometry, GenericProjection, LngLat, WorldCoordinates } from "../../../../../common/types";
|
|
2
|
+
import type { LineStringDrawingStyle } from "../../interface";
|
|
3
|
+
export declare function generateLineGeometry(geometry: GenericLineStringGeometry<LngLat>, projection: GenericProjection<LngLat>, style: Required<LineStringDrawingStyle>, needClipGeometry: boolean, tileBounds: [
|
|
4
|
+
WorldCoordinates,
|
|
5
|
+
WorldCoordinates
|
|
6
|
+
], extruded: undefined | boolean, vertexCount: number, elevation: number, featureVertexOffset: number, texCoord: Float32Array, vertices: Float32Array, minZ: number, worldSimplificationRate: number): number;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GenericPointGeometry, GenericProjection, LngLat } from "../../../../../common/types";
|
|
2
|
+
import type { PointDrawingStyle } from "../../interface";
|
|
3
|
+
import type { Atlas } from "../../MMapDefaultVectorLayerImplementation/utils/atlas";
|
|
4
|
+
export declare function generatePointGeometry(projection: GenericProjection<LngLat>, geometry: GenericPointGeometry<LngLat>, style: PointDrawingStyle, vertices: Float32Array, featureVertexOffset: number, elevation: number, normals: Float32Array, atlas: Atlas, texCoord: Float32Array): number;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { GenericPolygonGeometry, GenericProjection, LngLat } from "../../../../../common/types";
|
|
2
|
+
export declare function generatePolygonGeometry(geometry: GenericPolygonGeometry<LngLat>, projection: GenericProjection<LngLat>, vertexCount: number, extruded: undefined | boolean, featureVertexOffset: number, vertices: Float32Array, elevation: number, minZ: number, worldSimplificationRate: number): number;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { LngLat, Projection, Vec2, WorldCoordinates } from "../../../../../common/types";
|
|
2
|
+
import type { GeoJSONFeature } from "../../interface";
|
|
3
|
+
export type Rectangle = [
|
|
4
|
+
WorldCoordinates,
|
|
5
|
+
WorldCoordinates,
|
|
6
|
+
WorldCoordinates,
|
|
7
|
+
WorldCoordinates
|
|
8
|
+
];
|
|
9
|
+
/**
|
|
10
|
+
* Check if the given points form a ring
|
|
11
|
+
*/
|
|
12
|
+
export declare function isRing(points: WorldCoordinates[] | LngLat[]): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Fill vertices for rectangle in the buffer by CW order
|
|
15
|
+
*/
|
|
16
|
+
export declare function fillVerticesForRectangle(vertices: Float32Array, offset: number, rect: Rectangle): void;
|
|
17
|
+
/**
|
|
18
|
+
* Extrude the given ring to the given height
|
|
19
|
+
*/
|
|
20
|
+
export declare function extrudeSides(ring: WorldCoordinates[], vertices: Float32Array, offset: number, height: number, z: number): void;
|
|
21
|
+
interface OffsetDescription {
|
|
22
|
+
offset: Vec2;
|
|
23
|
+
size: Vec2;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Set texture coordinates for the rectangle
|
|
27
|
+
*/
|
|
28
|
+
export declare function setTextureCoords(texCoord: Float32Array, offset: number, description: OffsetDescription): void;
|
|
29
|
+
/**
|
|
30
|
+
* Calculate barycentric coordinates for triangles
|
|
31
|
+
*/
|
|
32
|
+
export declare function calculateBarycentric(barycentric: Float32Array, size: number, start: number, length: number): void;
|
|
33
|
+
/**
|
|
34
|
+
* Convert meters to world coordinates
|
|
35
|
+
*/
|
|
36
|
+
export declare function meterToWorld(feature: GeoJSONFeature, projection: Projection): number;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { VectorLayerImplementationConstructor } from "../../../../common/types";
|
|
2
|
+
import { type DefaultProps, MMapDataAnalyticsLayer } from "../MMapDataAnalyticsLayer/MMapDataAnalyticsLayer";
|
|
3
|
+
import type { GeoJSONFeature, Gradient } from "../interface";
|
|
4
|
+
interface MMapHeatmapLayerProps {
|
|
5
|
+
/** Function to get the weight of the feature. By default, the weight is 0.5. */
|
|
6
|
+
getWeight?: (f: GeoJSONFeature) => number;
|
|
7
|
+
/** Gradient for heat map display. By default, the standard gradient is used. */
|
|
8
|
+
gradient?: Gradient[];
|
|
9
|
+
zOffset?: number;
|
|
10
|
+
opacity?: number;
|
|
11
|
+
density?: number;
|
|
12
|
+
pointSize?: number;
|
|
13
|
+
blur?: number;
|
|
14
|
+
max?: number;
|
|
15
|
+
}
|
|
16
|
+
declare const defaultProps: {
|
|
17
|
+
getWeight: () => number;
|
|
18
|
+
density: number;
|
|
19
|
+
max: number;
|
|
20
|
+
pointSize: number;
|
|
21
|
+
blur: number;
|
|
22
|
+
zOffset: number;
|
|
23
|
+
opacity: number;
|
|
24
|
+
};
|
|
25
|
+
type DefaultPropsHeatmap = typeof defaultProps;
|
|
26
|
+
export declare class MMapHeatmapLayer extends MMapDataAnalyticsLayer<GeoJSONFeature, MMapHeatmapLayerProps, DefaultPropsHeatmap & DefaultProps> {
|
|
27
|
+
static defaultPropsJson: {
|
|
28
|
+
getWeight: () => number;
|
|
29
|
+
density: number;
|
|
30
|
+
max: number;
|
|
31
|
+
pointSize: number;
|
|
32
|
+
blur: number;
|
|
33
|
+
zOffset: number;
|
|
34
|
+
opacity: number;
|
|
35
|
+
};
|
|
36
|
+
protected _getImplementation(): VectorLayerImplementationConstructor;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { VectorLayerImplementationConstructor } from "../../../../common/types";
|
|
2
|
+
import type { MMapHeatmapLayer } from "../MMapHeatmapLayer/MMapHeatmapLayer";
|
|
3
|
+
export declare function getHeatmapImpl(proxy: MMapHeatmapLayer["PROXY"]): VectorLayerImplementationConstructor;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { MMapDefaultVectorLayerImplementation, AnalyticsRenderUnit } from "../../MMapDefaultVectorLayerImplementation/MMapDefaultVectorLayerImplementation";
|
|
2
|
+
import type { MMapHeatmapLayer } from "../MMapHeatmapLayer";
|
|
3
|
+
export declare function createGradientRenderUnit(this: MMapDefaultVectorLayerImplementation, proxy: MMapHeatmapLayer["PROXY"]): AnalyticsRenderUnit;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type MMapDefaultVectorLayerImplementation, type AnalyticsRenderUnit } from "../../MMapDefaultVectorLayerImplementation/MMapDefaultVectorLayerImplementation";
|
|
2
|
+
import type { MMapHeatmapLayer } from "../MMapHeatmapLayer";
|
|
3
|
+
export declare function createHeatmapRenderUnit(this: MMapDefaultVectorLayerImplementation, proxy: MMapHeatmapLayer["PROXY"]): AnalyticsRenderUnit;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { GenericFeature, GenericLineStringGeometry, GenericPointGeometry, GenericPolygonGeometry, LngLat } from "../../../common/types";
|
|
2
|
+
type Color = string;
|
|
3
|
+
interface GeoJsonLineStringFeature extends GenericFeature<LngLat> {
|
|
4
|
+
geometry: GenericLineStringGeometry<LngLat>;
|
|
5
|
+
}
|
|
6
|
+
interface GeoJsonPolygonFeature extends GenericFeature<LngLat> {
|
|
7
|
+
geometry: GenericPolygonGeometry<LngLat>;
|
|
8
|
+
}
|
|
9
|
+
interface GeoJsonPointFeature extends GenericFeature<LngLat> {
|
|
10
|
+
geometry: GenericPointGeometry<LngLat>;
|
|
11
|
+
}
|
|
12
|
+
interface PolygonDrawingStyle {
|
|
13
|
+
fill?: Color;
|
|
14
|
+
elevation?: number;
|
|
15
|
+
zOffset?: number;
|
|
16
|
+
simplificationRate?: number;
|
|
17
|
+
}
|
|
18
|
+
interface LineStringDrawingStyle {
|
|
19
|
+
fill?: Color;
|
|
20
|
+
width?: number;
|
|
21
|
+
elevation?: number;
|
|
22
|
+
dash?: number | [
|
|
23
|
+
number,
|
|
24
|
+
number
|
|
25
|
+
];
|
|
26
|
+
zOffset?: number;
|
|
27
|
+
simplificationRate?: number;
|
|
28
|
+
}
|
|
29
|
+
interface PointDrawingStyle {
|
|
30
|
+
icon?: string;
|
|
31
|
+
iconSize?: number;
|
|
32
|
+
elevation?: number;
|
|
33
|
+
zOffset?: number;
|
|
34
|
+
fill?: string;
|
|
35
|
+
}
|
|
36
|
+
type GeoJSONFeature = GeoJsonLineStringFeature | GeoJsonPolygonFeature | GeoJsonPointFeature;
|
|
37
|
+
type FeatureDrawingStyle = PolygonDrawingStyle | LineStringDrawingStyle | PointDrawingStyle;
|
|
38
|
+
interface Gradient {
|
|
39
|
+
color: Color;
|
|
40
|
+
offset: number;
|
|
41
|
+
}
|
|
42
|
+
export type { GeoJSONFeature, GeoJsonLineStringFeature, GeoJsonPolygonFeature, GeoJsonPointFeature, FeatureDrawingStyle, PolygonDrawingStyle, LineStringDrawingStyle, PointDrawingStyle, Gradient };
|