mapbox-gl-shadow-simulator 0.62.1 → 0.63.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.
- package/dist/leaflet-shademap/leaflet-shademap/dist/ShadeMap.d.ts +129 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/ShadeMapLeaflet.d.ts +16 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/ShadeMapMapbox.d.ts +31 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/buildings/BuildingRasterizer.d.ts +44 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/buildings/fetch-buildings.d.ts +12 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/buildings/normalize-buildings.d.ts +8 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/components/CanvasOverlay.d.ts +11 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/index.d.ts +7 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/lib/EventEmitter.d.ts +10 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/lib/TileMerger.d.ts +48 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/lib/heightMap.d.ts +35 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/lib/helpers.d.ts +33 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/lib/image.d.ts +13 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/lib/projection.d.ts +3 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/lib/shadowMap.d.ts +17 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/lib/webgl.d.ts +13 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/map/geometryLeaflet.d.ts +11 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/map/umap.d.ts +26 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/shader/gpu.d.ts +37 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/shader/kernel.d.ts +74 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/types/color.d.ts +5 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/types/constants.d.ts +3 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/types/quality.d.ts +5 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/types/shadeMapOptions.d.ts +47 -0
- package/dist/leaflet-shademap/leaflet-shademap/dist/types/shadow3DData.d.ts +21 -0
- package/dist/mapbox-gl-shadow-simulator.d.ts +4 -2
- package/dist/mapbox-gl-shadow-simulator.esm.js +2 -2
- package/dist/mapbox-gl-shadow-simulator.umd.min.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { LatLngLiteral, Map as LeafletMap } from "leaflet";
|
|
2
|
+
import { Map, MapboxGeoJSONFeature } from "mapbox-gl";
|
|
3
|
+
import { BuildingRasterizer } from "./buildings/BuildingRasterizer";
|
|
4
|
+
import { EventEmitter } from "./lib/EventEmitter";
|
|
5
|
+
import { HeightMap } from "./lib/heightMap";
|
|
6
|
+
import { TileMerger } from "./lib/TileMerger";
|
|
7
|
+
import { LatLngBounds } from "./map/geometryLeaflet";
|
|
8
|
+
import { UMap } from "./map/umap";
|
|
9
|
+
import { CompiledKernel } from "./shader/kernel";
|
|
10
|
+
import { Color } from "./types/color";
|
|
11
|
+
import { DSMSource, SunExposureOptions, TerrainSource } from "./types/shadeMapOptions";
|
|
12
|
+
export declare class ShadeMap extends EventEmitter {
|
|
13
|
+
_canvas: HTMLCanvasElement;
|
|
14
|
+
_gl?: WebGLRenderingContext;
|
|
15
|
+
_map?: Map | LeafletMap;
|
|
16
|
+
_compiledKernel?: CompiledKernel;
|
|
17
|
+
_color: Color;
|
|
18
|
+
_bounds?: LatLngBounds;
|
|
19
|
+
_buildingRasterizer?: BuildingRasterizer;
|
|
20
|
+
_tileMerger?: TileMerger;
|
|
21
|
+
_canopyMerger?: TileMerger;
|
|
22
|
+
_heightMap?: HeightMap;
|
|
23
|
+
options: {
|
|
24
|
+
date: Date;
|
|
25
|
+
color: string;
|
|
26
|
+
opacity: number;
|
|
27
|
+
sunExposure: {
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
startDate: Date;
|
|
30
|
+
endDate: Date;
|
|
31
|
+
iterations: number;
|
|
32
|
+
};
|
|
33
|
+
apiKey: string;
|
|
34
|
+
terrainSource: {
|
|
35
|
+
maxZoom: number;
|
|
36
|
+
tileSize: number;
|
|
37
|
+
_overzoom: number;
|
|
38
|
+
getSourceUrl: (params: {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
z: number;
|
|
42
|
+
}) => string;
|
|
43
|
+
getElevation: (params: {
|
|
44
|
+
r: number;
|
|
45
|
+
g: number;
|
|
46
|
+
b: number;
|
|
47
|
+
a: number;
|
|
48
|
+
}) => number;
|
|
49
|
+
};
|
|
50
|
+
canopySource: undefined;
|
|
51
|
+
dsmSource: {
|
|
52
|
+
bounds: {
|
|
53
|
+
lat: number;
|
|
54
|
+
lng: number;
|
|
55
|
+
}[];
|
|
56
|
+
data: Uint8ClampedArray;
|
|
57
|
+
width: number;
|
|
58
|
+
height: number;
|
|
59
|
+
maxHeight: number;
|
|
60
|
+
};
|
|
61
|
+
belowCanopy: boolean;
|
|
62
|
+
getFeatures: () => Promise<MapboxGeoJSONFeature[]>;
|
|
63
|
+
getSize: () => {
|
|
64
|
+
width: number;
|
|
65
|
+
height: number;
|
|
66
|
+
};
|
|
67
|
+
debug: (msg: string) => void;
|
|
68
|
+
};
|
|
69
|
+
constructor(...args: any[]);
|
|
70
|
+
onRemove(): this;
|
|
71
|
+
setDate(date: Date): this;
|
|
72
|
+
_setDateForTimezone(date: Date, tzId?: string): void;
|
|
73
|
+
setColor(color: string): this;
|
|
74
|
+
setOpacity(opacity: number): this;
|
|
75
|
+
setBelowCanopy(belowCanopy: boolean): this;
|
|
76
|
+
setTerrainSource(terrainSource: TerrainSource): this;
|
|
77
|
+
setCanopySource(canopySource: TerrainSource): this;
|
|
78
|
+
setDSMSource(dsmSource: DSMSource): this;
|
|
79
|
+
setSunExposure(enabled?: boolean, options?: SunExposureOptions): Promise<this>;
|
|
80
|
+
_lngLatToTextureCoords(lngLat: LatLngLiteral[]): number[][];
|
|
81
|
+
_getBounds(map: UMap, demZoom: number): LatLngBounds;
|
|
82
|
+
_getDEMZoom(map: UMap): number;
|
|
83
|
+
_reset(): Promise<this>;
|
|
84
|
+
_draw(heightMap: HeightMap): Promise<this>;
|
|
85
|
+
readPixel(x: number, y: number): Uint8Array;
|
|
86
|
+
readPixels(x: number, y: number, width: number, height: number): Uint8Array;
|
|
87
|
+
isPositionInSun(x: number, y: number): Promise<boolean>;
|
|
88
|
+
isPositionInShade(x: number, y: number): Promise<boolean>;
|
|
89
|
+
toGeoTiff(): {
|
|
90
|
+
data: Uint8Array;
|
|
91
|
+
metadata: {
|
|
92
|
+
width: number;
|
|
93
|
+
height: number;
|
|
94
|
+
ModelTiepoint: any[];
|
|
95
|
+
ModelPixelScale: number[];
|
|
96
|
+
GeographicTypeGeoKey: number;
|
|
97
|
+
GeogCitationGeoKey: string;
|
|
98
|
+
};
|
|
99
|
+
} | null;
|
|
100
|
+
_generateShadeProfile(params: {
|
|
101
|
+
locations: LatLngLiteral[];
|
|
102
|
+
dates: Date[];
|
|
103
|
+
sunColor: number[];
|
|
104
|
+
shadeColor: number[];
|
|
105
|
+
}): Uint8Array;
|
|
106
|
+
_generateLocationShadeProfile(params: {
|
|
107
|
+
location: LatLngLiteral;
|
|
108
|
+
startDate: Date;
|
|
109
|
+
endDate: Date;
|
|
110
|
+
sunColor: number[];
|
|
111
|
+
shadeColor: number[];
|
|
112
|
+
tzId: string;
|
|
113
|
+
panelAltitude: number;
|
|
114
|
+
panelAzimuth: number;
|
|
115
|
+
}): {
|
|
116
|
+
data: Uint8Array;
|
|
117
|
+
width: number;
|
|
118
|
+
height: number;
|
|
119
|
+
};
|
|
120
|
+
getHoursOfSun(x: number, y: number): number;
|
|
121
|
+
_repositionCanvas(bounds: LatLngBounds): void;
|
|
122
|
+
_flush(): void;
|
|
123
|
+
flushSync(): void;
|
|
124
|
+
_parseColor(color: string): {
|
|
125
|
+
r: number;
|
|
126
|
+
g: number;
|
|
127
|
+
b: number;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Map } from "leaflet";
|
|
2
|
+
import { CanvasOverlay } from "./components/CanvasOverlay";
|
|
3
|
+
import { LatLngBounds } from "./map/geometryLeaflet";
|
|
4
|
+
import { ShadeMap } from "./ShadeMap";
|
|
5
|
+
import { ShadeMapOptions } from "./types/shadeMapOptions";
|
|
6
|
+
declare class ShadeMapLeaflet extends ShadeMap {
|
|
7
|
+
_canvasOverlay?: CanvasOverlay;
|
|
8
|
+
constructor(options: ShadeMapOptions);
|
|
9
|
+
addTo(map: Map): this;
|
|
10
|
+
onAdd(map: Map): this;
|
|
11
|
+
_repositionCanvas(bounds: LatLngBounds): void;
|
|
12
|
+
}
|
|
13
|
+
declare module "leaflet" {
|
|
14
|
+
function shadeMap(options: ShadeMapOptions): ShadeMapLeaflet;
|
|
15
|
+
}
|
|
16
|
+
export default ShadeMapLeaflet;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Map } from "mapbox-gl";
|
|
2
|
+
import { LatLngBounds } from "./map/geometryLeaflet";
|
|
3
|
+
import { ShadeMap } from "./ShadeMap";
|
|
4
|
+
import { ShadeMapOptions } from "./types/shadeMapOptions";
|
|
5
|
+
export default class extends ShadeMap {
|
|
6
|
+
id: string;
|
|
7
|
+
type: string;
|
|
8
|
+
canvasSourceId: string;
|
|
9
|
+
attributionSourceId: string;
|
|
10
|
+
canvasLayerId: string;
|
|
11
|
+
attributionLayerId: string;
|
|
12
|
+
_map?: Map;
|
|
13
|
+
_refreshing: number;
|
|
14
|
+
_raf: number;
|
|
15
|
+
_moveEndHandler: () => void;
|
|
16
|
+
_framebuffer?: WebGLFramebuffer;
|
|
17
|
+
constructor(options: ShadeMapOptions);
|
|
18
|
+
render(gl: WebGLRenderingContext, matrix: number[]): void;
|
|
19
|
+
addTo(map: Map): this;
|
|
20
|
+
onAdd(map: Map): this;
|
|
21
|
+
onRemove(): this;
|
|
22
|
+
_getHeightMapCoords(x: number, y: number): any;
|
|
23
|
+
getHoursOfSun(x: number, y: number): number;
|
|
24
|
+
remove(): void;
|
|
25
|
+
readPixel(x: number, y: number): Uint8Array;
|
|
26
|
+
readPixels(x: number, y: number, width: number, height: number): Uint8Array;
|
|
27
|
+
isPositionInSun(x: number, y: number): Promise<boolean>;
|
|
28
|
+
isPositionInShade(x: number, y: number): Promise<boolean>;
|
|
29
|
+
_flush(): void;
|
|
30
|
+
_repositionCanvas(bounds: LatLngBounds): this;
|
|
31
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { XYZ } from "../lib/helpers";
|
|
2
|
+
import { DSMSource } from "../types/shadeMapOptions";
|
|
3
|
+
interface BuildingRasterGLArgs {
|
|
4
|
+
upperLeftTile: XYZ;
|
|
5
|
+
features: {
|
|
6
|
+
aPosition: Float32Array;
|
|
7
|
+
cuts: Uint16Array | Uint8Array;
|
|
8
|
+
buildingHeight: number;
|
|
9
|
+
centroid: number[];
|
|
10
|
+
highlight: boolean;
|
|
11
|
+
}[];
|
|
12
|
+
mapZoom: number;
|
|
13
|
+
imageData: WebGLTexture;
|
|
14
|
+
canopyData: WebGLTexture;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
dsmSource: DSMSource;
|
|
18
|
+
dsmCoords: number[];
|
|
19
|
+
gl: WebGLRenderingContext;
|
|
20
|
+
}
|
|
21
|
+
export declare class BuildingRasterizer {
|
|
22
|
+
gl: WebGLRenderingContext;
|
|
23
|
+
program: WebGLProgram;
|
|
24
|
+
positionAttributeLocation: number;
|
|
25
|
+
dsmAttributeLocation: number;
|
|
26
|
+
useDSMUniformLocation: WebGLUniformLocation;
|
|
27
|
+
isNegative: WebGLUniformLocation;
|
|
28
|
+
xyzUniformLocation: WebGLUniformLocation;
|
|
29
|
+
dimensionsUniformLocation: WebGLUniformLocation;
|
|
30
|
+
heightMapUniformLocation: WebGLUniformLocation;
|
|
31
|
+
canopyMapUniformLocation: WebGLUniformLocation;
|
|
32
|
+
centroidUniformLocation: WebGLUniformLocation;
|
|
33
|
+
colorUniformLocation: WebGLUniformLocation;
|
|
34
|
+
positionBuffer: WebGLBuffer;
|
|
35
|
+
dsmBuffer: WebGLBuffer;
|
|
36
|
+
indexBuffer: WebGLBuffer;
|
|
37
|
+
targetTexture: WebGLTexture;
|
|
38
|
+
constructor(gl: WebGLRenderingContext);
|
|
39
|
+
raster(args: BuildingRasterGLArgs): {
|
|
40
|
+
maxHeight: number;
|
|
41
|
+
heightMapTex: WebGLTexture;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MapboxGeoJSONFeature } from "mapbox-gl";
|
|
2
|
+
interface FetchBuildingsArgs {
|
|
3
|
+
getFeatures: () => Promise<MapboxGeoJSONFeature[]>;
|
|
4
|
+
}
|
|
5
|
+
export declare const fetchBuildings: (args: FetchBuildingsArgs) => Promise<{
|
|
6
|
+
aPosition: Float32Array;
|
|
7
|
+
cuts: Uint8Array | Uint16Array;
|
|
8
|
+
buildingHeight: number;
|
|
9
|
+
centroid: number[];
|
|
10
|
+
highlight: any;
|
|
11
|
+
}[]>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ImageOverlay, ImageOverlayOptions, LatLngBounds, LatLngBoundsExpression } from "leaflet";
|
|
2
|
+
export declare class CanvasOverlay extends ImageOverlay {
|
|
3
|
+
_url: HTMLCanvasElement;
|
|
4
|
+
_image?: HTMLCanvasElement;
|
|
5
|
+
_zoomAnimated?: boolean;
|
|
6
|
+
_bounds?: LatLngBounds;
|
|
7
|
+
constructor(canvas: HTMLCanvasElement, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions);
|
|
8
|
+
_initImage(): this;
|
|
9
|
+
setBounds(bounds: LatLngBounds): this;
|
|
10
|
+
}
|
|
11
|
+
export declare function canvasOverlay(...args: ConstructorParameters<typeof CanvasOverlay>): CanvasOverlay;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "leaflet";
|
|
2
|
+
import ShadeMapLeaflet from "./ShadeMapLeaflet";
|
|
3
|
+
import { ShadeMapOptions } from "./types/shadeMapOptions";
|
|
4
|
+
declare module "leaflet" {
|
|
5
|
+
function shadeMap(options: ShadeMapOptions): ShadeMapLeaflet;
|
|
6
|
+
}
|
|
7
|
+
export { ShadeMapLeaflet as default, ShadeMapOptions };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type Listener = (...args: any[]) => void;
|
|
2
|
+
export declare class EventEmitter {
|
|
3
|
+
private readonly events;
|
|
4
|
+
on(event: string, listener: Listener): () => void;
|
|
5
|
+
removeListener(event: string, listener: Listener): void;
|
|
6
|
+
removeAllListeners(): void;
|
|
7
|
+
emit(event: string, ...args: any[]): void;
|
|
8
|
+
once(event: string, listener: Listener): () => void;
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { XYZRaster } from "./image";
|
|
2
|
+
/**
|
|
3
|
+
* Notes:
|
|
4
|
+
*
|
|
5
|
+
* The responsibility of this code is to download map tiles and stitch
|
|
6
|
+
* them together into a bitmap
|
|
7
|
+
*
|
|
8
|
+
* The code can be aborted if a new set of tiles is requested
|
|
9
|
+
* The code works with 256x256 and 512x512 tiles
|
|
10
|
+
* Zoom can exceed a tileset's maximum value by cropping and scaling to the appropriate size
|
|
11
|
+
* Some tiles are virtual, they do not correspond to a physical image but are a subset of a physical image
|
|
12
|
+
*/
|
|
13
|
+
interface MergeImageOptions {
|
|
14
|
+
getSourceUrl: (params: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
z: number;
|
|
18
|
+
}) => string;
|
|
19
|
+
getElevation: (params: {
|
|
20
|
+
r: number;
|
|
21
|
+
g: number;
|
|
22
|
+
b: number;
|
|
23
|
+
a: number;
|
|
24
|
+
}) => number;
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
crossOrigin?: string;
|
|
28
|
+
tileSize: number;
|
|
29
|
+
maxZoom: number;
|
|
30
|
+
tileLoaded: (loadedTiles: number, totalTiles: number) => void;
|
|
31
|
+
}
|
|
32
|
+
export declare class TileMerger {
|
|
33
|
+
gl: WebGLRenderingContext;
|
|
34
|
+
tileTexture: WebGLTexture;
|
|
35
|
+
outputTexture: WebGLTexture;
|
|
36
|
+
program: WebGLProgram;
|
|
37
|
+
texPositionAttributeLocation: number;
|
|
38
|
+
tilePositionAttributeLocation: number;
|
|
39
|
+
encodingUniformLocation: WebGLUniformLocation;
|
|
40
|
+
tileSizeUniformLocation: WebGLUniformLocation;
|
|
41
|
+
texPositionBuffer: WebGLBuffer;
|
|
42
|
+
tilePositionBuffer: WebGLBuffer;
|
|
43
|
+
inProgress: HTMLImageElement[];
|
|
44
|
+
finished: number;
|
|
45
|
+
constructor(gl: WebGLRenderingContext);
|
|
46
|
+
merge(tiles: XYZRaster[], options: MergeImageOptions): Promise<WebGLTexture | null>;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { MapboxGeoJSONFeature } from "mapbox-gl";
|
|
2
|
+
import { BuildingRasterizer } from "../buildings/BuildingRasterizer";
|
|
3
|
+
import { XYZRaster } from "../lib/image";
|
|
4
|
+
import { TileMerger } from "./TileMerger";
|
|
5
|
+
import { LatLngBounds, ValidBounds } from "../map/geometryLeaflet";
|
|
6
|
+
import { DSMSource, TerrainSource } from "../types/shadeMapOptions";
|
|
7
|
+
interface HeightMapParams {
|
|
8
|
+
terrainSource: TerrainSource;
|
|
9
|
+
canopySource?: TerrainSource;
|
|
10
|
+
dsmSource: DSMSource;
|
|
11
|
+
getFeatures: () => Promise<MapboxGeoJSONFeature[]>;
|
|
12
|
+
tileLoaded: (loadedTiles: number, totalTiles: number) => void;
|
|
13
|
+
gl: WebGLRenderingContext;
|
|
14
|
+
bounds: LatLngBounds;
|
|
15
|
+
buildingRasterizer: BuildingRasterizer;
|
|
16
|
+
tileMerger: TileMerger;
|
|
17
|
+
canopyMerger: TileMerger;
|
|
18
|
+
demZoom: number;
|
|
19
|
+
forceUpdate: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface HeightMap {
|
|
22
|
+
heightMapTex: WebGLTexture | null;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
maxHeight: number;
|
|
26
|
+
visibleDEMPixelBounds: ValidBounds;
|
|
27
|
+
DEMPixelBounds: ValidBounds;
|
|
28
|
+
raster: XYZRaster[];
|
|
29
|
+
demZoom: number;
|
|
30
|
+
dirty: boolean;
|
|
31
|
+
outputWidth: number;
|
|
32
|
+
outputHeight: number;
|
|
33
|
+
}
|
|
34
|
+
export declare const getHeightMap: (params: HeightMapParams) => Promise<HeightMap>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Point, ValidBounds } from "../map/geometryLeaflet";
|
|
2
|
+
export declare const pad: (x: number) => string | number;
|
|
3
|
+
export interface XYZ {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
z: number;
|
|
7
|
+
}
|
|
8
|
+
export interface XYZParams {
|
|
9
|
+
upperLeft: Point;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
zoom: number;
|
|
13
|
+
}
|
|
14
|
+
export declare const xyz: (params: XYZParams) => XYZ[];
|
|
15
|
+
export interface TileBoundsArgs {
|
|
16
|
+
upperLeft: Point;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
}
|
|
20
|
+
export declare const getTileBounds: (args: TileBoundsArgs) => ValidBounds;
|
|
21
|
+
export declare const getDeclination: (date: Date) => {
|
|
22
|
+
dec: number;
|
|
23
|
+
Hi: number;
|
|
24
|
+
};
|
|
25
|
+
export declare const getDeclinationMs: (ms: number) => {
|
|
26
|
+
dec: number;
|
|
27
|
+
Hi: number;
|
|
28
|
+
};
|
|
29
|
+
export declare const randomId: () => number;
|
|
30
|
+
export declare const timeInTheSunMs: (exposureLayerColor: Uint8Array, exposureLayerOpacity: number, totalTimeIntervalInMs: number) => number;
|
|
31
|
+
export declare const UTCOffsetByTimeZone: (date?: Date, timeZone?: string) => number;
|
|
32
|
+
export declare function mercatorXfromLng(lng: number): number;
|
|
33
|
+
export declare function mercatorYfromLat(lat: number): number;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { XYZ } from "../lib/helpers";
|
|
2
|
+
export interface XYZRaster {
|
|
3
|
+
xOffset: number;
|
|
4
|
+
yOffset: number;
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
z: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const createTileRaster: (xyzTiles: XYZ[]) => XYZRaster[];
|
|
10
|
+
export declare const getDimensions: (data: XYZRaster[]) => {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UMap } from "../map/umap";
|
|
2
|
+
import { CompiledKernel } from "../shader/kernel";
|
|
3
|
+
import { Color } from "../types/color";
|
|
4
|
+
import { HeightMap } from "./heightMap";
|
|
5
|
+
interface DrawShadowParams {
|
|
6
|
+
kernel: CompiledKernel;
|
|
7
|
+
map: UMap;
|
|
8
|
+
heightMap: HeightMap;
|
|
9
|
+
now: Date;
|
|
10
|
+
color: Color;
|
|
11
|
+
opacity: number;
|
|
12
|
+
maxZoom: number;
|
|
13
|
+
belowCanopy: boolean;
|
|
14
|
+
skipRender: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const drawShadow: (params: DrawShadowParams) => void;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface BindTextureOptions {
|
|
2
|
+
gl: WebGLRenderingContext;
|
|
3
|
+
texture: WebGLTexture;
|
|
4
|
+
imageData?: Uint8ClampedArray | Float32Array | null;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
filter?: number;
|
|
8
|
+
wrap?: number;
|
|
9
|
+
format?: number;
|
|
10
|
+
type?: number;
|
|
11
|
+
internalFormat?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const bindTexture: (options: BindTextureOptions) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LatLng } from "../../node_modules/leaflet/src/geo/LatLng";
|
|
2
|
+
import { LatLngBounds } from "../../node_modules/leaflet/src/geo/LatLngBounds";
|
|
3
|
+
import { Bounds } from "../../node_modules/leaflet/src/geometry/Bounds";
|
|
4
|
+
import { Point } from "../../node_modules/leaflet/src/geometry/Point";
|
|
5
|
+
export { Point, Bounds, LatLngBounds, LatLng };
|
|
6
|
+
export interface ValidBounds extends Bounds {
|
|
7
|
+
getTopLeft: () => Point;
|
|
8
|
+
getBottomRight: () => Point;
|
|
9
|
+
min: Point;
|
|
10
|
+
max: Point;
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LatLngLiteral, Layer, Map as LeafletMap, PointExpression } from "leaflet";
|
|
2
|
+
import { Map as MapboxGLMap } from "mapbox-gl";
|
|
3
|
+
import { LatLng, LatLngBounds, Point } from "../map/geometryLeaflet";
|
|
4
|
+
export interface UMap {
|
|
5
|
+
project: (center: LatLngLiteral, zoom: number) => Point;
|
|
6
|
+
unproject: (point: Point, zoom: number) => LatLng;
|
|
7
|
+
screenUnproject: (point: PointExpression) => LatLng;
|
|
8
|
+
getZoom: () => number;
|
|
9
|
+
getCenter: () => LatLng;
|
|
10
|
+
getBounds: () => LatLngBounds;
|
|
11
|
+
eachLayer(fn: (layer: Layer) => void): void;
|
|
12
|
+
getBearing: () => number;
|
|
13
|
+
getPitch: () => number;
|
|
14
|
+
rawMap: () => LeafletMap | MapboxGLMap;
|
|
15
|
+
isLeaflet: () => boolean;
|
|
16
|
+
getPixelDimensions: () => {
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
};
|
|
20
|
+
createBounds: (args: {
|
|
21
|
+
nw: LatLngLiteral;
|
|
22
|
+
se: LatLngLiteral;
|
|
23
|
+
}) => LatLngBounds;
|
|
24
|
+
}
|
|
25
|
+
declare const uMap: (map: MapboxGLMap | LeafletMap) => UMap;
|
|
26
|
+
export default uMap;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Color } from "../types/color";
|
|
2
|
+
import { Shadow3DData } from "../types/shadow3DData";
|
|
3
|
+
import { CompiledKernel } from "./kernel";
|
|
4
|
+
export declare const updateHeightMapGPU: (compiledKernel: CompiledKernel, shadow3DData: Shadow3DData) => void;
|
|
5
|
+
export declare const updateDateGPU: (compiledKernel: CompiledKernel, params: {
|
|
6
|
+
date: Date;
|
|
7
|
+
}) => void;
|
|
8
|
+
export declare const generateShadeProfile: (compiledKernel: CompiledKernel, params: {
|
|
9
|
+
texCoords: number[][];
|
|
10
|
+
dates: Date[];
|
|
11
|
+
sunColor: number[];
|
|
12
|
+
shadeColor: number[];
|
|
13
|
+
}) => Uint8Array;
|
|
14
|
+
export declare const generateLocationShadeProfile: (compiledKernel: CompiledKernel, params: {
|
|
15
|
+
startTime: number;
|
|
16
|
+
endTime: number;
|
|
17
|
+
tzId: string;
|
|
18
|
+
texCoord: number[];
|
|
19
|
+
sunColor: number[];
|
|
20
|
+
shadeColor: number[];
|
|
21
|
+
panelAltitude: number;
|
|
22
|
+
panelAzimuth: number;
|
|
23
|
+
}) => {
|
|
24
|
+
output: Uint8Array;
|
|
25
|
+
outputWidth: number;
|
|
26
|
+
outputHeight: number;
|
|
27
|
+
};
|
|
28
|
+
export declare const updateDateRangeGPU: (compiledKernel: CompiledKernel, params: {
|
|
29
|
+
startDate: Date;
|
|
30
|
+
endDate: Date;
|
|
31
|
+
iterations: number;
|
|
32
|
+
emit: (name: string, ...args: any[]) => void;
|
|
33
|
+
}) => Promise<boolean>;
|
|
34
|
+
export declare const updateColorGPU: (compiledKernel: CompiledKernel, params: {
|
|
35
|
+
color: Color;
|
|
36
|
+
opacity: number;
|
|
37
|
+
}) => void;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
interface CompileProgramArgs {
|
|
2
|
+
gl: WebGLRenderingContext;
|
|
3
|
+
vSrc: string;
|
|
4
|
+
fSrc: string;
|
|
5
|
+
}
|
|
6
|
+
interface UpdateHeightMapArgs {
|
|
7
|
+
heightMapTex: WebGLTexture | null;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
maxHeight: number;
|
|
11
|
+
heightMapZoom: number;
|
|
12
|
+
topYCoord: number;
|
|
13
|
+
ySize: number;
|
|
14
|
+
colorVec: number[];
|
|
15
|
+
step: number;
|
|
16
|
+
west: number;
|
|
17
|
+
dLng: number;
|
|
18
|
+
dec: number;
|
|
19
|
+
Hi: number;
|
|
20
|
+
cornerClipCoords: number[];
|
|
21
|
+
cornerTextureCoords: number[];
|
|
22
|
+
outputWidth: number;
|
|
23
|
+
outputHeight: number;
|
|
24
|
+
belowCanopy: boolean;
|
|
25
|
+
skipRender: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface UpdateDateArgs {
|
|
28
|
+
dec: number;
|
|
29
|
+
Hi: number;
|
|
30
|
+
}
|
|
31
|
+
interface UpdateDateRangeArgs {
|
|
32
|
+
startDate: Date;
|
|
33
|
+
endDate: Date;
|
|
34
|
+
iterations: number;
|
|
35
|
+
emit: (name: string, ...args: any[]) => void;
|
|
36
|
+
}
|
|
37
|
+
interface UpdateColorArgs {
|
|
38
|
+
colorVec: number[];
|
|
39
|
+
}
|
|
40
|
+
interface ShadeProfileArgs {
|
|
41
|
+
texCoords: number[][];
|
|
42
|
+
dates: Date[];
|
|
43
|
+
sunColor: number[];
|
|
44
|
+
shadeColor: number[];
|
|
45
|
+
}
|
|
46
|
+
interface LocationShadeProfileArgs {
|
|
47
|
+
startTime: number;
|
|
48
|
+
endTime: number;
|
|
49
|
+
tzId: string;
|
|
50
|
+
texCoord: number[];
|
|
51
|
+
sunColor: number[];
|
|
52
|
+
shadeColor: number[];
|
|
53
|
+
panelAltitude: number;
|
|
54
|
+
panelAzimuth: number;
|
|
55
|
+
}
|
|
56
|
+
export interface CompiledKernel {
|
|
57
|
+
updateHeightMap: (args: UpdateHeightMapArgs) => void;
|
|
58
|
+
updateDate: (args: UpdateDateArgs) => void;
|
|
59
|
+
updateDateRange: (args: UpdateDateRangeArgs) => Promise<boolean>;
|
|
60
|
+
updateColor: (args: UpdateColorArgs) => void;
|
|
61
|
+
generateShadeProfile: (args: ShadeProfileArgs) => Uint8Array;
|
|
62
|
+
generateLocationShadeProfile: (args: LocationShadeProfileArgs) => {
|
|
63
|
+
output: Uint8Array;
|
|
64
|
+
outputWidth: number;
|
|
65
|
+
outputHeight: number;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export declare function compileProgram(args: CompileProgramArgs): WebGLProgram;
|
|
69
|
+
interface Settings {
|
|
70
|
+
context: WebGLRenderingContext;
|
|
71
|
+
setRenderBuffer: (gl: WebGLRenderingContext, viewportWidth: number, viewportHeight: number) => void;
|
|
72
|
+
}
|
|
73
|
+
declare function kernel(settings: Settings): CompiledKernel;
|
|
74
|
+
export default kernel;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { MapboxGeoJSONFeature } from "mapbox-gl";
|
|
2
|
+
import { Quality } from "./quality";
|
|
3
|
+
import { LatLngLiteral } from "leaflet";
|
|
4
|
+
export interface TerrainSource {
|
|
5
|
+
maxZoom: number;
|
|
6
|
+
tileSize: number;
|
|
7
|
+
getSourceUrl: (params: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
z: number;
|
|
11
|
+
}) => string;
|
|
12
|
+
getElevation: (params: {
|
|
13
|
+
r: number;
|
|
14
|
+
g: number;
|
|
15
|
+
b: number;
|
|
16
|
+
a: number;
|
|
17
|
+
}) => number;
|
|
18
|
+
_overzoom: number;
|
|
19
|
+
}
|
|
20
|
+
export interface DSMSource {
|
|
21
|
+
data: Uint8ClampedArray;
|
|
22
|
+
bounds: LatLngLiteral[];
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
maxHeight: number;
|
|
26
|
+
}
|
|
27
|
+
export interface SunExposureOptions {
|
|
28
|
+
startDate: Date;
|
|
29
|
+
endDate: Date;
|
|
30
|
+
iterations?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface SunExposure extends SunExposureOptions {
|
|
33
|
+
enabled: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface ShadeMapOptions {
|
|
36
|
+
date?: Date;
|
|
37
|
+
color?: string;
|
|
38
|
+
opacity?: number;
|
|
39
|
+
quality?: Quality;
|
|
40
|
+
sunExposure?: SunExposure;
|
|
41
|
+
terrainSource?: TerrainSource;
|
|
42
|
+
canopySource?: TerrainSource;
|
|
43
|
+
dsmSource?: DSMSource;
|
|
44
|
+
getFeatures?: () => Promise<MapboxGeoJSONFeature[]>;
|
|
45
|
+
apiKey: string;
|
|
46
|
+
debug?: (msg: string) => void;
|
|
47
|
+
}
|