itowns 2.36.2 → 2.37.0

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.
Files changed (82) hide show
  1. package/CONTRIBUTING.md +30 -17
  2. package/changelog.md +52 -0
  3. package/dist/debug.js +1 -1
  4. package/dist/debug.js.LICENSE.txt +1 -1
  5. package/dist/debug.js.map +1 -1
  6. package/dist/itowns.js +1 -1
  7. package/dist/itowns.js.map +1 -1
  8. package/dist/itowns_widgets.js +2 -0
  9. package/dist/itowns_widgets.js.map +1 -0
  10. package/examples/config.json +25 -6
  11. package/examples/css/widgets.css +248 -0
  12. package/examples/geoid_geoidLayer.html +102 -0
  13. package/examples/images/compass.svg +60 -0
  14. package/examples/images/widget-logo.svg +66 -0
  15. package/examples/itowns-potree.html +252 -0
  16. package/examples/js/GUI/GuiTools.js +17 -0
  17. package/examples/js/Scale.js +1 -0
  18. package/examples/source_file_from_fetched_data.html +90 -0
  19. package/examples/source_file_from_format.html +85 -0
  20. package/examples/source_file_from_methods.html +87 -0
  21. package/examples/source_file_from_parsed_data.html +104 -0
  22. package/examples/source_file_geojson_raster.html +21 -45
  23. package/examples/source_file_gpx_raster.html +28 -36
  24. package/examples/source_file_kml_raster.html +1 -4
  25. package/examples/source_file_shapefile.html +39 -34
  26. package/examples/source_stream_wfs_25d.html +21 -13
  27. package/examples/source_stream_wfs_3d.html +21 -12
  28. package/examples/source_stream_wfs_raster.html +20 -20
  29. package/examples/view_immersive.html +13 -14
  30. package/examples/widgets_minimap.html +122 -0
  31. package/examples/widgets_navigation.html +119 -0
  32. package/lib/Controls/GlobeControls.js +13 -0
  33. package/lib/Controls/PlanarControls.js +1 -1
  34. package/lib/Converter/convertToTile.js +5 -1
  35. package/lib/Core/3DTiles/C3DTBoundingVolume.js +4 -1
  36. package/lib/Core/Deprecated/Undeprecator.js +1 -1
  37. package/lib/Core/Feature.js +3 -4
  38. package/lib/Core/Geographic/Extent.js +1 -1
  39. package/lib/Core/Geographic/GeoidGrid.js +143 -0
  40. package/lib/Core/MainLoop.js +1 -1
  41. package/lib/Core/Math/Ellipsoid.js +1 -1
  42. package/lib/Core/Prefab/Globe/SkyShader.js +3 -1
  43. package/lib/Core/Prefab/Planar/PlanarLayer.js +3 -1
  44. package/lib/Core/Style.js +1 -1
  45. package/lib/Core/TileGeometry.js +3 -1
  46. package/lib/Core/TileMesh.js +11 -17
  47. package/lib/Core/View.js +40 -2
  48. package/lib/Layer/ElevationLayer.js +6 -2
  49. package/lib/Layer/FeatureGeometryLayer.js +3 -1
  50. package/lib/Layer/GeoidLayer.js +131 -0
  51. package/lib/Layer/InfoLayer.js +1 -1
  52. package/lib/Layer/Layer.js +1 -1
  53. package/lib/Layer/LayerUpdateStrategy.js +1 -1
  54. package/lib/Layer/PotreeLayer.js +3 -1
  55. package/lib/Layer/TiledGeometryLayer.js +3 -1
  56. package/lib/Main.js +214 -174
  57. package/lib/MainBundle.js +1 -1
  58. package/lib/Parser/B3dmParser.js +2 -1
  59. package/lib/Parser/GDFParser.js +118 -0
  60. package/lib/Parser/GTXParser.js +92 -0
  61. package/lib/Parser/ISGParser.js +121 -0
  62. package/lib/Parser/LASParser.js +3 -1
  63. package/lib/Parser/XbilParser.js +1 -1
  64. package/lib/Process/3dTilesProcessing.js +2 -2
  65. package/lib/Process/FeatureProcessing.js +3 -1
  66. package/lib/Process/LayeredMaterialNodeProcessing.js +7 -4
  67. package/lib/Provider/URLBuilder.js +1 -1
  68. package/lib/Renderer/LayeredMaterial.js +2 -2
  69. package/lib/Renderer/OBB.js +18 -25
  70. package/lib/Renderer/PointsMaterial.js +5 -6
  71. package/lib/Renderer/RasterTile.js +1 -1
  72. package/lib/Renderer/Shader/ShaderUtils.js +4 -2
  73. package/lib/Source/C3DTilesSource.js +3 -1
  74. package/lib/Source/EntwinePointTileSource.js +3 -1
  75. package/lib/Source/PotreeSource.js +3 -1
  76. package/lib/Source/Source.js +15 -10
  77. package/lib/Source/WMTSSource.js +3 -1
  78. package/lib/ThreeExtended/loaders/GLTFLoader.js +85 -35
  79. package/lib/Utils/CameraUtils.js +11 -1
  80. package/lib/Utils/DEMUtils.js +1 -1
  81. package/lib/Utils/FeaturesUtils.js +8 -4
  82. package/package.json +25 -25
