itowns 2.44.3-next.3 → 2.44.3-next.30

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 (92) hide show
  1. package/CODING.md +1 -1
  2. package/CONTRIBUTORS.md +1 -0
  3. package/dist/debug.js +1 -1
  4. package/dist/debug.js.map +1 -1
  5. package/dist/itowns.js +1 -1
  6. package/dist/itowns.js.LICENSE.txt +0 -2
  7. package/dist/itowns.js.map +1 -1
  8. package/dist/itowns_widgets.js +1 -1
  9. package/dist/itowns_widgets.js.map +1 -1
  10. package/examples/3dtiles_loader.html +109 -45
  11. package/examples/config.json +2 -10
  12. package/examples/entwine_3d_loader.html +3 -1
  13. package/examples/entwine_simple_loader.html +1 -1
  14. package/examples/images/itowns_logo.svg +123 -0
  15. package/examples/js/plugins/COGParser.js +1 -1
  16. package/examples/jsm/OGC3DTilesHelper.js +1 -1
  17. package/examples/layers/JSONLayers/GeoidMNT.json +3 -1
  18. package/examples/source_file_geojson_3d.html +0 -1
  19. package/examples/source_stream_wfs_raster.html +0 -7
  20. package/lib/Controls/GlobeControls.js +45 -28
  21. package/lib/Controls/StateControl.js +5 -2
  22. package/lib/Converter/Feature2Mesh.js +10 -4
  23. package/lib/Converter/Feature2Texture.js +3 -1
  24. package/lib/Converter/convertToTile.js +3 -8
  25. package/lib/Converter/textureConverter.js +3 -4
  26. package/lib/Core/Deprecated/Undeprecator.js +0 -1
  27. package/lib/Core/Feature.js +1 -2
  28. package/lib/Core/Geographic/Coordinates.js +143 -132
  29. package/lib/Core/Geographic/Crs.js +140 -145
  30. package/lib/Core/Geographic/Extent.js +72 -267
  31. package/lib/Core/Geographic/GeoidGrid.js +1 -1
  32. package/lib/Core/Math/Ellipsoid.js +62 -21
  33. package/lib/Core/Prefab/Globe/Atmosphere.js +4 -8
  34. package/lib/Core/Prefab/Globe/GlobeLayer.js +22 -15
  35. package/lib/Core/Prefab/Globe/GlobeTileBuilder.js +111 -0
  36. package/lib/Core/Prefab/GlobeView.js +2 -7
  37. package/lib/Core/Prefab/Planar/PlanarLayer.js +17 -11
  38. package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +43 -43
  39. package/lib/Core/Prefab/TileBuilder.js +27 -32
  40. package/lib/Core/Prefab/computeBufferTileGeometry.js +189 -130
  41. package/lib/Core/Style.js +3 -3
  42. package/lib/Core/Tile/Tile.js +219 -0
  43. package/lib/Core/Tile/TileGrid.js +43 -0
  44. package/lib/Core/TileGeometry.js +112 -28
  45. package/lib/Core/TileMesh.js +3 -3
  46. package/lib/Core/View.js +15 -8
  47. package/lib/Layer/C3DTilesLayer.js +20 -16
  48. package/lib/Layer/ColorLayer.js +35 -9
  49. package/lib/Layer/CopcLayer.js +5 -0
  50. package/lib/Layer/ElevationLayer.js +39 -7
  51. package/lib/Layer/EntwinePointTileLayer.js +12 -5
  52. package/lib/Layer/FeatureGeometryLayer.js +20 -6
  53. package/lib/Layer/GeometryLayer.js +42 -11
  54. package/lib/Layer/LabelLayer.js +19 -9
  55. package/lib/Layer/Layer.js +83 -57
  56. package/lib/Layer/OGC3DTilesLayer.js +81 -30
  57. package/lib/Layer/OrientedImageLayer.js +11 -5
  58. package/lib/Layer/PointCloudLayer.js +74 -30
  59. package/lib/Layer/Potree2Layer.js +7 -2
  60. package/lib/Layer/PotreeLayer.js +8 -3
  61. package/lib/Layer/RasterLayer.js +12 -2
  62. package/lib/Layer/TiledGeometryLayer.js +69 -13
  63. package/lib/Main.js +2 -2
  64. package/lib/Parser/GeoJsonParser.js +1 -1
  65. package/lib/Parser/VectorTileParser.js +1 -1
  66. package/lib/Parser/XbilParser.js +14 -2
  67. package/lib/Provider/Fetcher.js +5 -1
  68. package/lib/Provider/URLBuilder.js +22 -11
  69. package/lib/Renderer/Camera.js +1 -1
  70. package/lib/Renderer/OBB.js +11 -13
  71. package/lib/Renderer/PointsMaterial.js +1 -1
  72. package/lib/Renderer/RasterTile.js +1 -2
  73. package/lib/Renderer/SphereHelper.js +0 -6
  74. package/lib/Source/CopcSource.js +13 -2
  75. package/lib/Source/EntwinePointTileSource.js +14 -4
  76. package/lib/Source/FileSource.js +1 -4
  77. package/lib/Source/Source.js +1 -4
  78. package/lib/Source/TMSSource.js +10 -9
  79. package/lib/Source/VectorTilesSource.js +3 -5
  80. package/lib/Source/WFSSource.js +15 -10
  81. package/lib/Source/WMSSource.js +56 -18
  82. package/lib/Source/WMTSSource.js +13 -7
  83. package/lib/Utils/CameraUtils.js +1 -1
  84. package/lib/Utils/gui/C3DTilesStyle.js +2 -3
  85. package/lib/Utils/placeObjectOnGround.js +0 -1
  86. package/package.json +13 -6
  87. package/examples/3dtiles_25d.html +0 -120
  88. package/examples/3dtiles_basic.html +0 -94
  89. package/examples/3dtiles_batch_table.html +0 -86
  90. package/examples/3dtiles_ion.html +0 -126
  91. package/examples/3dtiles_pointcloud.html +0 -95
  92. package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +0 -110
