@carto/kepler.gl 0.0.68 → 0.0.69-alpha.hackathon-3dtiles.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,6 +54,43 @@ import {
54
54
  import {observeDimensions, unobserveDimensions} from '../utils/observe-dimensions';
55
55
  import {LOCALE_CODES} from 'localization/locales';
56
56
 
57
+ // 3D tiles
58
+ import {_TerrainExtension as TerrainExtension} from '@deck.gl/extensions';
59
+ import {Tile3DLayer} from '@deck.gl/geo-layers';
60
+
61
+ const GOOGLE_MAPS_API_KEY = 'AIzaSyCpvQymc5wjSYIsxy3RV1widM3p3h78CAk';
62
+
63
+ let h = 0;
64
+ const tiles3d = new Tile3DLayer({
65
+ id: 'google-3d-tiles',
66
+ data: 'https://tile.googleapis.com/v1/3dtiles/root.json',
67
+ onTilesetLoad: tileset3d => {
68
+ // tileset3d.options.maximumScreenSpaceError = 4;
69
+ tileset3d._onTileLoadError = () => {};
70
+ tileset3d.options.onTraversalComplete = selectedTiles => {
71
+ // Do not show tiles which are many layers too low in resolution (avoids artifacts)
72
+ let maxDepth = 0;
73
+ for (const {depth} of selectedTiles) {
74
+ if (depth > maxDepth) maxDepth = depth;
75
+ }
76
+ const filtered = selectedTiles.filter(t => t.depth > maxDepth - 4);
77
+
78
+ // Hacky way to obtain height above sea level to improve controls
79
+ if (filtered.length) {
80
+ h = filtered.map(t => t.boundingBox[0][2]).reduce((a, n) => a + n) / filtered.length;
81
+ }
82
+
83
+ return filtered;
84
+ };
85
+ },
86
+ loadOptions: {
87
+ fetch: {headers: {'X-GOOG-API-KEY': GOOGLE_MAPS_API_KEY}}
88
+ },
89
+ // @ts-ignore
90
+ operation: 'terrain+draw' // Required to enable draping of other layers
91
+ });
92
+ const terrainExtension = new TerrainExtension();
93
+
57
94
  // Performance debugging
58
95
  import {createTracker, createLayerUpdateTracker, renderPerformanceStats} from './performance';
59
96
  const trackers = {};
@@ -404,6 +441,17 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {
404
441
  );
405
442
  }
406
443
 
444
+ if (
445
+ mapStyle.styleType === 'voyager' &&
446
+ Object.values(mapStyle.visibleLayerGroups).filter(x => x).length === 0
447
+ ) {
448
+ // Inject 3D tiles when map style is Voyager without layers (hack until UI is built)
449
+ deckGlLayers = deckGlLayers
450
+ .filter(l => Boolean(l && l.clone))
451
+ .map(l => l.clone({extensions: [...l.props.extensions, terrainExtension]}));
452
+ deckGlLayers.push(tiles3d.clone());
453
+ }
454
+
407
455
  // Limit renders
408
456
  const hasRendered = this._hasRendered;
409
457
  const resetHasRendered = () => (hasRendered.current = false);
@@ -427,7 +475,10 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {
427
475
  }}
428
476
  onHover={visStateActions.onLayerHover}
429
477
  onClick={visStateActions.onLayerClick}
