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
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports["default"] = void 0;
9
9
 
10
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
+
10
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
13
 
12
14
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
@@ -116,7 +118,7 @@ var PotreeSource = /*#__PURE__*/function (_Source) {
116
118
  return _this;
117
119
  }
118
120
 
119
- return PotreeSource;
121
+ return (0, _createClass2["default"])(PotreeSource);
120
122
  }(_Source2["default"]);
121
123
 
122
124
  var _default = PotreeSource;
@@ -5,9 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports["default"] = exports.supportedParsers = exports.supportedFetchers = void 0;
9
-
10
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
8
+ exports.supportedParsers = exports.supportedFetchers = exports["default"] = void 0;
11
9
 
12
10
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
11
 
@@ -15,6 +13,8 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
15
13
 
16
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
17
15
 
16
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
+
18
18
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
19
19
 
20
20
  var _Extent = _interopRequireDefault(require("../Core/Geographic/Extent"));
@@ -23,8 +23,14 @@ var _GeoJsonParser = _interopRequireDefault(require("../Parser/GeoJsonParser"));
23
23
 
24
24
  var _KMLParser = _interopRequireDefault(require("../Parser/KMLParser"));
25
25
 
26
+ var _GDFParser = _interopRequireDefault(require("../Parser/GDFParser"));
27
+
26
28
  var _GpxParser = _interopRequireDefault(require("../Parser/GpxParser"));
27
29
 
30
+ var _GTXParser = _interopRequireDefault(require("../Parser/GTXParser"));
31
+
32
+ var _ISGParser = _interopRequireDefault(require("../Parser/ISGParser"));
33
+
28
34
  var _VectorTileParser = _interopRequireDefault(require("../Parser/VectorTileParser"));
29
35
 
30
36
  var _Fetcher = _interopRequireDefault(require("../Provider/Fetcher"));
@@ -35,9 +41,9 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
35
41
 
36
42
  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; } }
37
43
 
38
- var supportedFetchers = new Map([['image/x-bil;bits=32', _Fetcher["default"].textureFloat], ['geojson', _Fetcher["default"].json], ['application/json', _Fetcher["default"].json], ['application/kml', _Fetcher["default"].xml], ['application/gpx', _Fetcher["default"].xml], ['application/x-protobuf;type=mapbox-vector', _Fetcher["default"].arrayBuffer]]);
44
+ var supportedFetchers = new Map([['image/x-bil;bits=32', _Fetcher["default"].textureFloat], ['geojson', _Fetcher["default"].json], ['application/json', _Fetcher["default"].json], ['application/kml', _Fetcher["default"].xml], ['application/gpx', _Fetcher["default"].xml], ['application/x-protobuf;type=mapbox-vector', _Fetcher["default"].arrayBuffer], ['application/gtx', _Fetcher["default"].arrayBuffer], ['application/isg', _Fetcher["default"].text], ['application/gdf', _Fetcher["default"].text]]);
39
45
  exports.supportedFetchers = supportedFetchers;
40
- var supportedParsers = new Map([['geojson', _GeoJsonParser["default"].parse], ['application/json', _GeoJsonParser["default"].parse], ['application/kml', _KMLParser["default"].parse], ['application/gpx', _GpxParser["default"].parse], ['application/x-protobuf;type=mapbox-vector', _VectorTileParser["default"].parse]]);
46
+ var supportedParsers = new Map([['geojson', _GeoJsonParser["default"].parse], ['application/json', _GeoJsonParser["default"].parse], ['application/kml', _KMLParser["default"].parse], ['application/gpx', _GpxParser["default"].parse], ['application/x-protobuf;type=mapbox-vector', _VectorTileParser["default"].parse], ['application/gtx', _GTXParser["default"].parse], ['application/isg', _ISGParser["default"].parse], ['application/gdf', _GDFParser["default"].parse]]);
41
47
  exports.supportedParsers = supportedParsers;
