Rename _ol_style_Icon_ to Icon

This commit is contained in:
Tim Schaub
2018-01-11 13:25:01 -07:00
parent f4484455aa
commit fb22c587f8
18 changed files with 77 additions and 77 deletions

View File

@@ -12,7 +12,7 @@ import VectorLayer from '../src/ol/layer/Vector.js';
import TileJSON from '../src/ol/source/TileJSON.js'; import TileJSON from '../src/ol/source/TileJSON.js';
import VectorSource from '../src/ol/source/Vector.js'; import VectorSource from '../src/ol/source/Vector.js';
import Fill from '../src/ol/style/Fill.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 Stroke from '../src/ol/style/Stroke.js';
import Style from '../src/ol/style/Style.js'; import Style from '../src/ol/style/Style.js';
@@ -157,7 +157,7 @@ var map = new Map({
features: [pointFeature, lineFeature, polygonFeature] features: [pointFeature, lineFeature, polygonFeature]
}), }),
style: new Style({ style: new Style({
image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ image: new Icon(/** @type {olx.style.IconOptions} */ ({
anchor: [0.5, 46], anchor: [0.5, 46],
anchorXUnits: 'fraction', anchorXUnits: 'fraction',
anchorYUnits: 'pixels', anchorYUnits: 'pixels',

View File

@@ -8,7 +8,7 @@ import _ol_render_ from '../src/ol/render.js';
import Stamen from '../src/ol/source/Stamen.js'; import Stamen from '../src/ol/source/Stamen.js';
import VectorSource from '../src/ol/source/Vector.js'; import VectorSource from '../src/ol/source/Vector.js';
import Fill from '../src/ol/style/Fill.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 Stroke from '../src/ol/style/Stroke.js';
import Style from '../src/ol/style/Style.js'; import Style from '../src/ol/style/Style.js';
@@ -41,7 +41,7 @@ var styleFunction = function(feature) {
})); }));
vectorContext.drawGeometry(new Polygon([symbol.map(scaleFunction)])); vectorContext.drawGeometry(new Polygon([symbol.map(scaleFunction)]));
style = new Style({ style = new Style({
image: new _ol_style_Icon_({ image: new Icon({
img: canvas, img: canvas,
imgSize: [size, size], imgSize: [size, size],
rotation: 1.2 rotation: 1.2

View File

@@ -9,7 +9,7 @@ import BingMaps from '../src/ol/source/BingMaps.js';
import VectorSource from '../src/ol/source/Vector.js'; import VectorSource from '../src/ol/source/Vector.js';
import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js';
import Fill from '../src/ol/style/Fill.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 Stroke from '../src/ol/style/Stroke.js';
import Style from '../src/ol/style/Style.js'; import Style from '../src/ol/style/Style.js';
@@ -91,7 +91,7 @@ var styles = {
}) })
}), }),
'icon': new Style({ 'icon': new Style({
image: new _ol_style_Icon_({ image: new Icon({
anchor: [0.5, 1], anchor: [0.5, 1],
src: 'data/icon.png' src: 'data/icon.png'
}) })

View File

@@ -7,7 +7,7 @@ import VectorLayer from '../src/ol/layer/Vector.js';
import {fromLonLat} from '../src/ol/proj.js'; import {fromLonLat} from '../src/ol/proj.js';
import TileJSON from '../src/ol/source/TileJSON.js'; import TileJSON from '../src/ol/source/TileJSON.js';
import VectorSource from '../src/ol/source/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'; import Style from '../src/ol/style/Style.js';
@@ -24,7 +24,7 @@ var madrid = new Feature({
}); });
rome.setStyle(new Style({ rome.setStyle(new Style({
image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ image: new Icon(/** @type {olx.style.IconOptions} */ ({
color: '#8959A8', color: '#8959A8',
crossOrigin: 'anonymous', crossOrigin: 'anonymous',
src: 'data/dot.png' src: 'data/dot.png'
@@ -32,7 +32,7 @@ rome.setStyle(new Style({
})); }));
london.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', color: '#4271AE',
crossOrigin: 'anonymous', crossOrigin: 'anonymous',
src: 'data/dot.png' src: 'data/dot.png'
@@ -40,7 +40,7 @@ london.setStyle(new Style({
})); }));
madrid.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], color: [113, 140, 0],
crossOrigin: 'anonymous', crossOrigin: 'anonymous',
src: 'data/dot.png' src: 'data/dot.png'

View File

@@ -7,13 +7,13 @@ import TileLayer from '../src/ol/layer/Tile.js';
import VectorLayer from '../src/ol/layer/Vector.js'; import VectorLayer from '../src/ol/layer/Vector.js';
import Stamen from '../src/ol/source/Stamen.js'; import Stamen from '../src/ol/source/Stamen.js';
import VectorSource from '../src/ol/source/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'; import Style from '../src/ol/style/Style.js';
function createStyle(src, img) { function createStyle(src, img) {
return new Style({ return new Style({
image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ image: new Icon(/** @type {olx.style.IconOptions} */ ({
anchor: [0.5, 0.96], anchor: [0.5, 0.96],
crossOrigin: 'anonymous', crossOrigin: 'anonymous',
src: src, src: src,

View File

@@ -4,7 +4,7 @@ import View from '../src/ol/View.js';
import Point from '../src/ol/geom/Point.js'; import Point from '../src/ol/geom/Point.js';
import VectorLayer from '../src/ol/layer/Vector.js'; import VectorLayer from '../src/ol/layer/Vector.js';
import VectorSource from '../src/ol/source/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'; import Style from '../src/ol/style/Style.js';
@@ -44,7 +44,7 @@ var iconCount = iconInfo.length;
var icons = new Array(iconCount); var icons = new Array(iconCount);
for (i = 0; i < iconCount; ++i) { for (i = 0; i < iconCount; ++i) {
var info = iconInfo[i]; var info = iconInfo[i];
icons[i] = new _ol_style_Icon_({ icons[i] = new Icon({
offset: info.offset, offset: info.offset,
opacity: info.opacity, opacity: info.opacity,
rotateWithView: info.rotateWithView, rotateWithView: info.rotateWithView,

View File

@@ -7,7 +7,7 @@ import TileLayer from '../src/ol/layer/Tile.js';
import VectorLayer from '../src/ol/layer/Vector.js'; import VectorLayer from '../src/ol/layer/Vector.js';
import TileJSON from '../src/ol/source/TileJSON.js'; import TileJSON from '../src/ol/source/TileJSON.js';
import VectorSource from '../src/ol/source/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'; import Style from '../src/ol/style/Style.js';
@@ -19,7 +19,7 @@ var iconFeature = new Feature({
}); });
var iconStyle = new Style({ var iconStyle = new Style({
image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ image: new Icon(/** @type {olx.style.IconOptions} */ ({
anchor: [0.5, 46], anchor: [0.5, 46],
anchorXUnits: 'fraction', anchorXUnits: 'fraction',
anchorYUnits: 'pixels', anchorYUnits: 'pixels',

View File

@@ -6,7 +6,7 @@ import TileLayer from '../src/ol/layer/Tile.js';
import VectorLayer from '../src/ol/layer/Vector.js'; import VectorLayer from '../src/ol/layer/Vector.js';
import OSM from '../src/ol/source/OSM.js'; import OSM from '../src/ol/source/OSM.js';
import VectorSource from '../src/ol/source/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 Stroke from '../src/ol/style/Stroke.js'; import Stroke from '../src/ol/style/Stroke.js';
import Style from '../src/ol/style/Style.js'; import Style from '../src/ol/style/Style.js';
@@ -35,7 +35,7 @@ var styleFunction = function(feature) {
// arrows // arrows
styles.push(new Style({ styles.push(new Style({
geometry: new Point(end), geometry: new Point(end),
image: new _ol_style_Icon_({ image: new Icon({
src: 'data/arrow.png', src: 'data/arrow.png',
anchor: [0.75, 0.5], anchor: [0.75, 0.5],
rotateWithView: true, rotateWithView: true,

View File

@@ -5,7 +5,7 @@ import VectorTileLayer from '../src/ol/layer/VectorTile.js';
import {get as getProjection} from '../src/ol/proj.js'; import {get as getProjection} from '../src/ol/proj.js';
import VectorTileSource from '../src/ol/source/VectorTile.js'; import VectorTileSource from '../src/ol/source/VectorTile.js';
import Fill from '../src/ol/style/Fill.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 Stroke from '../src/ol/style/Stroke.js';
import Style from '../src/ol/style/Style.js'; import Style from '../src/ol/style/Style.js';
import _ol_style_Text_ from '../src/ol/style/Text.js'; import _ol_style_Text_ from '../src/ol/style/Text.js';
@@ -45,7 +45,7 @@ var map = new Map({
}), }),
tileUrlFunction: tileUrlFunction tileUrlFunction: tileUrlFunction
}), }),
style: createMapboxStreetsV6Style(Style, Fill, Stroke, _ol_style_Icon_, _ol_style_Text_) style: createMapboxStreetsV6Style(Style, Fill, Stroke, Icon, _ol_style_Text_)
}) })
], ],
target: 'map', target: 'map',

View File

@@ -4,7 +4,7 @@ import MVT from '../src/ol/format/MVT.js';
import VectorTileLayer from '../src/ol/layer/VectorTile.js'; import VectorTileLayer from '../src/ol/layer/VectorTile.js';
import VectorTileSource from '../src/ol/source/VectorTile.js'; import VectorTileSource from '../src/ol/source/VectorTile.js';
import Fill from '../src/ol/style/Fill.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 Stroke from '../src/ol/style/Stroke.js';
import Style from '../src/ol/style/Style.js'; import Style from '../src/ol/style/Style.js';
import _ol_style_Text_ from '../src/ol/style/Text.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/' + url: 'https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' +
'{z}/{x}/{y}.vector.pbf?access_token=' + key '{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', target: 'map',

View File

@@ -21,7 +21,7 @@ import Polygon from '../geom/Polygon.js';
import {toRadians} from '../math.js'; import {toRadians} from '../math.js';
import {get as getProjection} from '../proj.js'; import {get as getProjection} from '../proj.js';
import Fill from '../style/Fill.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 IconAnchorUnits from '../style/IconAnchorUnits.js';
import IconOrigin from '../style/IconOrigin.js'; import IconOrigin from '../style/IconOrigin.js';
import Stroke from '../style/Stroke.js'; import Stroke from '../style/Stroke.js';
@@ -197,7 +197,7 @@ KML.createStyleDefaults_ = function() {
* @type {ol.style.Image} * @type {ol.style.Image}
* @private * @private
*/ */
KML.DEFAULT_IMAGE_STYLE_ = new _ol_style_Icon_({ KML.DEFAULT_IMAGE_STYLE_ = new Icon({
anchor: KML.DEFAULT_IMAGE_STYLE_ANCHOR_, anchor: KML.DEFAULT_IMAGE_STYLE_ANCHOR_,
anchorOrigin: IconOrigin.BOTTOM_LEFT, anchorOrigin: IconOrigin.BOTTOM_LEFT,
anchorXUnits: KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_, 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, anchor: anchor,
anchorOrigin: anchorOrigin, anchorOrigin: anchorOrigin,
anchorXUnits: anchorXUnits, anchorXUnits: anchorXUnits,
@@ -2555,7 +2555,7 @@ KML.writeStyle_ = function(node, style, objectStack) {
var strokeStyle = style.getStroke(); var strokeStyle = style.getStroke();
var imageStyle = style.getImage(); var imageStyle = style.getImage();
var textStyle = style.getText(); var textStyle = style.getText();
if (imageStyle instanceof _ol_style_Icon_) { if (imageStyle instanceof Icon) {
properties['IconStyle'] = imageStyle; properties['IconStyle'] = imageStyle;
} }
if (textStyle) { if (textStyle) {

View File

@@ -9,7 +9,7 @@ import VectorLayer from '../layer/Vector.js';
import {clamp} from '../math.js'; import {clamp} from '../math.js';
import _ol_obj_ from '../obj.js'; import _ol_obj_ from '../obj.js';
import RenderEventType from '../render/EventType.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'; import Style from '../style/Style.js';
@@ -118,7 +118,7 @@ var Heatmap = function(opt_options) {
if (!style) { if (!style) {
style = [ style = [
new Style({ new Style({
image: new _ol_style_Icon_({ image: new Icon({
opacity: opacity, opacity: opacity,
src: this.circleImage_ src: this.circleImage_
}) })

View File

@@ -21,7 +21,7 @@ import _ol_style_Image_ from '../style/Image.js';
* @extends {ol.style.Image} * @extends {ol.style.Image}
* @api * @api
*/ */
var _ol_style_Icon_ = function(opt_options) { var Icon = function(opt_options) {
var options = 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. * @return {ol.style.Icon} The cloned style.
* @api * @api
*/ */
_ol_style_Icon_.prototype.clone = function() { Icon.prototype.clone = function() {
return new _ol_style_Icon_({ return new Icon({
anchor: this.anchor_.slice(), anchor: this.anchor_.slice(),
anchorOrigin: this.anchorOrigin_, anchorOrigin: this.anchorOrigin_,
anchorXUnits: this.anchorXUnits_, anchorXUnits: this.anchorXUnits_,
@@ -205,7 +205,7 @@ _ol_style_Icon_.prototype.clone = function() {
* @inheritDoc * @inheritDoc
* @api * @api
*/ */
_ol_style_Icon_.prototype.getAnchor = function() { Icon.prototype.getAnchor = function() {
if (this.normalizedAnchor_) { if (this.normalizedAnchor_) {
return this.normalizedAnchor_; return this.normalizedAnchor_;
} }
@@ -251,7 +251,7 @@ _ol_style_Icon_.prototype.getAnchor = function() {
* @return {ol.Color} Color. * @return {ol.Color} Color.
* @api * @api
*/ */
_ol_style_Icon_.prototype.getColor = function() { Icon.prototype.getColor = function() {
return this.color_; return this.color_;
}; };
@@ -263,7 +263,7 @@ _ol_style_Icon_.prototype.getColor = function() {
* @override * @override
* @api * @api
*/ */
_ol_style_Icon_.prototype.getImage = function(pixelRatio) { Icon.prototype.getImage = function(pixelRatio) {
return this.iconImage_.getImage(pixelRatio); return this.iconImage_.getImage(pixelRatio);
}; };
@@ -271,7 +271,7 @@ _ol_style_Icon_.prototype.getImage = function(pixelRatio) {
/** /**
* @override * @override
*/ */
_ol_style_Icon_.prototype.getImageSize = function() { Icon.prototype.getImageSize = function() {
return this.iconImage_.getSize(); return this.iconImage_.getSize();
}; };
@@ -279,7 +279,7 @@ _ol_style_Icon_.prototype.getImageSize = function() {
/** /**
* @override * @override
*/ */
_ol_style_Icon_.prototype.getHitDetectionImageSize = function() { Icon.prototype.getHitDetectionImageSize = function() {
return this.getImageSize(); return this.getImageSize();
}; };
@@ -287,7 +287,7 @@ _ol_style_Icon_.prototype.getHitDetectionImageSize = function() {
/** /**
* @override * @override
*/ */
_ol_style_Icon_.prototype.getImageState = function() { Icon.prototype.getImageState = function() {
return this.iconImage_.getImageState(); return this.iconImage_.getImageState();
}; };
@@ -295,7 +295,7 @@ _ol_style_Icon_.prototype.getImageState = function() {
/** /**
* @override * @override
*/ */
_ol_style_Icon_.prototype.getHitDetectionImage = function(pixelRatio) { Icon.prototype.getHitDetectionImage = function(pixelRatio) {
return this.iconImage_.getHitDetectionImage(pixelRatio); return this.iconImage_.getHitDetectionImage(pixelRatio);
}; };
@@ -304,7 +304,7 @@ _ol_style_Icon_.prototype.getHitDetectionImage = function(pixelRatio) {
* @inheritDoc * @inheritDoc
* @api * @api
*/ */
_ol_style_Icon_.prototype.getOrigin = function() { Icon.prototype.getOrigin = function() {
if (this.origin_) { if (this.origin_) {
return this.origin_; return this.origin_;
} }
@@ -336,7 +336,7 @@ _ol_style_Icon_.prototype.getOrigin = function() {
* @return {string|undefined} Image src. * @return {string|undefined} Image src.
* @api * @api
*/ */
_ol_style_Icon_.prototype.getSrc = function() { Icon.prototype.getSrc = function() {
return this.iconImage_.getSrc(); return this.iconImage_.getSrc();
}; };
@@ -345,7 +345,7 @@ _ol_style_Icon_.prototype.getSrc = function() {
* @inheritDoc * @inheritDoc
* @api * @api
*/ */
_ol_style_Icon_.prototype.getSize = function() { Icon.prototype.getSize = function() {
return !this.size_ ? this.iconImage_.getSize() : this.size_; return !this.size_ ? this.iconImage_.getSize() : this.size_;
}; };
@@ -353,7 +353,7 @@ _ol_style_Icon_.prototype.getSize = function() {
/** /**
* @override * @override
*/ */
_ol_style_Icon_.prototype.listenImageChange = function(listener, thisArg) { Icon.prototype.listenImageChange = function(listener, thisArg) {
return _ol_events_.listen(this.iconImage_, EventType.CHANGE, return _ol_events_.listen(this.iconImage_, EventType.CHANGE,
listener, thisArg); listener, thisArg);
}; };
@@ -367,7 +367,7 @@ _ol_style_Icon_.prototype.listenImageChange = function(listener, thisArg) {
* @override * @override
* @api * @api
*/ */
_ol_style_Icon_.prototype.load = function() { Icon.prototype.load = function() {
this.iconImage_.load(); this.iconImage_.load();
}; };
@@ -375,8 +375,8 @@ _ol_style_Icon_.prototype.load = function() {
/** /**
* @override * @override
*/ */
_ol_style_Icon_.prototype.unlistenImageChange = function(listener, thisArg) { Icon.prototype.unlistenImageChange = function(listener, thisArg) {
_ol_events_.unlisten(this.iconImage_, EventType.CHANGE, _ol_events_.unlisten(this.iconImage_, EventType.CHANGE,
listener, thisArg); listener, thisArg);
}; };
export default _ol_style_Icon_; export default Icon;

View File

@@ -4,7 +4,7 @@ import Map from '../../../../src/ol/Map.js';
import View from '../../../../src/ol/View.js'; import View from '../../../../src/ol/View.js';
import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js';
import VectorSource from '../../../../src/ol/source/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'; import Style from '../../../../src/ol/style/Style.js';
@@ -59,7 +59,7 @@ describe('ol.rendering.style.Icon', function() {
img.onload = function() { img.onload = function() {
imgInfo.img = img; imgInfo.img = img;
feature.setStyle(new Style({ 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); vectorSource.addFeature(feature);
callback(); callback();

View File

@@ -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 {remove as removeTransform} from '../../../../src/ol/proj/transforms.js';
import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js';
import Fill from '../../../../src/ol/style/Fill.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 IconAnchorUnits from '../../../../src/ol/style/IconAnchorUnits.js';
import IconOrigin from '../../../../src/ol/style/IconOrigin.js'; import IconOrigin from '../../../../src/ol/style/IconOrigin.js';
import Stroke from '../../../../src/ol/style/Stroke.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.getFill()).to.be(KML.DEFAULT_FILL_STYLE_);
expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_);
var imageStyle = style.getImage(); 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(new URL(imageStyle.getSrc()).href).to.eql(new URL('http://foo.png').href);
expect(imageStyle.getAnchor()).to.be(null); expect(imageStyle.getAnchor()).to.be(null);
expect(imageStyle.getOrigin()).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.getFill()).to.be(KML.DEFAULT_FILL_STYLE_);
expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_);
var imageStyle = style.getImage(); 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(new URL(imageStyle.getSrc()).href).to.eql(new URL('http://foo.png').href);
expect(imageStyle.anchor_).to.be.an(Array); expect(imageStyle.anchor_).to.be.an(Array);
expect(imageStyle.anchor_).to.have.length(2); 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() { it('can write an feature\'s icon style', function() {
var style = new Style({ var style = new Style({
image: new _ol_style_Icon_({ image: new Icon({
anchor: [0.25, 36], anchor: [0.25, 36],
anchorOrigin: 'top-left', anchorOrigin: 'top-left',
anchorXUnits: 'fraction', anchorXUnits: 'fraction',
@@ -2314,7 +2314,7 @@ describe('ol.format.KML', function() {
it('does not write styles when writeStyles option is false', function() { it('does not write styles when writeStyles option is false', function() {
format = new KML({writeStyles: false}); format = new KML({writeStyles: false});
var style = new Style({ var style = new Style({
image: new _ol_style_Icon_({ image: new Icon({
src: 'http://foo.png' src: 'http://foo.png'
}) })
}); });
@@ -3209,7 +3209,7 @@ describe('ol.format.KML', function() {
var style = styleArray[0]; var style = styleArray[0];
expect(style).to.be.an(Style); expect(style).to.be.an(Style);
var imageStyle = style.getImage(); 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'); expect(imageStyle.getSrc()).to.eql('http://maps.google.com/mapfiles/kml/shapes/star.png');
}); });

View File

@@ -8,7 +8,7 @@ import VectorLayer from '../../../../../src/ol/layer/Vector.js';
import CanvasLayerRenderer from '../../../../../src/ol/renderer/canvas/Layer.js'; import CanvasLayerRenderer from '../../../../../src/ol/renderer/canvas/Layer.js';
import CanvasMapRenderer from '../../../../../src/ol/renderer/canvas/Map.js'; import CanvasMapRenderer from '../../../../../src/ol/renderer/canvas/Map.js';
import VectorSource from '../../../../../src/ol/source/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'; import Style from '../../../../../src/ol/style/Style.js';
describe('ol.renderer.canvas.Map', function() { describe('ol.renderer.canvas.Map', function() {
@@ -59,7 +59,7 @@ describe('ol.renderer.canvas.Map', function() {
] ]
}), }),
style: new Style({ style: new Style({
image: new _ol_style_Icon_({ image: new Icon({
img: img, img: img,
imgSize: [1, 1] imgSize: [1, 1]
}) })

View File

@@ -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_render_canvas_ReplayGroup_ from '../../../../src/ol/render/canvas/ReplayGroup.js';
import _ol_renderer_vector_ from '../../../../src/ol/renderer/vector.js'; import _ol_renderer_vector_ from '../../../../src/ol/renderer/vector.js';
import Fill from '../../../../src/ol/style/Fill.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 Stroke from '../../../../src/ol/style/Stroke.js';
import Style from '../../../../src/ol/style/Style.js'; import Style from '../../../../src/ol/style/Style.js';
import Feature from '../../../../src/ol/Feature.js'; import Feature from '../../../../src/ol/Feature.js';
@@ -24,7 +24,7 @@ describe('ol.renderer.vector', function() {
beforeEach(function() { beforeEach(function() {
replayGroup = new _ol_render_canvas_ReplayGroup_(1); replayGroup = new _ol_render_canvas_ReplayGroup_(1);
feature = new Feature(); feature = new Feature();
iconStyle = new _ol_style_Icon_({ iconStyle = new Icon({
src: 'http://example.com/icon.png' src: 'http://example.com/icon.png'
}); });
style = new Style({ style = new Style({

View File

@@ -1,6 +1,6 @@
import {getUid} from '../../../../src/ol/index.js'; import {getUid} from '../../../../src/ol/index.js';
import {iconImageCache} from '../../../../src/ol/style.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'; 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() { it('caches canvas images with a uid as src', function() {
var canvas = document.createElement('canvas'); var canvas = document.createElement('canvas');
new _ol_style_Icon_({ new Icon({
img: canvas, img: canvas,
imgSize: size imgSize: size
}); });
@@ -22,7 +22,7 @@ describe('ol.style.Icon', function() {
}); });
it('imgSize overrides img.width and img.height', function(done) { it('imgSize overrides img.width and img.height', function(done) {
var style = new _ol_style_Icon_({ var style = new Icon({
src: src, src: src,
imgSize: size imgSize: size
}); });
@@ -39,17 +39,17 @@ describe('ol.style.Icon', function() {
describe('#clone', function() { describe('#clone', function() {
it('creates a new ol.style.Icon', function() { it('creates a new ol.style.Icon', function() {
var original = new _ol_style_Icon_({ var original = new Icon({
src: src src: src
}); });
var clone = original.clone(); var clone = original.clone();
expect(clone).to.be.an(_ol_style_Icon_); expect(clone).to.be.an(Icon);
expect(clone).to.not.be(original); expect(clone).to.not.be(original);
}); });
it('copies all values ', function() { it('copies all values ', function() {
var canvas = document.createElement('canvas'); var canvas = document.createElement('canvas');
var original = new _ol_style_Icon_({ var original = new Icon({
anchor: [1, 0], anchor: [1, 0],
anchorOrigin: 'bottom-right', anchorOrigin: 'bottom-right',
anchorXUnits: 'pixels', anchorXUnits: 'pixels',
@@ -85,7 +85,7 @@ describe('ol.style.Icon', function() {
expect(original.getRotateWithView()).to.eql(clone.getRotateWithView()); expect(original.getRotateWithView()).to.eql(clone.getRotateWithView());
expect(original.getSnapToPixel()).to.eql(clone.getSnapToPixel()); expect(original.getSnapToPixel()).to.eql(clone.getSnapToPixel());
var original2 = new _ol_style_Icon_({ var original2 = new Icon({
src: src src: src
}); });
var clone2 = original2.clone(); 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() { 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], anchor: [1, 0],
color: [1, 2, 3, 0.4], color: [1, 2, 3, 0.4],
src: src, src: src,
@@ -123,7 +123,7 @@ describe('ol.style.Icon', function() {
var fractionAnchor = [0.25, 0.25]; var fractionAnchor = [0.25, 0.25];
it('uses fractional units by default', function() { it('uses fractional units by default', function() {
var iconStyle = new _ol_style_Icon_({ var iconStyle = new Icon({
src: 'test.png', src: 'test.png',
size: size, size: size,
anchor: fractionAnchor anchor: fractionAnchor
@@ -132,7 +132,7 @@ describe('ol.style.Icon', function() {
}); });
it('uses pixels units', function() { it('uses pixels units', function() {
var iconStyle = new _ol_style_Icon_({ var iconStyle = new Icon({
src: 'test.png', src: 'test.png',
size: size, size: size,
anchor: [2, 18], anchor: [2, 18],
@@ -143,7 +143,7 @@ describe('ol.style.Icon', function() {
}); });
it('uses a bottom left anchor origin', function() { it('uses a bottom left anchor origin', function() {
var iconStyle = new _ol_style_Icon_({ var iconStyle = new Icon({
src: 'test.png', src: 'test.png',
size: size, size: size,
anchor: fractionAnchor, anchor: fractionAnchor,
@@ -153,7 +153,7 @@ describe('ol.style.Icon', function() {
}); });
it('uses a bottom right anchor origin', function() { it('uses a bottom right anchor origin', function() {
var iconStyle = new _ol_style_Icon_({ var iconStyle = new Icon({
src: 'test.png', src: 'test.png',
size: size, size: size,
anchor: fractionAnchor, anchor: fractionAnchor,
@@ -163,7 +163,7 @@ describe('ol.style.Icon', function() {
}); });
it('uses a top right anchor origin', function() { it('uses a top right anchor origin', function() {
var iconStyle = new _ol_style_Icon_({ var iconStyle = new Icon({
src: 'test.png', src: 'test.png',
size: size, size: size,
anchor: fractionAnchor, anchor: fractionAnchor,
@@ -178,7 +178,7 @@ describe('ol.style.Icon', function() {
var imageSize = [144, 192]; var imageSize = [144, 192];
it('uses a top left offset origin (default)', function() { it('uses a top left offset origin (default)', function() {
var iconStyle = new _ol_style_Icon_({ var iconStyle = new Icon({
src: 'test.png', src: 'test.png',
size: size, size: size,
offset: offset offset: offset
@@ -187,7 +187,7 @@ describe('ol.style.Icon', function() {
}); });
it('uses a bottom left offset origin', function() { it('uses a bottom left offset origin', function() {
var iconStyle = new _ol_style_Icon_({ var iconStyle = new Icon({
src: 'test.png', src: 'test.png',
size: size, size: size,
offset: offset, offset: offset,
@@ -198,7 +198,7 @@ describe('ol.style.Icon', function() {
}); });
it('uses a bottom right offset origin', function() { it('uses a bottom right offset origin', function() {
var iconStyle = new _ol_style_Icon_({ var iconStyle = new Icon({
src: 'test.png', src: 'test.png',
size: size, size: size,
offset: offset, offset: offset,
@@ -209,7 +209,7 @@ describe('ol.style.Icon', function() {
}); });
it('uses a top right offset origin', function() { it('uses a top right offset origin', function() {
var iconStyle = new _ol_style_Icon_({ var iconStyle = new Icon({
src: 'test.png', src: 'test.png',
size: size, size: size,
offset: offset, offset: offset,
@@ -230,14 +230,14 @@ describe('ol.style.Icon', function() {
var iconImage = new _ol_style_IconImage_(null, 'test.png', imgSize); var iconImage = new _ol_style_IconImage_(null, 'test.png', imgSize);
iconImageCache.set(src, null, null, iconImage); iconImageCache.set(src, null, null, iconImage);
var iconStyle = new _ol_style_Icon_({ var iconStyle = new Icon({
src: 'test.png' src: 'test.png'
}); });
expect(iconStyle.getImageSize()).to.eql(imgSize); expect(iconStyle.getImageSize()).to.eql(imgSize);
}); });
it('uses the given image size', function() { it('uses the given image size', function() {
var iconStyle = new _ol_style_Icon_({ var iconStyle = new Icon({
img: {src: 'test.png'}, img: {src: 'test.png'},
imgSize: imgSize imgSize: imgSize
}); });