diff --git a/examples/cluster.js b/examples/cluster.js index fb9843e82f..bd95ecda01 100644 --- a/examples/cluster.js +++ b/examples/cluster.js @@ -11,7 +11,7 @@ import _ol_style_Circle_ 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 _ol_style_Text_ from '../src/ol/style/Text.js'; +import Text from '../src/ol/style/Text.js'; var distance = document.getElementById('distance'); @@ -50,7 +50,7 @@ var clusters = new VectorLayer({ color: '#3399CC' }) }), - text: new _ol_style_Text_({ + text: new Text({ text: size.toString(), fill: new Fill({ color: '#fff' diff --git a/examples/earthquake-clusters.js b/examples/earthquake-clusters.js index 471eb45018..03992f1620 100644 --- a/examples/earthquake-clusters.js +++ b/examples/earthquake-clusters.js @@ -14,7 +14,7 @@ import Fill from '../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.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'; +import Text from '../src/ol/style/Text.js'; var earthquakeFill = new Fill({ @@ -92,7 +92,7 @@ function styleFunction(feature, resolution) { 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 diff --git a/examples/image-vector-layer.js b/examples/image-vector-layer.js index 369c1cced6..c42cc680de 100644 --- a/examples/image-vector-layer.js +++ b/examples/image-vector-layer.js @@ -6,7 +6,7 @@ import VectorSource from '../src/ol/source/Vector.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_style_Text_ from '../src/ol/style/Text.js'; +import Text from '../src/ol/style/Text.js'; var style = new Style({ @@ -17,7 +17,7 @@ var style = new Style({ color: '#319FD3', width: 1 }), - text: new _ol_style_Text_() + text: new Text() }); var map = new Map({ diff --git a/examples/mapbox-vector-tiles-advanced.js b/examples/mapbox-vector-tiles-advanced.js index 23eec433d7..7a48b09588 100644 --- a/examples/mapbox-vector-tiles-advanced.js +++ b/examples/mapbox-vector-tiles-advanced.js @@ -8,7 +8,7 @@ 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 _ol_style_Text_ from '../src/ol/style/Text.js'; +import Text from '../src/ol/style/Text.js'; import TileGrid from '../src/ol/tilegrid/TileGrid.js'; @@ -45,7 +45,7 @@ var map = new Map({ }), tileUrlFunction: tileUrlFunction }), - style: createMapboxStreetsV6Style(Style, Fill, Stroke, 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 65e59588a3..4c7ae3d7d0 100644 --- a/examples/mapbox-vector-tiles.js +++ b/examples/mapbox-vector-tiles.js @@ -7,7 +7,7 @@ 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 _ol_style_Text_ from '../src/ol/style/Text.js'; +import Text from '../src/ol/style/Text.js'; var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg'; @@ -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, Icon, _ol_style_Text_) + style: createMapboxStreetsV6Style(Style, Fill, Stroke, Icon, Text) }) ], target: 'map', diff --git a/examples/street-labels.js b/examples/street-labels.js index 4a5d178d01..6d7dc1ef5f 100644 --- a/examples/street-labels.js +++ b/examples/street-labels.js @@ -8,10 +8,10 @@ import BingMaps from '../src/ol/source/BingMaps.js'; import VectorSource from '../src/ol/source/Vector.js'; import Fill from '../src/ol/style/Fill.js'; import Style from '../src/ol/style/Style.js'; -import _ol_style_Text_ from '../src/ol/style/Text.js'; +import Text from '../src/ol/style/Text.js'; var style = new Style({ - text: new _ol_style_Text_({ + text: new Text({ font: 'bold 11px "Open Sans", "Arial Unicode MS", "sans-serif"', placement: 'line', fill: new Fill({ diff --git a/examples/topolis.js b/examples/topolis.js index 07a4603d9c..aae8664ce7 100644 --- a/examples/topolis.js +++ b/examples/topolis.js @@ -17,7 +17,7 @@ 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 _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Text_ from '../src/ol/style/Text.js'; +import Text from '../src/ol/style/Text.js'; import MousePosition from '../src/ol/control/MousePosition.js'; var raster = new TileLayer({ @@ -34,7 +34,7 @@ var nodesLayer = new VectorLayer({ 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 Fill({color: 'red'}), stroke: new Stroke({ @@ -56,7 +56,7 @@ var edgesLayer = new VectorLayer({ color: 'blue', width: 1 }), - text: new _ol_style_Text_({ + text: new Text({ text: f.get('edge').id.toString(), fill: new Fill({color: 'blue'}), stroke: new Stroke({ @@ -81,7 +81,7 @@ var facesLayer = new VectorLayer({ 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 Fill({color: 'green'}), diff --git a/examples/vector-label-decluttering.js b/examples/vector-label-decluttering.js index 0505b3a687..8daf6e326f 100644 --- a/examples/vector-label-decluttering.js +++ b/examples/vector-label-decluttering.js @@ -7,7 +7,7 @@ import VectorSource from '../src/ol/source/Vector.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_style_Text_ from '../src/ol/style/Text.js'; +import Text from '../src/ol/style/Text.js'; var map = new Map({ target: 'map', @@ -35,7 +35,7 @@ var labelStyle = new Style({ } return geometry; }, - text: new _ol_style_Text_({ + text: new Text({ font: '12px Calibri,sans-serif', overflow: true, fill: new Fill({ diff --git a/examples/vector-labels.js b/examples/vector-labels.js index 1ebbef72a8..d80fab0219 100644 --- a/examples/vector-labels.js +++ b/examples/vector-labels.js @@ -9,7 +9,7 @@ import _ol_style_Circle_ 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 _ol_style_Text_ from '../src/ol/style/Text.js'; +import Text from '../src/ol/style/Text.js'; var openSansAdded = false; @@ -109,7 +109,7 @@ 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, diff --git a/examples/vector-layer.js b/examples/vector-layer.js index 7b69f61c2b..66b9b8bab2 100644 --- a/examples/vector-layer.js +++ b/examples/vector-layer.js @@ -6,7 +6,7 @@ import VectorSource from '../src/ol/source/Vector.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_style_Text_ from '../src/ol/style/Text.js'; +import Text from '../src/ol/style/Text.js'; var style = new Style({ @@ -17,7 +17,7 @@ var style = new Style({ color: '#319FD3', width: 1 }), - text: new _ol_style_Text_({ + text: new Text({ font: '12px Calibri,sans-serif', fill: new Fill({ color: '#000' @@ -57,7 +57,7 @@ var highlightStyle = new Style({ 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 Fill({ color: '#000' diff --git a/src/ol/Graticule.js b/src/ol/Graticule.js index fd8a4992bf..ff950a4095 100644 --- a/src/ol/Graticule.js +++ b/src/ol/Graticule.js @@ -12,7 +12,7 @@ import {get as getProjection, equivalent as equivalentProjection, getTransform, import RenderEventType from './render/EventType.js'; import Fill from './style/Fill.js'; import Stroke from './style/Stroke.js'; -import _ol_style_Text_ from './style/Text.js'; +import Text from './style/Text.js'; /** @@ -283,7 +283,7 @@ 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 Fill({ @@ -300,7 +300,7 @@ 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 Fill({ diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index ce85ca9d25..95c0831a29 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -26,7 +26,7 @@ import IconAnchorUnits from '../style/IconAnchorUnits.js'; import IconOrigin from '../style/IconOrigin.js'; import Stroke from '../style/Stroke.js'; import Style from '../style/Style.js'; -import _ol_style_Text_ from '../style/Text.js'; +import Text from '../style/Text.js'; import _ol_xml_ from '../xml.js'; /** @@ -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_, @@ -665,7 +665,7 @@ KML.LabelStyleParser_ = function(node, objectStack) { return; } var styleObject = objectStack[objectStack.length - 1]; - var textStyle = new _ol_style_Text_({ + var textStyle = new Text({ fill: new Fill({ color: /** @type {ol.Color} */ ('color' in object ? object['color'] : KML.DEFAULT_COLOR_) diff --git a/src/ol/style/Text.js b/src/ol/style/Text.js index 2f8c8ebfbe..e8beec8dd7 100644 --- a/src/ol/style/Text.js +++ b/src/ol/style/Text.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 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/vector.test.js b/test/rendering/ol/layer/vector.test.js index 062b013dcb..3a3ab5fa38 100644 --- a/test/rendering/ol/layer/vector.test.js +++ b/test/rendering/ol/layer/vector.test.js @@ -12,7 +12,7 @@ import _ol_style_Circle_ 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 _ol_style_Text_ from '../../../../src/ol/style/Text.js'; +import Text from '../../../../src/ol/style/Text.js'; describe('ol.rendering.layer.Vector', function() { @@ -606,7 +606,7 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { return new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: feature.get('text'), font: '12px sans-serif' }) @@ -647,7 +647,7 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { return new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: feature.get('text'), font: '12px sans-serif' }) @@ -690,7 +690,7 @@ describe('ol.rendering.layer.Vector', function() { layer.setStyle(function(feature) { return new Style({ zIndex: feature.get('zIndex'), - text: new _ol_style_Text_({ + text: new Text({ text: feature.get('text'), font: '12px sans-serif' }) @@ -850,7 +850,7 @@ describe('ol.rendering.layer.Vector', function() { color: 'blue' }) }), - text: new _ol_style_Text_({ + text: new Text({ text: feature.get('text'), font: '12px sans-serif', textBaseline: 'bottom', @@ -890,7 +890,7 @@ describe('ol.rendering.layer.Vector', function() { color: '#CCC', width: 12 }), - text: new _ol_style_Text_({ + text: new Text({ placement: 'line', text: 'east-west', font: '12px sans-serif' @@ -933,7 +933,7 @@ describe('ol.rendering.layer.Vector', function() { color: '#CCC', width: 12 }), - text: new _ol_style_Text_({ + text: new Text({ placement: 'line', text: 'east-west', font: '12px sans-serif' @@ -978,7 +978,7 @@ describe('ol.rendering.layer.Vector', function() { 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 d849d9a4c0..e7131335b1 100644 --- a/test/rendering/ol/layer/vectortile.test.js +++ b/test/rendering/ol/layer/vectortile.test.js @@ -11,7 +11,7 @@ import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import Fill from '../../../../src/ol/style/Fill.js'; import Style from '../../../../src/ol/style/Style.js'; -import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; +import Text from '../../../../src/ol/style/Text.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -150,7 +150,7 @@ describe('ol.rendering.layer.VectorTile', function() { 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/style/text.test.js b/test/rendering/ol/style/text.test.js index 40ff98bfc5..9bd39dab7d 100644 --- a/test/rendering/ol/style/text.test.js +++ b/test/rendering/ol/style/text.test.js @@ -8,7 +8,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_Text_ from '../../../../src/ol/style/Text.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'; @@ -53,7 +53,7 @@ describe('ol.rendering.style.Text', function() { geometry: new Point([-20, 18]) }); feature.setStyle(new Style({ - text: new _ol_style_Text_({ + text: new Text({ scale: scale, text: 'hello', font: '10px sans-serif' @@ -65,7 +65,7 @@ describe('ol.rendering.style.Text', function() { geometry: new Point([-10, 0]) }); feature.setStyle(new Style({ - text: new _ol_style_Text_({ + text: new Text({ scale: scale, text: 'hello', fill: new Fill({ @@ -84,7 +84,7 @@ describe('ol.rendering.style.Text', function() { geometry: new Point([20, 10]) }); feature.setStyle(new Style({ - text: new _ol_style_Text_({ + text: new Text({ scale: scale, rotateWithView: true, text: 'hello', @@ -111,7 +111,7 @@ describe('ol.rendering.style.Text', function() { stroke: new Stroke({ color: 'red' }), - text: new _ol_style_Text_({ + text: new Text({ text: 'Hello world', font: 'bold 14px sans-serif', scale: scale || 1, @@ -177,7 +177,7 @@ describe('ol.rendering.style.Text', function() { var feature; feature = new Feature(new Point([25, 0])); feature.setStyle(new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'Hello world\nleft', font: 'bold 14px sans-serif', textAlign: 'left' @@ -186,7 +186,7 @@ describe('ol.rendering.style.Text', function() { vectorSource.addFeature(feature); feature = new Feature(new Point([-25, 0])); feature.setStyle(new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'Hello world\nright', font: 'bold 14px sans-serif', textAlign: 'right' @@ -195,7 +195,7 @@ describe('ol.rendering.style.Text', function() { vectorSource.addFeature(feature); feature = new Feature(new Point([0, 25])); feature.setStyle(new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'Hello world\nbottom', font: 'bold 14px sans-serif', textBaseline: 'bottom' @@ -204,7 +204,7 @@ describe('ol.rendering.style.Text', function() { vectorSource.addFeature(feature); feature = new Feature(new Point([0, -25])); feature.setStyle(new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'top\nHello world', font: 'bold 14px sans-serif', textBaseline: 'top' @@ -219,7 +219,7 @@ describe('ol.rendering.style.Text', function() { var feature; feature = new Feature(new Point([0, 0])); feature.setStyle(new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'Hello world\nleft', font: 'bold 14px sans-serif', textAlign: 'left', @@ -229,7 +229,7 @@ describe('ol.rendering.style.Text', function() { vectorSource.addFeature(feature); feature = new Feature(new Point([0, 0])); feature.setStyle(new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'Hello world\nright', font: 'bold 14px sans-serif', textAlign: 'right', @@ -239,7 +239,7 @@ describe('ol.rendering.style.Text', function() { vectorSource.addFeature(feature); feature = new Feature(new Point([0, 0])); feature.setStyle(new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'Hello world\nbottom', font: 'bold 14px sans-serif', textBaseline: 'bottom', @@ -249,7 +249,7 @@ describe('ol.rendering.style.Text', function() { vectorSource.addFeature(feature); feature = new Feature(new Point([0, 0])); feature.setStyle(new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'top\nHello world', font: 'bold 14px sans-serif', textBaseline: 'top', @@ -274,7 +274,7 @@ describe('ol.rendering.style.Text', function() { geom.appendLineString(line); var feature = new Feature(geom); feature.setStyle(new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'Hello world', placement: 'line', font: 'bold 30px sans-serif' @@ -291,7 +291,7 @@ describe('ol.rendering.style.Text', function() { geom.setFlatCoordinates('XY', polygon, [polygon.length]); var feature = new Feature(geom); feature.setStyle(new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'Hello world', font: 'bold 24px sans-serif', placement: 'line', @@ -317,7 +317,7 @@ describe('ol.rendering.style.Text', function() { multiPolygon.appendPolygon(geom); var feature = new Feature(multiPolygon); feature.setStyle(new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'Hello world', font: 'bold 24px sans-serif', placement: 'line', diff --git a/test/spec/ol/format/kml.test.js b/test/spec/ol/format/kml.test.js index 65cdc98177..40314fc547 100644 --- a/test/spec/ol/format/kml.test.js +++ b/test/spec/ol/format/kml.test.js @@ -20,7 +20,7 @@ import IconAnchorUnits from '../../../../src/ol/style/IconAnchorUnits.js'; import IconOrigin from '../../../../src/ol/style/IconOrigin.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'; +import Text from '../../../../src/ol/style/Text.js'; import _ol_xml_ from '../../../../src/ol/xml.js'; @@ -1944,7 +1944,7 @@ describe('ol.format.KML', function() { 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(Fill); @@ -2361,7 +2361,7 @@ describe('ol.format.KML', function() { it('can write an feature\'s text style', function() { var style = new Style({ - text: new _ol_style_Text_({ + text: new Text({ scale: 0.5, text: 'foo', fill: new Fill({ diff --git a/test/spec/ol/graticule.test.js b/test/spec/ol/graticule.test.js index 257b79f967..8b62655278 100644 --- a/test/spec/ol/graticule.test.js +++ b/test/spec/ol/graticule.test.js @@ -2,7 +2,7 @@ import Graticule from '../../../src/ol/Graticule.js'; import Map from '../../../src/ol/Map.js'; import {get as getProjection} from '../../../src/ol/proj.js'; import Stroke from '../../../src/ol/style/Stroke.js'; -import _ol_style_Text_ from '../../../src/ol/style/Text.js'; +import Text from '../../../src/ol/style/Text.js'; describe('ol.Graticule', function() { var 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/render/canvas/immediate.test.js b/test/spec/ol/render/canvas/immediate.test.js index 6eeaa074fc..1da35cc03e 100644 --- a/test/spec/ol/render/canvas/immediate.test.js +++ b/test/spec/ol/render/canvas/immediate.test.js @@ -12,7 +12,7 @@ import _ol_style_Circle_ 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 _ol_style_Text_ from '../../../../../src/ol/style/Text.js'; +import Text from '../../../../../src/ol/style/Text.js'; describe('ol.render.canvas.Immediate', function() { @@ -44,7 +44,7 @@ describe('ol.render.canvas.Immediate', function() { sinon.spy(context, 'setTextStyle'); var fill = new Fill({}); var stroke = new Stroke({}); - var text = new _ol_style_Text_({}); + var text = new Text({}); var image = new _ol_style_Circle_({}); var style = new Style({ fill: fill, 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/webgl/textreplay.test.js b/test/spec/ol/render/webgl/textreplay.test.js index 14debc1c44..5ba68a74c5 100644 --- a/test/spec/ol/render/webgl/textreplay.test.js +++ b/test/spec/ol/render/webgl/textreplay.test.js @@ -3,13 +3,13 @@ import Point from '../../../../../src/ol/geom/Point.js'; import _ol_render_webgl_TextReplay_ from '../../../../../src/ol/render/webgl/TextReplay.js'; import Fill from '../../../../../src/ol/style/Fill.js'; import Stroke from '../../../../../src/ol/style/Stroke.js'; -import _ol_style_Text_ from '../../../../../src/ol/style/Text.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, diff --git a/test/spec/ol/renderer/canvas/vectorlayer.test.js b/test/spec/ol/renderer/canvas/vectorlayer.test.js index 216538b69e..e3e0312608 100644 --- a/test/spec/ol/renderer/canvas/vectorlayer.test.js +++ b/test/spec/ol/renderer/canvas/vectorlayer.test.js @@ -11,7 +11,7 @@ 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 Style from '../../../../../src/ol/style/Style.js'; -import _ol_style_Text_ from '../../../../../src/ol/style/Text.js'; +import Text from '../../../../../src/ol/style/Text.js'; describe('ol.renderer.canvas.VectorLayer', function() { @@ -57,12 +57,12 @@ describe('ol.renderer.canvas.VectorLayer', function() { target: target }); var layerStyle = [new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'layer' }) })]; var featureStyle = [new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'feature' }) })]; @@ -94,7 +94,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { target: target }); var layerStyle = new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'layer', font: '12px "Unavailable Font",sans-serif' }) @@ -125,7 +125,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { target: target }); var layerStyle = new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'layer', font: '12px sans-serif' }) @@ -157,7 +157,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { target: target }); var layerStyle = new Style({ - text: new _ol_style_Text_({ + 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 ae85667136..b738364496 100644 --- a/test/spec/ol/renderer/canvas/vectortilelayer.test.js +++ b/test/spec/ol/renderer/canvas/vectortilelayer.test.js @@ -17,7 +17,7 @@ import _ol_render_Feature_ from '../../../../../src/ol/render/Feature.js'; import CanvasVectorTileLayerRenderer from '../../../../../src/ol/renderer/canvas/VectorTileLayer.js'; import VectorTileSource from '../../../../../src/ol/source/VectorTile.js'; import Style from '../../../../../src/ol/style/Style.js'; -import _ol_style_Text_ from '../../../../../src/ol/style/Text.js'; +import Text from '../../../../../src/ol/style/Text.js'; import _ol_tilegrid_ from '../../../../../src/ol/tilegrid.js'; @@ -46,12 +46,12 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { target: target }); layerStyle = [new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'layer' }) })]; var featureStyle = [new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'feature' }) })]; @@ -217,7 +217,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { var layer2 = new VectorTileLayer({ source: source, style: new Style({ - text: new _ol_style_Text_({ + text: new Text({ text: 'layer2' }) }) diff --git a/test/spec/ol/style/style.test.js b/test/spec/ol/style/style.test.js index 06b8962b6c..23dd9a7f8f 100644 --- a/test/spec/ol/style/style.test.js +++ b/test/spec/ol/style/style.test.js @@ -4,7 +4,7 @@ import Style from '../../../../src/ol/style/Style.js'; import Fill from '../../../../src/ol/style/Fill.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import Stroke from '../../../../src/ol/style/Stroke.js'; -import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; +import Text from '../../../../src/ol/style/Text.js'; describe('ol.style.Style', function() { @@ -18,7 +18,7 @@ describe('ol.style.Style', function() { width: 1 }); - var testText = new _ol_style_Text_({ + var testText = new Text({ font: '12px Calibri,sans-serif', fill: new Fill({ color: '#000' @@ -54,7 +54,7 @@ describe('ol.style.Style', function() { stroke: new Stroke({ color: '#319FD3' }), - text: new _ol_style_Text_({ + text: new Text({ text: 'test' }), zIndex: 2 @@ -80,7 +80,7 @@ describe('ol.style.Style', function() { stroke: new Stroke({ color: '#319FD3' }), - text: new _ol_style_Text_({ + text: new Text({ text: 'test' }) }); diff --git a/test/spec/ol/style/text.test.js b/test/spec/ol/style/text.test.js index 045ecc6675..9775a1519d 100644 --- a/test/spec/ol/style/text.test.js +++ b/test/spec/ol/style/text.test.js @@ -1,6 +1,6 @@ import Fill from '../../../../src/ol/style/Fill.js'; import Stroke from '../../../../src/ol/style/Stroke.js'; -import _ol_style_Text_ from '../../../../src/ol/style/Text.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_({ + 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, @@ -77,7 +77,7 @@ describe('ol.style.Text', function() { }); it('the clone does not reference the same objects as the original', function() { - var original = new _ol_style_Text_({ + var original = new Text({ fill: new Fill({ color: '#319FD3' }),