42
48
  var noCache = {
43
49
  getByArray: function getByArray() {},
@@ -57,7 +63,7 @@ var noCache = {
57
63
  *
58
64
  */
59
65
 
60
- var InformationsData = function InformationsData(options) {
66
+ var InformationsData = /*#__PURE__*/(0, _createClass2["default"])(function InformationsData(options) {
61
67
  (0, _classCallCheck2["default"])(this, InformationsData);
62
68
 
63
69
  /* istanbul ignore next */
@@ -67,7 +73,7 @@ var InformationsData = function InformationsData(options) {
67
73
  }
68
74
 
69
75
  this.crs = options.crs;
70
- };
76
+ });
71
77
  /**
72
78
  * This class describes parsing options.
73
79
  * @property {InformationsData|Source} in - data informations contained in the file.
@@ -75,12 +81,11 @@ var InformationsData = function InformationsData(options) {
75
81
  */
76
82
  // eslint-disable-next-line
77
83
 
78
-
79
84
  var
80
85
  /* istanbul ignore next */
81
- ParsingOptions = function ParsingOptions() {
86
+ ParsingOptions = /*#__PURE__*/(0, _createClass2["default"])(function ParsingOptions() {
82
87
  (0, _classCallCheck2["default"])(this, ParsingOptions);
83
- };
88
+ });
84
89
 
85
90
  function fetchSourceData(source, extent) {
86
91
  var url = source.urlFromExtent(extent);
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports["default"] = void 0;
9
9
 
10
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
+
10
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
13
 
12
14
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
@@ -102,7 +104,7 @@ var WMTSSource = /*#__PURE__*/function (_TMSSource) {
102
104
  return _this;
103
105
  }
104
106
 
105
- return WMTSSource;
107
+ return (0, _createClass2["default"])(WMTSSource);
106
108
  }(_TMSSource2["default"]);
107
109
 
108
110
  var _default = WMTSSource;
@@ -64,6 +64,10 @@ var GLTFLoader = /*#__PURE__*/function (_Loader) {
64
64
  return new GLTFTextureWebPExtension(parser);
65
65
  });
66
66
 
67
+ _this.register(function (parser) {
68
+ return new GLTFMaterialsSheenExtension(parser);
69
+ });
70
+
67
71
  _this.register(function (parser) {
68
72
  return new GLTFMaterialsTransmissionExtension(parser);
69
73
  });
@@ -270,6 +274,14 @@ var GLTFLoader = /*#__PURE__*/function (_Loader) {
270
274
  parser.setPlugins(plugins);
271
275
  parser.parse(onLoad, onError);
272
276
  }
277
+ }, {
278
+ key: "parseAsync",
279
+ value: function parseAsync(data, path) {
280
+ var scope = this;
281
+ return new Promise(function (resolve, reject) {
282
+ scope.parse(data, path, resolve, reject);
283
+ });
284
+ }
273
285
  }]);
274
286
  return GLTFLoader;
275
287
  }(_three.Loader);
@@ -309,6 +321,7 @@ var EXTENSIONS = {
309
321
  KHR_MATERIALS_CLEARCOAT: 'KHR_materials_clearcoat',
310
322
  KHR_MATERIALS_IOR: 'KHR_materials_ior',
311
323
  KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: 'KHR_materials_pbrSpecularGlossiness',
324
+ KHR_MATERIALS_SHEEN: 'KHR_materials_sheen',
312
325
  KHR_MATERIALS_SPECULAR: 'KHR_materials_specular',
313
326
  KHR_MATERIALS_TRANSMISSION: 'KHR_materials_transmission',
314
327
  KHR_MATERIALS_UNLIT: 'KHR_materials_unlit',
@@ -531,6 +544,65 @@ var GLTFMaterialsClearcoatExtension = /*#__PURE__*/function () {
531
544
  }]);
532
545
  return GLTFMaterialsClearcoatExtension;
533
546
  }();