@@ -0,0 +1,131 @@
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 _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
+
16
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
17
+
18
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
19
+
20
+ var _Layer2 = _interopRequireDefault(require("./Layer"));
21
+
22
+ var _LayerUpdateState = _interopRequireDefault(require("./LayerUpdateState"));
23
+
24
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
25
+
26
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
27
+
28
+ /**
29
+ * `GeoidLayer` is a specific `{@link Layer}` which supports geoid height data. When added to a `{@link View}`, it
30
+ * vertically translates each of the view's tiles by a proper geoid height value. For a given tile, the geoid height
31
+ * value used for translation is the geoid height computed at the center of the tile.
32
+ *
33
+ * @example
34
+ * // Create a GeoidLayer from a GTX geoid heights file.
35
+ * const geoidLayer = new GeoidLayer('geoid', {
36
+ * source: new FileSource({
37
+ * url: 'url-to-some-GTX-geoid-heights-file.gtx',
38
+ * crs: 'EPSG:4326',
39
+ * format: 'application/gtx',
40
+ * }),
41
+ * });
42
+ */
43
+ var GeoidLayer = /*#__PURE__*/function (_Layer) {
44
+ (0, _inherits2["default"])(GeoidLayer, _Layer);
45
+
46
+ var _super = _createSuper(GeoidLayer);
47
+
48
+ /**
49
+ * Creates a new instance of `GeoidLayer`.
50
+ *
51
+ * @param {string} id An unique identifier for the layer.
52
+ * @param {Object} config The layer configuration. All elements in it will be merged as is in the
53
+ * layer. For example, if the configuration contains three elements `name,
54
+ * protocol, extent`, these elements will be available using `layer.name` or
55
+ * something else depending on the property name. Only `config.source`
56
+ * parameter is mandatory.
57
+ * @param {Object} config.source The source of the geoid data displayed by the `GeoidLayer`. It is mandatory
58
+ * that the source data for a `GeoidLayer` be parsed into a
59
+ * `{@link GeoidGrid}`. You can refer to `{@link GTXParser}`,
60
+ * `{@link GDFParser}` and `{@link ISGParser}` to see how three standard
61
+ * geoid height grid file formats are parsed into `{@link GeoidGrid}`.
62
+ */
63
+ function GeoidLayer(id) {
64
+ var _this;
65
+
66
+ var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
67
+ (0, _classCallCheck2["default"])(this, GeoidLayer);
68
+ _this = _super.call(this, id, config);
69
+ _this.isGeoidLayer = true;
70
+
71
+ _this.defineLayerProperty('visible', true);
72
+
73
+ return _this;
74
+ }
75
+
76
+ (0, _createClass2["default"])(GeoidLayer, [{
77
+ key: "updateNodeZ",
78
+ value: function updateNodeZ(node, parent) {
79
+ node.position.z += (this.visible ? 1 : -1) * (node.geoidHeight - parent.geoidHeight);
80
+ node.updateMatrix();
81
+ node.updateMatrixWorld(true);
82
+ }
83
+ }, {
84
+ key: "update",
85
+ value: function update(context, layer, node, parent) {
86
+ var _this2 = this;
87
+
88
+ if (!parent || !node.material) {
89
+ return;
90
+ } // Don't update tile if its zoom is not within the layer's zoom limits
91
+
92
+
93
+ var extentsDestination = node.getExtentsByProjection(layer.crs);
94
+ var zoom = extentsDestination[0].zoom;
95
+
96
+ if (zoom > layer.zoom.max || zoom < layer.zoom.min) {
97
+ return;
98
+ }
99
+
100
+ if (node.layerUpdateState[layer.id] === undefined) {
101
+ node.layerUpdateState[layer.id] = new _LayerUpdateState["default"]();
102
+
103
+ var updateNodeZ = function () {
104
+ return _this2.updateNodeZ(node, parent);
105
+ };
106
+
107
+ layer.addEventListener('visible-property-changed', updateNodeZ);
108
+ node.addEventListener('dispose', function () {
109
+ layer.removeEventListener('visible-property-changed', updateNodeZ);
110
+ });
111
+ }
112
+
113
+ if (layer.frozen || !layer.visible || !node.material.visible || !node.layerUpdateState[layer.id].canTryUpdate()) {
114
+ return;
115
+ }
116
+
117
+ node.layerUpdateState[layer.id].newTry();
118
+ return this.getData(node.extent, extentsDestination).then(function (result) {
119
+ node.geoidHeight = result.getHeightAtCoordinates(node.extent.center());
120
+
121
+ _this2.updateNodeZ(node, parent);
122
+
123
+ node.layerUpdateState[layer.id].noMoreUpdatePossible();
124
+ });
125
+ }
126
+ }]);
127
+ return GeoidLayer;
128
+ }(_Layer2["default"]);
129
+
130
+ var _default = GeoidLayer;
131
+ exports["default"] = _default;
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.InfoTiledGeometryLayer = exports["default"] = void 0;
8
+ exports["default"] = exports.InfoTiledGeometryLayer = void 0;
9
9
 
