diff --git a/examples/webpack/example-builder.js b/examples/webpack/example-builder.js index 5f8b3cccd8..82eb7560ae 100644 --- a/examples/webpack/example-builder.js +++ b/examples/webpack/example-builder.js @@ -152,6 +152,9 @@ ExampleBuilder.prototype.render = async function(dir, chunk) { // add in script tag const jsName = `${name}.js`; let jsSource = getJsSource(chunk, path.join('.', jsName)); + if (!jsSource) { + throw new Error(`No .js source for ${jsName}`); + } jsSource = jsSource.replace(/'\.\.\/src\//g, '\''); if (data.cloak) { for (const entry of data.cloak) { diff --git a/rendering/cases/linestring-style-opacity/main.js b/rendering/cases/linestring-style-opacity/main.js index e663640825..710ef11bec 100644 --- a/rendering/cases/linestring-style-opacity/main.js +++ b/rendering/cases/linestring-style-opacity/main.js @@ -1,4 +1,4 @@ -import Map from '../../../src/ol/CompositeMap.js'; +import Map from '../../../src/ol/Map.js'; import View from '../../../src/ol/View.js'; import Feature from '../../../src/ol/Feature.js'; import LineString from '../../../src/ol/geom/LineString.js'; diff --git a/rendering/cases/linestring-style-rotation/main.js b/rendering/cases/linestring-style-rotation/main.js index f69bd1cf74..3a4031e89f 100644 --- a/rendering/cases/linestring-style-rotation/main.js +++ b/rendering/cases/linestring-style-rotation/main.js @@ -1,4 +1,4 @@ -import Map from '../../../src/ol/CompositeMap.js'; +import Map from '../../../src/ol/Map.js'; import View from '../../../src/ol/View.js'; import Feature from '../../../src/ol/Feature.js'; import LineString from '../../../src/ol/geom/LineString.js'; diff --git a/rendering/cases/linestring-style/main.js b/rendering/cases/linestring-style/main.js index d5cd8e4236..800659c76f 100644 --- a/rendering/cases/linestring-style/main.js +++ b/rendering/cases/linestring-style/main.js @@ -1,4 +1,4 @@ -import Map from '../../../src/ol/CompositeMap.js'; +import Map from '../../../src/ol/Map.js'; import View from '../../../src/ol/View.js'; import Feature from '../../../src/ol/Feature.js'; import LineString from '../../../src/ol/geom/LineString.js'; diff --git a/src/ol/CompositeMap.js b/src/ol/CompositeMap.js deleted file mode 100644 index 7050fd96f6..0000000000 --- a/src/ol/CompositeMap.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * @module ol/CompositeMap - */ -import PluggableMap from './PluggableMap.js'; -import {defaults as defaultControls} from './control/util.js'; -import {defaults as defaultInteractions} from './interaction.js'; -import {assign} from './obj.js'; -import CompositeMapRenderer from './renderer/Composite.js'; - -/** - * @classdesc - * The map is the core component of OpenLayers. For a map to render, a view, - * one or more layers, and a target container are needed: - * - * import Map from 'ol/Map'; - * import View from 'ol/View'; - * import TileLayer from 'ol/layer/Tile'; - * import OSM from 'ol/source/OSM'; - * - * var map = new Map({ - * view: new View({ - * center: [0, 0], - * zoom: 1 - * }), - * layers: [ - * new TileLayer({ - * source: new OSM() - * }) - * ], - * target: 'map' - * }); - * - * The above snippet creates a map using a {@link module:ol/layer/Tile} to - * display {@link module:ol/source/OSM~OSM} OSM data and render it to a DOM - * element with the id `map`. - * - * The constructor places a viewport container (with CSS class name - * `ol-viewport`) in the target element (see `getViewport()`), and then two - * further elements within the viewport: one with CSS class name - * `ol-overlaycontainer-stopevent` for controls and some overlays, and one with - * CSS class name `ol-overlaycontainer` for other overlays (see the `stopEvent` - * option of {@link module:ol/Overlay~Overlay} for the difference). The map - * itself is placed in a further element within the viewport. - * - * Layers are stored as a {@link module:ol/Collection~Collection} in - * layerGroups. A top-level group is provided by the library. This is what is - * accessed by `getLayerGroup` and `setLayerGroup`. Layers entered in the - * options are added to this group, and `addLayer` and `removeLayer` change the - * layer collection in the group. `getLayers` is a convenience function for - * `getLayerGroup().getLayers()`. Note that {@link module:ol/layer/Group~Group} - * is a subclass of {@link module:ol/layer/Base}, so layers entered in the - * options or added with `addLayer` can be groups, which can contain further - * groups, and so on. - * - * @fires import("./MapBrowserEvent.js").MapBrowserEvent - * @fires import("./MapEvent.js").MapEvent - * @fires module:ol/render/Event~RenderEvent#postcompose - * @fires module:ol/render/Event~RenderEvent#precompose - * @api - */ -class CompositeMap extends PluggableMap { - - /** - * @param {import("./PluggableMap.js").MapOptions} options Map options. - */ - constructor(options) { - options = assign({}, options); - if (!options.controls) { - options.controls = defaultControls(); - } - if (!options.interactions) { - options.interactions = defaultInteractions(); - } - - super(options); - } - - createRenderer() { - return new CompositeMapRenderer(this); - } -} - - -export default CompositeMap; diff --git a/src/ol/Map.js b/src/ol/Map.js index 56a42f4a03..a5b6937a0f 100644 --- a/src/ol/Map.js +++ b/src/ol/Map.js @@ -5,7 +5,7 @@ import PluggableMap from './PluggableMap.js'; import {defaults as defaultControls} from './control/util.js'; import {defaults as defaultInteractions} from './interaction.js'; import {assign} from './obj.js'; -import CanvasMapRenderer from './renderer/canvas/Map.js'; +import CompositeMapRenderer from './renderer/Composite.js'; /** * @classdesc @@ -76,7 +76,7 @@ class Map extends PluggableMap { } createRenderer() { - return new CanvasMapRenderer(this); + return new CompositeMapRenderer(this); } } diff --git a/test/index_test.js b/test/index_test.js index 5203db1f25..504e1d8b51 100644 --- a/test/index_test.js +++ b/test/index_test.js @@ -1,5 +1,5 @@ // require all modules ending in ".test.js" from the // current directory and all subdirectories -const testsContext = require.context('.', true, /\.test\.js$/); +const testsContext = require.context('./spec', true, /\.test\.js$/); testsContext.keys().forEach(testsContext);