430
- onError={this._onDeckError}
478
+ onError={e => {
479
+ debugger;
480
+ this._onDeckError(e);
481
+ }}
431
482
  ref={comp => {
432
483
  if (comp && comp.deck && comp.deck !== this._deck) {
433
484
  this._deck = comp.deck;
@@ -477,6 +528,8 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {
477
528
  // after we have received proper dimensions from observeDimensions
478
529
  const next = {
479
530
  ...(width > 0 && height > 0 ? viewState : restViewState),
531
+ // Only works with Mapbox basemap (Google ignores this)
532
+ position: [0, 0, h],
480
533
  // enabling transition in two maps may lead to endless update loops
481
534
  transitionDuration: primary ? TRANSITION_DURATION : 0
482
535
  };
@@ -84,6 +84,12 @@ export const TOOLTIP_FORMATS = {
84
84
  format: '.4~r',
85
85
  type: TOOLTIP_FORMAT_TYPES.DECIMAL
86
86
  },
87
+ DECIMAL_ZERO: {
88
+ id: 'DECIMAL_ZERO',
89
+ label: '12,345,678',
90
+ format: ',.0f',
91
+ type: TOOLTIP_FORMAT_TYPES.DECIMAL
92
+ },
87
93
  DECIMAL_THREE: {
88
94
  id: 'DECIMAL_THREE',
89
95
  label: '12,345.432',
@@ -20,17 +20,12 @@
20
20
 
21
21
  import en from './en';
22
22
  import {flattenMessages} from 'utils/locale-utils';
23
- import {LOCALE_CODES} from './locales';
24
23
 
25
24
  const enFlat = flattenMessages(en);
26
25
 
27
- export const messages = Object.keys(LOCALE_CODES).reduce(
28
- (acc, key) => ({
29
- ...acc,
30
- [key]: key === 'en' ? enFlat : {...enFlat, ...flattenMessages(require(`./${key}`).default)}
31
- }),
32
- {}
33
- );
26
+ export const messages = {
27
+ en: enFlat
28
+ };
34
29
 
35
30
  export {LOCALE_CODES, LOCALES} from './locales';
36
31
 
@@ -19,14 +19,7 @@
19
19
  // THE SOFTWARE.
20
20
 
21
21
  export const LOCALES = {
22
- en: 'English',
23
- fi: 'Suomi',
24
- pt: 'Português',
25
- es: 'Español',
26
- ca: 'Català',
27
- ja: '日本語',
28
- cn: '简体中文',
29
- ru: 'Русский'
22
+ en: 'English'
30
23
  };
31
24
 
32
25
  /**
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
-
10
- var _react = _interopRequireDefault(require("react"));
11
-
12
- var _reactIntl = require("react-intl");
13
-
14
- // Copyright (c) 2022 Uber Technologies, Inc.
15
- //
16
- // Permission is hereby granted, free of charge, to any person obtaining a copy
17
- // of this software and associated documentation files (the "Software"), to deal
18
- // in the Software without restriction, including without limitation the rights
19
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20
- // copies of the Software, and to permit persons to whom the Software is
21
- // furnished to do so, subject to the following conditions:
22
- //
23
- // The above copyright notice and this permission notice shall be included in
24
- // all copies or substantial portions of the Software.
25
- //
26
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
32
- // THE SOFTWARE.
33
- CustomMarkerCategoriesSelectorFactory.deps = [];
34
-
35
- function CustomMarkerCategoriesSelectorFactory() {
36
- var CustomMarkerCategoriesSelector = function CustomMarkerCategoriesSelector() {
37
- return /*#__PURE__*/_react["default"].createElement("div", null, "Component replaced by cloud native");
38
- };
39
-
40
- return (0, _reactIntl.injectIntl)(CustomMarkerCategoriesSelector);
41
- }
42
-
43
- var _default = CustomMarkerCategoriesSelectorFactory;
44
- exports["default"] = _default;
45
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL3NpZGUtcGFuZWwvbGF5ZXItcGFuZWwvY3VzdG9tLW1hcmtlci1jYXRlZ29yaWVzLXNlbGVjdG9yLmpzIl0sIm5hbWVzIjpbIkN1c3RvbU1hcmtlckNhdGVnb3JpZXNTZWxlY3RvckZhY3RvcnkiLCJkZXBzIiwiQ3VzdG9tTWFya2VyQ2F0ZWdvcmllc1NlbGVjdG9yIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFvQkE7O0FBQ0E7O0FBckJBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBS0FBLHFDQUFxQyxDQUFDQyxJQUF0QyxHQUE2QyxFQUE3Qzs7QUFDQSxTQUFTRCxxQ0FBVCxHQUFpRDtBQUMvQyxNQUFNRSw4Q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