kepler.gl.geoiq
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
1,058 lines (929 loc) • 116 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.layerColors = exports["default"] = exports.colorMaker = exports.OVERLAY_TYPE = void 0;
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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _window = require("global/window");
var _keymirror = _interopRequireDefault(require("keymirror"));
var _defaultLayerIcon = _interopRequireDefault(require("./default-layer-icon"));
var _defaultSettings = require("../constants/default-settings");
var _colorRanges = require("../constants/color-ranges");
var _customColorRanges = require("../constants/custom-color-ranges");
var _layerFactory = require("./layer-factory");
var _utils = require("../utils/utils");
var _dataUtils = require("../utils/data-utils");
var _dataScaleUtils = require("../utils/data-scale-utils");
var _colorUtils = require("../utils/color-utils");
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; }
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == (0, _typeof2["default"])(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError((0, _typeof2["default"])(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
var _marked = /*#__PURE__*/_regeneratorRuntime().mark(generateColor);
/**
* Approx. number of points to sample in a large data set
* @type {number}
*/
var MAX_SAMPLE_SIZE = 5000;
var OVERLAY_TYPE = exports.OVERLAY_TYPE = (0, _keymirror["default"])({
deckgl: null,
mapboxgl: null
});
var layerColors = exports.layerColors = Object.values(_customColorRanges.DataVizColors).map(_colorUtils.hexToRgb);
function generateColor() {
var index;
return _regeneratorRuntime().wrap(function generateColor$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
index = 0;
case 1:
if (!(index < layerColors.length + 1)) {
_context.next = 7;
break;
}
if (index === layerColors.length) {
index = 0;
}
_context.next = 5;
return layerColors[index++];
case 5:
_context.next = 1;
break;
case 7:
case "end":
return _context.stop();
}
}, _marked);
}
var colorMaker = exports.colorMaker = generateColor();
var defaultGetFieldValue = function defaultGetFieldValue(field, d) {
return d[field.tableFieldIndex - 1];
};
var Layer = exports["default"] = /*#__PURE__*/function () {
function Layer() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
(0, _classCallCheck2["default"])(this, Layer);
(0, _defineProperty2["default"])(this, "inDebounce", 0);
this.id = props.id || (0, _utils.generateHashId)(6); // meta
this.meta = {}; // visConfigSettings
this.visConfigSettings = {};
this.config = this.getDefaultLayerConfig(_objectSpread({
columns: this.getLayerColumns()
}, props));
}
(0, _createClass2["default"])(Layer, [{
key: "layerIcon",
get: function get() {
return _defaultLayerIcon["default"];
}
}, {
key: "overlayType",
get: function get() {
return OVERLAY_TYPE.deckgl;
}
}, {
key: "type",
get: function get() {
return null;
}
}, {
key: "name",
get: function get() {
return this.type;
}
}, {
key: "isAggregated",
get: function get() {
return false;
}
}, {
key: "showLoader",
get: function get() {
return false;
}
}, {
key: "requiredLayerColumns",
get: function get() {
return [];
}
}, {
key: "optionalColumns",
get: function get() {
return [];
}
}, {
key: "noneLayerDataAffectingProps",
get: function get() {
return ['label', 'opacity', 'thickness', 'isVisible'];
}
}, {
key: "visualChannels",
get: function get() {
return {
color: {
property: 'color',
field: 'colorField',
scale: 'colorScale',
domain: 'colorDomain',
range: 'colorRange',
key: 'color',
channelScaleType: _defaultSettings.CHANNEL_SCALES.color
},
size: {
property: 'size',
field: 'sizeField',
scale: 'sizeScale',
domain: 'sizeDomain',
range: 'sizeRange',
key: 'size',
channelScaleType: _defaultSettings.CHANNEL_SCALES.size
}
};
}
/*
* Column pairs maps layer column to a specific field pairs,
* By default, it is set to null
*/
}, {
key: "columnPairs",
get: function get() {
return null;
}
/*
* Default point column pairs, can be used for point based layers: point, icon etc.
*/
}, {
key: "defaultPointColumnPairs",
get: function get() {
return {
lat: {
pair: 'lng',
fieldPairKey: 'lat'
},
lng: {
pair: 'lat',
fieldPairKey: 'lng'
}
};
}
/*
* Default link column pairs, can be used for link based layers: arc, line etc
*/
}, {
key: "defaultLinkColumnPairs",
get: function get() {
return {
lat0: {
pair: 'lng0',
fieldPairKey: 'lat'
},
lng0: {
pair: 'lat0',
fieldPairKey: 'lng'
},
lat1: {
pair: 'lng1',
fieldPairKey: 'lat'
},
lng1: {
pair: 'lat1',
fieldPairKey: 'lng'
}
};
}
/**
* Return a React component for to render layer instructions in a modal
* @returns {object} - an object
* @example
* return {
* id: 'iconInfo',
* template: IconInfoModal,
* modalProps: {
* title: 'How to draw icons'
* };
* }
*/
}, {
key: "layerInfoModal",
get: function get() {
return null;
}
/*
* Given a dataset, automatically find props to create layer based on it
* and return the props and previous found layers.
* By default, no layers will be found
*/
}, {
key: "getDefaultLayerConfig",
value: function getDefaultLayerConfig() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return {
dataId: props.dataId || null,
label: props.label || 'new layer',
color: props.color || colorMaker.next().value,
columns: props.columns || null,
isVisible: props.isVisible || false,
isConfigActive: props.isConfigActive || false,
highlightColor: props.highlightColor || [252, 242, 26, 255],
// TODO: refactor this into separate visual Channel config
// color by field, domain is set by filters, field, scale type
colorField: null,
colorDomain: [0, 1],
colorScale: _defaultSettings.SCALE_TYPES.quantile,
// color by size, domain is set by filters, field, scale type
sizeDomain: [0, 1],
sizeScale: _defaultSettings.SCALE_TYPES.linear,
sizeField: null,
visConfig: {},
textLabel: [_layerFactory.DEFAULT_TEXT_LABEL],
colorUI: {
color: _layerFactory.DEFAULT_COLOR_UI,
colorRange: _layerFactory.DEFAULT_COLOR_UI
},
animation: {
enabled: false
}
};
}
/**
* Get the description of a visualChannel config
* @param key
* @returns {{label: string, measure: (string|string)}}
*/
}, {
key: "getVisualChannelDescription",
value: function getVisualChannelDescription(key) {
// e.g. label: Color, measure: Vehicle Type
return {
label: this.visConfigSettings[this.visualChannels[key].range].label,
measure: this.config[this.visualChannels[key].field] ? this.config[this.visualChannels[key].field].name : this.visualChannels[key].defaultMeasure
};
}
/**
* Assign a field to layer column, return column config
* @param key - Column Key
* @param field - Selected field
* @returns {{}} - Column config
*/
}, {
key: "assignColumn",
value: function assignColumn(key, field) {
// field value could be null for optional columns
var update = field ? {
value: field.name,
fieldIdx: field.tableFieldIndex - 1
} : {
value: null,
fieldIdx: -1
};
return _objectSpread(_objectSpread({}, this.config.columns), {}, (0, _defineProperty2["default"])({}, key, _objectSpread(_objectSpread({}, this.config.columns[key]), update)));
}
/**
* Assign a field pair to column config, return column config
* @param key - Column Key
* @param pair - field Pair
* @returns {{}} - Column config
*/
}, {
key: "assignColumnPairs",
value: function assignColumnPairs(key, pair) {
var _objectSpread3;
if (!this.columnPairs || !this.columnPairs[key]) {
// should not end in this state
return this.config.columns;
}
var _this$columnPairs$key = this.columnPairs[key],
partnerKey = _this$columnPairs$key.pair,
fieldPairKey = _this$columnPairs$key.fieldPairKey;
var partnerFieldPairKey = this.columnPairs[partnerKey].fieldPairKey;
return _objectSpread(_objectSpread({}, this.config.columns), {}, (_objectSpread3 = {}, (0, _defineProperty2["default"])(_objectSpread3, key, pair[fieldPairKey]), (0, _defineProperty2["default"])(_objectSpread3, partnerKey, pair[partnerFieldPairKey]), _objectSpread3));
}
/**
* Calculate a radius zoom multiplier to render points, so they are visible in all zoom level
* @param mapState
* @param mapState.zoom - actual zoom
* @param mapState.zoomOffset - zoomOffset when render in the plot container for export image
* @returns {number}
*/
}, {
key: "getZoomFactor",
value: function getZoomFactor(_ref) {
var zoom = _ref.zoom,
_ref$zoomOffset = _ref.zoomOffset,
zoomOffset = _ref$zoomOffset === void 0 ? 0 : _ref$zoomOffset;
return Math.pow(2, Math.max(14 - zoom + zoomOffset, 0));
}
/**
* Calculate a elevation zoom multiplier to render points, so they are visible in all zoom level
* @param mapState
* @param mapState.zoom - actual zoom
* @param mapState.zoomOffset - zoomOffset when render in the plot container for export image
* @returns {number}
*/
}, {
key: "getElevationZoomFactor",
value: function getElevationZoomFactor(_ref2) {
var zoom = _ref2.zoom,
_ref2$zoomOffset = _ref2.zoomOffset,
zoomOffset = _ref2$zoomOffset === void 0 ? 0 : _ref2$zoomOffset;
return Math.pow(2, Math.max(8 - zoom + zoomOffset, 0));
}
}, {
key: "formatLayerData",
value: function formatLayerData(data, allData, filteredIndex) {
return {};
}
}, {
key: "axiosApiCall",
value: function axiosApiCall() {
return null;
}
}, {
key: "renderLayer",
value: function renderLayer() {
return [];
}
}, {
key: "getHoverData",
value: function getHoverData(object) {
if (!object) {
return null;
} // by default, each entry of layerData should have a data property points
// to the original item in the allData array
// each layer can implement its own getHoverData method
return object.data;
}
/**
* When change layer type, try to copy over layer configs as much as possible
* @param configToCopy - config to copy over
* @param visConfigSettings - visConfig settings of config to copy
*/
}, {
key: "assignConfigToLayer",
value: function assignConfigToLayer(configToCopy, visConfigSettings) {
var _this = this;
// don't deep merge visualChannel field
// don't deep merge color range, reversed: is not a key by default
var shallowCopy = ['colorRange', 'strokeColorRange'].concat(Object.values(this.visualChannels).map(function (v) {
return v.field;
})); // don't copy over domain and animation
var notToCopy = ['animation'].concat(Object.values(this.visualChannels).map(function (v) {
return v.domain;
})); // if range is for the same property group copy it, otherwise, not to copy
Object.values(this.visualChannels).forEach(function (v) {
if (configToCopy.visConfig[v.range] && visConfigSettings[v.range].group !== _this.visConfigSettings[v.range].group) {
notToCopy.push(v.range);
}
}); // don't copy over visualChannel range
var currentConfig = this.config;
var copied = this.copyLayerConfig(currentConfig, configToCopy, {
shallowCopy: shallowCopy,
notToCopy: notToCopy
});
this.updateLayerConfig(copied); // validate visualChannel field type and scale types
Object.keys(this.visualChannels).forEach(function (channel) {
_this.validateVisualChannel(channel);
});
}
/*
* Recursively copy config over to an empty layer
* when received saved config, or copy config over from a different layer type
* make sure to only copy over value to existing keys
* @param {object} currentConfig - existing config to be override
* @param {object} configToCopy - new Config to copy over
* @param {string[]} shallowCopy - array of properties to not to be deep copied
* @param {string[]} notToCopy - array of properties not to copy
* @returns {object} - copied config
*/
}, {
key: "copyLayerConfig",
value: function copyLayerConfig(currentConfig, configToCopy) {
var _this2 = this;
var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
_ref3$shallowCopy = _ref3.shallowCopy,
shallowCopy = _ref3$shallowCopy === void 0 ? [] : _ref3$shallowCopy,
_ref3$notToCopy = _ref3.notToCopy,
notToCopy = _ref3$notToCopy === void 0 ? [] : _ref3$notToCopy;
var copied = {};
Object.keys(currentConfig).forEach(function (key) {
if ((0, _utils.isPlainObject)(currentConfig[key]) && (0, _utils.isPlainObject)(configToCopy[key]) && !shallowCopy.includes(key) && !notToCopy.includes(key)) {
// recursively assign object value
copied[key] = _this2.copyLayerConfig(currentConfig[key], configToCopy[key], {
shallowCopy: shallowCopy,
notToCopy: notToCopy
});
} else if ((0, _dataUtils.notNullorUndefined)(configToCopy[key]) && !notToCopy.includes(key)) {
// copy
copied[key] = configToCopy[key];
} else {
// keep existing
copied[key] = currentConfig[key];
}
});
return copied;
}
}, {
key: "registerVisConfig",
value: function registerVisConfig(layerVisConfigs) {
var _this3 = this;
Object.keys(layerVisConfigs).forEach(function (item) {
if (typeof item === 'string' && _layerFactory.LAYER_VIS_CONFIGS[layerVisConfigs[item]]) {
// if assigned one of default LAYER_CONFIGS
_this3.config.visConfig[item] = _layerFactory.LAYER_VIS_CONFIGS[layerVisConfigs[item]].defaultValue;
_this3.visConfigSettings[item] = _layerFactory.LAYER_VIS_CONFIGS[layerVisConfigs[item]];
} else if (['type', 'defaultValue'].every(function (p) {
return layerVisConfigs[item].hasOwnProperty(p);
})) {
// if provided customized visConfig, and has type && defaultValue
// TODO: further check if customized visConfig is valid
_this3.config.visConfig[item] = layerVisConfigs[item].defaultValue;
_this3.visConfigSettings[item] = layerVisConfigs[item];
}
});
}
}, {
key: "getLayerColumns",
value: function getLayerColumns() {
var required = this.requiredLayerColumns.reduce(function (accu, key) {
return _objectSpread(_objectSpread({}, accu), {}, (0, _defineProperty2["default"])({}, key, {
value: null,
fieldIdx: -1
}));
}, {});
var optional = this.optionalColumns.reduce(function (accu, key) {
return _objectSpread(_objectSpread({}, accu), {}, (0, _defineProperty2["default"])({}, key, {
value: null,
fieldIdx: -1,
optional: true
}));
}, {});
return _objectSpread(_objectSpread({}, required), optional);
}
}, {
key: "updateLayerConfig",
value: function updateLayerConfig(newConfig) {
if (Object.keys(newConfig).includes('colorField') && this.type !== 'pincode' && this.type !== 'boundary') {
newConfig = _objectSpread(_objectSpread({}, newConfig), {
apiCallRequest: true
});
}
this.config = _objectSpread(_objectSpread({}, this.config), newConfig);
return this;
}
}, {
key: "updateLayerVisConfig",
value: function updateLayerVisConfig(newVisConfig) {
this.config.visConfig = _objectSpread(_objectSpread({}, this.config.visConfig), newVisConfig);
return this;
}
}, {
key: "updateLayerColorUI",
value: function updateLayerColorUI(prop, newConfig) {
var _this$config = this.config,
previous = _this$config.colorUI,
visConfig = _this$config.visConfig;
if (!(0, _utils.isPlainObject)(newConfig) || typeof prop !== 'string') {
return this;
}
var colorUIProp = Object.entries(newConfig).reduce(function (accu, _ref4) {
var _ref5 = (0, _slicedToArray2["default"])(_ref4, 2),
key = _ref5[0],
value = _ref5[1];
return _objectSpread(_objectSpread({}, accu), {}, (0, _defineProperty2["default"])({}, key, (0, _utils.isPlainObject)(accu[key]) && (0, _utils.isPlainObject)(value) ? _objectSpread(_objectSpread({}, accu[key]), value) : value));
}, previous[prop] || _layerFactory.DEFAULT_COLOR_UI);
var colorUI = _objectSpread(_objectSpread({}, previous), {}, (0, _defineProperty2["default"])({}, prop, colorUIProp));
this.updateLayerConfig({
colorUI: colorUI
}); // if colorUI[prop] is colorRange
var isColorRange = visConfig[prop] && visConfig[prop].colors;
if (isColorRange) {
this.updateColorUIByColorRange(newConfig, prop);
this.updateColorRangeByColorUI(newConfig, previous, prop);
this.updateCustomPalette(newConfig, previous, prop);
}
return this;
}
}, {
key: "updateCustomPalette",
value: function updateCustomPalette(newConfig, previous, prop) {
if (!newConfig.colorRangeConfig || !newConfig.colorRangeConfig.custom) {
return;
}
var _this$config2 = this.config,
colorUI = _this$config2.colorUI,
visConfig = _this$config2.visConfig;
if (!visConfig[prop]) return;
var colors = visConfig[prop].colors;
var customPalette = _objectSpread(_objectSpread({}, colorUI[prop].customPalette), {}, {
name: 'Custom Palette',
colors: (0, _toConsumableArray2["default"])(colors)
});
this.updateLayerConfig({
colorUI: _objectSpread(_objectSpread({}, colorUI), {}, (0, _defineProperty2["default"])({}, prop, _objectSpread(_objectSpread({}, colorUI[prop]), {}, {
customPalette: customPalette
})))
});
}
/**
* if open dropdown and prop is color range
* Automatically set colorRangeConfig's step and reversed
* @param {*} newConfig
* @param {*} prop
*/
}, {
key: "updateColorUIByColorRange",
value: function updateColorUIByColorRange(newConfig, prop) {
if (typeof newConfig.showDropdown !== 'number') return;
var _this$config3 = this.config,
colorUI = _this$config3.colorUI,
visConfig = _this$config3.visConfig;
this.updateLayerConfig({
colorUI: _objectSpread(_objectSpread({}, colorUI), {}, (0, _defineProperty2["default"])({}, prop, _objectSpread(_objectSpread({}, colorUI[prop]), {}, {
colorRangeConfig: _objectSpread(_objectSpread({}, colorUI[prop].colorRangeConfig), {}, {
steps: visConfig[prop].colors.length,
reversed: Boolean(visConfig[prop].reversed)
})
})))
});
}
}, {
key: "updateColorRangeByColorUI",
value: function updateColorRangeByColorUI(newConfig, previous, prop) {
// only update colorRange if changes in UI is made to 'reversed', 'steps' or steps
var shouldUpdate = newConfig.colorRangeConfig && ['reversed', 'steps'].some(function (key) {
return newConfig.colorRangeConfig.hasOwnProperty(key) && newConfig.colorRangeConfig[key] !== (previous[prop] || _layerFactory.DEFAULT_COLOR_UI).colorRangeConfig[key];
});
if (!shouldUpdate) return;
var _this$config4 = this.config,
colorUI = _this$config4.colorUI,
visConfig = _this$config4.visConfig;
var _colorUI$prop$colorRa = colorUI[prop].colorRangeConfig,
steps = _colorUI$prop$colorRa.steps,
reversed = _colorUI$prop$colorRa.reversed;
var colorRange = visConfig[prop]; // find based on step or reversed
var update;
if (newConfig.colorRangeConfig.hasOwnProperty('steps')) {
var group = (0, _colorUtils.getColorGroupByName)(colorRange);
if (group) {
var sameGroup = _colorRanges.COLOR_RANGES.filter(function (cr) {
return (0, _colorUtils.getColorGroupByName)(cr) === group;
});
update = sameGroup.find(function (cr) {
return cr.colors.length === steps;
});
if (update && colorRange.reversed) {
update = (0, _colorUtils.reverseColorRange)(true, update);
}
}
}
if (newConfig.colorRangeConfig.hasOwnProperty('reversed')) {
update = (0, _colorUtils.reverseColorRange)(reversed, update || colorRange);
}
if (update) {
this.updateLayerVisConfig((0, _defineProperty2["default"])({}, prop, update));
}
}
/**
* Check whether layer has all columns
*
* @param {object} layer
* @returns {boolean} yes or no
*/
}, {
key: "hasAllColumns",
value: function hasAllColumns() {
var columns = this.config.columns;
return columns && Object.values(columns).every(function (v) {
return Boolean(v.optional || v.value && v.fieldIdx > -1);
});
}
}, {
key: "shouldRenderColumnConfig",
value: function shouldRenderColumnConfig() {
return true;
}
/**
* Check whether layer has data
*
* @param {object} layer
* @param {Array | Object} layerData
* @returns {boolean} yes or no
*/
}, {
key: "hasLayerData",
value: function hasLayerData(layerData) {
if (!layerData) {
return false;
}
return Boolean(layerData.collected && layerData.collected.length || layerData.data && layerData.data.length);
}
}, {
key: "isValidToSave",
value: function isValidToSave() {
return this.type;
}
}, {
key: "shouldRenderLayer",
value: function shouldRenderLayer(data) {
return this.type && this.config.isVisible && this.hasLayerData(data) && typeof this.renderLayer === 'function';
}
}, {
key: "getVisChannelScale",
value: function getVisChannelScale(scale, domain, range, fixed) {
return _defaultSettings.SCALE_FUNC[fixed ? 'linear' : scale]().domain(domain).range(fixed ? domain : range);
}
}, {
key: "getPointsBounds",
value: function getPointsBounds(allData, getPosition) {
// no need to loop through the entire dataset
// get a sample of data to calculate bounds
var sampleData = allData.length > MAX_SAMPLE_SIZE ? (0, _dataUtils.getSampleData)(allData, MAX_SAMPLE_SIZE) : allData;
var points = sampleData.map(getPosition);
var latBounds = (0, _dataUtils.getLatLngBounds)(points, 1, [-90, 90]);
var lngBounds = (0, _dataUtils.getLatLngBounds)(points, 0, [-180, 180]);
if (!latBounds || !lngBounds) {
return null;
}
return [lngBounds[0], latBounds[0], lngBounds[1], latBounds[1]];
}
}, {
key: "getEncodedChannelValue",
value: function getEncodedChannelValue(scale, data, field) {
var nullValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _defaultSettings.NO_VALUE_COLOR;
var getValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : defaultGetFieldValue;
var type = field.type;
var value = getValue(field, data);
if (!(0, _dataUtils.notNullorUndefined)(value)) {
return nullValue;
}
var attributeValue;
if (type === _defaultSettings.ALL_FIELD_TYPES.timestamp) {
// shouldn't need to convert here
// scale Function should take care of it
attributeValue = scale(new Date(value));
} else {
attributeValue = scale(value);
}
if (!(0, _dataUtils.notNullorUndefined)(attributeValue)) {
attributeValue = nullValue;
}
return attributeValue;
}
}, {
key: "updateMeta",
value: function updateMeta(meta) {
this.meta = _objectSpread(_objectSpread({}, this.meta), meta);
}
/**
* helper function to update one layer domain when state.data changed
* if state.data change is due ot update filter, newFiler will be passed
* called by updateAllLayerDomainData
* @param {Object} dataset
* @param {Object} newFilter
* @returns {object} layer
* @returns {object} widget
*/
}, {
key: "updateLayerDomain",
value: function updateLayerDomain(dataset, newFilter) {
var _this4 = this;
Object.values(this.visualChannels).forEach(function (channel) {
var scale = channel.scale;
var scaleType = _this4.config[scale]; // ordinal domain is based on allData, if only filter changed
// no need to update ordinal domain
if (!newFilter || scaleType !== _defaultSettings.SCALE_TYPES.ordinal) {
var domain = channel.domain;
var updatedDomain = _this4.calculateLayerDomain(dataset, channel);
_this4.updateLayerConfig((0, _defineProperty2["default"])({}, domain, updatedDomain));
}
});
return this;
}
/**
* Validate visual channel field and scales based on supported field & scale type
* @param channel
*/
}, {
key: "validateVisualChannel",
value: function validateVisualChannel(channel) {
this.validateFieldType(channel);
this.validateScale(channel);
}
/**
* Validate field type based on channelScaleType
*/
}, {
key: "validateFieldType",
value: function validateFieldType(channel) {
var visualChannel = this.visualChannels[channel];
var field = visualChannel.field,
channelScaleType = visualChannel.channelScaleType,
supportedFieldTypes = visualChannel.supportedFieldTypes;
if (this.config[field]) {
// if field is selected, check if field type is supported
var channelSupportedFieldTypes = supportedFieldTypes || _defaultSettings.CHANNEL_SCALE_SUPPORTED_FIELDS[channelScaleType];
if (!channelSupportedFieldTypes.includes(this.config[field].type)) {
// field type is not supported, set it back to null
// set scale back to default
this.updateLayerConfig((0, _defineProperty2["default"])({}, field, null));
}
}
}
/**
* Validate scale type based on aggregation
*/
}, {
key: "validateScale",
value: function validateScale(channel) {
var visualChannel = this.visualChannels[channel];
var scale = visualChannel.scale;
if (!scale) {
// visualChannel doesn't have scale
return;
}
var scaleOptions = this.getScaleOptions(channel); // check if current selected scale is
// supported, if not, change to default
if (!scaleOptions.includes(this.config[scale])) {
this.updateLayerConfig((0, _defineProperty2["default"])({}, scale, scaleOptions[0]));
}
}
/**
* Get scale options based on current field
* @param {string} channel
* @returns {string[]}
*/
}, {
key: "getScaleOptions",
value: function getScaleOptions(channel) {
var visualChannel = this.visualChannels[channel];
var field = visualChannel.field,
scale = visualChannel.scale,
channelScaleType = visualChannel.channelScaleType;
return this.config[field] ? _defaultSettings.FIELD_OPTS[this.config[field].type].scale[channelScaleType] : [this.getDefaultLayerConfig()[scale]];
}
}, {
key: "updateLayerVisualChannel",
value: function updateLayerVisualChannel(dataset, channel) {
var visualChannel = this.visualChannels[channel];
this.validateVisualChannel(channel); // calculate layer channel domain
var updatedDomain = this.calculateLayerDomain(dataset, visualChannel);
this.updateLayerConfig((0, _defineProperty2["default"])({}, visualChannel.domain, updatedDomain));
}
}, {
key: "calculateLayerDomain",
value: function calculateLayerDomain(dataset, visualChannel) {
var allData = dataset.allData,
filteredIndexForDomain = dataset.filteredIndexForDomain;
var defaultDomain = [0, 1];
var scale = visualChannel.scale;
var scaleType = this.config[scale];
var field = this.config[visualChannel.field];
if (!field) {
// if colorField or sizeField were set back to null
return defaultDomain;
}
if (!_defaultSettings.SCALE_TYPES[scaleType]) {
_window.console.error("scale type ".concat(scaleType, " not supported"));
return defaultDomain;
} // TODO: refactor to add valueAccessor to field
var fieldIdx = field.tableFieldIndex - 1;
var isTime = field.type === _defaultSettings.ALL_FIELD_TYPES.timestamp;
var valueAccessor = _dataUtils.maybeToDate.bind(null, isTime, fieldIdx, field.format);
var indexValueAccessor = function indexValueAccessor(i) {
return valueAccessor(allData[i]);
};
var sortFunction = (0, _dataUtils.getSortingFunction)(field.type);
switch (scaleType) {
case _defaultSettings.SCALE_TYPES.ordinal:
case _defaultSettings.SCALE_TYPES.point:
// do not recalculate ordinal domain based on filtered data
// don't need to update ordinal domain every time
return (0, _dataScaleUtils.getOrdinalDomain)(allData, valueAccessor);
case _defaultSettings.SCALE_TYPES.quantile:
return (0, _dataScaleUtils.getQuantileDomain)(filteredIndexForDomain, indexValueAccessor, sortFunction);
case _defaultSettings.SCALE_TYPES.log:
return (0, _dataScaleUtils.getLogDomain)(filteredIndexForDomain, indexValueAccessor);
case _defaultSettings.SCALE_TYPES.quantize:
case _defaultSettings.SCALE_TYPES.linear:
case _defaultSettings.SCALE_TYPES.sqrt:
default:
return (0, _dataScaleUtils.getLinearDomain)(filteredIndexForDomain, indexValueAccessor);
}
}
}, {
key: "isLayerHovered",
value: function isLayerHovered(objectInfo) {
return objectInfo && objectInfo.layer && objectInfo.picked && objectInfo.layer.props.id === this.id;
}
}, {
key: "getRadiusScaleByZoom",
value: function getRadiusScaleByZoom(mapState, fixedRadius) {
var radiusChannel = Object.values(this.visualChannels).find(function (vc) {
return vc.property === 'radius';
});
if (!radiusChannel) {
return 1;
}
var field = radiusChannel.field;
var fixed = fixedRadius === undefined ? this.config.visConfig.fixedRadius : fixedRadius;
var radius = this.config.visConfig.radius;
return fixed ? 1 : (this.config[field] ? 1 : radius) * this.getZoomFactor(mapState);
}
}, {
key: "shouldCalculateLayerData",
value: function shouldCalculateLayerData(props) {
var _this5 = this;
return props.some(function (p) {
return !_this5.noneLayerDataAffectingProps.includes(p);
});
}
}], [{
key: "findDefaultLayerProps",
value: function findDefaultLayerProps(dataset, foundLayers) {
return {
props: [],
foundLayers: foundLayers
};
}
/**
* Given a array of preset required column names
* found field that has the same name to set as layer column
*
* @param {object[]} defaultFields
* @param {object[]} allFields
* @returns {object[] | null} all possible required layer column pairs
*/
}, {
key: "findDefaultColumnField",
value: function findDefaultColumnField(defaultFields, allFields) {
// find all matched fields for each required col
var requiredColumns = Object.keys(defaultFields).reduce(function (prev, key) {
var requiredFields = allFields.filter(function (f) {
return f.name === defaultFields[key] || defaultFields[key].includes(f.name);
});
prev[key] = requiredFields.length ? requiredFields.map(function (f) {
return {
value: f.name,
fieldIdx: f.tableFieldIndex - 1
};
}) : null;
return prev;
}, {});
if (!Object.values(requiredColumns).every(Boolean)) {
// if any field missing, return null
return null;
}
return this.getAllPossibleColumnPairs(requiredColumns);
}
}, {
key: "getAllPossibleColumnPairs",
value: function getAllPossibleColumnPairs(requiredColumns) {
// for multiple matched field for one required column, return multiple
// combinations, e. g. if column a has 2 matched, column b has 3 matched
// 6 possible column pairs will be returned
var allKeys = Object.keys(requiredColumns);
var pointers = allKeys.map(function (k, i) {
return i === allKeys.length - 1 ? -1 : 0;
});
var countPerKey = allKeys.map(function (k) {
return requiredColumns[k].length;
});
var pairs = [];
/* eslint-disable no-loop-func */
while (incrementPointers(pointers, countPerKey, pointers.length - 1)) {
var newPair = pointers.reduce(function (prev, cuur, i) {
prev[allKeys[i]] = requiredColumns[allKeys[i]][cuur];
return prev;
}, {});
pairs.push(newPair);
}
/* eslint-enable no-loop-func */
// recursively increment pointers
function incrementPointers(pts, counts, index) {
if (index === 0 && pts[0] === counts[0] - 1) {
// nothing to increment
return false;
}
if (pts[index] + 1 < counts[index]) {
pts[index] = pts[index] + 1;
return true;
}
pts[index] = 0;
return incrementPointers(pts, counts, index - 1);
}
return pairs;
}
}, {
key: "hexToRgb",
value: function hexToRgb(c) {
return (0, _colorUtils.hexToRgb)(c);
}
}]);
return Layer;
}();
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sYXllcnMvYmFzZS1sYXllci5qcyJdLCJuYW1lcyI6WyJnZW5lcmF0ZUNvbG9yIiwiTUFYX1NBTVBMRV9TSVpFIiwiT1ZFUkxBWV9UWVBFIiwiZGVja2dsIiwibWFwYm94Z2wiLCJsYXllckNvbG9ycyIsIk9iamVjdCIsInZhbHVlcyIsIkRhdGFWaXpDb2xvcnMiLCJtYXAiLCJoZXhUb1JnYiIsImluZGV4IiwibGVuZ3RoIiwiY29sb3JNYWtlciIsImRlZmF1bHRHZXRGaWVsZFZhbHVlIiwiZmllbGQiLCJkIiwidGFibGVGaWVsZEluZGV4IiwiTGF5ZXIiLCJwcm9wcyIsImlkIiwibWV0YSIsInZpc0NvbmZpZ1NldHRpbmdzIiwiY29uZmlnIiwiZ2V0RGVmYXVsdExheWVyQ29uZmlnIiwiY29sdW1ucyIsImdldExheWVyQ29sdW1ucyIsIkRlZmF1bHRMYXllckljb24iLCJ0eXBlIiwiY29sb3IiLCJwcm9wZXJ0eSIsInNjYWxlIiwiZG9tYWluIiwicmFuZ2UiLCJrZXkiLCJjaGFubmVs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