UNPKG

kepler.gl

Version:

kepler.gl is a webgl based application to visualize large scale location data in the browser

316 lines (307 loc) 49 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.addLayerToLayerOrder = addLayerToLayerOrder; exports.bindLayerCallbacks = bindLayerCallbacks; exports.calculateLayerData = calculateLayerData; exports.computeDeckLayers = computeDeckLayers; exports.findDefaultLayer = findDefaultLayer; exports.getCustomDeckLayers = getCustomDeckLayers; exports.getLayerHoverProp = getLayerHoverProp; exports.getLayerHoverPropValue = getLayerHoverPropValue; exports.getLayerOrderFromLayers = getLayerOrderFromLayers; exports.isLayerRenderable = isLayerRenderable; exports.isLayerVisible = isLayerVisible; exports.prepareLayersForDeck = prepareLayersForDeck; exports.prepareLayersToRender = prepareLayersToRender; exports.renderDeckGlLayer = renderDeckGlLayer; exports.reorderLayerOrder = reorderLayerOrder; var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); var _console = _interopRequireDefault(require("global/console")); var _sortable = require("@dnd-kit/sortable"); var _constants = require("@kepler.gl/constants"); var _layers = require("@kepler.gl/layers"); var _utils = require("@kepler.gl/utils"); var _deckglLayers = require("@kepler.gl/deckgl-layers"); function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // SPDX-License-Identifier: MIT // Copyright contributors to the kepler.gl project /** * Find default layers from fields */ function findDefaultLayer(dataset, layerClasses) { if (!dataset) { return []; } var layerProps = Object.keys(layerClasses).reduce(function (previous, lc) { var result = typeof layerClasses[lc].findDefaultLayerProps === 'function' ? layerClasses[lc].findDefaultLayerProps(dataset, previous) : { props: [] }; var props = Array.isArray(result) ? result : result.props || []; var foundLayers = result.foundLayers || previous; return foundLayers.concat(props.map(function (p) { return _objectSpread(_objectSpread({}, p), {}, { type: lc, dataId: dataset.id }, lc === 'arc' || lc === 'line' ? { isVisible: false } : {}); })); }, []); // go through all layerProps to create layer return layerProps.map(function (props) { var layer = new layerClasses[props.type](props); return typeof layer.setInitialLayerConfig === 'function' && dataset.dataContainer ? layer.setInitialLayerConfig(dataset) : layer; }); } /** * Calculate layer data based on layer type, col Config, * return updated layer if colorDomain, dataMap has changed. * Also, returns updated layer in case the input layer was in invalid state. * Adds an error message to the layer in case of an exception. */ function calculateLayerData(layer, state, oldLayerData) { var layerData; try { // Make sure the layer updates data after an error if (!layer.isValid) { layer._oldDataUpdateTriggers = undefined; } if (!layer.type || !layer.hasAllColumns() || !layer.config.dataId) { return { layer: layer, layerData: {} }; } layerData = layer.formatLayerData(state.datasets, oldLayerData); // At this point the data for the layer is updated without errors if (!layer.isValid) { // Switch to visible after an error layer = layer.updateLayerConfig({ isVisible: true }); } layer.isValid = true; layer.errorMessage = null; } catch (err) { _console["default"].error(err); layer = layer.updateLayerConfig({ isVisible: false }); layer.isValid = false; layer.errorMessage = err instanceof Error && err.message ? err.message.substring(0, 100) : 'Unknown error'; layerData = {}; } return { layer: layer, layerData: layerData }; } /** * Calculate props passed to LayerHoverInfo */ function getLayerHoverProp(_ref) { var animationConfig = _ref.animationConfig, interactionConfig = _ref.interactionConfig, hoverInfo = _ref.hoverInfo, layers = _ref.layers, layersToRender = _ref.layersToRender, datasets = _ref.datasets; if (interactionConfig.tooltip.enabled && hoverInfo && hoverInfo.picked) { // if anything hovered var object = hoverInfo.object, overlay = hoverInfo.layer; // deckgl layer to kepler-gl layer var layer = layers[overlay.props.idx]; // NOTE: for binary format GeojsonLayer, deck will return object=null but hoverInfo.index >= 0 if ((object || hoverInfo.index >= 0) && layer && layer.getHoverData && layersToRender[layer.id]) { // if layer is visible and have hovered data var dataId = layer.config.dataId; if (!dataId) { return null; } var _datasets$dataId = datasets[dataId], dataContainer = _datasets$dataId.dataContainer, fields = _datasets$dataId.fields; var data = layer.getHoverData(object || hoverInfo.index, dataContainer, fields, animationConfig, hoverInfo); if (!data) { return null; } var fieldsToShow = interactionConfig.tooltip.config.fieldsToShow[dataId]; return { data: data, fields: fields, fieldsToShow: fieldsToShow, layer: layer, currentTime: animationConfig.currentTime }; } } return null; } function renderDeckGlLayer(props, layerCallbacks) { var datasets = props.datasets, layer = props.layer, layerIndex = props.layerIndex, data = props.data, hoverInfo = props.hoverInfo, clicked = props.clicked, mapState = props.mapState, interactionConfig = props.interactionConfig, animationConfig = props.animationConfig, mapLayers = props.mapLayers; var dataset = datasets[layer.config.dataId]; var _ref2 = dataset || {}, gpuFilter = _ref2.gpuFilter; var objectHovered = clicked || hoverInfo; var visible = !mapLayers || mapLayers && mapLayers[layer.id]; // Layer is Layer class return layer.renderLayer({ data: data, gpuFilter: gpuFilter, idx: layerIndex, interactionConfig: interactionConfig, layerCallbacks: layerCallbacks, mapState: mapState, animationConfig: animationConfig, objectHovered: objectHovered, visible: visible, dataset: dataset }); } function isLayerRenderable(layer, layerData) { return layer.id !== _constants.GEOCODER_LAYER_ID && layer.shouldRenderLayer(layerData); } function isLayerVisible(layer, mapLayers) { return layer.config.isVisible && ( // if layer.id is not in mapLayers, don't render it !mapLayers || mapLayers && mapLayers[layer.id]); } // Prepare a dict of layers rendered by the deck.gl // Note, isVisible: false layer is passed to deck.gl here // return {[id]: true \ false} function prepareLayersForDeck(layers, layerData) { return layers.reduce(function (accu, layer, idx) { return _objectSpread(_objectSpread({}, accu), {}, (0, _defineProperty2["default"])({}, layer.id, isLayerRenderable(layer, layerData[idx]) && layer.overlayType === _layers.OVERLAY_TYPE_CONST.deckgl)); }, {}); } // Prepare a dict of rendered layers rendered in the map // This includes only the visibile layers for single map view and split map view // return {[id]: true \ false} function prepareLayersToRender(layers, layerData, mapLayers) { return layers.reduce(function (accu, layer, idx) { return _objectSpread(_objectSpread({}, accu), {}, (0, _defineProperty2["default"])({}, layer.id, isLayerRenderable(layer, layerData[idx]) && isLayerVisible(layer, mapLayers))); }, {}); } function getCustomDeckLayers(deckGlProps) { var bottomDeckLayers = Array.isArray(deckGlProps === null || deckGlProps === void 0 ? void 0 : deckGlProps.layers) ? deckGlProps === null || deckGlProps === void 0 ? void 0 : deckGlProps.layers : (0, _utils.isFunction)(deckGlProps === null || deckGlProps === void 0 ? void 0 : deckGlProps.layers) ? deckGlProps === null || deckGlProps === void 0 ? void 0 : deckGlProps.layers() : []; var topDeckLayers = Array.isArray(deckGlProps === null || deckGlProps === void 0 ? void 0 : deckGlProps.topLayers) ? deckGlProps === null || deckGlProps === void 0 ? void 0 : deckGlProps.topLayers : (0, _utils.isFunction)(deckGlProps === null || deckGlProps === void 0 ? void 0 : deckGlProps.topLayers) ? deckGlProps === null || deckGlProps === void 0 ? void 0 : deckGlProps.topLayers() : []; return [bottomDeckLayers, topDeckLayers]; } function bindLayerCallbacks() { var layerCallbacks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var idx = arguments.length > 1 ? arguments[1] : undefined; return Object.keys(layerCallbacks).reduce(function (accu, key) { return _objectSpread(_objectSpread({}, accu), {}, (0, _defineProperty2["default"])({}, key, function (val) { return layerCallbacks[key](idx, val); })); }, {}); } // eslint-disable-next-line complexity function computeDeckLayers(_ref3, options, layerCallbacks, deckGlProps) { var visState = _ref3.visState, mapState = _ref3.mapState, mapStyle = _ref3.mapStyle; var datasets = visState.datasets, layers = visState.layers, layerOrder = visState.layerOrder, layerData = visState.layerData, hoverInfo = visState.hoverInfo, clicked = visState.clicked, interactionConfig = visState.interactionConfig, animationConfig = visState.animationConfig, splitMaps = visState.splitMaps; var _ref4 = options || {}, mapIndex = _ref4.mapIndex, mapboxApiAccessToken = _ref4.mapboxApiAccessToken, mapboxApiUrl = _ref4.mapboxApiUrl, primaryMap = _ref4.primaryMap, layersForDeck = _ref4.layersForDeck, editorInfo = _ref4.editorInfo; var dataLayers = []; if (layerData && layerData.length) { var mapLayers = (0, _utils.getMapLayersFromSplitMaps)(splitMaps, mapIndex || 0); var currentLayersForDeck = layersForDeck || prepareLayersForDeck(layers, layerData); dataLayers = layerOrder.slice().reverse().filter(function (id) { return currentLayersForDeck[id]; }).reduce(function (overlays, layerId) { var layerIndex = layers.findIndex(function (_ref5) { var id = _ref5.id; return id === layerId; }); var bindedLayerCallbacks = layerCallbacks ? bindLayerCallbacks(layerCallbacks, layerIndex) : {}; var layer = layers[layerIndex]; var data = layerData[layerIndex]; var layerOverlay = renderDeckGlLayer({ datasets: datasets, layer: layer, layerIndex: layerIndex, data: data, hoverInfo: hoverInfo, clicked: clicked, mapState: mapState, interactionConfig: interactionConfig, animationConfig: animationConfig, mapLayers: mapLayers }, bindedLayerCallbacks); return overlays.concat(layerOverlay || []); }, []); } if (!primaryMap) { return dataLayers; } if (mapStyle !== null && mapStyle !== void 0 && mapStyle.visibleLayerGroups['3d building'] && primaryMap && mapboxApiAccessToken && mapboxApiUrl) { dataLayers.push(new _deckglLayers.ThreeDBuildingLayer({ id: '_keplergl_3d-building', mapboxApiAccessToken: mapboxApiAccessToken, mapboxApiUrl: mapboxApiUrl, threeDBuildingColor: mapStyle.threeDBuildingColor, updateTriggers: { getFillColor: mapStyle.threeDBuildingColor } })); } var _getCustomDeckLayers = getCustomDeckLayers(deckGlProps), _getCustomDeckLayers2 = (0, _slicedToArray2["default"])(_getCustomDeckLayers, 2), customBottomDeckLayers = _getCustomDeckLayers2[0], customTopDeckLayers = _getCustomDeckLayers2[1]; var editorLayer = []; if (editorInfo) { editorLayer.push((0, _layers.getEditorLayer)(_objectSpread({}, editorInfo))); } return [].concat((0, _toConsumableArray2["default"])(customBottomDeckLayers), (0, _toConsumableArray2["default"])(dataLayers), (0, _toConsumableArray2["default"])(customTopDeckLayers), editorLayer); } function getLayerOrderFromLayers(layers) { return layers.map(function (_ref6) { var id = _ref6.id; return id; }); } function reorderLayerOrder(layerOrder, originLayerId, destinationLayerId) { var activeIndex = layerOrder.indexOf(originLayerId); var overIndex = layerOrder.indexOf(destinationLayerId); return (0, _sortable.arrayMove)(layerOrder, activeIndex, overIndex); } function addLayerToLayerOrder(layerOrder, layerId) { return [layerId].concat((0, _toConsumableArray2["default"])(layerOrder)); } function getLayerHoverPropValue(data, fieldIndex) { if (!data) return undefined; if (data instanceof _utils.DataRow) return data.valueAt(fieldIndex); return data[fieldIndex]; } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfY29uc29sZSIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJyZXF1aXJlIiwiX3NvcnRhYmxlIiwiX2NvbnN0YW50cyIsIl9sYXllcnMiLCJfdXRpbHMiLCJfZGVja2dsTGF5ZXJzIiwib3duS2V5cyIsImUiLCJyIiwidCIsIk9iamVjdCIsImtleXMiLCJnZXRPd25Qcm9wZXJ0eVN5bWJvbHMiLCJvIiwiZmlsdGVyIiwiZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yIiwiZW51bWVyYWJsZSIsInB1c2giLCJhcHBseSIsIl9vYmplY3RTcHJlYWQiLCJhcmd1bWVudHMiLCJsZW5ndGgiLCJmb3JFYWNoIiwiX2RlZmluZVByb3BlcnR5MiIsImdldE93blByb3BlcnR5RGVzY3JpcHRvcnMiLCJkZWZpbmVQcm9wZXJ0aWVzIiwiZGVmaW5lUHJvcGVydHkiLCJmaW5kRGVmYXVsdExheWVyIiwiZGF0YXNldCIsImxheWVyQ2xhc3NlcyI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CwgcHJldmlvdXMpXG4gICAgICAgICAgOiB7cHJvcHM6IFtdfTtcblxuICAgICAgY29uc3QgcHJvcHMgPSBBcnJheS5pc0FycmF5KHJlc3VsdCkgPyByZXN1bHQgOiByZXN1bHQucHJvcHMgfHwgW107XG4gICAgICBjb25zdCBmb3VuZExheWVycyA9IHJlc3VsdC5mb3VuZExheWVycyB8fCBwcmV2aW91cztcblxuICAgICAgcmV0dXJuIGZvdW5kTGF5ZXJzLmNvbmNhdChcbiAgICAgICAgcHJvcHMubWFwKHAgPT4gKHtcbiAgICAgICAgICAuLi5wLFxuICAgICAgICAgIHR5cGU6IGxjLFxuICAgICAgICAgIGRhdGFJZDogZGF0YXNldC5pZCxcbiAgICAgICAgICAvLyBzZXQgYXJjIGxheWVyIGluaXRpYWwgdmlzaWJsaXR5IHRvIGZhbHNlLCBiZWNhdXNlIGFyY3MgdGVuZCB0byBiZSB0b28gbXVzeVxuICAgICAgICAgIC4uLihsYyA9PT0gJ2FyYycgfHwgbGMgPT09ICdsaW5lJyA/IHtpc1Zpc2libGU6IGZhbHNlfSA6IHt9KVxuICAgICAgICB9KSlcbiAgICAgICk7XG4gICAgfSxcbiAgICBbXSBhcyAoRmluZERlZmF1bHRMYXllclByb3BzICYge3R5cGU6IHN0cmluZ30pW11cbiAgKTtcblxuICAvLyBnbyB0aHJvdWdoIGFsbCBsYXllclByb3BzIHRvIGNyZWF0ZSBsYXllclxuICByZXR1cm4gbGF5ZXJQcm9wcy5tYXAocHJvcHMgPT4ge1xuICAgIGNvbnN0IGxheWVyID0gbmV3IGxheWVyQ2xhc3Nlc1twcm9wcy50eXBlXShwcm9wcyk7XG4gICAgcmV0dXJuIHR5cGVvZiBsYXllci5zZXRJbml0aWFsTGF5ZXJDb25maWcgPT09ICdmdW5jdGlvbicgJiYgZGF0YXNldC5kYXRhQ29udGFpbmVyXG4gICAgICA/IGxheWVyLnNldEluaXRpYWxMYXllckNvbmZpZyhkYXRhc2V0KVxuICAgICAgOiBsYXllc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IgJiZcbiAgICAgIGxheWVyLmdldEhvdmVyRGF0YSAmJlxuICAgICAgbGF5ZXJzVG9SZW5kZXJbbGF5ZXIuaWRdXG4gICAgKSB7XG4gICAgICAvLyBpZiBsYXllciBpcyB2aXNpYmxlIGFuZCBoYXZlIGhvdmVyZWQgZGF0YVxuICAgICAgY29uc3Qge1xuICAgICAgICBjb25maWc6IHtkYXRhSWR9XG4gICAgICB9ID0gbGF5ZXI7XG4gICAgICBpZiAoIWRhdGFJZCkge1xuICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgIH1cbiAgICAgIGNvbnN0IHtkYXRhQ29udGFpbmVyLCBmaWVsZHN9ID0gZGF0YXNldHNbZGF0YUlkXTtcbiAgICAgIGNvbnN0IGRhdGE6IERhdGFSb3cgfCBudWxsID0gbGF5ZXIuZ2V0SG92ZXJEYXRhKFxuICAgICAgICBvYmplY3QgfHwgaG92ZXJJbmZvLmluZGV4LFxuICAgICAgICBkYXRhQ29udGFpbmVyLFxuICAgICAgICBmaWVsZHMsXG4gICAgICAgIGFuaW1hdGlvbkNvbmZpZyxcbiAgICAgICAgaG92ZXJJbmZvXG4gICAgICApO1xuICAgICAgaWYgKCFkYXRhKSB7XG4gICAgICAgIHJldHVybiBudWxsO1xuICAgICAgfVxuICAgICAgY29uc3QgZmllbGRzVG9TaG93ID0gaW50ZXJhY3Rpb25Db25maWcudG9vbHRpcC5jb25maWcuZmllbGRzVG9TaG93W2RhdGFJZF07XG5cbiAgICAgIHJldHVybiB7XG4gICAgICAgIGRhdGEsXG4gICAgICAgIGZpZWxkcyxcbiAgICAgICAgZmllbGRzVG9TaG93LFxuICAgICAgICBsYXllcixcbiAgICAgICAgY3VycmVudFRpbWU6IGFuaW1hdGlvbkNvbmZpZy5jdXJyZW50VGltZVxuICAgICAgfTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gbnVsbDtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIHJlbmRlckRlY2tHbExheWVyKHByb3BzOiBhb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IGlmIChsYXllckRhdGEgJiYgbGF5ZXJEYXRhLmxlbmd0aCkge1xuICAgIGNvbnN0IG1hcExheWVycyA9IGdldE1hcExheWVyc0Zyb21TcGxpdE1hcHMoc3BsaXRNYXBzLCBtYXBJbmRleCB8fCAwKTtcblxuICAgIGNvbnN0IGN1cnJlbnRMYXllcnNGb3JEZWNrID0gbGF5ZXJzRm9yRGVjayB8fCBwcmVwYXJlTGF5ZXJzRm9yRGVjayhsYXllcnMsIGxheWVyRGF0YSk7XG5cbiAgICBkYXRhTGF5ZXJzID0gbGF5ZXJPcmRlclxuICAgICAgLnNsaWNlKClcbiAgICAgIC5yZXZlcnNlKClcbiAgICAgIC5maWx0ZXIoaWQgPT4gY3VycmVudExheWVyc0ZvckRlY2tbaWRdKVxuICAgICAgLnJlZHVjZSgob3ZlcmxheXMsIGxheWVySWQpID0+IHtcbiAgICAgICAgY29uc3QgbGF5ZXJJbmRleCA9IGxheWVycy5maW5kSW5kZXgoKHtpZH0pID0+IGlkID09PSBsYXllcklkKTtcbiAgICAgICAgY29uc3QgYmluZGVkTGF5ZXJDYWxsYmFja3MgPSBsYXllckNhbGxiYWNrc1xuICAgICAgICAgID8gYmluZExheWVyQ2FsbGJhY2tzKGxheWVyQ2FsbGJhY2tzLCBsYXllckluZGV4KVxuICAgICAgICAgIDoge307XG4gICAgICAgIGNvbnN0IGxheWVyID0gbGF5ZXJzW2xheWVySW5kZXhdO1xuICAgICAgICBjb25zdCBkYXRhID0gbGF5ZXJEYXRhW2xheWVySW5kZXhdO1xuICAgICAgICBjb25zdCBsYXllck92ZXJsYXkgPSByZW5kZXJEZWNrR2xMYXllcihcbiAgICAgICAgICB7XG4gICAgICAgICAgICBkYXRhc2V0cyxcbiAgICAgICAgICAgIGxheWVyLFxuICAgICAgICAgICAgbGF5ZXJJbmRleCxcbiAgICAgICAgICAgIGRhdGEsXG4gICAgICAgICAgICBob3ZlckluZm8sXG4gICAgICAgICAgICBjbGlja2VkLFxuICAgICAgICAgICA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