itowns 2.35.0 → 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 (110) hide show
  1. package/CONTRIBUTING.md +30 -17
  2. package/CONTRIBUTORS.md +1 -0
  3. package/changelog.md +146 -0
  4. package/dist/debug.js +1 -1
  5. package/dist/debug.js.LICENSE.txt +1 -1
  6. package/dist/debug.js.map +1 -1
  7. package/dist/itowns.js +1 -1
  8. package/dist/itowns.js.map +1 -1
  9. package/dist/itowns_widgets.js +2 -0
  10. package/dist/itowns_widgets.js.map +1 -0
  11. package/examples/3dtiles_basic.html +2 -2
  12. package/examples/config.json +25 -6
  13. package/examples/css/widgets.css +248 -0
  14. package/examples/geoid_geoidLayer.html +102 -0
  15. package/examples/images/compass.svg +60 -0
  16. package/examples/images/widget-logo.svg +66 -0
  17. package/examples/itowns-potree.html +252 -0
  18. package/examples/js/GUI/GuiTools.js +17 -0
  19. package/examples/js/Scale.js +1 -0
  20. package/examples/js/plugins/CSVnVRTParser.js +0 -1
  21. package/examples/layers/JSONLayers/Administrative.json +1 -1
  22. package/examples/layers/JSONLayers/Cada.json +1 -1
  23. package/examples/layers/JSONLayers/EtatMajor.json +1 -1
  24. package/examples/layers/JSONLayers/IGN_MNT.json +1 -1
  25. package/examples/layers/JSONLayers/IGN_MNT_HIGHRES.json +1 -1
  26. package/examples/layers/JSONLayers/WORLD_DTM.json +1 -1
  27. package/examples/misc_custom_label.html +0 -2
  28. package/examples/plugins_vrt.html +0 -1
  29. package/examples/source_file_from_fetched_data.html +90 -0
  30. package/examples/source_file_from_format.html +85 -0
  31. package/examples/source_file_from_methods.html +87 -0
  32. package/examples/source_file_from_parsed_data.html +104 -0
  33. package/examples/source_file_geojson_raster.html +21 -48
  34. package/examples/source_file_gpx_raster.html +28 -36
  35. package/examples/source_file_kml_raster.html +1 -4
  36. package/examples/source_file_shapefile.html +39 -35
  37. package/examples/source_stream_wfs_25d.html +29 -29
  38. package/examples/source_stream_wfs_3d.html +21 -12
  39. package/examples/source_stream_wfs_raster.html +20 -20
  40. package/examples/view_25d_map.html +28 -0
  41. package/examples/view_immersive.html +13 -14
  42. package/examples/view_multi_25d.html +1 -1
  43. package/examples/widgets_minimap.html +122 -0
  44. package/examples/widgets_navigation.html +119 -0
  45. package/lib/Controls/FirstPersonControls.js +10 -1
  46. package/lib/Controls/GlobeControls.js +26 -11
  47. package/lib/Controls/PlanarControls.js +1 -1
  48. package/lib/Converter/Feature2Mesh.js +1 -0
  49. package/lib/Converter/Feature2Texture.js +2 -2
  50. package/lib/Converter/convertToTile.js +6 -2
  51. package/lib/Core/3DTiles/C3DTBoundingVolume.js +4 -1
  52. package/lib/Core/Deprecated/Undeprecator.js +1 -1
  53. package/lib/Core/Feature.js +42 -42
  54. package/lib/Core/Geographic/Coordinates.js +56 -0
  55. package/lib/Core/Geographic/Crs.js +15 -0
  56. package/lib/Core/Geographic/Extent.js +100 -12
  57. package/lib/Core/Geographic/GeoidGrid.js +143 -0
  58. package/lib/Core/MainLoop.js +1 -1
  59. package/lib/Core/Math/Ellipsoid.js +27 -9
  60. package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +1 -1
  61. package/lib/Core/Prefab/Globe/SkyShader.js +3 -1
  62. package/lib/Core/Prefab/Planar/PlanarLayer.js +3 -1
  63. package/lib/Core/Prefab/PlanarView.js +1 -1
  64. package/lib/Core/Style.js +2 -1
  65. package/lib/Core/TileGeometry.js +3 -1
  66. package/lib/Core/TileMesh.js +11 -16
  67. package/lib/Core/View.js +43 -5
  68. package/lib/Layer/ElevationLayer.js +15 -18
  69. package/lib/Layer/FeatureGeometryLayer.js +3 -1
  70. package/lib/Layer/GeoidLayer.js +131 -0
  71. package/lib/Layer/InfoLayer.js +1 -1
  72. package/lib/Layer/LabelLayer.js +7 -1
  73. package/lib/Layer/Layer.js +1 -1
  74. package/lib/Layer/LayerUpdateStrategy.js +1 -1
  75. package/lib/Layer/PotreeLayer.js +3 -1
  76. package/lib/Layer/TiledGeometryLayer.js +3 -1
  77. package/lib/Main.js +214 -174
  78. package/lib/MainBundle.js +1 -1
  79. package/lib/Parser/B3dmParser.js +2 -1
  80. package/lib/Parser/GDFParser.js +118 -0
  81. package/lib/Parser/GTXParser.js +92 -0
  82. package/lib/Parser/ISGParser.js +121 -0
  83. package/lib/Parser/LASParser.js +3 -1
  84. package/lib/Parser/ShapefileParser.js +0 -1
  85. package/lib/Parser/VectorTileParser.js +1 -1
  86. package/lib/Parser/XbilParser.js +1 -1
  87. package/lib/Process/3dTilesProcessing.js +10 -10
  88. package/lib/Process/FeatureProcessing.js +3 -1
  89. package/lib/Process/LayeredMaterialNodeProcessing.js +7 -4
  90. package/lib/Process/ObjectRemovalHelper.js +5 -2
  91. package/lib/Provider/URLBuilder.js +1 -1
  92. package/lib/Renderer/Label2DRenderer.js +14 -11
  93. package/lib/Renderer/LayeredMaterial.js +4 -3
  94. package/lib/Renderer/OBB.js +20 -27
  95. package/lib/Renderer/PointsMaterial.js +5 -6
  96. package/lib/Renderer/RasterTile.js +23 -5
  97. package/lib/Renderer/Shader/ShaderChunk.js +3 -3
  98. package/lib/Renderer/Shader/ShaderUtils.js +4 -2
  99. package/lib/Source/C3DTilesSource.js +3 -1
  100. package/lib/Source/EntwinePointTileSource.js +3 -1
  101. package/lib/Source/FileSource.js +2 -7
  102. package/lib/Source/PotreeSource.js +3 -1
  103. package/lib/Source/Source.js +15 -10
  104. package/lib/Source/VectorTilesSource.js +19 -0
  105. package/lib/Source/WMTSSource.js +3 -1
  106. package/lib/ThreeExtended/loaders/GLTFLoader.js +239 -98
  107. package/lib/Utils/CameraUtils.js +12 -2
  108. package/lib/Utils/DEMUtils.js +3 -3
  109. package/lib/Utils/FeaturesUtils.js +8 -4
  110. package/package.json +25 -25
