From fb22c587f8f66ecf7bda39f50f2b0dcbb776c8ad Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 13:25:01 -0700 Subject: [PATCH] Rename _ol_style_Icon_ to Icon --- examples/custom-interactions.js | 4 +-- examples/earthquake-custom-symbol.js | 4 +-- examples/feature-move-animation.js | 4 +-- examples/icon-color.js | 8 ++--- examples/icon-negative.js | 4 +-- examples/icon-sprite-webgl.js | 4 +-- examples/icon.js | 4 +-- examples/line-arrows.js | 4 +-- examples/mapbox-vector-tiles-advanced.js | 4 +-- examples/mapbox-vector-tiles.js | 4 +-- src/ol/format/KML.js | 8 ++--- src/ol/layer/Heatmap.js | 4 +-- src/ol/style/Icon.js | 36 +++++++++++----------- test/rendering/ol/style/icon.test.js | 4 +-- test/spec/ol/format/kml.test.js | 12 ++++---- test/spec/ol/renderer/canvas/map.test.js | 4 +-- test/spec/ol/renderer/vector.test.js | 4 +-- test/spec/ol/style/icon.test.js | 38 ++++++++++++------------ 18 files changed, 77 insertions(+), 77 deletions(-) diff --git a/examples/custom-interactions.js b/examples/custom-interactions.js index f22ac5d7a2..cc5dd1bad6 100644 --- a/examples/custom-interactions.js +++ b/examples/custom-interactions.js @@ -12,7 +12,7 @@ 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 Fill from '../src/ol/style/Fill.js'; -import _ol_style_Icon_ from '../src/ol/style/Icon.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'; @@ -157,7 +157,7 @@ var map = new Map({ features: [pointFeature, lineFeature, polygonFeature] }), style: new Style({ - image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ + image: new Icon(/** @type {olx.style.IconOptions} */ ({ anchor: [0.5, 46], anchorXUnits: 'fraction', anchorYUnits: 'pixels', diff --git a/examples/earthquake-custom-symbol.js b/examples/earthquake-custom-symbol.js index 169157480e..58c2c43bc8 100644 --- a/examples/earthquake-custom-symbol.js +++ b/examples/earthquake-custom-symbol.js @@ -8,7 +8,7 @@ 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 Fill from '../src/ol/style/Fill.js'; -import _ol_style_Icon_ from '../src/ol/style/Icon.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'; @@ -41,7 +41,7 @@ var styleFunction = function(feature) { })); vectorContext.drawGeometry(new Polygon([symbol.map(scaleFunction)])); style = new Style({ - image: new _ol_style_Icon_({ + image: new Icon({ img: canvas, imgSize: [size, size], rotation: 1.2 diff --git a/examples/feature-move-animation.js b/examples/feature-move-animation.js index ee8e088e8d..2d9d74199d 100644 --- a/examples/feature-move-animation.js +++ b/examples/feature-move-animation.js @@ -9,7 +9,7 @@ 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 Fill from '../src/ol/style/Fill.js'; -import _ol_style_Icon_ from '../src/ol/style/Icon.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'; @@ -91,7 +91,7 @@ var styles = { }) }), 'icon': new Style({ - image: new _ol_style_Icon_({ + image: new Icon({ anchor: [0.5, 1], src: 'data/icon.png' }) diff --git a/examples/icon-color.js b/examples/icon-color.js index 330eac4f71..24bbd94c24 100644 --- a/examples/icon-color.js +++ b/examples/icon-color.js @@ -7,7 +7,7 @@ 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 Icon from '../src/ol/style/Icon.js'; import Style from '../src/ol/style/Style.js'; @@ -24,7 +24,7 @@ var madrid = new Feature({ }); rome.setStyle(new Style({ - image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ + image: new Icon(/** @type {olx.style.IconOptions} */ ({ color: '#8959A8', crossOrigin: 'anonymous', src: 'data/dot.png' @@ -32,7 +32,7 @@ rome.setStyle(new Style({ })); london.setStyle(new Style({ - image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ + image: new Icon(/** @type {olx.style.IconOptions} */ ({ color: '#4271AE', crossOrigin: 'anonymous', src: 'data/dot.png' @@ -40,7 +40,7 @@ london.setStyle(new Style({ })); madrid.setStyle(new Style({ - image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ + 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 5c1288a56a..bb7c22ec3d 100644 --- a/examples/icon-negative.js +++ b/examples/icon-negative.js @@ -7,13 +7,13 @@ 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 Icon from '../src/ol/style/Icon.js'; import Style from '../src/ol/style/Style.js'; function createStyle(src, img) { return new Style({ - image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ + image: new Icon(/** @type {olx.style.IconOptions} */ ({ anchor: [0.5, 0.96], crossOrigin: 'anonymous', src: src, diff --git a/examples/icon-sprite-webgl.js b/examples/icon-sprite-webgl.js index f0e679da67..9fe2d63f08 100644 --- a/examples/icon-sprite-webgl.js +++ b/examples/icon-sprite-webgl.js @@ -4,7 +4,7 @@ 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 Icon from '../src/ol/style/Icon.js'; import Style from '../src/ol/style/Style.js'; @@ -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, diff --git a/examples/icon.js b/examples/icon.js index 795dd0c561..91d2edf9ed 100644 --- a/examples/icon.js +++ b/examples/icon.js @@ -7,7 +7,7 @@ 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 Icon from '../src/ol/style/Icon.js'; import Style from '../src/ol/style/Style.js'; @@ -19,7 +19,7 @@ var iconFeature = new Feature({ }); var iconStyle = new Style({ - image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ + image: new Icon(/** @type {olx.style.IconOptions} */ ({ anchor: [0.5, 46], anchorXUnits: 'fraction', anchorYUnits: 'pixels', diff --git a/examples/line-arrows.js b/examples/line-arrows.js index 083eafa8b5..49801ff64d 100644 --- a/examples/line-arrows.js +++ b/examples/line-arrows.js @@ -6,7 +6,7 @@ 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 Icon from '../src/ol/style/Icon.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -35,7 +35,7 @@ var styleFunction = function(feature) { // arrows 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 f9a0cf8349..23eec433d7 100644 --- a/examples/mapbox-vector-tiles-advanced.js +++ b/examples/mapbox-vector-tiles-advanced.js @@ -5,7 +5,7 @@ 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 Fill from '../src/ol/style/Fill.js'; -import _ol_style_Icon_ from '../src/ol/style/Icon.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 _ol_style_Text_ from '../src/ol/style/Text.js'; @@ -45,7 +45,7 @@ var map = new Map({ }), tileUrlFunction: tileUrlFunction }), - style: createMapboxStreetsV6Style(Style, Fill, Stroke, _ol_style_Icon_, _ol_style_Text_) + style: createMapboxStreetsV6Style(Style, Fill, Stroke, Icon, _ol_style_Text_) }) ], target: 'map', diff --git a/examples/mapbox-vector-tiles.js b/examples/mapbox-vector-tiles.js index 2f2a542785..65e59588a3 100644 --- a/examples/mapbox-vector-tiles.js +++ b/examples/mapbox-vector-tiles.js @@ -4,7 +4,7 @@ import MVT from '../src/ol/format/MVT.js'; import VectorTileLayer from '../src/ol/layer/VectorTile.js'; import VectorTileSource from '../src/ol/source/VectorTile.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Icon_ from '../src/ol/style/Icon.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 _ol_style_Text_ from '../src/ol/style/Text.js'; @@ -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(Style, Fill, Stroke, _ol_style_Icon_, _ol_style_Text_) + style: createMapboxStreetsV6Style(Style, Fill, Stroke, Icon, _ol_style_Text_) }) ], target: 'map', diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index 880863a07e..ce85ca9d25 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -21,7 +21,7 @@ import Polygon from '../geom/Polygon.js'; import {toRadians} from '../math.js'; import {get as getProjection} from '../proj.js'; import Fill from '../style/Fill.js'; -import _ol_style_Icon_ from '../style/Icon.js'; +import Icon from '../style/Icon.js'; import IconAnchorUnits from '../style/IconAnchorUnits.js'; import IconOrigin from '../style/IconOrigin.js'; import Stroke from '../style/Stroke.js'; @@ -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_, @@ -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, @@ -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/layer/Heatmap.js b/src/ol/layer/Heatmap.js index a3080db07c..d60e405139 100644 --- a/src/ol/layer/Heatmap.js +++ b/src/ol/layer/Heatmap.js @@ -9,7 +9,7 @@ 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 Icon from '../style/Icon.js'; import Style from '../style/Style.js'; @@ -118,7 +118,7 @@ var Heatmap = function(opt_options) { if (!style) { style = [ new Style({ - image: new _ol_style_Icon_({ + image: new Icon({ opacity: opacity, src: this.circleImage_ }) diff --git a/src/ol/style/Icon.js b/src/ol/style/Icon.js index 5060248d73..2fb6f4f2ab 100644 --- a/src/ol/style/Icon.js +++ b/src/ol/style/Icon.js @@ -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 || {}; @@ -172,7 +172,7 @@ var _ol_style_Icon_ = function(opt_options) { }; -inherits(_ol_style_Icon_, _ol_style_Image_); +inherits(Icon, _ol_style_Image_); /** @@ -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/test/rendering/ol/style/icon.test.js b/test/rendering/ol/style/icon.test.js index 3e364c6b95..4ec3ab1fbc 100644 --- a/test/rendering/ol/style/icon.test.js +++ b/test/rendering/ol/style/icon.test.js @@ -4,7 +4,7 @@ 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 Icon from '../../../../src/ol/style/Icon.js'; import Style from '../../../../src/ol/style/Style.js'; @@ -59,7 +59,7 @@ describe('ol.rendering.style.Icon', function() { img.onload = function() { imgInfo.img = img; feature.setStyle(new Style({ - image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ (imgInfo)) + image: new Icon(/** @type {olx.style.IconOptions} */ (imgInfo)) })); vectorSource.addFeature(feature); callback(); diff --git a/test/spec/ol/format/kml.test.js b/test/spec/ol/format/kml.test.js index 8af5776aa6..65cdc98177 100644 --- a/test/spec/ol/format/kml.test.js +++ b/test/spec/ol/format/kml.test.js @@ -15,7 +15,7 @@ import _ol_proj_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 Fill from '../../../../src/ol/style/Fill.js'; -import _ol_style_Icon_ from '../../../../src/ol/style/Icon.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 Stroke from '../../../../src/ol/style/Stroke.js'; @@ -1756,7 +1756,7 @@ describe('ol.format.KML', function() { 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); @@ -1836,7 +1836,7 @@ describe('ol.format.KML', function() { 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); @@ -2265,7 +2265,7 @@ describe('ol.format.KML', function() { it('can write an feature\'s icon style', function() { var style = new Style({ - image: new _ol_style_Icon_({ + image: new Icon({ anchor: [0.25, 36], anchorOrigin: 'top-left', anchorXUnits: 'fraction', @@ -2314,7 +2314,7 @@ describe('ol.format.KML', function() { it('does not write styles when writeStyles option is false', function() { format = new KML({writeStyles: false}); var style = new Style({ - image: new _ol_style_Icon_({ + image: new Icon({ src: 'http://foo.png' }) }); @@ -3209,7 +3209,7 @@ describe('ol.format.KML', function() { var style = styleArray[0]; 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/renderer/canvas/map.test.js b/test/spec/ol/renderer/canvas/map.test.js index 8312fdc472..c2f0a357ac 100644 --- a/test/spec/ol/renderer/canvas/map.test.js +++ b/test/spec/ol/renderer/canvas/map.test.js @@ -8,7 +8,7 @@ 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 Icon from '../../../../../src/ol/style/Icon.js'; import Style from '../../../../../src/ol/style/Style.js'; describe('ol.renderer.canvas.Map', function() { @@ -59,7 +59,7 @@ describe('ol.renderer.canvas.Map', function() { ] }), style: new Style({ - image: new _ol_style_Icon_({ + image: new Icon({ img: img, imgSize: [1, 1] }) diff --git a/test/spec/ol/renderer/vector.test.js b/test/spec/ol/renderer/vector.test.js index d587050f73..e8694c8351 100644 --- a/test/spec/ol/renderer/vector.test.js +++ b/test/spec/ol/renderer/vector.test.js @@ -9,7 +9,7 @@ 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 Fill from '../../../../src/ol/style/Fill.js'; -import _ol_style_Icon_ from '../../../../src/ol/style/Icon.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,7 +24,7 @@ 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 Style({ diff --git a/test/spec/ol/style/icon.test.js b/test/spec/ol/style/icon.test.js index 53963a513b..9f4e4ff037 100644 --- a/test/spec/ol/style/icon.test.js +++ b/test/spec/ol/style/icon.test.js @@ -1,6 +1,6 @@ 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 Icon from '../../../../src/ol/style/Icon.js'; import _ol_style_IconImage_ from '../../../../src/ol/style/IconImage.js'; @@ -13,7 +13,7 @@ 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 }); @@ -22,7 +22,7 @@ describe('ol.style.Icon', function() { }); 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, @@ -230,14 +230,14 @@ describe('ol.style.Icon', function() { var iconImage = new _ol_style_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 });