itowns 2.44.3-next.2 → 2.44.3-next.21

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 (44) 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.map +1 -1
  7. package/dist/itowns_widgets.js +1 -1
  8. package/dist/itowns_widgets.js.map +1 -1
  9. package/examples/3dtiles_loader.html +105 -44
  10. package/examples/config.json +2 -10
  11. package/examples/images/itowns_logo.svg +123 -0
  12. package/examples/js/plugins/COGParser.js +1 -1
  13. package/lib/Controls/GlobeControls.js +38 -21
  14. package/lib/Controls/StateControl.js +5 -2
  15. package/lib/Converter/Feature2Mesh.js +9 -2
  16. package/lib/Converter/textureConverter.js +3 -3
  17. package/lib/Core/Geographic/Extent.js +74 -266
  18. package/lib/Core/Prefab/Globe/GlobeLayer.js +1 -1
  19. package/lib/Core/Prefab/GlobeView.js +0 -4
  20. package/lib/Core/Prefab/Planar/PlanarLayer.js +1 -1
  21. package/lib/Core/Tile/Tile.js +219 -0
  22. package/lib/Core/Tile/TileGrid.js +46 -0
  23. package/lib/Core/TileMesh.js +2 -1
  24. package/lib/Core/View.js +13 -6
  25. package/lib/Layer/C3DTilesLayer.js +15 -14
  26. package/lib/Layer/LabelLayer.js +8 -4
  27. package/lib/Layer/OGC3DTilesLayer.js +62 -31
  28. package/lib/Parser/GeoJsonParser.js +1 -1
  29. package/lib/Parser/VectorTileParser.js +1 -1
  30. package/lib/Parser/XbilParser.js +14 -2
  31. package/lib/Provider/URLBuilder.js +22 -11
  32. package/lib/Renderer/PointsMaterial.js +1 -1
  33. package/lib/Source/TMSSource.js +9 -7
  34. package/lib/Source/VectorTilesSource.js +2 -2
  35. package/lib/Source/WFSSource.js +14 -8
  36. package/lib/Source/WMSSource.js +20 -10
  37. package/lib/Source/WMTSSource.js +13 -7
  38. package/lib/Utils/gui/C3DTilesStyle.js +2 -3
  39. package/package.json +9 -3
  40. package/examples/3dtiles_25d.html +0 -120
  41. package/examples/3dtiles_basic.html +0 -94
  42. package/examples/3dtiles_batch_table.html +0 -86
  43. package/examples/3dtiles_ion.html +0 -126
  44. package/examples/3dtiles_pointcloud.html +0 -95
@@ -1,6 +1,9 @@
1
- import Extent from "../Core/Geographic/Extent.js";
2
- const extent = new Extent('EPSG:4326', [0, 0, 0, 0]);
3
1
  let subDomainsCount = 0;