@@ -1,5 +1,36 @@
1
1
  import Source from "./Source.js";
2
2
  import URLBuilder from "../Provider/URLBuilder.js";
3
+ import Extent from "../Core/Geographic/Extent.js";
4
+ import * as CRS from "../Core/Geographic/Crs.js";
5
+ const _extent = new Extent('EPSG:4326', [0, 0, 0, 0]);
6
+
7
+ /**
8
+ * Proj provides an optional param to define axis order and orientation for a
9
+ * given projection. 'enu' for instance stands for east, north, up.
10
+ * Elevation is not needed here. The two first characters are sufficient to map
11
+ * proj axis to iTowns bbox order formalism.
12
+ * 'enu' corresponds to 'wsen' because bbox starts by lower value coordinates
13
+ * and preserves axis ordering, here long/lat.
14
+ */
15
+ const projAxisToBboxMappings = {
16
+ en: 'wsen',
17
+ es: 'wnes',
18
+ wn: 'eswn',
19
+ ws: 'enws',
20
+ ne: 'swne',
21
+ se: 'nwse',
22
+ nw: 'senw',
23
+ sw: 'nesw'
24
+ };
25
+
26
+ /**
27
+ * Provides the bbox axis order matching provided proj4 axis
28
+ * @param {string} projAxis the CRS axis order as defined in proj4
29
+ * @returns {string} the corresponding bbox axis order to use for WMS 1.3.0
30
+ */
31
+ function projAxisToWmsBbox(projAxis) {
32
+ return projAxis && projAxisToBboxMappings[projAxis.slice(0, 2)] || 'wsen';
33
+ }
3
34
 
