itowns 2.44.3-next.21 → 2.44.3-next.23

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 (55) hide show
  1. package/dist/debug.js +1 -1
  2. package/dist/debug.js.map +1 -1
  3. package/dist/itowns.js +1 -1
  4. package/dist/itowns.js.map +1 -1
  5. package/examples/layers/JSONLayers/GeoidMNT.json +3 -1
  6. package/examples/source_file_geojson_3d.html +0 -1
  7. package/examples/source_stream_wfs_raster.html +0 -7
  8. package/lib/Converter/Feature2Mesh.js +1 -2
  9. package/lib/Converter/Feature2Texture.js +3 -1
  10. package/lib/Converter/convertToTile.js +3 -3
  11. package/lib/Converter/textureConverter.js +1 -2
  12. package/lib/Core/Feature.js +1 -2
  13. package/lib/Core/Geographic/Coordinates.js +1 -1
  14. package/lib/Core/Geographic/Crs.js +114 -144
  15. package/lib/Core/Geographic/Extent.js +2 -5
  16. package/lib/Core/Geographic/GeoidGrid.js +1 -1
  17. package/lib/Core/Prefab/Globe/Atmosphere.js +4 -2
  18. package/lib/Core/Prefab/Globe/GlobeLayer.js +21 -14
  19. package/lib/Core/Prefab/Globe/GlobeTileBuilder.js +111 -0
  20. package/lib/Core/Prefab/GlobeView.js +2 -3
  21. package/lib/Core/Prefab/Planar/PlanarLayer.js +16 -10
  22. package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +43 -43
  23. package/lib/Core/Prefab/TileBuilder.js +27 -32
  24. package/lib/Core/Prefab/computeBufferTileGeometry.js +189 -130
  25. package/lib/Core/Tile/Tile.js +4 -4
  26. package/lib/Core/Tile/TileGrid.js +7 -10
  27. package/lib/Core/TileGeometry.js +112 -28
  28. package/lib/Core/TileMesh.js +1 -2
  29. package/lib/Core/View.js +2 -2
  30. package/lib/Layer/C3DTilesLayer.js +7 -4
  31. package/lib/Layer/ColorLayer.js +35 -9
  32. package/lib/Layer/CopcLayer.js +5 -0
  33. package/lib/Layer/ElevationLayer.js +39 -7
  34. package/lib/Layer/EntwinePointTileLayer.js +12 -5
  35. package/lib/Layer/FeatureGeometryLayer.js +20 -6
  36. package/lib/Layer/GeometryLayer.js +42 -11
  37. package/lib/Layer/LabelLayer.js +11 -5
  38. package/lib/Layer/Layer.js +83 -57
  39. package/lib/Layer/OGC3DTilesLayer.js +3 -2
  40. package/lib/Layer/OrientedImageLayer.js +12 -4
  41. package/lib/Layer/PointCloudLayer.js +69 -23
  42. package/lib/Layer/Potree2Layer.js +7 -2
  43. package/lib/Layer/PotreeLayer.js +8 -3
  44. package/lib/Layer/RasterLayer.js +12 -2
  45. package/lib/Layer/TiledGeometryLayer.js +69 -13
  46. package/lib/Main.js +1 -1
  47. package/lib/Provider/Fetcher.js +5 -1
  48. package/lib/Renderer/OBB.js +11 -13
  49. package/lib/Renderer/RasterTile.js +1 -2
  50. package/lib/Source/FileSource.js +1 -2
  51. package/lib/Source/Source.js +1 -1
  52. package/lib/Source/TMSSource.js +2 -3
  53. package/lib/Source/WFSSource.js +1 -2
  54. package/package.json +3 -3
  55. package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +0 -110
@@ -1,3 +1,4 @@
1
+ import * as CRS from "../Core/Geographic/Crs.js";
1
2
  import Extent from "../Core/Geographic/Extent.js";
2
3
  import GeoJsonParser from "../Parser/GeoJsonParser.js";
3
4
  import KMLParser from "../Parser/KMLParser.js";
@@ -8,7 +9,6 @@ import ISGParser from "../Parser/ISGParser.js";
8
9
  import VectorTileParser from "../Parser/VectorTileParser.js";
9
10
  import Fetcher from "../Provider/Fetcher.js";
10
11
  import Cache from "../Core/Scheduler/Cache.js";
11
- import CRS from "../Core/Geographic/Crs.js";
12
12
 
13
13
  /** @private */
14
14
  export const supportedParsers = new Map([['application/geo+json', GeoJsonParser.parse], ['application/json', GeoJsonParser.parse], ['application/kml', KMLParser.parse], ['application/gpx', GpxParser.parse], ['application/x-protobuf;type=mapbox-vector', VectorTileParser.parse], ['application/gtx', GTXParser.parse], ['application/isg', ISGParser.parse], ['application/gdf', GDFParser.parse]]);
