Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[Feat] Gpu data filter (#878)

Shan Heb336b9cdfd89
diff --git a/.travis.yml b/.travis.yml
index e75818a34..9c61a58f1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,7 @@
language: node_js
+os: linux
+env:
+ - CXX=g++-6
addons:
apt:
sources:
@@ -11,15 +14,16 @@ addons:
- libglapi-mesa
- libosmesa6
- libxi-dev
+services:
+ - xvfb
install:
- yarn --ignore-engines
node_js:
- 8
- 10
-services:
- - xvfb
before_script:
- "curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install.sh | sudo bash"
+ - ulimit -c unlimited -S # enable core dumps
after_success:
- cat coverage/lcov.info | coveralls
script:
diff --git a/contributing/DEVELOPERS.md b/contributing/DEVELOPERS.md
index 3411868ef..266920347 100644
--- a/contributing/DEVELOPERS.md
+++ b/contributing/DEVELOPERS.md
@@ -68,6 +68,17 @@ http://localhost:8080/
This is the demo app we hosted on [http://kepler.gl/#/demo][demo-app]. By default, it serves non-minified source code inside the src directory.
+#### Develop with deck.gl
+
+When develop, upgrade, debug deck.gl, Demo app can load deck.gl directly from src
+```
+// load deck.gl from node_modules/deck.gl/src, sub-modules from node_modules/@deck.gl/<module>/src
+npm run start:deck
+
+// load deck.gl src from the deck.gl folder parallel to kepler.gl
+npm run start:deck-src
+```
+
## <a name="tests"> Running Tests
We write unit and browser tests with [Tape][tape] and [Enzyme][enzyme], and lint with [ESLint][eslint]. Make sure to run test before submitting your PR. To run all of the tests once with node:
diff --git a/examples/demo-app/package.json b/examples/demo-app/package.json
index 1cace6cfe..b7c0588bf 100644
--- a/examples/demo-app/package.json
+++ b/examples/demo-app/package.json
@@ -3,7 +3,8 @@
"start": "webpack-dev-server --mode development --progress --hot --open",
"start-prod": "webpack-dev-server -p --progress --hot --open",
"start-local": "webpack-dev-server --mode development --env.es6 --progress --hot --open",
- "start-local-deck": "webpack-dev-server --mode development --env.es6 --env.deck --progress --hot --open"
+ "start-local-deck": "webpack-dev-server --mode development --env.es6 --env.deck --progress --hot --open",
+ "start-local-deck-src": "webpack-dev-server --mode development --env.es6 --env.deck_src --progress --hot --open"
},
"dependencies": {
"d3-request": "^1.0.6",
diff --git a/examples/demo-app/src/app.js b/examples/demo-app/src/app.js
index 429a18d78..41db031d2 100644
--- a/examples/demo-app/src/app.js
+++ b/examples/demo-app/src/app.js
@@ -125,6 +125,7 @@ class App extends Component {
// }
// load sample data
// this._loadSampleData();
+
// Notifications
// this._loadMockNotifications();
}
@@ -169,8 +170,8 @@ class App extends Component {
// this._loadGeojsonData();
// this._loadTripGeoJson();
// this._loadIconData();
- // this._loadGeojsonData();
// this._loadH3HexagonData();
+ // this._loadScenegraphLayer();
}
_loadPointData() {
@@ -192,6 +193,38 @@ class App extends Component {
);
}
+ _loadScenegraphLayer() {
+ this.props.dispatch(
+ addDataToMap({
+ datasets: {
+ info: {
+ label: 'Sample Scenegraph Ducks',
+ id: 'test_trip_data'
+ },
+ data: processCsvData(testCsvData)
+ },
+ config: {
+ version: 'v1',
+ config: {
+ visState: {
+ layers: [{
+ type: '3D',
+ config: {
+ dataId: 'test_trip_data',
+ columns: {
+ lat: 'gps_data.lat',
+ lng: 'gps_data.lng'
+ },
+ isVisible: true
+ }
+ }]
+ }
+ }
+ }
+ })
+ );
+ }
+
_loadIconData() {
// load icon data and config and process csv file
this.props.dispatch(
diff --git a/examples/demo-app/src/data/sample-animate-trip-data.js b/examples/demo-app/src/data/sample-animate-trip-data.js
index ea1ed6228..ac91e10bf 100644
--- a/examples/demo-app/src/data/sample-animate-trip-data.js
+++ b/examples/demo-app/src/data/sample-animate-trip-data.js
@@ -23,7 +23,10 @@ export default {
features: [
{
type: 'Feature',
- properties: {vendor: 'A'},
+ properties: {
+ vendor: 'A',
+ value: 10
+ },
geometry: {
type: 'LineString',
coordinates: [
@@ -85,7 +88,10 @@ export default {
},
{
type: 'Feature',
- properties: {vendor: 'B'},
+ properties: {
+ vendor: 'B',
+ value: 4
+ },
geometry: {
type: 'LineString',
coordinates: [
@@ -149,7 +155,10 @@ export default {
},
{
type: 'Feature',
- properties: {vendor: 'A'},
+ properties: {
+ vendor: 'A',
+ value: 7
+ },
geometry: {
type: 'LineString',
coordinates: [
@@ -197,7 +206,10 @@ export default {
},
{
type: 'Feature',
- properties: {vendor: 'A'},
+ properties: {
+ vendor: 'A',
+ value: 11
+ },
geometry: {
type: 'LineString',
coordinates: [
@@ -228,7 +240,10 @@ export default {
},
{
type: 'Feature',
- properties: {vendor: 'B'},
+ properties: {
+ vendor: 'B',
+ value: 6
+ },
geometry: {
type: 'LineString',
coordinates: [
@@ -278,7 +293,10 @@ export default {
},
{
type: 'Feature',
- properties: {vendor: 'A'},
+ properties: {
+ vendor: 'A',
+ value: 1
+ },
geometry: {
type: 'LineString',
coordinates: [
@@ -294,7 +312,10 @@ export default {
},
{
type: 'Feature',
- properties: {vendor: 'A'},
+ properties: {
+ vendor: 'A',
+ value: 7
+ },
geometry: {
type: 'LineString',
coordinates: [
@@ -332,7 +353,10 @@ export default {
},
{
type: 'Feature',
- properties: {vendor: 'B'},
+ properties: {
+ vendor: 'B',
+ value: 15
+ },
geometry: {
type: 'LineString',
coordinates: [
diff --git a/examples/demo-app/src/data/sample-trip-data.js b/examples/demo-app/src/data/sample-trip-data.js
index 7e81b10bb..e59a03981 100644
--- a/examples/demo-app/src/data/sample-trip-data.js
+++ b/examples/demo-app/src/data/sample-trip-data.js
@@ -19,31 +19,32 @@
// THE SOFTWARE.
// Sample Taxi Trip Data
-export const testCsvData = `gps_data.utc_timestamp,gps_data.lat,gps_data.lng,gps_data.types,epoch,has_result,id,time,begintrip_ts_utc,begintrip_ts_local,date
-2016-09-17 00:09:55,29.9900937,31.2590542,driver_analytics,1472688000000,False,1,2016-09-23T00:00:00.000Z,2016-10-01 09:41:39+00:00,2016-10-01 09:41:39+00:00,2016-09-23
-2016-09-17 00:10:56,29.9927699,31.2461142,driver_analytics,1472688000000,False,2,2016-09-23T00:00:00.000Z,2016-10-01 09:46:37+00:00,2016-10-01 16:46:37+00:00,2016-09-23
-2016-09-17 00:11:56,29.9907261,31.2312742,driver_analytics,1472688000000,False,3,2016-09-23T00:00:00.000Z,,,2016-09-23
-2016-09-17 00:12:58,29.9870074,31.2175827,driver_analytics,1472688000000,False,4,2016-09-23T00:00:00.000Z,,,2016-09-23
-2016-09-17 00:14:00,29.9923041,31.2154899,driver_analytics,1472688000000,False,5,2016-09-23T00:00:00.000Z,2016-10-01 09:47:37+00:00,2016-10-01 16:47:37+00:00,
-2016-09-17 00:15:01,29.9968249,31.2149361,driver_analytics,1472688000000,False,12124,2016-09-23T05:00:00.000Z,,,
-2016-09-17 00:16:03,30.0037217,31.2164035,driver_analytics,1472688000000,False,222,2016-09-23T05:00:00.000Z,,,
-2016-09-17 00:17:05,30.0116207,31.2179346,driver_analytics,1472688000000,False,345,2016-09-23T00:00:00.000Z,,,2016-09-24
-2016-09-17 00:18:09,30.0208925,31.2179556,driver_analytics,1472708000000,False,,2016-09-23T00:00:00.000Z,,,2016-09-24
-2016-09-17 00:19:12,30.0218999,31.2178842,driver_analytics,1472708000000,False,,2016-09-23T06:00:00.000Z,,,2016-09-24
-2016-09-17 00:19:27,30.0229344,31.2179138,driver_analytics,1472708000000,False,,2016-09-23T05:00:00.000Z,,,2016-09-24
-2016-09-17 00:20:14,30.0264237,31.2179415,driver_analytics,1472708000000,False,,,,,2016-09-24
-2016-09-17 00:21:17,30.0292134,31.2181809,driver_analytics,1472754400000,False,,,,,2016-09-24
-2016-09-17 00:22:20,30.034391,31.2193991,driver_analytics,1472754400000,,,2016-09-23T06:00:00.000Z,,,
-2016-09-17 00:23:22,30.0352752,31.2181803,driver_analytics,1472754400000,,,2016-09-23T06:00:00.000Z,2016-10-01 10:01:54+00:00,2016-10-01 17:01:54+00:00,
-2016-09-17 00:24:24,30.0395918,31.2195902,driver_analytics,1472754400000,,1,2016-09-23T00:00:00.000Z,2016-10-01 09:53:04+00:00,2016-10-01 16:53:04+00:00,
-2016-09-17 00:25:28,30.0497387,31.2174421,driver_analytics,1472774400000,,,2016-09-23T07:00:00.000Z,2016-10-01 09:55:23+00:00,2016-10-01 16:55:23+00:00,
-2016-09-17 00:26:29,30.0538936,31.2165983,driver_analytics,1472774400000,,43,2016-09-23T07:00:00.000Z,2016-10-01 09:59:53+00:00,2016-10-01 16:59:53+00:00,2016-10-10
-2016-09-17 00:27:31,30.060911,31.2148748,driver_analytics,1472774400000,,4,2016-09-23T07:00:00.000Z,2016-10-01 09:57:11+00:00,2016-10-01 16:57:11+00:00,2016-10-10
-2016-09-17 00:28:35,30.060334,31.2212278,driver_analytics,1472774400000,,5,2016-09-23T07:00:00.000Z,2016-10-01 09:59:27+00:00,2016-10-01 16:59:27+00:00,2016-10-10
-2016-09-17 00:29:40,30.0554663,31.2288985,driver_analytics,1472774400000,True,,2016-09-23T07:00:00.000Z,2016-10-01 09:46:36+00:00,2016-10-01 16:46:36+00:00,2016-10-10
-2016-09-17 00:30:03,30.0614122,31.2187021,driver_gps,1472774400000,True,6,2016-09-23T08:00:00.000Z,2016-10-01 09:54:31+00:00,2016-10-01 16:54:31+00:00,2016-10-10
-2016-09-17 00:30:03,30.0612697,31.2191059,driver_gps,1472774400000,True,7,2016-09-23T08:00:00.000Z,2016-10-01 09:53:35+00:00,2016-10-01 16:53:35+00:00,2016-10-10
-2016-09-17 00:30:08,30.0610977,31.2194728,driver_gps,1472774400000,True,,2016-09-23T08:00:00.000Z,,,`;
+export const testCsvData = `gps_data.utc_timestamp,gps_data.lat,gps_data.lng,gps_data.types,epoch,has_result,id,time,begintrip_ts_utc,begintrip_ts_local,date,<img>_tooltip,website
+2016-09-17 00:09:55,29.9900937,31.2590542,driver_analytics,1472688000000,False,1,2016-09-23T00:00:00.000Z,2016-10-01 09:41:39+00:00,2016-10-01 09:41:39+00:00,2016-09-23,https://d1a3f4spazzrp4.cloudfront.net/kepler.gl/icon-demo-map.jpg,http://kepler.gl
+2016-09-17 00:10:56,29.9927699,31.2461142,driver_analytics,1472688000000,False,2,2016-09-23T00:00:00.000Z,2016-10-01 09:46:37+00:00,2016-10-01 16:46:37+00:00,2016-09-23,https://d1a3f4spazzrp4.cloudfront.net/kepler.gl/icon-demo-map.jpg,http://kepler.gl
+2016-09-17 00:11:56,29.9907261,31.2312742,driver_analytics,1472688000000,False,3,2016-09-23T00:00:00.000Z,,,2016-09-23,https://user-images.githubusercontent.com/3605556/66859873-f2aed400-ef40-11e9-8a41-d07de7560376.png,http://kepler.gl
+2016-09-17 00:12:58,29.9870074,31.2175827,driver_analytics,1472688000000,False,4,2016-09-23T00:00:00.000Z,,,2016-09-23,https://user-images.githubusercontent.com/3605556/66859873-f2aed400-ef40-11e9-8a41-d07de7560376.png,http://kepler.gl
+2016-09-17 00:14:00,29.9923041,31.2154899,driver_analytics,1472688000000,False,5,2016-09-23T00:00:00.000Z,2016-10-01 09:47:37+00:00,2016-10-01 16:47:37+00:00,,https://user-images.githubusercontent.com/3605556/66859873-f2aed400-ef40-11e9-8a41-d07de7560376.png,http://kepler.gl
+2016-09-17 00:15:01,29.9968249,31.2149361,driver_analytics,1472688000000,False,12124,2016-09-23T05:00:00.000Z,,,,https://user-images.githubusercontent.com/3605556/66859873-f2aed400-ef40-11e9-8a41-d07de7560376.png,http://kepler.gl
+2016-09-17 00:16:03,30.0037217,31.2164035,driver_analytics,1472688000000,False,222,2016-09-23T05:00:00.000Z,,,,https://user-images.githubusercontent.com/3605556/66859873-f2aed400-ef40-11e9-8a41-d07de7560376.png,http://kepler.gl
+2016-09-17 00:17:05,30.0116207,31.2179346,driver_analytics,1472688000000,False,345,2016-09-23T00:00:00.000Z,,,2016-09-24,https://user-images.githubusercontent.com/3605556/66859873-f2aed400-ef40-11e9-8a41-d07de7560376.png,http://kepler.gl
+2016-09-17 00:18:09,30.0208925,31.2179556,driver_analytics,1472708000000,False,,2016-09-23T00:00:00.000Z,,,2016-09-24,https://user-images.githubusercontent.com/3605556/66859873-f2aed400-ef40-11e9-8a41-d07de7560376.png,http://kepler.gl
+2016-09-17 00:19:12,30.0218999,31.2178842,driver_analytics,1472708000000,False,,2016-09-23T06:00:00.000Z,,,2016-09-24,https://user-images.githubusercontent.com/3605556/66859873-f2aed400-ef40-11e9-8a41-d07de7560376.png,http://kepler.gl
+2016-09-17 00:19:27,30.0229344,31.2179138,driver_analytics,1472708000000,False,,2016-09-23T05:00:00.000Z,,,2016-09-24,https://user-images.githubusercontent.com/3605556/66859873-f2aed400-ef40-11e9-8a41-d07de7560376.png,http://kepler.gl
+2016-09-17 00:20:14,30.0264237,31.2179415,driver_analytics,1472708000000,False,,,,,2016-09-24,https://user-images.githubusercontent.com/3605556/66859873-f2aed400-ef40-11e9-8a41-d07de7560376.png,http://kepler.gl
+2016-09-17 00:21:17,30.0292134,31.2181809,driver_analytics,1472754400000,False,,,,,2016-09-24,https://user-images.githubusercontent.com/3605556/66859873-f2aed400-ef40-11e9-8a41-d07de7560376.png,http://kepler.gl
+2016-09-17 00:22:20,30.034391,31.2193991,driver_analytics,1472754400000,,,2016-09-23T06:00:00.000Z,,,,https://user-images.githubusercontent.com/3605556/66859873-f2aed400-ef40-11e9-8a41-d07de7560376.png,http://kepler.gl
+2016-09-17 00:23:22,30.0352752,31.2181803,driver_analytics,1472754400000,,,2016-09-23T06:00:00.000Z,2016-10-01 10:01:54+00:00,2016-10-01 17:01:54+00:00,,https://user-images.githubusercontent.com/3605556/66859873-f2aed400-ef40-11e9-8a41-d07de7560376.png,http://kepler.gl
+2016-09-17 00:24:24,30.0395918,31.2195902,driver_analytics,1472754400000,,1,2016-09-23T00:00:00.000Z,2016-10-01 09:53:04+00:00,2016-10-01 16:53:04+00:00,,https://user-images.githubusercontent.com/3605556/66859873-f2aed400-ef40-11e9-8a41-d07de7560376.png,http://kepler.gl
+2016-09-17 00:25:28,30.0497387,31.2174421,driver_analytics,1472774400000,,,2016-09-23T07:00:00.000Z,2016-10-01 09:55:23+00:00,2016-10-01 16:55:23+00:00,,https://d1a3f4spazzrp4.cloudfront.net/kepler.gl/icon-demo-map.jpg,http://kepler.gl
+2016-09-17 00:26:29,30.0538936,31.2165983,driver_analytics,1472774400000,,43,2016-09-23T07:00:00.000Z,2016-10-01 09:59:53+00:00,2016-10-01 16:59:53+00:00,2016-10-10,https://d1a3f4spazzrp4.cloudfront.net/kepler.gl/icon-demo-map.jpg,http://kepler.gl
+2016-09-17 00:27:31,30.060911,31.2148748,driver_analytics,1472774400000,,4,2016-09-23T07:00:00.000Z,2016-10-01 09:57:11+00:00,2016-10-01 16:57:11+00:00,2016-10-10,https://d1a3f4spazzrp4.cloudfront.net/kepler.gl/icon-demo-map.jpg,http://kepler.gl
+2016-09-17 00:28:35,30.060334,31.2212278,driver_analytics,1472774400000,,5,2016-09-23T07:00:00.000Z,2016-10-01 09:59:27+00:00,2016-10-01 16:59:27+00:00,2016-10-10,https://d1a3f4spazzrp4.cloudfront.net/kepler.gl/icon-demo-map.jpg,http://kepler.gl
+2016-09-17 00:29:40,30.0554663,31.2288985,driver_analytics,1472774400000,True,,2016-09-23T07:00:00.000Z,2016-10-01 09:46:36+00:00,2016-10-01 16:46:36+00:00,2016-10-10,https://d1a3f4spazzrp4.cloudfront.net/kepler.gl/icon-demo-map.jpg,http://kepler.gl
+2016-09-17 00:30:03,30.0614122,31.2187021,driver_gps,1472774400000,True,6,2016-09-23T08:00:00.000Z,2016-10-01 09:54:31+00:00,2016-10-01 16:54:31+00:00,2016-10-10,https://d1a3f4spazzrp4.cloudfront.net/kepler.gl/icon-demo-map.jpg,http://kepler.gl
+2016-09-17 00:30:03,30.0612697,31.2191059,driver_gps,1472774400000,True,7,2016-09-23T08:00:00.000Z,2016-10-01 09:53:35+00:00,2016-10-01 16:53:35+00:00,2016-10-10,https://d1a3f4spazzrp4.cloudfront.net/kepler.gl/icon-demo-map.jpg,http://kepler.gl
+2016-09-17 00:30:08,30.0610977,31.2194728,driver_gps,1472774400000,True,,2016-09-23T08:00:00.000Z,,,,https://d1a3f4spazzrp4.cloudfront.net/kepler.gl/icon-demo-map.jpg,http://kepler.gl
+`;
export default {
fields: [
@@ -73,9 +74,9 @@ export default {
],
rows: [
[
- '2015-01-15 19:05:39 +00:00',
+ null,
'2015-01-15 19:23:42 +00:00',
- 1,
+ null,
1.59,
-73.99389648,
40.75011063,
@@ -83,12 +84,12 @@ export default {
40.75061798,
12,
true,
- 'orange peel'
+ 'orange peel 0'
],
[
- '2015-01-15 19:05:39 +00:00',
+ null,
'2015-01-15 19:32:00 +00:00',
- 0,
+ -3,
2.38,
-73.97642517,
40.73981094,
@@ -96,7 +97,7 @@ export default {
40.75788879,
16.5,
false,
- 'banana peel'
+ 'orange peel 0'
],
[
'2015-01-15 19:05:40 +00:00',
@@ -112,7 +113,7 @@ export default {
'apple tree'
],
[
- '2015-01-15 19:05:40 +00:00',
+ null,
'2015-01-15 19:28:18 +00:00',
5,
8.33,
@@ -122,7 +123,7 @@ export default {
40.78578186,
26,
true,
- 'orange peel'
+ 'orange peel 0'
],
[
'2015-01-15 19:05:41 +00:00',
@@ -296,7 +297,7 @@ export default {
[
'2015-01-15 19:05:43 +00:00',
'2015-01-15 19:17:43 +00:00',
- 0,
+ -3,
2.23,
-73.98509216,
40.75698853,
@@ -374,7 +375,7 @@ export default {
[
'2015-01-15 14:00:41 +00:00',
'2015-01-15 14:31:42 +00:00',
- 5,
+ -5,
7.48,
-73.87081909,
40.77370071,
@@ -439,7 +440,7 @@ export default {
[
'2015-01-15 14:00:43 +00:00',
'2015-01-15 14:58:40 +00:00',
- 1,
+ -1,
15.2,
-73.8012619,
40.66772842,
@@ -647,7 +648,7 @@ export default {
[
'2015-01-15 10:26:14 +00:00',
'2015-01-15 10:42:16 +00:00',
- 1,
+ -1,
1.9,
-73.94948578,
40.77207184,
@@ -3993,6 +3994,32 @@ export const sampleTripDataConfig = {
},
{
type: 'point',
+ config: {
+ dataId: 'test_trip_data',
+ columns: {
+ lat: 'pickup_latitude',
+ lng: 'pickup_longitude'
+ },
+ color: [255, 0, 0],
+ label: 'pickup',
+ isVisible: true
+ }
+ },
+ {
+ type: 'point',
+ config: {
+ dataId: 'test_trip_data',
+ columns: {
+ lat: 'dropoff_latitude',
+ lng: 'dropoff_longitude'
+ },
+ color: [0, 0, 255],
+ label: 'dropoff',
+ isVisible: true
+ }
+ },
+ {
+ type: 'cluster',
config: {
dataId: 'test_trip_data',
columns: {
@@ -4006,23 +4033,40 @@ export const sampleTripDataConfig = {
type: 'arc',
config: {
dataId: 'test_trip_data',
+ label: 'pickup -> dropoff',
columns: {
lat0: 'pickup_latitude',
lng0: 'pickup_longitude',
lat1: 'dropoff_latitude',
lng1: 'dropoff_longitude'
},
- isVisible: true
+ color: [255, 0, 0],
+ isVisible: true,
+ visConfig: {
+ targetColor: [0, 0, 255]
+ }
}
}
],
filters: [
{
- id: 'me',
dataId: 'test_trip_data',
name: 'tpep_pickup_datetime',
- type: 'timeRange',
enlarged: true
+ },
+ {
+ dataId: 'test_trip_data',
+ name: 'passenger_count'
+ },
+ {
+ dataId: 'test_trip_data',
+ name: 'fare_type',
+ value: ['orange peel', 'apple tree']
+ },
+ {
+ dataId: 'test_trip_data',
+ name: 'is_completed',
+ value: true
}
]
}
diff --git a/examples/webpack.config.local.js b/examples/webpack.config.local.js
index e80171973..afba1de55 100644
--- a/examples/webpack.config.local.js
+++ b/examples/webpack.config.local.js
@@ -29,16 +29,68 @@
const resolve = require('path').resolve;
const join = require('path').join;
const webpack = require('webpack');
+const fs = require('fs');
+const KeplerPackage = require('../package');
+const {logStep, logError} = require('../scripts/log');
const LIB_DIR = resolve(__dirname, '..');
const SRC_DIR = resolve(LIB_DIR, './src');
+// For deck.gl upgrade, load deck.gl from node_modules of the root directory
const NODE_MODULES_DIR = resolve(__dirname, '../node_modules');
-const KeplerPackage = require('../package');
+// For debugging deck.gl, load deck.gl from external deck.gl directory
+const EXTERNAL_DECK_SRC = resolve(__dirname, '../../deck.gl');
// Support for hot reloading changes to the deck.gl library:
-function makeLocalDevConfig(env, EXAMPLE_DIR = LIB_DIR) {
+function makeLocalDevConfig(env, EXAMPLE_DIR = LIB_DIR, externals = {}) {
+ const resolveAlias = {
+ // Imports kepler.gl library from the src directory in this repo
+ 'kepler.gl': SRC_DIR,
+ react: `${NODE_MODULES_DIR}/react`,
+ 'react-dom': `${NODE_MODULES_DIR}/react-dom`,
+ 'react-redux': `${NODE_MODULES_DIR}/react-redux/lib`,
+ 'styled-components': `${NODE_MODULES_DIR}/styled-components`
+ };
+
+ // resolve deck.gl from local dir
+ if (env.deck || env.deck_src) {
+ // Load deck.gl from root node_modules
+ // if env.deck_src Load deck.gl from deck.gl/modules/main/src folder parallel to kepler.gl
+ resolveAlias['deck.gl'] = env.deck
+ ? `${NODE_MODULES_DIR}/deck.gl/src`
+ : `${EXTERNAL_DECK_SRC}/modules/main/src`;
+
+ // if env.deck Load @deck.gl modules from root node_modules/@deck.gl
+ // if env.deck_src Load @deck.gl modules from deck.gl/modules folder parallel to kepler.gl
+ externals['deck.gl'].forEach(mdl => {
+ resolveAlias[`@deck.gl/${mdl}`] = env.deck
+ ? `${NODE_MODULES_DIR}/@deck.gl/${mdl}/src`
+ : `${EXTERNAL_DECK_SRC}/modules/${mdl}/src`;
+ });
+
+ ['luma.gl', 'probe.gl', 'loaders.gl'].forEach(name => {
+ // if env.deck Load ${name} from root node_modules
+ // if env.deck_src Load ${name} from deck.gl/node_modules folder parallel to kepler.gl
+ resolveAlias[name] = env.deck
+ ? `${NODE_MODULES_DIR}/${name}/src`
+ : name === 'probe.gl'
+ ? `${EXTERNAL_DECK_SRC}/node_modules/${name}/src`
+ : `${EXTERNAL_DECK_SRC}/node_modules/@${name}/core/src`;
+
+ // if env.deck Load @${name} modules from root node_modules/@${name}
+ // if env.deck_src Load @${name} modules from deck.gl/node_modules/@${name} folder parallel to kepler.gl`
+ externals[name].forEach(mdl => {
+ resolveAlias[`@${name}/${mdl}`] = env.deck
+ ? `${NODE_MODULES_DIR}/@${name}/${mdl}/src`
+ : `${EXTERNAL_DECK_SRC}/node_modules/@${name}/${mdl}/src`;
+ });
+ });
+ }
+
+ logStep(`resolve.alias:\n ${JSON.stringify(resolveAlias, null, 2)}`);
+
+ // load deck.gl from
return {
// suppress warnings about bundle size
devServer: {
@@ -51,39 +103,9 @@ function makeLocalDevConfig(env, EXAMPLE_DIR = LIB_DIR) {
devtool: 'source-map',
resolve: {
- alias: {
- // Imports kepler.gl library from the src directory in this repo
- 'kepler.gl': SRC_DIR,
- react: `${NODE_MODULES_DIR}/react`,
- 'react-dom': `${NODE_MODULES_DIR}/react-dom`,
- 'react-redux': `${NODE_MODULES_DIR}/react-redux/lib`,
- 'styled-components': `${NODE_MODULES_DIR}/styled-components`,
- ...(env.deck
- ? {
- 'luma.gl': `${NODE_MODULES_DIR}/luma.gl/src`,
- '@luma.gl/constants': `${NODE_MODULES_DIR}/@luma.gl/constants/src`,
- '@luma.gl/core': `${NODE_MODULES_DIR}/@luma.gl/core/src`,
- '@luma.gl/debug': `${NODE_MODULES_DIR}/@luma.gl/debug/src`,
- '@luma.gl/webgl': `${NODE_MODULES_DIR}/@luma.gl/webgl/src`,
- '@luma.gl/webgl-state-tracker': `${NODE_MODULES_DIR}/@luma.gl/webgl-state-tracker/src`,
- '@luma.gl/webgl2-polyfill': `${NODE_MODULES_DIR}/@luma.gl/webgl2-polyfill/src`,
- '@luma.gl/shadertools': `${NODE_MODULES_DIR}/@luma.gl/shadertools/src`,
- '@luma.gl/addons': `${NODE_MODULES_DIR}/@luma.gl/addons/src`,
-
- 'deck.gl': `${NODE_MODULES_DIR}/deck.gl/src`,
- '@deck.gl/core': `${NODE_MODULES_DIR}/@deck.gl/core/src`,
- '@deck.gl/layers': `${NODE_MODULES_DIR}/@deck.gl/layers/src`,
- '@deck.gl/react': `${NODE_MODULES_DIR}/@deck.gl/react/src`,
- '@deck.gl/mesh-layers': `${NODE_MODULES_DIR}/@deck.gl/mesh-layers/src`,
-
- 'probe.gl': `${NODE_MODULES_DIR}/probe.gl/src`,
-
- '@loaders.gl/core': `${NODE_MODULES_DIR}/@loaders.gl/core/src`,
- '@loaders.gl/gltf': `${NODE_MODULES_DIR}/@loaders.gl/gltf/src`
- }
- : {})
- }
+ alias: resolveAlias
},
+
module: {
rules: [
{
@@ -108,25 +130,33 @@ function makeLocalDevConfig(env, EXAMPLE_DIR = LIB_DIR) {
function makeBabelRule(env, exampleDir) {
return {
- // Compile source using bable
+ // Compile source using babel
test: /\.js$/,
loader: 'babel-loader',
include: [
- ...(env.deck
+ ...(env.deck || env.deck_src
? [
- `${NODE_MODULES_DIR}/@deck.gl`,
- `${NODE_MODULES_DIR}/@luma.gl`,
- `${NODE_MODULES_DIR}/@probe.gl`,
- `${NODE_MODULES_DIR}/@loaders.gl`
+ join(NODE_MODULES_DIR, '@deck.gl'),
+ join(NODE_MODULES_DIR, '@luma.gl'),
+ join(NODE_MODULES_DIR, '@probe.gl'),
+ join(NODE_MODULES_DIR, '@loaders.gl'),
+ join(EXTERNAL_DECK_SRC, 'modules'),
+ join(EXTERNAL_DECK_SRC, 'node_modules/@luma.gl'),
+ join(EXTERNAL_DECK_SRC, 'node_modules/@probe.gl'),
+ join(EXTERNAL_DECK_SRC, 'node_modules/probe.gl'),
+ join(EXTERNAL_DECK_SRC, 'node_modules/@loaders.gl')
]
: []),
join(exampleDir, 'src'),
SRC_DIR
],
// do not exclude deck.gl and luma.gl when loading from root/node_modules
- exclude: env.deck
- ? [/node_modules\/(?!(@deck\.gl|@luma\.gl|@probe\.gl|@loaders\.gl)\/).*/]
- : [/node_modules/],
+ exclude:
+ env.deck || env.deck_src
+ ? [
+ /node_modules\/(?!(@deck\.gl|@luma\.gl|@probe\.gl|probe.gl|@loaders\.gl)\/).*/
+ ]
+ : [/node_modules/],
options: {
presets: ['@babel/preset-env', '@babel/preset-react'],
plugins: [
@@ -184,11 +214,13 @@ function makeBabelRule(env, exampleDir) {
* Add local settings to load kepler/deck/luma from root node_modules
* Add source map loader
* Add Environment plugins
- * @param {*} exampleConfig
- * @param {*} exampleDir
+ * @param {Object} env
+ * @param {Object} exampleConfig
+ * @param {string} exampleDir
+ * @param {Object} externals
*/
-function addLocalDevSettings(env, exampleConfig, exampleDir) {
- const localDevConfig = makeLocalDevConfig(env, exampleDir);
+function addLocalDevSettings(env, exampleConfig, exampleDir, externals) {
+ const localDevConfig = makeLocalDevConfig(env, exampleDir, externals);
const config = {...exampleConfig, ...localDevConfig};
config.resolve = config.resolve || {};
@@ -211,7 +243,7 @@ function addLocalDevSettings(env, exampleConfig, exampleDir) {
return config;
}
-function addBableSettings(env, config, exampleDir) {
+function addBabelSettings(env, config, exampleDir) {
return {
...config,
module: {
@@ -225,8 +257,44 @@ function addBableSettings(env, config, exampleDir) {
}
module.exports = (exampleConfig, exampleDir) => env => {
- let config = addLocalDevSettings(env, exampleConfig, exampleDir);
- config = addBableSettings(env, config, exampleDir);
- return config;
+ // find all @deck.gl @luma.gl @loaders.gl modules
+ const modules = ['@deck.gl', '@loaders.gl', '@luma.gl', '@probe.gl'];
+ const loadAllDirs = modules.map(
+ dir =>
+ new Promise(function readDir(success, reject) {
+ fs.readdir(join(NODE_MODULES_DIR, dir), function readDirItems(
+ err,
+ items
+ ) {
+ if (err) {
+ logError(
+ `Cannot find ${dir} in node_modules, make sure it is installed.`,
+ err
+ );
+ success(null);
+ }
+ success(items);
+ });
+ })
+ );
+
+ return Promise.all(loadAllDirs)
+ .then(results => ({
+ 'deck.gl': results[0],
+ 'loaders.gl': results[1],
+ 'luma.gl': results[2],
+ 'probe.gl': results[3]
+ }))
+ .then(externals => {
+ let config = addLocalDevSettings(
+ env,
+ exampleConfig,
+ exampleDir,
+ externals
+ );
+ config = addBabelSettings(env, config, exampleDir, externals);
+
+ return config;
+ });
};
diff --git a/package.json b/package.json
index 8d1d22d44..3296a33f1 100644
--- a/package.json
+++ b/package.json
@@ -34,6 +34,7 @@
"coveralls": "nyc npm test && nyc report --reporter cobertura --reporter=text-lcov | coveralls",
"start": "npm run install-and-start -- examples/demo-app start-local",
"start:deck": "npm run install-and-start -- examples/demo-app start-local-deck",
+ "start:deck-src": "npm run install-and-start -- examples/demo-app start-local-deck-src",
"start:open-modal": "npm run install-and-start -- examples/open-modal start-local",
"start:custom-reducer": "npm run install-and-start -- examples/custom-reducer start-local",
"start:replace-component": "npm run install-and-start -- examples/replace-component start-local",
@@ -87,7 +88,7 @@
"d3-hexbin": "^0.2.2",
"d3-request": "^1.0.6",
"d3-scale": "^1.0.6",
- "deck.gl": "7.1.11",
+ "deck.gl": "^7.3.14",
"fuzzy": "^0.1.3",
"global": "^4.3.0",
"h3-js": "^3.1.0",
@@ -103,7 +104,7 @@
"lodash.throttle": "^4.1.1",
"lodash.uniq": "^4.0.1",
"lodash.uniqby": "^4.7.0",
- "luma.gl": "^7.1.1",
+ "luma.gl": "^7.3.2",
"mini-svg-data-uri": "^1.0.3",
"moment": "^2.10.6",
"pbf": "^3.1.0",
@@ -161,7 +162,7 @@
"@babel/register": "^7.0.0",
"@babel/runtime": "^7.0.0",
"@babel/traverse": "^7.2.3",
- "@deck.gl/test-utils": "^7.1.5",
+ "@deck.gl/test-utils": "^7.3.14",
"@probe.gl/test-utils": "^3.0.1",
"babel-eslint": "^9.0.0",
"babel-loader": "^8.0.0",
@@ -194,6 +195,7 @@
"react-hot-loader": "^3.0.0-beta.6",
"redux-mock-store": "^1.2.1",
"sinon": "^2.4.1",
+ "sinon-stub-promise": "^4.0.0",
"source-map-loader": "^0.2.1",
"styled-components": "^4.1.3",
"tap-spec": "^4.1.1",
diff --git a/scripts/log.js b/scripts/log.js
index d42577034..91006ad45 100644
--- a/scripts/log.js
+++ b/scripts/log.js
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import console from 'global/console';
+const console = require('global/console');
const Colors = {
Reset: '\x1b[0m',
@@ -54,8 +54,10 @@ function log(color) {
};
}
-export const logSuccess = log(Colors.FgGreen);
-export const logOk = log(Colors.FgCyan);
-export const logError = log(Colors.FgRed);
-export const logProgress = log(Colors.FgBlue);
-export const logStep = log(Colors.FgMagenta);
+module.exports = {
+ logSuccess: log(Colors.FgGreen),
+ logOk: log(Colors.FgCyan),
+ logError: log(Colors.FgRed),
+ logProgress: log(Colors.FgBlue),
+ logStep: log(Colors.FgMagenta),
+}
diff --git a/src/actions/vis-state-actions.js b/src/actions/vis-state-actions.js
index f87b25463..47ec0bd20 100644
--- a/src/actions/vis-state-actions.js
+++ b/src/actions/vis-state-actions.js
@@ -582,6 +582,21 @@ export function setEditorMode(mode) {
}
/**
+ * Trigger CPU filter of selected dataset
+ * @memberof visStateActions
+ * @param {string | Arrary<string>} dataId - single dataId or an array of dataIds
+ * @returns {{type: ActionTypes.APPLY_CPU_FILTER, dataId: string}}
+ * @public
+ */
+export function applyCPUFilter(dataId) {
+ return {
+ type: ActionTypes.APPLY_CPU_FILTER,
+ dataId
+ };
+}
+
+/**
+
* Toggle editor layer visibility
* @memberof visStateActions
* @return {{type: ActionTypes.TOGGLE_EDITOR_VISIBILITY}}
diff --git a/src/components/bottom-widget.js b/src/components/bottom-widget.js
index bbd311671..c2189cfcc 100644
--- a/src/components/bottom-widget.js
+++ b/src/components/bottom-widget.js
@@ -23,7 +23,7 @@ import styled from 'styled-components';
import PropTypes from 'prop-types';
import TimeWidgetFactory from './filters/time-widget';
import AnimationControlFactory from './common/animation-control/animation-control';
-import {FILTER_TYPES} from 'utils/filter-utils';
+import {FILTER_TYPES} from 'constants/default-settings';
const propTypes = {
filters: PropTypes.arrayOf(PropTypes.object),
diff --git a/src/components/editor/editor.js b/src/components/editor/editor.js
index b96b5df60..05f014799 100644
--- a/src/components/editor/editor.js
+++ b/src/components/editor/editor.js
@@ -28,7 +28,7 @@ import get from 'lodash.get';
import {EDITOR_AVAILABLE_LAYERS} from 'constants/default-settings';
import FeatureActionPanel from './feature-action-panel';
-import {FILTER_TYPES} from 'utils/filter-utils';
+import {FILTER_TYPES} from 'constants/default-settings';
import {
DEFAULT_RADIUS,
diff --git a/src/components/filters/filter-panels/filter-panel-with-field-select.js b/src/components/filters/filter-panels/filter-panel-with-field-select.js
index fb87893fd..3630cc03d 100644
--- a/src/components/filters/filter-panels/filter-panel-with-field-select.js
+++ b/src/components/filters/filter-panels/filter-panel-with-field-select.js
@@ -78,6 +78,7 @@ function FieldPanelWithFieldSelectFactory(
{panelActions && panelActions.map(panelAction => (
<PanelHeaderAction
id={panelAction.id}
+ key={panelAction.id}
onClick={panelAction.onClick}
tooltip={panelAction.tooltip}
IconComponent={panelAction.iconComponent}
diff --git a/src/components/kepler-gl.js b/src/components/kepler-gl.js
index 423701ff8..027fc9f2d 100644
--- a/src/components/kepler-gl.js
+++ b/src/components/kepler-gl.js
@@ -347,7 +347,6 @@ function KeplerGlFactory(
}
containerW={containerW}
/>
-
<ModalWrapper
mapStyle={mapStyle}
visState={visState}
diff --git a/src/components/map-container.js b/src/components/map-container.js
index 4861ee762..b967f02d8 100644
--- a/src/components/map-container.js
+++ b/src/components/map-container.js
@@ -36,12 +36,12 @@ import Editor from './editor/editor';
// utils
import {generateMapboxLayers, updateMapboxLayers} from 'layers/mapbox-utils';
import {OVERLAY_TYPE} from 'layers/base-layer';
-import {onWebGLInitialized, setLayerBlending} from 'utils/gl-utils';
+import {setLayerBlending} from 'utils/gl-utils';
import {transformRequest} from 'utils/map-style-utils/mapbox-utils';
// default-settings
import ThreeDBuildingLayer from 'deckgl-layers/3d-building-layer/3d-building-layer';
-import {FILTER_TYPES} from 'utils/filter-utils';
+import {FILTER_TYPES} from 'constants/default-settings';
const MAP_STYLE = {
container: {
@@ -108,6 +108,8 @@ export default function MapContainerFactory(MapPopover, MapControl) {
this.previousLayers = {
// [layers.id]: mapboxLayerConfig
};
+
+ this._deck = null;
}
componentWillUnmount() {
@@ -164,8 +166,6 @@ export default function MapContainerFactory(MapPopover, MapControl) {
});
};
- _onWebGLInitialized = onWebGLInitialized;
-
_handleMapToggleLayer = layerId => {
const {index: mapIndex = 0, visStateActions} = this.props;
visStateActions.toggleLayerForMap(mapIndex, layerId);
@@ -238,6 +238,7 @@ export default function MapContainerFactory(MapPopover, MapControl) {
objectInfo &&
objectInfo.picked
) {
+
// if anything hovered
const {object, layer: overlay} = objectInfo;
@@ -300,22 +301,18 @@ export default function MapContainerFactory(MapPopover, MapControl) {
_renderLayer = (overlays, idx) => {
const {
+ datasets,
layers,
layerData,
hoverInfo,
clicked,
mapState,
interactionConfig,
- mousePos,
animationConfig
} = this.props;
const layer = layers[idx];
const data = layerData[idx];
-
- const layerInteraction = {
- mousePosition: mousePos.mousePosition,
- wrapLongitude: true
- };
+ const {gpuFilter} = datasets[layer.config.dataId] || {};
const objectHovered = clicked || hoverInfo;
const layerCallbacks = {
@@ -325,13 +322,13 @@ export default function MapContainerFactory(MapPopover, MapControl) {
// Layer is Layer class
const layerOverlay = layer.renderLayer({
data,
+ gpuFilter,
idx,
- layerInteraction,
- objectHovered,
- mapState,
interactionConfig,
layerCallbacks,
- animationConfig
+ mapState,
+ animationConfig,
+ objectHovered
});
return overlays.concat(layerOverlay || []);
@@ -378,10 +375,14 @@ export default function MapContainerFactory(MapPopover, MapControl) {
viewState={mapState}
id="default-deckgl-overlay"
layers={deckGlLayers}
- onWebGLInitialized={this._onWebGLInitialized}
onBeforeRender={this._onBeforeRender}
onHover={visStateActions.onLayerHover}
onClick={visStateActions.onLayerClick}
+ ref={comp => {
+ if (comp && comp.deck && !this._deck) {
+ this._deck = comp.deck;
+ }
+ }}
/>
);
}
diff --git a/src/components/modal-container.js b/src/components/modal-container.js
index 7aaf6e5e2..d93702463 100644
--- a/src/components/modal-container.js
+++ b/src/components/modal-container.js
@@ -154,15 +154,17 @@ export default function ModalContainerFactory(
const {selectedDataset, dataType, filtered} = uiState.exportData;
// get the selected data
const filename = 'kepler-gl';
- const selectedDatasets = datasets[selectedDataset] ? [datasets[selectedDataset]] : Object.values(datasets);
+ const selectedDatasets = datasets[selectedDataset] ?
+ [datasets[selectedDataset]] : Object.values(datasets);
+
if (!selectedDatasets.length) {
// error: selected dataset not found.
this._closeModal();
}
selectedDatasets.forEach(selectedData => {
- const {allData, data, fields, label} = selectedData;
- const exportData = filtered ? data : allData;
+ const {allData, fields, label, filteredIdxCPU = []} = selectedData;
+ const exportData = filtered ? filteredIdxCPU.map(i => allData[i]) : allData;
// start to export data according to selected data type
switch (dataType) {
case EXPORT_DATA_TYPE.CSV: {
@@ -175,7 +177,6 @@ export default function ModalContainerFactory(
default:
break;
}
-
});
this._closeModal();
@@ -343,6 +344,7 @@ export default function ModalContainerFactory(
<ExportDataModal
{...uiState.exportData}
datasets={datasets}
+ applyCPUFilter={this.props.visStateActions.applyCPUFilter}
onClose={this._closeModal}
onChangeExportDataType={this.props.uiStateActions.setExportDataType}
onChangeExportSelectedDataset={this.props.uiStateActions.setExportSelectedDataset}
diff --git a/src/components/modals/data-table-modal.js b/src/components/modals/data-table-modal.js
index 9445a2671..309d463f1 100644
--- a/src/components/modals/data-table-modal.js
+++ b/src/components/modals/data-table-modal.js
@@ -88,6 +88,7 @@ function DataTableModalFactory(DataGrid) {
}
const activeDataset = datasets[dataId];
+ const rows = activeDataset.allData;
return (
<StyledModal className="dataset-modal" >
@@ -99,7 +100,7 @@ function DataTableModalFactory(DataGrid) {
<DataGrid
width={width}
height={height}
- rows={activeDataset.data}
+ rows={rows}
columns={activeDataset.fields}
/>
</StyledModal>
diff --git a/src/components/modals/export-data-modal.js b/src/components/modals/export-data-modal.js
index c87fe6c5b..646989a81 100644
--- a/src/components/modals/export-data-modal.js
+++ b/src/components/modals/export-data-modal.js
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {EXPORT_DATA_TYPE_OPTIONS} from 'constants/default-settings';
@@ -36,6 +36,7 @@ const propTypes = {
dataType: PropTypes.string.isRequired,
filtered: PropTypes.bool.isRequired,
// callbacks
+ applyCPUFilter: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
onChangeExportSelectedDataset: PropTypes.func.isRequired,
onChangeExportDataType: PropTypes.func.isRequired,
@@ -45,90 +46,122 @@ const propTypes = {
const getDataRowCount = (datasets, selectedDataset, filtered) => {
const selectedData = datasets[selectedDataset];
if (!selectedData) {
- return `${Object.keys(datasets).length} Files ` ;
+ return `${Object.keys(datasets).length} Files `;
}
- const {allData, data} = selectedData;
- const rowCount = filtered ? data.length : allData.length;
+ const {allData, filteredIdxCPU} = selectedData;
+
+ if (filtered && !filteredIdxCPU) {
+ return '-';
+ }
+
+ const rowCount = filtered ? filteredIdxCPU.length : allData.length;
+
return `${rowCount.toLocaleString()} Rows`;
};
-const ExportDataModal = ({
- datasets,
- selectedDataset,
- dataType,
- filtered,
- config,
- // callbacks:
- onChangeExportDataType,
- onChangeExportSelectedDataset,
- onChangeExportFiltered
-}) => (
- <StyledModalContent className="export-data-modal">
- <div>
- <StyledExportSection>
- <div className="description">
- <div className="title">
- Dataset
- </div>
- <div className="subtitle">
- Choose the datasets you want to export
- </div>
- </div>
- <div className="selection">
- <select value={selectedDataset} onChange={e => onChangeExportSelectedDataset(e.target.value)}>
- {['All'].concat(Object.keys(datasets)).map(d => (
- <option key={d} value={d}>{(datasets[d] && datasets[d].label) || d}</option>
- ))}
- </select>
- </div>
- </StyledExportSection>
- <StyledExportSection>
- <div className="description">
- <div className="title">
- Data Type
- </div>
- <div className="subtitle">
- Choose the type of data you want to export
- </div>
- </div>
- <div className="selection">
- {EXPORT_DATA_TYPE_OPTIONS.map(op =>
- <StyledType
- key={op.id}
- selected={dataType === op.id}
- available={op.available}
- onClick={() => op.available && onChangeExportDataType(op.id)}
- >
- <FileType ext={op.label} height="80px" fontSize="11px" />
- </StyledType>
- )}
- </div>
- </StyledExportSection>
- <StyledExportSection>
- <div className="description">
- <div className="title">
- Filter Data
- </div>
- <div className="subtitle">
- You can choose exporting original data or filtered data
- </div>
- </div>
- <div className="selection">
- <StyledFilteredOption selected={!filtered} onClick={() => onChangeExportFiltered(false)}>
- <div className="filtered-title">Unfiltered Data</div>
- <div className="filtered-subtitle">{getDataRowCount(datasets, selectedDataset, false)}</div>
- </StyledFilteredOption>
- <StyledFilteredOption selected={filtered} onClick={() => onChangeExportFiltered(true)}>
- <div className="filtered-title">Filtered Data</div>
- <div className="filtered-subtitle">{getDataRowCount(datasets, selectedDataset, true)}</div>
- </StyledFilteredOption>
- </div>
- </StyledExportSection>
- </div>
- </StyledModalContent>
-);
+const ExportDataModalFactory = () => {
+ class ExportDataModal extends Component {
+ componentDidMount() {
+ const toCPUFilter =
+ this.props.selectedDataset || Object.keys(this.props.datasets);
+ this.props.applyCPUFilter(toCPUFilter);
+ }
+
+ _onSelectDataset = ({target: {value}}) => {
+ this.props.applyCPUFilter(value);
+ this.props.onChangeExportSelectedDataset(value);
+ };
+
+ render() {
+ const {
+ datasets,
+ selectedDataset,
+ dataType,
+ filtered,
+ onChangeExportDataType,
+ onChangeExportFiltered
+ } = this.props;
-ExportDataModal.propTypes = propTypes;
+ return (
+ <StyledModalContent className="export-data-modal">
+ <div>
+ <StyledExportSection>
+ <div className="description">
+ <div className="title">Dataset</div>
+ <div className="subtitle">
+ Choose the datasets you want to export
+ </div>
+ </div>
+ <div className="selection">
+ <select
+ value={selectedDataset}
+ onChange={this._onSelectDataset}
+ >
+ {['All'].concat(Object.keys(datasets)).map(d => (
+ <option key={d} value={d}>
+ {(datasets[d] && datasets[d].label) || d}
+ </option>
+ ))}
+ </select>
+ </div>
+ </StyledExportSection>
+ <StyledExportSection>
+ <div className="description">
+ <div className="title">Data Type</div>
+ <div className="subtitle">
+ Choose the type of data you want to export
+ </div>
+ </div>
+ <div className="selection">
+ {EXPORT_DATA_TYPE_OPTIONS.map(op => (
+ <StyledType
+ key={op.id}
+ selected={dataType === op.id}
+ available={op.available}
+ onClick={() =>
+ op.available && onChangeExportDataType(op.id)
+ }
+ >
+ <FileType ext={op.label} height="80px" fontSize="11px" />
+ </StyledType>
+ ))}
+ </div>
+ </StyledExportSection>
+ <StyledExportSection>
+ <div className="description">
+ <div className="title">Filter Data</div>
+ <div className="subtitle">
+ You can choose exporting original data or filtered data
+ </div>
+ </div>
+ <div className="selection">
+ <StyledFilteredOption
+ selected={!filtered}
+ onClick={() => onChangeExportFiltered(false)}
+ >
+ <div className="filtered-title">Unfiltered Data</div>
+ <div className="filtered-subtitle">
+ {getDataRowCount(datasets, selectedDataset, false)}
+ </div>
+ </StyledFilteredOption>
+ <StyledFilteredOption
+ selected={filtered}
+ onClick={() => onChangeExportFiltered(true)}
+ >
+ <div className="filtered-title">Filtered Data</div>
+ <div className="filtered-subtitle">
+ {getDataRowCount(datasets, selectedDataset, true)}
+ </div>
+ </StyledFilteredOption>
+ </div>
+ </StyledExportSection>
+ </div>
+ </StyledModalContent>
+ );
+ }
+ }
+ ExportDataModal.propTypes = propTypes;
+ return ExportDataModal;
+};
-const ExportDataModalFactory = () => ExportDataModal;
export default ExportDataModalFactory;
diff --git a/src/components/side-panel/filter-panel/filter-panel.js b/src/components/side-panel/filter-panel/filter-panel.js
index c8fcd60cb..a52e65e56 100644
--- a/src/components/side-panel/filter-panel/filter-panel.js
+++ b/src/components/side-panel/filter-panel/filter-panel.js
@@ -22,8 +22,7 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {createSelector} from 'reselect';
import styled from 'styled-components';
-import {FILTER_TYPES} from 'utils/filter-utils';
-import {ALL_FIELD_TYPES} from 'constants/default-settings';
+import {ALL_FIELD_TYPES, FILTER_TYPES} from 'constants/default-settings';
import FilterPanelHeaderFactory from 'components/side-panel/filter-panel/filter-panel-header';
import NewFilterPanelFactory from 'components/filters/filter-panels/new-filter-panel';
diff --git a/src/components/side-panel/layer-panel/layer-column-config.js b/src/components/side-panel/layer-panel/layer-column-config.js
index a8d09efad..c11895160 100644
--- a/src/components/side-panel/layer-panel/layer-column-config.js
+++ b/src/components/side-panel/layer-panel/layer-column-config.js
@@ -22,6 +22,7 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import FieldSelector from 'components/common/field-selector';
+import {createSelector} from 'reselect';
import {
PanelLabel,
@@ -35,51 +36,68 @@ const TopRow = styled.div`
export default class LayerColumnConfig extends Component {
static propTypes = {
- layer: PropTypes.object.isRequired,
+ columns: PropTypes.object.isRequired,
fields: PropTypes.arrayOf(PropTypes.any).isRequired,
+ assignColumnPairs: PropTypes.func.isRequired,
+ assignColumn: PropTypes.func.isRequired,
updateLayerConfig: PropTypes.func.isRequired,
- fieldPairs: PropTypes.arrayOf(PropTypes.any)
+ columnPairs: PropTypes.object,
+ fieldPairs: PropTypes.arrayOf(PropTypes.any),
+ columnLabels: PropTypes.object
};
+ columnPairs = props => props.columnPairs;
+ fieldPairs = props => props.fieldPairs;
+ fieldPairsSelector = createSelector(
+ this.columnPairs,
+ this.fieldPairs,
+ (columnPairs, fieldPairs) => columnPairs ?
+ fieldPairs.map(fp => ({
+ name: fp.defaultName,
+ type: 'point',
+ pair: fp.pair
+ }))
+ : null
+ );
+
_updateColumn(key, value) {
- const {layer} = this.props;
+ const {columnPairs, assignColumnPairs, assignColumn} = this.props;
const columns =
- value && value.pair && layer.columnPairs
- ? layer.assignColumnPairs(key, value.pair)
- : layer.assignColumn(key, value);
+ value && value.pair && columnPairs
+ ? assignColumnPairs(key, value.pair)
+ : assignColumn(key, value);
this.props.updateLayerConfig({columns});
}
render() {
- const {layer, fields, fieldPairs} = this.props;
+ const {
+ columns,
+ columnLabels,
+ fields
+ } = this.props;
+
+ const fieldPairs = this.fieldPairsSelector(this.props);
+
return (
<div>
<SidePanelSection>
<div className="layer-config__column">
- <TopRow>
- <PanelLabel>Columns</PanelLabel>
- <PanelLabel>* Required</PanelLabel>
- </TopRow>
- {Object.keys(layer.config.columns).map(key => (
- <ColumnSelector
- column={layer.config.columns[key]}
- label={key}
- key={key}
- allFields={fields}
- fieldPairs={
- layer.columnPairs
- ? fieldPairs.map(fp => ({
- name: fp.defaultName,
- type: 'point',
- pair: fp.pair
- }))
- : null
- }
- onSelect={val => this._updateColumn(key, val)}
- />
- ))}
+ <TopRow>
+ <PanelLabel>Columns</PanelLabel>
+ <PanelLabel>* Required</PanelLabel>
+ </TopRow>
+ {Object.keys(columns).map(key => (
+ <ColumnSelector
+ column={columns[key]}
+ label={columnLabels && columnLabels[key] || key}
+ key={key}
+ allFields={fields}
+ fieldPairs={fieldPairs}
+ onSelect={val => this._updateColumn(key, val)}
+ />
+ ))}
</div>
</SidePanelSection>
</div>
diff --git a/src/components/side-panel/layer-panel/layer-configurator.js b/src/components/side-panel/layer-panel/layer-configurator.js
index 7527450be..3b831a115 100644
--- a/src/components/side-panel/layer-panel/layer-configurator.js
+++ b/src/components/side-panel/layer-panel/layer-configurator.js
@@ -891,7 +891,11 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {
/>
)}
<LayerColumnConfig
- layer={layer}
+ columnPairs={layer.columnPairs}
+ columns={layer.config.columns}
+ assignColumnPairs={layer.assignColumnPairs.bind(layer)}
+ assignColumn={layer.assignColumn.bind(layer)}
+ columnLabels={layer.columnLabels}
fields={fields}
fieldPairs={fieldPairs}
updateLayerConfig={updateLayerConfig}
diff --git a/src/constants/action-types.js b/src/constants/action-types.js
index 61019caae..f52f4f057 100644
--- a/src/constants/action-types.js
+++ b/src/constants/action-types.js
@@ -95,6 +95,7 @@ const ActionTypes = keyMirror({
LOAD_FILES_ERR: null,
LAYER_COLOR_UI_CHANGE: null,
TOGGLE_FEATURE_LAYER: null,
+ APPLY_CPU_FILTER: null,
// mapState
UPDATE_MAP: null,
diff --git a/src/constants/default-settings.js b/src/constants/default-settings.js
index e6ddff299..19a70a898 100644
--- a/src/constants/default-settings.js
+++ b/src/constants/default-settings.js
@@ -247,6 +247,14 @@ export const TRIP_ARC_FIELDS = {
lng1: 'dropoff'
};
+export const FILTER_TYPES = keyMirror({
+ range: null,
+ select: null,
+ timeRange: null,
+ multiSelect: null,
+ polygon: null
+});
+
export const SCALE_TYPES = keyMirror({
ordinal: null,
quantile: null,
@@ -725,3 +733,8 @@ export const EDITOR_AVAILABLE_LAYERS = [
LAYER_TYPES.arc,
LAYER_TYPES.line
];
+// GPU Filtering
+/**
+ * Max number of filter value buffers that deck.gl provides
+ */
+export const MAX_GPU_FILTERS = 4;
diff --git a/src/deckgl-layers/arc-brushing-layer/arc-brushing-layer.js b/src/deckgl-layers/arc-brushing-layer/arc-brushing-layer.js
deleted file mode 100644
index 3016c6641..000000000
--- a/src/deckgl-layers/arc-brushing-layer/arc-brushing-layer.js
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-import {ArcLayer} from 'deck.gl';
-import {editShader} from 'deckgl-layers/layer-utils/shader-utils';
-
-const defaultProps = {
- ...ArcLayer.defaultProps,
- // show arc if source is in brush
- brushSource: true,
- // show arc if target is in brush
- brushTarget: true,
- enableBrushing: true,
- getWidth: d => d.strokeWidth,
- strokeScale: 1,
- // brush radius in meters
- brushRadius: 100000,
- mousePosition: [0, 0]
-};
-
-function addBrushingVsShader(vs) {
- return editShader(
- vs,
- 'arc brushing vs',
- 'vec2 offset = getExtrusionOffset((next.xy - curr.xy) * indexDir, positions.y, widthPixels);',
- 'vec2 offset = brushing_getExtrusionOffset((next.xy - curr.xy) * indexDir, positions.y, project_uViewportSize, instancePositions, instanceWidths);'
- );
-}
-
-function addBrushingVs64Shader(vs) {
- return editShader(
- vs,
- 'arc brushing vs64',
- 'vec2 offset = getExtrusionOffset(next_pos_clipspace.xy - curr_pos_clipspace.xy, positions.y, widthPixels);',
- 'vec2 offset = brushing_getExtrusionOffset(next_pos_clipspace.xy - curr_pos_clipspace.xy, positions.y, project_uViewportSize, instancePositions, instanceWidths);'
- );
-}
-
-export default class ArcBrushingLayer extends ArcLayer {
- getShaders() {
- const shaders = super.getShaders();
- return {
- vs: this.is64bitEnabled()
- ? addBrushingVs64Shader(shaders.vs)
- : addBrushingVsShader(shaders.vs),
- fs: shaders.fs,
- modules: shaders.modules.concat(['brushing'])
- };
- }
-
- draw(opts) {
- const {uniforms} = opts;
-
- const {
- brushSource,
- brushTarget,
- brushRadius,
- enableBrushing,
- mousePosition,
- strokeScale
- } = this.props;
-
- super.draw({
- ...opts,
- uniforms: {
- ...uniforms,
- brushing_uBrushSource: brushSource ? 1 : 0,
- brushing_uBrushTarget: brushTarget ? 1 : 0,
- brushing_uBrushRadius: brushRadius,
- brushing_uEnableBrushing: enableBrushing ? 1 : 0,
- brushing_uStrokeScale: strokeScale,
- brushing_uMousePosition: mousePosition
- ? new Float32Array(this.unproject(mousePosition))
- : defaultProps.mousePosition
- }
- });
- }
-}
-
-ArcBrushingLayer.layerName = 'ArcBrushingLayer';
-ArcBrushingLayer.defaultProps = defaultProps;
diff --git a/src/deckgl-layers/cluster-layer/cluster-layer.js b/src/deckgl-layers/cluster-layer/cluster-layer.js
index 18b5fa82b..f9fe33a67 100644
--- a/src/deckgl-layers/cluster-layer/cluster-layer.js
+++ b/src/deckgl-layers/cluster-layer/cluster-layer.js
@@ -20,251 +20,210 @@
import {CompositeLayer, ScatterplotLayer} from 'deck.gl';
import geoViewport from '@mapbox/geo-viewport';
-import {ascending, max} from 'd3-array';
-import {
- getQuantileDomain,
- getOrdinalDomain,
- getLinearDomain
-} from 'utils/data-scale-utils';
-import {
- getColorScaleFunction,
- getRadiusScaleFunction,
- needsRecalculateRadiusRange,
- needsRecalculateColorDomain,
- needReCalculateScaleFunction
-} from '../layer-utils/utils';
+import CPUAggregator, {defaultColorDimension, getDimensionScale} from '../layer-utils/cpu-aggregator';
+import {getDistanceScales} from 'viewport-mercator-project';
+import {max} from 'd3-array';
+
import {DefaultColorRange} from 'constants/color-ranges';
import {LAYER_VIS_CONFIGS} from 'layers/layer-factory';
import {SCALE_TYPES} from 'constants/default-settings';
-import {
- clearClustererCache,
- clustersAtZoom,
- getGeoJSON
-} from '../layer-utils/cluster-utils';
+import ClusterBuilder, {getGeoJSON} from '../layer-utils/cluster-utils';
const defaultRadius = LAYER_VIS_CONFIGS.clusterRadius.defaultValue;
const defaultRadiusRange = LAYER_VIS_CONFIGS.clusterRadiusRange.defaultValue;
-const defaultProps = {
- clusterRadius: defaultRadius,
- colorDomain: null,
- colorRange: DefaultColorRange,
- colorScale: SCALE_TYPES.quantize,
- radiusRange: defaultRadiusRange,
+const defaultGetColorValue = points => points.length;
+const defaultGetRadiusValue = cell => cell.filteredPoints ? cell.filteredPoints.length : cell.points.length;
- // maybe later...
- lowerPercentile: 0,
- upperPercentile: 100,
+function processGeoJSON(step, props, aggregation, viewport) {
+ const {data, getPosition, filterData} = props;
+ const geoJSON = getGeoJSON(data, getPosition, filterData);
+ const clusterBuilder = new ClusterBuilder();
- getPosition: x => x.position,
+ this.setState({geoJSON, clusterBuilder});
+}
- // if want to have color based on customized aggregator, instead of count
- getColorValue: points => points.length,
+function getClusters(step, props, aggregation, viewport) {
- // if want to have radius based on customized aggregator, instead of count
- getRadiusValue: cell => cell.properties.point_count,
- fp64: false
-};
+ const {geoJSON, clusterBuilder} = this.state;
+ const {clusterRadius, zoom, width, height} = props;
+ const {longitude, latitude} = viewport;
-export default class ClusterLayer extends CompositeLayer {
- initializeState() {
- this.state = {
- clusters: null,
- geoJSON: null
- };
- }
+ // zoom needs to be an integer for the different map utils. Also helps with cache key.
+ const bbox = geoViewport.bounds([longitude, latitude], zoom, [width, height]);
+ const clusters = clusterBuilder.clustersAtZoom({bbox, clusterRadius, geoJSON, zoom});
- shouldUpdateState({changeFlags}) {
- return changeFlags.somethingChanged;
- }
+ this.setState({
+ layerData: {data: clusters}
+ });
+}
- updateState({context, oldProps, props, changeFlags}) {
- if (changeFlags.dataChanged || this.needsReProjectPoints(oldProps, props)) {
- // project data into clusters, and get clustered data
- this.processGeoJSON();
- this.getClusters();
+function getSubLayerRadius(dimensionState, dimension, layerProps) {
+ return cell => {
+ const {getRadiusValue} = layerProps;
+ const {scaleFunc} = dimensionState;
+ return scaleFunc(getRadiusValue(cell));
+ };
+}
- // this needs clustered data to be set
- this.getColorValueDomain();
- } else if (this.needsReclusterPoints(oldProps, props)) {
- this.getClusters();
- this.getColorValueDomain();
- } else if (this.needsRecalculateScaleFunction(oldProps, props)) {
- this.getColorValueDomain();
+export const clusterAggregation = {
+ key: 'position',
+ updateSteps: [
+ {
+ key: 'geojson',
+ triggers: {
+ position: {
+ prop: 'getPosition',
+ updateTrigger: 'getPosition'
+ },
+ filterData: {
+ prop: 'filterData',
+ updateTrigger: 'filterData'
+ }
+ },
+ updater: processGeoJSON
+ },
+ {
+ key: 'clustering',
+ triggers: {
+ clusterRadius: {
+ prop: 'clusterRadius'
+ },
+ zoom: {
+ prop: 'zoom'
+ },
+ width: {
+ prop: 'width'
+ },
+ height: {
+ prop: 'height'
+ }
+ },
+ updater: getClusters
}
- }
-
- needsReProjectPoints(oldProps, props) {
- return (
- oldProps.clusterRadius !== props.clusterRadius ||
- oldProps.getPosition !== props.getPosition
- );
- }
+ ]
+};
- needsReclusterPoints(oldProps, props) {
- return (
- Math.round(oldProps.mapState.zoom) !== Math.round(props.mapState.zoom)
- );
- }
+function getRadiusValueDomain(step, props, dimensionUpdater) {
+ const {key} = dimensionUpdater;
+ const {getRadiusValue} = props;
+ const {layerData} = this.state;
- needsRecalculateScaleFunction(oldProps, props) {
- return (
- needsRecalculateColorDomain(oldProps, props) ||
- needReCalculateScaleFunction(oldProps, props) ||
- needsRecalculateRadiusRange(oldProps, props) ||
- oldProps.getColorValue !== props.getColorValue
- );
- }
+ const valueDomain = [0, max(layerData.data, getRadiusValue)];
+ this._setDimensionState(key, {valueDomain});
+}
- processGeoJSON() {
- const {data, getPosition} = this.props;
- this.setState({geoJSON: getGeoJSON(data, getPosition)});
- clearClustererCache();
+const clusterLayerDimensions = [
+ defaultColorDimension,
+ {
+ key: 'radius',
+ accessor: 'getRadius',
+ nullValue: 0,
+ updateSteps: [
+ {
+ key: 'getDomain',
+ triggers: {
+ value: {
+ prop: 'getRadiusValue',
+ updateTrigger: 'getRadiusValue'
+ }
+ },
+ updater: getRadiusValueDomain
+ },
+ {
+ key: 'getScaleFunc',
+ triggers: {
+ domain: {prop: 'radiusDomain'},
+ range: {prop: 'radiusRange'},
+ scaleType: {prop: 'radiusScaleType'}
+ },
+ updater: getDimensionScale
+ }
+ ],
+ getSubLayerAccessor: getSubLayerRadius,
+ getPickingInfo: (dimensionState, cell, layerProps) => {
+ const radiusValue = layerProps.getRadiusValue(cell);
+ return {radiusValue};
+ }
}
+];
- getClusters() {
- const {geoJSON} = this.state;
- const {clusterRadius, mapState} = this.props;
- const {longitude, latitude, zoom, width, height} = mapState;
- // zoom needs to be an integer for the different map utils. Also helps with cache key.
- const zoomRound = Math.round(zoom);
- const bbox = geoViewport.bounds([longitude, latitude], zoomRound, [
- width,
- height
- ]);
+const defaultProps = {
+ clusterRadius: defaultRadius,
+ colorDomain: null,
+ colorRange: DefaultColorRange,
+ colorScaleType: SCALE_TYPES.quantize,
+ radiusScaleType: SCALE_TYPES.sqrt,
+ radiusRange: defaultRadiusRange,
+ getPosition: {type: 'accessor', value: x => x.position},
+ getColorValue: {type: 'accessor', value: defaultGetColorValue},
+ getRadiusValue: {type: 'accessor', value: defaultGetRadiusValue}
+};
- const clusters = clustersAtZoom({bbox, clusterRadius, geoJSON, zoom: zoomRound});
+export default class ClusterLayer extends CompositeLayer {
+ initializeState() {
+ const cpuAggregator = new CPUAggregator({
+ aggregation: clusterAggregation,
+ dimensions: clusterLayerDimensions
+ });
- this.setState({clusters});
+ this.state = {
+ cpuAggregator,
+ aggregatorState: cpuAggregator.state
+ };
}
- getColorValueDomain() {
- const {
- colorScale,
- getColorValue,
- getRadiusValue,
- onSetColorDomain
- } = this.props;
- const {clusters} = this.state;
-
- const radiusDomain = [0, max(clusters, getRadiusValue)];
-
- const colorValues = clusters.map(d => getColorValue(d.properties.points));
-
- const identity = d => d;
-
- const colorDomain =
- colorScale === SCALE_TYPES.ordinal
- ? getOrdinalDomain(colorValues, identity)
- : colorScale === SCALE_TYPES.quantile
- ? getQuantileDomain(colorValues, identity, ascending)
- : getLinearDomain(colorValues, identity);
-
+ updateState({oldProps, props, changeFlags}) {
this.setState({
- colorDomain,
- radiusDomain
+ // make a copy of the internal state of cpuAggregator for testing
+ aggregatorState: this.state.cpuAggregator.updateState(
+ {oldProps, props, changeFlags},
+ this.context.viewport
+ )
});
-
- getColorScaleFunction(this);
- getRadiusScaleFunction(this);
-
- onSetColorDomain(colorDomain);
}
- getUpdateTriggers() {
- return {
- getColor: {
- colorRange: this.props.colorRange,
- colorDomain: this.props.colorDomain,
- getColorValue: this.props.getColorValue,
- colorScale: this.props.colorScale,
- lowerPercentile: this.props.lowerPercentile,
- upperPercentile: this.props.upperPercentile
- },
- getRadius: {
- radiusRange: this.props.radiusRange,
- radiusDomain: this.props.radiusDomain,
- getRadiusValue: this.props.getRadiusValue
- }
- };
- }
-
- /*
- * override default layer method to calculate cell color based on color scale function
- */
- _onGetSublayerColor(cell) {
- const {getColorValue} = this.props;
- const {colorScaleFunc, colorDomain} = this.state;
-
- const cv = getColorValue(cell.properties.points);
-
- // if cell value is outside domain, set alpha to 0
- const color =
- cv >= colorDomain[0] && cv <= colorDomain[colorDomain.length - 1]
- ? colorScaleFunc(cv)
- : [0, 0, 0, 0];
-
- // add final alpha to color
- color[3] = Number.isFinite(color[3]) ? color[3] : 255;
-
- return color;
+ getPickingInfo({info}) {
+ return this.state.cpuAggregator.getPickingInfo({info}, this.props);
}
- _onGetSublayerRadius(cell) {
- const {getRadiusValue} = this.props;
- const {radiusScaleFunc} = this.state;
- return radiusScaleFunc(getRadiusValue(cell));
+ _getSublayerUpdateTriggers() {
+ return this.state.cpuAggregator.getUpdateTriggers(this.props);
}
- getPickingInfo({info}) {
- const {clusters} = this.state;
- const isPicked = info.picked && info.index > -1;
-
- let object = null;
- if (isPicked) {
- // add cluster colorValue to object
- const cluster = clusters[info.index];
- const colorValue = this.props.getColorValue(cluster.properties.points);
-
- object = {
- ...cluster.properties,
- colorValue,
- radius: this._onGetSublayerRadius(cluster),
- position: cluster.geometry.coordinates
- };
- }
-
+ _getSubLayerAccessors() {
return {
- ...info,
- picked: Boolean(object),
- // override object with picked cluster property
- object
+ getRadius: this.state.cpuAggregator.getAccessor('radius', this.props),
+ getFillColor: this.state.cpuAggregator.getAccessor('fillColor', this.props)
};
}
renderLayers() {
// for subclassing, override this method to return
// customized sub layer props
- const {id, radiusScale, fp64} = this.props;
+ const {id, radiusScale} = this.props;
+ const {cpuAggregator} = this.state;
// base layer props
const {opacity, pickable, autoHighlight, highlightColor} = this.props;
+ const updateTriggers = this._getSublayerUpdateTriggers();
+ const accessors = this._getSubLayerAccessors();
+
+ const distanceScale = getDistanceScales(this.context.viewport);
+ const metersPerPixel = distanceScale.metersPerPixel[0];
// return props to the sublayer constructor
return new ScatterplotLayer({
id: `${id}-cluster`,
- data: this.state.clusters,
- radiusScale,
- fp64,
+ data: cpuAggregator.state.layerData.data,
+ radiusScale: metersPerPixel * radiusScale,
opacity,
pickable,
autoHighlight,
highlightColor,
- getPosition: d => d.geometry.coordinates,
- getRadius: this._onGetSublayerRadius.bind(this),
- getColor: this._onGetSublayerColor.bind(this),
- updateTriggers: this.getUpdateTriggers()
+ updateTriggers,
+ ...accessors
});
}
}
diff --git a/src/deckgl-layers/column-layer/enhanced-column-layer.js b/src/deckgl-layers/column-layer/enhanced-column-layer.js
index 6c9e0c318..70331f1ec 100644
--- a/src/deckgl-layers/column-layer/enhanced-column-layer.js
+++ b/src/deckgl-layers/column-layer/enhanced-column-layer.js
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import {ColumnLayer} from 'deck.gl';
+import {ColumnLayer} from '@deck.gl/layers';
import {editShader} from 'deckgl-layers/layer-utils/shader-utils';
function addInstanceCoverage(vs) {
@@ -38,8 +38,8 @@ function addInstanceCoverage(vs) {
);
}
-// TODO: export all dekc.gl layers from kepler.gl
-export default class EnhancedColumnLayer extends ColumnLayer {
+// TODO: export all deck.gl layers from kepler.gl
+class EnhancedColumnLayer extends ColumnLayer {
getShaders() {
const shaders = super.getShaders();
@@ -60,3 +60,5 @@ export default class EnhancedColumnLayer extends ColumnLayer {
}
EnhancedColumnLayer.layerName = 'EnhancedColumnLayer';
+
+export default EnhancedColumnLayer;
diff --git a/src/deckgl-layers/grid-layer/enhanced-cpu-grid-layer.js b/src/deckgl-layers/grid-layer/enhanced-cpu-grid-layer.js
index cac3de6c6..77e4767ba 100644
--- a/src/deckgl-layers/grid-layer/enhanced-cpu-grid-layer.js
+++ b/src/deckgl-layers/grid-layer/enhanced-cpu-grid-layer.js
@@ -19,40 +19,41 @@
// THE SOFTWARE.
import {CPUGridLayer} from 'deck.gl';
-import {getColorValueDomain, getColorScaleFunction, getElevationScaleFunction} from '../layer-utils/utils';
-
-const defaultProps = {
- ...CPUGridLayer.defaultProps,
- sizeScale: 'linear',
- colorScale: 'quantile'
+import CPUAggregator, {getAggregatedData} from '../layer-utils/cpu-aggregator';
+
+export const gridAggregation = {
+ key: 'position',
+ updateSteps: [
+ {
+ key: 'aggregate',
+ triggers: {
+ cellSize: {
+ prop: 'cellSize'
+ },
+ position: {
+ prop: 'getPosition',
+ updateTrigger: 'getPosition'
+ },
+ aggregator: {
+ prop: 'gridAggregator'
+ }
+ },
+ updater: getAggregatedData
+ }
+ ]
};
-export default class EnhancedCPUGridLayer extends CPUGridLayer {
- getDimensionUpdaters() {
- const dimensionUpdaters = super.getDimensionUpdaters();
- // add colorScale and sizeScale to dimension updates
- dimensionUpdaters.getFillColor[1].triggers.push('colorScale');
- dimensionUpdaters.getElevation[1].triggers.push('sizeScale');
- return dimensionUpdaters;
- }
-
- /*
- * override default layer method to calculate color domain
- * and scale function base on color scale type
- */
- getColorValueDomain() {
- getColorValueDomain(this);
- }
+export default class ScaleEnhancedGridLayer extends CPUGridLayer {
+ initializeState() {
+ const cpuAggregator = new CPUAggregator({
+ aggregation: gridAggregation
+ });
- getColorScale() {
- getColorScaleFunction(this);
+ this.state = {
+ cpuAggregator,
+ aggregatorState: cpuAggregator.state
+ };
}
-
- getElevationScale() {
- getElevationScaleFunction(this);
- }
-
}
-EnhancedCPUGridLayer.layerName = 'EnhancedGridLayer';
-EnhancedCPUGridLayer.defaultProps = defaultProps;
+ScaleEnhancedGridLayer.layerName = 'ScaleEnhancedGridLayer';
diff --git a/src/deckgl-layers/hexagon-layer/enhanced-hexagon-layer.js b/src/deckgl-layers/hexagon-layer/enhanced-hexagon-layer.js
index 72b2c2072..dc0b2db8d 100644
--- a/src/deckgl-layers/hexagon-layer/enhanced-hexagon-layer.js
+++ b/src/deckgl-layers/hexagon-layer/enhanced-hexagon-layer.js
@@ -18,38 +18,42 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import {HexagonLayer} from 'deck.gl';
-import {pointToHexbin} from './hexagon-aggregator';
+import {HexagonLayer} from '@deck.gl/aggregation-layers';
+import CPUAggregator, {getAggregatedData} from '../layer-utils/cpu-aggregator';
-import {getColorValueDomain, getColorScaleFunction} from '../layer-utils/utils';
-
-const defaultProps = {
- ...HexagonLayer.defaultProps,
- hexagonAggregator: pointToHexbin,
- colorScale: 'quantile'
+export const hexagonAggregation = {
+ key: 'position',
+ updateSteps: [
+ {
+ key: 'aggregate',
+ triggers: {
+ cellSize: {
+ prop: 'radius'
+ },
+ position: {
+ prop: 'getPosition',
+ updateTrigger: 'getPosition'
+ },
+ aggregator: {
+ prop: 'hexagonAggregator'
+ }
+ },
+ updater: getAggregatedData
+ }
+ ]
};
-export default class EnhancedHexagonLayer extends HexagonLayer {
- getDimensionUpdaters() {
- const dimensionUpdaters = super.getDimensionUpdaters();
- // add colorScale to dimension updates
- dimensionUpdaters.getFillColor[1].triggers.push('colorScale');
- dimensionUpdaters.getElevation[1].triggers.push('sizeScale');
- return dimensionUpdaters;
- }
-
- /*
- * override default layer method to calculate color domain
- * and scale function base on color scale type
- */
- getColorValueDomain() {
- getColorValueDomain(this);
- }
+export default class ScaleEnhancedHexagonLayer extends HexagonLayer {
+ initializeState() {
+ const cpuAggregator = new CPUAggregator({
+ aggregation: hexagonAggregation
+ });
- getColorScale() {
- getColorScaleFunction(this);
+ this.state = {
+ cpuAggregator,
+ aggregatorState: cpuAggregator.state
+ };
}
}
-EnhancedHexagonLayer.layerName = 'EnhancedHexagonLayer';
-EnhancedHexagonLayer.defaultProps = defaultProps;
+ScaleEnhancedHexagonLayer.layerName = 'ScaleEnhancedHexagonLayer';
diff --git a/src/deckgl-layers/hexagon-layer/hexagon-aggregator.js b/src/deckgl-layers/hexagon-layer/hexagon-aggregator.js
deleted file mode 100644
index 36f651d56..000000000
--- a/src/deckgl-layers/hexagon-layer/hexagon-aggregator.js
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-import {hexbin} from 'd3-hexbin';
-
-/**
- * Use d3-hexbin to performs hexagonal binning from geo points to hexagons
- * @param {Array} data - array of points
- * @param {Number} radius - hexagon radius in meter
- * @param {function} getPosition - get points lon lat
- * @param {Object} viewport - current viewport object
-
- * @return {Object} - hexagons and countRange
- */
-export function pointToHexbin({data, radius, getPosition}, viewport) {
- // get hexagon radius in mercator world unit
- const radiusInPixel = getRadiusInPixel(radius, viewport);
-
- // add world space coordinates to points
- // filter empty bins
- const screenPoints = data.reduce((accu, pt) => {
- const lat = getPosition(pt)[1];
- const lng = getPosition(pt)[0];
-
- if (!Number.isFinite(lat) || !Number.isFinite(lng)) {
- return accu;
- }
-
- accu.push(
- Object.assign(
- {
- screenCoord: viewport.projectFlat(getPosition(pt))
- },
- pt
- )
- );
-
- return accu;
- }, []);
-
- const newHexbin = hexbin()
- .radius(radiusInPixel)
- .x(d => d.screenCoord[0])
- .y(d => d.screenCoord[1]);
-
- const hexagonBins = newHexbin(screenPoints);
-
- return {
- hexagons: hexagonBins.map((hex, index) => ({
- position: viewport.unprojectFlat([hex.x, hex.y]),
- points: hex,
- index
- }))
- };
-}
-
-/**
- * Get radius in mercator world space coordinates from meter
- * @param {Number} radius - in meter
- * @param {Object} viewport - current viewport object
-
- * @return {Number} radius in mercator world spcae coordinates
- */
-export function getRadiusInPixel(radius, viewport) {
- const {pixelsPerMeter} = viewport.getDistanceScales();
-
- // x, y distance should be the same
- return radius * pixelsPerMeter[0];
-}
diff --git a/src/deckgl-layers/layer-utils/cluster-utils.js b/src/deckgl-layers/layer-utils/cluster-utils.js
index d9320ffbd..620af94ba 100644
--- a/src/deckgl-layers/layer-utils/cluster-utils.js
+++ b/src/deckgl-layers/layer-utils/cluster-utils.js
@@ -21,8 +21,10 @@
import Supercluster from 'supercluster';
import memoize from 'lodash.memoize';
-export function getGeoJSON(data, getPosition) {
- return data
+export function getGeoJSON(data, getPosition, filterData) {
+ const raw = typeof filterData === 'function' ? data.filter(filterData) : data;
+
+ return raw
.map(d => ({
type: 'Point',
properties: {
@@ -40,22 +42,36 @@ export function getGeoJSON(data, getPosition) {
const clusterResolver = ({clusterRadius}) => `${clusterRadius}`;
-const getClusterer = memoize(({clusterRadius, geoJSON}) => {
- return new Supercluster({
+const getClusterer = ({clusterRadius, geoJSON}) =>
+ new Supercluster({
maxZoom: 20,
radius: clusterRadius,
reduce: (accumulated, props) => {
- accumulated.points = [...accumulated.points, ...props.points]
+ accumulated.points = [...accumulated.points, ...props.points];
},
map: props => ({points: [props.data]})
}).load(geoJSON);
-}, clusterResolver);
-export function clustersAtZoom({bbox, clusterRadius, geoJSON, zoom}) {
- const clusterer = getClusterer({clusterRadius, geoJSON});
- return clusterer.getClusters(bbox, zoom);
-}
+export default class ClusterBuilder {
+ constructor() {
+ this.clusterer = memoize(getClusterer, clusterResolver);
+ }
+
+ clustersAtZoom({bbox, clusterRadius, geoJSON, zoom}) {
+ const clusterer = this.clusterer({clusterRadius, geoJSON});
+
+ // map clusters to formatted bins to be passed to deck.gl bin-sorter
+ const clusters = clusterer.getClusters(bbox, zoom)
+ .map((c, i) => ({
+ points: c.properties.points,
+ position: c.geometry.coordinates,
+ index: i
+ }));
+
+ return clusters;
+ }
-export function clearClustererCache() {
- getClusterer.cache.clear();
+ clearClustererCache() {
+ this.clusterer.cache.clear();
+ }
}
diff --git a/src/deckgl-layers/layer-utils/cpu-aggregator.js b/src/deckgl-layers/layer-utils/cpu-aggregator.js
new file mode 100644
index 000000000..a7fa9471f
--- /dev/null
+++ b/src/deckgl-layers/layer-utils/cpu-aggregator.js
@@ -0,0 +1,608 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+/* eslint-disable guard-for-in */
+import {experimental, AGGREGATION_OPERATION} from '@deck.gl/aggregation-layers';
+import {console as Console} from 'global/window';
+
+import {aggregate} from 'utils/aggregate-utils';
+import {AGGREGATION_TYPES, SCALE_FUNC} from 'constants/default-settings';
+
+const {BinSorter} = experimental;
+
+export const DECK_AGGREGATION_MAP = {
+ [AGGREGATION_OPERATION.SUM]: AGGREGATION_TYPES.sum,
+ [AGGREGATION_OPERATION.MEAN]: AGGREGATION_TYPES.average,
+ [AGGREGATION_OPERATION.MIN]: AGGREGATION_TYPES.minimum,
+ [AGGREGATION_OPERATION.MAX]: AGGREGATION_TYPES.maximum
+};
+
+export function getValueFunc(aggregation, accessor) {
+ if (!aggregation || !AGGREGATION_OPERATION[aggregation.toUpperCase()]) {
+ Console.warn(`Aggregation ${aggregation} is not supported`);
+ }
+
+ const op =
+ AGGREGATION_OPERATION[aggregation.toUpperCase()] ||
+ AGGREGATION_OPERATION.SUM;
+ const keplerOp = DECK_AGGREGATION_MAP[op];
+
+ return pts => aggregate(pts.map(accessor), keplerOp);
+}
+
+export function getScaleFunctor(scaleType) {
+ if (!scaleType || !SCALE_FUNC[scaleType]) {
+ Console.warn(`Scale ${scaleType} is not supported`);
+ }
+ return SCALE_FUNC[scaleType] || SCALE_FUNC.quantize;
+}
+
+function nop() {}
+
+export function getGetValue(step, props, dimensionUpdater) {
+ const {key} = dimensionUpdater;
+ const {value, weight, aggregation} = step.triggers;
+
+ let getValue = props[value.prop];
+
+ if (getValue === null) {
+ // If `getValue` is not provided from props, build it with aggregation and weight.
+ getValue = getValueFunc(props[aggregation.prop], props[weight.prop]);
+ }
+
+ if (getValue) {
+ this._setDimensionState(key, {getValue});
+ }
+}
+
+export function getDimensionSortedBins(step, props, dimensionUpdater) {
+ const {key} = dimensionUpdater;
+ const {getValue} = this.state.dimensions[key];
+
+ const sortedBins = new BinSorter(this.state.layerData.data || [], {
+ getValue,
+ filterData: props._filterData
+ });
+ this._setDimensionState(key, {sortedBins});
+}
+
+export function getDimensionValueDomain(step, props, dimensionUpdater) {
+ const {key} = dimensionUpdater;
+ const {
+ triggers: {lowerPercentile, upperPercentile, scaleType}
+ } = step;
+
+ if (!this.state.dimensions[key].sortedBins) {
+ // the previous step should set sortedBins, if not, something went wrong
+ return;
+ }
+
+ // for log and sqrt scale, returns linear domain by default
+ // TODO: support other scale function domain in bin sorter
+ const valueDomain = this.state.dimensions[
+ key
+ ].sortedBins.getValueDomainByScale(props[scaleType.prop], [
+ props[lowerPercentile.prop],
+ props[upperPercentile.prop]
+ ]);
+
+ this._setDimensionState(key, {valueDomain});
+}
+
+export function getDimensionScale(step, props, dimensionUpdater) {
+ const {key} = dimensionUpdater;
+ const {domain, range, scaleType} = step.triggers;
+ const {onSet} = step;
+ if (!this.state.dimensions[key].valueDomain) {
+ // the previous step should set valueDomain, if not, something went wrong
+ return;
+ }
+
+ const dimensionRange = props[range.prop];
+ const dimensionDomain =
+ props[domain.prop] || this.state.dimensions[key].valueDomain;
+
+ const scaleFunctor = getScaleFunctor(scaleType && props[scaleType.prop])();
+
+ const scaleFunc = scaleFunctor.domain(dimensionDomain).range(dimensionRange);
+
+ if (typeof onSet === 'object' && typeof props[onSet.props] === 'function') {
+ props[onSet.props](scaleFunc.domain());
+ }
+ this._setDimensionState(key, {scaleFunc});
+}
+
+function normalizeResult(result = {}) {
+ // support previous hexagonAggregator API
+ if (result.hexagons) {
+ return Object.assign({data: result.hexagons}, result);
+ } else if (result.layerData) {
+ return Object.assign({data: result.layerData}, result);
+ }
+
+ return result;
+}
+
+export function getAggregatedData(step, props, aggregation, viewport) {
+ const {
+ triggers: {aggregator: aggr}
+ } = step;
+ const aggregator = props[aggr.prop];
+
+ // result should contain a data array and other props
+ // result = {data: [], ...other props}
+ const result = aggregator(props, viewport);
+ this.setState({
+ layerData: normalizeResult(result)
+ });
+}
+
+export const defaultAggregation = {
+ key: 'position',
+ updateSteps: [
+ {
+ key: 'aggregate',
+ triggers: {
+ cellSize: {
+ prop: 'cellSize'
+ },
+ position: {
+ prop: 'getPosition',
+ updateTrigger: 'getPosition'
+ },
+ aggregator: {
+ prop: 'gridAggregator'
+ }
+ },
+ updater: getAggregatedData
+ }
+ ]
+};
+
+function getSubLayerAccessor(dimensionState, dimension, layerProps) {
+ return cell => {
+ const {sortedBins, scaleFunc} = dimensionState;
+ const bin = sortedBins.binMap[cell.index];
+
+ if (bin && bin.counts === 0) {
+ // no points left in bin after filtering
+ return dimension.nullValue;
+ }
+
+ const cv = bin && bin.value;
+ const domain = scaleFunc.domain();
+
+ const isValueInDomain = cv >= domain[0] && cv <= domain[domain.length - 1];
+
+ // if cell value is outside domain, set alpha to 0
+ return isValueInDomain ? scaleFunc(cv) : dimension.nullValue;
+ };
+}
+
+export const defaultColorDimension = {
+ key: 'fillColor',
+ accessor: 'getFillColor',
+ getPickingInfo: (dimensionState, cell) => {
+ const {sortedBins} = dimensionState;
+ const colorValue =
+ sortedBins.binMap[cell.index] && sortedBins.binMap[cell.index].value;
+ return {colorValue};
+ },
+ nullValue: [0, 0, 0, 0],
+ updateSteps: [
+ {
+ key: 'getValue',
+ triggers: {
+ value: {
+ prop: 'getColorValue',
+ updateTrigger: 'getColorValue'
+ },
+ weight: {
+ prop: 'getColorWeight',
+ updateTrigger: 'getColorWeight'
+ },
+ aggregation: {
+ prop: 'colorAggregation'
+ }
+ },
+ updater: getGetValue
+ },
+ {
+ key: 'getBins',
+ triggers: {
+ _filterData: {
+ prop: '_filterData',
+ updateTrigger: '_filterData'
+ }
+ },
+ updater: getDimensionSortedBins
+ },
+ {
+ key: 'getDomain',
+ triggers: {
+ lowerPercentile: {
+ prop: 'lowerPercentile'
+ },
+ upperPercentile: {
+ prop: 'upperPercentile'
+ },
+ scaleType: {prop: 'colorScaleType'}
+ },
+ updater: getDimensionValueDomain
+ },
+ {
+ key: 'getScaleFunc',
+ triggers: {
+ domain: {prop: 'colorDomain'},
+ range: {prop: 'colorRange'},
+ scaleType: {prop: 'colorScaleType'}
+ },
+ onSet: {
+ props: 'onSetColorDomain'
+ },
+ updater: getDimensionScale
+ }
+ ],
+ getSubLayerAccessor
+};
+
+export const defaultElevationDimension = {
+ key: 'elevation',
+ accessor: 'getElevation',
+ getPickingInfo: (dimensionState, cell) => {
+ const {sortedBins} = dimensionState;
+ const elevationValue =
+ sortedBins.binMap[cell.index] && sortedBins.binMap[cell.index].value;
+ return {elevationValue};
+ },
+ nullValue: -1,
+ updateSteps: [
+ {
+ key: 'getValue',
+ triggers: {
+ value: {
+ prop: 'getElevationValue',
+ updateTrigger: 'getElevationValue'
+ },
+ weight: {
+ prop: 'getElevationWeight',
+ updateTrigger: 'getElevationWeight'
+ },
+ aggregation: {
+ prop: 'elevationAggregation'
+ }
+ },
+ updater: getGetValue
+ },
+ {
+ key: 'getBins',
+ triggers: {
+ _filterData: {
+ prop: '_filterData',
+ updateTrigger: '_filterData'
+ }
+ },
+ updater: getDimensionSortedBins
+ },
+ {
+ key: 'getDomain',
+ triggers: {
+ lowerPercentile: {
+ prop: 'elevationLowerPercentile'
+ },
+ upperPercentile: {
+ prop: 'elevationUpperPercentile'
+ },
+ scaleType: {prop: 'elevationScaleType'}
+ },
+ updater: getDimensionValueDomain
+ },
+ {
+ key: 'getScaleFunc',
+ triggers: {
+ domain: {prop: 'elevationDomain'},
+ range: {prop: 'elevationRange'},
+ scaleType: {prop: 'elevationScaleType'}
+ },
+ onSet: {
+ props: 'onSetElevationDomain'
+ },
+ updater: getDimensionScale
+ }
+ ],
+ getSubLayerAccessor
+};
+
+export const defaultDimensions = [
+ defaultColorDimension,
+ defaultElevationDimension
+];
+
+export default class CPUAggregator {
+ constructor(opts = {}) {
+ this.state = {
+ layerData: {},
+ dimensions: {
+ // color: {
+ // getValue: null,
+ // domain: null,
+ // sortedBins: null,
+ // scaleFunc: nop
+ // },
+ // elevation: {
+ // getValue: null,
+ // domain: null,
+ // sortedBins: null,
+ // scaleFunc: nop
+ // }
+ },
+ ...opts.initialState
+ };
+ this.dimensionUpdaters = {};
+ this.aggregationUpdater = {};
+
+ this._addDimension(opts.dimensions || defaultDimensions);
+ this._addAggregation(opts.aggregation || defaultAggregation);
+ }
+
+ static defaultDimensions() {
+ return defaultDimensions;
+ }
+
+ updateAllDimensions(props) {
+ let dimensionChanges = [];
+ // update all dimensions
+ for (const dim in this.dimensionUpdaters) {
+ const updaters = this._accumulateUpdaters(
+ 0,
+ props,
+ this.dimensionUpdaters[dim]
+ );
+ dimensionChanges = dimensionChanges.concat(updaters);
+ }
+
+ dimensionChanges.forEach(f => typeof f === 'function' && f());
+ }
+
+ updateAggregation(props, viewport) {
+ const updaters = this._accumulateUpdaters(
+ 0,
+ props,
+ this.aggregationUpdater
+ );
+ updaters.forEach(f => typeof f === 'function' && f(viewport));
+ }
+
+ updateState({oldProps, props, changeFlags}, viewport) {
+ // const reprojectNeeded = this.needsReProjectPoints(oldProps, props, changeFlags);
+ let dimensionChanges = [];
+
+ if (changeFlags.dataChanged) {
+ // if data changed update everything
+ this.updateAggregation(props, viewport);
+ this.updateAllDimensions(props);
+
+ return this.state;
+ }
+
+ const aggregationChanges = this._getAggregationChanges(
+ oldProps,
+ props,
+ changeFlags
+ );
+
+ if (aggregationChanges && aggregationChanges.length) {
+ // get aggregatedData
+ aggregationChanges.forEach(f => typeof f === 'function' && f(viewport));
+ this.updateAllDimensions(props);
+ } else {
+ // only update dimensions
+ dimensionChanges =
+ this._getDimensionChanges(oldProps, props, changeFlags) || [];
+ dimensionChanges.forEach(f => typeof f === 'function' && f());
+ }
+
+ return this.state;
+ }
+
+ // Update private state
+ setState(updateObject) {
+ this.state = Object.assign({}, this.state, updateObject);
+ }
+
+ // Update private state.dimensions
+ _setDimensionState(key, updateObject) {
+ this.setState({
+ dimensions: Object.assign({}, this.state.dimensions, {
+ [key]: Object.assign({}, this.state.dimensions[key], updateObject)
+ })
+ });
+ }
+
+ _addAggregation(aggregation) {
+ this.aggregationUpdater = aggregation;
+ }
+
+ _addDimension(dimensions = []) {
+ dimensions.forEach(dimension => {
+ const {key} = dimension;
+ this.dimensionUpdaters[key] = dimension;
+ });
+ }
+
+ _needUpdateStep(dimensionStep, oldProps, props, changeFlags) {
+ // whether need to update current dimension step
+ // dimension step is the value, domain, scaleFunction of each dimension
+ // each step is an object with properties links to layer prop and whether the prop is
+ // controlled by updateTriggers
+ return Object.values(dimensionStep.triggers).some(item => {
+ if (item.updateTrigger) {
+ // check based on updateTriggers change first
+ return (
+ changeFlags.updateTriggersChanged &&
+ (changeFlags.updateTriggersChanged.all ||
+ changeFlags.updateTriggersChanged[item.updateTrigger])
+ );
+ }
+ // fallback to direct comparison
+ return oldProps[item.prop] !== props[item.prop];
+ });
+ }
+
+ _accumulateUpdaters(step, props, dimension) {
+ const updaters = [];
+ for (let i = step; i < dimension.updateSteps.length; i++) {
+ if (typeof dimension.updateSteps[i].updater === 'function') {
+ updaters.push(
+ dimension.updateSteps[i].updater.bind(
+ this,
+ dimension.updateSteps[i],
+ props,
+ dimension
+ )
+ );
+ }
+ }
+
+ return updaters;
+ }
+
+ _getAllUpdaters(dimension, oldProps, props, changeFlags) {
+ let updaters = [];
+ const needUpdateStep = dimension.updateSteps.findIndex(step =>
+ this._needUpdateStep(step, oldProps, props, changeFlags)
+ );
+
+ if (needUpdateStep > -1) {
+ updaters = updaters.concat(
+ this._accumulateUpdaters(needUpdateStep, props, dimension)
+ );
+ }
+
+ return updaters;
+ }
+
+ _getAggregationChanges(oldProps, props, changeFlags) {
+ const updaters = this._getAllUpdaters(
+ this.aggregationUpdater,
+ oldProps,
+ props,
+ changeFlags
+ );
+ return updaters.length ? updaters : null;
+ }
+
+ _getDimensionChanges(oldProps, props, changeFlags) {
+ let updaters = [];
+
+ // get dimension to be updated
+ for (const key in this.dimensionUpdaters) {
+ // return the first triggered updater for each dimension
+ const dimension = this.dimensionUpdaters[key];
+ const dimensionUpdaters = this._getAllUpdaters(
+ dimension,
+ oldProps,
+ props,
+ changeFlags
+ );
+ updaters = updaters.concat(dimensionUpdaters);
+ }
+
+ return updaters.length ? updaters : null;
+ }
+
+ getUpdateTriggers(props) {
+ const _updateTriggers = props.updateTriggers || {};
+ const updateTriggers = {};
+
+ for (const key in this.dimensionUpdaters) {
+ const {accessor, updateSteps} = this.dimensionUpdaters[key];
+ // fold dimension triggers into each accessor
+ updateTriggers[accessor] = {};
+
+ updateSteps.forEach(step => {
+ Object.values(step.triggers || []).forEach(({prop, updateTrigger}) => {
+ if (updateTrigger) {
+ // if prop is based on updateTrigger e.g. getColorValue, getColorWeight
+ // and updateTriggers is passed in from layer prop
+ // fold the updateTriggers into accessor
+ const fromProp = _updateTriggers[updateTrigger];
+ if (typeof fromProp === 'object' && !Array.isArray(fromProp)) {
+ // if updateTrigger is an object spread it
+ Object.assign(updateTriggers[accessor], fromProp);
+ } else if (fromProp !== undefined) {
+ updateTriggers[accessor][prop] = fromProp;
+ }
+ } else {
+ // if prop is not based on updateTrigger
+ updateTriggers[accessor][prop] = props[prop];
+ }
+ });
+ });
+ }
+
+ return updateTriggers;
+ }
+
+ getPickingInfo({info}, layerProps) {
+ const isPicked = info.picked && info.index > -1;
+ let object = null;
+
+ if (isPicked) {
+ const cell = this.state.layerData.data[info.index];
+
+ let binInfo = {};
+ for (const key in this.dimensionUpdaters) {
+ const {getPickingInfo} = this.dimensionUpdaters[key];
+ if (typeof getPickingInfo === 'function') {
+ binInfo = Object.assign(
+ {},
+ binInfo,
+ getPickingInfo(this.state.dimensions[key], cell, layerProps)
+ );
+ }
+ }
+
+ object = Object.assign(binInfo, cell, {
+ points: cell.filteredPoints || cell.points
+ });
+ }
+
+ // add bin and to info
+ return Object.assign(info, {
+ picked: Boolean(object),
+ // override object with picked cell
+ object
+ });
+ }
+
+ getAccessor(dimensionKey, layerProps) {
+ if (!this.dimensionUpdaters.hasOwnProperty(dimensionKey)) {
+ return nop;
+ }
+ return this.dimensionUpdaters[dimensionKey].getSubLayerAccessor(
+ this.state.dimensions[dimensionKey],
+ this.dimensionUpdaters[dimensionKey],
+ layerProps
+ );
+ }
+}
+
+CPUAggregator.getDimensionScale = getDimensionScale;
diff --git a/src/deckgl-layers/layer-utils/utils.js b/src/deckgl-layers/layer-utils/utils.js
deleted file mode 100644
index 9b1b11202..000000000
--- a/src/deckgl-layers/layer-utils/utils.js
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-import {unique} from 'utils/data-utils';
-
-import {SCALE_TYPES, SCALE_FUNC} from 'constants/default-settings';
-
-// Enable render color by customized color Scale
-export function getBinColorDomain(scaleType, bins, [lowerIdx, upperIdx]) {
- switch (scaleType) {
- case SCALE_TYPES.quantize:
- return [bins[lowerIdx].value, bins[upperIdx].value];
-
- case SCALE_TYPES.quantile:
- return bins.slice(lowerIdx, upperIdx + 1).map(d => d.value);
- case SCALE_TYPES.ordinal:
- return unique(bins.map(b => b.value)).sort();
- default:
- return [bins[lowerIdx].value, bins[upperIdx].value];
- }
-}
-
-export function getScaleFunctor(scaleType) {
- return SCALE_FUNC[scaleType] || SCALE_FUNC.quantile;
-}
-
-export function getColorValueDomain(layer) {
- const {lowerPercentile, upperPercentile, colorScale} = layer.props;
- const {sortedBins} = layer.state.sortedColorBins;
- const len = sortedBins.length;
-
- if (!len) {
- // err... what do we do
- layer.state.colorValueDomain = null;
- } else {
- const lowerIdx = Math.ceil(lowerPercentile / 100 * (len - 1));
- const upperIdx = Math.floor(upperPercentile / 100 * (len - 1));
-
- // calculate valueDomain based on
- layer.state.colorValueDomain = getBinColorDomain(colorScale, sortedBins, [
- lowerIdx,
- upperIdx
- ]);
- layer.getColorScale();
- }
-
- layer.props.onSetColorDomain(layer.state.colorValueDomain);
-}
-
-export function getColorScaleFunction(layer) {
- const {colorScale, colorDomain} = layer.props;
- layer.state.colorScaleFunc = getScaleFunctor(colorScale)()
- .domain(
- colorDomain || layer.state.colorDomain || layer.state.colorValueDomain
- )
- .range(layer.props.colorRange);
-}
-
-export function getElevationScaleFunction(layer) {
- const elevationRange = layer.props.elevationRange;
- const elevationDomain = layer.props.elevationDomain || layer.state.elevationValueDomain;
-
- layer.state.elevationScaleFunc = getScaleFunctor(layer.props.sizeScale)()
- .domain(elevationDomain)
- .range(elevationRange);
-}
-
-export function getRadiusScaleFunction(layer) {
- const {viewport} = layer.context;
- layer.state.radiusScaleFunc = SCALE_FUNC.sqrt()
- .domain(layer.state.radiusDomain)
- .range(
- layer.props.radiusRange.map(
- d => d * viewport.distanceScales.metersPerPixel[0]
- )
- );
-}
-
-export function needsRecalculateColorDomain(oldProps, props) {
- return (
- oldProps.lowerPercentile !== props.lowerPercentile ||
- oldProps.upperPercentile !== props.upperPercentile ||
- oldProps.colorScale !== props.colorScale
- );
-}
-
-export function needReCalculateScaleFunction(oldProps, props) {
- return oldProps.colorRange !== props.colorRange;
-}
-
-export function needsRecalculateRadiusRange(oldProps, props) {
- return (
- oldProps.radiusRange !== props.radiusRange &&
- (oldProps.radiusRange[0] !== props.radiusRange[0] ||
- oldProps.radiusRange[1] !== props.radiusRange[1])
- );
-}
diff --git a/src/deckgl-layers/line-layer/line-layer.js b/src/deckgl-layers/line-layer/line-layer.js
index 95689af07..1d170a84c 100644
--- a/src/deckgl-layers/line-layer/line-layer.js
+++ b/src/deckgl-layers/line-layer/line-layer.js
@@ -24,21 +24,10 @@ import {editShader} from 'deckgl-layers/layer-utils/shader-utils';
const defaultProps = {
...LineLayer.defaultProps,
- // show arc if source is in brush
- brushSource: true,
- // show arc if target is in brush
- brushTarget: true,
- enableBrushing: true,
- getWidth: d => d.strokeWidth,
- getTargetColor: x => x.color || [0, 0, 0, 255],
- strokeScale: 1,
-
- // brush radius in meters
- brushRadius: 100000,
- mousePosition: [0, 0]
+ getTargetColor: x => x.color || [0, 0, 0, 255]
};
-function addBrushingVsShader(vs) {
+function addInstanceColorShader(vs) {
const targetColorVs = editShader(
vs,
'line target color vs',
@@ -46,33 +35,22 @@ function addBrushingVsShader(vs) {
'attribute vec4 instanceColors; attribute vec4 instanceTargetColors;'
);
- const brushingVs = editShader(
- targetColorVs,
- 'line brushing vs',
- 'vec2 offset = getExtrusionOffset(target.xy - source.xy, positions.y, widthPixels);',
- 'vec2 offset = brushing_getExtrusionOffset(target.xy - source.xy, positions.y, project_uViewportSize, vec4(instanceSourcePositions.xy, instanceTargetPositions.xy), instanceWidths);'
- );
-
return editShader(
- brushingVs,
+ targetColorVs,
'line color vs',
- 'vColor = vec4(instanceColors.rgb, instanceColors.a * opacity) / 255.;',
- `vec4 color = mix(instanceColors, instanceTargetColors, positions.x) / 255.;` +
+ 'vColor = vec4(instanceColors.rgb, instanceColors.a * opacity);',
+ `vec4 color = mix(instanceColors, instanceTargetColors, positions.x);` +
`vColor = vec4(color.rgb, color.a * opacity);`
)
}
-export default class LineBrushingLayer extends LineLayer {
+export default class EnhancedLineLayer extends LineLayer {
getShaders() {
const shaders = super.getShaders();
- // const addons = getExtrusion + isPicked + isPtInRange;
return {
- // ...shaders,
- vs: addBrushingVsShader(shaders.vs),
- fs: shaders.fs,
- // vs: this.props.fp64 ? addons + vs64 : addons + vs,
- modules: shaders.modules.concat(['brushing'])
+ ...shaders,
+ vs: addInstanceColorShader(shaders.vs)
};
}
@@ -81,53 +59,16 @@ export default class LineBrushingLayer extends LineLayer {
const {attributeManager} = this.state;
attributeManager.addInstanced({
instanceTargetColors: {
- size: 4,
+ size: this.props.colorFormat.length,
type: GL.UNSIGNED_BYTE,
+ normalized: true,
+ transition: true,
accessor: 'getTargetColor',
- update: this.calculateInstanceTargetColors
- }
- });
- }
-
- draw({uniforms}) {
- const {
- brushSource,
- brushTarget,
- brushRadius,
- enableBrushing,
- mousePosition,
- strokeScale
- } = this.props;
-
- super.draw({
- uniforms: {
- ...uniforms,
- brushing_uBrushSource: brushSource ? 1 : 0,
- brushing_uBrushTarget: brushTarget ? 1 : 0,
- brushing_uBrushRadius: brushRadius,
- brushing_uEnableBrushing: enableBrushing ? 1 : 0,
- brushing_uStrokeScale: strokeScale,
- brushing_uMousePosition: mousePosition
- ? new Float32Array(this.unproject(mousePosition))
- : defaultProps.mousePosition
+ defaultValue: [0, 0, 0, 255]
}
});
}
-
- calculateInstanceTargetColors(attribute) {
- const {data, getTargetColor} = this.props;
- const {value, size} = attribute;
- let i = 0;
- for (const object of data) {
- const color = getTargetColor(object);
- value[i + 0] = color[0];
- value[i + 1] = color[1];
- value[i + 2] = color[2];
- value[i + 3] = isNaN(color[3]) ? 255 : color[3];
- i += size;
- }
- }
}
-LineBrushingLayer.layerName = 'LineBrushingLayer';
-LineBrushingLayer.defaultProps = defaultProps;
+EnhancedLineLayer.layerName = 'EnhancedLineLayer';
+EnhancedLineLayer.defaultProps = defaultProps;
diff --git a/src/deckgl-layers/scatterplot-brushing-layer/scatterplot-brushing-layer.js b/src/deckgl-layers/scatterplot-brushing-layer/scatterplot-brushing-layer.js
deleted file mode 100644
index a67d22527..000000000
--- a/src/deckgl-layers/scatterplot-brushing-layer/scatterplot-brushing-layer.js
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-import {ScatterplotLayer} from 'deck.gl';
-import {editShader} from 'deckgl-layers/layer-utils/shader-utils';
-
-function addBrushingVsShader(vs) {
- return editShader(
- vs,
- 'scatterplot brushing vs',
- 'outerRadiusPixels += stroked * lineWidthPixels / 2.0;',
- 'outerRadiusPixels = brushing_getRadius(instancePositions, outerRadiusPixels + stroked * lineWidthPixels / 2.0);'
- );
-}
-
-const defaultProps = {
- ...ScatterplotLayer.defaultProps,
- enableBrushing: true,
- // brush radius in meters
- brushRadius: 100000,
- mousePosition: [0, 0],
- outsideBrushRadius: 0
-};
-
-export default class ScatterplotBrushingLayer extends ScatterplotLayer {
-
- getShaders() {
- const shaders = super.getShaders();
- return {
- vs: addBrushingVsShader(shaders.vs),
- fs: shaders.fs,
- modules: shaders.modules.concat(['brushing'])
- };
- }
- draw(opts) {
- const {uniforms} = opts;
- const {
- brushRadius,
- enableBrushing,
- mousePosition,
- outsideBrushRadius
- } = this.props;
-
- // add uniforms
- super.draw({
- ...opts,
- uniforms: {
- ...uniforms,
- brushing_uBrushRadius: brushRadius,
- brushing_uOutsideBrushRadius: outsideBrushRadius,
- brushing_uMousePosition: mousePosition
- ? new Float32Array(this.unproject(mousePosition))
- : defaultProps.mousePosition,
- brushing_uEnableBrushing: enableBrushing ? 1 : 0
- }
- });
- }
-}
-
-ScatterplotBrushingLayer.layerName = 'ScatterplotBrushingLayer';
-ScatterplotBrushingLayer.defaultProps = defaultProps;
diff --git a/src/deckgl-layers/svg-icon-layer/scatterplot-icon-layer.js b/src/deckgl-layers/svg-icon-layer/scatterplot-icon-layer.js
index 462151c6c..57d22f000 100644
--- a/src/deckgl-layers/svg-icon-layer/scatterplot-icon-layer.js
+++ b/src/deckgl-layers/svg-icon-layer/scatterplot-icon-layer.js
@@ -18,15 +18,16 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import {ScatterplotLayer} from 'deck.gl';
+import {ScatterplotLayer} from '@deck.gl/layers';
import {Geometry, Model} from 'luma.gl';
import GL from '@luma.gl/constants';
+const DEFAULT_POS = [-1, -1, 0, -1, 1, 0, 1, 1, 0, 1, -1, 0];
export default class ScatterplotIconLayer extends ScatterplotLayer {
_getModel(gl) {
// use default scatterplot shaders
const shaders = this.getShaders();
- const defaultPos = [-1, -1, 0, -1, 1, 0, 1, 1, 0, 1, -1, 0];
+
const {iconGeometry} = this.props;
const geometry = iconGeometry
@@ -39,7 +40,7 @@ export default class ScatterplotIconLayer extends ScatterplotLayer {
: new Geometry({
drawMode: GL.TRIANGLE_FAN,
attributes: {
- positions: new Float32Array(defaultPos)
+ positions: new Float32Array(DEFAULT_POS)
}
});
diff --git a/src/deckgl-layers/svg-icon-layer/svg-icon-layer.js b/src/deckgl-layers/svg-icon-layer/svg-icon-layer.js
index 250a374c7..3eb81084b 100644
--- a/src/deckgl-layers/svg-icon-layer/svg-icon-layer.js
+++ b/src/deckgl-layers/svg-icon-layer/svg-icon-layer.js
@@ -42,6 +42,7 @@ const DEFAULT_ICON_GEOMETRY = [
1,
0
];
+
const defaultProps = {
getIconGeometry: iconId => DEFAULT_ICON_GEOMETRY,
getIcon: d => d.icon
@@ -64,23 +65,16 @@ export default class SvgIconLayer extends CompositeLayer {
_extractSublayers() {
const {data, getIconGeometry, getIcon} = this.props;
- const iconLayers = data.reduce((accu, d) => {
- const iconId = getIcon(d);
-
- if (iconId in accu) {
- accu[iconId].data.push(d);
- } else {
- const geometry = getIconGeometry(iconId) || DEFAULT_ICON_GEOMETRY;
- accu[iconId] = {
- id: iconId,
- geometry,
- data: [d]
- };
+ const iconLayers = {};
+ for (let i = 0; i < data.length; i++) {
+ const iconId = getIcon(data[i]);
+ iconLayers[iconId] = iconLayers[iconId] || {
+ id: iconId,
+ geometry: getIconGeometry(iconId) || DEFAULT_ICON_GEOMETRY,
+ data: []
}
-
- return accu;
- }, {});
-
+ iconLayers[iconId].data.push(data[i]);
+ }
this.setState({
data: Object.values(iconLayers)
});
diff --git a/src/layers/aggregation-layer.js b/src/layers/aggregation-layer.js
index 231cea159..5bc8ca42f 100644
--- a/src/layers/aggregation-layer.js
+++ b/src/layers/aggregation-layer.js
@@ -22,20 +22,41 @@ import memoize from 'lodash.memoize';
import Layer from './base-layer';
import {hexToRgb} from 'utils/color-utils';
import {aggregate} from 'utils/aggregate-utils';
-import {CHANNEL_SCALES, FIELD_OPTS, DEFAULT_AGGREGATION} from 'constants/default-settings';
+import {HIGHLIGH_COLOR_3D} from 'constants/default-settings';
+
+import {
+ CHANNEL_SCALES,
+ FIELD_OPTS,
+ DEFAULT_AGGREGATION
+} from 'constants/default-settings';
export const pointPosAccessor = ({lat, lng}) => d => [
- d[lng.fieldIdx],
- d[lat.fieldIdx]
+ d.data[lng.fieldIdx],
+ d.data[lat.fieldIdx]
];
export const pointPosResolver = ({lat, lng}) =>
`${lat.fieldIdx}-${lng.fieldIdx}`;
-export const getValueAggr = (field, aggregation) => points =>
- aggregate(points.map(p => p[field.tableFieldIndex - 1]), aggregation);
+export const getValueAggrFunc = (
+ field,
+ aggregation
+) => {
+ return points => {
+
+ return field
+ ? aggregate(
+ points.map(p => p.data[field.tableFieldIndex - 1]),
+ aggregation
+ )
+ : points.length;
+ };
+};
-const aggrResolver = (field, aggregation) => `${field.name}-${aggregation}`;
+export const getFilterDataFunc = (filterRange, getFilterValue) => pt =>
+ getFilterValue(pt).every(
+ (val, i) => val >= filterRange[i][0] && val <= filterRange[i][1]
+ );
const getLayerColorRange = colorRange => colorRange.colors.map(hexToRgb);
@@ -45,10 +66,8 @@ export default class AggregationLayer extends Layer {
constructor(props) {
super(props);
- this.getPosition = memoize(pointPosAccessor, pointPosResolver);
- this.getColorValue = memoize(getValueAggr, aggrResolver);
+ this.getPositionAccessor = () => pointPosAccessor(this.config.columns);
this.getColorRange = memoize(getLayerColorRange);
- this.getElevationValue = memoize(getValueAggr, aggrResolver);
}
get isAggregated() {
@@ -68,7 +87,6 @@ export default class AggregationLayer extends Layer {
...super.noneLayerDataAffectingProps,
'enable3d',
'colorRange',
- 'colorScale',
'colorDomain',
'sizeRange',
'sizeScale',
@@ -115,13 +133,15 @@ export default class AggregationLayer extends Layer {
*/
getVisualChannelDescription(key) {
// e.g. label: Color, measure: Average of ETA
- const {range, field, defaultMeasure, aggregation} = this.visualChannels[key];
+ const {range, field, defaultMeasure, aggregation} = this.visualChannels[
+ key
+ ];
return {
label: this.visConfigSettings[range].label,
measure: this.config[field]
? `${this.config.visConfig[aggregation]} of ${this.config[field].name}`
: defaultMeasure
- }
+ };
}
getHoverData(object) {
@@ -141,7 +161,6 @@ export default class AggregationLayer extends Layer {
* @param channel
*/
validateVisualChannel(channel) {
-
// field type decides aggregation type decides scale type
this.validateFieldType(channel);
this.validateAggregationType(channel);
@@ -163,8 +182,9 @@ export default class AggregationLayer extends Layer {
if (!aggregationOptions.length) {
// if field cannot be aggregated, set field to null
this.updateLayerConfig({[field]: null});
-
- } else if (!aggregationOptions.includes(this.config.visConfig[aggregation])) {
+ } else if (
+ !aggregationOptions.includes(this.config.visConfig[aggregation])
+ ) {
// current aggregation type is not supported by this field
// set aggregation to the first supported option
this.updateLayerVisConfig({[aggregation]: aggregationOptions[0]});
@@ -176,8 +196,10 @@ export default class AggregationLayer extends Layer {
const {field, channelScaleType} = visualChannel;
return Object.keys(
- this.config[field] ? FIELD_OPTS[this.config[field].type].scale[channelScaleType] :
- DEFAULT_AGGREGATION[channelScaleType])
+ this.config[field]
+ ? FIELD_OPTS[this.config[field].type].scale[channelScaleType]
+ : DEFAULT_AGGREGATION[channelScaleType]
+ );
}
/**
@@ -189,65 +211,134 @@ export default class AggregationLayer extends Layer {
const visualChannel = this.visualChannels[channel];
const {field, aggregation, channelScaleType} = visualChannel;
const aggregationType = this.config.visConfig[aggregation];
- return this.config[field] ?
- // scale options based on aggregation
- FIELD_OPTS[this.config[field].type].scale[channelScaleType][aggregationType] :
- // default scale options for point count
- DEFAULT_AGGREGATION[channelScaleType][aggregationType];
+ return this.config[field]
+ ? // scale options based on aggregation
+ FIELD_OPTS[this.config[field].type].scale[channelScaleType][
+ aggregationType
+ ]
+ : // default scale options for point count
+ DEFAULT_AGGREGATION[channelScaleType][aggregationType];
}
/**
* Aggregation layer handles visual channel aggregation inside deck.gl layer
*/
- updateLayerDomain(dataset, newFilter) {
+ updateLayerDomain(datasets, newFilter) {
return this;
}
updateLayerMeta(allData, getPosition) {
// get bounds from points
- const bounds = this.getPointsBounds(allData, getPosition);
+ const bounds = this.getPointsBounds(allData, d => getPosition({data: d}));
this.updateMeta({bounds});
}
- formatLayerData(_, allData, filteredIndex, oldLayerData, opt = {}) {
- const getPosition = this.getPosition(this.config.columns);
+ calculateDataAttribute({allData, filteredIndex}, getPosition) {
+ const data = [];
+
+ for (let i = 0; i < filteredIndex.length; i++) {
+ const index = filteredIndex[i];
+ const pos = getPosition({data: allData[index]});
- if (!oldLayerData || oldLayerData.getPosition !== getPosition) {
- this.updateLayerMeta(allData, getPosition);
+ // if doesn't have point lat or lng, do not add the point
+ // deck.gl can't handle position = null
+ if (pos.every(Number.isFinite)) {
+ data.push({
+ index,
+ data: allData[index]
+ });
+ }
}
- const getColorValue = this.config.colorField
- ? this.getColorValue(
- this.config.colorField,
- this.config.visConfig.colorAggregation
- )
- : undefined;
+ return data;
+ }
- const getElevationValue = this.config.sizeField
- ? this.getElevationValue(
- this.config.sizeField,
- this.config.visConfig.sizeAggregation
- )
+ formatLayerData(datasets, oldLayerData) {
+ const getPosition = this.getPositionAccessor(); // if (
+ const {gpuFilter} = datasets[this.config.dataId];
+
+ const getColorValue = getValueAggrFunc(
+ this.config.colorField,
+ this.config.visConfig.colorAggregation
+ );
+
+ const getElevationValue = getValueAggrFunc(
+ this.config.sizeField,
+ this.config.visConfig.sizeAggregation
+ );
+ const hasFilter = Object.values(gpuFilter.filterRange).some(arr =>
+ arr.some(v => v !== 0)
+ );
+ const getFilterValue = gpuFilter.filterValueAccessor();
+ const filterData = hasFilter
+ ? getFilterDataFunc(gpuFilter.filterRange, getFilterValue)
: undefined;
- let data;
- if (
- oldLayerData &&
- oldLayerData.data &&
- opt.sameData &&
- oldLayerData.getPosition === getPosition
- ) {
- data = oldLayerData.data;
- } else {
- data = filteredIndex.map(i => allData[i]);
- }
+ const {data} = this.updateData(datasets, oldLayerData);
return {
data,
getPosition,
+ _filterData: filterData,
...(getColorValue ? {getColorValue} : {}),
...(getElevationValue ? {getElevationValue} : {})
};
}
+
+ getDefaultDeckLayerProps(opts) {
+ const baseProp = super.getDefaultDeckLayerProps(opts);
+ return {
+ ...baseProp,
+ highlightColor: HIGHLIGH_COLOR_3D,
+ // gpu data filtering is not supported in aggregation layer
+ extensions: [],
+ autoHighlight: this.config.visConfig.enable3d
+ };
+ }
+
+ getDefaultAggregationLayerProp(opts) {
+ const {gpuFilter, mapState, layerCallbacks} = opts;
+ const {visConfig} = this.config;
+ const eleZoomFactor = this.getElevationZoomFactor(mapState);
+ const updateTriggers = {
+ getColorValue: {
+ colorField: this.config.colorField,
+ colorAggregation: this.config.visConfig.colorAggregation
+ },
+ getElevationValue: {
+ sizeField: this.config.sizeField,
+ sizeAggregation: this.config.visConfig.sizeAggregation
+ },
+ _filterData: {
+ filterRange: gpuFilter.filterRange,
+ ...gpuFilter.filterValueUpdateTriggers
+ }
+ };
+
+ return {
+ ...this.getDefaultDeckLayerProps(opts),
+ coverage: visConfig.coverage,
+
+ // color
+ colorRange: this.getColorRange(visConfig.colorRange),
+ colorScaleType: this.config.colorScale,
+ upperPercentile: visConfig.percentile[1],
+ lowerPercentile: visConfig.percentile[0],
+
+ // elevation
+ extruded: visConfig.enable3d,
+ elevationScale: visConfig.elevationScale * eleZoomFactor,
+ elevationScaleType: this.config.sizeScale,
+ elevationRange: visConfig.sizeRange,
+ elevationLowerPercentile: visConfig.elevationPercentile[0],
+ elevationUpperPercentile: visConfig.elevationPercentile[1],
+
+ // updateTriggers
+ updateTriggers,
+
+ // callbacks
+ onSetColorDomain: layerCallbacks.onSetLayerDomain
+ };
+ }
}
diff --git a/src/layers/arc-layer/arc-layer.js b/src/layers/arc-layer/arc-layer.js
index 3a3921e05..efcd0c02e 100644
--- a/src/layers/arc-layer/arc-layer.js
+++ b/src/layers/arc-layer/arc-layer.js
@@ -18,10 +18,10 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import memoize from 'lodash.memoize';
-
import Layer from '../base-layer';
-import ArcBrushingLayer from 'deckgl-layers/arc-brushing-layer/arc-brushing-layer';
+import {BrushingExtension} from '@deck.gl/extensions';
+import {ArcLayer as DeckArcLayer} from '@deck.gl/layers';
+
import {hexToRgb} from 'utils/color-utils';
import ArcLayerIcon from './arc-layer-icon';
import {DEFAULT_LAYER_COLOR} from 'constants/default-settings';
@@ -35,10 +35,13 @@ export const arcPosAccessor = ({lat0, lng0, lat1, lng1}) => d => [
0
];
-export const arcPosResolver = ({lat0, lng0, lat1, lng1}) =>
- `${lat0.fieldIdx}-${lng0.fieldIdx}-${lat1.fieldIdx}-${lat1.fieldIdx}}`;
-
export const arcRequiredColumns = ['lat0', 'lng0', 'lat1', 'lng1'];
+export const arcColumnLabels = {
+ lat0: 'source lat',
+ lng0: 'source lng',
+ lat1: 'target lat',
+ lng1: 'target lng'
+};
export const arcVisConfigs = {
opacity: 'opacity',
@@ -51,8 +54,9 @@ export const arcVisConfigs = {
export default class ArcLayer extends Layer {
constructor(props) {
super(props);
+
this.registerVisConfig(arcVisConfigs);
- this.getPosition = memoize(arcPosAccessor, arcPosResolver);
+ this.getPositionAccessor = () => arcPosAccessor(this.config.columns);
}
get type() {
@@ -71,6 +75,9 @@ export default class ArcLayer extends Layer {
return arcRequiredColumns;
}
+ get columnLabels() {
+ return arcColumnLabels;
+ }
get columnPairs() {
return this.defaultLinkColumnPairs;
}
@@ -106,12 +113,31 @@ export default class ArcLayer extends Layer {
return {props: [props]};
}
- getPositionAccessor() {
- return this.getPosition(this.config.columns);
+ calculateDataAttribute({allData, filteredIndex}, getPosition) {
+ const data = [];
+ for (let i = 0; i < filteredIndex.length; i++) {
+ // data = filteredIndex.reduce((accu, index) => {
+ const index = filteredIndex[i];
+ const pos = getPosition({data: allData[index]});
+
+ // if doesn't have point lat or lng, do not add the point
+ // deck.gl can't handle position = null
+ if (pos.every(Number.isFinite)) {
+ data.push({
+ index,
+ sourcePosition: [pos[0], pos[1], pos[2]],
+ targetPosition: [pos[3], pos[4], pos[5]],
+ data: allData[index]
+ });
+ }
+ }
+
+ return data;
}
+
// TODO: fix complexity
/* eslint-disable complexity */
- formatLayerData(_, allData, filteredIndex, oldLayerData, opt = {}) {
+ formatLayerData(datasets, oldLayerData, opt = {}) {
const {
colorScale,
colorDomain,
@@ -123,6 +149,9 @@ export default class ArcLayer extends Layer {
visConfig: {sizeRange, colorRange, targetColor}
} = this.config;
+ const {gpuFilter} = datasets[this.config.dataId];
+ const {data} = this.updateData(datasets, oldLayerData);
+
// arc color
const cScale =
colorField &&
@@ -136,46 +165,10 @@ export default class ArcLayer extends Layer {
const sScale =
sizeField && this.getVisChannelScale(sizeScale, sizeDomain, sizeRange);
- const getPosition = this.getPositionAccessor();
-
- if (!oldLayerData || oldLayerData.getPosition !== getPosition) {
- this.updateLayerMeta(allData, getPosition);
- }
+ const getStrokeWidth = sScale ? d =>
+ this.getEncodedChannelValue(sScale, d.data, sizeField, 0) : 1;
- let data;
- if (
- oldLayerData &&
- oldLayerData.data &&
- opt.sameData &&
- oldLayerData.getPosition === getPosition
- ) {
- data = oldLayerData.data;
- } else {
- data = filteredIndex.reduce((accu, index) => {
- const pos = getPosition({data: allData[index]});
-
- // if doesn't have point lat or lng, do not add the arc
- // deck.gl can't handle position == null
- if (!pos.every(Number.isFinite)) {
- return accu;
- }
-
- accu.push({
- index,
- sourcePosition: [pos[0], pos[1], pos[2]],
- targetPosition: [pos[3], pos[4], pos[5]],
- data: allData[index]
- });
-
- return accu;
- }, []);
- }
-
- const getStrokeWidth = sScale
- ? d => this.getEncodedChannelValue(sScale, d.data, sizeField, 0)
- : 1;
-
- const getColor = cScale
+ const getSourceColor = cScale
? d => this.getEncodedChannelValue(cScale, d.data, colorField)
: color;
@@ -185,10 +178,10 @@ export default class ArcLayer extends Layer {
return {
data,
- getColor,
- getSourceColor: getColor,
+ getSourceColor,
getTargetColor,
- getWidth: getStrokeWidth
+ getWidth: getStrokeWidth,
+ getFilterValue: gpuFilter.filterValueAccessor()
};
}
/* eslint-enable complexity */
@@ -201,7 +194,6 @@ export default class ArcLayer extends Layer {
const pos = getPosition({data: d});
return [pos[0], pos[1]];
});
-
const tBounds = this.getPointsBounds(allData, d => {
const pos = getPosition({data: d});
return [pos[3], pos[4]];
@@ -220,15 +212,13 @@ export default class ArcLayer extends Layer {
this.updateMeta({bounds});
}
- renderLayer({
- data,
- idx,
- objectHovered,
- layerInteraction,
- mapState,
- interactionConfig
- }) {
- const {brush} = interactionConfig;
+ renderLayer(opts) {
+ const {
+ data,
+ gpuFilter,
+ objectHovered,
+ interactionConfig
+ } = opts;
const colorUpdateTriggers = {
color: this.config.color,
@@ -238,53 +228,35 @@ export default class ArcLayer extends Layer {
targetColor: this.config.visConfig.targetColor
};
- const interaction = {
- // auto highlighting
- pickable: true,
- autoHighlight: !brush.enabled,
- highlightColor: this.config.highlightColor,
-
- // brushing
- brushRadius: brush.config.size * 1000,
- brushSource: true,
- brushTarget: true,
- enableBrushing: brush.enabled
- };
+ const defaultLayerProps = this.getDefaultDeckLayerProps(opts);
return [
- new ArcBrushingLayer({
+ new DeckArcLayer({
+ ...defaultLayerProps,
+ ...this.getBrushingExtensionProps(interactionConfig, 'source_target'),
...data,
- ...interaction,
- ...layerInteraction,
- id: this.id,
- idx,
- opacity: this.config.visConfig.opacity,
- pickedColor: this.config.highlightColor,
- strokeScale: this.config.visConfig.thickness,
-
- // parameters
- parameters: {depthTest: mapState.dragRotate},
-
+ widthScale: this.config.visConfig.thickness,
updateTriggers: {
+ getFilterValue: gpuFilter.filterValueUpdateTriggers,
getWidth: {
sizeField: this.config.sizeField,
sizeRange: this.config.visConfig.sizeRange
},
getSourceColor: colorUpdateTriggers,
getTargetColor: colorUpdateTriggers
- }
+ },
+ extensions: [...defaultLayerProps.extensions, new BrushingExtension()]
}),
// hover layer
...(this.isLayerHovered(objectHovered)
? [
- new ArcBrushingLayer({
- id: `${this.id}-hovered`,
+ new DeckArcLayer({
+ ...this.getDefaultHoverLayerProps(),
data: [objectHovered.object],
- strokeScale: this.config.visConfig.thickness,
+ widthScale: this.config.visConfig.thickness,
getSourceColor: this.config.highlightColor,
getTargetColor: this.config.highlightColor,
- getWidth: data.getWidth,
- pickable: false
+ getWidth: data.getWidth
})
]
: [])
diff --git a/src/layers/base-layer.js b/src/layers/base-layer.js
index 658551a56..17a7ee4c1 100644
--- a/src/layers/base-layer.js
+++ b/src/layers/base-layer.js
@@ -20,7 +20,11 @@
import {console as Console} from 'global/window';
import keymirror from 'keymirror';
+import {DataFilterExtension} from '@deck.gl/extensions';
+import {COORDINATE_SYSTEM} from '@deck.gl/core';
+
import DefaultLayerIcon from './default-layer-icon';
+import {diffUpdateTriggers} from './layer-update';
import {
ALL_FIELD_TYPES,
@@ -29,7 +33,8 @@ import {
CHANNEL_SCALES,
FIELD_OPTS,
SCALE_FUNC,
- CHANNEL_SCALE_SUPPORTED_FIELDS
+ CHANNEL_SCALE_SUPPORTED_FIELDS,
+ MAX_GPU_FILTERS
} from 'constants/default-settings';
import {COLOR_RANGES} from 'constants/color-ranges';
import {DataVizColors} from 'constants/custom-color-ranges';
@@ -66,6 +71,7 @@ import {
* @type {number}
*/
const MAX_SAMPLE_SIZE = 5000;
+const dataFilterExtension = new DataFilterExtension({filterSize: MAX_GPU_FILTERS});
export const OVERLAY_TYPE = keymirror({
deckgl: null,
@@ -403,7 +409,7 @@ export default class Layer {
return Math.pow(2, Math.max(8 - zoom + zoomOffset, 0));
}
- formatLayerData(data, allData, filteredIndex) {
+ formatLayerData(datasets, filteredIndex) {
return {};
}
@@ -765,6 +771,13 @@ export default class Layer {
return [lngBounds[0], latBounds[0], lngBounds[1], latBounds[1]];
}
+ getChangedTriggers(dataUpdateTriggers) {
+ const triggerChanged = diffUpdateTriggers(dataUpdateTriggers, this._oldDataUpdateTriggers);
+ this._oldDataUpdateTriggers = dataUpdateTriggers;
+
+ return triggerChanged;
+ }
+
getEncodedChannelValue(
scale,
data,
@@ -799,6 +812,37 @@ export default class Layer {
this.meta = {...this.meta, ...meta};
}
+ getDataUpdateTriggers({filteredIndex, id}) {
+ const {columns} = this.config;
+
+ return {
+ getData: {datasetId: id, columns, filteredIndex},
+ getMeta: {datasetId: id, columns}
+ }
+ }
+
+ updateData(datasets, oldLayerData) {
+ const layerDataset = datasets[this.config.dataId];
+ const {allData} = datasets[this.config.dataId];
+
+ const getPosition = this.getPositionAccessor();
+ const dataUpdateTriggers = this.getDataUpdateTriggers(layerDataset);
+ const triggerChanged = this.getChangedTriggers(dataUpdateTriggers);
+
+ if (triggerChanged.getMeta) {
+ this.updateLayerMeta(allData, getPosition);
+ }
+
+ let data = [];
+ if (!triggerChanged.getData) {
+ // same data
+ data = oldLayerData.data;
+ } else {
+ data = this.calculateDataAttribute(layerDataset, getPosition);
+ }
+
+ return {data, triggerChanged};
+ }
/**
* helper function to update one layer domain when state.data changed
* if state.data change is due ot update filter, newFiler will be passed
@@ -807,8 +851,13 @@ export default class Layer {
* @param {Object} newFilter
* @returns {object} layer
*/
- updateLayerDomain(dataset, newFilter) {
+ updateLayerDomain(datasets, newFilter) {
+ const dataset = this.getDataset(datasets);
+ if (!dataset) {
+ return this;
+ }
Object.values(this.visualChannels).forEach(channel => {
+
const {scale} = channel;
const scaleType = this.config[scale];
// ordinal domain is based on allData, if only filter changed
@@ -824,6 +873,10 @@ export default class Layer {
return this;
}
+ getDataset(datasets) {
+ return datasets[this.config.dataId];
+ }
+
/**
* Validate visual channel field and scales based on supported field & scale type
* @param channel
@@ -981,4 +1034,42 @@ export default class Layer {
shouldCalculateLayerData(props) {
return props.some(p => !this.noneLayerDataAffectingProps.includes(p));
}
+
+ getBrushingExtensionProps(interactionConfig, brushingTarget) {
+ const {brush} = interactionConfig;
+
+ return {
+ // brushing
+ autoHighlight: !brush.enabled,
+ brushingRadius: brush.config.size * 1000,
+ brushingTarget: brushingTarget || 'source',
+ brushingEnabled: brush.enabled
+ }
+ }
+
+ getDefaultDeckLayerProps({idx, gpuFilter, mapState}) {
+ return {
+ id: this.id,
+ idx,
+ coordinateSystem: COORDINATE_SYSTEM.LNGLAT_DEPRECATED,
+ pickable: true,
+ wrapLongitude: true,
+ parameters: {depthTest: Boolean(mapState.dragRotate || this.config.visConfig.enable3d)},
+ // visconfig
+ opacity: this.config.visConfig.opacity,
+ highlightColor: this.config.highlightColor,
+ // data filtering
+ extensions: [dataFilterExtension],
+ filterRange: gpuFilter.filterRange
+ }
+ }
+
+ getDefaultHoverLayerProps() {
+ return {
+ id: `${this.id}-hovered`,
+ pickable: false,
+ wrapLongitude: true,
+ coordinateSystem: COORDINATE_SYSTEM.LNGLAT_DEPRECATED
+ }
+ }
}
diff --git a/src/layers/cluster-layer/cluster-layer.js b/src/layers/cluster-layer/cluster-layer.js
index ac6748bb2..e8aa9af07 100644
--- a/src/layers/cluster-layer/cluster-layer.js
+++ b/src/layers/cluster-layer/cluster-layer.js
@@ -63,33 +63,49 @@ export default class ClusterLayer extends AggregationLayer {
};
}
- renderLayer({
- data,
- idx,
- objectHovered,
- mapState,
- interaction,
- layerCallbacks
- }) {
+ renderLayer(opts) {
const {visConfig} = this.config;
+ const {
+ data,
+ gpuFilter,
+ objectHovered,
+ mapState,
+ layerCallbacks
+ } = opts;
+
+ const updateTriggers = {
+ getColorValue: {
+ colorField: this.config.colorField,
+ colorAggregation: this.config.visConfig.colorAggregation
+ },
+ filterData: {
+ filterRange: gpuFilter.filterRange,
+ ...gpuFilter.filterValueUpdateTriggers
+ }
+ };
+ const {_filterData: filterData, ...clusterData} = data;
return [
new DeckGLClusterLayer({
- ...data,
- id: this.id,
- idx,
+ ...this.getDefaultDeckLayerProps(opts),
+ ...clusterData,
+ filterData,
+
+ // radius
radiusScale: 1,
radiusRange: visConfig.radiusRange,
clusterRadius: visConfig.clusterRadius,
+
+ // color
colorRange: this.getColorRange(visConfig.colorRange),
- colorScale: this.config.colorScale,
- pickable: true,
- autoHighlight: true,
- highlightColor: this.config.highlightColor,
- opacity: visConfig.opacity,
- mapState,
- // parameters
- parameters: {depthTest: mapState.dragRotate},
+ colorScaleType: this.config.colorScale,
+
+ zoom: Math.round(mapState.zoom),
+ width: mapState.width,
+ height: mapState.height,
+
+ // updateTriggers
+ updateTriggers,
// call back from layer after calculate clusters
onSetColorDomain: layerCallbacks.onSetLayerDomain
diff --git a/src/layers/geojson-layer/geojson-layer.js b/src/layers/geojson-layer/geojson-layer.js
index 7da2980ae..76a3abdd4 100644
--- a/src/layers/geojson-layer/geojson-layer.js
+++ b/src/layers/geojson-layer/geojson-layer.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import memoize from 'lodash.memoize';
import uniq from 'lodash.uniq';
import {DATA_TYPES} from 'type-analyzer';
import Layer, {colorMaker} from '../base-layer';
-import {GeoJsonLayer as DeckGLGeoJsonLayer} from 'deck.gl';
-
+import {GeoJsonLayer as DeckGLGeoJsonLayer} from '@deck.gl/layers';
import {hexToRgb} from 'utils/color-utils';
import {
getGeojsonDataMaps,
@@ -73,7 +71,9 @@ export const geojsonVisConfigs = {
export const geoJsonRequiredColumns = ['geojson'];
export const featureAccessor = ({geojson}) => d => d[geojson.fieldIdx];
-export const featureResolver = ({geojson}) => geojson.fieldIdx;
+export const defaultElevation = 500;
+export const defaultLineWidth = 1;
+export const defaultRadius = 1;
export default class GeoJsonLayer extends Layer {
constructor(props) {
@@ -81,7 +81,7 @@ export default class GeoJsonLayer extends Layer {
this.dataToFeature = [];
this.registerVisConfig(geojsonVisConfigs);
- this.getFeature = memoize(featureAccessor, featureResolver);
+ this.getPositionAccessor = () => featureAccessor(this.config.columns);
}
get type() {
@@ -197,9 +197,14 @@ export default class GeoJsonLayer extends Layer {
return allData[object.properties.index];
}
+ calculateDataAttribute({allData, filteredIndex}, getPosition) {
+ return filteredIndex
+ .map(i => this.dataToFeature[i])
+ .filter(d => d);
+ }
// TODO: fix complexity
/* eslint-disable complexity */
- formatLayerData(_, allData, filteredIndex, oldLayerData, opt = {}) {
+ formatLayerData(datasets, oldLayerData, opt = {}) {
const {
colorScale,
colorField,
@@ -231,31 +236,8 @@ export default class GeoJsonLayer extends Layer {
strokeColor
} = visConfig;
- const getFeature = this.getPositionAccessor(this.config.column);
-
- // geojson feature are object, if doesn't exists
- // create it and save to layer
- if (!oldLayerData || oldLayerData.getFeature !== getFeature) {
- this.updateLayerMeta(allData, getFeature);
- }
-
- let geojsonData;
-
- if (
- oldLayerData &&
- oldLayerData.data &&
- opt.sameData &&
- oldLayerData.getFeature === getFeature
- ) {
- // no need to create a new array of data
- // use updateTriggers to selectively re-calculate attributes
- geojsonData = oldLayerData.data;
- } else {
- // filteredIndex is a reference of index in allData which can map to feature
- geojsonData = filteredIndex
- .map(i => this.dataToFeature[i])
- .filter(d => d);
- }
+ const {allData, gpuFilter} = datasets[this.config.dataId];
+ const {data} = this.updateData(datasets, oldLayerData);
// fill color
const cScale =
@@ -274,6 +256,7 @@ export default class GeoJsonLayer extends Layer {
strokeColorDomain,
strokeColorRange.colors.map(hexToRgb)
);
+
// calculate stroke scale - if stroked = true
const sScale =
sizeField &&
@@ -291,9 +274,16 @@ export default class GeoJsonLayer extends Layer {
radiusField &&
this.getVisChannelScale(radiusScale, radiusDomain, radiusRange);
+ // access feature properties from geojson sub layer
+ const getDataForGpuFilter = f => allData[f.properties.index];
+ const getIndexForGpuFilter = f => f.properties.index;
+
return {
- data: geojsonData,
- getFeature,
+ data,
+ getFilterValue: gpuFilter.filterValueAccessor(
+ getIndexForGpuFilter,
+ getDataForGpuFilter
+ ),
getFillColor: d =>
cScale
? this.getEncodedChannelValue(
@@ -318,7 +308,7 @@ export default class GeoJsonLayer extends Layer {
sizeField,
0
)
- : d.properties.lineWidth || 1,
+ : d.properties.lineWidth || defaultLineWidth,
getElevation: d =>
eScale
? this.getEncodedChannelValue(
@@ -327,7 +317,7 @@ export default class GeoJsonLayer extends Layer {
heightField,
0
)
- : d.properties.elevation || 500,
+ : d.properties.elevation || defaultElevation,
getRadius: d =>
rScale
? this.getEncodedChannelValue(
@@ -336,7 +326,7 @@ export default class GeoJsonLayer extends Layer {
radiusField,
0
)
- : d.properties.radius || 1
+ : d.properties.radius || defaultRadius
};
}
/* eslint-enable complexity */
@@ -347,7 +337,6 @@ export default class GeoJsonLayer extends Layer {
// get bounds from features
const bounds = getGeojsonBounds(this.dataToFeature);
-
// if any of the feature has properties.radius set to be true
const fixedRadius = Boolean(
this.dataToFeature.find(d => d && d.properties && d.properties.radius)
@@ -379,14 +368,20 @@ export default class GeoJsonLayer extends Layer {
return this;
}
- renderLayer({data, idx, objectHovered, mapState, interactionConfig}) {
+ renderLayer(opts) {
+ const {
+ data,
+ gpuFilter,
+ objectHovered,
+ mapState
+ } = opts;
+
const {fixedRadius} = this.meta;
const radiusScale = this.getRadiusScaleByZoom(mapState, fixedRadius);
const zoomFactor = this.getZoomFactor(mapState);
const {visConfig} = this.config;
const layerProps = {
- // multiplier applied just so it being consistent with previously saved maps
lineWidthScale: visConfig.thickness * zoomFactor * 8,
elevationScale: visConfig.elevationScale,
pointRadiusScale: radiusScale,
@@ -418,33 +413,24 @@ export default class GeoJsonLayer extends Layer {
getRadius: {
radiusField: this.config.radiusField,
radiusRange: visConfig.radiusRange
- }
+ },
+ getFilterValue: gpuFilter.filterValueUpdateTriggers
};
+ const defaultLayerProps = this.getDefaultDeckLayerProps(opts);
+
return [
new DeckGLGeoJsonLayer({
+ ...defaultLayerProps,
...layerProps,
- id: this.id,
- idx,
- data: data.data,
- getFillColor: data.getFillColor,
- getLineColor: data.getLineColor,
- getLineWidth: data.getLineWidth,
- getRadius: data.getRadius,
- getElevation: data.getElevation,
- // highlight
- pickable: true,
+ ...data,
highlightColor: HIGHLIGH_COLOR_3D,
autoHighlight: visConfig.enable3d,
- // parameters
- parameters: {
- depthTest: Boolean(visConfig.enable3d || mapState.dragRotate)
- },
- opacity: visConfig.opacity,
stroked: visConfig.stroked,
filled: visConfig.filled,
extruded: visConfig.enable3d,
wireframe: visConfig.wireframe,
+ wrapLongitude: false,
lineMiterLimit: 2,
rounded: true,
updateTriggers
@@ -452,17 +438,16 @@ export default class GeoJsonLayer extends Layer {
...(this.isLayerHovered(objectHovered) && !visConfig.enable3d
? [
new DeckGLGeoJsonLayer({
+ ...this.getDefaultHoverLayerProps(),
...layerProps,
- id: `${this.id}-hovered`,
data: [objectHovered.object],
getLineWidth: data.getLineWidth,
getRadius: data.getRadius,
getElevation: data.getElevation,
getLineColor: this.config.highlightColor,
getFillColor: this.config.highlightColor,
- updateTriggers,
+ // always draw outline
stroked: true,
- pickable: false,
filled: false
})
]
diff --git a/src/layers/grid-layer/grid-layer.js b/src/layers/grid-layer/grid-layer.js
index 4ff1bae13..5e9b78e4e 100644
--- a/src/layers/grid-layer/grid-layer.js
+++ b/src/layers/grid-layer/grid-layer.js
@@ -18,12 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import {GeoJsonLayer, GridLayer as DeckGLGridLayer} from 'deck.gl';
+import {GeoJsonLayer} from 'deck.gl';
+import EnhancedGridLayer from 'deckgl-layers/grid-layer/enhanced-cpu-grid-layer';
import AggregationLayer from '../aggregation-layer';
-import EnhancedCPUGridLayer from 'deckgl-layers/grid-layer/enhanced-cpu-grid-layer';
import {pointToPolygonGeo} from './grid-utils';
import GridLayerIcon from './grid-layer-icon';
-import {HIGHLIGH_COLOR_3D} from 'constants/default-settings';
export const gridVisConfigs = {
opacity: 'opacity',
@@ -55,93 +54,31 @@ export default class GridLayer extends AggregationLayer {
return GridLayerIcon;
}
- formatLayerData(_, allData, filteredIndex, oldLayerData, opt = {}) {
- const formattedData = super.formatLayerData(
- _,
- allData,
- filteredIndex,
- oldLayerData,
- opt
- );
+ renderLayer(opts) {
+ const {
+ data,
+ objectHovered,
+ mapState
+ } = opts;
- const {getPosition, data} = formattedData;
-
- // TODO: fix this in deck.gl layer
- const cleaned = data.filter(d => {
- const pos = getPosition(d);
- return pos.every(Number.isFinite);
- });
-
- // All data processing is done in deck.gl layer
- return {
- ...formattedData,
- data: cleaned
- };
- }
-
- renderLayer({
- data,
- idx,
- objectHovered,
- mapState,
- interaction,
- layerCallbacks,
- layerInteraction
- }) {
const zoomFactor = this.getZoomFactor(mapState);
- const eleZoomFactor = this.getElevationZoomFactor(mapState);
const {visConfig} = this.config;
const cellSize = visConfig.worldUnitSize * 1000;
return [
- new DeckGLGridLayer({
+ new EnhancedGridLayer({
+ ...this.getDefaultAggregationLayerProp(opts),
...data,
- ...layerInteraction,
wrapLongitude: false,
- id: this.id,
- idx,
- cellSize,
- coverage: visConfig.coverage,
- // highlight
- autoHighlight: visConfig.enable3d,
- highlightColor: HIGHLIGH_COLOR_3D,
-
- // color
- colorRange: this.getColorRange(visConfig.colorRange),
- colorScale: this.config.colorScale,
- sizeScale: this.config.sizeScale,
- opacity: visConfig.opacity,
- upperPercentile: visConfig.percentile[1],
- lowerPercentile: visConfig.percentile[0],
-
- // elevation
- extruded: visConfig.enable3d,
- elevationScale: visConfig.elevationScale * eleZoomFactor,
- elevationRange: visConfig.sizeRange,
- elevationLowerPercentile: visConfig.elevationPercentile[0],
- elevationUpperPercentile: visConfig.elevationPercentile[1],
- // parameters
- parameters: {depthTest: Boolean(visConfig.enable3d || mapState.dragRotate)},
-
- // render
- pickable: true,
-
- // callbacks
- onSetColorDomain: layerCallbacks.onSetLayerDomain,
-
- _subLayerProps: {
- CPU: {
- type: EnhancedCPUGridLayer
- }
- }
+ cellSize
}),
// render an outline of each cell if not extruded
...(this.isLayerHovered(objectHovered) && !visConfig.enable3d
? [
new GeoJsonLayer({
- ...layerInteraction,
- id: `${this.id}-hovered`,
+ ...this.getDefaultHoverLayerProps(),
+ wrapLongitude: false,
data: [
pointToPolygonGeo({
object: objectHovered.object,
diff --git a/src/layers/h3-hexagon-layer/h3-hexagon-layer.js b/src/layers/h3-hexagon-layer/h3-hexagon-layer.js
index 62a4cdf51..016dcd75a 100644
--- a/src/layers/h3-hexagon-layer/h3-hexagon-layer.js
+++ b/src/layers/h3-hexagon-layer/h3-hexagon-layer.js
@@ -18,10 +18,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import memoize from 'lodash.memoize';
-
import Layer from '../base-layer';
-import {GeoJsonLayer, H3HexagonLayer} from 'deck.gl';
+import {GeoJsonLayer} from '@deck.gl/layers';
+import {H3HexagonLayer} from '@deck.gl/geo-layers';
import EnhancedColumnLayer from 'deckgl-layers/column-layer/enhanced-column-layer';
import {getVertices, getCentroid, idToPolygonGeo, h3IsValid} from './h3-utils';
import H3HexagonLayerIcon from './h3-hexagon-layer-icon';
@@ -33,7 +32,6 @@ export const HEXAGON_ID_FIELDS = {
export const hexIdRequiredColumns = ['hex_id'];
export const hexIdAccessor = ({hex_id}) => d => d[hex_id.fieldIdx];
-export const hexIdResolver = ({hex_id}) => hex_id.fieldIdx;
export const HexagonIdVisConfigs = {
opacity: 'opacity',
@@ -58,7 +56,7 @@ export default class HexagonIdLayer extends Layer {
constructor(props) {
super(props);
this.registerVisConfig(HexagonIdVisConfigs);
- this.getHexId = memoize(hexIdAccessor, hexIdResolver);
+ this.getPositionAccessor = () => hexIdAccessor(this.config.columns);
}
get type() {
@@ -123,15 +121,35 @@ export default class HexagonIdLayer extends Layer {
};
}
+ calculateDataAttribute({allData, filteredIndex}, getHexId) {
+ const data = [];
+
+ for (let i = 0; i < filteredIndex.length; i++) {
+ const index = filteredIndex[i];
+ const id = getHexId(allData[index]);
+ const centroid = this.dataToFeature.centroids[index];
+
+ if (centroid) {
+ data.push({
+ // keep a reference to the original data index
+ index,
+ data: allData[index],
+ id,
+ centroid
+ });
+ }
+ }
+ return data;
+ }
+
// TODO: fix complexity
/* eslint-disable complexity */
- formatLayerData(_, allData, filteredIndex, oldLayerData, opt = {}) {
+ formatLayerData(datasets, oldLayerData, opt = {}) {
const {
colorScale,
colorDomain,
colorField,
color,
- columns,
sizeField,
sizeScale,
sizeDomain,
@@ -141,6 +159,9 @@ export default class HexagonIdLayer extends Layer {
visConfig: {sizeRange, colorRange, coverageRange}
} = this.config;
+ const {gpuFilter} = datasets[this.config.dataId];
+ const getHexId = this.getPositionAccessor();
+ const {data} = this.updateData(datasets, oldLayerData);
// color
const cScale =
colorField &&
@@ -159,39 +180,6 @@ export default class HexagonIdLayer extends Layer {
coverageField &&
this.getVisChannelScale(coverageScale, coverageDomain, coverageRange, 0);
- const getHexId = this.getHexId(columns);
-
- if (!oldLayerData || oldLayerData.getHexId !== getHexId) {
- this.updateLayerMeta(allData, getHexId);
- }
-
- let data;
- if (
- oldLayerData &&
- oldLayerData.data &&
- opt.sameData &&
- oldLayerData.getHexId === getHexId
- ) {
- data = oldLayerData.data;
- } else {
- data = filteredIndex.reduce((accu, index, i) => {
- const id = getHexId(allData[index]);
- const centroid = this.dataToFeature.centroids[index];
-
- if (centroid) {
- accu.push({
- // keep a reference to the original data index
- index: i,
- data: allData[index],
- id,
- centroid
- });
- }
-
- return accu;
- }, []);
- }
-
const getElevation = sScale
? d => this.getEncodedChannelValue(sScale, d.data, sizeField, 0)
: 0;
@@ -204,13 +192,13 @@ export default class HexagonIdLayer extends Layer {
? d => this.getEncodedChannelValue(coScale, d.data, coverageField, 0)
: 1;
- // const layerData = {
return {
data,
getElevation,
getColor,
getHexId,
getCoverage,
+ getFilterValue: gpuFilter.filterValueAccessor(),
hexagonVertices: this.dataToFeature.hexagonVertices,
hexagonCenter: this.dataToFeature.hexagonCenter
};
@@ -230,8 +218,8 @@ export default class HexagonIdLayer extends Layer {
// find hexagonVertices
// only need 1 instance of hexagonVertices
if (!hexagonVertices) {
- hexagonVertices = getVertices({id});
- hexagonCenter = getCentroid({id});
+ hexagonVertices = id && getVertices({id});
+ hexagonCenter = id && getCentroid({id});
}
// save a reference of centroids to dataToFeature
@@ -244,14 +232,14 @@ export default class HexagonIdLayer extends Layer {
this.updateMeta({bounds});
}
- renderLayer({
- data,
- idx,
- layerInteraction,
- objectHovered,
- mapState,
- interactionConfig
- }) {
+ renderLayer(opts) {
+ const {
+ data,
+ gpuFilter,
+ objectHovered,
+ mapState
+ } = opts;
+
const zoomFactor = this.getZoomFactor(mapState);
const eleZoomFactor = this.getElevationZoomFactor(mapState);
const {config} = this;
@@ -261,38 +249,36 @@ export default class HexagonIdLayer extends Layer {
getColor: {
color: config.color,
colorField: config.colorField,
- colorRange: config.visConfig.colorRange,
+ colorRange: visConfig.colorRange,
colorScale: config.colorScale
},
getElevation: {
sizeField: config.sizeField,
- sizeRange: config.visConfig.sizeRange
- }
+ sizeRange: visConfig.sizeRange
+ },
+ getFilterValue: gpuFilter.filterValueUpdateTriggers
};
const columnLayerTriggers = {
getCoverage: {
coverageField: config.coverageField,
- coverageRange: config.visConfig.coverageRange
+ coverageRange: visConfig.coverageRange
}
};
+ const defaultLayerProps = this.getDefaultDeckLayerProps(opts);
+
return [
new H3HexagonLayer({
- ...layerInteraction,
+ ...defaultLayerProps,
...data,
wrapLongitude: false,
- id: this.id,
- idx,
- pickable: true,
+
getHexagon: x => x.id,
// coverage
coverage: config.coverageField ? 1 : visConfig.coverage,
- // parameters
- parameters: {depthTest: Boolean(config.sizeField || mapState.dragRotate)},
-
// highlight
autoHighlight: Boolean(config.sizeField),
highlightColor: HIGHLIGH_COLOR_3D,
@@ -301,9 +287,6 @@ export default class HexagonIdLayer extends Layer {
extruded: Boolean(config.sizeField),
elevationScale: visConfig.elevationScale * eleZoomFactor,
- // color
- opacity: visConfig.opacity,
-
// render
updateTriggers: h3HexagonLayerTriggers,
_subLayerProps: {
@@ -317,7 +300,7 @@ export default class HexagonIdLayer extends Layer {
...(this.isLayerHovered(objectHovered) && !config.sizeField
? [
new GeoJsonLayer({
- id: `${this.id}-hovered`,
+ ...this.getDefaultHoverLayerProps(),
data: [idToPolygonGeo(objectHovered)],
getLineColor: config.highlightColor,
lineWidthScale: 8 * zoomFactor
diff --git a/src/layers/heatmap-layer/heatmap-layer.js b/src/layers/heatmap-layer/heatmap-layer.js
index da69a26ef..ec19b03e7 100644
--- a/src/layers/heatmap-layer/heatmap-layer.js
+++ b/src/layers/heatmap-layer/heatmap-layer.js
@@ -26,7 +26,6 @@ import {
ALL_FIELD_TYPES
} from 'constants/default-settings';
import {hexToRgb} from 'utils/color-utils';
-import {geojsonFromPoints} from '../mapbox-utils';
import MapboxGLLayer from '../mapboxgl-layer';
import HeatmapLayerIcon from './heatmap-layer-icon';
@@ -34,9 +33,9 @@ const MAX_ZOOM_LEVEL = 18;
export const pointPosAccessor = ({lat, lng}) => d => [
// lng
- d.data[lng.fieldIdx],
+ d[lng.fieldIdx],
// lat
- d.data[lat.fieldIdx]
+ d[lat.fieldIdx]
];
export const pointColResolver = ({lat, lng}) =>
@@ -81,8 +80,6 @@ const heatmapDensity = colorRange => {
return colorDensity;
};
-const shouldRebuild = (sameData, sameConfig) => !(sameData && sameConfig);
-
class HeatmapLayer extends MapboxGLLayer {
constructor(props) {
super(props);
@@ -145,130 +142,99 @@ class HeatmapLayer extends MapboxGLLayer {
return layerConfig;
}
- isSameData = ({allData, filteredIndex, oldLayerData, opt = {}}, config) => {
- return Boolean(
- oldLayerData && oldLayerData.columns === config.columns && opt.sameData
- );
- };
-
- isSameConfig = ({oldLayerData, config}) => {
- // columns must use the same filedIdx
- // this is a fast way to compare columns object
- const {columns, weightField} = config;
-
- if (!oldLayerData) {
- return false;
- }
-
- const sameColumns = columns === oldLayerData.columns;
- const sameWeightField = weightField === oldLayerData.weightField;
- return sameColumns && sameWeightField;
- };
-
- datasetSelector = config => config.dataId;
- columnsSelector = config => pointColResolver(config.columns);
- visConfigSelector = config => config.visConfig;
- weightFieldSelector = config =>
- config.weightField ? config.weightField.name : null;
- weightDomainSelector = config => config.weightDomain;
-
getPositionAccessor() {
return this.getPosition(this.config.columns);
}
updateLayerMeta(allData) {
const getPosition = this.getPositionAccessor();
- const bounds = this.getPointsBounds(allData, d => getPosition({data: d}));
+ const bounds = this.getPointsBounds(allData, d => getPosition(d));
this.updateMeta({bounds});
}
- computeHeatmapConfiguration = createSelector(
- this.datasetSelector,
- this.columnsSelector,
+ columnsSelector = config => pointColResolver(config.columns);
+ visConfigSelector = config => config.visConfig;
+ weightFieldSelector = config =>
+ config.weightField ? config.weightField.name : null;
+ weightDomainSelector = config => config.weightDomain;
+
+ paintSelector = createSelector(
this.visConfigSelector,
this.weightFieldSelector,
this.weightDomainSelector,
+ (visConfig, weightField, weightDomain) => ({
+ 'heatmap-weight': weightField
+ ? [
+ 'interpolate',
+ ['linear'],
+ ['get', weightField],
+ weightDomain[0],
+ 0,
+ weightDomain[1],
+ 1
+ ]
+ : 1,
+ 'heatmap-intensity': [
+ 'interpolate',
+ ['linear'],
+ ['zoom'],
+ 0,
+ 1,
+ MAX_ZOOM_LEVEL,
+ 3
+ ],
+ 'heatmap-color': [
+ 'interpolate',
+ ['linear'],
+ ['heatmap-density'],
+ ...heatmapDensity(visConfig.colorRange)
+ ],
+ 'heatmap-radius': [
+ 'interpolate',
+ ['linear'],
+ ['zoom'],
+ 0,
+ 2,
+ MAX_ZOOM_LEVEL,
+ visConfig.radius // radius
+ ],
+ 'heatmap-opacity': visConfig.opacity
+ })
+ );
+
+ computeHeatmapConfiguration = createSelector(
+ this.sourceSelector,
+ this.filterSelector,
+ this.paintSelector,
+ (source, filter, paint) => {
- (datasetId, columns, visConfig, weightField, weightDomain) => {
return {
type: 'heatmap',
id: this.id,
- source: `${datasetId}-${columns}`,
+ source,
layout: {
visibility: 'visible'
},
maxzoom: MAX_ZOOM_LEVEL,
- paint: {
- 'heatmap-weight': weightField
- ? [
- 'interpolate',
- ['linear'],
- ['get', weightField],
- weightDomain[0],
- 0,
- weightDomain[1],
- 1
- ]
- : 1,
- 'heatmap-intensity': [
- 'interpolate',
- ['linear'],
- ['zoom'],
- 0,
- 1,
- MAX_ZOOM_LEVEL,
- 3
- ],
- 'heatmap-color': [
- 'interpolate',
- ['linear'],
- ['heatmap-density'],
- ...heatmapDensity(visConfig.colorRange)
- ],
- 'heatmap-radius': [
- 'interpolate',
- ['linear'],
- ['zoom'],
- 0,
- 2,
- MAX_ZOOM_LEVEL,
- visConfig.radius // radius
- ],
- 'heatmap-opacity': visConfig.opacity
- }
+ filter,
+ paint
};
}
);
- formatLayerData(_, allData, filteredIndex, oldLayerData, opt = {}) {
- const options = {
- allData,
- filteredIndex,
- oldLayerData,
- opt,
- config: this.config
- };
+ getGeometry(position) {
+ return position.every(Number.isFinite) ? {
+ type: 'Point',
+ coordinates: position
+ } : null;
+ };
+ formatLayerData(datasets, oldLayerData) {
const {weightField} = this.config;
- const isSameData = this.isSameData(options, this.config);
- const isSameConfig = this.isSameConfig(options);
-
const getPosition = this.getPositionAccessor();
+ const {data} = this.updateData(datasets, oldLayerData);
- if (!oldLayerData || oldLayerData.getPosition !== getPosition) {
- this.updateLayerMeta(allData, getPosition);
- }
-
- const data = !shouldRebuild(isSameData, isSameConfig)
- ? oldLayerData.data
- : geojsonFromPoints(
- allData,
- filteredIndex,
- this.config.columns,
- weightField ? [weightField] : []
- );
-
- const newConfig = this.computeHeatmapConfiguration(this.config);
+ const newConfig = this.computeHeatmapConfiguration(this.config, datasets);
newConfig.id = this.id;
return {
diff --git a/src/layers/hexagon-layer/hexagon-layer.js b/src/layers/hexagon-layer/hexagon-layer.js
index a87e69ad5..2bda6c128 100644
--- a/src/layers/hexagon-layer/hexagon-layer.js
+++ b/src/layers/hexagon-layer/hexagon-layer.js
@@ -24,7 +24,6 @@ import EnhancedHexagonLayer from 'deckgl-layers/hexagon-layer/enhanced-hexagon-l
import {hexagonToPolygonGeo} from './hexagon-utils';
import HexagonLayerIcon from './hexagon-layer-icon';
import {clamp} from 'utils/data-utils';
-import {HIGHLIGH_COLOR_3D} from 'constants/default-settings';
export const hexagonVisConfigs = {
opacity: 'opacity',
@@ -61,64 +60,30 @@ export default class HexagonLayer extends AggregationLayer {
return HexagonLayerIcon;
}
- renderLayer({
- data,
- idx,
- objectHovered,
- mapState,
- interaction,
- layerCallbacks,
- layerInteraction
- }) {
+ renderLayer(opts) {
+ const {
+ data,
+ objectHovered,
+ mapState
+ } = opts;
const zoomFactor = this.getZoomFactor(mapState);
- const eleZoomFactor = this.getElevationZoomFactor(mapState);
const {visConfig} = this.config;
const radius = visConfig.worldUnitSize * 1000;
return [
new EnhancedHexagonLayer({
+ ...this.getDefaultAggregationLayerProp(opts),
...data,
- ...layerInteraction,
wrapLongitude: false,
- id: this.id,
- idx,
-
- // highlight
- autoHighlight: visConfig.enable3d,
- highlightColor: HIGHLIGH_COLOR_3D,
-
- radius,
- coverage: visConfig.coverage,
-
- // color
- colorRange: this.getColorRange(visConfig.colorRange),
- colorScale: this.config.colorScale,
- opacity: visConfig.opacity,
- upperPercentile: visConfig.percentile[1],
- lowerPercentile: visConfig.percentile[0],
-
- // parameters
- parameters: {depthTest: Boolean(visConfig.enable3d || mapState.dragRotate)},
-
- // elevation
- extruded: visConfig.enable3d,
- elevationScale: visConfig.elevationScale * eleZoomFactor,
- elevationLowerPercentile: visConfig.elevationPercentile[0],
- elevationUpperPercentile: visConfig.elevationPercentile[1],
-
- // render
- pickable: true,
-
- // callbacks
- onSetColorDomain: layerCallbacks.onSetLayerDomain
+ radius
}),
// render an outline of each hexagon if not extruded
...(this.isLayerHovered(objectHovered) && !visConfig.enable3d
? [
new GeoJsonLayer({
- ...layerInteraction,
- id: `${this.id}-hovered`,
+ ...this.getDefaultAggregationLayerProp(),
+ wrapLongitude: false,
data: [
hexagonToPolygonGeo(
objectHovered,
diff --git a/src/layers/icon-layer/icon-layer.js b/src/layers/icon-layer/icon-layer.js
index 493f08b39..035c79017 100644
--- a/src/layers/icon-layer/icon-layer.js
+++ b/src/layers/icon-layer/icon-layer.js
@@ -18,15 +18,17 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import Layer from '../base-layer';
-import memoize from 'lodash.memoize';
import window from 'global/window';
+import {BrushingExtension} from '@deck.gl/extensions';
import {hexToRgb} from 'utils/color-utils';
import SvgIconLayer from 'deckgl-layers/svg-icon-layer/svg-icon-layer';
import IconLayerIcon from './icon-layer-icon';
import {ICON_FIELDS, CLOUDFRONT} from 'constants/default-settings';
import IconInfoModalFactory from './icon-info-modal';
+import Layer from '../base-layer';
+
+const brushingExtension = new BrushingExtension();
export const SVG_ICON_URL = `${CLOUDFRONT}/icons/svg-icons.json`;
@@ -34,11 +36,7 @@ export const iconPosAccessor = ({lat, lng}) => d => [
d.data[lng.fieldIdx],
d.data[lat.fieldIdx]
];
-
-export const iconPosResolver = ({lat, lng}) => `${lat.fieldIdx}-${lng.fieldIdx}`;
-
export const iconAccessor = ({icon}) => d => d.data[icon.fieldIdx];
-export const iconResolver = ({icon}) => icon.fieldIdx;
export const iconRequiredColumns = ['lat', 'lng', 'icon'];
@@ -50,16 +48,26 @@ export const pointVisConfigs = {
radiusRange: 'radiusRange'
};
+function flatterIconPositions(icon) {
+ return icon.mesh.cells.reduce((prev, cell) => {
+ cell.forEach(p => {
+ Array.prototype.push.apply(prev, icon.mesh.positions[p]);
+ });
+ return prev;
+ }, []);
+}
+
export default class IconLayer extends Layer {
- constructor(props) {
+ constructor(props = {}) {
super(props);
this.registerVisConfig(pointVisConfigs);
- this.getPosition = memoize(iconPosAccessor, iconPosResolver);
- this.getIcon = memoize(iconAccessor, iconResolver);
+ this.getPositionAccessor = () => iconPosAccessor(this.config.columns);
+ this.getIconAccessor = () => iconAccessor(this.config.columns);
// prepare layer info modal
this._layerInfoModal = IconInfoModalFactory();
+ this.iconGeometry = props.iconGeometry || null;
this.getSvgIcons();
}
@@ -101,7 +109,7 @@ export default class IconLayer extends Layer {
};
}
- async getSvgIcons() {
+ getSvgIcons() {
const fetchConfig = {
method: 'GET',
mode: 'cors',
@@ -109,22 +117,21 @@ export default class IconLayer extends Layer {
};
if (window.fetch) {
- const response = await window.fetch(SVG_ICON_URL, fetchConfig);
- const {svgIcons} = await response.json();
-
- this.iconGeometry = svgIcons.reduce(
- (accu, curr) => ({
- ...accu,
- [curr.id]: curr.mesh.cells.reduce((prev, cell) => {
- cell.forEach(p => {
- Array.prototype.push.apply(prev, curr.mesh.positions[p]);
- });
- return prev;
- }, [])
- }),
- {}
- );
- this._layerInfoModal = IconInfoModalFactory(svgIcons);
+
+ window.fetch(SVG_ICON_URL, fetchConfig)
+ .then(response => response.json())
+ .then((parsed = {}) => {
+ const {svgIcons = []} = parsed;
+ this.iconGeometry = svgIcons.reduce(
+ (accu, curr) => ({
+ ...accu,
+ [curr.id]: flatterIconPositions(curr)
+ }),
+ {}
+ );
+
+ this._layerInfoModal = IconInfoModalFactory(svgIcons);
+ });
}
}
@@ -165,20 +172,44 @@ export default class IconLayer extends Layer {
return {props};
}
- // TODO: fix complexity
- /* eslint-disable complexity */
- formatLayerData(_, allData, filteredIndex, oldLayerData, opt = {}) {
+ calculateDataAttribute({allData, filteredIndex}, getPosition) {
+ const getIcon = this.getIconAccessor();
+ const data = [];
+
+ for (let i = 0; i < filteredIndex.length; i++) {
+ const index = filteredIndex[i];
+ const pos = getPosition({data: allData[index]});
+ const icon = getIcon({data: allData[index]});
+
+ // if doesn't have point lat or lng, do not add the point
+ // deck.gl can't handle position = null
+ if (pos.every(Number.isFinite) && typeof icon === 'string') {
+ data.push({
+ index,
+ icon,
+ data: allData[index]
+ });
+ }
+ }
+
+ return data;
+ }
+
+ formatLayerData(datasets, oldLayerData, opt = {}) {
const {
colorScale,
colorDomain,
colorField,
color,
- columns,
sizeField,
sizeScale,
sizeDomain,
visConfig: {radiusRange, colorRange}
} = this.config;
+ const getPosition = this.getPositionAccessor();
+
+ const {gpuFilter} = datasets[this.config.dataId];
+ const {data} = this.updateData(datasets, oldLayerData);
// point color
const cScale =
@@ -193,126 +224,82 @@ export default class IconLayer extends Layer {
const rScale =
sizeField && this.getVisChannelScale(sizeScale, sizeDomain, radiusRange, 0);
- const getPosition = this.getPosition(columns);
- const getIcon = this.getIcon(columns);
-
- if (!oldLayerData || oldLayerData.getPosition !== getPosition) {
- this.updateLayerMeta(allData, getPosition);
- }
-
- let data;
- if (
- oldLayerData &&
- oldLayerData.data &&
- opt.sameData &&
- oldLayerData.getPosition === getPosition &&
- oldLayerData.getIcon === getIcon
- ) {
- data = oldLayerData.data;
- } else {
- data = filteredIndex.reduce((accu, index) => {
- const pos = getPosition({data: allData[index]});
- const icon = getIcon({data: allData[index]});
-
- // if doesn't have point lat or lng, do not add the point
- // deck.gl can't handle position = null
- if (!pos.every(Number.isFinite) || typeof icon !== 'string') {
- return accu;
- }
-
- accu.push({
- index,
- icon,
- data: allData[index]
- });
-
- return accu;
- }, []);
- }
-
- const getRadius = rScale
- ? d => this.getEncodedChannelValue(rScale, d.data, sizeField, 0)
- : 1;
+ const getRadius = rScale ? d =>
+ this.getEncodedChannelValue(rScale, d.data, sizeField) : 1;
- const getColor = cScale
+ const getFillColor = cScale
? d => this.getEncodedChannelValue(cScale, d.data, colorField)
: color;
return {
data,
getPosition,
- getIcon,
- getColor,
+ getFillColor,
+ getFilterValue: gpuFilter.filterValueAccessor(),
getRadius
};
}
- /* eslint-enable complexity */
updateLayerMeta(allData, getPosition) {
const bounds = this.getPointsBounds(allData, d => getPosition({data: d}));
this.updateMeta({bounds});
}
- renderLayer({
- data,
- idx,
- objectHovered,
- mapState,
- interactionConfig,
- layerInteraction
- }) {
+ renderLayer(opts) {
+ const {
+ data,
+ gpuFilter,
+ objectHovered,
+ mapState,
+ interactionConfig
+ } = opts;
+
const layerProps = {
- radiusMinPixels: 1,
radiusScale: this.getRadiusScaleByZoom(mapState),
...(this.config.visConfig.fixedRadius ? {} : {radiusMaxPixels: 500})
};
+ const defaultLayerProps = this.getDefaultDeckLayerProps(opts);
+ const brushingProps = this.getBrushingExtensionProps(interactionConfig);
+
return !this.iconGeometry
? []
: [
new SvgIconLayer({
+ ...defaultLayerProps,
+ ...brushingProps,
...layerProps,
...data,
- ...layerInteraction,
- id: this.id,
- idx,
- opacity: this.config.visConfig.opacity,
getIconGeometry: id => this.iconGeometry[id],
- // picking
- autoHighlight: true,
- highlightColor: this.config.highlightColor,
- pickable: true,
-
- // parameters
- parameters: {depthTest: mapState.dragRotate},
-
// update triggers
updateTriggers: {
+ getFilterValue: gpuFilter.filterValueUpdateTriggers,
getRadius: {
sizeField: this.config.colorField,
radiusRange: this.config.visConfig.radiusRange,
sizeScale: this.config.sizeScale
},
- getColor: {
+ getFillColor: {
color: this.config.color,
colorField: this.config.colorField,
colorRange: this.config.visConfig.colorRange,
colorScale: this.config.colorScale
}
- }
+ },
+ extensions: [...defaultLayerProps.extensions, brushingExtension]
}),
+
...(this.isLayerHovered(objectHovered)
? [
new SvgIconLayer({
+ ...this.getDefaultHoverLayerProps(),
...layerProps,
- id: `${this.id}-hovered`,
data: [objectHovered.object],
getPosition: data.getPosition,
getRadius: data.getRadius,
- getColor: this.config.highlightColor,
- getIconGeometry: id => this.iconGeometry[id],
- pickable: false
+ getFillColor: this.config.highlightColor,
+ getIconGeometry: id => this.iconGeometry[id]
})
]
: [])
diff --git a/src/layers/layer-factory.js b/src/layers/layer-factory.js
index d2825a9e9..894aebf67 100644
--- a/src/layers/layer-factory.js
+++ b/src/layers/layer-factory.js
@@ -132,7 +132,7 @@ export const LAYER_VIS_CONFIGS = {
},
clusterRadius: {
type: 'number',
- label: 'Cluster Radius in pixels',
+ label: 'Cluster Radius in Pixels',
defaultValue: 40,
isRanged: false,
range: [1, 500],
diff --git a/src/layers/layer-update.js b/src/layers/layer-update.js
new file mode 100644
index 000000000..493cc2005
--- /dev/null
+++ b/src/layers/layer-update.js
@@ -0,0 +1,70 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+/* eslint-disable guard-for-in */
+
+/**
+ *
+ * @param {Object} updateTriggers {getPosition: {column}, getData: {filteredIndex}}
+ * @param {Object} oldUpdateTriggers
+ * @returns {Boolean|Object} `false` if nothing changed, or `triggerChanged` as an object
+ */
+export function diffUpdateTriggers(updateTriggers, oldUpdateTriggers = {}) {
+ const triggerChanged = {};
+ let reason = false;
+
+ for (const triggerName in updateTriggers) {
+ const newTriggers = updateTriggers[triggerName] || {};
+ const oldTriggers = oldUpdateTriggers[triggerName] || {};
+ const diffReason = compareUpdateTrigger(newTriggers, oldTriggers, triggerName);
+
+ if (diffReason) {
+ triggerChanged[triggerName] = true;
+ reason = triggerChanged;
+ }
+ }
+
+ return reason;
+}
+
+function compareUpdateTrigger(newTriggers, oldTriggers, triggerName) {
+ if (typeof oldTriggers !== 'object') {
+ return oldTriggers === newTriggers ? null : `${triggerName} changed shallowly`;
+ }
+
+ for (const key in oldTriggers) {
+ if (!(key in newTriggers)) {
+ return `${triggerName}.${key} deleted`;
+ }
+
+ // shallow compare
+ if (oldTriggers[key] !== newTriggers[key]) {
+ return `${triggerName}.${key} changed shallowly`;
+ }
+ }
+
+ for (const key in newTriggers) {
+ if (!(key in oldTriggers)) {
+ return `${triggerName}.${key} added`;
+ }
+ }
+
+ return null;
+}
diff --git a/src/layers/line-layer/line-layer.js b/src/layers/line-layer/line-layer.js
index 1e57b217b..b3c35d35b 100644
--- a/src/layers/line-layer/line-layer.js
+++ b/src/layers/line-layer/line-layer.js
@@ -18,9 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import ArcLayer from '../arc-layer/arc-layer';
-import DeckGLLineLayer from 'deckgl-layers/line-layer/line-layer';
+import {BrushingExtension} from '@deck.gl/extensions';
+
import LineLayerIcon from './line-layer-icon';
+import ArcLayer from '../arc-layer/arc-layer';
+import EnhancedLineLayer from 'deckgl-layers/line-layer/line-layer';
export default class LineLayer extends ArcLayer {
get type() {
@@ -51,15 +53,17 @@ export default class LineLayer extends ArcLayer {
return {props: [props]};
}
- renderLayer({
- data,
- idx,
- layerInteraction,
- objectHovered,
- mapState,
- interactionConfig
- }) {
- const {brush} = interactionConfig;
+ renderLayer(opts) {
+ const {
+ data,
+ gpuFilter,
+ objectHovered,
+ interactionConfig
+ } = opts;
+
+ const layerProps = {
+ widthScale: this.config.visConfig.thickness
+ };
const colorUpdateTriggers = {
color: this.config.color,
@@ -69,52 +73,36 @@ export default class LineLayer extends ArcLayer {
targetColor: this.config.visConfig.targetColor
};
- const interaction = {
- // auto highlighting
- pickable: true,
- autoHighlight: !brush.enabled,
- highlightColor: this.config.highlightColor,
-
- // brushing
- brushRadius: brush.config.size * 1000,
- brushSource: true,
- brushTarget: true,
- enableBrushing: brush.enabled
- };
-
+ const defaultLayerProps = this.getDefaultDeckLayerProps(opts);
return [
// base layer
- new DeckGLLineLayer({
- ...layerInteraction,
+ new EnhancedLineLayer({
+ ...defaultLayerProps,
+ ...this.getBrushingExtensionProps(interactionConfig, 'source_target'),
...data,
- ...interaction,
+ ...layerProps,
getColor: data.getSourceColor,
- id: this.id,
- idx,
- opacity: this.config.visConfig.opacity,
- strokeScale: this.config.visConfig.thickness,
- // parameters
- parameters: {depthTest: mapState.dragRotate},
updateTriggers: {
+ getFilterValue: gpuFilter.filterValueUpdateTriggers,
getWidth: {
sizeField: this.config.sizeField,
sizeRange: this.config.visConfig.sizeRange
},
getColor: colorUpdateTriggers,
getTargetColor: colorUpdateTriggers
- }
+ },
+ extensions: [...defaultLayerProps.extensions, new BrushingExtension()]
}),
// hover layer
...(this.isLayerHovered(objectHovered)
? [
- new DeckGLLineLayer({
- id: `${this.id}-hovered`,
+ new EnhancedLineLayer({
+ ...this.getDefaultHoverLayerProps(),
+ ...layerProps,
data: [objectHovered.object],
- strokeScale: this.config.visConfig.thickness,
getColor: this.config.highlightColor,
getTargetColor: this.config.highlightColor,
- getWidth: data.getWidth,
- pickable: false
+ getWidth: data.getWidth
})
]
: [])
diff --git a/src/layers/mapbox-utils.js b/src/layers/mapbox-utils.js
index 9da9f1716..4cd415002 100644
--- a/src/layers/mapbox-utils.js
+++ b/src/layers/mapbox-utils.js
@@ -139,37 +139,68 @@ function updateSourceData(map, sourceId, data) {
* @param properties [{label: {fieldIdx}]
* @returns {{type: string, properties: {}, features: {type: string, properties: {}, geometry: {type: string, coordinates: *[]}}[]}}
*/
-export function geojsonFromPoints(
+export function geoJsonFromData(
allData = [],
filteredIndex = [],
- columns = {},
- properties = []
+ getGeometry,
+ getProperties = (d, i) => {}
) {
+
const geojson = {
type: 'FeatureCollection',
features: []
};
for (let i = 0; i < filteredIndex.length; i++) {
- const point = allData[filteredIndex[i]];
- geojson.features.push({
- type: 'Feature',
- properties: properties.reduce(
- (final, property) => ({
- ...final,
- [property.name]: point[property.tableFieldIndex - 1]
- }),
- {}
- ),
- geometry: {
- type: 'Point',
- coordinates: [
- columns.lng ? point[columns.lng.fieldIdx] : null, // lng
- columns.lat ? point[columns.lat.fieldIdx] : null // lat
- ]
- }
- });
+ const index = filteredIndex[i];
+ const point = allData[index];
+ const geometry = getGeometry(point);
+
+ if (geometry) {
+ geojson.features.push({
+ type: 'Feature',
+ properties: {
+ index,
+ ...getProperties(point, index)
+ },
+ geometry
+ });
+ }
}
return geojson;
}
+
+export const prefixGpuField = (name) => `gpu:${name}`
+
+export function gpuFilterToMapboxFilter(gpuFilter) {
+ const {
+ filterRange,
+ filterValueUpdateTriggers
+ } = gpuFilter;
+
+ const hasFilter = Object.values(filterValueUpdateTriggers).filter(d => d);
+
+ if (!hasFilter.length) {
+ return null;
+ }
+
+ const condition = ['all'];
+
+ // [">=", key, value]
+ // ["<=", key, value]
+ const expressions = Object.values(filterValueUpdateTriggers).reduce(
+ (accu, name, i) =>
+ name
+ ? [
+ ...accu,
+ ['>=', prefixGpuField(name), filterRange[i][0]],
+ ['<=', prefixGpuField(name), filterRange[i][1]]
+ ]
+ : accu,
+ condition
+ );
+
+ return expressions;
+}
+
diff --git a/src/layers/mapboxgl-layer.js b/src/layers/mapboxgl-layer.js
index b49fd7d78..d358cf0f9 100644
--- a/src/layers/mapboxgl-layer.js
+++ b/src/layers/mapboxgl-layer.js
@@ -19,11 +19,20 @@
// THE SOFTWARE.
import Layer, {OVERLAY_TYPE} from './base-layer';
+import {createSelector} from 'reselect';
+
+import {
+ geoJsonFromData,
+ prefixGpuField,
+ gpuFilterToMapboxFilter
+} from './mapbox-utils';
export const mapboxRequiredColumns = ['lat', 'lng'];
-class MapboxLayerGL extends Layer {
+export const pointColResolver = ({lat, lng}) =>
+ `${lat.fieldIdx}-${lng.fieldIdx}`;
+class MapboxLayerGL extends Layer {
get overlayType() {
return OVERLAY_TYPE.mapboxgl;
}
@@ -51,17 +60,98 @@ class MapboxLayerGL extends Layer {
get visualChannels() {
return {};
}
+ datasetSelector = config => config.dataId;
+ gpuFilterSelector = (config, datasets) =>
+ (datasets[config.dataId] || {}).gpuFilter;
+ columnsSelector = config => pointColResolver(config.columns);
+
+ sourceSelector = createSelector(
+ this.datasetSelector,
+ this.columnsSelector,
+ (datasetId, columns) => `${datasetId}-${columns}`
+ );
+
+ filterSelector = createSelector(
+ this.gpuFilterSelector,
+ gpuFilter => gpuFilterToMapboxFilter(gpuFilter)
+ );
+
+ getDataUpdateTriggers({filteredIndex, gpuFilter, id}) {
+ const {columns} = this.config;
+
+ const visualChannelFields = Object.values(this.visualChannels).reduce(
+ (accu, v) => ({
+ ...accu,
+ ...(this.config[v.field] ? {[v.field]: this.config[v.field].name} : {})
+ }),
+ {}
+ );
+
+ const updateTriggers = {
+ getData: {
+ datasetId: id,
+ columns,
+ filteredIndex,
+ ...visualChannelFields,
+ ...gpuFilter.filterValueUpdateTriggers
+ },
+ getMeta: {datasetId: id, columns}
+ };
+
+ return updateTriggers;
+ }
+
+ calculateDataAttribute({allData, filteredIndex, gpuFilter}, getPosition) {
+ const getGeometry = d => this.getGeometry(getPosition(d));
+
+ const vcFields = Object.values(this.visualChannels)
+ .map(v => this.config[v.field])
+ .filter(v => v);
+
+ const getPropertyFromVisualChanel = vcFields.length
+ ? d =>
+ vcFields.reduce(
+ (accu, field) => ({
+ ...accu,
+ [field.name]: d[field.tableFieldIndex - 1]
+ }),
+ {}
+ )
+ : d => ({});
+
+ const {filterValueUpdateTriggers, filterValueAccessor} = gpuFilter;
+
+ // gpuField To property
+ const hasFilter = Object.values(filterValueUpdateTriggers).filter(d => d)
+ .length;
+ const valueAccessor = filterValueAccessor();
+
+ const getPropertyFromFilter = hasFilter
+ ? (d, index) => {
+ const filterValue = valueAccessor({data: d, index});
+ return Object.values(filterValueUpdateTriggers).reduce(
+ (accu, name, i) => ({
+ ...accu,
+ ...(name ? {[prefixGpuField(name)]: filterValue[i]} : {})
+ }),
+ {}
+ );
+ }
+ : d => ({});
+
+ const getProperties = (d, i) => ({
+ ...getPropertyFromVisualChanel(d),
+ ...getPropertyFromFilter(d, i)
+ });
+
+ return geoJsonFromData(allData, filteredIndex, getGeometry, getProperties);
+ }
// this layer is rendered at mapbox level
// todo: maybe need to find a better solution for this one
shouldRenderLayer() {
- return (
- this.type &&
- this.config.isVisible &&
- this.hasAllColumns()
- );
+ return this.type && this.config.isVisible && this.hasAllColumns();
}
-
}
export default MapboxLayerGL;
diff --git a/src/layers/point-layer/point-layer.js b/src/layers/point-layer/point-layer.js
index 433dfce02..869296d4d 100644
--- a/src/layers/point-layer/point-layer.js
+++ b/src/layers/point-layer/point-layer.js
@@ -18,16 +18,15 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import memoize from 'lodash.memoize';
import uniq from 'lodash.uniq';
-import {TextLayer} from 'deck.gl';
+import {BrushingExtension} from '@deck.gl/extensions';
+import {ScatterplotLayer, TextLayer} from '@deck.gl/layers';
+import {getDistanceScales} from 'viewport-mercator-project';
import Layer from '../base-layer';
-import ScatterplotBrushingLayer from 'deckgl-layers/scatterplot-brushing-layer/scatterplot-brushing-layer';
import {hexToRgb} from 'utils/color-utils';
import PointLayerIcon from './point-layer-icon';
import {DEFAULT_LAYER_COLOR, CHANNEL_SCALES} from 'constants/default-settings';
-import {getDistanceScales} from 'viewport-mercator-project';
import {notNullorUndefined} from 'utils/data-utils';
export const pointPosAccessor = ({lat, lng, altitude}) => d => [
@@ -38,20 +37,16 @@ export const pointPosAccessor = ({lat, lng, altitude}) => d => [
altitude && altitude.fieldIdx > -1 ? d.data[altitude.fieldIdx] : 0
];
-export const pointPosResolver = ({lat, lng, altitude}) =>
- `${lat.fieldIdx}-${lng.fieldIdx}-${altitude ? altitude.fieldIdx : 'z'}`;
-
export const pointLabelAccessor = textLabel => d => {
const val = d.data[textLabel.field.tableFieldIndex - 1];
return notNullorUndefined(val) ? String(val) : '';
};
-export const pointLabelResolver = textLabel =>
- textLabel.field && textLabel.field.tableFieldIndex;
-
export const pointRequiredColumns = ['lat', 'lng'];
export const pointOptionalColumns = ['altitude'];
+const brushingExtension = new BrushingExtension();
+
export const pointVisConfigs = {
radius: 'radius',
fixedRadius: 'fixedRadius',
@@ -75,8 +70,7 @@ export default class PointLayer extends Layer {
super(props);
this.registerVisConfig(pointVisConfigs);
- this.getPosition = memoize(pointPosAccessor, pointPosResolver);
- this.getText = [memoize(pointLabelAccessor, pointLabelResolver)];
+ this.getPositionAccessor = () => pointPosAccessor(this.config.columns);
}
get type() {
@@ -131,10 +125,6 @@ export default class PointLayer extends Layer {
};
}
- getPositionAccessor() {
- return this.getPosition(this.config.columns);
- }
-
static findDefaultLayerProps({fieldPairs = []}) {
const props = [];
@@ -182,9 +172,41 @@ export default class PointLayer extends Layer {
};
}
- // TODO: fix complexity
- /* eslint-disable complexity */
- formatLayerData(_, allData, filteredIndex, oldLayerData, opt = {}) {
+ calculateDataAttribute({allData, filteredIndex}, getPosition) {
+ const data = [];
+
+ for (let i = 0; i < filteredIndex.length; i++) {
+ const index = filteredIndex[i];
+ const pos = getPosition({data: allData[index]});
+
+ // if doesn't have point lat or lng, do not add the point
+ // deck.gl can't handle position = null
+ if (pos.every(Number.isFinite)) {
+ data.push({
+ data: allData[index],
+ position: pos,
+ // index is important for filter
+ index
+ });
+ }
+ }
+ return data;
+ }
+
+ getDataUpdateTriggers({filteredIndex}) {
+ return {
+ ...super.getDataUpdateTriggers({filteredIndex}),
+ ...this.config.textLabel.reduce(
+ (accu, tl, i) => ({
+ ...accu,
+ [`getLabelCharacterSet-${i}`]: tl.field ? tl.field.name : null
+ }),
+ {}
+ )
+ };
+ }
+
+ formatLayerData(datasets, oldLayerData) {
const {
colorScale,
colorDomain,
@@ -206,7 +228,13 @@ export default class PointLayer extends Layer {
}
} = this.config;
- // fill color
+ const {gpuFilter} = datasets[this.config.dataId];
+ const {data, triggerChanged} = this.updateData(
+ datasets,
+ oldLayerData
+ );
+ const getPosition = this.getPositionAccessor();
+ // point color
const cScale =
colorField &&
this.getVisChannelScale(
@@ -229,39 +257,6 @@ export default class PointLayer extends Layer {
sizeField &&
this.getVisChannelScale(sizeScale, sizeDomain, radiusRange, fixedRadius);
- const getPosition = this.getPositionAccessor();
-
- if (!oldLayerData || oldLayerData.getPosition !== getPosition) {
- this.updateLayerMeta(allData, getPosition);
- }
-
- let data;
- if (
- oldLayerData &&
- oldLayerData.data &&
- opt.sameData &&
- oldLayerData.getPosition === getPosition
- ) {
- data = oldLayerData.data;
- } else {
- data = filteredIndex.reduce((accu, index) => {
- const pos = getPosition({data: allData[index]});
-
- // if doesn't have point lat or lng, do not add the point
- // deck.gl can't handle position = null
- if (!pos.every(Number.isFinite)) {
- return accu;
- }
-
- accu.push({
- data: allData[index]
- });
-
- return accu;
- }, []);
- }
-
- // get all distinct characters in the text labels
const getRadius = rScale
? d => this.getEncodedChannelValue(rScale, d.data, sizeField, 0)
: 1;
@@ -274,7 +269,7 @@ export default class PointLayer extends Layer {
? d => this.getEncodedChannelValue(scScale, d.data, strokeColorField)
: strokeColor || color;
- // TODO: this should be cleaned up in the gpu-data-filter branch
+ // get all distinct characters in the text labels
const textLabels = textLabel.map((tl, i) => {
if (!tl.field) {
// if no field selected,
@@ -283,20 +278,11 @@ export default class PointLayer extends Layer {
characterSet: []
};
}
- if (!this.getText[i]) {
- this.getText[i] = memoize(pointLabelAccessor, pointLabelResolver);
- }
- const getText = this.getText[i](tl);
+ const getText = pointLabelAccessor(tl);
let characterSet;
- if (
- oldLayerData &&
- Array.isArray(oldLayerData.textLabels) &&
- oldLayerData.textLabels[i] &&
- opt.sameData &&
- oldLayerData.textLabels[i].getText === getText
- ) {
+ if (!triggerChanged[`getLabelCharacterSet-${i}`]) {
characterSet = oldLayerData.textLabels[i].characterSet;
} else {
const allLabels = tl.field ? data.map(getText) : [];
@@ -314,6 +300,7 @@ export default class PointLayer extends Layer {
getPosition,
getFillColor,
getLineColor,
+ getFilterValue: gpuFilter.filterValueAccessor(),
getRadius,
textLabels
};
@@ -354,39 +341,29 @@ export default class PointLayer extends Layer {
];
}
- renderLayer({
- data,
- idx,
- layerInteraction,
- objectHovered,
- mapState,
- interactionConfig
- }) {
- const enableBrushing = interactionConfig.brush.enabled;
+ renderLayer(opts) {
+ const {
+ data,
+ gpuFilter,
+ objectHovered,
+ mapState,
+ interactionConfig
+ } = opts;
+
const radiusScale = this.getRadiusScaleByZoom(mapState);
const layerProps = {
- // TODO: support setting stroke and fill simultaneously
stroked: this.config.visConfig.outline,
filled: this.config.visConfig.filled,
- radiusMinPixels: 0,
- lineWidthMinPixels: this.config.visConfig.thickness,
+ // filterRange: gpuFilter.filterRange,
+ lineWidthScale: this.config.visConfig.thickness,
radiusScale,
...(this.config.visConfig.fixedRadius ? {} : {radiusMaxPixels: 500})
};
- const interaction = {
- autoHighlight: !enableBrushing,
- enableBrushing,
- brushRadius: interactionConfig.brush.config.size * 1000,
- highlightColor: this.config.highlightColor
- };
-
const {textLabel} = this.config;
const updateTriggers = {
- getPosition: {
- columns: this.config.columns
- },
+ getPosition: this.config.columns,
getRadius: {
sizeField: this.config.sizeField,
radiusRange: this.config.visConfig.radiusRange,
@@ -404,37 +381,37 @@ export default class PointLayer extends Layer {
colorField: this.config.strokeColorField,
colorRange: this.config.visConfig.strokeColorRange,
colorScale: this.config.strokeColorScale
- }
+ },
+ getFilterValue: gpuFilter.filterValueUpdateTriggers
};
+ const defaultLayerProps = this.getDefaultDeckLayerProps(opts);
+ const brushingProps = this.getBrushingExtensionProps(interactionConfig);
+
return [
- new ScatterplotBrushingLayer({
+ new ScatterplotLayer({
+ ...defaultLayerProps,
+ ...brushingProps,
...layerProps,
- ...layerInteraction,
...data,
- ...interaction,
- idx,
- id: this.id,
- opacity: this.config.visConfig.opacity,
- pickable: true,
parameters: {
// circles will be flat on the map when the altitude column is not used
depthTest: this.config.columns.altitude.fieldIdx > -1
},
- updateTriggers
+ updateTriggers,
+ extensions: [...defaultLayerProps.extensions, brushingExtension]
}),
// hover layer
...(this.isLayerHovered(objectHovered)
? [
- new ScatterplotBrushingLayer({
+ new ScatterplotLayer({
+ ...this.getDefaultHoverLayerProps(),
...layerProps,
- id: `${this.id}-hovered`,
data: [objectHovered.object],
getLineColor: this.config.highlightColor,
getFillColor: this.config.highlightColor,
getRadius: data.getRadius,
- getPosition: data.getPosition,
- pickable: false
+ getPosition: data.getPosition
})
]
: []),
@@ -443,7 +420,7 @@ export default class PointLayer extends Layer {
if (d.getText) {
accu.push(
new TextLayer({
- ...layerInteraction,
+ ...brushingProps,
id: `${this.id}-label-${textLabel[i].field.name}`,
data: data.data,
getPosition: data.getPosition,
@@ -464,6 +441,10 @@ export default class PointLayer extends Layer {
// text will always show on top of all layers
depthTest: false
},
+
+ getFilterValue: data.getFilterValue,
+ extensions: [...defaultLayerProps.extensions, brushingExtension],
+ filterRange: defaultLayerProps.filterRange,
updateTriggers: {
getPosition: this.config.columns,
getText: textLabel[i].field.name,
@@ -475,7 +456,8 @@ export default class PointLayer extends Layer {
},
getTextAnchor: textLabel[i].anchor,
getAlignmentBaseline: textLabel[i].alignment,
- getColor: textLabel[i].color
+ getColor: textLabel[i].color,
+ getFilterValue: gpuFilter.filterValueUpdateTriggers
}
})
);
diff --git a/src/layers/scenegraph-layer/scenegraph-layer.js b/src/layers/scenegraph-layer/scenegraph-layer.js
index ffc77c113..5ceb58113 100644
--- a/src/layers/scenegraph-layer/scenegraph-layer.js
+++ b/src/layers/scenegraph-layer/scenegraph-layer.js
@@ -23,7 +23,6 @@ import {load} from '@loaders.gl/core';
import {GLTFScenegraphLoader} from '@luma.gl/addons';
import Layer from '../base-layer';
-import memoize from 'lodash.memoize';
import ScenegraphLayerIcon from './scenegraph-layer-icon';
import ScenegraphInfoModalFactory from './scenegraph-info-modal';
@@ -47,9 +46,6 @@ export const scenegraphPosAccessor = ({lat, lng, altitude}) => d => [
altitude && altitude.fieldIdx > -1 ? d.data[altitude.fieldIdx] : 0
];
-export const scenegraphPosResolver = ({lat, lng, altitude}) =>
- `${lat.fieldIdx}-${lng.fieldIdx}-${altitude ? altitude.fieldIdx : 'z'}`;
-
export const scenegraphVisConfigs = {
opacity: 'opacity',
colorRange: 'colorRange',
@@ -71,7 +67,7 @@ export default class ScenegraphLayer extends Layer {
super(props);
this.registerVisConfig(scenegraphVisConfigs);
- this.getPosition = memoize(scenegraphPosAccessor, scenegraphPosResolver);
+ this.getPositionAccessor = () => scenegraphPosAccessor(this.config.columns);
// prepare layer info modal
this._layerInfoModal = ScenegraphInfoModalFactory();
@@ -107,45 +103,38 @@ export default class ScenegraphLayer extends Layer {
};
}
- formatLayerData(_, allData, filteredIndex, oldLayerData, opt = {}) {
- const {columns} = this.config;
-
- const getPosition = this.getPosition(columns);
-
- if (!oldLayerData || oldLayerData.getPosition !== getPosition) {
- this.updateLayerMeta(allData, getPosition);
- }
-
- let data;
- if (
- oldLayerData &&
- oldLayerData.data &&
- opt.sameData &&
- oldLayerData.getPosition === getPosition
- ) {
- data = oldLayerData.data;
- } else {
- data = filteredIndex.reduce((accu, index) => {
- const pos = getPosition({data: allData[index]});
-
- // if doesn't have point lat or lng, do not add the point
- // deck.gl can't handle position = null
- if (!pos.every(Number.isFinite)) {
- return accu;
- }
-
- accu.push({
- index,
- data: allData[index]
+ calculateDataAttribute({allData, filteredIndex}, getPosition) {
+ const data = [];
+
+ for (let i = 0; i < filteredIndex.length; i++) {
+ const index = filteredIndex[i];
+ const pos = getPosition({data: allData[index]});
+
+ // if doesn't have point lat or lng, do not add the point
+ // deck.gl can't handle position = null
+ if (pos.every(Number.isFinite)) {
+ data.push({
+ data: allData[index],
+ position: pos,
+ // index is important for filter
+ index
});
-
- return accu;
- }, []);
+ }
}
+ return data;
+ }
+ formatLayerData(datasets, oldLayerData) {
+ const {gpuFilter} = datasets[this.config.dataId];
+ const {data} = this.updateData(
+ datasets,
+ oldLayerData
+ );
+ const getPosition = this.getPositionAccessor();
return {
data,
- getPosition
+ getPosition,
+ getFilterValue: gpuFilter.filterValueAccessor()
};
}
@@ -154,19 +143,11 @@ export default class ScenegraphLayer extends Layer {
this.updateMeta({bounds});
}
- renderLayer({
- data,
- idx,
- objectHovered,
- mapState,
- interactionConfig,
- layerInteraction
- }) {
- const layerProps = {
- radiusMinPixels: 1,
- radiusScale: this.getRadiusScaleByZoom(mapState),
- ...(this.config.visConfig.fixedRadius ? {} : {radiusMaxPixels: 500})
- };
+ renderLayer(opts) {
+ const {
+ data,
+ gpuFilter
+ } = opts;
const {
visConfig: {sizeScale = 1, angleX = 0, angleY = 0, angleZ = 90}
@@ -174,32 +155,22 @@ export default class ScenegraphLayer extends Layer {
return [
new DeckScenegraphLayer({
- ...layerProps,
+ ...this.getDefaultDeckLayerProps(opts),
...data,
- ...layerInteraction,
- id: this.id,
- idx,
- opacity: this.config.visConfig.opacity,
-
fetch,
-
scenegraph: this.config.visConfig.scenegraph || DEFAULT_MODEL,
-
sizeScale,
getTranslation: DEFAULT_TRANSITION,
getScale: DEFAULT_SCALE,
getOrientation: [angleX, angleY, angleZ],
getColor: DEFAULT_COLOR,
-
- // picking
- pickable: true,
-
// parameters
parameters: {depthTest: true, blend: false},
-
// update triggers
updateTriggers: {
- getOrientation: {angleX, angleY, angleZ}
+ getOrientation: {angleX, angleY, angleZ},
+ getPosition: this.config.columns,
+ getFilterValue: gpuFilter.filterValueUpdateTriggers
}
})
];
diff --git a/src/layers/trip-layer/trip-layer.js b/src/layers/trip-layer/trip-layer.js
index e2f8f3b6b..31fdd3a05 100644
--- a/src/layers/trip-layer/trip-layer.js
+++ b/src/layers/trip-layer/trip-layer.js
@@ -40,11 +40,14 @@ import {
import {hexToRgb} from 'utils/color-utils';
import TripInfoModalFactory from './trip-info-modal';
+export const defaultThickness = 0.5;
+export const defaultWidth = 1;
+
export const tripVisConfigs = {
opacity: 'opacity',
thickness: {
type: 'number',
- defaultValue: 0.5,
+ defaultValue: defaultThickness,
label: 'Stroke Width',
isRanged: false,
range: [0, 100],
@@ -171,10 +174,15 @@ export default class TripLayer extends Layer {
return allData[object.properties.index];
}
- // TODO: fix complexity
- /* eslint-disable complexity */
- formatLayerData(_, allData, filteredIndex, oldLayerData, opt = {}) {
+ calculateDataAttribute({allData, filteredIndex}, getPosition) {
+ return filteredIndex
+ .map(i => this.dataToFeature[i])
+ .filter(d => d && d.geometry.type === 'LineString');
+ }
+
+ formatLayerData(datasets, oldLayerData) {
// to-do: parse segment from allData
+
const {
colorScale,
colorField,
@@ -186,33 +194,9 @@ export default class TripLayer extends Layer {
visConfig
} = this.config;
- const {stroked, colorRange, sizeRange} = visConfig;
-
- const getFeature = this.getPositionAccessor(this.config.column);
-
- // geojson feature are object, if doesn't exists
- // create it and save to layer
- if (!oldLayerData || oldLayerData.getFeature !== getFeature) {
- this.updateLayerMeta(allData, getFeature);
- }
-
- let geojsonData;
-
- if (
- oldLayerData &&
- oldLayerData.data &&
- opt.sameData &&
- oldLayerData.getFeature === getFeature
- ) {
- // no need to create a new array of data
- // use updateTriggers to selectively re-calculate attributes
- geojsonData = oldLayerData.data;
- } else {
- // filteredIndex is a reference of index in allData which can map to feature
- geojsonData = filteredIndex
- .map(i => this.dataToFeature[i])
- .filter(d => d && d.geometry.type === 'LineString');
- }
+ const {colorRange, sizeRange} = visConfig;
+ const {allData, gpuFilter} = datasets[this.config.dataId];
+ const {data} = this.updateData(datasets, oldLayerData);
// color
const cScale =
@@ -222,15 +206,20 @@ export default class TripLayer extends Layer {
colorDomain,
colorRange.colors.map(hexToRgb)
);
-
// calculate stroke scale - if stroked = true
const sScale =
sizeField &&
- stroked &&
this.getVisChannelScale(sizeScale, sizeDomain, sizeRange);
+ // access feature properties from geojson sub layer
+ const getDataForGpuFilter = f => allData[f.properties.index];
+ const getIndexForGpuFilter = f => f.properties.index;
return {
- data: geojsonData,
+ data,
+ getFilterValue: gpuFilter.filterValueAccessor(
+ getIndexForGpuFilter,
+ getDataForGpuFilter
+ ),
getPath: d => d.geometry.coordinates,
getTimestamps: d => this.dataToTimeStamp[d.properties.index],
getColor: d =>
@@ -249,10 +238,9 @@ export default class TripLayer extends Layer {
sizeField,
0
)
- : d.properties.lineWidth || 1
+ : d.properties.lineWidth || defaultWidth
};
}
- /* eslint-enable complexity */
updateAnimationDomain(domain) {
this.updateLayerConfig({
@@ -292,7 +280,13 @@ export default class TripLayer extends Layer {
return this;
}
- renderLayer({data, idx, mapState, animationConfig}) {
+ renderLayer(opts) {
+ const {
+ data,
+ gpuFilter,
+ mapState,
+ animationConfig
+ } = opts;
const {visConfig} = this.config;
const zoomFactor = this.getZoomFactor(mapState);
@@ -310,26 +304,20 @@ export default class TripLayer extends Layer {
getTimestamps: {
columns: this.config.columns,
domain0: animationConfig.domain[0]
- }
+ },
+ getFilterValue: gpuFilter.filterValueUpdateTriggers
};
+ const defaultLayerProps = this.getDefaultDeckLayerProps(opts);
return [
new DeckGLTripsLayer({
- id: this.id,
- idx,
- data: data.data,
- getPath: data.getPath,
- getColor: data.getColor,
+ ...defaultLayerProps,
+ ...data,
getTimestamps: d =>
data.getTimestamps(d).map(ts => ts - animationConfig.domain[0]),
- opacity: this.config.visConfig.opacity,
widthScale: this.config.visConfig.thickness * zoomFactor * 8,
- highlightColor: this.config.highlightColor,
-
- getWidth: data.getWidth,
rounded: true,
- pickable: true,
- autoHighlight: true,
+ wrapLongitude: false,
parameters: {
depthTest: mapState.dragRotate,
depthMask: false
diff --git a/src/processors/data-processor.js b/src/processors/data-processor.js
index fb29c454a..2997ebb4d 100644
--- a/src/processors/data-processor.js
+++ b/src/processors/data-processor.js
@@ -52,7 +52,7 @@ export const ACCEPTED_ANALYZER_TYPES = [
];
// if any of these value occurs in csv, parse it to null;
-const CSV_NULLS = ['', 'null', 'NULL', 'Null', 'NaN', '\N'];
+const CSV_NULLS = ['', 'null', 'NULL', 'Null', 'NaN', '/N'];
const IGNORE_DATA_TYPES = Object.keys(AnalyzerDATA_TYPES).filter(
type => !ACCEPTED_ANALYZER_TYPES.includes(type)
@@ -475,19 +475,19 @@ export function processGeojson(rawData) {
}
// getting all feature fields
- const allData = normalizedGeojson.features.reduce((accu, f, i) => {
+ const allDataRows = [];
+ for (let i = 0; i < normalizedGeojson.features.length; i++) {
+ const f = normalizedGeojson.features[i];
if (f.geometry) {
- accu.push({
+ allDataRows.push({
// add feature to _geojson field
_geojson: f,
...(f.properties || {})
});
}
- return accu;
- }, []);
-
+ }
// get all the field
- const fields = allData.reduce((prev, curr) => {
+ const fields = allDataRows.reduce((prev, curr) => {
Object.keys(curr).forEach(key => {
if (!prev.includes(key)) {
prev.push(key);
@@ -497,16 +497,16 @@ export function processGeojson(rawData) {
}, []);
// make sure each feature has exact same fields
- allData.forEach(d => {
+ allDataRows.forEach(d => {
fields.forEach(f => {
if (!(f in d)) {
d[f] = null;
+ d._geojson.properties[f] = null;
}
});
});
- const processRow = processRowObject(allData);
- return processRow;
+ return processRowObject(allDataRows);
}
/**
diff --git a/src/reducers/vis-state-merger.js b/src/reducers/vis-state-merger.js
index a28562863..eafb2b148 100644
--- a/src/reducers/vis-state-merger.js
+++ b/src/reducers/vis-state-merger.js
@@ -22,6 +22,7 @@ import uniq from 'lodash.uniq';
import pick from 'lodash.pick';
import isEqual from 'lodash.isequal';
import flattenDeep from 'lodash.flattendeep'
+import {toArray} from 'utils/utils';
import {
applyFiltersToDatasets,
@@ -29,6 +30,9 @@ import {
} from 'utils/filter-utils';
import {getInitialMapLayersForSplitMap} from 'utils/split-map-utils';
+import {
+ resetFilterGpuMode, assignGpuChannels
+} from 'utils/gpu-filter-utils';
import {LAYER_BLENDINGS} from 'constants/default-settings';
import {mergeFilterDomainStep} from '../utils/filter-utils';
@@ -42,6 +46,7 @@ import {mergeFilterDomainStep} from '../utils/filter-utils';
* @return {Object} updatedState
*/
export function mergeFilters(state, filtersToMerge) {
+
const merged = [];
const unmerged = [];
const {datasets} = state;
@@ -54,7 +59,7 @@ export function mergeFilters(state, filtersToMerge) {
// merge filters
filtersToMerge.forEach(filter => {
// we can only look for datasets define in the filter dataId
- const datasetIds = Array.isArray(filter.dataId) ? filter.dataId : [filter.dataId];
+ const datasetIds = toArray(filter.dataId);
// we can merge a filter only if all datasets in filter.dataId are loaded
if (datasetIds.every(d => datasets[d])) {
@@ -64,7 +69,9 @@ export function mergeFilters(state, filtersToMerge) {
const dataset = updatedDatasets[datasetId];
const layers = state.layers.filter(l => l.config.dataId === dataset.id);
- const {filter: updatedFilter, dataset: updatedDataset} = validateFilterWithData(acc.augmentedDatasets[datasetId] || dataset, filter, layers);
+ const {filter: updatedFilter, dataset: updatedDataset} = validateFilterWithData(
+ acc.augmentedDatasets[datasetId] || dataset, filter, layers
+ );
if (updatedFilter) {
return {
@@ -106,10 +113,11 @@ export function mergeFilters(state, filtersToMerge) {
}
});
+ // merge filter with existing
+ let updatedFilters = [...(state.filters || []), ...merged];
+ updatedFilters = resetFilterGpuMode(updatedFilters);
+ updatedFilters = assignGpuChannels(updatedFilters);
// filter data
- const updatedFilters = [...(state.filters || []), ...merged];
-
- // flatten all filter dataIds
const datasetsToFilter = uniq(flattenDeep(merged.map(f => f.dataId)));
const filtered = applyFiltersToDatasets(datasetsToFilter, updatedDatasets, updatedFilters, state.layers);
@@ -422,31 +430,35 @@ export function validateSavedTextLabel(
* refer to vis-state-schema.js VisualChannelSchemaV1
*
* @param {Array<Object>} fields
- * @param {Object} visualChannels
+ * @param {Object} newLayer
* @param {Object} savedLayer
- * @return {Object} - validated visual channel in config or {}
+ * @return {Object} - newLayer
*/
export function validateSavedVisualChannels(
fields,
- visualChannels,
+ newLayer,
savedLayer
) {
- return Object.values(visualChannels).reduce((found, {field, scale}) => {
+ Object.values(newLayer.visualChannels).forEach(({field, scale, key}) => {
let foundField;
if (savedLayer.config[field]) {
foundField = fields.find(fd =>
Object.keys(savedLayer.config[field]).every(
- key => savedLayer.config[field][key] === fd[key]
+ prop => savedLayer.config[field][prop] === fd[prop]
)
);
}
- return {
- ...found,
+ const foundChannel = {
...(foundField ? {[field]: foundField} : {}),
...(savedLayer.config[scale] ? {[scale]: savedLayer.config[scale]} : {})
};
- }, {});
+ if (Object.keys(foundChannel).length) {
+ newLayer.updateLayerConfig(foundChannel);
+ newLayer.validateVisualChannel(key);
+ }
+ });
+ return newLayer;
}
/**
@@ -474,7 +486,7 @@ export function validateLayerWithData(
return null;
}
- const newLayer = new layerClasses[type]({
+ let newLayer = new layerClasses[type]({
id: savedLayer.id,
dataId,
label: savedLayer.config.label,
@@ -496,9 +508,9 @@ export function validateLayerWithData(
// visual channel field is saved to be {name, type}
// find visual channel field by matching both name and type
// refer to vis-state-schema.js VisualChannelSchemaV1
- const foundVisualChannelConfigs = validateSavedVisualChannels(
+ newLayer = validateSavedVisualChannels(
fields,
- newLayer.visualChannels,
+ newLayer,
savedLayer
);
@@ -521,8 +533,7 @@ export function validateLayerWithData(
newLayer.updateLayerConfig({
columns,
visConfig,
- textLabel,
- ...foundVisualChannelConfigs
+ textLabel
});
return newLayer;
diff --git a/src/reducers/vis-state-updaters.js b/src/reducers/vis-state-updaters.js
index 7954ced1b..4041da716 100644
--- a/src/reducers/vis-state-updaters.js
+++ b/src/reducers/vis-state-updaters.js
@@ -22,7 +22,6 @@ import {console as Console} from 'global/window';
import Task, {disableStackCapturing, withTask} from 'react-palm/tasks';
import cloneDeep from 'lodash.clonedeep';
import uniq from 'lodash.uniq';
-import {toArray} from 'utils/utils';
import get from 'lodash.get';
// Tasks
@@ -40,14 +39,21 @@ import {
applyFilterFieldName,
applyFiltersToDatasets,
generatePolygonFilter,
+ filterDatasetCPU,
getDefaultFilter,
getFilterPlot,
getDefaultFilterPlotType,
isInRange,
getFilterIdInFeature,
- featureToFilterValue
+ featureToFilterValue,
+ updateFilterDataId
} from 'utils/filter-utils';
+import {
+ setFilterGpuMode,
+ assignGpuChannel
+} from 'utils/gpu-filter-utils';
import {createNewDataEntry} from 'utils/dataset-utils';
+import {set, toArray} from 'utils/utils';
import {
findDefaultLayer,
@@ -254,10 +260,7 @@ export function layerConfigChangeUpdater(state, action) {
const updateLayerDataResult = calculateLayerData(
newLayer,
state,
- oldLayerData,
- {
- sameData: true
- }
+ oldLayerData
);
layerData = updateLayerDataResult.layerData;
@@ -378,11 +381,11 @@ export function layerTypeChangeUpdater(state, action) {
newLayer.assignConfigToLayer(oldLayer.config, oldLayer.visConfigSettings);
- if (newLayer.config.dataId) {
- const dataset = state.datasets[newLayer.config.dataId];
- newLayer.updateLayerDomain(dataset);
- }
-
+ // if (newLayer.config.dataId) {
+ // const dataset = state.datasets[newLayer.config.dataId];
+ // newLayer.updateLayerDomain(dataset);
+ // }
+ newLayer.updateLayerDomain(state.datasets);
const {layerData, layer} = calculateLayerData(newLayer, state);
let newState = updateStateWithLayerAndData(state, {layerData, layer, idx});
@@ -433,9 +436,7 @@ export function layerVisualChannelChangeUpdater(state, action) {
newLayer.updateLayerVisualChannel(dataset, channel);
const oldLayerData = state.layerData[idx];
- const {layerData, layer} = calculateLayerData(newLayer, state, oldLayerData, {
- sameData: true
- });
+ const {layerData, layer} = calculateLayerData(newLayer, state, oldLayerData);
return updateStateWithLayerAndData(state, {layerData, layer, idx});
}
@@ -466,10 +467,7 @@ export function layerVisConfigChangeUpdater(state, action) {
const {layerData, layer} = calculateLayerData(
newLayer,
state,
- oldLayerData,
- {
- sameData: true
- }
+ oldLayerData
);
return updateStateWithLayerAndData(state, {layerData, layer, idx});
}
@@ -532,12 +530,15 @@ export function interactionConfigChangeUpdater(state, action) {
* @public
*/
export function setFilterUpdater(state, action) {
- const {idx, prop, value, valueIndex = 0} = action;
+ const {
+ idx,
+ prop,
+ value,
+ valueIndex = 0
+ } = action;
+
+ let newFilter = set([prop], value, state.filters[idx]);
let newState = state;
- let newFilter = {
- ...state.filters[idx],
- [prop]: value
- };
const {dataId} = newFilter;
@@ -550,7 +551,7 @@ export function setFilterUpdater(state, action) {
// 2. Add a new dataset id
case FILTER_UPDATER_PROPS.dataId:
// if trying to update filter dataId. create an empty new filter
- newFilter = getDefaultFilter(dataId);
+ newFilter = updateFilterDataId(dataId);
break;
case FILTER_UPDATER_PROPS.name:
@@ -574,13 +575,12 @@ export function setFilterUpdater(state, action) {
newFilter = updatedFilter;
- newState = {
- ...state,
- datasets: {
- ...state.datasets,
- [datasetId]: newDataset
- }
- };
+ if (newFilter.gpu) {
+ newFilter = setFilterGpuMode(newFilter, state.filters);
+ newFilter = assignGpuChannel(newFilter, state.filters);
+ }
+
+ newState = set(['datasets', datasetId], newDataset, state);
// only filter the current dataset
break;
@@ -617,10 +617,7 @@ export function setFilterUpdater(state, action) {
}
// save new filters to newState
- newState = {
- ...newState,
- filters: Object.assign([...state.filters], {[idx]: newFilter})
- };
+ newState = set(['filters', idx], newFilter, newState);
// if we are currently setting a prop that only requires to filter the current
// dataset we will pass only the current dataset to applyFiltersToDatasets and
@@ -630,16 +627,14 @@ export function setFilterUpdater(state, action) {
: datasetIds;
// filter data
- newState = {
- ...newState,
- datasets: applyFiltersToDatasets(
- datasetIdsToFilter,
- newState.datasets,
- newState.filters,
- newState.layers
- )
- };
+ const filteredDatasets = applyFiltersToDatasets(
+ datasetIdsToFilter,
+ newState.datasets,
+ newState.filters,
+ newState.layers
+ );
+ newState = set(['datasets'], filteredDatasets, newState);
// dataId is an array
// pass only the dataset we need to update
newState = updateAllLayerDomainData(newState, datasetIdsToFilter, newFilter);
@@ -849,15 +844,15 @@ export const removeFilterUpdater = (state, action) => {
...state.filters.slice(idx + 1, state.filters.length)
];
- const newState = {
- ...state,
- datasets: applyFiltersToDatasets(dataId, state.datasets, newFilters, state.layers),
- filters: newFilters,
- editor: getFilterIdInFeature(state.editor.selectedFeature) === id ? {
- ...state.editor,
- selectedFeature: null
- } : state.editor
- };
+ const filteredDatasets = applyFiltersToDatasets(dataId, state.datasets, newFilters, state.layers);
+ const newEditor = getFilterIdInFeature(state.editor.selectedFeature) === id ? {
+ ...state.editor,
+ selectedFeature: null
+ } : state.editor;
+
+ let newState = set(['filters'], newFilters, state);
+ newState = set(['datasets'], filteredDatasets, newState);
+ newState = set(['editor'], newEditor, newState);
return updateAllLayerDomainData(newState, dataId);
};
@@ -1359,6 +1354,7 @@ function closeSpecificMapAtIndex(state, action) {
export const loadFilesUpdater = (state, action) => {
const {files} = action;
const filesToLoad = files.map(fileBlob => processFileToLoad(fileBlob));
+
// reader -> parser -> augment -> receiveVisData
const loadFileTasks = [
Task.all(filesToLoad.map(LOAD_FILE_TASK)).bimap(results => {
@@ -1397,6 +1393,23 @@ export const loadFilesErrUpdater = (state, {error}) => ({
fileLoadingErr: error
});
+/**
+ * When select dataset for export, apply cpu filter to selected dataset
+ * @memberof visStateUpdaters
+ * @param {Object} state `visState`
+ * @param {Object} action
+ * @param {string} action.dataId dataset id
+ * @returns {Object} nextState
+ * @public
+ */
+export const applyCPUFilterUpdater = (state, {dataId}) => {
+
+ // apply cpuFilter
+ const dataIds = toArray(dataId);
+
+ return dataIds.reduce((accu, id) => filterDatasetCPU(accu, id), state);
+};
+
/**
* Helper function to update All layer domain and layer data of state
* @memberof visStateUpdaters
@@ -1435,46 +1448,36 @@ export function addDefaultLayers(state, datasets) {
*/
export function addDefaultTooltips(state, dataset) {
const tooltipFields = findFieldsToShow(dataset);
-
- return {
- ...state,
- interactionConfig: {
- ...state.interactionConfig,
- tooltip: {
- ...state.interactionConfig.tooltip,
- config: {
- // find default fields to show in tooltip
- fieldsToShow: {
- ...state.interactionConfig.tooltip.config.fieldsToShow,
- ...tooltipFields
- }
- }
- }
- }
+ const merged = {
+ ...state.interactionConfig.tooltip.config.fieldsToShow,
+ ...tooltipFields
};
+
+ return set(['interactionConfig', 'tooltip', 'config', 'fieldsToShow'], merged, state);
}
/**
* Helper function to update layer domains for an array of datasets
* @param {Object} state
* @param {Array|Array<string>} dataId dataset id or array of dataset ids
- * @param {Object} newFilter if is called by setFilter, the filter that has changed
+ * @param {Object} updatedFilter if is called by setFilter, the filter that has updated
* @returns {Object} nextState
*/
-export function updateAllLayerDomainData(state, dataId, newFilter) {
+export function updateAllLayerDomainData(state, dataId, updatedFilter) {
const dataIds = typeof dataId === 'string' ? [dataId] : dataId;
const newLayers = [];
const newLayerData = [];
state.layers.forEach((oldLayer, i) => {
if (oldLayer.config.dataId && dataIds.includes(oldLayer.config.dataId)) {
+
// No need to recalculate layer domain if filter has fixed domain
const newLayer =
- newFilter && newFilter.fixedDomain
+ updatedFilter && updatedFilter.fixedDomain
? oldLayer
: oldLayer.updateLayerDomain(
- state.datasets[oldLayer.config.dataId],
- newFilter
+ state.datasets,
+ updatedFilter
);
const {layerData, layer} = calculateLayerData(
diff --git a/src/reducers/vis-state.js b/src/reducers/vis-state.js
index 31318e57b..16f076a7d 100644
--- a/src/reducers/vis-state.js
+++ b/src/reducers/vis-state.js
@@ -107,7 +107,9 @@ const actionHandler = {
[ActionTypes.TOGGLE_EDITOR_VISIBILITY]: visStateUpdaters.toggleEditorVisibility,
- [ActionTypes.TOGGLE_FILTER_FEATURE]: visStateUpdaters.toggleFilterFeatureUpdater
+ [ActionTypes.TOGGLE_FILTER_FEATURE]: visStateUpdaters.toggleFilterFeatureUpdater,
+
+ [ActionTypes.APPLY_CPU_FILTER]: visStateUpdaters.applyCPUFilterUpdater
};
// construct vis-state reducer
diff --git a/src/shaderlib/brushing-module.js b/src/shaderlib/brushing-module.js
deleted file mode 100644
index 02186f334..000000000
--- a/src/shaderlib/brushing-module.js
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-function getUniforms() {
- return {};
-}
-
-const vs = `\
-uniform vec2 brushing_uMousePosition;
-uniform float brushing_uBrushRadius;
-uniform float brushing_uBrushSource;
-uniform float brushing_uBrushTarget;
-uniform float brushing_uEnableBrushing;
-uniform float brushing_uStrokeScale;
-uniform float brushing_uOutsideBrushRadius;
-
-const float R_EARTH = 6371000.; // earth radius in meter
-// const float PI = 3.1415926538;
-
-// approximate distance between lng lat in meters
-float distanceBetweenLatLng(vec2 source, vec2 target) {
- float PI = 3.1415926538;
- vec2 delta = (source - target) * PI / 180.;
-
- float a =
- sin(delta.y / 2.) * sin(delta.y / 2.) +
- cos(source.y * PI / 180.) * cos(target.y * PI / 180.) *
- sin(delta.x / 2.) * sin(delta.x / 2.);
-
- float c = 2. * atan(sqrt(a), sqrt(1. - a));
-
- return R_EARTH * c;
-}
-
-// range is km
-float isPointInRange(vec2 ptLatLng, float enabled) {
- return float(enabled <= 0. || distanceBetweenLatLng(ptLatLng, brushing_uMousePosition) <= brushing_uBrushRadius);
-}
-
-vec2 getExtrusionOffset(vec2 line_clipspace, vec2 viewportSize, float offset_direction, float lineWidth) {
- // normalized direction of the line
- vec2 dir_screenspace = normalize(line_clipspace * viewportSize);
- // rotate by 90 degrees
- dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
-
- vec2 offset_screenspace = dir_screenspace * offset_direction * lineWidth / 2.0;
- vec2 offset_clipspace = offset_screenspace / viewportSize * 2.0;
-
- return offset_clipspace;
-}
-
-vec2 brushing_getExtrusionOffset(
- vec2 line_clipspace,
- float offset_direction,
- vec2 viewportSize,
- vec4 instancePositions,
- float instanceStrokeWidth
-) {
- float isSourceInBrush = isPointInRange(instancePositions.xy, brushing_uBrushSource);
- float isTargetInBrush = isPointInRange(instancePositions.zw, brushing_uBrushTarget);
-
- float isInBrush = float(brushing_uEnableBrushing <= 0. ||
- (brushing_uBrushSource * isSourceInBrush > 0. || brushing_uBrushTarget * isTargetInBrush > 0.));
-
- float strokeWidth = brushing_uStrokeScale * instanceStrokeWidth;
-
- float finalWidth = mix(0.0, strokeWidth, isInBrush);
-
- // extrude
- return getExtrusionOffset(line_clipspace, viewportSize, offset_direction, finalWidth);
-}
-
-float brushing_getRadius(
- vec3 instancePositions,
- float instanceRadius
-) {
- float isPtInBrush = isPointInRange(instancePositions.xy, brushing_uEnableBrushing);
- return mix(brushing_uOutsideBrushRadius, instanceRadius, isPtInBrush);
-}
-`;
-
-export default {
- name: 'brushing',
- vs,
- getUniforms
-};
diff --git a/src/utils/data-utils.js b/src/utils/data-utils.js
index 8fd970b3b..518a4d75c 100644
--- a/src/utils/data-utils.js
+++ b/src/utils/data-utils.js
@@ -278,3 +278,16 @@ export const arrayMove = (array, from, to) => {
arrayMoveMutate(array, from, to);
return array;
};
+
+export function findFirstNoneEmpty(data, count = 1, getValue = identity) {
+ let c = 0;
+ const found = [];
+ while (c < count && c < data.length) {
+ const value = getValue(data[c]);
+ if (notNullorUndefined(value)) {
+ found.push(value);
+ }
+ c++;
+ }
+ return found;
+}
diff --git a/src/utils/dataset-utils.js b/src/utils/dataset-utils.js
index 4113f4674..4550206a5 100644
--- a/src/utils/dataset-utils.js
+++ b/src/utils/dataset-utils.js
@@ -23,6 +23,8 @@ import uniq from 'lodash.uniq';
import {TRIP_POINT_FIELDS} from 'constants/default-settings';
import {generateHashId} from './utils';
import {validateInputData} from 'processors/data-processor';
+import {getGpuFilterProps} from 'utils/gpu-filter-utils';
+
// apply a color for each dataset
// to use as label colors
const datasetColors = [
@@ -92,18 +94,19 @@ export function createNewDataEntry({info = {}, data}, datasets = {}) {
tableFieldIndex: i + 1
}));
+ const allIndexes = allData.map((_, i) => i);
return {
[dataId]: {
...datasetInfo,
color: datasetInfo.color || getNewDatasetColor(datasets),
id: dataId,
allData,
- // TODO: no need to make a copy anymore, only save fieldedIndex
- data: allData.slice(),
- filteredIndex: allData.map((_, i) => i),
- filteredIndexForDomain: allData.map((_, i) => i),
+ allIndexes,
+ filteredIndex: allIndexes,
+ filteredIndexForDomain: allIndexes,
fieldPairs: findPointFieldPairs(fields),
- fields
+ fields,
+ gpuFilter: getGpuFilterProps([], dataId, fields)
}
};
}
diff --git a/src/utils/filter-utils.js b/src/utils/filter-utils.js
index 9225ebd7c..80632c3f7 100644
--- a/src/utils/filter-utils.js
+++ b/src/utils/filter-utils.js
@@ -23,12 +23,12 @@ import keyMirror from 'keymirror';
import get from 'lodash.get';
import booleanWithin from '@turf/boolean-within';
import {point as turfPoint} from '@turf/helpers';
-import {ALL_FIELD_TYPES} from 'constants/default-settings';
+import {ALL_FIELD_TYPES, FILTER_TYPES} from 'constants/default-settings';
import {maybeToDate, notNullorUndefined, unique, timeToUnixMilli} from './data-utils';
import * as ScaleUtils from './data-scale-utils';
-import {generateHashId} from './utils';
-import {toArray} from 'utils/utils';
import {LAYER_TYPES} from '../constants';
+import {generateHashId, set, toArray} from './utils';
+import {getGpuFilterProps, getDatasetFieldIndexForFilter} from './gpu-filter-utils';
export const TimestampStepMap = [
{max: 1, step: 0.05},
@@ -50,14 +50,6 @@ const durationDay = durationHour * 24;
const durationWeek = durationDay * 7;
const durationYear = durationDay * 365;
-export const FILTER_TYPES = keyMirror({
- range: null,
- select: null,
- timeRange: null,
- multiSelect: null,
- polygon: null
-});
-
export const PLOT_TYPES = keyMirror({
histogram: null,
lineChart: null
@@ -72,6 +64,9 @@ export const FILTER_UPDATER_PROPS = keyMirror({
export const LIMITED_FILTER_EFFECT_PROPS = keyMirror({
[FILTER_UPDATER_PROPS.name]: null
});
+/**
+ * Max number of filter value buffers that deck.gl provides
+ */
const SupportedPlotType = {
[FILTER_TYPES.timeRange]: {
@@ -115,7 +110,10 @@ export const DEFAULT_FILTER_STRUCTURE = {
// plot
plotType: PLOT_TYPES.histogram,
yAxis: null,
- interval: null
+ interval: null,
+
+ // mode
+ gpu: false
};
export const FILTER_ID_LENGTH = 4;
@@ -131,7 +129,7 @@ export function getDefaultFilter(dataId) {
return {
...DEFAULT_FILTER_STRUCTURE,
// store it as dataId and it could be one or many
- dataId: Array.isArray(dataId) ? dataId : [dataId],
+ dataId: toArray(dataId),
id: generateHashId(FILTER_ID_LENGTH)
};
}
@@ -201,7 +199,6 @@ const filterValidators = {
export function validateFilter(dataset, filter) {
// match filter.dataId
const failed = {dataset, filter: null};
-
const filterDataId = toArray(filter.dataId);
const filterDatasetIndex = filterDataId.indexOf(dataset.id);
@@ -214,12 +211,18 @@ export function validateFilter(dataset, filter) {
...getDefaultFilter(filter.dataId),
...filter,
dataId: filterDataId,
- name: Array.isArray(filter.name) ? filter.name : [filter.name]
+ name: toArray(filter.name)
};
const fieldName = initializeFilter.name[filterDatasetIndex];
const {filter: updatedFilter, dataset: updatedDataset} =
- applyFilterFieldName(initializeFilter, dataset, fieldName, filterDatasetIndex, {mergeDomain: true});
+ applyFilterFieldName(
+ initializeFilter,
+ dataset,
+ fieldName,
+ filterDatasetIndex,
+ {mergeDomain: true}
+ );
if (!updatedFilter) {
return failed;
@@ -283,13 +286,13 @@ function validateFilterYAxis(filter, dataset) {
/**
* Get default filter prop based on field type
*
- * @param {Object[]} data
- * @param {object} field
- * @returns {object} default filter
+ * @param {Array<Array>} allData
+ * @param {Object} field
+ * @returns {Object} default filter
*/
-export function getFilterProps(data, field) {
+export function getFilterProps(allData, field) {
const filterProps = {
- ...getFieldDomain(data, field),
+ ...getFieldDomain(allData, field),
fieldType: field.type
};
@@ -300,14 +303,16 @@ export function getFilterProps(data, field) {
...filterProps,
value: filterProps.domain,
type: FILTER_TYPES.range,
- typeOptions: [FILTER_TYPES.range]
+ typeOptions: [FILTER_TYPES.range],
+ gpu: true
};
case ALL_FIELD_TYPES.boolean:
return {
...filterProps,
type: FILTER_TYPES.select,
- value: true
+ value: true,
+ gpu: false
};
case ALL_FIELD_TYPES.string:
@@ -315,7 +320,8 @@ export function getFilterProps(data, field) {
return {
...filterProps,
type: FILTER_TYPES.multiSelect,
- value: []
+ value: [],
+ gpu: false
};
case ALL_FIELD_TYPES.timestamp:
@@ -324,7 +330,8 @@ export function getFilterProps(data, field) {
type: FILTER_TYPES.timeRange,
enlarged: true,
fixedDomain: true,
- value: filterProps.domain
+ value: filterProps.domain,
+ gpu: true
};
default:
@@ -335,11 +342,11 @@ export function getFilterProps(data, field) {
/**
* Calculate field domain based on field type and data
*
- * @param {Object[]} data
- * @param {object} field
- * @returns {object} with domain as key
+ * @param {Array<Array>} allData
+ * @param {Object} field
+ * @returns {Object} with domain as key
*/
-export function getFieldDomain(data, field) {
+export function getFieldDomain(allData, field) {
const fieldIdx = field.tableFieldIndex - 1;
const isTime = field.type === ALL_FIELD_TYPES.timestamp;
const valueAccessor = maybeToDate.bind(null, isTime, fieldIdx, field.format);
@@ -349,21 +356,21 @@ export function getFieldDomain(data, field) {
case ALL_FIELD_TYPES.real:
case ALL_FIELD_TYPES.integer:
// calculate domain and step
- return getNumericFieldDomain(data, valueAccessor);
+ return getNumericFieldDomain(allData, valueAccessor);
case ALL_FIELD_TYPES.boolean:
return {domain: [true, false]};
case ALL_FIELD_TYPES.string:
case ALL_FIELD_TYPES.date:
- domain = ScaleUtils.getOrdinalDomain(data, valueAccessor);
+ domain = ScaleUtils.getOrdinalDomain(allData, valueAccessor);
return {domain};
case ALL_FIELD_TYPES.timestamp:
- return getTimestampFieldDomain(data, valueAccessor);
+ return getTimestampFieldDomain(allData, valueAccessor);
default:
- return {domain: ScaleUtils.getOrdinalDomain(data, valueAccessor)};
+ return {domain: ScaleUtils.getOrdinalDomain(allData, valueAccessor)};
}
}
@@ -389,7 +396,7 @@ export const getPolygonFilterFunctor = (layer, filter) => {
default:
return () => true
}
-};
+}
/**
* @param field dataset Field
@@ -431,70 +438,197 @@ export function getFilterFunction(field, dataId, filter, layers) {
}
}
+export function updateFilterDataId(dataId) {
+ return getDefaultFilter(dataId);
+}
+
/**
* Filter data based on an array of filters
- * @param {Object} dataset to perform the filter on
- * @param {Object[]} filters list of filters to use against dataset
- * @return {Object} {data: filtered, filteredIndex, filteredIndexForDomain}
+ *
+ * @param {Object} dataset
+ * @param {Array<Object>} filters
+ * @param {Object} opt
+ * @param {Object} opt.cpuOnly only allow cpu filtering
+ * @param {Object} opt.ignoreDomain ignore filter for domain calculation
+ * @returns {Object} dataset
+ * @returns {Array<Number>} dataset.filteredIndex
+ * @returns {Array<Number>} dataset.filteredIndexForDomain
*/
-export function filterData(dataset, filters, layers) {
- const {allData: data, fields} = dataset;
+export function filterDataset(dataset, filters, layers, opt = {}) {
+ const {allData, id: dataId, filterRecord: oldFilterRecord, fields} = dataset;
+
+ // if there is no filters
+ const filterRecord = getFilterRecord(dataId, filters, opt);
+
+ const newDataset = set(['filterRecord'], filterRecord, dataset);
if (!filters.length) {
- const defaultValues = data.map((d, i) => i);
- return {data, filteredIndex: defaultValues, filteredIndexForDomain: defaultValues};
+ return {
+ ...newDataset,
+ gpuFilter: getGpuFilterProps(filters, dataId, fields),
+ filteredIndex: dataset.allIndexes,
+ filteredIndexForDomain: dataset.allIndexes
+ };
}
- const appliedFilters = filters.filter(d => shouldApplyFilter(d, dataset.id));
+ const changedFilters = diffFilters(filterRecord, oldFilterRecord);
- // Map filter against current dataset field
- const filterFunctors = appliedFilters.reduce((acc, filter) => {
- const fieldIndex = getDatasetFieldIndexForFilter(dataset, filter);
- const field = fieldIndex !== -1 ? fields[fieldIndex] : null;
+ // generate 2 sets of filter result
+ // filteredIndex used to calculate layer data
+ // filteredIndexForDomain used to calculate layer Domain
+ const shouldCalDomain = Boolean(changedFilters.dynamicDomain);
+ const shouldCalIndex = Boolean(changedFilters.cpu);
- return {
- ...acc,
- [filter.id]: getFilterFunction(field, dataset.id, filter, layers)
+ let filterResult = {};
+ if (shouldCalDomain || shouldCalIndex) {
+
+ const dynamicDomainFilters = shouldCalDomain ? filterRecord.dynamicDomain : null;
+ const cpuFilters = shouldCalIndex ? filterRecord.cpu : null;
+
+ const filterFuncs = filters.reduce((acc, filter) => {
+ const fieldIndex = getDatasetFieldIndexForFilter(dataset.id, filter);
+ const field = fieldIndex !== -1 ? fields[fieldIndex] : null;
+
+ return {
+ ...acc,
+ [filter.id]: getFilterFunction(field, dataset.id, filter, layers)
+ }
+ }, {});
+
+ filterResult = filterDataByFilterTypes(
+ {dynamicDomainFilters, cpuFilters, filterFuncs},
+ allData
+ );
+ }
+
+ return {
+ ...newDataset,
+ ...filterResult,
+ gpuFilter: getGpuFilterProps(filters, dataId, fields)
+ };
+}
+
+/**
+ *
+ * @param {Object} filters
+ * @param {Array|null} filters.dynamicDomainFilters
+ * @param {Array|null} filters.cpuFilters
+ * @param {Object} filters.filterFuncs
+ * @returns {{filteredIndex: Array, filteredIndexForDomain: Array}} filteredIndex and filteredIndexForDomain
+ */
+function filterDataByFilterTypes({dynamicDomainFilters, cpuFilters, filterFuncs}, allData) {
+ const result = {
+ ...(dynamicDomainFilters ? {filteredIndexForDomain: []} : {}),
+ ...(cpuFilters ? {filteredIndex: []} : {})
+ };
+
+ for (let i = 0; i < allData.length; i++) {
+ const d = allData[i];
+
+ const matchForDomain =
+ dynamicDomainFilters &&
+ dynamicDomainFilters.every(filter => filterFuncs[filter.id](d, i));
+
+ if (matchForDomain) {
+ result.filteredIndexForDomain.push(i);
}
- }, {});
- const [dynamicDomainFilters, fixedDomainFilters] = appliedFilters.reduce(
- (accu, f) => {
- (f.fixedDomain ? accu[1] : accu[0]).push(f);
- return accu;
- },
- [[], []]
- );
+ const matchForRender =
+ cpuFilters &&
+ cpuFilters.every(filter => filterFuncs[filter.id](d, i));
- const {filtered, filteredIndex, filteredIndexForDomain} = data.reduce(
- (accu, d, i) => {
- const matchForDomain = dynamicDomainFilters.every(filter => filterFunctors[filter.id](d, i));
+ if (matchForRender) {
+ result.filteredIndex.push(i);
+ }
+ }
- if (matchForDomain) {
- accu.filteredIndexForDomain.push(i);
+ return result;
+}
- const matchForRender = fixedDomainFilters.every(filter => filterFunctors[filter.id](d, i));
+/**
+ * Get a record of filters based on domain type and gpu / cpu
+ * @param {string} dataId
+ * @param {Array<Object>} filters
+ * @param {Object} opt.cpuOnly only allow cpu filtering
+ * @param {Object} opt.ignoreDomain ignore filter for domain calculation
+ * @returns {{dynamicDomain: Array, fixedDomain: Array, cpu: Array, gpu: Array}} filterRecord
+ */
+export function getFilterRecord(dataId, filters, opt = {}) {
+ const filterRecord = {
+ dynamicDomain: [],
+ fixedDomain: [],
+ cpu: [],
+ gpu: []
+ };
- if (matchForRender) {
- accu.filtered.push(d);
- accu.filteredIndex.push(i);
- }
- }
+ filters.forEach(f => {
+ if (isValidFilterValue(f.type, f.value) && toArray(f.dataId).includes(dataId)) {
+ (f.fixedDomain || opt.ignoreDomain
+ ? filterRecord.fixedDomain
+ : filterRecord.dynamicDomain
+ ).push(f);
- return accu;
- },
- {filtered: [], filteredIndex: [], filteredIndexForDomain: []}
- );
+ (f.gpu && !opt.cpuOnly ? filterRecord.gpu : filterRecord.cpu).push(f);
+ }
+ });
- return {data: filtered, filteredIndex, filteredIndexForDomain};
+ return filterRecord;
}
+/**
+ * Compare filter records to get what has changed
+ * @param {Object} filterRecord
+ * @param {Object} oldFilterRecord
+ * @returns {{dynamicDomain: Object, fixedDomain: Object, cpu: Object, gpu: Object}} changed filters based on type
+ */
+export function diffFilters(filterRecord, oldFilterRecord = {}) {
+ let filterChanged = {};
+
+ Object.entries(filterRecord).forEach(([record, items]) => {
+
+ items.forEach(filter => {
+
+ const oldFilter = (oldFilterRecord[record] || []).find(
+ f => f.id === filter.id
+ );
+
+ if (!oldFilter) {
+ // added
+ filterChanged = set([record, filter.id], 'added', filterChanged);
+ } else {
+ // check what has changed
+ ['name', 'value', 'dataId'].forEach(prop => {
+ if (filter[prop] !== oldFilter[prop]) {
+ filterChanged = set(
+ [record, filter.id],
+ `${prop}_changed`,
+ filterChanged
+ );
+ }
+ });
+ }
+ });
+
+ (oldFilterRecord[record] || []).forEach(oldFilter => {
+ // deleted
+ if (!items.find(f => f.id === oldFilter.id)) {
+ filterChanged = set([record, oldFilter.id], 'deleted', filterChanged);
+ }
+ });
+
+ if (!filterChanged[record]) {
+ filterChanged[record] = null;
+ }
+ });
+
+ return filterChanged;
+}
/**
* Call by parsing filters from URL
* Check if value of filter within filter domain, if not adjust it to match
* filter domain
*
- * @param {string[] | string | number | number[]} value
+ * @param {Array<string> | string | Number | Array<Number>} value
* @param {Array} filter.domain
* @param {String} filter.type
* @returns {*} - adjusted value to match filter or null to remove filter
@@ -577,9 +711,15 @@ function getNumericStepSize(diff) {
/**
* Calculate timestamp domain and suitable step
*
- * @param {Object[]} data
- * @param {function} valueAccessor
- * @returns {object} domain and step
+ * @param {Array<Array>} data
+ * @param {Function} valueAccessor
+ * @returns {{
+ * domain: Array<Number>,
+ * step: Number,
+ * mappedValue: Array<Number>,
+ * histogram: Array<Object>,
+ * enlargedHistogram: Array<Object>
+ * }} timestamp field domain
*/
export function getTimestampFieldDomain(data, valueAccessor) {
// to avoid converting string format time to epoch
@@ -600,6 +740,13 @@ export function getTimestampFieldDomain(data, valueAccessor) {
return {domain, step, mappedValue, histogram, enlargedHistogram};
}
+/**
+ *
+ * @param {Array<Number>} domain
+ * @param {Array<Number>} mappedValue
+ * @param {Number} bins
+ * @returns {Array<{count: Number, x0: Number, x1: number}>} histogram
+ */
export function histogramConstruct(domain, mappedValue, bins) {
return d3Histogram()
.thresholds(ticks(domain[0], domain[1], bins))
@@ -613,11 +760,11 @@ export function histogramConstruct(domain, mappedValue, bins) {
/**
* Calculate histogram from domain and array of values
*
- * @param {number[]} domain
- * @param {Object[]} mappedValue
- * @returns {Array[]} histogram
+ * @param {Array<Number>} domain
+ * @param {Array<Object>} mappedValue
+ * @returns {{histogram: Array<Object>, enlargedHistogram: Array<Object>}} 2 sets of histogram
*/
-function getHistogram(domain, mappedValue) {
+export function getHistogram(domain, mappedValue) {
const histogram = histogramConstruct(domain, mappedValue, histogramBins);
const enlargedHistogram = histogramConstruct(
domain,
@@ -631,10 +778,10 @@ function getHistogram(domain, mappedValue) {
/**
* round number based on step
*
- * @param {number} val
- * @param {number} step
+ * @param {Number} val
+ * @param {Number} step
* @param {string} bound
- * @returns {number} rounded number
+ * @returns {Number} rounded number
*/
export function formatNumberByStep(val, step, bound) {
if (bound === 'floor') {
@@ -764,19 +911,6 @@ export function getDefaultFilterPlotType(filter) {
return filterPlotTypes[filter.yAxis.type] || null;
}
-/**
- * Apply a list of filters to a given dataset
- * @param dataset
- * @param filters
- * @return {Object} filtered dataset
- */
-export function applyFilterToDataset(dataset, filters, layers) {
- return {
- ...dataset,
- ...filterData(dataset, filters, layers)
- };
-}
-
/**
*
* @param datasetIds list of dataset ids to be filtered
@@ -785,26 +919,35 @@ export function applyFilterToDataset(dataset, filters, layers) {
* @return {{[datasetId: string]: Object}} datasets - new updated datasets
*/
export function applyFiltersToDatasets(datasetIds, datasets, filters, layers) {
- const dataIds = Array.isArray(datasetIds) ? datasetIds : [datasetIds];
- return dataIds.reduce((acc, dataIdentifier) => {
- const layersToFilter = (layers || []).filter(l => l.config.dataId === dataIdentifier);
+ const dataIds = toArray(datasetIds);
+ return dataIds.reduce((acc, dataId) => {
+ const layersToFilter = (layers || []).filter(l => l.config.dataId === dataId);
+ const appliedFilters = filters.filter(d => shouldApplyFilter(d, dataId));
+
return {
...acc,
- [dataIdentifier]: applyFilterToDataset(datasets[dataIdentifier], filters, layersToFilter)
+ [dataId]: filterDataset(datasets[dataId], appliedFilters, layersToFilter)
}
}, datasets);
}
/**
* Applies a new field name value to fielter and update both filter and dataset
- * @param filter to be applied the new field name on
- * @param dataset
- * @param fieldName
- * @param filterDatasetIndex
- * @param options
- * @return {object} {filter, datasets}
+ * @param {Object} filter - to be applied the new field name on
+ * @param {Object} dataset - dataset the field belongs to
+ * @param {string} fieldName - field.name
+ * @param {Number} filterDatasetIndex - field.name
+ * @param {Number} filters - current
+ * @param {Object} option
+ * @return {Object} {filter, datasets}
*/
-export function applyFilterFieldName(filter, dataset, fieldName, filterDatasetIndex = 0, {mergeDomain = false} = {}) {
+export function applyFilterFieldName(
+ filter,
+ dataset,
+ fieldName,
+ filterDatasetIndex = 0,
+ {mergeDomain = false} = {}
+) {
// using filterDatasetIndex we can filter only the specified dataset
const {fields, allData} = dataset;
@@ -816,20 +959,17 @@ export function applyFilterFieldName(filter, dataset, fieldName, filterDatasetIn
return {filter: null, dataset};
}
- const newFilter = {
- ...filter,
- // TODO, since we allow to add multiple fields to a filter we can no longer freeze the filter
- freeze: true
- };
-
// TODO: validate field type
const field = fields[fieldIndex];
- const filterProps = field.hasOwnProperty('filterProps') ? field.filterProps : getFilterProps(allData, field);
+ const filterProps = field.hasOwnProperty('filterProps') ?
+ field.filterProps : getFilterProps(allData, field);
- const filterWithProps = {
- ...(mergeDomain ? mergeFilterDomainStep(newFilter, filterProps) : {...newFilter, ...filterProps}),
+ const newFilter = {
+ ...(mergeDomain ? mergeFilterDomainStep(filter, filterProps) : {...filter, ...filterProps}),
name: Object.assign([].concat(filter.name), {[filterDatasetIndex]: field.name}),
- fieldIdx: Object.assign([].concat(filter.fieldIdx), {[filterDatasetIndex]: field.tableFieldIndex - 1})
+ fieldIdx: Object.assign([].concat(filter.fieldIdx), {[filterDatasetIndex]: field.tableFieldIndex - 1}),
+ // TODO, since we allow to add multiple fields to a filter we can no longer freeze the filter
+ freeze: true
};
const fieldWithFilterProps = {
@@ -840,7 +980,7 @@ export function applyFilterFieldName(filter, dataset, fieldName, filterDatasetIn
const newFields = Object.assign([].concat(fields), {[fieldIndex]: fieldWithFilterProps});
return {
- filter: filterWithProps,
+ filter: newFilter,
dataset: {
...dataset,
fields: newFields
@@ -910,37 +1050,6 @@ export function mergeFilterDomainStep(filter, filterProps) {
}
/* eslint-enable complexity */
-/**
- * Return filter dataset index from filter.dataId
- * @param dataset
- * @param filter
- * @return {*}
- */
-export function getDatasetIndexForFilter(dataset, filter) {
- const {dataId} = filter;
- const dataIds = toArray(dataId);
- // dataId is an array
- return dataIds.findIndex(id => id === dataset.id);
-}
-
-/**
- * Return dataset field index from filter.fieldIdx
- * The index matches the same dataset index for filter.dataId
- * @param dataset
- * @param filter
- * @return {*}
- */
-export function getDatasetFieldIndexForFilter(dataset, filter) {
- const datasetIndex = getDatasetIndexForFilter(dataset, filter);
- if (datasetIndex === -1) {
- return datasetIndex;
- }
-
- const fieldIndex = filter.fieldIdx[datasetIndex];
-
- return notNullorUndefined(fieldIndex) ? fieldIndex : -1;
-}
-
export const featureToFilterValue = (feature, filterId, properties = {}) => ({
...feature,
id: feature.id,
@@ -981,3 +1090,61 @@ export function generatePolygonFilter(layers, feature) {
value: featureToFilterValue(feature, filter.id, {isVisible: true})
};
}
+
+/**
+ * Run filter entirely on CPU
+ * @param {Object} state - visState
+ * @param {string} dataId
+ * @return {Object} state state with updated datasets
+ */
+export function filterDatasetCPU(state, dataId) {
+ const datasetFilters = state.filters.filter(f => f.dataId.includes(dataId));
+ const selectedDataset = state.datasets[dataId];
+
+ if (!selectedDataset) {
+ return state;
+ }
+
+ const opt = {
+ cpuOnly: true,
+ ignoreDomain: true
+ };
+
+ if (!datasetFilters.length) {
+ // no filter
+ const filtered = {
+ ...selectedDataset,
+ filteredIdxCPU: selectedDataset.allIndexes,
+ filterRecordCPU: getFilterRecord(dataId, state.filters, opt)
+ };
+
+ return set(['datasets', dataId], filtered, state);
+ }
+
+ // no gpu filter
+ if (!datasetFilters.find(f => f.gpu)) {
+ const filtered = {
+ ...selectedDataset,
+ filteredIdxCPU: selectedDataset.filteredIndex,
+ filterRecordCPU: getFilterRecord(dataId, state.filters, opt)
+ };
+ return set(['datasets', dataId], filtered, state);
+ }
+
+ // make a copy for cpu filtering
+ const copied = {
+ ...selectedDataset,
+ filterRecord: selectedDataset.filterRecordCPU,
+ filteredIndex: selectedDataset.filteredIdxCPU
+ };
+
+ const filtered = filterDataset(copied, state.filters, state.layers, opt);
+
+ const cpuFilteredDataset = {
+ ...selectedDataset,
+ filteredIdxCPU: filtered.filteredIndex,
+ filterRecordCPU: filtered.filterRecord
+ };
+
+ return set(['datasets', dataId], cpuFilteredDataset, state);
+}
diff --git a/src/utils/gl-utils.js b/src/utils/gl-utils.js
index dfd320b7d..e453370af 100644
--- a/src/utils/gl-utils.js
+++ b/src/utils/gl-utils.js
@@ -18,17 +18,12 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import {registerShaderModules, setParameters} from 'luma.gl';
-import brushingModule from 'shaderlib/brushing-module';
+import {setParameters} from 'luma.gl';
import {LAYER_BLENDINGS} from 'constants/default-settings';
import GL from '@luma.gl/constants';
const getGlConst = d => GL[d];
-export function onWebGLInitialized(gl) {
- registerShaderModules([brushingModule], {ignoreMultipleRegistrations: true});
-}
-
export function setLayerBlending(gl, layerBlending) {
const blending = LAYER_BLENDINGS[layerBlending];
const {blendFunc, blendEquation} = blending;
diff --git a/src/utils/gpu-filter-utils.js b/src/utils/gpu-filter-utils.js
new file mode 100644
index 000000000..1201e1f1e
--- /dev/null
+++ b/src/utils/gpu-filter-utils.js
@@ -0,0 +1,246 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import {set, toArray} from './utils';
+import {MAX_GPU_FILTERS, FILTER_TYPES} from 'constants/default-settings';
+import {notNullorUndefined} from './data-utils';
+import moment from 'moment';
+
+/**
+ * Set gpu mode based on current number of gpu filters exists
+ * @param {Object} gpuFilter
+ * @param {Array<Object>} filters
+ */
+export function setFilterGpuMode(filter, filters) {
+ // filter can be apply to multiple dataset, hence gpu filter mode should also be
+ // an array, however, to keep us sane, for now, we only check if there is available channel for every dataId,
+ // if all of them has, we set gpu mode to true
+ // TODO: refactor filter so we don't keep an array of everything
+
+ filter.dataId.forEach((dataId, datasetIdx) => {
+ const gpuFilters = filters.filter(f => f.dataId.includes(dataId) && f.gpu);
+
+ if (filter.gpu && gpuFilters.length === MAX_GPU_FILTERS) {
+ return set(['gpu'], false, filter);
+ }
+ });
+
+ return filter;
+}
+
+export function assignGpuChannels(allFilters) {
+ return allFilters.reduce((accu, f, index) => {
+ let filters = accu;
+
+ // if gpu is true assign and validate gpu Channel
+ if (f.gpu) {
+ f = assignGpuChannel(f, accu);
+ filters = set([index], f, accu);
+ }
+
+ return filters;
+ }, allFilters);
+}
+/**
+ * Assign a new gpu filter a channel based on first availability
+ * @param {Object} filter
+ * @param {Array<Object>} filters
+ */
+export function assignGpuChannel(filter, filters) {
+ // find first available channel
+ if (!filter.gpu) {
+ return filter;
+ }
+
+ const gpuChannel = filter.gpuChannel || [];
+
+ filter.dataId.forEach((dataId, datasetIdx) => {
+ const findGpuChannel = channel => f => {
+ const dataIdx = toArray(f.dataId).indexOf(dataId);
+ return (
+ f.id !== filter.id &&
+ dataIdx > -1 &&
+ f.gpu &&
+ toArray(f.gpuChannel)[dataIdx] === channel
+ );
+ };
+
+ if (
+ Number.isFinite(gpuChannel[datasetIdx]) &&
+ !filters.find(findGpuChannel(gpuChannel[datasetIdx]))
+ ) {
+ // if value is already assigned and valid
+ return;
+ }
+
+ let i = 0;
+
+ while (i < MAX_GPU_FILTERS) {
+ if (!filters.find(findGpuChannel(i))) {
+ gpuChannel[datasetIdx] = i;
+ return;
+ }
+ i++;
+ }
+ });
+
+ // if cannot find channel for all dataid, set gpu back to false
+ // TODO: refactor filter to handle same filter different gpu mode
+ if (!gpuChannel.length || !gpuChannel.every(Number.isFinite)) {
+ return {
+ ...filter,
+ gpu: false
+ };
+ }
+
+ return {
+ ...filter,
+ gpuChannel
+ };
+}
+/**
+ * Edit filter.gpu to ensure that only
+ * X number of gpu filers can coexist.
+ * @param {Array<Object>} filters
+ * @returns {Array<Object>} updated filters
+ */
+export function resetFilterGpuMode(filters) {
+ const gpuPerDataset = {};
+
+ return filters.map((f, i) => {
+ if (f.gpu) {
+ let gpu = true;
+ toArray(f.dataId).forEach(dataId => {
+ const count = gpuPerDataset[dataId];
+
+ if (count === MAX_GPU_FILTERS) {
+ gpu = false;
+ } else {
+ gpuPerDataset[dataId] = count ? count + 1 : 1;
+ }
+ });
+
+ if (!gpu) {
+ return set(['gpu'], false, f);
+ }
+ }
+
+ return f;
+ });
+}
+
+/**
+ * Initial filter uniform
+ * @returns {Array<Array<Number>>}
+ */
+function getEmptyFilterRange() {
+ return new Array(MAX_GPU_FILTERS).fill(0).map(d => [0, 0]);
+}
+
+// By default filterValueAccessor expect each datum to be formated as {index, data}
+// data is the row in allData, and index is its index in allData
+const defaultGetIndex = d => d.index;
+const defaultGetData = d => d.data;
+
+/**
+ *
+ * @param {Array<Object>} channels
+ * @return {Function} getFilterValue
+ */
+const getFilterValueAccessor = (channels, dataId, fields) => (
+ getIndex = defaultGetIndex,
+ getData = defaultGetData
+) => d =>
+ // for empty channel, value is 0 and min max would be [0, 0]
+ channels.map(filter => {
+ if (!filter) {
+ return 0;
+ }
+ const fieldIndex = getDatasetFieldIndexForFilter(dataId, filter);
+ const field = fields[fieldIndex];
+
+ const value =
+ filter.type === FILTER_TYPES.timeRange
+ ? field.filterProps && Array.isArray(field.filterProps.mappedValue)
+ ? field.filterProps.mappedValue[getIndex(d)]
+ : moment.utc(getData(d)[fieldIndex]).valueOf()
+ : getData(d)[fieldIndex];
+
+ return notNullorUndefined(value)
+ ? value - filter.domain[0]
+ : Number.MIN_SAFE_INTEGER;
+ });
+
+/**
+ * Get filter properties for gpu filtering
+ * @param {Array<Object>} filters
+ * @param {string} dataId
+ * @returns {{filterRange: {Object}, filterValueUpdateTriggers: Object, getFilterValue: Function}}
+ */
+export function getGpuFilterProps(filters, dataId, fields) {
+ const filterRange = getEmptyFilterRange();
+ const triggers = {};
+
+ // array of filter for each channel, undefined, if no filter is assigned to that channel
+ const channels = [];
+
+ for (let i = 0; i < MAX_GPU_FILTERS; i++) {
+ const filter = filters.find(
+ f =>
+ f.gpu &&
+ f.dataId.includes(dataId) &&
+ f.gpuChannel[f.dataId.indexOf(dataId)] === i
+ );
+
+ filterRange[i][0] = filter ? filter.value[0] - filter.domain[0] : 0;
+ filterRange[i][1] = filter ? filter.value[1] - filter.domain[0] : 0;
+
+ triggers[`gpuFilter_${i}`] = filter
+ ? filter.name[filter.dataId.indexOf(dataId)]
+ : null;
+ channels.push(filter);
+ }
+
+ const filterValueAccessor = getFilterValueAccessor(channels, dataId, fields);
+
+ return {
+ filterRange,
+ filterValueUpdateTriggers: triggers,
+ filterValueAccessor
+ };
+}
+
+/**
+ * Return dataset field index from filter.fieldIdx
+ * The index matches the same dataset index for filter.dataId
+ * @param dataset
+ * @param filter
+ * @return {*}
+ */
+export function getDatasetFieldIndexForFilter(dataId, filter) {
+ const datasetIndex = toArray(filter.dataId).indexOf(dataId);
+ if (datasetIndex < 0) {
+ return -1;
+ }
+
+ const fieldIndex = filter.fieldIdx[datasetIndex];
+
+ return notNullorUndefined(fieldIndex) ? fieldIndex : -1;
+}
diff --git a/src/utils/layer-utils/layer-utils.js b/src/utils/layer-utils/layer-utils.js
index 50d73a1ad..03da97d25 100644
--- a/src/utils/layer-utils/layer-utils.js
+++ b/src/utils/layer-utils/layer-utils.js
@@ -59,28 +59,21 @@ export function findDefaultLayer(dataset, layerClasses = {}) {
/**
* calculate layer data based on layer type, col Config,
* return updated layer if colorDomain, dataMap has changed
- * @param {object} layer
- * @param {object} state
- * @param {object} oldLayerData
- * @param {object} opt
- * @returns {object} {layerData: {}, layer: {} || undefined}
+ * @param {Object} layer
+ * @param {Object} state
+ * @param {Object} oldLayerData
+ * @returns {{layerData: Array<Object>, layer: Object | undefined}}
*/
-export function calculateLayerData(layer, state, oldLayerData, opt = {}) {
+export function calculateLayerData(layer, state, oldLayerData) {
const {type} = layer;
- const {datasets} = state;
- const {data, filteredIndex, allData} = datasets[layer.config.dataId] || {};
-
- if (!type || !layer.hasAllColumns()) {
+ if (!type || !layer.hasAllColumns() || !layer.config.dataId) {
return {layer, layerData: {}};
}
const layerData = layer.formatLayerData(
- data,
- allData,
- filteredIndex,
- oldLayerData,
- opt
+ state.datasets,
+ oldLayerData
);
return {layerData, layer};
}
diff --git a/src/utils/utils.js b/src/utils/utils.js
index 0c10f8435..cff0ecae1 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -56,7 +56,9 @@ export function isPlainObject(obj) {
* @returns {string}
*/
export function capitalizeFirstLetter(str) {
- return str.charAt(0).toUpperCase() + str.slice(1);
+ return typeof str === 'string'
+ ? str.charAt(0).toUpperCase() + str.slice(1)
+ : str;
}
/**
@@ -65,8 +67,8 @@ export function capitalizeFirstLetter(str) {
* @param {string} str
* @returns {string}
*/
-export function camelToTitle(str){
- const breakWord = str.replace( /([A-Z])/g, " $1" );
+export function camelToTitle(str) {
+ const breakWord = str.replace(/([A-Z])/g, ' $1');
return capitalizeFirstLetter(breakWord);
}
@@ -76,7 +78,7 @@ export function camelToTitle(str){
* @return {string} url
*/
export function getHTMLMapModeTileUrl(mode) {
- return `https://d1a3f4spazzrp4.cloudfront.net/kepler.gl/documentation/map-${mode.toLowerCase()}-mode.png`
+ return `https://d1a3f4spazzrp4.cloudfront.net/kepler.gl/documentation/map-${mode.toLowerCase()}-mode.png`;
}
/**
@@ -98,3 +100,53 @@ export function toArray(item) {
return [item];
}
+
+/**
+ * immutably insert value to an Array or Object
+ * @param {Array|Object} obj
+ * @param {Number|String} key
+ * @param {*} value
+ * @returns {Array|Object}
+ */
+const insertValue = (obj, key, value) => {
+ if (Array.isArray(obj) && typeof key === 'number') {
+ return [...obj.slice(0, key), value, ...obj.slice(key + 1, obj.length)];
+ }
+
+ return {...obj, [key]: value};
+};
+
+/**
+ * check if value is a loose object including a plain object, array, function
+ * @param {*} value
+ */
+export function isObject(value) {
+ return value !== null && (typeof value === 'object' || typeof value === 'function')
+}
+
+const setPath = ([key, ...next], value, obj) => {
+ // is Object allows js object, array and function
+ if (!isObject(obj)) {
+ return obj
+ }
+
+ if (next.length === 0) {
+ return insertValue(obj, key, value);
+ }
+
+ return insertValue(
+ obj,
+ key,
+ setPath(next, value, obj.hasOwnProperty(key) ? obj[key] : {})
+ );
+};
+
+/**
+ * Immutable version of _.set
+ * @param {Array<String|Number>} path
+ * @param {*} value
+ * @param {Object} obj
+ * @returns {Object}
+ */
+export const set = (path, value, obj) =>
+ obj === null ? obj : setPath(path, value, obj);
diff --git a/test/browser/components/injector-test.js b/test/browser/components/injector-test.js
index a401153d3..a30b99d38 100644
--- a/test/browser/components/injector-test.js
+++ b/test/browser/components/injector-test.js
@@ -34,7 +34,6 @@ import {
import coreReducer from 'reducers/core';
import {keplerGlInit} from 'actions/actions';
-import {ERROR_MSG} from 'components/injector';
import {visStateLens, uiStateLens, mapStateLens, mapStyleLens} from 'reducers';
const mockStore = configureStore();
diff --git a/test/browser/components/modals/data-table-modal-test.js b/test/browser/components/modals/data-table-modal-test.js
index edc513d09..b92370b45 100644
--- a/test/browser/components/modals/data-table-modal-test.js
+++ b/test/browser/components/modals/data-table-modal-test.js
@@ -42,9 +42,10 @@ const DataGrid = DataGridFactory(FieldHeader, Cell);
const DataTableModal = DataTableModalFactory(DataGrid);
// This makes sure react-virtualized renders the full grid
+// width needs to be large enough to fit all
const WIDTH = 2100;
const HEIGHT = 800;
-const rows = 10;
+const rows = testAllData.length;
/* eslint-disable max-statements */
test('Components -> DataTableModal.render: csv 1', t => {
@@ -61,8 +62,7 @@ test('Components -> DataTableModal.render: csv 1', t => {
id: 'smoothie',
allData: testAllData,
fields: testFields,
- color: [113, 113, 113],
- data: testAllData.slice(0, rows)
+ color: [113, 113, 113]
}
}}
dataId="smoothie"
@@ -94,8 +94,8 @@ test('Components -> DataTableModal.render: csv 1', t => {
);
t.equal(
wrapper.find('StyledComponent.cell.boolean').length,
- 10,
- 'should render 10 boolean cells'
+ rows,
+ `should render ${rows.length} boolean cells`
);
const expectedRows = {
@@ -103,7 +103,7 @@ test('Components -> DataTableModal.render: csv 1', t => {
'2016-09-17 00:09:55',
'29.9900937',
'31.2590542',
- 'driver_analytics',
+ 'driver_analytics_0',
'1472688000000',
'false',
'1',
@@ -190,7 +190,7 @@ test('Components -> DataTableModal.render: csv 2', t => {
const expectedRows = {
0: [
- '{"type":"Feature","properties":{"fillColor":[1,2,3],"lineColor":[4,5,6],"lineWidth":1,"elevation":10,"radius":5},"geometry":{"type":"Point","coordinates":[[-122,37]]}}',
+ '{"type":"Feature","properties":{"fillColor":[1,2,3],"lineColor":[4,5,6],"lineWidth":1,"elevation":10,"radius":5},"geometry":{"type":"Point","coordinates":[-122.1,37.3]}}',
'[1,2,3]',
'[4,5,6]',
'1',
@@ -198,7 +198,7 @@ test('Components -> DataTableModal.render: csv 2', t => {
'5'
],
1: [
- '{"type":"Feature","properties":{"fillColor":[7,8,9],"lineColor":[4,5,6],"lineWidth":3,"elevation":10,"radius":5},"geometry":{"type":"Point","coordinates":[[-122,37]]}}',
+ '{"type":"Feature","properties":{"fillColor":[7,8,9],"lineColor":[4,5,6],"lineWidth":3,"elevation":10,"radius":5},"geometry":{"type":"Point","coordinates":[-122.2,37.2]}}',
'[7,8,9]',
'[4,5,6]',
'3',
@@ -206,7 +206,7 @@ test('Components -> DataTableModal.render: csv 2', t => {
'5'
],
2: [
- '{"type":"Feature","properties":{"fillColor":[1,2,3],"lineColor":[4,5,6],"lineWidth":4,"elevation":10,"radius":5},"geometry":{"type":"Point","coordinates":[[-122,37]]}}',
+ '{"type":"Feature","properties":{"fillColor":[1,2,3],"lineColor":[4,5,6],"lineWidth":4,"elevation":10,"radius":5},"geometry":{"type":"Point","coordinates":[-122.3,37.1]}}',
'[1,2,3]',
'[4,5,6]',
'4',
diff --git a/test/browser/index.js b/test/browser/index.js
index a91d4a06c..72c3991d3 100644
--- a/test/browser/index.js
+++ b/test/browser/index.js
@@ -20,3 +20,6 @@
// component tests
import './components';
+
+// test layers
+import './layer-tests';
diff --git a/test/browser/layer-tests/arc-layer-specs.js b/test/browser/layer-tests/arc-layer-specs.js
new file mode 100644
index 000000000..91d8dd917
--- /dev/null
+++ b/test/browser/layer-tests/arc-layer-specs.js
@@ -0,0 +1,419 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import test from 'tape';
+import moment from 'moment';
+
+import {
+ testCreateCases,
+ testFormatLayerDataCases,
+ testRenderLayerCases,
+ dataId,
+ testRows,
+ preparedDataset,
+ preparedFilterDomain0,
+ arcLayerMeta
+} from 'test/helpers/layer-utils';
+
+import {KeplerGlLayers} from 'layers';
+
+const {ArcLayer} = KeplerGlLayers;
+const columns = {
+ lat0: 'lat',
+ lng0: 'lng',
+ lat1: 'lat_1',
+ lng1: 'lng_1'
+};
+
+test('#ArcLayer -> constructor', t => {
+ const TEST_CASES = {
+ CREATE: [
+ {
+ props: {
+ dataId: 'smoothie',
+ isVisible: true,
+ label: 'test arc layer'
+ },
+ test: layer => {
+ t.ok(
+ layer.config.dataId === 'smoothie',
+ 'ArcLayer dataId should be correct'
+ );
+ t.ok(layer.type === 'arc', 'type should be arc');
+ t.ok(layer.isAggregated === false, 'ArcLayer is not aggregated');
+ t.ok(
+ layer.config.label === 'test arc layer',
+ 'label should be correct'
+ );
+ t.ok(
+ Object.keys(layer.columnPairs).length,
+ 'should have columnPairs'
+ );
+ }
+ }
+ ]
+ };
+
+ testCreateCases(t, ArcLayer, TEST_CASES.CREATE);
+ t.end();
+});
+
+test('#ArcLayer -> formatLayerData', t => {
+ const filteredIndex = [0, 2, 4];
+
+ // filter.domain: [ 1474071056000, 1474071489000 ]
+ // filterRange: [ [ 39000, 552000 ]
+ const TEST_CASES = [
+ {
+ name: 'Arc trip data.1',
+ layer: {
+ config: {
+ dataId,
+ label: 'trip arcs',
+ columns,
+ color: [10, 10, 10]
+ },
+ type: 'arc',
+ id: 'test_layer_0'
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+
+ const expectedLayerData = {
+ data: [
+ {
+ data: testRows[0],
+ index: 0,
+ sourcePosition: [testRows[0][2], testRows[0][1], 0],
+ targetPosition: [testRows[0][4], testRows[0][3], 0]
+ },
+ {
+ data: testRows[4],
+ index: 4,
+ sourcePosition: [testRows[4][2], testRows[4][1], 0],
+ targetPosition: [testRows[4][4], testRows[4][3], 0]
+ }
+ ],
+ getFilterValue: () => {},
+ getSourceColor: () => {},
+ getTargetColor: () => {},
+ getWidth: () => {}
+ };
+ const expectedDataKeys = Object.keys(expectedLayerData).sort();
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ expectedDataKeys,
+ 'layerData should have 6 keys'
+ );
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct arc layerData data'
+ );
+ // getSourceColor
+ t.deepEqual(
+ layerData.getSourceColor,
+ layer.config.color,
+ 'getSourceColor should be a constant'
+ );
+ // getSourceColor
+ t.deepEqual(
+ layerData.getTargetColor,
+ layer.config.color,
+ 'getTargetColors should be a constant'
+ );
+ // getWidth
+ t.equal(layerData.getWidth, 1, 'getWidth should be a constant');
+ // getFilterValue
+ t.deepEqual(
+ layerData.data.map(layerData.getFilterValue),
+ [
+ [Number.MIN_SAFE_INTEGER, 0, 0, 0],
+ [moment.utc(testRows[4][0]).valueOf() - preparedFilterDomain0, 0, 0, 0],
+ ],
+ 'getFilterValue should return [value, 0, 0, 0]'
+ );
+
+ // layerMeta
+ t.deepEqual(
+ layer.meta,
+ arcLayerMeta,
+ 'should format correct arc layer meta'
+ );
+ }
+ },
+ {
+ name: 'Arc trip data.2 targetColor',
+ layer: {
+ config: {
+ dataId,
+ label: 'trip arcs',
+ columns,
+ color: [10, 10, 10],
+ visConfig: {
+ targetColor: [1, 2, 3]
+ }
+ },
+ type: 'arc',
+ id: 'test_layer_2'
+ },
+ datasets: {
+ [dataId]: preparedDataset
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+
+ const expectedLayerData = {
+ data: [],
+ getFilterValue: () => {},
+ getSourceColor: () => {},
+ getTargetColor: () => {},
+ getWidth: () => {}
+ };
+ const expectedDataKeys = Object.keys(expectedLayerData).sort();
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ expectedDataKeys,
+ 'layerData should have 6 keys'
+ );
+
+ // getSourceColor
+ t.deepEqual(
+ layerData.getSourceColor,
+ layer.config.color,
+ 'getSourceColor should be a constant'
+ );
+ // getSourceColor
+ t.deepEqual(
+ layerData.getTargetColor,
+ [1, 2, 3],
+ 'getTargetColors should be a constant'
+ );
+ }
+ },
+ {
+ name: 'Arc trip data. with colorField and sizeField',
+ layer: {
+ config: {
+ dataId,
+ label: 'trip arcs',
+ columns,
+ color: [10, 10, 10],
+ // color by types(string)
+ colorField: {
+ type: 'string',
+ name: 'types'
+ },
+ // size by trip_distance(real)
+ sizeField: {
+ type: 'real',
+ name: 'trip_distance'
+ },
+ visConfig: {
+ colorRange: {
+ colors: ['#010101', '#020202', '#030303']
+ },
+ sizeRange: [10, 20]
+ }
+ },
+ type: 'arc',
+ id: 'test_layer_1'
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData} = result;
+ const expectedLayerData = {
+ data: [
+ {
+ data: testRows[0],
+ index: 0,
+ sourcePosition: [testRows[0][2], testRows[0][1], 0],
+ targetPosition: [testRows[0][4], testRows[0][3], 0]
+ },
+ {
+ data: testRows[4],
+ index: 4,
+ sourcePosition: [testRows[4][2], testRows[4][1], 0],
+ targetPosition: [testRows[4][4], testRows[4][3], 0]
+ }
+ ],
+ getFilterValue: () => {},
+ getSourceColor: () => {},
+ getTargetColor: () => {},
+ getWidth: () => {}
+ };
+ const expectedDataKeys = Object.keys(expectedLayerData).sort();
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ expectedDataKeys,
+ 'layerData should have 6 keys'
+ );
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct arc layerData data'
+ );
+ // getSourceColor
+ // domain: ['driver_analytics', 'driver_analytics_0', 'driver_gps']
+ // range ['#010101', '#020202', '#030303']
+ t.deepEqual(
+ layerData.data.map(layerData.getSourceColor),
+ [[2, 2, 2], [1, 1, 1]],
+ 'getSourceColor should be correct'
+ );
+ // getTargetColor
+ // domain: ['driver_analytics', 'driver_analytics_0', 'driver_gps']
+ // range ['#010101', '#020202', '#030303']
+ t.deepEqual(
+ layerData.data.map(layerData.getTargetColor),
+ [[2, 2, 2], [1, 1, 1]],
+ 'getTargetColors be correct'
+ );
+ // getWidth
+ // domain: [1.59, 11]
+ // range: [10, 20]
+ // value [1.59, 2.37]
+ t.deepEqual(
+ layerData.data.map(layerData.getWidth),
+ [10, (2.37 - 1.59) * (10 / 9.41) + 10],
+ 'getWidth should be a constant'
+ );
+ // getFilterValue
+ t.deepEqual(
+ layerData.data.map(layerData.getFilterValue),
+ [
+ [Number.MIN_SAFE_INTEGER, 0, 0, 0],
+ [moment.utc(testRows[4][0]).valueOf() - preparedFilterDomain0, 0, 0, 0],
+ ],
+ 'getFilterValue should return [value, 0, 0, 0]'
+ );
+ }
+ }
+ ];
+
+ testFormatLayerDataCases(t, ArcLayer, TEST_CASES);
+ t.end();
+});
+
+test('#ArcLayer -> renderLayer', t => {
+ const filteredIndex = [0, 2, 4];
+
+ const TEST_CASES = [
+ {
+ name: 'Arc render layer.1',
+ layer: {
+ config: {
+ dataId,
+ label: 'trip arcs',
+ columns,
+ color: [10, 10, 10]
+ },
+ type: 'arc',
+ id: 'test_layer_0'
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: (deckLayers, layer) => {
+ t.equal(deckLayers.length, 1, 'Should create 1 deck.gl layer');
+ const {props} = deckLayers[0];
+
+ const expectedProps = {
+ opacity: layer.config.visConfig.opacity,
+ widthScale: layer.config.visConfig.thickness,
+ filterRange: preparedDataset.gpuFilter.filterRange
+ }
+ Object.keys(expectedProps).forEach(key => {
+ t.equal(
+ props[key],
+ expectedProps[key],
+ `should have correct props.${key}`
+ );
+ });
+ }
+ },
+ {
+ name: 'Arc render layer.2 brushing',
+ layer: {
+ config: {
+ dataId,
+ label: 'trip arcs',
+ columns,
+ color: [10, 10, 10]
+ },
+ type: 'arc',
+ id: 'test_layer_0'
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ renderArgs: {
+ interactionConfig: {
+ brush: {
+ enabled: true,
+ config: {
+ size: 2.5
+ }
+ }
+ }
+ },
+ assert: (deckLayers, layer) => {
+ t.equal(deckLayers.length, 1, 'Should create 1 deck.gl layer');
+ const {props} = deckLayers[0];
+ // test instancePositions
+ const expectedProps = {
+ brushingRadius: 2500,
+ brushingEnabled: true,
+ brushingTarget: 'source_target'
+ }
+ Object.keys(expectedProps).forEach(key => {
+ t.equal(
+ props[key],
+ expectedProps[key],
+ `should have correct props.${key}`
+ );
+ });
+ }
+ }
+ ];
+
+ testRenderLayerCases(t, ArcLayer, TEST_CASES);
+ t.end();
+});
diff --git a/test/node/layer-tests/base-layer-sepcs.js b/test/browser/layer-tests/base-layer-sepcs.js
similarity index 88%
rename from test/node/layer-tests/base-layer-sepcs.js
rename to test/browser/layer-tests/base-layer-sepcs.js
index 36a379e33..4e75801c2 100644
--- a/test/node/layer-tests/base-layer-sepcs.js
+++ b/test/browser/layer-tests/base-layer-sepcs.js
@@ -22,6 +22,7 @@ import test from 'tape-catch';
import {Layer} from 'layers';
import AggregationLayer from 'layers/aggregation-layer';
+/* Fixed in #618
test('#BaseLayer -> updateLayerDomain', t => {
const allData = [['a', 3], ['b', 4], ['c', 1], ['d', null], ['e', 5], ['f', 0]];
@@ -29,7 +30,7 @@ test('#BaseLayer -> updateLayerDomain', t => {
const filteredIndex = [0, 1, 2, 3];
const filteredIndexForDomain = [0, 1, 2, 3, 4];
- const mockLayer = new Layer();
+ const mockLayer = new Layer({dataId: 'test'});
mockLayer.updateLayerConfig({
colorField: {
@@ -44,10 +45,12 @@ test('#BaseLayer -> updateLayerDomain', t => {
const expectedDomain = [1, 3, 4, 5];
let updatedLayer = mockLayer.updateLayerDomain({
- data,
- allData,
- filteredIndex,
- filteredIndexForDomain
+ test: {
+ data,
+ allData,
+ filteredIndex,
+ filteredIndexForDomain
+ }
});
t.deepEqual(updatedLayer.config.colorDomain, expectedDomain,
@@ -68,10 +71,12 @@ test('#BaseLayer -> updateLayerDomain', t => {
});
updatedLayer = mockLayer.updateLayerDomain({
- data,
- allData,
- filteredIndex,
- filteredIndexForDomain
+ test: {
+ data,
+ allData,
+ filteredIndex,
+ filteredIndexForDomain
+ }
});
const expectedOrdinalDomain = ['a', 'b', 'c', 'd', 'e', 'f'];
@@ -86,17 +91,17 @@ test('#BaseLayer -> updateLayerDomain', t => {
filteredIndexForDomain
};
- updatedLayer = mockLayer.updateLayerDomain(newDataset, {id: 'newFilter'});
+ updatedLayer = mockLayer.updateLayerDomain({test: newDataset}, {id: 'newFilter'});
t.deepEqual(updatedLayer.config.colorDomain, expectedOrdinalDomain,
'should skip domain calculation if field is oridinal');
t.end();
});
-
+*/
test('#AggregationLayer -> updateLayerDomain', t => {
const data = [['a', 3], ['b', 4], ['c', 1], ['d', null]];
- const mockLayer = new AggregationLayer();
+ const mockLayer = new AggregationLayer({dataId: 'test'});
mockLayer.updateLayerConfig({
colorField: {
@@ -109,7 +114,7 @@ test('#AggregationLayer -> updateLayerDomain', t => {
sizeDomain: [0, 1]
});
- const updatedLayer = mockLayer.updateLayerDomain({data, allData: data});
+ const updatedLayer = mockLayer.updateLayerDomain({test: {data, allData: data}});
t.deepEqual(updatedLayer.config.colorDomain, [0, 1],
'should not calculate aggregation layer domain');
diff --git a/test/browser/layer-tests/cluster-layer-specs.js b/test/browser/layer-tests/cluster-layer-specs.js
new file mode 100644
index 000000000..c376ee6de
--- /dev/null
+++ b/test/browser/layer-tests/cluster-layer-specs.js
@@ -0,0 +1,382 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import test from 'tape';
+import sinon from 'sinon';
+
+import {
+ testCreateCases,
+ testFormatLayerDataCases,
+ testRenderLayerCases,
+ preparedDataset,
+ dataId,
+ testRows,
+ pointLayerMeta
+} from 'test/helpers/layer-utils';
+
+import {KeplerGlLayers} from 'layers';
+import {INITIAL_MAP_STATE} from 'reducers/map-state-updaters';
+
+const {ClusterLayer} = KeplerGlLayers;
+
+const columns = {
+ lat: 'lat',
+ lng: 'lng'
+};
+
+test('#ClusterLayer -> constructor', t => {
+ const TEST_CASES = {
+ CREATE: [
+ {
+ props: {
+ dataId: 'taro',
+ isVisible: true,
+ label: 'test cluster layer'
+ },
+ test: layer => {
+ t.ok(
+ layer.config.dataId === 'taro',
+ 'clusterLayer dataId should be correct'
+ );
+ t.ok(layer.type === 'cluster', 'type should be cluster');
+ t.ok(layer.isAggregated === true, 'clusterLayer is aggregated');
+ t.ok(
+ layer.config.label === 'test cluster layer',
+ 'label should be correct'
+ );
+ t.ok(
+ Object.keys(layer.columnPairs).length,
+ 'should have columnPairs'
+ );
+ }
+ }
+ ]
+ };
+
+ testCreateCases(t, ClusterLayer, TEST_CASES.CREATE);
+ t.end();
+});
+
+test('#ClusterLayer -> formatLayerData', t => {
+ const filteredIndex = [0, 1, 2, 4, 5, 7];
+
+ const TEST_CASES = [
+ {
+ name: 'Cluster gps point.1',
+ layer: {
+ type: 'cluster',
+ id: 'test_layer_1',
+ config: {
+ dataId,
+ label: 'some geometry file',
+ columns,
+ color: [1, 2, 3]
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+ const expectedLayerData = {
+ data: [0, 1, 4, 5, 7].map(index => ({
+ data: testRows[index],
+ index
+ })),
+ _filterData: () => {},
+ getColorValue: () => {},
+ getElevationValue: () => {},
+ getPosition: () => {}
+ };
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ Object.keys(expectedLayerData).sort(),
+ 'layerData should have 4 keys'
+ );
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct grid layerData'
+ );
+ // test getPosition
+ t.deepEqual(
+ layerData.getPosition(layerData.data[0]),
+ [testRows[0][2], testRows[0][1]],
+ 'getPosition should return correct position'
+ );
+ // test getColorValue [1474071095000, 1474071608000]
+ // 0: Null - 0
+ // 1: 2016-09-17 00:10:56 1474071056000 - 0
+ // 4: 2016-09-17 00:14:00 1474071240000 - 1
+ // 5: 2016-09-17 00:15:01 1474071301000 - 1
+ // 7: 2016-09-17 00:17:05 1474071425000 - 1
+ t.equal(
+ // assume all points fall into one bin
+ layerData.getColorValue(expectedLayerData.data),
+ 5,
+ 'should return unfiltered point count'
+ );
+ t.equal(
+ // assume all points fall into one bin
+ layerData.getElevationValue(expectedLayerData.data),
+ 5,
+ 'should return unfiltered point count'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData._filterData),
+ [false, false, true, true, true],
+ '_filterData should filter data correctly'
+ );
+ // test layer.meta
+ t.deepEqual(
+ layer.meta,
+ pointLayerMeta,
+ 'should format correct grid layer meta'
+ );
+ }
+ },
+ {
+ name: 'Cluster gps point.2',
+ layer: {
+ type: 'cluster',
+ id: 'test_layer_2',
+ config: {
+ dataId,
+ label: 'some geometry file',
+ columns,
+ color: [1, 2, 3],
+ // color by types(string)
+ colorField: {
+ type: 'string',
+ name: 'types'
+ },
+ // size by id(integer)
+ sizeField: {
+ type: 'real',
+ name: 'trip_distance'
+ }
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData} = result;
+ const expectedLayerData = {
+ data: [0, 1, 4, 5, 7].map(index => ({
+ data: testRows[index],
+ index
+ })),
+ _filterData: () => {},
+ getColorValue: () => {},
+ getElevationValue: () => {},
+ getPosition: () => {}
+ };
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ Object.keys(expectedLayerData).sort(),
+ 'layerData should have 4 keys'
+ );
+ // test getColorValue aggregate by mode
+ // 0: driver_analytics_0 - 0
+ // 1: null - 0
+ // 4: driver_analytics - 1
+ // 5: driver_analytics - 1
+ // 7: driver_analytics - 1
+ t.equal(
+ // assume all points fall into one bin
+ layerData.getColorValue(expectedLayerData.data),
+ 'driver_analytics',
+ 'should return filtered mode of (types)'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData._filterData),
+ [false, false, true, true, true],
+ '_filterData should filter data correctly'
+ );
+ }
+ }
+ ];
+
+ testFormatLayerDataCases(t, ClusterLayer, TEST_CASES);
+ t.end();
+});
+
+test('#ClusterLayer -> renderLayer', t => {
+ const filteredIndex = [0, 1, 2, 4, 5, 7];
+ const spyLayerCallbacks = sinon.spy();
+
+ // 0 2016-09-17 00:09:55: 1474070995000 - false
+ // 1 2016-09-17 00:10:56: 1474071056000 - false
+ // 2 2016-09-17 00:11:56: 1474071116000 - true
+ // 4 2016-09-17 00:14:00: 1474071240000 - true
+ // 5 2016-09-17 00:15:01: 1474071301000 - true
+ // 7 2016-09-17 00:17:05: 1474071425000 - true
+
+ // timeFilter [1474071095000, 1474071608000]
+ const TEST_CASES = [
+ {
+ name: 'Cluster gps point.1',
+ layer: {
+ type: 'cluster',
+ id: 'test_layer_1',
+ config: {
+ dataId,
+ label: 'some geometry file',
+ columns,
+ color: [1, 2, 3],
+ visConfig: {
+ worldUnitSize: 20,
+ colorRange: {
+ colors: ['#080808', '#090909', '#070707']
+ }
+ }
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ renderArgs: {
+ layerCallbacks: {
+ onSetLayerDomain: spyLayerCallbacks
+ }
+ },
+ assert: (deckLayers, layer) => {
+ t.deepEqual(
+ deckLayers.map(l => l.id),
+ ['test_layer_1', 'test_layer_1-cluster'],
+ 'Should create 2 deck.gl layers'
+ );
+ const [clusterLayer, scatterplotLayer] = deckLayers;
+ const {props} = clusterLayer;
+ const scatterplotLayerProp = scatterplotLayer.props;
+
+ const expectedProps = {
+ colorRange: [
+ [8, 8, 8],
+ [9, 9, 9],
+ [7, 7, 7]
+ ],
+ radiusScale: 1,
+ radiusRange: layer.config.visConfig.radiusRange,
+ clusterRadius: layer.config.visConfig.clusterRadius,
+ colorScaleType: layer.config.colorScale,
+ zoom: Math.round(INITIAL_MAP_STATE.zoom),
+ width: INITIAL_MAP_STATE.width,
+ height: INITIAL_MAP_STATE.height
+ };
+
+ Object.keys(expectedProps).forEach(key => {
+ t.deepEqual(
+ props[key],
+ expectedProps[key],
+ `should have correct props.${key}`
+ );
+ });
+
+ const expectedScatterplotData = [
+ {
+ points: [
+ {
+ index: 4,
+ data: preparedDataset.allData[4]
+ }
+ ],
+ position: [-122.136795, 37.456535],
+ index: 0,
+ filteredPoints: null
+ },
+ {
+ points: [
+ {
+ index: 5,
+ data: preparedDataset.allData[5]
+ }
+ ],
+ position: [-122.10239, 37.40066],
+ index: 1,
+ filteredPoints: null
+ },
+ {
+ points: [
+ {
+ index: 7,
+ data: preparedDataset.allData[7]
+ }
+ ],
+ position: [-122.26108, 37.879066],
+ index: 2,
+ filteredPoints: null
+ }
+ ];
+ const expectedColorBins = [
+ {i: 0, value: 1, counts: 1},
+ {i: 1, value: 1, counts: 1},
+ {i: 2, value: 1, counts: 1}
+ ];
+
+ t.deepEqual(
+ scatterplotLayerProp.data,
+ expectedScatterplotData,
+ 'should pass correct data to cluster layer'
+ );
+ t.deepEqual(
+ spyLayerCallbacks.args[0][0],
+ [1, 1, 1],
+ 'should call onSetLayerDomain with correct domain'
+ );
+
+ // fillColor
+ t.deepEqual(
+ clusterLayer.state.aggregatorState.dimensions.fillColor.sortedBins
+ .sortedBins,
+ expectedColorBins,
+ 'should create correct color bins sortedBins'
+ );
+ t.deepEqual(
+ clusterLayer.state.aggregatorState.dimensions.fillColor.valueDomain,
+ [1, 1, 1],
+ 'should create correct radius valueDomain based on filteredPoints'
+ );
+
+ // radius
+ t.deepEqual(
+ clusterLayer.state.aggregatorState.dimensions.radius.valueDomain,
+ [0, 1],
+ 'should create correct radius valueDomain based on filteredPoints'
+ );
+ }
+ }
+ ];
+
+ testRenderLayerCases(t, ClusterLayer, TEST_CASES);
+ t.end();
+});
diff --git a/test/browser/layer-tests/geojson-layer-specs.js b/test/browser/layer-tests/geojson-layer-specs.js
new file mode 100644
index 000000000..a845c0bdb
--- /dev/null
+++ b/test/browser/layer-tests/geojson-layer-specs.js
@@ -0,0 +1,632 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import test from 'tape';
+import GeojsonLayer, {
+ defaultElevation,
+ defaultLineWidth,
+ defaultRadius
+} from 'layers/geojson-layer/geojson-layer';
+
+import {
+ updatedLayerSimplifiedShape,
+ updatedLayerV2
+} from 'test/fixtures/test-csv-data';
+import {
+ dataId,
+ preparedGeoDataset,
+ testCreateCases,
+ testFormatLayerDataCases,
+ testRenderLayerCases,
+ prepareGeojsonDataset,
+ geoFilterDomain0,
+ geojsonFilterDomain0
+} from 'test/helpers/layer-utils';
+import {
+ updatedGeoJsonLayer,
+ geoJsonWithStyle,
+ geoStyleDataToFeature,
+ geoStyleMeta
+} from 'test/fixtures/geojson';
+import {createNewDataEntry} from 'utils/dataset-utils';
+import {processGeojson} from 'processors/data-processor';
+
+test('#GeojsonLayer -> constructor', t => {
+ const TEST_CASES = {
+ CREATE: [
+ {
+ props: {
+ dataId: 'smoothie',
+ isVisible: true,
+ label: 'test geojson layer'
+ },
+ test: layer => {
+ t.ok(
+ layer.config.dataId === 'smoothie',
+ 'geojsonLayer dataId should be correct'
+ );
+ t.ok(layer.type === 'geojson', 'type should be geojson');
+ t.ok(layer.isAggregated === false, 'geojsonLayer is not aggregated');
+ }
+ }
+ ]
+ };
+
+ testCreateCases(t, GeojsonLayer, TEST_CASES.CREATE);
+ t.end();
+});
+
+test('#GeojsonLayer -> formatLayerData', t => {
+ const filteredIndex = [0, 2, 4];
+
+ const TEST_CASES = [
+ {
+ name: 'Geojson wkt polygon.1',
+ layer: {
+ type: 'geojson',
+ id: 'test_geojson_layer_1',
+ config: {
+ color: [1, 2, 3],
+ dataId,
+ label: 'some geometry file',
+ columns: {
+ geojson: 'simplified_shape_v2'
+ }
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedGeoDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+ const expectedLayerData = {
+ data: [
+ updatedLayerV2.dataToFeature[2],
+ updatedLayerV2.dataToFeature[4]
+ ]
+ };
+ const expectedDataKeys = [
+ 'data',
+ 'getElevation',
+ 'getFillColor',
+ 'getFilterValue',
+ 'getLineColor',
+ 'getLineWidth',
+ 'getRadius'
+ ];
+ const expectedLayerMeta = updatedLayerV2.meta;
+ const expectedDataToFeature = updatedLayerV2.dataToFeature;
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ expectedDataKeys,
+ 'layerData should have 7 keys'
+ );
+ // data
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct geojson layerData'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getElevation),
+ [defaultElevation, defaultElevation],
+ 'getElevation should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getFillColor),
+ [[1, 2, 3], [1, 2, 3]],
+ 'getFillColor should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getFilterValue),
+ [
+ [Number.MIN_SAFE_INTEGER, 0, 0, 0],
+ [11.8 - geoFilterDomain0, 0, 0, 0]
+ ],
+ 'getFilterValue should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getLineColor),
+ [[1, 2, 3], [1, 2, 3]],
+ 'getLineColor should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getLineWidth),
+ [defaultLineWidth, defaultLineWidth],
+ 'getLineWidth should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getRadius),
+ [defaultRadius, defaultRadius],
+ 'getRadius should return correct value'
+ );
+ // meta
+ t.deepEqual(
+ layer.meta,
+ expectedLayerMeta,
+ 'should format correct geojson layer meta'
+ );
+ // dataToFeature
+ t.equal(
+ layer.dataToFeature.length,
+ expectedDataToFeature.length,
+ 'should format correct geojson dataToFeature length'
+ );
+
+ layer.dataToFeature.forEach((feature, i) => {
+ t.deepEqual(
+ feature,
+ expectedDataToFeature[i],
+ `should format correct geojson dataToFeature[${i}]`
+ );
+ });
+ }
+ },
+ {
+ name: 'Geojson wkt polygon.2',
+ layer: {
+ type: 'geojson',
+ id: 'test_geojson_layer_2',
+ config: {
+ dataId,
+ label: 'some geometry file',
+ columns: {
+ geojson: 'simplified_shape'
+ },
+ visConfig: {
+ stroked: true,
+ enable3d: true,
+ colorRange: {
+ colors: ['#010101', '#020202', '#030303']
+ },
+ strokeColorRange: {
+ colors: ['#040404', '#050505', '#060606']
+ }
+ },
+ // color by c_zip_type(string)
+ colorField: preparedGeoDataset.fields.find(
+ f => f.name === 'c_zip_type'
+ ),
+ strokeColorField: preparedGeoDataset.fields.find(
+ f => f.name === 'c_zip_type'
+ ),
+
+ // stroke by c_number(real)
+ sizeField: preparedGeoDataset.fields.find(f => f.name === 'c_number'),
+ // stroke by a_zip(int)
+ heightField: preparedGeoDataset.fields.find(f => f.name === 'a_zip')
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedGeoDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+ const expectedLayerData = {
+ data: [
+ updatedLayerV2.dataToFeature[2],
+ updatedLayerV2.dataToFeature[4]
+ ]
+ };
+ const expectedDataKeys = [
+ 'data',
+ 'getElevation',
+ 'getFillColor',
+ 'getFilterValue',
+ 'getLineColor',
+ 'getLineWidth',
+ 'getRadius'
+ ];
+ const expectedLayerMeta = updatedLayerV2.meta;
+ const expectedDataToFeature = updatedLayerV2.dataToFeature;
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ expectedDataKeys,
+ 'layerData should have 7 keys'
+ );
+ // data
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct geojson layerData'
+ );
+ t.deepEqual(
+ // by a_zip
+ // domain [7014, 7416]
+ // [7016, 7029] -> [0, 500]
+ layerData.data.map(layerData.getElevation),
+ [(2 / 402) * 500, (15 / 402) * 500],
+ 'getElevation should return correct value'
+ );
+ t.deepEqual(
+ // by c_zip_type
+ // 'C_Medium_High' null 'A_Low_Rural',
+ layerData.data.map(layerData.getFillColor),
+ [[2, 2, 2], [2, 2, 2]],
+ 'getFillColor should return correct value'
+ );
+
+ t.deepEqual(
+ // by m_rate
+ // 7.5 null 10
+ layerData.data.map(layerData.getFilterValue),
+ [
+ [Number.MIN_SAFE_INTEGER, 0, 0, 0],
+ [11.8 - geoFilterDomain0, 0, 0, 0]
+ ],
+ 'getFilterValue should return correct value'
+ );
+ t.deepEqual(
+ // by c_zip_type
+ // 'C_Medium_High' null 'A_Low_Rural',
+ layerData.data.map(layerData.getLineColor),
+ [[5, 5, 5], [5, 5, 5]],
+ 'getLineColor should return correct value'
+ );
+ t.deepEqual(
+ // c_number
+ // domain [13.8, 29.2]
+ // range [0, 10]
+ // 27.6, 39.1 -> [0, 10]
+ layerData.data.map(layerData.getLineWidth),
+ [8.961038961038962, 16.42857142857143],
+ 'getLineWidth should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getRadius),
+ [1, 1],
+ 'getRadius should return correct value'
+ );
+ // meta
+ t.deepEqual(
+ layer.meta,
+ expectedLayerMeta,
+ 'should format correct geojson layerData'
+ );
+ // dataToFeature
+ t.deepEqual(
+ layer.dataToFeature,
+ expectedDataToFeature,
+ 'should format correct geojson layerData'
+ );
+ }
+ },
+ {
+ name: 'Geojson wkt polygon.3',
+ layer: {
+ type: 'geojson',
+ id: 'test_geojson_layer_3',
+ config: {
+ dataId,
+ label: 'some geometry file',
+ columns: {
+ geojson: '_geojson'
+ },
+ color: [5, 5, 5]
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...prepareGeojsonDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+
+ const expectedLayerData = {
+ data: [
+ updatedGeoJsonLayer.dataToFeature[0],
+ updatedGeoJsonLayer.dataToFeature[2],
+ updatedGeoJsonLayer.dataToFeature[4]
+ ]
+ };
+ const expectedDataKeys = [
+ 'data',
+ 'getElevation',
+ 'getFillColor',
+ 'getFilterValue',
+ 'getLineColor',
+ 'getLineWidth',
+ 'getRadius'
+ ];
+ const expectedLayerMeta = updatedGeoJsonLayer.meta;
+ const expectedDataToFeature = updatedGeoJsonLayer.dataToFeature;
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ expectedDataKeys,
+ 'layerData should have 7 keys'
+ );
+ // // data
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct geojson layerData'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getElevation),
+ [defaultElevation, defaultElevation, defaultElevation],
+ 'getElevation should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getFillColor),
+ [[5, 5, 5], [5, 5, 5], [5, 5, 5]],
+ 'getFillColor should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getFilterValue),
+ [
+ [11 - geojsonFilterDomain0, 0, 0, 0],
+ [20 - geojsonFilterDomain0, 0, 0, 0],
+ [Number.MIN_SAFE_INTEGER, 0, 0, 0]
+ ],
+ 'getFilterValue should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getLineColor),
+ [[5, 5, 5], [5, 5, 5], [5, 5, 5]],
+ 'getLineColor should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getLineWidth),
+ [1, 1, 1],
+ 'getLineWidth should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getRadius),
+ [defaultLineWidth, defaultLineWidth, defaultLineWidth],
+ 'getRadius should return correct value'
+ );
+
+ // meta
+ t.deepEqual(
+ layer.meta,
+ expectedLayerMeta,
+ 'should format correct geojson layer meta'
+ );
+ // dataToFeature
+ t.deepEqual(
+ layer.dataToFeature,
+ expectedDataToFeature,
+ 'should format correct geojson layer dataToFeature'
+ );
+ }
+ },
+ // test case 3
+ {
+ name: 'Geojson with style properties',
+ layer: {
+ type: 'geojson',
+ id: 'test_geojson_layer_4',
+ config: {
+ dataId,
+ label: 'some geometry file',
+ columns: {
+ geojson: '_geojson'
+ },
+ color: [5, 5, 5]
+ }
+ },
+ datasets: createNewDataEntry({
+ info: {id: dataId},
+ data: processGeojson(geoJsonWithStyle)
+ }),
+ assert: result => {
+ const {layerData, layer} = result;
+
+ const expectedLayerData = {
+ data: geoStyleDataToFeature
+ };
+ const expectedDataKeys = [
+ 'data',
+ 'getElevation',
+ 'getFillColor',
+ 'getFilterValue',
+ 'getLineColor',
+ 'getLineWidth',
+ 'getRadius'
+ ];
+ const expectedLayerMeta = geoStyleMeta;
+
+ const expectedDataToFeature = geoStyleDataToFeature;
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ expectedDataKeys,
+ 'layerData should have 7 keys'
+ );
+ // // data
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct geojson layerData'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getElevation),
+ [10, 10, 10],
+ 'getElevation should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getFillColor),
+ [[1, 2, 3], [7, 8, 9], [1, 2, 3]],
+ 'getFillColor should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getFilterValue),
+ [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]],
+ 'getFilterValue should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getLineColor),
+ [[4, 5, 6], [4, 5, 6], [4, 5, 6]],
+ 'getLineColor should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getLineWidth),
+ [1, 3, 4],
+ 'getLineWidth should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getRadius),
+ [5, 5, 5],
+ 'getRadius should return correct value'
+ );
+
+ // meta
+ t.deepEqual(
+ layer.meta,
+ expectedLayerMeta,
+ 'should format correct geojson layer meta'
+ );
+ // dataToFeature
+ t.deepEqual(
+ layer.dataToFeature,
+ expectedDataToFeature,
+ 'should format correct geojson layer dataToFeature'
+ );
+ }
+ }
+ ];
+
+ testFormatLayerDataCases(t, GeojsonLayer, TEST_CASES);
+ t.end();
+});
+
+test('#GeojsonLayer -> renderLayer', t => {
+ const filteredIndex = [0, 2, 4];
+ const TEST_CASES = [
+ {
+ name: 'Test render geojson.1',
+ layer: {
+ id: 'test_layer_1',
+ type: 'geojson',
+ config: {
+ dataId,
+ color: [1, 2, 3],
+ label: 'gps point',
+ columns: {
+ geojson: '_geojson'
+ },
+ visConfig: {
+ strokeColor: [4, 5, 6]
+ }
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...prepareGeojsonDataset,
+ filteredIndex
+ }
+ },
+ assert: deckLayers => {
+ const ids = [
+ 'test_layer_1',
+ 'test_layer_1-polygons-fill',
+ 'test_layer_1-polygons-stroke'
+ ];
+ t.deepEqual(
+ deckLayers.map(l => l.id),
+ ids,
+ 'Should render 3 deck layers'
+ );
+ // polygon fill attributes;
+ const {attributes} = deckLayers[1].state.attributeManager;
+ const indices = attributes.indices.value;
+
+ // test instanceFilterValues
+ const expectedFilterValues = new Float32Array([
+ 11 - geojsonFilterDomain0,
+ 0,
+ 0,
+ 0, // 0
+ 11 - geojsonFilterDomain0,
+ 0,
+ 0,
+ 0, // 4
+ 11 - geojsonFilterDomain0,
+ 0,
+ 0,
+ 0, // 8
+ 11 - geojsonFilterDomain0,
+ 0,
+ 0,
+ 0, // 12
+ 11 - geojsonFilterDomain0,
+ 0,
+ 0,
+ 0, // 16
+ 11 - geojsonFilterDomain0,
+ 0,
+ 0,
+ 0, // 20
+ 20 - geojsonFilterDomain0,
+ 0,
+ 0,
+ 0, // 24
+ 20 - geojsonFilterDomain0,
+ 0,
+ 0,
+ 0, // 28
+ 20 - geojsonFilterDomain0,
+ 0,
+ 0,
+ 0, // 32
+ 20 - geojsonFilterDomain0,
+ 0,
+ 0,
+ 0, // 36
+ Number.MIN_SAFE_INTEGER,
+ 0,
+ 0,
+ 0, // 40
+ Number.MIN_SAFE_INTEGER,
+ 0,
+ 0,
+ 0, // 44
+ Number.MIN_SAFE_INTEGER,
+ 0,
+ 0,
+ 0, // 48
+ Number.MIN_SAFE_INTEGER,
+ 0,
+ 0,
+ 0 // 52
+ ]);
+ t.deepEqual(
+ attributes.filterValues.value.slice(0, (indices.length - 1) * 4),
+ expectedFilterValues,
+ 'Should have correct filterValues'
+ );
+ }
+ }
+ ];
+
+ testRenderLayerCases(t, GeojsonLayer, TEST_CASES);
+ t.end();
+});
diff --git a/test/browser/layer-tests/grid-layer-specs.js b/test/browser/layer-tests/grid-layer-specs.js
new file mode 100644
index 000000000..5df717581
--- /dev/null
+++ b/test/browser/layer-tests/grid-layer-specs.js
@@ -0,0 +1,439 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import test from 'tape';
+import sinon from 'sinon';
+
+import {
+ testCreateCases,
+ testFormatLayerDataCases,
+ testRenderLayerCases,
+ preparedDataset,
+ dataId,
+ testRows,
+ pointLayerMeta
+} from 'test/helpers/layer-utils';
+
+import GridLayer from 'layers/grid-layer/grid-layer';
+import {pointToPolygonGeo} from 'layers/grid-layer/grid-utils';
+import {INITIAL_MAP_STATE} from 'reducers/map-state-updaters';
+
+const columns = {
+ lat: 'lat',
+ lng: 'lng'
+};
+
+test('#GridLayer -> constructor', t => {
+ const TEST_CASES = {
+ CREATE: [
+ {
+ props: {
+ dataId: 'taro',
+ isVisible: true,
+ label: 'test grid layer'
+ },
+ test: layer => {
+ t.ok(
+ layer.config.dataId === 'taro',
+ 'gridLayer dataId should be correct'
+ );
+ t.ok(layer.type === 'grid', 'type should be grid');
+ t.ok(layer.isAggregated === true, 'gridLayer is aggregated');
+ t.ok(
+ layer.config.label === 'test grid layer',
+ 'label should be correct'
+ );
+ t.ok(
+ Object.keys(layer.columnPairs).length,
+ 'should have columnPairs'
+ );
+ }
+ }
+ ]
+ };
+
+ testCreateCases(t, GridLayer, TEST_CASES.CREATE);
+ t.end();
+});
+
+test('#GridLayer -> formatLayerData', t => {
+ const filteredIndex = [0, 1, 2, 4, 5, 7];
+
+ const TEST_CASES = [
+ {
+ name: 'Grid gps point.1',
+ layer: {
+ type: 'grid',
+ id: 'test_layer_1',
+ config: {
+ dataId,
+ label: 'some geometry file',
+ columns,
+ color: [1, 2, 3]
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+ const expectedLayerData = {
+ data: [0, 1, 4, 5, 7].map(index => ({
+ data: testRows[index],
+ index
+ })),
+ _filterData: () => {},
+ getColorValue: () => {},
+ getElevationValue: () => {},
+ getPosition: () => {}
+ };
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ Object.keys(expectedLayerData).sort(),
+ 'layerData should have 4 keys'
+ );
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct grid layerData'
+ );
+ // test getPosition
+ t.deepEqual(
+ layerData.getPosition(layerData.data[0]),
+ [testRows[0][2], testRows[0][1]],
+ 'getPosition should return correct position'
+ );
+ // test getColorValue [1474071095000, 1474071608000]
+ // 0: Null - 0
+ // 1: 2016-09-17 00:10:56 1474071056000 - 0
+ // 4: 2016-09-17 00:14:00 1474071240000 - 1
+ // 5: 2016-09-17 00:15:01 1474071301000 - 1
+ // 7: 2016-09-17 00:17:05 1474071425000 - 1
+ t.equal(
+ // assume all points fall into one bin
+ layerData.getColorValue(expectedLayerData.data),
+ 5,
+ 'should return unfiltered point count'
+ );
+ t.equal(
+ // assume all points fall into one bin
+ layerData.getElevationValue(expectedLayerData.data),
+ 5,
+ 'should return unfiltered point count'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData._filterData),
+ [false, false, true, true, true],
+ '_filterData should filter data correctly'
+ );
+ // test layer.meta
+ t.deepEqual(
+ layer.meta,
+ pointLayerMeta,
+ 'should format correct grid layer meta'
+ );
+ }
+ },
+ {
+ name: 'Grid gps point.2',
+ layer: {
+ type: 'grid',
+ id: 'test_layer_2',
+ config: {
+ dataId,
+ label: 'some geometry file',
+ columns,
+ color: [1, 2, 3],
+ // color by types(string)
+ colorField: {
+ type: 'string',
+ name: 'types'
+ },
+ // size by id(integer)
+ sizeField: {
+ type: 'real',
+ name: 'trip_distance'
+ }
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData} = result;
+ const expectedLayerData = {
+ data: [0, 1, 4, 5, 7].map(index => ({
+ data: testRows[index],
+ index
+ })),
+ _filterData: () => {},
+ getColorValue: () => {},
+ getElevationValue: () => {},
+ getPosition: () => {}
+ };
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ Object.keys(expectedLayerData).sort(),
+ 'layerData should have 4 keys'
+ );
+ // test getColorValue aggregate by mode
+ // 0: driver_analytics_0 - 0
+ // 1: null - 0
+ // 4: driver_analytics - 1
+ // 5: driver_analytics - 1
+ // 7: driver_analytics - 1
+ t.equal(
+ // assume all points fall into one bin
+ layerData.getColorValue(expectedLayerData.data),
+ 'driver_analytics',
+ 'should return filtered mode of (types)'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData._filterData),
+ [false, false, true, true, true],
+ '_filterData should filter data correctly'
+ );
+ // test getColorValue aggregate by avg
+ // 0: 1.59 - 0
+ // 1: 2.38 - 0
+ // 4: 2.37 - 1
+ // 5: 7.13 - 1
+ // 7: 11 - 1
+ t.equal(
+ // assume all points fall into one bin
+ layerData.getElevationValue(expectedLayerData.data),
+ (1.59 + 2.38 + 2.37 + 7.13 + 11) / 5,
+ 'should return filtered avg trip_distance'
+ );
+ }
+ }
+ ];
+
+ testFormatLayerDataCases(t, GridLayer, TEST_CASES);
+ t.end();
+});
+
+test('#GridLayer -> renderLayer', t => {
+ const filteredIndex = [0, 1, 2, 4, 5, 7];
+ const spyLayerCallbacks = sinon.spy();
+
+ const TEST_CASES = [
+ {
+ name: 'Grid gps point.1',
+ layer: {
+ type: 'grid',
+ id: 'test_layer_1',
+ config: {
+ dataId,
+ label: 'some geometry file',
+ columns,
+ color: [1, 2, 3],
+ visConfig: {
+ worldUnitSize: 20,
+ colorRange: {
+ colors: ['#080808', '#090909', '#070707']
+ }
+ }
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ renderArgs: {
+ layerCallbacks: {
+ onSetLayerDomain: spyLayerCallbacks
+ }
+ },
+ assert: (deckLayers, layer) => {
+ t.deepEqual(
+ deckLayers.map(l => l.id),
+ ['test_layer_1', 'test_layer_1-grid-cell'],
+ 'Should create 2 deck.gl layers'
+ );
+ const [cpuGridLayer, gridCellLayer] = deckLayers;
+ const {props} = cpuGridLayer;
+ const gridCellLayerProp = gridCellLayer.props;
+
+ const expectedProps = {
+ coverage: layer.config.visConfig.coverage,
+ cellSize: layer.config.visConfig.worldUnitSize * 1000,
+ colorRange: [
+ [8, 8, 8],
+ [9, 9, 9],
+ [7, 7, 7]
+ ],
+ colorScaleType: layer.config.colorScale,
+ elevationScaleType: layer.config.sizeScale,
+ elevationScale: layer.config.visConfig.elevationScale,
+ upperPercentile: layer.config.visConfig.percentile[1],
+ lowerPercentile: layer.config.visConfig.percentile[0]
+ };
+
+ Object.keys(expectedProps).forEach(key => {
+ t.deepEqual(
+ props[key],
+ expectedProps[key],
+ `should have correct props.${key}`
+ );
+ });
+
+ const expectedGridCellData = [
+ {
+ index: 0,
+ position: [-122.59661345873265, 37.743177277521255],
+ count: 2,
+ points: [
+ {
+ index: 0,
+ data: preparedDataset.allData[0]
+ },
+ {
+ index: 1,
+ data: preparedDataset.allData[1]
+ }
+ ],
+ filteredPoints: []
+ },
+ {
+ index: 1,
+ position: [-122.14283174694398, 37.38384344551697],
+ count: 2,
+ points: [
+ {
+ index: 4,
+ data: preparedDataset.allData[4]
+ },
+ {
+ index: 5,
+ data: preparedDataset.allData[5]
+ }
+ ],
+ filteredPoints: [
+ {
+ index: 4,
+ data: preparedDataset.allData[4]
+ },
+ {
+ index: 5,
+ data: preparedDataset.allData[5]
+ }
+ ]
+ },
+ {
+ index: 2,
+ position: [-122.36972260283831, 37.743177277521255],
+ count: 1,
+ points: [
+ {
+ index: 7,
+ data: preparedDataset.allData[7]
+ }
+ ],
+ filteredPoints: [
+ {
+ index: 7,
+ data: preparedDataset.allData[7]
+ }
+ ]
+ }
+ ];
+ const expectedColorBins = [
+ {i: 2, value: 1, counts: 1},
+ {i: 1, value: 2, counts: 2}
+ ];
+
+ const expectedElevationBins = [
+ {i: 2, value: 1, counts: 1},
+ {i: 1, value: 2, counts: 2}
+ ];
+
+ t.deepEqual(
+ gridCellLayerProp.data,
+ expectedGridCellData,
+ 'should pass correct data to grid cell layer'
+ );
+ t.deepEqual(
+ spyLayerCallbacks.args[0][0],
+ [1, 2],
+ 'should call onSetLayerDomain with correct domain'
+ );
+
+ t.deepEqual(
+ cpuGridLayer.state.aggregatorState.dimensions.fillColor.sortedBins
+ .sortedBins,
+ expectedColorBins,
+ 'should create correct color bins'
+ );
+
+ t.deepEqual(
+ cpuGridLayer.state.aggregatorState.dimensions.elevation.sortedBins
+ .sortedBins,
+ expectedElevationBins,
+ 'should create correct elevation bins'
+ );
+ }
+ }
+ ];
+
+ testRenderLayerCases(t, GridLayer, TEST_CASES);
+ t.end();
+});
+
+test('#GridLayer -> pointToPolygonGeo', t => {
+ const polygonGeo = pointToPolygonGeo({
+ object: {
+ position: [-122.39096, 37.769897]
+ },
+ cellSize: 20000,
+ coverage: 1,
+ properties: {
+ name: 'a'
+ },
+ mapState: INITIAL_MAP_STATE
+ });
+
+ const expected = {
+ geometry: {
+ coordinates: [
+ [-122.39095999999999, 37.769897000000014],
+ [-122.1634200224827, 37.769897000000014],
+ [-122.16286655375738, 37.94954323177784],
+ [-122.39095999999999, 37.94954323177784],
+ [-122.39095999999999, 37.769897000000014]
+ ],
+ type: 'LineString'
+ },
+ properties: {name: 'a'}
+ };
+
+ t.deepEqual(polygonGeo, expected, 'should create correct polygonGeo');
+ t.end();
+});
diff --git a/test/browser/layer-tests/h3-hexagon-layer-specs.js b/test/browser/layer-tests/h3-hexagon-layer-specs.js
new file mode 100644
index 000000000..e69de29bb
diff --git a/test/browser/layer-tests/heatmap-layer-specs.js b/test/browser/layer-tests/heatmap-layer-specs.js
new file mode 100644
index 000000000..551451ef9
--- /dev/null
+++ b/test/browser/layer-tests/heatmap-layer-specs.js
@@ -0,0 +1,215 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import test from 'tape';
+import {
+ testCreateCases,
+ testFormatLayerDataCases,
+ preparedDataset,
+ dataId,
+ pointLayerMeta
+} from 'test/helpers/layer-utils';
+
+import HeatmapLayer from 'layers/heatmap-layer/heatmap-layer';
+
+const columns = {
+ lat: 'lat',
+ lng: 'lng'
+};
+
+test('#HeatmapLayer -> contructor', t => {
+ const TEST_CASES = {
+ CREATE: [
+ {
+ props: {
+ dataId: 'taro',
+ isVisible: true,
+ label: 'test heatmap layer'
+ },
+ test: layer => {
+ // test constructor
+ t.equal(
+ layer.config.visConfig.radius,
+ 20,
+ 'Heatmap default radius should be 20'
+ );
+ t.ok(
+ layer.config.dataId === 'taro',
+ 'heatmaplayer dataId should be correct'
+ );
+ t.ok(layer.type === 'heatmap', 'type should be heatmap');
+ t.ok(layer.isAggregated === true, 'heatmaplayer is aggregated');
+ t.ok(
+ layer.config.label === 'test heatmap layer',
+ 'label should be correct'
+ );
+ t.ok(
+ Object.keys(layer.columnPairs).length,
+ 'should have columnPairs'
+ );
+ }
+ }
+ ]
+ };
+
+ testCreateCases(t, HeatmapLayer, TEST_CASES.CREATE);
+ t.end();
+});
+
+test('#Heatmaplayer -> formatLayerData', t => {
+ const filteredIndex = [0, 2, 4];
+
+ const expectedConfig = {
+ type: 'heatmap',
+ id: 'heatmap-test-1',
+ source: `${dataId}-1-2`,
+ layout: {visibility: 'visible'},
+ maxzoom: 18,
+ filter: [
+ 'all',
+ ['>=', 'gpu:utc_timestamp', 39000],
+ ['<=', 'gpu:utc_timestamp', 552000]
+ ],
+ paint: {
+ 'heatmap-weight': [
+ 'interpolate',
+ ['linear'],
+ ['get', 'id'],
+ 1,
+ 0,
+ 345,
+ 1
+ ],
+ 'heatmap-intensity': ['interpolate', ['linear'], ['zoom'], 0, 1, 18, 3],
+ 'heatmap-color': [
+ 'interpolate',
+ ['linear'],
+ ['heatmap-density'],
+ 0,
+ 'rgba(0,0,0,0)',
+ 0.14285714285714285,
+ 'rgb(90,24,70)',
+ 0.2857142857142857,
+ 'rgb(144,12,63)',
+ 0.42857142857142855,
+ 'rgb(199,0,57)',
+ 0.5714285714285714,
+ 'rgb(227,97,28)',
+ 0.7142857142857143,
+ 'rgb(241,146,14)',
+ 0.8571428571428571,
+ 'rgb(255,195,0)'
+ ],
+ 'heatmap-radius': ['interpolate', ['linear'], ['zoom'], 0, 2, 18, 20],
+ 'heatmap-opacity': 0.8
+ }
+ };
+
+ const TEST_CASES = [
+ {
+ name: 'Heatmap gps point.1',
+ layer: {
+ type: 'heatmap',
+ id: 'heatmap-test-1',
+ config: {
+ dataId,
+ label: 'mapbox heatmap',
+ isVisible: true,
+ columns,
+ weightField: {
+ type: 'integer',
+ name: 'id'
+ }
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+
+ const expectedLayerData = {
+ columns,
+ config: expectedConfig,
+ data: {
+ type: 'FeatureCollection',
+ features: [
+ {
+ type: 'Feature',
+ properties: {
+ index: 0,
+ 'gpu:utc_timestamp': Number.MIN_SAFE_INTEGER,
+ id: 1
+ },
+ geometry: {type: 'Point', coordinates: [-122.39096, 37.778564]}
+ },
+ {
+ type: 'Feature',
+ properties: {
+ index: 4,
+ 'gpu:utc_timestamp': 184000,
+ id: 5
+ },
+ geometry: {type: 'Point', coordinates: [-122.136795, 37.456535]}
+ }
+ ]
+ },
+ weightField: null,
+ getPosition: () => {}
+ };
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ Object.keys(expectedLayerData).sort(),
+ 'lheatmap ayerData should have correct keys'
+ );
+
+ // test data
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct heatmap layerData.data'
+ );
+
+ // test columns,
+ expectedLayerData.config.id = layer.id;
+ // test config
+ t.deepEqual(
+ layerData.config,
+ expectedLayerData.config,
+ 'should format correct heatmap layerData.config'
+ );
+
+ // test layer.meta
+ t.deepEqual(
+ layer.meta,
+ pointLayerMeta,
+ 'should format correct heatmap layer.meta'
+ );
+ }
+ }
+ ];
+
+ testFormatLayerDataCases(t, HeatmapLayer, TEST_CASES);
+ t.end();
+});
diff --git a/test/browser/layer-tests/hexagon-layer-specs.js b/test/browser/layer-tests/hexagon-layer-specs.js
new file mode 100644
index 000000000..0b0c8d030
--- /dev/null
+++ b/test/browser/layer-tests/hexagon-layer-specs.js
@@ -0,0 +1,401 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import test from 'tape';
+import sinon from 'sinon';
+
+import {
+ testCreateCases,
+ testFormatLayerDataCases,
+ testRenderLayerCases,
+ preparedDataset,
+ dataId,
+ testRows,
+ pointLayerMeta
+} from 'test/helpers/layer-utils';
+
+import HexagonLayer from 'layers/hexagon-layer/hexagon-layer';
+
+const columns = {
+ lat: 'lat',
+ lng: 'lng'
+};
+
+test('#HexagonLayer -> constructor', t => {
+ const TEST_CASES = {
+ CREATE: [
+ {
+ props: {
+ dataId: 'blue',
+ isVisible: true,
+ label: 'test hexagon layer'
+ },
+ test: layer => {
+ t.ok(
+ layer.config.dataId === 'blue',
+ 'HexagonLayer dataId should be correct'
+ );
+ t.ok(layer.type === 'hexagon', 'type should be hexagon');
+ t.ok(layer.isAggregated === true, 'HexagonLayer is aggregated');
+ t.ok(
+ layer.config.label === 'test hexagon layer',
+ 'label should be correct'
+ );
+ t.ok(
+ Object.keys(layer.columnPairs).length,
+ 'should have columnPairs'
+ );
+ }
+ }
+ ]
+ };
+
+ testCreateCases(t, HexagonLayer, TEST_CASES.CREATE);
+ t.end();
+});
+
+test('#HexagonLayer -> formatLayerData', t => {
+ const filteredIndex = [0, 1, 2, 4, 5, 7];
+
+ const TEST_CASES = [
+ {
+ name: 'hexagon layer gps point.1',
+ layer: {
+ type: 'hexagon',
+ id: 'test_layer_1',
+ config: {
+ dataId,
+ label: 'some geometry file',
+ columns,
+ color: [1, 2, 3]
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+ const expectedLayerData = {
+ data: [0, 1, 4, 5, 7].map(index => ({
+ data: testRows[index],
+ index
+ })),
+ _filterData: () => {},
+ getColorValue: () => {},
+ getElevationValue: () => {},
+ getPosition: () => {}
+ };
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ Object.keys(expectedLayerData).sort(),
+ 'layerData should have 4 keys'
+ );
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct hexagon layerData'
+ );
+ // test getPosition
+ t.deepEqual(
+ layerData.getPosition(layerData.data[0]),
+ [testRows[0][2], testRows[0][1]],
+ 'getPosition should return correct position'
+ );
+ // test getColorValue [1474071095000, 1474071608000]
+ // 0: Null - 0
+ // 1: 2016-09-17 00:10:56 1474071056000 - 0
+ // 4: 2016-09-17 00:14:00 1474071240000 - 1
+ // 5: 2016-09-17 00:15:01 1474071301000 - 1
+ // 7: 2016-09-17 00:17:05 1474071425000 - 1
+ t.equal(
+ // assume all points fall into one bin
+ layerData.getColorValue(expectedLayerData.data),
+ 5,
+ 'should return filtered point count'
+ );
+ t.equal(
+ // assume all points fall into one bin
+ layerData.getElevationValue(expectedLayerData.data),
+ 5,
+ 'should return filtered point count'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData._filterData),
+ [false, false, true, true, true],
+ '_filterData should filter data correctly'
+ );
+ // test layer.meta
+ t.deepEqual(
+ layer.meta,
+ pointLayerMeta,
+ 'should format correct hexagon layer meta'
+ );
+ }
+ },
+ {
+ name: 'Hexagon layer gps point.2',
+ layer: {
+ type: 'hexagon',
+ id: 'test_layer_2',
+ config: {
+ dataId,
+ label: 'some geometry file',
+ columns,
+ color: [1, 2, 3],
+ // color by types(string)
+ colorField: {
+ type: 'string',
+ name: 'types'
+ },
+ // size by id(integer)
+ sizeField: {
+ type: 'real',
+ name: 'trip_distance'
+ }
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData} = result;
+ const expectedLayerData = {
+ data: [0, 1, 4, 5, 7].map(index => ({
+ data: testRows[index],
+ index
+ })),
+ _filterData: () => {},
+ getColorValue: () => {},
+ getElevationValue: () => {},
+ getPosition: () => {}
+ };
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ Object.keys(expectedLayerData).sort(),
+ 'layerData should have 4 keys'
+ );
+ // test getColorValue aggregate by mode
+ // 0: driver_analytics_0 - 0
+ // 1: null - 0
+ // 4: driver_analytics - 1
+ // 5: driver_analytics - 1
+ // 7: driver_analytics - 1
+ t.equal(
+ // assume all points fall into one bin
+ layerData.getColorValue(expectedLayerData.data),
+ 'driver_analytics',
+ 'should return filtered mode of (types)'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData._filterData),
+ [false, false, true, true, true],
+ '_filterData should filter data correctly'
+ );
+ // test getColorValue aggregate by avg
+ // 0: 1.59 - 0
+ // 1: 2.38 - 0
+ // 4: 2.37 - 1
+ // 5: 7.13 - 1
+ // 7: 11 - 1
+ t.equal(
+ // assume all points fall into one bin
+ layerData.getElevationValue(expectedLayerData.data),
+ (1.59 + 2.38 + 2.37 + 7.13 + 11) / 5,
+ 'should return filtered avg trip_distance'
+ );
+ }
+ }
+ ];
+
+ testFormatLayerDataCases(t, HexagonLayer, TEST_CASES);
+ t.end();
+});
+
+test('#HexagonLayer -> renderLayer', t => {
+ const filteredIndex = [0, 1, 2, 4, 5, 7];
+ const spyLayerCallbacks = sinon.spy();
+ const {allData} = preparedDataset;
+
+ const TEST_CASES = [
+ {
+ name: 'Hexagon gps point.1',
+ layer: {
+ type: 'hexagon',
+ id: 'test_layer_1',
+ config: {
+ dataId,
+ label: 'some geometry file',
+ columns,
+ color: [1, 2, 3],
+ visConfig: {
+ worldUnitSize: 20,
+ colorRange: {
+ colors: ['#080808', '#090909', '#070707']
+ }
+ }
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ renderArgs: {
+ layerCallbacks: {
+ onSetLayerDomain: spyLayerCallbacks
+ }
+ },
+ assert: (deckLayers, layer) => {
+ t.deepEqual(
+ deckLayers.map(l => l.id),
+ ['test_layer_1', 'test_layer_1-hexagon-cell'],
+ 'Should create 2 deck.gl layers'
+ );
+
+ const [deckHexLayer, hexCellLayer] = deckLayers;
+ const {props, state} = deckHexLayer;
+
+ // deckGl default pointToHexbin reads viewport set to width: 1 and height: 1 on initial render
+ const pt0 = {
+ screenCoord: [41949.62272711111, 101320.76889147105],
+ index: 0,
+ data: allData[0]
+ };
+ const pt1 = {
+ screenCoord: [41936.53009066667, 101311.85384886562],
+ index: 1,
+ data: allData[1]
+ };
+ const pt4 = {
+ screenCoord: [42134.70003199999, 101616.81008745039],
+ index: 4,
+ data: allData[4]
+ };
+ const pt5 = {
+ screenCoord: [42159.752988444445, 101668.04589451979],
+ index: 5,
+ data: allData[5]
+ };
+ const pt7 = {
+ screenCoord: [42044.19845688889, 101228.11376437404],
+ index: 7,
+ data: allData[7]
+ };
+
+ const expectedHexCellData = [
+ {
+ position: [-122.47496374709492, 37.71932315011047],
+ points: [pt0, pt1],
+ index: 0,
+ filteredPoints: []
+ },
+ {
+ position: [-122.2779601982836, 37.44892081775436],
+ points: [pt4, pt5],
+ index: 1,
+ filteredPoints: [pt4, pt5]
+ },
+ {
+ position: [-122.2779601982836, 37.98874207331562],
+ points: [pt7],
+ index: 2,
+ filteredPoints: [pt7]
+ }
+ ];
+
+ // assigned by d3-hexbin
+ expectedHexCellData[0].points.x = 41888.45306522654;
+ expectedHexCellData[0].points.y = 101375.32539537722;
+ expectedHexCellData[1].points.x = 42031.9066716143;
+ expectedHexCellData[1].points.y = 101623.79433016981;
+ expectedHexCellData[2].points.x = 42031.9066716143;
+ expectedHexCellData[2].points.y = 101126.85646058463;
+
+ const expectedProps = {
+ coverage: layer.config.visConfig.coverage,
+ radius: layer.config.visConfig.worldUnitSize * 1000,
+ colorRange: [
+ [8, 8, 8],
+ [9, 9, 9],
+ [7, 7, 7]
+ ],
+ colorScaleType: layer.config.colorScale,
+ elevationScaleType: layer.config.sizeScale,
+ elevationScale: layer.config.visConfig.elevationScale,
+ upperPercentile: layer.config.visConfig.percentile[1],
+ lowerPercentile: layer.config.visConfig.percentile[0]
+ };
+
+ const expectedColorBins = [
+ {i: 2, value: 1, counts: 1},
+ {i: 1, value: 2, counts: 2},
+ ];
+ const expectedElevationBins = [
+ {i: 2, value: 1, counts: 1},
+ {i: 1, value: 2, counts: 2},
+ ];
+
+ t.deepEqual(
+ hexCellLayer.props.data,
+ expectedHexCellData,
+ 'should pass correct data to hexagon cell layer'
+ );
+
+ Object.keys(expectedProps).forEach(key => {
+ t.deepEqual(
+ props[key],
+ expectedProps[key],
+ `should have correct props.${key}`
+ );
+ });
+
+ t.deepEqual(
+ spyLayerCallbacks.args[0][0],
+ [1, 2],
+ 'should call onSetLayerDomain with correct domain'
+ );
+
+ t.deepEqual(
+ state.aggregatorState.dimensions.fillColor.sortedBins.sortedBins,
+ expectedColorBins,
+ 'should create correct color bins'
+ );
+
+ t.deepEqual(
+ state.aggregatorState.dimensions.elevation.sortedBins.sortedBins,
+ expectedElevationBins,
+ 'should create correct elevation bins'
+ );
+ }
+ }
+ ];
+
+ testRenderLayerCases(t, HexagonLayer, TEST_CASES);
+ t.end();
+});
diff --git a/test/browser/layer-tests/icon-layer-specs.js b/test/browser/layer-tests/icon-layer-specs.js
new file mode 100644
index 000000000..d41958062
--- /dev/null
+++ b/test/browser/layer-tests/icon-layer-specs.js
@@ -0,0 +1,428 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import test from 'tape';
+import React from 'react';
+import {mount} from 'enzyme';
+import sinon from 'sinon';
+import sinonStubPromise from 'sinon-stub-promise';
+sinonStubPromise(sinon);
+
+import {
+ testCreateCases,
+ testFormatLayerDataCases,
+ testRenderLayerCases,
+ preparedDataset,
+ dataId,
+ testRows,
+ pointLayerMeta,
+ iconGeometry
+} from 'test/helpers/layer-utils';
+import {KeplerGlLayers} from 'layers';
+import {INITIAL_MAP_STATE} from 'reducers/map-state-updaters';
+
+const {IconLayer} = KeplerGlLayers;
+const columns = {
+ lat: 'lat',
+ lng: 'lng',
+ icon: 'icon'
+};
+
+const mockSvgIcons = [
+ {
+ id: 'alert',
+ mesh: {
+ positions: [
+ [1, -0.5, 0],
+ [0.9, -0.52, 0],
+ [0.97, -0.5, 0],
+ [0.3, -0.4, 0]
+ ],
+ cells: [[0, 1, 3], [1, 2, 3]]
+ }
+ }
+];
+
+test('#IconLayer -> constructor', t => {
+ const TEST_CASES = {
+ CREATE: [
+ {
+ props: {
+ dataId: 'smoothie',
+ isVisible: true,
+ label: 'test icon layer'
+ },
+ test: layer => {
+ t.ok(
+ layer.config.dataId === 'smoothie',
+ 'IconLayer dataId should be correct'
+ );
+ t.ok(layer.type === 'icon', 'type should be icon');
+ t.ok(layer.isAggregated === false, 'IconLayer is not aggregated');
+ t.ok(
+ layer.config.label === 'test icon layer',
+ 'label should be correct'
+ );
+ t.ok(
+ Object.keys(layer.columnPairs).length,
+ 'should have columnPairs'
+ );
+
+ // t.ok(spy.calledOnce, 'should call window.fetch once');
+ }
+ }
+ ]
+ };
+
+ testCreateCases(t, IconLayer, TEST_CASES.CREATE);
+ t.end();
+});
+
+test('#IconLayer -> formatLayerData', t => {
+ const filteredIndex = [0, 2, 4];
+
+ const TEST_CASES = [
+ {
+ name: 'gps point with icon.1',
+ layer: {
+ config: {
+ dataId,
+ label: 'gps point icon',
+ columns,
+ color: [2, 3, 4]
+ },
+ type: 'icon',
+ id: 'test_layer_1'
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+
+ const expectedLayerData = {
+ data: [
+ {
+ data: testRows[0],
+ index: 0,
+ icon: 'accel'
+ }
+ ],
+ getFilterValue: () => {},
+ getFillColor: () => {},
+ getRadius: () => {},
+ getPosition: () => {}
+ };
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ Object.keys(expectedLayerData).sort(),
+ 'layerData should have 5 keys'
+ );
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct point layerData data'
+ );
+ // getPosition
+ t.deepEqual(
+ layerData.getPosition(layerData.data[0]),
+ [testRows[0][2], testRows[0][1]],
+ 'getPosition should return correct position'
+ );
+ // getFillColor
+ t.deepEqual(
+ layerData.getFillColor,
+ [2, 3, 4],
+ 'getFillColor should be a constant'
+ );
+ // getRadius
+ t.equal(layerData.getRadius, 1, 'getRadius should be a constant');
+ // getFilterValue
+ t.deepEqual(
+ layerData.data.map(layerData.getFilterValue),
+ [[Number.MIN_SAFE_INTEGER, 0, 0, 0]],
+ 'getFilterValue should return [value, 0, 0, 0]'
+ );
+ // layerMeta
+ t.deepEqual(
+ layer.meta,
+ pointLayerMeta,
+ 'should format correct point layer meta'
+ );
+ }
+ },
+ {
+ name: 'Icon data. with colorField and sizeField',
+ layer: {
+ config: {
+ dataId,
+ label: 'icons',
+ columns,
+ color: [10, 10, 10],
+ // color by types(string)
+ colorField: {
+ type: 'string',
+ name: 'types'
+ },
+ // size by id(integer)
+ sizeField: {
+ type: 'real',
+ name: 'trip_distance'
+ },
+ visConfig: {
+ colorRange: {
+ colors: ['#010101', '#020202', '#030303']
+ },
+ radiusRange: [10, 20]
+ }
+ },
+ type: 'icon',
+ id: 'test_layer_2'
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData} = result;
+
+ // getSourceColor
+ // domain: ['driver_analytics', 'driver_analytics_0', 'driver_gps']
+ // range ['#010101', '#020202', '#030303']
+ t.deepEqual(
+ layerData.data.map(layerData.getFillColor),
+ [[2, 2, 2]],
+ 'getFillColor should be correct'
+ );
+ // getRadius
+ // domain: [1.59, 11]
+ // range: [10, 20]
+ // value [1.59, 2.37]
+ t.deepEqual(
+ layerData.data.map(layerData.getRadius),
+ [10],
+ 'getRadius should be a constant'
+ );
+ // getFilterValue
+ t.deepEqual(
+ layerData.data.map(layerData.getFilterValue),
+ [[Number.MIN_SAFE_INTEGER, 0, 0, 0]],
+ 'getFilterValue should return [value, 0, 0, 0]'
+ );
+ }
+ }
+ ];
+
+ testFormatLayerDataCases(t, IconLayer, TEST_CASES);
+ t.end();
+});
+
+test('#IconLayer -> renderLayer', t => {
+ const filteredIndex = [0, 2, 4, 5];
+
+ const TEST_CASES = [
+ {
+ name: 'Test render icon.1 -> no icon Geometry',
+ layer: {
+ config: {
+ dataId,
+ label: 'gps point icon',
+ columns,
+ color: [2, 3, 4]
+ },
+ type: 'icon',
+ id: 'test_layer_1'
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: (deckLayers, layer) => {
+ t.equal(layer.type, 'icon', 'should create 1 icon layer');
+ t.equal(
+ deckLayers.length,
+ 0,
+ 'Should create 0 deck.gl layer when icon geometry is not provided'
+ );
+ }
+ },
+ {
+ name: 'Test render icon.2 -> has icon geometry',
+ layer: {
+ id: 'test_layer_1',
+ type: 'icon',
+ config: {
+ dataId,
+ label: 'gps point icon',
+ columns,
+ color: [1, 2, 3]
+ }
+ },
+ afterLayerInitialized: layer => {
+ layer.iconGeometry = iconGeometry;
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: (deckLayers, layer) => {
+ t.equal(layer.type, 'icon', 'should create 1 icon layer');
+ t.equal(
+ deckLayers.length,
+ 3,
+ 'Should create 3 deck.gl layer when icon geometry is provided'
+ );
+ const expectedLayerIds = [
+ 'test_layer_1',
+ 'test_layer_1-accel',
+ 'test_layer_1-attach'
+ ];
+
+ t.deepEqual(
+ deckLayers.map(l => l.id),
+ expectedLayerIds,
+ 'should create 1 composite, 2 svg icon layer'
+ );
+
+ const {props} = deckLayers[0];
+
+ const expectedProps = {
+ opacity: layer.config.visConfig.opacity,
+ radiusMaxPixels: 500,
+ radiusScale: layer.getRadiusScaleByZoom(INITIAL_MAP_STATE),
+ filterRange: preparedDataset.gpuFilter.filterRange,
+ brushingEnabled: false
+ };
+ Object.keys(expectedProps).forEach(key => {
+ t.deepEqual(
+ props[key],
+ expectedProps[key],
+ `should have correct props.${key}`
+ );
+ });
+ }
+ },
+ {
+ name: 'Test render icon.2 -> has icon geometry -> brushing',
+ layer: {
+ id: 'test_layer_1',
+ type: 'icon',
+ config: {
+ dataId,
+ label: 'gps point icon',
+ columns,
+ color: [1, 2, 3]
+ }
+ },
+ afterLayerInitialized: layer => {
+ layer.iconGeometry = iconGeometry;
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ renderArgs: {
+ interactionConfig: {
+ brush: {
+ enabled: true,
+ config: {
+ size: 2.5
+ }
+ }
+ }
+ },
+ assert: (deckLayers, layer) => {
+ t.equal(layer.type, 'icon', 'should create 1 icon layer');
+ t.equal(
+ deckLayers.length,
+ 3,
+ 'Should create 3 deck.gl layer when icon geometry is provided'
+ );
+ const expectedLayerIds = [
+ 'test_layer_1',
+ 'test_layer_1-accel',
+ 'test_layer_1-attach'
+ ];
+
+ t.deepEqual(
+ deckLayers.map(l => l.id),
+ expectedLayerIds,
+ 'should create 1 composite, 2 svg icon layer'
+ );
+
+ const {props} = deckLayers[0];
+
+ const expectedProps = {
+ brushingRadius: 2500,
+ brushingTarget: 'source',
+ brushingEnabled: true
+ };
+ Object.keys(expectedProps).forEach(key => {
+ t.deepEqual(
+ props[key],
+ expectedProps[key],
+ `should have correct props.${key}`
+ );
+ });
+ }
+ }
+ ];
+
+ testRenderLayerCases(t, IconLayer, TEST_CASES);
+ t.end();
+});
+
+test('#IconLayer -> fetch icon geometry -> renderIconModal', t => {
+ const mockSuccessResponse = {svgIcons: mockSvgIcons};
+ const mockJsonPromise = sinon.stub().returnsPromise();
+ mockJsonPromise.resolves(mockSuccessResponse);
+
+ const stubedFetch = sinon.stub(global, 'fetch').returnsPromise();
+
+ stubedFetch.resolves({
+ json: mockJsonPromise
+ });
+
+ // initialize iconLayer
+ const iconLayer = new IconLayer();
+ t.deepEqual(iconLayer.iconGeometry, iconLayer.iconGeometry, 'should create correct iconGeometry');
+
+ let wrapper;
+ t.doesNotThrow(() => {
+ wrapper = mount(<iconLayer.layerInfoModal.template />);
+ }, 'mount layer info modal with icons should not fail');
+
+ t.equal(wrapper.find('.icon-table__item').length, 3, 'should render 1 icon');
+ t.equal(wrapper.find('.icon-table_item__name').at(0).find('code').text(), 'alert', 'should render alert icon');
+
+ stubedFetch.restore();
+ t.end();
+});
diff --git a/test/node/layer-tests/index.js b/test/browser/layer-tests/index.js
similarity index 90%
rename from test/node/layer-tests/index.js
rename to test/browser/layer-tests/index.js
index 66c556d53..93777067f 100644
--- a/test/node/layer-tests/index.js
+++ b/test/browser/layer-tests/index.js
@@ -19,11 +19,15 @@
// THE SOFTWARE.
import './base-layer-sepcs';
+import './arc-layer-specs';
+import './cluster-layer-specs';
import './geojson-layer-specs';
import './grid-layer-specs';
-import './point-layer-specs';
-import './hexagon-layer-specs';
+import './h3-hexagon-layer-specs';
import './heatmap-layer-specs';
+import './hexagon-layer-specs';
+import './icon-layer-specs';
+import './line-layer-specs';
+import './point-layer-specs';
import './scenegraph-layer-specs';
-import './cluster-layer-specs';
-
+import './trip-layer-specs';
diff --git a/test/browser/layer-tests/line-layer-specs.js b/test/browser/layer-tests/line-layer-specs.js
new file mode 100644
index 000000000..fe9dee660
--- /dev/null
+++ b/test/browser/layer-tests/line-layer-specs.js
@@ -0,0 +1,412 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import test from 'tape';
+import moment from 'moment';
+
+import {
+ testCreateCases,
+ testFormatLayerDataCases,
+ testRenderLayerCases,
+ dataId,
+ testRows,
+ preparedDataset,
+ arcLayerMeta
+} from 'test/helpers/layer-utils';
+
+import {KeplerGlLayers} from 'layers';
+
+const {LineLayer} = KeplerGlLayers;
+const columns = {
+ lat0: 'lat',
+ lng0: 'lng',
+ lat1: 'lat_1',
+ lng1: 'lng_1'
+};
+
+test('#LineLayer -> constructor', t => {
+ const TEST_CASES = {
+ CREATE: [
+ {
+ props: {
+ dataId: 'smoothie',
+ isVisible: true,
+ label: 'test line layer'
+ },
+ test: layer => {
+ t.ok(
+ layer.config.dataId === 'smoothie',
+ 'LineLayer dataId should be correct'
+ );
+ t.ok(layer.type === 'line', 'type should be line');
+ t.ok(layer.isAggregated === false, 'LineLayer is not aggregated');
+ t.ok(
+ layer.config.label === 'test line layer',
+ 'label should be correct'
+ );
+ t.ok(
+ Object.keys(layer.columnPairs).length,
+ 'should have columnPairs'
+ );
+ }
+ }
+ ]
+ };
+
+ testCreateCases(t, LineLayer, TEST_CASES.CREATE);
+ t.end();
+});
+
+test('#LineLayer -> formatLayerData', t => {
+ const filteredIndex = [0, 2, 4];
+ const filterDomain0 = 1474071056000;
+
+ const TEST_CASES = [
+ {
+ name: 'Line trip data.1',
+ layer: {
+ config: {
+ dataId,
+ label: 'trip lines',
+ columns,
+ color: [10, 10, 10]
+ },
+ type: 'line',
+ id: 'test_layer_0'
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+
+ const expectedLayerData = {
+ data: [
+ {
+ data: testRows[0],
+ index: 0,
+ sourcePosition: [testRows[0][2], testRows[0][1], 0],
+ targetPosition: [testRows[0][4], testRows[0][3], 0]
+ },
+ {
+ data: testRows[4],
+ index: 4,
+ sourcePosition: [testRows[4][2], testRows[4][1], 0],
+ targetPosition: [testRows[4][4], testRows[4][3], 0]
+ }
+ ],
+ getFilterValue: () => {},
+ getSourceColor: () => {},
+ getTargetColor: () => {},
+ getWidth: () => {}
+ };
+ const expectedDataKeys = Object.keys(expectedLayerData).sort();
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ expectedDataKeys,
+ 'layerData should have 6 keys'
+ );
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct line layerData'
+ );
+ // getSourceColor
+ t.deepEqual(
+ layerData.getSourceColor,
+ layer.config.color,
+ 'getSourceColor should be a constant'
+ );
+ // getTargetColor
+ t.deepEqual(
+ layerData.getTargetColor,
+ layer.config.color,
+ 'getTargetColors should be a constant'
+ );
+ // getWidth
+ t.equal(layerData.getWidth, 1, 'getWidth should be a constant');
+ // getFilterValue
+ t.deepEqual(
+ layerData.data.map(layerData.getFilterValue),
+ [
+ [Number.MIN_SAFE_INTEGER, 0, 0, 0],
+ [moment.utc(testRows[4][0]).valueOf() - filterDomain0, 0, 0, 0],
+ ],
+ 'getFilterValue should return [value, 0, 0, 0]'
+ );
+
+ // layerMeta
+ t.deepEqual(
+ layer.meta,
+ arcLayerMeta,
+ 'should format correct arc layer meta'
+ );
+ }
+ },
+ {
+ name: 'Lind trip data.2 targetColor',
+ layer: {
+ config: {
+ dataId,
+ label: 'trip lines',
+ columns,
+ color: [10, 10, 10],
+ visConfig: {
+ targetColor: [1, 2, 3]
+ }
+ },
+ type: 'line',
+ id: 'test_layer_2'
+ },
+ datasets: {
+ [dataId]: preparedDataset
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+
+ const expectedLayerData = {
+ data: [],
+ getFilterValue: () => {},
+ getSourceColor: () => {},
+ getTargetColor: () => {},
+ getWidth: () => {}
+ };
+ const expectedDataKeys = Object.keys(expectedLayerData).sort();
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ expectedDataKeys,
+ 'layerData should have 6 keys'
+ );
+ // getSourceColor
+ t.deepEqual(
+ layerData.getSourceColor,
+ layer.config.color,
+ 'getSourceColor should be a constant'
+ );
+ // getSourceColor
+ t.deepEqual(
+ layerData.getTargetColor,
+ [1, 2, 3],
+ 'getTargetColors should be a constant'
+ );
+ }
+ },
+ {
+ name: 'Line trip data. with colorField and sizeField',
+ layer: {
+ config: {
+ dataId,
+ label: 'trip lines',
+ columns,
+ color: [10, 10, 10],
+ // color by id(integer)
+ colorField: {
+ type: 'string',
+ name: 'types'
+ },
+ // size by id(integer)
+ sizeField: {
+ type: 'real',
+ name: 'trip_distance'
+ },
+ visConfig: {
+ colorRange: {
+ colors: ['#010101', '#020202', '#030303']
+ },
+ sizeRange: [10, 20]
+ }
+ },
+ type: 'line',
+ id: 'test_layer_1'
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData} = result;
+
+ const expectedLayerData = {
+ data: [
+ {
+ data: testRows[0],
+ index: 0,
+ sourcePosition: [testRows[0][2], testRows[0][1], 0],
+ targetPosition: [testRows[0][4], testRows[0][3], 0]
+ },
+ {
+ data: testRows[4],
+ index: 4,
+ sourcePosition: [testRows[4][2], testRows[4][1], 0],
+ targetPosition: [testRows[4][4], testRows[4][3], 0]
+ }
+ ],
+ getFilterValue: () => {},
+ getSourceColor: () => {},
+ getTargetColor: () => {},
+ getWidth: () => {}
+ };
+ const expectedDataKeys = Object.keys(expectedLayerData).sort();
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ expectedDataKeys,
+ 'layerData should have 6 keys'
+ );
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct line layerData data'
+ );
+ // getSourceColor
+ // domain: ['driver_analytics', 'driver_analytics_0', 'driver_gps']
+ // range ['#010101', '#020202', '#030303']
+ t.deepEqual(
+ layerData.data.map(layerData.getSourceColor),
+ [[2, 2, 2], [1, 1, 1]],
+ 'getSourceColor should be correct'
+ );
+ // getTargetColor
+ // domain: ['driver_analytics', 'driver_analytics_0', 'driver_gps']
+ // range ['#010101', '#020202', '#030303']
+ t.deepEqual(
+ layerData.data.map(layerData.getTargetColor),
+ [[2, 2, 2], [1, 1, 1]],
+ 'getTargetColors be correct'
+ );
+ // getWidth
+ // domain: [1.59, 11]
+ // range: [10, 20]
+ // value [1.59, 2.37]
+ t.deepEqual(
+ layerData.data.map(layerData.getWidth),
+ [10, (2.37 - 1.59) * (10 / 9.41) + 10],
+ 'getWidth should be a constant'
+ );
+ // getFilterValue
+ t.deepEqual(
+ layerData.data.map(layerData.getFilterValue),
+ [
+ [Number.MIN_SAFE_INTEGER, 0, 0, 0],
+ [moment.utc(testRows[4][0]).valueOf() - filterDomain0, 0, 0, 0],
+ ],
+ 'getFilterValue should return [value, 0, 0, 0]'
+ );
+ }
+ }
+ ];
+
+ testFormatLayerDataCases(t, LineLayer, TEST_CASES);
+ t.end();
+});
+
+test('#LineLayer -> renderLayer', t => {
+ const filteredIndex = [0, 2, 4];
+
+ const TEST_CASES = [
+ {
+ name: 'Line render layer.1',
+ layer: {
+ config: {
+ dataId,
+ label: 'trip lines',
+ columns,
+ color: [10, 10, 10]
+ },
+ type: 'line',
+ id: 'test_layer_0'
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: (deckLayers, layer) => {
+ t.equal(deckLayers.length, 1, 'Should create 1 deck.gl layer');
+ const {props} = deckLayers[0];
+ // test instancePositions
+ t.equal(
+ props.opacity, layer.config.visConfig.opacity, 'should calculate correct opacity'
+ );
+ t.equal(
+ props.widthScale, layer.config.visConfig.thickness, 'should apply correct widthScale'
+ )
+ t.equal(
+ props.filterRange, preparedDataset.gpuFilter.filterRange, 'should supply correct filterRange'
+ )
+ }
+ },
+ {
+ name: 'Line render layer.2 brushing',
+ layer: {
+ config: {
+ dataId,
+ label: 'trip lines',
+ columns,
+ color: [10, 10, 10]
+ },
+ type: 'line',
+ id: 'test_layer_0'
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ renderArgs: {
+ interactionConfig: {
+ brush: {
+ enabled: true,
+ config: {
+ size: 2.5
+ }
+ }
+ }
+ },
+ assert: (deckLayers, layer) => {
+ t.equal(deckLayers.length, 1, 'Should create 1 deck.gl layer');
+ const {props} = deckLayers[0];
+ // test instancePositions
+
+ t.equal(
+ props.brushingRadius, 2500, 'should supply brushingRadius'
+ );
+ t.equal(
+ props.brushingEnabled, true, 'should have brushingEnabled: true'
+ );
+ t.equal(
+ props.brushingTarget, 'source_target', 'brushingTarget: should be source'
+ )
+ }
+ }
+ ];
+
+ testRenderLayerCases(t, LineLayer, TEST_CASES);
+ t.end();
+});
diff --git a/test/browser/layer-tests/point-layer-specs.js b/test/browser/layer-tests/point-layer-specs.js
new file mode 100644
index 000000000..8f42ed877
--- /dev/null
+++ b/test/browser/layer-tests/point-layer-specs.js
@@ -0,0 +1,682 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import test from 'tape';
+import moment from 'moment';
+import {getDistanceScales} from 'viewport-mercator-project';
+import {
+ testCreateCases,
+ testFormatLayerDataCases,
+ testRenderLayerCases,
+ preparedDataset,
+ dataId,
+ testRows,
+ pointLayerMeta,
+ fieldDomain
+} from 'test/helpers/layer-utils';
+
+import {KeplerGlLayers} from 'layers';
+import {INITIAL_MAP_STATE} from 'reducers/map-state-updaters';
+import {DEFAULT_TEXT_LABEL} from 'layers/layer-factory';
+
+const {PointLayer} = KeplerGlLayers;
+
+test('#PointLayer -> constructor', t => {
+ const TEST_CASES = {
+ CREATE: [
+ {
+ props: {
+ dataId: 'smoothie',
+ isVisible: true,
+ label: 'test point layer'
+ },
+ test: layer => {
+ t.ok(
+ layer.config.dataId === 'smoothie',
+ 'PointLayer dataId should be correct'
+ );
+ t.ok(layer.type === 'point', 'type should be point');
+ t.ok(layer.isAggregated === false, 'PointLayer is not aggregated');
+ t.ok(
+ layer.config.label === 'test point layer',
+ 'label should be correct'
+ );
+ t.deepEqual(
+ layer.columnPairs,
+ {
+ lat: {pair: 'lng', fieldPairKey: 'lat'},
+ lng: {pair: 'lat', fieldPairKey: 'lng'}
+ },
+ 'columnPairs should be correct'
+ );
+ }
+ }
+ ]
+ };
+
+ testCreateCases(t, PointLayer, TEST_CASES.CREATE);
+ t.end();
+});
+
+test('#PointLayer -> formatLayerData', t => {
+ const filteredIndex = [0, 2, 4];
+ const filterDomain0 = 1474071056000;
+
+ const TEST_CASES = [
+ {
+ name: 'Point gps point.1',
+ layer: {
+ config: {
+ dataId,
+ label: 'gps point',
+ columns: {
+ lat: 'lat',
+ lng: 'lng',
+ altitude: 'id'
+ },
+ textLabel: [
+ {
+ field: {
+ name: 'types',
+ type: 'string'
+ }
+ },
+ {
+ field: {
+ name: 'has_result',
+ type: 'boolean'
+ }
+ }
+ ],
+ visConfig: {
+ strokeColor: [1, 2, 3]
+ }
+ },
+ type: 'point',
+ id: 'test_layer_1'
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+
+ const expectedLayerData = {
+ textLabels: [
+ {
+ characterSet: [],
+ getText: () => {}
+ },
+ {
+ characterSet: [],
+ getText: () => {}
+ }
+ ],
+ data: [
+ {
+ data: testRows[0],
+ index: 0,
+ position: [testRows[0][2], testRows[0][1], testRows[0][7]]
+ },
+ {
+ data: testRows[4],
+ index: 4,
+ position: [testRows[4][2], testRows[4][1], testRows[4][7]]
+ }
+ ],
+ getFilterValue: () => {},
+ getFillColor: () => {},
+ getLineColor: () => {},
+ getRadius: () => {},
+ getPosition: () => {}
+ };
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ Object.keys(expectedLayerData).sort(),
+ 'layerData should have 7 keys'
+ );
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct point layerData data'
+ );
+ // getPosition
+ t.deepEqual(
+ layerData.getPosition(layerData.data[0]),
+ [testRows[0][2], testRows[0][1], testRows[0][7]],
+ 'getPosition should return correct position'
+ );
+ // getFillColor
+ t.deepEqual(
+ layerData.getFillColor,
+ layer.config.color,
+ 'getFillColor should be a constant'
+ );
+ // getLineColor
+ t.deepEqual(
+ layerData.getLineColor,
+ [1, 2, 3],
+ 'getLineColor should be a constant'
+ );
+ // getRadius
+ t.equal(layerData.getRadius, 1, 'getRadius should be a constant');
+ // getFilterValue
+ t.deepEqual(
+ layerData.data.map(layerData.getFilterValue),
+ [
+ [Number.MIN_SAFE_INTEGER, 0, 0, 0],
+ [moment.utc(testRows[4][0]).valueOf() - filterDomain0, 0, 0, 0]
+ ],
+ 'getFilterValue should return [0, 0, 0, 0]'
+ );
+ // textLabels
+ t.deepEqual(
+ layerData.textLabels.length,
+ expectedLayerData.textLabels.length,
+ 'textLabels should have 2 items'
+ );
+ t.deepEqual(
+ layerData.textLabels[0].characterSet,
+ ['d','r','i','v','e','_','a','n','l','y','t','c','s','0'],
+ 'textLabels should have correct characterSet'
+ );
+ t.deepEqual(
+ layerData.textLabels[0].getText(layerData.data[0]),
+ 'driver_analytics_0',
+ 'textLabels getText should have correct text'
+ );
+ // layerMeta
+ t.deepEqual(
+ layer.meta,
+ pointLayerMeta,
+ 'should format correct point layer meta'
+ );
+ }
+ },
+ {
+ name: 'Test gps point.2 Data colorFields. sizeField and fixedRadius',
+ layer: {
+ type: 'point',
+ id: 'test_layer_2',
+ config: {
+ dataId,
+ label: 'some point file',
+ columns: {
+ lat: 'lat',
+ lng: 'lng'
+ },
+ visConfig: {
+ outline: true,
+ fixedRadius: true,
+ colorRange: {
+ colors: ['#010101', '#020202', '#030303']
+ },
+ strokeColor: [4, 5, 6]
+ },
+ // color by id(integer)
+ colorField: {
+ type: 'integer',
+ name: 'id'
+ },
+ // size by id(integer)
+ sizeField: {
+ type: 'integer',
+ name: 'id'
+ }
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+ const expectedLayerData = {
+ data: [
+ {
+ data: testRows[0],
+ index: 0,
+ position: [testRows[0][2], testRows[0][1], 0]
+ },
+ {
+ data: testRows[4],
+ index: 4,
+ position: [testRows[4][2], testRows[4][1], 0]
+ }
+ ],
+ getFilterValue: () => {},
+ getLineColor: () => {},
+ getFillColor: () => {},
+ getRadius: () => {},
+ getPosition: () => {},
+ textLabels: []
+ };
+ t.deepEqual(
+ Object.keys(layerData).sort,
+ Object.keys(expectedLayerData).sort,
+ 'layerData should have 7 keys'
+ );
+ t.deepEqual(
+ layer.config.colorDomain,
+ fieldDomain.id,
+ 'should update layer color domain'
+ );
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should filter out nulls, format correct point layerData'
+ );
+ // getPosition
+ t.deepEqual(
+ layerData.getPosition(layerData.data[0]),
+ [testRows[0][2], testRows[0][1], 0],
+ 'getPosition should return correct lat lng'
+ );
+ // layerMeta
+ t.deepEqual(
+ layer.meta,
+ pointLayerMeta,
+ 'should format correct layerMeta'
+ );
+ // getFillColor
+ t.deepEqual(
+ layerData.getFillColor(layerData.data[0]),
+ [1, 1, 1],
+ 'getFillColor should return correct color'
+ );
+ // getLineColor
+ t.deepEqual(
+ layerData.getLineColor,
+ [4, 5, 6],
+ 'getLineColor should return correct color'
+ );
+ // getRadius
+ // domain [1, 12124]
+ t.equal(
+ layerData.getRadius(layerData.data[0]),
+ 1,
+ 'getRadius should return fixed radius'
+ );
+ }
+ },
+ {
+ name: 'Test gps point.2 Data strokeColorFields and SizeField',
+ layer: {
+ type: 'point',
+ id: 'test_layer_2',
+ config: {
+ dataId,
+ label: 'some point file',
+ columns: {
+ lat: 'lat',
+ lng: 'lng'
+ },
+ color: [10, 10, 10],
+ visConfig: {
+ outline: true,
+ colorRange: {
+ colors: ['#010101', '#020202', '#030303']
+ },
+ strokeColorRange: {
+ colors: ['#040404', '#050505', '#060606']
+ },
+ strokeColor: [4, 5, 6],
+ radiusRange: [10, 100]
+ },
+ // color by id(integer)
+ strokeColorField: {
+ type: 'integer',
+ name: 'id'
+ },
+ // size by id(integer)
+ sizeField: {
+ type: 'integer',
+ name: 'id'
+ }
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+
+ const expectedLayerData = {
+ data: [
+ {
+ data: testRows[0],
+ index: 0,
+ position: [testRows[0][2], testRows[0][1], 0]
+ },
+ {
+ data: testRows[4],
+ index: 4,
+ position: [testRows[4][2], testRows[4][1], 0]
+ }
+ ],
+ getFilterValue: () => {},
+ getLineColor: () => {},
+ getFillColor: () => {},
+ getRadius: () => {},
+ getPosition: () => {},
+ textLabels: []
+ };
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ Object.keys(expectedLayerData).sort(),
+ 'layerData should have 6 keys'
+ );
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct point layerData data'
+ );
+ t.deepEqual(
+ layer.config.sizeDomain,
+ [fieldDomain.id[0], fieldDomain.id[fieldDomain.id.length - 1]],
+ 'should update layer sizeDomain'
+ );
+ // getFillColor
+ t.deepEqual(
+ layerData.getFillColor,
+ [10, 10, 10],
+ 'getFillColor should return correct color'
+ );
+ // getLineColor
+ t.deepEqual(
+ layerData.getLineColor(layerData.data[0]),
+ [4, 4, 4],
+ 'getLineColor should return correct color'
+ );
+ // getRadius
+ // domain [1, 12124]
+ // range [10, 100]
+ t.equal(
+ layerData.getRadius(layerData.data[0]),
+ 10,
+ 'getRadius should return corrent radius'
+ );
+ }
+ }
+ ];
+
+ testFormatLayerDataCases(t, PointLayer, TEST_CASES);
+ t.end();
+});
+
+test('#PointLayer -> renderLayer', t => {
+ const filteredIndex = [0, 2, 4];
+ const TEST_CASES = [
+ {
+ name: 'Test render point.1',
+ layer: {
+ id: 'test_layer_1',
+ type: 'point',
+ config: {
+ dataId,
+ label: 'gps point',
+ columns: {
+ lat: 'lat',
+ lng: 'lng',
+ altitude: null
+ },
+ strokeColorField: {
+ type: 'string',
+ name: 'types'
+ },
+ color: [1, 2, 3],
+ visConfig: {
+ strokeColorRange: {
+ colors: ['#040404', '#050505', '#060606']
+ },
+ thickness: 3
+ }
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: (deckLayers, layer) => {
+ t.equal(deckLayers.length, 1, 'Should create 1 deck.gl layer');
+ const {props} = deckLayers[0];
+ const expectedProps = {
+ opacity: layer.config.visConfig.opacity,
+ stroked: layer.config.visConfig.outline,
+ filled: layer.config.visConfig.filled,
+ radiusScale: layer.getRadiusScaleByZoom(INITIAL_MAP_STATE),
+ lineWidthScale: layer.config.visConfig.thickness,
+ filterRange: preparedDataset.gpuFilter.filterRange
+ };
+ Object.keys(expectedProps).forEach(key => {
+ t.deepEqual(
+ props[key],
+ expectedProps[key],
+ `should have correct props.${key}`
+ );
+ });
+ }
+ },
+ {
+ name: 'Point gps point.1 with text labels',
+ layer: {
+ config: {
+ dataId,
+ label: 'gps point',
+ columns: {
+ lat: 'lat',
+ lng: 'lng',
+ altitude: 'id'
+ },
+ textLabel: [
+ {
+ field: {
+ name: 'types',
+ type: 'string'
+ }
+ // default anchor: start, alignment: center
+ },
+ {
+ field: {
+ name: 'has_result',
+ type: 'boolean'
+ },
+ anchor: 'middle',
+ alignment: 'bottom'
+ }
+ ],
+ visConfig: {
+ strokeColor: [1, 2, 3]
+ }
+ },
+ type: 'point',
+ id: 'test_layer_1'
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: (deckLayers, layer, layerData) => {
+ t.equal(deckLayers.length, 5, 'Should create 5 deck.gl layer');
+ t.deepEqual(
+ deckLayers.map(l => l.id),
+ [
+ 'test_layer_1',
+ 'test_layer_1-label-types',
+ 'test_layer_1-label-types-characters',
+ 'test_layer_1-label-has_result',
+ 'test_layer_1-label-has_result-characters'
+ ],
+ 'Should create 5 deck.gl layers'
+ );
+ // test test_layer_1-label-types
+ const {
+ getPosition,
+ getColor,
+ getSize,
+ getPixelOffset,
+ getFilterValue
+ } = deckLayers[2].props;
+ const {getPixelOffset: getPixelOffset1} = deckLayers[4].props;
+
+ const distanceScale = getDistanceScales(INITIAL_MAP_STATE);
+ const radiusScale = layer.getRadiusScaleByZoom(INITIAL_MAP_STATE);
+ const pixelRadius = radiusScale * distanceScale.pixelsPerMeter[0];
+
+ const padding = 20;
+
+ // anchor: start, alignment: center
+ const expectedPixelOffset0 = [
+ 1 * (pixelRadius + padding),
+ 0 * (pixelRadius + padding + 0)
+ ];
+
+ // anchor: 'middle', alignment: 'bottom'
+ const expectedPixelOffset1 = [
+ 0 * (pixelRadius + padding),
+ 1 * (pixelRadius + padding + DEFAULT_TEXT_LABEL.size)
+ ];
+
+ t.deepEqual(
+ getPosition(layerData.data[0]),
+ [testRows[0][2], testRows[0][1], 1],
+ 'Should calculate correct getPosition'
+ );
+ t.deepEqual(
+ getColor,
+ DEFAULT_TEXT_LABEL.color,
+ 'Should calculate correct getColor'
+ );
+ t.deepEqual(getSize, 1, 'Should calculate correct getSize');
+ t.deepEqual(
+ getPixelOffset,
+ expectedPixelOffset0,
+ 'Should calculate correct instancePixelOffset'
+ );
+ t.deepEqual(
+ getPixelOffset1,
+ expectedPixelOffset1,
+ 'Should calculate correct instancePixelOffset'
+ );
+ t.deepEqual(
+ getFilterValue(layerData.data[0]),
+ [Number.MIN_SAFE_INTEGER, 0, 0, 0],
+ 'Should calculate correct instancePixelOffset'
+ );
+ }
+ },
+ {
+ name: 'Point gps point.1 with text labels, color and sizeField',
+ layer: {
+ config: {
+ dataId,
+ label: 'gps point',
+ columns: {
+ lat: 'lat',
+ lng: 'lng',
+ altitude: 'id'
+ },
+ textLabel: [
+ {
+ field: {
+ name: 'types',
+ type: 'string'
+ },
+ color: [2, 2, 2],
+ size: 10,
+ anchor: 'start',
+ alignment: 'bottom'
+ }
+ ],
+ // size by id(integer)
+ sizeField: {
+ type: 'integer',
+ name: 'id'
+ },
+ visConfig: {
+ strokeColor: [1, 2, 3]
+ }
+ },
+ type: 'point',
+ id: 'test_layer_1'
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: (deckLayers, layer, layerData) => {
+ t.deepEqual(
+ deckLayers.map(l => l.id),
+ [
+ 'test_layer_1',
+ 'test_layer_1-label-types',
+ 'test_layer_1-label-types-characters'
+ ],
+ 'Should create 3 deck.gl layers'
+ );
+ // test test_layer_1-label-types
+ const {getColor, getSize, getPixelOffset} = deckLayers[2].props;
+
+ const distanceScale = getDistanceScales(INITIAL_MAP_STATE);
+ const radiusScale = layer.getRadiusScaleByZoom(INITIAL_MAP_STATE);
+ const pixelRadius = radiusScale * distanceScale.pixelsPerMeter[0];
+
+ const padding = 20;
+
+ // anchor: start, alignment: center
+ const getRadius = layerData.getRadius(layerData.data[1]);
+
+ const expectedPixelOffset1 = [
+ 1 * (getRadius * pixelRadius + padding),
+ 1 * (getRadius * pixelRadius + padding + 10)
+ ];
+ t.deepEqual(getColor, [2, 2, 2], 'Should calculate correct getColor');
+ t.deepEqual(getSize, 1, 'Should calculate correct getSize');
+ t.deepEqual(
+ getPixelOffset(layerData.data[1]),
+ expectedPixelOffset1,
+ 'Should calculate correct instancePixelOffset multiplied by getRadius'
+ );
+
+
+ const {attributes} = deckLayers[0].state.attributeManager;
+ }
+ }
+ ];
+
+ testRenderLayerCases(t, PointLayer, TEST_CASES);
+ t.end();
+});
diff --git a/test/browser/layer-tests/scenegraph-layer-specs.js b/test/browser/layer-tests/scenegraph-layer-specs.js
new file mode 100644
index 000000000..b0cf78ef3
--- /dev/null
+++ b/test/browser/layer-tests/scenegraph-layer-specs.js
@@ -0,0 +1,214 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import test from 'tape';
+import moment from 'moment';
+import global from 'global';
+import sinon from 'sinon';
+import sinonStubPromise from 'sinon-stub-promise';
+sinonStubPromise(sinon)
+
+import {
+ testCreateCases,
+ testFormatLayerDataCases,
+ testRenderLayerCases,
+ preparedDataset,
+ dataId,
+ testRows,
+ pointLayerMeta,
+ preparedFilterDomain0
+} from 'test/helpers/layer-utils';
+import {KeplerGlLayers} from 'layers';
+const {ScenegraphLayer} = KeplerGlLayers;
+const columns = {lat: 'lat', lng: 'lng'};
+
+test('#ScenegraphLayer -> constructor', t => {
+ const TEST_CASES = {
+ CREATE: [
+ {
+ props: {
+ dataId: 'smoothie',
+ isVisible: true,
+ label: 'test 3d layer'
+ },
+ test: layer => {
+ t.ok(
+ layer.config.dataId === 'smoothie',
+ 'ScenegraphLayer dataId should be correct'
+ );
+ t.ok(layer.type === '3D', 'type should be 3D');
+ t.ok(
+ layer.isAggregated === false,
+ 'ScenegraphLayer is not aggregated'
+ );
+ t.ok(
+ layer.config.label === 'test 3d layer',
+ 'label should be correct'
+ );
+ t.ok(
+ Object.keys(layer.columnPairs).length,
+ 'should have columnPairs'
+ );
+ }
+ }
+ ]
+ };
+
+ testCreateCases(t, ScenegraphLayer, TEST_CASES.CREATE);
+ t.end();
+});
+
+test('#ScenegraphLayer -> formatLayerData', t => {
+ const filteredIndex = [0, 2, 4];
+
+ const TEST_CASES = [
+ {
+ name: 'Scenegraph gps point.1',
+ layer: {
+ type: '3D',
+ id: 'test_layer_1',
+ config: {
+ dataId,
+ label: 'gps 3d',
+ columns
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+ const expectedLayerData = {
+ data: [
+ {
+ data: testRows[0],
+ index: 0,
+ position: [testRows[0][2], testRows[0][1], 0]
+ },
+ {
+ data: testRows[4],
+ index: 4,
+ position: [testRows[4][2], testRows[4][1], 0]
+ }
+ ],
+ getFilterValue: () => {},
+ getPosition: () => {}
+ };
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ Object.keys(expectedLayerData).sort(),
+ 'layerData should have 3 keys'
+ );
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct point layerData data'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getPosition),
+ [
+ [testRows[0][2], testRows[0][1], 0],
+ [testRows[4][2], testRows[4][1], 0]
+ ],
+ 'getPosition should return correct lat lng'
+ );
+ // getFilterValue
+ t.deepEqual(
+ layerData.data.map(layerData.getFilterValue),
+ [
+ [Number.MIN_SAFE_INTEGER, 0, 0, 0],
+ [moment.utc(testRows[4][0]).valueOf() - preparedFilterDomain0, 0, 0, 0],
+ ],
+ 'getFilterValue should return [value, 0, 0, 0]'
+ );
+ // layerMeta
+ t.deepEqual(
+ layer.meta,
+ pointLayerMeta,
+ 'should format correct point layer meta'
+ );
+ }
+ }
+ ];
+
+ testFormatLayerDataCases(t, ScenegraphLayer, TEST_CASES);
+ t.end();
+});
+
+test('#ScenegraphLayer -> renderLayer', t => {
+
+ // TODO: mock actual gltf response
+ const mockSuccessResponse = {};
+ const mockJsonPromise = sinon.stub().returnsPromise();
+ mockJsonPromise.resolves(mockSuccessResponse);
+ const stubedFetch = sinon.stub(global, 'fetch').returnsPromise();
+
+ stubedFetch.resolves({
+ json: mockJsonPromise
+ });
+
+ const filteredIndex = [0, 2, 4];
+
+ const TEST_CASES = [
+ {
+ name: 'Scenegraph gps point.1',
+ layer: {
+ type: '3D',
+ id: 'test_layer_1',
+ config: {
+ dataId,
+ label: 'gps 3d',
+ columns
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...preparedDataset,
+ filteredIndex
+ }
+ },
+ assert: (deckLayers, layer) => {
+ t.equal(deckLayers.length, 1, 'Should create 1 deck.gl layer');
+ const {props} = deckLayers[0];
+
+ const expectedProps = {
+ opacity: layer.config.visConfig.opacity,
+ sizeScale: layer.config.visConfig.sizeScale,
+ filterRange: preparedDataset.gpuFilter.filterRange
+ }
+ Object.keys(expectedProps).forEach(key => {
+ t.equal(
+ props[key],
+ expectedProps[key],
+ `should have correct props.${key}`
+ );
+ });
+ }
+ }];
+
+ testRenderLayerCases(t, ScenegraphLayer, TEST_CASES);
+
+ stubedFetch.restore();
+ t.end();
+});
diff --git a/test/browser/layer-tests/trip-layer-specs.js b/test/browser/layer-tests/trip-layer-specs.js
new file mode 100644
index 000000000..dee63688b
--- /dev/null
+++ b/test/browser/layer-tests/trip-layer-specs.js
@@ -0,0 +1,469 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+/* eslint-disable max-statements */
+import test from 'tape';
+import TripLayer, {defaultWidth} from 'layers/trip-layer/trip-layer';
+
+import {
+ dataId,
+ testCreateCases,
+ testFormatLayerDataCases,
+ testRenderLayerCases,
+ prepareTripGeoDataset,
+ valueFilterDomain0,
+ animationConfig
+} from 'test/helpers/layer-utils';
+import {
+ TripLayerMeta,
+ dataToFeature,
+ dataToTimeStamp
+} from 'test/fixtures/trip-geojson';
+
+test('#TripLayer -> constructor', t => {
+ const TEST_CASES = {
+ CREATE: [
+ {
+ props: {
+ dataId: 'smoothie',
+ isVisible: true,
+ label: 'test trip layer'
+ },
+ test: layer => {
+ t.ok(
+ layer.config.dataId === 'smoothie',
+ 'tripnLayer dataId should be correct'
+ );
+ t.ok(layer.type === 'trip', 'type should be trip');
+ t.ok(layer.isAggregated === false, 'tripLayer is not aggregated');
+ }
+ }
+ ]
+ };
+
+ testCreateCases(t, TripLayer, TEST_CASES.CREATE);
+ t.end();
+});
+
+test('#TripLayer -> formatLayerData', t => {
+ const filteredIndex = [0, 2, 4];
+
+ const TEST_CASES = [
+ {
+ name: 'Trip Geojson.1',
+ layer: {
+ type: 'trip',
+ id: 'test_trip_layer_1',
+ config: {
+ color: [1, 2, 3],
+ dataId,
+ label: 'some trips',
+ columns: {
+ geojson: '_geojson'
+ }
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...prepareTripGeoDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+ const expectedLayerData = {
+ data: [dataToFeature[0], dataToFeature[2], dataToFeature[4]]
+ };
+ const expectedDataKeys = [
+ 'data',
+ 'getPath',
+ 'getTimestamps',
+ 'getFilterValue',
+ 'getColor',
+ 'getWidth'
+ ];
+
+ t.deepEqual(
+ Object.keys(layerData).sort(),
+ expectedDataKeys.sort(),
+ 'layerData should have 7 keys'
+ );
+ // data
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct geojson layerData'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getColor),
+ [
+ [1, 2, 3],
+ [1, 2, 3],
+ [1, 2, 3]
+ ],
+ 'getColor should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getFilterValue),
+ [
+ [Number.MIN_SAFE_INTEGER, 0, 0, 0],
+ [7 - valueFilterDomain0, 0, 0, 0],
+ [6 - valueFilterDomain0, 0, 0, 0]
+ ],
+ 'getFilterValue should return correct value'
+ );
+ t.deepEqual(
+ layerData.data.map(layerData.getWidth),
+ [defaultWidth, defaultWidth, defaultWidth],
+ 'getWidth should return correct value'
+ );
+ t.deepEqual(
+ layerData.getPath(layerData.data[0]),
+ dataToFeature[0].geometry.coordinates,
+ 'getPath should return correct coordinates'
+ );
+ t.deepEqual(
+ layerData.getTimestamps(layerData.data[0]),
+ dataToTimeStamp[0],
+ 'getWidth should return getTimestamps'
+ );
+ // meta
+ t.deepEqual(
+ Object.keys(layer.meta).sort(),
+ ['bounds', 'featureTypes', 'getFeature'],
+ 'should format correct geojson layer meta keys'
+ );
+ t.deepEqual(
+ layer.meta.bounds,
+ TripLayerMeta.bounds,
+ 'should format correct geojson layer meta bounds'
+ );
+ t.deepEqual(
+ layer.meta.featureTypes,
+ TripLayerMeta.featureTypes,
+ 'should format correct geojson layer meta featureTypes'
+ );
+ // dataToFeature
+ t.deepEqual(
+ layer.dataToTimeStamp,
+ dataToTimeStamp,
+ 'should format correct geojson dataToFeature'
+ );
+
+ t.deepEqual(
+ layer.dataToFeature,
+ dataToFeature,
+ 'should format correct geojson dataToFeature'
+ );
+ }
+ },
+ {
+ name: 'Trip Geojson.2',
+ layer: {
+ type: 'trip',
+ id: 'test_trip_layer_2',
+ config: {
+ color: [1, 2, 3],
+ dataId,
+ label: 'some trips',
+ columns: {
+ geojson: '_geojson'
+ },
+ // color by types(string)
+ colorField: {
+ type: 'string',
+ name: 'types'
+ },
+ // size by trip_distance(real)
+ sizeField: {
+ type: 'real',
+ name: 'trip_distance'
+ },
+ visConfig: {
+ colorRange: {
+ colors: ['#010101', '#020202', '#030303']
+ },
+ sizeRange: [10, 20]
+ }
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...prepareTripGeoDataset,
+ filteredIndex
+ }
+ },
+ assert: result => {
+ const {layerData, layer} = result;
+
+ const expectedLayerData = {
+ data: [dataToFeature[0], dataToFeature[2], dataToFeature[4]]
+ };
+ // data
+ t.deepEqual(
+ layerData.data,
+ expectedLayerData.data,
+ 'should format correct geojson layerData'
+ );
+ // getColor
+ // domain: ['driver_analytics', 'driver_analytics_0', 'driver_gps']
+ // range ['#010101', '#020202', '#030303']
+ t.deepEqual(
+ layerData.data.map(layerData.getColor),
+ [
+ [2, 2, 2],
+ [1, 1, 1],
+ [1, 1, 1]
+ ],
+ 'getColor should return correct value'
+ );
+ // getWidth
+ // domain: [2.37, 8.33]
+ // range: [10, 20]
+ // value [1.59, 2.83, 2.37]
+ t.deepEqual(
+ layerData.data.map(layerData.getWidth),
+ [8.691275167785234, 10.771812080536913, 10],
+ 'getWidth should return correct value'
+ );
+
+ // dataToFeature
+ t.deepEqual(
+ layer.dataToTimeStamp,
+ dataToTimeStamp,
+ 'should format correct geojson dataToFeature'
+ );
+
+ t.deepEqual(
+ layer.dataToFeature,
+ dataToFeature,
+ 'should format correct geojson dataToFeature'
+ );
+ }
+ }
+ ];
+
+ testFormatLayerDataCases(t, TripLayer, TEST_CASES);
+ t.end();
+});
+
+test('#TripLayer -> renderLayer', t => {
+ const filteredIndex = [0, 2, 4];
+
+ const TEST_CASES = [
+ {
+ name: 'Trip Geojson.1',
+ layer: {
+ type: 'trip',
+ id: 'test_trip_layer_1',
+ config: {
+ color: [1, 2, 3],
+ dataId,
+ label: 'some trips',
+ columns: {
+ geojson: '_geojson'
+ },
+ visConfig: {
+ colorRange: {
+ colors: ['#080808', '#090909', '#070707']
+ },
+ trailLength: 2
+ }
+ }
+ },
+ datasets: {
+ [dataId]: {
+ ...prepareTripGeoDataset,
+ filteredIndex
+ }
+ },
+ renderArgs: {
+ animationConfig
+ },
+ assert: (deckLayers, layer) => {
+ const ids = ['test_trip_layer_1'];
+ t.deepEqual(
+ deckLayers.map(l => l.id),
+ ids,
+ 'Should render 1 deck layers'
+ );
+
+ const deckTripLayer = deckLayers[0];
+ const expectedProps = {
+ trailLength: 2000,
+ rounded: true,
+ widthScale: 128,
+ currentTime: 0,
+ parameters: {depthTest: false, depthMask: false},
+ filterRange: [
+ [3, 11],
+ [0, 0],
+ [0, 0],
+ [0, 0]
+ ],
+ opacity: 0.8
+ };
+
+ Object.keys(expectedProps).forEach(key => {
+ t.deepEqual(
+ deckTripLayer.props[key],
+ expectedProps[key],
+ `should have correct props.${key}`
+ );
+ });
+
+ t.deepEqual(
+ deckTripLayer.props.extensions.map(cl => cl.constructor.name),
+ ['DataFilterExtension'],
+ 'Should provide DataFilterExtension'
+ );
+ // test attributes
+ const {attributes} = deckTripLayer.state.attributeManager;
+
+ // instanceStrokeWidths
+
+ const fvs = [
+ [Number.MIN_SAFE_INTEGER, 0, 0, 0],
+ [7 - valueFilterDomain0, 0, 0, 0],
+ [6 - valueFilterDomain0, 0, 0, 0]
+ ];
+
+ const numVertexs = [9, 7, 6];
+ const testLen = 9 + 7 + 6;
+ const expectedFilterValues = new Float32Array(testLen * 4);
+ const expectedColors = new Float32Array(testLen * 4);
+
+ const expectedTimestamps = new Float32Array([
+ 1077000,
+ 1085000,
+ 1085000,
+ 1095000,
+ 1095000,
+ 1103000,
+ 1103000,
+ 1104000,
+ 1104000,
+ 1106000,
+ 1106000,
+ 1107000,
+ 1107000,
+ 1110000,
+ 1110000,
+ 1112000,
+ 1112000,
+ 1114000,
+ 834000,
+ 862000,
+ 862000,
+ 864000,
+ 864000,
+ 895000,
+ 895000,
+ 920000,
+ 920000,
+ 953000,
+ 953000,
+ 976000,
+ 976000,
+ 989000,
+ 1405000,
+ 1433000,
+ 1433000,
+ 1451000,
+ 1451000,
+ 1471000,
+ 1471000,
+ 1495000,
+ 1495000,
+ 1517000,
+ 1517000,
+ 1575000
+ ]);
+
+ let c = 0;
+ for (let i = 0; i < 3; i++) {
+ for (let n = 0; n < numVertexs[i]; n++) {
+ expectedFilterValues[c + 0] = fvs[i][0];
+ expectedFilterValues[c + 1] = fvs[i][1];
+ expectedFilterValues[c + 2] = fvs[i][2];
+ expectedFilterValues[c + 3] = fvs[i][3];
+ expectedColors[c + 0] = 1;
+ expectedColors[c + 1] = 2;
+ expectedColors[c + 2] = 3;
+ expectedColors[c + 3] = 255;
+ c += 4;
+ }
+ }
+
+ const expectedStroke = new Float32Array([
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1
+ ])
+ t.deepEqual(
+ attributes.filterValues.value.slice(0, testLen * 4),
+ expectedFilterValues,
+ 'Should have correct filterValues'
+ );
+
+ t.deepEqual(
+ attributes.instanceTimestamps.value.slice(0, 44),
+ expectedTimestamps,
+ 'Should have correct instanceTimestamps'
+ );
+
+ t.deepEqual(
+ attributes.instanceColors.value.slice(0, testLen * 4),
+ expectedColors,
+ 'Should have correct instanceColors'
+ );
+
+ t.deepEqual(
+ attributes.instanceStrokeWidths.value.slice(0, testLen),
+ expectedStroke,
+ 'Should have correct instanceStrokeWidths'
+ );
+ // TODO: test UpdateTriggers
+ }
+ }
+ ];
+
+ testRenderLayerCases(t, TripLayer, TEST_CASES);
+ t.end();
+});
diff --git a/test/fixtures/geojson.js b/test/fixtures/geojson.js
index c521520e9..ccc05a735 100644
--- a/test/fixtures/geojson.js
+++ b/test/fixtures/geojson.js
@@ -18,117 +18,192 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-export const geojsonData = {
- type: 'FeatureCollection',
- features: [
- {
- type: 'Feature',
- properties: {
- OBJECTID: 1,
- ZIP_CODE: 94107,
- ID: 94107,
- TRIPS: 11,
- RATE: 'a'
- },
- geometry: {
- type: 'Polygon',
- coordinates: [
- [
- [-122.401159718585049, 37.782024266952142],
- [-122.400374366843309, 37.782644515545172],
- [-122.400019020063766, 37.782925153640136],
- [-122.399891477967842, 37.783025880124256],
- [-122.398930331092998, 37.783784933304034],
- [-122.397811613142864, 37.784666586003652],
- [-122.396705177550587, 37.785542130425938],
- [-122.395895701657864, 37.784896929203114],
- [-122.395160622349934, 37.78431101230386],
- [-122.394398389309941, 37.783701667981575],
- [-122.401159718585049, 37.782024266952142]
- ]
- ]
- }
- },
- {
- type: 'Feature',
- properties: {
- OBJECTID: 2,
- ZIP_CODE: 94105,
- ID: 94105,
- TRIPS: 4,
- RATE: 'b'
- },
- geometry: {
- type: 'Polygon',
- coordinates: [
- [
- [-122.39249932896719, 37.793768814133983],
- [-122.391890260341384, 37.794278544568918],
- [-122.391788865572423, 37.794170982455135],
- [-122.39173429034625, 37.79420276052317],
- [-122.391666728649753, 37.794132425256194],
- [-122.391723034266192, 37.79410061945832],
- [-122.391673228351905, 37.794047854124599],
- [-122.391982015107928, 37.793871906128679],
- [-122.39249932896719, 37.793768814133983]
- ]
- ]
- }
- },
- {
- type: 'Feature',
- properties: {
- OBJECTID: 3,
- ZIP_CODE: 94109,
- ID: 94109,
- TRIPS: 20
- },
- geometry: {
- type: 'Polygon',
- coordinates: [
- [
- [-122.39249932896719, 37.793768814133983],
- [-122.391890260341384, 37.794278544568918],
- [-122.391788865572423, 37.794170982455135],
- [-122.39173429034625, 37.79420276052317],
- [-122.391666728649753, 37.794132425256194],
- [-122.391723034266192, 37.79410061945832],
- [-122.391673228351905, 37.794047854124599],
- [-122.391982015107928, 37.793871906128679],
- [-122.39249932896719, 37.793768814133983]
- ]
- ]
- }
- },
- {
- type: 'Feature',
- properties: {
- OBJECTID: 4,
- ZIP_CODE: 94111,
- ID: 94111,
- RATE: 'c'
- },
- geometry: {
- type: 'Polygon',
- coordinates: [
- [
- [-122.39249932896719, 37.793768814133983],
- [-122.391890260341384, 37.794278544568918],
- [-122.391788865572423, 37.794170982455135],
- [-122.39173429034625, 37.79420276052317],
- [-122.391666728649753, 37.794132425256194],
- [-122.391723034266192, 37.79410061945832],
- [-122.391673228351905, 37.794047854124599],
- [-122.391982015107928, 37.793871906128679],
- [-122.39249932896719, 37.793768814133983]
- ]
- ]
- }
+import {extent} from 'd3-array';
+
+export const geoJsonDataId = 'ieukmgne';
+
+/**
+ *
+ * GeoJSON with Polygons
+ */
+const feature0 = {
+ type: 'Feature',
+ properties: {
+ OBJECTID: 1,
+ ZIP_CODE: 94107,
+ ID: 94107,
+ TRIPS: 11,
+ RATE: 'a',
+ OBJ: {
+ id: 1
}
- ]
+ },
+ geometry: {
+ type: 'Polygon',
+ coordinates: [
+ [
+ [-122.401159718585049, 37.782024266952142],
+ [-122.400374366843309, 37.782644515545172],
+ [-122.400019020063766, 37.782925153640136],
+ [-122.399891477967842, 37.783025880124256],
+ [-122.398930331092998, 37.783784933304034]
+ ]
+ ]
+ }
};
-export const geoJsonDataId = 'ieukmgne';
+const feature0Parsed = {
+ type: 'Feature',
+ geometry: feature0.geometry,
+ properties: {
+ ...feature0.properties,
+ OBJ: {id: 1}
+ }
+};
+
+const feature1 = {
+ type: 'Feature',
+ properties: {
+ OBJECTID: 2,
+ ZIP_CODE: 94105,
+ ID: 94105,
+ TRIPS: 4,
+ RATE: 'b',
+ OBJ: {
+ id: 2
+ }
+ },
+ geometry: {
+ type: 'Polygon',
+ coordinates: [
+ [
+ [-122.39249932896719, 37.793768814133983],
+ [-122.391890260341384, 37.794278544568918],
+ [-122.391666728649753, 37.794132425256194],
+ [-122.391723034266192, 37.79410061945832],
+ [-122.39249932896719, 37.793768814133983]
+ ]
+ ]
+ }
+};
+
+const feature1Parsed = {
+ type: 'Feature',
+ geometry: feature1.geometry,
+ properties: {
+ ...feature1.properties,
+ OBJ: {id: 2}
+ }
+};
+
+const feature2 = {
+ type: 'Feature',
+ properties: {
+ OBJECTID: 3,
+ ZIP_CODE: 94109,
+ ID: 94109,
+ TRIPS: 20,
+ RATE: null,
+ OBJ: {
+ id: 3
+ }
+ },
+ geometry: {
+ type: 'Polygon',
+ coordinates: [
+ [
+ [-122.39249932896719, 37.793768814133983],
+ [-122.391890260341384, 37.794278544568918],
+ [-122.391982015107928, 37.793871906128679],
+ [-122.39249932896719, 37.793768814133983]
+ ]
+ ]
+ }
+};
+
+const feature2Parsed = {
+ type: 'Feature',
+ geometry: feature2.geometry,
+ properties: {
+ ...feature2.properties,
+ OBJ: {id: 3}
+ }
+};
+
+const feature3 = {
+ type: 'Feature',
+ properties: {
+ OBJECTID: 4,
+ ZIP_CODE: 94111,
+ ID: 94111,
+ RATE: 'c',
+ OBJ: {
+ id: 4
+ }
+ },
+ geometry: {
+ type: 'Polygon',
+ coordinates: [
+ [
+ [-122.39249932896719, 37.793768814133983],
+ [-122.391666728649753, 37.794132425256194],
+ [-122.391723034266192, 37.79410061945832],
+ [-122.391673228351905, 37.794047854124599],
+ [-122.391982015107928, 37.793871906128679],
+ [-122.39249932896719, 37.793768814133983]
+ ]
+ ]
+ }
+};
+
+const feature3Parsed = {
+ type: 'Feature',
+ geometry: feature3.geometry,
+ properties: {
+ ...feature3.properties,
+ TRIPS: null,
+ OBJ: {id: 4}
+ }
+};
+
+const feature4 = {
+ type: 'Feature',
+ properties: {
+ OBJECTID: 5,
+ ZIP_CODE: 94107,
+ ID: 9409,
+ RATE: 'c',
+ OBJ: {
+ id: 5
+ }
+ },
+ geometry: {
+ type: 'Polygon',
+ coordinates: [
+ [
+ [-122.39249932896719, 37.793768814133983],
+ [-122.391890260341384, 37.794278544568918],
+ [-122.391788865572423, 37.794170982455135],
+ [-122.39249932896719, 37.793768814133983]
+ ]
+ ]
+ }
+}
+
+const feature4Parsed = {
+ type: 'Feature',
+ geometry: feature4.geometry,
+ properties: {
+ ...feature4.properties,
+ TRIPS: null,
+ OBJ: {id: 5}
+ }
+};
+
+export const geojsonData = {
+ type: 'FeatureCollection',
+ features: [feature0, feature1, feature2, feature3, feature4]
+};
export const fields = [
{
@@ -172,6 +247,13 @@ export const fields = [
format: '',
tableFieldIndex: 6,
analyzerType: 'STRING'
+ },
+ {
+ type: 'geojson',
+ name: 'OBJ',
+ format: '',
+ tableFieldIndex: 7,
+ analyzerType: 'OBJECT'
}
];
@@ -181,138 +263,11 @@ export const datasetFields = fields.map(f => ({
}));
export const rows = [
- [
- {
- type: 'Feature',
- properties: {
- OBJECTID: 1,
- ZIP_CODE: 94107,
- ID: 94107,
- TRIPS: 11,
- RATE: 'a'
- },
- geometry: {
- type: 'Polygon',
- coordinates: [
- [
- [-122.401159718585049, 37.782024266952142],
- [-122.400374366843309, 37.782644515545172],
- [-122.400019020063766, 37.782925153640136],
- [-122.399891477967842, 37.783025880124256],
- [-122.398930331092998, 37.783784933304034],
- [-122.397811613142864, 37.784666586003652],
- [-122.396705177550587, 37.785542130425938],
- [-122.395895701657864, 37.784896929203114],
- [-122.395160622349934, 37.78431101230386],
- [-122.394398389309941, 37.783701667981575],
- [-122.401159718585049, 37.782024266952142]
- ]
- ]
- }
- },
- 1,
- 94107,
- 94107,
- 11,
- 'a'
- ],
- [
- {
- type: 'Feature',
- properties: {
- OBJECTID: 2,
- ZIP_CODE: 94105,
- ID: 94105,
- TRIPS: 4,
- RATE: 'b'
- },
- geometry: {
- type: 'Polygon',
- coordinates: [
- [
- [-122.39249932896719, 37.793768814133983],
- [-122.391890260341384, 37.794278544568918],
- [-122.391788865572423, 37.794170982455135],
- [-122.39173429034625, 37.79420276052317],
- [-122.391666728649753, 37.794132425256194],
- [-122.391723034266192, 37.79410061945832],
- [-122.391673228351905, 37.794047854124599],
- [-122.391982015107928, 37.793871906128679],
- [-122.39249932896719, 37.793768814133983]
- ]
- ]
- }
- },
- 2,
- 94105,
- 94105,
- 4,
- 'b'
- ],
- [
- {
- type: 'Feature',
- properties: {
- OBJECTID: 3,
- ZIP_CODE: 94109,
- ID: 94109,
- TRIPS: 20
- },
- geometry: {
- type: 'Polygon',
- coordinates: [
- [
- [-122.39249932896719, 37.793768814133983],
- [-122.391890260341384, 37.794278544568918],
- [-122.391788865572423, 37.794170982455135],
- [-122.39173429034625, 37.79420276052317],
- [-122.391666728649753, 37.794132425256194],
- [-122.391723034266192, 37.79410061945832],
- [-122.391673228351905, 37.794047854124599],
- [-122.391982015107928, 37.793871906128679],
- [-122.39249932896719, 37.793768814133983]
- ]
- ]
- }
- },
- 3,
- 94109,
- 94109,
- 20,
- null
- ],
- [
- {
- type: 'Feature',
- properties: {
- OBJECTID: 4,
- ZIP_CODE: 94111,
- ID: 94111,
- RATE: 'c'
- },
- geometry: {
- type: 'Polygon',
- coordinates: [
- [
- [-122.39249932896719, 37.793768814133983],
- [-122.391890260341384, 37.794278544568918],
- [-122.391788865572423, 37.794170982455135],
- [-122.39173429034625, 37.79420276052317],
- [-122.391666728649753, 37.794132425256194],
- [-122.391723034266192, 37.79410061945832],
- [-122.391673228351905, 37.794047854124599],
- [-122.391982015107928, 37.793871906128679],
- [-122.39249932896719, 37.793768814133983]
- ]
- ]
- }
- },
- 4,
- 94111,
- 94111,
- null,
- 'c'
- ]
+ [feature0Parsed, 1, 94107, 94107, 11, 'a', {id: 1}],
+ [feature1Parsed, 2, 94105, 94105, 4, 'b', {id: 2}],
+ [feature2Parsed, 3, 94109, 94109, 20, null, {id: 3}],
+ [feature3Parsed, 4, 94111, 94111, null, 'c', {id: 4}],
+ [feature4Parsed, 5, 94107, 9409, null, 'c', {id: 5}]
];
// add index to properties
@@ -458,7 +413,8 @@ export const geoJsonTripFilterProps = {
step: 0.01,
type: 'range',
typeOptions: ['range'],
- value: [4, 20]
+ value: [4, 20],
+ gpu: true
};
export const mergedTripFilter = {
@@ -475,14 +431,16 @@ export const mergedTripFilter = {
value: [4, 12],
plotType: 'histogram',
yAxis: null,
- interval: null
+ interval: null,
+ gpuChannel: [0]
};
export const geoJsonRateFilterProps = {
domain: ['a', 'b', 'c'],
fieldType: 'string',
type: 'multiSelect',
- value: []
+ value: [],
+ gpu: false
};
export const mergedRateFilter = {
@@ -509,6 +467,35 @@ export const geoBounds = [
37.79427854456892
];
+export const expectedDataToFeature = [
+ feature0Parsed,
+ feature1Parsed,
+ feature2Parsed,
+ feature3Parsed,
+ feature4Parsed
+].map((f, i) => ({
+ ...f,
+ properties: {...f.properties, index: i}
+}));
+
+export const updatedGeoJsonLayer = {
+ dataToFeature: expectedDataToFeature,
+ meta: {
+ featureTypes: {polygon: true},
+ bounds: geoBounds,
+ fixedRadius: false
+ }
+};
+
+export const mappedTripValue = geojsonData.features.map(
+ f => f.properties.TRIPS
+);
+
+export const tripDomain = extent(mappedTripValue);
+
+/**
+ * GeoJSON with style properties
+ */
export const geoJsonWithStyle = {
type: 'FeatureCollection',
features: [
@@ -521,7 +508,7 @@ export const geoJsonWithStyle = {
elevation: 10,
radius: 5
},
- geometry: {type: 'Point', coordinates: [[-122, 37]]}
+ geometry: {type: 'Point', coordinates: [-122.1, 37.3]}
},
{
type: 'Feature',
@@ -532,7 +519,7 @@ export const geoJsonWithStyle = {
elevation: 10,
radius: 5
},
- geometry: {type: 'Point', coordinates: [[-122, 37]]}
+ geometry: {type: 'Point', coordinates: [-122.2, 37.2]}
},
{
type: 'Feature',
@@ -543,7 +530,7 @@ export const geoJsonWithStyle = {
elevation: 10,
radius: 5
},
- geometry: {type: 'Point', coordinates: [[-122, 37]]}
+ geometry: {type: 'Point', coordinates: [-122.3, 37.1]}
}
]
};
@@ -599,3 +586,21 @@ export const geoStyleRows = [
[geoJsonWithStyle.features[1], [7, 8, 9], [4, 5, 6], 3, 10, 5],
[geoJsonWithStyle.features[2], [1, 2, 3], [4, 5, 6], 4, 10, 5]
];
+
+export const geoStyleDataToFeature = geoJsonWithStyle.features.map((f, i) => ({
+ ...f,
+ properties: {...f.properties, index: i}
+}));
+
+export const geoStyleBounds = [
+ -122.3,
+ 37.1,
+ -122.1,
+ 37.3
+];
+
+export const geoStyleMeta = {
+ featureTypes: {point: true},
+ bounds: geoStyleBounds,
+ fixedRadius: true
+};
diff --git a/test/fixtures/state-saved-v0.js b/test/fixtures/state-saved-v0.js
index 8ce62f695..5a36e58b9 100644
--- a/test/fixtures/state-saved-v0.js
+++ b/test/fixtures/state-saved-v0.js
@@ -919,7 +919,8 @@ export const mergedFilters = [
yAxis: null,
interval: null,
speed: 1,
- fixedDomain: false
+ fixedDomain: false,
+ gpu: false
},
{
dataId: ['9h10t7fyb'],
@@ -951,7 +952,9 @@ export const mergedFilters = [
1453770540000
],
fieldType: 'timestamp',
- fixedDomain: true
+ fixedDomain: true,
+ gpu: true,
+ gpuChannel: [0]
},
{
dataId: ['9h10t7fyb'],
@@ -969,7 +972,8 @@ export const mergedFilters = [
yAxis: null,
interval: null,
speed: 1,
- fixedDomain: false
+ fixedDomain: false,
+ gpu: false
},
{
dataId: ['9h10t7fyb'],
@@ -991,7 +995,9 @@ export const mergedFilters = [
speed: 1,
fieldType: 'integer',
typeOptions: ['range'],
- fixedDomain: false
+ fixedDomain: false,
+ gpu: true,
+ gpuChannel: [1]
},
{
dataId: ['v79816te8'],
@@ -1013,7 +1019,9 @@ export const mergedFilters = [
speed: 1,
fieldType: 'integer',
typeOptions: ['range'],
- fixedDomain: false
+ fixedDomain: false,
+ gpu: true,
+ gpuChannel: [0]
}
];
@@ -1182,7 +1190,7 @@ mergedLayer2.config = {
analyzerType: 'INT'
},
sizeDomain: [78, 694],
- sizeScale: 'linear',
+ sizeScale: 'sqrt',
textLabel: [DEFAULT_TEXT_LABEL],
colorUI: {
color: DEFAULT_COLOR_UI,
diff --git a/test/fixtures/state-saved-v1-1.js b/test/fixtures/state-saved-v1-1.js
index df356db5c..57ec48f91 100644
--- a/test/fixtures/state-saved-v1-1.js
+++ b/test/fixtures/state-saved-v1-1.js
@@ -855,7 +855,9 @@ export const mergedFilters = [
speed: 1,
fieldType: 'real',
typeOptions: ['range'],
- fixedDomain: false
+ fixedDomain: false,
+ gpu: true,
+ gpuChannel: [0]
}
];
diff --git a/test/fixtures/state-saved-v1-5.js b/test/fixtures/state-saved-v1-5.js
index 434cca14a..fb4e25ae8 100644
--- a/test/fixtures/state-saved-v1-5.js
+++ b/test/fixtures/state-saved-v1-5.js
@@ -21,8 +21,7 @@
import tripGeojson, {
timeStampDomain,
tripBounds,
- dataToTimeStamp,
- dataToFeature
+ dataToTimeStamp
} from 'test/fixtures/trip-geojson';
import {
DEFAULT_TEXT_LABEL,
@@ -287,7 +286,80 @@ mergedLayer0.config = {
animation: {enabled: true, domain: timeStampDomain}
};
-mergedLayer0.dataToFeature = dataToFeature;
+mergedLayer0.dataToFeature = [
+ {
+ type: 'Feature',
+ properties: {
+ vendor: 'A',
+ index: 0
+ },
+ geometry: tripGeojson.features[0].geometry
+ },
+ {
+ type: 'Feature',
+ properties: {
+ vendor: 'B',
+ index: 1
+ },
+ geometry: tripGeojson.features[1].geometry
+ },
+ {
+ type: 'Feature',
+ properties: {
+ vendor: 'A',
+ index: 2
+ },
+ geometry: tripGeojson.features[2].geometry
+ },
+ {
+ type: 'Feature',
+ properties: {
+ vendor: 'A',
+ index: 3
+ },
+ geometry: tripGeojson.features[3].geometry
+ },
+ {
+ type: 'Feature',
+ properties: {
+ vendor: 'A',
+ index: 4
+ },
+ geometry: tripGeojson.features[4].geometry
+ },
+ {
+ type: 'Feature',
+ properties: {
+ vendor: 'A',
+ index: 5
+ },
+ geometry: tripGeojson.features[5].geometry
+ },
+ {
+ type: 'Feature',
+ properties: {
+ vendor: 'B',
+ index: 6
+ },
+ geometry: tripGeojson.features[6].geometry
+ },
+ {
+ type: 'Feature',
+ properties: {
+ vendor: 'A',
+ index: 7
+ },
+ geometry: tripGeojson.features[7].geometry
+ },
+ {
+ type: 'Feature',
+ properties: {
+ vendor: 'A',
+ index: 8
+ },
+ geometry: tripGeojson.features[8].geometry
+ }
+];
mergedLayer0.dataToTimeStamp = dataToTimeStamp;
mergedLayer0.meta.bounds = tripBounds;
mergedLayer0.meta.featureTypes = {line: true};
diff --git a/test/fixtures/test-csv-data.js b/test/fixtures/test-csv-data.js
index 7457097a3..27594eaaf 100644
--- a/test/fixtures/test-csv-data.js
+++ b/test/fixtures/test-csv-data.js
@@ -20,7 +20,7 @@
/* eslint-disable max-lens */
const data = `gps_data.utc_timestamp,gps_data.lat,gps_data.lng,gps_data.types,epoch,has_result,id,time,begintrip_ts_utc,begintrip_ts_local,date
-2016-09-17 00:09:55,29.9900937,31.2590542,driver_analytics,1472688000000,False,1,2016-09-23T00:00:00.000Z,2016-10-01 09:41:39+00:00,2016-10-01 09:41:39+00:00,2016-09-23
+2016-09-17 00:09:55,29.9900937,31.2590542,driver_analytics_0,1472688000000,False,1,2016-09-23T00:00:00.000Z,2016-10-01 09:41:39+00:00,2016-10-01 09:41:39+00:00,2016-09-23
2016-09-17 00:10:56,29.9927699,31.2461142,driver_analytics,1472688000000,False,2,2016-09-23T00:00:00.000Z,2016-10-01 09:46:37+00:00,2016-10-01 16:46:37+00:00,2016-09-23
2016-09-17 00:11:56,29.9907261,31.2312742,driver_analytics,1472688000000,False,3,2016-09-23T00:00:00.000Z,,,2016-09-23
2016-09-17 00:12:58,29.9870074,31.2175827,driver_analytics,1472688000000,False,4,2016-09-23T00:00:00.000Z,,,2016-09-23
@@ -264,26 +264,26 @@ export const sampleConfig = {
};
export const dataWithNulls = `gps_data.utc_timestamp,gps_data.lat,gps_data.lng,gps_data.types,epoch,has_result,id,time,begintrip_ts_utc,begintrip_ts_local,date
-2016-09-17 00:09:55,29.9900937,31.2590542,driver_analytics,1472688000000,False,1,2016-09-23T00:00:00.000Z,2016-10-01 09:41:39+00:00,2016-10-01 09:41:39+00:00,2016-09-23
-2016-09-17 00:10:56,29.9927699,31.2461142,driver_analytics,1472688000000,False,null,2016-09-23T00:00:00.000Z,2016-10-01 09:46:37+00:00,2016-10-01 16:46:37+00:00,2016-09-23
+Null,29.9900937,31.2590542,driver_analytics_0,1472688000000,False,1,2016-09-23T00:00:00.000Z,2016-10-01 09:41:39+00:00,2016-10-01 09:41:39+00:00,2016-09-23
+2016-09-17 00:10:56,29.9927699,31.2461142,null,1472688000000,False,null,2016-09-23T00:00:00.000Z,2016-10-01 09:46:37+00:00,2016-10-01 16:46:37+00:00,2016-09-23
2016-09-17 00:11:56,29.9907261,NaN,driver_analytics,1472688000000,False,3,2016-09-23T00:00:00.000Z,,,2016-09-23
-2016-09-17 00:12:58,29.9870074,31.2175827,driver_analytics,1472688000000,False,4,2016-09-23T00:00:00.000Z,,,2016-09-23
+2016-09-17 00:12:58,29.9870074,31.2175827,driver_gps,1472688000000,False,4,2016-09-23T00:00:00.000Z,,,2016-09-23
2016-09-17 00:14:00,29.9923041,31.2154899,driver_analytics,1472688000000,1,5,2016-09-23T00:00:00.000Z,2016-10-01 09:47:37+00:00,2016-10-01 16:47:37+00:00,
2016-09-17 00:15:01,29.9968249,31.2149361,driver_analytics,1472688000000,False,12124,2016-09-23T05:00:00.000Z,,,
2016-09-17 00:16:03,Null,31.2164035,driver_analytics,1472688000000,False,222,2016-09-23T05:00:00.000Z,,,
2016-09-17 00:17:05,30.0116207,31.2179346,driver_analytics,1472688000000,False,345,2016-09-23T00:00:00.000Z,,,2016-09-24
2016-09-17 00:18:09,30.0208925,31.2179556,driver_analytics,1472708000000,False,,2016-09-23T00:00:00.000Z,,,2016-09-24
2016-09-17 00:19:12,30.0218999,31.2178842,driver_analytics,NULL,0,,2016-09-23T06:00:00.000Z,,,2016-09-24
-2016-09-17 00:19:27,30.0229344,31.2179138,driver_analytics,1472708000000,False,,2016-09-23T05:00:00.000Z,,,2016-09-24
-2016-09-17 00:20:14,30.0264237,31.2179415,driver_analytics,1472708000000,False,,,,,2016-09-24
-2016-09-17 00:21:17,30.0292134,31.2181809,driver_analytics,1472754400000,False,,,,,2016-09-24`;
+2016-09-17 00:19:27,30.0229344,31.2179138,driver_gps,1472708000000,False,,2016-09-23T05:00:00.000Z,,,2016-09-24
+2016-09-17 00:20:14,30.0264237,31.2179415,driver_gps,1472708000000,False,,,,,2016-09-24
+2016-09-17 00:21:17,30.0292134,31.2181809,driver_gps,1472754400000,False,,,,,2016-09-24`;
export const parsedDataWithNulls = [
[
- '2016-09-17 00:09:55',
+ null,
29.9900937,
31.2590542,
- 'driver_analytics',
+ 'driver_analytics_0',
1472688000000,
false,
1,
@@ -296,7 +296,7 @@ export const parsedDataWithNulls = [
'2016-09-17 00:10:56',
29.9927699,
31.2461142,
- 'driver_analytics',
+ null,
1472688000000,
false,
null,
@@ -322,7 +322,7 @@ export const parsedDataWithNulls = [
'2016-09-17 00:12:58',
29.9870074,
31.2175827,
- 'driver_analytics',
+ 'driver_gps',
1472688000000,
false,
4,
@@ -413,7 +413,7 @@ export const parsedDataWithNulls = [
'2016-09-17 00:19:27',
30.0229344,
31.2179138,
- 'driver_analytics',
+ 'driver_gps',
1472708000000,
false,
null,
@@ -426,7 +426,7 @@ export const parsedDataWithNulls = [
'2016-09-17 00:20:14',
30.0264237,
31.2179415,
- 'driver_analytics',
+ 'driver_gps',
1472708000000,
false,
null,
@@ -439,7 +439,7 @@ export const parsedDataWithNulls = [
'2016-09-17 00:21:17',
30.0292134,
31.2181809,
- 'driver_analytics',
+ 'driver_gps',
1472754400000,
false,
null,
@@ -452,12 +452,12 @@ export const parsedDataWithNulls = [
export const wktCsv = `a_zip,simplified_shape_v2,simplified_shape,m_rate,c_zip_type,c_number
7015,,,7,C_Medium_High,22.22
-7014,"{""type"":""Polygon"",""coordinates"":[[[-74.158491,40.835947],[-74.157914,40.83902],[-74.148473,40.834522]]]}","POLYGON ((-74.158491 40.835947, -74.157914 40.83902, -74.148473 40.834522))",7.5,C_Medium_High,29.07437458
-7016,"{""type"":""Polygon"",""coordinates"":[[[-74.31687,40.656696],[-74.319449,40.658154],[-74.31687,40.656696]]]}","POLYGON ((-74.31687 40.656696, -74.319449 40.658154, -74.31687 40.656696))",6.5,C_Medium_High,27.60106201
-7023,"{""type"":""Polygon"",""coordinates"":[[[-74.387589,40.632238],[-74.387589,40.632238]]]}","POLYGON ((-74.387589 40.632238, -74.387589 40.632238))",7.6,C_Medium_High,23.85239437
-7029,"{""type"":""Polygon"",""coordinates"":[[[-74.165995,40.747969],[-74.165987,40.745199],[-74.165995,40.747969]]]}","POLYGON ((-74.165995 40.747969, -74.165987 40.745199, -74.165995 40.747969))",11.8,C_Medium_High,39.13775443
-7416,"{""type"":""MultiPolygon"",""coordinates"":[[[[-74.566993,41.087294],[-74.564908,41.089339],[-74.552353,41.091647],[-74.566993,41.087294]]],[[[-74.593264,41.088526],[-74.593264,41.088526]]]]}","MULTIPOLYGON (((-74.566993 41.087294, -74.564908 41.089339, -74.552353 41.091647, -74.566993 41.087294)),((-74.593264 41.088526, -74.593264 41.088526)))",10,A_Low_Rural,13.81679389
-7023,"{""type"":""LineString"",""coordinates"":[[-74.387589,40.632238],[-74.387589,40.632238]]}","LINESTRING (-74.387589 40.632238, -74.387589 40.632238)",7.6,C_Medium_High,23.85239437
+7014,"{""type"":""Polygon"",""coordinates"":[[[-74.158491,40.835947],[-74.157914,40.83902],[-74.148473,40.834522]]]}","POLYGON ((-74.158491 40.835947, -74.157914 40.83902, -74.148473 40.834522))",7.5,C_Medium_High,29.1
+7016,"{""type"":""Polygon"",""coordinates"":[[[-74.31687,40.656696],[-74.319449,40.658154],[-74.31687,40.656696]]]}","POLYGON ((-74.31687 40.656696, -74.319449 40.658154, -74.31687 40.656696))",,C_Medium_High,27.6
+7023,"{""type"":""Polygon"",""coordinates"":[[[-74.387589,40.632238],[-74.387589,40.632238]]]}","POLYGON ((-74.387589 40.632238, -74.387589 40.632238))",7.6,C_Medium_High,23.8
+7029,"{""type"":""Polygon"",""coordinates"":[[[-74.165995,40.747969],[-74.165987,40.745199],[-74.165995,40.747969]]]}","POLYGON ((-74.165995 40.747969, -74.165987 40.745199, -74.165995 40.747969))",11.8,C_Medium_High,39.1
+7416,"{""type"":""MultiPolygon"",""coordinates"":[[[[-74.566993,41.087294],[-74.564908,41.089339],[-74.552353,41.091647],[-74.566993,41.087294]]],[[[-74.593264,41.088526],[-74.593264,41.088526]]]]}","MULTIPOLYGON (((-74.566993 41.087294, -74.564908 41.089339, -74.552353 41.091647, -74.566993 41.087294)),((-74.593264 41.088526, -74.593264 41.088526)))",10,A_Low_Rural,13.8
+7023,"{""type"":""LineString"",""coordinates"":[[-74.387589,40.632238],[-74.387589,40.632238]]}","LINESTRING (-74.387589 40.632238, -74.387589 40.632238)",7.6,C_Medium_High,29.2
`;
// csv data
@@ -575,6 +575,33 @@ export const timeMappedValue = [
1474617600000
];
+export const epochMappedValue = [
+ 1472688000000,
+ 1472688000000,
+ 1472688000000,
+ 1472688000000,
+ 1472688000000,
+ 1472688000000,
+ 1472688000000,
+ 1472688000000,
+ 1472708000000,
+ 1472708000000,
+ 1472708000000,
+ 1472708000000,
+ 1472754400000,
+ 1472754400000,
+ 1472754400000,
+ 1472754400000,
+ 1472774400000,
+ 1472774400000,
+ 1472774400000,
+ 1472774400000,
+ 1472774400000,
+ 1472774400000,
+ 1472774400000,
+ 1472774400000
+];
+
export const timeHistogram = [
{count: 8, x0: 1474588800000, x1: 1474589000000},
{count: 0, x0: 1474589000000, x1: 1474590000000},
@@ -766,6 +793,7 @@ export const timeFilterProps = {
type: 'timeRange',
enlarged: true,
fixedDomain: true,
+ gpu: true,
value: [1474588800000, 1474617600000]
};
@@ -784,13 +812,50 @@ export const mergedTimeFilter = {
plotType: 'histogram',
yAxis: null,
interval: null,
- value: [1474606800000, 1474617600000]
+ value: [1474606800000, 1474617600000],
+ gpuChannel: [0]
+};
+
+export const epochFilterProps = {
+ domain: [1472688000000, 1472774400000],
+ step: 1000,
+ mappedValue: epochMappedValue,
+ histogram: 'dont test me',
+ enlargedHistogram: 'dont test me',
+ fieldType: 'timestamp',
+ type: 'timeRange',
+ enlarged: true,
+ fixedDomain: true,
+ gpu: true,
+ value: [1472688000000, 1472774400000]
+};
+
+// value set mockStateWithFilters 1472700000000, 1472760000000
+export const mergedEpochFilter = {
+ ...epochFilterProps,
+ dataId: [dataId],
+ freeze: true,
+ id: 'epoch-1',
+ fixedDomain: true,
+ enlarged: true,
+ isAnimating: false,
+ speed: 1,
+ name: ['epoch'],
+ type: 'timeRange',
+ fieldIdx: [4],
+ plotType: 'histogram',
+ yAxis: null,
+ interval: null,
+ value: [1472700000000, 1472760000000],
+ // time filter is in channel 0
+ gpuChannel: [1]
};
export const dateFilterProps ={
domain: ['2016-09-23', '2016-09-24', '2016-10-10'],
fieldType: 'date',
type: 'multiSelect',
+ gpu: false,
value: []
}
@@ -857,12 +922,64 @@ export const wktCsvFields = [
}
];
+export const wktCsvRows = [
+ [ 7015, null, null, 7, 'C_Medium_High', 22.22 ],
+ [
+ 7014,
+ '{"type":"Polygon","coordinates":[[[-74.158491,40.835947],[-74.157914,40.83902],[-74.148473,40.834522]]]}',
+ 'POLYGON ((-74.158491 40.835947, -74.157914 40.83902, -74.148473 40.834522))',
+ 7.5,
+ 'C_Medium_High',
+ 29.1
+ ],
+ [
+ 7016,
+ '{"type":"Polygon","coordinates":[[[-74.31687,40.656696],[-74.319449,40.658154],[-74.31687,40.656696]]]}',
+ 'POLYGON ((-74.31687 40.656696, -74.319449 40.658154, -74.31687 40.656696))',
+ null,
+ 'C_Medium_High',
+ 27.6
+ ],
+ [
+ 7023,
+ '{"type":"Polygon","coordinates":[[[-74.387589,40.632238],[-74.387589,40.632238]]]}',
+ 'POLYGON ((-74.387589 40.632238, -74.387589 40.632238))',
+ 7.6,
+ 'C_Medium_High',
+ 23.8
+ ],
+ [
+ 7029,
+ '{"type":"Polygon","coordinates":[[[-74.165995,40.747969],[-74.165987,40.745199],[-74.165995,40.747969]]]}',
+ 'POLYGON ((-74.165995 40.747969, -74.165987 40.745199, -74.165995 40.747969))',
+ 11.8,
+ 'C_Medium_High',
+ 39.1
+ ],
+ [
+ 7416,
+ '{"type":"MultiPolygon","coordinates":[[[[-74.566993,41.087294],[-74.564908,41.089339],[-74.552353,41.091647],[-74.566993,41.087294]]],[[[-74.593264,41.088526],[-74.593264,41.088526]]]]}',
+ 'MULTIPOLYGON (((-74.566993 41.087294, -74.564908 41.089339, -74.552353 41.091647, -74.566993 41.087294)),((-74.593264 41.088526, -74.593264 41.088526)))',
+ 10,
+ 'A_Low_Rural',
+ 13.8
+ ],
+ [
+ 7023,
+ '{"type":"LineString","coordinates":[[-74.387589,40.632238],[-74.387589,40.632238]]}',
+ 'LINESTRING (-74.387589 40.632238, -74.387589 40.632238)',
+ 7.6,
+ 'C_Medium_High',
+ 29.2
+ ]
+];
+
export const testAllData = [
[
'2016-09-17 00:09:55',
29.9900937,
31.2590542,
- 'driver_analytics',
+ 'driver_analytics_0',
1472688000000,
false,
1,
@@ -1174,6 +1291,7 @@ export const testAllData = [
export default data;
+// geojson layer from wktcsv
export const updatedLayerV2 = {
dataToFeature: [
null,
diff --git a/test/fixtures/test-hex-id-data.js b/test/fixtures/test-hex-id-data.js
index 247b6ad06..06e2cc6d6 100644
--- a/test/fixtures/test-hex-id-data.js
+++ b/test/fixtures/test-hex-id-data.js
@@ -29,80 +29,14 @@ export default `hex_id,value
89283082817ffff,74
89283082c3bffff,66
89283082883ffff,76
-89283082c03ffff,60
-89283082807ffff,68
-8928308289bffff,49
-89283082c0fffff,41
-89283082c87ffff,50
-89283082d4fffff,45
-89283082c77ffff,41
-89283082c2bffff,53
-89283082803ffff,41
-89283082813ffff,43
-89283082d5bffff,45
-89283082897ffff,40
-89283082c67ffff,42
-89283082d47ffff,51
-89283082dc3ffff,52
89283082c33ffff,43
89283082c23ffff,40
89283082887ffff,36
-89283082d4bffff,36
-892830828bbffff,48
-892830828b7ffff,28
-89283082c17ffff,34
-89283082c6fffff,21
-8928308288bffff,25
-892830828abffff,26
-89283082c27ffff,27
-89283082c8fffff,33
-89283082cafffff,29
-89283082c13ffff,27
-89283082cabffff,22
-89283082c63ffff,26
-89283082d43ffff,30
-89283082d53ffff,19
-892830828a3ffff,28
-89283082d1bffff,20
-89283095367ffff,17
-8928309536bffff,26
-89283082c37ffff,16
-89283082c73ffff,17
-89283082c8bffff,15
89283082ca7ffff,27
89283082cb3ffff,32
89283082c0bffff,26
89283082ca3ffff,19
89283082dcfffff,18
-89283082c1bffff,20
-89283082ddbffff,18
-8928309534fffff,16
-89283082d03ffff,15
-89283082cbbffff,21
-89283082cd7ffff,9
-8928309534bffff,9
-892830828c7ffff,13
-89283082cc7ffff,12
-89283082d0bffff,19
-89283082dcbffff,19
-89283082dd3ffff,15
-89283082dd7ffff,15
-892830828d7ffff,13
-89283082d17ffff,5
-8928309536fffff,8
-89283095373ffff,6
-89283082cb7ffff,15
-89283082d83ffff,9
-89283082d07ffff,4
-89283082d0fffff,3
-89283082d13ffff,6
-89283082d9bffff,5
-89283082c83ffff,11
-89283082d8bffff,4
-89283082dc7ffff,5
-89283095377ffff,5
-89283082c97ffff,4
-89283082d7bffff,2
89283082d8fffff,1
89283095347ffff,3
89283095363ffff,2
@@ -126,7 +60,7 @@ export const hexIdDataConfig = {
id: 'byjasfp0u',
name: 'value',
type: 'range',
- value: [11.2, 18],
+ value: [11.2, 28],
enlarged: false,
plotType: 'histogram',
yAxis: null
@@ -227,7 +161,7 @@ export const mergedFilters = [
id: 'value',
name: ['value'],
type: 'range',
- value: [11.2, 18],
+ value: [11.2, 28],
enlarged: false,
freeze: true,
plotType: 'histogram',
@@ -242,122 +176,13 @@ export const mergedFilters = [
speed: 1,
fieldType: 'integer',
typeOptions: ['range'],
- fixedDomain: false
+ fixedDomain: false,
+ gpuChannel: [0],
+ gpu: true
}
];
-const allData = [
- ['89283082c2fffff', 64],
- ['8928308288fffff', 73],
- ['89283082c07ffff', 65],
- ['89283082817ffff', 74],
- ['89283082c3bffff', 66],
- ['89283082883ffff', 76],
- ['89283082c03ffff', 60],
- ['89283082807ffff', 68],
- ['8928308289bffff', 49],
- ['89283082c0fffff', 41],
- ['89283082c87ffff', 50],
- ['89283082d4fffff', 45],
- ['89283082c77ffff', 41],
- ['89283082c2bffff', 53],
- ['89283082803ffff', 41],
- ['89283082813ffff', 43],
- ['89283082d5bffff', 45],
- ['89283082897ffff', 40],
- ['89283082c67ffff', 42],
- ['89283082d47ffff', 51],
- ['89283082dc3ffff', 52],
- ['89283082c33ffff', 43],
- ['89283082c23ffff', 40],
- ['89283082887ffff', 36],
- ['89283082d4bffff', 36],
- ['892830828bbffff', 48],
- ['892830828b7ffff', 28],
- ['89283082c17ffff', 34],
- ['89283082c6fffff', 21],
- ['8928308288bffff', 25],
- ['892830828abffff', 26],
- ['89283082c27ffff', 27],
- ['89283082c8fffff', 33],
- ['89283082cafffff', 29],
- ['89283082c13ffff', 27],
- ['89283082cabffff', 22],
- ['89283082c63ffff', 26],
- ['89283082d43ffff', 30],
- ['89283082d53ffff', 19],
- ['892830828a3ffff', 28],
- ['89283082d1bffff', 20],
- ['89283095367ffff', 17],
- ['8928309536bffff', 26],
- ['89283082c37ffff', 16],
- ['89283082c73ffff', 17],
- ['89283082c8bffff', 15],
- ['89283082ca7ffff', 27],
- ['89283082cb3ffff', 32],
- ['89283082c0bffff', 26],
- ['89283082ca3ffff', 19],
- ['89283082dcfffff', 18],
- ['89283082c1bffff', 20],
- ['89283082ddbffff', 18],
- ['8928309534fffff', 16],
- ['89283082d03ffff', 15],
- ['89283082cbbffff', 21],
- ['89283082cd7ffff', 9],
- ['8928309534bffff', 9],
- ['892830828c7ffff', 13],
- ['89283082cc7ffff', 12],
- ['89283082d0bffff', 19],
- ['89283082dcbffff', 19],
- ['89283082dd3ffff', 15],
- ['89283082dd7ffff', 15],
- ['892830828d7ffff', 13],
- ['89283082d17ffff', 5],
- ['8928309536fffff', 8],
- ['89283095373ffff', 6],
- ['89283082cb7ffff', 15],
- ['89283082d83ffff', 9],
- ['89283082d07ffff', 4],
- ['89283082d0fffff', 3],
- ['89283082d13ffff', 6],
- ['89283082d9bffff', 5],
- ['89283082c83ffff', 11],
- ['89283082d8bffff', 4],
- ['89283082dc7ffff', 5],
- ['89283095377ffff', 5],
- ['89283082c97ffff', 4],
- ['89283082d7bffff', 2],
- ['89283082d8fffff', 1],
- ['89283095347ffff', 3],
- ['89283095363ffff', 2],
- ['8928309537bffff', 4],
- ['89283082d93ffff', 6],
- ['89283082d73ffff', 1],
- ['8928309530bffff', 1],
- ['8928309532bffff', 1]
-];
-
-const filteredData = [
- ['89283095367ffff', 17],
- ['89283082c37ffff', 16],
- ['89283082c73ffff', 17],
- ['89283082c8bffff', 15],
- ['89283082dcfffff', 18],
- ['89283082ddbffff', 18],
- ['8928309534fffff', 16],
- ['89283082d03ffff', 15],
- ['892830828c7ffff', 13],
- ['89283082cc7ffff', 12],
- ['89283082dd3ffff', 15],
- ['89283082dd7ffff', 15],
- ['892830828d7ffff', 13],
- ['89283082cb7ffff', 15]
-];
-
-const filteredIndex = [41, 43, 44, 45, 50, 52, 53, 54, 58, 59, 62, 63, 64, 68];
-const filteredIndexForDomain = [41, 43, 44, 45, 50, 52, 53, 54, 58, 59, 62, 63, 64, 68];
-
-const fields = [
+const mergedFields = [
{
name: 'hex_id',
format: '',
@@ -378,40 +203,40 @@ const fields = [
step: 0.1,
histogram: [
{count: 4, x0: 1, x1: 2},
- {count: 4, x0: 2, x1: 4},
- {count: 8, x0: 4, x1: 6},
- {count: 3, x0: 6, x1: 8},
- {count: 4, x0: 8, x1: 10},
- {count: 1, x0: 10, x1: 12},
- {count: 3, x0: 12, x1: 14},
- {count: 5, x0: 14, x1: 16},
- {count: 4, x0: 16, x1: 18},
- {count: 6, x0: 18, x1: 20},
- {count: 4, x0: 20, x1: 22},
- {count: 1, x0: 22, x1: 24},
- {count: 1, x0: 24, x1: 26},
- {count: 7, x0: 26, x1: 28},
- {count: 3, x0: 28, x1: 30},
- {count: 1, x0: 30, x1: 32},
- {count: 2, x0: 32, x1: 34},
- {count: 1, x0: 34, x1: 36},
- {count: 2, x0: 36, x1: 38},
+ {count: 2, x0: 2, x1: 4},
+ {count: 1, x0: 4, x1: 6},
+ {count: 1, x0: 6, x1: 8},
+ {count: 0, x0: 8, x1: 10},
+ {count: 0, x0: 10, x1: 12},
+ {count: 0, x0: 12, x1: 14},
+ {count: 0, x0: 14, x1: 16},
+ {count: 0, x0: 16, x1: 18},
+ {count: 2, x0: 18, x1: 20},
+ {count: 0, x0: 20, x1: 22},
+ {count: 0, x0: 22, x1: 24},
+ {count: 0, x0: 24, x1: 26},
+ {count: 2, x0: 26, x1: 28},
+ {count: 0, x0: 28, x1: 30},
+ {count: 0, x0: 30, x1: 32},
+ {count: 1, x0: 32, x1: 34},
+ {count: 0, x0: 34, x1: 36},
+ {count: 1, x0: 36, x1: 38},
{count: 0, x0: 38, x1: 40},
- {count: 5, x0: 40, x1: 42},
- {count: 3, x0: 42, x1: 44},
- {count: 2, x0: 44, x1: 46},
+ {count: 1, x0: 40, x1: 42},
+ {count: 1, x0: 42, x1: 44},
+ {count: 0, x0: 44, x1: 46},
{count: 0, x0: 46, x1: 48},
- {count: 2, x0: 48, x1: 50},
- {count: 2, x0: 50, x1: 52},
- {count: 2, x0: 52, x1: 54},
+ {count: 0, x0: 48, x1: 50},
+ {count: 0, x0: 50, x1: 52},
+ {count: 0, x0: 52, x1: 54},
{count: 0, x0: 54, x1: 56},
{count: 0, x0: 56, x1: 58},
{count: 0, x0: 58, x1: 60},
- {count: 1, x0: 60, x1: 62},
+ {count: 0, x0: 60, x1: 62},
{count: 0, x0: 62, x1: 64},
{count: 2, x0: 64, x1: 66},
{count: 1, x0: 66, x1: 68},
- {count: 1, x0: 68, x1: 70},
+ {count: 0, x0: 68, x1: 70},
{count: 0, x0: 70, x1: 72},
{count: 1, x0: 72, x1: 74},
{count: 1, x0: 74, x1: 76},
@@ -419,65 +244,65 @@ const fields = [
],
enlargedHistogram: [
{count: 4, x0: 1, x1: 2},
- {count: 2, x0: 2, x1: 3},
- {count: 2, x0: 3, x1: 4},
- {count: 4, x0: 4, x1: 5},
- {count: 4, x0: 5, x1: 6},
- {count: 3, x0: 6, x1: 7},
+ {count: 1, x0: 2, x1: 3},
+ {count: 1, x0: 3, x1: 4},
+ {count: 1, x0: 4, x1: 5},
+ {count: 0, x0: 5, x1: 6},
+ {count: 1, x0: 6, x1: 7},
{count: 0, x0: 7, x1: 8},
- {count: 1, x0: 8, x1: 9},
- {count: 3, x0: 9, x1: 10},
+ {count: 0, x0: 8, x1: 9},
+ {count: 0, x0: 9, x1: 10},
{count: 0, x0: 10, x1: 11},
- {count: 1, x0: 11, x1: 12},
- {count: 1, x0: 12, x1: 13},
- {count: 2, x0: 13, x1: 14},
+ {count: 0, x0: 11, x1: 12},
+ {count: 0, x0: 12, x1: 13},
+ {count: 0, x0: 13, x1: 14},
{count: 0, x0: 14, x1: 15},
- {count: 5, x0: 15, x1: 16},
- {count: 2, x0: 16, x1: 17},
- {count: 2, x0: 17, x1: 18},
- {count: 2, x0: 18, x1: 19},
- {count: 4, x0: 19, x1: 20},
- {count: 2, x0: 20, x1: 21},
- {count: 2, x0: 21, x1: 22},
- {count: 1, x0: 22, x1: 23},
+ {count: 0, x0: 15, x1: 16},
+ {count: 0, x0: 16, x1: 17},
+ {count: 0, x0: 17, x1: 18},
+ {count: 1, x0: 18, x1: 19},
+ {count: 1, x0: 19, x1: 20},
+ {count: 0, x0: 20, x1: 21},
+ {count: 0, x0: 21, x1: 22},
+ {count: 0, x0: 22, x1: 23},
{count: 0, x0: 23, x1: 24},
{count: 0, x0: 24, x1: 25},
- {count: 1, x0: 25, x1: 26},
- {count: 4, x0: 26, x1: 27},
- {count: 3, x0: 27, x1: 28},
- {count: 2, x0: 28, x1: 29},
- {count: 1, x0: 29, x1: 30},
- {count: 1, x0: 30, x1: 31},
+ {count: 0, x0: 25, x1: 26},
+ {count: 1, x0: 26, x1: 27},
+ {count: 1, x0: 27, x1: 28},
+ {count: 0, x0: 28, x1: 29},
+ {count: 0, x0: 29, x1: 30},
+ {count: 0, x0: 30, x1: 31},
{count: 0, x0: 31, x1: 32},
{count: 1, x0: 32, x1: 33},
- {count: 1, x0: 33, x1: 34},
- {count: 1, x0: 34, x1: 35},
+ {count: 0, x0: 33, x1: 34},
+ {count: 0, x0: 34, x1: 35},
{count: 0, x0: 35, x1: 36},
- {count: 2, x0: 36, x1: 37},
+ {count: 1, x0: 36, x1: 37},
{count: 0, x0: 37, x1: 38},
{count: 0, x0: 38, x1: 39},
{count: 0, x0: 39, x1: 40},
- {count: 2, x0: 40, x1: 41},
- {count: 3, x0: 41, x1: 42},
- {count: 1, x0: 42, x1: 43},
- {count: 2, x0: 43, x1: 44},
+ {count: 1, x0: 40, x1: 41},
+ {count: 0, x0: 41, x1: 42},
+ {count: 0, x0: 42, x1: 43},
+ {count: 1, x0: 43, x1: 44},
{count: 0, x0: 44, x1: 45},
- {count: 2, x0: 45, x1: 46},
+ {count: 0, x0: 45, x1: 46},
{count: 0, x0: 46, x1: 47},
{count: 0, x0: 47, x1: 48},
- {count: 1, x0: 48, x1: 49},
- {count: 1, x0: 49, x1: 50},
- {count: 1, x0: 50, x1: 51},
- {count: 1, x0: 51, x1: 52},
- {count: 1, x0: 52, x1: 53},
- {count: 1, x0: 53, x1: 54},
+ {count: 0, x0: 48, x1: 49},
+ {count: 0, x0: 49, x1: 50},
+ {count: 0, x0: 50, x1: 51},
+ {count: 0, x0: 51, x1: 52},
+ {count: 0, x0: 52, x1: 53},
+ {count: 0, x0: 53, x1: 54},
{count: 0, x0: 54, x1: 55},
{count: 0, x0: 55, x1: 56},
{count: 0, x0: 56, x1: 57},
{count: 0, x0: 57, x1: 58},
{count: 0, x0: 58, x1: 59},
{count: 0, x0: 59, x1: 60},
- {count: 1, x0: 60, x1: 61},
+ {count: 0, x0: 60, x1: 61},
{count: 0, x0: 61, x1: 62},
{count: 0, x0: 62, x1: 63},
{count: 0, x0: 63, x1: 64},
@@ -485,7 +310,7 @@ const fields = [
{count: 1, x0: 65, x1: 66},
{count: 1, x0: 66, x1: 67},
{count: 0, x0: 67, x1: 68},
- {count: 1, x0: 68, x1: 69},
+ {count: 0, x0: 68, x1: 69},
{count: 0, x0: 69, x1: 70},
{count: 0, x0: 70, x1: 71},
{count: 0, x0: 71, x1: 72},
@@ -498,23 +323,12 @@ const fields = [
fieldType: 'integer',
value: [1, 76],
type: 'range',
- typeOptions: ['range']
+ typeOptions: ['range'],
+ gpu: true
}
}
];
-export const expectedHexDataset = {
- id: dataId,
- fields,
- allData,
- data: filteredData,
- filteredIndex,
- filteredIndexForDomain,
- fieldPairs: [],
- label: 'new dataset',
- color: 'dont test me'
-};
-
export const mergedH3Layer = new H3Layer({
id: 'avlgol'
});
@@ -541,7 +355,7 @@ mergedH3Layer.config = {
id: 'value'
},
colorScale: 'quantile',
- colorDomain: [12, 13, 13, 15, 15, 15, 15, 15, 16, 16, 17, 17, 18, 18],
+ colorDomain: [18, 19, 26, 27],
sizeField: null,
sizeDomain: [0, 1],
sizeScale: 'linear',
@@ -579,3 +393,62 @@ mergedH3Layer.config = {
enabled: false
}
};
+
+export const expectedMergedDataset = {
+ id: 'h3-hex-id',
+ label: 'new dataset',
+ color: 'dont test me',
+ allData: [
+ ['89283082c2fffff', 64],
+ ['8928308288fffff', 73],
+ ['89283082c07ffff', 65],
+ ['89283082817ffff', 74],
+ ['89283082c3bffff', 66],
+ ['89283082883ffff', 76],
+ ['89283082c33ffff', 43],
+ ['89283082c23ffff', 40],
+ ['89283082887ffff', 36],
+ ['89283082ca7ffff', 27],
+ ['89283082cb3ffff', 32],
+ ['89283082c0bffff', 26],
+ ['89283082ca3ffff', 19],
+ ['89283082dcfffff', 18],
+ ['89283082d8fffff', 1],
+ ['89283095347ffff', 3],
+ ['89283095363ffff', 2],
+ ['8928309537bffff', 4],
+ ['89283082d93ffff', 6],
+ ['89283082d73ffff', 1],
+ ['8928309530bffff', 1],
+ ['8928309532bffff', 1]
+ ],
+ allIndexes: new Array(22).fill(0).map((d, i) => i),
+ filteredIndex: new Array(22).fill(0).map((d, i) => i),
+ filteredIndexForDomain: [9, 11, 12, 13],
+ fieldPairs: [],
+ fields: mergedFields,
+ gpuFilter: {
+ filterRange: [
+ [10.2, 27],
+ [0, 0],
+ [0, 0],
+ [0, 0]
+ ],
+ filterValueUpdateTriggers: {
+ gpuFilter_0: 'value',
+ gpuFilter_1: null,
+ gpuFilter_2: null,
+ gpuFilter_3: null
+ },
+ filterValueAccessor: {
+ inputs: [{data: ['89283082c33ffff', 43], index: 6}],
+ result: [42, 0, 0, 0]
+ }
+ },
+ filterRecord: {
+ dynamicDomain: [mergedFilters[0]],
+ fixedDomain: [],
+ cpu: [],
+ gpu: [mergedFilters[0]]
+ }
+};
diff --git a/test/fixtures/test-layer-data.js b/test/fixtures/test-layer-data.js
new file mode 100644
index 000000000..6485ec3aa
--- /dev/null
+++ b/test/fixtures/test-layer-data.js
@@ -0,0 +1,50 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+export default `utc_timestamp,lat,lng,lat_1,lng_1,types,has_result,id,hex_id,trip_distance,icon
+Null,37.778564,-122.39096,37.769897,-122.41168,driver_analytics_0,FALSE,1,89283082c2fffff,1.59,accel
+2016-09-17 00:10:56,37.78824,-122.40894,37.798237,-122.41889,null,FALSE,null,8928308288fffff,2.38,add-person
+2016-09-17 00:11:56,38.281445,NaN,37.76018,NaN,driver_analytics,FALSE,3,89283082c07ffff,2.83,alert
+2016-09-17 00:12:58,37.79354,-122.40121,37.37006,-121.96353,driver_gps,FALSE,4,89283082817ffff,8.33,android
+2016-09-17 00:14:00,37.456535,-122.136795,37.418655,-122.149734,driver_analytics,1,5,89283082c3bffff,2.37,
+2016-09-17 00:15:01,37.40066,-122.10239,37.787052,-122.41089,driver_analytics,FALSE,34,89283082883ffff,7.13,attach
+2016-09-17 00:16:03,Null,-122.42459,Null,-122.40495,driver_analytics,FALSE,222,89283082c33ffff,3.22,
+2016-09-17 00:17:05,37.879066,-122.26108,37.753033,-122.42929,driver_analytics,TRUE,345,89283082c23ffff,11,car-suv
+2016-09-17 00:18:09,37.775578,-122.39363,37.749577,-122.41829,driver_analytics,FALSE,43,89283082887ffff,4.12,car-taxi`;
+
+export const iconGeometry = {
+ accel: [1, 2, 3, 4],
+ 'add-person': [1, 2, 3, 4],
+ alert: [1, 2, 3, 4],
+ android: [1, 2, 3, 4],
+ attach: [1, 2, 3, 4],
+ 'car-suv': [1, 2, 3, 4],
+ 'car-taxi': [1, 2, 3, 4]
+};
+
+export const bounds = {
+ 'lat-lng': [-122.42459, 37.40066, -122.10239, 38.281445],
+ 'lat_1-lng_1': [-122.42929, 37.37006, -121.96353, 37.798237],
+ arc: [-122.42929, 37.37006, -121.96353, 38.281445]
+};
+
+export const fieldDomain = {
+ id: [1, 3, 4, 5, 34, 43, 222, 345]
+}
diff --git a/test/fixtures/test-trip-data.js b/test/fixtures/test-trip-data.js
index 5e311a9e1..a633baa84 100644
--- a/test/fixtures/test-trip-data.js
+++ b/test/fixtures/test-trip-data.js
@@ -46,8 +46,8 @@ export const fields = [
export const rows = [
[
- '2015-01-15 19:05:39 +00:00',
- '2015-01-15 19:23:42 +00:00',
+ '2015-01-15 19:05:39',
+ '2015-01-15 19:23:42',
1,
1.59,
-73.99389648,
@@ -59,8 +59,8 @@ export const rows = [
'orange peel'
],
[
- '2015-01-15 19:05:39 +00:00',
- '2015-01-15 19:32:00 +00:00',
+ '2015-01-15 19:05:39',
+ '2015-01-15 19:32:00',
0,
2.38,
-73.97642517,
@@ -72,8 +72,8 @@ export const rows = [
'banana peel'
],
[
- '2015-01-15 19:05:40 +00:00',
- '2015-01-15 19:21:00 +00:00',
+ '2015-01-15 19:05:40',
+ '2015-01-15 19:21:00',
5,
2.83,
-73.96870422,
@@ -85,8 +85,8 @@ export const rows = [
'apple tree'
],
[
- '2015-01-15 19:05:40 +00:00',
- '2015-01-15 19:28:18 +00:00',
+ '2015-01-15 19:05:40',
+ '2015-01-15 19:28:18',
5,
8.33,
-73.86306,
@@ -98,8 +98,8 @@ export const rows = [
'orange peel'
],
[
- '2015-01-15 19:05:41 +00:00',
- '2015-01-15 19:20:36 +00:00',
+ '2015-01-15 19:05:41',
+ '2015-01-15 19:20:36',
1,
2.37,
-73.94554138,
@@ -111,8 +111,8 @@ export const rows = [
'apple tree'
],
[
- '2015-01-15 19:05:41 +00:00',
- '2015-01-15 19:20:22 +00:00',
+ '2015-01-15 19:05:41',
+ '2015-01-15 19:20:22',
2,
7.13,
-73.87445831,
diff --git a/test/fixtures/trip-geojson.js b/test/fixtures/trip-geojson.js
index 4224c932c..888dad6dd 100644
--- a/test/fixtures/trip-geojson.js
+++ b/test/fixtures/trip-geojson.js
@@ -26,9 +26,10 @@ export const tripDataInfo = {
const tripGeoJson = {
type: 'FeatureCollection',
features: [
+ // 0
{
type: 'Feature',
- properties: {vendor: 'A'},
+ properties: {vendor: 'A', types: 'driver_analytics_0', trip_distance: 1.59},
geometry: {
type: 'LineString',
coordinates: [
@@ -45,9 +46,10 @@ const tripGeoJson = {
]
}
},
+ // 1
{
type: 'Feature',
- properties: {vendor: 'B'},
+ properties: {vendor: 'B', value: 4, trip_distance: 2.38},
geometry: {
type: 'LineString',
coordinates: [
@@ -63,9 +65,10 @@ const tripGeoJson = {
]
}
},
+ // 2
{
type: 'Feature',
- properties: {vendor: 'A'},
+ properties: {vendor: 'A', value: 7, types: 'driver_analytics', trip_distance: 2.83},
geometry: {
type: 'LineString',
coordinates: [
@@ -80,9 +83,10 @@ const tripGeoJson = {
]
}
},
+ // 3
{
type: 'Feature',
- properties: {vendor: 'A'},
+ properties: {vendor: 'A', value: 11, types: 'driver_gps', trip_distance: 8.33},
geometry: {
type: 'LineString',
coordinates: [
@@ -98,9 +102,10 @@ const tripGeoJson = {
]
}
},
+ // 4
{
type: 'Feature',
- properties: {vendor: 'A'},
+ properties: {vendor: 'A', value: 6, types: 'driver_analytics', trip_distance: 2.37},
geometry: {
type: 'LineString',
coordinates: [
@@ -114,9 +119,10 @@ const tripGeoJson = {
]
}
},
+ // 5
{
type: 'Feature',
- properties: {vendor: 'A'},
+ properties: {vendor: 'A', value: 1, types: 'driver_analytics', trip_distance: 7.13},
geometry: {
type: 'LineString',
coordinates: [
@@ -134,9 +140,10 @@ const tripGeoJson = {
]
}
},
+ // 6
{
type: 'Feature',
- properties: {vendor: 'B'},
+ properties: {vendor: 'B', value: 7, types: 'driver_analytics', trip_distance: 3.22},
geometry: {
type: 'LineString',
coordinates: [
@@ -153,9 +160,10 @@ const tripGeoJson = {
]
}
},
+ // 7
{
type: 'Feature',
- properties: {vendor: 'A'},
+ properties: {vendor: 'A', value: 15, types: 'driver_analytics', trip_distance: 11},
geometry: {
type: 'LineString',
coordinates: [
@@ -175,9 +183,10 @@ const tripGeoJson = {
]
}
},
+ // 8
{
type: 'Feature',
- properties: {vendor: 'A'},
+ properties: {vendor: 'A', types: 'driver_analytics', trip_distance: 4.12},
geometry: {
type: 'LineString',
coordinates: [
@@ -202,15 +211,15 @@ const tripGeoJson = {
const fts = tripGeoJson.features;
export const dataToFeature = [
- {type: 'Feature', properties: {...fts[0].properties, index: 0}, geometry: fts[0].geometry},
- {type: 'Feature', properties: {...fts[1].properties, index: 1}, geometry: fts[1].geometry},
+ {type: 'Feature', properties: {...fts[0].properties, value: null, index: 0}, geometry: fts[0].geometry},
+ {type: 'Feature', properties: {...fts[1].properties, types: null, index: 1}, geometry: fts[1].geometry},
{type: 'Feature', properties: {...fts[2].properties, index: 2}, geometry: fts[2].geometry},
{type: 'Feature', properties: {...fts[3].properties, index: 3}, geometry: fts[3].geometry},
{type: 'Feature', properties: {...fts[4].properties, index: 4}, geometry: fts[4].geometry},
{type: 'Feature', properties: {...fts[5].properties, index: 5}, geometry: fts[5].geometry},
{type: 'Feature', properties: {...fts[6].properties, index: 6}, geometry: fts[6].geometry},
{type: 'Feature', properties: {...fts[7].properties, index: 7}, geometry: fts[7].geometry},
- {type: 'Feature', properties: {...fts[8].properties, index: 8}, geometry: fts[8].geometry}
+ {type: 'Feature', properties: {...fts[8].properties, value: null, index: 8}, geometry: fts[8].geometry}
];
export const dataToTimeStamp = [
@@ -325,5 +334,12 @@ export const dataToTimeStamp = [
];
export const timeStampDomain = [1565577261000, 1565578836000];
export const tripBounds = [-74.33242, 40.60428, -73.78707, 40.88362];
+export const valueDomain = [1, 15];
+
+export const TripLayerMeta = {
+ bounds: tripBounds,
+ featureTypes: {line: true},
+ getFeature: 'test separate'
+};
export default tripGeoJson;
diff --git a/test/helpers/comparison-utils.js b/test/helpers/comparison-utils.js
index 5d5492344..a57fbcd26 100644
--- a/test/helpers/comparison-utils.js
+++ b/test/helpers/comparison-utils.js
@@ -18,47 +18,63 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import {FILTER_TYPES} from 'utils/filter-utils';
+import {FILTER_TYPES} from 'constants/default-settings';
+
+export function cmpObjectKeys(t, expectedObj, actualObj, name) {
+ t.deepEqual(
+ Object.keys(actualObj).sort(),
+ Object.keys(expectedObj).sort(),
+ `${name} should have same keys`
+ );
+}
+
export function cmpFilters(
t,
expectedFilter,
actualFilter,
opt = {},
- idx = ''
+ idx = '',
+ name = ''
) {
t.equal(
typeof actualFilter,
typeof expectedFilter,
- 'filters should be same type'
+ `${name}filters should be same type`
);
-
if (Array.isArray(expectedFilter) && Array.isArray(actualFilter)) {
t.equal(
actualFilter.length,
expectedFilter.length,
- 'should have same number of filters'
+ `${name} should have same number of filters`
);
expectedFilter.forEach((f, i) => {
- cmpFilters(t, expectedFilter[i], actualFilter[i], opt, i);
+ cmpFilters(t, expectedFilter[i], actualFilter[i], opt, i, name);
});
} else {
- t.deepEqual(
- Object.keys(actualFilter).sort(),
- Object.keys(expectedFilter).sort(),
- `idx:${idx} | ${actualFilter.type} filter should have same keys`
+ cmpObjectKeys(
+ t,
+ expectedFilter,
+ actualFilter,
+ `idx:${idx} | ${actualFilter.type} filter ${actualFilter.name}`
);
Object.keys(actualFilter).forEach(key => {
if (key === 'histogram' || key === 'enlargedHistogram') {
- if (actualFilter.type === FILTER_TYPES.range || FILTER_TYPES.timeRange) {
- t.ok(actualFilter[key].length, `filter.${key} should not be empty`);
+ if (
+ actualFilter.type === FILTER_TYPES.range ||
+ FILTER_TYPES.timeRange
+ ) {
+ t.ok(
+ actualFilter[key].length,
+ `${name}.filter.${key} should not be empty`
+ );
}
} else if (key !== 'id' || opt.id) {
// test everything except id, which is auto generated
t.deepEqual(
actualFilter[key],
expectedFilter[key],
- `idx:${idx} | ${actualFilter.type} filter.${key} should be correct`
+ `${name}.idx:${idx} | ${actualFilter.type} filter ${actualFilter.name} ${key} should be correct`
);
}
});
@@ -82,10 +98,11 @@ export function cmpLayers(t, expectedLayer, actualLayer, opt = {}) {
cmpLayers(t, expectedLayer[i], actualLayer[i]);
});
} else {
- t.deepEqual(
- Object.keys(actualLayer.config).sort(),
- Object.keys(expectedLayer.config).sort(),
- `layer.${actualLayer.id} should have same keys`
+ cmpObjectKeys(
+ t,
+ expectedLayer.config,
+ actualLayer.config,
+ `layer.${actualLayer.id}`
);
Object.keys(expectedLayer.config).forEach(key => {
@@ -124,10 +141,11 @@ export function cmpSavedLayers(
cmpSavedLayers(t, expectedLayer[i], actualLayer[i], opt, i);
});
} else {
- t.deepEqual(
- Object.keys(actualLayer).sort(),
- Object.keys(expectedLayer).sort(),
- `idx:${idx} | layer.${actualLayer.type} should have same keys`
+ cmpObjectKeys(
+ t,
+ expectedLayer,
+ actualLayer,
+ `idx:${idx} | layer.${actualLayer.type}`
);
t.deepEqual(
@@ -144,19 +162,18 @@ export function cmpSavedLayers(
);
if (key === 'config') {
- t.deepEqual(
- Object.keys(actualLayer.config).sort(),
- Object.keys(expectedLayer.config).sort(),
- `idx:${idx} | layer.${actualLayer.type} config should have same keys`
+ cmpObjectKeys(
+ t,
+ expectedLayer.config,
+ actualLayer.config,
+ `idx:${idx} | layer.${actualLayer.type}`
);
Object.keys(actualLayer.config).forEach(ck => {
t.deepEqual(
actualLayer.config[ck],
expectedLayer.config[ck],
- `idx:${idx} | ${
- actualLayer.type
- } layer.config ${ck} should be correct`
+ `idx:${idx} | ${actualLayer.type} layer.config ${ck} should be correct`
);
});
}
@@ -165,11 +182,7 @@ export function cmpSavedLayers(
}
export function cmpDatasets(t, expectedDatasets, actualDatasets) {
- t.deepEqual(
- Object.keys(actualDatasets).sort(),
- Object.keys(expectedDatasets).sort(),
- 'datasets should have same keys'
- );
+ cmpObjectKeys(t, expectedDatasets, actualDatasets, 'datasets');
Object.keys(actualDatasets).forEach(dataId => {
cmpDataset(t, expectedDatasets[dataId], actualDatasets[dataId]);
@@ -177,47 +190,93 @@ export function cmpDatasets(t, expectedDatasets, actualDatasets) {
}
export function cmpDataset(t, expectedDataset, actualDataset, opt = {}) {
- t.deepEqual(
- Object.keys(actualDataset).sort(),
- Object.keys(expectedDataset).sort(),
- 'dataset should have same keys'
+ cmpObjectKeys(
+ t,
+ expectedDataset,
+ actualDataset,
+ `dataset:${expectedDataset.id}`
);
- // test everything except color, which is auto generated
+ // test everything except auto generated color
Object.keys(actualDataset).forEach(key => {
if (key === 'fields') {
t.equal(
actualDataset.fields.length,
expectedDataset.fields.length,
- `dataset.${key} should have same number of fields`
+ `dataset.${expectedDataset.id}.${key} should have same number of fields`
);
actualDataset.fields.forEach((actualField, i) => {
- t.deepEqual(
- actualField,
+ cmpField(
+ t,
expectedDataset.fields[i],
- `dataset.${key} fields ${actualField.name} should be the same`
+ actualField,
+ `dataset.${expectedDataset.id} fields ${actualField.name}`
+ );
+ });
+ } else if (key === 'gpuFilter') {
+ // test gpuFilter props
+ cmpGpuFilterProp(t, expectedDataset.gpuFilter, actualDataset.gpuFilter);
+ } else if (key === 'filterRecord' || key === 'filterRecordCPU') {
+ cmpObjectKeys(
+ t,
+ expectedDataset[key],
+ actualDataset[key],
+ `dataset.${expectedDataset.id}.${key}`
+ );
+ Object.keys(expectedDataset[key]).forEach(item => {
+ t.ok(Array.isArray(expectedDataset[key][item]),
+ `dataset.${expectedDataset.id}[key].${item} should be an array`);
+ // compare filter name
+ t.deepEqual(
+ actualDataset[key][item].map(f => f.name),
+ expectedDataset[key][item].map(f => f.name),
+ `dataset.${expectedDataset.id}.${key}.${item} should contain correct filter`
);
});
} else if (key !== 'color' || opt.color) {
t.deepEqual(
actualDataset[key],
expectedDataset[key],
- `dataset.${key} should be correct`
+ `dataset.${expectedDataset.id}.${key} should be correct`
);
}
});
}
-export function cmpInteraction(t, expectedInt, actualInt) {
- t.ok(typeof expectedInt === 'object', 'expected interaction should be an object');
- t.ok(typeof actualInt === 'object', 'actual interaction should be an object');
+export function cmpGpuFilterProp(t, expectedGpuFilter, actualGpuFilter) {
+ cmpObjectKeys(t, expectedGpuFilter, actualGpuFilter, 'gpu filter');
- t.deepEqual(
- Object.keys(actualInt).sort(),
- Object.keys(expectedInt).sort(),
- 'interaction should have same keys'
- );
+ Object.keys(expectedGpuFilter).forEach(key => {
+ if (
+ key === 'filterValueAccessor' &&
+ expectedGpuFilter.filterValueAccessor.inputs
+ ) {
+ const {inputs, result} = expectedGpuFilter.filterValueAccessor;
+ t.deepEqual(
+ actualGpuFilter.filterValueAccessor()(...inputs),
+ result,
+ 'getFilterValue should be correct'
+ );
+ } else if (
+ key === 'filterValueAccessor' &&
+ typeof expectedGpuFilter.filterValueAccessor === 'function'
+ ) {
+
+ // don't compare filter value accessor
+ return;
+ } else {
+ t.deepEqual(
+ actualGpuFilter[key],
+ expectedGpuFilter[key],
+ `getFilterValue.${key} should be correct`
+ );
+ }
+ });
+}
+
+export function cmpInteraction(t, expectedInt, actualInt) {
+ cmpObjectKeys(t, expectedInt, actualInt, 'interaction');
Object.keys(actualInt).forEach(key => {
t.equal(
typeof actualInt[key],
@@ -225,7 +284,11 @@ export function cmpInteraction(t, expectedInt, actualInt) {
`interaction.${key} should be same type`
);
- if (typeof actualInt[key] === 'object' && actualInt[key] !== null && !Array.isArray(actualInt[key])) {
+ if (
+ typeof actualInt[key] === 'object' &&
+ actualInt[key] !== null &&
+ !Array.isArray(actualInt[key])
+ ) {
cmpInteraction(t, expectedInt[key], actualInt[key]);
} else {
t.deepEqual(
@@ -247,10 +310,11 @@ export function cmpParsedAppConfigs(
Object.keys(actualConfig).forEach(key => {
if (key === 'visState') {
- t.deepEqual(
- Object.keys(actualConfig[key]).sort(),
- Object.keys(expectedConfig[key]).sort(),
- 'visState should have same keys'
+ cmpObjectKeys(
+ t,
+ expectedConfig.visState,
+ actualConfig.visState,
+ 'visState'
);
// for visConfig go through each entry
cmpParsedAppConfigs(t, expectedConfig[key], actualConfig[key], {
@@ -270,3 +334,32 @@ export function cmpParsedAppConfigs(
}
});
}
+
+export function cmpField(t, expected, actual, name) {
+ cmpObjectKeys(t, expected, actual, name);
+
+ Object.keys(expected).forEach(k => {
+ if (k === 'filterProps') {
+ // compare filterProps
+ t.ok(typeof actual[k] === 'object', `${name} should have filterProps`);
+
+ if (actual[k]) {
+ cmpObjectKeys(t, expected[k], actual[k], `${name} filterProps`);
+ // compare filterProps key
+ Object.keys(expected[k]).forEach(key => {
+ if (key === 'histogram' || key === 'enlargedHistogram') {
+ t.ok(actual[k][key].length, `${name}.filterProps.${key} should not be empty`);
+ } else {
+ t.deepEqual(
+ actual[k][key],
+ expected[k][key],
+ `${name}.filterProps.${key} should be correct`
+ );
+ }
+ });
+ }
+ } else {
+ t.deepEqual(actual[k], expected[k], `${name}.${k} should be the same`);
+ }
+ });
+}
diff --git a/test/helpers/layer-utils.js b/test/helpers/layer-utils.js
index 9fe2ccde3..34d6eddef 100644
--- a/test/helpers/layer-utils.js
+++ b/test/helpers/layer-utils.js
@@ -18,17 +18,33 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import {LayerManager} from 'deck.gl';
+import {LayerManager, MapView} from 'deck.gl';
+import React from 'react';
import {gl} from '@deck.gl/test-utils';
-import {INITIAL_MAP_STATE} from 'reducers/map-state-updaters';
-import {INITIAL_VIS_STATE} from 'reducers/vis-state-updaters';
import sinon from 'sinon';
+import {mount} from 'enzyme';
import {console as Console} from 'global/window';
-import {onWebGLInitialized} from 'utils/gl-utils';
+import cloneDeep from 'lodash.clonedeep';
+
+import {INITIAL_MAP_STATE} from 'reducers/map-state-updaters';
+import {INITIAL_VIS_STATE} from 'reducers/vis-state-updaters';
+import * as VisStateActions from 'actions/vis-state-actions';
+
import {colorMaker, layerColors} from 'layers/base-layer';
+import {getGpuFilterProps} from 'utils/gpu-filter-utils';
+import {validateLayerWithData} from 'reducers/vis-state-merger';
+import {LayerClasses} from 'layers';
+import {processCsvData, processGeojson} from 'processors/data-processor';
+import {applyActions} from 'test/helpers/mock-state';
+import {visStateReducer} from 'reducers';
+
+// Fixtures
+import csvData, {wktCsv} from 'test/fixtures/test-csv-data';
+import testLayerData, {bounds, iconGeometry, fieldDomain} from 'test/fixtures/test-layer-data';
+import {geojsonData} from 'test/fixtures/geojson';
+import tripGeoJson from 'test/fixtures/trip-geojson';
-// Initialize gl once
-onWebGLInitialized(gl);
+import {logStep} from '../../scripts/log';
export function testCreateLayer(t, LayerClass, props = {}) {
let layer;
@@ -41,11 +57,31 @@ export function testCreateLayer(t, LayerClass, props = {}) {
return layer;
}
-export function testFormatLayerData(t, layer, dataArgs) {
+export function testCreateLayerFromConfig(t, tc) {
+ const {datasets, layer: layerConfig = {}} = tc;
+ let layer;
+
+ t.doesNotThrow(() => {
+ const {dataId} = layerConfig.config;
+ layer = validateLayerWithData(datasets[dataId], layerConfig, LayerClasses);
+ t.ok(
+ layer instanceof LayerClasses[layerConfig.type],
+ `${layerConfig.type} layer created`
+ );
+ layer.updateLayerDomain(datasets);
+ if (tc.afterLayerInitialized) {
+ tc.afterLayerInitialized(layer);
+ }
+ }, `create a ${layerConfig.type} layer from config should not fail`);
+
+ return layer;
+}
+
+export function testFormatLayerData(t, layer, datasets) {
let result;
t.doesNotThrow(() => {
- result = layer.formatLayerData(...dataArgs);
+ result = layer.formatLayerData(datasets);
t.ok(result, 'has layer data');
t.ok(layer, 'has updated layer');
}, `format ${layer.type} layerData should not fail`);
@@ -56,6 +92,19 @@ export function testFormatLayerData(t, layer, dataArgs) {
export function testCreateCases(t, LayerClass, testCases) {
testCases.forEach(tc => {
const layer = testCreateLayer(t, LayerClass, tc.props);
+ if (layer) {
+ t.ok(typeof layer.type === 'string', 'layer type should be string');
+ t.ok(typeof layer.id === 'string', 'layer id should be string');
+ t.doesNotThrow(() => {
+ mount(<layer.layerIcon />);
+ }, 'layer icon should be mountable');
+
+ if (layer.layerInfoModal) {
+ t.doesNotThrow(() => {
+ mount(<layer.layerInfoModal.template />);
+ }, 'layer info modal should be mountable');
+ }
+ }
if (layer && tc.test) {
tc.test(layer);
}
@@ -75,7 +124,8 @@ export function testUpdateLayer(t, layer, updateMethod, updateArgs) {
export function testFormatLayerDataCases(t, LayerClass, testCases) {
testCases.forEach(tc => {
- const layer = testCreateLayer(t, LayerClass, tc.props);
+ logStep(`---> Test Format Layer Data ${tc.name}`);
+ const layer = testCreateLayerFromConfig(t, tc);
let updatedLayer = layer;
// if provided updates
@@ -97,9 +147,10 @@ export function testFormatLayerDataCases(t, LayerClass, testCases) {
}
if (updatedLayer) {
- const result = testFormatLayerData(t, updatedLayer, tc.data);
- if (result && tc.test) {
- tc.test({layerData: result, layer: updatedLayer});
+ const result = testFormatLayerData(t, updatedLayer, tc.datasets);
+ t.ok(result, `${tc.name} Should have format layer data result`);
+ if (result && tc.assert) {
+ tc.assert({layerData: result, layer: updatedLayer});
}
}
});
@@ -107,45 +158,67 @@ export function testFormatLayerDataCases(t, LayerClass, testCases) {
export function testRenderLayerCases(t, LayerClass, testCases) {
testCases.forEach(tc => {
- const layer = testCreateLayer(t, LayerClass, tc.props);
+ logStep(`---> Test Render Layer ${tc.name}`);
+
+ const layer = testCreateLayerFromConfig(t, tc);
let result;
+ let deckLayers;
+ let viewport = INITIAL_MAP_STATE;
if (layer) {
- result = testFormatLayerData(t, layer, tc.data);
+ result = testFormatLayerData(t, layer, tc.datasets);
}
if (result) {
- let deckLayers;
-
t.doesNotThrow(() => {
deckLayers = layer.renderLayer({
data: result,
idx: 0,
layerInteraction: {},
mapState: INITIAL_MAP_STATE,
+ gpuFilter:
+ tc.datasets[layer.config.dataId].gpuFilter ||
+ getGpuFilterProps([], layer.config.dataId, tc.datasets[layer.config.dataId].fields),
interactionConfig: INITIAL_VIS_STATE.interactionConfig,
...(tc.renderArgs || {})
});
+
+ if (tc.renderArgs && tc.renderArgs.viewport) {
+ viewport = {...viewport, ...tc.renderArgs.viewport};
+ }
}, `${layer.type}.renderLayer should not fail`);
+ }
- if (deckLayers) {
- const initialDeckLayers = testInitializeDeckLayer(t, layer.type, deckLayers);
+ if (deckLayers) {
+ const initialDeckLayers = testInitializeDeckLayer(
+ t,
+ layer.type,
+ deckLayers,
+ {viewport}
+ );
- if (tc.assert) {
- tc.assert(initialDeckLayers, layer, result);
- }
+ if (tc.assert) {
+ tc.assert(initialDeckLayers, layer, result);
}
}
});
}
-export function testInitializeDeckLayer(t, layerType, layers) {
- const layerManager = new LayerManager(gl);
+export function testInitializeDeckLayer(t, layerType, deckLayers, {viewport}) {
+ const testViewport = new MapView().makeViewport({
+ width: viewport.width,
+ height: viewport.height,
+ viewState: viewport
+ });
+ const layerManager = new LayerManager(gl, {viewport: testViewport});
const spy = sinon.spy(Console, 'error');
t.doesNotThrow(
- () => layerManager.setLayers(Array.isArray(layers) ? layers : [layers]),
+ () =>
+ layerManager.setLayers(
+ Array.isArray(deckLayers) ? deckLayers : [deckLayers]
+ ),
`initialization of ${layerType} layer render should not fail`
);
@@ -171,7 +244,7 @@ export function getNextColorMakerValue(num = 1) {
const index = layerColors.findIndex(c => c === colorNow);
for (let n = 0; n < num; n++) {
- const next = index + n + 1;
+ const next = index + n + 1;
const nextIndex =
next < layerColors.length ? next : next - layerColors.length;
results.push(layerColors[nextIndex]);
@@ -179,3 +252,122 @@ export function getNextColorMakerValue(num = 1) {
return results;
}
+
+function addFilterToData(data, id, filters) {
+ const filterActions = filters.reduce(
+ (accu, f, i) => [
+ ...accu,
+ // add filter
+ {action: VisStateActions.addFilter, payload: [id]},
+ // set filter name
+ {action: VisStateActions.setFilter, payload: [i, 'name', f.name]},
+ // set filter value
+ {
+ action: VisStateActions.setFilter,
+ payload: [i, 'value', f.value]
+ }
+ ],
+ []
+ );
+
+ return applyActions(visStateReducer, INITIAL_VIS_STATE, [
+ {
+ action: VisStateActions.updateVisData,
+ payload: [
+ {
+ info: {id},
+ data
+ }
+ ]
+ },
+ ...filterActions
+ ]);
+}
+
+export const {rows, fields} = processCsvData(csvData);
+export const {rows: testRows, fields: testFields} = processCsvData(
+ testLayerData
+);
+
+export const dataId = '0dj3h';
+export {
+ dataId as tripDataId,
+ fields as tripFields,
+ rows as tripRows
+} from 'test/fixtures/test-trip-data';
+
+/*
+ * point, arc, hex, csv dataset from with gpu time filter
+ */
+const timeFilter = [
+ {name: 'utc_timestamp', value: [1474071095000, 1474071608000]}
+];
+
+const stateWithTimeFilter = addFilterToData(
+ {fields: testFields, rows: testRows},
+ dataId,
+ timeFilter
+);
+
+export const preparedDataset = stateWithTimeFilter.datasets[dataId];
+export const gpuTimeFilter = stateWithTimeFilter.filters[0];
+export const preparedFilterDomain0 = gpuTimeFilter.domain[0];
+
+export const pointLayerMeta = {
+ bounds: bounds['lat-lng']
+};
+export const arcLayerMeta = {
+ bounds: bounds.arc
+};
+
+export {iconGeometry, fieldDomain};
+
+/*
+ * Geo csv dataset from wkt with gpu filter
+ */
+export const {rows: geoCsvRows, fields: geoCsvFields} = processCsvData(wktCsv);
+
+const stateWithGeoFilter = addFilterToData(
+ {fields: geoCsvFields, rows: geoCsvRows},
+ dataId,
+ [{name: 'm_rate', value: [7, 10]}]
+);
+
+export const preparedGeoDataset = stateWithGeoFilter.datasets[dataId];
+export const preparedGeoDatasetFilter = stateWithGeoFilter.filters[0];
+
+/*
+ * GeoJson dataset with gpu filter
+ */
+export const {rows: geoJsonRows, fields: geoJsonFields} = processGeojson(
+ cloneDeep(geojsonData)
+);
+
+const stateWithGeojsonFilter = addFilterToData(
+ {fields: geoJsonFields, rows: geoJsonRows},
+ dataId,
+ [{name: 'TRIPS', value: [4, 12]}]
+);
+
+export const prepareGeojsonDataset = stateWithGeojsonFilter.datasets[dataId];
+export const prepareGeojsonDatasetFilter = stateWithGeojsonFilter.filters[0];
+export const geoFilterDomain0 = preparedGeoDatasetFilter.domain[0];
+export const geojsonFilterDomain0 = prepareGeojsonDatasetFilter.domain[0];
+
+/*
+ * trip GeoJson dataset with gpu filter
+ */
+export const {rows: tripGeoRows, fields: tripGeoFields} = processGeojson(
+ cloneDeep(tripGeoJson)
+);
+
+const stateWithTripGeojsonFilter = addFilterToData(
+ {fields: tripGeoFields, rows: tripGeoRows},
+ dataId,
+ [{name: 'value', value: [4, 12]}]
+);
+
+export const prepareTripGeoDataset = stateWithTripGeojsonFilter.datasets[dataId];
+export const prepareTripGeoDatasetFilter = stateWithTripGeojsonFilter.filters[0];
+export const valueFilterDomain0 = prepareTripGeoDatasetFilter.domain[0];
+export const {animationConfig} = stateWithTripGeojsonFilter;
diff --git a/test/helpers/mock-state.js b/test/helpers/mock-state.js
index 8727f9af0..13b2dcac5 100644
--- a/test/helpers/mock-state.js
+++ b/test/helpers/mock-state.js
@@ -18,6 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+import test from 'tape-catch';
import cloneDeep from 'lodash.clonedeep';
import {VizColorPalette} from 'constants/custom-color-ranges';
import {getInitialInputStyle} from 'reducers/map-style-updaters';
@@ -114,6 +115,11 @@ function mockStateWithFileUpload() {
}
});
+ test(t => {
+ t.equal(updatedState.visState.layers.length, 2, 'should auto create 2 layers');
+ t.end();
+ });
+
return updatedState;
}
@@ -196,7 +202,19 @@ function mockStateWithMultiFilters() {
{action: VisStateActions.setFilter, payload: [3, 'name', 'TRIPS']},
// set filter value
- {action: VisStateActions.setFilter, payload: [3, 'value', [4, 12]]}
+ {action: VisStateActions.setFilter, payload: [3, 'value', [4, 12]]},
+
+ // add another gpu filter
+ {action: VisStateActions.addFilter, payload: [testCsvDataId]},
+
+ // set filter to 'time'
+ {action: VisStateActions.setFilter, payload: [4, 'name', 'epoch']},
+
+ // set filter value
+ {
+ action: VisStateActions.setFilter,
+ payload: [4, 'value', [1472700000000, 1472760000000]]
+ },
]);
// replace filter id with controlled value for easy testing
diff --git a/test/node/index.js b/test/node/index.js
index ff9588225..144263bc7 100644
--- a/test/node/index.js
+++ b/test/node/index.js
@@ -26,6 +26,3 @@ import './reducers';
// test schemas
import './schemas';
-
-// test layers
-import './layer-tests';
diff --git a/test/node/layer-tests/cluster-layer-specs.js b/test/node/layer-tests/cluster-layer-specs.js
deleted file mode 100644
index 2d42ecaa7..000000000
--- a/test/node/layer-tests/cluster-layer-specs.js
+++ /dev/null
@@ -1,203 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-import test from 'tape';
-import {
- testCreateCases,
- testFormatLayerDataCases,
- testRenderLayerCases
-} from 'test/helpers/layer-utils';
-import csvData from 'test/fixtures/test-csv-data';
-import {KeplerGlLayers} from 'layers';
-const {ClusterLayer} = KeplerGlLayers;
-
-import {processCsvData} from 'processors/data-processor';
-
-test('#ClusterLayer -> constructor', t => {
- const TEST_CASES = {
- CREATE: [
- {
- props: {
- dataId: 'smoothie',
- isVisible: true,
- label: 'test cluster layer'
- },
- test: layer => {
- t.ok(
- layer.config.dataId === 'smoothie',
- 'ClusterLayer dataId should be correct'
- );
- t.ok(layer.type === 'cluster', 'type should be cluster');
- t.ok(layer.isAggregated === true, 'ClusterLayer is aggregated');
- }
- }
- ]
- };
-
- testCreateCases(t, ClusterLayer, TEST_CASES.CREATE);
- t.end();
-});
-
-test('#ClusterLayer -> formatLayerData', t => {
- const {rows} = processCsvData(csvData);
-
- const filteredIndex = [0, 2, 4];
- const data = [rows[0], rows[2], rows[4]];
-
- const expectedLayerMeta = {
- bounds: [31.2148748, 29.9870074, 31.2590542, 30.0614122]
- };
-
- const TEST_CASES = [
- {
- props: {
- dataId: '0dj3h',
- label: 'gps point',
- columns: {
- lat: {
- value: 'gps_data.lat',
- fieldIdx: 1
- },
- lng: {
- value: 'gps_data.lng',
- fieldIdx: 2
- }
- }
- },
- data: [data, rows, filteredIndex, undefined],
- test: result => {
- const {layerData, layer} = result;
- const expectedLayerData = {
- data: [rows[0], rows[2], rows[4]],
- getPosition: () => {}
- };
-
- t.deepEqual(
- Object.keys(layerData).sort(),
- Object.keys(expectedLayerData).sort(),
- 'layerData should have 6 keys'
- );
- t.deepEqual(
- layerData.data,
- expectedLayerData.data,
- 'should format correct cluster layerData'
- );
- t.ok(
- typeof layerData.getPosition === 'function',
- 'should have getPosition accessor as function'
- );
- t.deepEqual(
- layerData.getPosition(layerData.data[0]),
- [31.2590542, 29.9900937],
- 'getPosition should return correct lat lng'
- );
- t.deepEqual(
- layer.meta,
- expectedLayerMeta,
- 'should format correct cluster layer meta'
- );
- }
- }
- ];
-
- testFormatLayerDataCases(t, ClusterLayer, TEST_CASES);
- t.end();
-});
-
-test('#PointLayer -> renderLayer', t => {
- const {rows} = processCsvData(csvData);
-
- const filteredIndex = rows.map((d, i) => i);
- const data = rows;
-
- const TEST_CASES = [
- {
- props: {
- dataId: '0dj3h',
- label: 'gps point',
- id: 'test',
- columns: {
- lat: {
- value: 'gps_data.lat',
- fieldIdx: 1
- },
- lng: {
- value: 'gps_data.lng',
- fieldIdx: 2
- }
- }
- },
- renderArgs: {
- mapState: {
- height: 914,
- latitude: 30.05057028781603,
- longitude: 31.235150464409074,
- width: 1136,
- zoom: 11.447706282002736
- },
- layerCallbacks: {
- onSetLayerDomain: domain => {}
- }
- },
- data: [data, rows, filteredIndex, undefined],
- assert: (deckLayers, layer, result) => {
- t.equal(deckLayers.length, 2, 'should render 2 layers');
-
- t.deepEqual(
- deckLayers.map(l => l.id),
- ['test', 'test-cluster'],
- 'should render 1 cluster, 1 point layer'
- );
-
- const clusterLayer = deckLayers[0];
- const {clusters} = clusterLayer.state;
-
- t.equal(clusters.length, 7, 'should create 7 clusters');
- clusters.forEach(cluster => {
- t.ok(
- cluster.properties.point_count === cluster.properties.points.length,
- 'point count should be correct'
- );
- });
- }
- }
- ];
-
- testRenderLayerCases(t, ClusterLayer, TEST_CASES);
- t.end();
-});
diff --git a/test/node/layer-tests/geojson-layer-specs.js b/test/node/layer-tests/geojson-layer-specs.js
deleted file mode 100644
index 0336b741c..000000000
--- a/test/node/layer-tests/geojson-layer-specs.js
+++ /dev/null
@@ -1,212 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-import test from 'tape';
-import GeojsonLayer from 'layers/geojson-layer/geojson-layer';
-import {processCsvData} from 'processors/data-processor';
-
-import {wktCsv, updatedLayerV2} from 'test/fixtures/test-csv-data';
-import {
- testCreateCases,
- testFormatLayerDataCases
-} from 'test/helpers/layer-utils';
-
-test('#GeojsonLayer -> constructor', t => {
- const TEST_CASES = {
- CREATE: [
- {
- props: {
- dataId: 'smoothie',
- isVisible: true,
- label: 'test geojson layer'
- },
- test: layer => {
- t.ok(
- layer.config.dataId === 'smoothie',
- 'geojsonLayer dataId should be correct'
- );
- t.ok(layer.type === 'geojson', 'type should be geojson');
- t.ok(layer.isAggregated === false, 'geojsonLayer is not aggregated');
- }
- }
- ]
- };
-
- testCreateCases(t, GeojsonLayer, TEST_CASES.CREATE);
- t.end();
-});
-
-test('#GeojsonLayer -> formatLayerData', t => {
- const {rows} = processCsvData(wktCsv);
-
- const filteredIndex = [0, 1, 2, 4];
- const data = [rows[0], rows[1], rows[2], rows[4]];
-
- const TEST_CASES = [
- {
- props: {
- dataId: '0dj3h',
- label: 'some geometry file',
- columns: {
- geojson: {
- value: 'simplified_shape_v2',
- fieldIdx: 1
- }
- }
- },
- data: [data, rows, filteredIndex, undefined],
- test: result => {
- const {layerData, layer} = result;
- const expectedLayerData = {
- data: [
- updatedLayerV2.dataToFeature[1],
- updatedLayerV2.dataToFeature[2],
- updatedLayerV2.dataToFeature[4]
- ],
- getFeature: () => {},
- getFillColor: () => {},
- getLineColor: () => {},
- getLineWidth: () => {},
- getElevation: () => {},
- getRadius: () => {}
- };
- const expectedLayerMeta = updatedLayerV2.meta;
- const expectedDataToFeature = updatedLayerV2.dataToFeature;
-
- t.deepEqual(
- layerData.data,
- expectedLayerData.data,
- 'should format correct geojson layerData'
- );
- t.ok(
- typeof layerData.getFeature === 'function',
- 'should have getFeature'
- );
- t.ok(
- typeof layerData.getFillColor === 'function',
- 'should have getFillColor'
- );
- t.ok(
- typeof layerData.getLineColor === 'function',
- 'should have getLineColor'
- );
- t.ok(
- typeof layerData.getLineWidth === 'function',
- 'should have getSize'
- );
- t.ok(
- typeof layerData.getElevation === 'function',
- 'should have getRadius'
- );
- t.ok(
- typeof layerData.getRadius === 'function',
- 'should have getRadius'
- );
-
- t.deepEqual(
- layer.meta,
- expectedLayerMeta,
- 'should format correct geojson layer meta'
- );
- t.deepEqual(
- layer.dataToFeature,
- expectedDataToFeature,
- 'should format correct geojson dataToFeature'
- );
- }
- },
- {
- props: {
- dataId: '0dj3h',
- label: 'some geometry file',
- columns: {
- geojson: {
- value: 'simplified_shape',
- fieldIdx: 2
- }
- }
- },
- data: [data, rows, filteredIndex, undefined],
- test: result => {
- const {layerData, layer} = result;
-
- const expectedLayerData = {
- data: [
- updatedLayerV2.dataToFeature[1],
- updatedLayerV2.dataToFeature[2],
- updatedLayerV2.dataToFeature[4]
- ],
- getFeature: () => {},
- getFillColor: () => {},
- getLineColor: () => {},
- getLineWidth: () => {},
- getElevation: () => {},
- getRadius: () => {}
- };
- const expectedLayerMeta = updatedLayerV2.meta;
- const expectedDataToFeature = updatedLayerV2.dataToFeature;
-
- t.deepEqual(
- layerData.data,
- expectedLayerData.data,
- 'should format correct geojson layerData'
- );
- t.ok(
- typeof layerData.getFeature === 'function',
- 'should have getFeature'
- );
- t.ok(
- typeof layerData.getFillColor === 'function',
- 'should have getFillColor'
- );
- t.ok(
- typeof layerData.getLineColor === 'function',
- 'should have getLineColor'
- );
- t.ok(
- typeof layerData.getLineWidth === 'function',
- 'should have getSize'
- );
- t.ok(
- typeof layerData.getElevation === 'function',
- 'should have getRadius'
- );
- t.ok(
- typeof layerData.getRadius === 'function',
- 'should have getRadius'
- );
-
- t.deepEqual(
- layer.meta,
- expectedLayerMeta,
- 'should format correct geojson layer meta'
- );
- t.deepEqual(
- layer.dataToFeature,
- expectedDataToFeature,
- 'should format correct geojson dataToFeature'
- );
- }
- }
- ];
-
- testFormatLayerDataCases(t, GeojsonLayer, TEST_CASES);
- t.end();
-});
diff --git a/test/node/layer-tests/grid-layer-specs.js b/test/node/layer-tests/grid-layer-specs.js
deleted file mode 100644
index f35c1aea2..000000000
--- a/test/node/layer-tests/grid-layer-specs.js
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-import test from 'tape';
-import {
- testCreateCases,
- testFormatLayerDataCases
-} from 'test/helpers/layer-utils';
-import csvData, {testFields} from 'test/fixtures/test-csv-data';
-
-import GridLayer from 'layers/grid-layer/grid-layer';
-import {processCsvData} from 'processors/data-processor';
-
-test('#GridLayer -> constructor', t => {
- const TEST_CASES = {
- CREATE: [
- {
- props: {
- dataId: 'smoothie',
- isVisible: true,
- label: 'test grid layer'
- },
- test: layer => {
- t.ok(
- layer.config.dataId === 'smoothie',
- 'gridLayer dataId should be correct'
- );
- t.ok(layer.type === 'grid', 'type should be grid');
- t.ok(layer.isAggregated === true, 'gridLayer is aggregated');
- }
- }
- ]
- };
-
- testCreateCases(t, GridLayer, TEST_CASES.CREATE);
- t.end();
-});
-
-test('#GridLayer -> formatLayerData', t => {
- const {rows} = processCsvData(csvData);
-
- const filteredIndex = [0, 2, 4];
- const data = [rows[0], rows[2], rows[4]];
-
- const dataWithNull = [[null, null, '12']].concat(data);
- const allDataWithNull = [[null, null, '12']].concat(rows);
-
- const expectedLayerMeta = {
- bounds: [31.2148748, 29.9870074, 31.2590542, 30.0614122]
- };
-
- const TEST_CASES = [
- {
- props: {
- dataId: '0dj3h',
- label: 'some geometry file',
- columns: {
- lat: {
- value: 'gps_data.lat',
- fieldIdx: 1
- },
- lng: {
- value: 'gps_data.lng',
- fieldIdx: 2
- }
- }
- },
- data: [data, rows, filteredIndex, undefined],
- test: result => {
- const {layerData, layer} = result;
- const expectedLayerData = {
- data: [rows[0], rows[2], rows[4]],
- getPosition: () => {}
- };
-
- t.deepEqual(
- Object.keys(layerData),
- ['data', 'getPosition'],
- 'layerData should have 2 keys'
- );
- t.deepEqual(
- layerData.data,
- expectedLayerData.data,
- 'should format correct grid layerData'
- );
- t.ok(
- typeof layerData.getPosition === 'function',
- 'should have getPosition'
- );
- t.deepEqual(
- layerData.getPosition(layerData.data[0]),
- [31.2590542, 29.9900937],
- 'getPosition should return correct lat lng'
- );
- t.deepEqual(
- layer.meta,
- expectedLayerMeta,
- 'should format correct grid layerData'
- );
- }
- },
- {
- props: {
- dataId: '0dj3h',
- label: 'some geometry file',
- columns: {
- lat: {
- value: 'gps_data.lat',
- fieldIdx: 1
- },
- lng: {
- value: 'gps_data.lng',
- fieldIdx: 2
- }
- }
- },
- updates: [
- {method: 'updateLayerConfig', args: [{colorField: testFields[6]}]},
- {
- method: 'updateLayerVisualChannel',
- args: [{data: dataWithNull, allData: allDataWithNull}, 'color']
- }
- ],
- data: [dataWithNull, allDataWithNull, filteredIndex, undefined],
- test: result => {
- const {layerData, layer} = result;
-
- const expectedLayerData = {
- data: [rows[1], rows[3]],
- getPosition: () => {},
- getColorValue: () => {}
- };
-
- t.deepEqual(
- Object.keys(layerData),
- ['data', 'getPosition', 'getColorValue'],
- 'layerData should have 2 keys'
- );
- t.deepEqual(
- layerData.data,
- expectedLayerData.data,
- 'should filter out nulls, format correct grid layerData'
- );
- t.ok(
- typeof layerData.getPosition === 'function',
- 'should have getPosition'
- );
- t.ok(
- typeof layerData.getColorValue === 'function',
- 'should have getColorValue'
- );
- t.deepEqual(
- layerData.getPosition(layerData.data[0]),
- [31.2461142, 29.9927699],
- 'getPosition should return correct lat lng'
- );
- t.deepEqual(
- layer.meta,
- expectedLayerMeta,
- 'should format correct grid layerData'
- );
- }
- }
- ];
-
- testFormatLayerDataCases(t, GridLayer, TEST_CASES);
- t.end();
-});
diff --git a/test/node/layer-tests/heatmap-layer-specs.js b/test/node/layer-tests/heatmap-layer-specs.js
deleted file mode 100644
index 07c7279b0..000000000
--- a/test/node/layer-tests/heatmap-layer-specs.js
+++ /dev/null
@@ -1,302 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-import test from 'tape';
-import {
- testCreateCases,
- testFormatLayerDataCases
-} from 'test/helpers/layer-utils';
-import {processCsvData} from 'processors/data-processor';
-import csvData from 'test/fixtures/test-csv-data';
-
-import HeatmapLayer from 'layers/heatmap-layer/heatmap-layer';
-
-test('#HeatmapLayer -> contructor', t => {
- const TEST_CASES = {
- CREATE: [
- {
- props: {
- dataId: 'heatmap',
- isVisible: true,
- label: 'test heatmap layer'
- },
- test: layer => {
- // test constructor
- t.equal(
- layer.config.visConfig.radius,
- 20,
- 'Heatmap default radius should be 20'
- );
- }
- }
- ]
- };
-
- testCreateCases(t, HeatmapLayer, TEST_CASES.CREATE);
- t.end();
-});
-
-test('#Heatmaplayer -> formatLayerData', t => {
- const {rows} = processCsvData(csvData);
- const filteredIndex = Array(rows.length)
- .fill()
- .map((_, index) => index);
- const data = rows;
- const columns = {
- lat: {
- name: 'gps_data.lat',
- fieldIdx: 1
- },
- lng: {
- name: 'gps_data.lng',
- fieldIdx: 2
- }
- };
- const expectedConfig = {
- type: 'heatmap',
- id: 'assign_from_layer',
- source: 'heatmap-1-2',
- layout: {visibility: 'visible'},
- maxzoom: 18,
- paint: {
- 'heatmap-weight': 1,
- 'heatmap-intensity': ['interpolate', ['linear'], ['zoom'], 0, 1, 18, 3],
- 'heatmap-color': [
- 'interpolate',
- ['linear'],
- ['heatmap-density'],
- 0,
- 'rgba(0,0,0,0)',
- 0.14285714285714285,
- 'rgb(90,24,70)',
- 0.2857142857142857,
- 'rgb(144,12,63)',
- 0.42857142857142855,
- 'rgb(199,0,57)',
- 0.5714285714285714,
- 'rgb(227,97,28)',
- 0.7142857142857143,
- 'rgb(241,146,14)',
- 0.8571428571428571,
- 'rgb(255,195,0)'
- ],
- 'heatmap-radius': ['interpolate', ['linear'], ['zoom'], 0, 2, 18, 20],
- 'heatmap-opacity': 0.8
- }
- };
-
- const TEST_CASES = [
- {
- props: {
- dataId: 'heatmap',
- label: 'mapbox heatmap',
- isVisible: true,
- columns
- },
- data: [data, rows, filteredIndex, undefined],
- test: result => {
- const {layerData, layer} = result;
-
- const expectedLayerMeta = {
- bounds: [31.2148748, 29.9870074, 31.2590542, 30.0614122]
- };
- const expectedLayerData = {
- columns,
- config: expectedConfig,
- data: {
- type: 'FeatureCollection',
- features: [
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2590542, 29.9900937]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2461142, 29.9927699]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2312742, 29.9907261]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2175827, 29.9870074]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2154899, 29.9923041]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2149361, 29.9968249]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2164035, 30.0037217]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2179346, 30.0116207]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2179556, 30.0208925]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2178842, 30.0218999]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2179138, 30.0229344]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2179415, 30.0264237]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2181809, 30.0292134]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2193991, 30.034391]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2181803, 30.0352752]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2195902, 30.0395918]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2174421, 30.0497387]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2165983, 30.0538936]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2148748, 30.060911]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2212278, 30.060334]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2288985, 30.0554663]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2187021, 30.0614122]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2191059, 30.0612697]}
- },
- {
- type: 'Feature',
- properties: {},
- geometry: {type: 'Point', coordinates: [31.2194728, 30.0610977]}
- }
- ]
- },
- weightField: null,
- getPosition: () => {}
- };
-
- t.deepEqual(
- Object.keys(layerData).sort(),
- Object.keys(expectedLayerData).sort(),
- 'lheatmap ayerData should have correct keys'
- );
-
- // test data
- t.deepEqual(
- layerData.data,
- expectedLayerData.data,
- 'should format correct heatmap layerData.data'
- );
-
- // test columns,
- t.deepEqual(
- layerData.columns,
- expectedLayerData.columns,
- 'should format correct heatmap layerData.columns'
- );
- expectedLayerData.config.id = layer.id;
- // test config
- t.deepEqual(
- layerData.config,
- expectedLayerData.config,
- 'should format correct heatmap layerData.config'
- );
- // test weightField
- t.deepEqual(
- layerData.weightField,
- expectedLayerData.weightField,
- 'should format correct heatmap weightField'
- );
- // test layer.meta
- t.deepEqual(
- layer.meta,
- expectedLayerMeta,
- 'should format correct heatmap layer.meta'
- );
- }
- }
- ];
-
- testFormatLayerDataCases(t, HeatmapLayer, TEST_CASES);
- t.end();
-});
-
-// todo: make sure data is created correctly
-// todo: define heatmap weight based on property
-// todo: make sure data is recomputed when weight property is changed
-// todo: make sure data is not recomputed if things don't change
-// todo: make sure config is the same when things don't change
diff --git a/test/node/layer-tests/hexagon-layer-specs.js b/test/node/layer-tests/hexagon-layer-specs.js
deleted file mode 100644
index d6f3d3bb4..000000000
--- a/test/node/layer-tests/hexagon-layer-specs.js
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-import test from 'tape';
-import {
- testCreateCases,
- testFormatLayerDataCases
-} from 'test/helpers/layer-utils';
-import csvData, {testFields} from 'test/fixtures/test-csv-data';
-
-import HexagonLayer from 'layers/hexagon-layer/hexagon-layer';
-import {processCsvData} from 'processors/data-processor';
-
-test('#HexagonLayer -> constructor', t => {
- const TEST_CASES = {
- CREATE: [
- {
- props: {
- dataId: 'smoothie',
- isVisible: true,
- label: 'test hexagon layer'
- },
- test: layer => {
- t.ok(
- layer.config.dataId === 'smoothie',
- 'HexagonLayer dataId should be correct'
- );
- t.ok(layer.type === 'hexagon', 'type should be hexagon');
- t.ok(layer.isAggregated === true, 'HexagonLayer is aggregated');
- }
- }
- ]
- };
-
- testCreateCases(t, HexagonLayer, TEST_CASES.CREATE);
- t.end();
-});
-
-test('#HexagonLayer -> formatLayerData', async t => {
- const {rows} = await processCsvData(csvData);
-
- const filteredIndex = [0, 2, 4];
- const data = [rows[0], rows[2], rows[4]];
-
- const dataWithNull = [[null, null, '12']].concat(data);
- const allDataWithNull = [[null, null, '12']].concat(rows);
-
- const expectedLayerMeta = {
- bounds: [31.2148748, 29.9870074, 31.2590542, 30.0614122]
- };
-
- const TEST_CASES = [
- {
- props: {
- dataId: '0dj3h',
- label: 'some geometry file',
- columns: {
- lat: {
- value: 'gps_data.lat',
- fieldIdx: 1
- },
- lng: {
- value: 'gps_data.lng',
- fieldIdx: 2
- }
- }
- },
- data: [data, rows, filteredIndex, undefined],
- test: result => {
- const {layerData, layer} = result;
- const expectedLayerData = {
- data: [rows[0], rows[2], rows[4]],
- getPosition: () => {}
- };
-
- t.deepEqual(
- Object.keys(layerData),
- ['data', 'getPosition'],
- 'layerData should have 2 keys'
- );
- t.deepEqual(
- layerData.data,
- expectedLayerData.data,
- 'should format correct hexagon layerData'
- );
- t.ok(
- typeof layerData.getPosition === 'function',
- 'should have getPosition'
- );
- t.deepEqual(
- layerData.getPosition(layerData.data[0]),
- [31.2590542, 29.9900937],
- 'getPosition should return correct lat lng'
- );
- t.deepEqual(
- layer.meta,
- expectedLayerMeta,
- 'should format correct grid layerData'
- );
- }
- },
- {
- props: {
- dataId: '0dj3h',
- label: 'some geometry file',
- columns: {
- lat: {
- value: 'gps_data.lat',
- fieldIdx: 1
- },
- lng: {
- value: 'gps_data.lng',
- fieldIdx: 2
- }
- }
- },
- updates: [
- {method: 'updateLayerConfig', args: [{colorField: testFields[6]}]},
- {
- method: 'updateLayerVisualChannel',
- args: [{data: dataWithNull, allData: allDataWithNull}, 'color']
- }
- ],
- data: [dataWithNull, allDataWithNull, filteredIndex, undefined],
- test: result => {
- const {layerData, layer} = result;
-
- const expectedLayerData = {
- data: [[null, null, '12'], rows[1], rows[3]],
- getPosition: () => {},
- getColorValue: () => {}
- };
-
- t.deepEqual(
- Object.keys(layerData),
- ['data', 'getPosition', 'getColorValue'],
- 'layerData should have 2 keys'
- );
- t.deepEqual(
- layerData.data,
- expectedLayerData.data,
- 'should not filter out nulls, format correct hexagon layerData'
- );
- t.ok(
- typeof layerData.getPosition === 'function',
- 'should have getPosition'
- );
- t.ok(
- typeof layerData.getColorValue === 'function',
- 'should have getColorValue'
- );
- t.deepEqual(
- layerData.getPosition(layerData.data[0]),
- ['12', null],
- 'getPosition should return correct lat lng'
- );
- t.deepEqual(
- layer.meta,
- expectedLayerMeta,
- 'should format correct grid layerData'
- );
- }
- }
- ];
-
- testFormatLayerDataCases(t, HexagonLayer, TEST_CASES);
- t.end();
-});
diff --git a/test/node/layer-tests/point-layer-specs.js b/test/node/layer-tests/point-layer-specs.js
deleted file mode 100644
index 45f89c49d..000000000
--- a/test/node/layer-tests/point-layer-specs.js
+++ /dev/null
@@ -1,284 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-import test from 'tape';
-import {
- testCreateCases,
- testFormatLayerDataCases,
- testRenderLayerCases
-} from 'test/helpers/layer-utils';
-import csvData, {testFields} from 'test/fixtures/test-csv-data';
-import {KeplerGlLayers} from 'layers';
-const {PointLayer} = KeplerGlLayers;
-
-import {processCsvData} from 'processors/data-processor';
-
-test('#PointLayer -> constructor', t => {
- const TEST_CASES = {
- CREATE: [
- {
- props: {
- dataId: 'smoothie',
- isVisible: true,
- label: 'test point layer'
- },
- test: layer => {
- t.ok(
- layer.config.dataId === 'smoothie',
- 'PointLayer dataId should be correct'
- );
- t.ok(layer.type === 'point', 'type should be grid');
- t.ok(layer.isAggregated === false, 'PointLayer is not aggregated');
- }
- }
- ]
- };
-
- testCreateCases(t, PointLayer, TEST_CASES.CREATE);
- t.end();
-});
-
-test('#PointLayer -> formatLayerData', t => {
- const {rows} = processCsvData(csvData);
-
- const filteredIndex = [0, 2, 4];
- const data = [rows[0], rows[2], rows[4]];
-
- const dataWithNull = [[null, null, '12']].concat(data);
- const allDataWithNull = [[null, null, '12']].concat(rows);
-
- const expectedLayerMeta = {
- bounds: [31.2148748, 29.9870074, 31.2590542, 30.0614122]
- };
- const dataset = {
- data: dataWithNull,
- allData: allDataWithNull,
- filteredIndexForDomain: [0, 2, 4, 5, 6, 7, 8, 9, 10]
- };
-
- const TEST_CASES = [
- {
- props: {
- dataId: '0dj3h',
- label: 'gps point',
- columns: {
- lat: {
- value: 'gps_data.lat',
- fieldIdx: 1
- },
- lng: {
- value: 'gps_data.lng',
- fieldIdx: 2
- }
- }
- },
- data: [data, rows, filteredIndex, undefined],
- test: result => {
- const {layerData, layer} = result;
- const expectedLayerData = {
- textLabels: {
- characterSet: [],
- getText: () => {}
- },
- data: [
- {
- data: rows[0]
- },
- {
- data: rows[2]
- },
- {
- data: rows[4]
- }
- ],
- getPosition: () => {},
- getFillColor: () => {},
- getLineColor: () => {},
- getRadius: () => {}
- };
-
- t.deepEqual(
- Object.keys(layerData).sort(),
- Object.keys(expectedLayerData).sort(),
- 'layerData should have 6 keys'
- );
- t.deepEqual(
- layerData.data,
- expectedLayerData.data,
- 'should format correct grid layerData'
- );
- t.ok(
- typeof layerData.getPosition === 'function',
- 'should have getPosition accessor as function'
- );
- t.deepEqual(
- layerData.getFillColor,
- layer.config.color,
- 'getFillColor should be a constant'
- );
- t.deepEqual(
- layerData.getRadius,
- 1,
- 'getRadius should be a constant'
- );
- t.deepEqual(
- layerData.getPosition(layerData.data[0]),
- [31.2590542, 29.9900937, 0],
- 'getPosition should return correct lat lng'
- );
- t.deepEqual(
- layer.meta,
- expectedLayerMeta,
- 'should format correct point layer meta'
- );
- }
- },
- {
- props: {
- dataId: '0dj3h',
- label: 'some point file',
- columns: {
- lat: {
- value: 'gps_data.lat',
- fieldIdx: 1
- },
- lng: {
- value: 'gps_data.lng',
- fieldIdx: 2
- }
- }
- },
- updates: [
- // update layer config to an integer field
- {method: 'updateLayerConfig', args: [{colorField: testFields[6]}]},
- {
- method: 'updateLayerVisualChannel',
- args: [dataset, 'color']
- },
- {method: 'updateLayerConfig', args: [{sizeField: testFields[6]}]},
- {
- method: 'updateLayerVisualChannel',
- args: [dataset, 'size']
- },
- {
- method: 'updateLayerVisConfig',
- args: [{fixedRadius: true}]
- }
- ],
- data: [dataWithNull, allDataWithNull, filteredIndex, undefined],
- test: result => {
- const {layerData, layer} = result;
-
- const expectedLayerData = {
- data: [
- {
- data: rows[1]
- },
- {
- data: rows[3]
- }
- ],
- getPosition: () => {},
- getLineColor: () => {},
- getFillColor: () => {},
- getRadius: () => {},
- getText: () => {}
- };
- t.deepEqual(
- layer.config.colorDomain,
- [2, 4, 5, 222, 345, 12124],
- 'should update layer color domain'
- );
- t.deepEqual(
- Object.keys(layerData).sort,
- Object.keys(expectedLayerData).sort,
- 'layerData should have 6 keys'
- );
- t.deepEqual(
- layerData.data,
- expectedLayerData.data,
- 'should filter out nulls, format correct point layerData'
- );
- t.ok(
- ['getPosition', 'getFillColor', 'getRadius'].every(
- k => typeof layerData[k] === 'function'
- ),
- 'should have getPosition, getFillColor, getRadius accessor as function'
- );
- t.deepEqual(
- layerData.getPosition(layerData.data[0]),
- [31.2461142, 29.9927699, 0],
- 'getPosition should return correct lat lng'
- );
- t.deepEqual(
- layer.meta,
- expectedLayerMeta,
- 'should format correct grid layerData'
- );
- t.deepEqual(
- layerData.getFillColor(layerData.data[0]),
- [90, 24, 70],
- 'getColor should return correct color'
- );
- t.equal(
- layerData.getRadius(layerData.data[0]),
- 2,
- 'getRadius should return fixed radius'
- );
- }
- }
- ];
-
- testFormatLayerDataCases(t, PointLayer, TEST_CASES);
- t.end();
-});
-
-test('#PointLayer -> renderLayer', t => {
- const {rows} = processCsvData(csvData);
-
- const filteredIndex = [0, 2, 4];
- const data = [rows[0], rows[2], rows[4]];
-
- const TEST_CASES = [{
- props: {
- dataId: '0dj3h',
- label: 'gps point',
- columns: {
- lat: {
- value: 'gps_data.lat',
- fieldIdx: 1
- },
- lng: {
- value: 'gps_data.lng',
- fieldIdx: 2
- },
- altitude: {
- value: null,
- fieldIdx: -1,
- optional: true
- }
- }
- },
- data: [data, rows, filteredIndex, undefined]
- }];
-
- testRenderLayerCases(t, PointLayer, TEST_CASES);
- t.end();
-});
diff --git a/test/node/layer-tests/scenegraph-layer-specs.js b/test/node/layer-tests/scenegraph-layer-specs.js
deleted file mode 100644
index 7e211a322..000000000
--- a/test/node/layer-tests/scenegraph-layer-specs.js
+++ /dev/null
@@ -1,205 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-import test from 'tape';
-import {
- testCreateCases,
- testFormatLayerDataCases
-} from 'test/helpers/layer-utils';
-import csvData, {testFields} from 'test/fixtures/test-csv-data';
-import {KeplerGlLayers} from 'layers';
-const {ScenegraphLayer} = KeplerGlLayers;
-
-import {processCsvData} from 'processors/data-processor';
-
-test('#ScenegraphLayer -> constructor', t => {
- const TEST_CASES = {
- CREATE: [
- {
- props: {
- dataId: 'smoothie',
- isVisible: true,
- label: 'test 3d layer'
- },
- test: layer => {
- t.ok(
- layer.config.dataId === 'smoothie',
- 'ScenegraphLayer dataId should be correct'
- );
- t.ok(layer.type === '3D', 'type should be 3D');
- t.ok(
- layer.isAggregated === false,
- 'ScenegraphLayer is not aggregated'
- );
- }
- }
- ]
- };
-
- testCreateCases(t, ScenegraphLayer, TEST_CASES.CREATE);
- t.end();
-});
-
-test('#ScenegraphLayer -> formatLayerData', t => {
- const {rows} = processCsvData(csvData);
-
- const filteredIndex = [0, 2, 4];
- const data = [rows[0], rows[2], rows[4]];
-
- const dataWithNull = [[null, null, '12']].concat(data);
- const allDataWithNull = [[null, null, '12']].concat(rows);
-
- const expectedLayerMeta = {
- bounds: [31.2148748, 29.9870074, 31.2590542, 30.0614122]
- };
- const dataset = {
- data: dataWithNull,
- allData: allDataWithNull,
- filteredIndexForDomain: [0, 2, 4, 5, 6, 7, 8, 9, 10]
- };
-
- const TEST_CASES = [
- {
- props: {
- dataId: '0dj3h',
- label: 'gps 3d',
- columns: {
- lat: {
- value: 'gps_data.lat',
- fieldIdx: 1
- },
- lng: {
- value: 'gps_data.lng',
- fieldIdx: 2
- }
- }
- },
- data: [data, rows, filteredIndex, undefined],
- test: result => {
- const {layerData, layer} = result;
- const expectedLayerData = {
- data: [
- {
- data: rows[0]
- },
- {
- data: rows[2]
- },
- {
- data: rows[4]
- }
- ],
- getPosition: () => {}
- };
-
- t.deepEqual(
- Object.keys(layerData).sort(),
- Object.keys(expectedLayerData).sort(),
- 'layerData should have 2 keys'
- );
- t.ok(
- typeof layerData.getPosition === 'function',
- 'should have getPosition accessor as function'
- );
- t.deepEqual(
- layerData.getPosition(layerData.data[0]),
- [31.2590542, 29.9900937, 0],
- 'getPosition should return correct lat lng'
- );
- t.deepEqual(
- layer.meta,
- expectedLayerMeta,
- 'should format correct 3d layer meta'
- );
- }
- },
- {
- props: {
- dataId: '0dj3h',
- label: 'some 3d file',
- columns: {
- lat: {
- value: 'gps_data.lat',
- fieldIdx: 1
- },
- lng: {
- value: 'gps_data.lng',
- fieldIdx: 2
- }
- }
- },
- updates: [
- // update layer config to an integer field
- {method: 'updateLayerConfig', args: [{colorField: testFields[6]}]},
- {
- method: 'updateLayerVisualChannel',
- args: [dataset, 'color']
- },
- {method: 'updateLayerConfig', args: [{sizeField: testFields[6]}]},
- {
- method: 'updateLayerVisualChannel',
- args: [dataset, 'size']
- },
- {
- method: 'updateLayerVisConfig',
- args: [{fixedRadius: true}]
- }
- ],
- data: [dataWithNull, allDataWithNull, filteredIndex, undefined],
- test: result => {
- const {layerData, layer} = result;
-
- const expectedLayerData = {
- data: [
- {
- data: rows[1]
- },
- {
- data: rows[3]
- }
- ],
- getPosition: () => {}
- };
- t.deepEqual(
- layer.config.colorDomain,
- [2, 4, 5, 222, 345, 12124],
- 'should update layer color domain'
- );
- t.deepEqual(
- Object.keys(layerData).sort(),
- Object.keys(expectedLayerData).sort(),
- 'layerData should have 2 keys'
- );
- t.ok(
- ['getPosition'].every(k => typeof layerData[k] === 'function'),
- 'should have getPosition accessor as function'
- );
- t.deepEqual(
- layerData.getPosition(layerData.data[0]),
- [31.2461142, 29.9927699, 0],
- 'getPosition should return correct lat lng'
- );
- }
- }
- ];
-
- testFormatLayerDataCases(t, ScenegraphLayer, TEST_CASES);
- t.end();
-});
diff --git a/test/node/reducers/composer-state-test.js b/test/node/reducers/composer-state-test.js
index dcfb8832a..17d2bc3d7 100644
--- a/test/node/reducers/composer-state-test.js
+++ b/test/node/reducers/composer-state-test.js
@@ -18,6 +18,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+/* eslint-disable max-statements */
+
import test from 'tape';
import keplerGlReducer from 'reducers';
import {addDataToMapUpdater} from 'reducers/combined-updaters';
@@ -25,8 +27,18 @@ import {registerEntry} from 'actions/identity-actions';
import {processCsvData} from 'processors/data-processor';
import testCsvData, {sampleConfig} from 'test/fixtures/test-csv-data';
-import testHexIdData, {hexIdDataConfig, mergedH3Layer, mergedFilters, expectedHexDataset} from 'test/fixtures/test-hex-id-data';
-import {cmpLayers, cmpFilters, cmpDatasets, cmpDataset, cmpInteraction} from 'test/helpers/comparison-utils';
+import testHexIdData, {
+ hexIdDataConfig,
+ mergedH3Layer,
+ mergedFilters,
+ expectedMergedDataset
+} from 'test/fixtures/test-hex-id-data';
+import {
+ cmpLayers,
+ cmpFilters,
+ cmpDataset,
+ cmpInteraction
+} from 'test/helpers/comparison-utils';
import {INITIAL_UI_STATE} from 'reducers/ui-state-updaters';
import {toggleMapControlUpdater} from 'reducers/map-state-updaters';
@@ -147,7 +159,11 @@ test('#composerStateReducer - addDataToMapUpdater: uiState', t => {
currentModal: null
};
- t.deepEqual(newState.uiState, expectedUIState, 'ui state should be set readOnly:false,currentModal: null');
+ t.deepEqual(
+ newState.uiState,
+ expectedUIState,
+ 'ui state should be set readOnly:false,currentModal: null'
+ );
t.end();
});
@@ -194,8 +210,7 @@ test('#composerStateReducer - addDataToMapUpdater: keepExistingConfig', t => {
}
});
- const hexDataset = nextState1.visState.datasets[hexDataId];
- cmpDataset(t, expectedHexDataset, nextState1.visState.datasets[hexDataId]);
+ cmpDataset(t, expectedMergedDataset, nextState1.visState.datasets[hexDataId])
t.deepEqual(nextState1.visState.splitMaps, [], 'should clear out splitMaps');
@@ -223,10 +238,7 @@ test('#composerStateReducer - addDataToMapUpdater: keepExistingConfig', t => {
const expectedVisState = {
layers: [...oldLayers, mergedH3Layer],
filters: [...oldFilters, ...mergedFilters],
- datasets: {
- ...oldDatasets,
- [hexDataId]: hexDataset
- },
+ datasets: 'test seperate',
interactionConfig: {
...oldInteractionConfig,
tooltip: {
@@ -240,30 +252,49 @@ test('#composerStateReducer - addDataToMapUpdater: keepExistingConfig', t => {
}
},
splitMaps: [
- {layers: {
- ...oldSplitMaps[0].layers,
- avlgol: true
- }},
- {layers: {
- ...oldSplitMaps[1].layers,
- avlgol: true
- }}
+ {
+ layers: {
+ ...oldSplitMaps[0].layers,
+ avlgol: true
+ }
+ },
+ {
+ layers: {
+ ...oldSplitMaps[1].layers,
+ avlgol: true
+ }
+ }
],
layerOrder: [2, 0, 1]
};
cmpLayers(t, expectedVisState.layers, actualVisState.layers);
cmpFilters(t, expectedVisState.filters, actualVisState.filters);
- cmpDatasets(t, expectedVisState.datasets, actualVisState.datasets);
- cmpInteraction(t, expectedVisState.interactionConfig, actualVisState.interactionConfig);
- t.deepEqual(expectedVisState.layerOrder, actualVisState.layerOrder, 'Should create new layer, move it to the top');
- t.deepEqual(expectedVisState.splitMaps, actualVisState.splitMaps, 'Should keep existing splitMaps, add new layres to splitMaps');
+ // test datasets
+ t.deepEqual(Object.keys(actualVisState.datasets), [sampleConfig.dataId, hexDataId], 'should save 2 datasets to state');
+ t.equal(actualVisState.datasets[sampleConfig.dataId], oldDatasets[sampleConfig.dataId], 'should keep oldDataset same');
+
+ cmpDataset(t, expectedMergedDataset, actualVisState.datasets[hexDataId], 'should merge and filter hexdata');
+ cmpInteraction(
+ t,
+ expectedVisState.interactionConfig,
+ actualVisState.interactionConfig
+ );
+ t.deepEqual(
+ expectedVisState.layerOrder,
+ actualVisState.layerOrder,
+ 'Should create new layer, move it to the top'
+ );
+ t.deepEqual(
+ expectedVisState.splitMaps,
+ actualVisState.splitMaps,
+ 'Should keep existing splitMaps, add new layers to splitMaps'
+ );
t.end();
});
test('#composerStateReducer - addDataToMapUpdater: readOnly', t => {
-
const datasets = {
data: processCsvData(testCsvData),
info: {
@@ -288,7 +319,11 @@ test('#composerStateReducer - addDataToMapUpdater: readOnly', t => {
datasets
}
});
- t.equal(nextState1.uiState.readOnly, false, 'should set readonly to be false');
+ t.equal(
+ nextState1.uiState.readOnly,
+ false,
+ 'should set readonly to be false'
+ );
const nextState2 = addDataToMapUpdater(state, {
payload: {
@@ -298,6 +333,10 @@ test('#composerStateReducer - addDataToMapUpdater: readOnly', t => {
}
}
});
- t.equal(nextState2.uiState.readOnly, false, 'should set readonly to be false');
+ t.equal(
+ nextState2.uiState.readOnly,
+ false,
+ 'should set readonly to be false'
+ );
t.end();
});
diff --git a/test/node/reducers/vis-state-merger-test.js b/test/node/reducers/vis-state-merger-test.js
index 4bc10d66d..cfaefe9ca 100644
--- a/test/node/reducers/vis-state-merger-test.js
+++ b/test/node/reducers/vis-state-merger-test.js
@@ -97,8 +97,10 @@ import {
testAllData,
timeFilterProps,
dateFilterProps,
+ epochFilterProps,
mergedTimeFilter,
- mergedDateFilter
+ mergedDateFilter,
+ mergedEpochFilter
} from 'test/fixtures/test-csv-data';
import {
@@ -153,6 +155,7 @@ test('VisStateMerger.v1 -> mergeFilters -> toEmptyState', t => {
const savedConfig = cloneDeep(savedStateV1);
const oldState = cloneDeep(InitialState);
const oldVisState = oldState.visState;
+ const expectedMergedFilterV1 = mergedFiltersV1;
const parsedConfig = SchemaManager.parseSavedConfig(
savedConfig.config,
@@ -161,7 +164,6 @@ test('VisStateMerger.v1 -> mergeFilters -> toEmptyState', t => {
const parsedFilters = parsedConfig.visState.filters;
const mergedState = mergeFilters(oldState.visState, parsedFilters);
-
Object.keys(oldVisState).forEach(key => {
if (key === 'filterToBeMerged') {
t.deepEqual(
@@ -184,7 +186,7 @@ test('VisStateMerger.v1 -> mergeFilters -> toEmptyState', t => {
const stateWData = visStateReducer(mergedState, updateVisData(parsedData));
// test parsed filters
- cmpFilters(t, mergedFiltersV1, stateWData.filters);
+ cmpFilters(t, expectedMergedFilterV1, stateWData.filters);
t.end();
});
@@ -1303,21 +1305,53 @@ test('VisStateMerger.v1 -> mergeFilters -> multiFilters', t => {
...f,
...(
f.name === 'time' ?
- {filterProps: timeFilterProps} : f.name === 'date' ?
- {filterProps: dateFilterProps} : {}
+ {filterProps: timeFilterProps} :
+ f.name === 'date' ?
+ {filterProps: dateFilterProps} :
+ f.name === 'epoch' ?
+ {filterProps: epochFilterProps} :
+ {}
)
})),
allData: testAllData,
+ allIndexes: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
id: testCsvDataId,
label: 'hello.csv',
color: 'donot test me',
- data: [
- testAllData[9],
- testAllData[10]
- ],
- filteredIndex: [9, 10],
+ filteredIndex: [0, 1, 2, 3, 7, 8, 9, 10, 11, 12],
filteredIndexForDomain: [0, 1, 2, 3, 7, 8, 9, 10, 11, 12],
- fieldPairs: oldCsvData.fieldPairs
+ fieldPairs: oldCsvData.fieldPairs,
+ filterRecord: {
+ dynamicDomain: [mergedDateFilter],
+ fixedDomain: [mergedTimeFilter, mergedEpochFilter],
+ cpu: [mergedDateFilter],
+ gpu: [mergedTimeFilter, mergedEpochFilter]
+ },
+ gpuFilter: {
+ filterRange: [
+ [1474606800000 - 1474588800000, 1474617600000 - 1474588800000],
+ [1472700000000 - 1472688000000, 1472760000000 - 1472688000000],
+ [0, 0],
+ [0, 0]
+ ],
+ filterValueUpdateTriggers: {
+ gpuFilter_0: 'time',
+ gpuFilter_1: 'epoch',
+ gpuFilter_2: null,
+ gpuFilter_3: null
+ },
+ filterValueAccessor: {
+ inputs: [{
+ data: testAllData[1],
+ index: 1
+ }],
+ result: [
+ 1474588800000 - 1474588800000,
+ 1472688000000 - 1472688000000,
+ 0,0
+ ]
+ }
+ }
},
[testGeoJsonDataId]: {
fields: testGeoJsonFields.map(f => ({
@@ -1328,11 +1362,38 @@ test('VisStateMerger.v1 -> mergeFilters -> multiFilters', t => {
{filterProps: geoJsonRateFilterProps} : {}
)
})),
+ filterRecord: {
+ dynamicDomain: [mergedRateFilter, mergedTripFilter],
+ fixedDomain: [],
+ cpu: [mergedRateFilter],
+ gpu: [mergedTripFilter]
+ },
+ gpuFilter: {
+ filterRange: [
+ [0, 8],
+ [0, 0],
+ [0, 0],
+ [0, 0]
+ ],
+ filterValueUpdateTriggers: {
+ gpuFilter_0: 'TRIPS',
+ gpuFilter_1: null,
+ gpuFilter_2: null,
+ gpuFilter_3: null
+ },
+ filterValueAccessor: {
+ inputs: [{
+ data: testGeoJsonAllData[1],
+ index: 1
+ }],
+ result: [0, 0, 0, 0]
+ }
+ },
allData: testGeoJsonAllData,
+ allIndexes: [0, 1, 2, 3, 4],
id: testGeoJsonDataId,
label: 'zip.geojson',
color: 'donot test me',
- data: [testGeoJsonAllData[0]],
filteredIndex: [0],
filteredIndexForDomain: [0],
fieldPairs: oldGeoJsonData.fieldPairs
@@ -1345,7 +1406,8 @@ test('VisStateMerger.v1 -> mergeFilters -> multiFilters', t => {
mergedTimeFilter,
mergedRateFilter,
mergedDateFilter,
- mergedTripFilter
+ mergedTripFilter,
+ mergedEpochFilter
];
cmpFilters(t, expectedFilters, mergedState.filters);
diff --git a/test/node/reducers/vis-state-test.js b/test/node/reducers/vis-state-test.js
index cdb98d0e0..302fe2c50 100644
--- a/test/node/reducers/vis-state-test.js
+++ b/test/node/reducers/vis-state-test.js
@@ -28,12 +28,13 @@ import reducer from 'reducers/vis-state';
import {
INITIAL_VIS_STATE,
- DEFAULT_EDITOR,
defaultAnimationConfig
} from 'reducers/vis-state-updaters';
-import {getDefaultFilter} from 'utils/filter-utils';
import {getDefaultInteraction} from 'utils/interaction-utils';
+import {
+ getDefaultFilter
+} from 'utils/filter-utils';
import {createNewDataEntry} from 'utils/dataset-utils';
import {processCsvData, processGeojson} from 'processors/data-processor';
import {Layer, KeplerGlLayers} from 'layers';
@@ -48,11 +49,12 @@ const {
} = KeplerGlLayers;
// fixtures
-import testData, {testFields, testAllData} from 'test/fixtures/test-csv-data';
+import testData, {mergedTimeFilter, testFields, testAllData} from 'test/fixtures/test-csv-data';
import {
geojsonData,
- geoBounds,
geoJsonTripFilterProps,
+ expectedDataToFeature,
+ updatedGeoJsonLayer,
fields as geojsonFields
} from 'test/fixtures/geojson';
@@ -64,7 +66,8 @@ import {
cmpFilters,
cmpLayers,
cmpDatasets,
- cmpDataset
+ cmpDataset,
+ cmpObjectKeys
} from 'test/helpers/comparison-utils';
import {
applyActions,
@@ -419,7 +422,7 @@ test('#visStateReducer -> LAYER_TYPE_CHANGE.2', t => {
t.equal(newLayer.config.colorScale, 'ordinal', 'should scale to ordinal');
t.deepEqual(
newLayer.config.colorDomain,
- ['driver_analytics', 'driver_gps'],
+ ['driver_analytics', 'driver_analytics_0', 'driver_gps'],
'should calculate color domain'
);
t.equal(
@@ -511,7 +514,7 @@ test('#visStateReducer -> LAYER_TYPE_CHANGE.2', t => {
t.equal(newLayer4.config.colorField, stringField, 'should keep colorField');
t.deepEqual(
newLayer4.config.colorDomain,
- ['driver_analytics', 'driver_gps'],
+ ['driver_analytics', 'driver_analytics_0', 'driver_gps'],
'should calculate color domain'
);
t.equal(newLayer4.config.colorScale, 'ordinal', 'should keep color scale');
@@ -889,89 +892,111 @@ test('#visStateReducer -> UPDATE_LAYER_BLENDING', t => {
});
test('#visStateReducer -> REMOVE_FILTER', t => {
- const currentFilters = [
- {
- fieldIdx: [0],
- dataId: ['smoothie'],
- name: mockData.fields[0].name,
- type: 'range',
- value: [12.25, 12.29]
- },
- {
- fieldIdx: [1],
- dataId: ['milkshake'],
- name: mockData.fields[1].name,
- type: 'range',
- value: [35.3, 37.75]
- }
- ];
-
- const oldState = {
- filters: currentFilters,
- datasets: {
- milkshake: {
- allData: [
- [12.25, 37.75, 45.21, 100.12],
- [null, 35.2, 45, 21.3],
- [12.29, 37.64, 46.21, 99.127],
- [null, null, 33.1, 29.34]
- ],
- data: [[12.25, 37.75, 45.21, 100.12], [12.29, 37.64, 46.21, 99.127]],
- filteredIndex: [0, 2],
- filteredIndexForDomain: [0, 2]
+ const initialState = StateWFilters.visState;
+ // filter[0]: 'time' testCsvData
+ // filter[1]: 'RATE' testGeoJsonData
+
+ const dataset0 = initialState.datasets[testCsvDataId];
+ const dataset1 = initialState.datasets[testGeoJsonDataId];
+
+ const expectedData0 = {
+ ...dataset0,
+ gpuFilter: {
+ filterRange: [
+ [1474606800000 - 1474588800000, 1474617600000 - 1474588800000],
+ [0, 0],
+ [0, 0],
+ [0, 0]
+ ],
+ filterValueUpdateTriggers: {
+ gpuFilter_0: 'time',
+ gpuFilter_1: null,
+ gpuFilter_2: null,
+ gpuFilter_3: null
},
- smoothie: {
- allData: [
- [12.25, 37.75, 45.21, 100.12],
- [null, 35.2, 45, 21.3],
- [12.29, 37.64, 46.21, 99.127],
- [null, null, 33.1, 29.34]
+ filterValueAccessor: {
+ inputs: [
+ {
+ data: dataset0.allData[0],
+ index: 0
+ }
],
- data: [[12.25, 37.75, 45.21, 100.12], [12.29, 37.64, 46.21, 99.127]],
- filteredIndex: [0, 2],
- filteredIndexForDomain: [0, 2]
+ result: [0, 0, 0, 0]
}
},
- layers: [],
- layerData: [],
- editor: DEFAULT_EDITOR
+ filterRecord: {
+ dynamicDomain: [],
+ fixedDomain: [initialState.filters[0]],
+ cpu: [],
+ gpu: [initialState.filters[0]]
+ }
};
- // remove smoothie filter
- const newReducer = reducer(oldState, VisStateActions.removeFilter(0));
+ const expectedData1 = {
+ ...dataset1,
+ filteredIndex: dataset1.allIndexes,
+ filteredIndexForDomain: dataset1.allIndexes,
+ filterRecord: {
+ dynamicDomain: [],
+ fixedDomain: [],
+ cpu: [],
+ gpu: []
+ }
+ };
- t.deepEqual(
- newReducer,
- {
- filters: [
- {
- fieldIdx: [1],
- dataId: ['milkshake'],
- name: mockData.fields[1].name,
- type: 'range',
- value: [35.3, 37.75]
- }
- ],
- datasets: {
- milkshake: {
- allData: mockData.data,
- data: [mockData.data[0], mockData.data[2]],
- filteredIndex: [0, 2],
- filteredIndexForDomain: [0, 2]
- },
- smoothie: {
- allData: mockData.data,
- data: mockData.data,
- filteredIndex: [0, 1, 2, 3],
- filteredIndexForDomain: [0, 1, 2, 3]
- }
- },
- layers: [],
- layerData: [],
- editor: DEFAULT_EDITOR
+ const expectedFilters = [mergedTimeFilter];
+
+ // remove smoothie filter - gpu: true, fixedDomain: false
+ const newReducer = reducer(initialState, VisStateActions.removeFilter(1));
+
+ const expectedLayerData1 = {data: dataset1.allData.map(d => d)};
+ const expectedState = {
+ ...initialState,
+ filters: expectedFilters,
+ datasets: {
+ [testCsvDataId]: expectedData0,
+ [testGeoJsonDataId]: expectedData1
},
- 'should remove filter and recalculate data only for associated dataset'
- );
+ layerData: [
+ initialState.layerData[0],
+ expectedLayerData1
+ ]
+ };
+
+ cmpObjectKeys(t, expectedState, newReducer, 'After removing filter, visState');
+
+ Object.keys(newReducer).forEach(key => {
+ switch (key) {
+ case 'datasets':
+ cmpDatasets(t, expectedState.datasets, newReducer.datasets);
+ break;
+ case 'filters':
+ cmpFilters(t, expectedState.filters, newReducer.filters);
+ break;
+ case 'layers':
+ cmpLayers(t, expectedState.layers, newReducer.layers);
+ break;
+ case 'layerData':
+ // only compare length
+
+ t.equal(
+ expectedState.layerData.length,
+ newReducer.layerData.length,
+ 'should have same number of layerData'
+ );
+ newReducer.layerData.forEach((ld, i) => {
+ t.equal(
+ expectedState.layerData[i].data.length,
+ newReducer.layerData[i].data.length,
+ 'layerData.data should have same length'
+ );
+ });
+ break;
+ default:
+ t.deepEqual(newReducer[key], expectedState[key], `visState.${key} should be correct after removing filter`);
+ break;
+ }
+ });
t.end();
});
@@ -1090,8 +1115,21 @@ test('#visStateReducer -> UPDATE_VIS_DATA.2 -> to empty state', t => {
fields: expectedFields,
filteredIndex: mockRawData.rows.map((_, i) => i),
filteredIndexForDomain: mockRawData.rows.map((_, i) => i),
+ allIndexes: mockRawData.rows.map((_, i) => i),
allData: mockRawData.rows,
- data: mockRawData.rows,
+ gpuFilter: {
+ filterRange: [[0, 0], [0, 0], [0, 0], [0, 0]],
+ filterValueUpdateTriggers: {
+ gpuFilter_0: null,
+ gpuFilter_1: null,
+ gpuFilter_2: null,
+ gpuFilter_3: null
+ },
+ filterValueAccessor: {
+ inputs: ['a', 'b', 'c', 'd', 'e'],
+ result: [0, 0, 0, 0]
+ }
+ },
color: 'donnot test me',
id: 'smoothie',
label: 'exciting dataset',
@@ -1226,8 +1264,7 @@ test('#visStateReducer -> UPDATE_VIS_DATA.3 -> merge w/ existing state', t => {
datasets: {
snowflake: {
fields: [{id: 'a'}, {id: 'b'}],
- allData: [['something'], ['something_else']],
- data: [['something']]
+ allData: [['something'], ['something_else']]
}
},
filters: [{name: 'hello'}, {name: 'world'}],
@@ -1249,16 +1286,28 @@ test('#visStateReducer -> UPDATE_VIS_DATA.3 -> merge w/ existing state', t => {
const expectedDatasets = {
snowflake: {
fields: [{id: 'a'}, {id: 'b'}],
- allData: [['something'], ['something_else']],
- data: [['something']]
+ allData: [['something'], ['something_else']]
},
smoothie: {
fields: expectedFields,
allData: mockRawData.rows,
- data: mockRawData.rows,
color: 'donnot test me',
filteredIndex: mockRawData.rows.map((_, i) => i),
filteredIndexForDomain: mockRawData.rows.map((_, i) => i),
+ allIndexes: mockRawData.rows.map((_, i) => i),
+ gpuFilter: {
+ filterRange: [[0, 0], [0, 0], [0, 0], [0, 0]],
+ filterValueUpdateTriggers: {
+ gpuFilter_0: null,
+ gpuFilter_1: null,
+ gpuFilter_2: null,
+ gpuFilter_3: null
+ },
+ filterValueAccessor: {
+ inputs: [{data: mockData.data[0], index: 0}],
+ result: [0, 0, 0, 0]
+ }
+ },
id: 'smoothie',
label: 'smoothie and milkshake',
fieldPairs: [
@@ -1376,23 +1425,25 @@ test('#visStateReducer -> UPDATE_VIS_DATA.4.Geojson -> geojson data', t => {
label: 'king milkshake',
color: 'donnot test me',
allData: rows,
- data: rows,
filteredIndex: rows.map((_, i) => i),
filteredIndexForDomain: rows.map((_, i) => i),
+ allIndexes: rows.map((_, i) => i),
fields: fields.map(f => ({...f, id: f.name})),
- fieldPairs: []
- };
-
- const dataToFeature = geojsonData.features.reduce(
- (accu, f, i) => ({
- ...accu,
- [i]: {
- ...f,
- properties: {...f.properties, index: i}
+ fieldPairs: [],
+ gpuFilter: {
+ filterRange: [[0, 0], [0, 0], [0, 0], [0, 0]],
+ filterValueUpdateTriggers: {
+ gpuFilter_0: null,
+ gpuFilter_1: null,
+ gpuFilter_2: null,
+ gpuFilter_3: null
+ },
+ filterValueAccessor: {
+ inputs: [{data: mockData.data[0], index: 0}],
+ result: [0, 0, 0, 0]
}
- }),
- {}
- );
+ }
+ };
const expectedLayer = new GeojsonLayer({
label: 'king milkshake',
@@ -1407,14 +1458,8 @@ test('#visStateReducer -> UPDATE_VIS_DATA.4.Geojson -> geojson data', t => {
filled: true,
strokeColor: layer1StrokeColor
});
- expectedLayer.dataToFeature = dataToFeature;
- expectedLayer.meta = {
- bounds: geoBounds,
- fixedRadius: false,
- featureTypes: {
- polygon: true
- }
- };
+ expectedLayer.dataToFeature = expectedDataToFeature;
+ expectedLayer.meta = updatedGeoJsonLayer.meta;
const expectedLayerData = {
data: geojsonData.features.map((f, i) => ({
@@ -1529,29 +1574,25 @@ test('#visStateReducer -> UPDATE_VIS_DATA -> mergeFilters', t => {
const oldState = CloneDeep(INITIAL_VIS_STATE);
oldState.filterToBeMerged = [
{
- ...getDefaultFilter('smoothie'),
+ dataId: 'smoothie',
id: '38chejr',
enlarged: true,
name: mockFilter.name,
type: mockFilter.type,
- value: mockFilter.value,
- // fieldIdx is now required
- fieldIdx: [0]
+ value: mockFilter.value
},
{
- ...getDefaultFilter('nothing_here'),
+ dataId: 'nothing_here',
id: 'vuey55d',
enlarged: true,
name: 'test_test',
type: 'select',
- value: true,
- // fieldIdx is now required
- fieldIdx: [0]
+ value: true
}
];
const expectedFilter = {
- ...getDefaultFilter('smoothie'),
+ dataId: ['smoothie'],
domain: [12.25, 12.29],
enlarged: true,
fieldIdx: [0],
@@ -1561,9 +1602,11 @@ test('#visStateReducer -> UPDATE_VIS_DATA -> mergeFilters', t => {
freeze: true,
plotType: 'histogram',
yAxis: null,
+ gpu: true,
+ gpuChannel: [0],
interval: null,
- histogram: [1],
- enlargedHistogram: [1],
+ histogram: [],
+ enlargedHistogram: [],
isAnimating: false,
name: [mockFilter.name],
speed: 1,
@@ -1573,8 +1616,6 @@ test('#visStateReducer -> UPDATE_VIS_DATA -> mergeFilters', t => {
value: mockFilter.value
};
- const filteredData = [mockData.data[0]];
-
const newState = reducer(
oldState,
VisStateActions.updateVisData([
@@ -1585,14 +1626,41 @@ test('#visStateReducer -> UPDATE_VIS_DATA -> mergeFilters', t => {
])
);
+ const allIndexes = mockRawData.rows.map((_, i) => i);
+
const expectedDatasets = {
smoothie: {
fields: expectedFields,
- filteredIndex: [0],
+ // gpu filter in place, filteredIndex should not be updated
+ filteredIndex: allIndexes,
filteredIndexForDomain: [0],
+ filterRecord: {
+ dynamicDomain: [newState.filters.find(f => f.id === '38chejr')],
+ fixedDomain: [],
+ cpu: [],
+ gpu: [newState.filters.find(f => f.id === '38chejr')]
+ },
+ gpuFilter: {
+ filterRange: [
+ [mockFilter.value[0] - expectedFilter.domain[0], mockFilter.value[1] - expectedFilter.domain[0]],
+ [0, 0],
+ [0, 0],
+ [0, 0]
+ ],
+ filterValueUpdateTriggers: {
+ gpuFilter_0: mockFilter.name,
+ gpuFilter_1: null,
+ gpuFilter_2: null,
+ gpuFilter_3: null
+ },
+ filterValueAccessor: {
+ inputs: [{data: mockRawData.rows[0], index: 1}],
+ result: [12.25 - expectedFilter.domain[0], 0, 0, 0]
+ }
+ },
+ allIndexes,
allData: mockRawData.rows,
- data: filteredData,
- color: 'donnot test me',
+ color: 'donot test me',
id: 'smoothie',
label: 'smoothie and milkshake',
fieldPairs: [
@@ -1654,6 +1722,12 @@ test('#visStateReducer -> UPDATE_VIS_DATA -> mergeFilters', t => {
//
// cmpDatasets(t, expectedState.datasets, newState.datasets);
+ // filteredIndex should be shallow equal
+ t.equal(
+ newState.datasets.smoothie.filteredIndex,
+ newState.datasets.smoothie.allIndexes,
+ 'filteredIndex should be shallow equal'
+ );
t.end();
});
@@ -1760,7 +1834,7 @@ test('#visStateReducer -> UPDATE_VIS_DATA.SPLIT_MAPS', t => {
t.end();
});
-test('#visStateReducer -> SET_FILTER (processCsvData)', t => {
+test('#visStateReducer -> setFilter.dynamicDomain & cpu', t => {
// get test data
const {fields, rows} = processCsvData(testData);
const payload = [
@@ -1807,7 +1881,7 @@ test('#visStateReducer -> SET_FILTER (processCsvData)', t => {
);
const expectedFilter = {
- ...getDefaultFilter('smoothie'),
+ dataId: ['smoothie'],
freeze: false,
id: 'donnot test me yet',
name: [],
@@ -1820,7 +1894,9 @@ test('#visStateReducer -> SET_FILTER (processCsvData)', t => {
plotType: 'histogram',
yAxis: null,
speed: 1,
- interval: null
+ interval: null,
+ gpu: false,
+ fieldIdx: []
};
cmpFilters(t, expectedFilter, stateWithFilter.filters[0]);
@@ -1833,7 +1909,7 @@ test('#visStateReducer -> SET_FILTER (processCsvData)', t => {
);
const expectedFilterWName = {
- ...getDefaultFilter('smoothie'),
+ dataId: ['smoothie'],
freeze: true,
id: filterId,
name: ['date'],
@@ -1848,7 +1924,8 @@ test('#visStateReducer -> SET_FILTER (processCsvData)', t => {
plotType: 'histogram',
yAxis: null,
speed: 1,
- interval: null
+ interval: null,
+ gpu: false
};
// test filter
@@ -1860,24 +1937,45 @@ test('#visStateReducer -> SET_FILTER (processCsvData)', t => {
type: 'multiSelect',
value: [],
fieldType: 'date',
- domain: ['2016-09-23', '2016-09-24', '2016-10-10']
+ domain: ['2016-09-23', '2016-09-24', '2016-10-10'],
+ gpu: false
}
};
const {allData} = initialState.datasets.smoothie;
+
// test dataset
const expectedDataset = {
id: 'smoothie',
label: 'queen smoothie',
color: 'donnot test me',
allData,
- data: [],
fields: [
...initialState.datasets.smoothie.fields.slice(0, 10),
updatedField
],
- filteredIndex: [],
- filteredIndexForDomain: [],
+ filteredIndex: allData.map((d, i) => i),
+ filteredIndexForDomain: allData.map((d, i) => i),
+ allIndexes: allData.map((d, i) => i),
+ filterRecord: {
+ dynamicDomain: [],
+ fixedDomain: [],
+ cpu: [],
+ gpu: []
+ },
+ gpuFilter: {
+ filterRange: [[0, 0], [0, 0], [0, 0], [0, 0]],
+ filterValueUpdateTriggers: {
+ gpuFilter_0: null,
+ gpuFilter_1: null,
+ gpuFilter_2: null,
+ gpuFilter_3: null
+ },
+ filterValueAccessor: {
+ inputs: [{data: allData[0], index: 0}],
+ result: [0, 0, 0, 0]
+ }
+ },
fieldPairs: [
{
defaultName: 'gps data',
@@ -1895,7 +1993,7 @@ test('#visStateReducer -> SET_FILTER (processCsvData)', t => {
}
]
};
-
+ console.log('cmpDataset')
cmpDataset(t, expectedDataset, stateWithFilterName.datasets.smoothie);
// set filter value
@@ -1912,17 +2010,17 @@ test('#visStateReducer -> SET_FILTER (processCsvData)', t => {
// test filter
cmpFilters(t, expectedFilterWValue, stateWithFilterValue.filters[0]);
+ const updatedFilterWValue = stateWithFilterValue.filters[0];
+
const expectedFilteredDataset = {
...expectedDataset,
+ filterRecord: {
+ dynamicDomain: [updatedFilterWValue],
+ fixedDomain: [],
+ cpu: [updatedFilterWValue],
+ gpu: []
+ },
allData,
- data: [
- allData[17],
- allData[18],
- allData[19],
- allData[20],
- allData[21],
- allData[22]
- ],
filteredIndex: [17, 18, 19, 20, 21, 22],
filteredIndexForDomain: [17, 18, 19, 20, 21, 22]
};
@@ -1935,96 +2033,12 @@ test('#visStateReducer -> SET_FILTER (processCsvData)', t => {
const expectedLayerData1 = {
data: [
- {
- data: [
- '2016-09-17 00:26:29',
- 30.0538936,
- 31.2165983,
- 'driver_analytics',
- 1472774400000,
- null,
- 43,
- '2016-09-23T07:00:00.000Z',
- '2016-10-01 09:59:53+00:00',
- '2016-10-01 16:59:53+00:00',
- '2016-10-10'
- ]
- },
- {
- data: [
- '2016-09-17 00:27:31',
- 30.060911,
- 31.2148748,
- 'driver_analytics',
- 1472774400000,
- null,
- 4,
- '2016-09-23T07:00:00.000Z',
- '2016-10-01 09:57:11+00:00',
- '2016-10-01 16:57:11+00:00',
- '2016-10-10'
- ]
- },
- {
- data: [
- '2016-09-17 00:28:35',
- 30.060334,
- 31.2212278,
- 'driver_analytics',
- 1472774400000,
- null,
- 5,
- '2016-09-23T07:00:00.000Z',
- '2016-10-01 09:59:27+00:00',
- '2016-10-01 16:59:27+00:00',
- '2016-10-10'
- ]
- },
- {
- data: [
- '2016-09-17 00:29:40',
- 30.0554663,
- 31.2288985,
- 'driver_analytics',
- 1472774400000,
- true,
- null,
- '2016-09-23T07:00:00.000Z',
- '2016-10-01 09:46:36+00:00',
- '2016-10-01 16:46:36+00:00',
- '2016-10-10'
- ]
- },
- {
- data: [
- '2016-09-17 00:30:03',
- 30.0614122,
- 31.2187021,
- 'driver_gps',
- 1472774400000,
- true,
- 6,
- '2016-09-23T08:00:00.000Z',
- '2016-10-01 09:54:31+00:00',
- '2016-10-01 16:54:31+00:00',
- '2016-10-10'
- ]
- },
- {
- data: [
- '2016-09-17 00:30:03',
- 30.0612697,
- 31.2191059,
- 'driver_gps',
- 1472774400000,
- true,
- 7,
- '2016-09-23T08:00:00.000Z',
- '2016-10-01 09:53:35+00:00',
- '2016-10-01 16:53:35+00:00',
- '2016-10-10'
- ]
- }
+ {data: allData[17], index: 17, position: [31.2165983, 30.0538936, 0]},
+ {data: allData[18], index: 18, position: [31.2148748, 30.060911, 0]},
+ {data: allData[19], index: 19, position: [31.2212278, 30.060334, 0]},
+ {data: allData[20], index: 20, position: [31.2288985, 30.0554663, 0]},
+ {data: allData[21], index: 21, position: [31.2187021, 30.0614122, 0]},
+ {data: allData[22], index: 22, position: [31.2191059, 30.0612697, 0]}
],
getPosition: () => {},
getColor: () => {},
@@ -2070,7 +2084,9 @@ test('#visStateReducer -> SET_FILTER.name', t => {
step: 0.01,
histogram: [],
enlargedHistogram: 'dont test me',
- typeOptions: ['range']
+ typeOptions: ['range'],
+ gpu: true,
+ gpuChannel: [0]
};
cmpFilters(t, [expectedFilter0, expectedFilter1], updated.filters);
@@ -2078,7 +2094,7 @@ test('#visStateReducer -> SET_FILTER.name', t => {
t.end();
});
-test('#visStateReducer -> SET_FILTER (processGeojson)', t => {
+test('#visStateReducer -> setFilter.dynamicDomain & gpu', t => {
const {fields, rows} = processGeojson(CloneDeep(geojsonData));
const payload = [
{
@@ -2128,7 +2144,9 @@ test('#visStateReducer -> SET_FILTER (processGeojson)', t => {
plotType: 'histogram',
yAxis: null,
interval: null,
- speed: 1
+ speed: 1,
+ gpu: true,
+ gpuChannel: [0]
};
// test filter
@@ -2150,77 +2168,6 @@ test('#visStateReducer -> SET_FILTER (processGeojson)', t => {
const expectedFilteredDataset = {
...initialState.datasets.milkshake,
- data: [
- [
- {
- type: 'Feature',
- properties: {
- OBJECTID: 1,
- ZIP_CODE: 94107,
- ID: 94107,
- TRIPS: 11,
- RATE: 'a',
- index: 0
- },
- geometry: {
- type: 'Polygon',
- coordinates: [
- [
- [-122.401159718585049, 37.782024266952142],
- [-122.400374366843309, 37.782644515545172],
- [-122.400019020063766, 37.782925153640136],
- [-122.399891477967842, 37.783025880124256],
- [-122.398930331092998, 37.783784933304034],
- [-122.397811613142864, 37.784666586003652],
- [-122.396705177550587, 37.785542130425938],
- [-122.395895701657864, 37.784896929203114],
- [-122.395160622349934, 37.78431101230386],
- [-122.394398389309941, 37.783701667981575],
- [-122.401159718585049, 37.782024266952142]
- ]
- ]
- }
- },
- 1,
- 94107,
- 94107,
- 11,
- 'a'
- ],
- [
- {
- type: 'Feature',
- properties: {
- OBJECTID: 3,
- ZIP_CODE: 94109,
- ID: 94109,
- TRIPS: 20,
- index: 2
- },
- geometry: {
- type: 'Polygon',
- coordinates: [
- [
- [-122.39249932896719, 37.793768814133983],
- [-122.391890260341384, 37.794278544568918],
- [-122.391788865572423, 37.794170982455135],
- [-122.39173429034625, 37.79420276052317],
- [-122.391666728649753, 37.794132425256194],
- [-122.391723034266192, 37.79410061945832],
- [-122.391673228351905, 37.794047854124599],
- [-122.391982015107928, 37.793871906128679],
- [-122.39249932896719, 37.793768814133983]
- ]
- ]
- }
- },
- 3,
- 94109,
- 94109,
- 20,
- null
- ]
- ],
// receive Vis Data will add id to fields
// filter will add filterProps to fields
@@ -2233,22 +2180,44 @@ test('#visStateReducer -> SET_FILTER (processGeojson)', t => {
}
: {...f, id: f.name}
),
- filteredIndex: [0, 2],
- filteredIndexForDomain: [0, 2]
+ gpuFilter: {
+ filterRange: [[4, 16], [0, 0], [0, 0], [0, 0]],
+ filterValueUpdateTriggers: {
+ gpuFilter_0: 'TRIPS',
+ gpuFilter_1: null,
+ gpuFilter_2: null,
+ gpuFilter_3: null
+ },
+ filterValueAccessor: {
+ inputs: [
+ {data: initialState.datasets.milkshake.allData[0], index: 0}
+ ],
+ result: [7, 0, 0, 0]
+ }
+ },
+ filterRecord: {
+ dynamicDomain: [stateWithFilterValue.filters[0]],
+ fixedDomain: [],
+ cpu: [],
+ gpu: [stateWithFilterValue.filters[0]]
+ },
+ filteredIndex: geojsonData.features.map((_, i) => i),
+ filteredIndexForDomain: [0, 2],
+ allIndexes: geojsonData.features.map((_, i) => i)
};
- const actualTripFeild = stateWithFilterValue.datasets.milkshake.fields[4];
- const expectetField = expectedFilteredDataset.fields[4];
+ const actualTripField = stateWithFilterValue.datasets.milkshake.fields[4];
+ const expectedField = expectedFilteredDataset.fields[4];
t.deepEqual(
- Object.keys(actualTripFeild).sort(),
- Object.keys(expectetField).sort(),
+ Object.keys(actualTripField).sort(),
+ Object.keys(expectedField).sort(),
'trip field keys should be same'
);
- Object.keys(actualTripFeild).forEach(k => {
+ Object.keys(actualTripField).forEach(k => {
t.deepEqual(
- actualTripFeild[k],
- expectetField[k],
+ actualTripField[k],
+ expectedField[k],
`trip field ${k} should be same`
);
});
@@ -2279,7 +2248,7 @@ test('#visStateReducer -> UPDATE_FILTER_ANIMATION_SPEED', t => {
t.end();
});
-test('#visStateReducer -> SET_FILTER.fixedDomain', t => {
+test('#visStateReducer -> setFilter.fixedDomain & DynamicDomain & gpu & cpu', t => {
// get test data
const {fields, rows} = processCsvData(testData);
const payload = [
@@ -2300,6 +2269,7 @@ test('#visStateReducer -> SET_FILTER.fixedDomain', t => {
}
}).smoothie;
+ // add fixedDomain & gpu filter
const stateWidthTsFilter = applyActions(reducer, INITIAL_VIS_STATE, [
// receive data
{action: VisStateActions.updateVisData, payload: [payload]},
@@ -2365,7 +2335,9 @@ test('#visStateReducer -> SET_FILTER.fixedDomain', t => {
enlargedHistogram: [],
enlarged: true,
isAnimating: false,
- fieldType: 'timestamp'
+ fieldType: 'timestamp',
+ gpu: true,
+ gpuChannel: [0]
};
cmpFilters(t, expectedFilterTs, stateWidthTsFilter.filters[0]);
@@ -2388,13 +2360,35 @@ test('#visStateReducer -> SET_FILTER.fixedDomain', t => {
type: 'timeRange',
enlarged: true,
fixedDomain: true,
- value: [1474070995000, 1474072208000]
+ value: [1474070995000, 1474072208000],
+ gpu: true
}
}
: f
),
- data: [7, 8, 9, 10, 11, 12, 13].map(i => datasetSmoothie.allData[i]),
- filteredIndex: [7, 8, 9, 10, 11, 12, 13],
+ filterRecord: {
+ dynamicDomain: [],
+ fixedDomain: [stateWidthTsFilter.filters[0]],
+ cpu: [],
+ gpu: [stateWidthTsFilter.filters[0]]
+ },
+ gpuFilter: {
+ filterRange: [[1474071425000 - 1474070995000, 1474071740000 - 1474070995000], [0, 0], [0, 0], [0, 0]],
+ filterValueUpdateTriggers: {
+ gpuFilter_0: 'gps_data.utc_timestamp',
+ gpuFilter_1: null,
+ gpuFilter_2: null,
+ gpuFilter_3: null
+ },
+ filterValueAccessor: {
+ inputs: [
+ {data: datasetSmoothie.allData[1], index: 1}
+ ],
+ result: [61000, 0, 0, 0]
+ }
+ },
+ // copy everything
+ filteredIndex: datasetSmoothie.allData.map((d, i) => i),
filteredIndexForDomain: datasetSmoothie.allData.map((d, i) => i)
};
@@ -2402,16 +2396,16 @@ test('#visStateReducer -> SET_FILTER.fixedDomain', t => {
cmpDataset(t, expectedDatasetSmoothie, stateWidthTsFilter.datasets.smoothie);
const stateWidthTsAndNameFilter = applyActions(reducer, stateWidthTsFilter, [
- // add ts filter
+ // add ordinal filter
{action: VisStateActions.addFilter, payload: ['smoothie']},
- // set ts filter name
+ // set ordinal filter name
{
action: VisStateActions.setFilter,
payload: [1, 'name', 'date']
},
- // set ts filter value
+ // set ordinal filter value
{
action: VisStateActions.setFilter,
payload: [1, 'value', ['2016-09-24', '2016-10-10']]
@@ -2428,13 +2422,34 @@ test('#visStateReducer -> SET_FILTER.fixedDomain', t => {
domain: ['2016-09-23', '2016-09-24', '2016-10-10'],
fieldType: 'date',
type: 'multiSelect',
- value: []
+ value: [],
+ gpu: false
}
}
: f
),
- data: [7, 8, 9, 10, 11, 12].map(i => datasetSmoothie.allData[i]),
- filteredIndex: [7, 8, 9, 10, 11, 12],
+ gpuFilter: {
+ filterRange: [[1474071425000 - 1474070995000, 1474071740000 - 1474070995000], [0, 0], [0, 0], [0, 0]],
+ filterValueUpdateTriggers: {
+ gpuFilter_0: 'gps_data.utc_timestamp',
+ gpuFilter_1: null,
+ gpuFilter_2: null,
+ gpuFilter_3: null
+ },
+ filterValueAccessor: {
+ inputs: [
+ {data: datasetSmoothie.allData[1], index: 1}
+ ],
+ result: [61000, 0, 0, 0]
+ }
+ },
+ filterRecord: {
+ dynamicDomain: [stateWidthTsAndNameFilter.filters[1]],
+ fixedDomain: [stateWidthTsAndNameFilter.filters[0]],
+ cpu: [stateWidthTsAndNameFilter.filters[1]],
+ gpu: [stateWidthTsAndNameFilter.filters[0]]
+ },
+ filteredIndex: [7, 8, 9, 10, 11, 12, 17, 18, 19, 20, 21, 22],
filteredIndexForDomain: [7, 8, 9, 10, 11, 12, 17, 18, 19, 20, 21, 22]
};
@@ -2562,7 +2577,9 @@ test('#visStateReducer -> SET_FILTER_PLOT', t => {
enlargedHistogram: [],
enlarged: true,
isAnimating: false,
- fieldType: 'timestamp'
+ fieldType: 'timestamp',
+ gpu: true,
+ gpuChannel: [0]
};
// test filter
@@ -3200,6 +3217,7 @@ test('#visStateReducer -> MOUSE_MOVE', t => {
t.end();
});
+
test('#visStateReducer -> LAYER_COLOR_UI_CHANGE. show dropdown', t => {
const initialState = CloneDeep(StateWFilesFiltersLayerColor.visState);
const pointLayer = initialState.layers[0];
@@ -3822,9 +3840,7 @@ test('#visStateReducer -> POLYGON: Create polygon filter', t => {
allData: mockPolygonData.data,
fields: mockPolygonData.fields
}
- },
- layers: [],
- layerData: []
+ }
};
let newReducer = reducer(state, VisStateActions.addLayer());
@@ -3877,7 +3893,8 @@ test('#visStateReducer -> POLYGON: Create polygon filter', t => {
plotType: 'histogram',
yAxis: null,
interval: null,
- layerId: [newReducer.layers[0].id]
+ layerId: [newReducer.layers[0].id],
+ gpu: false
};
t.deepEqual(
@@ -3995,9 +4012,7 @@ test('#visStateReducer -> POLYGON: Toggle filter feature', t => {
allData: mockPolygonData.data,
fields: mockPolygonData.fields
}
- },
- layers: [],
- layerData: []
+ }
};
let newReducer = reducer(state, VisStateActions.addLayer());
@@ -4048,7 +4063,8 @@ test('#visStateReducer -> POLYGON: Toggle filter feature', t => {
plotType: 'histogram',
yAxis: null,
interval: null,
- layerId: [newReducer.layers[0].id]
+ layerId: [newReducer.layers[0].id],
+ gpu: false
};
t.deepEqual(
@@ -4182,6 +4198,109 @@ test('#uiStateReducer -> TOGGLE_EDITOR_VISIBILITY', t => {
newState.editor.visible,
true,
'Should set editor visibility to true'
+ );
+
+ t.end();
+});
+
+test('#visStateReducer -> APPLY_CPU_FILTER. no filter', t => {
+ const initialState = CloneDeep(StateWFiles.visState);
+ const dataId = testCsvDataId;
+ const previousDataset = initialState.datasets[dataId];
+
+ const nextState = reducer(
+ initialState,
+ VisStateActions.applyCPUFilter(dataId)
+ );
+
+ const expectedDataset = {
+ ...previousDataset,
+ filteredIdxCPU: previousDataset.allIndexes,
+ filterRecordCPU: {
+ dynamicDomain: [],
+ fixedDomain: [],
+ cpu: [],
+ gpu: []
+ }
+ };
+
+ cmpDataset(t, expectedDataset, nextState.datasets[dataId]);
+ t.end();
+});
+
+test('#visStateReducer -> APPLY_CPU_FILTER. has gpu filter', t => {
+ const initialState = CloneDeep(StateWFilters.visState);
+ // dataset has gpu filter
+ const dataId = testCsvDataId;
+ const previousDataset = initialState.datasets[dataId];
+ const gpuFilter = initialState.filters[0];
+
+ const nextState = reducer(
+ initialState,
+ VisStateActions.applyCPUFilter(dataId)
+ );
+
+ const expectedDataset = {
+ ...previousDataset,
+ filteredIdxCPU: [5, 6, 9, 10, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23],
+ filterRecordCPU: {
+ dynamicDomain: [],
+ fixedDomain: [gpuFilter],
+ cpu: [gpuFilter],
+ gpu: []
+ }
+ };
+
+ cmpDataset(t, expectedDataset, nextState.datasets[dataId]);
+
+ // calling it again
+ const nextState2 = reducer(
+ nextState,
+ VisStateActions.applyCPUFilter(dataId)
+ );
+
+ t.equal(
+ nextState.datasets[dataId].filteredIdxCPU,
+ nextState2.datasets[dataId].filteredIdxCPU,
+ 'should directly copy filter result when filter hasnot changed'
+ );
+ t.end();
+});
+
+test('#visStateReducer -> APPLY_CPU_FILTER. has cpu filter', t => {
+ const initialState = CloneDeep(StateWFilters.visState);
+ // dataset has gpu filter
+ const dataId = testGeoJsonDataId;
+ const previousDataset2 = initialState.datasets[dataId];
+ const ordinalFilter = initialState.filters[1];
+
+ const nextState = reducer(
+ initialState,
+ VisStateActions.applyCPUFilter(dataId)
+ );
+
+ const expectedDataset = {
+ ...previousDataset2,
+ filteredIdxCPU: [0],
+ filterRecordCPU: {
+ dynamicDomain: [],
+ fixedDomain: [ordinalFilter],
+ cpu: [ordinalFilter],
+ gpu: []
+ }
+ };
+
+ cmpDataset(t, expectedDataset, nextState.datasets[dataId]);
+
+ const nextState2 = reducer(
+ nextState,
+ VisStateActions.applyCPUFilter(dataId)
+ );
+
+ t.equal(
+ nextState.datasets[dataId].filteredIdxCPU,
+ nextState2.datasets[dataId].filteredIdxCPU,
+ 'should directly copy filter result when filter hasnot changed'
);
t.end();
@@ -4229,6 +4348,49 @@ test('#uiStateReducer -> SET_FEATURES/SET_SELECTED_FEATURE/DELETE_FEATURE', t =>
EDITOR_MODES.EDIT,
'Editor mode should be set to edit_vertex'
);
+ t.end();
+});
+
+test('#visStateReducer -> APPLY_CPU_FILTER. has multi datsets', t => {
+ const initialState = CloneDeep(StateWFilters.visState);
+ const previousDataset1 = initialState.datasets[testCsvDataId];
+ const previousDataset2 = initialState.datasets[testGeoJsonDataId];
+ const gpuFilter = initialState.filters[0];
+ const ordinalFilter = initialState.filters[1];
+
+ const nextState = reducer(
+ initialState,
+ VisStateActions.applyCPUFilter([testCsvDataId, testGeoJsonDataId])
+ );
+
+ const expectedDataset1 = {
+ ...previousDataset1,
+ filteredIdxCPU: [5, 6, 9, 10, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23],
+ filterRecordCPU: {
+ dynamicDomain: [],
+ fixedDomain: [gpuFilter],
+ cpu: [gpuFilter],
+ gpu: []
+ }
+ };
+
+ const expectedDataset2 = {
+ ...previousDataset2,
+ filteredIdxCPU: [0],
+ filterRecordCPU: {
+ dynamicDomain: [],
+ fixedDomain: [ordinalFilter],
+ cpu: [ordinalFilter],
+ gpu: []
+ }
+ };
+
+ const expectedDatasets = {
+ [testCsvDataId]: expectedDataset1,
+ [testGeoJsonDataId]: expectedDataset2
+ };
+
+ cmpDatasets(t, expectedDatasets, nextState.datasets);
t.end();
});
diff --git a/test/node/schemas/schema-conversion-test.js b/test/node/schemas/schema-conversion-test.js
index 0724bd02d..54f2a5f32 100644
--- a/test/node/schemas/schema-conversion-test.js
+++ b/test/node/schemas/schema-conversion-test.js
@@ -22,7 +22,8 @@ import test from 'tape';
import SchemaManager from 'schemas';
import {cmpParsedAppConfigs} from 'test/helpers/comparison-utils';
-import {console as Console} from 'global/window';
+import {logStep} from '../../../scripts/log';
+
import {
savedConfigV0 as savedConfig0,
parsedConfigV0 as parsedConfig0
@@ -73,10 +74,10 @@ const TEST_CASES = [
test('#appSchema -> Convert Saved Configs', t => {
TEST_CASES.forEach(({name, cases}) => {
- Console.log(`---> test: ${name}`);
+ logStep(`---> test: ${name}`);
cases.forEach(cs => {
- Console.log(`------> test: ${cs.name}`);
+ logStep(`------> test: ${cs.name}`);
const parsed = SchemaManager.parseSavedConfig(cs.saved);
cmpParsedAppConfigs(t, cs.parsed, parsed, {name: cs.name});
diff --git a/test/node/utils/data-processor-test.js b/test/node/utils/data-processor-test.js
index 2be3fc252..0cb7a4ac9 100644
--- a/test/node/utils/data-processor-test.js
+++ b/test/node/utils/data-processor-test.js
@@ -29,7 +29,8 @@ import testData, {
testFields,
testAllData,
wktCsv,
- wktCsvFields
+ wktCsvFields,
+ wktCsvRows
} from 'test/fixtures/test-csv-data';
import {
geojsonData,
@@ -192,13 +193,13 @@ test('Processor -> processCsvData -> with nulls', t => {
});
test('Processor -> processCsv.wkt', t => {
- const {fields} = processCsvData(wktCsv);
+ const {fields, rows} = processCsvData(wktCsv);
- t.deepEqual(
- fields,
- wktCsvFields,
- 'should find geometry fields as type:geojson'
- );
+ t.deepEqual(fields, wktCsvFields, 'should find geometry fields as type:geojson');
+ rows.forEach((r, i) => {
+ t.deepEqual(r, wktCsvRows[i], `should process wkt rows[${i}] correctly`);
+ });
+ t.deepEqual(rows, wktCsvRows, 'should process wkt rows correctly');
t.end();
});
@@ -206,9 +207,15 @@ test('Processor -> processCsv.wkt', t => {
test('Processor => processGeojson', t => {
const {fields, rows} = processGeojson(geojsonData);
- t.deepEqual(fields, geojsonFields, 'should format geojson fields');
- t.deepEqual(rows, geojsonRows, 'should format geojson rows');
+ t.equal(fields.length, geojsonFields.length, 'should have same field length');
+ fields.forEach((f, i) => {
+ t.deepEqual(f, geojsonFields[i], 'should format geojson fields');
+ })
+ t.equal(rows.length, geojsonRows.length, 'should have same row length');
+ rows.forEach((r, i) => {
+ t.deepEqual(r, geojsonRows[i], 'should format correct geojson rows');
+ });
t.end();
});
diff --git a/test/node/utils/filter-utils-test.js b/test/node/utils/filter-utils-test.js
index c2fb74b96..ff3f086d1 100644
--- a/test/node/utils/filter-utils-test.js
+++ b/test/node/utils/filter-utils-test.js
@@ -23,21 +23,22 @@ import moment from 'moment';
import testData, {testFields} from 'test/fixtures/test-csv-data';
import {
- FILTER_TYPES,
adjustValueToFilterDomain,
getFilterFunction,
getFieldDomain,
+ getHistogram,
getTimestampFieldDomain,
getDefaultFilter,
- getDatasetIndexForFilter,
- getDatasetFieldIndexForFilter,
validatePolygonFilter,
- filterData,
generatePolygonFilter,
isValidFilterValue,
- isInPolygon
+ isInPolygon,
+ diffFilters
} from 'utils/filter-utils';
+import {getDatasetFieldIndexForFilter} from 'utils/gpu-filter-utils';
+
+import {FILTER_TYPES} from 'constants/default-settings';
import {processCsvData} from 'processors/data-processor';
import {mockPolygonFeature, mockPolygonData} from '../../fixtures/polygon';
@@ -364,132 +365,7 @@ test('filterUtils -> getTimestampFieldDomain', t => {
expect: {
domain: [0, 1],
step: 0.05,
- histogram: [
- {count: 0, x0: 0, x1: 0.05},
- {count: 0, x0: 0.05, x1: 0.1},
- {count: 0, x0: 0.1, x1: 0.15},
- {count: 0, x0: 0.15, x1: 0.2},
- {count: 0, x0: 0.2, x1: 0.25},
- {count: 0, x0: 0.25, x1: 0.3},
- {count: 0, x0: 0.3, x1: 0.35},
- {count: 0, x0: 0.35, x1: 0.4},
- {count: 0, x0: 0.4, x1: 0.45},
- {count: 0, x0: 0.45, x1: 0.5},
- {count: 0, x0: 0.5, x1: 0.55},
- {count: 0, x0: 0.55, x1: 0.6},
- {count: 0, x0: 0.6, x1: 0.65},
- {count: 0, x0: 0.65, x1: 0.7},
- {count: 0, x0: 0.7, x1: 0.75},
- {count: 0, x0: 0.75, x1: 0.8},
- {count: 0, x0: 0.8, x1: 0.85},
- {count: 0, x0: 0.85, x1: 0.9},
- {count: 0, x0: 0.9, x1: 0.95},
- {count: 0, x0: 0.95, x1: 1},
- {count: 0, x0: 1, x1: 1}
- ],
- enlargedHistogram: [
- {count: 0, x0: 0, x1: 0.01},
- {count: 0, x0: 0.01, x1: 0.02},
- {count: 0, x0: 0.02, x1: 0.03},
- {count: 0, x0: 0.03, x1: 0.04},
- {count: 0, x0: 0.04, x1: 0.05},
- {count: 0, x0: 0.05, x1: 0.06},
- {count: 0, x0: 0.06, x1: 0.07},
- {count: 0, x0: 0.07, x1: 0.08},
- {count: 0, x0: 0.08, x1: 0.09},
- {count: 0, x0: 0.09, x1: 0.1},
- {count: 0, x0: 0.1, x1: 0.11},
- {count: 0, x0: 0.11, x1: 0.12},
- {count: 0, x0: 0.12, x1: 0.13},
- {count: 0, x0: 0.13, x1: 0.14},
- {count: 0, x0: 0.14, x1: 0.15},
- {count: 0, x0: 0.15, x1: 0.16},
- {count: 0, x0: 0.16, x1: 0.17},
- {count: 0, x0: 0.17, x1: 0.18},
- {count: 0, x0: 0.18, x1: 0.19},
- {count: 0, x0: 0.19, x1: 0.2},
- {count: 0, x0: 0.2, x1: 0.21},
- {count: 0, x0: 0.21, x1: 0.22},
- {count: 0, x0: 0.22, x1: 0.23},
- {count: 0, x0: 0.23, x1: 0.24},
- {count: 0, x0: 0.24, x1: 0.25},
- {count: 0, x0: 0.25, x1: 0.26},
- {count: 0, x0: 0.26, x1: 0.27},
- {count: 0, x0: 0.27, x1: 0.28},
- {count: 0, x0: 0.28, x1: 0.29},
- {count: 0, x0: 0.29, x1: 0.3},
- {count: 0, x0: 0.3, x1: 0.31},
- {count: 0, x0: 0.31, x1: 0.32},
- {count: 0, x0: 0.32, x1: 0.33},
- {count: 0, x0: 0.33, x1: 0.34},
- {count: 0, x0: 0.34, x1: 0.35},
- {count: 0, x0: 0.35, x1: 0.36},
- {count: 0, x0: 0.36, x1: 0.37},
- {count: 0, x0: 0.37, x1: 0.38},
- {count: 0, x0: 0.38, x1: 0.39},
- {count: 0, x0: 0.39, x1: 0.4},
- {count: 0, x0: 0.4, x1: 0.41},
- {count: 0, x0: 0.41, x1: 0.42},
- {count: 0, x0: 0.42, x1: 0.43},
- {count: 0, x0: 0.43, x1: 0.44},
- {count: 0, x0: 0.44, x1: 0.45},
- {count: 0, x0: 0.45, x1: 0.46},
- {count: 0, x0: 0.46, x1: 0.47},
- {count: 0, x0: 0.47, x1: 0.48},
- {count: 0, x0: 0.48, x1: 0.49},
- {count: 0, x0: 0.49, x1: 0.5},
- {count: 0, x0: 0.5, x1: 0.51},
- {count: 0, x0: 0.51, x1: 0.52},
- {count: 0, x0: 0.52, x1: 0.53},
- {count: 0, x0: 0.53, x1: 0.54},
- {count: 0, x0: 0.54, x1: 0.55},
- {count: 0, x0: 0.55, x1: 0.56},
- {count: 0, x0: 0.56, x1: 0.57},
- {count: 0, x0: 0.57, x1: 0.58},
- {count: 0, x0: 0.58, x1: 0.59},
- {count: 0, x0: 0.59, x1: 0.6},
- {count: 0, x0: 0.6, x1: 0.61},
- {count: 0, x0: 0.61, x1: 0.62},
- {count: 0, x0: 0.62, x1: 0.63},
- {count: 0, x0: 0.63, x1: 0.64},
- {count: 0, x0: 0.64, x1: 0.65},
- {count: 0, x0: 0.65, x1: 0.66},
- {count: 0, x0: 0.66, x1: 0.67},
- {count: 0, x0: 0.67, x1: 0.68},
- {count: 0, x0: 0.68, x1: 0.69},
- {count: 0, x0: 0.69, x1: 0.7},
- {count: 0, x0: 0.7, x1: 0.71},
- {count: 0, x0: 0.71, x1: 0.72},
- {count: 0, x0: 0.72, x1: 0.73},
- {count: 0, x0: 0.73, x1: 0.74},
- {count: 0, x0: 0.74, x1: 0.75},
- {count: 0, x0: 0.75, x1: 0.76},
- {count: 0, x0: 0.76, x1: 0.77},
- {count: 0, x0: 0.77, x1: 0.78},
- {count: 0, x0: 0.78, x1: 0.79},
- {count: 0, x0: 0.79, x1: 0.8},
- {count: 0, x0: 0.8, x1: 0.81},
- {count: 0, x0: 0.81, x1: 0.82},
- {count: 0, x0: 0.82, x1: 0.83},
- {count: 0, x0: 0.83, x1: 0.84},
- {count: 0, x0: 0.84, x1: 0.85},
- {count: 0, x0: 0.85, x1: 0.86},
- {count: 0, x0: 0.86, x1: 0.87},
- {count: 0, x0: 0.87, x1: 0.88},
- {count: 0, x0: 0.88, x1: 0.89},
- {count: 0, x0: 0.89, x1: 0.9},
- {count: 0, x0: 0.9, x1: 0.91},
- {count: 0, x0: 0.91, x1: 0.92},
- {count: 0, x0: 0.92, x1: 0.93},
- {count: 0, x0: 0.93, x1: 0.94},
- {count: 0, x0: 0.94, x1: 0.95},
- {count: 0, x0: 0.95, x1: 0.96},
- {count: 0, x0: 0.96, x1: 0.97},
- {count: 0, x0: 0.97, x1: 0.98},
- {count: 0, x0: 0.98, x1: 0.99},
- {count: 0, x0: 0.99, x1: 1},
- {count: 0, x0: 1, x1: 1}
- ],
+ ...getHistogram([0, 1], []),
mappedValue: []
}
},
@@ -512,142 +388,10 @@ test('filterUtils -> getTimestampFieldDomain', t => {
expect: {
domain: [1475315139001, 1475315139003],
mappedValue: [1475315139001, 1475315139002, 1475315139003],
- histogram: [
- {count: 1, x0: 1475315139000, x1: 1475315139200},
- {count: 0, x0: 1475315139200, x1: 1475315139400},
- {count: 0, x0: 1475315139400, x1: 1475315139600},
- {count: 0, x0: 1475315139600, x1: 1475315139800},
- {count: 0, x0: 1475315139800, x1: 1475315140000},
- {count: 0, x0: 1475315140000, x1: 1475315140200},
- {count: 0, x0: 1475315140200, x1: 1475315140400},
- {count: 0, x0: 1475315140400, x1: 1475315140600},
- {count: 0, x0: 1475315140600, x1: 1475315140800},
- {count: 0, x0: 1475315140800, x1: 1475315141000},
- {count: 0, x0: 1475315141000, x1: 1475315141200},
- {count: 0, x0: 1475315141200, x1: 1475315141400},
- {count: 0, x0: 1475315141400, x1: 1475315141600},
- {count: 0, x0: 1475315141600, x1: 1475315141800},
- {count: 0, x0: 1475315141800, x1: 1475315142000},
- {count: 0, x0: 1475315142000, x1: 1475315142200},
- {count: 0, x0: 1475315142200, x1: 1475315142400},
- {count: 0, x0: 1475315142400, x1: 1475315142600},
- {count: 0, x0: 1475315142600, x1: 1475315142800},
- {count: 0, x0: 1475315142800, x1: 1475315143000},
- {count: 0, x0: 1475315143000, x1: 1475315143200},
- {count: 0, x0: 1475315143200, x1: 1475315143400},
- {count: 0, x0: 1475315143400, x1: 1475315143600},
- {count: 0, x0: 1475315143600, x1: 1475315143800},
- {count: 0, x0: 1475315143800, x1: 1475315144000},
- {count: 0, x0: 1475315144000, x1: 1475315144200},
- {count: 0, x0: 1475315144200, x1: 1475315144400},
- {count: 0, x0: 1475315144400, x1: 1475315144600},
- {count: 0, x0: 1475315144600, x1: 1475315144800},
- {count: 0, x0: 1475315144800, x1: 1475315145000},
- {count: 1, x0: 1475315145000, x1: 1475315145000}
- ],
- enlargedHistogram: [
- {count: 1, x0: 1475315139001, x1: 1475315139001.02},
- {count: 0, x0: 1475315139001.02, x1: 1475315139001.04},
- {count: 0, x0: 1475315139001.04, x1: 1475315139001.06},
- {count: 0, x0: 1475315139001.06, x1: 1475315139001.08},
- {count: 0, x0: 1475315139001.08, x1: 1475315139001.1},
- {count: 0, x0: 1475315139001.1, x1: 1475315139001.12},
- {count: 0, x0: 1475315139001.12, x1: 1475315139001.14},
- {count: 0, x0: 1475315139001.14, x1: 1475315139001.16},
- {count: 0, x0: 1475315139001.16, x1: 1475315139001.18},
- {count: 0, x0: 1475315139001.18, x1: 1475315139001.2},
- {count: 0, x0: 1475315139001.2, x1: 1475315139001.22},
- {count: 0, x0: 1475315139001.22, x1: 1475315139001.24},
- {count: 0, x0: 1475315139001.24, x1: 1475315139001.26},
- {count: 0, x0: 1475315139001.26, x1: 1475315139001.28},
- {count: 0, x0: 1475315139001.28, x1: 1475315139001.3},
- {count: 0, x0: 1475315139001.3, x1: 1475315139001.32},
- {count: 0, x0: 1475315139001.32, x1: 1475315139001.34},
- {count: 0, x0: 1475315139001.34, x1: 1475315139001.36},
- {count: 0, x0: 1475315139001.36, x1: 1475315139001.38},
- {count: 0, x0: 1475315139001.38, x1: 1475315139001.4},
- {count: 0, x0: 1475315139001.4, x1: 1475315139001.42},
- {count: 0, x0: 1475315139001.42, x1: 1475315139001.44},
- {count: 0, x0: 1475315139001.44, x1: 1475315139001.46},
- {count: 0, x0: 1475315139001.46, x1: 1475315139001.48},
- {count: 0, x0: 1475315139001.48, x1: 1475315139001.5},
- {count: 0, x0: 1475315139001.5, x1: 1475315139001.52},
- {count: 0, x0: 1475315139001.52, x1: 1475315139001.54},
- {count: 0, x0: 1475315139001.54, x1: 1475315139001.56},
- {count: 0, x0: 1475315139001.56, x1: 1475315139001.58},
- {count: 0, x0: 1475315139001.58, x1: 1475315139001.6},
- {count: 0, x0: 1475315139001.6, x1: 1475315139001.62},
- {count: 0, x0: 1475315139001.62, x1: 1475315139001.64},
- {count: 0, x0: 1475315139001.64, x1: 1475315139001.66},
- {count: 0, x0: 1475315139001.66, x1: 1475315139001.68},
- {count: 0, x0: 1475315139001.68, x1: 1475315139001.7},
- {count: 0, x0: 1475315139001.7, x1: 1475315139001.72},
- {count: 0, x0: 1475315139001.72, x1: 1475315139001.74},
- {count: 0, x0: 1475315139001.74, x1: 1475315139001.76},
- {count: 0, x0: 1475315139001.76, x1: 1475315139001.78},
- {count: 0, x0: 1475315139001.78, x1: 1475315139001.8},
- {count: 0, x0: 1475315139001.8, x1: 1475315139001.82},
- {count: 0, x0: 1475315139001.82, x1: 1475315139001.84},
- {count: 0, x0: 1475315139001.84, x1: 1475315139001.86},
- {count: 0, x0: 1475315139001.86, x1: 1475315139001.88},
- {count: 0, x0: 1475315139001.88, x1: 1475315139001.9},
- {count: 0, x0: 1475315139001.9, x1: 1475315139001.92},
- {count: 0, x0: 1475315139001.92, x1: 1475315139001.94},
- {count: 0, x0: 1475315139001.94, x1: 1475315139001.96},
- {count: 0, x0: 1475315139001.96, x1: 1475315139001.98},
- {count: 0, x0: 1475315139001.98, x1: 1475315139002},
- {count: 1, x0: 1475315139002, x1: 1475315139002.02},
- {count: 0, x0: 1475315139002.02, x1: 1475315139002.04},
- {count: 0, x0: 1475315139002.04, x1: 1475315139002.06},
- {count: 0, x0: 1475315139002.06, x1: 1475315139002.08},
- {count: 0, x0: 1475315139002.08, x1: 1475315139002.1},
- {count: 0, x0: 1475315139002.1, x1: 1475315139002.12},
- {count: 0, x0: 1475315139002.12, x1: 1475315139002.14},
- {count: 0, x0: 1475315139002.14, x1: 1475315139002.16},
- {count: 0, x0: 1475315139002.16, x1: 1475315139002.18},
- {count: 0, x0: 1475315139002.18, x1: 1475315139002.2},
- {count: 0, x0: 1475315139002.2, x1: 1475315139002.22},
- {count: 0, x0: 1475315139002.22, x1: 1475315139002.24},
- {count: 0, x0: 1475315139002.24, x1: 1475315139002.26},
- {count: 0, x0: 1475315139002.26, x1: 1475315139002.28},
- {count: 0, x0: 1475315139002.28, x1: 1475315139002.3},
- {count: 0, x0: 1475315139002.3, x1: 1475315139002.32},
- {count: 0, x0: 1475315139002.32, x1: 1475315139002.34},
- {count: 0, x0: 1475315139002.34, x1: 1475315139002.36},
- {count: 0, x0: 1475315139002.36, x1: 1475315139002.38},
- {count: 0, x0: 1475315139002.38, x1: 1475315139002.4},
- {count: 0, x0: 1475315139002.4, x1: 1475315139002.42},
- {count: 0, x0: 1475315139002.42, x1: 1475315139002.44},
- {count: 0, x0: 1475315139002.44, x1: 1475315139002.46},
- {count: 0, x0: 1475315139002.46, x1: 1475315139002.48},
- {count: 0, x0: 1475315139002.48, x1: 1475315139002.5},
- {count: 0, x0: 1475315139002.5, x1: 1475315139002.52},
- {count: 0, x0: 1475315139002.52, x1: 1475315139002.54},
- {count: 0, x0: 1475315139002.54, x1: 1475315139002.56},
- {count: 0, x0: 1475315139002.56, x1: 1475315139002.58},
- {count: 0, x0: 1475315139002.58, x1: 1475315139002.6},
- {count: 0, x0: 1475315139002.6, x1: 1475315139002.62},
- {count: 0, x0: 1475315139002.62, x1: 1475315139002.64},
- {count: 0, x0: 1475315139002.64, x1: 1475315139002.66},
- {count: 0, x0: 1475315139002.66, x1: 1475315139002.68},
- {count: 0, x0: 1475315139002.68, x1: 1475315139002.7},
- {count: 0, x0: 1475315139002.7, x1: 1475315139002.72},
- {count: 0, x0: 1475315139002.72, x1: 1475315139002.74},
- {count: 0, x0: 1475315139002.74, x1: 1475315139002.76},
- {count: 0, x0: 1475315139002.76, x1: 1475315139002.78},
- {count: 0, x0: 1475315139002.78, x1: 1475315139002.8},
- {count: 0, x0: 1475315139002.8, x1: 1475315139002.82},
- {count: 0, x0: 1475315139002.82, x1: 1475315139002.84},
- {count: 0, x0: 1475315139002.84, x1: 1475315139002.86},
- {count: 0, x0: 1475315139002.86, x1: 1475315139002.88},
- {count: 0, x0: 1475315139002.88, x1: 1475315139002.9},
- {count: 0, x0: 1475315139002.9, x1: 1475315139002.92},
- {count: 0, x0: 1475315139002.92, x1: 1475315139002.94},
- {count: 0, x0: 1475315139002.94, x1: 1475315139002.96},
- {count: 0, x0: 1475315139002.96, x1: 1475315139002.98},
- {count: 0, x0: 1475315139002.98, x1: 1475315139003},
- {count: 1, x0: 1475315139003, x1: 1475315139003}
- ],
+ ...getHistogram(
+ [1475315139001, 1475315139003],
+ [1475315139001, 1475315139002, 1475315139003]
+ ),
step: 0.1
}
},
@@ -703,13 +447,9 @@ test('filterUtils -> getTimestampFieldDomain', t => {
);
Object.keys(timeData[key].expect).forEach(k => {
-
// histogram is created by d3, only need to test they exist
if (k === 'histogram' || k === 'enlargedHistogram') {
- t.ok(
- tsFieldDomain[k].length,
- `should create ${k}`
- );
+ t.ok(tsFieldDomain[k].length, `should create ${k}`);
} else {
t.deepEqual(
tsFieldDomain[k],
@@ -723,36 +463,10 @@ test('filterUtils -> getTimestampFieldDomain', t => {
t.end();
});
-test('filterUtils -> getDatasetIndexForFilter', t => {
+test('filterUtils -> getDatasetFieldIndexForFilter', t => {
const dataId = 'test-this-id';
- let fieldIndex = getDatasetIndexForFilter({id: dataId}, {dataId: [dataId]});
- t.equal(
- fieldIndex,
- 0,
- 'FieldIndex should be 0'
- );
-
- fieldIndex = getDatasetIndexForFilter({id: dataId}, {dataId: ['different-id', dataId]});
- t.equal(
- fieldIndex,
- 1,
- 'FieldIndex should be 1'
- );
- fieldIndex = getDatasetIndexForFilter({id: dataId}, {dataId: ['different-id']});
- t.equal(
- fieldIndex,
- -1,
- 'FieldIndex should be -1'
- );
-
- t.end();
-});
-
-test('filterUtils -> getDatasetIndexForFilter', t => {
- const dataId = 'test-this-id';
-
- let fieldIndex = getDatasetFieldIndexForFilter({id: dataId}, {
+ let fieldIndex = getDatasetFieldIndexForFilter(dataId, {
dataId: [dataId],
fieldIdx: [3]
});
@@ -763,7 +477,7 @@ test('filterUtils -> getDatasetIndexForFilter', t => {
'FieldIndex should be 3'
);
- fieldIndex = getDatasetFieldIndexForFilter({id: dataId}, {
+ fieldIndex = getDatasetFieldIndexForFilter(dataId, {
dataId: ['different-id', dataId],
fieldIdx: [3, 5]
});
@@ -774,7 +488,7 @@ test('filterUtils -> getDatasetIndexForFilter', t => {
'FieldIndex should be 5'
);
- fieldIndex = getDatasetFieldIndexForFilter({id: dataId}, {dataId: ['different-id']});
+ fieldIndex = getDatasetFieldIndexForFilter(dataId, {dataId: ['different-id']});
t.equal(
fieldIndex,
-1,
@@ -988,7 +702,7 @@ test('filterUtils -> validatePolygonFilter', t => {
t.equal(
validatePolygonFilter(dataset, {}, layers).filter,
null,
- 'Should non validate empty filter'
+ 'Should not validate empty filter'
);
t.deepEqual(
@@ -997,7 +711,7 @@ test('filterUtils -> validatePolygonFilter', t => {
dataId: ['non_valid']
}, layers).filter,
null,
- 'Should non validate filter with non existing dataId'
+ 'Should not validate filter with non existing dataId'
);
t.deepEqual(
@@ -1008,23 +722,7 @@ test('filterUtils -> validatePolygonFilter', t => {
}
}, layers).filter,
null,
- 'Should not validate filter given type and value'
- );
-
- t.end();
-});
-
-test('filterUtils -> filterData', t => {
- const dataset = {
- id: 'dataset-1',
- allData: [],
- data: [],
- fields: []
- };
-
- t.deepEqual(
- filterData(dataset, []),
- {data: [], filteredIndex: [], filteredIndexForDomain: []}
+ 'Should not validate filter given type and value without corresponding layer'
);
t.end();
@@ -1072,3 +770,79 @@ test('filterUtils -> Polygon getFilterFunction ', t => {
t.end();
});
/* eslint-enable max-statements */
+
+test('filterUtils -> diffFilters', t => {
+ const testCases = [
+ {
+ filterRecord: {
+ dynamicDomain: [],
+ fixedDomain: [],
+ cpu: [],
+ gpu: []
+ },
+ oldFilterRecord: undefined,
+ result: {
+ dynamicDomain: null,
+ fixedDomain: null,
+ cpu: null,
+ gpu: null
+ }
+ },
+ {
+ filterRecord: {
+ dynamicDomain: [],
+ fixedDomain: [],
+ cpu: [],
+ gpu: []
+ },
+ oldFilterRecord: {
+ dynamicDomain: [],
+ fixedDomain: [],
+ cpu: [],
+ gpu: []
+ },
+ result: {
+ dynamicDomain: null,
+ fixedDomain: null,
+ cpu: null,
+ gpu: null
+ }
+ },
+ {
+ filterRecord: {
+ dynamicDomain: [{id: 'aa', name: 'hello', value: 'bb'}],
+ fixedDomain: [{id: 'bb', name: 'ab', value: 'ab'}],
+ cpu: [
+ {id: 'dd', name: 'hey', value: 'ee'},
+ {id: 'ee', name: 'ee', value: 'ff'}
+ ],
+ gpu: []
+ },
+ oldFilterRecord: {
+ dynamicDomain: [{id: 'aa', name: 'hello', value: 'bb'}],
+ fixedDomain: [
+ {id: 'bb', name: 'cd', value: 'ab'},
+ {id: 'cc', name: 'world', value: 'dd'}
+ ],
+ cpu: [{id: 'ee', name: 'ee', value: 'gg'}],
+ gpu: []
+ },
+ result: {
+ dynamicDomain: null,
+ fixedDomain: {bb: 'name_changed', cc: 'deleted'},
+ cpu: {dd: 'added', ee: 'value_changed'},
+ gpu: null
+ }
+ }
+ ];
+
+ testCases.forEach(({filterRecord, oldFilterRecord, result}) => {
+ t.deepEqual(
+ diffFilters(filterRecord, oldFilterRecord),
+ result,
+ 'diff filters should be correct'
+ );
+ });
+
+ t.end();
+});
diff --git a/test/node/utils/gpu-filter-utils-test.js b/test/node/utils/gpu-filter-utils-test.js
new file mode 100644
index 000000000..5224f8af2
--- /dev/null
+++ b/test/node/utils/gpu-filter-utils-test.js
@@ -0,0 +1,234 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import test from 'tape';
+import {
+ resetFilterGpuMode,
+ assignGpuChannel,
+ assignGpuChannels,
+ getDatasetFieldIndexForFilter
+} from 'utils/gpu-filter-utils';
+
+test('gpuFilterUtils -> resetFilterGpuMode', t => {
+ const testFilters = [
+ {id: '1', dataId: ['smoothie'], gpu: true},
+ {id: '2', dataId: ['smoothie'], gpu: true},
+ {id: '3', dataId: ['smoothie'], gpu: false},
+ {id: '4', dataId: ['smoothie'], gpu: true},
+ {id: '5', dataId: ['smoothie'], gpu: true},
+ {id: '6', dataId: ['smoothie'], gpu: true},
+ {id: '7', dataId: ['milkshake'], gpu: true},
+ {id: '8', dataId: ['milkshake'], gpu: false}
+ ];
+
+ const expectedFilters = [
+ {id: '1', dataId: ['smoothie'], gpu: true},
+ {id: '2', dataId: ['smoothie'], gpu: true},
+ {id: '3', dataId: ['smoothie'], gpu: false},
+ {id: '4', dataId: ['smoothie'], gpu: true},
+ {id: '5', dataId: ['smoothie'], gpu: true},
+ {id: '6', dataId: ['smoothie'], gpu: false},
+ {id: '7', dataId: ['milkshake'], gpu: true},
+ {id: '8', dataId: ['milkshake'], gpu: false}
+ ];
+
+ const result = resetFilterGpuMode(testFilters);
+ t.deepEqual(result, expectedFilters, 'should reset gpu mode');
+
+ t.end();
+});
+
+test('gpuFilterUtils -> assignGpuChannel', t => {
+ const testCases = [
+ {
+ gpuFilter: {id: '3', dataId: ['a'], gpu: true},
+ filters: [
+ {id: '1', dataId: ['b'], gpu: true, gpuChannel: [0]},
+ {id: '2', dataId: ['a'], gpu: true, gpuChannel: [0]}
+ ],
+ result: {
+ id: '3',
+ dataId: ['a'],
+ gpu: true,
+ gpuChannel: [1]
+ }
+ },
+ {
+ gpuFilter: {id: '3', dataId: ['a'], gpu: true, gpuChannel: [1]},
+ filters: [
+ {id: '3', dataId: ['a'], gpu: true, gpuChannel: [1]},
+ {id: '1', dataId: ['b'], gpu: true, gpuChannel: [0]},
+ {id: '2', dataId: ['a'], gpu: true, gpuChannel: [0]}
+ ],
+ result: {
+ id: '3',
+ dataId: ['a'],
+ gpu: true,
+ gpuChannel: [1]
+ }
+ },
+ {
+ gpuFilter: {id: '3', dataId: ['a'], gpu: true},
+ filters: [
+ {id: '1', dataId: ['b'], gpu: true, gpuChannel: [0]},
+ {id: '2', dataId: ['a'], gpu: true, gpuChannel: [1]}
+ ],
+ result: {id: '3', dataId: ['a'], gpu: true, gpuChannel: [0]}
+ },
+ {
+ gpuFilter: {id: '5', dataId: ['a', 'b'], gpu: true},
+ filters: [
+ {id: '1', dataId: ['b'], gpu: true, gpuChannel: [0]},
+ {id: '2', dataId: ['a'], gpu: true, gpuChannel: [3]},
+ {id: '3', dataId: ['a'], gpu: true, gpuChannel: [0]},
+ {id: '4', dataId: ['a'], gpu: true, gpuChannel: [2]}
+ ],
+ result: {id: '5', dataId: ['a', 'b'], gpu: true, gpuChannel: [1, 1]}
+ },
+ {
+ gpuFilter: {id: '5', dataId: ['a', 'b'], gpu: true, gpuChannel: [1]},
+ filters: [
+ {id: '1', dataId: ['b'], gpu: true, gpuChannel: [0]},
+ {id: '2', dataId: ['a'], gpu: true, gpuChannel: [3]},
+ {id: '3', dataId: ['a', 'b'], gpu: true, gpuChannel: [0, 2]},
+ {id: '4', dataId: ['a'], gpu: true, gpuChannel: [2]}
+ ],
+ result: {id: '5', dataId: ['a', 'b'], gpu: true, gpuChannel: [1, 1]}
+ },
+ {
+ gpuFilter: {id: '6', dataId: ['a'], gpu: true},
+ filters: [
+ {id: '1', dataId: ['b'], gpu: true, gpuChannel: [0]},
+ {id: '2', dataId: ['a'], gpu: true, gpuChannel: [3]},
+ {id: '3', dataId: ['a'], gpu: true, gpuChannel: [2]},
+ {id: '4', dataId: ['a'], gpu: true, gpuChannel: [0]},
+ {id: '5', dataId: ['a'], gpu: true, gpuChannel: [1]}
+ ],
+ result: {id: '6', dataId: ['a'], gpu: false}
+ }
+ ];
+
+ testCases.forEach(tc => {
+ t.deepEqual(
+ assignGpuChannel(tc.gpuFilter, tc.filters),
+ tc.result,
+ 'should assign correct channel'
+ );
+ });
+
+ t.end();
+});
+
+test('gpuFilterUtils -> assignGpuChannels', t => {
+ const testCases = [
+ {
+ filters: [
+ {id: '1', dataId: ['a'], gpu: true, gpuChannel: [1]},
+ {id: '2', dataId: ['a'], gpu: true},
+ {id: '3', dataId: ['b'], gpu: true},
+ {id: '4', dataId: ['b'], gpu: false}
+ ],
+ result: [
+ {id: '1', dataId: ['a'], gpu: true, gpuChannel: [1]},
+ {id: '2', dataId: ['a'], gpu: true, gpuChannel: [0]},
+ {id: '3', dataId: ['b'], gpu: true, gpuChannel: [0]},
+ {id: '4', dataId: ['b'], gpu: false}
+ ]
+ },
+ {
+ filters: [
+ {id: '1', dataId: ['a'], gpu: true, gpuChannel: [1]},
+ {id: '2', dataId: ['b'], gpu: true, gpuChannel: [1]},
+ {id: '3', dataId: ['a'], gpu: true, gpuChannel: [2]},
+ {id: '4', dataId: ['b'], gpu: false},
+ {id: '5', dataId: ['a'], gpu: true},
+ {id: '6', dataId: ['b'], gpu: true},
+ {id: '7', dataId: ['b'], gpu: true, gpuChannel: [0]}
+ ],
+ result: [
+ {id: '1', dataId: ['a'], gpu: true, gpuChannel: [1]},
+ {id: '2', dataId: ['b'], gpu: true, gpuChannel: [1]},
+ {id: '3', dataId: ['a'], gpu: true, gpuChannel: [2]},
+ {id: '4', dataId: ['b'], gpu: false},
+ {id: '5', dataId: ['a'], gpu: true, gpuChannel: [0]},
+ {id: '6', dataId: ['b'], gpu: true, gpuChannel: [2]},
+ {id: '7', dataId: ['b'], gpu: true, gpuChannel: [0]}
+ ]
+ },
+ {
+ filters: [
+ {id: '1', dataId: ['a', 'b'], gpu: true, gpuChannel: [1, 0]},
+ {id: '2', dataId: ['a'], gpu: true, gpuChannel: [1]},
+ {id: '3', dataId: ['b', 'a'], gpu: true},
+ {id: '4', dataId: ['b'], gpu: true}
+ ],
+ result: [
+ {id: '1', dataId: ['a', 'b'], gpu: true, gpuChannel: [0, 0]},
+ {id: '2', dataId: ['a'], gpu: true, gpuChannel: [1]},
+ {id: '3', dataId: ['b', 'a'], gpu: true, gpuChannel: [1, 2]},
+ {id: '4', dataId: ['b'], gpu: true, gpuChannel: [2]}
+ ]
+ }
+ ];
+
+ testCases.forEach(tc => {
+ t.deepEqual(
+ assignGpuChannels(tc.filters),
+ tc.result,
+ 'should assign correct channel'
+ );
+ });
+ t.end();
+});
+
+test('gpuFilterUtils -> getDatasetFieldIndexForFilter', t => {
+ const dataId = 'test-this-id';
+
+ let fieldIndex = getDatasetFieldIndexForFilter(dataId, {
+ dataId: [dataId],
+ fieldIdx: [3]
+ });
+
+ t.equal(
+ fieldIndex,
+ 3,
+ 'FieldIndex should be 3'
+ );
+
+ fieldIndex = getDatasetFieldIndexForFilter(dataId, {
+ dataId: ['different-id', dataId],
+ fieldIdx: [3, 5]
+ });
+
+ t.equal(
+ fieldIndex,
+ 5,
+ 'FieldIndex should be 5'
+ );
+
+ fieldIndex = getDatasetFieldIndexForFilter(dataId, {dataId: ['different-id']});
+ t.equal(
+ fieldIndex,
+ -1,
+ 'FieldIndex should be -1'
+ );
+
+ t.end();
+});
diff --git a/test/node/utils/index.js b/test/node/utils/index.js
index c16adce44..2a4354813 100644
--- a/test/node/utils/index.js
+++ b/test/node/utils/index.js
@@ -21,6 +21,7 @@
import './data-utils-test';
import './data-processor-test';
import './filter-utils-test';
+import './gpu-filter-utils-test';
import './layer-utils-test';
import './data-scale-utils-test';
import './interaction-utils-test';
@@ -28,4 +29,4 @@ import './mapbox-gl-style-editor-test';
import './notifications-utils-test';
import './aggregate-utils-test';
import './color-util-test';
-import './utils-test';
+import './util-test';
diff --git a/test/node/utils/utils-test.js b/test/node/utils/util-test.js
similarity index 66%
rename from test/node/utils/utils-test.js
rename to test/node/utils/util-test.js
index f08637222..251a3314f 100644
--- a/test/node/utils/utils-test.js
+++ b/test/node/utils/util-test.js
@@ -19,9 +19,22 @@
// THE SOFTWARE.
import test from 'tape';
-import {toArray} from 'utils/utils';
+import {set, toArray} from 'utils/utils';
-test('utils -> toArray', t => {
+test('Utils -> set', t => {
+ const obj1 = {map: {map1: 'world'}};
+ const obj2 = set(['map', 'map1'], 'hello', obj1);
+
+ t.notLooseEqual(obj1, obj2, 'set should create a new object');
+ t.equal(set(['map'], 'hello', null), null, 'set null should return null');
+ t.equal(set(['map'], 'hello', undefined), undefined, 'set undefined should return undefined');
+ t.deepEqual(set(['map', 'map1'], 'hello', {map: {map1: 'world'}}), {map: {map1: 'hello'}}, 'set should set value');
+ t.deepEqual(set(['map'], 'hello', {}), {map: 'hello'}, 'set should create leave node');
+ t.deepEqual(set(['map', 1], 'hello', {map: ['hello', 'world']}), {map: ['hello', 'hello']}, 'set should work with array');
+ t.end();
+});
+
+test('Utils -> toArray', t => {
t.deepEqual(
toArray(),
[],
diff --git a/test/setup-browser-env.js b/test/setup-browser-env.js
index 287b6b8c2..b8bb12b83 100644
--- a/test/setup-browser-env.js
+++ b/test/setup-browser-env.js
@@ -34,6 +34,15 @@ const dom = new JSDOM('<!doctype html><html><body></body></html>', {
const {window} = dom;
mockCanvas(window);
+// // issue: https://github.com/chromaui/chromatic-cli/issues/14
+Object.defineProperty(window, 'fetch', {
+ value: () =>
+ new Promise((res, rej) => {
+ // we just let this never resolve
+ }),
+ writable: true,
+});
+
const nop = () => {};
function mockCanvas(globalWindow) {
@@ -74,6 +83,7 @@ function mockCanvas(globalWindow) {
global.window = window;
global.document = window.document;
global.HTMLElement = window.HTMLElement;
+global.fetch = window.fetch;
Object.keys(global.window).forEach(property => {
if (typeof global[property] === 'undefined') {
diff --git a/yarn.lock b/yarn.lock
index fb5e9972f..7260eea3d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3,9 +3,9 @@
"@babel/cli@^7.0.0":
- version "7.7.5"
- resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.7.5.tgz#25702cc65418efc06989af3727897b9f4c8690b6"
- integrity sha512-y2YrMGXM3NUyu1Myg0pxg+Lx6g8XhEyvLHYNRwTBV6fDek3H7Io6b7N/LXscLs4HWn4HxMdy7f2rM1rTMp2mFg==
+ version "7.7.7"
+ resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.7.7.tgz#56849acbf81d1a970dd3d1b3097c8ebf5da3f534"
+ integrity sha512-XQw5KyCZyu/M8/0rYiZyuwbgIQNzOrJzs9dDLX+MieSgBwTLvTj4QVbLmxJACAIvQIDT7PtyHN2sC48EOWTgaA==
dependencies:
commander "^4.0.1"
convert-source-map "^1.1.0"
@@ -26,14 +26,14 @@
"@babel/highlight" "^7.0.0"
"@babel/core@^7.0.0", "@babel/core@^7.1.2":
- version "7.7.5"
- resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.7.5.tgz#ae1323cd035b5160293307f50647e83f8ba62f7e"
- integrity sha512-M42+ScN4+1S9iB6f+TL7QBpoQETxbclx+KNoKJABghnKYE+fMzSGqst0BZJc8CpI625bwPwYgUyRvxZ+0mZzpw==
+ version "7.7.7"
+ resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.7.7.tgz#ee155d2e12300bcc0cff6a8ad46f2af5063803e9"
+ integrity sha512-jlSjuj/7z138NLZALxVgrx13AOtqip42ATZP7+kYl53GvDV6+4dCek1mVUo8z8c8Xnw/mx2q3d9HWh3griuesQ==
dependencies:
"@babel/code-frame" "^7.5.5"
- "@babel/generator" "^7.7.4"
+ "@babel/generator" "^7.7.7"
"@babel/helpers" "^7.7.4"
- "@babel/parser" "^7.7.5"
+ "@babel/parser" "^7.7.7"
"@babel/template" "^7.7.4"
"@babel/traverse" "^7.7.4"
"@babel/types" "^7.7.4"
@@ -45,10 +45,10 @@
semver "^5.4.1"
source-map "^0.5.0"
-"@babel/generator@^7.1.3", "@babel/generator@^7.4.0", "@babel/generator@^7.7.4":
- version "7.7.4"
- resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.4.tgz#db651e2840ca9aa66f327dcec1dc5f5fa9611369"
- integrity sha512-m5qo2WgdOJeyYngKImbkyQrnUN1mPceaG5BV+G0E3gWsa4l/jCSryWJdM2x8OuGAOyh+3d5pVYfZWCiNFtynxg==
+"@babel/generator@^7.1.3", "@babel/generator@^7.4.0", "@babel/generator@^7.7.4", "@babel/generator@^7.7.7":
+ version "7.7.7"
+ resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.7.tgz#859ac733c44c74148e1a72980a64ec84b85f4f45"
+ integrity sha512-/AOIBpHh/JU1l0ZFS4kiRCBnLi6OTHzh0RPk3h9isBxkkqELtQNFi1Vr/tiG9p1yfoUdKVwISuXWQR+hwwM4VQ==
dependencies:
"@babel/types" "^7.7.4"
jsesc "^2.5.1"
@@ -257,16 +257,17 @@
js-tokens "^4.0.0"
"@babel/node@^7.2.2":
- version "7.7.4"
- resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.7.4.tgz#de1cc9c67b335a19e4f71208554779bc63719f5a"
- integrity sha512-Vhhq2kK+BpsR2tW35zP8yOJZ7ONMVBwCD9fmNeRTU3MNNpcJDrrtVP5NK8ZX4nQAs0GSq6ky8noyn6MCVgL08g==
+ version "7.7.7"
+ resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.7.7.tgz#10c488ca36da07670be0131679c4e22f9d7795d4"
+ integrity sha512-QWWbQ6AyDffz6mA2mF0jixb/3IyRlqWgz5JNa2F6kSYe4vhPEytwuGmanx0NQJxBufDjffm/jYPuIfKfAyVzuA==
dependencies:
- "@babel/register" "^7.7.4"
+ "@babel/register" "^7.7.7"
commander "^2.8.1"
core-js "^3.2.1"
lodash "^4.17.13"
node-environment-flags "^1.0.5"
regenerator-runtime "^0.13.3"
+ resolve "^1.13.1"
v8flags "^3.1.1"
@@ -274,10 +275,10 @@
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.1.3.tgz#2c92469bac2b7fbff810b67fca07bd138b48af77"
integrity sha512-gqmspPZOMW3MIRb9HlrnbZHXI1/KHTOroBwN1NcLL6pWxzqzEKGvRTq0W/PxS45OtQGbaFikSQpkS5zbnsQm2w==
-"@babel/parser@^7.0.0", "@babel/parser@^7.3.3", "@babel/parser@^7.4.3", "@babel/parser@^7.7.4", "@babel/parser@^7.7.5":
- version "7.7.5"
- resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.5.tgz#cbf45321619ac12d83363fcf9c94bb67fa646d71"
- integrity sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig==
+"@babel/parser@^7.0.0", "@babel/parser@^7.3.3", "@babel/parser@^7.4.3", "@babel/parser@^7.7.4", "@babel/parser@^7.7.7":
+ version "7.7.7"
+ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.7.tgz#1b886595419cf92d811316d5b715a53ff38b4937"
+ integrity sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw==
"@babel/plugin-proposal-async-generator-functions@^7.7.4":
version "7.7.4"
@@ -386,10 +387,10 @@
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-syntax-numeric-separator" "^7.7.4"
-"@babel/plugin-proposal-object-rest-spread@^7.7.4":
- version "7.7.4"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.7.4.tgz#cc57849894a5c774214178c8ab64f6334ec8af71"
- integrity sha512-rnpnZR3/iWKmiQyJ3LKJpSwLDcX/nSXhdLk4Aq/tXOApIvyu7qoabrige0ylsAJffaUC51WiBu209Q0U+86OWQ==
+"@babel/plugin-proposal-object-rest-spread@^7.7.7":
+ version "7.7.7"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.7.7.tgz#9f27075004ab99be08c5c1bd653a2985813cb370"
+ integrity sha512-3qp9I8lelgzNedI3hrhkvhaEYree6+WHnyA/q4Dza9z7iEIs1eyhWyJnetk3jJ69RT0AT4G0UhEGwyGFJ7GUuQ==
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-syntax-object-rest-spread" "^7.7.4"
@@ -411,12 +412,12 @@
"@babel/plugin-syntax-optional-chaining" "^7.7.4"
"@babel/plugin-proposal-pipeline-operator@^7.0.0":
- version "7.7.4"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-pipeline-operator/-/plugin-proposal-pipeline-operator-7.7.4.tgz#d61724b4f207b0a7c08e9182e8e36fda2d93e384"
- integrity sha512-+ZczeVHN5Ny2R5kHnvxnK0U+tFiarWzX+aMKsw3uugdn4WIrUOsJ7eRX2dIRwBKUT/c8QgzT3rQGsIDlPkchBQ==
+ version "7.7.7"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-pipeline-operator/-/plugin-proposal-pipeline-operator-7.7.7.tgz#d85c3c90924db3c4876cdf5a6290f1977d66cd5a"
+ integrity sha512-QJA76bpU+MF8+fygZN7qaKDmMg6KwMzdMfp01i0XT2R7qt4g2xRVSYF01XyX8p4wYIN6ch+mZsi1ZOYa9lI/Dg==
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
- "@babel/plugin-syntax-pipeline-operator" "^7.7.4"
+ "@babel/plugin-syntax-pipeline-operator" "^7.7.7"
"@babel/plugin-proposal-throw-expressions@^7.0.0":
version "7.7.4"
@@ -426,10 +427,10 @@
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-syntax-throw-expressions" "^7.7.4"
-"@babel/plugin-proposal-unicode-property-regex@^7.7.4":
- version "7.7.4"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.4.tgz#7c239ccaf09470dbe1d453d50057460e84517ebb"
- integrity sha512-cHgqHgYvffluZk85dJ02vloErm3Y6xtH+2noOBOJ2kXOJH3aVCDnj5eR/lVNlTnYu4hndAPJD3rTFjW3qee0PA==
+"@babel/plugin-proposal-unicode-property-regex@^7.7.7":
+ version "7.7.7"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.7.tgz#433fa9dac64f953c12578b29633f456b68831c4e"
+ integrity sha512-80PbkKyORBUVm1fbTLrHpYdJxMThzM1UqFGh0ALEhO9TYbG86Ah9zQYAB/84axz2vcxefDLdZwWwZNlYARlu9w==
dependencies:
"@babel/helper-create-regexp-features-plugin" "^7.7.4"
"@babel/helper-plugin-utils" "^7.0.0"
@@ -560,10 +561,10 @@
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
-"@babel/plugin-syntax-pipeline-operator@^7.7.4":
- version "7.7.4"
- resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-pipeline-operator/-/plugin-syntax-pipeline-operator-7.7.4.tgz#8bfe2648196829f1c442ae7087f2ad92083415f8"
- integrity sha512-llA4gBPpZWeEQLll8q0FYTLQ/PyITMxqlms7c6DnSVCLtzyBr+YsPMDkwWyEzVADszZs+v0HTL3Oftw++Admlg==
+"@babel/plugin-syntax-pipeline-operator@^7.7.7":
+ version "7.7.7"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-pipeline-operator/-/plugin-syntax-pipeline-operator-7.7.7.tgz#90e9bb01d9157db8019a3e2021ee6eefe52e96d1"
+ integrity sha512-yZ5XNFphdeAelOqH5A/f3EuUTusWkNev3h6XuxYx7CY0pALlncM6tsvBBbYvFNoR4rDuYVX/+Ut44fTW+/WZQg==
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
@@ -640,10 +641,10 @@
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
-"@babel/plugin-transform-dotall-regex@^7.7.4":
- version "7.7.4"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.7.4.tgz#f7ccda61118c5b7a2599a72d5e3210884a021e96"
- integrity sha512-mk0cH1zyMa/XHeb6LOTXTbG7uIJ8Rrjlzu91pUx/KS3JpcgaTDwMS8kM+ar8SLOvlL2Lofi4CGBAjCo3a2x+lw==
+"@babel/plugin-transform-dotall-regex@^7.7.7":
+ version "7.7.7"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.7.7.tgz#3e9713f1b69f339e87fa796b097d73ded16b937b"
+ integrity sha512-b4in+YlTeE/QmTgrllnb3bHA0HntYvjz8O3Mcbx75UBPJA2xhb5A8nle498VhxSXJHQefjtQxpnLPehDJ4TRlg==
dependencies:
"@babel/helper-create-regexp-features-plugin" "^7.7.4"
"@babel/helper-plugin-utils" "^7.0.0"
@@ -758,10 +759,10 @@
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/helper-replace-supers" "^7.7.4"
-"@babel/plugin-transform-parameters@^7.7.4":
- version "7.7.4"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.7.4.tgz#da4555c97f39b51ac089d31c7380f03bca4075ce"
- integrity sha512-VJwhVePWPa0DqE9vcfptaJSzNDKrWU/4FbYCjZERtmqEs05g3UMXnYMZoXja7JAJ7Y7sPZipwm/pGApZt7wHlw==
+"@babel/plugin-transform-parameters@^7.7.7":
+ version "7.7.7"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.7.7.tgz#7a884b2460164dc5f194f668332736584c760007"
+ integrity sha512-OhGSrf9ZBrr1fw84oFXj5hgi8Nmg+E2w5L7NhnG0lPvpDtqd7dbyilM2/vR8CKbJ907RyxPh2kj6sBCSSfI9Ew==
dependencies:
"@babel/helper-call-delegate" "^7.7.4"
"@babel/helper-get-function-arity" "^7.7.4"
@@ -798,9 +799,9 @@
"@babel/plugin-syntax-jsx" "^7.7.4"
"@babel/plugin-transform-react-jsx@^7.7.4":
- version "7.7.4"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.7.4.tgz#d91205717fae4e2f84d020cd3057ec02a10f11da"
- integrity sha512-LixU4BS95ZTEAZdPaIuyg/k8FiiqN9laQ0dMHB4MlpydHY53uQdWCUrwjLr5o6ilS6fAgZey4Q14XBjl5tL6xw==
+ version "7.7.7"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.7.7.tgz#5cbaa7445b4a09f774029f3cc7bb448ff3122a5d"
+ integrity sha512-SlPjWPbva2+7/ZJbGcoqjl4LsQaLpKEzxW9hcxU7675s24JmdotJOSJ4cgAbV82W3FcZpHIGmRZIlUL8ayMvjw==
dependencies:
"@babel/helper-builder-react-jsx" "^7.7.4"
"@babel/helper-plugin-utils" "^7.0.0"
@@ -884,18 +885,18 @@
regenerator-runtime "^0.13.2"
"@babel/preset-env@^7.0.0", "@babel/preset-env@^7.1.0":
- version "7.7.6"
- resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.7.6.tgz#39ac600427bbb94eec6b27953f1dfa1d64d457b2"
- integrity sha512-k5hO17iF/Q7tR9Jv8PdNBZWYW6RofxhnxKjBMc0nG4JTaWvOTiPoO/RLFwAKcA4FpmuBFm6jkoqaRJLGi0zdaQ==
+ version "7.7.7"
+ resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.7.7.tgz#c294167b91e53e7e36d820e943ece8d0c7fe46ac"
+ integrity sha512-pCu0hrSSDVI7kCVUOdcMNQEbOPJ52E+LrQ14sN8uL2ALfSqePZQlKrOy+tM4uhEdYlCHi4imr8Zz2cZe9oSdIg==
dependencies:
"@babel/helper-module-imports" "^7.7.4"
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-proposal-async-generator-functions" "^7.7.4"
"@babel/plugin-proposal-dynamic-import" "^7.7.4"
"@babel/plugin-proposal-json-strings" "^7.7.4"
- "@babel/plugin-proposal-object-rest-spread" "^7.7.4"
+ "@babel/plugin-proposal-object-rest-spread" "^7.7.7"
"@babel/plugin-proposal-optional-catch-binding" "^7.7.4"
- "@babel/plugin-proposal-unicode-property-regex" "^7.7.4"
+ "@babel/plugin-proposal-unicode-property-regex" "^7.7.7"
"@babel/plugin-syntax-async-generators" "^7.7.4"
"@babel/plugin-syntax-dynamic-import" "^7.7.4"
"@babel/plugin-syntax-json-strings" "^7.7.4"
@@ -909,7 +910,7 @@
"@babel/plugin-transform-classes" "^7.7.4"
"@babel/plugin-transform-computed-properties" "^7.7.4"
"@babel/plugin-transform-destructuring" "^7.7.4"
- "@babel/plugin-transform-dotall-regex" "^7.7.4"
+ "@babel/plugin-transform-dotall-regex" "^7.7.7"
"@babel/plugin-transform-duplicate-keys" "^7.7.4"
"@babel/plugin-transform-exponentiation-operator" "^7.7.4"
"@babel/plugin-transform-for-of" "^7.7.4"
@@ -923,7 +924,7 @@
"@babel/plugin-transform-named-capturing-groups-regex" "^7.7.4"
"@babel/plugin-transform-new-target" "^7.7.4"
"@babel/plugin-transform-object-super" "^7.7.4"
- "@babel/plugin-transform-parameters" "^7.7.4"
+ "@babel/plugin-transform-parameters" "^7.7.7"
"@babel/plugin-transform-property-literals" "^7.7.4"
"@babel/plugin-transform-regenerator" "^7.7.5"
"@babel/plugin-transform-reserved-words" "^7.7.4"
@@ -935,7 +936,7 @@
"@babel/plugin-transform-unicode-regex" "^7.7.4"
"@babel/types" "^7.7.4"
browserslist "^4.6.0"
- core-js-compat "^3.4.7"
+ core-js-compat "^3.6.0"
invariant "^2.2.2"
js-levenshtein "^1.1.3"
semver "^5.5.0"
@@ -964,10 +965,10 @@
resolved "https://registry.yarnpkg.com/@babel/preset-stage-0/-/preset-stage-0-7.0.0.tgz#999aaec79ee8f0a763042c68c06539c97c6e0646"
integrity sha512-FBMd0IiARPtH5aaOFUVki6evHiJQiY0pFy7fizyRF7dtwc+el3nwpzvhb9qBNzceG1OIJModG1xpE0DDFjPXwA==
-"@babel/register@^7.0.0", "@babel/register@^7.7.4":
- version "7.7.4"
- resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.7.4.tgz#45a4956471a9df3b012b747f5781cc084ee8f128"
- integrity sha512-/fmONZqL6ZMl9KJUYajetCrID6m0xmL4odX7v+Xvoxcv0DdbP/oO0TWIeLUCHqczQ6L6njDMqmqHFy2cp3FFsA==
+"@babel/register@^7.0.0", "@babel/register@^7.7.7":
+ version "7.7.7"
+ resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.7.7.tgz#46910c4d1926b9c6096421b23d1f9e159c1dcee1"
+ integrity sha512-S2mv9a5dc2pcpg/ConlKZx/6wXaEwHeqfo7x/QbXsdCAZm+WJC1ekVvL1TVxNsedTs5y/gG63MhJTEsmwmjtiA==
dependencies:
find-cache-dir "^2.0.0"
lodash "^4.17.13"
@@ -976,9 +977,9 @@
source-map-support "^0.5.16"
"@babel/runtime@^7.0.0", "@babel/runtime@^7.2.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.3":
- version "7.7.6"
- resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.6.tgz#d18c511121aff1b4f2cd1d452f1bac9601dd830f"
- integrity sha512-BWAJxpNVa0QlE5gZdWjSxXtemZyZ9RmrmVozxt3NUXeZhVIJ5ANyqmMc0JDrivBZyxUuQvFxlvH4OWWOogGfUw==
+ version "7.7.7"
+ resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.7.tgz#194769ca8d6d7790ec23605af9ee3e42a0aa79cf"
+ integrity sha512-uCnC2JEVAu8AKB5do1WRIsvrdJ0flYx/A/9f/6chdacnEZ7LmavjdsDXr5ksYBegxtuTPR5Va9/+13QF/kFkCA==
dependencies:
regenerator-runtime "^0.13.2"
@@ -1015,81 +1016,93 @@
lodash "^4.17.13"
to-fast-properties "^2.0.0"
-"@deck.gl/[email protected]":
- version "7.1.11"
- resolved "https://registry.yarnpkg.com/@deck.gl/aggregation-layers/-/aggregation-layers-7.1.11.tgz#6b66f81a9ff0b120f5b8997c1eee38bf40e106ba"
- integrity sha512-CHsr+UJhf06Mqb/q60iP7ftHQv3ftHUhJbVO4550PRo+QMFFhHfhxo53gQDDgrQ3stxpAcLT3lXRSNghMoU34g==
+"@deck.gl/[email protected]":
+ version "7.3.14"
+ resolved "https://registry.yarnpkg.com/@deck.gl/aggregation-layers/-/aggregation-layers-7.3.14.tgz#b74c603837748ce55b906c4399b97b36dd98c340"
+ integrity sha512-BdGf+fC1b91wPp0NAoULRFbAid9abs6dB7ieKfxzggH6vAkxOhzcTMQIIwnSjPrusGmzSHLg98YDKU5WEp9HdQ==
dependencies:
d3-hexbin "^0.2.1"
-"@deck.gl/[email protected]":
- version "7.1.11"
- resolved "https://registry.yarnpkg.com/@deck.gl/core/-/core-7.1.11.tgz#b5da356053b28767b95d16c29afc1010e21f4e89"
- integrity sha512-jUi1CcsnF5KPL2sv7Z0H3x+8amee5csqliZXGbXEBYox1l8naC4PhHg5jTgLaB0ZOHfVDsldPwGdPC+Mi4jP/Q==
+"@deck.gl/[email protected]":
+ version "7.3.14"
+ resolved "https://registry.yarnpkg.com/@deck.gl/core/-/core-7.3.14.tgz#8840b3ffb2cc923bcc66634a49e937efeaa94dff"
+ integrity sha512-vzOI3TxpXatKtTWDa37sQ8f/8XyVrJZyUJQOs1fVmkraJ5Y5WqaigM910JHSIAuCJ1G8OaL375sW9H5lMSa2kA==
dependencies:
- "@luma.gl/core" "^7.1.0"
+ "@loaders.gl/core" "^1.3.4"
+ "@loaders.gl/images" "^1.3.4"
+ "@luma.gl/addons" "^7.3.2"
+ "@luma.gl/core" "^7.3.2"
gl-matrix "^3.0.0"
- math.gl "^2.3.0"
+ math.gl "^3.0.0"
mjolnir.js "^2.1.2"
- probe.gl "^3.0.1"
+ probe.gl "^3.1.1"
seer "^0.2.4"
- viewport-mercator-project "^6.1.0"
-
-"@deck.gl/[email protected]":
- version "7.1.11"
- resolved "https://registry.yarnpkg.com/@deck.gl/geo-layers/-/geo-layers-7.1.11.tgz#d574a607af10d793194f6a9ee3ce440488da422a"
- integrity sha512-gIJ1K98IFSZ12hB+zHyQC+9pMncb9BKVhJTA7pjUpxwcmEkkroqet9zkYQQMeSInK0a67BR9GXjebb/N0U04qA==
- dependencies:
+ viewport-mercator-project "^6.2.3"
+
+"@deck.gl/[email protected]":
+ version "7.3.14"
+ resolved "https://registry.yarnpkg.com/@deck.gl/extensions/-/extensions-7.3.14.tgz#1cb934fdfeba0c63e0ac928679006e0fdbe48ce6"
+ integrity sha512-FLWsZL+cVugQzNRZ+JDkCB5TaNwuC4yQYvmp2dMbaRZ0ZBpPRIKtbdM5rY+nbcKNWX0HljU6XRQ2r6ykZO37uw==
+
+"@deck.gl/[email protected]":
+ version "7.3.14"
+ resolved "https://registry.yarnpkg.com/@deck.gl/geo-layers/-/geo-layers-7.3.14.tgz#15803e7c1296ec4df65f66c834c9e3e49c5e4eab"
+ integrity sha512-vyHJFlRY0zxmcdrofvAgsErzs4pAmHI43/L3X7wc9N4RUf/rL7b7Gl/luxSWREMSj0c4djbF1eypV//7ViS0gQ==
+ dependencies:
+ "@loaders.gl/3d-tiles" "^1.3.4"
+ "@loaders.gl/core" "^1.3.4"
+ "@loaders.gl/gltf" "^1.3.4"
+ "@math.gl/culling" "^3.0.0"
+ "@math.gl/geospatial" "^3.0.0"
h3-js "^3.4.3"
long "^3.2.0"
s2-geometry "^1.2.10"
-"@deck.gl/[email protected]":
- version "7.1.11"
- resolved "https://registry.yarnpkg.com/@deck.gl/google-maps/-/google-maps-7.1.11.tgz#d85cf3a81ee2a5123e46b4c85d0c8ef7034c4476"
- integrity sha512-gYp3NFIsyT5p65HgKjXFWTDzFf7K8+6ce9d9MIqaNgVWFZdsjUy9JL5TttDMQXshaQ1aZpxtLL6ZO3BiI1w8fw==
+"@deck.gl/[email protected]":
+ version "7.3.14"
+ resolved "https://registry.yarnpkg.com/@deck.gl/google-maps/-/google-maps-7.3.14.tgz#1db909ee66091469f7fe33d301508fed95809c06"
+ integrity sha512-m53qvSfQQc5KGyd5FKbaL5Y4RLz0sP/kRpsGDB2OYWEN/r/SAziF4Vz1FKViY7HYlFS58M8Wa3LUfPqgi8XdqQ==
-"@deck.gl/[email protected]":
- version "7.1.11"
- resolved "https://registry.yarnpkg.com/@deck.gl/json/-/json-7.1.11.tgz#8342322e3cfca8a0e14a970766a793b4e7cb4e06"
- integrity sha512-obYAXq5VZ0qCTVS8hopS64aXGicUeBNg0/03AAfo+Q5z62cNqagAktGKVZMUsJ13bV8CPohJ2zRWMXO+mAJtew==
+"@deck.gl/[email protected]":
+ version "7.3.14"
+ resolved "https://registry.yarnpkg.com/@deck.gl/json/-/json-7.3.14.tgz#c47ea44587025c20664aa672eeeb53da08264c3c"
+ integrity sha512-ctl1E4FFdRgMa5MLcx5eYv5nIHwktcGv7trbWyQpEDDKCkTxN+Cun1SgoSSLBjorHmvm0h8WAUx+7Es8H5XWnQ==
dependencies:
d3-dsv "^1.0.8"
+ expression-eval "^2.0.0"
-"@deck.gl/[email protected]":
- version "7.1.11"
- resolved "https://registry.yarnpkg.com/@deck.gl/layers/-/layers-7.1.11.tgz#d53175a9adfb03869084acc33145c846458d40c8"
- integrity sha512-hOylm7Pf3CSvqpDoiCJLnqLAU3PAePISskJ5jjhpXtgHBrm1/Gk4boP4/7t7kFZdbSvVIXin13pPRbT0SWCRPw==
+"@deck.gl/[email protected]":
+ version "7.3.14"
+ resolved "https://registry.yarnpkg.com/@deck.gl/layers/-/layers-7.3.14.tgz#4faf0b7cd4303e6c6d373d3008804a24bf004538"
+ integrity sha512-0bvS1lQKMzthPFEJ8nDG+/WML0UJlYStTZCC1LcYisbsaPtPrRWzHEZZYc4bGDC/3IIHRNbWF+FiTkxB7yP02Q==
dependencies:
- "@loaders.gl/core" "^1.0.3"
- "@loaders.gl/images" "^1.0.3"
+ "@loaders.gl/images" "^1.3.4"
"@mapbox/tiny-sdf" "^1.1.0"
earcut "^2.0.6"
-"@deck.gl/[email protected]":
- version "7.1.11"
- resolved "https://registry.yarnpkg.com/@deck.gl/mapbox/-/mapbox-7.1.11.tgz#87d2e9306f0ce7679ddc95b11e33b7c2d1ee9d9d"
- integrity sha512-V4cc9vwXzAOBtWV8x+WtvPVXElGChogkvQketeR2uhz6wIHuH+3sBBRg/Ma476w/II+DKjeHg2AzAZeX3SK7yQ==
+"@deck.gl/[email protected]":
+ version "7.3.14"
+ resolved "https://registry.yarnpkg.com/@deck.gl/mapbox/-/mapbox-7.3.14.tgz#6f86bf5ca7e7a929ffbb8e989c43dc062509f7c9"
+ integrity sha512-ULkaqmc9bAEe9rneMoJrprPox81Lj/HDzGqXoFV/QEQY2lq6inq54pKVQkfnRqSFp+W7+npeLzgNkiOh/e3F9Q==
-"@deck.gl/[email protected]":
- version "7.1.11"
- resolved "https://registry.yarnpkg.com/@deck.gl/mesh-layers/-/mesh-layers-7.1.11.tgz#f2eef1962e1f868957b88113f6f57dc94636ba64"
- integrity sha512-rI8ffUNh7ac2GpMcGLEiKyRarOPeLfVRlMRKjl9LXU61Wgx6DaHqsMmeqxzjoXEzgiRlY/XgCjepVg0dY6btlQ==
+"@deck.gl/[email protected]":
+ version "7.3.14"
+ resolved "https://registry.yarnpkg.com/@deck.gl/mesh-layers/-/mesh-layers-7.3.14.tgz#73470246b157926ba6d441604c3948a687aff299"
+ integrity sha512-nOLvlyWIVsld+XRxOme4CwRFZfMNkr1dZj3eyDy6vNPNMHPtUg6U+cw+MG3Da2+cZbWQxsWv/PYP4dGVZ8j6fw==
dependencies:
- "@loaders.gl/core" "^1.0.3"
- "@loaders.gl/images" "^1.0.3"
+ "@luma.gl/addons" "^7.3.2"
-"@deck.gl/[email protected]":
- version "7.1.11"
- resolved "https://registry.yarnpkg.com/@deck.gl/react/-/react-7.1.11.tgz#dbd84a2bec4551841e4592da58a064e0d0d80693"
- integrity sha512-WUzxhvM3jZIZkBAQgdQR+tFBAVDm5opLCKMWI9YkJUsdJzdv9uwiWCsk3Se1pCTFIa5Asb8U6YAi1CHl+OOFyA==
+"@deck.gl/[email protected]":
+ version "7.3.14"
+ resolved "https://registry.yarnpkg.com/@deck.gl/react/-/react-7.3.14.tgz#1f4f6a70647f90df76ab256c184c37e2359d2fc3"
+ integrity sha512-oJvIM6s7ksljaWMPDxkagusONFGKOx3PQQhJq5u5FWsQhN2wbAgdeZdRVEIDDnMgg8/IxtzqmEO/XEN3o80wdw==
dependencies:
prop-types "^15.6.0"
-"@deck.gl/test-utils@^7.1.5":
- version "7.3.8"
- resolved "https://registry.yarnpkg.com/@deck.gl/test-utils/-/test-utils-7.3.8.tgz#20d9b61469b5599c1d2840f94813ecfa0755b038"
- integrity sha512-oT9aS3Ixrxacj9ufhgiZ+xJQk1WWoZcjpfOZOEoX34VUOdaPOMcQgSQyAkKNGcZmuA6qv3cQDolSlPBP9bnffA==
+"@deck.gl/test-utils@^7.3.14":
+ version "7.3.14"
+ resolved "https://registry.yarnpkg.com/@deck.gl/test-utils/-/test-utils-7.3.14.tgz#23404dd646da27c6317ce709aa80f7513557c95c"
+ integrity sha512-USxkDGyqrKVZpd+CKOi2zIGc5eWYjmazxmF3IK9uK3OfGeYXw9fCL8QwukI3Zbzl3XVgg0RRvClAbvyqNtELeQ==
"@emotion/is-prop-valid@^0.8.1":
version "0.8.5"
@@ -1851,14 +1864,28 @@
npmlog "^4.1.2"
write-file-atomic "^2.3.0"
-"@loaders.gl/[email protected]", "@loaders.gl/core@^1.0.3":
+"@loaders.gl/3d-tiles@^1.3.4":
+ version "1.3.5"
+ resolved "https://registry.yarnpkg.com/@loaders.gl/3d-tiles/-/3d-tiles-1.3.5.tgz#e1f568be68ad233efd1c5b58bdb09d14a25c4cea"
+ integrity sha512-JLaK4QjtBTPOlBlLObcoOIdy8cEkR66yBkizaH6oTSV4MFQXZPoGuBm23Ua3si8prn5bPpsNBwzDvCqYmpxUmg==
+ dependencies:
+ "@loaders.gl/core" "1.3.5"
+ "@loaders.gl/gltf" "1.3.5"
+ "@loaders.gl/loader-utils" "1.3.5"
+ "@loaders.gl/math" "1.3.5"
+ "@math.gl/culling" "^3.0.0-beta.3"
+ "@math.gl/geospatial" "^3.0.0-beta.3"
+ math.gl "^3.0.0-beta.3"
+ probe.gl "^3.1.0-beta.3"
+
+"@loaders.gl/[email protected]", "@loaders.gl/core@^1.3.4":
version "1.3.5"
resolved "https://registry.yarnpkg.com/@loaders.gl/core/-/core-1.3.5.tgz#e7046b0e75e45db9fa6c4f0816395ef69aa7d9a8"
integrity sha512-aCVHgLrFuVvxqEP2soN/nst22mfEzAfhhe9LuFQbLcg2oUKbaW6eh1EW6AeYSkkjCmRkCmXRYLFWNvjbg2R55g==
dependencies:
"@babel/runtime" "^7.3.1"
-"@loaders.gl/gltf@^1.3.0":
+"@loaders.gl/[email protected]", "@loaders.gl/gltf@^1.3.0", "@loaders.gl/gltf@^1.3.4":
version "1.3.5"
resolved "https://registry.yarnpkg.com/@loaders.gl/gltf/-/gltf-1.3.5.tgz#bc7500eaad3429d41d071059757723d34ad7037a"
integrity sha512-JLsa0Q7h8Nt+FUECIaEewdJ6DusQxycazfiUo3D2gj8Lt15ydsdPtWLwDhyWRhm80i4FtqO5IqZTQIyTNAlOmA==
@@ -1867,7 +1894,7 @@
"@loaders.gl/images" "1.3.5"
"@loaders.gl/loader-utils" "1.3.5"
-"@loaders.gl/[email protected]", "@loaders.gl/images@^1.0.3", "@loaders.gl/images@^1.3.0":
+"@loaders.gl/[email protected]", "@loaders.gl/images@^1.3.0", "@loaders.gl/images@^1.3.4":
version "1.3.5"
resolved "https://registry.yarnpkg.com/@loaders.gl/images/-/images-1.3.5.tgz#7e34847c66418879e5bad96f7667ab3a34d4825e"
integrity sha512-96F9a1+7HsFEr+bnZh04r4pI2J7iXq4CvaQowCd75sFzgiHBvniHjMDNhjpbzHqGskXoKrSCJUeQ/EVUPCxZtw==
@@ -1879,7 +1906,15 @@
dependencies:
"@babel/runtime" "^7.3.1"
-"@luma.gl/[email protected]":
+"@loaders.gl/[email protected]":
+ version "1.3.5"
+ resolved "https://registry.yarnpkg.com/@loaders.gl/math/-/math-1.3.5.tgz#05825f1fe0c539b9bca770852bf05517827ea415"
+ integrity sha512-/xEqzPD8zm0KV8fau5blE7HZlv5Cs1uEw1uQz5iqDZBL4nymgpK8lQtnjR+rfVx+D8OmHYpx55dVFVsFqFmHcA==
+ dependencies:
+ "@loaders.gl/images" "1.3.5"
+ math.gl "^3.0.0-beta.3"
+
+"@luma.gl/[email protected]", "@luma.gl/addons@^7.3.2":
version "7.3.2"
resolved "https://registry.yarnpkg.com/@luma.gl/addons/-/addons-7.3.2.tgz#ace9d6a81121d7edd5776b2c9cb846b6defbf477"
integrity sha512-ul/iQnrqnhnmVuYo20zrW1FWokKkcnNlqxpRwPolkxFtMsyg5Z+hpxB0dM8buYpCSE0c5ypIsH2AatwXjIMTJA==
@@ -1894,7 +1929,7 @@
resolved "https://registry.yarnpkg.com/@luma.gl/constants/-/constants-7.3.2.tgz#99c5d665f9e6d21192525038e47ec4acfbbbe0a6"
integrity sha512-hr6JOOwsGPjjoHnil4sQ6AWsc8P6XXYtRL10TwNYfFTcNxrhSrjQvutYoCzXHH5U0vfHBfPMMUyLASK9FqiHOA==
-"@luma.gl/[email protected]", "@luma.gl/core@^7.1.0":
+"@luma.gl/[email protected]", "@luma.gl/core@^7.3.2":
version "7.3.2"
resolved "https://registry.yarnpkg.com/@luma.gl/core/-/core-7.3.2.tgz#1d006da99ead3f1a7d6323e5c39e1dd6086f1ecf"
integrity sha512-XyQPSUJRkZcc//gVX0AgjLLNTkCOO68NRnm7RkIhikRBEUdovb4IOcpmWMCB1/Gyj4hzg/Z1FOAVT4pG1E+agw==
@@ -2020,6 +2055,40 @@
resolved "https://registry.yarnpkg.com/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz#497c67a1cef50d1a2459ba60f315e448d2ad87fe"
integrity sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==
+"@math.gl/[email protected]":
+ version "3.1.2"
+ resolved "https://registry.yarnpkg.com/@math.gl/core/-/core-3.1.2.tgz#226472efe83388ca454ee7ab1912358c299f8bc1"
+ integrity sha512-2mUs1ymuca2yU8chJuENUF5DD45sUJXqo8Pqw7cTmZN/Yf/qYKDA/VuPjKjrnTYuQXwUoo/VwSGd0KAaYS+TTA==
+ dependencies:
+ "@babel/runtime" "^7.0.0"
+ gl-matrix "^3.0.0"
+
+"@math.gl/culling@^3.0.0", "@math.gl/culling@^3.0.0-beta.3":
+ version "3.1.2"
+ resolved "https://registry.yarnpkg.com/@math.gl/culling/-/culling-3.1.2.tgz#dc0caf6407fb069c6570010afb3450ca78e98d56"
+ integrity sha512-b0gYJIPxHeArKmMIw9eGzQJEQl5E78PCrSuD1cG30YfxlzQZJjGEBTfmqkR+h3ylwD64OcCi0boLilet4pBcKg==
+ dependencies:
+ "@babel/runtime" "^7.0.0"
+ "@math.gl/core" "3.1.2"
+ gl-matrix "^3.0.0"
+
+"@math.gl/geospatial@^3.0.0", "@math.gl/geospatial@^3.0.0-beta.3":
+ version "3.1.2"
+ resolved "https://registry.yarnpkg.com/@math.gl/geospatial/-/geospatial-3.1.2.tgz#9084344a22262e732005533fac9bbf742c8dcf4b"
+ integrity sha512-+oDLdXJfO1E/BLKSckJXnlAdimxvBliNZQUstViugrXJcUsN+DmgyybyV00kdPftN62+E0apCCN83PeAZfoe1A==
+ dependencies:
+ "@babel/runtime" "^7.0.0"
+ "@math.gl/core" "3.1.2"
+ gl-matrix "^3.0.0"
+
+"@math.gl/web-mercator@^3.1.3":
+ version "3.1.3"
+ resolved "https://registry.yarnpkg.com/@math.gl/web-mercator/-/web-mercator-3.1.3.tgz#3a6b2aeb6c68b331f26269c2fa1905cacc40e84b"
+ integrity sha512-aU+3upxkdA9yObA7EudfEKfN/QH4o5impyc7s/a34J2hZKPsihgREphxnKzl2RknXD/KoL7MnQv589LToAJGMQ==
+ dependencies:
+ "@babel/runtime" "^7.0.0"
+ gl-matrix "^3.0.0"
+
"@mrmlnc/readdir-enhanced@^2.2.1":
version "2.2.1"
resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde"
@@ -2076,9 +2145,9 @@
universal-user-agent "^4.0.0"
"@octokit/rest@^16.28.4":
- version "16.35.0"
- resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-16.35.0.tgz#7ccc1f802f407d5b8eb21768c6deca44e7b4c0d8"
- integrity sha512-9ShFqYWo0CLoGYhA1FdtdykJuMzS/9H6vSbbQWDX4pWr4p9v+15MsH/wpd/3fIU+tSxylaNO48+PIHqOkBRx3w==
+ version "16.35.2"
+ resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-16.35.2.tgz#0098c9e2a895d4afb0fa6578479283553543143c"
+ integrity sha512-iijaNZpn9hBpUdh8YdXqNiWazmq4R1vCUsmxpBB0kCQ0asHZpCx+HNs22eiHuwYKRhO31ZSAGBJLi0c+3XHaKQ==
dependencies:
"@octokit/request" "^5.2.0"
"@octokit/request-error" "^1.0.2"
@@ -2100,14 +2169,21 @@
dependencies:
"@types/node" ">= 8"
+"@probe.gl/[email protected]":
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/@probe.gl/stats/-/stats-3.2.0.tgz#642005c308d768db2ace859482fd89942cbbfc31"
+ integrity sha512-Imo1NZwvV3B9jzVZDXz9Fl1rnhR54wb2YG41Ey25QrHQVH6sFqe2gUutFEY2T/sLLVkbFGNWuZU7jVqCRCJTdw==
+ dependencies:
+ "@babel/runtime" "^7.0.0"
+
"@probe.gl/test-utils@^3.0.1":
- version "3.1.1"
- resolved "https://registry.yarnpkg.com/@probe.gl/test-utils/-/test-utils-3.1.1.tgz#3ffb632b590ae82ae40011e520be0a2e5eb94059"
- integrity sha512-jeOficrZ6zEc38kQTLVfj98GHb551EHv17QSUPTB2lr7grhD2juA+g0h7mmQWW6QNVEzXkJROo2Bv2LO1Ci5Fw==
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/@probe.gl/test-utils/-/test-utils-3.2.0.tgz#abca814fab2977d65f44fd2e0a987f58118546b1"
+ integrity sha512-vsRH/noJnmeqtEoeIPBJbDd8bwJxlrVS8sUhlln9oFIKAok/mfwlSuf3MIwab9KxBGMBIUS2uRoAYz1XrJIHAQ==
dependencies:
"@babel/runtime" "^7.0.0"
pixelmatch "^4.0.2"
- probe.gl "3.1.1"
+ probe.gl "3.2.0"
puppeteer "^1.16.0"
"@turf/[email protected]", "@turf/bbox@^6.0.1":
@@ -2184,9 +2260,9 @@
integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==
"@types/node@*", "@types/node@>= 8":
- version "12.12.17"
- resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.17.tgz#191b71e7f4c325ee0fb23bc4a996477d92b8c39b"
- integrity sha512-Is+l3mcHvs47sKy+afn2O1rV4ldZFU7W8101cNlOd+MRbjM4Onida8jSZnJdTe/0Pcf25g9BNIUsuugmE6puHA==
+ version "12.12.21"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.21.tgz#aa44a6363291c7037111c47e4661ad210aded23f"
+ integrity sha512-8sRGhbpU+ck1n0PGAUgVrWrWdjSW2aqNeyC15W88GRsMpSwzv6RJGlLhE7s2RhVSOdyDmxbqlWSeThq4/7xqlA==
"@types/unist@^2.0.2":
version "2.0.3"
@@ -2691,12 +2767,13 @@ array-ify@^1.0.0:
integrity sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=
array-includes@^3.0.3:
- version "3.1.0"
- resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.0.tgz#48a929ef4c6bb1fa6dc4a92c9b023a261b0ca404"
- integrity sha512-ONOEQoKrvXPKk7Su92Co0YMqYO32FfqJTzkKU9u2UpIXyYZIzLSvpdg4AwvSw4mSUW0czu6inK+zby6Oj6gDjQ==
+ version "3.1.1"
+ resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.1.tgz#cdd67e6852bdf9c1215460786732255ed2459348"
+ integrity sha512-c2VXaCHl7zPsvpkFsw4nxvFie4fh1ur9bpcgsVkIjqn0H/Xwdg+7fv3n2r/isyS8EBj5b06M9kHyZuIr4El6WQ==
dependencies:
define-properties "^1.1.3"
- es-abstract "^1.17.0-next.0"
+ es-abstract "^1.17.0"
+ is-string "^1.0.5"
array-union@^1.0.1, array-union@^1.0.2:
version "1.0.2"
@@ -2728,7 +2805,7 @@ array.prototype.find@^2.0.1, array.prototype.find@^2.1.0:
define-properties "^1.1.3"
es-abstract "^1.13.0"
-array.prototype.flat@^1.2.1:
+array.prototype.flat@^1.2.3:
version "1.2.3"
resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.3.tgz#0de82b426b0318dbfdb940089e38b043d37f6c7b"
integrity sha512-gBlRZV0VSmfPIeWfuuy56XZMvbVfbEUnOXUvt3F/eUUUSyzlgLxhEX4YAEpxNAogRGehPSnfXyPtYyKAhkzQhQ==
@@ -3574,9 +3651,9 @@ camelize@^1.0.0:
integrity sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=
caniuse-lite@^1.0.30001015:
- version "1.0.30001015"
- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001015.tgz#15a7ddf66aba786a71d99626bc8f2b91c6f0f5f0"
- integrity sha512-/xL2AbW/XWHNu1gnIrO8UitBGoFthcsDgU9VLK1/dpsoxbaD5LscHozKze05R6WLsBvLhqv78dAPozMFQBYLbQ==
+ version "1.0.30001016"
+ resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001016.tgz#16ea48d7d6e8caf3cad3295c2d746fe38c4e7f66"
+ integrity sha512-yYQ2QfotceRiH4U+h1Us86WJXtVHDmy3nEKIdYPsZCYnOV5/tMgGbmoIlrMzmh2VXlproqYtVaKeGDBkMZifFA==
capture-stack-trace@^1.0.0:
version "1.0.1"
@@ -3656,7 +3733,7 @@ check-types@^8.0.3:
resolved "https://registry.yarnpkg.com/check-types/-/check-types-8.0.3.tgz#3356cca19c889544f2d7a95ed49ce508a0ecf552"
integrity sha512-YpeKZngUmG65rLudJ4taU7VLkOCTMhNl/u4ctNC56LQS/zJTyNH0Lrtwm1tfTsbLlwvlfsA2d1c8vCf/Kh2KwQ==
-cheerio@^1.0.0-rc.2:
+cheerio@^1.0.0-rc.3:
version "1.0.0-rc.3"
resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.3.tgz#094636d425b2e9c0f4eb91a46c05630c9a1a8bf6"
integrity sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==
@@ -4161,13 +4238,13 @@ copy-descriptor@^0.1.0:
resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"
integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=
-core-js-compat@^3.4.7:
- version "3.5.0"
- resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.5.0.tgz#5a11a619a9e9dd2dcf1c742b2060bc4a2143e5b6"
- integrity sha512-E7iJB72svRjJTnm9HDvujzNVMCm3ZcDYEedkJ/sDTNsy/0yooCd9Cg7GSzE7b4e0LfIkjijdB1tqg0pGwxWeWg==
+core-js-compat@^3.6.0:
+ version "3.6.0"
+ resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.6.0.tgz#4eb6cb69d03d99159ed7c860cd5fcf7d23a62ea9"
+ integrity sha512-Z3eCNjGgoYluH89Jt4wVkfYsc/VdLrA2/woX5lm0isO/pCT+P+Y+o65bOuEnjDJLthdwTBxbCVzptTXtc18fJg==
dependencies:
browserslist "^4.8.2"
- semver "^6.3.0"
+ semver "7.0.0"
core-js@^1.0.0:
version "1.2.7"
@@ -4180,9 +4257,9 @@ core-js@^2.4.0, core-js@^2.6.5:
integrity sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==
core-js@^3.2.1:
- version "3.5.0"
- resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.5.0.tgz#66df8e49be4bd775e6f952a9d083b756ad41c1ed"
- integrity sha512-Ifh3kj78gzQ7NAoJXeTu+XwzDld0QRIwjBLRqAMhuLhP3d2Av5wmgE9ycfnvK6NAEjTkQ1sDPeoEZAWO3Hx1Uw==
+ version "3.6.0"
+ resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.0.tgz#2b854e451de1967d1e29896025cdc13a2518d9ea"
+ integrity sha512-AHPTNKzyB+YwgDWoSOCaid9PUSEF6781vsfiK8qUz62zRR448/XgK2NtCbpiUGizbep8Lrpt0Du19PpGGZvw3Q==
[email protected], core-util-is@~1.0.0:
version "1.0.2"
@@ -4349,9 +4426,9 @@ cssstyle@^1.0.0:
cssom "0.3.x"
csstype@^2.6.7:
- version "2.6.7"
- resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.7.tgz#20b0024c20b6718f4eda3853a1f5a1cce7f5e4a5"
- integrity sha512-9Mcn9sFbGBAdmimWb2gLVDtFJzeKtDGIr76TUqmjZrw9LFXBMSU70lcs+C0/7fyCd6iBDqmksUcCOUIkisPHsQ==
+ version "2.6.8"
+ resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.8.tgz#0fb6fc2417ffd2816a418c9336da74d7f07db431"
+ integrity sha512-msVS9qTuMT5zwAGCVm4mxfrZ18BNc6Csd0oJAtiFMZ1FAx1CCvy2+5MDmYoix63LM/6NDbNtodCiGYGmFgO0dA==
currently-unhandled@^0.4.1:
version "0.4.1"
@@ -4599,7 +4676,7 @@ [email protected]:
dependencies:
ms "2.0.0"
-debug@^3.0.0, debug@^3.1.0, debug@^3.1.1, debug@^3.2.5, debug@^3.2.6:
+debug@^3.0.0, debug@^3.1.0, debug@^3.1.1, debug@^3.2.5:
version "3.2.6"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==
@@ -4631,20 +4708,21 @@ decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.1.2, decamelize@^1.2.0:
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
- version "7.1.11"
- resolved "https://registry.yarnpkg.com/deck.gl/-/deck.gl-7.1.11.tgz#bed2b80b87670a9efa239ac95a9edb50ac46e9e8"
- integrity sha512-OUj9JE544N6Y/DCdfdnsbqKn9o72bWgRfsKhyi8aZ8v76hq7XyelmO2GljBmHGYmuMNVLrKcymNMV0m8EEgpZA==
- dependencies:
- "@deck.gl/aggregation-layers" "7.1.11"
- "@deck.gl/core" "7.1.11"
- "@deck.gl/geo-layers" "7.1.11"
- "@deck.gl/google-maps" "7.1.11"
- "@deck.gl/json" "7.1.11"
- "@deck.gl/layers" "7.1.11"
- "@deck.gl/mapbox" "7.1.11"
- "@deck.gl/mesh-layers" "7.1.11"
- "@deck.gl/react" "7.1.11"
+deck.gl@^7.3.14:
+ version "7.3.14"
+ resolved "https://registry.yarnpkg.com/deck.gl/-/deck.gl-7.3.14.tgz#e61b04527c848ac70d2da848131fe0d8e56d26f5"
+ integrity sha512-wz7V+JOrhTvnrdzOfxNQF1KhbqyFATe6+w8R7j40pFD6IH8/jggcE9Vr7d7VxKeRS579cFVeliyG2/qMFKgemw==
+ dependencies:
+ "@deck.gl/aggregation-layers" "7.3.14"
+ "@deck.gl/core" "7.3.14"
+ "@deck.gl/extensions" "7.3.14"
+ "@deck.gl/geo-layers" "7.3.14"
+ "@deck.gl/google-maps" "7.3.14"
+ "@deck.gl/json" "7.3.14"
+ "@deck.gl/layers" "7.3.14"
+ "@deck.gl/mapbox" "7.3.14"
+ "@deck.gl/mesh-layers" "7.3.14"
+ "@deck.gl/react" "7.3.14"
decode-uri-component@^0.2.0:
version "0.2.0"
@@ -4663,7 +4741,7 @@ dedent@^0.7.0:
resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c"
integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=
-deep-equal@^1.0.1:
+deep-equal@^1.0.1, deep-equal@~1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.1.1.tgz#b5c98c942ceffaf7cb051e24e1434a25a2e6076a"
integrity sha512-yd9c5AdiqVcR+JjcwUQb9DkhJc8ngNr0MahEBGvDiJw8puWab2yZlh+nkasOnZP+EGTAP6rRp2JzJhJZzvNF8g==
@@ -4833,7 +4911,7 @@ detect-indent@^5.0.0:
resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d"
integrity sha1-OHHMCmoALow+Wzz38zYmRnXwa50=
-detect-libc@^1.0.2, detect-libc@^1.0.3:
+detect-libc@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b"
integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=
@@ -5263,72 +5341,73 @@ entities@^2.0.0:
resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.0.tgz#68d6084cab1b079767540d80e56a39b423e4abf4"
integrity sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==
-env-paths@^1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-1.0.0.tgz#4168133b42bb05c38a35b1ae4397c8298ab369e0"
- integrity sha1-QWgTO0K7BcOKNbGuQ5fIKYqzaeA=
+env-paths@^2.2.0:
+ version "2.2.0"
+ resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.0.tgz#cdca557dc009152917d6166e2febe1f039685e43"
+ integrity sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA==
enzyme-adapter-react-16@^1.10.0:
- version "1.15.1"
- resolved "https://registry.yarnpkg.com/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.15.1.tgz#8ad55332be7091dc53a25d7d38b3485fc2ba50d5"
- integrity sha512-yMPxrP3vjJP+4wL/qqfkT6JAIctcwKF+zXO6utlGPgUJT2l4tzrdjMDWGd/Pp1BjHBcljhN24OzNEGRteibJhA==
+ version "1.15.2"
+ resolved "https://registry.yarnpkg.com/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.15.2.tgz#b16db2f0ea424d58a808f9df86ab6212895a4501"
+ integrity sha512-SkvDrb8xU3lSxID8Qic9rB8pvevDbLybxPK6D/vW7PrT0s2Cl/zJYuXvsd1EBTz0q4o3iqG3FJhpYz3nUNpM2Q==
dependencies:
- enzyme-adapter-utils "^1.12.1"
- enzyme-shallow-equal "^1.0.0"
+ enzyme-adapter-utils "^1.13.0"
+ enzyme-shallow-equal "^1.0.1"
has "^1.0.3"
object.assign "^4.1.0"
- object.values "^1.1.0"
+ object.values "^1.1.1"
prop-types "^15.7.2"
- react-is "^16.10.2"
+ react-is "^16.12.0"
react-test-renderer "^16.0.0-0"
semver "^5.7.0"
-enzyme-adapter-utils@^1.12.1:
- version "1.12.1"
- resolved "https://registry.yarnpkg.com/enzyme-adapter-utils/-/enzyme-adapter-utils-1.12.1.tgz#e828e0d038e2b1efa4b9619ce896226f85c9dd88"
- integrity sha512-KWiHzSjZaLEoDCOxY8Z1RAbUResbqKN5bZvenPbfKtWorJFVETUw754ebkuCQ3JKm0adx1kF8JaiR+PHPiP47g==
+enzyme-adapter-utils@^1.13.0:
+ version "1.13.0"
+ resolved "https://registry.yarnpkg.com/enzyme-adapter-utils/-/enzyme-adapter-utils-1.13.0.tgz#01c885dde2114b4690bf741f8dc94cee3060eb78"
+ integrity sha512-YuEtfQp76Lj5TG1NvtP2eGJnFKogk/zT70fyYHXK2j3v6CtuHqc8YmgH/vaiBfL8K1SgVVbQXtTcgQZFwzTVyQ==
dependencies:
airbnb-prop-types "^2.15.0"
- function.prototype.name "^1.1.1"
+ function.prototype.name "^1.1.2"
object.assign "^4.1.0"
- object.fromentries "^2.0.1"
+ object.fromentries "^2.0.2"
prop-types "^15.7.2"
- semver "^5.7.0"
+ semver "^5.7.1"
-enzyme-shallow-equal@^1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/enzyme-shallow-equal/-/enzyme-shallow-equal-1.0.0.tgz#d8e4603495e6ea279038eef05a4bf4887b55dc69"
- integrity sha512-VUf+q5o1EIv2ZaloNQQtWCJM9gpeux6vudGVH6vLmfPXFLRuxl5+Aq3U260wof9nn0b0i+P5OEUXm1vnxkRpXQ==
+enzyme-shallow-equal@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/enzyme-shallow-equal/-/enzyme-shallow-equal-1.0.1.tgz#7afe03db3801c9b76de8440694096412a8d9d49e"
+ integrity sha512-hGA3i1so8OrYOZSM9whlkNmVHOicJpsjgTzC+wn2JMJXhq1oO4kA4bJ5MsfzSIcC71aLDKzJ6gZpIxrqt3QTAQ==
dependencies:
has "^1.0.3"
- object-is "^1.0.1"
+ object-is "^1.0.2"
enzyme@^3.9.0:
- version "3.10.0"
- resolved "https://registry.yarnpkg.com/enzyme/-/enzyme-3.10.0.tgz#7218e347c4a7746e133f8e964aada4a3523452f6"
- integrity sha512-p2yy9Y7t/PFbPoTvrWde7JIYB2ZyGC+NgTNbVEGvZ5/EyoYSr9aG/2rSbVvyNvMHEhw9/dmGUJHWtfQIEiX9pg==
- dependencies:
- array.prototype.flat "^1.2.1"
- cheerio "^1.0.0-rc.2"
- function.prototype.name "^1.1.0"
+ version "3.11.0"
+ resolved "https://registry.yarnpkg.com/enzyme/-/enzyme-3.11.0.tgz#71d680c580fe9349f6f5ac6c775bc3e6b7a79c28"
+ integrity sha512-Dw8/Gs4vRjxY6/6i9wU0V+utmQO9kvh9XLnz3LIudviOnVYDEe2ec+0k+NQoMamn1VrjKgCUOWj5jG/5M5M0Qw==
+ dependencies:
+ array.prototype.flat "^1.2.3"
+ cheerio "^1.0.0-rc.3"
+ enzyme-shallow-equal "^1.0.1"
+ function.prototype.name "^1.1.2"
has "^1.0.3"
- html-element-map "^1.0.0"
- is-boolean-object "^1.0.0"
- is-callable "^1.1.4"
- is-number-object "^1.0.3"
- is-regex "^1.0.4"
- is-string "^1.0.4"
+ html-element-map "^1.2.0"
+ is-boolean-object "^1.0.1"
+ is-callable "^1.1.5"
+ is-number-object "^1.0.4"
+ is-regex "^1.0.5"
+ is-string "^1.0.5"
is-subset "^0.1.1"
lodash.escape "^4.0.1"
lodash.isequal "^4.5.0"
- object-inspect "^1.6.0"
- object-is "^1.0.1"
+ object-inspect "^1.7.0"
+ object-is "^1.0.2"
object.assign "^4.1.0"
- object.entries "^1.0.4"
- object.values "^1.0.4"
- raf "^3.4.0"
+ object.entries "^1.1.1"
+ object.values "^1.1.1"
+ raf "^3.4.1"
rst-selector-parser "^2.2.3"
- string.prototype.trim "^1.1.2"
+ string.prototype.trim "^1.2.1"
err-code@^1.0.0:
version "1.1.2"
@@ -5363,38 +5442,22 @@ error@^7.0.0:
dependencies:
string-template "~0.2.1"
-es-abstract@^1.13.0, es-abstract@^1.5.0:
- version "1.16.3"
- resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.16.3.tgz#52490d978f96ff9f89ec15b5cf244304a5bca161"
- integrity sha512-WtY7Fx5LiOnSYgF5eg/1T+GONaGmpvpPdCpSnYij+U2gDTL0UPfWrhDw7b2IYb+9NQJsYpCA0wOQvZfsd6YwRw==
+es-abstract@^1.13.0, es-abstract@^1.17.0, es-abstract@^1.17.0-next.1, es-abstract@^1.5.0:
+ version "1.17.0"
+ resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.0.tgz#f42a517d0036a5591dbb2c463591dc8bb50309b1"
+ integrity sha512-yYkE07YF+6SIBmg1MsJ9dlub5L48Ek7X0qz+c/CPCHS9EBXfESorzng4cJQjJW5/pB6vDF41u7F8vUhLVDqIug==
dependencies:
es-to-primitive "^1.2.1"
function-bind "^1.1.1"
has "^1.0.3"
has-symbols "^1.0.1"
- is-callable "^1.1.4"
- is-regex "^1.0.4"
- object-inspect "^1.7.0"
- object-keys "^1.1.1"
- string.prototype.trimleft "^2.1.0"
- string.prototype.trimright "^2.1.0"
-
-es-abstract@^1.17.0-next.0, es-abstract@^1.17.0-next.1:
- version "1.17.0-next.1"
- resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.0-next.1.tgz#94acc93e20b05a6e96dacb5ab2f1cb3a81fc2172"
- integrity sha512-7MmGr03N7Rnuid6+wyhD9sHNE2n4tFSwExnU2lQl3lIo2ShXWGePY80zYaoMOmILWv57H0amMjZGHNzzGG70Rw==
- dependencies:
- es-to-primitive "^1.2.1"
- function-bind "^1.1.1"
- has "^1.0.3"
- has-symbols "^1.0.1"
- is-callable "^1.1.4"
- is-regex "^1.0.4"
+ is-callable "^1.1.5"
+ is-regex "^1.0.5"
object-inspect "^1.7.0"
object-keys "^1.1.1"
object.assign "^4.1.0"
- string.prototype.trimleft "^2.1.0"
- string.prototype.trimright "^2.1.0"
+ string.prototype.trimleft "^2.1.1"
+ string.prototype.trimright "^2.1.1"
es-to-primitive@^1.2.1:
version "1.2.1"
@@ -5491,9 +5554,9 @@ eslint-plugin-eslint-plugin@^2.1.0:
integrity sha512-kT3A/ZJftt28gbl/Cv04qezb/NQ1dwYIbi8lyf806XMxkus7DvOVCLIfTXMrorp322Pnoez7+zabXH29tADIDg==
eslint-plugin-prettier@^3.1.0:
- version "3.1.1"
- resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.1.tgz#507b8562410d02a03f0ddc949c616f877852f2ba"
- integrity sha512-A+TZuHZ0KU0cnn56/9mfR7/KjUJ9QNVXUhwvRFSR7PGPe0zQR6PTkmyqg1AtUUEOzTqeRsUwyKFh0oVZKVCrtA==
+ version "3.1.2"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.2.tgz#432e5a667666ab84ce72f945c72f77d996a5c9ba"
+ integrity sha512-GlolCC9y3XZfv3RQfwGew7NnuFDKsfI4lbvRK+PIIo23SFH+LemGs4cKwzAaRa+Mdb+lQO/STaIayno8T5sJJA==
dependencies:
prettier-linter-helpers "^1.0.0"
@@ -5866,6 +5929,13 @@ express@^4.16.3, express@^4.17.1:
utils-merge "1.0.1"
vary "~1.1.2"
+expression-eval@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/expression-eval/-/expression-eval-2.0.0.tgz#156bc71a700b0c7797f47d8a7167ce4fba5c060c"
+ integrity sha512-8cFzfco37CdZQd4DTyZ+ncxQtPUTE0dcxvbGXYc17Ji+3MQSBkT+11GdfC7eO2duvLNuWjN7Ejqb0kLX/u2bBw==
+ dependencies:
+ jsep "^0.3.0"
+
extend-shallow@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f"
@@ -5973,9 +6043,9 @@ fast-glob@^2.2.6:
micromatch "^3.1.10"
fast-json-stable-stringify@^2.0.0:
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2"
- integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I=
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
+ integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==
fast-levenshtein@~2.0.6:
version "2.0.6"
@@ -6330,34 +6400,33 @@ fs.realpath@^1.0.0:
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
fsevents@^1.2.7:
- version "1.2.10"
- resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.10.tgz#47252793be8a625a5f96dfaa1c88547f4b20595a"
- integrity sha512-Dw5DScF/8AWhWzWRbnQrFJfeR/TOJZjRr9Du9kfmd8t234ICcVeDBlauFl/jVcE5ZewhlPoCFvIqp0SE3kAVxA==
+ version "1.2.11"
+ resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.11.tgz#67bf57f4758f02ede88fb2a1712fef4d15358be3"
+ integrity sha512-+ux3lx6peh0BpvY0JebGyZoiR4D+oYzdPZMKJwkZ+sFkNJzpL7tXc/wehS49gUAxg3tmMHPHZkA8JU2rhhgDHw==
dependencies:
+ bindings "^1.5.0"
nan "^2.12.1"
- node-pre-gyp "^0.12.0"
function-bind@^1.0.2, function-bind@^1.1.1, function-bind@~1.1.0, function-bind@~1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==
-function.prototype.name@^1.1.0, function.prototype.name@^1.1.1:
- version "1.1.1"
- resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.1.tgz#6d252350803085abc2ad423d4fe3be2f9cbda392"
- integrity sha512-e1NzkiJuw6xqVH7YSdiW/qDHebcmMhPNe6w+4ZYYEg0VA+LaLzx37RimbPLuonHhYGFGPx1ME2nSi74JiaCr/Q==
+function.prototype.name@^1.1.0, function.prototype.name@^1.1.1, function.prototype.name@^1.1.2:
+ version "1.1.2"
+ resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.2.tgz#5cdf79d7c05db401591dfde83e3b70c5123e9a45"
+ integrity sha512-C8A+LlHBJjB2AdcRPorc5JvJ5VUoWlXdEHLOJdCI7kjHEtGTpHQUiqMvCIKUwIsGwZX2jZJy761AXsn356bJQg==
dependencies:
define-properties "^1.1.3"
- function-bind "^1.1.1"
- functions-have-names "^1.1.1"
- is-callable "^1.1.4"
+ es-abstract "^1.17.0-next.1"
+ functions-have-names "^1.2.0"
functional-red-black-tree@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=
-functions-have-names@^1.1.1:
+functions-have-names@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.0.tgz#83da7583e4ea0c9ac5ff530f73394b033e0bf77d"
integrity sha512-zKXyzksTeaCSw5wIX79iCA40YAa6CJMJgNg9wdkU/ERBrIdPSimPICYiLp65lRbSBqtiHql/HZfS2DyI/AH6tQ==
@@ -6623,7 +6692,7 @@ glob@^6.0.1:
once "^1.3.0"
path-is-absolute "^1.0.0"
-glob@^7.0.0, glob@^7.0.3, glob@^7.0.6, glob@^7.1.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@~7.1.2, glob@~7.1.4:
+glob@^7.0.0, glob@^7.0.3, glob@^7.0.6, glob@^7.1.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@~7.1.2, glob@~7.1.6:
version "7.1.6"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
@@ -6755,7 +6824,7 @@ got@^5.0.0:
unzip-response "^1.0.2"
url-parse-lax "^1.0.0"
-graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0:
+graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.2:
version "4.2.3"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423"
integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==
@@ -6993,7 +7062,7 @@ hpack.js@^2.1.6:
readable-stream "^2.0.1"
wbuf "^1.1.0"
-html-element-map@^1.0.0:
+html-element-map@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/html-element-map/-/html-element-map-1.2.0.tgz#dfbb09efe882806af63d990cf6db37993f099f22"
integrity sha512-0uXq8HsuG1v2TmQ8QkIhzbrqeskE4kn52Q18QJ9iAA/SnHoEKXWiUxHQtclRsCFWEUD2So34X+0+pZZu862nnw==
@@ -7183,7 +7252,7 @@ humanize-ms@^1.2.1:
dependencies:
ms "^2.0.0"
[email protected], [email protected], iconv-lite@^0.4.17, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13:
[email protected], [email protected], iconv-lite@^0.4.17, iconv-lite@^0.4.24, iconv-lite@~0.4.13:
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==
@@ -7479,10 +7548,10 @@ is-binary-path@^1.0.0:
dependencies:
binary-extensions "^1.0.0"
-is-boolean-object@^1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.0.0.tgz#98f8b28030684219a95f375cfbd88ce3405dff93"
- integrity sha1-mPiygDBoQhmpXzdc+9iM40Bd/5M=
+is-boolean-object@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.0.1.tgz#10edc0900dd127697a92f6f9807c7617d68ac48e"
+ integrity sha512-TqZuVwa/sppcrhUCAYkGBk7w0yxfQQnxq28fjkO53tnK9FQXmdwz2JS5+GjsWQ6RByES1K40nI+yDic5c9/aAQ==
is-buffer@^1.1.0, is-buffer@^1.1.4, is-buffer@^1.1.5:
version "1.1.6"
@@ -7494,10 +7563,10 @@ is-buffer@^2.0.0:
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.4.tgz#3e572f23c8411a5cfd9557c849e3665e0b290623"
integrity sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==
-is-callable@^1.1.3, is-callable@^1.1.4:
- version "1.1.4"
- resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75"
- integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==
+is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.1.5:
+ version "1.1.5"
+ resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.5.tgz#f7e46b596890456db74e7f6e976cb3273d06faab"
+ integrity sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==
is-ci@^2.0.0:
version "2.0.0"
@@ -7521,9 +7590,9 @@ is-data-descriptor@^1.0.0:
kind-of "^6.0.0"
is-date-object@^1.0.1:
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
- integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.2.tgz#bda736f2cd8fd06d32844e7743bfa7494c3bfd7e"
+ integrity sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==
is-decimal@^1.0.0:
version "1.0.3"
@@ -7642,10 +7711,10 @@ is-npm@^1.0.0:
resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4"
integrity sha1-8vtjpl5JBbQGyGBydloaTceTufQ=
-is-number-object@^1.0.3:
- version "1.0.3"
- resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.3.tgz#f265ab89a9f445034ef6aff15a8f00b00f551799"
- integrity sha1-8mWrian0RQNO9q/xWo8AsA9VF5k=
+is-number-object@^1.0.4:
+ version "1.0.4"
+ resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.4.tgz#36ac95e741cf18b283fc1ddf5e83da798e3ec197"
+ integrity sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw==
is-number@^2.1.0:
version "2.1.0"
@@ -7729,12 +7798,12 @@ is-redirect@^1.0.0:
resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24"
integrity sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=
-is-regex@^1.0.4:
- version "1.0.4"
- resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
- integrity sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=
+is-regex@^1.0.4, is-regex@^1.0.5, is-regex@~1.0.5:
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.5.tgz#39d589a358bf18967f726967120b8fc1aed74eae"
+ integrity sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==
dependencies:
- has "^1.0.1"
+ has "^1.0.3"
is-relative@^1.0.0:
version "1.0.0"
@@ -7765,10 +7834,10 @@ is-stream@^1.0.0, is-stream@^1.0.1, is-stream@^1.1.0:
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ=
-is-string@^1.0.4:
- version "1.0.4"
- resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.4.tgz#cc3a9b69857d621e963725a24caeec873b826e64"
- integrity sha1-zDqbaYV9Yh6WNyWiTK7shzuCbmQ=
+is-string@^1.0.5:
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.5.tgz#40493ed198ef3ff477b8c7f92f644ec82a5cd3a6"
+ integrity sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==
is-subset@^0.1.1:
version "0.1.1"
@@ -7812,9 +7881,9 @@ is-valid-glob@^1.0.0:
integrity sha1-Kb8+/3Ab4tTTFdusw5vDn+j2Aao=
is-what@^3.3.1:
- version "3.4.0"
- resolved "https://registry.yarnpkg.com/is-what/-/is-what-3.4.0.tgz#a9b3fe0c22f52d49efef977f640da44e65a3f866"
- integrity sha512-oFdBRuSY9PocqPoUUseDXek4I+A1kWGigZGhuG+7GEkp0tRkek11adc0HbTEVsNvtojV7rp0uhf5LWtGvHzoOQ==
+ version "3.5.0"
+ resolved "https://registry.yarnpkg.com/is-what/-/is-what-3.5.0.tgz#c50b0e8f3021e0b39410c159bea43a5510d99027"
+ integrity sha512-00pwt/Jf7IaRh5m2Dp93Iw8LG2cd3OpDj3NrD1XPNUpAWVxPvBP296p4IiGmIU4Ur0f3f56IoIM+fS2pFYF+tQ==
is-whitespace-character@^1.0.0:
version "1.0.3"
@@ -8046,6 +8115,11 @@ jsdom@^11.1.0:
ws "^5.2.0"
xml-name-validator "^3.0.0"
+jsep@^0.3.0:
+ version "0.3.4"
+ resolved "https://registry.yarnpkg.com/jsep/-/jsep-0.3.4.tgz#55ebd4400c5c5861cb1ff949a7a4cd97fcaacaa0"
+ integrity sha512-ovGD9wE+wvudIIYxZGrRcZCxNyZ3Cl1N7Bzyp7/j4d/tA0BaUwcVM9bu0oZaSrefMiNwv6TwZ9X15gvZosteCQ==
+
jsesc@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b"
@@ -8507,7 +8581,7 @@ log-driver@^1.2.7:
resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8"
integrity sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==
-loglevel@^1.6.4:
+loglevel@^1.6.6:
version "1.6.6"
resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.6.tgz#0ee6300cc058db6b3551fa1c4bf73b83bb771312"
integrity sha512-Sgr5lbboAUBo3eXCSPL4/KoVz3ROKquOjcctxmHIt+vol2DrqTQe3SwkKKuYhEiWB5kYa13YyopJ69deJ1irzQ==
@@ -8567,7 +8641,7 @@ lru-cache@^5.1.1:
dependencies:
yallist "^3.0.2"
-luma.gl@^7.1.1:
+luma.gl@^7.3.2:
version "7.3.2"
resolved "https://registry.yarnpkg.com/luma.gl/-/luma.gl-7.3.2.tgz#97a416d77fffd3044735ed75d19bdbf5aff00e94"
integrity sha512-iBm+G2AlQQcd1xXoltEL9Xkohkk/0oyvQU2vgQY4WRfi92JFiimpWnAUR8/hM9jj7jqT4zdc74vUR+GunvQYAA==
@@ -8648,9 +8722,9 @@ map-visit@^1.0.0:
object-visit "^1.0.0"
mapbox-gl@^1.0.0:
- version "1.6.0"
- resolved "https://registry.yarnpkg.com/mapbox-gl/-/mapbox-gl-1.6.0.tgz#f5f6040476a6514712229d057888dd8c25927672"
- integrity sha512-eCHiC8mDa/pOxSi7Z4s4qFWYN8h2uV3zXn6Yf8znbjlMNuYeusV8o3NZb/3rkL6m6gh+UJJL7KTUAc3tedMblA==
+ version "1.6.1"
+ resolved "https://registry.yarnpkg.com/mapbox-gl/-/mapbox-gl-1.6.1.tgz#bc9beb2d7d6464b0d281a225a3f23bd3a84d9f49"
+ integrity sha512-qUvu8c/WX0woSLj8M64eK8351th4RI2+grGJ0ZlFb5ELEJNTb4SqMX/4uxRkb5d1euh2U72+AML1QOZjQnUPUw==
dependencies:
"@mapbox/geojson-rewind" "^0.4.0"
"@mapbox/geojson-types" "^1.0.2"
@@ -8696,21 +8770,12 @@ math-random@^1.0.1:
resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c"
integrity sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==
-math.gl@^2.3.0:
- version "2.3.3"
- resolved "https://registry.yarnpkg.com/math.gl/-/math.gl-2.3.3.tgz#69d07904507145c639835aefcd0ec5e790cd3046"
- integrity sha512-wZhx7574KHUpJVMzkaQ559zfn3R8iB0BOilwNrfL/fOLQfPo2TPWsKX96PdfS4svKA2XIGi3yfizrv2Redcv0g==
- dependencies:
- "@babel/runtime" "^7.0.0"
- gl-matrix "^3.0.0"
-
-math.gl@^3.0.0:
- version "3.0.0"
- resolved "https://registry.yarnpkg.com/math.gl/-/math.gl-3.0.0.tgz#fe7ee98bd9439a29942246b3fe7a36f27fba06b2"
- integrity sha512-HIH2zXZmkCLudLUQjZe8ppnM5bMBeo8prblFSVQ0jy9AxPa3HZqYONDX6vPOf3En7nwkJzw451JHSYAxe70nPA==
+math.gl@^3.0.0, math.gl@^3.0.0-beta.3:
+ version "3.1.2"
+ resolved "https://registry.yarnpkg.com/math.gl/-/math.gl-3.1.2.tgz#ed835e1011f326a23a13b20b7fb3f737d3830463"
+ integrity sha512-FBoEUIJrmt6p/Ekt6LFZBx4rVYo6E7cIY358W142QRRpBeo/pFb6uW4zQNeIEprpbpxrwwFyYrDtUuoKN80tfg==
dependencies:
- "@babel/runtime" "^7.0.0"
- gl-matrix "^3.0.0"
+ "@math.gl/core" "3.1.2"
md5-hex@^1.2.0:
version "1.3.0"
@@ -9099,7 +9164,15 @@ mixin-deep@^1.2.0:
for-in "^1.0.2"
is-extendable "^1.0.1"
-mjolnir.js@^2.1.0, mjolnir.js@^2.1.2, mjolnir.js@^2.2.0:
+mjolnir.js@^2.1.0:
+ version "2.3.0"
+ resolved "https://registry.yarnpkg.com/mjolnir.js/-/mjolnir.js-2.3.0.tgz#192e66fb21b9e81521ee3ac71676e2a3fa678dec"
+ integrity sha512-ungiyxsr+E/M6/76e/K3Ut98QbuEO3UhvC3ucHplDkOpA1x7TeAm01hpP3E8bDsYFrkPk4PCUVJEuirZWguxEA==
+ dependencies:
+ "@babel/runtime" "^7.0.0"
+ hammerjs "^2.0.8"
+
+mjolnir.js@^2.1.2, mjolnir.js@^2.2.0:
version "2.2.1"
resolved "https://registry.yarnpkg.com/mjolnir.js/-/mjolnir.js-2.2.1.tgz#84fc2352ff2ec58b061b0dab1a5ec67f3d2ad966"
integrity sha512-bUTP/NbwOfdrN4TKMjUcarfGmWU5yN6aHFR1ek7BNuFOwHk4PslUZjKzdOp1jwx2m0uCoRa5lG+x82l8Vii7Ng==
@@ -9304,15 +9377,6 @@ nearley@^2.7.10:
randexp "0.4.6"
semver "^5.4.1"
-needle@^2.2.1:
- version "2.4.0"
- resolved "https://registry.yarnpkg.com/needle/-/needle-2.4.0.tgz#6833e74975c444642590e15a750288c5f939b57c"
- integrity sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg==
- dependencies:
- debug "^3.2.6"
- iconv-lite "^0.4.4"
- sax "^1.2.4"
-
version "0.6.2"
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb"
@@ -9395,21 +9459,21 @@ node-gyp@^4.0.0:
which "1"
node-gyp@^5.0.2:
- version "5.0.5"
- resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-5.0.5.tgz#f6cf1da246eb8c42b097d7cd4d6c3ce23a4163af"
- integrity sha512-WABl9s4/mqQdZneZHVWVG4TVr6QQJZUC6PAx47ITSk9lreZ1n+7Z9mMAIbA3vnO4J9W20P7LhCxtzfWsAD/KDw==
+ version "5.0.7"
+ resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-5.0.7.tgz#dd4225e735e840cf2870e4037c2ed9c28a31719e"
+ integrity sha512-K8aByl8OJD51V0VbUURTKsmdswkQQusIvlvmTyhHlIT1hBvaSxzdxpSle857XuXa7uc02UEZx9OR5aDxSWS5Qw==
dependencies:
- env-paths "^1.0.0"
- glob "^7.0.3"
- graceful-fs "^4.1.2"
- mkdirp "^0.5.0"
- nopt "2 || 3"
- npmlog "0 || 1 || 2 || 3 || 4"
- request "^2.87.0"
- rimraf "2"
- semver "~5.3.0"
+ env-paths "^2.2.0"
+ glob "^7.1.4"
+ graceful-fs "^4.2.2"
+ mkdirp "^0.5.1"
+ nopt "^4.0.1"
+ npmlog "^4.1.2"
+ request "^2.88.0"
+ rimraf "^2.6.3"
+ semver "^5.7.1"
tar "^4.4.12"
- which "1"
+ which "^1.3.1"
node-libs-browser@^2.2.1:
version "2.2.1"
@@ -9445,26 +9509,10 @@ node-modules-regexp@^1.0.0:
resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40"
integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=
-node-pre-gyp@^0.12.0:
- version "0.12.0"
- resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz#39ba4bb1439da030295f899e3b520b7785766149"
- integrity sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A==
- dependencies:
- detect-libc "^1.0.2"
- mkdirp "^0.5.1"
- needle "^2.2.1"
- nopt "^4.0.1"
- npm-packlist "^1.1.6"
- npmlog "^4.0.2"
- rc "^1.2.7"
- rimraf "^2.6.1"
- semver "^5.3.0"
- tar "^4"
-
node-releases@^1.1.42:
- version "1.1.42"
- resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.42.tgz#a999f6a62f8746981f6da90627a8d2fc090bbad7"
- integrity sha512-OQ/ESmUqGawI2PRX+XIRao44qWYBBfN54ImQYdWVTQqUckuejOg76ysSqDBK8NG3zwySRVnX36JwDQ6x+9GxzA==
+ version "1.1.43"
+ resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.43.tgz#2c6ca237f88ce11d49631f11190bb01f8d0549f2"
+ integrity sha512-Rmfnj52WNhvr83MvuAWHEqXVoZXCcDQssSOffU4n4XOL9sPrP61mSZ88g25NqmABDvH7PiAlFCzoSCSdzA293w==
dependencies:
semver "^6.3.0"
@@ -9573,7 +9621,7 @@ npm-normalize-package-bin@^1.0.0, npm-normalize-package-bin@^1.0.1:
semver "^5.6.0"
validate-npm-package-name "^3.0.0"
-npm-packlist@^1.1.6, npm-packlist@^1.4.4:
+npm-packlist@^1.4.4:
version "1.4.7"
resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.7.tgz#9e954365a06b80b18111ea900945af4f88ed4848"
integrity sha512-vAj7dIkp5NhieaGZxBJB8fF4R0078rqsmhJcAfXZ6O7JJhjhPK96n5Ry1oZcfLXgfun0GWTZPOxaEyqv8GBykQ==
@@ -9597,7 +9645,7 @@ npm-run-path@^2.0.0:
dependencies:
path-key "^2.0.0"
-"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.1, npmlog@^4.0.2, npmlog@^4.1.2:
+"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.1, npmlog@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b"
integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==
@@ -9706,7 +9754,7 @@ object-copy@^0.1.0:
define-property "^0.2.5"
kind-of "^3.0.3"
-object-inspect@^1.6.0, object-inspect@^1.7.0:
+object-inspect@^1.7.0, object-inspect@~1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67"
integrity sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==
@@ -9716,15 +9764,10 @@ object-inspect@~1.3.0:
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.3.0.tgz#5b1eb8e6742e2ee83342a637034d844928ba2f6d"
integrity sha512-OHHnLgLNXpM++GnJRyyhbr2bwl3pPVm4YvaraHrRvDt/N3r+s/gDVHciA7EJBTkijKXj61ssgSAikq1fb0IBRg==
-object-inspect@~1.6.0:
- version "1.6.0"
- resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b"
- integrity sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==
-
-object-is@^1.0.1:
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.0.1.tgz#0aa60ec9989a0b3ed795cf4d06f62cf1ad6539b6"
- integrity sha1-CqYOyZiaCz7Xlc9NBvYs8a1lObY=
+object-is@^1.0.1, object-is@^1.0.2:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.0.2.tgz#6b80eb84fe451498f65007982f035a5b445edec4"
+ integrity sha512-Epah+btZd5wrrfjkJZq1AOB9O6OxUQto45hzFd7lXGrpHPGE0W1k+426yrZV+k6NJOzLNNW/nVsmZdIWsAqoOQ==
object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.1:
version "1.1.1"
@@ -9748,7 +9791,7 @@ object.assign@^4.0.1, object.assign@^4.0.4, object.assign@^4.1.0:
has-symbols "^1.0.0"
object-keys "^1.0.11"
-object.entries@^1.0.4, object.entries@^1.1.0:
+object.entries@^1.1.0, object.entries@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.1.tgz#ee1cf04153de02bb093fec33683900f57ce5399b"
integrity sha512-ilqR7BgdyZetJutmDPfXCDffGa0/Yzl2ivVNpbx/g4UeWrCdRnFDUBrKJGLhGieRHDATnyZXWBeCb29k9CJysQ==
@@ -9758,7 +9801,7 @@ object.entries@^1.0.4, object.entries@^1.1.0:
function-bind "^1.1.1"
has "^1.0.3"
-object.fromentries@^2.0.1:
+object.fromentries@^2.0.1, object.fromentries@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.2.tgz#4a09c9b9bb3843dd0f89acdb517a794d4f355ac9"
integrity sha512-r3ZiBH7MQppDJVLx6fhD618GKNG40CZYH9wgwdhKxBDDbQgjeWGGd4AtkZad84d291YxvWe7bJGuE65Anh0dxQ==
@@ -9791,7 +9834,7 @@ object.pick@^1.3.0:
dependencies:
isobject "^3.0.1"
-object.values@^1.0.4, object.values@^1.1.0:
+object.values@^1.1.0, object.values@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.1.tgz#68a99ecde356b7e9295a3c5e0ce31dc8c953de5e"
integrity sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA==
@@ -10569,12 +10612,13 @@ private@^0.1.6:
resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"
integrity sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==
[email protected], probe.gl@^3.0.1, probe.gl@^3.1.1:
- version "3.1.1"
- resolved "https://registry.yarnpkg.com/probe.gl/-/probe.gl-3.1.1.tgz#58f5d23efe588b9d9af10add6b47587f8e6c72b3"
- integrity sha512-mD/DzhaYVftrRpobJd/W5JNhDVYCpClhuCGeOphuNZO1+qM6tOlBIf/6ETz11JyolZoJTTeT6aiVXOuIVyAVRg==
[email protected], probe.gl@^3.1.0-beta.3, probe.gl@^3.1.1:
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/probe.gl/-/probe.gl-3.2.0.tgz#f5368a5bc963ec12e19645e2b6ce0294f682f31f"
+ integrity sha512-rJPW92vyl3cf0xpg1xwZPUKWqF0j7sktsmQQ0ILbpXDtEeHFXGC+VeBYpDZc/l1mlj6ft6fum0NP/rLr36HirA==
dependencies:
"@babel/runtime" "^7.0.0"
+ "@probe.gl/stats" "3.2.0"
process-nextick-args@^2.0.0, process-nextick-args@~2.0.0:
version "2.0.1"
@@ -10841,7 +10885,7 @@ quickselect@^2.0.0:
resolved "https://registry.yarnpkg.com/quickselect/-/quickselect-2.0.0.tgz#f19680a486a5eefb581303e023e98faaf25dd018"
integrity sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==
-raf@^3.1.0, raf@^3.4.0:
+raf@^3.1.0, raf@^3.4.1:
version "3.4.1"
resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.1.tgz#0742e99a4a6552f445d73e3ee0328af0ff1ede39"
integrity sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==
@@ -10966,7 +11010,7 @@ react-hot-loader@^3.0.0-beta.6:
redbox-react "^1.3.6"
source-map "^0.6.1"
-react-is@^16.10.2, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.6, react-is@^16.9.0:
+react-is@^16.12.0, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.6, react-is@^16.9.0:
version "16.12.0"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c"
integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q==
@@ -10996,9 +11040,9 @@ [email protected]:
viewport-mercator-project ">=5.0.0"
react-map-gl@^5.0.3:
- version "5.1.3"
- resolved "https://registry.yarnpkg.com/react-map-gl/-/react-map-gl-5.1.3.tgz#c91a28f6dc670d4023e79a8cce8b2129974e6677"
- integrity sha512-Fsj4+yxj/KA7phY5XTGBBi8Ac/PmZGhy1igEJX+IK+kvEbCDJDflhxJQ1NEHDA+9q5CpRpY+mNzb7qIQBUtFZw==
+ version "5.1.5"
+ resolved "https://registry.yarnpkg.com/react-map-gl/-/react-map-gl-5.1.5.tgz#901c5c77f0bc1e8117e3755746096abdb439685d"
+ integrity sha512-c8Wzk/HbV3u9IKbo6F4+9iMY591ehPM4+SIAHauG7TwcbWCB8itclnVbUKDIZqd2Yydp/y7uh7iXjPQCk7taAQ==
dependencies:
"@babel/runtime" "^7.0.0"
mapbox-gl "^1.0.0"
@@ -11452,11 +11496,12 @@ regex-not@^1.0.0, regex-not@^1.0.2:
safe-regex "^1.1.0"
regexp.prototype.flags@^1.2.0:
- version "1.2.0"
- resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.2.0.tgz#6b30724e306a27833eeb171b66ac8890ba37e41c"
- integrity sha512-ztaw4M1VqgMwl9HlPpOuiYgItcHlunW0He2fE6eNfT6E/CF2FtYi9ofOYe4mKntstYk0Fyh/rDRBdS3AnxjlrA==
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz#7aba89b3c13a64509dabcf3ca8d9fbb9bdf5cb75"
+ integrity sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ==
dependencies:
- define-properties "^1.1.2"
+ define-properties "^1.1.3"
+ es-abstract "^1.17.0-next.1"
regexpp@^1.0.1:
version "1.1.0"
@@ -11501,9 +11546,9 @@ regjsgen@^0.5.0:
integrity sha512-5qxzGZjDs9w4tzT3TPhCJqWdCc3RLYwy9J2NB0nm5Lz+S273lvWcpjaTGHsT1dc6Hhfq41uSEOw8wBmxrKOuyg==
regjsparser@^0.6.0:
- version "0.6.1"
- resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.6.1.tgz#5b6b28c418f312ef42898dc6865ae2d4b9f0f7a2"
- integrity sha512-7LutE94sz/NKSYegK+/4E77+8DipxF+Qn2Tmu362AcmsF2NYq/wx3+ObvU90TKEhjf7hQoFXo23ajjrXP7eUgg==
+ version "0.6.2"
+ resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.6.2.tgz#fd62c753991467d9d1ffe0a9f67f27a529024b96"
+ integrity sha512-E9ghzUtoLwDekPT0DYCp+c4h+bvuUpe6rRHCTYn6eGoqj1LgKXxT6I0Il4WbjhQkOghzi/V+y03bPKvbllL93Q==
dependencies:
jsesc "~0.5.0"
@@ -11800,16 +11845,16 @@ [email protected]:
integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=
resolve@^1.1.3, resolve@^1.1.4, resolve@^1.10.0, resolve@^1.13.1, resolve@^1.3.2, resolve@^1.4.0, resolve@^1.8.1:
- version "1.13.1"
- resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.13.1.tgz#be0aa4c06acd53083505abb35f4d66932ab35d16"
- integrity sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w==
+ version "1.14.1"
+ resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.14.1.tgz#9e018c540fcf0c427d678b9931cbf45e984bcaff"
+ integrity sha512-fn5Wobh4cxbLzuHaE+nphztHy43/b++4M6SsGFC2gB8uYwf0C8LcarfCz1un7UTW8OFQg9iNjZ4xpcFVGebDPg==
dependencies:
path-parse "^1.0.6"
-resolve@~1.11.1:
- version "1.11.1"
- resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.1.tgz#ea10d8110376982fef578df8fc30b9ac30a07a3e"
- integrity sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==
+resolve@~1.13.1:
+ version "1.13.1"
+ resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.13.1.tgz#be0aa4c06acd53083505abb35f4d66932ab35d16"
+ integrity sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w==
dependencies:
path-parse "^1.0.6"
@@ -12003,11 +12048,16 @@ semver-diff@^2.0.0:
dependencies:
semver "^5.0.3"
-"semver@2 || 3 || 4 || 5", "[email protected] || 3.x || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0:
+"semver@2 || 3 || 4 || 5", "[email protected] || 3.x || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0, semver@^5.7.1:
version "5.7.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
+ version "7.0.0"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e"
+ integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==
+
semver@^6.0.0, semver@^6.2.0, semver@^6.3.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
@@ -12170,6 +12220,11 @@ simple-get@^3.0.3:
once "^1.3.1"
simple-concat "^1.0.0"
+sinon-stub-promise@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/sinon-stub-promise/-/sinon-stub-promise-4.0.0.tgz#6d498ba1198557cd01e3466af92dc7df725192c2"
+ integrity sha1-bUmLoRmFV80B40Zq+S3H33JRksI=
+
sinon@^2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/sinon/-/sinon-2.4.1.tgz#021fd64b54cb77d9d2fb0d43cdedfae7629c3a36"
@@ -12604,13 +12659,13 @@ string-width@^3.0.0, string-width@^3.1.0:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^5.1.0"
-string.prototype.trim@^1.1.2:
- version "1.2.0"
- resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.0.tgz#75a729b10cfc1be439543dae442129459ce61e3d"
- integrity sha512-9EIjYD/WdlvLpn987+ctkLf0FfvBefOCuiEr2henD8X+7jfwPnyvTdmW8OJhj5p+M0/96mBdynLWkxUr+rHlpg==
+string.prototype.trim@^1.2.1, string.prototype.trim@~1.2.1:
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.1.tgz#141233dff32c82bfad80684d7e5f0869ee0fb782"
+ integrity sha512-MjGFEeqixw47dAMFMtgUro/I0+wNqZB5GKXGt1fFr24u3TzDXCPu7J9Buppzoe3r/LqkSDLDDJzE15RGWDGAVw==
dependencies:
define-properties "^1.1.3"
- es-abstract "^1.13.0"
+ es-abstract "^1.17.0-next.1"
function-bind "^1.1.1"
string.prototype.trim@~1.1.2:
@@ -12622,18 +12677,18 @@ string.prototype.trim@~1.1.2:
es-abstract "^1.5.0"
function-bind "^1.0.2"
-string.prototype.trimleft@^2.1.0:
- version "2.1.0"
- resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz#6cc47f0d7eb8d62b0f3701611715a3954591d634"
- integrity sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==
+string.prototype.trimleft@^2.1.1:
+ version "2.1.1"
+ resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.1.tgz#9bdb8ac6abd6d602b17a4ed321870d2f8dcefc74"
+ integrity sha512-iu2AGd3PuP5Rp7x2kEZCrB2Nf41ehzh+goo8TV7z8/XDBbsvc6HQIlUl9RjkZ4oyrW1XM5UwlGl1oVEaDjg6Ag==
dependencies:
define-properties "^1.1.3"
function-bind "^1.1.1"
-string.prototype.trimright@^2.1.0:
- version "2.1.0"
- resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz#669d164be9df9b6f7559fa8e89945b168a5a6c58"
- integrity sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==
+string.prototype.trimright@^2.1.1:
+ version "2.1.1"
+ resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.1.tgz#440314b15996c866ce8a0341894d45186200c5d9"
+ integrity sha512-qFvWL3/+QIgZXVmJBfpHmxLB7xsUXz6HsUmP8+5dRaC3Q7oKUv9Vo6aMCRZC1smrtyECFsIT30PqBJ1gTjAs+g==
dependencies:
define-properties "^1.1.3"
function-bind "^1.1.1"
@@ -12902,22 +12957,23 @@ [email protected]:
through "~2.3.8"
tape@^4.9.2:
- version "4.11.0"
- resolved "https://registry.yarnpkg.com/tape/-/tape-4.11.0.tgz#63d41accd95e45a23a874473051c57fdbc58edc1"
- integrity sha512-yixvDMX7q7JIs/omJSzSZrqulOV51EC9dK8dM0TzImTIkHWfe2/kFyL5v+d9C+SrCMaICk59ujsqFAVidDqDaA==
+ version "4.12.0"
+ resolved "https://registry.yarnpkg.com/tape/-/tape-4.12.0.tgz#eb5382ac5d450f9c858819b2233458e69aeda4a8"
+ integrity sha512-PWs/TopmfVeYyLNZnfKsoV160xjNq1LvX2SWzZTyhVYsDldR93p5Zp0lfmsY3BCpZdVMXBOkfYZFeScEfsFvKQ==
dependencies:
- deep-equal "~1.0.1"
+ deep-equal "~1.1.1"
defined "~1.0.0"
for-each "~0.3.3"
function-bind "~1.1.1"
- glob "~7.1.4"
+ glob "~7.1.6"
has "~1.0.3"
inherits "~2.0.4"
+ is-regex "~1.0.5"
minimist "~1.2.0"
- object-inspect "~1.6.0"
- resolve "~1.11.1"
+ object-inspect "~1.7.0"
+ resolve "~1.13.1"
resumer "~0.0.0"
- string.prototype.trim "~1.1.2"
+ string.prototype.trim "~1.2.1"
through "~2.3.8"
tar-fs@^2.0.0:
@@ -12941,7 +12997,7 @@ tar-stream@^2.0.0:
inherits "^2.0.3"
readable-stream "^3.1.1"
-tar@^4, tar@^4.4.10, tar@^4.4.12, tar@^4.4.8:
+tar@^4.4.10, tar@^4.4.12, tar@^4.4.8:
version "4.4.13"
resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525"
integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==
@@ -12971,7 +13027,7 @@ temp-write@^3.4.0:
temp-dir "^1.0.0"
uuid "^3.0.1"
-terser-webpack-plugin@^1.4.1:
+terser-webpack-plugin@^1.4.3:
version "1.4.3"
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.4.3.tgz#5ecaf2dbdc5fb99745fd06791f46fc9ddb1c9a7c"
integrity sha512-QMxecFz/gHQwteWwSo5nTc6UaICqN1bMedC5sMtUc7y3Ha3Q8y6ZO0iCR8pq4RJC8Hjf0FEPEHZqcMB/+DFCrA==
@@ -12987,9 +13043,9 @@ terser-webpack-plugin@^1.4.1:
worker-farm "^1.7.0"
terser@^4.1.2:
- version "4.4.2"
- resolved "https://registry.yarnpkg.com/terser/-/terser-4.4.2.tgz#448fffad0245f4c8a277ce89788b458bfd7706e8"
- integrity sha512-Uufrsvhj9O1ikwgITGsZ5EZS6qPokUOkCegS7fYOdGTv+OA90vndUbU6PEjr5ePqHfNUbGyMO7xyIZv2MhsALQ==
+ version "4.4.3"
+ resolved "https://registry.yarnpkg.com/terser/-/terser-4.4.3.tgz#401abc52b88869cf904412503b1eb7da093ae2f0"
+ integrity sha512-0ikKraVtRDKGzHrzkCv5rUNDzqlhmhowOBqC0XqUHFpW+vJ45+20/IFBcebwKfiS2Z9fJin6Eo+F1zLZsxi8RA==
dependencies:
commander "^2.20.0"
source-map "~0.6.1"
@@ -13349,9 +13405,9 @@ typedarray@^0.0.6, typedarray@~0.0.5:
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
ua-parser-js@^0.7.18:
- version "0.7.20"
- resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.20.tgz#7527178b82f6a62a0f243d1f94fd30e3e3c21098"
- integrity sha512-8OaIKfzL5cpx8eCMAhhvTlft8GYF8b2eQr6JkCyVdrgjcytyOmPCXrqXFcUnhonRpLlh5yxEZVohm6mzaowUOw==
+ version "0.7.21"
+ resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.21.tgz#853cf9ce93f642f67174273cc34565ae6f308777"
+ integrity sha512-+O8/qh/Qj8CgC6eYBVBykMrNtp5Gebn4dlGD/kKXVkJNDwyrAwSIqwz8CDf+tsAIWVycKcku6gIXJ0qwx/ZXaQ==
uber-licence@^3.1.1:
version "3.1.1"
@@ -13813,7 +13869,14 @@ vfile@^3.0.0:
unist-util-stringify-position "^1.0.0"
vfile-message "^1.0.0"
-viewport-mercator-project@>=5.0.0, viewport-mercator-project@^6.0.0, viewport-mercator-project@^6.1.0, viewport-mercator-project@^6.2.1:
+viewport-mercator-project@>=5.0.0:
+ version "7.0.1"
+ resolved "https://registry.yarnpkg.com/viewport-mercator-project/-/viewport-mercator-project-7.0.1.tgz#9d7248072f2cbb122f93b63d2b346a5763b8d79a"
+ integrity sha512-WKTuTL7o6WKdPQ+gmZhlXL7UpSdCdPUjxkDTBd/3AayBdAFSQGHxsqdbmPBvmoGwvo9KWo/30HTkNo/Z7ORJpw==
+ dependencies:
+ "@math.gl/web-mercator" "^3.1.3"
+
+viewport-mercator-project@^6.0.0, viewport-mercator-project@^6.2.1:
version "6.2.2"
resolved "https://registry.yarnpkg.com/viewport-mercator-project/-/viewport-mercator-project-6.2.2.tgz#f524819ad53fcc009b46136a59f73461bfcf1604"
integrity sha512-vs9pjDZxDwoiEqr+GgdpRAUogEQRoZ9D9COVLSr4+h/WdcUWhYN36SQr3n5jaTKrl/wlfdRj+TYU8wTk05grbg==
@@ -13821,6 +13884,14 @@ viewport-mercator-project@>=5.0.0, viewport-mercator-project@^6.0.0, viewport-me
"@babel/runtime" "^7.0.0"
gl-matrix "^3.0.0"
+viewport-mercator-project@^6.2.3:
+ version "6.2.3"
+ resolved "https://registry.yarnpkg.com/viewport-mercator-project/-/viewport-mercator-project-6.2.3.tgz#4122040f51ef9553fa41a46bcc6502977b3909c6"
+ integrity sha512-QQb0/qCLlP4DdfbHHSWVYXpghB2wkLIiiZQnoelOB59mXKQSyZVxjreq1S+gaBJFpcGkWEcyVtre0+2y2DTl/Q==
+ dependencies:
+ "@babel/runtime" "^7.0.0"
+ gl-matrix "^3.0.0"
+
vinyl-fs@^3.0.2:
version "3.0.3"
resolved "https://registry.yarnpkg.com/vinyl-fs/-/vinyl-fs-3.0.3.tgz#c85849405f67428feabbbd5c5dbdd64f47d31bc7"
@@ -13994,9 +14065,9 @@ webpack-dev-middleware@^3.5.1, webpack-dev-middleware@^3.7.2:
webpack-log "^2.0.0"
webpack-dev-server@^3.1.14:
- version "3.9.0"
- resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-3.9.0.tgz#27c3b5d0f6b6677c4304465ac817623c8b27b89c"
- integrity sha512-E6uQ4kRrTX9URN9s/lIbqTAztwEPdvzVrcmHE8EQ9YnuT9J8Es5Wrd8n9BKg1a0oZ5EgEke/EQFgUsp18dSTBw==
+ version "3.10.1"
+ resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-3.10.1.tgz#1ff3e5cccf8e0897aa3f5909c654e623f69b1c0e"
+ integrity sha512-AGG4+XrrXn4rbZUueyNrQgO4KGnol+0wm3MPdqGLmmA+NofZl3blZQKxZ9BND6RDNuvAK9OMYClhjOSnxpWRoA==
dependencies:
ansi-html "0.0.7"
bonjour "^3.5.0"
@@ -14013,7 +14084,7 @@ webpack-dev-server@^3.1.14:
ip "^1.1.5"
is-absolute-url "^3.0.3"
killable "^1.0.1"
- loglevel "^1.6.4"
+ loglevel "^1.6.6"
opn "^5.5.0"
p-retry "^3.0.1"
portfinder "^1.0.25"
@@ -14064,9 +14135,9 @@ webpack-stats-plugin@^0.2.1:
integrity sha512-OYMZLpZrK/qLA79NE4kC4DCt85h/5ipvWJcsefKe9MMw0qU4/ck/IJg+4OmWA+5EfrZZpHXDq92IptfYDWVfkw==
webpack@^4.28.4, webpack@^4.29.0:
- version "4.41.2"
- resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.41.2.tgz#c34ec76daa3a8468c9b61a50336d8e3303dce74e"
- integrity sha512-Zhw69edTGfbz9/8JJoyRQ/pq8FYUoY0diOXqW0T6yhgdhCv6wr0hra5DwwWexNRns2Z2+gsnrNcbe9hbGBgk/A==
+ version "4.41.4"
+ resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.41.4.tgz#4bec4125224bdf50efa8be6226c19047599cd034"
+ integrity sha512-Lc+2uB6NjpCWsHI3trkoISOI64h9QYIXenbEWj3bn3oyjfB1lEBXjWAfAyY2sM0rZn41oD5V91OLwKRwS6Wp8Q==
dependencies:
"@webassemblyjs/ast" "1.8.5"
"@webassemblyjs/helper-module-context" "1.8.5"
@@ -14088,7 +14159,7 @@ webpack@^4.28.4, webpack@^4.29.0:
node-libs-browser "^2.2.1"
schema-utils "^1.0.0"
tapable "^1.1.3"
- terser-webpack-plugin "^1.4.1"
+ terser-webpack-plugin "^1.4.3"
watchpack "^1.6.0"
webpack-sources "^1.4.1"