4
35
  /**
5
36
  * An object defining the source of images to get from a
@@ -95,32 +126,39 @@ class WMSSource extends Source {
95
126
  this.version = source.version || '1.3.0';
96
127
  this.transparent = source.transparent || false;
97
128
  this.bboxDigits = source.bboxDigits;
98
- if (!source.axisOrder) {
99
- // 4326 (lat/long) axis order depends on the WMS version used
100
- if (this.crs == 'EPSG:4326') {
101
- // EPSG 4326 x = lat, long = y
102
- // version 1.1.0 long/lat while version 1.3.0 mandates xy (so lat,long)
103
- this.axisOrder = this.version === '1.1.0' ? 'wsen' : 'swne';
104
- } else {
105
- // xy,xy order
106
- this.axisOrder = 'wsen';
107
- }
129
+ if (source.axisOrder) {
130
+ this.axisOrder = source.axisOrder;
131
+ } else if (this.version === '1.3.0') {
132
+ // If not set, axis order depends on WMS version
133
+ // Version 1.3.0 depends on CRS axis order as defined in epsg.org database
134
+ this.axisOrder = projAxisToWmsBbox(CRS.axisOrder(this.crs));
135
+ } else {
136
+ // Versions 1.X.X mandate long/lat order, east-north orientation
137
+ this.axisOrder = 'wsen';
108
138
  }
109
139
  const crsPropName = this.version === '1.3.0' ? 'CRS' : 'SRS';
110
-
111
- // Add ? at the end of the url if it is not already in the given URL
112
- if (!this.url.endsWith('?')) {
113
- this.url = `${this.url}?`;
114
- }
115
- this.url = `${this.url}SERVICE=WMS&REQUEST=GetMap&LAYERS=${this.name}&VERSION=${this.version}&STYLES=${this.style}&FORMAT=${this.format}&TRANSPARENT=${this.transparent}&BBOX=%bbox&${crsPropName}=${this.crs}&WIDTH=${this.width}&HEIGHT=${this.height}`;
140
+ const urlObj = new URL(this.url);
141
+ urlObj.searchParams.set('SERVICE', 'WMS');
142
+ urlObj.searchParams.set('REQUEST', 'GetMap');
143
+ urlObj.searchParams.set('LAYERS', this.name);
144
+ urlObj.searchParams.set('VERSION', this.version);
145
+ urlObj.searchParams.set('STYLES', this.style);
146
+ urlObj.searchParams.set('FORMAT', this.format);
147
+ urlObj.searchParams.set('TRANSPARENT', this.transparent);
148
+ urlObj.searchParams.set('BBOX', '%bbox');
149
+ urlObj.searchParams.set(crsPropName, this.crs);
150
+ urlObj.searchParams.set('WIDTH', this.width);
151
+ urlObj.searchParams.set('HEIGHT', this.height);
116
152
  this.vendorSpecific = source.vendorSpecific;
117
153
  for (const name in this.vendorSpecific) {
118
154
  if (Object.prototype.hasOwnProperty.call(this.vendorSpecific, name)) {
119
- this.url = `${this.url}&${name}=${this.vendorSpecific[name]}`;
155
+ urlObj.searchParams.set(name, this.vendorSpecific[name]);
120
156
  }
121
157
  }
158
+ this.url = decodeURIComponent(urlObj.toString());
122
159
  }
123
- urlFromExtent(extent) {
160
+ urlFromExtent(extentOrTile) {
161
+ const extent = extentOrTile.isExtent ? extentOrTile.as(this.crs, _extent) : extentOrTile.toExtent(this.crs, _extent);
124
162
  return URLBuilder.bbox(extent, this);
125
163
  }
126
164
  extentInsideLimit(extent) {
@@ -69,18 +69,24 @@ class WMTSSource extends TMSSource {
69
69
  }
70
70
  super(source);
71
71
  this.isWMTSSource = true;
72
-
73
- // Add ? at the end of the url if it is not already in the given URL
74
- if (!this.url.endsWith('?')) {
75
- this.url = `${this.url}?`;
76
- }
77
- this.url = `${this.url}` + `LAYER=${source.name}` + `&FORMAT=${this.format}` + '&SERVICE=WMTS' + `&VERSION=${source.version || '1.0.0'}` + '&REQUEST=GetTile' + `&STYLE=${source.style || 'normal'}` + `&TILEMATRIXSET=${source.tileMatrixSet}` + '&TILEMATRIX=%TILEMATRIX&TILEROW=%ROW&TILECOL=%COL';
72
+ const urlObj = new URL(this.url);
73
+ urlObj.searchParams.set('LAYER', source.name);
74
+ urlObj.searchParams.set('FORMAT', this.format);
75
+ urlObj.searchParams.set('SERVICE', 'WMTS');
76
+ urlObj.searchParams.set('VERSION', source.version || '1.0.0');
77
+ urlObj.searchParams.set('REQUEST', 'GetTile');
78
+ urlObj.searchParams.set('STYLE', source.style || 'normal');
79
+ urlObj.searchParams.set('TILEMATRIXSET', source.tileMatrixSet);
80
+ urlObj.searchParams.set('TILEMATRIX', '%TILEMATRIX');
81
+ urlObj.searchParams.set('TILEROW', '%ROW');
82
+ urlObj.searchParams.set('TILECOL', '%COL');
78
83
  this.vendorSpecific = source.vendorSpecific;
79
84
  for (const name in this.vendorSpecific) {
80
85
  if (Object.prototype.hasOwnProperty.call(this.vendorSpecific, name)) {
81
- this.url = `${this.url}&${name}=${this.vendorSpecific[name]}`;
86
+ urlObj.searchParams.set(name, this.vendorSpecific[name]);
82
87
  }
83
88
  }
89
+ this.url = decodeURIComponent(urlObj.toString());
84
90
  }
85
91
  }
86
92
  export default WMTSSource;
@@ -156,7 +156,7 @@ class CameraRig extends THREE.Object3D {
156
156
 
157
157
  // set rig's objects transformation from camera's position and target's position
158
158
  setFromPositions(view, cameraPosition) {
159
- this.setTargetFromCoordinate(view, new Coordinates(view.referenceCrs, targetPosition));
159
+ this.setTargetFromCoordinate(view, new Coordinates(view.referenceCrs).setFromVector3(targetPosition));
160
160
  this.target.rotation.set(0, 0, 0);
161
161
  this.updateMatrixWorld(true);
162
162
  this.camera.position.copy(cameraPosition);
@@ -1,4 +1,3 @@
1
- import Style from "../../Core/Style.js";
2
1
  import { C3DTILES_LAYER_EVENTS } from "../../Layer/C3DTilesLayer.js";
3
2
  import Widget from "./Widget.js";
4
3
  const DEFAULT_OPTIONS = {
@@ -187,7 +186,7 @@ class C3DTilesStyle extends Widget {
187
186
  }
188
187
 
189
188
  // set style
190
- c3DTilesLayer.style = new Style({
189
+ c3DTilesLayer.style = {
191
190
  fill: {
192
191
  color: c3DTileFeature => {
193
192
  let result = null;
@@ -204,7 +203,7 @@ class C3DTilesStyle extends Widget {
204
203
  return result;
205
204
  }
206
205
  }
207
- });
206
+ };
208
207
  });
209
208
  });
210
209
  updateSelectedLayer();
@@ -55,7 +55,6 @@ function _updateVector3(layer, method, nodes, vecCRS, vec, offset) {
55
55
  *
56
56
  * @return {boolean} true if successful, false if we couldn't lookup the elevation at the given coords
57
57
  */
