From b39b87ee53173ebc780c85a028dd27ddaab8d7a7 Mon Sep 17 00:00:00 2001 From: valentinMachado Date: Thu, 13 Jul 2023 15:05:18 +0200 Subject: [PATCH 1/6] clean(ItownsUtil) remove add layer from config methods --- examples/2DVisualization.html | 74 +++- examples/3DTilesPointCloud.html | 44 ++- examples/3DTilesWireframe.html | 70 +++- examples/AddLayersFromConfig.html | 89 ++++- examples/AvatarGame.html | 101 +++-- examples/AvatarGameShader.html | 95 ++++- examples/C3DTilesLayerStyle.html | 19 +- examples/CameraPositionerWidget.html | 23 +- examples/DocumentWidget.html | 70 +++- examples/DragAndDropAvatar.html | 95 ++++- examples/GeocodingWidget.html | 23 +- examples/GuidedTour.html | 70 +++- examples/LayerChoiceWidget.html | 89 ++++- examples/MultiPlanarProcess.html | 96 ++++- examples/TemporalWidget.html | 51 ++- examples/WorldMap.html | 23 +- examples/ZeppelinGame.html | 101 +++-- examples/assets/js/C3DTilesEditor.js | 144 ++++++-- examples/assets/js/ShowRoom.js | 147 ++++++-- examples/dom_element_3D.html | 89 ++++- examples/widget_planar_controls.html | 23 +- packages/browser/src/ItownsUtil.js | 346 +----------------- .../browser/src/Widget/Temporal/Temporal.js | 13 +- 23 files changed, 1259 insertions(+), 636 deletions(-) diff --git a/examples/2DVisualization.html b/examples/2DVisualization.html index c29608a9c..02ce1f764 100644 --- a/examples/2DVisualization.html +++ b/examples/2DVisualization.html @@ -17,7 +17,7 @@ './assets/config/frame3D_planars.json', './assets/config/layer/base_maps.json', './assets/config/layer/elevation.json', - './assets/config/layer/3DTiles.json', + './assets/config/layer/3DTiles.json' ]) .then((configs) => { udvizBrowser.proj4.default.defs( @@ -39,24 +39,70 @@ ); // ADD BASE MAP - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) ); // ADD ELEVATION LAYER - udvizBrowser.addElevationLayer( - configs['elevation'], - frame3DPlanar.itownsView, - extent + const isTextureFormat = + configs['elevation']['format'] == 'image/jpeg' || + configs['elevation']['format'] == 'image/png'; + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ElevationLayer( + configs['elevation']['layer_name'], + { + useColorTextureElevation: isTextureFormat, + colorTextureElevationMinZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMinZ'] + : null, + colorTextureElevationMaxZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMaxZ'] + : null, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + url: configs['elevation']['url'], + name: configs['elevation']['name'], + crs: extent.crs, + heightMapWidth: 256, + format: configs['elevation']['format'] + }) + } + ) ); // ADD LAYERS - udvizBrowser.add3DTilesLayers( - configs['3DTiles'], - frame3DPlanar.itownsView - ); + configs['3DTiles'].forEach((layerConfig) => { + udvizBrowser.itowns.View.prototype.addLayer.call( + frame3DPlanar.itownsView, + new udvizBrowser.itowns.C3DTilesLayer( + layerConfig['id'], + { + name: layerConfig['id'], + source: new udvizBrowser.itowns.C3DTilesSource({ + url: layerConfig['url'] + }) + }, + frame3DPlanar.itownsView + ) + ); + }); const button = document.createElement('button'); button.innerHTML = 'Change visualization mode to 3D'; @@ -83,7 +129,7 @@ for (const [ // eslint-disable-next-line no-unused-vars batchId, - c3DTFeature, + c3DTFeature ] of tileContent.layer.tilesC3DTileFeatures.get( tileContent.tileId )) { diff --git a/examples/3DTilesPointCloud.html b/examples/3DTilesPointCloud.html index 71984e127..ce55bc27e 100644 --- a/examples/3DTilesPointCloud.html +++ b/examples/3DTilesPointCloud.html @@ -38,17 +38,47 @@ ); // ADD BASE MAP - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) ); - // /// ADD LAYER - udvizBrowser.add3DTilesLayers( - configs['3DTiles_point_cloud'], + const pointCloudLayer = new udvizBrowser.itowns.C3DTilesLayer( + configs['3DTiles_point_cloud'][0]['id'], + { + name: configs['3DTiles_point_cloud'][0]['id'], + source: new udvizBrowser.itowns.C3DTilesSource({ + url: configs['3DTiles_point_cloud'][0]['url'] + }) + }, frame3DPlanar.itownsView ); + + // hack (not declare in C3DTilesLayer) to override point cloud material + pointCloudLayer.material = new udvizBrowser.THREE.PointsMaterial({ + size: configs['3DTiles_point_cloud'][0]['pc_size'], + vertexColors: true + }); + udvizBrowser.itowns.View.prototype.addLayer.call( + frame3DPlanar.itownsView, + pointCloudLayer + ); }); SCRIPT_TAG_RELOAD diff --git a/examples/3DTilesWireframe.html b/examples/3DTilesWireframe.html index 8c3520574..b8b70c4b1 100644 --- a/examples/3DTilesWireframe.html +++ b/examples/3DTilesWireframe.html @@ -39,24 +39,70 @@ ); // ADD BASE MAP - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) ); // ADD ELEVATION LAYER - udvizBrowser.addElevationLayer( - configs['elevation'], - frame3DPlanar.itownsView, - extent + const isTextureFormat = + configs['elevation']['format'] == 'image/jpeg' || + configs['elevation']['format'] == 'image/png'; + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ElevationLayer( + configs['elevation']['layer_name'], + { + useColorTextureElevation: isTextureFormat, + colorTextureElevationMinZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMinZ'] + : null, + colorTextureElevationMaxZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMaxZ'] + : null, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + url: configs['elevation']['url'], + name: configs['elevation']['name'], + crs: extent.crs, + heightMapWidth: 256, + format: configs['elevation']['format'] + }) + } + ) ); // ADD LAYERS - udvizBrowser.add3DTilesLayers( - configs['3DTiles'], - frame3DPlanar.itownsView - ); + configs['3DTiles'].forEach((layerConfig) => { + udvizBrowser.itowns.View.prototype.addLayer.call( + frame3DPlanar.itownsView, + new udvizBrowser.itowns.C3DTilesLayer( + layerConfig['id'], + { + name: layerConfig['id'], + source: new udvizBrowser.itowns.C3DTilesSource({ + url: layerConfig['url'] + }) + }, + frame3DPlanar.itownsView + ) + ); + }); frame3DPlanar.itownsView .getLayers() diff --git a/examples/AddLayersFromConfig.html b/examples/AddLayersFromConfig.html index 47ddc8121..692618bbf 100644 --- a/examples/AddLayersFromConfig.html +++ b/examples/AddLayersFromConfig.html @@ -41,27 +41,82 @@ // /// ADD LAYERS - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) ); - udvizBrowser.addGeoJsonLayers( - configs['geoJSONs'], - frame3DPlanar.itownsView, - extent - ); + configs['geoJSONs'].forEach((layerConfig) => { + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer(layerConfig.id, { + name: layerConfig.id, + transparent: true, + source: new udvizBrowser.itowns.FileSource({ + url: layerConfig.url, + crs: extent.crs, + format: 'application/json' + }), + style: new udvizBrowser.itowns.Style(layerConfig.style) + }) + ); + }); - udvizBrowser.add3DTilesLayers( - configs['3DTiles'], - frame3DPlanar.itownsView - ); + configs['3DTiles'].forEach((layerConfig) => { + udvizBrowser.itowns.View.prototype.addLayer.call( + frame3DPlanar.itownsView, + new udvizBrowser.itowns.C3DTilesLayer( + layerConfig['id'], + { + name: layerConfig['id'], + source: new udvizBrowser.itowns.C3DTilesSource({ + url: layerConfig['url'] + }) + }, + frame3DPlanar.itownsView + ) + ); + }); - udvizBrowser.addElevationLayer( - configs['elevation'], - frame3DPlanar.itownsView, - extent + const isTextureFormat = + configs['elevation']['format'] == 'image/jpeg' || + configs['elevation']['format'] == 'image/png'; + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ElevationLayer( + configs['elevation']['layer_name'], + { + useColorTextureElevation: isTextureFormat, + colorTextureElevationMinZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMinZ'] + : null, + colorTextureElevationMaxZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMaxZ'] + : null, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + url: configs['elevation']['url'], + name: configs['elevation']['name'], + crs: extent.crs, + heightMapWidth: 256, + format: configs['elevation']['format'] + }) + } + ) ); }); diff --git a/examples/AvatarGame.html b/examples/AvatarGame.html index b3c478e8b..bd0bb1533 100644 --- a/examples/AvatarGame.html +++ b/examples/AvatarGame.html @@ -166,28 +166,85 @@ game.start(); // /// ADD LAYERS - udvizBrowser.add3DTilesLayers( - configs['3DTiles'], - frame3DPlanar.itownsView - ); - - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent - ); - - udvizBrowser.addElevationLayer( - configs['elevation'], - frame3DPlanar.itownsView, - extent - ); - - udvizBrowser.addGeoJsonLayers( - configs['geoJSONs'], - frame3DPlanar.itownsView, - extent - ); + { + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) + ); + + configs['geoJSONs'].forEach((layerConfig) => { + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer(layerConfig.id, { + name: layerConfig.id, + transparent: true, + source: new udvizBrowser.itowns.FileSource({ + url: layerConfig.url, + crs: extent.crs, + format: 'application/json' + }), + style: new udvizBrowser.itowns.Style(layerConfig.style) + }) + ); + }); + + configs['3DTiles'].forEach((layerConfig) => { + udvizBrowser.itowns.View.prototype.addLayer.call( + frame3DPlanar.itownsView, + new udvizBrowser.itowns.C3DTilesLayer( + layerConfig['id'], + { + name: layerConfig['id'], + source: new udvizBrowser.itowns.C3DTilesSource({ + url: layerConfig['url'] + }) + }, + frame3DPlanar.itownsView + ) + ); + }); + + const isTextureFormat = + configs['elevation']['format'] == 'image/jpeg' || + configs['elevation']['format'] == 'image/png'; + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ElevationLayer( + configs['elevation']['layer_name'], + { + useColorTextureElevation: isTextureFormat, + colorTextureElevationMinZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMinZ'] + : null, + colorTextureElevationMaxZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMaxZ'] + : null, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + url: configs['elevation']['url'], + name: configs['elevation']['name'], + crs: extent.crs, + heightMapWidth: 256, + format: configs['elevation']['format'] + }) + } + ) + ); + } }); }); diff --git a/examples/AvatarGameShader.html b/examples/AvatarGameShader.html index 23986d9a7..551823172 100644 --- a/examples/AvatarGameShader.html +++ b/examples/AvatarGameShader.html @@ -471,28 +471,85 @@ }); // /// ADD LAYERS - udvizBrowser.add3DTilesLayers( - configs['3DTiles'], - frame3DPlanar.itownsView - ); + { + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) + ); - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent - ); + configs['geoJSONs'].forEach((layerConfig) => { + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer(layerConfig.id, { + name: layerConfig.id, + transparent: true, + source: new udvizBrowser.itowns.FileSource({ + url: layerConfig.url, + crs: extent.crs, + format: 'application/json' + }), + style: new udvizBrowser.itowns.Style(layerConfig.style) + }) + ); + }); - udvizBrowser.addElevationLayer( - configs['elevation'], - frame3DPlanar.itownsView, - extent - ); + configs['3DTiles'].forEach((layerConfig) => { + udvizBrowser.itowns.View.prototype.addLayer.call( + frame3DPlanar.itownsView, + new udvizBrowser.itowns.C3DTilesLayer( + layerConfig['id'], + { + name: layerConfig['id'], + source: new udvizBrowser.itowns.C3DTilesSource({ + url: layerConfig['url'] + }) + }, + frame3DPlanar.itownsView + ) + ); + }); - udvizBrowser.addGeoJsonLayers( - configs['geoJSONs'], - frame3DPlanar.itownsView, - extent - ); + const isTextureFormat = + configs['elevation']['format'] == 'image/jpeg' || + configs['elevation']['format'] == 'image/png'; + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ElevationLayer( + configs['elevation']['layer_name'], + { + useColorTextureElevation: isTextureFormat, + colorTextureElevationMinZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMinZ'] + : null, + colorTextureElevationMaxZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMaxZ'] + : null, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + url: configs['elevation']['url'], + name: configs['elevation']['name'], + crs: extent.crs, + heightMapWidth: 256, + format: configs['elevation']['format'] + }) + } + ) + ); + } }); }); diff --git a/examples/C3DTilesLayerStyle.html b/examples/C3DTilesLayerStyle.html index 9b2962bfd..3762bb4cd 100644 --- a/examples/C3DTilesLayerStyle.html +++ b/examples/C3DTilesLayerStyle.html @@ -36,10 +36,21 @@ configs['frame3D_planars'][2] ); - udvizBrowser.add3DTilesLayers( - configs['3DTiles'], - frame3DPlanar.itownsView - ); + configs['3DTiles'].forEach((layerConfig) => { + udvizBrowser.itowns.View.prototype.addLayer.call( + frame3DPlanar.itownsView, + new udvizBrowser.itowns.C3DTilesLayer( + layerConfig['id'], + { + name: layerConfig['id'], + source: new udvizBrowser.itowns.C3DTilesSource({ + url: layerConfig['url'] + }) + }, + frame3DPlanar.itownsView + ) + ); + }); const myStyle = new udvizBrowser.itowns.Style({ fill: { diff --git a/examples/CameraPositionerWidget.html b/examples/CameraPositionerWidget.html index 6760a0cec..f352527c8 100644 --- a/examples/CameraPositionerWidget.html +++ b/examples/CameraPositionerWidget.html @@ -36,10 +36,25 @@ configs['frame3D_planars'][2] ); - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) ); // //// CAMERA POSITIONER diff --git a/examples/DocumentWidget.html b/examples/DocumentWidget.html index 40cff3150..86f13ef68 100644 --- a/examples/DocumentWidget.html +++ b/examples/DocumentWidget.html @@ -40,21 +40,67 @@ ); // /// ADD LAYERS - udvizBrowser.add3DTilesLayers( - configs['3DTiles'], - frame3DPlanar.itownsView - ); + configs['3DTiles'].forEach((layerConfig) => { + udvizBrowser.itowns.View.prototype.addLayer.call( + frame3DPlanar.itownsView, + new udvizBrowser.itowns.C3DTilesLayer( + layerConfig['id'], + { + name: layerConfig['id'], + source: new udvizBrowser.itowns.C3DTilesSource({ + url: layerConfig['url'] + }) + }, + frame3DPlanar.itownsView + ) + ); + }); - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) ); - udvizBrowser.addElevationLayer( - configs['elevation'], - frame3DPlanar.itownsView, - extent + const isTextureFormat = + configs['elevation']['format'] == 'image/jpeg' || + configs['elevation']['format'] == 'image/png'; + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ElevationLayer( + configs['elevation']['layer_name'], + { + useColorTextureElevation: isTextureFormat, + colorTextureElevationMinZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMinZ'] + : null, + colorTextureElevationMaxZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMaxZ'] + : null, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + url: configs['elevation']['url'], + name: configs['elevation']['name'], + crs: extent.crs, + heightMapWidth: 256, + format: configs['elevation']['format'] + }) + } + ) ); // quick fix but css needs to be remove from documents view TODO ISSUE diff --git a/examples/DragAndDropAvatar.html b/examples/DragAndDropAvatar.html index 9247e3e46..7d5a4cafa 100644 --- a/examples/DragAndDropAvatar.html +++ b/examples/DragAndDropAvatar.html @@ -95,28 +95,85 @@ game.start(); // /// ADD LAYERS - udvizBrowser.add3DTilesLayers( - configs['3DTiles'], - frame3DPlanar.itownsView - ); + { + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) + ); - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent - ); + configs['geoJSONs'].forEach((layerConfig) => { + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer(layerConfig.id, { + name: layerConfig.id, + transparent: true, + source: new udvizBrowser.itowns.FileSource({ + url: layerConfig.url, + crs: extent.crs, + format: 'application/json' + }), + style: new udvizBrowser.itowns.Style(layerConfig.style) + }) + ); + }); - udvizBrowser.addElevationLayer( - configs['elevation'], - frame3DPlanar.itownsView, - extent - ); + configs['3DTiles'].forEach((layerConfig) => { + udvizBrowser.itowns.View.prototype.addLayer.call( + frame3DPlanar.itownsView, + new udvizBrowser.itowns.C3DTilesLayer( + layerConfig['id'], + { + name: layerConfig['id'], + source: new udvizBrowser.itowns.C3DTilesSource({ + url: layerConfig['url'] + }) + }, + frame3DPlanar.itownsView + ) + ); + }); - udvizBrowser.addGeoJsonLayers( - configs['geoJSONs'], - frame3DPlanar.itownsView, - extent - ); + const isTextureFormat = + configs['elevation']['format'] == 'image/jpeg' || + configs['elevation']['format'] == 'image/png'; + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ElevationLayer( + configs['elevation']['layer_name'], + { + useColorTextureElevation: isTextureFormat, + colorTextureElevationMinZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMinZ'] + : null, + colorTextureElevationMaxZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMaxZ'] + : null, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + url: configs['elevation']['url'], + name: configs['elevation']['name'], + crs: extent.crs, + heightMapWidth: 256, + format: configs['elevation']['format'] + }) + } + ) + ); + } }); }); diff --git a/examples/GeocodingWidget.html b/examples/GeocodingWidget.html index 03ecd4cc0..6c5e78a6d 100644 --- a/examples/GeocodingWidget.html +++ b/examples/GeocodingWidget.html @@ -39,10 +39,25 @@ // /// ADD LAYERS - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) ); // //// REQUEST SERVICE diff --git a/examples/GuidedTour.html b/examples/GuidedTour.html index a3b92b1f5..db337cd20 100644 --- a/examples/GuidedTour.html +++ b/examples/GuidedTour.html @@ -40,21 +40,67 @@ ); // /// ADD LAYERS - udvizBrowser.add3DTilesLayers( - configs['3DTiles'], - frame3DPlanar.itownsView - ); + configs['3DTiles'].forEach((layerConfig) => { + udvizBrowser.itowns.View.prototype.addLayer.call( + frame3DPlanar.itownsView, + new udvizBrowser.itowns.C3DTilesLayer( + layerConfig['id'], + { + name: layerConfig['id'], + source: new udvizBrowser.itowns.C3DTilesSource({ + url: layerConfig['url'] + }) + }, + frame3DPlanar.itownsView + ) + ); + }); - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) ); - udvizBrowser.addElevationLayer( - configs['elevation'], - frame3DPlanar.itownsView, - extent + const isTextureFormat = + configs['elevation']['format'] == 'image/jpeg' || + configs['elevation']['format'] == 'image/png'; + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ElevationLayer( + configs['elevation']['layer_name'], + { + useColorTextureElevation: isTextureFormat, + colorTextureElevationMinZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMinZ'] + : null, + colorTextureElevationMaxZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMaxZ'] + : null, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + url: configs['elevation']['url'], + name: configs['elevation']['name'], + crs: extent.crs, + heightMapWidth: 256, + format: configs['elevation']['format'] + }) + } + ) ); // REQUEST SERVICE diff --git a/examples/LayerChoiceWidget.html b/examples/LayerChoiceWidget.html index 863d9fcb2..d68e5fe5e 100644 --- a/examples/LayerChoiceWidget.html +++ b/examples/LayerChoiceWidget.html @@ -40,28 +40,83 @@ ); // /// ADD LAYERS - udvizBrowser.add3DTilesLayers( - configs['3DTiles'], - frame3DPlanar.itownsView - ); + configs['3DTiles'].forEach((layerConfig) => { + udvizBrowser.itowns.View.prototype.addLayer.call( + frame3DPlanar.itownsView, + new udvizBrowser.itowns.C3DTilesLayer( + layerConfig['id'], + { + name: layerConfig['id'], + source: new udvizBrowser.itowns.C3DTilesSource({ + url: layerConfig['url'] + }) + }, + frame3DPlanar.itownsView + ) + ); + }); - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) ); - udvizBrowser.addElevationLayer( - configs['elevation'], - frame3DPlanar.itownsView, - extent + const isTextureFormat = + configs['elevation']['format'] == 'image/jpeg' || + configs['elevation']['format'] == 'image/png'; + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ElevationLayer( + configs['elevation']['layer_name'], + { + useColorTextureElevation: isTextureFormat, + colorTextureElevationMinZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMinZ'] + : null, + colorTextureElevationMaxZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMaxZ'] + : null, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + url: configs['elevation']['url'], + name: configs['elevation']['name'], + crs: extent.crs, + heightMapWidth: 256, + format: configs['elevation']['format'] + }) + } + ) ); - udvizBrowser.addGeoJsonLayers( - configs['geoJSONs'], - frame3DPlanar.itownsView, - extent - ); + configs['geoJSONs'].forEach((layerConfig) => { + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer(layerConfig.id, { + name: layerConfig.id, + transparent: true, + source: new udvizBrowser.itowns.FileSource({ + url: layerConfig.url, + crs: extent.crs, + format: 'application/json' + }), + style: new udvizBrowser.itowns.Style(layerConfig.style) + }) + ); + }); // //// LAYER CHOICE MODULE const layerChoice = new udvizBrowser.Widget.LayerChoice( diff --git a/examples/MultiPlanarProcess.html b/examples/MultiPlanarProcess.html index 9246e8aeb..27cb5833b 100644 --- a/examples/MultiPlanarProcess.html +++ b/examples/MultiPlanarProcess.html @@ -61,29 +61,87 @@ } ); multiGame.start(); + // /// ADD LAYERS - udvizBrowser.add3DTilesLayers( - configs['3DTiles'], - multiGame.frame3DPlanar.itownsView - ); + { + multiGame.frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) + ); - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - multiGame.frame3DPlanar.itownsView, - extent - ); + configs['geoJSONs'].forEach((layerConfig) => { + multiGame.frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer(layerConfig.id, { + name: layerConfig.id, + transparent: true, + source: new udvizBrowser.itowns.FileSource({ + url: layerConfig.url, + crs: extent.crs, + format: 'application/json' + }), + style: new udvizBrowser.itowns.Style(layerConfig.style) + }) + ); + }); - udvizBrowser.addElevationLayer( - configs['elevation'], - multiGame.frame3DPlanar.itownsView, - extent - ); + configs['3DTiles'].forEach((layerConfig) => { + udvizBrowser.itowns.View.prototype.addLayer.call( + multiGame.frame3DPlanar.itownsView, + new udvizBrowser.itowns.C3DTilesLayer( + layerConfig['id'], + { + name: layerConfig['id'], + source: new udvizBrowser.itowns.C3DTilesSource({ + url: layerConfig['url'] + }) + }, + multiGame.frame3DPlanar.itownsView + ) + ); + }); - udvizBrowser.addGeoJsonLayers( - configs['geoJSONs'], - multiGame.frame3DPlanar.itownsView, - extent - ); + const isTextureFormat = + configs['elevation']['format'] == 'image/jpeg' || + configs['elevation']['format'] == 'image/png'; + multiGame.frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ElevationLayer( + configs['elevation']['layer_name'], + { + useColorTextureElevation: isTextureFormat, + colorTextureElevationMinZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMinZ'] + : null, + colorTextureElevationMaxZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMaxZ'] + : null, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + url: configs['elevation']['url'], + name: configs['elevation']['name'], + crs: extent.crs, + heightMapWidth: 256, + format: configs['elevation']['format'] + }) + } + ) + ); + } }); }); }); diff --git a/examples/TemporalWidget.html b/examples/TemporalWidget.html index 542a2e8f7..e77350a1d 100644 --- a/examples/TemporalWidget.html +++ b/examples/TemporalWidget.html @@ -39,16 +39,51 @@ configs['frame3D_planars'][2] ); - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) ); - udvizBrowser.addElevationLayer( - configs['elevation'], - frame3DPlanar.itownsView, - extent + const isTextureFormat = + configs['elevation']['format'] == 'image/jpeg' || + configs['elevation']['format'] == 'image/png'; + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ElevationLayer( + configs['elevation']['layer_name'], + { + useColorTextureElevation: isTextureFormat, + colorTextureElevationMinZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMinZ'] + : null, + colorTextureElevationMaxZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMaxZ'] + : null, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + url: configs['elevation']['url'], + name: configs['elevation']['name'], + crs: extent.crs, + heightMapWidth: 256, + format: configs['elevation']['format'] + }) + } + ) ); udvizBrowser.Widget.Temporal.add3DTilesTemporalFromConfig( diff --git a/examples/WorldMap.html b/examples/WorldMap.html index 1259e9eb8..782ef5d0a 100644 --- a/examples/WorldMap.html +++ b/examples/WorldMap.html @@ -31,10 +31,25 @@ ); // /// ADD LAYER - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) ); }); diff --git a/examples/ZeppelinGame.html b/examples/ZeppelinGame.html index e29ff7180..ac2a7d4cd 100644 --- a/examples/ZeppelinGame.html +++ b/examples/ZeppelinGame.html @@ -262,28 +262,85 @@ game.start(); // /// ADD LAYERS - udvizBrowser.add3DTilesLayers( - configs['3DTiles'], - frame3DPlanar.itownsView - ); - - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent - ); - - udvizBrowser.addElevationLayer( - configs['elevation'], - frame3DPlanar.itownsView, - extent - ); - - udvizBrowser.addGeoJsonLayers( - configs['geoJSONs'], - frame3DPlanar.itownsView, - extent - ); + { + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) + ); + + configs['geoJSONs'].forEach((layerConfig) => { + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer(layerConfig.id, { + name: layerConfig.id, + transparent: true, + source: new udvizBrowser.itowns.FileSource({ + url: layerConfig.url, + crs: extent.crs, + format: 'application/json' + }), + style: new udvizBrowser.itowns.Style(layerConfig.style) + }) + ); + }); + + configs['3DTiles'].forEach((layerConfig) => { + udvizBrowser.itowns.View.prototype.addLayer.call( + frame3DPlanar.itownsView, + new udvizBrowser.itowns.C3DTilesLayer( + layerConfig['id'], + { + name: layerConfig['id'], + source: new udvizBrowser.itowns.C3DTilesSource({ + url: layerConfig['url'] + }) + }, + frame3DPlanar.itownsView + ) + ); + }); + + const isTextureFormat = + configs['elevation']['format'] == 'image/jpeg' || + configs['elevation']['format'] == 'image/png'; + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ElevationLayer( + configs['elevation']['layer_name'], + { + useColorTextureElevation: isTextureFormat, + colorTextureElevationMinZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMinZ'] + : null, + colorTextureElevationMaxZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMaxZ'] + : null, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + url: configs['elevation']['url'], + name: configs['elevation']['name'], + crs: extent.crs, + heightMapWidth: 256, + format: configs['elevation']['format'] + }) + } + ) + ); + } }); }); diff --git a/examples/assets/js/C3DTilesEditor.js b/examples/assets/js/C3DTilesEditor.js index 009f9c3ec..e6b2e062d 100644 --- a/examples/assets/js/C3DTilesEditor.js +++ b/examples/assets/js/C3DTilesEditor.js @@ -109,38 +109,138 @@ const C3DTilesEditor = class { */ addLayers(configs) { if (configs.$3DTiles) { - udvizBrowser.add3DTilesLayers( - configs.$3DTiles, - this.frame3DPlanar.itownsView - ); + configs.$3DTiles.forEach((layerConfig) => { + udvizBrowser.itowns.View.prototype.addLayer.call( + this.frame3DPlanar.itownsView, + new udvizBrowser.itowns.C3DTilesLayer( + layerConfig['id'], + { + style: this.c3DTilesStyle, + name: layerConfig['id'], + source: new udvizBrowser.itowns.C3DTilesSource({ + url: layerConfig['url'], + }), + }, + this.frame3DPlanar.itownsView + ) + ); + }); } if (configs.elevation) { - udvizBrowser.addElevationLayer( - configs.elevation, - this.frame3DPlanar.itownsView, - this.extent + const isTextureFormat = + configs.elevation['format'] == 'image/jpeg' || + configs.elevation['format'] == 'image/png'; + this.frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ElevationLayer( + configs.elevation['layer_name'], + { + useColorTextureElevation: isTextureFormat, + colorTextureElevationMinZ: isTextureFormat + ? configs.elevation['colorTextureElevationMinZ'] + : null, + colorTextureElevationMaxZ: isTextureFormat + ? configs.elevation['colorTextureElevationMaxZ'] + : null, + source: new udvizBrowser.itowns.WMSSource({ + extent: this.extent, + url: configs.elevation['url'], + name: configs.elevation['name'], + crs: this.extent.crs, + heightMapWidth: 256, + format: configs.elevation['format'], + }), + } + ) ); } if (configs.baseMap) { - udvizBrowser.addBaseMapLayer( - configs.baseMap, - this.frame3DPlanar.itownsView, - this.extent + this.frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer(configs.baseMap['layer_name'], { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {}, + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: this.extent, + name: configs.baseMap['name'], + url: configs.baseMap['url'], + version: configs.baseMap['version'], + crs: this.extent.crs, + format: configs.baseMap['format'], + }), + transparent: true, + }) ); } if (configs.labels) { - udvizBrowser.addLabelLayers( - configs.labels, - this.frame3DPlanar.itownsView, - this.extent - ); + configs.labels.forEach((layerConfig) => { + if ( + !layerConfig['id'] || + !layerConfig['url'] || + !layerConfig['sourceType'] + ) { + console.warn( + 'Your "LabelLayer" field does not have either "url", "id" or "sourceType" properties. ' + ); + return; + } + + let source = null; + + // Declare the data source for the LabelLayer + if (layerConfig['sourceType'] == 'file') { + source = new udvizBrowser.itowns.FileSource({ + url: layerConfig.url, + crs: this.extent.crs, + format: 'application/json', + }); + } else if (layerConfig['sourceType'] == 'wfs') { + source = new udvizBrowser.itowns.WFSSource({ + url: layerConfig.url, + version: '2.0.0', + typeName: layerConfig.name, + crs: this.extent.crs, + format: 'application/json', + }); + } else { + console.warn( + 'Unsupported LabelLayer sourceType ' + layerConfig['sourceType'] + ); + return; + } + + const layerStyle = new udvizBrowser.itowns.Style(layerConfig.style); + + const zoom = { min: 0 }; + if (layerConfig.zoom) { + if (layerConfig.zoom.min) zoom.min = layerConfig.zoom.min; + if (layerConfig.zoom.max) zoom.max = layerConfig.zoom.max; + } + + const labelLayer = new udvizBrowser.itowns.LabelLayer(layerConfig.id, { + transparent: true, + source: source, + style: layerStyle, + zoom: zoom, + }); + this.frame3DPlanar.itownsView.addLayer(labelLayer); + }); } if (configs.geoJSON) { - udvizBrowser.addGeoJsonLayers( - configs.geoJSON, - this.frame3DPlanar.itownsView, - this.extent - ); + configs.geoJSON.forEach((layerConfig) => { + this.frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer(layerConfig.id, { + name: layerConfig.id, + transparent: true, + source: new udvizBrowser.itowns.FileSource({ + url: layerConfig.url, + crs: this.extent.crs, + format: 'application/json', + }), + style: new udvizBrowser.itowns.Style(layerConfig.style), + }) + ); + }); } } }; diff --git a/examples/assets/js/ShowRoom.js b/examples/assets/js/ShowRoom.js index 0bbcd4cfd..2723899c2 100644 --- a/examples/assets/js/ShowRoom.js +++ b/examples/assets/js/ShowRoom.js @@ -137,50 +137,137 @@ const ShowRoom = class { addLayers(configs) { if (configs.$3DTiles) { configs.$3DTiles.forEach((layerConfig) => { - const c3DTilesLayer = new udvizBrowser.itowns.C3DTilesLayer( - layerConfig['id'], - { - style: this.c3DTilesStyle, - name: layerConfig['id'], - source: new udvizBrowser.itowns.C3DTilesSource({ - url: layerConfig['url'], - }), - }, - this.frame3DPlanar.itownsView - ); udvizBrowser.itowns.View.prototype.addLayer.call( this.frame3DPlanar.itownsView, - c3DTilesLayer + new udvizBrowser.itowns.C3DTilesLayer( + layerConfig['id'], + { + style: this.c3DTilesStyle, + name: layerConfig['id'], + source: new udvizBrowser.itowns.C3DTilesSource({ + url: layerConfig['url'], + }), + }, + this.frame3DPlanar.itownsView + ) ); }); } if (configs.elevation) { - udvizBrowser.addElevationLayer( - configs.elevation, - this.frame3DPlanar.itownsView, - this.extent + const isTextureFormat = + configs.elevation['format'] == 'image/jpeg' || + configs.elevation['format'] == 'image/png'; + this.frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ElevationLayer( + configs.elevation['layer_name'], + { + useColorTextureElevation: isTextureFormat, + colorTextureElevationMinZ: isTextureFormat + ? configs.elevation['colorTextureElevationMinZ'] + : null, + colorTextureElevationMaxZ: isTextureFormat + ? configs.elevation['colorTextureElevationMaxZ'] + : null, + source: new udvizBrowser.itowns.WMSSource({ + extent: this.extent, + url: configs.elevation['url'], + name: configs.elevation['name'], + crs: this.extent.crs, + heightMapWidth: 256, + format: configs.elevation['format'], + }), + } + ) ); } if (configs.baseMap) { - udvizBrowser.addBaseMapLayer( - configs.baseMap, - this.frame3DPlanar.itownsView, - this.extent + this.frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer(configs.baseMap['layer_name'], { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {}, + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: this.extent, + name: configs.baseMap['name'], + url: configs.baseMap['url'], + version: configs.baseMap['version'], + crs: this.extent.crs, + format: configs.baseMap['format'], + }), + transparent: true, + }) ); } if (configs.labels) { - udvizBrowser.addLabelLayers( - configs.labels, - this.frame3DPlanar.itownsView, - this.extent - ); + configs.labels.forEach((layerConfig) => { + if ( + !layerConfig['id'] || + !layerConfig['url'] || + !layerConfig['sourceType'] + ) { + console.warn( + 'Your "LabelLayer" field does not have either "url", "id" or "sourceType" properties. ' + ); + return; + } + + let source = null; + + // Declare the data source for the LabelLayer + if (layerConfig['sourceType'] == 'file') { + source = new udvizBrowser.itowns.FileSource({ + url: layerConfig.url, + crs: this.extent.crs, + format: 'application/json', + }); + } else if (layerConfig['sourceType'] == 'wfs') { + source = new udvizBrowser.itowns.WFSSource({ + url: layerConfig.url, + version: '2.0.0', + typeName: layerConfig.name, + crs: this.extent.crs, + format: 'application/json', + }); + } else { + console.warn( + 'Unsupported LabelLayer sourceType ' + layerConfig['sourceType'] + ); + return; + } + + const layerStyle = new udvizBrowser.itowns.Style(layerConfig.style); + + const zoom = { min: 0 }; + if (layerConfig.zoom) { + if (layerConfig.zoom.min) zoom.min = layerConfig.zoom.min; + if (layerConfig.zoom.max) zoom.max = layerConfig.zoom.max; + } + + const labelLayer = new udvizBrowser.itowns.LabelLayer(layerConfig.id, { + transparent: true, + source: source, + style: layerStyle, + zoom: zoom, + }); + this.frame3DPlanar.itownsView.addLayer(labelLayer); + }); } if (configs.geoJSON) { - udvizBrowser.addGeoJsonLayers( - configs.geoJSON, - this.frame3DPlanar.itownsView, - this.extent - ); + configs.geoJSON.forEach((layerConfig) => { + this.frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer(layerConfig.id, { + name: layerConfig.id, + transparent: true, + source: new udvizBrowser.itowns.FileSource({ + url: layerConfig.url, + crs: this.extent.crs, + format: 'application/json', + }), + style: new udvizBrowser.itowns.Style(layerConfig.style), + }) + ); + }); } } diff --git a/examples/dom_element_3D.html b/examples/dom_element_3D.html index a5fcdc1f9..bd2206e3d 100644 --- a/examples/dom_element_3D.html +++ b/examples/dom_element_3D.html @@ -40,28 +40,83 @@ ); // add layers - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) ); - udvizBrowser.addElevationLayer( - configs['elevation'], - frame3DPlanar.itownsView, - extent + const isTextureFormat = + configs['elevation']['format'] == 'image/jpeg' || + configs['elevation']['format'] == 'image/png'; + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ElevationLayer( + configs['elevation']['layer_name'], + { + useColorTextureElevation: isTextureFormat, + colorTextureElevationMinZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMinZ'] + : null, + colorTextureElevationMaxZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMaxZ'] + : null, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + url: configs['elevation']['url'], + name: configs['elevation']['name'], + crs: extent.crs, + heightMapWidth: 256, + format: configs['elevation']['format'] + }) + } + ) ); - udvizBrowser.add3DTilesLayers( - configs['3DTiles'], - frame3DPlanar.itownsView - ); + configs['3DTiles'].forEach((layerConfig) => { + udvizBrowser.itowns.View.prototype.addLayer.call( + frame3DPlanar.itownsView, + new udvizBrowser.itowns.C3DTilesLayer( + layerConfig['id'], + { + name: layerConfig['id'], + source: new udvizBrowser.itowns.C3DTilesSource({ + url: layerConfig['url'] + }) + }, + frame3DPlanar.itownsView + ) + ); + }); - udvizBrowser.addGeoJsonLayers( - configs['geoJSONs'], - frame3DPlanar.itownsView, - extent - ); + configs['geoJSONs'].forEach((layerConfig) => { + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer(layerConfig.id, { + name: layerConfig.id, + transparent: true, + source: new udvizBrowser.itowns.FileSource({ + url: layerConfig.url, + crs: extent.crs, + format: 'application/json' + }), + style: new udvizBrowser.itowns.Style(layerConfig.style) + }) + ); + }); const center = extent.center(); diff --git a/examples/widget_planar_controls.html b/examples/widget_planar_controls.html index 1867011f3..1c94b5d54 100644 --- a/examples/widget_planar_controls.html +++ b/examples/widget_planar_controls.html @@ -39,10 +39,25 @@ // /// ADD LAYERS - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) ); const widget = new udvizBrowser.Widget.PlanarControls( diff --git a/packages/browser/src/ItownsUtil.js b/packages/browser/src/ItownsUtil.js index 17e832c67..3676d84c4 100644 --- a/packages/browser/src/ItownsUtil.js +++ b/packages/browser/src/ItownsUtil.js @@ -1,352 +1,8 @@ -// If functions declare here are needed by widgets these functions should be propose to itowns -// If not this function are just meant to be use in an @ud-viz/browser eg in Template +// Everything there should be contributed at some point in itowns const THREE = require('three'); const itowns = require('itowns'); -/** ADD LAYER TO ITOWNS VIEW FROM CONFIG */ - -/** - * It creates a 3D Tiles layer, - * and adds it to the layer manager - * - * @param {*} layer - the layer object from the config file - * @param {itowns.View} itownsView - the itowns view - * @param {object} extensions - optional extensions - * @returns {itowns.C3DTilesLayer} A 3D Tiles Layer - */ -export function createC3DTilesLayer(layer, itownsView, extensions = null) { - if (!layer['id'] || !layer['url']) { - throw ( - 'Your layer does not have url id properties or both. ' + - '(in UD-Viz/UD-Viz-Shared/examples/data/config/generalDemoConfig.json)' - ); - } - - /** @type {itowns.C3DTilesLayer} */ - const $3dTilesLayer = new itowns.C3DTilesLayer( - layer['id'], - { - name: layer['id'], - source: new itowns.C3DTilesSource({ - url: layer['url'], - }), - registeredExtensions: extensions, - }, - itownsView - ); - - if (layer['pc_size']) { - // this is a point cloud 3DTiles - $3dTilesLayer.material = new THREE.PointsMaterial({ - size: layer['pc_size'], - vertexColors: true, - }); - // .material is the overrideMaterial of a point cloud 3DTiles - } - - return $3dTilesLayer; -} - -/** - * Setup and add 3D tiles to an itowns view - * - * @param {object} config3DTilesLayers An object containing 3D Tiles layers configs - * @param {itowns.View} itownsView - the itowns view - */ -export function add3DTilesLayers(config3DTilesLayers, itownsView) { - // Positional arguments verification - if (!config3DTilesLayers) { - console.warn('no 3DTilesLayers config'); - return; - } - for (const layer of config3DTilesLayers) { - itowns.View.prototype.addLayer.call( - itownsView, - createC3DTilesLayer(layer, itownsView) - ); - } -} - -/** - * Sets up a GeoJson layers and adds them to the itowns view (for the demos - * that don't need more granularity than that). - * - * @param {object} configGeoJSONLayers An object containing GeoJSON layers configs - * @param {itowns.View} itownsView - the itowns view - * @param {itowns.Extent} extent extent of the view - */ -export function addGeoJsonLayers(configGeoJSONLayers, itownsView, extent) { - // Positional arguments verification - if (!configGeoJSONLayers) { - console.warn('No "GeoJSONLayers" field in the configuration file'); - return; - } - /** - * Create an iTowns GeoJson layer based on the specified layerConfig. - * - * @param {string} layerConfig The name of the layer to setup from the - * all_widget_config.json config file (should be one of the properties - * of the GeoJsonLayer object in - * UD-Viz/examples/config/all_widget_config.json - * config file). - */ - const setupAndAddGeoJsonLayer = function (layerConfig) { - if (!layerConfig['id'] || !layerConfig['url']) { - console.warn( - 'Your "GeoJsonLayer" field does not have either "url" or "id" properties. ' + - '(in UD-Viz/examples/config/all_widget_config.json)' - ); - return; - } - - // Declare the data source for the layerConfig - const source = new itowns.FileSource({ - url: layerConfig.url, - crs: extent.crs, - format: 'application/json', - }); - - const layerStyle = new itowns.Style(layerConfig.style); - - const geojsonLayer = new itowns.ColorLayer(layerConfig.id, { - name: layerConfig.id, - transparent: true, - source: source, - style: layerStyle, - }); - itownsView.addLayer(geojsonLayer); - }; - - for (const layer of configGeoJSONLayers) { - setupAndAddGeoJsonLayer(layer); - } -} - -/** - * Sets up LabelLayers and adds them to the itowns view. - * The source of a LabelLayer can be either a WFS source or a File source. - * The features in the source must be Point geometries. - * - * @param {object} configLabelLayers An object containing layers configs - * @param {itowns.View} itownsView - the itowns view - * @param {itowns.Extent} extent extent of the view - */ -export function addLabelLayers(configLabelLayers, itownsView, extent) { - // Positional arguments verification - if (!configLabelLayers) { - console.warn('No "labelLayers" field in the configuration file'); - return; - } - /** - * Create an iTowns LabelLayer based on the specified layerConfig. - * - * @param {object} layerConfig The JSON config of the layer - * @param {string} layerConfig.id The ID of the layer - * @param {string} layerConfig.sourceType The type of the source, should be either "file" or "wfs" - * @param {object} layerConfig.style The iTowns style of the label layer - * @param {string} layerConfig.url The URL of the layer - * @param {string} layerConfig.name If the source is WFS, the name of the source - * @param {object} layerConfig.zoom The min/max zoom to display the layer - */ - const setupAndAddLabelLayer = function (layerConfig) { - if ( - !layerConfig['id'] || - !layerConfig['url'] || - !layerConfig['sourceType'] - ) { - console.warn( - 'Your "LabelLayer" field does not have either "url", "id" or "sourceType" properties. ' - ); - return; - } - - let source = null; - - // Declare the data source for the LabelLayer - if (layerConfig['sourceType'] == 'file') { - source = new itowns.FileSource({ - url: layerConfig.url, - crs: extent.crs, - format: 'application/json', - }); - } else if (layerConfig['sourceType'] == 'wfs') { - source = new itowns.WFSSource({ - url: layerConfig.url, - version: '2.0.0', - typeName: layerConfig.name, - crs: extent.crs, - format: 'application/json', - }); - } else { - console.warn( - 'Unsupported LabelLayer sourceType ' + layerConfig['sourceType'] - ); - return; - } - - const layerStyle = new itowns.Style(layerConfig.style); - - const zoom = { min: 0 }; - if (layerConfig.zoom) { - if (layerConfig.zoom.min) zoom.min = layerConfig.zoom.min; - if (layerConfig.zoom.max) zoom.max = layerConfig.zoom.max; - } - - const labelLayer = new itowns.LabelLayer(layerConfig.id, { - transparent: true, - source: source, - style: layerStyle, - zoom: zoom, - }); - itownsView.addLayer(labelLayer); - }; - - for (const layer of configLabelLayers) { - setupAndAddLabelLayer(layer); - } -} - -/** - * Add Base map layer to an itowns view - * - * @param {object} baseMapLayerConfig An object with the config of the base map - * @param {itowns.View} itownsView The iTowns view - * @param {itowns.Extent} extent extent of the view - */ -export function addBaseMapLayer(baseMapLayerConfig, itownsView, extent) { - if (!baseMapLayerConfig) { - console.warn('No baseMap config '); - return; - } - - if (!baseMapLayerConfig.name) { - console.warn('no name in baseMap config'); - return; - } - - if (!baseMapLayerConfig.url) { - console.warn('no url in baseMap config'); - return; - } - - if (!baseMapLayerConfig.version) { - console.warn('no version in baseMap config'); - return; - } - - if (!baseMapLayerConfig.format) { - console.warn('no format in baseMap config'); - return; - } - - const wmsImagerySource = new itowns.WMSSource({ - extent: extent, - name: baseMapLayerConfig['name'], - url: baseMapLayerConfig['url'], - version: baseMapLayerConfig['version'], - crs: extent.crs, - format: baseMapLayerConfig['format'], - }); - - if (!baseMapLayerConfig.layer_name) { - console.warn('no layer_name in baseMap config'); - return; - } - - // Add a WMS imagery layer - const wmsImageryLayer = new itowns.ColorLayer( - baseMapLayerConfig['layer_name'], - { - updateStrategy: { - type: itowns.STRATEGY_DICHOTOMY, - options: {}, - }, - source: wmsImagerySource, - transparent: true, - } - ); - itownsView.addLayer(wmsImageryLayer); -} - -/** - * Add Elevation map layer to an itowns view - * - * @param {object} configElevationLayer An object with the config of the elevation layer - * @param {itowns.View} itownsView The iTowns view - * @param {itowns.Extent} extent extent of the view - */ -export function addElevationLayer(configElevationLayer, itownsView, extent) { - if (!configElevationLayer) { - console.warn('No "ElevationLayer" field in the configuration file'); - return; - } - - // Url check - if (!configElevationLayer['url']) { - console.warn('Need an url in elevation_layer config'); - return; - } - - // Name check - if (!configElevationLayer['name']) { - console.warn('Need a name in elevation_layer config'); - return; - } - - // Format check - if (!configElevationLayer['format']) { - console.warn('Need a format in elevation_layer config'); - return; - } - const isTextureFormat = - configElevationLayer['format'] == 'image/jpeg' || - configElevationLayer['format'] == 'image/png'; - - // ColorTextureElevationMinZ check - if (isTextureFormat && !configElevationLayer['colorTextureElevationMinZ']) { - console.warn('Need a colorTextureElevationMinZ in elevation_layer config'); - return; - } - - // ColorTextureElevationMaxZ check - if (isTextureFormat && !configElevationLayer['colorTextureElevationMaxZ']) { - console.warn('Need a colorTextureElevationMaxZ in elevation_layer config'); - return; - } - - // Layer_name check - if (!configElevationLayer['layer_name']) { - console.warn('Need a layer_name in elevation_layer config'); - return; - } - - // Add a WMS elevation source - const wmsElevationSource = new itowns.WMSSource({ - extent: extent, - url: configElevationLayer['url'], - name: configElevationLayer['name'], - crs: extent.crs, - heightMapWidth: 256, - format: configElevationLayer['format'], - }); - - const elevationLayerConfig = { source: wmsElevationSource }; - if (isTextureFormat) { - elevationLayerConfig['useColorTextureElevation'] = true; - elevationLayerConfig['colorTextureElevationMinZ'] = - configElevationLayer['colorTextureElevationMinZ']; - elevationLayerConfig['colorTextureElevationMaxZ'] = - configElevationLayer['colorTextureElevationMaxZ']; - } - // Add a WMS elevation layer - const wmsElevationLayer = new itowns.ElevationLayer( - configElevationLayer['layer_name'], - elevationLayerConfig - ); - itownsView.addLayer(wmsElevationLayer); -} - /** CAMERA */ /** diff --git a/packages/browser/src/Widget/Temporal/Temporal.js b/packages/browser/src/Widget/Temporal/Temporal.js index 9aaedb38c..e2db638b3 100644 --- a/packages/browser/src/Widget/Temporal/Temporal.js +++ b/packages/browser/src/Widget/Temporal/Temporal.js @@ -3,7 +3,6 @@ import { $3DTemporalBoundingVolume } from './Model/3DTemporalBoundingVolume'; import { $3DTemporalTileset } from './Model/3DTemporalTileset'; import * as itownsWidget from 'itowns/widgets'; import * as itowns from 'itowns'; -import { createC3DTilesLayer } from '../../ItownsUtil'; /** * @@ -57,7 +56,17 @@ export function add3DTilesTemporalFromConfig(config, itownsView) { const extensions = create3DTilesTemporalExtension(layer['extensions']); itowns.View.prototype.addLayer.call( itownsView, - createC3DTilesLayer(layer, itownsView, extensions) + new itowns.C3DTilesLayer( + layer['id'], + { + name: layer['id'], + source: new itowns.C3DTilesSource({ + url: layer['url'], + }), + registeredExtensions: extensions, + }, + itownsView + ) ); } } From af8e3c32b9fea79120fc118d038f0d23e0185d49 Mon Sep 17 00:00:00 2001 From: valentinMachado Date: Thu, 13 Jul 2023 15:06:19 +0200 Subject: [PATCH 2/6] clean(config) remove color attributes in 3DTiles layer config --- examples/assets/config/layer/3DTiles.json | 24 +++++++------------ .../assets/config/layer/3DTiles_temporal.json | 3 +-- .../assets/config/layer/doua_temporal.json | 1 - 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/examples/assets/config/layer/3DTiles.json b/examples/assets/config/layer/3DTiles.json index b81a7bf5b..e05ffc630 100644 --- a/examples/assets/config/layer/3DTiles.json +++ b/examples/assets/config/layer/3DTiles.json @@ -1,42 +1,34 @@ [ { "id": "Lyon-1", - "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/2015/Lyon-1_2015/tileset.json", - "color": "0xFFFFFF" + "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/2015/Lyon-1_2015/tileset.json" }, { "id": "Lyon-2", - "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/2015/Lyon-2_2015/tileset.json", - "color": "0xFFFFFF" + "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/2015/Lyon-2_2015/tileset.json" }, { "id": "Lyon-3", - "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/2015/Lyon-3_2015/tileset.json", - "color": "0xFFFFFF" + "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/2015/Lyon-3_2015/tileset.json" }, { "id": "Lyon-4", - "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/2015/Lyon-4_2015/tileset.json", - "color": "0xFFFFFF" + "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/2015/Lyon-4_2015/tileset.json" }, { "id": "Lyon-5", - "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/2015/Lyon-5_2015/tileset.json", - "color": "0xFFFFFF" + "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/2015/Lyon-5_2015/tileset.json" }, { "id": "Lyon-6", - "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/2015/Lyon-6_2015/tileset.json", - "color": "0xFFFFFF" + "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/2015/Lyon-6_2015/tileset.json" }, { "id": "Lyon-7", - "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/2015/Lyon-7_2015/tileset.json", - "color": "0xFFFFFF" + "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/2015/Lyon-7_2015/tileset.json" }, { "id": "Lyon-8", - "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/2015/Lyon-8_2015/tileset.json", - "color": "0xFFFFFF" + "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/2015/Lyon-8_2015/tileset.json" } ] diff --git a/examples/assets/config/layer/3DTiles_temporal.json b/examples/assets/config/layer/3DTiles_temporal.json index 8fe2460c3..62509849b 100644 --- a/examples/assets/config/layer/3DTiles_temporal.json +++ b/examples/assets/config/layer/3DTiles_temporal.json @@ -2,7 +2,6 @@ { "id": "Lyon-1-temporal", "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/Temporal/Lyon1er_Temporal-2009-2012-2015_TileSet/tileset.json", - "extensions": ["3DTILES_temporal"], - "color": "0xFFFFFF" + "extensions": ["3DTILES_temporal"] } ] diff --git a/examples/assets/config/layer/doua_temporal.json b/examples/assets/config/layer/doua_temporal.json index 315a260d4..1bf5c2380 100644 --- a/examples/assets/config/layer/doua_temporal.json +++ b/examples/assets/config/layer/doua_temporal.json @@ -2,7 +2,6 @@ { "id": "La Doua temporel", "url": "https://dataset-dl.liris.cnrs.fr/three-d-tiles-lyon-metropolis/Temporal/la-doua_2009-2018-temporal_tileset/tileset.json", - "color": "0xFFFFFF", "extensions": ["3DTILES_temporal"] } ] From 4953cd8b8dc28d1d0a2872b2a9a474c61c54e11c Mon Sep 17 00:00:00 2001 From: Mathieu Livebardon Date: Mon, 17 Jul 2023 11:21:41 +0200 Subject: [PATCH 3/6] update:prettier check --- examples/2DVisualization.html | 18 +++---- examples/3DTilesPointCloud.html | 14 +++--- examples/3DTilesWidget.html | 14 +++--- examples/3DTilesWireframe.html | 16 +++--- examples/AddLayersFromConfig.html | 20 ++++---- examples/Authentification.html | 2 +- examples/AvatarGame.html | 56 ++++++++++----------- examples/AvatarGameShader.html | 58 ++++++++++----------- examples/BaseMapWidget.html | 8 +-- examples/C3DTilesEditor.html | 4 +- examples/C3DTilesLayerStyle.html | 12 ++--- examples/CameraPositionerWidget.html | 8 +-- examples/DocumentWidget.html | 16 +++--- examples/DragAndDropAvatar.html | 42 ++++++++-------- examples/GeocodingWidget.html | 8 +-- examples/GuidedTour.html | 16 +++--- examples/LayerChoiceWidget.html | 20 ++++---- examples/MultiPlanarProcess.html | 26 +++++----- examples/SPARQLWidget.html | 2 +- examples/SlideShowWidget.html | 4 +- examples/TemporalWidget.html | 12 ++--- examples/WorldMap.html | 8 +-- examples/ZeppelinGame.html | 70 +++++++++++++------------- examples/assets/css/loadingScreen.css | 2 +- examples/assets/css/widget_3dtiles.css | 2 +- examples/assets/md/about.md | 13 +++-- examples/assets/md/help.md | 14 +++--- examples/dom_element_3D.html | 20 ++++---- examples/show_room.html | 8 +-- examples/widget_planar_controls.html | 8 +-- 30 files changed, 260 insertions(+), 261 deletions(-) diff --git a/examples/2DVisualization.html b/examples/2DVisualization.html index 02ce1f764..5983d117d 100644 --- a/examples/2DVisualization.html +++ b/examples/2DVisualization.html @@ -17,7 +17,7 @@ './assets/config/frame3D_planars.json', './assets/config/layer/base_maps.json', './assets/config/layer/elevation.json', - './assets/config/layer/3DTiles.json' + './assets/config/layer/3DTiles.json', ]) .then((configs) => { udvizBrowser.proj4.default.defs( @@ -45,7 +45,7 @@ { updateStrategy: { type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, - options: {} + options: {}, }, source: new udvizBrowser.itowns.WMSSource({ extent: extent, @@ -53,9 +53,9 @@ url: configs['base_maps'][0]['url'], version: configs['base_maps'][0]['version'], crs: extent.crs, - format: configs['base_maps'][0]['format'] + format: configs['base_maps'][0]['format'], }), - transparent: true + transparent: true, } ) ); @@ -81,8 +81,8 @@ name: configs['elevation']['name'], crs: extent.crs, heightMapWidth: 256, - format: configs['elevation']['format'] - }) + format: configs['elevation']['format'], + }), } ) ); @@ -96,8 +96,8 @@ { name: layerConfig['id'], source: new udvizBrowser.itowns.C3DTilesSource({ - url: layerConfig['url'] - }) + url: layerConfig['url'], + }), }, frame3DPlanar.itownsView ) @@ -129,7 +129,7 @@ for (const [ // eslint-disable-next-line no-unused-vars batchId, - c3DTFeature + c3DTFeature, ] of tileContent.layer.tilesC3DTileFeatures.get( tileContent.tileId )) { diff --git a/examples/3DTilesPointCloud.html b/examples/3DTilesPointCloud.html index ce55bc27e..3a05de921 100644 --- a/examples/3DTilesPointCloud.html +++ b/examples/3DTilesPointCloud.html @@ -16,7 +16,7 @@ './assets/config/crs.json', './assets/config/frame3D_planars.json', './assets/config/layer/3DTiles_point_cloud.json', - './assets/config/layer/base_maps.json' + './assets/config/layer/base_maps.json', ]) .then((configs) => { udvizBrowser.proj4.default.defs( @@ -44,7 +44,7 @@ { updateStrategy: { type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, - options: {} + options: {}, }, source: new udvizBrowser.itowns.WMSSource({ extent: extent, @@ -52,9 +52,9 @@ url: configs['base_maps'][0]['url'], version: configs['base_maps'][0]['version'], crs: extent.crs, - format: configs['base_maps'][0]['format'] + format: configs['base_maps'][0]['format'], }), - transparent: true + transparent: true, } ) ); @@ -64,8 +64,8 @@ { name: configs['3DTiles_point_cloud'][0]['id'], source: new udvizBrowser.itowns.C3DTilesSource({ - url: configs['3DTiles_point_cloud'][0]['url'] - }) + url: configs['3DTiles_point_cloud'][0]['url'], + }), }, frame3DPlanar.itownsView ); @@ -73,7 +73,7 @@ // hack (not declare in C3DTilesLayer) to override point cloud material pointCloudLayer.material = new udvizBrowser.THREE.PointsMaterial({ size: configs['3DTiles_point_cloud'][0]['pc_size'], - vertexColors: true + vertexColors: true, }); udvizBrowser.itowns.View.prototype.addLayer.call( frame3DPlanar.itownsView, diff --git a/examples/3DTilesWidget.html b/examples/3DTilesWidget.html index 15dc54c48..611f77a62 100644 --- a/examples/3DTilesWidget.html +++ b/examples/3DTilesWidget.html @@ -16,7 +16,7 @@ './assets/config/extents.json', './assets/config/crs.json', './assets/config/frame3D_planars.json', - './assets/config/layer/3DTiles.json' + './assets/config/layer/3DTiles.json', ]) .then((configs) => { udvizBrowser.proj4.default.defs( @@ -43,8 +43,8 @@ return feature.userData.selectedColor ? feature.userData.selectedColor : 'white'; - } - } + }, + }, }); // create 3DTilesLayers @@ -55,8 +55,8 @@ style: style, name: layerConfig['id'], source: new udvizBrowser.itowns.C3DTilesSource({ - url: layerConfig['url'] - }) + url: layerConfig['url'], + }), }, frame3DPlanar.itownsView ); @@ -74,7 +74,7 @@ layerContainerClassName: 'widgets-3dtiles-layer-container', c3DTFeatureInfoContainerClassName: 'widgets-3dtiles-feature-container', - urlContainerClassName: 'widgets-3dtiles-url-container' + urlContainerClassName: 'widgets-3dtiles-url-container', } ); widget.domElement.setAttribute('id', 'widgets-3dtiles'); @@ -82,7 +82,7 @@ // add on click behavior const contextSelection = { feature: null, - layer: null + layer: null, }; frame3DPlanar.domElement.onclick = (event) => { if (contextSelection.feature) { diff --git a/examples/3DTilesWireframe.html b/examples/3DTilesWireframe.html index b8b70c4b1..0aa2fdf96 100644 --- a/examples/3DTilesWireframe.html +++ b/examples/3DTilesWireframe.html @@ -17,7 +17,7 @@ './assets/config/frame3D_planars.json', './assets/config/layer/3DTiles.json', './assets/config/layer/base_maps.json', - './assets/config/layer/elevation.json' + './assets/config/layer/elevation.json', ]) .then((configs) => { udvizBrowser.proj4.default.defs( @@ -45,7 +45,7 @@ { updateStrategy: { type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, - options: {} + options: {}, }, source: new udvizBrowser.itowns.WMSSource({ extent: extent, @@ -53,9 +53,9 @@ url: configs['base_maps'][0]['url'], version: configs['base_maps'][0]['version'], crs: extent.crs, - format: configs['base_maps'][0]['format'] + format: configs['base_maps'][0]['format'], }), - transparent: true + transparent: true, } ) ); @@ -81,8 +81,8 @@ name: configs['elevation']['name'], crs: extent.crs, heightMapWidth: 256, - format: configs['elevation']['format'] - }) + format: configs['elevation']['format'], + }), } ) ); @@ -96,8 +96,8 @@ { name: layerConfig['id'], source: new udvizBrowser.itowns.C3DTilesSource({ - url: layerConfig['url'] - }) + url: layerConfig['url'], + }), }, frame3DPlanar.itownsView ) diff --git a/examples/AddLayersFromConfig.html b/examples/AddLayersFromConfig.html index 692618bbf..1a61e27f1 100644 --- a/examples/AddLayersFromConfig.html +++ b/examples/AddLayersFromConfig.html @@ -18,7 +18,7 @@ './assets/config/layer/base_maps.json', './assets/config/layer/geoJSONs.json', './assets/config/layer/elevation.json', - './assets/config/layer/3DTiles.json' + './assets/config/layer/3DTiles.json', ]) .then((configs) => { udvizBrowser.proj4.default.defs( @@ -47,7 +47,7 @@ { updateStrategy: { type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, - options: {} + options: {}, }, source: new udvizBrowser.itowns.WMSSource({ extent: extent, @@ -55,9 +55,9 @@ url: configs['base_maps'][0]['url'], version: configs['base_maps'][0]['version'], crs: extent.crs, - format: configs['base_maps'][0]['format'] + format: configs['base_maps'][0]['format'], }), - transparent: true + transparent: true, } ) ); @@ -70,9 +70,9 @@ source: new udvizBrowser.itowns.FileSource({ url: layerConfig.url, crs: extent.crs, - format: 'application/json' + format: 'application/json', }), - style: new udvizBrowser.itowns.Style(layerConfig.style) + style: new udvizBrowser.itowns.Style(layerConfig.style), }) ); }); @@ -85,8 +85,8 @@ { name: layerConfig['id'], source: new udvizBrowser.itowns.C3DTilesSource({ - url: layerConfig['url'] - }) + url: layerConfig['url'], + }), }, frame3DPlanar.itownsView ) @@ -113,8 +113,8 @@ name: configs['elevation']['name'], crs: extent.crs, heightMapWidth: 256, - format: configs['elevation']['format'] - }) + format: configs['elevation']['format'], + }), } ) ); diff --git a/examples/Authentification.html b/examples/Authentification.html index ecf926338..d811db5b9 100644 --- a/examples/Authentification.html +++ b/examples/Authentification.html @@ -12,7 +12,7 @@ diff --git a/examples/C3DTilesLayerStyle.html b/examples/C3DTilesLayerStyle.html index 3762bb4cd..467b4ab94 100644 --- a/examples/C3DTilesLayerStyle.html +++ b/examples/C3DTilesLayerStyle.html @@ -15,7 +15,7 @@ './assets/config/extents.json', './assets/config/crs.json', './assets/config/frame3D_planars.json', - './assets/config/layer/3DTiles.json' + './assets/config/layer/3DTiles.json', ]) .then((configs) => { udvizBrowser.proj4.default.defs( @@ -44,8 +44,8 @@ { name: layerConfig['id'], source: new udvizBrowser.itowns.C3DTilesSource({ - url: layerConfig['url'] - }) + url: layerConfig['url'], + }), }, frame3DPlanar.itownsView ) @@ -68,8 +68,8 @@ opacity: function (feature) { if (feature.batchId % 2 == 0) return 0.5; return 1; - } - } + }, + }, }); // apply style to layers @@ -83,7 +83,7 @@ // userData styling example using a pick selection const contextSelection = { feature: null, - layer: null + layer: null, }; frame3DPlanar.domElement.onclick = (event) => { if (contextSelection.feature) { diff --git a/examples/CameraPositionerWidget.html b/examples/CameraPositionerWidget.html index f352527c8..9a91e4e1a 100644 --- a/examples/CameraPositionerWidget.html +++ b/examples/CameraPositionerWidget.html @@ -15,7 +15,7 @@ './assets/config/extents.json', './assets/config/crs.json', './assets/config/frame3D_planars.json', - './assets/config/layer/base_maps.json' + './assets/config/layer/base_maps.json', ]) .then((configs) => { udvizBrowser.proj4.default.defs( @@ -42,7 +42,7 @@ { updateStrategy: { type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, - options: {} + options: {}, }, source: new udvizBrowser.itowns.WMSSource({ extent: extent, @@ -50,9 +50,9 @@ url: configs['base_maps'][0]['url'], version: configs['base_maps'][0]['version'], crs: extent.crs, - format: configs['base_maps'][0]['format'] + format: configs['base_maps'][0]['format'], }), - transparent: true + transparent: true, } ) ); diff --git a/examples/DocumentWidget.html b/examples/DocumentWidget.html index 86f13ef68..ad9b814e6 100644 --- a/examples/DocumentWidget.html +++ b/examples/DocumentWidget.html @@ -18,7 +18,7 @@ './assets/config/server/spatial_multimedia_db_server.json', './assets/config/layer/3DTiles.json', './assets/config/layer/base_maps.json', - './assets/config/layer/elevation.json' + './assets/config/layer/elevation.json', ]) .then((configs) => { udvizBrowser.proj4.default.defs( @@ -48,8 +48,8 @@ { name: layerConfig['id'], source: new udvizBrowser.itowns.C3DTilesSource({ - url: layerConfig['url'] - }) + url: layerConfig['url'], + }), }, frame3DPlanar.itownsView ) @@ -62,7 +62,7 @@ { updateStrategy: { type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, - options: {} + options: {}, }, source: new udvizBrowser.itowns.WMSSource({ extent: extent, @@ -70,9 +70,9 @@ url: configs['base_maps'][0]['url'], version: configs['base_maps'][0]['version'], crs: extent.crs, - format: configs['base_maps'][0]['format'] + format: configs['base_maps'][0]['format'], }), - transparent: true + transparent: true, } ) ); @@ -97,8 +97,8 @@ name: configs['elevation']['name'], crs: extent.crs, heightMapWidth: 256, - format: configs['elevation']['format'] - }) + format: configs['elevation']['format'], + }), } ) ); diff --git a/examples/DragAndDropAvatar.html b/examples/DragAndDropAvatar.html index 7d5a4cafa..0e9a02292 100644 --- a/examples/DragAndDropAvatar.html +++ b/examples/DragAndDropAvatar.html @@ -20,7 +20,7 @@ './assets/config/layer/3DTiles.json', './assets/config/layer/base_maps.json', './assets/config/layer/elevation.json', - './assets/config/layer/geoJSONs.json' + './assets/config/layer/geoJSONs.json', ]) .then((configs) => { const assetManager = new udvizBrowser.AssetManager(); @@ -46,12 +46,12 @@ udvizBrowser.Shared.Game.ScriptTemplate.DragAndDropAvatar .ID_SCRIPT, udvizBrowser.Shared.Game.ScriptTemplate.NativeCommandManager - .ID_SCRIPT + .ID_SCRIPT, ], variables: { idRenderDataAvatar: 'avatar', // render data your avatar should use - defaultSpeedRotate: 0.0005 - } + defaultSpeedRotate: 0.0005, + }, }, ExternalScript: { variables: {}, @@ -59,10 +59,10 @@ udvizBrowser.Game.External.ScriptTemplate.DragAndDropAvatar .ID_SCRIPT, udvizBrowser.Game.External.ScriptTemplate.CameraManager - .ID_SCRIPT - ] - } - } + .ID_SCRIPT, + ], + }, + }, }); const frame3DPlanar = new udvizBrowser.Frame3DPlanar( @@ -78,17 +78,17 @@ { externalGameScriptClass: [ udvizBrowser.Game.External.ScriptTemplate.DragAndDropAvatar, - udvizBrowser.Game.External.ScriptTemplate.CameraManager + udvizBrowser.Game.External.ScriptTemplate.CameraManager, ], gameScriptClass: [ udvizBrowser.Shared.Game.ScriptTemplate.NativeCommandManager, - udvizBrowser.Shared.Game.ScriptTemplate.DragAndDropAvatar + udvizBrowser.Shared.Game.ScriptTemplate.DragAndDropAvatar, ], gameOrigin: { x: extent.center().x, y: extent.center().y, - z: 300 - } + z: 300, + }, } ); @@ -102,7 +102,7 @@ { updateStrategy: { type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, - options: {} + options: {}, }, source: new udvizBrowser.itowns.WMSSource({ extent: extent, @@ -110,9 +110,9 @@ url: configs['base_maps'][0]['url'], version: configs['base_maps'][0]['version'], crs: extent.crs, - format: configs['base_maps'][0]['format'] + format: configs['base_maps'][0]['format'], }), - transparent: true + transparent: true, } ) ); @@ -125,9 +125,9 @@ source: new udvizBrowser.itowns.FileSource({ url: layerConfig.url, crs: extent.crs, - format: 'application/json' + format: 'application/json', }), - style: new udvizBrowser.itowns.Style(layerConfig.style) + style: new udvizBrowser.itowns.Style(layerConfig.style), }) ); }); @@ -140,8 +140,8 @@ { name: layerConfig['id'], source: new udvizBrowser.itowns.C3DTilesSource({ - url: layerConfig['url'] - }) + url: layerConfig['url'], + }), }, frame3DPlanar.itownsView ) @@ -168,8 +168,8 @@ name: configs['elevation']['name'], crs: extent.crs, heightMapWidth: 256, - format: configs['elevation']['format'] - }) + format: configs['elevation']['format'], + }), } ) ); diff --git a/examples/GeocodingWidget.html b/examples/GeocodingWidget.html index 6c5e78a6d..4fe45aa2a 100644 --- a/examples/GeocodingWidget.html +++ b/examples/GeocodingWidget.html @@ -16,7 +16,7 @@ './assets/config/crs.json', './assets/config/frame3D_planars.json', './assets/config/server/geocoding_server.json', - './assets/config/layer/base_maps.json' + './assets/config/layer/base_maps.json', ]) .then((configs) => { udvizBrowser.proj4.default.defs( @@ -45,7 +45,7 @@ { updateStrategy: { type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, - options: {} + options: {}, }, source: new udvizBrowser.itowns.WMSSource({ extent: extent, @@ -53,9 +53,9 @@ url: configs['base_maps'][0]['url'], version: configs['base_maps'][0]['version'], crs: extent.crs, - format: configs['base_maps'][0]['format'] + format: configs['base_maps'][0]['format'], }), - transparent: true + transparent: true, } ) ); diff --git a/examples/GuidedTour.html b/examples/GuidedTour.html index db337cd20..257e96558 100644 --- a/examples/GuidedTour.html +++ b/examples/GuidedTour.html @@ -18,7 +18,7 @@ './assets/config/server/spatial_multimedia_db_server.json', './assets/config/layer/3DTiles.json', './assets/config/layer/base_maps.json', - './assets/config/layer/elevation.json' + './assets/config/layer/elevation.json', ]) .then((configs) => { udvizBrowser.proj4.default.defs( @@ -48,8 +48,8 @@ { name: layerConfig['id'], source: new udvizBrowser.itowns.C3DTilesSource({ - url: layerConfig['url'] - }) + url: layerConfig['url'], + }), }, frame3DPlanar.itownsView ) @@ -62,7 +62,7 @@ { updateStrategy: { type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, - options: {} + options: {}, }, source: new udvizBrowser.itowns.WMSSource({ extent: extent, @@ -70,9 +70,9 @@ url: configs['base_maps'][0]['url'], version: configs['base_maps'][0]['version'], crs: extent.crs, - format: configs['base_maps'][0]['format'] + format: configs['base_maps'][0]['format'], }), - transparent: true + transparent: true, } ) ); @@ -97,8 +97,8 @@ name: configs['elevation']['name'], crs: extent.crs, heightMapWidth: 256, - format: configs['elevation']['format'] - }) + format: configs['elevation']['format'], + }), } ) ); diff --git a/examples/LayerChoiceWidget.html b/examples/LayerChoiceWidget.html index d68e5fe5e..12b25e3c8 100644 --- a/examples/LayerChoiceWidget.html +++ b/examples/LayerChoiceWidget.html @@ -18,7 +18,7 @@ './assets/config/layer/3DTiles.json', './assets/config/layer/base_maps.json', './assets/config/layer/elevation.json', - './assets/config/layer/geoJSONs.json' + './assets/config/layer/geoJSONs.json', ]) .then((configs) => { udvizBrowser.proj4.default.defs( @@ -48,8 +48,8 @@ { name: layerConfig['id'], source: new udvizBrowser.itowns.C3DTilesSource({ - url: layerConfig['url'] - }) + url: layerConfig['url'], + }), }, frame3DPlanar.itownsView ) @@ -62,7 +62,7 @@ { updateStrategy: { type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, - options: {} + options: {}, }, source: new udvizBrowser.itowns.WMSSource({ extent: extent, @@ -70,9 +70,9 @@ url: configs['base_maps'][0]['url'], version: configs['base_maps'][0]['version'], crs: extent.crs, - format: configs['base_maps'][0]['format'] + format: configs['base_maps'][0]['format'], }), - transparent: true + transparent: true, } ) ); @@ -97,8 +97,8 @@ name: configs['elevation']['name'], crs: extent.crs, heightMapWidth: 256, - format: configs['elevation']['format'] - }) + format: configs['elevation']['format'], + }), } ) ); @@ -111,9 +111,9 @@ source: new udvizBrowser.itowns.FileSource({ url: layerConfig.url, crs: extent.crs, - format: 'application/json' + format: 'application/json', }), - style: new udvizBrowser.itowns.Style(layerConfig.style) + style: new udvizBrowser.itowns.Style(layerConfig.style), }) ); }); diff --git a/examples/MultiPlanarProcess.html b/examples/MultiPlanarProcess.html index 27cb5833b..9d688d2fa 100644 --- a/examples/MultiPlanarProcess.html +++ b/examples/MultiPlanarProcess.html @@ -20,7 +20,7 @@ './assets/config/layer/3DTiles.json', './assets/config/layer/base_maps.json', './assets/config/layer/elevation.json', - './assets/config/layer/geoJSONs.json' + './assets/config/layer/geoJSONs.json', ]) .then((configs) => { const assetManager = new udvizBrowser.AssetManager(); @@ -50,14 +50,14 @@ frame3DPlanarOptions: configs['frame3D_planars'][2], externalGameScriptClass: [ udvizBrowser.Game.External.ScriptTemplate.CameraManager, - udvizBrowser.Game.External.ScriptTemplate.Note + udvizBrowser.Game.External.ScriptTemplate.Note, ], sceneConfig: configs['scene'], gameOrigin: { x: extent.center().x, y: extent.center().y, - z: 300 - } + z: 300, + }, } ); multiGame.start(); @@ -70,7 +70,7 @@ { updateStrategy: { type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, - options: {} + options: {}, }, source: new udvizBrowser.itowns.WMSSource({ extent: extent, @@ -78,9 +78,9 @@ url: configs['base_maps'][0]['url'], version: configs['base_maps'][0]['version'], crs: extent.crs, - format: configs['base_maps'][0]['format'] + format: configs['base_maps'][0]['format'], }), - transparent: true + transparent: true, } ) ); @@ -93,9 +93,9 @@ source: new udvizBrowser.itowns.FileSource({ url: layerConfig.url, crs: extent.crs, - format: 'application/json' + format: 'application/json', }), - style: new udvizBrowser.itowns.Style(layerConfig.style) + style: new udvizBrowser.itowns.Style(layerConfig.style), }) ); }); @@ -108,8 +108,8 @@ { name: layerConfig['id'], source: new udvizBrowser.itowns.C3DTilesSource({ - url: layerConfig['url'] - }) + url: layerConfig['url'], + }), }, multiGame.frame3DPlanar.itownsView ) @@ -136,8 +136,8 @@ name: configs['elevation']['name'], crs: extent.crs, heightMapWidth: 256, - format: configs['elevation']['format'] - }) + format: configs['elevation']['format'], + }), } ) ); diff --git a/examples/SPARQLWidget.html b/examples/SPARQLWidget.html index 14a36cd7f..5fb2ae7d7 100644 --- a/examples/SPARQLWidget.html +++ b/examples/SPARQLWidget.html @@ -18,7 +18,7 @@ './assets/config/layer/doua_temporal.json', './assets/config/widget/temporal.json', './assets/config/widget/sparql_widget.json', - './assets/config/server/sparql_server.json' + './assets/config/server/sparql_server.json', ]) .then((configs) => { udvizBrowser.proj4.default.defs( diff --git a/examples/SlideShowWidget.html b/examples/SlideShowWidget.html index 45981cb9d..fa0af3be6 100644 --- a/examples/SlideShowWidget.html +++ b/examples/SlideShowWidget.html @@ -15,7 +15,7 @@ './assets/config/extents.json', './assets/config/crs.json', './assets/config/frame3D_planars.json', - './assets/config/widget/slide_show.json' + './assets/config/widget/slide_show.json', ]) .then((configs) => { udvizBrowser.proj4.default.defs( @@ -32,7 +32,7 @@ ); const frame3DPlanar = new udvizBrowser.Frame3DPlanar(extent, { - hasItownsControls: true + hasItownsControls: true, }); const fitExtent = () => { diff --git a/examples/TemporalWidget.html b/examples/TemporalWidget.html index e77350a1d..da477e52d 100644 --- a/examples/TemporalWidget.html +++ b/examples/TemporalWidget.html @@ -18,7 +18,7 @@ './assets/config/widget/temporal.json', './assets/config/layer/3DTiles_temporal.json', './assets/config/layer/base_maps.json', - './assets/config/layer/elevation.json' + './assets/config/layer/elevation.json', ]) .then((configs) => { udvizBrowser.proj4.default.defs( @@ -45,7 +45,7 @@ { updateStrategy: { type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, - options: {} + options: {}, }, source: new udvizBrowser.itowns.WMSSource({ extent: extent, @@ -53,9 +53,9 @@ url: configs['base_maps'][0]['url'], version: configs['base_maps'][0]['version'], crs: extent.crs, - format: configs['base_maps'][0]['format'] + format: configs['base_maps'][0]['format'], }), - transparent: true + transparent: true, } ) ); @@ -80,8 +80,8 @@ name: configs['elevation']['name'], crs: extent.crs, heightMapWidth: 256, - format: configs['elevation']['format'] - }) + format: configs['elevation']['format'], + }), } ) ); diff --git a/examples/WorldMap.html b/examples/WorldMap.html index 782ef5d0a..f56a3029c 100644 --- a/examples/WorldMap.html +++ b/examples/WorldMap.html @@ -14,7 +14,7 @@ .loadMultipleJSON([ './assets/config/extents.json', './assets/config/frame3D_planars.json', - './assets/config/layer/base_maps.json' + './assets/config/layer/base_maps.json', ]) .then((configs) => { const extent = new udvizBrowser.itowns.Extent( @@ -37,7 +37,7 @@ { updateStrategy: { type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, - options: {} + options: {}, }, source: new udvizBrowser.itowns.WMSSource({ extent: extent, @@ -45,9 +45,9 @@ url: configs['base_maps'][0]['url'], version: configs['base_maps'][0]['version'], crs: extent.crs, - format: configs['base_maps'][0]['format'] + format: configs['base_maps'][0]['format'], }), - transparent: true + transparent: true, } ) ); diff --git a/examples/ZeppelinGame.html b/examples/ZeppelinGame.html index ac2a7d4cd..00bdcc0b2 100644 --- a/examples/ZeppelinGame.html +++ b/examples/ZeppelinGame.html @@ -21,7 +21,7 @@ static: false, // => this Game.Object3D is going to move components: { GameScript: { - idScripts: [ZeppelinGameScript.ID_SCRIPT] + idScripts: [ZeppelinGameScript.ID_SCRIPT], }, Render: { idRenderData: 'zeppelin' }, Collider: { @@ -29,11 +29,11 @@ { type: 'Circle', center: { x: 0, y: 0 }, - radius: 10 - } - ] - } - } + radius: 10, + }, + ], + }, + }, }); promises.push(this.context.addObject3D(this.zeppelinGO)); @@ -71,18 +71,18 @@ components: { Render: { idRenderData: 'sphere', - color: [Math.random(), Math.random(), Math.random(), 1] + color: [Math.random(), Math.random(), Math.random(), 1], }, Collider: { shapes: [ { type: 'Circle', center: { x: 0, y: 0 }, - radius: size / 2 - } - ] - } - } + radius: size / 2, + }, + ], + }, + }, }); result.position.set(x, y, size); @@ -181,7 +181,7 @@ './assets/config/layer/3DTiles.json', './assets/config/layer/base_maps.json', './assets/config/layer/elevation.json', - './assets/config/layer/geoJSONs.json' + './assets/config/layer/geoJSONs.json', ]) .then((configs) => { const assetManager = new udvizBrowser.AssetManager(); @@ -204,31 +204,31 @@ static: true, components: { Audio: { - sounds: ['ballon_pop'] + sounds: ['ballon_pop'], }, GameScript: { idScripts: [ GameContextManager.ID_SCRIPT, udvizBrowser.Shared.Game.ScriptTemplate.NativeCommandManager - .ID_SCRIPT + .ID_SCRIPT, ], variables: { - defaultSpeedRotate: 0.0005 - } + defaultSpeedRotate: 0.0005, + }, }, ExternalScript: { variables: { sphereCount: 0, camera_distance: 60, - camera_angle: 0.2 + camera_angle: 0.2, }, idScripts: [ ExternalGameContextManager.ID_SCRIPT, udvizBrowser.Game.External.ScriptTemplate.CameraManager - .ID_SCRIPT - ] - } - } + .ID_SCRIPT, + ], + }, + }, }); const frame3DPlanar = new udvizBrowser.Frame3DPlanar( @@ -245,17 +245,17 @@ gameScriptClass: [ udvizBrowser.Shared.Game.ScriptTemplate.NativeCommandManager, GameContextManager, - ZeppelinGameScript + ZeppelinGameScript, ], externalGameScriptClass: [ udvizBrowser.Game.External.ScriptTemplate.CameraManager, - ExternalGameContextManager + ExternalGameContextManager, ], gameOrigin: { x: extent.center().x, y: extent.center().y, - z: 300 - } + z: 300, + }, } ); @@ -269,7 +269,7 @@ { updateStrategy: { type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, - options: {} + options: {}, }, source: new udvizBrowser.itowns.WMSSource({ extent: extent, @@ -277,9 +277,9 @@ url: configs['base_maps'][0]['url'], version: configs['base_maps'][0]['version'], crs: extent.crs, - format: configs['base_maps'][0]['format'] + format: configs['base_maps'][0]['format'], }), - transparent: true + transparent: true, } ) ); @@ -292,9 +292,9 @@ source: new udvizBrowser.itowns.FileSource({ url: layerConfig.url, crs: extent.crs, - format: 'application/json' + format: 'application/json', }), - style: new udvizBrowser.itowns.Style(layerConfig.style) + style: new udvizBrowser.itowns.Style(layerConfig.style), }) ); }); @@ -307,8 +307,8 @@ { name: layerConfig['id'], source: new udvizBrowser.itowns.C3DTilesSource({ - url: layerConfig['url'] - }) + url: layerConfig['url'], + }), }, frame3DPlanar.itownsView ) @@ -335,8 +335,8 @@ name: configs['elevation']['name'], crs: extent.crs, heightMapWidth: 256, - format: configs['elevation']['format'] - }) + format: configs['elevation']['format'], + }), } ) ); diff --git a/examples/assets/css/loadingScreen.css b/examples/assets/css/loadingScreen.css index 8d011e7b5..6c1597aec 100644 --- a/examples/assets/css/loadingScreen.css +++ b/examples/assets/css/loadingScreen.css @@ -15,7 +15,7 @@ .loading_screen_character { color: gray; - height: var(--size-character); + height: var(--size-character); font-size: var(--size-character); animation-name: characterAnimation; animation-direction: alternate-reverse; diff --git a/examples/assets/css/widget_3dtiles.css b/examples/assets/css/widget_3dtiles.css index 5827dfd5e..b23e0a887 100644 --- a/examples/assets/css/widget_3dtiles.css +++ b/examples/assets/css/widget_3dtiles.css @@ -29,4 +29,4 @@ .widgets-3dtiles-feature-container { border: 1px solid; padding: 5px; -} \ No newline at end of file +} diff --git a/examples/assets/md/about.md b/examples/assets/md/about.md index 88f53cca7..abdf892f7 100644 --- a/examples/assets/md/about.md +++ b/examples/assets/md/about.md @@ -1,19 +1,18 @@ # About This UD-Viz-Shared demo is part of the [Urban Data Viewer](https://github.com/VCityTeam/UD-Viz) (UD-Viz) project of [the VCity project](https://projet.liris.cnrs.fr/vcity/) from [LIRIS lab](https://liris.cnrs.fr/en) (with additional support from [LabEx IMU](http://imu.universite-lyon.fr/)). UD-Viz-Shared demo is powered with: - * [iTowns](http://www.itowns-project.org/) - * [Lyon Métropole Open Data](https://data.grandlyon.com) +- [iTowns](http://www.itowns-project.org/) +- [Lyon Métropole Open Data](https://data.grandlyon.com) Legal and operational disclaimer: -This demonstration and its underlying software are provided “as is”. The authors and contributors disclaim all warranties with regard to the software including all implied warranties of merchantability and fitness for a particular purpose (refer to the spirit of any [BSD license](https://en.wikipedia.org/wiki/BSD_licenses#2-clause_license_(%22Simplified_BSD_License%22_or_%22FreeBSD_License%22)) dislaimer). - +This demonstration and its underlying software are provided “as is”. The authors and contributors disclaim all warranties with regard to the software including all implied warranties of merchantability and fitness for a particular purpose (refer to the spirit of any [BSD license]() dislaimer). Nevertheless, if you notice any issue, help us by [openning an issue on github](https://github.com/MEPP-team/UD-Viz/issues). Concerning user contributed data: - * the free usage with no warranty spirit also applies to any user contributed data : in particular there are no backups of any user contributed/uploaded data. - * if you are a copyright owner and believe that content available in this demo infringes one or more of your copyrights, please [open an issue on github](https://github.com/VCityTeam/UD-Viz/issues) so that we can (best effort) remove it from this site. +- the free usage with no warranty spirit also applies to any user contributed data : in particular there are no backups of any user contributed/uploaded data. +- if you are a copyright owner and believe that content available in this demo infringes one or more of your copyrights, please [open an issue on github](https://github.com/VCityTeam/UD-Viz/issues) so that we can (best effort) remove it from this site. -Icons made by [Freepik](https://www.freepik.com) from [www.flaticon.com](https://www.flaticon.com/) is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/) \ No newline at end of file +Icons made by [Freepik](https://www.freepik.com) from [www.flaticon.com](https://www.flaticon.com/) is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/) diff --git a/examples/assets/md/help.md b/examples/assets/md/help.md index e9e751a6c..dd33a455b 100644 --- a/examples/assets/md/help.md +++ b/examples/assets/md/help.md @@ -205,10 +205,10 @@ Under construction... ## Camera key bindings: - * Left-Click: camera translation (drag) - * Right-Click: camera translation (pan) - * Ctrl + Left-Click: camera rotation (orbit) - * Spacebar / Wheel-Click: smart zoom - * Mouse Wheel: zoom in/out - * T: orient camera to a top view - * Y: move camera to start position \ No newline at end of file +- Left-Click: camera translation (drag) +- Right-Click: camera translation (pan) +- Ctrl + Left-Click: camera rotation (orbit) +- Spacebar / Wheel-Click: smart zoom +- Mouse Wheel: zoom in/out +- T: orient camera to a top view +- Y: move camera to start position diff --git a/examples/dom_element_3D.html b/examples/dom_element_3D.html index bd2206e3d..924b433aa 100644 --- a/examples/dom_element_3D.html +++ b/examples/dom_element_3D.html @@ -18,7 +18,7 @@ './assets/config/layer/3DTiles.json', './assets/config/layer/base_maps.json', './assets/config/layer/elevation.json', - './assets/config/layer/geoJSONs.json' + './assets/config/layer/geoJSONs.json', ]) .then((configs) => { udvizBrowser.proj4.default.defs( @@ -46,7 +46,7 @@ { updateStrategy: { type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, - options: {} + options: {}, }, source: new udvizBrowser.itowns.WMSSource({ extent: extent, @@ -54,9 +54,9 @@ url: configs['base_maps'][0]['url'], version: configs['base_maps'][0]['version'], crs: extent.crs, - format: configs['base_maps'][0]['format'] + format: configs['base_maps'][0]['format'], }), - transparent: true + transparent: true, } ) ); @@ -81,8 +81,8 @@ name: configs['elevation']['name'], crs: extent.crs, heightMapWidth: 256, - format: configs['elevation']['format'] - }) + format: configs['elevation']['format'], + }), } ) ); @@ -95,8 +95,8 @@ { name: layerConfig['id'], source: new udvizBrowser.itowns.C3DTilesSource({ - url: layerConfig['url'] - }) + url: layerConfig['url'], + }), }, frame3DPlanar.itownsView ) @@ -111,9 +111,9 @@ source: new udvizBrowser.itowns.FileSource({ url: layerConfig.url, crs: extent.crs, - format: 'application/json' + format: 'application/json', }), - style: new udvizBrowser.itowns.Style(layerConfig.style) + style: new udvizBrowser.itowns.Style(layerConfig.style), }) ); }); diff --git a/examples/show_room.html b/examples/show_room.html index 2f87f5897..0d458f444 100644 --- a/examples/show_room.html +++ b/examples/show_room.html @@ -31,7 +31,7 @@ './assets/config/layer/base_maps.json', './assets/config/layer/elevation.json', './assets/config/layer/geoJSONs.json', - './assets/config/layer/labels.json' + './assets/config/layer/labels.json', ]) .then((configs) => { udvizBrowser.proj4.default.defs( @@ -55,7 +55,7 @@ loadingScreen(app.frame3DPlanar.itownsView, [ 'UD-VIZ', - 'UDVIZ_VERSION' + 'UDVIZ_VERSION', ]); app.addLayers({ @@ -63,14 +63,14 @@ elevation: configs['elevation'], baseMap: configs['base_maps'][0], labels: configs['labels'], - geoJSON: configs['geoJSONs'] + geoJSON: configs['geoJSONs'], }); app.addLogos([ './assets/img/logo/logo-grand-lyon.png', './assets/img/logo/logo-imu.png', './assets/img/logo/logo-liris.png', - './assets/img/logo/logo-univ-lyon.png' + './assets/img/logo/logo-univ-lyon.png', ]); app.addWidgetAuthentication( diff --git a/examples/widget_planar_controls.html b/examples/widget_planar_controls.html index 1c94b5d54..d9bb5ad09 100644 --- a/examples/widget_planar_controls.html +++ b/examples/widget_planar_controls.html @@ -16,7 +16,7 @@ './assets/config/extents.json', './assets/config/crs.json', './assets/config/frame3D_planars.json', - './assets/config/layer/base_maps.json' + './assets/config/layer/base_maps.json', ]) .then((configs) => { udvizBrowser.proj4.default.defs( @@ -45,7 +45,7 @@ { updateStrategy: { type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, - options: {} + options: {}, }, source: new udvizBrowser.itowns.WMSSource({ extent: extent, @@ -53,9 +53,9 @@ url: configs['base_maps'][0]['url'], version: configs['base_maps'][0]['version'], crs: extent.crs, - format: configs['base_maps'][0]['format'] + format: configs['base_maps'][0]['format'], }), - transparent: true + transparent: true, } ) ); From c6743e2ec4102367b203583c99e6371f8ee087fd Mon Sep 17 00:00:00 2001 From: Mathieu Livebardon Date: Mon, 17 Jul 2023 13:53:31 +0200 Subject: [PATCH 4/6] update --- packages/browser/src/GUI/css/window.css | 330 +++++++++--------- .../views/AuthenticationView.css | 2 - .../Comment/views/DocumentCommentsStyle.css | 2 - .../Server/Geocoding/views/GeocodingStyle.css | 2 - .../Server/SPARQL/View/SparqlQueryWindow.css | 192 +++++----- .../3DTILES_temporal.batchTable.schema.json | 60 ++-- ...DTILES_temporal.boundingVolume.schema.json | 38 +- .../3DTILES_temporal.tileset.schema.json | 78 ++--- .../3DTILES_temporal.transaction.schema.json | 74 ++-- ...DTILES_temporal.version.schema.schema.json | 78 ++--- ...LES_temporal.versionTransition.schema.json | 96 ++--- packages/node/Readme.md | 4 +- packages/shared/Readme.md | 130 +++---- 13 files changed, 540 insertions(+), 546 deletions(-) diff --git a/packages/browser/src/GUI/css/window.css b/packages/browser/src/GUI/css/window.css index ed3b8cd70..a21ff8754 100644 --- a/packages/browser/src/GUI/css/window.css +++ b/packages/browser/src/GUI/css/window.css @@ -1,165 +1,165 @@ -.window { - position: absolute; - top: 0px; - left: 0px; - min-width: 200px; - width: 350px; - padding: 0; - resize: both; - overflow: hidden; - display: grid; - grid-template-rows: 30px auto; - box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.75); - background-color: #f95a5a; /* test */ - z-index: 1; -} - -.window-header { - background-color: rgb(0, 0, 0, 0.9); - color: #eeeeee; - margin: 0; - cursor: default; - display: flex; - align-items: center; -} - -.window-header .window-title { - margin: 0; - margin-left: 5px; - margin-top: -2px; - font-size: 1.5vh; -} - -.window-close-button, -.window-toggle-content-visibility-button { - margin: 0px; - height: auto; - background-color: transparent; - color: white; - border: none; - font-size: 20px; - font-weight: bold; - transition: background-color 0.2s ease; - align-self: center; - width: 25px !important; -} - -/*margin-left : auto*/ -.window-toggle-content-visibility-button { - margin: 0 0 0 auto !important; -} - -.window-close-button:hover, -.window-toggle-content-visibility-button:hover { - background-color: #f95a5a; - cursor: pointer; -} - -.window-content { - background-color: rgba(30, 30, 30, 0.9); - border: 5px solid rgba(30, 30, 30, 0.1); - overflow-y: auto; - margin: 0; -} - -.window-inner-content { - color: #f2f2f2; -} - -/* Useful styles that can be used in windows */ - -/* A box arround a section */ -.window-inner-content .box-section { - background: rgba(255, 255, 255, 0.168); - width: auto; - height: auto; - margin: 0 0 30px; - padding: 11px 10px 35px; - /* opacity: 0.2; */ - border-radius: 7px; -} - -.window-inner-content .section-title { - margin: 5px 0 5px 10px; - padding: 0; - font-size: 20px; - font-weight: bold; - display: block; -} - -.window-inner-content .subsection-title { - margin: 7px 0 7px 5px; - padding: 0; - font-size: 16px; - font-weight: bold; - display: block; -} - -/* Clickable text */ -.window-inner-content .clickable-text { - cursor: pointer; -} - -.window-inner-content .clickable-text:hover { - text-decoration: underline; -} - -/* Some styles for a working "spoiler" div - * The expected structure should be the following : - * - * - *
+ * + *
[--outputFile] -o [--ignore] -i -d --noImport` | \ No newline at end of file +| `autoMermaid` | Permits to create a mermaid diagram in a markdown file from a folder in entry. `npx @ud-viz/node autoMermaid [--entryFolder] -e [--outputFile] -o [--ignore] -i -d --noImport` | diff --git a/packages/shared/Readme.md b/packages/shared/Readme.md index b7f7fd02b..89c3eb68d 100644 --- a/packages/shared/Readme.md +++ b/packages/shared/Readme.md @@ -1,65 +1,65 @@ -# @ud-viz/shared - -[![NPM package version](https://badgen.net/npm/v/@ud-viz/shared)](https://npmjs.com/package/@ud-viz/shared) - -[@ud-viz/shared](https://npmjs.com/package/@ud-viz/shared) is a npm package based on [Three.js](https://threejs.org/) including data processing and model plus a game engine. - -- [@ud-viz/shared](#ud-vizshared) - - [Directory Hierarchy](#directory-hierarchy) - - [Getting started](#getting-started) - - [Developers](#developers) - - [Npm scripts](#npm-scripts) - - [Debugging](#debugging) - -### Directory Hierarchy - -``` -UD-Viz/packages/shared -├── bin # Global NodeJS development -├── src # JS files composing the package -| ├── Game # Shared game engine -| | ├── Component # Components of `Game.Object3D` -| | ├── ScriptTemplate # JS script templates of Shared game engine -| | ├── State # Game state -| | ├── Context.js # Handle scripts, collisions and model of a game -| | ├── Object3D.js # Game node of a 3D scene -| ├── Command.js # Basic object communication -| ├── Data.js # Module for data processing (split string, converts to uri...) -| ├── EventSender.js # Manage custom events -| ├── index.js # API description (webpack entry point) -| ├── ProcessInterval.js # Manage loop process requesters -| ├── Type.js # Check if a string is a valid number -├── webpackConfig # Configs of bundles' creation -├── package.json # Global npm project description -├── Readme.md # It's a me, Mario! -``` - -## Getting started - -See [here](https://github.com/VCityTeam/UD-Viz/blob/master/Readme.md#getting-started). - -## Developers - -For pre-requisites see [here](https://github.com/VCityTeam/UD-Viz/blob/master/docs/static/Developers.md#pre-requisites). - -### Npm scripts - -| Script | Description | -| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `npm run build` | Create a [webpack](https://webpack.js.org/) bundle in [production](./webpackConfig/webpack.config.prod.js) mode. See [webpack.config.js](./webpackConfig/webpack.config.js) | -| `npm run build-debug` | Create a [webpack](https://webpack.js.org/) bundle in [developpement](./webpackConfig/webpack.config.dev.js) mode. See [webpack.config.js](./webpackConfig/webpack.config.js) | -| `npm run test` | Run shared testing scripts. Uses [this test script](./bin/test.js) | -| `npm run debug` | Launch a watcher for debugging. See [here](#debugging) for more information | - -### Debugging - -For debugging run: - -```bash -npm run debug -``` - -This runs a watched routine [debug.js](./bin/debug.js) with [nodemon](https://www.npmjs.com/package/nodemon) which: - -- Runs a `npm run build-debug` -- May run `npm run test` (true by default). +# @ud-viz/shared + +[![NPM package version](https://badgen.net/npm/v/@ud-viz/shared)](https://npmjs.com/package/@ud-viz/shared) + +[@ud-viz/shared](https://npmjs.com/package/@ud-viz/shared) is a npm package based on [Three.js](https://threejs.org/) including data processing and model plus a game engine. + +- [@ud-viz/shared](#ud-vizshared) + - [Directory Hierarchy](#directory-hierarchy) + - [Getting started](#getting-started) + - [Developers](#developers) + - [Npm scripts](#npm-scripts) + - [Debugging](#debugging) + +### Directory Hierarchy + +``` +UD-Viz/packages/shared +├── bin # Global NodeJS development +├── src # JS files composing the package +| ├── Game # Shared game engine +| | ├── Component # Components of `Game.Object3D` +| | ├── ScriptTemplate # JS script templates of Shared game engine +| | ├── State # Game state +| | ├── Context.js # Handle scripts, collisions and model of a game +| | ├── Object3D.js # Game node of a 3D scene +| ├── Command.js # Basic object communication +| ├── Data.js # Module for data processing (split string, converts to uri...) +| ├── EventSender.js # Manage custom events +| ├── index.js # API description (webpack entry point) +| ├── ProcessInterval.js # Manage loop process requesters +| ├── Type.js # Check if a string is a valid number +├── webpackConfig # Configs of bundles' creation +├── package.json # Global npm project description +├── Readme.md # It's a me, Mario! +``` + +## Getting started + +See [here](https://github.com/VCityTeam/UD-Viz/blob/master/Readme.md#getting-started). + +## Developers + +For pre-requisites see [here](https://github.com/VCityTeam/UD-Viz/blob/master/docs/static/Developers.md#pre-requisites). + +### Npm scripts + +| Script | Description | +| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `npm run build` | Create a [webpack](https://webpack.js.org/) bundle in [production](./webpackConfig/webpack.config.prod.js) mode. See [webpack.config.js](./webpackConfig/webpack.config.js) | +| `npm run build-debug` | Create a [webpack](https://webpack.js.org/) bundle in [developpement](./webpackConfig/webpack.config.dev.js) mode. See [webpack.config.js](./webpackConfig/webpack.config.js) | +| `npm run test` | Run shared testing scripts. Uses [this test script](./bin/test.js) | +| `npm run debug` | Launch a watcher for debugging. See [here](#debugging) for more information | + +### Debugging + +For debugging run: + +```bash +npm run debug +``` + +This runs a watched routine [debug.js](./bin/debug.js) with [nodemon](https://www.npmjs.com/package/nodemon) which: + +- Runs a `npm run build-debug` +- May run `npm run test` (true by default). From 67947a8e3bbb80674101277551e754028dcbaf5d Mon Sep 17 00:00:00 2001 From: Mathieu Livebardon Date: Mon, 17 Jul 2023 16:36:15 +0200 Subject: [PATCH 5/6] update:about.md threw error --- examples/assets/md/about.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/assets/md/about.md b/examples/assets/md/about.md index abdf892f7..c88ed0735 100644 --- a/examples/assets/md/about.md +++ b/examples/assets/md/about.md @@ -6,7 +6,7 @@ This UD-Viz-Shared demo is part of the [Urban Data Viewer](https://github.com/VC - [Lyon Métropole Open Data](https://data.grandlyon.com) Legal and operational disclaimer: -This demonstration and its underlying software are provided “as is”. The authors and contributors disclaim all warranties with regard to the software including all implied warranties of merchantability and fitness for a particular purpose (refer to the spirit of any [BSD license]() dislaimer). +This demonstration and its underlying software are provided “as is”. The authors and contributors disclaim all warranties with regard to the software including all implied warranties of merchantability and fitness for a particular purpose (refer to the spirit of any [BSD license](https://en.wikipedia.org/wiki/BSD_licenses#2-clause_license_(%22Simplified_BSD_License%22_or_%22FreeBSD_License%22)) dislaimer). Nevertheless, if you notice any issue, help us by [openning an issue on github](https://github.com/MEPP-team/UD-Viz/issues). From 83e35f7423f0c26637395228a5a86396c420bebc Mon Sep 17 00:00:00 2001 From: valentinMachado Date: Wed, 19 Jul 2023 14:44:12 +0200 Subject: [PATCH 6/6] fix(examples) 3DTiles loading add layer --- examples/3DTiles_loading.html | 51 +++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/examples/3DTiles_loading.html b/examples/3DTiles_loading.html index 7142aedd0..d40c9bd68 100644 --- a/examples/3DTiles_loading.html +++ b/examples/3DTiles_loading.html @@ -64,17 +64,52 @@ ); // ADD BASE MAP - udvizBrowser.addBaseMapLayer( - configs['base_maps'][0], - frame3DPlanar.itownsView, - extent + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ColorLayer( + configs['base_maps'][0]['layer_name'], + { + updateStrategy: { + type: udvizBrowser.itowns.STRATEGY_DICHOTOMY, + options: {} + }, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + name: configs['base_maps'][0]['name'], + url: configs['base_maps'][0]['url'], + version: configs['base_maps'][0]['version'], + crs: extent.crs, + format: configs['base_maps'][0]['format'] + }), + transparent: true + } + ) ); // ADD ELEVATION LAYER - udvizBrowser.addElevationLayer( - configs['elevation'], - frame3DPlanar.itownsView, - extent + const isTextureFormat = + configs['elevation']['format'] == 'image/jpeg' || + configs['elevation']['format'] == 'image/png'; + frame3DPlanar.itownsView.addLayer( + new udvizBrowser.itowns.ElevationLayer( + configs['elevation']['layer_name'], + { + useColorTextureElevation: isTextureFormat, + colorTextureElevationMinZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMinZ'] + : null, + colorTextureElevationMaxZ: isTextureFormat + ? configs['elevation']['colorTextureElevationMaxZ'] + : null, + source: new udvizBrowser.itowns.WMSSource({ + extent: extent, + url: configs['elevation']['url'], + name: configs['elevation']['name'], + crs: extent.crs, + heightMapWidth: 256, + format: configs['elevation']['format'] + }) + } + ) ); // c3DTiles loading element