From 92d9ca0e8948eff6c4f2514e3b5befd5af3cf055 Mon Sep 17 00:00:00 2001 From: gchoqueux Date: Wed, 30 Sep 2020 12:36:26 +0200 Subject: [PATCH] fix(examples): replace deprecated parsedData by features. --- examples/js/plugins/CSVnVRTParser.js | 4 ++-- examples/js/plugins/DragNDrop.js | 8 ++++---- examples/js/plugins/TIFFParser.js | 2 +- examples/plugins_vrt.html | 6 ++---- examples/source_file_geojson_raster.html | 12 ++++-------- examples/source_file_shapefile.html | 6 ++---- 6 files changed, 15 insertions(+), 23 deletions(-) diff --git a/examples/js/plugins/CSVnVRTParser.js b/examples/js/plugins/CSVnVRTParser.js index cc5a32ffea..e4010cc53c 100644 --- a/examples/js/plugins/CSVnVRTParser.js +++ b/examples/js/plugins/CSVnVRTParser.js @@ -21,8 +21,8 @@ * buildExtent: true, * crsOut: 'EPSG:4326' * }); - * }).then(function _(feature) { - * var source = new itowns.FileSource({ parsedData: feature }); + * }).then(function _(features) { + * var source = new itowns.FileSource({ features }); * var layer = new itowns.ColorLayer('CSVnVRT', { source }); * view.addLayer(layer); * }); diff --git a/examples/js/plugins/DragNDrop.js b/examples/js/plugins/DragNDrop.js index 52f60e0769..b773c5cf90 100644 --- a/examples/js/plugins/DragNDrop.js +++ b/examples/js/plugins/DragNDrop.js @@ -73,11 +73,11 @@ var DragNDrop = (function _() { mergeFeatures: true, withNormal: (extension.mode == _GEOMETRY), withAltitude: (extension.mode == _GEOMETRY), - }).then(function _(result) { - var dimensions = result.extent.dimensions(); + }).then(function _(features) { + var dimensions = features.extent.dimensions(); var source = new itowns.FileSource({ - parsedData: result, + features: features, crs: 'EPSG:4326', }); @@ -119,7 +119,7 @@ var DragNDrop = (function _() { // Move the camera to the first vertex itowns.CameraUtils.animateCameraToLookAtTarget(_view, _view.camera.camera3D, { - coord: new itowns.Coordinates(result.crs, result.features[0].vertices), + coord: new itowns.Coordinates(features.crs, features.features[0].vertices), range: dimensions.x * dimensions.y * 1e6, }); }); diff --git a/examples/js/plugins/TIFFParser.js b/examples/js/plugins/TIFFParser.js index 38f1005507..da50afbaad 100644 --- a/examples/js/plugins/TIFFParser.js +++ b/examples/js/plugins/TIFFParser.js @@ -12,7 +12,7 @@ * Fetcher.arrayBuffer('image.tiff') * .then(TIFFParser.parse) * .then(function _(texture) { - * var source = new itowns.FileSource({ parsedData: texture }); + * var source = new itowns.FileSource({ features: texture }); * var layer = new itowns.ColorLayer('tiff', { source }); * view.addLayer(layer); * }); diff --git a/examples/plugins_vrt.html b/examples/plugins_vrt.html index 3f165e228d..e5add54f84 100644 --- a/examples/plugins_vrt.html +++ b/examples/plugins_vrt.html @@ -53,10 +53,8 @@ buildExtent: true, crsOut: view.tileLayer.extent.crs, }); - }).then(function _(feature) { - var velibSource = new itowns.FileSource({ - parsedData: feature, - }); + }).then(function _(features) { + var velibSource = new itowns.FileSource({ features }); var velibLayer = new itowns.ColorLayer('velib', { source: velibSource, diff --git a/examples/source_file_geojson_raster.html b/examples/source_file_geojson_raster.html index 977bc3544c..0edcc0cce2 100644 --- a/examples/source_file_geojson_raster.html +++ b/examples/source_file_geojson_raster.html @@ -69,10 +69,8 @@ itowns.Fetcher.json('https://raw.githubusercontent.com/gregoiredavid/france-geojson/master/departements/09-ariege/departement-09-ariege.geojson') .then(function _(geojson) { return itowns.GeoJsonParser.parse(geojson, optionsGeoJsonParser); - }).then(function _(parsedData) { - var ariegeSource = new itowns.FileSource({ - parsedData, - }); + }).then(function _(features) { + var ariegeSource = new itowns.FileSource({ features }); var ariegeStyle = new itowns.Style({ fill: { @@ -97,10 +95,8 @@ itowns.Fetcher.json('https://raw.githubusercontent.com/gregoiredavid/france-geojson/master/departements/66-pyrenees-orientales/departement-66-pyrenees-orientales.geojson') .then(function _(geojson) { return itowns.GeoJsonParser.parse(geojson, optionsGeoJsonParser); - }).then(function _(parsedData) { - var pyoSource = new itowns.FileSource({ - parsedData, - }); + }).then(function _(features) { + var pyoSource = new itowns.FileSource({ features }); var pyoStyle = new itowns.Style({ fill: { diff --git a/examples/source_file_shapefile.html b/examples/source_file_shapefile.html index 2c29a55667..03324e4683 100644 --- a/examples/source_file_shapefile.html +++ b/examples/source_file_shapefile.html @@ -51,10 +51,8 @@ buildExtent: true, crsOut: view.tileLayer.extent.crs, }); - }).then(function _(feature) { - var velibSource = new itowns.FileSource({ - parsedData: feature, - }); + }).then(function _(features) { + var velibSource = new itowns.FileSource({ features }); var velibStyle = new itowns.Style({ zoom: { min: 10, max: 20 },