58
- /* istanbul ignore next */
59
58
  function placeObjectOnGround(layer, crs, obj) {
60
59
  let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
61
60
  let tileHint = arguments.length > 4 ? arguments[4] : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itowns",
3
- "version": "2.44.3-next.3",
3
+ "version": "2.44.3-next.30",
4
4
  "description": "A JS/WebGL framework for 3D geospatial data visualization",
5
5
  "type": "module",
6
6
  "main": "lib/Main.js",
@@ -9,7 +9,7 @@
9
9
  "./widgets": "./lib/Utils/gui/Main.js"
10
10
  },
11
11
  "scripts": {
12
- "lint": "eslint \"src/**/*.js\" \"test/**/*.js\" \"examples/**/*.js\" \"docs/*.js\"",
12
+ "lint": "eslint \"src/**/*.{js,ts,tsx}\" \"test/**/*.js\" \"examples/**/*.js\" \"docs/*.js\"",
13
13
  "doc": "jsdoc --readme docs/HOMEPAGE.md -c docs/config.json",
14
14
  "doclint": "npm run doc -- -t templates/silent",
15
15
  "test": "npm run lint -- --max-warnings=0 && npm run build && npm run test-with-coverage && npm run test-functional",
@@ -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",
@@ -57,11 +57,11 @@
57
57
  },