@@ -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",
@@ -577,7 +587,7 @@ var _default = {
577
587
  };
578
588
  } else {
579
589
  extent = extent.as(view.referenceCrs);
580
- dimensions = extent.dimensions();
590
+ dimensions = extent.planarDimensions();
581
591
  }
582
592
 
583
593
  extent.center(cameraTransformOptions.coord);
@@ -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
 
@@ -345,7 +345,7 @@ function offsetInExtent(point, extent) {
345
345
  throw new Error("Unsupported mix: ".concat(point.crs, " and ").concat(extent.crs));
346
346
  }
347
347
 
348
- extent.dimensions(dimension);
348
+ extent.planarDimensions(dimension);
349
349
  var originX = (point.x - extent.west) / dimension.x;
350
350
  var originY = (extent.north - point.y) / dimension.y;
351
351
  return target.set(originX, originY);
@@ -402,7 +402,7 @@ function _readZ(layer, method, coord, nodes, cache) {
402
402
  // - the correct one: emulate the vertex shader code
403
403
 
404
404
  if (method == PRECISE_READ_Z) {
405
- pt.z = _readZCorrect(layer, src, temp.offset, tile.extent.dimensions(), tileWithValidElevationTexture.extent.dimensions());
405
+ pt.z = _readZCorrect(layer, src, temp.offset, tile.extent.planarDimensions(), tileWithValidElevationTexture.extent.planarDimensions());
406
406
  } else {
407
407
  pt.z = _readZFast(layer, src, temp.offset);
408
408
  }
@@ -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.35.0",
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.9",
51
- "@mapbox/mapbox-gl-style-spec": "^13.21.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.131.3"
64
+ "three": "0.135.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@babel/cli": "^7.14.8",
68
- "@babel/plugin-transform-runtime": "^7.15.0",
69
- "@babel/preset-env": "^7.15.0",
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.16.2",
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.24.1",
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.0",
95
- "mocha": "^9.1.0",
96
- "node-fetch": "^2.6.1",
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.2.0",
99
+ "puppeteer": "^13.0.0",
100
100
  "q": "^1.5.1",
101
- "replace-in-file": "^6.2.0",
102
- "three": "0.131.3",
101
+ "replace-in-file": "^6.3.2",
102
+ "three": "0.135.0",
103
103
  "url-polyfill": "^1.1.12",
104
- "webpack": "^5.51.1",
105
- "webpack-cli": "^4.8.0",
106
- "webpack-dev-server": "^4.0.0",
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
  }