diff --git a/examples/blend-modes.js b/examples/blend-modes.js index 819f4c4798..45e900d178 100644 --- a/examples/blend-modes.js +++ b/examples/blend-modes.js @@ -4,10 +4,10 @@ import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.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'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; // Create separate layers for red, green an blue circles. @@ -18,12 +18,12 @@ var redLayer = new VectorLayer({ source: new VectorSource({ features: [new Feature(new Point([0, 0]))] }), - style: new _ol_style_Style_({ - image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + style: new Style({ + image: new CircleStyle({ + fill: new Fill({ color: 'rgba(255,0,0,0.8)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgb(255,0,0)', width: 15 }), @@ -36,12 +36,12 @@ var greenLayer = new VectorLayer({ // 433.013 is roughly 250 * Math.sqrt(3) features: [new Feature(new Point([250, 433.013]))] }), - style: new _ol_style_Style_({ - image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + style: new Style({ + image: new CircleStyle({ + fill: new Fill({ color: 'rgba(0,255,0,0.8)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgb(0,255,0)', width: 15 }), @@ -53,12 +53,12 @@ var blueLayer = new VectorLayer({ source: new VectorSource({ features: [new Feature(new Point([500, 0]))] }), - style: new _ol_style_Style_({ - image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + style: new Style({ + image: new CircleStyle({ + fill: new Fill({ color: 'rgba(0,0,255,0.8)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgb(0,0,255)', width: 15 }), diff --git a/examples/box-selection.js b/examples/box-selection.js index 959897764b..69be214ab4 100644 --- a/examples/box-selection.js +++ b/examples/box-selection.js @@ -3,7 +3,7 @@ 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 Select from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; @@ -33,7 +33,7 @@ var map = new Map({ }); // a normal select interaction to handle click -var select = new _ol_interaction_Select_(); +var select = new Select(); map.addInteraction(select); var selectedFeatures = select.getFeatures(); diff --git a/examples/canvas-gradient-pattern.js b/examples/canvas-gradient-pattern.js index f4810a1430..7e7e1f6f98 100644 --- a/examples/canvas-gradient-pattern.js +++ b/examples/canvas-gradient-pattern.js @@ -6,9 +6,9 @@ import _ol_has_ from '../src/ol/has.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import {fromLonLat} from '../src/ol/proj.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'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var canvas = document.createElement('canvas'); var context = canvas.getContext('2d'); @@ -57,10 +57,10 @@ var pattern = (function() { }()); // Generate style for gradient or pattern fill -var fill = new _ol_style_Fill_(); -var style = new _ol_style_Style_({ +var fill = new Fill(); +var style = new Style({ fill: fill, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#333', width: 2 }) diff --git a/examples/center.js b/examples/center.js index df01af6871..f63b37e2de 100644 --- a/examples/center.js +++ b/examples/center.js @@ -6,29 +6,29 @@ import TileLayer from '../src/ol/layer/Tile.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'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var source = new VectorSource({ url: 'data/geojson/switzerland.geojson', format: new GeoJSON() }); -var style = new _ol_style_Style_({ - fill: new _ol_style_Fill_({ +var style = new Style({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', width: 1 }), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', width: 1 }) diff --git a/examples/cluster.js b/examples/cluster.js index 984abc59db..8016547cad 100644 --- a/examples/cluster.js +++ b/examples/cluster.js @@ -7,11 +7,11 @@ 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'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; -import _ol_style_Text_ from '../src/ol/style/Text.js'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; +import Text from '../src/ol/style/Text.js'; var distance = document.getElementById('distance'); @@ -40,19 +40,19 @@ var clusters = new VectorLayer({ var size = feature.get('features').length; var style = styleCache[size]; if (!style) { - style = new _ol_style_Style_({ - image: new _ol_style_Circle_({ + style = new Style({ + image: new CircleStyle({ radius: 10, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#fff' }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#3399CC' }) }), - text: new _ol_style_Text_({ + text: new Text({ text: size.toString(), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#fff' }) }) diff --git a/examples/custom-interactions.js b/examples/custom-interactions.js index 7ef6119efc..cc5dd1bad6 100644 --- a/examples/custom-interactions.js +++ b/examples/custom-interactions.js @@ -6,15 +6,15 @@ 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 PointerInteraction from '../src/ol/interaction/Pointer.js'; import TileLayer from '../src/ol/layer/Tile.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'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Fill from '../src/ol/style/Fill.js'; +import Icon from '../src/ol/style/Icon.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; /** @@ -29,7 +29,7 @@ var app = {}; */ app.Drag = function() { - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: app.Drag.prototype.handleDownEvent, handleDragEvent: app.Drag.prototype.handleDragEvent, handleMoveEvent: app.Drag.prototype.handleMoveEvent, @@ -61,7 +61,7 @@ app.Drag = function() { this.previousCursor_ = undefined; }; -inherits(app.Drag, _ol_interaction_Pointer_); +inherits(app.Drag, PointerInteraction); /** @@ -156,19 +156,19 @@ var map = new Map({ source: new VectorSource({ features: [pointFeature, lineFeature, polygonFeature] }), - style: new _ol_style_Style_({ - image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ + style: new Style({ + image: new Icon(/** @type {olx.style.IconOptions} */ ({ anchor: [0.5, 46], anchorXUnits: 'fraction', anchorYUnits: 'pixels', opacity: 0.95, src: 'data/icon.png' })), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ width: 3, color: [255, 0, 0, 1] }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: [0, 0, 255, 0.6] }) }) diff --git a/examples/drag-and-drop-image-vector.js b/examples/drag-and-drop-image-vector.js index 7f69b9213d..4678ffbee0 100644 --- a/examples/drag-and-drop-image-vector.js +++ b/examples/drag-and-drop-image-vector.js @@ -11,63 +11,63 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import TileLayer from '../src/ol/layer/Tile.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'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var defaultStyle = { - 'Point': new _ol_style_Style_({ - image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + 'Point': new Style({ + image: new CircleStyle({ + fill: new Fill({ color: 'rgba(255,255,0,0.5)' }), radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#ff0', width: 1 }) }) }), - 'LineString': new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + 'LineString': new Style({ + stroke: new Stroke({ color: '#f00', width: 3 }) }), - 'Polygon': new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + 'Polygon': new Style({ + fill: new Fill({ color: 'rgba(0,255,255,0.5)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#0ff', width: 1 }) }), - 'MultiPoint': new _ol_style_Style_({ - image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + 'MultiPoint': new Style({ + image: new CircleStyle({ + fill: new Fill({ color: 'rgba(255,0,255,0.5)' }), radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#f0f', width: 1 }) }) }), - 'MultiLineString': new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + 'MultiLineString': new Style({ + stroke: new Stroke({ color: '#0f0', width: 3 }) }), - 'MultiPolygon': new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + 'MultiPolygon': new Style({ + fill: new Fill({ color: 'rgba(0,0,255,0.5)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#00f', width: 1 }) diff --git a/examples/drag-and-drop.js b/examples/drag-and-drop.js index fd61bd55f0..4bfdd07686 100644 --- a/examples/drag-and-drop.js +++ b/examples/drag-and-drop.js @@ -11,63 +11,63 @@ import TileLayer from '../src/ol/layer/Tile.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'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var defaultStyle = { - 'Point': new _ol_style_Style_({ - image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + 'Point': new Style({ + image: new CircleStyle({ + fill: new Fill({ color: 'rgba(255,255,0,0.5)' }), radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#ff0', width: 1 }) }) }), - 'LineString': new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + 'LineString': new Style({ + stroke: new Stroke({ color: '#f00', width: 3 }) }), - 'Polygon': new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + 'Polygon': new Style({ + fill: new Fill({ color: 'rgba(0,255,255,0.5)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#0ff', width: 1 }) }), - 'MultiPoint': new _ol_style_Style_({ - image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + 'MultiPoint': new Style({ + image: new CircleStyle({ + fill: new Fill({ color: 'rgba(255,0,255,0.5)' }), radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#f0f', width: 1 }) }) }), - 'MultiLineString': new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + 'MultiLineString': new Style({ + stroke: new Stroke({ color: '#0f0', width: 3 }) }), - 'MultiPolygon': new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + 'MultiPolygon': new Style({ + fill: new Fill({ color: 'rgba(0,0,255,0.5)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#00f', width: 1 }) diff --git a/examples/draw-and-modify-features.js b/examples/draw-and-modify-features.js index ef65dab1e2..19cab51e58 100644 --- a/examples/draw-and-modify-features.js +++ b/examples/draw-and-modify-features.js @@ -1,16 +1,16 @@ import Map from '../src/ol/Map.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 Modify from '../src/ol/interaction/Modify.js'; +import Snap from '../src/ol/interaction/Snap.js'; import TileLayer from '../src/ol/layer/Tile.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'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var raster = new TileLayer({ source: new OSM() @@ -19,17 +19,17 @@ var raster = new TileLayer({ var source = new VectorSource(); var vector = new VectorLayer({ source: source, - style: new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + style: new Style({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.2)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#ffcc33', width: 2 }), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 7, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#ffcc33' }) }) @@ -45,7 +45,7 @@ var map = new Map({ }) }); -var modify = new _ol_interaction_Modify_({source: source}); +var modify = new Modify({source: source}); map.addInteraction(modify); var draw, snap; // global so we can remove them later @@ -57,7 +57,7 @@ function addInteractions() { type: typeSelect.value }); map.addInteraction(draw); - snap = new _ol_interaction_Snap_({source: source}); + snap = new Snap({source: source}); map.addInteraction(snap); } diff --git a/examples/dynamic-data.js b/examples/dynamic-data.js index 59393de30d..320aec8bb1 100644 --- a/examples/dynamic-data.js +++ b/examples/dynamic-data.js @@ -4,10 +4,10 @@ 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 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'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var map = new Map({ @@ -23,28 +23,28 @@ var map = new Map({ }) }); -var imageStyle = new _ol_style_Style_({ - image: new _ol_style_Circle_({ +var imageStyle = new Style({ + image: new CircleStyle({ radius: 5, snapToPixel: false, - fill: new _ol_style_Fill_({color: 'yellow'}), - stroke: new _ol_style_Stroke_({color: 'red', width: 1}) + fill: new Fill({color: 'yellow'}), + stroke: new Stroke({color: 'red', width: 1}) }) }); -var headInnerImageStyle = new _ol_style_Style_({ - image: new _ol_style_Circle_({ +var headInnerImageStyle = new Style({ + image: new CircleStyle({ radius: 2, snapToPixel: false, - fill: new _ol_style_Fill_({color: 'blue'}) + fill: new Fill({color: 'blue'}) }) }); -var headOuterImageStyle = new _ol_style_Style_({ - image: new _ol_style_Circle_({ +var headOuterImageStyle = new Style({ + image: new CircleStyle({ radius: 5, snapToPixel: false, - fill: new _ol_style_Fill_({color: 'black'}) + fill: new Fill({color: 'black'}) }) }); diff --git a/examples/earthquake-clusters.js b/examples/earthquake-clusters.js index 6b08b056e0..c6131c996a 100644 --- a/examples/earthquake-clusters.js +++ b/examples/earthquake-clusters.js @@ -3,35 +3,35 @@ 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 Select from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.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'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; -import _ol_style_Text_ from '../src/ol/style/Text.js'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import RegularShape from '../src/ol/style/RegularShape.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; +import Text from '../src/ol/style/Text.js'; -var earthquakeFill = new _ol_style_Fill_({ +var earthquakeFill = new Fill({ color: 'rgba(255, 153, 0, 0.8)' }); -var earthquakeStroke = new _ol_style_Stroke_({ +var earthquakeStroke = new Stroke({ color: 'rgba(255, 204, 0, 0.2)', width: 1 }); -var textFill = new _ol_style_Fill_({ +var textFill = new Fill({ color: '#fff' }); -var textStroke = new _ol_style_Stroke_({ +var textStroke = new Stroke({ color: 'rgba(0, 0, 0, 0.6)', width: 3 }); -var invisibleFill = new _ol_style_Fill_({ +var invisibleFill = new Fill({ color: 'rgba(255, 255, 255, 0.01)' }); @@ -43,9 +43,9 @@ function createEarthquakeStyle(feature) { var magnitude = parseFloat(name.substr(2)); var radius = 5 + 20 * (magnitude - 5); - return new _ol_style_Style_({ + return new Style({ geometry: feature.getGeometry(), - image: new _ol_style_RegularShape_({ + image: new RegularShape({ radius1: radius, radius2: 3, points: 5, @@ -85,14 +85,14 @@ function styleFunction(feature, resolution) { var style; var size = feature.get('features').length; if (size > 1) { - style = new _ol_style_Style_({ - image: new _ol_style_Circle_({ + style = new Style({ + image: new CircleStyle({ radius: feature.get('radius'), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: [255, 153, 0, Math.min(0.8, 0.4 + (size / maxFeatureCount))] }) }), - text: new _ol_style_Text_({ + text: new Text({ text: size.toString(), fill: textFill, stroke: textStroke @@ -106,8 +106,8 @@ function styleFunction(feature, resolution) { } function selectStyleFunction(feature) { - var styles = [new _ol_style_Style_({ - image: new _ol_style_Circle_({ + var styles = [new Style({ + image: new CircleStyle({ radius: feature.get('radius'), fill: invisibleFill }) @@ -142,7 +142,7 @@ var raster = new TileLayer({ var map = new Map({ layers: [raster, vector], - interactions: defaultInteractions().extend([new _ol_interaction_Select_({ + interactions: defaultInteractions().extend([new Select({ condition: function(evt) { return evt.type == 'pointermove' || evt.type == 'singleclick'; diff --git a/examples/earthquake-custom-symbol.js b/examples/earthquake-custom-symbol.js index 6375c0a526..58c2c43bc8 100644 --- a/examples/earthquake-custom-symbol.js +++ b/examples/earthquake-custom-symbol.js @@ -7,10 +7,10 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import _ol_render_ from '../src/ol/render.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'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Fill from '../src/ol/style/Fill.js'; +import Icon from '../src/ol/style/Icon.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var symbol = [[0, 0], [4, 2], [6, 0], [10, 5], [6, 3], [4, 5], [0, 0]]; @@ -35,13 +35,13 @@ var styleFunction = function(feature) { var vectorContext = _ol_render_.toContext( /** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d')), {size: [size, size], pixelRatio: 1}); - vectorContext.setStyle(new _ol_style_Style_({ - fill: new _ol_style_Fill_({color: 'rgba(255, 153, 0, 0.4)'}), - stroke: new _ol_style_Stroke_({color: 'rgba(255, 204, 0, 0.2)', width: 2}) + vectorContext.setStyle(new Style({ + fill: new Fill({color: 'rgba(255, 153, 0, 0.4)'}), + stroke: new Stroke({color: 'rgba(255, 204, 0, 0.2)', width: 2}) })); vectorContext.drawGeometry(new Polygon([symbol.map(scaleFunction)])); - style = new _ol_style_Style_({ - image: new _ol_style_Icon_({ + style = new Style({ + image: new Icon({ img: canvas, imgSize: [size, size], rotation: 1.2 diff --git a/examples/extent-interaction.js b/examples/extent-interaction.js index 8314d550a4..b048326402 100644 --- a/examples/extent-interaction.js +++ b/examples/extent-interaction.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.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 ExtentInteraction from '../src/ol/interaction/Extent.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; @@ -29,7 +29,7 @@ var map = new Map({ }) }); -var extent = new _ol_interaction_Extent_({ +var extent = new ExtentInteraction({ condition: _ol_events_condition_.platformModifierKeyOnly }); map.addInteraction(extent); diff --git a/examples/feature-animation.js b/examples/feature-animation.js index 0631fa4991..442e971df2 100644 --- a/examples/feature-animation.js +++ b/examples/feature-animation.js @@ -10,9 +10,9 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import {fromLonLat} from '../src/ol/proj.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'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var map = new Map({ @@ -66,11 +66,11 @@ function flash(feature) { var radius = easeOut(elapsedRatio) * 25 + 5; var opacity = easeOut(1 - elapsedRatio); - var style = new _ol_style_Style_({ - image: new _ol_style_Circle_({ + var style = new Style({ + image: new CircleStyle({ radius: radius, snapToPixel: false, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(255, 0, 0, ' + opacity + ')', width: 0.25 + opacity }) diff --git a/examples/feature-move-animation.js b/examples/feature-move-animation.js index 43e1157680..fd34c697c1 100644 --- a/examples/feature-move-animation.js +++ b/examples/feature-move-animation.js @@ -7,11 +7,11 @@ import TileLayer from '../src/ol/layer/Tile.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'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Icon from '../src/ol/style/Icon.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; // This long string is placed here due to jsFiddle limitations. // It is usually loaded with AJAX. @@ -85,23 +85,23 @@ var endMarker = new Feature({ }); var styles = { - 'route': new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + 'route': new Style({ + stroke: new Stroke({ width: 6, color: [237, 212, 0, 0.8] }) }), - 'icon': new _ol_style_Style_({ - image: new _ol_style_Icon_({ + 'icon': new Style({ + image: new Icon({ anchor: [0.5, 1], src: 'data/icon.png' }) }), - 'geoMarker': new _ol_style_Style_({ - image: new _ol_style_Circle_({ + 'geoMarker': new Style({ + image: new CircleStyle({ radius: 7, snapToPixel: false, - fill: new _ol_style_Fill_({color: 'black'}), - stroke: new _ol_style_Stroke_({ + fill: new Fill({color: 'black'}), + stroke: new Stroke({ color: 'white', width: 2 }) }) diff --git a/examples/flight-animation.js b/examples/flight-animation.js index fdad2f77bd..aacd445b96 100644 --- a/examples/flight-animation.js +++ b/examples/flight-animation.js @@ -7,8 +7,8 @@ import TileLayer from '../src/ol/layer/Tile.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'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var map = new Map({ layers: [ @@ -25,8 +25,8 @@ var map = new Map({ }) }); -var style = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ +var style = new Style({ + stroke: new Stroke({ color: '#EAE911', width: 2 }) diff --git a/examples/geojson-vt.js b/examples/geojson-vt.js index c284a12282..06ff1dc2d3 100644 --- a/examples/geojson-vt.js +++ b/examples/geojson-vt.js @@ -5,8 +5,8 @@ import GeoJSON from '../src/ol/format/GeoJSON.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'; +import VectorTileLayer from '../src/ol/layer/VectorTile.js'; +import Projection from '../src/ol/proj/Projection.js'; var replacer = function(key, value) { @@ -48,7 +48,7 @@ var replacer = function(key, value) { } }; -var tilePixels = new _ol_proj_Projection_({ +var tilePixels = new Projection({ code: 'TILE_PIXELS', units: 'tile-pixels' }); @@ -93,7 +93,7 @@ fetch(url).then(function(response) { }, url: 'data:' // arbitrary url, we don't use it in the tileLoadFunction }); - var vectorLayer = new _ol_layer_VectorTile_({ + var vectorLayer = new VectorTileLayer({ source: vectorSource }); map.addLayer(vectorLayer); diff --git a/examples/geojson.js b/examples/geojson.js index b9c1ea093d..fa497be054 100644 --- a/examples/geojson.js +++ b/examples/geojson.js @@ -8,78 +8,78 @@ import TileLayer from '../src/ol/layer/Tile.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'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; -var image = new _ol_style_Circle_({ +var image = new CircleStyle({ radius: 5, fill: null, - stroke: new _ol_style_Stroke_({color: 'red', width: 1}) + stroke: new Stroke({color: 'red', width: 1}) }); var styles = { - 'Point': new _ol_style_Style_({ + 'Point': new Style({ image: image }), - 'LineString': new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + 'LineString': new Style({ + stroke: new Stroke({ color: 'green', width: 1 }) }), - 'MultiLineString': new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + 'MultiLineString': new Style({ + stroke: new Stroke({ color: 'green', width: 1 }) }), - 'MultiPoint': new _ol_style_Style_({ + 'MultiPoint': new Style({ image: image }), - 'MultiPolygon': new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + 'MultiPolygon': new Style({ + stroke: new Stroke({ color: 'yellow', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 255, 0, 0.1)' }) }), - 'Polygon': new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + 'Polygon': new Style({ + stroke: new Stroke({ color: 'blue', lineDash: [4], width: 3 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0, 0, 255, 0.1)' }) }), - 'GeometryCollection': new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + 'GeometryCollection': new Style({ + stroke: new Stroke({ color: 'magenta', width: 2 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'magenta' }), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 10, fill: null, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'magenta' }) }) }), - 'Circle': new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + 'Circle': new Style({ + stroke: new Stroke({ color: 'red', width: 2 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255,0,0,0.2)' }) }) diff --git a/examples/geolocation.js b/examples/geolocation.js index 4660adcadc..0df94b6ef1 100644 --- a/examples/geolocation.js +++ b/examples/geolocation.js @@ -8,10 +8,10 @@ import TileLayer from '../src/ol/layer/Tile.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'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var view = new View({ center: [0, 0], @@ -67,13 +67,13 @@ geolocation.on('change:accuracyGeometry', function() { }); var positionFeature = new Feature(); -positionFeature.setStyle(new _ol_style_Style_({ - image: new _ol_style_Circle_({ +positionFeature.setStyle(new Style({ + image: new CircleStyle({ radius: 6, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#3399CC' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#fff', width: 2 }) diff --git a/examples/gpx.js b/examples/gpx.js index 19a3322352..2861e70c84 100644 --- a/examples/gpx.js +++ b/examples/gpx.js @@ -5,10 +5,10 @@ import TileLayer from '../src/ol/layer/Tile.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'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var raster = new TileLayer({ source: new BingMaps({ @@ -18,26 +18,26 @@ var raster = new TileLayer({ }); var style = { - 'Point': new _ol_style_Style_({ - image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + 'Point': new Style({ + image: new CircleStyle({ + fill: new Fill({ color: 'rgba(255,255,0,0.4)' }), radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#ff0', width: 1 }) }) }), - 'LineString': new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + 'LineString': new Style({ + stroke: new Stroke({ color: '#f00', width: 3 }) }), - 'MultiLineString': new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + 'MultiLineString': new Style({ + stroke: new Stroke({ color: '#0f0', width: 3 }) diff --git a/examples/graticule.js b/examples/graticule.js index 7a47183a95..f435460f72 100644 --- a/examples/graticule.js +++ b/examples/graticule.js @@ -4,7 +4,7 @@ import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat} from '../src/ol/proj.js'; import OSM from '../src/ol/source/OSM.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; var map = new Map({ @@ -25,7 +25,7 @@ var map = new Map({ // Create the graticule component var graticule = new Graticule({ // the style to use for the lines, optional. - strokeStyle: new _ol_style_Stroke_({ + strokeStyle: new Stroke({ color: 'rgba(255,120,0,0.9)', width: 2, lineDash: [0.5, 4] diff --git a/examples/hit-tolerance.js b/examples/hit-tolerance.js index 8c1b060dfb..015887f486 100644 --- a/examples/hit-tolerance.js +++ b/examples/hit-tolerance.js @@ -6,15 +6,15 @@ 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'; +import Style from '../src/ol/style/Style.js'; +import Stroke from '../src/ol/style/Stroke.js'; var raster = new TileLayer({ source: new OSM() }); -var style = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ +var style = new Style({ + stroke: new Stroke({ color: 'black', width: 1 }) diff --git a/examples/icon-color.js b/examples/icon-color.js index b1380ed6b3..24bbd94c24 100644 --- a/examples/icon-color.js +++ b/examples/icon-color.js @@ -7,8 +7,8 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import {fromLonLat} from '../src/ol/proj.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'; +import Icon from '../src/ol/style/Icon.js'; +import Style from '../src/ol/style/Style.js'; var rome = new Feature({ @@ -23,24 +23,24 @@ var madrid = new Feature({ geometry: new Point(fromLonLat([-3.683333, 40.4])) }); -rome.setStyle(new _ol_style_Style_({ - image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ +rome.setStyle(new Style({ + image: new Icon(/** @type {olx.style.IconOptions} */ ({ color: '#8959A8', crossOrigin: 'anonymous', src: 'data/dot.png' })) })); -london.setStyle(new _ol_style_Style_({ - image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ +london.setStyle(new Style({ + image: new Icon(/** @type {olx.style.IconOptions} */ ({ color: '#4271AE', crossOrigin: 'anonymous', src: 'data/dot.png' })) })); -madrid.setStyle(new _ol_style_Style_({ - image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ +madrid.setStyle(new Style({ + image: new Icon(/** @type {olx.style.IconOptions} */ ({ color: [113, 140, 0], crossOrigin: 'anonymous', src: 'data/dot.png' diff --git a/examples/icon-negative.js b/examples/icon-negative.js index ed82c9a723..bb7c22ec3d 100644 --- a/examples/icon-negative.js +++ b/examples/icon-negative.js @@ -2,18 +2,18 @@ import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.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 Select from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.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'; +import Icon from '../src/ol/style/Icon.js'; +import Style from '../src/ol/style/Style.js'; function createStyle(src, img) { - return new _ol_style_Style_({ - image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ + return new Style({ + image: new Icon(/** @type {olx.style.IconOptions} */ ({ anchor: [0.5, 0.96], crossOrigin: 'anonymous', src: src, @@ -46,7 +46,7 @@ var map = new Map({ }); var selectStyle = {}; -var select = new _ol_interaction_Select_({ +var select = new Select({ style: function(feature) { var image = feature.get('style').getImage().getImage(); if (!selectStyle[image.src]) { diff --git a/examples/icon-sprite-webgl.js b/examples/icon-sprite-webgl.js index 3e04f117e6..9fe2d63f08 100644 --- a/examples/icon-sprite-webgl.js +++ b/examples/icon-sprite-webgl.js @@ -4,8 +4,8 @@ import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.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'; +import Icon from '../src/ol/style/Icon.js'; +import Style from '../src/ol/style/Style.js'; var iconInfo = [{ @@ -44,7 +44,7 @@ var iconCount = iconInfo.length; var icons = new Array(iconCount); for (i = 0; i < iconCount; ++i) { var info = iconInfo[i]; - icons[i] = new _ol_style_Icon_({ + icons[i] = new Icon({ offset: info.offset, opacity: info.opacity, rotateWithView: info.rotateWithView, @@ -65,7 +65,7 @@ for (i = 0; i < featureCount; ++i) { [2 * e * Math.random() - e, 2 * e * Math.random() - e]); feature = new Feature(geometry); feature.setStyle( - new _ol_style_Style_({ + new Style({ image: icons[i % (iconCount - 1)] }) ); @@ -101,7 +101,7 @@ new VectorLayer({ source: new VectorSource({ features: overlayFeatures }), - style: new _ol_style_Style_({ + style: new Style({ image: icons[iconCount - 1] }) }); diff --git a/examples/icon.js b/examples/icon.js index a54d17d0b3..91d2edf9ed 100644 --- a/examples/icon.js +++ b/examples/icon.js @@ -7,8 +7,8 @@ import TileLayer from '../src/ol/layer/Tile.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'; +import Icon from '../src/ol/style/Icon.js'; +import Style from '../src/ol/style/Style.js'; var iconFeature = new Feature({ @@ -18,8 +18,8 @@ var iconFeature = new Feature({ rainfall: 500 }); -var iconStyle = new _ol_style_Style_({ - image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ +var iconStyle = new Style({ + image: new Icon(/** @type {olx.style.IconOptions} */ ({ anchor: [0.5, 46], anchorXUnits: 'fraction', anchorYUnits: 'pixels', diff --git a/examples/igc.js b/examples/igc.js index 2faf483adf..2e42f2e9ae 100644 --- a/examples/igc.js +++ b/examples/igc.js @@ -9,10 +9,10 @@ import TileLayer from '../src/ol/layer/Tile.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'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var colors = { @@ -28,8 +28,8 @@ var styleFunction = function(feature) { var color = colors[feature.get('PLT')]; var style = styleCache[color]; if (!style) { - style = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + style = new Style({ + stroke: new Stroke({ color: color, width: 3 }) @@ -152,13 +152,13 @@ map.on('click', function(evt) { displaySnap(evt.coordinate); }); -var stroke = new _ol_style_Stroke_({ +var stroke = new Stroke({ color: 'rgba(255,0,0,0.9)', width: 1 }); -var style = new _ol_style_Style_({ +var style = new Style({ stroke: stroke, - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 5, fill: null, stroke: stroke @@ -178,10 +178,10 @@ map.on('postcompose', function(evt) { var featureOverlay = new VectorLayer({ source: new VectorSource(), map: map, - style: new _ol_style_Style_({ - image: new _ol_style_Circle_({ + style: new Style({ + image: new CircleStyle({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255,0,0,0.9)' }) }) diff --git a/examples/image-vector-layer.js b/examples/image-vector-layer.js index 55a1d0ed65..c42cc680de 100644 --- a/examples/image-vector-layer.js +++ b/examples/image-vector-layer.js @@ -3,21 +3,21 @@ import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.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'; -import _ol_style_Text_ from '../src/ol/style/Text.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; +import Text from '../src/ol/style/Text.js'; -var style = new _ol_style_Style_({ - fill: new _ol_style_Fill_({ +var style = new Style({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', width: 1 }), - text: new _ol_style_Text_() + text: new Text() }); var map = new Map({ @@ -44,12 +44,12 @@ var map = new Map({ var featureOverlay = new VectorLayer({ source: new VectorSource(), map: map, - style: new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + style: new Style({ + stroke: new Stroke({ color: '#f00', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255,0,0,0.1)' }) }) diff --git a/examples/kml-earthquakes.js b/examples/kml-earthquakes.js index f696525a85..e785399ae0 100644 --- a/examples/kml-earthquakes.js +++ b/examples/kml-earthquakes.js @@ -5,10 +5,10 @@ import TileLayer from '../src/ol/layer/Tile.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'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var styleCache = {}; @@ -21,13 +21,13 @@ var styleFunction = function(feature) { var radius = 5 + 20 * (magnitude - 5); var style = styleCache[radius]; if (!style) { - style = new _ol_style_Style_({ - image: new _ol_style_Circle_({ + style = new Style({ + image: new CircleStyle({ radius: radius, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 153, 0, 0.4)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(255, 204, 0, 0.2)', width: 1 }) diff --git a/examples/kml-timezones.js b/examples/kml-timezones.js index 54ea073ebc..5c6956d254 100644 --- a/examples/kml-timezones.js +++ b/examples/kml-timezones.js @@ -5,9 +5,9 @@ import TileLayer from '../src/ol/layer/Tile.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'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; /* @@ -35,11 +35,11 @@ var styleFunction = function(feature) { delta = 24 - delta; } var opacity = 0.75 * (1 - delta / 12); - return new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + return new Style({ + fill: new Fill({ color: [0xff, 0xff, 0x33, opacity] }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#ffffff' }) }); diff --git a/examples/layer-group.js b/examples/layer-group.js index 50830955b7..c245b4cd9a 100644 --- a/examples/layer-group.js +++ b/examples/layer-group.js @@ -1,6 +1,6 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; -import _ol_layer_Group_ from '../src/ol/layer/Group.js'; +import LayerGroup from '../src/ol/layer/Group.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat} from '../src/ol/proj.js'; import OSM from '../src/ol/source/OSM.js'; @@ -10,7 +10,7 @@ var map = new Map({ layers: [ new TileLayer({ source: new OSM() - }), new _ol_layer_Group_({ + }), new LayerGroup({ layers: [ new TileLayer({ source: new TileJSON({ @@ -49,7 +49,7 @@ function bindInputs(layerid, layer) { } map.getLayers().forEach(function(layer, i) { bindInputs('#layer' + i, layer); - if (layer instanceof _ol_layer_Group_) { + if (layer instanceof LayerGroup) { layer.getLayers().forEach(function(sublayer, j) { bindInputs('#layer' + i + j, sublayer); }); diff --git a/examples/layer-z-index.js b/examples/layer-z-index.js index 7d13dd8a62..b20297559c 100644 --- a/examples/layer-z-index.js +++ b/examples/layer-z-index.js @@ -4,27 +4,27 @@ import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.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'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Fill from '../src/ol/style/Fill.js'; +import RegularShape from '../src/ol/style/RegularShape.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; -var stroke = new _ol_style_Stroke_({color: 'black', width: 1}); +var stroke = new Stroke({color: 'black', width: 1}); var styles = { - 'square': new _ol_style_Style_({ - image: new _ol_style_RegularShape_({ - fill: new _ol_style_Fill_({color: 'blue'}), + 'square': new Style({ + image: new RegularShape({ + fill: new Fill({color: 'blue'}), stroke: stroke, points: 4, radius: 80, angle: Math.PI / 4 }) }), - 'triangle': new _ol_style_Style_({ - image: new _ol_style_RegularShape_({ - fill: new _ol_style_Fill_({color: 'red'}), + 'triangle': new Style({ + image: new RegularShape({ + fill: new Fill({color: 'red'}), stroke: stroke, points: 3, radius: 80, @@ -32,9 +32,9 @@ var styles = { angle: 0 }) }), - 'star': new _ol_style_Style_({ - image: new _ol_style_RegularShape_({ - fill: new _ol_style_Fill_({color: 'green'}), + 'star': new Style({ + image: new RegularShape({ + fill: new Fill({color: 'green'}), stroke: stroke, points: 5, radius: 80, diff --git a/examples/line-arrows.js b/examples/line-arrows.js index 14e7310731..49801ff64d 100644 --- a/examples/line-arrows.js +++ b/examples/line-arrows.js @@ -6,9 +6,9 @@ import TileLayer from '../src/ol/layer/Tile.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'; +import Icon from '../src/ol/style/Icon.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var raster = new TileLayer({ source: new OSM() @@ -20,8 +20,8 @@ var styleFunction = function(feature) { var geometry = feature.getGeometry(); var styles = [ // linestring - new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + new Style({ + stroke: new Stroke({ color: '#ffcc33', width: 2 }) @@ -33,9 +33,9 @@ var styleFunction = function(feature) { var dy = end[1] - start[1]; var rotation = Math.atan2(dy, dx); // arrows - styles.push(new _ol_style_Style_({ + styles.push(new Style({ geometry: new Point(end), - image: new _ol_style_Icon_({ + image: new Icon({ src: 'data/arrow.png', anchor: [0.75, 0.5], rotateWithView: true, diff --git a/examples/mapbox-vector-tiles-advanced.js b/examples/mapbox-vector-tiles-advanced.js index 8b6b0d3d6f..7a48b09588 100644 --- a/examples/mapbox-vector-tiles-advanced.js +++ b/examples/mapbox-vector-tiles-advanced.js @@ -1,14 +1,14 @@ import Map from '../src/ol/Map.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 VectorTileLayer from '../src/ol/layer/VectorTile.js'; import {get as getProjection} from '../src/ol/proj.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'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; -import _ol_style_Text_ from '../src/ol/style/Text.js'; +import Fill from '../src/ol/style/Fill.js'; +import Icon from '../src/ol/style/Icon.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; +import Text from '../src/ol/style/Text.js'; import TileGrid from '../src/ol/tilegrid/TileGrid.js'; @@ -32,7 +32,7 @@ function tileUrlFunction(tileCoord) { var map = new Map({ layers: [ - new _ol_layer_VectorTile_({ + new VectorTileLayer({ source: new VectorTileSource({ attributions: '© Mapbox ' + '© ' + @@ -45,7 +45,7 @@ var map = new Map({ }), tileUrlFunction: tileUrlFunction }), - style: createMapboxStreetsV6Style(_ol_style_Style_, _ol_style_Fill_, _ol_style_Stroke_, _ol_style_Icon_, _ol_style_Text_) + style: createMapboxStreetsV6Style(Style, Fill, Stroke, Icon, Text) }) ], target: 'map', diff --git a/examples/mapbox-vector-tiles.js b/examples/mapbox-vector-tiles.js index cec13bfa6e..4c7ae3d7d0 100644 --- a/examples/mapbox-vector-tiles.js +++ b/examples/mapbox-vector-tiles.js @@ -1,20 +1,20 @@ import Map from '../src/ol/Map.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 VectorTileLayer from '../src/ol/layer/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'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; -import _ol_style_Text_ from '../src/ol/style/Text.js'; +import Fill from '../src/ol/style/Fill.js'; +import Icon from '../src/ol/style/Icon.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; +import Text from '../src/ol/style/Text.js'; var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg'; var map = new Map({ layers: [ - new _ol_layer_VectorTile_({ + new VectorTileLayer({ declutter: true, source: new VectorTileSource({ attributions: '© Mapbox ' + @@ -24,7 +24,7 @@ var map = new Map({ url: 'https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' + '{z}/{x}/{y}.vector.pbf?access_token=' + key }), - style: createMapboxStreetsV6Style(_ol_style_Style_, _ol_style_Fill_, _ol_style_Stroke_, _ol_style_Icon_, _ol_style_Text_) + style: createMapboxStreetsV6Style(Style, Fill, Stroke, Icon, Text) }) ], target: 'map', diff --git a/examples/measure.js b/examples/measure.js index 0f7972a1bd..b829c289a9 100644 --- a/examples/measure.js +++ b/examples/measure.js @@ -10,10 +10,10 @@ import TileLayer from '../src/ol/layer/Tile.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'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var raster = new TileLayer({ @@ -24,17 +24,17 @@ var source = new VectorSource(); var vector = new VectorLayer({ source: source, - style: new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + style: new Style({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.2)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#ffcc33', width: 2 }), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 7, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#ffcc33' }) }) @@ -180,21 +180,21 @@ function addInteraction() { draw = new Draw({ source: source, type: type, - style: new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + style: new Style({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.2)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(0, 0, 0, 0.5)', lineDash: [10, 10], width: 2 }), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(0, 0, 0, 0.7)' }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.2)' }) }) diff --git a/examples/modify-features.js b/examples/modify-features.js index ba85ad8957..33f9ea545b 100644 --- a/examples/modify-features.js +++ b/examples/modify-features.js @@ -2,8 +2,8 @@ import Map from '../src/ol/Map.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 Modify from '../src/ol/interaction/Modify.js'; +import Select from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; @@ -22,11 +22,11 @@ var vector = new VectorLayer({ }) }); -var select = new _ol_interaction_Select_({ +var select = new Select({ wrapX: false }); -var modify = new _ol_interaction_Modify_({ +var modify = new Modify({ features: select.getFeatures() }); diff --git a/examples/modify-test.js b/examples/modify-test.js index e9991ff0c2..f6501c30c6 100644 --- a/examples/modify-test.js +++ b/examples/modify-test.js @@ -2,54 +2,54 @@ import Map from '../src/ol/Map.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 Modify from '../src/ol/interaction/Modify.js'; +import Select from '../src/ol/interaction/Select.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'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var styleFunction = (function() { var styles = {}; - var image = new _ol_style_Circle_({ + var image = new CircleStyle({ radius: 5, fill: null, - stroke: new _ol_style_Stroke_({color: 'orange', width: 2}) + stroke: new Stroke({color: 'orange', width: 2}) }); - styles['Point'] = new _ol_style_Style_({image: image}); - styles['Polygon'] = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + styles['Point'] = new Style({image: image}); + styles['Polygon'] = new Style({ + stroke: new Stroke({ color: 'blue', width: 3 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0, 0, 255, 0.1)' }) }); - styles['MultiLineString'] = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + styles['MultiLineString'] = new Style({ + stroke: new Stroke({ color: 'green', width: 3 }) }); - styles['MultiPolygon'] = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + styles['MultiPolygon'] = new Style({ + stroke: new Stroke({ color: 'yellow', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 255, 0, 0.1)' }) }); - styles['default'] = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + styles['default'] = new Style({ + stroke: new Stroke({ color: 'red', width: 3 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 0, 0, 0.1)' }), image: image @@ -156,19 +156,19 @@ var layer = new VectorLayer({ var overlayStyle = (function() { var styles = {}; styles['Polygon'] = [ - new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + new Style({ + fill: new Fill({ color: [255, 255, 255, 0.5] }) }), - new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + new Style({ + stroke: new Stroke({ color: [255, 255, 255, 1], width: 5 }) }), - new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + new Style({ + stroke: new Stroke({ color: [0, 153, 255, 1], width: 3 }) @@ -177,14 +177,14 @@ var overlayStyle = (function() { styles['MultiPolygon'] = styles['Polygon']; styles['LineString'] = [ - new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + new Style({ + stroke: new Stroke({ color: [255, 255, 255, 1], width: 5 }) }), - new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + new Style({ + stroke: new Stroke({ color: [0, 153, 255, 1], width: 3 }) @@ -193,13 +193,13 @@ var overlayStyle = (function() { styles['MultiLineString'] = styles['LineString']; styles['Point'] = [ - new _ol_style_Style_({ - image: new _ol_style_Circle_({ + new Style({ + image: new CircleStyle({ radius: 7, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: [0, 153, 255, 1] }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: [255, 255, 255, 0.75], width: 1.5 }) @@ -216,11 +216,11 @@ var overlayStyle = (function() { }; })(); -var select = new _ol_interaction_Select_({ +var select = new Select({ style: overlayStyle }); -var modify = new _ol_interaction_Modify_({ +var modify = new Modify({ features: select.getFeatures(), style: overlayStyle, insertVertexCondition: function() { diff --git a/examples/osm-vector-tiles.js b/examples/osm-vector-tiles.js index 05ac9d689d..5f0c7d332c 100644 --- a/examples/osm-vector-tiles.js +++ b/examples/osm-vector-tiles.js @@ -1,12 +1,12 @@ import Map from '../src/ol/Map.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 VectorTileLayer from '../src/ol/layer/VectorTile.js'; import {fromLonLat} from '../src/ol/proj.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'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var key = 'vector-tiles-5eJz6JX'; @@ -16,18 +16,18 @@ var roadColor = { 'minor_road': '#ccb', 'highway': '#f39' }; -var buildingStyle = new _ol_style_Style_({ - fill: new _ol_style_Fill_({ +var buildingStyle = new Style({ + fill: new Fill({ color: '#666', opacity: 0.4 }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#444', width: 1 }) }); -var waterStyle = new _ol_style_Style_({ - fill: new _ol_style_Fill_({ +var waterStyle = new Style({ + fill: new Fill({ color: '#9db9e8' }) }); @@ -46,8 +46,8 @@ var roadStyle = function(feature) { color = roadColor[kind]; width = kind == 'highway' ? 1.5 : 1; } - style = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + style = new Style({ + stroke: new Stroke({ color: color, width: width }), @@ -60,7 +60,7 @@ var roadStyle = function(feature) { var map = new Map({ layers: [ - new _ol_layer_VectorTile_({ + new VectorTileLayer({ source: new VectorTileSource({ attributions: '© OpenStreetMap contributors, Who’s On First, ' + 'Natural Earth, and openstreetmapdata.com', diff --git a/examples/polygon-styles.js b/examples/polygon-styles.js index 20947b5126..3928e95afd 100644 --- a/examples/polygon-styles.js +++ b/examples/polygon-styles.js @@ -4,10 +4,10 @@ import GeoJSON from '../src/ol/format/GeoJSON.js'; import MultiPoint from '../src/ol/geom/MultiPoint.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'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var styles = [ /* We are using two different styles for the polygons: @@ -17,19 +17,19 @@ var styles = [ * returned as `MultiPoint` geometry, which will be used to render * the style. */ - new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + new Style({ + stroke: new Stroke({ color: 'blue', width: 3 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0, 0, 255, 0.1)' }) }), - new _ol_style_Style_({ - image: new _ol_style_Circle_({ + new Style({ + image: new CircleStyle({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'orange' }) }), diff --git a/examples/regularshape.js b/examples/regularshape.js index 88dde56b95..34f851515e 100644 --- a/examples/regularshape.js +++ b/examples/regularshape.js @@ -4,18 +4,18 @@ import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.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'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Fill from '../src/ol/style/Fill.js'; +import RegularShape from '../src/ol/style/RegularShape.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; -var stroke = new _ol_style_Stroke_({color: 'black', width: 2}); -var fill = new _ol_style_Fill_({color: 'red'}); +var stroke = new Stroke({color: 'black', width: 2}); +var fill = new Fill({color: 'red'}); var styles = { - 'square': new _ol_style_Style_({ - image: new _ol_style_RegularShape_({ + 'square': new Style({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 4, @@ -23,8 +23,8 @@ var styles = { angle: Math.PI / 4 }) }), - 'triangle': new _ol_style_Style_({ - image: new _ol_style_RegularShape_({ + 'triangle': new Style({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 3, @@ -33,8 +33,8 @@ var styles = { angle: 0 }) }), - 'star': new _ol_style_Style_({ - image: new _ol_style_RegularShape_({ + 'star': new Style({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 5, @@ -43,8 +43,8 @@ var styles = { angle: 0 }) }), - 'cross': new _ol_style_Style_({ - image: new _ol_style_RegularShape_({ + 'cross': new Style({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 4, @@ -53,8 +53,8 @@ var styles = { angle: 0 }) }), - 'x': new _ol_style_Style_({ - image: new _ol_style_RegularShape_({ + 'x': new Style({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 4, diff --git a/examples/render-geometry.js b/examples/render-geometry.js index d12cc98479..fc7d8450da 100644 --- a/examples/render-geometry.js +++ b/examples/render-geometry.js @@ -2,21 +2,21 @@ 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_render_ from '../src/ol/render.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'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var canvas = document.getElementById('canvas'); var vectorContext = _ol_render_.toContext(canvas.getContext('2d'), {size: [100, 100]}); -var fill = new _ol_style_Fill_({color: 'blue'}); -var stroke = new _ol_style_Stroke_({color: 'black'}); -var style = new _ol_style_Style_({ +var fill = new Fill({color: 'blue'}); +var stroke = new Stroke({color: 'black'}); +var style = new Style({ fill: fill, stroke: stroke, - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 10, fill: fill, stroke: stroke diff --git a/examples/select-features.js b/examples/select-features.js index ded95624fe..32615701f6 100644 --- a/examples/select-features.js +++ b/examples/select-features.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.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 Select from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; @@ -31,19 +31,19 @@ var map = new Map({ var select = null; // ref to currently selected interaction // select interaction working on "singleclick" -var selectSingleClick = new _ol_interaction_Select_(); +var selectSingleClick = new Select(); // select interaction working on "click" -var selectClick = new _ol_interaction_Select_({ +var selectClick = new Select({ condition: _ol_events_condition_.click }); // select interaction working on "pointermove" -var selectPointerMove = new _ol_interaction_Select_({ +var selectPointerMove = new Select({ condition: _ol_events_condition_.pointerMove }); -var selectAltClick = new _ol_interaction_Select_({ +var selectAltClick = new Select({ condition: function(mapBrowserEvent) { return _ol_events_condition_.click(mapBrowserEvent) && _ol_events_condition_.altKeyOnly(mapBrowserEvent); diff --git a/examples/snap.js b/examples/snap.js index 73335e12b7..34131a79bb 100644 --- a/examples/snap.js +++ b/examples/snap.js @@ -1,17 +1,17 @@ import Map from '../src/ol/Map.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 Modify from '../src/ol/interaction/Modify.js'; +import Select from '../src/ol/interaction/Select.js'; +import Snap from '../src/ol/interaction/Snap.js'; import TileLayer from '../src/ol/layer/Tile.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'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var raster = new TileLayer({ source: new OSM() @@ -19,17 +19,17 @@ var raster = new TileLayer({ var vector = new VectorLayer({ source: new VectorSource(), - style: new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + style: new Style({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.2)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#ffcc33', width: 2 }), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 7, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#ffcc33' }) }) @@ -45,12 +45,12 @@ var map = new Map({ }) }); -var Modify = { +var ExampleModify = { init: function() { - this.select = new _ol_interaction_Select_(); + this.select = new Select(); map.addInteraction(this.select); - this.modify = new _ol_interaction_Modify_({ + this.modify = new Modify({ features: this.select.getFeatures() }); map.addInteraction(this.modify); @@ -69,7 +69,7 @@ var Modify = { this.modify.setActive(active); } }; -Modify.init(); +ExampleModify.init(); var optionsForm = document.getElementById('options-form'); @@ -126,25 +126,25 @@ optionsForm.onchange = function(e) { var type = e.target.getAttribute('name'); var value = e.target.value; if (type == 'draw-type') { - Draw.getActive() && Draw.setActive(true); + ExampleDraw.getActive() && ExampleDraw.setActive(true); } else if (type == 'interaction') { if (value == 'modify') { - Draw.setActive(false); - Modify.setActive(true); + ExampleDraw.setActive(false); + ExampleModify.setActive(true); } else if (value == 'draw') { - Draw.setActive(true); - Modify.setActive(false); + ExampleDraw.setActive(true); + ExampleModify.setActive(false); } } }; -Draw.setActive(true); -Modify.setActive(false); +ExampleDraw.setActive(true); +ExampleModify.setActive(false); // The snap interaction must be added after the Modify and Draw interactions // in order for its map browser event handlers to be fired first. Its handlers // are responsible of doing the snapping. -var snap = new _ol_interaction_Snap_({ +var snap = new Snap({ source: vector.getSource() }); map.addInteraction(snap); diff --git a/examples/sphere-mollweide.js b/examples/sphere-mollweide.js index 71ff806e43..09a667a1b1 100644 --- a/examples/sphere-mollweide.js +++ b/examples/sphere-mollweide.js @@ -3,7 +3,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import VectorLayer from '../src/ol/layer/Vector.js'; -import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; +import Projection from '../src/ol/proj/Projection.js'; import VectorSource from '../src/ol/source/Vector.js'; import {register} from '../src/ol/proj/proj4.js'; import proj4 from 'proj4'; @@ -15,7 +15,7 @@ register(proj4); // Configure the Sphere Mollweide projection object with an extent, // and a world extent. These are required for the Graticule. -var sphereMollweideProjection = new _ol_proj_Projection_({ +var sphereMollweideProjection = new Projection({ code: 'ESRI:53009', extent: [-9009954.605703328, -9009954.605703328, 9009954.605703328, 9009954.605703328], diff --git a/examples/static-image.js b/examples/static-image.js index 7cc3e4caeb..3e152094cf 100644 --- a/examples/static-image.js +++ b/examples/static-image.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import * as _ol_extent_ from '../src/ol/extent.js'; import ImageLayer from '../src/ol/layer/Image.js'; -import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; +import Projection from '../src/ol/proj/Projection.js'; import Static from '../src/ol/source/ImageStatic.js'; @@ -10,7 +10,7 @@ import Static from '../src/ol/source/ImageStatic.js'; // coordinates directly to map coordinates, so we create a projection that uses // the image extent in pixels. var extent = [0, 0, 1024, 968]; -var projection = new _ol_proj_Projection_({ +var projection = new Projection({ code: 'xkcd-image', units: 'pixels', extent: extent diff --git a/examples/street-labels.js b/examples/street-labels.js index fc2f0c9db5..6d7dc1ef5f 100644 --- a/examples/street-labels.js +++ b/examples/street-labels.js @@ -6,15 +6,15 @@ import TileLayer from '../src/ol/layer/Tile.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'; +import Fill from '../src/ol/style/Fill.js'; +import Style from '../src/ol/style/Style.js'; +import Text from '../src/ol/style/Text.js'; -var style = new _ol_style_Style_({ - text: new _ol_style_Text_({ +var style = new Style({ + text: new Text({ font: 'bold 11px "Open Sans", "Arial Unicode MS", "sans-serif"', placement: 'line', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'white' }) }) diff --git a/examples/symbol-atlas-webgl.js b/examples/symbol-atlas-webgl.js index c3dae93cb0..ceaa52a172 100644 --- a/examples/symbol-atlas-webgl.js +++ b/examples/symbol-atlas-webgl.js @@ -4,14 +4,14 @@ import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.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'; -import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import AtlasManager from '../src/ol/style/AtlasManager.js'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import RegularShape from '../src/ol/style/RegularShape.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; -var atlasManager = new _ol_style_AtlasManager_({ +var atlasManager = new AtlasManager({ // we increase the initial size so that all symbols fit into // a single atlas image initialSize: 512 @@ -47,14 +47,14 @@ for (i = 0; i < symbolInfo.length; ++i) { var info = symbolInfo[i]; for (j = 0; j < radiuses.length; ++j) { // circle symbol - symbols.push(new _ol_style_Circle_({ + symbols.push(new CircleStyle({ opacity: info.opacity, scale: info.scale, radius: radiuses[j], - fill: new _ol_style_Fill_({ + fill: new Fill({ color: info.fillColor }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: info.strokeColor, width: 1 }), @@ -64,17 +64,17 @@ for (i = 0; i < symbolInfo.length; ++i) { })); // star symbol - symbols.push(new _ol_style_RegularShape_({ + symbols.push(new RegularShape({ points: 8, opacity: info.opacity, scale: info.scale, radius: radiuses[j], radius2: radiuses[j] * 0.7, angle: 1.4, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: info.fillColor }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: info.strokeColor, width: 1 }), @@ -92,7 +92,7 @@ for (i = 0; i < featureCount; ++i) { [2 * e * Math.random() - e, 2 * e * Math.random() - e]); feature = new Feature(geometry); feature.setStyle( - new _ol_style_Style_({ + new Style({ image: symbols[i % symbolCount] }) ); diff --git a/examples/synthetic-lines.js b/examples/synthetic-lines.js index a5e41f051b..5854ac99c0 100644 --- a/examples/synthetic-lines.js +++ b/examples/synthetic-lines.js @@ -4,8 +4,8 @@ import View from '../src/ol/View.js'; import LineString from '../src/ol/geom/LineString.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'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var count = 10000; @@ -41,8 +41,8 @@ var vector = new VectorLayer({ features: features, wrapX: false }), - style: new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + style: new Style({ + stroke: new Stroke({ color: '#666666', width: 1 }) diff --git a/examples/synthetic-points.js b/examples/synthetic-points.js index 84b48cbd0f..a26d956984 100644 --- a/examples/synthetic-points.js +++ b/examples/synthetic-points.js @@ -5,10 +5,10 @@ import LineString from '../src/ol/geom/LineString.js'; import Point from '../src/ol/geom/Point.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'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var count = 20000; @@ -24,18 +24,18 @@ for (var i = 0; i < count; ++i) { } var styles = { - '10': new _ol_style_Style_({ - image: new _ol_style_Circle_({ + '10': new Style({ + image: new CircleStyle({ radius: 5, - fill: new _ol_style_Fill_({color: '#666666'}), - stroke: new _ol_style_Stroke_({color: '#bada55', width: 1}) + fill: new Fill({color: '#666666'}), + stroke: new Stroke({color: '#bada55', width: 1}) }) }), - '20': new _ol_style_Style_({ - image: new _ol_style_Circle_({ + '20': new Style({ + image: new CircleStyle({ radius: 10, - fill: new _ol_style_Fill_({color: '#666666'}), - stroke: new _ol_style_Stroke_({color: '#bada55', width: 1}) + fill: new Fill({color: '#666666'}), + stroke: new Stroke({color: '#bada55', width: 1}) }) }) }; @@ -96,13 +96,13 @@ map.on('click', function(evt) { displaySnap(evt.coordinate); }); -var stroke = new _ol_style_Stroke_({ +var stroke = new Stroke({ color: 'rgba(255,255,0,0.9)', width: 3 }); -var style = new _ol_style_Style_({ +var style = new Style({ stroke: stroke, - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 10, stroke: stroke }) diff --git a/examples/topojson.js b/examples/topojson.js index 7f2b92922e..f43ca0fffb 100644 --- a/examples/topojson.js +++ b/examples/topojson.js @@ -5,9 +5,9 @@ import TileLayer from '../src/ol/layer/Tile.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'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var raster = new TileLayer({ @@ -16,11 +16,11 @@ var raster = new TileLayer({ }) }); -var style = new _ol_style_Style_({ - fill: new _ol_style_Fill_({ +var style = new Style({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', width: 1 }) diff --git a/examples/topolis.js b/examples/topolis.js index 25838c83f0..5358056cb3 100644 --- a/examples/topolis.js +++ b/examples/topolis.js @@ -8,16 +8,16 @@ 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 Snap from '../src/ol/interaction/Snap.js'; import TileLayer from '../src/ol/layer/Tile.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'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Text_ from '../src/ol/style/Text.js'; +import Style from '../src/ol/style/Style.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Fill from '../src/ol/style/Fill.js'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Text from '../src/ol/style/Text.js'; import MousePosition from '../src/ol/control/MousePosition.js'; var raster = new TileLayer({ @@ -28,16 +28,16 @@ var nodes = new VectorSource({wrapX: false}); var nodesLayer = new VectorLayer({ source: nodes, style: function(f) { - var style = new _ol_style_Style_({ - image: new _ol_style_Circle_({ + var style = new Style({ + image: new CircleStyle({ radius: 8, - fill: new _ol_style_Fill_({color: 'rgba(255, 0, 0, 0.2)'}), - stroke: new _ol_style_Stroke_({color: 'red', width: 1}) + fill: new Fill({color: 'rgba(255, 0, 0, 0.2)'}), + stroke: new Stroke({color: 'red', width: 1}) }), - text: new _ol_style_Text_({ + text: new Text({ text: f.get('node').id.toString(), - fill: new _ol_style_Fill_({color: 'red'}), - stroke: new _ol_style_Stroke_({ + fill: new Fill({color: 'red'}), + stroke: new Stroke({ color: 'white', width: 3 }) @@ -51,15 +51,15 @@ var edges = new VectorSource({wrapX: false}); var edgesLayer = new VectorLayer({ source: edges, style: function(f) { - var style = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + var style = new Style({ + stroke: new Stroke({ color: 'blue', width: 1 }), - text: new _ol_style_Text_({ + text: new Text({ text: f.get('edge').id.toString(), - fill: new _ol_style_Fill_({color: 'blue'}), - stroke: new _ol_style_Stroke_({ + fill: new Fill({color: 'blue'}), + stroke: new Stroke({ color: 'white', width: 2 }) @@ -73,19 +73,19 @@ var faces = new VectorSource({wrapX: false}); var facesLayer = new VectorLayer({ source: faces, style: function(f) { - var style = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + var style = new Style({ + stroke: new Stroke({ color: 'black', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0, 255, 0, 0.2)' }), - text: new _ol_style_Text_({ + text: new Text({ font: 'bold 12px sans-serif', text: f.get('face').id.toString(), - fill: new _ol_style_Fill_({color: 'green'}), - stroke: new _ol_style_Stroke_({ + fill: new Fill({color: 'green'}), + stroke: new Stroke({ color: 'white', width: 2 }) @@ -209,7 +209,7 @@ var draw = new Draw({ }); draw.on('drawend', onDrawend); map.addInteraction(draw); -var snap = new _ol_interaction_Snap_({ +var snap = new Snap({ source: edges }); map.addInteraction(snap); diff --git a/examples/translate-features.js b/examples/translate-features.js index 5ea637c8a1..1638798c9b 100644 --- a/examples/translate-features.js +++ b/examples/translate-features.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.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 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 VectorLayer from '../src/ol/layer/Vector.js'; @@ -21,7 +21,7 @@ var vector = new VectorLayer({ }) }); -var select = new _ol_interaction_Select_(); +var select = new Select(); var translate = new _ol_interaction_Translate_({ features: select.getFeatures() diff --git a/examples/vector-esri-edit.js b/examples/vector-esri-edit.js index f0e15a643d..ba9d6e8f43 100644 --- a/examples/vector-esri-edit.js +++ b/examples/vector-esri-edit.js @@ -3,8 +3,8 @@ 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 Modify from '../src/ol/interaction/Modify.js'; +import Select from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js'; @@ -67,11 +67,11 @@ var draw = new Draw({ type: 'Polygon' }); -var select = new _ol_interaction_Select_(); +var select = new Select(); select.setActive(false); var selected = select.getFeatures(); -var modify = new _ol_interaction_Modify_({ +var modify = new Modify({ features: selected }); modify.setActive(false); diff --git a/examples/vector-esri.js b/examples/vector-esri.js index c281795d51..de7d898d67 100644 --- a/examples/vector-esri.js +++ b/examples/vector-esri.js @@ -7,9 +7,9 @@ import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js'; import {fromLonLat} from '../src/ol/proj.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'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; import _ol_tilegrid_ from '../src/ol/tilegrid.js'; @@ -20,38 +20,38 @@ var layer = '0'; var esrijsonFormat = new EsriJSON(); var styleCache = { - 'ABANDONED': new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + 'ABANDONED': new Style({ + fill: new Fill({ color: 'rgba(225, 225, 225, 255)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(0, 0, 0, 255)', width: 0.4 }) }), - 'GAS': new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + 'GAS': new Style({ + fill: new Fill({ color: 'rgba(255, 0, 0, 255)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(110, 110, 110, 255)', width: 0.4 }) }), - 'OIL': new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + 'OIL': new Style({ + fill: new Fill({ color: 'rgba(56, 168, 0, 255)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(110, 110, 110, 255)', width: 0 }) }), - 'OILGAS': new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + 'OILGAS': new Style({ + fill: new Fill({ color: 'rgba(168, 112, 0, 255)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(110, 110, 110, 255)', width: 0.4 }) diff --git a/examples/vector-label-decluttering.js b/examples/vector-label-decluttering.js index 5557e09e50..8daf6e326f 100644 --- a/examples/vector-label-decluttering.js +++ b/examples/vector-label-decluttering.js @@ -4,10 +4,10 @@ import * as _ol_extent_ from '../src/ol/extent.js'; import GeoJSON from '../src/ol/format/GeoJSON.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'; -import _ol_style_Text_ from '../src/ol/style/Text.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; +import Text from '../src/ol/style/Text.js'; var map = new Map({ target: 'map', @@ -17,7 +17,7 @@ var map = new Map({ }) }); -var labelStyle = new _ol_style_Style_({ +var labelStyle = new Style({ geometry: function(feature) { var geometry = feature.getGeometry(); if (geometry.getType() == 'MultiPolygon') { @@ -35,23 +35,23 @@ var labelStyle = new _ol_style_Style_({ } return geometry; }, - text: new _ol_style_Text_({ + text: new Text({ font: '12px Calibri,sans-serif', overflow: true, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#000' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#fff', width: 3 }) }) }); -var countryStyle = new _ol_style_Style_({ - fill: new _ol_style_Fill_({ +var countryStyle = new Style({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', width: 1 }) diff --git a/examples/vector-labels.js b/examples/vector-labels.js index 1b2e65e382..9b1858563f 100644 --- a/examples/vector-labels.js +++ b/examples/vector-labels.js @@ -5,11 +5,11 @@ import TileLayer from '../src/ol/layer/Tile.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'; -import _ol_style_Text_ from '../src/ol/style/Text.js'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; +import Text from '../src/ol/style/Text.js'; var openSansAdded = false; @@ -109,13 +109,13 @@ var createTextStyle = function(feature, resolution, dom) { var outlineColor = dom.outline.value; var outlineWidth = parseInt(dom.outlineWidth.value, 10); - return new _ol_style_Text_({ + return new Text({ textAlign: align == '' ? undefined : align, textBaseline: baseline, font: font, text: getText(feature, resolution, dom), - fill: new _ol_style_Fill_({color: fillColor}), - stroke: new _ol_style_Stroke_({color: outlineColor, width: outlineWidth}), + fill: new Fill({color: fillColor}), + stroke: new Stroke({color: outlineColor, width: outlineWidth}), offsetX: offsetX, offsetY: offsetY, placement: placement, @@ -128,12 +128,12 @@ var createTextStyle = function(feature, resolution, dom) { // Polygons function polygonStyleFunction(feature, resolution) { - return new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + return new Style({ + stroke: new Stroke({ color: 'blue', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0, 0, 255, 0.1)' }), text: createTextStyle(feature, resolution, myDom.polygons) @@ -151,8 +151,8 @@ var vectorPolygons = new VectorLayer({ // Lines function lineStyleFunction(feature, resolution) { - return new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + return new Style({ + stroke: new Stroke({ color: 'green', width: 2 }), @@ -171,11 +171,11 @@ var vectorLines = new VectorLayer({ // Points function pointStyleFunction(feature, resolution) { - return new _ol_style_Style_({ - image: new _ol_style_Circle_({ + return new Style({ + image: new CircleStyle({ radius: 10, - fill: new _ol_style_Fill_({color: 'rgba(255, 0, 0, 0.1)'}), - stroke: new _ol_style_Stroke_({color: 'red', width: 1}) + fill: new Fill({color: 'rgba(255, 0, 0, 0.1)'}), + stroke: new Stroke({color: 'red', width: 1}) }), text: createTextStyle(feature, resolution, myDom.points) }); diff --git a/examples/vector-layer.js b/examples/vector-layer.js index 22dcd5e206..66b9b8bab2 100644 --- a/examples/vector-layer.js +++ b/examples/vector-layer.js @@ -3,26 +3,26 @@ import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.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'; -import _ol_style_Text_ from '../src/ol/style/Text.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; +import Text from '../src/ol/style/Text.js'; -var style = new _ol_style_Style_({ - fill: new _ol_style_Fill_({ +var style = new Style({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', width: 1 }), - text: new _ol_style_Text_({ + text: new Text({ font: '12px Calibri,sans-serif', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#000' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#fff', width: 3 }) @@ -49,20 +49,20 @@ var map = new Map({ }) }); -var highlightStyle = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ +var highlightStyle = new Style({ + stroke: new Stroke({ color: '#f00', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255,0,0,0.1)' }), - text: new _ol_style_Text_({ + text: new Text({ font: '12px Calibri,sans-serif', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#000' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#f00', width: 3 }) diff --git a/examples/vector-osm.js b/examples/vector-osm.js index d42d9521cb..2026eee098 100644 --- a/examples/vector-osm.js +++ b/examples/vector-osm.js @@ -8,67 +8,67 @@ import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js'; import {transformExtent} from '../src/ol/proj.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'; +import CircleStyle from '../src/ol/style/Circle.js'; +import Fill from '../src/ol/style/Fill.js'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var map; var styles = { 'amenity': { - 'parking': new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + 'parking': new Style({ + stroke: new Stroke({ color: 'rgba(170, 170, 170, 1.0)', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(170, 170, 170, 0.3)' }) }) }, 'building': { - '.*': new _ol_style_Style_({ + '.*': new Style({ zIndex: 100, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(246, 99, 79, 1.0)', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(246, 99, 79, 0.3)' }) }) }, 'highway': { - 'service': new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + 'service': new Style({ + stroke: new Stroke({ color: 'rgba(255, 255, 255, 1.0)', width: 2 }) }), - '.*': new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + '.*': new Style({ + stroke: new Stroke({ color: 'rgba(255, 255, 255, 1.0)', width: 3 }) }) }, 'landuse': { - 'forest|grass|allotments': new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + 'forest|grass|allotments': new Style({ + stroke: new Stroke({ color: 'rgba(140, 208, 95, 1.0)', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(140, 208, 95, 0.3)' }) }) }, 'natural': { - 'tree': new _ol_style_Style_({ - image: new _ol_style_Circle_({ + 'tree': new Style({ + image: new CircleStyle({ radius: 2, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(140, 208, 95, 1.0)' }), stroke: null diff --git a/examples/vector-tile-info.js b/examples/vector-tile-info.js index a159eb02ec..01fff8070c 100644 --- a/examples/vector-tile-info.js +++ b/examples/vector-tile-info.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.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 VectorTileLayer from '../src/ol/layer/VectorTile.js'; import VectorTileSource from '../src/ol/source/VectorTile.js'; var map = new Map({ @@ -10,7 +10,7 @@ var map = new Map({ center: [0, 0], zoom: 2 }), - layers: [new _ol_layer_VectorTile_({ + layers: [new VectorTileLayer({ 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 6a64ddbd5f..9b8b530f57 100644 --- a/examples/vector-wfs-getfeature.js +++ b/examples/vector-wfs-getfeature.js @@ -7,15 +7,15 @@ import TileLayer from '../src/ol/layer/Tile.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'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var vectorSource = new VectorSource(); var vector = new VectorLayer({ source: vectorSource, - style: new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + style: new Style({ + stroke: new Stroke({ color: 'rgba(0, 0, 255, 1.0)', width: 2 }) diff --git a/examples/vector-wfs.js b/examples/vector-wfs.js index 01d9a85efe..59275be629 100644 --- a/examples/vector-wfs.js +++ b/examples/vector-wfs.js @@ -6,8 +6,8 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.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'; +import Stroke from '../src/ol/style/Stroke.js'; +import Style from '../src/ol/style/Style.js'; var vectorSource = new VectorSource({ @@ -24,8 +24,8 @@ var vectorSource = new VectorSource({ var vector = new VectorLayer({ source: vectorSource, - style: new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + style: new Style({ + stroke: new Stroke({ color: 'rgba(0, 0, 255, 1.0)', width: 2 }) diff --git a/examples/wms-custom-proj.js b/examples/wms-custom-proj.js index 473997a764..918b165547 100644 --- a/examples/wms-custom-proj.js +++ b/examples/wms-custom-proj.js @@ -4,7 +4,7 @@ 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 Projection from '../src/ol/proj/Projection.js'; import TileWMS from '../src/ol/source/TileWMS.js'; @@ -13,7 +13,7 @@ import TileWMS from '../src/ol/source/TileWMS.js'; // ol.proj.addProjection to make it available to the library for lookup by its // code. -var projection = new _ol_proj_Projection_({ +var projection = new Projection({ code: 'EPSG:21781', // The extent is used to determine zoom level 0. Recommended values for a // projection's validity extent can be found at https://epsg.io/. diff --git a/examples/wms-image-custom-proj.js b/examples/wms-image-custom-proj.js index b3be1e0b07..e01e64c903 100644 --- a/examples/wms-image-custom-proj.js +++ b/examples/wms-image-custom-proj.js @@ -4,7 +4,7 @@ import {defaults as defaultControls} from '../src/ol/control.js'; import ScaleLine from '../src/ol/control/ScaleLine.js'; import ImageLayer from '../src/ol/layer/Image.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; +import Projection from '../src/ol/proj/Projection.js'; import ImageWMS from '../src/ol/source/ImageWMS.js'; import {register} from '../src/ol/proj/proj4.js'; import proj4 from 'proj4'; @@ -29,7 +29,7 @@ proj4.defs('EPSG:21781', '+towgs84=660.077,13.551,369.344,2.484,1.783,2.939,5.66 +units=m +no_defs'); register(proj4); -var projection = new _ol_proj_Projection_({ +var projection = new Projection({ code: 'EPSG:21781', extent: [485869.5728, 76443.1884, 837076.5648, 299941.7864] }); diff --git a/examples/wms-no-proj.js b/examples/wms-no-proj.js index dfe3625a45..2acc62144e 100644 --- a/examples/wms-no-proj.js +++ b/examples/wms-no-proj.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.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_proj_Projection_ from '../src/ol/proj/Projection.js'; +import Projection from '../src/ol/proj/Projection.js'; import ImageWMS from '../src/ol/source/ImageWMS.js'; import TileWMS from '../src/ol/source/TileWMS.js'; @@ -37,7 +37,7 @@ var layers = [ // projection object. Requesting tiles only needs the code together with a // tile grid of Cartesian coordinates; it does not matter how those // coordinates relate to latitude or longitude. -var projection = new _ol_proj_Projection_({ +var projection = new Projection({ code: 'EPSG:21781', units: 'm' }); diff --git a/src/ol/Collection.js b/src/ol/Collection.js index fb1423da1c..c39d984504 100644 --- a/src/ol/Collection.js +++ b/src/ol/Collection.js @@ -41,7 +41,7 @@ export var CollectionOptions; * @template T * @api */ -var _ol_Collection_ = function(opt_array, opt_options) { +var Collection = function(opt_array, opt_options) { BaseObject.call(this); @@ -69,14 +69,14 @@ var _ol_Collection_ = function(opt_array, opt_options) { }; -inherits(_ol_Collection_, BaseObject); +inherits(Collection, BaseObject); /** * Remove all elements from the collection. * @api */ -_ol_Collection_.prototype.clear = function() { +Collection.prototype.clear = function() { while (this.getLength() > 0) { this.pop(); } @@ -90,7 +90,7 @@ _ol_Collection_.prototype.clear = function() { * @return {ol.Collection.} This collection. * @api */ -_ol_Collection_.prototype.extend = function(arr) { +Collection.prototype.extend = function(arr) { var i, ii; for (i = 0, ii = arr.length; i < ii; ++i) { this.push(arr[i]); @@ -106,7 +106,7 @@ _ol_Collection_.prototype.extend = function(arr) { * index and the array). The return value is ignored. * @api */ -_ol_Collection_.prototype.forEach = function(f) { +Collection.prototype.forEach = function(f) { var array = this.array_; for (var i = 0, ii = array.length; i < ii; ++i) { f(array[i], i, array); @@ -122,7 +122,7 @@ _ol_Collection_.prototype.forEach = function(f) { * @return {!Array.} Array. * @api */ -_ol_Collection_.prototype.getArray = function() { +Collection.prototype.getArray = function() { return this.array_; }; @@ -133,7 +133,7 @@ _ol_Collection_.prototype.getArray = function() { * @return {T} Element. * @api */ -_ol_Collection_.prototype.item = function(index) { +Collection.prototype.item = function(index) { return this.array_[index]; }; @@ -144,7 +144,7 @@ _ol_Collection_.prototype.item = function(index) { * @observable * @api */ -_ol_Collection_.prototype.getLength = function() { +Collection.prototype.getLength = function() { return (/** @type {number} */ this.get(Property.LENGTH)); }; @@ -155,14 +155,14 @@ _ol_Collection_.prototype.getLength = function() { * @param {T} elem Element. * @api */ -_ol_Collection_.prototype.insertAt = function(index, elem) { +Collection.prototype.insertAt = function(index, elem) { if (this.unique_) { this.assertUnique_(elem); } this.array_.splice(index, 0, elem); this.updateLength_(); this.dispatchEvent( - new _ol_Collection_.Event(CollectionEventType.ADD, elem)); + new Collection.Event(CollectionEventType.ADD, elem)); }; @@ -172,7 +172,7 @@ _ol_Collection_.prototype.insertAt = function(index, elem) { * @return {T|undefined} Element. * @api */ -_ol_Collection_.prototype.pop = function() { +Collection.prototype.pop = function() { return this.removeAt(this.getLength() - 1); }; @@ -183,7 +183,7 @@ _ol_Collection_.prototype.pop = function() { * @return {number} New length of the collection. * @api */ -_ol_Collection_.prototype.push = function(elem) { +Collection.prototype.push = function(elem) { if (this.unique_) { this.assertUnique_(elem); } @@ -199,7 +199,7 @@ _ol_Collection_.prototype.push = function(elem) { * @return {T|undefined} The removed element or undefined if none found. * @api */ -_ol_Collection_.prototype.remove = function(elem) { +Collection.prototype.remove = function(elem) { var arr = this.array_; var i, ii; for (i = 0, ii = arr.length; i < ii; ++i) { @@ -218,12 +218,12 @@ _ol_Collection_.prototype.remove = function(elem) { * @return {T|undefined} Value. * @api */ -_ol_Collection_.prototype.removeAt = function(index) { +Collection.prototype.removeAt = function(index) { var prev = this.array_[index]; this.array_.splice(index, 1); this.updateLength_(); this.dispatchEvent( - new _ol_Collection_.Event(CollectionEventType.REMOVE, prev)); + new Collection.Event(CollectionEventType.REMOVE, prev)); return prev; }; @@ -234,7 +234,7 @@ _ol_Collection_.prototype.removeAt = function(index) { * @param {T} elem Element. * @api */ -_ol_Collection_.prototype.setAt = function(index, elem) { +Collection.prototype.setAt = function(index, elem) { var n = this.getLength(); if (index < n) { if (this.unique_) { @@ -243,9 +243,9 @@ _ol_Collection_.prototype.setAt = function(index, elem) { var prev = this.array_[index]; this.array_[index] = elem; this.dispatchEvent( - new _ol_Collection_.Event(CollectionEventType.REMOVE, prev)); + new Collection.Event(CollectionEventType.REMOVE, prev)); this.dispatchEvent( - new _ol_Collection_.Event(CollectionEventType.ADD, elem)); + new Collection.Event(CollectionEventType.ADD, elem)); } else { var j; for (j = n; j < index; ++j) { @@ -259,7 +259,7 @@ _ol_Collection_.prototype.setAt = function(index, elem) { /** * @private */ -_ol_Collection_.prototype.updateLength_ = function() { +Collection.prototype.updateLength_ = function() { this.set(Property.LENGTH, this.array_.length); }; @@ -269,7 +269,7 @@ _ol_Collection_.prototype.updateLength_ = function() { * @param {T} elem Element. * @param {number=} opt_except Optional index to ignore. */ -_ol_Collection_.prototype.assertUnique_ = function(elem, opt_except) { +Collection.prototype.assertUnique_ = function(elem, opt_except) { for (var i = 0, ii = this.array_.length; i < ii; ++i) { if (this.array_[i] === elem && i !== opt_except) { throw new AssertionError(58); @@ -288,7 +288,7 @@ _ol_Collection_.prototype.assertUnique_ = function(elem, opt_except) { * @param {ol.CollectionEventType} type Type. * @param {*=} opt_element Element. */ -_ol_Collection_.Event = function(type, opt_element) { +Collection.Event = function(type, opt_element) { Event.call(this, type); @@ -300,6 +300,6 @@ _ol_Collection_.Event = function(type, opt_element) { this.element = opt_element; }; -inherits(_ol_Collection_.Event, Event); +inherits(Collection.Event, Event); -export default _ol_Collection_; +export default Collection; diff --git a/src/ol/Feature.js b/src/ol/Feature.js index 6e9e78ff97..639aa36210 100644 --- a/src/ol/Feature.js +++ b/src/ol/Feature.js @@ -7,7 +7,7 @@ import EventType from './events/EventType.js'; import {inherits} from './index.js'; import BaseObject from './Object.js'; import Geometry from './geom/Geometry.js'; -import _ol_style_Style_ from './style/Style.js'; +import Style from './style/Style.js'; /** * @classdesc @@ -307,7 +307,7 @@ Feature.createStyleFunction = function(obj) { if (Array.isArray(obj)) { styles = obj; } else { - assert(obj instanceof _ol_style_Style_, + assert(obj instanceof Style, 41); // Expected an `ol.style.Style` or an array of `ol.style.Style` styles = [obj]; } diff --git a/src/ol/Graticule.js b/src/ol/Graticule.js index 5df54754dd..ff950a4095 100644 --- a/src/ol/Graticule.js +++ b/src/ol/Graticule.js @@ -10,9 +10,9 @@ import _ol_geom_flat_geodesic_ from './geom/flat/geodesic.js'; import {clamp} from './math.js'; import {get as getProjection, equivalent as equivalentProjection, getTransform, transformExtent} from './proj.js'; import RenderEventType from './render/EventType.js'; -import _ol_style_Fill_ from './style/Fill.js'; -import _ol_style_Stroke_ from './style/Stroke.js'; -import _ol_style_Text_ from './style/Text.js'; +import Fill from './style/Fill.js'; +import Stroke from './style/Stroke.js'; +import Text from './style/Text.js'; /** @@ -20,7 +20,7 @@ import _ol_style_Text_ from './style/Text.js'; * @private * @const */ -var DEFAULT_STROKE_STYLE = new _ol_style_Stroke_({ +var DEFAULT_STROKE_STYLE = new Stroke({ color: 'rgba(0,0,0,0.2)' }); @@ -283,13 +283,13 @@ var Graticule = function(opt_options) { * @private */ this.lonLabelStyle_ = options.lonLabelStyle !== undefined ? options.lonLabelStyle : - new _ol_style_Text_({ + new Text({ font: '12px Calibri,sans-serif', textBaseline: 'bottom', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0,0,0,1)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(255,255,255,1)', width: 3 }) @@ -300,13 +300,13 @@ var Graticule = function(opt_options) { * @private */ this.latLabelStyle_ = options.latLabelStyle !== undefined ? options.latLabelStyle : - new _ol_style_Text_({ + new Text({ font: '12px Calibri,sans-serif', textAlign: 'end', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0,0,0,1)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(255,255,255,1)', width: 3 }) diff --git a/src/ol/ImageTile.js b/src/ol/ImageTile.js index e50e38eb98..7767926f41 100644 --- a/src/ol/ImageTile.js +++ b/src/ol/ImageTile.js @@ -2,7 +2,7 @@ * @module ol/ImageTile */ import {inherits} from './index.js'; -import _ol_Tile_ from './Tile.js'; +import Tile from './Tile.js'; import TileState from './TileState.js'; import {createCanvasContext2D} from './dom.js'; import _ol_events_ from './events.js'; @@ -20,7 +20,7 @@ import EventType from './events/EventType.js'; */ var ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) { - _ol_Tile_.call(this, tileCoord, state, opt_options); + Tile.call(this, tileCoord, state, opt_options); /** * @private @@ -59,7 +59,7 @@ var ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction, o }; -inherits(ImageTile, _ol_Tile_); +inherits(ImageTile, Tile); /** @@ -75,7 +75,7 @@ ImageTile.prototype.disposeInternal = function() { } this.state = TileState.ABORT; this.changed(); - _ol_Tile_.prototype.disposeInternal.call(this); + Tile.prototype.disposeInternal.call(this); }; diff --git a/src/ol/MapBrowserEventHandler.js b/src/ol/MapBrowserEventHandler.js index 2fbb76d756..5bb188e837 100644 --- a/src/ol/MapBrowserEventHandler.js +++ b/src/ol/MapBrowserEventHandler.js @@ -8,7 +8,7 @@ import MapBrowserPointerEvent from './MapBrowserPointerEvent.js'; import _ol_events_ from './events.js'; import EventTarget from './events/EventTarget.js'; import PointerEventType from './pointer/EventType.js'; -import _ol_pointer_PointerEventHandler_ from './pointer/PointerEventHandler.js'; +import PointerEventHandler from './pointer/PointerEventHandler.js'; /** * @param {ol.PluggableMap} map The map with the viewport to listen to events on. @@ -81,7 +81,7 @@ var MapBrowserEventHandler = function(map, moveTolerance) { * @type {ol.pointer.PointerEventHandler} * @private */ - this.pointerEventHandler_ = new _ol_pointer_PointerEventHandler_(element); + this.pointerEventHandler_ = new PointerEventHandler(element); /** * Event handler which generates pointer events for @@ -218,7 +218,7 @@ MapBrowserEventHandler.prototype.handlePointerDown_ = function(pointerEvent) { * the viewport when dragging. */ this.documentPointerEventHandler_ = - new _ol_pointer_PointerEventHandler_(document); + new PointerEventHandler(document); this.dragListenerKeys_.push( _ol_events_.listen(this.documentPointerEventHandler_, diff --git a/src/ol/PluggableMap.js b/src/ol/PluggableMap.js index f73b68121e..e0c76532ee 100644 --- a/src/ol/PluggableMap.js +++ b/src/ol/PluggableMap.js @@ -2,7 +2,7 @@ * @module ol/PluggableMap */ import {getUid, inherits} from './index.js'; -import _ol_Collection_ from './Collection.js'; +import Collection from './Collection.js'; import CollectionEventType from './CollectionEventType.js'; import MapBrowserEvent from './MapBrowserEvent.js'; import MapBrowserEventHandler from './MapBrowserEventHandler.js'; @@ -23,7 +23,7 @@ import EventType from './events/EventType.js'; import {createEmpty, clone, createOrUpdateEmpty, equals, getForViewAndSize, isEmpty} from './extent.js'; import {TRUE} from './functions.js'; import _ol_has_ from './has.js'; -import _ol_layer_Group_ from './layer/Group.js'; +import LayerGroup from './layer/Group.js'; import {getMapRendererPlugins} from './plugins.js'; import RendererType from './renderer/Type.js'; import _ol_size_ from './size.js'; @@ -276,13 +276,13 @@ var PluggableMap = function(options) { * @type {ol.Collection.} * @protected */ - this.controls = optionsInternal.controls || new _ol_Collection_(); + this.controls = optionsInternal.controls || new Collection(); /** * @type {ol.Collection.} * @protected */ - this.interactions = optionsInternal.interactions || new _ol_Collection_(); + this.interactions = optionsInternal.interactions || new Collection(); /** * @type {ol.Collection.} @@ -1404,8 +1404,8 @@ function createOptionsInternal(options) { */ var values = {}; - var layerGroup = (options.layers instanceof _ol_layer_Group_) ? - options.layers : new _ol_layer_Group_({layers: options.layers}); + var layerGroup = (options.layers instanceof LayerGroup) ? + options.layers : new LayerGroup({layers: options.layers}); values[MapProperty.LAYERGROUP] = layerGroup; values[MapProperty.TARGET] = options.target; @@ -1457,9 +1457,9 @@ function createOptionsInternal(options) { var controls; if (options.controls !== undefined) { if (Array.isArray(options.controls)) { - controls = new _ol_Collection_(options.controls.slice()); + controls = new Collection(options.controls.slice()); } else { - assert(options.controls instanceof _ol_Collection_, + assert(options.controls instanceof Collection, 47); // Expected `controls` to be an array or an `ol.Collection` controls = options.controls; } @@ -1468,9 +1468,9 @@ function createOptionsInternal(options) { var interactions; if (options.interactions !== undefined) { if (Array.isArray(options.interactions)) { - interactions = new _ol_Collection_(options.interactions.slice()); + interactions = new Collection(options.interactions.slice()); } else { - assert(options.interactions instanceof _ol_Collection_, + assert(options.interactions instanceof Collection, 48); // Expected `interactions` to be an array or an `ol.Collection` interactions = options.interactions; } @@ -1479,14 +1479,14 @@ function createOptionsInternal(options) { var overlays; if (options.overlays !== undefined) { if (Array.isArray(options.overlays)) { - overlays = new _ol_Collection_(options.overlays.slice()); + overlays = new Collection(options.overlays.slice()); } else { - assert(options.overlays instanceof _ol_Collection_, + assert(options.overlays instanceof Collection, 49); // Expected `overlays` to be an array or an `ol.Collection` overlays = options.overlays; } } else { - overlays = new _ol_Collection_(); + overlays = new Collection(); } return { diff --git a/src/ol/Tile.js b/src/ol/Tile.js index 63430c4985..4497d29423 100644 --- a/src/ol/Tile.js +++ b/src/ol/Tile.js @@ -18,7 +18,7 @@ import EventType from './events/EventType.js'; * @param {ol.TileState} state State. * @param {olx.TileOptions=} opt_options Tile options. */ -var _ol_Tile_ = function(tileCoord, state, opt_options) { +var Tile = function(tileCoord, state, opt_options) { EventTarget.call(this); var options = opt_options ? opt_options : {}; @@ -66,13 +66,13 @@ var _ol_Tile_ = function(tileCoord, state, opt_options) { }; -inherits(_ol_Tile_, EventTarget); +inherits(Tile, EventTarget); /** * @protected */ -_ol_Tile_.prototype.changed = function() { +Tile.prototype.changed = function() { this.dispatchEvent(EventType.CHANGE); }; @@ -80,7 +80,7 @@ _ol_Tile_.prototype.changed = function() { /** * @return {string} Key. */ -_ol_Tile_.prototype.getKey = function() { +Tile.prototype.getKey = function() { return this.key + '/' + this.tileCoord; }; @@ -90,7 +90,7 @@ _ol_Tile_.prototype.getKey = function() { * such tile exists, the original tile is returned. * @return {!ol.Tile} Best tile for rendering. */ -_ol_Tile_.prototype.getInterimTile = function() { +Tile.prototype.getInterimTile = function() { if (!this.interimTile) { //empty chain return this; @@ -116,7 +116,7 @@ _ol_Tile_.prototype.getInterimTile = function() { * Goes through the chain of interim tiles and discards sections of the chain * that are no longer relevant. */ -_ol_Tile_.prototype.refreshInterimChain = function() { +Tile.prototype.refreshInterimChain = function() { if (!this.interimTile) { return; } @@ -151,7 +151,7 @@ _ol_Tile_.prototype.refreshInterimChain = function() { * @return {ol.TileCoord} The tile coordinate. * @api */ -_ol_Tile_.prototype.getTileCoord = function() { +Tile.prototype.getTileCoord = function() { return this.tileCoord; }; @@ -159,14 +159,14 @@ _ol_Tile_.prototype.getTileCoord = function() { /** * @return {ol.TileState} State. */ -_ol_Tile_.prototype.getState = function() { +Tile.prototype.getState = function() { return this.state; }; /** * @param {ol.TileState} state State. */ -_ol_Tile_.prototype.setState = function(state) { +Tile.prototype.setState = function(state) { this.state = state; this.changed(); }; @@ -178,7 +178,7 @@ _ol_Tile_.prototype.setState = function(state) { * @abstract * @api */ -_ol_Tile_.prototype.load = function() {}; +Tile.prototype.load = function() {}; /** * Get the alpha value for rendering. @@ -186,7 +186,7 @@ _ol_Tile_.prototype.load = function() {}; * @param {number} time The render frame time. * @return {number} A number between 0 and 1. */ -_ol_Tile_.prototype.getAlpha = function(id, time) { +Tile.prototype.getAlpha = function(id, time) { if (!this.transition_) { return 1; } @@ -213,7 +213,7 @@ _ol_Tile_.prototype.getAlpha = function(id, time) { * @param {number} id An id for the renderer. * @return {boolean} The tile is in transition. */ -_ol_Tile_.prototype.inTransition = function(id) { +Tile.prototype.inTransition = function(id) { if (!this.transition_) { return false; } @@ -224,9 +224,9 @@ _ol_Tile_.prototype.inTransition = function(id) { * Mark a transition as complete. * @param {number} id An id for the renderer. */ -_ol_Tile_.prototype.endTransition = function(id) { +Tile.prototype.endTransition = function(id) { if (this.transition_) { this.transitionStarts_[id] = -1; } }; -export default _ol_Tile_; +export default Tile; diff --git a/src/ol/VectorImageTile.js b/src/ol/VectorImageTile.js index 0118537438..6dcb4576ad 100644 --- a/src/ol/VectorImageTile.js +++ b/src/ol/VectorImageTile.js @@ -2,7 +2,7 @@ * @module ol/VectorImageTile */ import {getUid, inherits} from './index.js'; -import _ol_Tile_ from './Tile.js'; +import Tile from './Tile.js'; import TileState from './TileState.js'; import {createCanvasContext2D} from './dom.js'; import _ol_events_ from './events.js'; @@ -36,7 +36,7 @@ var VectorImageTile = function(tileCoord, state, sourceRevision, format, tileLoadFunction, urlTileCoord, tileUrlFunction, sourceTileGrid, tileGrid, sourceTiles, pixelRatio, projection, tileClass, handleTileChange, opt_options) { - _ol_Tile_.call(this, tileCoord, state, opt_options); + Tile.call(this, tileCoord, state, opt_options); /** * @private @@ -121,7 +121,7 @@ var VectorImageTile = function(tileCoord, state, sourceRevision, format, }; -inherits(VectorImageTile, _ol_Tile_); +inherits(VectorImageTile, Tile); /** @@ -149,7 +149,7 @@ VectorImageTile.prototype.disposeInternal = function() { this.loadListenerKeys_.length = 0; this.sourceTileListenerKeys_.forEach(_ol_events_.unlistenByKey); this.sourceTileListenerKeys_.length = 0; - _ol_Tile_.prototype.disposeInternal.call(this); + Tile.prototype.disposeInternal.call(this); }; diff --git a/src/ol/VectorTile.js b/src/ol/VectorTile.js index 90e048c389..c5830c6231 100644 --- a/src/ol/VectorTile.js +++ b/src/ol/VectorTile.js @@ -2,7 +2,7 @@ * @module ol/VectorTile */ import {getUid, inherits} from './index.js'; -import _ol_Tile_ from './Tile.js'; +import Tile from './Tile.js'; import TileState from './TileState.js'; /** @@ -17,7 +17,7 @@ import TileState from './TileState.js'; */ var VectorTile = function(tileCoord, state, src, format, tileLoadFunction, opt_options) { - _ol_Tile_.call(this, tileCoord, state, opt_options); + Tile.call(this, tileCoord, state, opt_options); /** * @type {number} @@ -75,7 +75,7 @@ var VectorTile = function(tileCoord, state, src, format, tileLoadFunction, opt_o }; -inherits(VectorTile, _ol_Tile_); +inherits(VectorTile, Tile); /** * @const @@ -92,7 +92,7 @@ VectorTile.prototype.disposeInternal = function() { this.replayGroups_ = {}; this.state = TileState.ABORT; this.changed(); - _ol_Tile_.prototype.disposeInternal.call(this); + Tile.prototype.disposeInternal.call(this); }; diff --git a/src/ol/control.js b/src/ol/control.js index 7184291adc..a0875894fd 100644 --- a/src/ol/control.js +++ b/src/ol/control.js @@ -1,7 +1,7 @@ /** * @module ol/control */ -import _ol_Collection_ from './Collection.js'; +import Collection from './Collection.js'; import Attribution from './control/Attribution.js'; import Rotate from './control/Rotate.js'; import Zoom from './control/Zoom.js'; @@ -23,7 +23,7 @@ export function defaults(opt_options) { var options = opt_options ? opt_options : {}; - var controls = new _ol_Collection_(); + var controls = new Collection(); var zoomControl = options.zoom !== undefined ? options.zoom : true; if (zoomControl) { diff --git a/src/ol/control/Attribution.js b/src/ol/control/Attribution.js index 047edc12cc..05f8c4feea 100644 --- a/src/ol/control/Attribution.js +++ b/src/ol/control/Attribution.js @@ -8,7 +8,7 @@ import {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js'; import {removeChildren, replaceNode} from '../dom.js'; import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; -import _ol_layer_Layer_ from '../layer/Layer.js'; +import Layer from '../layer/Layer.js'; /** * @classdesc @@ -146,7 +146,7 @@ Attribution.prototype.getSourceAttributions_ = function(frameState) { var resolution = frameState.viewState.resolution; for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) { var layerState = layerStatesArray[i]; - if (!_ol_layer_Layer_.visibleAtResolution(layerState, resolution)) { + if (!Layer.visibleAtResolution(layerState, resolution)) { continue; } diff --git a/src/ol/control/OverviewMap.js b/src/ol/control/OverviewMap.js index 74a562d114..dd8d4a441c 100644 --- a/src/ol/control/OverviewMap.js +++ b/src/ol/control/OverviewMap.js @@ -2,7 +2,7 @@ * @module ol/control/OverviewMap */ import {inherits} from '../index.js'; -import _ol_Collection_ from '../Collection.js'; +import Collection from '../Collection.js'; import PluggableMap from '../PluggableMap.js'; import MapEventType from '../MapEventType.js'; import MapProperty from '../MapProperty.js'; @@ -116,8 +116,8 @@ var OverviewMap = function(opt_options) { * @private */ this.ovmap_ = new PluggableMap({ - controls: new _ol_Collection_(), - interactions: new _ol_Collection_(), + controls: new Collection(), + interactions: new Collection(), view: options.view }); var ovmap = this.ovmap_; diff --git a/src/ol/control/ZoomSlider.js b/src/ol/control/ZoomSlider.js index 75845b816f..aea9f350b7 100644 --- a/src/ol/control/ZoomSlider.js +++ b/src/ol/control/ZoomSlider.js @@ -13,7 +13,7 @@ import Event from '../events/Event.js'; import EventType from '../events/EventType.js'; import {clamp} from '../math.js'; import PointerEventType from '../pointer/EventType.js'; -import _ol_pointer_PointerEventHandler_ from '../pointer/PointerEventHandler.js'; +import PointerEventHandler from '../pointer/PointerEventHandler.js'; /** * @classdesc @@ -111,7 +111,7 @@ var ZoomSlider = function(opt_options) { * @type {ol.pointer.PointerEventHandler} * @private */ - this.dragger_ = new _ol_pointer_PointerEventHandler_(containerElement); + this.dragger_ = new PointerEventHandler(containerElement); _ol_events_.listen(this.dragger_, PointerEventType.POINTERDOWN, this.handleDraggerStart_, this); diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index 3fcbf66bc4..95c0831a29 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -20,13 +20,13 @@ import Point from '../geom/Point.js'; import Polygon from '../geom/Polygon.js'; import {toRadians} from '../math.js'; import {get as getProjection} from '../proj.js'; -import _ol_style_Fill_ from '../style/Fill.js'; -import _ol_style_Icon_ from '../style/Icon.js'; +import Fill from '../style/Fill.js'; +import Icon from '../style/Icon.js'; import IconAnchorUnits from '../style/IconAnchorUnits.js'; import IconOrigin from '../style/IconOrigin.js'; -import _ol_style_Stroke_ from '../style/Stroke.js'; -import _ol_style_Style_ from '../style/Style.js'; -import _ol_style_Text_ from '../style/Text.js'; +import Stroke from '../style/Stroke.js'; +import Style from '../style/Style.js'; +import Text from '../style/Text.js'; import _ol_xml_ from '../xml.js'; /** @@ -145,7 +145,7 @@ KML.createStyleDefaults_ = function() { * @type {ol.style.Fill} * @private */ - KML.DEFAULT_FILL_STYLE_ = new _ol_style_Fill_({ + KML.DEFAULT_FILL_STYLE_ = new Fill({ color: KML.DEFAULT_COLOR_ }); @@ -197,7 +197,7 @@ KML.createStyleDefaults_ = function() { * @type {ol.style.Image} * @private */ - KML.DEFAULT_IMAGE_STYLE_ = new _ol_style_Icon_({ + KML.DEFAULT_IMAGE_STYLE_ = new Icon({ anchor: KML.DEFAULT_IMAGE_STYLE_ANCHOR_, anchorOrigin: IconOrigin.BOTTOM_LEFT, anchorXUnits: KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_, @@ -221,7 +221,7 @@ KML.createStyleDefaults_ = function() { * @type {ol.style.Stroke} * @private */ - KML.DEFAULT_STROKE_STYLE_ = new _ol_style_Stroke_({ + KML.DEFAULT_STROKE_STYLE_ = new Stroke({ color: KML.DEFAULT_COLOR_, width: 1 }); @@ -231,7 +231,7 @@ KML.createStyleDefaults_ = function() { * @type {ol.style.Stroke} * @private */ - KML.DEFAULT_TEXT_STROKE_STYLE_ = new _ol_style_Stroke_({ + KML.DEFAULT_TEXT_STROKE_STYLE_ = new Stroke({ color: [51, 51, 51, 1], width: 2 }); @@ -241,7 +241,7 @@ KML.createStyleDefaults_ = function() { * @type {ol.style.Text} * @private */ - KML.DEFAULT_TEXT_STYLE_ = new _ol_style_Text_({ + KML.DEFAULT_TEXT_STYLE_ = new Text({ font: 'bold 16px Helvetica', fill: KML.DEFAULT_FILL_STYLE_, stroke: KML.DEFAULT_TEXT_STROKE_STYLE_, @@ -253,7 +253,7 @@ KML.createStyleDefaults_ = function() { * @type {ol.style.Style} * @private */ - KML.DEFAULT_STYLE_ = new _ol_style_Style_({ + KML.DEFAULT_STYLE_ = new Style({ fill: KML.DEFAULT_FILL_STYLE_, image: KML.DEFAULT_IMAGE_STYLE_, text: KML.DEFAULT_TEXT_STYLE_, @@ -325,7 +325,7 @@ KML.createNameStyleFunction_ = function(foundStyle, name) { textStyle.setOffsetY(textOffset[1]); textStyle.setTextAlign(textAlign); - var nameStyle = new _ol_style_Style_({ + var nameStyle = new Style({ text: textStyle }); return nameStyle; @@ -631,7 +631,7 @@ KML.IconStyleParser_ = function(node, objectStack) { } } - var imageStyle = new _ol_style_Icon_({ + var imageStyle = new Icon({ anchor: anchor, anchorOrigin: anchorOrigin, anchorXUnits: anchorXUnits, @@ -665,8 +665,8 @@ KML.LabelStyleParser_ = function(node, objectStack) { return; } var styleObject = objectStack[objectStack.length - 1]; - var textStyle = new _ol_style_Text_({ - fill: new _ol_style_Fill_({ + var textStyle = new Text({ + fill: new Fill({ color: /** @type {ol.Color} */ ('color' in object ? object['color'] : KML.DEFAULT_COLOR_) }), @@ -694,7 +694,7 @@ KML.LineStyleParser_ = function(node, objectStack) { return; } var styleObject = objectStack[objectStack.length - 1]; - var strokeStyle = new _ol_style_Stroke_({ + var strokeStyle = new Stroke({ color: /** @type {ol.Color} */ ('color' in object ? object['color'] : KML.DEFAULT_COLOR_), width: /** @type {number} */ ('width' in object ? object['width'] : 1) @@ -716,7 +716,7 @@ KML.PolyStyleParser_ = function(node, objectStack) { return; } var styleObject = objectStack[objectStack.length - 1]; - var fillStyle = new _ol_style_Fill_({ + var fillStyle = new Fill({ color: /** @type {ol.Color} */ ('color' in object ? object['color'] : KML.DEFAULT_COLOR_) }); @@ -1042,7 +1042,7 @@ KML.readStyle_ = function(node, objectStack) { if (outline !== undefined && !outline) { strokeStyle = null; } - return [new _ol_style_Style_({ + return [new Style({ fill: fillStyle, image: imageStyle, stroke: strokeStyle, @@ -2555,7 +2555,7 @@ KML.writeStyle_ = function(node, style, objectStack) { var strokeStyle = style.getStroke(); var imageStyle = style.getImage(); var textStyle = style.getText(); - if (imageStyle instanceof _ol_style_Icon_) { + if (imageStyle instanceof Icon) { properties['IconStyle'] = imageStyle; } if (textStyle) { diff --git a/src/ol/format/MVT.js b/src/ol/format/MVT.js index 13322ed856..50cc47c91e 100644 --- a/src/ol/format/MVT.js +++ b/src/ol/format/MVT.js @@ -17,9 +17,9 @@ import MultiPolygon from '../geom/MultiPolygon.js'; 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 Projection from '../proj/Projection.js'; import Units from '../proj/Units.js'; -import _ol_render_Feature_ from '../render/Feature.js'; +import RenderFeature from '../render/Feature.js'; /** * @classdesc @@ -39,7 +39,7 @@ var MVT = function(opt_options) { /** * @type {ol.proj.Projection} */ - this.defaultDataProjection = new _ol_proj_Projection_({ + this.defaultDataProjection = new Projection({ code: '', units: Units.TILE_PIXELS }); @@ -51,7 +51,7 @@ var MVT = function(opt_options) { * (Array.|Array.>),Object.,number)} */ this.featureClass_ = options.featureClass ? - options.featureClass : _ol_render_Feature_; + options.featureClass : RenderFeature; /** * @private @@ -287,7 +287,7 @@ MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options) { var geometryType = MVT.getGeometryType_(type, ends.length); - if (this.featureClass_ === _ol_render_Feature_) { + if (this.featureClass_ === RenderFeature) { feature = new this.featureClass_(geometryType, flatCoordinates, ends, values, id); } else { var geom; diff --git a/src/ol/interaction.js b/src/ol/interaction.js index c8c135db32..6ecd3982b2 100644 --- a/src/ol/interaction.js +++ b/src/ol/interaction.js @@ -1,7 +1,7 @@ /** * @module ol/interaction */ -import _ol_Collection_ from './Collection.js'; +import Collection from './Collection.js'; import Kinetic from './Kinetic.js'; import DoubleClickZoom from './interaction/DoubleClickZoom.js'; import DragPan from './interaction/DragPan.js'; @@ -41,7 +41,7 @@ export function defaults(opt_options) { var options = opt_options ? opt_options : {}; - var interactions = new _ol_Collection_(); + var interactions = new Collection(); var kinetic = new Kinetic(-0.005, 0.05, 100); diff --git a/src/ol/interaction/DragBox.js b/src/ol/interaction/DragBox.js index 8329066293..2e2b569bfd 100644 --- a/src/ol/interaction/DragBox.js +++ b/src/ol/interaction/DragBox.js @@ -5,7 +5,7 @@ import Event from '../events/Event.js'; import {inherits, nullFunction} from '../index.js'; import _ol_events_condition_ from '../events/condition.js'; -import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; +import PointerInteraction from '../interaction/Pointer.js'; import _ol_render_Box_ from '../render/Box.js'; /** @@ -27,7 +27,7 @@ import _ol_render_Box_ from '../render/Box.js'; */ var DragBox = function(opt_options) { - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: DragBox.handleDownEvent_, handleDragEvent: DragBox.handleDragEvent_, handleUpEvent: DragBox.handleUpEvent_ @@ -68,7 +68,7 @@ var DragBox = function(opt_options) { options.boxEndCondition : DragBox.defaultBoxEndCondition; }; -inherits(DragBox, _ol_interaction_Pointer_); +inherits(DragBox, PointerInteraction); /** diff --git a/src/ol/interaction/DragPan.js b/src/ol/interaction/DragPan.js index 97220cc018..bd7e433847 100644 --- a/src/ol/interaction/DragPan.js +++ b/src/ol/interaction/DragPan.js @@ -7,7 +7,7 @@ import _ol_coordinate_ from '../coordinate.js'; import {easeOut} from '../easing.js'; import _ol_events_condition_ from '../events/condition.js'; import {FALSE} from '../functions.js'; -import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; +import PointerInteraction from '../interaction/Pointer.js'; /** * @classdesc @@ -20,7 +20,7 @@ import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; */ var DragPan = function(opt_options) { - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: DragPan.handleDownEvent_, handleDragEvent: DragPan.handleDragEvent_, handleUpEvent: DragPan.handleUpEvent_ @@ -59,7 +59,7 @@ var DragPan = function(opt_options) { }; -inherits(DragPan, _ol_interaction_Pointer_); +inherits(DragPan, PointerInteraction); /** @@ -70,7 +70,7 @@ inherits(DragPan, _ol_interaction_Pointer_); DragPan.handleDragEvent_ = function(mapBrowserEvent) { var targetPointers = this.targetPointers; var centroid = - _ol_interaction_Pointer_.centroid(targetPointers); + PointerInteraction.centroid(targetPointers); if (targetPointers.length == this.lastPointersCount_) { if (this.kinetic_) { this.kinetic_.update(centroid[0], centroid[1]); diff --git a/src/ol/interaction/DragRotate.js b/src/ol/interaction/DragRotate.js index 5b78c1d761..87facda506 100644 --- a/src/ol/interaction/DragRotate.js +++ b/src/ol/interaction/DragRotate.js @@ -7,7 +7,7 @@ import ViewHint from '../ViewHint.js'; import _ol_events_condition_ from '../events/condition.js'; import {FALSE} from '../functions.js'; import Interaction from '../interaction/Interaction.js'; -import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; +import PointerInteraction from '../interaction/Pointer.js'; /** * @classdesc @@ -26,7 +26,7 @@ var DragRotate = function(opt_options) { var options = opt_options ? opt_options : {}; - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: DragRotate.handleDownEvent_, handleDragEvent: DragRotate.handleDragEvent_, handleUpEvent: DragRotate.handleUpEvent_ @@ -52,7 +52,7 @@ var DragRotate = function(opt_options) { this.duration_ = options.duration !== undefined ? options.duration : 250; }; -inherits(DragRotate, _ol_interaction_Pointer_); +inherits(DragRotate, PointerInteraction); /** diff --git a/src/ol/interaction/DragRotateAndZoom.js b/src/ol/interaction/DragRotateAndZoom.js index 8846fd5dfc..757cdef2a9 100644 --- a/src/ol/interaction/DragRotateAndZoom.js +++ b/src/ol/interaction/DragRotateAndZoom.js @@ -6,7 +6,7 @@ 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'; +import PointerInteraction from '../interaction/Pointer.js'; /** * @classdesc @@ -27,7 +27,7 @@ var DragRotateAndZoom = function(opt_options) { var options = opt_options ? opt_options : {}; - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: DragRotateAndZoom.handleDownEvent_, handleDragEvent: DragRotateAndZoom.handleDragEvent_, handleUpEvent: DragRotateAndZoom.handleUpEvent_ @@ -66,7 +66,7 @@ var DragRotateAndZoom = function(opt_options) { }; -inherits(DragRotateAndZoom, _ol_interaction_Pointer_); +inherits(DragRotateAndZoom, PointerInteraction); /** diff --git a/src/ol/interaction/Draw.js b/src/ol/interaction/Draw.js index c6f739446f..dec83deed4 100644 --- a/src/ol/interaction/Draw.js +++ b/src/ol/interaction/Draw.js @@ -20,11 +20,11 @@ import MultiPolygon from '../geom/MultiPolygon.js'; import Point from '../geom/Point.js'; import Polygon, {fromCircle, makeRegular} from '../geom/Polygon.js'; import DrawEventType from '../interaction/DrawEventType.js'; -import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; +import PointerInteraction from '../interaction/Pointer.js'; import InteractionProperty from '../interaction/Property.js'; import VectorLayer from '../layer/Vector.js'; import VectorSource from '../source/Vector.js'; -import _ol_style_Style_ from '../style/Style.js'; +import Style from '../style/Style.js'; /** * @classdesc @@ -38,7 +38,7 @@ import _ol_style_Style_ from '../style/Style.js'; */ var Draw = function(options) { - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: Draw.handleDownEvent_, handleEvent: Draw.handleEvent, handleUpEvent: Draw.handleUpEvent_ @@ -290,14 +290,14 @@ var Draw = function(options) { }; -inherits(Draw, _ol_interaction_Pointer_); +inherits(Draw, PointerInteraction); /** * @return {ol.StyleFunction} Styles. */ Draw.getDefaultStyleFunction = function() { - var styles = _ol_style_Style_.createDefaultEditing(); + var styles = Style.createDefaultEditing(); return function(feature, resolution) { return styles[feature.getGeometry().getType()]; }; @@ -308,7 +308,7 @@ Draw.getDefaultStyleFunction = function() { * @inheritDoc */ Draw.prototype.setMap = function(map) { - _ol_interaction_Pointer_.prototype.setMap.call(this, map); + PointerInteraction.prototype.setMap.call(this, map); this.updateState_(); }; @@ -337,7 +337,7 @@ Draw.handleEvent = function(event) { } else if (event.type === MapBrowserEventType.DBLCLICK) { pass = false; } - return _ol_interaction_Pointer_.handleEvent.call(this, event) && pass; + return PointerInteraction.handleEvent.call(this, event) && pass; }; diff --git a/src/ol/interaction/Extent.js b/src/ol/interaction/Extent.js index 16a829c766..a85ebae843 100644 --- a/src/ol/interaction/Extent.js +++ b/src/ol/interaction/Extent.js @@ -12,10 +12,10 @@ import GeometryType from '../geom/GeometryType.js'; 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 PointerInteraction from '../interaction/Pointer.js'; import VectorLayer from '../layer/Vector.js'; import VectorSource from '../source/Vector.js'; -import _ol_style_Style_ from '../style/Style.js'; +import Style from '../style/Style.js'; /** * @classdesc @@ -29,7 +29,7 @@ import _ol_style_Style_ from '../style/Style.js'; * @param {olx.interaction.ExtentOptions=} opt_options Options. * @api */ -var _ol_interaction_Extent_ = function(opt_options) { +var ExtentInteraction = function(opt_options) { var options = opt_options || {}; @@ -81,11 +81,11 @@ var _ol_interaction_Extent_ = function(opt_options) { } /* Inherit ol.interaction.Pointer */ - _ol_interaction_Pointer_.call(this, { - handleDownEvent: _ol_interaction_Extent_.handleDownEvent_, - handleDragEvent: _ol_interaction_Extent_.handleDragEvent_, - handleEvent: _ol_interaction_Extent_.handleEvent_, - handleUpEvent: _ol_interaction_Extent_.handleUpEvent_ + PointerInteraction.call(this, { + handleDownEvent: ExtentInteraction.handleDownEvent_, + handleDragEvent: ExtentInteraction.handleDragEvent_, + handleEvent: ExtentInteraction.handleEvent_, + handleUpEvent: ExtentInteraction.handleUpEvent_ }); /** @@ -98,7 +98,7 @@ var _ol_interaction_Extent_ = function(opt_options) { useSpatialIndex: false, wrapX: !!opt_options.wrapX }), - style: opt_options.boxStyle ? opt_options.boxStyle : _ol_interaction_Extent_.getDefaultExtentStyleFunction_(), + style: opt_options.boxStyle ? opt_options.boxStyle : ExtentInteraction.getDefaultExtentStyleFunction_(), updateWhileAnimating: true, updateWhileInteracting: true }); @@ -113,7 +113,7 @@ var _ol_interaction_Extent_ = function(opt_options) { useSpatialIndex: false, wrapX: !!opt_options.wrapX }), - style: opt_options.pointerStyle ? opt_options.pointerStyle : _ol_interaction_Extent_.getDefaultPointerStyleFunction_(), + style: opt_options.pointerStyle ? opt_options.pointerStyle : ExtentInteraction.getDefaultPointerStyleFunction_(), updateWhileAnimating: true, updateWhileInteracting: true }); @@ -123,7 +123,7 @@ var _ol_interaction_Extent_ = function(opt_options) { } }; -inherits(_ol_interaction_Extent_, _ol_interaction_Pointer_); +inherits(ExtentInteraction, PointerInteraction); /** * @param {ol.MapBrowserEvent} mapBrowserEvent Event. @@ -131,7 +131,7 @@ inherits(_ol_interaction_Extent_, _ol_interaction_Pointer_); * @this {ol.interaction.Extent} * @private */ -_ol_interaction_Extent_.handleEvent_ = function(mapBrowserEvent) { +ExtentInteraction.handleEvent_ = function(mapBrowserEvent) { if (!(mapBrowserEvent instanceof MapBrowserPointerEvent)) { return true; } @@ -140,7 +140,7 @@ _ol_interaction_Extent_.handleEvent_ = function(mapBrowserEvent) { this.handlePointerMove_(mapBrowserEvent); } //call pointer to determine up/down/drag - _ol_interaction_Pointer_.handleEvent.call(this, mapBrowserEvent); + PointerInteraction.handleEvent.call(this, mapBrowserEvent); //return false to stop propagation return false; }; @@ -151,7 +151,7 @@ _ol_interaction_Extent_.handleEvent_ = function(mapBrowserEvent) { * @this {ol.interaction.Extent} * @private */ -_ol_interaction_Extent_.handleDownEvent_ = function(mapBrowserEvent) { +ExtentInteraction.handleDownEvent_ = function(mapBrowserEvent) { var pixel = mapBrowserEvent.pixel; var map = mapBrowserEvent.map; @@ -183,15 +183,15 @@ _ol_interaction_Extent_.handleDownEvent_ = function(mapBrowserEvent) { //snap to point if (x !== null && y !== null) { - this.pointerHandler_ = _ol_interaction_Extent_.getPointHandler_(getOpposingPoint(vertex)); + this.pointerHandler_ = ExtentInteraction.getPointHandler_(getOpposingPoint(vertex)); //snap to edge } else if (x !== null) { - this.pointerHandler_ = _ol_interaction_Extent_.getEdgeHandler_( + this.pointerHandler_ = ExtentInteraction.getEdgeHandler_( getOpposingPoint([x, extent[1]]), getOpposingPoint([x, extent[3]]) ); } else if (y !== null) { - this.pointerHandler_ = _ol_interaction_Extent_.getEdgeHandler_( + this.pointerHandler_ = ExtentInteraction.getEdgeHandler_( getOpposingPoint([extent[0], y]), getOpposingPoint([extent[2], y]) ); @@ -200,7 +200,7 @@ _ol_interaction_Extent_.handleDownEvent_ = function(mapBrowserEvent) { } else { vertex = map.getCoordinateFromPixel(pixel); this.setExtent([vertex[0], vertex[1], vertex[0], vertex[1]]); - this.pointerHandler_ = _ol_interaction_Extent_.getPointHandler_(vertex); + this.pointerHandler_ = ExtentInteraction.getPointHandler_(vertex); } return true; //event handled; start downup sequence }; @@ -211,7 +211,7 @@ _ol_interaction_Extent_.handleDownEvent_ = function(mapBrowserEvent) { * @this {ol.interaction.Extent} * @private */ -_ol_interaction_Extent_.handleDragEvent_ = function(mapBrowserEvent) { +ExtentInteraction.handleDragEvent_ = function(mapBrowserEvent) { if (this.pointerHandler_) { var pixelCoordinate = mapBrowserEvent.coordinate; this.setExtent(this.pointerHandler_(pixelCoordinate)); @@ -226,7 +226,7 @@ _ol_interaction_Extent_.handleDragEvent_ = function(mapBrowserEvent) { * @this {ol.interaction.Extent} * @private */ -_ol_interaction_Extent_.handleUpEvent_ = function(mapBrowserEvent) { +ExtentInteraction.handleUpEvent_ = function(mapBrowserEvent) { this.pointerHandler_ = null; //If bbox is zero area, set to null; var extent = this.getExtent(); @@ -242,8 +242,8 @@ _ol_interaction_Extent_.handleUpEvent_ = function(mapBrowserEvent) { * @return {ol.StyleFunction} Default Extent style * @private */ -_ol_interaction_Extent_.getDefaultExtentStyleFunction_ = function() { - var style = _ol_style_Style_.createDefaultEditing(); +ExtentInteraction.getDefaultExtentStyleFunction_ = function() { + var style = Style.createDefaultEditing(); return function(feature, resolution) { return style[GeometryType.POLYGON]; }; @@ -255,8 +255,8 @@ _ol_interaction_Extent_.getDefaultExtentStyleFunction_ = function() { * @return {ol.StyleFunction} Default pointer style * @private */ -_ol_interaction_Extent_.getDefaultPointerStyleFunction_ = function() { - var style = _ol_style_Style_.createDefaultEditing(); +ExtentInteraction.getDefaultPointerStyleFunction_ = function() { + var style = Style.createDefaultEditing(); return function(feature, resolution) { return style[GeometryType.POINT]; }; @@ -267,7 +267,7 @@ _ol_interaction_Extent_.getDefaultPointerStyleFunction_ = function() { * @returns {function (ol.Coordinate): ol.Extent} event handler * @private */ -_ol_interaction_Extent_.getPointHandler_ = function(fixedPoint) { +ExtentInteraction.getPointHandler_ = function(fixedPoint) { return function(point) { return boundingExtent([fixedPoint, point]); }; @@ -279,7 +279,7 @@ _ol_interaction_Extent_.getPointHandler_ = function(fixedPoint) { * @returns {function (ol.Coordinate): ol.Extent|null} event handler * @private */ -_ol_interaction_Extent_.getEdgeHandler_ = function(fixedP1, fixedP2) { +ExtentInteraction.getEdgeHandler_ = function(fixedP1, fixedP2) { if (fixedP1[0] == fixedP2[0]) { return function(point) { return boundingExtent([fixedP1, [point[0], fixedP2[1]]]); @@ -298,7 +298,7 @@ _ol_interaction_Extent_.getEdgeHandler_ = function(fixedP1, fixedP2) { * @returns {Array>} extent line segments * @private */ -_ol_interaction_Extent_.getSegments_ = function(extent) { +ExtentInteraction.getSegments_ = function(extent) { return [ [[extent[0], extent[1]], [extent[0], extent[3]]], [[extent[0], extent[3]], [extent[2], extent[3]]], @@ -313,7 +313,7 @@ _ol_interaction_Extent_.getSegments_ = function(extent) { * @returns {ol.Coordinate|null} snapped vertex on extent * @private */ -_ol_interaction_Extent_.prototype.snapToVertex_ = function(pixel, map) { +ExtentInteraction.prototype.snapToVertex_ = function(pixel, map) { var pixelCoordinate = map.getCoordinateFromPixel(pixel); var sortByDistance = function(a, b) { return _ol_coordinate_.squaredDistanceToSegment(pixelCoordinate, a) - @@ -322,7 +322,7 @@ _ol_interaction_Extent_.prototype.snapToVertex_ = function(pixel, map) { var extent = this.getExtent(); if (extent) { //convert extents to line segments and find the segment closest to pixelCoordinate - var segments = _ol_interaction_Extent_.getSegments_(extent); + var segments = ExtentInteraction.getSegments_(extent); segments.sort(sortByDistance); var closestSegment = segments[0]; @@ -353,7 +353,7 @@ _ol_interaction_Extent_.prototype.snapToVertex_ = function(pixel, map) { * @param {ol.MapBrowserEvent} mapBrowserEvent pointer move event * @private */ -_ol_interaction_Extent_.prototype.handlePointerMove_ = function(mapBrowserEvent) { +ExtentInteraction.prototype.handlePointerMove_ = function(mapBrowserEvent) { var pixel = mapBrowserEvent.pixel; var map = mapBrowserEvent.map; @@ -369,7 +369,7 @@ _ol_interaction_Extent_.prototype.handlePointerMove_ = function(mapBrowserEvent) * @returns {ol.Feature} extent as featrue * @private */ -_ol_interaction_Extent_.prototype.createOrUpdateExtentFeature_ = function(extent) { +ExtentInteraction.prototype.createOrUpdateExtentFeature_ = function(extent) { var extentFeature = this.extentFeature_; if (!extentFeature) { @@ -396,7 +396,7 @@ _ol_interaction_Extent_.prototype.createOrUpdateExtentFeature_ = function(extent * @returns {ol.Feature} vertex as feature * @private */ -_ol_interaction_Extent_.prototype.createOrUpdatePointerFeature_ = function(vertex) { +ExtentInteraction.prototype.createOrUpdatePointerFeature_ = function(vertex) { var vertexFeature = this.vertexFeature_; if (!vertexFeature) { vertexFeature = new Feature(new Point(vertex)); @@ -413,10 +413,10 @@ _ol_interaction_Extent_.prototype.createOrUpdatePointerFeature_ = function(verte /** * @inheritDoc */ -_ol_interaction_Extent_.prototype.setMap = function(map) { +ExtentInteraction.prototype.setMap = function(map) { this.extentOverlay_.setMap(map); this.vertexOverlay_.setMap(map); - _ol_interaction_Pointer_.prototype.setMap.call(this, map); + PointerInteraction.prototype.setMap.call(this, map); }; /** @@ -425,7 +425,7 @@ _ol_interaction_Extent_.prototype.setMap = function(map) { * @return {ol.Extent} Drawn extent in the view projection. * @api */ -_ol_interaction_Extent_.prototype.getExtent = function() { +ExtentInteraction.prototype.getExtent = function() { return this.extent_; }; @@ -435,11 +435,11 @@ _ol_interaction_Extent_.prototype.getExtent = function() { * @param {ol.Extent} extent Extent * @api */ -_ol_interaction_Extent_.prototype.setExtent = function(extent) { +ExtentInteraction.prototype.setExtent = function(extent) { //Null extent means no bbox this.extent_ = extent ? extent : null; this.createOrUpdateExtentFeature_(extent); - this.dispatchEvent(new _ol_interaction_Extent_.Event(this.extent_)); + this.dispatchEvent(new ExtentInteraction.Event(this.extent_)); }; @@ -453,7 +453,7 @@ _ol_interaction_Extent_.prototype.setExtent = function(extent) { * @param {ol.Extent} extent the new extent * @extends {ol.events.Event} */ -_ol_interaction_Extent_.Event = function(extent) { +ExtentInteraction.Event = function(extent) { Event.call(this, _ol_interaction_ExtentEventType_.EXTENTCHANGED); /** @@ -464,5 +464,5 @@ _ol_interaction_Extent_.Event = function(extent) { this.extent = extent; }; -inherits(_ol_interaction_Extent_.Event, Event); -export default _ol_interaction_Extent_; +inherits(ExtentInteraction.Event, Event); +export default ExtentInteraction; diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index e5c362d59d..f8ceae718d 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -2,7 +2,7 @@ * @module ol/interaction/Modify */ import {getUid, inherits} from '../index.js'; -import _ol_Collection_ from '../Collection.js'; +import Collection from '../Collection.js'; import CollectionEventType from '../CollectionEventType.js'; import Feature from '../Feature.js'; import MapBrowserEventType from '../MapBrowserEventType.js'; @@ -16,13 +16,13 @@ import _ol_events_condition_ from '../events/condition.js'; import {boundingExtent, buffer, createOrUpdateFromCoordinate} from '../extent.js'; 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 ModifyEventType from '../interaction/ModifyEventType.js'; +import PointerInteraction from '../interaction/Pointer.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'; +import Style from '../style/Style.js'; /** * @classdesc @@ -43,13 +43,13 @@ import _ol_style_Style_ from '../style/Style.js'; * @fires ol.interaction.Modify.Event * @api */ -var _ol_interaction_Modify_ = function(options) { +var Modify = function(options) { - _ol_interaction_Pointer_.call(this, { - handleDownEvent: _ol_interaction_Modify_.handleDownEvent_, - handleDragEvent: _ol_interaction_Modify_.handleDragEvent_, - handleEvent: _ol_interaction_Modify_.handleEvent, - handleUpEvent: _ol_interaction_Modify_.handleUpEvent_ + PointerInteraction.call(this, { + handleDownEvent: Modify.handleDownEvent_, + handleDragEvent: Modify.handleDragEvent_, + handleEvent: Modify.handleEvent, + handleUpEvent: Modify.handleUpEvent_ }); /** @@ -163,7 +163,7 @@ var _ol_interaction_Modify_ = function(options) { wrapX: !!options.wrapX }), style: options.style ? options.style : - _ol_interaction_Modify_.getDefaultStyleFunction(), + Modify.getDefaultStyleFunction(), updateWhileAnimating: true, updateWhileInteracting: true }); @@ -195,7 +195,7 @@ var _ol_interaction_Modify_ = function(options) { var features; if (options.source) { this.source_ = options.source; - features = new _ol_Collection_(this.source_.getFeatures()); + features = new Collection(this.source_.getFeatures()); _ol_events_.listen(this.source_, VectorEventType.ADDFEATURE, this.handleSourceAdd_, this); _ol_events_.listen(this.source_, VectorEventType.REMOVEFEATURE, @@ -227,27 +227,27 @@ var _ol_interaction_Modify_ = function(options) { }; -inherits(_ol_interaction_Modify_, _ol_interaction_Pointer_); +inherits(Modify, PointerInteraction); /** * @define {number} The segment index assigned to a circle's center when * breaking up a cicrle into ModifySegmentDataType segments. */ -_ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX = 0; +Modify.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX = 0; /** * @define {number} The segment index assigned to a circle's circumference when * breaking up a circle into ModifySegmentDataType segments. */ -_ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX = 1; +Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX = 1; /** * @param {ol.Feature} feature Feature. * @private */ -_ol_interaction_Modify_.prototype.addFeature_ = function(feature) { +Modify.prototype.addFeature_ = function(feature) { var geometry = feature.getGeometry(); if (geometry && geometry.getType() in this.SEGMENT_WRITERS_) { this.SEGMENT_WRITERS_[geometry.getType()].call(this, feature, geometry); @@ -265,11 +265,11 @@ _ol_interaction_Modify_.prototype.addFeature_ = function(feature) { * @param {ol.MapBrowserPointerEvent} evt Map browser event * @private */ -_ol_interaction_Modify_.prototype.willModifyFeatures_ = function(evt) { +Modify.prototype.willModifyFeatures_ = function(evt) { if (!this.modified_) { this.modified_ = true; - this.dispatchEvent(new _ol_interaction_Modify_.Event( - _ol_interaction_ModifyEventType_.MODIFYSTART, this.features_, evt)); + this.dispatchEvent(new Modify.Event( + ModifyEventType.MODIFYSTART, this.features_, evt)); } }; @@ -278,7 +278,7 @@ _ol_interaction_Modify_.prototype.willModifyFeatures_ = function(evt) { * @param {ol.Feature} feature Feature. * @private */ -_ol_interaction_Modify_.prototype.removeFeature_ = function(feature) { +Modify.prototype.removeFeature_ = function(feature) { this.removeFeatureSegmentData_(feature); // Remove the vertex feature if the collection of canditate features // is empty. @@ -295,7 +295,7 @@ _ol_interaction_Modify_.prototype.removeFeature_ = function(feature) { * @param {ol.Feature} feature Feature. * @private */ -_ol_interaction_Modify_.prototype.removeFeatureSegmentData_ = function(feature) { +Modify.prototype.removeFeatureSegmentData_ = function(feature) { var rBush = this.rBush_; var /** @type {Array.} */ nodesToRemove = []; rBush.forEach( @@ -316,21 +316,21 @@ _ol_interaction_Modify_.prototype.removeFeatureSegmentData_ = function(feature) /** * @inheritDoc */ -_ol_interaction_Modify_.prototype.setActive = function(active) { +Modify.prototype.setActive = function(active) { if (this.vertexFeature_ && !active) { this.overlay_.getSource().removeFeature(this.vertexFeature_); this.vertexFeature_ = null; } - _ol_interaction_Pointer_.prototype.setActive.call(this, active); + PointerInteraction.prototype.setActive.call(this, active); }; /** * @inheritDoc */ -_ol_interaction_Modify_.prototype.setMap = function(map) { +Modify.prototype.setMap = function(map) { this.overlay_.setMap(map); - _ol_interaction_Pointer_.prototype.setMap.call(this, map); + PointerInteraction.prototype.setMap.call(this, map); }; @@ -338,7 +338,7 @@ _ol_interaction_Modify_.prototype.setMap = function(map) { * @param {ol.source.Vector.Event} event Event. * @private */ -_ol_interaction_Modify_.prototype.handleSourceAdd_ = function(event) { +Modify.prototype.handleSourceAdd_ = function(event) { if (event.feature) { this.features_.push(event.feature); } @@ -349,7 +349,7 @@ _ol_interaction_Modify_.prototype.handleSourceAdd_ = function(event) { * @param {ol.source.Vector.Event} event Event. * @private */ -_ol_interaction_Modify_.prototype.handleSourceRemove_ = function(event) { +Modify.prototype.handleSourceRemove_ = function(event) { if (event.feature) { this.features_.remove(event.feature); } @@ -360,7 +360,7 @@ _ol_interaction_Modify_.prototype.handleSourceRemove_ = function(event) { * @param {ol.Collection.Event} evt Event. * @private */ -_ol_interaction_Modify_.prototype.handleFeatureAdd_ = function(evt) { +Modify.prototype.handleFeatureAdd_ = function(evt) { this.addFeature_(/** @type {ol.Feature} */ (evt.element)); }; @@ -369,7 +369,7 @@ _ol_interaction_Modify_.prototype.handleFeatureAdd_ = function(evt) { * @param {ol.events.Event} evt Event. * @private */ -_ol_interaction_Modify_.prototype.handleFeatureChange_ = function(evt) { +Modify.prototype.handleFeatureChange_ = function(evt) { if (!this.changingFeature_) { var feature = /** @type {ol.Feature} */ (evt.target); this.removeFeature_(feature); @@ -382,7 +382,7 @@ _ol_interaction_Modify_.prototype.handleFeatureChange_ = function(evt) { * @param {ol.Collection.Event} evt Event. * @private */ -_ol_interaction_Modify_.prototype.handleFeatureRemove_ = function(evt) { +Modify.prototype.handleFeatureRemove_ = function(evt) { var feature = /** @type {ol.Feature} */ (evt.element); this.removeFeature_(feature); }; @@ -393,7 +393,7 @@ _ol_interaction_Modify_.prototype.handleFeatureRemove_ = function(evt) { * @param {ol.geom.Point} geometry Geometry. * @private */ -_ol_interaction_Modify_.prototype.writePointGeometry_ = function(feature, geometry) { +Modify.prototype.writePointGeometry_ = function(feature, geometry) { var coordinates = geometry.getCoordinates(); var segmentData = /** @type {ol.ModifySegmentDataType} */ ({ feature: feature, @@ -409,7 +409,7 @@ _ol_interaction_Modify_.prototype.writePointGeometry_ = function(feature, geomet * @param {ol.geom.MultiPoint} geometry Geometry. * @private */ -_ol_interaction_Modify_.prototype.writeMultiPointGeometry_ = function(feature, geometry) { +Modify.prototype.writeMultiPointGeometry_ = function(feature, geometry) { var points = geometry.getCoordinates(); var coordinates, i, ii, segmentData; for (i = 0, ii = points.length; i < ii; ++i) { @@ -431,7 +431,7 @@ _ol_interaction_Modify_.prototype.writeMultiPointGeometry_ = function(feature, g * @param {ol.geom.LineString} geometry Geometry. * @private */ -_ol_interaction_Modify_.prototype.writeLineStringGeometry_ = function(feature, geometry) { +Modify.prototype.writeLineStringGeometry_ = function(feature, geometry) { var coordinates = geometry.getCoordinates(); var i, ii, segment, segmentData; for (i = 0, ii = coordinates.length - 1; i < ii; ++i) { @@ -452,7 +452,7 @@ _ol_interaction_Modify_.prototype.writeLineStringGeometry_ = function(feature, g * @param {ol.geom.MultiLineString} geometry Geometry. * @private */ -_ol_interaction_Modify_.prototype.writeMultiLineStringGeometry_ = function(feature, geometry) { +Modify.prototype.writeMultiLineStringGeometry_ = function(feature, geometry) { var lines = geometry.getCoordinates(); var coordinates, i, ii, j, jj, segment, segmentData; for (j = 0, jj = lines.length; j < jj; ++j) { @@ -477,7 +477,7 @@ _ol_interaction_Modify_.prototype.writeMultiLineStringGeometry_ = function(featu * @param {ol.geom.Polygon} geometry Geometry. * @private */ -_ol_interaction_Modify_.prototype.writePolygonGeometry_ = function(feature, geometry) { +Modify.prototype.writePolygonGeometry_ = function(feature, geometry) { var rings = geometry.getCoordinates(); var coordinates, i, ii, j, jj, segment, segmentData; for (j = 0, jj = rings.length; j < jj; ++j) { @@ -502,7 +502,7 @@ _ol_interaction_Modify_.prototype.writePolygonGeometry_ = function(feature, geom * @param {ol.geom.MultiPolygon} geometry Geometry. * @private */ -_ol_interaction_Modify_.prototype.writeMultiPolygonGeometry_ = function(feature, geometry) { +Modify.prototype.writeMultiPolygonGeometry_ = function(feature, geometry) { var polygons = geometry.getCoordinates(); var coordinates, i, ii, j, jj, k, kk, rings, segment, segmentData; for (k = 0, kk = polygons.length; k < kk; ++k) { @@ -536,18 +536,18 @@ _ol_interaction_Modify_.prototype.writeMultiPolygonGeometry_ = function(feature, * @param {ol.geom.Circle} geometry Geometry. * @private */ -_ol_interaction_Modify_.prototype.writeCircleGeometry_ = function(feature, geometry) { +Modify.prototype.writeCircleGeometry_ = function(feature, geometry) { var coordinates = geometry.getCenter(); var centerSegmentData = /** @type {ol.ModifySegmentDataType} */ ({ feature: feature, geometry: geometry, - index: _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX, + index: Modify.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX, segment: [coordinates, coordinates] }); var circumferenceSegmentData = /** @type {ol.ModifySegmentDataType} */ ({ feature: feature, geometry: geometry, - index: _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX, + index: Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX, segment: [coordinates, coordinates] }); var featureSegments = [centerSegmentData, circumferenceSegmentData]; @@ -562,7 +562,7 @@ _ol_interaction_Modify_.prototype.writeCircleGeometry_ = function(feature, geome * @param {ol.geom.GeometryCollection} geometry Geometry. * @private */ -_ol_interaction_Modify_.prototype.writeGeometryCollectionGeometry_ = function(feature, geometry) { +Modify.prototype.writeGeometryCollectionGeometry_ = function(feature, geometry) { var i, geometries = geometry.getGeometriesArray(); for (i = 0; i < geometries.length; ++i) { this.SEGMENT_WRITERS_[geometries[i].getType()].call( @@ -576,7 +576,7 @@ _ol_interaction_Modify_.prototype.writeGeometryCollectionGeometry_ = function(fe * @return {ol.Feature} Vertex feature. * @private */ -_ol_interaction_Modify_.prototype.createOrUpdateVertexFeature_ = function(coordinates) { +Modify.prototype.createOrUpdateVertexFeature_ = function(coordinates) { var vertexFeature = this.vertexFeature_; if (!vertexFeature) { vertexFeature = new Feature(new Point(coordinates)); @@ -596,7 +596,7 @@ _ol_interaction_Modify_.prototype.createOrUpdateVertexFeature_ = function(coordi * @return {number} The difference in indexes. * @private */ -_ol_interaction_Modify_.compareIndexes_ = function(a, b) { +Modify.compareIndexes_ = function(a, b) { return a.index - b.index; }; @@ -607,7 +607,7 @@ _ol_interaction_Modify_.compareIndexes_ = function(a, b) { * @this {ol.interaction.Modify} * @private */ -_ol_interaction_Modify_.handleDownEvent_ = function(evt) { +Modify.handleDownEvent_ = function(evt) { if (!this.condition_(evt)) { return false; } @@ -623,7 +623,7 @@ _ol_interaction_Modify_.handleDownEvent_ = function(evt) { var vertexExtent = boundingExtent([vertex]); var segmentDataMatches = this.rBush_.getInExtent(vertexExtent); var componentSegments = {}; - segmentDataMatches.sort(_ol_interaction_Modify_.compareIndexes_); + segmentDataMatches.sort(Modify.compareIndexes_); for (var i = 0, ii = segmentDataMatches.length; i < ii; ++i) { var segmentDataMatch = segmentDataMatches[i]; var segment = segmentDataMatch.segment; @@ -636,9 +636,9 @@ _ol_interaction_Modify_.handleDownEvent_ = function(evt) { componentSegments[uid] = new Array(2); } if (segmentDataMatch.geometry.getType() === GeometryType.CIRCLE && - segmentDataMatch.index === _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) { + segmentDataMatch.index === Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) { - var closestVertex = _ol_interaction_Modify_.closestOnSegmentData_(pixelCoordinate, segmentDataMatch); + var closestVertex = Modify.closestOnSegmentData_(pixelCoordinate, segmentDataMatch); if (_ol_coordinate_.equals(closestVertex, vertex) && !componentSegments[uid][0]) { this.dragSegments_.push([segmentDataMatch, 0]); componentSegments[uid][0] = segmentDataMatch; @@ -683,7 +683,7 @@ _ol_interaction_Modify_.handleDownEvent_ = function(evt) { * @this {ol.interaction.Modify} * @private */ -_ol_interaction_Modify_.handleDragEvent_ = function(evt) { +Modify.handleDragEvent_ = function(evt) { this.ignoreNextSingleClick_ = false; this.willModifyFeatures_(evt); @@ -733,7 +733,7 @@ _ol_interaction_Modify_.handleDragEvent_ = function(evt) { break; case GeometryType.CIRCLE: segment[0] = segment[1] = vertex; - if (segmentData.index === _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX) { + if (segmentData.index === Modify.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX) { this.changingFeature_ = true; geometry.setCenter(vertex); this.changingFeature_ = false; @@ -761,7 +761,7 @@ _ol_interaction_Modify_.handleDragEvent_ = function(evt) { * @this {ol.interaction.Modify} * @private */ -_ol_interaction_Modify_.handleUpEvent_ = function(evt) { +Modify.handleUpEvent_ = function(evt) { var segmentData; var geometry; for (var i = this.dragSegments_.length - 1; i >= 0; --i) { @@ -782,8 +782,8 @@ _ol_interaction_Modify_.handleUpEvent_ = function(evt) { } } if (this.modified_) { - this.dispatchEvent(new _ol_interaction_Modify_.Event( - _ol_interaction_ModifyEventType_.MODIFYEND, this.features_, evt)); + this.dispatchEvent(new Modify.Event( + ModifyEventType.MODIFYEND, this.features_, evt)); this.modified_ = false; } return false; @@ -798,7 +798,7 @@ _ol_interaction_Modify_.handleUpEvent_ = function(evt) { * @this {ol.interaction.Modify} * @api */ -_ol_interaction_Modify_.handleEvent = function(mapBrowserEvent) { +Modify.handleEvent = function(mapBrowserEvent) { if (!(mapBrowserEvent instanceof MapBrowserPointerEvent)) { return true; } @@ -823,7 +823,7 @@ _ol_interaction_Modify_.handleEvent = function(mapBrowserEvent) { this.ignoreNextSingleClick_ = false; } - return _ol_interaction_Pointer_.handleEvent.call(this, mapBrowserEvent) && + return PointerInteraction.handleEvent.call(this, mapBrowserEvent) && !handled; }; @@ -832,7 +832,7 @@ _ol_interaction_Modify_.handleEvent = function(mapBrowserEvent) { * @param {ol.MapBrowserEvent} evt Event. * @private */ -_ol_interaction_Modify_.prototype.handlePointerMove_ = function(evt) { +Modify.prototype.handlePointerMove_ = function(evt) { this.lastPixel_ = evt.pixel; this.handlePointerAtPixel_(evt.pixel, evt.map); }; @@ -843,11 +843,11 @@ _ol_interaction_Modify_.prototype.handlePointerMove_ = function(evt) { * @param {ol.PluggableMap} map Map. * @private */ -_ol_interaction_Modify_.prototype.handlePointerAtPixel_ = function(pixel, map) { +Modify.prototype.handlePointerAtPixel_ = function(pixel, map) { var pixelCoordinate = map.getCoordinateFromPixel(pixel); var sortByDistance = function(a, b) { - return _ol_interaction_Modify_.pointDistanceToSegmentDataSquared_(pixelCoordinate, a) - - _ol_interaction_Modify_.pointDistanceToSegmentDataSquared_(pixelCoordinate, b); + return Modify.pointDistanceToSegmentDataSquared_(pixelCoordinate, a) - + Modify.pointDistanceToSegmentDataSquared_(pixelCoordinate, b); }; var box = buffer(createOrUpdateFromCoordinate(pixelCoordinate), @@ -859,14 +859,14 @@ _ol_interaction_Modify_.prototype.handlePointerAtPixel_ = function(pixel, map) { nodes.sort(sortByDistance); var node = nodes[0]; var closestSegment = node.segment; - var vertex = _ol_interaction_Modify_.closestOnSegmentData_(pixelCoordinate, node); + var vertex = Modify.closestOnSegmentData_(pixelCoordinate, node); var vertexPixel = map.getPixelFromCoordinate(vertex); var dist = _ol_coordinate_.distance(pixel, vertexPixel); if (dist <= this.pixelTolerance_) { var vertexSegments = {}; if (node.geometry.getType() === GeometryType.CIRCLE && - node.index === _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) { + node.index === Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) { this.snappedToVertex_ = true; this.createOrUpdateVertexFeature_(vertex); @@ -917,13 +917,13 @@ _ol_interaction_Modify_.prototype.handlePointerAtPixel_ = function(pixel, map) { * segment we are calculating the distance to. * @return {number} The square of the distance between a point and a line segment. */ -_ol_interaction_Modify_.pointDistanceToSegmentDataSquared_ = function(pointCoordinates, segmentData) { +Modify.pointDistanceToSegmentDataSquared_ = function(pointCoordinates, segmentData) { var geometry = segmentData.geometry; if (geometry.getType() === GeometryType.CIRCLE) { var circleGeometry = /** @type {ol.geom.Circle} */ (geometry); - if (segmentData.index === _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) { + if (segmentData.index === Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) { var distanceToCenterSquared = _ol_coordinate_.squaredDistance(circleGeometry.getCenter(), pointCoordinates); var distanceToCircumference = @@ -943,11 +943,11 @@ _ol_interaction_Modify_.pointDistanceToSegmentDataSquared_ = function(pointCoord * segment which should contain the closest point. * @return {ol.Coordinate} The point closest to the specified line segment. */ -_ol_interaction_Modify_.closestOnSegmentData_ = function(pointCoordinates, segmentData) { +Modify.closestOnSegmentData_ = function(pointCoordinates, segmentData) { var geometry = segmentData.geometry; if (geometry.getType() === GeometryType.CIRCLE && - segmentData.index === _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) { + segmentData.index === Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) { return geometry.getClosestPoint(pointCoordinates); } return _ol_coordinate_.closestOnSegment(pointCoordinates, segmentData.segment); @@ -959,7 +959,7 @@ _ol_interaction_Modify_.closestOnSegmentData_ = function(pointCoordinates, segme * @param {ol.Coordinate} vertex Vertex. * @private */ -_ol_interaction_Modify_.prototype.insertVertex_ = function(segmentData, vertex) { +Modify.prototype.insertVertex_ = function(segmentData, vertex) { var segment = segmentData.segment; var feature = segmentData.feature; var geometry = segmentData.geometry; @@ -1025,13 +1025,13 @@ _ol_interaction_Modify_.prototype.insertVertex_ = function(segmentData, vertex) * @return {boolean} True when a vertex was removed. * @api */ -_ol_interaction_Modify_.prototype.removePoint = function() { +Modify.prototype.removePoint = function() { if (this.lastPointerEvent_ && this.lastPointerEvent_.type != MapBrowserEventType.POINTERDRAG) { var evt = this.lastPointerEvent_; this.willModifyFeatures_(evt); this.removeVertex_(); - this.dispatchEvent(new _ol_interaction_Modify_.Event( - _ol_interaction_ModifyEventType_.MODIFYEND, this.features_, evt)); + this.dispatchEvent(new Modify.Event( + ModifyEventType.MODIFYEND, this.features_, evt)); this.modified_ = false; return true; } @@ -1043,7 +1043,7 @@ _ol_interaction_Modify_.prototype.removePoint = function() { * @return {boolean} True when a vertex was removed. * @private */ -_ol_interaction_Modify_.prototype.removeVertex_ = function() { +Modify.prototype.removeVertex_ = function() { var dragSegments = this.dragSegments_; var segmentsByFeature = {}; var deleted = false; @@ -1162,7 +1162,7 @@ _ol_interaction_Modify_.prototype.removeVertex_ = function() { * @param {Array} coordinates Coordinates. * @private */ -_ol_interaction_Modify_.prototype.setGeometryCoordinates_ = function(geometry, coordinates) { +Modify.prototype.setGeometryCoordinates_ = function(geometry, coordinates) { this.changingFeature_ = true; geometry.setCoordinates(coordinates); this.changingFeature_ = false; @@ -1176,7 +1176,7 @@ _ol_interaction_Modify_.prototype.setGeometryCoordinates_ = function(geometry, c * @param {number} delta Delta (1 or -1). * @private */ -_ol_interaction_Modify_.prototype.updateSegmentIndices_ = function( +Modify.prototype.updateSegmentIndices_ = function( geometry, index, depth, delta) { this.rBush_.forEachInExtent(geometry.getExtent(), function(segmentDataMatch) { if (segmentDataMatch.geometry === geometry && @@ -1192,8 +1192,8 @@ _ol_interaction_Modify_.prototype.updateSegmentIndices_ = function( /** * @return {ol.StyleFunction} Styles. */ -_ol_interaction_Modify_.getDefaultStyleFunction = function() { - var style = _ol_style_Style_.createDefaultEditing(); +Modify.getDefaultStyleFunction = function() { + var style = Style.createDefaultEditing(); return function(feature, resolution) { return style[GeometryType.POINT]; }; @@ -1213,7 +1213,7 @@ _ol_interaction_Modify_.getDefaultStyleFunction = function() { * @param {ol.MapBrowserPointerEvent} mapBrowserPointerEvent Associated * {@link ol.MapBrowserPointerEvent}. */ -_ol_interaction_Modify_.Event = function(type, features, mapBrowserPointerEvent) { +Modify.Event = function(type, features, mapBrowserPointerEvent) { Event.call(this, type); @@ -1231,5 +1231,5 @@ _ol_interaction_Modify_.Event = function(type, features, mapBrowserPointerEvent) */ this.mapBrowserEvent = mapBrowserPointerEvent; }; -inherits(_ol_interaction_Modify_.Event, Event); -export default _ol_interaction_Modify_; +inherits(Modify.Event, Event); +export default Modify; diff --git a/src/ol/interaction/PinchRotate.js b/src/ol/interaction/PinchRotate.js index bfa8f3b177..e9ae3c6c48 100644 --- a/src/ol/interaction/PinchRotate.js +++ b/src/ol/interaction/PinchRotate.js @@ -5,7 +5,7 @@ import {inherits} from '../index.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 PointerInteraction from '../interaction/Pointer.js'; import RotationConstraint from '../RotationConstraint.js'; /** @@ -20,7 +20,7 @@ import RotationConstraint from '../RotationConstraint.js'; */ var PinchRotate = function(opt_options) { - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: PinchRotate.handleDownEvent_, handleDragEvent: PinchRotate.handleDragEvent_, handleUpEvent: PinchRotate.handleUpEvent_ @@ -66,7 +66,7 @@ var PinchRotate = function(opt_options) { }; -inherits(PinchRotate, _ol_interaction_Pointer_); +inherits(PinchRotate, PointerInteraction); /** @@ -106,7 +106,7 @@ PinchRotate.handleDragEvent_ = function(mapBrowserEvent) { // FIXME: should be the intersection point between the lines: // touch0,touch1 and previousTouch0,previousTouch1 var viewportPosition = map.getViewport().getBoundingClientRect(); - var centroid = _ol_interaction_Pointer_.centroid(this.targetPointers); + var centroid = PointerInteraction.centroid(this.targetPointers); centroid[0] -= viewportPosition.left; centroid[1] -= viewportPosition.top; this.anchor_ = map.getCoordinateFromPixel(centroid); diff --git a/src/ol/interaction/PinchZoom.js b/src/ol/interaction/PinchZoom.js index edb6c080c1..9d75905918 100644 --- a/src/ol/interaction/PinchZoom.js +++ b/src/ol/interaction/PinchZoom.js @@ -5,7 +5,7 @@ import {inherits} from '../index.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 PointerInteraction from '../interaction/Pointer.js'; /** * @classdesc @@ -19,7 +19,7 @@ import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; */ var PinchZoom = function(opt_options) { - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: PinchZoom.handleDownEvent_, handleDragEvent: PinchZoom.handleDragEvent_, handleUpEvent: PinchZoom.handleUpEvent_ @@ -59,7 +59,7 @@ var PinchZoom = function(opt_options) { }; -inherits(PinchZoom, _ol_interaction_Pointer_); +inherits(PinchZoom, PointerInteraction); /** @@ -104,7 +104,7 @@ PinchZoom.handleDragEvent_ = function(mapBrowserEvent) { // scale anchor point. var viewportPosition = map.getViewport().getBoundingClientRect(); - var centroid = _ol_interaction_Pointer_.centroid(this.targetPointers); + var centroid = PointerInteraction.centroid(this.targetPointers); centroid[0] -= viewportPosition.left; centroid[1] -= viewportPosition.top; this.anchor_ = map.getCoordinateFromPixel(centroid); diff --git a/src/ol/interaction/Pointer.js b/src/ol/interaction/Pointer.js index a26586c5e0..12782bd0bb 100644 --- a/src/ol/interaction/Pointer.js +++ b/src/ol/interaction/Pointer.js @@ -23,12 +23,12 @@ import _ol_obj_ from '../obj.js'; * @extends {ol.interaction.Interaction} * @api */ -var _ol_interaction_Pointer_ = function(opt_options) { +var PointerInteraction = function(opt_options) { var options = opt_options ? opt_options : {}; var handleEvent = options.handleEvent ? - options.handleEvent : _ol_interaction_Pointer_.handleEvent; + options.handleEvent : PointerInteraction.handleEvent; Interaction.call(this, { handleEvent: handleEvent @@ -39,28 +39,28 @@ var _ol_interaction_Pointer_ = function(opt_options) { * @private */ this.handleDownEvent_ = options.handleDownEvent ? - options.handleDownEvent : _ol_interaction_Pointer_.handleDownEvent; + options.handleDownEvent : PointerInteraction.handleDownEvent; /** * @type {function(ol.MapBrowserPointerEvent)} * @private */ this.handleDragEvent_ = options.handleDragEvent ? - options.handleDragEvent : _ol_interaction_Pointer_.handleDragEvent; + options.handleDragEvent : PointerInteraction.handleDragEvent; /** * @type {function(ol.MapBrowserPointerEvent)} * @private */ this.handleMoveEvent_ = options.handleMoveEvent ? - options.handleMoveEvent : _ol_interaction_Pointer_.handleMoveEvent; + options.handleMoveEvent : PointerInteraction.handleMoveEvent; /** * @type {function(ol.MapBrowserPointerEvent):boolean} * @private */ this.handleUpEvent_ = options.handleUpEvent ? - options.handleUpEvent : _ol_interaction_Pointer_.handleUpEvent; + options.handleUpEvent : PointerInteraction.handleUpEvent; /** * @type {boolean} @@ -82,14 +82,14 @@ var _ol_interaction_Pointer_ = function(opt_options) { }; -inherits(_ol_interaction_Pointer_, Interaction); +inherits(PointerInteraction, Interaction); /** * @param {Array.} pointerEvents List of events. * @return {ol.Pixel} Centroid pixel. */ -_ol_interaction_Pointer_.centroid = function(pointerEvents) { +PointerInteraction.centroid = function(pointerEvents) { var length = pointerEvents.length; var clientX = 0; var clientY = 0; @@ -107,7 +107,7 @@ _ol_interaction_Pointer_.centroid = function(pointerEvents) { * or pointerup event. * @private */ -_ol_interaction_Pointer_.prototype.isPointerDraggingEvent_ = function(mapBrowserEvent) { +PointerInteraction.prototype.isPointerDraggingEvent_ = function(mapBrowserEvent) { var type = mapBrowserEvent.type; return type === MapBrowserEventType.POINTERDOWN || type === MapBrowserEventType.POINTERDRAG || @@ -119,7 +119,7 @@ _ol_interaction_Pointer_.prototype.isPointerDraggingEvent_ = function(mapBrowser * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. * @private */ -_ol_interaction_Pointer_.prototype.updateTrackedPointers_ = function(mapBrowserEvent) { +PointerInteraction.prototype.updateTrackedPointers_ = function(mapBrowserEvent) { if (this.isPointerDraggingEvent_(mapBrowserEvent)) { var event = mapBrowserEvent.pointerEvent; @@ -142,7 +142,7 @@ _ol_interaction_Pointer_.prototype.updateTrackedPointers_ = function(mapBrowserE * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. * @this {ol.interaction.Pointer} */ -_ol_interaction_Pointer_.handleDragEvent = nullFunction; +PointerInteraction.handleDragEvent = nullFunction; /** @@ -150,7 +150,7 @@ _ol_interaction_Pointer_.handleDragEvent = nullFunction; * @return {boolean} Capture dragging. * @this {ol.interaction.Pointer} */ -_ol_interaction_Pointer_.handleUpEvent = FALSE; +PointerInteraction.handleUpEvent = FALSE; /** @@ -158,14 +158,14 @@ _ol_interaction_Pointer_.handleUpEvent = FALSE; * @return {boolean} Capture dragging. * @this {ol.interaction.Pointer} */ -_ol_interaction_Pointer_.handleDownEvent = FALSE; +PointerInteraction.handleDownEvent = FALSE; /** * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. * @this {ol.interaction.Pointer} */ -_ol_interaction_Pointer_.handleMoveEvent = nullFunction; +PointerInteraction.handleMoveEvent = nullFunction; /** @@ -177,7 +177,7 @@ _ol_interaction_Pointer_.handleMoveEvent = nullFunction; * @this {ol.interaction.Pointer} * @api */ -_ol_interaction_Pointer_.handleEvent = function(mapBrowserEvent) { +PointerInteraction.handleEvent = function(mapBrowserEvent) { if (!(mapBrowserEvent instanceof MapBrowserPointerEvent)) { return true; } @@ -217,8 +217,8 @@ _ol_interaction_Pointer_.handleEvent = function(mapBrowserEvent) { * @return {boolean} Should the event be stopped? * @protected */ -_ol_interaction_Pointer_.prototype.shouldStopEvent = function(handled) { +PointerInteraction.prototype.shouldStopEvent = function(handled) { return handled; }; -export default _ol_interaction_Pointer_; +export default PointerInteraction; diff --git a/src/ol/interaction/Select.js b/src/ol/interaction/Select.js index da8e6ab6e3..2cd9d10a5f 100644 --- a/src/ol/interaction/Select.js +++ b/src/ol/interaction/Select.js @@ -13,7 +13,7 @@ import Interaction from '../interaction/Interaction.js'; import VectorLayer from '../layer/Vector.js'; import _ol_obj_ from '../obj.js'; import VectorSource from '../source/Vector.js'; -import _ol_style_Style_ from '../style/Style.js'; +import Style from '../style/Style.js'; /** * @classdesc @@ -33,10 +33,10 @@ import _ol_style_Style_ from '../style/Style.js'; * @fires ol.interaction.Select.Event * @api */ -var _ol_interaction_Select_ = function(opt_options) { +var Select = function(opt_options) { Interaction.call(this, { - handleEvent: _ol_interaction_Select_.handleEvent + handleEvent: Select.handleEvent }); var options = opt_options ? opt_options : {}; @@ -94,7 +94,7 @@ var _ol_interaction_Select_ = function(opt_options) { wrapX: options.wrapX }), style: options.style ? options.style : - _ol_interaction_Select_.getDefaultStyleFunction(), + Select.getDefaultStyleFunction(), updateWhileAnimating: true, updateWhileInteracting: true }); @@ -142,7 +142,7 @@ var _ol_interaction_Select_ = function(opt_options) { }; -inherits(_ol_interaction_Select_, Interaction); +inherits(Select, Interaction); /** @@ -150,7 +150,7 @@ inherits(_ol_interaction_Select_, Interaction); * @param {ol.layer.Layer} layer Layer. * @private */ -_ol_interaction_Select_.prototype.addFeatureLayerAssociation_ = function(feature, layer) { +Select.prototype.addFeatureLayerAssociation_ = function(feature, layer) { var key = getUid(feature); this.featureLayerAssociation_[key] = layer; }; @@ -161,7 +161,7 @@ _ol_interaction_Select_.prototype.addFeatureLayerAssociation_ = function(feature * @return {ol.Collection.} Features collection. * @api */ -_ol_interaction_Select_.prototype.getFeatures = function() { +Select.prototype.getFeatures = function() { return this.featureOverlay_.getSource().getFeaturesCollection(); }; @@ -171,7 +171,7 @@ _ol_interaction_Select_.prototype.getFeatures = function() { * @returns {number} Hit tolerance in pixels. * @api */ -_ol_interaction_Select_.prototype.getHitTolerance = function() { +Select.prototype.getHitTolerance = function() { return this.hitTolerance_; }; @@ -185,7 +185,7 @@ _ol_interaction_Select_.prototype.getHitTolerance = function() { * @return {ol.layer.Vector} Layer. * @api */ -_ol_interaction_Select_.prototype.getLayer = function(feature) { +Select.prototype.getLayer = function(feature) { var key = getUid(feature); return /** @type {ol.layer.Vector} */ (this.featureLayerAssociation_[key]); }; @@ -199,7 +199,7 @@ _ol_interaction_Select_.prototype.getLayer = function(feature) { * @this {ol.interaction.Select} * @api */ -_ol_interaction_Select_.handleEvent = function(mapBrowserEvent) { +Select.handleEvent = function(mapBrowserEvent) { if (!this.condition_(mapBrowserEvent)) { return true; } @@ -280,7 +280,7 @@ _ol_interaction_Select_.handleEvent = function(mapBrowserEvent) { } if (selected.length > 0 || deselected.length > 0) { this.dispatchEvent( - new _ol_interaction_Select_.Event(_ol_interaction_Select_.EventType_.SELECT, + new Select.Event(Select.EventType_.SELECT, selected, deselected, mapBrowserEvent)); } return _ol_events_condition_.pointerMove(mapBrowserEvent); @@ -294,7 +294,7 @@ _ol_interaction_Select_.handleEvent = function(mapBrowserEvent) { * @param {number} hitTolerance Hit tolerance in pixels. * @api */ -_ol_interaction_Select_.prototype.setHitTolerance = function(hitTolerance) { +Select.prototype.setHitTolerance = function(hitTolerance) { this.hitTolerance_ = hitTolerance; }; @@ -306,7 +306,7 @@ _ol_interaction_Select_.prototype.setHitTolerance = function(hitTolerance) { * @override * @api */ -_ol_interaction_Select_.prototype.setMap = function(map) { +Select.prototype.setMap = function(map) { var currentMap = this.getMap(); var selectedFeatures = this.featureOverlay_.getSource().getFeaturesCollection(); @@ -324,8 +324,8 @@ _ol_interaction_Select_.prototype.setMap = function(map) { /** * @return {ol.StyleFunction} Styles. */ -_ol_interaction_Select_.getDefaultStyleFunction = function() { - var styles = _ol_style_Style_.createDefaultEditing(); +Select.getDefaultStyleFunction = function() { + var styles = Style.createDefaultEditing(); extend(styles[GeometryType.POLYGON], styles[GeometryType.LINE_STRING]); extend(styles[GeometryType.GEOMETRY_COLLECTION], styles[GeometryType.LINE_STRING]); @@ -342,7 +342,7 @@ _ol_interaction_Select_.getDefaultStyleFunction = function() { * @param {ol.Collection.Event} evt Event. * @private */ -_ol_interaction_Select_.prototype.addFeature_ = function(evt) { +Select.prototype.addFeature_ = function(evt) { var map = this.getMap(); if (map) { map.skipFeature(/** @type {ol.Feature} */ (evt.element)); @@ -354,7 +354,7 @@ _ol_interaction_Select_.prototype.addFeature_ = function(evt) { * @param {ol.Collection.Event} evt Event. * @private */ -_ol_interaction_Select_.prototype.removeFeature_ = function(evt) { +Select.prototype.removeFeature_ = function(evt) { var map = this.getMap(); if (map) { map.unskipFeature(/** @type {ol.Feature} */ (evt.element)); @@ -366,7 +366,7 @@ _ol_interaction_Select_.prototype.removeFeature_ = function(evt) { * @param {ol.Feature|ol.render.Feature} feature Feature. * @private */ -_ol_interaction_Select_.prototype.removeFeatureLayerAssociation_ = function(feature) { +Select.prototype.removeFeatureLayerAssociation_ = function(feature) { var key = getUid(feature); delete this.featureLayerAssociation_[key]; }; @@ -386,7 +386,7 @@ _ol_interaction_Select_.prototype.removeFeatureLayerAssociation_ = function(feat * @extends {ol.events.Event} * @constructor */ -_ol_interaction_Select_.Event = function(type, selected, deselected, mapBrowserEvent) { +Select.Event = function(type, selected, deselected, mapBrowserEvent) { Event.call(this, type); /** @@ -410,14 +410,14 @@ _ol_interaction_Select_.Event = function(type, selected, deselected, mapBrowserE */ this.mapBrowserEvent = mapBrowserEvent; }; -inherits(_ol_interaction_Select_.Event, Event); +inherits(Select.Event, Event); /** * @enum {string} * @private */ -_ol_interaction_Select_.EventType_ = { +Select.EventType_ = { /** * Triggered when feature(s) has been (de)selected. * @event ol.interaction.Select.Event#select @@ -425,4 +425,4 @@ _ol_interaction_Select_.EventType_ = { */ SELECT: 'select' }; -export default _ol_interaction_Select_; +export default Select; diff --git a/src/ol/interaction/Snap.js b/src/ol/interaction/Snap.js index 2556f32ed8..19ea695606 100644 --- a/src/ol/interaction/Snap.js +++ b/src/ol/interaction/Snap.js @@ -2,7 +2,7 @@ * @module ol/interaction/Snap */ import {getUid, inherits} from '../index.js'; -import _ol_Collection_ from '../Collection.js'; +import Collection from '../Collection.js'; import CollectionEventType from '../CollectionEventType.js'; import _ol_coordinate_ from '../coordinate.js'; import _ol_events_ from '../events.js'; @@ -11,7 +11,7 @@ import {boundingExtent, createEmpty} from '../extent.js'; import {TRUE, FALSE} from '../functions.js'; import GeometryType from '../geom/GeometryType.js'; import {fromCircle} from '../geom/Polygon.js'; -import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; +import PointerInteraction from '../interaction/Pointer.js'; import _ol_obj_ from '../obj.js'; import VectorSource from '../source/Vector.js'; import VectorEventType from '../source/VectorEventType.js'; @@ -39,12 +39,12 @@ import RBush from '../structs/RBush.js'; * @param {olx.interaction.SnapOptions=} opt_options Options. * @api */ -var _ol_interaction_Snap_ = function(opt_options) { +var Snap = function(opt_options) { - _ol_interaction_Pointer_.call(this, { - handleEvent: _ol_interaction_Snap_.handleEvent_, + PointerInteraction.call(this, { + handleEvent: Snap.handleEvent_, handleDownEvent: TRUE, - handleUpEvent: _ol_interaction_Snap_.handleUpEvent_ + handleUpEvent: Snap.handleUpEvent_ }); var options = opt_options ? opt_options : {}; @@ -120,7 +120,7 @@ var _ol_interaction_Snap_ = function(opt_options) { * @type {function(ol.SnapSegmentDataType, ol.SnapSegmentDataType): number} * @private */ - this.sortByDistance_ = _ol_interaction_Snap_.sortByDistance.bind(this); + this.sortByDistance_ = Snap.sortByDistance.bind(this); /** @@ -149,7 +149,7 @@ var _ol_interaction_Snap_ = function(opt_options) { }; }; -inherits(_ol_interaction_Snap_, _ol_interaction_Pointer_); +inherits(Snap, PointerInteraction); /** @@ -159,7 +159,7 @@ inherits(_ol_interaction_Snap_, _ol_interaction_Pointer_); * Defaults to `true`. * @api */ -_ol_interaction_Snap_.prototype.addFeature = function(feature, opt_listen) { +Snap.prototype.addFeature = function(feature, opt_listen) { var listen = opt_listen !== undefined ? opt_listen : true; var feature_uid = getUid(feature); var geometry = feature.getGeometry(); @@ -184,7 +184,7 @@ _ol_interaction_Snap_.prototype.addFeature = function(feature, opt_listen) { * @param {ol.Feature} feature Feature. * @private */ -_ol_interaction_Snap_.prototype.forEachFeatureAdd_ = function(feature) { +Snap.prototype.forEachFeatureAdd_ = function(feature) { this.addFeature(feature); }; @@ -193,7 +193,7 @@ _ol_interaction_Snap_.prototype.forEachFeatureAdd_ = function(feature) { * @param {ol.Feature} feature Feature. * @private */ -_ol_interaction_Snap_.prototype.forEachFeatureRemove_ = function(feature) { +Snap.prototype.forEachFeatureRemove_ = function(feature) { this.removeFeature(feature); }; @@ -202,7 +202,7 @@ _ol_interaction_Snap_.prototype.forEachFeatureRemove_ = function(feature) { * @return {ol.Collection.|Array.} Features. * @private */ -_ol_interaction_Snap_.prototype.getFeatures_ = function() { +Snap.prototype.getFeatures_ = function() { var features; if (this.features_) { features = this.features_; @@ -217,11 +217,11 @@ _ol_interaction_Snap_.prototype.getFeatures_ = function() { * @param {ol.source.Vector.Event|ol.Collection.Event} evt Event. * @private */ -_ol_interaction_Snap_.prototype.handleFeatureAdd_ = function(evt) { +Snap.prototype.handleFeatureAdd_ = function(evt) { var feature; if (evt instanceof VectorSource.Event) { feature = evt.feature; - } else if (evt instanceof _ol_Collection_.Event) { + } else if (evt instanceof Collection.Event) { feature = evt.element; } this.addFeature(/** @type {ol.Feature} */ (feature)); @@ -232,11 +232,11 @@ _ol_interaction_Snap_.prototype.handleFeatureAdd_ = function(evt) { * @param {ol.source.Vector.Event|ol.Collection.Event} evt Event. * @private */ -_ol_interaction_Snap_.prototype.handleFeatureRemove_ = function(evt) { +Snap.prototype.handleFeatureRemove_ = function(evt) { var feature; if (evt instanceof VectorSource.Event) { feature = evt.feature; - } else if (evt instanceof _ol_Collection_.Event) { + } else if (evt instanceof Collection.Event) { feature = evt.element; } this.removeFeature(/** @type {ol.Feature} */ (feature)); @@ -247,7 +247,7 @@ _ol_interaction_Snap_.prototype.handleFeatureRemove_ = function(evt) { * @param {ol.events.Event} evt Event. * @private */ -_ol_interaction_Snap_.prototype.handleFeatureChange_ = function(evt) { +Snap.prototype.handleFeatureChange_ = function(evt) { var feature = /** @type {ol.Feature} */ (evt.target); if (this.handlingDownUpSequence) { var uid = getUid(feature); @@ -267,7 +267,7 @@ _ol_interaction_Snap_.prototype.handleFeatureChange_ = function(evt) { * or not. Defaults to `true`. * @api */ -_ol_interaction_Snap_.prototype.removeFeature = function(feature, opt_unlisten) { +Snap.prototype.removeFeature = function(feature, opt_unlisten) { var unlisten = opt_unlisten !== undefined ? opt_unlisten : true; var feature_uid = getUid(feature); var extent = this.indexedFeaturesExtents_[feature_uid]; @@ -294,7 +294,7 @@ _ol_interaction_Snap_.prototype.removeFeature = function(feature, opt_unlisten) /** * @inheritDoc */ -_ol_interaction_Snap_.prototype.setMap = function(map) { +Snap.prototype.setMap = function(map) { var currentMap = this.getMap(); var keys = this.featuresListenerKeys_; var features = this.getFeatures_(); @@ -304,7 +304,7 @@ _ol_interaction_Snap_.prototype.setMap = function(map) { keys.length = 0; features.forEach(this.forEachFeatureRemove_.bind(this)); } - _ol_interaction_Pointer_.prototype.setMap.call(this, map); + PointerInteraction.prototype.setMap.call(this, map); if (map) { if (this.features_) { @@ -330,7 +330,7 @@ _ol_interaction_Snap_.prototype.setMap = function(map) { /** * @inheritDoc */ -_ol_interaction_Snap_.prototype.shouldStopEvent = FALSE; +Snap.prototype.shouldStopEvent = FALSE; /** @@ -339,7 +339,7 @@ _ol_interaction_Snap_.prototype.shouldStopEvent = FALSE; * @param {ol.PluggableMap} map Map. * @return {ol.SnapResultType} Snap result */ -_ol_interaction_Snap_.prototype.snapTo = function(pixel, pixelCoordinate, map) { +Snap.prototype.snapTo = function(pixel, pixelCoordinate, map) { var lowerLeft = map.getCoordinateFromPixel( [pixel[0] - this.pixelTolerance_, pixel[1] + this.pixelTolerance_]); @@ -423,7 +423,7 @@ _ol_interaction_Snap_.prototype.snapTo = function(pixel, pixelCoordinate, map) { * @param {ol.Feature} feature Feature * @private */ -_ol_interaction_Snap_.prototype.updateFeature_ = function(feature) { +Snap.prototype.updateFeature_ = function(feature) { this.removeFeature(feature, false); this.addFeature(feature, false); }; @@ -434,7 +434,7 @@ _ol_interaction_Snap_.prototype.updateFeature_ = function(feature) { * @param {ol.geom.Circle} geometry Geometry. * @private */ -_ol_interaction_Snap_.prototype.writeCircleGeometry_ = function(feature, geometry) { +Snap.prototype.writeCircleGeometry_ = function(feature, geometry) { var polygon = fromCircle(geometry); var coordinates = polygon.getCoordinates()[0]; var i, ii, segment, segmentData; @@ -454,7 +454,7 @@ _ol_interaction_Snap_.prototype.writeCircleGeometry_ = function(feature, geometr * @param {ol.geom.GeometryCollection} geometry Geometry. * @private */ -_ol_interaction_Snap_.prototype.writeGeometryCollectionGeometry_ = function(feature, geometry) { +Snap.prototype.writeGeometryCollectionGeometry_ = function(feature, geometry) { var i, geometries = geometry.getGeometriesArray(); for (i = 0; i < geometries.length; ++i) { var segmentWriter = this.SEGMENT_WRITERS_[geometries[i].getType()]; @@ -470,7 +470,7 @@ _ol_interaction_Snap_.prototype.writeGeometryCollectionGeometry_ = function(feat * @param {ol.geom.LineString} geometry Geometry. * @private */ -_ol_interaction_Snap_.prototype.writeLineStringGeometry_ = function(feature, geometry) { +Snap.prototype.writeLineStringGeometry_ = function(feature, geometry) { var coordinates = geometry.getCoordinates(); var i, ii, segment, segmentData; for (i = 0, ii = coordinates.length - 1; i < ii; ++i) { @@ -489,7 +489,7 @@ _ol_interaction_Snap_.prototype.writeLineStringGeometry_ = function(feature, geo * @param {ol.geom.MultiLineString} geometry Geometry. * @private */ -_ol_interaction_Snap_.prototype.writeMultiLineStringGeometry_ = function(feature, geometry) { +Snap.prototype.writeMultiLineStringGeometry_ = function(feature, geometry) { var lines = geometry.getCoordinates(); var coordinates, i, ii, j, jj, segment, segmentData; for (j = 0, jj = lines.length; j < jj; ++j) { @@ -511,7 +511,7 @@ _ol_interaction_Snap_.prototype.writeMultiLineStringGeometry_ = function(feature * @param {ol.geom.MultiPoint} geometry Geometry. * @private */ -_ol_interaction_Snap_.prototype.writeMultiPointGeometry_ = function(feature, geometry) { +Snap.prototype.writeMultiPointGeometry_ = function(feature, geometry) { var points = geometry.getCoordinates(); var coordinates, i, ii, segmentData; for (i = 0, ii = points.length; i < ii; ++i) { @@ -530,7 +530,7 @@ _ol_interaction_Snap_.prototype.writeMultiPointGeometry_ = function(feature, geo * @param {ol.geom.MultiPolygon} geometry Geometry. * @private */ -_ol_interaction_Snap_.prototype.writeMultiPolygonGeometry_ = function(feature, geometry) { +Snap.prototype.writeMultiPolygonGeometry_ = function(feature, geometry) { var polygons = geometry.getCoordinates(); var coordinates, i, ii, j, jj, k, kk, rings, segment, segmentData; for (k = 0, kk = polygons.length; k < kk; ++k) { @@ -555,7 +555,7 @@ _ol_interaction_Snap_.prototype.writeMultiPolygonGeometry_ = function(feature, g * @param {ol.geom.Point} geometry Geometry. * @private */ -_ol_interaction_Snap_.prototype.writePointGeometry_ = function(feature, geometry) { +Snap.prototype.writePointGeometry_ = function(feature, geometry) { var coordinates = geometry.getCoordinates(); var segmentData = /** @type {ol.SnapSegmentDataType} */ ({ feature: feature, @@ -570,7 +570,7 @@ _ol_interaction_Snap_.prototype.writePointGeometry_ = function(feature, geometry * @param {ol.geom.Polygon} geometry Geometry. * @private */ -_ol_interaction_Snap_.prototype.writePolygonGeometry_ = function(feature, geometry) { +Snap.prototype.writePolygonGeometry_ = function(feature, geometry) { var rings = geometry.getCoordinates(); var coordinates, i, ii, j, jj, segment, segmentData; for (j = 0, jj = rings.length; j < jj; ++j) { @@ -594,13 +594,13 @@ _ol_interaction_Snap_.prototype.writePolygonGeometry_ = function(feature, geomet * @this {ol.interaction.Snap} * @private */ -_ol_interaction_Snap_.handleEvent_ = function(evt) { +Snap.handleEvent_ = function(evt) { var result = this.snapTo(evt.pixel, evt.coordinate, evt.map); if (result.snapped) { evt.coordinate = result.vertex.slice(0, 2); evt.pixel = result.vertexPixel; } - return _ol_interaction_Pointer_.handleEvent.call(this, evt); + return PointerInteraction.handleEvent.call(this, evt); }; @@ -610,7 +610,7 @@ _ol_interaction_Snap_.handleEvent_ = function(evt) { * @this {ol.interaction.Snap} * @private */ -_ol_interaction_Snap_.handleUpEvent_ = function(evt) { +Snap.handleUpEvent_ = function(evt) { var featuresToUpdate = _ol_obj_.getValues(this.pendingFeatures_); if (featuresToUpdate.length) { featuresToUpdate.forEach(this.updateFeature_.bind(this)); @@ -627,10 +627,10 @@ _ol_interaction_Snap_.handleUpEvent_ = function(evt) { * @return {number} The difference in distance. * @this {ol.interaction.Snap} */ -_ol_interaction_Snap_.sortByDistance = function(a, b) { +Snap.sortByDistance = function(a, b) { return _ol_coordinate_.squaredDistanceToSegment( this.pixelCoordinate_, a.segment) - _ol_coordinate_.squaredDistanceToSegment( this.pixelCoordinate_, b.segment); }; -export default _ol_interaction_Snap_; +export default Snap; diff --git a/src/ol/interaction/Translate.js b/src/ol/interaction/Translate.js index 146c256abc..40cd77c48f 100644 --- a/src/ol/interaction/Translate.js +++ b/src/ol/interaction/Translate.js @@ -2,15 +2,15 @@ * @module ol/interaction/Translate */ import {inherits} from '../index.js'; -import _ol_Collection_ from '../Collection.js'; +import Collection from '../Collection.js'; import BaseObject from '../Object.js'; import _ol_events_ from '../events.js'; import Event from '../events/Event.js'; import {TRUE} from '../functions.js'; import {includes} from '../array.js'; -import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; +import PointerInteraction from '../interaction/Pointer.js'; import InteractionProperty from '../interaction/Property.js'; -import _ol_interaction_TranslateEventType_ from '../interaction/TranslateEventType.js'; +import TranslateEventType from '../interaction/TranslateEventType.js'; /** * @classdesc @@ -23,7 +23,7 @@ import _ol_interaction_TranslateEventType_ from '../interaction/TranslateEventTy * @api */ var _ol_interaction_Translate_ = function(opt_options) { - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: _ol_interaction_Translate_.handleDownEvent_, handleDragEvent: _ol_interaction_Translate_.handleDragEvent_, handleMoveEvent: _ol_interaction_Translate_.handleMoveEvent_, @@ -85,7 +85,7 @@ var _ol_interaction_Translate_ = function(opt_options) { }; -inherits(_ol_interaction_Translate_, _ol_interaction_Pointer_); +inherits(_ol_interaction_Translate_, PointerInteraction); /** @@ -100,11 +100,11 @@ _ol_interaction_Translate_.handleDownEvent_ = function(event) { this.lastCoordinate_ = event.coordinate; _ol_interaction_Translate_.handleMoveEvent_.call(this, event); - var features = this.features_ || new _ol_Collection_([this.lastFeature_]); + var features = this.features_ || new Collection([this.lastFeature_]); this.dispatchEvent( new _ol_interaction_Translate_.Event( - _ol_interaction_TranslateEventType_.TRANSLATESTART, features, + TranslateEventType.TRANSLATESTART, features, event.coordinate)); return true; } @@ -123,11 +123,11 @@ _ol_interaction_Translate_.handleUpEvent_ = function(event) { this.lastCoordinate_ = null; _ol_interaction_Translate_.handleMoveEvent_.call(this, event); - var features = this.features_ || new _ol_Collection_([this.lastFeature_]); + var features = this.features_ || new Collection([this.lastFeature_]); this.dispatchEvent( new _ol_interaction_Translate_.Event( - _ol_interaction_TranslateEventType_.TRANSLATEEND, features, + TranslateEventType.TRANSLATEEND, features, event.coordinate)); return true; } @@ -146,7 +146,7 @@ _ol_interaction_Translate_.handleDragEvent_ = function(event) { var deltaX = newCoordinate[0] - this.lastCoordinate_[0]; var deltaY = newCoordinate[1] - this.lastCoordinate_[1]; - var features = this.features_ || new _ol_Collection_([this.lastFeature_]); + var features = this.features_ || new Collection([this.lastFeature_]); features.forEach(function(feature) { var geom = feature.getGeometry(); @@ -157,7 +157,7 @@ _ol_interaction_Translate_.handleDragEvent_ = function(event) { this.lastCoordinate_ = newCoordinate; this.dispatchEvent( new _ol_interaction_Translate_.Event( - _ol_interaction_TranslateEventType_.TRANSLATING, features, + TranslateEventType.TRANSLATING, features, newCoordinate)); } }; @@ -231,7 +231,7 @@ _ol_interaction_Translate_.prototype.setHitTolerance = function(hitTolerance) { */ _ol_interaction_Translate_.prototype.setMap = function(map) { var oldMap = this.getMap(); - _ol_interaction_Pointer_.prototype.setMap.call(this, map); + PointerInteraction.prototype.setMap.call(this, map); this.updateState_(oldMap); }; diff --git a/src/ol/layer/Base.js b/src/ol/layer/Base.js index 78ace3cc02..5506892def 100644 --- a/src/ol/layer/Base.js +++ b/src/ol/layer/Base.js @@ -21,7 +21,7 @@ import _ol_obj_ from '../obj.js'; * @param {olx.layer.BaseOptions} options Layer options. * @api */ -var _ol_layer_Base_ = function(options) { +var BaseLayer = function(options) { BaseObject.call(this); @@ -60,14 +60,14 @@ var _ol_layer_Base_ = function(options) { }; -inherits(_ol_layer_Base_, BaseObject); +inherits(BaseLayer, BaseObject); /** * Get the layer type (used when creating a layer renderer). * @return {ol.LayerType} The layer type. */ -_ol_layer_Base_.prototype.getType = function() { +BaseLayer.prototype.getType = function() { return this.type; }; @@ -75,7 +75,7 @@ _ol_layer_Base_.prototype.getType = function() { /** * @return {ol.LayerState} Layer state. */ -_ol_layer_Base_.prototype.getLayerState = function() { +BaseLayer.prototype.getLayerState = function() { this.state_.opacity = clamp(this.getOpacity(), 0, 1); this.state_.sourceState = this.getSourceState(); this.state_.visible = this.getVisible(); @@ -94,7 +94,7 @@ _ol_layer_Base_.prototype.getLayerState = function() { * modified in place). * @return {Array.} Array of layers. */ -_ol_layer_Base_.prototype.getLayersArray = function(opt_array) {}; +BaseLayer.prototype.getLayersArray = function(opt_array) {}; /** @@ -103,7 +103,7 @@ _ol_layer_Base_.prototype.getLayersArray = function(opt_array) {}; * states (to be modified in place). * @return {Array.} List of layer states. */ -_ol_layer_Base_.prototype.getLayerStatesArray = function(opt_states) {}; +BaseLayer.prototype.getLayerStatesArray = function(opt_states) {}; /** @@ -113,7 +113,7 @@ _ol_layer_Base_.prototype.getLayerStatesArray = function(opt_states) {}; * @observable * @api */ -_ol_layer_Base_.prototype.getExtent = function() { +BaseLayer.prototype.getExtent = function() { return ( /** @type {ol.Extent|undefined} */ this.get(LayerProperty.EXTENT) ); @@ -126,7 +126,7 @@ _ol_layer_Base_.prototype.getExtent = function() { * @observable * @api */ -_ol_layer_Base_.prototype.getMaxResolution = function() { +BaseLayer.prototype.getMaxResolution = function() { return ( /** @type {number} */ this.get(LayerProperty.MAX_RESOLUTION) ); @@ -139,7 +139,7 @@ _ol_layer_Base_.prototype.getMaxResolution = function() { * @observable * @api */ -_ol_layer_Base_.prototype.getMinResolution = function() { +BaseLayer.prototype.getMinResolution = function() { return ( /** @type {number} */ this.get(LayerProperty.MIN_RESOLUTION) ); @@ -152,7 +152,7 @@ _ol_layer_Base_.prototype.getMinResolution = function() { * @observable * @api */ -_ol_layer_Base_.prototype.getOpacity = function() { +BaseLayer.prototype.getOpacity = function() { return ( /** @type {number} */ this.get(LayerProperty.OPACITY) ); @@ -163,7 +163,7 @@ _ol_layer_Base_.prototype.getOpacity = function() { * @abstract * @return {ol.source.State} Source state. */ -_ol_layer_Base_.prototype.getSourceState = function() {}; +BaseLayer.prototype.getSourceState = function() {}; /** @@ -172,7 +172,7 @@ _ol_layer_Base_.prototype.getSourceState = function() {}; * @observable * @api */ -_ol_layer_Base_.prototype.getVisible = function() { +BaseLayer.prototype.getVisible = function() { return ( /** @type {boolean} */ this.get(LayerProperty.VISIBLE) ); @@ -186,7 +186,7 @@ _ol_layer_Base_.prototype.getVisible = function() { * @observable * @api */ -_ol_layer_Base_.prototype.getZIndex = function() { +BaseLayer.prototype.getZIndex = function() { return ( /** @type {number} */ this.get(LayerProperty.Z_INDEX) ); @@ -200,7 +200,7 @@ _ol_layer_Base_.prototype.getZIndex = function() { * @observable * @api */ -_ol_layer_Base_.prototype.setExtent = function(extent) { +BaseLayer.prototype.setExtent = function(extent) { this.set(LayerProperty.EXTENT, extent); }; @@ -211,7 +211,7 @@ _ol_layer_Base_.prototype.setExtent = function(extent) { * @observable * @api */ -_ol_layer_Base_.prototype.setMaxResolution = function(maxResolution) { +BaseLayer.prototype.setMaxResolution = function(maxResolution) { this.set(LayerProperty.MAX_RESOLUTION, maxResolution); }; @@ -222,7 +222,7 @@ _ol_layer_Base_.prototype.setMaxResolution = function(maxResolution) { * @observable * @api */ -_ol_layer_Base_.prototype.setMinResolution = function(minResolution) { +BaseLayer.prototype.setMinResolution = function(minResolution) { this.set(LayerProperty.MIN_RESOLUTION, minResolution); }; @@ -233,7 +233,7 @@ _ol_layer_Base_.prototype.setMinResolution = function(minResolution) { * @observable * @api */ -_ol_layer_Base_.prototype.setOpacity = function(opacity) { +BaseLayer.prototype.setOpacity = function(opacity) { this.set(LayerProperty.OPACITY, opacity); }; @@ -244,7 +244,7 @@ _ol_layer_Base_.prototype.setOpacity = function(opacity) { * @observable * @api */ -_ol_layer_Base_.prototype.setVisible = function(visible) { +BaseLayer.prototype.setVisible = function(visible) { this.set(LayerProperty.VISIBLE, visible); }; @@ -256,7 +256,7 @@ _ol_layer_Base_.prototype.setVisible = function(visible) { * @observable * @api */ -_ol_layer_Base_.prototype.setZIndex = function(zindex) { +BaseLayer.prototype.setZIndex = function(zindex) { this.set(LayerProperty.Z_INDEX, zindex); }; -export default _ol_layer_Base_; +export default BaseLayer; diff --git a/src/ol/layer/Group.js b/src/ol/layer/Group.js index 043a24898e..a977c49a20 100644 --- a/src/ol/layer/Group.js +++ b/src/ol/layer/Group.js @@ -2,7 +2,7 @@ * @module ol/layer/Group */ import {getUid, inherits} from '../index.js'; -import _ol_Collection_ from '../Collection.js'; +import Collection from '../Collection.js'; import CollectionEventType from '../CollectionEventType.js'; import BaseObject from '../Object.js'; import ObjectEventType from '../ObjectEventType.js'; @@ -10,7 +10,7 @@ import {assert} from '../asserts.js'; import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {getIntersection} from '../extent.js'; -import _ol_layer_Base_ from '../layer/Base.js'; +import BaseLayer from '../layer/Base.js'; import _ol_obj_ from '../obj.js'; import SourceState from '../source/State.js'; @@ -35,7 +35,7 @@ var Property = { * @param {olx.layer.GroupOptions=} opt_options Layer options. * @api */ -var _ol_layer_Group_ = function(opt_options) { +var LayerGroup = function(opt_options) { var options = opt_options || {}; var baseOptions = /** @type {olx.layer.GroupOptions} */ @@ -44,7 +44,7 @@ var _ol_layer_Group_ = function(opt_options) { var layers = options.layers; - _ol_layer_Base_.call(this, baseOptions); + BaseLayer.call(this, baseOptions); /** * @private @@ -64,27 +64,27 @@ var _ol_layer_Group_ = function(opt_options) { if (layers) { if (Array.isArray(layers)) { - layers = new _ol_Collection_(layers.slice(), {unique: true}); + layers = new Collection(layers.slice(), {unique: true}); } else { - assert(layers instanceof _ol_Collection_, + assert(layers instanceof Collection, 43); // Expected `layers` to be an array or an `ol.Collection` layers = layers; } } else { - layers = new _ol_Collection_(undefined, {unique: true}); + layers = new Collection(undefined, {unique: true}); } this.setLayers(layers); }; -inherits(_ol_layer_Group_, _ol_layer_Base_); +inherits(LayerGroup, BaseLayer); /** * @private */ -_ol_layer_Group_.prototype.handleLayerChange_ = function() { +LayerGroup.prototype.handleLayerChange_ = function() { this.changed(); }; @@ -93,7 +93,7 @@ _ol_layer_Group_.prototype.handleLayerChange_ = function() { * @param {ol.events.Event} event Event. * @private */ -_ol_layer_Group_.prototype.handleLayersChanged_ = function(event) { +LayerGroup.prototype.handleLayersChanged_ = function(event) { this.layersListenerKeys_.forEach(_ol_events_.unlistenByKey); this.layersListenerKeys_.length = 0; @@ -129,7 +129,7 @@ _ol_layer_Group_.prototype.handleLayersChanged_ = function(event) { * @param {ol.Collection.Event} collectionEvent Collection event. * @private */ -_ol_layer_Group_.prototype.handleLayersAdd_ = function(collectionEvent) { +LayerGroup.prototype.handleLayersAdd_ = function(collectionEvent) { var layer = /** @type {ol.layer.Base} */ (collectionEvent.element); var key = getUid(layer).toString(); this.listenerKeys_[key] = [ @@ -146,7 +146,7 @@ _ol_layer_Group_.prototype.handleLayersAdd_ = function(collectionEvent) { * @param {ol.Collection.Event} collectionEvent Collection event. * @private */ -_ol_layer_Group_.prototype.handleLayersRemove_ = function(collectionEvent) { +LayerGroup.prototype.handleLayersRemove_ = function(collectionEvent) { var layer = /** @type {ol.layer.Base} */ (collectionEvent.element); var key = getUid(layer).toString(); this.listenerKeys_[key].forEach(_ol_events_.unlistenByKey); @@ -163,7 +163,7 @@ _ol_layer_Group_.prototype.handleLayersRemove_ = function(collectionEvent) { * @observable * @api */ -_ol_layer_Group_.prototype.getLayers = function() { +LayerGroup.prototype.getLayers = function() { return (/** @type {!ol.Collection.} */ this.get(Property.LAYERS)); }; @@ -176,7 +176,7 @@ _ol_layer_Group_.prototype.getLayers = function() { * @observable * @api */ -_ol_layer_Group_.prototype.setLayers = function(layers) { +LayerGroup.prototype.setLayers = function(layers) { this.set(Property.LAYERS, layers); }; @@ -184,7 +184,7 @@ _ol_layer_Group_.prototype.setLayers = function(layers) { /** * @inheritDoc */ -_ol_layer_Group_.prototype.getLayersArray = function(opt_array) { +LayerGroup.prototype.getLayersArray = function(opt_array) { var array = opt_array !== undefined ? opt_array : []; this.getLayers().forEach(function(layer) { layer.getLayersArray(array); @@ -196,7 +196,7 @@ _ol_layer_Group_.prototype.getLayersArray = function(opt_array) { /** * @inheritDoc */ -_ol_layer_Group_.prototype.getLayerStatesArray = function(opt_states) { +LayerGroup.prototype.getLayerStatesArray = function(opt_states) { var states = opt_states !== undefined ? opt_states : []; var pos = states.length; @@ -231,8 +231,8 @@ _ol_layer_Group_.prototype.getLayerStatesArray = function(opt_states) { /** * @inheritDoc */ -_ol_layer_Group_.prototype.getSourceState = function() { +LayerGroup.prototype.getSourceState = function() { return SourceState.READY; }; -export default _ol_layer_Group_; +export default LayerGroup; diff --git a/src/ol/layer/Heatmap.js b/src/ol/layer/Heatmap.js index 25397b799f..d60e405139 100644 --- a/src/ol/layer/Heatmap.js +++ b/src/ol/layer/Heatmap.js @@ -9,8 +9,8 @@ import VectorLayer from '../layer/Vector.js'; import {clamp} from '../math.js'; import _ol_obj_ from '../obj.js'; import RenderEventType from '../render/EventType.js'; -import _ol_style_Icon_ from '../style/Icon.js'; -import _ol_style_Style_ from '../style/Style.js'; +import Icon from '../style/Icon.js'; +import Style from '../style/Style.js'; /** @@ -117,8 +117,8 @@ var Heatmap = function(opt_options) { var style = this.styleCache_[index]; if (!style) { style = [ - new _ol_style_Style_({ - image: new _ol_style_Icon_({ + new Style({ + image: new Icon({ opacity: opacity, src: this.circleImage_ }) diff --git a/src/ol/layer/Image.js b/src/ol/layer/Image.js index bfd059b7fb..7477b585c7 100644 --- a/src/ol/layer/Image.js +++ b/src/ol/layer/Image.js @@ -3,7 +3,7 @@ */ import {inherits} from '../index.js'; import LayerType from '../LayerType.js'; -import _ol_layer_Layer_ from '../layer/Layer.js'; +import Layer from '../layer/Layer.js'; /** * @classdesc @@ -21,7 +21,7 @@ import _ol_layer_Layer_ from '../layer/Layer.js'; */ var ImageLayer = function(opt_options) { var options = opt_options ? opt_options : {}; - _ol_layer_Layer_.call(this, /** @type {olx.layer.LayerOptions} */ (options)); + Layer.call(this, /** @type {olx.layer.LayerOptions} */ (options)); /** * The layer type. @@ -32,7 +32,7 @@ var ImageLayer = function(opt_options) { }; -inherits(ImageLayer, _ol_layer_Layer_); +inherits(ImageLayer, Layer); /** diff --git a/src/ol/layer/Layer.js b/src/ol/layer/Layer.js index 5718c74f87..99e37a2254 100644 --- a/src/ol/layer/Layer.js +++ b/src/ol/layer/Layer.js @@ -5,7 +5,7 @@ import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {getUid, inherits} from '../index.js'; import BaseObject from '../Object.js'; -import _ol_layer_Base_ from '../layer/Base.js'; +import BaseLayer from '../layer/Base.js'; import LayerProperty from '../layer/Property.js'; import _ol_obj_ from '../obj.js'; import RenderEventType from '../render/EventType.js'; @@ -33,12 +33,12 @@ import SourceState from '../source/State.js'; * @param {olx.layer.LayerOptions} options Layer options. * @api */ -var _ol_layer_Layer_ = function(options) { +var Layer = function(options) { var baseOptions = _ol_obj_.assign({}, options); delete baseOptions.source; - _ol_layer_Base_.call(this, /** @type {olx.layer.BaseOptions} */ (baseOptions)); + BaseLayer.call(this, /** @type {olx.layer.BaseOptions} */ (baseOptions)); /** * @private @@ -70,7 +70,7 @@ var _ol_layer_Layer_ = function(options) { this.setSource(source); }; -inherits(_ol_layer_Layer_, _ol_layer_Base_); +inherits(Layer, BaseLayer); /** @@ -81,7 +81,7 @@ inherits(_ol_layer_Layer_, _ol_layer_Base_); * @param {number} resolution Resolution. * @return {boolean} The layer is visible at the given resolution. */ -_ol_layer_Layer_.visibleAtResolution = function(layerState, resolution) { +Layer.visibleAtResolution = function(layerState, resolution) { return layerState.visible && resolution >= layerState.minResolution && resolution < layerState.maxResolution; }; @@ -90,7 +90,7 @@ _ol_layer_Layer_.visibleAtResolution = function(layerState, resolution) { /** * @inheritDoc */ -_ol_layer_Layer_.prototype.getLayersArray = function(opt_array) { +Layer.prototype.getLayersArray = function(opt_array) { var array = opt_array ? opt_array : []; array.push(this); return array; @@ -100,7 +100,7 @@ _ol_layer_Layer_.prototype.getLayersArray = function(opt_array) { /** * @inheritDoc */ -_ol_layer_Layer_.prototype.getLayerStatesArray = function(opt_states) { +Layer.prototype.getLayerStatesArray = function(opt_states) { var states = opt_states ? opt_states : []; states.push(this.getLayerState()); return states; @@ -113,7 +113,7 @@ _ol_layer_Layer_.prototype.getLayerStatesArray = function(opt_states) { * @observable * @api */ -_ol_layer_Layer_.prototype.getSource = function() { +Layer.prototype.getSource = function() { var source = this.get(LayerProperty.SOURCE); return /** @type {ol.source.Source} */ (source) || null; }; @@ -122,7 +122,7 @@ _ol_layer_Layer_.prototype.getSource = function() { /** * @inheritDoc */ -_ol_layer_Layer_.prototype.getSourceState = function() { +Layer.prototype.getSourceState = function() { var source = this.getSource(); return !source ? SourceState.UNDEFINED : source.getState(); }; @@ -131,7 +131,7 @@ _ol_layer_Layer_.prototype.getSourceState = function() { /** * @private */ -_ol_layer_Layer_.prototype.handleSourceChange_ = function() { +Layer.prototype.handleSourceChange_ = function() { this.changed(); }; @@ -139,7 +139,7 @@ _ol_layer_Layer_.prototype.handleSourceChange_ = function() { /** * @private */ -_ol_layer_Layer_.prototype.handleSourcePropertyChange_ = function() { +Layer.prototype.handleSourcePropertyChange_ = function() { if (this.sourceChangeKey_) { _ol_events_.unlistenByKey(this.sourceChangeKey_); this.sourceChangeKey_ = null; @@ -165,7 +165,7 @@ _ol_layer_Layer_.prototype.handleSourcePropertyChange_ = function() { * @param {ol.PluggableMap} map Map. * @api */ -_ol_layer_Layer_.prototype.setMap = function(map) { +Layer.prototype.setMap = function(map) { if (this.mapPrecomposeKey_) { _ol_events_.unlistenByKey(this.mapPrecomposeKey_); this.mapPrecomposeKey_ = null; @@ -199,7 +199,7 @@ _ol_layer_Layer_.prototype.setMap = function(map) { * @observable * @api */ -_ol_layer_Layer_.prototype.setSource = function(source) { +Layer.prototype.setSource = function(source) { this.set(LayerProperty.SOURCE, source); }; -export default _ol_layer_Layer_; +export default Layer; diff --git a/src/ol/layer/Tile.js b/src/ol/layer/Tile.js index 91601b4c48..4846832420 100644 --- a/src/ol/layer/Tile.js +++ b/src/ol/layer/Tile.js @@ -3,7 +3,7 @@ */ import {inherits} from '../index.js'; import LayerType from '../LayerType.js'; -import _ol_layer_Layer_ from '../layer/Layer.js'; +import Layer from '../layer/Layer.js'; import _ol_layer_TileProperty_ from '../layer/TileProperty.js'; import _ol_obj_ from '../obj.js'; @@ -28,7 +28,7 @@ var TileLayer = function(opt_options) { delete baseOptions.preload; delete baseOptions.useInterimTilesOnError; - _ol_layer_Layer_.call(this, /** @type {olx.layer.LayerOptions} */ (baseOptions)); + Layer.call(this, /** @type {olx.layer.LayerOptions} */ (baseOptions)); this.setPreload(options.preload !== undefined ? options.preload : 0); this.setUseInterimTilesOnError(options.useInterimTilesOnError !== undefined ? @@ -43,7 +43,7 @@ var TileLayer = function(opt_options) { }; -inherits(TileLayer, _ol_layer_Layer_); +inherits(TileLayer, Layer); /** diff --git a/src/ol/layer/Vector.js b/src/ol/layer/Vector.js index 99e0eed12a..ea94399be8 100644 --- a/src/ol/layer/Vector.js +++ b/src/ol/layer/Vector.js @@ -3,10 +3,10 @@ */ import {inherits} from '../index.js'; import LayerType from '../LayerType.js'; -import _ol_layer_Layer_ from '../layer/Layer.js'; +import Layer from '../layer/Layer.js'; import _ol_layer_VectorRenderType_ from '../layer/VectorRenderType.js'; import _ol_obj_ from '../obj.js'; -import _ol_style_Style_ from '../style/Style.js'; +import Style from '../style/Style.js'; /** @@ -41,7 +41,7 @@ var VectorLayer = function(opt_options) { delete baseOptions.renderBuffer; delete baseOptions.updateWhileAnimating; delete baseOptions.updateWhileInteracting; - _ol_layer_Layer_.call(this, /** @type {olx.layer.LayerOptions} */ (baseOptions)); + Layer.call(this, /** @type {olx.layer.LayerOptions} */ (baseOptions)); /** * @private @@ -101,7 +101,7 @@ var VectorLayer = function(opt_options) { }; -inherits(VectorLayer, _ol_layer_Layer_); +inherits(VectorLayer, Layer); /** @@ -207,9 +207,9 @@ VectorLayer.prototype.setRenderOrder = function(renderOrder) { * @api */ VectorLayer.prototype.setStyle = function(style) { - this.style_ = style !== undefined ? style : _ol_style_Style_.defaultFunction; + this.style_ = style !== undefined ? style : Style.defaultFunction; this.styleFunction_ = style === null ? - undefined : _ol_style_Style_.createFunction(this.style_); + undefined : Style.createFunction(this.style_); this.changed(); }; diff --git a/src/ol/layer/VectorTile.js b/src/ol/layer/VectorTile.js index 09fff11053..e6abe832ca 100644 --- a/src/ol/layer/VectorTile.js +++ b/src/ol/layer/VectorTile.js @@ -21,7 +21,7 @@ import _ol_obj_ from '../obj.js'; * @param {olx.layer.VectorTileOptions=} opt_options Options. * @api */ -var _ol_layer_VectorTile_ = function(opt_options) { +var VectorTileLayer = function(opt_options) { var options = opt_options ? opt_options : {}; var renderMode = options.renderMode || _ol_layer_VectorTileRenderType_.HYBRID; @@ -54,7 +54,7 @@ var _ol_layer_VectorTile_ = function(opt_options) { }; -inherits(_ol_layer_VectorTile_, VectorLayer); +inherits(VectorTileLayer, VectorLayer); /** @@ -63,7 +63,7 @@ inherits(_ol_layer_VectorTile_, VectorLayer); * @observable * @api */ -_ol_layer_VectorTile_.prototype.getPreload = function() { +VectorTileLayer.prototype.getPreload = function() { return ( /** @type {number} */ this.get(_ol_layer_TileProperty_.PRELOAD) ); @@ -76,7 +76,7 @@ _ol_layer_VectorTile_.prototype.getPreload = function() { * @observable * @api */ -_ol_layer_VectorTile_.prototype.getUseInterimTilesOnError = function() { +VectorTileLayer.prototype.getUseInterimTilesOnError = function() { return ( /** @type {boolean} */ this.get(_ol_layer_TileProperty_.USE_INTERIM_TILES_ON_ERROR) ); @@ -89,7 +89,7 @@ _ol_layer_VectorTile_.prototype.getUseInterimTilesOnError = function() { * @observable * @api */ -_ol_layer_VectorTile_.prototype.setPreload = function(preload) { +VectorTileLayer.prototype.setPreload = function(preload) { this.set(_ol_layer_TileProperty_.PRELOAD, preload); }; @@ -100,7 +100,7 @@ _ol_layer_VectorTile_.prototype.setPreload = function(preload) { * @observable * @api */ -_ol_layer_VectorTile_.prototype.setUseInterimTilesOnError = function(useInterimTilesOnError) { +VectorTileLayer.prototype.setUseInterimTilesOnError = function(useInterimTilesOnError) { this.set( _ol_layer_TileProperty_.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError); }; @@ -112,5 +112,5 @@ _ol_layer_VectorTile_.prototype.setUseInterimTilesOnError = function(useInterimT * @return {ol.source.VectorTile} Source. * @api */ -_ol_layer_VectorTile_.prototype.getSource; -export default _ol_layer_VectorTile_; +VectorTileLayer.prototype.getSource; +export default VectorTileLayer; diff --git a/src/ol/pointer/PointerEvent.js b/src/ol/pointer/PointerEvent.js index d4ed88f2b5..24f87971c3 100644 --- a/src/ol/pointer/PointerEvent.js +++ b/src/ol/pointer/PointerEvent.js @@ -47,7 +47,7 @@ import Event from '../events/Event.js'; * @param {Object.=} opt_eventDict An optional dictionary of * initial event properties. */ -var _ol_pointer_PointerEvent_ = function(type, originalEvent, opt_eventDict) { +var PointerEvent = function(type, originalEvent, opt_eventDict) { Event.call(this, type); /** @@ -192,7 +192,7 @@ var _ol_pointer_PointerEvent_ = function(type, originalEvent, opt_eventDict) { } }; -inherits(_ol_pointer_PointerEvent_, Event); +inherits(PointerEvent, Event); /** @@ -200,7 +200,7 @@ inherits(_ol_pointer_PointerEvent_, Event); * @param {Object.} eventDict The event dictionary. * @return {number} Button indicator. */ -_ol_pointer_PointerEvent_.prototype.getButtons_ = function(eventDict) { +PointerEvent.prototype.getButtons_ = function(eventDict) { // According to the w3c spec, // http://www.w3.org/TR/DOM-Level-3-Events/#events-MouseEvent-button // MouseEvent.button == 0 can mean either no mouse button depressed, or the @@ -223,7 +223,7 @@ _ol_pointer_PointerEvent_.prototype.getButtons_ = function(eventDict) { // // This is fixed with DOM Level 4's use of buttons var buttons; - if (eventDict.buttons || _ol_pointer_PointerEvent_.HAS_BUTTONS) { + if (eventDict.buttons || PointerEvent.HAS_BUTTONS) { buttons = eventDict.buttons; } else { switch (eventDict.which) { @@ -243,7 +243,7 @@ _ol_pointer_PointerEvent_.prototype.getButtons_ = function(eventDict) { * @param {number} buttons Button indicator. * @return {number} The pressure. */ -_ol_pointer_PointerEvent_.prototype.getPressure_ = function(eventDict, buttons) { +PointerEvent.prototype.getPressure_ = function(eventDict, buttons) { // Spec requires that pointers without pressure specified use 0.5 for down // state and 0 for up state. var pressure = 0; @@ -260,7 +260,7 @@ _ol_pointer_PointerEvent_.prototype.getPressure_ = function(eventDict, buttons) * Is the `buttons` property supported? * @type {boolean} */ -_ol_pointer_PointerEvent_.HAS_BUTTONS = false; +PointerEvent.HAS_BUTTONS = false; /** @@ -269,9 +269,9 @@ _ol_pointer_PointerEvent_.HAS_BUTTONS = false; (function() { try { var ev = new MouseEvent('click', {buttons: 1}); - _ol_pointer_PointerEvent_.HAS_BUTTONS = ev.buttons === 1; + PointerEvent.HAS_BUTTONS = ev.buttons === 1; } catch (e) { // pass } })(); -export default _ol_pointer_PointerEvent_; +export default PointerEvent; diff --git a/src/ol/pointer/PointerEventHandler.js b/src/ol/pointer/PointerEventHandler.js index f7dc510e9d..fd585837a0 100644 --- a/src/ol/pointer/PointerEventHandler.js +++ b/src/ol/pointer/PointerEventHandler.js @@ -39,7 +39,7 @@ import PointerEventType from '../pointer/EventType.js'; import _ol_pointer_MouseSource_ from '../pointer/MouseSource.js'; import _ol_pointer_MsSource_ from '../pointer/MsSource.js'; import _ol_pointer_NativeSource_ from '../pointer/NativeSource.js'; -import _ol_pointer_PointerEvent_ from '../pointer/PointerEvent.js'; +import PointerEvent from '../pointer/PointerEvent.js'; import _ol_pointer_TouchSource_ from '../pointer/TouchSource.js'; /** @@ -47,7 +47,7 @@ import _ol_pointer_TouchSource_ from '../pointer/TouchSource.js'; * @extends {ol.events.EventTarget} * @param {Element|HTMLDocument} element Viewport element. */ -var _ol_pointer_PointerEventHandler_ = function(element) { +var PointerEventHandler = function(element) { EventTarget.call(this); /** @@ -78,14 +78,14 @@ var _ol_pointer_PointerEventHandler_ = function(element) { this.registerSources(); }; -inherits(_ol_pointer_PointerEventHandler_, EventTarget); +inherits(PointerEventHandler, EventTarget); /** * Set up the event sources (mouse, touch and native pointers) * that generate pointer events. */ -_ol_pointer_PointerEventHandler_.prototype.registerSources = function() { +PointerEventHandler.prototype.registerSources = function() { if (_ol_has_.POINTER) { this.registerSource('native', new _ol_pointer_NativeSource_(this)); } else if (_ol_has_.MSPOINTER) { @@ -111,7 +111,7 @@ _ol_pointer_PointerEventHandler_.prototype.registerSources = function() { * @param {string} name A name for the event source * @param {ol.pointer.EventSource} source The source event. */ -_ol_pointer_PointerEventHandler_.prototype.registerSource = function(name, source) { +PointerEventHandler.prototype.registerSource = function(name, source) { var s = source; var newEvents = s.getEvents(); @@ -132,7 +132,7 @@ _ol_pointer_PointerEventHandler_.prototype.registerSource = function(name, sourc * Set up the events for all registered event sources. * @private */ -_ol_pointer_PointerEventHandler_.prototype.register_ = function() { +PointerEventHandler.prototype.register_ = function() { var l = this.eventSourceList_.length; var eventSource; for (var i = 0; i < l; i++) { @@ -146,7 +146,7 @@ _ol_pointer_PointerEventHandler_.prototype.register_ = function() { * Remove all registered events. * @private */ -_ol_pointer_PointerEventHandler_.prototype.unregister_ = function() { +PointerEventHandler.prototype.unregister_ = function() { var l = this.eventSourceList_.length; var eventSource; for (var i = 0; i < l; i++) { @@ -161,7 +161,7 @@ _ol_pointer_PointerEventHandler_.prototype.unregister_ = function() { * @private * @param {Event} inEvent Browser event. */ -_ol_pointer_PointerEventHandler_.prototype.eventHandler_ = function(inEvent) { +PointerEventHandler.prototype.eventHandler_ = function(inEvent) { var type = inEvent.type; var handler = this.eventMap_[type]; if (handler) { @@ -175,7 +175,7 @@ _ol_pointer_PointerEventHandler_.prototype.eventHandler_ = function(inEvent) { * @private * @param {Array.} events List of events. */ -_ol_pointer_PointerEventHandler_.prototype.addEvents_ = function(events) { +PointerEventHandler.prototype.addEvents_ = function(events) { events.forEach(function(eventName) { _ol_events_.listen(this.element_, eventName, this.eventHandler_, this); }.bind(this)); @@ -187,7 +187,7 @@ _ol_pointer_PointerEventHandler_.prototype.addEvents_ = function(events) { * @private * @param {Array.} events List of events. */ -_ol_pointer_PointerEventHandler_.prototype.removeEvents_ = function(events) { +PointerEventHandler.prototype.removeEvents_ = function(events) { events.forEach(function(e) { _ol_events_.unlisten(this.element_, e, this.eventHandler_, this); }.bind(this)); @@ -203,11 +203,11 @@ _ol_pointer_PointerEventHandler_.prototype.removeEvents_ = function(events) { * @return {Object} An object containing shallow copies of * `inEvent`'s properties. */ -_ol_pointer_PointerEventHandler_.prototype.cloneEvent = function(event, inEvent) { +PointerEventHandler.prototype.cloneEvent = function(event, inEvent) { var eventCopy = {}, p; - for (var i = 0, ii = _ol_pointer_PointerEventHandler_.CLONE_PROPS.length; i < ii; i++) { - p = _ol_pointer_PointerEventHandler_.CLONE_PROPS[i][0]; - eventCopy[p] = event[p] || inEvent[p] || _ol_pointer_PointerEventHandler_.CLONE_PROPS[i][1]; + for (var i = 0, ii = PointerEventHandler.CLONE_PROPS.length; i < ii; i++) { + p = PointerEventHandler.CLONE_PROPS[i][0]; + eventCopy[p] = event[p] || inEvent[p] || PointerEventHandler.CLONE_PROPS[i][1]; } return eventCopy; @@ -222,7 +222,7 @@ _ol_pointer_PointerEventHandler_.prototype.cloneEvent = function(event, inEvent) * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.down = function(data, event) { +PointerEventHandler.prototype.down = function(data, event) { this.fireEvent(PointerEventType.POINTERDOWN, data, event); }; @@ -232,7 +232,7 @@ _ol_pointer_PointerEventHandler_.prototype.down = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.move = function(data, event) { +PointerEventHandler.prototype.move = function(data, event) { this.fireEvent(PointerEventType.POINTERMOVE, data, event); }; @@ -242,7 +242,7 @@ _ol_pointer_PointerEventHandler_.prototype.move = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.up = function(data, event) { +PointerEventHandler.prototype.up = function(data, event) { this.fireEvent(PointerEventType.POINTERUP, data, event); }; @@ -252,7 +252,7 @@ _ol_pointer_PointerEventHandler_.prototype.up = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.enter = function(data, event) { +PointerEventHandler.prototype.enter = function(data, event) { data.bubbles = false; this.fireEvent(PointerEventType.POINTERENTER, data, event); }; @@ -263,7 +263,7 @@ _ol_pointer_PointerEventHandler_.prototype.enter = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.leave = function(data, event) { +PointerEventHandler.prototype.leave = function(data, event) { data.bubbles = false; this.fireEvent(PointerEventType.POINTERLEAVE, data, event); }; @@ -274,7 +274,7 @@ _ol_pointer_PointerEventHandler_.prototype.leave = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.over = function(data, event) { +PointerEventHandler.prototype.over = function(data, event) { data.bubbles = true; this.fireEvent(PointerEventType.POINTEROVER, data, event); }; @@ -285,7 +285,7 @@ _ol_pointer_PointerEventHandler_.prototype.over = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.out = function(data, event) { +PointerEventHandler.prototype.out = function(data, event) { data.bubbles = true; this.fireEvent(PointerEventType.POINTEROUT, data, event); }; @@ -296,7 +296,7 @@ _ol_pointer_PointerEventHandler_.prototype.out = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.cancel = function(data, event) { +PointerEventHandler.prototype.cancel = function(data, event) { this.fireEvent(PointerEventType.POINTERCANCEL, data, event); }; @@ -306,7 +306,7 @@ _ol_pointer_PointerEventHandler_.prototype.cancel = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.leaveOut = function(data, event) { +PointerEventHandler.prototype.leaveOut = function(data, event) { this.out(data, event); if (!this.contains_(data.target, data.relatedTarget)) { this.leave(data, event); @@ -319,7 +319,7 @@ _ol_pointer_PointerEventHandler_.prototype.leaveOut = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.enterOver = function(data, event) { +PointerEventHandler.prototype.enterOver = function(data, event) { this.over(data, event); if (!this.contains_(data.target, data.relatedTarget)) { this.enter(data, event); @@ -334,7 +334,7 @@ _ol_pointer_PointerEventHandler_.prototype.enterOver = function(data, event) { * @return {boolean} Returns true if the container element * contains the other element. */ -_ol_pointer_PointerEventHandler_.prototype.contains_ = function(container, contained) { +PointerEventHandler.prototype.contains_ = function(container, contained) { if (!container || !contained) { return false; } @@ -352,8 +352,8 @@ _ol_pointer_PointerEventHandler_.prototype.contains_ = function(container, conta * @param {Event} event The event. * @return {ol.pointer.PointerEvent} A PointerEvent of type `inType`. */ -_ol_pointer_PointerEventHandler_.prototype.makeEvent = function(inType, data, event) { - return new _ol_pointer_PointerEvent_(inType, event, data); +PointerEventHandler.prototype.makeEvent = function(inType, data, event) { + return new PointerEvent(inType, event, data); }; @@ -363,7 +363,7 @@ _ol_pointer_PointerEventHandler_.prototype.makeEvent = function(inType, data, ev * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.fireEvent = function(inType, data, event) { +PointerEventHandler.prototype.fireEvent = function(inType, data, event) { var e = this.makeEvent(inType, data, event); this.dispatchEvent(e); }; @@ -374,7 +374,7 @@ _ol_pointer_PointerEventHandler_.prototype.fireEvent = function(inType, data, ev * and dispatches this event. * @param {Event} event A platform event with a target. */ -_ol_pointer_PointerEventHandler_.prototype.fireNativeEvent = function(event) { +PointerEventHandler.prototype.fireNativeEvent = function(event) { var e = this.makeEvent(event.type, event, event); this.dispatchEvent(e); }; @@ -387,7 +387,7 @@ _ol_pointer_PointerEventHandler_.prototype.fireNativeEvent = function(event) { * @param {Event} event The event. * @return {ol.pointer.PointerEvent} The wrapped event. */ -_ol_pointer_PointerEventHandler_.prototype.wrapMouseEvent = function(eventType, event) { +PointerEventHandler.prototype.wrapMouseEvent = function(eventType, event) { var pointerEvent = this.makeEvent( eventType, _ol_pointer_MouseSource_.prepareEvent(event, this), event); return pointerEvent; @@ -397,7 +397,7 @@ _ol_pointer_PointerEventHandler_.prototype.wrapMouseEvent = function(eventType, /** * @inheritDoc */ -_ol_pointer_PointerEventHandler_.prototype.disposeInternal = function() { +PointerEventHandler.prototype.disposeInternal = function() { this.unregister_(); EventTarget.prototype.disposeInternal.call(this); }; @@ -407,7 +407,7 @@ _ol_pointer_PointerEventHandler_.prototype.disposeInternal = function() { * Properties to copy when cloning an event, with default values. * @type {Array.} */ -_ol_pointer_PointerEventHandler_.CLONE_PROPS = [ +PointerEventHandler.CLONE_PROPS = [ // MouseEvent ['bubbles', false], ['cancelable', false], @@ -441,4 +441,4 @@ _ol_pointer_PointerEventHandler_.CLONE_PROPS = [ ['currentTarget', null], ['which', 0] ]; -export default _ol_pointer_PointerEventHandler_; +export default PointerEventHandler; diff --git a/src/ol/proj/EPSG3857.js b/src/ol/proj/EPSG3857.js index 033a3ecdcc..e72398b3b7 100644 --- a/src/ol/proj/EPSG3857.js +++ b/src/ol/proj/EPSG3857.js @@ -3,7 +3,7 @@ */ import {inherits} from '../index.js'; import {cosh} from '../math.js'; -import _ol_proj_Projection_ from '../proj/Projection.js'; +import Projection from '../proj/Projection.js'; import Units from '../proj/Units.js'; var _ol_proj_EPSG3857_ = {}; @@ -18,7 +18,7 @@ var _ol_proj_EPSG3857_ = {}; * @private */ _ol_proj_EPSG3857_.Projection_ = function(code) { - _ol_proj_Projection_.call(this, { + Projection.call(this, { code: code, units: Units.METERS, extent: _ol_proj_EPSG3857_.EXTENT, @@ -29,7 +29,7 @@ _ol_proj_EPSG3857_.Projection_ = function(code) { } }); }; -inherits(_ol_proj_EPSG3857_.Projection_, _ol_proj_Projection_); +inherits(_ol_proj_EPSG3857_.Projection_, Projection); /** diff --git a/src/ol/proj/EPSG4326.js b/src/ol/proj/EPSG4326.js index cff4203b1b..645a3eb29c 100644 --- a/src/ol/proj/EPSG4326.js +++ b/src/ol/proj/EPSG4326.js @@ -2,7 +2,7 @@ * @module ol/proj/EPSG4326 */ import {inherits} from '../index.js'; -import _ol_proj_Projection_ from '../proj/Projection.js'; +import Projection from '../proj/Projection.js'; import Units from '../proj/Units.js'; var _ol_proj_EPSG4326_ = {}; @@ -22,7 +22,7 @@ var _ol_proj_EPSG4326_ = {}; * @private */ _ol_proj_EPSG4326_.Projection_ = function(code, opt_axisOrientation) { - _ol_proj_Projection_.call(this, { + Projection.call(this, { code: code, units: Units.DEGREES, extent: _ol_proj_EPSG4326_.EXTENT, @@ -32,7 +32,7 @@ _ol_proj_EPSG4326_.Projection_ = function(code, opt_axisOrientation) { worldExtent: _ol_proj_EPSG4326_.EXTENT }); }; -inherits(_ol_proj_EPSG4326_.Projection_, _ol_proj_Projection_); +inherits(_ol_proj_EPSG4326_.Projection_, Projection); /** diff --git a/src/ol/proj/Projection.js b/src/ol/proj/Projection.js index 08df01e4c1..75b6a916d0 100644 --- a/src/ol/proj/Projection.js +++ b/src/ol/proj/Projection.js @@ -33,7 +33,7 @@ import Units from '../proj/Units.js'; * @struct * @api */ -var _ol_proj_Projection_ = function(options) { +var Projection = function(options) { /** * @private * @type {string} @@ -110,7 +110,7 @@ var _ol_proj_Projection_ = function(options) { /** * @return {boolean} The projection is suitable for wrapping the x-axis */ -_ol_proj_Projection_.prototype.canWrapX = function() { +Projection.prototype.canWrapX = function() { return this.canWrapX_; }; @@ -120,7 +120,7 @@ _ol_proj_Projection_.prototype.canWrapX = function() { * @return {string} Code. * @api */ -_ol_proj_Projection_.prototype.getCode = function() { +Projection.prototype.getCode = function() { return this.code_; }; @@ -130,7 +130,7 @@ _ol_proj_Projection_.prototype.getCode = function() { * @return {ol.Extent} Extent. * @api */ -_ol_proj_Projection_.prototype.getExtent = function() { +Projection.prototype.getExtent = function() { return this.extent_; }; @@ -140,7 +140,7 @@ _ol_proj_Projection_.prototype.getExtent = function() { * @return {ol.proj.Units} Units. * @api */ -_ol_proj_Projection_.prototype.getUnits = function() { +Projection.prototype.getUnits = function() { return this.units_; }; @@ -152,7 +152,7 @@ _ol_proj_Projection_.prototype.getUnits = function() { * @return {number|undefined} Meters. * @api */ -_ol_proj_Projection_.prototype.getMetersPerUnit = function() { +Projection.prototype.getMetersPerUnit = function() { return this.metersPerUnit_ || Units.METERS_PER_UNIT[this.units_]; }; @@ -162,7 +162,7 @@ _ol_proj_Projection_.prototype.getMetersPerUnit = function() { * @return {ol.Extent} Extent. * @api */ -_ol_proj_Projection_.prototype.getWorldExtent = function() { +Projection.prototype.getWorldExtent = function() { return this.worldExtent_; }; @@ -178,7 +178,7 @@ _ol_proj_Projection_.prototype.getWorldExtent = function() { * @return {string} Axis orientation. * @api */ -_ol_proj_Projection_.prototype.getAxisOrientation = function() { +Projection.prototype.getAxisOrientation = function() { return this.axisOrientation_; }; @@ -188,7 +188,7 @@ _ol_proj_Projection_.prototype.getAxisOrientation = function() { * @return {boolean} Whether the projection is global. * @api */ -_ol_proj_Projection_.prototype.isGlobal = function() { +Projection.prototype.isGlobal = function() { return this.global_; }; @@ -198,7 +198,7 @@ _ol_proj_Projection_.prototype.isGlobal = function() { * @param {boolean} global Whether the projection is global. * @api */ -_ol_proj_Projection_.prototype.setGlobal = function(global) { +Projection.prototype.setGlobal = function(global) { this.global_ = global; this.canWrapX_ = !!(global && this.extent_); }; @@ -207,7 +207,7 @@ _ol_proj_Projection_.prototype.setGlobal = function(global) { /** * @return {ol.tilegrid.TileGrid} The default tile grid. */ -_ol_proj_Projection_.prototype.getDefaultTileGrid = function() { +Projection.prototype.getDefaultTileGrid = function() { return this.defaultTileGrid_; }; @@ -215,7 +215,7 @@ _ol_proj_Projection_.prototype.getDefaultTileGrid = function() { /** * @param {ol.tilegrid.TileGrid} tileGrid The default tile grid. */ -_ol_proj_Projection_.prototype.setDefaultTileGrid = function(tileGrid) { +Projection.prototype.setDefaultTileGrid = function(tileGrid) { this.defaultTileGrid_ = tileGrid; }; @@ -225,7 +225,7 @@ _ol_proj_Projection_.prototype.setDefaultTileGrid = function(tileGrid) { * @param {ol.Extent} extent Extent. * @api */ -_ol_proj_Projection_.prototype.setExtent = function(extent) { +Projection.prototype.setExtent = function(extent) { this.extent_ = extent; this.canWrapX_ = !!(this.global_ && extent); }; @@ -237,7 +237,7 @@ _ol_proj_Projection_.prototype.setExtent = function(extent) { * [minlon, minlat, maxlon, maxlat]. * @api */ -_ol_proj_Projection_.prototype.setWorldExtent = function(worldExtent) { +Projection.prototype.setWorldExtent = function(worldExtent) { this.worldExtent_ = worldExtent; }; @@ -248,7 +248,7 @@ _ol_proj_Projection_.prototype.setWorldExtent = function(worldExtent) { * @param {function(number, ol.Coordinate):number} func Function * @api */ -_ol_proj_Projection_.prototype.setGetPointResolution = function(func) { +Projection.prototype.setGetPointResolution = function(func) { this.getPointResolutionFunc_ = func; }; @@ -258,7 +258,7 @@ _ol_proj_Projection_.prototype.setGetPointResolution = function(func) { * @return {function(number, ol.Coordinate):number|undefined} The custom point * resolution function (if set). */ -_ol_proj_Projection_.prototype.getPointResolutionFunc = function() { +Projection.prototype.getPointResolutionFunc = function() { return this.getPointResolutionFunc_; }; -export default _ol_proj_Projection_; +export default Projection; diff --git a/src/ol/render.js b/src/ol/render.js index 57819793b1..7218cbe81a 100644 --- a/src/ol/render.js +++ b/src/ol/render.js @@ -3,7 +3,7 @@ */ import _ol_has_ from './has.js'; import _ol_transform_ from './transform.js'; -import _ol_render_canvas_Immediate_ from './render/canvas/Immediate.js'; +import CanvasImmediateRenderer from './render/canvas/Immediate.js'; var _ol_render_ = {}; @@ -40,7 +40,7 @@ _ol_render_.toContext = function(context, opt_options) { } var extent = [0, 0, canvas.width, canvas.height]; var transform = _ol_transform_.scale(_ol_transform_.create(), pixelRatio, pixelRatio); - return new _ol_render_canvas_Immediate_(context, pixelRatio, extent, transform, + return new CanvasImmediateRenderer(context, pixelRatio, extent, transform, 0); }; export default _ol_render_; diff --git a/src/ol/render/Event.js b/src/ol/render/Event.js index 12d7d0eee2..ce8f075264 100644 --- a/src/ol/render/Event.js +++ b/src/ol/render/Event.js @@ -14,7 +14,7 @@ import Event from '../events/Event.js'; * @param {?CanvasRenderingContext2D=} opt_context Context. * @param {?ol.webgl.Context=} opt_glContext WebGL Context. */ -var _ol_render_Event_ = function( +var RenderEvent = function( type, opt_vectorContext, opt_frameState, opt_context, opt_glContext) { @@ -52,5 +52,5 @@ var _ol_render_Event_ = function( }; -inherits(_ol_render_Event_, Event); -export default _ol_render_Event_; +inherits(RenderEvent, Event); +export default RenderEvent; diff --git a/src/ol/render/Feature.js b/src/ol/render/Feature.js index eb09044de8..c129fa8653 100644 --- a/src/ol/render/Feature.js +++ b/src/ol/render/Feature.js @@ -24,7 +24,7 @@ import _ol_transform_ from '../transform.js'; * @param {Object.} properties Properties. * @param {number|string|undefined} id Feature id. */ -var _ol_render_Feature_ = function(type, flatCoordinates, ends, properties, id) { +var RenderFeature = function(type, flatCoordinates, ends, properties, id) { /** * @private * @type {ol.Extent|undefined} @@ -88,7 +88,7 @@ var _ol_render_Feature_ = function(type, flatCoordinates, ends, properties, id) * @return {*} Value for the requested key. * @api */ -_ol_render_Feature_.prototype.get = function(key) { +RenderFeature.prototype.get = function(key) { return this.properties_[key]; }; @@ -96,8 +96,8 @@ _ol_render_Feature_.prototype.get = function(key) { /** * @return {Array.|Array.>} Ends or endss. */ -_ol_render_Feature_.prototype.getEnds = -_ol_render_Feature_.prototype.getEndss = function() { +RenderFeature.prototype.getEnds = +RenderFeature.prototype.getEndss = function() { return this.ends_; }; @@ -107,7 +107,7 @@ _ol_render_Feature_.prototype.getEndss = function() { * @return {ol.Extent} Extent. * @api */ -_ol_render_Feature_.prototype.getExtent = function() { +RenderFeature.prototype.getExtent = function() { if (!this.extent_) { this.extent_ = this.type_ === GeometryType.POINT ? createOrUpdateFromCoordinate(this.flatCoordinates_) : @@ -122,7 +122,7 @@ _ol_render_Feature_.prototype.getExtent = function() { /** * @return {Array.} Flat interior points. */ -_ol_render_Feature_.prototype.getFlatInteriorPoint = function() { +RenderFeature.prototype.getFlatInteriorPoint = function() { if (!this.flatInteriorPoints_) { var flatCenter = getCenter(this.getExtent()); this.flatInteriorPoints_ = _ol_geom_flat_interiorpoint_.linearRings( @@ -135,7 +135,7 @@ _ol_render_Feature_.prototype.getFlatInteriorPoint = function() { /** * @return {Array.} Flat interior points. */ -_ol_render_Feature_.prototype.getFlatInteriorPoints = function() { +RenderFeature.prototype.getFlatInteriorPoints = function() { if (!this.flatInteriorPoints_) { var flatCenters = _ol_geom_flat_center_.linearRingss( this.flatCoordinates_, 0, this.ends_, 2); @@ -149,7 +149,7 @@ _ol_render_Feature_.prototype.getFlatInteriorPoints = function() { /** * @return {Array.} Flat midpoint. */ -_ol_render_Feature_.prototype.getFlatMidpoint = function() { +RenderFeature.prototype.getFlatMidpoint = function() { if (!this.flatMidpoints_) { this.flatMidpoints_ = _ol_geom_flat_interpolate_.lineString( this.flatCoordinates_, 0, this.flatCoordinates_.length, 2, 0.5); @@ -161,7 +161,7 @@ _ol_render_Feature_.prototype.getFlatMidpoint = function() { /** * @return {Array.} Flat midpoints. */ -_ol_render_Feature_.prototype.getFlatMidpoints = function() { +RenderFeature.prototype.getFlatMidpoints = function() { if (!this.flatMidpoints_) { this.flatMidpoints_ = []; var flatCoordinates = this.flatCoordinates_; @@ -184,7 +184,7 @@ _ol_render_Feature_.prototype.getFlatMidpoints = function() { * @return {number|string|undefined} Id. * @api */ -_ol_render_Feature_.prototype.getId = function() { +RenderFeature.prototype.getId = function() { return this.id_; }; @@ -192,7 +192,7 @@ _ol_render_Feature_.prototype.getId = function() { /** * @return {Array.} Flat coordinates. */ -_ol_render_Feature_.prototype.getOrientedFlatCoordinates = function() { +RenderFeature.prototype.getOrientedFlatCoordinates = function() { return this.flatCoordinates_; }; @@ -200,8 +200,8 @@ _ol_render_Feature_.prototype.getOrientedFlatCoordinates = function() { /** * @return {Array.} Flat coordinates. */ -_ol_render_Feature_.prototype.getFlatCoordinates = - _ol_render_Feature_.prototype.getOrientedFlatCoordinates; +RenderFeature.prototype.getFlatCoordinates = + RenderFeature.prototype.getOrientedFlatCoordinates; /** @@ -210,7 +210,7 @@ _ol_render_Feature_.prototype.getFlatCoordinates = * @return {ol.render.Feature} Feature. * @api */ -_ol_render_Feature_.prototype.getGeometry = function() { +RenderFeature.prototype.getGeometry = function() { return this; }; @@ -220,7 +220,7 @@ _ol_render_Feature_.prototype.getGeometry = function() { * @return {Object.} Feature properties. * @api */ -_ol_render_Feature_.prototype.getProperties = function() { +RenderFeature.prototype.getProperties = function() { return this.properties_; }; @@ -229,14 +229,14 @@ _ol_render_Feature_.prototype.getProperties = function() { * Get the feature for working with its geometry. * @return {ol.render.Feature} Feature. */ -_ol_render_Feature_.prototype.getSimplifiedGeometry = - _ol_render_Feature_.prototype.getGeometry; +RenderFeature.prototype.getSimplifiedGeometry = + RenderFeature.prototype.getGeometry; /** * @return {number} Stride. */ -_ol_render_Feature_.prototype.getStride = function() { +RenderFeature.prototype.getStride = function() { return 2; }; @@ -244,7 +244,7 @@ _ol_render_Feature_.prototype.getStride = function() { /** * @return {undefined} */ -_ol_render_Feature_.prototype.getStyleFunction = nullFunction; +RenderFeature.prototype.getStyleFunction = nullFunction; /** @@ -252,7 +252,7 @@ _ol_render_Feature_.prototype.getStyleFunction = nullFunction; * @return {ol.geom.GeometryType} Geometry type. * @api */ -_ol_render_Feature_.prototype.getType = function() { +RenderFeature.prototype.getType = function() { return this.type_; }; @@ -263,7 +263,7 @@ _ol_render_Feature_.prototype.getType = function() { * @param {ol.ProjectionLike} source The current projection * @param {ol.ProjectionLike} destination The desired projection. */ -_ol_render_Feature_.prototype.transform = function(source, destination) { +RenderFeature.prototype.transform = function(source, destination) { var pixelExtent = source.getExtent(); var projectedExtent = source.getWorldExtent(); var scale = getHeight(projectedExtent) / getHeight(pixelExtent); @@ -275,4 +275,4 @@ _ol_render_Feature_.prototype.transform = function(source, destination) { _ol_geom_flat_transform_.transform2D(this.flatCoordinates_, 0, this.flatCoordinates_.length, 2, transform, this.flatCoordinates_); }; -export default _ol_render_Feature_; +export default RenderFeature; diff --git a/src/ol/render/canvas/Immediate.js b/src/ol/render/canvas/Immediate.js index 6492841c27..0bfea34b9e 100644 --- a/src/ol/render/canvas/Immediate.js +++ b/src/ol/render/canvas/Immediate.js @@ -35,7 +35,7 @@ import _ol_transform_ from '../../transform.js'; * @param {number} viewRotation View rotation. * @struct */ -var _ol_render_canvas_Immediate_ = function(context, pixelRatio, extent, transform, viewRotation) { +var CanvasImmediateRenderer = function(context, pixelRatio, extent, transform, viewRotation) { VectorContext.call(this); /** @@ -238,7 +238,7 @@ var _ol_render_canvas_Immediate_ = function(context, pixelRatio, extent, transfo }; -inherits(_ol_render_canvas_Immediate_, VectorContext); +inherits(CanvasImmediateRenderer, VectorContext); /** @@ -248,7 +248,7 @@ inherits(_ol_render_canvas_Immediate_, VectorContext); * @param {number} stride Stride. * @private */ -_ol_render_canvas_Immediate_.prototype.drawImages_ = function(flatCoordinates, offset, end, stride) { +CanvasImmediateRenderer.prototype.drawImages_ = function(flatCoordinates, offset, end, stride) { if (!this.image_) { return; } @@ -303,7 +303,7 @@ _ol_render_canvas_Immediate_.prototype.drawImages_ = function(flatCoordinates, o * @param {number} stride Stride. * @private */ -_ol_render_canvas_Immediate_.prototype.drawText_ = function(flatCoordinates, offset, end, stride) { +CanvasImmediateRenderer.prototype.drawText_ = function(flatCoordinates, offset, end, stride) { if (!this.textState_ || this.text_ === '') { return; } @@ -355,7 +355,7 @@ _ol_render_canvas_Immediate_.prototype.drawText_ = function(flatCoordinates, off * @private * @return {number} end End. */ -_ol_render_canvas_Immediate_.prototype.moveToLineTo_ = function(flatCoordinates, offset, end, stride, close) { +CanvasImmediateRenderer.prototype.moveToLineTo_ = function(flatCoordinates, offset, end, stride, close) { var context = this.context_; var pixelCoordinates = _ol_geom_flat_transform_.transform2D( flatCoordinates, offset, end, stride, this.transform_, @@ -383,7 +383,7 @@ _ol_render_canvas_Immediate_.prototype.moveToLineTo_ = function(flatCoordinates, * @private * @return {number} End. */ -_ol_render_canvas_Immediate_.prototype.drawRings_ = function(flatCoordinates, offset, ends, stride) { +CanvasImmediateRenderer.prototype.drawRings_ = function(flatCoordinates, offset, ends, stride) { var i, ii; for (i = 0, ii = ends.length; i < ii; ++i) { offset = this.moveToLineTo_( @@ -401,7 +401,7 @@ _ol_render_canvas_Immediate_.prototype.drawRings_ = function(flatCoordinates, of * @override * @api */ -_ol_render_canvas_Immediate_.prototype.drawCircle = function(geometry) { +CanvasImmediateRenderer.prototype.drawCircle = function(geometry) { if (!intersects(this.extent_, geometry.getExtent())) { return; } @@ -442,7 +442,7 @@ _ol_render_canvas_Immediate_.prototype.drawCircle = function(geometry) { * @override * @api */ -_ol_render_canvas_Immediate_.prototype.setStyle = function(style) { +CanvasImmediateRenderer.prototype.setStyle = function(style) { this.setFillStrokeStyle(style.getFill(), style.getStroke()); this.setImageStyle(style.getImage()); this.setTextStyle(style.getText()); @@ -457,7 +457,7 @@ _ol_render_canvas_Immediate_.prototype.setStyle = function(style) { * @override * @api */ -_ol_render_canvas_Immediate_.prototype.drawGeometry = function(geometry) { +CanvasImmediateRenderer.prototype.drawGeometry = function(geometry) { var type = geometry.getType(); switch (type) { case GeometryType.POINT: @@ -500,7 +500,7 @@ _ol_render_canvas_Immediate_.prototype.drawGeometry = function(geometry) { * @override * @api */ -_ol_render_canvas_Immediate_.prototype.drawFeature = function(feature, style) { +CanvasImmediateRenderer.prototype.drawFeature = function(feature, style) { var geometry = style.getGeometryFunction()(feature); if (!geometry || !intersects(this.extent_, geometry.getExtent())) { return; @@ -517,7 +517,7 @@ _ol_render_canvas_Immediate_.prototype.drawFeature = function(feature, style) { * @param {ol.geom.GeometryCollection} geometry Geometry collection. * @override */ -_ol_render_canvas_Immediate_.prototype.drawGeometryCollection = function(geometry) { +CanvasImmediateRenderer.prototype.drawGeometryCollection = function(geometry) { var geometries = geometry.getGeometriesArray(); var i, ii; for (i = 0, ii = geometries.length; i < ii; ++i) { @@ -533,7 +533,7 @@ _ol_render_canvas_Immediate_.prototype.drawGeometryCollection = function(geometr * @param {ol.geom.Point|ol.render.Feature} geometry Point geometry. * @override */ -_ol_render_canvas_Immediate_.prototype.drawPoint = function(geometry) { +CanvasImmediateRenderer.prototype.drawPoint = function(geometry) { var flatCoordinates = geometry.getFlatCoordinates(); var stride = geometry.getStride(); if (this.image_) { @@ -552,7 +552,7 @@ _ol_render_canvas_Immediate_.prototype.drawPoint = function(geometry) { * @param {ol.geom.MultiPoint|ol.render.Feature} geometry MultiPoint geometry. * @override */ -_ol_render_canvas_Immediate_.prototype.drawMultiPoint = function(geometry) { +CanvasImmediateRenderer.prototype.drawMultiPoint = function(geometry) { var flatCoordinates = geometry.getFlatCoordinates(); var stride = geometry.getStride(); if (this.image_) { @@ -571,7 +571,7 @@ _ol_render_canvas_Immediate_.prototype.drawMultiPoint = function(geometry) { * @param {ol.geom.LineString|ol.render.Feature} geometry LineString geometry. * @override */ -_ol_render_canvas_Immediate_.prototype.drawLineString = function(geometry) { +CanvasImmediateRenderer.prototype.drawLineString = function(geometry) { if (!intersects(this.extent_, geometry.getExtent())) { return; } @@ -599,7 +599,7 @@ _ol_render_canvas_Immediate_.prototype.drawLineString = function(geometry) { * geometry. * @override */ -_ol_render_canvas_Immediate_.prototype.drawMultiLineString = function(geometry) { +CanvasImmediateRenderer.prototype.drawMultiLineString = function(geometry) { var geometryExtent = geometry.getExtent(); if (!intersects(this.extent_, geometryExtent)) { return; @@ -633,7 +633,7 @@ _ol_render_canvas_Immediate_.prototype.drawMultiLineString = function(geometry) * @param {ol.geom.Polygon|ol.render.Feature} geometry Polygon geometry. * @override */ -_ol_render_canvas_Immediate_.prototype.drawPolygon = function(geometry) { +CanvasImmediateRenderer.prototype.drawPolygon = function(geometry) { if (!intersects(this.extent_, geometry.getExtent())) { return; } @@ -668,7 +668,7 @@ _ol_render_canvas_Immediate_.prototype.drawPolygon = function(geometry) { * @param {ol.geom.MultiPolygon} geometry MultiPolygon geometry. * @override */ -_ol_render_canvas_Immediate_.prototype.drawMultiPolygon = function(geometry) { +CanvasImmediateRenderer.prototype.drawMultiPolygon = function(geometry) { if (!intersects(this.extent_, geometry.getExtent())) { return; } @@ -708,7 +708,7 @@ _ol_render_canvas_Immediate_.prototype.drawMultiPolygon = function(geometry) { * @param {ol.CanvasFillState} fillState Fill state. * @private */ -_ol_render_canvas_Immediate_.prototype.setContextFillState_ = function(fillState) { +CanvasImmediateRenderer.prototype.setContextFillState_ = function(fillState) { var context = this.context_; var contextFillState = this.contextFillState_; if (!contextFillState) { @@ -728,7 +728,7 @@ _ol_render_canvas_Immediate_.prototype.setContextFillState_ = function(fillState * @param {ol.CanvasStrokeState} strokeState Stroke state. * @private */ -_ol_render_canvas_Immediate_.prototype.setContextStrokeState_ = function(strokeState) { +CanvasImmediateRenderer.prototype.setContextStrokeState_ = function(strokeState) { var context = this.context_; var contextStrokeState = this.contextStrokeState_; if (!contextStrokeState) { @@ -785,7 +785,7 @@ _ol_render_canvas_Immediate_.prototype.setContextStrokeState_ = function(strokeS * @param {ol.CanvasTextState} textState Text state. * @private */ -_ol_render_canvas_Immediate_.prototype.setContextTextState_ = function(textState) { +CanvasImmediateRenderer.prototype.setContextTextState_ = function(textState) { var context = this.context_; var contextTextState = this.contextTextState_; var textAlign = textState.textAlign ? @@ -822,7 +822,7 @@ _ol_render_canvas_Immediate_.prototype.setContextTextState_ = function(textState * @param {ol.style.Stroke} strokeStyle Stroke style. * @override */ -_ol_render_canvas_Immediate_.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) { +CanvasImmediateRenderer.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) { if (!fillStyle) { this.fillState_ = null; } else { @@ -869,7 +869,7 @@ _ol_render_canvas_Immediate_.prototype.setFillStrokeStyle = function(fillStyle, * @param {ol.style.Image} imageStyle Image style. * @override */ -_ol_render_canvas_Immediate_.prototype.setImageStyle = function(imageStyle) { +CanvasImmediateRenderer.prototype.setImageStyle = function(imageStyle) { if (!imageStyle) { this.image_ = null; } else { @@ -901,7 +901,7 @@ _ol_render_canvas_Immediate_.prototype.setImageStyle = function(imageStyle) { * @param {ol.style.Text} textStyle Text style. * @override */ -_ol_render_canvas_Immediate_.prototype.setTextStyle = function(textStyle) { +CanvasImmediateRenderer.prototype.setTextStyle = function(textStyle) { if (!textStyle) { this.text_ = ''; } else { @@ -971,4 +971,4 @@ _ol_render_canvas_Immediate_.prototype.setTextStyle = function(textStyle) { textScale : 1); } }; -export default _ol_render_canvas_Immediate_; +export default CanvasImmediateRenderer; diff --git a/src/ol/render/webgl/PolygonReplay.js b/src/ol/render/webgl/PolygonReplay.js index 494d58833b..8d3bfad1f9 100644 --- a/src/ol/render/webgl/PolygonReplay.js +++ b/src/ol/render/webgl/PolygonReplay.js @@ -14,7 +14,7 @@ import _ol_render_webgl_polygonreplay_defaultshader_Locations_ from '../webgl/po import _ol_render_webgl_LineStringReplay_ from '../webgl/LineStringReplay.js'; import _ol_render_webgl_Replay_ from '../webgl/Replay.js'; import _ol_render_webgl_ from '../webgl.js'; -import _ol_style_Stroke_ from '../../style/Stroke.js'; +import Stroke from '../../style/Stroke.js'; import LinkedList from '../../structs/LinkedList.js'; import RBush from '../../structs/RBush.js'; import _ol_webgl_ from '../../webgl.js'; @@ -1063,7 +1063,7 @@ _ol_render_webgl_PolygonReplay_.prototype.setFillStrokeStyle = function(fillStyl if (strokeStyle) { this.lineStringReplay.setFillStrokeStyle(null, strokeStyle); } else { - var nullStrokeStyle = new _ol_style_Stroke_({ + var nullStrokeStyle = new Stroke({ color: [0, 0, 0, 0], lineWidth: 0 }); diff --git a/src/ol/render/webgl/TextReplay.js b/src/ol/render/webgl/TextReplay.js index f83e51b2db..c83e2bb11f 100644 --- a/src/ol/render/webgl/TextReplay.js +++ b/src/ol/render/webgl/TextReplay.js @@ -9,7 +9,7 @@ import _ol_has_ from '../../has.js'; import _ol_render_replay_ from '../replay.js'; import _ol_render_webgl_ from '../webgl.js'; import _ol_render_webgl_TextureReplay_ from '../webgl/TextureReplay.js'; -import _ol_style_AtlasManager_ from '../../style/AtlasManager.js'; +import AtlasManager from '../../style/AtlasManager.js'; import _ol_webgl_Buffer_ from '../../webgl/Buffer.js'; /** @@ -421,7 +421,7 @@ _ol_render_webgl_TextReplay_.prototype.getAtlas_ = function(state) { state.lineWidth / 2) * state.scale); this.atlases_[hash] = { - atlas: new _ol_style_AtlasManager_({ + atlas: new AtlasManager({ space: state.lineWidth + 1 }), width: {}, diff --git a/src/ol/renderer/Map.js b/src/ol/renderer/Map.js index 7bceace145..fc3956f357 100644 --- a/src/ol/renderer/Map.js +++ b/src/ol/renderer/Map.js @@ -7,7 +7,7 @@ import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {getWidth} from '../extent.js'; import {TRUE} from '../functions.js'; -import _ol_layer_Layer_ from '../layer/Layer.js'; +import Layer from '../layer/Layer.js'; import {getLayerRendererPlugins} from '../plugins.js'; import {iconImageCache} from '../style.js'; import _ol_transform_ from '../transform.js'; @@ -141,7 +141,7 @@ MapRenderer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameSta for (i = numLayers - 1; i >= 0; --i) { var layerState = layerStates[i]; var layer = layerState.layer; - if (_ol_layer_Layer_.visibleAtResolution(layerState, viewResolution) && + if (Layer.visibleAtResolution(layerState, viewResolution) && layerFilter.call(thisArg2, layer)) { var layerRenderer = this.getLayerRenderer(layer); if (layer.getSource()) { diff --git a/src/ol/renderer/canvas/ImageLayer.js b/src/ol/renderer/canvas/ImageLayer.js index b0bb994192..84e04f9e68 100644 --- a/src/ol/renderer/canvas/ImageLayer.js +++ b/src/ol/renderer/canvas/ImageLayer.js @@ -12,7 +12,7 @@ import _ol_layer_VectorRenderType_ from '../../layer/VectorRenderType.js'; import _ol_obj_ from '../../obj.js'; import {getLayerRendererPlugins} from '../../plugins.js'; import RendererType from '../Type.js'; -import _ol_renderer_canvas_IntermediateCanvas_ from '../canvas/IntermediateCanvas.js'; +import IntermediateCanvasRenderer from '../canvas/IntermediateCanvas.js'; import _ol_transform_ from '../../transform.js'; /** @@ -23,7 +23,7 @@ import _ol_transform_ from '../../transform.js'; */ var CanvasImageLayerRenderer = function(imageLayer) { - _ol_renderer_canvas_IntermediateCanvas_.call(this, imageLayer); + IntermediateCanvasRenderer.call(this, imageLayer); /** * @private @@ -50,7 +50,7 @@ var CanvasImageLayerRenderer = function(imageLayer) { }; -inherits(CanvasImageLayerRenderer, _ol_renderer_canvas_IntermediateCanvas_); +inherits(CanvasImageLayerRenderer, IntermediateCanvasRenderer); /** @@ -201,7 +201,7 @@ CanvasImageLayerRenderer.prototype.forEachFeatureAtCoordinate = function(coordin if (this.vectorRenderer_) { return this.vectorRenderer_.forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, thisArg); } else { - return _ol_renderer_canvas_IntermediateCanvas_.prototype.forEachFeatureAtCoordinate.call(this, coordinate, frameState, hitTolerance, callback, thisArg); + return IntermediateCanvasRenderer.prototype.forEachFeatureAtCoordinate.call(this, coordinate, frameState, hitTolerance, callback, thisArg); } }; diff --git a/src/ol/renderer/canvas/IntermediateCanvas.js b/src/ol/renderer/canvas/IntermediateCanvas.js index cb235d6ee4..a3f1827ddf 100644 --- a/src/ol/renderer/canvas/IntermediateCanvas.js +++ b/src/ol/renderer/canvas/IntermediateCanvas.js @@ -14,7 +14,7 @@ import _ol_transform_ from '../../transform.js'; * @extends {ol.renderer.canvas.Layer} * @param {ol.layer.Layer} layer Layer. */ -var _ol_renderer_canvas_IntermediateCanvas_ = function(layer) { +var IntermediateCanvasRenderer = function(layer) { CanvasLayerRenderer.call(this, layer); @@ -32,13 +32,13 @@ var _ol_renderer_canvas_IntermediateCanvas_ = function(layer) { }; -inherits(_ol_renderer_canvas_IntermediateCanvas_, CanvasLayerRenderer); +inherits(IntermediateCanvasRenderer, CanvasLayerRenderer); /** * @inheritDoc */ -_ol_renderer_canvas_IntermediateCanvas_.prototype.composeFrame = function(frameState, layerState, context) { +IntermediateCanvasRenderer.prototype.composeFrame = function(frameState, layerState, context) { this.preCompose(context, frameState); @@ -84,20 +84,20 @@ _ol_renderer_canvas_IntermediateCanvas_.prototype.composeFrame = function(frameS * @abstract * @return {HTMLCanvasElement|HTMLVideoElement|Image} Canvas. */ -_ol_renderer_canvas_IntermediateCanvas_.prototype.getImage = function() {}; +IntermediateCanvasRenderer.prototype.getImage = function() {}; /** * @abstract * @return {!ol.Transform} Image transform. */ -_ol_renderer_canvas_IntermediateCanvas_.prototype.getImageTransform = function() {}; +IntermediateCanvasRenderer.prototype.getImageTransform = function() {}; /** * @inheritDoc */ -_ol_renderer_canvas_IntermediateCanvas_.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg) { +IntermediateCanvasRenderer.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_canvas_IntermediateCanvas_.prototype.forEachFeatureAtCoordinate = f /** * @inheritDoc */ -_ol_renderer_canvas_IntermediateCanvas_.prototype.forEachLayerAtCoordinate = function(coordinate, frameState, callback, thisArg) { +IntermediateCanvasRenderer.prototype.forEachLayerAtCoordinate = function(coordinate, frameState, callback, thisArg) { if (!this.getImage()) { return undefined; } @@ -146,4 +146,4 @@ _ol_renderer_canvas_IntermediateCanvas_.prototype.forEachLayerAtCoordinate = fun } } }; -export default _ol_renderer_canvas_IntermediateCanvas_; +export default IntermediateCanvasRenderer; diff --git a/src/ol/renderer/canvas/Layer.js b/src/ol/renderer/canvas/Layer.js index d623ed3556..52b9c5c723 100644 --- a/src/ol/renderer/canvas/Layer.js +++ b/src/ol/renderer/canvas/Layer.js @@ -4,10 +4,10 @@ import {inherits} from '../../index.js'; import {getBottomLeft, getBottomRight, getTopLeft, getTopRight} from '../../extent.js'; import {TRUE} from '../../functions.js'; -import _ol_render_Event_ from '../../render/Event.js'; +import RenderEvent from '../../render/Event.js'; import RenderEventType from '../../render/EventType.js'; import _ol_render_canvas_ from '../../render/canvas.js'; -import _ol_render_canvas_Immediate_ from '../../render/canvas/Immediate.js'; +import CanvasImmediateRenderer from '../../render/canvas/Immediate.js'; import LayerRenderer from '../Layer.js'; import _ol_transform_ from '../../transform.js'; @@ -87,10 +87,10 @@ CanvasLayerRenderer.prototype.dispatchComposeEvent_ = function(type, context, fr _ol_render_canvas_.rotateAtOffset(context, -rotation, width / 2, height / 2); var transform = opt_transform !== undefined ? opt_transform : this.getTransform(frameState, 0); - var render = new _ol_render_canvas_Immediate_( + var render = new CanvasImmediateRenderer( context, frameState.pixelRatio, frameState.extent, transform, frameState.viewState.rotation); - var composeEvent = new _ol_render_Event_(type, render, frameState, + var composeEvent = new RenderEvent(type, render, frameState, context, null); layer.dispatchEvent(composeEvent); _ol_render_canvas_.rotateAtOffset(context, rotation, width / 2, height / 2); diff --git a/src/ol/renderer/canvas/Map.js b/src/ol/renderer/canvas/Map.js index d98e2ad810..eea47a7186 100644 --- a/src/ol/renderer/canvas/Map.js +++ b/src/ol/renderer/canvas/Map.js @@ -8,11 +8,11 @@ import {inherits} from '../../index.js'; import {stableSort} from '../../array.js'; import {CLASS_UNSELECTABLE} from '../../css.js'; import {createCanvasContext2D} from '../../dom.js'; -import _ol_layer_Layer_ from '../../layer/Layer.js'; -import _ol_render_Event_ from '../../render/Event.js'; +import Layer from '../../layer/Layer.js'; +import RenderEvent from '../../render/Event.js'; import RenderEventType from '../../render/EventType.js'; import _ol_render_canvas_ from '../../render/canvas.js'; -import _ol_render_canvas_Immediate_ from '../../render/canvas/Immediate.js'; +import CanvasImmediateRenderer from '../../render/canvas/Immediate.js'; import MapRenderer from '../Map.js'; import RendererType from '../Type.js'; import SourceState from '../../source/State.js'; @@ -100,9 +100,9 @@ CanvasMapRenderer.prototype.dispatchComposeEvent_ = function(type, frameState) { var transform = this.getTransform(frameState); - var vectorContext = new _ol_render_canvas_Immediate_(context, pixelRatio, + var vectorContext = new CanvasImmediateRenderer(context, pixelRatio, extent, transform, rotation); - var composeEvent = new _ol_render_Event_(type, vectorContext, + var composeEvent = new RenderEvent(type, vectorContext, frameState, context, null); map.dispatchEvent(composeEvent); } @@ -179,7 +179,7 @@ CanvasMapRenderer.prototype.renderFrame = function(frameState) { layerState = layerStatesArray[i]; layer = layerState.layer; layerRenderer = /** @type {ol.renderer.canvas.Layer} */ (this.getLayerRenderer(layer)); - if (!_ol_layer_Layer_.visibleAtResolution(layerState, viewResolution) || + if (!Layer.visibleAtResolution(layerState, viewResolution) || layerState.sourceState != SourceState.READY) { continue; } @@ -223,7 +223,7 @@ CanvasMapRenderer.prototype.forEachLayerAtPixel = function(pixel, frameState, ca for (i = numLayers - 1; i >= 0; --i) { var layerState = layerStates[i]; var layer = layerState.layer; - if (_ol_layer_Layer_.visibleAtResolution(layerState, viewResolution) && + if (Layer.visibleAtResolution(layerState, viewResolution) && layerFilter.call(thisArg2, layer)) { var layerRenderer = /** @type {ol.renderer.canvas.Layer} */ (this.getLayerRenderer(layer)); result = layerRenderer.forEachLayerAtCoordinate( diff --git a/src/ol/renderer/canvas/TileLayer.js b/src/ol/renderer/canvas/TileLayer.js index df933c1e10..b848a5b6b6 100644 --- a/src/ol/renderer/canvas/TileLayer.js +++ b/src/ol/renderer/canvas/TileLayer.js @@ -9,7 +9,7 @@ import ViewHint from '../../ViewHint.js'; import {createCanvasContext2D} from '../../dom.js'; import {containsExtent, createEmpty, equals, getIntersection, isEmpty} from '../../extent.js'; import RendererType from '../Type.js'; -import _ol_renderer_canvas_IntermediateCanvas_ from '../canvas/IntermediateCanvas.js'; +import IntermediateCanvasRenderer from '../canvas/IntermediateCanvas.js'; import _ol_transform_ from '../../transform.js'; /** @@ -20,7 +20,7 @@ import _ol_transform_ from '../../transform.js'; */ var CanvasTileLayerRenderer = function(tileLayer) { - _ol_renderer_canvas_IntermediateCanvas_.call(this, tileLayer); + IntermediateCanvasRenderer.call(this, tileLayer); /** * @protected @@ -78,7 +78,7 @@ var CanvasTileLayerRenderer = function(tileLayer) { }; -inherits(CanvasTileLayerRenderer, _ol_renderer_canvas_IntermediateCanvas_); +inherits(CanvasTileLayerRenderer, IntermediateCanvasRenderer); /** diff --git a/src/ol/renderer/webgl/Layer.js b/src/ol/renderer/webgl/Layer.js index 639af5b1ad..31ea973144 100644 --- a/src/ol/renderer/webgl/Layer.js +++ b/src/ol/renderer/webgl/Layer.js @@ -2,7 +2,7 @@ * @module ol/renderer/webgl/Layer */ import {inherits} from '../../index.js'; -import _ol_render_Event_ from '../../render/Event.js'; +import RenderEvent from '../../render/Event.js'; import RenderEventType from '../../render/EventType.js'; import _ol_render_webgl_Immediate_ from '../../render/webgl/Immediate.js'; import LayerRenderer from '../Layer.js'; @@ -202,7 +202,7 @@ WebGLLayerRenderer.prototype.dispatchComposeEvent_ = function(type, context, fra var render = new _ol_render_webgl_Immediate_( context, center, resolution, rotation, size, extent, pixelRatio); - var composeEvent = new _ol_render_Event_( + var composeEvent = new RenderEvent( type, render, frameState, null, context); layer.dispatchEvent(composeEvent); } diff --git a/src/ol/renderer/webgl/Map.js b/src/ol/renderer/webgl/Map.js index 4d11bcb810..6e58c1ba97 100644 --- a/src/ol/renderer/webgl/Map.js +++ b/src/ol/renderer/webgl/Map.js @@ -8,8 +8,8 @@ import {CLASS_UNSELECTABLE} from '../../css.js'; import {createCanvasContext2D} from '../../dom.js'; import _ol_events_ from '../../events.js'; import _ol_has_ from '../../has.js'; -import _ol_layer_Layer_ from '../../layer/Layer.js'; -import _ol_render_Event_ from '../../render/Event.js'; +import Layer from '../../layer/Layer.js'; +import RenderEvent from '../../render/Event.js'; import RenderEventType from '../../render/EventType.js'; import _ol_render_webgl_Immediate_ from '../../render/webgl/Immediate.js'; import MapRenderer from '../Map.js'; @@ -276,7 +276,7 @@ WebGLMapRenderer.prototype.dispatchComposeEvent_ = function(type, frameState) { var vectorContext = new _ol_render_webgl_Immediate_(context, center, resolution, rotation, size, extent, pixelRatio); - var composeEvent = new _ol_render_Event_(type, vectorContext, + var composeEvent = new RenderEvent(type, vectorContext, frameState, null, context); map.dispatchEvent(composeEvent); } @@ -449,7 +449,7 @@ WebGLMapRenderer.prototype.renderFrame = function(frameState) { var i, ii, layerRenderer, layerState; for (i = 0, ii = layerStatesArray.length; i < ii; ++i) { layerState = layerStatesArray[i]; - if (_ol_layer_Layer_.visibleAtResolution(layerState, viewResolution) && + if (Layer.visibleAtResolution(layerState, viewResolution) && layerState.sourceState == SourceState.READY) { layerRenderer = /** @type {ol.renderer.webgl.Layer} */ (this.getLayerRenderer(layerState.layer)); if (layerRenderer.prepareFrame(frameState, layerState, context)) { @@ -524,7 +524,7 @@ WebGLMapRenderer.prototype.forEachFeatureAtCoordinate = function(coordinate, fra for (i = numLayers - 1; i >= 0; --i) { var layerState = layerStates[i]; var layer = layerState.layer; - if (_ol_layer_Layer_.visibleAtResolution(layerState, viewState.resolution) && + if (Layer.visibleAtResolution(layerState, viewState.resolution) && layerFilter.call(thisArg2, layer)) { var layerRenderer = this.getLayerRenderer(layer); result = layerRenderer.forEachFeatureAtCoordinate( @@ -556,7 +556,7 @@ WebGLMapRenderer.prototype.hasFeatureAtCoordinate = function(coordinate, frameSt for (i = numLayers - 1; i >= 0; --i) { var layerState = layerStates[i]; var layer = layerState.layer; - if (_ol_layer_Layer_.visibleAtResolution(layerState, viewState.resolution) && + if (Layer.visibleAtResolution(layerState, viewState.resolution) && layerFilter.call(thisArg, layer)) { var layerRenderer = this.getLayerRenderer(layer); hasFeature = @@ -588,7 +588,7 @@ WebGLMapRenderer.prototype.forEachLayerAtPixel = function(pixel, frameState, cal for (i = numLayers - 1; i >= 0; --i) { var layerState = layerStates[i]; var layer = layerState.layer; - if (_ol_layer_Layer_.visibleAtResolution(layerState, viewState.resolution) && + if (Layer.visibleAtResolution(layerState, viewState.resolution) && layerFilter.call(thisArg, layer)) { var layerRenderer = /** @type {ol.renderer.webgl.Layer} */ (this.getLayerRenderer(layer)); result = layerRenderer.forEachLayerAtPixel( diff --git a/src/ol/reproj/Image.js b/src/ol/reproj/Image.js index a764964dda..69f418fd0d 100644 --- a/src/ol/reproj/Image.js +++ b/src/ol/reproj/Image.js @@ -9,7 +9,7 @@ import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {getCenter, getIntersection, getHeight, getWidth} from '../extent.js'; import _ol_reproj_ from '../reproj.js'; -import _ol_reproj_Triangulation_ from '../reproj/Triangulation.js'; +import Triangulation from '../reproj/Triangulation.js'; /** * @classdesc @@ -26,7 +26,7 @@ import _ol_reproj_Triangulation_ from '../reproj/Triangulation.js'; * @param {ol.ReprojImageFunctionType} getImageFunction * Function returning source images (extent, resolution, pixelRatio). */ -var _ol_reproj_Image_ = function(sourceProj, targetProj, +var ReprojImage = function(sourceProj, targetProj, targetExtent, targetResolution, pixelRatio, getImageFunction) { /** @@ -55,7 +55,7 @@ var _ol_reproj_Image_ = function(sourceProj, targetProj, * @private * @type {!ol.reproj.Triangulation} */ - this.triangulation_ = new _ol_reproj_Triangulation_( + this.triangulation_ = new Triangulation( sourceProj, targetProj, limitedTargetExtent, this.maxSourceExtent_, sourceResolution * errorThresholdInPixels); @@ -109,13 +109,13 @@ var _ol_reproj_Image_ = function(sourceProj, targetProj, _ol_ImageBase_.call(this, targetExtent, targetResolution, this.sourcePixelRatio_, state); }; -inherits(_ol_reproj_Image_, _ol_ImageBase_); +inherits(ReprojImage, _ol_ImageBase_); /** * @inheritDoc */ -_ol_reproj_Image_.prototype.disposeInternal = function() { +ReprojImage.prototype.disposeInternal = function() { if (this.state == ImageState.LOADING) { this.unlistenSource_(); } @@ -126,7 +126,7 @@ _ol_reproj_Image_.prototype.disposeInternal = function() { /** * @inheritDoc */ -_ol_reproj_Image_.prototype.getImage = function() { +ReprojImage.prototype.getImage = function() { return this.canvas_; }; @@ -134,7 +134,7 @@ _ol_reproj_Image_.prototype.getImage = function() { /** * @return {ol.proj.Projection} Projection. */ -_ol_reproj_Image_.prototype.getProjection = function() { +ReprojImage.prototype.getProjection = function() { return this.targetProj_; }; @@ -142,7 +142,7 @@ _ol_reproj_Image_.prototype.getProjection = function() { /** * @private */ -_ol_reproj_Image_.prototype.reproject_ = function() { +ReprojImage.prototype.reproject_ = function() { var sourceState = this.sourceImage_.getState(); if (sourceState == ImageState.LOADED) { var width = getWidth(this.targetExtent_) / this.targetResolution_; @@ -163,7 +163,7 @@ _ol_reproj_Image_.prototype.reproject_ = function() { /** * @inheritDoc */ -_ol_reproj_Image_.prototype.load = function() { +ReprojImage.prototype.load = function() { if (this.state == ImageState.IDLE) { this.state = ImageState.LOADING; this.changed(); @@ -189,8 +189,8 @@ _ol_reproj_Image_.prototype.load = function() { /** * @private */ -_ol_reproj_Image_.prototype.unlistenSource_ = function() { +ReprojImage.prototype.unlistenSource_ = function() { _ol_events_.unlistenByKey(/** @type {!ol.EventsKey} */ (this.sourceListenerKey_)); this.sourceListenerKey_ = null; }; -export default _ol_reproj_Image_; +export default ReprojImage; diff --git a/src/ol/reproj/Tile.js b/src/ol/reproj/Tile.js index 0875b9b30a..7567c0388b 100644 --- a/src/ol/reproj/Tile.js +++ b/src/ol/reproj/Tile.js @@ -3,14 +3,14 @@ */ import {ERROR_THRESHOLD} from './common.js'; import {inherits} from '../index.js'; -import _ol_Tile_ from '../Tile.js'; +import Tile from '../Tile.js'; import TileState from '../TileState.js'; import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {getArea, getCenter, getIntersection} from '../extent.js'; import {clamp} from '../math.js'; import _ol_reproj_ from '../reproj.js'; -import _ol_reproj_Triangulation_ from '../reproj/Triangulation.js'; +import Triangulation from '../reproj/Triangulation.js'; /** * @classdesc @@ -32,11 +32,11 @@ import _ol_reproj_Triangulation_ from '../reproj/Triangulation.js'; * @param {number=} opt_errorThreshold Acceptable reprojection error (in px). * @param {boolean=} opt_renderEdges Render reprojection edges. */ -var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid, +var ReprojTile = function(sourceProj, sourceTileGrid, targetProj, targetTileGrid, tileCoord, wrappedTileCoord, pixelRatio, gutter, getTileFunction, opt_errorThreshold, opt_renderEdges) { - _ol_Tile_.call(this, tileCoord, TileState.IDLE); + Tile.call(this, tileCoord, TileState.IDLE); /** * @private @@ -142,7 +142,7 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid, * @private * @type {!ol.reproj.Triangulation} */ - this.triangulation_ = new _ol_reproj_Triangulation_( + this.triangulation_ = new Triangulation( sourceProj, targetProj, limitedTargetExtent, maxSourceExtent, sourceResolution * errorThresholdInPixels); @@ -187,17 +187,17 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid, } }; -inherits(_ol_reproj_Tile_, _ol_Tile_); +inherits(ReprojTile, Tile); /** * @inheritDoc */ -_ol_reproj_Tile_.prototype.disposeInternal = function() { +ReprojTile.prototype.disposeInternal = function() { if (this.state == TileState.LOADING) { this.unlistenSources_(); } - _ol_Tile_.prototype.disposeInternal.call(this); + Tile.prototype.disposeInternal.call(this); }; @@ -205,7 +205,7 @@ _ol_reproj_Tile_.prototype.disposeInternal = function() { * Get the HTML Canvas element for this tile. * @return {HTMLCanvasElement} Canvas. */ -_ol_reproj_Tile_.prototype.getImage = function() { +ReprojTile.prototype.getImage = function() { return this.canvas_; }; @@ -213,7 +213,7 @@ _ol_reproj_Tile_.prototype.getImage = function() { /** * @private */ -_ol_reproj_Tile_.prototype.reproject_ = function() { +ReprojTile.prototype.reproject_ = function() { var sources = []; this.sourceTiles_.forEach(function(tile, i, arr) { if (tile && tile.getState() == TileState.LOADED) { @@ -251,7 +251,7 @@ _ol_reproj_Tile_.prototype.reproject_ = function() { /** * @inheritDoc */ -_ol_reproj_Tile_.prototype.load = function() { +ReprojTile.prototype.load = function() { if (this.state == TileState.IDLE) { this.state = TileState.LOADING; this.changed(); @@ -300,8 +300,8 @@ _ol_reproj_Tile_.prototype.load = function() { /** * @private */ -_ol_reproj_Tile_.prototype.unlistenSources_ = function() { +ReprojTile.prototype.unlistenSources_ = function() { this.sourcesListenerKeys_.forEach(_ol_events_.unlistenByKey); this.sourcesListenerKeys_ = null; }; -export default _ol_reproj_Tile_; +export default ReprojTile; diff --git a/src/ol/reproj/Triangulation.js b/src/ol/reproj/Triangulation.js index 6d552e9f2a..1635d872e0 100644 --- a/src/ol/reproj/Triangulation.js +++ b/src/ol/reproj/Triangulation.js @@ -41,7 +41,7 @@ var MAX_TRIANGLE_WIDTH = 0.25; * @param {number} errorThreshold Acceptable error (in source units). * @constructor */ -var _ol_reproj_Triangulation_ = function(sourceProj, targetProj, targetExtent, +var Triangulation = function(sourceProj, targetProj, targetExtent, maxSourceExtent, errorThreshold) { /** @@ -189,7 +189,7 @@ var _ol_reproj_Triangulation_ = function(sourceProj, targetProj, targetExtent, * @param {ol.Coordinate} cSrc The source c coordinate. * @private */ -_ol_reproj_Triangulation_.prototype.addTriangle_ = function(a, b, c, +Triangulation.prototype.addTriangle_ = function(a, b, c, aSrc, bSrc, cSrc) { this.triangles_.push({ source: [aSrc, bSrc, cSrc], @@ -214,7 +214,7 @@ _ol_reproj_Triangulation_.prototype.addTriangle_ = function(a, b, c, * @param {number} maxSubdivision Maximal allowed subdivision of the quad. * @private */ -_ol_reproj_Triangulation_.prototype.addQuad_ = function(a, b, c, d, +Triangulation.prototype.addQuad_ = function(a, b, c, d, aSrc, bSrc, cSrc, dSrc, maxSubdivision) { var sourceQuadExtent = boundingExtent([aSrc, bSrc, cSrc, dSrc]); @@ -326,7 +326,7 @@ _ol_reproj_Triangulation_.prototype.addQuad_ = function(a, b, c, d, * * @return {ol.Extent} Calculated extent. */ -_ol_reproj_Triangulation_.prototype.calculateSourceExtent = function() { +Triangulation.prototype.calculateSourceExtent = function() { var extent = createEmpty(); this.triangles_.forEach(function(triangle, i, arr) { @@ -343,7 +343,7 @@ _ol_reproj_Triangulation_.prototype.calculateSourceExtent = function() { /** * @return {Array.} Array of the calculated triangles. */ -_ol_reproj_Triangulation_.prototype.getTriangles = function() { +Triangulation.prototype.getTriangles = function() { return this.triangles_; }; -export default _ol_reproj_Triangulation_; +export default Triangulation; diff --git a/src/ol/source/Image.js b/src/ol/source/Image.js index cf7e354042..c96e424092 100644 --- a/src/ol/source/Image.js +++ b/src/ol/source/Image.js @@ -8,7 +8,7 @@ import {linearFindNearest} from '../array.js'; import Event from '../events/Event.js'; import {equals} from '../extent.js'; import {equivalent} from '../proj.js'; -import _ol_reproj_Image_ from '../reproj/Image.js'; +import ReprojImage from '../reproj/Image.js'; import Source from '../source/Source.js'; /** @@ -109,7 +109,7 @@ ImageSource.prototype.getImage = function(extent, resolution, pixelRatio, projec this.reprojectedImage_ = null; } - this.reprojectedImage_ = new _ol_reproj_Image_( + this.reprojectedImage_ = new ReprojImage( sourceProjection, projection, extent, resolution, pixelRatio, function(extent, resolution, pixelRatio) { return this.getImageInternal(extent, resolution, diff --git a/src/ol/source/TileDebug.js b/src/ol/source/TileDebug.js index e54627e3b3..4bbc08aff4 100644 --- a/src/ol/source/TileDebug.js +++ b/src/ol/source/TileDebug.js @@ -2,7 +2,7 @@ * @module ol/source/TileDebug */ import {inherits} from '../index.js'; -import _ol_Tile_ from '../Tile.js'; +import Tile from '../Tile.js'; import TileState from '../TileState.js'; import {createCanvasContext2D} from '../dom.js'; import _ol_size_ from '../size.js'; @@ -66,7 +66,7 @@ TileDebug.prototype.getTile = function(z, x, y) { */ TileDebug.Tile_ = function(tileCoord, tileSize, text) { - _ol_Tile_.call(this, tileCoord, TileState.LOADED); + Tile.call(this, tileCoord, TileState.LOADED); /** * @private @@ -87,7 +87,7 @@ TileDebug.Tile_ = function(tileCoord, tileSize, text) { this.canvas_ = null; }; -inherits(TileDebug.Tile_, _ol_Tile_); +inherits(TileDebug.Tile_, Tile); /** diff --git a/src/ol/source/TileImage.js b/src/ol/source/TileImage.js index 48756ce3a1..7c71e935a4 100644 --- a/src/ol/source/TileImage.js +++ b/src/ol/source/TileImage.js @@ -9,7 +9,7 @@ import TileState from '../TileState.js'; 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 ReprojTile from '../reproj/Tile.js'; import UrlTile from '../source/UrlTile.js'; import _ol_tilecoord_ from '../tilecoord.js'; import _ol_tilegrid_ from '../tilegrid.js'; @@ -254,7 +254,7 @@ TileImage.prototype.getTile = function(z, x, y, pixelRatio, projection) { var targetTileGrid = this.getTileGridForProjection(projection); var wrappedTileCoord = this.getTileCoordForTileUrlFunction(tileCoord, projection); - var newTile = new _ol_reproj_Tile_( + var newTile = new ReprojTile( sourceProjection, sourceTileGrid, projection, targetTileGrid, tileCoord, wrappedTileCoord, this.getTilePixelRatio(pixelRatio), diff --git a/src/ol/source/TileUTFGrid.js b/src/ol/source/TileUTFGrid.js index fd44237902..afe7effc42 100644 --- a/src/ol/source/TileUTFGrid.js +++ b/src/ol/source/TileUTFGrid.js @@ -2,7 +2,7 @@ * @module ol/source/TileUTFGrid */ import {inherits} from '../index.js'; -import _ol_Tile_ from '../Tile.js'; +import Tile from '../Tile.js'; import TileState from '../TileState.js'; import {createFromTemplates, nullTileUrlFunction} from '../tileurlfunction.js'; import {assert} from '../asserts.js'; @@ -259,7 +259,7 @@ UTFGrid.prototype.useTile = function(z, x, y) { */ UTFGrid.Tile_ = function(tileCoord, state, src, extent, preemptive, jsonp) { - _ol_Tile_.call(this, tileCoord, state); + Tile.call(this, tileCoord, state); /** * @private @@ -305,7 +305,7 @@ UTFGrid.Tile_ = function(tileCoord, state, src, extent, preemptive, jsonp) { this.jsonp_ = jsonp; }; -inherits(UTFGrid.Tile_, _ol_Tile_); +inherits(UTFGrid.Tile_, Tile); /** diff --git a/src/ol/source/Vector.js b/src/ol/source/Vector.js index 462e832c77..e2ff2799c3 100644 --- a/src/ol/source/Vector.js +++ b/src/ol/source/Vector.js @@ -3,7 +3,7 @@ */ import {getUid, inherits, nullFunction} from '../index.js'; -import _ol_Collection_ from '../Collection.js'; +import Collection from '../Collection.js'; import CollectionEventType from '../CollectionEventType.js'; import ObjectEventType from '../ObjectEventType.js'; import {extend} from '../array.js'; @@ -131,14 +131,14 @@ var VectorSource = function(opt_options) { this.featuresCollection_ = null; var collection, features; - if (options.features instanceof _ol_Collection_) { + if (options.features instanceof Collection) { collection = options.features; features = collection.getArray(); } else if (Array.isArray(options.features)) { features = options.features; } if (!useSpatialIndex && collection === undefined) { - collection = new _ol_Collection_(features); + collection = new Collection(features); } if (features !== undefined) { this.addFeaturesInternal(features); diff --git a/src/ol/style/Atlas.js b/src/ol/style/Atlas.js index b5932d59c1..7b0f802500 100644 --- a/src/ol/style/Atlas.js +++ b/src/ol/style/Atlas.js @@ -20,7 +20,7 @@ import {createCanvasContext2D} from '../dom.js'; * edges overlap when being rendered). To avoid this we add a * padding around each image. */ -var _ol_style_Atlas_ = function(size, space) { +var Atlas = function(size, space) { /** * @private @@ -58,7 +58,7 @@ var _ol_style_Atlas_ = function(size, space) { * @param {string} id The identifier of the entry to check. * @return {?ol.AtlasInfo} The atlas info. */ -_ol_style_Atlas_.prototype.get = function(id) { +Atlas.prototype.get = function(id) { return this.entries_[id] || null; }; @@ -73,7 +73,7 @@ _ol_style_Atlas_.prototype.get = function(id) { * `renderCallback`. * @return {?ol.AtlasInfo} The position and atlas image for the entry. */ -_ol_style_Atlas_.prototype.add = function(id, width, height, renderCallback, opt_this) { +Atlas.prototype.add = function(id, width, height, renderCallback, opt_this) { var block, i, ii; for (i = 0, ii = this.emptyBlocks_.length; i < ii; ++i) { block = this.emptyBlocks_[i]; @@ -110,7 +110,7 @@ _ol_style_Atlas_.prototype.add = function(id, width, height, renderCallback, opt * @param {number} width The width of the entry to insert. * @param {number} height The height of the entry to insert. */ -_ol_style_Atlas_.prototype.split_ = function(index, block, width, height) { +Atlas.prototype.split_ = function(index, block, width, height) { var deltaWidth = block.width - width; var deltaHeight = block.height - height; @@ -168,7 +168,7 @@ _ol_style_Atlas_.prototype.split_ = function(index, block, width, height) { * @param {ol.AtlasBlock} newBlock1 The 1st block to add. * @param {ol.AtlasBlock} newBlock2 The 2nd block to add. */ -_ol_style_Atlas_.prototype.updateBlocks_ = function(index, newBlock1, newBlock2) { +Atlas.prototype.updateBlocks_ = function(index, newBlock1, newBlock2) { var args = [index, 1]; if (newBlock1.width > 0 && newBlock1.height > 0) { args.push(newBlock1); @@ -178,4 +178,4 @@ _ol_style_Atlas_.prototype.updateBlocks_ = function(index, newBlock1, newBlock2) } this.emptyBlocks_.splice.apply(this.emptyBlocks_, args); }; -export default _ol_style_Atlas_; +export default Atlas; diff --git a/src/ol/style/AtlasManager.js b/src/ol/style/AtlasManager.js index 9d67ff1a2d..e281735e37 100644 --- a/src/ol/style/AtlasManager.js +++ b/src/ol/style/AtlasManager.js @@ -2,7 +2,7 @@ * @module ol/style/AtlasManager */ import {WEBGL_MAX_TEXTURE_SIZE, nullFunction} from '../index.js'; -import _ol_style_Atlas_ from '../style/Atlas.js'; +import Atlas from '../style/Atlas.js'; /** @@ -33,7 +33,7 @@ var MAX_ATLAS_SIZE = -1; * @api * @param {olx.style.AtlasManagerOptions=} opt_options Options. */ -var _ol_style_AtlasManager_ = function(opt_options) { +var AtlasManager = function(opt_options) { var options = opt_options || {}; @@ -66,7 +66,7 @@ var _ol_style_AtlasManager_ = function(opt_options) { * @private * @type {Array.} */ - this.atlases_ = [new _ol_style_Atlas_(this.currentSize_, this.space_)]; + this.atlases_ = [new Atlas(this.currentSize_, this.space_)]; /** * The size in pixels of the latest atlas image for hit-detection images. @@ -79,7 +79,7 @@ var _ol_style_AtlasManager_ = function(opt_options) { * @private * @type {Array.} */ - this.hitAtlases_ = [new _ol_style_Atlas_(this.currentHitSize_, this.space_)]; + this.hitAtlases_ = [new Atlas(this.currentHitSize_, this.space_)]; }; @@ -88,7 +88,7 @@ var _ol_style_AtlasManager_ = function(opt_options) { * @return {?ol.AtlasManagerInfo} The position and atlas image for the * entry, or `null` if the entry is not part of the atlas manager. */ -_ol_style_AtlasManager_.prototype.getInfo = function(id) { +AtlasManager.prototype.getInfo = function(id) { /** @type {?ol.AtlasInfo} */ var info = this.getInfo_(this.atlases_, id); @@ -108,7 +108,7 @@ _ol_style_AtlasManager_.prototype.getInfo = function(id) { * @return {?ol.AtlasInfo} The position and atlas image for the entry, * or `null` if the entry is not part of the atlases. */ -_ol_style_AtlasManager_.prototype.getInfo_ = function(atlases, id) { +AtlasManager.prototype.getInfo_ = function(atlases, id) { var atlas, info, i, ii; for (i = 0, ii = atlases.length; i < ii; ++i) { atlas = atlases[i]; @@ -129,7 +129,7 @@ _ol_style_AtlasManager_.prototype.getInfo_ = function(atlases, id) { * @return {?ol.AtlasManagerInfo} The position and atlas image for the * entry, or `null` if the entry is not part of the atlases. */ -_ol_style_AtlasManager_.prototype.mergeInfos_ = function(info, hitInfo) { +AtlasManager.prototype.mergeInfos_ = function(info, hitInfo) { return /** @type {ol.AtlasManagerInfo} */ ({ offsetX: info.offsetX, offsetY: info.offsetY, @@ -161,7 +161,7 @@ _ol_style_AtlasManager_.prototype.mergeInfos_ = function(info, hitInfo) { * @return {?ol.AtlasManagerInfo} The position and atlas image for the * entry, or `null` if the image is too big. */ -_ol_style_AtlasManager_.prototype.add = function(id, width, height, +AtlasManager.prototype.add = function(id, width, height, renderCallback, opt_renderHitCallback, opt_this) { if (width + this.space_ > this.maxSize_ || height + this.space_ > this.maxSize_) { @@ -201,7 +201,7 @@ _ol_style_AtlasManager_.prototype.add = function(id, width, height, * @return {?ol.AtlasInfo} The position and atlas image for the entry, * or `null` if the image is too big. */ -_ol_style_AtlasManager_.prototype.add_ = function(isHitAtlas, id, width, height, +AtlasManager.prototype.add_ = function(isHitAtlas, id, width, height, renderCallback, opt_this) { var atlases = (isHitAtlas) ? this.hitAtlases_ : this.atlases_; var atlas, info, i, ii; @@ -221,7 +221,7 @@ _ol_style_AtlasManager_.prototype.add_ = function(isHitAtlas, id, width, height, size = Math.min(this.currentSize_ * 2, this.maxSize_); this.currentSize_ = size; } - atlas = new _ol_style_Atlas_(size, this.space_); + atlas = new Atlas(size, this.space_); atlases.push(atlas); // run the loop another time ++ii; @@ -229,4 +229,4 @@ _ol_style_AtlasManager_.prototype.add_ = function(isHitAtlas, id, width, height, } return null; }; -export default _ol_style_AtlasManager_; +export default AtlasManager; diff --git a/src/ol/style/Circle.js b/src/ol/style/Circle.js index 3cb75c995a..992e8c3390 100644 --- a/src/ol/style/Circle.js +++ b/src/ol/style/Circle.js @@ -2,7 +2,7 @@ * @module ol/style/Circle */ import {inherits} from '../index.js'; -import _ol_style_RegularShape_ from '../style/RegularShape.js'; +import RegularShape from '../style/RegularShape.js'; /** * @classdesc @@ -13,11 +13,11 @@ import _ol_style_RegularShape_ from '../style/RegularShape.js'; * @extends {ol.style.RegularShape} * @api */ -var _ol_style_Circle_ = function(opt_options) { +var CircleStyle = function(opt_options) { var options = opt_options || {}; - _ol_style_RegularShape_.call(this, { + RegularShape.call(this, { points: Infinity, fill: options.fill, radius: options.radius, @@ -28,7 +28,7 @@ var _ol_style_Circle_ = function(opt_options) { }; -inherits(_ol_style_Circle_, _ol_style_RegularShape_); +inherits(CircleStyle, RegularShape); /** @@ -37,8 +37,8 @@ inherits(_ol_style_Circle_, _ol_style_RegularShape_); * @override * @api */ -_ol_style_Circle_.prototype.clone = function() { - var style = new _ol_style_Circle_({ +CircleStyle.prototype.clone = function() { + var style = new CircleStyle({ fill: this.getFill() ? this.getFill().clone() : undefined, stroke: this.getStroke() ? this.getStroke().clone() : undefined, radius: this.getRadius(), @@ -57,8 +57,8 @@ _ol_style_Circle_.prototype.clone = function() { * @param {number} radius Circle radius. * @api */ -_ol_style_Circle_.prototype.setRadius = function(radius) { +CircleStyle.prototype.setRadius = function(radius) { this.radius_ = radius; this.render_(this.atlasManager_); }; -export default _ol_style_Circle_; +export default CircleStyle; diff --git a/src/ol/style/Fill.js b/src/ol/style/Fill.js index ebf65facb5..30fa9d7316 100644 --- a/src/ol/style/Fill.js +++ b/src/ol/style/Fill.js @@ -12,7 +12,7 @@ import {asString} from '../color.js'; * @param {olx.style.FillOptions=} opt_options Options. * @api */ -var _ol_style_Fill_ = function(opt_options) { +var Fill = function(opt_options) { var options = opt_options || {}; @@ -35,9 +35,9 @@ var _ol_style_Fill_ = function(opt_options) { * @return {ol.style.Fill} The cloned style. * @api */ -_ol_style_Fill_.prototype.clone = function() { +Fill.prototype.clone = function() { var color = this.getColor(); - return new _ol_style_Fill_({ + return new Fill({ color: (color && color.slice) ? color.slice() : color || undefined }); }; @@ -48,7 +48,7 @@ _ol_style_Fill_.prototype.clone = function() { * @return {ol.Color|ol.ColorLike} Color. * @api */ -_ol_style_Fill_.prototype.getColor = function() { +Fill.prototype.getColor = function() { return this.color_; }; @@ -59,7 +59,7 @@ _ol_style_Fill_.prototype.getColor = function() { * @param {ol.Color|ol.ColorLike} color Color. * @api */ -_ol_style_Fill_.prototype.setColor = function(color) { +Fill.prototype.setColor = function(color) { this.color_ = color; this.checksum_ = undefined; }; @@ -68,7 +68,7 @@ _ol_style_Fill_.prototype.setColor = function(color) { /** * @return {string} The checksum. */ -_ol_style_Fill_.prototype.getChecksum = function() { +Fill.prototype.getChecksum = function() { if (this.checksum_ === undefined) { if ( this.color_ instanceof CanvasPattern || @@ -82,4 +82,4 @@ _ol_style_Fill_.prototype.getChecksum = function() { return this.checksum_; }; -export default _ol_style_Fill_; +export default Fill; diff --git a/src/ol/style/Icon.js b/src/ol/style/Icon.js index 5060248d73..8993a778bf 100644 --- a/src/ol/style/Icon.js +++ b/src/ol/style/Icon.js @@ -8,9 +8,9 @@ import {asArray} from '../color.js'; import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import IconAnchorUnits from '../style/IconAnchorUnits.js'; -import _ol_style_IconImage_ from '../style/IconImage.js'; +import IconImage from '../style/IconImage.js'; import IconOrigin from '../style/IconOrigin.js'; -import _ol_style_Image_ from '../style/Image.js'; +import ImageStyle from '../style/Image.js'; /** * @classdesc @@ -21,7 +21,7 @@ import _ol_style_Image_ from '../style/Image.js'; * @extends {ol.style.Image} * @api */ -var _ol_style_Icon_ = function(opt_options) { +var Icon = function(opt_options) { var options = opt_options || {}; @@ -107,7 +107,7 @@ var _ol_style_Icon_ = function(opt_options) { * @private * @type {ol.style.IconImage} */ - this.iconImage_ = _ol_style_IconImage_.get( + this.iconImage_ = IconImage.get( image, /** @type {string} */ (src), imgSize, this.crossOrigin_, imageState, this.color_); /** @@ -162,7 +162,7 @@ var _ol_style_Icon_ = function(opt_options) { var snapToPixel = options.snapToPixel !== undefined ? options.snapToPixel : true; - _ol_style_Image_.call(this, { + ImageStyle.call(this, { opacity: opacity, rotation: rotation, scale: scale, @@ -172,7 +172,7 @@ var _ol_style_Icon_ = function(opt_options) { }; -inherits(_ol_style_Icon_, _ol_style_Image_); +inherits(Icon, ImageStyle); /** @@ -180,8 +180,8 @@ inherits(_ol_style_Icon_, _ol_style_Image_); * @return {ol.style.Icon} The cloned style. * @api */ -_ol_style_Icon_.prototype.clone = function() { - return new _ol_style_Icon_({ +Icon.prototype.clone = function() { + return new Icon({ anchor: this.anchor_.slice(), anchorOrigin: this.anchorOrigin_, anchorXUnits: this.anchorXUnits_, @@ -205,7 +205,7 @@ _ol_style_Icon_.prototype.clone = function() { * @inheritDoc * @api */ -_ol_style_Icon_.prototype.getAnchor = function() { +Icon.prototype.getAnchor = function() { if (this.normalizedAnchor_) { return this.normalizedAnchor_; } @@ -251,7 +251,7 @@ _ol_style_Icon_.prototype.getAnchor = function() { * @return {ol.Color} Color. * @api */ -_ol_style_Icon_.prototype.getColor = function() { +Icon.prototype.getColor = function() { return this.color_; }; @@ -263,7 +263,7 @@ _ol_style_Icon_.prototype.getColor = function() { * @override * @api */ -_ol_style_Icon_.prototype.getImage = function(pixelRatio) { +Icon.prototype.getImage = function(pixelRatio) { return this.iconImage_.getImage(pixelRatio); }; @@ -271,7 +271,7 @@ _ol_style_Icon_.prototype.getImage = function(pixelRatio) { /** * @override */ -_ol_style_Icon_.prototype.getImageSize = function() { +Icon.prototype.getImageSize = function() { return this.iconImage_.getSize(); }; @@ -279,7 +279,7 @@ _ol_style_Icon_.prototype.getImageSize = function() { /** * @override */ -_ol_style_Icon_.prototype.getHitDetectionImageSize = function() { +Icon.prototype.getHitDetectionImageSize = function() { return this.getImageSize(); }; @@ -287,7 +287,7 @@ _ol_style_Icon_.prototype.getHitDetectionImageSize = function() { /** * @override */ -_ol_style_Icon_.prototype.getImageState = function() { +Icon.prototype.getImageState = function() { return this.iconImage_.getImageState(); }; @@ -295,7 +295,7 @@ _ol_style_Icon_.prototype.getImageState = function() { /** * @override */ -_ol_style_Icon_.prototype.getHitDetectionImage = function(pixelRatio) { +Icon.prototype.getHitDetectionImage = function(pixelRatio) { return this.iconImage_.getHitDetectionImage(pixelRatio); }; @@ -304,7 +304,7 @@ _ol_style_Icon_.prototype.getHitDetectionImage = function(pixelRatio) { * @inheritDoc * @api */ -_ol_style_Icon_.prototype.getOrigin = function() { +Icon.prototype.getOrigin = function() { if (this.origin_) { return this.origin_; } @@ -336,7 +336,7 @@ _ol_style_Icon_.prototype.getOrigin = function() { * @return {string|undefined} Image src. * @api */ -_ol_style_Icon_.prototype.getSrc = function() { +Icon.prototype.getSrc = function() { return this.iconImage_.getSrc(); }; @@ -345,7 +345,7 @@ _ol_style_Icon_.prototype.getSrc = function() { * @inheritDoc * @api */ -_ol_style_Icon_.prototype.getSize = function() { +Icon.prototype.getSize = function() { return !this.size_ ? this.iconImage_.getSize() : this.size_; }; @@ -353,7 +353,7 @@ _ol_style_Icon_.prototype.getSize = function() { /** * @override */ -_ol_style_Icon_.prototype.listenImageChange = function(listener, thisArg) { +Icon.prototype.listenImageChange = function(listener, thisArg) { return _ol_events_.listen(this.iconImage_, EventType.CHANGE, listener, thisArg); }; @@ -367,7 +367,7 @@ _ol_style_Icon_.prototype.listenImageChange = function(listener, thisArg) { * @override * @api */ -_ol_style_Icon_.prototype.load = function() { +Icon.prototype.load = function() { this.iconImage_.load(); }; @@ -375,8 +375,8 @@ _ol_style_Icon_.prototype.load = function() { /** * @override */ -_ol_style_Icon_.prototype.unlistenImageChange = function(listener, thisArg) { +Icon.prototype.unlistenImageChange = function(listener, thisArg) { _ol_events_.unlisten(this.iconImage_, EventType.CHANGE, listener, thisArg); }; -export default _ol_style_Icon_; +export default Icon; diff --git a/src/ol/style/IconImage.js b/src/ol/style/IconImage.js index 1174f69cd2..fb893e00a3 100644 --- a/src/ol/style/IconImage.js +++ b/src/ol/style/IconImage.js @@ -19,7 +19,7 @@ import {iconImageCache} from '../style.js'; * @param {ol.Color} color Color. * @extends {ol.events.EventTarget} */ -var _ol_style_IconImage_ = function(image, src, size, crossOrigin, imageState, +var IconImage = function(image, src, size, crossOrigin, imageState, color) { EventTarget.call(this); @@ -89,7 +89,7 @@ var _ol_style_IconImage_ = function(image, src, size, crossOrigin, imageState, }; -inherits(_ol_style_IconImage_, EventTarget); +inherits(IconImage, EventTarget); /** @@ -101,11 +101,11 @@ inherits(_ol_style_IconImage_, EventTarget); * @param {ol.Color} color Color. * @return {ol.style.IconImage} Icon image. */ -_ol_style_IconImage_.get = function(image, src, size, crossOrigin, imageState, +IconImage.get = function(image, src, size, crossOrigin, imageState, color) { var iconImage = iconImageCache.get(src, crossOrigin, color); if (!iconImage) { - iconImage = new _ol_style_IconImage_( + iconImage = new IconImage( image, src, size, crossOrigin, imageState, color); iconImageCache.set(src, crossOrigin, color, iconImage); } @@ -116,7 +116,7 @@ _ol_style_IconImage_.get = function(image, src, size, crossOrigin, imageState, /** * @private */ -_ol_style_IconImage_.prototype.determineTainting_ = function() { +IconImage.prototype.determineTainting_ = function() { var context = createCanvasContext2D(1, 1); try { context.drawImage(this.image_, 0, 0); @@ -130,7 +130,7 @@ _ol_style_IconImage_.prototype.determineTainting_ = function() { /** * @private */ -_ol_style_IconImage_.prototype.dispatchChangeEvent_ = function() { +IconImage.prototype.dispatchChangeEvent_ = function() { this.dispatchEvent(EventType.CHANGE); }; @@ -138,7 +138,7 @@ _ol_style_IconImage_.prototype.dispatchChangeEvent_ = function() { /** * @private */ -_ol_style_IconImage_.prototype.handleImageError_ = function() { +IconImage.prototype.handleImageError_ = function() { this.imageState_ = ImageState.ERROR; this.unlistenImage_(); this.dispatchChangeEvent_(); @@ -148,7 +148,7 @@ _ol_style_IconImage_.prototype.handleImageError_ = function() { /** * @private */ -_ol_style_IconImage_.prototype.handleImageLoad_ = function() { +IconImage.prototype.handleImageLoad_ = function() { this.imageState_ = ImageState.LOADED; if (this.size_) { this.image_.width = this.size_[0]; @@ -166,7 +166,7 @@ _ol_style_IconImage_.prototype.handleImageLoad_ = function() { * @param {number} pixelRatio Pixel ratio. * @return {Image|HTMLCanvasElement} Image or Canvas element. */ -_ol_style_IconImage_.prototype.getImage = function(pixelRatio) { +IconImage.prototype.getImage = function(pixelRatio) { return this.canvas_ ? this.canvas_ : this.image_; }; @@ -174,7 +174,7 @@ _ol_style_IconImage_.prototype.getImage = function(pixelRatio) { /** * @return {ol.ImageState} Image state. */ -_ol_style_IconImage_.prototype.getImageState = function() { +IconImage.prototype.getImageState = function() { return this.imageState_; }; @@ -183,7 +183,7 @@ _ol_style_IconImage_.prototype.getImageState = function() { * @param {number} pixelRatio Pixel ratio. * @return {Image|HTMLCanvasElement} Image element. */ -_ol_style_IconImage_.prototype.getHitDetectionImage = function(pixelRatio) { +IconImage.prototype.getHitDetectionImage = function(pixelRatio) { if (!this.hitDetectionImage_) { if (this.tainting_) { var width = this.size_[0]; @@ -202,7 +202,7 @@ _ol_style_IconImage_.prototype.getHitDetectionImage = function(pixelRatio) { /** * @return {ol.Size} Image size. */ -_ol_style_IconImage_.prototype.getSize = function() { +IconImage.prototype.getSize = function() { return this.size_; }; @@ -210,7 +210,7 @@ _ol_style_IconImage_.prototype.getSize = function() { /** * @return {string|undefined} Image src. */ -_ol_style_IconImage_.prototype.getSrc = function() { +IconImage.prototype.getSrc = function() { return this.src_; }; @@ -218,7 +218,7 @@ _ol_style_IconImage_.prototype.getSrc = function() { /** * Load not yet loaded URI. */ -_ol_style_IconImage_.prototype.load = function() { +IconImage.prototype.load = function() { if (this.imageState_ == ImageState.IDLE) { this.imageState_ = ImageState.LOADING; this.imageListenerKeys_ = [ @@ -239,7 +239,7 @@ _ol_style_IconImage_.prototype.load = function() { /** * @private */ -_ol_style_IconImage_.prototype.replaceColor_ = function() { +IconImage.prototype.replaceColor_ = function() { if (this.tainting_ || this.color_ === null) { return; } @@ -270,8 +270,8 @@ _ol_style_IconImage_.prototype.replaceColor_ = function() { * * @private */ -_ol_style_IconImage_.prototype.unlistenImage_ = function() { +IconImage.prototype.unlistenImage_ = function() { this.imageListenerKeys_.forEach(_ol_events_.unlistenByKey); this.imageListenerKeys_ = null; }; -export default _ol_style_IconImage_; +export default IconImage; diff --git a/src/ol/style/Image.js b/src/ol/style/Image.js index 0a680147b2..aa82166f24 100644 --- a/src/ol/style/Image.js +++ b/src/ol/style/Image.js @@ -12,7 +12,7 @@ * @param {ol.StyleImageOptions} options Options. * @api */ -var _ol_style_Image_ = function(options) { +var ImageStyle = function(options) { /** * @private @@ -52,7 +52,7 @@ var _ol_style_Image_ = function(options) { * @return {number} Opacity. * @api */ -_ol_style_Image_.prototype.getOpacity = function() { +ImageStyle.prototype.getOpacity = function() { return this.opacity_; }; @@ -62,7 +62,7 @@ _ol_style_Image_.prototype.getOpacity = function() { * @return {boolean} Rotate with map. * @api */ -_ol_style_Image_.prototype.getRotateWithView = function() { +ImageStyle.prototype.getRotateWithView = function() { return this.rotateWithView_; }; @@ -72,7 +72,7 @@ _ol_style_Image_.prototype.getRotateWithView = function() { * @return {number} Rotation. * @api */ -_ol_style_Image_.prototype.getRotation = function() { +ImageStyle.prototype.getRotation = function() { return this.rotation_; }; @@ -82,7 +82,7 @@ _ol_style_Image_.prototype.getRotation = function() { * @return {number} Scale. * @api */ -_ol_style_Image_.prototype.getScale = function() { +ImageStyle.prototype.getScale = function() { return this.scale_; }; @@ -92,7 +92,7 @@ _ol_style_Image_.prototype.getScale = function() { * @return {boolean} The symbolizer should snap to a pixel. * @api */ -_ol_style_Image_.prototype.getSnapToPixel = function() { +ImageStyle.prototype.getSnapToPixel = function() { return this.snapToPixel_; }; @@ -103,7 +103,7 @@ _ol_style_Image_.prototype.getSnapToPixel = function() { * @abstract * @return {Array.} Anchor. */ -_ol_style_Image_.prototype.getAnchor = function() {}; +ImageStyle.prototype.getAnchor = function() {}; /** @@ -112,7 +112,7 @@ _ol_style_Image_.prototype.getAnchor = function() {}; * @param {number} pixelRatio Pixel ratio. * @return {HTMLCanvasElement|HTMLVideoElement|Image} Image element. */ -_ol_style_Image_.prototype.getImage = function(pixelRatio) {}; +ImageStyle.prototype.getImage = function(pixelRatio) {}; /** @@ -120,28 +120,28 @@ _ol_style_Image_.prototype.getImage = function(pixelRatio) {}; * @param {number} pixelRatio Pixel ratio. * @return {HTMLCanvasElement|HTMLVideoElement|Image} Image element. */ -_ol_style_Image_.prototype.getHitDetectionImage = function(pixelRatio) {}; +ImageStyle.prototype.getHitDetectionImage = function(pixelRatio) {}; /** * @abstract * @return {ol.ImageState} Image state. */ -_ol_style_Image_.prototype.getImageState = function() {}; +ImageStyle.prototype.getImageState = function() {}; /** * @abstract * @return {ol.Size} Image size. */ -_ol_style_Image_.prototype.getImageSize = function() {}; +ImageStyle.prototype.getImageSize = function() {}; /** * @abstract * @return {ol.Size} Size of the hit-detection image. */ -_ol_style_Image_.prototype.getHitDetectionImageSize = function() {}; +ImageStyle.prototype.getHitDetectionImageSize = function() {}; /** @@ -149,7 +149,7 @@ _ol_style_Image_.prototype.getHitDetectionImageSize = function() {}; * @abstract * @return {Array.} Origin. */ -_ol_style_Image_.prototype.getOrigin = function() {}; +ImageStyle.prototype.getOrigin = function() {}; /** @@ -157,7 +157,7 @@ _ol_style_Image_.prototype.getOrigin = function() {}; * @abstract * @return {ol.Size} Size. */ -_ol_style_Image_.prototype.getSize = function() {}; +ImageStyle.prototype.getSize = function() {}; /** @@ -166,7 +166,7 @@ _ol_style_Image_.prototype.getSize = function() {}; * @param {number} opacity Opacity. * @api */ -_ol_style_Image_.prototype.setOpacity = function(opacity) { +ImageStyle.prototype.setOpacity = function(opacity) { this.opacity_ = opacity; }; @@ -176,7 +176,7 @@ _ol_style_Image_.prototype.setOpacity = function(opacity) { * * @param {boolean} rotateWithView Rotate with map. */ -_ol_style_Image_.prototype.setRotateWithView = function(rotateWithView) { +ImageStyle.prototype.setRotateWithView = function(rotateWithView) { this.rotateWithView_ = rotateWithView; }; @@ -187,7 +187,7 @@ _ol_style_Image_.prototype.setRotateWithView = function(rotateWithView) { * @param {number} rotation Rotation. * @api */ -_ol_style_Image_.prototype.setRotation = function(rotation) { +ImageStyle.prototype.setRotation = function(rotation) { this.rotation_ = rotation; }; @@ -198,7 +198,7 @@ _ol_style_Image_.prototype.setRotation = function(rotation) { * @param {number} scale Scale. * @api */ -_ol_style_Image_.prototype.setScale = function(scale) { +ImageStyle.prototype.setScale = function(scale) { this.scale_ = scale; }; @@ -208,7 +208,7 @@ _ol_style_Image_.prototype.setScale = function(scale) { * * @param {boolean} snapToPixel Snap to pixel? */ -_ol_style_Image_.prototype.setSnapToPixel = function(snapToPixel) { +ImageStyle.prototype.setSnapToPixel = function(snapToPixel) { this.snapToPixel_ = snapToPixel; }; @@ -220,14 +220,14 @@ _ol_style_Image_.prototype.setSnapToPixel = function(snapToPixel) { * @return {ol.EventsKey|undefined} Listener key. * @template T */ -_ol_style_Image_.prototype.listenImageChange = function(listener, thisArg) {}; +ImageStyle.prototype.listenImageChange = function(listener, thisArg) {}; /** * Load not yet loaded URI. * @abstract */ -_ol_style_Image_.prototype.load = function() {}; +ImageStyle.prototype.load = function() {}; /** @@ -236,5 +236,5 @@ _ol_style_Image_.prototype.load = function() {}; * @param {T} thisArg Value to use as `this` when executing `listener`. * @template T */ -_ol_style_Image_.prototype.unlistenImageChange = function(listener, thisArg) {}; -export default _ol_style_Image_; +ImageStyle.prototype.unlistenImageChange = function(listener, thisArg) {}; +export default ImageStyle; diff --git a/src/ol/style/RegularShape.js b/src/ol/style/RegularShape.js index c08d7066bb..6dd283844b 100644 --- a/src/ol/style/RegularShape.js +++ b/src/ol/style/RegularShape.js @@ -7,7 +7,7 @@ import {createCanvasContext2D} from '../dom.js'; import _ol_has_ from '../has.js'; import ImageState from '../ImageState.js'; import _ol_render_canvas_ from '../render/canvas.js'; -import _ol_style_Image_ from '../style/Image.js'; +import ImageStyle from '../style/Image.js'; /** * @classdesc @@ -20,7 +20,7 @@ import _ol_style_Image_ from '../style/Image.js'; * @extends {ol.style.Image} * @api */ -var _ol_style_RegularShape_ = function(options) { +var RegularShape = function(options) { /** * @private * @type {Array.} @@ -126,7 +126,7 @@ var _ol_style_RegularShape_ = function(options) { var rotateWithView = options.rotateWithView !== undefined ? options.rotateWithView : false; - _ol_style_Image_.call(this, { + ImageStyle.call(this, { opacity: 1, rotateWithView: rotateWithView, rotation: options.rotation !== undefined ? options.rotation : 0, @@ -135,7 +135,7 @@ var _ol_style_RegularShape_ = function(options) { }); }; -inherits(_ol_style_RegularShape_, _ol_style_Image_); +inherits(RegularShape, ImageStyle); /** @@ -143,8 +143,8 @@ inherits(_ol_style_RegularShape_, _ol_style_Image_); * @return {ol.style.RegularShape} The cloned style. * @api */ -_ol_style_RegularShape_.prototype.clone = function() { - var style = new _ol_style_RegularShape_({ +RegularShape.prototype.clone = function() { + var style = new RegularShape({ fill: this.getFill() ? this.getFill().clone() : undefined, points: this.getPoints(), radius: this.getRadius(), @@ -166,7 +166,7 @@ _ol_style_RegularShape_.prototype.clone = function() { * @inheritDoc * @api */ -_ol_style_RegularShape_.prototype.getAnchor = function() { +RegularShape.prototype.getAnchor = function() { return this.anchor_; }; @@ -176,7 +176,7 @@ _ol_style_RegularShape_.prototype.getAnchor = function() { * @return {number} Shape's rotation in radians. * @api */ -_ol_style_RegularShape_.prototype.getAngle = function() { +RegularShape.prototype.getAngle = function() { return this.angle_; }; @@ -186,7 +186,7 @@ _ol_style_RegularShape_.prototype.getAngle = function() { * @return {ol.style.Fill} Fill style. * @api */ -_ol_style_RegularShape_.prototype.getFill = function() { +RegularShape.prototype.getFill = function() { return this.fill_; }; @@ -194,7 +194,7 @@ _ol_style_RegularShape_.prototype.getFill = function() { /** * @inheritDoc */ -_ol_style_RegularShape_.prototype.getHitDetectionImage = function(pixelRatio) { +RegularShape.prototype.getHitDetectionImage = function(pixelRatio) { return this.hitDetectionCanvas_; }; @@ -203,7 +203,7 @@ _ol_style_RegularShape_.prototype.getHitDetectionImage = function(pixelRatio) { * @inheritDoc * @api */ -_ol_style_RegularShape_.prototype.getImage = function(pixelRatio) { +RegularShape.prototype.getImage = function(pixelRatio) { return this.canvas_; }; @@ -211,7 +211,7 @@ _ol_style_RegularShape_.prototype.getImage = function(pixelRatio) { /** * @inheritDoc */ -_ol_style_RegularShape_.prototype.getImageSize = function() { +RegularShape.prototype.getImageSize = function() { return this.imageSize_; }; @@ -219,7 +219,7 @@ _ol_style_RegularShape_.prototype.getImageSize = function() { /** * @inheritDoc */ -_ol_style_RegularShape_.prototype.getHitDetectionImageSize = function() { +RegularShape.prototype.getHitDetectionImageSize = function() { return this.hitDetectionImageSize_; }; @@ -227,7 +227,7 @@ _ol_style_RegularShape_.prototype.getHitDetectionImageSize = function() { /** * @inheritDoc */ -_ol_style_RegularShape_.prototype.getImageState = function() { +RegularShape.prototype.getImageState = function() { return ImageState.LOADED; }; @@ -236,7 +236,7 @@ _ol_style_RegularShape_.prototype.getImageState = function() { * @inheritDoc * @api */ -_ol_style_RegularShape_.prototype.getOrigin = function() { +RegularShape.prototype.getOrigin = function() { return this.origin_; }; @@ -246,7 +246,7 @@ _ol_style_RegularShape_.prototype.getOrigin = function() { * @return {number} Number of points for stars and regular polygons. * @api */ -_ol_style_RegularShape_.prototype.getPoints = function() { +RegularShape.prototype.getPoints = function() { return this.points_; }; @@ -256,7 +256,7 @@ _ol_style_RegularShape_.prototype.getPoints = function() { * @return {number} Radius. * @api */ -_ol_style_RegularShape_.prototype.getRadius = function() { +RegularShape.prototype.getRadius = function() { return this.radius_; }; @@ -266,7 +266,7 @@ _ol_style_RegularShape_.prototype.getRadius = function() { * @return {number|undefined} Radius2. * @api */ -_ol_style_RegularShape_.prototype.getRadius2 = function() { +RegularShape.prototype.getRadius2 = function() { return this.radius2_; }; @@ -275,7 +275,7 @@ _ol_style_RegularShape_.prototype.getRadius2 = function() { * @inheritDoc * @api */ -_ol_style_RegularShape_.prototype.getSize = function() { +RegularShape.prototype.getSize = function() { return this.size_; }; @@ -285,7 +285,7 @@ _ol_style_RegularShape_.prototype.getSize = function() { * @return {ol.style.Stroke} Stroke style. * @api */ -_ol_style_RegularShape_.prototype.getStroke = function() { +RegularShape.prototype.getStroke = function() { return this.stroke_; }; @@ -293,26 +293,26 @@ _ol_style_RegularShape_.prototype.getStroke = function() { /** * @inheritDoc */ -_ol_style_RegularShape_.prototype.listenImageChange = function(listener, thisArg) {}; +RegularShape.prototype.listenImageChange = function(listener, thisArg) {}; /** * @inheritDoc */ -_ol_style_RegularShape_.prototype.load = function() {}; +RegularShape.prototype.load = function() {}; /** * @inheritDoc */ -_ol_style_RegularShape_.prototype.unlistenImageChange = function(listener, thisArg) {}; +RegularShape.prototype.unlistenImageChange = function(listener, thisArg) {}; /** * @protected * @param {ol.style.AtlasManager|undefined} atlasManager An atlas manager. */ -_ol_style_RegularShape_.prototype.render_ = function(atlasManager) { +RegularShape.prototype.render_ = function(atlasManager) { var imageSize; var lineCap = ''; var lineJoin = ''; @@ -422,7 +422,7 @@ _ol_style_RegularShape_.prototype.render_ = function(atlasManager) { * @param {number} x The origin for the symbol (x). * @param {number} y The origin for the symbol (y). */ -_ol_style_RegularShape_.prototype.draw_ = function(renderOptions, context, x, y) { +RegularShape.prototype.draw_ = function(renderOptions, context, x, y) { var i, angle0, radiusC; // reset transform context.setTransform(1, 0, 0, 1, 0, 0); @@ -480,7 +480,7 @@ _ol_style_RegularShape_.prototype.draw_ = function(renderOptions, context, x, y) * @private * @param {ol.RegularShapeRenderOptions} renderOptions Render options. */ -_ol_style_RegularShape_.prototype.createHitDetectionCanvas_ = function(renderOptions) { +RegularShape.prototype.createHitDetectionCanvas_ = function(renderOptions) { this.hitDetectionImageSize_ = [renderOptions.size, renderOptions.size]; if (this.fill_) { this.hitDetectionCanvas_ = this.canvas_; @@ -503,7 +503,7 @@ _ol_style_RegularShape_.prototype.createHitDetectionCanvas_ = function(renderOpt * @param {number} x The origin for the symbol (x). * @param {number} y The origin for the symbol (y). */ -_ol_style_RegularShape_.prototype.drawHitDetectionCanvas_ = function(renderOptions, context, x, y) { +RegularShape.prototype.drawHitDetectionCanvas_ = function(renderOptions, context, x, y) { // reset transform context.setTransform(1, 0, 0, 1, 0, 0); @@ -550,7 +550,7 @@ _ol_style_RegularShape_.prototype.drawHitDetectionCanvas_ = function(renderOptio /** * @return {string} The checksum. */ -_ol_style_RegularShape_.prototype.getChecksum = function() { +RegularShape.prototype.getChecksum = function() { var strokeChecksum = this.stroke_ ? this.stroke_.getChecksum() : '-'; var fillChecksum = this.fill_ ? @@ -576,4 +576,4 @@ _ol_style_RegularShape_.prototype.getChecksum = function() { return this.checksums_[0]; }; -export default _ol_style_RegularShape_; +export default RegularShape; diff --git a/src/ol/style/Stroke.js b/src/ol/style/Stroke.js index 4b9cf27eb6..d4c72ce7c4 100644 --- a/src/ol/style/Stroke.js +++ b/src/ol/style/Stroke.js @@ -14,7 +14,7 @@ import {getUid} from '../index.js'; * @param {olx.style.StrokeOptions=} opt_options Options. * @api */ -var _ol_style_Stroke_ = function(opt_options) { +var Stroke = function(opt_options) { var options = opt_options || {}; @@ -73,9 +73,9 @@ var _ol_style_Stroke_ = function(opt_options) { * @return {ol.style.Stroke} The cloned style. * @api */ -_ol_style_Stroke_.prototype.clone = function() { +Stroke.prototype.clone = function() { var color = this.getColor(); - return new _ol_style_Stroke_({ + return new Stroke({ color: (color && color.slice) ? color.slice() : color || undefined, lineCap: this.getLineCap(), lineDash: this.getLineDash() ? this.getLineDash().slice() : undefined, @@ -92,7 +92,7 @@ _ol_style_Stroke_.prototype.clone = function() { * @return {ol.Color|ol.ColorLike} Color. * @api */ -_ol_style_Stroke_.prototype.getColor = function() { +Stroke.prototype.getColor = function() { return this.color_; }; @@ -102,7 +102,7 @@ _ol_style_Stroke_.prototype.getColor = function() { * @return {string|undefined} Line cap. * @api */ -_ol_style_Stroke_.prototype.getLineCap = function() { +Stroke.prototype.getLineCap = function() { return this.lineCap_; }; @@ -112,7 +112,7 @@ _ol_style_Stroke_.prototype.getLineCap = function() { * @return {Array.} Line dash. * @api */ -_ol_style_Stroke_.prototype.getLineDash = function() { +Stroke.prototype.getLineDash = function() { return this.lineDash_; }; @@ -122,7 +122,7 @@ _ol_style_Stroke_.prototype.getLineDash = function() { * @return {number|undefined} Line dash offset. * @api */ -_ol_style_Stroke_.prototype.getLineDashOffset = function() { +Stroke.prototype.getLineDashOffset = function() { return this.lineDashOffset_; }; @@ -132,7 +132,7 @@ _ol_style_Stroke_.prototype.getLineDashOffset = function() { * @return {string|undefined} Line join. * @api */ -_ol_style_Stroke_.prototype.getLineJoin = function() { +Stroke.prototype.getLineJoin = function() { return this.lineJoin_; }; @@ -142,7 +142,7 @@ _ol_style_Stroke_.prototype.getLineJoin = function() { * @return {number|undefined} Miter limit. * @api */ -_ol_style_Stroke_.prototype.getMiterLimit = function() { +Stroke.prototype.getMiterLimit = function() { return this.miterLimit_; }; @@ -152,7 +152,7 @@ _ol_style_Stroke_.prototype.getMiterLimit = function() { * @return {number|undefined} Width. * @api */ -_ol_style_Stroke_.prototype.getWidth = function() { +Stroke.prototype.getWidth = function() { return this.width_; }; @@ -163,7 +163,7 @@ _ol_style_Stroke_.prototype.getWidth = function() { * @param {ol.Color|ol.ColorLike} color Color. * @api */ -_ol_style_Stroke_.prototype.setColor = function(color) { +Stroke.prototype.setColor = function(color) { this.color_ = color; this.checksum_ = undefined; }; @@ -175,7 +175,7 @@ _ol_style_Stroke_.prototype.setColor = function(color) { * @param {string|undefined} lineCap Line cap. * @api */ -_ol_style_Stroke_.prototype.setLineCap = function(lineCap) { +Stroke.prototype.setLineCap = function(lineCap) { this.lineCap_ = lineCap; this.checksum_ = undefined; }; @@ -193,7 +193,7 @@ _ol_style_Stroke_.prototype.setLineCap = function(lineCap) { * @param {Array.} lineDash Line dash. * @api */ -_ol_style_Stroke_.prototype.setLineDash = function(lineDash) { +Stroke.prototype.setLineDash = function(lineDash) { this.lineDash_ = lineDash; this.checksum_ = undefined; }; @@ -205,7 +205,7 @@ _ol_style_Stroke_.prototype.setLineDash = function(lineDash) { * @param {number|undefined} lineDashOffset Line dash offset. * @api */ -_ol_style_Stroke_.prototype.setLineDashOffset = function(lineDashOffset) { +Stroke.prototype.setLineDashOffset = function(lineDashOffset) { this.lineDashOffset_ = lineDashOffset; this.checksum_ = undefined; }; @@ -217,7 +217,7 @@ _ol_style_Stroke_.prototype.setLineDashOffset = function(lineDashOffset) { * @param {string|undefined} lineJoin Line join. * @api */ -_ol_style_Stroke_.prototype.setLineJoin = function(lineJoin) { +Stroke.prototype.setLineJoin = function(lineJoin) { this.lineJoin_ = lineJoin; this.checksum_ = undefined; }; @@ -229,7 +229,7 @@ _ol_style_Stroke_.prototype.setLineJoin = function(lineJoin) { * @param {number|undefined} miterLimit Miter limit. * @api */ -_ol_style_Stroke_.prototype.setMiterLimit = function(miterLimit) { +Stroke.prototype.setMiterLimit = function(miterLimit) { this.miterLimit_ = miterLimit; this.checksum_ = undefined; }; @@ -241,7 +241,7 @@ _ol_style_Stroke_.prototype.setMiterLimit = function(miterLimit) { * @param {number|undefined} width Width. * @api */ -_ol_style_Stroke_.prototype.setWidth = function(width) { +Stroke.prototype.setWidth = function(width) { this.width_ = width; this.checksum_ = undefined; }; @@ -250,7 +250,7 @@ _ol_style_Stroke_.prototype.setWidth = function(width) { /** * @return {string} The checksum. */ -_ol_style_Stroke_.prototype.getChecksum = function() { +Stroke.prototype.getChecksum = function() { if (this.checksum_ === undefined) { this.checksum_ = 's'; if (this.color_) { @@ -279,4 +279,4 @@ _ol_style_Stroke_.prototype.getChecksum = function() { return this.checksum_; }; -export default _ol_style_Stroke_; +export default Stroke; diff --git a/src/ol/style/Style.js b/src/ol/style/Style.js index a179d34816..ae33eb9d5d 100644 --- a/src/ol/style/Style.js +++ b/src/ol/style/Style.js @@ -3,9 +3,9 @@ */ import {assert} from '../asserts.js'; import GeometryType from '../geom/GeometryType.js'; -import _ol_style_Circle_ from '../style/Circle.js'; -import _ol_style_Fill_ from '../style/Fill.js'; -import _ol_style_Stroke_ from '../style/Stroke.js'; +import CircleStyle from '../style/Circle.js'; +import Fill from '../style/Fill.js'; +import Stroke from '../style/Stroke.js'; /** * @classdesc @@ -18,7 +18,7 @@ import _ol_style_Stroke_ from '../style/Stroke.js'; * @param {olx.style.StyleOptions=} opt_options Style options. * @api */ -var _ol_style_Style_ = function(opt_options) { +var Style = function(opt_options) { var options = opt_options || {}; @@ -32,7 +32,7 @@ var _ol_style_Style_ = function(opt_options) { * @private * @type {!ol.StyleGeometryFunction} */ - this.geometryFunction_ = _ol_style_Style_.defaultGeometryFunction; + this.geometryFunction_ = Style.defaultGeometryFunction; if (options.geometry !== undefined) { this.setGeometry(options.geometry); @@ -82,12 +82,12 @@ var _ol_style_Style_ = function(opt_options) { * @return {ol.style.Style} The cloned style. * @api */ -_ol_style_Style_.prototype.clone = function() { +Style.prototype.clone = function() { var geometry = this.getGeometry(); if (geometry && geometry.clone) { geometry = geometry.clone(); } - return new _ol_style_Style_({ + return new Style({ geometry: geometry, fill: this.getFill() ? this.getFill().clone() : undefined, image: this.getImage() ? this.getImage().clone() : undefined, @@ -104,7 +104,7 @@ _ol_style_Style_.prototype.clone = function() { * @return {ol.StyleRenderFunction|null} Custom renderer function. * @api */ -_ol_style_Style_.prototype.getRenderer = function() { +Style.prototype.getRenderer = function() { return this.renderer_; }; @@ -115,7 +115,7 @@ _ol_style_Style_.prototype.getRenderer = function() { * @param {ol.StyleRenderFunction|null} renderer Custom renderer function. * @api */ -_ol_style_Style_.prototype.setRenderer = function(renderer) { +Style.prototype.setRenderer = function(renderer) { this.renderer_ = renderer; }; @@ -127,7 +127,7 @@ _ol_style_Style_.prototype.setRenderer = function(renderer) { * be rendered with this style. * @api */ -_ol_style_Style_.prototype.getGeometry = function() { +Style.prototype.getGeometry = function() { return this.geometry_; }; @@ -138,7 +138,7 @@ _ol_style_Style_.prototype.getGeometry = function() { * and returns the geometry to render instead of the feature's geometry. * @api */ -_ol_style_Style_.prototype.getGeometryFunction = function() { +Style.prototype.getGeometryFunction = function() { return this.geometryFunction_; }; @@ -148,7 +148,7 @@ _ol_style_Style_.prototype.getGeometryFunction = function() { * @return {ol.style.Fill} Fill style. * @api */ -_ol_style_Style_.prototype.getFill = function() { +Style.prototype.getFill = function() { return this.fill_; }; @@ -158,7 +158,7 @@ _ol_style_Style_.prototype.getFill = function() { * @param {ol.style.Fill} fill Fill style. * @api */ -_ol_style_Style_.prototype.setFill = function(fill) { +Style.prototype.setFill = function(fill) { this.fill_ = fill; }; @@ -168,7 +168,7 @@ _ol_style_Style_.prototype.setFill = function(fill) { * @return {ol.style.Image} Image style. * @api */ -_ol_style_Style_.prototype.getImage = function() { +Style.prototype.getImage = function() { return this.image_; }; @@ -178,7 +178,7 @@ _ol_style_Style_.prototype.getImage = function() { * @param {ol.style.Image} image Image style. * @api */ -_ol_style_Style_.prototype.setImage = function(image) { +Style.prototype.setImage = function(image) { this.image_ = image; }; @@ -188,7 +188,7 @@ _ol_style_Style_.prototype.setImage = function(image) { * @return {ol.style.Stroke} Stroke style. * @api */ -_ol_style_Style_.prototype.getStroke = function() { +Style.prototype.getStroke = function() { return this.stroke_; }; @@ -198,7 +198,7 @@ _ol_style_Style_.prototype.getStroke = function() { * @param {ol.style.Stroke} stroke Stroke style. * @api */ -_ol_style_Style_.prototype.setStroke = function(stroke) { +Style.prototype.setStroke = function(stroke) { this.stroke_ = stroke; }; @@ -208,7 +208,7 @@ _ol_style_Style_.prototype.setStroke = function(stroke) { * @return {ol.style.Text} Text style. * @api */ -_ol_style_Style_.prototype.getText = function() { +Style.prototype.getText = function() { return this.text_; }; @@ -218,7 +218,7 @@ _ol_style_Style_.prototype.getText = function() { * @param {ol.style.Text} text Text style. * @api */ -_ol_style_Style_.prototype.setText = function(text) { +Style.prototype.setText = function(text) { this.text_ = text; }; @@ -228,7 +228,7 @@ _ol_style_Style_.prototype.setText = function(text) { * @return {number|undefined} ZIndex. * @api */ -_ol_style_Style_.prototype.getZIndex = function() { +Style.prototype.getZIndex = function() { return this.zIndex_; }; @@ -241,7 +241,7 @@ _ol_style_Style_.prototype.getZIndex = function() { * for this style. * @api */ -_ol_style_Style_.prototype.setGeometry = function(geometry) { +Style.prototype.setGeometry = function(geometry) { if (typeof geometry === 'function') { this.geometryFunction_ = geometry; } else if (typeof geometry === 'string') { @@ -249,7 +249,7 @@ _ol_style_Style_.prototype.setGeometry = function(geometry) { return /** @type {ol.geom.Geometry} */ (feature.get(geometry)); }; } else if (!geometry) { - this.geometryFunction_ = _ol_style_Style_.defaultGeometryFunction; + this.geometryFunction_ = Style.defaultGeometryFunction; } else if (geometry !== undefined) { this.geometryFunction_ = function() { return /** @type {ol.geom.Geometry} */ (geometry); @@ -265,7 +265,7 @@ _ol_style_Style_.prototype.setGeometry = function(geometry) { * @param {number|undefined} zIndex ZIndex. * @api */ -_ol_style_Style_.prototype.setZIndex = function(zIndex) { +Style.prototype.setZIndex = function(zIndex) { this.zIndex_ = zIndex; }; @@ -278,7 +278,7 @@ _ol_style_Style_.prototype.setZIndex = function(zIndex) { * A style function, a single style, or an array of styles. * @return {ol.StyleFunction} A style function. */ -_ol_style_Style_.createFunction = function(obj) { +Style.createFunction = function(obj) { var styleFunction; if (typeof obj === 'function') { @@ -291,7 +291,7 @@ _ol_style_Style_.createFunction = function(obj) { if (Array.isArray(obj)) { styles = obj; } else { - assert(obj instanceof _ol_style_Style_, + assert(obj instanceof Style, 41); // Expected an `ol.style.Style` or an array of `ol.style.Style` styles = [obj]; } @@ -307,7 +307,7 @@ _ol_style_Style_.createFunction = function(obj) { * @type {Array.} * @private */ -_ol_style_Style_.default_ = null; +Style.default_ = null; /** @@ -315,23 +315,23 @@ _ol_style_Style_.default_ = null; * @param {number} resolution Resolution. * @return {Array.} Style. */ -_ol_style_Style_.defaultFunction = function(feature, resolution) { +Style.defaultFunction = function(feature, resolution) { // We don't use an immediately-invoked function // and a closure so we don't get an error at script evaluation time in // browsers that do not support Canvas. (ol.style.Circle does // canvas.getContext('2d') at construction time, which will cause an.error // in such browsers.) - if (!_ol_style_Style_.default_) { - var fill = new _ol_style_Fill_({ + if (!Style.default_) { + var fill = new Fill({ color: 'rgba(255,255,255,0.4)' }); - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ color: '#3399CC', width: 1.25 }); - _ol_style_Style_.default_ = [ - new _ol_style_Style_({ - image: new _ol_style_Circle_({ + Style.default_ = [ + new Style({ + image: new CircleStyle({ fill: fill, stroke: stroke, radius: 5 @@ -341,7 +341,7 @@ _ol_style_Style_.defaultFunction = function(feature, resolution) { }) ]; } - return _ol_style_Style_.default_; + return Style.default_; }; @@ -349,15 +349,15 @@ _ol_style_Style_.defaultFunction = function(feature, resolution) { * Default styles for editing features. * @return {Object.>} Styles */ -_ol_style_Style_.createDefaultEditing = function() { +Style.createDefaultEditing = function() { /** @type {Object.>} */ var styles = {}; var white = [255, 255, 255, 1]; var blue = [0, 153, 255, 1]; var width = 3; styles[GeometryType.POLYGON] = [ - new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + new Style({ + fill: new Fill({ color: [255, 255, 255, 0.5] }) }) @@ -366,14 +366,14 @@ _ol_style_Style_.createDefaultEditing = function() { styles[GeometryType.POLYGON]; styles[GeometryType.LINE_STRING] = [ - new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + new Style({ + stroke: new Stroke({ color: white, width: width + 2 }) }), - new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + new Style({ + stroke: new Stroke({ color: blue, width: width }) @@ -389,13 +389,13 @@ _ol_style_Style_.createDefaultEditing = function() { styles[GeometryType.POINT] = [ - new _ol_style_Style_({ - image: new _ol_style_Circle_({ + new Style({ + image: new CircleStyle({ radius: width * 2, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: blue }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: white, width: width / 2 }) @@ -422,7 +422,7 @@ _ol_style_Style_.createDefaultEditing = function() { * for. * @return {ol.geom.Geometry|ol.render.Feature|undefined} Geometry to render. */ -_ol_style_Style_.defaultGeometryFunction = function(feature) { +Style.defaultGeometryFunction = function(feature) { return feature.getGeometry(); }; -export default _ol_style_Style_; +export default Style; diff --git a/src/ol/style/Text.js b/src/ol/style/Text.js index 279cece8ea..e8beec8dd7 100644 --- a/src/ol/style/Text.js +++ b/src/ol/style/Text.js @@ -1,7 +1,7 @@ /** * @module ol/style/Text */ -import _ol_style_Fill_ from '../style/Fill.js'; +import Fill from '../style/Fill.js'; import TextPlacement from '../style/TextPlacement.js'; /** @@ -12,7 +12,7 @@ import TextPlacement from '../style/TextPlacement.js'; * @param {olx.style.TextOptions=} opt_options Options. * @api */ -var _ol_style_Text_ = function(opt_options) { +var Text = function(opt_options) { var options = opt_options || {}; @@ -63,7 +63,7 @@ var _ol_style_Text_ = function(opt_options) { * @type {ol.style.Fill} */ this.fill_ = options.fill !== undefined ? options.fill : - new _ol_style_Fill_({color: _ol_style_Text_.DEFAULT_FILL_COLOR_}); + new Fill({color: Text.DEFAULT_FILL_COLOR_}); /** * @private @@ -128,7 +128,7 @@ var _ol_style_Text_ = function(opt_options) { * @const {string} * @private */ -_ol_style_Text_.DEFAULT_FILL_COLOR_ = '#333'; +Text.DEFAULT_FILL_COLOR_ = '#333'; /** @@ -136,8 +136,8 @@ _ol_style_Text_.DEFAULT_FILL_COLOR_ = '#333'; * @return {ol.style.Text} The cloned style. * @api */ -_ol_style_Text_.prototype.clone = function() { - return new _ol_style_Text_({ +Text.prototype.clone = function() { + return new Text({ font: this.getFont(), placement: this.getPlacement(), maxAngle: this.getMaxAngle(), @@ -163,7 +163,7 @@ _ol_style_Text_.prototype.clone = function() { * @return {boolean} Let text overflow the length of the path they follow. * @api */ -_ol_style_Text_.prototype.getOverflow = function() { +Text.prototype.getOverflow = function() { return this.overflow_; }; @@ -173,7 +173,7 @@ _ol_style_Text_.prototype.getOverflow = function() { * @return {string|undefined} Font. * @api */ -_ol_style_Text_.prototype.getFont = function() { +Text.prototype.getFont = function() { return this.font_; }; @@ -183,7 +183,7 @@ _ol_style_Text_.prototype.getFont = function() { * @return {number} Angle in radians. * @api */ -_ol_style_Text_.prototype.getMaxAngle = function() { +Text.prototype.getMaxAngle = function() { return this.maxAngle_; }; @@ -193,7 +193,7 @@ _ol_style_Text_.prototype.getMaxAngle = function() { * @return {ol.style.TextPlacement|string} Text placement. * @api */ -_ol_style_Text_.prototype.getPlacement = function() { +Text.prototype.getPlacement = function() { return this.placement_; }; @@ -203,7 +203,7 @@ _ol_style_Text_.prototype.getPlacement = function() { * @return {number} Horizontal text offset. * @api */ -_ol_style_Text_.prototype.getOffsetX = function() { +Text.prototype.getOffsetX = function() { return this.offsetX_; }; @@ -213,7 +213,7 @@ _ol_style_Text_.prototype.getOffsetX = function() { * @return {number} Vertical text offset. * @api */ -_ol_style_Text_.prototype.getOffsetY = function() { +Text.prototype.getOffsetY = function() { return this.offsetY_; }; @@ -223,7 +223,7 @@ _ol_style_Text_.prototype.getOffsetY = function() { * @return {ol.style.Fill} Fill style. * @api */ -_ol_style_Text_.prototype.getFill = function() { +Text.prototype.getFill = function() { return this.fill_; }; @@ -233,7 +233,7 @@ _ol_style_Text_.prototype.getFill = function() { * @return {boolean|undefined} Rotate with map. * @api */ -_ol_style_Text_.prototype.getRotateWithView = function() { +Text.prototype.getRotateWithView = function() { return this.rotateWithView_; }; @@ -243,7 +243,7 @@ _ol_style_Text_.prototype.getRotateWithView = function() { * @return {number|undefined} Rotation. * @api */ -_ol_style_Text_.prototype.getRotation = function() { +Text.prototype.getRotation = function() { return this.rotation_; }; @@ -253,7 +253,7 @@ _ol_style_Text_.prototype.getRotation = function() { * @return {number|undefined} Scale. * @api */ -_ol_style_Text_.prototype.getScale = function() { +Text.prototype.getScale = function() { return this.scale_; }; @@ -263,7 +263,7 @@ _ol_style_Text_.prototype.getScale = function() { * @return {ol.style.Stroke} Stroke style. * @api */ -_ol_style_Text_.prototype.getStroke = function() { +Text.prototype.getStroke = function() { return this.stroke_; }; @@ -273,7 +273,7 @@ _ol_style_Text_.prototype.getStroke = function() { * @return {string|undefined} Text. * @api */ -_ol_style_Text_.prototype.getText = function() { +Text.prototype.getText = function() { return this.text_; }; @@ -283,7 +283,7 @@ _ol_style_Text_.prototype.getText = function() { * @return {string|undefined} Text align. * @api */ -_ol_style_Text_.prototype.getTextAlign = function() { +Text.prototype.getTextAlign = function() { return this.textAlign_; }; @@ -293,7 +293,7 @@ _ol_style_Text_.prototype.getTextAlign = function() { * @return {string|undefined} Text baseline. * @api */ -_ol_style_Text_.prototype.getTextBaseline = function() { +Text.prototype.getTextBaseline = function() { return this.textBaseline_; }; @@ -303,7 +303,7 @@ _ol_style_Text_.prototype.getTextBaseline = function() { * @return {ol.style.Fill} Fill style. * @api */ -_ol_style_Text_.prototype.getBackgroundFill = function() { +Text.prototype.getBackgroundFill = function() { return this.backgroundFill_; }; @@ -313,7 +313,7 @@ _ol_style_Text_.prototype.getBackgroundFill = function() { * @return {ol.style.Stroke} Stroke style. * @api */ -_ol_style_Text_.prototype.getBackgroundStroke = function() { +Text.prototype.getBackgroundStroke = function() { return this.backgroundStroke_; }; @@ -323,7 +323,7 @@ _ol_style_Text_.prototype.getBackgroundStroke = function() { * @return {Array.} Padding. * @api */ -_ol_style_Text_.prototype.getPadding = function() { +Text.prototype.getPadding = function() { return this.padding_; }; @@ -334,7 +334,7 @@ _ol_style_Text_.prototype.getPadding = function() { * @param {boolean} overflow Let text overflow the path that it follows. * @api */ -_ol_style_Text_.prototype.setOverflow = function(overflow) { +Text.prototype.setOverflow = function(overflow) { this.overflow_ = overflow; }; @@ -345,7 +345,7 @@ _ol_style_Text_.prototype.setOverflow = function(overflow) { * @param {string|undefined} font Font. * @api */ -_ol_style_Text_.prototype.setFont = function(font) { +Text.prototype.setFont = function(font) { this.font_ = font; }; @@ -356,7 +356,7 @@ _ol_style_Text_.prototype.setFont = function(font) { * @param {number} maxAngle Angle in radians. * @api */ -_ol_style_Text_.prototype.setMaxAngle = function(maxAngle) { +Text.prototype.setMaxAngle = function(maxAngle) { this.maxAngle_ = maxAngle; }; @@ -367,7 +367,7 @@ _ol_style_Text_.prototype.setMaxAngle = function(maxAngle) { * @param {number} offsetX Horizontal text offset. * @api */ -_ol_style_Text_.prototype.setOffsetX = function(offsetX) { +Text.prototype.setOffsetX = function(offsetX) { this.offsetX_ = offsetX; }; @@ -378,7 +378,7 @@ _ol_style_Text_.prototype.setOffsetX = function(offsetX) { * @param {number} offsetY Vertical text offset. * @api */ -_ol_style_Text_.prototype.setOffsetY = function(offsetY) { +Text.prototype.setOffsetY = function(offsetY) { this.offsetY_ = offsetY; }; @@ -389,7 +389,7 @@ _ol_style_Text_.prototype.setOffsetY = function(offsetY) { * @param {ol.style.TextPlacement|string} placement Placement. * @api */ -_ol_style_Text_.prototype.setPlacement = function(placement) { +Text.prototype.setPlacement = function(placement) { this.placement_ = placement; }; @@ -400,7 +400,7 @@ _ol_style_Text_.prototype.setPlacement = function(placement) { * @param {ol.style.Fill} fill Fill style. * @api */ -_ol_style_Text_.prototype.setFill = function(fill) { +Text.prototype.setFill = function(fill) { this.fill_ = fill; }; @@ -411,7 +411,7 @@ _ol_style_Text_.prototype.setFill = function(fill) { * @param {number|undefined} rotation Rotation. * @api */ -_ol_style_Text_.prototype.setRotation = function(rotation) { +Text.prototype.setRotation = function(rotation) { this.rotation_ = rotation; }; @@ -422,7 +422,7 @@ _ol_style_Text_.prototype.setRotation = function(rotation) { * @param {number|undefined} scale Scale. * @api */ -_ol_style_Text_.prototype.setScale = function(scale) { +Text.prototype.setScale = function(scale) { this.scale_ = scale; }; @@ -433,7 +433,7 @@ _ol_style_Text_.prototype.setScale = function(scale) { * @param {ol.style.Stroke} stroke Stroke style. * @api */ -_ol_style_Text_.prototype.setStroke = function(stroke) { +Text.prototype.setStroke = function(stroke) { this.stroke_ = stroke; }; @@ -444,7 +444,7 @@ _ol_style_Text_.prototype.setStroke = function(stroke) { * @param {string|undefined} text Text. * @api */ -_ol_style_Text_.prototype.setText = function(text) { +Text.prototype.setText = function(text) { this.text_ = text; }; @@ -455,7 +455,7 @@ _ol_style_Text_.prototype.setText = function(text) { * @param {string|undefined} textAlign Text align. * @api */ -_ol_style_Text_.prototype.setTextAlign = function(textAlign) { +Text.prototype.setTextAlign = function(textAlign) { this.textAlign_ = textAlign; }; @@ -466,7 +466,7 @@ _ol_style_Text_.prototype.setTextAlign = function(textAlign) { * @param {string|undefined} textBaseline Text baseline. * @api */ -_ol_style_Text_.prototype.setTextBaseline = function(textBaseline) { +Text.prototype.setTextBaseline = function(textBaseline) { this.textBaseline_ = textBaseline; }; @@ -477,7 +477,7 @@ _ol_style_Text_.prototype.setTextBaseline = function(textBaseline) { * @param {ol.style.Fill} fill Fill style. * @api */ -_ol_style_Text_.prototype.setBackgroundFill = function(fill) { +Text.prototype.setBackgroundFill = function(fill) { this.backgroundFill_ = fill; }; @@ -488,7 +488,7 @@ _ol_style_Text_.prototype.setBackgroundFill = function(fill) { * @param {ol.style.Stroke} stroke Stroke style. * @api */ -_ol_style_Text_.prototype.setBackgroundStroke = function(stroke) { +Text.prototype.setBackgroundStroke = function(stroke) { this.backgroundStroke_ = stroke; }; @@ -499,7 +499,7 @@ _ol_style_Text_.prototype.setBackgroundStroke = function(stroke) { * @param {!Array.} padding Padding. * @api */ -_ol_style_Text_.prototype.setPadding = function(padding) { +Text.prototype.setPadding = function(padding) { this.padding_ = padding; }; -export default _ol_style_Text_; +export default Text; diff --git a/test/rendering/ol/layer/clip.test.js b/test/rendering/ol/layer/clip.test.js index c620fdcb5f..f179e8c3d9 100644 --- a/test/rendering/ol/layer/clip.test.js +++ b/test/rendering/ol/layer/clip.test.js @@ -3,8 +3,8 @@ import View from '../../../../src/ol/View.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; import TileLayer from '../../../../src/ol/layer/Tile.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'; +import Stroke from '../../../../src/ol/style/Stroke.js'; +import Style from '../../../../src/ol/style/Style.js'; describe('layer clipping', function() { @@ -69,8 +69,8 @@ describe('layer clipping', function() { [[[80, -40], [120, 0], [80, 40], [40, 0], [80, -40]]] ]).transform('EPSG:4326', 'EPSG:3857'); - var style = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + var style = new Style({ + stroke: new Stroke({ width: 2, color: 'blue' }) diff --git a/test/rendering/ol/layer/tile.test.js b/test/rendering/ol/layer/tile.test.js index 36ad343f77..d3b2c3783e 100644 --- a/test/rendering/ol/layer/tile.test.js +++ b/test/rendering/ol/layer/tile.test.js @@ -7,9 +7,9 @@ import _ol_obj_ from '../../../../src/ol/obj.js'; import {transform} from '../../../../src/ol/proj.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'; +import CircleStyle from '../../../../src/ol/style/Circle.js'; +import Fill from '../../../../src/ol/style/Fill.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -278,11 +278,11 @@ describe('ol.rendering.layer.Tile', function() { }); onAddLayer = function(evt) { evt.element.on('render', function(e) { - e.vectorContext.setImageStyle(new _ol_style_Circle_({ + e.vectorContext.setImageStyle(new CircleStyle({ radius: 5, snapToPixel: false, - fill: new _ol_style_Fill_({color: 'yellow'}), - stroke: new _ol_style_Stroke_({color: 'red', width: 1}) + fill: new Fill({color: 'yellow'}), + stroke: new Stroke({color: 'red', width: 1}) })); e.vectorContext.drawPoint(new Point( transform([-123, 38], 'EPSG:4326', 'EPSG:3857'))); diff --git a/test/rendering/ol/layer/vector.test.js b/test/rendering/ol/layer/vector.test.js index c034d5701b..b8e2e35a52 100644 --- a/test/rendering/ol/layer/vector.test.js +++ b/test/rendering/ol/layer/vector.test.js @@ -8,11 +8,11 @@ import Point from '../../../../src/ol/geom/Point.js'; import Polygon from '../../../../src/ol/geom/Polygon.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'; -import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; -import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; +import CircleStyle from '../../../../src/ol/style/Circle.js'; +import Fill from '../../../../src/ol/style/Fill.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; +import Style from '../../../../src/ol/style/Style.js'; +import Text from '../../../../src/ol/style/Text.js'; describe('ol.rendering.layer.Vector', function() { @@ -79,9 +79,9 @@ describe('ol.rendering.layer.Vector', function() { [center[0], center[1] - 1], [center[0], center[1] + 1] ])); - smallLine.setStyle(new _ol_style_Style_({ + smallLine.setStyle(new Style({ zIndex: -99, - stroke: new _ol_style_Stroke_({width: 75, color: 'red'}) + stroke: new Stroke({width: 75, color: 'red'}) })); source.addFeature(smallLine); addPolygon(100); @@ -105,9 +105,9 @@ describe('ol.rendering.layer.Vector', function() { [center[0], center[1] - 1], [center[0], center[1] + 1] ])); - smallLine.setStyle(new _ol_style_Style_({ + smallLine.setStyle(new Style({ zIndex: -99, - stroke: new _ol_style_Stroke_({width: 75, color: 'red'}) + stroke: new Stroke({width: 75, color: 'red'}) })); source.addFeature(smallLine); addPolygon(100); @@ -133,11 +133,11 @@ describe('ol.rendering.layer.Vector', function() { [center[0], center[1] + 1] ])); smallLine.setStyle([ - new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({width: 75, color: 'red'}) + new Style({ + stroke: new Stroke({width: 75, color: 'red'}) }), - new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({width: 45, color: 'white'}) + new Style({ + stroke: new Stroke({width: 45, color: 'white'}) }) ]); source.addFeature(smallLine); @@ -146,11 +146,11 @@ describe('ol.rendering.layer.Vector', function() { [center[0], center[1] + 1000] ])); smallLine2.setStyle([ - new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({width: 35, color: 'blue'}) + new Style({ + stroke: new Stroke({width: 35, color: 'blue'}) }), - new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({width: 15, color: 'green'}) + new Style({ + stroke: new Stroke({width: 15, color: 'green'}) }) ]); source.addFeature(smallLine2); @@ -172,11 +172,11 @@ describe('ol.rendering.layer.Vector', function() { [center[0], center[1] + 1] ])); smallLine.setStyle([ - new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({width: 75, color: 'red'}) + new Style({ + stroke: new Stroke({width: 75, color: 'red'}) }), - new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({width: 45, color: 'white'}) + new Style({ + stroke: new Stroke({width: 45, color: 'white'}) }) ]); source.addFeature(smallLine); @@ -185,11 +185,11 @@ describe('ol.rendering.layer.Vector', function() { [center[0], center[1] + 1000] ])); smallLine2.setStyle([ - new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({width: 35, color: 'blue'}) + new Style({ + stroke: new Stroke({width: 35, color: 'blue'}) }), - new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({width: 15, color: 'green'}) + new Style({ + stroke: new Stroke({width: 15, color: 'green'}) }) ]); source.addFeature(smallLine2); @@ -212,8 +212,8 @@ describe('ol.rendering.layer.Vector', function() { addCircle(500); map.addLayer(new VectorLayer({ source: source, - style: new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + style: new Style({ + stroke: new Stroke({ width: 2, color: 'black' }) @@ -233,8 +233,8 @@ describe('ol.rendering.layer.Vector', function() { map.addLayer(new VectorLayer({ renderMode: 'image', source: source, - style: new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + style: new Style({ + stroke: new Stroke({ width: 2, color: 'black' }) @@ -254,11 +254,11 @@ describe('ol.rendering.layer.Vector', function() { map.addLayer(new VectorLayer({ renderMode: 'image', source: source, - style: new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + style: new Style({ + fill: new Fill({ color: 'rgba(255,0,0,0.5)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ width: 2, color: 'black' }) @@ -285,8 +285,8 @@ describe('ol.rendering.layer.Vector', function() { addPolygon(720); map.addLayer(new VectorLayer({ source: source, - style: new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + style: new Style({ + stroke: new Stroke({ color: '#3399CC', width: 1.25 }) @@ -309,8 +309,8 @@ describe('ol.rendering.layer.Vector', function() { addLineString(720); map.addLayer(new VectorLayer({ source: source, - style: new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + style: new Style({ + stroke: new Stroke({ color: '#3399CC', width: 1.25 }) @@ -350,12 +350,12 @@ describe('ol.rendering.layer.Vector', function() { source: createSource(true), style: function(feature) { alternateColor(); - return new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + return new Style({ + stroke: new Stroke({ color: alternateColor(), width: 1.25 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: alternateColor() }) }); @@ -401,12 +401,12 @@ describe('ol.rendering.layer.Vector', function() { source: createSource(true), style: function(feature) { alternateColor(); - return new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + return new Style({ + stroke: new Stroke({ color: alternateColor(), width: 1.25 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: alternateColor() }) }); @@ -470,8 +470,8 @@ describe('ol.rendering.layer.Vector', function() { source: new VectorSource({ features: [feature] }), - style: new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + style: new Style({ + fill: new Fill({ color: 'blue' }) }) @@ -534,12 +534,12 @@ describe('ol.rendering.layer.Vector', function() { }); it('renders partially out-of-view polygons with a fill and stroke', function(done) { - layer.setStyle(new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + layer.setStyle(new Style({ + stroke: new Stroke({ color: [0, 0, 0, 1], width: 2 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: [255, 0, 0, 1] }) })); @@ -550,8 +550,8 @@ describe('ol.rendering.layer.Vector', function() { }); it('renders partially out-of-view polygons with a fill', function(done) { - layer.setStyle(new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + layer.setStyle(new Style({ + fill: new Fill({ color: [0, 0, 0, 1] }) })); @@ -562,8 +562,8 @@ describe('ol.rendering.layer.Vector', function() { }); it('renders partially out-of-view polygons with a stroke', function(done) { - layer.setStyle(new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + layer.setStyle(new Style({ + stroke: new Stroke({ color: [0, 0, 0, 1], width: 2 }) @@ -605,8 +605,8 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { - return new _ol_style_Style_({ - text: new _ol_style_Text_({ + return new Style({ + text: new Text({ text: feature.get('text'), font: '12px sans-serif' }) @@ -646,8 +646,8 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { - return new _ol_style_Style_({ - text: new _ol_style_Text_({ + return new Style({ + text: new Text({ text: feature.get('text'), font: '12px sans-serif' }) @@ -688,9 +688,9 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { - return new _ol_style_Style_({ + return new Style({ zIndex: feature.get('zIndex'), - text: new _ol_style_Text_({ + text: new Text({ text: feature.get('text'), font: '12px sans-serif' }) @@ -723,10 +723,10 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { - return new _ol_style_Style_({ - image: new _ol_style_Circle_({ + return new Style({ + image: new CircleStyle({ radius: 15, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue' }) }) @@ -763,10 +763,10 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { - return new _ol_style_Style_({ - image: new _ol_style_Circle_({ + return new Style({ + image: new CircleStyle({ radius: 15, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue' }) }) @@ -804,11 +804,11 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { - return new _ol_style_Style_({ + return new Style({ zIndex: feature.get('zIndex'), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 15, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue' }) }) @@ -843,14 +843,14 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { - return new _ol_style_Style_({ - image: new _ol_style_Circle_({ + return new Style({ + image: new CircleStyle({ radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue' }) }), - text: new _ol_style_Text_({ + text: new Text({ text: feature.get('text'), font: '12px sans-serif', textBaseline: 'bottom', @@ -873,10 +873,10 @@ describe('ol.rendering.layer.Vector', function() { map.addLayer(layer); var point = new Feature(new Point(center)); - point.setStyle(new _ol_style_Style_({ - image: new _ol_style_Circle_({ + point.setStyle(new Style({ + image: new CircleStyle({ radius: 8, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue' }) }) @@ -885,12 +885,12 @@ describe('ol.rendering.layer.Vector', function() { [center[0] - 650, center[1] - 200], [center[0] + 650, center[1] - 200] ])); - line.setStyle(new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + line.setStyle(new Style({ + stroke: new Stroke({ color: '#CCC', width: 12 }), - text: new _ol_style_Text_({ + text: new Text({ placement: 'line', text: 'east-west', font: '12px sans-serif' @@ -916,10 +916,10 @@ describe('ol.rendering.layer.Vector', function() { map.addLayer(layer); var point = new Feature(new Point(center)); - point.setStyle(new _ol_style_Style_({ - image: new _ol_style_Circle_({ + point.setStyle(new Style({ + image: new CircleStyle({ radius: 8, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue' }) }) @@ -928,12 +928,12 @@ describe('ol.rendering.layer.Vector', function() { [center[0] - 650, center[1] - 200], [center[0] + 650, center[1] - 200] ])); - line.setStyle(new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + line.setStyle(new Style({ + stroke: new Stroke({ color: '#CCC', width: 12 }), - text: new _ol_style_Text_({ + text: new Text({ placement: 'line', text: 'east-west', font: '12px sans-serif' @@ -959,11 +959,11 @@ describe('ol.rendering.layer.Vector', function() { map.addLayer(layer); var point = new Feature(new Point(center)); - point.setStyle(new _ol_style_Style_({ + point.setStyle(new Style({ zIndex: 2, - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 8, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue' }) }) @@ -972,13 +972,13 @@ describe('ol.rendering.layer.Vector', function() { [center[0] - 650, center[1] - 200], [center[0] + 650, center[1] - 200] ])); - line.setStyle(new _ol_style_Style_({ + line.setStyle(new Style({ zIndex: 1, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#CCC', width: 12 }), - text: new _ol_style_Text_({ + text: new Text({ placement: 'line', text: 'east-west', font: '12px sans-serif' diff --git a/test/rendering/ol/layer/vectortile.test.js b/test/rendering/ol/layer/vectortile.test.js index ecffba7886..afbf12b35a 100644 --- a/test/rendering/ol/layer/vectortile.test.js +++ b/test/rendering/ol/layer/vectortile.test.js @@ -4,14 +4,14 @@ import View from '../../../../src/ol/View.js'; import MVT from '../../../../src/ol/format/MVT.js'; import Point from '../../../../src/ol/geom/Point.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; -import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; +import VectorTileLayer from '../../../../src/ol/layer/VectorTile.js'; import _ol_obj_ from '../../../../src/ol/obj.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'; -import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; +import CircleStyle from '../../../../src/ol/style/Circle.js'; +import Fill from '../../../../src/ol/style/Fill.js'; +import Style from '../../../../src/ol/style/Style.js'; +import Text from '../../../../src/ol/style/Text.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -62,7 +62,7 @@ describe('ol.rendering.layer.VectorTile', function() { source: source }; _ol_obj_.assign(options, layerOptions); - map.addLayer(new _ol_layer_VectorTile_(options)); + map.addLayer(new VectorTileLayer(options)); } describe('vector tile layer', function() { @@ -104,10 +104,10 @@ describe('ol.rendering.layer.VectorTile', function() { map.addLayer(new VectorLayer({ zIndex: 1, source: vectorSource, - style: new _ol_style_Style_({ - image: new _ol_style_Circle_({ + style: new Style({ + image: new CircleStyle({ radius: 10, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'red' }) }) @@ -143,14 +143,14 @@ describe('ol.rendering.layer.VectorTile', function() { var style = function(feature, resolution) { var geom = feature.getGeometry(); if (geom.getType() == 'Point') { - return new _ol_style_Style_({ - image: new _ol_style_Circle_({ + return new Style({ + image: new CircleStyle({ radius: 7, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'red' }) }), - text: new _ol_style_Text_({ + text: new Text({ text: feature.get('name_en'), font: '12px sans-serif', textBaseline: 'bottom', diff --git a/test/rendering/ol/render.test.js b/test/rendering/ol/render.test.js index 8469c168a5..7756e93ab0 100644 --- a/test/rendering/ol/render.test.js +++ b/test/rendering/ol/render.test.js @@ -3,11 +3,11 @@ import Point from '../../../src/ol/geom/Point.js'; import Polygon from '../../../src/ol/geom/Polygon.js'; import _ol_render_ from '../../../src/ol/render.js'; import VectorContext from '../../../src/ol/render/VectorContext.js'; -import _ol_render_canvas_Immediate_ from '../../../src/ol/render/canvas/Immediate.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'; +import CanvasImmediateRenderer from '../../../src/ol/render/canvas/Immediate.js'; +import CircleStyle from '../../../src/ol/style/Circle.js'; +import Fill from '../../../src/ol/style/Fill.js'; +import Stroke from '../../../src/ol/style/Stroke.js'; +import Style from '../../../src/ol/style/Style.js'; function getContext() { return document.createElement('canvas').getContext('2d'); @@ -23,7 +23,7 @@ describe('ol.render', function() { size: [100, 100] }); expect(vectorContext).to.be.a(VectorContext); - expect(vectorContext).to.be.a(_ol_render_canvas_Immediate_); + expect(vectorContext).to.be.a(CanvasImmediateRenderer); }); it('can be used to render a point geometry', function(done) { @@ -33,9 +33,9 @@ describe('ol.render', function() { size: [100, 100] }); - var style = new _ol_style_Style_({ - image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + var style = new Style({ + image: new CircleStyle({ + fill: new Fill({ color: 'green' }), radius: 10 @@ -57,8 +57,8 @@ describe('ol.render', function() { size: [100, 100] }); - var style = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + var style = new Style({ + stroke: new Stroke({ color: 'red', width: 14 }) @@ -81,8 +81,8 @@ describe('ol.render', function() { size: [100, 100] }); - var style = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + var style = new Style({ + stroke: new Stroke({ lineCap: 'butt', color: 'red', width: 14 @@ -106,8 +106,8 @@ describe('ol.render', function() { size: [100, 100] }); - var style = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + var style = new Style({ + stroke: new Stroke({ lineJoin: 'bevel', color: 'red', width: 14 @@ -131,12 +131,12 @@ describe('ol.render', function() { size: [100, 100] }); - var style = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + var style = new Style({ + stroke: new Stroke({ color: 'blue', width: 8 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0,0,255,0.5)' }) }); @@ -160,8 +160,8 @@ describe('ol.render', function() { size: [100, 100] }); - var style = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + var style = new Style({ + stroke: new Stroke({ lineDash: [10, 5] }) }); @@ -185,8 +185,8 @@ describe('ol.render', function() { size: [100, 100] }); - var style = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + var style = new Style({ + stroke: new Stroke({ lineDash: [10, 5], lineDashOffset: 5 }) diff --git a/test/rendering/ol/reproj/image.test.js b/test/rendering/ol/reproj/image.test.js index 86dcff2f1b..eb8b7fb916 100644 --- a/test/rendering/ol/reproj/image.test.js +++ b/test/rendering/ol/reproj/image.test.js @@ -1,7 +1,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 ReprojImage from '../../../../src/ol/reproj/Image.js'; import Static from '../../../../src/ol/source/ImageStatic.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -14,7 +14,7 @@ describe('ol.rendering.reproj.Image', function() { var imagesRequested = 0; - var image = new _ol_reproj_Image_(sourceProj, getProjection(targetProj), + var image = new ReprojImage(sourceProj, getProjection(targetProj), targetExtent, targetResolution, pixelRatio, function(extent, resolution, pixelRatio) { imagesRequested++; diff --git a/test/rendering/ol/reproj/tile.test.js b/test/rendering/ol/reproj/tile.test.js index 4b27de01b0..7e71000b86 100644 --- a/test/rendering/ol/reproj/tile.test.js +++ b/test/rendering/ol/reproj/tile.test.js @@ -1,7 +1,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 ReprojTile from '../../../../src/ol/reproj/Tile.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'; @@ -16,7 +16,7 @@ describe('ol.rendering.reproj.Tile', function() { var tilesRequested = 0; - var tile = new _ol_reproj_Tile_(sourceProjection, source.getTileGrid(), + var tile = new ReprojTile(sourceProjection, source.getTileGrid(), getProjection(targetProjection), targetTileGrid, [z, x, y], null, pixelRatio, sourceGutter, function(z, x, y, pixelRatio) { diff --git a/test/rendering/ol/style/circle.test.js b/test/rendering/ol/style/circle.test.js index 4bf090bac1..97f042e3a8 100644 --- a/test/rendering/ol/style/circle.test.js +++ b/test/rendering/ol/style/circle.test.js @@ -5,10 +5,10 @@ import Map from '../../../../src/ol/Map.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'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import CircleStyle from '../../../../src/ol/style/Circle.js'; +import Fill from '../../../../src/ol/style/Fill.js'; +import Style from '../../../../src/ol/style/Style.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; describe('ol.rendering.style.Circle', function() { @@ -48,10 +48,10 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[-20, 18]]) : new Point([-20, 18]) }); - feature.setStyle(new _ol_style_Style_({ - image: new _ol_style_Circle_({ + feature.setStyle(new Style({ + image: new CircleStyle({ radius: 2, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#91E339' }) }) @@ -61,10 +61,10 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[-10, 18]]) : new Point([-10, 18]) }); - feature.setStyle(new _ol_style_Style_({ - image: new _ol_style_Circle_({ + feature.setStyle(new Style({ + image: new CircleStyle({ radius: 4, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#5447E6' }) }) @@ -74,10 +74,10 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[4, 18]]) : new Point([4, 18]) }); - feature.setStyle(new _ol_style_Style_({ - image: new _ol_style_Circle_({ + feature.setStyle(new Style({ + image: new CircleStyle({ radius: 6, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#92A8A6' }) }) @@ -87,13 +87,13 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[-20, 3]]) : new Point([-20, 3]) }); - feature.setStyle(new _ol_style_Style_({ - image: new _ol_style_Circle_({ + feature.setStyle(new Style({ + image: new CircleStyle({ radius: 2, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#91E339' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#000000', width: 1 }) @@ -104,13 +104,13 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[-10, 3]]) : new Point([-10, 3]) }); - feature.setStyle(new _ol_style_Style_({ - image: new _ol_style_Circle_({ + feature.setStyle(new Style({ + image: new CircleStyle({ radius: 4, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#5447E6' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#000000', width: 2 }) @@ -121,13 +121,13 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[4, 3]]) : new Point([4, 3]) }); - feature.setStyle(new _ol_style_Style_({ - image: new _ol_style_Circle_({ + feature.setStyle(new Style({ + image: new CircleStyle({ radius: 6, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#92A8A6' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#000000', width: 3 }) @@ -138,10 +138,10 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[-20, -15]]) : new Point([-20, -15]) }); - feature.setStyle(new _ol_style_Style_({ - image: new _ol_style_Circle_({ + feature.setStyle(new Style({ + image: new CircleStyle({ radius: 2, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#256308', width: 1 }) @@ -152,13 +152,13 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[-10, -15]]) : new Point([-10, -15]) }); - feature.setStyle(new _ol_style_Style_({ - image: new _ol_style_Circle_({ + feature.setStyle(new Style({ + image: new CircleStyle({ radius: 4, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0, 0, 255, 0.3)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#256308', width: 2 }) @@ -169,13 +169,13 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[4, -15]]) : new Point([4, -15]) }); - feature.setStyle(new _ol_style_Style_({ - image: new _ol_style_Circle_({ + feature.setStyle(new Style({ + image: new CircleStyle({ radius: 6, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(235, 45, 70, 0.6)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#256308', width: 3 }) diff --git a/test/rendering/ol/style/icon.test.js b/test/rendering/ol/style/icon.test.js index 234e437378..4ec3ab1fbc 100644 --- a/test/rendering/ol/style/icon.test.js +++ b/test/rendering/ol/style/icon.test.js @@ -4,8 +4,8 @@ import Map from '../../../../src/ol/Map.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'; +import Icon from '../../../../src/ol/style/Icon.js'; +import Style from '../../../../src/ol/style/Style.js'; describe('ol.rendering.style.Icon', function() { @@ -58,8 +58,8 @@ describe('ol.rendering.style.Icon', function() { var img = new Image(); img.onload = function() { imgInfo.img = img; - feature.setStyle(new _ol_style_Style_({ - image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ (imgInfo)) + feature.setStyle(new Style({ + image: new Icon(/** @type {olx.style.IconOptions} */ (imgInfo)) })); vectorSource.addFeature(feature); callback(); diff --git a/test/rendering/ol/style/linestring.test.js b/test/rendering/ol/style/linestring.test.js index 00cdfa5ee9..6286668361 100644 --- a/test/rendering/ol/style/linestring.test.js +++ b/test/rendering/ol/style/linestring.test.js @@ -4,8 +4,8 @@ import Map from '../../../../src/ol/Map.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'; +import Style from '../../../../src/ol/style/Style.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; describe('ol.rendering.style.LineString', function() { @@ -48,8 +48,8 @@ describe('ol.rendering.style.LineString', function() { [[-20, 20], [15, 20]] ) }); - feature.setStyle(new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({color: '#DE213A', width: 3}) + feature.setStyle(new Style({ + stroke: new Stroke({color: '#DE213A', width: 3}) })); vectorSource.addFeature(feature); @@ -58,8 +58,8 @@ describe('ol.rendering.style.LineString', function() { [[-20, 15], [15, 15]] ) }); - feature.setStyle(new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({color: '#9696EB', width: 1}) + feature.setStyle(new Style({ + stroke: new Stroke({color: '#9696EB', width: 1}) })); vectorSource.addFeature(feature); @@ -68,10 +68,10 @@ describe('ol.rendering.style.LineString', function() { [[-20, 10], [15, 10]] ) }); - feature.setStyle([new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({color: '#F2F211', width: 5}) - }), new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({color: '#292921', width: 1}) + feature.setStyle([new Style({ + stroke: new Stroke({color: '#F2F211', width: 5}) + }), new Style({ + stroke: new Stroke({color: '#292921', width: 1}) })]); vectorSource.addFeature(feature); @@ -80,8 +80,8 @@ describe('ol.rendering.style.LineString', function() { [[-20, -20], [-2, 0], [15, -20]] ) }); - feature.setStyle(new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + feature.setStyle(new Style({ + stroke: new Stroke({ color: '#000000', width: 2, lineCap: 'square', @@ -96,8 +96,8 @@ describe('ol.rendering.style.LineString', function() { [[-20, -15], [-2, 5], [15, -15]] ) }); - feature.setStyle(new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + feature.setStyle(new Style({ + stroke: new Stroke({ color: '#000000', width: 2, lineCap: 'square', diff --git a/test/rendering/ol/style/polygon.test.js b/test/rendering/ol/style/polygon.test.js index e1ac2fa2a8..905e9764a2 100644 --- a/test/rendering/ol/style/polygon.test.js +++ b/test/rendering/ol/style/polygon.test.js @@ -4,9 +4,9 @@ import Map from '../../../../src/ol/Map.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'; +import Fill from '../../../../src/ol/style/Fill.js'; +import Style from '../../../../src/ol/style/Style.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; describe('ol.rendering.style.Polygon', function() { @@ -44,7 +44,7 @@ describe('ol.rendering.style.Polygon', function() { describe('different types', function() { function createFeatures() { - var fill = new _ol_style_Fill_({color: 'red'}); + var fill = new Fill({color: 'red'}); var feature; // rectangle @@ -53,7 +53,7 @@ describe('ol.rendering.style.Polygon', function() { [[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]] ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ fill: fill })); vectorSource.addFeature(feature); @@ -66,7 +66,7 @@ describe('ol.rendering.style.Polygon', function() { ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ fill: fill })); vectorSource.addFeature(feature); @@ -80,7 +80,7 @@ describe('ol.rendering.style.Polygon', function() { ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ fill: fill })); vectorSource.addFeature(feature); @@ -104,7 +104,7 @@ describe('ol.rendering.style.Polygon', function() { describe('different types with stroke', function() { function createFeatures() { - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ width: 10, color: '#000', lineJoin: 'round', @@ -118,7 +118,7 @@ describe('ol.rendering.style.Polygon', function() { [[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]] ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ stroke: stroke })); vectorSource.addFeature(feature); @@ -131,7 +131,7 @@ describe('ol.rendering.style.Polygon', function() { ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ stroke: stroke })); vectorSource.addFeature(feature); @@ -145,7 +145,7 @@ describe('ol.rendering.style.Polygon', function() { ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ stroke: stroke })); vectorSource.addFeature(feature); @@ -178,8 +178,8 @@ describe('ol.rendering.style.Polygon', function() { [[-20, 10], [-20, 20], [-0, 20], [-0, 10], [-20, 10]] ]) }); - feature.setStyle(new _ol_style_Style_({ - fill: new _ol_style_Fill_({color: '#E31E10'}), + feature.setStyle(new Style({ + fill: new Fill({color: '#E31E10'}), zIndex: 2 })); vectorSource.addFeature(feature); @@ -190,8 +190,8 @@ describe('ol.rendering.style.Polygon', function() { [[-15, 5], [-15, 15], [5, 15], [5, 5], [-15, 5]] ]) }); - feature.setStyle(new _ol_style_Style_({ - fill: new _ol_style_Fill_({color: '#1A5E42'}), + feature.setStyle(new Style({ + fill: new Fill({color: '#1A5E42'}), zIndex: 3 })); vectorSource.addFeature(feature); @@ -202,8 +202,8 @@ describe('ol.rendering.style.Polygon', function() { [[-10, 0], [-10, 10], [10, 10], [10, 0], [-10, 0]] ]) }); - feature.setStyle(new _ol_style_Style_({ - fill: new _ol_style_Fill_({color: '#DEDE21'}), + feature.setStyle(new Style({ + fill: new Fill({color: '#DEDE21'}), zIndex: 1 })); vectorSource.addFeature(feature); @@ -235,9 +235,9 @@ describe('ol.rendering.style.Polygon', function() { [[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]] ]) }); - feature.setStyle(new _ol_style_Style_({ - fill: new _ol_style_Fill_({color: '#9696EB'}), - stroke: new _ol_style_Stroke_({color: '#9696EB', width: 1}) + feature.setStyle(new Style({ + fill: new Fill({color: '#9696EB'}), + stroke: new Stroke({color: '#9696EB', width: 1}) })); vectorSource.addFeature(feature); @@ -247,9 +247,9 @@ describe('ol.rendering.style.Polygon', function() { [[0, 10], [0, 20], [15, 20], [15, 10], [0, 10]] ]) }); - feature.setStyle(new _ol_style_Style_({ - fill: new _ol_style_Fill_({color: 'rgba(255, 0, 0, 0.1)'}), - stroke: new _ol_style_Stroke_({color: '#DE213A', width: 3}) + feature.setStyle(new Style({ + fill: new Fill({color: 'rgba(255, 0, 0, 0.1)'}), + stroke: new Stroke({color: '#DE213A', width: 3}) })); vectorSource.addFeature(feature); @@ -259,9 +259,9 @@ describe('ol.rendering.style.Polygon', function() { [[-20, -20], [-20, 5], [15, 5], [15, -20], [-20, -20]] ]) }); - feature.setStyle(new _ol_style_Style_({ - fill: new _ol_style_Fill_({color: 'rgba(18, 204, 105, 0.3)'}), - stroke: new _ol_style_Stroke_({color: '#032E17', width: 2}) + feature.setStyle(new Style({ + fill: new Fill({color: 'rgba(18, 204, 105, 0.3)'}), + stroke: new Stroke({color: '#032E17', width: 2}) })); vectorSource.addFeature(feature); } @@ -321,9 +321,9 @@ describe('ol.rendering.style.Polygon', function() { [[-20, -20], [-20, 20], [18, 20], [-20, -20]] ]) }); - feature.setStyle(new _ol_style_Style_({ - fill: new _ol_style_Fill_({color: createPattern()}), - stroke: new _ol_style_Stroke_({color: createRainbowGradient(), width: 3}) + feature.setStyle(new Style({ + fill: new Fill({color: createPattern()}), + stroke: new Stroke({color: createRainbowGradient(), width: 3}) })); vectorSource.addFeature(feature); } diff --git a/test/rendering/ol/style/regularshape.test.js b/test/rendering/ol/style/regularshape.test.js index ee120eda97..fca045054e 100644 --- a/test/rendering/ol/style/regularshape.test.js +++ b/test/rendering/ol/style/regularshape.test.js @@ -4,10 +4,10 @@ import Map from '../../../../src/ol/Map.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'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import Fill from '../../../../src/ol/style/Fill.js'; +import RegularShape from '../../../../src/ol/style/RegularShape.js'; +import Style from '../../../../src/ol/style/Style.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; describe('ol.rendering.style.RegularShape', function() { @@ -46,8 +46,8 @@ describe('ol.rendering.style.RegularShape', function() { geometry: new Point([-15, 15]) }); // square - feature.setStyle(new _ol_style_Style_({ - image: new _ol_style_RegularShape_({ + feature.setStyle(new Style({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 4, @@ -61,8 +61,8 @@ describe('ol.rendering.style.RegularShape', function() { geometry: new Point([8, 15]) }); // triangle - feature.setStyle(new _ol_style_Style_({ - image: new _ol_style_RegularShape_({ + feature.setStyle(new Style({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 3, @@ -77,8 +77,8 @@ describe('ol.rendering.style.RegularShape', function() { geometry: new Point([-10, -8]) }); // star - feature.setStyle(new _ol_style_Style_({ - image: new _ol_style_RegularShape_({ + feature.setStyle(new Style({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 5, @@ -93,8 +93,8 @@ describe('ol.rendering.style.RegularShape', function() { geometry: new Point([12, -8]) }); // cross - feature.setStyle(new _ol_style_Style_({ - image: new _ol_style_RegularShape_({ + feature.setStyle(new Style({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 4, @@ -108,8 +108,8 @@ describe('ol.rendering.style.RegularShape', function() { describe('#render', function() { - var stroke = new _ol_style_Stroke_({width: 2}); - var fill = new _ol_style_Fill_({color: 'red'}); + var stroke = new Stroke({width: 2}); + var fill = new Fill({color: 'red'}); it('tests the canvas renderer', function(done) { createMap('canvas'); @@ -119,7 +119,7 @@ describe('ol.rendering.style.RegularShape', function() { it('supports lineDash', function(done) { createMap('canvas'); - createFeatures(new _ol_style_Stroke_({ + createFeatures(new Stroke({ lineDash: [10, 5] })); expectResemble(map, 'rendering/ol/style/expected/regularshape-canvas-linedash.png', 5, done); @@ -127,7 +127,7 @@ describe('ol.rendering.style.RegularShape', function() { it('supports lineDashOffset', function(done) { createMap('canvas'); - createFeatures(new _ol_style_Stroke_({ + createFeatures(new Stroke({ lineDash: [10, 5], lineDashOffset: 5 })); @@ -143,8 +143,8 @@ describe('ol.rendering.style.RegularShape', function() { }); describe('uses the default fill and stroke color', function() { - var stroke = new _ol_style_Stroke_(); - var fill = new _ol_style_Fill_(); + var stroke = new Stroke(); + var fill = new Fill(); it('tests the canvas renderer', function(done) { createMap('canvas'); diff --git a/test/rendering/ol/style/text.test.js b/test/rendering/ol/style/text.test.js index 73fc4760e8..9bd39dab7d 100644 --- a/test/rendering/ol/style/text.test.js +++ b/test/rendering/ol/style/text.test.js @@ -8,10 +8,10 @@ import Map from '../../../../src/ol/Map.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'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import Text from '../../../../src/ol/style/Text.js'; +import Fill from '../../../../src/ol/style/Fill.js'; +import Style from '../../../../src/ol/style/Style.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; describe('ol.rendering.style.Text', function() { @@ -52,8 +52,8 @@ describe('ol.rendering.style.Text', function() { feature = new Feature({ geometry: new Point([-20, 18]) }); - feature.setStyle(new _ol_style_Style_({ - text: new _ol_style_Text_({ + feature.setStyle(new Style({ + text: new Text({ scale: scale, text: 'hello', font: '10px sans-serif' @@ -64,15 +64,15 @@ describe('ol.rendering.style.Text', function() { feature = new Feature({ geometry: new Point([-10, 0]) }); - feature.setStyle(new _ol_style_Style_({ - text: new _ol_style_Text_({ + feature.setStyle(new Style({ + text: new Text({ scale: scale, text: 'hello', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'red', font: '12px sans-serif' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#000', width: 3 }) @@ -83,13 +83,13 @@ describe('ol.rendering.style.Text', function() { feature = new Feature({ geometry: new Point([20, 10]) }); - feature.setStyle(new _ol_style_Style_({ - text: new _ol_style_Text_({ + feature.setStyle(new Style({ + text: new Text({ scale: scale, rotateWithView: true, text: 'hello', font: '10px sans-serif', - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: [10, 10, 10, 0.5] }) }) @@ -107,18 +107,18 @@ describe('ol.rendering.style.Text', function() { function createLineString(coords, textAlign, maxAngle, strokeColor, strokeWidth, scale) { var geom = new LineString(); geom.setFlatCoordinates('XY', coords); - var style = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + var style = new Style({ + stroke: new Stroke({ color: 'red' }), - text: new _ol_style_Text_({ + text: new Text({ text: 'Hello world', font: 'bold 14px sans-serif', scale: scale || 1, textAlign: textAlign, maxAngle: maxAngle, placement: 'line', - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: strokeColor || 'white', width: strokeWidth }) @@ -176,8 +176,8 @@ describe('ol.rendering.style.Text', function() { createMap('canvas'); var feature; feature = new Feature(new Point([25, 0])); - feature.setStyle(new _ol_style_Style_({ - text: new _ol_style_Text_({ + feature.setStyle(new Style({ + text: new Text({ text: 'Hello world\nleft', font: 'bold 14px sans-serif', textAlign: 'left' @@ -185,8 +185,8 @@ describe('ol.rendering.style.Text', function() { })); vectorSource.addFeature(feature); feature = new Feature(new Point([-25, 0])); - feature.setStyle(new _ol_style_Style_({ - text: new _ol_style_Text_({ + feature.setStyle(new Style({ + text: new Text({ text: 'Hello world\nright', font: 'bold 14px sans-serif', textAlign: 'right' @@ -194,8 +194,8 @@ describe('ol.rendering.style.Text', function() { })); vectorSource.addFeature(feature); feature = new Feature(new Point([0, 25])); - feature.setStyle(new _ol_style_Style_({ - text: new _ol_style_Text_({ + feature.setStyle(new Style({ + text: new Text({ text: 'Hello world\nbottom', font: 'bold 14px sans-serif', textBaseline: 'bottom' @@ -203,8 +203,8 @@ describe('ol.rendering.style.Text', function() { })); vectorSource.addFeature(feature); feature = new Feature(new Point([0, -25])); - feature.setStyle(new _ol_style_Style_({ - text: new _ol_style_Text_({ + feature.setStyle(new Style({ + text: new Text({ text: 'top\nHello world', font: 'bold 14px sans-serif', textBaseline: 'top' @@ -218,8 +218,8 @@ describe('ol.rendering.style.Text', function() { createMap('canvas'); var feature; feature = new Feature(new Point([0, 0])); - feature.setStyle(new _ol_style_Style_({ - text: new _ol_style_Text_({ + feature.setStyle(new Style({ + text: new Text({ text: 'Hello world\nleft', font: 'bold 14px sans-serif', textAlign: 'left', @@ -228,8 +228,8 @@ describe('ol.rendering.style.Text', function() { })); vectorSource.addFeature(feature); feature = new Feature(new Point([0, 0])); - feature.setStyle(new _ol_style_Style_({ - text: new _ol_style_Text_({ + feature.setStyle(new Style({ + text: new Text({ text: 'Hello world\nright', font: 'bold 14px sans-serif', textAlign: 'right', @@ -238,8 +238,8 @@ describe('ol.rendering.style.Text', function() { })); vectorSource.addFeature(feature); feature = new Feature(new Point([0, 0])); - feature.setStyle(new _ol_style_Style_({ - text: new _ol_style_Text_({ + feature.setStyle(new Style({ + text: new Text({ text: 'Hello world\nbottom', font: 'bold 14px sans-serif', textBaseline: 'bottom', @@ -248,8 +248,8 @@ describe('ol.rendering.style.Text', function() { })); vectorSource.addFeature(feature); feature = new Feature(new Point([0, 0])); - feature.setStyle(new _ol_style_Style_({ - text: new _ol_style_Text_({ + feature.setStyle(new Style({ + text: new Text({ text: 'top\nHello world', font: 'bold 14px sans-serif', textBaseline: 'top', @@ -273,8 +273,8 @@ describe('ol.rendering.style.Text', function() { line.translate(0, -100); geom.appendLineString(line); var feature = new Feature(geom); - feature.setStyle(new _ol_style_Style_({ - text: new _ol_style_Text_({ + feature.setStyle(new Style({ + text: new Text({ text: 'Hello world', placement: 'line', font: 'bold 30px sans-serif' @@ -290,8 +290,8 @@ describe('ol.rendering.style.Text', function() { var geom = new Polygon(null); geom.setFlatCoordinates('XY', polygon, [polygon.length]); var feature = new Feature(geom); - feature.setStyle(new _ol_style_Style_({ - text: new _ol_style_Text_({ + feature.setStyle(new Style({ + text: new Text({ text: 'Hello world', font: 'bold 24px sans-serif', placement: 'line', @@ -316,8 +316,8 @@ describe('ol.rendering.style.Text', function() { geom.translate(0, -60); multiPolygon.appendPolygon(geom); var feature = new Feature(multiPolygon); - feature.setStyle(new _ol_style_Style_({ - text: new _ol_style_Text_({ + feature.setStyle(new Style({ + text: new Text({ text: 'Hello world', font: 'bold 24px sans-serif', placement: 'line', @@ -333,20 +333,20 @@ describe('ol.rendering.style.Text', function() { createMap('canvas'); createFeatures(); var features = vectorSource.getFeatures(); - features[0].getStyle().getText().setBackgroundFill(new _ol_style_Fill_({ + features[0].getStyle().getText().setBackgroundFill(new Fill({ color: 'red' })); - features[1].getStyle().getText().setBackgroundFill(new _ol_style_Fill_({ + features[1].getStyle().getText().setBackgroundFill(new Fill({ color: 'red' })); - features[1].getStyle().getText().setBackgroundStroke(new _ol_style_Stroke_({ + features[1].getStyle().getText().setBackgroundStroke(new Stroke({ color: 'blue', width: 3 })); - features[2].getStyle().getText().setBackgroundFill(new _ol_style_Fill_({ + features[2].getStyle().getText().setBackgroundFill(new Fill({ color: 'red' })); - features[2].getStyle().getText().setBackgroundStroke(new _ol_style_Stroke_({ + features[2].getStyle().getText().setBackgroundStroke(new Stroke({ color: 'blue', width: 3 })); diff --git a/test/spec/ol/collection.test.js b/test/spec/ol/collection.test.js index 7d95628bb7..5bf7137a98 100644 --- a/test/spec/ol/collection.test.js +++ b/test/spec/ol/collection.test.js @@ -1,5 +1,5 @@ import _ol_events_ from '../../../src/ol/events.js'; -import _ol_Collection_ from '../../../src/ol/Collection.js'; +import Collection from '../../../src/ol/Collection.js'; import CollectionEventType from '../../../src/ol/CollectionEventType.js'; @@ -7,7 +7,7 @@ describe('ol.collection', function() { var collection; beforeEach(function() { - collection = new _ol_Collection_(); + collection = new Collection(); }); describe('create an empty collection', function() { @@ -21,7 +21,7 @@ describe('ol.collection', function() { describe('create a collection from an array', function() { it('creates the expected collection', function() { var array = [0, 1, 2]; - var collection = new _ol_Collection_(array); + var collection = new Collection(array); expect(collection.item(0)).to.eql(0); expect(collection.item(1)).to.eql(1); expect(collection.item(2)).to.eql(2); @@ -61,7 +61,7 @@ describe('ol.collection', function() { describe('insertAt', function() { it('inserts elements at the correct location', function() { - collection = new _ol_Collection_([0, 2]); + collection = new Collection([0, 2]); collection.insertAt(1, 1); expect(collection.item(0)).to.eql(0); expect(collection.item(1)).to.eql(1); @@ -80,7 +80,7 @@ describe('ol.collection', function() { describe('removeAt', function() { it('removes elements at the correction', function() { - var collection = new _ol_Collection_([0, 1, 2]); + var collection = new Collection([0, 1, 2]); collection.removeAt(1); expect(collection.item(0)).to.eql(0); expect(collection.item(1)).to.eql(2); @@ -110,13 +110,13 @@ describe('ol.collection', function() { describe('remove', function() { it('removes the first matching element', function() { - var collection = new _ol_Collection_([0, 1, 2]); + var collection = new Collection([0, 1, 2]); expect(collection.remove(1)).to.eql(1); expect(collection.getArray()).to.eql([0, 2]); expect(collection.getLength()).to.eql(2); }); it('fires a remove event', function() { - var collection = new _ol_Collection_([0, 1, 2]); + var collection = new Collection([0, 1, 2]); var cb = sinon.spy(); _ol_events_.listen(collection, CollectionEventType.REMOVE, cb); expect(collection.remove(1)).to.eql(1); @@ -124,13 +124,13 @@ describe('ol.collection', function() { expect(cb.lastCall.args[0].element).to.eql(1); }); it('does not remove more than one matching element', function() { - var collection = new _ol_Collection_([0, 1, 1, 2]); + var collection = new Collection([0, 1, 1, 2]); expect(collection.remove(1)).to.eql(1); expect(collection.getArray()).to.eql([0, 1, 2]); expect(collection.getLength()).to.eql(3); }); it('returns undefined if the element is not found', function() { - var collection = new _ol_Collection_([0, 1, 2]); + var collection = new Collection([0, 1, 2]); expect(collection.remove(3)).to.be(undefined); expect(collection.getArray()).to.eql([0, 1, 2]); expect(collection.getLength()).to.eql(3); @@ -139,7 +139,7 @@ describe('ol.collection', function() { describe('setAt and event', function() { it('does dispatch events', function() { - var collection = new _ol_Collection_(['a', 'b']); + var collection = new Collection(['a', 'b']); var added, removed; _ol_events_.listen(collection, CollectionEventType.ADD, function(e) { added = e.element; @@ -156,7 +156,7 @@ describe('ol.collection', function() { describe('removeAt and event', function() { it('does dispatch events', function() { - var collection = new _ol_Collection_(['a']); + var collection = new Collection(['a']); var removed; _ol_events_.listen( collection, CollectionEventType.REMOVE, function(e) { @@ -169,7 +169,7 @@ describe('ol.collection', function() { describe('insertAt and event', function() { it('does dispatch events', function() { - var collection = new _ol_Collection_([0, 2]); + var collection = new Collection([0, 2]); var added; _ol_events_.listen( collection, CollectionEventType.ADD, function(e) { @@ -202,7 +202,7 @@ describe('ol.collection', function() { describe('change:length event', function() { var collection, cb; beforeEach(function() { - collection = new _ol_Collection_([0, 1, 2]); + collection = new Collection([0, 1, 2]); cb = sinon.spy(); _ol_events_.listen(collection, 'change:length', cb); }); @@ -231,7 +231,7 @@ describe('ol.collection', function() { describe('add event', function() { it('triggers add when pushing', function() { - var collection = new _ol_Collection_(); + var collection = new Collection(); var elem; _ol_events_.listen(collection, CollectionEventType.ADD, function(e) { elem = e.element; @@ -244,7 +244,7 @@ describe('ol.collection', function() { describe('remove event', function() { var collection, cb1, cb2; beforeEach(function() { - collection = new _ol_Collection_([1]); + collection = new Collection([1]); cb1 = sinon.spy(); cb2 = sinon.spy(); }); @@ -275,7 +275,7 @@ describe('ol.collection', function() { expect(collection.item(1)).to.eql(2); }); it('fires events', function() { - var collection = new _ol_Collection_(); + var collection = new Collection(); var elems = []; _ol_events_.listen(collection, CollectionEventType.ADD, function(e) { elems.push(e.element); @@ -287,25 +287,25 @@ describe('ol.collection', function() { describe('unique collection', function() { it('allows unique items in the constructor', function() { - new _ol_Collection_([{}, {}, {}], {unique: true}); + new Collection([{}, {}, {}], {unique: true}); }); it('throws if duplicate items are passed to the constructor', function() { var item = {}; var call = function() { - new _ol_Collection_([item, item], {unique: true}); + new Collection([item, item], {unique: true}); }; expect(call).to.throwException(); }); it('allows unique items to be added via push', function() { - var unique = new _ol_Collection_(undefined, {unique: true}); + var unique = new Collection(undefined, {unique: true}); unique.push({}); unique.push({}); }); it('throws if duplicate items are added via push', function() { - var unique = new _ol_Collection_(undefined, {unique: true}); + var unique = new Collection(undefined, {unique: true}); var item = {}; unique.push(item); var call = function() { @@ -315,13 +315,13 @@ describe('ol.collection', function() { }); it('allows unique items to be added via insertAt', function() { - var unique = new _ol_Collection_(undefined, {unique: true}); + var unique = new Collection(undefined, {unique: true}); unique.insertAt(0, {}); unique.insertAt(0, {}); }); it('throws if duplicate items are added via insertAt', function() { - var unique = new _ol_Collection_(undefined, {unique: true}); + var unique = new Collection(undefined, {unique: true}); var item = {}; unique.insertAt(0, item); var call = function() { @@ -331,20 +331,20 @@ describe('ol.collection', function() { }); it('allows unique items to be added via setAt', function() { - var unique = new _ol_Collection_(undefined, {unique: true}); + var unique = new Collection(undefined, {unique: true}); unique.setAt(0, {}); unique.setAt(1, {}); }); it('allows items to be reset via setAt', function() { - var unique = new _ol_Collection_(undefined, {unique: true}); + var unique = new Collection(undefined, {unique: true}); var item = {}; unique.setAt(0, item); unique.setAt(0, item); }); it('throws if duplicate items are added via setAt', function() { - var unique = new _ol_Collection_(undefined, {unique: true}); + var unique = new Collection(undefined, {unique: true}); var item = {}; unique.setAt(0, item); var call = function() { diff --git a/test/spec/ol/control/attribution.test.js b/test/spec/ol/control/attribution.test.js index 3a54a14a76..6f7cf3f035 100644 --- a/test/spec/ol/control/attribution.test.js +++ b/test/spec/ol/control/attribution.test.js @@ -1,5 +1,5 @@ import Map from '../../../../src/ol/Map.js'; -import _ol_Tile_ from '../../../../src/ol/Tile.js'; +import Tile from '../../../../src/ol/Tile.js'; import View from '../../../../src/ol/View.js'; import Attribution from '../../../../src/ol/control/Attribution.js'; import TileLayer from '../../../../src/ol/layer/Tile.js'; @@ -50,7 +50,7 @@ describe('ol.control.Attribution', function() { map.getLayers().forEach(function(layer) { var source = layer.getSource(); source.getTile = function() { - var tile = new _ol_Tile_([0, 0, -1], 2 /* LOADED */); + var tile = new Tile([0, 0, -1], 2 /* LOADED */); tile.getImage = function() { var image = new Image(); image.width = 256; diff --git a/test/spec/ol/control/scaleline.test.js b/test/spec/ol/control/scaleline.test.js index 46e91db67e..179dc5f12f 100644 --- a/test/spec/ol/control/scaleline.test.js +++ b/test/spec/ol/control/scaleline.test.js @@ -2,7 +2,7 @@ import Map from '../../../../src/ol/Map.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'; +import Projection from '../../../../src/ol/proj/Projection.js'; describe('ol.control.ScaleLine', function() { var map; @@ -272,7 +272,7 @@ describe('ol.control.ScaleLine', function() { center: [0, 0], zoom: 0, resolutions: [1], - projection: new _ol_proj_Projection_({ + projection: new Projection({ code: 'METERS', units: 'm', getPointResolution: function(r) { @@ -286,7 +286,7 @@ describe('ol.control.ScaleLine', function() { center: [0, 0], zoom: 0, resolutions: [1], - projection: new _ol_proj_Projection_({ + projection: new Projection({ code: 'PIXELS', units: 'pixels', metersPerUnit: 1 / 1000, diff --git a/test/spec/ol/control/zoomslider.test.js b/test/spec/ol/control/zoomslider.test.js index 37c45a5ab0..cb0c20bc95 100644 --- a/test/spec/ol/control/zoomslider.test.js +++ b/test/spec/ol/control/zoomslider.test.js @@ -1,7 +1,7 @@ import Map from '../../../../src/ol/Map.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'; +import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js'; describe('ol.control.ZoomSlider', function() { var map, target, zoomslider; @@ -111,7 +111,7 @@ describe('ol.control.ZoomSlider', function() { control.element.firstChild.style.height = '10px'; map.renderSync(); var dragger = control.dragger_; - var event = new _ol_pointer_PointerEvent_('pointerdown', { + var event = new PointerEvent('pointerdown', { target: control.element.firstElementChild }); event.clientX = control.widthLimit_; @@ -143,7 +143,7 @@ describe('ol.control.ZoomSlider', function() { map.getView().setZoom(8); map.renderSync(); var dragger = control.dragger_; - var event = new _ol_pointer_PointerEvent_('pointerdown', { + var event = new PointerEvent('pointerdown', { target: control.element.firstElementChild }); event.clientX = 0; diff --git a/test/spec/ol/feature.test.js b/test/spec/ol/feature.test.js index 5efa4a85bf..36f2761450 100644 --- a/test/spec/ol/feature.test.js +++ b/test/spec/ol/feature.test.js @@ -1,7 +1,7 @@ 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'; +import Style from '../../../src/ol/style/Style.js'; describe('ol.Feature', function() { @@ -298,7 +298,7 @@ describe('ol.Feature', function() { describe('#setStyle()', function() { - var style = new _ol_style_Style_(); + var style = new Style(); var styleFunction = function(feature, resolution) { return resolution; @@ -355,7 +355,7 @@ describe('ol.Feature', function() { describe('#getStyle()', function() { - var style = new _ol_style_Style_(); + var style = new Style(); var styleFunction = function(resolution) { return null; @@ -403,7 +403,7 @@ describe('ol.Feature', function() { feature.setGeometryName('geom'); var geometry = new Point([1, 2]); feature.setGeometry(geometry); - var style = new _ol_style_Style_({}); + var style = new Style({}); feature.setStyle(style); feature.set('barkey', 'barval'); @@ -448,7 +448,7 @@ describe('ol.Feature', function() { }); describe('ol.Feature.createStyleFunction()', function() { - var style = new _ol_style_Style_(); + var style = new Style(); it('creates a feature style function from a single style', function() { var styleFunction = Feature.createStyleFunction(style); diff --git a/test/spec/ol/format/kml.test.js b/test/spec/ol/format/kml.test.js index ca6ca8f0cc..fa6b9775ae 100644 --- a/test/spec/ol/format/kml.test.js +++ b/test/spec/ol/format/kml.test.js @@ -11,16 +11,16 @@ 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 {addProjection, addCoordinateTransforms, transform, get as getProjection} from '../../../../src/ol/proj.js'; -import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; +import Projection from '../../../../src/ol/proj/Projection.js'; import {remove as removeTransform} from '../../../../src/ol/proj/transforms.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'; +import CircleStyle from '../../../../src/ol/style/Circle.js'; +import Fill from '../../../../src/ol/style/Fill.js'; +import Icon from '../../../../src/ol/style/Icon.js'; import IconAnchorUnits from '../../../../src/ol/style/IconAnchorUnits.js'; import IconOrigin from '../../../../src/ol/style/IconOrigin.js'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; -import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; +import Style from '../../../../src/ol/style/Style.js'; +import Text from '../../../../src/ol/style/Text.js'; import _ol_xml_ from '../../../../src/ol/xml.js'; @@ -30,7 +30,7 @@ describe('ol.format.KML', function() { describe('using defaultStyle', function() { - var dfltStyle = new _ol_style_Style_(); + var dfltStyle = new Style(); beforeEach(function() { format = new KML({ @@ -61,7 +61,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style).to.be(dfltStyle); }); }); @@ -356,7 +356,7 @@ describe('ol.format.KML', function() { }); it('can transform and write XYZ Point geometries', function() { - addProjection(new _ol_proj_Projection_({code: 'double'})); + addProjection(new Projection({code: 'double'})); addCoordinateTransforms('EPSG:4326', 'double', function(coordinate) { return [2 * coordinate[0], 2 * coordinate[1]]; @@ -1719,7 +1719,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); expect(style.getFill().getColor()).to.eql([255, 255, 255, 1]); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); @@ -1752,11 +1752,11 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); var imageStyle = style.getImage(); - expect(imageStyle).to.be.an(_ol_style_Icon_); + expect(imageStyle).to.be.an(Icon); expect(new URL(imageStyle.getSrc()).href).to.eql(new URL('http://foo.png').href); expect(imageStyle.getAnchor()).to.be(null); expect(imageStyle.getOrigin()).to.be(null); @@ -1832,11 +1832,11 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); var imageStyle = style.getImage(); - expect(imageStyle).to.be.an(_ol_style_Icon_); + expect(imageStyle).to.be.an(Icon); expect(new URL(imageStyle.getSrc()).href).to.eql(new URL('http://foo.png').href); expect(imageStyle.anchor_).to.be.an(Array); expect(imageStyle.anchor_).to.have.length(2); @@ -1903,7 +1903,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); var imageStyle = style.getImage(); @@ -1939,15 +1939,15 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); var textStyle = style.getText(); - expect(textStyle).to.be.an(_ol_style_Text_); + expect(textStyle).to.be.an(Text); expect(textStyle.getScale()).to.be(0.25); var textFillStyle = textStyle.getFill(); - expect(textFillStyle).to.be.an(_ol_style_Fill_); + expect(textFillStyle).to.be.an(Fill); expect(textFillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(style.getZIndex()).to.be(undefined); }); @@ -1974,11 +1974,11 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); var strokeStyle = style.getStroke(); - expect(strokeStyle).to.be.an(_ol_style_Stroke_); + expect(strokeStyle).to.be.an(Stroke); expect(strokeStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(strokeStyle.getWidth()).to.be(9); expect(style.getText()).to.be(KML.DEFAULT_TEXT_STYLE_); @@ -2006,9 +2006,9 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); var fillStyle = style.getFill(); - expect(fillStyle).to.be.an(_ol_style_Fill_); + expect(fillStyle).to.be.an(Fill); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); @@ -2043,13 +2043,13 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); var fillStyle = style.getFill(); - expect(fillStyle).to.be.an(_ol_style_Fill_); + expect(fillStyle).to.be.an(Fill); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); var strokeStyle = style.getStroke(); - expect(strokeStyle).to.be.an(_ol_style_Stroke_); + expect(strokeStyle).to.be.an(Stroke); expect(strokeStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(strokeStyle.getWidth()).to.be(9); expect(style.getText()).to.be(KML.DEFAULT_TEXT_STYLE_); @@ -2082,11 +2082,11 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getFill()).to.be(null); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); var strokeStyle = style.getStroke(); - expect(strokeStyle).to.be.an(_ol_style_Stroke_); + expect(strokeStyle).to.be.an(Stroke); expect(strokeStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(strokeStyle.getWidth()).to.be(9); expect(style.getText()).to.be(KML.DEFAULT_TEXT_STYLE_); @@ -2119,9 +2119,9 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); var fillStyle = style.getFill(); - expect(fillStyle).to.be.an(_ol_style_Fill_); + expect(fillStyle).to.be.an(Fill); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); expect(style.getStroke()).to.be(null); @@ -2157,7 +2157,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getFill()).to.be(null); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); expect(style.getStroke()).to.be(null); @@ -2210,7 +2210,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(2); var style = styleArray[1]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getText().getText()).to.eql(f.getProperties()['name']); }); @@ -2259,13 +2259,13 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(2); var style = styleArray[1]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getText().getText()).to.eql(f.getProperties()['name']); }); it('can write an feature\'s icon style', function() { - var style = new _ol_style_Style_({ - image: new _ol_style_Icon_({ + var style = new Style({ + image: new Icon({ anchor: [0.25, 36], anchorOrigin: 'top-left', anchorXUnits: 'fraction', @@ -2313,8 +2313,8 @@ describe('ol.format.KML', function() { it('does not write styles when writeStyles option is false', function() { format = new KML({writeStyles: false}); - var style = new _ol_style_Style_({ - image: new _ol_style_Icon_({ + var style = new Style({ + image: new Icon({ src: 'http://foo.png' }) }); @@ -2334,10 +2334,10 @@ describe('ol.format.KML', function() { }); it('skips image styles that are not icon styles', function() { - var style = new _ol_style_Style_({ - image: new _ol_style_Circle_({ + var style = new Style({ + image: new CircleStyle({ radius: 4, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgb(12, 34, 223)' }) }) @@ -2360,11 +2360,11 @@ describe('ol.format.KML', function() { }); it('can write an feature\'s text style', function() { - var style = new _ol_style_Style_({ - text: new _ol_style_Text_({ + var style = new Style({ + text: new Text({ scale: 0.5, text: 'foo', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgb(12, 34, 223)' }) }) @@ -2392,8 +2392,8 @@ describe('ol.format.KML', function() { }); it('can write an feature\'s stroke style', function() { - var style = new _ol_style_Style_({ - stroke: new _ol_style_Stroke_({ + var style = new Style({ + stroke: new Stroke({ color: '#112233', width: 2 }) @@ -2420,8 +2420,8 @@ describe('ol.format.KML', function() { }); it('can write an feature\'s fill style', function() { - var style = new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + var style = new Style({ + fill: new Fill({ color: 'rgba(12, 34, 223, 0.7)' }) }); @@ -2446,8 +2446,8 @@ describe('ol.format.KML', function() { }); it('can write multiple features with Style', function() { - var style = new _ol_style_Style_({ - fill: new _ol_style_Fill_({ + var style = new Style({ + fill: new Fill({ color: 'rgba(12, 34, 223, 0.7)' }) }); @@ -2513,7 +2513,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var s = styleArray[0]; - expect(s).to.be.an(_ol_style_Style_); + expect(s).to.be.an(Style); expect(s.getFill()).not.to.be(null); expect(s.getFill().getColor()).to.eql([0, 0, 0, 0]); }); @@ -2546,7 +2546,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var s = styleArray[0]; - expect(s).to.be.an(_ol_style_Style_); + expect(s).to.be.an(Style); expect(s).to.be(KML.DEFAULT_STYLE_); }); @@ -2587,7 +2587,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var s = styleArray[0]; - expect(s).to.be.an(_ol_style_Style_); + expect(s).to.be.an(Style); expect(s.getFill()).not.to.be(null); expect(s.getFill().getColor()).to.eql([0, 0, 0, 0]); }); @@ -2621,7 +2621,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var s = styleArray[0]; - expect(s).to.be.an(_ol_style_Style_); + expect(s).to.be.an(Style); expect(s.getFill()).not.to.be(null); expect(s.getFill().getColor()).to.eql([0, 0, 0, 0]); }); @@ -2655,7 +2655,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var s = styleArray[0]; - expect(s).to.be.an(_ol_style_Style_); + expect(s).to.be.an(Style); expect(s).to.be(KML.DEFAULT_STYLE_); }); @@ -2689,7 +2689,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var s = styleArray[0]; - expect(s).to.be.an(_ol_style_Style_); + expect(s).to.be.an(Style); expect(s.getFill()).not.to.be(null); expect(s.getFill().getColor()).to.eql([120, 86, 52, 18 / 255]); }); @@ -2722,9 +2722,9 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); var fillStyle = style.getFill(); - expect(fillStyle).to.be.an(_ol_style_Fill_); + expect(fillStyle).to.be.an(Fill); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); }); @@ -2754,9 +2754,9 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); var fillStyle = style.getFill(); - expect(fillStyle).to.be.an(_ol_style_Fill_); + expect(fillStyle).to.be.an(Fill); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); }); @@ -3207,9 +3207,9 @@ describe('ol.format.KML', function() { var styleArray = styleFunction.call(f, 0); expect(styleArray).to.be.an(Array); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); var imageStyle = style.getImage(); - expect(imageStyle).to.be.an(_ol_style_Icon_); + expect(imageStyle).to.be.an(Icon); expect(imageStyle.getSrc()).to.eql('http://maps.google.com/mapfiles/kml/shapes/star.png'); }); diff --git a/test/spec/ol/format/mvt.test.js b/test/spec/ol/format/mvt.test.js index 63470023b2..67c9de8eac 100644 --- a/test/spec/ol/format/mvt.test.js +++ b/test/spec/ol/format/mvt.test.js @@ -4,7 +4,7 @@ import MVT from '../../../../src/ol/format/MVT.js'; import Point from '../../../../src/ol/geom/Point.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; -import _ol_render_Feature_ from '../../../../src/ol/render/Feature.js'; +import RenderFeature from '../../../../src/ol/render/Feature.js'; where('ArrayBuffer.isView').describe('ol.format.MVT', function() { @@ -25,7 +25,7 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() { it('uses ol.render.Feature as feature class by default', function() { var format = new MVT({layers: ['water']}); var features = format.readFeatures(data); - expect(features[0]).to.be.a(_ol_render_Feature_); + expect(features[0]).to.be.a(RenderFeature); }); it('parses only specified layers', function() { @@ -185,7 +185,7 @@ describe('ol.format.MVT', function() { }; var feature = format.createFeature_({}, rawFeature); MVT.readRawGeometry_ = readRawGeometry_; - expect(feature).to.be.a(_ol_render_Feature_); + expect(feature).to.be.a(RenderFeature); expect(feature.getType()).to.be('Polygon'); expect(feature.getFlatCoordinates()).to.equal(createdFlatCoordinates); expect(feature.getEnds()).to.equal(createdEnds); diff --git a/test/spec/ol/graticule.test.js b/test/spec/ol/graticule.test.js index c57d73d3f0..8b62655278 100644 --- a/test/spec/ol/graticule.test.js +++ b/test/spec/ol/graticule.test.js @@ -1,8 +1,8 @@ import Graticule from '../../../src/ol/Graticule.js'; import Map from '../../../src/ol/Map.js'; import {get as getProjection} from '../../../src/ol/proj.js'; -import _ol_style_Stroke_ from '../../../src/ol/style/Stroke.js'; -import _ol_style_Text_ from '../../../src/ol/style/Text.js'; +import Stroke from '../../../src/ol/style/Stroke.js'; +import Text from '../../../src/ol/style/Text.js'; describe('ol.Graticule', function() { var graticule; @@ -54,12 +54,12 @@ describe('ol.Graticule', function() { var actualStyle = graticule.strokeStyle_; expect(actualStyle).not.to.be(undefined); - expect(actualStyle instanceof _ol_style_Stroke_).to.be(true); + expect(actualStyle instanceof Stroke).to.be(true); }); it('can be configured with a stroke style', function() { createGraticule(); - var customStrokeStyle = new _ol_style_Stroke_({ + var customStrokeStyle = new Stroke({ color: 'rebeccapurple' }); var styledGraticule = new Graticule({ @@ -73,8 +73,8 @@ describe('ol.Graticule', function() { }); it('can be configured with label options', function() { - var latLabelStyle = new _ol_style_Text_(); - var lonLabelStyle = new _ol_style_Text_(); + var latLabelStyle = new Text(); + var lonLabelStyle = new Text(); graticule = new Graticule({ map: new Map({}), showLabels: true, diff --git a/test/spec/ol/interaction/dragrotateandzoom.test.js b/test/spec/ol/interaction/dragrotateandzoom.test.js index 4c8ab28ffc..6bee0b0ca3 100644 --- a/test/spec/ol/interaction/dragrotateandzoom.test.js +++ b/test/spec/ol/interaction/dragrotateandzoom.test.js @@ -4,7 +4,7 @@ import View from '../../../../src/ol/View.js'; import DragRotateAndZoom from '../../../../src/ol/interaction/DragRotateAndZoom.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; -import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; +import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; describe('ol.interaction.DragRotateAndZoom', function() { @@ -59,7 +59,7 @@ describe('ol.interaction.DragRotateAndZoom', function() { it('does not rotate when rotation is disabled on the view', function() { var event = new MapBrowserPointerEvent('pointermove', map, - new _ol_pointer_PointerEvent_('pointermove', {clientX: 20, clientY: 10}, {pointerType: 'mouse'}), + new PointerEvent('pointermove', {clientX: 20, clientY: 10}, {pointerType: 'mouse'}), true); interaction.lastAngle_ = Math.PI; var spy = sinon.spy(Interaction, 'rotateWithoutConstraints'); @@ -73,7 +73,7 @@ describe('ol.interaction.DragRotateAndZoom', function() { enableRotation: false })); event = new MapBrowserPointerEvent('pointermove', map, - new _ol_pointer_PointerEvent_('pointermove', {clientX: 24, clientY: 16}, {pointerType: 'mouse'}), + new PointerEvent('pointermove', {clientX: 24, clientY: 16}, {pointerType: 'mouse'}), true); interaction.handleDragEvent_(event); expect(spy.callCount).to.be(1); diff --git a/test/spec/ol/interaction/draw.test.js b/test/spec/ol/interaction/draw.test.js index 5371118549..fab70bc755 100644 --- a/test/spec/ol/interaction/draw.test.js +++ b/test/spec/ol/interaction/draw.test.js @@ -15,7 +15,7 @@ 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 VectorLayer from '../../../../src/ol/layer/Vector.js'; -import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; +import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; @@ -68,7 +68,7 @@ describe('ol.interaction.Draw', function() { // calculated in case body has top < 0 (test runner with small window) var position = viewport.getBoundingClientRect(); var shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false; - var event = new _ol_pointer_PointerEvent_(type, { + var event = new PointerEvent(type, { clientX: position.left + x + width / 2, clientY: position.top + y + height / 2, shiftKey: shiftKey @@ -94,7 +94,7 @@ describe('ol.interaction.Draw', function() { freehand: true }); - var event = new _ol_pointer_PointerEvent_('pointerdown', { + var event = new PointerEvent('pointerdown', { clientX: 0, clientY: 0, shiftKey: false diff --git a/test/spec/ol/interaction/extent.test.js b/test/spec/ol/interaction/extent.test.js index 31c9278223..2eb75413d6 100644 --- a/test/spec/ol/interaction/extent.test.js +++ b/test/spec/ol/interaction/extent.test.js @@ -1,8 +1,8 @@ import Map from '../../../../src/ol/Map.js'; import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.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'; +import ExtentInteraction from '../../../../src/ol/interaction/Extent.js'; +import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js'; describe('ol.interaction.Extent', function() { var map, interaction; @@ -24,7 +24,7 @@ describe('ol.interaction.Extent', function() { }); map.renderSync(); - interaction = new _ol_interaction_Extent_(); + interaction = new ExtentInteraction(); map.addInteraction(interaction); }); @@ -50,7 +50,7 @@ describe('ol.interaction.Extent', function() { // calculated in case body has top < 0 (test runner with small window) var position = viewport.getBoundingClientRect(); var shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false; - var pointerEvent = new _ol_pointer_PointerEvent_(type, { + var pointerEvent = new PointerEvent(type, { type: type, button: button, clientX: position.left + x + width / 2, @@ -66,7 +66,7 @@ describe('ol.interaction.Extent', function() { it('can be configured with an extent', function() { expect(function() { - new _ol_interaction_Extent_({ + new ExtentInteraction({ extent: [-10, -10, 10, 10] }); }).to.not.throwException(); diff --git a/test/spec/ol/interaction/modify.test.js b/test/spec/ol/interaction/modify.test.js index eb38ad0780..5f40904133 100644 --- a/test/spec/ol/interaction/modify.test.js +++ b/test/spec/ol/interaction/modify.test.js @@ -1,4 +1,4 @@ -import _ol_Collection_ from '../../../../src/ol/Collection.js'; +import Collection from '../../../../src/ol/Collection.js'; import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.js'; import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js'; @@ -9,9 +9,9 @@ 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_interaction_Modify_ from '../../../../src/ol/interaction/Modify.js'; +import Modify from '../../../../src/ol/interaction/Modify.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; -import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; +import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; @@ -81,7 +81,7 @@ describe('ol.interaction.Modify', function() { var viewport = map.getViewport(); // calculated in case body has top < 0 (test runner with small window) var position = viewport.getBoundingClientRect(); - var pointerEvent = new _ol_pointer_PointerEvent_(type, { + var pointerEvent = new PointerEvent(type, { type: type, clientX: position.left + x + width / 2, clientY: position.top + y + height / 2, @@ -130,11 +130,11 @@ describe('ol.interaction.Modify', function() { var endevent = events[events.length - 1]; // first event should be modifystary - expect(startevent).to.be.an(_ol_interaction_Modify_.Event); + expect(startevent).to.be.an(Modify.Event); expect(startevent.type).to.eql('modifystart'); // last event should be modifyend - expect(endevent).to.be.an(_ol_interaction_Modify_.Event); + expect(endevent).to.be.an(Modify.Event); expect(endevent.type).to.eql('modifyend'); // make sure we get change events to events array @@ -153,8 +153,8 @@ describe('ol.interaction.Modify', function() { it('adds features to the RTree', function() { var feature = new Feature( new Point([0, 0])); - var features = new _ol_Collection_([feature]); - var modify = new _ol_interaction_Modify_({ + var features = new Collection([feature]); + var modify = new Modify({ features: features }); var rbushEntries = modify.rBush_.getAll(); @@ -164,8 +164,8 @@ describe('ol.interaction.Modify', function() { it('accepts feature without geometry', function() { var feature = new Feature(); - var features = new _ol_Collection_([feature]); - var modify = new _ol_interaction_Modify_({ + var features = new Collection([feature]); + var modify = new Modify({ features: features }); var rbushEntries = modify.rBush_.getAll(); @@ -181,7 +181,7 @@ describe('ol.interaction.Modify', function() { var feature = new Feature( new Point([0, 0])); var source = new VectorSource({features: [feature]}); - var modify = new _ol_interaction_Modify_({source: source}); + var modify = new Modify({source: source}); var rbushEntries = modify.rBush_.getAll(); expect(rbushEntries.length).to.be(1); expect(rbushEntries[0].feature).to.be(feature); @@ -199,8 +199,8 @@ describe('ol.interaction.Modify', function() { var second = features[1]; var secondRevision = second.getGeometry().getRevision(); - var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + var modify = new Modify({ + features: new Collection(features) }); map.addInteraction(modify); @@ -237,8 +237,8 @@ describe('ol.interaction.Modify', function() { var first = features[0]; var firstRevision = first.getGeometry().getRevision(); - var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + var modify = new Modify({ + features: new Collection(features) }); map.addInteraction(modify); @@ -273,8 +273,8 @@ describe('ol.interaction.Modify', function() { var first = features[0]; var firstRevision = first.getGeometry().getRevision(); - var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + var modify = new Modify({ + features: new Collection(features) }); map.addInteraction(modify); @@ -309,8 +309,8 @@ describe('ol.interaction.Modify', function() { var first = features[0]; var firstRevision = first.getGeometry().getRevision(); - var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + var modify = new Modify({ + features: new Collection(features) }); map.addInteraction(modify); @@ -347,8 +347,8 @@ describe('ol.interaction.Modify', function() { features.length = 0; features.push(lineFeature); - var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + var modify = new Modify({ + features: new Collection(features) }); map.addInteraction(modify); @@ -386,8 +386,8 @@ describe('ol.interaction.Modify', function() { features.length = 0; features.push(circleFeature); - var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + var modify = new Modify({ + features: new Collection(features) }); map.addInteraction(modify); @@ -417,8 +417,8 @@ describe('ol.interaction.Modify', function() { var modify, feature, events; beforeEach(function() { - modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + modify = new Modify({ + features: new Collection(features) }); map.addInteraction(modify); @@ -522,8 +522,8 @@ describe('ol.interaction.Modify', function() { var modify, feature, events; beforeEach(function() { - modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features), + modify = new Modify({ + features: new Collection(features), deleteCondition: _ol_events_condition_.doubleClick }); map.addInteraction(modify); @@ -575,8 +575,8 @@ describe('ol.interaction.Modify', function() { return false; }); - var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features), + var modify = new Modify({ + features: new Collection(features), insertVertexCondition: listenerSpy }); map.addInteraction(modify); @@ -621,8 +621,8 @@ describe('ol.interaction.Modify', function() { features.length = 0; features.push(feature); - var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + var modify = new Modify({ + features: new Collection(features) }); map.addInteraction(modify); @@ -657,8 +657,8 @@ describe('ol.interaction.Modify', function() { }); it('updates polygon segment data', function() { - var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + var modify = new Modify({ + features: new Collection(features) }); map.addInteraction(modify); @@ -697,8 +697,8 @@ describe('ol.interaction.Modify', function() { describe('#setActive', function() { it('removes the vertexFeature of deactivation', function() { - var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + var modify = new Modify({ + features: new Collection(features) }); map.addInteraction(modify); expect(modify.vertexFeature_).to.be(null); diff --git a/test/spec/ol/interaction/select.test.js b/test/spec/ol/interaction/select.test.js index b31a2faa71..659d9e48fc 100644 --- a/test/spec/ol/interaction/select.test.js +++ b/test/spec/ol/interaction/select.test.js @@ -1,4 +1,4 @@ -import _ol_Collection_ from '../../../../src/ol/Collection.js'; +import Collection from '../../../../src/ol/Collection.js'; import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.js'; import MapBrowserEventType from '../../../../src/ol/MapBrowserEventType.js'; @@ -6,9 +6,9 @@ import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.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 Select from '../../../../src/ol/interaction/Select.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; -import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; +import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; @@ -92,7 +92,7 @@ describe('ol.interaction.Select', function() { // calculated in case body has top < 0 (test runner with small window) var position = viewport.getBoundingClientRect(); var shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false; - var event = new _ol_pointer_PointerEvent_(type, { + var event = new PointerEvent(type, { clientX: position.left + x + width / 2, clientY: position.top + y + height / 2, shiftKey: shiftKey @@ -103,16 +103,16 @@ describe('ol.interaction.Select', function() { describe('constructor', function() { it('creates a new interaction', function() { - var select = new _ol_interaction_Select_(); - expect(select).to.be.a(_ol_interaction_Select_); + var select = new Select(); + expect(select).to.be.a(Select); expect(select).to.be.a(Interaction); }); describe('user-provided collection', function() { it('uses the user-provided collection', function() { - var features = new _ol_Collection_(); - var select = new _ol_interaction_Select_({features: features}); + var features = new Collection(); + var select = new Select({features: features}); expect(select.getFeatures()).to.be(features); }); @@ -124,7 +124,7 @@ describe('ol.interaction.Select', function() { var select; beforeEach(function() { - select = new _ol_interaction_Select_(); + select = new Select(); map.addInteraction(select); }); @@ -190,7 +190,7 @@ describe('ol.interaction.Select', function() { var select; beforeEach(function() { - select = new _ol_interaction_Select_({ + select = new Select({ multi: true }); map.addInteraction(select); @@ -239,7 +239,7 @@ describe('ol.interaction.Select', function() { var select; beforeEach(function() { - select = new _ol_interaction_Select_({ + select = new Select({ multi: true }); map.addInteraction(select); @@ -272,7 +272,7 @@ describe('ol.interaction.Select', function() { describe('with multi set to true', function() { it('only selects features that pass the filter', function() { - var select = new _ol_interaction_Select_({ + var select = new Select({ multi: true, filter: function(feature, layer) { return feature.get('type') === 'bar'; @@ -289,7 +289,7 @@ describe('ol.interaction.Select', function() { it('only selects features that pass the filter ' + 'using shift single-click', function() { - var select = new _ol_interaction_Select_({ + var select = new Select({ multi: true, filter: function(feature, layer) { return feature.get('type') === 'bar'; @@ -309,7 +309,7 @@ describe('ol.interaction.Select', function() { describe('with multi set to false', function() { it('only selects the first feature that passes the filter', function() { - var select = new _ol_interaction_Select_({ + var select = new Select({ multi: false, filter: function(feature, layer) { return feature.get('type') === 'bar'; @@ -324,7 +324,7 @@ describe('ol.interaction.Select', function() { it('only selects the first feature that passes the filter ' + 'using shift single-click', function() { - var select = new _ol_interaction_Select_({ + var select = new Select({ multi: false, filter: function(feature, layer) { return feature.get('type') === 'bar'; @@ -344,7 +344,7 @@ describe('ol.interaction.Select', function() { var interaction; beforeEach(function() { - interaction = new _ol_interaction_Select_(); + interaction = new Select(); map.addInteraction(interaction); }); afterEach(function() { @@ -372,7 +372,7 @@ describe('ol.interaction.Select', function() { var interaction; beforeEach(function() { - interaction = new _ol_interaction_Select_(); + interaction = new Select(); expect(interaction.getActive()).to.be(true); @@ -412,7 +412,7 @@ describe('ol.interaction.Select', function() { var interaction; beforeEach(function() { - interaction = new _ol_interaction_Select_(); + interaction = new Select(); expect(interaction.getActive()).to.be(true); }); diff --git a/test/spec/ol/interaction/snap.test.js b/test/spec/ol/interaction/snap.test.js index f8b5b48a35..fe1db01b4a 100644 --- a/test/spec/ol/interaction/snap.test.js +++ b/test/spec/ol/interaction/snap.test.js @@ -1,11 +1,11 @@ -import _ol_Collection_ from '../../../../src/ol/Collection.js'; +import Collection from '../../../../src/ol/Collection.js'; import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.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'; -import _ol_interaction_Snap_ from '../../../../src/ol/interaction/Snap.js'; +import Snap from '../../../../src/ol/interaction/Snap.js'; describe('ol.interaction.Snap', function() { @@ -13,8 +13,8 @@ describe('ol.interaction.Snap', function() { describe('constructor', function() { it('can be constructed without arguments', function() { - var instance = new _ol_interaction_Snap_(); - expect(instance).to.be.an(_ol_interaction_Snap_); + var instance = new Snap(); + expect(instance).to.be.an(Snap); }); }); @@ -57,8 +57,8 @@ describe('ol.interaction.Snap', function() { it('can handle XYZ coordinates', function() { var point = new Feature(new Point([0, 0, 123])); - var snapInteraction = new _ol_interaction_Snap_({ - features: new _ol_Collection_([point]) + var snapInteraction = new Snap({ + features: new Collection([point]) }); snapInteraction.setMap(map); @@ -67,15 +67,15 @@ describe('ol.interaction.Snap', function() { coordinate: [0, 0], map: map }; - _ol_interaction_Snap_.handleEvent_.call(snapInteraction, event); + Snap.handleEvent_.call(snapInteraction, event); // check that the coordinate is in XY and not XYZ expect(event.coordinate).to.eql([0, 0]); }); it('snaps to edges only', function() { var point = new Feature(new LineString([[-10, 0], [10, 0]])); - var snapInteraction = new _ol_interaction_Snap_({ - features: new _ol_Collection_([point]), + var snapInteraction = new Snap({ + features: new Collection([point]), pixelTolerance: 5, vertex: false }); @@ -86,14 +86,14 @@ describe('ol.interaction.Snap', function() { coordinate: [7, 4], map: map }; - _ol_interaction_Snap_.handleEvent_.call(snapInteraction, event); + Snap.handleEvent_.call(snapInteraction, event); expect(event.coordinate).to.eql([7, 0]); }); it('snaps to vertices only', function() { var point = new Feature(new LineString([[-10, 0], [10, 0]])); - var snapInteraction = new _ol_interaction_Snap_({ - features: new _ol_Collection_([point]), + var snapInteraction = new Snap({ + features: new Collection([point]), pixelTolerance: 5, edge: false }); @@ -104,14 +104,14 @@ describe('ol.interaction.Snap', function() { coordinate: [7, 4], map: map }; - _ol_interaction_Snap_.handleEvent_.call(snapInteraction, event); + Snap.handleEvent_.call(snapInteraction, event); expect(event.coordinate).to.eql([10, 0]); }); it('snaps to circle', function() { var circle = new Feature(new Circle([0, 0], 10)); - var snapInteraction = new _ol_interaction_Snap_({ - features: new _ol_Collection_([circle]), + var snapInteraction = new Snap({ + features: new Collection([circle]), pixelTolerance: 5 }); snapInteraction.setMap(map); @@ -121,7 +121,7 @@ describe('ol.interaction.Snap', function() { coordinate: [5, 5], map: map }; - _ol_interaction_Snap_.handleEvent_.call(snapInteraction, event); + Snap.handleEvent_.call(snapInteraction, event); expect(event.coordinate[0]).to.roughlyEqual(Math.sin(Math.PI / 4) * 10, 1e-10); expect(event.coordinate[1]).to.roughlyEqual(Math.sin(Math.PI / 4) * 10, 1e-10); @@ -129,8 +129,8 @@ describe('ol.interaction.Snap', function() { it('handle feature without geometry', function() { var feature = new Feature(); - var snapInteraction = new _ol_interaction_Snap_({ - features: new _ol_Collection_([feature]), + var snapInteraction = new Snap({ + features: new Collection([feature]), pixelTolerance: 5, edge: false }); @@ -143,14 +143,14 @@ describe('ol.interaction.Snap', function() { coordinate: [7, 4], map: map }; - _ol_interaction_Snap_.handleEvent_.call(snapInteraction, event); + Snap.handleEvent_.call(snapInteraction, event); expect(event.coordinate).to.eql([10, 0]); }); it('handle geometry changes', function() { var line = new Feature(new LineString([[-10, 0], [0, 0]])); - var snapInteraction = new _ol_interaction_Snap_({ - features: new _ol_Collection_([line]), + var snapInteraction = new Snap({ + features: new Collection([line]), pixelTolerance: 5, edge: false }); @@ -163,7 +163,7 @@ describe('ol.interaction.Snap', function() { coordinate: [7, 4], map: map }; - _ol_interaction_Snap_.handleEvent_.call(snapInteraction, event); + Snap.handleEvent_.call(snapInteraction, event); expect(event.coordinate).to.eql([10, 0]); }); @@ -172,8 +172,8 @@ describe('ol.interaction.Snap', function() { geometry: new LineString([[-10, 0], [0, 0]]), alt_geometry: new LineString([[-10, 0], [10, 0]]) }); - var snapInteraction = new _ol_interaction_Snap_({ - features: new _ol_Collection_([line]), + var snapInteraction = new Snap({ + features: new Collection([line]), pixelTolerance: 5, edge: false }); @@ -186,7 +186,7 @@ describe('ol.interaction.Snap', function() { coordinate: [7, 4], map: map }; - _ol_interaction_Snap_.handleEvent_.call(snapInteraction, event); + Snap.handleEvent_.call(snapInteraction, event); expect(event.coordinate).to.eql([10, 0]); }); diff --git a/test/spec/ol/interaction/translate.test.js b/test/spec/ol/interaction/translate.test.js index 4d080b44bc..63fe582a41 100644 --- a/test/spec/ol/interaction/translate.test.js +++ b/test/spec/ol/interaction/translate.test.js @@ -1,4 +1,4 @@ -import _ol_Collection_ from '../../../../src/ol/Collection.js'; +import Collection from '../../../../src/ol/Collection.js'; import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.js'; import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js'; @@ -7,7 +7,7 @@ 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 VectorLayer from '../../../../src/ol/layer/Vector.js'; -import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; +import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; @@ -67,7 +67,7 @@ describe('ol.interaction.Translate', function() { var position = viewport.getBoundingClientRect(); var shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false; var event = new MapBrowserPointerEvent(type, map, - new _ol_pointer_PointerEvent_(type, { + new PointerEvent(type, { clientX: position.left + x + width / 2, clientY: position.top + y + height / 2, shiftKey: shiftKey @@ -159,7 +159,7 @@ describe('ol.interaction.Translate', function() { beforeEach(function() { translate = new _ol_interaction_Translate_({ - features: new _ol_Collection_([features[0]]) + features: new Collection([features[0]]) }); map.addInteraction(translate); }); diff --git a/test/spec/ol/layer/group.test.js b/test/spec/ol/layer/group.test.js index b2c1097772..987de1dee3 100644 --- a/test/spec/ol/layer/group.test.js +++ b/test/spec/ol/layer/group.test.js @@ -1,9 +1,9 @@ import {getUid} from '../../../../src/ol/index.js'; import {stableSort} from '../../../../src/ol/array.js'; -import _ol_Collection_ from '../../../../src/ol/Collection.js'; +import Collection from '../../../../src/ol/Collection.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js'; -import _ol_layer_Group_ from '../../../../src/ol/layer/Group.js'; -import _ol_layer_Layer_ from '../../../../src/ol/layer/Layer.js'; +import LayerGroup from '../../../../src/ol/layer/Group.js'; +import Layer from '../../../../src/ol/layer/Layer.js'; import _ol_obj_ from '../../../../src/ol/obj.js'; import MapRenderer from '../../../../src/ol/renderer/Map.js'; import Source from '../../../../src/ol/source/Source.js'; @@ -16,7 +16,7 @@ describe('ol.layer.Group', function() { var layerGroup; beforeEach(function() { - layerGroup = new _ol_layer_Group_(); + layerGroup = new LayerGroup(); }); afterEach(function() { @@ -24,7 +24,7 @@ describe('ol.layer.Group', function() { }); it('creates an instance', function() { - expect(layerGroup).to.be.a(_ol_layer_Group_); + expect(layerGroup).to.be.a(LayerGroup); }); it('provides default opacity', function() { @@ -50,7 +50,7 @@ describe('ol.layer.Group', function() { }); it('provides default empty layers collection', function() { - expect(layerGroup.getLayers()).to.be.a(_ol_Collection_); + expect(layerGroup.getLayers()).to.be.a(Collection); expect(layerGroup.getLayers().getLength()).to.be(0); }); @@ -60,12 +60,12 @@ describe('ol.layer.Group', function() { var layer, group, listener; beforeEach(function() { - layer = new _ol_layer_Layer_({ + layer = new Layer({ source: new Source({ projection: 'EPSG:4326' }) }); - group = new _ol_layer_Group_({ + group = new LayerGroup({ layers: [layer] }); listener = sinon.spy(); @@ -99,12 +99,12 @@ describe('ol.layer.Group', function() { var layer, group, listener; beforeEach(function() { - layer = new _ol_layer_Layer_({ + layer = new Layer({ source: new Source({ projection: 'EPSG:4326' }) }); - group = new _ol_layer_Group_({ + group = new LayerGroup({ layers: [layer] }); listener = sinon.spy(); @@ -137,12 +137,12 @@ describe('ol.layer.Group', function() { describe('constructor (options)', function() { it('accepts options', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ source: new Source({ projection: 'EPSG:4326' }) }); - var layerGroup = new _ol_layer_Group_({ + var layerGroup = new LayerGroup({ layers: [layer], opacity: 0.5, visible: false, @@ -166,7 +166,7 @@ describe('ol.layer.Group', function() { maxResolution: 500, minResolution: 0.25 }); - expect(layerGroup.getLayers()).to.be.a(_ol_Collection_); + expect(layerGroup.getLayers()).to.be.a(Collection); expect(layerGroup.getLayers().getLength()).to.be(1); expect(layerGroup.getLayers().item(0)).to.be(layer); @@ -175,14 +175,14 @@ describe('ol.layer.Group', function() { }); it('accepts an extent option', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ source: new Source({ projection: 'EPSG:4326' }) }); var groupExtent = [-10, -5, 10, 5]; - var layerGroup = new _ol_layer_Group_({ + var layerGroup = new LayerGroup({ layers: [layer], opacity: 0.5, visible: false, @@ -207,7 +207,7 @@ describe('ol.layer.Group', function() { maxResolution: 500, minResolution: 0.25 }); - expect(layerGroup.getLayers()).to.be.a(_ol_Collection_); + expect(layerGroup.getLayers()).to.be.a(Collection); expect(layerGroup.getLayers().getLength()).to.be(1); expect(layerGroup.getLayers().item(0)).to.be(layer); @@ -221,7 +221,7 @@ describe('ol.layer.Group', function() { var layerGroup; beforeEach(function() { - layerGroup = new _ol_layer_Group_(); + layerGroup = new LayerGroup(); }); afterEach(function() { @@ -284,12 +284,12 @@ describe('ol.layer.Group', function() { describe('layers events', function() { it('listen / unlisten for layers added to the collection', function() { - var layers = new _ol_Collection_(); - var layerGroup = new _ol_layer_Group_({ + var layers = new Collection(); + var layerGroup = new LayerGroup({ layers: layers }); expect(Object.keys(layerGroup.listenerKeys_).length).to.eql(0); - var layer = new _ol_layer_Layer_({}); + var layer = new Layer({}); layers.push(layer); expect(Object.keys(layerGroup.listenerKeys_).length).to.eql(1); @@ -310,13 +310,13 @@ describe('ol.layer.Group', function() { describe('#setLayers', function() { it('sets layers property', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ source: new Source({ projection: 'EPSG:4326' }) }); - var layers = new _ol_Collection_([layer]); - var layerGroup = new _ol_layer_Group_(); + var layers = new Collection([layer]); + var layerGroup = new LayerGroup(); layerGroup.setLayers(layers); expect(layerGroup.getLayers()).to.be(layers); @@ -332,7 +332,7 @@ describe('ol.layer.Group', function() { describe('#getLayerStatesArray', function() { it('returns an empty array if no layer', function() { - var layerGroup = new _ol_layer_Group_(); + var layerGroup = new LayerGroup(); var layerStatesArray = layerGroup.getLayerStatesArray(); expect(layerStatesArray).to.be.a(Array); @@ -341,12 +341,12 @@ describe('ol.layer.Group', function() { layerGroup.dispose(); }); - var layer1 = new _ol_layer_Layer_({ + var layer1 = new Layer({ source: new Source({ projection: 'EPSG:4326' }) }); - var layer2 = new _ol_layer_Layer_({ + var layer2 = new Layer({ source: new Source({ projection: 'EPSG:4326' }), @@ -355,7 +355,7 @@ describe('ol.layer.Group', function() { maxResolution: 500, minResolution: 0.25 }); - var layer3 = new _ol_layer_Layer_({ + var layer3 = new Layer({ source: new Source({ projection: 'EPSG:4326' }), @@ -363,7 +363,7 @@ describe('ol.layer.Group', function() { }); it('does not transform layerStates by default', function() { - var layerGroup = new _ol_layer_Group_({ + var layerGroup = new LayerGroup({ layers: [layer1, layer2] }); @@ -386,7 +386,7 @@ describe('ol.layer.Group', function() { it('uses the layer group extent if layer has no extent', function() { var groupExtent = [-10, -5, 10, 5]; - var layerGroup = new _ol_layer_Group_({ + var layerGroup = new LayerGroup({ extent: groupExtent, layers: [layer1] }); @@ -397,7 +397,7 @@ describe('ol.layer.Group', function() { it('uses the intersection of group and child extent', function() { var groupExtent = [-10, -5, 10, 5]; - var layerGroup = new _ol_layer_Group_({ + var layerGroup = new LayerGroup({ extent: groupExtent, layers: [layer3] }); @@ -408,7 +408,7 @@ describe('ol.layer.Group', function() { }); it('transforms layerStates correctly', function() { - var layerGroup = new _ol_layer_Group_({ + var layerGroup = new LayerGroup({ layers: [layer1, layer2], opacity: 0.5, visible: false, @@ -446,7 +446,7 @@ describe('ol.layer.Group', function() { }); it('let order of layers without Z-index unchanged', function() { - var layerGroup = new _ol_layer_Group_({ + var layerGroup = new LayerGroup({ layers: [layer1, layer2] }); @@ -460,21 +460,21 @@ describe('ol.layer.Group', function() { }); it('orders layer with higher Z-index on top', function() { - var layer10 = new _ol_layer_Layer_({ + var layer10 = new Layer({ source: new Source({ projection: 'EPSG:4326' }) }); layer10.setZIndex(10); - var layerM1 = new _ol_layer_Layer_({ + var layerM1 = new Layer({ source: new Source({ projection: 'EPSG:4326' }) }); layerM1.setZIndex(-1); - var layerGroup = new _ol_layer_Group_({ + var layerGroup = new LayerGroup({ layers: [layer1, layer10, layer2, layerM1] }); diff --git a/test/spec/ol/layer/layer.test.js b/test/spec/ol/layer/layer.test.js index 1ae8063886..5d70109549 100644 --- a/test/spec/ol/layer/layer.test.js +++ b/test/spec/ol/layer/layer.test.js @@ -1,8 +1,8 @@ import {getUid} from '../../../../src/ol/index.js'; import Map from '../../../../src/ol/Map.js'; -import _ol_layer_Layer_ from '../../../../src/ol/layer/Layer.js'; +import Layer from '../../../../src/ol/layer/Layer.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; -import _ol_render_Event_ from '../../../../src/ol/render/Event.js'; +import RenderEvent from '../../../../src/ol/render/Event.js'; import Source from '../../../../src/ol/source/Source.js'; @@ -13,7 +13,7 @@ describe('ol.layer.Layer', function() { var layer; beforeEach(function() { - layer = new _ol_layer_Layer_({ + layer = new Layer({ source: new Source({ projection: getProjection('EPSG:4326') }) @@ -25,7 +25,7 @@ describe('ol.layer.Layer', function() { }); it('creates an instance', function() { - expect(layer).to.be.a(_ol_layer_Layer_); + expect(layer).to.be.a(Layer); }); it('provides default opacity', function() { @@ -63,7 +63,7 @@ describe('ol.layer.Layer', function() { describe('constructor (options)', function() { it('accepts options', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ source: new Source({ projection: getProjection('EPSG:4326') }), @@ -101,7 +101,7 @@ describe('ol.layer.Layer', function() { var layer; beforeEach(function() { - layer = new _ol_layer_Layer_({ + layer = new Layer({ source: new Source({ projection: getProjection('EPSG:4326') }) @@ -117,7 +117,7 @@ describe('ol.layer.Layer', function() { layer.setMinResolution(3); layer.setMaxResolution(5); var layerState = layer.getLayerState(); - expect(_ol_layer_Layer_.visibleAtResolution(layerState, 4)).to.be(false); + expect(Layer.visibleAtResolution(layerState, 4)).to.be(false); }); it('returns false if resolution lower than minResolution', function() { @@ -125,7 +125,7 @@ describe('ol.layer.Layer', function() { layer.setMinResolution(3); layer.setMaxResolution(5); var layerState = layer.getLayerState(); - expect(_ol_layer_Layer_.visibleAtResolution(layerState, 2)).to.be(false); + expect(Layer.visibleAtResolution(layerState, 2)).to.be(false); }); it('returns false if resolution greater than maxResolution', function() { @@ -133,7 +133,7 @@ describe('ol.layer.Layer', function() { layer.setMinResolution(3); layer.setMaxResolution(5); var layerState = layer.getLayerState(); - expect(_ol_layer_Layer_.visibleAtResolution(layerState, 6)).to.be(false); + expect(Layer.visibleAtResolution(layerState, 6)).to.be(false); }); it('returns true otherwise', function() { @@ -141,7 +141,7 @@ describe('ol.layer.Layer', function() { layer.setMinResolution(3); layer.setMaxResolution(5); var layerState = layer.getLayerState(); - expect(_ol_layer_Layer_.visibleAtResolution(layerState, 4)).to.be(true); + expect(Layer.visibleAtResolution(layerState, 4)).to.be(true); }); }); @@ -151,7 +151,7 @@ describe('ol.layer.Layer', function() { var layer; beforeEach(function() { - layer = new _ol_layer_Layer_({ + layer = new Layer({ source: new Source({ projection: getProjection('EPSG:4326') }) @@ -217,7 +217,7 @@ describe('ol.layer.Layer', function() { it('gets the layer source', function() { var source = new Source({projection: getProjection('EPSG:4326')}); - var layer = new _ol_layer_Layer_({source: source}); + var layer = new Layer({source: source}); expect(layer.getSource()).to.be(source); }); @@ -227,7 +227,7 @@ describe('ol.layer.Layer', function() { var projection = getProjection('EPSG:4326'); it('sets the layer source', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ source: new Source({projection: projection}) }); @@ -237,7 +237,7 @@ describe('ol.layer.Layer', function() { }); it('calls changed', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ source: new Source({projection: projection}) }); sinon.spy(layer, 'changed'); @@ -248,10 +248,10 @@ describe('ol.layer.Layer', function() { }); it('sets up event listeners', function() { - sinon.spy(_ol_layer_Layer_.prototype, 'handleSourceChange_'); + sinon.spy(Layer.prototype, 'handleSourceChange_'); var first = new Source({projection: projection}); - var layer = new _ol_layer_Layer_({source: first}); + var layer = new Layer({source: first}); first.setState('ready'); expect(layer.handleSourceChange_.calledOnce).to.be(true); @@ -264,7 +264,7 @@ describe('ol.layer.Layer', function() { expect(layer.handleSourceChange_.callCount).to.be(2); // remove spy - _ol_layer_Layer_.prototype.handleSourceChange_.restore(); + Layer.prototype.handleSourceChange_.restore(); }); }); @@ -273,7 +273,7 @@ describe('ol.layer.Layer', function() { var projection = getProjection('EPSG:4326'); it('sets the layer source', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ source: new Source({projection: projection}) }); @@ -283,7 +283,7 @@ describe('ol.layer.Layer', function() { }); it('calls changed', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ source: new Source({projection: projection}) }); sinon.spy(layer, 'changed'); @@ -294,10 +294,10 @@ describe('ol.layer.Layer', function() { }); it('sets up event listeners', function() { - sinon.spy(_ol_layer_Layer_.prototype, 'handleSourceChange_'); + sinon.spy(Layer.prototype, 'handleSourceChange_'); var first = new Source({projection: projection}); - var layer = new _ol_layer_Layer_({source: first}); + var layer = new Layer({source: first}); first.setState('ready'); expect(layer.handleSourceChange_.calledOnce).to.be(true); @@ -310,7 +310,7 @@ describe('ol.layer.Layer', function() { expect(layer.handleSourceChange_.callCount).to.be(2); // remove spy - _ol_layer_Layer_.prototype.handleSourceChange_.restore(); + Layer.prototype.handleSourceChange_.restore(); }); }); @@ -321,7 +321,7 @@ describe('ol.layer.Layer', function() { var layer; beforeEach(function() { - layer = new _ol_layer_Layer_({ + layer = new Layer({ source: new Source({ projection: getProjection('EPSG:4326') }) @@ -351,7 +351,7 @@ describe('ol.layer.Layer', function() { var layer; beforeEach(function() { - layer = new _ol_layer_Layer_({ + layer = new Layer({ source: new Source({ projection: getProjection('EPSG:4326') }) @@ -392,14 +392,14 @@ describe('ol.layer.Layer', function() { describe('with map in constructor options', function() { it('renders the layer', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ map: map }); var frameState = { layerStatesArray: [], layerStates: {} }; - map.dispatchEvent(new _ol_render_Event_('precompose', null, + map.dispatchEvent(new RenderEvent('precompose', null, frameState, null, null)); expect(frameState.layerStatesArray.length).to.be(1); var layerState = frameState.layerStatesArray[0]; @@ -420,7 +420,7 @@ describe('ol.layer.Layer', function() { }); it('requests a render frame', function() { - var layer = new _ol_layer_Layer_({}); + var layer = new Layer({}); layer.setMap(map); expect(mapRenderSpy.callCount).to.be(1); diff --git a/test/spec/ol/layer/vector.test.js b/test/spec/ol/layer/vector.test.js index 28a1de9c1a..8672f0db4d 100644 --- a/test/spec/ol/layer/vector.test.js +++ b/test/spec/ol/layer/vector.test.js @@ -1,19 +1,19 @@ -import _ol_layer_Layer_ from '../../../../src/ol/layer/Layer.js'; +import Layer from '../../../../src/ol/layer/Layer.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 Style from '../../../../src/ol/style/Style.js'; describe('ol.layer.Vector', function() { describe('constructor', function() { var source = new VectorSource(); - var style = new _ol_style_Style_(); + var style = new Style(); it('creates a new layer', function() { var layer = new VectorLayer({source: source}); expect(layer).to.be.a(VectorLayer); - expect(layer).to.be.a(_ol_layer_Layer_); + expect(layer).to.be.a(Layer); }); it('accepts a style option with a single style', function() { @@ -58,7 +58,7 @@ describe('ol.layer.Vector', function() { layer = new VectorLayer({ source: new VectorSource() }); - style = new _ol_style_Style_(); + style = new Style(); }); it('allows the style to be set after construction', function() { @@ -74,10 +74,10 @@ describe('ol.layer.Vector', function() { }); it('updates the internal style function', function() { - expect(layer.getStyleFunction()).to.be(_ol_style_Style_.defaultFunction); + expect(layer.getStyleFunction()).to.be(Style.defaultFunction); layer.setStyle(style); expect(layer.getStyleFunction()).not.to.be( - _ol_style_Style_.defaultFunction); + Style.defaultFunction); }); it('allows setting an null style', function() { @@ -89,8 +89,8 @@ describe('ol.layer.Vector', function() { it('sets the default style when passing undefined', function() { layer.setStyle(style); layer.setStyle(undefined); - expect(layer.getStyle()).to.be(_ol_style_Style_.defaultFunction); - expect(layer.getStyleFunction()).to.be(_ol_style_Style_.defaultFunction); + expect(layer.getStyle()).to.be(Style.defaultFunction); + expect(layer.getStyleFunction()).to.be(Style.defaultFunction); }); }); @@ -98,14 +98,14 @@ describe('ol.layer.Vector', function() { describe('#getStyle()', function() { var source = new VectorSource(); - var style = new _ol_style_Style_(); + var style = new Style(); it('returns what is provided to setStyle', function() { var layer = new VectorLayer({ source: source }); - expect(layer.getStyle()).to.be(_ol_style_Style_.defaultFunction); + expect(layer.getStyle()).to.be(Style.defaultFunction); layer.setStyle(style); expect(layer.getStyle()).to.be(style); diff --git a/test/spec/ol/layer/vectortile.test.js b/test/spec/ol/layer/vectortile.test.js index 860d8237b3..47ae6c9e3e 100644 --- a/test/spec/ol/layer/vectortile.test.js +++ b/test/spec/ol/layer/vectortile.test.js @@ -1,4 +1,4 @@ -import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; +import VectorTileLayer from '../../../../src/ol/layer/VectorTile.js'; import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; @@ -9,7 +9,7 @@ describe('ol.layer.VectorTile', function() { var layer; beforeEach(function() { - layer = new _ol_layer_VectorTile_({ + layer = new VectorTileLayer({ source: new VectorTileSource({}) }); }); @@ -19,7 +19,7 @@ describe('ol.layer.VectorTile', function() { }); it('creates an instance', function() { - expect(layer).to.be.a(_ol_layer_VectorTile_); + expect(layer).to.be.a(VectorTileLayer); }); it('provides default preload', function() { @@ -38,18 +38,18 @@ describe('ol.layer.VectorTile', function() { describe('constructor (options)', function() { it('works with options', function() { - var layer = new _ol_layer_VectorTile_({ + var layer = new VectorTileLayer({ renderMode: 'vector', source: new VectorTileSource({}) }); expect(layer.getRenderMode()).to.be('vector'); - layer = new _ol_layer_VectorTile_({ + layer = new VectorTileLayer({ renderMode: 'image', source: new VectorTileSource({}) }); expect(layer.getRenderMode()).to.be('image'); expect(function() { - layer = new _ol_layer_VectorTile_({ + layer = new VectorTileLayer({ renderMode: 'foo', source: new VectorTileSource({}) }); diff --git a/test/spec/ol/map.test.js b/test/spec/ol/map.test.js index 76935e882e..04c584dc44 100644 --- a/test/spec/ol/map.test.js +++ b/test/spec/ol/map.test.js @@ -12,7 +12,7 @@ import MouseWheelZoom from '../../../src/ol/interaction/MouseWheelZoom.js'; import PinchZoom from '../../../src/ol/interaction/PinchZoom.js'; import TileLayer from '../../../src/ol/layer/Tile.js'; import VectorLayer from '../../../src/ol/layer/Vector.js'; -import _ol_renderer_canvas_IntermediateCanvas_ from '../../../src/ol/renderer/canvas/IntermediateCanvas.js'; +import IntermediateCanvasRenderer from '../../../src/ol/renderer/canvas/IntermediateCanvas.js'; import VectorSource from '../../../src/ol/source/Vector.js'; import XYZ from '../../../src/ol/source/XYZ.js'; @@ -257,8 +257,8 @@ describe('ol.Map', function() { beforeEach(function(done) { log = []; - original = _ol_renderer_canvas_IntermediateCanvas_.prototype.forEachLayerAtCoordinate; - _ol_renderer_canvas_IntermediateCanvas_.prototype.forEachLayerAtCoordinate = function(coordinate) { + original = IntermediateCanvasRenderer.prototype.forEachLayerAtCoordinate; + IntermediateCanvasRenderer.prototype.forEachLayerAtCoordinate = function(coordinate) { log.push(coordinate.slice()); }; @@ -296,7 +296,7 @@ describe('ol.Map', function() { }); afterEach(function() { - _ol_renderer_canvas_IntermediateCanvas_.prototype.forEachLayerAtCoordinate = original; + IntermediateCanvasRenderer.prototype.forEachLayerAtCoordinate = original; map.dispose(); document.body.removeChild(target); log = null; diff --git a/test/spec/ol/mapbrowserevent.test.js b/test/spec/ol/mapbrowserevent.test.js index a5c80ca175..8a9a5f54d8 100644 --- a/test/spec/ol/mapbrowserevent.test.js +++ b/test/spec/ol/mapbrowserevent.test.js @@ -2,7 +2,7 @@ import Map from '../../../src/ol/Map.js'; import MapBrowserEventHandler from '../../../src/ol/MapBrowserEventHandler.js'; import _ol_events_ from '../../../src/ol/events.js'; import _ol_has_ from '../../../src/ol/has.js'; -import _ol_pointer_PointerEvent_ from '../../../src/ol/pointer/PointerEvent.js'; +import PointerEvent from '../../../src/ol/pointer/PointerEvent.js'; describe('ol.MapBrowserEventHandler', function() { describe('#emulateClick_', function() { @@ -36,7 +36,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('emulates click', function() { - handler.emulateClick_(new _ol_pointer_PointerEvent_('pointerdown', { + handler.emulateClick_(new PointerEvent('pointerdown', { type: 'mousedown', target: target, clientX: 0, @@ -46,7 +46,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('emulates singleclick', function() { - handler.emulateClick_(new _ol_pointer_PointerEvent_('pointerdown', { + handler.emulateClick_(new PointerEvent('pointerdown', { type: 'mousedown', target: target, clientX: 0, @@ -59,7 +59,7 @@ describe('ol.MapBrowserEventHandler', function() { expect(singleclickSpy.calledOnce).to.be.ok(); expect(dblclickSpy.called).to.not.be.ok(); - handler.emulateClick_(new _ol_pointer_PointerEvent_('pointerdown', { + handler.emulateClick_(new PointerEvent('pointerdown', { type: 'mousedown', target: target, clientX: 0, @@ -70,7 +70,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('emulates dblclick', function() { - handler.emulateClick_(new _ol_pointer_PointerEvent_('pointerdown', { + handler.emulateClick_(new PointerEvent('pointerdown', { type: 'mousedown', target: target, clientX: 0, @@ -79,7 +79,7 @@ describe('ol.MapBrowserEventHandler', function() { expect(singleclickSpy.called).to.not.be.ok(); expect(dblclickSpy.called).to.not.be.ok(); - handler.emulateClick_(new _ol_pointer_PointerEvent_('pointerdown', { + handler.emulateClick_(new PointerEvent('pointerdown', { type: 'mousedown', target: target, clientX: 0, @@ -107,7 +107,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('is an event after handlePointerDown_ has been called', function() { - var event = new _ol_pointer_PointerEvent_('pointerdown', {}); + var event = new PointerEvent('pointerdown', {}); handler.handlePointerDown_(event); expect(handler.down_).to.be(event); }); @@ -121,7 +121,7 @@ describe('ol.MapBrowserEventHandler', function() { beforeEach(function() { defaultHandler = new MapBrowserEventHandler(new Map({})); moveToleranceHandler = new MapBrowserEventHandler(new Map({}), 8); - pointerdownAt0 = new _ol_pointer_PointerEvent_('pointerdown', {}, { + pointerdownAt0 = new PointerEvent('pointerdown', {}, { clientX: 0, clientY: 0 }); @@ -130,7 +130,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('is not moving if distance is 0', function() { - var pointerdownAt0 = new _ol_pointer_PointerEvent_('pointerdown', {}, { + var pointerdownAt0 = new PointerEvent('pointerdown', {}, { clientX: 0, clientY: 0 }); @@ -138,7 +138,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('is moving if distance is 2', function() { - var pointerdownAt2 = new _ol_pointer_PointerEvent_('pointerdown', {}, { + var pointerdownAt2 = new PointerEvent('pointerdown', {}, { clientX: _ol_has_.DEVICE_PIXEL_RATIO + 1, clientY: _ol_has_.DEVICE_PIXEL_RATIO + 1 }); @@ -146,7 +146,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('is moving with negative distance', function() { - var pointerdownAt2 = new _ol_pointer_PointerEvent_('pointerdown', {}, { + var pointerdownAt2 = new PointerEvent('pointerdown', {}, { clientX: -(_ol_has_.DEVICE_PIXEL_RATIO + 1), clientY: -(_ol_has_.DEVICE_PIXEL_RATIO + 1) }); @@ -154,7 +154,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('is not moving if distance is less than move tolerance', function() { - var pointerdownAt2 = new _ol_pointer_PointerEvent_('pointerdown', {}, { + var pointerdownAt2 = new PointerEvent('pointerdown', {}, { clientX: _ol_has_.DEVICE_PIXEL_RATIO + 1, clientY: _ol_has_.DEVICE_PIXEL_RATIO + 1 }); @@ -162,7 +162,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('is moving if distance is greater than move tolerance', function() { - var pointerdownAt9 = new _ol_pointer_PointerEvent_('pointerdown', {}, { + var pointerdownAt9 = new PointerEvent('pointerdown', {}, { clientX: (_ol_has_.DEVICE_PIXEL_RATIO * 8) + 1, clientY: (_ol_has_.DEVICE_PIXEL_RATIO * 8) + 1 }); diff --git a/test/spec/ol/pointer/mousesource.test.js b/test/spec/ol/pointer/mousesource.test.js index 4ecbd007d7..2a719b9f97 100644 --- a/test/spec/ol/pointer/mousesource.test.js +++ b/test/spec/ol/pointer/mousesource.test.js @@ -1,7 +1,7 @@ import _ol_events_ from '../../../../src/ol/events.js'; import EventTarget from '../../../../src/ol/events/EventTarget.js'; import _ol_has_ from '../../../../src/ol/has.js'; -import _ol_pointer_PointerEventHandler_ from '../../../../src/ol/pointer/PointerEventHandler.js'; +import PointerEventHandler from '../../../../src/ol/pointer/PointerEventHandler.js'; import _ol_pointer_TouchSource_ from '../../../../src/ol/pointer/TouchSource.js'; @@ -20,7 +20,7 @@ describe('ol.pointer.MouseSource', function() { _ol_has_.MSPOINTER = false; _ol_has_.TOUCH = true; - handler = new _ol_pointer_PointerEventHandler_(target); + handler = new PointerEventHandler(target); eventSpy = sinon.spy(); }); diff --git a/test/spec/ol/pointer/pointereventhandler.test.js b/test/spec/ol/pointer/pointereventhandler.test.js index 559d25267e..dcde3beb7a 100644 --- a/test/spec/ol/pointer/pointereventhandler.test.js +++ b/test/spec/ol/pointer/pointereventhandler.test.js @@ -2,8 +2,8 @@ import _ol_events_ from '../../../../src/ol/events.js'; import EventTarget from '../../../../src/ol/events/EventTarget.js'; import _ol_has_ from '../../../../src/ol/has.js'; import _ol_pointer_MouseSource_ from '../../../../src/ol/pointer/MouseSource.js'; -import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; -import _ol_pointer_PointerEventHandler_ from '../../../../src/ol/pointer/PointerEventHandler.js'; +import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js'; +import PointerEventHandler from '../../../../src/ol/pointer/PointerEventHandler.js'; describe('ol.pointer.PointerEventHandler', function() { @@ -18,7 +18,7 @@ describe('ol.pointer.PointerEventHandler', function() { _ol_has_.POINTER = false; _ol_has_.MSPOINTER = false; - handler = new _ol_pointer_PointerEventHandler_(target); + handler = new PointerEventHandler(target); eventSpy = sinon.spy(); }); @@ -51,7 +51,7 @@ describe('ol.pointer.PointerEventHandler', function() { expect(eventSpy.calledOnce).to.be.ok(); var pointerEvent = eventSpy.firstCall.args[0]; - expect(pointerEvent).to.be.a(_ol_pointer_PointerEvent_); + expect(pointerEvent).to.be.a(PointerEvent); expect(pointerEvent.type).to.be('pointerdown'); expect(pointerEvent.pointerId).to.be(1); expect(pointerEvent.pointerType).to.be('mouse'); @@ -160,7 +160,7 @@ describe('ol.pointer.PointerEventHandler', function() { expect(pointerEvent.preventDefault).to.be.ok(); - expect(pointerEvent).to.be.a(_ol_pointer_PointerEvent_); + expect(pointerEvent).to.be.a(PointerEvent); }); }); diff --git a/test/spec/ol/pointer/touchsource.test.js b/test/spec/ol/pointer/touchsource.test.js index 132bab891b..f139112113 100644 --- a/test/spec/ol/pointer/touchsource.test.js +++ b/test/spec/ol/pointer/touchsource.test.js @@ -3,7 +3,7 @@ import Event from '../../../../src/ol/events/Event.js'; import EventTarget from '../../../../src/ol/events/EventTarget.js'; import _ol_has_ from '../../../../src/ol/has.js'; import _ol_obj_ from '../../../../src/ol/obj.js'; -import _ol_pointer_PointerEventHandler_ from '../../../../src/ol/pointer/PointerEventHandler.js'; +import PointerEventHandler from '../../../../src/ol/pointer/PointerEventHandler.js'; describe('ol.pointer.TouchSource', function() { var handler; var target; @@ -17,7 +17,7 @@ describe('ol.pointer.TouchSource', function() { _ol_has_.MSPOINTER = false; _ol_has_.TOUCH = true; - handler = new _ol_pointer_PointerEventHandler_(target); + handler = new PointerEventHandler(target); eventSpy = sinon.spy(); }); diff --git a/test/spec/ol/proj.test.js b/test/spec/ol/proj.test.js index 345f55e07c..0cece3e2a5 100644 --- a/test/spec/ol/proj.test.js +++ b/test/spec/ol/proj.test.js @@ -14,7 +14,7 @@ import { import {register} from '../../../src/ol/proj/proj4.js'; import _ol_proj_EPSG3857_ from '../../../src/ol/proj/EPSG3857.js'; import _ol_proj_EPSG4326_ from '../../../src/ol/proj/EPSG4326.js'; -import _ol_proj_Projection_ from '../../../src/ol/proj/Projection.js'; +import Projection from '../../../src/ol/proj/Projection.js'; describe('ol.proj', function() { @@ -71,11 +71,11 @@ describe('ol.proj', function() { it('gives that custom 3413 is equivalent to self', function() { var code = 'EPSG:3413'; - var source = new _ol_proj_Projection_({ + var source = new Projection({ code: code }); - var destination = new _ol_proj_Projection_({ + var destination = new Projection({ code: code }); @@ -101,11 +101,11 @@ describe('ol.proj', function() { it('requires code and units to be equal for projection evquivalence', function() { - var proj1 = new _ol_proj_Projection_({ + var proj1 = new Projection({ code: 'EPSG:3857', units: 'm' }); - var proj2 = new _ol_proj_Projection_({ + var proj2 = new Projection({ code: 'EPSG:3857', units: 'tile-pixels' }); @@ -194,14 +194,14 @@ describe('ol.proj', function() { describe('canWrapX()', function() { it('requires an extent for allowing wrapX', function() { - var proj = new _ol_proj_Projection_({ + var proj = new Projection({ code: 'foo', global: true }); expect(proj.canWrapX()).to.be(false); proj.setExtent([1, 2, 3, 4]); expect(proj.canWrapX()).to.be(true); - proj = new _ol_proj_Projection_({ + proj = new Projection({ code: 'foo', global: true, extent: [1, 2, 3, 4] @@ -212,14 +212,14 @@ describe('ol.proj', function() { }); it('requires global to be true for allowing wrapX', function() { - var proj = new _ol_proj_Projection_({ + var proj = new Projection({ code: 'foo', extent: [1, 2, 3, 4] }); expect(proj.canWrapX()).to.be(false); proj.setGlobal(true); expect(proj.canWrapX()).to.be(true); - proj = new _ol_proj_Projection_({ + proj = new Projection({ code: 'foo', global: true, extent: [1, 2, 3, 4] @@ -395,7 +395,7 @@ describe('ol.proj', function() { it('does not overwrite existing projections in the registry', function() { register(proj4); var epsg4326 = getProjection('EPSG:4326'); - new _ol_proj_Projection_({ + new Projection({ code: 'EPSG:4326', units: 'degrees', extent: [-45, -45, 45, 45] diff --git a/test/spec/ol/proj/transforms.test.js b/test/spec/ol/proj/transforms.test.js index 80d674321d..01f2ab4e90 100644 --- a/test/spec/ol/proj/transforms.test.js +++ b/test/spec/ol/proj/transforms.test.js @@ -1,4 +1,4 @@ -import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; +import Projection from '../../../../src/ol/proj/Projection.js'; import * as transforms from '../../../../src/ol/proj/transforms.js'; @@ -8,12 +8,12 @@ describe('transforms.remove()', function() { var units = 'degrees'; it('removes functions cached by transforms.add()', function() { - var foo = new _ol_proj_Projection_({ + var foo = new Projection({ code: 'foo', units: units, extent: extent }); - var bar = new _ol_proj_Projection_({ + var bar = new Projection({ code: 'bar', units: units, extent: extent diff --git a/test/spec/ol/render.test.js b/test/spec/ol/render.test.js index 007f49e952..cd03cb83a5 100644 --- a/test/spec/ol/render.test.js +++ b/test/spec/ol/render.test.js @@ -1,7 +1,7 @@ import {equals} from '../../../src/ol/array.js'; import _ol_has_ from '../../../src/ol/has.js'; import _ol_render_ from '../../../src/ol/render.js'; -import _ol_render_canvas_Immediate_ from '../../../src/ol/render/canvas/Immediate.js'; +import CanvasImmediateRenderer from '../../../src/ol/render/canvas/Immediate.js'; import _ol_transform_ from '../../../src/ol/transform.js'; @@ -12,7 +12,7 @@ describe('ol.render', function() { it('creates an ol.render.canvas.Immediate and sets defaults', function() { var canvas = document.createElement('canvas'); var render = _ol_render_.toContext(canvas.getContext('2d')); - expect(render).to.be.a(_ol_render_canvas_Immediate_); + expect(render).to.be.a(CanvasImmediateRenderer); expect(render.pixelRatio_).to.be(_ol_has_.DEVICE_PIXEL_RATIO); }); diff --git a/test/spec/ol/render/canvas/immediate.test.js b/test/spec/ol/render/canvas/immediate.test.js index f4a321e5d0..8076239890 100644 --- a/test/spec/ol/render/canvas/immediate.test.js +++ b/test/spec/ol/render/canvas/immediate.test.js @@ -7,12 +7,12 @@ 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 VectorContext from '../../../../../src/ol/render/VectorContext.js'; -import _ol_render_canvas_Immediate_ from '../../../../../src/ol/render/canvas/Immediate.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'; -import _ol_style_Text_ from '../../../../../src/ol/style/Text.js'; +import CanvasImmediateRenderer from '../../../../../src/ol/render/canvas/Immediate.js'; +import CircleStyle from '../../../../../src/ol/style/Circle.js'; +import Fill from '../../../../../src/ol/style/Fill.js'; +import Stroke from '../../../../../src/ol/style/Stroke.js'; +import Style from '../../../../../src/ol/style/Style.js'; +import Text from '../../../../../src/ol/style/Text.js'; describe('ol.render.canvas.Immediate', function() { @@ -30,23 +30,23 @@ describe('ol.render.canvas.Immediate', function() { describe('constructor', function() { it('creates an instance', function() { - var instance = new _ol_render_canvas_Immediate_(); - expect(instance).to.be.a(_ol_render_canvas_Immediate_); + var instance = new CanvasImmediateRenderer(); + expect(instance).to.be.a(CanvasImmediateRenderer); expect(instance).to.be.a(VectorContext); }); }); describe('#setStyle()', function() { it('calls the more specific methods with style parts', function() { - var context = new _ol_render_canvas_Immediate_(); + var context = new CanvasImmediateRenderer(); sinon.spy(context, 'setFillStrokeStyle'); sinon.spy(context, 'setImageStyle'); sinon.spy(context, 'setTextStyle'); - var fill = new _ol_style_Fill_({}); - var stroke = new _ol_style_Stroke_({}); - var text = new _ol_style_Text_({}); - var image = new _ol_style_Circle_({}); - var style = new _ol_style_Style_({ + var fill = new Fill({}); + var stroke = new Stroke({}); + var text = new Text({}); + var image = new CircleStyle({}); + var style = new Style({ fill: fill, stroke: stroke, image: image, @@ -68,7 +68,7 @@ describe('ol.render.canvas.Immediate', function() { var extent = [-10, -10, 10, 10]; it('calls drawPoint() with a Point', function() { - var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent); + var context = new CanvasImmediateRenderer(getMockContext(), 1, extent); sinon.spy(context, 'drawPoint'); var geometry = new Point([1, 2]); @@ -78,7 +78,7 @@ describe('ol.render.canvas.Immediate', function() { }); it('calls drawLineString() with a LineString', function() { - var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent); + var context = new CanvasImmediateRenderer(getMockContext(), 1, extent); sinon.spy(context, 'drawLineString'); var geometry = new LineString([[1, 2], [3, 4]]); @@ -88,7 +88,7 @@ describe('ol.render.canvas.Immediate', function() { }); it('calls drawPolygon() with a Polygon', function() { - var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent); + var context = new CanvasImmediateRenderer(getMockContext(), 1, extent); sinon.spy(context, 'drawPolygon'); var geometry = new Polygon([[[1, 2], [3, 4], [5, 6], [1, 2]]]); @@ -98,7 +98,7 @@ describe('ol.render.canvas.Immediate', function() { }); it('calls drawMultiPoint() with a MultiPoint', function() { - var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent); + var context = new CanvasImmediateRenderer(getMockContext(), 1, extent); sinon.spy(context, 'drawMultiPoint'); var geometry = new MultiPoint([[1, 2], [3, 4]]); @@ -108,7 +108,7 @@ describe('ol.render.canvas.Immediate', function() { }); it('calls drawMultiLineString() with a MultiLineString', function() { - var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent); + var context = new CanvasImmediateRenderer(getMockContext(), 1, extent); sinon.spy(context, 'drawMultiLineString'); var geometry = new MultiLineString([[[1, 2], [3, 4]]]); @@ -118,7 +118,7 @@ describe('ol.render.canvas.Immediate', function() { }); it('calls drawMultiPolygon() with a MultiPolygon', function() { - var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent); + var context = new CanvasImmediateRenderer(getMockContext(), 1, extent); sinon.spy(context, 'drawMultiPolygon'); var geometry = new MultiPolygon([[[[1, 2], [3, 4], [5, 6], [1, 2]]]]); @@ -128,7 +128,7 @@ describe('ol.render.canvas.Immediate', function() { }); it('calls drawGeometryCollection() with a GeometryCollection', function() { - var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent); + var context = new CanvasImmediateRenderer(getMockContext(), 1, extent); sinon.spy(context, 'drawGeometryCollection'); sinon.spy(context, 'drawPoint'); sinon.spy(context, 'drawLineString'); @@ -151,7 +151,7 @@ describe('ol.render.canvas.Immediate', function() { }); it('calls drawCircle() with a Circle', function() { - var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent); + var context = new CanvasImmediateRenderer(getMockContext(), 1, extent); sinon.spy(context, 'drawCircle'); var geometry = new Circle([0, 0]); @@ -223,7 +223,7 @@ describe('ol.render.canvas.Immediate', function() { -7572748.158493212, 3741317.9895594316 ]; - var canvas = new _ol_render_canvas_Immediate_(context, 1, extent, transform); + var canvas = new CanvasImmediateRenderer(context, 1, extent, transform); canvas.strokeState_ = { lineCap: 'round', diff --git a/test/spec/ol/render/canvas/textreplay.test.js b/test/spec/ol/render/canvas/textreplay.test.js index 690e65f3d0..095b7d6dfc 100644 --- a/test/spec/ol/render/canvas/textreplay.test.js +++ b/test/spec/ol/render/canvas/textreplay.test.js @@ -2,7 +2,7 @@ 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'; -import _ol_style_Text_ from '../../../../../src/ol/style/Text.js'; +import Text from '../../../../../src/ol/style/Text.js'; describe('ol.render.canvas.TextReplay', function() { @@ -11,13 +11,13 @@ describe('ol.render.canvas.TextReplay', function() { var geometry = new Polygon([[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]); var feature = new Feature(geometry); - replay.setTextStyle(new _ol_style_Text_({ + replay.setTextStyle(new Text({ text: 'This is a long text' })); replay.drawText(geometry, feature); expect(replay.instructions.length).to.be(0); - replay.setTextStyle(new _ol_style_Text_({ + replay.setTextStyle(new Text({ text: 'short' })); replay.drawText(geometry, feature); @@ -32,13 +32,13 @@ describe('ol.render.canvas.TextReplay', function() { ]); var feature = new Feature(geometry); - replay.setTextStyle(new _ol_style_Text_({ + replay.setTextStyle(new Text({ text: 'This is a long text' })); replay.drawText(geometry, feature); expect(replay.instructions.length).to.be(0); - replay.setTextStyle(new _ol_style_Text_({ + replay.setTextStyle(new Text({ text: 'short' })); replay.drawText(geometry, feature); diff --git a/test/spec/ol/render/feature.test.js b/test/spec/ol/render/feature.test.js index a3f5376110..fa9d214a2d 100644 --- a/test/spec/ol/render/feature.test.js +++ b/test/spec/ol/render/feature.test.js @@ -2,7 +2,7 @@ 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 Polygon from '../../../../src/ol/geom/Polygon.js'; -import _ol_render_Feature_ from '../../../../src/ol/render/Feature.js'; +import RenderFeature from '../../../../src/ol/render/Feature.js'; describe('ol.render.Feature', function() { @@ -16,8 +16,8 @@ describe('ol.render.Feature', function() { describe('Constructor', function() { it('creates an instance', function() { renderFeature = - new _ol_render_Feature_(type, flatCoordinates, ends, properties, 'foo'); - expect(renderFeature).to.be.a(_ol_render_Feature_); + new RenderFeature(type, flatCoordinates, ends, properties, 'foo'); + expect(renderFeature).to.be.a(RenderFeature); }); }); @@ -42,7 +42,7 @@ describe('ol.render.Feature', function() { }); it('returns the correct extent for a linestring', function() { var feature = - new _ol_render_Feature_('LineString', [-1, -2, 2, 1], null, {}); + new RenderFeature('LineString', [-1, -2, 2, 1], null, {}); expect(feature.getExtent()).to.eql([-1, -2, 2, 1]); }); }); @@ -56,7 +56,7 @@ describe('ol.render.Feature', function() { describe('#getFlatInteriorPoint()', function() { it('returns correct point and caches it', function() { var polygon = new Polygon([[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]); - var feature = new _ol_render_Feature_('Polygon', polygon.getOrientedFlatCoordinates(), + var feature = new RenderFeature('Polygon', polygon.getOrientedFlatCoordinates(), polygon.getEnds()); expect(feature.getFlatInteriorPoint()).to.eql([5, 5, 10]); expect(feature.getFlatInteriorPoint()).to.be(feature.flatInteriorPoints_); @@ -69,7 +69,7 @@ describe('ol.render.Feature', function() { [[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]], [[[10, 0], [10, 10], [20, 10], [20, 0], [10, 0]]] ]); - var feature = new _ol_render_Feature_('MultiPolygon', polygon.getOrientedFlatCoordinates(), + var feature = new RenderFeature('MultiPolygon', polygon.getOrientedFlatCoordinates(), polygon.getEndss()); expect(feature.getFlatInteriorPoints()).to.eql([5, 5, 10, 15, 5, 10]); expect(feature.getFlatInteriorPoints()).to.be(feature.flatInteriorPoints_); @@ -79,7 +79,7 @@ describe('ol.render.Feature', function() { describe('#getFlatMidpoint()', function() { it('returns correct point', function() { var line = new LineString([[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]); - var feature = new _ol_render_Feature_('LineString', line.getFlatCoordinates()); + var feature = new RenderFeature('LineString', line.getFlatCoordinates()); expect(feature.getFlatMidpoint()).to.eql([10, 10]); expect(feature.getFlatMidpoint()).to.eql(feature.flatMidpoints_); }); @@ -91,7 +91,7 @@ describe('ol.render.Feature', function() { [[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]], [[10, 0], [10, 10], [20, 10], [20, 0], [10, 0]] ]); - var feature = new _ol_render_Feature_('MultiLineString', line.getFlatCoordinates(), + var feature = new RenderFeature('MultiLineString', line.getFlatCoordinates(), line.getEnds()); expect(feature.getFlatMidpoints()).to.eql([10, 10, 20, 10]); expect(feature.getFlatMidpoints()).to.be(feature.flatMidpoints_); diff --git a/test/spec/ol/render/webgl/circlereplay.test.js b/test/spec/ol/render/webgl/circlereplay.test.js index 96463a08d8..8b79286274 100644 --- a/test/spec/ol/render/webgl/circlereplay.test.js +++ b/test/spec/ol/render/webgl/circlereplay.test.js @@ -4,17 +4,17 @@ 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'; import _ol_render_webgl_circlereplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/circlereplay/defaultshader/Locations.js'; -import _ol_style_Fill_ from '../../../../../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; +import Fill from '../../../../../src/ol/style/Fill.js'; +import Stroke from '../../../../../src/ol/style/Stroke.js'; describe('ol.render.webgl.CircleReplay', function() { var replay; - var strokeStyle = new _ol_style_Stroke_({ + var strokeStyle = new Stroke({ color: [0, 255, 0, 0.4] }); - var fillStyle = new _ol_style_Fill_({ + var fillStyle = new Fill({ color: [255, 0, 0, 1] }); diff --git a/test/spec/ol/render/webgl/imagereplay.test.js b/test/spec/ol/render/webgl/imagereplay.test.js index 62608818b5..9cf95fe07d 100644 --- a/test/spec/ol/render/webgl/imagereplay.test.js +++ b/test/spec/ol/render/webgl/imagereplay.test.js @@ -1,13 +1,13 @@ import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js'; import Point from '../../../../../src/ol/geom/Point.js'; import _ol_render_webgl_ImageReplay_ from '../../../../../src/ol/render/webgl/ImageReplay.js'; -import _ol_style_Image_ from '../../../../../src/ol/style/Image.js'; +import ImageStyle from '../../../../../src/ol/style/Image.js'; describe('ol.render.webgl.ImageReplay', function() { var replay; var createImageStyle = function(image) { - var imageStyle = new _ol_style_Image_({ + var imageStyle = new ImageStyle({ opacity: 0.1, rotateWithView: true, rotation: 1.5, diff --git a/test/spec/ol/render/webgl/immediate.test.js b/test/spec/ol/render/webgl/immediate.test.js index f67ee129b0..149960f6bb 100644 --- a/test/spec/ol/render/webgl/immediate.test.js +++ b/test/spec/ol/render/webgl/immediate.test.js @@ -12,19 +12,19 @@ import _ol_render_webgl_ImageReplay_ from '../../../../../src/ol/render/webgl/Im import _ol_render_webgl_Immediate_ from '../../../../../src/ol/render/webgl/Immediate.js'; import _ol_render_webgl_LineStringReplay_ from '../../../../../src/ol/render/webgl/LineStringReplay.js'; import _ol_render_webgl_PolygonReplay_ from '../../../../../src/ol/render/webgl/PolygonReplay.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'; +import CircleStyle from '../../../../../src/ol/style/Circle.js'; +import Fill from '../../../../../src/ol/style/Fill.js'; +import Stroke from '../../../../../src/ol/style/Stroke.js'; +import Style from '../../../../../src/ol/style/Style.js'; describe('ol.render.webgl.Immediate', function() { var context, style, circle, line, multiLine, point, multiPoint, polygon, multiPolygon; beforeEach(function() { context = new _ol_render_webgl_Immediate_({}, [0, 0], 0, 0, [0, 0], [-180, -90, 180, 90], 1); - style = new _ol_style_Style_({ - image: new _ol_style_Circle_(), - fill: new _ol_style_Fill_(), - stroke: new _ol_style_Stroke_() + style = new Style({ + image: new CircleStyle(), + fill: new Fill(), + stroke: new Stroke() }); circle = new Circle([0, 0], 5); line = new LineString([[0, 0], [5, 5]]); diff --git a/test/spec/ol/render/webgl/linestringreplay.test.js b/test/spec/ol/render/webgl/linestringreplay.test.js index c4c954ede4..7e09f3e778 100644 --- a/test/spec/ol/render/webgl/linestringreplay.test.js +++ b/test/spec/ol/render/webgl/linestringreplay.test.js @@ -5,16 +5,16 @@ import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js'; import _ol_render_webgl_LineStringReplay_ from '../../../../../src/ol/render/webgl/LineStringReplay.js'; import _ol_render_webgl_linestringreplay_defaultshader_ from '../../../../../src/ol/render/webgl/linestringreplay/defaultshader.js'; import _ol_render_webgl_linestringreplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/linestringreplay/defaultshader/Locations.js'; -import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../../src/ol/style/Stroke.js'; describe('ol.render.webgl.LineStringReplay', function() { var replay; - var strokeStyle1 = new _ol_style_Stroke_({ + var strokeStyle1 = new Stroke({ color: [0, 255, 0, 0.4] }); - var strokeStyle2 = new _ol_style_Stroke_({ + var strokeStyle2 = new Stroke({ color: [255, 0, 0, 1], lineCap: 'square', lineJoin: 'miter' @@ -100,7 +100,7 @@ describe('ol.render.webgl.LineStringReplay', function() { it('triangulates linestrings', function() { var linestring; - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ color: [0, 255, 0, 1], lineCap: 'butt', lineJoin: 'bevel' @@ -121,7 +121,7 @@ describe('ol.render.webgl.LineStringReplay', function() { it('optionally creates miters', function() { var linestring; - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ color: [0, 255, 0, 1], lineCap: 'butt' }); @@ -141,7 +141,7 @@ describe('ol.render.webgl.LineStringReplay', function() { it('optionally creates caps', function() { var linestring; - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ color: [0, 255, 0, 1] }); @@ -162,7 +162,7 @@ describe('ol.render.webgl.LineStringReplay', function() { it('respects segment orientation', function() { var linestring; - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ color: [0, 255, 0, 1], lineCap: 'butt', lineJoin: 'bevel' @@ -183,7 +183,7 @@ describe('ol.render.webgl.LineStringReplay', function() { it('closes boundaries', function() { var linestring; - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ color: [0, 255, 0, 1], lineCap: 'butt', lineJoin: 'bevel' diff --git a/test/spec/ol/render/webgl/polygonreplay.test.js b/test/spec/ol/render/webgl/polygonreplay.test.js index d7fe75e5e9..7d8125d94a 100644 --- a/test/spec/ol/render/webgl/polygonreplay.test.js +++ b/test/spec/ol/render/webgl/polygonreplay.test.js @@ -7,16 +7,16 @@ import _ol_render_webgl_polygonreplay_defaultshader_ from '../../../../../src/ol import _ol_render_webgl_polygonreplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader/Locations.js'; import LinkedList from '../../../../../src/ol/structs/LinkedList.js'; import RBush from '../../../../../src/ol/structs/RBush.js'; -import _ol_style_Fill_ from '../../../../../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; +import Fill from '../../../../../src/ol/style/Fill.js'; +import Stroke from '../../../../../src/ol/style/Stroke.js'; describe('ol.render.webgl.PolygonReplay', function() { var replay; - var fillStyle = new _ol_style_Fill_({ + var fillStyle = new Fill({ color: [0, 0, 255, 0.5] }); - var strokeStyle = new _ol_style_Stroke_({ + var strokeStyle = new Stroke({ color: [0, 255, 0, 0.4] }); @@ -435,7 +435,7 @@ describe('ol.render.webgl.PolygonReplay', function() { }); it('draws the elements in batches if there are multiple fill styles', function() { - var fillStyle2 = new _ol_style_Fill_({ + var fillStyle2 = new Fill({ color: [0, 255, 0, 1] }); replay.setFillStrokeStyle(fillStyle, strokeStyle); diff --git a/test/spec/ol/render/webgl/textreplay.test.js b/test/spec/ol/render/webgl/textreplay.test.js index 11e7ab056b..5ba68a74c5 100644 --- a/test/spec/ol/render/webgl/textreplay.test.js +++ b/test/spec/ol/render/webgl/textreplay.test.js @@ -1,15 +1,15 @@ import {createCanvasContext2D} from '../../../../../src/ol/dom.js'; import Point from '../../../../../src/ol/geom/Point.js'; import _ol_render_webgl_TextReplay_ from '../../../../../src/ol/render/webgl/TextReplay.js'; -import _ol_style_Fill_ from '../../../../../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; -import _ol_style_Text_ from '../../../../../src/ol/style/Text.js'; +import Fill from '../../../../../src/ol/style/Fill.js'; +import Stroke from '../../../../../src/ol/style/Stroke.js'; +import Text from '../../../../../src/ol/style/Text.js'; describe('ol.render.webgl.TextReplay', function() { var replay; var createTextStyle = function(fillStyle, strokeStyle, text) { - var textStyle = new _ol_style_Text_({ + var textStyle = new Text({ rotateWithView: true, rotation: 1.5, scale: 2, @@ -37,10 +37,10 @@ describe('ol.render.webgl.TextReplay', function() { beforeEach(function() { textStyle1 = createTextStyle( - new _ol_style_Fill_({ + new Fill({ color: [0, 0, 0, 1] }), - new _ol_style_Stroke_({ + new Stroke({ width: 1, color: [0, 0, 0, 1], lineCap: 'butt', @@ -51,10 +51,10 @@ describe('ol.render.webgl.TextReplay', function() { }), 'someText'); textStyle2 = createTextStyle( - new _ol_style_Fill_({ + new Fill({ color: [255, 255, 255, 1] }), - new _ol_style_Stroke_({ + new Stroke({ width: 1, color: [255, 255, 255, 1] }), @@ -62,10 +62,10 @@ describe('ol.render.webgl.TextReplay', function() { ); textStyle3 = createTextStyle(null, null, 'someText'); textStyle4 = createTextStyle( - new _ol_style_Fill_({ + new Fill({ color: [0, 0, 0, 1] }), - new _ol_style_Stroke_({ + new Stroke({ width: 1, color: [0, 0, 0, 1] }), @@ -115,7 +115,7 @@ describe('ol.render.webgl.TextReplay', function() { describe('#drawText', function() { beforeEach(function() { var textStyle = createTextStyle( - new _ol_style_Fill_({ + new Fill({ color: [0, 0, 0, 1] }), null, 'someText'); @@ -171,7 +171,7 @@ describe('ol.render.webgl.TextReplay', function() { describe('#addCharToAtlas_', function() { beforeEach(function() { var textStyle = createTextStyle( - new _ol_style_Fill_({ + new Fill({ color: [0, 0, 0, 1] }), null, 'someText'); @@ -209,7 +209,7 @@ describe('ol.render.webgl.TextReplay', function() { describe('#getTextSize_', function() { beforeEach(function() { var textStyle = createTextStyle( - new _ol_style_Fill_({ + new Fill({ color: [0, 0, 0, 1] }), null, 'someText'); @@ -261,7 +261,7 @@ describe('ol.render.webgl.TextReplay', function() { describe('#getAtlas_', function() { beforeEach(function() { var textStyle = createTextStyle( - new _ol_style_Fill_({ + new Fill({ color: [0, 0, 0, 1] }), null, 'someText'); diff --git a/test/spec/ol/renderer/canvas/imagelayer.test.js b/test/spec/ol/renderer/canvas/imagelayer.test.js index 64ae4723ec..423e73eb16 100644 --- a/test/spec/ol/renderer/canvas/imagelayer.test.js +++ b/test/spec/ol/renderer/canvas/imagelayer.test.js @@ -1,7 +1,7 @@ import Map from '../../../../../src/ol/Map.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 Projection from '../../../../../src/ol/proj/Projection.js'; import Static from '../../../../../src/ol/source/ImageStatic.js'; @@ -11,7 +11,7 @@ describe('ol.renderer.canvas.ImageLayer', function() { var map, target, source; beforeEach(function(done) { - var projection = new _ol_proj_Projection_({ + var projection = new Projection({ code: 'custom-image', units: 'pixels', extent: [0, 0, 200, 200] diff --git a/test/spec/ol/renderer/canvas/intermediatecanvas.test.js b/test/spec/ol/renderer/canvas/intermediatecanvas.test.js index 2e362daa87..0201d4d030 100644 --- a/test/spec/ol/renderer/canvas/intermediatecanvas.test.js +++ b/test/spec/ol/renderer/canvas/intermediatecanvas.test.js @@ -1,7 +1,7 @@ import _ol_transform_ from '../../../../../src/ol/transform.js'; import ImageLayer from '../../../../../src/ol/layer/Image.js'; import MapRenderer from '../../../../../src/ol/renderer/Map.js'; -import _ol_renderer_canvas_IntermediateCanvas_ from '../../../../../src/ol/renderer/canvas/IntermediateCanvas.js'; +import IntermediateCanvasRenderer from '../../../../../src/ol/renderer/canvas/IntermediateCanvas.js'; describe('ol.renderer.canvas.IntermediateCanvas', function() { @@ -12,7 +12,7 @@ describe('ol.renderer.canvas.IntermediateCanvas', function() { var layer = new ImageLayer({ extent: [1, 2, 3, 4] }); - renderer = new _ol_renderer_canvas_IntermediateCanvas_(layer); + renderer = new IntermediateCanvasRenderer(layer); var image = new Image(); image.width = 3; image.height = 3; diff --git a/test/spec/ol/renderer/canvas/map.test.js b/test/spec/ol/renderer/canvas/map.test.js index 9b65622676..c2f0a357ac 100644 --- a/test/spec/ol/renderer/canvas/map.test.js +++ b/test/spec/ol/renderer/canvas/map.test.js @@ -8,8 +8,8 @@ import VectorLayer from '../../../../../src/ol/layer/Vector.js'; import CanvasLayerRenderer from '../../../../../src/ol/renderer/canvas/Layer.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'; +import Icon from '../../../../../src/ol/style/Icon.js'; +import Style from '../../../../../src/ol/style/Style.js'; describe('ol.renderer.canvas.Map', function() { @@ -58,8 +58,8 @@ describe('ol.renderer.canvas.Map', function() { }) ] }), - style: new _ol_style_Style_({ - image: new _ol_style_Icon_({ + style: new Style({ + image: new Icon({ img: img, imgSize: [1, 1] }) diff --git a/test/spec/ol/renderer/canvas/replay.test.js b/test/spec/ol/renderer/canvas/replay.test.js index 2f52a0dc85..dd48156ddd 100644 --- a/test/spec/ol/renderer/canvas/replay.test.js +++ b/test/spec/ol/renderer/canvas/replay.test.js @@ -12,9 +12,9 @@ import _ol_render_canvas_PolygonReplay_ from '../../../../../src/ol/render/canva import _ol_render_canvas_Replay_ from '../../../../../src/ol/render/canvas/Replay.js'; import _ol_render_canvas_ReplayGroup_ from '../../../../../src/ol/render/canvas/ReplayGroup.js'; import _ol_renderer_vector_ from '../../../../../src/ol/renderer/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'; +import Fill from '../../../../../src/ol/style/Fill.js'; +import Stroke from '../../../../../src/ol/style/Stroke.js'; +import Style from '../../../../../src/ol/style/Style.js'; import _ol_transform_ from '../../../../../src/ol/transform.js'; describe('ol.render.canvas.ReplayGroup', function() { @@ -37,19 +37,19 @@ describe('ol.render.canvas.ReplayGroup', function() { [[[90, 45], [90, 0], [0, 0], [0, 45], [90, 45]]])); 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'}) + fill0 = new Style({ + fill: new Fill({color: 'black'}) }); - fill1 = new _ol_style_Style_({ - fill: new _ol_style_Fill_({color: 'red'}) + fill1 = new Style({ + fill: new Fill({color: 'red'}) }); - style1 = new _ol_style_Style_({ - fill: new _ol_style_Fill_({color: 'black'}), - stroke: new _ol_style_Stroke_({color: 'white', width: 1}) + style1 = new Style({ + fill: new Fill({color: 'black'}), + stroke: new Stroke({color: 'white', width: 1}) }); - style2 = new _ol_style_Style_({ - fill: new _ol_style_Fill_({color: 'white'}), - stroke: new _ol_style_Stroke_({color: 'black', width: 1, lineDash: [3, 6], + style2 = new Style({ + fill: new Fill({color: 'white'}), + stroke: new Stroke({color: 'black', width: 1, lineDash: [3, 6], lineDashOffset: 2}) }); fillCount = 0; @@ -216,7 +216,7 @@ describe('ol.render.canvas.ReplayGroup', function() { it('calls the renderer function configured for the style', function() { var calls = []; - var style = new _ol_style_Style_({ + var style = new Style({ renderer: function(coords, state) { calls.push({ coords: coords, @@ -448,7 +448,7 @@ describe('ol.render.canvas.LineStringReplay', function() { var resolution = 10; var replay = new _ol_render_canvas_LineStringReplay_(tolerance, extent, resolution); - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ width: 2 }); replay.setFillStrokeStyle(null, stroke); @@ -476,7 +476,7 @@ describe('ol.render.canvas.PolygonReplay', function() { it('returns correct offset', function() { var coords = [1, 2, 3, 4, 5, 6, 1, 2, 1, 2, 3, 4, 5, 6, 1, 2]; var ends = [7, 14]; - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ width: 5 }); replay.setFillStrokeStyle(null, stroke); @@ -491,7 +491,7 @@ describe('ol.render.canvas.PolygonReplay', function() { describe('#getBufferedMaxExtent()', function() { it('buffers the max extent to accommodate stroke width', function() { - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ width: 5 }); replay.setFillStrokeStyle(null, stroke); diff --git a/test/spec/ol/renderer/canvas/vectorlayer.test.js b/test/spec/ol/renderer/canvas/vectorlayer.test.js index 4d393b4c09..e3e0312608 100644 --- a/test/spec/ol/renderer/canvas/vectorlayer.test.js +++ b/test/spec/ol/renderer/canvas/vectorlayer.test.js @@ -10,8 +10,8 @@ import {get as getProjection} from '../../../../../src/ol/proj.js'; import _ol_render_canvas_ from '../../../../../src/ol/render/canvas.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'; +import Style from '../../../../../src/ol/style/Style.js'; +import Text from '../../../../../src/ol/style/Text.js'; describe('ol.renderer.canvas.VectorLayer', function() { @@ -56,13 +56,13 @@ describe('ol.renderer.canvas.VectorLayer', function() { }), target: target }); - var layerStyle = [new _ol_style_Style_({ - text: new _ol_style_Text_({ + var layerStyle = [new Style({ + text: new Text({ text: 'layer' }) })]; - var featureStyle = [new _ol_style_Style_({ - text: new _ol_style_Text_({ + var featureStyle = [new Style({ + text: new Text({ text: 'feature' }) })]; @@ -93,8 +93,8 @@ describe('ol.renderer.canvas.VectorLayer', function() { }), target: target }); - var layerStyle = new _ol_style_Style_({ - text: new _ol_style_Text_({ + var layerStyle = new Style({ + text: new Text({ text: 'layer', font: '12px "Unavailable Font",sans-serif' }) @@ -124,8 +124,8 @@ describe('ol.renderer.canvas.VectorLayer', function() { }), target: target }); - var layerStyle = new _ol_style_Style_({ - text: new _ol_style_Text_({ + var layerStyle = new Style({ + text: new Text({ text: 'layer', font: '12px sans-serif' }) @@ -156,8 +156,8 @@ describe('ol.renderer.canvas.VectorLayer', function() { }), target: target }); - var layerStyle = new _ol_style_Style_({ - text: new _ol_style_Text_({ + var layerStyle = new Style({ + text: new Text({ text: 'layer', font: '12px "Droid Sans",sans-serif' }) diff --git a/test/spec/ol/renderer/canvas/vectortilelayer.test.js b/test/spec/ol/renderer/canvas/vectortilelayer.test.js index 666c809aef..ee137c35a2 100644 --- a/test/spec/ol/renderer/canvas/vectortilelayer.test.js +++ b/test/spec/ol/renderer/canvas/vectortilelayer.test.js @@ -9,15 +9,15 @@ 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'; -import _ol_layer_VectorTile_ from '../../../../../src/ol/layer/VectorTile.js'; +import VectorTileLayer from '../../../../../src/ol/layer/VectorTile.js'; import {get as getProjection, fromLonLat} from '../../../../../src/ol/proj.js'; -import _ol_proj_Projection_ from '../../../../../src/ol/proj/Projection.js'; +import 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 RenderFeature from '../../../../../src/ol/render/Feature.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 Style from '../../../../../src/ol/style/Style.js'; +import Text from '../../../../../src/ol/style/Text.js'; import _ol_tilegrid_ from '../../../../../src/ol/tilegrid.js'; @@ -45,19 +45,19 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { }), target: target }); - layerStyle = [new _ol_style_Style_({ - text: new _ol_style_Text_({ + layerStyle = [new Style({ + text: new Text({ text: 'layer' }) })]; - var featureStyle = [new _ol_style_Style_({ - text: new _ol_style_Text_({ + var featureStyle = [new Style({ + text: new Text({ text: 'feature' }) })]; feature1 = new Feature(new Point([1, -1])); feature2 = new Feature(new Point([0, 0])); - feature3 = new _ol_render_Feature_('Point', [1, -1], []); + feature3 = new RenderFeature('Point', [1, -1], []); feature2.setStyle(featureStyle); var TileClass = function() { VectorTile.apply(this, arguments); @@ -77,7 +77,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { tile.setState(TileState.LOADED); return tile; }; - layer = new _ol_layer_VectorTile_({ + layer = new VectorTileLayer({ source: source, style: layerStyle }); @@ -133,7 +133,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { it('renders replays with custom renderers as direct replays', function() { layer.renderMode_ = 'image'; - layer.setStyle(new _ol_style_Style_({ + layer.setStyle(new Style({ renderer: function() {} })); var spy = sinon.spy(CanvasVectorTileLayerRenderer.prototype, @@ -201,7 +201,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { }); it('Geometries are transformed from tile-pixels', function() { - var proj = new _ol_proj_Projection_({code: 'EPSG:3857', units: 'tile-pixels'}); + var proj = new Projection({code: 'EPSG:3857', units: 'tile-pixels'}); var tile; tileCallback = function(t) { t.setProjection(proj); @@ -214,10 +214,10 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { }); it('works for multiple layers that use the same source', function() { - var layer2 = new _ol_layer_VectorTile_({ + var layer2 = new VectorTileLayer({ source: source, - style: new _ol_style_Style_({ - text: new _ol_style_Text_({ + style: new Style({ + text: new Text({ text: 'layer2' }) }) @@ -239,7 +239,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { describe('#prepareFrame', function() { it('re-renders when layer changed', function() { - var layer = new _ol_layer_VectorTile_({ + var layer = new VectorTileLayer({ source: new VectorTileSource({ tileGrid: _ol_tilegrid_.createXYZ(), transition: 0 @@ -308,7 +308,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { beforeEach(function() { replayGroup = {}; - layer = new _ol_layer_VectorTile_({ + layer = new VectorTileLayer({ source: new VectorTileSource({ tileClass: TileClass, tileGrid: _ol_tilegrid_.createXYZ() @@ -358,7 +358,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { var map = new Map({ target: target, layers: [ - new _ol_layer_VectorTile_({ + new VectorTileLayer({ extent: extent, source: source }) diff --git a/test/spec/ol/renderer/layer.test.js b/test/spec/ol/renderer/layer.test.js index f47c67ecac..d56b8e4ec3 100644 --- a/test/spec/ol/renderer/layer.test.js +++ b/test/spec/ol/renderer/layer.test.js @@ -1,7 +1,7 @@ import _ol_Image_ from '../../../../src/ol/Image.js'; import Map from '../../../../src/ol/Map.js'; import View from '../../../../src/ol/View.js'; -import _ol_layer_Layer_ from '../../../../src/ol/layer/Layer.js'; +import Layer from '../../../../src/ol/layer/Layer.js'; import TileLayer from '../../../../src/ol/layer/Tile.js'; import LayerRenderer from '../../../../src/ol/renderer/Layer.js'; import XYZ from '../../../../src/ol/source/XYZ.js'; @@ -13,7 +13,7 @@ describe('ol.renderer.Layer', function() { var eventType = 'change'; beforeEach(function() { - var layer = new _ol_layer_Layer_({}); + var layer = new Layer({}); renderer = new LayerRenderer(layer); }); diff --git a/test/spec/ol/renderer/vector.test.js b/test/spec/ol/renderer/vector.test.js index e0434fa402..e8694c8351 100644 --- a/test/spec/ol/renderer/vector.test.js +++ b/test/spec/ol/renderer/vector.test.js @@ -8,10 +8,10 @@ import MultiPoint from '../../../../src/ol/geom/MultiPoint.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; import _ol_render_canvas_ReplayGroup_ from '../../../../src/ol/render/canvas/ReplayGroup.js'; import _ol_renderer_vector_ from '../../../../src/ol/renderer/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'; -import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; +import Fill from '../../../../src/ol/style/Fill.js'; +import Icon from '../../../../src/ol/style/Icon.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; +import Style from '../../../../src/ol/style/Style.js'; import Feature from '../../../../src/ol/Feature.js'; @@ -24,13 +24,13 @@ describe('ol.renderer.vector', function() { beforeEach(function() { replayGroup = new _ol_render_canvas_ReplayGroup_(1); feature = new Feature(); - iconStyle = new _ol_style_Icon_({ + iconStyle = new Icon({ src: 'http://example.com/icon.png' }); - style = new _ol_style_Style_({ + style = new Style({ image: iconStyle, - fill: new _ol_style_Fill_({}), - stroke: new _ol_style_Stroke_({}) + fill: new Fill({}), + stroke: new Stroke({}) }); squaredTolerance = 1; listener = function() {}; diff --git a/test/spec/ol/reproj/image.test.js b/test/spec/ol/reproj/image.test.js index 76f908d31d..c5f11b7ab2 100644 --- a/test/spec/ol/reproj/image.test.js +++ b/test/spec/ol/reproj/image.test.js @@ -1,12 +1,12 @@ import _ol_Image_ from '../../../../src/ol/Image.js'; import _ol_events_ from '../../../../src/ol/events.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; -import _ol_reproj_Image_ from '../../../../src/ol/reproj/Image.js'; +import ReprojImage from '../../../../src/ol/reproj/Image.js'; describe('ol.reproj.Image', function() { function createImage(pixelRatio) { - return new _ol_reproj_Image_( + return new ReprojImage( getProjection('EPSG:3857'), getProjection('EPSG:4326'), [-180, -85, 180, 85], 10, pixelRatio, function(extent, resolution, pixelRatio) { diff --git a/test/spec/ol/reproj/tile.test.js b/test/spec/ol/reproj/tile.test.js index d9220c9291..d11730af02 100644 --- a/test/spec/ol/reproj/tile.test.js +++ b/test/spec/ol/reproj/tile.test.js @@ -2,7 +2,7 @@ import ImageTile from '../../../../src/ol/ImageTile.js'; import _ol_events_ from '../../../../src/ol/events.js'; import {addCommon, clearAllProjections, get as getProjection} from '../../../../src/ol/proj.js'; import {register} from '../../../../src/ol/proj/proj4.js'; -import _ol_reproj_Tile_ from '../../../../src/ol/reproj/Tile.js'; +import ReprojTile from '../../../../src/ol/reproj/Tile.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -27,7 +27,7 @@ describe('ol.reproj.Tile', function() { function createTile(pixelRatio, opt_tileSize) { var proj4326 = getProjection('EPSG:4326'); var proj3857 = getProjection('EPSG:3857'); - return new _ol_reproj_Tile_( + return new ReprojTile( proj3857, _ol_tilegrid_.createForProjection(proj3857), proj4326, _ol_tilegrid_.createForProjection(proj4326, 3, opt_tileSize), [3, 2, -2], null, pixelRatio, 0, function(z, x, y, pixelRatio) { @@ -54,7 +54,7 @@ describe('ol.reproj.Tile', function() { it('is empty when outside target tile grid', function() { var proj4326 = getProjection('EPSG:4326'); var proj3857 = getProjection('EPSG:3857'); - var tile = new _ol_reproj_Tile_( + var tile = new ReprojTile( proj3857, _ol_tilegrid_.createForProjection(proj3857), proj4326, _ol_tilegrid_.createForProjection(proj4326), [0, -1, 0], null, 1, 0, function() { @@ -66,7 +66,7 @@ describe('ol.reproj.Tile', function() { it('is empty when outside source tile grid', function() { var proj4326 = getProjection('EPSG:4326'); var proj27700 = getProjection('EPSG:27700'); - var tile = new _ol_reproj_Tile_( + var tile = new ReprojTile( proj27700, _ol_tilegrid_.createForProjection(proj27700), proj4326, _ol_tilegrid_.createForProjection(proj4326), [3, 2, -2], null, 1, 0, function() { diff --git a/test/spec/ol/reproj/triangulation.test.js b/test/spec/ol/reproj/triangulation.test.js index 839b970865..d93524e482 100644 --- a/test/spec/ol/reproj/triangulation.test.js +++ b/test/spec/ol/reproj/triangulation.test.js @@ -1,6 +1,6 @@ import {addCommon, clearAllProjections, get as getProjection} from '../../../../src/ol/proj.js'; import {register} from '../../../../src/ol/proj/proj4.js'; -import _ol_reproj_Triangulation_ from '../../../../src/ol/reproj/Triangulation.js'; +import Triangulation from '../../../../src/ol/reproj/Triangulation.js'; describe('ol.reproj.Triangulation', function() { @@ -23,7 +23,7 @@ describe('ol.reproj.Triangulation', function() { describe('constructor', function() { it('is trivial for identity', function() { var proj4326 = getProjection('EPSG:4326'); - var triangulation = new _ol_reproj_Triangulation_(proj4326, proj4326, + var triangulation = new Triangulation(proj4326, proj4326, [20, 20, 30, 30], [-180, -90, 180, 90], 0); expect(triangulation.getTriangles().length).to.be(2); }); @@ -31,14 +31,14 @@ describe('ol.reproj.Triangulation', function() { it('is empty when outside source extent', function() { var proj4326 = getProjection('EPSG:4326'); var proj27700 = getProjection('EPSG:27700'); - var triangulation = new _ol_reproj_Triangulation_(proj27700, proj4326, + var triangulation = new Triangulation(proj27700, proj4326, [0, 0, 10, 10], proj27700.getExtent(), 0); expect(triangulation.getTriangles().length).to.be(0); }); it('can handle null source extent', function() { var proj4326 = getProjection('EPSG:4326'); - var triangulation = new _ol_reproj_Triangulation_(proj4326, proj4326, + var triangulation = new Triangulation(proj4326, proj4326, [20, 20, 30, 30], null, 0); expect(triangulation.getTriangles().length).to.be(2); }); diff --git a/test/spec/ol/source/raster.test.js b/test/spec/ol/source/raster.test.js index 225b5c59a9..ccbdfba202 100644 --- a/test/spec/ol/source/raster.test.js +++ b/test/spec/ol/source/raster.test.js @@ -2,7 +2,7 @@ import Map from '../../../../src/ol/Map.js'; import TileState from '../../../../src/ol/TileState.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 Projection from '../../../../src/ol/proj/Projection.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'; @@ -62,7 +62,7 @@ where('Uint8ClampedArray').describe('ol.source.Raster', function() { target: target, view: new View({ resolutions: [1], - projection: new _ol_proj_Projection_({ + projection: new Projection({ code: 'image', units: 'pixels', extent: extent diff --git a/test/spec/ol/source/tile.test.js b/test/spec/ol/source/tile.test.js index 550869286e..f23a4bab63 100644 --- a/test/spec/ol/source/tile.test.js +++ b/test/spec/ol/source/tile.test.js @@ -1,8 +1,8 @@ import {inherits} from '../../../../src/ol/index.js'; -import _ol_Tile_ from '../../../../src/ol/Tile.js'; +import Tile from '../../../../src/ol/Tile.js'; 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 Projection from '../../../../src/ol/proj/Projection.js'; import Source from '../../../../src/ol/source/Source.js'; import TileSource from '../../../../src/ol/source/Tile.js'; import _ol_tilecoord_ from '../../../../src/ol/tilecoord.js'; @@ -31,7 +31,7 @@ var MockTile = function(tileStates) { }); for (var key in tileStates) { - this.tileCache.set(key, new _ol_Tile_(key.split('/'), tileStates[key])); + this.tileCache.set(key, new Tile(key.split('/'), tileStates[key])); } }; @@ -46,7 +46,7 @@ MockTile.prototype.getTile = function(z, x, y) { if (this.tileCache.containsKey(key)) { return /** @type {!ol.Tile} */ (this.tileCache.get(key)); } else { - var tile = new _ol_Tile_(key, 0); // IDLE + var tile = new Tile(key, 0); // IDLE this.tileCache.set(key, tile); return tile; } @@ -258,7 +258,7 @@ describe('ol.source.Tile', function() { it('works with wrapX and custom projection without extent', function() { var tileSource = new TileSource({ - projection: new _ol_proj_Projection_({ + projection: new Projection({ code: 'foo', global: true, units: 'm' @@ -279,7 +279,7 @@ describe('ol.source.Tile', function() { }); // check the loaded tile is there var tile = source.getTile(1, 0, 0); - expect(tile).to.be.a(_ol_Tile_); + expect(tile).to.be.a(Tile); // check tile cache is filled expect(source.tileCache.getCount()).to.eql(1); // refresh the source @@ -312,17 +312,17 @@ describe('MockTile', function() { // check a loaded tile tile = source.getTile(0, 0, 0); - expect(tile).to.be.a(_ol_Tile_); + expect(tile).to.be.a(Tile); expect(tile.state).to.be(2); // LOADED // check a tile that is not loaded tile = source.getTile(1, 0, -1); - expect(tile).to.be.a(_ol_Tile_); + expect(tile).to.be.a(Tile); expect(tile.state).to.be(0); // IDLE // check another loaded tile tile = source.getTile(1, 0, 0); - expect(tile).to.be.a(_ol_Tile_); + expect(tile).to.be.a(Tile); expect(tile.state).to.be(2); // LOADED }); diff --git a/test/spec/ol/source/tileimage.test.js b/test/spec/ol/source/tileimage.test.js index f80b2dfad4..b09593ea18 100644 --- a/test/spec/ol/source/tileimage.test.js +++ b/test/spec/ol/source/tileimage.test.js @@ -5,8 +5,8 @@ import _ol_events_ from '../../../../src/ol/events.js'; import {addCommon, clearAllProjections, get as getProjection} from '../../../../src/ol/proj.js'; 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 Projection from '../../../../src/ol/proj/Projection.js'; +import ReprojTile from '../../../../src/ol/reproj/Tile.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'; @@ -117,16 +117,16 @@ describe('ol.source.TileImage', function() { var source3857 = createSource('EPSG:3857'); var tile3857 = source3857.getTile(0, 0, -1, 1, getProjection('EPSG:3857')); expect(tile3857).to.be.a(ImageTile); - expect(tile3857).not.to.be.a(_ol_reproj_Tile_); + expect(tile3857).not.to.be.a(ReprojTile); - var projXXX = new _ol_proj_Projection_({ + var projXXX = new Projection({ code: 'XXX', units: 'degrees' }); var sourceXXX = createSource(projXXX); var tileXXX = sourceXXX.getTile(0, 0, -1, 1, projXXX); expect(tileXXX).to.be.a(ImageTile); - expect(tileXXX).not.to.be.a(_ol_reproj_Tile_); + expect(tileXXX).not.to.be.a(ReprojTile); }); beforeEach(function() { @@ -146,7 +146,7 @@ describe('ol.source.TileImage', function() { tileSize: [2, 2] })); var tile = source.getTile(0, 0, -1, 1, getProjection('EPSG:3857')); - expect(tile).to.be.a(_ol_reproj_Tile_); + expect(tile).to.be.a(ReprojTile); _ol_events_.listen(tile, 'change', function() { if (tile.getState() == 2) { // LOADED @@ -165,7 +165,7 @@ describe('ol.source.TileImage', function() { tileSize: [2, 2] })); var tile = source.getTile(0, 0, -1, 1, proj); - expect(tile).to.be.a(_ol_reproj_Tile_); + expect(tile).to.be.a(ReprojTile); _ol_events_.listen(tile, 'change', function() { if (tile.getState() == 2) { // LOADED diff --git a/test/spec/ol/source/vector.test.js b/test/spec/ol/source/vector.test.js index a35872cb59..822b48847e 100644 --- a/test/spec/ol/source/vector.test.js +++ b/test/spec/ol/source/vector.test.js @@ -1,5 +1,5 @@ import _ol_events_ from '../../../../src/ol/events.js'; -import _ol_Collection_ from '../../../../src/ol/Collection.js'; +import Collection from '../../../../src/ol/Collection.js'; import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.js'; import View from '../../../../src/ol/View.js'; @@ -560,7 +560,7 @@ describe('ol.source.Vector', function() { }); it('returns a features collection', function() { - expect(source.getFeaturesCollection()).to.be.a(_ol_Collection_); + expect(source.getFeaturesCollection()).to.be.a(Collection); }); it('#forEachFeatureInExtent loops through all features', function() { @@ -622,7 +622,7 @@ describe('ol.source.Vector', function() { describe('with a collection of features plus spatial index', function() { var collection, source; beforeEach(function() { - collection = new _ol_Collection_(); + collection = new Collection(); source = new VectorSource({ features: collection }); diff --git a/test/spec/ol/source/vectortile.test.js b/test/spec/ol/source/vectortile.test.js index 4838982c06..d700adae5e 100644 --- a/test/spec/ol/source/vectortile.test.js +++ b/test/spec/ol/source/vectortile.test.js @@ -3,7 +3,7 @@ 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 VectorTileLayer from '../../../../src/ol/layer/VectorTile.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -111,7 +111,7 @@ describe('ol.source.VectorTile', function() { map = new Map({ layers: [ - new _ol_layer_VectorTile_({ + new VectorTileLayer({ extent: extent, source: source }) diff --git a/test/spec/ol/source/wmts.test.js b/test/spec/ol/source/wmts.test.js index 78f8194359..6e59b6b646 100644 --- a/test/spec/ol/source/wmts.test.js +++ b/test/spec/ol/source/wmts.test.js @@ -1,6 +1,6 @@ import _ol_format_WMTSCapabilities_ from '../../../../src/ol/format/WMTSCapabilities.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; -import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; +import Projection from '../../../../src/ol/proj/Projection.js'; import WMTSTileGrid from '../../../../src/ol/tilegrid/WMTS.js'; import WMTS from '../../../../src/ol/source/WMTS.js'; @@ -57,7 +57,7 @@ describe('ol.source.WMTS', function() { expect(options.format).to.be.eql('image/jpeg'); - expect(options.projection).to.be.a(_ol_proj_Projection_); + expect(options.projection).to.be.a(Projection); expect(options.projection).to.be.eql(getProjection('EPSG:3857')); expect(options.requestEncoding).to.be.eql('KVP'); @@ -91,7 +91,7 @@ describe('ol.source.WMTS', function() { expect(options.format).to.be.eql('image/png'); - expect(options.projection).to.be.a(_ol_proj_Projection_); + expect(options.projection).to.be.a(Projection); expect(options.projection).to.be.eql(getProjection('EPSG:3857')); expect(options.requestEncoding).to.be.eql('REST'); @@ -139,7 +139,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 = WMTS.optionsFromCapabilities(capabilities, { layer: 'BlueMarbleNextGeneration', - projection: new _ol_proj_Projection_({ + projection: new Projection({ code: 'EPSG:2056', units: 'm' }) diff --git a/test/spec/ol/source/zoomify.test.js b/test/spec/ol/source/zoomify.test.js index 0d529a4e5c..eb4c831728 100644 --- a/test/spec/ol/source/zoomify.test.js +++ b/test/spec/ol/source/zoomify.test.js @@ -1,6 +1,6 @@ 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 Projection from '../../../../src/ol/proj/Projection.js'; import Zoomify from '../../../../src/ol/source/Zoomify.js'; import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js'; @@ -11,7 +11,7 @@ describe('ol.source.Zoomify', function() { var size = [w, h]; var zoomifyUrl = 'spec/ol/source/images/zoomify/{TileGroup}/{z}-{x}-{y}.jpg'; var iipUrl = 'spec/ol/source/images/zoomify?JTL={z},{tileIndex}'; - var proj = new _ol_proj_Projection_({ + var proj = new Projection({ code: 'ZOOMIFY', units: 'pixels', extent: [0, 0, w, h] diff --git a/test/spec/ol/style/atlasmanager.test.js b/test/spec/ol/style/atlasmanager.test.js index be06e9151f..2559f10d1a 100644 --- a/test/spec/ol/style/atlasmanager.test.js +++ b/test/spec/ol/style/atlasmanager.test.js @@ -1,5 +1,5 @@ -import _ol_style_Atlas_ from '../../../../src/ol/style/Atlas.js'; -import _ol_style_AtlasManager_ from '../../../../src/ol/style/AtlasManager.js'; +import Atlas from '../../../../src/ol/style/Atlas.js'; +import AtlasManager from '../../../../src/ol/style/AtlasManager.js'; describe('ol.style.Atlas', function() { @@ -10,7 +10,7 @@ describe('ol.style.Atlas', function() { describe('#constructor', function() { it('inits the atlas', function() { - var atlas = new _ol_style_Atlas_(256, 1); + var atlas = new Atlas(256, 1); expect(atlas.emptyBlocks_).to.eql( [{x: 0, y: 0, width: 256, height: 256}]); }); @@ -19,7 +19,7 @@ describe('ol.style.Atlas', function() { describe('#add (squares with same size)', function() { it('adds one entry', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); var info = atlas.add('1', 32, 32, defaultRender); expect(info).to.eql( @@ -29,7 +29,7 @@ describe('ol.style.Atlas', function() { }); it('adds two entries', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); atlas.add('1', 32, 32, defaultRender); var info = atlas.add('2', 32, 32, defaultRender); @@ -41,7 +41,7 @@ describe('ol.style.Atlas', function() { }); it('adds three entries', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); atlas.add('1', 32, 32, defaultRender); atlas.add('2', 32, 32, defaultRender); @@ -54,7 +54,7 @@ describe('ol.style.Atlas', function() { }); it('adds four entries (new row)', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); atlas.add('1', 32, 32, defaultRender); atlas.add('2', 32, 32, defaultRender); @@ -68,7 +68,7 @@ describe('ol.style.Atlas', function() { }); it('returns null when an entry is too big', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); atlas.add('1', 32, 32, defaultRender); atlas.add('2', 32, 32, defaultRender); @@ -79,7 +79,7 @@ describe('ol.style.Atlas', function() { }); it('fills up the whole atlas', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); for (var i = 1; i <= 16; i++) { expect(atlas.add(i.toString(), 28, 28, defaultRender)).to.be.ok(); @@ -93,7 +93,7 @@ describe('ol.style.Atlas', function() { describe('#add (rectangles with different sizes)', function() { it('adds a bunch of rectangles', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); expect(atlas.add('1', 64, 32, defaultRender)).to.eql( {offsetX: 1, offsetY: 1, image: atlas.canvas_}); @@ -116,7 +116,7 @@ describe('ol.style.Atlas', function() { }); it('fills up the whole atlas (rectangles in portrait format)', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); for (var i = 1; i <= 32; i++) { expect(atlas.add(i.toString(), 28, 14, defaultRender)).to.be.ok(); @@ -127,7 +127,7 @@ describe('ol.style.Atlas', function() { }); it('fills up the whole atlas (rectangles in landscape format)', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); for (var i = 1; i <= 32; i++) { expect(atlas.add(i.toString(), 14, 28, defaultRender)).to.be.ok(); @@ -141,7 +141,7 @@ describe('ol.style.Atlas', function() { describe('#add (rendering)', function() { it('calls the render callback with the right values', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); var rendererCallback = sinon.spy(); atlas.add('1', 32, 32, rendererCallback); @@ -156,7 +156,7 @@ describe('ol.style.Atlas', function() { }); it('is possible to actually draw on the canvas', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); var rendererCallback = function(context, x, y) { context.fillStyle = '#FFA500'; @@ -179,7 +179,7 @@ describe('ol.style.AtlasManager', function() { describe('#constructor', function() { it('inits the atlas manager', function() { - var manager = new _ol_style_AtlasManager_(); + var manager = new AtlasManager(); expect(manager.atlases_).to.not.be.empty(); }); }); @@ -187,7 +187,7 @@ describe('ol.style.AtlasManager', function() { describe('#add', function() { it('adds one entry', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); var info = manager.add('1', 32, 32, defaultRender); expect(info).to.eql({ @@ -198,7 +198,7 @@ describe('ol.style.AtlasManager', function() { }); it('adds one entry (also to the hit detection atlas)', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); var info = manager.add('1', 32, 32, defaultRender, defaultRender); expect(info).to.eql({ @@ -209,7 +209,7 @@ describe('ol.style.AtlasManager', function() { }); it('creates a new atlas if needed', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); expect(manager.add('1', 100, 100, defaultRender, defaultRender)) .to.be.ok(); var info = manager.add('2', 100, 100, defaultRender, defaultRender); @@ -221,7 +221,7 @@ describe('ol.style.AtlasManager', function() { }); it('creates new atlases until one is large enough', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); expect(manager.add('1', 100, 100, defaultRender, defaultRender)) .to.be.ok(); expect(manager.atlases_).to.have.length(1); @@ -235,7 +235,7 @@ describe('ol.style.AtlasManager', function() { }); it('checks all existing atlases and create a new if needed', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); expect(manager.add('1', 100, 100, defaultRender, defaultRender)) .to.be.ok(); expect(manager.add('2', 100, 100, defaultRender, defaultRender)) @@ -251,7 +251,7 @@ describe('ol.style.AtlasManager', function() { }); it('returns null if the size exceeds the maximum size', function() { - var manager = new _ol_style_AtlasManager_( + var manager = new AtlasManager( {initialSize: 128, maxSize: 2048}); expect(manager.add('1', 100, 100, defaultRender, defaultRender)) .to.be.ok(); @@ -260,7 +260,7 @@ describe('ol.style.AtlasManager', function() { }); it('always has the same offset for the hit-detection', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); // add one image without hit-detection callback var info = manager.add('1', 32, 32, defaultRender); // add then one with hit-detection callback @@ -277,7 +277,7 @@ describe('ol.style.AtlasManager', function() { describe('#getInfo', function() { it('returns null if no entry for the given id', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); expect(manager.getInfo('123456')).to.eql(null); }); }); diff --git a/test/spec/ol/style/circle.test.js b/test/spec/ol/style/circle.test.js index a69e586459..be9c38647d 100644 --- a/test/spec/ol/style/circle.test.js +++ b/test/spec/ol/style/circle.test.js @@ -1,7 +1,7 @@ -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'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import AtlasManager from '../../../../src/ol/style/AtlasManager.js'; +import CircleStyle from '../../../../src/ol/style/Circle.js'; +import Fill from '../../../../src/ol/style/Fill.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; describe('ol.style.Circle', function() { @@ -9,7 +9,7 @@ describe('ol.style.Circle', function() { describe('#constructor', function() { it('creates a canvas if no atlas is used (no fill-style)', function() { - var style = new _ol_style_Circle_({radius: 10}); + var style = new CircleStyle({radius: 10}); expect(style.getImage()).to.be.an(HTMLCanvasElement); expect(style.getSize()).to.eql([21, 21]); expect(style.getImageSize()).to.eql([21, 21]); @@ -22,9 +22,9 @@ describe('ol.style.Circle', function() { }); it('creates a canvas if no atlas is used (fill-style)', function() { - var style = new _ol_style_Circle_({ + var style = new CircleStyle({ radius: 10, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#FFFF00' }) }); @@ -40,8 +40,8 @@ describe('ol.style.Circle', function() { }); it('adds itself to an atlas manager (no fill-style)', function() { - var atlasManager = new _ol_style_AtlasManager_({initialSize: 512}); - var style = new _ol_style_Circle_({radius: 10, atlasManager: atlasManager}); + var atlasManager = new AtlasManager({initialSize: 512}); + var style = new CircleStyle({radius: 10, atlasManager: atlasManager}); expect(style.getImage()).to.be.an(HTMLCanvasElement); expect(style.getSize()).to.eql([21, 21]); expect(style.getImageSize()).to.eql([512, 512]); @@ -54,11 +54,11 @@ describe('ol.style.Circle', function() { }); it('adds itself to an atlas manager (fill-style)', function() { - var atlasManager = new _ol_style_AtlasManager_({initialSize: 512}); - var style = new _ol_style_Circle_({ + var atlasManager = new AtlasManager({initialSize: 512}); + var style = new CircleStyle({ radius: 10, atlasManager: atlasManager, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#FFFF00' }) }); @@ -77,18 +77,18 @@ describe('ol.style.Circle', function() { describe('#clone', function() { it('creates a new ol.style.Circle', function() { - var original = new _ol_style_Circle_(); + var original = new CircleStyle(); var clone = original.clone(); - expect(clone).to.be.an(_ol_style_Circle_); + expect(clone).to.be.an(CircleStyle); expect(clone).to.not.be(original); }); it('copies all values', function() { - var original = new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + var original = new CircleStyle({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }), radius: 5, @@ -106,11 +106,11 @@ describe('ol.style.Circle', function() { }); it('the clone does not reference the same objects as the original', function() { - var original = new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + var original = new CircleStyle({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); @@ -129,39 +129,39 @@ describe('ol.style.Circle', function() { describe('#getChecksum', function() { it('calculates the same hash code for default options', function() { - var style1 = new _ol_style_Circle_(); - var style2 = new _ol_style_Circle_(); + var style1 = new CircleStyle(); + var style2 = new CircleStyle(); expect(style1.getChecksum()).to.eql(style2.getChecksum()); }); it('calculates not the same hash code (radius)', function() { - var style1 = new _ol_style_Circle_(); - var style2 = new _ol_style_Circle_({ + var style1 = new CircleStyle(); + var style2 = new CircleStyle({ radius: 5 }); expect(style1.getChecksum()).to.not.eql(style2.getChecksum()); }); it('calculates the same hash code (radius)', function() { - var style1 = new _ol_style_Circle_({ + var style1 = new CircleStyle({ radius: 5 }); - var style2 = new _ol_style_Circle_({ + var style2 = new CircleStyle({ radius: 5 }); expect(style1.getChecksum()).to.eql(style2.getChecksum()); }); it('calculates not the same hash code (color)', function() { - var style1 = new _ol_style_Circle_({ + var style1 = new CircleStyle({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }) }); - var style2 = new _ol_style_Circle_({ + var style2 = new CircleStyle({ radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); @@ -169,12 +169,12 @@ describe('ol.style.Circle', function() { }); it('calculates the same hash code (everything set)', function() { - var style1 = new _ol_style_Circle_({ + var style1 = new CircleStyle({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', lineCap: 'round', lineDash: [5, 15, 25], @@ -183,12 +183,12 @@ describe('ol.style.Circle', function() { width: 2 }) }); - var style2 = new _ol_style_Circle_({ + var style2 = new CircleStyle({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', lineCap: 'round', lineDash: [5, 15, 25], @@ -201,12 +201,12 @@ describe('ol.style.Circle', function() { }); it('calculates not the same hash code (stroke width differs)', function() { - var style1 = new _ol_style_Circle_({ + var style1 = new CircleStyle({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', lineCap: 'round', lineDash: [5, 15, 25], @@ -215,12 +215,12 @@ describe('ol.style.Circle', function() { width: 3 }) }); - var style2 = new _ol_style_Circle_({ + var style2 = new CircleStyle({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', lineCap: 'round', lineDash: [5, 15, 25], @@ -233,21 +233,21 @@ describe('ol.style.Circle', function() { }); it('invalidates a cached checksum if values change (fill)', function() { - var style1 = new _ol_style_Circle_({ + var style1 = new CircleStyle({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); - var style2 = new _ol_style_Circle_({ + var style2 = new CircleStyle({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); @@ -258,21 +258,21 @@ describe('ol.style.Circle', function() { }); it('invalidates a cached checksum if values change (stroke)', function() { - var style1 = new _ol_style_Circle_({ + var style1 = new CircleStyle({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); - var style2 = new _ol_style_Circle_({ + var style2 = new CircleStyle({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); @@ -286,9 +286,9 @@ describe('ol.style.Circle', function() { describe('#setRadius', function() { it('changes the circle radius', function() { - var style = new _ol_style_Circle_({ + var style = new CircleStyle({ radius: 10, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#FFFF00' }) }); diff --git a/test/spec/ol/style/fill.test.js b/test/spec/ol/style/fill.test.js index cf5b151eda..449085fe9b 100644 --- a/test/spec/ol/style/fill.test.js +++ b/test/spec/ol/style/fill.test.js @@ -1,18 +1,18 @@ -import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; +import Fill from '../../../../src/ol/style/Fill.js'; describe('ol.style.Fill', function() { describe('#clone', function() { it('creates a new ol.style.Fill', function() { - var original = new _ol_style_Fill_(); + var original = new Fill(); var clone = original.clone(); - expect(clone).to.be.an(_ol_style_Fill_); + expect(clone).to.be.an(Fill); expect(clone).to.not.be(original); }); it('copies all values', function() { - var original = new _ol_style_Fill_({ + var original = new Fill({ color: '#319FD3' }); var clone = original.clone(); @@ -20,7 +20,7 @@ describe('ol.style.Fill', function() { }); it('the clone does not reference the same objects as the original', function() { - var original = new _ol_style_Fill_({ + var original = new Fill({ color: [63, 255, 127, 0.7] }); var clone = original.clone(); diff --git a/test/spec/ol/style/icon.test.js b/test/spec/ol/style/icon.test.js index 53963a513b..f333669fd5 100644 --- a/test/spec/ol/style/icon.test.js +++ b/test/spec/ol/style/icon.test.js @@ -1,7 +1,7 @@ import {getUid} from '../../../../src/ol/index.js'; import {iconImageCache} from '../../../../src/ol/style.js'; -import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js'; -import _ol_style_IconImage_ from '../../../../src/ol/style/IconImage.js'; +import Icon from '../../../../src/ol/style/Icon.js'; +import IconImage from '../../../../src/ol/style/IconImage.js'; describe('ol.style.Icon', function() { @@ -13,16 +13,16 @@ describe('ol.style.Icon', function() { it('caches canvas images with a uid as src', function() { var canvas = document.createElement('canvas'); - new _ol_style_Icon_({ + new Icon({ img: canvas, imgSize: size }); - expect(_ol_style_IconImage_.get( + expect(IconImage.get( canvas, getUid(canvas), size, '').getImage()).to.eql(canvas); }); it('imgSize overrides img.width and img.height', function(done) { - var style = new _ol_style_Icon_({ + var style = new Icon({ src: src, imgSize: size }); @@ -39,17 +39,17 @@ describe('ol.style.Icon', function() { describe('#clone', function() { it('creates a new ol.style.Icon', function() { - var original = new _ol_style_Icon_({ + var original = new Icon({ src: src }); var clone = original.clone(); - expect(clone).to.be.an(_ol_style_Icon_); + expect(clone).to.be.an(Icon); expect(clone).to.not.be(original); }); it('copies all values ', function() { var canvas = document.createElement('canvas'); - var original = new _ol_style_Icon_({ + var original = new Icon({ anchor: [1, 0], anchorOrigin: 'bottom-right', anchorXUnits: 'pixels', @@ -85,7 +85,7 @@ describe('ol.style.Icon', function() { expect(original.getRotateWithView()).to.eql(clone.getRotateWithView()); expect(original.getSnapToPixel()).to.eql(clone.getSnapToPixel()); - var original2 = new _ol_style_Icon_({ + var original2 = new Icon({ src: src }); var clone2 = original2.clone(); @@ -95,7 +95,7 @@ describe('ol.style.Icon', function() { }); it('the clone does not reference the same objects as the original', function() { - var original = new _ol_style_Icon_({ + var original = new Icon({ anchor: [1, 0], color: [1, 2, 3, 0.4], src: src, @@ -123,7 +123,7 @@ describe('ol.style.Icon', function() { var fractionAnchor = [0.25, 0.25]; it('uses fractional units by default', function() { - var iconStyle = new _ol_style_Icon_({ + var iconStyle = new Icon({ src: 'test.png', size: size, anchor: fractionAnchor @@ -132,7 +132,7 @@ describe('ol.style.Icon', function() { }); it('uses pixels units', function() { - var iconStyle = new _ol_style_Icon_({ + var iconStyle = new Icon({ src: 'test.png', size: size, anchor: [2, 18], @@ -143,7 +143,7 @@ describe('ol.style.Icon', function() { }); it('uses a bottom left anchor origin', function() { - var iconStyle = new _ol_style_Icon_({ + var iconStyle = new Icon({ src: 'test.png', size: size, anchor: fractionAnchor, @@ -153,7 +153,7 @@ describe('ol.style.Icon', function() { }); it('uses a bottom right anchor origin', function() { - var iconStyle = new _ol_style_Icon_({ + var iconStyle = new Icon({ src: 'test.png', size: size, anchor: fractionAnchor, @@ -163,7 +163,7 @@ describe('ol.style.Icon', function() { }); it('uses a top right anchor origin', function() { - var iconStyle = new _ol_style_Icon_({ + var iconStyle = new Icon({ src: 'test.png', size: size, anchor: fractionAnchor, @@ -178,7 +178,7 @@ describe('ol.style.Icon', function() { var imageSize = [144, 192]; it('uses a top left offset origin (default)', function() { - var iconStyle = new _ol_style_Icon_({ + var iconStyle = new Icon({ src: 'test.png', size: size, offset: offset @@ -187,7 +187,7 @@ describe('ol.style.Icon', function() { }); it('uses a bottom left offset origin', function() { - var iconStyle = new _ol_style_Icon_({ + var iconStyle = new Icon({ src: 'test.png', size: size, offset: offset, @@ -198,7 +198,7 @@ describe('ol.style.Icon', function() { }); it('uses a bottom right offset origin', function() { - var iconStyle = new _ol_style_Icon_({ + var iconStyle = new Icon({ src: 'test.png', size: size, offset: offset, @@ -209,7 +209,7 @@ describe('ol.style.Icon', function() { }); it('uses a top right offset origin', function() { - var iconStyle = new _ol_style_Icon_({ + var iconStyle = new Icon({ src: 'test.png', size: size, offset: offset, @@ -227,17 +227,17 @@ describe('ol.style.Icon', function() { // pretend that the image is already in the cache, // this image will be used for the icon. var src = 'test.png'; - var iconImage = new _ol_style_IconImage_(null, 'test.png', imgSize); + var iconImage = new IconImage(null, 'test.png', imgSize); iconImageCache.set(src, null, null, iconImage); - var iconStyle = new _ol_style_Icon_({ + var iconStyle = new Icon({ src: 'test.png' }); expect(iconStyle.getImageSize()).to.eql(imgSize); }); it('uses the given image size', function() { - var iconStyle = new _ol_style_Icon_({ + var iconStyle = new Icon({ img: {src: 'test.png'}, imgSize: imgSize }); diff --git a/test/spec/ol/style/iconimagecache.test.js b/test/spec/ol/style/iconimagecache.test.js index 2d1035dd8e..838b0a078a 100644 --- a/test/spec/ol/style/iconimagecache.test.js +++ b/test/spec/ol/style/iconimagecache.test.js @@ -1,7 +1,7 @@ import {nullFunction} from '../../../../src/ol/index.js'; import _ol_events_ from '../../../../src/ol/events.js'; import {iconImageCache} from '../../../../src/ol/style.js'; -import _ol_style_IconImage_ from '../../../../src/ol/style/IconImage.js'; +import IconImage from '../../../../src/ol/style/IconImage.js'; describe('ol.style.IconImageCache', function() { var originalMaxCacheSize; @@ -23,7 +23,7 @@ describe('ol.style.IconImageCache', function() { for (i = 0; i < 4; ++i) { src = i + ''; - iconImage = new _ol_style_IconImage_(null, src); + iconImage = new IconImage(null, src); iconImageCache.set(src, null, null, iconImage); } @@ -33,7 +33,7 @@ describe('ol.style.IconImageCache', function() { expect(iconImageCache.cacheSize_).to.eql(4); src = '4'; - iconImage = new _ol_style_IconImage_(null, src); + iconImage = new IconImage(null, src); iconImageCache.set(src, null, null, iconImage); expect(iconImageCache.cacheSize_).to.eql(5); @@ -41,13 +41,13 @@ describe('ol.style.IconImageCache', function() { expect(iconImageCache.cacheSize_).to.eql(3); src = '0'; - iconImage = new _ol_style_IconImage_(null, src); + iconImage = new IconImage(null, src); _ol_events_.listen(iconImage, 'change', nullFunction, false); iconImageCache.set(src, null, null, iconImage); expect(iconImageCache.cacheSize_).to.eql(4); src = '4'; - iconImage = new _ol_style_IconImage_(null, src); + iconImage = new IconImage(null, src); _ol_events_.listen(iconImage, 'change', nullFunction, false); iconImageCache.set(src, null, null, iconImage); expect(iconImageCache.cacheSize_).to.eql(5); @@ -65,7 +65,7 @@ describe('ol.style.IconImageCache', function() { for (i = 0; i < 3; ++i) { src = i + ''; - iconImage = new _ol_style_IconImage_(null, src); + iconImage = new IconImage(null, src); iconImageCache.set(src, null, null, iconImage); } diff --git a/test/spec/ol/style/regularshape.test.js b/test/spec/ol/style/regularshape.test.js index 9442bdd189..e0a96ebad4 100644 --- a/test/spec/ol/style/regularshape.test.js +++ b/test/spec/ol/style/regularshape.test.js @@ -1,7 +1,7 @@ -import _ol_style_AtlasManager_ from '../../../../src/ol/style/AtlasManager.js'; -import _ol_style_RegularShape_ from '../../../../src/ol/style/RegularShape.js'; -import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import AtlasManager from '../../../../src/ol/style/AtlasManager.js'; +import RegularShape from '../../../../src/ol/style/RegularShape.js'; +import Fill from '../../../../src/ol/style/Fill.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; describe('ol.style.RegularShape', function() { @@ -9,7 +9,7 @@ describe('ol.style.RegularShape', function() { describe('#constructor', function() { it('can use rotateWithView', function() { - var style = new _ol_style_RegularShape_({ + var style = new RegularShape({ rotateWithView: true, radius: 0 }); @@ -17,7 +17,7 @@ describe('ol.style.RegularShape', function() { }); it('can use radius', function() { - var style = new _ol_style_RegularShape_({ + var style = new RegularShape({ radius: 5, radius2: 10 }); @@ -26,7 +26,7 @@ describe('ol.style.RegularShape', function() { }); it('can use radius1 as an alias for radius', function() { - var style = new _ol_style_RegularShape_({ + var style = new RegularShape({ radius1: 5, radius2: 10 }); @@ -35,7 +35,7 @@ describe('ol.style.RegularShape', function() { }); it('creates a canvas if no atlas is used (no fill-style)', function() { - var style = new _ol_style_RegularShape_({radius: 10}); + var style = new RegularShape({radius: 10}); expect(style.getImage()).to.be.an(HTMLCanvasElement); expect(style.getSize()).to.eql([21, 21]); expect(style.getImageSize()).to.eql([21, 21]); @@ -48,9 +48,9 @@ describe('ol.style.RegularShape', function() { }); it('creates a canvas if no atlas is used (fill-style)', function() { - var style = new _ol_style_RegularShape_({ + var style = new RegularShape({ radius: 10, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#FFFF00' }) }); @@ -66,8 +66,8 @@ describe('ol.style.RegularShape', function() { }); it('adds itself to an atlas manager (no fill-style)', function() { - var atlasManager = new _ol_style_AtlasManager_({initialSize: 512}); - var style = new _ol_style_RegularShape_( + var atlasManager = new AtlasManager({initialSize: 512}); + var style = new RegularShape( {radius: 10, atlasManager: atlasManager}); expect(style.getImage()).to.be.an(HTMLCanvasElement); expect(style.getSize()).to.eql([21, 21]); @@ -81,11 +81,11 @@ describe('ol.style.RegularShape', function() { }); it('adds itself to an atlas manager (fill-style)', function() { - var atlasManager = new _ol_style_AtlasManager_({initialSize: 512}); - var style = new _ol_style_RegularShape_({ + var atlasManager = new AtlasManager({initialSize: 512}); + var style = new RegularShape({ radius: 10, atlasManager: atlasManager, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#FFFF00' }) }); @@ -104,17 +104,17 @@ describe('ol.style.RegularShape', function() { describe('#clone', function() { it('creates a new ol.style.RegularShape', function() { - var original = new _ol_style_RegularShape_({ + var original = new RegularShape({ points: 5 }); var clone = original.clone(); - expect(clone).to.be.an(_ol_style_RegularShape_); + expect(clone).to.be.an(RegularShape); expect(clone).to.not.be(original); }); it('copies all values', function() { - var original = new _ol_style_RegularShape_({ - fill: new _ol_style_Fill_({ + var original = new RegularShape({ + fill: new Fill({ color: '#319FD3' }), points: 5, @@ -122,7 +122,7 @@ describe('ol.style.RegularShape', function() { radius2: 6, angle: 1, snapToPixel: false, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }), rotation: 2, @@ -145,11 +145,11 @@ describe('ol.style.RegularShape', function() { }); it('the clone does not reference the same objects as the original', function() { - var original = new _ol_style_RegularShape_({ - fill: new _ol_style_Fill_({ + var original = new RegularShape({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); @@ -168,11 +168,11 @@ describe('ol.style.RegularShape', function() { describe('#getChecksum', function() { it('calculates not the same hash code (radius)', function() { - var style1 = new _ol_style_RegularShape_({ + var style1 = new RegularShape({ radius: 4, radius2: 5 }); - var style2 = new _ol_style_RegularShape_({ + var style2 = new RegularShape({ radius: 3, radius2: 5 }); @@ -180,11 +180,11 @@ describe('ol.style.RegularShape', function() { }); it('calculates not the same hash code (radius2)', function() { - var style1 = new _ol_style_RegularShape_({ + var style1 = new RegularShape({ radius: 4, radius2: 5 }); - var style2 = new _ol_style_RegularShape_({ + var style2 = new RegularShape({ radius: 4, radius2: 6 }); @@ -192,25 +192,25 @@ describe('ol.style.RegularShape', function() { }); it('calculates the same hash code (radius)', function() { - var style1 = new _ol_style_RegularShape_({ + var style1 = new RegularShape({ radius: 5 }); - var style2 = new _ol_style_RegularShape_({ + var style2 = new RegularShape({ radius: 5 }); expect(style1.getChecksum()).to.eql(style2.getChecksum()); }); it('calculates not the same hash code (color)', function() { - var style1 = new _ol_style_RegularShape_({ + var style1 = new RegularShape({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }) }); - var style2 = new _ol_style_RegularShape_({ + var style2 = new RegularShape({ radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); @@ -218,15 +218,15 @@ describe('ol.style.RegularShape', function() { }); it('calculates the same hash code (everything set)', function() { - var style1 = new _ol_style_RegularShape_({ + var style1 = new RegularShape({ radius: 5, radius2: 3, angle: 1.41, points: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', lineCap: 'round', lineDash: [5, 15, 25], @@ -235,15 +235,15 @@ describe('ol.style.RegularShape', function() { width: 2 }) }); - var style2 = new _ol_style_RegularShape_({ + var style2 = new RegularShape({ radius: 5, radius2: 3, angle: 1.41, points: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', lineCap: 'round', lineDash: [5, 15, 25], @@ -256,15 +256,15 @@ describe('ol.style.RegularShape', function() { }); it('calculates not the same hash code (stroke width differs)', function() { - var style1 = new _ol_style_RegularShape_({ + var style1 = new RegularShape({ radius: 5, radius2: 3, angle: 1.41, points: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', lineCap: 'round', lineDash: [5, 15, 25], @@ -273,15 +273,15 @@ describe('ol.style.RegularShape', function() { width: 3 }) }); - var style2 = new _ol_style_RegularShape_({ + var style2 = new RegularShape({ radius: 5, radius2: 3, angle: 1.41, points: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', lineCap: 'round', lineDash: [5, 15, 25], @@ -294,21 +294,21 @@ describe('ol.style.RegularShape', function() { }); it('invalidates a cached checksum if values change (fill)', function() { - var style1 = new _ol_style_RegularShape_({ + var style1 = new RegularShape({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); - var style2 = new _ol_style_RegularShape_({ + var style2 = new RegularShape({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); @@ -319,21 +319,21 @@ describe('ol.style.RegularShape', function() { }); it('invalidates a cached checksum if values change (stroke)', function() { - var style1 = new _ol_style_RegularShape_({ + var style1 = new RegularShape({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); - var style2 = new _ol_style_RegularShape_({ + var style2 = new RegularShape({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); diff --git a/test/spec/ol/style/stroke.test.js b/test/spec/ol/style/stroke.test.js index d16f42094a..93ee01f123 100644 --- a/test/spec/ol/style/stroke.test.js +++ b/test/spec/ol/style/stroke.test.js @@ -1,18 +1,18 @@ -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; describe('ol.style.Stroke', function() { describe('#clone', function() { it('creates a new ol.style.Stroke', function() { - var original = new _ol_style_Stroke_(); + var original = new Stroke(); var clone = original.clone(); - expect(clone).to.be.an(_ol_style_Stroke_); + expect(clone).to.be.an(Stroke); expect(clone).to.not.be(original); }); it('copies all values', function() { - var original = new _ol_style_Stroke_({ + var original = new Stroke({ color: '#319FD3', lineCap: 'square', lineJoin: 'miter', @@ -32,7 +32,7 @@ describe('ol.style.Stroke', function() { }); it('the clone does not reference the same objects as the original', function() { - var original = new _ol_style_Stroke_({ + var original = new Stroke({ color: [1, 2, 3, 0.4], lineDash: [1, 2, 3] }); diff --git a/test/spec/ol/style/style.test.js b/test/spec/ol/style/style.test.js index 955a9d9e3e..a6e64e1465 100644 --- a/test/spec/ol/style/style.test.js +++ b/test/spec/ol/style/style.test.js @@ -1,60 +1,60 @@ 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'; -import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; -import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; +import Style from '../../../../src/ol/style/Style.js'; +import Fill from '../../../../src/ol/style/Fill.js'; +import CircleStyle from '../../../../src/ol/style/Circle.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; +import Text from '../../../../src/ol/style/Text.js'; describe('ol.style.Style', function() { - var testFill = new _ol_style_Fill_({ + var testFill = new Fill({ color: 'rgba(255, 255, 255, 0.6)' }); - var testStroke = new _ol_style_Stroke_({ + var testStroke = new Stroke({ color: '#319FD3', width: 1 }); - var testText = new _ol_style_Text_({ + var testText = new Text({ font: '12px Calibri,sans-serif', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#000' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#fff', width: 3 }) }); - var testImage = new _ol_style_Circle_({ + var testImage = new CircleStyle({ radius: 5 }); describe('#clone', function() { it('creates a new ol.style.Style', function() { - var original = new _ol_style_Style_(); + var original = new Style(); var clone = original.clone(); - expect(clone).to.be.an(_ol_style_Style_); + expect(clone).to.be.an(Style); expect(clone).to.not.be(original); }); it('copies all values', function() { - var original = new _ol_style_Style_({ + var original = new Style({ geometry: new Point([0, 0, 0]), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 5 }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }), - text: new _ol_style_Text_({ + text: new Text({ text: 'test' }), zIndex: 2 @@ -69,18 +69,18 @@ describe('ol.style.Style', function() { }); it('the clone does not reference the same objects as the original', function() { - var original = new _ol_style_Style_({ + var original = new Style({ geometry: new Point([0, 0, 0]), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 5 }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }), - text: new _ol_style_Text_({ + text: new Text({ text: 'test' }) }); @@ -107,7 +107,7 @@ describe('ol.style.Style', function() { describe('#setZIndex', function() { it('sets the zIndex', function() { - var style = new _ol_style_Style_(); + var style = new Style(); style.setZIndex(0.7); expect(style.getZIndex()).to.be(0.7); @@ -115,7 +115,7 @@ describe('ol.style.Style', function() { }); describe('#getFill', function() { - var style = new _ol_style_Style_({ + var style = new Style({ fill: testFill }); @@ -125,7 +125,7 @@ describe('ol.style.Style', function() { }); describe('#setFill', function() { - var style = new _ol_style_Style_(); + var style = new Style(); it('sets the fill style of a style', function() { style.setFill(testFill); @@ -134,7 +134,7 @@ describe('ol.style.Style', function() { }); describe('#getImage', function() { - var style = new _ol_style_Style_({ + var style = new Style({ image: testImage }); @@ -144,7 +144,7 @@ describe('ol.style.Style', function() { }); describe('#setImage', function() { - var style = new _ol_style_Style_(); + var style = new Style(); it('sets the image style of a style', function() { style.setImage(testImage); @@ -153,7 +153,7 @@ describe('ol.style.Style', function() { }); describe('#getStroke', function() { - var style = new _ol_style_Style_({ + var style = new Style({ stroke: testStroke }); @@ -163,7 +163,7 @@ describe('ol.style.Style', function() { }); describe('#setStroke', function() { - var style = new _ol_style_Style_(); + var style = new Style(); it('sets the stroke style of a style', function() { style.setStroke(testStroke); @@ -172,7 +172,7 @@ describe('ol.style.Style', function() { }); describe('#getText', function() { - var style = new _ol_style_Style_({ + var style = new Style({ text: testText }); @@ -182,7 +182,7 @@ describe('ol.style.Style', function() { }); describe('#setText', function() { - var style = new _ol_style_Style_(); + var style = new Style(); it('sets the text style of a style', function() { style.setText(testText); @@ -191,7 +191,7 @@ describe('ol.style.Style', function() { }); describe('#setGeometry', function() { - var style = new _ol_style_Style_(); + var style = new Style(); it('creates a geometry function from a string', function() { var feature = new Feature(); @@ -221,7 +221,7 @@ describe('ol.style.Style', function() { describe('#getGeometry', function() { it('returns whatever was passed to setGeometry', function() { - var style = new _ol_style_Style_(); + var style = new Style(); style.setGeometry('foo'); expect(style.getGeometry()).to.eql('foo'); var geom = new Point([1, 2]); @@ -241,15 +241,15 @@ describe('ol.style.Style', function() { }); describe('ol.style.Style.createFunction()', function() { - var style = new _ol_style_Style_(); + var style = new Style(); it('creates a style function from a single style', function() { - var styleFunction = _ol_style_Style_.createFunction(style); + var styleFunction = Style.createFunction(style); expect(styleFunction()).to.eql([style]); }); it('creates a style function from an array of styles', function() { - var styleFunction = _ol_style_Style_.createFunction([style]); + var styleFunction = Style.createFunction([style]); expect(styleFunction()).to.eql([style]); }); @@ -257,13 +257,13 @@ describe('ol.style.Style.createFunction()', function() { var original = function() { return [style]; }; - var styleFunction = _ol_style_Style_.createFunction(original); + var styleFunction = Style.createFunction(original); expect(styleFunction).to.be(original); }); it('throws on (some) unexpected input', function() { expect(function() { - _ol_style_Style_.createFunction({bogus: 'input'}); + Style.createFunction({bogus: 'input'}); }).to.throwException(); }); diff --git a/test/spec/ol/style/text.test.js b/test/spec/ol/style/text.test.js index e3ae66d68d..9775a1519d 100644 --- a/test/spec/ol/style/text.test.js +++ b/test/spec/ol/style/text.test.js @@ -1,6 +1,6 @@ -import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; -import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; +import Fill from '../../../../src/ol/style/Fill.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; +import Text from '../../../../src/ol/style/Text.js'; describe('ol.style.Text', function() { @@ -8,19 +8,19 @@ describe('ol.style.Text', function() { describe('#constructor', function() { it('uses a default fill style if none passed', function() { - var style = new _ol_style_Text_(); + var style = new Text(); expect(style.getFill().getColor()).to.be('#333'); }); it('uses a provided fill style if one passed', function() { - var style = new _ol_style_Text_({ - fill: new _ol_style_Fill_({color: '#123456'}) + var style = new Text({ + fill: new Fill({color: '#123456'}) }); expect(style.getFill().getColor()).to.be('#123456'); }); it('can always be resetted to no color', function() { - var style = new _ol_style_Text_(); + var style = new Text(); style.getFill().setColor(); expect(style.getFill().getColor()).to.be(undefined); }); @@ -30,14 +30,14 @@ describe('ol.style.Text', function() { describe('#clone', function() { it('creates a new ol.style.Text', function() { - var original = new _ol_style_Text_(); + var original = new Text(); var clone = original.clone(); - expect(clone).to.be.an(_ol_style_Text_); + expect(clone).to.be.an(Text); expect(clone).to.not.be(original); }); it('copies all values', function() { - var original = new _ol_style_Text_({ + var original = new Text({ font: '12px serif', offsetX: 4, offsetY: 10, @@ -47,16 +47,16 @@ describe('ol.style.Text', function() { text: 'test', textAlign: 'center', textBaseline: 'top', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }), - backgroundFill: new _ol_style_Fill_({ + backgroundFill: new Fill({ color: 'white' }), - backgroundStroke: new _ol_style_Stroke_({ + backgroundStroke: new Stroke({ color: 'black' }) }); @@ -77,11 +77,11 @@ describe('ol.style.Text', function() { }); it('the clone does not reference the same objects as the original', function() { - var original = new _ol_style_Text_({ - fill: new _ol_style_Fill_({ + var original = new Text({ + fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); diff --git a/test/spec/ol/tile.test.js b/test/spec/ol/tile.test.js index e0da139632..4bd22a4a26 100644 --- a/test/spec/ol/tile.test.js +++ b/test/spec/ol/tile.test.js @@ -1,6 +1,6 @@ import {getUid} from '../../../src/ol/index.js'; import ImageTile from '../../../src/ol/ImageTile.js'; -import _ol_Tile_ from '../../../src/ol/Tile.js'; +import Tile from '../../../src/ol/Tile.js'; import TileState from '../../../src/ol/TileState.js'; @@ -8,14 +8,14 @@ describe('ol.Tile', function() { describe('constructor', function() { it('sets a default transition', function() { var coord = [0, 0, 0]; - var tile = new _ol_Tile_(coord, TileState.IDLE); + var tile = new Tile(coord, TileState.IDLE); expect(tile.transition_).to.equal(250); }); it('allows the transition to be set', function() { var coord = [0, 0, 0]; var transition = 500; - var tile = new _ol_Tile_(coord, TileState.IDLE, {transition: transition}); + var tile = new Tile(coord, TileState.IDLE, {transition: transition}); expect(tile.transition_).to.equal(transition); }); }); @@ -23,7 +23,7 @@ describe('ol.Tile', function() { describe('#getAlpha()', function() { it('returns the alpha value for a tile in transition', function() { var coord = [0, 0, 0]; - var tile = new _ol_Tile_(coord, TileState.IDLE); + var tile = new Tile(coord, TileState.IDLE); var id = 'test'; var time = Date.now(); @@ -45,7 +45,7 @@ describe('ol.Tile', function() { describe('#inTransition()', function() { it('determines if the tile is in transition', function() { var coord = [0, 0, 0]; - var tile = new _ol_Tile_(coord, TileState.IDLE); + var tile = new Tile(coord, TileState.IDLE); var id = 'test'; expect(tile.inTransition(id)).to.be(true); diff --git a/test/spec/ol/tilecache.test.js b/test/spec/ol/tilecache.test.js index 1089327b8e..8ef6b36cb4 100644 --- a/test/spec/ol/tilecache.test.js +++ b/test/spec/ol/tilecache.test.js @@ -1,4 +1,4 @@ -import _ol_Tile_ from '../../../src/ol/Tile.js'; +import Tile from '../../../src/ol/Tile.js'; import TileCache from '../../../src/ol/TileCache.js'; import _ol_tilecoord_ from '../../../src/ol/tilecoord.js'; @@ -8,13 +8,13 @@ describe('ol.TileCache', function() { describe('#pruneExceptNewestZ()', function() { it('gets rid of all entries that are not at the newest z', function() { var tiles = [ - new _ol_Tile_([0, 0, 0]), - new _ol_Tile_([1, 0, 0]), - new _ol_Tile_([1, 1, 0]), - new _ol_Tile_([2, 0, 0]), - new _ol_Tile_([2, 1, 0]), - new _ol_Tile_([2, 2, 0]), - new _ol_Tile_([2, 3, 0]) // newest tile at z: 2 + new Tile([0, 0, 0]), + new Tile([1, 0, 0]), + new Tile([1, 1, 0]), + new Tile([2, 0, 0]), + new Tile([2, 1, 0]), + new Tile([2, 2, 0]), + new Tile([2, 3, 0]) // newest tile at z: 2 ]; var cache = new TileCache(); diff --git a/test/spec/ol/tilegrid/tilegrid.test.js b/test/spec/ol/tilegrid/tilegrid.test.js index f6210f384f..5509fda135 100644 --- a/test/spec/ol/tilegrid/tilegrid.test.js +++ b/test/spec/ol/tilegrid/tilegrid.test.js @@ -3,7 +3,7 @@ import TileRange from '../../../../src/ol/TileRange.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js'; import {get as getProjection, METERS_PER_UNIT} from '../../../../src/ol/proj.js'; import _ol_proj_EPSG3857_ from '../../../../src/ol/proj/EPSG3857.js'; -import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; +import Projection from '../../../../src/ol/proj/Projection.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js'; @@ -335,7 +335,7 @@ describe('ol.tilegrid.TileGrid', function() { }); it('works for projections unknown to the client', function() { - var projection = new _ol_proj_Projection_( + var projection = new Projection( {code: 'EPSG:31287', units: 'm'}); var grid = _ol_tilegrid_.createForProjection(projection); var resolutions = grid.getResolutions(); diff --git a/test/spec/ol/tilequeue.test.js b/test/spec/ol/tilequeue.test.js index 9de2401f78..b99e938a49 100644 --- a/test/spec/ol/tilequeue.test.js +++ b/test/spec/ol/tilequeue.test.js @@ -1,5 +1,5 @@ import ImageTile from '../../../src/ol/ImageTile.js'; -import _ol_Tile_ from '../../../src/ol/Tile.js'; +import Tile from '../../../src/ol/Tile.js'; import TileQueue from '../../../src/ol/TileQueue.js'; import TileState from '../../../src/ol/TileState.js'; import ImageSource from '../../../src/ol/source/Image.js'; @@ -11,7 +11,7 @@ describe('ol.TileQueue', function() { function addRandomPriorityTiles(tq, num) { var i, tile, priority; for (i = 0; i < num; i++) { - tile = new _ol_Tile_(); + tile = new Tile(); priority = Math.floor(Math.random() * 100); tq.elements_.push([tile, '', [0, 0]]); tq.priorities_.push(priority); diff --git a/test/spec/ol/vectortile.test.js b/test/spec/ol/vectortile.test.js index d129e92f3f..4a69833173 100644 --- a/test/spec/ol/vectortile.test.js +++ b/test/spec/ol/vectortile.test.js @@ -4,7 +4,7 @@ import VectorTile from '../../../src/ol/VectorTile.js'; import _ol_events_ from '../../../src/ol/events.js'; import TextFeature from '../../../src/ol/format/TextFeature.js'; import {get as getProjection} from '../../../src/ol/proj.js'; -import _ol_proj_Projection_ from '../../../src/ol/proj/Projection.js'; +import Projection from '../../../src/ol/proj/Projection.js'; describe('ol.VectorTile', function() { @@ -13,7 +13,7 @@ describe('ol.VectorTile', function() { // mock format that return a tile-pixels feature var format = new TextFeature(); format.readProjection = function(source) { - return new _ol_proj_Projection_({ + return new Projection({ code: '', units: 'tile-pixels' });