58
58
  "homepage": "https://itowns.github.io/",
59
59
  "dependencies": {
60
- "@mapbox/mapbox-gl-style-spec": "^13.28.0",
61
60
  "@mapbox/vector-tile": "^2.0.3",
61
+ "@maplibre/maplibre-gl-style-spec": "^22.0.0",
62
62
  "@tmcw/togeojson": "^5.8.1",
63
63
  "@tweenjs/tween.js": "^25.0.0",
64
- "3d-tiles-renderer": "^0.3.38",
64
+ "3d-tiles-renderer": "^0.3.39",
65
65
  "brotli-compress": "^1.3.3",
66
66
  "copc": "^0.0.6",
67
67
  "earcut": "^3.0.0",
@@ -79,8 +79,13 @@
79
79
  "@babel/core": "^7.25.2",
80
80
  "@babel/plugin-transform-runtime": "^7.25.4",
81
81
  "@babel/preset-env": "^7.25.4",
82
+ "@babel/preset-typescript": "^7.24.7",
82
83
  "@babel/register": "^7.24.6",
84
+ "@stylistic/eslint-plugin": "^2.8.0",
85
+ "@types/proj4": "^2.5.5",
83
86
  "@types/three": "^0.168.0",
87
+ "@typescript-eslint/eslint-plugin": "^8.5.0",
88
+ "@typescript-eslint/parser": "^8.5.0",
84
89
  "@xmldom/xmldom": "^0.9.2",
85
90
  "babel-inline-import-loader": "^1.0.1",
86
91
  "babel-loader": "^9.2.1",
@@ -101,6 +106,7 @@
101
106
  "eslint-config-airbnb-base": "^15.0.0",
102
107
  "eslint-import-resolver-babel-module": "^5.3.2",
103
108
  "eslint-plugin-import": "^2.30.0",
109
+ "eslint-plugin-tsdoc": "^0.3.0",
104
110
  "eslint-webpack-plugin": "^4.2.0",
105
111
  "github-url-from-git": "^1.5.0",
106
112
  "grunt": "^1.6.1",
@@ -115,6 +121,7 @@
115
121
  "sinon": "^19.0.2",
116
122
  "three": "^0.168.0",
117
123
  "typescript": "^5.6.2",
124
+ "undici": "^7.2.0",
118
125
  "webgl-mock": "^0.1.7",
119
126
  "webpack": "^5.94.0",
120
127
  "webpack-cli": "^5.1.4",
@@ -1,120 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Itowns - 3D Tiles on 2.5D map example</title>
4
-
5
- <meta charset="UTF-8">
6
- <link rel="stylesheet" type="text/css" href="css/example.css">
7
- <link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">
8
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
9
- <script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
10
- </head>
11
- <body>
12
- <div id="viewerDiv" class="viewer"></div>
13
- <script src="../dist/itowns.js"></script>
14
- <script src="js/GUI/LoadingScreen.js"></script>
15
- <script src="../dist/debug.js"></script>
16
- <script src="js/GUI/GuiTools.js"></script>
17
- <script src="js/3dTilesHelper.js"></script>
18
- <script type="text/javascript">
19
- // Define crs projection that we will use (taken from https://epsg.io/3946, Proj4js section)
20
- itowns.proj4.defs('EPSG:3946', '+proj=lcc +lat_1=45.25 +lat_2=46.75 +lat_0=46 +lon_0=3 +x_0=1700000 +y_0=5200000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs');
21
-
22
- // Define geographic extent: CRS, min/max X, min/max Y
23
- var extent = new itowns.Extent( 'EPSG:3946',
24
- 1837816.94334, 1847692.32501,
25
- 5170036.4587, 5178412.82698);
26
-
27
- // `viewerDiv` will contain iTowns' rendering area (`<canvas>`)
28
- var viewerDiv = document.getElementById('viewerDiv');
29
-
30
- // Instanciate PlanarView*
31
- var cameraCoord = new itowns.Coordinates('EPSG:3946', 1841980,
32
- 5175682, 3000)
33
- var view = new itowns.PlanarView(viewerDiv, extent, { placement: {
34
- coord: cameraCoord, heading: 30, range: 4000, tilt: 30 } });
35
-
36
- setupLoadingScreen(viewerDiv, view);
37
-
38
- // Add a WMS imagery source
39
- var wmsImagerySource = new itowns.WMSSource({
40
- extent: extent,
41
- name: 'ortho_latest',
42
- url: 'https://imagerie.data.grandlyon.com/wms/grandlyon',
43
- version: '1.3.0',
44
- crs: 'EPSG:3946',
45
- format: 'image/jpeg',
46
- });
47
-
48
- // Add a WMS imagery layer
49
- var wmsImageryLayer = new itowns.ColorLayer('wms_imagery', {
50
- updateStrategy: {
51
- type: itowns.STRATEGY_DICHOTOMY,
52
- options: {},
53
- },
54
- source: wmsImagerySource,
55
- });
56
-
57
- view.addLayer(wmsImageryLayer);
58
-
59
- // Add a WMS elevation source
60
- var wmsElevationSource = new itowns.WMSSource({
61
- extent: extent,
62
- url: 'https://imagerie.data.grandlyon.com/wms/grandlyon',
63
- name: 'MNT2018_Altitude_2m',
64
- crs: 'EPSG:3946',
65
- width: 256,
66
- format: 'image/jpeg',
67
- });
68
-
69
- // Add a WMS elevation layer
70
- var wmsElevationLayer = new itowns.ElevationLayer('wms_elevation', {
71
- useColorTextureElevation: true,
72
- colorTextureElevationMinZ: 144,
73
- colorTextureElevationMaxZ: 622,
74
- source: wmsElevationSource,
75
- });
76
-
77
- view.addLayer(wmsElevationLayer);
78
-
79
- // Add 3D Tiles layer
80
- // This 3D Tiles tileset uses the draco compression that is an
81
- // extension of gltf. We need to enable it.
82
- itowns.enableDracoLoader('./libs/draco/');
83
-
84
- var $3dTilesLayer = new itowns.C3DTilesLayer(
85
- '3d-tiles-layer-building', {
86
- name: 'Lyon-2015-building',
87
- source: new itowns.C3DTilesSource({
88
- url: 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/' +
89
- '3DTiles/lyon_1_3946_textured_draco/tileset.json',
90
- }),
91
- }, view);
92
-
93
- // Lights
94
- var dirLight = new itowns.THREE.DirectionalLight(0xffffff, 1);
95
- dirLight.position.set(-0.9, 0.3, 1);
96
- dirLight.updateMatrixWorld();
97
- view.scene.add( dirLight );
98
-
99
- var ambLight = new itowns.THREE.AmbientLight(0xffffff, 0.2);
100
- view.scene.add( ambLight );
101
-
102
- // Pick 3D Tiles features when hovering them with the mouse and
103
- // display their semantic information in an html div
104
- var pickingArgs = {};
105
- pickingArgs.htmlDiv = document.getElementById('featureInfo');
106
- pickingArgs.view = view;
107
- pickingArgs.layer = $3dTilesLayer;
108
- itowns.View.prototype.addLayer.call(view, $3dTilesLayer);
109
-
110
- // Request redraw
111
- view.notifyChange();
112
-
113
- // Add a debug UI
114
- var menu = new GuiTools('menuDiv', view);
115
- var d = new debug.Debug(view, menu.gui);
116
- debug.createTileDebugUI(menu.gui, view, view.tileLayer, d);
117
- debug.create3dTilesDebugUI(menu.gui, view, $3dTilesLayer);
118
- </script>
119
- </body>
120
- </html>
@@ -1,94 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Itowns - 3d-tiles example</title>
5
-
6
- <meta charset="UTF-8">
7
- <link rel="stylesheet" type="text/css" href="css/example.css">
8
- <link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">
9
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
10
- <script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
11
- </head>
12
- <body>
13
- <div id="viewerDiv"></div>
14
- <div id="description">
15
- <p><b>Feature Information:</b></p>
16
- <div id="featureInfo"></div>
17
- </div>
18
- <script src="js/GUI/GuiTools.js"></script>
19
- <script src="../dist/itowns.js"></script>
20
- <script src="js/GUI/LoadingScreen.js"></script>
21
- <script src="../dist/debug.js"></script>
22
- <script src="js/3dTilesHelper.js"></script>
23
- <script type="text/javascript">
24
- /* global itowns,document,GuiTools*/
25
- var placement = {
26
- coord: new itowns.Coordinates('EPSG:4326', -75.6114, 40.03428, 0),
27
- range: 4000,
28
- tilt: 22,
29
- heading: 180
30
- }
31
- // iTowns namespace defined here
32
- var viewerDiv = document.getElementById('viewerDiv');
33
-
34
- var view = new itowns.GlobeView(viewerDiv, placement);
35
- view.camera3D.near = 5;
36
- setupLoadingScreen(viewerDiv, view);
37
-
38
- var menuGlobe = new GuiTools('menuDiv', view, 300);
39
-
40
- itowns.Fetcher.json('./layers/JSONLayers/OPENSM.json').then(function _(config) {
41
- config.source = new itowns.TMSSource(config.source);
42
- var layer = new itowns.ColorLayer('Ortho', config);
43
- view.addLayer(layer).then(menuGlobe.addLayerGUI.bind(menuGlobe));
44
- });
45
-
46
- // Create a new Layer 3d-tiles For DiscreteLOD
47
- // -------------------------------------------
48
- var $3dTilesLayerDiscreteLOD = new itowns.C3DTilesLayer('3d-tiles-discrete-lod', {
49
- name: 'DiscreteLOD',
50
- sseThreshold: 0.05,
51
- source: new itowns.C3DTilesSource({
52
- url: 'https://raw.githubusercontent.com/CesiumGS/3d-tiles-samples/master/1.0/TilesetWithDiscreteLOD/tileset.json',
53
- }),
54
- }, view);
55
-
56
- itowns.View.prototype.addLayer.call(view, $3dTilesLayerDiscreteLOD);
57
-
58
- // Create a new Layer 3d-tiles For Viewer Request Volume
59
- // -----------------------------------------------------
60
-
61
- var $3dTilesLayerRequestVolume = new itowns.C3DTilesLayer('3d-tiles-request-volume', {
62
- name: 'RequestVolume',
63
- source: new itowns.C3DTilesSource({
64
- url: 'https://raw.githubusercontent.com/CesiumGS/3d-tiles-samples/master/1.0/TilesetWithRequestVolume/tileset.json',
65
- }),
66
- sseThreshold: 1,
67
- }, view);
68
-
69
- // add an event for picking the 3D Tiles layer and displaying
70
- // information about the picked feature in an html div
71
- var pickingArgs = {};
72
- pickingArgs.htmlDiv = document.getElementById('featureInfo');
73
- pickingArgs.view = view;
74
- pickingArgs.layer = $3dTilesLayerRequestVolume;
75
- itowns.View.prototype.addLayer.call(view,
76
- $3dTilesLayerRequestVolume).then(function _() {
77
- window.addEventListener('mousemove',
78
- (event) => fillHTMLWithPickingInfo(event, pickingArgs),false);
79
- });
80
-
81
- // Add the UI Debug
82
- var d = new debug.Debug(view, menuGlobe.gui);
83
- debug.createTileDebugUI(menuGlobe.gui, view, view.tileLayer, d);
84
- debug.create3dTilesDebugUI(menuGlobe.gui, view, $3dTilesLayerDiscreteLOD);
85
- debug.create3dTilesDebugUI(menuGlobe.gui, view, $3dTilesLayerRequestVolume);
86
- d.zoom = function() {
87
- view.camera3D.position.set(1215013.9, -4736315.5, 4081597.5);
88
- view.camera3D.quaternion.set(0.9108514448729665, 0.13456816437801225, 0.1107206134840362, 0.3741416847378546);
89
- view.notifyChange(view.camera3D);
90
- }
91
- menuGlobe.gui.add(d, 'zoom').name('Go to point cloud');
92
- </script>
93
- </body>
94
- </html>
@@ -1,86 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Itowns - 3d-tiles hierarchy example</title>
5
-
6
- <meta charset="UTF-8">
7
- <link rel="stylesheet" type="text/css" href="css/example.css">
8
- <link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">
9
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
10
- <script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
11
- </head>
12
- <body>
13
- <div id="viewerDiv"></div>
14
- <div id="description">
15
- <p><b>Feature Information:</b></p>
16
- <div id="featureInfo"></div>
17
- </div>
18
- <script src="js/GUI/GuiTools.js"></script>
19
- <script src="../dist/itowns.js"></script>
20
- <script src="js/GUI/LoadingScreen.js"></script>
21
- <script src="../dist/debug.js"></script>
22
- <script src="js/3dTilesHelper.js"></script>
23
- <script type="text/javascript">
24
- // Note: The following positions and camera parameters have been
25
- // obtained manually using view.controls.getCameraCoordinate() ;
26
- // view.controls.getCameraTargetPosition() ;
27
- // view.controls.getCameraOrientation()
28
- var placement = {
29
- coord: new itowns.Coordinates('EPSG:4326', -75.61349, 40.044259),
30
- range: 200,
31
- tilt: 10,
32
- heading: 145,
33
- };
34
-
35
- var viewerDiv = document.getElementById('viewerDiv');
36
-
37
- var view = new itowns.GlobeView(viewerDiv, placement);
38
-
39
- setupLoadingScreen(viewerDiv, view);
40
-
41
- var menuGlobe = new GuiTools('menuDiv', view, 300);
42
-
43
- // Add Open Street Map orthographic layer
44
- itowns.Fetcher.json('./layers/JSONLayers/OPENSM.json')
45
- .then(function _(config) {
46
- config.source = new itowns.TMSSource(config.source);
47
- var layer = new itowns.ColorLayer('Ortho', config);
48
- view.addLayer(layer)
49
- .then(menuGlobe.addLayerGUI.bind(menuGlobe));
50
- });
51
-
52
- // Create a new 3D tiles layer with batch table hierarchy extension
53
- const extensions = new itowns.C3DTExtensions();
54
- extensions.registerExtension("3DTILES_batch_table_hierarchy",
55
- { [itowns.C3DTilesTypes.batchtable]:
56
- itowns.C3DTBatchTableHierarchyExtension });
57
-
58
- // Create the 3D Tiles layer
59
- var $3dTilesLayerBTHierarchy = new itowns.C3DTilesLayer(
60
- '3d-tiles-bt-hierarchy', {
61
- name: 'BTHierarchy',
62
- source: new itowns.C3DTilesSource({
63
- url: 'https://raw.githubusercontent.com/AnalyticalGraphicsInc/cesium/master/Apps/SampleData/Cesium3DTiles/Hierarchy/BatchTableHierarchy/tileset.json',
64
- }),
65
- registeredExtensions: extensions,
66
- },
67
- view);
68
-
69
- // add an event for picking the 3D Tiles layer and displaying
70
- // information about the picked feature in an html div
71
- var pickingArgs = {};
72
- pickingArgs.htmlDiv = document.getElementById('featureInfo');
73
- pickingArgs.view = view;
74
- pickingArgs.layer = $3dTilesLayerBTHierarchy;
75
- itowns.View.prototype.addLayer.call(view, $3dTilesLayerBTHierarchy).then(function _() {
76
- window.addEventListener('mousemove',
77
- (event) => fillHTMLWithPickingInfo(event, pickingArgs),false);
78
- });
79
-
80
- // Add a debug UI
81
- var d = new debug.Debug(view, menuGlobe.gui);
82
- debug.createTileDebugUI(menuGlobe.gui, view, view.tileLayer, d);
83
- debug.create3dTilesDebugUI(menuGlobe.gui, view, $3dTilesLayerBTHierarchy);
84
- </script>
85
- </body>
86
- </html>