@@ -3,8 +3,7 @@ import URLBuilder from "../Provider/URLBuilder.js";
3
3
  import Extent from "../Core/Geographic/Extent.js";
4
4
  import Tile from "../Core/Tile/Tile.js";
5
5
  import { globalExtentTMS } from "../Core/Tile/TileGrid.js";
6
- import CRS from "../Core/Geographic/Crs.js";
7
- const _tile = new Tile(CRS.tms_4326, 0, 0, 0);
6
+ const _tile = new Tile('EPSG:4326', 0, 0, 0);
8
7
 
9
8
  /**
10
9
  * An object defining the source of resources to get from a
@@ -88,7 +87,7 @@ class TMSSource extends Source {
88
87
  }
89
88
  this.zoom = source.zoom;
90
89
  this.isInverted = source.isInverted || false;
91
- this.crs = CRS.formatToTms(source.crs);
90
+ this.crs = source.crs;
92
91
  this.tileMatrixSetLimits = source.tileMatrixSetLimits;
93
92
  this.extentSetlimits = {};
94
93
  this.tileMatrixCallback = source.tileMatrixCallback || (zoomLevel => zoomLevel);
@@ -1,6 +1,5 @@
1
1
  import Source from "./Source.js";
2
2
  import URLBuilder from "../Provider/URLBuilder.js";
3
- import CRS from "../Core/Geographic/Crs.js";
4
3
  import Extent from "../Core/Geographic/Extent.js";
5
4
  const _extent = new Extent('EPSG:4326', [0, 0, 0, 0]);
6
5
 
@@ -154,7 +153,7 @@ class WFSSource extends Source {
154
153
  return super.handlingError(err);
155
154
  }
156
155
  requestToKey(extent) {
157
- if (CRS.isTms(extent.crs)) {
156
+ if (extent.isTile) {
158
157
  return super.requestToKey(extent);
159
158
  } else {
160
159
  return [extent.zoom, extent.south, extent.west];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itowns",
3
- "version": "2.44.3-next.21",
3
+ "version": "2.44.3-next.23",
4
4
  "description": "A JS/WebGL framework for 3D geospatial data visualization",
5
5
  "type": "module",
6
6
  "main": "lib/Main.js",
@@ -21,13 +21,13 @@
21
21
  "base-test-unit": "cross-env BABEL_DISABLE_CACHE=1 mocha --file test/unit/bootstrap.js --import=./config/babel-register/register.mjs",
22
22
  "build": "cross-env NODE_ENV=production webpack",
23
23
  "build-dev": "cross-env NODE_ENV=development webpack",
24
- "transpile": "cross-env BABEL_DISABLE_CACHE=1 babel src --out-dir lib",
24
+ "transpile": "cross-env BABEL_DISABLE_CACHE=1 babel src --out-dir lib --extensions .js,.ts",
25
25
  "start": "cross-env NODE_ENV=development webpack serve",
26
26
  "start-https": "cross-env NODE_ENV=development webpack serve --https",
27
27
  "debug": "cross-env noInline=true npm start",
28
28
  "prepublishOnly": "npm run build && npm run transpile",
29
29
  "prepare": "cross-env NO_UPDATE_NOTIFIER=true node ./config/prepare.mjs && node ./config/replace.config.mjs",
30
- "watch": "cross-env BABEL_DISABLE_CACHE=1 babel --watch src --out-dir lib",
30
+ "watch": "npm run transpile -- --watch",
31
31
  "changelog": "conventional-changelog -n ./config/conventionalChangelog/config.cjs -i changelog.md -s",
32
32
  "bump": "if [ -z $npm_config_level ]; then grunt bump:minor; else grunt bump:$npm_config_level; fi && npm run changelog && npm install && git add -A && git commit --amend --no-edit",
33
33
  "publish-next": "npm version prerelease --preid next && npm publish --access public --tag=next --provenance",
@@ -1,110 +0,0 @@
1
- import * as THREE from 'three';
2
- import Coordinates from "../../Geographic/Coordinates.js";
3
- import Extent from "../../Geographic/Extent.js";
4
- const PI_OV_FOUR = Math.PI / 4;
5
- const INV_TWO_PI = 1.0 / (Math.PI * 2);
6
- const axisZ = new THREE.Vector3(0, 0, 1);
7
- const axisY = new THREE.Vector3(0, 1, 0);
8
- const quatToAlignLongitude = new THREE.Quaternion();
9
- const quatToAlignLatitude = new THREE.Quaternion();
10
- const quatNormalToZ = new THREE.Quaternion();
11
- function WGS84ToOneSubY(latitude) {
12
- return 1.0 - (0.5 - Math.log(Math.tan(PI_OV_FOUR + THREE.MathUtils.degToRad(latitude) * 0.5)) * INV_TWO_PI);
13
- }
14
- class BuilderEllipsoidTile {
15
- constructor() {
16
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17
- this.tmp = {
18
- coords: [new Coordinates('EPSG:4326', 0, 0), new Coordinates('EPSG:4326', 0, 0)],
19
- position: new THREE.Vector3(),
20
- dimension: new THREE.Vector2()
21
- };
22
- this.crs = options.crs;
23
- // Order crs projection on tiles
24
- this.uvCount = options.uvCount;
25
- this.computeUvs = [
26
- // Normalized coordinates (from degree) on the entire tile
27
- // EPSG:4326
28
- () => {},
29
- // Float row coordinate from Pseudo mercator coordinates
30
- // EPSG:3857
31
- params => {
32
- const t = WGS84ToOneSubY(params.projected.latitude) * params.nbRow;
33
- return (!isFinite(t) ? 0 : t) - params.deltaUV1;
34
- }];
35
- }
36
- // prepare params
37
- // init projected object -> params.projected
38
- prepare(params) {
39
- params.nbRow = 2 ** (params.level + 1.0);
40
- let st1 = WGS84ToOneSubY(params.extent.south);
41
- if (!isFinite(st1)) {
42
- st1 = 0;
43
- }
44
- const sizeTexture = 1.0 / params.nbRow;
45
- const start = st1 % sizeTexture;
46
- params.deltaUV1 = (st1 - start) * params.nbRow;
47
-
48
- // transformation to align tile's normal to z axis
49
- params.quatNormalToZ = quatNormalToZ.setFromAxisAngle(axisY, -(Math.PI * 0.5 - THREE.MathUtils.degToRad(params.extent.center().latitude)));
50
-
51
- // let's avoid building too much temp objects
52
- params.projected = {
53
- longitude: 0,
54
- latitude: 0
55
- };
56
- params.extent.planarDimensions(this.tmp.dimension);
57
- }
58
-
59
- // get center tile in cartesian 3D
60
- center(extent) {
61
- return extent.center(this.tmp.coords[0]).as(this.crs, this.tmp.coords[1]).toVector3();
62
- }
63
-
64
- // get position 3D cartesian
65
- vertexPosition(params) {
66
- this.tmp.coords[0].setFromValues(params.projected.longitude, params.projected.latitude);
67
- this.tmp.coords[0].as(this.crs, this.tmp.coords[1]).toVector3(this.tmp.position);
68
- return this.tmp.position;
69
- }
70
-
71
- // get normal for last vertex
72
- vertexNormal() {
73
- return this.tmp.coords[1].geodesicNormal;
74
- }
75
-
76
- // coord u tile to projected
77
- uProjecte(u, params) {
78
- params.projected.longitude = params.extent.west + u * this.tmp.dimension.x;
79
- }
80
-
81
- // coord v tile to projected
82
- vProjecte(v, params) {
83
- params.projected.latitude = params.extent.south + v * this.tmp.dimension.y;
84
- }
85
- computeSharableExtent(extent) {
86
- // Compute sharable extent to pool the geometries
87
- // the geometry in common extent is identical to the existing input
88
- // with a transformation (translation, rotation)
89
-
90
- // TODO: It should be possible to use equatorial plan symetrie,
91
- // but we should be reverse UV on tile
92
- // Common geometry is looking for only on longitude
93
- const sizeLongitude = Math.abs(extent.west - extent.east) / 2;
94
- const sharableExtent = new Extent(extent.crs, -sizeLongitude, sizeLongitude, extent.south, extent.north);
95
-
96
- // compute rotation to transform tile to position it on ellipsoid
97
- // this transformation take into account the transformation of the parents
98
- const rotLon = THREE.MathUtils.degToRad(extent.west - sharableExtent.west);
99
- const rotLat = THREE.MathUtils.degToRad(90 - extent.center(this.tmp.coords[0]).latitude);
100
- quatToAlignLongitude.setFromAxisAngle(axisZ, rotLon);
101
- quatToAlignLatitude.setFromAxisAngle(axisY, rotLat);
102
- quatToAlignLongitude.multiply(quatToAlignLatitude);
103
- return {
104
- sharableExtent,
105
- quaternion: quatToAlignLongitude.clone(),
106
- position: this.center(extent)
107
- };
108
- }
109
- }
110
- export default BuilderEllipsoidTile;