2
+
3
+ /**
4
+ * @param {string} url
5
+ * @returns {string}
6
+ */
4
7
  function subDomains(url) {
5
8
  const subDomainsPtrn = /\$\{u:([\w-_.|]+)\}/.exec(url);
6
9
  if (!subDomainsPtrn) {
@@ -51,8 +54,13 @@ export default {
51
54
  * // The resulting url is:
52
55
  * // http://server.geo/tms/15/2142/3412.jpg;
53
56
  *
54
- * @param {Extent} coords - the coordinates
55
- * @param {Source} source
57
+ * @param {Object} coords - tile coordinates
58
+ * @param {number} coords.row - tile row
59
+ * @param {number} coords.col - tile column
60
+ * @param {number} coords.zoom - tile zoom
61
+ * @param {Object} source
62
+ * @param {string} source.url
63
+ * @param {Function} source.tileMatrixCallback
56
64
  *
57
65
  * @return {string} the formed url
58
66
  */
@@ -79,8 +87,12 @@ export default {
79
87
  * // The resulting url is:
80
88
  * // http://server.geo/wms/BBOX=12,35,14,46&FORMAT=jpg&SERVICE=WMS
81
89
  *
82
- * @param {Extent} bbox - the bounding box
83
- * @param {Object} source
90
+ * @param {Object} bbox - the bounding box
91
+ * @param {number} bbox.west
92
+ * @param {number} bbox.south
93
+ * @param {number} bbox.east
94
+ * @param {number} bbox.north
95
+ * @param {Object} source - the source of data
84
96
  * @param {string} source.crs
85
97
  * @param {number} source.bboxDigits
86
98
  * @param {string} source.url
@@ -93,11 +105,10 @@ export default {
93
105
  if (source.bboxDigits !== undefined) {
94
106
  precision = source.bboxDigits;
95
107
  }
96
- bbox.as(source.crs, extent);
97
- const w = extent.west.toFixed(precision);
98
- const s = extent.south.toFixed(precision);
99
- const e = extent.east.toFixed(precision);
100
- const n = extent.north.toFixed(precision);
108
+ const w = bbox.west.toFixed(precision);
109
+ const s = bbox.south.toFixed(precision);
110
+ const e = bbox.east.toFixed(precision);
111
+ const n = bbox.north.toFixed(precision);
101
112
  let bboxInUnit = source.axisOrder || 'wsen';
102
113
  bboxInUnit = bboxInUnit.replace('w', `${w},`).replace('s', `${s},`).replace('e', `${e},`).replace('n', `${n},`).slice(0, -1);
103
114
  return subDomains(source.url.replace('%bbox', bboxInUnit));
@@ -258,7 +258,7 @@ class PointsMaterial extends THREE.ShaderMaterial {
258
258
  /**
259
259
  * @class PointsMaterial
260
260
  * @param {object} [options={}] The options
261
- * @param {number} [options.size=0] size point
261
+ * @param {number} [options.size=1] point size
262
262
  * @param {number} [options.mode=PNTS_MODE.COLOR] display mode.
263
263
  * @param {number} [options.shape=PNTS_SHAPE.CIRCLE] rendered points shape.
264
264
  * @param {THREE.Vector4} [options.overlayColor=new THREE.Vector4(0, 0, 0, 0)] overlay color.
@@ -1,8 +1,10 @@
1
1
  import Source from "./Source.js";
2
2
  import URLBuilder from "../Provider/URLBuilder.js";
3
- import Extent, { globalExtentTMS } from "../Core/Geographic/Extent.js";
3
+ import Extent from "../Core/Geographic/Extent.js";
4
+ import Tile from "../Core/Tile/Tile.js";
5
+ import { globalExtentTMS } from "../Core/Tile/TileGrid.js";
4
6
  import CRS from "../Core/Geographic/Crs.js";
5
- const extent = new Extent(CRS.tms_4326, 0, 0, 0);
7
+ const _tile = new Tile(CRS.tms_4326, 0, 0, 0);
6
8
 
7
9
  /**
8
10
  * An object defining the source of resources to get from a
@@ -107,8 +109,8 @@ class TMSSource extends Source {
107
109
  }
108
110
  }
109
111
  }
110
- urlFromExtent(extent) {
111
- return URLBuilder.xyz(extent, this);
112
+ urlFromExtent(tile) {
113
+ return URLBuilder.xyz(tile, this);
112
114
  }
113
115
  onLayerAdded(options) {
114
116
  super.onLayerAdded(options);
@@ -118,17 +120,17 @@ class TMSSource extends Source {
118
120
  const crs = parent ? parent.extent.crs : options.out.crs;
119
121
  if (this.tileMatrixSetLimits && !this.extentSetlimits[crs]) {
120
122
  this.extentSetlimits[crs] = {};
121
- extent.crs = this.crs;
123
+ _tile.crs = this.crs;
122
124
  for (let i = this.zoom.max; i >= this.zoom.min; i--) {
123
125
  const tmsl = this.tileMatrixSetLimits[i];
124
126
  const {
125
127
  west,
126
128
  north
127
- } = extent.set(i, tmsl.minTileRow, tmsl.minTileCol).as(crs);
129
+ } = _tile.set(i, tmsl.minTileRow, tmsl.minTileCol).toExtent(crs);
128
130
  const {
129
131
  east,
130
132
  south
131
- } = extent.set(i, tmsl.maxTileRow, tmsl.maxTileCol).as(crs);
133
+ } = _tile.set(i, tmsl.maxTileRow, tmsl.maxTileCol).toExtent(crs);
132
134
  this.extentSetlimits[crs][i] = new Extent(crs, west, east, south, north);
133
135
  }
134
136
  }
@@ -135,8 +135,8 @@ class VectorTilesSource extends TMSSource {
135
135
  this.urls = Array.from(new Set(TMSUrlList));
136
136
  });
137
137
  }
138
- urlFromExtent(extent, url) {
139
- return URLBuilder.xyz(extent, {
138
+ urlFromExtent(tile, url) {
139
+ return URLBuilder.xyz(tile, {
140
140
  tileMatrixCallback: this.tileMatrixCallback,
141
141
  url
142
142
  });
@@ -1,6 +1,8 @@
1
1
  import Source from "./Source.js";
2
2
  import URLBuilder from "../Provider/URLBuilder.js";
3
3
  import CRS from "../Core/Geographic/Crs.js";
4
+ import Extent from "../Core/Geographic/Extent.js";
5
+ const _extent = new Extent('EPSG:4326', [0, 0, 0, 0]);
4
6
 
5
7
  /**
6
8
  * An object defining the source of resources to get from a
@@ -118,22 +120,25 @@ class WFSSource extends Source {
118
120
  this.typeName = source.typeName;
119
121
  this.version = source.version || '2.0.2';
120
122
  this.bboxDigits = source.bboxDigits;
121
-
122
- // Add ? at the end of the url if it is not already in the given URL
123
- if (!this.url.endsWith('?')) {
124
- this.url = `${this.url}?`;
125
- }
126
- this.url = `${source.url}SERVICE=WFS&REQUEST=GetFeature&typeName=${this.typeName}&VERSION=${this.version}&SRSNAME=${this.crs}&outputFormat=${this.format}&BBOX=%bbox,${this.crs}`;
127
123
  this.zoom = {
128
124
  min: 0,
129
125
  max: Infinity
130
126
  };
127
+ const urlObj = new URL(source.url);
128
+ urlObj.searchParams.set('SERVICE', 'WFS');
129
+ urlObj.searchParams.set('REQUEST', 'GetFeature');
130
+ urlObj.searchParams.set('typeName', this.typeName);
131
+ urlObj.searchParams.set('VERSION', this.version);
132
+ urlObj.searchParams.set('SRSNAME', this.crs);
133
+ urlObj.searchParams.set('outputFormat', this.format);
134
+ urlObj.searchParams.set('BBOX', `%bbox,${this.crs}`);
131
135
  this.vendorSpecific = source.vendorSpecific;
132
136
  for (const name in this.vendorSpecific) {
133
137
  if (Object.prototype.hasOwnProperty.call(this.vendorSpecific, name)) {
134
- this.url = `${this.url}&${name}=${this.vendorSpecific[name]}`;
138
+ urlObj.searchParams.set(name, this.vendorSpecific[name]);
135
139
  }
136
140
  }
141
+ this.url = decodeURIComponent(urlObj.toString());
137
142
  }
138
143
  handlingError(err) {
139
144
  if (err.response && err.response.status == 400) {
@@ -155,7 +160,8 @@ class WFSSource extends Source {
155
160
  return [extent.zoom, extent.south, extent.west];
156
161
  }
157
162
  }
158
- urlFromExtent(extent) {
163
+ urlFromExtent(extentOrTile) {
164
+ const extent = extentOrTile.isExtent ? extentOrTile.as(this.crs, _extent) : extentOrTile.toExtent(this.crs, _extent);
159
165
  return URLBuilder.bbox(extent, this);
160
166
  }
161
167
  extentInsideLimit(extent) {
@@ -1,5 +1,7 @@
1
1
  import Source from "./Source.js";
2
2
  import URLBuilder from "../Provider/URLBuilder.js";
3
+ import Extent from "../Core/Geographic/Extent.js";
4
+ const _extent = new Extent('EPSG:4326', [0, 0, 0, 0]);
3
5
 
4
6
  /**
5
7
  * An object defining the source of images to get from a
@@ -99,28 +101,36 @@ class WMSSource extends Source {
99
101
  // 4326 (lat/long) axis order depends on the WMS version used
100
102
  if (this.crs == 'EPSG:4326') {
101
103
  // 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
+ // version 1.X.X long/lat while version 1.3.0 mandates xy (so lat,long)
105
+ this.axisOrder = this.version === '1.3.0' ? 'swne' : 'wsen';
104
106
  } else {
105
107
  // xy,xy order
106
108
  this.axisOrder = 'wsen';
107
109
  }
108
110
  }
109
111
  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}`;
112
+ const urlObj = new URL(this.url);
113
+ urlObj.searchParams.set('SERVICE', 'WMS');
114
+ urlObj.searchParams.set('REQUEST', 'GetMap');
115
+ urlObj.searchParams.set('LAYERS', this.name);
116
+ urlObj.searchParams.set('VERSION', this.version);
117
+ urlObj.searchParams.set('STYLES', this.style);
118
+ urlObj.searchParams.set('FORMAT', this.format);
119
+ urlObj.searchParams.set('TRANSPARENT', this.transparent);
120
+ urlObj.searchParams.set('BBOX', '%bbox');
121
+ urlObj.searchParams.set(crsPropName, this.crs);
122
+ urlObj.searchParams.set('WIDTH', this.width);
123
+ urlObj.searchParams.set('HEIGHT', this.height);
116
124
  this.vendorSpecific = source.vendorSpecific;
117
125
  for (const name in this.vendorSpecific) {
118
126
  if (Object.prototype.hasOwnProperty.call(this.vendorSpecific, name)) {
119
- this.url = `${this.url}&${name}=${this.vendorSpecific[name]}`;
127
+ urlObj.searchParams.set(name, this.vendorSpecific[name]);
120
128
  }
121
129
  }
130
+ this.url = decodeURIComponent(urlObj.toString());
122
131
  }
123
- urlFromExtent(extent) {
132
+ urlFromExtent(extentOrTile) {
133
+ const extent = extentOrTile.isExtent ? extentOrTile.as(this.crs, _extent) : extentOrTile.toExtent(this.crs, _extent);
124
134
  return URLBuilder.bbox(extent, this);
125
135
  }
126
136
  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;
@@ -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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itowns",
3
- "version": "2.44.3-next.2",
3
+ "version": "2.44.3-next.21",
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",
@@ -61,7 +61,7 @@
61
61
  "@mapbox/vector-tile": "^2.0.3",
62
62
  "@tmcw/togeojson": "^5.8.1",
63
63
  "@tweenjs/tween.js": "^25.0.0",
64
- "3d-tiles-renderer": "^0.3.37",
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",
@@ -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>