@kepler.gl/deckgl-arrow-layers 3.3.0-alpha.2 → 3.3.0-alpha.21
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/dist/cjs/constants.js +15 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/index.js +27 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/layers/geo-arrow-arc-layer.js +145 -0
- package/dist/cjs/layers/geo-arrow-arc-layer.js.map +1 -0
- package/dist/cjs/layers/geo-arrow-scatterplot-layer.js +270 -0
- package/dist/cjs/layers/geo-arrow-scatterplot-layer.js.map +1 -0
- package/dist/cjs/layers/geo-arrow-text-layer.js +176 -0
- package/dist/cjs/layers/geo-arrow-text-layer.js.map +1 -0
- package/dist/cjs/types.js +6 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/utils/picking.js +54 -0
- package/dist/cjs/utils/picking.js.map +1 -0
- package/dist/cjs/utils/utils.js +271 -0
- package/dist/cjs/utils/utils.js.map +1 -0
- package/dist/cjs/utils/validate.js +103 -0
- package/dist/cjs/utils/validate.js.map +1 -0
- package/dist/esm/constants.js +9 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/layers/geo-arrow-arc-layer.js +141 -0
- package/dist/esm/layers/geo-arrow-arc-layer.js.map +1 -0
- package/dist/esm/layers/geo-arrow-scatterplot-layer.js +266 -0
- package/dist/esm/layers/geo-arrow-scatterplot-layer.js.map +1 -0
- package/dist/esm/layers/geo-arrow-text-layer.js +172 -0
- package/dist/esm/layers/geo-arrow-text-layer.js.map +1 -0
- package/dist/esm/types.js +3 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils/picking.js +46 -0
- package/dist/esm/utils/picking.js.map +1 -0
- package/dist/esm/utils/utils.js +246 -0
- package/dist/esm/utils/utils.js.map +1 -0
- package/dist/esm/utils/validate.js +95 -0
- package/dist/esm/utils/validate.js.map +1 -0
- package/dist/layers/geo-arrow-scatterplot-layer.d.ts +15 -2
- package/dist/types.d.ts +3 -0
- package/dist/utils/utils.d.ts +1 -11
- package/package.json +22 -15
- package/dist/constants.js +0 -15
- package/dist/index.js +0 -27
- package/dist/layers/geo-arrow-arc-layer.js +0 -146
- package/dist/layers/geo-arrow-scatterplot-layer.js +0 -223
- package/dist/layers/geo-arrow-text-layer.js +0 -174
- package/dist/types.js +0 -6
- package/dist/utils/picking.js +0 -54
- package/dist/utils/utils.js +0 -313
- package/dist/utils/validate.js +0 -104
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.GeoArrowTextLayer = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
|
+
var _core = require("@deck.gl/core");
|
|
18
|
+
var _layers = require("@deck.gl/layers");
|
|
19
|
+
var ga = _interopRequireWildcard(require("@geoarrow/geoarrow-js"));
|
|
20
|
+
var _constants = require("@kepler.gl/constants");
|
|
21
|
+
var _utils = require("../utils/utils");
|
|
22
|
+
var _picking = require("../utils/picking");
|
|
23
|
+
var _validate = require("../utils/validate");
|
|
24
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
25
|
+
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)); }
|
|
26
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
27
|
+
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; }
|
|
28
|
+
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
|
|
29
|
+
// Copyright contributors to the kepler.gl project
|
|
30
|
+
// deck.gl-community
|
|
31
|
+
// SPDX-License-Identifier: MIT
|
|
32
|
+
// Copyright (c) vis.gl contributors
|
|
33
|
+
/** All properties supported by GeoArrowTextLayer */
|
|
34
|
+
|
|
35
|
+
/** Properties added by GeoArrowTextLayer */
|
|
36
|
+
|
|
37
|
+
// Remove data and getPosition from the upstream default props
|
|
38
|
+
var _TextLayer$defaultPro = _layers.TextLayer.defaultProps,
|
|
39
|
+
_data = _TextLayer$defaultPro.data,
|
|
40
|
+
_getPosition = _TextLayer$defaultPro.getPosition,
|
|
41
|
+
_getText = _TextLayer$defaultPro.getText,
|
|
42
|
+
_getTextAnchor = _TextLayer$defaultPro.getTextAnchor,
|
|
43
|
+
_getAlignmentBaseline = _TextLayer$defaultPro.getAlignmentBaseline,
|
|
44
|
+
_getPixelOffset = _TextLayer$defaultPro.getPixelOffset,
|
|
45
|
+
_defaultProps = (0, _objectWithoutProperties2["default"])(_TextLayer$defaultPro, ["data", "getPosition", "getText", "getTextAnchor", "getAlignmentBaseline", "getPixelOffset"]);
|
|
46
|
+
|
|
47
|
+
// Default props added by us
|
|
48
|
+
var ourDefaultProps = {
|
|
49
|
+
getTextAnchor: 'middle',
|
|
50
|
+
getAlignmentBaseline: 'center',
|
|
51
|
+
getPixelOffset: [0, 0],
|
|
52
|
+
_validate: true
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// @ts-expect-error Type 'Uint8Array' is not assignable to type 'RGBAColor'
|
|
56
|
+
var defaultProps = _objectSpread(_objectSpread({}, _defaultProps), ourDefaultProps);
|
|
57
|
+
var GeoArrowTextLayer = exports.GeoArrowTextLayer = /*#__PURE__*/function (_CompositeLayer) {
|
|
58
|
+
function GeoArrowTextLayer() {
|
|
59
|
+
(0, _classCallCheck2["default"])(this, GeoArrowTextLayer);
|
|
60
|
+
return _callSuper(this, GeoArrowTextLayer, arguments);
|
|
61
|
+
}
|
|
62
|
+
(0, _inherits2["default"])(GeoArrowTextLayer, _CompositeLayer);
|
|
63
|
+
return (0, _createClass2["default"])(GeoArrowTextLayer, [{
|
|
64
|
+
key: "getPickingInfo",
|
|
65
|
+
value: function getPickingInfo(params) {
|
|
66
|
+
return (0, _picking.getPickingInfo)(params, this.props.data);
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "renderLayers",
|
|
70
|
+
value: function renderLayers() {
|
|
71
|
+
var table = this.props.data;
|
|
72
|
+
if (this.props.getPosition !== undefined) {
|
|
73
|
+
var geometryColumn = this.props.getPosition;
|
|
74
|
+
if (geometryColumn !== undefined && ga.vector.isPointVector(geometryColumn)) {
|
|
75
|
+
return this._renderLayersPoint(geometryColumn);
|
|
76
|
+
}
|
|
77
|
+
throw new Error('getPosition should pass in an arrow Vector of Point type');
|
|
78
|
+
} else {
|
|
79
|
+
var pointVector = (0, _utils.getGeometryVector)(table, _constants.GEOARROW_EXTENSIONS.POINT);
|
|
80
|
+
if (pointVector !== null) {
|
|
81
|
+
return this._renderLayersPoint(pointVector);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
throw new Error('getPosition not GeoArrow point');
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
87
|
+
key: "_renderLayersPoint",
|
|
88
|
+
value: function _renderLayersPoint(geometryColumn) {
|
|
89
|
+
var table = this.props.data;
|
|
90
|
+
if (this.props._validate) {
|
|
91
|
+
(0, _utils.assert)(ga.vector.isPointVector(geometryColumn));
|
|
92
|
+
(0, _validate.validateAccessors)(this.props, table);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Exclude manually-set accessors
|
|
96
|
+
var _extractAccessorsFrom = (0, _utils.extractAccessorsFromProps)(this.props, ['getPosition', 'getText']),
|
|
97
|
+
_extractAccessorsFrom2 = (0, _slicedToArray2["default"])(_extractAccessorsFrom, 2),
|
|
98
|
+
accessors = _extractAccessorsFrom2[0],
|
|
99
|
+
otherProps = _extractAccessorsFrom2[1];
|
|
100
|
+
var tableOffsets = (0, _picking.computeChunkOffsets)(table.data);
|
|
101
|
+
var layers = [];
|
|
102
|
+
for (var recordBatchIdx = 0; recordBatchIdx < table.batches.length; recordBatchIdx++) {
|
|
103
|
+
var _this$props$_subLayer;
|
|
104
|
+
var geometryData = geometryColumn.data[recordBatchIdx];
|
|
105
|
+
var flatCoordsData = ga.child.getPointChild(geometryData);
|
|
106
|
+
var flatCoordinateArray = flatCoordsData.values;
|
|
107
|
+
var textData = this.props.getText.data[recordBatchIdx];
|
|
108
|
+
var numLabels = textData.length;
|
|
109
|
+
var textValues = textData.values;
|
|
110
|
+
var characterOffsets = textData.valueOffsets;
|
|
111
|
+
|
|
112
|
+
// @ts-expect-error how to properly retrieve batch offset?
|
|
113
|
+
var batchOffset = geometryColumn._offsets[recordBatchIdx];
|
|
114
|
+
var props = _objectSpread(_objectSpread(_objectSpread({}, ourDefaultProps), otherProps), {}, {
|
|
115
|
+
// used for picking purposes
|
|
116
|
+
recordBatchIdx: recordBatchIdx,
|
|
117
|
+
tableOffsets: tableOffsets,
|
|
118
|
+
id: "".concat(this.props.id, "-geoarrow-text-layer-").concat(recordBatchIdx),
|
|
119
|
+
data: {
|
|
120
|
+
data: table.batches[recordBatchIdx],
|
|
121
|
+
length: geometryData.length,
|
|
122
|
+
startIndices: characterOffsets,
|
|
123
|
+
attributes: {
|
|
124
|
+
// Positions need to be expanded to be one per character!
|
|
125
|
+
getPosition: {
|
|
126
|
+
value: (0, _utils.expandArrayToCoords)(flatCoordinateArray, geometryData.type.listSize, characterOffsets, numLabels),
|
|
127
|
+
size: geometryData.type.listSize
|
|
128
|
+
},
|
|
129
|
+
// TODO: support non-ascii characters
|
|
130
|
+
getText: {
|
|
131
|
+
value: textValues
|
|
132
|
+
// size: 1,
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
// TODO privide more robust data comparators
|
|
137
|
+
dataComparator: function dataComparator(d1, d2) {
|
|
138
|
+
return d1.data === d2.data;
|
|
139
|
+
},
|
|
140
|
+
// Keep any `_subLayerProps` the caller passed in (e.g. a globe-aware
|
|
141
|
+
// `characters` sublayer class) instead of replacing them wholesale.
|
|
142
|
+
_subLayerProps: _objectSpread(_objectSpread({}, this.props._subLayerProps), {}, {
|
|
143
|
+
characters: _objectSpread(_objectSpread({}, (_this$props$_subLayer = this.props._subLayerProps) === null || _this$props$_subLayer === void 0 ? void 0 : _this$props$_subLayer.characters), {}, {
|
|
144
|
+
dataComparator: function dataComparator(d1, d2) {
|
|
145
|
+
return d1.data === d2.data;
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
});
|
|
150
|
+
for (var _i = 0, _Object$entries = Object.entries(accessors); _i < _Object$entries.length; _i++) {
|
|
151
|
+
var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
|
|
152
|
+
propName = _Object$entries$_i[0],
|
|
153
|
+
propInput = _Object$entries$_i[1];
|
|
154
|
+
(0, _utils.assignAccessor)({
|
|
155
|
+
props: props,
|
|
156
|
+
propName: propName,
|
|
157
|
+
propInput: propInput,
|
|
158
|
+
chunkIdx: recordBatchIdx,
|
|
159
|
+
geomCoordOffsets: characterOffsets,
|
|
160
|
+
batchOffset: batchOffset
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
var layer = new _layers.TextLayer(_objectSpread(_objectSpread({}, this.getSubLayerProps(props)), {}, {
|
|
164
|
+
// preserve binded accessors, as they are overwriten back by pass-through accessors from extensions
|
|
165
|
+
getFiltered: props.getFiltered,
|
|
166
|
+
getFilterValue: props.getFilterValue
|
|
167
|
+
}));
|
|
168
|
+
layers.push(layer);
|
|
169
|
+
}
|
|
170
|
+
return layers;
|
|
171
|
+
}
|
|
172
|
+
}]);
|
|
173
|
+
}(_core.CompositeLayer);
|
|
174
|
+
(0, _defineProperty2["default"])(GeoArrowTextLayer, "defaultProps", defaultProps);
|
|
175
|
+
(0, _defineProperty2["default"])(GeoArrowTextLayer, "layerName", 'GeoArrowTextLayer');
|
|
176
|
+
//# sourceMappingURL=geo-arrow-text-layer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geo-arrow-text-layer.js","names":["_core","require","_layers","ga","_interopRequireWildcard","_constants","_utils","_picking","_validate","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_callSuper","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","_TextLayer$defaultPro","TextLayer","defaultProps","_data","data","_getPosition","getPosition","_getText","getText","_getTextAnchor","getTextAnchor","_getAlignmentBaseline","getAlignmentBaseline","_getPixelOffset","getPixelOffset","_defaultProps","_objectWithoutProperties2","ourDefaultProps","GeoArrowTextLayer","exports","_CompositeLayer","_classCallCheck2","_inherits2","_createClass2","key","value","getPickingInfo","params","props","renderLayers","table","undefined","geometryColumn","vector","isPointVector","_renderLayersPoint","Error","pointVector","getGeometryVector","GEOARROW_EXTENSIONS","POINT","assert","validateAccessors","_extractAccessorsFrom","extractAccessorsFromProps","_extractAccessorsFrom2","_slicedToArray2","accessors","otherProps","tableOffsets","computeChunkOffsets","layers","recordBatchIdx","batches","_this$props$_subLayer","geometryData","flatCoordsData","child","getPointChild","flatCoordinateArray","values","textData","numLabels","textValues","characterOffsets","valueOffsets","batchOffset","_offsets","id","concat","startIndices","attributes","expandArrayToCoords","type","listSize","size","dataComparator","d1","d2","_subLayerProps","characters","_i","_Object$entries","entries","_Object$entries$_i","propName","propInput","assignAccessor","chunkIdx","geomCoordOffsets","layer","getSubLayerProps","getFiltered","getFilterValue","CompositeLayer"],"sources":["../../../src/layers/geo-arrow-text-layer.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\n// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n CompositeLayer,\n CompositeLayerProps,\n DefaultProps,\n GetPickingInfoParams,\n Layer,\n LayersList\n} from '@deck.gl/core';\nimport {TextLayer} from '@deck.gl/layers';\nimport type {TextLayerProps} from '@deck.gl/layers';\nimport * as arrow from 'apache-arrow';\nimport * as ga from '@geoarrow/geoarrow-js';\n\nimport {GEOARROW_EXTENSIONS} from '@kepler.gl/constants';\n\nimport {\n assignAccessor,\n expandArrayToCoords,\n extractAccessorsFromProps,\n getGeometryVector\n} from '../utils/utils';\nimport {GeoArrowExtraPickingProps, computeChunkOffsets, getPickingInfo} from '../utils/picking';\nimport {ColorAccessor, FloatAccessor, GeoArrowPickingInfo} from '../types';\nimport {assert} from '../utils/utils';\nimport {validateAccessors} from '../utils/validate';\n\n/** All properties supported by GeoArrowTextLayer */\nexport type GeoArrowTextLayerProps = Omit<\n TextLayerProps<arrow.Table>,\n // We remove background for now because there are special requirements for\n // using binary attributes with background\n // https://deck.gl/docs/api-reference/layers/text-layer#use-binary-attributes-with-background\n | 'background'\n | 'data'\n | 'getBackgroundColor'\n | 'getBorderColor'\n | 'getBorderWidth'\n | 'getText'\n | 'getPosition'\n | 'getColor'\n | 'getSize'\n | 'getAngle'\n | 'getTextAnchor'\n | 'getAlignmentBaseline'\n | 'getPixelOffset'\n> &\n _GeoArrowTextLayerProps &\n CompositeLayerProps;\n\n/** Properties added by GeoArrowTextLayer */\ntype _GeoArrowTextLayerProps = {\n data: arrow.Table;\n\n /** Background color accessor.\n * @default [255, 255, 255, 255]\n */\n getBackgroundColor?: ColorAccessor;\n /** Border color accessor.\n * @default [0, 0, 0, 255]\n */\n getBorderColor?: ColorAccessor;\n /** Border width accessor.\n * @default 0\n */\n getBorderWidth?: FloatAccessor;\n /**\n * Label text accessor\n */\n getText: arrow.Vector<arrow.Utf8>;\n /**\n * Anchor position accessor\n */\n getPosition?: ga.vector.PointVector;\n /**\n * Label color accessor\n * @default [0, 0, 0, 255]\n */\n getColor?: ColorAccessor;\n /**\n * Label size accessor\n * @default 32\n */\n getSize?: FloatAccessor;\n /**\n * Label rotation accessor, in degrees\n * @default 0\n */\n getAngle?: FloatAccessor;\n /**\n * Horizontal alignment accessor\n * @default 'middle'\n */\n getTextAnchor?: arrow.Vector<arrow.Utf8> | 'start' | 'middle' | 'end';\n /**\n * Vertical alignment accessor\n * @default 'center'\n */\n getAlignmentBaseline?: arrow.Vector<arrow.Utf8> | 'top' | 'center' | 'bottom';\n /**\n * Label offset from the anchor position, [x, y] in pixels\n * @default [0, 0]\n */\n getPixelOffset?: arrow.Vector<arrow.FixedSizeList<arrow.Int>> | [number, number];\n\n /**\n * If `true`, validate the arrays provided (e.g. chunk lengths)\n * @default true\n */\n _validate?: boolean;\n};\n\n// Remove data and getPosition from the upstream default props\nconst {\n data: _data,\n getPosition: _getPosition,\n getText: _getText,\n getTextAnchor: _getTextAnchor,\n getAlignmentBaseline: _getAlignmentBaseline,\n getPixelOffset: _getPixelOffset,\n ..._defaultProps\n} = TextLayer.defaultProps;\n\n// Default props added by us\nconst ourDefaultProps: Pick<\n GeoArrowTextLayerProps,\n 'getTextAnchor' | 'getAlignmentBaseline' | 'getPixelOffset' | '_validate'\n> = {\n getTextAnchor: 'middle',\n getAlignmentBaseline: 'center',\n getPixelOffset: [0, 0],\n _validate: true\n};\n\n// @ts-expect-error Type 'Uint8Array' is not assignable to type 'RGBAColor'\nconst defaultProps: DefaultProps<GeoArrowTextLayerProps> = {\n ..._defaultProps,\n ...ourDefaultProps\n};\n\nexport class GeoArrowTextLayer<ExtraProps extends object = object> extends CompositeLayer<\n GeoArrowTextLayerProps & ExtraProps\n> {\n static defaultProps = defaultProps;\n static layerName = 'GeoArrowTextLayer';\n\n getPickingInfo(\n params: GetPickingInfoParams & {\n sourceLayer: {props: GeoArrowExtraPickingProps};\n }\n ): GeoArrowPickingInfo {\n return getPickingInfo(params, this.props.data);\n }\n\n renderLayers(): Layer<object> | LayersList | null {\n const {data: table} = this.props;\n\n if (this.props.getPosition !== undefined) {\n const geometryColumn = this.props.getPosition;\n if (geometryColumn !== undefined && ga.vector.isPointVector(geometryColumn)) {\n return this._renderLayersPoint(geometryColumn);\n }\n\n throw new Error('getPosition should pass in an arrow Vector of Point type');\n } else {\n const pointVector = getGeometryVector(table, GEOARROW_EXTENSIONS.POINT);\n if (pointVector !== null) {\n return this._renderLayersPoint(pointVector);\n }\n }\n\n throw new Error('getPosition not GeoArrow point');\n }\n\n _renderLayersPoint(geometryColumn: ga.vector.PointVector): Layer<object> | LayersList | null {\n const {data: table} = this.props;\n\n if (this.props._validate) {\n assert(ga.vector.isPointVector(geometryColumn));\n validateAccessors(this.props, table);\n }\n\n // Exclude manually-set accessors\n const [accessors, otherProps] = extractAccessorsFromProps(this.props, [\n 'getPosition',\n 'getText'\n ]);\n const tableOffsets = computeChunkOffsets(table.data);\n\n const layers: TextLayer<any>[] = [];\n for (let recordBatchIdx = 0; recordBatchIdx < table.batches.length; recordBatchIdx++) {\n const geometryData = geometryColumn.data[recordBatchIdx];\n const flatCoordsData = ga.child.getPointChild(geometryData);\n const flatCoordinateArray = flatCoordsData.values;\n\n const textData = this.props.getText.data[recordBatchIdx];\n const numLabels = textData.length;\n const textValues = textData.values;\n const characterOffsets = textData.valueOffsets;\n\n // @ts-expect-error how to properly retrieve batch offset?\n const batchOffset = geometryColumn._offsets[recordBatchIdx];\n\n const props: Record<string, any> = {\n // Note: because this is a composite layer and not doing the rendering\n // itself, we still have to pass in our defaultProps\n ...ourDefaultProps,\n ...otherProps,\n\n // used for picking purposes\n recordBatchIdx,\n tableOffsets,\n\n id: `${this.props.id}-geoarrow-text-layer-${recordBatchIdx}`,\n data: {\n data: table.batches[recordBatchIdx],\n length: geometryData.length,\n startIndices: characterOffsets,\n attributes: {\n // Positions need to be expanded to be one per character!\n getPosition: {\n value: expandArrayToCoords(\n flatCoordinateArray,\n geometryData.type.listSize,\n characterOffsets,\n numLabels\n ),\n size: geometryData.type.listSize\n },\n // TODO: support non-ascii characters\n getText: {\n value: textValues\n // size: 1,\n }\n }\n },\n // TODO privide more robust data comparators\n dataComparator: (d1: {data: unknown}, d2: {data: unknown}) => {\n return d1.data === d2.data;\n },\n // Keep any `_subLayerProps` the caller passed in (e.g. a globe-aware\n // `characters` sublayer class) instead of replacing them wholesale.\n _subLayerProps: {\n ...(this.props._subLayerProps as Record<string, any> | undefined),\n characters: {\n ...(this.props._subLayerProps as Record<string, any> | undefined)?.characters,\n dataComparator: (d1: {data: unknown}, d2: {data: unknown}) => {\n return d1.data === d2.data;\n }\n }\n }\n };\n\n for (const [propName, propInput] of Object.entries(accessors)) {\n assignAccessor({\n props,\n propName,\n propInput,\n chunkIdx: recordBatchIdx,\n geomCoordOffsets: characterOffsets,\n batchOffset\n });\n }\n\n const layer = new TextLayer({\n ...this.getSubLayerProps(props),\n // preserve binded accessors, as they are overwriten back by pass-through accessors from extensions\n getFiltered: props.getFiltered,\n getFilterValue: props.getFilterValue\n });\n layers.push(layer);\n }\n\n return layers;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAOA,IAAAA,KAAA,GAAAC,OAAA;AAQA,IAAAC,OAAA,GAAAD,OAAA;AAGA,IAAAE,EAAA,GAAAC,uBAAA,CAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAMA,IAAAM,QAAA,GAAAN,OAAA;AAGA,IAAAO,SAAA,GAAAP,OAAA;AAAoD,SAAAG,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,wBAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,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AAAA,IAAAjG,gBAAA,aAA5EqB,iBAAiB,kBAGNhB,YAAY;AAAA,IAAAL,gBAAA,aAHvBqB,iBAAiB,eAIT,mBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\n// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {BinaryAttribute, Color, PickingInfo} from '@deck.gl/core';\nimport {TypedArray} from '@math.gl/types';\nimport * as arrow from 'apache-arrow';\n\n/**\n * An individual layer's data\n */\nexport type GeoArrowLayerData<T> = {\n data: T;\n length: number;\n attributes?: Record<string, TypedArray | Buffer | BinaryAttribute>;\n};\n\n/**\n * Internal type for layer data handling, used in `wrapAccessorFunction`.\n */\nexport type _GeoArrowInternalLayerData<T> = GeoArrowLayerData<T> & {\n /**\n * A lookup table from expanded multi-geometry index to original index.\n *\n * This is omitted from the user-facing type because in `wrapAccessorFunction`\n * in `utils.ts` we apply the lookup from \"exploded\" row to \"original\" row.\n */\n invertedGeomOffsets?: Uint8Array | Uint16Array | Uint32Array;\n};\n\nexport type AccessorContext<T> = {\n /** The current row index of the current iteration */\n index: number;\n /** The value of the `data` prop */\n data: GeoArrowLayerData<T>;\n /** A pre-allocated array. The accessor function can optionally fill data into this array and return it,\n * instead of creating a new array for every object. In some browsers this improves performance significantly\n * by reducing garbage collection. */\n target: number[];\n};\n\n/**\n * Internal type for layer data handling, used in `wrapAccessorFunction`.\n */\nexport type _InternalAccessorContext<T> = AccessorContext<T> & {\n /** The value of the `data` prop */\n data: _GeoArrowInternalLayerData<T>;\n};\n\n/** Function that returns a value for each object. */\nexport type AccessorFunction<In, Out> = (\n /** Contextual information of the current element. */\n objectInfo: AccessorContext<In>\n) => Out;\n\n/** Either a uniform value for all objects, or a function that returns a value for each object. */\nexport type Accessor<In, Out> = Out | AccessorFunction<In, Out>;\n\nexport type GeoArrowPickingInfo = PickingInfo & {\n object?: arrow.StructRowProxy;\n};\n\nexport type FloatAccessor = arrow.Vector<arrow.Float> | Accessor<arrow.RecordBatch, number>;\nexport type TimestampAccessor = arrow.Vector<arrow.List<arrow.Float>>;\nexport type ColorAccessor =\n | arrow.Vector<arrow.FixedSizeList<arrow.Uint8>>\n | Accessor<arrow.RecordBatch, Color | Color[]>;\nexport type NormalAccessor =\n | arrow.Vector<arrow.FixedSizeList<arrow.Float32>>\n | Accessor<arrow.Table, arrow.Vector<arrow.FixedSizeList<arrow.Float32>>>;\n\nexport type ExtensionProps = {\n getPulseStartTime?: (d: any, objectInfo?: {index: number}) => number[];\n getFiltered?: ({index}: {index: number}) => number;\n getFilterValue?: (d: any, objectInfo?: {index: number}) => (number | number[])[];\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.computeChunkOffsets = computeChunkOffsets;
|
|
8
|
+
exports.getPickingInfo = getPickingInfo;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
// SPDX-License-Identifier: MIT
|
|
13
|
+
// Copyright contributors to the kepler.gl project
|
|
14
|
+
|
|
15
|
+
// deck.gl-community
|
|
16
|
+
// SPDX-License-Identifier: MIT
|
|
17
|
+
// Copyright (c) vis.gl contributors
|
|
18
|
+
|
|
19
|
+
function getPickingInfo(_ref, table) {
|
|
20
|
+
var info = _ref.info,
|
|
21
|
+
sourceLayer = _ref.sourceLayer;
|
|
22
|
+
// Geometry index as rendered
|
|
23
|
+
var index = info.index;
|
|
24
|
+
|
|
25
|
+
// if a Multi- geometry dataset, map from the rendered index back to the
|
|
26
|
+
// feature index
|
|
27
|
+
if (sourceLayer.props.data.invertedGeomOffsets) {
|
|
28
|
+
index = sourceLayer.props.data.invertedGeomOffsets[index];
|
|
29
|
+
}
|
|
30
|
+
var recordBatchIdx = sourceLayer.props.recordBatchIdx;
|
|
31
|
+
var tableOffsets = sourceLayer.props.tableOffsets;
|
|
32
|
+
var batch = table.batches[recordBatchIdx];
|
|
33
|
+
var row = batch.get(index);
|
|
34
|
+
if (row === null) {
|
|
35
|
+
return info;
|
|
36
|
+
}
|
|
37
|
+
var currentBatchOffset = tableOffsets[recordBatchIdx];
|
|
38
|
+
|
|
39
|
+
// Update index to be _global_ index, not within the specific record batch
|
|
40
|
+
index += currentBatchOffset;
|
|
41
|
+
return _objectSpread(_objectSpread({}, info), {}, {
|
|
42
|
+
index: index,
|
|
43
|
+
object: row
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// This is vendored from Arrow JS because it's a private API
|
|
48
|
+
function computeChunkOffsets(chunks) {
|
|
49
|
+
return chunks.reduce(function (offsets, chunk, index) {
|
|
50
|
+
offsets[index + 1] = offsets[index] + chunk.length;
|
|
51
|
+
return offsets;
|
|
52
|
+
}, new Uint32Array(chunks.length + 1));
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=picking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"picking.js","names":["getPickingInfo","_ref","table","info","sourceLayer","index","props","data","invertedGeomOffsets","recordBatchIdx","tableOffsets","batch","batches","row","get","currentBatchOffset","_objectSpread","object","computeChunkOffsets","chunks","reduce","offsets","chunk","length","Uint32Array"],"sources":["../../../src/utils/picking.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\n// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport * as arrow from 'apache-arrow';\nimport {GetPickingInfoParams} from '@deck.gl/core';\nimport {GeoArrowPickingInfo} from '../types';\n\nexport interface GeoArrowExtraPickingProps {\n recordBatchIdx: number;\n tableOffsets: Uint32Array;\n data: {\n invertedGeomOffsets?: Uint8Array | Uint16Array | Uint32Array;\n };\n}\n\nexport function getPickingInfo(\n {\n info,\n sourceLayer\n }: GetPickingInfoParams & {\n sourceLayer: {props: GeoArrowExtraPickingProps};\n },\n table: arrow.Table\n): GeoArrowPickingInfo {\n // Geometry index as rendered\n let index = info.index;\n\n // if a Multi- geometry dataset, map from the rendered index back to the\n // feature index\n if (sourceLayer.props.data.invertedGeomOffsets) {\n index = sourceLayer.props.data.invertedGeomOffsets[index];\n }\n\n const recordBatchIdx = sourceLayer.props.recordBatchIdx;\n const tableOffsets = sourceLayer.props.tableOffsets;\n\n const batch = table.batches[recordBatchIdx];\n const row = batch.get(index);\n if (row === null) {\n return info;\n }\n\n const currentBatchOffset = tableOffsets[recordBatchIdx];\n\n // Update index to be _global_ index, not within the specific record batch\n index += currentBatchOffset;\n return {\n ...info,\n index,\n object: row\n };\n}\n\n// This is vendored from Arrow JS because it's a private API\nexport function computeChunkOffsets<T extends arrow.DataType>(\n chunks: ReadonlyArray<arrow.Data<T>>\n) {\n return chunks.reduce((offsets, chunk, index) => {\n offsets[index + 1] = offsets[index] + chunk.length;\n return offsets;\n }, new Uint32Array(chun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CAAC,CAAC,CAAC;AACxC","ignoreList":[]}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.assert = assert;
|
|
9
|
+
exports.assignAccessor = assignAccessor;
|
|
10
|
+
Object.defineProperty(exports, "convertStructToFixedSizeList", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _utils.convertStructToFixedSizeList;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
exports.expandArrayToCoords = expandArrayToCoords;
|
|
17
|
+
exports.extractAccessorsFromProps = extractAccessorsFromProps;
|
|
18
|
+
exports.findGeometryColumnIndex = findGeometryColumnIndex;
|
|
19
|
+
exports.getGeometryVector = getGeometryVector;
|
|
20
|
+
exports.getListNestingLevels = getListNestingLevels;
|
|
21
|
+
exports.getMultiLineStringResolvedOffsets = getMultiLineStringResolvedOffsets;
|
|
22
|
+
exports.getMultiPolygonResolvedOffsets = getMultiPolygonResolvedOffsets;
|
|
23
|
+
exports.getPolygonResolvedOffsets = getPolygonResolvedOffsets;
|
|
24
|
+
exports.invertOffsets = invertOffsets;
|
|
25
|
+
exports.isColumnReference = isColumnReference;
|
|
26
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
27
|
+
var arrow = _interopRequireWildcard(require("apache-arrow"));
|
|
28
|
+
var ga = _interopRequireWildcard(require("@geoarrow/geoarrow-js"));
|
|
29
|
+
var _utils = require("@kepler.gl/utils");
|
|
30
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
31
|
+
// SPDX-License-Identifier: MIT
|
|
32
|
+
// Copyright contributors to the kepler.gl project
|
|
33
|
+
|
|
34
|
+
// deck.gl-community
|
|
35
|
+
// SPDX-License-Identifier: MIT
|
|
36
|
+
// Copyright (c) vis.gl contributors
|
|
37
|
+
|
|
38
|
+
function assert(condition, message) {
|
|
39
|
+
if (!condition) throw new Error(message || 'assert');
|
|
40
|
+
}
|
|
41
|
+
function findGeometryColumnIndex(schema, extensionName, geometryColumnName) {
|
|
42
|
+
var index = schema.fields.findIndex(function (field) {
|
|
43
|
+
return field.name === geometryColumnName || field.metadata.get('ARROW:extension:name') === extensionName;
|
|
44
|
+
});
|
|
45
|
+
return index !== -1 ? index : null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Returns `true` if the input is a reference to a column in the table
|
|
50
|
+
*/
|
|
51
|
+
function isColumnReference(input) {
|
|
52
|
+
return typeof input === 'string';
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A wrapper around a user-provided accessor function
|
|
56
|
+
*
|
|
57
|
+
* For layers like Scatterplot, Path, and Polygon, we automatically handle
|
|
58
|
+
* "exploding" the table when multi-geometry input are provided. This means that
|
|
59
|
+
* the upstream `index` value passed to the user will be the correct row index
|
|
60
|
+
* _only_ for non-exploded data.
|
|
61
|
+
*
|
|
62
|
+
* With this function, we simplify the user usage by automatically converting
|
|
63
|
+
* back from "exploded" index back to the original row index.
|
|
64
|
+
*/
|
|
65
|
+
function wrapAccessorFunction(objectInfo, userAccessorFunction, batchOffset) {
|
|
66
|
+
var index = objectInfo.index,
|
|
67
|
+
data = objectInfo.data;
|
|
68
|
+
var newIndex = index + batchOffset;
|
|
69
|
+
if (data.invertedGeomOffsets !== undefined) {
|
|
70
|
+
newIndex = data.invertedGeomOffsets[index] + batchOffset;
|
|
71
|
+
}
|
|
72
|
+
var newObjectData = {
|
|
73
|
+
data: data.data,
|
|
74
|
+
length: data.length,
|
|
75
|
+
attributes: data.attributes
|
|
76
|
+
};
|
|
77
|
+
var newObjectInfo = {
|
|
78
|
+
index: newIndex,
|
|
79
|
+
data: newObjectData,
|
|
80
|
+
target: objectInfo.target
|
|
81
|
+
};
|
|
82
|
+
return userAccessorFunction(newObjectInfo);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Resolve accessor and assign to props object
|
|
87
|
+
*
|
|
88
|
+
* This is useful as a helper function because a scalar prop is set at the top
|
|
89
|
+
* level while a vectorized prop is set inside data.attributes
|
|
90
|
+
*
|
|
91
|
+
*/
|
|
92
|
+
function assignAccessor(args) {
|
|
93
|
+
var props = args.props,
|
|
94
|
+
propName = args.propName,
|
|
95
|
+
propInput = args.propInput,
|
|
96
|
+
chunkIdx = args.chunkIdx,
|
|
97
|
+
geomCoordOffsets = args.geomCoordOffsets,
|
|
98
|
+
_args$batchOffset = args.batchOffset,
|
|
99
|
+
batchOffset = _args$batchOffset === void 0 ? 0 : _args$batchOffset;
|
|
100
|
+
if (propInput === undefined) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if ((0, _utils.isArrowVector)(propInput)) {
|
|
104
|
+
var columnData = propInput.data[chunkIdx];
|
|
105
|
+
if (arrow.DataType.isFixedSizeList(columnData)) {
|
|
106
|
+
assert(columnData.children.length === 1);
|
|
107
|
+
var values = columnData.children[0].values;
|
|
108
|
+
if (geomCoordOffsets) {
|
|
109
|
+
values = expandArrayToCoords(values, columnData.type.listSize, geomCoordOffsets);
|
|
110
|
+
}
|
|
111
|
+
props.data.attributes[propName] = {
|
|
112
|
+
value: values,
|
|
113
|
+
size: columnData.type.listSize,
|
|
114
|
+
// Set to `true` to signify that colors are already 0-255, and deck/luma
|
|
115
|
+
// does not need to rescale
|
|
116
|
+
// https://github.com/visgl/deck.gl/blob/401d624c0529faaa62125714c376b3ba3b8f379f/docs/api-reference/core/attribute-manager.md?plain=1#L66
|
|
117
|
+
normalized: true
|
|
118
|
+
};
|
|
119
|
+
} else if (arrow.DataType.isFloat(columnData)) {
|
|
120
|
+
var _values = columnData.values;
|
|
121
|
+
if (geomCoordOffsets) {
|
|
122
|
+
_values = expandArrayToCoords(_values, 1, geomCoordOffsets);
|
|
123
|
+
}
|
|
124
|
+
props.data.attributes[propName] = {
|
|
125
|
+
value: _values,
|
|
126
|
+
size: 1
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
} else if (typeof propInput === 'function') {
|
|
130
|
+
props[propName] = function (object, objectInfo) {
|
|
131
|
+
// Special case that doesn't have the same parameters
|
|
132
|
+
if (propName === 'getPolygonOffset') {
|
|
133
|
+
return propInput(object, objectInfo);
|
|
134
|
+
}
|
|
135
|
+
return wrapAccessorFunction(objectInfo, propInput, batchOffset);
|
|
136
|
+
};
|
|
137
|
+
} else {
|
|
138
|
+
props[propName] = propInput;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Expand an array from "one element per geometry" to "one element per coordinate"
|
|
144
|
+
*
|
|
145
|
+
* @param input: the input array to expand
|
|
146
|
+
* @param size : the number of nested elements in the input array per geometry. So for example, for RGB data this would be 3, for RGBA this would be 4. For radius, this would be 1.
|
|
147
|
+
* @param geomOffsets : an offsets array mapping from the geometry to the coordinate indexes. So in the case of a LineStringArray, this is retrieved directly from the GeoArrow storage. In the case of a PolygonArray, this comes from the resolved indexes that need to be given to the SolidPolygonLayer anyways.
|
|
148
|
+
* @param numPositions : end position in geomOffsets, as geomOffsets can potentially contain preallocated zeroes in the end of the buffer.
|
|
149
|
+
*
|
|
150
|
+
* @return {TypedArray} values expanded to be per-coordinate
|
|
151
|
+
*/
|
|
152
|
+
function expandArrayToCoords(input, size, geomOffsets, numPositions) {
|
|
153
|
+
var lastIndex = numPositions || geomOffsets.length - 1;
|
|
154
|
+
var numCoords = geomOffsets[lastIndex];
|
|
155
|
+
// @ts-expect-error
|
|
156
|
+
var outputArray = new input.constructor(numCoords * size);
|
|
157
|
+
|
|
158
|
+
// geomIdx is an index into the geomOffsets array
|
|
159
|
+
// geomIdx is also the geometry/table index
|
|
160
|
+
for (var geomIdx = 0; geomIdx < lastIndex; geomIdx++) {
|
|
161
|
+
// geomOffsets maps from the geometry index to the coord index
|
|
162
|
+
// So here we get the range of coords that this geometry covers
|
|
163
|
+
var lastCoordIdx = geomOffsets[geomIdx];
|
|
164
|
+
var nextCoordIdx = geomOffsets[geomIdx + 1];
|
|
165
|
+
|
|
166
|
+
// Iterate over this range of coord indices
|
|
167
|
+
for (var coordIdx = lastCoordIdx; coordIdx < nextCoordIdx; coordIdx++) {
|
|
168
|
+
// Iterate over size
|
|
169
|
+
for (var i = 0; i < size; i++) {
|
|
170
|
+
// Copy from the geometry index in `input` to the coord index in
|
|
171
|
+
// `output`
|
|
172
|
+
outputArray[coordIdx * size + i] = input[geomIdx * size + i];
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return outputArray;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Get a geometry vector with the specified extension type name from the table.
|
|
181
|
+
*/
|
|
182
|
+
function getGeometryVector(table, geoarrowTypeName) {
|
|
183
|
+
var geometryColumnIdx = findGeometryColumnIndex(table.schema, geoarrowTypeName);
|
|
184
|
+
if (geometryColumnIdx === null) {
|
|
185
|
+
return null;
|
|
186
|
+
// throw new Error(`No column found with extension type ${geoarrowTypeName}`);
|
|
187
|
+
}
|
|
188
|
+
return table.getChildAt(geometryColumnIdx);
|
|
189
|
+
}
|
|
190
|
+
function getListNestingLevels(data) {
|
|
191
|
+
var nestingLevels = 0;
|
|
192
|
+
if (arrow.DataType.isList(data.type)) {
|
|
193
|
+
nestingLevels += 1;
|
|
194
|
+
data = data.children[0];
|
|
195
|
+
}
|
|
196
|
+
return nestingLevels;
|
|
197
|
+
}
|
|
198
|
+
function getMultiLineStringResolvedOffsets(data) {
|
|
199
|
+
var geomOffsets = data.valueOffsets;
|
|
200
|
+
var lineStringData = ga.child.getMultiLineStringChild(data);
|
|
201
|
+
var ringOffsets = lineStringData.valueOffsets;
|
|
202
|
+
var resolvedRingOffsets = new Int32Array(geomOffsets.length);
|
|
203
|
+
for (var i = 0; i < resolvedRingOffsets.length; ++i) {
|
|
204
|
+
// Perform the lookup into the ringIndices array using the geomOffsets
|
|
205
|
+
// array
|
|
206
|
+
resolvedRingOffsets[i] = ringOffsets[geomOffsets[i]];
|
|
207
|
+
}
|
|
208
|
+
return resolvedRingOffsets;
|
|
209
|
+
}
|
|
210
|
+
function getPolygonResolvedOffsets(data) {
|
|
211
|
+
var geomOffsets = data.valueOffsets;
|
|
212
|
+
var ringData = ga.child.getPolygonChild(data);
|
|
213
|
+
var ringOffsets = ringData.valueOffsets;
|
|
214
|
+
var resolvedRingOffsets = new Int32Array(geomOffsets.length);
|
|
215
|
+
for (var i = 0; i < resolvedRingOffsets.length; ++i) {
|
|
216
|
+
// Perform the lookup into the ringIndices array using the geomOffsets
|
|
217
|
+
// array
|
|
218
|
+
resolvedRingOffsets[i] = ringOffsets[geomOffsets[i]];
|
|
219
|
+
}
|
|
220
|
+
return resolvedRingOffsets;
|
|
221
|
+
}
|
|
222
|
+
function getMultiPolygonResolvedOffsets(data) {
|
|
223
|
+
var polygonData = ga.child.getMultiPolygonChild(data);
|
|
224
|
+
var ringData = ga.child.getPolygonChild(polygonData);
|
|
225
|
+
var geomOffsets = data.valueOffsets;
|
|
226
|
+
var polygonOffsets = polygonData.valueOffsets;
|
|
227
|
+
var ringOffsets = ringData.valueOffsets;
|
|
228
|
+
var resolvedRingOffsets = new Int32Array(geomOffsets.length);
|
|
229
|
+
for (var i = 0; i < resolvedRingOffsets.length; ++i) {
|
|
230
|
+
resolvedRingOffsets[i] = ringOffsets[polygonOffsets[geomOffsets[i]]];
|
|
231
|
+
}
|
|
232
|
+
return resolvedRingOffsets;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Invert offsets so that lookup can go in the opposite direction
|
|
237
|
+
*/
|
|
238
|
+
function invertOffsets(offsets) {
|
|
239
|
+
var largestOffset = offsets[offsets.length - 1];
|
|
240
|
+
var arrayConstructor = offsets.length < Math.pow(2, 8) ? Uint8Array : offsets.length < Math.pow(2, 16) ? Uint16Array : Uint32Array;
|
|
241
|
+
var invertedOffsets = new arrayConstructor(largestOffset);
|
|
242
|
+
for (var arrayIdx = 0; arrayIdx < offsets.length - 1; arrayIdx++) {
|
|
243
|
+
var thisOffset = offsets[arrayIdx];
|
|
244
|
+
var nextOffset = offsets[arrayIdx + 1];
|
|
245
|
+
for (var offset = thisOffset; offset < nextOffset; offset++) {
|
|
246
|
+
invertedOffsets[offset] = arrayIdx;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return invertedOffsets;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// TODO: better typing
|
|
253
|
+
function extractAccessorsFromProps(props, excludeKeys) {
|
|
254
|
+
var accessors = {};
|
|
255
|
+
var otherProps = {};
|
|
256
|
+
for (var _i = 0, _Object$entries = Object.entries(props); _i < _Object$entries.length; _i++) {
|
|
257
|
+
var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
|
|
258
|
+
key = _Object$entries$_i[0],
|
|
259
|
+
value = _Object$entries$_i[1];
|
|
260
|
+
if (excludeKeys.includes(key)) {
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
if (key.startsWith('get')) {
|
|
264
|
+
accessors[key] = value;
|
|
265
|
+
} else {
|
|
266
|
+
otherProps[key] = value;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return [accessors, otherProps];
|
|
270
|
+
}
|
|
271
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["arrow","_interopRequireWildcard","require","ga","_utils","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","assert","condition","message","Error","findGeometryColumnIndex","schema","extensionName","geometryColumnName","index","fields","findIndex","field","name","metadata","isColumnReference","input","wrapAccessorFunction","objectInfo","userAccessorFunction","batchOffset","data","newIndex","invertedGeomOffsets","undefined","newObjectData","length","attributes","newObjectInfo","target","assignAccessor","args","props","propName","propInput","chunkIdx","geomCoordOffsets","_args$batchOffset","isArrowVector","columnData","DataType","isFixedSizeList","children","values","expandArrayToCoords","type","listSize","value","size","normalized","isFloat","object","geomOffsets","numPositions","lastIndex","numCoords","outputArray","constructor","geomIdx","lastCoordIdx","nextCoordIdx","coordIdx","getGeometryVector","table","geoarrowTypeName","geometryColumnIdx","getChildAt","getListNestingLevels","nestingLevels","isList","getMultiLineStringResolvedOffsets","valueOffsets","lineStringData","child","getMultiLineStringChild","ringOffsets","resolvedRingOffsets","Int32Array","getPolygonResolvedOffsets","ringData","getPolygonChild","getMultiPolygonResolvedOffsets","polygonData","getMultiPolygonChild","polygonOffsets","invertOffsets","offsets","largestOffset","arrayConstructor","Math","pow","Uint8Array","Uint16Array","Uint32Array","invertedOffsets","arrayIdx","thisOffset","nextOffset","offset","extractAccessorsFromProps","excludeKeys","accessors","otherProps","_i","_Object$entries","entries","_Object$entries$_i","_slicedToArray2","key","includes","startsWith"],"sources":["../../../src/utils/utils.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\n// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport * as arrow from 'apache-arrow';\nimport * as ga from '@geoarrow/geoarrow-js';\nimport {AccessorContext, AccessorFunction, _InternalAccessorContext} from '../types';\nimport {isArrowVector} from '@kepler.gl/utils';\n\nexport function assert(condition: unknown, message?: string): asserts condition {\n if (!condition) throw new Error(message || 'assert');\n}\n\nexport type TypedArray =\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | Int8Array\n | Int16Array\n | Int32Array\n | Float32Array\n | Float64Array;\n\nexport function findGeometryColumnIndex(\n schema: arrow.Schema,\n extensionName: string,\n geometryColumnName?: string | null\n): number | null {\n const index = schema.fields.findIndex(\n field =>\n field.name === geometryColumnName ||\n field.metadata.get('ARROW:extension:name') === extensionName\n );\n return index !== -1 ? index : null;\n}\n\n/**\n * Returns `true` if the input is a reference to a column in the table\n */\nexport function isColumnReference(input: any): input is string {\n return typeof input === 'string';\n}\n\nexport {convertStructToFixedSizeList} from '@kepler.gl/utils';\n\ntype AssignAccessorProps = {\n /** The object on which to assign the resolved accesor */\n props: Record<string, any>;\n /** The name of the prop to set */\n propName: string;\n /** The user-supplied input to the layer. Must either be a scalar value or a reference to a column in the table. */\n propInput: any;\n /** Numeric index in the table */\n chunkIdx: number;\n /** a map from the geometry index to the coord offsets for that geometry. */\n geomCoordOffsets?: Int32Array | null;\n /** Absolute offset of the batch in the table/vector. Added to the sampling index. */\n batchOffset?: number;\n};\n\n/**\n * A wrapper around a user-provided accessor function\n *\n * For layers like Scatterplot, Path, and Polygon, we automatically handle\n * \"exploding\" the table when multi-geometry input are provided. This means that\n * the upstream `index` value passed to the user will be the correct row index\n * _only_ for non-exploded data.\n *\n * With this function, we simplify the user usage by automatically converting\n * back from \"exploded\" index back to the original row index.\n */\nfunction wrapAccessorFunction<In, Out>(\n objectInfo: _InternalAccessorContext<In>,\n userAccessorFunction: AccessorFunction<In, Out>,\n batchOffset: number\n): Out {\n const {index, data} = objectInfo;\n let newIndex = index + batchOffset;\n if (data.invertedGeomOffsets !== undefined) {\n newIndex = data.invertedGeomOffsets[index] + batchOffset;\n }\n const newObjectData = {\n data: data.data,\n length: data.length,\n attributes: data.attributes\n };\n const newObjectInfo = {\n index: newIndex,\n data: newObjectData,\n target: objectInfo.target\n };\n return userAccessorFunction(newObjectInfo);\n}\n\n/**\n * Resolve accessor and assign to props object\n *\n * This is useful as a helper function because a scalar prop is set at the top\n * level while a vectorized prop is set inside data.attributes\n *\n */\nexport function assignAccessor(args: AssignAccessorProps) {\n const {props, propName, propInput, chunkIdx, geomCoordOffsets, batchOffset = 0} = args;\n\n if (propInput === undefined) {\n return;\n }\n\n if (isArrowVector(propInput)) {\n const columnData = propInput.data[chunkIdx];\n\n if (arrow.DataType.isFixedSizeList(columnData)) {\n assert(columnData.children.length === 1);\n let values = columnData.children[0].values;\n\n if (geomCoordOffsets) {\n values = expandArrayToCoords(values, columnData.type.listSize, geomCoordOffsets);\n }\n\n props.data.attributes[propName] = {\n value: values,\n size: columnData.type.listSize,\n // Set to `true` to signify that colors are already 0-255, and deck/luma\n // does not need to rescale\n // https://github.com/visgl/deck.gl/blob/401d624c0529faaa62125714c376b3ba3b8f379f/docs/api-reference/core/attribute-manager.md?plain=1#L66\n normalized: true\n };\n } else if (arrow.DataType.isFloat(columnData)) {\n let values = columnData.values;\n\n if (geomCoordOffsets) {\n values = expandArrayToCoords(values, 1, geomCoordOffsets);\n }\n\n props.data.attributes[propName] = {\n value: values,\n size: 1\n };\n }\n } else if (typeof propInput === 'function') {\n props[propName] = <In>(object: any, objectInfo: AccessorContext<In>) => {\n // Special case that doesn't have the same parameters\n if (propName === 'getPolygonOffset') {\n return propInput(object, objectInfo);\n }\n\n return wrapAccessorFunction(objectInfo, propInput, batchOffset);\n };\n } else {\n props[propName] = propInput;\n }\n}\n\n/**\n * Expand an array from \"one element per geometry\" to \"one element per coordinate\"\n *\n * @param input: the input array to expand\n * @param size : the number of nested elements in the input array per geometry. So for example, for RGB data this would be 3, for RGBA this would be 4. For radius, this would be 1.\n * @param geomOffsets : an offsets array mapping from the geometry to the coordinate indexes. So in the case of a LineStringArray, this is retrieved directly from the GeoArrow storage. In the case of a PolygonArray, this comes from the resolved indexes that need to be given to the SolidPolygonLayer anyways.\n * @param numPositions : end position in geomOffsets, as geomOffsets can potentially contain preallocated zeroes in the end of the buffer.\n *\n * @return {TypedArray} values expanded to be per-coordinate\n */\nexport function expandArrayToCoords<T extends TypedArray>(\n input: T,\n size: number,\n geomOffsets: Int32Array,\n numPositions?: number\n): T {\n const lastIndex = numPositions || geomOffsets.length - 1;\n const numCoords = geomOffsets[lastIndex];\n // @ts-expect-error\n const outputArray: T = new input.constructor(numCoords * size);\n\n // geomIdx is an index into the geomOffsets array\n // geomIdx is also the geometry/table index\n for (let geomIdx = 0; geomIdx < lastIndex; geomIdx++) {\n // geomOffsets maps from the geometry index to the coord index\n // So here we get the range of coords that this geometry covers\n const lastCoordIdx = geomOffsets[geomIdx];\n const nextCoordIdx = geomOffsets[geomIdx + 1];\n\n // Iterate over this range of coord indices\n for (let coordIdx = lastCoordIdx; coordIdx < nextCoordIdx; coordIdx++) {\n // Iterate over size\n for (let i = 0; i < size; i++) {\n // Copy from the geometry index in `input` to the coord index in\n // `output`\n outputArray[coordIdx * size + i] = input[geomIdx * size + i];\n }\n }\n }\n\n return outputArray;\n}\n\n/**\n * Get a geometry vector with the specified extension type name from the table.\n */\nexport function getGeometryVector(\n table: arrow.Table,\n geoarrowTypeName: string\n): arrow.Vector | null {\n const geometryColumnIdx = findGeometryColumnIndex(table.schema, geoarrowTypeName);\n\n if (geometryColumnIdx === null) {\n return null;\n // throw new Error(`No column found with extension type ${geoarrowTypeName}`);\n }\n\n return table.getChildAt(geometryColumnIdx);\n}\n\nexport function getListNestingLevels(data: arrow.Data): number {\n let nestingLevels = 0;\n if (arrow.DataType.isList(data.type)) {\n nestingLevels += 1;\n data = data.children[0];\n }\n return nestingLevels;\n}\n\nexport function getMultiLineStringResolvedOffsets(data: ga.data.MultiLineStringData): Int32Array {\n const geomOffsets = data.valueOffsets;\n const lineStringData = ga.child.getMultiLineStringChild(data);\n const ringOffsets = lineStringData.valueOffsets;\n\n const resolvedRingOffsets = new Int32Array(geomOffsets.length);\n for (let i = 0; i < resolvedRingOffsets.length; ++i) {\n // Perform the lookup into the ringIndices array using the geomOffsets\n // array\n resolvedRingOffsets[i] = ringOffsets[geomOffsets[i]];\n }\n\n return resolvedRingOffsets;\n}\n\nexport function getPolygonResolvedOffsets(data: ga.data.PolygonData): Int32Array {\n const geomOffsets = data.valueOffsets;\n const ringData = ga.child.getPolygonChild(data);\n const ringOffsets = ringData.valueOffsets;\n\n const resolvedRingOffsets = new Int32Array(geomOffsets.length);\n for (let i = 0; i < resolvedRingOffsets.length; ++i) {\n // Perform the lookup into the ringIndices array using the geomOffsets\n // array\n resolvedRingOffsets[i] = ringOffsets[geomOffsets[i]];\n }\n\n return resolvedRingOffsets;\n}\n\nexport function getMultiPolygonResolvedOffsets(data: ga.data.MultiPolygonData): Int32Array {\n const polygonData = ga.child.getMultiPolygonChild(data);\n const ringData = ga.child.getPolygonChild(polygonData);\n\n const geomOffsets = data.valueOffsets;\n const polygonOffsets = polygonData.valueOffsets;\n const ringOffsets = ringData.valueOffsets;\n\n const resolvedRingOffsets = new Int32Array(geomOffsets.length);\n for (let i = 0; i < resolvedRingOffsets.length; ++i) {\n resolvedRingOffsets[i] = ringOffsets[polygonOffsets[geomOffsets[i]]];\n }\n\n return resolvedRingOffsets;\n}\n\n/**\n * Invert offsets so that lookup can go in the opposite direction\n */\nexport function invertOffsets(offsets: Int32Array): Uint8Array | Uint16Array | Uint32Array {\n const largestOffset = offsets[offsets.length - 1];\n\n const arrayConstructor =\n offsets.length < Math.pow(2, 8)\n ? Uint8Array\n : offsets.length < Math.pow(2, 16)\n ? Uint16Array\n : Uint32Array;\n\n const invertedOffsets = new arrayConstructor(largestOffset);\n for (let arrayIdx = 0; arrayIdx < offsets.length - 1; arrayIdx++) {\n const thisOffset = offsets[arrayIdx];\n const nextOffset = offsets[arrayIdx + 1];\n for (let offset = thisOffset; offset < nextOffset; offset++) {\n invertedOffsets[offset] = arrayIdx;\n }\n }\n\n return invertedOffsets;\n}\n\n// TODO: better typing\nexport function extractAccessorsFromProps(\n props: Record<string, any>,\n excludeKeys: string[]\n): [Record<string, any>, Record<string, any>] {\n const accessors: Record<string, any> = {};\n const otherProps: Record<string, any> = {};\n for (const [key, value] of Object.entries(props)) {\n if (excludeKeys.includes(key)) {\n continue;\n }\n\n if (key.startsWith('get')) {\n accessors[key] = value;\n } else {\n otherProps[key] = value;\n }\n }\n\n return [accessors, otherProps];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,EAAA,GAAAF,uBAAA,CAAAC,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAA+C,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,wBAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,mBAAAT,CAAA,iBAAAA,CAAA,gBAAAU,OAAA,CAAAV,CAAA,0BAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,cAAAM,EAAA,IAAAd,CAAA,gBAAAc,EAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,EAAA,OAAAP,CAAA,IAAAD,CAAA,GAAAW,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAnB,CAAA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