@carto/kepler.gl 0.0.1-alpha.map-libre
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/CHANGELOG.md +939 -0
- package/LICENSE +19 -0
- package/README.md +63 -0
- package/actions.js +21 -0
- package/cloud-providers.js +21 -0
- package/components.js +21 -0
- package/constants.js +21 -0
- package/dist/actions/action-wrapper.js +218 -0
- package/dist/actions/actions.js +198 -0
- package/dist/actions/identity-actions.js +105 -0
- package/dist/actions/index.js +161 -0
- package/dist/actions/map-state-actions.js +112 -0
- package/dist/actions/map-style-actions.js +167 -0
- package/dist/actions/provider-actions.js +129 -0
- package/dist/actions/ui-state-actions.js +316 -0
- package/dist/actions/vis-state-actions.js +1045 -0
- package/dist/cloud-providers/index.js +22 -0
- package/dist/cloud-providers/provider.js +386 -0
- package/dist/components/bottom-widget.js +215 -0
- package/dist/components/common/action-panel.js +134 -0
- package/dist/components/common/animation-control/animation-control.js +126 -0
- package/dist/components/common/animation-control/animation-controller.js +273 -0
- package/dist/components/common/animation-control/animation-speed-slider.js +101 -0
- package/dist/components/common/animation-control/floating-time-display.js +157 -0
- package/dist/components/common/animation-control/playback-controls.js +278 -0
- package/dist/components/common/animation-control/speed-control.js +68 -0
- package/dist/components/common/checkbox.js +155 -0
- package/dist/components/common/color-legend.js +249 -0
- package/dist/components/common/data-table/button.js +46 -0
- package/dist/components/common/data-table/canvas.js +32 -0
- package/dist/components/common/data-table/cell-size.js +174 -0
- package/dist/components/common/data-table/grid.js +84 -0
- package/dist/components/common/data-table/index.js +514 -0
- package/dist/components/common/data-table/option-dropdown.js +103 -0
- package/dist/components/common/dataset-label.js +36 -0
- package/dist/components/common/error-boundary.js +83 -0
- package/dist/components/common/field-selector.js +282 -0
- package/dist/components/common/field-token.js +42 -0
- package/dist/components/common/file-uploader/file-drop.js +227 -0
- package/dist/components/common/file-uploader/file-upload-progress.js +102 -0
- package/dist/components/common/file-uploader/file-upload.js +304 -0
- package/dist/components/common/file-uploader/upload-button.js +111 -0
- package/dist/components/common/histogram-plot.js +102 -0
- package/dist/components/common/icons/add.js +64 -0
- package/dist/components/common/icons/anchor_window.js +62 -0
- package/dist/components/common/icons/arrow-down-alt.js +64 -0
- package/dist/components/common/icons/arrow-down-solid .js +64 -0
- package/dist/components/common/icons/arrow-down.js +64 -0
- package/dist/components/common/icons/arrow-left.js +67 -0
- package/dist/components/common/icons/arrow-right.js +64 -0
- package/dist/components/common/icons/arrow-up-alt.js +65 -0
- package/dist/components/common/icons/arrow-up-solid.js +64 -0
- package/dist/components/common/icons/arrow-up.js +64 -0
- package/dist/components/common/icons/base.js +110 -0
- package/dist/components/common/icons/bug.js +66 -0
- package/dist/components/common/icons/cancel.js +64 -0
- package/dist/components/common/icons/checkmark.js +71 -0
- package/dist/components/common/icons/chevron-right.js +69 -0
- package/dist/components/common/icons/clipboard.js +65 -0
- package/dist/components/common/icons/clock.js +66 -0
- package/dist/components/common/icons/close.js +69 -0
- package/dist/components/common/icons/code-alt.js +68 -0
- package/dist/components/common/icons/copy.js +70 -0
- package/dist/components/common/icons/crosshairs.js +68 -0
- package/dist/components/common/icons/cube-3d.js +68 -0
- package/dist/components/common/icons/cursor-click.js +68 -0
- package/dist/components/common/icons/data-table.js +65 -0
- package/dist/components/common/icons/db.js +65 -0
- package/dist/components/common/icons/delete.js +65 -0
- package/dist/components/common/icons/docs.js +80 -0
- package/dist/components/common/icons/drag-n-drop.js +66 -0
- package/dist/components/common/icons/draw-polygon.js +87 -0
- package/dist/components/common/icons/email.js +68 -0
- package/dist/components/common/icons/expand.js +66 -0
- package/dist/components/common/icons/eye-seen.js +66 -0
- package/dist/components/common/icons/eye-unseen.js +66 -0
- package/dist/components/common/icons/file-type.js +45 -0
- package/dist/components/common/icons/file.js +64 -0
- package/dist/components/common/icons/files.js +66 -0
- package/dist/components/common/icons/filter-funnel.js +64 -0
- package/dist/components/common/icons/free-window.js +62 -0
- package/dist/components/common/icons/gear.js +66 -0
- package/dist/components/common/icons/hash.js +64 -0
- package/dist/components/common/icons/histogram.js +64 -0
- package/dist/components/common/icons/index.js +612 -0
- package/dist/components/common/icons/info.js +78 -0
- package/dist/components/common/icons/layers.js +64 -0
- package/dist/components/common/icons/left-arrow.js +68 -0
- package/dist/components/common/icons/legend.js +64 -0
- package/dist/components/common/icons/line-chart.js +63 -0
- package/dist/components/common/icons/login.js +66 -0
- package/dist/components/common/icons/logout.js +65 -0
- package/dist/components/common/icons/map-icon.js +73 -0
- package/dist/components/common/icons/map.js +73 -0
- package/dist/components/common/icons/messages.js +64 -0
- package/dist/components/common/icons/minus.js +64 -0
- package/dist/components/common/icons/pause.js +64 -0
- package/dist/components/common/icons/picture.js +66 -0
- package/dist/components/common/icons/pin.js +64 -0
- package/dist/components/common/icons/play.js +64 -0
- package/dist/components/common/icons/polygon.js +89 -0
- package/dist/components/common/icons/rectangle.js +90 -0
- package/dist/components/common/icons/reduce.js +67 -0
- package/dist/components/common/icons/reset.js +64 -0
- package/dist/components/common/icons/rocket.js +64 -0
- package/dist/components/common/icons/save.js +66 -0
- package/dist/components/common/icons/save2.js +70 -0
- package/dist/components/common/icons/search.js +66 -0
- package/dist/components/common/icons/settings.js +66 -0
- package/dist/components/common/icons/share.js +64 -0
- package/dist/components/common/icons/split.js +92 -0
- package/dist/components/common/icons/square-select.js +66 -0
- package/dist/components/common/icons/swap-horizontal.js +68 -0
- package/dist/components/common/icons/table.js +63 -0
- package/dist/components/common/icons/trash.js +66 -0
- package/dist/components/common/icons/upload.js +65 -0
- package/dist/components/common/icons/vert-dots.js +102 -0
- package/dist/components/common/icons/vert-three-dots.js +77 -0
- package/dist/components/common/icons/warning.js +79 -0
- package/dist/components/common/image-preview.js +73 -0
- package/dist/components/common/info-helper.js +84 -0
- package/dist/components/common/item-selector/accessor.js +56 -0
- package/dist/components/common/item-selector/chickleted-input.js +118 -0
- package/dist/components/common/item-selector/dropdown-list.js +316 -0
- package/dist/components/common/item-selector/item-selector-submenu.js +99 -0
- package/dist/components/common/item-selector/item-selector.js +363 -0
- package/dist/components/common/item-selector/typeahead.js +496 -0
- package/dist/components/common/line-chart.js +125 -0
- package/dist/components/common/loading-spinner.js +58 -0
- package/dist/components/common/logo.js +92 -0
- package/dist/components/common/map-layer-selector.js +50 -0
- package/dist/components/common/modal.js +204 -0
- package/dist/components/common/portaled.js +317 -0
- package/dist/components/common/progress-bar.js +56 -0
- package/dist/components/common/range-brush.js +319 -0
- package/dist/components/common/range-plot.js +148 -0
- package/dist/components/common/range-slider.js +346 -0
- package/dist/components/common/slider/mouse-event.js +136 -0
- package/dist/components/common/slider/slider-bar-handle.js +122 -0
- package/dist/components/common/slider/slider-handle.js +167 -0
- package/dist/components/common/slider/slider.js +268 -0
- package/dist/components/common/styled-components.js +395 -0
- package/dist/components/common/switch.js +47 -0
- package/dist/components/common/time-range-slider-time-title.js +74 -0
- package/dist/components/common/time-range-slider.js +131 -0
- package/dist/components/common/time-slider-marker.js +141 -0
- package/dist/components/common/toolbar-item.js +67 -0
- package/dist/components/common/toolbar.js +33 -0
- package/dist/components/common/vertical-toolbar.js +22 -0
- package/dist/components/container.js +217 -0
- package/dist/components/context.js +42 -0
- package/dist/components/editor/constants.js +47 -0
- package/dist/components/editor/editor.js +274 -0
- package/dist/components/editor/feature-action-panel.js +154 -0
- package/dist/components/editor/feature-styles.js +72 -0
- package/dist/components/editor/handle-style.js +80 -0
- package/dist/components/filters/components.js +20 -0
- package/dist/components/filters/filter-panels/filter-panel-with-field-select.js +110 -0
- package/dist/components/filters/filter-panels/multi-select-filter-panel.js +80 -0
- package/dist/components/filters/filter-panels/new-filter-panel.js +101 -0
- package/dist/components/filters/filter-panels/polygon-filter-panel.js +102 -0
- package/dist/components/filters/filter-panels/range-filter-panel.js +80 -0
- package/dist/components/filters/filter-panels/single-select-filter-panel.js +80 -0
- package/dist/components/filters/filter-panels/time-range-filter-panel.js +92 -0
- package/dist/components/filters/index.js +48 -0
- package/dist/components/filters/multi-select-filter.js +54 -0
- package/dist/components/filters/polygon-filter.js +96 -0
- package/dist/components/filters/range-filter.js +53 -0
- package/dist/components/filters/single-select-filter.js +63 -0
- package/dist/components/filters/time-range-filter.js +86 -0
- package/dist/components/filters/time-widget.js +173 -0
- package/dist/components/geocoder/geocoder.js +315 -0
- package/dist/components/geocoder-panel.js +224 -0
- package/dist/components/index.js +1485 -0
- package/dist/components/injector.js +178 -0
- package/dist/components/kepler-gl.js +563 -0
- package/dist/components/map/coordinate-info.js +68 -0
- package/dist/components/map/layer-hover-info.js +176 -0
- package/dist/components/map/layer-selector-panel.js +116 -0
- package/dist/components/map/locale-panel.js +113 -0
- package/dist/components/map/map-control-panel.js +79 -0
- package/dist/components/map/map-control-toolbar.js +25 -0
- package/dist/components/map/map-control-tooltip.js +55 -0
- package/dist/components/map/map-control.js +80 -0
- package/dist/components/map/map-draw-panel.js +142 -0
- package/dist/components/map/map-legend-panel.js +124 -0
- package/dist/components/map/map-legend.js +244 -0
- package/dist/components/map/map-popover.js +204 -0
- package/dist/components/map/split-map-button.js +98 -0
- package/dist/components/map/toggle-3d-button.js +86 -0
- package/dist/components/map-container.js +562 -0
- package/dist/components/maps-layout.js +58 -0
- package/dist/components/modal-container.js +536 -0
- package/dist/components/modals/add-map-style-modal.js +288 -0
- package/dist/components/modals/cloud-tile.js +124 -0
- package/dist/components/modals/data-table-modal.js +249 -0
- package/dist/components/modals/delete-data-modal.js +54 -0
- package/dist/components/modals/error-display.js +51 -0
- package/dist/components/modals/export-data-modal.js +227 -0
- package/dist/components/modals/export-image-modal.js +136 -0
- package/dist/components/modals/export-map-modal/components.js +51 -0
- package/dist/components/modals/export-map-modal/export-html-map.js +141 -0
- package/dist/components/modals/export-map-modal/export-json-map.js +87 -0
- package/dist/components/modals/export-map-modal/export-map-modal.js +133 -0
- package/dist/components/modals/image-modal-container.js +90 -0
- package/dist/components/modals/load-data-modal.js +97 -0
- package/dist/components/modals/load-storage-map.js +288 -0
- package/dist/components/modals/loading-dialog.js +48 -0
- package/dist/components/modals/modal-dialog.js +37 -0
- package/dist/components/modals/modal-tabs.js +99 -0
- package/dist/components/modals/overwrite-map-modal.js +80 -0
- package/dist/components/modals/provider-modal-container.js +84 -0
- package/dist/components/modals/save-map-modal.js +207 -0
- package/dist/components/modals/share-map-modal.js +202 -0
- package/dist/components/modals/status-panel.js +83 -0
- package/dist/components/modals/storage-map-viewer.js +135 -0
- package/dist/components/notification-panel/notification-item.js +164 -0
- package/dist/components/notification-panel.js +87 -0
- package/dist/components/performance.js +134 -0
- package/dist/components/plot-container.js +275 -0
- package/dist/components/side-panel/cloud-storage-dropdown.js +63 -0
- package/dist/components/side-panel/common/dataset-info.js +43 -0
- package/dist/components/side-panel/common/dataset-tag.js +42 -0
- package/dist/components/side-panel/common/dataset-title.js +170 -0
- package/dist/components/side-panel/common/source-data-catalog.js +60 -0
- package/dist/components/side-panel/common/source-data-selector.js +120 -0
- package/dist/components/side-panel/custom-panel.js +60 -0
- package/dist/components/side-panel/filter-manager.js +132 -0
- package/dist/components/side-panel/filter-panel/filter-panel-header.js +70 -0
- package/dist/components/side-panel/filter-panel/filter-panel.js +145 -0
- package/dist/components/side-panel/interaction-manager.js +58 -0
- package/dist/components/side-panel/interaction-panel/brush-config.js +54 -0
- package/dist/components/side-panel/interaction-panel/interaction-panel.js +168 -0
- package/dist/components/side-panel/interaction-panel/tooltip-config/tooltip-chicklet.js +250 -0
- package/dist/components/side-panel/interaction-panel/tooltip-config.js +163 -0
- package/dist/components/side-panel/layer-manager.js +321 -0
- package/dist/components/side-panel/layer-panel/color-dimension-scale-selector.js +45 -0
- package/dist/components/side-panel/layer-panel/color-palette.js +83 -0
- package/dist/components/side-panel/layer-panel/color-range-selector.js +370 -0
- package/dist/components/side-panel/layer-panel/color-selector.js +226 -0
- package/dist/components/side-panel/layer-panel/column-selector.js +65 -0
- package/dist/components/side-panel/layer-panel/custom-markers-config-group.js +40 -0
- package/dist/components/side-panel/layer-panel/custom-palette.js +318 -0
- package/dist/components/side-panel/layer-panel/custom-picker.js +128 -0
- package/dist/components/side-panel/layer-panel/dimension-scale-selector.js +61 -0
- package/dist/components/side-panel/layer-panel/layer-aggregation-resolution.js +26 -0
- package/dist/components/side-panel/layer-panel/layer-column-config.js +93 -0
- package/dist/components/side-panel/layer-panel/layer-config-group.js +245 -0
- package/dist/components/side-panel/layer-panel/layer-configurator.js +977 -0
- package/dist/components/side-panel/layer-panel/layer-panel-header.js +222 -0
- package/dist/components/side-panel/layer-panel/layer-panel.js +201 -0
- package/dist/components/side-panel/layer-panel/layer-type-dropdown-list.js +89 -0
- package/dist/components/side-panel/layer-panel/layer-type-list-item.js +71 -0
- package/dist/components/side-panel/layer-panel/layer-type-selector.js +96 -0
- package/dist/components/side-panel/layer-panel/layer-visibility-by-zoom.js +111 -0
- package/dist/components/side-panel/layer-panel/single-color-palette.js +109 -0
- package/dist/components/side-panel/layer-panel/text-label-panel.js +175 -0
- package/dist/components/side-panel/layer-panel/vis-config-by-field-selector.js +174 -0
- package/dist/components/side-panel/layer-panel/vis-config-slider.js +90 -0
- package/dist/components/side-panel/layer-panel/vis-config-switch.js +84 -0
- package/dist/components/side-panel/map-manager.js +155 -0
- package/dist/components/side-panel/map-style-panel/map-layer-selector.js +106 -0
- package/dist/components/side-panel/map-style-panel/map-style-selector.js +78 -0
- package/dist/components/side-panel/panel-dropdown.js +86 -0
- package/dist/components/side-panel/panel-header-action.js +121 -0
- package/dist/components/side-panel/panel-header.js +351 -0
- package/dist/components/side-panel/panel-tab.js +68 -0
- package/dist/components/side-panel/panel-title.js +28 -0
- package/dist/components/side-panel/panel-toggle.js +69 -0
- package/dist/components/side-panel/side-bar.js +164 -0
- package/dist/components/side-panel.js +242 -0
- package/dist/connect/keplergl-connect.js +68 -0
- package/dist/connect/with-local-selector.js +110 -0
- package/dist/constants/action-types.js +180 -0
- package/dist/constants/color-palette.js +547 -0
- package/dist/constants/color-ranges.js +70 -0
- package/dist/constants/custom-color-ranges.js +415 -0
- package/dist/constants/default-settings.js +902 -0
- package/dist/constants/index.js +370 -0
- package/dist/constants/keyevent.js +47 -0
- package/dist/constants/tooltip.js +205 -0
- package/dist/constants/user-feedbacks.js +33 -0
- package/dist/constants/user-guides.js +44 -0
- package/dist/deckgl-layers/3d-building-layer/3d-building-layer.js +88 -0
- package/dist/deckgl-layers/3d-building-layer/3d-building-utils.js +214 -0
- package/dist/deckgl-layers/cluster-layer/cluster-layer.js +334 -0
- package/dist/deckgl-layers/column-layer/enhanced-column-layer.js +78 -0
- package/dist/deckgl-layers/grid-layer/enhanced-cpu-grid-layer.js +96 -0
- package/dist/deckgl-layers/hexagon-layer/enhanced-hexagon-layer.js +96 -0
- package/dist/deckgl-layers/layer-utils/cluster-utils.js +119 -0
- package/dist/deckgl-layers/layer-utils/cpu-aggregator.js +643 -0
- package/dist/deckgl-layers/layer-utils/shader-utils.js +50 -0
- package/dist/deckgl-layers/line-layer/line-layer.js +111 -0
- package/dist/deckgl-layers/svg-icon-layer/scatterplot-icon-layer.js +78 -0
- package/dist/deckgl-layers/svg-icon-layer/svg-icon-layer.js +120 -0
- package/dist/index.js +155 -0
- package/dist/layers/aggregation-layer.js +416 -0
- package/dist/layers/arc-layer/arc-layer-icon.js +77 -0
- package/dist/layers/arc-layer/arc-layer.js +275 -0
- package/dist/layers/base-layer.js +1688 -0
- package/dist/layers/cluster-layer/cluster-layer-icon.js +80 -0
- package/dist/layers/cluster-layer/cluster-layer.js +151 -0
- package/dist/layers/default-layer-icon.js +87 -0
- package/dist/layers/geojson-layer/geojson-layer-icon.js +91 -0
- package/dist/layers/geojson-layer/geojson-layer.js +446 -0
- package/dist/layers/geojson-layer/geojson-utils.js +183 -0
- package/dist/layers/grid-layer/grid-layer-icon.js +136 -0
- package/dist/layers/grid-layer/grid-layer.js +115 -0
- package/dist/layers/grid-layer/grid-utils.js +62 -0
- package/dist/layers/h3-hexagon-layer/h3-hexagon-layer-icon.js +71 -0
- package/dist/layers/h3-hexagon-layer/h3-hexagon-layer.js +346 -0
- package/dist/layers/h3-hexagon-layer/h3-utils.js +97 -0
- package/dist/layers/heatmap-layer/heatmap-layer-icon.js +88 -0
- package/dist/layers/heatmap-layer/heatmap-layer.js +269 -0
- package/dist/layers/hexagon-layer/hexagon-layer-icon.js +100 -0
- package/dist/layers/hexagon-layer/hexagon-layer.js +120 -0
- package/dist/layers/hexagon-layer/hexagon-utils.js +74 -0
- package/dist/layers/icon-layer/icon-info-modal.js +117 -0
- package/dist/layers/icon-layer/icon-layer-icon.js +73 -0
- package/dist/layers/icon-layer/icon-layer.js +392 -0
- package/dist/layers/index.js +97 -0
- package/dist/layers/layer-factory.js +499 -0
- package/dist/layers/layer-text-label.js +72 -0
- package/dist/layers/layer-update.js +85 -0
- package/dist/layers/line-layer/line-layer-icon.js +79 -0
- package/dist/layers/line-layer/line-layer.js +209 -0
- package/dist/layers/mapbox-utils.js +204 -0
- package/dist/layers/mapboxgl-layer.js +210 -0
- package/dist/layers/point-layer/point-layer-icon.js +94 -0
- package/dist/layers/point-layer/point-layer.js +475 -0
- package/dist/layers/s2-geometry-layer/s2-geometry-layer.js +334 -0
- package/dist/layers/s2-geometry-layer/s2-layer-icon.js +70 -0
- package/dist/layers/s2-geometry-layer/s2-utils.js +51 -0
- package/dist/layers/scenegraph-layer/scenegraph-info-modal.js +48 -0
- package/dist/layers/scenegraph-layer/scenegraph-layer-icon.js +151 -0
- package/dist/layers/scenegraph-layer/scenegraph-layer.js +250 -0
- package/dist/layers/trip-layer/trip-info-modal.js +54 -0
- package/dist/layers/trip-layer/trip-layer-icon.js +89 -0
- package/dist/layers/trip-layer/trip-layer.js +403 -0
- package/dist/layers/trip-layer/trip-utils.js +204 -0
- package/dist/layers/types.js +47 -0
- package/dist/localization/en.js +480 -0
- package/dist/localization/formatted-message.js +45 -0
- package/dist/localization/index.js +60 -0
- package/dist/localization/locales.js +64 -0
- package/dist/middleware/index.js +47 -0
- package/dist/processors/data-processor.js +784 -0
- package/dist/processors/file-handler.js +432 -0
- package/dist/processors/index.js +106 -0
- package/dist/reducers/combined-updaters.js +195 -0
- package/dist/reducers/composer-helpers.js +110 -0
- package/dist/reducers/composers.js +27 -0
- package/dist/reducers/core.js +156 -0
- package/dist/reducers/index.js +139 -0
- package/dist/reducers/map-state-updaters.js +239 -0
- package/dist/reducers/map-state.js +47 -0
- package/dist/reducers/map-style-updaters.js +531 -0
- package/dist/reducers/map-style.js +46 -0
- package/dist/reducers/provider-state-updaters.js +541 -0
- package/dist/reducers/provider-state.js +46 -0
- package/dist/reducers/root.js +218 -0
- package/dist/reducers/ui-state-updaters.js +855 -0
- package/dist/reducers/ui-state.js +47 -0
- package/dist/reducers/vis-state-merger.js +615 -0
- package/dist/reducers/vis-state-selectors.js +52 -0
- package/dist/reducers/vis-state-updaters.js +2433 -0
- package/dist/reducers/vis-state.js +46 -0
- package/dist/schemas/dataset-schema.js +189 -0
- package/dist/schemas/index.js +132 -0
- package/dist/schemas/map-state-schema.js +49 -0
- package/dist/schemas/map-style-schema.js +122 -0
- package/dist/schemas/schema-manager.js +262 -0
- package/dist/schemas/schema-utils.js +62 -0
- package/dist/schemas/schema.js +114 -0
- package/dist/schemas/versions.js +38 -0
- package/dist/schemas/vis-state-schema.js +1071 -0
- package/dist/styles/base.js +1570 -0
- package/dist/styles/index.js +32 -0
- package/dist/styles/media-breakpoints.js +39 -0
- package/dist/tasks/tasks.js +122 -0
- package/dist/templates/export-map-html.js +45 -0
- package/dist/utils/aggregate-utils.js +75 -0
- package/dist/utils/color-utils.js +135 -0
- package/dist/utils/data-scale-utils.js +84 -0
- package/dist/utils/data-utils.js +491 -0
- package/dist/utils/dataset-utils.js +254 -0
- package/dist/utils/dom-to-image.js +557 -0
- package/dist/utils/dom-utils.js +425 -0
- package/dist/utils/export-utils.js +297 -0
- package/dist/utils/filter-utils.js +1286 -0
- package/dist/utils/gl-utils.js +35 -0
- package/dist/utils/gpu-filter-utils.js +261 -0
- package/dist/utils/index.js +226 -0
- package/dist/utils/interaction-utils.js +201 -0
- package/dist/utils/layer-utils.js +205 -0
- package/dist/utils/locale-utils.js +54 -0
- package/dist/utils/map-info-utils.js +32 -0
- package/dist/utils/map-style-utils/mapbox-gl-style-editor.js +212 -0
- package/dist/utils/map-style-utils/mapbox-utils.js +35 -0
- package/dist/utils/mapbox-utils.js +39 -0
- package/dist/utils/notifications-utils.js +89 -0
- package/dist/utils/observe-dimensions.js +147 -0
- package/dist/utils/projection-utils.js +83 -0
- package/dist/utils/searcher-utils.js +45 -0
- package/dist/utils/split-map-utils.js +108 -0
- package/dist/utils/table-utils/data-container-utils.js +69 -0
- package/dist/utils/table-utils/data-row.js +82 -0
- package/dist/utils/table-utils/index.js +20 -0
- package/dist/utils/table-utils/indexed-data-container.js +241 -0
- package/dist/utils/table-utils/kepler-table.js +544 -0
- package/dist/utils/table-utils/row-data-container.js +242 -0
- package/dist/utils/utils.js +234 -0
- package/layers.js +21 -0
- package/localization.js +21 -0
- package/middleware.js +21 -0
- package/package.json +281 -0
- package/processors.js +21 -0
- package/reducers.js +21 -0
- package/schemas.js +21 -0
- package/src/actions/action-wrapper.js +183 -0
- package/src/actions/actions.d.ts +104 -0
- package/src/actions/actions.js +178 -0
- package/src/actions/identity-actions.d.ts +53 -0
- package/src/actions/identity-actions.js +83 -0
- package/src/actions/index.d.ts +23 -0
- package/src/actions/index.js +42 -0
- package/src/actions/map-state-actions.d.ts +46 -0
- package/src/actions/map-state-actions.js +90 -0
- package/src/actions/map-style-actions.d.ts +116 -0
- package/src/actions/map-style-actions.js +135 -0
- package/src/actions/provider-actions.d.ts +203 -0
- package/src/actions/provider-actions.js +94 -0
- package/src/actions/ui-state-actions.d.ts +200 -0
- package/src/actions/ui-state-actions.js +272 -0
- package/src/actions/vis-state-actions.d.ts +502 -0
- package/src/actions/vis-state-actions.js +919 -0
- package/src/cloud-providers/index.d.ts +53 -0
- package/src/cloud-providers/index.js +21 -0
- package/src/cloud-providers/provider.js +233 -0
- package/src/components/bottom-widget.d.ts +33 -0
- package/src/components/bottom-widget.js +235 -0
- package/src/components/common/action-panel.d.ts +24 -0
- package/src/components/common/action-panel.js +177 -0
- package/src/components/common/animation-control/animation-control.js +155 -0
- package/src/components/common/animation-control/animation-controller.js +224 -0
- package/src/components/common/animation-control/animation-speed-slider.js +79 -0
- package/src/components/common/animation-control/floating-time-display.js +192 -0
- package/src/components/common/animation-control/playback-controls.js +278 -0
- package/src/components/common/animation-control/speed-control.js +71 -0
- package/src/components/common/checkbox.js +128 -0
- package/src/components/common/color-legend.js +198 -0
- package/src/components/common/data-table/button.js +47 -0
- package/src/components/common/data-table/canvas.js +43 -0
- package/src/components/common/data-table/cell-size.js +180 -0
- package/src/components/common/data-table/grid.js +55 -0
- package/src/components/common/data-table/index.js +620 -0
- package/src/components/common/data-table/option-dropdown.js +110 -0
- package/src/components/common/dataset-label.js +40 -0
- package/src/components/common/error-boundary.js +43 -0
- package/src/components/common/field-selector.js +233 -0
- package/src/components/common/field-token.js +56 -0
- package/src/components/common/file-uploader/file-drop.d.ts +19 -0
- package/src/components/common/file-uploader/file-drop.js +196 -0
- package/src/components/common/file-uploader/file-upload-progress.d.ts +11 -0
- package/src/components/common/file-uploader/file-upload-progress.js +110 -0
- package/src/components/common/file-uploader/file-upload.d.ts +22 -0
- package/src/components/common/file-uploader/file-upload.js +301 -0
- package/src/components/common/file-uploader/upload-button.d.ts.wip +11 -0
- package/src/components/common/file-uploader/upload-button.js +83 -0
- package/src/components/common/histogram-plot.js +102 -0
- package/src/components/common/icons/add.js +43 -0
- package/src/components/common/icons/anchor_window.js +53 -0
- package/src/components/common/icons/arrow-down-alt.js +43 -0
- package/src/components/common/icons/arrow-down-solid .js +43 -0
- package/src/components/common/icons/arrow-down.js +46 -0
- package/src/components/common/icons/arrow-left.js +48 -0
- package/src/components/common/icons/arrow-right.js +46 -0
- package/src/components/common/icons/arrow-up-alt.js +46 -0
- package/src/components/common/icons/arrow-up-solid.js +43 -0
- package/src/components/common/icons/arrow-up.js +46 -0
- package/src/components/common/icons/base.js +90 -0
- package/src/components/common/icons/bug.js +46 -0
- package/src/components/common/icons/cancel.js +43 -0
- package/src/components/common/icons/checkmark.js +45 -0
- package/src/components/common/icons/chevron-right.js +47 -0
- package/src/components/common/icons/clipboard.js +46 -0
- package/src/components/common/icons/clock.js +44 -0
- package/src/components/common/icons/close.js +49 -0
- package/src/components/common/icons/code-alt.js +43 -0
- package/src/components/common/icons/copy.js +44 -0
- package/src/components/common/icons/crosshairs.js +43 -0
- package/src/components/common/icons/cube-3d.js +45 -0
- package/src/components/common/icons/cursor-click.js +49 -0
- package/src/components/common/icons/data-table.js +45 -0
- package/src/components/common/icons/db.js +45 -0
- package/src/components/common/icons/delete.js +44 -0
- package/src/components/common/icons/docs.js +46 -0
- package/src/components/common/icons/drag-n-drop.js +44 -0
- package/src/components/common/icons/draw-polygon.js +60 -0
- package/src/components/common/icons/email.js +45 -0
- package/src/components/common/icons/expand.js +45 -0
- package/src/components/common/icons/eye-seen.js +44 -0
- package/src/components/common/icons/eye-unseen.js +44 -0
- package/src/components/common/icons/file-type.js +57 -0
- package/src/components/common/icons/file.js +43 -0
- package/src/components/common/icons/files.js +42 -0
- package/src/components/common/icons/filter-funnel.js +43 -0
- package/src/components/common/icons/free-window.js +53 -0
- package/src/components/common/icons/gear.js +45 -0
- package/src/components/common/icons/hash.js +43 -0
- package/src/components/common/icons/histogram.js +47 -0
- package/src/components/common/icons/index.js +96 -0
- package/src/components/common/icons/info.js +54 -0
- package/src/components/common/icons/layers.js +43 -0
- package/src/components/common/icons/left-arrow.js +43 -0
- package/src/components/common/icons/legend.js +43 -0
- package/src/components/common/icons/line-chart.js +45 -0
- package/src/components/common/icons/login.js +46 -0
- package/src/components/common/icons/logout.js +43 -0
- package/src/components/common/icons/map-icon.js +69 -0
- package/src/components/common/icons/map.js +69 -0
- package/src/components/common/icons/messages.js +43 -0
- package/src/components/common/icons/minus.js +45 -0
- package/src/components/common/icons/pause.js +43 -0
- package/src/components/common/icons/picture.js +43 -0
- package/src/components/common/icons/pin.js +43 -0
- package/src/components/common/icons/play.js +43 -0
- package/src/components/common/icons/polygon.js +74 -0
- package/src/components/common/icons/rectangle.js +75 -0
- package/src/components/common/icons/reduce.js +48 -0
- package/src/components/common/icons/reset.js +43 -0
- package/src/components/common/icons/rocket.js +43 -0
- package/src/components/common/icons/save.js +44 -0
- package/src/components/common/icons/save2.js +47 -0
- package/src/components/common/icons/search.js +44 -0
- package/src/components/common/icons/settings.js +45 -0
- package/src/components/common/icons/share.js +43 -0
- package/src/components/common/icons/split.js +63 -0
- package/src/components/common/icons/square-select.js +44 -0
- package/src/components/common/icons/swap-horizontal.js +43 -0
- package/src/components/common/icons/table.js +46 -0
- package/src/components/common/icons/trash.js +51 -0
- package/src/components/common/icons/upload.js +44 -0
- package/src/components/common/icons/vert-dots.js +50 -0
- package/src/components/common/icons/vert-three-dots.js +45 -0
- package/src/components/common/icons/warning.js +46 -0
- package/src/components/common/image-preview.js +111 -0
- package/src/components/common/info-helper.js +84 -0
- package/src/components/common/item-selector/accessor.js +45 -0
- package/src/components/common/item-selector/chickleted-input.js +143 -0
- package/src/components/common/item-selector/dropdown-list.js +250 -0
- package/src/components/common/item-selector/item-selector-submenu.js +68 -0
- package/src/components/common/item-selector/item-selector.d.ts +34 -0
- package/src/components/common/item-selector/item-selector.js +360 -0
- package/src/components/common/item-selector/typeahead.js +507 -0
- package/src/components/common/line-chart.js +134 -0
- package/src/components/common/loading-spinner.js +64 -0
- package/src/components/common/logo.js +92 -0
- package/src/components/common/map-layer-selector.d.ts +10 -0
- package/src/components/common/map-layer-selector.js +54 -0
- package/src/components/common/modal.js +233 -0
- package/src/components/common/portaled.js +264 -0
- package/src/components/common/progress-bar.d.ts +13 -0
- package/src/components/common/progress-bar.js +49 -0
- package/src/components/common/range-brush.js +256 -0
- package/src/components/common/range-plot.js +139 -0
- package/src/components/common/range-slider.js +299 -0
- package/src/components/common/slider/mouse-event.js +97 -0
- package/src/components/common/slider/slider-bar-handle.js +97 -0
- package/src/components/common/slider/slider-handle.js +181 -0
- package/src/components/common/slider/slider.js +213 -0
- package/src/components/common/styled-components.js +657 -0
- package/src/components/common/switch.js +50 -0
- package/src/components/common/time-range-slider-time-title.js +76 -0
- package/src/components/common/time-range-slider.js +163 -0
- package/src/components/common/time-slider-marker.js +168 -0
- package/src/components/common/toolbar-item.d.ts +14 -0
- package/src/components/common/toolbar-item.js +83 -0
- package/src/components/common/toolbar.js +45 -0
- package/src/components/common/vertical-toolbar.js +35 -0
- package/src/components/container.js +173 -0
- package/src/components/context.d.ts +10 -0
- package/src/components/context.js +32 -0
- package/src/components/editor/constants.js +39 -0
- package/src/components/editor/editor.js +218 -0
- package/src/components/editor/feature-action-panel.js +143 -0
- package/src/components/editor/feature-styles.js +75 -0
- package/src/components/editor/handle-style.js +89 -0
- package/src/components/filters/components.js +28 -0
- package/src/components/filters/filter-panels/filter-panel-types.d.ts +28 -0
- package/src/components/filters/filter-panels/filter-panel-with-field-select.js +124 -0
- package/src/components/filters/filter-panels/multi-select-filter-panel.js +75 -0
- package/src/components/filters/filter-panels/new-filter-panel.js +99 -0
- package/src/components/filters/filter-panels/polygon-filter-panel.js +96 -0
- package/src/components/filters/filter-panels/range-filter-panel.js +75 -0
- package/src/components/filters/filter-panels/single-select-filter-panel.js +75 -0
- package/src/components/filters/filter-panels/time-range-filter-panel.js +95 -0
- package/src/components/filters/index.js +25 -0
- package/src/components/filters/multi-select-filter.js +36 -0
- package/src/components/filters/polygon-filter.d.ts +13 -0
- package/src/components/filters/polygon-filter.js +73 -0
- package/src/components/filters/range-filter.js +43 -0
- package/src/components/filters/single-select-filter.js +49 -0
- package/src/components/filters/time-range-filter.js +68 -0
- package/src/components/filters/time-widget.js +228 -0
- package/src/components/geocoder/geocoder.d.ts +33 -0
- package/src/components/geocoder/geocoder.js +272 -0
- package/src/components/geocoder-panel.js +191 -0
- package/src/components/index.js +247 -0
- package/src/components/injector.js +161 -0
- package/src/components/kepler-gl.d.ts +60 -0
- package/src/components/kepler-gl.js +525 -0
- package/src/components/map/coordinate-info.js +53 -0
- package/src/components/map/layer-hover-info.d.ts +12 -0
- package/src/components/map/layer-hover-info.js +185 -0
- package/src/components/map/layer-selector-panel.d.ts +16 -0
- package/src/components/map/layer-selector-panel.js +106 -0
- package/src/components/map/locale-panel.d.ts +12 -0
- package/src/components/map/locale-panel.js +91 -0
- package/src/components/map/map-control-panel.d.ts +11 -0
- package/src/components/map/map-control-panel.js +98 -0
- package/src/components/map/map-control-toolbar.js +33 -0
- package/src/components/map/map-control-tooltip.d.ts +8 -0
- package/src/components/map/map-control-tooltip.js +40 -0
- package/src/components/map/map-control.d.ts +37 -0
- package/src/components/map/map-control.js +100 -0
- package/src/components/map/map-draw-panel.d.ts +16 -0
- package/src/components/map/map-draw-panel.js +125 -0
- package/src/components/map/map-legend-panel.d.ts +20 -0
- package/src/components/map/map-legend-panel.js +100 -0
- package/src/components/map/map-legend.d.ts +58 -0
- package/src/components/map/map-legend.js +228 -0
- package/src/components/map/map-popover.d.ts +28 -0
- package/src/components/map/map-popover.js +250 -0
- package/src/components/map/split-map-button.d.ts +19 -0
- package/src/components/map/split-map-button.js +82 -0
- package/src/components/map/toggle-3d-button.d.ts +16 -0
- package/src/components/map/toggle-3d-button.js +75 -0
- package/src/components/map-container.d.ts +18 -0
- package/src/components/map-container.js +502 -0
- package/src/components/maps-layout.d.ts +5 -0
- package/src/components/maps-layout.js +40 -0
- package/src/components/modal-container.d.ts +38 -0
- package/src/components/modal-container.js +545 -0
- package/src/components/modals/add-map-style-modal.js +301 -0
- package/src/components/modals/cloud-tile.js +147 -0
- package/src/components/modals/data-table-modal.js +217 -0
- package/src/components/modals/delete-data-modal.js +48 -0
- package/src/components/modals/error-display.js +39 -0
- package/src/components/modals/export-data-modal.js +193 -0
- package/src/components/modals/export-image-modal.d.ts +21 -0
- package/src/components/modals/export-image-modal.js +144 -0
- package/src/components/modals/export-map-modal/components.js +42 -0
- package/src/components/modals/export-map-modal/export-html-map.d.ts +21 -0
- package/src/components/modals/export-map-modal/export-html-map.js +145 -0
- package/src/components/modals/export-map-modal/export-json-map.js +100 -0
- package/src/components/modals/export-map-modal/export-map-modal.js +114 -0
- package/src/components/modals/image-modal-container.d.ts +13 -0
- package/src/components/modals/image-modal-container.js +76 -0
- package/src/components/modals/load-data-modal.d.ts +30 -0
- package/src/components/modals/load-data-modal.js +94 -0
- package/src/components/modals/load-storage-map.js +381 -0
- package/src/components/modals/loading-dialog.js +69 -0
- package/src/components/modals/modal-dialog.js +25 -0
- package/src/components/modals/modal-tabs.js +126 -0
- package/src/components/modals/overwrite-map-modal.d.ts +18 -0
- package/src/components/modals/overwrite-map-modal.js +97 -0
- package/src/components/modals/provider-modal-container.d.ts +12 -0
- package/src/components/modals/provider-modal-container.js +60 -0
- package/src/components/modals/save-map-modal.d.ts +32 -0
- package/src/components/modals/save-map-modal.js +244 -0
- package/src/components/modals/share-map-modal.js +208 -0
- package/src/components/modals/status-panel.js +95 -0
- package/src/components/modals/storage-map-viewer.js +177 -0
- package/src/components/notification-panel/notification-item.js +132 -0
- package/src/components/notification-panel.js +72 -0
- package/src/components/performance.js +103 -0
- package/src/components/plot-container.js +228 -0
- package/src/components/side-panel/cloud-storage-dropdown.js +52 -0
- package/src/components/side-panel/common/dataset-info.js +45 -0
- package/src/components/side-panel/common/dataset-tag.js +55 -0
- package/src/components/side-panel/common/dataset-title.js +146 -0
- package/src/components/side-panel/common/source-data-catalog.js +61 -0
- package/src/components/side-panel/common/source-data-selector.js +79 -0
- package/src/components/side-panel/custom-panel.js +50 -0
- package/src/components/side-panel/filter-manager.js +105 -0
- package/src/components/side-panel/filter-panel/filter-panel-header.js +83 -0
- package/src/components/side-panel/filter-panel/filter-panel.js +126 -0
- package/src/components/side-panel/interaction-manager.js +46 -0
- package/src/components/side-panel/interaction-panel/brush-config.js +51 -0
- package/src/components/side-panel/interaction-panel/interaction-panel.js +115 -0
- package/src/components/side-panel/interaction-panel/tooltip-config/tooltip-chicklet.js +199 -0
- package/src/components/side-panel/interaction-panel/tooltip-config.js +190 -0
- package/src/components/side-panel/layer-manager.js +290 -0
- package/src/components/side-panel/layer-panel/color-dimension-scale-selector.js +33 -0
- package/src/components/side-panel/layer-panel/color-palette.js +90 -0
- package/src/components/side-panel/layer-panel/color-range-selector.js +322 -0
- package/src/components/side-panel/layer-panel/color-selector.js +193 -0
- package/src/components/side-panel/layer-panel/column-selector.js +70 -0
- package/src/components/side-panel/layer-panel/custom-markers-config-group.js +30 -0
- package/src/components/side-panel/layer-panel/custom-palette.js +296 -0
- package/src/components/side-panel/layer-panel/custom-picker.js +88 -0
- package/src/components/side-panel/layer-panel/dimension-scale-selector.js +48 -0
- package/src/components/side-panel/layer-panel/layer-aggregation-resolution.js +13 -0
- package/src/components/side-panel/layer-panel/layer-column-config.js +113 -0
- package/src/components/side-panel/layer-panel/layer-config-group.js +237 -0
- package/src/components/side-panel/layer-panel/layer-configurator.js +1317 -0
- package/src/components/side-panel/layer-panel/layer-panel-header.js +236 -0
- package/src/components/side-panel/layer-panel/layer-panel.js +171 -0
- package/src/components/side-panel/layer-panel/layer-type-dropdown-list.js +105 -0
- package/src/components/side-panel/layer-panel/layer-type-list-item.js +83 -0
- package/src/components/side-panel/layer-panel/layer-type-selector.js +89 -0
- package/src/components/side-panel/layer-panel/layer-visibility-by-zoom.js +123 -0
- package/src/components/side-panel/layer-panel/single-color-palette.js +98 -0
- package/src/components/side-panel/layer-panel/text-label-panel.js +179 -0
- package/src/components/side-panel/layer-panel/vis-config-by-field-selector.js +163 -0
- package/src/components/side-panel/layer-panel/vis-config-slider.js +82 -0
- package/src/components/side-panel/layer-panel/vis-config-switch.js +87 -0
- package/src/components/side-panel/map-manager.js +114 -0
- package/src/components/side-panel/map-style-panel/map-layer-selector.js +128 -0
- package/src/components/side-panel/map-style-panel/map-style-selector.js +111 -0
- package/src/components/side-panel/panel-dropdown.js +53 -0
- package/src/components/side-panel/panel-header-action.js +106 -0
- package/src/components/side-panel/panel-header.js +321 -0
- package/src/components/side-panel/panel-tab.js +62 -0
- package/src/components/side-panel/panel-title.js +32 -0
- package/src/components/side-panel/panel-toggle.js +70 -0
- package/src/components/side-panel/side-bar.js +136 -0
- package/src/components/side-panel.d.ts +33 -0
- package/src/components/side-panel.js +253 -0
- package/src/connect/keplergl-connect.js +47 -0
- package/src/connect/with-local-selector.d.ts +11 -0
- package/src/connect/with-local-selector.js +67 -0
- package/src/constants/action-types.d.ts +135 -0
- package/src/constants/action-types.js +184 -0
- package/src/constants/color-palette.js +553 -0
- package/src/constants/color-ranges.js +63 -0
- package/src/constants/custom-color-ranges.js +551 -0
- package/src/constants/default-settings.js +991 -0
- package/src/constants/index.js +80 -0
- package/src/constants/keyevent.js +36 -0
- package/src/constants/tooltip.js +198 -0
- package/src/constants/user-feedbacks.js +32 -0
- package/src/constants/user-guides.js +32 -0
- package/src/deckgl-layers/3d-building-layer/3d-building-layer.js +56 -0
- package/src/deckgl-layers/3d-building-layer/3d-building-utils.js +192 -0
- package/src/deckgl-layers/cluster-layer/cluster-layer.js +255 -0
- package/src/deckgl-layers/column-layer/enhanced-column-layer.js +63 -0
- package/src/deckgl-layers/grid-layer/enhanced-cpu-grid-layer.js +70 -0
- package/src/deckgl-layers/hexagon-layer/enhanced-hexagon-layer.js +70 -0
- package/src/deckgl-layers/layer-utils/cluster-utils.js +76 -0
- package/src/deckgl-layers/layer-utils/cpu-aggregator.js +583 -0
- package/src/deckgl-layers/layer-utils/shader-utils.js +41 -0
- package/src/deckgl-layers/line-layer/line-layer.js +122 -0
- package/src/deckgl-layers/svg-icon-layer/scatterplot-icon-layer.js +57 -0
- package/src/deckgl-layers/svg-icon-layer/svg-icon-layer.js +85 -0
- package/src/index.js +52 -0
- package/src/layers/aggregation-layer.js +356 -0
- package/src/layers/arc-layer/arc-layer-icon.js +67 -0
- package/src/layers/arc-layer/arc-layer.js +221 -0
- package/src/layers/base-layer.js +1439 -0
- package/src/layers/cluster-layer/cluster-layer-icon.js +71 -0
- package/src/layers/cluster-layer/cluster-layer.js +125 -0
- package/src/layers/default-layer-icon.js +50 -0
- package/src/layers/geojson-layer/geojson-layer-icon.js +68 -0
- package/src/layers/geojson-layer/geojson-layer.js +344 -0
- package/src/layers/geojson-layer/geojson-utils.js +179 -0
- package/src/layers/grid-layer/grid-layer-icon.js +53 -0
- package/src/layers/grid-layer/grid-layer.js +95 -0
- package/src/layers/grid-layer/grid-utils.js +71 -0
- package/src/layers/h3-hexagon-layer/h3-hexagon-layer-icon.js +48 -0
- package/src/layers/h3-hexagon-layer/h3-hexagon-layer.js +264 -0
- package/src/layers/h3-hexagon-layer/h3-utils.js +65 -0
- package/src/layers/heatmap-layer/heatmap-layer-icon.js +64 -0
- package/src/layers/heatmap-layer/heatmap-layer.js +226 -0
- package/src/layers/hexagon-layer/hexagon-layer-icon.js +74 -0
- package/src/layers/hexagon-layer/hexagon-layer.js +95 -0
- package/src/layers/hexagon-layer/hexagon-utils.js +63 -0
- package/src/layers/icon-layer/icon-info-modal.js +155 -0
- package/src/layers/icon-layer/icon-layer-icon.js +56 -0
- package/src/layers/icon-layer/icon-layer.js +324 -0
- package/src/layers/index.d.ts +126 -0
- package/src/layers/index.js +72 -0
- package/src/layers/layer-factory.d.ts +148 -0
- package/src/layers/layer-factory.js +480 -0
- package/src/layers/layer-text-label.js +62 -0
- package/src/layers/layer-update.js +71 -0
- package/src/layers/line-layer/line-layer-icon.js +69 -0
- package/src/layers/line-layer/line-layer.js +161 -0
- package/src/layers/mapbox-utils.js +195 -0
- package/src/layers/mapboxgl-layer.js +154 -0
- package/src/layers/point-layer/point-layer-icon.js +51 -0
- package/src/layers/point-layer/point-layer.js +414 -0
- package/src/layers/s2-geometry-layer/s2-geometry-layer.js +265 -0
- package/src/layers/s2-geometry-layer/s2-layer-icon.js +47 -0
- package/src/layers/s2-geometry-layer/s2-utils.js +36 -0
- package/src/layers/scenegraph-layer/scenegraph-info-modal.js +97 -0
- package/src/layers/scenegraph-layer/scenegraph-layer-icon.js +144 -0
- package/src/layers/scenegraph-layer/scenegraph-layer.js +182 -0
- package/src/layers/trip-layer/trip-info-modal.js +82 -0
- package/src/layers/trip-layer/trip-layer-icon.js +62 -0
- package/src/layers/trip-layer/trip-layer.js +295 -0
- package/src/layers/trip-layer/trip-utils.js +169 -0
- package/src/layers/types.js +37 -0
- package/src/localization/en.js +501 -0
- package/src/localization/formatted-message.js +33 -0
- package/src/localization/index.js +32 -0
- package/src/localization/locales.js +46 -0
- package/src/middleware/index.js +34 -0
- package/src/processors/data-processor.d.ts +57 -0
- package/src/processors/data-processor.js +684 -0
- package/src/processors/file-handler.d.ts +46 -0
- package/src/processors/file-handler.js +220 -0
- package/src/processors/index.js +44 -0
- package/src/reducers/combined-updaters.d.ts +26 -0
- package/src/reducers/combined-updaters.js +198 -0
- package/src/reducers/composer-helpers.d.ts +32 -0
- package/src/reducers/composer-helpers.js +70 -0
- package/src/reducers/composers.js +33 -0
- package/src/reducers/core.d.ts +25 -0
- package/src/reducers/core.js +97 -0
- package/src/reducers/index.d.ts +118 -0
- package/src/reducers/index.js +53 -0
- package/src/reducers/map-state-updaters.d.ts +64 -0
- package/src/reducers/map-state-updaters.js +224 -0
- package/src/reducers/map-state.js +47 -0
- package/src/reducers/map-style-updaters.d.ts +76 -0
- package/src/reducers/map-style-updaters.js +541 -0
- package/src/reducers/map-style.js +53 -0
- package/src/reducers/provider-state-updaters.d.ts +88 -0
- package/src/reducers/provider-state-updaters.js +428 -0
- package/src/reducers/provider-state.js +53 -0
- package/src/reducers/root.js +230 -0
- package/src/reducers/types.d.ts +10 -0
- package/src/reducers/ui-state-updaters.d.ts +198 -0
- package/src/reducers/ui-state-updaters.js +766 -0
- package/src/reducers/ui-state.js +73 -0
- package/src/reducers/vis-state-merger.d.ts +78 -0
- package/src/reducers/vis-state-merger.js +545 -0
- package/src/reducers/vis-state-selectors.js +35 -0
- package/src/reducers/vis-state-updaters.d.ts +534 -0
- package/src/reducers/vis-state-updaters.js +2137 -0
- package/src/reducers/vis-state.js +155 -0
- package/src/schemas/dataset-schema.js +141 -0
- package/src/schemas/index.d.ts +24 -0
- package/src/schemas/index.js +42 -0
- package/src/schemas/map-state-schema.js +52 -0
- package/src/schemas/map-style-schema.js +95 -0
- package/src/schemas/schema-manager.d.ts +229 -0
- package/src/schemas/schema-manager.js +228 -0
- package/src/schemas/schema-utils.js +54 -0
- package/src/schemas/schema.d.ts +47 -0
- package/src/schemas/schema.js +90 -0
- package/src/schemas/versions.d.ts +23 -0
- package/src/schemas/versions.js +28 -0
- package/src/schemas/vis-state-schema.js +731 -0
- package/src/styles/base.js +1620 -0
- package/src/styles/index.js +22 -0
- package/src/styles/media-breakpoints.js +47 -0
- package/src/tasks/tasks.js +92 -0
- package/src/templates/export-map-html.js +262 -0
- package/src/typedefs/README.md +3 -0
- package/src/typedefs/deck.gl__core.d.ts +64 -0
- package/src/typedefs/deck.gl__mesh-layers.d.ts +33 -0
- package/src/utils/aggregate-utils.js +71 -0
- package/src/utils/color-utils.js +106 -0
- package/src/utils/data-scale-utils.d.ts +26 -0
- package/src/utils/data-scale-utils.js +61 -0
- package/src/utils/data-utils.d.ts +45 -0
- package/src/utils/data-utils.js +428 -0
- package/src/utils/dataset-utils.d.ts +10 -0
- package/src/utils/dataset-utils.js +255 -0
- package/src/utils/dom-to-image.js +533 -0
- package/src/utils/dom-utils.js +354 -0
- package/src/utils/export-utils.js +247 -0
- package/src/utils/filter-utils.d.ts +192 -0
- package/src/utils/filter-utils.js +1114 -0
- package/src/utils/gl-utils.js +42 -0
- package/src/utils/gpu-filter-utils.d.ts +28 -0
- package/src/utils/gpu-filter-utils.js +253 -0
- package/src/utils/index.d.ts +5 -0
- package/src/utils/index.js +55 -0
- package/src/utils/interaction-utils.d.ts +36 -0
- package/src/utils/interaction-utils.js +185 -0
- package/src/utils/layer-utils.d.ts +78 -0
- package/src/utils/layer-utils.js +205 -0
- package/src/utils/locale-utils.js +59 -0
- package/src/utils/map-info-utils.js +29 -0
- package/src/utils/map-style-utils/mapbox-gl-style-editor.js +201 -0
- package/src/utils/map-style-utils/mapbox-utils.js +28 -0
- package/src/utils/mapbox-utils.js +27 -0
- package/src/utils/notifications-utils.js +83 -0
- package/src/utils/observe-dimensions.d.ts +18 -0
- package/src/utils/observe-dimensions.js +115 -0
- package/src/utils/projection-utils.js +72 -0
- package/src/utils/searcher-utils.js +37 -0
- package/src/utils/split-map-utils.js +104 -0
- package/src/utils/table-utils/UPGRADE-data-container.md +38 -0
- package/src/utils/table-utils/data-container-interface.d.ts +140 -0
- package/src/utils/table-utils/data-container-utils.d.ts +43 -0
- package/src/utils/table-utils/data-container-utils.js +61 -0
- package/src/utils/table-utils/data-row.d.ts +65 -0
- package/src/utils/table-utils/data-row.js +54 -0
- package/src/utils/table-utils/index.d.ts +1 -0
- package/src/utils/table-utils/index.js +21 -0
- package/src/utils/table-utils/indexed-data-container.d.ts +26 -0
- package/src/utils/table-utils/indexed-data-container.js +152 -0
- package/src/utils/table-utils/kepler-table.d.ts +114 -0
- package/src/utils/table-utils/kepler-table.js +486 -0
- package/src/utils/table-utils/row-data-container.d.ts +30 -0
- package/src/utils/table-utils/row-data-container.js +151 -0
- package/src/utils/utils.js +202 -0
- package/styles.js +21 -0
|
@@ -0,0 +1,1439 @@
|
|
|
1
|
+
// Copyright (c) 2022 Uber Technologies, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
// in the Software without restriction, including without limitation the rights
|
|
6
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
// furnished to do so, subject to the following conditions:
|
|
9
|
+
//
|
|
10
|
+
// The above copyright notice and this permission notice shall be included in
|
|
11
|
+
// all copies or substantial portions of the Software.
|
|
12
|
+
//
|
|
13
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
// THE SOFTWARE.
|
|
20
|
+
|
|
21
|
+
import {console as Console} from 'global/window';
|
|
22
|
+
import keymirror from 'keymirror';
|
|
23
|
+
import {CollisionFilterExtension, DataFilterExtension} from '@deck.gl/extensions';
|
|
24
|
+
import {COORDINATE_SYSTEM, Layer as DeckLayer} from '@deck.gl/core';
|
|
25
|
+
import {_PointLabelLayer as PointLabelLayer} from '@deck.gl/carto';
|
|
26
|
+
import DefaultLayerIcon from './default-layer-icon';
|
|
27
|
+
import {diffUpdateTriggers} from './layer-update';
|
|
28
|
+
|
|
29
|
+
import {
|
|
30
|
+
ALL_FIELD_TYPES,
|
|
31
|
+
NO_VALUE_COLOR,
|
|
32
|
+
SCALE_TYPES,
|
|
33
|
+
CHANNEL_SCALES,
|
|
34
|
+
FIELD_OPTS,
|
|
35
|
+
SCALE_FUNC,
|
|
36
|
+
CHANNEL_SCALE_SUPPORTED_FIELDS,
|
|
37
|
+
MAX_GPU_FILTERS,
|
|
38
|
+
UNKNOWN_COLOR,
|
|
39
|
+
ZOOM_LEVEL_LIMITS
|
|
40
|
+
} from 'constants/default-settings';
|
|
41
|
+
import {COLOR_RANGES} from 'constants/color-ranges';
|
|
42
|
+
import {DataVizColors} from 'constants/custom-color-ranges';
|
|
43
|
+
import {
|
|
44
|
+
LAYER_VIS_CONFIGS,
|
|
45
|
+
DEFAULT_TEXT_LABEL,
|
|
46
|
+
DEFAULT_COLOR_UI,
|
|
47
|
+
DEFAULT_HIGHLIGHT_COLOR,
|
|
48
|
+
DEFAULT_LAYER_LABEL
|
|
49
|
+
} from './layer-factory';
|
|
50
|
+
|
|
51
|
+
import {generateHashId, isPlainObject} from 'utils/utils';
|
|
52
|
+
|
|
53
|
+
import {getLatLngBounds, notNullorUndefined} from 'utils/data-utils';
|
|
54
|
+
import {getSampleData} from 'utils/table-utils/data-container-utils';
|
|
55
|
+
|
|
56
|
+
import {hexToRgb, getColorGroupByName, reverseColorRange} from 'utils/color-utils';
|
|
57
|
+
import {getMaskExtensionProps} from 'utils/layer-utils';
|
|
58
|
+
import {scaleOrdinal} from 'd3-scale';
|
|
59
|
+
|
|
60
|
+
/** @typedef {import('./index').Layer} LayerClass} */
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Approx. number of points to sample in a large data set
|
|
64
|
+
* @type {number}
|
|
65
|
+
*/
|
|
66
|
+
export const LAYER_ID_LENGTH = 6;
|
|
67
|
+
|
|
68
|
+
// Note, this is is SVG of solid circle encoded as data-uri
|
|
69
|
+
const FALLBACK_ICON =
|
|
70
|
+
'data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCiAgPGNpcmNsZSBjeD0iNTAiIGN5PSI1MCIgcj0iNTAiLz4NCjwvc3ZnPg==';
|
|
71
|
+
|
|
72
|
+
const MAX_SAMPLE_SIZE = 5000;
|
|
73
|
+
const defaultDomain = [0, 1];
|
|
74
|
+
const dataFilterExtension = new DataFilterExtension({filterSize: MAX_GPU_FILTERS});
|
|
75
|
+
const collisionFilterExtension = new CollisionFilterExtension();
|
|
76
|
+
|
|
77
|
+
const defaultDataAccessor = dc => d => d;
|
|
78
|
+
const defaultGetFieldValue = (field, d) => field.valueAccessor(d);
|
|
79
|
+
const scaleIdentity = v => v;
|
|
80
|
+
|
|
81
|
+
export const OVERLAY_TYPE = keymirror({
|
|
82
|
+
deckgl: null,
|
|
83
|
+
mapboxgl: null
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export const layerColors = Object.values(DataVizColors).map(hexToRgb);
|
|
87
|
+
function* generateColor() {
|
|
88
|
+
let index = 0;
|
|
89
|
+
while (index < layerColors.length + 1) {
|
|
90
|
+
if (index === layerColors.length) {
|
|
91
|
+
index = 0;
|
|
92
|
+
}
|
|
93
|
+
yield layerColors[index++];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const colorMaker = generateColor();
|
|
98
|
+
|
|
99
|
+
/** @type {LayerClass} */
|
|
100
|
+
class Layer {
|
|
101
|
+
constructor(props = {}) {
|
|
102
|
+
this.id = props.id || generateHashId(LAYER_ID_LENGTH);
|
|
103
|
+
|
|
104
|
+
// meta
|
|
105
|
+
this.meta = {};
|
|
106
|
+
|
|
107
|
+
// visConfigSettings
|
|
108
|
+
this.visConfigSettings = {};
|
|
109
|
+
|
|
110
|
+
// interactivitySettings
|
|
111
|
+
this._interactivitySettings = {};
|
|
112
|
+
|
|
113
|
+
// @ts-ignore
|
|
114
|
+
this.config = this.getDefaultLayerConfig({
|
|
115
|
+
columns: this.getLayerColumns(),
|
|
116
|
+
...props
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
get layerIcon() {
|
|
121
|
+
return DefaultLayerIcon;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
get overlayType() {
|
|
125
|
+
return OVERLAY_TYPE.deckgl;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
get type() {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
get name() {
|
|
133
|
+
return this.type;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
get isAggregated() {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
get requiredLayerColumns() {
|
|
141
|
+
return [];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
get optionalColumns() {
|
|
145
|
+
return [];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
get noneLayerDataAffectingProps() {
|
|
149
|
+
return ['label', 'opacity', 'thickness', 'isVisible', 'hidden'];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
get visualChannels() {
|
|
153
|
+
return {
|
|
154
|
+
color: {
|
|
155
|
+
property: 'color',
|
|
156
|
+
field: 'colorField',
|
|
157
|
+
scale: 'colorScale',
|
|
158
|
+
domain: 'colorDomain',
|
|
159
|
+
range: 'colorRange',
|
|
160
|
+
key: 'color',
|
|
161
|
+
channelScaleType: CHANNEL_SCALES.color,
|
|
162
|
+
nullValue: NO_VALUE_COLOR,
|
|
163
|
+
defaultValue: config => config.color
|
|
164
|
+
},
|
|
165
|
+
size: {
|
|
166
|
+
property: 'size',
|
|
167
|
+
field: 'sizeField',
|
|
168
|
+
scale: 'sizeScale',
|
|
169
|
+
domain: 'sizeDomain',
|
|
170
|
+
range: 'sizeRange',
|
|
171
|
+
key: 'size',
|
|
172
|
+
channelScaleType: CHANNEL_SCALES.size,
|
|
173
|
+
nullValue: 0,
|
|
174
|
+
defaultValue: 1
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/*
|
|
180
|
+
* Column pairs maps layer column to a specific field pairs,
|
|
181
|
+
* By default, it is set to null
|
|
182
|
+
*/
|
|
183
|
+
get columnPairs() {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/*
|
|
188
|
+
* Default point column pairs, can be used for point based layers: point, icon etc.
|
|
189
|
+
*/
|
|
190
|
+
get defaultPointColumnPairs() {
|
|
191
|
+
return {
|
|
192
|
+
lat: {pair: 'lng', fieldPairKey: 'lat'},
|
|
193
|
+
lng: {pair: 'lat', fieldPairKey: 'lng'}
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/*
|
|
198
|
+
* Default link column pairs, can be used for link based layers: arc, line etc
|
|
199
|
+
*/
|
|
200
|
+
get defaultLinkColumnPairs() {
|
|
201
|
+
return {
|
|
202
|
+
lat0: {pair: 'lng0', fieldPairKey: 'lat'},
|
|
203
|
+
lng0: {pair: 'lat0', fieldPairKey: 'lng'},
|
|
204
|
+
lat1: {pair: 'lng1', fieldPairKey: 'lat'},
|
|
205
|
+
lng1: {pair: 'lat1', fieldPairKey: 'lng'}
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Return a React component for to render layer instructions in a modal
|
|
211
|
+
* @returns {object} - an object
|
|
212
|
+
* @example
|
|
213
|
+
* return {
|
|
214
|
+
* id: 'iconInfo',
|
|
215
|
+
* template: IconInfoModal,
|
|
216
|
+
* modalProps: {
|
|
217
|
+
* title: 'How to draw icons'
|
|
218
|
+
* };
|
|
219
|
+
* }
|
|
220
|
+
*/
|
|
221
|
+
get layerInfoModal() {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
get interactivitySettings() {
|
|
226
|
+
return this._interactivitySettings;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
set interactivitySettings(interactivitySettings) {
|
|
230
|
+
this._interactivitySettings = interactivitySettings;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
get hasTooltip() {
|
|
234
|
+
return Boolean(
|
|
235
|
+
this.interactivitySettings?.hover?.fields.length ||
|
|
236
|
+
this.interactivitySettings?.click?.fields.length
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
get hasInteractivity() {
|
|
241
|
+
return Boolean(this.hasTooltip && this.interactivitySettings?.enabled);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/*
|
|
245
|
+
* Given a dataset, automatically find props to create layer based on it
|
|
246
|
+
* and return the props and previous found layers.
|
|
247
|
+
* By default, no layers will be found
|
|
248
|
+
*/
|
|
249
|
+
static findDefaultLayerProps(dataset, foundLayers) {
|
|
250
|
+
return {props: [], foundLayers};
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Given a array of preset required column names
|
|
255
|
+
* found field that has the same name to set as layer column
|
|
256
|
+
*
|
|
257
|
+
* @param {object} defaultFields
|
|
258
|
+
* @param {object[]} allFields
|
|
259
|
+
* @returns {object[] | null} all possible required layer column pairs
|
|
260
|
+
*/
|
|
261
|
+
static findDefaultColumnField(defaultFields, allFields) {
|
|
262
|
+
// find all matched fields for each required col
|
|
263
|
+
const requiredColumns = Object.keys(defaultFields).reduce((prev, key) => {
|
|
264
|
+
const requiredFields = allFields.filter(
|
|
265
|
+
f => f.name === defaultFields[key] || defaultFields[key].includes(f.name)
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
prev[key] = requiredFields.length
|
|
269
|
+
? requiredFields.map(f => ({
|
|
270
|
+
value: f.name,
|
|
271
|
+
fieldIdx: f.fieldIdx
|
|
272
|
+
}))
|
|
273
|
+
: null;
|
|
274
|
+
return prev;
|
|
275
|
+
}, {});
|
|
276
|
+
|
|
277
|
+
if (!Object.values(requiredColumns).every(Boolean)) {
|
|
278
|
+
// if any field missing, return null
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return this.getAllPossibleColumnParis(requiredColumns);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
static getAllPossibleColumnParis(requiredColumns) {
|
|
286
|
+
// for multiple matched field for one required column, return multiple
|
|
287
|
+
// combinations, e. g. if column a has 2 matched, column b has 3 matched
|
|
288
|
+
// 6 possible column pairs will be returned
|
|
289
|
+
const allKeys = Object.keys(requiredColumns);
|
|
290
|
+
const pointers = allKeys.map((k, i) => ((i === allKeys.length - 1 ? -1 : 0)));
|
|
291
|
+
const countPerKey = allKeys.map(k => requiredColumns[k].length);
|
|
292
|
+
const pairs = [];
|
|
293
|
+
|
|
294
|
+
/* eslint-disable no-loop-func */
|
|
295
|
+
while (incrementPointers(pointers, countPerKey, pointers.length - 1)) {
|
|
296
|
+
const newPair = pointers.reduce((prev, cuur, i) => {
|
|
297
|
+
prev[allKeys[i]] = requiredColumns[allKeys[i]][cuur];
|
|
298
|
+
return prev;
|
|
299
|
+
}, {});
|
|
300
|
+
|
|
301
|
+
pairs.push(newPair);
|
|
302
|
+
}
|
|
303
|
+
/* eslint-enable no-loop-func */
|
|
304
|
+
|
|
305
|
+
// recursively increment pointers
|
|
306
|
+
function incrementPointers(pts, counts, index) {
|
|
307
|
+
if (index === 0 && pts[0] === counts[0] - 1) {
|
|
308
|
+
// nothing to increment
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
if (pts[index] + 1 < counts[index]) {
|
|
313
|
+
pts[index] = pts[index] + 1;
|
|
314
|
+
return true;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
pts[index] = 0;
|
|
318
|
+
return incrementPointers(pts, counts, index - 1);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return pairs;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
static hexToRgb(c) {
|
|
325
|
+
return hexToRgb(c);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
getDefaultLayerConfig(props = {}) {
|
|
329
|
+
return {
|
|
330
|
+
dataId: props.dataId || null,
|
|
331
|
+
visibilityByZoom: {
|
|
332
|
+
min: props.visibilityByZoom?.min || ZOOM_LEVEL_LIMITS.min,
|
|
333
|
+
max: props.visibilityByZoom?.max || ZOOM_LEVEL_LIMITS.max
|
|
334
|
+
},
|
|
335
|
+
label: props.label || DEFAULT_LAYER_LABEL,
|
|
336
|
+
color: props.color || colorMaker.next().value,
|
|
337
|
+
columns: props.columns || null,
|
|
338
|
+
isVisible: props.isVisible || false,
|
|
339
|
+
isConfigActive: props.isConfigActive || false,
|
|
340
|
+
highlightColor: props.highlightColor || DEFAULT_HIGHLIGHT_COLOR,
|
|
341
|
+
hidden: props.hidden || false,
|
|
342
|
+
|
|
343
|
+
// TODO: refactor this into separate visual Channel config
|
|
344
|
+
// color by field, domain is set by filters, field, scale type
|
|
345
|
+
colorField: null,
|
|
346
|
+
colorDomain: [0, 1],
|
|
347
|
+
colorScale: SCALE_TYPES.quantile,
|
|
348
|
+
|
|
349
|
+
// color by size, domain is set by filters, field, scale type
|
|
350
|
+
sizeDomain: [0, 1],
|
|
351
|
+
sizeScale: SCALE_TYPES.linear,
|
|
352
|
+
sizeField: null,
|
|
353
|
+
radiusField: null,
|
|
354
|
+
|
|
355
|
+
visConfig: {},
|
|
356
|
+
|
|
357
|
+
textLabel: [DEFAULT_TEXT_LABEL],
|
|
358
|
+
|
|
359
|
+
colorUI: {
|
|
360
|
+
color: DEFAULT_COLOR_UI,
|
|
361
|
+
colorRange: DEFAULT_COLOR_UI
|
|
362
|
+
},
|
|
363
|
+
animation: {enabled: false}
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Get the description of a visualChannel config
|
|
369
|
+
* @param key
|
|
370
|
+
* @returns {{label: string, measure: (string|string)}}
|
|
371
|
+
*/
|
|
372
|
+
getVisualChannelDescription(key) {
|
|
373
|
+
// e.g. label: Color, measure: Vehicle Type
|
|
374
|
+
return {
|
|
375
|
+
label: this.visConfigSettings[this.visualChannels[key].range].label,
|
|
376
|
+
measure: this.config[this.visualChannels[key].field]
|
|
377
|
+
? (this.config[this.visualChannels[key].field].displayName ||
|
|
378
|
+
this.config[this.visualChannels[key].field].name)
|
|
379
|
+
: this.visualChannels[key].defaultMeasure
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Assign a field to layer column, return column config
|
|
385
|
+
* @param key - Column Key
|
|
386
|
+
* @param field - Selected field
|
|
387
|
+
* @returns {{}} - Column config
|
|
388
|
+
*/
|
|
389
|
+
assignColumn(key, field) {
|
|
390
|
+
// field value could be null for optional columns
|
|
391
|
+
const update = field
|
|
392
|
+
? {
|
|
393
|
+
value: field.name,
|
|
394
|
+
fieldIdx: field.fieldIdx
|
|
395
|
+
}
|
|
396
|
+
: {value: null, fieldIdx: -1};
|
|
397
|
+
|
|
398
|
+
return {
|
|
399
|
+
...this.config.columns,
|
|
400
|
+
[key]: {
|
|
401
|
+
...this.config.columns[key],
|
|
402
|
+
...update
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Assign a field pair to column config, return column config
|
|
409
|
+
* @param key - Column Key
|
|
410
|
+
* @param pair - field Pair
|
|
411
|
+
* @returns {object} - Column config
|
|
412
|
+
*/
|
|
413
|
+
assignColumnPairs(key, pair) {
|
|
414
|
+
if (!this.columnPairs || !this.columnPairs?.[key]) {
|
|
415
|
+
// should not end in this state
|
|
416
|
+
return this.config.columns;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const {pair: partnerKey, fieldPairKey} = this.columnPairs?.[key];
|
|
420
|
+
const {fieldPairKey: partnerFieldPairKey} = this.columnPairs?.[partnerKey];
|
|
421
|
+
|
|
422
|
+
return {
|
|
423
|
+
...this.config.columns,
|
|
424
|
+
[key]: pair[fieldPairKey],
|
|
425
|
+
[partnerKey]: pair[partnerFieldPairKey]
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Calculate a radius zoom multiplier to render points, so they are visible in all zoom level
|
|
431
|
+
* @param {object} mapState
|
|
432
|
+
* @param {number} mapState.zoom - actual zoom
|
|
433
|
+
* @param {number | void} mapState.zoomOffset - zoomOffset when render in the plot container for export image
|
|
434
|
+
* @returns {number}
|
|
435
|
+
*/
|
|
436
|
+
getZoomFactor({zoom, zoomOffset = 0}) {
|
|
437
|
+
return Math.pow(2, Math.max(14 - zoom + zoomOffset, 0));
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Calculate a elevation zoom multiplier to render points, so they are visible in all zoom level
|
|
442
|
+
* @param {object} mapState
|
|
443
|
+
* @param {number} mapState.zoom - actual zoom
|
|
444
|
+
* @param {number | void} mapState.zoomOffset - zoomOffset when render in the plot container for export image
|
|
445
|
+
* @returns {number}
|
|
446
|
+
*/
|
|
447
|
+
getElevationZoomFactor({zoom, zoomOffset = 0}) {
|
|
448
|
+
return this.config.visConfig.enableElevationZoomFactor
|
|
449
|
+
? Math.pow(2, Math.max(8 - zoom + zoomOffset, 0))
|
|
450
|
+
: 1;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
formatLayerData(datasets, filteredIndex) {
|
|
454
|
+
return {};
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
renderLayer() {
|
|
458
|
+
return [];
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
getHoverData(object, dataContainer) {
|
|
462
|
+
if (!object) {
|
|
463
|
+
return null;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
// By default, each entry of layerData should have an index of a row in the original data container.
|
|
467
|
+
// Each layer can implement its own getHoverData method
|
|
468
|
+
return dataContainer.row(object.index);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* When change layer type, try to copy over layer configs as much as possible
|
|
473
|
+
* @param configToCopy - config to copy over
|
|
474
|
+
* @param visConfigSettings - visConfig settings of config to copy
|
|
475
|
+
*/
|
|
476
|
+
assignConfigToLayer(configToCopy, visConfigSettings) {
|
|
477
|
+
// don't deep merge visualChannel field
|
|
478
|
+
// don't deep merge color range, reversed: is not a key by default
|
|
479
|
+
const shallowCopy = ['colorRange', 'strokeColorRange'].concat(
|
|
480
|
+
Object.values(this.visualChannels).map(v => v.field)
|
|
481
|
+
);
|
|
482
|
+
|
|
483
|
+
// don't copy over domain and animation
|
|
484
|
+
const notToCopy = ['animation'].concat(Object.values(this.visualChannels).map(v => v.domain));
|
|
485
|
+
// if range is for the same property group copy it, otherwise, not to copy
|
|
486
|
+
Object.values(this.visualChannels).forEach(v => {
|
|
487
|
+
if (
|
|
488
|
+
configToCopy.visConfig[v.range] &&
|
|
489
|
+
this.visConfigSettings[v.range] &&
|
|
490
|
+
visConfigSettings[v.range].group !== this.visConfigSettings[v.range].group
|
|
491
|
+
) {
|
|
492
|
+
notToCopy.push(v.range);
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
// don't copy over visualChannel range
|
|
497
|
+
const currentConfig = this.config;
|
|
498
|
+
const copied = this.copyLayerConfig(currentConfig, configToCopy, {
|
|
499
|
+
shallowCopy,
|
|
500
|
+
notToCopy
|
|
501
|
+
});
|
|
502
|
+
this.updateLayerConfig(copied);
|
|
503
|
+
// validate visualChannel field type and scale types
|
|
504
|
+
Object.keys(this.visualChannels).forEach(channel => {
|
|
505
|
+
this.validateVisualChannel(channel);
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/*
|
|
510
|
+
* Recursively copy config over to an empty layer
|
|
511
|
+
* when received saved config, or copy config over from a different layer type
|
|
512
|
+
* make sure to only copy over value to existing keys
|
|
513
|
+
* @param {object} currentConfig - existing config to be override
|
|
514
|
+
* @param {object} configToCopy - new Config to copy over
|
|
515
|
+
* @param {string[]} shallowCopy - array of properties to not to be deep copied
|
|
516
|
+
* @param {string[]} notToCopy - array of properties not to copy
|
|
517
|
+
* @returns {object} - copied config
|
|
518
|
+
*/
|
|
519
|
+
copyLayerConfig(currentConfig, configToCopy, {shallowCopy = [], notToCopy = []} = {}) {
|
|
520
|
+
const copied = {};
|
|
521
|
+
Object.keys(currentConfig).forEach(key => {
|
|
522
|
+
if (
|
|
523
|
+
isPlainObject(currentConfig[key]) &&
|
|
524
|
+
isPlainObject(configToCopy[key]) &&
|
|
525
|
+
!shallowCopy.includes(key) &&
|
|
526
|
+
!notToCopy.includes(key)
|
|
527
|
+
) {
|
|
528
|
+
// recursively assign object value
|
|
529
|
+
copied[key] = this.copyLayerConfig(currentConfig[key], configToCopy[key], {
|
|
530
|
+
shallowCopy,
|
|
531
|
+
notToCopy
|
|
532
|
+
});
|
|
533
|
+
} else if (notNullorUndefined(configToCopy[key]) && !notToCopy.includes(key)) {
|
|
534
|
+
// copy
|
|
535
|
+
copied[key] = configToCopy[key];
|
|
536
|
+
} else {
|
|
537
|
+
// keep existing
|
|
538
|
+
copied[key] = currentConfig[key];
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
return copied;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
registerVisConfig(layerVisConfigs) {
|
|
546
|
+
Object.keys(layerVisConfigs).forEach(item => {
|
|
547
|
+
if (typeof item === 'string' && LAYER_VIS_CONFIGS[layerVisConfigs[item]]) {
|
|
548
|
+
// if assigned one of default LAYER_CONFIGS
|
|
549
|
+
this.config.visConfig[item] = LAYER_VIS_CONFIGS[layerVisConfigs[item]].defaultValue;
|
|
550
|
+
this.visConfigSettings[item] = LAYER_VIS_CONFIGS[layerVisConfigs[item]];
|
|
551
|
+
} else if (['type', 'defaultValue'].every(p => layerVisConfigs[item].hasOwnProperty(p))) {
|
|
552
|
+
// if provided customized visConfig, and has type && defaultValue
|
|
553
|
+
// TODO: further check if customized visConfig is valid
|
|
554
|
+
this.config.visConfig[item] = layerVisConfigs[item].defaultValue;
|
|
555
|
+
this.visConfigSettings[item] = layerVisConfigs[item];
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
getLayerColumns() {
|
|
561
|
+
const columnValidators = this.columnValidators || {};
|
|
562
|
+
const required = this.requiredLayerColumns.reduce(
|
|
563
|
+
(accu, key) => ({
|
|
564
|
+
...accu,
|
|
565
|
+
[key]: columnValidators[key]
|
|
566
|
+
? {value: null, fieldIdx: -1, validator: columnValidators[key]}
|
|
567
|
+
: {value: null, fieldIdx: -1}
|
|
568
|
+
}),
|
|
569
|
+
{}
|
|
570
|
+
);
|
|
571
|
+
const optional = this.optionalColumns.reduce(
|
|
572
|
+
(accu, key) => ({
|
|
573
|
+
...accu,
|
|
574
|
+
[key]: {value: null, fieldIdx: -1, optional: true}
|
|
575
|
+
}),
|
|
576
|
+
{}
|
|
577
|
+
);
|
|
578
|
+
|
|
579
|
+
return {...required, ...optional};
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
updateLayerConfig(newConfig) {
|
|
583
|
+
this.config = {...this.config, ...newConfig};
|
|
584
|
+
return this;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
updateLayerVisConfig(newVisConfig) {
|
|
588
|
+
this.config.visConfig = {...this.config.visConfig, ...newVisConfig};
|
|
589
|
+
return this;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
updateLayerColorUI(prop, newConfig) {
|
|
593
|
+
const {colorUI: previous, visConfig} = this.config;
|
|
594
|
+
|
|
595
|
+
if (!isPlainObject(newConfig) || typeof prop !== 'string') {
|
|
596
|
+
return this;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
const colorUIProp = Object.entries(newConfig).reduce((accu, [key, value]) => {
|
|
600
|
+
return {
|
|
601
|
+
...accu,
|
|
602
|
+
[key]: isPlainObject(accu[key]) && isPlainObject(value) ? {...accu[key], ...value} : value
|
|
603
|
+
};
|
|
604
|
+
}, previous[prop] || DEFAULT_COLOR_UI);
|
|
605
|
+
|
|
606
|
+
const colorUI = {
|
|
607
|
+
...previous,
|
|
608
|
+
[prop]: colorUIProp
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
this.updateLayerConfig({colorUI});
|
|
612
|
+
// if colorUI[prop] is colorRange
|
|
613
|
+
const isColorRange = visConfig[prop] && visConfig[prop].colors;
|
|
614
|
+
|
|
615
|
+
if (isColorRange) {
|
|
616
|
+
this.updateColorUIByColorRange(newConfig, prop);
|
|
617
|
+
this.updateColorRangeByColorUI(newConfig, previous, prop);
|
|
618
|
+
this.updateCustomPalette(newConfig, previous, prop);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
return this;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
updateCustomPalette(newConfig, previous, prop) {
|
|
625
|
+
if (!newConfig.colorRangeConfig || !newConfig.colorRangeConfig.custom) {
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
const {colorUI, visConfig} = this.config;
|
|
630
|
+
|
|
631
|
+
if (!visConfig[prop]) return;
|
|
632
|
+
const {colors} = visConfig[prop];
|
|
633
|
+
const customPalette = {
|
|
634
|
+
...colorUI[prop].customPalette,
|
|
635
|
+
name: 'Custom Palette',
|
|
636
|
+
colors: [...colors]
|
|
637
|
+
};
|
|
638
|
+
this.updateLayerConfig({
|
|
639
|
+
colorUI: {
|
|
640
|
+
...colorUI,
|
|
641
|
+
[prop]: {
|
|
642
|
+
...colorUI[prop],
|
|
643
|
+
customPalette
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* if open dropdown and prop is color range
|
|
650
|
+
* Automatically set colorRangeConfig's step, reversed and type
|
|
651
|
+
* @param {*} newConfig
|
|
652
|
+
* @param {*} prop
|
|
653
|
+
*/
|
|
654
|
+
updateColorUIByColorRange(newConfig, prop) {
|
|
655
|
+
if (typeof newConfig.showDropdown !== 'number') return;
|
|
656
|
+
|
|
657
|
+
const {colorUI, visConfig} = this.config;
|
|
658
|
+
this.updateLayerConfig({
|
|
659
|
+
colorUI: {
|
|
660
|
+
...colorUI,
|
|
661
|
+
[prop]: {
|
|
662
|
+
...colorUI[prop],
|
|
663
|
+
colorRangeConfig: {
|
|
664
|
+
...colorUI[prop].colorRangeConfig,
|
|
665
|
+
type: visConfig[prop].type,
|
|
666
|
+
steps: visConfig[prop].colors.length,
|
|
667
|
+
reversed: Boolean(visConfig[prop].reversed)
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
// eslint-disable-next-line complexity
|
|
675
|
+
updateColorRangeByColorUI(newConfig, previous, prop) {
|
|
676
|
+
// only update colorRange if changes in UI is made to 'reversed', 'steps' or steps
|
|
677
|
+
const shouldUpdate =
|
|
678
|
+
newConfig.colorRangeConfig &&
|
|
679
|
+
['reversed', 'steps'].some(
|
|
680
|
+
key =>
|
|
681
|
+
newConfig.colorRangeConfig.hasOwnProperty(key) &&
|
|
682
|
+
newConfig.colorRangeConfig[key] !==
|
|
683
|
+
(previous[prop] || DEFAULT_COLOR_UI).colorRangeConfig[key]
|
|
684
|
+
);
|
|
685
|
+
if (!shouldUpdate) return;
|
|
686
|
+
|
|
687
|
+
const {colorUI, visConfig} = this.config;
|
|
688
|
+
const {steps, reversed} = colorUI[prop].colorRangeConfig;
|
|
689
|
+
const colorRange = visConfig[prop];
|
|
690
|
+
// find based on step or reversed
|
|
691
|
+
let update;
|
|
692
|
+
if (newConfig.colorRangeConfig.hasOwnProperty('steps')) {
|
|
693
|
+
const group = getColorGroupByName(colorRange);
|
|
694
|
+
|
|
695
|
+
if (group) {
|
|
696
|
+
const sameGroup = COLOR_RANGES.filter(cr => getColorGroupByName(cr) === group);
|
|
697
|
+
|
|
698
|
+
update = sameGroup.find(cr => cr.colors.length === steps);
|
|
699
|
+
|
|
700
|
+
if (update && colorRange.reversed) {
|
|
701
|
+
update = reverseColorRange(true, update);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
if (update && colorRange.colorMap) {
|
|
705
|
+
update = this.updateColorMap(prop, colorRange.colorMap, update);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
if (newConfig.colorRangeConfig.hasOwnProperty('reversed')) {
|
|
711
|
+
update = reverseColorRange(reversed, update || colorRange);
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
if (update) {
|
|
715
|
+
this.updateLayerVisConfig({[prop]: update});
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
updateColorMap(prop, colorMap, colorRange) {
|
|
720
|
+
// @ts-ignore
|
|
721
|
+
const {field, domain} = Object.values(this.visualChannels).find(value => value.range === prop);
|
|
722
|
+
const type = this.config[field]?.type;
|
|
723
|
+
|
|
724
|
+
if (type === 'string' || type === 'boolean' || type === 'date') {
|
|
725
|
+
return this.updateCategoryColorMap(colorMap, this.config[domain], colorRange);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
// If no type or type is not string, boolean or date
|
|
729
|
+
return this.updateNumericColorMap(colorMap, this.config[domain], colorRange);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
updateCategoryColorMap(colorMap, domain, colorRange) {
|
|
733
|
+
const colors = colorRange.colors;
|
|
734
|
+
const assignedCategories = [];
|
|
735
|
+
const newColorMap = colorMap.slice(0, colors.length).map((cMap, index) => {
|
|
736
|
+
assignedCategories.push(cMap[0]);
|
|
737
|
+
return [cMap[0], colors[index]];
|
|
738
|
+
});
|
|
739
|
+
const unassignedColors = colors.slice(newColorMap.length, colors.length);
|
|
740
|
+
|
|
741
|
+
for (const color of unassignedColors) {
|
|
742
|
+
const category = domain.find(d => !assignedCategories.includes(d));
|
|
743
|
+
if (!category) {
|
|
744
|
+
break;
|
|
745
|
+
}
|
|
746
|
+
assignedCategories.push(category);
|
|
747
|
+
newColorMap.push([category, color]);
|
|
748
|
+
}
|
|
749
|
+
return {
|
|
750
|
+
...colorRange,
|
|
751
|
+
colorMap: newColorMap
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
updateNumericColorMap(colorMap, domain, update) {
|
|
756
|
+
const colors = update.colors;
|
|
757
|
+
let newColorMap = colorMap.slice(0, colors.length);
|
|
758
|
+
|
|
759
|
+
newColorMap = newColorMap.map((cMap, index) => {
|
|
760
|
+
const value = index === newColorMap.length - 1 ? null : cMap[0];
|
|
761
|
+
return [value, colors[index]];
|
|
762
|
+
});
|
|
763
|
+
const unassignedColors = colors.slice(newColorMap.length, colors.length);
|
|
764
|
+
|
|
765
|
+
if (unassignedColors.length > 0) {
|
|
766
|
+
const colorMapValues = colorMap.map(c => c[0]).filter(c => typeof c === 'number');
|
|
767
|
+
const maxValue = Math.max(...colorMapValues, domain[domain.length - 1]);
|
|
768
|
+
const prevValue = newColorMap[newColorMap.length - 2][0];
|
|
769
|
+
const step = (maxValue - prevValue) / (unassignedColors.length + 1);
|
|
770
|
+
newColorMap[newColorMap.length - 1][0] = prevValue + step;
|
|
771
|
+
|
|
772
|
+
for (const [i, color] of unassignedColors.entries()) {
|
|
773
|
+
const value = i === unassignedColors.length - 1 ? null : prevValue + (step * (i + 2));
|
|
774
|
+
newColorMap.push([value, color]);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
return {
|
|
778
|
+
...update,
|
|
779
|
+
colorMap: newColorMap
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Check whether layer has all columns
|
|
785
|
+
* @returns {boolean} yes or no
|
|
786
|
+
*/
|
|
787
|
+
hasAllColumns() {
|
|
788
|
+
const {columns} = this.config;
|
|
789
|
+
return (
|
|
790
|
+
(columns &&
|
|
791
|
+
Object.values(columns).every(v => {
|
|
792
|
+
return Boolean(v.optional || (v.value && v.fieldIdx > -1));
|
|
793
|
+
}))
|
|
794
|
+
);
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Check whether layer has data
|
|
799
|
+
*
|
|
800
|
+
* @param {Array | Object} layerData
|
|
801
|
+
* @returns {boolean} yes or no
|
|
802
|
+
*/
|
|
803
|
+
hasLayerData(layerData) {
|
|
804
|
+
if (!layerData) {
|
|
805
|
+
return false;
|
|
806
|
+
}
|
|
807
|
+
return Boolean(layerData.data && layerData.data.length);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
isValidToSave() {
|
|
811
|
+
return this.type && this.hasAllColumns();
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
shouldRenderLayer(data) {
|
|
815
|
+
return (
|
|
816
|
+
(this.type &&
|
|
817
|
+
this.hasAllColumns() &&
|
|
818
|
+
this.hasLayerData(data) &&
|
|
819
|
+
typeof this.renderLayer === 'function')
|
|
820
|
+
);
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
getColorScale(colorScale, colorDomain, colorRange) {
|
|
824
|
+
if (Array.isArray(colorRange.colorMap)) {
|
|
825
|
+
const cMap = new Map();
|
|
826
|
+
colorRange.colorMap.forEach(([k, v]) => {
|
|
827
|
+
cMap.set(k, typeof v === 'string' ? hexToRgb(v) : v);
|
|
828
|
+
});
|
|
829
|
+
|
|
830
|
+
// @ts-ignore d3 scale
|
|
831
|
+
const scale = SCALE_FUNC[colorScale]()
|
|
832
|
+
.domain(Array.from(cMap.keys()))
|
|
833
|
+
.range(Array.from(cMap.values()))
|
|
834
|
+
.unknown(UNKNOWN_COLOR);
|
|
835
|
+
return scale;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
return this.getVisChannelScale(colorScale, colorDomain, colorRange.colors.map(hexToRgb));
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
getCustomMarkersScale(range, fallbackIcon) {
|
|
842
|
+
let unknownValue = fallbackIcon || FALLBACK_ICON;
|
|
843
|
+
if (!range) {
|
|
844
|
+
return () => unknownValue;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
const mapping = new Map();
|
|
848
|
+
|
|
849
|
+
if (range.othersMarker) {
|
|
850
|
+
unknownValue = range.othersMarker;
|
|
851
|
+
}
|
|
852
|
+
for (const {value, markerUrl} of range.markerMap) {
|
|
853
|
+
if (markerUrl) {
|
|
854
|
+
mapping.set(value, markerUrl);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
// @ts-ignore d3 scale
|
|
859
|
+
const scale = scaleOrdinal()
|
|
860
|
+
.domain(Array.from(mapping.keys()))
|
|
861
|
+
.range(Array.from(mapping.values()))
|
|
862
|
+
.unknown(unknownValue);
|
|
863
|
+
return scale;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* Mapping from visual channels to deck.gl accesors
|
|
868
|
+
* @param {Object} param Parameters
|
|
869
|
+
* @param {Function} param.dataAccessor Access kepler.gl layer data from deck.gl layer
|
|
870
|
+
* @param {import('utils/table-utils/data-container-interface').DataContainerInterface} param.dataContainer DataContainer to use use with dataAccessor
|
|
871
|
+
* @return {Object} attributeAccessors - deck.gl layer attribute accessors
|
|
872
|
+
*/
|
|
873
|
+
getAttributeAccessors({dataAccessor = defaultDataAccessor, dataContainer}) {
|
|
874
|
+
const attributeAccessors = {};
|
|
875
|
+
|
|
876
|
+
// eslint-disable-next-line complexity
|
|
877
|
+
Object.keys(this.visualChannels).forEach(channel => {
|
|
878
|
+
const {
|
|
879
|
+
field,
|
|
880
|
+
fixed,
|
|
881
|
+
scale,
|
|
882
|
+
domain,
|
|
883
|
+
range,
|
|
884
|
+
accessor,
|
|
885
|
+
defaultValue,
|
|
886
|
+
getAttributeValue,
|
|
887
|
+
nullValue,
|
|
888
|
+
channelScaleType,
|
|
889
|
+
aggregation
|
|
890
|
+
} = this.visualChannels[channel];
|
|
891
|
+
|
|
892
|
+
const shouldGetScale = Boolean(
|
|
893
|
+
(scale || channelScaleType === CHANNEL_SCALES.identity) && this.config[field]
|
|
894
|
+
);
|
|
895
|
+
|
|
896
|
+
if (shouldGetScale) {
|
|
897
|
+
const args = [this.config[scale], this.config[domain], this.config.visConfig[range]];
|
|
898
|
+
const isFixed = fixed && this.config.visConfig[fixed];
|
|
899
|
+
// It's important to declare as const all the parameters that we are going to be use in the getEncodedChannelValue call
|
|
900
|
+
// otherwise, the oldLayerData parameter in formatLayerData method will be wrong (you can check the formatLayerData TileLayer method in Builder as example)
|
|
901
|
+
const fieldConfig = this.config[field];
|
|
902
|
+
const aggregationValue = this.config.visConfig[aggregation];
|
|
903
|
+
|
|
904
|
+
const scaleFunction =
|
|
905
|
+
channelScaleType === CHANNEL_SCALES.identity
|
|
906
|
+
? scaleIdentity
|
|
907
|
+
: channelScaleType === CHANNEL_SCALES.color
|
|
908
|
+
? this.getColorScale(...args)
|
|
909
|
+
: channelScaleType === CHANNEL_SCALES.customMarker
|
|
910
|
+
? this.getCustomMarkersScale(
|
|
911
|
+
this.config.visConfig[range],
|
|
912
|
+
this.config.visConfig.customMarkersUrl
|
|
913
|
+
)
|
|
914
|
+
: this.getVisChannelScale(...args, isFixed);
|
|
915
|
+
|
|
916
|
+
attributeAccessors[accessor] = d =>
|
|
917
|
+
this.getEncodedChannelValue(
|
|
918
|
+
scaleFunction,
|
|
919
|
+
dataAccessor(dataContainer)(d),
|
|
920
|
+
fieldConfig,
|
|
921
|
+
aggregationValue,
|
|
922
|
+
nullValue
|
|
923
|
+
);
|
|
924
|
+
} else if (typeof getAttributeValue === 'function') {
|
|
925
|
+
attributeAccessors[accessor] = getAttributeValue(this.config);
|
|
926
|
+
} else {
|
|
927
|
+
attributeAccessors[accessor] =
|
|
928
|
+
typeof defaultValue === 'function' ? defaultValue(this.config) : defaultValue;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
if (!(accessor in attributeAccessors)) {
|
|
932
|
+
Console.warn(`Failed to provide accessor function for ${accessor || channel}`);
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
|
|
936
|
+
return attributeAccessors;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
getVisChannelScale(scale, domain, range, fixed) {
|
|
940
|
+
if (scale === SCALE_TYPES.ordinal) {
|
|
941
|
+
// @ts-ignore d3-scale type
|
|
942
|
+
return SCALE_FUNC[scale]()
|
|
943
|
+
.domain(domain.slice(0, range.length))
|
|
944
|
+
.range(range)
|
|
945
|
+
.unknown(UNKNOWN_COLOR);
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
// for `count` aggregation, we domain is actually `[0, Infinity]` so it doesn't make sense
|
|
949
|
+
// to use it, so skip specyfying this domains
|
|
950
|
+
const domainIsInfinite = domain && (domain[0] === 0 && domain[1] === Infinity);
|
|
951
|
+
const scaleFactory = SCALE_FUNC[fixed ? 'linear' : scale];
|
|
952
|
+
// @ts-ignore d3-scale type
|
|
953
|
+
let result = scaleFactory();
|
|
954
|
+
if (domain && !domainIsInfinite) {
|
|
955
|
+
result = result.domain(domain);
|
|
956
|
+
}
|
|
957
|
+
return result.range(fixed ? domain : range);
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* Get longitude and latitude bounds of the data.
|
|
962
|
+
* @param {import('utils/table-utils/data-container-interface').DataContainerInterface} dataContainer DataContainer to calculate bounds for.
|
|
963
|
+
* @param {(d: {index: number}, dc: import('utils/table-utils/data-container-interface').DataContainerInterface) => number[]} getPosition Access kepler.gl layer data from deck.gl layer
|
|
964
|
+
* @return {number[]|null} bounds of the data.
|
|
965
|
+
*/
|
|
966
|
+
getPointsBounds(dataContainer, getPosition) {
|
|
967
|
+
// no need to loop through the entire dataset
|
|
968
|
+
// get a sample of data to calculate bounds
|
|
969
|
+
const sampleData =
|
|
970
|
+
dataContainer.numRows() > MAX_SAMPLE_SIZE
|
|
971
|
+
? getSampleData(dataContainer, MAX_SAMPLE_SIZE)
|
|
972
|
+
: dataContainer;
|
|
973
|
+
|
|
974
|
+
const points = sampleData.mapIndex(getPosition);
|
|
975
|
+
|
|
976
|
+
const latBounds = getLatLngBounds(points, 1, [-90, 90]);
|
|
977
|
+
const lngBounds = getLatLngBounds(points, 0, [-180, 180]);
|
|
978
|
+
|
|
979
|
+
if (!latBounds || !lngBounds) {
|
|
980
|
+
return null;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
return [lngBounds[0], latBounds[0], lngBounds[1], latBounds[1]];
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
getChangedTriggers(dataUpdateTriggers) {
|
|
987
|
+
const triggerChanged = diffUpdateTriggers(dataUpdateTriggers, this._oldDataUpdateTriggers);
|
|
988
|
+
this._oldDataUpdateTriggers = dataUpdateTriggers;
|
|
989
|
+
|
|
990
|
+
return triggerChanged;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
getEncodedChannelValue(
|
|
994
|
+
scale,
|
|
995
|
+
data,
|
|
996
|
+
field,
|
|
997
|
+
// In builder we overwrite the getValue function and we use the _aggregation parameter in spatial index layers as the QuadkeyLayer.
|
|
998
|
+
_aggregation,
|
|
999
|
+
nullValue = NO_VALUE_COLOR,
|
|
1000
|
+
getValue = defaultGetFieldValue
|
|
1001
|
+
) {
|
|
1002
|
+
const {type} = field;
|
|
1003
|
+
const value = getValue(field, data);
|
|
1004
|
+
|
|
1005
|
+
if (!notNullorUndefined(value)) {
|
|
1006
|
+
return nullValue;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
let attributeValue;
|
|
1010
|
+
if (type === ALL_FIELD_TYPES.timestamp) {
|
|
1011
|
+
// shouldn't need to convert here
|
|
1012
|
+
// scale Function should take care of it
|
|
1013
|
+
attributeValue = scale(new Date(value));
|
|
1014
|
+
} else {
|
|
1015
|
+
attributeValue = scale(value);
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
if (!notNullorUndefined(attributeValue)) {
|
|
1019
|
+
attributeValue = nullValue;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
return attributeValue;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
updateMeta(meta) {
|
|
1026
|
+
this.meta = {...this.meta, ...meta};
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
getDataUpdateTriggers({filteredIndex, id, allData}) {
|
|
1030
|
+
const {columns} = this.config;
|
|
1031
|
+
|
|
1032
|
+
return {
|
|
1033
|
+
getData: {datasetId: id, allData, columns, filteredIndex},
|
|
1034
|
+
getMeta: {datasetId: id, allData, columns},
|
|
1035
|
+
...(this.config.textLabel || []).reduce(
|
|
1036
|
+
(accu, tl, i) => ({
|
|
1037
|
+
...accu,
|
|
1038
|
+
[`getLabelCharacterSet-${i}`]: tl.field ? tl.field.name : null
|
|
1039
|
+
}),
|
|
1040
|
+
{}
|
|
1041
|
+
)
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
updateData(datasets, oldLayerData) {
|
|
1046
|
+
if (!this.config.dataId) {
|
|
1047
|
+
return {};
|
|
1048
|
+
}
|
|
1049
|
+
const layerDataset = datasets[this.config.dataId];
|
|
1050
|
+
const {dataContainer} = layerDataset;
|
|
1051
|
+
|
|
1052
|
+
this.updateVisualChannelFields(layerDataset);
|
|
1053
|
+
|
|
1054
|
+
const getPosition = this.getPositionAccessor(dataContainer);
|
|
1055
|
+
const dataUpdateTriggers = this.getDataUpdateTriggers(layerDataset);
|
|
1056
|
+
const triggerChanged = this.getChangedTriggers(dataUpdateTriggers);
|
|
1057
|
+
|
|
1058
|
+
if (triggerChanged.getMeta) {
|
|
1059
|
+
this.updateLayerMeta(dataContainer, getPosition);
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
let data = [];
|
|
1063
|
+
|
|
1064
|
+
if (!triggerChanged.getData && oldLayerData && oldLayerData.data) {
|
|
1065
|
+
// same data
|
|
1066
|
+
data = oldLayerData.data;
|
|
1067
|
+
} else {
|
|
1068
|
+
data = this.calculateDataAttribute(layerDataset, getPosition);
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
return {data, triggerChanged};
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* Update styled fields to match ones from new dataset.
|
|
1076
|
+
*
|
|
1077
|
+
* @param {Object} dataset
|
|
1078
|
+
*/
|
|
1079
|
+
updateVisualChannelFields(dataset) {
|
|
1080
|
+
for (const {field} of Object.values(this.visualChannels)) {
|
|
1081
|
+
const oldField = this.config[field];
|
|
1082
|
+
if (!oldField) {
|
|
1083
|
+
return;
|
|
1084
|
+
}
|
|
1085
|
+
const newDataSetField = dataset.fields.find(fd => fd.name === oldField.name) || null;
|
|
1086
|
+
this.updateLayerConfig({[field]: newDataSetField});
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
* helper function to update one layer domain when state.data changed
|
|
1092
|
+
* if state.data change is due ot update filter, newFiler will be passed
|
|
1093
|
+
* called by updateAllLayerDomainData
|
|
1094
|
+
* @param {Object} datasets
|
|
1095
|
+
* @param {Object} newFilter
|
|
1096
|
+
* @returns {object} layer
|
|
1097
|
+
*/
|
|
1098
|
+
updateLayerDomain(datasets, newFilter) {
|
|
1099
|
+
const table = this.getDataset(datasets);
|
|
1100
|
+
if (!table) {
|
|
1101
|
+
return this;
|
|
1102
|
+
}
|
|
1103
|
+
Object.values(this.visualChannels).forEach(channel => {
|
|
1104
|
+
const {scale} = channel;
|
|
1105
|
+
const scaleType = this.config[scale];
|
|
1106
|
+
// ordinal domain is based on dataContainer, if only filter changed
|
|
1107
|
+
// no need to update ordinal domain
|
|
1108
|
+
if (!newFilter || scaleType !== SCALE_TYPES.ordinal) {
|
|
1109
|
+
const {domain} = channel;
|
|
1110
|
+
const updatedDomain = this.calculateLayerDomain(table, channel);
|
|
1111
|
+
this.updateLayerConfig({[domain]: updatedDomain});
|
|
1112
|
+
}
|
|
1113
|
+
});
|
|
1114
|
+
|
|
1115
|
+
return this;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
getDataset(datasets) {
|
|
1119
|
+
return this.config.dataId ? datasets[this.config.dataId] : null;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* Validate visual channel field and scales based on supported field & scale type
|
|
1124
|
+
* @param channel
|
|
1125
|
+
*/
|
|
1126
|
+
validateVisualChannel(channel) {
|
|
1127
|
+
this.validateFieldType(channel);
|
|
1128
|
+
this.validateScale(channel);
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
/**
|
|
1132
|
+
* Validate field type based on channelScaleType
|
|
1133
|
+
*/
|
|
1134
|
+
validateFieldType(channel) {
|
|
1135
|
+
const visualChannel = this.visualChannels[channel];
|
|
1136
|
+
const {field, channelScaleType, supportedFieldTypes} = visualChannel;
|
|
1137
|
+
|
|
1138
|
+
if (this.config[field]) {
|
|
1139
|
+
// if field is selected, check if field type is supported
|
|
1140
|
+
const channelSupportedFieldTypes =
|
|
1141
|
+
supportedFieldTypes || CHANNEL_SCALE_SUPPORTED_FIELDS[channelScaleType];
|
|
1142
|
+
|
|
1143
|
+
if (!channelSupportedFieldTypes.includes(this.config[field].type)) {
|
|
1144
|
+
// field type is not supported, set it back to null
|
|
1145
|
+
// set scale back to default
|
|
1146
|
+
this.updateLayerConfig({[field]: null});
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* Validate scale type based on aggregation
|
|
1153
|
+
*/
|
|
1154
|
+
validateScale(channel) {
|
|
1155
|
+
const visualChannel = this.visualChannels[channel];
|
|
1156
|
+
const {scale} = visualChannel;
|
|
1157
|
+
if (!scale) {
|
|
1158
|
+
// visualChannel doesn't have scale
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
const scaleOptions = this.getScaleOptions(channel);
|
|
1162
|
+
// check if current selected scale is
|
|
1163
|
+
// supported, if not, change to default
|
|
1164
|
+
if (!scaleOptions.includes(this.config[scale])) {
|
|
1165
|
+
this.updateLayerConfig({[scale]: scaleOptions[0]});
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* Get scale options based on current field
|
|
1171
|
+
* @param {string} channel
|
|
1172
|
+
* @returns {string[]}
|
|
1173
|
+
*/
|
|
1174
|
+
getScaleOptions(channel) {
|
|
1175
|
+
const visualChannel = this.visualChannels[channel];
|
|
1176
|
+
const {field, scale, channelScaleType} = visualChannel;
|
|
1177
|
+
|
|
1178
|
+
return this.config[field]
|
|
1179
|
+
? FIELD_OPTS[this.config[field].type].scale[channelScaleType]
|
|
1180
|
+
: [this.getDefaultLayerConfig()[scale]];
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
updateLayerVisualChannel(dataset, channel) {
|
|
1184
|
+
const visualChannel = this.visualChannels[channel];
|
|
1185
|
+
this.validateVisualChannel(channel);
|
|
1186
|
+
// calculate layer channel domain
|
|
1187
|
+
const updatedDomain = this.calculateLayerDomain(dataset, visualChannel);
|
|
1188
|
+
this.updateLayerConfig({[visualChannel.domain]: updatedDomain});
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
getVisualChannelUpdateTriggers() {
|
|
1192
|
+
const updateTriggers = {};
|
|
1193
|
+
Object.values(this.visualChannels).forEach(visualChannel => {
|
|
1194
|
+
// field range scale domain
|
|
1195
|
+
const {accessor, field, scale, domain, range, defaultValue, fixed} = visualChannel;
|
|
1196
|
+
|
|
1197
|
+
updateTriggers[accessor] = {
|
|
1198
|
+
[field]: this.config[field],
|
|
1199
|
+
[scale]: this.config[scale],
|
|
1200
|
+
[domain]: this.config[domain],
|
|
1201
|
+
[range]: this.config.visConfig[range],
|
|
1202
|
+
defaultValue: typeof defaultValue === 'function' ? defaultValue(this.config) : defaultValue,
|
|
1203
|
+
...(fixed ? {[fixed]: this.config.visConfig[fixed]} : {})
|
|
1204
|
+
};
|
|
1205
|
+
});
|
|
1206
|
+
return updateTriggers;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
calculateLayerDomain(dataset, visualChannel) {
|
|
1210
|
+
const {scale} = visualChannel;
|
|
1211
|
+
const field = this.config[visualChannel.field];
|
|
1212
|
+
if (!field || !scale) {
|
|
1213
|
+
// if colorField or sizeField were set back to null
|
|
1214
|
+
return defaultDomain;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
const scaleType = this.config[scale];
|
|
1218
|
+
const dataSetField = dataset.fields.find(f => f.name === field.name);
|
|
1219
|
+
if (!scaleType || !dataSetField) {
|
|
1220
|
+
// if new dataset doesn't contain previously set field
|
|
1221
|
+
return defaultDomain;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
return dataset.getColumnLayerDomain(dataSetField, scaleType) || defaultDomain;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
hasHoveredObject(objectInfo) {
|
|
1228
|
+
return this.isLayerHovered(objectInfo) && objectInfo.object ? objectInfo.object : null;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
isLayerHovered(objectInfo) {
|
|
1232
|
+
return objectInfo?.picked && objectInfo?.layer?.props?.id === this.id;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
getRadiusScaleByZoom(mapState) {
|
|
1236
|
+
const radiusChannel = Object.values(this.visualChannels).find(vc => vc.property === 'radius');
|
|
1237
|
+
|
|
1238
|
+
if (!radiusChannel) {
|
|
1239
|
+
return 1;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
const field = radiusChannel.field;
|
|
1243
|
+
const {radius} = this.config.visConfig;
|
|
1244
|
+
|
|
1245
|
+
// @ts-ignore
|
|
1246
|
+
return (this.config[field] ? 1 : radius) * this.getZoomFactor(mapState);
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
getRadiusScale() {
|
|
1250
|
+
const radiusChannel = Object.values(this.visualChannels).find(vc => vc.property === 'radius');
|
|
1251
|
+
|
|
1252
|
+
if (!radiusChannel || this.config[radiusChannel.field]) {
|
|
1253
|
+
return 1;
|
|
1254
|
+
} else {
|
|
1255
|
+
return this.config.visConfig.radius;
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
getMaxMarkerSize() {
|
|
1260
|
+
const {radiusField, sizeField, visConfig} = this.config;
|
|
1261
|
+
const {radiusRange, radius} = visConfig;
|
|
1262
|
+
const field = radiusField || sizeField;
|
|
1263
|
+
return Math.ceil((field && radiusRange ? radiusRange[1] : radius));
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
shouldCalculateLayerData(props) {
|
|
1267
|
+
return props.some(p => !this.noneLayerDataAffectingProps.includes(p));
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
getBrushingExtensionProps(interactionConfig, brushingTarget) {
|
|
1271
|
+
const {brush} = interactionConfig;
|
|
1272
|
+
|
|
1273
|
+
return {
|
|
1274
|
+
// brushing
|
|
1275
|
+
autoHighlight: !brush.enabled,
|
|
1276
|
+
brushingRadius: brush.config.size * 1000,
|
|
1277
|
+
brushingTarget: brushingTarget || 'source',
|
|
1278
|
+
brushingEnabled: brush.enabled
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
getDefaultDeckLayerProps({idx, gpuFilter, mapState, visible, maskPolygon}) {
|
|
1283
|
+
const maskExtensionProps = getMaskExtensionProps(maskPolygon);
|
|
1284
|
+
return {
|
|
1285
|
+
...maskExtensionProps,
|
|
1286
|
+
id: this.id,
|
|
1287
|
+
idx,
|
|
1288
|
+
coordinateSystem: COORDINATE_SYSTEM.LNGLAT,
|
|
1289
|
+
pickable: this.hasInteractivity,
|
|
1290
|
+
wrapLongitude: true,
|
|
1291
|
+
parameters: {depthTest: Boolean(mapState.dragRotate || this.config.visConfig.enable3d)},
|
|
1292
|
+
hidden: this.config.hidden,
|
|
1293
|
+
visibilityByZoom: this.config.visibilityByZoom,
|
|
1294
|
+
// visconfig
|
|
1295
|
+
opacity: this.config.visConfig.opacity,
|
|
1296
|
+
highlightColor: this.config.highlightColor,
|
|
1297
|
+
// data filtering
|
|
1298
|
+
extensions: [dataFilterExtension, ...maskExtensionProps.extensions],
|
|
1299
|
+
filterRange: gpuFilter ? gpuFilter.filterRange : undefined,
|
|
1300
|
+
// layer should be visible and if splitMap, shown in to one of panel
|
|
1301
|
+
visible: this.config.isVisible && visible
|
|
1302
|
+
};
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
getDefaultHoverLayerProps() {
|
|
1306
|
+
return {
|
|
1307
|
+
id: `${this.id}-hovered`,
|
|
1308
|
+
pickable: false,
|
|
1309
|
+
wrapLongitude: true,
|
|
1310
|
+
coordinateSystem: COORDINATE_SYSTEM.LNGLAT
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
renderTextLabelLayer(
|
|
1315
|
+
{getPosition, getRadius, radiusScale, updateTriggers, sharedProps},
|
|
1316
|
+
renderOpts
|
|
1317
|
+
) {
|
|
1318
|
+
const {data, mapState} = renderOpts;
|
|
1319
|
+
const {textLabel, visibilityByZoom} = this.config;
|
|
1320
|
+
const extensions = [...sharedProps.extensions, collisionFilterExtension];
|
|
1321
|
+
|
|
1322
|
+
if (!data || !data.textLabels || !data.textLabels[0] || !data.textLabels[0].getText) {
|
|
1323
|
+
return [];
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
const [mainLabel, secondaryLabel] = textLabel;
|
|
1327
|
+
const {
|
|
1328
|
+
alignment,
|
|
1329
|
+
anchor,
|
|
1330
|
+
color: getColor,
|
|
1331
|
+
field: mainField,
|
|
1332
|
+
outlineColor,
|
|
1333
|
+
size: sizeScale
|
|
1334
|
+
} = mainLabel;
|
|
1335
|
+
const {
|
|
1336
|
+
color: getSecondaryColor,
|
|
1337
|
+
field: secondaryField,
|
|
1338
|
+
outlineColor: secondaryOutlineColor,
|
|
1339
|
+
size: secondarySizeScale
|
|
1340
|
+
} = secondaryLabel || {};
|
|
1341
|
+
|
|
1342
|
+
return [
|
|
1343
|
+
new PointLabelLayer({
|
|
1344
|
+
...sharedProps,
|
|
1345
|
+
|
|
1346
|
+
// Recreate layer when labels change otherwise rendering breaks
|
|
1347
|
+
// TODO could be more efficient with updateTriggers?
|
|
1348
|
+
id: `${this.id}-${mainField?.name}-${secondaryField?.name}-label`,
|
|
1349
|
+
data: data.data,
|
|
1350
|
+
visibilityByZoom,
|
|
1351
|
+
extensions,
|
|
1352
|
+
|
|
1353
|
+
characterSet: 'auto',
|
|
1354
|
+
collisionEnabled: true,
|
|
1355
|
+
collisionGroup: `${this.id}-labels`,
|
|
1356
|
+
|
|
1357
|
+
getText: data.textLabels[0].getText,
|
|
1358
|
+
getColor,
|
|
1359
|
+
sizeScale,
|
|
1360
|
+
outlineColor,
|
|
1361
|
+
|
|
1362
|
+
...(secondaryField && {
|
|
1363
|
+
getSecondaryText: data.textLabels[1].getText,
|
|
1364
|
+
getSecondaryColor,
|
|
1365
|
+
secondarySizeScale,
|
|
1366
|
+
secondaryOutlineColor
|
|
1367
|
+
}),
|
|
1368
|
+
|
|
1369
|
+
// Position
|
|
1370
|
+
getPosition,
|
|
1371
|
+
getRadius,
|
|
1372
|
+
radiusScale,
|
|
1373
|
+
getTextAnchor: anchor,
|
|
1374
|
+
getAlignmentBaseline: alignment,
|
|
1375
|
+
|
|
1376
|
+
// Style
|
|
1377
|
+
fontFamily: 'Inter, sans',
|
|
1378
|
+
fontSettings: {sdf: true},
|
|
1379
|
+
fontWeight: 500,
|
|
1380
|
+
outlineWidth: 4,
|
|
1381
|
+
parameters: {
|
|
1382
|
+
// text will always show on top of all layers
|
|
1383
|
+
depthTest: false
|
|
1384
|
+
},
|
|
1385
|
+
|
|
1386
|
+
getFilterValue: data.getFilterValue,
|
|
1387
|
+
updateTriggers: {
|
|
1388
|
+
...updateTriggers,
|
|
1389
|
+
getText: mainField?.name,
|
|
1390
|
+
getColor: mainField?.color,
|
|
1391
|
+
getTextAnchor: mainLabel.anchor,
|
|
1392
|
+
getAlignmentBaseline: mainLabel.alignment,
|
|
1393
|
+
getSecondaryText: secondaryField?.name
|
|
1394
|
+
}
|
|
1395
|
+
})
|
|
1396
|
+
];
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
/**
|
|
1400
|
+
* Create deck.gl `IconLayer` "autoPack" mode accessor for custom markers.
|
|
1401
|
+
*
|
|
1402
|
+
* @param {*} iconUrlAccessor deck.gl accessor (or value) that resolves to URL of icon for given row
|
|
1403
|
+
* @returns deck.gl accessor that returns UnpackedIcon ready to consume by IconLayer
|
|
1404
|
+
*/
|
|
1405
|
+
getCustomMarkerIconAccessor(iconUrlAccessor, mask = true) {
|
|
1406
|
+
const maxIconSize = this.getMaxMarkerSize();
|
|
1407
|
+
|
|
1408
|
+
return d => {
|
|
1409
|
+
const wantedUrl =
|
|
1410
|
+
(typeof iconUrlAccessor === 'function') ? iconUrlAccessor(d) : iconUrlAccessor;
|
|
1411
|
+
const iconOk = Boolean(wantedUrl);
|
|
1412
|
+
mask = iconOk ? mask : true;
|
|
1413
|
+
const url = iconOk ? wantedUrl : FALLBACK_ICON;
|
|
1414
|
+
return {
|
|
1415
|
+
id: `${url}@@${maxIconSize}@${mask ? 'm' : 'c'}`,
|
|
1416
|
+
url,
|
|
1417
|
+
width: maxIconSize,
|
|
1418
|
+
height: maxIconSize,
|
|
1419
|
+
mask
|
|
1420
|
+
};
|
|
1421
|
+
};
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
calculateDataAttribute(keplerTable, getPosition) {
|
|
1425
|
+
// implemented in subclasses
|
|
1426
|
+
return [];
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
updateLayerMeta(dataContainer, getPosition) {
|
|
1430
|
+
// implemented in subclasses
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
getPositionAccessor(dataContainer) {
|
|
1434
|
+
// implemented in subclasses
|
|
1435
|
+
return () => null;
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
export default Layer;
|