diff --git a/examples/accessible.js b/examples/accessible.js index b46f865156..c2f6611e23 100644 --- a/examples/accessible.js +++ b/examples/accessible.js @@ -1,14 +1,14 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', @@ -17,7 +17,7 @@ var map = new Map({ collapsible: false } }), - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/animation.js b/examples/animation.js index d5a4752a26..ad92b9892b 100644 --- a/examples/animation.js +++ b/examples/animation.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {easeIn, easeOut} from '../src/ol/easing.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var london = fromLonLat([-0.12755, 51.507222]); var moscow = fromLonLat([37.6178, 55.7517]); @@ -11,7 +11,7 @@ var istanbul = fromLonLat([28.9744, 41.0128]); var rome = fromLonLat([12.5, 41.9]); var bern = fromLonLat([7.4458, 46.95]); -var view = new _ol_View_({ +var view = new View({ center: istanbul, zoom: 6 }); @@ -21,7 +21,7 @@ var map = new Map({ layers: [ new TileLayer({ preload: 4, - source: new _ol_source_OSM_() + source: new OSM() }) ], // Improve user experience by loading tiles while animating. Will make diff --git a/examples/arcgis-image.js b/examples/arcgis-image.js index eddfc20c59..e7250ed7c0 100644 --- a/examples/arcgis-image.js +++ b/examples/arcgis-image.js @@ -1,19 +1,19 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Image_ from '../src/ol/layer/Image.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_ImageArcGISRest_ from '../src/ol/source/ImageArcGISRest.js'; +import ImageLayer from '../src/ol/layer/Image.js'; +import OSM from '../src/ol/source/OSM.js'; +import ImageArcGISRest from '../src/ol/source/ImageArcGISRest.js'; var url = 'https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/' + 'Specialty/ESRI_StateCityHighway_USA/MapServer'; var layers = [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }), - new _ol_layer_Image_({ - source: new _ol_source_ImageArcGISRest_({ + new ImageLayer({ + source: new ImageArcGISRest({ ratio: 1, params: {}, url: url @@ -23,7 +23,7 @@ var layers = [ var map = new Map({ layers: layers, target: 'map', - view: new _ol_View_({ + view: new View({ center: [-10997148, 4569099], zoom: 4 }) diff --git a/examples/arcgis-tiled.js b/examples/arcgis-tiled.js index 4c49b65bfb..cb3ea87bc2 100644 --- a/examples/arcgis-tiled.js +++ b/examples/arcgis-tiled.js @@ -1,19 +1,19 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_TileArcGISRest_ from '../src/ol/source/TileArcGISRest.js'; +import OSM from '../src/ol/source/OSM.js'; +import TileArcGISRest from '../src/ol/source/TileArcGISRest.js'; var url = 'https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/' + 'Specialty/ESRI_StateCityHighway_USA/MapServer'; var layers = [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }), new TileLayer({ extent: [-13884991, 2870341, -7455066, 6338219], - source: new _ol_source_TileArcGISRest_({ + source: new TileArcGISRest({ url: url }) }) @@ -21,7 +21,7 @@ var layers = [ var map = new Map({ layers: layers, target: 'map', - view: new _ol_View_({ + view: new View({ center: [-10997148, 4569099], zoom: 4 }) diff --git a/examples/attributions.js b/examples/attributions.js index 11f51535f7..8f976dcbb4 100644 --- a/examples/attributions.js +++ b/examples/attributions.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import Attribution from '../src/ol/control/Attribution.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var attribution = new Attribution({ collapsible: false @@ -11,12 +11,12 @@ var attribution = new Attribution({ var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], controls: defaultControls({attribution: false}).extend([attribution]), target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/bing-maps.js b/examples/bing-maps.js index 97405c2f0e..0848bcdea3 100644 --- a/examples/bing-maps.js +++ b/examples/bing-maps.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; var styles = [ @@ -18,7 +18,7 @@ for (i = 0, ii = styles.length; i < ii; ++i) { layers.push(new TileLayer({ visible: false, preload: Infinity, - source: new _ol_source_BingMaps_({ + source: new BingMaps({ key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5', imagerySet: styles[i] // use maxZoom 19 to see stretched tiles instead of the BingMaps @@ -33,7 +33,7 @@ var map = new Map({ // zooming choppy on mobile or slow devices. loadTilesWhileInteracting: true, target: 'map', - view: new _ol_View_({ + view: new View({ center: [-6655.5402445057125, 6709968.258934638], zoom: 13 }) diff --git a/examples/blend-modes.js b/examples/blend-modes.js index ba8cee2da7..819f4c4798 100644 --- a/examples/blend-modes.js +++ b/examples/blend-modes.js @@ -1,9 +1,9 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -14,9 +14,9 @@ import _ol_style_Style_ from '../src/ol/style/Style.js'; // // Every layer has one feature that is styled with a circle, together the // features form the corners of an equilateral triangle and their styles overlap -var redLayer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ - features: [new _ol_Feature_(new Point([0, 0]))] +var redLayer = new VectorLayer({ + source: new VectorSource({ + features: [new Feature(new Point([0, 0]))] }), style: new _ol_style_Style_({ image: new _ol_style_Circle_({ @@ -31,10 +31,10 @@ var redLayer = new _ol_layer_Vector_({ }) }) }); -var greenLayer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var greenLayer = new VectorLayer({ + source: new VectorSource({ // 433.013 is roughly 250 * Math.sqrt(3) - features: [new _ol_Feature_(new Point([250, 433.013]))] + features: [new Feature(new Point([250, 433.013]))] }), style: new _ol_style_Style_({ image: new _ol_style_Circle_({ @@ -49,9 +49,9 @@ var greenLayer = new _ol_layer_Vector_({ }) }) }); -var blueLayer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ - features: [new _ol_Feature_(new Point([500, 0]))] +var blueLayer = new VectorLayer({ + source: new VectorSource({ + features: [new Feature(new Point([500, 0]))] }), style: new _ol_style_Style_({ image: new _ol_style_Circle_({ @@ -76,7 +76,7 @@ var map = new Map({ blueLayer ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [250, 220], extent: [0, 0, 500, 500], resolution: 4, diff --git a/examples/box-selection.js b/examples/box-selection.js index 39fe91581c..959897764b 100644 --- a/examples/box-selection.js +++ b/examples/box-selection.js @@ -1,16 +1,16 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import _ol_events_condition_ from '../src/ol/events/condition.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import DragBox from '../src/ol/interaction/DragBox.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; -var vectorSource = new _ol_source_Vector_({ +var vectorSource = new VectorSource({ url: 'data/geojson/countries.geojson', format: new GeoJSON() }); @@ -19,14 +19,14 @@ var vectorSource = new _ol_source_Vector_({ var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }), - new _ol_layer_Vector_({ + new VectorLayer({ source: vectorSource }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/button-title.js b/examples/button-title.js index 9f0356d15d..13d4bd971c 100644 --- a/examples/button-title.js +++ b/examples/button-title.js @@ -1,16 +1,16 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [-8730000, 5930000], rotation: Math.PI / 5, zoom: 8 diff --git a/examples/canvas-gradient-pattern.js b/examples/canvas-gradient-pattern.js index 5ee1c17c49..f4810a1430 100644 --- a/examples/canvas-gradient-pattern.js +++ b/examples/canvas-gradient-pattern.js @@ -1,11 +1,11 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import * as _ol_extent_ from '../src/ol/extent.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_has_ from '../src/ol/has.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; @@ -81,8 +81,8 @@ var getStackedStyle = function(feature, resolution) { }; // Create a vector layer that makes use of the style function above… -var vectorLayer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vectorLayer = new VectorLayer({ + source: new VectorSource({ url: 'data/geojson/countries.geojson', format: new GeoJSON() }), @@ -95,7 +95,7 @@ var map = new Map({ vectorLayer ], target: 'map', - view: new _ol_View_({ + view: new View({ center: fromLonLat([7, 52]), zoom: 3 }) diff --git a/examples/canvas-tiles.js b/examples/canvas-tiles.js index f6830225be..8839063a74 100644 --- a/examples/canvas-tiles.js +++ b/examples/canvas-tiles.js @@ -1,20 +1,20 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_TileDebug_ from '../src/ol/source/TileDebug.js'; +import OSM from '../src/ol/source/OSM.js'; +import TileDebug from '../src/ol/source/TileDebug.js'; -var osmSource = new _ol_source_OSM_(); +var osmSource = new OSM(); var map = new Map({ layers: [ new TileLayer({ source: osmSource }), new TileLayer({ - source: new _ol_source_TileDebug_({ + source: new TileDebug({ projection: 'EPSG:3857', tileGrid: osmSource.getTileGrid() }) @@ -26,7 +26,7 @@ var map = new Map({ collapsible: false } }), - view: new _ol_View_({ + view: new View({ center: fromLonLat([-0.1275, 51.507222]), zoom: 10 }) diff --git a/examples/cartodb.js b/examples/cartodb.js index 55fbb392be..c515b247ef 100644 --- a/examples/cartodb.js +++ b/examples/cartodb.js @@ -1,8 +1,8 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_CartoDB_ from '../src/ol/source/CartoDB.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import CartoDB from '../src/ol/source/CartoDB.js'; +import OSM from '../src/ol/source/OSM.js'; var mapConfig = { 'layers': [{ @@ -15,7 +15,7 @@ var mapConfig = { }] }; -var cartoDBSource = new _ol_source_CartoDB_({ +var cartoDBSource = new CartoDB({ account: 'documentation', config: mapConfig }); @@ -23,14 +23,14 @@ var cartoDBSource = new _ol_source_CartoDB_({ var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }), new TileLayer({ source: cartoDBSource }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/center.js b/examples/center.js index d73760d4b7..df01af6871 100644 --- a/examples/center.js +++ b/examples/center.js @@ -1,17 +1,17 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; -var source = new _ol_source_Vector_({ +var source = new VectorSource({ url: 'data/geojson/switzerland.geojson', format: new GeoJSON() }); @@ -34,18 +34,18 @@ var style = new _ol_style_Style_({ }) }) }); -var vectorLayer = new _ol_layer_Vector_({ +var vectorLayer = new VectorLayer({ source: source, style: style }); -var view = new _ol_View_({ +var view = new View({ center: [0, 0], zoom: 1 }); var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }), vectorLayer ], diff --git a/examples/cluster.js b/examples/cluster.js index 6955466de5..984abc59db 100644 --- a/examples/cluster.js +++ b/examples/cluster.js @@ -1,12 +1,12 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Cluster_ from '../src/ol/source/Cluster.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import Cluster from '../src/ol/source/Cluster.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -21,20 +21,20 @@ var features = new Array(count); var e = 4500000; for (var i = 0; i < count; ++i) { var coordinates = [2 * e * Math.random() - e, 2 * e * Math.random() - e]; - features[i] = new _ol_Feature_(new Point(coordinates)); + features[i] = new Feature(new Point(coordinates)); } -var source = new _ol_source_Vector_({ +var source = new VectorSource({ features: features }); -var clusterSource = new _ol_source_Cluster_({ +var clusterSource = new Cluster({ distance: parseInt(distance.value, 10), source: source }); var styleCache = {}; -var clusters = new _ol_layer_Vector_({ +var clusters = new VectorLayer({ source: clusterSource, style: function(feature) { var size = feature.get('features').length; @@ -64,13 +64,13 @@ var clusters = new _ol_layer_Vector_({ }); var raster = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); var map = new Map({ layers: [raster, clusters], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/color-manipulation.js b/examples/color-manipulation.js index 045018a426..b86fc42806 100644 --- a/examples/color-manipulation.js +++ b/examples/color-manipulation.js @@ -1,9 +1,9 @@ // NOCOMPILE import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; -import _ol_layer_Image_ from '../src/ol/layer/Image.js'; +import View from '../src/ol/View.js'; +import ImageLayer from '../src/ol/layer/Image.js'; import RasterSource from '../src/ol/source/Raster.js'; -import _ol_source_Stamen_ from '../src/ol/source/Stamen.js'; +import Stamen from '../src/ol/source/Stamen.js'; /** @@ -101,7 +101,7 @@ function xyz2rgb(x) { } var raster = new RasterSource({ - sources: [new _ol_source_Stamen_({ + sources: [new Stamen({ layer: 'watercolor', transition: 0 })], @@ -150,12 +150,12 @@ raster.on('beforeoperations', function(event) { var map = new Map({ layers: [ - new _ol_layer_Image_({ + new ImageLayer({ source: raster }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 2500000], zoom: 2, maxZoom: 18 diff --git a/examples/custom-controls.js b/examples/custom-controls.js index 6d7868bbec..f086020355 100644 --- a/examples/custom-controls.js +++ b/examples/custom-controls.js @@ -1,10 +1,10 @@ import {inherits} from '../src/ol/index.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import Control from '../src/ol/control/Control.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; /** @@ -67,11 +67,11 @@ var map = new Map({ ]), layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 3, rotation: 1 diff --git a/examples/custom-interactions.js b/examples/custom-interactions.js index 3e4a4add3e..7ef6119efc 100644 --- a/examples/custom-interactions.js +++ b/examples/custom-interactions.js @@ -1,16 +1,16 @@ import {inherits} from '../src/ol/index.js'; -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import LineString from '../src/ol/geom/LineString.js'; import Point from '../src/ol/geom/Point.js'; import Polygon from '../src/ol/geom/Polygon.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import _ol_interaction_Pointer_ from '../src/ol/interaction/Pointer.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_TileJSON_ from '../src/ol/source/TileJSON.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import TileJSON from '../src/ol/source/TileJSON.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -134,12 +134,12 @@ app.Drag.prototype.handleUpEvent = function() { }; -var pointFeature = new _ol_Feature_(new Point([0, 0])); +var pointFeature = new Feature(new Point([0, 0])); -var lineFeature = new _ol_Feature_( +var lineFeature = new Feature( new LineString([[-1e7, 1e6], [-1e6, 3e6]])); -var polygonFeature = new _ol_Feature_( +var polygonFeature = new Feature( new Polygon([[[-3e6, -1e6], [-3e6, 1e6], [-1e6, 1e6], [-1e6, -1e6], [-3e6, -1e6]]])); @@ -148,12 +148,12 @@ var map = new Map({ interactions: defaultInteractions().extend([new app.Drag()]), layers: [ new TileLayer({ - source: new _ol_source_TileJSON_({ + source: new TileJSON({ url: 'https://api.tiles.mapbox.com/v3/mapbox.geography-class.json?secure' }) }), - new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ + new VectorLayer({ + source: new VectorSource({ features: [pointFeature, lineFeature, polygonFeature] }), style: new _ol_style_Style_({ @@ -175,7 +175,7 @@ var map = new Map({ }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/d3.js b/examples/d3.js index 2caca226e3..c0096cb8e8 100644 --- a/examples/d3.js +++ b/examples/d3.js @@ -1,24 +1,24 @@ // NOCOMPILE import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {getWidth, getCenter} from '../src/ol/extent.js'; -import _ol_layer_Image_ from '../src/ol/layer/Image.js'; +import ImageLayer from '../src/ol/layer/Image.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat, toLonLat} from '../src/ol/proj.js'; -import _ol_source_ImageCanvas_ from '../src/ol/source/ImageCanvas.js'; -import _ol_source_Stamen_ from '../src/ol/source/Stamen.js'; +import ImageCanvasSource from '../src/ol/source/ImageCanvas.js'; +import Stamen from '../src/ol/source/Stamen.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_Stamen_({ + source: new Stamen({ layer: 'watercolor' }) }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: fromLonLat([-97, 38]), zoom: 4 }) @@ -80,8 +80,8 @@ d3.json('data/topojson/us.json', function(error, us) { return canvas.node(); }; - var layer = new _ol_layer_Image_({ - source: new _ol_source_ImageCanvas_({ + var layer = new ImageLayer({ + source: new ImageCanvasSource({ canvasFunction: canvasFunction, projection: 'EPSG:3857' }) diff --git a/examples/device-orientation.js b/examples/device-orientation.js index ea8ed3ee76..1b2147d94c 100644 --- a/examples/device-orientation.js +++ b/examples/device-orientation.js @@ -1,19 +1,19 @@ // NOCOMPILE import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {toRadians} from '../src/ol/math.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; -var view = new _ol_View_({ +var view = new View({ center: [0, 0], zoom: 2 }); var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', diff --git a/examples/drag-and-drop-image-vector.js b/examples/drag-and-drop-image-vector.js index 3921612aa8..7f69b9213d 100644 --- a/examples/drag-and-drop-image-vector.js +++ b/examples/drag-and-drop-image-vector.js @@ -1,5 +1,5 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import GPX from '../src/ol/format/GPX.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import IGC from '../src/ol/format/IGC.js'; @@ -7,10 +7,10 @@ import KML from '../src/ol/format/KML.js'; import TopoJSON from '../src/ol/format/TopoJSON.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import DragAndDrop from '../src/ol/interaction/DragAndDrop.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -97,24 +97,24 @@ var map = new Map({ interactions: defaultInteractions().extend([dragAndDropInteraction]), layers: [ new TileLayer({ - source: new _ol_source_BingMaps_({ + source: new BingMaps({ imagerySet: 'Aerial', key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5' }) }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) }); dragAndDropInteraction.on('addfeatures', function(event) { - var vectorSource = new _ol_source_Vector_({ + var vectorSource = new VectorSource({ features: event.features }); - map.addLayer(new _ol_layer_Vector_({ + map.addLayer(new VectorLayer({ renderMode: 'image', source: vectorSource, style: styleFunction diff --git a/examples/drag-and-drop.js b/examples/drag-and-drop.js index 15b56c27a5..fd61bd55f0 100644 --- a/examples/drag-and-drop.js +++ b/examples/drag-and-drop.js @@ -1,5 +1,5 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import GPX from '../src/ol/format/GPX.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import IGC from '../src/ol/format/IGC.js'; @@ -8,9 +8,9 @@ import TopoJSON from '../src/ol/format/TopoJSON.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import DragAndDrop from '../src/ol/interaction/DragAndDrop.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -97,24 +97,24 @@ var map = new Map({ interactions: defaultInteractions().extend([dragAndDropInteraction]), layers: [ new TileLayer({ - source: new _ol_source_BingMaps_({ + source: new BingMaps({ imagerySet: 'Aerial', key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5' }) }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) }); dragAndDropInteraction.on('addfeatures', function(event) { - var vectorSource = new _ol_source_Vector_({ + var vectorSource = new VectorSource({ features: event.features }); - map.addLayer(new _ol_layer_Vector_({ + map.addLayer(new VectorLayer({ source: vectorSource, style: styleFunction })); diff --git a/examples/drag-rotate-and-zoom.js b/examples/drag-rotate-and-zoom.js index f9baf924f1..8a33fd33a8 100644 --- a/examples/drag-rotate-and-zoom.js +++ b/examples/drag-rotate-and-zoom.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import DragRotateAndZoom from '../src/ol/interaction/DragRotateAndZoom.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var map = new Map({ @@ -12,11 +12,11 @@ var map = new Map({ ]), layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/draw-and-modify-features.js b/examples/draw-and-modify-features.js index a39f91854a..ef65dab1e2 100644 --- a/examples/draw-and-modify-features.js +++ b/examples/draw-and-modify-features.js @@ -1,23 +1,23 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import Draw from '../src/ol/interaction/Draw.js'; import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; var raster = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); -var source = new _ol_source_Vector_(); -var vector = new _ol_layer_Vector_({ +var source = new VectorSource(); +var vector = new VectorLayer({ source: source, style: new _ol_style_Style_({ fill: new _ol_style_Fill_({ @@ -39,7 +39,7 @@ var vector = new _ol_layer_Vector_({ var map = new Map({ layers: [raster, vector], target: 'map', - view: new _ol_View_({ + view: new View({ center: [-11000000, 4600000], zoom: 4 }) diff --git a/examples/draw-features.js b/examples/draw-features.js index 8b99e6d685..06c9332ba7 100644 --- a/examples/draw-features.js +++ b/examples/draw-features.js @@ -1,25 +1,25 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import Draw from '../src/ol/interaction/Draw.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; var raster = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); -var source = new _ol_source_Vector_({wrapX: false}); +var source = new VectorSource({wrapX: false}); -var vector = new _ol_layer_Vector_({ +var vector = new VectorLayer({ source: source }); var map = new Map({ layers: [raster, vector], target: 'map', - view: new _ol_View_({ + view: new View({ center: [-11000000, 4600000], zoom: 4 }) diff --git a/examples/draw-freehand.js b/examples/draw-freehand.js index b570a63b14..0450693466 100644 --- a/examples/draw-freehand.js +++ b/examples/draw-freehand.js @@ -1,25 +1,25 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import Draw from '../src/ol/interaction/Draw.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; var raster = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); -var source = new _ol_source_Vector_({wrapX: false}); +var source = new VectorSource({wrapX: false}); -var vector = new _ol_layer_Vector_({ +var vector = new VectorLayer({ source: source }); var map = new Map({ layers: [raster, vector], target: 'map', - view: new _ol_View_({ + view: new View({ center: [-11000000, 4600000], zoom: 4 }) diff --git a/examples/draw-shapes.js b/examples/draw-shapes.js index a82ce47e82..ea32c589ae 100644 --- a/examples/draw-shapes.js +++ b/examples/draw-shapes.js @@ -1,26 +1,26 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import Polygon from '../src/ol/geom/Polygon.js'; import Draw from '../src/ol/interaction/Draw.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; var raster = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); -var source = new _ol_source_Vector_({wrapX: false}); +var source = new VectorSource({wrapX: false}); -var vector = new _ol_layer_Vector_({ +var vector = new VectorLayer({ source: source }); var map = new Map({ layers: [raster, vector], target: 'map', - view: new _ol_View_({ + view: new View({ center: [-11000000, 4600000], zoom: 4 }) diff --git a/examples/dynamic-data.js b/examples/dynamic-data.js index 86cc8fca60..59393de30d 100644 --- a/examples/dynamic-data.js +++ b/examples/dynamic-data.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import MultiPoint from '../src/ol/geom/MultiPoint.js'; import Point from '../src/ol/geom/Point.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -13,11 +13,11 @@ import _ol_style_Style_ from '../src/ol/style/Style.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/earthquake-clusters.js b/examples/earthquake-clusters.js index 7411111705..6b08b056e0 100644 --- a/examples/earthquake-clusters.js +++ b/examples/earthquake-clusters.js @@ -1,14 +1,14 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import * as _ol_extent_ from '../src/ol/extent.js'; import KML from '../src/ol/format/KML.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Cluster_ from '../src/ol/source/Cluster.js'; -import _ol_source_Stamen_ from '../src/ol/source/Stamen.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import Cluster from '../src/ol/source/Cluster.js'; +import Stamen from '../src/ol/source/Stamen.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; @@ -121,10 +121,10 @@ function selectStyleFunction(feature) { return styles; } -vector = new _ol_layer_Vector_({ - source: new _ol_source_Cluster_({ +vector = new VectorLayer({ + source: new Cluster({ distance: 40, - source: new _ol_source_Vector_({ + source: new VectorSource({ url: 'data/kml/2012_Earthquakes_Mag5.kml', format: new KML({ extractStyles: false @@ -135,7 +135,7 @@ vector = new _ol_layer_Vector_({ }); var raster = new TileLayer({ - source: new _ol_source_Stamen_({ + source: new Stamen({ layer: 'toner' }) }); @@ -150,7 +150,7 @@ var map = new Map({ style: selectStyleFunction })]), target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/earthquake-custom-symbol.js b/examples/earthquake-custom-symbol.js index 4f4e9953b0..6375c0a526 100644 --- a/examples/earthquake-custom-symbol.js +++ b/examples/earthquake-custom-symbol.js @@ -1,12 +1,12 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import KML from '../src/ol/format/KML.js'; import Polygon from '../src/ol/geom/Polygon.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; import _ol_render_ from '../src/ol/render.js'; -import _ol_source_Stamen_ from '../src/ol/source/Stamen.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import Stamen from '../src/ol/source/Stamen.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -52,8 +52,8 @@ var styleFunction = function(feature) { return style; }; -var vector = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vector = new VectorLayer({ + source: new VectorSource({ url: 'data/kml/2012_Earthquakes_Mag5.kml', format: new KML({ extractStyles: false @@ -63,7 +63,7 @@ var vector = new _ol_layer_Vector_({ }); var raster = new TileLayer({ - source: new _ol_source_Stamen_({ + source: new Stamen({ layer: 'toner' }) }); @@ -71,7 +71,7 @@ var raster = new TileLayer({ var map = new Map({ layers: [raster, vector], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/epsg-4326.js b/examples/epsg-4326.js index 242cbbb52d..7e0850ecfc 100644 --- a/examples/epsg-4326.js +++ b/examples/epsg-4326.js @@ -1,14 +1,14 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import ScaleLine from '../src/ol/control/ScaleLine.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js'; +import TileWMS from '../src/ol/source/TileWMS.js'; var layers = [ new TileLayer({ - source: new _ol_source_TileWMS_({ + source: new TileWMS({ url: 'https://ahocevar.com/geoserver/wms', params: { 'LAYERS': 'ne:NE1_HR_LC_SR_W_DR', @@ -26,7 +26,7 @@ var map = new Map({ ]), layers: layers, target: 'map', - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], zoom: 2 diff --git a/examples/export-map.js b/examples/export-map.js index b5ddd68043..339ecd2ad9 100644 --- a/examples/export-map.js +++ b/examples/export-map.js @@ -1,21 +1,21 @@ // NOCOMPILE // this example uses FileSaver.js for which we don't have an externs file. import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }), - new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ + new VectorLayer({ + source: new VectorSource({ url: 'data/geojson/countries.geojson', format: new GeoJSON() }) @@ -27,7 +27,7 @@ var map = new Map({ collapsible: false } }), - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/export-pdf.js b/examples/export-pdf.js index c52dbfceb0..c1bdcd2a60 100644 --- a/examples/export-pdf.js +++ b/examples/export-pdf.js @@ -1,15 +1,15 @@ // NOCOMPILE import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import WKT from '../src/ol/format/WKT.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; var raster = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); var format = new WKT(); @@ -19,8 +19,8 @@ var feature = format.readFeature( '-39.1552734375, 10.689697265625 -25.0927734375))'); feature.getGeometry().transform('EPSG:4326', 'EPSG:3857'); -var vector = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vector = new VectorLayer({ + source: new VectorSource({ features: [feature] }) }); @@ -34,7 +34,7 @@ var map = new Map({ collapsible: false } }), - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/extent-interaction.js b/examples/extent-interaction.js index eef97204cf..8314d550a4 100644 --- a/examples/extent-interaction.js +++ b/examples/extent-interaction.js @@ -1,14 +1,14 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import _ol_events_condition_ from '../src/ol/events/condition.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_interaction_Extent_ from '../src/ol/interaction/Extent.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; -var vectorSource = new _ol_source_Vector_({ +var vectorSource = new VectorSource({ url: 'data/geojson/countries.geojson', format: new GeoJSON() }); @@ -16,14 +16,14 @@ var vectorSource = new _ol_source_Vector_({ var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }), - new _ol_layer_Vector_({ + new VectorLayer({ source: vectorSource }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/feature-animation.js b/examples/feature-animation.js index 9d1550626f..0631fa4991 100644 --- a/examples/feature-animation.js +++ b/examples/feature-animation.js @@ -1,15 +1,15 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_Observable_ from '../src/ol/Observable.js'; -import _ol_View_ from '../src/ol/View.js'; +import Observable from '../src/ol/Observable.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import {easeOut} from '../src/ol/easing.js'; import Point from '../src/ol/geom/Point.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; @@ -18,7 +18,7 @@ import _ol_style_Style_ from '../src/ol/style/Style.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_({ + source: new OSM({ wrapX: false }) }) @@ -29,16 +29,16 @@ var map = new Map({ } }), target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 1 }) }); -var source = new _ol_source_Vector_({ +var source = new VectorSource({ wrapX: false }); -var vector = new _ol_layer_Vector_({ +var vector = new VectorLayer({ source: source }); map.addLayer(vector); @@ -47,7 +47,7 @@ function addRandomFeature() { var x = Math.random() * 360 - 180; var y = Math.random() * 180 - 90; var geom = new Point(fromLonLat([x, y])); - var feature = new _ol_Feature_(geom); + var feature = new Feature(geom); source.addFeature(feature); } @@ -80,7 +80,7 @@ function flash(feature) { vectorContext.setStyle(style); vectorContext.drawGeometry(flashGeom); if (elapsed > duration) { - _ol_Observable_.unByKey(listenerKey); + Observable.unByKey(listenerKey); return; } // tell OpenLayers to continue postcompose animation diff --git a/examples/feature-move-animation.js b/examples/feature-move-animation.js index 27e49a0ae7..43e1157680 100644 --- a/examples/feature-move-animation.js +++ b/examples/feature-move-animation.js @@ -1,12 +1,12 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import Polyline from '../src/ol/format/Polyline.js'; import Point from '../src/ol/geom/Point.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; @@ -67,19 +67,19 @@ var route = /** @type {ol.geom.LineString} */ (new Polyline({ var routeCoords = route.getCoordinates(); var routeLength = routeCoords.length; -var routeFeature = new _ol_Feature_({ +var routeFeature = new Feature({ type: 'route', geometry: route }); -var geoMarker = new _ol_Feature_({ +var geoMarker = new Feature({ type: 'geoMarker', geometry: new Point(routeCoords[0]) }); -var startMarker = new _ol_Feature_({ +var startMarker = new Feature({ type: 'icon', geometry: new Point(routeCoords[0]) }); -var endMarker = new _ol_Feature_({ +var endMarker = new Feature({ type: 'icon', geometry: new Point(routeCoords[routeLength - 1]) }); @@ -113,8 +113,8 @@ var speed, now; var speedInput = document.getElementById('speed'); var startButton = document.getElementById('start-animation'); -var vectorLayer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vectorLayer = new VectorLayer({ + source: new VectorSource({ features: [routeFeature, geoMarker, startMarker, endMarker] }), style: function(feature) { @@ -130,7 +130,7 @@ var center = [-5639523.95, -3501274.52]; var map = new Map({ target: document.getElementById('map'), loadTilesWhileAnimating: true, - view: new _ol_View_({ + view: new View({ center: center, zoom: 10, minZoom: 2, @@ -138,7 +138,7 @@ var map = new Map({ }), layers: [ new TileLayer({ - source: new _ol_source_BingMaps_({ + source: new BingMaps({ imagerySet: 'AerialWithLabels', key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5' }) @@ -163,7 +163,7 @@ var moveFeature = function(event) { } var currentPoint = new Point(routeCoords[index]); - var feature = new _ol_Feature_(currentPoint); + var feature = new Feature(currentPoint); vectorContext.drawFeature(feature, styles.geoMarker); } // tell OpenLayers to continue the postcompose animation diff --git a/examples/flight-animation.js b/examples/flight-animation.js index 44e2b52128..fdad2f77bd 100644 --- a/examples/flight-animation.js +++ b/examples/flight-animation.js @@ -1,25 +1,25 @@ // NOCOMPILE -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import LineString from '../src/ol/geom/LineString.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Stamen_ from '../src/ol/source/Stamen.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import Stamen from '../src/ol/source/Stamen.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_Stamen_({ + source: new Stamen({ layer: 'toner' }) }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) @@ -70,7 +70,7 @@ var animateFlights = function(event) { map.render(); }; -flightsSource = new _ol_source_Vector_({ +flightsSource = new VectorSource({ wrapX: false, attributions: 'Flight data by ' + 'OpenFlights,', @@ -95,7 +95,7 @@ flightsSource = new _ol_source_Vector_({ var line = new LineString(arcLine.geometries[0].coords); line.transform('EPSG:4326', 'EPSG:3857'); - var feature = new _ol_Feature_({ + var feature = new Feature({ geometry: line, finished: false }); @@ -109,7 +109,7 @@ flightsSource = new _ol_source_Vector_({ } }); -var flightsLayer = new _ol_layer_Vector_({ +var flightsLayer = new VectorLayer({ source: flightsSource, style: function(feature) { // if the animation is still active for a feature, do not diff --git a/examples/fractal.js b/examples/fractal.js index efa413b5a6..8600e2b075 100644 --- a/examples/fractal.js +++ b/examples/fractal.js @@ -1,9 +1,9 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import LineString from '../src/ol/geom/LineString.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import VectorSource from '../src/ol/source/Vector.js'; var radius = 10e6; var cos30 = Math.cos(Math.PI / 6); @@ -15,10 +15,10 @@ var triangle = new LineString([ [0, radius], [run, -rise], [-run, -rise], [0, radius] ]); -var feature = new _ol_Feature_(triangle); +var feature = new Feature(triangle); -var layer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var layer = new VectorLayer({ + source: new VectorSource({ features: [feature] }) }); @@ -26,7 +26,7 @@ var layer = new _ol_layer_Vector_({ var map = new Map({ layers: [layer], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 1 }) diff --git a/examples/full-screen-drag-rotate-and-zoom.js b/examples/full-screen-drag-rotate-and-zoom.js index 5df99c2132..08eb37458b 100644 --- a/examples/full-screen-drag-rotate-and-zoom.js +++ b/examples/full-screen-drag-rotate-and-zoom.js @@ -1,11 +1,11 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import FullScreen from '../src/ol/control/FullScreen.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import DragRotateAndZoom from '../src/ol/interaction/DragRotateAndZoom.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; var map = new Map({ @@ -17,7 +17,7 @@ var map = new Map({ ]), layers: [ new TileLayer({ - source: new _ol_source_BingMaps_({ + source: new BingMaps({ key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5', imagerySet: 'Aerial' }) @@ -25,7 +25,7 @@ var map = new Map({ ], // Use the canvas renderer because it's currently the fastest target: 'map', - view: new _ol_View_({ + view: new View({ center: [-33519607, 5616436], rotation: -Math.PI / 8, zoom: 8 diff --git a/examples/full-screen-source.js b/examples/full-screen-source.js index e5d94aaf9f..5540db3b7d 100644 --- a/examples/full-screen-source.js +++ b/examples/full-screen-source.js @@ -1,12 +1,12 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import FullScreen from '../src/ol/control/FullScreen.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; -var view = new _ol_View_({ +var view = new View({ center: [-9101767, 2822912], zoom: 14 }); @@ -19,7 +19,7 @@ var map = new Map({ ]), layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', diff --git a/examples/full-screen.js b/examples/full-screen.js index 869ba66d68..4d9547c8f3 100644 --- a/examples/full-screen.js +++ b/examples/full-screen.js @@ -1,12 +1,12 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import FullScreen from '../src/ol/control/FullScreen.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; -var view = new _ol_View_({ +var view = new View({ center: [-9101767, 2822912], zoom: 14 }); @@ -17,7 +17,7 @@ var map = new Map({ ]), layers: [ new TileLayer({ - source: new _ol_source_BingMaps_({ + source: new BingMaps({ key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5', imagerySet: 'Aerial' }) diff --git a/examples/geojson-vt.js b/examples/geojson-vt.js index dd1d6b10d0..c284a12282 100644 --- a/examples/geojson-vt.js +++ b/examples/geojson-vt.js @@ -1,9 +1,9 @@ // NOCOMPILE import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorTileSource from '../src/ol/source/VectorTile.js'; import TileLayer from '../src/ol/layer/Tile.js'; import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; @@ -56,11 +56,11 @@ var tilePixels = new _ol_proj_Projection_({ var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) @@ -74,7 +74,7 @@ fetch(url).then(function(response) { extent: 4096, debug: 1 }); - var vectorSource = new _ol_source_VectorTile_({ + var vectorSource = new VectorTileSource({ format: new GeoJSON(), tileLoadFunction: function(tile) { var format = tile.getFormat(); diff --git a/examples/geojson.js b/examples/geojson.js index f7776cbb4f..b9c1ea093d 100644 --- a/examples/geojson.js +++ b/examples/geojson.js @@ -1,13 +1,13 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import Circle from '../src/ol/geom/Circle.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -160,13 +160,13 @@ var geojsonObject = { }] }; -var vectorSource = new _ol_source_Vector_({ +var vectorSource = new VectorSource({ features: (new GeoJSON()).readFeatures(geojsonObject) }); -vectorSource.addFeature(new _ol_Feature_(new Circle([5e6, 7e6], 1e6))); +vectorSource.addFeature(new Feature(new Circle([5e6, 7e6], 1e6))); -var vectorLayer = new _ol_layer_Vector_({ +var vectorLayer = new VectorLayer({ source: vectorSource, style: styleFunction }); @@ -174,7 +174,7 @@ var vectorLayer = new _ol_layer_Vector_({ var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }), vectorLayer ], @@ -184,7 +184,7 @@ var map = new Map({ collapsible: false } }), - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/geolocation-orientation.js b/examples/geolocation-orientation.js index 335c0ecf11..4b3e25687c 100644 --- a/examples/geolocation-orientation.js +++ b/examples/geolocation-orientation.js @@ -1,15 +1,15 @@ import Geolocation from '../src/ol/Geolocation.js'; import Map from '../src/ol/Map.js'; import _ol_Overlay_ from '../src/ol/Overlay.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import LineString from '../src/ol/geom/LineString.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; // creating the view -var view = new _ol_View_({ +var view = new View({ center: fromLonLat([5.8713, 45.6452]), zoom: 19 }); @@ -18,7 +18,7 @@ var view = new _ol_View_({ var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', diff --git a/examples/geolocation.js b/examples/geolocation.js index ab8e0d6e1f..4660adcadc 100644 --- a/examples/geolocation.js +++ b/examples/geolocation.js @@ -1,19 +1,19 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Geolocation from '../src/ol/Geolocation.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import Point from '../src/ol/geom/Point.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; -var view = new _ol_View_({ +var view = new View({ center: [0, 0], zoom: 2 }); @@ -21,7 +21,7 @@ var view = new _ol_View_({ var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', @@ -61,12 +61,12 @@ geolocation.on('error', function(error) { info.style.display = ''; }); -var accuracyFeature = new _ol_Feature_(); +var accuracyFeature = new Feature(); geolocation.on('change:accuracyGeometry', function() { accuracyFeature.setGeometry(geolocation.getAccuracyGeometry()); }); -var positionFeature = new _ol_Feature_(); +var positionFeature = new Feature(); positionFeature.setStyle(new _ol_style_Style_({ image: new _ol_style_Circle_({ radius: 6, @@ -86,9 +86,9 @@ geolocation.on('change:position', function() { new Point(coordinates) : null); }); -new _ol_layer_Vector_({ +new VectorLayer({ map: map, - source: new _ol_source_Vector_({ + source: new VectorSource({ features: [accuracyFeature, positionFeature] }) }); diff --git a/examples/getfeatureinfo-image.js b/examples/getfeatureinfo-image.js index 647ac359b0..43490c0fcd 100644 --- a/examples/getfeatureinfo-image.js +++ b/examples/getfeatureinfo-image.js @@ -1,21 +1,21 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; -import _ol_layer_Image_ from '../src/ol/layer/Image.js'; -import _ol_source_ImageWMS_ from '../src/ol/source/ImageWMS.js'; +import View from '../src/ol/View.js'; +import ImageLayer from '../src/ol/layer/Image.js'; +import ImageWMS from '../src/ol/source/ImageWMS.js'; -var wmsSource = new _ol_source_ImageWMS_({ +var wmsSource = new ImageWMS({ url: 'https://ahocevar.com/geoserver/wms', params: {'LAYERS': 'ne:ne'}, serverType: 'geoserver', crossOrigin: 'anonymous' }); -var wmsLayer = new _ol_layer_Image_({ +var wmsLayer = new ImageLayer({ source: wmsSource }); -var view = new _ol_View_({ +var view = new View({ center: [0, 0], zoom: 1 }); diff --git a/examples/getfeatureinfo-tile.js b/examples/getfeatureinfo-tile.js index 0ec94b4b51..d1bc2480ed 100644 --- a/examples/getfeatureinfo-tile.js +++ b/examples/getfeatureinfo-tile.js @@ -1,10 +1,10 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js'; +import TileWMS from '../src/ol/source/TileWMS.js'; -var wmsSource = new _ol_source_TileWMS_({ +var wmsSource = new TileWMS({ url: 'https://ahocevar.com/geoserver/wms', params: {'LAYERS': 'ne:ne', 'TILED': true}, serverType: 'geoserver', @@ -15,7 +15,7 @@ var wmsLayer = new TileLayer({ source: wmsSource }); -var view = new _ol_View_({ +var view = new View({ center: [0, 0], zoom: 1 }); diff --git a/examples/gpx.js b/examples/gpx.js index b5d1529a25..19a3322352 100644 --- a/examples/gpx.js +++ b/examples/gpx.js @@ -1,17 +1,17 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import GPX from '../src/ol/format/GPX.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; var raster = new TileLayer({ - source: new _ol_source_BingMaps_({ + source: new BingMaps({ imagerySet: 'Aerial', key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5' }) @@ -44,8 +44,8 @@ var style = { }) }; -var vector = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vector = new VectorLayer({ + source: new VectorSource({ url: 'data/gpx/fells_loop.gpx', format: new GPX() }), @@ -57,7 +57,7 @@ var vector = new _ol_layer_Vector_({ var map = new Map({ layers: [raster, vector], target: document.getElementById('map'), - view: new _ol_View_({ + view: new View({ center: [-7916041.528716288, 5228379.045749711], zoom: 12 }) diff --git a/examples/graticule.js b/examples/graticule.js index cd88513b44..7a47183a95 100644 --- a/examples/graticule.js +++ b/examples/graticule.js @@ -1,22 +1,22 @@ import Graticule from '../src/ol/Graticule.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_({ + source: new OSM({ wrapX: false }) }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: fromLonLat([4.8, 47.75]), zoom: 5 }) diff --git a/examples/heatmap-earthquakes.js b/examples/heatmap-earthquakes.js index 09fcfad319..6645652d6a 100644 --- a/examples/heatmap-earthquakes.js +++ b/examples/heatmap-earthquakes.js @@ -1,16 +1,16 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import KML from '../src/ol/format/KML.js'; import HeatmapLayer from '../src/ol/layer/Heatmap.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_Stamen_ from '../src/ol/source/Stamen.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import Stamen from '../src/ol/source/Stamen.js'; +import VectorSource from '../src/ol/source/Vector.js'; var blur = document.getElementById('blur'); var radius = document.getElementById('radius'); var vector = new HeatmapLayer({ - source: new _ol_source_Vector_({ + source: new VectorSource({ url: 'data/kml/2012_Earthquakes_Mag5.kml', format: new KML({ extractStyles: false @@ -30,7 +30,7 @@ vector.getSource().on('addfeature', function(event) { }); var raster = new TileLayer({ - source: new _ol_source_Stamen_({ + source: new Stamen({ layer: 'toner' }) }); @@ -38,7 +38,7 @@ var raster = new TileLayer({ var map = new Map({ layers: [raster, vector], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/here-maps.js b/examples/here-maps.js index feb994b014..2e6406beb1 100644 --- a/examples/here-maps.js +++ b/examples/here-maps.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_XYZ_ from '../src/ol/source/XYZ.js'; +import XYZ from '../src/ol/source/XYZ.js'; var appId = 'kDm0Jq1K4Ak7Bwtn8uvk'; var appCode = 'xnmvc4dKZrDfGlvQHXSvwQ'; @@ -59,7 +59,7 @@ for (i = 0, ii = hereLayers.length; i < ii; ++i) { layers.push(new TileLayer({ visible: false, preload: Infinity, - source: new _ol_source_XYZ_({ + source: new XYZ({ url: createUrl(urlTpl, layerDesc), attributions: 'Map Tiles © ' + new Date().getFullYear() + ' ' + 'HERE' @@ -73,7 +73,7 @@ var map = new Map({ // zooming choppy on mobile or slow devices. loadTilesWhileInteracting: true, target: 'map', - view: new _ol_View_({ + view: new View({ center: [921371.9389, 6358337.7609], zoom: 10 }) diff --git a/examples/hit-tolerance.js b/examples/hit-tolerance.js index 1cab8284c3..8c1b060dfb 100644 --- a/examples/hit-tolerance.js +++ b/examples/hit-tolerance.js @@ -1,16 +1,16 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; -import _ol_Feature_ from '../src/ol/Feature.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; +import Feature from '../src/ol/Feature.js'; import LineString from '../src/ol/geom/LineString.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; var raster = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); var style = new _ol_style_Style_({ @@ -20,10 +20,10 @@ var style = new _ol_style_Style_({ }) }); -var feature = new _ol_Feature_(new LineString([[-4000000, 0], [4000000, 0]])); +var feature = new Feature(new LineString([[-4000000, 0], [4000000, 0]])); -var vector = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vector = new VectorLayer({ + source: new VectorSource({ features: [feature] }), style: style @@ -32,7 +32,7 @@ var vector = new _ol_layer_Vector_({ var map = new Map({ layers: [raster, vector], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/icon-color.js b/examples/icon-color.js index 1be4531fc4..b1380ed6b3 100644 --- a/examples/icon-color.js +++ b/examples/icon-color.js @@ -1,25 +1,25 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_TileJSON_ from '../src/ol/source/TileJSON.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import TileJSON from '../src/ol/source/TileJSON.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; -var rome = new _ol_Feature_({ +var rome = new Feature({ geometry: new Point(fromLonLat([12.5, 41.9])) }); -var london = new _ol_Feature_({ +var london = new Feature({ geometry: new Point(fromLonLat([-0.12755, 51.507222])) }); -var madrid = new _ol_Feature_({ +var madrid = new Feature({ geometry: new Point(fromLonLat([-3.683333, 40.4])) }); @@ -48,16 +48,16 @@ madrid.setStyle(new _ol_style_Style_({ })); -var vectorSource = new _ol_source_Vector_({ +var vectorSource = new VectorSource({ features: [rome, london, madrid] }); -var vectorLayer = new _ol_layer_Vector_({ +var vectorLayer = new VectorLayer({ source: vectorSource }); var rasterLayer = new TileLayer({ - source: new _ol_source_TileJSON_({ + source: new TileJSON({ url: 'https://api.tiles.mapbox.com/v3/mapbox.geography-class.json?secure', crossOrigin: '' }) @@ -66,7 +66,7 @@ var rasterLayer = new TileLayer({ var map = new Map({ layers: [rasterLayer, vectorLayer], target: document.getElementById('map'), - view: new _ol_View_({ + view: new View({ center: fromLonLat([2.896372, 44.60240]), zoom: 3 }) diff --git a/examples/icon-negative.js b/examples/icon-negative.js index 2bf9b04a28..ed82c9a723 100644 --- a/examples/icon-negative.js +++ b/examples/icon-negative.js @@ -1,12 +1,12 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Stamen_ from '../src/ol/source/Stamen.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import Stamen from '../src/ol/source/Stamen.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; @@ -23,23 +23,23 @@ function createStyle(src, img) { }); } -var iconFeature = new _ol_Feature_(new Point([0, 0])); +var iconFeature = new Feature(new Point([0, 0])); iconFeature.set('style', createStyle('data/icon.png', undefined)); var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_Stamen_({layer: 'watercolor'}) + source: new Stamen({layer: 'watercolor'}) }), - new _ol_layer_Vector_({ + new VectorLayer({ style: function(feature) { return feature.get('style'); }, - source: new _ol_source_Vector_({features: [iconFeature]}) + source: new VectorSource({features: [iconFeature]}) }) ], target: document.getElementById('map'), - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 3 }) diff --git a/examples/icon-sprite-webgl.js b/examples/icon-sprite-webgl.js index 3313f039f3..3e04f117e6 100644 --- a/examples/icon-sprite-webgl.js +++ b/examples/icon-sprite-webgl.js @@ -1,9 +1,9 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; @@ -63,7 +63,7 @@ var e = 25000000; for (i = 0; i < featureCount; ++i) { geometry = new Point( [2 * e * Math.random() - e, 2 * e * Math.random() - e]); - feature = new _ol_Feature_(geometry); + feature = new Feature(geometry); feature.setStyle( new _ol_style_Style_({ image: icons[i % (iconCount - 1)] @@ -72,10 +72,10 @@ for (i = 0; i < featureCount; ++i) { features[i] = feature; } -var vectorSource = new _ol_source_Vector_({ +var vectorSource = new VectorSource({ features: features }); -var vector = new _ol_layer_Vector_({ +var vector = new VectorLayer({ source: vectorSource }); @@ -83,7 +83,7 @@ var map = new Map({ renderer: /** @type {Array} */ (['webgl', 'canvas']), layers: [vector], target: document.getElementById('map'), - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 5 }) @@ -96,9 +96,9 @@ for (i = 0; i < featureCount; i += 30) { overlayFeatures.push(clone); } -new _ol_layer_Vector_({ +new VectorLayer({ map: map, - source: new _ol_source_Vector_({ + source: new VectorSource({ features: overlayFeatures }), style: new _ol_style_Style_({ diff --git a/examples/icon.js b/examples/icon.js index 0c3535ddee..5885b6a218 100644 --- a/examples/icon.js +++ b/examples/icon.js @@ -1,17 +1,17 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; import _ol_Overlay_ from '../src/ol/Overlay.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_TileJSON_ from '../src/ol/source/TileJSON.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import TileJSON from '../src/ol/source/TileJSON.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; -var iconFeature = new _ol_Feature_({ +var iconFeature = new Feature({ geometry: new Point([0, 0]), name: 'Null Island', population: 4000, @@ -29,16 +29,16 @@ var iconStyle = new _ol_style_Style_({ iconFeature.setStyle(iconStyle); -var vectorSource = new _ol_source_Vector_({ +var vectorSource = new VectorSource({ features: [iconFeature] }); -var vectorLayer = new _ol_layer_Vector_({ +var vectorLayer = new VectorLayer({ source: vectorSource }); var rasterLayer = new TileLayer({ - source: new _ol_source_TileJSON_({ + source: new TileJSON({ url: 'https://api.tiles.mapbox.com/v3/mapbox.geography-class.json?secure', crossOrigin: '' }) @@ -47,7 +47,7 @@ var rasterLayer = new TileLayer({ var map = new Map({ layers: [rasterLayer, vectorLayer], target: document.getElementById('map'), - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 3 }) diff --git a/examples/igc.js b/examples/igc.js index c848e80217..2faf483adf 100644 --- a/examples/igc.js +++ b/examples/igc.js @@ -1,14 +1,14 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import IGC from '../src/ol/format/IGC.js'; import LineString from '../src/ol/geom/LineString.js'; import Point from '../src/ol/geom/Point.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -39,7 +39,7 @@ var styleFunction = function(feature) { return style; }; -var vectorSource = new _ol_source_Vector_(); +var vectorSource = new VectorSource(); var igcUrls = [ 'data/igc/Clement-Latour.igc', @@ -83,16 +83,16 @@ vectorSource.on('addfeature', function(event) { var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_({ + source: new OSM({ attributions: [ 'All maps © OpenCycleMap', - _ol_source_OSM_.ATTRIBUTION + OSM.ATTRIBUTION ], url: 'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png' + '?apikey=0e6fc415256d4fbb9b5166a718591d71' }) }), - new _ol_layer_Vector_({ + new VectorLayer({ source: vectorSource, style: styleFunction }) @@ -103,7 +103,7 @@ var map = new Map({ collapsible: false } }), - view: new _ol_View_({ + view: new View({ center: [703365.7089403362, 5714629.865071137], zoom: 9 }) @@ -175,8 +175,8 @@ map.on('postcompose', function(evt) { } }); -var featureOverlay = new _ol_layer_Vector_({ - source: new _ol_source_Vector_(), +var featureOverlay = new VectorLayer({ + source: new VectorSource(), map: map, style: new _ol_style_Style_({ image: new _ol_style_Circle_({ @@ -196,7 +196,7 @@ document.getElementById('time').addEventListener('input', function() { var coordinate = geometry.getCoordinateAtM(m, true); var highlight = feature.get('highlight'); if (highlight === undefined) { - highlight = new _ol_Feature_(new Point(coordinate)); + highlight = new Feature(new Point(coordinate)); feature.set('highlight', highlight); featureOverlay.getSource().addFeature(highlight); } else { diff --git a/examples/image-filter.js b/examples/image-filter.js index dcdc05680d..83eb980f96 100644 --- a/examples/image-filter.js +++ b/examples/image-filter.js @@ -1,19 +1,19 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; var key = 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'; var imagery = new TileLayer({ - source: new _ol_source_BingMaps_({key: key, imagerySet: 'Aerial'}) + source: new BingMaps({key: key, imagerySet: 'Aerial'}) }); var map = new Map({ layers: [imagery], target: 'map', - view: new _ol_View_({ + view: new View({ center: fromLonLat([-120, 50]), zoom: 6 }) diff --git a/examples/image-load-events.js b/examples/image-load-events.js index 84e91d5bcd..7eb36831ad 100644 --- a/examples/image-load-events.js +++ b/examples/image-load-events.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; -import _ol_layer_Image_ from '../src/ol/layer/Image.js'; -import _ol_source_ImageWMS_ from '../src/ol/source/ImageWMS.js'; +import View from '../src/ol/View.js'; +import ImageLayer from '../src/ol/layer/Image.js'; +import ImageWMS from '../src/ol/source/ImageWMS.js'; /** @@ -77,7 +77,7 @@ Progress.prototype.hide = function() { var progress = new Progress(document.getElementById('progress')); -var source = new _ol_source_ImageWMS_({ +var source = new ImageWMS({ url: 'https://ahocevar.com/geoserver/wms', params: {'LAYERS': 'topp:states'}, serverType: 'geoserver' @@ -96,10 +96,10 @@ source.on('imageloaderror', function() { var map = new Map({ layers: [ - new _ol_layer_Image_({source: source}) + new ImageLayer({source: source}) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [-10997148, 4569099], zoom: 4 }) diff --git a/examples/image-vector-layer.js b/examples/image-vector-layer.js index 49b73b1495..55a1d0ed65 100644 --- a/examples/image-vector-layer.js +++ b/examples/image-vector-layer.js @@ -1,8 +1,8 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; @@ -22,9 +22,9 @@ var style = new _ol_style_Style_({ var map = new Map({ layers: [ - new _ol_layer_Vector_({ + new VectorLayer({ renderMode: 'image', - source: new _ol_source_Vector_({ + source: new VectorSource({ url: 'data/geojson/countries.geojson', format: new GeoJSON() }), @@ -35,14 +35,14 @@ var map = new Map({ }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 1 }) }); -var featureOverlay = new _ol_layer_Vector_({ - source: new _ol_source_Vector_(), +var featureOverlay = new VectorLayer({ + source: new VectorSource(), map: map, style: new _ol_style_Style_({ stroke: new _ol_style_Stroke_({ diff --git a/examples/jsts.js b/examples/jsts.js index fcfd01bad6..e27e638505 100644 --- a/examples/jsts.js +++ b/examples/jsts.js @@ -1,16 +1,16 @@ // NOCOMPILE // this example uses JSTS for which we don't have an externs file. import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; -var source = new _ol_source_Vector_(); +var source = new VectorSource(); fetch('data/geojson/roads-seoul.geojson').then(function(response) { return response.json(); }).then(function(json) { @@ -33,18 +33,18 @@ fetch('data/geojson/roads-seoul.geojson').then(function(response) { source.addFeatures(features); }); -var vectorLayer = new _ol_layer_Vector_({ +var vectorLayer = new VectorLayer({ source: source }); var rasterLayer = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); var map = new Map({ layers: [rasterLayer, vectorLayer], target: document.getElementById('map'), - view: new _ol_View_({ + view: new View({ center: fromLonLat([126.979293, 37.528787]), zoom: 15 }) diff --git a/examples/kml-earthquakes.js b/examples/kml-earthquakes.js index 82d19ea1e5..f696525a85 100644 --- a/examples/kml-earthquakes.js +++ b/examples/kml-earthquakes.js @@ -1,10 +1,10 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import KML from '../src/ol/format/KML.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Stamen_ from '../src/ol/source/Stamen.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import Stamen from '../src/ol/source/Stamen.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -38,8 +38,8 @@ var styleFunction = function(feature) { return style; }; -var vector = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vector = new VectorLayer({ + source: new VectorSource({ url: 'data/kml/2012_Earthquakes_Mag5.kml', format: new KML({ extractStyles: false @@ -49,7 +49,7 @@ var vector = new _ol_layer_Vector_({ }); var raster = new TileLayer({ - source: new _ol_source_Stamen_({ + source: new Stamen({ layer: 'toner' }) }); @@ -57,7 +57,7 @@ var raster = new TileLayer({ var map = new Map({ layers: [raster, vector], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/kml-timezones.js b/examples/kml-timezones.js index 23db827d56..54ea073ebc 100644 --- a/examples/kml-timezones.js +++ b/examples/kml-timezones.js @@ -1,10 +1,10 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import KML from '../src/ol/format/KML.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Stamen_ from '../src/ol/source/Stamen.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import Stamen from '../src/ol/source/Stamen.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; @@ -45,8 +45,8 @@ var styleFunction = function(feature) { }); }; -var vector = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vector = new VectorLayer({ + source: new VectorSource({ url: 'data/kml/timezones.kml', format: new KML({ extractStyles: false @@ -56,7 +56,7 @@ var vector = new _ol_layer_Vector_({ }); var raster = new TileLayer({ - source: new _ol_source_Stamen_({ + source: new Stamen({ layer: 'toner' }) }); @@ -64,7 +64,7 @@ var raster = new TileLayer({ var map = new Map({ layers: [raster, vector], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/kml.js b/examples/kml.js index 1e78383f78..9afaf5cd92 100644 --- a/examples/kml.js +++ b/examples/kml.js @@ -1,20 +1,20 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import KML from '../src/ol/format/KML.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; +import VectorSource from '../src/ol/source/Vector.js'; var raster = new TileLayer({ - source: new _ol_source_BingMaps_({ + source: new BingMaps({ imagerySet: 'Aerial', key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5' }) }); -var vector = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vector = new VectorLayer({ + source: new VectorSource({ url: 'data/kml/2012-02-10.kml', format: new KML() }) @@ -23,7 +23,7 @@ var vector = new _ol_layer_Vector_({ var map = new Map({ layers: [raster, vector], target: document.getElementById('map'), - view: new _ol_View_({ + view: new View({ center: [876970.8463461736, 5859807.853963373], projection: 'EPSG:3857', zoom: 10 diff --git a/examples/layer-clipping-webgl.js b/examples/layer-clipping-webgl.js index 1ed0abeff2..d92b474466 100644 --- a/examples/layer-clipping-webgl.js +++ b/examples/layer-clipping-webgl.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import _ol_has_ from '../src/ol/has.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; if (!_ol_has_.WEBGL) { var info = document.getElementById('no-webgl'); @@ -14,7 +14,7 @@ if (!_ol_has_.WEBGL) { } else { var osm = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); var map = new Map({ @@ -26,7 +26,7 @@ if (!_ol_has_.WEBGL) { collapsible: false } }), - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/layer-clipping.js b/examples/layer-clipping.js index 6396f18e9f..ecf7618f05 100644 --- a/examples/layer-clipping.js +++ b/examples/layer-clipping.js @@ -1,11 +1,11 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var osm = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); var map = new Map({ @@ -16,7 +16,7 @@ var map = new Map({ collapsible: false } }), - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/layer-extent.js b/examples/layer-extent.js index 5a14be36fa..dd7ff5d6b7 100644 --- a/examples/layer-extent.js +++ b/examples/layer-extent.js @@ -1,8 +1,8 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {transformExtent} from '../src/ol/proj.js'; -import _ol_source_TileJSON_ from '../src/ol/source/TileJSON.js'; +import TileJSON from '../src/ol/source/TileJSON.js'; function transform(extent) { return transformExtent(extent, 'EPSG:4326', 'EPSG:3857'); @@ -16,7 +16,7 @@ var extents = { }; var base = new TileLayer({ - source: new _ol_source_TileJSON_({ + source: new TileJSON({ url: 'https://api.tiles.mapbox.com/v3/mapbox.world-light.json?secure', crossOrigin: 'anonymous' }) @@ -24,7 +24,7 @@ var base = new TileLayer({ var overlay = new TileLayer({ extent: extents.India, - source: new _ol_source_TileJSON_({ + source: new TileJSON({ url: 'https://api.tiles.mapbox.com/v3/mapbox.world-black.json?secure', crossOrigin: 'anonymous' }) @@ -33,7 +33,7 @@ var overlay = new TileLayer({ var map = new Map({ layers: [base, overlay], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 1 }) diff --git a/examples/layer-group.js b/examples/layer-group.js index 72a5c7dec6..50830955b7 100644 --- a/examples/layer-group.js +++ b/examples/layer-group.js @@ -1,25 +1,25 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import _ol_layer_Group_ from '../src/ol/layer/Group.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_TileJSON_ from '../src/ol/source/TileJSON.js'; +import OSM from '../src/ol/source/OSM.js'; +import TileJSON from '../src/ol/source/TileJSON.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }), new _ol_layer_Group_({ layers: [ new TileLayer({ - source: new _ol_source_TileJSON_({ + source: new TileJSON({ url: 'https://api.tiles.mapbox.com/v3/mapbox.20110804-hoa-foodinsecurity-3month.json?secure', crossOrigin: 'anonymous' }) }), new TileLayer({ - source: new _ol_source_TileJSON_({ + source: new TileJSON({ url: 'https://api.tiles.mapbox.com/v3/mapbox.world-borders-light.json?secure', crossOrigin: 'anonymous' }) @@ -28,7 +28,7 @@ var map = new Map({ }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: fromLonLat([37.40570, 8.81566]), zoom: 4 }) diff --git a/examples/layer-spy.js b/examples/layer-spy.js index 10c6eff9ef..53464b978a 100644 --- a/examples/layer-spy.js +++ b/examples/layer-spy.js @@ -1,17 +1,17 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; var key = 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'; var roads = new TileLayer({ - source: new _ol_source_BingMaps_({key: key, imagerySet: 'Road'}) + source: new BingMaps({key: key, imagerySet: 'Road'}) }); var imagery = new TileLayer({ - source: new _ol_source_BingMaps_({key: key, imagerySet: 'Aerial'}) + source: new BingMaps({key: key, imagerySet: 'Aerial'}) }); var container = document.getElementById('map'); @@ -19,7 +19,7 @@ var container = document.getElementById('map'); var map = new Map({ layers: [roads, imagery], target: container, - view: new _ol_View_({ + view: new View({ center: fromLonLat([-109, 46.5]), zoom: 6 }) diff --git a/examples/layer-swipe.js b/examples/layer-swipe.js index da1b0a0012..cff2119e48 100644 --- a/examples/layer-swipe.js +++ b/examples/layer-swipe.js @@ -1,15 +1,15 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; +import OSM from '../src/ol/source/OSM.js'; var osm = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); var bing = new TileLayer({ - source: new _ol_source_BingMaps_({ + source: new BingMaps({ key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5', imagerySet: 'Aerial' }) @@ -23,7 +23,7 @@ var map = new Map({ collapsible: false } }), - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/layer-z-index.js b/examples/layer-z-index.js index bd03887db9..7d13dd8a62 100644 --- a/examples/layer-z-index.js +++ b/examples/layer-z-index.js @@ -1,9 +1,9 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -46,14 +46,14 @@ var styles = { function createLayer(coordinates, style, zIndex) { - var feature = new _ol_Feature_(new Point(coordinates)); + var feature = new Feature(new Point(coordinates)); feature.setStyle(style); - var source = new _ol_source_Vector_({ + var source = new VectorSource({ features: [feature] }); - var vectorLayer = new _ol_layer_Vector_({ + var vectorLayer = new VectorLayer({ source: source }); vectorLayer.setZIndex(zIndex); @@ -72,7 +72,7 @@ layers.push(layer2); var map = new Map({ layers: layers, target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 18 }) diff --git a/examples/lazy-source.js b/examples/lazy-source.js index 93a16954d1..133a8b59b1 100644 --- a/examples/lazy-source.js +++ b/examples/lazy-source.js @@ -1,16 +1,16 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; -var source = new _ol_source_OSM_(); +var source = new OSM(); var layer = new TileLayer(); var map = new Map({ layers: [layer], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/line-arrows.js b/examples/line-arrows.js index bb970d6d1f..14e7310731 100644 --- a/examples/line-arrows.js +++ b/examples/line-arrows.js @@ -1,20 +1,20 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.js'; import Draw from '../src/ol/interaction/Draw.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; var raster = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); -var source = new _ol_source_Vector_(); +var source = new VectorSource(); var styleFunction = function(feature) { var geometry = feature.getGeometry(); @@ -46,7 +46,7 @@ var styleFunction = function(feature) { return styles; }; -var vector = new _ol_layer_Vector_({ +var vector = new VectorLayer({ source: source, style: styleFunction }); @@ -54,7 +54,7 @@ var vector = new _ol_layer_Vector_({ var map = new Map({ layers: [raster, vector], target: 'map', - view: new _ol_View_({ + view: new View({ center: [-11000000, 4600000], zoom: 4 }) diff --git a/examples/localized-openstreetmap.js b/examples/localized-openstreetmap.js index 5ad4e9459a..6f5a84266e 100644 --- a/examples/localized-openstreetmap.js +++ b/examples/localized-openstreetmap.js @@ -1,15 +1,15 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var openCycleMapLayer = new TileLayer({ - source: new _ol_source_OSM_({ + source: new OSM({ attributions: [ 'All maps © OpenCycleMap', - _ol_source_OSM_.ATTRIBUTION + OSM.ATTRIBUTION ], url: 'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png' + '?apikey=0e6fc415256d4fbb9b5166a718591d71' @@ -17,10 +17,10 @@ var openCycleMapLayer = new TileLayer({ }); var openSeaMapLayer = new TileLayer({ - source: new _ol_source_OSM_({ + source: new OSM({ attributions: [ 'All maps © OpenSeaMap', - _ol_source_OSM_.ATTRIBUTION + OSM.ATTRIBUTION ], opaque: false, url: 'https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png' @@ -39,7 +39,7 @@ var map = new Map({ collapsible: false } }), - view: new _ol_View_({ + view: new View({ maxZoom: 18, center: [-244780.24508882355, 5986452.183179816], zoom: 15 diff --git a/examples/magnify.js b/examples/magnify.js index 2f60d5333e..ff3cf13606 100644 --- a/examples/magnify.js +++ b/examples/magnify.js @@ -1,13 +1,13 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; var key = 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'; var imagery = new TileLayer({ - source: new _ol_source_BingMaps_({key: key, imagerySet: 'Aerial'}) + source: new BingMaps({key: key, imagerySet: 'Aerial'}) }); var container = document.getElementById('map'); @@ -15,7 +15,7 @@ var container = document.getElementById('map'); var map = new Map({ layers: [imagery], target: container, - view: new _ol_View_({ + view: new View({ center: fromLonLat([-109, 46.5]), zoom: 6 }) diff --git a/examples/mapbox-vector-tiles-advanced.js b/examples/mapbox-vector-tiles-advanced.js index 941523b8af..8b6b0d3d6f 100644 --- a/examples/mapbox-vector-tiles-advanced.js +++ b/examples/mapbox-vector-tiles-advanced.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import MVT from '../src/ol/format/MVT.js'; import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; import {get as getProjection} from '../src/ol/proj.js'; -import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; +import VectorTileSource from '../src/ol/source/VectorTile.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -33,7 +33,7 @@ function tileUrlFunction(tileCoord) { var map = new Map({ layers: [ new _ol_layer_VectorTile_({ - source: new _ol_source_VectorTile_({ + source: new VectorTileSource({ attributions: '© Mapbox ' + '© ' + 'OpenStreetMap contributors', @@ -49,7 +49,7 @@ var map = new Map({ }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], minZoom: 1, zoom: 2 diff --git a/examples/mapbox-vector-tiles.js b/examples/mapbox-vector-tiles.js index 16677950aa..cec13bfa6e 100644 --- a/examples/mapbox-vector-tiles.js +++ b/examples/mapbox-vector-tiles.js @@ -1,8 +1,8 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import MVT from '../src/ol/format/MVT.js'; import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; -import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; +import VectorTileSource from '../src/ol/source/VectorTile.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -16,7 +16,7 @@ var map = new Map({ layers: [ new _ol_layer_VectorTile_({ declutter: true, - source: new _ol_source_VectorTile_({ + source: new VectorTileSource({ attributions: '© Mapbox ' + '© ' + 'OpenStreetMap contributors', @@ -28,7 +28,7 @@ var map = new Map({ }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/mapguide-untiled.js b/examples/mapguide-untiled.js index afc000dad6..6a10498673 100644 --- a/examples/mapguide-untiled.js +++ b/examples/mapguide-untiled.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; -import _ol_layer_Image_ from '../src/ol/layer/Image.js'; -import _ol_source_ImageMapGuide_ from '../src/ol/source/ImageMapGuide.js'; +import View from '../src/ol/View.js'; +import ImageLayer from '../src/ol/layer/Image.js'; +import ImageMapGuide from '../src/ol/source/ImageMapGuide.js'; var mdf = 'Library://Public/Samples/Sheboygan/Maps/Sheboygan.MapDefinition'; var agentUrl = @@ -14,9 +14,9 @@ var bounds = [ ]; var map = new Map({ layers: [ - new _ol_layer_Image_({ + new ImageLayer({ extent: bounds, - source: new _ol_source_ImageMapGuide_({ + source: new ImageMapGuide({ projection: 'EPSG:4326', url: agentUrl, useOverlay: false, @@ -32,7 +32,7 @@ var map = new Map({ }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [-87.7302542509315, 43.744459064634], projection: 'EPSG:4326', zoom: 12 diff --git a/examples/measure.js b/examples/measure.js index 4a73e8842a..5e504ba953 100644 --- a/examples/measure.js +++ b/examples/measure.js @@ -1,15 +1,15 @@ import Map from '../src/ol/Map.js'; -import _ol_Observable_ from '../src/ol/Observable.js'; +import Observable from '../src/ol/Observable.js'; import _ol_Overlay_ from '../src/ol/Overlay.js'; import {getArea, getLength} from '../src/ol/sphere.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import LineString from '../src/ol/geom/LineString.js'; import Polygon from '../src/ol/geom/Polygon.js'; import Draw from '../src/ol/interaction/Draw.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -17,12 +17,12 @@ import _ol_style_Style_ from '../src/ol/style/Style.js'; var raster = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); -var source = new _ol_source_Vector_(); +var source = new VectorSource(); -var vector = new _ol_layer_Vector_({ +var vector = new VectorLayer({ source: source, style: new _ol_style_Style_({ fill: new _ol_style_Fill_({ @@ -121,7 +121,7 @@ var pointerMoveHandler = function(evt) { var map = new Map({ layers: [raster, vector], target: 'map', - view: new _ol_View_({ + view: new View({ center: [-11000000, 4600000], zoom: 15 }) @@ -238,7 +238,7 @@ function addInteraction() { // unset tooltip so that a new one can be created measureTooltipElement = null; createMeasureTooltip(); - _ol_Observable_.unByKey(listener); + Observable.unByKey(listener); }, this); } diff --git a/examples/min-max-resolution.js b/examples/min-max-resolution.js index d191d7f5b7..cd8ecd303f 100644 --- a/examples/min-max-resolution.js +++ b/examples/min-max-resolution.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_TileJSON_ from '../src/ol/source/TileJSON.js'; +import OSM from '../src/ol/source/OSM.js'; +import TileJSON from '../src/ol/source/TileJSON.js'; /** @@ -12,12 +12,12 @@ import _ol_source_TileJSON_ from '../src/ol/source/TileJSON.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_(), + source: new OSM(), minResolution: 200, maxResolution: 2000 }), new TileLayer({ - source: new _ol_source_TileJSON_({ + source: new TileJSON({ url: 'https://api.tiles.mapbox.com/v3/mapbox.natural-earth-hypso-bathy.json?secure', crossOrigin: 'anonymous' }), @@ -31,7 +31,7 @@ var map = new Map({ collapsible: false } }), - view: new _ol_View_({ + view: new View({ center: [653600, 5723680], zoom: 5 }) diff --git a/examples/min-zoom.js b/examples/min-zoom.js index 366629504f..ecc51b1cf8 100644 --- a/examples/min-zoom.js +++ b/examples/min-zoom.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var viewport = document.getElementById('map'); @@ -12,7 +12,7 @@ function getMinZoom() { var initialZoom = getMinZoom(); -var view = new _ol_View_({ +var view = new View({ center: [0, 0], minZoom: initialZoom, zoom: initialZoom @@ -21,7 +21,7 @@ var view = new _ol_View_({ var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', diff --git a/examples/mobile-full-screen.js b/examples/mobile-full-screen.js index 20ae22f86c..59ae12bc02 100644 --- a/examples/mobile-full-screen.js +++ b/examples/mobile-full-screen.js @@ -1,11 +1,11 @@ import Geolocation from '../src/ol/Geolocation.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; -var view = new _ol_View_({ +var view = new View({ center: [0, 0], zoom: 2 }); @@ -13,7 +13,7 @@ var view = new _ol_View_({ var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_BingMaps_({ + source: new BingMaps({ key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5', imagerySet: 'Road' }) diff --git a/examples/modify-features.js b/examples/modify-features.js index 997be2d727..ba85ad8957 100644 --- a/examples/modify-features.js +++ b/examples/modify-features.js @@ -1,21 +1,21 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; var raster = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); -var vector = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vector = new VectorLayer({ + source: new VectorSource({ url: 'data/geojson/countries.geojson', format: new GeoJSON(), wrapX: false @@ -34,7 +34,7 @@ var map = new Map({ interactions: defaultInteractions().extend([select, modify]), layers: [raster, vector], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/modify-test.js b/examples/modify-test.js index d886c6228d..e9991ff0c2 100644 --- a/examples/modify-test.js +++ b/examples/modify-test.js @@ -1,11 +1,11 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -144,11 +144,11 @@ var geojsonObject = { }] }; -var source = new _ol_source_Vector_({ +var source = new VectorSource({ features: (new GeoJSON()).readFeatures(geojsonObject) }); -var layer = new _ol_layer_Vector_({ +var layer = new VectorLayer({ source: source, style: styleFunction }); @@ -235,7 +235,7 @@ var map = new Map({ interactions: defaultInteractions().extend([select, modify]), layers: [layer], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 1000000], zoom: 2 }) diff --git a/examples/mouse-position.js b/examples/mouse-position.js index ef0d22fd37..14e1433ad2 100644 --- a/examples/mouse-position.js +++ b/examples/mouse-position.js @@ -1,10 +1,10 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import MousePosition from '../src/ol/control/MousePosition.js'; import _ol_coordinate_ from '../src/ol/coordinate.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var mousePositionControl = new MousePosition({ coordinateFormat: _ol_coordinate_.createStringXY(4), @@ -24,11 +24,11 @@ var map = new Map({ }).extend([mousePositionControl]), layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/mousewheel-zoom.js b/examples/mousewheel-zoom.js index 2a794e859a..a73b1b10cf 100644 --- a/examples/mousewheel-zoom.js +++ b/examples/mousewheel-zoom.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import MouseWheelZoom from '../src/ol/interaction/MouseWheelZoom.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var map = new Map({ @@ -14,11 +14,11 @@ var map = new Map({ ]), layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/moveend.js b/examples/moveend.js index fd3ee25d63..3cfffb714b 100644 --- a/examples/moveend.js +++ b/examples/moveend.js @@ -1,16 +1,16 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import * as _ol_extent_ from '../src/ol/extent.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {toLonLat} from '../src/ol/proj.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', @@ -19,7 +19,7 @@ var map = new Map({ collapsible: false } }), - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/navigation-controls.js b/examples/navigation-controls.js index f578dc1ff7..863da95955 100644 --- a/examples/navigation-controls.js +++ b/examples/navigation-controls.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import ZoomToExtent from '../src/ol/control/ZoomToExtent.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var map = new Map({ @@ -21,11 +21,11 @@ var map = new Map({ ]), layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/osm-vector-tiles.js b/examples/osm-vector-tiles.js index 2be32d7518..05ac9d689d 100644 --- a/examples/osm-vector-tiles.js +++ b/examples/osm-vector-tiles.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TopoJSON from '../src/ol/format/TopoJSON.js'; import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; +import VectorTileSource from '../src/ol/source/VectorTile.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; @@ -61,7 +61,7 @@ var roadStyle = function(feature) { var map = new Map({ layers: [ new _ol_layer_VectorTile_({ - source: new _ol_source_VectorTile_({ + source: new VectorTileSource({ attributions: '© OpenStreetMap contributors, Who’s On First, ' + 'Natural Earth, and openstreetmapdata.com', format: new TopoJSON({ @@ -82,7 +82,7 @@ var map = new Map({ }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: fromLonLat([-74.0064, 40.7142]), maxZoom: 19, zoom: 15 diff --git a/examples/overlay.js b/examples/overlay.js index 2caccaea2b..2253c8a3c1 100644 --- a/examples/overlay.js +++ b/examples/overlay.js @@ -1,20 +1,20 @@ import Map from '../src/ol/Map.js'; import _ol_Overlay_ from '../src/ol/Overlay.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import _ol_coordinate_ from '../src/ol/coordinate.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat, toLonLat} from '../src/ol/proj.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var layer = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); var map = new Map({ layers: [layer], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/overviewmap-custom.js b/examples/overviewmap-custom.js index 3854633c9b..0ac6a41ba3 100644 --- a/examples/overviewmap-custom.js +++ b/examples/overviewmap-custom.js @@ -1,11 +1,11 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import OverviewMap from '../src/ol/control/OverviewMap.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import DragRotateAndZoom from '../src/ol/interaction/DragRotateAndZoom.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var overviewMapControl = new OverviewMap({ @@ -13,7 +13,7 @@ var overviewMapControl = new OverviewMap({ className: 'ol-overviewmap ol-custom-overviewmap', layers: [ new TileLayer({ - source: new _ol_source_OSM_({ + source: new OSM({ 'url': 'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png' + '?apikey=0e6fc415256d4fbb9b5166a718591d71' }) @@ -33,11 +33,11 @@ var map = new Map({ ]), layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [500000, 6000000], zoom: 7 }) diff --git a/examples/overviewmap.js b/examples/overviewmap.js index fc9ad0928f..131b118307 100644 --- a/examples/overviewmap.js +++ b/examples/overviewmap.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import OverviewMap from '../src/ol/control/OverviewMap.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var map = new Map({ controls: defaultControls().extend([ @@ -11,11 +11,11 @@ var map = new Map({ ]), layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [500000, 6000000], zoom: 7 }) diff --git a/examples/permalink.js b/examples/permalink.js index ea2f796be2..e2932512f5 100644 --- a/examples/permalink.js +++ b/examples/permalink.js @@ -1,8 +1,8 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; // default zoom, center and rotation var zoom = 2; @@ -26,7 +26,7 @@ if (window.location.hash !== '') { var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], controls: defaultControls({ @@ -35,7 +35,7 @@ var map = new Map({ } }), target: 'map', - view: new _ol_View_({ + view: new View({ center: center, zoom: zoom, rotation: rotation diff --git a/examples/pinch-zoom.js b/examples/pinch-zoom.js index 02422fcd2a..4261e79445 100644 --- a/examples/pinch-zoom.js +++ b/examples/pinch-zoom.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import _ol_interaction_PinchZoom_ from '../src/ol/interaction/PinchZoom.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var map = new Map({ @@ -14,11 +14,11 @@ var map = new Map({ ]), layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/polygon-styles.js b/examples/polygon-styles.js index 0eee5c0647..20947b5126 100644 --- a/examples/polygon-styles.js +++ b/examples/polygon-styles.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import MultiPoint from '../src/ol/geom/MultiPoint.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -80,11 +80,11 @@ var geojsonObject = { }] }; -var source = new _ol_source_Vector_({ +var source = new VectorSource({ features: (new GeoJSON()).readFeatures(geojsonObject) }); -var layer = new _ol_layer_Vector_({ +var layer = new VectorLayer({ source: source, style: styles }); @@ -92,7 +92,7 @@ var layer = new _ol_layer_Vector_({ var map = new Map({ layers: [layer], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 3000000], zoom: 2 }) diff --git a/examples/popup.js b/examples/popup.js index f82abbbee0..ade956bc6e 100644 --- a/examples/popup.js +++ b/examples/popup.js @@ -1,10 +1,10 @@ import Map from '../src/ol/Map.js'; import _ol_Overlay_ from '../src/ol/Overlay.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import _ol_coordinate_ from '../src/ol/coordinate.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {toLonLat} from '../src/ol/proj.js'; -import _ol_source_TileJSON_ from '../src/ol/source/TileJSON.js'; +import TileJSON from '../src/ol/source/TileJSON.js'; /** @@ -44,7 +44,7 @@ closer.onclick = function() { var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_TileJSON_({ + source: new TileJSON({ url: 'https://api.tiles.mapbox.com/v3/mapbox.natural-earth-hypso-bathy.json?secure', crossOrigin: 'anonymous' }) @@ -52,7 +52,7 @@ var map = new Map({ ], overlays: [overlay], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/preload.js b/examples/preload.js index a904f7c7cd..0981ec5af3 100644 --- a/examples/preload.js +++ b/examples/preload.js @@ -1,10 +1,10 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; -var view = new _ol_View_({ +var view = new View({ center: [-4808600, -2620936], zoom: 8 }); @@ -13,7 +13,7 @@ var map1 = new Map({ layers: [ new TileLayer({ preload: Infinity, - source: new _ol_source_BingMaps_({ + source: new BingMaps({ key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5', imagerySet: 'Aerial' }) @@ -27,7 +27,7 @@ var map2 = new Map({ layers: [ new TileLayer({ preload: 0, // default value - source: new _ol_source_BingMaps_({ + source: new BingMaps({ key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5', imagerySet: 'AerialWithLabels' }) diff --git a/examples/raster.js b/examples/raster.js index 01292f2ad2..a45da59206 100644 --- a/examples/raster.js +++ b/examples/raster.js @@ -1,10 +1,10 @@ // NOCOMPILE // this example uses d3 for which we don't have an externs file. import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; -import _ol_layer_Image_ from '../src/ol/layer/Image.js'; +import View from '../src/ol/View.js'; +import ImageLayer from '../src/ol/layer/Image.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; import RasterSource from '../src/ol/source/Raster.js'; var minVgi = 0; @@ -49,7 +49,7 @@ function summarize(value, counts) { /** * Use aerial imagery as the input data for the raster source. */ -var bing = new _ol_source_BingMaps_({ +var bing = new BingMaps({ key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5', imagerySet: 'Aerial' }); @@ -115,12 +115,12 @@ var map = new Map({ new TileLayer({ source: bing }), - new _ol_layer_Image_({ + new ImageLayer({ source: raster }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [-9651695, 4937351], zoom: 13, minZoom: 12, diff --git a/examples/region-growing.js b/examples/region-growing.js index bf14ca45ed..61424e909f 100644 --- a/examples/region-growing.js +++ b/examples/region-growing.js @@ -1,10 +1,10 @@ // NOCOMPILE import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; -import _ol_layer_Image_ from '../src/ol/layer/Image.js'; +import View from '../src/ol/View.js'; +import ImageLayer from '../src/ol/layer/Image.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; import RasterSource from '../src/ol/source/Raster.js'; function growRegion(inputs, data) { @@ -75,7 +75,7 @@ function next4Edges(edge) { var key = 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'; var imagery = new TileLayer({ - source: new _ol_source_BingMaps_({key: key, imagerySet: 'Aerial'}) + source: new BingMaps({key: key, imagerySet: 'Aerial'}) }); var raster = new RasterSource({ @@ -89,7 +89,7 @@ var raster = new RasterSource({ } }); -var rasterImage = new _ol_layer_Image_({ +var rasterImage = new ImageLayer({ opacity: 0.7, source: raster }); @@ -97,7 +97,7 @@ var rasterImage = new _ol_layer_Image_({ var map = new Map({ layers: [imagery, rasterImage], target: 'map', - view: new _ol_View_({ + view: new View({ center: fromLonLat([-119.07, 47.65]), zoom: 11 }) diff --git a/examples/regularshape.js b/examples/regularshape.js index 6659131740..88dde56b95 100644 --- a/examples/regularshape.js +++ b/examples/regularshape.js @@ -1,9 +1,9 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -72,15 +72,15 @@ var features = new Array(count); var e = 4500000; for (var i = 0; i < count; ++i) { var coordinates = [2 * e * Math.random() - e, 2 * e * Math.random() - e]; - features[i] = new _ol_Feature_(new Point(coordinates)); + features[i] = new Feature(new Point(coordinates)); features[i].setStyle(styles[styleKeys[Math.floor(Math.random() * 5)]]); } -var source = new _ol_source_Vector_({ +var source = new VectorSource({ features: features }); -var vectorLayer = new _ol_layer_Vector_({ +var vectorLayer = new VectorLayer({ source: source }); @@ -89,7 +89,7 @@ var map = new Map({ vectorLayer ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/reprojection-by-code.js b/examples/reprojection-by-code.js index 6546d2bf92..588488189c 100644 --- a/examples/reprojection-by-code.js +++ b/examples/reprojection-by-code.js @@ -1,22 +1,22 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import * as _ol_extent_ from '../src/ol/extent.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {get as getProjection, getTransform} from '../src/ol/proj.js'; import {register} from '../src/ol/proj/proj4.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_TileImage_ from '../src/ol/source/TileImage.js'; +import OSM from '../src/ol/source/OSM.js'; +import TileImage from '../src/ol/source/TileImage.js'; import proj4 from 'proj4'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', - view: new _ol_View_({ + view: new View({ projection: 'EPSG:3857', center: [0, 0], zoom: 1 @@ -32,7 +32,7 @@ var renderEdgesCheckbox = document.getElementById('render-edges'); function setProjection(code, name, proj4def, bbox) { if (code === null || name === null || proj4def === null || bbox === null) { resultSpan.innerHTML = 'Nothing usable found, using EPSG:3857...'; - map.setView(new _ol_View_({ + map.setView(new View({ projection: 'EPSG:3857', center: [0, 0], zoom: 1 @@ -52,7 +52,7 @@ function setProjection(code, name, proj4def, bbox) { var extent = _ol_extent_.applyTransform( [bbox[1], bbox[2], bbox[3], bbox[0]], fromLonLat); newProj.setExtent(extent); - var newView = new _ol_View_({ + var newView = new View({ projection: newProj }); map.setView(newView); @@ -102,7 +102,7 @@ renderEdgesCheckbox.onchange = function() { map.getLayers().forEach(function(layer) { if (layer instanceof TileLayer) { var source = layer.getSource(); - if (source instanceof _ol_source_TileImage_) { + if (source instanceof TileImage) { source.setRenderReprojectionEdges(renderEdgesCheckbox.checked); } } diff --git a/examples/reprojection-image.js b/examples/reprojection-image.js index 5b0634bedd..784f389267 100644 --- a/examples/reprojection-image.js +++ b/examples/reprojection-image.js @@ -1,11 +1,11 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {getCenter} from '../src/ol/extent.js'; -import _ol_layer_Image_ from '../src/ol/layer/Image.js'; +import ImageLayer from '../src/ol/layer/Image.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {transform} from '../src/ol/proj.js'; -import _ol_source_ImageStatic_ from '../src/ol/source/ImageStatic.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import Static from '../src/ol/source/ImageStatic.js'; +import OSM from '../src/ol/source/OSM.js'; import {register} from '../src/ol/proj/proj4.js'; import proj4 from 'proj4'; @@ -20,10 +20,10 @@ var imageExtent = [0, 0, 700000, 1300000]; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }), - new _ol_layer_Image_({ - source: new _ol_source_ImageStatic_({ + new ImageLayer({ + source: new Static({ url: 'https://upload.wikimedia.org/wikipedia/commons/thumb/1/18/' + 'British_National_Grid.svg/2000px-British_National_Grid.svg.png', crossOrigin: '', @@ -33,7 +33,7 @@ var map = new Map({ }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: transform(getCenter(imageExtent), 'EPSG:27700', 'EPSG:3857'), zoom: 4 }) diff --git a/examples/reprojection-wgs84.js b/examples/reprojection-wgs84.js index 0e25eb8b14..4bb3f41d2e 100644 --- a/examples/reprojection-wgs84.js +++ b/examples/reprojection-wgs84.js @@ -1,16 +1,16 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], zoom: 2 diff --git a/examples/reprojection.js b/examples/reprojection.js index b81c302ace..c846083841 100644 --- a/examples/reprojection.js +++ b/examples/reprojection.js @@ -1,15 +1,15 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import * as _ol_extent_ from '../src/ol/extent.js'; import _ol_format_WMTSCapabilities_ from '../src/ol/format/WMTSCapabilities.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {get as getProjection} from '../src/ol/proj.js'; import {register} from '../src/ol/proj/proj4.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_TileImage_ from '../src/ol/source/TileImage.js'; -import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js'; -import _ol_source_WMTS_ from '../src/ol/source/WMTS.js'; -import _ol_source_XYZ_ from '../src/ol/source/XYZ.js'; +import OSM from '../src/ol/source/OSM.js'; +import TileImage from '../src/ol/source/TileImage.js'; +import TileWMS from '../src/ol/source/TileWMS.js'; +import WMTS from '../src/ol/source/WMTS.js'; +import XYZ from '../src/ol/source/XYZ.js'; import TileGrid from '../src/ol/tilegrid/TileGrid.js'; import proj4 from 'proj4'; @@ -59,7 +59,7 @@ proj54009.setExtent([-18e6, -9e6, 18e6, 9e6]); var layers = {}; layers['bng'] = new TileLayer({ - source: new _ol_source_XYZ_({ + source: new XYZ({ projection: 'EPSG:27700', url: 'https://tileserver.maptiler.com/miniscale/{z}/{x}/{y}.png', crossOrigin: '', @@ -68,11 +68,11 @@ layers['bng'] = new TileLayer({ }); layers['osm'] = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); layers['wms4326'] = new TileLayer({ - source: new _ol_source_TileWMS_({ + source: new TileWMS({ url: 'https://ahocevar.com/geoserver/wms', crossOrigin: '', params: { @@ -84,7 +84,7 @@ layers['wms4326'] = new TileLayer({ }); layers['wms21781'] = new TileLayer({ - source: new _ol_source_TileWMS_({ + source: new TileWMS({ attributions: '© Pixelmap 1:1000000 / geo.admin.ch', crossOrigin: 'anonymous', @@ -104,7 +104,7 @@ fetch(url).then(function(response) { return response.text(); }).then(function(text) { var result = parser.read(text); - var options = _ol_source_WMTS_.optionsFromCapabilities(result, { + var options = WMTS.optionsFromCapabilities(result, { layer: 'OSM_Land_Mask', matrixSet: 'EPSG3413_250m' }); @@ -112,12 +112,12 @@ fetch(url).then(function(response) { options.projection = 'EPSG:3413'; options.wrapX = false; layers['wmts3413'] = new TileLayer({ - source: new _ol_source_WMTS_(/** @type {!olx.source.WMTSOptions} */ (options)) + source: new WMTS(/** @type {!olx.source.WMTSOptions} */ (options)) }); }); layers['grandcanyon'] = new TileLayer({ - source: new _ol_source_XYZ_({ + source: new XYZ({ url: 'https://tileserver.maptiler.com/grandcanyon@2x/{z}/{x}/{y}.png', crossOrigin: '', tilePixelRatio: 2, @@ -135,7 +135,7 @@ for (var i = 0, ii = resolutions.length; i < ii; ++i) { } layers['states'] = new TileLayer({ - source: new _ol_source_TileWMS_({ + source: new TileWMS({ url: 'https://ahocevar.com/geoserver/wms', crossOrigin: '', params: {'LAYERS': 'topp:states'}, @@ -156,7 +156,7 @@ var map = new Map({ layers['bng'] ], target: 'map', - view: new _ol_View_({ + view: new View({ projection: 'EPSG:3857', center: [0, 0], zoom: 2 @@ -173,7 +173,7 @@ var renderEdges = false; function updateViewProjection() { var newProj = getProjection(viewProjSelect.value); var newProjExtent = newProj.getExtent(); - var newView = new _ol_View_({ + var newView = new View({ projection: newProj, center: _ol_extent_.getCenter(newProjExtent || [0, 0, 0, 0]), zoom: 0, @@ -202,7 +202,7 @@ updateViewProjection(); var updateRenderEdgesOnLayer = function(layer) { if (layer instanceof TileLayer) { var source = layer.getSource(); - if (source instanceof _ol_source_TileImage_) { + if (source instanceof TileImage) { source.setRenderReprojectionEdges(renderEdges); } } diff --git a/examples/reusable-source.js b/examples/reusable-source.js index edd1f279f3..45a1cc9a01 100644 --- a/examples/reusable-source.js +++ b/examples/reusable-source.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_XYZ_ from '../src/ol/source/XYZ.js'; +import XYZ from '../src/ol/source/XYZ.js'; var urls = [ 'https://{a-c}.tiles.mapbox.com/v3/mapbox.blue-marble-topo-jan/{z}/{x}/{y}.png', @@ -10,7 +10,7 @@ var urls = [ 'https://{a-c}.tiles.mapbox.com/v3/mapbox.blue-marble-topo-bathy-jul/{z}/{x}/{y}.png' ]; -var source = new _ol_source_XYZ_(); +var source = new XYZ(); var map = new Map({ target: 'map', @@ -19,7 +19,7 @@ var map = new Map({ source: source }) ], - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/rotation.js b/examples/rotation.js index 39c3998be7..5e2a5f565b 100644 --- a/examples/rotation.js +++ b/examples/rotation.js @@ -1,14 +1,14 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', @@ -17,7 +17,7 @@ var map = new Map({ collapsible: false } }), - view: new _ol_View_({ + view: new View({ center: [14200000, 4130000], rotation: Math.PI / 6, zoom: 10 diff --git a/examples/scale-line.js b/examples/scale-line.js index d0ed61ea0e..e8da84fd9e 100644 --- a/examples/scale-line.js +++ b/examples/scale-line.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import ScaleLine from '../src/ol/control/ScaleLine.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var scaleLineControl = new ScaleLine(); @@ -18,11 +18,11 @@ var map = new Map({ ]), layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/scaleline-indiana-east.js b/examples/scaleline-indiana-east.js index 90d720988e..a740932ed2 100644 --- a/examples/scaleline-indiana-east.js +++ b/examples/scaleline-indiana-east.js @@ -1,10 +1,10 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import ScaleLine from '../src/ol/control/ScaleLine.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat, transformExtent} from '../src/ol/proj.js'; import {register} from '../src/ol/proj/proj4.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; import proj4 from 'proj4'; proj4.defs('Indiana-East', 'PROJCS["IN83-EF",GEOGCS["LL83",DATUM["NAD83",' + @@ -21,11 +21,11 @@ register(proj4); var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', - view: new _ol_View_({ + view: new View({ projection: 'Indiana-East', center: fromLonLat([-85.685, 39.891], 'Indiana-East'), zoom: 7, diff --git a/examples/sea-level.js b/examples/sea-level.js index 7f53e4c6d7..ac73fcab99 100644 --- a/examples/sea-level.js +++ b/examples/sea-level.js @@ -1,11 +1,11 @@ // NOCOMPILE import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; -import _ol_layer_Image_ from '../src/ol/layer/Image.js'; +import View from '../src/ol/View.js'; +import ImageLayer from '../src/ol/layer/Image.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat} from '../src/ol/proj.js'; import RasterSource from '../src/ol/source/Raster.js'; -import _ol_source_XYZ_ from '../src/ol/source/XYZ.js'; +import XYZ from '../src/ol/source/XYZ.js'; function flood(pixels, data) { var pixel = pixels[0]; @@ -24,7 +24,7 @@ function flood(pixels, data) { } var key = 'pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg'; -var elevation = new _ol_source_XYZ_({ +var elevation = new XYZ({ url: 'https://api.mapbox.com/v4/mapbox.terrain-rgb/{z}/{x}/{y}.pngraw?access_token=' + key, crossOrigin: 'anonymous', transition: 0 @@ -39,16 +39,16 @@ var map = new Map({ target: 'map', layers: [ new TileLayer({ - source: new _ol_source_XYZ_({ + source: new XYZ({ url: 'https://api.mapbox.com/styles/v1/tschaub/ciutc102t00c62js5fqd47kqw/tiles/256/{z}/{x}/{y}?access_token=' + key }) }), - new _ol_layer_Image_({ + new ImageLayer({ opacity: 0.6, source: raster }) ], - view: new _ol_View_({ + view: new View({ center: fromLonLat([-122.3267, 37.8377]), zoom: 11 }) diff --git a/examples/select-features.js b/examples/select-features.js index 4bd97da826..ded95624fe 100644 --- a/examples/select-features.js +++ b/examples/select-features.js @@ -1,19 +1,19 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import _ol_events_condition_ from '../src/ol/events/condition.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; var raster = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); -var vector = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vector = new VectorLayer({ + source: new VectorSource({ url: 'data/geojson/countries.geojson', format: new GeoJSON() }) @@ -22,7 +22,7 @@ var vector = new _ol_layer_Vector_({ var map = new Map({ layers: [raster, vector], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/semi-transparent-layer.js b/examples/semi-transparent-layer.js index 001ae812fa..50aa7039c3 100644 --- a/examples/semi-transparent-layer.js +++ b/examples/semi-transparent-layer.js @@ -1,25 +1,25 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_TileJSON_ from '../src/ol/source/TileJSON.js'; +import OSM from '../src/ol/source/OSM.js'; +import TileJSON from '../src/ol/source/TileJSON.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }), new TileLayer({ - source: new _ol_source_TileJSON_({ + source: new TileJSON({ url: 'https://api.tiles.mapbox.com/v3/mapbox.va-quake-aug.json?secure', crossOrigin: 'anonymous' }) }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: fromLonLat([-77.93255, 37.9555]), zoom: 7 }) diff --git a/examples/shaded-relief.js b/examples/shaded-relief.js index 33b1f3f18e..eca8e274b7 100644 --- a/examples/shaded-relief.js +++ b/examples/shaded-relief.js @@ -1,11 +1,11 @@ // NOCOMPILE import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; -import _ol_layer_Image_ from '../src/ol/layer/Image.js'; +import View from '../src/ol/View.js'; +import ImageLayer from '../src/ol/layer/Image.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; import RasterSource from '../src/ol/source/Raster.js'; -import _ol_source_XYZ_ from '../src/ol/source/XYZ.js'; +import XYZ from '../src/ol/source/XYZ.js'; /** @@ -102,7 +102,7 @@ function shade(inputs, data) { return {data: shadeData, width: width, height: height}; } -var elevation = new _ol_source_XYZ_({ +var elevation = new XYZ({ url: 'https://{a-d}.tiles.mapbox.com/v3/aj.sf-dem/{z}/{x}/{y}.png', crossOrigin: 'anonymous', transition: 0 @@ -118,14 +118,14 @@ var map = new Map({ target: 'map', layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }), - new _ol_layer_Image_({ + new ImageLayer({ opacity: 0.3, source: raster }) ], - view: new _ol_View_({ + view: new View({ extent: [-13675026, 4439648, -13580856, 4580292], center: [-13615645, 4497969], minZoom: 10, diff --git a/examples/side-by-side.js b/examples/side-by-side.js index 51f28def41..ac6bff925a 100644 --- a/examples/side-by-side.js +++ b/examples/side-by-side.js @@ -1,14 +1,14 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import _ol_has_ from '../src/ol/has.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var layer = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); -var view = new _ol_View_({ +var view = new View({ center: [0, 0], zoom: 1 }); diff --git a/examples/simple.js b/examples/simple.js index 4f83c069b6..01bb501621 100644 --- a/examples/simple.js +++ b/examples/simple.js @@ -1,17 +1,17 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/snap.js b/examples/snap.js index d80e5fcb65..73335e12b7 100644 --- a/examples/snap.js +++ b/examples/snap.js @@ -1,24 +1,24 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import Draw from '../src/ol/interaction/Draw.js'; import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; var raster = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); -var vector = new _ol_layer_Vector_({ - source: new _ol_source_Vector_(), +var vector = new VectorLayer({ + source: new VectorSource(), style: new _ol_style_Style_({ fill: new _ol_style_Fill_({ color: 'rgba(255, 255, 255, 0.2)' @@ -39,7 +39,7 @@ var vector = new _ol_layer_Vector_({ var map = new Map({ layers: [raster, vector], target: 'map', - view: new _ol_View_({ + view: new View({ center: [-11000000, 4600000], zoom: 4 }) diff --git a/examples/sphere-mollweide.js b/examples/sphere-mollweide.js index 3c01d6c753..71ff806e43 100644 --- a/examples/sphere-mollweide.js +++ b/examples/sphere-mollweide.js @@ -1,10 +1,10 @@ import Graticule from '../src/ol/Graticule.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorSource from '../src/ol/source/Vector.js'; import {register} from '../src/ol/proj/proj4.js'; import proj4 from 'proj4'; @@ -25,15 +25,15 @@ var sphereMollweideProjection = new _ol_proj_Projection_({ var map = new Map({ keyboardEventTarget: document, layers: [ - new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ + new VectorLayer({ + source: new VectorSource({ url: 'data/geojson/countries-110m.geojson', format: new GeoJSON() }) }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], projection: sphereMollweideProjection, resolutions: [65536, 32768, 16384, 8192, 4096, 2048], diff --git a/examples/stamen.js b/examples/stamen.js index 77fa88d3fc..0a44ab490a 100644 --- a/examples/stamen.js +++ b/examples/stamen.js @@ -1,25 +1,25 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_Stamen_ from '../src/ol/source/Stamen.js'; +import Stamen from '../src/ol/source/Stamen.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_Stamen_({ + source: new Stamen({ layer: 'watercolor' }) }), new TileLayer({ - source: new _ol_source_Stamen_({ + source: new Stamen({ layer: 'terrain-labels' }) }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: fromLonLat([-122.416667, 37.783333]), zoom: 12 }) diff --git a/examples/static-image.js b/examples/static-image.js index 27e24ccf32..7cc3e4caeb 100644 --- a/examples/static-image.js +++ b/examples/static-image.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import * as _ol_extent_ from '../src/ol/extent.js'; -import _ol_layer_Image_ from '../src/ol/layer/Image.js'; +import ImageLayer from '../src/ol/layer/Image.js'; import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; -import _ol_source_ImageStatic_ from '../src/ol/source/ImageStatic.js'; +import Static from '../src/ol/source/ImageStatic.js'; // Map views always need a projection. Here we just want to map image @@ -18,8 +18,8 @@ var projection = new _ol_proj_Projection_({ var map = new Map({ layers: [ - new _ol_layer_Image_({ - source: new _ol_source_ImageStatic_({ + new ImageLayer({ + source: new Static({ attributions: '© xkcd', url: 'https://imgs.xkcd.com/comics/online_communities.png', projection: projection, @@ -28,7 +28,7 @@ var map = new Map({ }) ], target: 'map', - view: new _ol_View_({ + view: new View({ projection: projection, center: _ol_extent_.getCenter(extent), zoom: 2, diff --git a/examples/street-labels.js b/examples/street-labels.js index 0d0d516856..fc2f0c9db5 100644 --- a/examples/street-labels.js +++ b/examples/street-labels.js @@ -1,11 +1,11 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import * as _ol_extent_ from '../src/ol/extent.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; import _ol_style_Text_ from '../src/ol/style/Text.js'; @@ -23,13 +23,13 @@ var style = new _ol_style_Style_({ var viewExtent = [1817379, 6139595, 1827851, 6143616]; var map = new Map({ layers: [new TileLayer({ - source: new _ol_source_BingMaps_({ + source: new BingMaps({ key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5', imagerySet: 'Aerial' }) - }), new _ol_layer_Vector_({ + }), new VectorLayer({ declutter: true, - source: new _ol_source_Vector_({ + source: new VectorSource({ format: new GeoJSON(), url: 'data/geojson/vienna-streets.geojson' }), @@ -39,7 +39,7 @@ var map = new Map({ } })], target: 'map', - view: new _ol_View_({ + view: new View({ extent: viewExtent, center: _ol_extent_.getCenter(viewExtent), zoom: 17, diff --git a/examples/symbol-atlas-webgl.js b/examples/symbol-atlas-webgl.js index 142402fdd0..c3dae93cb0 100644 --- a/examples/symbol-atlas-webgl.js +++ b/examples/symbol-atlas-webgl.js @@ -1,9 +1,9 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_AtlasManager_ from '../src/ol/style/AtlasManager.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; @@ -90,7 +90,7 @@ var e = 25000000; for (i = 0; i < featureCount; ++i) { geometry = new Point( [2 * e * Math.random() - e, 2 * e * Math.random() - e]); - feature = new _ol_Feature_(geometry); + feature = new Feature(geometry); feature.setStyle( new _ol_style_Style_({ image: symbols[i % symbolCount] @@ -99,10 +99,10 @@ for (i = 0; i < featureCount; ++i) { features[i] = feature; } -var vectorSource = new _ol_source_Vector_({ +var vectorSource = new VectorSource({ features: features }); -var vector = new _ol_layer_Vector_({ +var vector = new VectorLayer({ source: vectorSource }); @@ -110,7 +110,7 @@ var map = new Map({ renderer: /** @type {Array} */ (['webgl', 'canvas']), layers: [vector], target: document.getElementById('map'), - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 4 }) diff --git a/examples/synthetic-lines.js b/examples/synthetic-lines.js index 7c0acd9452..a5e41f051b 100644 --- a/examples/synthetic-lines.js +++ b/examples/synthetic-lines.js @@ -1,9 +1,9 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import LineString from '../src/ol/geom/LineString.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; @@ -30,14 +30,14 @@ for (i = 0; i < count; ++i) { deltaX = delta * signX; deltaY = delta * signY; endPoint = [startPoint[0] + deltaX, startPoint[1] + deltaY]; - features[i] = new _ol_Feature_({ + features[i] = new Feature({ 'geometry': new LineString([startPoint, endPoint]) }); startPoint = endPoint; } -var vector = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vector = new VectorLayer({ + source: new VectorSource({ features: features, wrapX: false }), @@ -49,7 +49,7 @@ var vector = new _ol_layer_Vector_({ }) }); -var view = new _ol_View_({ +var view = new View({ center: [0, 0], zoom: 0 }); diff --git a/examples/synthetic-points.js b/examples/synthetic-points.js index 85cda5b939..84b48cbd0f 100644 --- a/examples/synthetic-points.js +++ b/examples/synthetic-points.js @@ -1,10 +1,10 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import LineString from '../src/ol/geom/LineString.js'; import Point from '../src/ol/geom/Point.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -15,7 +15,7 @@ var count = 20000; var features = new Array(count); var e = 18000000; for (var i = 0; i < count; ++i) { - features[i] = new _ol_Feature_({ + features[i] = new Feature({ 'geometry': new Point( [2 * e * Math.random() - e, 2 * e * Math.random() - e]), 'i': i, @@ -40,11 +40,11 @@ var styles = { }) }; -var vectorSource = new _ol_source_Vector_({ +var vectorSource = new VectorSource({ features: features, wrapX: false }); -var vector = new _ol_layer_Vector_({ +var vector = new VectorLayer({ source: vectorSource, style: function(feature) { return styles[feature.get('size')]; @@ -54,7 +54,7 @@ var vector = new _ol_layer_Vector_({ var map = new Map({ layers: [vector], target: document.getElementById('map'), - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/teleport.js b/examples/teleport.js index 2f295e9220..88785b2281 100644 --- a/examples/teleport.js +++ b/examples/teleport.js @@ -1,14 +1,14 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }) ], controls: defaultControls({ @@ -16,7 +16,7 @@ var map = new Map({ collapsible: false } }), - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/tile-load-events.js b/examples/tile-load-events.js index eca8c96a9d..e8c0b20297 100644 --- a/examples/tile-load-events.js +++ b/examples/tile-load-events.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_TileJSON_ from '../src/ol/source/TileJSON.js'; +import TileJSON from '../src/ol/source/TileJSON.js'; /** @@ -77,7 +77,7 @@ Progress.prototype.hide = function() { var progress = new Progress(document.getElementById('progress')); -var source = new _ol_source_TileJSON_({ +var source = new TileJSON({ url: 'https://api.tiles.mapbox.com/v3/mapbox.world-bright.json?secure', crossOrigin: 'anonymous' }); @@ -98,7 +98,7 @@ var map = new Map({ new TileLayer({source: source}) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/tile-transitions.js b/examples/tile-transitions.js index 63f06d4a31..5715978741 100644 --- a/examples/tile-transitions.js +++ b/examples/tile-transitions.js @@ -1,23 +1,23 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_XYZ_ from '../src/ol/source/XYZ.js'; +import XYZ from '../src/ol/source/XYZ.js'; var url = 'https://{a-c}.tiles.mapbox.com/v3/mapbox.world-bright/{z}/{x}/{y}.png'; var withTransition = new TileLayer({ - source: new _ol_source_XYZ_({url: url}) + source: new XYZ({url: url}) }); var withoutTransition = new TileLayer({ - source: new _ol_source_XYZ_({url: url, transition: 0}), + source: new XYZ({url: url, transition: 0}), visible: false }); var map = new Map({ layers: [withTransition, withoutTransition], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2, maxZoom: 11 diff --git a/examples/tilejson.js b/examples/tilejson.js index 2c0bb5dc80..c5d01d85a6 100644 --- a/examples/tilejson.js +++ b/examples/tilejson.js @@ -1,20 +1,20 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_TileJSON_ from '../src/ol/source/TileJSON.js'; +import TileJSON from '../src/ol/source/TileJSON.js'; var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_TileJSON_({ + source: new TileJSON({ url: 'https://api.tiles.mapbox.com/v3/mapbox.geography-class.json?secure', crossOrigin: 'anonymous' }) }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/tileutfgrid.js b/examples/tileutfgrid.js index dd10accc1e..95ed229faf 100644 --- a/examples/tileutfgrid.js +++ b/examples/tileutfgrid.js @@ -1,26 +1,26 @@ import Map from '../src/ol/Map.js'; import _ol_Overlay_ from '../src/ol/Overlay.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_TileJSON_ from '../src/ol/source/TileJSON.js'; -import _ol_source_TileUTFGrid_ from '../src/ol/source/TileUTFGrid.js'; +import TileJSON from '../src/ol/source/TileJSON.js'; +import UTFGrid from '../src/ol/source/TileUTFGrid.js'; var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg'; var mapLayer = new TileLayer({ - source: new _ol_source_TileJSON_({ + source: new TileJSON({ url: 'https://api.tiles.mapbox.com/v4/mapbox.geography-class.json?secure&access_token=' + key }) }); -var gridSource = new _ol_source_TileUTFGrid_({ +var gridSource = new UTFGrid({ url: 'https://api.tiles.mapbox.com/v4/mapbox.geography-class.json?secure&access_token=' + key }); var gridLayer = new TileLayer({source: gridSource}); -var view = new _ol_View_({ +var view = new View({ center: [0, 0], zoom: 1 }); diff --git a/examples/tissot.js b/examples/tissot.js index bcab30871e..b8f2880a38 100644 --- a/examples/tissot.js +++ b/examples/tissot.js @@ -1,24 +1,24 @@ -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {circular as circularPolygon} from '../src/ol/geom/Polygon.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import TileWMS from '../src/ol/source/TileWMS.js'; +import VectorSource from '../src/ol/source/Vector.js'; -var vectorLayer4326 = new _ol_layer_Vector_({ - source: new _ol_source_Vector_() +var vectorLayer4326 = new VectorLayer({ + source: new VectorSource() }); -var vectorLayer3857 = new _ol_layer_Vector_({ - source: new _ol_source_Vector_() +var vectorLayer3857 = new VectorLayer({ + source: new VectorSource() }); var map4326 = new Map({ layers: [ new TileLayer({ - source: new _ol_source_TileWMS_({ + source: new TileWMS({ url: 'https://ahocevar.com/geoserver/wms', params: { 'LAYERS': 'ne:NE1_HR_LC_SR_W_DR', @@ -29,7 +29,7 @@ var map4326 = new Map({ vectorLayer4326 ], target: 'map4326', - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], zoom: 2 @@ -39,7 +39,7 @@ var map4326 = new Map({ var map3857 = new Map({ layers: [ new TileLayer({ - source: new _ol_source_TileWMS_({ + source: new TileWMS({ url: 'https://ahocevar.com/geoserver/wms', params: { 'LAYERS': 'ne:NE1_HR_LC_SR_W_DR', @@ -50,7 +50,7 @@ var map3857 = new Map({ vectorLayer3857 ], target: 'map3857', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) @@ -62,7 +62,7 @@ for (x = -180; x < 180; x += 30) { for (y = -90; y < 90; y += 30) { var circle4326 = circularPolygon([x, y], radius, 64); var circle3857 = circle4326.clone().transform('EPSG:4326', 'EPSG:3857'); - vectorLayer4326.getSource().addFeature(new _ol_Feature_(circle4326)); - vectorLayer3857.getSource().addFeature(new _ol_Feature_(circle3857)); + vectorLayer4326.getSource().addFeature(new Feature(circle4326)); + vectorLayer3857.getSource().addFeature(new Feature(circle3857)); } } diff --git a/examples/topojson.js b/examples/topojson.js index 2f032c2227..7f2b92922e 100644 --- a/examples/topojson.js +++ b/examples/topojson.js @@ -1,17 +1,17 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TopoJSON from '../src/ol/format/TopoJSON.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_TileJSON_ from '../src/ol/source/TileJSON.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import TileJSON from '../src/ol/source/TileJSON.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; var raster = new TileLayer({ - source: new _ol_source_TileJSON_({ + source: new TileJSON({ url: 'https://api.tiles.mapbox.com/v3/mapbox.world-dark.json?secure' }) }); @@ -26,8 +26,8 @@ var style = new _ol_style_Style_({ }) }); -var vector = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vector = new VectorLayer({ + source: new VectorSource({ url: 'data/topojson/world-110m.json', format: new TopoJSON({ // don't want to render the full world polygon (stored as 'land' layer), @@ -42,7 +42,7 @@ var vector = new _ol_layer_Vector_({ var map = new Map({ layers: [raster, vector], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 1 }) diff --git a/examples/topolis.js b/examples/topolis.js index f8825241b9..25838c83f0 100644 --- a/examples/topolis.js +++ b/examples/topolis.js @@ -1,18 +1,18 @@ // NOCOMPILE // this example uses topolis and toastr for which we don't have an externs file. -import _ol_Feature_ from '../src/ol/Feature.js'; +import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.js'; import LineString from '../src/ol/geom/LineString.js'; import Polygon from '../src/ol/geom/Polygon.js'; import Draw from '../src/ol/interaction/Draw.js'; import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; @@ -21,11 +21,11 @@ import _ol_style_Text_ from '../src/ol/style/Text.js'; import MousePosition from '../src/ol/control/MousePosition.js'; var raster = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); -var nodes = new _ol_source_Vector_({wrapX: false}); -var nodesLayer = new _ol_layer_Vector_({ +var nodes = new VectorSource({wrapX: false}); +var nodesLayer = new VectorLayer({ source: nodes, style: function(f) { var style = new _ol_style_Style_({ @@ -47,8 +47,8 @@ var nodesLayer = new _ol_layer_Vector_({ } }); -var edges = new _ol_source_Vector_({wrapX: false}); -var edgesLayer = new _ol_layer_Vector_({ +var edges = new VectorSource({wrapX: false}); +var edgesLayer = new VectorLayer({ source: edges, style: function(f) { var style = new _ol_style_Style_({ @@ -69,8 +69,8 @@ var edgesLayer = new _ol_layer_Vector_({ } }); -var faces = new _ol_source_Vector_({wrapX: false}); -var facesLayer = new _ol_layer_Vector_({ +var faces = new VectorSource({wrapX: false}); +var facesLayer = new VectorLayer({ source: faces, style: function(f) { var style = new _ol_style_Style_({ @@ -98,7 +98,7 @@ var facesLayer = new _ol_layer_Vector_({ var map = new Map({ layers: [raster, facesLayer, edgesLayer, nodesLayer], target: 'map', - view: new _ol_View_({ + view: new View({ center: [-11000000, 4600000], zoom: 16 }) @@ -129,7 +129,7 @@ function removeElementFeature(source, element) { } function nodeToFeature(node) { - var feature = new _ol_Feature_({ + var feature = new Feature({ geometry: new Point(node.coordinate), node: node }); @@ -138,7 +138,7 @@ function nodeToFeature(node) { } function edgeToFeature(edge) { - var feature = new _ol_Feature_({ + var feature = new Feature({ geometry: new LineString(edge.coordinates), edge: edge }); @@ -148,7 +148,7 @@ function edgeToFeature(edge) { function faceToFeature(face) { var coordinates = topo.getFaceGeometry(face); - var feature = new _ol_Feature_({ + var feature = new Feature({ geometry: new Polygon(coordinates), face: face }); diff --git a/examples/translate-features.js b/examples/translate-features.js index ad160edb2f..5ea637c8a1 100644 --- a/examples/translate-features.js +++ b/examples/translate-features.js @@ -1,21 +1,21 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_interaction_Translate_ from '../src/ol/interaction/Translate.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; var raster = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); -var vector = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vector = new VectorLayer({ + source: new VectorSource({ url: 'data/geojson/countries.geojson', format: new GeoJSON() }) @@ -31,7 +31,7 @@ var map = new Map({ interactions: defaultInteractions().extend([select, translate]), layers: [raster, vector], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/examples/turf.js b/examples/turf.js index 367d56799d..a9ee78ba9e 100644 --- a/examples/turf.js +++ b/examples/turf.js @@ -1,16 +1,16 @@ // NOCOMPILE // this example uses turf.js for which we don't have an externs file. import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; -var source = new _ol_source_Vector_(); +var source = new VectorSource(); fetch('data/geojson/roads-seoul.geojson').then(function(response) { return response.json(); }).then(function(json) { @@ -38,18 +38,18 @@ fetch('data/geojson/roads-seoul.geojson').then(function(response) { street.getGeometry().transform('EPSG:4326', 'EPSG:3857'); source.addFeature(street); }); -var vectorLayer = new _ol_layer_Vector_({ +var vectorLayer = new VectorLayer({ source: source }); var rasterLayer = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); var map = new Map({ layers: [rasterLayer, vectorLayer], target: document.getElementById('map'), - view: new _ol_View_({ + view: new View({ center: fromLonLat([126.980366, 37.526540]), zoom: 15 }) diff --git a/examples/vector-esri-edit.js b/examples/vector-esri-edit.js index 4bf81e81a8..f0e15a643d 100644 --- a/examples/vector-esri-edit.js +++ b/examples/vector-esri-edit.js @@ -1,16 +1,16 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import EsriJSON from '../src/ol/format/EsriJSON.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import Draw from '../src/ol/interaction/Draw.js'; import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; -import _ol_source_XYZ_ from '../src/ol/source/XYZ.js'; +import VectorSource from '../src/ol/source/Vector.js'; +import XYZ from '../src/ol/source/XYZ.js'; import _ol_tilegrid_ from '../src/ol/tilegrid.js'; @@ -20,7 +20,7 @@ var layer = '0'; var esrijsonFormat = new EsriJSON(); -var vectorSource = new _ol_source_Vector_({ +var vectorSource = new VectorSource({ loader: function(extent, resolution, projection) { var url = serviceUrl + layer + '/query/?f=json&' + 'returnGeometry=true&spatialRel=esriSpatialRelIntersects&geometry=' + @@ -49,12 +49,12 @@ var vectorSource = new _ol_source_Vector_({ })) }); -var vector = new _ol_layer_Vector_({ +var vector = new VectorLayer({ source: vectorSource }); var raster = new TileLayer({ - source: new _ol_source_XYZ_({ + source: new XYZ({ attributions: 'Tiles © ArcGIS', url: 'https://server.arcgisonline.com/ArcGIS/rest/services/' + @@ -80,7 +80,7 @@ var map = new Map({ interactions: defaultInteractions().extend([draw, select, modify]), layers: [raster, vector], target: document.getElementById('map'), - view: new _ol_View_({ + view: new View({ center: fromLonLat([-122.619, 45.512]), zoom: 12 }) diff --git a/examples/vector-esri.js b/examples/vector-esri.js index 9527dcb48b..c281795d51 100644 --- a/examples/vector-esri.js +++ b/examples/vector-esri.js @@ -1,12 +1,12 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import EsriJSON from '../src/ol/format/EsriJSON.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; -import _ol_source_XYZ_ from '../src/ol/source/XYZ.js'; +import VectorSource from '../src/ol/source/Vector.js'; +import XYZ from '../src/ol/source/XYZ.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; @@ -58,7 +58,7 @@ var styleCache = { }) }; -var vectorSource = new _ol_source_Vector_({ +var vectorSource = new VectorSource({ loader: function(extent, resolution, projection) { var url = serviceUrl + layer + '/query/?f=json&' + 'returnGeometry=true&spatialRel=esriSpatialRelIntersects&geometry=' + @@ -87,7 +87,7 @@ var vectorSource = new _ol_source_Vector_({ })) }); -var vector = new _ol_layer_Vector_({ +var vector = new VectorLayer({ source: vectorSource, style: function(feature) { var classify = feature.get('activeprod'); @@ -96,7 +96,7 @@ var vector = new _ol_layer_Vector_({ }); var raster = new TileLayer({ - source: new _ol_source_XYZ_({ + source: new XYZ({ attributions: 'Tiles © ArcGIS', url: 'https://server.arcgisonline.com/ArcGIS/rest/services/' + @@ -107,7 +107,7 @@ var raster = new TileLayer({ var map = new Map({ layers: [raster, vector], target: document.getElementById('map'), - view: new _ol_View_({ + view: new View({ center: fromLonLat([-97.6114, 38.8403]), zoom: 7 }) diff --git a/examples/vector-label-decluttering.js b/examples/vector-label-decluttering.js index a07cf3cbb0..5557e09e50 100644 --- a/examples/vector-label-decluttering.js +++ b/examples/vector-label-decluttering.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import * as _ol_extent_ from '../src/ol/extent.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; @@ -11,7 +11,7 @@ import _ol_style_Text_ from '../src/ol/style/Text.js'; var map = new Map({ target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 1 }) @@ -58,8 +58,8 @@ var countryStyle = new _ol_style_Style_({ }); var style = [countryStyle, labelStyle]; -var vectorLayer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vectorLayer = new VectorLayer({ + source: new VectorSource({ url: 'data/geojson/countries.geojson', format: new GeoJSON() }), diff --git a/examples/vector-labels.js b/examples/vector-labels.js index 7be75285db..1b2e65e382 100644 --- a/examples/vector-labels.js +++ b/examples/vector-labels.js @@ -1,10 +1,10 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -140,8 +140,8 @@ function polygonStyleFunction(feature, resolution) { }); } -var vectorPolygons = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vectorPolygons = new VectorLayer({ + source: new VectorSource({ url: 'data/geojson/polygon-samples.geojson', format: new GeoJSON() }), @@ -160,8 +160,8 @@ function lineStyleFunction(feature, resolution) { }); } -var vectorLines = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vectorLines = new VectorLayer({ + source: new VectorSource({ url: 'data/geojson/line-samples.geojson', format: new GeoJSON() }), @@ -181,8 +181,8 @@ function pointStyleFunction(feature, resolution) { }); } -var vectorPoints = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vectorPoints = new VectorLayer({ + source: new VectorSource({ url: 'data/geojson/point-samples.geojson', format: new GeoJSON() }), @@ -192,14 +192,14 @@ var vectorPoints = new _ol_layer_Vector_({ var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }), vectorPolygons, vectorLines, vectorPoints ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [-8161939, 6095025], zoom: 8 }) diff --git a/examples/vector-layer.js b/examples/vector-layer.js index 8ee3e64083..22dcd5e206 100644 --- a/examples/vector-layer.js +++ b/examples/vector-layer.js @@ -1,8 +1,8 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; @@ -29,8 +29,8 @@ var style = new _ol_style_Style_({ }) }); -var vectorLayer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vectorLayer = new VectorLayer({ + source: new VectorSource({ url: 'data/geojson/countries.geojson', format: new GeoJSON() }), @@ -43,7 +43,7 @@ var vectorLayer = new _ol_layer_Vector_({ var map = new Map({ layers: [vectorLayer], target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 1 }) @@ -69,8 +69,8 @@ var highlightStyle = new _ol_style_Style_({ }) }); -var featureOverlay = new _ol_layer_Vector_({ - source: new _ol_source_Vector_(), +var featureOverlay = new VectorLayer({ + source: new VectorSource(), map: map, style: function(feature) { highlightStyle.getText().setText(feature.get('name')); diff --git a/examples/vector-osm.js b/examples/vector-osm.js index 546a9d32d0..d42d9521cb 100644 --- a/examples/vector-osm.js +++ b/examples/vector-osm.js @@ -1,13 +1,13 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import OSMXML from '../src/ol/format/OSMXML.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js'; import {transformExtent} from '../src/ol/proj.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -77,7 +77,7 @@ var styles = { } }; -var vectorSource = new _ol_source_Vector_({ +var vectorSource = new VectorSource({ format: new OSMXML(), loader: function(extent, resolution, projection) { var epsg4326Extent = transformExtent(extent, projection, 'EPSG:4326'); @@ -98,7 +98,7 @@ var vectorSource = new _ol_source_Vector_({ strategy: _ol_loadingstrategy_.bbox }); -var vector = new _ol_layer_Vector_({ +var vector = new VectorLayer({ source: vectorSource, style: function(feature) { for (var key in styles) { @@ -116,7 +116,7 @@ var vector = new _ol_layer_Vector_({ }); var raster = new TileLayer({ - source: new _ol_source_BingMaps_({ + source: new BingMaps({ imagerySet: 'Aerial', key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5' }) @@ -130,7 +130,7 @@ map = new Map({ collapsible: false } }), - view: new _ol_View_({ + view: new View({ center: [739218, 5906096], maxZoom: 19, zoom: 17 diff --git a/examples/vector-tile-info.js b/examples/vector-tile-info.js index 4f2f81f789..a159eb02ec 100644 --- a/examples/vector-tile-info.js +++ b/examples/vector-tile-info.js @@ -1,17 +1,17 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import MVT from '../src/ol/format/MVT.js'; import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; -import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; +import VectorTileSource from '../src/ol/source/VectorTile.js'; var map = new Map({ target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }), layers: [new _ol_layer_VectorTile_({ - source: new _ol_source_VectorTile_({ + source: new VectorTileSource({ format: new MVT(), url: 'https://basemaps.arcgis.com/v1/arcgis/rest/services/World_Basemap/VectorTileServer/tile/{z}/{y}/{x}.pbf' }) diff --git a/examples/vector-wfs-getfeature.js b/examples/vector-wfs-getfeature.js index 9374bac482..6a64ddbd5f 100644 --- a/examples/vector-wfs-getfeature.js +++ b/examples/vector-wfs-getfeature.js @@ -1,18 +1,18 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import _ol_format_filter_ from '../src/ol/format/filter.js'; import WFS from '../src/ol/format/WFS.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; -var vectorSource = new _ol_source_Vector_(); -var vector = new _ol_layer_Vector_({ +var vectorSource = new VectorSource(); +var vector = new VectorLayer({ source: vectorSource, style: new _ol_style_Style_({ stroke: new _ol_style_Stroke_({ @@ -23,7 +23,7 @@ var vector = new _ol_layer_Vector_({ }); var raster = new TileLayer({ - source: new _ol_source_BingMaps_({ + source: new BingMaps({ imagerySet: 'Aerial', key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5' }) @@ -32,7 +32,7 @@ var raster = new TileLayer({ var map = new Map({ layers: [raster, vector], target: document.getElementById('map'), - view: new _ol_View_({ + view: new View({ center: [-8908887.277395891, 5381918.072437216], maxZoom: 19, zoom: 12 diff --git a/examples/vector-wfs.js b/examples/vector-wfs.js index 7cb0f376b1..01d9a85efe 100644 --- a/examples/vector-wfs.js +++ b/examples/vector-wfs.js @@ -1,16 +1,16 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; +import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; -var vectorSource = new _ol_source_Vector_({ +var vectorSource = new VectorSource({ format: new GeoJSON(), url: function(extent) { return 'https://ahocevar.com/geoserver/wfs?service=WFS&' + @@ -22,7 +22,7 @@ var vectorSource = new _ol_source_Vector_({ }); -var vector = new _ol_layer_Vector_({ +var vector = new VectorLayer({ source: vectorSource, style: new _ol_style_Style_({ stroke: new _ol_style_Stroke_({ @@ -33,7 +33,7 @@ var vector = new _ol_layer_Vector_({ }); var raster = new TileLayer({ - source: new _ol_source_BingMaps_({ + source: new BingMaps({ imagerySet: 'Aerial', key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5' }) @@ -42,7 +42,7 @@ var raster = new TileLayer({ var map = new Map({ layers: [raster, vector], target: document.getElementById('map'), - view: new _ol_View_({ + view: new View({ center: [-8908887.277395891, 5381918.072437216], maxZoom: 19, zoom: 12 diff --git a/examples/wkt.js b/examples/wkt.js index 6b633535eb..2a90fd956d 100644 --- a/examples/wkt.js +++ b/examples/wkt.js @@ -1,13 +1,13 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import WKT from '../src/ol/format/WKT.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_Vector_ from '../src/ol/source/Vector.js'; +import VectorLayer from '../src/ol/layer/Vector.js'; +import OSM from '../src/ol/source/OSM.js'; +import VectorSource from '../src/ol/source/Vector.js'; var raster = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); var wkt = 'POLYGON((10.689 -25.092, 34.595 ' + @@ -21,8 +21,8 @@ var feature = format.readFeature(wkt, { featureProjection: 'EPSG:3857' }); -var vector = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ +var vector = new VectorLayer({ + source: new VectorSource({ features: [feature] }) }); @@ -30,7 +30,7 @@ var vector = new _ol_layer_Vector_({ var map = new Map({ layers: [raster, vector], target: 'map', - view: new _ol_View_({ + view: new View({ center: [2952104.0199, -3277504.823], zoom: 4 }) diff --git a/examples/wms-custom-proj.js b/examples/wms-custom-proj.js index b7db20a68e..473997a764 100644 --- a/examples/wms-custom-proj.js +++ b/examples/wms-custom-proj.js @@ -1,11 +1,11 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import ScaleLine from '../src/ol/control/ScaleLine.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {addProjection, addCoordinateTransforms, transform} from '../src/ol/proj.js'; import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; -import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js'; +import TileWMS from '../src/ol/source/TileWMS.js'; // By default OpenLayers does not know about the EPSG:21781 (Swiss) projection. @@ -44,7 +44,7 @@ var extent = [420000, 30000, 900000, 350000]; var layers = [ new TileLayer({ extent: extent, - source: new _ol_source_TileWMS_({ + source: new TileWMS({ url: 'https://wms.geo.admin.ch/', crossOrigin: 'anonymous', attributions: '© Pixelmap 1:1000000 / geo.admin.ch', crossOrigin: 'anonymous', @@ -20,8 +20,8 @@ var layers = [ url: 'https://wms.geo.admin.ch/' }) }), - new _ol_layer_Image_({ - source: new _ol_source_ImageWMS_({ + new ImageLayer({ + source: new ImageWMS({ attributions: '© National parks / geo.admin.ch', crossOrigin: 'anonymous', @@ -45,7 +45,7 @@ var projection = new _ol_proj_Projection_({ var map = new Map({ layers: layers, target: 'map', - view: new _ol_View_({ + view: new View({ center: [660000, 190000], projection: projection, zoom: 9 diff --git a/examples/wms-tiled-wrap-180.js b/examples/wms-tiled-wrap-180.js index d6955ecf0d..48c11720f8 100644 --- a/examples/wms-tiled-wrap-180.js +++ b/examples/wms-tiled-wrap-180.js @@ -1,16 +1,16 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js'; +import OSM from '../src/ol/source/OSM.js'; +import TileWMS from '../src/ol/source/TileWMS.js'; var layers = [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }), new TileLayer({ - source: new _ol_source_TileWMS_({ + source: new TileWMS({ url: 'https://ahocevar.com/geoserver/ne/wms', params: {'LAYERS': 'ne:ne_10m_admin_0_countries', 'TILED': true}, serverType: 'geoserver' @@ -20,7 +20,7 @@ var layers = [ var map = new Map({ layers: layers, target: 'map', - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 1 }) diff --git a/examples/wms-tiled.js b/examples/wms-tiled.js index 767fe2c61a..885be0e331 100644 --- a/examples/wms-tiled.js +++ b/examples/wms-tiled.js @@ -1,17 +1,17 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js'; +import OSM from '../src/ol/source/OSM.js'; +import TileWMS from '../src/ol/source/TileWMS.js'; var layers = [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }), new TileLayer({ extent: [-13884991, 2870341, -7455066, 6338219], - source: new _ol_source_TileWMS_({ + source: new TileWMS({ url: 'https://ahocevar.com/geoserver/wms', params: {'LAYERS': 'topp:states', 'TILED': true}, serverType: 'geoserver', @@ -23,7 +23,7 @@ var layers = [ var map = new Map({ layers: layers, target: 'map', - view: new _ol_View_({ + view: new View({ center: [-10997148, 4569099], zoom: 4 }) diff --git a/examples/wms-time.js b/examples/wms-time.js index e253c1c64e..751295e7f6 100644 --- a/examples/wms-time.js +++ b/examples/wms-time.js @@ -1,10 +1,10 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import * as _ol_extent_ from '../src/ol/extent.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {transformExtent} from '../src/ol/proj.js'; -import _ol_source_Stamen_ from '../src/ol/source/Stamen.js'; -import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js'; +import Stamen from '../src/ol/source/Stamen.js'; +import TileWMS from '../src/ol/source/TileWMS.js'; function threeHoursAgo() { return new Date(Math.round(Date.now() / 3600000) * 3600000 - 3600000 * 3); @@ -17,13 +17,13 @@ var animationId = null; var layers = [ new TileLayer({ - source: new _ol_source_Stamen_({ + source: new Stamen({ layer: 'terrain' }) }), new TileLayer({ extent: extent, - source: new _ol_source_TileWMS_({ + source: new TileWMS({ attributions: ['Iowa State University'], url: 'https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r-t.cgi', params: {'LAYERS': 'nexrad-n0r-wmst'} @@ -33,7 +33,7 @@ var layers = [ var map = new Map({ layers: layers, target: 'map', - view: new _ol_View_({ + view: new View({ center: _ol_extent_.getCenter(extent), zoom: 4 }) diff --git a/examples/wmts-dimensions.js b/examples/wmts-dimensions.js index 6004e66d8f..e0e78d94de 100644 --- a/examples/wmts-dimensions.js +++ b/examples/wmts-dimensions.js @@ -1,10 +1,10 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import * as _ol_extent_ from '../src/ol/extent.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {get as getProjection} from '../src/ol/proj.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_WMTS_ from '../src/ol/source/WMTS.js'; +import OSM from '../src/ol/source/OSM.js'; +import WMTS from '../src/ol/source/WMTS.js'; import WMTSTileGrid from '../src/ol/tilegrid/WMTS.js'; @@ -26,7 +26,7 @@ var tileGrid = new WMTSTileGrid({ var scalgoToken = 'CC5BF28A7D96B320C7DFBFD1236B5BEB'; -var wmtsSource = new _ol_source_WMTS_({ +var wmtsSource = new WMTS({ url: 'http://ts2.scalgo.com/olpatch/wmts?token=' + scalgoToken, layer: 'SRTM_4_1:SRTM_4_1_flooded_sealevels', format: 'image/png', @@ -45,14 +45,14 @@ var wmtsSource = new _ol_source_WMTS_({ var map = new Map({ target: 'map', - view: new _ol_View_({ + view: new View({ projection: projection, center: [-9871995, 3566245], zoom: 6 }), layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }), new TileLayer({ opacity: 0.5, diff --git a/examples/wmts-hidpi.js b/examples/wmts-hidpi.js index db0b689f98..b00ec50fba 100644 --- a/examples/wmts-hidpi.js +++ b/examples/wmts-hidpi.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import _ol_format_WMTSCapabilities_ from '../src/ol/format/WMTSCapabilities.js'; import _ol_has_ from '../src/ol/has.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_WMTS_ from '../src/ol/source/WMTS.js'; +import WMTS from '../src/ol/source/WMTS.js'; var capabilitiesUrl = 'https://www.basemap.at/wmts/1.0.0/WMTSCapabilities.xml'; @@ -17,7 +17,7 @@ var tilePixelRatio = hiDPI ? 2 : 1; var map = new Map({ target: 'map', - view: new _ol_View_({ + view: new View({ center: [1823849, 6143760], zoom: 11 }) @@ -27,13 +27,13 @@ fetch(capabilitiesUrl).then(function(response) { return response.text(); }).then(function(text) { var result = new _ol_format_WMTSCapabilities_().read(text); - var options = _ol_source_WMTS_.optionsFromCapabilities(result, { + var options = WMTS.optionsFromCapabilities(result, { layer: layer, matrixSet: 'google3857', style: 'normal' }); options.tilePixelRatio = tilePixelRatio; map.addLayer(new TileLayer({ - source: new _ol_source_WMTS_(/** @type {!olx.source.WMTSOptions} */ (options)) + source: new WMTS(/** @type {!olx.source.WMTSOptions} */ (options)) })); }); diff --git a/examples/wmts-ign.js b/examples/wmts-ign.js index 3ce1ab5ef6..31164ac5f7 100644 --- a/examples/wmts-ign.js +++ b/examples/wmts-ign.js @@ -1,10 +1,10 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import * as _ol_extent_ from '../src/ol/extent.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat, get as getProjection} from '../src/ol/proj.js'; -import _ol_source_WMTS_ from '../src/ol/source/WMTS.js'; +import WMTS from '../src/ol/source/WMTS.js'; import WMTSTileGrid from '../src/ol/tilegrid/WMTS.js'; @@ -15,7 +15,7 @@ var map = new Map({ collapsible: false } }), - view: new _ol_View_({ + view: new View({ zoom: 5, center: fromLonLat([5, 45]) }) @@ -41,7 +41,7 @@ var tileGrid = new WMTSTileGrid({ // Expiration date is 06/29/2018. var key = '2mqbg0z6cx7ube8gsou10nrt'; -var ign_source = new _ol_source_WMTS_({ +var ign_source = new WMTS({ url: 'https://wxs.ign.fr/' + key + '/wmts', layer: 'GEOGRAPHICALGRIDSYSTEMS.MAPS', matrixSet: 'PM', diff --git a/examples/wmts-layer-from-capabilities.js b/examples/wmts-layer-from-capabilities.js index e316a9fdcb..8756778b77 100644 --- a/examples/wmts-layer-from-capabilities.js +++ b/examples/wmts-layer-from-capabilities.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import _ol_format_WMTSCapabilities_ from '../src/ol/format/WMTSCapabilities.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_WMTS_ from '../src/ol/source/WMTS.js'; +import OSM from '../src/ol/source/OSM.js'; +import WMTS from '../src/ol/source/WMTS.js'; var parser = new _ol_format_WMTSCapabilities_(); var map; @@ -12,7 +12,7 @@ fetch('data/WMTSCapabilities.xml').then(function(response) { return response.text(); }).then(function(text) { var result = parser.read(text); - var options = _ol_source_WMTS_.optionsFromCapabilities(result, { + var options = WMTS.optionsFromCapabilities(result, { layer: 'layer-7328', matrixSet: 'EPSG:3857' }); @@ -20,16 +20,16 @@ fetch('data/WMTSCapabilities.xml').then(function(response) { map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_(), + source: new OSM(), opacity: 0.7 }), new TileLayer({ opacity: 1, - source: new _ol_source_WMTS_(/** @type {!olx.source.WMTSOptions} */ (options)) + source: new WMTS(/** @type {!olx.source.WMTSOptions} */ (options)) }) ], target: 'map', - view: new _ol_View_({ + view: new View({ center: [19412406.33, -5050500.21], zoom: 5 }) diff --git a/examples/wmts.js b/examples/wmts.js index 4a6adfe0a9..228c26c958 100644 --- a/examples/wmts.js +++ b/examples/wmts.js @@ -1,11 +1,11 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import {defaults as defaultControls} from '../src/ol/control.js'; import * as _ol_extent_ from '../src/ol/extent.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {get as getProjection} from '../src/ol/proj.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_WMTS_ from '../src/ol/source/WMTS.js'; +import OSM from '../src/ol/source/OSM.js'; +import WMTS from '../src/ol/source/WMTS.js'; import WMTSTileGrid from '../src/ol/tilegrid/WMTS.js'; @@ -23,12 +23,12 @@ for (var z = 0; z < 14; ++z) { var map = new Map({ layers: [ new TileLayer({ - source: new _ol_source_OSM_(), + source: new OSM(), opacity: 0.7 }), new TileLayer({ opacity: 0.7, - source: new _ol_source_WMTS_({ + source: new WMTS({ attributions: 'Tiles © ArcGIS', url: 'https://services.arcgisonline.com/arcgis/rest/' + @@ -53,7 +53,7 @@ var map = new Map({ collapsible: false } }), - view: new _ol_View_({ + view: new View({ center: [-11158582, 4813697], zoom: 4 }) diff --git a/examples/xyz-esri-4326-512.js b/examples/xyz-esri-4326-512.js index 57be2af393..47d329173c 100644 --- a/examples/xyz-esri-4326-512.js +++ b/examples/xyz-esri-4326-512.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_XYZ_ from '../src/ol/source/XYZ.js'; +import XYZ from '../src/ol/source/XYZ.js'; // The tile size supported by the ArcGIS tile service. var tileSize = 512; @@ -13,7 +13,7 @@ var map = new Map({ target: 'map', layers: [ new TileLayer({ - source: new _ol_source_XYZ_({ + source: new XYZ({ attributions: 'Copyright:© 2013 ESRI, i-cubed, GeoEye', maxZoom: 16, projection: 'EPSG:4326', @@ -27,7 +27,7 @@ var map = new Map({ }) }) ], - view: new _ol_View_({ + view: new View({ center: [0, 0], projection: 'EPSG:4326', zoom: 2, diff --git a/examples/xyz-esri.js b/examples/xyz-esri.js index 4405a7db4c..653ef9b102 100644 --- a/examples/xyz-esri.js +++ b/examples/xyz-esri.js @@ -1,15 +1,15 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_XYZ_ from '../src/ol/source/XYZ.js'; +import XYZ from '../src/ol/source/XYZ.js'; var map = new Map({ target: 'map', layers: [ new TileLayer({ - source: new _ol_source_XYZ_({ + source: new XYZ({ attributions: 'Tiles © ArcGIS', url: 'https://server.arcgisonline.com/ArcGIS/rest/services/' + @@ -17,7 +17,7 @@ var map = new Map({ }) }) ], - view: new _ol_View_({ + view: new View({ center: fromLonLat([-121.1, 47.5]), zoom: 7 }) diff --git a/examples/xyz-retina.js b/examples/xyz-retina.js index 8130aa79f6..2cf03502b4 100644 --- a/examples/xyz-retina.js +++ b/examples/xyz-retina.js @@ -1,9 +1,9 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {transform, transformExtent} from '../src/ol/proj.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_XYZ_ from '../src/ol/source/XYZ.js'; +import OSM from '../src/ol/source/OSM.js'; +import XYZ from '../src/ol/source/XYZ.js'; var mapMinZoom = 1; var mapMaxZoom = 15; @@ -13,11 +13,11 @@ var map = new Map({ target: 'map', layers: [ new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }), new TileLayer({ extent: transformExtent(mapExtent, 'EPSG:4326', 'EPSG:3857'), - source: new _ol_source_XYZ_({ + source: new XYZ({ attributions: 'Tiles © USGS, rendered with ' + 'MapTiler', url: 'https://tileserver.maptiler.com/grandcanyon@2x/{z}/{x}/{y}.png', @@ -27,7 +27,7 @@ var map = new Map({ }) }) ], - view: new _ol_View_({ + view: new View({ projection: 'EPSG:3857', center: transform([-112.18688965, 36.057944835], 'EPSG:4326', 'EPSG:3857'), diff --git a/examples/xyz.js b/examples/xyz.js index 3ead7f102f..2f06344a5a 100644 --- a/examples/xyz.js +++ b/examples/xyz.js @@ -1,20 +1,20 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_XYZ_ from '../src/ol/source/XYZ.js'; +import XYZ from '../src/ol/source/XYZ.js'; var map = new Map({ target: 'map', layers: [ new TileLayer({ - source: new _ol_source_XYZ_({ + source: new XYZ({ url: 'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png' + '?apikey=0e6fc415256d4fbb9b5166a718591d71' }) }) ], - view: new _ol_View_({ + view: new View({ center: [-472202, 7530279], zoom: 12 }) diff --git a/examples/zoom-constrained.js b/examples/zoom-constrained.js index cba1f2ef63..bac04ed040 100644 --- a/examples/zoom-constrained.js +++ b/examples/zoom-constrained.js @@ -1,20 +1,20 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; +import BingMaps from '../src/ol/source/BingMaps.js'; var map = new Map({ target: 'map', layers: [ new TileLayer({ - source: new _ol_source_BingMaps_({ + source: new BingMaps({ key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5', imagerySet: 'Aerial' }) }) ], - view: new _ol_View_({ + view: new View({ center: [-13553864, 5918250], zoom: 11, minZoom: 9, diff --git a/examples/zoomify.js b/examples/zoomify.js index 9424b58ed0..5b2589135e 100644 --- a/examples/zoomify.js +++ b/examples/zoomify.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_Zoomify_ from '../src/ol/source/Zoomify.js'; +import Zoomify from '../src/ol/source/Zoomify.js'; var imgWidth = 9911; var imgHeight = 6100; @@ -11,7 +11,7 @@ var zoomifyUrl = 'http://vips.vtech.fr/cgi-bin/iipsrv.fcgi?zoomify=' + var iipUrl = 'http://vips.vtech.fr/cgi-bin/iipsrv.fcgi?FIF=' + '/mnt/MD1/AD00/plan_CHU-4HD-01/FOND.TIF' + '&JTL={z},{tileIndex}'; var layer = new TileLayer({ - source: new _ol_source_Zoomify_({ + source: new Zoomify({ url: zoomifyUrl, size: [imgWidth, imgHeight], crossOrigin: 'anonymous' @@ -23,7 +23,7 @@ var extent = [0, -imgHeight, imgWidth, 0]; var map = new Map({ layers: [layer], target: 'map', - view: new _ol_View_({ + view: new View({ // adjust zoom levels to those provided by the source resolutions: layer.getSource().getTileGrid().getResolutions(), // constrain the center: center cannot be set outside this extent @@ -36,13 +36,13 @@ var control = document.getElementById('zoomifyProtocol'); control.addEventListener('change', function(event) { var value = event.currentTarget.value; if (value === 'iip') { - layer.setSource(new _ol_source_Zoomify_({ + layer.setSource(new Zoomify({ url: iipUrl, size: [imgWidth, imgHeight], crossOrigin: 'anonymous' })); } else if (value === 'zoomify') { - layer.setSource(new _ol_source_Zoomify_({ + layer.setSource(new Zoomify({ url: zoomifyUrl, size: [imgWidth, imgHeight], crossOrigin: 'anonymous' diff --git a/examples/zoomslider.js b/examples/zoomslider.js index 3b571e2cad..4de9afab22 100644 --- a/examples/zoomslider.js +++ b/examples/zoomslider.js @@ -1,8 +1,8 @@ import Map from '../src/ol/Map.js'; -import _ol_View_ from '../src/ol/View.js'; +import View from '../src/ol/View.js'; import ZoomSlider from '../src/ol/control/ZoomSlider.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../src/ol/source/OSM.js'; +import OSM from '../src/ol/source/OSM.js'; /** @@ -14,14 +14,14 @@ import _ol_source_OSM_ from '../src/ol/source/OSM.js'; var createMap = function(divId) { var source, layer, map, zoomslider; - source = new _ol_source_OSM_(); + source = new OSM(); layer = new TileLayer({ source: source }); map = new Map({ layers: [layer], target: divId, - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 2 }) diff --git a/src/ol/CanvasMap.js b/src/ol/CanvasMap.js index 7e05f47db1..4360fc1931 100644 --- a/src/ol/CanvasMap.js +++ b/src/ol/CanvasMap.js @@ -8,19 +8,19 @@ import {defaults as defaultControls} from './control.js'; import {defaults as defaultInteractions} from './interaction.js'; import _ol_obj_ from './obj.js'; import {register, registerMultiple} from './plugins.js'; -import _ol_renderer_canvas_ImageLayer_ from './renderer/canvas/ImageLayer.js'; -import _ol_renderer_canvas_Map_ from './renderer/canvas/Map.js'; -import _ol_renderer_canvas_TileLayer_ from './renderer/canvas/TileLayer.js'; -import _ol_renderer_canvas_VectorLayer_ from './renderer/canvas/VectorLayer.js'; -import _ol_renderer_canvas_VectorTileLayer_ from './renderer/canvas/VectorTileLayer.js'; +import CanvasImageLayerRenderer from './renderer/canvas/ImageLayer.js'; +import CanvasMapRenderer from './renderer/canvas/Map.js'; +import CanvasTileLayerRenderer from './renderer/canvas/TileLayer.js'; +import CanvasVectorLayerRenderer from './renderer/canvas/VectorLayer.js'; +import CanvasVectorTileLayerRenderer from './renderer/canvas/VectorTileLayer.js'; -register(PluginType.MAP_RENDERER, _ol_renderer_canvas_Map_); +register(PluginType.MAP_RENDERER, CanvasMapRenderer); registerMultiple(PluginType.LAYER_RENDERER, [ - _ol_renderer_canvas_ImageLayer_, - _ol_renderer_canvas_TileLayer_, - _ol_renderer_canvas_VectorLayer_, - _ol_renderer_canvas_VectorTileLayer_ + CanvasImageLayerRenderer, + CanvasTileLayerRenderer, + CanvasVectorLayerRenderer, + CanvasVectorTileLayerRenderer ]); diff --git a/src/ol/CenterConstraint.js b/src/ol/CenterConstraint.js index da21fac1d8..2b8b67a0b0 100644 --- a/src/ol/CenterConstraint.js +++ b/src/ol/CenterConstraint.js @@ -2,14 +2,14 @@ * @module ol/CenterConstraint */ import {clamp} from './math.js'; -var _ol_CenterConstraint_ = {}; +var CenterConstraint = {}; /** * @param {ol.Extent} extent Extent. * @return {ol.CenterConstraintType} The constraint. */ -_ol_CenterConstraint_.createExtent = function(extent) { +CenterConstraint.createExtent = function(extent) { return ( /** * @param {ol.Coordinate|undefined} center Center. @@ -33,7 +33,7 @@ _ol_CenterConstraint_.createExtent = function(extent) { * @param {ol.Coordinate|undefined} center Center. * @return {ol.Coordinate|undefined} Center. */ -_ol_CenterConstraint_.none = function(center) { +CenterConstraint.none = function(center) { return center; }; -export default _ol_CenterConstraint_; +export default CenterConstraint; diff --git a/src/ol/Collection.js b/src/ol/Collection.js index dbbdd4c24b..fb1423da1c 100644 --- a/src/ol/Collection.js +++ b/src/ol/Collection.js @@ -4,7 +4,7 @@ import {inherits} from './index.js'; import AssertionError from './AssertionError.js'; import CollectionEventType from './CollectionEventType.js'; -import _ol_Object_ from './Object.js'; +import BaseObject from './Object.js'; import Event from './events/Event.js'; @@ -43,7 +43,7 @@ export var CollectionOptions; */ var _ol_Collection_ = function(opt_array, opt_options) { - _ol_Object_.call(this); + BaseObject.call(this); var options = opt_options || {}; @@ -69,7 +69,7 @@ var _ol_Collection_ = function(opt_array, opt_options) { }; -inherits(_ol_Collection_, _ol_Object_); +inherits(_ol_Collection_, BaseObject); /** diff --git a/src/ol/Feature.js b/src/ol/Feature.js index 53d6bedcf6..6e9e78ff97 100644 --- a/src/ol/Feature.js +++ b/src/ol/Feature.js @@ -5,7 +5,7 @@ import {assert} from './asserts.js'; import _ol_events_ from './events.js'; import EventType from './events/EventType.js'; import {inherits} from './index.js'; -import _ol_Object_ from './Object.js'; +import BaseObject from './Object.js'; import Geometry from './geom/Geometry.js'; import _ol_style_Style_ from './style/Style.js'; @@ -54,9 +54,9 @@ import _ol_style_Style_ from './style/Style.js'; * include a Geometry associated with a `geometry` key. * @api */ -var _ol_Feature_ = function(opt_geometryOrProperties) { +var Feature = function(opt_geometryOrProperties) { - _ol_Object_.call(this); + BaseObject.call(this); /** * @private @@ -91,7 +91,7 @@ var _ol_Feature_ = function(opt_geometryOrProperties) { this.geometryChangeKey_ = null; _ol_events_.listen( - this, _ol_Object_.getChangeEventType(this.geometryName_), + this, BaseObject.getChangeEventType(this.geometryName_), this.handleGeometryChanged_, this); if (opt_geometryOrProperties !== undefined) { @@ -107,7 +107,7 @@ var _ol_Feature_ = function(opt_geometryOrProperties) { } }; -inherits(_ol_Feature_, _ol_Object_); +inherits(Feature, BaseObject); /** @@ -116,8 +116,8 @@ inherits(_ol_Feature_, _ol_Object_); * @return {ol.Feature} The clone. * @api */ -_ol_Feature_.prototype.clone = function() { - var clone = new _ol_Feature_(this.getProperties()); +Feature.prototype.clone = function() { + var clone = new Feature(this.getProperties()); clone.setGeometryName(this.getGeometryName()); var geometry = this.getGeometry(); if (geometry) { @@ -139,7 +139,7 @@ _ol_Feature_.prototype.clone = function() { * @api * @observable */ -_ol_Feature_.prototype.getGeometry = function() { +Feature.prototype.getGeometry = function() { return /** @type {ol.geom.Geometry|undefined} */ ( this.get(this.geometryName_)); }; @@ -152,7 +152,7 @@ _ol_Feature_.prototype.getGeometry = function() { * @return {number|string|undefined} Id. * @api */ -_ol_Feature_.prototype.getId = function() { +Feature.prototype.getId = function() { return this.id_; }; @@ -164,7 +164,7 @@ _ol_Feature_.prototype.getId = function() { * for this feature. * @api */ -_ol_Feature_.prototype.getGeometryName = function() { +Feature.prototype.getGeometryName = function() { return this.geometryName_; }; @@ -176,7 +176,7 @@ _ol_Feature_.prototype.getGeometryName = function() { * ol.FeatureStyleFunction|ol.StyleFunction} The feature style. * @api */ -_ol_Feature_.prototype.getStyle = function() { +Feature.prototype.getStyle = function() { return this.style_; }; @@ -187,7 +187,7 @@ _ol_Feature_.prototype.getStyle = function() { * representing the current style of this feature. * @api */ -_ol_Feature_.prototype.getStyleFunction = function() { +Feature.prototype.getStyleFunction = function() { return this.styleFunction_; }; @@ -195,7 +195,7 @@ _ol_Feature_.prototype.getStyleFunction = function() { /** * @private */ -_ol_Feature_.prototype.handleGeometryChange_ = function() { +Feature.prototype.handleGeometryChange_ = function() { this.changed(); }; @@ -203,7 +203,7 @@ _ol_Feature_.prototype.handleGeometryChange_ = function() { /** * @private */ -_ol_Feature_.prototype.handleGeometryChanged_ = function() { +Feature.prototype.handleGeometryChanged_ = function() { if (this.geometryChangeKey_) { _ol_events_.unlistenByKey(this.geometryChangeKey_); this.geometryChangeKey_ = null; @@ -224,7 +224,7 @@ _ol_Feature_.prototype.handleGeometryChanged_ = function() { * @api * @observable */ -_ol_Feature_.prototype.setGeometry = function(geometry) { +Feature.prototype.setGeometry = function(geometry) { this.set(this.geometryName_, geometry); }; @@ -238,10 +238,10 @@ _ol_Feature_.prototype.setGeometry = function(geometry) { * @api * @fires ol.events.Event#event:change */ -_ol_Feature_.prototype.setStyle = function(style) { +Feature.prototype.setStyle = function(style) { this.style_ = style; this.styleFunction_ = !style ? - undefined : _ol_Feature_.createStyleFunction(style); + undefined : Feature.createStyleFunction(style); this.changed(); }; @@ -255,7 +255,7 @@ _ol_Feature_.prototype.setStyle = function(style) { * @api * @fires ol.events.Event#event:change */ -_ol_Feature_.prototype.setId = function(id) { +Feature.prototype.setId = function(id) { this.id_ = id; this.changed(); }; @@ -268,13 +268,13 @@ _ol_Feature_.prototype.setId = function(id) { * @param {string} name The property name of the default geometry. * @api */ -_ol_Feature_.prototype.setGeometryName = function(name) { +Feature.prototype.setGeometryName = function(name) { _ol_events_.unlisten( - this, _ol_Object_.getChangeEventType(this.geometryName_), + this, BaseObject.getChangeEventType(this.geometryName_), this.handleGeometryChanged_, this); this.geometryName_ = name; _ol_events_.listen( - this, _ol_Object_.getChangeEventType(this.geometryName_), + this, BaseObject.getChangeEventType(this.geometryName_), this.handleGeometryChanged_, this); this.handleGeometryChanged_(); }; @@ -288,7 +288,7 @@ _ol_Feature_.prototype.setGeometryName = function(name) { * A feature style function, a single style, or an array of styles. * @return {ol.FeatureStyleFunction} A style function. */ -_ol_Feature_.createStyleFunction = function(obj) { +Feature.createStyleFunction = function(obj) { var styleFunction; if (typeof obj === 'function') { @@ -317,4 +317,4 @@ _ol_Feature_.createStyleFunction = function(obj) { } return styleFunction; }; -export default _ol_Feature_; +export default Feature; diff --git a/src/ol/Geolocation.js b/src/ol/Geolocation.js index 546c4b22ed..574e4d37f2 100644 --- a/src/ol/Geolocation.js +++ b/src/ol/Geolocation.js @@ -3,7 +3,7 @@ */ import {inherits} from './index.js'; import _ol_GeolocationProperty_ from './GeolocationProperty.js'; -import _ol_Object_ from './Object.js'; +import BaseObject from './Object.js'; import _ol_events_ from './events.js'; import EventType from './events/EventType.js'; import {circular as circularPolygon} from './geom/Polygon.js'; @@ -55,7 +55,7 @@ export var GeolocationOptions; */ var Geolocation = function(opt_options) { - _ol_Object_.call(this); + BaseObject.call(this); var options = opt_options || {}; @@ -79,10 +79,10 @@ var Geolocation = function(opt_options) { this.watchId_ = undefined; _ol_events_.listen( - this, _ol_Object_.getChangeEventType(_ol_GeolocationProperty_.PROJECTION), + this, BaseObject.getChangeEventType(_ol_GeolocationProperty_.PROJECTION), this.handleProjectionChanged_, this); _ol_events_.listen( - this, _ol_Object_.getChangeEventType(_ol_GeolocationProperty_.TRACKING), + this, BaseObject.getChangeEventType(_ol_GeolocationProperty_.TRACKING), this.handleTrackingChanged_, this); if (options.projection !== undefined) { @@ -96,7 +96,7 @@ var Geolocation = function(opt_options) { }; -inherits(Geolocation, _ol_Object_); +inherits(Geolocation, BaseObject); /** @@ -104,7 +104,7 @@ inherits(Geolocation, _ol_Object_); */ Geolocation.prototype.disposeInternal = function() { this.setTracking(false); - _ol_Object_.prototype.disposeInternal.call(this); + BaseObject.prototype.disposeInternal.call(this); }; diff --git a/src/ol/ImageCanvas.js b/src/ol/ImageCanvas.js index ba1783911b..0a35034f0b 100644 --- a/src/ol/ImageCanvas.js +++ b/src/ol/ImageCanvas.js @@ -15,7 +15,7 @@ import ImageState from './ImageState.js'; * @param {ol.ImageCanvasLoader=} opt_loader Optional loader function to * support asynchronous canvas drawing. */ -var _ol_ImageCanvas_ = function(extent, resolution, pixelRatio, canvas, opt_loader) { +var ImageCanvas = function(extent, resolution, pixelRatio, canvas, opt_loader) { /** * Optional canvas loader function. @@ -42,14 +42,14 @@ var _ol_ImageCanvas_ = function(extent, resolution, pixelRatio, canvas, opt_load }; -inherits(_ol_ImageCanvas_, _ol_ImageBase_); +inherits(ImageCanvas, _ol_ImageBase_); /** * Get any error associated with asynchronous rendering. * @return {Error} Any error that occurred during rendering. */ -_ol_ImageCanvas_.prototype.getError = function() { +ImageCanvas.prototype.getError = function() { return this.error_; }; @@ -59,7 +59,7 @@ _ol_ImageCanvas_.prototype.getError = function() { * @param {Error} err Any error during drawing. * @private */ -_ol_ImageCanvas_.prototype.handleLoad_ = function(err) { +ImageCanvas.prototype.handleLoad_ = function(err) { if (err) { this.error_ = err; this.state = ImageState.ERROR; @@ -73,7 +73,7 @@ _ol_ImageCanvas_.prototype.handleLoad_ = function(err) { /** * @inheritDoc */ -_ol_ImageCanvas_.prototype.load = function() { +ImageCanvas.prototype.load = function() { if (this.state == ImageState.IDLE) { this.state = ImageState.LOADING; this.changed(); @@ -85,7 +85,7 @@ _ol_ImageCanvas_.prototype.load = function() { /** * @inheritDoc */ -_ol_ImageCanvas_.prototype.getImage = function() { +ImageCanvas.prototype.getImage = function() { return this.canvas_; }; -export default _ol_ImageCanvas_; +export default ImageCanvas; diff --git a/src/ol/Map.js b/src/ol/Map.js index d07a57e91f..d3a04dc4c1 100644 --- a/src/ol/Map.js +++ b/src/ol/Map.js @@ -8,31 +8,31 @@ import {defaults as defaultControls} from './control.js'; import {defaults as defaultInteractions} from './interaction.js'; import _ol_obj_ from './obj.js'; import {register, registerMultiple} from './plugins.js'; -import _ol_renderer_canvas_ImageLayer_ from './renderer/canvas/ImageLayer.js'; -import _ol_renderer_canvas_Map_ from './renderer/canvas/Map.js'; -import _ol_renderer_canvas_TileLayer_ from './renderer/canvas/TileLayer.js'; -import _ol_renderer_canvas_VectorLayer_ from './renderer/canvas/VectorLayer.js'; -import _ol_renderer_canvas_VectorTileLayer_ from './renderer/canvas/VectorTileLayer.js'; -import _ol_renderer_webgl_ImageLayer_ from './renderer/webgl/ImageLayer.js'; -import _ol_renderer_webgl_Map_ from './renderer/webgl/Map.js'; -import _ol_renderer_webgl_TileLayer_ from './renderer/webgl/TileLayer.js'; -import _ol_renderer_webgl_VectorLayer_ from './renderer/webgl/VectorLayer.js'; +import CanvasImageLayerRenderer from './renderer/canvas/ImageLayer.js'; +import CanvasMapRenderer from './renderer/canvas/Map.js'; +import CanvasTileLayerRenderer from './renderer/canvas/TileLayer.js'; +import CanvasVectorLayerRenderer from './renderer/canvas/VectorLayer.js'; +import CanvasVectorTileLayerRenderer from './renderer/canvas/VectorTileLayer.js'; +import WebGLImageLayerRenderer from './renderer/webgl/ImageLayer.js'; +import WebGLMapRenderer from './renderer/webgl/Map.js'; +import WebGLTileLayerRenderer from './renderer/webgl/TileLayer.js'; +import WebGLVectorLayerRenderer from './renderer/webgl/VectorLayer.js'; -register(PluginType.MAP_RENDERER, _ol_renderer_canvas_Map_); +register(PluginType.MAP_RENDERER, CanvasMapRenderer); registerMultiple(PluginType.LAYER_RENDERER, [ - _ol_renderer_canvas_ImageLayer_, - _ol_renderer_canvas_TileLayer_, - _ol_renderer_canvas_VectorLayer_, - _ol_renderer_canvas_VectorTileLayer_ + CanvasImageLayerRenderer, + CanvasTileLayerRenderer, + CanvasVectorLayerRenderer, + CanvasVectorTileLayerRenderer ]); // TODO: move these to new ol-webgl package -register(PluginType.MAP_RENDERER, _ol_renderer_webgl_Map_); +register(PluginType.MAP_RENDERER, WebGLMapRenderer); registerMultiple(PluginType.LAYER_RENDERER, [ - _ol_renderer_webgl_ImageLayer_, - _ol_renderer_webgl_TileLayer_, - _ol_renderer_webgl_VectorLayer_ + WebGLImageLayerRenderer, + WebGLTileLayerRenderer, + WebGLVectorLayerRenderer ]); diff --git a/src/ol/Object.js b/src/ol/Object.js index 10f8fe0ea6..227061bdcb 100644 --- a/src/ol/Object.js +++ b/src/ol/Object.js @@ -3,7 +3,7 @@ */ import {getUid, inherits} from './index.js'; import ObjectEventType from './ObjectEventType.js'; -import _ol_Observable_ from './Observable.js'; +import Observable from './Observable.js'; import Event from './events/Event.js'; import _ol_obj_ from './obj.js'; @@ -52,8 +52,8 @@ import _ol_obj_ from './obj.js'; * @fires ol.Object.Event * @api */ -var _ol_Object_ = function(opt_values) { - _ol_Observable_.call(this); +var BaseObject = function(opt_values) { + Observable.call(this); // Call ol.getUid to ensure that the order of objects' ids is the same as // the order in which they were created. This also helps to ensure that @@ -72,24 +72,24 @@ var _ol_Object_ = function(opt_values) { } }; -inherits(_ol_Object_, _ol_Observable_); +inherits(BaseObject, Observable); /** * @private * @type {Object.} */ -_ol_Object_.changeEventTypeCache_ = {}; +BaseObject.changeEventTypeCache_ = {}; /** * @param {string} key Key name. * @return {string} Change name. */ -_ol_Object_.getChangeEventType = function(key) { - return _ol_Object_.changeEventTypeCache_.hasOwnProperty(key) ? - _ol_Object_.changeEventTypeCache_[key] : - (_ol_Object_.changeEventTypeCache_[key] = 'change:' + key); +BaseObject.getChangeEventType = function(key) { + return BaseObject.changeEventTypeCache_.hasOwnProperty(key) ? + BaseObject.changeEventTypeCache_[key] : + (BaseObject.changeEventTypeCache_[key] = 'change:' + key); }; @@ -99,7 +99,7 @@ _ol_Object_.getChangeEventType = function(key) { * @return {*} Value. * @api */ -_ol_Object_.prototype.get = function(key) { +BaseObject.prototype.get = function(key) { var value; if (this.values_.hasOwnProperty(key)) { value = this.values_[key]; @@ -113,7 +113,7 @@ _ol_Object_.prototype.get = function(key) { * @return {Array.} List of property names. * @api */ -_ol_Object_.prototype.getKeys = function() { +BaseObject.prototype.getKeys = function() { return Object.keys(this.values_); }; @@ -123,7 +123,7 @@ _ol_Object_.prototype.getKeys = function() { * @return {Object.} Object. * @api */ -_ol_Object_.prototype.getProperties = function() { +BaseObject.prototype.getProperties = function() { return _ol_obj_.assign({}, this.values_); }; @@ -132,12 +132,12 @@ _ol_Object_.prototype.getProperties = function() { * @param {string} key Key name. * @param {*} oldValue Old value. */ -_ol_Object_.prototype.notify = function(key, oldValue) { +BaseObject.prototype.notify = function(key, oldValue) { var eventType; - eventType = _ol_Object_.getChangeEventType(key); - this.dispatchEvent(new _ol_Object_.Event(eventType, key, oldValue)); + eventType = BaseObject.getChangeEventType(key); + this.dispatchEvent(new BaseObject.Event(eventType, key, oldValue)); eventType = ObjectEventType.PROPERTYCHANGE; - this.dispatchEvent(new _ol_Object_.Event(eventType, key, oldValue)); + this.dispatchEvent(new BaseObject.Event(eventType, key, oldValue)); }; @@ -148,7 +148,7 @@ _ol_Object_.prototype.notify = function(key, oldValue) { * @param {boolean=} opt_silent Update without triggering an event. * @api */ -_ol_Object_.prototype.set = function(key, value, opt_silent) { +BaseObject.prototype.set = function(key, value, opt_silent) { if (opt_silent) { this.values_[key] = value; } else { @@ -168,7 +168,7 @@ _ol_Object_.prototype.set = function(key, value, opt_silent) { * @param {boolean=} opt_silent Update without triggering an event. * @api */ -_ol_Object_.prototype.setProperties = function(values, opt_silent) { +BaseObject.prototype.setProperties = function(values, opt_silent) { var key; for (key in values) { this.set(key, values[key], opt_silent); @@ -182,7 +182,7 @@ _ol_Object_.prototype.setProperties = function(values, opt_silent) { * @param {boolean=} opt_silent Unset without triggering an event. * @api */ -_ol_Object_.prototype.unset = function(key, opt_silent) { +BaseObject.prototype.unset = function(key, opt_silent) { if (key in this.values_) { var oldValue = this.values_[key]; delete this.values_[key]; @@ -204,7 +204,7 @@ _ol_Object_.prototype.unset = function(key, opt_silent) { * @implements {oli.Object.Event} * @constructor */ -_ol_Object_.Event = function(type, key, oldValue) { +BaseObject.Event = function(type, key, oldValue) { Event.call(this, type); /** @@ -223,5 +223,5 @@ _ol_Object_.Event = function(type, key, oldValue) { this.oldValue = oldValue; }; -inherits(_ol_Object_.Event, Event); -export default _ol_Object_; +inherits(BaseObject.Event, Event); +export default BaseObject; diff --git a/src/ol/Observable.js b/src/ol/Observable.js index cf69ec5123..53ea102ed3 100644 --- a/src/ol/Observable.js +++ b/src/ol/Observable.js @@ -20,7 +20,7 @@ import EventType from './events/EventType.js'; * @struct * @api */ -var _ol_Observable_ = function() { +var Observable = function() { EventTarget.call(this); @@ -32,7 +32,7 @@ var _ol_Observable_ = function() { }; -inherits(_ol_Observable_, EventTarget); +inherits(Observable, EventTarget); /** @@ -41,7 +41,7 @@ inherits(_ol_Observable_, EventTarget); * or `once()` (or an array of keys). * @api */ -_ol_Observable_.unByKey = function(key) { +Observable.unByKey = function(key) { if (Array.isArray(key)) { for (var i = 0, ii = key.length; i < ii; ++i) { _ol_events_.unlistenByKey(key[i]); @@ -56,7 +56,7 @@ _ol_Observable_.unByKey = function(key) { * Increases the revision counter and dispatches a 'change' event. * @api */ -_ol_Observable_.prototype.changed = function() { +Observable.prototype.changed = function() { ++this.revision_; this.dispatchEvent(EventType.CHANGE); }; @@ -73,7 +73,7 @@ _ol_Observable_.prototype.changed = function() { * @function * @api */ -_ol_Observable_.prototype.dispatchEvent; +Observable.prototype.dispatchEvent; /** @@ -82,7 +82,7 @@ _ol_Observable_.prototype.dispatchEvent; * @return {number} Revision. * @api */ -_ol_Observable_.prototype.getRevision = function() { +Observable.prototype.getRevision = function() { return this.revision_; }; @@ -96,7 +96,7 @@ _ol_Observable_.prototype.getRevision = function() { * will be an array of keys. * @api */ -_ol_Observable_.prototype.on = function(type, listener) { +Observable.prototype.on = function(type, listener) { if (Array.isArray(type)) { var len = type.length; var keys = new Array(len); @@ -120,7 +120,7 @@ _ol_Observable_.prototype.on = function(type, listener) { * will be an array of keys. * @api */ -_ol_Observable_.prototype.once = function(type, listener) { +Observable.prototype.once = function(type, listener) { if (Array.isArray(type)) { var len = type.length; var keys = new Array(len); @@ -141,7 +141,7 @@ _ol_Observable_.prototype.once = function(type, listener) { * @param {function(?): ?} listener The listener function. * @api */ -_ol_Observable_.prototype.un = function(type, listener) { +Observable.prototype.un = function(type, listener) { if (Array.isArray(type)) { for (var i = 0, ii = type.length; i < ii; ++i) { _ol_events_.unlisten(this, type[i], listener); @@ -151,4 +151,4 @@ _ol_Observable_.prototype.un = function(type, listener) { _ol_events_.unlisten(this, /** @type {string} */ (type), listener); } }; -export default _ol_Observable_; +export default Observable; diff --git a/src/ol/Overlay.js b/src/ol/Overlay.js index fae2ccffc7..e331f33881 100644 --- a/src/ol/Overlay.js +++ b/src/ol/Overlay.js @@ -3,7 +3,7 @@ */ import {inherits} from './index.js'; import MapEventType from './MapEventType.js'; -import _ol_Object_ from './Object.js'; +import BaseObject from './Object.js'; import OverlayPositioning from './OverlayPositioning.js'; import {CLASS_SELECTABLE} from './css.js'; import {removeNode, removeChildren, outerWidth, outerHeight} from './dom.js'; @@ -47,7 +47,7 @@ var Property = { */ var Overlay = function(options) { - _ol_Object_.call(this); + BaseObject.call(this); /** * @protected @@ -126,23 +126,23 @@ var Overlay = function(options) { this.mapPostrenderListenerKey = null; _ol_events_.listen( - this, _ol_Object_.getChangeEventType(Property.ELEMENT), + this, BaseObject.getChangeEventType(Property.ELEMENT), this.handleElementChanged, this); _ol_events_.listen( - this, _ol_Object_.getChangeEventType(Property.MAP), + this, BaseObject.getChangeEventType(Property.MAP), this.handleMapChanged, this); _ol_events_.listen( - this, _ol_Object_.getChangeEventType(Property.OFFSET), + this, BaseObject.getChangeEventType(Property.OFFSET), this.handleOffsetChanged, this); _ol_events_.listen( - this, _ol_Object_.getChangeEventType(Property.POSITION), + this, BaseObject.getChangeEventType(Property.POSITION), this.handlePositionChanged, this); _ol_events_.listen( - this, _ol_Object_.getChangeEventType(Property.POSITIONING), + this, BaseObject.getChangeEventType(Property.POSITIONING), this.handlePositioningChanged, this); if (options.element !== undefined) { @@ -161,7 +161,7 @@ var Overlay = function(options) { }; -inherits(Overlay, _ol_Object_); +inherits(Overlay, BaseObject); /** diff --git a/src/ol/PluggableMap.js b/src/ol/PluggableMap.js index e9a6759f7a..211bc4c548 100644 --- a/src/ol/PluggableMap.js +++ b/src/ol/PluggableMap.js @@ -10,11 +10,11 @@ import MapBrowserEventType from './MapBrowserEventType.js'; import MapEvent from './MapEvent.js'; import MapEventType from './MapEventType.js'; import _ol_MapProperty_ from './MapProperty.js'; -import _ol_Object_ from './Object.js'; +import BaseObject from './Object.js'; import ObjectEventType from './ObjectEventType.js'; import TileQueue from './TileQueue.js'; -import _ol_View_ from './View.js'; -import _ol_ViewHint_ from './ViewHint.js'; +import View from './View.js'; +import ViewHint from './ViewHint.js'; import {assert} from './asserts.js'; import {removeNode} from './dom.js'; import _ol_events_ from './events.js'; @@ -111,7 +111,7 @@ export var MapOptions; */ var PluggableMap = function(options) { - _ol_Object_.call(this); + BaseObject.call(this); var optionsInternal = createOptionsInternal(options); @@ -337,13 +337,13 @@ var PluggableMap = function(options) { this.skippedFeatureUids_ = {}; _ol_events_.listen( - this, _ol_Object_.getChangeEventType(_ol_MapProperty_.LAYERGROUP), + this, BaseObject.getChangeEventType(_ol_MapProperty_.LAYERGROUP), this.handleLayerGroupChanged_, this); - _ol_events_.listen(this, _ol_Object_.getChangeEventType(_ol_MapProperty_.VIEW), + _ol_events_.listen(this, BaseObject.getChangeEventType(_ol_MapProperty_.VIEW), this.handleViewChanged_, this); - _ol_events_.listen(this, _ol_Object_.getChangeEventType(_ol_MapProperty_.SIZE), + _ol_events_.listen(this, BaseObject.getChangeEventType(_ol_MapProperty_.SIZE), this.handleSizeChanged_, this); - _ol_events_.listen(this, _ol_Object_.getChangeEventType(_ol_MapProperty_.TARGET), + _ol_events_.listen(this, BaseObject.getChangeEventType(_ol_MapProperty_.TARGET), this.handleTargetChanged_, this); // setProperties will trigger the rendering of the map if the map @@ -425,7 +425,7 @@ var PluggableMap = function(options) { }; -inherits(PluggableMap, _ol_Object_); +inherits(PluggableMap, BaseObject); /** @@ -505,7 +505,7 @@ PluggableMap.prototype.disposeInternal = function() { this.animationDelayKey_ = undefined; } this.setTarget(null); - _ol_Object_.prototype.disposeInternal.call(this); + BaseObject.prototype.disposeInternal.call(this); }; @@ -954,11 +954,11 @@ PluggableMap.prototype.handlePostRender = function() { var maxNewLoads = maxTotalLoading; if (frameState) { var hints = frameState.viewHints; - if (hints[_ol_ViewHint_.ANIMATING]) { + if (hints[ViewHint.ANIMATING]) { maxTotalLoading = this.loadTilesWhileAnimating_ ? 8 : 0; maxNewLoads = 2; } - if (hints[_ol_ViewHint_.INTERACTING]) { + if (hints[ViewHint.INTERACTING]) { maxTotalLoading = this.loadTilesWhileInteracting_ ? 8 : 0; maxNewLoads = 2; } @@ -1260,8 +1260,8 @@ PluggableMap.prototype.renderFrame_ = function(time) { } var idle = this.previousExtent_ && - !frameState.viewHints[_ol_ViewHint_.ANIMATING] && - !frameState.viewHints[_ol_ViewHint_.INTERACTING] && + !frameState.viewHints[ViewHint.ANIMATING] && + !frameState.viewHints[ViewHint.INTERACTING] && !equals(frameState.extent, this.previousExtent_); if (idle) { @@ -1411,7 +1411,7 @@ function createOptionsInternal(options) { values[_ol_MapProperty_.TARGET] = options.target; values[_ol_MapProperty_.VIEW] = options.view !== undefined ? - options.view : new _ol_View_(); + options.view : new View(); /** * @type {Array.} diff --git a/src/ol/ResolutionConstraint.js b/src/ol/ResolutionConstraint.js index 52922070b0..567d60a643 100644 --- a/src/ol/ResolutionConstraint.js +++ b/src/ol/ResolutionConstraint.js @@ -3,14 +3,14 @@ */ import {linearFindNearest} from './array.js'; import {clamp} from './math.js'; -var _ol_ResolutionConstraint_ = {}; +var ResolutionConstraint = {}; /** * @param {Array.} resolutions Resolutions. * @return {ol.ResolutionConstraintType} Zoom function. */ -_ol_ResolutionConstraint_.createSnapToResolutions = function(resolutions) { +ResolutionConstraint.createSnapToResolutions = function(resolutions) { return ( /** * @param {number|undefined} resolution Resolution. @@ -43,7 +43,7 @@ _ol_ResolutionConstraint_.createSnapToResolutions = function(resolutions) { * @param {number=} opt_maxLevel Maximum level. * @return {ol.ResolutionConstraintType} Zoom function. */ -_ol_ResolutionConstraint_.createSnapToPower = function(power, maxResolution, opt_maxLevel) { +ResolutionConstraint.createSnapToPower = function(power, maxResolution, opt_maxLevel) { return ( /** * @param {number|undefined} resolution Resolution. @@ -66,4 +66,4 @@ _ol_ResolutionConstraint_.createSnapToPower = function(power, maxResolution, opt } }); }; -export default _ol_ResolutionConstraint_; +export default ResolutionConstraint; diff --git a/src/ol/RotationConstraint.js b/src/ol/RotationConstraint.js index ba0fa7dc07..4bfab05c8f 100644 --- a/src/ol/RotationConstraint.js +++ b/src/ol/RotationConstraint.js @@ -2,7 +2,7 @@ * @module ol/RotationConstraint */ import {toRadians} from './math.js'; -var _ol_RotationConstraint_ = {}; +var RotationConstraint = {}; /** @@ -10,7 +10,7 @@ var _ol_RotationConstraint_ = {}; * @param {number} delta Delta. * @return {number|undefined} Rotation. */ -_ol_RotationConstraint_.disable = function(rotation, delta) { +RotationConstraint.disable = function(rotation, delta) { if (rotation !== undefined) { return 0; } else { @@ -24,7 +24,7 @@ _ol_RotationConstraint_.disable = function(rotation, delta) { * @param {number} delta Delta. * @return {number|undefined} Rotation. */ -_ol_RotationConstraint_.none = function(rotation, delta) { +RotationConstraint.none = function(rotation, delta) { if (rotation !== undefined) { return rotation + delta; } else { @@ -37,7 +37,7 @@ _ol_RotationConstraint_.none = function(rotation, delta) { * @param {number} n N. * @return {ol.RotationConstraintType} Rotation constraint. */ -_ol_RotationConstraint_.createSnapToN = function(n) { +RotationConstraint.createSnapToN = function(n) { var theta = 2 * Math.PI / n; return ( /** @@ -60,7 +60,7 @@ _ol_RotationConstraint_.createSnapToN = function(n) { * @param {number=} opt_tolerance Tolerance. * @return {ol.RotationConstraintType} Rotation constraint. */ -_ol_RotationConstraint_.createSnapToZero = function(opt_tolerance) { +RotationConstraint.createSnapToZero = function(opt_tolerance) { var tolerance = opt_tolerance || toRadians(5); return ( /** @@ -80,4 +80,4 @@ _ol_RotationConstraint_.createSnapToZero = function(opt_tolerance) { } }); }; -export default _ol_RotationConstraint_; +export default RotationConstraint; diff --git a/src/ol/View.js b/src/ol/View.js index 4e37a0251e..7c93134131 100644 --- a/src/ol/View.js +++ b/src/ol/View.js @@ -3,12 +3,12 @@ */ import {DEFAULT_TILE_SIZE} from './tilegrid/common.js'; import {inherits, getUid, nullFunction} from './index.js'; -import _ol_CenterConstraint_ from './CenterConstraint.js'; -import _ol_Object_ from './Object.js'; -import _ol_ResolutionConstraint_ from './ResolutionConstraint.js'; -import _ol_RotationConstraint_ from './RotationConstraint.js'; -import _ol_ViewHint_ from './ViewHint.js'; -import _ol_ViewProperty_ from './ViewProperty.js'; +import CenterConstraint from './CenterConstraint.js'; +import BaseObject from './Object.js'; +import ResolutionConstraint from './ResolutionConstraint.js'; +import RotationConstraint from './RotationConstraint.js'; +import ViewHint from './ViewHint.js'; +import ViewProperty from './ViewProperty.js'; import {linearFindNearest} from './array.js'; import {assert} from './asserts.js'; import _ol_coordinate_ from './coordinate.js'; @@ -20,7 +20,7 @@ import SimpleGeometry from './geom/SimpleGeometry.js'; import {clamp, modulo} from './math.js'; import _ol_obj_ from './obj.js'; import {createProjection, METERS_PER_UNIT} from './proj.js'; -import _ol_proj_Units_ from './proj/Units.js'; +import Units from './proj/Units.js'; /** @@ -86,8 +86,8 @@ var DEFAULT_MIN_ZOOM = 0; * @param {olx.ViewOptions=} opt_options View options. * @api */ -var _ol_View_ = function(opt_options) { - _ol_Object_.call(this); +var View = function(opt_options) { + BaseObject.call(this); var options = _ol_obj_.assign({}, opt_options); @@ -121,23 +121,23 @@ var _ol_View_ = function(opt_options) { this.applyOptions_(options); }; -inherits(_ol_View_, _ol_Object_); +inherits(View, BaseObject); /** * Set up the view with the given options. * @param {olx.ViewOptions} options View options. */ -_ol_View_.prototype.applyOptions_ = function(options) { +View.prototype.applyOptions_ = function(options) { /** * @type {Object.} */ var properties = {}; - properties[_ol_ViewProperty_.CENTER] = options.center !== undefined ? + properties[ViewProperty.CENTER] = options.center !== undefined ? options.center : null; - var resolutionConstraintInfo = _ol_View_.createResolutionConstraint_( + var resolutionConstraintInfo = View.createResolutionConstraint_( options); /** @@ -170,9 +170,9 @@ _ol_View_.prototype.applyOptions_ = function(options) { */ this.minZoom_ = resolutionConstraintInfo.minZoom; - var centerConstraint = _ol_View_.createCenterConstraint_(options); + var centerConstraint = View.createCenterConstraint_(options); var resolutionConstraint = resolutionConstraintInfo.constraint; - var rotationConstraint = _ol_View_.createRotationConstraint_(options); + var rotationConstraint = View.createRotationConstraint_(options); /** * @private @@ -185,18 +185,18 @@ _ol_View_.prototype.applyOptions_ = function(options) { }; if (options.resolution !== undefined) { - properties[_ol_ViewProperty_.RESOLUTION] = options.resolution; + properties[ViewProperty.RESOLUTION] = options.resolution; } else if (options.zoom !== undefined) { - properties[_ol_ViewProperty_.RESOLUTION] = this.constrainResolution( + properties[ViewProperty.RESOLUTION] = this.constrainResolution( this.maxResolution_, options.zoom - this.minZoom_); if (this.resolutions_) { // in case map zoom is out of min/max zoom range - properties[_ol_ViewProperty_.RESOLUTION] = clamp( - Number(this.getResolution() || properties[_ol_ViewProperty_.RESOLUTION]), + properties[ViewProperty.RESOLUTION] = clamp( + Number(this.getResolution() || properties[ViewProperty.RESOLUTION]), this.minResolution_, this.maxResolution_); } } - properties[_ol_ViewProperty_.ROTATION] = + properties[ViewProperty.ROTATION] = options.rotation !== undefined ? options.rotation : 0; this.setProperties(properties); @@ -216,7 +216,7 @@ _ol_View_.prototype.applyOptions_ = function(options) { * @param {olx.ViewOptions} newOptions New options to be applied. * @return {olx.ViewOptions} New options updated with the current view state. */ -_ol_View_.prototype.getUpdatedOptions_ = function(newOptions) { +View.prototype.getUpdatedOptions_ = function(newOptions) { var options = _ol_obj_.assign({}, this.options_); // preserve resolution (or zoom) @@ -269,7 +269,7 @@ _ol_View_.prototype.getUpdatedOptions_ = function(newOptions) { * the animation completed without being cancelled. * @api */ -_ol_View_.prototype.animate = function(var_args) { +View.prototype.animate = function(var_args) { var animationCount = arguments.length; var callback; if (animationCount > 1 && typeof arguments[animationCount - 1] === 'function') { @@ -336,7 +336,7 @@ _ol_View_.prototype.animate = function(var_args) { animation.callback = callback; // check if animation is a no-op - if (_ol_View_.isNoopAnimation(animation)) { + if (View.isNoopAnimation(animation)) { animation.complete = true; // we still push it onto the series for callback handling } else { @@ -345,7 +345,7 @@ _ol_View_.prototype.animate = function(var_args) { series.push(animation); } this.animations_.push(series); - this.setHint(_ol_ViewHint_.ANIMATING, 1); + this.setHint(ViewHint.ANIMATING, 1); this.updateAnimations_(); }; @@ -355,8 +355,8 @@ _ol_View_.prototype.animate = function(var_args) { * @return {boolean} The view is being animated. * @api */ -_ol_View_.prototype.getAnimating = function() { - return this.hints_[_ol_ViewHint_.ANIMATING] > 0; +View.prototype.getAnimating = function() { + return this.hints_[ViewHint.ANIMATING] > 0; }; @@ -365,8 +365,8 @@ _ol_View_.prototype.getAnimating = function() { * @return {boolean} The view is being interacted with. * @api */ -_ol_View_.prototype.getInteracting = function() { - return this.hints_[_ol_ViewHint_.INTERACTING] > 0; +View.prototype.getInteracting = function() { + return this.hints_[ViewHint.INTERACTING] > 0; }; @@ -374,8 +374,8 @@ _ol_View_.prototype.getInteracting = function() { * Cancel any ongoing animations. * @api */ -_ol_View_.prototype.cancelAnimations = function() { - this.setHint(_ol_ViewHint_.ANIMATING, -this.hints_[_ol_ViewHint_.ANIMATING]); +View.prototype.cancelAnimations = function() { + this.setHint(ViewHint.ANIMATING, -this.hints_[ViewHint.ANIMATING]); for (var i = 0, ii = this.animations_.length; i < ii; ++i) { var series = this.animations_[i]; if (series[0].callback) { @@ -388,7 +388,7 @@ _ol_View_.prototype.cancelAnimations = function() { /** * Update all animations. */ -_ol_View_.prototype.updateAnimations_ = function() { +View.prototype.updateAnimations_ = function() { if (this.updateAnimationKey_ !== undefined) { cancelAnimationFrame(this.updateAnimationKey_); this.updateAnimationKey_ = undefined; @@ -422,27 +422,27 @@ _ol_View_.prototype.updateAnimations_ = function() { var y1 = animation.targetCenter[1]; var x = x0 + progress * (x1 - x0); var y = y0 + progress * (y1 - y0); - this.set(_ol_ViewProperty_.CENTER, [x, y]); + this.set(ViewProperty.CENTER, [x, y]); } if (animation.sourceResolution && animation.targetResolution) { var resolution = progress === 1 ? animation.targetResolution : animation.sourceResolution + progress * (animation.targetResolution - animation.sourceResolution); if (animation.anchor) { - this.set(_ol_ViewProperty_.CENTER, + this.set(ViewProperty.CENTER, this.calculateCenterZoom(resolution, animation.anchor)); } - this.set(_ol_ViewProperty_.RESOLUTION, resolution); + this.set(ViewProperty.RESOLUTION, resolution); } if (animation.sourceRotation !== undefined && animation.targetRotation !== undefined) { var rotation = progress === 1 ? modulo(animation.targetRotation + Math.PI, 2 * Math.PI) - Math.PI : animation.sourceRotation + progress * (animation.targetRotation - animation.sourceRotation); if (animation.anchor) { - this.set(_ol_ViewProperty_.CENTER, + this.set(ViewProperty.CENTER, this.calculateCenterRotate(rotation, animation.anchor)); } - this.set(_ol_ViewProperty_.ROTATION, rotation); + this.set(ViewProperty.ROTATION, rotation); } more = true; if (!animation.complete) { @@ -451,7 +451,7 @@ _ol_View_.prototype.updateAnimations_ = function() { } if (seriesComplete) { this.animations_[i] = null; - this.setHint(_ol_ViewHint_.ANIMATING, -1); + this.setHint(ViewHint.ANIMATING, -1); var callback = series[0].callback; if (callback) { callback(true); @@ -470,7 +470,7 @@ _ol_View_.prototype.updateAnimations_ = function() { * @param {ol.Coordinate} anchor Rotation anchor. * @return {ol.Coordinate|undefined} Center for rotation and anchor. */ -_ol_View_.prototype.calculateCenterRotate = function(rotation, anchor) { +View.prototype.calculateCenterRotate = function(rotation, anchor) { var center; var currentCenter = this.getCenter(); if (currentCenter !== undefined) { @@ -487,7 +487,7 @@ _ol_View_.prototype.calculateCenterRotate = function(rotation, anchor) { * @param {ol.Coordinate} anchor Zoom anchor. * @return {ol.Coordinate|undefined} Center for resolution and anchor. */ -_ol_View_.prototype.calculateCenterZoom = function(resolution, anchor) { +View.prototype.calculateCenterZoom = function(resolution, anchor) { var center; var currentCenter = this.getCenter(); var currentResolution = this.getResolution(); @@ -506,7 +506,7 @@ _ol_View_.prototype.calculateCenterZoom = function(resolution, anchor) { * @private * @return {ol.Size} Viewport size or `[100, 100]` when no viewport is found. */ -_ol_View_.prototype.getSizeFromViewport_ = function() { +View.prototype.getSizeFromViewport_ = function() { var size = [100, 100]; var selector = '.ol-viewport[data-view="' + getUid(this) + '"]'; var element = document.querySelector(selector); @@ -525,7 +525,7 @@ _ol_View_.prototype.getSizeFromViewport_ = function() { * @return {ol.Coordinate|undefined} Constrained center. * @api */ -_ol_View_.prototype.constrainCenter = function(center) { +View.prototype.constrainCenter = function(center) { return this.constraints_.center(center); }; @@ -538,7 +538,7 @@ _ol_View_.prototype.constrainCenter = function(center) { * @return {number|undefined} Constrained resolution. * @api */ -_ol_View_.prototype.constrainResolution = function( +View.prototype.constrainResolution = function( resolution, opt_delta, opt_direction) { var delta = opt_delta || 0; var direction = opt_direction || 0; @@ -553,7 +553,7 @@ _ol_View_.prototype.constrainResolution = function( * @return {number|undefined} Constrained rotation. * @api */ -_ol_View_.prototype.constrainRotation = function(rotation, opt_delta) { +View.prototype.constrainRotation = function(rotation, opt_delta) { var delta = opt_delta || 0; return this.constraints_.rotation(rotation, delta); }; @@ -565,9 +565,9 @@ _ol_View_.prototype.constrainRotation = function(rotation, opt_delta) { * @observable * @api */ -_ol_View_.prototype.getCenter = function() { +View.prototype.getCenter = function() { return ( - /** @type {ol.Coordinate|undefined} */ this.get(_ol_ViewProperty_.CENTER) + /** @type {ol.Coordinate|undefined} */ this.get(ViewProperty.CENTER) ); }; @@ -575,7 +575,7 @@ _ol_View_.prototype.getCenter = function() { /** * @return {ol.Constraints} Constraints. */ -_ol_View_.prototype.getConstraints = function() { +View.prototype.getConstraints = function() { return this.constraints_; }; @@ -584,7 +584,7 @@ _ol_View_.prototype.getConstraints = function() { * @param {Array.=} opt_hints Destination array. * @return {Array.} Hint. */ -_ol_View_.prototype.getHints = function(opt_hints) { +View.prototype.getHints = function(opt_hints) { if (opt_hints !== undefined) { opt_hints[0] = this.hints_[0]; opt_hints[1] = this.hints_[1]; @@ -605,7 +605,7 @@ _ol_View_.prototype.getHints = function(opt_hints) { * @return {ol.Extent} Extent. * @api */ -_ol_View_.prototype.calculateExtent = function(opt_size) { +View.prototype.calculateExtent = function(opt_size) { var size = opt_size || this.getSizeFromViewport_(); var center = /** @type {!ol.Coordinate} */ (this.getCenter()); assert(center, 1); // The view center is not defined @@ -623,7 +623,7 @@ _ol_View_.prototype.calculateExtent = function(opt_size) { * @return {number} The maximum resolution of the view. * @api */ -_ol_View_.prototype.getMaxResolution = function() { +View.prototype.getMaxResolution = function() { return this.maxResolution_; }; @@ -633,7 +633,7 @@ _ol_View_.prototype.getMaxResolution = function() { * @return {number} The minimum resolution of the view. * @api */ -_ol_View_.prototype.getMinResolution = function() { +View.prototype.getMinResolution = function() { return this.minResolution_; }; @@ -643,7 +643,7 @@ _ol_View_.prototype.getMinResolution = function() { * @return {number} The maximum zoom level. * @api */ -_ol_View_.prototype.getMaxZoom = function() { +View.prototype.getMaxZoom = function() { return /** @type {number} */ (this.getZoomForResolution(this.minResolution_)); }; @@ -653,7 +653,7 @@ _ol_View_.prototype.getMaxZoom = function() { * @param {number} zoom The maximum zoom level. * @api */ -_ol_View_.prototype.setMaxZoom = function(zoom) { +View.prototype.setMaxZoom = function(zoom) { this.applyOptions_(this.getUpdatedOptions_({maxZoom: zoom})); }; @@ -663,7 +663,7 @@ _ol_View_.prototype.setMaxZoom = function(zoom) { * @return {number} The minimum zoom level. * @api */ -_ol_View_.prototype.getMinZoom = function() { +View.prototype.getMinZoom = function() { return /** @type {number} */ (this.getZoomForResolution(this.maxResolution_)); }; @@ -673,7 +673,7 @@ _ol_View_.prototype.getMinZoom = function() { * @param {number} zoom The minimum zoom level. * @api */ -_ol_View_.prototype.setMinZoom = function(zoom) { +View.prototype.setMinZoom = function(zoom) { this.applyOptions_(this.getUpdatedOptions_({minZoom: zoom})); }; @@ -683,7 +683,7 @@ _ol_View_.prototype.setMinZoom = function(zoom) { * @return {ol.proj.Projection} The projection of the view. * @api */ -_ol_View_.prototype.getProjection = function() { +View.prototype.getProjection = function() { return this.projection_; }; @@ -694,9 +694,9 @@ _ol_View_.prototype.getProjection = function() { * @observable * @api */ -_ol_View_.prototype.getResolution = function() { +View.prototype.getResolution = function() { return ( - /** @type {number|undefined} */ this.get(_ol_ViewProperty_.RESOLUTION) + /** @type {number|undefined} */ this.get(ViewProperty.RESOLUTION) ); }; @@ -707,7 +707,7 @@ _ol_View_.prototype.getResolution = function() { * @return {Array.|undefined} The resolutions of the view. * @api */ -_ol_View_.prototype.getResolutions = function() { +View.prototype.getResolutions = function() { return this.resolutions_; }; @@ -720,7 +720,7 @@ _ol_View_.prototype.getResolutions = function() { * the given size. * @api */ -_ol_View_.prototype.getResolutionForExtent = function(extent, opt_size) { +View.prototype.getResolutionForExtent = function(extent, opt_size) { var size = opt_size || this.getSizeFromViewport_(); var xResolution = getWidth(extent) / size[0]; var yResolution = getHeight(extent) / size[1]; @@ -734,7 +734,7 @@ _ol_View_.prototype.getResolutionForExtent = function(extent, opt_size) { * @param {number=} opt_power Power. * @return {function(number): number} Resolution for value function. */ -_ol_View_.prototype.getResolutionForValueFunction = function(opt_power) { +View.prototype.getResolutionForValueFunction = function(opt_power) { var power = opt_power || 2; var maxResolution = this.maxResolution_; var minResolution = this.minResolution_; @@ -757,9 +757,9 @@ _ol_View_.prototype.getResolutionForValueFunction = function(opt_power) { * @observable * @api */ -_ol_View_.prototype.getRotation = function() { +View.prototype.getRotation = function() { return ( - /** @type {number} */ this.get(_ol_ViewProperty_.ROTATION) + /** @type {number} */ this.get(ViewProperty.ROTATION) ); }; @@ -770,7 +770,7 @@ _ol_View_.prototype.getRotation = function() { * @param {number=} opt_power Power. * @return {function(number): number} Value for resolution function. */ -_ol_View_.prototype.getValueForResolutionFunction = function(opt_power) { +View.prototype.getValueForResolutionFunction = function(opt_power) { var power = opt_power || 2; var maxResolution = this.maxResolution_; var minResolution = this.minResolution_; @@ -791,7 +791,7 @@ _ol_View_.prototype.getValueForResolutionFunction = function(opt_power) { /** * @return {olx.ViewState} View state. */ -_ol_View_.prototype.getState = function() { +View.prototype.getState = function() { var center = /** @type {ol.Coordinate} */ (this.getCenter()); var projection = this.getProjection(); var resolution = /** @type {number} */ (this.getResolution()); @@ -813,7 +813,7 @@ _ol_View_.prototype.getState = function() { * @return {number|undefined} Zoom. * @api */ -_ol_View_.prototype.getZoom = function() { +View.prototype.getZoom = function() { var zoom; var resolution = this.getResolution(); if (resolution !== undefined) { @@ -829,7 +829,7 @@ _ol_View_.prototype.getZoom = function() { * @return {number|undefined} The zoom level for the provided resolution. * @api */ -_ol_View_.prototype.getZoomForResolution = function(resolution) { +View.prototype.getZoomForResolution = function(resolution) { var offset = this.minZoom_ || 0; var max, zoomFactor; if (this.resolutions_) { @@ -855,7 +855,7 @@ _ol_View_.prototype.getZoomForResolution = function(resolution) { * @return {number} The view resolution for the provided zoom level. * @api */ -_ol_View_.prototype.getResolutionForZoom = function(zoom) { +View.prototype.getResolutionForZoom = function(zoom) { return /** @type {number} */ (this.constrainResolution( this.maxResolution_, zoom - this.minZoom_, 0)); }; @@ -871,7 +871,7 @@ _ol_View_.prototype.getResolutionForZoom = function(zoom) { * @param {olx.view.FitOptions=} opt_options Options. * @api */ -_ol_View_.prototype.fit = function(geometryOrExtent, opt_options) { +View.prototype.fit = function(geometryOrExtent, opt_options) { var options = opt_options || {}; var size = options.size; if (!size) { @@ -974,7 +974,7 @@ _ol_View_.prototype.fit = function(geometryOrExtent, opt_options) { * @param {ol.Pixel} position Position on the view to center on. * @api */ -_ol_View_.prototype.centerOn = function(coordinate, size, position) { +View.prototype.centerOn = function(coordinate, size, position) { // calculate rotated position var rotation = this.getRotation(); var cosAngle = Math.cos(-rotation); @@ -997,7 +997,7 @@ _ol_View_.prototype.centerOn = function(coordinate, size, position) { /** * @return {boolean} Is defined. */ -_ol_View_.prototype.isDef = function() { +View.prototype.isDef = function() { return !!this.getCenter() && this.getResolution() !== undefined; }; @@ -1008,7 +1008,7 @@ _ol_View_.prototype.isDef = function() { * @param {ol.Coordinate=} opt_anchor The rotation center. * @api */ -_ol_View_.prototype.rotate = function(rotation, opt_anchor) { +View.prototype.rotate = function(rotation, opt_anchor) { if (opt_anchor !== undefined) { var center = this.calculateCenterRotate(rotation, opt_anchor); this.setCenter(center); @@ -1023,8 +1023,8 @@ _ol_View_.prototype.rotate = function(rotation, opt_anchor) { * @observable * @api */ -_ol_View_.prototype.setCenter = function(center) { - this.set(_ol_ViewProperty_.CENTER, center); +View.prototype.setCenter = function(center) { + this.set(ViewProperty.CENTER, center); if (this.getAnimating()) { this.cancelAnimations(); } @@ -1036,7 +1036,7 @@ _ol_View_.prototype.setCenter = function(center) { * @param {number} delta Delta. * @return {number} New value. */ -_ol_View_.prototype.setHint = function(hint, delta) { +View.prototype.setHint = function(hint, delta) { this.hints_[hint] += delta; this.changed(); return this.hints_[hint]; @@ -1049,8 +1049,8 @@ _ol_View_.prototype.setHint = function(hint, delta) { * @observable * @api */ -_ol_View_.prototype.setResolution = function(resolution) { - this.set(_ol_ViewProperty_.RESOLUTION, resolution); +View.prototype.setResolution = function(resolution) { + this.set(ViewProperty.RESOLUTION, resolution); if (this.getAnimating()) { this.cancelAnimations(); } @@ -1063,8 +1063,8 @@ _ol_View_.prototype.setResolution = function(resolution) { * @observable * @api */ -_ol_View_.prototype.setRotation = function(rotation) { - this.set(_ol_ViewProperty_.ROTATION, rotation); +View.prototype.setRotation = function(rotation) { + this.set(ViewProperty.ROTATION, rotation); if (this.getAnimating()) { this.cancelAnimations(); } @@ -1076,7 +1076,7 @@ _ol_View_.prototype.setRotation = function(rotation) { * @param {number} zoom Zoom level. * @api */ -_ol_View_.prototype.setZoom = function(zoom) { +View.prototype.setZoom = function(zoom) { this.setResolution(this.getResolutionForZoom(zoom)); }; @@ -1086,11 +1086,11 @@ _ol_View_.prototype.setZoom = function(zoom) { * @private * @return {ol.CenterConstraintType} The constraint. */ -_ol_View_.createCenterConstraint_ = function(options) { +View.createCenterConstraint_ = function(options) { if (options.extent !== undefined) { - return _ol_CenterConstraint_.createExtent(options.extent); + return CenterConstraint.createExtent(options.extent); } else { - return _ol_CenterConstraint_.none; + return CenterConstraint.none; } }; @@ -1101,7 +1101,7 @@ _ol_View_.createCenterConstraint_ = function(options) { * @return {{constraint: ol.ResolutionConstraintType, maxResolution: number, * minResolution: number, zoomFactor: number}} The constraint. */ -_ol_View_.createResolutionConstraint_ = function(options) { +View.createResolutionConstraint_ = function(options) { var resolutionConstraint; var maxResolution; var minResolution; @@ -1125,7 +1125,7 @@ _ol_View_.createResolutionConstraint_ = function(options) { maxResolution = resolutions[minZoom]; minResolution = resolutions[maxZoom] !== undefined ? resolutions[maxZoom] : resolutions[resolutions.length - 1]; - resolutionConstraint = _ol_ResolutionConstraint_.createSnapToResolutions( + resolutionConstraint = ResolutionConstraint.createSnapToResolutions( resolutions); } else { // calculate the default min and max resolution @@ -1133,7 +1133,7 @@ _ol_View_.createResolutionConstraint_ = function(options) { var extent = projection.getExtent(); var size = !extent ? // use an extent that can fit the whole world if need be - 360 * METERS_PER_UNIT[_ol_proj_Units_.DEGREES] / + 360 * METERS_PER_UNIT[Units.DEGREES] / projection.getMetersPerUnit() : Math.max(getWidth(extent), getHeight(extent)); @@ -1170,7 +1170,7 @@ _ol_View_.createResolutionConstraint_ = function(options) { Math.log(maxResolution / minResolution) / Math.log(zoomFactor)); minResolution = maxResolution / Math.pow(zoomFactor, maxZoom - minZoom); - resolutionConstraint = _ol_ResolutionConstraint_.createSnapToPower( + resolutionConstraint = ResolutionConstraint.createSnapToPower( zoomFactor, maxResolution, maxZoom - minZoom); } return {constraint: resolutionConstraint, maxResolution: maxResolution, @@ -1183,22 +1183,22 @@ _ol_View_.createResolutionConstraint_ = function(options) { * @param {olx.ViewOptions} options View options. * @return {ol.RotationConstraintType} Rotation constraint. */ -_ol_View_.createRotationConstraint_ = function(options) { +View.createRotationConstraint_ = function(options) { var enableRotation = options.enableRotation !== undefined ? options.enableRotation : true; if (enableRotation) { var constrainRotation = options.constrainRotation; if (constrainRotation === undefined || constrainRotation === true) { - return _ol_RotationConstraint_.createSnapToZero(); + return RotationConstraint.createSnapToZero(); } else if (constrainRotation === false) { - return _ol_RotationConstraint_.none; + return RotationConstraint.none; } else if (typeof constrainRotation === 'number') { - return _ol_RotationConstraint_.createSnapToN(constrainRotation); + return RotationConstraint.createSnapToN(constrainRotation); } else { - return _ol_RotationConstraint_.none; + return RotationConstraint.none; } } else { - return _ol_RotationConstraint_.disable; + return RotationConstraint.disable; } }; @@ -1208,7 +1208,7 @@ _ol_View_.createRotationConstraint_ = function(options) { * @param {ol.ViewAnimation} animation The animation. * @return {boolean} The animation involves no view change. */ -_ol_View_.isNoopAnimation = function(animation) { +View.isNoopAnimation = function(animation) { if (animation.sourceCenter && animation.targetCenter) { if (!_ol_coordinate_.equals(animation.sourceCenter, animation.targetCenter)) { return false; @@ -1222,4 +1222,4 @@ _ol_View_.isNoopAnimation = function(animation) { } return true; }; -export default _ol_View_; +export default View; diff --git a/src/ol/control/Control.js b/src/ol/control/Control.js index f0f12a75cc..91a8f5f19b 100644 --- a/src/ol/control/Control.js +++ b/src/ol/control/Control.js @@ -3,7 +3,7 @@ */ import {inherits, nullFunction} from '../index.js'; import MapEventType from '../MapEventType.js'; -import _ol_Object_ from '../Object.js'; +import BaseObject from '../Object.js'; import {removeNode} from '../dom.js'; import _ol_events_ from '../events.js'; @@ -38,7 +38,7 @@ import _ol_events_ from '../events.js'; */ var Control = function(options) { - _ol_Object_.call(this); + BaseObject.call(this); /** * @protected @@ -75,7 +75,7 @@ var Control = function(options) { }; -inherits(Control, _ol_Object_); +inherits(Control, BaseObject); /** @@ -83,7 +83,7 @@ inherits(Control, _ol_Object_); */ Control.prototype.disposeInternal = function() { removeNode(this.element); - _ol_Object_.prototype.disposeInternal.call(this); + BaseObject.prototype.disposeInternal.call(this); }; diff --git a/src/ol/control/MousePosition.js b/src/ol/control/MousePosition.js index 7af5613569..a30823b51d 100644 --- a/src/ol/control/MousePosition.js +++ b/src/ol/control/MousePosition.js @@ -5,7 +5,7 @@ import {inherits} from '../index.js'; import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; -import _ol_Object_ from '../Object.js'; +import BaseObject from '../Object.js'; import Control from '../control/Control.js'; import {getTransformFromProjections, identityTransform, get as getProjection} from '../proj.js'; @@ -39,7 +39,7 @@ var MousePosition = function(opt_options) { }); _ol_events_.listen(this, - _ol_Object_.getChangeEventType(MousePosition.Property_.PROJECTION), + BaseObject.getChangeEventType(MousePosition.Property_.PROJECTION), this.handleProjectionChanged_, this); if (options.coordinateFormat) { diff --git a/src/ol/control/OverviewMap.js b/src/ol/control/OverviewMap.js index d0cd21ba29..53dbaec378 100644 --- a/src/ol/control/OverviewMap.js +++ b/src/ol/control/OverviewMap.js @@ -6,11 +6,11 @@ import _ol_Collection_ from '../Collection.js'; import PluggableMap from '../PluggableMap.js'; import MapEventType from '../MapEventType.js'; import _ol_MapProperty_ from '../MapProperty.js'; -import _ol_Object_ from '../Object.js'; +import BaseObject from '../Object.js'; import ObjectEventType from '../ObjectEventType.js'; import Overlay from '../Overlay.js'; import OverlayPositioning from '../OverlayPositioning.js'; -import _ol_ViewProperty_ from '../ViewProperty.js'; +import ViewProperty from '../ViewProperty.js'; import Control from '../control/Control.js'; import _ol_coordinate_ from '../coordinate.js'; import {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js'; @@ -270,7 +270,7 @@ OverviewMap.prototype.handleMapPropertyChange_ = function(event) { */ OverviewMap.prototype.bindView_ = function(view) { _ol_events_.listen(view, - _ol_Object_.getChangeEventType(_ol_ViewProperty_.ROTATION), + BaseObject.getChangeEventType(ViewProperty.ROTATION), this.handleRotationChanged_, this); }; @@ -282,7 +282,7 @@ OverviewMap.prototype.bindView_ = function(view) { */ OverviewMap.prototype.unbindView_ = function(view) { _ol_events_.unlisten(view, - _ol_Object_.getChangeEventType(_ol_ViewProperty_.ROTATION), + BaseObject.getChangeEventType(ViewProperty.ROTATION), this.handleRotationChanged_, this); }; diff --git a/src/ol/control/ScaleLine.js b/src/ol/control/ScaleLine.js index 8b2f57fa82..621f2f933b 100644 --- a/src/ol/control/ScaleLine.js +++ b/src/ol/control/ScaleLine.js @@ -2,14 +2,14 @@ * @module ol/control/ScaleLine */ import {inherits} from '../index.js'; -import _ol_Object_ from '../Object.js'; +import BaseObject from '../Object.js'; import {assert} from '../asserts.js'; import Control from '../control/Control.js'; import ScaleLineUnits from '../control/ScaleLineUnits.js'; import {CLASS_UNSELECTABLE} from '../css.js'; import _ol_events_ from '../events.js'; import {getPointResolution, METERS_PER_UNIT} from '../proj.js'; -import _ol_proj_Units_ from '../proj/Units.js'; +import Units from '../proj/Units.js'; /** * @classdesc @@ -86,7 +86,7 @@ var ScaleLine = function(opt_options) { }); _ol_events_.listen( - this, _ol_Object_.getChangeEventType(ScaleLine.Property_.UNITS), + this, BaseObject.getChangeEventType(ScaleLine.Property_.UNITS), this.handleUnitsChanged_, this); this.setUnits(/** @type {ol.control.ScaleLineUnits} */ (options.units) || @@ -172,8 +172,8 @@ ScaleLine.prototype.updateElement_ = function() { var projection = viewState.projection; var units = this.getUnits(); var pointResolutionUnits = units == ScaleLineUnits.DEGREES ? - _ol_proj_Units_.DEGREES : - _ol_proj_Units_.METERS; + Units.DEGREES : + Units.METERS; var pointResolution = getPointResolution(projection, viewState.resolution, center, pointResolutionUnits); if (units != ScaleLineUnits.DEGREES) { @@ -183,8 +183,8 @@ ScaleLine.prototype.updateElement_ = function() { var nominalCount = this.minWidth_ * pointResolution; var suffix = ''; if (units == ScaleLineUnits.DEGREES) { - var metersPerDegree = METERS_PER_UNIT[_ol_proj_Units_.DEGREES]; - if (projection.getUnits() == _ol_proj_Units_.DEGREES) { + var metersPerDegree = METERS_PER_UNIT[Units.DEGREES]; + if (projection.getUnits() == Units.DEGREES) { nominalCount *= metersPerDegree; } else { pointResolution /= metersPerDegree; diff --git a/src/ol/control/ZoomSlider.js b/src/ol/control/ZoomSlider.js index fb95d51492..75845b816f 100644 --- a/src/ol/control/ZoomSlider.js +++ b/src/ol/control/ZoomSlider.js @@ -4,7 +4,7 @@ // FIXME should possibly show tooltip when dragging? import {inherits} from '../index.js'; -import _ol_ViewHint_ from '../ViewHint.js'; +import ViewHint from '../ViewHint.js'; import Control from '../control/Control.js'; import {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js'; import {easeOut} from '../easing.js'; @@ -251,7 +251,7 @@ ZoomSlider.prototype.handleContainerClick_ = function(event) { */ ZoomSlider.prototype.handleDraggerStart_ = function(event) { if (!this.dragging_ && event.originalEvent.target === this.element.firstElementChild) { - this.getMap().getView().setHint(_ol_ViewHint_.INTERACTING, 1); + this.getMap().getView().setHint(ViewHint.INTERACTING, 1); this.previousX_ = event.clientX; this.previousY_ = event.clientY; this.dragging_ = true; @@ -288,7 +288,7 @@ ZoomSlider.prototype.handleDraggerDrag_ = function(event) { ZoomSlider.prototype.handleDraggerEnd_ = function(event) { if (this.dragging_) { var view = this.getMap().getView(); - view.setHint(_ol_ViewHint_.INTERACTING, -1); + view.setHint(ViewHint.INTERACTING, -1); view.animate({ resolution: view.constrainResolution(this.currentResolution_), diff --git a/src/ol/format/EsriJSON.js b/src/ol/format/EsriJSON.js index 5be3ad888d..60705ec6af 100644 --- a/src/ol/format/EsriJSON.js +++ b/src/ol/format/EsriJSON.js @@ -2,7 +2,7 @@ * @module ol/format/EsriJSON */ import {inherits} from '../index.js'; -import _ol_Feature_ from '../Feature.js'; +import Feature from '../Feature.js'; import {assert} from '../asserts.js'; import {containsExtent} from '../extent.js'; import {transformWithOptions} from '../format/Feature.js'; @@ -464,7 +464,7 @@ EsriJSON.prototype.readFeatureFromObject = function( var esriJSONFeature = /** @type {EsriJSONFeature} */ (object); var geometry = EsriJSON.readGeometry_(esriJSONFeature.geometry, opt_options); - var feature = new _ol_Feature_(); + var feature = new Feature(); if (this.geometryName_) { feature.setGeometryName(this.geometryName_); } diff --git a/src/ol/format/GMLBase.js b/src/ol/format/GMLBase.js index 85437c0868..bd7bcdec2a 100644 --- a/src/ol/format/GMLBase.js +++ b/src/ol/format/GMLBase.js @@ -6,7 +6,7 @@ // envelopes/extents, only geometries! import {inherits} from '../index.js'; import {extend} from '../array.js'; -import _ol_Feature_ from '../Feature.js'; +import Feature from '../Feature.js'; import {transformWithOptions} from '../format/Feature.js'; import XMLFeature from '../format/XMLFeature.js'; import GeometryLayout from '../geom/GeometryLayout.js'; @@ -244,7 +244,7 @@ GMLBase.prototype.readFeatureElement = function(node, objectStack) { values[localName] = this.readGeometryElement(n, objectStack); } } - var feature = new _ol_Feature_(values); + var feature = new Feature(values); if (geometryName) { feature.setGeometryName(geometryName); } diff --git a/src/ol/format/GPX.js b/src/ol/format/GPX.js index 13a419e3b8..134d301e6f 100644 --- a/src/ol/format/GPX.js +++ b/src/ol/format/GPX.js @@ -2,7 +2,7 @@ * @module ol/format/GPX */ import {inherits} from '../index.js'; -import _ol_Feature_ from '../Feature.js'; +import Feature from '../Feature.js'; import {includes} from '../array.js'; import {transformWithOptions} from '../format/Feature.js'; import XMLFeature from '../format/XMLFeature.js'; @@ -542,7 +542,7 @@ function readRte(node, objectStack) { var geometry = new LineString(null); geometry.setFlatCoordinates(layout, flatCoordinates); transformWithOptions(geometry, false, options); - var feature = new _ol_Feature_(geometry); + var feature = new Feature(geometry); feature.setProperties(values); return feature; } @@ -574,7 +574,7 @@ function readTrk(node, objectStack) { var geometry = new MultiLineString(null); geometry.setFlatCoordinates(layout, flatCoordinates, ends); transformWithOptions(geometry, false, options); - var feature = new _ol_Feature_(geometry); + var feature = new Feature(geometry); feature.setProperties(values); return feature; } @@ -596,7 +596,7 @@ function readWpt(node, objectStack) { var layout = GPX.applyLayoutOptions_(layoutOptions, coordinates); var geometry = new Point(coordinates, layout); transformWithOptions(geometry, false, options); - var feature = new _ol_Feature_(geometry); + var feature = new Feature(geometry); feature.setProperties(values); return feature; } diff --git a/src/ol/format/GeoJSON.js b/src/ol/format/GeoJSON.js index c209f82db2..fd2a73028f 100644 --- a/src/ol/format/GeoJSON.js +++ b/src/ol/format/GeoJSON.js @@ -6,7 +6,7 @@ import {inherits} from '../index.js'; import {assert} from '../asserts.js'; -import _ol_Feature_ from '../Feature.js'; +import Feature from '../Feature.js'; import {transformWithOptions} from '../format/Feature.js'; import JSONFeature from '../format/JSONFeature.js'; import GeometryCollection from '../geom/GeometryCollection.js'; @@ -360,7 +360,7 @@ GeoJSON.prototype.readFeatureFromObject = function(object, opt_options) { } var geometry = readGeometry(geoJSONFeature.geometry, opt_options); - var feature = new _ol_Feature_(); + var feature = new Feature(); if (this.geometryName_) { feature.setGeometryName(this.geometryName_); } else if (this.extractGeometryName_ && geoJSONFeature.geometry_name !== undefined) { diff --git a/src/ol/format/IGC.js b/src/ol/format/IGC.js index a8c46e94c3..8a6f1bb542 100644 --- a/src/ol/format/IGC.js +++ b/src/ol/format/IGC.js @@ -2,7 +2,7 @@ * @module ol/format/IGC */ import {inherits} from '../index.js'; -import _ol_Feature_ from '../Feature.js'; +import Feature from '../Feature.js'; import {transformWithOptions} from '../format/Feature.js'; import TextFeature from '../format/TextFeature.js'; import GeometryLayout from '../geom/GeometryLayout.js'; @@ -163,7 +163,7 @@ IGC.prototype.readFeatureFromText = function(text, opt_options) { var lineString = new LineString(null); var layout = altitudeMode == IGCZ.NONE ? GeometryLayout.XYM : GeometryLayout.XYZM; lineString.setFlatCoordinates(layout, flatCoordinates); - var feature = new _ol_Feature_(transformWithOptions(lineString, false, opt_options)); + var feature = new Feature(transformWithOptions(lineString, false, opt_options)); feature.setProperties(properties); return feature; }; diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index e4f67db9d3..3fcbf66bc4 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -2,7 +2,7 @@ * @module ol/format/KML */ import {inherits} from '../index.js'; -import _ol_Feature_ from '../Feature.js'; +import Feature from '../Feature.js'; import {extend, includes} from '../array.js'; import {assert} from '../asserts.js'; import {asArray} from '../color.js'; @@ -1700,7 +1700,7 @@ KML.prototype.readPlacemark_ = function(node, objectStack) { if (!object) { return undefined; } - var feature = new _ol_Feature_(); + var feature = new Feature(); var id = node.getAttribute('id'); if (id !== null) { feature.setId(id); diff --git a/src/ol/format/MVT.js b/src/ol/format/MVT.js index 62948b96fa..13322ed856 100644 --- a/src/ol/format/MVT.js +++ b/src/ol/format/MVT.js @@ -18,7 +18,7 @@ import Point from '../geom/Point.js'; import Polygon from '../geom/Polygon.js'; import _ol_geom_flat_orient_ from '../geom/flat/orient.js'; import _ol_proj_Projection_ from '../proj/Projection.js'; -import _ol_proj_Units_ from '../proj/Units.js'; +import Units from '../proj/Units.js'; import _ol_render_Feature_ from '../render/Feature.js'; /** @@ -41,7 +41,7 @@ var MVT = function(opt_options) { */ this.defaultDataProjection = new _ol_proj_Projection_({ code: '', - units: _ol_proj_Units_.TILE_PIXELS + units: Units.TILE_PIXELS }); /** diff --git a/src/ol/format/OSMXML.js b/src/ol/format/OSMXML.js index cefa439486..7fc3e17e42 100644 --- a/src/ol/format/OSMXML.js +++ b/src/ol/format/OSMXML.js @@ -4,7 +4,7 @@ // FIXME add typedef for stack state objects import {inherits} from '../index.js'; import {extend} from '../array.js'; -import _ol_Feature_ from '../Feature.js'; +import Feature from '../Feature.js'; import {transformWithOptions} from '../format/Feature.js'; import XMLFeature from '../format/XMLFeature.js'; import GeometryLayout from '../geom/GeometryLayout.js'; @@ -58,7 +58,7 @@ OSMXML.readNode_ = function(node, objectStack) { if (!_ol_obj_.isEmpty(values.tags)) { var geometry = new Point(coordinates); transformWithOptions(geometry, false, options); - var feature = new _ol_Feature_(geometry); + var feature = new Feature(geometry); feature.setId(id); feature.setProperties(values.tags); state.features.push(feature); @@ -193,7 +193,7 @@ OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) { geometry.setFlatCoordinates(GeometryLayout.XY, flatCoordinates); } transformWithOptions(geometry, false, options); - var feature = new _ol_Feature_(geometry); + var feature = new Feature(geometry); feature.setId(values.id); feature.setProperties(values.tags); state.features.push(feature); diff --git a/src/ol/format/Polyline.js b/src/ol/format/Polyline.js index b7f7d51e60..253a8c2275 100644 --- a/src/ol/format/Polyline.js +++ b/src/ol/format/Polyline.js @@ -3,7 +3,7 @@ */ import {inherits} from '../index.js'; import {assert} from '../asserts.js'; -import _ol_Feature_ from '../Feature.js'; +import Feature from '../Feature.js'; import {transformWithOptions} from '../format/Feature.js'; import TextFeature from '../format/TextFeature.js'; import GeometryLayout from '../geom/GeometryLayout.js'; @@ -282,7 +282,7 @@ Polyline.prototype.readFeature; */ Polyline.prototype.readFeatureFromText = function(text, opt_options) { var geometry = this.readGeometryFromText(text, opt_options); - return new _ol_Feature_(geometry); + return new Feature(geometry); }; diff --git a/src/ol/format/TopoJSON.js b/src/ol/format/TopoJSON.js index fcbcfe807a..ffdf8f6713 100644 --- a/src/ol/format/TopoJSON.js +++ b/src/ol/format/TopoJSON.js @@ -2,7 +2,7 @@ * @module ol/format/TopoJSON */ import {inherits} from '../index.js'; -import _ol_Feature_ from '../Feature.js'; +import Feature from '../Feature.js'; import {transformWithOptions} from '../format/Feature.js'; import JSONFeature from '../format/JSONFeature.js'; import LineString from '../geom/LineString.js'; @@ -260,7 +260,7 @@ function readFeatureFromGeometry(object, arcs, scale, translate, property, name, } else { geometry = geometryReader(object, arcs); } - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setGeometry(/** @type {ol.geom.Geometry} */ ( transformWithOptions(geometry, false, opt_options))); if (object.id !== undefined) { diff --git a/src/ol/format/WKT.js b/src/ol/format/WKT.js index fc5a4b3487..9b91c7f12d 100644 --- a/src/ol/format/WKT.js +++ b/src/ol/format/WKT.js @@ -2,7 +2,7 @@ * @module ol/format/WKT */ import {inherits} from '../index.js'; -import _ol_Feature_ from '../Feature.js'; +import Feature from '../Feature.js'; import {transformWithOptions} from '../format/Feature.js'; import TextFeature from '../format/TextFeature.js'; import GeometryCollection from '../geom/GeometryCollection.js'; @@ -269,7 +269,7 @@ WKT.prototype.readFeature; WKT.prototype.readFeatureFromText = function(text, opt_options) { var geom = this.readGeometryFromText(text, opt_options); if (geom) { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setGeometry(geom); return feature; } @@ -304,7 +304,7 @@ WKT.prototype.readFeaturesFromText = function(text, opt_options) { } var feature, features = []; for (var i = 0, ii = geometries.length; i < ii; ++i) { - feature = new _ol_Feature_(); + feature = new Feature(); feature.setGeometry(geometries[i]); features.push(feature); } diff --git a/src/ol/geom/Geometry.js b/src/ol/geom/Geometry.js index ca6a58f891..00f6e1db12 100644 --- a/src/ol/geom/Geometry.js +++ b/src/ol/geom/Geometry.js @@ -2,12 +2,12 @@ * @module ol/geom/Geometry */ import {inherits} from '../index.js'; -import _ol_Object_ from '../Object.js'; +import BaseObject from '../Object.js'; import {createEmpty, getHeight, returnOrUpdate} from '../extent.js'; import {FALSE} from '../functions.js'; import _ol_geom_flat_transform_ from '../geom/flat/transform.js'; import {get as getProjection, getTransform} from '../proj.js'; -import _ol_proj_Units_ from '../proj/Units.js'; +import Units from '../proj/Units.js'; import _ol_transform_ from '../transform.js'; /** @@ -26,7 +26,7 @@ import _ol_transform_ from '../transform.js'; */ var Geometry = function() { - _ol_Object_.call(this); + BaseObject.call(this); /** * @private @@ -66,7 +66,7 @@ var Geometry = function() { }; -inherits(Geometry, _ol_Object_); +inherits(Geometry, BaseObject); /** @@ -256,7 +256,7 @@ Geometry.prototype.translate = function(deltaX, deltaY) {}; Geometry.prototype.transform = function(source, destination) { var tmpTransform = this.tmpTransform_; source = getProjection(source); - var transformFn = source.getUnits() == _ol_proj_Units_.TILE_PIXELS ? + var transformFn = source.getUnits() == Units.TILE_PIXELS ? function(inCoordinates, outCoordinates, stride) { var pixelExtent = source.getExtent(); var projectedExtent = source.getWorldExtent(); diff --git a/src/ol/interaction/DragPan.js b/src/ol/interaction/DragPan.js index 5faba7c016..97220cc018 100644 --- a/src/ol/interaction/DragPan.js +++ b/src/ol/interaction/DragPan.js @@ -2,7 +2,7 @@ * @module ol/interaction/DragPan */ import {inherits} from '../index.js'; -import _ol_ViewHint_ from '../ViewHint.js'; +import ViewHint from '../ViewHint.js'; import _ol_coordinate_ from '../coordinate.js'; import {easeOut} from '../easing.js'; import _ol_events_condition_ from '../events/condition.js'; @@ -123,7 +123,7 @@ DragPan.handleUpEvent_ = function(mapBrowserEvent) { easing: easeOut }); } - view.setHint(_ol_ViewHint_.INTERACTING, -1); + view.setHint(ViewHint.INTERACTING, -1); return false; } else { if (this.kinetic_) { @@ -149,7 +149,7 @@ DragPan.handleDownEvent_ = function(mapBrowserEvent) { var view = map.getView(); this.lastCentroid = null; if (!this.handlingDownUpSequence) { - view.setHint(_ol_ViewHint_.INTERACTING, 1); + view.setHint(ViewHint.INTERACTING, 1); } // stop any current animation if (view.getAnimating()) { diff --git a/src/ol/interaction/DragRotate.js b/src/ol/interaction/DragRotate.js index bb61e33788..5b78c1d761 100644 --- a/src/ol/interaction/DragRotate.js +++ b/src/ol/interaction/DragRotate.js @@ -2,8 +2,8 @@ * @module ol/interaction/DragRotate */ import {inherits} from '../index.js'; -import _ol_RotationConstraint_ from '../RotationConstraint.js'; -import _ol_ViewHint_ from '../ViewHint.js'; +import RotationConstraint from '../RotationConstraint.js'; +import ViewHint from '../ViewHint.js'; import _ol_events_condition_ from '../events/condition.js'; import {FALSE} from '../functions.js'; import Interaction from '../interaction/Interaction.js'; @@ -67,7 +67,7 @@ DragRotate.handleDragEvent_ = function(mapBrowserEvent) { var map = mapBrowserEvent.map; var view = map.getView(); - if (view.getConstraints().rotation === _ol_RotationConstraint_.disable) { + if (view.getConstraints().rotation === RotationConstraint.disable) { return; } var size = map.getSize(); @@ -97,7 +97,7 @@ DragRotate.handleUpEvent_ = function(mapBrowserEvent) { var map = mapBrowserEvent.map; var view = map.getView(); - view.setHint(_ol_ViewHint_.INTERACTING, -1); + view.setHint(ViewHint.INTERACTING, -1); var rotation = view.getRotation(); Interaction.rotate(view, rotation, undefined, this.duration_); @@ -119,7 +119,7 @@ DragRotate.handleDownEvent_ = function(mapBrowserEvent) { if (_ol_events_condition_.mouseActionButton(mapBrowserEvent) && this.condition_(mapBrowserEvent)) { var map = mapBrowserEvent.map; - map.getView().setHint(_ol_ViewHint_.INTERACTING, 1); + map.getView().setHint(ViewHint.INTERACTING, 1); this.lastAngle_ = undefined; return true; } else { diff --git a/src/ol/interaction/DragRotateAndZoom.js b/src/ol/interaction/DragRotateAndZoom.js index c6917fc43f..8846fd5dfc 100644 --- a/src/ol/interaction/DragRotateAndZoom.js +++ b/src/ol/interaction/DragRotateAndZoom.js @@ -2,8 +2,8 @@ * @module ol/interaction/DragRotateAndZoom */ import {inherits} from '../index.js'; -import _ol_RotationConstraint_ from '../RotationConstraint.js'; -import _ol_ViewHint_ from '../ViewHint.js'; +import RotationConstraint from '../RotationConstraint.js'; +import ViewHint from '../ViewHint.js'; import _ol_events_condition_ from '../events/condition.js'; import Interaction from '../interaction/Interaction.js'; import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; @@ -87,7 +87,7 @@ DragRotateAndZoom.handleDragEvent_ = function(mapBrowserEvent) { var theta = Math.atan2(deltaY, deltaX); var magnitude = Math.sqrt(deltaX * deltaX + deltaY * deltaY); var view = map.getView(); - if (view.getConstraints().rotation !== _ol_RotationConstraint_.disable && this.lastAngle_ !== undefined) { + if (view.getConstraints().rotation !== RotationConstraint.disable && this.lastAngle_ !== undefined) { var angleDelta = theta - this.lastAngle_; Interaction.rotateWithoutConstraints( view, view.getRotation() - angleDelta); @@ -117,7 +117,7 @@ DragRotateAndZoom.handleUpEvent_ = function(mapBrowserEvent) { var map = mapBrowserEvent.map; var view = map.getView(); - view.setHint(_ol_ViewHint_.INTERACTING, -1); + view.setHint(ViewHint.INTERACTING, -1); var direction = this.lastScaleDelta_ - 1; Interaction.rotate(view, view.getRotation()); Interaction.zoom(view, view.getResolution(), @@ -139,7 +139,7 @@ DragRotateAndZoom.handleDownEvent_ = function(mapBrowserEvent) { } if (this.condition_(mapBrowserEvent)) { - mapBrowserEvent.map.getView().setHint(_ol_ViewHint_.INTERACTING, 1); + mapBrowserEvent.map.getView().setHint(ViewHint.INTERACTING, 1); this.lastAngle_ = undefined; this.lastMagnitude_ = undefined; return true; diff --git a/src/ol/interaction/Draw.js b/src/ol/interaction/Draw.js index 4c1addd19a..0c6913eefc 100644 --- a/src/ol/interaction/Draw.js +++ b/src/ol/interaction/Draw.js @@ -2,9 +2,9 @@ * @module ol/interaction/Draw */ import {inherits} from '../index.js'; -import _ol_Feature_ from '../Feature.js'; +import Feature from '../Feature.js'; import MapBrowserEventType from '../MapBrowserEventType.js'; -import _ol_Object_ from '../Object.js'; +import BaseObject from '../Object.js'; import _ol_coordinate_ from '../coordinate.js'; import _ol_events_ from '../events.js'; import Event from '../events/Event.js'; @@ -22,8 +22,8 @@ import Polygon, {fromCircle, makeRegular} from '../geom/Polygon.js'; import DrawEventType from '../interaction/DrawEventType.js'; import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; import _ol_interaction_Property_ from '../interaction/Property.js'; -import _ol_layer_Vector_ from '../layer/Vector.js'; -import _ol_source_Vector_ from '../source/Vector.js'; +import VectorLayer from '../layer/Vector.js'; +import VectorSource from '../source/Vector.js'; import _ol_style_Style_ from '../style/Style.js'; /** @@ -249,8 +249,8 @@ var Draw = function(options) { * @type {ol.layer.Vector} * @private */ - this.overlay_ = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ + this.overlay_ = new VectorLayer({ + source: new VectorSource({ useSpatialIndex: false, wrapX: options.wrapX ? options.wrapX : false }), @@ -285,7 +285,7 @@ var Draw = function(options) { } _ol_events_.listen(this, - _ol_Object_.getChangeEventType(_ol_interaction_Property_.ACTIVE), + BaseObject.getChangeEventType(_ol_interaction_Property_.ACTIVE), this.updateState_, this); }; @@ -481,7 +481,7 @@ Draw.prototype.atFinish_ = function(event) { Draw.prototype.createOrUpdateSketchPoint_ = function(event) { var coordinates = event.coordinate.slice(); if (!this.sketchPoint_) { - this.sketchPoint_ = new _ol_Feature_(new Point(coordinates)); + this.sketchPoint_ = new Feature(new Point(coordinates)); this.updateSketchFeatures_(); } else { var sketchPointGeom = /** @type {ol.geom.Point} */ (this.sketchPoint_.getGeometry()); @@ -510,11 +510,11 @@ Draw.prototype.startDrawing_ = function(event) { } } if (this.sketchLineCoords_) { - this.sketchLine_ = new _ol_Feature_( + this.sketchLine_ = new Feature( new LineString(this.sketchLineCoords_)); } var geometry = this.geometryFunction_(this.sketchCoords_); - this.sketchFeature_ = new _ol_Feature_(); + this.sketchFeature_ = new Feature(); if (this.geometryName_) { this.sketchFeature_.setGeometryName(this.geometryName_); } @@ -557,7 +557,7 @@ Draw.prototype.modifyDrawing_ = function(event) { if (geometry instanceof Polygon && this.mode_ !== Draw.Mode_.POLYGON) { if (!this.sketchLine_) { - this.sketchLine_ = new _ol_Feature_(new LineString(null)); + this.sketchLine_ = new Feature(new LineString(null)); } var ring = geometry.getLinearRing(0); sketchLineGeom = /** @type {ol.geom.LineString} */ (this.sketchLine_.getGeometry()); diff --git a/src/ol/interaction/Extent.js b/src/ol/interaction/Extent.js index bb19804f2c..16a829c766 100644 --- a/src/ol/interaction/Extent.js +++ b/src/ol/interaction/Extent.js @@ -2,7 +2,7 @@ * @module ol/interaction/Extent */ import {inherits} from '../index.js'; -import _ol_Feature_ from '../Feature.js'; +import Feature from '../Feature.js'; import MapBrowserEventType from '../MapBrowserEventType.js'; import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js'; import _ol_coordinate_ from '../coordinate.js'; @@ -13,8 +13,8 @@ import Point from '../geom/Point.js'; import {fromExtent as polygonFromExtent} from '../geom/Polygon.js'; import _ol_interaction_ExtentEventType_ from '../interaction/ExtentEventType.js'; import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; -import _ol_layer_Vector_ from '../layer/Vector.js'; -import _ol_source_Vector_ from '../source/Vector.js'; +import VectorLayer from '../layer/Vector.js'; +import VectorSource from '../source/Vector.js'; import _ol_style_Style_ from '../style/Style.js'; /** @@ -93,8 +93,8 @@ var _ol_interaction_Extent_ = function(opt_options) { * @type {ol.layer.Vector} * @private */ - this.extentOverlay_ = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ + this.extentOverlay_ = new VectorLayer({ + source: new VectorSource({ useSpatialIndex: false, wrapX: !!opt_options.wrapX }), @@ -108,8 +108,8 @@ var _ol_interaction_Extent_ = function(opt_options) { * @type {ol.layer.Vector} * @private */ - this.vertexOverlay_ = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ + this.vertexOverlay_ = new VectorLayer({ + source: new VectorSource({ useSpatialIndex: false, wrapX: !!opt_options.wrapX }), @@ -374,9 +374,9 @@ _ol_interaction_Extent_.prototype.createOrUpdateExtentFeature_ = function(extent if (!extentFeature) { if (!extent) { - extentFeature = new _ol_Feature_({}); + extentFeature = new Feature({}); } else { - extentFeature = new _ol_Feature_(polygonFromExtent(extent)); + extentFeature = new Feature(polygonFromExtent(extent)); } this.extentFeature_ = extentFeature; this.extentOverlay_.getSource().addFeature(extentFeature); @@ -399,7 +399,7 @@ _ol_interaction_Extent_.prototype.createOrUpdateExtentFeature_ = function(extent _ol_interaction_Extent_.prototype.createOrUpdatePointerFeature_ = function(vertex) { var vertexFeature = this.vertexFeature_; if (!vertexFeature) { - vertexFeature = new _ol_Feature_(new Point(vertex)); + vertexFeature = new Feature(new Point(vertex)); this.vertexFeature_ = vertexFeature; this.vertexOverlay_.getSource().addFeature(vertexFeature); } else { diff --git a/src/ol/interaction/Interaction.js b/src/ol/interaction/Interaction.js index d3eccbfd15..d11d310acd 100644 --- a/src/ol/interaction/Interaction.js +++ b/src/ol/interaction/Interaction.js @@ -2,7 +2,7 @@ * @module ol/interaction/Interaction */ import {inherits} from '../index.js'; -import _ol_Object_ from '../Object.js'; +import BaseObject from '../Object.js'; import {easeOut, linear} from '../easing.js'; import _ol_interaction_Property_ from '../interaction/Property.js'; import {clamp} from '../math.js'; @@ -40,7 +40,7 @@ export var InteractionOptions; */ var Interaction = function(options) { - _ol_Object_.call(this); + BaseObject.call(this); /** * @private @@ -57,7 +57,7 @@ var Interaction = function(options) { }; -inherits(Interaction, _ol_Object_); +inherits(Interaction, BaseObject); /** diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index e3e696793a..e5c362d59d 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -4,7 +4,7 @@ import {getUid, inherits} from '../index.js'; import _ol_Collection_ from '../Collection.js'; import CollectionEventType from '../CollectionEventType.js'; -import _ol_Feature_ from '../Feature.js'; +import Feature from '../Feature.js'; import MapBrowserEventType from '../MapBrowserEventType.js'; import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js'; import {equals} from '../array.js'; @@ -18,8 +18,8 @@ import GeometryType from '../geom/GeometryType.js'; import Point from '../geom/Point.js'; import _ol_interaction_ModifyEventType_ from '../interaction/ModifyEventType.js'; import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; -import _ol_layer_Vector_ from '../layer/Vector.js'; -import _ol_source_Vector_ from '../source/Vector.js'; +import VectorLayer from '../layer/Vector.js'; +import VectorSource from '../source/Vector.js'; import VectorEventType from '../source/VectorEventType.js'; import RBush from '../structs/RBush.js'; import _ol_style_Style_ from '../style/Style.js'; @@ -157,8 +157,8 @@ var _ol_interaction_Modify_ = function(options) { * @type {ol.layer.Vector} * @private */ - this.overlay_ = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ + this.overlay_ = new VectorLayer({ + source: new VectorSource({ useSpatialIndex: false, wrapX: !!options.wrapX }), @@ -579,7 +579,7 @@ _ol_interaction_Modify_.prototype.writeGeometryCollectionGeometry_ = function(fe _ol_interaction_Modify_.prototype.createOrUpdateVertexFeature_ = function(coordinates) { var vertexFeature = this.vertexFeature_; if (!vertexFeature) { - vertexFeature = new _ol_Feature_(new Point(coordinates)); + vertexFeature = new Feature(new Point(coordinates)); this.vertexFeature_ = vertexFeature; this.overlay_.getSource().addFeature(vertexFeature); } else { diff --git a/src/ol/interaction/MouseWheelZoom.js b/src/ol/interaction/MouseWheelZoom.js index 569f707d9b..f0c771d3a0 100644 --- a/src/ol/interaction/MouseWheelZoom.js +++ b/src/ol/interaction/MouseWheelZoom.js @@ -2,7 +2,7 @@ * @module ol/interaction/MouseWheelZoom */ import {inherits} from '../index.js'; -import _ol_ViewHint_ from '../ViewHint.js'; +import ViewHint from '../ViewHint.js'; import condition from '../events/condition.js'; import {easeOut} from '../easing.js'; import EventType from '../events/EventType.js'; @@ -191,7 +191,7 @@ MouseWheelZoom.handleEvent = function(mapBrowserEvent) { if (this.trackpadTimeoutId_) { clearTimeout(this.trackpadTimeoutId_); } else { - view.setHint(_ol_ViewHint_.INTERACTING, 1); + view.setHint(ViewHint.INTERACTING, 1); } this.trackpadTimeoutId_ = setTimeout(this.decrementInteractingHint_.bind(this), this.trackpadEventGap_); var resolution = view.getResolution() * Math.pow(2, delta / this.trackpadDeltaPerZoom_); @@ -256,7 +256,7 @@ MouseWheelZoom.handleEvent = function(mapBrowserEvent) { MouseWheelZoom.prototype.decrementInteractingHint_ = function() { this.trackpadTimeoutId_ = undefined; var view = this.getMap().getView(); - view.setHint(_ol_ViewHint_.INTERACTING, -1); + view.setHint(ViewHint.INTERACTING, -1); }; diff --git a/src/ol/interaction/PinchRotate.js b/src/ol/interaction/PinchRotate.js index 109b16fc75..96170e1b0b 100644 --- a/src/ol/interaction/PinchRotate.js +++ b/src/ol/interaction/PinchRotate.js @@ -2,11 +2,11 @@ * @module ol/interaction/PinchRotate */ import {inherits} from '../index.js'; -import _ol_ViewHint_ from '../ViewHint.js'; +import ViewHint from '../ViewHint.js'; import {FALSE} from '../functions.js'; import Interaction from '../interaction/Interaction.js'; import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; -import _ol_RotationConstraint_ from '../RotationConstraint.js'; +import RotationConstraint from '../RotationConstraint.js'; /** * @classdesc @@ -98,7 +98,7 @@ _ol_interaction_PinchRotate_.handleDragEvent_ = function(mapBrowserEvent) { var map = mapBrowserEvent.map; var view = map.getView(); - if (view.getConstraints().rotation === _ol_RotationConstraint_.disable) { + if (view.getConstraints().rotation === RotationConstraint.disable) { return; } @@ -131,7 +131,7 @@ _ol_interaction_PinchRotate_.handleUpEvent_ = function(mapBrowserEvent) { if (this.targetPointers.length < 2) { var map = mapBrowserEvent.map; var view = map.getView(); - view.setHint(_ol_ViewHint_.INTERACTING, -1); + view.setHint(ViewHint.INTERACTING, -1); if (this.rotating_) { var rotation = view.getRotation(); Interaction.rotate( @@ -158,7 +158,7 @@ _ol_interaction_PinchRotate_.handleDownEvent_ = function(mapBrowserEvent) { this.rotating_ = false; this.rotationDelta_ = 0.0; if (!this.handlingDownUpSequence) { - map.getView().setHint(_ol_ViewHint_.INTERACTING, 1); + map.getView().setHint(ViewHint.INTERACTING, 1); } return true; } else { diff --git a/src/ol/interaction/PinchZoom.js b/src/ol/interaction/PinchZoom.js index 0b0decbc05..c44e88abf4 100644 --- a/src/ol/interaction/PinchZoom.js +++ b/src/ol/interaction/PinchZoom.js @@ -2,7 +2,7 @@ * @module ol/interaction/PinchZoom */ import {inherits} from '../index.js'; -import _ol_ViewHint_ from '../ViewHint.js'; +import ViewHint from '../ViewHint.js'; import {FALSE} from '../functions.js'; import Interaction from '../interaction/Interaction.js'; import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; @@ -125,7 +125,7 @@ _ol_interaction_PinchZoom_.handleUpEvent_ = function(mapBrowserEvent) { if (this.targetPointers.length < 2) { var map = mapBrowserEvent.map; var view = map.getView(); - view.setHint(_ol_ViewHint_.INTERACTING, -1); + view.setHint(ViewHint.INTERACTING, -1); var resolution = view.getResolution(); if (this.constrainResolution_ || resolution < view.getMinResolution() || @@ -157,7 +157,7 @@ _ol_interaction_PinchZoom_.handleDownEvent_ = function(mapBrowserEvent) { this.lastDistance_ = undefined; this.lastScaleDelta_ = 1; if (!this.handlingDownUpSequence) { - map.getView().setHint(_ol_ViewHint_.INTERACTING, 1); + map.getView().setHint(ViewHint.INTERACTING, 1); } return true; } else { diff --git a/src/ol/interaction/Select.js b/src/ol/interaction/Select.js index 3cb19f0669..da8e6ab6e3 100644 --- a/src/ol/interaction/Select.js +++ b/src/ol/interaction/Select.js @@ -10,9 +10,9 @@ import _ol_events_condition_ from '../events/condition.js'; import {TRUE} from '../functions.js'; import GeometryType from '../geom/GeometryType.js'; import Interaction from '../interaction/Interaction.js'; -import _ol_layer_Vector_ from '../layer/Vector.js'; +import VectorLayer from '../layer/Vector.js'; import _ol_obj_ from '../obj.js'; -import _ol_source_Vector_ from '../source/Vector.js'; +import VectorSource from '../source/Vector.js'; import _ol_style_Style_ from '../style/Style.js'; /** @@ -87,8 +87,8 @@ var _ol_interaction_Select_ = function(opt_options) { */ this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0; - var featureOverlay = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ + var featureOverlay = new VectorLayer({ + source: new VectorSource({ useSpatialIndex: false, features: options.features, wrapX: options.wrapX diff --git a/src/ol/interaction/Snap.js b/src/ol/interaction/Snap.js index 92a1627952..2556f32ed8 100644 --- a/src/ol/interaction/Snap.js +++ b/src/ol/interaction/Snap.js @@ -13,7 +13,7 @@ import GeometryType from '../geom/GeometryType.js'; import {fromCircle} from '../geom/Polygon.js'; import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; import _ol_obj_ from '../obj.js'; -import _ol_source_Vector_ from '../source/Vector.js'; +import VectorSource from '../source/Vector.js'; import VectorEventType from '../source/VectorEventType.js'; import RBush from '../structs/RBush.js'; @@ -219,7 +219,7 @@ _ol_interaction_Snap_.prototype.getFeatures_ = function() { */ _ol_interaction_Snap_.prototype.handleFeatureAdd_ = function(evt) { var feature; - if (evt instanceof _ol_source_Vector_.Event) { + if (evt instanceof VectorSource.Event) { feature = evt.feature; } else if (evt instanceof _ol_Collection_.Event) { feature = evt.element; @@ -234,7 +234,7 @@ _ol_interaction_Snap_.prototype.handleFeatureAdd_ = function(evt) { */ _ol_interaction_Snap_.prototype.handleFeatureRemove_ = function(evt) { var feature; - if (evt instanceof _ol_source_Vector_.Event) { + if (evt instanceof VectorSource.Event) { feature = evt.feature; } else if (evt instanceof _ol_Collection_.Event) { feature = evt.element; diff --git a/src/ol/interaction/Translate.js b/src/ol/interaction/Translate.js index e61dd8624e..c603fc0e2a 100644 --- a/src/ol/interaction/Translate.js +++ b/src/ol/interaction/Translate.js @@ -3,7 +3,7 @@ */ import {inherits} from '../index.js'; import _ol_Collection_ from '../Collection.js'; -import _ol_Object_ from '../Object.js'; +import BaseObject from '../Object.js'; import _ol_events_ from '../events.js'; import Event from '../events/Event.js'; import {TRUE} from '../functions.js'; @@ -80,7 +80,7 @@ var _ol_interaction_Translate_ = function(opt_options) { this.lastFeature_ = null; _ol_events_.listen(this, - _ol_Object_.getChangeEventType(_ol_interaction_Property_.ACTIVE), + BaseObject.getChangeEventType(_ol_interaction_Property_.ACTIVE), this.handleActiveChanged_, this); }; diff --git a/src/ol/layer/Base.js b/src/ol/layer/Base.js index 95047043a6..eceeceeebf 100644 --- a/src/ol/layer/Base.js +++ b/src/ol/layer/Base.js @@ -2,7 +2,7 @@ * @module ol/layer/Base */ import {inherits} from '../index.js'; -import _ol_Object_ from '../Object.js'; +import BaseObject from '../Object.js'; import _ol_layer_Property_ from '../layer/Property.js'; import {clamp} from '../math.js'; import _ol_obj_ from '../obj.js'; @@ -23,7 +23,7 @@ import _ol_obj_ from '../obj.js'; */ var _ol_layer_Base_ = function(options) { - _ol_Object_.call(this); + BaseObject.call(this); /** * @type {Object.} @@ -60,7 +60,7 @@ var _ol_layer_Base_ = function(options) { }; -inherits(_ol_layer_Base_, _ol_Object_); +inherits(_ol_layer_Base_, BaseObject); /** diff --git a/src/ol/layer/Group.js b/src/ol/layer/Group.js index ae07cd6370..043a24898e 100644 --- a/src/ol/layer/Group.js +++ b/src/ol/layer/Group.js @@ -4,7 +4,7 @@ import {getUid, inherits} from '../index.js'; import _ol_Collection_ from '../Collection.js'; import CollectionEventType from '../CollectionEventType.js'; -import _ol_Object_ from '../Object.js'; +import BaseObject from '../Object.js'; import ObjectEventType from '../ObjectEventType.js'; import {assert} from '../asserts.js'; import _ol_events_ from '../events.js'; @@ -59,7 +59,7 @@ var _ol_layer_Group_ = function(opt_options) { this.listenerKeys_ = {}; _ol_events_.listen(this, - _ol_Object_.getChangeEventType(Property.LAYERS), + BaseObject.getChangeEventType(Property.LAYERS), this.handleLayersChanged_, this); if (layers) { diff --git a/src/ol/layer/Heatmap.js b/src/ol/layer/Heatmap.js index de1771c3d2..25397b799f 100644 --- a/src/ol/layer/Heatmap.js +++ b/src/ol/layer/Heatmap.js @@ -3,9 +3,9 @@ */ import _ol_events_ from '../events.js'; import {inherits} from '../index.js'; -import _ol_Object_ from '../Object.js'; +import BaseObject from '../Object.js'; import {createCanvasContext2D} from '../dom.js'; -import _ol_layer_Vector_ from '../layer/Vector.js'; +import VectorLayer from '../layer/Vector.js'; import {clamp} from '../math.js'; import _ol_obj_ from '../obj.js'; import RenderEventType from '../render/EventType.js'; @@ -54,7 +54,7 @@ var Heatmap = function(opt_options) { delete baseOptions.blur; delete baseOptions.shadow; delete baseOptions.weight; - _ol_layer_Vector_.call(this, /** @type {olx.layer.VectorOptions} */ (baseOptions)); + VectorLayer.call(this, /** @type {olx.layer.VectorOptions} */ (baseOptions)); /** * @private @@ -81,7 +81,7 @@ var Heatmap = function(opt_options) { this.styleCache_ = null; _ol_events_.listen(this, - _ol_Object_.getChangeEventType(Property.GRADIENT), + BaseObject.getChangeEventType(Property.GRADIENT), this.handleGradientChanged_, this); this.setGradient(options.gradient ? options.gradient : DEFAULT_GRADIENT); @@ -91,10 +91,10 @@ var Heatmap = function(opt_options) { this.setRadius(options.radius !== undefined ? options.radius : 8); _ol_events_.listen(this, - _ol_Object_.getChangeEventType(Property.BLUR), + BaseObject.getChangeEventType(Property.BLUR), this.handleStyleChanged_, this); _ol_events_.listen(this, - _ol_Object_.getChangeEventType(Property.RADIUS), + BaseObject.getChangeEventType(Property.RADIUS), this.handleStyleChanged_, this); this.handleStyleChanged_(); @@ -136,7 +136,7 @@ var Heatmap = function(opt_options) { _ol_events_.listen(this, RenderEventType.RENDER, this.handleRender_, this); }; -inherits(Heatmap, _ol_layer_Vector_); +inherits(Heatmap, VectorLayer); /** diff --git a/src/ol/layer/Image.js b/src/ol/layer/Image.js index 81518b2cc2..bfd059b7fb 100644 --- a/src/ol/layer/Image.js +++ b/src/ol/layer/Image.js @@ -19,7 +19,7 @@ import _ol_layer_Layer_ from '../layer/Layer.js'; * @param {olx.layer.ImageOptions=} opt_options Layer options. * @api */ -var _ol_layer_Image_ = function(opt_options) { +var ImageLayer = function(opt_options) { var options = opt_options ? opt_options : {}; _ol_layer_Layer_.call(this, /** @type {olx.layer.LayerOptions} */ (options)); @@ -32,7 +32,7 @@ var _ol_layer_Image_ = function(opt_options) { }; -inherits(_ol_layer_Image_, _ol_layer_Layer_); +inherits(ImageLayer, _ol_layer_Layer_); /** @@ -41,5 +41,5 @@ inherits(_ol_layer_Image_, _ol_layer_Layer_); * @return {ol.source.Image} Source. * @api */ -_ol_layer_Image_.prototype.getSource; -export default _ol_layer_Image_; +ImageLayer.prototype.getSource; +export default ImageLayer; diff --git a/src/ol/layer/Layer.js b/src/ol/layer/Layer.js index 72b65b803d..bfdf3558d1 100644 --- a/src/ol/layer/Layer.js +++ b/src/ol/layer/Layer.js @@ -4,7 +4,7 @@ import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {getUid, inherits} from '../index.js'; -import _ol_Object_ from '../Object.js'; +import BaseObject from '../Object.js'; import _ol_layer_Base_ from '../layer/Base.js'; import _ol_layer_Property_ from '../layer/Property.js'; import _ol_obj_ from '../obj.js'; @@ -63,7 +63,7 @@ var _ol_layer_Layer_ = function(options) { } _ol_events_.listen(this, - _ol_Object_.getChangeEventType(_ol_layer_Property_.SOURCE), + BaseObject.getChangeEventType(_ol_layer_Property_.SOURCE), this.handleSourcePropertyChange_, this); var source = options.source ? options.source : null; diff --git a/src/ol/layer/Vector.js b/src/ol/layer/Vector.js index 0af05ea274..99e0eed12a 100644 --- a/src/ol/layer/Vector.js +++ b/src/ol/layer/Vector.js @@ -31,7 +31,7 @@ var Property = { * @param {olx.layer.VectorOptions=} opt_options Options. * @api */ -var _ol_layer_Vector_ = function(opt_options) { +var VectorLayer = function(opt_options) { var options = opt_options ? opt_options : /** @type {olx.layer.VectorOptions} */ ({}); @@ -101,13 +101,13 @@ var _ol_layer_Vector_ = function(opt_options) { }; -inherits(_ol_layer_Vector_, _ol_layer_Layer_); +inherits(VectorLayer, _ol_layer_Layer_); /** * @return {boolean} Declutter. */ -_ol_layer_Vector_.prototype.getDeclutter = function() { +VectorLayer.prototype.getDeclutter = function() { return this.declutter_; }; @@ -115,7 +115,7 @@ _ol_layer_Vector_.prototype.getDeclutter = function() { /** * @param {boolean} declutter Declutter. */ -_ol_layer_Vector_.prototype.setDeclutter = function(declutter) { +VectorLayer.prototype.setDeclutter = function(declutter) { this.declutter_ = declutter; }; @@ -123,7 +123,7 @@ _ol_layer_Vector_.prototype.setDeclutter = function(declutter) { /** * @return {number|undefined} Render buffer. */ -_ol_layer_Vector_.prototype.getRenderBuffer = function() { +VectorLayer.prototype.getRenderBuffer = function() { return this.renderBuffer_; }; @@ -132,7 +132,7 @@ _ol_layer_Vector_.prototype.getRenderBuffer = function() { * @return {function(ol.Feature, ol.Feature): number|null|undefined} Render * order. */ -_ol_layer_Vector_.prototype.getRenderOrder = function() { +VectorLayer.prototype.getRenderOrder = function() { return (/** @type {ol.RenderOrderFunction|null|undefined} */ this.get(Property.RENDER_ORDER)); }; @@ -143,7 +143,7 @@ _ol_layer_Vector_.prototype.getRenderOrder = function() { * @return {ol.source.Vector} Source. * @api */ -_ol_layer_Vector_.prototype.getSource; +VectorLayer.prototype.getSource; /** @@ -153,7 +153,7 @@ _ol_layer_Vector_.prototype.getSource; * Layer style. * @api */ -_ol_layer_Vector_.prototype.getStyle = function() { +VectorLayer.prototype.getStyle = function() { return this.style_; }; @@ -163,7 +163,7 @@ _ol_layer_Vector_.prototype.getStyle = function() { * @return {ol.StyleFunction|undefined} Layer style function. * @api */ -_ol_layer_Vector_.prototype.getStyleFunction = function() { +VectorLayer.prototype.getStyleFunction = function() { return this.styleFunction_; }; @@ -172,7 +172,7 @@ _ol_layer_Vector_.prototype.getStyleFunction = function() { * @return {boolean} Whether the rendered layer should be updated while * animating. */ -_ol_layer_Vector_.prototype.getUpdateWhileAnimating = function() { +VectorLayer.prototype.getUpdateWhileAnimating = function() { return this.updateWhileAnimating_; }; @@ -181,7 +181,7 @@ _ol_layer_Vector_.prototype.getUpdateWhileAnimating = function() { * @return {boolean} Whether the rendered layer should be updated while * interacting. */ -_ol_layer_Vector_.prototype.getUpdateWhileInteracting = function() { +VectorLayer.prototype.getUpdateWhileInteracting = function() { return this.updateWhileInteracting_; }; @@ -190,7 +190,7 @@ _ol_layer_Vector_.prototype.getUpdateWhileInteracting = function() { * @param {ol.RenderOrderFunction|null|undefined} renderOrder * Render order. */ -_ol_layer_Vector_.prototype.setRenderOrder = function(renderOrder) { +VectorLayer.prototype.setRenderOrder = function(renderOrder) { this.set(Property.RENDER_ORDER, renderOrder); }; @@ -206,7 +206,7 @@ _ol_layer_Vector_.prototype.setRenderOrder = function(renderOrder) { * style Layer style. * @api */ -_ol_layer_Vector_.prototype.setStyle = function(style) { +VectorLayer.prototype.setStyle = function(style) { this.style_ = style !== undefined ? style : _ol_style_Style_.defaultFunction; this.styleFunction_ = style === null ? undefined : _ol_style_Style_.createFunction(this.style_); @@ -217,9 +217,9 @@ _ol_layer_Vector_.prototype.setStyle = function(style) { /** * @return {ol.layer.VectorRenderType|string} The render mode. */ -_ol_layer_Vector_.prototype.getRenderMode = function() { +VectorLayer.prototype.getRenderMode = function() { return this.renderMode_; }; -export default _ol_layer_Vector_; +export default VectorLayer; diff --git a/src/ol/layer/VectorTile.js b/src/ol/layer/VectorTile.js index 65f8fe67e5..09fff11053 100644 --- a/src/ol/layer/VectorTile.js +++ b/src/ol/layer/VectorTile.js @@ -5,7 +5,7 @@ import {inherits} from '../index.js'; import LayerType from '../LayerType.js'; import {assert} from '../asserts.js'; import _ol_layer_TileProperty_ from '../layer/TileProperty.js'; -import _ol_layer_Vector_ from '../layer/Vector.js'; +import VectorLayer from '../layer/Vector.js'; import _ol_layer_VectorTileRenderType_ from '../layer/VectorTileRenderType.js'; import _ol_obj_ from '../obj.js'; @@ -39,7 +39,7 @@ var _ol_layer_VectorTile_ = function(opt_options) { delete baseOptions.preload; delete baseOptions.useInterimTilesOnError; - _ol_layer_Vector_.call(this, /** @type {olx.layer.VectorOptions} */ (baseOptions)); + VectorLayer.call(this, /** @type {olx.layer.VectorOptions} */ (baseOptions)); this.setPreload(options.preload ? options.preload : 0); this.setUseInterimTilesOnError(options.useInterimTilesOnError ? @@ -54,7 +54,7 @@ var _ol_layer_VectorTile_ = function(opt_options) { }; -inherits(_ol_layer_VectorTile_, _ol_layer_Vector_); +inherits(_ol_layer_VectorTile_, VectorLayer); /** diff --git a/src/ol/proj/EPSG3857.js b/src/ol/proj/EPSG3857.js index 33b3bce5cd..033a3ecdcc 100644 --- a/src/ol/proj/EPSG3857.js +++ b/src/ol/proj/EPSG3857.js @@ -4,7 +4,7 @@ import {inherits} from '../index.js'; import {cosh} from '../math.js'; import _ol_proj_Projection_ from '../proj/Projection.js'; -import _ol_proj_Units_ from '../proj/Units.js'; +import Units from '../proj/Units.js'; var _ol_proj_EPSG3857_ = {}; @@ -20,7 +20,7 @@ var _ol_proj_EPSG3857_ = {}; _ol_proj_EPSG3857_.Projection_ = function(code) { _ol_proj_Projection_.call(this, { code: code, - units: _ol_proj_Units_.METERS, + units: Units.METERS, extent: _ol_proj_EPSG3857_.EXTENT, global: true, worldExtent: _ol_proj_EPSG3857_.WORLD_EXTENT, diff --git a/src/ol/proj/EPSG4326.js b/src/ol/proj/EPSG4326.js index 64f1ed70a5..cff4203b1b 100644 --- a/src/ol/proj/EPSG4326.js +++ b/src/ol/proj/EPSG4326.js @@ -3,7 +3,7 @@ */ import {inherits} from '../index.js'; import _ol_proj_Projection_ from '../proj/Projection.js'; -import _ol_proj_Units_ from '../proj/Units.js'; +import Units from '../proj/Units.js'; var _ol_proj_EPSG4326_ = {}; @@ -24,7 +24,7 @@ var _ol_proj_EPSG4326_ = {}; _ol_proj_EPSG4326_.Projection_ = function(code, opt_axisOrientation) { _ol_proj_Projection_.call(this, { code: code, - units: _ol_proj_Units_.DEGREES, + units: Units.DEGREES, extent: _ol_proj_EPSG4326_.EXTENT, axisOrientation: opt_axisOrientation, global: true, diff --git a/src/ol/proj/Projection.js b/src/ol/proj/Projection.js index 2fff3fd90f..08df01e4c1 100644 --- a/src/ol/proj/Projection.js +++ b/src/ol/proj/Projection.js @@ -1,7 +1,7 @@ /** * @module ol/proj/Projection */ -import _ol_proj_Units_ from '../proj/Units.js'; +import Units from '../proj/Units.js'; /** * @classdesc @@ -153,7 +153,7 @@ _ol_proj_Projection_.prototype.getUnits = function() { * @api */ _ol_proj_Projection_.prototype.getMetersPerUnit = function() { - return this.metersPerUnit_ || _ol_proj_Units_.METERS_PER_UNIT[this.units_]; + return this.metersPerUnit_ || Units.METERS_PER_UNIT[this.units_]; }; diff --git a/src/ol/proj/Units.js b/src/ol/proj/Units.js index f1797aafb7..8004d54693 100644 --- a/src/ol/proj/Units.js +++ b/src/ol/proj/Units.js @@ -6,7 +6,7 @@ * `'us-ft'`. * @enum {string} */ -var _ol_proj_Units_ = { +var Units = { DEGREES: 'degrees', FEET: 'ft', METERS: 'm', @@ -22,11 +22,11 @@ var _ol_proj_Units_ = { * @type {Object.} * @api */ -_ol_proj_Units_.METERS_PER_UNIT = {}; +Units.METERS_PER_UNIT = {}; // use the radius of the Normal sphere -_ol_proj_Units_.METERS_PER_UNIT[_ol_proj_Units_.DEGREES] = +Units.METERS_PER_UNIT[Units.DEGREES] = 2 * Math.PI * 6370997 / 360; -_ol_proj_Units_.METERS_PER_UNIT[_ol_proj_Units_.FEET] = 0.3048; -_ol_proj_Units_.METERS_PER_UNIT[_ol_proj_Units_.METERS] = 1; -_ol_proj_Units_.METERS_PER_UNIT[_ol_proj_Units_.USFEET] = 1200 / 3937; -export default _ol_proj_Units_; +Units.METERS_PER_UNIT[Units.FEET] = 0.3048; +Units.METERS_PER_UNIT[Units.METERS] = 1; +Units.METERS_PER_UNIT[Units.USFEET] = 1200 / 3937; +export default Units; diff --git a/src/ol/renderer/Layer.js b/src/ol/renderer/Layer.js index cd6521bca1..a51aa53b3d 100644 --- a/src/ol/renderer/Layer.js +++ b/src/ol/renderer/Layer.js @@ -3,7 +3,7 @@ */ import {getUid, inherits, nullFunction} from '../index.js'; import ImageState from '../ImageState.js'; -import _ol_Observable_ from '../Observable.js'; +import Observable from '../Observable.js'; import TileState from '../TileState.js'; import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; @@ -18,7 +18,7 @@ import SourceState from '../source/State.js'; */ var _ol_renderer_Layer_ = function(layer) { - _ol_Observable_.call(this); + Observable.call(this); /** * @private @@ -29,7 +29,7 @@ var _ol_renderer_Layer_ = function(layer) { }; -inherits(_ol_renderer_Layer_, _ol_Observable_); +inherits(_ol_renderer_Layer_, Observable); /** diff --git a/src/ol/renderer/canvas/ImageLayer.js b/src/ol/renderer/canvas/ImageLayer.js index 42451da22c..b0bb994192 100644 --- a/src/ol/renderer/canvas/ImageLayer.js +++ b/src/ol/renderer/canvas/ImageLayer.js @@ -3,9 +3,9 @@ */ import {ENABLE_RASTER_REPROJECTION} from '../../reproj/common.js'; import {inherits} from '../../index.js'; -import _ol_ImageCanvas_ from '../../ImageCanvas.js'; +import ImageCanvas from '../../ImageCanvas.js'; import LayerType from '../../LayerType.js'; -import _ol_ViewHint_ from '../../ViewHint.js'; +import ViewHint from '../../ViewHint.js'; import {equals} from '../../array.js'; import {getHeight, getIntersection, getWidth, isEmpty} from '../../extent.js'; import _ol_layer_VectorRenderType_ from '../../layer/VectorRenderType.js'; @@ -21,7 +21,7 @@ import _ol_transform_ from '../../transform.js'; * @param {ol.layer.Image} imageLayer Single image layer. * @api */ -var _ol_renderer_canvas_ImageLayer_ = function(imageLayer) { +var CanvasImageLayerRenderer = function(imageLayer) { _ol_renderer_canvas_IntermediateCanvas_.call(this, imageLayer); @@ -50,7 +50,7 @@ var _ol_renderer_canvas_ImageLayer_ = function(imageLayer) { }; -inherits(_ol_renderer_canvas_ImageLayer_, _ol_renderer_canvas_IntermediateCanvas_); +inherits(CanvasImageLayerRenderer, _ol_renderer_canvas_IntermediateCanvas_); /** @@ -59,7 +59,7 @@ inherits(_ol_renderer_canvas_ImageLayer_, _ol_renderer_canvas_IntermediateCanvas * @param {ol.layer.Layer} layer The candidate layer. * @return {boolean} The renderer can render the layer. */ -_ol_renderer_canvas_ImageLayer_['handles'] = function(type, layer) { +CanvasImageLayerRenderer['handles'] = function(type, layer) { return type === RendererType.CANVAS && (layer.getType() === LayerType.IMAGE || layer.getType() === LayerType.VECTOR && /** @type {ol.layer.Vector} */ (layer).getRenderMode() === _ol_layer_VectorRenderType_.IMAGE); @@ -72,13 +72,13 @@ _ol_renderer_canvas_ImageLayer_['handles'] = function(type, layer) { * @param {ol.layer.Layer} layer The layer to be rendererd. * @return {ol.renderer.canvas.ImageLayer} The layer renderer. */ -_ol_renderer_canvas_ImageLayer_['create'] = function(mapRenderer, layer) { - var renderer = new _ol_renderer_canvas_ImageLayer_(/** @type {ol.layer.Image} */ (layer)); +CanvasImageLayerRenderer['create'] = function(mapRenderer, layer) { + var renderer = new CanvasImageLayerRenderer(/** @type {ol.layer.Image} */ (layer)); if (layer.getType() === LayerType.VECTOR) { var candidates = getLayerRendererPlugins(); for (var i = 0, ii = candidates.length; i < ii; ++i) { var candidate = /** @type {Object.} */ (candidates[i]); - if (candidate !== _ol_renderer_canvas_ImageLayer_ && candidate['handles'](RendererType.CANVAS, layer)) { + if (candidate !== CanvasImageLayerRenderer && candidate['handles'](RendererType.CANVAS, layer)) { renderer.setVectorRenderer(candidate['create'](mapRenderer, layer)); } } @@ -90,7 +90,7 @@ _ol_renderer_canvas_ImageLayer_['create'] = function(mapRenderer, layer) { /** * @inheritDoc */ -_ol_renderer_canvas_ImageLayer_.prototype.getImage = function() { +CanvasImageLayerRenderer.prototype.getImage = function() { return !this.image_ ? null : this.image_.getImage(); }; @@ -98,7 +98,7 @@ _ol_renderer_canvas_ImageLayer_.prototype.getImage = function() { /** * @inheritDoc */ -_ol_renderer_canvas_ImageLayer_.prototype.getImageTransform = function() { +CanvasImageLayerRenderer.prototype.getImageTransform = function() { return this.imageTransform_; }; @@ -106,7 +106,7 @@ _ol_renderer_canvas_ImageLayer_.prototype.getImageTransform = function() { /** * @inheritDoc */ -_ol_renderer_canvas_ImageLayer_.prototype.prepareFrame = function(frameState, layerState) { +CanvasImageLayerRenderer.prototype.prepareFrame = function(frameState, layerState) { var pixelRatio = frameState.pixelRatio; var size = frameState.size; @@ -125,7 +125,7 @@ _ol_renderer_canvas_ImageLayer_.prototype.prepareFrame = function(frameState, la renderedExtent = getIntersection(renderedExtent, layerState.extent); } - if (!hints[_ol_ViewHint_.ANIMATING] && !hints[_ol_ViewHint_.INTERACTING] && + if (!hints[ViewHint.ANIMATING] && !hints[ViewHint.INTERACTING] && !isEmpty(renderedExtent)) { var projection = viewState.projection; if (!ENABLE_RASTER_REPROJECTION) { @@ -153,7 +153,7 @@ _ol_renderer_canvas_ImageLayer_.prototype.prepareFrame = function(frameState, la context.canvas.width = imageFrameState.size[0] * pixelRatio; context.canvas.height = imageFrameState.size[1] * pixelRatio; vectorRenderer.composeFrame(imageFrameState, layerState, context); - this.image_ = new _ol_ImageCanvas_(renderedExtent, viewResolution, pixelRatio, context.canvas); + this.image_ = new ImageCanvas(renderedExtent, viewResolution, pixelRatio, context.canvas); this.skippedFeatures_ = skippedFeatures; } } else { @@ -197,7 +197,7 @@ _ol_renderer_canvas_ImageLayer_.prototype.prepareFrame = function(frameState, la /** * @inheritDoc */ -_ol_renderer_canvas_ImageLayer_.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg) { +CanvasImageLayerRenderer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg) { if (this.vectorRenderer_) { return this.vectorRenderer_.forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, thisArg); } else { @@ -209,7 +209,7 @@ _ol_renderer_canvas_ImageLayer_.prototype.forEachFeatureAtCoordinate = function( /** * @param {ol.renderer.canvas.VectorLayer} renderer Vector renderer. */ -_ol_renderer_canvas_ImageLayer_.prototype.setVectorRenderer = function(renderer) { +CanvasImageLayerRenderer.prototype.setVectorRenderer = function(renderer) { this.vectorRenderer_ = renderer; }; -export default _ol_renderer_canvas_ImageLayer_; +export default CanvasImageLayerRenderer; diff --git a/src/ol/renderer/canvas/Map.js b/src/ol/renderer/canvas/Map.js index 039f888ec4..ba33ce7ba2 100644 --- a/src/ol/renderer/canvas/Map.js +++ b/src/ol/renderer/canvas/Map.js @@ -24,7 +24,7 @@ import SourceState from '../../source/State.js'; * @param {ol.PluggableMap} map Map. * @api */ -var _ol_renderer_canvas_Map_ = function(container, map) { +var CanvasMapRenderer = function(container, map) { _ol_renderer_Map_.call(this, container, map); @@ -60,7 +60,7 @@ var _ol_renderer_canvas_Map_ = function(container, map) { }; -inherits(_ol_renderer_canvas_Map_, _ol_renderer_Map_); +inherits(CanvasMapRenderer, _ol_renderer_Map_); /** @@ -68,7 +68,7 @@ inherits(_ol_renderer_canvas_Map_, _ol_renderer_Map_); * @param {ol.renderer.Type} type The renderer type. * @return {boolean} The renderer can render the layer. */ -_ol_renderer_canvas_Map_['handles'] = function(type) { +CanvasMapRenderer['handles'] = function(type) { return type === RendererType.CANVAS; }; @@ -79,8 +79,8 @@ _ol_renderer_canvas_Map_['handles'] = function(type) { * @param {ol.PluggableMap} map Map. * @return {ol.renderer.canvas.Map} The map renderer. */ -_ol_renderer_canvas_Map_['create'] = function(container, map) { - return new _ol_renderer_canvas_Map_(container, map); +CanvasMapRenderer['create'] = function(container, map) { + return new CanvasMapRenderer(container, map); }; @@ -89,7 +89,7 @@ _ol_renderer_canvas_Map_['create'] = function(container, map) { * @param {olx.FrameState} frameState Frame state. * @private */ -_ol_renderer_canvas_Map_.prototype.dispatchComposeEvent_ = function(type, frameState) { +CanvasMapRenderer.prototype.dispatchComposeEvent_ = function(type, frameState) { var map = this.getMap(); var context = this.context_; if (map.hasListener(type)) { @@ -114,7 +114,7 @@ _ol_renderer_canvas_Map_.prototype.dispatchComposeEvent_ = function(type, frameS * @protected * @return {!ol.Transform} Transform. */ -_ol_renderer_canvas_Map_.prototype.getTransform = function(frameState) { +CanvasMapRenderer.prototype.getTransform = function(frameState) { var viewState = frameState.viewState; var dx1 = this.canvas_.width / 2; var dy1 = this.canvas_.height / 2; @@ -130,7 +130,7 @@ _ol_renderer_canvas_Map_.prototype.getTransform = function(frameState) { /** * @inheritDoc */ -_ol_renderer_canvas_Map_.prototype.getType = function() { +CanvasMapRenderer.prototype.getType = function() { return RendererType.CANVAS; }; @@ -138,7 +138,7 @@ _ol_renderer_canvas_Map_.prototype.getType = function() { /** * @inheritDoc */ -_ol_renderer_canvas_Map_.prototype.renderFrame = function(frameState) { +CanvasMapRenderer.prototype.renderFrame = function(frameState) { if (!frameState) { if (this.renderedVisible_) { @@ -207,7 +207,7 @@ _ol_renderer_canvas_Map_.prototype.renderFrame = function(frameState) { /** * @inheritDoc */ -_ol_renderer_canvas_Map_.prototype.forEachLayerAtPixel = function(pixel, frameState, callback, thisArg, +CanvasMapRenderer.prototype.forEachLayerAtPixel = function(pixel, frameState, callback, thisArg, layerFilter, thisArg2) { var result; var viewState = frameState.viewState; @@ -235,4 +235,4 @@ _ol_renderer_canvas_Map_.prototype.forEachLayerAtPixel = function(pixel, frameSt } return undefined; }; -export default _ol_renderer_canvas_Map_; +export default CanvasMapRenderer; diff --git a/src/ol/renderer/canvas/TileLayer.js b/src/ol/renderer/canvas/TileLayer.js index ed6a492caf..df933c1e10 100644 --- a/src/ol/renderer/canvas/TileLayer.js +++ b/src/ol/renderer/canvas/TileLayer.js @@ -5,7 +5,7 @@ import {getUid, inherits} from '../../index.js'; import LayerType from '../../LayerType.js'; import TileRange from '../../TileRange.js'; import TileState from '../../TileState.js'; -import _ol_ViewHint_ from '../../ViewHint.js'; +import ViewHint from '../../ViewHint.js'; import {createCanvasContext2D} from '../../dom.js'; import {containsExtent, createEmpty, equals, getIntersection, isEmpty} from '../../extent.js'; import RendererType from '../Type.js'; @@ -18,7 +18,7 @@ import _ol_transform_ from '../../transform.js'; * @param {ol.layer.Tile|ol.layer.VectorTile} tileLayer Tile layer. * @api */ -var _ol_renderer_canvas_TileLayer_ = function(tileLayer) { +var CanvasTileLayerRenderer = function(tileLayer) { _ol_renderer_canvas_IntermediateCanvas_.call(this, tileLayer); @@ -78,7 +78,7 @@ var _ol_renderer_canvas_TileLayer_ = function(tileLayer) { }; -inherits(_ol_renderer_canvas_TileLayer_, _ol_renderer_canvas_IntermediateCanvas_); +inherits(CanvasTileLayerRenderer, _ol_renderer_canvas_IntermediateCanvas_); /** @@ -87,7 +87,7 @@ inherits(_ol_renderer_canvas_TileLayer_, _ol_renderer_canvas_IntermediateCanvas_ * @param {ol.layer.Layer} layer The candidate layer. * @return {boolean} The renderer can render the layer. */ -_ol_renderer_canvas_TileLayer_['handles'] = function(type, layer) { +CanvasTileLayerRenderer['handles'] = function(type, layer) { return type === RendererType.CANVAS && layer.getType() === LayerType.TILE; }; @@ -98,8 +98,8 @@ _ol_renderer_canvas_TileLayer_['handles'] = function(type, layer) { * @param {ol.layer.Layer} layer The layer to be rendererd. * @return {ol.renderer.canvas.TileLayer} The layer renderer. */ -_ol_renderer_canvas_TileLayer_['create'] = function(mapRenderer, layer) { - return new _ol_renderer_canvas_TileLayer_(/** @type {ol.layer.Tile} */ (layer)); +CanvasTileLayerRenderer['create'] = function(mapRenderer, layer) { + return new CanvasTileLayerRenderer(/** @type {ol.layer.Tile} */ (layer)); }; @@ -108,7 +108,7 @@ _ol_renderer_canvas_TileLayer_['create'] = function(mapRenderer, layer) { * @param {ol.Tile} tile Tile. * @return {boolean} Tile is drawable. */ -_ol_renderer_canvas_TileLayer_.prototype.isDrawableTile_ = function(tile) { +CanvasTileLayerRenderer.prototype.isDrawableTile_ = function(tile) { var tileState = tile.getState(); var useInterimTilesOnError = this.getLayer().getUseInterimTilesOnError(); return tileState == TileState.LOADED || @@ -119,7 +119,7 @@ _ol_renderer_canvas_TileLayer_.prototype.isDrawableTile_ = function(tile) { /** * @inheritDoc */ -_ol_renderer_canvas_TileLayer_.prototype.prepareFrame = function(frameState, layerState) { +CanvasTileLayerRenderer.prototype.prepareFrame = function(frameState, layerState) { var pixelRatio = frameState.pixelRatio; var size = frameState.size; @@ -209,7 +209,7 @@ _ol_renderer_canvas_TileLayer_.prototype.prepareFrame = function(frameState, lay var renderedResolution = tileResolution * pixelRatio / tilePixelRatio * oversampling; var hints = frameState.viewHints; - var animatingOrInteracting = hints[_ol_ViewHint_.ANIMATING] || hints[_ol_ViewHint_.INTERACTING]; + var animatingOrInteracting = hints[ViewHint.ANIMATING] || hints[ViewHint.INTERACTING]; if (!(this.renderedResolution && Date.now() - frameState.time > 16 && animatingOrInteracting) && ( newTiles || !(this.renderedExtent_ && containsExtent(this.renderedExtent_, extent)) || @@ -308,7 +308,7 @@ _ol_renderer_canvas_TileLayer_.prototype.prepareFrame = function(frameState, lay * @param {number} gutter Tile gutter. * @param {boolean} transition Apply an alpha transition. */ -_ol_renderer_canvas_TileLayer_.prototype.drawTileImage = function(tile, frameState, layerState, x, y, w, h, gutter, transition) { +CanvasTileLayerRenderer.prototype.drawTileImage = function(tile, frameState, layerState, x, y, w, h, gutter, transition) { var image = tile.getImage(this.getLayer()); if (!image) { return; @@ -340,7 +340,7 @@ _ol_renderer_canvas_TileLayer_.prototype.drawTileImage = function(tile, frameSta /** * @inheritDoc */ -_ol_renderer_canvas_TileLayer_.prototype.getImage = function() { +CanvasTileLayerRenderer.prototype.getImage = function() { var context = this.context; return context ? context.canvas : null; }; @@ -350,13 +350,13 @@ _ol_renderer_canvas_TileLayer_.prototype.getImage = function() { * @function * @return {ol.layer.Tile|ol.layer.VectorTile} */ -_ol_renderer_canvas_TileLayer_.prototype.getLayer; +CanvasTileLayerRenderer.prototype.getLayer; /** * @inheritDoc */ -_ol_renderer_canvas_TileLayer_.prototype.getImageTransform = function() { +CanvasTileLayerRenderer.prototype.getImageTransform = function() { return this.imageTransform_; }; -export default _ol_renderer_canvas_TileLayer_; +export default CanvasTileLayerRenderer; diff --git a/src/ol/renderer/canvas/VectorLayer.js b/src/ol/renderer/canvas/VectorLayer.js index 761d7bf500..4f52ddc0bf 100644 --- a/src/ol/renderer/canvas/VectorLayer.js +++ b/src/ol/renderer/canvas/VectorLayer.js @@ -3,7 +3,7 @@ */ import {getUid, inherits} from '../../index.js'; import LayerType from '../../LayerType.js'; -import _ol_ViewHint_ from '../../ViewHint.js'; +import ViewHint from '../../ViewHint.js'; import {createCanvasContext2D} from '../../dom.js'; import _ol_events_ from '../../events.js'; import EventType from '../../events/EventType.js'; @@ -22,7 +22,7 @@ import _ol_renderer_vector_ from '../vector.js'; * @param {ol.layer.Vector} vectorLayer Vector layer. * @api */ -var _ol_renderer_canvas_VectorLayer_ = function(vectorLayer) { +var CanvasVectorLayerRenderer = function(vectorLayer) { _ol_renderer_canvas_Layer_.call(this, vectorLayer); @@ -83,7 +83,7 @@ var _ol_renderer_canvas_VectorLayer_ = function(vectorLayer) { }; -inherits(_ol_renderer_canvas_VectorLayer_, _ol_renderer_canvas_Layer_); +inherits(CanvasVectorLayerRenderer, _ol_renderer_canvas_Layer_); /** @@ -92,7 +92,7 @@ inherits(_ol_renderer_canvas_VectorLayer_, _ol_renderer_canvas_Layer_); * @param {ol.layer.Layer} layer The candidate layer. * @return {boolean} The renderer can render the layer. */ -_ol_renderer_canvas_VectorLayer_['handles'] = function(type, layer) { +CanvasVectorLayerRenderer['handles'] = function(type, layer) { return type === RendererType.CANVAS && layer.getType() === LayerType.VECTOR; }; @@ -103,15 +103,15 @@ _ol_renderer_canvas_VectorLayer_['handles'] = function(type, layer) { * @param {ol.layer.Layer} layer The layer to be rendererd. * @return {ol.renderer.canvas.VectorLayer} The layer renderer. */ -_ol_renderer_canvas_VectorLayer_['create'] = function(mapRenderer, layer) { - return new _ol_renderer_canvas_VectorLayer_(/** @type {ol.layer.Vector} */ (layer)); +CanvasVectorLayerRenderer['create'] = function(mapRenderer, layer) { + return new CanvasVectorLayerRenderer(/** @type {ol.layer.Vector} */ (layer)); }; /** * @inheritDoc */ -_ol_renderer_canvas_VectorLayer_.prototype.disposeInternal = function() { +CanvasVectorLayerRenderer.prototype.disposeInternal = function() { _ol_events_.unlisten(_ol_render_canvas_.labelCache, EventType.CLEAR, this.handleFontsChanged_, this); _ol_renderer_canvas_Layer_.prototype.disposeInternal.call(this); }; @@ -120,7 +120,7 @@ _ol_renderer_canvas_VectorLayer_.prototype.disposeInternal = function() { /** * @inheritDoc */ -_ol_renderer_canvas_VectorLayer_.prototype.composeFrame = function(frameState, layerState, context) { +CanvasVectorLayerRenderer.prototype.composeFrame = function(frameState, layerState, context) { var extent = frameState.extent; var pixelRatio = frameState.pixelRatio; @@ -246,7 +246,7 @@ _ol_renderer_canvas_VectorLayer_.prototype.composeFrame = function(frameState, l /** * @inheritDoc */ -_ol_renderer_canvas_VectorLayer_.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg) { +CanvasVectorLayerRenderer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg) { if (!this.replayGroup_) { return undefined; } else { @@ -276,7 +276,7 @@ _ol_renderer_canvas_VectorLayer_.prototype.forEachFeatureAtCoordinate = function /** * @param {ol.events.Event} event Event. */ -_ol_renderer_canvas_VectorLayer_.prototype.handleFontsChanged_ = function(event) { +CanvasVectorLayerRenderer.prototype.handleFontsChanged_ = function(event) { var layer = this.getLayer(); if (layer.getVisible() && this.replayGroup_) { layer.changed(); @@ -289,7 +289,7 @@ _ol_renderer_canvas_VectorLayer_.prototype.handleFontsChanged_ = function(event) * @param {ol.events.Event} event Image style change event. * @private */ -_ol_renderer_canvas_VectorLayer_.prototype.handleStyleImageChange_ = function(event) { +CanvasVectorLayerRenderer.prototype.handleStyleImageChange_ = function(event) { this.renderIfReadyAndVisible(); }; @@ -297,12 +297,12 @@ _ol_renderer_canvas_VectorLayer_.prototype.handleStyleImageChange_ = function(ev /** * @inheritDoc */ -_ol_renderer_canvas_VectorLayer_.prototype.prepareFrame = function(frameState, layerState) { +CanvasVectorLayerRenderer.prototype.prepareFrame = function(frameState, layerState) { var vectorLayer = /** @type {ol.layer.Vector} */ (this.getLayer()); var vectorSource = vectorLayer.getSource(); - var animating = frameState.viewHints[_ol_ViewHint_.ANIMATING]; - var interacting = frameState.viewHints[_ol_ViewHint_.INTERACTING]; + var animating = frameState.viewHints[ViewHint.ANIMATING]; + var interacting = frameState.viewHints[ViewHint.INTERACTING]; var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating(); var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting(); @@ -418,7 +418,7 @@ _ol_renderer_canvas_VectorLayer_.prototype.prepareFrame = function(frameState, l * @param {ol.render.canvas.ReplayGroup} replayGroup Replay group. * @return {boolean} `true` if an image is loading. */ -_ol_renderer_canvas_VectorLayer_.prototype.renderFeature = function(feature, resolution, pixelRatio, styles, replayGroup) { +CanvasVectorLayerRenderer.prototype.renderFeature = function(feature, resolution, pixelRatio, styles, replayGroup) { if (!styles) { return false; } @@ -438,4 +438,4 @@ _ol_renderer_canvas_VectorLayer_.prototype.renderFeature = function(feature, res } return loading; }; -export default _ol_renderer_canvas_VectorLayer_; +export default CanvasVectorLayerRenderer; diff --git a/src/ol/renderer/canvas/VectorTileLayer.js b/src/ol/renderer/canvas/VectorTileLayer.js index 34bfdf829a..e8401edb67 100644 --- a/src/ol/renderer/canvas/VectorTileLayer.js +++ b/src/ol/renderer/canvas/VectorTileLayer.js @@ -11,13 +11,13 @@ import rbush from 'rbush'; import {buffer, containsCoordinate, equals, getIntersection, getTopLeft, intersects} from '../../extent.js'; import _ol_layer_VectorTileRenderType_ from '../../layer/VectorTileRenderType.js'; import {equivalent as equivalentProjection} from '../../proj.js'; -import _ol_proj_Units_ from '../../proj/Units.js'; +import Units from '../../proj/Units.js'; import ReplayType from '../../render/ReplayType.js'; import _ol_render_canvas_ from '../../render/canvas.js'; import _ol_render_canvas_ReplayGroup_ from '../../render/canvas/ReplayGroup.js'; import _ol_render_replay_ from '../../render/replay.js'; import RendererType from '../Type.js'; -import _ol_renderer_canvas_TileLayer_ from '../canvas/TileLayer.js'; +import CanvasTileLayerRenderer from '../canvas/TileLayer.js'; import _ol_renderer_vector_ from '../vector.js'; import _ol_transform_ from '../../transform.js'; @@ -27,14 +27,14 @@ import _ol_transform_ from '../../transform.js'; * @param {ol.layer.VectorTile} layer VectorTile layer. * @api */ -var _ol_renderer_canvas_VectorTileLayer_ = function(layer) { +var CanvasVectorTileLayerRenderer = function(layer) { /** * @type {CanvasRenderingContext2D} */ this.context = null; - _ol_renderer_canvas_TileLayer_.call(this, layer); + CanvasTileLayerRenderer.call(this, layer); /** * Declutter tree. @@ -68,7 +68,7 @@ var _ol_renderer_canvas_VectorTileLayer_ = function(layer) { }; -inherits(_ol_renderer_canvas_VectorTileLayer_, _ol_renderer_canvas_TileLayer_); +inherits(CanvasVectorTileLayerRenderer, CanvasTileLayerRenderer); /** @@ -77,7 +77,7 @@ inherits(_ol_renderer_canvas_VectorTileLayer_, _ol_renderer_canvas_TileLayer_); * @param {ol.layer.Layer} layer The candidate layer. * @return {boolean} The renderer can render the layer. */ -_ol_renderer_canvas_VectorTileLayer_['handles'] = function(type, layer) { +CanvasVectorTileLayerRenderer['handles'] = function(type, layer) { return type === RendererType.CANVAS && layer.getType() === LayerType.VECTOR_TILE; }; @@ -88,8 +88,8 @@ _ol_renderer_canvas_VectorTileLayer_['handles'] = function(type, layer) { * @param {ol.layer.Layer} layer The layer to be rendererd. * @return {ol.renderer.canvas.VectorTileLayer} The layer renderer. */ -_ol_renderer_canvas_VectorTileLayer_['create'] = function(mapRenderer, layer) { - return new _ol_renderer_canvas_VectorTileLayer_(/** @type {ol.layer.VectorTile} */ (layer)); +CanvasVectorTileLayerRenderer['create'] = function(mapRenderer, layer) { + return new CanvasVectorTileLayerRenderer(/** @type {ol.layer.VectorTile} */ (layer)); }; @@ -97,7 +97,7 @@ _ol_renderer_canvas_VectorTileLayer_['create'] = function(mapRenderer, layer) { * @const * @type {!Object.>} */ -_ol_renderer_canvas_VectorTileLayer_.IMAGE_REPLAYS = { +CanvasVectorTileLayerRenderer.IMAGE_REPLAYS = { 'image': [ReplayType.POLYGON, ReplayType.CIRCLE, ReplayType.LINE_STRING, ReplayType.IMAGE, ReplayType.TEXT], 'hybrid': [ReplayType.POLYGON, ReplayType.LINE_STRING] @@ -108,7 +108,7 @@ _ol_renderer_canvas_VectorTileLayer_.IMAGE_REPLAYS = { * @const * @type {!Object.>} */ -_ol_renderer_canvas_VectorTileLayer_.VECTOR_REPLAYS = { +CanvasVectorTileLayerRenderer.VECTOR_REPLAYS = { 'image': [ReplayType.DEFAULT], 'hybrid': [ReplayType.IMAGE, ReplayType.TEXT, ReplayType.DEFAULT], 'vector': _ol_render_replay_.ORDER @@ -118,16 +118,16 @@ _ol_renderer_canvas_VectorTileLayer_.VECTOR_REPLAYS = { /** * @inheritDoc */ -_ol_renderer_canvas_VectorTileLayer_.prototype.disposeInternal = function() { +CanvasVectorTileLayerRenderer.prototype.disposeInternal = function() { _ol_events_.unlisten(_ol_render_canvas_.labelCache, EventType.CLEAR, this.handleFontsChanged_, this); - _ol_renderer_canvas_TileLayer_.prototype.disposeInternal.call(this); + CanvasTileLayerRenderer.prototype.disposeInternal.call(this); }; /** * @inheritDoc */ -_ol_renderer_canvas_VectorTileLayer_.prototype.prepareFrame = function(frameState, layerState) { +CanvasVectorTileLayerRenderer.prototype.prepareFrame = function(frameState, layerState) { var layer = this.getLayer(); var layerRevision = layer.getRevision(); if (this.renderedLayerRevision_ != layerRevision) { @@ -141,7 +141,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.prepareFrame = function(frameStat } } this.renderedLayerRevision_ = layerRevision; - return _ol_renderer_canvas_TileLayer_.prototype.prepareFrame.apply(this, arguments); + return CanvasTileLayerRenderer.prototype.prepareFrame.apply(this, arguments); }; @@ -150,7 +150,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.prepareFrame = function(frameStat * @param {olx.FrameState} frameState Frame state. * @private */ -_ol_renderer_canvas_VectorTileLayer_.prototype.createReplayGroup_ = function( +CanvasVectorTileLayerRenderer.prototype.createReplayGroup_ = function( tile, frameState) { var layer = this.getLayer(); var pixelRatio = frameState.pixelRatio; @@ -226,7 +226,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.createReplayGroup_ = function( for (var i = 0, ii = features.length; i < ii; ++i) { feature = features[i]; if (reproject) { - if (tileProjection.getUnits() == _ol_proj_Units_.TILE_PIXELS) { + if (tileProjection.getUnits() == Units.TILE_PIXELS) { // projected tile extent tileProjection.setWorldExtent(sourceTileExtent); // tile extent in tile pixel space @@ -252,13 +252,13 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.createReplayGroup_ = function( /** * @inheritDoc */ -_ol_renderer_canvas_VectorTileLayer_.prototype.drawTileImage = function( +CanvasVectorTileLayerRenderer.prototype.drawTileImage = function( tile, frameState, layerState, x, y, w, h, gutter, transition) { var vectorImageTile = /** @type {ol.VectorImageTile} */ (tile); this.createReplayGroup_(vectorImageTile, frameState); if (this.context) { this.renderTileImage_(vectorImageTile, frameState, layerState); - _ol_renderer_canvas_TileLayer_.prototype.drawTileImage.apply(this, arguments); + CanvasTileLayerRenderer.prototype.drawTileImage.apply(this, arguments); } }; @@ -266,7 +266,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.drawTileImage = function( /** * @inheritDoc */ -_ol_renderer_canvas_VectorTileLayer_.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg) { +CanvasVectorTileLayerRenderer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg) { var resolution = frameState.viewState.resolution; var rotation = frameState.viewState.rotation; hitTolerance = hitTolerance == undefined ? 0 : hitTolerance; @@ -321,7 +321,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.forEachFeatureAtCoordinate = func * @return {ol.Transform} transform Transform. * @private */ -_ol_renderer_canvas_VectorTileLayer_.prototype.getReplayTransform_ = function(tile, frameState) { +CanvasVectorTileLayerRenderer.prototype.getReplayTransform_ = function(tile, frameState) { var layer = this.getLayer(); var source = /** @type {ol.source.VectorTile} */ (layer.getSource()); var tileGrid = source.getTileGrid(); @@ -348,7 +348,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.getReplayTransform_ = function(ti /** * @param {ol.events.Event} event Event. */ -_ol_renderer_canvas_VectorTileLayer_.prototype.handleFontsChanged_ = function(event) { +CanvasVectorTileLayerRenderer.prototype.handleFontsChanged_ = function(event) { var layer = this.getLayer(); if (layer.getVisible() && this.renderedLayerRevision_ !== undefined) { layer.changed(); @@ -361,7 +361,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.handleFontsChanged_ = function(ev * @param {ol.events.Event} event Image style change event. * @private */ -_ol_renderer_canvas_VectorTileLayer_.prototype.handleStyleImageChange_ = function(event) { +CanvasVectorTileLayerRenderer.prototype.handleStyleImageChange_ = function(event) { this.renderIfReadyAndVisible(); }; @@ -369,12 +369,12 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.handleStyleImageChange_ = functio /** * @inheritDoc */ -_ol_renderer_canvas_VectorTileLayer_.prototype.postCompose = function(context, frameState, layerState) { +CanvasVectorTileLayerRenderer.prototype.postCompose = function(context, frameState, layerState) { var layer = this.getLayer(); var declutterReplays = layer.getDeclutter() ? {} : null; var source = /** @type {ol.source.VectorTile} */ (layer.getSource()); var renderMode = layer.getRenderMode(); - var replayTypes = _ol_renderer_canvas_VectorTileLayer_.VECTOR_REPLAYS[renderMode]; + var replayTypes = CanvasVectorTileLayerRenderer.VECTOR_REPLAYS[renderMode]; var pixelRatio = frameState.pixelRatio; var rotation = frameState.viewState.rotation; var size = frameState.size; @@ -448,7 +448,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.postCompose = function(context, f _ol_render_canvas_.rotateAtOffset(context, rotation, /** @type {number} */ (offsetX), /** @type {number} */ (offsetY)); } - _ol_renderer_canvas_TileLayer_.prototype.postCompose.apply(this, arguments); + CanvasTileLayerRenderer.prototype.postCompose.apply(this, arguments); }; @@ -460,7 +460,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.postCompose = function(context, f * @param {ol.render.canvas.ReplayGroup} replayGroup Replay group. * @return {boolean} `true` if an image is loading. */ -_ol_renderer_canvas_VectorTileLayer_.prototype.renderFeature = function(feature, squaredTolerance, styles, replayGroup) { +CanvasVectorTileLayerRenderer.prototype.renderFeature = function(feature, squaredTolerance, styles, replayGroup) { if (!styles) { return false; } @@ -486,12 +486,12 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.renderFeature = function(feature, * @param {ol.LayerState} layerState Layer state. * @private */ -_ol_renderer_canvas_VectorTileLayer_.prototype.renderTileImage_ = function( +CanvasVectorTileLayerRenderer.prototype.renderTileImage_ = function( tile, frameState, layerState) { var layer = this.getLayer(); var replayState = tile.getReplayState(layer); var revision = layer.getRevision(); - var replays = _ol_renderer_canvas_VectorTileLayer_.IMAGE_REPLAYS[layer.getRenderMode()]; + var replays = CanvasVectorTileLayerRenderer.IMAGE_REPLAYS[layer.getRenderMode()]; if (replays && replayState.renderedTileRevision !== revision) { replayState.renderedTileRevision = revision; var tileCoord = tile.wrappedTileCoord; @@ -519,4 +519,4 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.renderTileImage_ = function( } } }; -export default _ol_renderer_canvas_VectorTileLayer_; +export default CanvasVectorTileLayerRenderer; diff --git a/src/ol/renderer/webgl/ImageLayer.js b/src/ol/renderer/webgl/ImageLayer.js index 59512f6193..701d92fd9d 100644 --- a/src/ol/renderer/webgl/ImageLayer.js +++ b/src/ol/renderer/webgl/ImageLayer.js @@ -4,7 +4,7 @@ import {ENABLE_RASTER_REPROJECTION} from '../../reproj/common.js'; import {inherits, nullFunction} from '../../index.js'; import LayerType from '../../LayerType.js'; -import _ol_ViewHint_ from '../../ViewHint.js'; +import ViewHint from '../../ViewHint.js'; import {createCanvasContext2D} from '../../dom.js'; import {getIntersection, isEmpty} from '../../extent.js'; import {TRUE} from '../../functions.js'; @@ -21,7 +21,7 @@ import _ol_webgl_Context_ from '../../webgl/Context.js'; * @param {ol.layer.Image} imageLayer Tile layer. * @api */ -var _ol_renderer_webgl_ImageLayer_ = function(mapRenderer, imageLayer) { +var WebGLImageLayerRenderer = function(mapRenderer, imageLayer) { _ol_renderer_webgl_Layer_.call(this, mapRenderer, imageLayer); @@ -46,7 +46,7 @@ var _ol_renderer_webgl_ImageLayer_ = function(mapRenderer, imageLayer) { }; -inherits(_ol_renderer_webgl_ImageLayer_, _ol_renderer_webgl_Layer_); +inherits(WebGLImageLayerRenderer, _ol_renderer_webgl_Layer_); /** @@ -55,7 +55,7 @@ inherits(_ol_renderer_webgl_ImageLayer_, _ol_renderer_webgl_Layer_); * @param {ol.layer.Layer} layer The candidate layer. * @return {boolean} The renderer can render the layer. */ -_ol_renderer_webgl_ImageLayer_['handles'] = function(type, layer) { +WebGLImageLayerRenderer['handles'] = function(type, layer) { return type === RendererType.WEBGL && layer.getType() === LayerType.IMAGE; }; @@ -66,8 +66,8 @@ _ol_renderer_webgl_ImageLayer_['handles'] = function(type, layer) { * @param {ol.layer.Layer} layer The layer to be rendererd. * @return {ol.renderer.webgl.ImageLayer} The layer renderer. */ -_ol_renderer_webgl_ImageLayer_['create'] = function(mapRenderer, layer) { - return new _ol_renderer_webgl_ImageLayer_( +WebGLImageLayerRenderer['create'] = function(mapRenderer, layer) { + return new WebGLImageLayerRenderer( /** @type {ol.renderer.webgl.Map} */ (mapRenderer), /** @type {ol.layer.Image} */ (layer) ); @@ -79,7 +79,7 @@ _ol_renderer_webgl_ImageLayer_['create'] = function(mapRenderer, layer) { * @private * @return {WebGLTexture} Texture. */ -_ol_renderer_webgl_ImageLayer_.prototype.createTexture_ = function(image) { +WebGLImageLayerRenderer.prototype.createTexture_ = function(image) { // We meet the conditions to work with non-power of two textures. // http://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences#Non-Power_of_Two_Texture_Support @@ -96,7 +96,7 @@ _ol_renderer_webgl_ImageLayer_.prototype.createTexture_ = function(image) { /** * @inheritDoc */ -_ol_renderer_webgl_ImageLayer_.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg) { +WebGLImageLayerRenderer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg) { var layer = this.getLayer(); var source = layer.getSource(); var resolution = frameState.viewState.resolution; @@ -118,7 +118,7 @@ _ol_renderer_webgl_ImageLayer_.prototype.forEachFeatureAtCoordinate = function(c /** * @inheritDoc */ -_ol_renderer_webgl_ImageLayer_.prototype.prepareFrame = function(frameState, layerState, context) { +WebGLImageLayerRenderer.prototype.prepareFrame = function(frameState, layerState, context) { var gl = this.mapRenderer.getGL(); @@ -139,7 +139,7 @@ _ol_renderer_webgl_ImageLayer_.prototype.prepareFrame = function(frameState, lay if (layerState.extent !== undefined) { renderedExtent = getIntersection(renderedExtent, layerState.extent); } - if (!hints[_ol_ViewHint_.ANIMATING] && !hints[_ol_ViewHint_.INTERACTING] && + if (!hints[ViewHint.ANIMATING] && !hints[ViewHint.INTERACTING] && !isEmpty(renderedExtent)) { var projection = viewState.projection; if (!ENABLE_RASTER_REPROJECTION) { @@ -205,7 +205,7 @@ _ol_renderer_webgl_ImageLayer_.prototype.prepareFrame = function(frameState, lay * @param {ol.Extent} imageExtent Image extent. * @private */ -_ol_renderer_webgl_ImageLayer_.prototype.updateProjectionMatrix_ = function(canvasWidth, canvasHeight, pixelRatio, +WebGLImageLayerRenderer.prototype.updateProjectionMatrix_ = function(canvasWidth, canvasHeight, pixelRatio, viewCenter, viewResolution, viewRotation, imageExtent) { var canvasExtentWidth = canvasWidth * viewResolution; @@ -231,7 +231,7 @@ _ol_renderer_webgl_ImageLayer_.prototype.updateProjectionMatrix_ = function(canv /** * @inheritDoc */ -_ol_renderer_webgl_ImageLayer_.prototype.hasFeatureAtCoordinate = function(coordinate, frameState) { +WebGLImageLayerRenderer.prototype.hasFeatureAtCoordinate = function(coordinate, frameState) { var hasFeature = this.forEachFeatureAtCoordinate(coordinate, frameState, 0, TRUE, this); return hasFeature !== undefined; }; @@ -240,7 +240,7 @@ _ol_renderer_webgl_ImageLayer_.prototype.hasFeatureAtCoordinate = function(coord /** * @inheritDoc */ -_ol_renderer_webgl_ImageLayer_.prototype.forEachLayerAtPixel = function(pixel, frameState, callback, thisArg) { +WebGLImageLayerRenderer.prototype.forEachLayerAtPixel = function(pixel, frameState, callback, thisArg) { if (!this.image_ || !this.image_.getImage()) { return undefined; } @@ -301,7 +301,7 @@ _ol_renderer_webgl_ImageLayer_.prototype.forEachLayerAtPixel = function(pixel, f * @return {ol.Transform} The transformation matrix. * @private */ -_ol_renderer_webgl_ImageLayer_.prototype.getHitTransformationMatrix_ = function(mapSize, imageSize) { +WebGLImageLayerRenderer.prototype.getHitTransformationMatrix_ = function(mapSize, imageSize) { // the first matrix takes a map pixel, flips the y-axis and scales to // a range between -1 ... 1 var mapCoordTransform = _ol_transform_.create(); @@ -326,4 +326,4 @@ _ol_renderer_webgl_ImageLayer_.prototype.getHitTransformationMatrix_ = function( return transform; }; -export default _ol_renderer_webgl_ImageLayer_; +export default WebGLImageLayerRenderer; diff --git a/src/ol/renderer/webgl/Map.js b/src/ol/renderer/webgl/Map.js index 8b32294f47..316ccfb47b 100644 --- a/src/ol/renderer/webgl/Map.js +++ b/src/ol/renderer/webgl/Map.js @@ -35,7 +35,7 @@ var WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK = 1024; * @param {ol.PluggableMap} map Map. * @api */ -var _ol_renderer_webgl_Map_ = function(container, map) { +var WebGLMapRenderer = function(container, map) { _ol_renderer_Map_.call(this, container, map); /** @@ -166,7 +166,7 @@ var _ol_renderer_webgl_Map_ = function(container, map) { this.initializeGL_(); }; -inherits(_ol_renderer_webgl_Map_, _ol_renderer_Map_); +inherits(WebGLMapRenderer, _ol_renderer_Map_); /** @@ -174,7 +174,7 @@ inherits(_ol_renderer_webgl_Map_, _ol_renderer_Map_); * @param {ol.renderer.Type} type The renderer type. * @return {boolean} The renderer can render the layer. */ -_ol_renderer_webgl_Map_['handles'] = function(type) { +WebGLMapRenderer['handles'] = function(type) { return _ol_has_.WEBGL && type === RendererType.WEBGL; }; @@ -185,8 +185,8 @@ _ol_renderer_webgl_Map_['handles'] = function(type) { * @param {ol.PluggableMap} map Map. * @return {ol.renderer.webgl.Map} The map renderer. */ -_ol_renderer_webgl_Map_['create'] = function(container, map) { - return new _ol_renderer_webgl_Map_(container, map); +WebGLMapRenderer['create'] = function(container, map) { + return new WebGLMapRenderer(container, map); }; @@ -197,7 +197,7 @@ _ol_renderer_webgl_Map_['create'] = function(container, map) { * @param {number} magFilter Mag filter. * @param {number} minFilter Min filter. */ -_ol_renderer_webgl_Map_.prototype.bindTileTexture = function(tile, tileSize, tileGutter, magFilter, minFilter) { +WebGLMapRenderer.prototype.bindTileTexture = function(tile, tileSize, tileGutter, magFilter, minFilter) { var gl = this.getGL(); var tileKey = tile.getKey(); if (this.textureCache_.containsKey(tileKey)) { @@ -260,7 +260,7 @@ _ol_renderer_webgl_Map_.prototype.bindTileTexture = function(tile, tileSize, til * @param {olx.FrameState} frameState Frame state. * @private */ -_ol_renderer_webgl_Map_.prototype.dispatchComposeEvent_ = function(type, frameState) { +WebGLMapRenderer.prototype.dispatchComposeEvent_ = function(type, frameState) { var map = this.getMap(); if (map.hasListener(type)) { var context = this.context_; @@ -286,7 +286,7 @@ _ol_renderer_webgl_Map_.prototype.dispatchComposeEvent_ = function(type, frameSt /** * @inheritDoc */ -_ol_renderer_webgl_Map_.prototype.disposeInternal = function() { +WebGLMapRenderer.prototype.disposeInternal = function() { var gl = this.getGL(); if (!gl.isContextLost()) { this.textureCache_.forEach( @@ -310,7 +310,7 @@ _ol_renderer_webgl_Map_.prototype.disposeInternal = function() { * @param {olx.FrameState} frameState Frame state. * @private */ -_ol_renderer_webgl_Map_.prototype.expireCache_ = function(map, frameState) { +WebGLMapRenderer.prototype.expireCache_ = function(map, frameState) { var gl = this.getGL(); var textureCacheEntry; while (this.textureCache_.getCount() - this.textureCacheFrameMarkerCount_ > @@ -333,7 +333,7 @@ _ol_renderer_webgl_Map_.prototype.expireCache_ = function(map, frameState) { /** * @return {ol.webgl.Context} The context. */ -_ol_renderer_webgl_Map_.prototype.getContext = function() { +WebGLMapRenderer.prototype.getContext = function() { return this.context_; }; @@ -341,7 +341,7 @@ _ol_renderer_webgl_Map_.prototype.getContext = function() { /** * @return {WebGLRenderingContext} GL. */ -_ol_renderer_webgl_Map_.prototype.getGL = function() { +WebGLMapRenderer.prototype.getGL = function() { return this.gl_; }; @@ -349,7 +349,7 @@ _ol_renderer_webgl_Map_.prototype.getGL = function() { /** * @return {ol.structs.PriorityQueue.} Tile texture queue. */ -_ol_renderer_webgl_Map_.prototype.getTileTextureQueue = function() { +WebGLMapRenderer.prototype.getTileTextureQueue = function() { return this.tileTextureQueue_; }; @@ -357,7 +357,7 @@ _ol_renderer_webgl_Map_.prototype.getTileTextureQueue = function() { /** * @inheritDoc */ -_ol_renderer_webgl_Map_.prototype.getType = function() { +WebGLMapRenderer.prototype.getType = function() { return RendererType.WEBGL; }; @@ -366,7 +366,7 @@ _ol_renderer_webgl_Map_.prototype.getType = function() { * @param {ol.events.Event} event Event. * @protected */ -_ol_renderer_webgl_Map_.prototype.handleWebGLContextLost = function(event) { +WebGLMapRenderer.prototype.handleWebGLContextLost = function(event) { event.preventDefault(); this.textureCache_.clear(); this.textureCacheFrameMarkerCount_ = 0; @@ -382,7 +382,7 @@ _ol_renderer_webgl_Map_.prototype.handleWebGLContextLost = function(event) { /** * @protected */ -_ol_renderer_webgl_Map_.prototype.handleWebGLContextRestored = function() { +WebGLMapRenderer.prototype.handleWebGLContextRestored = function() { this.initializeGL_(); this.getMap().render(); }; @@ -391,7 +391,7 @@ _ol_renderer_webgl_Map_.prototype.handleWebGLContextRestored = function() { /** * @private */ -_ol_renderer_webgl_Map_.prototype.initializeGL_ = function() { +WebGLMapRenderer.prototype.initializeGL_ = function() { var gl = this.gl_; gl.activeTexture(_ol_webgl_.TEXTURE0); gl.blendFuncSeparate( @@ -408,7 +408,7 @@ _ol_renderer_webgl_Map_.prototype.initializeGL_ = function() { * @param {ol.Tile} tile Tile. * @return {boolean} Is tile texture loaded. */ -_ol_renderer_webgl_Map_.prototype.isTileTextureLoaded = function(tile) { +WebGLMapRenderer.prototype.isTileTextureLoaded = function(tile) { return this.textureCache_.containsKey(tile.getKey()); }; @@ -416,7 +416,7 @@ _ol_renderer_webgl_Map_.prototype.isTileTextureLoaded = function(tile) { /** * @inheritDoc */ -_ol_renderer_webgl_Map_.prototype.renderFrame = function(frameState) { +WebGLMapRenderer.prototype.renderFrame = function(frameState) { var context = this.getContext(); var gl = this.getGL(); @@ -508,7 +508,7 @@ _ol_renderer_webgl_Map_.prototype.renderFrame = function(frameState) { /** * @inheritDoc */ -_ol_renderer_webgl_Map_.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg, +WebGLMapRenderer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg, layerFilter, thisArg2) { var result; @@ -541,7 +541,7 @@ _ol_renderer_webgl_Map_.prototype.forEachFeatureAtCoordinate = function(coordina /** * @inheritDoc */ -_ol_renderer_webgl_Map_.prototype.hasFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, layerFilter, thisArg) { +WebGLMapRenderer.prototype.hasFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, layerFilter, thisArg) { var hasFeature = false; if (this.getGL().isContextLost()) { @@ -573,7 +573,7 @@ _ol_renderer_webgl_Map_.prototype.hasFeatureAtCoordinate = function(coordinate, /** * @inheritDoc */ -_ol_renderer_webgl_Map_.prototype.forEachLayerAtPixel = function(pixel, frameState, callback, thisArg, +WebGLMapRenderer.prototype.forEachLayerAtPixel = function(pixel, frameState, callback, thisArg, layerFilter, thisArg2) { if (this.getGL().isContextLost()) { return false; @@ -600,4 +600,4 @@ _ol_renderer_webgl_Map_.prototype.forEachLayerAtPixel = function(pixel, frameSta } return undefined; }; -export default _ol_renderer_webgl_Map_; +export default WebGLMapRenderer; diff --git a/src/ol/renderer/webgl/TileLayer.js b/src/ol/renderer/webgl/TileLayer.js index a223738d9b..cc1317ea9f 100644 --- a/src/ol/renderer/webgl/TileLayer.js +++ b/src/ol/renderer/webgl/TileLayer.js @@ -27,7 +27,7 @@ import _ol_webgl_Buffer_ from '../../webgl/Buffer.js'; * @param {ol.layer.Tile} tileLayer Tile layer. * @api */ -var _ol_renderer_webgl_TileLayer_ = function(mapRenderer, tileLayer) { +var WebGLTileLayerRenderer = function(mapRenderer, tileLayer) { _ol_renderer_webgl_Layer_.call(this, mapRenderer, tileLayer); @@ -86,7 +86,7 @@ var _ol_renderer_webgl_TileLayer_ = function(mapRenderer, tileLayer) { }; -inherits(_ol_renderer_webgl_TileLayer_, _ol_renderer_webgl_Layer_); +inherits(WebGLTileLayerRenderer, _ol_renderer_webgl_Layer_); /** @@ -95,7 +95,7 @@ inherits(_ol_renderer_webgl_TileLayer_, _ol_renderer_webgl_Layer_); * @param {ol.layer.Layer} layer The candidate layer. * @return {boolean} The renderer can render the layer. */ -_ol_renderer_webgl_TileLayer_['handles'] = function(type, layer) { +WebGLTileLayerRenderer['handles'] = function(type, layer) { return type === RendererType.WEBGL && layer.getType() === LayerType.TILE; }; @@ -106,8 +106,8 @@ _ol_renderer_webgl_TileLayer_['handles'] = function(type, layer) { * @param {ol.layer.Layer} layer The layer to be rendererd. * @return {ol.renderer.webgl.TileLayer} The layer renderer. */ -_ol_renderer_webgl_TileLayer_['create'] = function(mapRenderer, layer) { - return new _ol_renderer_webgl_TileLayer_( +WebGLTileLayerRenderer['create'] = function(mapRenderer, layer) { + return new WebGLTileLayerRenderer( /** @type {ol.renderer.webgl.Map} */ (mapRenderer), /** @type {ol.layer.Tile} */ (layer) ); @@ -117,7 +117,7 @@ _ol_renderer_webgl_TileLayer_['create'] = function(mapRenderer, layer) { /** * @inheritDoc */ -_ol_renderer_webgl_TileLayer_.prototype.disposeInternal = function() { +WebGLTileLayerRenderer.prototype.disposeInternal = function() { var context = this.mapRenderer.getContext(); context.deleteBuffer(this.renderArrayBuffer_); _ol_renderer_webgl_Layer_.prototype.disposeInternal.call(this); @@ -127,7 +127,7 @@ _ol_renderer_webgl_TileLayer_.prototype.disposeInternal = function() { /** * @inheritDoc */ -_ol_renderer_webgl_TileLayer_.prototype.createLoadedTileFinder = function(source, projection, tiles) { +WebGLTileLayerRenderer.prototype.createLoadedTileFinder = function(source, projection, tiles) { var mapRenderer = this.mapRenderer; return ( @@ -155,7 +155,7 @@ _ol_renderer_webgl_TileLayer_.prototype.createLoadedTileFinder = function(source /** * @inheritDoc */ -_ol_renderer_webgl_TileLayer_.prototype.handleWebGLContextLost = function() { +WebGLTileLayerRenderer.prototype.handleWebGLContextLost = function() { _ol_renderer_webgl_Layer_.prototype.handleWebGLContextLost.call(this); this.locations_ = null; }; @@ -164,7 +164,7 @@ _ol_renderer_webgl_TileLayer_.prototype.handleWebGLContextLost = function() { /** * @inheritDoc */ -_ol_renderer_webgl_TileLayer_.prototype.prepareFrame = function(frameState, layerState, context) { +WebGLTileLayerRenderer.prototype.prepareFrame = function(frameState, layerState, context) { var mapRenderer = this.mapRenderer; var gl = context.getGL(); @@ -379,7 +379,7 @@ _ol_renderer_webgl_TileLayer_.prototype.prepareFrame = function(frameState, laye /** * @inheritDoc */ -_ol_renderer_webgl_TileLayer_.prototype.forEachLayerAtPixel = function(pixel, frameState, callback, thisArg) { +WebGLTileLayerRenderer.prototype.forEachLayerAtPixel = function(pixel, frameState, callback, thisArg) { if (!this.framebuffer) { return undefined; } @@ -406,4 +406,4 @@ _ol_renderer_webgl_TileLayer_.prototype.forEachLayerAtPixel = function(pixel, fr return undefined; } }; -export default _ol_renderer_webgl_TileLayer_; +export default WebGLTileLayerRenderer; diff --git a/src/ol/renderer/webgl/VectorLayer.js b/src/ol/renderer/webgl/VectorLayer.js index 5a8ef45505..a13c2eac19 100644 --- a/src/ol/renderer/webgl/VectorLayer.js +++ b/src/ol/renderer/webgl/VectorLayer.js @@ -3,7 +3,7 @@ */ import {getUid, inherits} from '../../index.js'; import LayerType from '../../LayerType.js'; -import _ol_ViewHint_ from '../../ViewHint.js'; +import ViewHint from '../../ViewHint.js'; import {buffer, containsExtent, createEmpty} from '../../extent.js'; import _ol_render_webgl_ReplayGroup_ from '../../render/webgl/ReplayGroup.js'; import RendererType from '../Type.js'; @@ -18,7 +18,7 @@ import _ol_transform_ from '../../transform.js'; * @param {ol.layer.Vector} vectorLayer Vector layer. * @api */ -var _ol_renderer_webgl_VectorLayer_ = function(mapRenderer, vectorLayer) { +var WebGLVectorLayerRenderer = function(mapRenderer, vectorLayer) { _ol_renderer_webgl_Layer_.call(this, mapRenderer, vectorLayer); @@ -67,7 +67,7 @@ var _ol_renderer_webgl_VectorLayer_ = function(mapRenderer, vectorLayer) { }; -inherits(_ol_renderer_webgl_VectorLayer_, _ol_renderer_webgl_Layer_); +inherits(WebGLVectorLayerRenderer, _ol_renderer_webgl_Layer_); /** @@ -76,7 +76,7 @@ inherits(_ol_renderer_webgl_VectorLayer_, _ol_renderer_webgl_Layer_); * @param {ol.layer.Layer} layer The candidate layer. * @return {boolean} The renderer can render the layer. */ -_ol_renderer_webgl_VectorLayer_['handles'] = function(type, layer) { +WebGLVectorLayerRenderer['handles'] = function(type, layer) { return type === RendererType.WEBGL && layer.getType() === LayerType.VECTOR; }; @@ -87,8 +87,8 @@ _ol_renderer_webgl_VectorLayer_['handles'] = function(type, layer) { * @param {ol.layer.Layer} layer The layer to be rendererd. * @return {ol.renderer.webgl.VectorLayer} The layer renderer. */ -_ol_renderer_webgl_VectorLayer_['create'] = function(mapRenderer, layer) { - return new _ol_renderer_webgl_VectorLayer_( +WebGLVectorLayerRenderer['create'] = function(mapRenderer, layer) { + return new WebGLVectorLayerRenderer( /** @type {ol.renderer.webgl.Map} */ (mapRenderer), /** @type {ol.layer.Vector} */ (layer) ); @@ -98,7 +98,7 @@ _ol_renderer_webgl_VectorLayer_['create'] = function(mapRenderer, layer) { /** * @inheritDoc */ -_ol_renderer_webgl_VectorLayer_.prototype.composeFrame = function(frameState, layerState, context) { +WebGLVectorLayerRenderer.prototype.composeFrame = function(frameState, layerState, context) { this.layerState_ = layerState; var viewState = frameState.viewState; var replayGroup = this.replayGroup_; @@ -121,7 +121,7 @@ _ol_renderer_webgl_VectorLayer_.prototype.composeFrame = function(frameState, la /** * @inheritDoc */ -_ol_renderer_webgl_VectorLayer_.prototype.disposeInternal = function() { +WebGLVectorLayerRenderer.prototype.disposeInternal = function() { var replayGroup = this.replayGroup_; if (replayGroup) { var context = this.mapRenderer.getContext(); @@ -135,7 +135,7 @@ _ol_renderer_webgl_VectorLayer_.prototype.disposeInternal = function() { /** * @inheritDoc */ -_ol_renderer_webgl_VectorLayer_.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg) { +WebGLVectorLayerRenderer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg) { if (!this.replayGroup_ || !this.layerState_) { return undefined; } else { @@ -167,7 +167,7 @@ _ol_renderer_webgl_VectorLayer_.prototype.forEachFeatureAtCoordinate = function( /** * @inheritDoc */ -_ol_renderer_webgl_VectorLayer_.prototype.hasFeatureAtCoordinate = function(coordinate, frameState) { +WebGLVectorLayerRenderer.prototype.hasFeatureAtCoordinate = function(coordinate, frameState) { if (!this.replayGroup_ || !this.layerState_) { return false; } else { @@ -185,7 +185,7 @@ _ol_renderer_webgl_VectorLayer_.prototype.hasFeatureAtCoordinate = function(coor /** * @inheritDoc */ -_ol_renderer_webgl_VectorLayer_.prototype.forEachLayerAtPixel = function(pixel, frameState, callback, thisArg) { +WebGLVectorLayerRenderer.prototype.forEachLayerAtPixel = function(pixel, frameState, callback, thisArg) { var coordinate = _ol_transform_.apply( frameState.pixelToCoordinateTransform, pixel.slice()); var hasFeature = this.hasFeatureAtCoordinate(coordinate, frameState); @@ -203,7 +203,7 @@ _ol_renderer_webgl_VectorLayer_.prototype.forEachLayerAtPixel = function(pixel, * @param {ol.events.Event} event Image style change event. * @private */ -_ol_renderer_webgl_VectorLayer_.prototype.handleStyleImageChange_ = function(event) { +WebGLVectorLayerRenderer.prototype.handleStyleImageChange_ = function(event) { this.renderIfReadyAndVisible(); }; @@ -211,12 +211,12 @@ _ol_renderer_webgl_VectorLayer_.prototype.handleStyleImageChange_ = function(eve /** * @inheritDoc */ -_ol_renderer_webgl_VectorLayer_.prototype.prepareFrame = function(frameState, layerState, context) { +WebGLVectorLayerRenderer.prototype.prepareFrame = function(frameState, layerState, context) { var vectorLayer = /** @type {ol.layer.Vector} */ (this.getLayer()); var vectorSource = vectorLayer.getSource(); - var animating = frameState.viewHints[_ol_ViewHint_.ANIMATING]; - var interacting = frameState.viewHints[_ol_ViewHint_.INTERACTING]; + var animating = frameState.viewHints[ViewHint.ANIMATING]; + var interacting = frameState.viewHints[ViewHint.INTERACTING]; var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating(); var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting(); @@ -317,7 +317,7 @@ _ol_renderer_webgl_VectorLayer_.prototype.prepareFrame = function(frameState, la * @param {ol.render.webgl.ReplayGroup} replayGroup Replay group. * @return {boolean} `true` if an image is loading. */ -_ol_renderer_webgl_VectorLayer_.prototype.renderFeature = function(feature, resolution, pixelRatio, styles, replayGroup) { +WebGLVectorLayerRenderer.prototype.renderFeature = function(feature, resolution, pixelRatio, styles, replayGroup) { if (!styles) { return false; } @@ -337,4 +337,4 @@ _ol_renderer_webgl_VectorLayer_.prototype.renderFeature = function(feature, reso } return loading; }; -export default _ol_renderer_webgl_VectorLayer_; +export default WebGLVectorLayerRenderer; diff --git a/src/ol/source/BingMaps.js b/src/ol/source/BingMaps.js index 7582db5cf1..485f0055f7 100644 --- a/src/ol/source/BingMaps.js +++ b/src/ol/source/BingMaps.js @@ -7,7 +7,7 @@ import {applyTransform, intersects} from '../extent.js'; import _ol_net_ from '../net.js'; import {get as getProjection, getTransformFromProjections} from '../proj.js'; import SourceState from '../source/State.js'; -import _ol_source_TileImage_ from '../source/TileImage.js'; +import TileImage from '../source/TileImage.js'; import _ol_tilecoord_ from '../tilecoord.js'; import _ol_tilegrid_ from '../tilegrid.js'; @@ -20,7 +20,7 @@ import _ol_tilegrid_ from '../tilegrid.js'; * @param {olx.source.BingMapsOptions} options Bing Maps options. * @api */ -var _ol_source_BingMaps_ = function(options) { +var BingMaps = function(options) { /** * @private @@ -28,7 +28,7 @@ var _ol_source_BingMaps_ = function(options) { */ this.hidpi_ = options.hidpi !== undefined ? options.hidpi : false; - _ol_source_TileImage_.call(this, { + TileImage.call(this, { cacheSize: options.cacheSize, crossOrigin: 'anonymous', opaque: true, @@ -75,7 +75,7 @@ var _ol_source_BingMaps_ = function(options) { }; -inherits(_ol_source_BingMaps_, _ol_source_TileImage_); +inherits(BingMaps, TileImage); /** @@ -85,7 +85,7 @@ inherits(_ol_source_BingMaps_, _ol_source_TileImage_); * @type {string} * @api */ -_ol_source_BingMaps_.TOS_ATTRIBUTION = '' + 'Terms of Use'; @@ -96,7 +96,7 @@ _ol_source_BingMaps_.TOS_ATTRIBUTION = '= 200 && client.status < 300) { @@ -148,7 +148,7 @@ _ol_source_CartoDB_.prototype.handleInitResponse_ = function(paramHash, event) { * @private * @param {Event} event Event. */ -_ol_source_CartoDB_.prototype.handleInitError_ = function(event) { +CartoDB.prototype.handleInitError_ = function(event) { this.setState(SourceState.ERROR); }; @@ -158,9 +158,9 @@ _ol_source_CartoDB_.prototype.handleInitError_ = function(event) { * @param {CartoDBLayerInfo} data Result of carto db call. * @private */ -_ol_source_CartoDB_.prototype.applyTemplate_ = function(data) { +CartoDB.prototype.applyTemplate_ = function(data) { var tilesUrl = 'https://' + data.cdn_url.https + '/' + this.account_ + '/api/v1/map/' + data.layergroupid + '/{z}/{x}/{y}.png'; this.setUrl(tilesUrl); }; -export default _ol_source_CartoDB_; +export default CartoDB; diff --git a/src/ol/source/Cluster.js b/src/ol/source/Cluster.js index 55c8ce2eee..75ce57f452 100644 --- a/src/ol/source/Cluster.js +++ b/src/ol/source/Cluster.js @@ -4,12 +4,12 @@ import {getUid, inherits} from '../index.js'; import {assert} from '../asserts.js'; -import _ol_Feature_ from '../Feature.js'; +import Feature from '../Feature.js'; import _ol_coordinate_ from '../coordinate.js'; import EventType from '../events/EventType.js'; import {buffer, createEmpty, createOrUpdateFromCoordinate} from '../extent.js'; import Point from '../geom/Point.js'; -import _ol_source_Vector_ from '../source/Vector.js'; +import VectorSource from '../source/Vector.js'; /** * @classdesc @@ -22,8 +22,8 @@ import _ol_source_Vector_ from '../source/Vector.js'; * @extends {ol.source.Vector} * @api */ -var _ol_source_Cluster_ = function(options) { - _ol_source_Vector_.call(this, { +var Cluster = function(options) { + VectorSource.call(this, { attributions: options.attributions, extent: options.extent, projection: options.projection, @@ -67,10 +67,10 @@ var _ol_source_Cluster_ = function(options) { this.source = options.source; this.source.on(EventType.CHANGE, - _ol_source_Cluster_.prototype.refresh, this); + Cluster.prototype.refresh, this); }; -inherits(_ol_source_Cluster_, _ol_source_Vector_); +inherits(Cluster, VectorSource); /** @@ -78,7 +78,7 @@ inherits(_ol_source_Cluster_, _ol_source_Vector_); * @return {number} Distance. * @api */ -_ol_source_Cluster_.prototype.getDistance = function() { +Cluster.prototype.getDistance = function() { return this.distance; }; @@ -88,7 +88,7 @@ _ol_source_Cluster_.prototype.getDistance = function() { * @return {ol.source.Vector} Source. * @api */ -_ol_source_Cluster_.prototype.getSource = function() { +Cluster.prototype.getSource = function() { return this.source; }; @@ -96,7 +96,7 @@ _ol_source_Cluster_.prototype.getSource = function() { /** * @inheritDoc */ -_ol_source_Cluster_.prototype.loadFeatures = function(extent, resolution, +Cluster.prototype.loadFeatures = function(extent, resolution, projection) { this.source.loadFeatures(extent, resolution, projection); if (resolution !== this.resolution) { @@ -113,7 +113,7 @@ _ol_source_Cluster_.prototype.loadFeatures = function(extent, resolution, * @param {number} distance The distance in pixels. * @api */ -_ol_source_Cluster_.prototype.setDistance = function(distance) { +Cluster.prototype.setDistance = function(distance) { this.distance = distance; this.refresh(); }; @@ -123,18 +123,18 @@ _ol_source_Cluster_.prototype.setDistance = function(distance) { * handle the source changing * @override */ -_ol_source_Cluster_.prototype.refresh = function() { +Cluster.prototype.refresh = function() { this.clear(); this.cluster(); this.addFeatures(this.features); - _ol_source_Vector_.prototype.refresh.call(this); + VectorSource.prototype.refresh.call(this); }; /** * @protected */ -_ol_source_Cluster_.prototype.cluster = function() { +Cluster.prototype.cluster = function() { if (this.resolution === undefined) { return; } @@ -179,7 +179,7 @@ _ol_source_Cluster_.prototype.cluster = function() { * @return {ol.Feature} The cluster feature. * @protected */ -_ol_source_Cluster_.prototype.createCluster = function(features) { +Cluster.prototype.createCluster = function(features) { var centroid = [0, 0]; for (var i = features.length - 1; i >= 0; --i) { var geometry = this.geometryFunction(features[i]); @@ -191,8 +191,8 @@ _ol_source_Cluster_.prototype.createCluster = function(features) { } _ol_coordinate_.scale(centroid, 1 / features.length); - var cluster = new _ol_Feature_(new Point(centroid)); + var cluster = new Feature(new Point(centroid)); cluster.set('features', features); return cluster; }; -export default _ol_source_Cluster_; +export default Cluster; diff --git a/src/ol/source/Image.js b/src/ol/source/Image.js index fa484c8d62..cf7e354042 100644 --- a/src/ol/source/Image.js +++ b/src/ol/source/Image.js @@ -23,7 +23,7 @@ import Source from '../source/Source.js'; * @param {ol.SourceImageOptions} options Single image source options. * @api */ -var _ol_source_Image_ = function(options) { +var ImageSource = function(options) { Source.call(this, { attributions: options.attributions, extent: options.extent, @@ -53,14 +53,14 @@ var _ol_source_Image_ = function(options) { this.reprojectedRevision_ = 0; }; -inherits(_ol_source_Image_, Source); +inherits(ImageSource, Source); /** * @return {Array.} Resolutions. * @override */ -_ol_source_Image_.prototype.getResolutions = function() { +ImageSource.prototype.getResolutions = function() { return this.resolutions_; }; @@ -70,7 +70,7 @@ _ol_source_Image_.prototype.getResolutions = function() { * @param {number} resolution Resolution. * @return {number} Resolution. */ -_ol_source_Image_.prototype.findNearestResolution = function(resolution) { +ImageSource.prototype.findNearestResolution = function(resolution) { if (this.resolutions_) { var idx = linearFindNearest(this.resolutions_, resolution, 0); resolution = this.resolutions_[idx]; @@ -86,7 +86,7 @@ _ol_source_Image_.prototype.findNearestResolution = function(resolution) { * @param {ol.proj.Projection} projection Projection. * @return {ol.ImageBase} Single image. */ -_ol_source_Image_.prototype.getImage = function(extent, resolution, pixelRatio, projection) { +ImageSource.prototype.getImage = function(extent, resolution, pixelRatio, projection) { var sourceProjection = this.getProjection(); if (!ENABLE_RASTER_REPROJECTION || !sourceProjection || @@ -131,7 +131,7 @@ _ol_source_Image_.prototype.getImage = function(extent, resolution, pixelRatio, * @return {ol.ImageBase} Single image. * @protected */ -_ol_source_Image_.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) {}; +ImageSource.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) {}; /** @@ -139,22 +139,22 @@ _ol_source_Image_.prototype.getImageInternal = function(extent, resolution, pixe * @param {ol.events.Event} event Event. * @protected */ -_ol_source_Image_.prototype.handleImageChange = function(event) { +ImageSource.prototype.handleImageChange = function(event) { var image = /** @type {ol.Image} */ (event.target); switch (image.getState()) { case ImageState.LOADING: this.dispatchEvent( - new _ol_source_Image_.Event(_ol_source_Image_.EventType_.IMAGELOADSTART, + new ImageSource.Event(ImageSource.EventType_.IMAGELOADSTART, image)); break; case ImageState.LOADED: this.dispatchEvent( - new _ol_source_Image_.Event(_ol_source_Image_.EventType_.IMAGELOADEND, + new ImageSource.Event(ImageSource.EventType_.IMAGELOADEND, image)); break; case ImageState.ERROR: this.dispatchEvent( - new _ol_source_Image_.Event(_ol_source_Image_.EventType_.IMAGELOADERROR, + new ImageSource.Event(ImageSource.EventType_.IMAGELOADERROR, image)); break; default: @@ -169,7 +169,7 @@ _ol_source_Image_.prototype.handleImageChange = function(event) { * @param {ol.Image} image Image. * @param {string} src Source. */ -_ol_source_Image_.defaultImageLoadFunction = function(image, src) { +ImageSource.defaultImageLoadFunction = function(image, src) { image.getImage().src = src; }; @@ -185,7 +185,7 @@ _ol_source_Image_.defaultImageLoadFunction = function(image, src) { * @param {string} type Type. * @param {ol.Image} image The image. */ -_ol_source_Image_.Event = function(type, image) { +ImageSource.Event = function(type, image) { Event.call(this, type); @@ -197,14 +197,14 @@ _ol_source_Image_.Event = function(type, image) { this.image = image; }; -inherits(_ol_source_Image_.Event, Event); +inherits(ImageSource.Event, Event); /** * @enum {string} * @private */ -_ol_source_Image_.EventType_ = { +ImageSource.EventType_ = { /** * Triggered when an image starts loading. @@ -228,4 +228,4 @@ _ol_source_Image_.EventType_ = { IMAGELOADERROR: 'imageloaderror' }; -export default _ol_source_Image_; +export default ImageSource; diff --git a/src/ol/source/ImageArcGISRest.js b/src/ol/source/ImageArcGISRest.js index ca9092dbf0..8ae61c4790 100644 --- a/src/ol/source/ImageArcGISRest.js +++ b/src/ol/source/ImageArcGISRest.js @@ -8,7 +8,7 @@ import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {containsExtent, getHeight, getWidth} from '../extent.js'; import _ol_obj_ from '../obj.js'; -import _ol_source_Image_ from '../source/Image.js'; +import ImageSource from '../source/Image.js'; import _ol_uri_ from '../uri.js'; /** @@ -26,11 +26,11 @@ import _ol_uri_ from '../uri.js'; * @param {olx.source.ImageArcGISRestOptions=} opt_options Image ArcGIS Rest Options. * @api */ -var _ol_source_ImageArcGISRest_ = function(opt_options) { +var ImageArcGISRest = function(opt_options) { var options = opt_options || {}; - _ol_source_Image_.call(this, { + ImageSource.call(this, { attributions: options.attributions, projection: options.projection, resolutions: options.resolutions @@ -60,7 +60,7 @@ var _ol_source_ImageArcGISRest_ = function(opt_options) { * @type {ol.ImageLoadFunctionType} */ this.imageLoadFunction_ = options.imageLoadFunction !== undefined ? - options.imageLoadFunction : _ol_source_Image_.defaultImageLoadFunction; + options.imageLoadFunction : ImageSource.defaultImageLoadFunction; /** @@ -96,7 +96,7 @@ var _ol_source_ImageArcGISRest_ = function(opt_options) { }; -inherits(_ol_source_ImageArcGISRest_, _ol_source_Image_); +inherits(ImageArcGISRest, ImageSource); /** @@ -105,7 +105,7 @@ inherits(_ol_source_ImageArcGISRest_, _ol_source_Image_); * @return {Object} Params. * @api */ -_ol_source_ImageArcGISRest_.prototype.getParams = function() { +ImageArcGISRest.prototype.getParams = function() { return this.params_; }; @@ -113,7 +113,7 @@ _ol_source_ImageArcGISRest_.prototype.getParams = function() { /** * @inheritDoc */ -_ol_source_ImageArcGISRest_.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) { +ImageArcGISRest.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) { if (this.url_ === undefined) { return null; @@ -186,7 +186,7 @@ _ol_source_ImageArcGISRest_.prototype.getImageInternal = function(extent, resolu * @return {ol.ImageLoadFunctionType} The image load function. * @api */ -_ol_source_ImageArcGISRest_.prototype.getImageLoadFunction = function() { +ImageArcGISRest.prototype.getImageLoadFunction = function() { return this.imageLoadFunction_; }; @@ -200,7 +200,7 @@ _ol_source_ImageArcGISRest_.prototype.getImageLoadFunction = function() { * @return {string} Request URL. * @private */ -_ol_source_ImageArcGISRest_.prototype.getRequestUrl_ = function(extent, size, pixelRatio, projection, params) { +ImageArcGISRest.prototype.getRequestUrl_ = function(extent, size, pixelRatio, projection, params) { // ArcGIS Server only wants the numeric portion of the projection ID. var srid = projection.getCode().split(':').pop(); @@ -227,7 +227,7 @@ _ol_source_ImageArcGISRest_.prototype.getRequestUrl_ = function(extent, size, pi * @return {string|undefined} URL. * @api */ -_ol_source_ImageArcGISRest_.prototype.getUrl = function() { +ImageArcGISRest.prototype.getUrl = function() { return this.url_; }; @@ -237,7 +237,7 @@ _ol_source_ImageArcGISRest_.prototype.getUrl = function() { * @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function. * @api */ -_ol_source_ImageArcGISRest_.prototype.setImageLoadFunction = function(imageLoadFunction) { +ImageArcGISRest.prototype.setImageLoadFunction = function(imageLoadFunction) { this.image_ = null; this.imageLoadFunction_ = imageLoadFunction; this.changed(); @@ -249,7 +249,7 @@ _ol_source_ImageArcGISRest_.prototype.setImageLoadFunction = function(imageLoadF * @param {string|undefined} url URL. * @api */ -_ol_source_ImageArcGISRest_.prototype.setUrl = function(url) { +ImageArcGISRest.prototype.setUrl = function(url) { if (url != this.url_) { this.url_ = url; this.image_ = null; @@ -263,9 +263,9 @@ _ol_source_ImageArcGISRest_.prototype.setUrl = function(url) { * @param {Object} params Params. * @api */ -_ol_source_ImageArcGISRest_.prototype.updateParams = function(params) { +ImageArcGISRest.prototype.updateParams = function(params) { _ol_obj_.assign(this.params_, params); this.image_ = null; this.changed(); }; -export default _ol_source_ImageArcGISRest_; +export default ImageArcGISRest; diff --git a/src/ol/source/ImageCanvas.js b/src/ol/source/ImageCanvas.js index 26a98e7f44..249ff6d687 100644 --- a/src/ol/source/ImageCanvas.js +++ b/src/ol/source/ImageCanvas.js @@ -2,9 +2,9 @@ * @module ol/source/ImageCanvas */ import {inherits} from '../index.js'; -import _ol_ImageCanvas_ from '../ImageCanvas.js'; +import ImageCanvas from '../ImageCanvas.js'; import {containsExtent, getHeight, getWidth, scaleFromCenter} from '../extent.js'; -import _ol_source_Image_ from '../source/Image.js'; +import ImageSource from '../source/Image.js'; /** * @classdesc @@ -15,9 +15,9 @@ import _ol_source_Image_ from '../source/Image.js'; * @param {olx.source.ImageCanvasOptions} options Constructor options. * @api */ -var _ol_source_ImageCanvas_ = function(options) { +var ImageCanvasSource = function(options) { - _ol_source_Image_.call(this, { + ImageSource.call(this, { attributions: options.attributions, projection: options.projection, resolutions: options.resolutions, @@ -51,13 +51,13 @@ var _ol_source_ImageCanvas_ = function(options) { }; -inherits(_ol_source_ImageCanvas_, _ol_source_Image_); +inherits(ImageCanvasSource, ImageSource); /** * @inheritDoc */ -_ol_source_ImageCanvas_.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) { +ImageCanvasSource.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) { resolution = this.findNearestResolution(resolution); var canvas = this.canvas_; @@ -78,11 +78,11 @@ _ol_source_ImageCanvas_.prototype.getImageInternal = function(extent, resolution var canvasElement = this.canvasFunction_( extent, resolution, pixelRatio, size, projection); if (canvasElement) { - canvas = new _ol_ImageCanvas_(extent, resolution, pixelRatio, canvasElement); + canvas = new ImageCanvas(extent, resolution, pixelRatio, canvasElement); } this.canvas_ = canvas; this.renderedRevision_ = this.getRevision(); return canvas; }; -export default _ol_source_ImageCanvas_; +export default ImageCanvasSource; diff --git a/src/ol/source/ImageMapGuide.js b/src/ol/source/ImageMapGuide.js index dcd10d84b4..540e00e82c 100644 --- a/src/ol/source/ImageMapGuide.js +++ b/src/ol/source/ImageMapGuide.js @@ -7,7 +7,7 @@ import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {containsExtent, getCenter, getHeight, getWidth, scaleFromCenter} from '../extent.js'; import _ol_obj_ from '../obj.js'; -import _ol_source_Image_ from '../source/Image.js'; +import ImageSource from '../source/Image.js'; import _ol_uri_ from '../uri.js'; /** @@ -20,9 +20,9 @@ import _ol_uri_ from '../uri.js'; * @param {olx.source.ImageMapGuideOptions} options Options. * @api */ -var _ol_source_ImageMapGuide_ = function(options) { +var ImageMapGuide = function(options) { - _ol_source_Image_.call(this, { + ImageSource.call(this, { projection: options.projection, resolutions: options.resolutions }); @@ -58,7 +58,7 @@ var _ol_source_ImageMapGuide_ = function(options) { * @type {ol.ImageLoadFunctionType} */ this.imageLoadFunction_ = options.imageLoadFunction !== undefined ? - options.imageLoadFunction : _ol_source_Image_.defaultImageLoadFunction; + options.imageLoadFunction : ImageSource.defaultImageLoadFunction; /** * @private @@ -100,7 +100,7 @@ var _ol_source_ImageMapGuide_ = function(options) { }; -inherits(_ol_source_ImageMapGuide_, _ol_source_Image_); +inherits(ImageMapGuide, ImageSource); /** @@ -109,7 +109,7 @@ inherits(_ol_source_ImageMapGuide_, _ol_source_Image_); * @return {Object} Params. * @api */ -_ol_source_ImageMapGuide_.prototype.getParams = function() { +ImageMapGuide.prototype.getParams = function() { return this.params_; }; @@ -117,7 +117,7 @@ _ol_source_ImageMapGuide_.prototype.getParams = function() { /** * @inheritDoc */ -_ol_source_ImageMapGuide_.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) { +ImageMapGuide.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) { resolution = this.findNearestResolution(resolution); pixelRatio = this.hidpi_ ? pixelRatio : 1; @@ -161,7 +161,7 @@ _ol_source_ImageMapGuide_.prototype.getImageInternal = function(extent, resoluti * @return {ol.ImageLoadFunctionType} The image load function. * @api */ -_ol_source_ImageMapGuide_.prototype.getImageLoadFunction = function() { +ImageMapGuide.prototype.getImageLoadFunction = function() { return this.imageLoadFunction_; }; @@ -173,7 +173,7 @@ _ol_source_ImageMapGuide_.prototype.getImageLoadFunction = function() { * @param {number} dpi The display resolution. * @return {number} The computed map scale. */ -_ol_source_ImageMapGuide_.getScale = function(extent, size, metersPerUnit, dpi) { +ImageMapGuide.getScale = function(extent, size, metersPerUnit, dpi) { var mcsW = getWidth(extent); var mcsH = getHeight(extent); var devW = size[0]; @@ -192,7 +192,7 @@ _ol_source_ImageMapGuide_.getScale = function(extent, size, metersPerUnit, dpi) * @param {Object} params Params. * @api */ -_ol_source_ImageMapGuide_.prototype.updateParams = function(params) { +ImageMapGuide.prototype.updateParams = function(params) { _ol_obj_.assign(this.params_, params); this.changed(); }; @@ -206,8 +206,8 @@ _ol_source_ImageMapGuide_.prototype.updateParams = function(params) { * @param {ol.proj.Projection} projection Projection. * @return {string} The mapagent map image request URL. */ -_ol_source_ImageMapGuide_.prototype.getUrl = function(baseUrl, params, extent, size, projection) { - var scale = _ol_source_ImageMapGuide_.getScale(extent, size, +ImageMapGuide.prototype.getUrl = function(baseUrl, params, extent, size, projection) { + var scale = ImageMapGuide.getScale(extent, size, this.metersPerUnit_, this.displayDpi_); var center = getCenter(extent); var baseParams = { @@ -233,10 +233,10 @@ _ol_source_ImageMapGuide_.prototype.getUrl = function(baseUrl, params, extent, s * @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function. * @api */ -_ol_source_ImageMapGuide_.prototype.setImageLoadFunction = function( +ImageMapGuide.prototype.setImageLoadFunction = function( imageLoadFunction) { this.image_ = null; this.imageLoadFunction_ = imageLoadFunction; this.changed(); }; -export default _ol_source_ImageMapGuide_; +export default ImageMapGuide; diff --git a/src/ol/source/ImageStatic.js b/src/ol/source/ImageStatic.js index 4c269736d2..099e88e9e5 100644 --- a/src/ol/source/ImageStatic.js +++ b/src/ol/source/ImageStatic.js @@ -9,7 +9,7 @@ import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {intersects, getHeight, getWidth} from '../extent.js'; import {get as getProjection} from '../proj.js'; -import _ol_source_Image_ from '../source/Image.js'; +import ImageSource from '../source/Image.js'; /** * @classdesc @@ -20,7 +20,7 @@ import _ol_source_Image_ from '../source/Image.js'; * @param {olx.source.ImageStaticOptions} options Options. * @api */ -var _ol_source_ImageStatic_ = function(options) { +var Static = function(options) { var imageExtent = options.imageExtent; var crossOrigin = options.crossOrigin !== undefined ? @@ -28,9 +28,9 @@ var _ol_source_ImageStatic_ = function(options) { var /** @type {ol.ImageLoadFunctionType} */ imageLoadFunction = options.imageLoadFunction !== undefined ? - options.imageLoadFunction : _ol_source_Image_.defaultImageLoadFunction; + options.imageLoadFunction : ImageSource.defaultImageLoadFunction; - _ol_source_Image_.call(this, { + ImageSource.call(this, { attributions: options.attributions, projection: getProjection(options.projection) }); @@ -52,13 +52,13 @@ var _ol_source_ImageStatic_ = function(options) { }; -inherits(_ol_source_ImageStatic_, _ol_source_Image_); +inherits(Static, ImageSource); /** * @inheritDoc */ -_ol_source_ImageStatic_.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) { +Static.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) { if (intersects(extent, this.image_.getExtent())) { return this.image_; } @@ -69,7 +69,7 @@ _ol_source_ImageStatic_.prototype.getImageInternal = function(extent, resolution /** * @inheritDoc */ -_ol_source_ImageStatic_.prototype.handleImageChange = function(evt) { +Static.prototype.handleImageChange = function(evt) { if (this.image_.getState() == ImageState.LOADED) { var imageExtent = this.image_.getExtent(); var image = this.image_.getImage(); @@ -91,6 +91,6 @@ _ol_source_ImageStatic_.prototype.handleImageChange = function(evt) { this.image_.setImage(canvas); } } - _ol_source_Image_.prototype.handleImageChange.call(this, evt); + ImageSource.prototype.handleImageChange.call(this, evt); }; -export default _ol_source_ImageStatic_; +export default Static; diff --git a/src/ol/source/ImageWMS.js b/src/ol/source/ImageWMS.js index f510358031..b6eb1749ed 100644 --- a/src/ol/source/ImageWMS.js +++ b/src/ol/source/ImageWMS.js @@ -12,7 +12,7 @@ import {containsExtent, getCenter, getForViewAndSize, getHeight, getWidth} from import _ol_obj_ from '../obj.js'; import {get as getProjection, transform} from '../proj.js'; import _ol_reproj_ from '../reproj.js'; -import _ol_source_Image_ from '../source/Image.js'; +import ImageSource from '../source/Image.js'; import WMSServerType from '../source/WMSServerType.js'; import _ol_string_ from '../string.js'; import _ol_uri_ from '../uri.js'; @@ -27,11 +27,11 @@ import _ol_uri_ from '../uri.js'; * @param {olx.source.ImageWMSOptions=} opt_options Options. * @api */ -var _ol_source_ImageWMS_ = function(opt_options) { +var ImageWMS = function(opt_options) { var options = opt_options || {}; - _ol_source_Image_.call(this, { + ImageSource.call(this, { attributions: options.attributions, projection: options.projection, resolutions: options.resolutions @@ -55,7 +55,7 @@ var _ol_source_ImageWMS_ = function(opt_options) { * @type {ol.ImageLoadFunctionType} */ this.imageLoadFunction_ = options.imageLoadFunction !== undefined ? - options.imageLoadFunction : _ol_source_Image_.defaultImageLoadFunction; + options.imageLoadFunction : ImageSource.defaultImageLoadFunction; /** * @private @@ -108,7 +108,7 @@ var _ol_source_ImageWMS_ = function(opt_options) { }; -inherits(_ol_source_ImageWMS_, _ol_source_Image_); +inherits(ImageWMS, ImageSource); /** @@ -116,7 +116,7 @@ inherits(_ol_source_ImageWMS_, _ol_source_Image_); * @type {ol.Size} * @private */ -_ol_source_ImageWMS_.GETFEATUREINFO_IMAGE_SIZE_ = [101, 101]; +ImageWMS.GETFEATUREINFO_IMAGE_SIZE_ = [101, 101]; /** @@ -133,7 +133,7 @@ _ol_source_ImageWMS_.GETFEATUREINFO_IMAGE_SIZE_ = [101, 101]; * @return {string|undefined} GetFeatureInfo URL. * @api */ -_ol_source_ImageWMS_.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projection, params) { +ImageWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projection, params) { if (this.url_ === undefined) { return undefined; } @@ -146,7 +146,7 @@ _ol_source_ImageWMS_.prototype.getGetFeatureInfoUrl = function(coordinate, resol } var extent = getForViewAndSize(coordinate, resolution, 0, - _ol_source_ImageWMS_.GETFEATUREINFO_IMAGE_SIZE_); + ImageWMS.GETFEATUREINFO_IMAGE_SIZE_); var baseParams = { 'SERVICE': 'WMS', @@ -164,7 +164,7 @@ _ol_source_ImageWMS_.prototype.getGetFeatureInfoUrl = function(coordinate, resol baseParams[this.v13_ ? 'J' : 'Y'] = y; return this.getRequestUrl_( - extent, _ol_source_ImageWMS_.GETFEATUREINFO_IMAGE_SIZE_, + extent, ImageWMS.GETFEATUREINFO_IMAGE_SIZE_, 1, sourceProjectionObj || projectionObj, baseParams); }; @@ -175,7 +175,7 @@ _ol_source_ImageWMS_.prototype.getGetFeatureInfoUrl = function(coordinate, resol * @return {Object} Params. * @api */ -_ol_source_ImageWMS_.prototype.getParams = function() { +ImageWMS.prototype.getParams = function() { return this.params_; }; @@ -183,7 +183,7 @@ _ol_source_ImageWMS_.prototype.getParams = function() { /** * @inheritDoc */ -_ol_source_ImageWMS_.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) { +ImageWMS.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) { if (this.url_ === undefined) { return null; @@ -249,7 +249,7 @@ _ol_source_ImageWMS_.prototype.getImageInternal = function(extent, resolution, p * @return {ol.ImageLoadFunctionType} The image load function. * @api */ -_ol_source_ImageWMS_.prototype.getImageLoadFunction = function() { +ImageWMS.prototype.getImageLoadFunction = function() { return this.imageLoadFunction_; }; @@ -263,7 +263,7 @@ _ol_source_ImageWMS_.prototype.getImageLoadFunction = function() { * @return {string} Request URL. * @private */ -_ol_source_ImageWMS_.prototype.getRequestUrl_ = function(extent, size, pixelRatio, projection, params) { +ImageWMS.prototype.getRequestUrl_ = function(extent, size, pixelRatio, projection, params) { assert(this.url_ !== undefined, 9); // `url` must be configured or set using `#setUrl()` @@ -317,7 +317,7 @@ _ol_source_ImageWMS_.prototype.getRequestUrl_ = function(extent, size, pixelRati * @return {string|undefined} URL. * @api */ -_ol_source_ImageWMS_.prototype.getUrl = function() { +ImageWMS.prototype.getUrl = function() { return this.url_; }; @@ -327,7 +327,7 @@ _ol_source_ImageWMS_.prototype.getUrl = function() { * @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function. * @api */ -_ol_source_ImageWMS_.prototype.setImageLoadFunction = function( +ImageWMS.prototype.setImageLoadFunction = function( imageLoadFunction) { this.image_ = null; this.imageLoadFunction_ = imageLoadFunction; @@ -340,7 +340,7 @@ _ol_source_ImageWMS_.prototype.setImageLoadFunction = function( * @param {string|undefined} url URL. * @api */ -_ol_source_ImageWMS_.prototype.setUrl = function(url) { +ImageWMS.prototype.setUrl = function(url) { if (url != this.url_) { this.url_ = url; this.image_ = null; @@ -354,7 +354,7 @@ _ol_source_ImageWMS_.prototype.setUrl = function(url) { * @param {Object} params Params. * @api */ -_ol_source_ImageWMS_.prototype.updateParams = function(params) { +ImageWMS.prototype.updateParams = function(params) { _ol_obj_.assign(this.params_, params); this.updateV13_(); this.image_ = null; @@ -365,8 +365,8 @@ _ol_source_ImageWMS_.prototype.updateParams = function(params) { /** * @private */ -_ol_source_ImageWMS_.prototype.updateV13_ = function() { +ImageWMS.prototype.updateV13_ = function() { var version = this.params_['VERSION'] || DEFAULT_WMS_VERSION; this.v13_ = _ol_string_.compareVersions(version, '1.3') >= 0; }; -export default _ol_source_ImageWMS_; +export default ImageWMS; diff --git a/src/ol/source/OSM.js b/src/ol/source/OSM.js index 7654012be5..2e3bf63428 100644 --- a/src/ol/source/OSM.js +++ b/src/ol/source/OSM.js @@ -2,7 +2,7 @@ * @module ol/source/OSM */ import {inherits} from '../index.js'; -import _ol_source_XYZ_ from '../source/XYZ.js'; +import XYZ from '../source/XYZ.js'; /** * @classdesc @@ -13,7 +13,7 @@ import _ol_source_XYZ_ from '../source/XYZ.js'; * @param {olx.source.OSMOptions=} opt_options Open Street Map options. * @api */ -var _ol_source_OSM_ = function(opt_options) { +var OSM = function(opt_options) { var options = opt_options || {}; @@ -21,7 +21,7 @@ var _ol_source_OSM_ = function(opt_options) { if (options.attributions !== undefined) { attributions = options.attributions; } else { - attributions = [_ol_source_OSM_.ATTRIBUTION]; + attributions = [OSM.ATTRIBUTION]; } var crossOrigin = options.crossOrigin !== undefined ? @@ -30,7 +30,7 @@ var _ol_source_OSM_ = function(opt_options) { var url = options.url !== undefined ? options.url : 'https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'; - _ol_source_XYZ_.call(this, { + XYZ.call(this, { attributions: attributions, cacheSize: options.cacheSize, crossOrigin: crossOrigin, @@ -44,7 +44,7 @@ var _ol_source_OSM_ = function(opt_options) { }; -inherits(_ol_source_OSM_, _ol_source_XYZ_); +inherits(OSM, XYZ); /** @@ -54,7 +54,7 @@ inherits(_ol_source_OSM_, _ol_source_XYZ_); * @type {string} * @api */ -_ol_source_OSM_.ATTRIBUTION = '© ' + +OSM.ATTRIBUTION = '© ' + 'OpenStreetMap ' + 'contributors.'; -export default _ol_source_OSM_; +export default OSM; diff --git a/src/ol/source/Raster.js b/src/ol/source/Raster.js index bfe9ad304d..b8086d7872 100644 --- a/src/ol/source/Raster.js +++ b/src/ol/source/Raster.js @@ -2,7 +2,7 @@ * @module ol/source/Raster */ import {getUid, inherits} from '../index.js'; -import _ol_ImageCanvas_ from '../ImageCanvas.js'; +import ImageCanvas from '../ImageCanvas.js'; import TileQueue from '../TileQueue.js'; import {createCanvasContext2D} from '../dom.js'; import _ol_events_ from '../events.js'; @@ -10,15 +10,15 @@ import Event from '../events/Event.js'; import EventType from '../events/EventType.js'; import {Processor} from 'pixelworks'; import {equals, getCenter, getHeight, getWidth} from '../extent.js'; -import _ol_layer_Image_ from '../layer/Image.js'; +import ImageLayer from '../layer/Image.js'; import TileLayer from '../layer/Tile.js'; import _ol_obj_ from '../obj.js'; -import _ol_renderer_canvas_ImageLayer_ from '../renderer/canvas/ImageLayer.js'; -import _ol_renderer_canvas_TileLayer_ from '../renderer/canvas/TileLayer.js'; -import _ol_source_Image_ from '../source/Image.js'; +import CanvasImageLayerRenderer from '../renderer/canvas/ImageLayer.js'; +import CanvasTileLayerRenderer from '../renderer/canvas/TileLayer.js'; +import ImageSource from '../source/Image.js'; import RasterOperationType from '../source/RasterOperationType.js'; import SourceState from '../source/State.js'; -import _ol_source_Tile_ from '../source/Tile.js'; +import TileSource from '../source/Tile.js'; import _ol_transform_ from '../transform.js'; @@ -149,7 +149,7 @@ var RasterSource = function(options) { wantedTiles: {} }; - _ol_source_Image_.call(this, {}); + ImageSource.call(this, {}); if (options.operation !== undefined) { this.setOperation(options.operation, options.lib); @@ -157,7 +157,7 @@ var RasterSource = function(options) { }; -inherits(RasterSource, _ol_source_Image_); +inherits(RasterSource, ImageSource); /** @@ -317,7 +317,7 @@ RasterSource.prototype.onWorkerComplete_ = function(frameState, err, output, dat var width = Math.round(getWidth(extent) / resolution); var height = Math.round(getHeight(extent) / resolution); context = createCanvasContext2D(width, height); - this.renderedImageCanvas_ = new _ol_ImageCanvas_(extent, resolution, 1, context.canvas); + this.renderedImageCanvas_ = new ImageCanvas(extent, resolution, 1, context.canvas); } context.putImageData(output, 0, 0); @@ -398,9 +398,9 @@ function createRenderers(sources) { */ function createRenderer(source) { var renderer = null; - if (source instanceof _ol_source_Tile_) { + if (source instanceof TileSource) { renderer = createTileRenderer(source); - } else if (source instanceof _ol_source_Image_) { + } else if (source instanceof ImageSource) { renderer = createImageRenderer(source); } return renderer; @@ -413,8 +413,8 @@ function createRenderer(source) { * @return {ol.renderer.canvas.Layer} The renderer. */ function createImageRenderer(source) { - var layer = new _ol_layer_Image_({source: source}); - return new _ol_renderer_canvas_ImageLayer_(layer); + var layer = new ImageLayer({source: source}); + return new CanvasImageLayerRenderer(layer); } @@ -425,7 +425,7 @@ function createImageRenderer(source) { */ function createTileRenderer(source) { var layer = new TileLayer({source: source}); - return new _ol_renderer_canvas_TileLayer_(layer); + return new CanvasTileLayerRenderer(layer); } diff --git a/src/ol/source/Source.js b/src/ol/source/Source.js index 58c30401dc..379ac6e1fb 100644 --- a/src/ol/source/Source.js +++ b/src/ol/source/Source.js @@ -2,7 +2,7 @@ * @module ol/source/Source */ import {inherits, nullFunction} from '../index.js'; -import _ol_Object_ from '../Object.js'; +import BaseObject from '../Object.js'; import {get as getProjection} from '../proj.js'; import SourceState from '../source/State.js'; @@ -23,7 +23,7 @@ import SourceState from '../source/State.js'; */ var Source = function(options) { - _ol_Object_.call(this); + BaseObject.call(this); /** * @private @@ -52,7 +52,7 @@ var Source = function(options) { }; -inherits(Source, _ol_Object_); +inherits(Source, BaseObject); /** * Turns the attributions option into an attributions function. diff --git a/src/ol/source/Stamen.js b/src/ol/source/Stamen.js index 1244ae20d4..c1c249bfa8 100644 --- a/src/ol/source/Stamen.js +++ b/src/ol/source/Stamen.js @@ -2,8 +2,8 @@ * @module ol/source/Stamen */ import {inherits} from '../index.js'; -import _ol_source_OSM_ from '../source/OSM.js'; -import _ol_source_XYZ_ from '../source/XYZ.js'; +import OSM from '../source/OSM.js'; +import XYZ from '../source/XYZ.js'; /** * @classdesc @@ -14,19 +14,19 @@ import _ol_source_XYZ_ from '../source/XYZ.js'; * @param {olx.source.StamenOptions} options Stamen options. * @api */ -var _ol_source_Stamen_ = function(options) { +var Stamen = function(options) { var i = options.layer.indexOf('-'); var provider = i == -1 ? options.layer : options.layer.slice(0, i); - var providerConfig = _ol_source_Stamen_.ProviderConfig[provider]; + var providerConfig = Stamen.ProviderConfig[provider]; - var layerConfig = _ol_source_Stamen_.LayerConfig[options.layer]; + var layerConfig = Stamen.LayerConfig[options.layer]; var url = options.url !== undefined ? options.url : 'https://stamen-tiles-{a-d}.a.ssl.fastly.net/' + options.layer + '/{z}/{x}/{y}.' + layerConfig.extension; - _ol_source_XYZ_.call(this, { - attributions: _ol_source_Stamen_.ATTRIBUTIONS, + XYZ.call(this, { + attributions: Stamen.ATTRIBUTIONS, cacheSize: options.cacheSize, crossOrigin: 'anonymous', maxZoom: options.maxZoom != undefined ? options.maxZoom : providerConfig.maxZoom, @@ -39,24 +39,24 @@ var _ol_source_Stamen_ = function(options) { }); }; -inherits(_ol_source_Stamen_, _ol_source_XYZ_); +inherits(Stamen, XYZ); /** * @const * @type {Array.} */ -_ol_source_Stamen_.ATTRIBUTIONS = [ +Stamen.ATTRIBUTIONS = [ 'Map tiles by Stamen Design, ' + 'under CC BY' + ' 3.0.', - _ol_source_OSM_.ATTRIBUTION + OSM.ATTRIBUTION ]; /** * @type {Object.} */ -_ol_source_Stamen_.LayerConfig = { +Stamen.LayerConfig = { 'terrain': { extension: 'jpg', opaque: true @@ -106,7 +106,7 @@ _ol_source_Stamen_.LayerConfig = { /** * @type {Object.} */ -_ol_source_Stamen_.ProviderConfig = { +Stamen.ProviderConfig = { 'terrain': { minZoom: 4, maxZoom: 18 @@ -120,4 +120,4 @@ _ol_source_Stamen_.ProviderConfig = { maxZoom: 16 } }; -export default _ol_source_Stamen_; +export default Stamen; diff --git a/src/ol/source/Tile.js b/src/ol/source/Tile.js index c6c95ded6e..0f55f7dc55 100644 --- a/src/ol/source/Tile.js +++ b/src/ol/source/Tile.js @@ -23,7 +23,7 @@ import _ol_tilegrid_ from '../tilegrid.js'; * @param {ol.SourceTileOptions} options Tile source options. * @api */ -var _ol_source_Tile_ = function(options) { +var TileSource = function(options) { Source.call(this, { attributions: options.attributions, @@ -78,13 +78,13 @@ var _ol_source_Tile_ = function(options) { }; -inherits(_ol_source_Tile_, Source); +inherits(TileSource, Source); /** * @return {boolean} Can expire cache. */ -_ol_source_Tile_.prototype.canExpireCache = function() { +TileSource.prototype.canExpireCache = function() { return this.tileCache.canExpireCache(); }; @@ -93,7 +93,7 @@ _ol_source_Tile_.prototype.canExpireCache = function() { * @param {ol.proj.Projection} projection Projection. * @param {Object.} usedTiles Used tiles. */ -_ol_source_Tile_.prototype.expireCache = function(projection, usedTiles) { +TileSource.prototype.expireCache = function(projection, usedTiles) { var tileCache = this.getTileCacheForProjection(projection); if (tileCache) { tileCache.expireCache(usedTiles); @@ -110,7 +110,7 @@ _ol_source_Tile_.prototype.expireCache = function(projection, usedTiles) { * considered loaded. * @return {boolean} The tile range is fully covered with loaded tiles. */ -_ol_source_Tile_.prototype.forEachLoadedTile = function(projection, z, tileRange, callback) { +TileSource.prototype.forEachLoadedTile = function(projection, z, tileRange, callback) { var tileCache = this.getTileCacheForProjection(projection); if (!tileCache) { return false; @@ -142,7 +142,7 @@ _ol_source_Tile_.prototype.forEachLoadedTile = function(projection, z, tileRange * @param {ol.proj.Projection} projection Projection. * @return {number} Gutter. */ -_ol_source_Tile_.prototype.getGutter = function(projection) { +TileSource.prototype.getGutter = function(projection) { return 0; }; @@ -152,7 +152,7 @@ _ol_source_Tile_.prototype.getGutter = function(projection) { * @return {string} The key for all tiles. * @protected */ -_ol_source_Tile_.prototype.getKey = function() { +TileSource.prototype.getKey = function() { return this.key_; }; @@ -162,7 +162,7 @@ _ol_source_Tile_.prototype.getKey = function() { * @param {string} key The key for tiles. * @protected */ -_ol_source_Tile_.prototype.setKey = function(key) { +TileSource.prototype.setKey = function(key) { if (this.key_ !== key) { this.key_ = key; this.changed(); @@ -174,7 +174,7 @@ _ol_source_Tile_.prototype.setKey = function(key) { * @param {ol.proj.Projection} projection Projection. * @return {boolean} Opaque. */ -_ol_source_Tile_.prototype.getOpaque = function(projection) { +TileSource.prototype.getOpaque = function(projection) { return this.opaque_; }; @@ -182,7 +182,7 @@ _ol_source_Tile_.prototype.getOpaque = function(projection) { /** * @inheritDoc */ -_ol_source_Tile_.prototype.getResolutions = function() { +TileSource.prototype.getResolutions = function() { return this.tileGrid.getResolutions(); }; @@ -196,7 +196,7 @@ _ol_source_Tile_.prototype.getResolutions = function() { * @param {ol.proj.Projection} projection Projection. * @return {!ol.Tile} Tile. */ -_ol_source_Tile_.prototype.getTile = function(z, x, y, pixelRatio, projection) {}; +TileSource.prototype.getTile = function(z, x, y, pixelRatio, projection) {}; /** @@ -204,7 +204,7 @@ _ol_source_Tile_.prototype.getTile = function(z, x, y, pixelRatio, projection) { * @return {ol.tilegrid.TileGrid} Tile grid. * @api */ -_ol_source_Tile_.prototype.getTileGrid = function() { +TileSource.prototype.getTileGrid = function() { return this.tileGrid; }; @@ -213,7 +213,7 @@ _ol_source_Tile_.prototype.getTileGrid = function() { * @param {ol.proj.Projection} projection Projection. * @return {!ol.tilegrid.TileGrid} Tile grid. */ -_ol_source_Tile_.prototype.getTileGridForProjection = function(projection) { +TileSource.prototype.getTileGridForProjection = function(projection) { if (!this.tileGrid) { return _ol_tilegrid_.getForProjection(projection); } else { @@ -227,7 +227,7 @@ _ol_source_Tile_.prototype.getTileGridForProjection = function(projection) { * @return {ol.TileCache} Tile cache. * @protected */ -_ol_source_Tile_.prototype.getTileCacheForProjection = function(projection) { +TileSource.prototype.getTileCacheForProjection = function(projection) { var thisProj = this.getProjection(); if (thisProj && !equivalent(thisProj, projection)) { return null; @@ -244,7 +244,7 @@ _ol_source_Tile_.prototype.getTileCacheForProjection = function(projection) { * @param {number} pixelRatio Pixel ratio. * @return {number} Tile pixel ratio. */ -_ol_source_Tile_.prototype.getTilePixelRatio = function(pixelRatio) { +TileSource.prototype.getTilePixelRatio = function(pixelRatio) { return this.tilePixelRatio_; }; @@ -255,7 +255,7 @@ _ol_source_Tile_.prototype.getTilePixelRatio = function(pixelRatio) { * @param {ol.proj.Projection} projection Projection. * @return {ol.Size} Tile size. */ -_ol_source_Tile_.prototype.getTilePixelSize = function(z, pixelRatio, projection) { +TileSource.prototype.getTilePixelSize = function(z, pixelRatio, projection) { var tileGrid = this.getTileGridForProjection(projection); var tilePixelRatio = this.getTilePixelRatio(pixelRatio); var tileSize = _ol_size_.toSize(tileGrid.getTileSize(z), this.tmpSize); @@ -276,7 +276,7 @@ _ol_source_Tile_.prototype.getTilePixelSize = function(z, pixelRatio, projection * @return {ol.TileCoord} Tile coordinate to be passed to the tileUrlFunction or * null if no tile URL should be created for the passed `tileCoord`. */ -_ol_source_Tile_.prototype.getTileCoordForTileUrlFunction = function(tileCoord, opt_projection) { +TileSource.prototype.getTileCoordForTileUrlFunction = function(tileCoord, opt_projection) { var projection = opt_projection !== undefined ? opt_projection : this.getProjection(); var tileGrid = this.getTileGridForProjection(projection); @@ -290,7 +290,7 @@ _ol_source_Tile_.prototype.getTileCoordForTileUrlFunction = function(tileCoord, /** * @inheritDoc */ -_ol_source_Tile_.prototype.refresh = function() { +TileSource.prototype.refresh = function() { this.tileCache.clear(); this.changed(); }; @@ -303,7 +303,7 @@ _ol_source_Tile_.prototype.refresh = function() { * @param {number} y Tile coordinate y. * @param {ol.proj.Projection} projection Projection. */ -_ol_source_Tile_.prototype.useTile = nullFunction; +TileSource.prototype.useTile = nullFunction; /** @@ -317,7 +317,7 @@ _ol_source_Tile_.prototype.useTile = nullFunction; * @param {string} type Type. * @param {ol.Tile} tile The tile. */ -_ol_source_Tile_.Event = function(type, tile) { +TileSource.Event = function(type, tile) { Event.call(this, type); @@ -329,5 +329,5 @@ _ol_source_Tile_.Event = function(type, tile) { this.tile = tile; }; -inherits(_ol_source_Tile_.Event, Event); -export default _ol_source_Tile_; +inherits(TileSource.Event, Event); +export default TileSource; diff --git a/src/ol/source/TileArcGISRest.js b/src/ol/source/TileArcGISRest.js index bd7f426651..5a3f9a486f 100644 --- a/src/ol/source/TileArcGISRest.js +++ b/src/ol/source/TileArcGISRest.js @@ -6,7 +6,7 @@ import {createEmpty} from '../extent.js'; import {modulo} from '../math.js'; import _ol_obj_ from '../obj.js'; import _ol_size_ from '../size.js'; -import _ol_source_TileImage_ from '../source/TileImage.js'; +import TileImage from '../source/TileImage.js'; import _ol_tilecoord_ from '../tilecoord.js'; import _ol_uri_ from '../uri.js'; @@ -24,11 +24,11 @@ import _ol_uri_ from '../uri.js'; * options. * @api */ -var _ol_source_TileArcGISRest_ = function(opt_options) { +var TileArcGISRest = function(opt_options) { var options = opt_options || {}; - _ol_source_TileImage_.call(this, { + TileImage.call(this, { attributions: options.attributions, cacheSize: options.cacheSize, crossOrigin: options.crossOrigin, @@ -57,14 +57,14 @@ var _ol_source_TileArcGISRest_ = function(opt_options) { this.setKey(this.getKeyForParams_()); }; -inherits(_ol_source_TileArcGISRest_, _ol_source_TileImage_); +inherits(TileArcGISRest, TileImage); /** * @private * @return {string} The key for the current params. */ -_ol_source_TileArcGISRest_.prototype.getKeyForParams_ = function() { +TileArcGISRest.prototype.getKeyForParams_ = function() { var i = 0; var res = []; for (var key in this.params_) { @@ -80,7 +80,7 @@ _ol_source_TileArcGISRest_.prototype.getKeyForParams_ = function() { * @return {Object} Params. * @api */ -_ol_source_TileArcGISRest_.prototype.getParams = function() { +TileArcGISRest.prototype.getParams = function() { return this.params_; }; @@ -95,7 +95,7 @@ _ol_source_TileArcGISRest_.prototype.getParams = function() { * @return {string|undefined} Request URL. * @private */ -_ol_source_TileArcGISRest_.prototype.getRequestUrl_ = function(tileCoord, tileSize, tileExtent, +TileArcGISRest.prototype.getRequestUrl_ = function(tileCoord, tileSize, tileExtent, pixelRatio, projection, params) { var urls = this.urls; @@ -132,7 +132,7 @@ _ol_source_TileArcGISRest_.prototype.getRequestUrl_ = function(tileCoord, tileSi /** * @inheritDoc */ -_ol_source_TileArcGISRest_.prototype.getTilePixelRatio = function(pixelRatio) { +TileArcGISRest.prototype.getTilePixelRatio = function(pixelRatio) { return /** @type {number} */ (pixelRatio); }; @@ -140,7 +140,7 @@ _ol_source_TileArcGISRest_.prototype.getTilePixelRatio = function(pixelRatio) { /** * @inheritDoc */ -_ol_source_TileArcGISRest_.prototype.fixedTileUrlFunction = function(tileCoord, pixelRatio, projection) { +TileArcGISRest.prototype.fixedTileUrlFunction = function(tileCoord, pixelRatio, projection) { var tileGrid = this.getTileGrid(); if (!tileGrid) { @@ -178,8 +178,8 @@ _ol_source_TileArcGISRest_.prototype.fixedTileUrlFunction = function(tileCoord, * @param {Object} params Params. * @api */ -_ol_source_TileArcGISRest_.prototype.updateParams = function(params) { +TileArcGISRest.prototype.updateParams = function(params) { _ol_obj_.assign(this.params_, params); this.setKey(this.getKeyForParams_()); }; -export default _ol_source_TileArcGISRest_; +export default TileArcGISRest; diff --git a/src/ol/source/TileDebug.js b/src/ol/source/TileDebug.js index a876113fc2..e54627e3b3 100644 --- a/src/ol/source/TileDebug.js +++ b/src/ol/source/TileDebug.js @@ -6,7 +6,7 @@ import _ol_Tile_ from '../Tile.js'; import TileState from '../TileState.js'; import {createCanvasContext2D} from '../dom.js'; import _ol_size_ from '../size.js'; -import _ol_source_Tile_ from '../source/Tile.js'; +import TileSource from '../source/Tile.js'; import _ol_tilecoord_ from '../tilecoord.js'; /** @@ -22,9 +22,9 @@ import _ol_tilecoord_ from '../tilecoord.js'; * @param {olx.source.TileDebugOptions} options Debug tile options. * @api */ -var _ol_source_TileDebug_ = function(options) { +var TileDebug = function(options) { - _ol_source_Tile_.call(this, { + TileSource.call(this, { opaque: false, projection: options.projection, tileGrid: options.tileGrid, @@ -33,13 +33,13 @@ var _ol_source_TileDebug_ = function(options) { }; -inherits(_ol_source_TileDebug_, _ol_source_Tile_); +inherits(TileDebug, TileSource); /** * @inheritDoc */ -_ol_source_TileDebug_.prototype.getTile = function(z, x, y) { +TileDebug.prototype.getTile = function(z, x, y) { var tileCoordKey = _ol_tilecoord_.getKeyZXY(z, x, y); if (this.tileCache.containsKey(tileCoordKey)) { return /** @type {!ol.source.TileDebug.Tile_} */ (this.tileCache.get(tileCoordKey)); @@ -49,7 +49,7 @@ _ol_source_TileDebug_.prototype.getTile = function(z, x, y) { var textTileCoord = this.getTileCoordForTileUrlFunction(tileCoord); var text = !textTileCoord ? '' : this.getTileCoordForTileUrlFunction(textTileCoord).toString(); - var tile = new _ol_source_TileDebug_.Tile_(tileCoord, tileSize, text); + var tile = new TileDebug.Tile_(tileCoord, tileSize, text); this.tileCache.set(tileCoordKey, tile); return tile; } @@ -64,7 +64,7 @@ _ol_source_TileDebug_.prototype.getTile = function(z, x, y) { * @param {string} text Text. * @private */ -_ol_source_TileDebug_.Tile_ = function(tileCoord, tileSize, text) { +TileDebug.Tile_ = function(tileCoord, tileSize, text) { _ol_Tile_.call(this, tileCoord, TileState.LOADED); @@ -87,14 +87,14 @@ _ol_source_TileDebug_.Tile_ = function(tileCoord, tileSize, text) { this.canvas_ = null; }; -inherits(_ol_source_TileDebug_.Tile_, _ol_Tile_); +inherits(TileDebug.Tile_, _ol_Tile_); /** * Get the image element for this tile. * @return {HTMLCanvasElement} Image. */ -_ol_source_TileDebug_.Tile_.prototype.getImage = function() { +TileDebug.Tile_.prototype.getImage = function() { if (this.canvas_) { return this.canvas_; } else { @@ -119,5 +119,5 @@ _ol_source_TileDebug_.Tile_.prototype.getImage = function() { /** * @override */ -_ol_source_TileDebug_.Tile_.prototype.load = function() {}; -export default _ol_source_TileDebug_; +TileDebug.Tile_.prototype.load = function() {}; +export default TileDebug; diff --git a/src/ol/source/TileImage.js b/src/ol/source/TileImage.js index 235927bb3c..48756ce3a1 100644 --- a/src/ol/source/TileImage.js +++ b/src/ol/source/TileImage.js @@ -10,7 +10,7 @@ import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {equivalent, get as getProjection} from '../proj.js'; import _ol_reproj_Tile_ from '../reproj/Tile.js'; -import _ol_source_UrlTile_ from '../source/UrlTile.js'; +import UrlTile from '../source/UrlTile.js'; import _ol_tilecoord_ from '../tilecoord.js'; import _ol_tilegrid_ from '../tilegrid.js'; @@ -24,9 +24,9 @@ import _ol_tilegrid_ from '../tilegrid.js'; * @param {olx.source.TileImageOptions} options Image tile options. * @api */ -var _ol_source_TileImage_ = function(options) { +var TileImage = function(options) { - _ol_source_UrlTile_.call(this, { + UrlTile.call(this, { attributions: options.attributions, cacheSize: options.cacheSize, extent: options.extent, @@ -35,7 +35,7 @@ var _ol_source_TileImage_ = function(options) { state: options.state, tileGrid: options.tileGrid, tileLoadFunction: options.tileLoadFunction ? - options.tileLoadFunction : _ol_source_TileImage_.defaultTileLoadFunction, + options.tileLoadFunction : TileImage.defaultTileLoadFunction, tilePixelRatio: options.tilePixelRatio, tileUrlFunction: options.tileUrlFunction, url: options.url, @@ -84,15 +84,15 @@ var _ol_source_TileImage_ = function(options) { this.renderReprojectionEdges_ = false; }; -inherits(_ol_source_TileImage_, _ol_source_UrlTile_); +inherits(TileImage, UrlTile); /** * @inheritDoc */ -_ol_source_TileImage_.prototype.canExpireCache = function() { +TileImage.prototype.canExpireCache = function() { if (!ENABLE_RASTER_REPROJECTION) { - return _ol_source_UrlTile_.prototype.canExpireCache.call(this); + return UrlTile.prototype.canExpireCache.call(this); } if (this.tileCache.canExpireCache()) { return true; @@ -110,9 +110,9 @@ _ol_source_TileImage_.prototype.canExpireCache = function() { /** * @inheritDoc */ -_ol_source_TileImage_.prototype.expireCache = function(projection, usedTiles) { +TileImage.prototype.expireCache = function(projection, usedTiles) { if (!ENABLE_RASTER_REPROJECTION) { - _ol_source_UrlTile_.prototype.expireCache.call(this, projection, usedTiles); + UrlTile.prototype.expireCache.call(this, projection, usedTiles); return; } var usedTileCache = this.getTileCacheForProjection(projection); @@ -128,7 +128,7 @@ _ol_source_TileImage_.prototype.expireCache = function(projection, usedTiles) { /** * @inheritDoc */ -_ol_source_TileImage_.prototype.getGutter = function(projection) { +TileImage.prototype.getGutter = function(projection) { if (ENABLE_RASTER_REPROJECTION && this.getProjection() && projection && !equivalent(this.getProjection(), projection)) { return 0; @@ -142,7 +142,7 @@ _ol_source_TileImage_.prototype.getGutter = function(projection) { * @protected * @return {number} Gutter. */ -_ol_source_TileImage_.prototype.getGutterInternal = function() { +TileImage.prototype.getGutterInternal = function() { return 0; }; @@ -150,12 +150,12 @@ _ol_source_TileImage_.prototype.getGutterInternal = function() { /** * @inheritDoc */ -_ol_source_TileImage_.prototype.getOpaque = function(projection) { +TileImage.prototype.getOpaque = function(projection) { if (ENABLE_RASTER_REPROJECTION && this.getProjection() && projection && !equivalent(this.getProjection(), projection)) { return false; } else { - return _ol_source_UrlTile_.prototype.getOpaque.call(this, projection); + return UrlTile.prototype.getOpaque.call(this, projection); } }; @@ -163,9 +163,9 @@ _ol_source_TileImage_.prototype.getOpaque = function(projection) { /** * @inheritDoc */ -_ol_source_TileImage_.prototype.getTileGridForProjection = function(projection) { +TileImage.prototype.getTileGridForProjection = function(projection) { if (!ENABLE_RASTER_REPROJECTION) { - return _ol_source_UrlTile_.prototype.getTileGridForProjection.call(this, projection); + return UrlTile.prototype.getTileGridForProjection.call(this, projection); } var thisProj = this.getProjection(); if (this.tileGrid && (!thisProj || equivalent(thisProj, projection))) { @@ -184,9 +184,9 @@ _ol_source_TileImage_.prototype.getTileGridForProjection = function(projection) /** * @inheritDoc */ -_ol_source_TileImage_.prototype.getTileCacheForProjection = function(projection) { +TileImage.prototype.getTileCacheForProjection = function(projection) { if (!ENABLE_RASTER_REPROJECTION) { - return _ol_source_UrlTile_.prototype.getTileCacheForProjection.call(this, projection); + return UrlTile.prototype.getTileCacheForProjection.call(this, projection); } var thisProj = this.getProjection(); if (!thisProj || equivalent(thisProj, projection)) { return this.tileCache; @@ -210,7 +210,7 @@ _ol_source_TileImage_.prototype.getTileCacheForProjection = function(projection) * @return {!ol.Tile} Tile. * @private */ -_ol_source_TileImage_.prototype.createTile_ = function(z, x, y, pixelRatio, projection, key) { +TileImage.prototype.createTile_ = function(z, x, y, pixelRatio, projection, key) { var tileCoord = [z, x, y]; var urlTileCoord = this.getTileCoordForTileUrlFunction( tileCoord, projection); @@ -233,7 +233,7 @@ _ol_source_TileImage_.prototype.createTile_ = function(z, x, y, pixelRatio, proj /** * @inheritDoc */ -_ol_source_TileImage_.prototype.getTile = function(z, x, y, pixelRatio, projection) { +TileImage.prototype.getTile = function(z, x, y, pixelRatio, projection) { var sourceProjection = /** @type {!ol.proj.Projection} */ (this.getProjection()); if (!ENABLE_RASTER_REPROJECTION || !sourceProjection || !projection || equivalent(sourceProjection, projection)) { @@ -287,7 +287,7 @@ _ol_source_TileImage_.prototype.getTile = function(z, x, y, pixelRatio, projecti * @return {!ol.Tile} Tile. * @protected */ -_ol_source_TileImage_.prototype.getTileInternal = function(z, x, y, pixelRatio, projection) { +TileImage.prototype.getTileInternal = function(z, x, y, pixelRatio, projection) { var tile = null; var tileCoordKey = _ol_tilecoord_.getKeyZXY(z, x, y); var key = this.getKey(); @@ -323,7 +323,7 @@ _ol_source_TileImage_.prototype.getTileInternal = function(z, x, y, pixelRatio, * @param {boolean} render Render the edges. * @api */ -_ol_source_TileImage_.prototype.setRenderReprojectionEdges = function(render) { +TileImage.prototype.setRenderReprojectionEdges = function(render) { if (!ENABLE_RASTER_REPROJECTION || this.renderReprojectionEdges_ == render) { return; @@ -348,7 +348,7 @@ _ol_source_TileImage_.prototype.setRenderReprojectionEdges = function(render) { * @param {ol.tilegrid.TileGrid} tilegrid Tile grid to use for the projection. * @api */ -_ol_source_TileImage_.prototype.setTileGridForProjection = function(projection, tilegrid) { +TileImage.prototype.setTileGridForProjection = function(projection, tilegrid) { if (ENABLE_RASTER_REPROJECTION) { var proj = getProjection(projection); if (proj) { @@ -365,7 +365,7 @@ _ol_source_TileImage_.prototype.setTileGridForProjection = function(projection, * @param {ol.ImageTile} imageTile Image tile. * @param {string} src Source. */ -_ol_source_TileImage_.defaultTileLoadFunction = function(imageTile, src) { +TileImage.defaultTileLoadFunction = function(imageTile, src) { imageTile.getImage().src = src; }; -export default _ol_source_TileImage_; +export default TileImage; diff --git a/src/ol/source/TileJSON.js b/src/ol/source/TileJSON.js index 17cf4fc0f6..d6653c2da0 100644 --- a/src/ol/source/TileJSON.js +++ b/src/ol/source/TileJSON.js @@ -14,7 +14,7 @@ import {applyTransform, intersects} from '../extent.js'; import _ol_net_ from '../net.js'; import {get as getProjection, getTransformFromProjections} from '../proj.js'; import SourceState from '../source/State.js'; -import _ol_source_TileImage_ from '../source/TileImage.js'; +import TileImage from '../source/TileImage.js'; import _ol_tilegrid_ from '../tilegrid.js'; /** @@ -26,7 +26,7 @@ import _ol_tilegrid_ from '../tilegrid.js'; * @param {olx.source.TileJSONOptions} options TileJSON options. * @api */ -var _ol_source_TileJSON_ = function(options) { +var TileJSON = function(options) { /** * @type {TileJSON} @@ -34,7 +34,7 @@ var _ol_source_TileJSON_ = function(options) { */ this.tileJSON_ = null; - _ol_source_TileImage_.call(this, { + TileImage.call(this, { attributions: options.attributions, cacheSize: options.cacheSize, crossOrigin: options.crossOrigin, @@ -65,14 +65,14 @@ var _ol_source_TileJSON_ = function(options) { }; -inherits(_ol_source_TileJSON_, _ol_source_TileImage_); +inherits(TileJSON, TileImage); /** * @private * @param {Event} event The load event. */ -_ol_source_TileJSON_.prototype.onXHRLoad_ = function(event) { +TileJSON.prototype.onXHRLoad_ = function(event) { var client = /** @type {XMLHttpRequest} */ (event.target); // status will be 0 for file:// urls if (!client.status || client.status >= 200 && client.status < 300) { @@ -94,7 +94,7 @@ _ol_source_TileJSON_.prototype.onXHRLoad_ = function(event) { * @private * @param {Event} event The error event. */ -_ol_source_TileJSON_.prototype.onXHRError_ = function(event) { +TileJSON.prototype.onXHRError_ = function(event) { this.handleTileJSONError(); }; @@ -103,7 +103,7 @@ _ol_source_TileJSON_.prototype.onXHRError_ = function(event) { * @return {TileJSON} The tilejson object. * @api */ -_ol_source_TileJSON_.prototype.getTileJSON = function() { +TileJSON.prototype.getTileJSON = function() { return this.tileJSON_; }; @@ -112,7 +112,7 @@ _ol_source_TileJSON_.prototype.getTileJSON = function() { * @protected * @param {TileJSON} tileJSON Tile JSON. */ -_ol_source_TileJSON_.prototype.handleTileJSONResponse = function(tileJSON) { +TileJSON.prototype.handleTileJSONResponse = function(tileJSON) { var epsg4326Projection = getProjection('EPSG:4326'); @@ -156,7 +156,7 @@ _ol_source_TileJSON_.prototype.handleTileJSONResponse = function(tileJSON) { /** * @protected */ -_ol_source_TileJSON_.prototype.handleTileJSONError = function() { +TileJSON.prototype.handleTileJSONError = function() { this.setState(SourceState.ERROR); }; -export default _ol_source_TileJSON_; +export default TileJSON; diff --git a/src/ol/source/TileUTFGrid.js b/src/ol/source/TileUTFGrid.js index 3c8857f9eb..fd44237902 100644 --- a/src/ol/source/TileUTFGrid.js +++ b/src/ol/source/TileUTFGrid.js @@ -12,7 +12,7 @@ import {applyTransform, intersects} from '../extent.js'; import _ol_net_ from '../net.js'; import {get as getProjection, getTransformFromProjections} from '../proj.js'; import SourceState from '../source/State.js'; -import _ol_source_Tile_ from '../source/Tile.js'; +import TileSource from '../source/Tile.js'; import _ol_tilecoord_ from '../tilecoord.js'; import _ol_tilegrid_ from '../tilegrid.js'; @@ -25,8 +25,8 @@ import _ol_tilegrid_ from '../tilegrid.js'; * @param {olx.source.TileUTFGridOptions} options Source options. * @api */ -var _ol_source_TileUTFGrid_ = function(options) { - _ol_source_Tile_.call(this, { +var UTFGrid = function(options) { + TileSource.call(this, { projection: getProjection('EPSG:3857'), state: SourceState.LOADING }); @@ -74,14 +74,14 @@ var _ol_source_TileUTFGrid_ = function(options) { } }; -inherits(_ol_source_TileUTFGrid_, _ol_source_Tile_); +inherits(UTFGrid, TileSource); /** * @private * @param {Event} event The load event. */ -_ol_source_TileUTFGrid_.prototype.onXHRLoad_ = function(event) { +UTFGrid.prototype.onXHRLoad_ = function(event) { var client = /** @type {XMLHttpRequest} */ (event.target); // status will be 0 for file:// urls if (!client.status || client.status >= 200 && client.status < 300) { @@ -103,7 +103,7 @@ _ol_source_TileUTFGrid_.prototype.onXHRLoad_ = function(event) { * @private * @param {Event} event The error event. */ -_ol_source_TileUTFGrid_.prototype.onXHRError_ = function(event) { +UTFGrid.prototype.onXHRError_ = function(event) { this.handleTileJSONError(); }; @@ -113,7 +113,7 @@ _ol_source_TileUTFGrid_.prototype.onXHRError_ = function(event) { * @return {string|undefined} The template from TileJSON. * @api */ -_ol_source_TileUTFGrid_.prototype.getTemplate = function() { +UTFGrid.prototype.getTemplate = function() { return this.template_; }; @@ -129,7 +129,7 @@ _ol_source_TileUTFGrid_.prototype.getTemplate = function() { * The tile data is requested if not yet loaded. * @api */ -_ol_source_TileUTFGrid_.prototype.forDataAtCoordinateAndResolution = function( +UTFGrid.prototype.forDataAtCoordinateAndResolution = function( coordinate, resolution, callback, opt_request) { if (this.tileGrid) { var tileCoord = this.tileGrid.getTileCoordForCoordAndResolution( @@ -152,7 +152,7 @@ _ol_source_TileUTFGrid_.prototype.forDataAtCoordinateAndResolution = function( /** * @protected */ -_ol_source_TileUTFGrid_.prototype.handleTileJSONError = function() { +UTFGrid.prototype.handleTileJSONError = function() { this.setState(SourceState.ERROR); }; @@ -162,7 +162,7 @@ _ol_source_TileUTFGrid_.prototype.handleTileJSONError = function() { * @protected * @param {TileJSON} tileJSON Tile JSON. */ -_ol_source_TileUTFGrid_.prototype.handleTileJSONResponse = function(tileJSON) { +UTFGrid.prototype.handleTileJSONResponse = function(tileJSON) { var epsg4326Projection = getProjection('EPSG:4326'); @@ -213,7 +213,7 @@ _ol_source_TileUTFGrid_.prototype.handleTileJSONResponse = function(tileJSON) { /** * @inheritDoc */ -_ol_source_TileUTFGrid_.prototype.getTile = function(z, x, y, pixelRatio, projection) { +UTFGrid.prototype.getTile = function(z, x, y, pixelRatio, projection) { var tileCoordKey = _ol_tilecoord_.getKeyZXY(z, x, y); if (this.tileCache.containsKey(tileCoordKey)) { return /** @type {!ol.Tile} */ (this.tileCache.get(tileCoordKey)); @@ -222,7 +222,7 @@ _ol_source_TileUTFGrid_.prototype.getTile = function(z, x, y, pixelRatio, projec var urlTileCoord = this.getTileCoordForTileUrlFunction(tileCoord, projection); var tileUrl = this.tileUrlFunction_(urlTileCoord, pixelRatio, projection); - var tile = new _ol_source_TileUTFGrid_.Tile_( + var tile = new UTFGrid.Tile_( tileCoord, tileUrl !== undefined ? TileState.IDLE : TileState.EMPTY, tileUrl !== undefined ? tileUrl : '', @@ -238,7 +238,7 @@ _ol_source_TileUTFGrid_.prototype.getTile = function(z, x, y, pixelRatio, projec /** * @inheritDoc */ -_ol_source_TileUTFGrid_.prototype.useTile = function(z, x, y) { +UTFGrid.prototype.useTile = function(z, x, y) { var tileCoordKey = _ol_tilecoord_.getKeyZXY(z, x, y); if (this.tileCache.containsKey(tileCoordKey)) { this.tileCache.get(tileCoordKey); @@ -257,7 +257,7 @@ _ol_source_TileUTFGrid_.prototype.useTile = function(z, x, y) { * @param {boolean} jsonp Load the tile as a script. * @private */ -_ol_source_TileUTFGrid_.Tile_ = function(tileCoord, state, src, extent, preemptive, jsonp) { +UTFGrid.Tile_ = function(tileCoord, state, src, extent, preemptive, jsonp) { _ol_Tile_.call(this, tileCoord, state); @@ -305,14 +305,14 @@ _ol_source_TileUTFGrid_.Tile_ = function(tileCoord, state, src, extent, preempti this.jsonp_ = jsonp; }; -inherits(_ol_source_TileUTFGrid_.Tile_, _ol_Tile_); +inherits(UTFGrid.Tile_, _ol_Tile_); /** * Get the image element for this tile. * @return {Image} Image. */ -_ol_source_TileUTFGrid_.Tile_.prototype.getImage = function() { +UTFGrid.Tile_.prototype.getImage = function() { return null; }; @@ -322,7 +322,7 @@ _ol_source_TileUTFGrid_.Tile_.prototype.getImage = function() { * @param {ol.Coordinate} coordinate Coordinate. * @return {*} The data. */ -_ol_source_TileUTFGrid_.Tile_.prototype.getData = function(coordinate) { +UTFGrid.Tile_.prototype.getData = function(coordinate) { if (!this.grid_ || !this.keys_) { return null; } @@ -369,7 +369,7 @@ _ol_source_TileUTFGrid_.Tile_.prototype.getData = function(coordinate) { * The tile data is requested if not yet loaded. * @template T */ -_ol_source_TileUTFGrid_.Tile_.prototype.forDataAtCoordinate = function(coordinate, callback, opt_this, opt_request) { +UTFGrid.Tile_.prototype.forDataAtCoordinate = function(coordinate, callback, opt_this, opt_request) { if (this.state == TileState.IDLE && opt_request === true) { _ol_events_.listenOnce(this, EventType.CHANGE, function(e) { callback.call(opt_this, this.getData(coordinate)); @@ -390,7 +390,7 @@ _ol_source_TileUTFGrid_.Tile_.prototype.forDataAtCoordinate = function(coordinat /** * @inheritDoc */ -_ol_source_TileUTFGrid_.Tile_.prototype.getKey = function() { +UTFGrid.Tile_.prototype.getKey = function() { return this.src_; }; @@ -398,7 +398,7 @@ _ol_source_TileUTFGrid_.Tile_.prototype.getKey = function() { /** * @private */ -_ol_source_TileUTFGrid_.Tile_.prototype.handleError_ = function() { +UTFGrid.Tile_.prototype.handleError_ = function() { this.state = TileState.ERROR; this.changed(); }; @@ -408,7 +408,7 @@ _ol_source_TileUTFGrid_.Tile_.prototype.handleError_ = function() { * @param {!UTFGridJSON} json UTFGrid data. * @private */ -_ol_source_TileUTFGrid_.Tile_.prototype.handleLoad_ = function(json) { +UTFGrid.Tile_.prototype.handleLoad_ = function(json) { this.grid_ = json.grid; this.keys_ = json.keys; this.data_ = json.data; @@ -421,7 +421,7 @@ _ol_source_TileUTFGrid_.Tile_.prototype.handleLoad_ = function(json) { /** * @private */ -_ol_source_TileUTFGrid_.Tile_.prototype.loadInternal_ = function() { +UTFGrid.Tile_.prototype.loadInternal_ = function() { if (this.state == TileState.IDLE) { this.state = TileState.LOADING; if (this.jsonp_) { @@ -442,7 +442,7 @@ _ol_source_TileUTFGrid_.Tile_.prototype.loadInternal_ = function() { * @private * @param {Event} event The load event. */ -_ol_source_TileUTFGrid_.Tile_.prototype.onXHRLoad_ = function(event) { +UTFGrid.Tile_.prototype.onXHRLoad_ = function(event) { var client = /** @type {XMLHttpRequest} */ (event.target); // status will be 0 for file:// urls if (!client.status || client.status >= 200 && client.status < 300) { @@ -464,7 +464,7 @@ _ol_source_TileUTFGrid_.Tile_.prototype.onXHRLoad_ = function(event) { * @private * @param {Event} event The error event. */ -_ol_source_TileUTFGrid_.Tile_.prototype.onXHRError_ = function(event) { +UTFGrid.Tile_.prototype.onXHRError_ = function(event) { this.handleError_(); }; @@ -472,9 +472,9 @@ _ol_source_TileUTFGrid_.Tile_.prototype.onXHRError_ = function(event) { /** * @override */ -_ol_source_TileUTFGrid_.Tile_.prototype.load = function() { +UTFGrid.Tile_.prototype.load = function() { if (this.preemptive_) { this.loadInternal_(); } }; -export default _ol_source_TileUTFGrid_; +export default UTFGrid; diff --git a/src/ol/source/TileWMS.js b/src/ol/source/TileWMS.js index 997a49ccb1..fb078c4a3d 100644 --- a/src/ol/source/TileWMS.js +++ b/src/ol/source/TileWMS.js @@ -11,7 +11,7 @@ import {modulo} from '../math.js'; import {get as getProjection, transform, transformExtent} from '../proj.js'; import _ol_reproj_ from '../reproj.js'; import _ol_size_ from '../size.js'; -import _ol_source_TileImage_ from '../source/TileImage.js'; +import TileImage from '../source/TileImage.js'; import WMSServerType from '../source/WMSServerType.js'; import _ol_tilecoord_ from '../tilecoord.js'; import _ol_string_ from '../string.js'; @@ -26,7 +26,7 @@ import _ol_uri_ from '../uri.js'; * @param {olx.source.TileWMSOptions=} opt_options Tile WMS options. * @api */ -var _ol_source_TileWMS_ = function(opt_options) { +var TileWMS = function(opt_options) { var options = opt_options || {}; @@ -34,7 +34,7 @@ var _ol_source_TileWMS_ = function(opt_options) { var transparent = 'TRANSPARENT' in params ? params['TRANSPARENT'] : true; - _ol_source_TileImage_.call(this, { + TileImage.call(this, { attributions: options.attributions, cacheSize: options.cacheSize, crossOrigin: options.crossOrigin, @@ -91,7 +91,7 @@ var _ol_source_TileWMS_ = function(opt_options) { }; -inherits(_ol_source_TileWMS_, _ol_source_TileImage_); +inherits(TileWMS, TileImage); /** @@ -108,7 +108,7 @@ inherits(_ol_source_TileWMS_, _ol_source_TileImage_); * @return {string|undefined} GetFeatureInfo URL. * @api */ -_ol_source_TileWMS_.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projection, params) { +TileWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projection, params) { var projectionObj = getProjection(projection); var sourceProjectionObj = this.getProjection(); @@ -164,7 +164,7 @@ _ol_source_TileWMS_.prototype.getGetFeatureInfoUrl = function(coordinate, resolu /** * @inheritDoc */ -_ol_source_TileWMS_.prototype.getGutterInternal = function() { +TileWMS.prototype.getGutterInternal = function() { return this.gutter_; }; @@ -175,7 +175,7 @@ _ol_source_TileWMS_.prototype.getGutterInternal = function() { * @return {Object} Params. * @api */ -_ol_source_TileWMS_.prototype.getParams = function() { +TileWMS.prototype.getParams = function() { return this.params_; }; @@ -190,7 +190,7 @@ _ol_source_TileWMS_.prototype.getParams = function() { * @return {string|undefined} Request URL. * @private */ -_ol_source_TileWMS_.prototype.getRequestUrl_ = function(tileCoord, tileSize, tileExtent, +TileWMS.prototype.getRequestUrl_ = function(tileCoord, tileSize, tileExtent, pixelRatio, projection, params) { var urls = this.urls; @@ -257,7 +257,7 @@ _ol_source_TileWMS_.prototype.getRequestUrl_ = function(tileCoord, tileSize, til /** * @inheritDoc */ -_ol_source_TileWMS_.prototype.getTilePixelRatio = function(pixelRatio) { +TileWMS.prototype.getTilePixelRatio = function(pixelRatio) { return (!this.hidpi_ || this.serverType_ === undefined) ? 1 : /** @type {number} */ (pixelRatio); }; @@ -267,7 +267,7 @@ _ol_source_TileWMS_.prototype.getTilePixelRatio = function(pixelRatio) { * @private * @return {string} The key for the current params. */ -_ol_source_TileWMS_.prototype.getKeyForParams_ = function() { +TileWMS.prototype.getKeyForParams_ = function() { var i = 0; var res = []; for (var key in this.params_) { @@ -280,7 +280,7 @@ _ol_source_TileWMS_.prototype.getKeyForParams_ = function() { /** * @inheritDoc */ -_ol_source_TileWMS_.prototype.fixedTileUrlFunction = function(tileCoord, pixelRatio, projection) { +TileWMS.prototype.fixedTileUrlFunction = function(tileCoord, pixelRatio, projection) { var tileGrid = this.getTileGrid(); if (!tileGrid) { @@ -328,7 +328,7 @@ _ol_source_TileWMS_.prototype.fixedTileUrlFunction = function(tileCoord, pixelRa * @param {Object} params Params. * @api */ -_ol_source_TileWMS_.prototype.updateParams = function(params) { +TileWMS.prototype.updateParams = function(params) { _ol_obj_.assign(this.params_, params); this.updateV13_(); this.setKey(this.getKeyForParams_()); @@ -338,8 +338,8 @@ _ol_source_TileWMS_.prototype.updateParams = function(params) { /** * @private */ -_ol_source_TileWMS_.prototype.updateV13_ = function() { +TileWMS.prototype.updateV13_ = function() { var version = this.params_['VERSION'] || DEFAULT_WMS_VERSION; this.v13_ = _ol_string_.compareVersions(version, '1.3') >= 0; }; -export default _ol_source_TileWMS_; +export default TileWMS; diff --git a/src/ol/source/UrlTile.js b/src/ol/source/UrlTile.js index db20bd83db..f29470b0ca 100644 --- a/src/ol/source/UrlTile.js +++ b/src/ol/source/UrlTile.js @@ -4,7 +4,7 @@ import {getUid, inherits} from '../index.js'; import TileState from '../TileState.js'; import {expandUrl, createFromTemplates, nullTileUrlFunction} from '../tileurlfunction.js'; -import _ol_source_Tile_ from '../source/Tile.js'; +import TileSource from '../source/Tile.js'; import TileEventType from '../source/TileEventType.js'; import _ol_tilecoord_ from '../tilecoord.js'; @@ -18,9 +18,9 @@ import _ol_tilecoord_ from '../tilecoord.js'; * @extends {ol.source.Tile} * @param {ol.SourceUrlTileOptions} options Image tile options. */ -var _ol_source_UrlTile_ = function(options) { +var UrlTile = function(options) { - _ol_source_Tile_.call(this, { + TileSource.call(this, { attributions: options.attributions, cacheSize: options.cacheSize, extent: options.extent, @@ -69,21 +69,21 @@ var _ol_source_UrlTile_ = function(options) { }; -inherits(_ol_source_UrlTile_, _ol_source_Tile_); +inherits(UrlTile, TileSource); /** * @type {ol.TileUrlFunctionType|undefined} * @protected */ -_ol_source_UrlTile_.prototype.fixedTileUrlFunction; +UrlTile.prototype.fixedTileUrlFunction; /** * Return the tile load function of the source. * @return {ol.TileLoadFunctionType} TileLoadFunction * @api */ -_ol_source_UrlTile_.prototype.getTileLoadFunction = function() { +UrlTile.prototype.getTileLoadFunction = function() { return this.tileLoadFunction; }; @@ -93,7 +93,7 @@ _ol_source_UrlTile_.prototype.getTileLoadFunction = function() { * @return {ol.TileUrlFunctionType} TileUrlFunction * @api */ -_ol_source_UrlTile_.prototype.getTileUrlFunction = function() { +UrlTile.prototype.getTileUrlFunction = function() { return this.tileUrlFunction; }; @@ -105,7 +105,7 @@ _ol_source_UrlTile_.prototype.getTileUrlFunction = function() { * @return {!Array.|null} URLs. * @api */ -_ol_source_UrlTile_.prototype.getUrls = function() { +UrlTile.prototype.getUrls = function() { return this.urls; }; @@ -115,7 +115,7 @@ _ol_source_UrlTile_.prototype.getUrls = function() { * @param {ol.events.Event} event Event. * @protected */ -_ol_source_UrlTile_.prototype.handleTileChange = function(event) { +UrlTile.prototype.handleTileChange = function(event) { var tile = /** @type {ol.Tile} */ (event.target); var uid = getUid(tile); var tileState = tile.getState(); @@ -130,7 +130,7 @@ _ol_source_UrlTile_.prototype.handleTileChange = function(event) { TileEventType.TILELOADEND : undefined; } if (type != undefined) { - this.dispatchEvent(new _ol_source_Tile_.Event(type, tile)); + this.dispatchEvent(new TileSource.Event(type, tile)); } }; @@ -140,7 +140,7 @@ _ol_source_UrlTile_.prototype.handleTileChange = function(event) { * @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function. * @api */ -_ol_source_UrlTile_.prototype.setTileLoadFunction = function(tileLoadFunction) { +UrlTile.prototype.setTileLoadFunction = function(tileLoadFunction) { this.tileCache.clear(); this.tileLoadFunction = tileLoadFunction; this.changed(); @@ -153,7 +153,7 @@ _ol_source_UrlTile_.prototype.setTileLoadFunction = function(tileLoadFunction) { * @param {string=} opt_key Optional new tile key for the source. * @api */ -_ol_source_UrlTile_.prototype.setTileUrlFunction = function(tileUrlFunction, opt_key) { +UrlTile.prototype.setTileUrlFunction = function(tileUrlFunction, opt_key) { this.tileUrlFunction = tileUrlFunction; this.tileCache.pruneExceptNewestZ(); if (typeof opt_key !== 'undefined') { @@ -169,7 +169,7 @@ _ol_source_UrlTile_.prototype.setTileUrlFunction = function(tileUrlFunction, opt * @param {string} url URL. * @api */ -_ol_source_UrlTile_.prototype.setUrl = function(url) { +UrlTile.prototype.setUrl = function(url) { var urls = this.urls = expandUrl(url); this.setTileUrlFunction(this.fixedTileUrlFunction ? this.fixedTileUrlFunction.bind(this) : @@ -182,7 +182,7 @@ _ol_source_UrlTile_.prototype.setUrl = function(url) { * @param {Array.} urls URLs. * @api */ -_ol_source_UrlTile_.prototype.setUrls = function(urls) { +UrlTile.prototype.setUrls = function(urls) { this.urls = urls; var key = urls.join('\n'); this.setTileUrlFunction(this.fixedTileUrlFunction ? @@ -194,10 +194,10 @@ _ol_source_UrlTile_.prototype.setUrls = function(urls) { /** * @inheritDoc */ -_ol_source_UrlTile_.prototype.useTile = function(z, x, y) { +UrlTile.prototype.useTile = function(z, x, y) { var tileCoordKey = _ol_tilecoord_.getKeyZXY(z, x, y); if (this.tileCache.containsKey(tileCoordKey)) { this.tileCache.get(tileCoordKey); } }; -export default _ol_source_UrlTile_; +export default UrlTile; diff --git a/src/ol/source/Vector.js b/src/ol/source/Vector.js index ea1594297e..462e832c77 100644 --- a/src/ol/source/Vector.js +++ b/src/ol/source/Vector.js @@ -33,7 +33,7 @@ import RBush from '../structs/RBush.js'; * @param {olx.source.VectorOptions=} opt_options Vector source options. * @api */ -var _ol_source_Vector_ = function(opt_options) { +var VectorSource = function(opt_options) { var options = opt_options || {}; @@ -149,7 +149,7 @@ var _ol_source_Vector_ = function(opt_options) { }; -inherits(_ol_source_Vector_, Source); +inherits(VectorSource, Source); /** @@ -161,7 +161,7 @@ inherits(_ol_source_Vector_, Source); * @param {ol.Feature} feature Feature to add. * @api */ -_ol_source_Vector_.prototype.addFeature = function(feature) { +VectorSource.prototype.addFeature = function(feature) { this.addFeatureInternal(feature); this.changed(); }; @@ -172,7 +172,7 @@ _ol_source_Vector_.prototype.addFeature = function(feature) { * @param {ol.Feature} feature Feature. * @protected */ -_ol_source_Vector_.prototype.addFeatureInternal = function(feature) { +VectorSource.prototype.addFeatureInternal = function(feature) { var featureKey = getUid(feature).toString(); if (!this.addToIndex_(featureKey, feature)) { @@ -192,7 +192,7 @@ _ol_source_Vector_.prototype.addFeatureInternal = function(feature) { } this.dispatchEvent( - new _ol_source_Vector_.Event(VectorEventType.ADDFEATURE, feature)); + new VectorSource.Event(VectorEventType.ADDFEATURE, feature)); }; @@ -201,7 +201,7 @@ _ol_source_Vector_.prototype.addFeatureInternal = function(feature) { * @param {ol.Feature} feature The feature. * @private */ -_ol_source_Vector_.prototype.setupChangeEvents_ = function(featureKey, feature) { +VectorSource.prototype.setupChangeEvents_ = function(featureKey, feature) { this.featureChangeKeys_[featureKey] = [ _ol_events_.listen(feature, EventType.CHANGE, this.handleFeatureChange_, this), @@ -218,7 +218,7 @@ _ol_source_Vector_.prototype.setupChangeEvents_ = function(featureKey, feature) * candidate for insertion into the Rtree. * @private */ -_ol_source_Vector_.prototype.addToIndex_ = function(featureKey, feature) { +VectorSource.prototype.addToIndex_ = function(featureKey, feature) { var valid = true; var id = feature.getId(); if (id !== undefined) { @@ -241,7 +241,7 @@ _ol_source_Vector_.prototype.addToIndex_ = function(featureKey, feature) { * @param {Array.} features Features to add. * @api */ -_ol_source_Vector_.prototype.addFeatures = function(features) { +VectorSource.prototype.addFeatures = function(features) { this.addFeaturesInternal(features); this.changed(); }; @@ -252,7 +252,7 @@ _ol_source_Vector_.prototype.addFeatures = function(features) { * @param {Array.} features Features. * @protected */ -_ol_source_Vector_.prototype.addFeaturesInternal = function(features) { +VectorSource.prototype.addFeaturesInternal = function(features) { var featureKey, i, length, feature; var extents = []; @@ -286,7 +286,7 @@ _ol_source_Vector_.prototype.addFeaturesInternal = function(features) { } for (i = 0, length = newFeatures.length; i < length; i++) { - this.dispatchEvent(new _ol_source_Vector_.Event( + this.dispatchEvent(new VectorSource.Event( VectorEventType.ADDFEATURE, newFeatures[i])); } }; @@ -296,7 +296,7 @@ _ol_source_Vector_.prototype.addFeaturesInternal = function(features) { * @param {!ol.Collection.} collection Collection. * @private */ -_ol_source_Vector_.prototype.bindFeaturesCollection_ = function(collection) { +VectorSource.prototype.bindFeaturesCollection_ = function(collection) { var modifyingCollection = false; _ol_events_.listen(this, VectorEventType.ADDFEATURE, function(evt) { @@ -339,7 +339,7 @@ _ol_source_Vector_.prototype.bindFeaturesCollection_ = function(collection) { * @param {boolean=} opt_fast Skip dispatching of {@link removefeature} events. * @api */ -_ol_source_Vector_.prototype.clear = function(opt_fast) { +VectorSource.prototype.clear = function(opt_fast) { if (opt_fast) { for (var featureId in this.featureChangeKeys_) { var keys = this.featureChangeKeys_[featureId]; @@ -368,7 +368,7 @@ _ol_source_Vector_.prototype.clear = function(opt_fast) { this.loadedExtentsRtree_.clear(); this.nullGeometryFeatures_ = {}; - var clearEvent = new _ol_source_Vector_.Event(VectorEventType.CLEAR); + var clearEvent = new VectorSource.Event(VectorEventType.CLEAR); this.dispatchEvent(clearEvent); this.changed(); }; @@ -385,7 +385,7 @@ _ol_source_Vector_.prototype.clear = function(opt_fast) { * @template T * @api */ -_ol_source_Vector_.prototype.forEachFeature = function(callback) { +VectorSource.prototype.forEachFeature = function(callback) { if (this.featuresRtree_) { return this.featuresRtree_.forEach(callback); } else if (this.featuresCollection_) { @@ -406,7 +406,7 @@ _ol_source_Vector_.prototype.forEachFeature = function(callback) { * @return {T|undefined} The return value from the last call to the callback. * @template T */ -_ol_source_Vector_.prototype.forEachFeatureAtCoordinateDirect = function(coordinate, callback) { +VectorSource.prototype.forEachFeatureAtCoordinateDirect = function(coordinate, callback) { var extent = [coordinate[0], coordinate[1], coordinate[0], coordinate[1]]; return this.forEachFeatureInExtent(extent, function(feature) { var geometry = feature.getGeometry(); @@ -439,7 +439,7 @@ _ol_source_Vector_.prototype.forEachFeatureAtCoordinateDirect = function(coordin * @template T * @api */ -_ol_source_Vector_.prototype.forEachFeatureInExtent = function(extent, callback) { +VectorSource.prototype.forEachFeatureInExtent = function(extent, callback) { if (this.featuresRtree_) { return this.featuresRtree_.forEachInExtent(extent, callback); } else if (this.featuresCollection_) { @@ -464,7 +464,7 @@ _ol_source_Vector_.prototype.forEachFeatureInExtent = function(extent, callback) * @template T * @api */ -_ol_source_Vector_.prototype.forEachFeatureIntersectingExtent = function(extent, callback) { +VectorSource.prototype.forEachFeatureIntersectingExtent = function(extent, callback) { return this.forEachFeatureInExtent(extent, /** * @param {ol.Feature} feature Feature. @@ -490,7 +490,7 @@ _ol_source_Vector_.prototype.forEachFeatureIntersectingExtent = function(extent, * @return {ol.Collection.} The collection of features. * @api */ -_ol_source_Vector_.prototype.getFeaturesCollection = function() { +VectorSource.prototype.getFeaturesCollection = function() { return this.featuresCollection_; }; @@ -500,7 +500,7 @@ _ol_source_Vector_.prototype.getFeaturesCollection = function() { * @return {Array.} Features. * @api */ -_ol_source_Vector_.prototype.getFeatures = function() { +VectorSource.prototype.getFeatures = function() { var features; if (this.featuresCollection_) { features = this.featuresCollection_.getArray(); @@ -520,7 +520,7 @@ _ol_source_Vector_.prototype.getFeatures = function() { * @return {Array.} Features. * @api */ -_ol_source_Vector_.prototype.getFeaturesAtCoordinate = function(coordinate) { +VectorSource.prototype.getFeaturesAtCoordinate = function(coordinate) { var features = []; this.forEachFeatureAtCoordinateDirect(coordinate, function(feature) { features.push(feature); @@ -540,7 +540,7 @@ _ol_source_Vector_.prototype.getFeaturesAtCoordinate = function(coordinate) { * @return {Array.} Features. * @api */ -_ol_source_Vector_.prototype.getFeaturesInExtent = function(extent) { +VectorSource.prototype.getFeaturesInExtent = function(extent) { return this.featuresRtree_.getInExtent(extent); }; @@ -557,7 +557,7 @@ _ol_source_Vector_.prototype.getFeaturesInExtent = function(extent) { * @return {ol.Feature} Closest feature. * @api */ -_ol_source_Vector_.prototype.getClosestFeatureToCoordinate = function(coordinate, opt_filter) { +VectorSource.prototype.getClosestFeatureToCoordinate = function(coordinate, opt_filter) { // Find the closest feature using branch and bound. We start searching an // infinite extent, and find the distance from the first feature found. This // becomes the closest feature. We then compute a smaller extent which any @@ -610,7 +610,7 @@ _ol_source_Vector_.prototype.getClosestFeatureToCoordinate = function(coordinate * @return {ol.Extent} Extent. * @api */ -_ol_source_Vector_.prototype.getExtent = function(opt_extent) { +VectorSource.prototype.getExtent = function(opt_extent) { return this.featuresRtree_.getExtent(opt_extent); }; @@ -624,7 +624,7 @@ _ol_source_Vector_.prototype.getExtent = function(opt_extent) { * @return {ol.Feature} The feature (or `null` if not found). * @api */ -_ol_source_Vector_.prototype.getFeatureById = function(id) { +VectorSource.prototype.getFeatureById = function(id) { var feature = this.idIndex_[id.toString()]; return feature !== undefined ? feature : null; }; @@ -636,7 +636,7 @@ _ol_source_Vector_.prototype.getFeatureById = function(id) { * @return {ol.format.Feature|undefined} The feature format. * @api */ -_ol_source_Vector_.prototype.getFormat = function() { +VectorSource.prototype.getFormat = function() { return this.format_; }; @@ -644,7 +644,7 @@ _ol_source_Vector_.prototype.getFormat = function() { /** * @return {boolean} The source can have overlapping geometries. */ -_ol_source_Vector_.prototype.getOverlaps = function() { +VectorSource.prototype.getOverlaps = function() { return this.overlaps_; }; @@ -652,7 +652,7 @@ _ol_source_Vector_.prototype.getOverlaps = function() { /** * @override */ -_ol_source_Vector_.prototype.getResolutions = function() {}; +VectorSource.prototype.getResolutions = function() {}; /** @@ -661,7 +661,7 @@ _ol_source_Vector_.prototype.getResolutions = function() {}; * @return {string|ol.FeatureUrlFunction|undefined} The url. * @api */ -_ol_source_Vector_.prototype.getUrl = function() { +VectorSource.prototype.getUrl = function() { return this.url_; }; @@ -670,7 +670,7 @@ _ol_source_Vector_.prototype.getUrl = function() { * @param {ol.events.Event} event Event. * @private */ -_ol_source_Vector_.prototype.handleFeatureChange_ = function(event) { +VectorSource.prototype.handleFeatureChange_ = function(event) { var feature = /** @type {ol.Feature} */ (event.target); var featureKey = getUid(feature).toString(); var geometry = feature.getGeometry(); @@ -713,7 +713,7 @@ _ol_source_Vector_.prototype.handleFeatureChange_ = function(event) { } } this.changed(); - this.dispatchEvent(new _ol_source_Vector_.Event( + this.dispatchEvent(new VectorSource.Event( VectorEventType.CHANGEFEATURE, feature)); }; @@ -721,7 +721,7 @@ _ol_source_Vector_.prototype.handleFeatureChange_ = function(event) { /** * @return {boolean} Is empty. */ -_ol_source_Vector_.prototype.isEmpty = function() { +VectorSource.prototype.isEmpty = function() { return this.featuresRtree_.isEmpty() && _ol_obj_.isEmpty(this.nullGeometryFeatures_); }; @@ -732,7 +732,7 @@ _ol_source_Vector_.prototype.isEmpty = function() { * @param {number} resolution Resolution. * @param {ol.proj.Projection} projection Projection. */ -_ol_source_Vector_.prototype.loadFeatures = function( +VectorSource.prototype.loadFeatures = function( extent, resolution, projection) { var loadedExtentsRtree = this.loadedExtentsRtree_; var extentsToLoad = this.strategy_(extent, resolution); @@ -760,7 +760,7 @@ _ol_source_Vector_.prototype.loadFeatures = function( * @param {ol.Extent} extent Extent. * @api */ -_ol_source_Vector_.prototype.removeLoadedExtent = function(extent) { +VectorSource.prototype.removeLoadedExtent = function(extent) { var loadedExtentsRtree = this.loadedExtentsRtree_; var obj; loadedExtentsRtree.forEachInExtent(extent, function(object) { @@ -782,7 +782,7 @@ _ol_source_Vector_.prototype.removeLoadedExtent = function(extent) { * @param {ol.Feature} feature Feature to remove. * @api */ -_ol_source_Vector_.prototype.removeFeature = function(feature) { +VectorSource.prototype.removeFeature = function(feature) { var featureKey = getUid(feature).toString(); if (featureKey in this.nullGeometryFeatures_) { delete this.nullGeometryFeatures_[featureKey]; @@ -801,7 +801,7 @@ _ol_source_Vector_.prototype.removeFeature = function(feature) { * @param {ol.Feature} feature Feature. * @protected */ -_ol_source_Vector_.prototype.removeFeatureInternal = function(feature) { +VectorSource.prototype.removeFeatureInternal = function(feature) { var featureKey = getUid(feature).toString(); this.featureChangeKeys_[featureKey].forEach(_ol_events_.unlistenByKey); delete this.featureChangeKeys_[featureKey]; @@ -811,7 +811,7 @@ _ol_source_Vector_.prototype.removeFeatureInternal = function(feature) { } else { delete this.undefIdIndex_[featureKey]; } - this.dispatchEvent(new _ol_source_Vector_.Event( + this.dispatchEvent(new VectorSource.Event( VectorEventType.REMOVEFEATURE, feature)); }; @@ -823,7 +823,7 @@ _ol_source_Vector_.prototype.removeFeatureInternal = function(feature) { * @return {boolean} Removed the feature from the index. * @private */ -_ol_source_Vector_.prototype.removeFromIdIndex_ = function(feature) { +VectorSource.prototype.removeFromIdIndex_ = function(feature) { var removed = false; for (var id in this.idIndex_) { if (this.idIndex_[id] === feature) { @@ -842,7 +842,7 @@ _ol_source_Vector_.prototype.removeFromIdIndex_ = function(feature) { * @param {ol.FeatureLoader} loader The loader to set. * @api */ -_ol_source_Vector_.prototype.setLoader = function(loader) { +VectorSource.prototype.setLoader = function(loader) { this.loader_ = loader; }; @@ -858,7 +858,7 @@ _ol_source_Vector_.prototype.setLoader = function(loader) { * @param {string} type Type. * @param {ol.Feature=} opt_feature Feature. */ -_ol_source_Vector_.Event = function(type, opt_feature) { +VectorSource.Event = function(type, opt_feature) { Event.call(this, type); @@ -870,5 +870,5 @@ _ol_source_Vector_.Event = function(type, opt_feature) { this.feature = opt_feature; }; -inherits(_ol_source_Vector_.Event, Event); -export default _ol_source_Vector_; +inherits(VectorSource.Event, Event); +export default VectorSource; diff --git a/src/ol/source/VectorTile.js b/src/ol/source/VectorTile.js index 6b3a38710a..6287477ad3 100644 --- a/src/ol/source/VectorTile.js +++ b/src/ol/source/VectorTile.js @@ -6,7 +6,7 @@ import TileState from '../TileState.js'; import VectorImageTile, {defaultLoadFunction} from '../VectorImageTile.js'; import VectorTile from '../VectorTile.js'; import _ol_size_ from '../size.js'; -import _ol_source_UrlTile_ from '../source/UrlTile.js'; +import UrlTile from '../source/UrlTile.js'; import _ol_tilecoord_ from '../tilecoord.js'; import _ol_tilegrid_ from '../tilegrid.js'; @@ -26,7 +26,7 @@ import _ol_tilegrid_ from '../tilegrid.js'; * @param {olx.source.VectorTileOptions} options Vector tile options. * @api */ -var _ol_source_VectorTile_ = function(options) { +var VectorTileSource = function(options) { var projection = options.projection || 'EPSG:3857'; var extent = options.extent || _ol_tilegrid_.extentFromProjection(projection); @@ -38,7 +38,7 @@ var _ol_source_VectorTile_ = function(options) { tileSize: options.tileSize || 512 }); - _ol_source_UrlTile_.call(this, { + UrlTile.call(this, { attributions: options.attributions, cacheSize: options.cacheSize !== undefined ? options.cacheSize : 128, extent: extent, @@ -87,13 +87,13 @@ var _ol_source_VectorTile_ = function(options) { }; -inherits(_ol_source_VectorTile_, _ol_source_UrlTile_); +inherits(VectorTileSource, UrlTile); /** * @return {boolean} The source can have overlapping geometries. */ -_ol_source_VectorTile_.prototype.getOverlaps = function() { +VectorTileSource.prototype.getOverlaps = function() { return this.overlaps_; }; @@ -101,7 +101,7 @@ _ol_source_VectorTile_.prototype.getOverlaps = function() { * clear {@link ol.TileCache} and delete all source tiles * @api */ -_ol_source_VectorTile_.prototype.clear = function() { +VectorTileSource.prototype.clear = function() { this.tileCache.clear(); this.sourceTiles_ = {}; }; @@ -109,7 +109,7 @@ _ol_source_VectorTile_.prototype.clear = function() { /** * @inheritDoc */ -_ol_source_VectorTile_.prototype.getTile = function(z, x, y, pixelRatio, projection) { +VectorTileSource.prototype.getTile = function(z, x, y, pixelRatio, projection) { var tileCoordKey = _ol_tilecoord_.getKeyZXY(z, x, y); if (this.tileCache.containsKey(tileCoordKey)) { return /** @type {!ol.Tile} */ (this.tileCache.get(tileCoordKey)); @@ -136,7 +136,7 @@ _ol_source_VectorTile_.prototype.getTile = function(z, x, y, pixelRatio, project /** * @inheritDoc */ -_ol_source_VectorTile_.prototype.getTileGridForProjection = function(projection) { +VectorTileSource.prototype.getTileGridForProjection = function(projection) { var code = projection.getCode(); var tileGrid = this.tileGrids_[code]; if (!tileGrid) { @@ -153,7 +153,7 @@ _ol_source_VectorTile_.prototype.getTileGridForProjection = function(projection) /** * @inheritDoc */ -_ol_source_VectorTile_.prototype.getTilePixelRatio = function(pixelRatio) { +VectorTileSource.prototype.getTilePixelRatio = function(pixelRatio) { return pixelRatio; }; @@ -161,8 +161,8 @@ _ol_source_VectorTile_.prototype.getTilePixelRatio = function(pixelRatio) { /** * @inheritDoc */ -_ol_source_VectorTile_.prototype.getTilePixelSize = function(z, pixelRatio, projection) { +VectorTileSource.prototype.getTilePixelSize = function(z, pixelRatio, projection) { var tileSize = _ol_size_.toSize(this.getTileGridForProjection(projection).getTileSize(z)); return [Math.round(tileSize[0] * pixelRatio), Math.round(tileSize[1] * pixelRatio)]; }; -export default _ol_source_VectorTile_; +export default VectorTileSource; diff --git a/src/ol/source/WMTS.js b/src/ol/source/WMTS.js index a716513d6f..82455ca207 100644 --- a/src/ol/source/WMTS.js +++ b/src/ol/source/WMTS.js @@ -7,7 +7,7 @@ import {find, findIndex, includes} from '../array.js'; import {containsExtent} from '../extent.js'; import _ol_obj_ from '../obj.js'; import {get as getProjection, equivalent, transformExtent} from '../proj.js'; -import _ol_source_TileImage_ from '../source/TileImage.js'; +import TileImage from '../source/TileImage.js'; import WMTSRequestEncoding from '../source/WMTSRequestEncoding.js'; import {createFromCapabilitiesMatrixSet} from '../tilegrid/WMTS.js'; import _ol_uri_ from '../uri.js'; @@ -21,7 +21,7 @@ import _ol_uri_ from '../uri.js'; * @param {olx.source.WMTSOptions} options WMTS options. * @api */ -var _ol_source_WMTS_ = function(options) { +var WMTS = function(options) { // TODO: add support for TileMatrixLimits @@ -153,7 +153,7 @@ var _ol_source_WMTS_ = function(options) { var tileUrlFunction = (urls && urls.length > 0) ? createFromTileUrlFunctions(urls.map(this.createFromWMTSTemplate_)) : nullTileUrlFunction; - _ol_source_TileImage_.call(this, { + TileImage.call(this, { attributions: options.attributions, cacheSize: options.cacheSize, crossOrigin: options.crossOrigin, @@ -173,14 +173,14 @@ var _ol_source_WMTS_ = function(options) { }; -inherits(_ol_source_WMTS_, _ol_source_TileImage_); +inherits(WMTS, TileImage); /** * Set the URLs to use for requests. * URLs may contain OCG conform URL Template Variables: {TileMatrix}, {TileRow}, {TileCol}. * @override */ -_ol_source_WMTS_.prototype.setUrls = function(urls) { +WMTS.prototype.setUrls = function(urls) { this.urls = urls; var key = urls.join('\n'); this.setTileUrlFunction(this.fixedTileUrlFunction ? @@ -195,7 +195,7 @@ _ol_source_WMTS_.prototype.setUrls = function(urls) { * @return {!Object} Dimensions. * @api */ -_ol_source_WMTS_.prototype.getDimensions = function() { +WMTS.prototype.getDimensions = function() { return this.dimensions_; }; @@ -205,7 +205,7 @@ _ol_source_WMTS_.prototype.getDimensions = function() { * @return {string} Format. * @api */ -_ol_source_WMTS_.prototype.getFormat = function() { +WMTS.prototype.getFormat = function() { return this.format_; }; @@ -215,7 +215,7 @@ _ol_source_WMTS_.prototype.getFormat = function() { * @return {string} Layer. * @api */ -_ol_source_WMTS_.prototype.getLayer = function() { +WMTS.prototype.getLayer = function() { return this.layer_; }; @@ -225,7 +225,7 @@ _ol_source_WMTS_.prototype.getLayer = function() { * @return {string} MatrixSet. * @api */ -_ol_source_WMTS_.prototype.getMatrixSet = function() { +WMTS.prototype.getMatrixSet = function() { return this.matrixSet_; }; @@ -235,7 +235,7 @@ _ol_source_WMTS_.prototype.getMatrixSet = function() { * @return {ol.source.WMTSRequestEncoding} Request encoding. * @api */ -_ol_source_WMTS_.prototype.getRequestEncoding = function() { +WMTS.prototype.getRequestEncoding = function() { return this.requestEncoding_; }; @@ -245,7 +245,7 @@ _ol_source_WMTS_.prototype.getRequestEncoding = function() { * @return {string} Style. * @api */ -_ol_source_WMTS_.prototype.getStyle = function() { +WMTS.prototype.getStyle = function() { return this.style_; }; @@ -255,7 +255,7 @@ _ol_source_WMTS_.prototype.getStyle = function() { * @return {string} Version. * @api */ -_ol_source_WMTS_.prototype.getVersion = function() { +WMTS.prototype.getVersion = function() { return this.version_; }; @@ -264,7 +264,7 @@ _ol_source_WMTS_.prototype.getVersion = function() { * @private * @return {string} The key for the current dimensions. */ -_ol_source_WMTS_.prototype.getKeyForDimensions_ = function() { +WMTS.prototype.getKeyForDimensions_ = function() { var i = 0; var res = []; for (var key in this.dimensions_) { @@ -279,7 +279,7 @@ _ol_source_WMTS_.prototype.getKeyForDimensions_ = function() { * @param {Object} dimensions Dimensions. * @api */ -_ol_source_WMTS_.prototype.updateDimensions = function(dimensions) { +WMTS.prototype.updateDimensions = function(dimensions) { _ol_obj_.assign(this.dimensions_, dimensions); this.setKey(this.getKeyForDimensions_()); }; @@ -309,7 +309,7 @@ _ol_source_WMTS_.prototype.updateDimensions = function(dimensions) { * @return {?olx.source.WMTSOptions} WMTS source options object or `null` if the layer was not found. * @api */ -_ol_source_WMTS_.optionsFromCapabilities = function(wmtsCap, config) { +WMTS.optionsFromCapabilities = function(wmtsCap, config) { var layers = wmtsCap['Contents']['Layer']; var l = find(layers, function(elt, index, array) { return elt['Identifier'] == config['layer']; @@ -477,4 +477,4 @@ _ol_source_WMTS_.optionsFromCapabilities = function(wmtsCap, config) { crossOrigin: config['crossOrigin'] }; }; -export default _ol_source_WMTS_; +export default WMTS; diff --git a/src/ol/source/XYZ.js b/src/ol/source/XYZ.js index 021928d1cb..98a41fb560 100644 --- a/src/ol/source/XYZ.js +++ b/src/ol/source/XYZ.js @@ -2,7 +2,7 @@ * @module ol/source/XYZ */ import {inherits} from '../index.js'; -import _ol_source_TileImage_ from '../source/TileImage.js'; +import TileImage from '../source/TileImage.js'; import _ol_tilegrid_ from '../tilegrid.js'; /** @@ -27,7 +27,7 @@ import _ol_tilegrid_ from '../tilegrid.js'; * @param {olx.source.XYZOptions=} opt_options XYZ options. * @api */ -var _ol_source_XYZ_ = function(opt_options) { +var XYZ = function(opt_options) { var options = opt_options || {}; var projection = options.projection !== undefined ? options.projection : 'EPSG:3857'; @@ -40,7 +40,7 @@ var _ol_source_XYZ_ = function(opt_options) { tileSize: options.tileSize }); - _ol_source_TileImage_.call(this, { + TileImage.call(this, { attributions: options.attributions, cacheSize: options.cacheSize, crossOrigin: options.crossOrigin, @@ -59,5 +59,5 @@ var _ol_source_XYZ_ = function(opt_options) { }; -inherits(_ol_source_XYZ_, _ol_source_TileImage_); -export default _ol_source_XYZ_; +inherits(XYZ, TileImage); +export default XYZ; diff --git a/src/ol/source/Zoomify.js b/src/ol/source/Zoomify.js index e4912966cf..ac4dd05494 100644 --- a/src/ol/source/Zoomify.js +++ b/src/ol/source/Zoomify.js @@ -10,7 +10,7 @@ import {assert} from '../asserts.js'; import {createCanvasContext2D} from '../dom.js'; import {getTopLeft} from '../extent.js'; import _ol_size_ from '../size.js'; -import _ol_source_TileImage_ from '../source/TileImage.js'; +import TileImage from '../source/TileImage.js'; import TileGrid from '../tilegrid/TileGrid.js'; /** @@ -23,14 +23,14 @@ import TileGrid from '../tilegrid/TileGrid.js'; * @param {olx.source.ZoomifyOptions=} opt_options Options. * @api */ -var _ol_source_Zoomify_ = function(opt_options) { +var Zoomify = function(opt_options) { var options = opt_options || {}; var size = options.size; var tierSizeCalculation = options.tierSizeCalculation !== undefined ? options.tierSizeCalculation : - _ol_source_Zoomify_.TierSizeCalculation_.DEFAULT; + Zoomify.TierSizeCalculation_.DEFAULT; var imageWidth = size[0]; var imageHeight = size[1]; @@ -40,7 +40,7 @@ var _ol_source_Zoomify_ = function(opt_options) { var tileSizeForTierSizeCalculation = tileSize; switch (tierSizeCalculation) { - case _ol_source_Zoomify_.TierSizeCalculation_.DEFAULT: + case Zoomify.TierSizeCalculation_.DEFAULT: while (imageWidth > tileSizeForTierSizeCalculation || imageHeight > tileSizeForTierSizeCalculation) { tierSizeInTiles.push([ Math.ceil(imageWidth / tileSizeForTierSizeCalculation), @@ -49,7 +49,7 @@ var _ol_source_Zoomify_ = function(opt_options) { tileSizeForTierSizeCalculation += tileSizeForTierSizeCalculation; } break; - case _ol_source_Zoomify_.TierSizeCalculation_.TRUNCATED: + case Zoomify.TierSizeCalculation_.TRUNCATED: var width = imageWidth; var height = imageHeight; while (width > tileSizeForTierSizeCalculation || height > tileSizeForTierSizeCalculation) { @@ -135,9 +135,9 @@ var _ol_source_Zoomify_ = function(opt_options) { var tileUrlFunction = createFromTileUrlFunctions(urls.map(createFromTemplate)); - var ZoomifyTileClass = _ol_source_Zoomify_.Tile_.bind(null, tileGrid); + var ZoomifyTileClass = Zoomify.Tile_.bind(null, tileGrid); - _ol_source_TileImage_.call(this, { + TileImage.call(this, { attributions: options.attributions, cacheSize: options.cacheSize, crossOrigin: options.crossOrigin, @@ -151,7 +151,7 @@ var _ol_source_Zoomify_ = function(opt_options) { }; -inherits(_ol_source_Zoomify_, _ol_source_TileImage_); +inherits(Zoomify, TileImage); /** * @constructor @@ -165,7 +165,7 @@ inherits(_ol_source_Zoomify_, _ol_source_TileImage_); * @param {olx.TileOptions=} opt_options Tile options. * @private */ -_ol_source_Zoomify_.Tile_ = function( +Zoomify.Tile_ = function( tileGrid, tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) { ImageTile.call(this, tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options); @@ -182,13 +182,13 @@ _ol_source_Zoomify_.Tile_ = function( */ this.tileSize_ = _ol_size_.toSize(tileGrid.getTileSize(tileCoord[0])); }; -inherits(_ol_source_Zoomify_.Tile_, ImageTile); +inherits(Zoomify.Tile_, ImageTile); /** * @inheritDoc */ -_ol_source_Zoomify_.Tile_.prototype.getImage = function() { +Zoomify.Tile_.prototype.getImage = function() { if (this.zoomifyImage_) { return this.zoomifyImage_; } @@ -213,8 +213,8 @@ _ol_source_Zoomify_.Tile_.prototype.getImage = function() { * @enum {string} * @private */ -_ol_source_Zoomify_.TierSizeCalculation_ = { +Zoomify.TierSizeCalculation_ = { DEFAULT: 'default', TRUNCATED: 'truncated' }; -export default _ol_source_Zoomify_; +export default Zoomify; diff --git a/src/ol/tilegrid.js b/src/ol/tilegrid.js index 306b2ec34b..8f5a0dd27e 100644 --- a/src/ol/tilegrid.js +++ b/src/ol/tilegrid.js @@ -7,7 +7,7 @@ import {containsCoordinate, createOrUpdate, getCorner, getHeight, getWidth} from import Corner from './extent/Corner.js'; import _ol_obj_ from './obj.js'; import {get as getProjection, METERS_PER_UNIT} from './proj.js'; -import _ol_proj_Units_ from './proj/Units.js'; +import Units from './proj/Units.js'; import TileGrid from './tilegrid/TileGrid.js'; var _ol_tilegrid_ = {}; @@ -150,7 +150,7 @@ _ol_tilegrid_.extentFromProjection = function(projection) { projection = getProjection(projection); var extent = projection.getExtent(); if (!extent) { - var half = 180 * METERS_PER_UNIT[_ol_proj_Units_.DEGREES] / + var half = 180 * METERS_PER_UNIT[Units.DEGREES] / projection.getMetersPerUnit(); extent = createOrUpdate(-half, -half, half, half); } diff --git a/test/rendering/ol/layer/clip.test.js b/test/rendering/ol/layer/clip.test.js index 72756f80f4..c620fdcb5f 100644 --- a/test/rendering/ol/layer/clip.test.js +++ b/test/rendering/ol/layer/clip.test.js @@ -1,8 +1,8 @@ import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; import TileLayer from '../../../../src/ol/layer/Tile.js'; -import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js'; +import XYZ from '../../../../src/ol/source/XYZ.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; @@ -41,7 +41,7 @@ describe('layer clipping', function() { map = new Map({ pixelRatio: 1, target: createMapDiv(256, 256), - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 0 }) @@ -55,7 +55,7 @@ describe('layer clipping', function() { it('clips to all parts of the MultiPolygon', function(done) { - var source = new _ol_source_XYZ_({ + var source = new XYZ({ url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png', transition: 0 }); diff --git a/test/rendering/ol/layer/image.test.js b/test/rendering/ol/layer/image.test.js index 1d44b466ae..4d7f9343ff 100644 --- a/test/rendering/ol/layer/image.test.js +++ b/test/rendering/ol/layer/image.test.js @@ -1,9 +1,9 @@ import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; -import _ol_layer_Image_ from '../../../../src/ol/layer/Image.js'; +import View from '../../../../src/ol/View.js'; +import ImageLayer from '../../../../src/ol/layer/Image.js'; import _ol_obj_ from '../../../../src/ol/obj.js'; import {get as getProjection, transform, transformExtent} from '../../../../src/ol/proj.js'; -import _ol_source_ImageStatic_ from '../../../../src/ol/source/ImageStatic.js'; +import Static from '../../../../src/ol/source/ImageStatic.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -16,7 +16,7 @@ describe('ol.rendering.layer.Image', function() { pixelRatio: 1, target: createMapDiv(50, 50), renderer: renderer, - view: new _ol_View_({ + view: new View({ center: transform( [-122.416667, 37.783333], 'EPSG:4326', 'EPSG:3857'), zoom: 5 @@ -57,7 +57,7 @@ describe('ol.rendering.layer.Image', function() { source: source }; _ol_obj_.assign(options, layerOptions); - map.addLayer(new _ol_layer_Image_(options)); + map.addLayer(new ImageLayer(options)); }); } @@ -65,7 +65,7 @@ describe('ol.rendering.layer.Image', function() { var source; beforeEach(function() { - source = new _ol_source_ImageStatic_({ + source = new Static({ url: 'rendering/ol/data/tiles/osm/5/5/12.png', imageExtent: _ol_tilegrid_.createXYZ().getTileCoordExtent( [5, 5, -12 - 1]), @@ -95,7 +95,7 @@ describe('ol.rendering.layer.Image', function() { var source; beforeEach(function() { - source = new _ol_source_ImageStatic_({ + source = new Static({ url: 'rendering/ol/data/tiles/osm/5/5/12.png', imageExtent: transformExtent( [-123, 37, -122, 38], 'EPSG:4326', 'EPSG:3857') diff --git a/test/rendering/ol/layer/tile.test.js b/test/rendering/ol/layer/tile.test.js index 937b6eeaa5..36ad343f77 100644 --- a/test/rendering/ol/layer/tile.test.js +++ b/test/rendering/ol/layer/tile.test.js @@ -1,12 +1,12 @@ import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js'; import Point from '../../../../src/ol/geom/Point.js'; import TileLayer from '../../../../src/ol/layer/Tile.js'; import _ol_obj_ from '../../../../src/ol/obj.js'; import {transform} from '../../../../src/ol/proj.js'; -import _ol_source_TileImage_ from '../../../../src/ol/source/TileImage.js'; -import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js'; +import TileImage from '../../../../src/ol/source/TileImage.js'; +import XYZ from '../../../../src/ol/source/XYZ.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -24,7 +24,7 @@ describe('ol.rendering.layer.Tile', function() { pixelRatio: opt_pixelRatio || 1, target: createMapDiv(size[0], size[1]), renderer: renderer, - view: new _ol_View_({ + view: new View({ center: opt_center !== undefined ? opt_center : transform( [-122.416667, 37.783333], 'EPSG:4326', 'EPSG:3857'), resolutions: opt_resolutions, @@ -73,7 +73,7 @@ describe('ol.rendering.layer.Tile', function() { describe('with tile transition', function() { it('renders correctly after the transition', function(done) { createMap('canvas'); - var source = new _ol_source_XYZ_({ + var source = new XYZ({ url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png' }); waitForTiles([source], {}, function() { @@ -89,7 +89,7 @@ describe('ol.rendering.layer.Tile', function() { var source; beforeEach(function() { - source = new _ol_source_XYZ_({ + source = new XYZ({ url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png', transition: 0 }); @@ -117,11 +117,11 @@ describe('ol.rendering.layer.Tile', function() { var source1, source2; beforeEach(function() { - source1 = new _ol_source_XYZ_({ + source1 = new XYZ({ url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png', transition: 0 }); - source2 = new _ol_source_XYZ_({ + source2 = new XYZ({ url: 'rendering/ol/data/tiles/stamen-labels/{z}/{x}/{y}.png', transition: 0 }); @@ -191,7 +191,7 @@ describe('ol.rendering.layer.Tile', function() { var source; beforeEach(function() { - source = new _ol_source_XYZ_({ + source = new XYZ({ url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png', transition: 0 }); @@ -218,7 +218,7 @@ describe('ol.rendering.layer.Tile', function() { describe('tile layer with non-square tiles', function() { function createSource(tileSize) { - return new _ol_source_TileImage_({ + return new TileImage({ url: 'rendering/ol/data/tiles/' + tileSize + '/{z}/{x}/{y}.png', tileGrid: _ol_tilegrid_.createXYZ({ tileSize: tileSize.split('x') @@ -272,7 +272,7 @@ describe('ol.rendering.layer.Tile', function() { var source, onAddLayer; beforeEach(function() { - source = new _ol_source_XYZ_({ + source = new XYZ({ url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png', transition: 0 }); diff --git a/test/rendering/ol/layer/vector.test.js b/test/rendering/ol/layer/vector.test.js index 8abc6e5dcb..c034d5701b 100644 --- a/test/rendering/ol/layer/vector.test.js +++ b/test/rendering/ol/layer/vector.test.js @@ -1,13 +1,13 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import GeoJSON from '../../../../src/ol/format/GeoJSON.js'; import Circle from '../../../../src/ol/geom/Circle.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import Point from '../../../../src/ol/geom/Point.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; -import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; +import VectorLayer from '../../../../src/ol/layer/Vector.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -25,7 +25,7 @@ describe('ol.rendering.layer.Vector', function() { pixelRatio: 1, target: createMapDiv(80, 80), renderer: renderer, - view: new _ol_View_({ + view: new View({ center: center, zoom: 13 }) @@ -42,11 +42,11 @@ describe('ol.rendering.layer.Vector', function() { var source; function addCircle(r) { - source.addFeature(new _ol_Feature_(new Circle(center, r))); + source.addFeature(new Feature(new Circle(center, r))); } function addPolygon(r) { - source.addFeature(new _ol_Feature_(new Polygon([ + source.addFeature(new Feature(new Polygon([ [ [center[0] - r, center[1] - r], [center[0] + r, center[1] - r], @@ -58,7 +58,7 @@ describe('ol.rendering.layer.Vector', function() { } function addLineString(r) { - source.addFeature(new _ol_Feature_(new LineString([ + source.addFeature(new Feature(new LineString([ [center[0] - r, center[1] - r], [center[0] + r, center[1] - r], [center[0] + r, center[1] + r], @@ -70,12 +70,12 @@ describe('ol.rendering.layer.Vector', function() { describe('vector layer', function() { beforeEach(function() { - source = new _ol_source_Vector_(); + source = new VectorSource(); }); it('renders opacity correctly with the canvas renderer', function(done) { createMap('canvas'); - var smallLine = new _ol_Feature_(new LineString([ + var smallLine = new Feature(new LineString([ [center[0], center[1] - 1], [center[0], center[1] + 1] ])); @@ -90,7 +90,7 @@ describe('ol.rendering.layer.Vector', function() { addCircle(500); addPolygon(600); addPolygon(720); - map.addLayer(new _ol_layer_Vector_({ + map.addLayer(new VectorLayer({ source: source })); map.once('postrender', function() { @@ -101,7 +101,7 @@ describe('ol.rendering.layer.Vector', function() { it('renders opacity correctly with renderMode: \'image\'', function(done) { createMap('canvas'); - var smallLine = new _ol_Feature_(new LineString([ + var smallLine = new Feature(new LineString([ [center[0], center[1] - 1], [center[0], center[1] + 1] ])); @@ -116,7 +116,7 @@ describe('ol.rendering.layer.Vector', function() { addCircle(500); addPolygon(600); addPolygon(720); - map.addLayer(new _ol_layer_Vector_({ + map.addLayer(new VectorLayer({ renerMode: 'image', source: source })); @@ -128,7 +128,7 @@ describe('ol.rendering.layer.Vector', function() { it('renders transparent layers correctly with the canvas renderer', function(done) { createMap('canvas'); - var smallLine = new _ol_Feature_(new LineString([ + var smallLine = new Feature(new LineString([ [center[0], center[1] - 1], [center[0], center[1] + 1] ])); @@ -141,7 +141,7 @@ describe('ol.rendering.layer.Vector', function() { }) ]); source.addFeature(smallLine); - var smallLine2 = new _ol_Feature_(new LineString([ + var smallLine2 = new Feature(new LineString([ [center[0], center[1] - 1000], [center[0], center[1] + 1000] ])); @@ -155,7 +155,7 @@ describe('ol.rendering.layer.Vector', function() { ]); source.addFeature(smallLine2); - map.addLayer(new _ol_layer_Vector_({ + map.addLayer(new VectorLayer({ source: source, opacity: 0.5 })); @@ -167,7 +167,7 @@ describe('ol.rendering.layer.Vector', function() { it('renders transparent layers correctly with renderMode: \'image\'', function(done) { createMap('canvas'); - var smallLine = new _ol_Feature_(new LineString([ + var smallLine = new Feature(new LineString([ [center[0], center[1] - 1], [center[0], center[1] + 1] ])); @@ -180,7 +180,7 @@ describe('ol.rendering.layer.Vector', function() { }) ]); source.addFeature(smallLine); - var smallLine2 = new _ol_Feature_(new LineString([ + var smallLine2 = new Feature(new LineString([ [center[0], center[1] - 1000], [center[0], center[1] + 1000] ])); @@ -194,7 +194,7 @@ describe('ol.rendering.layer.Vector', function() { ]); source.addFeature(smallLine2); - map.addLayer(new _ol_layer_Vector_({ + map.addLayer(new VectorLayer({ renderMode: 'image', source: source, opacity: 0.5 @@ -210,7 +210,7 @@ describe('ol.rendering.layer.Vector', function() { map.getView().setRotation(Math.PI + Math.PI / 4); addPolygon(300); addCircle(500); - map.addLayer(new _ol_layer_Vector_({ + map.addLayer(new VectorLayer({ source: source, style: new _ol_style_Style_({ stroke: new _ol_style_Stroke_({ @@ -230,7 +230,7 @@ describe('ol.rendering.layer.Vector', function() { map.getView().setRotation(Math.PI + Math.PI / 4); addPolygon(300); addCircle(500); - map.addLayer(new _ol_layer_Vector_({ + map.addLayer(new VectorLayer({ renderMode: 'image', source: source, style: new _ol_style_Style_({ @@ -251,7 +251,7 @@ describe('ol.rendering.layer.Vector', function() { addCircle(500); addPolygon(300); map.skipFeature(source.getFeatures()[1]); - map.addLayer(new _ol_layer_Vector_({ + map.addLayer(new VectorLayer({ renderMode: 'image', source: source, style: new _ol_style_Style_({ @@ -274,7 +274,7 @@ describe('ol.rendering.layer.Vector', function() { it('renders fill/stroke batches correctly with the canvas renderer', function(done) { createMap('canvas'); - source = new _ol_source_Vector_({ + source = new VectorSource({ overlaps: false }); addPolygon(100); @@ -283,7 +283,7 @@ describe('ol.rendering.layer.Vector', function() { addCircle(500); addPolygon(600); addPolygon(720); - map.addLayer(new _ol_layer_Vector_({ + map.addLayer(new VectorLayer({ source: source, style: new _ol_style_Style_({ stroke: new _ol_style_Stroke_({ @@ -300,14 +300,14 @@ describe('ol.rendering.layer.Vector', function() { it('renders stroke batches correctly with the canvas renderer', function(done) { createMap('canvas'); - source = new _ol_source_Vector_({ + source = new VectorSource({ overlaps: false }); addLineString(100); addLineString(250); addLineString(600); addLineString(720); - map.addLayer(new _ol_layer_Vector_({ + map.addLayer(new VectorLayer({ source: source, style: new _ol_style_Style_({ stroke: new _ol_style_Stroke_({ @@ -327,7 +327,7 @@ describe('ol.rendering.layer.Vector', function() { var color; function createSource(overlaps) { color = '#3399CC'; - source = new _ol_source_Vector_({ + source = new VectorSource({ overlaps: overlaps }); addPolygon(720); @@ -346,7 +346,7 @@ describe('ol.rendering.layer.Vector', function() { } return color; } - var layer = new _ol_layer_Vector_({ + var layer = new VectorLayer({ source: createSource(true), style: function(feature) { alternateColor(); @@ -380,7 +380,7 @@ describe('ol.rendering.layer.Vector', function() { var color; function createSource(overlaps) { color = '#3399CC'; - source = new _ol_source_Vector_({ + source = new VectorSource({ overlaps: overlaps }); addLineString(720); @@ -397,7 +397,7 @@ describe('ol.rendering.layer.Vector', function() { } return color; } - var layer = new _ol_layer_Vector_({ + var layer = new VectorLayer({ source: createSource(true), style: function(feature) { alternateColor(); @@ -434,7 +434,7 @@ describe('ol.rendering.layer.Vector', function() { map2 = new Map({ pixelRatio: 1, target: createMapDiv(128, 128), - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 0 }) @@ -466,8 +466,8 @@ describe('ol.rendering.layer.Vector', function() { var format = new GeoJSON({featureProjection: 'EPSG:3857'}); var feature = format.readFeature(json); - var layer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ + var layer = new VectorLayer({ + source: new VectorSource({ features: [feature] }), style: new _ol_style_Style_({ @@ -492,16 +492,16 @@ describe('ol.rendering.layer.Vector', function() { var layer, map3; beforeEach(function() { - var src = new _ol_source_Vector_({ + var src = new VectorSource({ features: [ - new _ol_Feature_(new Polygon([[ + new Feature(new Polygon([[ [-22, 58], [-22, 78], [-9, 78], [-9, 58], [-22, 58] ]])), - new _ol_Feature_(new Polygon([[ + new Feature(new Polygon([[ [-9, 58], [-9, 78], [4, 78], @@ -510,11 +510,11 @@ describe('ol.rendering.layer.Vector', function() { ]])) ] }); - layer = new _ol_layer_Vector_({ + layer = new VectorLayer({ renderBuffer: 0, source: src }); - var view = new _ol_View_({ + var view = new View({ center: [-9.5, 78], zoom: 2, projection: 'EPSG:4326' @@ -579,26 +579,26 @@ describe('ol.rendering.layer.Vector', function() { describe('decluttering', function() { beforeEach(function() { - source = new _ol_source_Vector_(); + source = new VectorSource(); }); it('declutters text', function(done) { createMap('canvas'); - var layer = new _ol_layer_Vector_({ + var layer = new VectorLayer({ source: source }); map.addLayer(layer); - var centerFeature = new _ol_Feature_({ + var centerFeature = new Feature({ geometry: new Point(center), text: 'center' }); source.addFeature(centerFeature); - source.addFeature(new _ol_Feature_({ + source.addFeature(new Feature({ geometry: new Point([center[0] - 540, center[1]]), text: 'west' })); - source.addFeature(new _ol_Feature_({ + source.addFeature(new Feature({ geometry: new Point([center[0] + 540, center[1]]), text: 'east' })); @@ -624,22 +624,22 @@ describe('ol.rendering.layer.Vector', function() { it('declutters text with renderMode: \'image\'', function(done) { createMap('canvas'); - var layer = new _ol_layer_Vector_({ + var layer = new VectorLayer({ renderMode: 'image', source: source }); map.addLayer(layer); - var centerFeature = new _ol_Feature_({ + var centerFeature = new Feature({ geometry: new Point(center), text: 'center' }); source.addFeature(centerFeature); - source.addFeature(new _ol_Feature_({ + source.addFeature(new Feature({ geometry: new Point([center[0] - 540, center[1]]), text: 'west' })); - source.addFeature(new _ol_Feature_({ + source.addFeature(new Feature({ geometry: new Point([center[0] + 540, center[1]]), text: 'east' })); @@ -665,22 +665,22 @@ describe('ol.rendering.layer.Vector', function() { it('declutters text and respects z-index', function(done) { createMap('canvas'); - var layer = new _ol_layer_Vector_({ + var layer = new VectorLayer({ source: source }); map.addLayer(layer); - source.addFeature(new _ol_Feature_({ + source.addFeature(new Feature({ geometry: new Point(center), text: 'center', zIndex: 2 })); - source.addFeature(new _ol_Feature_({ + source.addFeature(new Feature({ geometry: new Point([center[0] - 540, center[1]]), text: 'west', zIndex: 3 })); - source.addFeature(new _ol_Feature_({ + source.addFeature(new Feature({ geometry: new Point([center[0] + 540, center[1]]), text: 'east', zIndex: 1 @@ -705,19 +705,19 @@ describe('ol.rendering.layer.Vector', function() { it('declutters images', function(done) { createMap('canvas'); - var layer = new _ol_layer_Vector_({ + var layer = new VectorLayer({ source: source }); map.addLayer(layer); - var centerFeature = new _ol_Feature_({ + var centerFeature = new Feature({ geometry: new Point(center) }); source.addFeature(centerFeature); - source.addFeature(new _ol_Feature_({ + source.addFeature(new Feature({ geometry: new Point([center[0] - 540, center[1]]) })); - source.addFeature(new _ol_Feature_({ + source.addFeature(new Feature({ geometry: new Point([center[0] + 540, center[1]]) })); @@ -744,20 +744,20 @@ describe('ol.rendering.layer.Vector', function() { it('declutters images with renderMode: \'image\'', function(done) { createMap('canvas'); - var layer = new _ol_layer_Vector_({ + var layer = new VectorLayer({ renderMode: 'image', source: source }); map.addLayer(layer); - var centerFeature = new _ol_Feature_({ + var centerFeature = new Feature({ geometry: new Point(center) }); source.addFeature(centerFeature); - source.addFeature(new _ol_Feature_({ + source.addFeature(new Feature({ geometry: new Point([center[0] - 540, center[1]]) })); - source.addFeature(new _ol_Feature_({ + source.addFeature(new Feature({ geometry: new Point([center[0] + 540, center[1]]) })); @@ -784,20 +784,20 @@ describe('ol.rendering.layer.Vector', function() { it('declutters images and respects z-index', function(done) { createMap('canvas'); - var layer = new _ol_layer_Vector_({ + var layer = new VectorLayer({ source: source }); map.addLayer(layer); - source.addFeature(new _ol_Feature_({ + source.addFeature(new Feature({ geometry: new Point(center), zIndex: 2 })); - source.addFeature(new _ol_Feature_({ + source.addFeature(new Feature({ geometry: new Point([center[0] - 540, center[1]]), zIndex: 3 })); - source.addFeature(new _ol_Feature_({ + source.addFeature(new Feature({ geometry: new Point([center[0] + 540, center[1]]), zIndex: 1 })); @@ -823,20 +823,20 @@ describe('ol.rendering.layer.Vector', function() { it('declutters image & text groups', function(done) { createMap('canvas'); - var layer = new _ol_layer_Vector_({ + var layer = new VectorLayer({ source: source }); map.addLayer(layer); - source.addFeature(new _ol_Feature_({ + source.addFeature(new Feature({ geometry: new Point(center), text: 'center' })); - source.addFeature(new _ol_Feature_({ + source.addFeature(new Feature({ geometry: new Point([center[0] - 540, center[1]]), text: 'west' })); - source.addFeature(new _ol_Feature_({ + source.addFeature(new Feature({ geometry: new Point([center[0] + 540, center[1]]), text: 'east' })); @@ -867,12 +867,12 @@ describe('ol.rendering.layer.Vector', function() { it('declutters text along lines and images', function(done) { createMap('canvas'); - var layer = new _ol_layer_Vector_({ + var layer = new VectorLayer({ source: source }); map.addLayer(layer); - var point = new _ol_Feature_(new Point(center)); + var point = new Feature(new Point(center)); point.setStyle(new _ol_style_Style_({ image: new _ol_style_Circle_({ radius: 8, @@ -881,7 +881,7 @@ describe('ol.rendering.layer.Vector', function() { }) }) })); - var line = new _ol_Feature_(new LineString([ + var line = new Feature(new LineString([ [center[0] - 650, center[1] - 200], [center[0] + 650, center[1] - 200] ])); @@ -910,12 +910,12 @@ describe('ol.rendering.layer.Vector', function() { it('declutters text along lines and images with renderMode: \'image\'', function(done) { createMap('canvas'); - var layer = new _ol_layer_Vector_({ + var layer = new VectorLayer({ source: source }); map.addLayer(layer); - var point = new _ol_Feature_(new Point(center)); + var point = new Feature(new Point(center)); point.setStyle(new _ol_style_Style_({ image: new _ol_style_Circle_({ radius: 8, @@ -924,7 +924,7 @@ describe('ol.rendering.layer.Vector', function() { }) }) })); - var line = new _ol_Feature_(new LineString([ + var line = new Feature(new LineString([ [center[0] - 650, center[1] - 200], [center[0] + 650, center[1] - 200] ])); @@ -953,12 +953,12 @@ describe('ol.rendering.layer.Vector', function() { it('declutters text along lines and images with z-index', function(done) { createMap('canvas'); - var layer = new _ol_layer_Vector_({ + var layer = new VectorLayer({ source: source }); map.addLayer(layer); - var point = new _ol_Feature_(new Point(center)); + var point = new Feature(new Point(center)); point.setStyle(new _ol_style_Style_({ zIndex: 2, image: new _ol_style_Circle_({ @@ -968,7 +968,7 @@ describe('ol.rendering.layer.Vector', function() { }) }) })); - var line = new _ol_Feature_(new LineString([ + var line = new Feature(new LineString([ [center[0] - 650, center[1] - 200], [center[0] + 650, center[1] - 200] ])); diff --git a/test/rendering/ol/layer/vectortile.test.js b/test/rendering/ol/layer/vectortile.test.js index a75f5f62db..ecffba7886 100644 --- a/test/rendering/ol/layer/vectortile.test.js +++ b/test/rendering/ol/layer/vectortile.test.js @@ -1,13 +1,13 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import MVT from '../../../../src/ol/format/MVT.js'; import Point from '../../../../src/ol/geom/Point.js'; -import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; +import VectorLayer from '../../../../src/ol/layer/Vector.js'; import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; import _ol_obj_ from '../../../../src/ol/obj.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; -import _ol_source_VectorTile_ from '../../../../src/ol/source/VectorTile.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; +import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; @@ -25,7 +25,7 @@ describe('ol.rendering.layer.VectorTile', function() { pixelRatio: opt_pixelRatio || 1, target: createMapDiv(size, size), renderer: renderer, - view: new _ol_View_({ + view: new View({ center: [1825927.7316762917, 6143091.089223046], zoom: 14 }) @@ -69,7 +69,7 @@ describe('ol.rendering.layer.VectorTile', function() { var source; beforeEach(function() { - source = new _ol_source_VectorTile_({ + source = new VectorTileSource({ format: new MVT(), tileGrid: _ol_tilegrid_.createXYZ(), url: 'rendering/ol/data/tiles/mvt/{z}-{x}-{y}.vector.pbf', @@ -96,12 +96,12 @@ describe('ol.rendering.layer.VectorTile', function() { it('renders rotated view correctly with vector layer on top', function(done) { createMap('canvas'); - var vectorSource = new _ol_source_Vector_({ + var vectorSource = new VectorSource({ features: [ - new _ol_Feature_(new Point([1825727.7316762917, 6143091.089223046])) + new Feature(new Point([1825727.7316762917, 6143091.089223046])) ] }); - map.addLayer(new _ol_layer_Vector_({ + map.addLayer(new VectorLayer({ zIndex: 1, source: vectorSource, style: new _ol_style_Style_({ diff --git a/test/rendering/ol/map.test.js b/test/rendering/ol/map.test.js index 2abc786fd9..0942db006e 100644 --- a/test/rendering/ol/map.test.js +++ b/test/rendering/ol/map.test.js @@ -1,18 +1,18 @@ -import _ol_Feature_ from '../../../src/ol/Feature.js'; +import Feature from '../../../src/ol/Feature.js'; import Point from '../../../src/ol/geom/Point.js'; import Map from '../../../src/ol/Map.js'; -import _ol_View_ from '../../../src/ol/View.js'; -import _ol_layer_Vector_ from '../../../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../../../src/ol/source/Vector.js'; +import View from '../../../src/ol/View.js'; +import VectorLayer from '../../../src/ol/layer/Vector.js'; +import VectorSource from '../../../src/ol/source/Vector.js'; describe('ol.rendering.Map', function() { var map; function createMap(renderer) { - var vectorLayer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ - features: [new _ol_Feature_({ + var vectorLayer = new VectorLayer({ + source: new VectorSource({ + features: [new Feature({ geometry: new Point([0, 0]) })] }) @@ -23,7 +23,7 @@ describe('ol.rendering.Map', function() { target: createMapDiv(50, 50), renderer: renderer, layers: [vectorLayer], - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 diff --git a/test/rendering/ol/reproj/image.test.js b/test/rendering/ol/reproj/image.test.js index ce6e736324..86dcff2f1b 100644 --- a/test/rendering/ol/reproj/image.test.js +++ b/test/rendering/ol/reproj/image.test.js @@ -2,7 +2,7 @@ import _ol_events_ from '../../../../src/ol/events.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; import _ol_proj_EPSG3857_ from '../../../../src/ol/proj/EPSG3857.js'; import _ol_reproj_Image_ from '../../../../src/ol/reproj/Image.js'; -import _ol_source_ImageStatic_ from '../../../../src/ol/source/ImageStatic.js'; +import Static from '../../../../src/ol/source/ImageStatic.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -35,7 +35,7 @@ describe('ol.rendering.reproj.Image', function() { describe('image reprojections from EPSG:3857', function() { beforeEach(function() { - source = new _ol_source_ImageStatic_({ + source = new Static({ url: 'rendering/ol/data/tiles/osm/5/5/12.png', imageExtent: _ol_tilegrid_.createXYZ().getTileCoordExtent([5, 5, -13]), projection: getProjection('EPSG:3857') diff --git a/test/rendering/ol/reproj/tile.test.js b/test/rendering/ol/reproj/tile.test.js index 410df98ea5..4b27de01b0 100644 --- a/test/rendering/ol/reproj/tile.test.js +++ b/test/rendering/ol/reproj/tile.test.js @@ -2,7 +2,7 @@ import TileState from '../../../../src/ol/TileState.js'; import _ol_events_ from '../../../../src/ol/events.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; import _ol_reproj_Tile_ from '../../../../src/ol/reproj/Tile.js'; -import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js'; +import XYZ from '../../../../src/ol/source/XYZ.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; import {register} from '../../../../src/ol/proj/proj4.js'; @@ -38,7 +38,7 @@ describe('ol.rendering.reproj.Tile', function() { describe('single tile reprojections from EPSG:3857', function() { beforeEach(function() { - source = new _ol_source_XYZ_({ + source = new XYZ({ projection: 'EPSG:3857', url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png' }); @@ -83,7 +83,7 @@ describe('ol.rendering.reproj.Tile', function() { describe('stitching several tiles from EPSG:3857', function() { beforeEach(function() { - source = new _ol_source_XYZ_({ + source = new XYZ({ projection: 'EPSG:3857', url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png' }); @@ -111,7 +111,7 @@ describe('ol.rendering.reproj.Tile', function() { describe('tile projection from EPSG:4326', function() { beforeEach(function() { - source = new _ol_source_XYZ_({ + source = new XYZ({ projection: 'EPSG:4326', maxZoom: 0, url: 'rendering/ol/data/tiles/4326/{z}/{x}/{y}.png' @@ -132,7 +132,7 @@ describe('ol.rendering.reproj.Tile', function() { describe('non-square source tiles', function() { beforeEach(function() { - source = new _ol_source_XYZ_({ + source = new XYZ({ projection: 'EPSG:3857', url: 'rendering/ol/data/tiles/osm-512x256/{z}/{x}/{y}.png', tileSize: [512, 256] @@ -153,7 +153,7 @@ describe('ol.rendering.reproj.Tile', function() { describe('dateline wrapping', function() { beforeEach(function() { - source = new _ol_source_XYZ_({ + source = new XYZ({ projection: 'EPSG:4326', maxZoom: 0, url: 'rendering/ol/data/tiles/4326/{z}/{x}/{y}.png' diff --git a/test/rendering/ol/source/raster.test.js b/test/rendering/ol/source/raster.test.js index f5cf437b14..5ffe7671f2 100644 --- a/test/rendering/ol/source/raster.test.js +++ b/test/rendering/ol/source/raster.test.js @@ -1,8 +1,8 @@ import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; -import _ol_layer_Image_ from '../../../../src/ol/layer/Image.js'; +import View from '../../../../src/ol/View.js'; +import ImageLayer from '../../../../src/ol/layer/Image.js'; import RasterSource from '../../../../src/ol/source/Raster.js'; -import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js'; +import XYZ from '../../../../src/ol/source/XYZ.js'; where('Uint8ClampedArray').describe('ol.rendering.source.Raster', function() { @@ -32,7 +32,7 @@ where('Uint8ClampedArray').describe('ol.rendering.source.Raster', function() { target: createMapDiv(200, 200), pixelRatio: pixelRatio, renderer: renderer, - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 0 }) @@ -50,7 +50,7 @@ where('Uint8ClampedArray').describe('ol.rendering.source.Raster', function() { it('renders the result of an operation', function(done) { createMap('canvas', 1); - var source = new _ol_source_XYZ_({ + var source = new XYZ({ url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png', transition: 0 }); @@ -75,7 +75,7 @@ where('Uint8ClampedArray').describe('ol.rendering.source.Raster', function() { expectResemble(map, 'rendering/ol/source/expected/raster-1.png', IMAGE_TOLERANCE, done); }); - var layer = new _ol_layer_Image_({source: raster}); + var layer = new ImageLayer({source: raster}); map.addLayer(layer); }); diff --git a/test/rendering/ol/source/tilewms.test.js b/test/rendering/ol/source/tilewms.test.js index d23e4a8600..1e5fef4c80 100644 --- a/test/rendering/ol/source/tilewms.test.js +++ b/test/rendering/ol/source/tilewms.test.js @@ -1,7 +1,7 @@ import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import TileLayer from '../../../../src/ol/layer/Tile.js'; -import _ol_source_TileWMS_ from '../../../../src/ol/source/TileWMS.js'; +import TileWMS from '../../../../src/ol/source/TileWMS.js'; describe('ol.rendering.source.TileWMS', function() { @@ -29,7 +29,7 @@ describe('ol.rendering.source.TileWMS', function() { target: createMapDiv(200, 200), pixelRatio: pixelRatio, renderer: renderer, - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 5 }) @@ -44,7 +44,7 @@ describe('ol.rendering.source.TileWMS', function() { }); function createSource(gutter) { - return new _ol_source_TileWMS_({ + return new TileWMS({ params: { 'LAYERS': 'layer' }, diff --git a/test/rendering/ol/style/circle.test.js b/test/rendering/ol/style/circle.test.js index 47f5b5b062..4bf090bac1 100644 --- a/test/rendering/ol/style/circle.test.js +++ b/test/rendering/ol/style/circle.test.js @@ -1,10 +1,10 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import Point from '../../../../src/ol/geom/Point.js'; import MultiPoint from '../../../../src/ol/geom/MultiPoint.js'; import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; -import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; +import View from '../../../../src/ol/View.js'; +import VectorLayer from '../../../../src/ol/layer/Vector.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; @@ -16,8 +16,8 @@ describe('ol.rendering.style.Circle', function() { var map, vectorSource; function createMap(renderer) { - vectorSource = new _ol_source_Vector_(); - var vectorLayer = new _ol_layer_Vector_({ + vectorSource = new VectorSource(); + var vectorLayer = new VectorLayer({ source: vectorSource }); @@ -26,7 +26,7 @@ describe('ol.rendering.style.Circle', function() { target: createMapDiv(50, 50), renderer: renderer, layers: [vectorLayer], - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 @@ -45,7 +45,7 @@ describe('ol.rendering.style.Circle', function() { function createFeatures(multi) { var feature; - feature = new _ol_Feature_({ + feature = new Feature({ geometry: multi ? new MultiPoint([[-20, 18]]) : new Point([-20, 18]) }); feature.setStyle(new _ol_style_Style_({ @@ -58,7 +58,7 @@ describe('ol.rendering.style.Circle', function() { })); vectorSource.addFeature(feature); - feature = new _ol_Feature_({ + feature = new Feature({ geometry: multi ? new MultiPoint([[-10, 18]]) : new Point([-10, 18]) }); feature.setStyle(new _ol_style_Style_({ @@ -71,7 +71,7 @@ describe('ol.rendering.style.Circle', function() { })); vectorSource.addFeature(feature); - feature = new _ol_Feature_({ + feature = new Feature({ geometry: multi ? new MultiPoint([[4, 18]]) : new Point([4, 18]) }); feature.setStyle(new _ol_style_Style_({ @@ -84,7 +84,7 @@ describe('ol.rendering.style.Circle', function() { })); vectorSource.addFeature(feature); - feature = new _ol_Feature_({ + feature = new Feature({ geometry: multi ? new MultiPoint([[-20, 3]]) : new Point([-20, 3]) }); feature.setStyle(new _ol_style_Style_({ @@ -101,7 +101,7 @@ describe('ol.rendering.style.Circle', function() { })); vectorSource.addFeature(feature); - feature = new _ol_Feature_({ + feature = new Feature({ geometry: multi ? new MultiPoint([[-10, 3]]) : new Point([-10, 3]) }); feature.setStyle(new _ol_style_Style_({ @@ -118,7 +118,7 @@ describe('ol.rendering.style.Circle', function() { })); vectorSource.addFeature(feature); - feature = new _ol_Feature_({ + feature = new Feature({ geometry: multi ? new MultiPoint([[4, 3]]) : new Point([4, 3]) }); feature.setStyle(new _ol_style_Style_({ @@ -135,7 +135,7 @@ describe('ol.rendering.style.Circle', function() { })); vectorSource.addFeature(feature); - feature = new _ol_Feature_({ + feature = new Feature({ geometry: multi ? new MultiPoint([[-20, -15]]) : new Point([-20, -15]) }); feature.setStyle(new _ol_style_Style_({ @@ -149,7 +149,7 @@ describe('ol.rendering.style.Circle', function() { })); vectorSource.addFeature(feature); - feature = new _ol_Feature_({ + feature = new Feature({ geometry: multi ? new MultiPoint([[-10, -15]]) : new Point([-10, -15]) }); feature.setStyle(new _ol_style_Style_({ @@ -166,7 +166,7 @@ describe('ol.rendering.style.Circle', function() { })); vectorSource.addFeature(feature); - feature = new _ol_Feature_({ + feature = new Feature({ geometry: multi ? new MultiPoint([[4, -15]]) : new Point([4, -15]) }); feature.setStyle(new _ol_style_Style_({ diff --git a/test/rendering/ol/style/icon.test.js b/test/rendering/ol/style/icon.test.js index c641268708..234e437378 100644 --- a/test/rendering/ol/style/icon.test.js +++ b/test/rendering/ol/style/icon.test.js @@ -1,9 +1,9 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import Point from '../../../../src/ol/geom/Point.js'; import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; -import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; +import View from '../../../../src/ol/View.js'; +import VectorLayer from '../../../../src/ol/layer/Vector.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js'; import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; @@ -22,8 +22,8 @@ describe('ol.rendering.style.Icon', function() { }; function createMap(renderer, width, height) { - vectorSource = new _ol_source_Vector_(); - var vectorLayer = new _ol_layer_Vector_({ + vectorSource = new VectorSource(); + var vectorLayer = new VectorLayer({ source: vectorSource }); @@ -32,7 +32,7 @@ describe('ol.rendering.style.Icon', function() { target: createMapDiv(width ? width : 50, height ? height : 50), renderer: renderer, layers: [vectorLayer], - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 @@ -51,7 +51,7 @@ describe('ol.rendering.style.Icon', function() { function createFeatures(src, imgInfo, callback) { var feature; - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Point([0, 0]) }); diff --git a/test/rendering/ol/style/linestring.test.js b/test/rendering/ol/style/linestring.test.js index 31659070c5..00cdfa5ee9 100644 --- a/test/rendering/ol/style/linestring.test.js +++ b/test/rendering/ol/style/linestring.test.js @@ -1,9 +1,9 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; -import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; +import View from '../../../../src/ol/View.js'; +import VectorLayer from '../../../../src/ol/layer/Vector.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -13,8 +13,8 @@ describe('ol.rendering.style.LineString', function() { var map, vectorSource; function createMap(renderer, opt_pixelRatio) { - vectorSource = new _ol_source_Vector_(); - var vectorLayer = new _ol_layer_Vector_({ + vectorSource = new VectorSource(); + var vectorLayer = new VectorLayer({ source: vectorSource }); @@ -23,7 +23,7 @@ describe('ol.rendering.style.LineString', function() { target: createMapDiv(50, 50), renderer: renderer, layers: [vectorLayer], - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 @@ -43,7 +43,7 @@ describe('ol.rendering.style.LineString', function() { function createFeatures() { var feature; - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new LineString( [[-20, 20], [15, 20]] ) @@ -53,7 +53,7 @@ describe('ol.rendering.style.LineString', function() { })); vectorSource.addFeature(feature); - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new LineString( [[-20, 15], [15, 15]] ) @@ -63,7 +63,7 @@ describe('ol.rendering.style.LineString', function() { })); vectorSource.addFeature(feature); - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new LineString( [[-20, 10], [15, 10]] ) @@ -75,7 +75,7 @@ describe('ol.rendering.style.LineString', function() { })]); vectorSource.addFeature(feature); - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new LineString( [[-20, -20], [-2, 0], [15, -20]] ) @@ -91,7 +91,7 @@ describe('ol.rendering.style.LineString', function() { })); vectorSource.addFeature(feature); - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new LineString( [[-20, -15], [-2, 5], [15, -15]] ) diff --git a/test/rendering/ol/style/polygon.test.js b/test/rendering/ol/style/polygon.test.js index 16286da724..e1ac2fa2a8 100644 --- a/test/rendering/ol/style/polygon.test.js +++ b/test/rendering/ol/style/polygon.test.js @@ -1,9 +1,9 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; -import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; +import View from '../../../../src/ol/View.js'; +import VectorLayer from '../../../../src/ol/layer/Vector.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -16,8 +16,8 @@ describe('ol.rendering.style.Polygon', function() { function createMap(renderer, opt_size) { var size = opt_size || 50; - vectorSource = new _ol_source_Vector_(); - var vectorLayer = new _ol_layer_Vector_({ + vectorSource = new VectorSource(); + var vectorLayer = new VectorLayer({ source: vectorSource }); @@ -26,7 +26,7 @@ describe('ol.rendering.style.Polygon', function() { target: createMapDiv(size, size), renderer: renderer, layers: [vectorLayer], - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 @@ -48,7 +48,7 @@ describe('ol.rendering.style.Polygon', function() { var feature; // rectangle - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Polygon([ [[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]] ]) @@ -59,7 +59,7 @@ describe('ol.rendering.style.Polygon', function() { vectorSource.addFeature(feature); // rectangle with 1 hole - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Polygon([ [[0, 10], [0, 20], [15, 20], [15, 10], [0, 10]], [[5, 13], [10, 13], [10, 17], [5, 17], [5, 13]] @@ -72,7 +72,7 @@ describe('ol.rendering.style.Polygon', function() { vectorSource.addFeature(feature); // rectangle with 2 holes - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Polygon([ [[-20, -20], [-20, 5], [15, 5], [15, -20], [-20, -20]], [[-18, -18], [-12, -18], [-12, -12], [-18, -12], [-18, -18]], @@ -113,7 +113,7 @@ describe('ol.rendering.style.Polygon', function() { var feature; // rectangle - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Polygon([ [[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]] ]) @@ -124,7 +124,7 @@ describe('ol.rendering.style.Polygon', function() { vectorSource.addFeature(feature); // rectangle with 1 hole - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Polygon([ [[0, 10], [0, 20], [20, 20], [20, 10], [0, 10]], [[5, 13], [10, 13], [10, 17], [5, 17], [5, 13]] @@ -137,7 +137,7 @@ describe('ol.rendering.style.Polygon', function() { vectorSource.addFeature(feature); // rectangle with 2 holes - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Polygon([ [[-20, -20], [-20, 5], [20, 5], [20, -20], [-20, -20]], [[-12, -3], [-12, -12], [-8, -12], [-8, -3], [-12, -3]], @@ -173,7 +173,7 @@ describe('ol.rendering.style.Polygon', function() { function createFeatures() { var feature; // rectangle with z-index 2 - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Polygon([ [[-20, 10], [-20, 20], [-0, 20], [-0, 10], [-20, 10]] ]) @@ -185,7 +185,7 @@ describe('ol.rendering.style.Polygon', function() { vectorSource.addFeature(feature); // rectangle with z-index 3 - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Polygon([ [[-15, 5], [-15, 15], [5, 15], [5, 5], [-15, 5]] ]) @@ -197,7 +197,7 @@ describe('ol.rendering.style.Polygon', function() { vectorSource.addFeature(feature); // rectangle with z-index 1 - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Polygon([ [[-10, 0], [-10, 10], [10, 10], [10, 0], [-10, 0]] ]) @@ -230,7 +230,7 @@ describe('ol.rendering.style.Polygon', function() { function createFeatures() { var feature; // rectangle - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Polygon([ [[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]] ]) @@ -242,7 +242,7 @@ describe('ol.rendering.style.Polygon', function() { vectorSource.addFeature(feature); // rectangle with 1 hole - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Polygon([ [[0, 10], [0, 20], [15, 20], [15, 10], [0, 10]] ]) @@ -254,7 +254,7 @@ describe('ol.rendering.style.Polygon', function() { vectorSource.addFeature(feature); // rectangle with 2 holes - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Polygon([ [[-20, -20], [-20, 5], [15, 5], [15, -20], [-20, -20]] ]) @@ -316,7 +316,7 @@ describe('ol.rendering.style.Polygon', function() { } function createFeatures() { - var feature = new _ol_Feature_({ + var feature = new Feature({ geometry: new Polygon([ [[-20, -20], [-20, 20], [18, 20], [-20, -20]] ]) diff --git a/test/rendering/ol/style/regularshape.test.js b/test/rendering/ol/style/regularshape.test.js index 2e07707274..ee120eda97 100644 --- a/test/rendering/ol/style/regularshape.test.js +++ b/test/rendering/ol/style/regularshape.test.js @@ -1,9 +1,9 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import Point from '../../../../src/ol/geom/Point.js'; import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; -import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; +import View from '../../../../src/ol/View.js'; +import VectorLayer from '../../../../src/ol/layer/Vector.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../../../../src/ol/style/RegularShape.js'; import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; @@ -15,8 +15,8 @@ describe('ol.rendering.style.RegularShape', function() { var map, vectorSource; function createMap(renderer) { - vectorSource = new _ol_source_Vector_(); - var vectorLayer = new _ol_layer_Vector_({ + vectorSource = new VectorSource(); + var vectorLayer = new VectorLayer({ source: vectorSource }); @@ -25,7 +25,7 @@ describe('ol.rendering.style.RegularShape', function() { target: createMapDiv(50, 50), renderer: renderer, layers: [vectorLayer], - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 @@ -42,7 +42,7 @@ describe('ol.rendering.style.RegularShape', function() { function createFeatures(stroke, fill) { var feature; - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Point([-15, 15]) }); // square @@ -57,7 +57,7 @@ describe('ol.rendering.style.RegularShape', function() { })); vectorSource.addFeature(feature); - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Point([8, 15]) }); // triangle @@ -73,7 +73,7 @@ describe('ol.rendering.style.RegularShape', function() { })); vectorSource.addFeature(feature); - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Point([-10, -8]) }); // star @@ -89,7 +89,7 @@ describe('ol.rendering.style.RegularShape', function() { })); vectorSource.addFeature(feature); - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Point([12, -8]) }); // cross diff --git a/test/rendering/ol/style/text.test.js b/test/rendering/ol/style/text.test.js index 9736575216..73fc4760e8 100644 --- a/test/rendering/ol/style/text.test.js +++ b/test/rendering/ol/style/text.test.js @@ -1,13 +1,13 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import MultiLineString from '../../../../src/ol/geom/MultiLineString.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; import Point from '../../../../src/ol/geom/Point.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; -import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; +import View from '../../../../src/ol/View.js'; +import VectorLayer from '../../../../src/ol/layer/Vector.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; @@ -19,8 +19,8 @@ describe('ol.rendering.style.Text', function() { function createMap(renderer, opt_pixelRatio) { var pixelRatio = opt_pixelRatio || 1; - vectorSource = new _ol_source_Vector_(); - var vectorLayer = new _ol_layer_Vector_({ + vectorSource = new VectorSource(); + var vectorLayer = new VectorLayer({ source: vectorSource }); @@ -29,7 +29,7 @@ describe('ol.rendering.style.Text', function() { target: createMapDiv(200 / pixelRatio, 200 / pixelRatio), renderer: renderer, layers: [vectorLayer], - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 @@ -49,7 +49,7 @@ describe('ol.rendering.style.Text', function() { function createFeatures(opt_scale) { var scale = opt_scale || 1; var feature; - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Point([-20, 18]) }); feature.setStyle(new _ol_style_Style_({ @@ -61,7 +61,7 @@ describe('ol.rendering.style.Text', function() { })); vectorSource.addFeature(feature); - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Point([-10, 0]) }); feature.setStyle(new _ol_style_Style_({ @@ -80,7 +80,7 @@ describe('ol.rendering.style.Text', function() { })); vectorSource.addFeature(feature); - feature = new _ol_Feature_({ + feature = new Feature({ geometry: new Point([20, 10]) }); feature.setStyle(new _ol_style_Style_({ @@ -124,13 +124,13 @@ describe('ol.rendering.style.Text', function() { }) }) }); - var feature = new _ol_Feature_(geom); + var feature = new Feature(geom); feature.setStyle(style); vectorSource.addFeature(feature); geom = geom.clone(); geom.translate(0, 5); - feature = new _ol_Feature_(geom); + feature = new Feature(geom); style = style.clone(); style.getText().setTextBaseline('top'); feature.setStyle(style); @@ -138,7 +138,7 @@ describe('ol.rendering.style.Text', function() { geom = geom.clone(); geom.translate(0, -10); - feature = new _ol_Feature_(geom); + feature = new Feature(geom); style = style.clone(); style.getText().setTextBaseline('bottom'); feature.setStyle(style); @@ -175,7 +175,7 @@ describe('ol.rendering.style.Text', function() { it('renders multiline text with alignment options', function(done) { createMap('canvas'); var feature; - feature = new _ol_Feature_(new Point([25, 0])); + feature = new Feature(new Point([25, 0])); feature.setStyle(new _ol_style_Style_({ text: new _ol_style_Text_({ text: 'Hello world\nleft', @@ -184,7 +184,7 @@ describe('ol.rendering.style.Text', function() { }) })); vectorSource.addFeature(feature); - feature = new _ol_Feature_(new Point([-25, 0])); + feature = new Feature(new Point([-25, 0])); feature.setStyle(new _ol_style_Style_({ text: new _ol_style_Text_({ text: 'Hello world\nright', @@ -193,7 +193,7 @@ describe('ol.rendering.style.Text', function() { }) })); vectorSource.addFeature(feature); - feature = new _ol_Feature_(new Point([0, 25])); + feature = new Feature(new Point([0, 25])); feature.setStyle(new _ol_style_Style_({ text: new _ol_style_Text_({ text: 'Hello world\nbottom', @@ -202,7 +202,7 @@ describe('ol.rendering.style.Text', function() { }) })); vectorSource.addFeature(feature); - feature = new _ol_Feature_(new Point([0, -25])); + feature = new Feature(new Point([0, -25])); feature.setStyle(new _ol_style_Style_({ text: new _ol_style_Text_({ text: 'top\nHello world', @@ -217,7 +217,7 @@ describe('ol.rendering.style.Text', function() { it('renders multiline text with positioning options', function(done) { createMap('canvas'); var feature; - feature = new _ol_Feature_(new Point([0, 0])); + feature = new Feature(new Point([0, 0])); feature.setStyle(new _ol_style_Style_({ text: new _ol_style_Text_({ text: 'Hello world\nleft', @@ -227,7 +227,7 @@ describe('ol.rendering.style.Text', function() { }) })); vectorSource.addFeature(feature); - feature = new _ol_Feature_(new Point([0, 0])); + feature = new Feature(new Point([0, 0])); feature.setStyle(new _ol_style_Style_({ text: new _ol_style_Text_({ text: 'Hello world\nright', @@ -237,7 +237,7 @@ describe('ol.rendering.style.Text', function() { }) })); vectorSource.addFeature(feature); - feature = new _ol_Feature_(new Point([0, 0])); + feature = new Feature(new Point([0, 0])); feature.setStyle(new _ol_style_Style_({ text: new _ol_style_Text_({ text: 'Hello world\nbottom', @@ -247,7 +247,7 @@ describe('ol.rendering.style.Text', function() { }) })); vectorSource.addFeature(feature); - feature = new _ol_Feature_(new Point([0, 0])); + feature = new Feature(new Point([0, 0])); feature.setStyle(new _ol_style_Style_({ text: new _ol_style_Text_({ text: 'top\nHello world', @@ -272,7 +272,7 @@ describe('ol.rendering.style.Text', function() { line = line.clone(); line.translate(0, -100); geom.appendLineString(line); - var feature = new _ol_Feature_(geom); + var feature = new Feature(geom); feature.setStyle(new _ol_style_Style_({ text: new _ol_style_Text_({ text: 'Hello world', @@ -289,7 +289,7 @@ describe('ol.rendering.style.Text', function() { createMap('canvas'); var geom = new Polygon(null); geom.setFlatCoordinates('XY', polygon, [polygon.length]); - var feature = new _ol_Feature_(geom); + var feature = new Feature(geom); feature.setStyle(new _ol_style_Style_({ text: new _ol_style_Text_({ text: 'Hello world', @@ -315,7 +315,7 @@ describe('ol.rendering.style.Text', function() { geom = geom.clone(); geom.translate(0, -60); multiPolygon.appendPolygon(geom); - var feature = new _ol_Feature_(multiPolygon); + var feature = new Feature(multiPolygon); feature.setStyle(new _ol_style_Style_({ text: new _ol_style_Text_({ text: 'Hello world', diff --git a/test/spec/ol/control/attribution.test.js b/test/spec/ol/control/attribution.test.js index 58adf01584..3a54a14a76 100644 --- a/test/spec/ol/control/attribution.test.js +++ b/test/spec/ol/control/attribution.test.js @@ -1,9 +1,9 @@ import Map from '../../../../src/ol/Map.js'; import _ol_Tile_ from '../../../../src/ol/Tile.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import Attribution from '../../../../src/ol/control/Attribution.js'; import TileLayer from '../../../../src/ol/layer/Tile.js'; -import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js'; +import TileSource from '../../../../src/ol/source/Tile.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; describe('ol.control.Attribution', function() { @@ -21,28 +21,28 @@ describe('ol.control.Attribution', function() { })], layers: [ new TileLayer({ - source: new _ol_source_Tile_({ + source: new TileSource({ projection: 'EPSG:3857', tileGrid: _ol_tilegrid_.createXYZ(), attributions: 'foo' }) }), new TileLayer({ - source: new _ol_source_Tile_({ + source: new TileSource({ projection: 'EPSG:3857', tileGrid: _ol_tilegrid_.createXYZ(), attributions: 'bar' }) }), new TileLayer({ - source: new _ol_source_Tile_({ + source: new TileSource({ projection: 'EPSG:3857', tileGrid: _ol_tilegrid_.createXYZ(), attributions: 'foo' }) }) ], - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 0 }) diff --git a/test/spec/ol/control/overviewmap.test.js b/test/spec/ol/control/overviewmap.test.js index b88c13c256..8dd21efb02 100644 --- a/test/spec/ol/control/overviewmap.test.js +++ b/test/spec/ol/control/overviewmap.test.js @@ -1,5 +1,5 @@ import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import Control from '../../../../src/ol/control/Control.js'; import OverviewMap from '../../../../src/ol/control/OverviewMap.js'; @@ -32,7 +32,7 @@ describe('ol.control.OverviewMap', function() { describe('setMap()', function() { it('keeps ovmap view rotation in sync with map view rotation', function() { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0, rotation: 0 @@ -54,7 +54,7 @@ describe('ol.control.OverviewMap', function() { var ovView = control.ovmap_.getView(); expect(ovView.getRotation()).to.be(0); - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0, rotation: 0 @@ -68,7 +68,7 @@ describe('ol.control.OverviewMap', function() { var control = new OverviewMap(); var ovView = control.ovmap_.getView(); - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0, rotation: 0 diff --git a/test/spec/ol/control/scaleline.test.js b/test/spec/ol/control/scaleline.test.js index 09bcef16b2..46e91db67e 100644 --- a/test/spec/ol/control/scaleline.test.js +++ b/test/spec/ol/control/scaleline.test.js @@ -1,5 +1,5 @@ import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import ScaleLine from '../../../../src/ol/control/ScaleLine.js'; import {fromLonLat} from '../../../../src/ol/proj.js'; import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; @@ -91,7 +91,7 @@ describe('ol.control.ScaleLine', function() { expect(renderSpy.called).to.be(false); ctrl.setMap(map); expect(renderSpy.called).to.be(false); - map.setView(new _ol_View_({ + map.setView(new View({ center: [0, 0], zoom: 0 })); @@ -108,7 +108,7 @@ describe('ol.control.ScaleLine', function() { render: renderSpy }); ctrl.setMap(map); - map.setView(new _ol_View_({ + map.setView(new View({ center: [0, 0], zoom: 0 })); @@ -125,7 +125,7 @@ describe('ol.control.ScaleLine', function() { render: renderSpy }); ctrl.setMap(map); - map.setView(new _ol_View_({ + map.setView(new View({ center: [0, 0], zoom: 0 })); @@ -143,7 +143,7 @@ describe('ol.control.ScaleLine', function() { var ctrl = new ScaleLine(); expect(ctrl.element.innerText).to.be(''); ctrl.setMap(map); - map.setView(new _ol_View_({ + map.setView(new View({ center: [0, 0], zoom: 0 })); @@ -173,7 +173,7 @@ describe('ol.control.ScaleLine', function() { describe('#setUnits', function() { it('triggers rerendering', function() { var ctrl = new ScaleLine(); - map.setView(new _ol_View_({ + map.setView(new View({ center: [0, 0], zoom: 0 })); @@ -198,7 +198,7 @@ describe('ol.control.ScaleLine', function() { beforeEach(function(done) { ctrl = new ScaleLine(); ctrl.setMap(map); - map.setView(new _ol_View_({ + map.setView(new View({ center: [0, 0], zoom: 0 })); @@ -248,14 +248,14 @@ describe('ol.control.ScaleLine', function() { it('is rendered differently for different projections', function() { var ctrl = new ScaleLine(); ctrl.setMap(map); - map.setView(new _ol_View_({ + map.setView(new View({ center: fromLonLat([7, 52]), zoom: 2, projection: 'EPSG:3857' })); map.renderSync(); var innerHtml3857 = ctrl.element_.innerHTML; - map.setView(new _ol_View_({ + map.setView(new View({ center: [7, 52], zoom: 2, projection: 'EPSG:4326' @@ -268,7 +268,7 @@ describe('ol.control.ScaleLine', function() { it('Projection\'s metersPerUnit affect scale for non-degree units', function() { var ctrl = new ScaleLine(); ctrl.setMap(map); - map.setView(new _ol_View_({ + map.setView(new View({ center: [0, 0], zoom: 0, resolutions: [1], @@ -282,7 +282,7 @@ describe('ol.control.ScaleLine', function() { })); map.renderSync(); expect(ctrl.element_.innerText).to.be('100 m'); - map.setView(new _ol_View_({ + map.setView(new View({ center: [0, 0], zoom: 0, resolutions: [1], @@ -305,7 +305,7 @@ describe('ol.control.ScaleLine', function() { it('is rendered differently at different latitudes for metric', function() { var ctrl = new ScaleLine(); ctrl.setMap(map); - map.setView(new _ol_View_({ + map.setView(new View({ center: fromLonLat([7, 0]), zoom: 2, projection: 'EPSG:4326' @@ -323,7 +323,7 @@ describe('ol.control.ScaleLine', function() { units: 'degrees' }); ctrl.setMap(map); - map.setView(new _ol_View_({ + map.setView(new View({ center: fromLonLat([7, 0]), zoom: 2, projection: 'EPSG:4326' @@ -363,7 +363,7 @@ describe('ol.control.ScaleLine', function() { minWidth: 10 }); ctrl.setMap(map); - map.setView(new _ol_View_({ + map.setView(new View({ center: [0, 0], zoom: currentZoom, maxZoom: currentZoom diff --git a/test/spec/ol/control/zoomslider.test.js b/test/spec/ol/control/zoomslider.test.js index 6ac48ccc17..37c45a5ab0 100644 --- a/test/spec/ol/control/zoomslider.test.js +++ b/test/spec/ol/control/zoomslider.test.js @@ -1,5 +1,5 @@ import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import ZoomSlider from '../../../../src/ol/control/ZoomSlider.js'; import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; @@ -91,7 +91,7 @@ describe('ol.control.ZoomSlider', function() { beforeEach(function() { map = new Map({ target: createMapDiv(500, 100), - view: new _ol_View_({ + view: new View({ center: [0, 0], resolutions: [16, 8, 4, 2, 1, 0.5, 0.25, 0.125, 0.0625] }) diff --git a/test/spec/ol/feature.test.js b/test/spec/ol/feature.test.js index fc79f8dfe2..5efa4a85bf 100644 --- a/test/spec/ol/feature.test.js +++ b/test/spec/ol/feature.test.js @@ -1,4 +1,4 @@ -import _ol_Feature_ from '../../../src/ol/Feature.js'; +import Feature from '../../../src/ol/Feature.js'; import Point from '../../../src/ol/geom/Point.js'; import _ol_obj_ from '../../../src/ol/obj.js'; import _ol_style_Style_ from '../../../src/ol/style/Style.js'; @@ -9,25 +9,25 @@ describe('ol.Feature', function() { describe('constructor', function() { it('creates a new feature', function() { - var feature = new _ol_Feature_(); - expect(feature).to.be.a(_ol_Feature_); + var feature = new Feature(); + expect(feature).to.be.a(Feature); }); it('takes properties', function() { - var feature = new _ol_Feature_({ + var feature = new Feature({ foo: 'bar' }); expect(feature.get('foo')).to.be('bar'); }); it('can store the feature\'s commonly used id', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setId('foo'); expect(feature.getId()).to.be('foo'); }); it('will set the default geometry', function() { - var feature = new _ol_Feature_({ + var feature = new Feature({ geometry: new Point([10, 20]), foo: 'bar' }); @@ -41,7 +41,7 @@ describe('ol.Feature', function() { describe('#get()', function() { it('returns values set at construction', function() { - var feature = new _ol_Feature_({ + var feature = new Feature({ a: 'first', b: 'second' }); @@ -50,12 +50,12 @@ describe('ol.Feature', function() { }); it('returns undefined for unset attributes', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); expect(feature.get('a')).to.be(undefined); }); it('returns values set by set', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.set('a', 'b'); expect(feature.get('a')).to.be('b'); }); @@ -66,7 +66,7 @@ describe('ol.Feature', function() { it('returns an object with all attributes', function() { var point = new Point([15, 30]); - var feature = new _ol_Feature_({ + var feature = new Feature({ foo: 'bar', ten: 10, geometry: point @@ -83,7 +83,7 @@ describe('ol.Feature', function() { }); it('is empty by default', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); var properties = feature.getProperties(); expect(_ol_obj_.isEmpty(properties)).to.be(true); }); @@ -96,30 +96,30 @@ describe('ol.Feature', function() { var point = new Point([15, 30]); it('returns undefined for unset geometry', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); expect(feature.getGeometry()).to.be(undefined); }); it('returns null for null geometry (constructor)', function() { - var feature = new _ol_Feature_(null); + var feature = new Feature(null); expect(feature.getGeometry()).to.be(null); }); it('returns null for null geometry (setGeometry())', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setGeometry(null); expect(feature.getGeometry()).to.be(null); }); it('gets the geometry set at construction', function() { - var feature = new _ol_Feature_({ + var feature = new Feature({ geometry: point }); expect(feature.getGeometry()).to.be(point); }); it('gets any geometry set by setGeometry', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setGeometry(point); expect(feature.getGeometry()).to.be(point); @@ -133,7 +133,7 @@ describe('ol.Feature', function() { describe('#set()', function() { it('sets values', function() { - var feature = new _ol_Feature_({ + var feature = new Feature({ a: 'first', b: 'second' }); @@ -143,7 +143,7 @@ describe('ol.Feature', function() { it('can be used to set the geometry', function() { var point = new Point([3, 4]); - var feature = new _ol_Feature_({ + var feature = new Feature({ geometry: new Point([1, 2]) }); feature.set('geometry', point); @@ -153,7 +153,7 @@ describe('ol.Feature', function() { it('can be used to set attributes with arbitrary names', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.set('toString', 'string'); expect(feature.get('toString')).to.be('string'); @@ -174,13 +174,13 @@ describe('ol.Feature', function() { var point = new Point([15, 30]); it('sets the default geometry', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setGeometry(point); expect(feature.get('geometry')).to.be(point); }); it('replaces previous default geometry', function() { - var feature = new _ol_Feature_({ + var feature = new Feature({ geometry: point }); expect(feature.getGeometry()).to.be(point); @@ -197,7 +197,7 @@ describe('ol.Feature', function() { var point = new Point([15, 30]); it('sets property where to to look at geometry', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setGeometry(point); expect(feature.getGeometry()).to.be(point); @@ -214,7 +214,7 @@ describe('ol.Feature', function() { }); it('changes property listener', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setGeometry(point); var point2 = new Point([1, 2]); feature.set('altGeometry', point2); @@ -227,7 +227,7 @@ describe('ol.Feature', function() { }); it('can use a different geometry name', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setGeometryName('foo'); var point = new Point([10, 20]); feature.setGeometry(point); @@ -239,14 +239,14 @@ describe('ol.Feature', function() { describe('#setId()', function() { it('sets the feature identifier', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); expect(feature.getId()).to.be(undefined); feature.setId('foo'); expect(feature.getId()).to.be('foo'); }); it('accepts a string or number', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setId('foo'); expect(feature.getId()).to.be('foo'); feature.setId(2); @@ -254,7 +254,7 @@ describe('ol.Feature', function() { }); it('dispatches the "change" event', function(done) { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.on('change', function() { expect(feature.getId()).to.be('foo'); done(); @@ -271,24 +271,24 @@ describe('ol.Feature', function() { }; it('returns undefined after construction', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); expect(feature.getStyleFunction()).to.be(undefined); }); it('returns the function passed to setStyle', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setStyle(styleFunction); expect(feature.getStyleFunction()).to.be(styleFunction); }); it('does not get confused with user "styleFunction" property', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.set('styleFunction', 'foo'); expect(feature.getStyleFunction()).to.be(undefined); }); it('does not get confused with "styleFunction" option', function() { - var feature = new _ol_Feature_({ + var feature = new Feature({ styleFunction: 'foo' }); expect(feature.getStyleFunction()).to.be(undefined); @@ -305,21 +305,21 @@ describe('ol.Feature', function() { }; it('accepts a single style', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setStyle(style); var func = feature.getStyleFunction(); expect(func()).to.eql([style]); }); it('accepts an array of styles', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setStyle([style]); var func = feature.getStyleFunction(); expect(func()).to.eql([style]); }); it('accepts a style function', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); function featureStyleFunction(resolution) { return styleFunction(this, resolution); } @@ -329,14 +329,14 @@ describe('ol.Feature', function() { }); it('accepts a layer style function', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setStyle(styleFunction); expect(feature.getStyleFunction()).to.not.be(styleFunction); expect(feature.getStyleFunction()(42)).to.be(42); }); it('accepts null', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setStyle(style); feature.setStyle(null); expect(feature.getStyle()).to.be(null); @@ -344,7 +344,7 @@ describe('ol.Feature', function() { }); it('dispatches a change event', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); var spy = sinon.spy(); feature.on('change', spy); feature.setStyle(style); @@ -362,7 +362,7 @@ describe('ol.Feature', function() { }; it('returns what is passed to setStyle', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); expect(feature.getStyle()).to.be(null); @@ -378,7 +378,7 @@ describe('ol.Feature', function() { }); it('does not get confused with "style" option to constructor', function() { - var feature = new _ol_Feature_({ + var feature = new Feature({ style: 'foo' }); @@ -386,7 +386,7 @@ describe('ol.Feature', function() { }); it('does not get confused with user set "style" property', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.set('style', 'foo'); expect(feature.getStyle()).to.be(null); @@ -397,7 +397,7 @@ describe('ol.Feature', function() { describe('#clone', function() { it('correctly clones features', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setProperties({'fookey': 'fooval'}); feature.setId(1); feature.setGeometryName('geom'); @@ -421,7 +421,7 @@ describe('ol.Feature', function() { }); it('correctly clones features with no geometry and no style', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.set('fookey', 'fooval'); var clone = feature.clone(); @@ -435,7 +435,7 @@ describe('ol.Feature', function() { it('dispatches a change event when geometry is set to null', function() { - var feature = new _ol_Feature_({ + var feature = new Feature({ geometry: new Point([0, 0]) }); var spy = sinon.spy(); @@ -451,12 +451,12 @@ describe('ol.Feature.createStyleFunction()', function() { var style = new _ol_style_Style_(); it('creates a feature style function from a single style', function() { - var styleFunction = _ol_Feature_.createStyleFunction(style); + var styleFunction = Feature.createStyleFunction(style); expect(styleFunction()).to.eql([style]); }); it('creates a feature style function from an array of styles', function() { - var styleFunction = _ol_Feature_.createStyleFunction([style]); + var styleFunction = Feature.createStyleFunction([style]); expect(styleFunction()).to.eql([style]); }); @@ -464,13 +464,13 @@ describe('ol.Feature.createStyleFunction()', function() { var original = function() { return [style]; }; - var styleFunction = _ol_Feature_.createStyleFunction(original); + var styleFunction = Feature.createStyleFunction(original); expect(styleFunction).to.be(original); }); it('throws on (some) unexpected input', function() { expect(function() { - _ol_Feature_.createStyleFunction({bogus: 'input'}); + Feature.createStyleFunction({bogus: 'input'}); }).to.throwException(); }); diff --git a/test/spec/ol/featureloader.test.js b/test/spec/ol/featureloader.test.js index 6865ef1ef3..67643fb119 100644 --- a/test/spec/ol/featureloader.test.js +++ b/test/spec/ol/featureloader.test.js @@ -1,6 +1,6 @@ import {xhr} from '../../../src/ol/featureloader.js'; import GeoJSON from '../../../src/ol/format/GeoJSON.js'; -import _ol_source_Vector_ from '../../../src/ol/source/Vector.js'; +import VectorSource from '../../../src/ol/source/Vector.js'; describe('ol.featureloader', function() { @@ -15,7 +15,7 @@ describe('ol.featureloader', function() { url = 'spec/ol/data/point.json'; format = new GeoJSON(); - source = new _ol_source_Vector_(); + source = new VectorSource(); }); it('adds features to the source', function(done) { diff --git a/test/spec/ol/format/esrijson.test.js b/test/spec/ol/format/esrijson.test.js index 03b39c1518..e59f28ff6d 100644 --- a/test/spec/ol/format/esrijson.test.js +++ b/test/spec/ol/format/esrijson.test.js @@ -1,4 +1,4 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js'; import EsriJSON from '../../../../src/ol/format/EsriJSON.js'; import LineString from '../../../../src/ol/geom/LineString.js'; @@ -161,7 +161,7 @@ describe('ol.format.EsriJSON', function() { it('can read a single point feature', function() { var feature = format.readFeature(pointEsriJSON); - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geometry = feature.getGeometry(); expect(geometry).to.be.an(Point); expect(geometry.getCoordinates()).to.eql([102.0, 0.5]); @@ -170,7 +170,7 @@ describe('ol.format.EsriJSON', function() { it('can read a single multipoint feature', function() { var feature = format.readFeature(multiPointEsriJSON); - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geometry = feature.getGeometry(); expect(geometry).to.be.an(MultiPoint); expect(geometry.getCoordinates()).to.eql([[102.0, 0.0], [103.0, 1.0]]); @@ -179,7 +179,7 @@ describe('ol.format.EsriJSON', function() { it('can read a single line string feature', function() { var feature = format.readFeature(lineStringEsriJSON); - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geometry = feature.getGeometry(); expect(geometry).to.be.an(LineString); expect(geometry.getCoordinates()).to.eql( @@ -190,7 +190,7 @@ describe('ol.format.EsriJSON', function() { it('can read a multi line string feature', function() { var feature = format.readFeature(multiLineStringEsriJSON); - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geometry = feature.getGeometry(); expect(geometry).to.be.an(MultiLineString); expect(geometry.getCoordinates()).to.eql([ @@ -203,7 +203,7 @@ describe('ol.format.EsriJSON', function() { it('can read a single polygon feature', function() { var feature = format.readFeature(polygonEsriJSON); - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geometry = feature.getGeometry(); expect(geometry).to.be.an(Polygon); expect(geometry.getCoordinates()).to.eql([[ @@ -215,7 +215,7 @@ describe('ol.format.EsriJSON', function() { it('can read a multi polygon feature', function() { var feature = format.readFeature(multiPolygonEsriJSON); - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geometry = feature.getGeometry(); expect(geometry).to.be.an(MultiPolygon); expect(geometry.getCoordinates()).to.eql([ @@ -282,13 +282,13 @@ describe('ol.format.EsriJSON', function() { expect(array.length).to.be(2); var first = array[0]; - expect(first).to.be.a(_ol_Feature_); + expect(first).to.be.a(Feature); expect(first.get('LINK_ID')).to.be(573730499); var firstGeom = first.getGeometry(); expect(firstGeom).to.be.a(LineString); var second = array[1]; - expect(second).to.be.a(_ol_Feature_); + expect(second).to.be.a(Feature); expect(second.get('ST_NAME')).to.be('BRUNNSGATAN'); var secondGeom = second.getGeometry(); expect(secondGeom).to.be.a(LineString); @@ -300,7 +300,7 @@ describe('ol.format.EsriJSON', function() { expect(result.length).to.be(9); var first = result[0]; - expect(first).to.be.a(_ol_Feature_); + expect(first).to.be.a(Feature); expect(first.get('field_name')).to.be('EUDORA'); expect(first.getId()).to.be(6406); var firstGeom = first.getGeometry(); @@ -311,7 +311,7 @@ describe('ol.format.EsriJSON', function() { ])).to.be(true); var last = result[8]; - expect(last).to.be.a(_ol_Feature_); + expect(last).to.be.a(Feature); expect(last.get('field_name')).to.be('FEAGINS'); expect(last.getId()).to.be(6030); var lastGeom = last.getGeometry(); @@ -744,12 +744,12 @@ describe('ol.format.EsriJSON', function() { expect(features.length).to.be(2); var first = features[0]; - expect(first).to.be.a(_ol_Feature_); + expect(first).to.be.a(Feature); expect(first.get('foo')).to.be('bar'); expect(first.getGeometry()).to.be.a(Point); var second = features[1]; - expect(second).to.be.a(_ol_Feature_); + expect(second).to.be.a(Feature); expect(second.get('bam')).to.be('baz'); expect(second.getGeometry()).to.be.a(LineString); @@ -1048,7 +1048,7 @@ describe('ol.format.EsriJSON', function() { it('writes out a feature with a different geometryName correctly', function() { - var feature = new _ol_Feature_({'foo': 'bar'}); + var feature = new Feature({'foo': 'bar'}); feature.setGeometryName('mygeom'); feature.setGeometry(new Point([5, 10])); var esrijson = format.writeFeaturesObject([feature]); @@ -1056,7 +1056,7 @@ describe('ol.format.EsriJSON', function() { }); it('writes out a feature without properties correctly', function() { - var feature = new _ol_Feature_(new Point([5, 10])); + var feature = new Feature(new Point([5, 10])); var esrijson = format.writeFeatureObject(feature); expect(esrijson.attributes).to.eql({}); }); diff --git a/test/spec/ol/format/geojson.test.js b/test/spec/ol/format/geojson.test.js index 5c1d1b86d5..0ccaabe3fa 100644 --- a/test/spec/ol/format/geojson.test.js +++ b/test/spec/ol/format/geojson.test.js @@ -1,4 +1,4 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js'; import GeoJSON from '../../../../src/ol/format/GeoJSON.js'; import Circle from '../../../../src/ol/geom/Circle.js'; @@ -145,7 +145,7 @@ describe('ol.format.GeoJSON', function() { it('can read a single point feature', function() { var feature = format.readFeature(pointGeoJSON); - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geometry = feature.getGeometry(); expect(geometry).to.be.an(Point); expect(geometry.getCoordinates()).to.eql([102.0, 0.5]); @@ -154,7 +154,7 @@ describe('ol.format.GeoJSON', function() { it('can read a single point geometry as a feature', function() { var feature = format.readFeature(pointGeoJSON.geometry); - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geometry = feature.getGeometry(); expect(geometry).to.be.an(Point); expect(geometry.getCoordinates()).to.eql([102.0, 0.5]); @@ -162,7 +162,7 @@ describe('ol.format.GeoJSON', function() { it('can read a single line string feature', function() { var feature = format.readFeature(lineStringGeoJSON); - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geometry = feature.getGeometry(); expect(geometry).to.be.an(LineString); expect(geometry.getCoordinates()).to.eql( @@ -173,7 +173,7 @@ describe('ol.format.GeoJSON', function() { it('can read a single polygon feature', function() { var feature = format.readFeature(polygonGeoJSON); - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geometry = feature.getGeometry(); expect(geometry).to.be.an(Polygon); expect(geometry.getCoordinates()).to.eql([[ @@ -185,7 +185,7 @@ describe('ol.format.GeoJSON', function() { it('can read a feature with null geometry', function() { var feature = format.readFeature(nullGeometryGeoJSON); - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geometry = feature.getGeometry(); expect(geometry).to.eql(null); expect(feature.get('prop0')).to.be('value0'); @@ -193,7 +193,7 @@ describe('ol.format.GeoJSON', function() { it('can read a feature with id equal to 0', function() { var feature = format.readFeature(zeroIdGeoJSON); - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); expect(feature.getId()).to.be(0); }); @@ -271,13 +271,13 @@ describe('ol.format.GeoJSON', function() { expect(array.length).to.be(2); var first = array[0]; - expect(first).to.be.a(_ol_Feature_); + expect(first).to.be.a(Feature); expect(first.get('LINK_ID')).to.be(573730499); var firstGeom = first.getGeometry(); expect(firstGeom).to.be.a(LineString); var second = array[1]; - expect(second).to.be.a(_ol_Feature_); + expect(second).to.be.a(Feature); expect(second.get('ST_NAME')).to.be('BRUNNSGATAN'); var secondGeom = second.getGeometry(); expect(secondGeom).to.be.a(LineString); @@ -297,7 +297,7 @@ describe('ol.format.GeoJSON', function() { expect(result.length).to.be(179); var first = result[0]; - expect(first).to.be.a(_ol_Feature_); + expect(first).to.be.a(Feature); expect(first.get('name')).to.be('Afghanistan'); expect(first.getId()).to.be('AFG'); var firstGeom = first.getGeometry(); @@ -307,7 +307,7 @@ describe('ol.format.GeoJSON', function() { .to.be(true); var last = result[178]; - expect(last).to.be.a(_ol_Feature_); + expect(last).to.be.a(Feature); expect(last.get('name')).to.be('Zimbabwe'); expect(last.getId()).to.be('ZWE'); var lastGeom = last.getGeometry(); @@ -338,7 +338,7 @@ describe('ol.format.GeoJSON', function() { expect(features.length).to.be(1); var first = features[0]; - expect(first).to.be.a(_ol_Feature_); + expect(first).to.be.a(Feature); expect(first.get('bam')).to.be('baz'); expect(first.getGeometry()).to.be.a(LineString); @@ -462,12 +462,12 @@ describe('ol.format.GeoJSON', function() { expect(features.length).to.be(2); var first = features[0]; - expect(first).to.be.a(_ol_Feature_); + expect(first).to.be.a(Feature); expect(first.get('foo')).to.be('bar'); expect(first.getGeometry()).to.be.a(Point); var second = features[1]; - expect(second).to.be.a(_ol_Feature_); + expect(second).to.be.a(Feature); expect(second.get('bam')).to.be('baz'); expect(second.getGeometry()).to.be.a(LineString); @@ -505,12 +505,12 @@ describe('ol.format.GeoJSON', function() { expect(features.length).to.be(2); var first = features[0]; - expect(first).to.be.a(_ol_Feature_); + expect(first).to.be.a(Feature); expect(first.get('foo')).to.be('bar'); expect(first.getGeometry()).to.be.a(Point); var second = features[1]; - expect(second).to.be.a(_ol_Feature_); + expect(second).to.be.a(Feature); expect(second.get('bam')).to.be('baz'); expect(second.getGeometry()).to.be.a(LineString); @@ -560,7 +560,7 @@ describe('ol.format.GeoJSON', function() { it('writes out a feature with a different geometryName correctly', function() { - var feature = new _ol_Feature_({'foo': 'bar'}); + var feature = new Feature({'foo': 'bar'}); feature.setGeometryName('mygeom'); feature.setGeometry(new Point([5, 10])); var geojson = format.writeFeaturesObject([feature]); @@ -568,19 +568,19 @@ describe('ol.format.GeoJSON', function() { }); it('writes out a feature without properties correctly', function() { - var feature = new _ol_Feature_(new Point([5, 10])); + var feature = new Feature(new Point([5, 10])); var geojson = format.writeFeatureObject(feature); expect(geojson.properties).to.eql(null); }); it('writes out a feature without geometry correctly', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); var geojson = format.writeFeatureObject(feature); expect(geojson.geometry).to.eql(null); }); it('writes out a feature with id equal to 0 correctly', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setId(0); var geojson = format.writeFeatureObject(feature); expect(geojson.id).to.eql(0); diff --git a/test/spec/ol/format/gml.test.js b/test/spec/ol/format/gml.test.js index 607ae08b32..2d4f4cf730 100644 --- a/test/spec/ol/format/gml.test.js +++ b/test/spec/ol/format/gml.test.js @@ -1,4 +1,4 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import _ol_format_GML_ from '../../../../src/ol/format/GML.js'; import GML2 from '../../../../src/ol/format/GML2.js'; import LineString from '../../../../src/ol/geom/LineString.js'; @@ -163,7 +163,7 @@ describe('ol.format.GML2', function() { ' ' + ' '; - var feature = new _ol_Feature_({ + var feature = new Feature({ geometry: new LineString([[1.1, 2], [3, 4.2]]) }); feature.setId(1); @@ -194,7 +194,7 @@ describe('ol.format.GML2', function() { ' ' + ' '; - var feature = new _ol_Feature_({ + var feature = new Feature({ geometry: new Polygon([[[1.1, 2], [3, 4.2], [5.2, 6]]]) }); feature.setId(1); @@ -221,7 +221,7 @@ describe('ol.format.GML2', function() { ' ' + ' '; - var feature = new _ol_Feature_({ + var feature = new Feature({ geometry: new Point([1.1, 2]) }); feature.setId(1); @@ -252,7 +252,7 @@ describe('ol.format.GML2', function() { ' ' + ' '; - var feature = new _ol_Feature_({ + var feature = new Feature({ geometry: new MultiPoint([[1.1, 2]]) }); feature.setId(1); @@ -283,7 +283,7 @@ describe('ol.format.GML2', function() { ' ' + ' '; - var feature = new _ol_Feature_({ + var feature = new Feature({ geometry: new MultiLineString([[[1.1, 2], [3, 4.2]]]) }); feature.setId(1); @@ -318,7 +318,7 @@ describe('ol.format.GML2', function() { ' ' + ' '; - var feature = new _ol_Feature_({ + var feature = new Feature({ geometry: new MultiPolygon([[[[1.1, 2], [3, 4.2], [5.2, 6]]]]) }); feature.setId(1); diff --git a/test/spec/ol/format/gpx.test.js b/test/spec/ol/format/gpx.test.js index a575d6be2d..27914b2048 100644 --- a/test/spec/ol/format/gpx.test.js +++ b/test/spec/ol/format/gpx.test.js @@ -1,4 +1,4 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import GPX from '../../../../src/ol/format/GPX.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import MultiLineString from '../../../../src/ol/geom/MultiLineString.js'; @@ -36,7 +36,7 @@ describe('ol.format.GPX', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(LineString); expect(g.getCoordinates()).to.eql([]); @@ -65,7 +65,7 @@ describe('ol.format.GPX', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); expect(f.get('name')).to.be('Name'); expect(f.get('cmt')).to.be('Comment'); expect(f.get('desc')).to.be('Description'); @@ -93,7 +93,7 @@ describe('ol.format.GPX', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(LineString); expect(g.getCoordinates()).to.eql([[2, 1], [4, 3]]); @@ -118,7 +118,7 @@ describe('ol.format.GPX', function() { }); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(LineString); var p1 = transform([2, 1], 'EPSG:4326', 'EPSG:3857'); @@ -160,7 +160,7 @@ describe('ol.format.GPX', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(MultiLineString); expect(g.getCoordinates()).to.eql([]); @@ -189,7 +189,7 @@ describe('ol.format.GPX', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); expect(f.get('name')).to.be('Name'); expect(f.get('cmt')).to.be('Comment'); expect(f.get('desc')).to.be('Description'); @@ -216,7 +216,7 @@ describe('ol.format.GPX', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(MultiLineString); expect(g.getCoordinates()).to.eql([[]]); @@ -247,7 +247,7 @@ describe('ol.format.GPX', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(MultiLineString); expect(g.getCoordinates()).to.eql([ @@ -282,7 +282,7 @@ describe('ol.format.GPX', function() { }); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(MultiLineString); var p1 = transform([2, 1], 'EPSG:4326', 'EPSG:3857'); @@ -329,7 +329,7 @@ describe('ol.format.GPX', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(MultiLineString); expect(g.getCoordinates()).to.eql([ @@ -391,7 +391,7 @@ describe('ol.format.GPX', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(Point); expect(g.getCoordinates()).to.eql([2, 1]); @@ -413,7 +413,7 @@ describe('ol.format.GPX', function() { }); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(Point); var expectedPoint = transform([2, 1], 'EPSG:4326', 'EPSG:3857'); @@ -438,7 +438,7 @@ describe('ol.format.GPX', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(Point); expect(g.getCoordinates()).to.eql([2, 1, 3]); @@ -460,7 +460,7 @@ describe('ol.format.GPX', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(Point); expect(g.getCoordinates()).to.eql([2, 1, 1263115752]); @@ -483,7 +483,7 @@ describe('ol.format.GPX', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(Point); expect(g.getCoordinates()).to.eql([2, 1, 3, 1263115752]); @@ -523,7 +523,7 @@ describe('ol.format.GPX', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); expect(f.get('magvar')).to.be(11); expect(f.get('geoidheight')).to.be(4); expect(f.get('name')).to.be('Name'); @@ -663,7 +663,7 @@ describe('ol.format.GPX', function() { it('does not fail', function() { var polygon = new Polygon( [[[0, 0], [2, 2], [4, 0], [0, 0]]]); - var feature = new _ol_Feature_(polygon); + var feature = new Feature(polygon); var features = [feature]; var gpx = format.writeFeaturesNode(features); var expected = diff --git a/test/spec/ol/format/igc.test.js b/test/spec/ol/format/igc.test.js index e7b6714521..e4bafa50ab 100644 --- a/test/spec/ol/format/igc.test.js +++ b/test/spec/ol/format/igc.test.js @@ -1,5 +1,5 @@ import IGC from '../../../../src/ol/format/IGC.js'; -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import {get as getProjection, transform} from '../../../../src/ol/proj.js'; @@ -46,7 +46,7 @@ describe('ol.format.IGC', function() { it('does read a feature', function() { var feature = format.readFeature(igc); - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geom = feature.getGeometry(); expect(geom.getType()).to.eql('LineString'); expect(geom.getCoordinates()).to.eql([ @@ -60,7 +60,7 @@ describe('ol.format.IGC', function() { var feature = format.readFeature(igc, { featureProjection: 'EPSG:3857' }); - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geom = feature.getGeometry(); expect(geom.getType()).to.eql('LineString'); @@ -93,7 +93,7 @@ describe('ol.format.IGC', function() { var features = format.readFeatures(igc); expect(features.length).to.eql(1); var feature = features[0]; - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geom = feature.getGeometry(); expect(geom.getType()).to.eql('LineString'); expect(geom.getCoordinates()).to.eql([ @@ -109,7 +109,7 @@ describe('ol.format.IGC', function() { }); expect(features.length).to.eql(1); var feature = features[0]; - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geom = feature.getGeometry(); expect(geom.getType()).to.eql('LineString'); diff --git a/test/spec/ol/format/kml.test.js b/test/spec/ol/format/kml.test.js index 97d7d96b7e..ca6ca8f0cc 100644 --- a/test/spec/ol/format/kml.test.js +++ b/test/spec/ol/format/kml.test.js @@ -1,4 +1,4 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import {find} from '../../../../src/ol/array.js'; import GeoJSON from '../../../../src/ol/format/GeoJSON.js'; import KML from '../../../../src/ol/format/KML.js'; @@ -54,7 +54,7 @@ describe('ol.format.KML', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var styleFunction = f.getStyleFunction(); expect(styleFunction).not.to.be(undefined); var styleArray = styleFunction.call(f, 0); @@ -101,7 +101,7 @@ describe('ol.format.KML', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); expect(f.getId()).to.be('foo'); }); @@ -113,12 +113,12 @@ describe('ol.format.KML', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); expect(f.getId()).to.be(undefined); }); it('can write a Feature', function() { - var features = [new _ol_Feature_()]; + var features = [new Feature()]; var node = format.writeFeaturesNode(features); var text = '' + ''; var f = format.readFeature(text); - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(Point); expect(g.getCoordinates()).to.eql([1, 2, 3]); @@ -307,7 +307,7 @@ describe('ol.format.KML', function() { var f = format.readFeature(text, { featureProjection: 'EPSG:3857' }); - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(Point); var expectedPoint = transform([1, 2], 'EPSG:4326', 'EPSG:3857'); @@ -318,7 +318,7 @@ describe('ol.format.KML', function() { it('can write XY Point geometries', function() { var layout = 'XY'; var point = new Point([1, 2], layout); - var features = [new _ol_Feature_(point)]; + var features = [new Feature(point)]; var node = format.writeFeaturesNode(features); var text = ''; var fs = format.readFeatures(text); expect(fs).to.have.length(1); - expect(fs[0]).to.be.an(_ol_Feature_); + expect(fs[0]).to.be.an(Feature); }); it('can read a single feature from nested Document', function() { @@ -2827,7 +2827,7 @@ describe('ol.format.KML', function() { ''; var fs = format.readFeatures(text); expect(fs).to.have.length(1); - expect(fs[0]).to.be.an(_ol_Feature_); + expect(fs[0]).to.be.an(Feature); }); it('can transform and read a single feature from a Document', function() { @@ -2844,7 +2844,7 @@ describe('ol.format.KML', function() { }); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(Point); var expectedPoint = transform([1, 2], 'EPSG:4326', 'EPSG:3857'); @@ -2862,9 +2862,9 @@ describe('ol.format.KML', function() { ''; var fs = format.readFeatures(text); expect(fs).to.have.length(2); - expect(fs[0]).to.be.an(_ol_Feature_); + expect(fs[0]).to.be.an(Feature); expect(fs[0].getId()).to.be('1'); - expect(fs[1]).to.be.an(_ol_Feature_); + expect(fs[1]).to.be.an(Feature); expect(fs[1].getId()).to.be('2'); }); @@ -2884,7 +2884,7 @@ describe('ol.format.KML', function() { ''; var fs = format.readFeatures(text); expect(fs).to.have.length(1); - expect(fs[0]).to.be.an(_ol_Feature_); + expect(fs[0]).to.be.an(Feature); }); it('can read a multiple features from a Folder', function() { @@ -2897,9 +2897,9 @@ describe('ol.format.KML', function() { ''; var fs = format.readFeatures(text); expect(fs).to.have.length(2); - expect(fs[0]).to.be.an(_ol_Feature_); + expect(fs[0]).to.be.an(Feature); expect(fs[0].getId()).to.be('1'); - expect(fs[1]).to.be.an(_ol_Feature_); + expect(fs[1]).to.be.an(Feature); expect(fs[1].getId()).to.be('2'); }); @@ -2913,7 +2913,7 @@ describe('ol.format.KML', function() { ''; var fs = format.readFeatures(text); expect(fs).to.have.length(1); - expect(fs[0]).to.be.an(_ol_Feature_); + expect(fs[0]).to.be.an(Feature); }); it('can read features from Folders nested in Folders', function() { @@ -2926,7 +2926,7 @@ describe('ol.format.KML', function() { ''; var fs = format.readFeatures(text); expect(fs).to.have.length(1); - expect(fs[0]).to.be.an(_ol_Feature_); + expect(fs[0]).to.be.an(Feature); }); it('can read a single feature', function() { @@ -2935,7 +2935,7 @@ describe('ol.format.KML', function() { ''; var fs = format.readFeatures(text); expect(fs).to.have.length(1); - expect(fs[0]).to.be.an(_ol_Feature_); + expect(fs[0]).to.be.an(Feature); }); it('can read features at multiple levels', function() { @@ -2955,15 +2955,15 @@ describe('ol.format.KML', function() { ''; var fs = format.readFeatures(text); expect(fs).to.have.length(5); - expect(fs[0]).to.be.an(_ol_Feature_); + expect(fs[0]).to.be.an(Feature); expect(fs[0].getId()).to.be('a'); - expect(fs[1]).to.be.an(_ol_Feature_); + expect(fs[1]).to.be.an(Feature); expect(fs[1].getId()).to.be('b'); - expect(fs[2]).to.be.an(_ol_Feature_); + expect(fs[2]).to.be.an(Feature); expect(fs[2].getId()).to.be('c'); - expect(fs[3]).to.be.an(_ol_Feature_); + expect(fs[3]).to.be.an(Feature); expect(fs[3].getId()).to.be('d'); - expect(fs[4]).to.be.an(_ol_Feature_); + expect(fs[4]).to.be.an(Feature); expect(fs[4].getId()).to.be('e'); }); @@ -2990,9 +2990,9 @@ describe('ol.format.KML', function() { }); it('can write multiple features', function() { - var feature1 = new _ol_Feature_(); + var feature1 = new Feature(); feature1.setId('1'); - var feature2 = new _ol_Feature_(); + var feature2 = new Feature(); feature2.setId('2'); var node = format.writeFeaturesNode([feature1, feature2]); var text = @@ -3034,7 +3034,7 @@ describe('ol.format.KML', function() { expect(fs).to.be.an(Array); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); expect(f.getGeometry()).to.be(null); }); @@ -3051,7 +3051,7 @@ describe('ol.format.KML', function() { expect(fs).to.be.an(Array); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); expect(f.getGeometry()).to.be(null); }); @@ -3068,7 +3068,7 @@ describe('ol.format.KML', function() { expect(fs).to.be.an(Array); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); expect(f.getGeometry()).to.be(null); }); @@ -3089,7 +3089,7 @@ describe('ol.format.KML', function() { expect(fs).to.be.an(Array); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); expect(f.getGeometry()).to.be(null); }); @@ -3108,7 +3108,7 @@ describe('ol.format.KML', function() { expect(fs).to.be.an(Array); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(GeometryCollection); expect(g.getGeometries()).to.be.empty(); @@ -3125,7 +3125,7 @@ describe('ol.format.KML', function() { expect(fs).to.be.an(Array); expect(fs).to.have.length(1); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); expect(f.get('visibility')).to.be(undefined); }); @@ -3145,15 +3145,15 @@ describe('ol.format.KML', function() { var fs = format.readFeatures(kml); expect(fs).to.be.an(Array); expect(fs).to.have.length(5); - expect(fs[0]).to.be.an(_ol_Feature_); + expect(fs[0]).to.be.an(Feature); expect(fs[0].getId()).to.be('a'); - expect(fs[1]).to.be.an(_ol_Feature_); + expect(fs[1]).to.be.an(Feature); expect(fs[1].getId()).to.be('b'); - expect(fs[2]).to.be.an(_ol_Feature_); + expect(fs[2]).to.be.an(Feature); expect(fs[2].getId()).to.be('c'); - expect(fs[3]).to.be.an(_ol_Feature_); + expect(fs[3]).to.be.an(Feature); expect(fs[3].getId()).to.be('d'); - expect(fs[4]).to.be.an(_ol_Feature_); + expect(fs[4]).to.be.an(Feature); expect(fs[4].getId()).to.be('e'); }); @@ -3182,7 +3182,7 @@ describe('ol.format.KML', function() { it('creates features with heterogeneous geometry collections', function() { // FIXME decide if we should instead create features with multiple geoms var feature = features[0]; - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geometry = feature.getGeometry(); expect(geometry).to.be.an(GeometryCollection); }); @@ -3191,7 +3191,7 @@ describe('ol.format.KML', function() { var alaska = find(features, function(feature) { return feature.get('name') === 'Alaska'; }); - expect(alaska).to.be.an(_ol_Feature_); + expect(alaska).to.be.an(Feature); var geometry = alaska.getGeometry(); expect(geometry).to.be.an(GeometryCollection); var components = geometry.getGeometries(); diff --git a/test/spec/ol/format/mvt.test.js b/test/spec/ol/format/mvt.test.js index 7a28cb489c..63470023b2 100644 --- a/test/spec/ol/format/mvt.test.js +++ b/test/spec/ol/format/mvt.test.js @@ -1,4 +1,4 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js'; import MVT from '../../../../src/ol/format/MVT.js'; import Point from '../../../../src/ol/geom/Point.js'; @@ -36,7 +36,7 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() { it('parses geometries correctly', function() { var format = new MVT({ - featureClass: _ol_Feature_, + featureClass: Feature, layers: ['poi_label'] }); var geometry; @@ -61,7 +61,7 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() { it('parses id property', function() { // ol.Feature var format = new MVT({ - featureClass: _ol_Feature_, + featureClass: Feature, layers: ['building'] }); var features = format.readFeatures(data); @@ -90,7 +90,7 @@ describe('ol.format.MVT', function() { describe('#createFeature_', function() { it('accepts a geometryName', function() { var format = new MVT({ - featureClass: _ol_Feature_, + featureClass: Feature, geometryName: 'myGeom' }); var rawFeature = { @@ -118,7 +118,7 @@ describe('ol.format.MVT', function() { it('detects a Polygon', function() { var format = new MVT({ - featureClass: _ol_Feature_ + featureClass: Feature }); var rawFeature = { type: 3, @@ -141,7 +141,7 @@ describe('ol.format.MVT', function() { it('detects a MultiPolygon', function() { var format = new MVT({ - featureClass: _ol_Feature_ + featureClass: Feature }); var rawFeature = { type: 3, diff --git a/test/spec/ol/format/osmxml.test.js b/test/spec/ol/format/osmxml.test.js index a02309ac59..561f0aa304 100644 --- a/test/spec/ol/format/osmxml.test.js +++ b/test/spec/ol/format/osmxml.test.js @@ -1,4 +1,4 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import OSMXML from '../../../../src/ol/format/OSMXML.js'; import Point from '../../../../src/ol/geom/Point.js'; import LineString from '../../../../src/ol/geom/LineString.js'; @@ -49,7 +49,7 @@ describe('ol.format.OSMXML', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(2); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(Point); expect(g.getCoordinates()).to.eql([2, 1]); @@ -74,12 +74,12 @@ describe('ol.format.OSMXML', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(3); var point = fs[0]; - expect(point).to.be.an(_ol_Feature_); + expect(point).to.be.an(Feature); var g = point.getGeometry(); expect(g).to.be.an(Point); expect(g.getCoordinates()).to.eql([2, 1]); var line = fs[2]; - expect(line).to.be.an(_ol_Feature_); + expect(line).to.be.an(Feature); g = line.getGeometry(); expect(g).to.be.an(LineString); expect(g.getCoordinates()).to.eql([[2, 1], [4, 3]]); @@ -105,7 +105,7 @@ describe('ol.format.OSMXML', function() { var fs = format.readFeatures(text); expect(fs).to.have.length(3); var line = fs[2]; - expect(line).to.be.an(_ol_Feature_); + expect(line).to.be.an(Feature); var g = line.getGeometry(); expect(g).to.be.an(LineString); expect(g.getCoordinates()).to.eql([[2, 1], [4, 3]]); @@ -128,7 +128,7 @@ describe('ol.format.OSMXML', function() { }); expect(fs).to.have.length(2); var f = fs[0]; - expect(f).to.be.an(_ol_Feature_); + expect(f).to.be.an(Feature); var g = f.getGeometry(); expect(g).to.be.an(Point); expect(g.getCoordinates()).to.eql( diff --git a/test/spec/ol/format/polyline.test.js b/test/spec/ol/format/polyline.test.js index 254795c630..42fea9d7a0 100644 --- a/test/spec/ol/format/polyline.test.js +++ b/test/spec/ol/format/polyline.test.js @@ -1,4 +1,4 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import Polyline, * as polyline from '../../../../src/ol/format/Polyline.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import {get as getProjection, transform} from '../../../../src/ol/proj.js'; @@ -265,7 +265,7 @@ describe('ol.format.Polyline', function() { it('returns the expected feature', function() { var feature = format.readFeature(encodedFlatPoints); - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geometry = feature.getGeometry(); expect(geometry).to.be.an(LineString); expect(geometry.getFlatCoordinates()).to.eql(flatPoints); @@ -275,7 +275,7 @@ describe('ol.format.Polyline', function() { var feature = format.readFeature(encodedFlatPoints, { featureProjection: 'EPSG:3857' }); - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geometry = feature.getGeometry(); expect(geometry).to.be.an(LineString); expect(geometry.getCoordinates()).to.eql(points3857); @@ -290,7 +290,7 @@ describe('ol.format.Polyline', function() { expect(features).to.be.an(Array); expect(features).to.have.length(1); var feature = features[0]; - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geometry = feature.getGeometry(); expect(geometry).to.be.an(LineString); expect(geometry.getFlatCoordinates()).to.eql(flatPoints); @@ -303,7 +303,7 @@ describe('ol.format.Polyline', function() { expect(features).to.be.an(Array); expect(features).to.have.length(1); var feature = features[0]; - expect(feature).to.be.an(_ol_Feature_); + expect(feature).to.be.an(Feature); var geometry = feature.getGeometry(); expect(geometry).to.be.an(LineString); expect(geometry.getCoordinates()).to.eql(points3857); @@ -360,12 +360,12 @@ describe('ol.format.Polyline', function() { describe('#writeFeature', function() { it('returns the expected text', function() { - var feature = new _ol_Feature_(new LineString(points)); + var feature = new Feature(new LineString(points)); expect(format.writeFeature(feature)).to.be(encodedFlatPoints); }); it('transforms and returns the expected text', function() { - var feature = new _ol_Feature_(new LineString(points3857)); + var feature = new Feature(new LineString(points3857)); expect(format.writeFeature(feature, { featureProjection: 'EPSG:3857' })).to.be(encodedFlatPoints); @@ -376,12 +376,12 @@ describe('ol.format.Polyline', function() { describe('#writeFeature', function() { it('returns the expected text', function() { - var features = [new _ol_Feature_(new LineString(points))]; + var features = [new Feature(new LineString(points))]; expect(format.writeFeatures(features)).to.be(encodedFlatPoints); }); it('transforms and returns the expected text', function() { - var features = [new _ol_Feature_(new LineString(points3857))]; + var features = [new Feature(new LineString(points3857))]; expect(format.writeFeatures(features, { featureProjection: 'EPSG:3857' })).to.be(encodedFlatPoints); diff --git a/test/spec/ol/format/topojson.test.js b/test/spec/ol/format/topojson.test.js index 69ff8fd9c0..3db2b67da5 100644 --- a/test/spec/ol/format/topojson.test.js +++ b/test/spec/ol/format/topojson.test.js @@ -1,4 +1,4 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; import FeatureFormat from '../../../../src/ol/format/Feature.js'; @@ -59,7 +59,7 @@ describe('ol.format.TopoJSON', function() { expect(features).to.have.length(1); var feature = features[0]; - expect(feature).to.be.a(_ol_Feature_); + expect(feature).to.be.a(Feature); var geometry = feature.getGeometry(); expect(geometry).to.be.a(Polygon); @@ -80,7 +80,7 @@ describe('ol.format.TopoJSON', function() { expect(features).to.have.length(1); var feature = features[0]; - expect(feature).to.be.a(_ol_Feature_); + expect(feature).to.be.a(Feature); expect(feature.getId()).to.be(0); }); @@ -155,14 +155,14 @@ describe('ol.format.TopoJSON', function() { expect(features.length).to.be(178); var first = features[0]; - expect(first).to.be.a(_ol_Feature_); + expect(first).to.be.a(Feature); var firstGeom = first.getGeometry(); expect(firstGeom).to.be.a(MultiPolygon); expect(firstGeom.getExtent()).to.eql( [-180, -85.60903777459777, 180, 83.64513000000002]); var last = features[177]; - expect(last).to.be.a(_ol_Feature_); + expect(last).to.be.a(Feature); var lastGeom = last.getGeometry(); expect(lastGeom).to.be.a(Polygon); expect(lastGeom.getExtent()).to.eql([ diff --git a/test/spec/ol/format/wfs.test.js b/test/spec/ol/format/wfs.test.js index 431c02ee08..49dce906ee 100644 --- a/test/spec/ol/format/wfs.test.js +++ b/test/spec/ol/format/wfs.test.js @@ -1,4 +1,4 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import GML2 from '../../../../src/ol/format/GML2.js'; import WFS from '../../../../src/ol/format/WFS.js'; import _ol_format_filter_ from '../../../../src/ol/format/filter.js'; @@ -712,7 +712,7 @@ describe('ol.format.WFS', function() { }); it('creates the correct srsName', function() { var format = new WFS(); - var insertFeature = new _ol_Feature_({ + var insertFeature = new Feature({ the_geom: new MultiLineString([[ [-5178372.1885436, 1992365.7775042], [-4434792.7774889, 1601008.1927386], @@ -743,7 +743,7 @@ describe('ol.format.WFS', function() { it('creates the correct update', function() { var format = new WFS(); - var updateFeature = new _ol_Feature_(); + var updateFeature = new Feature(); updateFeature.setGeometryName('the_geom'); updateFeature.setGeometry(new MultiLineString([[ [-12279454, 6741885], @@ -764,7 +764,7 @@ describe('ol.format.WFS', function() { it('creates the correct update if geometry name is alias', function() { var format = new WFS(); - var updateFeature = new _ol_Feature_(new MultiLineString([[ + var updateFeature = new Feature(new MultiLineString([[ [-12279454, 6741885], [-12064207, 6732101], [-11941908, 6595126], @@ -788,7 +788,7 @@ describe('ol.format.WFS', function() { it('creates the correct update with default featurePrefix', function() { var format = new WFS(); - var updateFeature = new _ol_Feature_(); + var updateFeature = new Feature(); updateFeature.setGeometryName('the_geom'); updateFeature.setGeometry(new MultiLineString([[ [-12279454, 6741885], @@ -811,7 +811,7 @@ describe('ol.format.WFS', function() { it('does not create an update if no fid', function() { var format = new WFS(); - var updateFeature = new _ol_Feature_(); + var updateFeature = new Feature(); updateFeature.setGeometryName('the_geom'); updateFeature.setGeometry(new MultiLineString([[ [-12279454, 6741885], @@ -844,7 +844,7 @@ describe('ol.format.WFS', function() { it('handles multiple geometries', function() { var format = new WFS(); - var updateFeature = new _ol_Feature_(); + var updateFeature = new Feature(); updateFeature.setGeometryName('the_geom'); updateFeature.setGeometry(new MultiLineString([[ [-12279454, 6741885], @@ -879,14 +879,14 @@ describe('ol.format.WFS', function() { it('creates the correct transaction body', function() { var format = new WFS(); - var insertFeature = new _ol_Feature_({ + var insertFeature = new Feature({ the_geom: new MultiPoint([[1, 2]]), foo: 'bar', nul: null }); insertFeature.setGeometryName('the_geom'); var inserts = [insertFeature]; - var updateFeature = new _ol_Feature_({ + var updateFeature = new Feature({ the_geom: new MultiPoint([[1, 2]]), foo: 'bar', // null value gets Property element with no Value @@ -898,7 +898,7 @@ describe('ol.format.WFS', function() { updateFeature.setGeometryName('the_geom'); var updates = [updateFeature]; - var deleteFeature = new _ol_Feature_(); + var deleteFeature = new Feature(); deleteFeature.setId('fid.37'); var deletes = [deleteFeature]; var serialized = format.writeTransaction(inserts, updates, deletes, { @@ -949,14 +949,14 @@ describe('ol.format.WFS', function() { it('handles the WFS version', function() { var format = new WFS(); - var insertFeature = new _ol_Feature_({ + var insertFeature = new Feature({ the_geom: new LineString([[1.1, 2], [3, 4.2]]), foo: 'bar', nul: null }); insertFeature.setGeometryName('the_geom'); var inserts = [insertFeature]; - var updateFeature = new _ol_Feature_({ + var updateFeature = new Feature({ the_geom: new LineString([[1.1, 2], [3, 4.2]]), foo: 'bar', // null value gets Property element with no Value @@ -968,7 +968,7 @@ describe('ol.format.WFS', function() { updateFeature.setGeometryName('the_geom'); var updates = [updateFeature]; - var deleteFeature = new _ol_Feature_(); + var deleteFeature = new Feature(); deleteFeature.setId('fid.37'); var deletes = [deleteFeature]; var serialized = format.writeTransaction(inserts, updates, deletes, { @@ -993,14 +993,14 @@ describe('ol.format.WFS', function() { it('do not add feature prefix twice', function() { var format = new WFS(); - var insertFeature = new _ol_Feature_({ + var insertFeature = new Feature({ the_geom: new MultiPoint([[1, 2]]), foo: 'bar', nul: null }); insertFeature.setGeometryName('the_geom'); var inserts = [insertFeature]; - var updateFeature = new _ol_Feature_({ + var updateFeature = new Feature({ the_geom: new MultiPoint([[1, 2]]), foo: 'bar', // null value gets Property element with no Value @@ -1012,7 +1012,7 @@ describe('ol.format.WFS', function() { updateFeature.setGeometryName('the_geom'); var updates = [updateFeature]; - var deleteFeature = new _ol_Feature_(); + var deleteFeature = new Feature(); deleteFeature.setId('fid.37'); var deletes = [deleteFeature]; var serialized = format.writeTransaction(inserts, updates, deletes, { @@ -1036,14 +1036,14 @@ describe('ol.format.WFS', function() { it('handles 3D in WFS 1.0.0', function() { var format = new WFS(); - var insertFeature = new _ol_Feature_({ + var insertFeature = new Feature({ the_geom: new LineString([[1.1, 2, 4], [3, 4.2, 5]]), foo: 'bar', nul: null }); insertFeature.setGeometryName('the_geom'); var inserts = [insertFeature]; - var updateFeature = new _ol_Feature_({ + var updateFeature = new Feature({ the_geom: new LineString([[1.1, 2, 6], [3, 4.2, 7]]), foo: 'bar', // null value gets Property element with no Value @@ -1078,14 +1078,14 @@ describe('ol.format.WFS', function() { it('handles 3D in WFS 1.1.0', function() { var format = new WFS(); - var insertFeature = new _ol_Feature_({ + var insertFeature = new Feature({ the_geom: new MultiPoint([[1, 2, 3]]), foo: 'bar', nul: null }); insertFeature.setGeometryName('the_geom'); var inserts = [insertFeature]; - var updateFeature = new _ol_Feature_({ + var updateFeature = new Feature({ the_geom: new MultiPoint([[1, 2, 3]]), foo: 'bar', // null value gets Property element with no Value @@ -1247,7 +1247,7 @@ describe('ol.format.WFS', function() { it('reads all features', function() { expect(features.length).to.be(5); features.forEach(function(feature) { - expect(feature instanceof _ol_Feature_).to.be(true); + expect(feature instanceof Feature).to.be(true); }); }); diff --git a/test/spec/ol/format/wkt.test.js b/test/spec/ol/format/wkt.test.js index 6d36ac0a00..bdb21e6f83 100644 --- a/test/spec/ol/format/wkt.test.js +++ b/test/spec/ol/format/wkt.test.js @@ -1,4 +1,4 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import Point from '../../../../src/ol/geom/Point.js'; import WKT from '../../../../src/ol/format/WKT.js'; import {transform} from '../../../../src/ol/proj.js'; @@ -62,14 +62,14 @@ describe('ol.format.WKT', function() { describe('#writeFeature()', function() { it('transforms with dataProjection and featureProjection', function() { - var feature = new _ol_Feature_( + var feature = new Feature( new Point([1, 2]).transform('EPSG:4326', 'EPSG:3857')); var wkt = format.writeFeature(feature, { dataProjection: 'EPSG:4326', featureProjection: 'EPSG:3857' }); var gotFeature = format.readFeature(wkt); - expect(gotFeature).to.be.a(_ol_Feature_); + expect(gotFeature).to.be.a(Feature); var got = gotFeature.getGeometry().getCoordinates(); expect(got[0]).to.roughlyEqual(1, 1e-6); expect(got[1]).to.roughlyEqual(2, 1e-6); @@ -101,9 +101,9 @@ describe('ol.format.WKT', function() { it('transforms with dataProjection and featureProjection', function() { var features = [ - new _ol_Feature_( + new Feature( new Point([1, 2]).transform('EPSG:4326', 'EPSG:3857')), - new _ol_Feature_( + new Feature( new Point([4, 5]).transform('EPSG:4326', 'EPSG:3857')) ]; var wkt = format.writeFeatures(features, { diff --git a/test/spec/ol/imagetile.test.js b/test/spec/ol/imagetile.test.js index 4fed6479ae..85ca753fce 100644 --- a/test/spec/ol/imagetile.test.js +++ b/test/spec/ol/imagetile.test.js @@ -2,7 +2,7 @@ import ImageTile from '../../../src/ol/ImageTile.js'; import TileState from '../../../src/ol/TileState.js'; import _ol_events_ from '../../../src/ol/events.js'; import EventType from '../../../src/ol/events/EventType.js'; -import _ol_source_Image_ from '../../../src/ol/source/Image.js'; +import ImageSource from '../../../src/ol/source/Image.js'; describe('ol.ImageTile', function() { @@ -13,7 +13,7 @@ describe('ol.ImageTile', function() { var tileCoord = [0, 0, 0]; var state = TileState.IDLE; var src = 'spec/ol/data/osm-0-0-0.png'; - var tileLoadFunction = _ol_source_Image_.defaultImageLoadFunction; + var tileLoadFunction = ImageSource.defaultImageLoadFunction; var tile = new ImageTile(tileCoord, state, src, null, tileLoadFunction); var previousState = tile.getState(); @@ -38,7 +38,7 @@ describe('ol.ImageTile', function() { var tileCoord = [0, 0, 0]; var state = TileState.ERROR; var src = 'spec/ol/data/osm-0-0-0.png'; - var tileLoadFunction = _ol_source_Image_.defaultImageLoadFunction; + var tileLoadFunction = ImageSource.defaultImageLoadFunction; var tile = new ImageTile(tileCoord, state, src, null, tileLoadFunction); var previousState = tile.getState(); @@ -63,7 +63,7 @@ describe('ol.ImageTile', function() { var tileCoord = [0, 0, 0]; var state = TileState.IDLE; var src = 'spec/ol/data/osm-0-0-99.png'; - var tileLoadFunction = _ol_source_Image_.defaultImageLoadFunction; + var tileLoadFunction = ImageSource.defaultImageLoadFunction; var tile = new ImageTile(tileCoord, state, src, null, tileLoadFunction); var key = _ol_events_.listen(tile, EventType.CHANGE, function(event) { @@ -89,7 +89,7 @@ describe('ol.ImageTile', function() { var tileCoord = [0, 0, 0]; var state = TileState.IDLE; var src = 'spec/ol/data/osm-0-0-0.png'; - var tileLoadFunction = _ol_source_Image_.defaultImageLoadFunction; + var tileLoadFunction = ImageSource.defaultImageLoadFunction; var tile = new ImageTile(tileCoord, state, src, null, tileLoadFunction); tile.load(); expect(tile.getState()).to.be(TileState.LOADING); diff --git a/test/spec/ol/interaction/draganddrop.test.js b/test/spec/ol/interaction/draganddrop.test.js index ffd6d51be6..a40f561e38 100644 --- a/test/spec/ol/interaction/draganddrop.test.js +++ b/test/spec/ol/interaction/draganddrop.test.js @@ -1,10 +1,10 @@ import {inherits} from '../../../../src/ol/index.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import Event from '../../../../src/ol/events/Event.js'; import EventTarget from '../../../../src/ol/events/EventTarget.js'; import GeoJSON from '../../../../src/ol/format/GeoJSON.js'; import DragAndDrop from '../../../../src/ol/interaction/DragAndDrop.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; where('FileReader').describe('ol.interaction.DragAndDrop', function() { var viewport, map, interaction; @@ -16,7 +16,7 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() { return viewport; }, getView: function() { - return new _ol_View_(); + return new View(); } }; interaction = new DragAndDrop({ @@ -36,7 +36,7 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() { }); it('accepts a source option', function() { - var source = new _ol_source_Vector_(); + var source = new VectorSource(); var drop = new DragAndDrop({ formatConstructors: [GeoJSON], source: source @@ -136,7 +136,7 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() { }); it('adds dropped features to a source', function(done) { - var source = new _ol_source_Vector_(); + var source = new VectorSource(); var drop = new DragAndDrop({ formatConstructors: [GeoJSON], source: source diff --git a/test/spec/ol/interaction/dragrotateandzoom.test.js b/test/spec/ol/interaction/dragrotateandzoom.test.js index b122b80066..4c8ab28ffc 100644 --- a/test/spec/ol/interaction/dragrotateandzoom.test.js +++ b/test/spec/ol/interaction/dragrotateandzoom.test.js @@ -1,11 +1,11 @@ import Map from '../../../../src/ol/Map.js'; import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import DragRotateAndZoom from '../../../../src/ol/interaction/DragRotateAndZoom.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js'; -import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; +import VectorLayer from '../../../../src/ol/layer/Vector.js'; import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; describe('ol.interaction.DragRotateAndZoom', function() { @@ -34,14 +34,14 @@ describe('ol.interaction.DragRotateAndZoom', function() { style.width = width + 'px'; style.height = height + 'px'; document.body.appendChild(target); - var source = new _ol_source_Vector_(); - var layer = new _ol_layer_Vector_({source: source}); + var source = new VectorSource(); + var layer = new VectorLayer({source: source}); interaction = new DragRotateAndZoom(); map = new Map({ target: target, layers: [layer], interactions: [interaction], - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 @@ -66,7 +66,7 @@ describe('ol.interaction.DragRotateAndZoom', function() { interaction.handleDragEvent_(event); expect(spy.callCount).to.be(1); expect(interaction.lastAngle_).to.be(-0.8308214428190254); - map.setView(new _ol_View_({ + map.setView(new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1, diff --git a/test/spec/ol/interaction/dragzoom.test.js b/test/spec/ol/interaction/dragzoom.test.js index 435824d9c7..77dfe3a2a2 100644 --- a/test/spec/ol/interaction/dragzoom.test.js +++ b/test/spec/ol/interaction/dragzoom.test.js @@ -1,11 +1,11 @@ import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js'; import {fromExtent as polygonFromExtent} from '../../../../src/ol/geom/Polygon.js'; import DragZoom from '../../../../src/ol/interaction/DragZoom.js'; -import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; +import VectorLayer from '../../../../src/ol/layer/Vector.js'; import _ol_render_Box_ from '../../../../src/ol/render/Box.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; describe('ol.interaction.DragZoom', function() { @@ -24,12 +24,12 @@ describe('ol.interaction.DragZoom', function() { style.width = width + 'px'; style.height = height + 'px'; document.body.appendChild(target); - source = new _ol_source_Vector_(); - var layer = new _ol_layer_Vector_({source: source}); + source = new VectorSource(); + var layer = new VectorLayer({source: source}); map = new Map({ target: target, layers: [layer], - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 diff --git a/test/spec/ol/interaction/draw.test.js b/test/spec/ol/interaction/draw.test.js index a38677e010..5371118549 100644 --- a/test/spec/ol/interaction/draw.test.js +++ b/test/spec/ol/interaction/draw.test.js @@ -1,7 +1,7 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.js'; import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import {equals} from '../../../../src/ol/array.js'; import _ol_events_ from '../../../../src/ol/events.js'; import _ol_events_condition_ from '../../../../src/ol/events/condition.js'; @@ -14,9 +14,9 @@ import Point from '../../../../src/ol/geom/Point.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; import Draw from '../../../../src/ol/interaction/Draw.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js'; -import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; +import VectorLayer from '../../../../src/ol/layer/Vector.js'; import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; describe('ol.interaction.Draw', function() { @@ -34,12 +34,12 @@ describe('ol.interaction.Draw', function() { style.width = width + 'px'; style.height = height + 'px'; document.body.appendChild(target); - source = new _ol_source_Vector_(); - var layer = new _ol_layer_Vector_({source: source}); + source = new VectorSource(); + var layer = new VectorLayer({source: source}); map = new Map({ target: target, layers: [layer], - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 @@ -1035,7 +1035,7 @@ describe('ol.interaction.Draw', function() { type: 'LineString' }); map.addInteraction(draw); - feature = new _ol_Feature_( + feature = new Feature( new LineString([[0, 0], [1, 1], [2, 0]])); }); diff --git a/test/spec/ol/interaction/extent.test.js b/test/spec/ol/interaction/extent.test.js index dfdb6b8d81..31c9278223 100644 --- a/test/spec/ol/interaction/extent.test.js +++ b/test/spec/ol/interaction/extent.test.js @@ -1,6 +1,6 @@ import Map from '../../../../src/ol/Map.js'; import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import _ol_interaction_Extent_ from '../../../../src/ol/interaction/Extent.js'; import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; @@ -16,7 +16,7 @@ describe('ol.interaction.Extent', function() { map = new Map({ target: target, layers: [], - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 diff --git a/test/spec/ol/interaction/interaction.test.js b/test/spec/ol/interaction/interaction.test.js index 743d2f65bf..e04cc5ac54 100644 --- a/test/spec/ol/interaction/interaction.test.js +++ b/test/spec/ol/interaction/interaction.test.js @@ -1,5 +1,5 @@ import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import EventTarget from '../../../../src/ol/events/EventTarget.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js'; @@ -59,7 +59,7 @@ describe('ol.interaction.Interaction', function() { describe('zoomByDelta()', function() { it('changes view resolution', function() { - var view = new _ol_View_({ + var view = new View({ resolution: 1, resolutions: [4, 2, 1, 0.5, 0.25] }); @@ -78,7 +78,7 @@ describe('ol.interaction.Interaction', function() { }); it('changes view resolution and center relative to the anchor', function() { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], resolution: 1, resolutions: [4, 2, 1, 0.5, 0.25] @@ -98,7 +98,7 @@ describe('ol.interaction.Interaction', function() { }); it('changes view resolution and center relative to the anchor, while respecting the extent', function() { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], extent: [-2.5, -2.5, 2.5, 2.5], resolution: 1, diff --git a/test/spec/ol/interaction/keyboardpan.test.js b/test/spec/ol/interaction/keyboardpan.test.js index 2250cb94be..8ff5bb24dd 100644 --- a/test/spec/ol/interaction/keyboardpan.test.js +++ b/test/spec/ol/interaction/keyboardpan.test.js @@ -1,6 +1,6 @@ import Map from '../../../../src/ol/Map.js'; import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import Event from '../../../../src/ol/events/Event.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js'; @@ -10,7 +10,7 @@ describe('ol.interaction.KeyboardPan', function() { beforeEach(function() { map = new Map({ target: createMapDiv(100, 100), - view: new _ol_View_({ + view: new View({ center: [0, 0], resolutions: [1], zoom: 0 diff --git a/test/spec/ol/interaction/keyboardzoom.test.js b/test/spec/ol/interaction/keyboardzoom.test.js index 23c9b67f1c..02fcfde877 100644 --- a/test/spec/ol/interaction/keyboardzoom.test.js +++ b/test/spec/ol/interaction/keyboardzoom.test.js @@ -1,6 +1,6 @@ import Map from '../../../../src/ol/Map.js'; import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import Event from '../../../../src/ol/events/Event.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js'; @@ -10,7 +10,7 @@ describe('ol.interaction.KeyboardZoom', function() { beforeEach(function() { map = new Map({ target: createMapDiv(100, 100), - view: new _ol_View_({ + view: new View({ center: [0, 0], resolutions: [1], zoom: 0 diff --git a/test/spec/ol/interaction/modify.test.js b/test/spec/ol/interaction/modify.test.js index 58ca38a682..eb38ad0780 100644 --- a/test/spec/ol/interaction/modify.test.js +++ b/test/spec/ol/interaction/modify.test.js @@ -1,8 +1,8 @@ import _ol_Collection_ from '../../../../src/ol/Collection.js'; -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.js'; import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import _ol_events_ from '../../../../src/ol/events.js'; import _ol_events_condition_ from '../../../../src/ol/events/condition.js'; import Circle from '../../../../src/ol/geom/Circle.js'; @@ -10,9 +10,9 @@ import LineString from '../../../../src/ol/geom/LineString.js'; import Point from '../../../../src/ol/geom/Point.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; import _ol_interaction_Modify_ from '../../../../src/ol/interaction/Modify.js'; -import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; +import VectorLayer from '../../../../src/ol/layer/Vector.js'; import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; describe('ol.interaction.Modify', function() { @@ -34,23 +34,23 @@ describe('ol.interaction.Modify', function() { document.body.appendChild(target); features = [ - new _ol_Feature_({ + new Feature({ geometry: new Polygon([ [[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]] ]) }) ]; - source = new _ol_source_Vector_({ + source = new VectorSource({ features: features }); - var layer = new _ol_layer_Vector_({source: source}); + var layer = new VectorLayer({source: source}); map = new Map({ target: target, layers: [layer], - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 @@ -151,7 +151,7 @@ describe('ol.interaction.Modify', function() { describe('constructor', function() { it('adds features to the RTree', function() { - var feature = new _ol_Feature_( + var feature = new Feature( new Point([0, 0])); var features = new _ol_Collection_([feature]); var modify = new _ol_interaction_Modify_({ @@ -163,7 +163,7 @@ describe('ol.interaction.Modify', function() { }); it('accepts feature without geometry', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); var features = new _ol_Collection_([feature]); var modify = new _ol_interaction_Modify_({ features: features @@ -178,9 +178,9 @@ describe('ol.interaction.Modify', function() { }); it('accepts a source', function() { - var feature = new _ol_Feature_( + var feature = new Feature( new Point([0, 0])); - var source = new _ol_source_Vector_({features: [feature]}); + var source = new VectorSource({features: [feature]}); var modify = new _ol_interaction_Modify_({source: source}); var rbushEntries = modify.rBush_.getAll(); expect(rbushEntries.length).to.be(1); @@ -225,7 +225,7 @@ describe('ol.interaction.Modify', function() { }); it('deletes first vertex of a LineString', function() { - var lineFeature = new _ol_Feature_({ + var lineFeature = new Feature({ geometry: new LineString( [[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]] ) @@ -261,7 +261,7 @@ describe('ol.interaction.Modify', function() { }); it('deletes last vertex of a LineString', function() { - var lineFeature = new _ol_Feature_({ + var lineFeature = new Feature({ geometry: new LineString( [[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]] ) @@ -297,7 +297,7 @@ describe('ol.interaction.Modify', function() { }); it('deletes vertex of a LineString programmatically', function() { - var lineFeature = new _ol_Feature_({ + var lineFeature = new Feature({ geometry: new LineString( [[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]] ) @@ -339,7 +339,7 @@ describe('ol.interaction.Modify', function() { describe('vertex modification', function() { it('keeps the third dimension', function() { - var lineFeature = new _ol_Feature_({ + var lineFeature = new Feature({ geometry: new LineString( [[0, 0, 10], [10, 20, 20], [0, 40, 30], [40, 40, 40], [40, 0, 50]] ) @@ -382,7 +382,7 @@ describe('ol.interaction.Modify', function() { describe('circle modification', function() { it('changes the circle radius and center', function() { - var circleFeature = new _ol_Feature_(new Circle([10, 10], 20)); + var circleFeature = new Feature(new Circle([10, 10], 20)); features.length = 0; features.push(circleFeature); @@ -617,7 +617,7 @@ describe('ol.interaction.Modify', function() { }); it('updates circle segment data', function() { - var feature = new _ol_Feature_(new Circle([10, 10], 20)); + var feature = new Feature(new Circle([10, 10], 20)); features.length = 0; features.push(feature); diff --git a/test/spec/ol/interaction/mousewheelzoom.test.js b/test/spec/ol/interaction/mousewheelzoom.test.js index 2f401b17d1..07caf65ad6 100644 --- a/test/spec/ol/interaction/mousewheelzoom.test.js +++ b/test/spec/ol/interaction/mousewheelzoom.test.js @@ -1,6 +1,6 @@ import Map from '../../../../src/ol/Map.js'; import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import Event from '../../../../src/ol/events/Event.js'; import _ol_has_ from '../../../../src/ol/has.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js'; @@ -15,7 +15,7 @@ describe('ol.interaction.MouseWheelZoom', function() { map = new Map({ target: createMapDiv(100, 100), interactions: [interaction], - view: new _ol_View_({ + view: new View({ center: [0, 0], resolutions: [2, 1, 0.5], zoom: 1 diff --git a/test/spec/ol/interaction/select.test.js b/test/spec/ol/interaction/select.test.js index 8c5785acdb..b31a2faa71 100644 --- a/test/spec/ol/interaction/select.test.js +++ b/test/spec/ol/interaction/select.test.js @@ -1,15 +1,15 @@ import _ol_Collection_ from '../../../../src/ol/Collection.js'; -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.js'; import MapBrowserEventType from '../../../../src/ol/MapBrowserEventType.js'; import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js'; import _ol_interaction_Select_ from '../../../../src/ol/interaction/Select.js'; -import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; +import VectorLayer from '../../../../src/ol/layer/Vector.js'; import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; describe('ol.interaction.Select', function() { @@ -36,33 +36,33 @@ describe('ol.interaction.Select', function() { // -> foo -> bar. var features = []; features.push( - new _ol_Feature_({ + new Feature({ geometry: geometry, type: 'bar' }), - new _ol_Feature_({ + new Feature({ geometry: geometry, type: 'foo' }), - new _ol_Feature_({ + new Feature({ geometry: geometry, type: 'bar' }), - new _ol_Feature_({ + new Feature({ geometry: geometry, type: 'foo' })); - source = new _ol_source_Vector_({ + source = new VectorSource({ features: features }); - layer = new _ol_layer_Vector_({source: source}); + layer = new VectorLayer({source: source}); map = new Map({ target: target, layers: [layer], - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 @@ -356,8 +356,8 @@ describe('ol.interaction.Select', function() { var feature = e.selected[0]; var layer_ = interaction.getLayer(feature); expect(e.selected).to.have.length(1); - expect(feature).to.be.a(_ol_Feature_); - expect(layer_).to.be.a(_ol_layer_Vector_); + expect(feature).to.be.a(Feature); + expect(layer_).to.be.a(VectorLayer); expect(layer_).to.equal(layer); }); interaction.on('select', listenerSpy); diff --git a/test/spec/ol/interaction/snap.test.js b/test/spec/ol/interaction/snap.test.js index 443a2a87aa..f8b5b48a35 100644 --- a/test/spec/ol/interaction/snap.test.js +++ b/test/spec/ol/interaction/snap.test.js @@ -1,7 +1,7 @@ import _ol_Collection_ from '../../../../src/ol/Collection.js'; -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import Circle from '../../../../src/ol/geom/Circle.js'; import Point from '../../../../src/ol/geom/Point.js'; import LineString from '../../../../src/ol/geom/LineString.js'; @@ -38,7 +38,7 @@ describe('ol.interaction.Snap', function() { map = new Map({ target: target, - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 @@ -56,7 +56,7 @@ describe('ol.interaction.Snap', function() { }); it('can handle XYZ coordinates', function() { - var point = new _ol_Feature_(new Point([0, 0, 123])); + var point = new Feature(new Point([0, 0, 123])); var snapInteraction = new _ol_interaction_Snap_({ features: new _ol_Collection_([point]) }); @@ -73,7 +73,7 @@ describe('ol.interaction.Snap', function() { }); it('snaps to edges only', function() { - var point = new _ol_Feature_(new LineString([[-10, 0], [10, 0]])); + var point = new Feature(new LineString([[-10, 0], [10, 0]])); var snapInteraction = new _ol_interaction_Snap_({ features: new _ol_Collection_([point]), pixelTolerance: 5, @@ -91,7 +91,7 @@ describe('ol.interaction.Snap', function() { }); it('snaps to vertices only', function() { - var point = new _ol_Feature_(new LineString([[-10, 0], [10, 0]])); + var point = new Feature(new LineString([[-10, 0], [10, 0]])); var snapInteraction = new _ol_interaction_Snap_({ features: new _ol_Collection_([point]), pixelTolerance: 5, @@ -109,7 +109,7 @@ describe('ol.interaction.Snap', function() { }); it('snaps to circle', function() { - var circle = new _ol_Feature_(new Circle([0, 0], 10)); + var circle = new Feature(new Circle([0, 0], 10)); var snapInteraction = new _ol_interaction_Snap_({ features: new _ol_Collection_([circle]), pixelTolerance: 5 @@ -128,7 +128,7 @@ describe('ol.interaction.Snap', function() { }); it('handle feature without geometry', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); var snapInteraction = new _ol_interaction_Snap_({ features: new _ol_Collection_([feature]), pixelTolerance: 5, @@ -148,7 +148,7 @@ describe('ol.interaction.Snap', function() { }); it('handle geometry changes', function() { - var line = new _ol_Feature_(new LineString([[-10, 0], [0, 0]])); + var line = new Feature(new LineString([[-10, 0], [0, 0]])); var snapInteraction = new _ol_interaction_Snap_({ features: new _ol_Collection_([line]), pixelTolerance: 5, @@ -168,7 +168,7 @@ describe('ol.interaction.Snap', function() { }); it('handle geometry name changes', function() { - var line = new _ol_Feature_({ + var line = new Feature({ geometry: new LineString([[-10, 0], [0, 0]]), alt_geometry: new LineString([[-10, 0], [10, 0]]) }); diff --git a/test/spec/ol/interaction/translate.test.js b/test/spec/ol/interaction/translate.test.js index e0e158aba6..4d080b44bc 100644 --- a/test/spec/ol/interaction/translate.test.js +++ b/test/spec/ol/interaction/translate.test.js @@ -1,14 +1,14 @@ import _ol_Collection_ from '../../../../src/ol/Collection.js'; -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.js'; import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import Point from '../../../../src/ol/geom/Point.js'; import _ol_interaction_Translate_ from '../../../../src/ol/interaction/Translate.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js'; -import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; +import VectorLayer from '../../../../src/ol/layer/Vector.js'; import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; describe('ol.interaction.Translate', function() { @@ -26,18 +26,18 @@ describe('ol.interaction.Translate', function() { style.width = width + 'px'; style.height = height + 'px'; document.body.appendChild(target); - source = new _ol_source_Vector_(); - features = [new _ol_Feature_({ + source = new VectorSource(); + features = [new Feature({ geometry: new Point([10, -20]) - }), new _ol_Feature_({ + }), new Feature({ geometry: new Point([20, -30]) })]; source.addFeatures(features); - var layer = new _ol_layer_Vector_({source: source}); + var layer = new VectorLayer({source: source}); map = new Map({ target: target, layers: [layer], - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 diff --git a/test/spec/ol/layer/tile.test.js b/test/spec/ol/layer/tile.test.js index cf25cb899f..df19bc7a00 100644 --- a/test/spec/ol/layer/tile.test.js +++ b/test/spec/ol/layer/tile.test.js @@ -1,5 +1,5 @@ import TileLayer from '../../../../src/ol/layer/Tile.js'; -import _ol_source_OSM_ from '../../../../src/ol/source/OSM.js'; +import OSM from '../../../../src/ol/source/OSM.js'; describe('ol.layer.Tile', function() { @@ -10,7 +10,7 @@ describe('ol.layer.Tile', function() { beforeEach(function() { layer = new TileLayer({ - source: new _ol_source_OSM_() + source: new OSM() }); }); diff --git a/test/spec/ol/layer/vector.test.js b/test/spec/ol/layer/vector.test.js index da9cfb601f..28a1de9c1a 100644 --- a/test/spec/ol/layer/vector.test.js +++ b/test/spec/ol/layer/vector.test.js @@ -1,23 +1,23 @@ import _ol_layer_Layer_ from '../../../../src/ol/layer/Layer.js'; -import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; +import VectorLayer from '../../../../src/ol/layer/Vector.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; describe('ol.layer.Vector', function() { describe('constructor', function() { - var source = new _ol_source_Vector_(); + var source = new VectorSource(); var style = new _ol_style_Style_(); it('creates a new layer', function() { - var layer = new _ol_layer_Vector_({source: source}); - expect(layer).to.be.a(_ol_layer_Vector_); + var layer = new VectorLayer({source: source}); + expect(layer).to.be.a(VectorLayer); expect(layer).to.be.a(_ol_layer_Layer_); }); it('accepts a style option with a single style', function() { - var layer = new _ol_layer_Vector_({ + var layer = new VectorLayer({ source: source, style: style }); @@ -27,7 +27,7 @@ describe('ol.layer.Vector', function() { }); it('accepts a style option with an array of styles', function() { - var layer = new _ol_layer_Vector_({ + var layer = new VectorLayer({ source: source, style: [style] }); @@ -37,7 +37,7 @@ describe('ol.layer.Vector', function() { }); it('accepts a style option with a style function', function() { - var layer = new _ol_layer_Vector_({ + var layer = new VectorLayer({ source: source, style: function(feature, resolution) { return [style]; @@ -55,8 +55,8 @@ describe('ol.layer.Vector', function() { var layer, style; beforeEach(function() { - layer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_() + layer = new VectorLayer({ + source: new VectorSource() }); style = new _ol_style_Style_(); }); @@ -97,11 +97,11 @@ describe('ol.layer.Vector', function() { describe('#getStyle()', function() { - var source = new _ol_source_Vector_(); + var source = new VectorSource(); var style = new _ol_style_Style_(); it('returns what is provided to setStyle', function() { - var layer = new _ol_layer_Vector_({ + var layer = new VectorLayer({ source: source }); diff --git a/test/spec/ol/layer/vectortile.test.js b/test/spec/ol/layer/vectortile.test.js index 060d5a3b2a..860d8237b3 100644 --- a/test/spec/ol/layer/vectortile.test.js +++ b/test/spec/ol/layer/vectortile.test.js @@ -1,5 +1,5 @@ import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; -import _ol_source_VectorTile_ from '../../../../src/ol/source/VectorTile.js'; +import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; describe('ol.layer.VectorTile', function() { @@ -10,7 +10,7 @@ describe('ol.layer.VectorTile', function() { beforeEach(function() { layer = new _ol_layer_VectorTile_({ - source: new _ol_source_VectorTile_({}) + source: new VectorTileSource({}) }); }); @@ -40,18 +40,18 @@ describe('ol.layer.VectorTile', function() { it('works with options', function() { var layer = new _ol_layer_VectorTile_({ renderMode: 'vector', - source: new _ol_source_VectorTile_({}) + source: new VectorTileSource({}) }); expect(layer.getRenderMode()).to.be('vector'); layer = new _ol_layer_VectorTile_({ renderMode: 'image', - source: new _ol_source_VectorTile_({}) + source: new VectorTileSource({}) }); expect(layer.getRenderMode()).to.be('image'); expect(function() { layer = new _ol_layer_VectorTile_({ renderMode: 'foo', - source: new _ol_source_VectorTile_({}) + source: new VectorTileSource({}) }); }).to.throwException(); }); diff --git a/test/spec/ol/map.test.js b/test/spec/ol/map.test.js index b0b3ea566f..07b8342cf1 100644 --- a/test/spec/ol/map.test.js +++ b/test/spec/ol/map.test.js @@ -1,8 +1,8 @@ -import _ol_Feature_ from '../../../src/ol/Feature.js'; +import Feature from '../../../src/ol/Feature.js'; import Map from '../../../src/ol/Map.js'; import MapEvent from '../../../src/ol/MapEvent.js'; import Overlay from '../../../src/ol/Overlay.js'; -import _ol_View_ from '../../../src/ol/View.js'; +import View from '../../../src/ol/View.js'; import LineString from '../../../src/ol/geom/LineString.js'; import _ol_has_ from '../../../src/ol/has.js'; import {defaults as defaultInteractions} from '../../../src/ol/interaction.js'; @@ -11,10 +11,10 @@ import Interaction from '../../../src/ol/interaction/Interaction.js'; import MouseWheelZoom from '../../../src/ol/interaction/MouseWheelZoom.js'; import _ol_interaction_PinchZoom_ from '../../../src/ol/interaction/PinchZoom.js'; import TileLayer from '../../../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../../../src/ol/layer/Vector.js'; +import VectorLayer from '../../../src/ol/layer/Vector.js'; import _ol_renderer_canvas_IntermediateCanvas_ from '../../../src/ol/renderer/canvas/IntermediateCanvas.js'; -import _ol_source_Vector_ from '../../../src/ol/source/Vector.js'; -import _ol_source_XYZ_ from '../../../src/ol/source/XYZ.js'; +import VectorSource from '../../../src/ol/source/Vector.js'; +import XYZ from '../../../src/ol/source/XYZ.js'; describe('ol.Map', function() { @@ -117,7 +117,7 @@ describe('ol.Map', function() { style.height = '180px'; document.body.appendChild(target); - view = new _ol_View_({ + view = new View({ projection: 'EPSG:4326' }); map = new Map({ @@ -125,7 +125,7 @@ describe('ol.Map', function() { view: view, layers: [ new TileLayer({ - source: new _ol_source_XYZ_({ + source: new XYZ({ url: '#{x}/{y}/{z}' }) }) @@ -195,12 +195,12 @@ describe('ol.Map', function() { document.body.appendChild(target); map = new Map({ target: target, - layers: [new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ - features: [new _ol_Feature_(new LineString([[-50, 0], [50, 0]]))] + layers: [new VectorLayer({ + source: new VectorSource({ + features: [new Feature(new LineString([[-50, 0], [50, 0]]))] }) })], - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 17 }) @@ -219,13 +219,13 @@ describe('ol.Map', function() { it('returns an array of found features', function() { var features = map.getFeaturesAtPixel([50, 50]); expect(features).to.be.an(Array); - expect(features[0]).to.be.an(_ol_Feature_); + expect(features[0]).to.be.an(Feature); }); it('returns an array of found features with declutter: true', function() { var layer = map.getLayers().item(0); map.removeLayer(layer); - var otherLayer = new _ol_layer_Vector_({ + var otherLayer = new VectorLayer({ declutter: true, source: layer.getSource() }); @@ -233,12 +233,12 @@ describe('ol.Map', function() { map.renderSync(); var features = map.getFeaturesAtPixel([50, 50]); expect(features).to.be.an(Array); - expect(features[0]).to.be.an(_ol_Feature_); + expect(features[0]).to.be.a(Feature); }); it('respects options', function() { - var otherLayer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_ + var otherLayer = new VectorLayer({ + source: new VectorSource }); map.addLayer(otherLayer); var features = map.getFeaturesAtPixel([50, 50], { @@ -273,19 +273,19 @@ describe('ol.Map', function() { map = new Map({ target: target, - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 1 }), layers: [ new TileLayer({ - source: new _ol_source_XYZ_() + source: new XYZ() }), new TileLayer({ - source: new _ol_source_XYZ_() + source: new XYZ() }), new TileLayer({ - source: new _ol_source_XYZ_() + source: new XYZ() }) ] }); @@ -328,7 +328,7 @@ describe('ol.Map', function() { document.body.appendChild(target); map = new Map({ target: target, - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 @@ -608,7 +608,7 @@ describe('ol.Map', function() { document.body.appendChild(target); map = new Map({ target: target, - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 diff --git a/test/spec/ol/object.test.js b/test/spec/ol/object.test.js index 379a151903..7455117e7b 100644 --- a/test/spec/ol/object.test.js +++ b/test/spec/ol/object.test.js @@ -1,4 +1,4 @@ -import _ol_Object_ from '../../../src/ol/Object.js'; +import BaseObject from '../../../src/ol/Object.js'; import _ol_events_ from '../../../src/ol/events.js'; @@ -6,7 +6,7 @@ describe('ol.Object', function() { var o; beforeEach(function() { - o = new _ol_Object_(); + o = new BaseObject(); }); describe('get, set and unset', function() { @@ -49,7 +49,7 @@ describe('ol.Object', function() { describe('#get()', function() { it('does not return values that are not explicitly set', function() { - var o = new _ol_Object_(); + var o = new BaseObject(); expect(o.get('constructor')).to.be(undefined); expect(o.get('hasOwnProperty')).to.be(undefined); expect(o.get('isPrototypeOf')).to.be(undefined); @@ -63,7 +63,7 @@ describe('ol.Object', function() { describe('#set()', function() { it('can be used with arbitrary names', function() { - var o = new _ol_Object_(); + var o = new BaseObject(); o.set('set', 'sat'); expect(o.get('set')).to.be('sat'); @@ -80,7 +80,7 @@ describe('ol.Object', function() { describe('#getKeys()', function() { it('returns property names set at construction', function() { - var o = new _ol_Object_({ + var o = new BaseObject({ prop1: 'val1', prop2: 'val2', toString: 'string', @@ -212,7 +212,7 @@ describe('ol.Object', function() { describe('create with options', function() { it('sets the property', function() { - var o = new _ol_Object_({k: 1}); + var o = new BaseObject({k: 1}); expect(o.get('k')).to.eql(1); expect(o.getKeys()).to.eql(['k']); diff --git a/test/spec/ol/observable.test.js b/test/spec/ol/observable.test.js index b750cb0a24..192fba9d1a 100644 --- a/test/spec/ol/observable.test.js +++ b/test/spec/ol/observable.test.js @@ -1,5 +1,5 @@ import EventTarget from '../../../src/ol/events/EventTarget.js'; -import _ol_Observable_ from '../../../src/ol/Observable.js'; +import Observable from '../../../src/ol/Observable.js'; describe('ol.Observable', function() { @@ -7,8 +7,8 @@ describe('ol.Observable', function() { describe('constructor', function() { it('creates a new observable', function() { - var observable = new _ol_Observable_(); - expect(observable).to.be.a(_ol_Observable_); + var observable = new Observable(); + expect(observable).to.be.a(Observable); expect(observable).to.be.a(EventTarget); }); @@ -17,7 +17,7 @@ describe('ol.Observable', function() { describe('#on()', function() { var observable, listener; beforeEach(function() { - observable = new _ol_Observable_(); + observable = new Observable(); listener = sinon.spy(); }); @@ -52,7 +52,7 @@ describe('ol.Observable', function() { describe('#once()', function() { var observable, listener; beforeEach(function() { - observable = new _ol_Observable_(); + observable = new Observable(); listener = sinon.spy(); }); @@ -108,7 +108,7 @@ describe('ol.Observable', function() { describe('#un()', function() { var observable, listener; beforeEach(function() { - observable = new _ol_Observable_(); + observable = new Observable(); listener = sinon.spy(); }); @@ -128,7 +128,7 @@ describe('ol.Observable', function() { describe('ol.Observable.unByKey()', function() { var observable, listener; beforeEach(function() { - observable = new _ol_Observable_(); + observable = new Observable(); listener = sinon.spy(); }); @@ -138,7 +138,7 @@ describe('ol.Observable', function() { observable.dispatchEvent('foo'); expect(listener.calledOnce).to.be(true); - _ol_Observable_.unByKey(key); + Observable.unByKey(key); observable.dispatchEvent('foo'); expect(listener.callCount).to.be(1); }); diff --git a/test/spec/ol/overlay.test.js b/test/spec/ol/overlay.test.js index 9c8bd619c0..1663c45a33 100644 --- a/test/spec/ol/overlay.test.js +++ b/test/spec/ol/overlay.test.js @@ -1,6 +1,6 @@ import Map from '../../../src/ol/Map.js'; import Overlay from '../../../src/ol/Overlay.js'; -import _ol_View_ from '../../../src/ol/View.js'; +import View from '../../../src/ol/View.js'; describe('ol.Overlay', function() { @@ -22,7 +22,7 @@ describe('ol.Overlay', function() { map = new Map({ target: target, - view: new _ol_View_({ + view: new View({ projection: 'EPSG:4326', center: [0, 0], resolution: 1 diff --git a/test/spec/ol/render/box.test.js b/test/spec/ol/render/box.test.js index 291aca824e..1206a2a9d9 100644 --- a/test/spec/ol/render/box.test.js +++ b/test/spec/ol/render/box.test.js @@ -1,6 +1,6 @@ import Disposable from '../../../../src/ol/Disposable.js'; import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; import _ol_render_Box_ from '../../../../src/ol/render/Box.js'; @@ -17,7 +17,7 @@ describe('ol.render.Box', function() { map = new Map({ target: target, - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 0 }) diff --git a/test/spec/ol/render/canvas/textreplay.test.js b/test/spec/ol/render/canvas/textreplay.test.js index d360fa78b4..690e65f3d0 100644 --- a/test/spec/ol/render/canvas/textreplay.test.js +++ b/test/spec/ol/render/canvas/textreplay.test.js @@ -1,4 +1,4 @@ -import _ol_Feature_ from '../../../../../src/ol/Feature.js'; +import Feature from '../../../../../src/ol/Feature.js'; import MultiPolygon from '../../../../../src/ol/geom/MultiPolygon.js'; import Polygon from '../../../../../src/ol/geom/Polygon.js'; import _ol_render_canvas_TextReplay_ from '../../../../../src/ol/render/canvas/TextReplay.js'; @@ -9,7 +9,7 @@ describe('ol.render.canvas.TextReplay', function() { it('renders polygon labels only when they fit', function() { var replay = new _ol_render_canvas_TextReplay_(1, [-180, -90, 180, 90], 0.02, 1, true); var geometry = new Polygon([[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]); - var feature = new _ol_Feature_(geometry); + var feature = new Feature(geometry); replay.setTextStyle(new _ol_style_Text_({ text: 'This is a long text' @@ -30,7 +30,7 @@ describe('ol.render.canvas.TextReplay', function() { [[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]], [[[1, 1], [1, 2], [2, 2], [2, 1], [1, 1]]] ]); - var feature = new _ol_Feature_(geometry); + var feature = new Feature(geometry); replay.setTextStyle(new _ol_style_Text_({ text: 'This is a long text' diff --git a/test/spec/ol/render/webgl/circlereplay.test.js b/test/spec/ol/render/webgl/circlereplay.test.js index 6af996410e..96463a08d8 100644 --- a/test/spec/ol/render/webgl/circlereplay.test.js +++ b/test/spec/ol/render/webgl/circlereplay.test.js @@ -1,5 +1,5 @@ import {getUid} from '../../../../../src/ol/index.js'; -import _ol_Feature_ from '../../../../../src/ol/Feature.js'; +import Feature from '../../../../../src/ol/Feature.js'; import Circle from '../../../../../src/ol/geom/Circle.js'; import _ol_render_webgl_CircleReplay_ from '../../../../../src/ol/render/webgl/CircleReplay.js'; import _ol_render_webgl_circlereplay_defaultshader_ from '../../../../../src/ol/render/webgl/circlereplay/defaultshader.js'; @@ -173,13 +173,13 @@ describe('ol.render.webgl.CircleReplay', function() { describe('#drawReplay', function() { var gl, context; - var feature1 = new _ol_Feature_({ + var feature1 = new Feature({ geometry: new Circle([0, 0], 5000) }); - var feature2 = new _ol_Feature_({ + var feature2 = new Feature({ geometry: new Circle([10, 10], 5000) }); - var feature3 = new _ol_Feature_({ + var feature3 = new Feature({ geometry: new Circle([20, 20], 5000) }); beforeEach(function() { diff --git a/test/spec/ol/render/webgl/immediate.test.js b/test/spec/ol/render/webgl/immediate.test.js index 8729a12e2a..f67ee129b0 100644 --- a/test/spec/ol/render/webgl/immediate.test.js +++ b/test/spec/ol/render/webgl/immediate.test.js @@ -1,4 +1,4 @@ -import _ol_Feature_ from '../../../../../src/ol/Feature.js'; +import Feature from '../../../../../src/ol/Feature.js'; import Circle from '../../../../../src/ol/geom/Circle.js'; import GeometryCollection from '../../../../../src/ol/geom/GeometryCollection.js'; import LineString from '../../../../../src/ol/geom/LineString.js'; @@ -47,7 +47,7 @@ describe('ol.render.webgl.Immediate', function() { describe('#drawFeature', function() { var feat; beforeEach(function() { - feat = new _ol_Feature_({ + feat = new Feature({ geometry: circle }); context.setStyle = function() {}; @@ -67,14 +67,14 @@ describe('ol.render.webgl.Immediate', function() { }); it('does nothing if no geometry is provided', function() { - feat = new _ol_Feature_(); + feat = new Feature(); context.drawFeature(feat, style); expect(context.setStyle.called).to.be(false); expect(context.drawGeometry.called).to.be(false); }); it('does nothing if geometry is out of bounds', function() { - feat = new _ol_Feature_({ + feat = new Feature({ geometry: new Circle([540, 540], 1) }); context.drawFeature(feat, style); diff --git a/test/spec/ol/render/webgl/linestringreplay.test.js b/test/spec/ol/render/webgl/linestringreplay.test.js index 477a1ab7e8..c4c954ede4 100644 --- a/test/spec/ol/render/webgl/linestringreplay.test.js +++ b/test/spec/ol/render/webgl/linestringreplay.test.js @@ -1,5 +1,5 @@ import {getUid} from '../../../../../src/ol/index.js'; -import _ol_Feature_ from '../../../../../src/ol/Feature.js'; +import Feature from '../../../../../src/ol/Feature.js'; import LineString from '../../../../../src/ol/geom/LineString.js'; import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js'; import _ol_render_webgl_LineStringReplay_ from '../../../../../src/ol/render/webgl/LineStringReplay.js'; @@ -286,13 +286,13 @@ describe('ol.render.webgl.LineStringReplay', function() { describe('#drawReplay', function() { var gl, context; - var feature1 = new _ol_Feature_({ + var feature1 = new Feature({ geometry: new LineString([[0, 0], [500, 500]]) }); - var feature2 = new _ol_Feature_({ + var feature2 = new Feature({ geometry: new LineString([[0, 0], [500, 500]]) }); - var feature3 = new _ol_Feature_({ + var feature3 = new Feature({ geometry: new LineString([[0, 0], [500, 500]]) }); beforeEach(function() { diff --git a/test/spec/ol/render/webgl/polygonreplay.test.js b/test/spec/ol/render/webgl/polygonreplay.test.js index 49af677f0f..d7fe75e5e9 100644 --- a/test/spec/ol/render/webgl/polygonreplay.test.js +++ b/test/spec/ol/render/webgl/polygonreplay.test.js @@ -1,5 +1,5 @@ import {getUid} from '../../../../../src/ol/index.js'; -import _ol_Feature_ from '../../../../../src/ol/Feature.js'; +import Feature from '../../../../../src/ol/Feature.js'; import MultiPolygon from '../../../../../src/ol/geom/MultiPolygon.js'; import Polygon from '../../../../../src/ol/geom/Polygon.js'; import _ol_render_webgl_PolygonReplay_ from '../../../../../src/ol/render/webgl/PolygonReplay.js'; @@ -395,13 +395,13 @@ describe('ol.render.webgl.PolygonReplay', function() { describe('#drawReplay', function() { var gl, context; - var feature1 = new _ol_Feature_({ + var feature1 = new Feature({ geometry: new Polygon([[[0, 0], [500, 500], [500, 0], [0, 0]]]) }); - var feature2 = new _ol_Feature_({ + var feature2 = new Feature({ geometry: new Polygon([[[0, 0], [500, 500], [500, 0], [0, 0]]]) }); - var feature3 = new _ol_Feature_({ + var feature3 = new Feature({ geometry: new Polygon([[[0, 0], [500, 500], [500, 0], [0, 0]]]) }); beforeEach(function() { diff --git a/test/spec/ol/renderer/canvas/imagelayer.test.js b/test/spec/ol/renderer/canvas/imagelayer.test.js index 17bd6e6ec1..64ae4723ec 100644 --- a/test/spec/ol/renderer/canvas/imagelayer.test.js +++ b/test/spec/ol/renderer/canvas/imagelayer.test.js @@ -1,8 +1,8 @@ import Map from '../../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../../src/ol/View.js'; -import _ol_layer_Image_ from '../../../../../src/ol/layer/Image.js'; +import View from '../../../../../src/ol/View.js'; +import ImageLayer from '../../../../../src/ol/layer/Image.js'; import _ol_proj_Projection_ from '../../../../../src/ol/proj/Projection.js'; -import _ol_source_ImageStatic_ from '../../../../../src/ol/source/ImageStatic.js'; +import Static from '../../../../../src/ol/source/ImageStatic.js'; describe('ol.renderer.canvas.ImageLayer', function() { @@ -20,7 +20,7 @@ describe('ol.renderer.canvas.ImageLayer', function() { target.style.width = '100px'; target.style.height = '100px'; document.body.appendChild(target); - source = new _ol_source_ImageStatic_({ + source = new Static({ url: 'spec/ol/data/dot.png', projection: projection, imageExtent: [0, 0, 20, 20] @@ -28,10 +28,10 @@ describe('ol.renderer.canvas.ImageLayer', function() { map = new Map({ pixelRatio: 1, target: target, - layers: [new _ol_layer_Image_({ + layers: [new ImageLayer({ source: source })], - view: new _ol_View_({ + view: new View({ projection: projection, center: [10, 10], zoom: 2, diff --git a/test/spec/ol/renderer/canvas/intermediatecanvas.test.js b/test/spec/ol/renderer/canvas/intermediatecanvas.test.js index cb6c94eefc..b138d8c5d8 100644 --- a/test/spec/ol/renderer/canvas/intermediatecanvas.test.js +++ b/test/spec/ol/renderer/canvas/intermediatecanvas.test.js @@ -1,5 +1,5 @@ import _ol_transform_ from '../../../../../src/ol/transform.js'; -import _ol_layer_Image_ from '../../../../../src/ol/layer/Image.js'; +import ImageLayer from '../../../../../src/ol/layer/Image.js'; import _ol_renderer_Map_ from '../../../../../src/ol/renderer/Map.js'; import _ol_renderer_canvas_IntermediateCanvas_ from '../../../../../src/ol/renderer/canvas/IntermediateCanvas.js'; @@ -9,7 +9,7 @@ describe('ol.renderer.canvas.IntermediateCanvas', function() { describe('#composeFrame()', function() { var renderer, frameState, layerState, context; beforeEach(function() { - var layer = new _ol_layer_Image_({ + var layer = new ImageLayer({ extent: [1, 2, 3, 4] }); renderer = new _ol_renderer_canvas_IntermediateCanvas_(layer); diff --git a/test/spec/ol/renderer/canvas/map.test.js b/test/spec/ol/renderer/canvas/map.test.js index 4ec1266a8a..f5e5ca787c 100644 --- a/test/spec/ol/renderer/canvas/map.test.js +++ b/test/spec/ol/renderer/canvas/map.test.js @@ -1,13 +1,13 @@ import {getUid} from '../../../../../src/ol/index.js'; -import _ol_Feature_ from '../../../../../src/ol/Feature.js'; +import Feature from '../../../../../src/ol/Feature.js'; import Map from '../../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../../src/ol/View.js'; +import View from '../../../../../src/ol/View.js'; import Point from '../../../../../src/ol/geom/Point.js'; import TileLayer from '../../../../../src/ol/layer/Tile.js'; -import _ol_layer_Vector_ from '../../../../../src/ol/layer/Vector.js'; +import VectorLayer from '../../../../../src/ol/layer/Vector.js'; import _ol_renderer_canvas_Layer_ from '../../../../../src/ol/renderer/canvas/Layer.js'; -import _ol_renderer_canvas_Map_ from '../../../../../src/ol/renderer/canvas/Map.js'; -import _ol_source_Vector_ from '../../../../../src/ol/source/Vector.js'; +import CanvasMapRenderer from '../../../../../src/ol/renderer/canvas/Map.js'; +import VectorSource from '../../../../../src/ol/source/Vector.js'; import _ol_style_Icon_ from '../../../../../src/ol/style/Icon.js'; import _ol_style_Style_ from '../../../../../src/ol/style/Style.js'; @@ -19,8 +19,8 @@ describe('ol.renderer.canvas.Map', function() { var map = new Map({ target: document.createElement('div') }); - var renderer = new _ol_renderer_canvas_Map_(map.viewport_, map); - expect(renderer).to.be.a(_ol_renderer_canvas_Map_); + var renderer = new CanvasMapRenderer(map.viewport_, map); + expect(renderer).to.be.a(CanvasMapRenderer); }); }); @@ -37,7 +37,7 @@ describe('ol.renderer.canvas.Map', function() { map = new Map({ pixelRatio: 1, target: target, - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 0 }) @@ -50,10 +50,10 @@ describe('ol.renderer.canvas.Map', function() { }; img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVR4nGNiAAAABgADNjd8qAAAAABJRU5ErkJggg=='; - layer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ + layer = new VectorLayer({ + source: new VectorSource({ features: [ - new _ol_Feature_({ + new Feature({ geometry: new Point([0, 0]) }) ] @@ -92,8 +92,8 @@ describe('ol.renderer.canvas.Map', function() { it('calls callback with main layer when skipped feature on unmanaged layer', function() { var feature = layer.getSource().getFeatures()[0]; - var managedLayer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ + var managedLayer = new VectorLayer({ + source: new VectorSource({ features: [feature] }) }); @@ -169,8 +169,8 @@ describe('ol.renderer.canvas.Map', function() { beforeEach(function() { map = new Map({}); map.on('postcompose', function() {}); - layer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({wrapX: true}) + layer = new VectorLayer({ + source: new VectorSource({wrapX: true}) }); renderer = map.getRenderer(); renderer.layerRenderers_ = {}; diff --git a/test/spec/ol/renderer/canvas/replay.test.js b/test/spec/ol/renderer/canvas/replay.test.js index 9a074f5833..2f52a0dc85 100644 --- a/test/spec/ol/renderer/canvas/replay.test.js +++ b/test/spec/ol/renderer/canvas/replay.test.js @@ -1,5 +1,5 @@ import {getUid} from '../../../../../src/ol/index.js'; -import _ol_Feature_ from '../../../../../src/ol/Feature.js'; +import Feature from '../../../../../src/ol/Feature.js'; import GeometryCollection from '../../../../../src/ol/geom/GeometryCollection.js'; import LineString from '../../../../../src/ol/geom/LineString.js'; import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js'; @@ -29,13 +29,13 @@ describe('ol.render.canvas.ReplayGroup', function() { beforeEach(function() { transform = _ol_transform_.create(); replay = new _ol_render_canvas_ReplayGroup_(1, [-180, -90, 180, 90], 1, 1, false); - feature0 = new _ol_Feature_(new Polygon( + feature0 = new Feature(new Polygon( [[[-90, 0], [-45, 45], [0, 0], [1, 1], [0, -45], [-90, 0]]])); - feature1 = new _ol_Feature_(new Polygon( + feature1 = new Feature(new Polygon( [[[-90, -45], [-90, 0], [0, 0], [0, -45], [-90, -45]]])); - feature2 = new _ol_Feature_(new Polygon( + feature2 = new Feature(new Polygon( [[[90, 45], [90, 0], [0, 0], [0, 45], [90, 45]]])); - feature3 = new _ol_Feature_(new Polygon( + feature3 = new Feature(new Polygon( [[[-90, -45], [-90, 45], [90, 45], [90, -45], [-90, -45]]])); fill0 = new _ol_style_Style_({ fill: new _ol_style_Fill_({color: 'black'}) @@ -229,17 +229,17 @@ describe('ol.render.canvas.ReplayGroup', function() { }); } }); - var point = new _ol_Feature_(new Point([45, 90])); - var multipoint = new _ol_Feature_(new MultiPoint( + var point = new Feature(new Point([45, 90])); + var multipoint = new Feature(new MultiPoint( [[45, 90], [90, 45]])); - var linestring = new _ol_Feature_(new LineString( + var linestring = new Feature(new LineString( [[45, 90], [45, 45], [90, 45]])); - var multilinestring = new _ol_Feature_(new MultiLineString( + var multilinestring = new Feature(new MultiLineString( [linestring.getGeometry().getCoordinates(), linestring.getGeometry().getCoordinates()])); var polygon = feature1; - var multipolygon = new _ol_Feature_(new MultiPolygon( + var multipolygon = new Feature(new MultiPolygon( [polygon.getGeometry().getCoordinates(), polygon.getGeometry().getCoordinates()])); - var geometrycollection = new _ol_Feature_(new GeometryCollection( + var geometrycollection = new Feature(new GeometryCollection( [point.getGeometry(), linestring.getGeometry(), polygon.getGeometry()])); replay = new _ol_render_canvas_ReplayGroup_(1, [-180, -90, 180, 90], 1, 1, true); _ol_renderer_vector_.renderFeature(replay, point, style, 1); diff --git a/test/spec/ol/renderer/canvas/tilelayer.test.js b/test/spec/ol/renderer/canvas/tilelayer.test.js index f8bcd02453..7c1b5d3fc3 100644 --- a/test/spec/ol/renderer/canvas/tilelayer.test.js +++ b/test/spec/ol/renderer/canvas/tilelayer.test.js @@ -1,11 +1,11 @@ import Map from '../../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../../src/ol/View.js'; +import View from '../../../../../src/ol/View.js'; import TileLayer from '../../../../../src/ol/layer/Tile.js'; import {get as getProjection} from '../../../../../src/ol/proj.js'; import _ol_renderer_Map_ from '../../../../../src/ol/renderer/Map.js'; -import _ol_renderer_canvas_TileLayer_ from '../../../../../src/ol/renderer/canvas/TileLayer.js'; -import _ol_source_TileWMS_ from '../../../../../src/ol/source/TileWMS.js'; -import _ol_source_XYZ_ from '../../../../../src/ol/source/XYZ.js'; +import CanvasTileLayerRenderer from '../../../../../src/ol/renderer/canvas/TileLayer.js'; +import TileWMS from '../../../../../src/ol/source/TileWMS.js'; +import XYZ from '../../../../../src/ol/source/XYZ.js'; import _ol_transform_ from '../../../../../src/ol/transform.js'; @@ -19,7 +19,7 @@ describe('ol.renderer.canvas.TileLayer', function() { target.style.width = '100px'; target.style.height = '100px'; document.body.appendChild(target); - source = new _ol_source_TileWMS_({ + source = new TileWMS({ url: 'spec/ol/data/osm-0-0-0.png', params: {LAYERS: 'foo', TIME: '0'} }); @@ -32,7 +32,7 @@ describe('ol.renderer.canvas.TileLayer', function() { layers: [new TileLayer({ source: source })], - view: new _ol_View_({ + view: new View({ zoom: 0, center: [0, 0] }) @@ -71,11 +71,11 @@ describe('ol.renderer.canvas.TileLayer', function() { it('uses correct draw scale when rotating (HiDPI)', function() { var layer = new TileLayer({ - source: new _ol_source_XYZ_({ + source: new XYZ({ tileSize: 1 }) }); - var renderer = new _ol_renderer_canvas_TileLayer_(layer); + var renderer = new CanvasTileLayerRenderer(layer); renderer.renderedTiles = []; var frameState = { viewHints: [], diff --git a/test/spec/ol/renderer/canvas/vectorlayer.test.js b/test/spec/ol/renderer/canvas/vectorlayer.test.js index 8444fa83ac..4d393b4c09 100644 --- a/test/spec/ol/renderer/canvas/vectorlayer.test.js +++ b/test/spec/ol/renderer/canvas/vectorlayer.test.js @@ -1,15 +1,15 @@ import {getUid} from '../../../../../src/ol/index.js'; -import _ol_Feature_ from '../../../../../src/ol/Feature.js'; +import Feature from '../../../../../src/ol/Feature.js'; import Map from '../../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../../src/ol/View.js'; +import View from '../../../../../src/ol/View.js'; import * as _ol_extent_ from '../../../../../src/ol/extent.js'; import Point from '../../../../../src/ol/geom/Point.js'; -import _ol_layer_Vector_ from '../../../../../src/ol/layer/Vector.js'; +import VectorLayer from '../../../../../src/ol/layer/Vector.js'; import _ol_obj_ from '../../../../../src/ol/obj.js'; import {get as getProjection} from '../../../../../src/ol/proj.js'; import _ol_render_canvas_ from '../../../../../src/ol/render/canvas.js'; -import _ol_renderer_canvas_VectorLayer_ from '../../../../../src/ol/renderer/canvas/VectorLayer.js'; -import _ol_source_Vector_ from '../../../../../src/ol/source/Vector.js'; +import CanvasVectorLayerRenderer from '../../../../../src/ol/renderer/canvas/VectorLayer.js'; +import VectorSource from '../../../../../src/ol/source/Vector.js'; import _ol_style_Style_ from '../../../../../src/ol/style/Style.js'; import _ol_style_Text_ from '../../../../../src/ol/style/Text.js'; @@ -37,11 +37,11 @@ describe('ol.renderer.canvas.VectorLayer', function() { }); it('creates a new instance', function() { - var layer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_() + var layer = new VectorLayer({ + source: new VectorSource() }); - var renderer = new _ol_renderer_canvas_VectorLayer_(layer); - expect(renderer).to.be.a(_ol_renderer_canvas_VectorLayer_); + var renderer = new CanvasVectorLayerRenderer(layer); + expect(renderer).to.be.a(CanvasVectorLayerRenderer); }); it('gives precedence to feature styles over layer styles', function() { @@ -50,7 +50,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { target.style.height = '256px'; document.body.appendChild(target); var map = new Map({ - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 0 }), @@ -66,11 +66,11 @@ describe('ol.renderer.canvas.VectorLayer', function() { text: 'feature' }) })]; - var feature1 = new _ol_Feature_(new Point([0, 0])); - var feature2 = new _ol_Feature_(new Point([0, 0])); + var feature1 = new Feature(new Point([0, 0])); + var feature2 = new Feature(new Point([0, 0])); feature2.setStyle(featureStyle); - var layer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ + var layer = new VectorLayer({ + source: new VectorSource({ features: [feature1, feature2] }), style: layerStyle @@ -87,7 +87,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { it('does not re-render for unavailable fonts', function(done) { _ol_obj_.clear(_ol_render_canvas_.checkedFonts_); var map = new Map({ - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 0 }), @@ -100,9 +100,9 @@ describe('ol.renderer.canvas.VectorLayer', function() { }) }); - var feature = new _ol_Feature_(new Point([0, 0])); - var layer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ + var feature = new Feature(new Point([0, 0])); + var layer = new VectorLayer({ + source: new VectorSource({ features: [feature] }), style: layerStyle @@ -118,7 +118,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { it('does not re-render for available fonts', function(done) { _ol_obj_.clear(_ol_render_canvas_.checkedFonts_); var map = new Map({ - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 0 }), @@ -131,9 +131,9 @@ describe('ol.renderer.canvas.VectorLayer', function() { }) }); - var feature = new _ol_Feature_(new Point([0, 0])); - var layer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ + var feature = new Feature(new Point([0, 0])); + var layer = new VectorLayer({ + source: new VectorSource({ features: [feature] }), style: layerStyle @@ -150,7 +150,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { _ol_obj_.clear(_ol_render_canvas_.checkedFonts_); head.appendChild(font); var map = new Map({ - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 0 }), @@ -163,9 +163,9 @@ describe('ol.renderer.canvas.VectorLayer', function() { }) }); - var feature = new _ol_Feature_(new Point([0, 0])); - var layer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({ + var feature = new Feature(new Point([0, 0])); + var layer = new VectorLayer({ + source: new VectorSource({ features: [feature] }), style: layerStyle @@ -185,15 +185,15 @@ describe('ol.renderer.canvas.VectorLayer', function() { var layer, renderer; beforeEach(function() { - layer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_() + layer = new VectorLayer({ + source: new VectorSource() }); - renderer = new _ol_renderer_canvas_VectorLayer_(layer); + renderer = new CanvasVectorLayerRenderer(layer); var replayGroup = {}; renderer.replayGroup_ = replayGroup; replayGroup.forEachFeatureAtCoordinate = function(coordinate, resolution, rotation, hitTolerance, skippedFeaturesUids, callback) { - var feature = new _ol_Feature_(); + var feature = new Feature(); callback(feature); callback(feature); }; @@ -222,10 +222,10 @@ describe('ol.renderer.canvas.VectorLayer', function() { var frameState, projExtent, renderer, worldWidth, buffer; beforeEach(function() { - var layer = new _ol_layer_Vector_({ - source: new _ol_source_Vector_({wrapX: true}) + var layer = new VectorLayer({ + source: new VectorSource({wrapX: true}) }); - renderer = new _ol_renderer_canvas_VectorLayer_(layer); + renderer = new CanvasVectorLayerRenderer(layer); var projection = getProjection('EPSG:3857'); projExtent = projection.getExtent(); worldWidth = _ol_extent_.getWidth(projExtent); diff --git a/test/spec/ol/renderer/canvas/vectortilelayer.test.js b/test/spec/ol/renderer/canvas/vectortilelayer.test.js index 2969902dba..666c809aef 100644 --- a/test/spec/ol/renderer/canvas/vectortilelayer.test.js +++ b/test/spec/ol/renderer/canvas/vectortilelayer.test.js @@ -1,11 +1,11 @@ import {getUid, inherits} from '../../../../../src/ol/index.js'; import _ol_obj_ from '../../../../../src/ol/obj.js'; -import _ol_Feature_ from '../../../../../src/ol/Feature.js'; +import Feature from '../../../../../src/ol/Feature.js'; import Map from '../../../../../src/ol/Map.js'; import TileState from '../../../../../src/ol/TileState.js'; import VectorImageTile from '../../../../../src/ol/VectorImageTile.js'; import VectorTile from '../../../../../src/ol/VectorTile.js'; -import _ol_View_ from '../../../../../src/ol/View.js'; +import View from '../../../../../src/ol/View.js'; import * as _ol_extent_ from '../../../../../src/ol/extent.js'; import MVT from '../../../../../src/ol/format/MVT.js'; import Point from '../../../../../src/ol/geom/Point.js'; @@ -14,8 +14,8 @@ import {get as getProjection, fromLonLat} from '../../../../../src/ol/proj.js'; import _ol_proj_Projection_ from '../../../../../src/ol/proj/Projection.js'; import _ol_render_canvas_ from '../../../../../src/ol/render/canvas.js'; import _ol_render_Feature_ from '../../../../../src/ol/render/Feature.js'; -import _ol_renderer_canvas_VectorTileLayer_ from '../../../../../src/ol/renderer/canvas/VectorTileLayer.js'; -import _ol_source_VectorTile_ from '../../../../../src/ol/source/VectorTile.js'; +import CanvasVectorTileLayerRenderer from '../../../../../src/ol/renderer/canvas/VectorTileLayer.js'; +import VectorTileSource from '../../../../../src/ol/source/VectorTile.js'; import _ol_style_Style_ from '../../../../../src/ol/style/Style.js'; import _ol_style_Text_ from '../../../../../src/ol/style/Text.js'; import _ol_tilegrid_ from '../../../../../src/ol/tilegrid.js'; @@ -39,7 +39,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { target.style.height = '256px'; document.body.appendChild(target); map = new Map({ - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 0 }), @@ -55,8 +55,8 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { text: 'feature' }) })]; - feature1 = new _ol_Feature_(new Point([1, -1])); - feature2 = new _ol_Feature_(new Point([0, 0])); + feature1 = new Feature(new Point([1, -1])); + feature2 = new Feature(new Point([0, 0])); feature3 = new _ol_render_Feature_('Point', [1, -1], []); feature2.setStyle(featureStyle); var TileClass = function() { @@ -67,13 +67,13 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { tileCallback(this); }; inherits(TileClass, VectorTile); - source = new _ol_source_VectorTile_({ + source = new VectorTileSource({ format: new MVT(), tileClass: TileClass, tileGrid: _ol_tilegrid_.createXYZ() }); source.getTile = function() { - var tile = _ol_source_VectorTile_.prototype.getTile.apply(source, arguments); + var tile = VectorTileSource.prototype.getTile.apply(source, arguments); tile.setState(TileState.LOADED); return tile; }; @@ -90,20 +90,20 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { }); it('creates a new instance', function() { - var renderer = new _ol_renderer_canvas_VectorTileLayer_(layer); - expect(renderer).to.be.a(_ol_renderer_canvas_VectorTileLayer_); + var renderer = new CanvasVectorTileLayerRenderer(layer); + expect(renderer).to.be.a(CanvasVectorTileLayerRenderer); expect(renderer.zDirection).to.be(0); }); it('uses lower resolution for pure vector rendering', function() { layer.renderMode_ = 'vector'; - var renderer = new _ol_renderer_canvas_VectorTileLayer_(layer); + var renderer = new CanvasVectorTileLayerRenderer(layer); expect(renderer.zDirection).to.be(1); }); it('does not render images for pure vector rendering', function() { layer.renderMode_ = 'vector'; - var spy = sinon.spy(_ol_renderer_canvas_VectorTileLayer_.prototype, + var spy = sinon.spy(CanvasVectorTileLayerRenderer.prototype, 'renderTileImage_'); map.renderSync(); expect(spy.callCount).to.be(0); @@ -112,7 +112,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { it('does not render replays for pure image rendering', function() { layer.renderMode_ = 'image'; - var spy = sinon.spy(_ol_renderer_canvas_VectorTileLayer_.prototype, + var spy = sinon.spy(CanvasVectorTileLayerRenderer.prototype, 'getTransform'); map.renderSync(); expect(spy.callCount).to.be(0); @@ -120,9 +120,9 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { }); it('renders both replays and images for hybrid rendering', function() { - var spy1 = sinon.spy(_ol_renderer_canvas_VectorTileLayer_.prototype, + var spy1 = sinon.spy(CanvasVectorTileLayerRenderer.prototype, 'getTransform'); - var spy2 = sinon.spy(_ol_renderer_canvas_VectorTileLayer_.prototype, + var spy2 = sinon.spy(CanvasVectorTileLayerRenderer.prototype, 'renderTileImage_'); map.renderSync(); expect(spy1.callCount).to.be(1); @@ -136,7 +136,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { layer.setStyle(new _ol_style_Style_({ renderer: function() {} })); - var spy = sinon.spy(_ol_renderer_canvas_VectorTileLayer_.prototype, + var spy = sinon.spy(CanvasVectorTileLayerRenderer.prototype, 'getTransform'); map.renderSync(); expect(spy.callCount).to.be(1); @@ -240,7 +240,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { describe('#prepareFrame', function() { it('re-renders when layer changed', function() { var layer = new _ol_layer_VectorTile_({ - source: new _ol_source_VectorTile_({ + source: new VectorTileSource({ tileGrid: _ol_tilegrid_.createXYZ(), transition: 0 }) @@ -261,7 +261,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { layer.getSource().getTile = function() { return tile; }; - var renderer = new _ol_renderer_canvas_VectorTileLayer_(layer); + var renderer = new CanvasVectorTileLayerRenderer(layer); renderer.renderTileImage_ = sinon.spy(); var proj = getProjection('EPSG:3857'); var frameState = { @@ -309,15 +309,15 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { beforeEach(function() { replayGroup = {}; layer = new _ol_layer_VectorTile_({ - source: new _ol_source_VectorTile_({ + source: new VectorTileSource({ tileClass: TileClass, tileGrid: _ol_tilegrid_.createXYZ() }) }); - renderer = new _ol_renderer_canvas_VectorTileLayer_(layer); + renderer = new CanvasVectorTileLayerRenderer(layer); replayGroup.forEachFeatureAtCoordinate = function(coordinate, resolution, rotation, hitTolerance, skippedFeaturesUids, callback) { - var feature = new _ol_Feature_(); + var feature = new Feature(); callback(feature); callback(feature); }; @@ -349,7 +349,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { target.style.height = '100px'; document.body.appendChild(target); var extent = [1824704.739223726, 6141868.096770482, 1827150.7241288517, 6144314.081675608]; - var source = new _ol_source_VectorTile_({ + var source = new VectorTileSource({ format: new MVT(), url: 'spec/ol/data/14-8938-5680.vector.pbf', minZoom: 14, @@ -363,7 +363,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { source: source }) ], - view: new _ol_View_({ + view: new View({ center: _ol_extent_.getCenter(extent), zoom: 19 }) diff --git a/test/spec/ol/renderer/layer.test.js b/test/spec/ol/renderer/layer.test.js index 3a9a936850..bc1883a325 100644 --- a/test/spec/ol/renderer/layer.test.js +++ b/test/spec/ol/renderer/layer.test.js @@ -1,10 +1,10 @@ import _ol_Image_ from '../../../../src/ol/Image.js'; import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import _ol_layer_Layer_ from '../../../../src/ol/layer/Layer.js'; import TileLayer from '../../../../src/ol/layer/Tile.js'; import _ol_renderer_Layer_ from '../../../../src/ol/renderer/Layer.js'; -import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js'; +import XYZ from '../../../../src/ol/source/XYZ.js'; import _ol_tilecoord_ from '../../../../src/ol/tilecoord.js'; @@ -98,12 +98,12 @@ describe('ol.renderer.Layer', function() { }); document.body.appendChild(target); - view = new _ol_View_({ + view = new View({ center: [0, 0], zoom: 0 }); - source = new _ol_source_XYZ_({ + source = new XYZ({ url: '#{x}/{y}/{z}' }); diff --git a/test/spec/ol/renderer/vector.test.js b/test/spec/ol/renderer/vector.test.js index 4dfb682b25..e0434fa402 100644 --- a/test/spec/ol/renderer/vector.test.js +++ b/test/spec/ol/renderer/vector.test.js @@ -12,7 +12,7 @@ import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; describe('ol.renderer.vector', function() { @@ -23,7 +23,7 @@ describe('ol.renderer.vector', function() { beforeEach(function() { replayGroup = new _ol_render_canvas_ReplayGroup_(1); - feature = new _ol_Feature_(); + feature = new Feature(); iconStyle = new _ol_style_Icon_({ src: 'http://example.com/icon.png' }); diff --git a/test/spec/ol/renderer/webgl/imagelayer.test.js b/test/spec/ol/renderer/webgl/imagelayer.test.js index 684f1667be..3ce5d6f0f1 100644 --- a/test/spec/ol/renderer/webgl/imagelayer.test.js +++ b/test/spec/ol/renderer/webgl/imagelayer.test.js @@ -1,8 +1,8 @@ import _ol_transform_ from '../../../../../src/ol/transform.js'; import Map from '../../../../../src/ol/Map.js'; -import _ol_layer_Image_ from '../../../../../src/ol/layer/Image.js'; -import _ol_source_Image_ from '../../../../../src/ol/source/Image.js'; -import _ol_renderer_webgl_ImageLayer_ from '../../../../../src/ol/renderer/webgl/ImageLayer.js'; +import ImageLayer from '../../../../../src/ol/layer/Image.js'; +import ImageSource from '../../../../../src/ol/source/Image.js'; +import WebGLImageLayerRenderer from '../../../../../src/ol/renderer/webgl/ImageLayer.js'; describe('ol.renderer.webgl.ImageLayer', function() { @@ -21,12 +21,12 @@ describe('ol.renderer.webgl.ImageLayer', function() { map = new Map({ target: document.createElement('div') }); - var layer = new _ol_layer_Image_({ - source: new _ol_source_Image_({ + var layer = new ImageLayer({ + source: new ImageSource({ extent: [0, 0, 1, 1] }) }); - renderer = new _ol_renderer_webgl_ImageLayer_(map.renderer_, layer); + renderer = new WebGLImageLayerRenderer(map.renderer_, layer); // input params canvasWidth = 512; diff --git a/test/spec/ol/resolutionconstraint.test.js b/test/spec/ol/resolutionconstraint.test.js index 139f754e22..97e5a4daf9 100644 --- a/test/spec/ol/resolutionconstraint.test.js +++ b/test/spec/ol/resolutionconstraint.test.js @@ -1,4 +1,4 @@ -import _ol_ResolutionConstraint_ from '../../../src/ol/ResolutionConstraint.js'; +import ResolutionConstraint from '../../../src/ol/ResolutionConstraint.js'; describe('ol.ResolutionConstraint', function() { @@ -8,7 +8,7 @@ describe('ol.ResolutionConstraint', function() { var resolutionConstraint; beforeEach(function() { - resolutionConstraint = _ol_ResolutionConstraint_.createSnapToResolutions( + resolutionConstraint = ResolutionConstraint.createSnapToResolutions( [1000, 500, 250, 100]); }); @@ -46,7 +46,7 @@ describe('ol.ResolutionConstraint', function() { beforeEach(function() { resolutionConstraint = - _ol_ResolutionConstraint_.createSnapToResolutions( + ResolutionConstraint.createSnapToResolutions( [1000, 500, 250, 100]); }); @@ -96,7 +96,7 @@ describe('ol.ResolutionConstraint', function() { beforeEach(function() { resolutionConstraint = - _ol_ResolutionConstraint_.createSnapToPower(2, 1024, 10); + ResolutionConstraint.createSnapToPower(2, 1024, 10); }); describe('delta 0', function() { @@ -154,7 +154,7 @@ describe('ol.ResolutionConstraint', function() { beforeEach(function() { resolutionConstraint = - _ol_ResolutionConstraint_.createSnapToPower(2, 1024, 10); + ResolutionConstraint.createSnapToPower(2, 1024, 10); }); describe('delta 0, direction 0', function() { diff --git a/test/spec/ol/rotationconstraint.test.js b/test/spec/ol/rotationconstraint.test.js index 5c0d7b0be3..9a50e427e1 100644 --- a/test/spec/ol/rotationconstraint.test.js +++ b/test/spec/ol/rotationconstraint.test.js @@ -1,4 +1,4 @@ -import _ol_RotationConstraint_ from '../../../src/ol/RotationConstraint.js'; +import RotationConstraint from '../../../src/ol/RotationConstraint.js'; describe('ol.RotationConstraint', function() { @@ -6,7 +6,7 @@ describe('ol.RotationConstraint', function() { describe('SnapToZero', function() { it('returns expected rotation value', function() { - var rotationConstraint = _ol_RotationConstraint_.createSnapToZero(0.3); + var rotationConstraint = RotationConstraint.createSnapToZero(0.3); expect(rotationConstraint(0.1, 0)).to.eql(0); expect(rotationConstraint(0.2, 0)).to.eql(0); diff --git a/test/spec/ol/source/bingmaps.test.js b/test/spec/ol/source/bingmaps.test.js index 04a9a7d6e2..bae2cf07b3 100644 --- a/test/spec/ol/source/bingmaps.test.js +++ b/test/spec/ol/source/bingmaps.test.js @@ -1,7 +1,7 @@ import _ol_net_ from '../../../../src/ol/net.js'; -import _ol_source_BingMaps_ from '../../../../src/ol/source/BingMaps.js'; +import BingMaps from '../../../../src/ol/source/BingMaps.js'; import _ol_tilecoord_ from '../../../../src/ol/tilecoord.js'; -import _ol_Observable_ from '../../../../src/ol/Observable.js'; +import Observable from '../../../../src/ol/Observable.js'; describe('ol.source.BingMaps', function() { @@ -21,14 +21,14 @@ describe('ol.source.BingMaps', function() { }; client.send(); }; - source = new _ol_source_BingMaps_({ + source = new BingMaps({ imagerySet: 'AerialWithLabels', key: '' }); _ol_net_.jsonp = olNetJsonp; var key = source.on('change', function() { if (source.getState() === 'ready') { - _ol_Observable_.unByKey(key); + Observable.unByKey(key); tileGrid = source.getTileGrid(); done(); } diff --git a/test/spec/ol/source/cartodb.test.js b/test/spec/ol/source/cartodb.test.js index 635a5dbdbf..6b8ec2555a 100644 --- a/test/spec/ol/source/cartodb.test.js +++ b/test/spec/ol/source/cartodb.test.js @@ -1,16 +1,16 @@ -import _ol_source_CartoDB_ from '../../../../src/ol/source/CartoDB.js'; -import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js'; +import CartoDB from '../../../../src/ol/source/CartoDB.js'; +import XYZ from '../../../../src/ol/source/XYZ.js'; describe('ol.source.CartoDB', function() { describe('constructor', function() { it('returns a CartoDB source', function() { - var source = new _ol_source_CartoDB_({ + var source = new CartoDB({ account: 'documentation', config: {} }); - expect(source).to.be.a(_ol_source_XYZ_); - expect(source).to.be.a(_ol_source_CartoDB_); + expect(source).to.be.a(XYZ); + expect(source).to.be.a(CartoDB); }); }); }); diff --git a/test/spec/ol/source/cluster.test.js b/test/spec/ol/source/cluster.test.js index 0034b10990..4274e4d016 100644 --- a/test/spec/ol/source/cluster.test.js +++ b/test/spec/ol/source/cluster.test.js @@ -1,22 +1,22 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import Point from '../../../../src/ol/geom/Point.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; -import _ol_source_Cluster_ from '../../../../src/ol/source/Cluster.js'; +import Cluster from '../../../../src/ol/source/Cluster.js'; import Source from '../../../../src/ol/source/Source.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; describe('ol.source.Cluster', function() { describe('constructor', function() { it('returns a cluster source', function() { - var source = new _ol_source_Cluster_({ + var source = new Cluster({ projection: getProjection('EPSG:4326'), - source: new _ol_source_Vector_() + source: new VectorSource() }); expect(source).to.be.a(Source); - expect(source).to.be.a(_ol_source_Cluster_); + expect(source).to.be.a(Cluster); expect(source.getDistance()).to.be(20); }); }); @@ -25,11 +25,11 @@ describe('ol.source.Cluster', function() { var extent = [-1, -1, 1, 1]; var projection = getProjection('EPSG:3857'); it('clusters a source with point features', function() { - var source = new _ol_source_Cluster_({ - source: new _ol_source_Vector_({ + var source = new Cluster({ + source: new VectorSource({ features: [ - new _ol_Feature_(new Point([0, 0])), - new _ol_Feature_(new Point([0, 0])) + new Feature(new Point([0, 0])), + new Feature(new Point([0, 0])) ] }) }); @@ -38,7 +38,7 @@ describe('ol.source.Cluster', function() { expect(source.getFeatures()[0].get('features').length).to.be(2); }); it('clusters with a custom geometryFunction', function() { - var source = new _ol_source_Cluster_({ + var source = new Cluster({ geometryFunction: function(feature) { var geom = feature.getGeometry(); if (geom.getType() == 'Point') { @@ -48,11 +48,11 @@ describe('ol.source.Cluster', function() { } return null; }, - source: new _ol_source_Vector_({ + source: new VectorSource({ features: [ - new _ol_Feature_(new Point([0, 0])), - new _ol_Feature_(new LineString([[0, 0], [1, 1]])), - new _ol_Feature_(new Polygon( + new Feature(new Point([0, 0])), + new Feature(new LineString([[0, 0], [1, 1]])), + new Feature(new Polygon( [[[-1, -1], [-1, 1], [1, 1], [1, -1], [-1, -1]]])) ] }) @@ -65,9 +65,9 @@ describe('ol.source.Cluster', function() { describe('#setDistance', function() { it('changes the distance value', function() { - var source = new _ol_source_Cluster_({ + var source = new Cluster({ distance: 100, - source: new _ol_source_Vector_() + source: new VectorSource() }); expect(source.getDistance()).to.be(100); source.setDistance(10); diff --git a/test/spec/ol/source/imagearcgisrest.test.js b/test/spec/ol/source/imagearcgisrest.test.js index fc32f6201e..a1994049f9 100644 --- a/test/spec/ol/source/imagearcgisrest.test.js +++ b/test/spec/ol/source/imagearcgisrest.test.js @@ -1,4 +1,4 @@ -import _ol_source_ImageArcGISRest_ from '../../../../src/ol/source/ImageArcGISRest.js'; +import ImageArcGISRest from '../../../../src/ol/source/ImageArcGISRest.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; @@ -19,7 +19,7 @@ describe('ol.source.ImageArcGISRest', function() { describe('#getImage', function() { it('returns a image with the expected URL', function() { - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); var image = source.getImage([3, 2, -7, 1], resolution, pixelRatio, proj3857); var uri = new URL(image.src_); expect(uri.protocol).to.be('http:'); @@ -35,7 +35,7 @@ describe('ol.source.ImageArcGISRest', function() { }); it('returns a non floating point DPI value', function() { - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); var image = source.getImage([3, 2, -7, 1.12], resolution, 1.01, proj3857); var uri = new URL(image.src_); var queryData = uri.searchParams; @@ -44,7 +44,7 @@ describe('ol.source.ImageArcGISRest', function() { it('returns a image with the expected URL for ImageServer', function() { options.url = 'http://example.com/ImageServer'; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); var image = source.getImage([3, 2, -7, 1], resolution, pixelRatio, proj3857); var uri = new URL(image.src_); expect(uri.protocol).to.be('http:'); @@ -61,7 +61,7 @@ describe('ol.source.ImageArcGISRest', function() { it('allows various parameters to be overridden', function() { options.params.FORMAT = 'png'; options.params.TRANSPARENT = false; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); var image = source.getImage([3, 2, -3, 1], resolution, pixelRatio, projection); var uri = new URL(image.src_); var queryData = uri.searchParams; @@ -71,7 +71,7 @@ describe('ol.source.ImageArcGISRest', function() { it('allows adding rest option', function() { options.params.LAYERS = 'show:1,3,4'; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); var image = source.getImage([3, 2, -3, 1], resolution, pixelRatio, proj3857); var uri = new URL(image.src_); var queryData = uri.searchParams; @@ -82,7 +82,7 @@ describe('ol.source.ImageArcGISRest', function() { describe('#updateParams', function() { it('add a new param', function() { - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); source.updateParams({'TEST': 'value'}); var image = source.getImage([3, 2, -7, 1], resolution, pixelRatio, proj3857); @@ -94,7 +94,7 @@ describe('ol.source.ImageArcGISRest', function() { it('updates an existing param', function() { options.params.TEST = 'value'; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); source.updateParams({'TEST': 'newValue'}); var image = source.getImage([3, 2, -7, 1], resolution, pixelRatio, proj3857); @@ -109,7 +109,7 @@ describe('ol.source.ImageArcGISRest', function() { it('verify getting a param', function() { options.params.TEST = 'value'; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); var setParams = source.getParams(); @@ -119,7 +119,7 @@ describe('ol.source.ImageArcGISRest', function() { it('verify on adding a param', function() { options.params.TEST = 'value'; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); source.updateParams({'TEST2': 'newValue'}); var setParams = source.getParams(); @@ -130,7 +130,7 @@ describe('ol.source.ImageArcGISRest', function() { it('verify on update a param', function() { options.params.TEST = 'value'; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); source.updateParams({'TEST': 'newValue'}); var setParams = source.getParams(); @@ -145,7 +145,7 @@ describe('ol.source.ImageArcGISRest', function() { it('verify getting url', function() { options.url = 'http://test.com/MapServer'; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); var url = source.getUrl(); @@ -159,7 +159,7 @@ describe('ol.source.ImageArcGISRest', function() { it('verify setting url when not set yet', function() { - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); source.setUrl('http://test.com/MapServer'); var url = source.getUrl(); @@ -170,7 +170,7 @@ describe('ol.source.ImageArcGISRest', function() { it('verify setting url with existing url', function() { options.url = 'http://test.com/MapServer'; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); source.setUrl('http://test2.com/MapServer'); var url = source.getUrl(); diff --git a/test/spec/ol/source/imagestatic.test.js b/test/spec/ol/source/imagestatic.test.js index e5ae06c33c..b7f2880c2b 100644 --- a/test/spec/ol/source/imagestatic.test.js +++ b/test/spec/ol/source/imagestatic.test.js @@ -1,4 +1,4 @@ -import _ol_source_ImageStatic_ from '../../../../src/ol/source/ImageStatic.js'; +import Static from '../../../../src/ol/source/ImageStatic.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; @@ -17,7 +17,7 @@ describe('ol.source.ImageStatic', function() { describe('#getImage', function() { it('scales image to fit imageExtent', function(done) { - var source = new _ol_source_ImageStatic_({ + var source = new Static({ url: 'spec/ol/source/images/12-655-1583.png', imageExtent: [ -13629027.891360067, 4539747.983913189, @@ -37,7 +37,7 @@ describe('ol.source.ImageStatic', function() { }); it('respects imageSize', function(done) { - var source = new _ol_source_ImageStatic_({ + var source = new Static({ url: 'spec/ol/source/images/12-655-1583.png', imageExtent: [ -13629027.891360067, 4539747.983913189, @@ -58,7 +58,7 @@ describe('ol.source.ImageStatic', function() { }); it('triggers image load events', function(done) { - var source = new _ol_source_ImageStatic_({ + var source = new Static({ url: 'spec/ol/source/images/12-655-1583.png', imageExtent: [ -13629027.891360067, 4539747.983913189, diff --git a/test/spec/ol/source/imagewms.test.js b/test/spec/ol/source/imagewms.test.js index aff39f31dd..a6fb51d142 100644 --- a/test/spec/ol/source/imagewms.test.js +++ b/test/spec/ol/source/imagewms.test.js @@ -1,4 +1,4 @@ -import _ol_source_ImageWMS_ from '../../../../src/ol/source/ImageWMS.js'; +import ImageWMS from '../../../../src/ol/source/ImageWMS.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; @@ -31,7 +31,7 @@ describe('ol.source.ImageWMS', function() { it('returns the expected image URL', function() { options.ratio = 1.5; - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); var image = source.getImage([10, 20, 30.1, 39.9], resolution, pixelRatio, projection); var uri = new URL(image.src_); var queryData = uri.searchParams; @@ -44,7 +44,7 @@ describe('ol.source.ImageWMS', function() { it('uses correct WIDTH and HEIGHT for HiDPI devices', function() { pixelRatio = 2; options.serverType = 'geoserver'; - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); var image = source.getImage(extent, resolution, pixelRatio, projection); var uri = new URL(image.src_); var queryData = uri.searchParams; @@ -56,7 +56,7 @@ describe('ol.source.ImageWMS', function() { it('requests integer WIDTH and HEIGHT', function() { options.ratio = 1.5; - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); var image = source.getImage([10, 20, 30.1, 39.9], resolution, pixelRatio, projection); var uri = new URL(image.src_); var queryData = uri.searchParams; @@ -67,7 +67,7 @@ describe('ol.source.ImageWMS', function() { }); it('sets WIDTH and HEIGHT to match the aspect ratio of BBOX', function() { - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); var image = source.getImage(extent, resolution, pixelRatio, projection); var uri = new URL(image.src_); expect(uri.protocol).to.be('http:'); @@ -91,7 +91,7 @@ describe('ol.source.ImageWMS', function() { it('sets the SRS query value instead of CRS if version < 1.3', function() { options.params.VERSION = '1.2'; - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); var image = source.getImage(extent, resolution, pixelRatio, projection); var uri = new URL(image.src_); var queryData = uri.searchParams; @@ -102,7 +102,7 @@ describe('ol.source.ImageWMS', function() { it('allows various parameters to be overridden', function() { options.params.FORMAT = 'image/jpeg'; options.params.TRANSPARENT = false; - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); var image = source.getImage(extent, resolution, pixelRatio, projection); var uri = new URL(image.src_); var queryData = uri.searchParams; @@ -112,7 +112,7 @@ describe('ol.source.ImageWMS', function() { it('does not add a STYLES= option if one is specified', function() { options.params.STYLES = 'foo'; - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); var image = source.getImage(extent, resolution, pixelRatio, projection); var uri = new URL(image.src_); var queryData = uri.searchParams; @@ -120,7 +120,7 @@ describe('ol.source.ImageWMS', function() { }); it('changes the BBOX order for EN axis orientations', function() { - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); projection = getProjection('CRS:84'); var image = source.getImage(extent, resolution, pixelRatio, projection); var uri = new URL(image.src_); @@ -130,7 +130,7 @@ describe('ol.source.ImageWMS', function() { it('uses EN BBOX order if version < 1.3', function() { options.params.VERSION = '1.1.0'; - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); var image = source.getImage(extent, resolution, pixelRatio, projection); var uri = new URL(image.src_); @@ -140,7 +140,7 @@ describe('ol.source.ImageWMS', function() { it('sets MAP_RESOLUTION when the server is MapServer', function() { options.serverType = 'mapserver'; - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); pixelRatio = 2; var image = source.getImage(extent, resolution, pixelRatio, projection); var uri = new URL(image.src_); @@ -150,7 +150,7 @@ describe('ol.source.ImageWMS', function() { it('sets FORMAT_OPTIONS when the server is GeoServer', function() { options.serverType = 'geoserver'; - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); pixelRatio = 2; var image = source.getImage(extent, resolution, pixelRatio, projection); var uri = new URL(image.src_); @@ -160,7 +160,7 @@ describe('ol.source.ImageWMS', function() { it('extends FORMAT_OPTIONS if it is already present', function() { options.serverType = 'geoserver'; - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); options.params.FORMAT_OPTIONS = 'param1:value1'; pixelRatio = 2; var image = source.getImage(extent, resolution, pixelRatio, projection); @@ -172,7 +172,7 @@ describe('ol.source.ImageWMS', function() { it('rounds FORMAT_OPTIONS to an integer when the server is GeoServer', function() { options.serverType = 'geoserver'; - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); pixelRatio = 1.325; var image = source.getImage(extent, resolution, pixelRatio, projection); @@ -183,7 +183,7 @@ describe('ol.source.ImageWMS', function() { it('sets DPI when the server is QGIS', function() { options.serverType = 'qgis'; - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); pixelRatio = 2; var image = source.getImage(extent, resolution, pixelRatio, projection); var uri = new URL(image.src_); @@ -194,7 +194,7 @@ describe('ol.source.ImageWMS', function() { it('creates an image with a custom imageLoadFunction', function() { var imageLoadFunction = sinon.spy(); options.imageLoadFunction = imageLoadFunction; - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); var image = source.getImage(extent, resolution, pixelRatio, projection); image.load(); expect(imageLoadFunction).to.be.called(); @@ -203,7 +203,7 @@ describe('ol.source.ImageWMS', function() { it('returns same image for consecutive calls with same args', function() { var extent = [10.01, 20, 30.01, 40]; - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); var image1 = source.getImage(extent, resolution, pixelRatio, projection); var image2 = source.getImage(extent, resolution, pixelRatio, projection); expect(image1).to.equal(image2); @@ -211,7 +211,7 @@ describe('ol.source.ImageWMS', function() { it('returns same image for calls with similar extents', function() { options.ratio = 1.5; - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); var extent = [10.01, 20, 30.01, 40]; var image1 = source.getImage(extent, resolution, pixelRatio, projection); extent = [10.01, 20.1, 30.01, 40.1]; @@ -221,7 +221,7 @@ describe('ol.source.ImageWMS', function() { it('calculates correct image size with ratio', function() { options.ratio = 1.5; - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); var extent = [10, 5, 30, 45]; source.getImage(extent, resolution, pixelRatio, projection); expect(source.imageSize_).to.eql([300, 600]); @@ -232,7 +232,7 @@ describe('ol.source.ImageWMS', function() { describe('#getGetFeatureInfoUrl', function() { it('returns the expected GetFeatureInfo URL', function() { - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); var url = source.getGetFeatureInfoUrl( [20, 30], resolution, projection, {INFO_FORMAT: 'text/plain'}); @@ -260,7 +260,7 @@ describe('ol.source.ImageWMS', function() { }); it('returns the expected GetFeatureInfo URL when source\'s projection is different from the parameter', function() { - var source = new _ol_source_ImageWMS_(optionsReproj); + var source = new ImageWMS(optionsReproj); var url = source.getGetFeatureInfoUrl( [20, 30], resolution, projection, {INFO_FORMAT: 'text/plain'}); @@ -288,7 +288,7 @@ describe('ol.source.ImageWMS', function() { }); it('sets the QUERY_LAYERS param as expected', function() { - var source = new _ol_source_ImageWMS_(options); + var source = new ImageWMS(options); var url = source.getGetFeatureInfoUrl( [20, 30], resolution, projection, {INFO_FORMAT: 'text/plain', QUERY_LAYERS: 'foo,bar'}); diff --git a/test/spec/ol/source/raster.test.js b/test/spec/ol/source/raster.test.js index 4e5da06f77..225b5c59a9 100644 --- a/test/spec/ol/source/raster.test.js +++ b/test/spec/ol/source/raster.test.js @@ -1,13 +1,13 @@ import Map from '../../../../src/ol/Map.js'; import TileState from '../../../../src/ol/TileState.js'; -import _ol_View_ from '../../../../src/ol/View.js'; -import _ol_layer_Image_ from '../../../../src/ol/layer/Image.js'; +import View from '../../../../src/ol/View.js'; +import ImageLayer from '../../../../src/ol/layer/Image.js'; import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; -import _ol_source_ImageStatic_ from '../../../../src/ol/source/ImageStatic.js'; +import Static from '../../../../src/ol/source/ImageStatic.js'; import RasterSource from '../../../../src/ol/source/Raster.js'; import Source from '../../../../src/ol/source/Source.js'; -import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js'; -import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js'; +import TileSource from '../../../../src/ol/source/Tile.js'; +import XYZ from '../../../../src/ol/source/XYZ.js'; var red = 'data:image/gif;base64,R0lGODlhAQABAPAAAP8AAP///yH5BAAAAAAALAAAAAA' + 'BAAEAAAICRAEAOw=='; @@ -35,17 +35,17 @@ where('Uint8ClampedArray').describe('ol.source.Raster', function() { var extent = [-1, -1, 1, 1]; - redSource = new _ol_source_ImageStatic_({ + redSource = new Static({ url: red, imageExtent: extent }); - greenSource = new _ol_source_ImageStatic_({ + greenSource = new Static({ url: green, imageExtent: extent }); - blueSource = new _ol_source_ImageStatic_({ + blueSource = new Static({ url: blue, imageExtent: extent }); @@ -60,7 +60,7 @@ where('Uint8ClampedArray').describe('ol.source.Raster', function() { map = new Map({ target: target, - view: new _ol_View_({ + view: new View({ resolutions: [1], projection: new _ol_proj_Projection_({ code: 'image', @@ -69,7 +69,7 @@ where('Uint8ClampedArray').describe('ol.source.Raster', function() { }) }), layers: [ - new _ol_layer_Image_({ + new ImageLayer({ source: raster }) ] @@ -92,7 +92,7 @@ where('Uint8ClampedArray').describe('ol.source.Raster', function() { it('returns a tile source', function() { var source = new RasterSource({ threads: 0, - sources: [new _ol_source_Tile_({})] + sources: [new TileSource({})] }); expect(source).to.be.a(Source); expect(source).to.be.a(RasterSource); @@ -311,7 +311,7 @@ where('Uint8ClampedArray').describe('ol.source.Raster', function() { it('is initiated on the underlying source', function(done) { - var source = new _ol_source_XYZ_({ + var source = new XYZ({ url: 'spec/ol/data/osm-{z}-{x}-{y}.png' }); @@ -325,12 +325,12 @@ where('Uint8ClampedArray').describe('ol.source.Raster', function() { map2 = new Map({ target: target, - view: new _ol_View_({ + view: new View({ center: [0, 0], zoom: 0 }), layers: [ - new _ol_layer_Image_({ + new ImageLayer({ source: raster }) ] diff --git a/test/spec/ol/source/stamen.test.js b/test/spec/ol/source/stamen.test.js index 6b74c20072..a401d48370 100644 --- a/test/spec/ol/source/stamen.test.js +++ b/test/spec/ol/source/stamen.test.js @@ -1,4 +1,4 @@ -import _ol_source_Stamen_ from '../../../../src/ol/source/Stamen.js'; +import Stamen from '../../../../src/ol/source/Stamen.js'; describe('ol.source.Stamen', function() { @@ -6,7 +6,7 @@ describe('ol.source.Stamen', function() { describe('constructor', function() { it('can be constructed with a custom minZoom', function() { - var source = new _ol_source_Stamen_({ + var source = new Stamen({ layer: 'watercolor', minZoom: 10 }); @@ -14,7 +14,7 @@ describe('ol.source.Stamen', function() { }); it('can be constructed with a custom maxZoom', function() { - var source = new _ol_source_Stamen_({ + var source = new Stamen({ layer: 'watercolor', maxZoom: 8 }); diff --git a/test/spec/ol/source/tile.test.js b/test/spec/ol/source/tile.test.js index 803d90e07d..550869286e 100644 --- a/test/spec/ol/source/tile.test.js +++ b/test/spec/ol/source/tile.test.js @@ -4,7 +4,7 @@ import TileRange from '../../../../src/ol/TileRange.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; import Source from '../../../../src/ol/source/Source.js'; -import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js'; +import TileSource from '../../../../src/ol/source/Tile.js'; import _ol_tilecoord_ from '../../../../src/ol/tilecoord.js'; import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js'; @@ -25,7 +25,7 @@ var MockTile = function(tileStates) { tileSize: 256 }); - _ol_source_Tile_.call(this, { + TileSource.call(this, { projection: getProjection('EPSG:4326'), tileGrid: tileGrid }); @@ -35,7 +35,7 @@ var MockTile = function(tileStates) { } }; -inherits(MockTile, _ol_source_Tile_); +inherits(MockTile, TileSource); /** @@ -56,15 +56,15 @@ describe('ol.source.Tile', function() { describe('constructor', function() { it('returns a tile source', function() { - var source = new _ol_source_Tile_({ + var source = new TileSource({ projection: getProjection('EPSG:4326') }); expect(source).to.be.a(Source); - expect(source).to.be.a(_ol_source_Tile_); + expect(source).to.be.a(TileSource); }); it('sets a custom cache size', function() { var projection = getProjection('EPSG:4326'); - var source = new _ol_source_Tile_({ + var source = new TileSource({ projection: projection, cacheSize: 42 }); @@ -74,7 +74,7 @@ describe('ol.source.Tile', function() { describe('#setKey()', function() { it('sets the source key', function() { - var source = new _ol_source_Tile_({}); + var source = new TileSource({}); expect(source.getKey()).to.equal(''); var key = 'foo'; @@ -85,7 +85,7 @@ describe('ol.source.Tile', function() { describe('#setKey()', function() { it('dispatches a change event', function(done) { - var source = new _ol_source_Tile_({}); + var source = new TileSource({}); var key = 'foo'; source.once('change', function() { @@ -95,7 +95,7 @@ describe('ol.source.Tile', function() { }); it('does not dispatch change if key does not change', function(done) { - var source = new _ol_source_Tile_({}); + var source = new TileSource({}); var key = 'foo'; source.once('change', function() { @@ -225,7 +225,7 @@ describe('ol.source.Tile', function() { describe('#getTileCoordForTileUrlFunction()', function() { it('returns the expected tile coordinate - {wrapX: true}', function() { - var tileSource = new _ol_source_Tile_({ + var tileSource = new TileSource({ projection: 'EPSG:3857', wrapX: true }); @@ -241,7 +241,7 @@ describe('ol.source.Tile', function() { }); it('returns the expected tile coordinate - {wrapX: false}', function() { - var tileSource = new _ol_source_Tile_({ + var tileSource = new TileSource({ projection: 'EPSG:3857', wrapX: false }); @@ -257,7 +257,7 @@ describe('ol.source.Tile', function() { }); it('works with wrapX and custom projection without extent', function() { - var tileSource = new _ol_source_Tile_({ + var tileSource = new TileSource({ projection: new _ol_proj_Projection_({ code: 'foo', global: true, @@ -297,7 +297,7 @@ describe('MockTile', function() { describe('constructor', function() { it('creates a tile source', function() { var source = new MockTile({}); - expect(source).to.be.a(_ol_source_Tile_); + expect(source).to.be.a(TileSource); expect(source).to.be.a(MockTile); }); }); diff --git a/test/spec/ol/source/tilearcgisrest.test.js b/test/spec/ol/source/tilearcgisrest.test.js index 10771c5572..ca07df81e8 100644 --- a/test/spec/ol/source/tilearcgisrest.test.js +++ b/test/spec/ol/source/tilearcgisrest.test.js @@ -1,5 +1,5 @@ import ImageTile from '../../../../src/ol/ImageTile.js'; -import _ol_source_TileArcGISRest_ from '../../../../src/ol/source/TileArcGISRest.js'; +import TileArcGISRest from '../../../../src/ol/source/TileArcGISRest.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; @@ -16,7 +16,7 @@ describe('ol.source.TileArcGISRest', function() { describe('#getTile', function() { it('returns a tile with the expected URL', function() { - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857')); expect(tile).to.be.an(ImageTile); var uri = new URL(tile.src_); @@ -38,7 +38,7 @@ describe('ol.source.TileArcGISRest', function() { }); it('returns a non floating point DPI value', function() { - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var tile = source.getTile(3, 2, -7, 1.12, getProjection('EPSG:3857')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -47,7 +47,7 @@ describe('ol.source.TileArcGISRest', function() { it('takes DPI from params if specified', function() { options.params.DPI = 96; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var tile = source.getTile(3, 2, -7, 1.12, getProjection('EPSG:3857')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -58,7 +58,7 @@ describe('ol.source.TileArcGISRest', function() { it('returns a tile with the expected URL with url list', function() { options.urls = ['http://test1.com/MapServer', 'http://test2.com/MapServer']; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857')); expect(tile).to.be.an(ImageTile); @@ -82,7 +82,7 @@ describe('ol.source.TileArcGISRest', function() { it('returns a tile with the expected URL for ImageServer', function() { options.url = 'http://example.com/ImageServer'; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857')); expect(tile).to.be.an(ImageTile); var uri = new URL(tile.src_); @@ -105,7 +105,7 @@ describe('ol.source.TileArcGISRest', function() { it('allows various parameters to be overridden', function() { options.params.FORMAT = 'png'; options.params.TRANSPARENT = false; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -115,7 +115,7 @@ describe('ol.source.TileArcGISRest', function() { it('allows adding rest option', function() { options.params.LAYERS = 'show:1,3,4'; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -126,7 +126,7 @@ describe('ol.source.TileArcGISRest', function() { describe('#updateParams', function() { it('add a new param', function() { - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); source.updateParams({'TEST': 'value'}); var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857')); @@ -138,7 +138,7 @@ describe('ol.source.TileArcGISRest', function() { it('updates an existing param', function() { options.params.TEST = 'value'; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); source.updateParams({'TEST': 'newValue'}); var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857')); @@ -153,7 +153,7 @@ describe('ol.source.TileArcGISRest', function() { it('verify getting a param', function() { options.params.TEST = 'value'; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var setParams = source.getParams(); @@ -163,7 +163,7 @@ describe('ol.source.TileArcGISRest', function() { it('verify on adding a param', function() { options.params.TEST = 'value'; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); source.updateParams({'TEST2': 'newValue'}); var setParams = source.getParams(); @@ -174,7 +174,7 @@ describe('ol.source.TileArcGISRest', function() { it('verify on update a param', function() { options.params.TEST = 'value'; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); source.updateParams({'TEST': 'newValue'}); var setParams = source.getParams(); @@ -189,7 +189,7 @@ describe('ol.source.TileArcGISRest', function() { it('verify getting array of urls', function() { options.urls = ['http://test.com/MapServer', 'http://test2.com/MapServer']; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var urls = source.getUrls(); @@ -203,7 +203,7 @@ describe('ol.source.TileArcGISRest', function() { it('verify setting urls when not set yet', function() { - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); source.setUrls(['http://test.com/MapServer', 'http://test2.com/MapServer']); var urls = source.getUrls(); @@ -214,7 +214,7 @@ describe('ol.source.TileArcGISRest', function() { it('verify setting urls with existing list', function() { options.urls = ['http://test.com/MapServer', 'http://test2.com/MapServer']; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); source.setUrls(['http://test3.com/MapServer', 'http://test4.com/MapServer']); var urls = source.getUrls(); @@ -227,7 +227,7 @@ describe('ol.source.TileArcGISRest', function() { it('verify setting url with no urls', function() { - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); source.setUrl('http://test.com/MapServer'); var urls = source.getUrls(); @@ -238,7 +238,7 @@ describe('ol.source.TileArcGISRest', function() { it('verify setting url with list of urls', function() { options.urls = ['http://test.com/MapServer', 'http://test2.com/MapServer']; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); source.setUrl('http://test3.com/MapServer'); var urls = source.getUrls(); diff --git a/test/spec/ol/source/tileimage.test.js b/test/spec/ol/source/tileimage.test.js index 23c7e26f33..f80b2dfad4 100644 --- a/test/spec/ol/source/tileimage.test.js +++ b/test/spec/ol/source/tileimage.test.js @@ -7,7 +7,7 @@ import {register} from '../../../../src/ol/proj/proj4.js'; import _ol_proj_EPSG3857_ from '../../../../src/ol/proj/EPSG3857.js'; import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; import _ol_reproj_Tile_ from '../../../../src/ol/reproj/Tile.js'; -import _ol_source_TileImage_ from '../../../../src/ol/source/TileImage.js'; +import TileImage from '../../../../src/ol/source/TileImage.js'; import _ol_tilecoord_ from '../../../../src/ol/tilecoord.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -15,7 +15,7 @@ import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; describe('ol.source.TileImage', function() { function createSource(opt_proj, opt_tileGrid, opt_cacheSize) { var proj = opt_proj || 'EPSG:3857'; - return new _ol_source_TileImage_({ + return new TileImage({ cacheSize: opt_cacheSize, projection: proj, tileGrid: opt_tileGrid || @@ -181,7 +181,7 @@ describe('ol.source.TileImage', function() { var source; beforeEach(function() { - source = new _ol_source_TileImage_({ + source = new TileImage({ url: '{z}/{x}/{y}' }); }); diff --git a/test/spec/ol/source/tilejson.test.js b/test/spec/ol/source/tilejson.test.js index b259d14402..be2c36d6a6 100644 --- a/test/spec/ol/source/tilejson.test.js +++ b/test/spec/ol/source/tilejson.test.js @@ -1,6 +1,6 @@ import Source from '../../../../src/ol/source/Source.js'; -import _ol_source_TileJSON_ from '../../../../src/ol/source/TileJSON.js'; -import _ol_Observable_ from '../../../../src/ol/Observable.js'; +import TileJSON from '../../../../src/ol/source/TileJSON.js'; +import Observable from '../../../../src/ol/Observable.js'; describe('ol.source.TileJSON', function() { @@ -8,18 +8,18 @@ describe('ol.source.TileJSON', function() { describe('constructor', function() { it('returns a tileJSON source', function() { - var source = new _ol_source_TileJSON_({ + var source = new TileJSON({ url: 'spec/ol/data/tilejson.json' }); expect(source).to.be.a(Source); - expect(source).to.be.a(_ol_source_TileJSON_); + expect(source).to.be.a(TileJSON); }); }); describe('#getTileJSON', function() { it('parses the tilejson file', function() { - var source = new _ol_source_TileJSON_({ + var source = new TileJSON({ url: 'spec/ol/data/tilejson.json' }); source.on('change', function() { @@ -63,7 +63,7 @@ describe('ol.source.TileJSON', function() { version: '1.0.0', webpage: 'https://a.tiles.mapbox.com/v3/mapbox.geography-class/page.html' }; - var source = new _ol_source_TileJSON_({ + var source = new TileJSON({ tileJSON: tileJSON }); expect(source.getState()).to.be('ready'); @@ -74,7 +74,7 @@ describe('ol.source.TileJSON', function() { describe('#getState', function() { it('returns error on HTTP 404', function() { - var source = new _ol_source_TileJSON_({ + var source = new TileJSON({ url: 'invalid.jsonp' }); source.on('change', function() { @@ -84,7 +84,7 @@ describe('ol.source.TileJSON', function() { }); it('returns error on CORS issues', function() { - var source = new _ol_source_TileJSON_({ + var source = new TileJSON({ url: 'http://example.com' }); source.on('change', function() { @@ -94,7 +94,7 @@ describe('ol.source.TileJSON', function() { }); it('returns error on JSON parsing issues', function() { - var source = new _ol_source_TileJSON_({ + var source = new TileJSON({ url: '/' }); source.on('change', function() { @@ -110,12 +110,12 @@ describe('ol.source.TileJSON', function() { var source, tileGrid; beforeEach(function(done) { - source = new _ol_source_TileJSON_({ + source = new TileJSON({ url: 'spec/ol/data/tilejson.json' }); var key = source.on('change', function() { if (source.getState() === 'ready') { - _ol_Observable_.unByKey(key); + Observable.unByKey(key); tileGrid = source.getTileGrid(); done(); } diff --git a/test/spec/ol/source/tileutfgrid.test.js b/test/spec/ol/source/tileutfgrid.test.js index fc4f33be1f..c122e8ffd1 100644 --- a/test/spec/ol/source/tileutfgrid.test.js +++ b/test/spec/ol/source/tileutfgrid.test.js @@ -1,6 +1,6 @@ import {get as getProjection, transformExtent, fromLonLat} from '../../../../src/ol/proj.js'; -import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js'; -import _ol_source_TileUTFGrid_ from '../../../../src/ol/source/TileUTFGrid.js'; +import TileSource from '../../../../src/ol/source/Tile.js'; +import UTFGrid from '../../../../src/ol/source/TileUTFGrid.js'; import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js'; @@ -28,7 +28,7 @@ describe('ol.source.TileUTFGrid', function() { }); function getTileUTFGrid() { - return new _ol_source_TileUTFGrid_({ + return new UTFGrid({ url: url }); } @@ -37,28 +37,28 @@ describe('ol.source.TileUTFGrid', function() { it('needs to be constructed with url option', function() { - var source = new _ol_source_TileUTFGrid_({url: url}); - expect(source).to.be.an(_ol_source_TileUTFGrid_); - expect(source).to.be.an(_ol_source_Tile_); + var source = new UTFGrid({url: url}); + expect(source).to.be.an(UTFGrid); + expect(source).to.be.an(TileSource); expect(function() { // no options: will throw - return new _ol_source_TileUTFGrid_(); + return new UTFGrid(); }).to.throwException(); expect(function() { // no url-option: will throw - return new _ol_source_TileUTFGrid_({}); + return new UTFGrid({}); }).to.throwException(); - expect(getTileUTFGrid()).to.be.an(_ol_source_TileUTFGrid_); + expect(getTileUTFGrid()).to.be.an(UTFGrid); }); }); describe('change event (ready)', function() { it('is fired when the source is ready', function(done) { - var source = new _ol_source_TileUTFGrid_({ + var source = new UTFGrid({ url: url }); expect(source.getState()).to.be('loading'); @@ -75,7 +75,7 @@ describe('ol.source.TileUTFGrid', function() { describe('change event (error)', function(done) { it('is fired when the source fails to initialize', function(done) { - var source = new _ol_source_TileUTFGrid_({ + var source = new UTFGrid({ url: 'Bogus UTFGrid URL' }); expect(source.getState()).to.be('loading'); @@ -228,7 +228,7 @@ describe('ol.source.TileUTFGrid', function() { var urlTileCoord = this.getTileCoordForTileUrlFunction(tileCoord, projection); var tileUrl = this.tileUrlFunction_(urlTileCoord, pixelRatio, projection); - var tile = new _ol_source_TileUTFGrid_.Tile_( + var tile = new UTFGrid.Tile_( tileCoord, tileUrl !== undefined ? 0 : 4, // IDLE : EMPTY tileUrl !== undefined ? tileUrl : '', diff --git a/test/spec/ol/source/tilewms.test.js b/test/spec/ol/source/tilewms.test.js index cff8072c08..ce02d31ab8 100644 --- a/test/spec/ol/source/tilewms.test.js +++ b/test/spec/ol/source/tilewms.test.js @@ -1,6 +1,6 @@ import ImageTile from '../../../../src/ol/ImageTile.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; -import _ol_source_TileWMS_ from '../../../../src/ol/source/TileWMS.js'; +import TileWMS from '../../../../src/ol/source/TileWMS.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js'; @@ -26,18 +26,18 @@ describe('ol.source.TileWMS', function() { describe('constructor', function() { it('can be constructed without url or urls params', function() { - var source = new _ol_source_TileWMS_({ + var source = new TileWMS({ projection: 'EPSG:3857', tileGrid: _ol_tilegrid_.createXYZ({maxZoom: 6}) }); - expect(source).to.be.an(_ol_source_TileWMS_); + expect(source).to.be.an(TileWMS); }); }); describe('#getTile', function() { it('returns a tile with the expected URL', function() { - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857')); expect(tile).to.be.an(ImageTile); var uri = new URL(tile.src_); @@ -66,7 +66,7 @@ describe('ol.source.TileWMS', function() { it('returns a larger tile when a gutter is specified', function() { options.gutter = 16; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857')); expect(tile).to.be.an(ImageTile); var uri = new URL(tile.src_); @@ -83,7 +83,7 @@ describe('ol.source.TileWMS', function() { it('sets the SRS query value instead of CRS if version < 1.3', function() { options.params.VERSION = '1.2'; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -94,7 +94,7 @@ describe('ol.source.TileWMS', function() { it('allows various parameters to be overridden', function() { options.params.FORMAT = 'image/jpeg'; options.params.TRANSPARENT = false; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -104,7 +104,7 @@ describe('ol.source.TileWMS', function() { it('does not add a STYLES= option if one is specified', function() { options.params.STYLES = 'foo'; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -112,7 +112,7 @@ describe('ol.source.TileWMS', function() { }); it('changes the BBOX order for EN axis orientations', function() { - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -121,7 +121,7 @@ describe('ol.source.TileWMS', function() { it('uses EN BBOX order if version < 1.3', function() { options.params.VERSION = '1.1.0'; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -3, 1, getProjection('CRS:84')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -130,7 +130,7 @@ describe('ol.source.TileWMS', function() { it('sets FORMAT_OPTIONS when the server is GeoServer', function() { options.serverType = 'geoserver'; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -3, 2, getProjection('CRS:84')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -139,7 +139,7 @@ describe('ol.source.TileWMS', function() { it('extends FORMAT_OPTIONS if it is already present', function() { options.serverType = 'geoserver'; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); options.params.FORMAT_OPTIONS = 'param1:value1'; var tile = source.getTile(3, 2, -3, 2, getProjection('CRS:84')); var uri = new URL(tile.src_); @@ -150,7 +150,7 @@ describe('ol.source.TileWMS', function() { it('rounds FORMAT_OPTIONS to an integer when the server is GeoServer', function() { options.serverType = 'geoserver'; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tile = source.getTile(3, 2, -3, 1.325, getProjection('CRS:84')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -163,7 +163,7 @@ describe('ol.source.TileWMS', function() { it('returns a tile if it is contained within layers extent', function() { options.extent = [-80, -40, -50, -10]; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tileCoord = [3, 2, -3]; var url = source.tileUrlFunction(tileCoord, 1, getProjection('EPSG:4326')); var uri = new URL(url); @@ -173,7 +173,7 @@ describe('ol.source.TileWMS', function() { it('returns a tile if it intersects layers extent', function() { options.extent = [-80, -40, -40, -10]; - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tileCoord = [3, 3, -3]; var url = source.tileUrlFunction(tileCoord, 1, getProjection('EPSG:4326')); var uri = new URL(url); @@ -187,7 +187,7 @@ describe('ol.source.TileWMS', function() { resolutions: [1.40625, 0.703125, 0.3515625, 0.17578125], origin: [-180, -90] }); - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var tileCoord = [3, 3, -3]; var url = source.tileUrlFunction(tileCoord, 1, getProjection('EPSG:4326')); var uri = new URL(url); @@ -201,7 +201,7 @@ describe('ol.source.TileWMS', function() { describe('#getGetFeatureInfoUrl', function() { it('returns the expected GetFeatureInfo URL', function() { - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); source.pixelRatio_ = 1; var url = source.getGetFeatureInfoUrl( [-7000000, -12000000], @@ -235,7 +235,7 @@ describe('ol.source.TileWMS', function() { }); it('returns the expected GetFeatureInfo URL when source\'s projection is different from the parameter', function() { - var source = new _ol_source_TileWMS_(optionsReproj); + var source = new TileWMS(optionsReproj); source.pixelRatio_ = 1; var url = source.getGetFeatureInfoUrl( [-7000000, -12000000], @@ -265,7 +265,7 @@ describe('ol.source.TileWMS', function() { }); it('sets the QUERY_LAYERS param as expected', function() { - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); source.pixelRatio_ = 1; var url = source.getGetFeatureInfoUrl( [-7000000, -12000000], @@ -301,7 +301,7 @@ describe('ol.source.TileWMS', function() { describe('#setUrl()', function() { it('sets the correct url', function() { - var source = new _ol_source_TileWMS_(options); + var source = new TileWMS(options); var url = 'http://foo/'; source.setUrl(url); var tileUrl = source.tileUrlFunction([0, 0, 0], 1, getProjection('EPSG:4326')); @@ -311,7 +311,7 @@ describe('ol.source.TileWMS', function() { describe('#setUrls()', function() { it ('updates the source key', function() { - var source = new _ol_source_TileWMS_({ + var source = new TileWMS({ urls: ['u1', 'u2'] }); var originalKey = source.getKey(); diff --git a/test/spec/ol/source/urltile.test.js b/test/spec/ol/source/urltile.test.js index bc9db6876a..2501c711e3 100644 --- a/test/spec/ol/source/urltile.test.js +++ b/test/spec/ol/source/urltile.test.js @@ -1,5 +1,5 @@ import {get as getProjection} from '../../../../src/ol/proj.js'; -import _ol_source_UrlTile_ from '../../../../src/ol/source/UrlTile.js'; +import UrlTile from '../../../../src/ol/source/UrlTile.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -7,7 +7,7 @@ describe('ol.source.UrlTile', function() { describe('#setUrl()', function() { it('sets the URL for the source', function() { - var source = new _ol_source_UrlTile_({}); + var source = new UrlTile({}); var url = 'https://example.com/'; source.setUrl(url); @@ -16,7 +16,7 @@ describe('ol.source.UrlTile', function() { }); it('updates the key for the source', function() { - var source = new _ol_source_UrlTile_({}); + var source = new UrlTile({}); var url = 'https://example.com/'; source.setUrl(url); @@ -27,7 +27,7 @@ describe('ol.source.UrlTile', function() { describe('#setUrls()', function() { it('sets the URL for the source', function() { - var source = new _ol_source_UrlTile_({}); + var source = new UrlTile({}); var urls = [ 'https://a.example.com/', @@ -40,7 +40,7 @@ describe('ol.source.UrlTile', function() { }); it('updates the key for the source', function() { - var source = new _ol_source_UrlTile_({}); + var source = new UrlTile({}); var urls = [ 'https://a.example.com/', @@ -55,7 +55,7 @@ describe('ol.source.UrlTile', function() { describe('url option', function() { it('expands url template', function() { - var tileSource = new _ol_source_UrlTile_({ + var tileSource = new UrlTile({ url: '{1-3}' }); @@ -69,7 +69,7 @@ describe('ol.source.UrlTile', function() { var tileSource, tileGrid; beforeEach(function() { - tileSource = new _ol_source_UrlTile_({ + tileSource = new UrlTile({ projection: 'EPSG:3857', tileGrid: _ol_tilegrid_.createXYZ({maxZoom: 6}), url: '{z}/{x}/{y}', @@ -176,7 +176,7 @@ describe('ol.source.UrlTile', function() { describe('using a "url" option', function() { beforeEach(function() { sourceOptions.url = url; - source = new _ol_source_UrlTile_(sourceOptions); + source = new UrlTile(sourceOptions); }); it('returns the XYZ URL', function() { @@ -189,7 +189,7 @@ describe('ol.source.UrlTile', function() { describe('using a "urls" option', function() { beforeEach(function() { sourceOptions.urls = ['some_xyz_url1', 'some_xyz_url2']; - source = new _ol_source_UrlTile_(sourceOptions); + source = new UrlTile(sourceOptions); }); it('returns the XYZ URLs', function() { @@ -204,7 +204,7 @@ describe('ol.source.UrlTile', function() { sourceOptions.tileUrlFunction = function() { return 'some_xyz_url'; }; - source = new _ol_source_UrlTile_(sourceOptions); + source = new UrlTile(sourceOptions); }); it('returns null', function() { diff --git a/test/spec/ol/source/vector.test.js b/test/spec/ol/source/vector.test.js index 1e4aac7aa2..a35872cb59 100644 --- a/test/spec/ol/source/vector.test.js +++ b/test/spec/ol/source/vector.test.js @@ -1,14 +1,14 @@ import _ol_events_ from '../../../../src/ol/events.js'; import _ol_Collection_ from '../../../../src/ol/Collection.js'; -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import Point from '../../../../src/ol/geom/Point.js'; import LineString from '../../../../src/ol/geom/LineString.js'; -import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; +import VectorLayer from '../../../../src/ol/layer/Vector.js'; import _ol_loadingstrategy_ from '../../../../src/ol/loadingstrategy.js'; import {get as getProjection, transformExtent, fromLonLat} from '../../../../src/ol/proj.js'; -import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; +import VectorSource from '../../../../src/ol/source/Vector.js'; describe('ol.source.Vector', function() { @@ -16,7 +16,7 @@ describe('ol.source.Vector', function() { var pointFeature; var infiniteExtent; beforeEach(function() { - pointFeature = new _ol_Feature_(new Point([0, 0])); + pointFeature = new Feature(new Point([0, 0])); infiniteExtent = [-Infinity, -Infinity, Infinity, Infinity]; }); @@ -24,7 +24,7 @@ describe('ol.source.Vector', function() { var vectorSource; beforeEach(function() { - vectorSource = new _ol_source_Vector_(); + vectorSource = new VectorSource(); }); describe('#forEachFeatureInExtent', function() { @@ -73,10 +73,10 @@ describe('ol.source.Vector', function() { }); it('adds same id features only once', function() { - var source = new _ol_source_Vector_(); - var feature1 = new _ol_Feature_(); + var source = new VectorSource(); + var feature1 = new Feature(); feature1.setId('1'); - var feature2 = new _ol_Feature_(); + var feature2 = new Feature(); feature2.setId('1'); source.addFeature(feature1); source.addFeature(feature2); @@ -92,10 +92,10 @@ describe('ol.source.Vector', function() { var features = []; var vectorSource; beforeEach(function() { - features.push(new _ol_Feature_(new LineString([[0, 0], [10, 10]]))); - features.push(new _ol_Feature_(new Point([0, 10]))); - features.push(new _ol_Feature_(new Point([10, 5]))); - vectorSource = new _ol_source_Vector_({ + features.push(new Feature(new LineString([[0, 0], [10, 10]]))); + features.push(new Feature(new Point([0, 10]))); + features.push(new Feature(new Point([10, 5]))); + vectorSource = new VectorSource({ features: features }); }); @@ -127,10 +127,10 @@ describe('ol.source.Vector', function() { var i; for (i = 0; i < 10; ++i) { features[i] = - new _ol_Feature_(new Point([Math.random(), Math.random()])); + new Feature(new Point([Math.random(), Math.random()])); } - features.push(new _ol_Feature_(null)); - vectorSource = new _ol_source_Vector_({ + features.push(new Feature(null)); + vectorSource = new VectorSource({ features: features }); }); @@ -265,11 +265,11 @@ describe('ol.source.Vector', function() { var vectorSource; beforeEach(function() { - vectorSource = new _ol_source_Vector_(); + vectorSource = new VectorSource(); }); it('keeps its index up-to-date', function() { - var feature = new _ol_Feature_(new Point([1, 1])); + var feature = new Feature(new Point([1, 1])); vectorSource.addFeature(feature); expect(vectorSource.getFeaturesInExtent([0, 0, 2, 2])). to.eql([feature]); @@ -281,13 +281,13 @@ describe('ol.source.Vector', function() { }); it('handles features with null geometries', function() { - var feature = new _ol_Feature_(null); + var feature = new Feature(null); vectorSource.addFeature(feature); expect(vectorSource.getFeatures()).to.eql([feature]); }); it('handles features with geometries changing from null', function() { - var feature = new _ol_Feature_(null); + var feature = new Feature(null); vectorSource.addFeature(feature); expect(vectorSource.getFeatures()).to.eql([feature]); feature.setGeometry(new Point([1, 1])); @@ -297,7 +297,7 @@ describe('ol.source.Vector', function() { }); it('handles features with geometries changing to null', function() { - var feature = new _ol_Feature_(new Point([1, 1])); + var feature = new Feature(new Point([1, 1])); vectorSource.addFeature(feature); expect(vectorSource.getFeatures()).to.eql([feature]); expect(vectorSource.getFeaturesInExtent([0, 0, 2, 2])). @@ -308,7 +308,7 @@ describe('ol.source.Vector', function() { }); it('fires a change event when setting a feature\'s property', function() { - var feature = new _ol_Feature_(new Point([1, 1])); + var feature = new Feature(new Point([1, 1])); vectorSource.addFeature(feature); var listener = sinon.spy(); _ol_events_.listen(vectorSource, 'change', listener); @@ -317,7 +317,7 @@ describe('ol.source.Vector', function() { }); it('fires a changefeature event when updating a feature', function() { - var feature = new _ol_Feature_(new Point([1, 1])); + var feature = new Feature(new Point([1, 1])); vectorSource.addFeature(feature); var listener = sinon.spy(function(event) { expect(event.feature).to.be(feature); @@ -332,18 +332,18 @@ describe('ol.source.Vector', function() { describe('#getFeatureById()', function() { var source; beforeEach(function() { - source = new _ol_source_Vector_(); + source = new VectorSource(); }); it('returns a feature by id', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setId('foo'); source.addFeature(feature); expect(source.getFeatureById('foo')).to.be(feature); }); it('returns a feature by id (set after add)', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); source.addFeature(feature); expect(source.getFeatureById('foo')).to.be(null); feature.setId('foo'); @@ -351,14 +351,14 @@ describe('ol.source.Vector', function() { }); it('returns null when no feature is found', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setId('foo'); source.addFeature(feature); expect(source.getFeatureById('bar')).to.be(null); }); it('returns null after removing feature', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setId('foo'); source.addFeature(feature); expect(source.getFeatureById('foo')).to.be(feature); @@ -367,7 +367,7 @@ describe('ol.source.Vector', function() { }); it('returns null after unsetting id', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setId('foo'); source.addFeature(feature); expect(source.getFeatureById('foo')).to.be(feature); @@ -376,7 +376,7 @@ describe('ol.source.Vector', function() { }); it('returns null after clear', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setId('foo'); source.addFeature(feature); expect(source.getFeatureById('foo')).to.be(feature); @@ -386,19 +386,19 @@ describe('ol.source.Vector', function() { it('returns null when no features are indexed', function() { expect(source.getFeatureById('foo')).to.be(null); - source.addFeature(new _ol_Feature_()); + source.addFeature(new Feature()); expect(source.getFeatureById('foo')).to.be(null); }); it('returns correct feature after add/remove/add', function() { expect(source.getFeatureById('foo')).to.be(null); - var first = new _ol_Feature_(); + var first = new Feature(); first.setId('foo'); source.addFeature(first); expect(source.getFeatureById('foo')).to.be(first); source.removeFeature(first); expect(source.getFeatureById('foo')).to.be(null); - var second = new _ol_Feature_(); + var second = new Feature(); second.setId('foo'); source.addFeature(second); expect(source.getFeatureById('foo')).to.be(second); @@ -406,7 +406,7 @@ describe('ol.source.Vector', function() { it('returns correct feature after add/change', function() { expect(source.getFeatureById('foo')).to.be(null); - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setId('foo'); source.addFeature(feature); expect(source.getFeatureById('foo')).to.be(feature); @@ -424,7 +424,7 @@ describe('ol.source.Vector', function() { it('requests the view extent plus render buffer', function(done) { var center = [-97.6114, 38.8403]; - var source = new _ol_source_Vector_({ + var source = new VectorSource({ strategy: _ol_loadingstrategy_.bbox, loader: function(extent) { setTimeout(function() { @@ -441,11 +441,11 @@ describe('ol.source.Vector', function() { var map = new Map({ target: div, layers: [ - new _ol_layer_Vector_({ + new VectorLayer({ source: source }) ], - view: new _ol_View_({ + view: new View({ center: fromLonLat(center), zoom: 7 }) @@ -460,7 +460,7 @@ describe('ol.source.Vector', function() { describe('with no loader and the "all" strategy', function() { it('stores the infinity extent in the Rtree', function() { - var source = new _ol_source_Vector_(); + var source = new VectorSource(); source.loadFeatures([-10000, -10000, 10000, 10000], 1, getProjection('EPSG:3857')); var loadedExtents = source.loadedExtentsRtree_.getAll(); @@ -481,7 +481,7 @@ describe('ol.source.Vector', function() { var loader2 = function(bbox, resolution, projection) { count2++; }; - var source = new _ol_source_Vector_({loader: loader1}); + var source = new VectorSource({loader: loader1}); source.loadFeatures([-10000, -10000, 10000, 10000], 1, getProjection('EPSG:3857')); source.setLoader(loader2); @@ -493,7 +493,7 @@ describe('ol.source.Vector', function() { }); it('removes extents with #removeLoadedExtent()', function(done) { - var source = new _ol_source_Vector_(); + var source = new VectorSource(); source.setLoader(function(bbox, resolution, projection) { setTimeout(function() { expect(source.loadedExtentsRtree_.getAll()).to.have.length(1); @@ -511,14 +511,14 @@ describe('ol.source.Vector', function() { describe('the feature id index', function() { var source; beforeEach(function() { - source = new _ol_source_Vector_(); + source = new VectorSource(); }); it('ignores features with the same id', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.setId('foo'); source.addFeature(feature); - var dupe = new _ol_Feature_(); + var dupe = new Feature(); dupe.setId('foo'); source.addFeature(dupe); expect(source.getFeatures()).to.have.length(1); @@ -526,10 +526,10 @@ describe('ol.source.Vector', function() { }); it('allows changing feature and set the same id', function() { - var foo = new _ol_Feature_(); + var foo = new Feature(); foo.setId('foo'); source.addFeature(foo); - var bar = new _ol_Feature_(); + var bar = new Feature(); bar.setId('bar'); source.addFeature(bar); bar.setId('foo'); @@ -541,11 +541,11 @@ describe('ol.source.Vector', function() { describe('the undefined feature id index', function() { var source; beforeEach(function() { - source = new _ol_source_Vector_(); + source = new VectorSource(); }); it('disallows adding the same feature twice', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); source.addFeature(feature); expect(function() { source.addFeature(feature); @@ -556,7 +556,7 @@ describe('ol.source.Vector', function() { describe('with useSpatialIndex set to false', function() { var source; beforeEach(function() { - source = new _ol_source_Vector_({useSpatialIndex: false}); + source = new VectorSource({useSpatialIndex: false}); }); it('returns a features collection', function() { @@ -564,7 +564,7 @@ describe('ol.source.Vector', function() { }); it('#forEachFeatureInExtent loops through all features', function() { - source.addFeatures([new _ol_Feature_(), new _ol_Feature_()]); + source.addFeatures([new Feature(), new Feature()]); var spy = sinon.spy(); source.forEachFeatureInExtent([0, 0, 0, 0], spy); expect(spy.callCount).to.be(2); @@ -575,7 +575,7 @@ describe('ol.source.Vector', function() { describe('with a collection of features', function() { var collection, source; beforeEach(function() { - source = new _ol_source_Vector_({ + source = new VectorSource({ useSpatialIndex: false }); collection = source.getFeaturesCollection(); @@ -586,7 +586,7 @@ describe('ol.source.Vector', function() { }); it('adding/removing features keeps the collection in sync', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); source.addFeature(feature); expect(collection.getLength()).to.be(1); source.removeFeature(feature); @@ -594,7 +594,7 @@ describe('ol.source.Vector', function() { }); it('#clear() features keeps the collection in sync', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); source.addFeatures([feature]); expect(collection.getLength()).to.be(1); source.clear(); @@ -606,7 +606,7 @@ describe('ol.source.Vector', function() { }); it('keeps the source\'s features in sync with the collection', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); collection.push(feature); expect(source.getFeatures().length).to.be(1); collection.remove(feature); @@ -623,7 +623,7 @@ describe('ol.source.Vector', function() { var collection, source; beforeEach(function() { collection = new _ol_Collection_(); - source = new _ol_source_Vector_({ + source = new VectorSource({ features: collection }); }); @@ -633,7 +633,7 @@ describe('ol.source.Vector', function() { }); it('adding/removing features keeps the collection in sync', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); source.addFeature(feature); expect(collection.getLength()).to.be(1); source.removeFeature(feature); @@ -641,7 +641,7 @@ describe('ol.source.Vector', function() { }); it('#clear() features keeps the collection in sync', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); source.addFeatures([feature]); expect(collection.getLength()).to.be(1); source.clear(); @@ -653,7 +653,7 @@ describe('ol.source.Vector', function() { }); it('keeps the source\'s features in sync with the collection', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); collection.push(feature); expect(source.getFeatures().length).to.be(1); collection.remove(feature); diff --git a/test/spec/ol/source/vectortile.test.js b/test/spec/ol/source/vectortile.test.js index efd38bfab6..4838982c06 100644 --- a/test/spec/ol/source/vectortile.test.js +++ b/test/spec/ol/source/vectortile.test.js @@ -1,18 +1,18 @@ import Map from '../../../../src/ol/Map.js'; -import _ol_View_ from '../../../../src/ol/View.js'; +import View from '../../../../src/ol/View.js'; import VectorImageTile from '../../../../src/ol/VectorImageTile.js'; import VectorTile from '../../../../src/ol/VectorTile.js'; import MVT from '../../../../src/ol/format/MVT.js'; import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; -import _ol_source_VectorTile_ from '../../../../src/ol/source/VectorTile.js'; +import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js'; describe('ol.source.VectorTile', function() { var format = new MVT(); - var source = new _ol_source_VectorTile_({ + var source = new VectorTileSource({ format: format, tilePixelRatio: 8, url: 'spec/ol/data/{z}-{x}-{y}.vector.pbf' @@ -96,7 +96,7 @@ describe('ol.source.VectorTile', function() { var extent = [665584.2026596286, 7033250.839875697, 667162.0221431496, 7035280.378636755]; - source = new _ol_source_VectorTile_({ + source = new VectorTileSource({ tileGrid: new TileGrid({ origin: [218128, 6126002], resolutions: [4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 0.5] @@ -117,7 +117,7 @@ describe('ol.source.VectorTile', function() { }) ], target: target, - view: new _ol_View_({ + view: new View({ zoom: 11, center: [666373.1624999996, 7034265.3572] }) diff --git a/test/spec/ol/source/wmts.test.js b/test/spec/ol/source/wmts.test.js index 64dcc61cf1..78f8194359 100644 --- a/test/spec/ol/source/wmts.test.js +++ b/test/spec/ol/source/wmts.test.js @@ -2,7 +2,7 @@ import _ol_format_WMTSCapabilities_ from '../../../../src/ol/format/WMTSCapabili import {get as getProjection} from '../../../../src/ol/proj.js'; import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; import WMTSTileGrid from '../../../../src/ol/tilegrid/WMTS.js'; -import _ol_source_WMTS_ from '../../../../src/ol/source/WMTS.js'; +import WMTS from '../../../../src/ol/source/WMTS.js'; describe('ol.source.WMTS', function() { @@ -23,7 +23,7 @@ describe('ol.source.WMTS', function() { }); it('returns null if the layer was not found in the capabilities', function() { - var options = _ol_source_WMTS_.optionsFromCapabilities(capabilities, { + var options = WMTS.optionsFromCapabilities(capabilities, { layer: 'invalid' }); @@ -31,7 +31,7 @@ describe('ol.source.WMTS', function() { }); it('passes the crossOrigin option', function() { - var options = _ol_source_WMTS_.optionsFromCapabilities(capabilities, { + var options = WMTS.optionsFromCapabilities(capabilities, { layer: 'BlueMarbleNextGeneration', matrixSet: 'google3857', crossOrigin: '' @@ -42,7 +42,7 @@ describe('ol.source.WMTS', function() { it('can create KVP options from spec/ol/format/wmts/ogcsample.xml', function() { - var options = _ol_source_WMTS_.optionsFromCapabilities( + var options = WMTS.optionsFromCapabilities( capabilities, {layer: 'BlueMarbleNextGeneration', matrixSet: 'google3857'}); @@ -74,7 +74,7 @@ describe('ol.source.WMTS', function() { it('can create REST options from spec/ol/format/wmts/ogcsample.xml', function() { - var options = _ol_source_WMTS_.optionsFromCapabilities(capabilities, { + var options = WMTS.optionsFromCapabilities(capabilities, { layer: 'BlueMarbleNextGeneration', matrixSet: 'google3857', requestEncoding: 'REST' @@ -105,7 +105,7 @@ describe('ol.source.WMTS', function() { }); it('can find a MatrixSet by SRS identifier', function() { - var options = _ol_source_WMTS_.optionsFromCapabilities(capabilities, { + var options = WMTS.optionsFromCapabilities(capabilities, { layer: 'BlueMarbleNextGeneration', projection: 'EPSG:3857', requestEncoding: 'REST' @@ -116,7 +116,7 @@ describe('ol.source.WMTS', function() { }); it('can find a MatrixSet by equivalent SRS identifier', function() { - var options = _ol_source_WMTS_.optionsFromCapabilities(capabilities, { + var options = WMTS.optionsFromCapabilities(capabilities, { layer: 'BlueMarbleNextGeneration', projection: 'EPSG:900913', requestEncoding: 'REST' @@ -127,7 +127,7 @@ describe('ol.source.WMTS', function() { }); it('can find the default MatrixSet', function() { - var options = _ol_source_WMTS_.optionsFromCapabilities(capabilities, { + var options = WMTS.optionsFromCapabilities(capabilities, { layer: 'BlueMarbleNextGeneration', requestEncoding: 'REST' }); @@ -137,7 +137,7 @@ describe('ol.source.WMTS', function() { }); it('uses the projection of the default MatrixSet if the config\'s projection is not supported', function() { - var options = _ol_source_WMTS_.optionsFromCapabilities(capabilities, { + var options = WMTS.optionsFromCapabilities(capabilities, { layer: 'BlueMarbleNextGeneration', projection: new _ol_proj_Projection_({ code: 'EPSG:2056', @@ -153,7 +153,7 @@ describe('ol.source.WMTS', function() { var tmpXml = content.replace(//g, ''); var tmpCapabilities = parser.read(tmpXml); expect(tmpCapabilities['OperationsMetadata']['GetTile']['DCP']['HTTP']['Get'][0]['Constraint']).to.be(undefined); - var options = _ol_source_WMTS_.optionsFromCapabilities(tmpCapabilities, + var options = WMTS.optionsFromCapabilities(tmpCapabilities, {layer: 'BlueMarbleNextGeneration', matrixSet: 'google3857'}); expect(options.layer).to.be.eql('BlueMarbleNextGeneration'); expect(options.matrixSet).to.be.eql('google3857'); @@ -166,7 +166,7 @@ describe('ol.source.WMTS', function() { var tmpCapabilities = parser.read(tmpXml); expect(tmpCapabilities['OperationsMetadata']['GetTile']['DCP']['HTTP']['Get'][0]['Constraint']).to.be(undefined); expect(tmpCapabilities['Contents']['Layer'][0]['ResourceURL']).to.be(undefined); - var options = _ol_source_WMTS_.optionsFromCapabilities(tmpCapabilities, + var options = WMTS.optionsFromCapabilities(tmpCapabilities, {layer: 'BlueMarbleNextGeneration', matrixSet: 'google3857'}); expect(options.layer).to.be.eql('BlueMarbleNextGeneration'); expect(options.matrixSet).to.be.eql('google3857'); @@ -180,7 +180,7 @@ describe('ol.source.WMTS', function() { it('can replace lowercase REST parameters', function() { - var source = new _ol_source_WMTS_({ + var source = new WMTS({ layer: 'layer', style: 'default', urls: ['http://www.example.com/wmts/coastlines/{layer}/{style}/' + @@ -206,7 +206,7 @@ describe('ol.source.WMTS', function() { it('can replace camelcase REST parameters', function() { - var source = new _ol_source_WMTS_({ + var source = new WMTS({ layer: 'layer', style: 'default', urls: ['http://www.example.com/wmts/coastlines/{Layer}/{Style}/' + @@ -247,7 +247,7 @@ describe('ol.source.WMTS', function() { it('can create KVP options from spec/ol/format/wmts/arcgis.xml', function() { - var options = _ol_source_WMTS_.optionsFromCapabilities( + var options = WMTS.optionsFromCapabilities( capabilities, { layer: 'Demographics_USA_Population_Density', requestEncoding: 'KVP', @@ -263,7 +263,7 @@ describe('ol.source.WMTS', function() { it('can create REST options from spec/ol/format/wmts/arcgis.xml', function() { - var options = _ol_source_WMTS_.optionsFromCapabilities( + var options = WMTS.optionsFromCapabilities( capabilities, { layer: 'Demographics_USA_Population_Density', matrixSet: 'default028mm' @@ -281,7 +281,7 @@ describe('ol.source.WMTS', function() { describe('#setUrls()', function() { it('sets the URL for the source', function() { - var source = new _ol_source_WMTS_({}); + var source = new WMTS({}); var urls = [ 'https://a.example.com/', @@ -294,7 +294,7 @@ describe('ol.source.WMTS', function() { }); it('updates the key for the source', function() { - var source = new _ol_source_WMTS_({}); + var source = new WMTS({}); var urls = [ 'https://a.example.com/', @@ -308,7 +308,7 @@ describe('ol.source.WMTS', function() { it('generates the correct tileUrlFunction during application of setUrl()', function() { var projection = getProjection('EPSG:3857'); - var source = new _ol_source_WMTS_({ + var source = new WMTS({ projection: projection, requestEncoding: 'REST', urls: [ @@ -334,7 +334,7 @@ describe('ol.source.WMTS', function() { describe('url option', function() { it('expands url template', function() { - var tileSource = new _ol_source_WMTS_({ + var tileSource = new WMTS({ url: '{1-3}' }); @@ -365,7 +365,7 @@ describe('ol.source.WMTS', function() { describe('using a "url" option', function() { beforeEach(function() { sourceOptions.url = 'some_wmts_url'; - source = new _ol_source_WMTS_(sourceOptions); + source = new WMTS(sourceOptions); }); it('returns the WMTS URLs', function() { @@ -378,7 +378,7 @@ describe('ol.source.WMTS', function() { describe('using a "urls" option', function() { beforeEach(function() { sourceOptions.urls = ['some_wmts_url1', 'some_wmts_url2']; - source = new _ol_source_WMTS_(sourceOptions); + source = new WMTS(sourceOptions); }); it('returns the WMTS URLs', function() { @@ -395,7 +395,7 @@ describe('ol.source.WMTS', function() { var source; beforeEach(function() { - source = new _ol_source_WMTS_({ + source = new WMTS({ layer: 'layer', style: 'default', matrixSet: 'foo', diff --git a/test/spec/ol/source/xyz.test.js b/test/spec/ol/source/xyz.test.js index d08190bed7..a06ccd00fa 100644 --- a/test/spec/ol/source/xyz.test.js +++ b/test/spec/ol/source/xyz.test.js @@ -1,7 +1,7 @@ -import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js'; -import _ol_source_TileImage_ from '../../../../src/ol/source/TileImage.js'; -import _ol_source_UrlTile_ from '../../../../src/ol/source/UrlTile.js'; -import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js'; +import TileSource from '../../../../src/ol/source/Tile.js'; +import TileImage from '../../../../src/ol/source/TileImage.js'; +import UrlTile from '../../../../src/ol/source/UrlTile.js'; +import XYZ from '../../../../src/ol/source/XYZ.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -10,30 +10,30 @@ describe('ol.source.XYZ', function() { describe('constructor', function() { it('can be constructed without options', function() { - var source = new _ol_source_XYZ_(); - expect(source).to.be.an(_ol_source_XYZ_); - expect(source).to.be.an(_ol_source_TileImage_); - expect(source).to.be.an(_ol_source_UrlTile_); - expect(source).to.be.an(_ol_source_Tile_); + var source = new XYZ(); + expect(source).to.be.an(XYZ); + expect(source).to.be.an(TileImage); + expect(source).to.be.an(UrlTile); + expect(source).to.be.an(TileSource); }); it('can be constructed with a custom tile grid', function() { var tileGrid = _ol_tilegrid_.createXYZ(); - var tileSource = new _ol_source_XYZ_({ + var tileSource = new XYZ({ tileGrid: tileGrid }); expect(tileSource.getTileGrid()).to.be(tileGrid); }); it('can be constructed with a custom tile size', function() { - var tileSource = new _ol_source_XYZ_({ + var tileSource = new XYZ({ tileSize: 512 }); expect(tileSource.getTileGrid().getTileSize(0)).to.be(512); }); it('can be constructed with a custom min zoom', function() { - var tileSource = new _ol_source_XYZ_({ + var tileSource = new XYZ({ minZoom: 2 }); expect(tileSource.getTileGrid().getMinZoom()).to.be(2); @@ -46,7 +46,7 @@ describe('ol.source.XYZ', function() { var xyzTileSource, tileGrid; beforeEach(function() { - xyzTileSource = new _ol_source_XYZ_({ + xyzTileSource = new XYZ({ maxZoom: 6, url: '{z}/{x}/{y}' }); @@ -149,7 +149,7 @@ describe('ol.source.XYZ', function() { describe('using a "url" option', function() { beforeEach(function() { sourceOptions.url = url; - source = new _ol_source_XYZ_(sourceOptions); + source = new XYZ(sourceOptions); }); it('returns the XYZ URL', function() { @@ -162,7 +162,7 @@ describe('ol.source.XYZ', function() { describe('using a "urls" option', function() { beforeEach(function() { sourceOptions.urls = ['some_xyz_url1', 'some_xyz_url2']; - source = new _ol_source_XYZ_(sourceOptions); + source = new XYZ(sourceOptions); }); it('returns the XYZ URLs', function() { @@ -177,7 +177,7 @@ describe('ol.source.XYZ', function() { sourceOptions.tileUrlFunction = function() { return 'some_xyz_url'; }; - source = new _ol_source_XYZ_(sourceOptions); + source = new XYZ(sourceOptions); }); it('returns null', function() { diff --git a/test/spec/ol/source/zoomify.test.js b/test/spec/ol/source/zoomify.test.js index 619570ac00..0d529a4e5c 100644 --- a/test/spec/ol/source/zoomify.test.js +++ b/test/spec/ol/source/zoomify.test.js @@ -1,7 +1,7 @@ import {DEFAULT_TILE_SIZE} from '../../../../src/ol/tilegrid/common.js'; import _ol_events_ from '../../../../src/ol/events.js'; import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; -import _ol_source_Zoomify_ from '../../../../src/ol/source/Zoomify.js'; +import Zoomify from '../../../../src/ol/source/Zoomify.js'; import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js'; @@ -17,26 +17,26 @@ describe('ol.source.Zoomify', function() { extent: [0, 0, w, h] }); function getZoomifySource() { - return new _ol_source_Zoomify_({ + return new Zoomify({ url: zoomifyUrl, size: size }); } function getZoomifySourceWithExtentInFirstQuadrant() { - return new _ol_source_Zoomify_({ + return new Zoomify({ url: zoomifyUrl, size: size, extent: [0, 0, size[0], size[1]] }); } function getIIPSource() { - return new _ol_source_Zoomify_({ + return new Zoomify({ url: iipUrl, size: size }); } function getZoomifySourceWith1024pxTiles() { - return new _ol_source_Zoomify_({ + return new Zoomify({ url: zoomifyUrl, size: size, tileSize: 1024 @@ -50,29 +50,29 @@ describe('ol.source.Zoomify', function() { // undefined config object expect(function() { - source = new _ol_source_Zoomify_(); + source = new Zoomify(); }).to.throwException(); // empty object as config object expect(function() { - source = new _ol_source_Zoomify_({}); + source = new Zoomify({}); }).to.throwException(); // not passing "size" in config object expect(function() { - source = new _ol_source_Zoomify_({ + source = new Zoomify({ url: 'some-url' }); }).to.throwException(); // passing "size" in config object expect(function() { - source = new _ol_source_Zoomify_({ + source = new Zoomify({ size: [47, 11] }); }).to.not.throwException(); // we got a source - expect(source).to.be.a(_ol_source_Zoomify_); + expect(source).to.be.a(Zoomify); // also test our helper methods from above expect(function() { @@ -82,12 +82,12 @@ describe('ol.source.Zoomify', function() { source = getIIPSource(); }).to.not.throwException(); // we got a source - expect(source).to.be.a(_ol_source_Zoomify_); + expect(source).to.be.a(Zoomify); }); it('does not need "tierSizeCalculation" option', function() { expect(function() { - new _ol_source_Zoomify_({ + new Zoomify({ size: [47, 11] }); }).to.not.throwException(); @@ -95,7 +95,7 @@ describe('ol.source.Zoomify', function() { it('accepts "tierSizeCalculation" option "default"', function() { expect(function() { - new _ol_source_Zoomify_({ + new Zoomify({ size: [47, 11], tierSizeCalculation: 'default' }); @@ -104,7 +104,7 @@ describe('ol.source.Zoomify', function() { it('accepts "tierSizeCalculation" option "truncated"', function() { expect(function() { - new _ol_source_Zoomify_({ + new Zoomify({ size: [47, 11], tierSizeCalculation: 'truncated' }); @@ -114,7 +114,7 @@ describe('ol.source.Zoomify', function() { it('throws on unexpected "tierSizeCalculation" ', function() { // passing unknown string will throw expect(function() { - new _ol_source_Zoomify_({ + new Zoomify({ size: [47, 11], tierSizeCalculation: 'ace-of-spades' }); @@ -199,14 +199,14 @@ describe('ol.source.Zoomify', function() { it('influences resolutions', function() { // not configured at all - var source = new _ol_source_Zoomify_({ + var source = new Zoomify({ url: zoomifyUrl, size: [513, 256] }); var tileGrid = source.getTileGrid(); // explicitly set as 'default' - var sourceDefault = new _ol_source_Zoomify_({ + var sourceDefault = new Zoomify({ url: zoomifyUrl, size: [513, 256], tierSizeCalculation: 'default' @@ -214,7 +214,7 @@ describe('ol.source.Zoomify', function() { var tileGridDefault = sourceDefault.getTileGrid(); // explicitly set to 'truncated' - var sourceTruncated = new _ol_source_Zoomify_({ + var sourceTruncated = new Zoomify({ url: zoomifyUrl, size: [513, 256], tierSizeCalculation: 'truncated' @@ -254,7 +254,7 @@ describe('ol.source.Zoomify', function() { }); it('creates an expected tileUrlFunction without template', function() { - var source = new _ol_source_Zoomify_({ + var source = new Zoomify({ url: 'spec/ol/source/images/zoomify/', size: size }); @@ -280,7 +280,7 @@ describe('ol.source.Zoomify', function() { it('returns expected tileClass instances via "getTile"', function() { var source = getZoomifySource(); var tile = source.getTile(0, 0, -1, 1, proj); - expect(tile).to.be.an(_ol_source_Zoomify_.Tile_); + expect(tile).to.be.an(Zoomify.Tile_); }); it('"tile.getImage" returns and caches an unloaded image', function() { diff --git a/test/spec/ol/style/style.test.js b/test/spec/ol/style/style.test.js index 97512f5a60..955a9d9e3e 100644 --- a/test/spec/ol/style/style.test.js +++ b/test/spec/ol/style/style.test.js @@ -1,4 +1,4 @@ -import _ol_Feature_ from '../../../../src/ol/Feature.js'; +import Feature from '../../../../src/ol/Feature.js'; import Point from '../../../../src/ol/geom/Point.js'; import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; @@ -194,7 +194,7 @@ describe('ol.style.Style', function() { var style = new _ol_style_Style_(); it('creates a geometry function from a string', function() { - var feature = new _ol_Feature_(); + var feature = new Feature(); feature.set('myGeom', new Point([0, 0])); style.setGeometry('myGeom'); expect(style.getGeometryFunction()(feature)) diff --git a/test/spec/ol/tilequeue.test.js b/test/spec/ol/tilequeue.test.js index 2b62283534..9de2401f78 100644 --- a/test/spec/ol/tilequeue.test.js +++ b/test/spec/ol/tilequeue.test.js @@ -2,7 +2,7 @@ import ImageTile from '../../../src/ol/ImageTile.js'; import _ol_Tile_ from '../../../src/ol/Tile.js'; import TileQueue from '../../../src/ol/TileQueue.js'; import TileState from '../../../src/ol/TileState.js'; -import _ol_source_Image_ from '../../../src/ol/source/Image.js'; +import ImageSource from '../../../src/ol/source/Image.js'; import PriorityQueue from '../../../src/ol/structs/PriorityQueue.js'; @@ -32,7 +32,7 @@ describe('ol.TileQueue', function() { 'yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=='; var tileLoadFunction = opt_tileLoadFunction ? - opt_tileLoadFunction : _ol_source_Image_.defaultImageLoadFunction; + opt_tileLoadFunction : ImageSource.defaultImageLoadFunction; return new ImageTile(tileCoord, state, src, null, tileLoadFunction); } diff --git a/test/spec/ol/vectortile.test.js b/test/spec/ol/vectortile.test.js index 866195b636..d129e92f3f 100644 --- a/test/spec/ol/vectortile.test.js +++ b/test/spec/ol/vectortile.test.js @@ -1,4 +1,4 @@ -import _ol_Feature_ from '../../../src/ol/Feature.js'; +import Feature from '../../../src/ol/Feature.js'; import {defaultLoadFunction} from '../../../src/ol/VectorImageTile.js'; import VectorTile from '../../../src/ol/VectorTile.js'; import _ol_events_ from '../../../src/ol/events.js'; @@ -19,7 +19,7 @@ describe('ol.VectorTile', function() { }); }; format.readFeatures = function(source, options) { - return [new _ol_Feature_()]; + return [new Feature()]; }; var tile = new VectorTile([0, 0, 0], null, null, format); diff --git a/test/spec/ol/view.test.js b/test/spec/ol/view.test.js index 19743e9815..f179e89b5c 100644 --- a/test/spec/ol/view.test.js +++ b/test/spec/ol/view.test.js @@ -1,6 +1,6 @@ import Map from '../../../src/ol/Map.js'; -import _ol_View_ from '../../../src/ol/View.js'; -import _ol_ViewHint_ from '../../../src/ol/ViewHint.js'; +import View from '../../../src/ol/View.js'; +import ViewHint from '../../../src/ol/ViewHint.js'; import * as _ol_extent_ from '../../../src/ol/extent.js'; import Circle from '../../../src/ol/geom/Circle.js'; import LineString from '../../../src/ol/geom/LineString.js'; @@ -12,11 +12,11 @@ describe('ol.View', function() { var view; beforeEach(function() { - view = new _ol_View_(); + view = new View(); }); it('creates an instance', function() { - expect(view).to.be.a(_ol_View_); + expect(view).to.be.a(View); }); it('provides default rotation', function() { @@ -32,7 +32,7 @@ describe('ol.View', function() { describe('with no options', function() { it('gives a correct center constraint function', function() { var options = {}; - var fn = _ol_View_.createCenterConstraint_(options); + var fn = View.createCenterConstraint_(options); expect(fn([0, 0])).to.eql([0, 0]); expect(fn(undefined)).to.eql(undefined); expect(fn([42, -100])).to.eql([42, -100]); @@ -44,7 +44,7 @@ describe('ol.View', function() { var options = { extent: [0, 0, 1, 1] }; - var fn = _ol_View_.createCenterConstraint_(options); + var fn = View.createCenterConstraint_(options); expect(fn([0, 0])).to.eql([0, 0]); expect(fn([-10, 0])).to.eql([0, 0]); expect(fn([100, 100])).to.eql([1, 1]); @@ -58,7 +58,7 @@ describe('ol.View', function() { describe('with no options', function() { it('gives a correct resolution constraint function', function() { var options = {}; - var fn = _ol_View_.createResolutionConstraint_(options).constraint; + var fn = View.createResolutionConstraint_(options).constraint; expect(fn(156543.03392804097, 0, 0)) .to.roughlyEqual(156543.03392804097, 1e-9); expect(fn(78271.51696402048, 0, 0)) @@ -74,7 +74,7 @@ describe('ol.View', function() { maxZoom: 3, zoomFactor: 3 }; - var info = _ol_View_.createResolutionConstraint_(options); + var info = View.createResolutionConstraint_(options); var maxResolution = info.maxResolution; expect(maxResolution).to.eql(81); var minResolution = info.minResolution; @@ -94,7 +94,7 @@ describe('ol.View', function() { var options = { resolutions: [97, 76, 65, 54, 0.45] }; - var info = _ol_View_.createResolutionConstraint_(options); + var info = View.createResolutionConstraint_(options); var maxResolution = info.maxResolution; expect(maxResolution).to.eql(97); var minResolution = info.minResolution; @@ -112,7 +112,7 @@ describe('ol.View', function() { var defaultMaxRes = 156543.03392804097; function getConstraint(options) { - return _ol_View_.createResolutionConstraint_(options).constraint; + return View.createResolutionConstraint_(options).constraint; } it('works with only maxZoom', function() { @@ -179,7 +179,7 @@ describe('ol.View', function() { var defaultMaxRes = 156543.03392804097; function getConstraint(options) { - return _ol_View_.createResolutionConstraint_(options).constraint; + return View.createResolutionConstraint_(options).constraint; } it('works with only maxResolution', function() { @@ -248,7 +248,7 @@ describe('ol.View', function() { var defaultMaxRes = 156543.03392804097; function getConstraint(options) { - return _ol_View_.createResolutionConstraint_(options).constraint; + return View.createResolutionConstraint_(options).constraint; } it('respects maxResolution over minZoom', function() { @@ -292,7 +292,7 @@ describe('ol.View', function() { describe('create rotation constraint', function() { it('gives a correct rotation constraint function', function() { var options = {}; - var fn = _ol_View_.createRotationConstraint_(options); + var fn = View.createRotationConstraint_(options); expect(fn(0.01, 0)).to.eql(0); expect(fn(0.15, 0)).to.eql(0.15); }); @@ -303,7 +303,7 @@ describe('ol.View', function() { describe('#setHint()', function() { it('changes a view hint', function() { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0 }); @@ -311,13 +311,13 @@ describe('ol.View', function() { expect(view.getHints()).to.eql([0, 0]); expect(view.getInteracting()).to.eql(false); - view.setHint(_ol_ViewHint_.INTERACTING, 1); + view.setHint(ViewHint.INTERACTING, 1); expect(view.getHints()).to.eql([0, 1]); expect(view.getInteracting()).to.eql(true); }); it('triggers the change event', function(done) { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0 }); @@ -327,7 +327,7 @@ describe('ol.View', function() { expect(view.getInteracting()).to.eql(true); done(); }); - view.setHint(_ol_ViewHint_.INTERACTING, 1); + view.setHint(ViewHint.INTERACTING, 1); }); }); @@ -335,7 +335,7 @@ describe('ol.View', function() { describe('#getUpdatedOptions_()', function() { it('applies minZoom to constructor options', function() { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], minZoom: 2, zoom: 10 @@ -348,7 +348,7 @@ describe('ol.View', function() { }); it('applies the current zoom', function() { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 10 }); @@ -360,7 +360,7 @@ describe('ol.View', function() { }); it('applies the current resolution if resolution was originally supplied', function() { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], resolution: 1000 }); @@ -372,7 +372,7 @@ describe('ol.View', function() { }); it('applies the current center', function() { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 10 }); @@ -384,7 +384,7 @@ describe('ol.View', function() { }); it('applies the current rotation', function() { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 10 }); @@ -418,7 +418,7 @@ describe('ol.View', function() { }); it('can be called to animate view properties', function(done) { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 5 }); @@ -438,7 +438,7 @@ describe('ol.View', function() { }); it('allows duration to be zero', function(done) { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 5 }); @@ -457,7 +457,7 @@ describe('ol.View', function() { }); it('immediately completes for no-op animations', function() { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 5 }); @@ -471,7 +471,7 @@ describe('ol.View', function() { }); it('immediately completes if view is not defined before', function() { - var view = new _ol_View_(); + var view = new View(); var center = [1, 2]; var zoom = 3; var rotation = 0.4; @@ -489,7 +489,7 @@ describe('ol.View', function() { }); it('sets final animation state if view is not defined before', function() { - var view = new _ol_View_(); + var view = new View(); var center = [1, 2]; var zoom = 3; @@ -514,7 +514,7 @@ describe('ol.View', function() { }); it('prefers zoom over resolution', function(done) { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 5 }); @@ -532,7 +532,7 @@ describe('ol.View', function() { it('avoids going under minResolution', function(done) { var maxZoom = 14; - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0, maxZoom: maxZoom @@ -551,7 +551,7 @@ describe('ol.View', function() { }); it('takes the shortest arc to the target rotation', function(done) { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0, rotation: Math.PI / 180 * 1 @@ -566,7 +566,7 @@ describe('ol.View', function() { }); it('normalizes rotation to angles between -180 and 180 degrees after the anmiation', function(done) { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0, rotation: Math.PI / 180 * 1 @@ -581,7 +581,7 @@ describe('ol.View', function() { }); it('calls a callback when animation completes', function(done) { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0 }); @@ -596,7 +596,7 @@ describe('ol.View', function() { }); it('calls callback with false when animation is interrupted', function(done) { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0 }); @@ -613,7 +613,7 @@ describe('ol.View', function() { }); it('calls a callback even if animation is a no-op', function(done) { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0 }); @@ -628,7 +628,7 @@ describe('ol.View', function() { }); it('calls a callback if view is not defined before', function(done) { - var view = new _ol_View_(); + var view = new View(); view.animate({ zoom: 10, @@ -641,7 +641,7 @@ describe('ol.View', function() { }); it('can run multiple animations in series', function(done) { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0 }); @@ -670,7 +670,7 @@ describe('ol.View', function() { }); it('properly sets the ANIMATING hint', function(done) { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0, rotation: 0 @@ -680,7 +680,7 @@ describe('ol.View', function() { function decrement() { --count; if (count === 0) { - expect(view.getHints()[_ol_ViewHint_.ANIMATING]).to.be(0); + expect(view.getHints()[ViewHint.ANIMATING]).to.be(0); done(); } } @@ -688,24 +688,24 @@ describe('ol.View', function() { center: [1, 2], duration: 25 }, decrement); - expect(view.getHints()[_ol_ViewHint_.ANIMATING]).to.be(1); + expect(view.getHints()[ViewHint.ANIMATING]).to.be(1); view.animate({ zoom: 1, duration: 25 }, decrement); - expect(view.getHints()[_ol_ViewHint_.ANIMATING]).to.be(2); + expect(view.getHints()[ViewHint.ANIMATING]).to.be(2); view.animate({ rotation: Math.PI, duration: 25 }, decrement); - expect(view.getHints()[_ol_ViewHint_.ANIMATING]).to.be(3); + expect(view.getHints()[ViewHint.ANIMATING]).to.be(3); }); it('clears the ANIMATING hint when animations are cancelled', function() { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0, rotation: 0 @@ -715,29 +715,29 @@ describe('ol.View', function() { center: [1, 2], duration: 25 }); - expect(view.getHints()[_ol_ViewHint_.ANIMATING]).to.be(1); + expect(view.getHints()[ViewHint.ANIMATING]).to.be(1); view.animate({ zoom: 1, duration: 25 }); - expect(view.getHints()[_ol_ViewHint_.ANIMATING]).to.be(2); + expect(view.getHints()[ViewHint.ANIMATING]).to.be(2); view.animate({ rotation: Math.PI, duration: 25 }); - expect(view.getHints()[_ol_ViewHint_.ANIMATING]).to.be(3); + expect(view.getHints()[ViewHint.ANIMATING]).to.be(3); // cancel animations view.setCenter([10, 20]); - expect(view.getHints()[_ol_ViewHint_.ANIMATING]).to.be(0); + expect(view.getHints()[ViewHint.ANIMATING]).to.be(0); }); it('completes multiple staggered animations run in parallel', function(done) { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0 }); @@ -770,7 +770,7 @@ describe('ol.View', function() { it('completes complex animation using resolution', function(done) { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], resolution: 2 }); @@ -841,7 +841,7 @@ describe('ol.View', function() { }); it('cancels a currently running animation', function(done) { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0, rotation: 0 @@ -863,7 +863,7 @@ describe('ol.View', function() { }); it('cancels a multiple animations', function(done) { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0, rotation: 0 @@ -893,7 +893,7 @@ describe('ol.View', function() { }); it('calls callbacks with false to indicate animations did not complete', function(done) { - var view = new _ol_View_({ + var view = new View({ center: [0, 0], zoom: 0 }); @@ -920,14 +920,14 @@ describe('ol.View', function() { var resolutions = [512, 256, 128, 64, 32, 16]; it('returns correct resolutions', function() { - view = new _ol_View_({ + view = new View({ resolutions: resolutions }); expect(view.getResolutions()).to.be(resolutions); }); it('returns resolutions as undefined', function() { - view = new _ol_View_(); + view = new View(); expect(view.getResolutions()).to.be(undefined); }); }); @@ -935,7 +935,7 @@ describe('ol.View', function() { describe('#getZoom', function() { var view; beforeEach(function() { - view = new _ol_View_({ + view = new View({ resolutions: [512, 256, 128, 64, 32, 16] }); }); @@ -967,7 +967,7 @@ describe('ol.View', function() { }); it('works for resolution arrays with variable zoom factors', function() { - var view = new _ol_View_({ + var view = new View({ resolutions: [10, 5, 2, 1] }); @@ -991,7 +991,7 @@ describe('ol.View', function() { describe('#getZoom() - constrained', function() { it('returns correct zoom levels', function() { - var view = new _ol_View_({ + var view = new View({ minZoom: 10, maxZoom: 20 }); @@ -1020,7 +1020,7 @@ describe('ol.View', function() { it('gives maxResolution precedence over minZoom', function() { - var view = new _ol_View_({ + var view = new View({ maxResolution: 100, minZoom: 2 // this should get ignored }); @@ -1036,7 +1036,7 @@ describe('ol.View', function() { describe('#getZoomForResolution', function() { it('returns correct zoom levels', function() { - var view = new _ol_View_(); + var view = new View(); var max = view.getMaxResolution(); expect(view.getZoomForResolution(max)).to.be(0); @@ -1049,7 +1049,7 @@ describe('ol.View', function() { }); it('returns correct zoom levels for specifically configured resolutions', function() { - var view = new _ol_View_({ + var view = new View({ resolutions: [10, 8, 6, 4, 2] }); @@ -1069,7 +1069,7 @@ describe('ol.View', function() { describe('#getResolutionForZoom', function() { it('returns correct zoom resolution', function() { - var view = new _ol_View_(); + var view = new View(); var max = view.getMaxZoom(); var min = view.getMinZoom(); @@ -1078,7 +1078,7 @@ describe('ol.View', function() { }); it('returns correct zoom levels for specifically configured resolutions', function() { - var view = new _ol_View_({ + var view = new View({ resolutions: [10, 8, 6, 4, 2] }); @@ -1094,12 +1094,12 @@ describe('ol.View', function() { describe('#getMaxZoom', function() { it('returns the zoom level for the min resolution', function() { - var view = new _ol_View_(); + var view = new View(); expect(view.getMaxZoom()).to.be(view.getZoomForResolution(view.getMinResolution())); }); it('works for a view configured with a maxZoom', function() { - var view = new _ol_View_({ + var view = new View({ maxZoom: 10 }); expect(view.getMaxZoom()).to.be(10); @@ -1110,12 +1110,12 @@ describe('ol.View', function() { describe('#getMinZoom', function() { it('returns the zoom level for the max resolution', function() { - var view = new _ol_View_(); + var view = new View(); expect(view.getMinZoom()).to.be(view.getZoomForResolution(view.getMaxResolution())); }); it('works for views configured with a minZoom', function() { - var view = new _ol_View_({ + var view = new View({ minZoom: 3 }); expect(view.getMinZoom()).to.be(3); @@ -1126,7 +1126,7 @@ describe('ol.View', function() { describe('#setMaxZoom', function() { describe('with resolutions property in view', function() { it('changes the zoom level when the level is over max zoom', function() { - var view = new _ol_View_({ + var view = new View({ resolutions: [100000, 50000, 25000, 12500, 6250, 3125], zoom: 4 }); @@ -1138,7 +1138,7 @@ describe('ol.View', function() { describe('with no resolutions property in view', function() { it('changes the zoom level when the level is over max zoom', function() { - var view = new _ol_View_({ + var view = new View({ zoom: 4 }); @@ -1151,7 +1151,7 @@ describe('ol.View', function() { describe('#setMinZoom', function() { describe('with resolutions property in view', function() { it('changes the zoom level when the level is under min zoom', function() { - var view = new _ol_View_({ + var view = new View({ resolutions: [100000, 50000, 25000, 12500, 6250, 3125], zoom: 4 }); @@ -1163,7 +1163,7 @@ describe('ol.View', function() { describe('with no resolutions property in view', function() { it('changes the zoom level when the level is under min zoom', function() { - var view = new _ol_View_({ + var view = new View({ zoom: 4 }); @@ -1175,7 +1175,7 @@ describe('ol.View', function() { describe('#calculateExtent', function() { it('returns the expected extent', function() { - var view = new _ol_View_({ + var view = new View({ resolutions: [512], zoom: 0, center: [0, 0] @@ -1188,7 +1188,7 @@ describe('ol.View', function() { expect(extent[3]).to.be(51200); }); it('returns the expected extent with rotation', function() { - var view = new _ol_View_({ + var view = new View({ resolutions: [512], zoom: 0, center: [0, 0], @@ -1244,7 +1244,7 @@ describe('ol.View', function() { var view; beforeEach(function() { - view = new _ol_View_({ + view = new View({ center: [0, 0], resolutions: [200, 100, 50, 20, 10, 5, 2, 1], zoom: 5 @@ -1370,7 +1370,7 @@ describe('ol.View', function() { describe('centerOn', function() { var view; beforeEach(function() { - view = new _ol_View_({ + view = new View({ resolutions: [200, 100, 50, 20, 10, 5, 2, 1] }); }); @@ -1460,7 +1460,7 @@ describe('ol.View.isNoopAnimation()', function() { cases.forEach(function(c, i) { it('works for case ' + i, function() { - var noop = _ol_View_.isNoopAnimation(c.animation); + var noop = View.isNoopAnimation(c.animation); expect(noop).to.equal(c.noop); }); });