kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
688 lines (681 loc) • 102 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.geojsonVisConfigs = exports.geoJsonRequiredColumns = exports.featureAccessor = exports.defaultRadius = exports.defaultLineWidth = exports.defaultElevation = exports["default"] = exports.COLUMN_MODE_TABLE = void 0;
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _helpers = require("@turf/helpers");
var _booleanWithin = _interopRequireDefault(require("@turf/boolean-within"));
var _lodash = _interopRequireDefault(require("lodash.uniq"));
var _typeAnalyzer = require("type-analyzer");
var _baseLayer = _interopRequireWildcard(require("../base-layer"));
var _layers = require("@deck.gl/layers");
var _geojsonUtils = require("./geojson-utils");
var _layerUtils = require("../layer-utils");
var _geojsonLayerIcon = _interopRequireDefault(require("./geojson-layer-icon"));
var _constants = require("@kepler.gl/constants");
var _utils = require("@kepler.gl/utils");
var _deckglLayers = require("@kepler.gl/deckgl-layers");
var _geojsonInfoModal = _interopRequireDefault(require("./geojson-info-modal"));
var _excluded = ["data"];
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
function _superPropGet(t, e, r, o) { var p = (0, _get2["default"])((0, _getPrototypeOf2["default"])(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }
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
var SUPPORTED_ANALYZER_TYPES = (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, _typeAnalyzer.DATA_TYPES.GEOMETRY, true), _typeAnalyzer.DATA_TYPES.GEOMETRY_FROM_STRING, true), _typeAnalyzer.DATA_TYPES.PAIR_GEOMETRY_FROM_STRING, true);
var geojsonVisConfigs = exports.geojsonVisConfigs = {
opacity: 'opacity',
strokeOpacity: _objectSpread(_objectSpread({}, _constants.LAYER_VIS_CONFIGS.opacity), {}, {
property: 'strokeOpacity'
}),
thickness: _objectSpread(_objectSpread({}, _constants.LAYER_VIS_CONFIGS.thickness), {}, {
defaultValue: 0.5
}),
strokeColor: 'strokeColor',
colorRange: 'colorRange',
strokeColorRange: 'strokeColorRange',
radius: 'radius',
sizeRange: 'strokeWidthRange',
radiusRange: 'radiusRange',
heightRange: 'elevationRange',
elevationScale: 'elevationScale',
stroked: 'stroked',
filled: 'filled',
enable3d: 'enable3d',
wireframe: 'wireframe',
fixedHeight: 'fixedHeight'
};
var geoJsonRequiredColumns = exports.geoJsonRequiredColumns = ['geojson'];
var featureAccessor = exports.featureAccessor = function featureAccessor(_ref) {
var geojson = _ref.geojson;
return function (dc) {
return function (d) {
return dc.valueAt(d.index, geojson.fieldIdx);
};
};
};
var geoColumnAccessor = function geoColumnAccessor(_ref2) {
var geojson = _ref2.geojson;
return function (dc) {
var _dc$getColumn;
return (_dc$getColumn = dc.getColumn) === null || _dc$getColumn === void 0 ? void 0 : _dc$getColumn.call(dc, geojson.fieldIdx);
};
};
var getTableModeValueAccessor = function getTableModeValueAccessor(feature) {
// Called from gpu-filter-utils.getFilterValueAccessor()
return function (field) {
return feature.properties.values.map(function (v) {
return field.valueAccessor(v);
});
};
};
var getTableModeFieldValue = function getTableModeFieldValue(field, data) {
var rv;
if (typeof data === 'function') {
rv = data(field);
} else {
rv = (0, _baseLayer.defaultGetFieldValue)(field, data);
}
return rv;
};
var geoFieldAccessor = function geoFieldAccessor(_ref3) {
var geojson = _ref3.geojson;
return function (dc) {
return dc.getField ? dc.getField(geojson.fieldIdx) : null;
};
};
// access feature properties from geojson sub layer
var defaultElevation = exports.defaultElevation = 500;
var defaultLineWidth = exports.defaultLineWidth = 1;
var defaultRadius = exports.defaultRadius = 1;
var COLUMN_MODE_TABLE = exports.COLUMN_MODE_TABLE = 'table';
var SUPPORTED_COLUMN_MODES = [{
key: _geojsonUtils.COLUMN_MODE_GEOJSON,
label: 'GeoJSON',
requiredColumns: ['geojson']
}, {
key: COLUMN_MODE_TABLE,
label: 'Table columns',
requiredColumns: ['id', 'lat', 'lng'],
optionalColumns: ['altitude', 'sortBy']
}];
var DEFAULT_COLUMN_MODE = _geojsonUtils.COLUMN_MODE_GEOJSON;
var GeoJsonLayer = exports["default"] = /*#__PURE__*/function (_Layer) {
function GeoJsonLayer(props) {
var _this;
(0, _classCallCheck2["default"])(this, GeoJsonLayer);
_this = _callSuper(this, GeoJsonLayer, [props]);
(0, _defineProperty2["default"])(_this, "dataToFeature", []);
(0, _defineProperty2["default"])(_this, "dataContainer", null);
(0, _defineProperty2["default"])(_this, "filteredIndex", null);
(0, _defineProperty2["default"])(_this, "filteredIndexTrigger", null);
(0, _defineProperty2["default"])(_this, "centroids", []);
(0, _defineProperty2["default"])(_this, "_layerInfoModal", void 0);
_this.registerVisConfig(geojsonVisConfigs);
_this.getPositionAccessor = function (dataContainer) {
return featureAccessor(_this.config.columns)(dataContainer);
};
_this._layerInfoModal = (0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, COLUMN_MODE_TABLE, (0, _geojsonInfoModal["default"])(COLUMN_MODE_TABLE)), _geojsonUtils.COLUMN_MODE_GEOJSON, (0, _geojsonInfoModal["default"])(_geojsonUtils.COLUMN_MODE_GEOJSON));
return _this;
}
(0, _inherits2["default"])(GeoJsonLayer, _Layer);
return (0, _createClass2["default"])(GeoJsonLayer, [{
key: "type",
get: function get() {
return GeoJsonLayer.type;
}
}, {
key: "name",
get: function get() {
return 'Polygon';
}
}, {
key: "layerIcon",
get: function get() {
return _geojsonLayerIcon["default"];
}
}, {
key: "columnPairs",
get: function get() {
return this.defaultPointColumnPairs;
}
}, {
key: "supportedColumnModes",
get: function get() {
return SUPPORTED_COLUMN_MODES;
}
}, {
key: "layerInfoModal",
get: function get() {
return (0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, _geojsonUtils.COLUMN_MODE_GEOJSON, {
id: 'iconInfo',
template: this._layerInfoModal[_geojsonUtils.COLUMN_MODE_GEOJSON],
modalProps: {
title: 'modal.polygonInfo.title'
}
}), COLUMN_MODE_TABLE, {
id: 'iconInfo',
template: this._layerInfoModal[COLUMN_MODE_TABLE],
modalProps: {
title: 'modal.polygonInfo.titleTable'
}
});
}
}, {
key: "accessVSFieldValue",
value: function accessVSFieldValue() {
if (this.config.columnMode === _geojsonUtils.COLUMN_MODE_GEOJSON) {
return _baseLayer.defaultGetFieldValue;
}
return getTableModeFieldValue;
}
}, {
key: "visualChannels",
get: function get() {
var visualChannels = _superPropGet(GeoJsonLayer, "visualChannels", this, 1);
return {
color: _objectSpread(_objectSpread({}, visualChannels.color), {}, {
accessor: 'getFillColor',
condition: function condition(config) {
return config.visConfig.filled;
},
nullValue: visualChannels.color.nullValue,
getAttributeValue: function getAttributeValue(config) {
return function (d) {
return d.properties.fillColor || config.color;
};
},
// used this to get updateTriggers
defaultValue: function defaultValue(config) {
return config.color;
}
}),
strokeColor: {
property: 'strokeColor',
field: 'strokeColorField',
scale: 'strokeColorScale',
domain: 'strokeColorDomain',
range: 'strokeColorRange',
key: 'strokeColor',
channelScaleType: _constants.CHANNEL_SCALES.color,
accessor: 'getLineColor',
condition: function condition(config) {
return config.visConfig.stroked;
},
nullValue: visualChannels.color.nullValue,
getAttributeValue: function getAttributeValue(config) {
return function (d) {
return d.properties.lineColor || config.visConfig.strokeColor || config.color;
};
},
// used this to get updateTriggers
defaultValue: function defaultValue(config) {
return config.visConfig.strokeColor || config.color;
}
},
size: _objectSpread(_objectSpread({}, visualChannels.size), {}, {
property: 'stroke',
accessor: 'getLineWidth',
condition: function condition(config) {
return config.visConfig.stroked;
},
nullValue: 0,
getAttributeValue: function getAttributeValue() {
return function (d) {
return d.properties.lineWidth || defaultLineWidth;
};
}
}),
height: {
property: 'height',
field: 'heightField',
scale: 'heightScale',
domain: 'heightDomain',
range: 'heightRange',
key: 'height',
fixed: 'fixedHeight',
channelScaleType: _constants.CHANNEL_SCALES.size,
accessor: 'getElevation',
condition: function condition(config) {
return config.visConfig.enable3d;
},
nullValue: 0,
getAttributeValue: function getAttributeValue() {
return function (d) {
return d.properties.elevation || defaultElevation;
};
}
},
radius: {
property: 'radius',
field: 'radiusField',
scale: 'radiusScale',
domain: 'radiusDomain',
range: 'radiusRange',
key: 'radius',
channelScaleType: _constants.CHANNEL_SCALES.radius,
accessor: 'getPointRadius',
nullValue: 0,
getAttributeValue: function getAttributeValue() {
return function (d) {
return d.properties.radius || defaultRadius;
};
}
}
};
}
}, {
key: "getDefaultLayerConfig",
value: function getDefaultLayerConfig(props) {
var _props$columnMode;
var defaultLayerConfig = _superPropGet(GeoJsonLayer, "getDefaultLayerConfig", this, 3)([props !== null && props !== void 0 ? props : {}]);
return _objectSpread(_objectSpread({}, defaultLayerConfig), {}, {
columnMode: (_props$columnMode = props === null || props === void 0 ? void 0 : props.columnMode) !== null && _props$columnMode !== void 0 ? _props$columnMode : DEFAULT_COLUMN_MODE,
// add height visual channel
heightField: null,
heightDomain: [0, 1],
heightScale: 'linear',
// add radius visual channel
radiusField: null,
radiusDomain: [0, 1],
radiusScale: 'linear',
// add stroke color visual channel
strokeColorField: null,
strokeColorDomain: [0, 1],
strokeColorScale: 'quantile',
colorUI: _objectSpread(_objectSpread({}, defaultLayerConfig.colorUI), {}, {
strokeColorRange: _constants.DEFAULT_COLOR_UI
})
});
}
}, {
key: "getHoverData",
value: function getHoverData(object, dataContainer) {
var _object$properties;
// index of dataContainer is saved to feature.properties
// for arrow format, `object` is the index of the row returned from deck
var index = this.geoArrowMode ? object : object === null || object === void 0 || (_object$properties = object.properties) === null || _object$properties === void 0 ? void 0 : _object$properties.index;
if (index >= 0) {
return dataContainer.row(index);
}
return null;
}
}, {
key: "getFilteredItemCount",
value: function getFilteredItemCount() {
// return -polygons-fill or -polygons-stroke
// + -linestrings
// + -points-circle
if (Object.keys(this.filteredItemCount).length) {
var polygonCount = this.filteredItemCount["".concat(this.id, "-polygons-fill")] || this.filteredItemCount["".concat(this.id, "-polygons-stroke")] || 0;
var linestringCount = this.filteredItemCount["".concat(this.id, "-linestrings")] || 0;
var pointCount = this.filteredItemCount["".concat(this.id, "-points-circle")] || 0;
return polygonCount + linestringCount + pointCount;
}
return null;
}
}, {
key: "calculateDataAttribute",
value: function calculateDataAttribute(dataset) {
var _this2 = this;
this.geoArrowMode = (0, _geojsonUtils.fieldIsGeoArrow)(geoFieldAccessor(this.config.columns)(dataset.dataContainer));
var dataContainer = dataset.dataContainer,
filteredIndex = dataset.filteredIndex;
if (this.geoArrowMode) {
// TODO add columnMode logic here for ArrowDataContainer?
// filter geojson/arrow table by values and make a partial copy of the raw table are expensive
// so we will use filteredIndex to create an attribute e.g. filteredIndex [0|1] for GPU filtering
// in deck.gl layer, see: FilterArrowExtension in @kepler.gl/deckgl-layers
if (!this.filteredIndex || this.filteredIndex.length !== dataContainer.numRows()) {
// for incremental data loading, we need to update filteredIndex
this.filteredIndex = new Uint8ClampedArray(dataContainer.numRows());
this.filteredIndex.fill(1);
}
// check if filteredIndex is a range from 0 to numRows if it is, we don't need to update it
var isRange = filteredIndex && filteredIndex.length === dataContainer.numRows();
if (!isRange || this.filteredIndexTrigger !== null) {
this.filteredIndex.fill(0);
for (var i = 0; i < filteredIndex.length; ++i) {
this.filteredIndex[filteredIndex[i]] = 1;
}
this.filteredIndexTrigger = filteredIndex;
}
// for arrow, always return full dataToFeature instead of a filtered one, so there is no need to update attributes in GPU
return this.dataToFeature;
}
// for geojson, this should work as well and more efficient. But we need to update some test cases e.g. #GeojsonLayer -> formatLayerData
switch (this.config.columnMode) {
case _geojsonUtils.COLUMN_MODE_GEOJSON:
{
return filteredIndex.map(function (i) {
return _this2.dataToFeature[i];
}).filter(function (d) {
return d;
});
}
case COLUMN_MODE_TABLE:
return (0, _geojsonUtils.applyFiltersToTableColumns)(dataset, this.dataToFeature);
default:
return [];
}
}
}, {
key: "formatLayerData",
value: function formatLayerData(datasets, oldLayerData) {
var _this3 = this;
if (this.config.dataId === null) {
return {};
}
var _datasets$this$config = datasets[this.config.dataId],
gpuFilter = _datasets$this$config.gpuFilter,
dataContainer = _datasets$this$config.dataContainer;
var _this$updateData = this.updateData(datasets, oldLayerData),
data = _this$updateData.data;
var filterValueAccessor;
var dataAccessor;
if (this.config.columnMode === _geojsonUtils.COLUMN_MODE_GEOJSON) {
filterValueAccessor = function filterValueAccessor(dc, d, fieldIndex) {
return dc.valueAt(d.properties.index, fieldIndex);
};
dataAccessor = function dataAccessor() {
return function (d) {
return {
index: d.properties.index
};
};
};
} else {
filterValueAccessor = getTableModeValueAccessor;
dataAccessor = function dataAccessor() {
return function (d) {
return {
index: d.properties.index
};
};
};
}
var indexAccessor = function indexAccessor(f) {
return f.properties.index;
};
var accessors = this.getAttributeAccessors({
dataAccessor: dataAccessor,
dataContainer: dataContainer
});
var isFilteredAccessor = function isFilteredAccessor(d) {
return _this3.filteredIndex ? _this3.filteredIndex[d.properties.index] : 1;
};
return _objectSpread({
data: data,
getFilterValue: gpuFilter.filterValueAccessor(dataContainer)(indexAccessor, filterValueAccessor),
getFiltered: isFilteredAccessor
}, accessors);
}
}, {
key: "isInPolygon",
value: function isInPolygon(data, index, polygon) {
var _polygon$properties, _polygon$properties2;
if (this.centroids.length === 0 || !this.centroids[index]) {
return false;
}
var isReactangleSearchBox = ((_polygon$properties = polygon.properties) === null || _polygon$properties === void 0 ? void 0 : _polygon$properties.shape) === 'Rectangle';
var point = this.centroids[index];
// if no valid centroid, return false
if (!point) return false;
// quick check if centroid is within the query rectangle
if (isReactangleSearchBox && (_polygon$properties2 = polygon.properties) !== null && _polygon$properties2 !== void 0 && _polygon$properties2.bbox) {
var _polygon$properties3;
var _ref5 = (polygon === null || polygon === void 0 || (_polygon$properties3 = polygon.properties) === null || _polygon$properties3 === void 0 ? void 0 : _polygon$properties3.bbox) || [],
_ref6 = (0, _slicedToArray2["default"])(_ref5, 4),
minX = _ref6[0],
minY = _ref6[1],
maxX = _ref6[2],
maxY = _ref6[3];
return point[0] >= minX && point[0] <= maxX && point[1] >= minY && point[1] <= maxY;
}
// use turf.js to check if centroid is within query polygon
return (0, _booleanWithin["default"])((0, _helpers.point)(point), polygon);
}
}, {
key: "updateLayerMeta",
value: function updateLayerMeta(dataset) {
var dataContainer = dataset.dataContainer;
this.dataContainer = dataContainer;
this.geoArrowMode = (0, _geojsonUtils.fieldIsGeoArrow)(geoFieldAccessor(this.config.columns)(dataset.dataContainer));
if (this.geoArrowMode && dataContainer instanceof _utils.ArrowDataContainer) {
var geoColumn = geoColumnAccessor(this.config.columns)(dataContainer);
var geoField = geoFieldAccessor(this.config.columns)(dataContainer);
// update the latest batch/chunk of geoarrow data when loading data incrementally
if (geoColumn && geoField && this.dataToFeature.length < dataContainer.numChunks()) {
// for incrementally loading data, we only load and render the latest batch; otherwise, we will load and render all batches
var isIncrementalLoad = dataContainer.numChunks() - this.dataToFeature.length === 1;
// TODO: add support for COLUMN_MODE_TABLE in getGeojsonLayerMetaFromArrow
var _getGeojsonLayerMetaF = (0, _layerUtils.getGeojsonLayerMetaFromArrow)(_objectSpread({
dataContainer: dataContainer,
geoColumn: geoColumn,
geoField: geoField
}, isIncrementalLoad ? {
chunkIndex: this.dataToFeature.length
} : null)),
dataToFeature = _getGeojsonLayerMetaF.dataToFeature,
bounds = _getGeojsonLayerMetaF.bounds,
fixedRadius = _getGeojsonLayerMetaF.fixedRadius,
featureTypes = _getGeojsonLayerMetaF.featureTypes,
centroids = _getGeojsonLayerMetaF.centroids;
if (centroids) this.centroids = this.centroids.concat(centroids);
this.updateMeta({
bounds: bounds,
fixedRadius: fixedRadius,
featureTypes: featureTypes
});
this.dataToFeature = [].concat((0, _toConsumableArray2["default"])(this.dataToFeature), (0, _toConsumableArray2["default"])(dataToFeature));
}
} else if (this.dataToFeature.length === 0 || this.config.columnMode === COLUMN_MODE_TABLE) {
var getFeature = this.getPositionAccessor(dataContainer);
var _getGeojsonLayerMeta = (0, _geojsonUtils.getGeojsonLayerMeta)({
dataContainer: dataContainer,
getFeature: getFeature,
config: this.config
}),
_dataToFeature = _getGeojsonLayerMeta.dataToFeature,
_bounds = _getGeojsonLayerMeta.bounds,
_fixedRadius = _getGeojsonLayerMeta.fixedRadius,
_featureTypes = _getGeojsonLayerMeta.featureTypes,
_centroids = _getGeojsonLayerMeta.centroids;
if (_centroids) this.centroids = _centroids;
this.dataToFeature = _dataToFeature;
this.updateMeta({
bounds: _bounds,
fixedRadius: _fixedRadius,
featureTypes: _featureTypes
});
}
}
}, {
key: "setInitialLayerConfig",
value: function setInitialLayerConfig(dataset) {
var dataContainer = dataset.dataContainer;
if (!dataContainer.numRows()) {
return this;
}
// defefaultLayerProps will automatically find geojson column
// if not found, we try to set it to id / lat /lng /ts
if (!this.config.columns.geojson.value) {
// find columns from lat, lng, id, and ts
var columnConfig = (0, _geojsonUtils.detectTableColumns)(dataset, this.config.columns, 'sortBy');
if (columnConfig) {
this.updateLayerConfig(_objectSpread(_objectSpread({}, columnConfig), {}, {
columnMode: COLUMN_MODE_TABLE
}));
} else {
return this;
}
}
this.updateLayerMeta(dataset);
var featureTypes = this.meta.featureTypes;
// default settings is stroke: true, filled: false
if (featureTypes && featureTypes.polygon) {
// set both fill and stroke to true
return this.updateLayerVisConfig({
filled: true,
stroked: true,
strokeColor: _baseLayer.colorMaker.next().value
});
} else if (featureTypes && featureTypes.point) {
// set fill to true if detect point
return this.updateLayerVisConfig({
filled: true,
stroked: false
});
}
return this;
}
}, {
key: "isLayerHovered",
value: function isLayerHovered(objectInfo) {
return this.geoArrowMode ? (0, _layerUtils.isLayerHoveredFromArrow)(objectInfo, this.id) : _superPropGet(GeoJsonLayer, "isLayerHovered", this, 3)([objectInfo]);
}
}, {
key: "hasHoveredObject",
value: function hasHoveredObject(objectInfo) {
return this.geoArrowMode ? (0, _layerUtils.getHoveredObjectFromArrow)(objectInfo, this.dataContainer, this.id, geoColumnAccessor(this.config.columns), geoFieldAccessor(this.config.columns)) : _superPropGet(GeoJsonLayer, "hasHoveredObject", this, 3)([objectInfo]);
}
}, {
key: "getElevationZoomFactor",
value: function getElevationZoomFactor(_ref7) {
var zoom = _ref7.zoom,
_ref7$zoomOffset = _ref7.zoomOffset,
zoomOffset = _ref7$zoomOffset === void 0 ? 0 : _ref7$zoomOffset;
return this.config.visConfig.fixedHeight ? 1 : Math.pow(2, Math.max(8 - zoom + zoomOffset, 0));
}
}, {
key: "renderLayer",
value: function renderLayer(opts) {
var _this4 = this;
var dataProps = opts.data,
gpuFilter = opts.gpuFilter,
objectHovered = opts.objectHovered,
mapState = opts.mapState,
interactionConfig = opts.interactionConfig;
var _this$meta = this.meta,
fixedRadius = _this$meta.fixedRadius,
featureTypes = _this$meta.featureTypes;
var radiusScale = this.getRadiusScaleByZoom(mapState, fixedRadius);
var zoomFactor = this.getZoomFactor(mapState);
var eleZoomFactor = this.getElevationZoomFactor(mapState);
var visConfig = this.config.visConfig;
var layerProps = {
lineWidthScale: visConfig.thickness * zoomFactor * 8,
elevationScale: visConfig.elevationScale * eleZoomFactor,
pointRadiusScale: radiusScale,
lineMiterLimit: 4
};
var updateTriggers = _objectSpread(_objectSpread({}, this.getVisualChannelUpdateTriggers()), {}, {
getFilterValue: gpuFilter.filterValueUpdateTriggers,
getFiltered: this.filteredIndexTrigger
});
var defaultLayerProps = this.getDefaultDeckLayerProps(opts);
var opaOverwrite = {
opacity: visConfig.strokeOpacity
};
var pickable = interactionConfig.tooltip.enabled;
var hoveredObject = this.hasHoveredObject(objectHovered);
var data = dataProps.data,
props = (0, _objectWithoutProperties2["default"])(dataProps, _excluded);
// arrow table can have multiple chunks, a deck.gl layer is created for each chunk
var deckLayerData = this.geoArrowMode ? data : [data];
var deckLayers = deckLayerData.map(function (d, i) {
return new _layers.GeoJsonLayer(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, defaultLayerProps), layerProps), props), {}, {
data: d,
id: deckLayerData.length > 1 ? "".concat(_this4.id, "-").concat(i) : _this4.id,
pickable: pickable,
highlightColor: _constants.HIGHLIGH_COLOR_3D,
autoHighlight: visConfig.enable3d && pickable,
stroked: visConfig.stroked,
filled: visConfig.filled,
extruded: visConfig.enable3d,
wireframe: visConfig.wireframe,
wrapLongitude: false,
lineMiterLimit: 2,
capRounded: true,
jointRounded: true,
updateTriggers: updateTriggers,
extensions: [].concat((0, _toConsumableArray2["default"])(defaultLayerProps.extensions), [new _deckglLayers.FilterArrowExtension()]),
_subLayerProps: _objectSpread(_objectSpread(_objectSpread({}, featureTypes !== null && featureTypes !== void 0 && featureTypes.polygon ? {
'polygons-stroke': opaOverwrite
} : {}), featureTypes !== null && featureTypes !== void 0 && featureTypes.line ? {
linestrings: opaOverwrite
} : {}), featureTypes !== null && featureTypes !== void 0 && featureTypes.point ? {
points: {
lineOpacity: visConfig.strokeOpacity
}
} : {})
}));
});
return [].concat((0, _toConsumableArray2["default"])(deckLayers), (0, _toConsumableArray2["default"])(hoveredObject && !visConfig.enable3d ? [new _layers.GeoJsonLayer(_objectSpread(_objectSpread(_objectSpread({}, this.getDefaultHoverLayerProps()), layerProps), {}, {
visible: defaultLayerProps.visible,
wrapLongitude: false,
data: [hoveredObject],
getLineWidth: props.getLineWidth,
getPointRadius: props.getPointRadius,
getElevation: props.getElevation,
getLineColor: this.config.highlightColor,
getFillColor: this.config.highlightColor,
// always draw outline
stroked: true,
filled: false
}))] : []));
}
}], [{
key: "type",
get: function get() {
return 'geojson';
}
}, {
key: "findDefaultLayerProps",
value: function findDefaultLayerProps(_ref8) {
var _this5 = this;
var label = _ref8.label,
_ref8$fields = _ref8.fields,
fields = _ref8$fields === void 0 ? [] : _ref8$fields;
var geojsonColumns = fields.filter(function (f) {
return (f.type === 'geojson' || f.type === 'geoarrow') && f.analyzerType && SUPPORTED_ANALYZER_TYPES[f.analyzerType];
}).map(function (f) {
return f.name;
});
var defaultColumns = {
geojson: (0, _lodash["default"])([].concat((0, _toConsumableArray2["default"])(_constants.GEOJSON_FIELDS.geojson), (0, _toConsumableArray2["default"])(geojsonColumns)))
};
var foundColumns = this.findDefaultColumnField(defaultColumns, fields);
if (!foundColumns || !foundColumns.length) {
return {
props: []
};
}
return {
props: foundColumns.map(function (columns) {
return {
label: typeof label === 'string' && label.replace(/\.[^/.]+$/, '') || _this5.type,
columns: columns,
isVisible: true
};
})
};
}
}]);
}(_baseLayer["default"]);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfaGVscGVycyIsInJlcXVpcmUiLCJfYm9vbGVhbldpdGhpbiIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJfbG9kYXNoIiwiX3R5cGVBbmFseXplciIsIl9iYXNlTGF5ZXIiLCJfaW50ZXJvcFJlcXVpcmVXaWxkY2FyZCIsIl9sYXllcnMiLCJfZ2VvanNvblV0aWxzIiwiX2xheWVyVXRpbHMiLCJfZ2VvanNvbkxheWVySWNvbiIsIl9jb25zdGFudHMiLCJfdXRpbHMiLCJfZGVja2dsTGF5ZXJzIiwiX2dlb2pzb25JbmZvTW9kYWwiLCJfZXhjbHVkZWQiLCJfZ2V0UmVxdWlyZVdpbGRjYXJkQ2FjaGUiLCJlIiwiV2Vha01hcCIsInIiLCJ0IiwiX19lc01vZHVsZSIsIl90eXBlb2YiLCJoYXMiLCJnZXQiLCJuIiwiX19wcm90b19fIiwiYSIsIk9iamVjdCIsImRlZmluZVByb3BlcnR5IiwiZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yIiwidSIsImhhc093bl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