10
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
11
 
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports.ImageryLayers = exports["default"] = void 0;
10
+ exports["default"] = exports.ImageryLayers = void 0;
11
11
 
12
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
13
 
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.STRATEGY_PROGRESSIVE = exports.STRATEGY_MIN_NETWORK_TRAFFIC = exports.STRATEGY_GROUP = exports.STRATEGY_DICHOTOMY = void 0;
6
7
  exports.chooseNextLevelToFetch = chooseNextLevelToFetch;
7
- exports.STRATEGY_DICHOTOMY = exports.STRATEGY_PROGRESSIVE = exports.STRATEGY_GROUP = exports.STRATEGY_MIN_NETWORK_TRAFFIC = void 0;
8
8
 
9
9
  var _RasterTile = require("../Renderer/RasterTile");
10
10
 
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports["default"] = void 0;
11
11
 
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
12
14
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
15
 
14
16
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
@@ -114,7 +116,7 @@ var PotreeLayer = /*#__PURE__*/function (_PointCloudLayer) {
114
116
  return _this;
115
117
  }
116
118
 
117
- return PotreeLayer;
119
+ return (0, _createClass2["default"])(PotreeLayer);
118
120
  }(_PointCloudLayer2["default"]);
119
121
 
120
122
  var _default = PotreeLayer;
@@ -118,7 +118,9 @@ var TiledGeometryLayer = /*#__PURE__*/function (_GeometryLayer) {
118
118
  config.cacheLifeTime = _Cache.CACHE_POLICIES.INFINITE;
119
119
  config.source = false;
120
120
  _this = _super.call(this, id, object3d, config);
121
- _this.isTiledGeometryLayer = true;
121
+ _this.isTiledGeometryLayer = true; // TODO : this should be add in a preprocess method specific to GeoidLayer.
122
+
123
+ _this.object3d.geoidHeight = 0;
122
124
  _this.protocol = 'tile';
123
125
  _this.sseSubdivisionThreshold = _this.sseSubdivisionThreshold || 1.0;
124
126
  _this.schemeTile = schemeTile;