547
+ /**
548
+ * Sheen Materials Extension
549
+ *
550
+ * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_sheen
551
+ */
552
+
553
+
554
+ var GLTFMaterialsSheenExtension = /*#__PURE__*/function () {
555
+ function GLTFMaterialsSheenExtension(parser) {
556
+ (0, _classCallCheck2["default"])(this, GLTFMaterialsSheenExtension);
557
+ this.parser = parser;
558
+ this.name = EXTENSIONS.KHR_MATERIALS_SHEEN;
559
+ }
560
+
561
+ (0, _createClass2["default"])(GLTFMaterialsSheenExtension, [{
562
+ key: "getMaterialType",
563
+ value: function getMaterialType(materialIndex) {
564
+ var parser = this.parser;
565
+ var materialDef = parser.json.materials[materialIndex];
566
+ if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
567
+ return _three.MeshPhysicalMaterial;
568
+ }
569
+ }, {
570
+ key: "extendMaterialParams",
571
+ value: function extendMaterialParams(materialIndex, materialParams) {
572
+ var parser = this.parser;
573
+ var materialDef = parser.json.materials[materialIndex];
574
+
575
+ if (!materialDef.extensions || !materialDef.extensions[this.name]) {
576
+ return Promise.resolve();
577
+ }
578
+
579
+ var pending = [];
580
+ materialParams.sheenColor = new _three.Color(0, 0, 0);
581
+ materialParams.sheenRoughness = 0;
582
+ materialParams.sheen = 1;
583
+ var extension = materialDef.extensions[this.name];
584
+
585
+ if (extension.sheenColorFactor !== undefined) {
586
+ materialParams.sheenColor.fromArray(extension.sheenColorFactor);
587
+ }
588
+
589
+ if (extension.sheenRoughnessFactor !== undefined) {
590
+ materialParams.sheenRoughness = extension.sheenRoughnessFactor;
591
+ }
592
+
593
+ if (extension.sheenColorTexture !== undefined) {
594
+ pending.push(parser.assignTexture(materialParams, 'sheenColorMap', extension.sheenColorTexture));
595
+ }
596
+
597
+ if (extension.sheenRoughnessTexture !== undefined) {
598
+ pending.push(parser.assignTexture(materialParams, 'sheenRoughnessMap', extension.sheenRoughnessTexture));
599
+ }
600
+
601
+ return Promise.all(pending);
602
+ }
603
+ }]);
604
+ return GLTFMaterialsSheenExtension;
605
+ }();
534
606
  /**
535
607
  * Transmission Materials Extension
536
608
  *
@@ -622,7 +694,7 @@ var GLTFMaterialsVolumeExtension = /*#__PURE__*/function () {
622
694
 
623
695
  materialParams.attenuationDistance = extension.attenuationDistance || 0;
624
696
  var colorArray = extension.attenuationColor || [1, 1, 1];
625
- materialParams.attenuationTint = new _three.Color(colorArray[0], colorArray[1], colorArray[2]);
697
+ materialParams.attenuationColor = new _three.Color(colorArray[0], colorArray[1], colorArray[2]);
626
698
  return Promise.all(pending);
627
699
  }
628
700
  }]);
@@ -708,10 +780,10 @@ var GLTFMaterialsSpecularExtension = /*#__PURE__*/function () {
708
780
  }
709
781
 
710
782
  var colorArray = extension.specularColorFactor || [1, 1, 1];
711
- materialParams.specularTint = new _three.Color(colorArray[0], colorArray[1], colorArray[2]);
783
+ materialParams.specularColor = new _three.Color(colorArray[0], colorArray[1], colorArray[2]);
712
784
 
