@mapcomponents/deck-gl 1.7.6 → 1.8.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/assets/3D/WhereGroupLogo.glb +0 -0
- package/dist/assets/tiles/points/r.pnts +0 -0
- package/dist/assets/tiles/points/r0.pnts +0 -0
- package/dist/assets/tiles/points/r00.pnts +0 -0
- package/dist/assets/tiles/points/r01.pnts +0 -0
- package/dist/assets/tiles/points/r02.pnts +0 -0
- package/dist/assets/tiles/points/r03.pnts +0 -0
- package/dist/assets/tiles/points/r04.pnts +0 -0
- package/dist/assets/tiles/points/r05.pnts +0 -0
- package/dist/assets/tiles/points/r06.pnts +0 -0
- package/dist/assets/tiles/points/r07.pnts +0 -0
- package/dist/assets/tiles/points/r2.pnts +0 -0
- package/dist/assets/tiles/points/r20.pnts +0 -0
- package/dist/assets/tiles/points/r21.pnts +0 -0
- package/dist/assets/tiles/points/r22.pnts +0 -0
- package/dist/assets/tiles/points/r23.pnts +0 -0
- package/dist/assets/tiles/points/r24.pnts +0 -0
- package/dist/assets/tiles/points/r25.pnts +0 -0
- package/dist/assets/tiles/points/r26.pnts +0 -0
- package/dist/assets/tiles/points/r27.pnts +0 -0
- package/dist/assets/tiles/points/r3.pnts +0 -0
- package/dist/assets/tiles/points/r4.pnts +0 -0
- package/dist/assets/tiles/points/r40.pnts +0 -0
- package/dist/assets/tiles/points/r41.pnts +0 -0
- package/dist/assets/tiles/points/r42.pnts +0 -0
- package/dist/assets/tiles/points/r43.pnts +0 -0
- package/dist/assets/tiles/points/r44.pnts +0 -0
- package/dist/assets/tiles/points/r45.pnts +0 -0
- package/dist/assets/tiles/points/r46.pnts +0 -0
- package/dist/assets/tiles/points/r47.pnts +0 -0
- package/dist/assets/tiles/points/r6.pnts +0 -0
- package/dist/assets/tiles/points/r60.pnts +0 -0
- package/dist/assets/tiles/points/r61.pnts +0 -0
- package/dist/assets/tiles/points/r63.pnts +0 -0
- package/dist/assets/tiles/points/r64.pnts +0 -0
- package/dist/assets/tiles/points/r65.pnts +0 -0
- package/dist/assets/tiles/preview.pnts +0 -0
- package/dist/assets/tiles/tileset.json +460 -0
- package/dist/assets/wg_locations.json +53 -0
- package/dist/components/Ml3DTileLayer/Ml3DTileLayer.d.ts +15 -0
- package/dist/components/Ml3DTileLayer/Ml3DTileLayer.d.ts.map +1 -0
- package/dist/components/MlHexagonLayer/MlHexagonLayer.d.ts +15 -0
- package/dist/components/MlHexagonLayer/MlHexagonLayer.d.ts.map +1 -0
- package/dist/components/MlSceneGraphLayer/MlScenegraphLayer.d.ts +15 -0
- package/dist/components/MlSceneGraphLayer/MlScenegraphLayer.d.ts.map +1 -0
- package/dist/contexts/DeckGlContext.d.ts +3 -1
- package/dist/contexts/DeckGlContext.d.ts.map +1 -1
- package/dist/decorators/MapContextDecorator.d.ts.map +1 -1
- package/dist/hooks/useDeckGl.d.ts +3 -2
- package/dist/hooks/useDeckGl.d.ts.map +1 -1
- package/dist/html2canvas.esm-CUkZERmf.js +22 -0
- package/dist/index-2pRp38DS.js +4712 -0
- package/dist/{index-FSZB5YUB.mjs → index-XOA5TV-e.mjs} +52670 -40284
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es-BNHgyHB_.js +18 -0
- package/dist/{index.es-BiYLqoqF.mjs → index.es-nMmjT7oh.mjs} +1 -1
- package/dist/index.js +1 -0
- package/dist/index.mjs +7 -5
- package/dist/package.json +8 -5
- package/dist/purify.es-D1I7B1hP.js +2 -0
- package/package.json +8 -5
- package/src/components/Ml3DTileLayer/Ml3DTileLayer.stories.tsx +43 -0
- package/src/components/Ml3DTileLayer/Ml3DTileLayer.tsx +57 -0
- package/src/components/{MlHexagonMap/MlHexagonMap.cy.tsx → MlHexagonLayer/MlHexagonLayer.cy.tsx} +4 -4
- package/src/components/MlHexagonLayer/MlHexagonLayer.stories.tsx +129 -0
- package/src/components/MlHexagonLayer/MlHexagonLayer.tsx +90 -0
- package/src/components/MlSceneGraphLayer/MlScenegraphLayer.stories.tsx +118 -0
- package/src/components/MlSceneGraphLayer/MlScenegraphLayer.tsx +47 -0
- package/src/contexts/DeckGlContext.tsx +9 -2
- package/src/decorators/MapContextDecorator.tsx +18 -13
- package/src/hooks/useDeckGl.tsx +11 -8
- package/src/index.ts +3 -1
- package/vite.config.ts +1 -1
- package/dist/components/MlHexagonMap/MlHexagonMap.d.ts +0 -14
- package/dist/components/MlHexagonMap/MlHexagonMap.d.ts.map +0 -1
- package/src/components/MlHexagonMap/MlHexagonMap.stories.tsx +0 -28
- package/src/components/MlHexagonMap/MlHexagonMap.tsx +0 -141
- /package/src/components/{MlHexagonMap/MlHexagonMap.meta_.json → MlHexagonLayer/MlHexagonLayer.meta_.json} +0 -0
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface MlHexagonMapProps {
|
|
2
|
-
/**
|
|
3
|
-
* Id of the target MapLibre instance in mapContext
|
|
4
|
-
*/
|
|
5
|
-
mapId?: string;
|
|
6
|
-
/**
|
|
7
|
-
* Id of an existing layer in the mapLibre instance to help specify the layer order
|
|
8
|
-
* This layer will be visually beneath the layer with the "insertBeforeLayer" id.
|
|
9
|
-
*/
|
|
10
|
-
insertBeforeLayer?: string;
|
|
11
|
-
}
|
|
12
|
-
declare const MlHexagonMap: (props: MlHexagonMapProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export default MlHexagonMap;
|
|
14
|
-
//# sourceMappingURL=MlHexagonMap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MlHexagonMap.d.ts","sourceRoot":"","sources":["../../../src/components/MlHexagonMap/MlHexagonMap.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,QAAA,MAAM,YAAY,GAAI,OAAO,iBAAiB,4CAyH7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import mapContextDecorator from '../../decorators/MapContextDecorator';
|
|
2
|
-
import MlHexagonMap from './MlHexagonMap';
|
|
3
|
-
import { DeckGlContextProvider } from '../../contexts/DeckGlContext';
|
|
4
|
-
|
|
5
|
-
const storyoptions = {
|
|
6
|
-
title: 'MapComponents/MlHexagonMap',
|
|
7
|
-
component: MlHexagonMap,
|
|
8
|
-
argTypes: {},
|
|
9
|
-
decorators: mapContextDecorator,
|
|
10
|
-
};
|
|
11
|
-
export default storyoptions;
|
|
12
|
-
|
|
13
|
-
interface TemplateProps {
|
|
14
|
-
mapId: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const Template = (props: TemplateProps) => (
|
|
18
|
-
<DeckGlContextProvider {...props}>
|
|
19
|
-
<MlHexagonMap {...props} />
|
|
20
|
-
</DeckGlContextProvider>
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
// eslint-disable-next-line
|
|
24
|
-
export const NoiseMap: { [key: string]: any } = Template.bind({});
|
|
25
|
-
NoiseMap.parameters = {};
|
|
26
|
-
NoiseMap.args = {
|
|
27
|
-
mapId: 'map_1',
|
|
28
|
-
};
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import useDeckGl from '../../hooks/useDeckGl';
|
|
3
|
-
import { HexagonLayer, HexagonLayerProps } from '@deck.gl/aggregation-layers';
|
|
4
|
-
import { useMap } from '@mapcomponents/react-maplibre';
|
|
5
|
-
|
|
6
|
-
export interface MlHexagonMapProps {
|
|
7
|
-
/**
|
|
8
|
-
* Id of the target MapLibre instance in mapContext
|
|
9
|
-
*/
|
|
10
|
-
mapId?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Id of an existing layer in the mapLibre instance to help specify the layer order
|
|
13
|
-
* This layer will be visually beneath the layer with the "insertBeforeLayer" id.
|
|
14
|
-
*/
|
|
15
|
-
insertBeforeLayer?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const MlHexagonMap = (props: MlHexagonMapProps) => {
|
|
19
|
-
const DATA_URL = 'assets/3D/laerm_points.json';
|
|
20
|
-
const deckGlHook = useDeckGl();
|
|
21
|
-
const [noiseData, setNoiseData] = useState({
|
|
22
|
-
type: '',
|
|
23
|
-
features: [],
|
|
24
|
-
});
|
|
25
|
-
const getJsonData = () => {
|
|
26
|
-
fetch(DATA_URL, {
|
|
27
|
-
headers: {
|
|
28
|
-
'Content-Type': 'application/json',
|
|
29
|
-
Accept: 'application/json',
|
|
30
|
-
},
|
|
31
|
-
})
|
|
32
|
-
.then(function (response) {
|
|
33
|
-
return response.json();
|
|
34
|
-
})
|
|
35
|
-
.then(function (json) {
|
|
36
|
-
setNoiseData(json);
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
getJsonData();
|
|
41
|
-
}, []);
|
|
42
|
-
|
|
43
|
-
const layerOpacity = 0.8;
|
|
44
|
-
const specularColor: [number, number, number] = [51, 51, 51];
|
|
45
|
-
const getColorRange: (layerOpacity: number) => [number, number, number, number][] = (
|
|
46
|
-
layerOpacity: number
|
|
47
|
-
) => [
|
|
48
|
-
[1, 152, 189, Math.round(80 * layerOpacity)],
|
|
49
|
-
[73, 227, 206, Math.round(90 * layerOpacity)],
|
|
50
|
-
[216, 254, 181, Math.round(100 * layerOpacity)],
|
|
51
|
-
[254, 237, 177, Math.round(110 * layerOpacity)],
|
|
52
|
-
[254, 173, 84, Math.round(120 * layerOpacity)],
|
|
53
|
-
[209, 55, 78, Math.round(150 * layerOpacity)],
|
|
54
|
-
];
|
|
55
|
-
const elevationRange: [number, number] = [30, 75];
|
|
56
|
-
|
|
57
|
-
const deckGlLayerProps = useMemo(() => {
|
|
58
|
-
return {
|
|
59
|
-
id: 'deckgl-layer',
|
|
60
|
-
|
|
61
|
-
data: noiseData ? noiseData.features : [],
|
|
62
|
-
type: HexagonLayer,
|
|
63
|
-
colorRange: getColorRange(layerOpacity),
|
|
64
|
-
coverage: 0.9,
|
|
65
|
-
elevationRange: elevationRange,
|
|
66
|
-
elevationScale: 10,
|
|
67
|
-
extruded: true,
|
|
68
|
-
autoHighlight: true,
|
|
69
|
-
// eslint-disable-next-line
|
|
70
|
-
getPosition: (d: any) => {
|
|
71
|
-
return d.geometry.coordinates;
|
|
72
|
-
},
|
|
73
|
-
pickable: true,
|
|
74
|
-
radius: 16,
|
|
75
|
-
upperPercentile: 100,
|
|
76
|
-
material: {
|
|
77
|
-
ambient: 0.8,
|
|
78
|
-
diffuse: 0.5,
|
|
79
|
-
shininess: 20,
|
|
80
|
-
specularColor: specularColor,
|
|
81
|
-
},
|
|
82
|
-
transitions: {
|
|
83
|
-
elevationScale: 1500,
|
|
84
|
-
},
|
|
85
|
-
// eslint-disable-next-line
|
|
86
|
-
getColorValue: (points: any[]) => {
|
|
87
|
-
const elVal = points.reduce((acc, point) => {
|
|
88
|
-
if (!point?.properties && point.source.properties)
|
|
89
|
-
return acc < point.source.properties.dba ? point.source.properties.dba : acc;
|
|
90
|
-
return acc < point.properties.dba ? point.properties.dba : acc;
|
|
91
|
-
}, -Infinity);
|
|
92
|
-
return Math.round(elVal);
|
|
93
|
-
},
|
|
94
|
-
// eslint-disable-next-line
|
|
95
|
-
getElevationValue: (points: any): number => {
|
|
96
|
-
// eslint-disable-next-line
|
|
97
|
-
const elVal = points.reduce((acc: any, point: any) => {
|
|
98
|
-
if (!point.properties && point.source.properties)
|
|
99
|
-
return acc < point.source.properties.dba ? point.source.properties.dba : acc;
|
|
100
|
-
return acc < point.properties.dba ? point.properties.dba : acc;
|
|
101
|
-
}, -Infinity);
|
|
102
|
-
return Math.round(elVal);
|
|
103
|
-
},
|
|
104
|
-
_filterData: null,
|
|
105
|
-
};
|
|
106
|
-
}, [noiseData.features]);
|
|
107
|
-
|
|
108
|
-
const mapHook = useMap({
|
|
109
|
-
mapId: props.mapId,
|
|
110
|
-
waitForLayer: props.insertBeforeLayer,
|
|
111
|
-
});
|
|
112
|
-
const initializedRef = useRef(false);
|
|
113
|
-
|
|
114
|
-
// add deckGl Layer
|
|
115
|
-
useEffect(() => {
|
|
116
|
-
if (
|
|
117
|
-
!mapHook.map ||
|
|
118
|
-
noiseData.features.length <= 0 ||
|
|
119
|
-
(initializedRef.current && noiseData.features.length >= 0)
|
|
120
|
-
)
|
|
121
|
-
return;
|
|
122
|
-
initializedRef.current = true;
|
|
123
|
-
|
|
124
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
125
|
-
// @ts-ignore
|
|
126
|
-
const hexagonLayer = new HexagonLayer({
|
|
127
|
-
...deckGlLayerProps,
|
|
128
|
-
} as unknown as HexagonLayerProps);
|
|
129
|
-
deckGlHook.addLayer(hexagonLayer);
|
|
130
|
-
|
|
131
|
-
return () => {
|
|
132
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
133
|
-
hexagonLayer && deckGlHook.removeLayer(hexagonLayer);
|
|
134
|
-
initializedRef.current = false;
|
|
135
|
-
};
|
|
136
|
-
}, [mapHook.map, props.mapId, deckGlLayerProps]);
|
|
137
|
-
|
|
138
|
-
return <></>;
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
export default MlHexagonMap;
|
|
File without changes
|