@sqlrooms/deck 0.29.0-rc.7 → 0.29.0-rc.9
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/LICENSE.md +2 -1
- package/README.md +31 -6
- package/dist/DeckJsonMap.d.ts +2 -2
- package/dist/DeckJsonMap.d.ts.map +1 -1
- package/dist/DeckJsonMap.js +204 -17
- package/dist/DeckJsonMap.js.map +1 -1
- package/dist/DeckJsonMapSpec.d.ts +36 -36
- package/dist/DeckJsonMapSpec.d.ts.map +1 -1
- package/dist/DeckJsonMapSpec.js +1 -0
- package/dist/DeckJsonMapSpec.js.map +1 -1
- package/dist/MapSettings.d.ts.map +1 -1
- package/dist/MapSettings.js +203 -25
- package/dist/MapSettings.js.map +1 -1
- package/dist/ai.d.ts +55 -8
- package/dist/ai.d.ts.map +1 -1
- package/dist/ai.js +190 -41
- package/dist/ai.js.map +1 -1
- package/dist/block.d.ts +20 -0
- package/dist/block.d.ts.map +1 -0
- package/dist/block.js +119 -0
- package/dist/block.js.map +1 -0
- package/dist/dashboard.d.ts +2 -0
- package/dist/dashboard.d.ts.map +1 -1
- package/dist/dashboard.js +194 -285
- package/dist/dashboard.js.map +1 -1
- package/dist/dashboardConfig.d.ts +11 -3
- package/dist/dashboardConfig.d.ts.map +1 -1
- package/dist/dashboardConfig.js +82 -7
- package/dist/dashboardConfig.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/json/aggregateWaypoints.d.ts +14 -0
- package/dist/json/aggregateWaypoints.d.ts.map +1 -0
- package/dist/json/aggregateWaypoints.js +190 -0
- package/dist/json/aggregateWaypoints.js.map +1 -0
- package/dist/json/compileColorScale.d.ts +1 -1
- package/dist/json/compileColorScale.d.ts.map +1 -1
- package/dist/json/compileColorScale.js +42 -20
- package/dist/json/compileColorScale.js.map +1 -1
- package/dist/json/createDeckJsonConfiguration.d.ts.map +1 -1
- package/dist/json/createDeckJsonConfiguration.js +106 -8
- package/dist/json/createDeckJsonConfiguration.js.map +1 -1
- package/dist/json/defaultClasses.d.ts +5 -4
- package/dist/json/defaultClasses.d.ts.map +1 -1
- package/dist/json/defaultClasses.js +9 -4
- package/dist/json/defaultClasses.js.map +1 -1
- package/dist/json/extractColorScaleLegends.d.ts.map +1 -1
- package/dist/json/extractColorScaleLegends.js +43 -5
- package/dist/json/extractColorScaleLegends.js.map +1 -1
- package/dist/json/heatmapDefaults.d.ts +8 -0
- package/dist/json/heatmapDefaults.d.ts.map +1 -0
- package/dist/json/heatmapDefaults.js +14 -0
- package/dist/json/heatmapDefaults.js.map +1 -0
- package/dist/json/layerCompatibility.d.ts.map +1 -1
- package/dist/json/layerCompatibility.js +5 -1
- package/dist/json/layerCompatibility.js.map +1 -1
- package/dist/json/layers/DeckColumnLayer.d.ts +12 -0
- package/dist/json/layers/DeckColumnLayer.d.ts.map +1 -0
- package/dist/json/layers/DeckColumnLayer.js +26 -0
- package/dist/json/layers/DeckColumnLayer.js.map +1 -0
- package/dist/json/layers/DeckH3HexagonLayer.d.ts +37 -0
- package/dist/json/layers/DeckH3HexagonLayer.d.ts.map +1 -0
- package/dist/json/layers/DeckH3HexagonLayer.js +96 -0
- package/dist/json/layers/DeckH3HexagonLayer.js.map +1 -0
- package/dist/json/layers/DeckTripsLayer.d.ts +45 -0
- package/dist/json/layers/DeckTripsLayer.d.ts.map +1 -0
- package/dist/json/layers/DeckTripsLayer.js +169 -0
- package/dist/json/layers/DeckTripsLayer.js.map +1 -0
- package/dist/json/layers/index.d.ts +4 -0
- package/dist/json/layers/index.d.ts.map +1 -0
- package/dist/json/layers/index.js +4 -0
- package/dist/json/layers/index.js.map +1 -0
- package/dist/json/rewriteGeoArrowAccessors.d.ts.map +1 -1
- package/dist/json/rewriteGeoArrowAccessors.js +5 -0
- package/dist/json/rewriteGeoArrowAccessors.js.map +1 -1
- package/dist/mapConfigUtils.d.ts +102 -1
- package/dist/mapConfigUtils.d.ts.map +1 -1
- package/dist/mapConfigUtils.js +21 -3
- package/dist/mapConfigUtils.js.map +1 -1
- package/dist/mapLayerConfigUtils.d.ts +15 -0
- package/dist/mapLayerConfigUtils.d.ts.map +1 -1
- package/dist/mapLayerConfigUtils.js +109 -7
- package/dist/mapLayerConfigUtils.js.map +1 -1
- package/dist/prepare/detectGeometryColumn.d.ts +10 -1
- package/dist/prepare/detectGeometryColumn.d.ts.map +1 -1
- package/dist/prepare/detectGeometryColumn.js +48 -6
- package/dist/prepare/detectGeometryColumn.js.map +1 -1
- package/dist/prepare/wkbDecoder.d.ts.map +1 -1
- package/dist/prepare/wkbDecoder.js +88 -1
- package/dist/prepare/wkbDecoder.js.map +1 -1
- package/dist/prepare/wkbParser.d.ts +5 -0
- package/dist/prepare/wkbParser.d.ts.map +1 -1
- package/dist/prepare/wkbParser.js +24 -0
- package/dist/prepare/wkbParser.js.map +1 -1
- package/dist/types.d.ts +14 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/useDeckMapDatasets.d.ts +17 -0
- package/dist/useDeckMapDatasets.d.ts.map +1 -0
- package/dist/useDeckMapDatasets.js +69 -0
- package/dist/useDeckMapDatasets.js.map +1 -0
- package/dist/useDeckMapFitToBounds.d.ts +29 -0
- package/dist/useDeckMapFitToBounds.d.ts.map +1 -0
- package/dist/useDeckMapFitToBounds.js +333 -0
- package/dist/useDeckMapFitToBounds.js.map +1 -0
- package/package.json +7 -6
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FirstPersonView, MapView, OrbitView, OrthographicView } from '@deck.gl/core';
|
|
2
2
|
import { GeoJsonLayer } from '@deck.gl/layers';
|
|
3
|
-
import { GeoArrowArcLayer,
|
|
3
|
+
import { GeoArrowArcLayer, GeoArrowHeatmapLayer, GeoArrowPathLayer, GeoArrowPolygonLayer, GeoArrowScatterplotLayer, GeoArrowSolidPolygonLayer } from '@geoarrow/deck.gl-layers';
|
|
4
|
+
import { DeckColumnLayer, DeckH3HexagonLayer, DeckTripsLayer } from './layers';
|
|
4
5
|
export declare const DEFAULT_DECK_JSON_CLASSES: {
|
|
5
6
|
MapView: typeof MapView;
|
|
6
7
|
FirstPersonView: typeof FirstPersonView;
|
|
@@ -9,13 +10,13 @@ export declare const DEFAULT_DECK_JSON_CLASSES: {
|
|
|
9
10
|
GeoJsonLayer: typeof GeoJsonLayer;
|
|
10
11
|
GeoArrowScatterplotLayer: typeof GeoArrowScatterplotLayer;
|
|
11
12
|
GeoArrowHeatmapLayer: typeof GeoArrowHeatmapLayer;
|
|
12
|
-
GeoArrowColumnLayer: typeof
|
|
13
|
+
GeoArrowColumnLayer: typeof DeckColumnLayer;
|
|
13
14
|
GeoArrowPathLayer: typeof GeoArrowPathLayer;
|
|
14
15
|
GeoArrowPolygonLayer: typeof GeoArrowPolygonLayer;
|
|
15
16
|
GeoArrowSolidPolygonLayer: typeof GeoArrowSolidPolygonLayer;
|
|
16
17
|
GeoArrowArcLayer: typeof GeoArrowArcLayer;
|
|
17
|
-
GeoArrowTripsLayer: typeof
|
|
18
|
-
GeoArrowH3HexagonLayer: typeof
|
|
18
|
+
GeoArrowTripsLayer: typeof DeckTripsLayer;
|
|
19
|
+
GeoArrowH3HexagonLayer: typeof DeckH3HexagonLayer;
|
|
19
20
|
};
|
|
20
21
|
export declare const DEFAULT_DECK_JSON_ENUMERATIONS: {
|
|
21
22
|
COORDINATE_SYSTEM: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultClasses.d.ts","sourceRoot":"","sources":["../../src/json/defaultClasses.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,OAAO,EACP,SAAS,EACT,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"defaultClasses.d.ts","sourceRoot":"","sources":["../../src/json/defaultClasses.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,OAAO,EACP,SAAS,EACT,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AAS7E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;CAerC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;CAE1C,CAAC;AAEF,eAAO,MAAM,2BAA2B,IAAK,CAAC"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { COORDINATE_SYSTEM, FirstPersonView, MapView, OrbitView, OrthographicView, } from '@deck.gl/core';
|
|
2
2
|
import { GeoJsonLayer } from '@deck.gl/layers';
|
|
3
|
-
import { GeoArrowArcLayer,
|
|
3
|
+
import { GeoArrowArcLayer, GeoArrowHeatmapLayer, GeoArrowPathLayer, GeoArrowPolygonLayer, GeoArrowScatterplotLayer, GeoArrowSolidPolygonLayer, } from '@geoarrow/deck.gl-layers';
|
|
4
|
+
import { DeckColumnLayer, DeckH3HexagonLayer, DeckTripsLayer } from './layers';
|
|
4
5
|
// TODO(geoarrow-upgrade): Revisit this import surface on the next GeoArrow bump.
|
|
5
6
|
// Published 0.3.x uses `@geoarrow/deck.gl-layers`; newer lines may rename the package
|
|
6
7
|
// and/or move the exported layer classes.
|
|
8
|
+
//
|
|
9
|
+
// NOTE: Some @geoarrow/deck.gl-layers@0.3.2 layers are incompatible with
|
|
10
|
+
// @deck.gl@9.3.x. We use our own wrappers in ./layers/ that properly interface
|
|
11
|
+
// Arrow data with the native deck.gl layers.
|
|
7
12
|
export const DEFAULT_DECK_JSON_CLASSES = {
|
|
8
13
|
MapView,
|
|
9
14
|
FirstPersonView,
|
|
@@ -12,13 +17,13 @@ export const DEFAULT_DECK_JSON_CLASSES = {
|
|
|
12
17
|
GeoJsonLayer,
|
|
13
18
|
GeoArrowScatterplotLayer,
|
|
14
19
|
GeoArrowHeatmapLayer,
|
|
15
|
-
GeoArrowColumnLayer,
|
|
20
|
+
GeoArrowColumnLayer: DeckColumnLayer,
|
|
16
21
|
GeoArrowPathLayer,
|
|
17
22
|
GeoArrowPolygonLayer,
|
|
18
23
|
GeoArrowSolidPolygonLayer,
|
|
19
24
|
GeoArrowArcLayer,
|
|
20
|
-
GeoArrowTripsLayer,
|
|
21
|
-
GeoArrowH3HexagonLayer,
|
|
25
|
+
GeoArrowTripsLayer: DeckTripsLayer,
|
|
26
|
+
GeoArrowH3HexagonLayer: DeckH3HexagonLayer,
|
|
22
27
|
};
|
|
23
28
|
export const DEFAULT_DECK_JSON_ENUMERATIONS = {
|
|
24
29
|
COORDINATE_SYSTEM,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultClasses.js","sourceRoot":"","sources":["../../src/json/defaultClasses.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,OAAO,EACP,SAAS,EACT,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"defaultClasses.js","sourceRoot":"","sources":["../../src/json/defaultClasses.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,OAAO,EACP,SAAS,EACT,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AAE7E,iFAAiF;AACjF,sFAAsF;AACtF,0CAA0C;AAC1C,EAAE;AACF,yEAAyE;AACzE,+EAA+E;AAC/E,6CAA6C;AAC7C,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,OAAO;IACP,eAAe;IACf,SAAS;IACT,gBAAgB;IAChB,YAAY;IACZ,wBAAwB;IACxB,oBAAoB;IACpB,mBAAmB,EAAE,eAAe;IACpC,iBAAiB;IACjB,oBAAoB;IACpB,yBAAyB;IACzB,gBAAgB;IAChB,kBAAkB,EAAE,cAAc;IAClC,sBAAsB,EAAE,kBAAkB;CAC3C,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,iBAAiB;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAC","sourcesContent":["import {\n COORDINATE_SYSTEM,\n FirstPersonView,\n MapView,\n OrbitView,\n OrthographicView,\n} from '@deck.gl/core';\nimport {GeoJsonLayer} from '@deck.gl/layers';\nimport {\n GeoArrowArcLayer,\n GeoArrowHeatmapLayer,\n GeoArrowPathLayer,\n GeoArrowPolygonLayer,\n GeoArrowScatterplotLayer,\n GeoArrowSolidPolygonLayer,\n} from '@geoarrow/deck.gl-layers';\nimport {DeckColumnLayer, DeckH3HexagonLayer, DeckTripsLayer} from './layers';\n\n// TODO(geoarrow-upgrade): Revisit this import surface on the next GeoArrow bump.\n// Published 0.3.x uses `@geoarrow/deck.gl-layers`; newer lines may rename the package\n// and/or move the exported layer classes.\n//\n// NOTE: Some @geoarrow/deck.gl-layers@0.3.2 layers are incompatible with\n// @deck.gl@9.3.x. We use our own wrappers in ./layers/ that properly interface\n// Arrow data with the native deck.gl layers.\nexport const DEFAULT_DECK_JSON_CLASSES = {\n MapView,\n FirstPersonView,\n OrbitView,\n OrthographicView,\n GeoJsonLayer,\n GeoArrowScatterplotLayer,\n GeoArrowHeatmapLayer,\n GeoArrowColumnLayer: DeckColumnLayer,\n GeoArrowPathLayer,\n GeoArrowPolygonLayer,\n GeoArrowSolidPolygonLayer,\n GeoArrowArcLayer,\n GeoArrowTripsLayer: DeckTripsLayer,\n GeoArrowH3HexagonLayer: DeckH3HexagonLayer,\n};\n\nexport const DEFAULT_DECK_JSON_ENUMERATIONS = {\n COORDINATE_SYSTEM,\n};\n\nexport const DEFAULT_DECK_JSON_CONSTANTS = {};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractColorScaleLegends.d.ts","sourceRoot":"","sources":["../../src/json/extractColorScaleLegends.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"extractColorScaleLegends.d.ts","sourceRoot":"","sources":["../../src/json/extractColorScaleLegends.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,UAAU,CAAC;AAmDvD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE;IAChD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACrC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;CACzD,yBA8DA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getColorScale } from './colorScaleFunction';
|
|
2
2
|
import { buildColorScaleLegend } from './compileColorScale';
|
|
3
|
+
import { DEFAULT_HEATMAP_COLOR_RANGE } from './heatmapDefaults';
|
|
3
4
|
import { resolveColorLegend, resolveDatasetId } from './layerConfig';
|
|
4
5
|
function resolveLegendTitle(layerProps, fallbackField) {
|
|
5
6
|
const legend = resolveColorLegend(layerProps, 'getFillColor') ??
|
|
@@ -11,6 +12,25 @@ function resolveLegendTitle(layerProps, fallbackField) {
|
|
|
11
12
|
}
|
|
12
13
|
return fallbackField;
|
|
13
14
|
}
|
|
15
|
+
function buildHeatmapLegend(layerProps) {
|
|
16
|
+
const rawRange = layerProps.colorRange;
|
|
17
|
+
const colorRange = Array.isArray(rawRange) && rawRange.length >= 2
|
|
18
|
+
? rawRange
|
|
19
|
+
: DEFAULT_HEATMAP_COLOR_RANGE;
|
|
20
|
+
const stops = colorRange.map((c, i) => {
|
|
21
|
+
const pct = (i / (colorRange.length - 1)) * 100;
|
|
22
|
+
return `rgba(${c[0]},${c[1]},${c[2]},${(c[3] ?? 255) / 255}) ${pct.toFixed(1)}%`;
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
type: 'continuous',
|
|
26
|
+
title: 'Density',
|
|
27
|
+
gradient: `linear-gradient(to right, ${stops.join(', ')})`,
|
|
28
|
+
ticks: [
|
|
29
|
+
{ label: 'Low', offset: 0 },
|
|
30
|
+
{ label: 'High', offset: 100 },
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
14
34
|
export function extractColorScaleLegends(options) {
|
|
15
35
|
const { spec, datasetIds, datasetStates } = options;
|
|
16
36
|
if (!spec || !Array.isArray(spec.layers)) {
|
|
@@ -22,6 +42,17 @@ export function extractColorScaleLegends(options) {
|
|
|
22
42
|
continue;
|
|
23
43
|
}
|
|
24
44
|
const layerProps = layer;
|
|
45
|
+
if (layerProps.visible === false) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const layerType = layerProps['@@type'];
|
|
49
|
+
if (layerType === 'GeoArrowHeatmapLayer') {
|
|
50
|
+
const heatmapLegend = buildHeatmapLegend(layerProps);
|
|
51
|
+
if (heatmapLegend) {
|
|
52
|
+
legends.push(heatmapLegend);
|
|
53
|
+
}
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
25
56
|
const resolvedColorScale = getColorScale(layerProps);
|
|
26
57
|
if (!resolvedColorScale) {
|
|
27
58
|
continue;
|
|
@@ -35,11 +66,18 @@ export function extractColorScaleLegends(options) {
|
|
|
35
66
|
if (!datasetState || datasetState.status !== 'ready') {
|
|
36
67
|
continue;
|
|
37
68
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
69
|
+
let resolvedLegend = null;
|
|
70
|
+
try {
|
|
71
|
+
resolvedLegend = buildColorScaleLegend({
|
|
72
|
+
table: datasetState.prepared.table,
|
|
73
|
+
colorScale,
|
|
74
|
+
title: resolveLegendTitle(layerProps, colorScale.field),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
// Skip legends for fields that don't exist in the dataset
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
43
81
|
if (resolvedLegend) {
|
|
44
82
|
legends.push(resolvedLegend);
|
|
45
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractColorScaleLegends.js","sourceRoot":"","sources":["../../src/json/extractColorScaleLegends.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAC,qBAAqB,EAAC,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAC,kBAAkB,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAEnE,SAAS,kBAAkB,CACzB,UAAmC,EACnC,aAAqB;IAErB,MAAM,MAAM,GACV,kBAAkB,CAAC,UAAU,EAAE,cAAc,CAAC;QAC9C,kBAAkB,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IACjD,IACE,MAAM;QACN,OAAO,MAAM,KAAK,QAAQ;QAC1B,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,EAChC,CAAC;QACD,OAAO,MAAM,CAAC,KAAK,CAAC;IACt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S;QACX,CAAC;QAED,IAAI,cAAc,EAAE,CAAC;YACnB,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type {ResolvedColorLegend} from '@sqlrooms/color-scales';\nimport type {PreparedDeckDatasetState} from '../types';\nimport {getColorScale} from './colorScaleFunction';\nimport {buildColorScaleLegend} from './compileColorScale';\nimport {DEFAULT_HEATMAP_COLOR_RANGE} from './heatmapDefaults';\nimport {resolveColorLegend, resolveDatasetId} from './layerConfig';\n\nfunction resolveLegendTitle(\n layerProps: Record<string, unknown>,\n fallbackField: string,\n) {\n const legend =\n resolveColorLegend(layerProps, 'getFillColor') ??\n resolveColorLegend(layerProps, 'getLineColor');\n if (\n legend &&\n typeof legend === 'object' &&\n typeof legend.title === 'string'\n ) {\n return legend.title;\n }\n\n return fallbackField;\n}\n\nfunction buildHeatmapLegend(\n layerProps: Record<string, unknown>,\n): ResolvedColorLegend | null {\n const rawRange = layerProps.colorRange as\n | Array<[number, number, number, number]>\n | undefined;\n const colorRange =\n Array.isArray(rawRange) && rawRange.length >= 2\n ? rawRange\n : DEFAULT_HEATMAP_COLOR_RANGE;\n\n const stops = colorRange.map((c, i) => {\n const pct = (i / (colorRange.length - 1)) * 100;\n return `rgba(${c[0]},${c[1]},${c[2]},${(c[3] ?? 255) / 255}) ${pct.toFixed(1)}%`;\n });\n\n return {\n type: 'continuous',\n title: 'Density',\n gradient: `linear-gradient(to right, ${stops.join(', ')})`,\n ticks: [\n {label: 'Low', offset: 0},\n {label: 'High', offset: 100},\n ],\n };\n}\n\nexport function extractColorScaleLegends(options: {\n spec: Record<string, unknown> | null;\n datasetIds: string[];\n datasetStates: Record<string, PreparedDeckDatasetState>;\n}) {\n const {spec, datasetIds, datasetStates} = options;\n if (!spec || !Array.isArray(spec.layers)) {\n return [] as ResolvedColorLegend[];\n }\n\n const legends: ResolvedColorLegend[] = [];\n\n for (const layer of spec.layers) {\n if (!layer || typeof layer !== 'object') {\n continue;\n }\n\n const layerProps = layer as Record<string, unknown>;\n\n if (layerProps.visible === false) {\n continue;\n }\n\n const layerType = layerProps['@@type'];\n if (layerType === 'GeoArrowHeatmapLayer') {\n const heatmapLegend = buildHeatmapLegend(layerProps);\n if (heatmapLegend) {\n legends.push(heatmapLegend);\n }\n continue;\n }\n\n const resolvedColorScale = getColorScale(layerProps);\n if (!resolvedColorScale) {\n continue;\n }\n const {colorScale} = resolvedColorScale;\n\n const datasetId = resolveDatasetId(layerProps, datasetIds);\n if (!datasetId) {\n continue;\n }\n\n const datasetState = datasetStates[datasetId];\n if (!datasetState || datasetState.status !== 'ready') {\n continue;\n }\n\n let resolvedLegend: ResolvedColorLegend | null = null;\n try {\n resolvedLegend = buildColorScaleLegend({\n table: datasetState.prepared.table,\n colorScale,\n title: resolveLegendTitle(layerProps, colorScale.field),\n });\n } catch {\n // Skip legends for fields that don't exist in the dataset\n continue;\n }\n\n if (resolvedLegend) {\n legends.push(resolvedLegend);\n }\n }\n\n return legends;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heatmapDefaults.d.ts","sourceRoot":"","sources":["../../src/json/heatmapDefaults.ts"],"names":[],"mappings":"AAOA,4FAA4F;AAC5F,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAC7C;IAAC,MAAM;IAAE,MAAM;IAAE,MAAM;IAAE,MAAM;CAAC,CAc7B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { continuousSequentialInterpolators, parseColorString, } from '@sqlrooms/color-scales';
|
|
2
|
+
const HEATMAP_COLOR_STEPS = 6;
|
|
3
|
+
/** Default color range for heatmap layers (YlOrRd, matching deck.gl's built-in default). */
|
|
4
|
+
export const DEFAULT_HEATMAP_COLOR_RANGE = continuousSequentialInterpolators.YlOrRd
|
|
5
|
+
? Array.from({ length: HEATMAP_COLOR_STEPS }, (_, i) => parseColorString(continuousSequentialInterpolators.YlOrRd(i / (HEATMAP_COLOR_STEPS - 1))))
|
|
6
|
+
: [
|
|
7
|
+
[255, 255, 178, 255],
|
|
8
|
+
[254, 178, 76, 255],
|
|
9
|
+
[253, 141, 60, 255],
|
|
10
|
+
[240, 59, 32, 255],
|
|
11
|
+
[189, 0, 38, 255],
|
|
12
|
+
[128, 0, 38, 255],
|
|
13
|
+
];
|
|
14
|
+
//# sourceMappingURL=heatmapDefaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heatmapDefaults.js","sourceRoot":"","sources":["../../src/json/heatmapDefaults.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B,4FAA4F;AAC5F,MAAM,CAAC,MAAM,2BAA2B,GAEpC,iCAAiC,CAAC,MAAM;IAC1C,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,mBAAmB,EAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACjD,gBAAgB,CACd,iCAAiC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,mBAAmB,GAAG,CAAC,CAAC,CAAC,CACxE,CACF;IACH,CAAC,CAAC;QACE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;QACpB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC;QACnB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC;QACnB,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC;QAClB,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC;QACjB,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC;KAClB,CAAC","sourcesContent":["import {\n continuousSequentialInterpolators,\n parseColorString,\n} from '@sqlrooms/color-scales';\n\nconst HEATMAP_COLOR_STEPS = 6;\n\n/** Default color range for heatmap layers (YlOrRd, matching deck.gl's built-in default). */\nexport const DEFAULT_HEATMAP_COLOR_RANGE: Array<\n [number, number, number, number]\n> = continuousSequentialInterpolators.YlOrRd\n ? Array.from({length: HEATMAP_COLOR_STEPS}, (_, i) =>\n parseColorString(\n continuousSequentialInterpolators.YlOrRd(i / (HEATMAP_COLOR_STEPS - 1)),\n ),\n )\n : [\n [255, 255, 178, 255],\n [254, 178, 76, 255],\n [253, 141, 60, 255],\n [240, 59, 32, 255],\n [189, 0, 38, 255],\n [128, 0, 38, 255],\n ];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layerCompatibility.d.ts","sourceRoot":"","sources":["../../src/json/layerCompatibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAExD,KAAK,oBAAoB,GAAG;IAC1B,cAAc,EAAE,SAAS,CAAC;IAC1B,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC5B,SAAS,EAAE,oBAAoB,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,cAAc,EAAE,UAAU,CAAC;IAC3B,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF,KAAK,kBAAkB,GAAG,oBAAoB,GAAG,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"layerCompatibility.d.ts","sourceRoot":"","sources":["../../src/json/layerCompatibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAExD,KAAK,oBAAoB,GAAG;IAC1B,cAAc,EAAE,SAAS,CAAC;IAC1B,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC5B,SAAS,EAAE,oBAAoB,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,cAAc,EAAE,UAAU,CAAC;IAC3B,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF,KAAK,kBAAkB,GAAG,oBAAoB,GAAG,qBAAqB,CAAC;AAuKvE,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,kCAEtD"}
|
|
@@ -61,6 +61,7 @@ const LAYER_COMPATIBILITY = {
|
|
|
61
61
|
},
|
|
62
62
|
],
|
|
63
63
|
vectorAccessorProps: ['getPath', 'getColor', 'getWidth'],
|
|
64
|
+
allowGeoArrowPromotion: true,
|
|
64
65
|
},
|
|
65
66
|
GeoArrowTripsLayer: {
|
|
66
67
|
representation: 'geoarrow',
|
|
@@ -78,6 +79,7 @@ const LAYER_COMPATIBILITY = {
|
|
|
78
79
|
},
|
|
79
80
|
],
|
|
80
81
|
vectorAccessorProps: ['getPath', 'getTimestamps', 'getColor', 'getWidth'],
|
|
82
|
+
allowGeoArrowPromotion: true,
|
|
81
83
|
},
|
|
82
84
|
GeoArrowPolygonLayer: {
|
|
83
85
|
representation: 'geoarrow',
|
|
@@ -139,6 +141,7 @@ const LAYER_COMPATIBILITY = {
|
|
|
139
141
|
'getHeight',
|
|
140
142
|
'getTilt',
|
|
141
143
|
],
|
|
144
|
+
allowGeoArrowPromotion: true,
|
|
142
145
|
},
|
|
143
146
|
GeoArrowH3HexagonLayer: {
|
|
144
147
|
representation: 'geoarrow',
|
|
@@ -153,8 +156,9 @@ const LAYER_COMPATIBILITY = {
|
|
|
153
156
|
vectorAccessorProps: [
|
|
154
157
|
'getHexagon',
|
|
155
158
|
'getFillColor',
|
|
156
|
-
'getLineColor',
|
|
157
159
|
'getElevation',
|
|
160
|
+
'getLineColor',
|
|
161
|
+
'getLineWidth',
|
|
158
162
|
],
|
|
159
163
|
},
|
|
160
164
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layerCompatibility.js","sourceRoot":"","sources":["../../src/json/layerCompatibility.ts"],"names":[],"mappings":"AAuBA,MAAM,mBAAmB,GAAuC;IAC9D,YAAY,EAAE;QACZ,cAAc,EAAE,SAAS;QACzB,mBAAmB,EAAE,EAAE;KACxB;IACD,wBAAwB,EAAE;QACxB,cAAc,EAAE,UAAU;QAC1B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,gBAAgB;aAC5B;SACF;QACD,mBAAmB,EAAE;YACnB,aAAa;YACb,WAAW;YACX,cAAc;YACd,cAAc;YACd,cAAc;SACf;QACD,sBAAsB,EAAE,IAAI;KAC7B;IACD,oBAAoB,EAAE;QACpB,cAAc,EAAE,UAAU;QAC1B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,gBAAgB;aAC5B;SACF;QACD,mBAAmB,EAAE,CAAC,aAAa,EAAE,WAAW,CAAC;QACjD,sBAAsB,EAAE,IAAI;KAC7B;IACD,mBAAmB,EAAE;QACnB,cAAc,EAAE,UAAU;QAC1B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,gBAAgB;aAC5B;SACF;QACD,mBAAmB,EAAE;YACnB,aAAa;YACb,cAAc;YACd,cAAc;YACd,cAAc;YACd,cAAc;SACf;QACD,sBAAsB,EAAE,IAAI;KAC7B;IACD,iBAAiB,EAAE;QACjB,cAAc,EAAE,UAAU;QAC1B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,gBAAgB;aAC5B;SACF;QACD,mBAAmB,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"layerCompatibility.js","sourceRoot":"","sources":["../../src/json/layerCompatibility.ts"],"names":[],"mappings":"AAuBA,MAAM,mBAAmB,GAAuC;IAC9D,YAAY,EAAE;QACZ,cAAc,EAAE,SAAS;QACzB,mBAAmB,EAAE,EAAE;KACxB;IACD,wBAAwB,EAAE;QACxB,cAAc,EAAE,UAAU;QAC1B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,gBAAgB;aAC5B;SACF;QACD,mBAAmB,EAAE;YACnB,aAAa;YACb,WAAW;YACX,cAAc;YACd,cAAc;YACd,cAAc;SACf;QACD,sBAAsB,EAAE,IAAI;KAC7B;IACD,oBAAoB,EAAE;QACpB,cAAc,EAAE,UAAU;QAC1B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,gBAAgB;aAC5B;SACF;QACD,mBAAmB,EAAE,CAAC,aAAa,EAAE,WAAW,CAAC;QACjD,sBAAsB,EAAE,IAAI;KAC7B;IACD,mBAAmB,EAAE;QACnB,cAAc,EAAE,UAAU;QAC1B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,gBAAgB;aAC5B;SACF;QACD,mBAAmB,EAAE;YACnB,aAAa;YACb,cAAc;YACd,cAAc;YACd,cAAc;YACd,cAAc;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E,UAAU;QAC1B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,mBAAmB;gBACzB,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,sBAAsB;gBACjC,QAAQ,EAAE,IAAI;aACf;YACD;gBACE,IAAI,EAAE,mBAAmB;gBACzB,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,sBAAsB;gBACjC,QAAQ,EAAE,IAAI;aACf;SACF;QACD,mBAAmB,EAAE;YACnB,mBAAmB;YACnB,mBAAmB;YACnB,gBAAgB;YAChB,gBAAgB;YAChB,UAAU;YACV,WAAW;YACX,SAAS;SACV;QACD,sBAAsB,EAAE,IAAI;KAC7B;IACD,sBAAsB,EAAE;QACtB,cAAc,EAAE,UAAU;QAC1B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,QAAQ;gBACd,SAAS,EAAE,eAAe;gBAC1B,QAAQ,EAAE,IAAI;aACf;SACF;QACD,mBAAmB,EAAE;YACnB,YAAY;YACZ,cAAc;YACd,cAAc;YACd,cAAc;YACd,cAAc;SACf;KACF;CACF,CAAC;AAEF,MAAM,UAAU,qBAAqB,CAAC,SAAiB;IACrD,OAAO,mBAAmB,CAAC,SAAS,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import type {LayerConfigColumnKey} from './layerConfig';\n\ntype GeoJsonCompatibility = {\n representation: 'geojson';\n vectorAccessorProps: string[];\n};\n\ntype GeoArrowBinding = {\n prop: string;\n kind: 'geometry' | 'column';\n configKey: LayerConfigColumnKey;\n required?: boolean;\n};\n\ntype GeoArrowCompatibility = {\n representation: 'geoarrow';\n bindings: GeoArrowBinding[];\n vectorAccessorProps: string[];\n allowGeoArrowPromotion?: boolean;\n};\n\ntype LayerCompatibility = GeoJsonCompatibility | GeoArrowCompatibility;\n\nconst LAYER_COMPATIBILITY: Record<string, LayerCompatibility> = {\n GeoJsonLayer: {\n representation: 'geojson',\n vectorAccessorProps: [],\n },\n GeoArrowScatterplotLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getPosition',\n kind: 'geometry',\n configKey: 'geometryColumn',\n },\n ],\n vectorAccessorProps: [\n 'getPosition',\n 'getRadius',\n 'getFillColor',\n 'getLineColor',\n 'getLineWidth',\n ],\n allowGeoArrowPromotion: true,\n },\n GeoArrowHeatmapLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getPosition',\n kind: 'geometry',\n configKey: 'geometryColumn',\n },\n ],\n vectorAccessorProps: ['getPosition', 'getWeight'],\n allowGeoArrowPromotion: true,\n },\n GeoArrowColumnLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getPosition',\n kind: 'geometry',\n configKey: 'geometryColumn',\n },\n ],\n vectorAccessorProps: [\n 'getPosition',\n 'getFillColor',\n 'getLineColor',\n 'getLineWidth',\n 'getElevation',\n ],\n allowGeoArrowPromotion: true,\n },\n GeoArrowPathLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getPath',\n kind: 'geometry',\n configKey: 'geometryColumn',\n },\n ],\n vectorAccessorProps: ['getPath', 'getColor', 'getWidth'],\n allowGeoArrowPromotion: true,\n },\n GeoArrowTripsLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getPath',\n kind: 'geometry',\n configKey: 'geometryColumn',\n },\n {\n prop: 'getTimestamps',\n kind: 'column',\n configKey: 'timestampColumn',\n required: true,\n },\n ],\n vectorAccessorProps: ['getPath', 'getTimestamps', 'getColor', 'getWidth'],\n allowGeoArrowPromotion: true,\n },\n GeoArrowPolygonLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getPolygon',\n kind: 'geometry',\n configKey: 'geometryColumn',\n },\n ],\n vectorAccessorProps: [\n 'getPolygon',\n 'getFillColor',\n 'getLineColor',\n 'getLineWidth',\n 'getElevation',\n ],\n allowGeoArrowPromotion: true,\n },\n GeoArrowSolidPolygonLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getPolygon',\n kind: 'geometry',\n configKey: 'geometryColumn',\n },\n ],\n vectorAccessorProps: [\n 'getPolygon',\n 'getElevation',\n 'getFillColor',\n 'getLineColor',\n ],\n allowGeoArrowPromotion: true,\n },\n GeoArrowArcLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getSourcePosition',\n kind: 'geometry',\n configKey: 'sourceGeometryColumn',\n required: true,\n },\n {\n prop: 'getTargetPosition',\n kind: 'geometry',\n configKey: 'targetGeometryColumn',\n required: true,\n },\n ],\n vectorAccessorProps: [\n 'getSourcePosition',\n 'getTargetPosition',\n 'getSourceColor',\n 'getTargetColor',\n 'getWidth',\n 'getHeight',\n 'getTilt',\n ],\n allowGeoArrowPromotion: true,\n },\n GeoArrowH3HexagonLayer: {\n representation: 'geoarrow',\n bindings: [\n {\n prop: 'getHexagon',\n kind: 'column',\n configKey: 'hexagonColumn',\n required: true,\n },\n ],\n vectorAccessorProps: [\n 'getHexagon',\n 'getFillColor',\n 'getElevation',\n 'getLineColor',\n 'getLineWidth',\n ],\n },\n};\n\nexport function getLayerCompatibility(layerName: string) {\n return LAYER_COMPATIBILITY[layerName];\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { GeoArrowColumnLayer } from '@geoarrow/deck.gl-layers';
|
|
2
|
+
/**
|
|
3
|
+
* GeoArrowColumnLayer wrapper with a fix for the deck.gl ColumnLayer
|
|
4
|
+
* wireframe index buffer bug (#10021). The fix patches the base ColumnLayer
|
|
5
|
+
* draw method which GeoArrowColumnLayer instantiates as sublayers.
|
|
6
|
+
*
|
|
7
|
+
* Remove this wrapper once deck.gl includes the upstream fix (PR #10094).
|
|
8
|
+
*/
|
|
9
|
+
export declare class DeckColumnLayer<ExtraProps extends object = object> extends GeoArrowColumnLayer<ExtraProps> {
|
|
10
|
+
static layerName: string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=DeckColumnLayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeckColumnLayer.d.ts","sourceRoot":"","sources":["../../../src/json/layers/DeckColumnLayer.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,mBAAmB,EAAC,MAAM,0BAA0B,CAAC;AAyB7D;;;;;;GAMG;AACH,qBAAa,eAAe,CAC1B,UAAU,SAAS,MAAM,GAAG,MAAM,CAClC,SAAQ,mBAAmB,CAAC,UAAU,CAAC;IACvC,MAAM,CAAC,SAAS,SAAyB;CAC1C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ColumnLayer } from '@deck.gl/layers';
|
|
2
|
+
import { GeoArrowColumnLayer } from '@geoarrow/deck.gl-layers';
|
|
3
|
+
// Workaround for deck.gl bug #10021: the ColumnLayer's wireframe index buffer
|
|
4
|
+
// leaks onto the fill model when using binary data (as GeoArrow does), causing
|
|
5
|
+
// the fill model to render with line-list indices instead of triangle-strip.
|
|
6
|
+
// This produces half-rendered columns with missing caps.
|
|
7
|
+
// See: https://github.com/visgl/deck.gl/pull/10094
|
|
8
|
+
const originalColumnDraw = ColumnLayer.prototype.draw;
|
|
9
|
+
ColumnLayer.prototype.draw = function (opts) {
|
|
10
|
+
const fillModel = this.state.fillModel;
|
|
11
|
+
if (fillModel?.vertexArray?.indexBuffer) {
|
|
12
|
+
fillModel.setIndexBuffer(null);
|
|
13
|
+
}
|
|
14
|
+
return originalColumnDraw.call(this, opts);
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* GeoArrowColumnLayer wrapper with a fix for the deck.gl ColumnLayer
|
|
18
|
+
* wireframe index buffer bug (#10021). The fix patches the base ColumnLayer
|
|
19
|
+
* draw method which GeoArrowColumnLayer instantiates as sublayers.
|
|
20
|
+
*
|
|
21
|
+
* Remove this wrapper once deck.gl includes the upstream fix (PR #10094).
|
|
22
|
+
*/
|
|
23
|
+
export class DeckColumnLayer extends GeoArrowColumnLayer {
|
|
24
|
+
static layerName = 'GeoArrowColumnLayer';
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=DeckColumnLayer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeckColumnLayer.js","sourceRoot":"","sources":["../../../src/json/layers/DeckColumnLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,mBAAmB,EAAC,MAAM,0BAA0B,CAAC;AAE7D,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,yDAAyD;AACzD,mDAAmD;AACnD,MAAM,kBAAkB,GAAG,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC;AACtD,WAAW,CAAC,SAAS,CAAC,IAAI,GAAG,UAAU,IAAyB;IAC9D,MAAM,SAAS,GACb,IAQD,CAAC,KAAK,CAAC,SAAS,CAAC;IAClB,IAAI,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;QACxC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,OAAO,eAEX,SAAQ,mBAA+B;IACvC,MAAM,CAAC,SAAS,GAAG,qBAAqB,CAAC","sourcesContent":["import {ColumnLayer} from '@deck.gl/layers';\nimport {GeoArrowColumnLayer} from '@geoarrow/deck.gl-layers';\n\n// Workaround for deck.gl bug #10021: the ColumnLayer's wireframe index buffer\n// leaks onto the fill model when using binary data (as GeoArrow does), causing\n// the fill model to render with line-list indices instead of triangle-strip.\n// This produces half-rendered columns with missing caps.\n// See: https://github.com/visgl/deck.gl/pull/10094\nconst originalColumnDraw = ColumnLayer.prototype.draw;\nColumnLayer.prototype.draw = function (opts: {uniforms: unknown}) {\n const fillModel = (\n this as unknown as {\n state: {\n fillModel: {\n vertexArray: {indexBuffer: unknown};\n setIndexBuffer: (b: null) => void;\n };\n };\n }\n ).state.fillModel;\n if (fillModel?.vertexArray?.indexBuffer) {\n fillModel.setIndexBuffer(null);\n }\n return originalColumnDraw.call(this, opts);\n};\n\n/**\n * GeoArrowColumnLayer wrapper with a fix for the deck.gl ColumnLayer\n * wireframe index buffer bug (#10021). The fix patches the base ColumnLayer\n * draw method which GeoArrowColumnLayer instantiates as sublayers.\n *\n * Remove this wrapper once deck.gl includes the upstream fix (PR #10094).\n */\nexport class DeckColumnLayer<\n ExtraProps extends object = object,\n> extends GeoArrowColumnLayer<ExtraProps> {\n static layerName = 'GeoArrowColumnLayer';\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { CompositeLayer, type Layer, type LayersList } from '@deck.gl/core';
|
|
2
|
+
import * as arrow from 'apache-arrow';
|
|
3
|
+
/**
|
|
4
|
+
* Custom GeoArrow-compatible H3HexagonLayer wrapper.
|
|
5
|
+
*
|
|
6
|
+
* GeoArrowH3HexagonLayer from @geoarrow/deck.gl-layers@0.3.2 is incompatible
|
|
7
|
+
* with @deck.gl/geo-layers@9.3.x: the wrapper passes H3 indices via binary
|
|
8
|
+
* attributes, but H3HexagonLayer internally iterates rows using createIterable
|
|
9
|
+
* and calls getHexagon(object) expecting string H3 indices. This causes
|
|
10
|
+
* "Cannot read properties of undefined" errors at runtime.
|
|
11
|
+
*
|
|
12
|
+
* This wrapper converts Arrow data to row objects with proper BigInt→hex string
|
|
13
|
+
* conversion, then passes them to the native H3HexagonLayer.
|
|
14
|
+
*/
|
|
15
|
+
export declare class DeckH3HexagonLayer extends CompositeLayer<{
|
|
16
|
+
data: arrow.Table;
|
|
17
|
+
getHexagon: arrow.Vector;
|
|
18
|
+
getFillColor?: arrow.Vector | [number, number, number, number] | ((...args: any[]) => any);
|
|
19
|
+
getElevation?: arrow.Vector | number | ((...args: any[]) => any);
|
|
20
|
+
getLineColor?: arrow.Vector | [number, number, number, number] | ((...args: any[]) => any);
|
|
21
|
+
getLineWidth?: arrow.Vector | number | ((...args: any[]) => any);
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
}> {
|
|
24
|
+
static layerName: string;
|
|
25
|
+
static defaultProps: {
|
|
26
|
+
highPrecision: string;
|
|
27
|
+
coverage: {
|
|
28
|
+
type: string;
|
|
29
|
+
min: number;
|
|
30
|
+
max: number;
|
|
31
|
+
value: number;
|
|
32
|
+
};
|
|
33
|
+
extruded: boolean;
|
|
34
|
+
};
|
|
35
|
+
renderLayers(): Layer | LayersList | null;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=DeckH3HexagonLayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeckH3HexagonLayer.d.ts","sourceRoot":"","sources":["../../../src/json/layers/DeckH3HexagonLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,KAAK,KAAK,EAAE,KAAK,UAAU,EAAC,MAAM,eAAe,CAAC;AAE1E,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,qBAAa,kBAAmB,SAAQ,cAAc,CAAC;IACrD,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC;IAClB,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC;IACzB,YAAY,CAAC,EACT,KAAK,CAAC,MAAM,GACZ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAChC,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC;IAC9B,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC;IACjE,YAAY,CAAC,EACT,KAAK,CAAC,MAAM,GACZ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAChC,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC;IAC9B,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC;IACjE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;IACA,MAAM,CAAC,SAAS,SAA4B;IAC5C,MAAM,CAAC,YAAY;;;;;;;;;MAIjB;IAEF,YAAY,IAAI,KAAK,GAAG,UAAU,GAAG,IAAI;CAoF1C"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { CompositeLayer } from '@deck.gl/core';
|
|
2
|
+
import { H3HexagonLayer } from '@deck.gl/geo-layers';
|
|
3
|
+
import * as arrow from 'apache-arrow';
|
|
4
|
+
/**
|
|
5
|
+
* Custom GeoArrow-compatible H3HexagonLayer wrapper.
|
|
6
|
+
*
|
|
7
|
+
* GeoArrowH3HexagonLayer from @geoarrow/deck.gl-layers@0.3.2 is incompatible
|
|
8
|
+
* with @deck.gl/geo-layers@9.3.x: the wrapper passes H3 indices via binary
|
|
9
|
+
* attributes, but H3HexagonLayer internally iterates rows using createIterable
|
|
10
|
+
* and calls getHexagon(object) expecting string H3 indices. This causes
|
|
11
|
+
* "Cannot read properties of undefined" errors at runtime.
|
|
12
|
+
*
|
|
13
|
+
* This wrapper converts Arrow data to row objects with proper BigInt→hex string
|
|
14
|
+
* conversion, then passes them to the native H3HexagonLayer.
|
|
15
|
+
*/
|
|
16
|
+
export class DeckH3HexagonLayer extends CompositeLayer {
|
|
17
|
+
static layerName = 'GeoArrowH3HexagonLayer';
|
|
18
|
+
static defaultProps = {
|
|
19
|
+
highPrecision: 'auto',
|
|
20
|
+
coverage: { type: 'number', min: 0, max: 1, value: 1 },
|
|
21
|
+
extruded: true,
|
|
22
|
+
};
|
|
23
|
+
renderLayers() {
|
|
24
|
+
const { data: table, getHexagon: hexProp, ...otherProps } = this.props;
|
|
25
|
+
if (!table || !hexProp)
|
|
26
|
+
return null;
|
|
27
|
+
const numRows = table.numRows;
|
|
28
|
+
const isVector = hexProp instanceof arrow.Vector;
|
|
29
|
+
const isBigIntColumn = isVector &&
|
|
30
|
+
(hexProp.type instanceof arrow.Int64 ||
|
|
31
|
+
hexProp.type instanceof arrow.Uint64);
|
|
32
|
+
// Resolve hex value per row
|
|
33
|
+
const getHexValue = (i) => {
|
|
34
|
+
if (isVector) {
|
|
35
|
+
const raw = hexProp.get(i);
|
|
36
|
+
if (isBigIntColumn && typeof raw === 'bigint') {
|
|
37
|
+
return raw.toString(16);
|
|
38
|
+
}
|
|
39
|
+
return String(raw ?? '');
|
|
40
|
+
}
|
|
41
|
+
// Compiled accessor function
|
|
42
|
+
if (typeof hexProp === 'function') {
|
|
43
|
+
const result = hexProp({
|
|
44
|
+
index: i,
|
|
45
|
+
data: { data: table.batches[0] },
|
|
46
|
+
target: [],
|
|
47
|
+
});
|
|
48
|
+
if (typeof result === 'bigint')
|
|
49
|
+
return result.toString(16);
|
|
50
|
+
return String(result ?? '');
|
|
51
|
+
}
|
|
52
|
+
return '';
|
|
53
|
+
};
|
|
54
|
+
// Build row objects from Arrow table
|
|
55
|
+
const rows = Array.from({ length: numRows }, (_, i) => {
|
|
56
|
+
const row = {};
|
|
57
|
+
for (const field of table.schema.fields) {
|
|
58
|
+
row[field.name] = table.getChild(field.name)?.get(i);
|
|
59
|
+
}
|
|
60
|
+
row.__h3Index = getHexValue(i);
|
|
61
|
+
return row;
|
|
62
|
+
});
|
|
63
|
+
// Resolve accessor props: Arrow Vectors → row functions, keep scalars
|
|
64
|
+
const layerProps = {};
|
|
65
|
+
for (const [propName, propValue] of Object.entries(otherProps)) {
|
|
66
|
+
if (propValue instanceof arrow.Vector) {
|
|
67
|
+
// Arrow Vector → row accessor (H3 layer uses row-based iteration)
|
|
68
|
+
const vec = propValue;
|
|
69
|
+
layerProps[propName] = (d, { index }) => {
|
|
70
|
+
return vec.get(index);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
else if (typeof propValue === 'function') {
|
|
74
|
+
// Compiled GeoArrow accessor → wrap with batch context
|
|
75
|
+
const fn = propValue;
|
|
76
|
+
layerProps[propName] = (_object, objectInfo) => {
|
|
77
|
+
return fn({
|
|
78
|
+
index: objectInfo.index,
|
|
79
|
+
data: { data: table.batches[0] },
|
|
80
|
+
target: objectInfo.target,
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
layerProps[propName] = propValue;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return new H3HexagonLayer({
|
|
89
|
+
...layerProps,
|
|
90
|
+
id: `${this.props.id}-geoarrow-h3`,
|
|
91
|
+
data: rows,
|
|
92
|
+
getHexagon: (d) => d.__h3Index,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=DeckH3HexagonLayer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeckH3HexagonLayer.js","sourceRoot":"","sources":["../../../src/json/layers/DeckH3HexagonLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAA8B,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,kBAAmB,SAAQ,cActC;IACA,MAAM,CAAC,SAAS,GAAG,wBAAwB,CAAC;IAC5C,MAAM,CAAC,YAAY,GAAG;QACpB,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAC;QACpD,QAAQ,EAAE,IAAI;KACf,CAAC;IAEF,YAAY;QACV,MAAM,EAAC,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,UAAU,EAAC,GA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AAM;qBAC1B,CAAC,CAAC;gBACL,CAAC,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,UAAU,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;YACnC,CAAC;QACH,CAAC;QAED,OAAO,IAAI,cAAc,CAAC;YACxB,GAAG,UAAU;YACb,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,cAAc;YAClC,IAAI,EAAE,IAAI;YACV,UAAU,EAAE,CAAC,CAA0B,EAAE,EAAE,CAAC,CAAC,CAAC,SAAmB;SAC3D,CAAC,CAAC;IACZ,CAAC","sourcesContent":["import {CompositeLayer, type Layer, type LayersList} from '@deck.gl/core';\nimport {H3HexagonLayer} from '@deck.gl/geo-layers';\nimport * as arrow from 'apache-arrow';\n\n/**\n * Custom GeoArrow-compatible H3HexagonLayer wrapper.\n *\n * GeoArrowH3HexagonLayer from @geoarrow/deck.gl-layers@0.3.2 is incompatible\n * with @deck.gl/geo-layers@9.3.x: the wrapper passes H3 indices via binary\n * attributes, but H3HexagonLayer internally iterates rows using createIterable\n * and calls getHexagon(object) expecting string H3 indices. This causes\n * \"Cannot read properties of undefined\" errors at runtime.\n *\n * This wrapper converts Arrow data to row objects with proper BigInt→hex string\n * conversion, then passes them to the native H3HexagonLayer.\n */\nexport class DeckH3HexagonLayer extends CompositeLayer<{\n data: arrow.Table;\n getHexagon: arrow.Vector;\n getFillColor?:\n | arrow.Vector\n | [number, number, number, number]\n | ((...args: any[]) => any);\n getElevation?: arrow.Vector | number | ((...args: any[]) => any);\n getLineColor?:\n | arrow.Vector\n | [number, number, number, number]\n | ((...args: any[]) => any);\n getLineWidth?: arrow.Vector | number | ((...args: any[]) => any);\n [key: string]: unknown;\n}> {\n static layerName = 'GeoArrowH3HexagonLayer';\n static defaultProps = {\n highPrecision: 'auto',\n coverage: {type: 'number', min: 0, max: 1, value: 1},\n extruded: true,\n };\n\n renderLayers(): Layer | LayersList | null {\n const {data: table, getHexagon: hexProp, ...otherProps} = this.props;\n\n if (!table || !hexProp) return null;\n\n const numRows = table.numRows;\n const isVector = hexProp instanceof arrow.Vector;\n const isBigIntColumn =\n isVector &&\n (hexProp.type instanceof arrow.Int64 ||\n hexProp.type instanceof arrow.Uint64);\n\n // Resolve hex value per row\n const getHexValue = (i: number): string => {\n if (isVector) {\n const raw = hexProp.get(i);\n if (isBigIntColumn && typeof raw === 'bigint') {\n return raw.toString(16);\n }\n return String(raw ?? '');\n }\n // Compiled accessor function\n if (typeof hexProp === 'function') {\n const result = (hexProp as (...args: unknown[]) => unknown)({\n index: i,\n data: {data: table.batches[0]},\n target: [],\n });\n if (typeof result === 'bigint') return result.toString(16);\n return String(result ?? '');\n }\n return '';\n };\n\n // Build row objects from Arrow table\n const rows: Record<string, unknown>[] = Array.from(\n {length: numRows},\n (_, i) => {\n const row: Record<string, unknown> = {};\n for (const field of table.schema.fields) {\n row[field.name] = table.getChild(field.name)?.get(i);\n }\n row.__h3Index = getHexValue(i);\n return row;\n },\n );\n\n // Resolve accessor props: Arrow Vectors → row functions, keep scalars\n const layerProps: Record<string, unknown> = {};\n for (const [propName, propValue] of Object.entries(otherProps)) {\n if (propValue instanceof arrow.Vector) {\n // Arrow Vector → row accessor (H3 layer uses row-based iteration)\n const vec = propValue;\n layerProps[propName] = (\n d: Record<string, unknown>,\n {index}: {index: number},\n ) => {\n return vec.get(index);\n };\n } else if (typeof propValue === 'function') {\n // Compiled GeoArrow accessor → wrap with batch context\n const fn = propValue;\n layerProps[propName] = (\n _object: unknown,\n objectInfo: {index: number; target?: number[]},\n ) => {\n return fn({\n index: objectInfo.index,\n data: {data: table.batches[0]},\n target: objectInfo.target,\n });\n };\n } else {\n layerProps[propName] = propValue;\n }\n }\n\n return new H3HexagonLayer({\n ...layerProps,\n id: `${this.props.id}-geoarrow-h3`,\n data: rows,\n getHexagon: (d: Record<string, unknown>) => d.__h3Index as string,\n } as any);\n }\n}\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { CompositeLayer, type Layer, type LayersList } from '@deck.gl/core';
|
|
2
|
+
import * as arrow from 'apache-arrow';
|
|
3
|
+
/**
|
|
4
|
+
* Custom GeoArrow-compatible TripsLayer wrapper.
|
|
5
|
+
*
|
|
6
|
+
* GeoArrowTripsLayer from @geoarrow/deck.gl-layers@0.3.2 is incompatible with
|
|
7
|
+
* deck.gl 9.3.x: it passes the raw timestamps typed array via binary attributes,
|
|
8
|
+
* but deck.gl 9.3's PathLayer/TripsLayer attribute manager fails to initialize
|
|
9
|
+
* them correctly, producing "Float64Array Error: Float64Array".
|
|
10
|
+
*
|
|
11
|
+
* This wrapper extracts the binary data from Arrow vectors and passes it to the
|
|
12
|
+
* native TripsLayer in a compatible format, properly resolving accessor props
|
|
13
|
+
* (Arrow Vectors → binary attributes, functions → wrapped with batch context).
|
|
14
|
+
*/
|
|
15
|
+
export declare class DeckTripsLayer extends CompositeLayer<{
|
|
16
|
+
data: arrow.Table;
|
|
17
|
+
getPath: arrow.Vector;
|
|
18
|
+
getTimestamps: arrow.Vector;
|
|
19
|
+
getColor?: arrow.Vector | [number, number, number, number] | ((...args: any[]) => any);
|
|
20
|
+
getWidth?: arrow.Vector | number | ((...args: any[]) => any);
|
|
21
|
+
currentTime?: number;
|
|
22
|
+
trailLength?: number;
|
|
23
|
+
fadeTrail?: boolean;
|
|
24
|
+
widthMinPixels?: number;
|
|
25
|
+
widthMaxPixels?: number;
|
|
26
|
+
opacity?: number;
|
|
27
|
+
_tripsMaxTimestamp?: number;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}> {
|
|
30
|
+
static layerName: string;
|
|
31
|
+
static defaultProps: {
|
|
32
|
+
currentTime: {
|
|
33
|
+
type: string;
|
|
34
|
+
value: number;
|
|
35
|
+
};
|
|
36
|
+
trailLength: {
|
|
37
|
+
type: string;
|
|
38
|
+
value: number;
|
|
39
|
+
};
|
|
40
|
+
fadeTrail: boolean;
|
|
41
|
+
_pathType: string;
|
|
42
|
+
};
|
|
43
|
+
renderLayers(): Layer | LayersList | null;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=DeckTripsLayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeckTripsLayer.d.ts","sourceRoot":"","sources":["../../../src/json/layers/DeckTripsLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,KAAK,KAAK,EAAE,KAAK,UAAU,EAAC,MAAM,eAAe,CAAC;AAE1E,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAsCtC;;;;;;;;;;;GAWG;AACH,qBAAa,cAAe,SAAQ,cAAc,CAAC;IACjD,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC;IAClB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC;IACtB,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC;IAC5B,QAAQ,CAAC,EACL,KAAK,CAAC,MAAM,GACZ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAChC,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;IACA,MAAM,CAAC,SAAS,SAAwB;IACxC,MAAM,CAAC,YAAY;;;;;;;;;;;MAKjB;IAEF,YAAY,IAAI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