713
785
  if (extension.specularColorTexture !== undefined) {
714
- pending.push(parser.assignTexture(materialParams, 'specularTintMap', extension.specularColorTexture).then(function (texture) {
786
+ pending.push(parser.assignTexture(materialParams, 'specularColorMap', extension.specularColorTexture).then(function (texture) {
715
787
  texture.encoding = _three.sRGBEncoding;
716
788
  }));
717
789
  }
@@ -892,8 +964,7 @@ var BINARY_EXTENSION_CHUNK_TYPES = {
892
964
  JSON: 0x4E4F534A,
893
965
  BIN: 0x004E4942
894
966
  };
895
-
896
- var GLTFBinaryExtension = function GLTFBinaryExtension(data) {
967
+ var GLTFBinaryExtension = /*#__PURE__*/(0, _createClass2["default"])(function GLTFBinaryExtension(data) {
897
968
  (0, _classCallCheck2["default"])(this, GLTFBinaryExtension);
898
969
  this.name = EXTENSIONS.KHR_BINARY_GLTF;
899
970
  this.content = null;
@@ -936,14 +1007,13 @@ var GLTFBinaryExtension = function GLTFBinaryExtension(data) {
936
1007
  if (this.content === null) {
937
1008
  throw new Error('THREE.GLTFLoader: JSON content not found.');
938
1009
  }
939
- };
1010
+ });
940
1011
  /**
941
1012
  * DRACO Mesh Compression Extension
942
1013
  *
943
1014
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression
944
1015
  */
945
1016
 
946
-
947
1017
  var GLTFDracoMeshCompressionExtension = /*#__PURE__*/function () {
948
1018
  function GLTFDracoMeshCompressionExtension(json, dracoLoader) {
949
1019
  (0, _classCallCheck2["default"])(this, GLTFDracoMeshCompressionExtension);
@@ -1265,10 +1335,10 @@ var GLTFMaterialsPbrSpecularGlossinessExtension = /*#__PURE__*/function () {
1265
1335
  */
1266
1336
 
1267
1337
 
1268
- var GLTFMeshQuantizationExtension = function GLTFMeshQuantizationExtension() {
1338
+ var GLTFMeshQuantizationExtension = /*#__PURE__*/(0, _createClass2["default"])(function GLTFMeshQuantizationExtension() {
1269
1339
  (0, _classCallCheck2["default"])(this, GLTFMeshQuantizationExtension);
1270
1340
  this.name = EXTENSIONS.KHR_MESH_QUANTIZATION;
1271
- };
1341
+ });
1272
1342
  /*********************************/
1273
1343
 
1274
1344
  /********** INTERPOLATION ********/
@@ -1277,7 +1347,6 @@ var GLTFMeshQuantizationExtension = function GLTFMeshQuantizationExtension() {
1277
1347
  // Spline Interpolation
1278
1348
  // Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#appendix-c-spline-interpolation
1279
1349
 
1280
-
1281
1350
  var GLTFCubicSplineInterpolant = /*#__PURE__*/function (_Interpolant) {
1282
1351
  (0, _inherits2["default"])(GLTFCubicSplineInterpolant, _Interpolant);
1283
1352
 
@@ -1454,30 +1523,10 @@ var ALPHA_MODES = {
1454
1523
  MASK: 'MASK',
1455
1524
  BLEND: 'BLEND'
1456
1525
  };
1457
- /* UTILITY FUNCTIONS */
1458
-
1459
- function resolveURL(url, path) {
1460
- // Invalid URL
1461
- if (typeof url !== 'string' || url === '') return ''; // Host Relative URL
1462
-
1463
- if (/^https?:\/\//i.test(path) && /^\//.test(url)) {
1464
- path = path.replace(/(^https?:\/\/[^\/]+).*/i, '$1');
1465
- } // Absolute URL http://,https://,//
1466
-
1467
-
1468
- if (/^(https?:)?\/\//i.test(url)) return url; // Data URI
1469
-
1470
- if (/^data:.*,.*$/i.test(url)) return url; // Blob URL
1471
-
1472
- if (/^blob:.*$/i.test(url)) return url; // Relative URL
1473
-
1474
- return path + url;
1475
- }
1476
1526
  /**
1477
1527
  * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#default-material
1478
1528
  */
1479
1529
 
1480
-
1481
1530
  function createDefaultMaterial(cache) {
1482
1531
  if (cache['DefaultMaterial'] === undefined) {
1483
1532
  cache['DefaultMaterial'] = new _three.MeshStandardMaterial({
@@ -1990,7 +2039,7 @@ var GLTFParser = /*#__PURE__*/function () {
1990
2039
 
1991
2040
  var options = this.options;
1992
2041
  return new Promise(function (resolve, reject) {
1993
- loader.load(resolveURL(bufferDef.uri, options.path), resolve, undefined, function () {
2042
+ loader.load(_three.LoaderUtils.resolveURL(bufferDef.uri, options.path), resolve, undefined, function () {
1994
2043
  reject(new Error('THREE.GLTFLoader: Failed to load buffer "' + bufferDef.uri + '".'));
1995
2044
  });
1996
2045
  });
@@ -2173,7 +2222,7 @@ var GLTFParser = /*#__PURE__*/function () {
2173
2222
  };
2174
2223
  }
2175
2224
 
2176
- loader.load(resolveURL(sourceURI, options.path), onLoad, undefined, reject);
2225
+ loader.load(_three.LoaderUtils.resolveURL(sourceURI, options.path), onLoad, undefined, reject);
2177
2226
  });
2178
2227
  }).then(function (texture) {
2179
2228
  // Clean up resources and configure Texture.
@@ -2322,7 +2371,9 @@ var GLTFParser = /*#__PURE__*/function () {
2322
2371
  }
2323
2372
  }, {
2324
2373
  key: "getMaterialType",
2325
- value: function getMaterialType() {
2374
+ value: function
2375
+ /* materialIndex */
2376
+ getMaterialType() {
2326
2377
  return _three.MeshStandardMaterial;
2327
2378
  }
2328
2379
  /**
@@ -2739,9 +2790,8 @@ var GLTFParser = /*#__PURE__*/function () {
2739
2790
  var targetNames = [];
2740
2791
 
2741
2792
  if (PATH_PROPERTIES[target.path] === PATH_PROPERTIES.weights) {
2742
- // Node may be a Group (glTF mesh with several primitives) or a Mesh.
2743
2793
  node.traverse(function (object) {
2744
- if (object.isMesh === true && object.morphTargetInfluences) {
2794
+ if (object.morphTargetInfluences) {
2745
2795
  targetNames.push(object.name ? object.name : object.uuid);
2746
2796
  }
2747
2797
  });
@@ -7,9 +7,9 @@ var _typeof = require("@babel/runtime/helpers/typeof");
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
+ exports["default"] = void 0;
10
11
  exports.getLookAtFromMath = getLookAtFromMath;
11
12
  exports.getRig = getRig;
12
- exports["default"] = void 0;
13
13
 
14
14
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
15
 
@@ -35,6 +35,8 @@ var _Ellipsoid = _interopRequireDefault(require("../Core/Math/Ellipsoid"));
35
35
 
36
36
  var _OBB = _interopRequireDefault(require("../Renderer/OBB"));
37
37
 
38
+ var _View = require("../Core/View");
39
+
38
40
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
39
41
 
40
42
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -173,6 +175,14 @@ var CameraRig = /*#__PURE__*/function (_THREE$Object3D) {
173
175
  } else {
174
176
  this.camera.matrixWorld.decompose(camera.position, camera.quaternion, camera.scale);
175
177
  }
178
+
179
+ view.dispatchEvent({
180
+ type: _View.VIEW_EVENTS.CAMERA_MOVED,
181
+ coord: this.coord,
182
+ range: this.range,
183
+ heading: this.heading,
184
+ tilt: this.tilt
185
+ });
176
186
  }
177
187
  }, {
178
188
  key: "setProxy",
@@ -7,8 +7,8 @@ var _typeof = require("@babel/runtime/helpers/typeof");
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports.readTextureValueWithBilinearFiltering = readTextureValueWithBilinearFiltering;
11
10
  exports["default"] = void 0;
11
+ exports.readTextureValueWithBilinearFiltering = readTextureValueWithBilinearFiltering;
12
12
 
13
13
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
14
14
 
@@ -81,20 +81,24 @@ function getClosestPoint(point, points, epsilon, offset, count, size) {
81
81
  return closestPoint;
82
82
  }
83
83
 
84
- function pointIsInsidePolygon(point, polygonPoints, offset, count, size) {
84
+ function pointIsInsidePolygon(point, polygonPoints, epsilon, offset, count, size) {
85
85
  // ray-casting algorithm based on
86
86
  // http://wrf.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
87
87
  var x = point.x;
88
88
  var y = point.y;
89
89
  var inside = false; // in first j is last point of polygon
90
90
  // for each segment of the polygon (j is i -1)
91
- // debugger;
92
91
 
93
92
  for (var i = offset, j = offset + count - size; i < offset + count; j = i, i += size) {
94
93
  var xi = polygonPoints[i];
95
94
  var yi = polygonPoints[i + 1];
96
95
  var xj = polygonPoints[j];
97
- var yj = polygonPoints[j + 1]; // isIntersect semi-infinite ray horizontally with polygon's edge
96
+ var yj = polygonPoints[j + 1];
97
+
98
+ if (pointIsOverLine(point, [xi, yi, xj, yj], epsilon, 0, 4, 2)) {
99
+ return true;
100
+ } // isIntersect semi-infinite ray horizontally with polygon's edge
101
+
98
102
 
99
103
  if (yi > y != yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) {
100
104
  inside = !inside;
@@ -107,7 +111,7 @@ function pointIsInsidePolygon(point, polygonPoints, offset, count, size) {
107
111
  function isFeatureSingleGeometryUnderCoordinate(coordinate, type, coordinates, epsilon, offset, count, size) {
108
112
  if (type == _Feature.FEATURE_TYPES.LINE && pointIsOverLine(coordinate, coordinates, epsilon, offset, count, size)) {
109
113
  return true;
110
- } else if (type == _Feature.FEATURE_TYPES.POLYGON && pointIsInsidePolygon(coordinate, coordinates, offset, count, size)) {
114
+ } else if (type == _Feature.FEATURE_TYPES.POLYGON && pointIsInsidePolygon(coordinate, coordinates, epsilon, offset, count, size)) {
111
115
  return true;
112
116
  } else if (type == _Feature.FEATURE_TYPES.POINT) {
113
117
  var closestPoint = getClosestPoint(coordinate, coordinates, epsilon, offset, count, size);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itowns",
3
- "version": "2.36.2",
3
+ "version": "2.37.0",
4
4
  "description": "A JS/WebGL framework for 3D geospatial data visualization",
5
5
  "main": "lib/Main.js",
6
6
  "scripts": {
@@ -47,8 +47,8 @@
47
47
  },
48
48
  "homepage": "https://itowns.github.io/",
49
49
  "dependencies": {
50
- "@loaders.gl/las": "^3.0.12",
51
- "@mapbox/mapbox-gl-style-spec": "^13.22.0",
50
+ "@loaders.gl/las": "^3.1.3",
51
+ "@mapbox/mapbox-gl-style-spec": "^13.23.0",
52
52
  "@mapbox/vector-tile": "^1.3.1",
53
53
  "@tmcw/togeojson": "^4.5.0",
54
54
  "@tweenjs/tween.js": "^18.6.4",
@@ -61,49 +61,49 @@
61
61
  },
62
62
  "peerDependencies": {
63
63
  "proj4": "^2.7.5",
64
- "three": "0.133.1"
64
+ "three": "0.135.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@babel/cli": "^7.15.7",
68
- "@babel/plugin-transform-runtime": "^7.15.8",
69
- "@babel/preset-env": "^7.15.8",
70
- "@babel/register": "^7.15.3",
67
+ "@babel/cli": "^7.16.0",
68
+ "@babel/plugin-transform-runtime": "^7.16.5",
69
+ "@babel/preset-env": "^7.16.5",
70
+ "@babel/register": "^7.16.5",
71
71
  "babel-inline-import-loader": "^1.0.1",
72
- "babel-loader": "^8.2.2",
72
+ "babel-loader": "^8.2.3",
73
73
  "babel-plugin-inline-import": "^3.0.0",
74
74
  "babel-plugin-minify-dead-code-elimination": "^0.5.1",
75
75
  "babel-plugin-minify-replace": "^0.5.0",
76
76
  "babel-plugin-module-resolver": "^4.1.0",
77
77
  "chalk": "^4.1.2",
78
- "chart.js": "^3.5.1",
78
+ "chart.js": "^3.6.2",
79
79
  "compare-func": "^2.0.0",
80
80
  "conventional-changelog-cli": "^2.1.1",
81
81
  "copyfiles": "^2.4.1",
82
- "core-js": "^3.18.3",
82
+ "core-js": "^3.20.0",
83
83
  "cross-env": "^7.0.3",
84
- "eslint": "^7.32.0",
85
- "eslint-config-airbnb-base": "^14.2.1",
86
- "eslint-import-resolver-webpack": "^0.13.1",
87
- "eslint-loader": "^4.0.2",
88
- "eslint-plugin-import": "^2.25.2",
84
+ "eslint": "^8.5.0",
85
+ "eslint-config-airbnb-base": "^15.0.0",
86
+ "eslint-import-resolver-webpack": "^0.13.2",
87
+ "eslint-plugin-import": "^2.25.3",
88
+ "eslint-webpack-plugin": "^3.1.1",
89
89
  "github-url-from-git": "^1.5.0",
90
90
  "grunt": "^1.4.1",
91
91
  "grunt-bump": "^0.8.0",
92
92
  "https-proxy-agent": "^5.0.0",
93
93
  "jsdoc": "^3.6.7",
94
- "marked": "^3.0.7",
95
- "mocha": "^9.1.2",
96
- "node-fetch": "^2.6.2",
94
+ "marked": "^4.0.8",
95
+ "mocha": "^9.1.3",
96
+ "node-fetch": "^2.6.6",
97
97
  "nyc": "^15.1.0",
98
98
  "proj4": "^2.7.5",
99
- "puppeteer": "^10.4.0",
99
+ "puppeteer": "^13.0.0",
100
100
  "q": "^1.5.1",
101
- "replace-in-file": "^6.2.0",
102
- "three": "0.133.1",
101
+ "replace-in-file": "^6.3.2",
102
+ "three": "0.135.0",
103
103
  "url-polyfill": "^1.1.12",
104
- "webpack": "^5.58.1",
105
- "webpack-cli": "^4.9.0",
106
- "webpack-dev-server": "^4.3.1",
104
+ "webpack": "^5.65.0",
105
+ "webpack-cli": "^4.9.1",
106
+ "webpack-dev-server": "^4.6.0",
107
107
  "whatwg-fetch": "^3.6.2"
108
108
  }
109
109
  }