From afb1f6db28cd710ffa7a0cf4d201e6968b5262b3 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:11:27 -0700 Subject: [PATCH 01/35] Rename _ol_renderer_canvas_IntermediateCanvas_ to IntermediateCanvasRenderer --- src/ol/renderer/canvas/ImageLayer.js | 8 ++++---- src/ol/renderer/canvas/IntermediateCanvas.js | 16 ++++++++-------- src/ol/renderer/canvas/TileLayer.js | 6 +++--- test/spec/ol/map.test.js | 8 ++++---- .../renderer/canvas/intermediatecanvas.test.js | 4 ++-- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/ol/renderer/canvas/ImageLayer.js b/src/ol/renderer/canvas/ImageLayer.js index b0bb994192..84e04f9e68 100644 --- a/src/ol/renderer/canvas/ImageLayer.js +++ b/src/ol/renderer/canvas/ImageLayer.js @@ -12,7 +12,7 @@ import _ol_layer_VectorRenderType_ from '../../layer/VectorRenderType.js'; import _ol_obj_ from '../../obj.js'; import {getLayerRendererPlugins} from '../../plugins.js'; import RendererType from '../Type.js'; -import _ol_renderer_canvas_IntermediateCanvas_ from '../canvas/IntermediateCanvas.js'; +import IntermediateCanvasRenderer from '../canvas/IntermediateCanvas.js'; import _ol_transform_ from '../../transform.js'; /** @@ -23,7 +23,7 @@ import _ol_transform_ from '../../transform.js'; */ var CanvasImageLayerRenderer = function(imageLayer) { - _ol_renderer_canvas_IntermediateCanvas_.call(this, imageLayer); + IntermediateCanvasRenderer.call(this, imageLayer); /** * @private @@ -50,7 +50,7 @@ var CanvasImageLayerRenderer = function(imageLayer) { }; -inherits(CanvasImageLayerRenderer, _ol_renderer_canvas_IntermediateCanvas_); +inherits(CanvasImageLayerRenderer, IntermediateCanvasRenderer); /** @@ -201,7 +201,7 @@ CanvasImageLayerRenderer.prototype.forEachFeatureAtCoordinate = function(coordin if (this.vectorRenderer_) { return this.vectorRenderer_.forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, thisArg); } else { - return _ol_renderer_canvas_IntermediateCanvas_.prototype.forEachFeatureAtCoordinate.call(this, coordinate, frameState, hitTolerance, callback, thisArg); + return IntermediateCanvasRenderer.prototype.forEachFeatureAtCoordinate.call(this, coordinate, frameState, hitTolerance, callback, thisArg); } }; diff --git a/src/ol/renderer/canvas/IntermediateCanvas.js b/src/ol/renderer/canvas/IntermediateCanvas.js index cb235d6ee4..a3f1827ddf 100644 --- a/src/ol/renderer/canvas/IntermediateCanvas.js +++ b/src/ol/renderer/canvas/IntermediateCanvas.js @@ -14,7 +14,7 @@ import _ol_transform_ from '../../transform.js'; * @extends {ol.renderer.canvas.Layer} * @param {ol.layer.Layer} layer Layer. */ -var _ol_renderer_canvas_IntermediateCanvas_ = function(layer) { +var IntermediateCanvasRenderer = function(layer) { CanvasLayerRenderer.call(this, layer); @@ -32,13 +32,13 @@ var _ol_renderer_canvas_IntermediateCanvas_ = function(layer) { }; -inherits(_ol_renderer_canvas_IntermediateCanvas_, CanvasLayerRenderer); +inherits(IntermediateCanvasRenderer, CanvasLayerRenderer); /** * @inheritDoc */ -_ol_renderer_canvas_IntermediateCanvas_.prototype.composeFrame = function(frameState, layerState, context) { +IntermediateCanvasRenderer.prototype.composeFrame = function(frameState, layerState, context) { this.preCompose(context, frameState); @@ -84,20 +84,20 @@ _ol_renderer_canvas_IntermediateCanvas_.prototype.composeFrame = function(frameS * @abstract * @return {HTMLCanvasElement|HTMLVideoElement|Image} Canvas. */ -_ol_renderer_canvas_IntermediateCanvas_.prototype.getImage = function() {}; +IntermediateCanvasRenderer.prototype.getImage = function() {}; /** * @abstract * @return {!ol.Transform} Image transform. */ -_ol_renderer_canvas_IntermediateCanvas_.prototype.getImageTransform = function() {}; +IntermediateCanvasRenderer.prototype.getImageTransform = function() {}; /** * @inheritDoc */ -_ol_renderer_canvas_IntermediateCanvas_.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg) { +IntermediateCanvasRenderer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg) { var layer = this.getLayer(); var source = layer.getSource(); var resolution = frameState.viewState.resolution; @@ -118,7 +118,7 @@ _ol_renderer_canvas_IntermediateCanvas_.prototype.forEachFeatureAtCoordinate = f /** * @inheritDoc */ -_ol_renderer_canvas_IntermediateCanvas_.prototype.forEachLayerAtCoordinate = function(coordinate, frameState, callback, thisArg) { +IntermediateCanvasRenderer.prototype.forEachLayerAtCoordinate = function(coordinate, frameState, callback, thisArg) { if (!this.getImage()) { return undefined; } @@ -146,4 +146,4 @@ _ol_renderer_canvas_IntermediateCanvas_.prototype.forEachLayerAtCoordinate = fun } } }; -export default _ol_renderer_canvas_IntermediateCanvas_; +export default IntermediateCanvasRenderer; diff --git a/src/ol/renderer/canvas/TileLayer.js b/src/ol/renderer/canvas/TileLayer.js index df933c1e10..b848a5b6b6 100644 --- a/src/ol/renderer/canvas/TileLayer.js +++ b/src/ol/renderer/canvas/TileLayer.js @@ -9,7 +9,7 @@ import ViewHint from '../../ViewHint.js'; import {createCanvasContext2D} from '../../dom.js'; import {containsExtent, createEmpty, equals, getIntersection, isEmpty} from '../../extent.js'; import RendererType from '../Type.js'; -import _ol_renderer_canvas_IntermediateCanvas_ from '../canvas/IntermediateCanvas.js'; +import IntermediateCanvasRenderer from '../canvas/IntermediateCanvas.js'; import _ol_transform_ from '../../transform.js'; /** @@ -20,7 +20,7 @@ import _ol_transform_ from '../../transform.js'; */ var CanvasTileLayerRenderer = function(tileLayer) { - _ol_renderer_canvas_IntermediateCanvas_.call(this, tileLayer); + IntermediateCanvasRenderer.call(this, tileLayer); /** * @protected @@ -78,7 +78,7 @@ var CanvasTileLayerRenderer = function(tileLayer) { }; -inherits(CanvasTileLayerRenderer, _ol_renderer_canvas_IntermediateCanvas_); +inherits(CanvasTileLayerRenderer, IntermediateCanvasRenderer); /** diff --git a/test/spec/ol/map.test.js b/test/spec/ol/map.test.js index 76935e882e..04c584dc44 100644 --- a/test/spec/ol/map.test.js +++ b/test/spec/ol/map.test.js @@ -12,7 +12,7 @@ import MouseWheelZoom from '../../../src/ol/interaction/MouseWheelZoom.js'; import PinchZoom from '../../../src/ol/interaction/PinchZoom.js'; import TileLayer from '../../../src/ol/layer/Tile.js'; import VectorLayer from '../../../src/ol/layer/Vector.js'; -import _ol_renderer_canvas_IntermediateCanvas_ from '../../../src/ol/renderer/canvas/IntermediateCanvas.js'; +import IntermediateCanvasRenderer from '../../../src/ol/renderer/canvas/IntermediateCanvas.js'; import VectorSource from '../../../src/ol/source/Vector.js'; import XYZ from '../../../src/ol/source/XYZ.js'; @@ -257,8 +257,8 @@ describe('ol.Map', function() { beforeEach(function(done) { log = []; - original = _ol_renderer_canvas_IntermediateCanvas_.prototype.forEachLayerAtCoordinate; - _ol_renderer_canvas_IntermediateCanvas_.prototype.forEachLayerAtCoordinate = function(coordinate) { + original = IntermediateCanvasRenderer.prototype.forEachLayerAtCoordinate; + IntermediateCanvasRenderer.prototype.forEachLayerAtCoordinate = function(coordinate) { log.push(coordinate.slice()); }; @@ -296,7 +296,7 @@ describe('ol.Map', function() { }); afterEach(function() { - _ol_renderer_canvas_IntermediateCanvas_.prototype.forEachLayerAtCoordinate = original; + IntermediateCanvasRenderer.prototype.forEachLayerAtCoordinate = original; map.dispose(); document.body.removeChild(target); log = null; diff --git a/test/spec/ol/renderer/canvas/intermediatecanvas.test.js b/test/spec/ol/renderer/canvas/intermediatecanvas.test.js index 2e362daa87..0201d4d030 100644 --- a/test/spec/ol/renderer/canvas/intermediatecanvas.test.js +++ b/test/spec/ol/renderer/canvas/intermediatecanvas.test.js @@ -1,7 +1,7 @@ import _ol_transform_ from '../../../../../src/ol/transform.js'; import ImageLayer from '../../../../../src/ol/layer/Image.js'; import MapRenderer from '../../../../../src/ol/renderer/Map.js'; -import _ol_renderer_canvas_IntermediateCanvas_ from '../../../../../src/ol/renderer/canvas/IntermediateCanvas.js'; +import IntermediateCanvasRenderer from '../../../../../src/ol/renderer/canvas/IntermediateCanvas.js'; describe('ol.renderer.canvas.IntermediateCanvas', function() { @@ -12,7 +12,7 @@ describe('ol.renderer.canvas.IntermediateCanvas', function() { var layer = new ImageLayer({ extent: [1, 2, 3, 4] }); - renderer = new _ol_renderer_canvas_IntermediateCanvas_(layer); + renderer = new IntermediateCanvasRenderer(layer); var image = new Image(); image.width = 3; image.height = 3; From d840eab615d1573533a5245cdc551e561d675b1a Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:16:44 -0700 Subject: [PATCH 02/35] Rename _ol_render_canvas_Immediate_ to ImmediateCanvasRenderer --- src/ol/render.js | 4 +- src/ol/render/canvas/Immediate.js | 48 ++++++++++---------- src/ol/renderer/canvas/Layer.js | 4 +- src/ol/renderer/canvas/Map.js | 4 +- test/rendering/ol/render.test.js | 4 +- test/spec/ol/render.test.js | 4 +- test/spec/ol/render/canvas/immediate.test.js | 26 +++++------ 7 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/ol/render.js b/src/ol/render.js index 57819793b1..7218cbe81a 100644 --- a/src/ol/render.js +++ b/src/ol/render.js @@ -3,7 +3,7 @@ */ import _ol_has_ from './has.js'; import _ol_transform_ from './transform.js'; -import _ol_render_canvas_Immediate_ from './render/canvas/Immediate.js'; +import CanvasImmediateRenderer from './render/canvas/Immediate.js'; var _ol_render_ = {}; @@ -40,7 +40,7 @@ _ol_render_.toContext = function(context, opt_options) { } var extent = [0, 0, canvas.width, canvas.height]; var transform = _ol_transform_.scale(_ol_transform_.create(), pixelRatio, pixelRatio); - return new _ol_render_canvas_Immediate_(context, pixelRatio, extent, transform, + return new CanvasImmediateRenderer(context, pixelRatio, extent, transform, 0); }; export default _ol_render_; diff --git a/src/ol/render/canvas/Immediate.js b/src/ol/render/canvas/Immediate.js index 6492841c27..0bfea34b9e 100644 --- a/src/ol/render/canvas/Immediate.js +++ b/src/ol/render/canvas/Immediate.js @@ -35,7 +35,7 @@ import _ol_transform_ from '../../transform.js'; * @param {number} viewRotation View rotation. * @struct */ -var _ol_render_canvas_Immediate_ = function(context, pixelRatio, extent, transform, viewRotation) { +var CanvasImmediateRenderer = function(context, pixelRatio, extent, transform, viewRotation) { VectorContext.call(this); /** @@ -238,7 +238,7 @@ var _ol_render_canvas_Immediate_ = function(context, pixelRatio, extent, transfo }; -inherits(_ol_render_canvas_Immediate_, VectorContext); +inherits(CanvasImmediateRenderer, VectorContext); /** @@ -248,7 +248,7 @@ inherits(_ol_render_canvas_Immediate_, VectorContext); * @param {number} stride Stride. * @private */ -_ol_render_canvas_Immediate_.prototype.drawImages_ = function(flatCoordinates, offset, end, stride) { +CanvasImmediateRenderer.prototype.drawImages_ = function(flatCoordinates, offset, end, stride) { if (!this.image_) { return; } @@ -303,7 +303,7 @@ _ol_render_canvas_Immediate_.prototype.drawImages_ = function(flatCoordinates, o * @param {number} stride Stride. * @private */ -_ol_render_canvas_Immediate_.prototype.drawText_ = function(flatCoordinates, offset, end, stride) { +CanvasImmediateRenderer.prototype.drawText_ = function(flatCoordinates, offset, end, stride) { if (!this.textState_ || this.text_ === '') { return; } @@ -355,7 +355,7 @@ _ol_render_canvas_Immediate_.prototype.drawText_ = function(flatCoordinates, off * @private * @return {number} end End. */ -_ol_render_canvas_Immediate_.prototype.moveToLineTo_ = function(flatCoordinates, offset, end, stride, close) { +CanvasImmediateRenderer.prototype.moveToLineTo_ = function(flatCoordinates, offset, end, stride, close) { var context = this.context_; var pixelCoordinates = _ol_geom_flat_transform_.transform2D( flatCoordinates, offset, end, stride, this.transform_, @@ -383,7 +383,7 @@ _ol_render_canvas_Immediate_.prototype.moveToLineTo_ = function(flatCoordinates, * @private * @return {number} End. */ -_ol_render_canvas_Immediate_.prototype.drawRings_ = function(flatCoordinates, offset, ends, stride) { +CanvasImmediateRenderer.prototype.drawRings_ = function(flatCoordinates, offset, ends, stride) { var i, ii; for (i = 0, ii = ends.length; i < ii; ++i) { offset = this.moveToLineTo_( @@ -401,7 +401,7 @@ _ol_render_canvas_Immediate_.prototype.drawRings_ = function(flatCoordinates, of * @override * @api */ -_ol_render_canvas_Immediate_.prototype.drawCircle = function(geometry) { +CanvasImmediateRenderer.prototype.drawCircle = function(geometry) { if (!intersects(this.extent_, geometry.getExtent())) { return; } @@ -442,7 +442,7 @@ _ol_render_canvas_Immediate_.prototype.drawCircle = function(geometry) { * @override * @api */ -_ol_render_canvas_Immediate_.prototype.setStyle = function(style) { +CanvasImmediateRenderer.prototype.setStyle = function(style) { this.setFillStrokeStyle(style.getFill(), style.getStroke()); this.setImageStyle(style.getImage()); this.setTextStyle(style.getText()); @@ -457,7 +457,7 @@ _ol_render_canvas_Immediate_.prototype.setStyle = function(style) { * @override * @api */ -_ol_render_canvas_Immediate_.prototype.drawGeometry = function(geometry) { +CanvasImmediateRenderer.prototype.drawGeometry = function(geometry) { var type = geometry.getType(); switch (type) { case GeometryType.POINT: @@ -500,7 +500,7 @@ _ol_render_canvas_Immediate_.prototype.drawGeometry = function(geometry) { * @override * @api */ -_ol_render_canvas_Immediate_.prototype.drawFeature = function(feature, style) { +CanvasImmediateRenderer.prototype.drawFeature = function(feature, style) { var geometry = style.getGeometryFunction()(feature); if (!geometry || !intersects(this.extent_, geometry.getExtent())) { return; @@ -517,7 +517,7 @@ _ol_render_canvas_Immediate_.prototype.drawFeature = function(feature, style) { * @param {ol.geom.GeometryCollection} geometry Geometry collection. * @override */ -_ol_render_canvas_Immediate_.prototype.drawGeometryCollection = function(geometry) { +CanvasImmediateRenderer.prototype.drawGeometryCollection = function(geometry) { var geometries = geometry.getGeometriesArray(); var i, ii; for (i = 0, ii = geometries.length; i < ii; ++i) { @@ -533,7 +533,7 @@ _ol_render_canvas_Immediate_.prototype.drawGeometryCollection = function(geometr * @param {ol.geom.Point|ol.render.Feature} geometry Point geometry. * @override */ -_ol_render_canvas_Immediate_.prototype.drawPoint = function(geometry) { +CanvasImmediateRenderer.prototype.drawPoint = function(geometry) { var flatCoordinates = geometry.getFlatCoordinates(); var stride = geometry.getStride(); if (this.image_) { @@ -552,7 +552,7 @@ _ol_render_canvas_Immediate_.prototype.drawPoint = function(geometry) { * @param {ol.geom.MultiPoint|ol.render.Feature} geometry MultiPoint geometry. * @override */ -_ol_render_canvas_Immediate_.prototype.drawMultiPoint = function(geometry) { +CanvasImmediateRenderer.prototype.drawMultiPoint = function(geometry) { var flatCoordinates = geometry.getFlatCoordinates(); var stride = geometry.getStride(); if (this.image_) { @@ -571,7 +571,7 @@ _ol_render_canvas_Immediate_.prototype.drawMultiPoint = function(geometry) { * @param {ol.geom.LineString|ol.render.Feature} geometry LineString geometry. * @override */ -_ol_render_canvas_Immediate_.prototype.drawLineString = function(geometry) { +CanvasImmediateRenderer.prototype.drawLineString = function(geometry) { if (!intersects(this.extent_, geometry.getExtent())) { return; } @@ -599,7 +599,7 @@ _ol_render_canvas_Immediate_.prototype.drawLineString = function(geometry) { * geometry. * @override */ -_ol_render_canvas_Immediate_.prototype.drawMultiLineString = function(geometry) { +CanvasImmediateRenderer.prototype.drawMultiLineString = function(geometry) { var geometryExtent = geometry.getExtent(); if (!intersects(this.extent_, geometryExtent)) { return; @@ -633,7 +633,7 @@ _ol_render_canvas_Immediate_.prototype.drawMultiLineString = function(geometry) * @param {ol.geom.Polygon|ol.render.Feature} geometry Polygon geometry. * @override */ -_ol_render_canvas_Immediate_.prototype.drawPolygon = function(geometry) { +CanvasImmediateRenderer.prototype.drawPolygon = function(geometry) { if (!intersects(this.extent_, geometry.getExtent())) { return; } @@ -668,7 +668,7 @@ _ol_render_canvas_Immediate_.prototype.drawPolygon = function(geometry) { * @param {ol.geom.MultiPolygon} geometry MultiPolygon geometry. * @override */ -_ol_render_canvas_Immediate_.prototype.drawMultiPolygon = function(geometry) { +CanvasImmediateRenderer.prototype.drawMultiPolygon = function(geometry) { if (!intersects(this.extent_, geometry.getExtent())) { return; } @@ -708,7 +708,7 @@ _ol_render_canvas_Immediate_.prototype.drawMultiPolygon = function(geometry) { * @param {ol.CanvasFillState} fillState Fill state. * @private */ -_ol_render_canvas_Immediate_.prototype.setContextFillState_ = function(fillState) { +CanvasImmediateRenderer.prototype.setContextFillState_ = function(fillState) { var context = this.context_; var contextFillState = this.contextFillState_; if (!contextFillState) { @@ -728,7 +728,7 @@ _ol_render_canvas_Immediate_.prototype.setContextFillState_ = function(fillState * @param {ol.CanvasStrokeState} strokeState Stroke state. * @private */ -_ol_render_canvas_Immediate_.prototype.setContextStrokeState_ = function(strokeState) { +CanvasImmediateRenderer.prototype.setContextStrokeState_ = function(strokeState) { var context = this.context_; var contextStrokeState = this.contextStrokeState_; if (!contextStrokeState) { @@ -785,7 +785,7 @@ _ol_render_canvas_Immediate_.prototype.setContextStrokeState_ = function(strokeS * @param {ol.CanvasTextState} textState Text state. * @private */ -_ol_render_canvas_Immediate_.prototype.setContextTextState_ = function(textState) { +CanvasImmediateRenderer.prototype.setContextTextState_ = function(textState) { var context = this.context_; var contextTextState = this.contextTextState_; var textAlign = textState.textAlign ? @@ -822,7 +822,7 @@ _ol_render_canvas_Immediate_.prototype.setContextTextState_ = function(textState * @param {ol.style.Stroke} strokeStyle Stroke style. * @override */ -_ol_render_canvas_Immediate_.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) { +CanvasImmediateRenderer.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) { if (!fillStyle) { this.fillState_ = null; } else { @@ -869,7 +869,7 @@ _ol_render_canvas_Immediate_.prototype.setFillStrokeStyle = function(fillStyle, * @param {ol.style.Image} imageStyle Image style. * @override */ -_ol_render_canvas_Immediate_.prototype.setImageStyle = function(imageStyle) { +CanvasImmediateRenderer.prototype.setImageStyle = function(imageStyle) { if (!imageStyle) { this.image_ = null; } else { @@ -901,7 +901,7 @@ _ol_render_canvas_Immediate_.prototype.setImageStyle = function(imageStyle) { * @param {ol.style.Text} textStyle Text style. * @override */ -_ol_render_canvas_Immediate_.prototype.setTextStyle = function(textStyle) { +CanvasImmediateRenderer.prototype.setTextStyle = function(textStyle) { if (!textStyle) { this.text_ = ''; } else { @@ -971,4 +971,4 @@ _ol_render_canvas_Immediate_.prototype.setTextStyle = function(textStyle) { textScale : 1); } }; -export default _ol_render_canvas_Immediate_; +export default CanvasImmediateRenderer; diff --git a/src/ol/renderer/canvas/Layer.js b/src/ol/renderer/canvas/Layer.js index d623ed3556..85c3fc554c 100644 --- a/src/ol/renderer/canvas/Layer.js +++ b/src/ol/renderer/canvas/Layer.js @@ -7,7 +7,7 @@ import {TRUE} from '../../functions.js'; import _ol_render_Event_ from '../../render/Event.js'; import RenderEventType from '../../render/EventType.js'; import _ol_render_canvas_ from '../../render/canvas.js'; -import _ol_render_canvas_Immediate_ from '../../render/canvas/Immediate.js'; +import CanvasImmediateRenderer from '../../render/canvas/Immediate.js'; import LayerRenderer from '../Layer.js'; import _ol_transform_ from '../../transform.js'; @@ -87,7 +87,7 @@ CanvasLayerRenderer.prototype.dispatchComposeEvent_ = function(type, context, fr _ol_render_canvas_.rotateAtOffset(context, -rotation, width / 2, height / 2); var transform = opt_transform !== undefined ? opt_transform : this.getTransform(frameState, 0); - var render = new _ol_render_canvas_Immediate_( + var render = new CanvasImmediateRenderer( context, frameState.pixelRatio, frameState.extent, transform, frameState.viewState.rotation); var composeEvent = new _ol_render_Event_(type, render, frameState, diff --git a/src/ol/renderer/canvas/Map.js b/src/ol/renderer/canvas/Map.js index d98e2ad810..ced664a4c6 100644 --- a/src/ol/renderer/canvas/Map.js +++ b/src/ol/renderer/canvas/Map.js @@ -12,7 +12,7 @@ import _ol_layer_Layer_ from '../../layer/Layer.js'; import _ol_render_Event_ from '../../render/Event.js'; import RenderEventType from '../../render/EventType.js'; import _ol_render_canvas_ from '../../render/canvas.js'; -import _ol_render_canvas_Immediate_ from '../../render/canvas/Immediate.js'; +import CanvasImmediateRenderer from '../../render/canvas/Immediate.js'; import MapRenderer from '../Map.js'; import RendererType from '../Type.js'; import SourceState from '../../source/State.js'; @@ -100,7 +100,7 @@ CanvasMapRenderer.prototype.dispatchComposeEvent_ = function(type, frameState) { var transform = this.getTransform(frameState); - var vectorContext = new _ol_render_canvas_Immediate_(context, pixelRatio, + var vectorContext = new CanvasImmediateRenderer(context, pixelRatio, extent, transform, rotation); var composeEvent = new _ol_render_Event_(type, vectorContext, frameState, context, null); diff --git a/test/rendering/ol/render.test.js b/test/rendering/ol/render.test.js index 8469c168a5..05244cc52a 100644 --- a/test/rendering/ol/render.test.js +++ b/test/rendering/ol/render.test.js @@ -3,7 +3,7 @@ import Point from '../../../src/ol/geom/Point.js'; import Polygon from '../../../src/ol/geom/Polygon.js'; import _ol_render_ from '../../../src/ol/render.js'; import VectorContext from '../../../src/ol/render/VectorContext.js'; -import _ol_render_canvas_Immediate_ from '../../../src/ol/render/canvas/Immediate.js'; +import CanvasImmediateRenderer from '../../../src/ol/render/canvas/Immediate.js'; import _ol_style_Circle_ from '../../../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../src/ol/style/Stroke.js'; @@ -23,7 +23,7 @@ describe('ol.render', function() { size: [100, 100] }); expect(vectorContext).to.be.a(VectorContext); - expect(vectorContext).to.be.a(_ol_render_canvas_Immediate_); + expect(vectorContext).to.be.a(CanvasImmediateRenderer); }); it('can be used to render a point geometry', function(done) { diff --git a/test/spec/ol/render.test.js b/test/spec/ol/render.test.js index 007f49e952..cd03cb83a5 100644 --- a/test/spec/ol/render.test.js +++ b/test/spec/ol/render.test.js @@ -1,7 +1,7 @@ import {equals} from '../../../src/ol/array.js'; import _ol_has_ from '../../../src/ol/has.js'; import _ol_render_ from '../../../src/ol/render.js'; -import _ol_render_canvas_Immediate_ from '../../../src/ol/render/canvas/Immediate.js'; +import CanvasImmediateRenderer from '../../../src/ol/render/canvas/Immediate.js'; import _ol_transform_ from '../../../src/ol/transform.js'; @@ -12,7 +12,7 @@ describe('ol.render', function() { it('creates an ol.render.canvas.Immediate and sets defaults', function() { var canvas = document.createElement('canvas'); var render = _ol_render_.toContext(canvas.getContext('2d')); - expect(render).to.be.a(_ol_render_canvas_Immediate_); + expect(render).to.be.a(CanvasImmediateRenderer); expect(render.pixelRatio_).to.be(_ol_has_.DEVICE_PIXEL_RATIO); }); diff --git a/test/spec/ol/render/canvas/immediate.test.js b/test/spec/ol/render/canvas/immediate.test.js index f4a321e5d0..b096ca6278 100644 --- a/test/spec/ol/render/canvas/immediate.test.js +++ b/test/spec/ol/render/canvas/immediate.test.js @@ -7,7 +7,7 @@ import MultiPolygon from '../../../../../src/ol/geom/MultiPolygon.js'; import Point from '../../../../../src/ol/geom/Point.js'; import Polygon from '../../../../../src/ol/geom/Polygon.js'; import VectorContext from '../../../../../src/ol/render/VectorContext.js'; -import _ol_render_canvas_Immediate_ from '../../../../../src/ol/render/canvas/Immediate.js'; +import CanvasImmediateRenderer from '../../../../../src/ol/render/canvas/Immediate.js'; import _ol_style_Circle_ from '../../../../../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; @@ -30,15 +30,15 @@ describe('ol.render.canvas.Immediate', function() { describe('constructor', function() { it('creates an instance', function() { - var instance = new _ol_render_canvas_Immediate_(); - expect(instance).to.be.a(_ol_render_canvas_Immediate_); + var instance = new CanvasImmediateRenderer(); + expect(instance).to.be.a(CanvasImmediateRenderer); expect(instance).to.be.a(VectorContext); }); }); describe('#setStyle()', function() { it('calls the more specific methods with style parts', function() { - var context = new _ol_render_canvas_Immediate_(); + var context = new CanvasImmediateRenderer(); sinon.spy(context, 'setFillStrokeStyle'); sinon.spy(context, 'setImageStyle'); sinon.spy(context, 'setTextStyle'); @@ -68,7 +68,7 @@ describe('ol.render.canvas.Immediate', function() { var extent = [-10, -10, 10, 10]; it('calls drawPoint() with a Point', function() { - var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent); + var context = new CanvasImmediateRenderer(getMockContext(), 1, extent); sinon.spy(context, 'drawPoint'); var geometry = new Point([1, 2]); @@ -78,7 +78,7 @@ describe('ol.render.canvas.Immediate', function() { }); it('calls drawLineString() with a LineString', function() { - var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent); + var context = new CanvasImmediateRenderer(getMockContext(), 1, extent); sinon.spy(context, 'drawLineString'); var geometry = new LineString([[1, 2], [3, 4]]); @@ -88,7 +88,7 @@ describe('ol.render.canvas.Immediate', function() { }); it('calls drawPolygon() with a Polygon', function() { - var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent); + var context = new CanvasImmediateRenderer(getMockContext(), 1, extent); sinon.spy(context, 'drawPolygon'); var geometry = new Polygon([[[1, 2], [3, 4], [5, 6], [1, 2]]]); @@ -98,7 +98,7 @@ describe('ol.render.canvas.Immediate', function() { }); it('calls drawMultiPoint() with a MultiPoint', function() { - var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent); + var context = new CanvasImmediateRenderer(getMockContext(), 1, extent); sinon.spy(context, 'drawMultiPoint'); var geometry = new MultiPoint([[1, 2], [3, 4]]); @@ -108,7 +108,7 @@ describe('ol.render.canvas.Immediate', function() { }); it('calls drawMultiLineString() with a MultiLineString', function() { - var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent); + var context = new CanvasImmediateRenderer(getMockContext(), 1, extent); sinon.spy(context, 'drawMultiLineString'); var geometry = new MultiLineString([[[1, 2], [3, 4]]]); @@ -118,7 +118,7 @@ describe('ol.render.canvas.Immediate', function() { }); it('calls drawMultiPolygon() with a MultiPolygon', function() { - var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent); + var context = new CanvasImmediateRenderer(getMockContext(), 1, extent); sinon.spy(context, 'drawMultiPolygon'); var geometry = new MultiPolygon([[[[1, 2], [3, 4], [5, 6], [1, 2]]]]); @@ -128,7 +128,7 @@ describe('ol.render.canvas.Immediate', function() { }); it('calls drawGeometryCollection() with a GeometryCollection', function() { - var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent); + var context = new CanvasImmediateRenderer(getMockContext(), 1, extent); sinon.spy(context, 'drawGeometryCollection'); sinon.spy(context, 'drawPoint'); sinon.spy(context, 'drawLineString'); @@ -151,7 +151,7 @@ describe('ol.render.canvas.Immediate', function() { }); it('calls drawCircle() with a Circle', function() { - var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent); + var context = new CanvasImmediateRenderer(getMockContext(), 1, extent); sinon.spy(context, 'drawCircle'); var geometry = new Circle([0, 0]); @@ -223,7 +223,7 @@ describe('ol.render.canvas.Immediate', function() { -7572748.158493212, 3741317.9895594316 ]; - var canvas = new _ol_render_canvas_Immediate_(context, 1, extent, transform); + var canvas = new CanvasImmediateRenderer(context, 1, extent, transform); canvas.strokeState_ = { lineCap: 'round', From 0113b9283ca3c4c7dfd1c058bb8a2f3602df524b Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:17:59 -0700 Subject: [PATCH 03/35] Rename _ol_render_Event_ to RenderEvent --- src/ol/render/Event.js | 6 +++--- src/ol/renderer/canvas/Layer.js | 4 ++-- src/ol/renderer/canvas/Map.js | 4 ++-- src/ol/renderer/webgl/Layer.js | 4 ++-- src/ol/renderer/webgl/Map.js | 4 ++-- test/spec/ol/layer/layer.test.js | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/ol/render/Event.js b/src/ol/render/Event.js index 12d7d0eee2..ce8f075264 100644 --- a/src/ol/render/Event.js +++ b/src/ol/render/Event.js @@ -14,7 +14,7 @@ import Event from '../events/Event.js'; * @param {?CanvasRenderingContext2D=} opt_context Context. * @param {?ol.webgl.Context=} opt_glContext WebGL Context. */ -var _ol_render_Event_ = function( +var RenderEvent = function( type, opt_vectorContext, opt_frameState, opt_context, opt_glContext) { @@ -52,5 +52,5 @@ var _ol_render_Event_ = function( }; -inherits(_ol_render_Event_, Event); -export default _ol_render_Event_; +inherits(RenderEvent, Event); +export default RenderEvent; diff --git a/src/ol/renderer/canvas/Layer.js b/src/ol/renderer/canvas/Layer.js index 85c3fc554c..52b9c5c723 100644 --- a/src/ol/renderer/canvas/Layer.js +++ b/src/ol/renderer/canvas/Layer.js @@ -4,7 +4,7 @@ import {inherits} from '../../index.js'; import {getBottomLeft, getBottomRight, getTopLeft, getTopRight} from '../../extent.js'; import {TRUE} from '../../functions.js'; -import _ol_render_Event_ from '../../render/Event.js'; +import RenderEvent from '../../render/Event.js'; import RenderEventType from '../../render/EventType.js'; import _ol_render_canvas_ from '../../render/canvas.js'; import CanvasImmediateRenderer from '../../render/canvas/Immediate.js'; @@ -90,7 +90,7 @@ CanvasLayerRenderer.prototype.dispatchComposeEvent_ = function(type, context, fr var render = new CanvasImmediateRenderer( context, frameState.pixelRatio, frameState.extent, transform, frameState.viewState.rotation); - var composeEvent = new _ol_render_Event_(type, render, frameState, + var composeEvent = new RenderEvent(type, render, frameState, context, null); layer.dispatchEvent(composeEvent); _ol_render_canvas_.rotateAtOffset(context, rotation, width / 2, height / 2); diff --git a/src/ol/renderer/canvas/Map.js b/src/ol/renderer/canvas/Map.js index ced664a4c6..058079f908 100644 --- a/src/ol/renderer/canvas/Map.js +++ b/src/ol/renderer/canvas/Map.js @@ -9,7 +9,7 @@ import {stableSort} from '../../array.js'; import {CLASS_UNSELECTABLE} from '../../css.js'; import {createCanvasContext2D} from '../../dom.js'; import _ol_layer_Layer_ from '../../layer/Layer.js'; -import _ol_render_Event_ from '../../render/Event.js'; +import RenderEvent from '../../render/Event.js'; import RenderEventType from '../../render/EventType.js'; import _ol_render_canvas_ from '../../render/canvas.js'; import CanvasImmediateRenderer from '../../render/canvas/Immediate.js'; @@ -102,7 +102,7 @@ CanvasMapRenderer.prototype.dispatchComposeEvent_ = function(type, frameState) { var vectorContext = new CanvasImmediateRenderer(context, pixelRatio, extent, transform, rotation); - var composeEvent = new _ol_render_Event_(type, vectorContext, + var composeEvent = new RenderEvent(type, vectorContext, frameState, context, null); map.dispatchEvent(composeEvent); } diff --git a/src/ol/renderer/webgl/Layer.js b/src/ol/renderer/webgl/Layer.js index 639af5b1ad..31ea973144 100644 --- a/src/ol/renderer/webgl/Layer.js +++ b/src/ol/renderer/webgl/Layer.js @@ -2,7 +2,7 @@ * @module ol/renderer/webgl/Layer */ import {inherits} from '../../index.js'; -import _ol_render_Event_ from '../../render/Event.js'; +import RenderEvent from '../../render/Event.js'; import RenderEventType from '../../render/EventType.js'; import _ol_render_webgl_Immediate_ from '../../render/webgl/Immediate.js'; import LayerRenderer from '../Layer.js'; @@ -202,7 +202,7 @@ WebGLLayerRenderer.prototype.dispatchComposeEvent_ = function(type, context, fra var render = new _ol_render_webgl_Immediate_( context, center, resolution, rotation, size, extent, pixelRatio); - var composeEvent = new _ol_render_Event_( + var composeEvent = new RenderEvent( type, render, frameState, null, context); layer.dispatchEvent(composeEvent); } diff --git a/src/ol/renderer/webgl/Map.js b/src/ol/renderer/webgl/Map.js index 4d11bcb810..9737b3905a 100644 --- a/src/ol/renderer/webgl/Map.js +++ b/src/ol/renderer/webgl/Map.js @@ -9,7 +9,7 @@ import {createCanvasContext2D} from '../../dom.js'; import _ol_events_ from '../../events.js'; import _ol_has_ from '../../has.js'; import _ol_layer_Layer_ from '../../layer/Layer.js'; -import _ol_render_Event_ from '../../render/Event.js'; +import RenderEvent from '../../render/Event.js'; import RenderEventType from '../../render/EventType.js'; import _ol_render_webgl_Immediate_ from '../../render/webgl/Immediate.js'; import MapRenderer from '../Map.js'; @@ -276,7 +276,7 @@ WebGLMapRenderer.prototype.dispatchComposeEvent_ = function(type, frameState) { var vectorContext = new _ol_render_webgl_Immediate_(context, center, resolution, rotation, size, extent, pixelRatio); - var composeEvent = new _ol_render_Event_(type, vectorContext, + var composeEvent = new RenderEvent(type, vectorContext, frameState, null, context); map.dispatchEvent(composeEvent); } diff --git a/test/spec/ol/layer/layer.test.js b/test/spec/ol/layer/layer.test.js index 1ae8063886..8d2211799e 100644 --- a/test/spec/ol/layer/layer.test.js +++ b/test/spec/ol/layer/layer.test.js @@ -2,7 +2,7 @@ import {getUid} from '../../../../src/ol/index.js'; import Map from '../../../../src/ol/Map.js'; import _ol_layer_Layer_ from '../../../../src/ol/layer/Layer.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; -import _ol_render_Event_ from '../../../../src/ol/render/Event.js'; +import RenderEvent from '../../../../src/ol/render/Event.js'; import Source from '../../../../src/ol/source/Source.js'; @@ -399,7 +399,7 @@ describe('ol.layer.Layer', function() { layerStatesArray: [], layerStates: {} }; - map.dispatchEvent(new _ol_render_Event_('precompose', null, + map.dispatchEvent(new RenderEvent('precompose', null, frameState, null, null)); expect(frameState.layerStatesArray.length).to.be(1); var layerState = frameState.layerStatesArray[0]; From ba206c96832680de807ec7394691254d00d2d7fb Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:20:52 -0700 Subject: [PATCH 04/35] Rename _ol_layer_Base_ to BaseLayer --- src/ol/layer/Base.js | 40 ++++++++++++++++++++-------------------- src/ol/layer/Group.js | 6 +++--- src/ol/layer/Layer.js | 6 +++--- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/ol/layer/Base.js b/src/ol/layer/Base.js index 78ace3cc02..5506892def 100644 --- a/src/ol/layer/Base.js +++ b/src/ol/layer/Base.js @@ -21,7 +21,7 @@ import _ol_obj_ from '../obj.js'; * @param {olx.layer.BaseOptions} options Layer options. * @api */ -var _ol_layer_Base_ = function(options) { +var BaseLayer = function(options) { BaseObject.call(this); @@ -60,14 +60,14 @@ var _ol_layer_Base_ = function(options) { }; -inherits(_ol_layer_Base_, BaseObject); +inherits(BaseLayer, BaseObject); /** * Get the layer type (used when creating a layer renderer). * @return {ol.LayerType} The layer type. */ -_ol_layer_Base_.prototype.getType = function() { +BaseLayer.prototype.getType = function() { return this.type; }; @@ -75,7 +75,7 @@ _ol_layer_Base_.prototype.getType = function() { /** * @return {ol.LayerState} Layer state. */ -_ol_layer_Base_.prototype.getLayerState = function() { +BaseLayer.prototype.getLayerState = function() { this.state_.opacity = clamp(this.getOpacity(), 0, 1); this.state_.sourceState = this.getSourceState(); this.state_.visible = this.getVisible(); @@ -94,7 +94,7 @@ _ol_layer_Base_.prototype.getLayerState = function() { * modified in place). * @return {Array.} Array of layers. */ -_ol_layer_Base_.prototype.getLayersArray = function(opt_array) {}; +BaseLayer.prototype.getLayersArray = function(opt_array) {}; /** @@ -103,7 +103,7 @@ _ol_layer_Base_.prototype.getLayersArray = function(opt_array) {}; * states (to be modified in place). * @return {Array.} List of layer states. */ -_ol_layer_Base_.prototype.getLayerStatesArray = function(opt_states) {}; +BaseLayer.prototype.getLayerStatesArray = function(opt_states) {}; /** @@ -113,7 +113,7 @@ _ol_layer_Base_.prototype.getLayerStatesArray = function(opt_states) {}; * @observable * @api */ -_ol_layer_Base_.prototype.getExtent = function() { +BaseLayer.prototype.getExtent = function() { return ( /** @type {ol.Extent|undefined} */ this.get(LayerProperty.EXTENT) ); @@ -126,7 +126,7 @@ _ol_layer_Base_.prototype.getExtent = function() { * @observable * @api */ -_ol_layer_Base_.prototype.getMaxResolution = function() { +BaseLayer.prototype.getMaxResolution = function() { return ( /** @type {number} */ this.get(LayerProperty.MAX_RESOLUTION) ); @@ -139,7 +139,7 @@ _ol_layer_Base_.prototype.getMaxResolution = function() { * @observable * @api */ -_ol_layer_Base_.prototype.getMinResolution = function() { +BaseLayer.prototype.getMinResolution = function() { return ( /** @type {number} */ this.get(LayerProperty.MIN_RESOLUTION) ); @@ -152,7 +152,7 @@ _ol_layer_Base_.prototype.getMinResolution = function() { * @observable * @api */ -_ol_layer_Base_.prototype.getOpacity = function() { +BaseLayer.prototype.getOpacity = function() { return ( /** @type {number} */ this.get(LayerProperty.OPACITY) ); @@ -163,7 +163,7 @@ _ol_layer_Base_.prototype.getOpacity = function() { * @abstract * @return {ol.source.State} Source state. */ -_ol_layer_Base_.prototype.getSourceState = function() {}; +BaseLayer.prototype.getSourceState = function() {}; /** @@ -172,7 +172,7 @@ _ol_layer_Base_.prototype.getSourceState = function() {}; * @observable * @api */ -_ol_layer_Base_.prototype.getVisible = function() { +BaseLayer.prototype.getVisible = function() { return ( /** @type {boolean} */ this.get(LayerProperty.VISIBLE) ); @@ -186,7 +186,7 @@ _ol_layer_Base_.prototype.getVisible = function() { * @observable * @api */ -_ol_layer_Base_.prototype.getZIndex = function() { +BaseLayer.prototype.getZIndex = function() { return ( /** @type {number} */ this.get(LayerProperty.Z_INDEX) ); @@ -200,7 +200,7 @@ _ol_layer_Base_.prototype.getZIndex = function() { * @observable * @api */ -_ol_layer_Base_.prototype.setExtent = function(extent) { +BaseLayer.prototype.setExtent = function(extent) { this.set(LayerProperty.EXTENT, extent); }; @@ -211,7 +211,7 @@ _ol_layer_Base_.prototype.setExtent = function(extent) { * @observable * @api */ -_ol_layer_Base_.prototype.setMaxResolution = function(maxResolution) { +BaseLayer.prototype.setMaxResolution = function(maxResolution) { this.set(LayerProperty.MAX_RESOLUTION, maxResolution); }; @@ -222,7 +222,7 @@ _ol_layer_Base_.prototype.setMaxResolution = function(maxResolution) { * @observable * @api */ -_ol_layer_Base_.prototype.setMinResolution = function(minResolution) { +BaseLayer.prototype.setMinResolution = function(minResolution) { this.set(LayerProperty.MIN_RESOLUTION, minResolution); }; @@ -233,7 +233,7 @@ _ol_layer_Base_.prototype.setMinResolution = function(minResolution) { * @observable * @api */ -_ol_layer_Base_.prototype.setOpacity = function(opacity) { +BaseLayer.prototype.setOpacity = function(opacity) { this.set(LayerProperty.OPACITY, opacity); }; @@ -244,7 +244,7 @@ _ol_layer_Base_.prototype.setOpacity = function(opacity) { * @observable * @api */ -_ol_layer_Base_.prototype.setVisible = function(visible) { +BaseLayer.prototype.setVisible = function(visible) { this.set(LayerProperty.VISIBLE, visible); }; @@ -256,7 +256,7 @@ _ol_layer_Base_.prototype.setVisible = function(visible) { * @observable * @api */ -_ol_layer_Base_.prototype.setZIndex = function(zindex) { +BaseLayer.prototype.setZIndex = function(zindex) { this.set(LayerProperty.Z_INDEX, zindex); }; -export default _ol_layer_Base_; +export default BaseLayer; diff --git a/src/ol/layer/Group.js b/src/ol/layer/Group.js index 043a24898e..978621f67f 100644 --- a/src/ol/layer/Group.js +++ b/src/ol/layer/Group.js @@ -10,7 +10,7 @@ import {assert} from '../asserts.js'; import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {getIntersection} from '../extent.js'; -import _ol_layer_Base_ from '../layer/Base.js'; +import BaseLayer from '../layer/Base.js'; import _ol_obj_ from '../obj.js'; import SourceState from '../source/State.js'; @@ -44,7 +44,7 @@ var _ol_layer_Group_ = function(opt_options) { var layers = options.layers; - _ol_layer_Base_.call(this, baseOptions); + BaseLayer.call(this, baseOptions); /** * @private @@ -78,7 +78,7 @@ var _ol_layer_Group_ = function(opt_options) { }; -inherits(_ol_layer_Group_, _ol_layer_Base_); +inherits(_ol_layer_Group_, BaseLayer); /** diff --git a/src/ol/layer/Layer.js b/src/ol/layer/Layer.js index 5718c74f87..33ceb931cd 100644 --- a/src/ol/layer/Layer.js +++ b/src/ol/layer/Layer.js @@ -5,7 +5,7 @@ import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {getUid, inherits} from '../index.js'; import BaseObject from '../Object.js'; -import _ol_layer_Base_ from '../layer/Base.js'; +import BaseLayer from '../layer/Base.js'; import LayerProperty from '../layer/Property.js'; import _ol_obj_ from '../obj.js'; import RenderEventType from '../render/EventType.js'; @@ -38,7 +38,7 @@ var _ol_layer_Layer_ = function(options) { var baseOptions = _ol_obj_.assign({}, options); delete baseOptions.source; - _ol_layer_Base_.call(this, /** @type {olx.layer.BaseOptions} */ (baseOptions)); + BaseLayer.call(this, /** @type {olx.layer.BaseOptions} */ (baseOptions)); /** * @private @@ -70,7 +70,7 @@ var _ol_layer_Layer_ = function(options) { this.setSource(source); }; -inherits(_ol_layer_Layer_, _ol_layer_Base_); +inherits(_ol_layer_Layer_, BaseLayer); /** From c6646b1cda26978cc903b69a6c6b0e80a1a9da29 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:22:19 -0700 Subject: [PATCH 05/35] Rename _ol_layer_Group_ to LayerGroup --- examples/layer-group.js | 6 +++--- src/ol/PluggableMap.js | 6 +++--- src/ol/layer/Group.js | 24 +++++++++++----------- test/spec/ol/layer/group.test.js | 34 ++++++++++++++++---------------- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/examples/layer-group.js b/examples/layer-group.js index 50830955b7..c245b4cd9a 100644 --- a/examples/layer-group.js +++ b/examples/layer-group.js @@ -1,6 +1,6 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; -import _ol_layer_Group_ from '../src/ol/layer/Group.js'; +import LayerGroup from '../src/ol/layer/Group.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat} from '../src/ol/proj.js'; import OSM from '../src/ol/source/OSM.js'; @@ -10,7 +10,7 @@ var map = new Map({ layers: [ new TileLayer({ source: new OSM() - }), new _ol_layer_Group_({ + }), new LayerGroup({ layers: [ new TileLayer({ source: new TileJSON({ @@ -49,7 +49,7 @@ function bindInputs(layerid, layer) { } map.getLayers().forEach(function(layer, i) { bindInputs('#layer' + i, layer); - if (layer instanceof _ol_layer_Group_) { + if (layer instanceof LayerGroup) { layer.getLayers().forEach(function(sublayer, j) { bindInputs('#layer' + i + j, sublayer); }); diff --git a/src/ol/PluggableMap.js b/src/ol/PluggableMap.js index f73b68121e..70e72796ca 100644 --- a/src/ol/PluggableMap.js +++ b/src/ol/PluggableMap.js @@ -23,7 +23,7 @@ import EventType from './events/EventType.js'; import {createEmpty, clone, createOrUpdateEmpty, equals, getForViewAndSize, isEmpty} from './extent.js'; import {TRUE} from './functions.js'; import _ol_has_ from './has.js'; -import _ol_layer_Group_ from './layer/Group.js'; +import LayerGroup from './layer/Group.js'; import {getMapRendererPlugins} from './plugins.js'; import RendererType from './renderer/Type.js'; import _ol_size_ from './size.js'; @@ -1404,8 +1404,8 @@ function createOptionsInternal(options) { */ var values = {}; - var layerGroup = (options.layers instanceof _ol_layer_Group_) ? - options.layers : new _ol_layer_Group_({layers: options.layers}); + var layerGroup = (options.layers instanceof LayerGroup) ? + options.layers : new LayerGroup({layers: options.layers}); values[MapProperty.LAYERGROUP] = layerGroup; values[MapProperty.TARGET] = options.target; diff --git a/src/ol/layer/Group.js b/src/ol/layer/Group.js index 978621f67f..908bb5b7f8 100644 --- a/src/ol/layer/Group.js +++ b/src/ol/layer/Group.js @@ -35,7 +35,7 @@ var Property = { * @param {olx.layer.GroupOptions=} opt_options Layer options. * @api */ -var _ol_layer_Group_ = function(opt_options) { +var LayerGroup = function(opt_options) { var options = opt_options || {}; var baseOptions = /** @type {olx.layer.GroupOptions} */ @@ -78,13 +78,13 @@ var _ol_layer_Group_ = function(opt_options) { }; -inherits(_ol_layer_Group_, BaseLayer); +inherits(LayerGroup, BaseLayer); /** * @private */ -_ol_layer_Group_.prototype.handleLayerChange_ = function() { +LayerGroup.prototype.handleLayerChange_ = function() { this.changed(); }; @@ -93,7 +93,7 @@ _ol_layer_Group_.prototype.handleLayerChange_ = function() { * @param {ol.events.Event} event Event. * @private */ -_ol_layer_Group_.prototype.handleLayersChanged_ = function(event) { +LayerGroup.prototype.handleLayersChanged_ = function(event) { this.layersListenerKeys_.forEach(_ol_events_.unlistenByKey); this.layersListenerKeys_.length = 0; @@ -129,7 +129,7 @@ _ol_layer_Group_.prototype.handleLayersChanged_ = function(event) { * @param {ol.Collection.Event} collectionEvent Collection event. * @private */ -_ol_layer_Group_.prototype.handleLayersAdd_ = function(collectionEvent) { +LayerGroup.prototype.handleLayersAdd_ = function(collectionEvent) { var layer = /** @type {ol.layer.Base} */ (collectionEvent.element); var key = getUid(layer).toString(); this.listenerKeys_[key] = [ @@ -146,7 +146,7 @@ _ol_layer_Group_.prototype.handleLayersAdd_ = function(collectionEvent) { * @param {ol.Collection.Event} collectionEvent Collection event. * @private */ -_ol_layer_Group_.prototype.handleLayersRemove_ = function(collectionEvent) { +LayerGroup.prototype.handleLayersRemove_ = function(collectionEvent) { var layer = /** @type {ol.layer.Base} */ (collectionEvent.element); var key = getUid(layer).toString(); this.listenerKeys_[key].forEach(_ol_events_.unlistenByKey); @@ -163,7 +163,7 @@ _ol_layer_Group_.prototype.handleLayersRemove_ = function(collectionEvent) { * @observable * @api */ -_ol_layer_Group_.prototype.getLayers = function() { +LayerGroup.prototype.getLayers = function() { return (/** @type {!ol.Collection.} */ this.get(Property.LAYERS)); }; @@ -176,7 +176,7 @@ _ol_layer_Group_.prototype.getLayers = function() { * @observable * @api */ -_ol_layer_Group_.prototype.setLayers = function(layers) { +LayerGroup.prototype.setLayers = function(layers) { this.set(Property.LAYERS, layers); }; @@ -184,7 +184,7 @@ _ol_layer_Group_.prototype.setLayers = function(layers) { /** * @inheritDoc */ -_ol_layer_Group_.prototype.getLayersArray = function(opt_array) { +LayerGroup.prototype.getLayersArray = function(opt_array) { var array = opt_array !== undefined ? opt_array : []; this.getLayers().forEach(function(layer) { layer.getLayersArray(array); @@ -196,7 +196,7 @@ _ol_layer_Group_.prototype.getLayersArray = function(opt_array) { /** * @inheritDoc */ -_ol_layer_Group_.prototype.getLayerStatesArray = function(opt_states) { +LayerGroup.prototype.getLayerStatesArray = function(opt_states) { var states = opt_states !== undefined ? opt_states : []; var pos = states.length; @@ -231,8 +231,8 @@ _ol_layer_Group_.prototype.getLayerStatesArray = function(opt_states) { /** * @inheritDoc */ -_ol_layer_Group_.prototype.getSourceState = function() { +LayerGroup.prototype.getSourceState = function() { return SourceState.READY; }; -export default _ol_layer_Group_; +export default LayerGroup; diff --git a/test/spec/ol/layer/group.test.js b/test/spec/ol/layer/group.test.js index b2c1097772..dd089e827f 100644 --- a/test/spec/ol/layer/group.test.js +++ b/test/spec/ol/layer/group.test.js @@ -2,7 +2,7 @@ import {getUid} from '../../../../src/ol/index.js'; import {stableSort} from '../../../../src/ol/array.js'; import _ol_Collection_ from '../../../../src/ol/Collection.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js'; -import _ol_layer_Group_ from '../../../../src/ol/layer/Group.js'; +import LayerGroup from '../../../../src/ol/layer/Group.js'; import _ol_layer_Layer_ from '../../../../src/ol/layer/Layer.js'; import _ol_obj_ from '../../../../src/ol/obj.js'; import MapRenderer from '../../../../src/ol/renderer/Map.js'; @@ -16,7 +16,7 @@ describe('ol.layer.Group', function() { var layerGroup; beforeEach(function() { - layerGroup = new _ol_layer_Group_(); + layerGroup = new LayerGroup(); }); afterEach(function() { @@ -24,7 +24,7 @@ describe('ol.layer.Group', function() { }); it('creates an instance', function() { - expect(layerGroup).to.be.a(_ol_layer_Group_); + expect(layerGroup).to.be.a(LayerGroup); }); it('provides default opacity', function() { @@ -65,7 +65,7 @@ describe('ol.layer.Group', function() { projection: 'EPSG:4326' }) }); - group = new _ol_layer_Group_({ + group = new LayerGroup({ layers: [layer] }); listener = sinon.spy(); @@ -104,7 +104,7 @@ describe('ol.layer.Group', function() { projection: 'EPSG:4326' }) }); - group = new _ol_layer_Group_({ + group = new LayerGroup({ layers: [layer] }); listener = sinon.spy(); @@ -142,7 +142,7 @@ describe('ol.layer.Group', function() { projection: 'EPSG:4326' }) }); - var layerGroup = new _ol_layer_Group_({ + var layerGroup = new LayerGroup({ layers: [layer], opacity: 0.5, visible: false, @@ -182,7 +182,7 @@ describe('ol.layer.Group', function() { }); var groupExtent = [-10, -5, 10, 5]; - var layerGroup = new _ol_layer_Group_({ + var layerGroup = new LayerGroup({ layers: [layer], opacity: 0.5, visible: false, @@ -221,7 +221,7 @@ describe('ol.layer.Group', function() { var layerGroup; beforeEach(function() { - layerGroup = new _ol_layer_Group_(); + layerGroup = new LayerGroup(); }); afterEach(function() { @@ -285,7 +285,7 @@ describe('ol.layer.Group', function() { it('listen / unlisten for layers added to the collection', function() { var layers = new _ol_Collection_(); - var layerGroup = new _ol_layer_Group_({ + var layerGroup = new LayerGroup({ layers: layers }); expect(Object.keys(layerGroup.listenerKeys_).length).to.eql(0); @@ -316,7 +316,7 @@ describe('ol.layer.Group', function() { }) }); var layers = new _ol_Collection_([layer]); - var layerGroup = new _ol_layer_Group_(); + var layerGroup = new LayerGroup(); layerGroup.setLayers(layers); expect(layerGroup.getLayers()).to.be(layers); @@ -332,7 +332,7 @@ describe('ol.layer.Group', function() { describe('#getLayerStatesArray', function() { it('returns an empty array if no layer', function() { - var layerGroup = new _ol_layer_Group_(); + var layerGroup = new LayerGroup(); var layerStatesArray = layerGroup.getLayerStatesArray(); expect(layerStatesArray).to.be.a(Array); @@ -363,7 +363,7 @@ describe('ol.layer.Group', function() { }); it('does not transform layerStates by default', function() { - var layerGroup = new _ol_layer_Group_({ + var layerGroup = new LayerGroup({ layers: [layer1, layer2] }); @@ -386,7 +386,7 @@ describe('ol.layer.Group', function() { it('uses the layer group extent if layer has no extent', function() { var groupExtent = [-10, -5, 10, 5]; - var layerGroup = new _ol_layer_Group_({ + var layerGroup = new LayerGroup({ extent: groupExtent, layers: [layer1] }); @@ -397,7 +397,7 @@ describe('ol.layer.Group', function() { it('uses the intersection of group and child extent', function() { var groupExtent = [-10, -5, 10, 5]; - var layerGroup = new _ol_layer_Group_({ + var layerGroup = new LayerGroup({ extent: groupExtent, layers: [layer3] }); @@ -408,7 +408,7 @@ describe('ol.layer.Group', function() { }); it('transforms layerStates correctly', function() { - var layerGroup = new _ol_layer_Group_({ + var layerGroup = new LayerGroup({ layers: [layer1, layer2], opacity: 0.5, visible: false, @@ -446,7 +446,7 @@ describe('ol.layer.Group', function() { }); it('let order of layers without Z-index unchanged', function() { - var layerGroup = new _ol_layer_Group_({ + var layerGroup = new LayerGroup({ layers: [layer1, layer2] }); @@ -474,7 +474,7 @@ describe('ol.layer.Group', function() { }); layerM1.setZIndex(-1); - var layerGroup = new _ol_layer_Group_({ + var layerGroup = new LayerGroup({ layers: [layer1, layer10, layer2, layerM1] }); From f94d69c7a86336c08a398451585d263b58c851f5 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:23:52 -0700 Subject: [PATCH 06/35] Rename _ol_layer_Layer_ to Layer --- src/ol/control/Attribution.js | 4 +-- src/ol/layer/Image.js | 6 ++-- src/ol/layer/Layer.js | 24 +++++++------- src/ol/layer/Tile.js | 6 ++-- src/ol/layer/Vector.js | 6 ++-- src/ol/renderer/Map.js | 4 +-- src/ol/renderer/canvas/Map.js | 6 ++-- src/ol/renderer/webgl/Map.js | 10 +++--- test/spec/ol/layer/group.test.js | 24 +++++++------- test/spec/ol/layer/layer.test.js | 50 ++++++++++++++--------------- test/spec/ol/layer/vector.test.js | 4 +-- test/spec/ol/renderer/layer.test.js | 4 +-- 12 files changed, 74 insertions(+), 74 deletions(-) diff --git a/src/ol/control/Attribution.js b/src/ol/control/Attribution.js index 047edc12cc..05f8c4feea 100644 --- a/src/ol/control/Attribution.js +++ b/src/ol/control/Attribution.js @@ -8,7 +8,7 @@ import {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js'; import {removeChildren, replaceNode} from '../dom.js'; import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; -import _ol_layer_Layer_ from '../layer/Layer.js'; +import Layer from '../layer/Layer.js'; /** * @classdesc @@ -146,7 +146,7 @@ Attribution.prototype.getSourceAttributions_ = function(frameState) { var resolution = frameState.viewState.resolution; for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) { var layerState = layerStatesArray[i]; - if (!_ol_layer_Layer_.visibleAtResolution(layerState, resolution)) { + if (!Layer.visibleAtResolution(layerState, resolution)) { continue; } diff --git a/src/ol/layer/Image.js b/src/ol/layer/Image.js index bfd059b7fb..7477b585c7 100644 --- a/src/ol/layer/Image.js +++ b/src/ol/layer/Image.js @@ -3,7 +3,7 @@ */ import {inherits} from '../index.js'; import LayerType from '../LayerType.js'; -import _ol_layer_Layer_ from '../layer/Layer.js'; +import Layer from '../layer/Layer.js'; /** * @classdesc @@ -21,7 +21,7 @@ import _ol_layer_Layer_ from '../layer/Layer.js'; */ var ImageLayer = function(opt_options) { var options = opt_options ? opt_options : {}; - _ol_layer_Layer_.call(this, /** @type {olx.layer.LayerOptions} */ (options)); + Layer.call(this, /** @type {olx.layer.LayerOptions} */ (options)); /** * The layer type. @@ -32,7 +32,7 @@ var ImageLayer = function(opt_options) { }; -inherits(ImageLayer, _ol_layer_Layer_); +inherits(ImageLayer, Layer); /** diff --git a/src/ol/layer/Layer.js b/src/ol/layer/Layer.js index 33ceb931cd..99e37a2254 100644 --- a/src/ol/layer/Layer.js +++ b/src/ol/layer/Layer.js @@ -33,7 +33,7 @@ import SourceState from '../source/State.js'; * @param {olx.layer.LayerOptions} options Layer options. * @api */ -var _ol_layer_Layer_ = function(options) { +var Layer = function(options) { var baseOptions = _ol_obj_.assign({}, options); delete baseOptions.source; @@ -70,7 +70,7 @@ var _ol_layer_Layer_ = function(options) { this.setSource(source); }; -inherits(_ol_layer_Layer_, BaseLayer); +inherits(Layer, BaseLayer); /** @@ -81,7 +81,7 @@ inherits(_ol_layer_Layer_, BaseLayer); * @param {number} resolution Resolution. * @return {boolean} The layer is visible at the given resolution. */ -_ol_layer_Layer_.visibleAtResolution = function(layerState, resolution) { +Layer.visibleAtResolution = function(layerState, resolution) { return layerState.visible && resolution >= layerState.minResolution && resolution < layerState.maxResolution; }; @@ -90,7 +90,7 @@ _ol_layer_Layer_.visibleAtResolution = function(layerState, resolution) { /** * @inheritDoc */ -_ol_layer_Layer_.prototype.getLayersArray = function(opt_array) { +Layer.prototype.getLayersArray = function(opt_array) { var array = opt_array ? opt_array : []; array.push(this); return array; @@ -100,7 +100,7 @@ _ol_layer_Layer_.prototype.getLayersArray = function(opt_array) { /** * @inheritDoc */ -_ol_layer_Layer_.prototype.getLayerStatesArray = function(opt_states) { +Layer.prototype.getLayerStatesArray = function(opt_states) { var states = opt_states ? opt_states : []; states.push(this.getLayerState()); return states; @@ -113,7 +113,7 @@ _ol_layer_Layer_.prototype.getLayerStatesArray = function(opt_states) { * @observable * @api */ -_ol_layer_Layer_.prototype.getSource = function() { +Layer.prototype.getSource = function() { var source = this.get(LayerProperty.SOURCE); return /** @type {ol.source.Source} */ (source) || null; }; @@ -122,7 +122,7 @@ _ol_layer_Layer_.prototype.getSource = function() { /** * @inheritDoc */ -_ol_layer_Layer_.prototype.getSourceState = function() { +Layer.prototype.getSourceState = function() { var source = this.getSource(); return !source ? SourceState.UNDEFINED : source.getState(); }; @@ -131,7 +131,7 @@ _ol_layer_Layer_.prototype.getSourceState = function() { /** * @private */ -_ol_layer_Layer_.prototype.handleSourceChange_ = function() { +Layer.prototype.handleSourceChange_ = function() { this.changed(); }; @@ -139,7 +139,7 @@ _ol_layer_Layer_.prototype.handleSourceChange_ = function() { /** * @private */ -_ol_layer_Layer_.prototype.handleSourcePropertyChange_ = function() { +Layer.prototype.handleSourcePropertyChange_ = function() { if (this.sourceChangeKey_) { _ol_events_.unlistenByKey(this.sourceChangeKey_); this.sourceChangeKey_ = null; @@ -165,7 +165,7 @@ _ol_layer_Layer_.prototype.handleSourcePropertyChange_ = function() { * @param {ol.PluggableMap} map Map. * @api */ -_ol_layer_Layer_.prototype.setMap = function(map) { +Layer.prototype.setMap = function(map) { if (this.mapPrecomposeKey_) { _ol_events_.unlistenByKey(this.mapPrecomposeKey_); this.mapPrecomposeKey_ = null; @@ -199,7 +199,7 @@ _ol_layer_Layer_.prototype.setMap = function(map) { * @observable * @api */ -_ol_layer_Layer_.prototype.setSource = function(source) { +Layer.prototype.setSource = function(source) { this.set(LayerProperty.SOURCE, source); }; -export default _ol_layer_Layer_; +export default Layer; diff --git a/src/ol/layer/Tile.js b/src/ol/layer/Tile.js index 91601b4c48..4846832420 100644 --- a/src/ol/layer/Tile.js +++ b/src/ol/layer/Tile.js @@ -3,7 +3,7 @@ */ import {inherits} from '../index.js'; import LayerType from '../LayerType.js'; -import _ol_layer_Layer_ from '../layer/Layer.js'; +import Layer from '../layer/Layer.js'; import _ol_layer_TileProperty_ from '../layer/TileProperty.js'; import _ol_obj_ from '../obj.js'; @@ -28,7 +28,7 @@ var TileLayer = function(opt_options) { delete baseOptions.preload; delete baseOptions.useInterimTilesOnError; - _ol_layer_Layer_.call(this, /** @type {olx.layer.LayerOptions} */ (baseOptions)); + Layer.call(this, /** @type {olx.layer.LayerOptions} */ (baseOptions)); this.setPreload(options.preload !== undefined ? options.preload : 0); this.setUseInterimTilesOnError(options.useInterimTilesOnError !== undefined ? @@ -43,7 +43,7 @@ var TileLayer = function(opt_options) { }; -inherits(TileLayer, _ol_layer_Layer_); +inherits(TileLayer, Layer); /** diff --git a/src/ol/layer/Vector.js b/src/ol/layer/Vector.js index 99e0eed12a..8a2f31c3e9 100644 --- a/src/ol/layer/Vector.js +++ b/src/ol/layer/Vector.js @@ -3,7 +3,7 @@ */ import {inherits} from '../index.js'; import LayerType from '../LayerType.js'; -import _ol_layer_Layer_ from '../layer/Layer.js'; +import Layer from '../layer/Layer.js'; import _ol_layer_VectorRenderType_ from '../layer/VectorRenderType.js'; import _ol_obj_ from '../obj.js'; import _ol_style_Style_ from '../style/Style.js'; @@ -41,7 +41,7 @@ var VectorLayer = function(opt_options) { delete baseOptions.renderBuffer; delete baseOptions.updateWhileAnimating; delete baseOptions.updateWhileInteracting; - _ol_layer_Layer_.call(this, /** @type {olx.layer.LayerOptions} */ (baseOptions)); + Layer.call(this, /** @type {olx.layer.LayerOptions} */ (baseOptions)); /** * @private @@ -101,7 +101,7 @@ var VectorLayer = function(opt_options) { }; -inherits(VectorLayer, _ol_layer_Layer_); +inherits(VectorLayer, Layer); /** diff --git a/src/ol/renderer/Map.js b/src/ol/renderer/Map.js index 7bceace145..fc3956f357 100644 --- a/src/ol/renderer/Map.js +++ b/src/ol/renderer/Map.js @@ -7,7 +7,7 @@ import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {getWidth} from '../extent.js'; import {TRUE} from '../functions.js'; -import _ol_layer_Layer_ from '../layer/Layer.js'; +import Layer from '../layer/Layer.js'; import {getLayerRendererPlugins} from '../plugins.js'; import {iconImageCache} from '../style.js'; import _ol_transform_ from '../transform.js'; @@ -141,7 +141,7 @@ MapRenderer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameSta for (i = numLayers - 1; i >= 0; --i) { var layerState = layerStates[i]; var layer = layerState.layer; - if (_ol_layer_Layer_.visibleAtResolution(layerState, viewResolution) && + if (Layer.visibleAtResolution(layerState, viewResolution) && layerFilter.call(thisArg2, layer)) { var layerRenderer = this.getLayerRenderer(layer); if (layer.getSource()) { diff --git a/src/ol/renderer/canvas/Map.js b/src/ol/renderer/canvas/Map.js index 058079f908..eea47a7186 100644 --- a/src/ol/renderer/canvas/Map.js +++ b/src/ol/renderer/canvas/Map.js @@ -8,7 +8,7 @@ import {inherits} from '../../index.js'; import {stableSort} from '../../array.js'; import {CLASS_UNSELECTABLE} from '../../css.js'; import {createCanvasContext2D} from '../../dom.js'; -import _ol_layer_Layer_ from '../../layer/Layer.js'; +import Layer from '../../layer/Layer.js'; import RenderEvent from '../../render/Event.js'; import RenderEventType from '../../render/EventType.js'; import _ol_render_canvas_ from '../../render/canvas.js'; @@ -179,7 +179,7 @@ CanvasMapRenderer.prototype.renderFrame = function(frameState) { layerState = layerStatesArray[i]; layer = layerState.layer; layerRenderer = /** @type {ol.renderer.canvas.Layer} */ (this.getLayerRenderer(layer)); - if (!_ol_layer_Layer_.visibleAtResolution(layerState, viewResolution) || + if (!Layer.visibleAtResolution(layerState, viewResolution) || layerState.sourceState != SourceState.READY) { continue; } @@ -223,7 +223,7 @@ CanvasMapRenderer.prototype.forEachLayerAtPixel = function(pixel, frameState, ca for (i = numLayers - 1; i >= 0; --i) { var layerState = layerStates[i]; var layer = layerState.layer; - if (_ol_layer_Layer_.visibleAtResolution(layerState, viewResolution) && + if (Layer.visibleAtResolution(layerState, viewResolution) && layerFilter.call(thisArg2, layer)) { var layerRenderer = /** @type {ol.renderer.canvas.Layer} */ (this.getLayerRenderer(layer)); result = layerRenderer.forEachLayerAtCoordinate( diff --git a/src/ol/renderer/webgl/Map.js b/src/ol/renderer/webgl/Map.js index 9737b3905a..6e58c1ba97 100644 --- a/src/ol/renderer/webgl/Map.js +++ b/src/ol/renderer/webgl/Map.js @@ -8,7 +8,7 @@ import {CLASS_UNSELECTABLE} from '../../css.js'; import {createCanvasContext2D} from '../../dom.js'; import _ol_events_ from '../../events.js'; import _ol_has_ from '../../has.js'; -import _ol_layer_Layer_ from '../../layer/Layer.js'; +import Layer from '../../layer/Layer.js'; import RenderEvent from '../../render/Event.js'; import RenderEventType from '../../render/EventType.js'; import _ol_render_webgl_Immediate_ from '../../render/webgl/Immediate.js'; @@ -449,7 +449,7 @@ WebGLMapRenderer.prototype.renderFrame = function(frameState) { var i, ii, layerRenderer, layerState; for (i = 0, ii = layerStatesArray.length; i < ii; ++i) { layerState = layerStatesArray[i]; - if (_ol_layer_Layer_.visibleAtResolution(layerState, viewResolution) && + if (Layer.visibleAtResolution(layerState, viewResolution) && layerState.sourceState == SourceState.READY) { layerRenderer = /** @type {ol.renderer.webgl.Layer} */ (this.getLayerRenderer(layerState.layer)); if (layerRenderer.prepareFrame(frameState, layerState, context)) { @@ -524,7 +524,7 @@ WebGLMapRenderer.prototype.forEachFeatureAtCoordinate = function(coordinate, fra for (i = numLayers - 1; i >= 0; --i) { var layerState = layerStates[i]; var layer = layerState.layer; - if (_ol_layer_Layer_.visibleAtResolution(layerState, viewState.resolution) && + if (Layer.visibleAtResolution(layerState, viewState.resolution) && layerFilter.call(thisArg2, layer)) { var layerRenderer = this.getLayerRenderer(layer); result = layerRenderer.forEachFeatureAtCoordinate( @@ -556,7 +556,7 @@ WebGLMapRenderer.prototype.hasFeatureAtCoordinate = function(coordinate, frameSt for (i = numLayers - 1; i >= 0; --i) { var layerState = layerStates[i]; var layer = layerState.layer; - if (_ol_layer_Layer_.visibleAtResolution(layerState, viewState.resolution) && + if (Layer.visibleAtResolution(layerState, viewState.resolution) && layerFilter.call(thisArg, layer)) { var layerRenderer = this.getLayerRenderer(layer); hasFeature = @@ -588,7 +588,7 @@ WebGLMapRenderer.prototype.forEachLayerAtPixel = function(pixel, frameState, cal for (i = numLayers - 1; i >= 0; --i) { var layerState = layerStates[i]; var layer = layerState.layer; - if (_ol_layer_Layer_.visibleAtResolution(layerState, viewState.resolution) && + if (Layer.visibleAtResolution(layerState, viewState.resolution) && layerFilter.call(thisArg, layer)) { var layerRenderer = /** @type {ol.renderer.webgl.Layer} */ (this.getLayerRenderer(layer)); result = layerRenderer.forEachLayerAtPixel( diff --git a/test/spec/ol/layer/group.test.js b/test/spec/ol/layer/group.test.js index dd089e827f..7f122094f2 100644 --- a/test/spec/ol/layer/group.test.js +++ b/test/spec/ol/layer/group.test.js @@ -3,7 +3,7 @@ import {stableSort} from '../../../../src/ol/array.js'; import _ol_Collection_ from '../../../../src/ol/Collection.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js'; import LayerGroup from '../../../../src/ol/layer/Group.js'; -import _ol_layer_Layer_ from '../../../../src/ol/layer/Layer.js'; +import Layer from '../../../../src/ol/layer/Layer.js'; import _ol_obj_ from '../../../../src/ol/obj.js'; import MapRenderer from '../../../../src/ol/renderer/Map.js'; import Source from '../../../../src/ol/source/Source.js'; @@ -60,7 +60,7 @@ describe('ol.layer.Group', function() { var layer, group, listener; beforeEach(function() { - layer = new _ol_layer_Layer_({ + layer = new Layer({ source: new Source({ projection: 'EPSG:4326' }) @@ -99,7 +99,7 @@ describe('ol.layer.Group', function() { var layer, group, listener; beforeEach(function() { - layer = new _ol_layer_Layer_({ + layer = new Layer({ source: new Source({ projection: 'EPSG:4326' }) @@ -137,7 +137,7 @@ describe('ol.layer.Group', function() { describe('constructor (options)', function() { it('accepts options', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ source: new Source({ projection: 'EPSG:4326' }) @@ -175,7 +175,7 @@ describe('ol.layer.Group', function() { }); it('accepts an extent option', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ source: new Source({ projection: 'EPSG:4326' }) @@ -289,7 +289,7 @@ describe('ol.layer.Group', function() { layers: layers }); expect(Object.keys(layerGroup.listenerKeys_).length).to.eql(0); - var layer = new _ol_layer_Layer_({}); + var layer = new Layer({}); layers.push(layer); expect(Object.keys(layerGroup.listenerKeys_).length).to.eql(1); @@ -310,7 +310,7 @@ describe('ol.layer.Group', function() { describe('#setLayers', function() { it('sets layers property', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ source: new Source({ projection: 'EPSG:4326' }) @@ -341,12 +341,12 @@ describe('ol.layer.Group', function() { layerGroup.dispose(); }); - var layer1 = new _ol_layer_Layer_({ + var layer1 = new Layer({ source: new Source({ projection: 'EPSG:4326' }) }); - var layer2 = new _ol_layer_Layer_({ + var layer2 = new Layer({ source: new Source({ projection: 'EPSG:4326' }), @@ -355,7 +355,7 @@ describe('ol.layer.Group', function() { maxResolution: 500, minResolution: 0.25 }); - var layer3 = new _ol_layer_Layer_({ + var layer3 = new Layer({ source: new Source({ projection: 'EPSG:4326' }), @@ -460,14 +460,14 @@ describe('ol.layer.Group', function() { }); it('orders layer with higher Z-index on top', function() { - var layer10 = new _ol_layer_Layer_({ + var layer10 = new Layer({ source: new Source({ projection: 'EPSG:4326' }) }); layer10.setZIndex(10); - var layerM1 = new _ol_layer_Layer_({ + var layerM1 = new Layer({ source: new Source({ projection: 'EPSG:4326' }) diff --git a/test/spec/ol/layer/layer.test.js b/test/spec/ol/layer/layer.test.js index 8d2211799e..5d70109549 100644 --- a/test/spec/ol/layer/layer.test.js +++ b/test/spec/ol/layer/layer.test.js @@ -1,6 +1,6 @@ import {getUid} from '../../../../src/ol/index.js'; import Map from '../../../../src/ol/Map.js'; -import _ol_layer_Layer_ from '../../../../src/ol/layer/Layer.js'; +import Layer from '../../../../src/ol/layer/Layer.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; import RenderEvent from '../../../../src/ol/render/Event.js'; import Source from '../../../../src/ol/source/Source.js'; @@ -13,7 +13,7 @@ describe('ol.layer.Layer', function() { var layer; beforeEach(function() { - layer = new _ol_layer_Layer_({ + layer = new Layer({ source: new Source({ projection: getProjection('EPSG:4326') }) @@ -25,7 +25,7 @@ describe('ol.layer.Layer', function() { }); it('creates an instance', function() { - expect(layer).to.be.a(_ol_layer_Layer_); + expect(layer).to.be.a(Layer); }); it('provides default opacity', function() { @@ -63,7 +63,7 @@ describe('ol.layer.Layer', function() { describe('constructor (options)', function() { it('accepts options', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ source: new Source({ projection: getProjection('EPSG:4326') }), @@ -101,7 +101,7 @@ describe('ol.layer.Layer', function() { var layer; beforeEach(function() { - layer = new _ol_layer_Layer_({ + layer = new Layer({ source: new Source({ projection: getProjection('EPSG:4326') }) @@ -117,7 +117,7 @@ describe('ol.layer.Layer', function() { layer.setMinResolution(3); layer.setMaxResolution(5); var layerState = layer.getLayerState(); - expect(_ol_layer_Layer_.visibleAtResolution(layerState, 4)).to.be(false); + expect(Layer.visibleAtResolution(layerState, 4)).to.be(false); }); it('returns false if resolution lower than minResolution', function() { @@ -125,7 +125,7 @@ describe('ol.layer.Layer', function() { layer.setMinResolution(3); layer.setMaxResolution(5); var layerState = layer.getLayerState(); - expect(_ol_layer_Layer_.visibleAtResolution(layerState, 2)).to.be(false); + expect(Layer.visibleAtResolution(layerState, 2)).to.be(false); }); it('returns false if resolution greater than maxResolution', function() { @@ -133,7 +133,7 @@ describe('ol.layer.Layer', function() { layer.setMinResolution(3); layer.setMaxResolution(5); var layerState = layer.getLayerState(); - expect(_ol_layer_Layer_.visibleAtResolution(layerState, 6)).to.be(false); + expect(Layer.visibleAtResolution(layerState, 6)).to.be(false); }); it('returns true otherwise', function() { @@ -141,7 +141,7 @@ describe('ol.layer.Layer', function() { layer.setMinResolution(3); layer.setMaxResolution(5); var layerState = layer.getLayerState(); - expect(_ol_layer_Layer_.visibleAtResolution(layerState, 4)).to.be(true); + expect(Layer.visibleAtResolution(layerState, 4)).to.be(true); }); }); @@ -151,7 +151,7 @@ describe('ol.layer.Layer', function() { var layer; beforeEach(function() { - layer = new _ol_layer_Layer_({ + layer = new Layer({ source: new Source({ projection: getProjection('EPSG:4326') }) @@ -217,7 +217,7 @@ describe('ol.layer.Layer', function() { it('gets the layer source', function() { var source = new Source({projection: getProjection('EPSG:4326')}); - var layer = new _ol_layer_Layer_({source: source}); + var layer = new Layer({source: source}); expect(layer.getSource()).to.be(source); }); @@ -227,7 +227,7 @@ describe('ol.layer.Layer', function() { var projection = getProjection('EPSG:4326'); it('sets the layer source', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ source: new Source({projection: projection}) }); @@ -237,7 +237,7 @@ describe('ol.layer.Layer', function() { }); it('calls changed', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ source: new Source({projection: projection}) }); sinon.spy(layer, 'changed'); @@ -248,10 +248,10 @@ describe('ol.layer.Layer', function() { }); it('sets up event listeners', function() { - sinon.spy(_ol_layer_Layer_.prototype, 'handleSourceChange_'); + sinon.spy(Layer.prototype, 'handleSourceChange_'); var first = new Source({projection: projection}); - var layer = new _ol_layer_Layer_({source: first}); + var layer = new Layer({source: first}); first.setState('ready'); expect(layer.handleSourceChange_.calledOnce).to.be(true); @@ -264,7 +264,7 @@ describe('ol.layer.Layer', function() { expect(layer.handleSourceChange_.callCount).to.be(2); // remove spy - _ol_layer_Layer_.prototype.handleSourceChange_.restore(); + Layer.prototype.handleSourceChange_.restore(); }); }); @@ -273,7 +273,7 @@ describe('ol.layer.Layer', function() { var projection = getProjection('EPSG:4326'); it('sets the layer source', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ source: new Source({projection: projection}) }); @@ -283,7 +283,7 @@ describe('ol.layer.Layer', function() { }); it('calls changed', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ source: new Source({projection: projection}) }); sinon.spy(layer, 'changed'); @@ -294,10 +294,10 @@ describe('ol.layer.Layer', function() { }); it('sets up event listeners', function() { - sinon.spy(_ol_layer_Layer_.prototype, 'handleSourceChange_'); + sinon.spy(Layer.prototype, 'handleSourceChange_'); var first = new Source({projection: projection}); - var layer = new _ol_layer_Layer_({source: first}); + var layer = new Layer({source: first}); first.setState('ready'); expect(layer.handleSourceChange_.calledOnce).to.be(true); @@ -310,7 +310,7 @@ describe('ol.layer.Layer', function() { expect(layer.handleSourceChange_.callCount).to.be(2); // remove spy - _ol_layer_Layer_.prototype.handleSourceChange_.restore(); + Layer.prototype.handleSourceChange_.restore(); }); }); @@ -321,7 +321,7 @@ describe('ol.layer.Layer', function() { var layer; beforeEach(function() { - layer = new _ol_layer_Layer_({ + layer = new Layer({ source: new Source({ projection: getProjection('EPSG:4326') }) @@ -351,7 +351,7 @@ describe('ol.layer.Layer', function() { var layer; beforeEach(function() { - layer = new _ol_layer_Layer_({ + layer = new Layer({ source: new Source({ projection: getProjection('EPSG:4326') }) @@ -392,7 +392,7 @@ describe('ol.layer.Layer', function() { describe('with map in constructor options', function() { it('renders the layer', function() { - var layer = new _ol_layer_Layer_({ + var layer = new Layer({ map: map }); var frameState = { @@ -420,7 +420,7 @@ describe('ol.layer.Layer', function() { }); it('requests a render frame', function() { - var layer = new _ol_layer_Layer_({}); + var layer = new Layer({}); layer.setMap(map); expect(mapRenderSpy.callCount).to.be(1); diff --git a/test/spec/ol/layer/vector.test.js b/test/spec/ol/layer/vector.test.js index 28a1de9c1a..90049569dd 100644 --- a/test/spec/ol/layer/vector.test.js +++ b/test/spec/ol/layer/vector.test.js @@ -1,4 +1,4 @@ -import _ol_layer_Layer_ from '../../../../src/ol/layer/Layer.js'; +import Layer from '../../../../src/ol/layer/Layer.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; @@ -13,7 +13,7 @@ describe('ol.layer.Vector', function() { it('creates a new layer', function() { var layer = new VectorLayer({source: source}); expect(layer).to.be.a(VectorLayer); - expect(layer).to.be.a(_ol_layer_Layer_); + expect(layer).to.be.a(Layer); }); it('accepts a style option with a single style', function() { diff --git a/test/spec/ol/renderer/layer.test.js b/test/spec/ol/renderer/layer.test.js index f47c67ecac..d56b8e4ec3 100644 --- a/test/spec/ol/renderer/layer.test.js +++ b/test/spec/ol/renderer/layer.test.js @@ -1,7 +1,7 @@ import _ol_Image_ from '../../../../src/ol/Image.js'; import Map from '../../../../src/ol/Map.js'; import View from '../../../../src/ol/View.js'; -import _ol_layer_Layer_ from '../../../../src/ol/layer/Layer.js'; +import Layer from '../../../../src/ol/layer/Layer.js'; import TileLayer from '../../../../src/ol/layer/Tile.js'; import LayerRenderer from '../../../../src/ol/renderer/Layer.js'; import XYZ from '../../../../src/ol/source/XYZ.js'; @@ -13,7 +13,7 @@ describe('ol.renderer.Layer', function() { var eventType = 'change'; beforeEach(function() { - var layer = new _ol_layer_Layer_({}); + var layer = new Layer({}); renderer = new LayerRenderer(layer); }); From 5337dc31d96111e3e9279e2ca4d50ccc39b3e0c3 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:25:51 -0700 Subject: [PATCH 07/35] Rename _ol_layer_VectorTile_ to VectorTileLayer --- examples/geojson-vt.js | 4 ++-- examples/mapbox-vector-tiles-advanced.js | 4 ++-- examples/mapbox-vector-tiles.js | 4 ++-- examples/osm-vector-tiles.js | 4 ++-- examples/vector-tile-info.js | 4 ++-- src/ol/layer/VectorTile.js | 16 ++++++++-------- test/rendering/ol/layer/vectortile.test.js | 4 ++-- test/spec/ol/layer/vectortile.test.js | 12 ++++++------ .../ol/renderer/canvas/vectortilelayer.test.js | 12 ++++++------ test/spec/ol/source/vectortile.test.js | 4 ++-- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/examples/geojson-vt.js b/examples/geojson-vt.js index c284a12282..6aae1d7005 100644 --- a/examples/geojson-vt.js +++ b/examples/geojson-vt.js @@ -5,7 +5,7 @@ import GeoJSON from '../src/ol/format/GeoJSON.js'; import OSM from '../src/ol/source/OSM.js'; import VectorTileSource from '../src/ol/source/VectorTile.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; +import VectorTileLayer from '../src/ol/layer/VectorTile.js'; import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; @@ -93,7 +93,7 @@ fetch(url).then(function(response) { }, url: 'data:' // arbitrary url, we don't use it in the tileLoadFunction }); - var vectorLayer = new _ol_layer_VectorTile_({ + var vectorLayer = new VectorTileLayer({ source: vectorSource }); map.addLayer(vectorLayer); diff --git a/examples/mapbox-vector-tiles-advanced.js b/examples/mapbox-vector-tiles-advanced.js index 8b6b0d3d6f..7ec9918e69 100644 --- a/examples/mapbox-vector-tiles-advanced.js +++ b/examples/mapbox-vector-tiles-advanced.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import MVT from '../src/ol/format/MVT.js'; -import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; +import VectorTileLayer from '../src/ol/layer/VectorTile.js'; import {get as getProjection} from '../src/ol/proj.js'; import VectorTileSource from '../src/ol/source/VectorTile.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; @@ -32,7 +32,7 @@ function tileUrlFunction(tileCoord) { var map = new Map({ layers: [ - new _ol_layer_VectorTile_({ + new VectorTileLayer({ source: new VectorTileSource({ attributions: '© Mapbox ' + '© ' + diff --git a/examples/mapbox-vector-tiles.js b/examples/mapbox-vector-tiles.js index cec13bfa6e..70b138f638 100644 --- a/examples/mapbox-vector-tiles.js +++ b/examples/mapbox-vector-tiles.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import MVT from '../src/ol/format/MVT.js'; -import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; +import VectorTileLayer from '../src/ol/layer/VectorTile.js'; import VectorTileSource from '../src/ol/source/VectorTile.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; @@ -14,7 +14,7 @@ var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg'; var map = new Map({ layers: [ - new _ol_layer_VectorTile_({ + new VectorTileLayer({ declutter: true, source: new VectorTileSource({ attributions: '© Mapbox ' + diff --git a/examples/osm-vector-tiles.js b/examples/osm-vector-tiles.js index 05ac9d689d..b949154975 100644 --- a/examples/osm-vector-tiles.js +++ b/examples/osm-vector-tiles.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import TopoJSON from '../src/ol/format/TopoJSON.js'; -import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; +import VectorTileLayer from '../src/ol/layer/VectorTile.js'; import {fromLonLat} from '../src/ol/proj.js'; import VectorTileSource from '../src/ol/source/VectorTile.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; @@ -60,7 +60,7 @@ var roadStyle = function(feature) { var map = new Map({ layers: [ - new _ol_layer_VectorTile_({ + new VectorTileLayer({ source: new VectorTileSource({ attributions: '© OpenStreetMap contributors, Who’s On First, ' + 'Natural Earth, and openstreetmapdata.com', diff --git a/examples/vector-tile-info.js b/examples/vector-tile-info.js index a159eb02ec..01fff8070c 100644 --- a/examples/vector-tile-info.js +++ b/examples/vector-tile-info.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import MVT from '../src/ol/format/MVT.js'; -import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; +import VectorTileLayer from '../src/ol/layer/VectorTile.js'; import VectorTileSource from '../src/ol/source/VectorTile.js'; var map = new Map({ @@ -10,7 +10,7 @@ var map = new Map({ center: [0, 0], zoom: 2 }), - layers: [new _ol_layer_VectorTile_({ + layers: [new VectorTileLayer({ source: new VectorTileSource({ format: new MVT(), url: 'https://basemaps.arcgis.com/v1/arcgis/rest/services/World_Basemap/VectorTileServer/tile/{z}/{y}/{x}.pbf' diff --git a/src/ol/layer/VectorTile.js b/src/ol/layer/VectorTile.js index 09fff11053..e6abe832ca 100644 --- a/src/ol/layer/VectorTile.js +++ b/src/ol/layer/VectorTile.js @@ -21,7 +21,7 @@ import _ol_obj_ from '../obj.js'; * @param {olx.layer.VectorTileOptions=} opt_options Options. * @api */ -var _ol_layer_VectorTile_ = function(opt_options) { +var VectorTileLayer = function(opt_options) { var options = opt_options ? opt_options : {}; var renderMode = options.renderMode || _ol_layer_VectorTileRenderType_.HYBRID; @@ -54,7 +54,7 @@ var _ol_layer_VectorTile_ = function(opt_options) { }; -inherits(_ol_layer_VectorTile_, VectorLayer); +inherits(VectorTileLayer, VectorLayer); /** @@ -63,7 +63,7 @@ inherits(_ol_layer_VectorTile_, VectorLayer); * @observable * @api */ -_ol_layer_VectorTile_.prototype.getPreload = function() { +VectorTileLayer.prototype.getPreload = function() { return ( /** @type {number} */ this.get(_ol_layer_TileProperty_.PRELOAD) ); @@ -76,7 +76,7 @@ _ol_layer_VectorTile_.prototype.getPreload = function() { * @observable * @api */ -_ol_layer_VectorTile_.prototype.getUseInterimTilesOnError = function() { +VectorTileLayer.prototype.getUseInterimTilesOnError = function() { return ( /** @type {boolean} */ this.get(_ol_layer_TileProperty_.USE_INTERIM_TILES_ON_ERROR) ); @@ -89,7 +89,7 @@ _ol_layer_VectorTile_.prototype.getUseInterimTilesOnError = function() { * @observable * @api */ -_ol_layer_VectorTile_.prototype.setPreload = function(preload) { +VectorTileLayer.prototype.setPreload = function(preload) { this.set(_ol_layer_TileProperty_.PRELOAD, preload); }; @@ -100,7 +100,7 @@ _ol_layer_VectorTile_.prototype.setPreload = function(preload) { * @observable * @api */ -_ol_layer_VectorTile_.prototype.setUseInterimTilesOnError = function(useInterimTilesOnError) { +VectorTileLayer.prototype.setUseInterimTilesOnError = function(useInterimTilesOnError) { this.set( _ol_layer_TileProperty_.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError); }; @@ -112,5 +112,5 @@ _ol_layer_VectorTile_.prototype.setUseInterimTilesOnError = function(useInterimT * @return {ol.source.VectorTile} Source. * @api */ -_ol_layer_VectorTile_.prototype.getSource; -export default _ol_layer_VectorTile_; +VectorTileLayer.prototype.getSource; +export default VectorTileLayer; diff --git a/test/rendering/ol/layer/vectortile.test.js b/test/rendering/ol/layer/vectortile.test.js index ecffba7886..6a0afd35b0 100644 --- a/test/rendering/ol/layer/vectortile.test.js +++ b/test/rendering/ol/layer/vectortile.test.js @@ -4,7 +4,7 @@ import View from '../../../../src/ol/View.js'; import MVT from '../../../../src/ol/format/MVT.js'; import Point from '../../../../src/ol/geom/Point.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; -import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; +import VectorTileLayer from '../../../../src/ol/layer/VectorTile.js'; import _ol_obj_ from '../../../../src/ol/obj.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; @@ -62,7 +62,7 @@ describe('ol.rendering.layer.VectorTile', function() { source: source }; _ol_obj_.assign(options, layerOptions); - map.addLayer(new _ol_layer_VectorTile_(options)); + map.addLayer(new VectorTileLayer(options)); } describe('vector tile layer', function() { diff --git a/test/spec/ol/layer/vectortile.test.js b/test/spec/ol/layer/vectortile.test.js index 860d8237b3..47ae6c9e3e 100644 --- a/test/spec/ol/layer/vectortile.test.js +++ b/test/spec/ol/layer/vectortile.test.js @@ -1,4 +1,4 @@ -import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; +import VectorTileLayer from '../../../../src/ol/layer/VectorTile.js'; import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; @@ -9,7 +9,7 @@ describe('ol.layer.VectorTile', function() { var layer; beforeEach(function() { - layer = new _ol_layer_VectorTile_({ + layer = new VectorTileLayer({ source: new VectorTileSource({}) }); }); @@ -19,7 +19,7 @@ describe('ol.layer.VectorTile', function() { }); it('creates an instance', function() { - expect(layer).to.be.a(_ol_layer_VectorTile_); + expect(layer).to.be.a(VectorTileLayer); }); it('provides default preload', function() { @@ -38,18 +38,18 @@ describe('ol.layer.VectorTile', function() { describe('constructor (options)', function() { it('works with options', function() { - var layer = new _ol_layer_VectorTile_({ + var layer = new VectorTileLayer({ renderMode: 'vector', source: new VectorTileSource({}) }); expect(layer.getRenderMode()).to.be('vector'); - layer = new _ol_layer_VectorTile_({ + layer = new VectorTileLayer({ renderMode: 'image', source: new VectorTileSource({}) }); expect(layer.getRenderMode()).to.be('image'); expect(function() { - layer = new _ol_layer_VectorTile_({ + layer = new VectorTileLayer({ renderMode: 'foo', source: new VectorTileSource({}) }); diff --git a/test/spec/ol/renderer/canvas/vectortilelayer.test.js b/test/spec/ol/renderer/canvas/vectortilelayer.test.js index 666c809aef..259b6aeb8d 100644 --- a/test/spec/ol/renderer/canvas/vectortilelayer.test.js +++ b/test/spec/ol/renderer/canvas/vectortilelayer.test.js @@ -9,7 +9,7 @@ import View from '../../../../../src/ol/View.js'; import * as _ol_extent_ from '../../../../../src/ol/extent.js'; import MVT from '../../../../../src/ol/format/MVT.js'; import Point from '../../../../../src/ol/geom/Point.js'; -import _ol_layer_VectorTile_ from '../../../../../src/ol/layer/VectorTile.js'; +import VectorTileLayer from '../../../../../src/ol/layer/VectorTile.js'; import {get as getProjection, fromLonLat} from '../../../../../src/ol/proj.js'; import _ol_proj_Projection_ from '../../../../../src/ol/proj/Projection.js'; import _ol_render_canvas_ from '../../../../../src/ol/render/canvas.js'; @@ -77,7 +77,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { tile.setState(TileState.LOADED); return tile; }; - layer = new _ol_layer_VectorTile_({ + layer = new VectorTileLayer({ source: source, style: layerStyle }); @@ -214,7 +214,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { }); it('works for multiple layers that use the same source', function() { - var layer2 = new _ol_layer_VectorTile_({ + var layer2 = new VectorTileLayer({ source: source, style: new _ol_style_Style_({ text: new _ol_style_Text_({ @@ -239,7 +239,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { describe('#prepareFrame', function() { it('re-renders when layer changed', function() { - var layer = new _ol_layer_VectorTile_({ + var layer = new VectorTileLayer({ source: new VectorTileSource({ tileGrid: _ol_tilegrid_.createXYZ(), transition: 0 @@ -308,7 +308,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { beforeEach(function() { replayGroup = {}; - layer = new _ol_layer_VectorTile_({ + layer = new VectorTileLayer({ source: new VectorTileSource({ tileClass: TileClass, tileGrid: _ol_tilegrid_.createXYZ() @@ -358,7 +358,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { var map = new Map({ target: target, layers: [ - new _ol_layer_VectorTile_({ + new VectorTileLayer({ extent: extent, source: source }) diff --git a/test/spec/ol/source/vectortile.test.js b/test/spec/ol/source/vectortile.test.js index 4838982c06..d700adae5e 100644 --- a/test/spec/ol/source/vectortile.test.js +++ b/test/spec/ol/source/vectortile.test.js @@ -3,7 +3,7 @@ import View from '../../../../src/ol/View.js'; import VectorImageTile from '../../../../src/ol/VectorImageTile.js'; import VectorTile from '../../../../src/ol/VectorTile.js'; import MVT from '../../../../src/ol/format/MVT.js'; -import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; +import VectorTileLayer from '../../../../src/ol/layer/VectorTile.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -111,7 +111,7 @@ describe('ol.source.VectorTile', function() { map = new Map({ layers: [ - new _ol_layer_VectorTile_({ + new VectorTileLayer({ extent: extent, source: source }) From 65d30f7ec0fd5dc4fbe9d576ac50e10bd63372ef Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:27:16 -0700 Subject: [PATCH 08/35] Rename _ol_reproj_Image_ to ReprojImage --- src/ol/reproj/Image.js | 18 +++++++++--------- src/ol/source/Image.js | 4 ++-- test/rendering/ol/reproj/image.test.js | 4 ++-- test/spec/ol/reproj/image.test.js | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/ol/reproj/Image.js b/src/ol/reproj/Image.js index a764964dda..e0ffc4265c 100644 --- a/src/ol/reproj/Image.js +++ b/src/ol/reproj/Image.js @@ -26,7 +26,7 @@ import _ol_reproj_Triangulation_ from '../reproj/Triangulation.js'; * @param {ol.ReprojImageFunctionType} getImageFunction * Function returning source images (extent, resolution, pixelRatio). */ -var _ol_reproj_Image_ = function(sourceProj, targetProj, +var ReprojImage = function(sourceProj, targetProj, targetExtent, targetResolution, pixelRatio, getImageFunction) { /** @@ -109,13 +109,13 @@ var _ol_reproj_Image_ = function(sourceProj, targetProj, _ol_ImageBase_.call(this, targetExtent, targetResolution, this.sourcePixelRatio_, state); }; -inherits(_ol_reproj_Image_, _ol_ImageBase_); +inherits(ReprojImage, _ol_ImageBase_); /** * @inheritDoc */ -_ol_reproj_Image_.prototype.disposeInternal = function() { +ReprojImage.prototype.disposeInternal = function() { if (this.state == ImageState.LOADING) { this.unlistenSource_(); } @@ -126,7 +126,7 @@ _ol_reproj_Image_.prototype.disposeInternal = function() { /** * @inheritDoc */ -_ol_reproj_Image_.prototype.getImage = function() { +ReprojImage.prototype.getImage = function() { return this.canvas_; }; @@ -134,7 +134,7 @@ _ol_reproj_Image_.prototype.getImage = function() { /** * @return {ol.proj.Projection} Projection. */ -_ol_reproj_Image_.prototype.getProjection = function() { +ReprojImage.prototype.getProjection = function() { return this.targetProj_; }; @@ -142,7 +142,7 @@ _ol_reproj_Image_.prototype.getProjection = function() { /** * @private */ -_ol_reproj_Image_.prototype.reproject_ = function() { +ReprojImage.prototype.reproject_ = function() { var sourceState = this.sourceImage_.getState(); if (sourceState == ImageState.LOADED) { var width = getWidth(this.targetExtent_) / this.targetResolution_; @@ -163,7 +163,7 @@ _ol_reproj_Image_.prototype.reproject_ = function() { /** * @inheritDoc */ -_ol_reproj_Image_.prototype.load = function() { +ReprojImage.prototype.load = function() { if (this.state == ImageState.IDLE) { this.state = ImageState.LOADING; this.changed(); @@ -189,8 +189,8 @@ _ol_reproj_Image_.prototype.load = function() { /** * @private */ -_ol_reproj_Image_.prototype.unlistenSource_ = function() { +ReprojImage.prototype.unlistenSource_ = function() { _ol_events_.unlistenByKey(/** @type {!ol.EventsKey} */ (this.sourceListenerKey_)); this.sourceListenerKey_ = null; }; -export default _ol_reproj_Image_; +export default ReprojImage; diff --git a/src/ol/source/Image.js b/src/ol/source/Image.js index cf7e354042..c96e424092 100644 --- a/src/ol/source/Image.js +++ b/src/ol/source/Image.js @@ -8,7 +8,7 @@ import {linearFindNearest} from '../array.js'; import Event from '../events/Event.js'; import {equals} from '../extent.js'; import {equivalent} from '../proj.js'; -import _ol_reproj_Image_ from '../reproj/Image.js'; +import ReprojImage from '../reproj/Image.js'; import Source from '../source/Source.js'; /** @@ -109,7 +109,7 @@ ImageSource.prototype.getImage = function(extent, resolution, pixelRatio, projec this.reprojectedImage_ = null; } - this.reprojectedImage_ = new _ol_reproj_Image_( + this.reprojectedImage_ = new ReprojImage( sourceProjection, projection, extent, resolution, pixelRatio, function(extent, resolution, pixelRatio) { return this.getImageInternal(extent, resolution, diff --git a/test/rendering/ol/reproj/image.test.js b/test/rendering/ol/reproj/image.test.js index 86dcff2f1b..eb8b7fb916 100644 --- a/test/rendering/ol/reproj/image.test.js +++ b/test/rendering/ol/reproj/image.test.js @@ -1,7 +1,7 @@ import _ol_events_ from '../../../../src/ol/events.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; import _ol_proj_EPSG3857_ from '../../../../src/ol/proj/EPSG3857.js'; -import _ol_reproj_Image_ from '../../../../src/ol/reproj/Image.js'; +import ReprojImage from '../../../../src/ol/reproj/Image.js'; import Static from '../../../../src/ol/source/ImageStatic.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -14,7 +14,7 @@ describe('ol.rendering.reproj.Image', function() { var imagesRequested = 0; - var image = new _ol_reproj_Image_(sourceProj, getProjection(targetProj), + var image = new ReprojImage(sourceProj, getProjection(targetProj), targetExtent, targetResolution, pixelRatio, function(extent, resolution, pixelRatio) { imagesRequested++; diff --git a/test/spec/ol/reproj/image.test.js b/test/spec/ol/reproj/image.test.js index 76f908d31d..c5f11b7ab2 100644 --- a/test/spec/ol/reproj/image.test.js +++ b/test/spec/ol/reproj/image.test.js @@ -1,12 +1,12 @@ import _ol_Image_ from '../../../../src/ol/Image.js'; import _ol_events_ from '../../../../src/ol/events.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; -import _ol_reproj_Image_ from '../../../../src/ol/reproj/Image.js'; +import ReprojImage from '../../../../src/ol/reproj/Image.js'; describe('ol.reproj.Image', function() { function createImage(pixelRatio) { - return new _ol_reproj_Image_( + return new ReprojImage( getProjection('EPSG:3857'), getProjection('EPSG:4326'), [-180, -85, 180, 85], 10, pixelRatio, function(extent, resolution, pixelRatio) { From 2efdf7982c53512dc68610cadfb07ee86d1d21a8 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:28:20 -0700 Subject: [PATCH 09/35] Rename _ol_reproj_Tile_ to ReprojTile --- src/ol/reproj/Tile.js | 16 ++++++++-------- src/ol/source/TileImage.js | 4 ++-- test/rendering/ol/reproj/tile.test.js | 4 ++-- test/spec/ol/reproj/tile.test.js | 8 ++++---- test/spec/ol/source/tileimage.test.js | 10 +++++----- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/ol/reproj/Tile.js b/src/ol/reproj/Tile.js index 0875b9b30a..0fc1b89e24 100644 --- a/src/ol/reproj/Tile.js +++ b/src/ol/reproj/Tile.js @@ -32,7 +32,7 @@ import _ol_reproj_Triangulation_ from '../reproj/Triangulation.js'; * @param {number=} opt_errorThreshold Acceptable reprojection error (in px). * @param {boolean=} opt_renderEdges Render reprojection edges. */ -var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid, +var ReprojTile = function(sourceProj, sourceTileGrid, targetProj, targetTileGrid, tileCoord, wrappedTileCoord, pixelRatio, gutter, getTileFunction, opt_errorThreshold, opt_renderEdges) { @@ -187,13 +187,13 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid, } }; -inherits(_ol_reproj_Tile_, _ol_Tile_); +inherits(ReprojTile, _ol_Tile_); /** * @inheritDoc */ -_ol_reproj_Tile_.prototype.disposeInternal = function() { +ReprojTile.prototype.disposeInternal = function() { if (this.state == TileState.LOADING) { this.unlistenSources_(); } @@ -205,7 +205,7 @@ _ol_reproj_Tile_.prototype.disposeInternal = function() { * Get the HTML Canvas element for this tile. * @return {HTMLCanvasElement} Canvas. */ -_ol_reproj_Tile_.prototype.getImage = function() { +ReprojTile.prototype.getImage = function() { return this.canvas_; }; @@ -213,7 +213,7 @@ _ol_reproj_Tile_.prototype.getImage = function() { /** * @private */ -_ol_reproj_Tile_.prototype.reproject_ = function() { +ReprojTile.prototype.reproject_ = function() { var sources = []; this.sourceTiles_.forEach(function(tile, i, arr) { if (tile && tile.getState() == TileState.LOADED) { @@ -251,7 +251,7 @@ _ol_reproj_Tile_.prototype.reproject_ = function() { /** * @inheritDoc */ -_ol_reproj_Tile_.prototype.load = function() { +ReprojTile.prototype.load = function() { if (this.state == TileState.IDLE) { this.state = TileState.LOADING; this.changed(); @@ -300,8 +300,8 @@ _ol_reproj_Tile_.prototype.load = function() { /** * @private */ -_ol_reproj_Tile_.prototype.unlistenSources_ = function() { +ReprojTile.prototype.unlistenSources_ = function() { this.sourcesListenerKeys_.forEach(_ol_events_.unlistenByKey); this.sourcesListenerKeys_ = null; }; -export default _ol_reproj_Tile_; +export default ReprojTile; diff --git a/src/ol/source/TileImage.js b/src/ol/source/TileImage.js index 48756ce3a1..7c71e935a4 100644 --- a/src/ol/source/TileImage.js +++ b/src/ol/source/TileImage.js @@ -9,7 +9,7 @@ import TileState from '../TileState.js'; import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {equivalent, get as getProjection} from '../proj.js'; -import _ol_reproj_Tile_ from '../reproj/Tile.js'; +import ReprojTile from '../reproj/Tile.js'; import UrlTile from '../source/UrlTile.js'; import _ol_tilecoord_ from '../tilecoord.js'; import _ol_tilegrid_ from '../tilegrid.js'; @@ -254,7 +254,7 @@ TileImage.prototype.getTile = function(z, x, y, pixelRatio, projection) { var targetTileGrid = this.getTileGridForProjection(projection); var wrappedTileCoord = this.getTileCoordForTileUrlFunction(tileCoord, projection); - var newTile = new _ol_reproj_Tile_( + var newTile = new ReprojTile( sourceProjection, sourceTileGrid, projection, targetTileGrid, tileCoord, wrappedTileCoord, this.getTilePixelRatio(pixelRatio), diff --git a/test/rendering/ol/reproj/tile.test.js b/test/rendering/ol/reproj/tile.test.js index 4b27de01b0..7e71000b86 100644 --- a/test/rendering/ol/reproj/tile.test.js +++ b/test/rendering/ol/reproj/tile.test.js @@ -1,7 +1,7 @@ import TileState from '../../../../src/ol/TileState.js'; import _ol_events_ from '../../../../src/ol/events.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; -import _ol_reproj_Tile_ from '../../../../src/ol/reproj/Tile.js'; +import ReprojTile from '../../../../src/ol/reproj/Tile.js'; import XYZ from '../../../../src/ol/source/XYZ.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; import {register} from '../../../../src/ol/proj/proj4.js'; @@ -16,7 +16,7 @@ describe('ol.rendering.reproj.Tile', function() { var tilesRequested = 0; - var tile = new _ol_reproj_Tile_(sourceProjection, source.getTileGrid(), + var tile = new ReprojTile(sourceProjection, source.getTileGrid(), getProjection(targetProjection), targetTileGrid, [z, x, y], null, pixelRatio, sourceGutter, function(z, x, y, pixelRatio) { diff --git a/test/spec/ol/reproj/tile.test.js b/test/spec/ol/reproj/tile.test.js index d9220c9291..d11730af02 100644 --- a/test/spec/ol/reproj/tile.test.js +++ b/test/spec/ol/reproj/tile.test.js @@ -2,7 +2,7 @@ import ImageTile from '../../../../src/ol/ImageTile.js'; import _ol_events_ from '../../../../src/ol/events.js'; import {addCommon, clearAllProjections, get as getProjection} from '../../../../src/ol/proj.js'; import {register} from '../../../../src/ol/proj/proj4.js'; -import _ol_reproj_Tile_ from '../../../../src/ol/reproj/Tile.js'; +import ReprojTile from '../../../../src/ol/reproj/Tile.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -27,7 +27,7 @@ describe('ol.reproj.Tile', function() { function createTile(pixelRatio, opt_tileSize) { var proj4326 = getProjection('EPSG:4326'); var proj3857 = getProjection('EPSG:3857'); - return new _ol_reproj_Tile_( + return new ReprojTile( proj3857, _ol_tilegrid_.createForProjection(proj3857), proj4326, _ol_tilegrid_.createForProjection(proj4326, 3, opt_tileSize), [3, 2, -2], null, pixelRatio, 0, function(z, x, y, pixelRatio) { @@ -54,7 +54,7 @@ describe('ol.reproj.Tile', function() { it('is empty when outside target tile grid', function() { var proj4326 = getProjection('EPSG:4326'); var proj3857 = getProjection('EPSG:3857'); - var tile = new _ol_reproj_Tile_( + var tile = new ReprojTile( proj3857, _ol_tilegrid_.createForProjection(proj3857), proj4326, _ol_tilegrid_.createForProjection(proj4326), [0, -1, 0], null, 1, 0, function() { @@ -66,7 +66,7 @@ describe('ol.reproj.Tile', function() { it('is empty when outside source tile grid', function() { var proj4326 = getProjection('EPSG:4326'); var proj27700 = getProjection('EPSG:27700'); - var tile = new _ol_reproj_Tile_( + var tile = new ReprojTile( proj27700, _ol_tilegrid_.createForProjection(proj27700), proj4326, _ol_tilegrid_.createForProjection(proj4326), [3, 2, -2], null, 1, 0, function() { diff --git a/test/spec/ol/source/tileimage.test.js b/test/spec/ol/source/tileimage.test.js index f80b2dfad4..efd743dd79 100644 --- a/test/spec/ol/source/tileimage.test.js +++ b/test/spec/ol/source/tileimage.test.js @@ -6,7 +6,7 @@ import {addCommon, clearAllProjections, get as getProjection} from '../../../../ import {register} from '../../../../src/ol/proj/proj4.js'; import _ol_proj_EPSG3857_ from '../../../../src/ol/proj/EPSG3857.js'; import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; -import _ol_reproj_Tile_ from '../../../../src/ol/reproj/Tile.js'; +import ReprojTile from '../../../../src/ol/reproj/Tile.js'; import TileImage from '../../../../src/ol/source/TileImage.js'; import _ol_tilecoord_ from '../../../../src/ol/tilecoord.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -117,7 +117,7 @@ describe('ol.source.TileImage', function() { var source3857 = createSource('EPSG:3857'); var tile3857 = source3857.getTile(0, 0, -1, 1, getProjection('EPSG:3857')); expect(tile3857).to.be.a(ImageTile); - expect(tile3857).not.to.be.a(_ol_reproj_Tile_); + expect(tile3857).not.to.be.a(ReprojTile); var projXXX = new _ol_proj_Projection_({ code: 'XXX', @@ -126,7 +126,7 @@ describe('ol.source.TileImage', function() { var sourceXXX = createSource(projXXX); var tileXXX = sourceXXX.getTile(0, 0, -1, 1, projXXX); expect(tileXXX).to.be.a(ImageTile); - expect(tileXXX).not.to.be.a(_ol_reproj_Tile_); + expect(tileXXX).not.to.be.a(ReprojTile); }); beforeEach(function() { @@ -146,7 +146,7 @@ describe('ol.source.TileImage', function() { tileSize: [2, 2] })); var tile = source.getTile(0, 0, -1, 1, getProjection('EPSG:3857')); - expect(tile).to.be.a(_ol_reproj_Tile_); + expect(tile).to.be.a(ReprojTile); _ol_events_.listen(tile, 'change', function() { if (tile.getState() == 2) { // LOADED @@ -165,7 +165,7 @@ describe('ol.source.TileImage', function() { tileSize: [2, 2] })); var tile = source.getTile(0, 0, -1, 1, proj); - expect(tile).to.be.a(_ol_reproj_Tile_); + expect(tile).to.be.a(ReprojTile); _ol_events_.listen(tile, 'change', function() { if (tile.getState() == 2) { // LOADED From 1552f27a4379c35784413f5d2644b64dafea8a01 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:29:56 -0700 Subject: [PATCH 10/35] Rename _ol_Tile_ to Tile --- src/ol/ImageTile.js | 8 +++---- src/ol/Tile.js | 28 ++++++++++++------------ src/ol/VectorImageTile.js | 8 +++---- src/ol/VectorTile.js | 8 +++---- src/ol/reproj/Tile.js | 8 +++---- src/ol/source/TileDebug.js | 6 ++--- src/ol/source/TileUTFGrid.js | 6 ++--- test/spec/ol/control/attribution.test.js | 4 ++-- test/spec/ol/source/tile.test.js | 14 ++++++------ test/spec/ol/tile.test.js | 10 ++++----- test/spec/ol/tilecache.test.js | 16 +++++++------- test/spec/ol/tilequeue.test.js | 4 ++-- 12 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/ol/ImageTile.js b/src/ol/ImageTile.js index e50e38eb98..7767926f41 100644 --- a/src/ol/ImageTile.js +++ b/src/ol/ImageTile.js @@ -2,7 +2,7 @@ * @module ol/ImageTile */ import {inherits} from './index.js'; -import _ol_Tile_ from './Tile.js'; +import Tile from './Tile.js'; import TileState from './TileState.js'; import {createCanvasContext2D} from './dom.js'; import _ol_events_ from './events.js'; @@ -20,7 +20,7 @@ import EventType from './events/EventType.js'; */ var ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) { - _ol_Tile_.call(this, tileCoord, state, opt_options); + Tile.call(this, tileCoord, state, opt_options); /** * @private @@ -59,7 +59,7 @@ var ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction, o }; -inherits(ImageTile, _ol_Tile_); +inherits(ImageTile, Tile); /** @@ -75,7 +75,7 @@ ImageTile.prototype.disposeInternal = function() { } this.state = TileState.ABORT; this.changed(); - _ol_Tile_.prototype.disposeInternal.call(this); + Tile.prototype.disposeInternal.call(this); }; diff --git a/src/ol/Tile.js b/src/ol/Tile.js index 63430c4985..4497d29423 100644 --- a/src/ol/Tile.js +++ b/src/ol/Tile.js @@ -18,7 +18,7 @@ import EventType from './events/EventType.js'; * @param {ol.TileState} state State. * @param {olx.TileOptions=} opt_options Tile options. */ -var _ol_Tile_ = function(tileCoord, state, opt_options) { +var Tile = function(tileCoord, state, opt_options) { EventTarget.call(this); var options = opt_options ? opt_options : {}; @@ -66,13 +66,13 @@ var _ol_Tile_ = function(tileCoord, state, opt_options) { }; -inherits(_ol_Tile_, EventTarget); +inherits(Tile, EventTarget); /** * @protected */ -_ol_Tile_.prototype.changed = function() { +Tile.prototype.changed = function() { this.dispatchEvent(EventType.CHANGE); }; @@ -80,7 +80,7 @@ _ol_Tile_.prototype.changed = function() { /** * @return {string} Key. */ -_ol_Tile_.prototype.getKey = function() { +Tile.prototype.getKey = function() { return this.key + '/' + this.tileCoord; }; @@ -90,7 +90,7 @@ _ol_Tile_.prototype.getKey = function() { * such tile exists, the original tile is returned. * @return {!ol.Tile} Best tile for rendering. */ -_ol_Tile_.prototype.getInterimTile = function() { +Tile.prototype.getInterimTile = function() { if (!this.interimTile) { //empty chain return this; @@ -116,7 +116,7 @@ _ol_Tile_.prototype.getInterimTile = function() { * Goes through the chain of interim tiles and discards sections of the chain * that are no longer relevant. */ -_ol_Tile_.prototype.refreshInterimChain = function() { +Tile.prototype.refreshInterimChain = function() { if (!this.interimTile) { return; } @@ -151,7 +151,7 @@ _ol_Tile_.prototype.refreshInterimChain = function() { * @return {ol.TileCoord} The tile coordinate. * @api */ -_ol_Tile_.prototype.getTileCoord = function() { +Tile.prototype.getTileCoord = function() { return this.tileCoord; }; @@ -159,14 +159,14 @@ _ol_Tile_.prototype.getTileCoord = function() { /** * @return {ol.TileState} State. */ -_ol_Tile_.prototype.getState = function() { +Tile.prototype.getState = function() { return this.state; }; /** * @param {ol.TileState} state State. */ -_ol_Tile_.prototype.setState = function(state) { +Tile.prototype.setState = function(state) { this.state = state; this.changed(); }; @@ -178,7 +178,7 @@ _ol_Tile_.prototype.setState = function(state) { * @abstract * @api */ -_ol_Tile_.prototype.load = function() {}; +Tile.prototype.load = function() {}; /** * Get the alpha value for rendering. @@ -186,7 +186,7 @@ _ol_Tile_.prototype.load = function() {}; * @param {number} time The render frame time. * @return {number} A number between 0 and 1. */ -_ol_Tile_.prototype.getAlpha = function(id, time) { +Tile.prototype.getAlpha = function(id, time) { if (!this.transition_) { return 1; } @@ -213,7 +213,7 @@ _ol_Tile_.prototype.getAlpha = function(id, time) { * @param {number} id An id for the renderer. * @return {boolean} The tile is in transition. */ -_ol_Tile_.prototype.inTransition = function(id) { +Tile.prototype.inTransition = function(id) { if (!this.transition_) { return false; } @@ -224,9 +224,9 @@ _ol_Tile_.prototype.inTransition = function(id) { * Mark a transition as complete. * @param {number} id An id for the renderer. */ -_ol_Tile_.prototype.endTransition = function(id) { +Tile.prototype.endTransition = function(id) { if (this.transition_) { this.transitionStarts_[id] = -1; } }; -export default _ol_Tile_; +export default Tile; diff --git a/src/ol/VectorImageTile.js b/src/ol/VectorImageTile.js index 0118537438..6dcb4576ad 100644 --- a/src/ol/VectorImageTile.js +++ b/src/ol/VectorImageTile.js @@ -2,7 +2,7 @@ * @module ol/VectorImageTile */ import {getUid, inherits} from './index.js'; -import _ol_Tile_ from './Tile.js'; +import Tile from './Tile.js'; import TileState from './TileState.js'; import {createCanvasContext2D} from './dom.js'; import _ol_events_ from './events.js'; @@ -36,7 +36,7 @@ var VectorImageTile = function(tileCoord, state, sourceRevision, format, tileLoadFunction, urlTileCoord, tileUrlFunction, sourceTileGrid, tileGrid, sourceTiles, pixelRatio, projection, tileClass, handleTileChange, opt_options) { - _ol_Tile_.call(this, tileCoord, state, opt_options); + Tile.call(this, tileCoord, state, opt_options); /** * @private @@ -121,7 +121,7 @@ var VectorImageTile = function(tileCoord, state, sourceRevision, format, }; -inherits(VectorImageTile, _ol_Tile_); +inherits(VectorImageTile, Tile); /** @@ -149,7 +149,7 @@ VectorImageTile.prototype.disposeInternal = function() { this.loadListenerKeys_.length = 0; this.sourceTileListenerKeys_.forEach(_ol_events_.unlistenByKey); this.sourceTileListenerKeys_.length = 0; - _ol_Tile_.prototype.disposeInternal.call(this); + Tile.prototype.disposeInternal.call(this); }; diff --git a/src/ol/VectorTile.js b/src/ol/VectorTile.js index 90e048c389..c5830c6231 100644 --- a/src/ol/VectorTile.js +++ b/src/ol/VectorTile.js @@ -2,7 +2,7 @@ * @module ol/VectorTile */ import {getUid, inherits} from './index.js'; -import _ol_Tile_ from './Tile.js'; +import Tile from './Tile.js'; import TileState from './TileState.js'; /** @@ -17,7 +17,7 @@ import TileState from './TileState.js'; */ var VectorTile = function(tileCoord, state, src, format, tileLoadFunction, opt_options) { - _ol_Tile_.call(this, tileCoord, state, opt_options); + Tile.call(this, tileCoord, state, opt_options); /** * @type {number} @@ -75,7 +75,7 @@ var VectorTile = function(tileCoord, state, src, format, tileLoadFunction, opt_o }; -inherits(VectorTile, _ol_Tile_); +inherits(VectorTile, Tile); /** * @const @@ -92,7 +92,7 @@ VectorTile.prototype.disposeInternal = function() { this.replayGroups_ = {}; this.state = TileState.ABORT; this.changed(); - _ol_Tile_.prototype.disposeInternal.call(this); + Tile.prototype.disposeInternal.call(this); }; diff --git a/src/ol/reproj/Tile.js b/src/ol/reproj/Tile.js index 0fc1b89e24..ef0b9d5beb 100644 --- a/src/ol/reproj/Tile.js +++ b/src/ol/reproj/Tile.js @@ -3,7 +3,7 @@ */ import {ERROR_THRESHOLD} from './common.js'; import {inherits} from '../index.js'; -import _ol_Tile_ from '../Tile.js'; +import Tile from '../Tile.js'; import TileState from '../TileState.js'; import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; @@ -36,7 +36,7 @@ var ReprojTile = function(sourceProj, sourceTileGrid, targetProj, targetTileGrid, tileCoord, wrappedTileCoord, pixelRatio, gutter, getTileFunction, opt_errorThreshold, opt_renderEdges) { - _ol_Tile_.call(this, tileCoord, TileState.IDLE); + Tile.call(this, tileCoord, TileState.IDLE); /** * @private @@ -187,7 +187,7 @@ var ReprojTile = function(sourceProj, sourceTileGrid, } }; -inherits(ReprojTile, _ol_Tile_); +inherits(ReprojTile, Tile); /** @@ -197,7 +197,7 @@ ReprojTile.prototype.disposeInternal = function() { if (this.state == TileState.LOADING) { this.unlistenSources_(); } - _ol_Tile_.prototype.disposeInternal.call(this); + Tile.prototype.disposeInternal.call(this); }; diff --git a/src/ol/source/TileDebug.js b/src/ol/source/TileDebug.js index e54627e3b3..4bbc08aff4 100644 --- a/src/ol/source/TileDebug.js +++ b/src/ol/source/TileDebug.js @@ -2,7 +2,7 @@ * @module ol/source/TileDebug */ import {inherits} from '../index.js'; -import _ol_Tile_ from '../Tile.js'; +import Tile from '../Tile.js'; import TileState from '../TileState.js'; import {createCanvasContext2D} from '../dom.js'; import _ol_size_ from '../size.js'; @@ -66,7 +66,7 @@ TileDebug.prototype.getTile = function(z, x, y) { */ TileDebug.Tile_ = function(tileCoord, tileSize, text) { - _ol_Tile_.call(this, tileCoord, TileState.LOADED); + Tile.call(this, tileCoord, TileState.LOADED); /** * @private @@ -87,7 +87,7 @@ TileDebug.Tile_ = function(tileCoord, tileSize, text) { this.canvas_ = null; }; -inherits(TileDebug.Tile_, _ol_Tile_); +inherits(TileDebug.Tile_, Tile); /** diff --git a/src/ol/source/TileUTFGrid.js b/src/ol/source/TileUTFGrid.js index fd44237902..afe7effc42 100644 --- a/src/ol/source/TileUTFGrid.js +++ b/src/ol/source/TileUTFGrid.js @@ -2,7 +2,7 @@ * @module ol/source/TileUTFGrid */ import {inherits} from '../index.js'; -import _ol_Tile_ from '../Tile.js'; +import Tile from '../Tile.js'; import TileState from '../TileState.js'; import {createFromTemplates, nullTileUrlFunction} from '../tileurlfunction.js'; import {assert} from '../asserts.js'; @@ -259,7 +259,7 @@ UTFGrid.prototype.useTile = function(z, x, y) { */ UTFGrid.Tile_ = function(tileCoord, state, src, extent, preemptive, jsonp) { - _ol_Tile_.call(this, tileCoord, state); + Tile.call(this, tileCoord, state); /** * @private @@ -305,7 +305,7 @@ UTFGrid.Tile_ = function(tileCoord, state, src, extent, preemptive, jsonp) { this.jsonp_ = jsonp; }; -inherits(UTFGrid.Tile_, _ol_Tile_); +inherits(UTFGrid.Tile_, Tile); /** diff --git a/test/spec/ol/control/attribution.test.js b/test/spec/ol/control/attribution.test.js index 3a54a14a76..6f7cf3f035 100644 --- a/test/spec/ol/control/attribution.test.js +++ b/test/spec/ol/control/attribution.test.js @@ -1,5 +1,5 @@ import Map from '../../../../src/ol/Map.js'; -import _ol_Tile_ from '../../../../src/ol/Tile.js'; +import Tile from '../../../../src/ol/Tile.js'; import View from '../../../../src/ol/View.js'; import Attribution from '../../../../src/ol/control/Attribution.js'; import TileLayer from '../../../../src/ol/layer/Tile.js'; @@ -50,7 +50,7 @@ describe('ol.control.Attribution', function() { map.getLayers().forEach(function(layer) { var source = layer.getSource(); source.getTile = function() { - var tile = new _ol_Tile_([0, 0, -1], 2 /* LOADED */); + var tile = new Tile([0, 0, -1], 2 /* LOADED */); tile.getImage = function() { var image = new Image(); image.width = 256; diff --git a/test/spec/ol/source/tile.test.js b/test/spec/ol/source/tile.test.js index 550869286e..79375e1bcf 100644 --- a/test/spec/ol/source/tile.test.js +++ b/test/spec/ol/source/tile.test.js @@ -1,5 +1,5 @@ import {inherits} from '../../../../src/ol/index.js'; -import _ol_Tile_ from '../../../../src/ol/Tile.js'; +import Tile from '../../../../src/ol/Tile.js'; import TileRange from '../../../../src/ol/TileRange.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; @@ -31,7 +31,7 @@ var MockTile = function(tileStates) { }); for (var key in tileStates) { - this.tileCache.set(key, new _ol_Tile_(key.split('/'), tileStates[key])); + this.tileCache.set(key, new Tile(key.split('/'), tileStates[key])); } }; @@ -46,7 +46,7 @@ MockTile.prototype.getTile = function(z, x, y) { if (this.tileCache.containsKey(key)) { return /** @type {!ol.Tile} */ (this.tileCache.get(key)); } else { - var tile = new _ol_Tile_(key, 0); // IDLE + var tile = new Tile(key, 0); // IDLE this.tileCache.set(key, tile); return tile; } @@ -279,7 +279,7 @@ describe('ol.source.Tile', function() { }); // check the loaded tile is there var tile = source.getTile(1, 0, 0); - expect(tile).to.be.a(_ol_Tile_); + expect(tile).to.be.a(Tile); // check tile cache is filled expect(source.tileCache.getCount()).to.eql(1); // refresh the source @@ -312,17 +312,17 @@ describe('MockTile', function() { // check a loaded tile tile = source.getTile(0, 0, 0); - expect(tile).to.be.a(_ol_Tile_); + expect(tile).to.be.a(Tile); expect(tile.state).to.be(2); // LOADED // check a tile that is not loaded tile = source.getTile(1, 0, -1); - expect(tile).to.be.a(_ol_Tile_); + expect(tile).to.be.a(Tile); expect(tile.state).to.be(0); // IDLE // check another loaded tile tile = source.getTile(1, 0, 0); - expect(tile).to.be.a(_ol_Tile_); + expect(tile).to.be.a(Tile); expect(tile.state).to.be(2); // LOADED }); diff --git a/test/spec/ol/tile.test.js b/test/spec/ol/tile.test.js index e0da139632..4bd22a4a26 100644 --- a/test/spec/ol/tile.test.js +++ b/test/spec/ol/tile.test.js @@ -1,6 +1,6 @@ import {getUid} from '../../../src/ol/index.js'; import ImageTile from '../../../src/ol/ImageTile.js'; -import _ol_Tile_ from '../../../src/ol/Tile.js'; +import Tile from '../../../src/ol/Tile.js'; import TileState from '../../../src/ol/TileState.js'; @@ -8,14 +8,14 @@ describe('ol.Tile', function() { describe('constructor', function() { it('sets a default transition', function() { var coord = [0, 0, 0]; - var tile = new _ol_Tile_(coord, TileState.IDLE); + var tile = new Tile(coord, TileState.IDLE); expect(tile.transition_).to.equal(250); }); it('allows the transition to be set', function() { var coord = [0, 0, 0]; var transition = 500; - var tile = new _ol_Tile_(coord, TileState.IDLE, {transition: transition}); + var tile = new Tile(coord, TileState.IDLE, {transition: transition}); expect(tile.transition_).to.equal(transition); }); }); @@ -23,7 +23,7 @@ describe('ol.Tile', function() { describe('#getAlpha()', function() { it('returns the alpha value for a tile in transition', function() { var coord = [0, 0, 0]; - var tile = new _ol_Tile_(coord, TileState.IDLE); + var tile = new Tile(coord, TileState.IDLE); var id = 'test'; var time = Date.now(); @@ -45,7 +45,7 @@ describe('ol.Tile', function() { describe('#inTransition()', function() { it('determines if the tile is in transition', function() { var coord = [0, 0, 0]; - var tile = new _ol_Tile_(coord, TileState.IDLE); + var tile = new Tile(coord, TileState.IDLE); var id = 'test'; expect(tile.inTransition(id)).to.be(true); diff --git a/test/spec/ol/tilecache.test.js b/test/spec/ol/tilecache.test.js index 1089327b8e..8ef6b36cb4 100644 --- a/test/spec/ol/tilecache.test.js +++ b/test/spec/ol/tilecache.test.js @@ -1,4 +1,4 @@ -import _ol_Tile_ from '../../../src/ol/Tile.js'; +import Tile from '../../../src/ol/Tile.js'; import TileCache from '../../../src/ol/TileCache.js'; import _ol_tilecoord_ from '../../../src/ol/tilecoord.js'; @@ -8,13 +8,13 @@ describe('ol.TileCache', function() { describe('#pruneExceptNewestZ()', function() { it('gets rid of all entries that are not at the newest z', function() { var tiles = [ - new _ol_Tile_([0, 0, 0]), - new _ol_Tile_([1, 0, 0]), - new _ol_Tile_([1, 1, 0]), - new _ol_Tile_([2, 0, 0]), - new _ol_Tile_([2, 1, 0]), - new _ol_Tile_([2, 2, 0]), - new _ol_Tile_([2, 3, 0]) // newest tile at z: 2 + new Tile([0, 0, 0]), + new Tile([1, 0, 0]), + new Tile([1, 1, 0]), + new Tile([2, 0, 0]), + new Tile([2, 1, 0]), + new Tile([2, 2, 0]), + new Tile([2, 3, 0]) // newest tile at z: 2 ]; var cache = new TileCache(); diff --git a/test/spec/ol/tilequeue.test.js b/test/spec/ol/tilequeue.test.js index 9de2401f78..b99e938a49 100644 --- a/test/spec/ol/tilequeue.test.js +++ b/test/spec/ol/tilequeue.test.js @@ -1,5 +1,5 @@ import ImageTile from '../../../src/ol/ImageTile.js'; -import _ol_Tile_ from '../../../src/ol/Tile.js'; +import Tile from '../../../src/ol/Tile.js'; import TileQueue from '../../../src/ol/TileQueue.js'; import TileState from '../../../src/ol/TileState.js'; import ImageSource from '../../../src/ol/source/Image.js'; @@ -11,7 +11,7 @@ describe('ol.TileQueue', function() { function addRandomPriorityTiles(tq, num) { var i, tile, priority; for (i = 0; i < num; i++) { - tile = new _ol_Tile_(); + tile = new Tile(); priority = Math.floor(Math.random() * 100); tq.elements_.push([tile, '', [0, 0]]); tq.priorities_.push(priority); From 84e93efe5c2d590dcc703cffafd560266d5c68f8 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:31:07 -0700 Subject: [PATCH 11/35] Rename _ol_reproj_Triangulation_ to Triangulation --- src/ol/reproj/Image.js | 4 ++-- src/ol/reproj/Tile.js | 4 ++-- src/ol/reproj/Triangulation.js | 12 ++++++------ test/spec/ol/reproj/triangulation.test.js | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/ol/reproj/Image.js b/src/ol/reproj/Image.js index e0ffc4265c..69f418fd0d 100644 --- a/src/ol/reproj/Image.js +++ b/src/ol/reproj/Image.js @@ -9,7 +9,7 @@ import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {getCenter, getIntersection, getHeight, getWidth} from '../extent.js'; import _ol_reproj_ from '../reproj.js'; -import _ol_reproj_Triangulation_ from '../reproj/Triangulation.js'; +import Triangulation from '../reproj/Triangulation.js'; /** * @classdesc @@ -55,7 +55,7 @@ var ReprojImage = function(sourceProj, targetProj, * @private * @type {!ol.reproj.Triangulation} */ - this.triangulation_ = new _ol_reproj_Triangulation_( + this.triangulation_ = new Triangulation( sourceProj, targetProj, limitedTargetExtent, this.maxSourceExtent_, sourceResolution * errorThresholdInPixels); diff --git a/src/ol/reproj/Tile.js b/src/ol/reproj/Tile.js index ef0b9d5beb..7567c0388b 100644 --- a/src/ol/reproj/Tile.js +++ b/src/ol/reproj/Tile.js @@ -10,7 +10,7 @@ import EventType from '../events/EventType.js'; import {getArea, getCenter, getIntersection} from '../extent.js'; import {clamp} from '../math.js'; import _ol_reproj_ from '../reproj.js'; -import _ol_reproj_Triangulation_ from '../reproj/Triangulation.js'; +import Triangulation from '../reproj/Triangulation.js'; /** * @classdesc @@ -142,7 +142,7 @@ var ReprojTile = function(sourceProj, sourceTileGrid, * @private * @type {!ol.reproj.Triangulation} */ - this.triangulation_ = new _ol_reproj_Triangulation_( + this.triangulation_ = new Triangulation( sourceProj, targetProj, limitedTargetExtent, maxSourceExtent, sourceResolution * errorThresholdInPixels); diff --git a/src/ol/reproj/Triangulation.js b/src/ol/reproj/Triangulation.js index 6d552e9f2a..1635d872e0 100644 --- a/src/ol/reproj/Triangulation.js +++ b/src/ol/reproj/Triangulation.js @@ -41,7 +41,7 @@ var MAX_TRIANGLE_WIDTH = 0.25; * @param {number} errorThreshold Acceptable error (in source units). * @constructor */ -var _ol_reproj_Triangulation_ = function(sourceProj, targetProj, targetExtent, +var Triangulation = function(sourceProj, targetProj, targetExtent, maxSourceExtent, errorThreshold) { /** @@ -189,7 +189,7 @@ var _ol_reproj_Triangulation_ = function(sourceProj, targetProj, targetExtent, * @param {ol.Coordinate} cSrc The source c coordinate. * @private */ -_ol_reproj_Triangulation_.prototype.addTriangle_ = function(a, b, c, +Triangulation.prototype.addTriangle_ = function(a, b, c, aSrc, bSrc, cSrc) { this.triangles_.push({ source: [aSrc, bSrc, cSrc], @@ -214,7 +214,7 @@ _ol_reproj_Triangulation_.prototype.addTriangle_ = function(a, b, c, * @param {number} maxSubdivision Maximal allowed subdivision of the quad. * @private */ -_ol_reproj_Triangulation_.prototype.addQuad_ = function(a, b, c, d, +Triangulation.prototype.addQuad_ = function(a, b, c, d, aSrc, bSrc, cSrc, dSrc, maxSubdivision) { var sourceQuadExtent = boundingExtent([aSrc, bSrc, cSrc, dSrc]); @@ -326,7 +326,7 @@ _ol_reproj_Triangulation_.prototype.addQuad_ = function(a, b, c, d, * * @return {ol.Extent} Calculated extent. */ -_ol_reproj_Triangulation_.prototype.calculateSourceExtent = function() { +Triangulation.prototype.calculateSourceExtent = function() { var extent = createEmpty(); this.triangles_.forEach(function(triangle, i, arr) { @@ -343,7 +343,7 @@ _ol_reproj_Triangulation_.prototype.calculateSourceExtent = function() { /** * @return {Array.} Array of the calculated triangles. */ -_ol_reproj_Triangulation_.prototype.getTriangles = function() { +Triangulation.prototype.getTriangles = function() { return this.triangles_; }; -export default _ol_reproj_Triangulation_; +export default Triangulation; diff --git a/test/spec/ol/reproj/triangulation.test.js b/test/spec/ol/reproj/triangulation.test.js index 839b970865..d93524e482 100644 --- a/test/spec/ol/reproj/triangulation.test.js +++ b/test/spec/ol/reproj/triangulation.test.js @@ -1,6 +1,6 @@ import {addCommon, clearAllProjections, get as getProjection} from '../../../../src/ol/proj.js'; import {register} from '../../../../src/ol/proj/proj4.js'; -import _ol_reproj_Triangulation_ from '../../../../src/ol/reproj/Triangulation.js'; +import Triangulation from '../../../../src/ol/reproj/Triangulation.js'; describe('ol.reproj.Triangulation', function() { @@ -23,7 +23,7 @@ describe('ol.reproj.Triangulation', function() { describe('constructor', function() { it('is trivial for identity', function() { var proj4326 = getProjection('EPSG:4326'); - var triangulation = new _ol_reproj_Triangulation_(proj4326, proj4326, + var triangulation = new Triangulation(proj4326, proj4326, [20, 20, 30, 30], [-180, -90, 180, 90], 0); expect(triangulation.getTriangles().length).to.be(2); }); @@ -31,14 +31,14 @@ describe('ol.reproj.Triangulation', function() { it('is empty when outside source extent', function() { var proj4326 = getProjection('EPSG:4326'); var proj27700 = getProjection('EPSG:27700'); - var triangulation = new _ol_reproj_Triangulation_(proj27700, proj4326, + var triangulation = new Triangulation(proj27700, proj4326, [0, 0, 10, 10], proj27700.getExtent(), 0); expect(triangulation.getTriangles().length).to.be(0); }); it('can handle null source extent', function() { var proj4326 = getProjection('EPSG:4326'); - var triangulation = new _ol_reproj_Triangulation_(proj4326, proj4326, + var triangulation = new Triangulation(proj4326, proj4326, [20, 20, 30, 30], null, 0); expect(triangulation.getTriangles().length).to.be(2); }); From 176021e1884032e7f5dd5c6feafd495d5f00692b Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:32:24 -0700 Subject: [PATCH 12/35] Rename _ol_Collection_ to Collection --- src/ol/Collection.js | 46 ++++++++++---------- src/ol/PluggableMap.js | 20 ++++----- src/ol/control.js | 4 +- src/ol/control/OverviewMap.js | 6 +-- src/ol/interaction.js | 4 +- src/ol/interaction/Modify.js | 4 +- src/ol/interaction/Snap.js | 6 +-- src/ol/interaction/Translate.js | 8 ++-- src/ol/layer/Group.js | 8 ++-- src/ol/source/Vector.js | 6 +-- test/spec/ol/collection.test.js | 50 +++++++++++----------- test/spec/ol/interaction/modify.test.js | 30 ++++++------- test/spec/ol/interaction/select.test.js | 4 +- test/spec/ol/interaction/snap.test.js | 16 +++---- test/spec/ol/interaction/translate.test.js | 4 +- test/spec/ol/layer/group.test.js | 12 +++--- test/spec/ol/source/vector.test.js | 6 +-- 17 files changed, 117 insertions(+), 117 deletions(-) diff --git a/src/ol/Collection.js b/src/ol/Collection.js index fb1423da1c..c39d984504 100644 --- a/src/ol/Collection.js +++ b/src/ol/Collection.js @@ -41,7 +41,7 @@ export var CollectionOptions; * @template T * @api */ -var _ol_Collection_ = function(opt_array, opt_options) { +var Collection = function(opt_array, opt_options) { BaseObject.call(this); @@ -69,14 +69,14 @@ var _ol_Collection_ = function(opt_array, opt_options) { }; -inherits(_ol_Collection_, BaseObject); +inherits(Collection, BaseObject); /** * Remove all elements from the collection. * @api */ -_ol_Collection_.prototype.clear = function() { +Collection.prototype.clear = function() { while (this.getLength() > 0) { this.pop(); } @@ -90,7 +90,7 @@ _ol_Collection_.prototype.clear = function() { * @return {ol.Collection.} This collection. * @api */ -_ol_Collection_.prototype.extend = function(arr) { +Collection.prototype.extend = function(arr) { var i, ii; for (i = 0, ii = arr.length; i < ii; ++i) { this.push(arr[i]); @@ -106,7 +106,7 @@ _ol_Collection_.prototype.extend = function(arr) { * index and the array). The return value is ignored. * @api */ -_ol_Collection_.prototype.forEach = function(f) { +Collection.prototype.forEach = function(f) { var array = this.array_; for (var i = 0, ii = array.length; i < ii; ++i) { f(array[i], i, array); @@ -122,7 +122,7 @@ _ol_Collection_.prototype.forEach = function(f) { * @return {!Array.} Array. * @api */ -_ol_Collection_.prototype.getArray = function() { +Collection.prototype.getArray = function() { return this.array_; }; @@ -133,7 +133,7 @@ _ol_Collection_.prototype.getArray = function() { * @return {T} Element. * @api */ -_ol_Collection_.prototype.item = function(index) { +Collection.prototype.item = function(index) { return this.array_[index]; }; @@ -144,7 +144,7 @@ _ol_Collection_.prototype.item = function(index) { * @observable * @api */ -_ol_Collection_.prototype.getLength = function() { +Collection.prototype.getLength = function() { return (/** @type {number} */ this.get(Property.LENGTH)); }; @@ -155,14 +155,14 @@ _ol_Collection_.prototype.getLength = function() { * @param {T} elem Element. * @api */ -_ol_Collection_.prototype.insertAt = function(index, elem) { +Collection.prototype.insertAt = function(index, elem) { if (this.unique_) { this.assertUnique_(elem); } this.array_.splice(index, 0, elem); this.updateLength_(); this.dispatchEvent( - new _ol_Collection_.Event(CollectionEventType.ADD, elem)); + new Collection.Event(CollectionEventType.ADD, elem)); }; @@ -172,7 +172,7 @@ _ol_Collection_.prototype.insertAt = function(index, elem) { * @return {T|undefined} Element. * @api */ -_ol_Collection_.prototype.pop = function() { +Collection.prototype.pop = function() { return this.removeAt(this.getLength() - 1); }; @@ -183,7 +183,7 @@ _ol_Collection_.prototype.pop = function() { * @return {number} New length of the collection. * @api */ -_ol_Collection_.prototype.push = function(elem) { +Collection.prototype.push = function(elem) { if (this.unique_) { this.assertUnique_(elem); } @@ -199,7 +199,7 @@ _ol_Collection_.prototype.push = function(elem) { * @return {T|undefined} The removed element or undefined if none found. * @api */ -_ol_Collection_.prototype.remove = function(elem) { +Collection.prototype.remove = function(elem) { var arr = this.array_; var i, ii; for (i = 0, ii = arr.length; i < ii; ++i) { @@ -218,12 +218,12 @@ _ol_Collection_.prototype.remove = function(elem) { * @return {T|undefined} Value. * @api */ -_ol_Collection_.prototype.removeAt = function(index) { +Collection.prototype.removeAt = function(index) { var prev = this.array_[index]; this.array_.splice(index, 1); this.updateLength_(); this.dispatchEvent( - new _ol_Collection_.Event(CollectionEventType.REMOVE, prev)); + new Collection.Event(CollectionEventType.REMOVE, prev)); return prev; }; @@ -234,7 +234,7 @@ _ol_Collection_.prototype.removeAt = function(index) { * @param {T} elem Element. * @api */ -_ol_Collection_.prototype.setAt = function(index, elem) { +Collection.prototype.setAt = function(index, elem) { var n = this.getLength(); if (index < n) { if (this.unique_) { @@ -243,9 +243,9 @@ _ol_Collection_.prototype.setAt = function(index, elem) { var prev = this.array_[index]; this.array_[index] = elem; this.dispatchEvent( - new _ol_Collection_.Event(CollectionEventType.REMOVE, prev)); + new Collection.Event(CollectionEventType.REMOVE, prev)); this.dispatchEvent( - new _ol_Collection_.Event(CollectionEventType.ADD, elem)); + new Collection.Event(CollectionEventType.ADD, elem)); } else { var j; for (j = n; j < index; ++j) { @@ -259,7 +259,7 @@ _ol_Collection_.prototype.setAt = function(index, elem) { /** * @private */ -_ol_Collection_.prototype.updateLength_ = function() { +Collection.prototype.updateLength_ = function() { this.set(Property.LENGTH, this.array_.length); }; @@ -269,7 +269,7 @@ _ol_Collection_.prototype.updateLength_ = function() { * @param {T} elem Element. * @param {number=} opt_except Optional index to ignore. */ -_ol_Collection_.prototype.assertUnique_ = function(elem, opt_except) { +Collection.prototype.assertUnique_ = function(elem, opt_except) { for (var i = 0, ii = this.array_.length; i < ii; ++i) { if (this.array_[i] === elem && i !== opt_except) { throw new AssertionError(58); @@ -288,7 +288,7 @@ _ol_Collection_.prototype.assertUnique_ = function(elem, opt_except) { * @param {ol.CollectionEventType} type Type. * @param {*=} opt_element Element. */ -_ol_Collection_.Event = function(type, opt_element) { +Collection.Event = function(type, opt_element) { Event.call(this, type); @@ -300,6 +300,6 @@ _ol_Collection_.Event = function(type, opt_element) { this.element = opt_element; }; -inherits(_ol_Collection_.Event, Event); +inherits(Collection.Event, Event); -export default _ol_Collection_; +export default Collection; diff --git a/src/ol/PluggableMap.js b/src/ol/PluggableMap.js index 70e72796ca..e0c76532ee 100644 --- a/src/ol/PluggableMap.js +++ b/src/ol/PluggableMap.js @@ -2,7 +2,7 @@ * @module ol/PluggableMap */ import {getUid, inherits} from './index.js'; -import _ol_Collection_ from './Collection.js'; +import Collection from './Collection.js'; import CollectionEventType from './CollectionEventType.js'; import MapBrowserEvent from './MapBrowserEvent.js'; import MapBrowserEventHandler from './MapBrowserEventHandler.js'; @@ -276,13 +276,13 @@ var PluggableMap = function(options) { * @type {ol.Collection.} * @protected */ - this.controls = optionsInternal.controls || new _ol_Collection_(); + this.controls = optionsInternal.controls || new Collection(); /** * @type {ol.Collection.} * @protected */ - this.interactions = optionsInternal.interactions || new _ol_Collection_(); + this.interactions = optionsInternal.interactions || new Collection(); /** * @type {ol.Collection.} @@ -1457,9 +1457,9 @@ function createOptionsInternal(options) { var controls; if (options.controls !== undefined) { if (Array.isArray(options.controls)) { - controls = new _ol_Collection_(options.controls.slice()); + controls = new Collection(options.controls.slice()); } else { - assert(options.controls instanceof _ol_Collection_, + assert(options.controls instanceof Collection, 47); // Expected `controls` to be an array or an `ol.Collection` controls = options.controls; } @@ -1468,9 +1468,9 @@ function createOptionsInternal(options) { var interactions; if (options.interactions !== undefined) { if (Array.isArray(options.interactions)) { - interactions = new _ol_Collection_(options.interactions.slice()); + interactions = new Collection(options.interactions.slice()); } else { - assert(options.interactions instanceof _ol_Collection_, + assert(options.interactions instanceof Collection, 48); // Expected `interactions` to be an array or an `ol.Collection` interactions = options.interactions; } @@ -1479,14 +1479,14 @@ function createOptionsInternal(options) { var overlays; if (options.overlays !== undefined) { if (Array.isArray(options.overlays)) { - overlays = new _ol_Collection_(options.overlays.slice()); + overlays = new Collection(options.overlays.slice()); } else { - assert(options.overlays instanceof _ol_Collection_, + assert(options.overlays instanceof Collection, 49); // Expected `overlays` to be an array or an `ol.Collection` overlays = options.overlays; } } else { - overlays = new _ol_Collection_(); + overlays = new Collection(); } return { diff --git a/src/ol/control.js b/src/ol/control.js index 7184291adc..a0875894fd 100644 --- a/src/ol/control.js +++ b/src/ol/control.js @@ -1,7 +1,7 @@ /** * @module ol/control */ -import _ol_Collection_ from './Collection.js'; +import Collection from './Collection.js'; import Attribution from './control/Attribution.js'; import Rotate from './control/Rotate.js'; import Zoom from './control/Zoom.js'; @@ -23,7 +23,7 @@ export function defaults(opt_options) { var options = opt_options ? opt_options : {}; - var controls = new _ol_Collection_(); + var controls = new Collection(); var zoomControl = options.zoom !== undefined ? options.zoom : true; if (zoomControl) { diff --git a/src/ol/control/OverviewMap.js b/src/ol/control/OverviewMap.js index 74a562d114..dd8d4a441c 100644 --- a/src/ol/control/OverviewMap.js +++ b/src/ol/control/OverviewMap.js @@ -2,7 +2,7 @@ * @module ol/control/OverviewMap */ import {inherits} from '../index.js'; -import _ol_Collection_ from '../Collection.js'; +import Collection from '../Collection.js'; import PluggableMap from '../PluggableMap.js'; import MapEventType from '../MapEventType.js'; import MapProperty from '../MapProperty.js'; @@ -116,8 +116,8 @@ var OverviewMap = function(opt_options) { * @private */ this.ovmap_ = new PluggableMap({ - controls: new _ol_Collection_(), - interactions: new _ol_Collection_(), + controls: new Collection(), + interactions: new Collection(), view: options.view }); var ovmap = this.ovmap_; diff --git a/src/ol/interaction.js b/src/ol/interaction.js index c8c135db32..6ecd3982b2 100644 --- a/src/ol/interaction.js +++ b/src/ol/interaction.js @@ -1,7 +1,7 @@ /** * @module ol/interaction */ -import _ol_Collection_ from './Collection.js'; +import Collection from './Collection.js'; import Kinetic from './Kinetic.js'; import DoubleClickZoom from './interaction/DoubleClickZoom.js'; import DragPan from './interaction/DragPan.js'; @@ -41,7 +41,7 @@ export function defaults(opt_options) { var options = opt_options ? opt_options : {}; - var interactions = new _ol_Collection_(); + var interactions = new Collection(); var kinetic = new Kinetic(-0.005, 0.05, 100); diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index e5c362d59d..821d64e8c2 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -2,7 +2,7 @@ * @module ol/interaction/Modify */ import {getUid, inherits} from '../index.js'; -import _ol_Collection_ from '../Collection.js'; +import Collection from '../Collection.js'; import CollectionEventType from '../CollectionEventType.js'; import Feature from '../Feature.js'; import MapBrowserEventType from '../MapBrowserEventType.js'; @@ -195,7 +195,7 @@ var _ol_interaction_Modify_ = function(options) { var features; if (options.source) { this.source_ = options.source; - features = new _ol_Collection_(this.source_.getFeatures()); + features = new Collection(this.source_.getFeatures()); _ol_events_.listen(this.source_, VectorEventType.ADDFEATURE, this.handleSourceAdd_, this); _ol_events_.listen(this.source_, VectorEventType.REMOVEFEATURE, diff --git a/src/ol/interaction/Snap.js b/src/ol/interaction/Snap.js index 2556f32ed8..8bcbb93177 100644 --- a/src/ol/interaction/Snap.js +++ b/src/ol/interaction/Snap.js @@ -2,7 +2,7 @@ * @module ol/interaction/Snap */ import {getUid, inherits} from '../index.js'; -import _ol_Collection_ from '../Collection.js'; +import Collection from '../Collection.js'; import CollectionEventType from '../CollectionEventType.js'; import _ol_coordinate_ from '../coordinate.js'; import _ol_events_ from '../events.js'; @@ -221,7 +221,7 @@ _ol_interaction_Snap_.prototype.handleFeatureAdd_ = function(evt) { var feature; if (evt instanceof VectorSource.Event) { feature = evt.feature; - } else if (evt instanceof _ol_Collection_.Event) { + } else if (evt instanceof Collection.Event) { feature = evt.element; } this.addFeature(/** @type {ol.Feature} */ (feature)); @@ -236,7 +236,7 @@ _ol_interaction_Snap_.prototype.handleFeatureRemove_ = function(evt) { var feature; if (evt instanceof VectorSource.Event) { feature = evt.feature; - } else if (evt instanceof _ol_Collection_.Event) { + } else if (evt instanceof Collection.Event) { feature = evt.element; } this.removeFeature(/** @type {ol.Feature} */ (feature)); diff --git a/src/ol/interaction/Translate.js b/src/ol/interaction/Translate.js index 146c256abc..58d2ff34e6 100644 --- a/src/ol/interaction/Translate.js +++ b/src/ol/interaction/Translate.js @@ -2,7 +2,7 @@ * @module ol/interaction/Translate */ import {inherits} from '../index.js'; -import _ol_Collection_ from '../Collection.js'; +import Collection from '../Collection.js'; import BaseObject from '../Object.js'; import _ol_events_ from '../events.js'; import Event from '../events/Event.js'; @@ -100,7 +100,7 @@ _ol_interaction_Translate_.handleDownEvent_ = function(event) { this.lastCoordinate_ = event.coordinate; _ol_interaction_Translate_.handleMoveEvent_.call(this, event); - var features = this.features_ || new _ol_Collection_([this.lastFeature_]); + var features = this.features_ || new Collection([this.lastFeature_]); this.dispatchEvent( new _ol_interaction_Translate_.Event( @@ -123,7 +123,7 @@ _ol_interaction_Translate_.handleUpEvent_ = function(event) { this.lastCoordinate_ = null; _ol_interaction_Translate_.handleMoveEvent_.call(this, event); - var features = this.features_ || new _ol_Collection_([this.lastFeature_]); + var features = this.features_ || new Collection([this.lastFeature_]); this.dispatchEvent( new _ol_interaction_Translate_.Event( @@ -146,7 +146,7 @@ _ol_interaction_Translate_.handleDragEvent_ = function(event) { var deltaX = newCoordinate[0] - this.lastCoordinate_[0]; var deltaY = newCoordinate[1] - this.lastCoordinate_[1]; - var features = this.features_ || new _ol_Collection_([this.lastFeature_]); + var features = this.features_ || new Collection([this.lastFeature_]); features.forEach(function(feature) { var geom = feature.getGeometry(); diff --git a/src/ol/layer/Group.js b/src/ol/layer/Group.js index 908bb5b7f8..a977c49a20 100644 --- a/src/ol/layer/Group.js +++ b/src/ol/layer/Group.js @@ -2,7 +2,7 @@ * @module ol/layer/Group */ import {getUid, inherits} from '../index.js'; -import _ol_Collection_ from '../Collection.js'; +import Collection from '../Collection.js'; import CollectionEventType from '../CollectionEventType.js'; import BaseObject from '../Object.js'; import ObjectEventType from '../ObjectEventType.js'; @@ -64,14 +64,14 @@ var LayerGroup = function(opt_options) { if (layers) { if (Array.isArray(layers)) { - layers = new _ol_Collection_(layers.slice(), {unique: true}); + layers = new Collection(layers.slice(), {unique: true}); } else { - assert(layers instanceof _ol_Collection_, + assert(layers instanceof Collection, 43); // Expected `layers` to be an array or an `ol.Collection` layers = layers; } } else { - layers = new _ol_Collection_(undefined, {unique: true}); + layers = new Collection(undefined, {unique: true}); } this.setLayers(layers); diff --git a/src/ol/source/Vector.js b/src/ol/source/Vector.js index 462e832c77..e2ff2799c3 100644 --- a/src/ol/source/Vector.js +++ b/src/ol/source/Vector.js @@ -3,7 +3,7 @@ */ import {getUid, inherits, nullFunction} from '../index.js'; -import _ol_Collection_ from '../Collection.js'; +import Collection from '../Collection.js'; import CollectionEventType from '../CollectionEventType.js'; import ObjectEventType from '../ObjectEventType.js'; import {extend} from '../array.js'; @@ -131,14 +131,14 @@ var VectorSource = function(opt_options) { this.featuresCollection_ = null; var collection, features; - if (options.features instanceof _ol_Collection_) { + if (options.features instanceof Collection) { collection = options.features; features = collection.getArray(); } else if (Array.isArray(options.features)) { features = options.features; } if (!useSpatialIndex && collection === undefined) { - collection = new _ol_Collection_(features); + collection = new Collection(features); } if (features !== undefined) { this.addFeaturesInternal(features); diff --git a/test/spec/ol/collection.test.js b/test/spec/ol/collection.test.js index 7d95628bb7..5bf7137a98 100644 --- a/test/spec/ol/collection.test.js +++ b/test/spec/ol/collection.test.js @@ -1,5 +1,5 @@ import _ol_events_ from '../../../src/ol/events.js'; -import _ol_Collection_ from '../../../src/ol/Collection.js'; +import Collection from '../../../src/ol/Collection.js'; import CollectionEventType from '../../../src/ol/CollectionEventType.js'; @@ -7,7 +7,7 @@ describe('ol.collection', function() { var collection; beforeEach(function() { - collection = new _ol_Collection_(); + collection = new Collection(); }); describe('create an empty collection', function() { @@ -21,7 +21,7 @@ describe('ol.collection', function() { describe('create a collection from an array', function() { it('creates the expected collection', function() { var array = [0, 1, 2]; - var collection = new _ol_Collection_(array); + var collection = new Collection(array); expect(collection.item(0)).to.eql(0); expect(collection.item(1)).to.eql(1); expect(collection.item(2)).to.eql(2); @@ -61,7 +61,7 @@ describe('ol.collection', function() { describe('insertAt', function() { it('inserts elements at the correct location', function() { - collection = new _ol_Collection_([0, 2]); + collection = new Collection([0, 2]); collection.insertAt(1, 1); expect(collection.item(0)).to.eql(0); expect(collection.item(1)).to.eql(1); @@ -80,7 +80,7 @@ describe('ol.collection', function() { describe('removeAt', function() { it('removes elements at the correction', function() { - var collection = new _ol_Collection_([0, 1, 2]); + var collection = new Collection([0, 1, 2]); collection.removeAt(1); expect(collection.item(0)).to.eql(0); expect(collection.item(1)).to.eql(2); @@ -110,13 +110,13 @@ describe('ol.collection', function() { describe('remove', function() { it('removes the first matching element', function() { - var collection = new _ol_Collection_([0, 1, 2]); + var collection = new Collection([0, 1, 2]); expect(collection.remove(1)).to.eql(1); expect(collection.getArray()).to.eql([0, 2]); expect(collection.getLength()).to.eql(2); }); it('fires a remove event', function() { - var collection = new _ol_Collection_([0, 1, 2]); + var collection = new Collection([0, 1, 2]); var cb = sinon.spy(); _ol_events_.listen(collection, CollectionEventType.REMOVE, cb); expect(collection.remove(1)).to.eql(1); @@ -124,13 +124,13 @@ describe('ol.collection', function() { expect(cb.lastCall.args[0].element).to.eql(1); }); it('does not remove more than one matching element', function() { - var collection = new _ol_Collection_([0, 1, 1, 2]); + var collection = new Collection([0, 1, 1, 2]); expect(collection.remove(1)).to.eql(1); expect(collection.getArray()).to.eql([0, 1, 2]); expect(collection.getLength()).to.eql(3); }); it('returns undefined if the element is not found', function() { - var collection = new _ol_Collection_([0, 1, 2]); + var collection = new Collection([0, 1, 2]); expect(collection.remove(3)).to.be(undefined); expect(collection.getArray()).to.eql([0, 1, 2]); expect(collection.getLength()).to.eql(3); @@ -139,7 +139,7 @@ describe('ol.collection', function() { describe('setAt and event', function() { it('does dispatch events', function() { - var collection = new _ol_Collection_(['a', 'b']); + var collection = new Collection(['a', 'b']); var added, removed; _ol_events_.listen(collection, CollectionEventType.ADD, function(e) { added = e.element; @@ -156,7 +156,7 @@ describe('ol.collection', function() { describe('removeAt and event', function() { it('does dispatch events', function() { - var collection = new _ol_Collection_(['a']); + var collection = new Collection(['a']); var removed; _ol_events_.listen( collection, CollectionEventType.REMOVE, function(e) { @@ -169,7 +169,7 @@ describe('ol.collection', function() { describe('insertAt and event', function() { it('does dispatch events', function() { - var collection = new _ol_Collection_([0, 2]); + var collection = new Collection([0, 2]); var added; _ol_events_.listen( collection, CollectionEventType.ADD, function(e) { @@ -202,7 +202,7 @@ describe('ol.collection', function() { describe('change:length event', function() { var collection, cb; beforeEach(function() { - collection = new _ol_Collection_([0, 1, 2]); + collection = new Collection([0, 1, 2]); cb = sinon.spy(); _ol_events_.listen(collection, 'change:length', cb); }); @@ -231,7 +231,7 @@ describe('ol.collection', function() { describe('add event', function() { it('triggers add when pushing', function() { - var collection = new _ol_Collection_(); + var collection = new Collection(); var elem; _ol_events_.listen(collection, CollectionEventType.ADD, function(e) { elem = e.element; @@ -244,7 +244,7 @@ describe('ol.collection', function() { describe('remove event', function() { var collection, cb1, cb2; beforeEach(function() { - collection = new _ol_Collection_([1]); + collection = new Collection([1]); cb1 = sinon.spy(); cb2 = sinon.spy(); }); @@ -275,7 +275,7 @@ describe('ol.collection', function() { expect(collection.item(1)).to.eql(2); }); it('fires events', function() { - var collection = new _ol_Collection_(); + var collection = new Collection(); var elems = []; _ol_events_.listen(collection, CollectionEventType.ADD, function(e) { elems.push(e.element); @@ -287,25 +287,25 @@ describe('ol.collection', function() { describe('unique collection', function() { it('allows unique items in the constructor', function() { - new _ol_Collection_([{}, {}, {}], {unique: true}); + new Collection([{}, {}, {}], {unique: true}); }); it('throws if duplicate items are passed to the constructor', function() { var item = {}; var call = function() { - new _ol_Collection_([item, item], {unique: true}); + new Collection([item, item], {unique: true}); }; expect(call).to.throwException(); }); it('allows unique items to be added via push', function() { - var unique = new _ol_Collection_(undefined, {unique: true}); + var unique = new Collection(undefined, {unique: true}); unique.push({}); unique.push({}); }); it('throws if duplicate items are added via push', function() { - var unique = new _ol_Collection_(undefined, {unique: true}); + var unique = new Collection(undefined, {unique: true}); var item = {}; unique.push(item); var call = function() { @@ -315,13 +315,13 @@ describe('ol.collection', function() { }); it('allows unique items to be added via insertAt', function() { - var unique = new _ol_Collection_(undefined, {unique: true}); + var unique = new Collection(undefined, {unique: true}); unique.insertAt(0, {}); unique.insertAt(0, {}); }); it('throws if duplicate items are added via insertAt', function() { - var unique = new _ol_Collection_(undefined, {unique: true}); + var unique = new Collection(undefined, {unique: true}); var item = {}; unique.insertAt(0, item); var call = function() { @@ -331,20 +331,20 @@ describe('ol.collection', function() { }); it('allows unique items to be added via setAt', function() { - var unique = new _ol_Collection_(undefined, {unique: true}); + var unique = new Collection(undefined, {unique: true}); unique.setAt(0, {}); unique.setAt(1, {}); }); it('allows items to be reset via setAt', function() { - var unique = new _ol_Collection_(undefined, {unique: true}); + var unique = new Collection(undefined, {unique: true}); var item = {}; unique.setAt(0, item); unique.setAt(0, item); }); it('throws if duplicate items are added via setAt', function() { - var unique = new _ol_Collection_(undefined, {unique: true}); + var unique = new Collection(undefined, {unique: true}); var item = {}; unique.setAt(0, item); var call = function() { diff --git a/test/spec/ol/interaction/modify.test.js b/test/spec/ol/interaction/modify.test.js index eb38ad0780..60d886793c 100644 --- a/test/spec/ol/interaction/modify.test.js +++ b/test/spec/ol/interaction/modify.test.js @@ -1,4 +1,4 @@ -import _ol_Collection_ from '../../../../src/ol/Collection.js'; +import Collection from '../../../../src/ol/Collection.js'; import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.js'; import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js'; @@ -153,7 +153,7 @@ describe('ol.interaction.Modify', function() { it('adds features to the RTree', function() { var feature = new Feature( new Point([0, 0])); - var features = new _ol_Collection_([feature]); + var features = new Collection([feature]); var modify = new _ol_interaction_Modify_({ features: features }); @@ -164,7 +164,7 @@ describe('ol.interaction.Modify', function() { it('accepts feature without geometry', function() { var feature = new Feature(); - var features = new _ol_Collection_([feature]); + var features = new Collection([feature]); var modify = new _ol_interaction_Modify_({ features: features }); @@ -200,7 +200,7 @@ describe('ol.interaction.Modify', function() { var secondRevision = second.getGeometry().getRevision(); var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + features: new Collection(features) }); map.addInteraction(modify); @@ -238,7 +238,7 @@ describe('ol.interaction.Modify', function() { var firstRevision = first.getGeometry().getRevision(); var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + features: new Collection(features) }); map.addInteraction(modify); @@ -274,7 +274,7 @@ describe('ol.interaction.Modify', function() { var firstRevision = first.getGeometry().getRevision(); var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + features: new Collection(features) }); map.addInteraction(modify); @@ -310,7 +310,7 @@ describe('ol.interaction.Modify', function() { var firstRevision = first.getGeometry().getRevision(); var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + features: new Collection(features) }); map.addInteraction(modify); @@ -348,7 +348,7 @@ describe('ol.interaction.Modify', function() { features.push(lineFeature); var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + features: new Collection(features) }); map.addInteraction(modify); @@ -387,7 +387,7 @@ describe('ol.interaction.Modify', function() { features.push(circleFeature); var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + features: new Collection(features) }); map.addInteraction(modify); @@ -418,7 +418,7 @@ describe('ol.interaction.Modify', function() { beforeEach(function() { modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + features: new Collection(features) }); map.addInteraction(modify); @@ -523,7 +523,7 @@ describe('ol.interaction.Modify', function() { beforeEach(function() { modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features), + features: new Collection(features), deleteCondition: _ol_events_condition_.doubleClick }); map.addInteraction(modify); @@ -576,7 +576,7 @@ describe('ol.interaction.Modify', function() { }); var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features), + features: new Collection(features), insertVertexCondition: listenerSpy }); map.addInteraction(modify); @@ -622,7 +622,7 @@ describe('ol.interaction.Modify', function() { features.push(feature); var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + features: new Collection(features) }); map.addInteraction(modify); @@ -658,7 +658,7 @@ describe('ol.interaction.Modify', function() { it('updates polygon segment data', function() { var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + features: new Collection(features) }); map.addInteraction(modify); @@ -698,7 +698,7 @@ describe('ol.interaction.Modify', function() { describe('#setActive', function() { it('removes the vertexFeature of deactivation', function() { var modify = new _ol_interaction_Modify_({ - features: new _ol_Collection_(features) + features: new Collection(features) }); map.addInteraction(modify); expect(modify.vertexFeature_).to.be(null); diff --git a/test/spec/ol/interaction/select.test.js b/test/spec/ol/interaction/select.test.js index b31a2faa71..7ae4810270 100644 --- a/test/spec/ol/interaction/select.test.js +++ b/test/spec/ol/interaction/select.test.js @@ -1,4 +1,4 @@ -import _ol_Collection_ from '../../../../src/ol/Collection.js'; +import Collection from '../../../../src/ol/Collection.js'; import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.js'; import MapBrowserEventType from '../../../../src/ol/MapBrowserEventType.js'; @@ -111,7 +111,7 @@ describe('ol.interaction.Select', function() { describe('user-provided collection', function() { it('uses the user-provided collection', function() { - var features = new _ol_Collection_(); + var features = new Collection(); var select = new _ol_interaction_Select_({features: features}); expect(select.getFeatures()).to.be(features); }); diff --git a/test/spec/ol/interaction/snap.test.js b/test/spec/ol/interaction/snap.test.js index f8b5b48a35..792c4b9f4a 100644 --- a/test/spec/ol/interaction/snap.test.js +++ b/test/spec/ol/interaction/snap.test.js @@ -1,4 +1,4 @@ -import _ol_Collection_ from '../../../../src/ol/Collection.js'; +import Collection from '../../../../src/ol/Collection.js'; import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.js'; import View from '../../../../src/ol/View.js'; @@ -58,7 +58,7 @@ describe('ol.interaction.Snap', function() { it('can handle XYZ coordinates', function() { var point = new Feature(new Point([0, 0, 123])); var snapInteraction = new _ol_interaction_Snap_({ - features: new _ol_Collection_([point]) + features: new Collection([point]) }); snapInteraction.setMap(map); @@ -75,7 +75,7 @@ describe('ol.interaction.Snap', function() { it('snaps to edges only', function() { var point = new Feature(new LineString([[-10, 0], [10, 0]])); var snapInteraction = new _ol_interaction_Snap_({ - features: new _ol_Collection_([point]), + features: new Collection([point]), pixelTolerance: 5, vertex: false }); @@ -93,7 +93,7 @@ describe('ol.interaction.Snap', function() { it('snaps to vertices only', function() { var point = new Feature(new LineString([[-10, 0], [10, 0]])); var snapInteraction = new _ol_interaction_Snap_({ - features: new _ol_Collection_([point]), + features: new Collection([point]), pixelTolerance: 5, edge: false }); @@ -111,7 +111,7 @@ describe('ol.interaction.Snap', function() { it('snaps to circle', function() { var circle = new Feature(new Circle([0, 0], 10)); var snapInteraction = new _ol_interaction_Snap_({ - features: new _ol_Collection_([circle]), + features: new Collection([circle]), pixelTolerance: 5 }); snapInteraction.setMap(map); @@ -130,7 +130,7 @@ describe('ol.interaction.Snap', function() { it('handle feature without geometry', function() { var feature = new Feature(); var snapInteraction = new _ol_interaction_Snap_({ - features: new _ol_Collection_([feature]), + features: new Collection([feature]), pixelTolerance: 5, edge: false }); @@ -150,7 +150,7 @@ describe('ol.interaction.Snap', function() { it('handle geometry changes', function() { var line = new Feature(new LineString([[-10, 0], [0, 0]])); var snapInteraction = new _ol_interaction_Snap_({ - features: new _ol_Collection_([line]), + features: new Collection([line]), pixelTolerance: 5, edge: false }); @@ -173,7 +173,7 @@ describe('ol.interaction.Snap', function() { alt_geometry: new LineString([[-10, 0], [10, 0]]) }); var snapInteraction = new _ol_interaction_Snap_({ - features: new _ol_Collection_([line]), + features: new Collection([line]), pixelTolerance: 5, edge: false }); diff --git a/test/spec/ol/interaction/translate.test.js b/test/spec/ol/interaction/translate.test.js index 4d080b44bc..0f5f8a1f91 100644 --- a/test/spec/ol/interaction/translate.test.js +++ b/test/spec/ol/interaction/translate.test.js @@ -1,4 +1,4 @@ -import _ol_Collection_ from '../../../../src/ol/Collection.js'; +import Collection from '../../../../src/ol/Collection.js'; import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.js'; import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js'; @@ -159,7 +159,7 @@ describe('ol.interaction.Translate', function() { beforeEach(function() { translate = new _ol_interaction_Translate_({ - features: new _ol_Collection_([features[0]]) + features: new Collection([features[0]]) }); map.addInteraction(translate); }); diff --git a/test/spec/ol/layer/group.test.js b/test/spec/ol/layer/group.test.js index 7f122094f2..987de1dee3 100644 --- a/test/spec/ol/layer/group.test.js +++ b/test/spec/ol/layer/group.test.js @@ -1,6 +1,6 @@ import {getUid} from '../../../../src/ol/index.js'; import {stableSort} from '../../../../src/ol/array.js'; -import _ol_Collection_ from '../../../../src/ol/Collection.js'; +import Collection from '../../../../src/ol/Collection.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js'; import LayerGroup from '../../../../src/ol/layer/Group.js'; import Layer from '../../../../src/ol/layer/Layer.js'; @@ -50,7 +50,7 @@ describe('ol.layer.Group', function() { }); it('provides default empty layers collection', function() { - expect(layerGroup.getLayers()).to.be.a(_ol_Collection_); + expect(layerGroup.getLayers()).to.be.a(Collection); expect(layerGroup.getLayers().getLength()).to.be(0); }); @@ -166,7 +166,7 @@ describe('ol.layer.Group', function() { maxResolution: 500, minResolution: 0.25 }); - expect(layerGroup.getLayers()).to.be.a(_ol_Collection_); + expect(layerGroup.getLayers()).to.be.a(Collection); expect(layerGroup.getLayers().getLength()).to.be(1); expect(layerGroup.getLayers().item(0)).to.be(layer); @@ -207,7 +207,7 @@ describe('ol.layer.Group', function() { maxResolution: 500, minResolution: 0.25 }); - expect(layerGroup.getLayers()).to.be.a(_ol_Collection_); + expect(layerGroup.getLayers()).to.be.a(Collection); expect(layerGroup.getLayers().getLength()).to.be(1); expect(layerGroup.getLayers().item(0)).to.be(layer); @@ -284,7 +284,7 @@ describe('ol.layer.Group', function() { describe('layers events', function() { it('listen / unlisten for layers added to the collection', function() { - var layers = new _ol_Collection_(); + var layers = new Collection(); var layerGroup = new LayerGroup({ layers: layers }); @@ -315,7 +315,7 @@ describe('ol.layer.Group', function() { projection: 'EPSG:4326' }) }); - var layers = new _ol_Collection_([layer]); + var layers = new Collection([layer]); var layerGroup = new LayerGroup(); layerGroup.setLayers(layers); diff --git a/test/spec/ol/source/vector.test.js b/test/spec/ol/source/vector.test.js index a35872cb59..822b48847e 100644 --- a/test/spec/ol/source/vector.test.js +++ b/test/spec/ol/source/vector.test.js @@ -1,5 +1,5 @@ import _ol_events_ from '../../../../src/ol/events.js'; -import _ol_Collection_ from '../../../../src/ol/Collection.js'; +import Collection from '../../../../src/ol/Collection.js'; import Feature from '../../../../src/ol/Feature.js'; import Map from '../../../../src/ol/Map.js'; import View from '../../../../src/ol/View.js'; @@ -560,7 +560,7 @@ describe('ol.source.Vector', function() { }); it('returns a features collection', function() { - expect(source.getFeaturesCollection()).to.be.a(_ol_Collection_); + expect(source.getFeaturesCollection()).to.be.a(Collection); }); it('#forEachFeatureInExtent loops through all features', function() { @@ -622,7 +622,7 @@ describe('ol.source.Vector', function() { describe('with a collection of features plus spatial index', function() { var collection, source; beforeEach(function() { - collection = new _ol_Collection_(); + collection = new Collection(); source = new VectorSource({ features: collection }); From 8a74d6b8db6954df6b2be17a4e6f0934cf4e868f Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:34:33 -0700 Subject: [PATCH 13/35] Rename _ol_pointer_PointerEventHandler_ to PointerEventHandler --- src/ol/MapBrowserEventHandler.js | 6 +- src/ol/control/ZoomSlider.js | 4 +- src/ol/pointer/PointerEventHandler.js | 62 +++++++++---------- test/spec/ol/pointer/mousesource.test.js | 4 +- .../ol/pointer/pointereventhandler.test.js | 4 +- test/spec/ol/pointer/touchsource.test.js | 4 +- 6 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/ol/MapBrowserEventHandler.js b/src/ol/MapBrowserEventHandler.js index 2fbb76d756..5bb188e837 100644 --- a/src/ol/MapBrowserEventHandler.js +++ b/src/ol/MapBrowserEventHandler.js @@ -8,7 +8,7 @@ import MapBrowserPointerEvent from './MapBrowserPointerEvent.js'; import _ol_events_ from './events.js'; import EventTarget from './events/EventTarget.js'; import PointerEventType from './pointer/EventType.js'; -import _ol_pointer_PointerEventHandler_ from './pointer/PointerEventHandler.js'; +import PointerEventHandler from './pointer/PointerEventHandler.js'; /** * @param {ol.PluggableMap} map The map with the viewport to listen to events on. @@ -81,7 +81,7 @@ var MapBrowserEventHandler = function(map, moveTolerance) { * @type {ol.pointer.PointerEventHandler} * @private */ - this.pointerEventHandler_ = new _ol_pointer_PointerEventHandler_(element); + this.pointerEventHandler_ = new PointerEventHandler(element); /** * Event handler which generates pointer events for @@ -218,7 +218,7 @@ MapBrowserEventHandler.prototype.handlePointerDown_ = function(pointerEvent) { * the viewport when dragging. */ this.documentPointerEventHandler_ = - new _ol_pointer_PointerEventHandler_(document); + new PointerEventHandler(document); this.dragListenerKeys_.push( _ol_events_.listen(this.documentPointerEventHandler_, diff --git a/src/ol/control/ZoomSlider.js b/src/ol/control/ZoomSlider.js index 75845b816f..aea9f350b7 100644 --- a/src/ol/control/ZoomSlider.js +++ b/src/ol/control/ZoomSlider.js @@ -13,7 +13,7 @@ import Event from '../events/Event.js'; import EventType from '../events/EventType.js'; import {clamp} from '../math.js'; import PointerEventType from '../pointer/EventType.js'; -import _ol_pointer_PointerEventHandler_ from '../pointer/PointerEventHandler.js'; +import PointerEventHandler from '../pointer/PointerEventHandler.js'; /** * @classdesc @@ -111,7 +111,7 @@ var ZoomSlider = function(opt_options) { * @type {ol.pointer.PointerEventHandler} * @private */ - this.dragger_ = new _ol_pointer_PointerEventHandler_(containerElement); + this.dragger_ = new PointerEventHandler(containerElement); _ol_events_.listen(this.dragger_, PointerEventType.POINTERDOWN, this.handleDraggerStart_, this); diff --git a/src/ol/pointer/PointerEventHandler.js b/src/ol/pointer/PointerEventHandler.js index f7dc510e9d..6e38312604 100644 --- a/src/ol/pointer/PointerEventHandler.js +++ b/src/ol/pointer/PointerEventHandler.js @@ -47,7 +47,7 @@ import _ol_pointer_TouchSource_ from '../pointer/TouchSource.js'; * @extends {ol.events.EventTarget} * @param {Element|HTMLDocument} element Viewport element. */ -var _ol_pointer_PointerEventHandler_ = function(element) { +var PointerEventHandler = function(element) { EventTarget.call(this); /** @@ -78,14 +78,14 @@ var _ol_pointer_PointerEventHandler_ = function(element) { this.registerSources(); }; -inherits(_ol_pointer_PointerEventHandler_, EventTarget); +inherits(PointerEventHandler, EventTarget); /** * Set up the event sources (mouse, touch and native pointers) * that generate pointer events. */ -_ol_pointer_PointerEventHandler_.prototype.registerSources = function() { +PointerEventHandler.prototype.registerSources = function() { if (_ol_has_.POINTER) { this.registerSource('native', new _ol_pointer_NativeSource_(this)); } else if (_ol_has_.MSPOINTER) { @@ -111,7 +111,7 @@ _ol_pointer_PointerEventHandler_.prototype.registerSources = function() { * @param {string} name A name for the event source * @param {ol.pointer.EventSource} source The source event. */ -_ol_pointer_PointerEventHandler_.prototype.registerSource = function(name, source) { +PointerEventHandler.prototype.registerSource = function(name, source) { var s = source; var newEvents = s.getEvents(); @@ -132,7 +132,7 @@ _ol_pointer_PointerEventHandler_.prototype.registerSource = function(name, sourc * Set up the events for all registered event sources. * @private */ -_ol_pointer_PointerEventHandler_.prototype.register_ = function() { +PointerEventHandler.prototype.register_ = function() { var l = this.eventSourceList_.length; var eventSource; for (var i = 0; i < l; i++) { @@ -146,7 +146,7 @@ _ol_pointer_PointerEventHandler_.prototype.register_ = function() { * Remove all registered events. * @private */ -_ol_pointer_PointerEventHandler_.prototype.unregister_ = function() { +PointerEventHandler.prototype.unregister_ = function() { var l = this.eventSourceList_.length; var eventSource; for (var i = 0; i < l; i++) { @@ -161,7 +161,7 @@ _ol_pointer_PointerEventHandler_.prototype.unregister_ = function() { * @private * @param {Event} inEvent Browser event. */ -_ol_pointer_PointerEventHandler_.prototype.eventHandler_ = function(inEvent) { +PointerEventHandler.prototype.eventHandler_ = function(inEvent) { var type = inEvent.type; var handler = this.eventMap_[type]; if (handler) { @@ -175,7 +175,7 @@ _ol_pointer_PointerEventHandler_.prototype.eventHandler_ = function(inEvent) { * @private * @param {Array.} events List of events. */ -_ol_pointer_PointerEventHandler_.prototype.addEvents_ = function(events) { +PointerEventHandler.prototype.addEvents_ = function(events) { events.forEach(function(eventName) { _ol_events_.listen(this.element_, eventName, this.eventHandler_, this); }.bind(this)); @@ -187,7 +187,7 @@ _ol_pointer_PointerEventHandler_.prototype.addEvents_ = function(events) { * @private * @param {Array.} events List of events. */ -_ol_pointer_PointerEventHandler_.prototype.removeEvents_ = function(events) { +PointerEventHandler.prototype.removeEvents_ = function(events) { events.forEach(function(e) { _ol_events_.unlisten(this.element_, e, this.eventHandler_, this); }.bind(this)); @@ -203,11 +203,11 @@ _ol_pointer_PointerEventHandler_.prototype.removeEvents_ = function(events) { * @return {Object} An object containing shallow copies of * `inEvent`'s properties. */ -_ol_pointer_PointerEventHandler_.prototype.cloneEvent = function(event, inEvent) { +PointerEventHandler.prototype.cloneEvent = function(event, inEvent) { var eventCopy = {}, p; - for (var i = 0, ii = _ol_pointer_PointerEventHandler_.CLONE_PROPS.length; i < ii; i++) { - p = _ol_pointer_PointerEventHandler_.CLONE_PROPS[i][0]; - eventCopy[p] = event[p] || inEvent[p] || _ol_pointer_PointerEventHandler_.CLONE_PROPS[i][1]; + for (var i = 0, ii = PointerEventHandler.CLONE_PROPS.length; i < ii; i++) { + p = PointerEventHandler.CLONE_PROPS[i][0]; + eventCopy[p] = event[p] || inEvent[p] || PointerEventHandler.CLONE_PROPS[i][1]; } return eventCopy; @@ -222,7 +222,7 @@ _ol_pointer_PointerEventHandler_.prototype.cloneEvent = function(event, inEvent) * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.down = function(data, event) { +PointerEventHandler.prototype.down = function(data, event) { this.fireEvent(PointerEventType.POINTERDOWN, data, event); }; @@ -232,7 +232,7 @@ _ol_pointer_PointerEventHandler_.prototype.down = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.move = function(data, event) { +PointerEventHandler.prototype.move = function(data, event) { this.fireEvent(PointerEventType.POINTERMOVE, data, event); }; @@ -242,7 +242,7 @@ _ol_pointer_PointerEventHandler_.prototype.move = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.up = function(data, event) { +PointerEventHandler.prototype.up = function(data, event) { this.fireEvent(PointerEventType.POINTERUP, data, event); }; @@ -252,7 +252,7 @@ _ol_pointer_PointerEventHandler_.prototype.up = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.enter = function(data, event) { +PointerEventHandler.prototype.enter = function(data, event) { data.bubbles = false; this.fireEvent(PointerEventType.POINTERENTER, data, event); }; @@ -263,7 +263,7 @@ _ol_pointer_PointerEventHandler_.prototype.enter = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.leave = function(data, event) { +PointerEventHandler.prototype.leave = function(data, event) { data.bubbles = false; this.fireEvent(PointerEventType.POINTERLEAVE, data, event); }; @@ -274,7 +274,7 @@ _ol_pointer_PointerEventHandler_.prototype.leave = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.over = function(data, event) { +PointerEventHandler.prototype.over = function(data, event) { data.bubbles = true; this.fireEvent(PointerEventType.POINTEROVER, data, event); }; @@ -285,7 +285,7 @@ _ol_pointer_PointerEventHandler_.prototype.over = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.out = function(data, event) { +PointerEventHandler.prototype.out = function(data, event) { data.bubbles = true; this.fireEvent(PointerEventType.POINTEROUT, data, event); }; @@ -296,7 +296,7 @@ _ol_pointer_PointerEventHandler_.prototype.out = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.cancel = function(data, event) { +PointerEventHandler.prototype.cancel = function(data, event) { this.fireEvent(PointerEventType.POINTERCANCEL, data, event); }; @@ -306,7 +306,7 @@ _ol_pointer_PointerEventHandler_.prototype.cancel = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.leaveOut = function(data, event) { +PointerEventHandler.prototype.leaveOut = function(data, event) { this.out(data, event); if (!this.contains_(data.target, data.relatedTarget)) { this.leave(data, event); @@ -319,7 +319,7 @@ _ol_pointer_PointerEventHandler_.prototype.leaveOut = function(data, event) { * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.enterOver = function(data, event) { +PointerEventHandler.prototype.enterOver = function(data, event) { this.over(data, event); if (!this.contains_(data.target, data.relatedTarget)) { this.enter(data, event); @@ -334,7 +334,7 @@ _ol_pointer_PointerEventHandler_.prototype.enterOver = function(data, event) { * @return {boolean} Returns true if the container element * contains the other element. */ -_ol_pointer_PointerEventHandler_.prototype.contains_ = function(container, contained) { +PointerEventHandler.prototype.contains_ = function(container, contained) { if (!container || !contained) { return false; } @@ -352,7 +352,7 @@ _ol_pointer_PointerEventHandler_.prototype.contains_ = function(container, conta * @param {Event} event The event. * @return {ol.pointer.PointerEvent} A PointerEvent of type `inType`. */ -_ol_pointer_PointerEventHandler_.prototype.makeEvent = function(inType, data, event) { +PointerEventHandler.prototype.makeEvent = function(inType, data, event) { return new _ol_pointer_PointerEvent_(inType, event, data); }; @@ -363,7 +363,7 @@ _ol_pointer_PointerEventHandler_.prototype.makeEvent = function(inType, data, ev * @param {Object} data Pointer event data. * @param {Event} event The event. */ -_ol_pointer_PointerEventHandler_.prototype.fireEvent = function(inType, data, event) { +PointerEventHandler.prototype.fireEvent = function(inType, data, event) { var e = this.makeEvent(inType, data, event); this.dispatchEvent(e); }; @@ -374,7 +374,7 @@ _ol_pointer_PointerEventHandler_.prototype.fireEvent = function(inType, data, ev * and dispatches this event. * @param {Event} event A platform event with a target. */ -_ol_pointer_PointerEventHandler_.prototype.fireNativeEvent = function(event) { +PointerEventHandler.prototype.fireNativeEvent = function(event) { var e = this.makeEvent(event.type, event, event); this.dispatchEvent(e); }; @@ -387,7 +387,7 @@ _ol_pointer_PointerEventHandler_.prototype.fireNativeEvent = function(event) { * @param {Event} event The event. * @return {ol.pointer.PointerEvent} The wrapped event. */ -_ol_pointer_PointerEventHandler_.prototype.wrapMouseEvent = function(eventType, event) { +PointerEventHandler.prototype.wrapMouseEvent = function(eventType, event) { var pointerEvent = this.makeEvent( eventType, _ol_pointer_MouseSource_.prepareEvent(event, this), event); return pointerEvent; @@ -397,7 +397,7 @@ _ol_pointer_PointerEventHandler_.prototype.wrapMouseEvent = function(eventType, /** * @inheritDoc */ -_ol_pointer_PointerEventHandler_.prototype.disposeInternal = function() { +PointerEventHandler.prototype.disposeInternal = function() { this.unregister_(); EventTarget.prototype.disposeInternal.call(this); }; @@ -407,7 +407,7 @@ _ol_pointer_PointerEventHandler_.prototype.disposeInternal = function() { * Properties to copy when cloning an event, with default values. * @type {Array.} */ -_ol_pointer_PointerEventHandler_.CLONE_PROPS = [ +PointerEventHandler.CLONE_PROPS = [ // MouseEvent ['bubbles', false], ['cancelable', false], @@ -441,4 +441,4 @@ _ol_pointer_PointerEventHandler_.CLONE_PROPS = [ ['currentTarget', null], ['which', 0] ]; -export default _ol_pointer_PointerEventHandler_; +export default PointerEventHandler; diff --git a/test/spec/ol/pointer/mousesource.test.js b/test/spec/ol/pointer/mousesource.test.js index 4ecbd007d7..2a719b9f97 100644 --- a/test/spec/ol/pointer/mousesource.test.js +++ b/test/spec/ol/pointer/mousesource.test.js @@ -1,7 +1,7 @@ import _ol_events_ from '../../../../src/ol/events.js'; import EventTarget from '../../../../src/ol/events/EventTarget.js'; import _ol_has_ from '../../../../src/ol/has.js'; -import _ol_pointer_PointerEventHandler_ from '../../../../src/ol/pointer/PointerEventHandler.js'; +import PointerEventHandler from '../../../../src/ol/pointer/PointerEventHandler.js'; import _ol_pointer_TouchSource_ from '../../../../src/ol/pointer/TouchSource.js'; @@ -20,7 +20,7 @@ describe('ol.pointer.MouseSource', function() { _ol_has_.MSPOINTER = false; _ol_has_.TOUCH = true; - handler = new _ol_pointer_PointerEventHandler_(target); + handler = new PointerEventHandler(target); eventSpy = sinon.spy(); }); diff --git a/test/spec/ol/pointer/pointereventhandler.test.js b/test/spec/ol/pointer/pointereventhandler.test.js index 559d25267e..6d5959075b 100644 --- a/test/spec/ol/pointer/pointereventhandler.test.js +++ b/test/spec/ol/pointer/pointereventhandler.test.js @@ -3,7 +3,7 @@ import EventTarget from '../../../../src/ol/events/EventTarget.js'; import _ol_has_ from '../../../../src/ol/has.js'; import _ol_pointer_MouseSource_ from '../../../../src/ol/pointer/MouseSource.js'; import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; -import _ol_pointer_PointerEventHandler_ from '../../../../src/ol/pointer/PointerEventHandler.js'; +import PointerEventHandler from '../../../../src/ol/pointer/PointerEventHandler.js'; describe('ol.pointer.PointerEventHandler', function() { @@ -18,7 +18,7 @@ describe('ol.pointer.PointerEventHandler', function() { _ol_has_.POINTER = false; _ol_has_.MSPOINTER = false; - handler = new _ol_pointer_PointerEventHandler_(target); + handler = new PointerEventHandler(target); eventSpy = sinon.spy(); }); diff --git a/test/spec/ol/pointer/touchsource.test.js b/test/spec/ol/pointer/touchsource.test.js index 132bab891b..f139112113 100644 --- a/test/spec/ol/pointer/touchsource.test.js +++ b/test/spec/ol/pointer/touchsource.test.js @@ -3,7 +3,7 @@ import Event from '../../../../src/ol/events/Event.js'; import EventTarget from '../../../../src/ol/events/EventTarget.js'; import _ol_has_ from '../../../../src/ol/has.js'; import _ol_obj_ from '../../../../src/ol/obj.js'; -import _ol_pointer_PointerEventHandler_ from '../../../../src/ol/pointer/PointerEventHandler.js'; +import PointerEventHandler from '../../../../src/ol/pointer/PointerEventHandler.js'; describe('ol.pointer.TouchSource', function() { var handler; var target; @@ -17,7 +17,7 @@ describe('ol.pointer.TouchSource', function() { _ol_has_.MSPOINTER = false; _ol_has_.TOUCH = true; - handler = new _ol_pointer_PointerEventHandler_(target); + handler = new PointerEventHandler(target); eventSpy = sinon.spy(); }); From dce17908869473c97f1c824992ca2f7d07fec89b Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:39:54 -0700 Subject: [PATCH 14/35] Rename _ol_interaction_Pointer_ to PointerInteraction --- examples/custom-interactions.js | 6 ++--- src/ol/interaction/DragBox.js | 6 ++--- src/ol/interaction/DragPan.js | 8 +++--- src/ol/interaction/DragRotate.js | 6 ++--- src/ol/interaction/DragRotateAndZoom.js | 6 ++--- src/ol/interaction/Draw.js | 10 ++++---- src/ol/interaction/Extent.js | 10 ++++---- src/ol/interaction/Modify.js | 12 ++++----- src/ol/interaction/PinchRotate.js | 8 +++--- src/ol/interaction/PinchZoom.js | 8 +++--- src/ol/interaction/Pointer.js | 34 ++++++++++++------------- src/ol/interaction/Snap.js | 10 ++++---- src/ol/interaction/Translate.js | 8 +++--- 13 files changed, 66 insertions(+), 66 deletions(-) diff --git a/examples/custom-interactions.js b/examples/custom-interactions.js index 7ef6119efc..5b42560c59 100644 --- a/examples/custom-interactions.js +++ b/examples/custom-interactions.js @@ -6,7 +6,7 @@ import LineString from '../src/ol/geom/LineString.js'; import Point from '../src/ol/geom/Point.js'; import Polygon from '../src/ol/geom/Polygon.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; -import _ol_interaction_Pointer_ from '../src/ol/interaction/Pointer.js'; +import PointerInteraction from '../src/ol/interaction/Pointer.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import TileJSON from '../src/ol/source/TileJSON.js'; @@ -29,7 +29,7 @@ var app = {}; */ app.Drag = function() { - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: app.Drag.prototype.handleDownEvent, handleDragEvent: app.Drag.prototype.handleDragEvent, handleMoveEvent: app.Drag.prototype.handleMoveEvent, @@ -61,7 +61,7 @@ app.Drag = function() { this.previousCursor_ = undefined; }; -inherits(app.Drag, _ol_interaction_Pointer_); +inherits(app.Drag, PointerInteraction); /** diff --git a/src/ol/interaction/DragBox.js b/src/ol/interaction/DragBox.js index 8329066293..2e2b569bfd 100644 --- a/src/ol/interaction/DragBox.js +++ b/src/ol/interaction/DragBox.js @@ -5,7 +5,7 @@ import Event from '../events/Event.js'; import {inherits, nullFunction} from '../index.js'; import _ol_events_condition_ from '../events/condition.js'; -import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; +import PointerInteraction from '../interaction/Pointer.js'; import _ol_render_Box_ from '../render/Box.js'; /** @@ -27,7 +27,7 @@ import _ol_render_Box_ from '../render/Box.js'; */ var DragBox = function(opt_options) { - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: DragBox.handleDownEvent_, handleDragEvent: DragBox.handleDragEvent_, handleUpEvent: DragBox.handleUpEvent_ @@ -68,7 +68,7 @@ var DragBox = function(opt_options) { options.boxEndCondition : DragBox.defaultBoxEndCondition; }; -inherits(DragBox, _ol_interaction_Pointer_); +inherits(DragBox, PointerInteraction); /** diff --git a/src/ol/interaction/DragPan.js b/src/ol/interaction/DragPan.js index 97220cc018..bd7e433847 100644 --- a/src/ol/interaction/DragPan.js +++ b/src/ol/interaction/DragPan.js @@ -7,7 +7,7 @@ import _ol_coordinate_ from '../coordinate.js'; import {easeOut} from '../easing.js'; import _ol_events_condition_ from '../events/condition.js'; import {FALSE} from '../functions.js'; -import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; +import PointerInteraction from '../interaction/Pointer.js'; /** * @classdesc @@ -20,7 +20,7 @@ import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; */ var DragPan = function(opt_options) { - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: DragPan.handleDownEvent_, handleDragEvent: DragPan.handleDragEvent_, handleUpEvent: DragPan.handleUpEvent_ @@ -59,7 +59,7 @@ var DragPan = function(opt_options) { }; -inherits(DragPan, _ol_interaction_Pointer_); +inherits(DragPan, PointerInteraction); /** @@ -70,7 +70,7 @@ inherits(DragPan, _ol_interaction_Pointer_); DragPan.handleDragEvent_ = function(mapBrowserEvent) { var targetPointers = this.targetPointers; var centroid = - _ol_interaction_Pointer_.centroid(targetPointers); + PointerInteraction.centroid(targetPointers); if (targetPointers.length == this.lastPointersCount_) { if (this.kinetic_) { this.kinetic_.update(centroid[0], centroid[1]); diff --git a/src/ol/interaction/DragRotate.js b/src/ol/interaction/DragRotate.js index 5b78c1d761..87facda506 100644 --- a/src/ol/interaction/DragRotate.js +++ b/src/ol/interaction/DragRotate.js @@ -7,7 +7,7 @@ import ViewHint from '../ViewHint.js'; import _ol_events_condition_ from '../events/condition.js'; import {FALSE} from '../functions.js'; import Interaction from '../interaction/Interaction.js'; -import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; +import PointerInteraction from '../interaction/Pointer.js'; /** * @classdesc @@ -26,7 +26,7 @@ var DragRotate = function(opt_options) { var options = opt_options ? opt_options : {}; - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: DragRotate.handleDownEvent_, handleDragEvent: DragRotate.handleDragEvent_, handleUpEvent: DragRotate.handleUpEvent_ @@ -52,7 +52,7 @@ var DragRotate = function(opt_options) { this.duration_ = options.duration !== undefined ? options.duration : 250; }; -inherits(DragRotate, _ol_interaction_Pointer_); +inherits(DragRotate, PointerInteraction); /** diff --git a/src/ol/interaction/DragRotateAndZoom.js b/src/ol/interaction/DragRotateAndZoom.js index 8846fd5dfc..757cdef2a9 100644 --- a/src/ol/interaction/DragRotateAndZoom.js +++ b/src/ol/interaction/DragRotateAndZoom.js @@ -6,7 +6,7 @@ import RotationConstraint from '../RotationConstraint.js'; import ViewHint from '../ViewHint.js'; import _ol_events_condition_ from '../events/condition.js'; import Interaction from '../interaction/Interaction.js'; -import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; +import PointerInteraction from '../interaction/Pointer.js'; /** * @classdesc @@ -27,7 +27,7 @@ var DragRotateAndZoom = function(opt_options) { var options = opt_options ? opt_options : {}; - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: DragRotateAndZoom.handleDownEvent_, handleDragEvent: DragRotateAndZoom.handleDragEvent_, handleUpEvent: DragRotateAndZoom.handleUpEvent_ @@ -66,7 +66,7 @@ var DragRotateAndZoom = function(opt_options) { }; -inherits(DragRotateAndZoom, _ol_interaction_Pointer_); +inherits(DragRotateAndZoom, PointerInteraction); /** diff --git a/src/ol/interaction/Draw.js b/src/ol/interaction/Draw.js index c6f739446f..b7d4633eb9 100644 --- a/src/ol/interaction/Draw.js +++ b/src/ol/interaction/Draw.js @@ -20,7 +20,7 @@ import MultiPolygon from '../geom/MultiPolygon.js'; import Point from '../geom/Point.js'; import Polygon, {fromCircle, makeRegular} from '../geom/Polygon.js'; import DrawEventType from '../interaction/DrawEventType.js'; -import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; +import PointerInteraction from '../interaction/Pointer.js'; import InteractionProperty from '../interaction/Property.js'; import VectorLayer from '../layer/Vector.js'; import VectorSource from '../source/Vector.js'; @@ -38,7 +38,7 @@ import _ol_style_Style_ from '../style/Style.js'; */ var Draw = function(options) { - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: Draw.handleDownEvent_, handleEvent: Draw.handleEvent, handleUpEvent: Draw.handleUpEvent_ @@ -290,7 +290,7 @@ var Draw = function(options) { }; -inherits(Draw, _ol_interaction_Pointer_); +inherits(Draw, PointerInteraction); /** @@ -308,7 +308,7 @@ Draw.getDefaultStyleFunction = function() { * @inheritDoc */ Draw.prototype.setMap = function(map) { - _ol_interaction_Pointer_.prototype.setMap.call(this, map); + PointerInteraction.prototype.setMap.call(this, map); this.updateState_(); }; @@ -337,7 +337,7 @@ Draw.handleEvent = function(event) { } else if (event.type === MapBrowserEventType.DBLCLICK) { pass = false; } - return _ol_interaction_Pointer_.handleEvent.call(this, event) && pass; + return PointerInteraction.handleEvent.call(this, event) && pass; }; diff --git a/src/ol/interaction/Extent.js b/src/ol/interaction/Extent.js index 16a829c766..fefef6dc7d 100644 --- a/src/ol/interaction/Extent.js +++ b/src/ol/interaction/Extent.js @@ -12,7 +12,7 @@ import GeometryType from '../geom/GeometryType.js'; import Point from '../geom/Point.js'; import {fromExtent as polygonFromExtent} from '../geom/Polygon.js'; import _ol_interaction_ExtentEventType_ from '../interaction/ExtentEventType.js'; -import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; +import PointerInteraction from '../interaction/Pointer.js'; import VectorLayer from '../layer/Vector.js'; import VectorSource from '../source/Vector.js'; import _ol_style_Style_ from '../style/Style.js'; @@ -81,7 +81,7 @@ var _ol_interaction_Extent_ = function(opt_options) { } /* Inherit ol.interaction.Pointer */ - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: _ol_interaction_Extent_.handleDownEvent_, handleDragEvent: _ol_interaction_Extent_.handleDragEvent_, handleEvent: _ol_interaction_Extent_.handleEvent_, @@ -123,7 +123,7 @@ var _ol_interaction_Extent_ = function(opt_options) { } }; -inherits(_ol_interaction_Extent_, _ol_interaction_Pointer_); +inherits(_ol_interaction_Extent_, PointerInteraction); /** * @param {ol.MapBrowserEvent} mapBrowserEvent Event. @@ -140,7 +140,7 @@ _ol_interaction_Extent_.handleEvent_ = function(mapBrowserEvent) { this.handlePointerMove_(mapBrowserEvent); } //call pointer to determine up/down/drag - _ol_interaction_Pointer_.handleEvent.call(this, mapBrowserEvent); + PointerInteraction.handleEvent.call(this, mapBrowserEvent); //return false to stop propagation return false; }; @@ -416,7 +416,7 @@ _ol_interaction_Extent_.prototype.createOrUpdatePointerFeature_ = function(verte _ol_interaction_Extent_.prototype.setMap = function(map) { this.extentOverlay_.setMap(map); this.vertexOverlay_.setMap(map); - _ol_interaction_Pointer_.prototype.setMap.call(this, map); + PointerInteraction.prototype.setMap.call(this, map); }; /** diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index 821d64e8c2..74c941e92a 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -17,7 +17,7 @@ import {boundingExtent, buffer, createOrUpdateFromCoordinate} from '../extent.js import GeometryType from '../geom/GeometryType.js'; import Point from '../geom/Point.js'; import _ol_interaction_ModifyEventType_ from '../interaction/ModifyEventType.js'; -import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; +import PointerInteraction from '../interaction/Pointer.js'; import VectorLayer from '../layer/Vector.js'; import VectorSource from '../source/Vector.js'; import VectorEventType from '../source/VectorEventType.js'; @@ -45,7 +45,7 @@ import _ol_style_Style_ from '../style/Style.js'; */ var _ol_interaction_Modify_ = function(options) { - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: _ol_interaction_Modify_.handleDownEvent_, handleDragEvent: _ol_interaction_Modify_.handleDragEvent_, handleEvent: _ol_interaction_Modify_.handleEvent, @@ -227,7 +227,7 @@ var _ol_interaction_Modify_ = function(options) { }; -inherits(_ol_interaction_Modify_, _ol_interaction_Pointer_); +inherits(_ol_interaction_Modify_, PointerInteraction); /** @@ -321,7 +321,7 @@ _ol_interaction_Modify_.prototype.setActive = function(active) { this.overlay_.getSource().removeFeature(this.vertexFeature_); this.vertexFeature_ = null; } - _ol_interaction_Pointer_.prototype.setActive.call(this, active); + PointerInteraction.prototype.setActive.call(this, active); }; @@ -330,7 +330,7 @@ _ol_interaction_Modify_.prototype.setActive = function(active) { */ _ol_interaction_Modify_.prototype.setMap = function(map) { this.overlay_.setMap(map); - _ol_interaction_Pointer_.prototype.setMap.call(this, map); + PointerInteraction.prototype.setMap.call(this, map); }; @@ -823,7 +823,7 @@ _ol_interaction_Modify_.handleEvent = function(mapBrowserEvent) { this.ignoreNextSingleClick_ = false; } - return _ol_interaction_Pointer_.handleEvent.call(this, mapBrowserEvent) && + return PointerInteraction.handleEvent.call(this, mapBrowserEvent) && !handled; }; diff --git a/src/ol/interaction/PinchRotate.js b/src/ol/interaction/PinchRotate.js index bfa8f3b177..e9ae3c6c48 100644 --- a/src/ol/interaction/PinchRotate.js +++ b/src/ol/interaction/PinchRotate.js @@ -5,7 +5,7 @@ import {inherits} from '../index.js'; import ViewHint from '../ViewHint.js'; import {FALSE} from '../functions.js'; import Interaction from '../interaction/Interaction.js'; -import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; +import PointerInteraction from '../interaction/Pointer.js'; import RotationConstraint from '../RotationConstraint.js'; /** @@ -20,7 +20,7 @@ import RotationConstraint from '../RotationConstraint.js'; */ var PinchRotate = function(opt_options) { - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: PinchRotate.handleDownEvent_, handleDragEvent: PinchRotate.handleDragEvent_, handleUpEvent: PinchRotate.handleUpEvent_ @@ -66,7 +66,7 @@ var PinchRotate = function(opt_options) { }; -inherits(PinchRotate, _ol_interaction_Pointer_); +inherits(PinchRotate, PointerInteraction); /** @@ -106,7 +106,7 @@ PinchRotate.handleDragEvent_ = function(mapBrowserEvent) { // FIXME: should be the intersection point between the lines: // touch0,touch1 and previousTouch0,previousTouch1 var viewportPosition = map.getViewport().getBoundingClientRect(); - var centroid = _ol_interaction_Pointer_.centroid(this.targetPointers); + var centroid = PointerInteraction.centroid(this.targetPointers); centroid[0] -= viewportPosition.left; centroid[1] -= viewportPosition.top; this.anchor_ = map.getCoordinateFromPixel(centroid); diff --git a/src/ol/interaction/PinchZoom.js b/src/ol/interaction/PinchZoom.js index edb6c080c1..9d75905918 100644 --- a/src/ol/interaction/PinchZoom.js +++ b/src/ol/interaction/PinchZoom.js @@ -5,7 +5,7 @@ import {inherits} from '../index.js'; import ViewHint from '../ViewHint.js'; import {FALSE} from '../functions.js'; import Interaction from '../interaction/Interaction.js'; -import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; +import PointerInteraction from '../interaction/Pointer.js'; /** * @classdesc @@ -19,7 +19,7 @@ import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; */ var PinchZoom = function(opt_options) { - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: PinchZoom.handleDownEvent_, handleDragEvent: PinchZoom.handleDragEvent_, handleUpEvent: PinchZoom.handleUpEvent_ @@ -59,7 +59,7 @@ var PinchZoom = function(opt_options) { }; -inherits(PinchZoom, _ol_interaction_Pointer_); +inherits(PinchZoom, PointerInteraction); /** @@ -104,7 +104,7 @@ PinchZoom.handleDragEvent_ = function(mapBrowserEvent) { // scale anchor point. var viewportPosition = map.getViewport().getBoundingClientRect(); - var centroid = _ol_interaction_Pointer_.centroid(this.targetPointers); + var centroid = PointerInteraction.centroid(this.targetPointers); centroid[0] -= viewportPosition.left; centroid[1] -= viewportPosition.top; this.anchor_ = map.getCoordinateFromPixel(centroid); diff --git a/src/ol/interaction/Pointer.js b/src/ol/interaction/Pointer.js index a26586c5e0..12782bd0bb 100644 --- a/src/ol/interaction/Pointer.js +++ b/src/ol/interaction/Pointer.js @@ -23,12 +23,12 @@ import _ol_obj_ from '../obj.js'; * @extends {ol.interaction.Interaction} * @api */ -var _ol_interaction_Pointer_ = function(opt_options) { +var PointerInteraction = function(opt_options) { var options = opt_options ? opt_options : {}; var handleEvent = options.handleEvent ? - options.handleEvent : _ol_interaction_Pointer_.handleEvent; + options.handleEvent : PointerInteraction.handleEvent; Interaction.call(this, { handleEvent: handleEvent @@ -39,28 +39,28 @@ var _ol_interaction_Pointer_ = function(opt_options) { * @private */ this.handleDownEvent_ = options.handleDownEvent ? - options.handleDownEvent : _ol_interaction_Pointer_.handleDownEvent; + options.handleDownEvent : PointerInteraction.handleDownEvent; /** * @type {function(ol.MapBrowserPointerEvent)} * @private */ this.handleDragEvent_ = options.handleDragEvent ? - options.handleDragEvent : _ol_interaction_Pointer_.handleDragEvent; + options.handleDragEvent : PointerInteraction.handleDragEvent; /** * @type {function(ol.MapBrowserPointerEvent)} * @private */ this.handleMoveEvent_ = options.handleMoveEvent ? - options.handleMoveEvent : _ol_interaction_Pointer_.handleMoveEvent; + options.handleMoveEvent : PointerInteraction.handleMoveEvent; /** * @type {function(ol.MapBrowserPointerEvent):boolean} * @private */ this.handleUpEvent_ = options.handleUpEvent ? - options.handleUpEvent : _ol_interaction_Pointer_.handleUpEvent; + options.handleUpEvent : PointerInteraction.handleUpEvent; /** * @type {boolean} @@ -82,14 +82,14 @@ var _ol_interaction_Pointer_ = function(opt_options) { }; -inherits(_ol_interaction_Pointer_, Interaction); +inherits(PointerInteraction, Interaction); /** * @param {Array.} pointerEvents List of events. * @return {ol.Pixel} Centroid pixel. */ -_ol_interaction_Pointer_.centroid = function(pointerEvents) { +PointerInteraction.centroid = function(pointerEvents) { var length = pointerEvents.length; var clientX = 0; var clientY = 0; @@ -107,7 +107,7 @@ _ol_interaction_Pointer_.centroid = function(pointerEvents) { * or pointerup event. * @private */ -_ol_interaction_Pointer_.prototype.isPointerDraggingEvent_ = function(mapBrowserEvent) { +PointerInteraction.prototype.isPointerDraggingEvent_ = function(mapBrowserEvent) { var type = mapBrowserEvent.type; return type === MapBrowserEventType.POINTERDOWN || type === MapBrowserEventType.POINTERDRAG || @@ -119,7 +119,7 @@ _ol_interaction_Pointer_.prototype.isPointerDraggingEvent_ = function(mapBrowser * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. * @private */ -_ol_interaction_Pointer_.prototype.updateTrackedPointers_ = function(mapBrowserEvent) { +PointerInteraction.prototype.updateTrackedPointers_ = function(mapBrowserEvent) { if (this.isPointerDraggingEvent_(mapBrowserEvent)) { var event = mapBrowserEvent.pointerEvent; @@ -142,7 +142,7 @@ _ol_interaction_Pointer_.prototype.updateTrackedPointers_ = function(mapBrowserE * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. * @this {ol.interaction.Pointer} */ -_ol_interaction_Pointer_.handleDragEvent = nullFunction; +PointerInteraction.handleDragEvent = nullFunction; /** @@ -150,7 +150,7 @@ _ol_interaction_Pointer_.handleDragEvent = nullFunction; * @return {boolean} Capture dragging. * @this {ol.interaction.Pointer} */ -_ol_interaction_Pointer_.handleUpEvent = FALSE; +PointerInteraction.handleUpEvent = FALSE; /** @@ -158,14 +158,14 @@ _ol_interaction_Pointer_.handleUpEvent = FALSE; * @return {boolean} Capture dragging. * @this {ol.interaction.Pointer} */ -_ol_interaction_Pointer_.handleDownEvent = FALSE; +PointerInteraction.handleDownEvent = FALSE; /** * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. * @this {ol.interaction.Pointer} */ -_ol_interaction_Pointer_.handleMoveEvent = nullFunction; +PointerInteraction.handleMoveEvent = nullFunction; /** @@ -177,7 +177,7 @@ _ol_interaction_Pointer_.handleMoveEvent = nullFunction; * @this {ol.interaction.Pointer} * @api */ -_ol_interaction_Pointer_.handleEvent = function(mapBrowserEvent) { +PointerInteraction.handleEvent = function(mapBrowserEvent) { if (!(mapBrowserEvent instanceof MapBrowserPointerEvent)) { return true; } @@ -217,8 +217,8 @@ _ol_interaction_Pointer_.handleEvent = function(mapBrowserEvent) { * @return {boolean} Should the event be stopped? * @protected */ -_ol_interaction_Pointer_.prototype.shouldStopEvent = function(handled) { +PointerInteraction.prototype.shouldStopEvent = function(handled) { return handled; }; -export default _ol_interaction_Pointer_; +export default PointerInteraction; diff --git a/src/ol/interaction/Snap.js b/src/ol/interaction/Snap.js index 8bcbb93177..467aadada7 100644 --- a/src/ol/interaction/Snap.js +++ b/src/ol/interaction/Snap.js @@ -11,7 +11,7 @@ import {boundingExtent, createEmpty} from '../extent.js'; import {TRUE, FALSE} from '../functions.js'; import GeometryType from '../geom/GeometryType.js'; import {fromCircle} from '../geom/Polygon.js'; -import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; +import PointerInteraction from '../interaction/Pointer.js'; import _ol_obj_ from '../obj.js'; import VectorSource from '../source/Vector.js'; import VectorEventType from '../source/VectorEventType.js'; @@ -41,7 +41,7 @@ import RBush from '../structs/RBush.js'; */ var _ol_interaction_Snap_ = function(opt_options) { - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleEvent: _ol_interaction_Snap_.handleEvent_, handleDownEvent: TRUE, handleUpEvent: _ol_interaction_Snap_.handleUpEvent_ @@ -149,7 +149,7 @@ var _ol_interaction_Snap_ = function(opt_options) { }; }; -inherits(_ol_interaction_Snap_, _ol_interaction_Pointer_); +inherits(_ol_interaction_Snap_, PointerInteraction); /** @@ -304,7 +304,7 @@ _ol_interaction_Snap_.prototype.setMap = function(map) { keys.length = 0; features.forEach(this.forEachFeatureRemove_.bind(this)); } - _ol_interaction_Pointer_.prototype.setMap.call(this, map); + PointerInteraction.prototype.setMap.call(this, map); if (map) { if (this.features_) { @@ -600,7 +600,7 @@ _ol_interaction_Snap_.handleEvent_ = function(evt) { evt.coordinate = result.vertex.slice(0, 2); evt.pixel = result.vertexPixel; } - return _ol_interaction_Pointer_.handleEvent.call(this, evt); + return PointerInteraction.handleEvent.call(this, evt); }; diff --git a/src/ol/interaction/Translate.js b/src/ol/interaction/Translate.js index 58d2ff34e6..fd3a4bd538 100644 --- a/src/ol/interaction/Translate.js +++ b/src/ol/interaction/Translate.js @@ -8,7 +8,7 @@ import _ol_events_ from '../events.js'; import Event from '../events/Event.js'; import {TRUE} from '../functions.js'; import {includes} from '../array.js'; -import _ol_interaction_Pointer_ from '../interaction/Pointer.js'; +import PointerInteraction from '../interaction/Pointer.js'; import InteractionProperty from '../interaction/Property.js'; import _ol_interaction_TranslateEventType_ from '../interaction/TranslateEventType.js'; @@ -23,7 +23,7 @@ import _ol_interaction_TranslateEventType_ from '../interaction/TranslateEventTy * @api */ var _ol_interaction_Translate_ = function(opt_options) { - _ol_interaction_Pointer_.call(this, { + PointerInteraction.call(this, { handleDownEvent: _ol_interaction_Translate_.handleDownEvent_, handleDragEvent: _ol_interaction_Translate_.handleDragEvent_, handleMoveEvent: _ol_interaction_Translate_.handleMoveEvent_, @@ -85,7 +85,7 @@ var _ol_interaction_Translate_ = function(opt_options) { }; -inherits(_ol_interaction_Translate_, _ol_interaction_Pointer_); +inherits(_ol_interaction_Translate_, PointerInteraction); /** @@ -231,7 +231,7 @@ _ol_interaction_Translate_.prototype.setHitTolerance = function(hitTolerance) { */ _ol_interaction_Translate_.prototype.setMap = function(map) { var oldMap = this.getMap(); - _ol_interaction_Pointer_.prototype.setMap.call(this, map); + PointerInteraction.prototype.setMap.call(this, map); this.updateState_(oldMap); }; From c7e2f6b62fca5fd65a5a4f7c00e7347bd37a6ce3 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:40:51 -0700 Subject: [PATCH 15/35] Rename _ol_interaction_Extent_ to ExtentInteraction --- examples/extent-interaction.js | 4 +- src/ol/interaction/Extent.js | 66 ++++++++++++------------- test/spec/ol/interaction/extent.test.js | 6 +-- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/examples/extent-interaction.js b/examples/extent-interaction.js index 8314d550a4..b048326402 100644 --- a/examples/extent-interaction.js +++ b/examples/extent-interaction.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import _ol_events_condition_ from '../src/ol/events/condition.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; -import _ol_interaction_Extent_ from '../src/ol/interaction/Extent.js'; +import ExtentInteraction from '../src/ol/interaction/Extent.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; @@ -29,7 +29,7 @@ var map = new Map({ }) }); -var extent = new _ol_interaction_Extent_({ +var extent = new ExtentInteraction({ condition: _ol_events_condition_.platformModifierKeyOnly }); map.addInteraction(extent); diff --git a/src/ol/interaction/Extent.js b/src/ol/interaction/Extent.js index fefef6dc7d..0ec6a26a79 100644 --- a/src/ol/interaction/Extent.js +++ b/src/ol/interaction/Extent.js @@ -29,7 +29,7 @@ import _ol_style_Style_ from '../style/Style.js'; * @param {olx.interaction.ExtentOptions=} opt_options Options. * @api */ -var _ol_interaction_Extent_ = function(opt_options) { +var ExtentInteraction = function(opt_options) { var options = opt_options || {}; @@ -82,10 +82,10 @@ var _ol_interaction_Extent_ = function(opt_options) { /* Inherit ol.interaction.Pointer */ PointerInteraction.call(this, { - handleDownEvent: _ol_interaction_Extent_.handleDownEvent_, - handleDragEvent: _ol_interaction_Extent_.handleDragEvent_, - handleEvent: _ol_interaction_Extent_.handleEvent_, - handleUpEvent: _ol_interaction_Extent_.handleUpEvent_ + handleDownEvent: ExtentInteraction.handleDownEvent_, + handleDragEvent: ExtentInteraction.handleDragEvent_, + handleEvent: ExtentInteraction.handleEvent_, + handleUpEvent: ExtentInteraction.handleUpEvent_ }); /** @@ -98,7 +98,7 @@ var _ol_interaction_Extent_ = function(opt_options) { useSpatialIndex: false, wrapX: !!opt_options.wrapX }), - style: opt_options.boxStyle ? opt_options.boxStyle : _ol_interaction_Extent_.getDefaultExtentStyleFunction_(), + style: opt_options.boxStyle ? opt_options.boxStyle : ExtentInteraction.getDefaultExtentStyleFunction_(), updateWhileAnimating: true, updateWhileInteracting: true }); @@ -113,7 +113,7 @@ var _ol_interaction_Extent_ = function(opt_options) { useSpatialIndex: false, wrapX: !!opt_options.wrapX }), - style: opt_options.pointerStyle ? opt_options.pointerStyle : _ol_interaction_Extent_.getDefaultPointerStyleFunction_(), + style: opt_options.pointerStyle ? opt_options.pointerStyle : ExtentInteraction.getDefaultPointerStyleFunction_(), updateWhileAnimating: true, updateWhileInteracting: true }); @@ -123,7 +123,7 @@ var _ol_interaction_Extent_ = function(opt_options) { } }; -inherits(_ol_interaction_Extent_, PointerInteraction); +inherits(ExtentInteraction, PointerInteraction); /** * @param {ol.MapBrowserEvent} mapBrowserEvent Event. @@ -131,7 +131,7 @@ inherits(_ol_interaction_Extent_, PointerInteraction); * @this {ol.interaction.Extent} * @private */ -_ol_interaction_Extent_.handleEvent_ = function(mapBrowserEvent) { +ExtentInteraction.handleEvent_ = function(mapBrowserEvent) { if (!(mapBrowserEvent instanceof MapBrowserPointerEvent)) { return true; } @@ -151,7 +151,7 @@ _ol_interaction_Extent_.handleEvent_ = function(mapBrowserEvent) { * @this {ol.interaction.Extent} * @private */ -_ol_interaction_Extent_.handleDownEvent_ = function(mapBrowserEvent) { +ExtentInteraction.handleDownEvent_ = function(mapBrowserEvent) { var pixel = mapBrowserEvent.pixel; var map = mapBrowserEvent.map; @@ -183,15 +183,15 @@ _ol_interaction_Extent_.handleDownEvent_ = function(mapBrowserEvent) { //snap to point if (x !== null && y !== null) { - this.pointerHandler_ = _ol_interaction_Extent_.getPointHandler_(getOpposingPoint(vertex)); + this.pointerHandler_ = ExtentInteraction.getPointHandler_(getOpposingPoint(vertex)); //snap to edge } else if (x !== null) { - this.pointerHandler_ = _ol_interaction_Extent_.getEdgeHandler_( + this.pointerHandler_ = ExtentInteraction.getEdgeHandler_( getOpposingPoint([x, extent[1]]), getOpposingPoint([x, extent[3]]) ); } else if (y !== null) { - this.pointerHandler_ = _ol_interaction_Extent_.getEdgeHandler_( + this.pointerHandler_ = ExtentInteraction.getEdgeHandler_( getOpposingPoint([extent[0], y]), getOpposingPoint([extent[2], y]) ); @@ -200,7 +200,7 @@ _ol_interaction_Extent_.handleDownEvent_ = function(mapBrowserEvent) { } else { vertex = map.getCoordinateFromPixel(pixel); this.setExtent([vertex[0], vertex[1], vertex[0], vertex[1]]); - this.pointerHandler_ = _ol_interaction_Extent_.getPointHandler_(vertex); + this.pointerHandler_ = ExtentInteraction.getPointHandler_(vertex); } return true; //event handled; start downup sequence }; @@ -211,7 +211,7 @@ _ol_interaction_Extent_.handleDownEvent_ = function(mapBrowserEvent) { * @this {ol.interaction.Extent} * @private */ -_ol_interaction_Extent_.handleDragEvent_ = function(mapBrowserEvent) { +ExtentInteraction.handleDragEvent_ = function(mapBrowserEvent) { if (this.pointerHandler_) { var pixelCoordinate = mapBrowserEvent.coordinate; this.setExtent(this.pointerHandler_(pixelCoordinate)); @@ -226,7 +226,7 @@ _ol_interaction_Extent_.handleDragEvent_ = function(mapBrowserEvent) { * @this {ol.interaction.Extent} * @private */ -_ol_interaction_Extent_.handleUpEvent_ = function(mapBrowserEvent) { +ExtentInteraction.handleUpEvent_ = function(mapBrowserEvent) { this.pointerHandler_ = null; //If bbox is zero area, set to null; var extent = this.getExtent(); @@ -242,7 +242,7 @@ _ol_interaction_Extent_.handleUpEvent_ = function(mapBrowserEvent) { * @return {ol.StyleFunction} Default Extent style * @private */ -_ol_interaction_Extent_.getDefaultExtentStyleFunction_ = function() { +ExtentInteraction.getDefaultExtentStyleFunction_ = function() { var style = _ol_style_Style_.createDefaultEditing(); return function(feature, resolution) { return style[GeometryType.POLYGON]; @@ -255,7 +255,7 @@ _ol_interaction_Extent_.getDefaultExtentStyleFunction_ = function() { * @return {ol.StyleFunction} Default pointer style * @private */ -_ol_interaction_Extent_.getDefaultPointerStyleFunction_ = function() { +ExtentInteraction.getDefaultPointerStyleFunction_ = function() { var style = _ol_style_Style_.createDefaultEditing(); return function(feature, resolution) { return style[GeometryType.POINT]; @@ -267,7 +267,7 @@ _ol_interaction_Extent_.getDefaultPointerStyleFunction_ = function() { * @returns {function (ol.Coordinate): ol.Extent} event handler * @private */ -_ol_interaction_Extent_.getPointHandler_ = function(fixedPoint) { +ExtentInteraction.getPointHandler_ = function(fixedPoint) { return function(point) { return boundingExtent([fixedPoint, point]); }; @@ -279,7 +279,7 @@ _ol_interaction_Extent_.getPointHandler_ = function(fixedPoint) { * @returns {function (ol.Coordinate): ol.Extent|null} event handler * @private */ -_ol_interaction_Extent_.getEdgeHandler_ = function(fixedP1, fixedP2) { +ExtentInteraction.getEdgeHandler_ = function(fixedP1, fixedP2) { if (fixedP1[0] == fixedP2[0]) { return function(point) { return boundingExtent([fixedP1, [point[0], fixedP2[1]]]); @@ -298,7 +298,7 @@ _ol_interaction_Extent_.getEdgeHandler_ = function(fixedP1, fixedP2) { * @returns {Array>} extent line segments * @private */ -_ol_interaction_Extent_.getSegments_ = function(extent) { +ExtentInteraction.getSegments_ = function(extent) { return [ [[extent[0], extent[1]], [extent[0], extent[3]]], [[extent[0], extent[3]], [extent[2], extent[3]]], @@ -313,7 +313,7 @@ _ol_interaction_Extent_.getSegments_ = function(extent) { * @returns {ol.Coordinate|null} snapped vertex on extent * @private */ -_ol_interaction_Extent_.prototype.snapToVertex_ = function(pixel, map) { +ExtentInteraction.prototype.snapToVertex_ = function(pixel, map) { var pixelCoordinate = map.getCoordinateFromPixel(pixel); var sortByDistance = function(a, b) { return _ol_coordinate_.squaredDistanceToSegment(pixelCoordinate, a) - @@ -322,7 +322,7 @@ _ol_interaction_Extent_.prototype.snapToVertex_ = function(pixel, map) { var extent = this.getExtent(); if (extent) { //convert extents to line segments and find the segment closest to pixelCoordinate - var segments = _ol_interaction_Extent_.getSegments_(extent); + var segments = ExtentInteraction.getSegments_(extent); segments.sort(sortByDistance); var closestSegment = segments[0]; @@ -353,7 +353,7 @@ _ol_interaction_Extent_.prototype.snapToVertex_ = function(pixel, map) { * @param {ol.MapBrowserEvent} mapBrowserEvent pointer move event * @private */ -_ol_interaction_Extent_.prototype.handlePointerMove_ = function(mapBrowserEvent) { +ExtentInteraction.prototype.handlePointerMove_ = function(mapBrowserEvent) { var pixel = mapBrowserEvent.pixel; var map = mapBrowserEvent.map; @@ -369,7 +369,7 @@ _ol_interaction_Extent_.prototype.handlePointerMove_ = function(mapBrowserEvent) * @returns {ol.Feature} extent as featrue * @private */ -_ol_interaction_Extent_.prototype.createOrUpdateExtentFeature_ = function(extent) { +ExtentInteraction.prototype.createOrUpdateExtentFeature_ = function(extent) { var extentFeature = this.extentFeature_; if (!extentFeature) { @@ -396,7 +396,7 @@ _ol_interaction_Extent_.prototype.createOrUpdateExtentFeature_ = function(extent * @returns {ol.Feature} vertex as feature * @private */ -_ol_interaction_Extent_.prototype.createOrUpdatePointerFeature_ = function(vertex) { +ExtentInteraction.prototype.createOrUpdatePointerFeature_ = function(vertex) { var vertexFeature = this.vertexFeature_; if (!vertexFeature) { vertexFeature = new Feature(new Point(vertex)); @@ -413,7 +413,7 @@ _ol_interaction_Extent_.prototype.createOrUpdatePointerFeature_ = function(verte /** * @inheritDoc */ -_ol_interaction_Extent_.prototype.setMap = function(map) { +ExtentInteraction.prototype.setMap = function(map) { this.extentOverlay_.setMap(map); this.vertexOverlay_.setMap(map); PointerInteraction.prototype.setMap.call(this, map); @@ -425,7 +425,7 @@ _ol_interaction_Extent_.prototype.setMap = function(map) { * @return {ol.Extent} Drawn extent in the view projection. * @api */ -_ol_interaction_Extent_.prototype.getExtent = function() { +ExtentInteraction.prototype.getExtent = function() { return this.extent_; }; @@ -435,11 +435,11 @@ _ol_interaction_Extent_.prototype.getExtent = function() { * @param {ol.Extent} extent Extent * @api */ -_ol_interaction_Extent_.prototype.setExtent = function(extent) { +ExtentInteraction.prototype.setExtent = function(extent) { //Null extent means no bbox this.extent_ = extent ? extent : null; this.createOrUpdateExtentFeature_(extent); - this.dispatchEvent(new _ol_interaction_Extent_.Event(this.extent_)); + this.dispatchEvent(new ExtentInteraction.Event(this.extent_)); }; @@ -453,7 +453,7 @@ _ol_interaction_Extent_.prototype.setExtent = function(extent) { * @param {ol.Extent} extent the new extent * @extends {ol.events.Event} */ -_ol_interaction_Extent_.Event = function(extent) { +ExtentInteraction.Event = function(extent) { Event.call(this, _ol_interaction_ExtentEventType_.EXTENTCHANGED); /** @@ -464,5 +464,5 @@ _ol_interaction_Extent_.Event = function(extent) { this.extent = extent; }; -inherits(_ol_interaction_Extent_.Event, Event); -export default _ol_interaction_Extent_; +inherits(ExtentInteraction.Event, Event); +export default ExtentInteraction; diff --git a/test/spec/ol/interaction/extent.test.js b/test/spec/ol/interaction/extent.test.js index 31c9278223..7035966775 100644 --- a/test/spec/ol/interaction/extent.test.js +++ b/test/spec/ol/interaction/extent.test.js @@ -1,7 +1,7 @@ import Map from '../../../../src/ol/Map.js'; import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js'; import View from '../../../../src/ol/View.js'; -import _ol_interaction_Extent_ from '../../../../src/ol/interaction/Extent.js'; +import ExtentInteraction from '../../../../src/ol/interaction/Extent.js'; import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; describe('ol.interaction.Extent', function() { @@ -24,7 +24,7 @@ describe('ol.interaction.Extent', function() { }); map.renderSync(); - interaction = new _ol_interaction_Extent_(); + interaction = new ExtentInteraction(); map.addInteraction(interaction); }); @@ -66,7 +66,7 @@ describe('ol.interaction.Extent', function() { it('can be configured with an extent', function() { expect(function() { - new _ol_interaction_Extent_({ + new ExtentInteraction({ extent: [-10, -10, 10, 10] }); }).to.not.throwException(); From edcdeb10365cf3dada7335d25b651fff39c9202e Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:45:55 -0700 Subject: [PATCH 16/35] Fix the snap example --- examples/snap.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/snap.js b/examples/snap.js index 73335e12b7..ed1796702e 100644 --- a/examples/snap.js +++ b/examples/snap.js @@ -45,7 +45,7 @@ var map = new Map({ }) }); -var Modify = { +var ExampleModify = { init: function() { this.select = new _ol_interaction_Select_(); map.addInteraction(this.select); @@ -69,7 +69,7 @@ var Modify = { this.modify.setActive(active); } }; -Modify.init(); +ExampleModify.init(); var optionsForm = document.getElementById('options-form'); @@ -126,20 +126,20 @@ optionsForm.onchange = function(e) { var type = e.target.getAttribute('name'); var value = e.target.value; if (type == 'draw-type') { - Draw.getActive() && Draw.setActive(true); + ExampleDraw.getActive() && ExampleDraw.setActive(true); } else if (type == 'interaction') { if (value == 'modify') { - Draw.setActive(false); - Modify.setActive(true); + ExampleDraw.setActive(false); + ExampleModify.setActive(true); } else if (value == 'draw') { - Draw.setActive(true); - Modify.setActive(false); + ExampleDraw.setActive(true); + ExampleModify.setActive(false); } } }; -Draw.setActive(true); -Modify.setActive(false); +ExampleDraw.setActive(true); +ExampleModify.setActive(false); // The snap interaction must be added after the Modify and Draw interactions // in order for its map browser event handlers to be fired first. Its handlers From 682b4402a0d0884b296a61328558e728ba9e6cec Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:50:51 -0700 Subject: [PATCH 17/35] Rename _ol_interaction_Modify_ to Modify --- examples/draw-and-modify-features.js | 4 +- examples/modify-features.js | 4 +- examples/modify-test.js | 4 +- examples/snap.js | 4 +- examples/vector-esri-edit.js | 4 +- src/ol/interaction/Modify.js | 124 ++++++++++++------------ test/spec/ol/interaction/modify.test.js | 36 +++---- 7 files changed, 90 insertions(+), 90 deletions(-) diff --git a/examples/draw-and-modify-features.js b/examples/draw-and-modify-features.js index ef65dab1e2..8adef2814a 100644 --- a/examples/draw-and-modify-features.js +++ b/examples/draw-and-modify-features.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import Draw from '../src/ol/interaction/Draw.js'; -import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; +import Modify from '../src/ol/interaction/Modify.js'; import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; @@ -45,7 +45,7 @@ var map = new Map({ }) }); -var modify = new _ol_interaction_Modify_({source: source}); +var modify = new Modify({source: source}); map.addInteraction(modify); var draw, snap; // global so we can remove them later diff --git a/examples/modify-features.js b/examples/modify-features.js index ba85ad8957..6d7952278a 100644 --- a/examples/modify-features.js +++ b/examples/modify-features.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; -import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; +import Modify from '../src/ol/interaction/Modify.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; @@ -26,7 +26,7 @@ var select = new _ol_interaction_Select_({ wrapX: false }); -var modify = new _ol_interaction_Modify_({ +var modify = new Modify({ features: select.getFeatures() }); diff --git a/examples/modify-test.js b/examples/modify-test.js index e9991ff0c2..a4a536eebd 100644 --- a/examples/modify-test.js +++ b/examples/modify-test.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; -import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; +import Modify from '../src/ol/interaction/Modify.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; @@ -220,7 +220,7 @@ var select = new _ol_interaction_Select_({ style: overlayStyle }); -var modify = new _ol_interaction_Modify_({ +var modify = new Modify({ features: select.getFeatures(), style: overlayStyle, insertVertexCondition: function() { diff --git a/examples/snap.js b/examples/snap.js index ed1796702e..a9d6e4300d 100644 --- a/examples/snap.js +++ b/examples/snap.js @@ -1,7 +1,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import Draw from '../src/ol/interaction/Draw.js'; -import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; +import Modify from '../src/ol/interaction/Modify.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js'; import TileLayer from '../src/ol/layer/Tile.js'; @@ -50,7 +50,7 @@ var ExampleModify = { this.select = new _ol_interaction_Select_(); map.addInteraction(this.select); - this.modify = new _ol_interaction_Modify_({ + this.modify = new Modify({ features: this.select.getFeatures() }); map.addInteraction(this.modify); diff --git a/examples/vector-esri-edit.js b/examples/vector-esri-edit.js index f0e15a643d..af2797a186 100644 --- a/examples/vector-esri-edit.js +++ b/examples/vector-esri-edit.js @@ -3,7 +3,7 @@ import View from '../src/ol/View.js'; import EsriJSON from '../src/ol/format/EsriJSON.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import Draw from '../src/ol/interaction/Draw.js'; -import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; +import Modify from '../src/ol/interaction/Modify.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; @@ -71,7 +71,7 @@ var select = new _ol_interaction_Select_(); select.setActive(false); var selected = select.getFeatures(); -var modify = new _ol_interaction_Modify_({ +var modify = new Modify({ features: selected }); modify.setActive(false); diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index 74c941e92a..554d39bc38 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -43,13 +43,13 @@ import _ol_style_Style_ from '../style/Style.js'; * @fires ol.interaction.Modify.Event * @api */ -var _ol_interaction_Modify_ = function(options) { +var Modify = function(options) { PointerInteraction.call(this, { - handleDownEvent: _ol_interaction_Modify_.handleDownEvent_, - handleDragEvent: _ol_interaction_Modify_.handleDragEvent_, - handleEvent: _ol_interaction_Modify_.handleEvent, - handleUpEvent: _ol_interaction_Modify_.handleUpEvent_ + handleDownEvent: Modify.handleDownEvent_, + handleDragEvent: Modify.handleDragEvent_, + handleEvent: Modify.handleEvent, + handleUpEvent: Modify.handleUpEvent_ }); /** @@ -163,7 +163,7 @@ var _ol_interaction_Modify_ = function(options) { wrapX: !!options.wrapX }), style: options.style ? options.style : - _ol_interaction_Modify_.getDefaultStyleFunction(), + Modify.getDefaultStyleFunction(), updateWhileAnimating: true, updateWhileInteracting: true }); @@ -227,27 +227,27 @@ var _ol_interaction_Modify_ = function(options) { }; -inherits(_ol_interaction_Modify_, PointerInteraction); +inherits(Modify, PointerInteraction); /** * @define {number} The segment index assigned to a circle's center when * breaking up a cicrle into ModifySegmentDataType segments. */ -_ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX = 0; +Modify.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX = 0; /** * @define {number} The segment index assigned to a circle's circumference when * breaking up a circle into ModifySegmentDataType segments. */ -_ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX = 1; +Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX = 1; /** * @param {ol.Feature} feature Feature. * @private */ -_ol_interaction_Modify_.prototype.addFeature_ = function(feature) { +Modify.prototype.addFeature_ = function(feature) { var geometry = feature.getGeometry(); if (geometry && geometry.getType() in this.SEGMENT_WRITERS_) { this.SEGMENT_WRITERS_[geometry.getType()].call(this, feature, geometry); @@ -265,10 +265,10 @@ _ol_interaction_Modify_.prototype.addFeature_ = function(feature) { * @param {ol.MapBrowserPointerEvent} evt Map browser event * @private */ -_ol_interaction_Modify_.prototype.willModifyFeatures_ = function(evt) { +Modify.prototype.willModifyFeatures_ = function(evt) { if (!this.modified_) { this.modified_ = true; - this.dispatchEvent(new _ol_interaction_Modify_.Event( + this.dispatchEvent(new Modify.Event( _ol_interaction_ModifyEventType_.MODIFYSTART, this.features_, evt)); } }; @@ -278,7 +278,7 @@ _ol_interaction_Modify_.prototype.willModifyFeatures_ = function(evt) { * @param {ol.Feature} feature Feature. * @private */ -_ol_interaction_Modify_.prototype.removeFeature_ = function(feature) { +Modify.prototype.removeFeature_ = function(feature) { this.removeFeatureSegmentData_(feature); // Remove the vertex feature if the collection of canditate features // is empty. @@ -295,7 +295,7 @@ _ol_interaction_Modify_.prototype.removeFeature_ = function(feature) { * @param {ol.Feature} feature Feature. * @private */ -_ol_interaction_Modify_.prototype.removeFeatureSegmentData_ = function(feature) { +Modify.prototype.removeFeatureSegmentData_ = function(feature) { var rBush = this.rBush_; var /** @type {Array.} */ nodesToRemove = []; rBush.forEach( @@ -316,7 +316,7 @@ _ol_interaction_Modify_.prototype.removeFeatureSegmentData_ = function(feature) /** * @inheritDoc */ -_ol_interaction_Modify_.prototype.setActive = function(active) { +Modify.prototype.setActive = function(active) { if (this.vertexFeature_ && !active) { this.overlay_.getSource().removeFeature(this.vertexFeature_); this.vertexFeature_ = null; @@ -328,7 +328,7 @@ _ol_interaction_Modify_.prototype.setActive = function(active) { /** * @inheritDoc */ -_ol_interaction_Modify_.prototype.setMap = function(map) { +Modify.prototype.setMap = function(map) { this.overlay_.setMap(map); PointerInteraction.prototype.setMap.call(this, map); }; @@ -338,7 +338,7 @@ _ol_interaction_Modify_.prototype.setMap = function(map) { * @param {ol.source.Vector.Event} event Event. * @private */ -_ol_interaction_Modify_.prototype.handleSourceAdd_ = function(event) { +Modify.prototype.handleSourceAdd_ = function(event) { if (event.feature) { this.features_.push(event.feature); } @@ -349,7 +349,7 @@ _ol_interaction_Modify_.prototype.handleSourceAdd_ = function(event) { * @param {ol.source.Vector.Event} event Event. * @private */ -_ol_interaction_Modify_.prototype.handleSourceRemove_ = function(event) { +Modify.prototype.handleSourceRemove_ = function(event) { if (event.feature) { this.features_.remove(event.feature); } @@ -360,7 +360,7 @@ _ol_interaction_Modify_.prototype.handleSourceRemove_ = function(event) { * @param {ol.Collection.Event} evt Event. * @private */ -_ol_interaction_Modify_.prototype.handleFeatureAdd_ = function(evt) { +Modify.prototype.handleFeatureAdd_ = function(evt) { this.addFeature_(/** @type {ol.Feature} */ (evt.element)); }; @@ -369,7 +369,7 @@ _ol_interaction_Modify_.prototype.handleFeatureAdd_ = function(evt) { * @param {ol.events.Event} evt Event. * @private */ -_ol_interaction_Modify_.prototype.handleFeatureChange_ = function(evt) { +Modify.prototype.handleFeatureChange_ = function(evt) { if (!this.changingFeature_) { var feature = /** @type {ol.Feature} */ (evt.target); this.removeFeature_(feature); @@ -382,7 +382,7 @@ _ol_interaction_Modify_.prototype.handleFeatureChange_ = function(evt) { * @param {ol.Collection.Event} evt Event. * @private */ -_ol_interaction_Modify_.prototype.handleFeatureRemove_ = function(evt) { +Modify.prototype.handleFeatureRemove_ = function(evt) { var feature = /** @type {ol.Feature} */ (evt.element); this.removeFeature_(feature); }; @@ -393,7 +393,7 @@ _ol_interaction_Modify_.prototype.handleFeatureRemove_ = function(evt) { * @param {ol.geom.Point} geometry Geometry. * @private */ -_ol_interaction_Modify_.prototype.writePointGeometry_ = function(feature, geometry) { +Modify.prototype.writePointGeometry_ = function(feature, geometry) { var coordinates = geometry.getCoordinates(); var segmentData = /** @type {ol.ModifySegmentDataType} */ ({ feature: feature, @@ -409,7 +409,7 @@ _ol_interaction_Modify_.prototype.writePointGeometry_ = function(feature, geomet * @param {ol.geom.MultiPoint} geometry Geometry. * @private */ -_ol_interaction_Modify_.prototype.writeMultiPointGeometry_ = function(feature, geometry) { +Modify.prototype.writeMultiPointGeometry_ = function(feature, geometry) { var points = geometry.getCoordinates(); var coordinates, i, ii, segmentData; for (i = 0, ii = points.length; i < ii; ++i) { @@ -431,7 +431,7 @@ _ol_interaction_Modify_.prototype.writeMultiPointGeometry_ = function(feature, g * @param {ol.geom.LineString} geometry Geometry. * @private */ -_ol_interaction_Modify_.prototype.writeLineStringGeometry_ = function(feature, geometry) { +Modify.prototype.writeLineStringGeometry_ = function(feature, geometry) { var coordinates = geometry.getCoordinates(); var i, ii, segment, segmentData; for (i = 0, ii = coordinates.length - 1; i < ii; ++i) { @@ -452,7 +452,7 @@ _ol_interaction_Modify_.prototype.writeLineStringGeometry_ = function(feature, g * @param {ol.geom.MultiLineString} geometry Geometry. * @private */ -_ol_interaction_Modify_.prototype.writeMultiLineStringGeometry_ = function(feature, geometry) { +Modify.prototype.writeMultiLineStringGeometry_ = function(feature, geometry) { var lines = geometry.getCoordinates(); var coordinates, i, ii, j, jj, segment, segmentData; for (j = 0, jj = lines.length; j < jj; ++j) { @@ -477,7 +477,7 @@ _ol_interaction_Modify_.prototype.writeMultiLineStringGeometry_ = function(featu * @param {ol.geom.Polygon} geometry Geometry. * @private */ -_ol_interaction_Modify_.prototype.writePolygonGeometry_ = function(feature, geometry) { +Modify.prototype.writePolygonGeometry_ = function(feature, geometry) { var rings = geometry.getCoordinates(); var coordinates, i, ii, j, jj, segment, segmentData; for (j = 0, jj = rings.length; j < jj; ++j) { @@ -502,7 +502,7 @@ _ol_interaction_Modify_.prototype.writePolygonGeometry_ = function(feature, geom * @param {ol.geom.MultiPolygon} geometry Geometry. * @private */ -_ol_interaction_Modify_.prototype.writeMultiPolygonGeometry_ = function(feature, geometry) { +Modify.prototype.writeMultiPolygonGeometry_ = function(feature, geometry) { var polygons = geometry.getCoordinates(); var coordinates, i, ii, j, jj, k, kk, rings, segment, segmentData; for (k = 0, kk = polygons.length; k < kk; ++k) { @@ -536,18 +536,18 @@ _ol_interaction_Modify_.prototype.writeMultiPolygonGeometry_ = function(feature, * @param {ol.geom.Circle} geometry Geometry. * @private */ -_ol_interaction_Modify_.prototype.writeCircleGeometry_ = function(feature, geometry) { +Modify.prototype.writeCircleGeometry_ = function(feature, geometry) { var coordinates = geometry.getCenter(); var centerSegmentData = /** @type {ol.ModifySegmentDataType} */ ({ feature: feature, geometry: geometry, - index: _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX, + index: Modify.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX, segment: [coordinates, coordinates] }); var circumferenceSegmentData = /** @type {ol.ModifySegmentDataType} */ ({ feature: feature, geometry: geometry, - index: _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX, + index: Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX, segment: [coordinates, coordinates] }); var featureSegments = [centerSegmentData, circumferenceSegmentData]; @@ -562,7 +562,7 @@ _ol_interaction_Modify_.prototype.writeCircleGeometry_ = function(feature, geome * @param {ol.geom.GeometryCollection} geometry Geometry. * @private */ -_ol_interaction_Modify_.prototype.writeGeometryCollectionGeometry_ = function(feature, geometry) { +Modify.prototype.writeGeometryCollectionGeometry_ = function(feature, geometry) { var i, geometries = geometry.getGeometriesArray(); for (i = 0; i < geometries.length; ++i) { this.SEGMENT_WRITERS_[geometries[i].getType()].call( @@ -576,7 +576,7 @@ _ol_interaction_Modify_.prototype.writeGeometryCollectionGeometry_ = function(fe * @return {ol.Feature} Vertex feature. * @private */ -_ol_interaction_Modify_.prototype.createOrUpdateVertexFeature_ = function(coordinates) { +Modify.prototype.createOrUpdateVertexFeature_ = function(coordinates) { var vertexFeature = this.vertexFeature_; if (!vertexFeature) { vertexFeature = new Feature(new Point(coordinates)); @@ -596,7 +596,7 @@ _ol_interaction_Modify_.prototype.createOrUpdateVertexFeature_ = function(coordi * @return {number} The difference in indexes. * @private */ -_ol_interaction_Modify_.compareIndexes_ = function(a, b) { +Modify.compareIndexes_ = function(a, b) { return a.index - b.index; }; @@ -607,7 +607,7 @@ _ol_interaction_Modify_.compareIndexes_ = function(a, b) { * @this {ol.interaction.Modify} * @private */ -_ol_interaction_Modify_.handleDownEvent_ = function(evt) { +Modify.handleDownEvent_ = function(evt) { if (!this.condition_(evt)) { return false; } @@ -623,7 +623,7 @@ _ol_interaction_Modify_.handleDownEvent_ = function(evt) { var vertexExtent = boundingExtent([vertex]); var segmentDataMatches = this.rBush_.getInExtent(vertexExtent); var componentSegments = {}; - segmentDataMatches.sort(_ol_interaction_Modify_.compareIndexes_); + segmentDataMatches.sort(Modify.compareIndexes_); for (var i = 0, ii = segmentDataMatches.length; i < ii; ++i) { var segmentDataMatch = segmentDataMatches[i]; var segment = segmentDataMatch.segment; @@ -636,9 +636,9 @@ _ol_interaction_Modify_.handleDownEvent_ = function(evt) { componentSegments[uid] = new Array(2); } if (segmentDataMatch.geometry.getType() === GeometryType.CIRCLE && - segmentDataMatch.index === _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) { + segmentDataMatch.index === Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) { - var closestVertex = _ol_interaction_Modify_.closestOnSegmentData_(pixelCoordinate, segmentDataMatch); + var closestVertex = Modify.closestOnSegmentData_(pixelCoordinate, segmentDataMatch); if (_ol_coordinate_.equals(closestVertex, vertex) && !componentSegments[uid][0]) { this.dragSegments_.push([segmentDataMatch, 0]); componentSegments[uid][0] = segmentDataMatch; @@ -683,7 +683,7 @@ _ol_interaction_Modify_.handleDownEvent_ = function(evt) { * @this {ol.interaction.Modify} * @private */ -_ol_interaction_Modify_.handleDragEvent_ = function(evt) { +Modify.handleDragEvent_ = function(evt) { this.ignoreNextSingleClick_ = false; this.willModifyFeatures_(evt); @@ -733,7 +733,7 @@ _ol_interaction_Modify_.handleDragEvent_ = function(evt) { break; case GeometryType.CIRCLE: segment[0] = segment[1] = vertex; - if (segmentData.index === _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX) { + if (segmentData.index === Modify.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX) { this.changingFeature_ = true; geometry.setCenter(vertex); this.changingFeature_ = false; @@ -761,7 +761,7 @@ _ol_interaction_Modify_.handleDragEvent_ = function(evt) { * @this {ol.interaction.Modify} * @private */ -_ol_interaction_Modify_.handleUpEvent_ = function(evt) { +Modify.handleUpEvent_ = function(evt) { var segmentData; var geometry; for (var i = this.dragSegments_.length - 1; i >= 0; --i) { @@ -782,7 +782,7 @@ _ol_interaction_Modify_.handleUpEvent_ = function(evt) { } } if (this.modified_) { - this.dispatchEvent(new _ol_interaction_Modify_.Event( + this.dispatchEvent(new Modify.Event( _ol_interaction_ModifyEventType_.MODIFYEND, this.features_, evt)); this.modified_ = false; } @@ -798,7 +798,7 @@ _ol_interaction_Modify_.handleUpEvent_ = function(evt) { * @this {ol.interaction.Modify} * @api */ -_ol_interaction_Modify_.handleEvent = function(mapBrowserEvent) { +Modify.handleEvent = function(mapBrowserEvent) { if (!(mapBrowserEvent instanceof MapBrowserPointerEvent)) { return true; } @@ -832,7 +832,7 @@ _ol_interaction_Modify_.handleEvent = function(mapBrowserEvent) { * @param {ol.MapBrowserEvent} evt Event. * @private */ -_ol_interaction_Modify_.prototype.handlePointerMove_ = function(evt) { +Modify.prototype.handlePointerMove_ = function(evt) { this.lastPixel_ = evt.pixel; this.handlePointerAtPixel_(evt.pixel, evt.map); }; @@ -843,11 +843,11 @@ _ol_interaction_Modify_.prototype.handlePointerMove_ = function(evt) { * @param {ol.PluggableMap} map Map. * @private */ -_ol_interaction_Modify_.prototype.handlePointerAtPixel_ = function(pixel, map) { +Modify.prototype.handlePointerAtPixel_ = function(pixel, map) { var pixelCoordinate = map.getCoordinateFromPixel(pixel); var sortByDistance = function(a, b) { - return _ol_interaction_Modify_.pointDistanceToSegmentDataSquared_(pixelCoordinate, a) - - _ol_interaction_Modify_.pointDistanceToSegmentDataSquared_(pixelCoordinate, b); + return Modify.pointDistanceToSegmentDataSquared_(pixelCoordinate, a) - + Modify.pointDistanceToSegmentDataSquared_(pixelCoordinate, b); }; var box = buffer(createOrUpdateFromCoordinate(pixelCoordinate), @@ -859,14 +859,14 @@ _ol_interaction_Modify_.prototype.handlePointerAtPixel_ = function(pixel, map) { nodes.sort(sortByDistance); var node = nodes[0]; var closestSegment = node.segment; - var vertex = _ol_interaction_Modify_.closestOnSegmentData_(pixelCoordinate, node); + var vertex = Modify.closestOnSegmentData_(pixelCoordinate, node); var vertexPixel = map.getPixelFromCoordinate(vertex); var dist = _ol_coordinate_.distance(pixel, vertexPixel); if (dist <= this.pixelTolerance_) { var vertexSegments = {}; if (node.geometry.getType() === GeometryType.CIRCLE && - node.index === _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) { + node.index === Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) { this.snappedToVertex_ = true; this.createOrUpdateVertexFeature_(vertex); @@ -917,13 +917,13 @@ _ol_interaction_Modify_.prototype.handlePointerAtPixel_ = function(pixel, map) { * segment we are calculating the distance to. * @return {number} The square of the distance between a point and a line segment. */ -_ol_interaction_Modify_.pointDistanceToSegmentDataSquared_ = function(pointCoordinates, segmentData) { +Modify.pointDistanceToSegmentDataSquared_ = function(pointCoordinates, segmentData) { var geometry = segmentData.geometry; if (geometry.getType() === GeometryType.CIRCLE) { var circleGeometry = /** @type {ol.geom.Circle} */ (geometry); - if (segmentData.index === _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) { + if (segmentData.index === Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) { var distanceToCenterSquared = _ol_coordinate_.squaredDistance(circleGeometry.getCenter(), pointCoordinates); var distanceToCircumference = @@ -943,11 +943,11 @@ _ol_interaction_Modify_.pointDistanceToSegmentDataSquared_ = function(pointCoord * segment which should contain the closest point. * @return {ol.Coordinate} The point closest to the specified line segment. */ -_ol_interaction_Modify_.closestOnSegmentData_ = function(pointCoordinates, segmentData) { +Modify.closestOnSegmentData_ = function(pointCoordinates, segmentData) { var geometry = segmentData.geometry; if (geometry.getType() === GeometryType.CIRCLE && - segmentData.index === _ol_interaction_Modify_.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) { + segmentData.index === Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) { return geometry.getClosestPoint(pointCoordinates); } return _ol_coordinate_.closestOnSegment(pointCoordinates, segmentData.segment); @@ -959,7 +959,7 @@ _ol_interaction_Modify_.closestOnSegmentData_ = function(pointCoordinates, segme * @param {ol.Coordinate} vertex Vertex. * @private */ -_ol_interaction_Modify_.prototype.insertVertex_ = function(segmentData, vertex) { +Modify.prototype.insertVertex_ = function(segmentData, vertex) { var segment = segmentData.segment; var feature = segmentData.feature; var geometry = segmentData.geometry; @@ -1025,12 +1025,12 @@ _ol_interaction_Modify_.prototype.insertVertex_ = function(segmentData, vertex) * @return {boolean} True when a vertex was removed. * @api */ -_ol_interaction_Modify_.prototype.removePoint = function() { +Modify.prototype.removePoint = function() { if (this.lastPointerEvent_ && this.lastPointerEvent_.type != MapBrowserEventType.POINTERDRAG) { var evt = this.lastPointerEvent_; this.willModifyFeatures_(evt); this.removeVertex_(); - this.dispatchEvent(new _ol_interaction_Modify_.Event( + this.dispatchEvent(new Modify.Event( _ol_interaction_ModifyEventType_.MODIFYEND, this.features_, evt)); this.modified_ = false; return true; @@ -1043,7 +1043,7 @@ _ol_interaction_Modify_.prototype.removePoint = function() { * @return {boolean} True when a vertex was removed. * @private */ -_ol_interaction_Modify_.prototype.removeVertex_ = function() { +Modify.prototype.removeVertex_ = function() { var dragSegments = this.dragSegments_; var segmentsByFeature = {}; var deleted = false; @@ -1162,7 +1162,7 @@ _ol_interaction_Modify_.prototype.removeVertex_ = function() { * @param {Array} coordinates Coordinates. * @private */ -_ol_interaction_Modify_.prototype.setGeometryCoordinates_ = function(geometry, coordinates) { +Modify.prototype.setGeometryCoordinates_ = function(geometry, coordinates) { this.changingFeature_ = true; geometry.setCoordinates(coordinates); this.changingFeature_ = false; @@ -1176,7 +1176,7 @@ _ol_interaction_Modify_.prototype.setGeometryCoordinates_ = function(geometry, c * @param {number} delta Delta (1 or -1). * @private */ -_ol_interaction_Modify_.prototype.updateSegmentIndices_ = function( +Modify.prototype.updateSegmentIndices_ = function( geometry, index, depth, delta) { this.rBush_.forEachInExtent(geometry.getExtent(), function(segmentDataMatch) { if (segmentDataMatch.geometry === geometry && @@ -1192,7 +1192,7 @@ _ol_interaction_Modify_.prototype.updateSegmentIndices_ = function( /** * @return {ol.StyleFunction} Styles. */ -_ol_interaction_Modify_.getDefaultStyleFunction = function() { +Modify.getDefaultStyleFunction = function() { var style = _ol_style_Style_.createDefaultEditing(); return function(feature, resolution) { return style[GeometryType.POINT]; @@ -1213,7 +1213,7 @@ _ol_interaction_Modify_.getDefaultStyleFunction = function() { * @param {ol.MapBrowserPointerEvent} mapBrowserPointerEvent Associated * {@link ol.MapBrowserPointerEvent}. */ -_ol_interaction_Modify_.Event = function(type, features, mapBrowserPointerEvent) { +Modify.Event = function(type, features, mapBrowserPointerEvent) { Event.call(this, type); @@ -1231,5 +1231,5 @@ _ol_interaction_Modify_.Event = function(type, features, mapBrowserPointerEvent) */ this.mapBrowserEvent = mapBrowserPointerEvent; }; -inherits(_ol_interaction_Modify_.Event, Event); -export default _ol_interaction_Modify_; +inherits(Modify.Event, Event); +export default Modify; diff --git a/test/spec/ol/interaction/modify.test.js b/test/spec/ol/interaction/modify.test.js index 60d886793c..ca6d3fc80f 100644 --- a/test/spec/ol/interaction/modify.test.js +++ b/test/spec/ol/interaction/modify.test.js @@ -9,7 +9,7 @@ import Circle from '../../../../src/ol/geom/Circle.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import Point from '../../../../src/ol/geom/Point.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; -import _ol_interaction_Modify_ from '../../../../src/ol/interaction/Modify.js'; +import Modify from '../../../../src/ol/interaction/Modify.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; @@ -130,11 +130,11 @@ describe('ol.interaction.Modify', function() { var endevent = events[events.length - 1]; // first event should be modifystary - expect(startevent).to.be.an(_ol_interaction_Modify_.Event); + expect(startevent).to.be.an(Modify.Event); expect(startevent.type).to.eql('modifystart'); // last event should be modifyend - expect(endevent).to.be.an(_ol_interaction_Modify_.Event); + expect(endevent).to.be.an(Modify.Event); expect(endevent.type).to.eql('modifyend'); // make sure we get change events to events array @@ -154,7 +154,7 @@ describe('ol.interaction.Modify', function() { var feature = new Feature( new Point([0, 0])); var features = new Collection([feature]); - var modify = new _ol_interaction_Modify_({ + var modify = new Modify({ features: features }); var rbushEntries = modify.rBush_.getAll(); @@ -165,7 +165,7 @@ describe('ol.interaction.Modify', function() { it('accepts feature without geometry', function() { var feature = new Feature(); var features = new Collection([feature]); - var modify = new _ol_interaction_Modify_({ + var modify = new Modify({ features: features }); var rbushEntries = modify.rBush_.getAll(); @@ -181,7 +181,7 @@ describe('ol.interaction.Modify', function() { var feature = new Feature( new Point([0, 0])); var source = new VectorSource({features: [feature]}); - var modify = new _ol_interaction_Modify_({source: source}); + var modify = new Modify({source: source}); var rbushEntries = modify.rBush_.getAll(); expect(rbushEntries.length).to.be(1); expect(rbushEntries[0].feature).to.be(feature); @@ -199,7 +199,7 @@ describe('ol.interaction.Modify', function() { var second = features[1]; var secondRevision = second.getGeometry().getRevision(); - var modify = new _ol_interaction_Modify_({ + var modify = new Modify({ features: new Collection(features) }); map.addInteraction(modify); @@ -237,7 +237,7 @@ describe('ol.interaction.Modify', function() { var first = features[0]; var firstRevision = first.getGeometry().getRevision(); - var modify = new _ol_interaction_Modify_({ + var modify = new Modify({ features: new Collection(features) }); map.addInteraction(modify); @@ -273,7 +273,7 @@ describe('ol.interaction.Modify', function() { var first = features[0]; var firstRevision = first.getGeometry().getRevision(); - var modify = new _ol_interaction_Modify_({ + var modify = new Modify({ features: new Collection(features) }); map.addInteraction(modify); @@ -309,7 +309,7 @@ describe('ol.interaction.Modify', function() { var first = features[0]; var firstRevision = first.getGeometry().getRevision(); - var modify = new _ol_interaction_Modify_({ + var modify = new Modify({ features: new Collection(features) }); map.addInteraction(modify); @@ -347,7 +347,7 @@ describe('ol.interaction.Modify', function() { features.length = 0; features.push(lineFeature); - var modify = new _ol_interaction_Modify_({ + var modify = new Modify({ features: new Collection(features) }); map.addInteraction(modify); @@ -386,7 +386,7 @@ describe('ol.interaction.Modify', function() { features.length = 0; features.push(circleFeature); - var modify = new _ol_interaction_Modify_({ + var modify = new Modify({ features: new Collection(features) }); map.addInteraction(modify); @@ -417,7 +417,7 @@ describe('ol.interaction.Modify', function() { var modify, feature, events; beforeEach(function() { - modify = new _ol_interaction_Modify_({ + modify = new Modify({ features: new Collection(features) }); map.addInteraction(modify); @@ -522,7 +522,7 @@ describe('ol.interaction.Modify', function() { var modify, feature, events; beforeEach(function() { - modify = new _ol_interaction_Modify_({ + modify = new Modify({ features: new Collection(features), deleteCondition: _ol_events_condition_.doubleClick }); @@ -575,7 +575,7 @@ describe('ol.interaction.Modify', function() { return false; }); - var modify = new _ol_interaction_Modify_({ + var modify = new Modify({ features: new Collection(features), insertVertexCondition: listenerSpy }); @@ -621,7 +621,7 @@ describe('ol.interaction.Modify', function() { features.length = 0; features.push(feature); - var modify = new _ol_interaction_Modify_({ + var modify = new Modify({ features: new Collection(features) }); map.addInteraction(modify); @@ -657,7 +657,7 @@ describe('ol.interaction.Modify', function() { }); it('updates polygon segment data', function() { - var modify = new _ol_interaction_Modify_({ + var modify = new Modify({ features: new Collection(features) }); map.addInteraction(modify); @@ -697,7 +697,7 @@ describe('ol.interaction.Modify', function() { describe('#setActive', function() { it('removes the vertexFeature of deactivation', function() { - var modify = new _ol_interaction_Modify_({ + var modify = new Modify({ features: new Collection(features) }); map.addInteraction(modify); From c9a91efc3d843fe8e0b153aa4892fb00ab15d9e6 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:51:32 -0700 Subject: [PATCH 18/35] Rename _ol_interaction_Select_ to Select --- examples/box-selection.js | 4 +-- examples/earthquake-clusters.js | 4 +-- examples/icon-negative.js | 4 +-- examples/modify-features.js | 4 +-- examples/modify-test.js | 4 +-- examples/select-features.js | 10 +++---- examples/snap.js | 4 +-- examples/translate-features.js | 4 +-- examples/vector-esri-edit.js | 4 +-- src/ol/interaction/Select.js | 40 ++++++++++++------------- test/spec/ol/interaction/select.test.js | 28 ++++++++--------- 11 files changed, 55 insertions(+), 55 deletions(-) diff --git a/examples/box-selection.js b/examples/box-selection.js index 959897764b..69be214ab4 100644 --- a/examples/box-selection.js +++ b/examples/box-selection.js @@ -3,7 +3,7 @@ import View from '../src/ol/View.js'; import _ol_events_condition_ from '../src/ol/events/condition.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import DragBox from '../src/ol/interaction/DragBox.js'; -import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; +import Select from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; @@ -33,7 +33,7 @@ var map = new Map({ }); // a normal select interaction to handle click -var select = new _ol_interaction_Select_(); +var select = new Select(); map.addInteraction(select); var selectedFeatures = select.getFeatures(); diff --git a/examples/earthquake-clusters.js b/examples/earthquake-clusters.js index 6b08b056e0..7462b90de4 100644 --- a/examples/earthquake-clusters.js +++ b/examples/earthquake-clusters.js @@ -3,7 +3,7 @@ import View from '../src/ol/View.js'; import * as _ol_extent_ from '../src/ol/extent.js'; import KML from '../src/ol/format/KML.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; -import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; +import Select from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import Cluster from '../src/ol/source/Cluster.js'; @@ -142,7 +142,7 @@ var raster = new TileLayer({ var map = new Map({ layers: [raster, vector], - interactions: defaultInteractions().extend([new _ol_interaction_Select_({ + interactions: defaultInteractions().extend([new Select({ condition: function(evt) { return evt.type == 'pointermove' || evt.type == 'singleclick'; diff --git a/examples/icon-negative.js b/examples/icon-negative.js index ed82c9a723..ad342938b7 100644 --- a/examples/icon-negative.js +++ b/examples/icon-negative.js @@ -2,7 +2,7 @@ import Feature from '../src/ol/Feature.js'; import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.js'; -import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; +import Select from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import Stamen from '../src/ol/source/Stamen.js'; @@ -46,7 +46,7 @@ var map = new Map({ }); var selectStyle = {}; -var select = new _ol_interaction_Select_({ +var select = new Select({ style: function(feature) { var image = feature.get('style').getImage().getImage(); if (!selectStyle[image.src]) { diff --git a/examples/modify-features.js b/examples/modify-features.js index 6d7952278a..33f9ea545b 100644 --- a/examples/modify-features.js +++ b/examples/modify-features.js @@ -3,7 +3,7 @@ import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import Modify from '../src/ol/interaction/Modify.js'; -import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; +import Select from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; @@ -22,7 +22,7 @@ var vector = new VectorLayer({ }) }); -var select = new _ol_interaction_Select_({ +var select = new Select({ wrapX: false }); diff --git a/examples/modify-test.js b/examples/modify-test.js index a4a536eebd..4018f2325a 100644 --- a/examples/modify-test.js +++ b/examples/modify-test.js @@ -3,7 +3,7 @@ import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import Modify from '../src/ol/interaction/Modify.js'; -import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; +import Select from '../src/ol/interaction/Select.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; @@ -216,7 +216,7 @@ var overlayStyle = (function() { }; })(); -var select = new _ol_interaction_Select_({ +var select = new Select({ style: overlayStyle }); diff --git a/examples/select-features.js b/examples/select-features.js index ded95624fe..32615701f6 100644 --- a/examples/select-features.js +++ b/examples/select-features.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import _ol_events_condition_ from '../src/ol/events/condition.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; -import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; +import Select from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; @@ -31,19 +31,19 @@ var map = new Map({ var select = null; // ref to currently selected interaction // select interaction working on "singleclick" -var selectSingleClick = new _ol_interaction_Select_(); +var selectSingleClick = new Select(); // select interaction working on "click" -var selectClick = new _ol_interaction_Select_({ +var selectClick = new Select({ condition: _ol_events_condition_.click }); // select interaction working on "pointermove" -var selectPointerMove = new _ol_interaction_Select_({ +var selectPointerMove = new Select({ condition: _ol_events_condition_.pointerMove }); -var selectAltClick = new _ol_interaction_Select_({ +var selectAltClick = new Select({ condition: function(mapBrowserEvent) { return _ol_events_condition_.click(mapBrowserEvent) && _ol_events_condition_.altKeyOnly(mapBrowserEvent); diff --git a/examples/snap.js b/examples/snap.js index a9d6e4300d..2f7e10c3af 100644 --- a/examples/snap.js +++ b/examples/snap.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import Draw from '../src/ol/interaction/Draw.js'; import Modify from '../src/ol/interaction/Modify.js'; -import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; +import Select from '../src/ol/interaction/Select.js'; import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; @@ -47,7 +47,7 @@ var map = new Map({ var ExampleModify = { init: function() { - this.select = new _ol_interaction_Select_(); + this.select = new Select(); map.addInteraction(this.select); this.modify = new Modify({ diff --git a/examples/translate-features.js b/examples/translate-features.js index 5ea637c8a1..1638798c9b 100644 --- a/examples/translate-features.js +++ b/examples/translate-features.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; -import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; +import Select from '../src/ol/interaction/Select.js'; import _ol_interaction_Translate_ from '../src/ol/interaction/Translate.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; @@ -21,7 +21,7 @@ var vector = new VectorLayer({ }) }); -var select = new _ol_interaction_Select_(); +var select = new Select(); var translate = new _ol_interaction_Translate_({ features: select.getFeatures() diff --git a/examples/vector-esri-edit.js b/examples/vector-esri-edit.js index af2797a186..ba9d6e8f43 100644 --- a/examples/vector-esri-edit.js +++ b/examples/vector-esri-edit.js @@ -4,7 +4,7 @@ import EsriJSON from '../src/ol/format/EsriJSON.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import Draw from '../src/ol/interaction/Draw.js'; import Modify from '../src/ol/interaction/Modify.js'; -import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; +import Select from '../src/ol/interaction/Select.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js'; @@ -67,7 +67,7 @@ var draw = new Draw({ type: 'Polygon' }); -var select = new _ol_interaction_Select_(); +var select = new Select(); select.setActive(false); var selected = select.getFeatures(); diff --git a/src/ol/interaction/Select.js b/src/ol/interaction/Select.js index da8e6ab6e3..c6f38bc626 100644 --- a/src/ol/interaction/Select.js +++ b/src/ol/interaction/Select.js @@ -33,10 +33,10 @@ import _ol_style_Style_ from '../style/Style.js'; * @fires ol.interaction.Select.Event * @api */ -var _ol_interaction_Select_ = function(opt_options) { +var Select = function(opt_options) { Interaction.call(this, { - handleEvent: _ol_interaction_Select_.handleEvent + handleEvent: Select.handleEvent }); var options = opt_options ? opt_options : {}; @@ -94,7 +94,7 @@ var _ol_interaction_Select_ = function(opt_options) { wrapX: options.wrapX }), style: options.style ? options.style : - _ol_interaction_Select_.getDefaultStyleFunction(), + Select.getDefaultStyleFunction(), updateWhileAnimating: true, updateWhileInteracting: true }); @@ -142,7 +142,7 @@ var _ol_interaction_Select_ = function(opt_options) { }; -inherits(_ol_interaction_Select_, Interaction); +inherits(Select, Interaction); /** @@ -150,7 +150,7 @@ inherits(_ol_interaction_Select_, Interaction); * @param {ol.layer.Layer} layer Layer. * @private */ -_ol_interaction_Select_.prototype.addFeatureLayerAssociation_ = function(feature, layer) { +Select.prototype.addFeatureLayerAssociation_ = function(feature, layer) { var key = getUid(feature); this.featureLayerAssociation_[key] = layer; }; @@ -161,7 +161,7 @@ _ol_interaction_Select_.prototype.addFeatureLayerAssociation_ = function(feature * @return {ol.Collection.} Features collection. * @api */ -_ol_interaction_Select_.prototype.getFeatures = function() { +Select.prototype.getFeatures = function() { return this.featureOverlay_.getSource().getFeaturesCollection(); }; @@ -171,7 +171,7 @@ _ol_interaction_Select_.prototype.getFeatures = function() { * @returns {number} Hit tolerance in pixels. * @api */ -_ol_interaction_Select_.prototype.getHitTolerance = function() { +Select.prototype.getHitTolerance = function() { return this.hitTolerance_; }; @@ -185,7 +185,7 @@ _ol_interaction_Select_.prototype.getHitTolerance = function() { * @return {ol.layer.Vector} Layer. * @api */ -_ol_interaction_Select_.prototype.getLayer = function(feature) { +Select.prototype.getLayer = function(feature) { var key = getUid(feature); return /** @type {ol.layer.Vector} */ (this.featureLayerAssociation_[key]); }; @@ -199,7 +199,7 @@ _ol_interaction_Select_.prototype.getLayer = function(feature) { * @this {ol.interaction.Select} * @api */ -_ol_interaction_Select_.handleEvent = function(mapBrowserEvent) { +Select.handleEvent = function(mapBrowserEvent) { if (!this.condition_(mapBrowserEvent)) { return true; } @@ -280,7 +280,7 @@ _ol_interaction_Select_.handleEvent = function(mapBrowserEvent) { } if (selected.length > 0 || deselected.length > 0) { this.dispatchEvent( - new _ol_interaction_Select_.Event(_ol_interaction_Select_.EventType_.SELECT, + new Select.Event(Select.EventType_.SELECT, selected, deselected, mapBrowserEvent)); } return _ol_events_condition_.pointerMove(mapBrowserEvent); @@ -294,7 +294,7 @@ _ol_interaction_Select_.handleEvent = function(mapBrowserEvent) { * @param {number} hitTolerance Hit tolerance in pixels. * @api */ -_ol_interaction_Select_.prototype.setHitTolerance = function(hitTolerance) { +Select.prototype.setHitTolerance = function(hitTolerance) { this.hitTolerance_ = hitTolerance; }; @@ -306,7 +306,7 @@ _ol_interaction_Select_.prototype.setHitTolerance = function(hitTolerance) { * @override * @api */ -_ol_interaction_Select_.prototype.setMap = function(map) { +Select.prototype.setMap = function(map) { var currentMap = this.getMap(); var selectedFeatures = this.featureOverlay_.getSource().getFeaturesCollection(); @@ -324,7 +324,7 @@ _ol_interaction_Select_.prototype.setMap = function(map) { /** * @return {ol.StyleFunction} Styles. */ -_ol_interaction_Select_.getDefaultStyleFunction = function() { +Select.getDefaultStyleFunction = function() { var styles = _ol_style_Style_.createDefaultEditing(); extend(styles[GeometryType.POLYGON], styles[GeometryType.LINE_STRING]); extend(styles[GeometryType.GEOMETRY_COLLECTION], styles[GeometryType.LINE_STRING]); @@ -342,7 +342,7 @@ _ol_interaction_Select_.getDefaultStyleFunction = function() { * @param {ol.Collection.Event} evt Event. * @private */ -_ol_interaction_Select_.prototype.addFeature_ = function(evt) { +Select.prototype.addFeature_ = function(evt) { var map = this.getMap(); if (map) { map.skipFeature(/** @type {ol.Feature} */ (evt.element)); @@ -354,7 +354,7 @@ _ol_interaction_Select_.prototype.addFeature_ = function(evt) { * @param {ol.Collection.Event} evt Event. * @private */ -_ol_interaction_Select_.prototype.removeFeature_ = function(evt) { +Select.prototype.removeFeature_ = function(evt) { var map = this.getMap(); if (map) { map.unskipFeature(/** @type {ol.Feature} */ (evt.element)); @@ -366,7 +366,7 @@ _ol_interaction_Select_.prototype.removeFeature_ = function(evt) { * @param {ol.Feature|ol.render.Feature} feature Feature. * @private */ -_ol_interaction_Select_.prototype.removeFeatureLayerAssociation_ = function(feature) { +Select.prototype.removeFeatureLayerAssociation_ = function(feature) { var key = getUid(feature); delete this.featureLayerAssociation_[key]; }; @@ -386,7 +386,7 @@ _ol_interaction_Select_.prototype.removeFeatureLayerAssociation_ = function(feat * @extends {ol.events.Event} * @constructor */ -_ol_interaction_Select_.Event = function(type, selected, deselected, mapBrowserEvent) { +Select.Event = function(type, selected, deselected, mapBrowserEvent) { Event.call(this, type); /** @@ -410,14 +410,14 @@ _ol_interaction_Select_.Event = function(type, selected, deselected, mapBrowserE */ this.mapBrowserEvent = mapBrowserEvent; }; -inherits(_ol_interaction_Select_.Event, Event); +inherits(Select.Event, Event); /** * @enum {string} * @private */ -_ol_interaction_Select_.EventType_ = { +Select.EventType_ = { /** * Triggered when feature(s) has been (de)selected. * @event ol.interaction.Select.Event#select @@ -425,4 +425,4 @@ _ol_interaction_Select_.EventType_ = { */ SELECT: 'select' }; -export default _ol_interaction_Select_; +export default Select; diff --git a/test/spec/ol/interaction/select.test.js b/test/spec/ol/interaction/select.test.js index 7ae4810270..dd54fd0695 100644 --- a/test/spec/ol/interaction/select.test.js +++ b/test/spec/ol/interaction/select.test.js @@ -6,7 +6,7 @@ import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js import View from '../../../../src/ol/View.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js'; -import _ol_interaction_Select_ from '../../../../src/ol/interaction/Select.js'; +import Select from '../../../../src/ol/interaction/Select.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; @@ -103,8 +103,8 @@ describe('ol.interaction.Select', function() { describe('constructor', function() { it('creates a new interaction', function() { - var select = new _ol_interaction_Select_(); - expect(select).to.be.a(_ol_interaction_Select_); + var select = new Select(); + expect(select).to.be.a(Select); expect(select).to.be.a(Interaction); }); @@ -112,7 +112,7 @@ describe('ol.interaction.Select', function() { it('uses the user-provided collection', function() { var features = new Collection(); - var select = new _ol_interaction_Select_({features: features}); + var select = new Select({features: features}); expect(select.getFeatures()).to.be(features); }); @@ -124,7 +124,7 @@ describe('ol.interaction.Select', function() { var select; beforeEach(function() { - select = new _ol_interaction_Select_(); + select = new Select(); map.addInteraction(select); }); @@ -190,7 +190,7 @@ describe('ol.interaction.Select', function() { var select; beforeEach(function() { - select = new _ol_interaction_Select_({ + select = new Select({ multi: true }); map.addInteraction(select); @@ -239,7 +239,7 @@ describe('ol.interaction.Select', function() { var select; beforeEach(function() { - select = new _ol_interaction_Select_({ + select = new Select({ multi: true }); map.addInteraction(select); @@ -272,7 +272,7 @@ describe('ol.interaction.Select', function() { describe('with multi set to true', function() { it('only selects features that pass the filter', function() { - var select = new _ol_interaction_Select_({ + var select = new Select({ multi: true, filter: function(feature, layer) { return feature.get('type') === 'bar'; @@ -289,7 +289,7 @@ describe('ol.interaction.Select', function() { it('only selects features that pass the filter ' + 'using shift single-click', function() { - var select = new _ol_interaction_Select_({ + var select = new Select({ multi: true, filter: function(feature, layer) { return feature.get('type') === 'bar'; @@ -309,7 +309,7 @@ describe('ol.interaction.Select', function() { describe('with multi set to false', function() { it('only selects the first feature that passes the filter', function() { - var select = new _ol_interaction_Select_({ + var select = new Select({ multi: false, filter: function(feature, layer) { return feature.get('type') === 'bar'; @@ -324,7 +324,7 @@ describe('ol.interaction.Select', function() { it('only selects the first feature that passes the filter ' + 'using shift single-click', function() { - var select = new _ol_interaction_Select_({ + var select = new Select({ multi: false, filter: function(feature, layer) { return feature.get('type') === 'bar'; @@ -344,7 +344,7 @@ describe('ol.interaction.Select', function() { var interaction; beforeEach(function() { - interaction = new _ol_interaction_Select_(); + interaction = new Select(); map.addInteraction(interaction); }); afterEach(function() { @@ -372,7 +372,7 @@ describe('ol.interaction.Select', function() { var interaction; beforeEach(function() { - interaction = new _ol_interaction_Select_(); + interaction = new Select(); expect(interaction.getActive()).to.be(true); @@ -412,7 +412,7 @@ describe('ol.interaction.Select', function() { var interaction; beforeEach(function() { - interaction = new _ol_interaction_Select_(); + interaction = new Select(); expect(interaction.getActive()).to.be(true); }); From b8cf046b38473bfe6ae58647ec730323710d3116 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:52:02 -0700 Subject: [PATCH 19/35] Rename _ol_interaction_Snap_ to Snap --- examples/draw-and-modify-features.js | 4 +- examples/snap.js | 4 +- examples/topolis.js | 4 +- src/ol/interaction/Snap.js | 58 +++++++++++++-------------- test/spec/ol/interaction/snap.test.js | 34 ++++++++-------- 5 files changed, 52 insertions(+), 52 deletions(-) diff --git a/examples/draw-and-modify-features.js b/examples/draw-and-modify-features.js index 8adef2814a..c3d5931f3d 100644 --- a/examples/draw-and-modify-features.js +++ b/examples/draw-and-modify-features.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import Draw from '../src/ol/interaction/Draw.js'; import Modify from '../src/ol/interaction/Modify.js'; -import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js'; +import Snap from '../src/ol/interaction/Snap.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; @@ -57,7 +57,7 @@ function addInteractions() { type: typeSelect.value }); map.addInteraction(draw); - snap = new _ol_interaction_Snap_({source: source}); + snap = new Snap({source: source}); map.addInteraction(snap); } diff --git a/examples/snap.js b/examples/snap.js index 2f7e10c3af..7a78c7105e 100644 --- a/examples/snap.js +++ b/examples/snap.js @@ -3,7 +3,7 @@ import View from '../src/ol/View.js'; import Draw from '../src/ol/interaction/Draw.js'; import Modify from '../src/ol/interaction/Modify.js'; import Select from '../src/ol/interaction/Select.js'; -import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js'; +import Snap from '../src/ol/interaction/Snap.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; @@ -144,7 +144,7 @@ ExampleModify.setActive(false); // The snap interaction must be added after the Modify and Draw interactions // in order for its map browser event handlers to be fired first. Its handlers // are responsible of doing the snapping. -var snap = new _ol_interaction_Snap_({ +var snap = new Snap({ source: vector.getSource() }); map.addInteraction(snap); diff --git a/examples/topolis.js b/examples/topolis.js index 25838c83f0..771e03bf60 100644 --- a/examples/topolis.js +++ b/examples/topolis.js @@ -8,7 +8,7 @@ import Point from '../src/ol/geom/Point.js'; import LineString from '../src/ol/geom/LineString.js'; import Polygon from '../src/ol/geom/Polygon.js'; import Draw from '../src/ol/interaction/Draw.js'; -import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js'; +import Snap from '../src/ol/interaction/Snap.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; @@ -209,7 +209,7 @@ var draw = new Draw({ }); draw.on('drawend', onDrawend); map.addInteraction(draw); -var snap = new _ol_interaction_Snap_({ +var snap = new Snap({ source: edges }); map.addInteraction(snap); diff --git a/src/ol/interaction/Snap.js b/src/ol/interaction/Snap.js index 467aadada7..19ea695606 100644 --- a/src/ol/interaction/Snap.js +++ b/src/ol/interaction/Snap.js @@ -39,12 +39,12 @@ import RBush from '../structs/RBush.js'; * @param {olx.interaction.SnapOptions=} opt_options Options. * @api */ -var _ol_interaction_Snap_ = function(opt_options) { +var Snap = function(opt_options) { PointerInteraction.call(this, { - handleEvent: _ol_interaction_Snap_.handleEvent_, + handleEvent: Snap.handleEvent_, handleDownEvent: TRUE, - handleUpEvent: _ol_interaction_Snap_.handleUpEvent_ + handleUpEvent: Snap.handleUpEvent_ }); var options = opt_options ? opt_options : {}; @@ -120,7 +120,7 @@ var _ol_interaction_Snap_ = function(opt_options) { * @type {function(ol.SnapSegmentDataType, ol.SnapSegmentDataType): number} * @private */ - this.sortByDistance_ = _ol_interaction_Snap_.sortByDistance.bind(this); + this.sortByDistance_ = Snap.sortByDistance.bind(this); /** @@ -149,7 +149,7 @@ var _ol_interaction_Snap_ = function(opt_options) { }; }; -inherits(_ol_interaction_Snap_, PointerInteraction); +inherits(Snap, PointerInteraction); /** @@ -159,7 +159,7 @@ inherits(_ol_interaction_Snap_, PointerInteraction); * Defaults to `true`. * @api */ -_ol_interaction_Snap_.prototype.addFeature = function(feature, opt_listen) { +Snap.prototype.addFeature = function(feature, opt_listen) { var listen = opt_listen !== undefined ? opt_listen : true; var feature_uid = getUid(feature); var geometry = feature.getGeometry(); @@ -184,7 +184,7 @@ _ol_interaction_Snap_.prototype.addFeature = function(feature, opt_listen) { * @param {ol.Feature} feature Feature. * @private */ -_ol_interaction_Snap_.prototype.forEachFeatureAdd_ = function(feature) { +Snap.prototype.forEachFeatureAdd_ = function(feature) { this.addFeature(feature); }; @@ -193,7 +193,7 @@ _ol_interaction_Snap_.prototype.forEachFeatureAdd_ = function(feature) { * @param {ol.Feature} feature Feature. * @private */ -_ol_interaction_Snap_.prototype.forEachFeatureRemove_ = function(feature) { +Snap.prototype.forEachFeatureRemove_ = function(feature) { this.removeFeature(feature); }; @@ -202,7 +202,7 @@ _ol_interaction_Snap_.prototype.forEachFeatureRemove_ = function(feature) { * @return {ol.Collection.|Array.} Features. * @private */ -_ol_interaction_Snap_.prototype.getFeatures_ = function() { +Snap.prototype.getFeatures_ = function() { var features; if (this.features_) { features = this.features_; @@ -217,7 +217,7 @@ _ol_interaction_Snap_.prototype.getFeatures_ = function() { * @param {ol.source.Vector.Event|ol.Collection.Event} evt Event. * @private */ -_ol_interaction_Snap_.prototype.handleFeatureAdd_ = function(evt) { +Snap.prototype.handleFeatureAdd_ = function(evt) { var feature; if (evt instanceof VectorSource.Event) { feature = evt.feature; @@ -232,7 +232,7 @@ _ol_interaction_Snap_.prototype.handleFeatureAdd_ = function(evt) { * @param {ol.source.Vector.Event|ol.Collection.Event} evt Event. * @private */ -_ol_interaction_Snap_.prototype.handleFeatureRemove_ = function(evt) { +Snap.prototype.handleFeatureRemove_ = function(evt) { var feature; if (evt instanceof VectorSource.Event) { feature = evt.feature; @@ -247,7 +247,7 @@ _ol_interaction_Snap_.prototype.handleFeatureRemove_ = function(evt) { * @param {ol.events.Event} evt Event. * @private */ -_ol_interaction_Snap_.prototype.handleFeatureChange_ = function(evt) { +Snap.prototype.handleFeatureChange_ = function(evt) { var feature = /** @type {ol.Feature} */ (evt.target); if (this.handlingDownUpSequence) { var uid = getUid(feature); @@ -267,7 +267,7 @@ _ol_interaction_Snap_.prototype.handleFeatureChange_ = function(evt) { * or not. Defaults to `true`. * @api */ -_ol_interaction_Snap_.prototype.removeFeature = function(feature, opt_unlisten) { +Snap.prototype.removeFeature = function(feature, opt_unlisten) { var unlisten = opt_unlisten !== undefined ? opt_unlisten : true; var feature_uid = getUid(feature); var extent = this.indexedFeaturesExtents_[feature_uid]; @@ -294,7 +294,7 @@ _ol_interaction_Snap_.prototype.removeFeature = function(feature, opt_unlisten) /** * @inheritDoc */ -_ol_interaction_Snap_.prototype.setMap = function(map) { +Snap.prototype.setMap = function(map) { var currentMap = this.getMap(); var keys = this.featuresListenerKeys_; var features = this.getFeatures_(); @@ -330,7 +330,7 @@ _ol_interaction_Snap_.prototype.setMap = function(map) { /** * @inheritDoc */ -_ol_interaction_Snap_.prototype.shouldStopEvent = FALSE; +Snap.prototype.shouldStopEvent = FALSE; /** @@ -339,7 +339,7 @@ _ol_interaction_Snap_.prototype.shouldStopEvent = FALSE; * @param {ol.PluggableMap} map Map. * @return {ol.SnapResultType} Snap result */ -_ol_interaction_Snap_.prototype.snapTo = function(pixel, pixelCoordinate, map) { +Snap.prototype.snapTo = function(pixel, pixelCoordinate, map) { var lowerLeft = map.getCoordinateFromPixel( [pixel[0] - this.pixelTolerance_, pixel[1] + this.pixelTolerance_]); @@ -423,7 +423,7 @@ _ol_interaction_Snap_.prototype.snapTo = function(pixel, pixelCoordinate, map) { * @param {ol.Feature} feature Feature * @private */ -_ol_interaction_Snap_.prototype.updateFeature_ = function(feature) { +Snap.prototype.updateFeature_ = function(feature) { this.removeFeature(feature, false); this.addFeature(feature, false); }; @@ -434,7 +434,7 @@ _ol_interaction_Snap_.prototype.updateFeature_ = function(feature) { * @param {ol.geom.Circle} geometry Geometry. * @private */ -_ol_interaction_Snap_.prototype.writeCircleGeometry_ = function(feature, geometry) { +Snap.prototype.writeCircleGeometry_ = function(feature, geometry) { var polygon = fromCircle(geometry); var coordinates = polygon.getCoordinates()[0]; var i, ii, segment, segmentData; @@ -454,7 +454,7 @@ _ol_interaction_Snap_.prototype.writeCircleGeometry_ = function(feature, geometr * @param {ol.geom.GeometryCollection} geometry Geometry. * @private */ -_ol_interaction_Snap_.prototype.writeGeometryCollectionGeometry_ = function(feature, geometry) { +Snap.prototype.writeGeometryCollectionGeometry_ = function(feature, geometry) { var i, geometries = geometry.getGeometriesArray(); for (i = 0; i < geometries.length; ++i) { var segmentWriter = this.SEGMENT_WRITERS_[geometries[i].getType()]; @@ -470,7 +470,7 @@ _ol_interaction_Snap_.prototype.writeGeometryCollectionGeometry_ = function(feat * @param {ol.geom.LineString} geometry Geometry. * @private */ -_ol_interaction_Snap_.prototype.writeLineStringGeometry_ = function(feature, geometry) { +Snap.prototype.writeLineStringGeometry_ = function(feature, geometry) { var coordinates = geometry.getCoordinates(); var i, ii, segment, segmentData; for (i = 0, ii = coordinates.length - 1; i < ii; ++i) { @@ -489,7 +489,7 @@ _ol_interaction_Snap_.prototype.writeLineStringGeometry_ = function(feature, geo * @param {ol.geom.MultiLineString} geometry Geometry. * @private */ -_ol_interaction_Snap_.prototype.writeMultiLineStringGeometry_ = function(feature, geometry) { +Snap.prototype.writeMultiLineStringGeometry_ = function(feature, geometry) { var lines = geometry.getCoordinates(); var coordinates, i, ii, j, jj, segment, segmentData; for (j = 0, jj = lines.length; j < jj; ++j) { @@ -511,7 +511,7 @@ _ol_interaction_Snap_.prototype.writeMultiLineStringGeometry_ = function(feature * @param {ol.geom.MultiPoint} geometry Geometry. * @private */ -_ol_interaction_Snap_.prototype.writeMultiPointGeometry_ = function(feature, geometry) { +Snap.prototype.writeMultiPointGeometry_ = function(feature, geometry) { var points = geometry.getCoordinates(); var coordinates, i, ii, segmentData; for (i = 0, ii = points.length; i < ii; ++i) { @@ -530,7 +530,7 @@ _ol_interaction_Snap_.prototype.writeMultiPointGeometry_ = function(feature, geo * @param {ol.geom.MultiPolygon} geometry Geometry. * @private */ -_ol_interaction_Snap_.prototype.writeMultiPolygonGeometry_ = function(feature, geometry) { +Snap.prototype.writeMultiPolygonGeometry_ = function(feature, geometry) { var polygons = geometry.getCoordinates(); var coordinates, i, ii, j, jj, k, kk, rings, segment, segmentData; for (k = 0, kk = polygons.length; k < kk; ++k) { @@ -555,7 +555,7 @@ _ol_interaction_Snap_.prototype.writeMultiPolygonGeometry_ = function(feature, g * @param {ol.geom.Point} geometry Geometry. * @private */ -_ol_interaction_Snap_.prototype.writePointGeometry_ = function(feature, geometry) { +Snap.prototype.writePointGeometry_ = function(feature, geometry) { var coordinates = geometry.getCoordinates(); var segmentData = /** @type {ol.SnapSegmentDataType} */ ({ feature: feature, @@ -570,7 +570,7 @@ _ol_interaction_Snap_.prototype.writePointGeometry_ = function(feature, geometry * @param {ol.geom.Polygon} geometry Geometry. * @private */ -_ol_interaction_Snap_.prototype.writePolygonGeometry_ = function(feature, geometry) { +Snap.prototype.writePolygonGeometry_ = function(feature, geometry) { var rings = geometry.getCoordinates(); var coordinates, i, ii, j, jj, segment, segmentData; for (j = 0, jj = rings.length; j < jj; ++j) { @@ -594,7 +594,7 @@ _ol_interaction_Snap_.prototype.writePolygonGeometry_ = function(feature, geomet * @this {ol.interaction.Snap} * @private */ -_ol_interaction_Snap_.handleEvent_ = function(evt) { +Snap.handleEvent_ = function(evt) { var result = this.snapTo(evt.pixel, evt.coordinate, evt.map); if (result.snapped) { evt.coordinate = result.vertex.slice(0, 2); @@ -610,7 +610,7 @@ _ol_interaction_Snap_.handleEvent_ = function(evt) { * @this {ol.interaction.Snap} * @private */ -_ol_interaction_Snap_.handleUpEvent_ = function(evt) { +Snap.handleUpEvent_ = function(evt) { var featuresToUpdate = _ol_obj_.getValues(this.pendingFeatures_); if (featuresToUpdate.length) { featuresToUpdate.forEach(this.updateFeature_.bind(this)); @@ -627,10 +627,10 @@ _ol_interaction_Snap_.handleUpEvent_ = function(evt) { * @return {number} The difference in distance. * @this {ol.interaction.Snap} */ -_ol_interaction_Snap_.sortByDistance = function(a, b) { +Snap.sortByDistance = function(a, b) { return _ol_coordinate_.squaredDistanceToSegment( this.pixelCoordinate_, a.segment) - _ol_coordinate_.squaredDistanceToSegment( this.pixelCoordinate_, b.segment); }; -export default _ol_interaction_Snap_; +export default Snap; diff --git a/test/spec/ol/interaction/snap.test.js b/test/spec/ol/interaction/snap.test.js index 792c4b9f4a..fe1db01b4a 100644 --- a/test/spec/ol/interaction/snap.test.js +++ b/test/spec/ol/interaction/snap.test.js @@ -5,7 +5,7 @@ import View from '../../../../src/ol/View.js'; import Circle from '../../../../src/ol/geom/Circle.js'; import Point from '../../../../src/ol/geom/Point.js'; import LineString from '../../../../src/ol/geom/LineString.js'; -import _ol_interaction_Snap_ from '../../../../src/ol/interaction/Snap.js'; +import Snap from '../../../../src/ol/interaction/Snap.js'; describe('ol.interaction.Snap', function() { @@ -13,8 +13,8 @@ describe('ol.interaction.Snap', function() { describe('constructor', function() { it('can be constructed without arguments', function() { - var instance = new _ol_interaction_Snap_(); - expect(instance).to.be.an(_ol_interaction_Snap_); + var instance = new Snap(); + expect(instance).to.be.an(Snap); }); }); @@ -57,7 +57,7 @@ describe('ol.interaction.Snap', function() { it('can handle XYZ coordinates', function() { var point = new Feature(new Point([0, 0, 123])); - var snapInteraction = new _ol_interaction_Snap_({ + var snapInteraction = new Snap({ features: new Collection([point]) }); snapInteraction.setMap(map); @@ -67,14 +67,14 @@ describe('ol.interaction.Snap', function() { coordinate: [0, 0], map: map }; - _ol_interaction_Snap_.handleEvent_.call(snapInteraction, event); + Snap.handleEvent_.call(snapInteraction, event); // check that the coordinate is in XY and not XYZ expect(event.coordinate).to.eql([0, 0]); }); it('snaps to edges only', function() { var point = new Feature(new LineString([[-10, 0], [10, 0]])); - var snapInteraction = new _ol_interaction_Snap_({ + var snapInteraction = new Snap({ features: new Collection([point]), pixelTolerance: 5, vertex: false @@ -86,13 +86,13 @@ describe('ol.interaction.Snap', function() { coordinate: [7, 4], map: map }; - _ol_interaction_Snap_.handleEvent_.call(snapInteraction, event); + Snap.handleEvent_.call(snapInteraction, event); expect(event.coordinate).to.eql([7, 0]); }); it('snaps to vertices only', function() { var point = new Feature(new LineString([[-10, 0], [10, 0]])); - var snapInteraction = new _ol_interaction_Snap_({ + var snapInteraction = new Snap({ features: new Collection([point]), pixelTolerance: 5, edge: false @@ -104,13 +104,13 @@ describe('ol.interaction.Snap', function() { coordinate: [7, 4], map: map }; - _ol_interaction_Snap_.handleEvent_.call(snapInteraction, event); + Snap.handleEvent_.call(snapInteraction, event); expect(event.coordinate).to.eql([10, 0]); }); it('snaps to circle', function() { var circle = new Feature(new Circle([0, 0], 10)); - var snapInteraction = new _ol_interaction_Snap_({ + var snapInteraction = new Snap({ features: new Collection([circle]), pixelTolerance: 5 }); @@ -121,7 +121,7 @@ describe('ol.interaction.Snap', function() { coordinate: [5, 5], map: map }; - _ol_interaction_Snap_.handleEvent_.call(snapInteraction, event); + Snap.handleEvent_.call(snapInteraction, event); expect(event.coordinate[0]).to.roughlyEqual(Math.sin(Math.PI / 4) * 10, 1e-10); expect(event.coordinate[1]).to.roughlyEqual(Math.sin(Math.PI / 4) * 10, 1e-10); @@ -129,7 +129,7 @@ describe('ol.interaction.Snap', function() { it('handle feature without geometry', function() { var feature = new Feature(); - var snapInteraction = new _ol_interaction_Snap_({ + var snapInteraction = new Snap({ features: new Collection([feature]), pixelTolerance: 5, edge: false @@ -143,13 +143,13 @@ describe('ol.interaction.Snap', function() { coordinate: [7, 4], map: map }; - _ol_interaction_Snap_.handleEvent_.call(snapInteraction, event); + Snap.handleEvent_.call(snapInteraction, event); expect(event.coordinate).to.eql([10, 0]); }); it('handle geometry changes', function() { var line = new Feature(new LineString([[-10, 0], [0, 0]])); - var snapInteraction = new _ol_interaction_Snap_({ + var snapInteraction = new Snap({ features: new Collection([line]), pixelTolerance: 5, edge: false @@ -163,7 +163,7 @@ describe('ol.interaction.Snap', function() { coordinate: [7, 4], map: map }; - _ol_interaction_Snap_.handleEvent_.call(snapInteraction, event); + Snap.handleEvent_.call(snapInteraction, event); expect(event.coordinate).to.eql([10, 0]); }); @@ -172,7 +172,7 @@ describe('ol.interaction.Snap', function() { geometry: new LineString([[-10, 0], [0, 0]]), alt_geometry: new LineString([[-10, 0], [10, 0]]) }); - var snapInteraction = new _ol_interaction_Snap_({ + var snapInteraction = new Snap({ features: new Collection([line]), pixelTolerance: 5, edge: false @@ -186,7 +186,7 @@ describe('ol.interaction.Snap', function() { coordinate: [7, 4], map: map }; - _ol_interaction_Snap_.handleEvent_.call(snapInteraction, event); + Snap.handleEvent_.call(snapInteraction, event); expect(event.coordinate).to.eql([10, 0]); }); From 870be87389b7d922dea544256f0c153c7308ac51 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:53:19 -0700 Subject: [PATCH 20/35] Rename _ol_interaction_ModifyEventType_ to ModifyEventType --- src/ol/interaction/Modify.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index 554d39bc38..21f5106918 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -16,7 +16,7 @@ import _ol_events_condition_ from '../events/condition.js'; import {boundingExtent, buffer, createOrUpdateFromCoordinate} from '../extent.js'; import GeometryType from '../geom/GeometryType.js'; import Point from '../geom/Point.js'; -import _ol_interaction_ModifyEventType_ from '../interaction/ModifyEventType.js'; +import ModifyEventType from '../interaction/ModifyEventType.js'; import PointerInteraction from '../interaction/Pointer.js'; import VectorLayer from '../layer/Vector.js'; import VectorSource from '../source/Vector.js'; @@ -269,7 +269,7 @@ Modify.prototype.willModifyFeatures_ = function(evt) { if (!this.modified_) { this.modified_ = true; this.dispatchEvent(new Modify.Event( - _ol_interaction_ModifyEventType_.MODIFYSTART, this.features_, evt)); + ModifyEventType.MODIFYSTART, this.features_, evt)); } }; @@ -783,7 +783,7 @@ Modify.handleUpEvent_ = function(evt) { } if (this.modified_) { this.dispatchEvent(new Modify.Event( - _ol_interaction_ModifyEventType_.MODIFYEND, this.features_, evt)); + ModifyEventType.MODIFYEND, this.features_, evt)); this.modified_ = false; } return false; @@ -1031,7 +1031,7 @@ Modify.prototype.removePoint = function() { this.willModifyFeatures_(evt); this.removeVertex_(); this.dispatchEvent(new Modify.Event( - _ol_interaction_ModifyEventType_.MODIFYEND, this.features_, evt)); + ModifyEventType.MODIFYEND, this.features_, evt)); this.modified_ = false; return true; } From 019933ef2574a8559f48ab4020180d45e20aa04f Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:55:28 -0700 Subject: [PATCH 21/35] Rename _ol_interaction_TranslateEventType_ to TranslateEventType --- src/ol/interaction/Translate.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ol/interaction/Translate.js b/src/ol/interaction/Translate.js index fd3a4bd538..40cd77c48f 100644 --- a/src/ol/interaction/Translate.js +++ b/src/ol/interaction/Translate.js @@ -10,7 +10,7 @@ import {TRUE} from '../functions.js'; import {includes} from '../array.js'; import PointerInteraction from '../interaction/Pointer.js'; import InteractionProperty from '../interaction/Property.js'; -import _ol_interaction_TranslateEventType_ from '../interaction/TranslateEventType.js'; +import TranslateEventType from '../interaction/TranslateEventType.js'; /** * @classdesc @@ -104,7 +104,7 @@ _ol_interaction_Translate_.handleDownEvent_ = function(event) { this.dispatchEvent( new _ol_interaction_Translate_.Event( - _ol_interaction_TranslateEventType_.TRANSLATESTART, features, + TranslateEventType.TRANSLATESTART, features, event.coordinate)); return true; } @@ -127,7 +127,7 @@ _ol_interaction_Translate_.handleUpEvent_ = function(event) { this.dispatchEvent( new _ol_interaction_Translate_.Event( - _ol_interaction_TranslateEventType_.TRANSLATEEND, features, + TranslateEventType.TRANSLATEEND, features, event.coordinate)); return true; } @@ -157,7 +157,7 @@ _ol_interaction_Translate_.handleDragEvent_ = function(event) { this.lastCoordinate_ = newCoordinate; this.dispatchEvent( new _ol_interaction_Translate_.Event( - _ol_interaction_TranslateEventType_.TRANSLATING, features, + TranslateEventType.TRANSLATING, features, newCoordinate)); } }; From 12d4db5045acb3a7d1f7d67caeb73a8ba5752f50 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:56:24 -0700 Subject: [PATCH 22/35] Rename _ol_style_Atlas_ to Atlas --- src/ol/style/Atlas.js | 12 ++++++------ src/ol/style/AtlasManager.js | 8 ++++---- test/spec/ol/style/atlasmanager.test.js | 26 ++++++++++++------------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/ol/style/Atlas.js b/src/ol/style/Atlas.js index b5932d59c1..7b0f802500 100644 --- a/src/ol/style/Atlas.js +++ b/src/ol/style/Atlas.js @@ -20,7 +20,7 @@ import {createCanvasContext2D} from '../dom.js'; * edges overlap when being rendered). To avoid this we add a * padding around each image. */ -var _ol_style_Atlas_ = function(size, space) { +var Atlas = function(size, space) { /** * @private @@ -58,7 +58,7 @@ var _ol_style_Atlas_ = function(size, space) { * @param {string} id The identifier of the entry to check. * @return {?ol.AtlasInfo} The atlas info. */ -_ol_style_Atlas_.prototype.get = function(id) { +Atlas.prototype.get = function(id) { return this.entries_[id] || null; }; @@ -73,7 +73,7 @@ _ol_style_Atlas_.prototype.get = function(id) { * `renderCallback`. * @return {?ol.AtlasInfo} The position and atlas image for the entry. */ -_ol_style_Atlas_.prototype.add = function(id, width, height, renderCallback, opt_this) { +Atlas.prototype.add = function(id, width, height, renderCallback, opt_this) { var block, i, ii; for (i = 0, ii = this.emptyBlocks_.length; i < ii; ++i) { block = this.emptyBlocks_[i]; @@ -110,7 +110,7 @@ _ol_style_Atlas_.prototype.add = function(id, width, height, renderCallback, opt * @param {number} width The width of the entry to insert. * @param {number} height The height of the entry to insert. */ -_ol_style_Atlas_.prototype.split_ = function(index, block, width, height) { +Atlas.prototype.split_ = function(index, block, width, height) { var deltaWidth = block.width - width; var deltaHeight = block.height - height; @@ -168,7 +168,7 @@ _ol_style_Atlas_.prototype.split_ = function(index, block, width, height) { * @param {ol.AtlasBlock} newBlock1 The 1st block to add. * @param {ol.AtlasBlock} newBlock2 The 2nd block to add. */ -_ol_style_Atlas_.prototype.updateBlocks_ = function(index, newBlock1, newBlock2) { +Atlas.prototype.updateBlocks_ = function(index, newBlock1, newBlock2) { var args = [index, 1]; if (newBlock1.width > 0 && newBlock1.height > 0) { args.push(newBlock1); @@ -178,4 +178,4 @@ _ol_style_Atlas_.prototype.updateBlocks_ = function(index, newBlock1, newBlock2) } this.emptyBlocks_.splice.apply(this.emptyBlocks_, args); }; -export default _ol_style_Atlas_; +export default Atlas; diff --git a/src/ol/style/AtlasManager.js b/src/ol/style/AtlasManager.js index 9d67ff1a2d..3862e1d019 100644 --- a/src/ol/style/AtlasManager.js +++ b/src/ol/style/AtlasManager.js @@ -2,7 +2,7 @@ * @module ol/style/AtlasManager */ import {WEBGL_MAX_TEXTURE_SIZE, nullFunction} from '../index.js'; -import _ol_style_Atlas_ from '../style/Atlas.js'; +import Atlas from '../style/Atlas.js'; /** @@ -66,7 +66,7 @@ var _ol_style_AtlasManager_ = function(opt_options) { * @private * @type {Array.} */ - this.atlases_ = [new _ol_style_Atlas_(this.currentSize_, this.space_)]; + this.atlases_ = [new Atlas(this.currentSize_, this.space_)]; /** * The size in pixels of the latest atlas image for hit-detection images. @@ -79,7 +79,7 @@ var _ol_style_AtlasManager_ = function(opt_options) { * @private * @type {Array.} */ - this.hitAtlases_ = [new _ol_style_Atlas_(this.currentHitSize_, this.space_)]; + this.hitAtlases_ = [new Atlas(this.currentHitSize_, this.space_)]; }; @@ -221,7 +221,7 @@ _ol_style_AtlasManager_.prototype.add_ = function(isHitAtlas, id, width, height, size = Math.min(this.currentSize_ * 2, this.maxSize_); this.currentSize_ = size; } - atlas = new _ol_style_Atlas_(size, this.space_); + atlas = new Atlas(size, this.space_); atlases.push(atlas); // run the loop another time ++ii; diff --git a/test/spec/ol/style/atlasmanager.test.js b/test/spec/ol/style/atlasmanager.test.js index be06e9151f..83778a81bd 100644 --- a/test/spec/ol/style/atlasmanager.test.js +++ b/test/spec/ol/style/atlasmanager.test.js @@ -1,4 +1,4 @@ -import _ol_style_Atlas_ from '../../../../src/ol/style/Atlas.js'; +import Atlas from '../../../../src/ol/style/Atlas.js'; import _ol_style_AtlasManager_ from '../../../../src/ol/style/AtlasManager.js'; @@ -10,7 +10,7 @@ describe('ol.style.Atlas', function() { describe('#constructor', function() { it('inits the atlas', function() { - var atlas = new _ol_style_Atlas_(256, 1); + var atlas = new Atlas(256, 1); expect(atlas.emptyBlocks_).to.eql( [{x: 0, y: 0, width: 256, height: 256}]); }); @@ -19,7 +19,7 @@ describe('ol.style.Atlas', function() { describe('#add (squares with same size)', function() { it('adds one entry', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); var info = atlas.add('1', 32, 32, defaultRender); expect(info).to.eql( @@ -29,7 +29,7 @@ describe('ol.style.Atlas', function() { }); it('adds two entries', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); atlas.add('1', 32, 32, defaultRender); var info = atlas.add('2', 32, 32, defaultRender); @@ -41,7 +41,7 @@ describe('ol.style.Atlas', function() { }); it('adds three entries', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); atlas.add('1', 32, 32, defaultRender); atlas.add('2', 32, 32, defaultRender); @@ -54,7 +54,7 @@ describe('ol.style.Atlas', function() { }); it('adds four entries (new row)', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); atlas.add('1', 32, 32, defaultRender); atlas.add('2', 32, 32, defaultRender); @@ -68,7 +68,7 @@ describe('ol.style.Atlas', function() { }); it('returns null when an entry is too big', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); atlas.add('1', 32, 32, defaultRender); atlas.add('2', 32, 32, defaultRender); @@ -79,7 +79,7 @@ describe('ol.style.Atlas', function() { }); it('fills up the whole atlas', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); for (var i = 1; i <= 16; i++) { expect(atlas.add(i.toString(), 28, 28, defaultRender)).to.be.ok(); @@ -93,7 +93,7 @@ describe('ol.style.Atlas', function() { describe('#add (rectangles with different sizes)', function() { it('adds a bunch of rectangles', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); expect(atlas.add('1', 64, 32, defaultRender)).to.eql( {offsetX: 1, offsetY: 1, image: atlas.canvas_}); @@ -116,7 +116,7 @@ describe('ol.style.Atlas', function() { }); it('fills up the whole atlas (rectangles in portrait format)', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); for (var i = 1; i <= 32; i++) { expect(atlas.add(i.toString(), 28, 14, defaultRender)).to.be.ok(); @@ -127,7 +127,7 @@ describe('ol.style.Atlas', function() { }); it('fills up the whole atlas (rectangles in landscape format)', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); for (var i = 1; i <= 32; i++) { expect(atlas.add(i.toString(), 14, 28, defaultRender)).to.be.ok(); @@ -141,7 +141,7 @@ describe('ol.style.Atlas', function() { describe('#add (rendering)', function() { it('calls the render callback with the right values', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); var rendererCallback = sinon.spy(); atlas.add('1', 32, 32, rendererCallback); @@ -156,7 +156,7 @@ describe('ol.style.Atlas', function() { }); it('is possible to actually draw on the canvas', function() { - var atlas = new _ol_style_Atlas_(128, 1); + var atlas = new Atlas(128, 1); var rendererCallback = function(context, x, y) { context.fillStyle = '#FFA500'; From 5f40eec1488d0c74df5f247a17337ab76c299956 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 10:57:17 -0700 Subject: [PATCH 23/35] Rename _ol_style_AtlasManager_ to AtlasManager --- examples/symbol-atlas-webgl.js | 4 ++-- src/ol/render/webgl/TextReplay.js | 4 ++-- src/ol/style/AtlasManager.js | 14 +++++++------- test/spec/ol/style/atlasmanager.test.js | 20 ++++++++++---------- test/spec/ol/style/circle.test.js | 6 +++--- test/spec/ol/style/regularshape.test.js | 6 +++--- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/examples/symbol-atlas-webgl.js b/examples/symbol-atlas-webgl.js index c3dae93cb0..1849c5fd5c 100644 --- a/examples/symbol-atlas-webgl.js +++ b/examples/symbol-atlas-webgl.js @@ -4,14 +4,14 @@ import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_AtlasManager_ from '../src/ol/style/AtlasManager.js'; +import AtlasManager from '../src/ol/style/AtlasManager.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; -var atlasManager = new _ol_style_AtlasManager_({ +var atlasManager = new AtlasManager({ // we increase the initial size so that all symbols fit into // a single atlas image initialSize: 512 diff --git a/src/ol/render/webgl/TextReplay.js b/src/ol/render/webgl/TextReplay.js index f83e51b2db..c83e2bb11f 100644 --- a/src/ol/render/webgl/TextReplay.js +++ b/src/ol/render/webgl/TextReplay.js @@ -9,7 +9,7 @@ import _ol_has_ from '../../has.js'; import _ol_render_replay_ from '../replay.js'; import _ol_render_webgl_ from '../webgl.js'; import _ol_render_webgl_TextureReplay_ from '../webgl/TextureReplay.js'; -import _ol_style_AtlasManager_ from '../../style/AtlasManager.js'; +import AtlasManager from '../../style/AtlasManager.js'; import _ol_webgl_Buffer_ from '../../webgl/Buffer.js'; /** @@ -421,7 +421,7 @@ _ol_render_webgl_TextReplay_.prototype.getAtlas_ = function(state) { state.lineWidth / 2) * state.scale); this.atlases_[hash] = { - atlas: new _ol_style_AtlasManager_({ + atlas: new AtlasManager({ space: state.lineWidth + 1 }), width: {}, diff --git a/src/ol/style/AtlasManager.js b/src/ol/style/AtlasManager.js index 3862e1d019..e281735e37 100644 --- a/src/ol/style/AtlasManager.js +++ b/src/ol/style/AtlasManager.js @@ -33,7 +33,7 @@ var MAX_ATLAS_SIZE = -1; * @api * @param {olx.style.AtlasManagerOptions=} opt_options Options. */ -var _ol_style_AtlasManager_ = function(opt_options) { +var AtlasManager = function(opt_options) { var options = opt_options || {}; @@ -88,7 +88,7 @@ var _ol_style_AtlasManager_ = function(opt_options) { * @return {?ol.AtlasManagerInfo} The position and atlas image for the * entry, or `null` if the entry is not part of the atlas manager. */ -_ol_style_AtlasManager_.prototype.getInfo = function(id) { +AtlasManager.prototype.getInfo = function(id) { /** @type {?ol.AtlasInfo} */ var info = this.getInfo_(this.atlases_, id); @@ -108,7 +108,7 @@ _ol_style_AtlasManager_.prototype.getInfo = function(id) { * @return {?ol.AtlasInfo} The position and atlas image for the entry, * or `null` if the entry is not part of the atlases. */ -_ol_style_AtlasManager_.prototype.getInfo_ = function(atlases, id) { +AtlasManager.prototype.getInfo_ = function(atlases, id) { var atlas, info, i, ii; for (i = 0, ii = atlases.length; i < ii; ++i) { atlas = atlases[i]; @@ -129,7 +129,7 @@ _ol_style_AtlasManager_.prototype.getInfo_ = function(atlases, id) { * @return {?ol.AtlasManagerInfo} The position and atlas image for the * entry, or `null` if the entry is not part of the atlases. */ -_ol_style_AtlasManager_.prototype.mergeInfos_ = function(info, hitInfo) { +AtlasManager.prototype.mergeInfos_ = function(info, hitInfo) { return /** @type {ol.AtlasManagerInfo} */ ({ offsetX: info.offsetX, offsetY: info.offsetY, @@ -161,7 +161,7 @@ _ol_style_AtlasManager_.prototype.mergeInfos_ = function(info, hitInfo) { * @return {?ol.AtlasManagerInfo} The position and atlas image for the * entry, or `null` if the image is too big. */ -_ol_style_AtlasManager_.prototype.add = function(id, width, height, +AtlasManager.prototype.add = function(id, width, height, renderCallback, opt_renderHitCallback, opt_this) { if (width + this.space_ > this.maxSize_ || height + this.space_ > this.maxSize_) { @@ -201,7 +201,7 @@ _ol_style_AtlasManager_.prototype.add = function(id, width, height, * @return {?ol.AtlasInfo} The position and atlas image for the entry, * or `null` if the image is too big. */ -_ol_style_AtlasManager_.prototype.add_ = function(isHitAtlas, id, width, height, +AtlasManager.prototype.add_ = function(isHitAtlas, id, width, height, renderCallback, opt_this) { var atlases = (isHitAtlas) ? this.hitAtlases_ : this.atlases_; var atlas, info, i, ii; @@ -229,4 +229,4 @@ _ol_style_AtlasManager_.prototype.add_ = function(isHitAtlas, id, width, height, } return null; }; -export default _ol_style_AtlasManager_; +export default AtlasManager; diff --git a/test/spec/ol/style/atlasmanager.test.js b/test/spec/ol/style/atlasmanager.test.js index 83778a81bd..2559f10d1a 100644 --- a/test/spec/ol/style/atlasmanager.test.js +++ b/test/spec/ol/style/atlasmanager.test.js @@ -1,5 +1,5 @@ import Atlas from '../../../../src/ol/style/Atlas.js'; -import _ol_style_AtlasManager_ from '../../../../src/ol/style/AtlasManager.js'; +import AtlasManager from '../../../../src/ol/style/AtlasManager.js'; describe('ol.style.Atlas', function() { @@ -179,7 +179,7 @@ describe('ol.style.AtlasManager', function() { describe('#constructor', function() { it('inits the atlas manager', function() { - var manager = new _ol_style_AtlasManager_(); + var manager = new AtlasManager(); expect(manager.atlases_).to.not.be.empty(); }); }); @@ -187,7 +187,7 @@ describe('ol.style.AtlasManager', function() { describe('#add', function() { it('adds one entry', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); var info = manager.add('1', 32, 32, defaultRender); expect(info).to.eql({ @@ -198,7 +198,7 @@ describe('ol.style.AtlasManager', function() { }); it('adds one entry (also to the hit detection atlas)', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); var info = manager.add('1', 32, 32, defaultRender, defaultRender); expect(info).to.eql({ @@ -209,7 +209,7 @@ describe('ol.style.AtlasManager', function() { }); it('creates a new atlas if needed', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); expect(manager.add('1', 100, 100, defaultRender, defaultRender)) .to.be.ok(); var info = manager.add('2', 100, 100, defaultRender, defaultRender); @@ -221,7 +221,7 @@ describe('ol.style.AtlasManager', function() { }); it('creates new atlases until one is large enough', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); expect(manager.add('1', 100, 100, defaultRender, defaultRender)) .to.be.ok(); expect(manager.atlases_).to.have.length(1); @@ -235,7 +235,7 @@ describe('ol.style.AtlasManager', function() { }); it('checks all existing atlases and create a new if needed', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); expect(manager.add('1', 100, 100, defaultRender, defaultRender)) .to.be.ok(); expect(manager.add('2', 100, 100, defaultRender, defaultRender)) @@ -251,7 +251,7 @@ describe('ol.style.AtlasManager', function() { }); it('returns null if the size exceeds the maximum size', function() { - var manager = new _ol_style_AtlasManager_( + var manager = new AtlasManager( {initialSize: 128, maxSize: 2048}); expect(manager.add('1', 100, 100, defaultRender, defaultRender)) .to.be.ok(); @@ -260,7 +260,7 @@ describe('ol.style.AtlasManager', function() { }); it('always has the same offset for the hit-detection', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); // add one image without hit-detection callback var info = manager.add('1', 32, 32, defaultRender); // add then one with hit-detection callback @@ -277,7 +277,7 @@ describe('ol.style.AtlasManager', function() { describe('#getInfo', function() { it('returns null if no entry for the given id', function() { - var manager = new _ol_style_AtlasManager_({initialSize: 128}); + var manager = new AtlasManager({initialSize: 128}); expect(manager.getInfo('123456')).to.eql(null); }); }); diff --git a/test/spec/ol/style/circle.test.js b/test/spec/ol/style/circle.test.js index a69e586459..657d08fc97 100644 --- a/test/spec/ol/style/circle.test.js +++ b/test/spec/ol/style/circle.test.js @@ -1,4 +1,4 @@ -import _ol_style_AtlasManager_ from '../../../../src/ol/style/AtlasManager.js'; +import AtlasManager from '../../../../src/ol/style/AtlasManager.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -40,7 +40,7 @@ describe('ol.style.Circle', function() { }); it('adds itself to an atlas manager (no fill-style)', function() { - var atlasManager = new _ol_style_AtlasManager_({initialSize: 512}); + var atlasManager = new AtlasManager({initialSize: 512}); var style = new _ol_style_Circle_({radius: 10, atlasManager: atlasManager}); expect(style.getImage()).to.be.an(HTMLCanvasElement); expect(style.getSize()).to.eql([21, 21]); @@ -54,7 +54,7 @@ describe('ol.style.Circle', function() { }); it('adds itself to an atlas manager (fill-style)', function() { - var atlasManager = new _ol_style_AtlasManager_({initialSize: 512}); + var atlasManager = new AtlasManager({initialSize: 512}); var style = new _ol_style_Circle_({ radius: 10, atlasManager: atlasManager, diff --git a/test/spec/ol/style/regularshape.test.js b/test/spec/ol/style/regularshape.test.js index 9442bdd189..faf7a02de0 100644 --- a/test/spec/ol/style/regularshape.test.js +++ b/test/spec/ol/style/regularshape.test.js @@ -1,4 +1,4 @@ -import _ol_style_AtlasManager_ from '../../../../src/ol/style/AtlasManager.js'; +import AtlasManager from '../../../../src/ol/style/AtlasManager.js'; import _ol_style_RegularShape_ from '../../../../src/ol/style/RegularShape.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -66,7 +66,7 @@ describe('ol.style.RegularShape', function() { }); it('adds itself to an atlas manager (no fill-style)', function() { - var atlasManager = new _ol_style_AtlasManager_({initialSize: 512}); + var atlasManager = new AtlasManager({initialSize: 512}); var style = new _ol_style_RegularShape_( {radius: 10, atlasManager: atlasManager}); expect(style.getImage()).to.be.an(HTMLCanvasElement); @@ -81,7 +81,7 @@ describe('ol.style.RegularShape', function() { }); it('adds itself to an atlas manager (fill-style)', function() { - var atlasManager = new _ol_style_AtlasManager_({initialSize: 512}); + var atlasManager = new AtlasManager({initialSize: 512}); var style = new _ol_style_RegularShape_({ radius: 10, atlasManager: atlasManager, From 4f4c90fc2030aeaac11e1adc2ab410ea7bc32760 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 13:22:43 -0700 Subject: [PATCH 24/35] Rename _ol_style_Style_ to Style --- examples/blend-modes.js | 8 +-- examples/canvas-gradient-pattern.js | 4 +- examples/center.js | 4 +- examples/cluster.js | 4 +- examples/custom-interactions.js | 4 +- examples/drag-and-drop-image-vector.js | 14 ++-- examples/drag-and-drop.js | 14 ++-- examples/draw-and-modify-features.js | 4 +- examples/dynamic-data.js | 8 +-- examples/earthquake-clusters.js | 8 +-- examples/earthquake-custom-symbol.js | 6 +- examples/feature-animation.js | 4 +- examples/feature-move-animation.js | 8 +-- examples/flight-animation.js | 4 +- examples/geojson.js | 18 ++--- examples/geolocation.js | 4 +- examples/gpx.js | 8 +-- examples/hit-tolerance.js | 4 +- examples/icon-color.js | 8 +-- examples/icon-negative.js | 4 +- examples/icon-sprite-webgl.js | 6 +- examples/icon.js | 4 +- examples/igc.js | 8 +-- examples/image-vector-layer.js | 6 +- examples/kml-earthquakes.js | 4 +- examples/kml-timezones.js | 4 +- examples/layer-z-index.js | 8 +-- examples/line-arrows.js | 6 +- examples/mapbox-vector-tiles-advanced.js | 4 +- examples/mapbox-vector-tiles.js | 4 +- examples/measure.js | 6 +- examples/modify-test.js | 24 +++---- examples/osm-vector-tiles.js | 8 +-- examples/polygon-styles.js | 6 +- examples/regularshape.js | 12 ++-- examples/render-geometry.js | 4 +- examples/snap.js | 4 +- examples/street-labels.js | 4 +- examples/symbol-atlas-webgl.js | 4 +- examples/synthetic-lines.js | 4 +- examples/synthetic-points.js | 8 +-- examples/topojson.js | 4 +- examples/topolis.js | 8 +-- examples/vector-esri.js | 10 +-- examples/vector-label-decluttering.js | 6 +- examples/vector-labels.js | 8 +-- examples/vector-layer.js | 6 +- examples/vector-osm.js | 14 ++-- examples/vector-wfs-getfeature.js | 4 +- examples/vector-wfs.js | 4 +- src/ol/Feature.js | 4 +- src/ol/format/KML.js | 8 +-- src/ol/interaction/Draw.js | 4 +- src/ol/interaction/Extent.js | 6 +- src/ol/interaction/Modify.js | 4 +- src/ol/interaction/Select.js | 4 +- src/ol/layer/Heatmap.js | 4 +- src/ol/layer/Vector.js | 6 +- src/ol/style/Style.js | 70 +++++++++---------- test/rendering/ol/layer/clip.test.js | 4 +- test/rendering/ol/layer/vector.test.js | 70 +++++++++---------- test/rendering/ol/layer/vectortile.test.js | 6 +- test/rendering/ol/render.test.js | 16 ++--- test/rendering/ol/style/circle.test.js | 20 +++--- test/rendering/ol/style/icon.test.js | 4 +- test/rendering/ol/style/linestring.test.js | 14 ++-- test/rendering/ol/style/polygon.test.js | 28 ++++---- test/rendering/ol/style/regularshape.test.js | 10 +-- test/rendering/ol/style/text.test.js | 32 ++++----- test/spec/ol/feature.test.js | 10 +-- test/spec/ol/format/kml.test.js | 64 ++++++++--------- test/spec/ol/layer/vector.test.js | 18 ++--- test/spec/ol/render/canvas/immediate.test.js | 4 +- test/spec/ol/render/webgl/immediate.test.js | 4 +- test/spec/ol/renderer/canvas/map.test.js | 4 +- test/spec/ol/renderer/canvas/replay.test.js | 12 ++-- .../ol/renderer/canvas/vectorlayer.test.js | 12 ++-- .../renderer/canvas/vectortilelayer.test.js | 10 +-- test/spec/ol/renderer/vector.test.js | 4 +- test/spec/ol/style/style.test.js | 42 +++++------ 80 files changed, 420 insertions(+), 420 deletions(-) diff --git a/examples/blend-modes.js b/examples/blend-modes.js index 819f4c4798..3541d6fc90 100644 --- a/examples/blend-modes.js +++ b/examples/blend-modes.js @@ -7,7 +7,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; // Create separate layers for red, green an blue circles. @@ -18,7 +18,7 @@ var redLayer = new VectorLayer({ source: new VectorSource({ features: [new Feature(new Point([0, 0]))] }), - style: new _ol_style_Style_({ + style: new Style({ image: new _ol_style_Circle_({ fill: new _ol_style_Fill_({ color: 'rgba(255,0,0,0.8)' @@ -36,7 +36,7 @@ var greenLayer = new VectorLayer({ // 433.013 is roughly 250 * Math.sqrt(3) features: [new Feature(new Point([250, 433.013]))] }), - style: new _ol_style_Style_({ + style: new Style({ image: new _ol_style_Circle_({ fill: new _ol_style_Fill_({ color: 'rgba(0,255,0,0.8)' @@ -53,7 +53,7 @@ var blueLayer = new VectorLayer({ source: new VectorSource({ features: [new Feature(new Point([500, 0]))] }), - style: new _ol_style_Style_({ + style: new Style({ image: new _ol_style_Circle_({ fill: new _ol_style_Fill_({ color: 'rgba(0,0,255,0.8)' diff --git a/examples/canvas-gradient-pattern.js b/examples/canvas-gradient-pattern.js index f4810a1430..ceb4573098 100644 --- a/examples/canvas-gradient-pattern.js +++ b/examples/canvas-gradient-pattern.js @@ -8,7 +8,7 @@ import {fromLonLat} from '../src/ol/proj.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var canvas = document.createElement('canvas'); var context = canvas.getContext('2d'); @@ -58,7 +58,7 @@ var pattern = (function() { // Generate style for gradient or pattern fill var fill = new _ol_style_Fill_(); -var style = new _ol_style_Style_({ +var style = new Style({ fill: fill, stroke: new _ol_style_Stroke_({ color: '#333', diff --git a/examples/center.js b/examples/center.js index df01af6871..8ffa8e0a13 100644 --- a/examples/center.js +++ b/examples/center.js @@ -9,13 +9,13 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var source = new VectorSource({ url: 'data/geojson/switzerland.geojson', format: new GeoJSON() }); -var style = new _ol_style_Style_({ +var style = new Style({ fill: new _ol_style_Fill_({ color: 'rgba(255, 255, 255, 0.6)' }), diff --git a/examples/cluster.js b/examples/cluster.js index 984abc59db..aceafc6e80 100644 --- a/examples/cluster.js +++ b/examples/cluster.js @@ -10,7 +10,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; import _ol_style_Text_ from '../src/ol/style/Text.js'; @@ -40,7 +40,7 @@ var clusters = new VectorLayer({ var size = feature.get('features').length; var style = styleCache[size]; if (!style) { - style = new _ol_style_Style_({ + style = new Style({ image: new _ol_style_Circle_({ radius: 10, stroke: new _ol_style_Stroke_({ diff --git a/examples/custom-interactions.js b/examples/custom-interactions.js index 5b42560c59..11d5901ad8 100644 --- a/examples/custom-interactions.js +++ b/examples/custom-interactions.js @@ -14,7 +14,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; /** @@ -156,7 +156,7 @@ var map = new Map({ source: new VectorSource({ features: [pointFeature, lineFeature, polygonFeature] }), - style: new _ol_style_Style_({ + style: new Style({ image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ anchor: [0.5, 46], anchorXUnits: 'fraction', diff --git a/examples/drag-and-drop-image-vector.js b/examples/drag-and-drop-image-vector.js index 7f69b9213d..ba7ea9f0ee 100644 --- a/examples/drag-and-drop-image-vector.js +++ b/examples/drag-and-drop-image-vector.js @@ -14,11 +14,11 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var defaultStyle = { - 'Point': new _ol_style_Style_({ + 'Point': new Style({ image: new _ol_style_Circle_({ fill: new _ol_style_Fill_({ color: 'rgba(255,255,0,0.5)' @@ -30,13 +30,13 @@ var defaultStyle = { }) }) }), - 'LineString': new _ol_style_Style_({ + 'LineString': new Style({ stroke: new _ol_style_Stroke_({ color: '#f00', width: 3 }) }), - 'Polygon': new _ol_style_Style_({ + 'Polygon': new Style({ fill: new _ol_style_Fill_({ color: 'rgba(0,255,255,0.5)' }), @@ -45,7 +45,7 @@ var defaultStyle = { width: 1 }) }), - 'MultiPoint': new _ol_style_Style_({ + 'MultiPoint': new Style({ image: new _ol_style_Circle_({ fill: new _ol_style_Fill_({ color: 'rgba(255,0,255,0.5)' @@ -57,13 +57,13 @@ var defaultStyle = { }) }) }), - 'MultiLineString': new _ol_style_Style_({ + 'MultiLineString': new Style({ stroke: new _ol_style_Stroke_({ color: '#0f0', width: 3 }) }), - 'MultiPolygon': new _ol_style_Style_({ + 'MultiPolygon': new Style({ fill: new _ol_style_Fill_({ color: 'rgba(0,0,255,0.5)' }), diff --git a/examples/drag-and-drop.js b/examples/drag-and-drop.js index fd61bd55f0..917200124f 100644 --- a/examples/drag-and-drop.js +++ b/examples/drag-and-drop.js @@ -14,11 +14,11 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var defaultStyle = { - 'Point': new _ol_style_Style_({ + 'Point': new Style({ image: new _ol_style_Circle_({ fill: new _ol_style_Fill_({ color: 'rgba(255,255,0,0.5)' @@ -30,13 +30,13 @@ var defaultStyle = { }) }) }), - 'LineString': new _ol_style_Style_({ + 'LineString': new Style({ stroke: new _ol_style_Stroke_({ color: '#f00', width: 3 }) }), - 'Polygon': new _ol_style_Style_({ + 'Polygon': new Style({ fill: new _ol_style_Fill_({ color: 'rgba(0,255,255,0.5)' }), @@ -45,7 +45,7 @@ var defaultStyle = { width: 1 }) }), - 'MultiPoint': new _ol_style_Style_({ + 'MultiPoint': new Style({ image: new _ol_style_Circle_({ fill: new _ol_style_Fill_({ color: 'rgba(255,0,255,0.5)' @@ -57,13 +57,13 @@ var defaultStyle = { }) }) }), - 'MultiLineString': new _ol_style_Style_({ + 'MultiLineString': new Style({ stroke: new _ol_style_Stroke_({ color: '#0f0', width: 3 }) }), - 'MultiPolygon': new _ol_style_Style_({ + 'MultiPolygon': new Style({ fill: new _ol_style_Fill_({ color: 'rgba(0,0,255,0.5)' }), diff --git a/examples/draw-and-modify-features.js b/examples/draw-and-modify-features.js index c3d5931f3d..a2f7b967a9 100644 --- a/examples/draw-and-modify-features.js +++ b/examples/draw-and-modify-features.js @@ -10,7 +10,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var raster = new TileLayer({ source: new OSM() @@ -19,7 +19,7 @@ var raster = new TileLayer({ var source = new VectorSource(); var vector = new VectorLayer({ source: source, - style: new _ol_style_Style_({ + style: new Style({ fill: new _ol_style_Fill_({ color: 'rgba(255, 255, 255, 0.2)' }), diff --git a/examples/dynamic-data.js b/examples/dynamic-data.js index 59393de30d..7c2de24d59 100644 --- a/examples/dynamic-data.js +++ b/examples/dynamic-data.js @@ -7,7 +7,7 @@ import OSM from '../src/ol/source/OSM.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var map = new Map({ @@ -23,7 +23,7 @@ var map = new Map({ }) }); -var imageStyle = new _ol_style_Style_({ +var imageStyle = new Style({ image: new _ol_style_Circle_({ radius: 5, snapToPixel: false, @@ -32,7 +32,7 @@ var imageStyle = new _ol_style_Style_({ }) }); -var headInnerImageStyle = new _ol_style_Style_({ +var headInnerImageStyle = new Style({ image: new _ol_style_Circle_({ radius: 2, snapToPixel: false, @@ -40,7 +40,7 @@ var headInnerImageStyle = new _ol_style_Style_({ }) }); -var headOuterImageStyle = new _ol_style_Style_({ +var headOuterImageStyle = new Style({ image: new _ol_style_Circle_({ radius: 5, snapToPixel: false, diff --git a/examples/earthquake-clusters.js b/examples/earthquake-clusters.js index 7462b90de4..6e9a0e9ed6 100644 --- a/examples/earthquake-clusters.js +++ b/examples/earthquake-clusters.js @@ -13,7 +13,7 @@ import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; import _ol_style_Text_ from '../src/ol/style/Text.js'; @@ -43,7 +43,7 @@ function createEarthquakeStyle(feature) { var magnitude = parseFloat(name.substr(2)); var radius = 5 + 20 * (magnitude - 5); - return new _ol_style_Style_({ + return new Style({ geometry: feature.getGeometry(), image: new _ol_style_RegularShape_({ radius1: radius, @@ -85,7 +85,7 @@ function styleFunction(feature, resolution) { var style; var size = feature.get('features').length; if (size > 1) { - style = new _ol_style_Style_({ + style = new Style({ image: new _ol_style_Circle_({ radius: feature.get('radius'), fill: new _ol_style_Fill_({ @@ -106,7 +106,7 @@ function styleFunction(feature, resolution) { } function selectStyleFunction(feature) { - var styles = [new _ol_style_Style_({ + var styles = [new Style({ image: new _ol_style_Circle_({ radius: feature.get('radius'), fill: invisibleFill diff --git a/examples/earthquake-custom-symbol.js b/examples/earthquake-custom-symbol.js index 6375c0a526..fd3a756a84 100644 --- a/examples/earthquake-custom-symbol.js +++ b/examples/earthquake-custom-symbol.js @@ -10,7 +10,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var symbol = [[0, 0], [4, 2], [6, 0], [10, 5], [6, 3], [4, 5], [0, 0]]; @@ -35,12 +35,12 @@ var styleFunction = function(feature) { var vectorContext = _ol_render_.toContext( /** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d')), {size: [size, size], pixelRatio: 1}); - vectorContext.setStyle(new _ol_style_Style_({ + vectorContext.setStyle(new Style({ fill: new _ol_style_Fill_({color: 'rgba(255, 153, 0, 0.4)'}), stroke: new _ol_style_Stroke_({color: 'rgba(255, 204, 0, 0.2)', width: 2}) })); vectorContext.drawGeometry(new Polygon([symbol.map(scaleFunction)])); - style = new _ol_style_Style_({ + style = new Style({ image: new _ol_style_Icon_({ img: canvas, imgSize: [size, size], diff --git a/examples/feature-animation.js b/examples/feature-animation.js index 0631fa4991..77d1d5384a 100644 --- a/examples/feature-animation.js +++ b/examples/feature-animation.js @@ -12,7 +12,7 @@ import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var map = new Map({ @@ -66,7 +66,7 @@ function flash(feature) { var radius = easeOut(elapsedRatio) * 25 + 5; var opacity = easeOut(1 - elapsedRatio); - var style = new _ol_style_Style_({ + var style = new Style({ image: new _ol_style_Circle_({ radius: radius, snapToPixel: false, diff --git a/examples/feature-move-animation.js b/examples/feature-move-animation.js index 43e1157680..c142c2ff4e 100644 --- a/examples/feature-move-animation.js +++ b/examples/feature-move-animation.js @@ -11,7 +11,7 @@ import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; // This long string is placed here due to jsFiddle limitations. // It is usually loaded with AJAX. @@ -85,18 +85,18 @@ var endMarker = new Feature({ }); var styles = { - 'route': new _ol_style_Style_({ + 'route': new Style({ stroke: new _ol_style_Stroke_({ width: 6, color: [237, 212, 0, 0.8] }) }), - 'icon': new _ol_style_Style_({ + 'icon': new Style({ image: new _ol_style_Icon_({ anchor: [0.5, 1], src: 'data/icon.png' }) }), - 'geoMarker': new _ol_style_Style_({ + 'geoMarker': new Style({ image: new _ol_style_Circle_({ radius: 7, snapToPixel: false, diff --git a/examples/flight-animation.js b/examples/flight-animation.js index fdad2f77bd..dbfe79f07d 100644 --- a/examples/flight-animation.js +++ b/examples/flight-animation.js @@ -8,7 +8,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import Stamen from '../src/ol/source/Stamen.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var map = new Map({ layers: [ @@ -25,7 +25,7 @@ var map = new Map({ }) }); -var style = new _ol_style_Style_({ +var style = new Style({ stroke: new _ol_style_Stroke_({ color: '#EAE911', width: 2 diff --git a/examples/geojson.js b/examples/geojson.js index b9c1ea093d..2ec7aa15ce 100644 --- a/examples/geojson.js +++ b/examples/geojson.js @@ -11,7 +11,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var image = new _ol_style_Circle_({ @@ -21,25 +21,25 @@ var image = new _ol_style_Circle_({ }); var styles = { - 'Point': new _ol_style_Style_({ + 'Point': new Style({ image: image }), - 'LineString': new _ol_style_Style_({ + 'LineString': new Style({ stroke: new _ol_style_Stroke_({ color: 'green', width: 1 }) }), - 'MultiLineString': new _ol_style_Style_({ + 'MultiLineString': new Style({ stroke: new _ol_style_Stroke_({ color: 'green', width: 1 }) }), - 'MultiPoint': new _ol_style_Style_({ + 'MultiPoint': new Style({ image: image }), - 'MultiPolygon': new _ol_style_Style_({ + 'MultiPolygon': new Style({ stroke: new _ol_style_Stroke_({ color: 'yellow', width: 1 @@ -48,7 +48,7 @@ var styles = { color: 'rgba(255, 255, 0, 0.1)' }) }), - 'Polygon': new _ol_style_Style_({ + 'Polygon': new Style({ stroke: new _ol_style_Stroke_({ color: 'blue', lineDash: [4], @@ -58,7 +58,7 @@ var styles = { color: 'rgba(0, 0, 255, 0.1)' }) }), - 'GeometryCollection': new _ol_style_Style_({ + 'GeometryCollection': new Style({ stroke: new _ol_style_Stroke_({ color: 'magenta', width: 2 @@ -74,7 +74,7 @@ var styles = { }) }) }), - 'Circle': new _ol_style_Style_({ + 'Circle': new Style({ stroke: new _ol_style_Stroke_({ color: 'red', width: 2 diff --git a/examples/geolocation.js b/examples/geolocation.js index 4660adcadc..a4c5a47b65 100644 --- a/examples/geolocation.js +++ b/examples/geolocation.js @@ -11,7 +11,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var view = new View({ center: [0, 0], @@ -67,7 +67,7 @@ geolocation.on('change:accuracyGeometry', function() { }); var positionFeature = new Feature(); -positionFeature.setStyle(new _ol_style_Style_({ +positionFeature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 6, fill: new _ol_style_Fill_({ diff --git a/examples/gpx.js b/examples/gpx.js index 19a3322352..d17cac8ca8 100644 --- a/examples/gpx.js +++ b/examples/gpx.js @@ -8,7 +8,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var raster = new TileLayer({ source: new BingMaps({ @@ -18,7 +18,7 @@ var raster = new TileLayer({ }); var style = { - 'Point': new _ol_style_Style_({ + 'Point': new Style({ image: new _ol_style_Circle_({ fill: new _ol_style_Fill_({ color: 'rgba(255,255,0,0.4)' @@ -30,13 +30,13 @@ var style = { }) }) }), - 'LineString': new _ol_style_Style_({ + 'LineString': new Style({ stroke: new _ol_style_Stroke_({ color: '#f00', width: 3 }) }), - 'MultiLineString': new _ol_style_Style_({ + 'MultiLineString': new Style({ stroke: new _ol_style_Stroke_({ color: '#0f0', width: 3 diff --git a/examples/hit-tolerance.js b/examples/hit-tolerance.js index 8c1b060dfb..24cc041f57 100644 --- a/examples/hit-tolerance.js +++ b/examples/hit-tolerance.js @@ -6,14 +6,14 @@ import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import Feature from '../src/ol/Feature.js'; import LineString from '../src/ol/geom/LineString.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; var raster = new TileLayer({ source: new OSM() }); -var style = new _ol_style_Style_({ +var style = new Style({ stroke: new _ol_style_Stroke_({ color: 'black', width: 1 diff --git a/examples/icon-color.js b/examples/icon-color.js index b1380ed6b3..330eac4f71 100644 --- a/examples/icon-color.js +++ b/examples/icon-color.js @@ -8,7 +8,7 @@ import {fromLonLat} from '../src/ol/proj.js'; import TileJSON from '../src/ol/source/TileJSON.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var rome = new Feature({ @@ -23,7 +23,7 @@ var madrid = new Feature({ geometry: new Point(fromLonLat([-3.683333, 40.4])) }); -rome.setStyle(new _ol_style_Style_({ +rome.setStyle(new Style({ image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ color: '#8959A8', crossOrigin: 'anonymous', @@ -31,7 +31,7 @@ rome.setStyle(new _ol_style_Style_({ })) })); -london.setStyle(new _ol_style_Style_({ +london.setStyle(new Style({ image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ color: '#4271AE', crossOrigin: 'anonymous', @@ -39,7 +39,7 @@ london.setStyle(new _ol_style_Style_({ })) })); -madrid.setStyle(new _ol_style_Style_({ +madrid.setStyle(new Style({ image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ color: [113, 140, 0], crossOrigin: 'anonymous', diff --git a/examples/icon-negative.js b/examples/icon-negative.js index ad342938b7..5c1288a56a 100644 --- a/examples/icon-negative.js +++ b/examples/icon-negative.js @@ -8,11 +8,11 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import Stamen from '../src/ol/source/Stamen.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; function createStyle(src, img) { - return new _ol_style_Style_({ + return new Style({ image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ anchor: [0.5, 0.96], crossOrigin: 'anonymous', diff --git a/examples/icon-sprite-webgl.js b/examples/icon-sprite-webgl.js index 3e04f117e6..f0e679da67 100644 --- a/examples/icon-sprite-webgl.js +++ b/examples/icon-sprite-webgl.js @@ -5,7 +5,7 @@ import Point from '../src/ol/geom/Point.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var iconInfo = [{ @@ -65,7 +65,7 @@ for (i = 0; i < featureCount; ++i) { [2 * e * Math.random() - e, 2 * e * Math.random() - e]); feature = new Feature(geometry); feature.setStyle( - new _ol_style_Style_({ + new Style({ image: icons[i % (iconCount - 1)] }) ); @@ -101,7 +101,7 @@ new VectorLayer({ source: new VectorSource({ features: overlayFeatures }), - style: new _ol_style_Style_({ + style: new Style({ image: icons[iconCount - 1] }) }); diff --git a/examples/icon.js b/examples/icon.js index a54d17d0b3..795dd0c561 100644 --- a/examples/icon.js +++ b/examples/icon.js @@ -8,7 +8,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 _ol_style_Icon_ from '../src/ol/style/Icon.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var iconFeature = new Feature({ @@ -18,7 +18,7 @@ var iconFeature = new Feature({ rainfall: 500 }); -var iconStyle = new _ol_style_Style_({ +var iconStyle = new Style({ image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ ({ anchor: [0.5, 46], anchorXUnits: 'fraction', diff --git a/examples/igc.js b/examples/igc.js index 2faf483adf..9d652574bf 100644 --- a/examples/igc.js +++ b/examples/igc.js @@ -12,7 +12,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var colors = { @@ -28,7 +28,7 @@ var styleFunction = function(feature) { var color = colors[feature.get('PLT')]; var style = styleCache[color]; if (!style) { - style = new _ol_style_Style_({ + style = new Style({ stroke: new _ol_style_Stroke_({ color: color, width: 3 @@ -156,7 +156,7 @@ var stroke = new _ol_style_Stroke_({ color: 'rgba(255,0,0,0.9)', width: 1 }); -var style = new _ol_style_Style_({ +var style = new Style({ stroke: stroke, image: new _ol_style_Circle_({ radius: 5, @@ -178,7 +178,7 @@ map.on('postcompose', function(evt) { var featureOverlay = new VectorLayer({ source: new VectorSource(), map: map, - style: new _ol_style_Style_({ + style: new Style({ image: new _ol_style_Circle_({ radius: 5, fill: new _ol_style_Fill_({ diff --git a/examples/image-vector-layer.js b/examples/image-vector-layer.js index 55a1d0ed65..2627c065af 100644 --- a/examples/image-vector-layer.js +++ b/examples/image-vector-layer.js @@ -5,11 +5,11 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; import _ol_style_Text_ from '../src/ol/style/Text.js'; -var style = new _ol_style_Style_({ +var style = new Style({ fill: new _ol_style_Fill_({ color: 'rgba(255, 255, 255, 0.6)' }), @@ -44,7 +44,7 @@ var map = new Map({ var featureOverlay = new VectorLayer({ source: new VectorSource(), map: map, - style: new _ol_style_Style_({ + style: new Style({ stroke: new _ol_style_Stroke_({ color: '#f00', width: 1 diff --git a/examples/kml-earthquakes.js b/examples/kml-earthquakes.js index f696525a85..c5c315a884 100644 --- a/examples/kml-earthquakes.js +++ b/examples/kml-earthquakes.js @@ -8,7 +8,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var styleCache = {}; @@ -21,7 +21,7 @@ var styleFunction = function(feature) { var radius = 5 + 20 * (magnitude - 5); var style = styleCache[radius]; if (!style) { - style = new _ol_style_Style_({ + style = new Style({ image: new _ol_style_Circle_({ radius: radius, fill: new _ol_style_Fill_({ diff --git a/examples/kml-timezones.js b/examples/kml-timezones.js index 54ea073ebc..88d3849308 100644 --- a/examples/kml-timezones.js +++ b/examples/kml-timezones.js @@ -7,7 +7,7 @@ import Stamen from '../src/ol/source/Stamen.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; /* @@ -35,7 +35,7 @@ var styleFunction = function(feature) { delta = 24 - delta; } var opacity = 0.75 * (1 - delta / 12); - return new _ol_style_Style_({ + return new Style({ fill: new _ol_style_Fill_({ color: [0xff, 0xff, 0x33, opacity] }), diff --git a/examples/layer-z-index.js b/examples/layer-z-index.js index 7d13dd8a62..980faa62db 100644 --- a/examples/layer-z-index.js +++ b/examples/layer-z-index.js @@ -7,13 +7,13 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var stroke = new _ol_style_Stroke_({color: 'black', width: 1}); var styles = { - 'square': new _ol_style_Style_({ + 'square': new Style({ image: new _ol_style_RegularShape_({ fill: new _ol_style_Fill_({color: 'blue'}), stroke: stroke, @@ -22,7 +22,7 @@ var styles = { angle: Math.PI / 4 }) }), - 'triangle': new _ol_style_Style_({ + 'triangle': new Style({ image: new _ol_style_RegularShape_({ fill: new _ol_style_Fill_({color: 'red'}), stroke: stroke, @@ -32,7 +32,7 @@ var styles = { angle: 0 }) }), - 'star': new _ol_style_Style_({ + 'star': new Style({ image: new _ol_style_RegularShape_({ fill: new _ol_style_Fill_({color: 'green'}), stroke: stroke, diff --git a/examples/line-arrows.js b/examples/line-arrows.js index 14e7310731..1c49d66cc4 100644 --- a/examples/line-arrows.js +++ b/examples/line-arrows.js @@ -8,7 +8,7 @@ import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var raster = new TileLayer({ source: new OSM() @@ -20,7 +20,7 @@ var styleFunction = function(feature) { var geometry = feature.getGeometry(); var styles = [ // linestring - new _ol_style_Style_({ + new Style({ stroke: new _ol_style_Stroke_({ color: '#ffcc33', width: 2 @@ -33,7 +33,7 @@ var styleFunction = function(feature) { var dy = end[1] - start[1]; var rotation = Math.atan2(dy, dx); // arrows - styles.push(new _ol_style_Style_({ + styles.push(new Style({ geometry: new Point(end), image: new _ol_style_Icon_({ src: 'data/arrow.png', diff --git a/examples/mapbox-vector-tiles-advanced.js b/examples/mapbox-vector-tiles-advanced.js index 7ec9918e69..4359817c5d 100644 --- a/examples/mapbox-vector-tiles-advanced.js +++ b/examples/mapbox-vector-tiles-advanced.js @@ -7,7 +7,7 @@ import VectorTileSource from '../src/ol/source/VectorTile.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; import _ol_style_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(_ol_style_Style_, _ol_style_Fill_, _ol_style_Stroke_, _ol_style_Icon_, _ol_style_Text_) + style: createMapboxStreetsV6Style(Style, _ol_style_Fill_, _ol_style_Stroke_, _ol_style_Icon_, _ol_style_Text_) }) ], target: 'map', diff --git a/examples/mapbox-vector-tiles.js b/examples/mapbox-vector-tiles.js index 70b138f638..1000b987c1 100644 --- a/examples/mapbox-vector-tiles.js +++ b/examples/mapbox-vector-tiles.js @@ -6,7 +6,7 @@ import VectorTileSource from '../src/ol/source/VectorTile.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import 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(_ol_style_Style_, _ol_style_Fill_, _ol_style_Stroke_, _ol_style_Icon_, _ol_style_Text_) + style: createMapboxStreetsV6Style(Style, _ol_style_Fill_, _ol_style_Stroke_, _ol_style_Icon_, _ol_style_Text_) }) ], target: 'map', diff --git a/examples/measure.js b/examples/measure.js index 0f7972a1bd..e084737cb1 100644 --- a/examples/measure.js +++ b/examples/measure.js @@ -13,7 +13,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var raster = new TileLayer({ @@ -24,7 +24,7 @@ var source = new VectorSource(); var vector = new VectorLayer({ source: source, - style: new _ol_style_Style_({ + style: new Style({ fill: new _ol_style_Fill_({ color: 'rgba(255, 255, 255, 0.2)' }), @@ -180,7 +180,7 @@ function addInteraction() { draw = new Draw({ source: source, type: type, - style: new _ol_style_Style_({ + style: new Style({ fill: new _ol_style_Fill_({ color: 'rgba(255, 255, 255, 0.2)' }), diff --git a/examples/modify-test.js b/examples/modify-test.js index 4018f2325a..4652665be3 100644 --- a/examples/modify-test.js +++ b/examples/modify-test.js @@ -9,7 +9,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var styleFunction = (function() { @@ -19,8 +19,8 @@ var styleFunction = (function() { fill: null, stroke: new _ol_style_Stroke_({color: 'orange', width: 2}) }); - styles['Point'] = new _ol_style_Style_({image: image}); - styles['Polygon'] = new _ol_style_Style_({ + styles['Point'] = new Style({image: image}); + styles['Polygon'] = new Style({ stroke: new _ol_style_Stroke_({ color: 'blue', width: 3 @@ -29,13 +29,13 @@ var styleFunction = (function() { color: 'rgba(0, 0, 255, 0.1)' }) }); - styles['MultiLineString'] = new _ol_style_Style_({ + styles['MultiLineString'] = new Style({ stroke: new _ol_style_Stroke_({ color: 'green', width: 3 }) }); - styles['MultiPolygon'] = new _ol_style_Style_({ + styles['MultiPolygon'] = new Style({ stroke: new _ol_style_Stroke_({ color: 'yellow', width: 1 @@ -44,7 +44,7 @@ var styleFunction = (function() { color: 'rgba(255, 255, 0, 0.1)' }) }); - styles['default'] = new _ol_style_Style_({ + styles['default'] = new Style({ stroke: new _ol_style_Stroke_({ color: 'red', width: 3 @@ -156,18 +156,18 @@ var layer = new VectorLayer({ var overlayStyle = (function() { var styles = {}; styles['Polygon'] = [ - new _ol_style_Style_({ + new Style({ fill: new _ol_style_Fill_({ color: [255, 255, 255, 0.5] }) }), - new _ol_style_Style_({ + new Style({ stroke: new _ol_style_Stroke_({ color: [255, 255, 255, 1], width: 5 }) }), - new _ol_style_Style_({ + new Style({ stroke: new _ol_style_Stroke_({ color: [0, 153, 255, 1], width: 3 @@ -177,13 +177,13 @@ var overlayStyle = (function() { styles['MultiPolygon'] = styles['Polygon']; styles['LineString'] = [ - new _ol_style_Style_({ + new Style({ stroke: new _ol_style_Stroke_({ color: [255, 255, 255, 1], width: 5 }) }), - new _ol_style_Style_({ + new Style({ stroke: new _ol_style_Stroke_({ color: [0, 153, 255, 1], width: 3 @@ -193,7 +193,7 @@ var overlayStyle = (function() { styles['MultiLineString'] = styles['LineString']; styles['Point'] = [ - new _ol_style_Style_({ + new Style({ image: new _ol_style_Circle_({ radius: 7, fill: new _ol_style_Fill_({ diff --git a/examples/osm-vector-tiles.js b/examples/osm-vector-tiles.js index b949154975..dd490963c1 100644 --- a/examples/osm-vector-tiles.js +++ b/examples/osm-vector-tiles.js @@ -6,7 +6,7 @@ import {fromLonLat} from '../src/ol/proj.js'; import VectorTileSource from '../src/ol/source/VectorTile.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var key = 'vector-tiles-5eJz6JX'; @@ -16,7 +16,7 @@ var roadColor = { 'minor_road': '#ccb', 'highway': '#f39' }; -var buildingStyle = new _ol_style_Style_({ +var buildingStyle = new Style({ fill: new _ol_style_Fill_({ color: '#666', opacity: 0.4 @@ -26,7 +26,7 @@ var buildingStyle = new _ol_style_Style_({ width: 1 }) }); -var waterStyle = new _ol_style_Style_({ +var waterStyle = new Style({ fill: new _ol_style_Fill_({ color: '#9db9e8' }) @@ -46,7 +46,7 @@ var roadStyle = function(feature) { color = roadColor[kind]; width = kind == 'highway' ? 1.5 : 1; } - style = new _ol_style_Style_({ + style = new Style({ stroke: new _ol_style_Stroke_({ color: color, width: width diff --git a/examples/polygon-styles.js b/examples/polygon-styles.js index 20947b5126..8134f5762d 100644 --- a/examples/polygon-styles.js +++ b/examples/polygon-styles.js @@ -7,7 +7,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var styles = [ /* We are using two different styles for the polygons: @@ -17,7 +17,7 @@ var styles = [ * returned as `MultiPoint` geometry, which will be used to render * the style. */ - new _ol_style_Style_({ + new Style({ stroke: new _ol_style_Stroke_({ color: 'blue', width: 3 @@ -26,7 +26,7 @@ var styles = [ color: 'rgba(0, 0, 255, 0.1)' }) }), - new _ol_style_Style_({ + new Style({ image: new _ol_style_Circle_({ radius: 5, fill: new _ol_style_Fill_({ diff --git a/examples/regularshape.js b/examples/regularshape.js index 88dde56b95..fde861489b 100644 --- a/examples/regularshape.js +++ b/examples/regularshape.js @@ -7,14 +7,14 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var stroke = new _ol_style_Stroke_({color: 'black', width: 2}); var fill = new _ol_style_Fill_({color: 'red'}); var styles = { - 'square': new _ol_style_Style_({ + 'square': new Style({ image: new _ol_style_RegularShape_({ fill: fill, stroke: stroke, @@ -23,7 +23,7 @@ var styles = { angle: Math.PI / 4 }) }), - 'triangle': new _ol_style_Style_({ + 'triangle': new Style({ image: new _ol_style_RegularShape_({ fill: fill, stroke: stroke, @@ -33,7 +33,7 @@ var styles = { angle: 0 }) }), - 'star': new _ol_style_Style_({ + 'star': new Style({ image: new _ol_style_RegularShape_({ fill: fill, stroke: stroke, @@ -43,7 +43,7 @@ var styles = { angle: 0 }) }), - 'cross': new _ol_style_Style_({ + 'cross': new Style({ image: new _ol_style_RegularShape_({ fill: fill, stroke: stroke, @@ -53,7 +53,7 @@ var styles = { angle: 0 }) }), - 'x': new _ol_style_Style_({ + 'x': new Style({ image: new _ol_style_RegularShape_({ fill: fill, stroke: stroke, diff --git a/examples/render-geometry.js b/examples/render-geometry.js index d12cc98479..cafd0d616f 100644 --- a/examples/render-geometry.js +++ b/examples/render-geometry.js @@ -5,7 +5,7 @@ import _ol_render_ from '../src/ol/render.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var canvas = document.getElementById('canvas'); @@ -13,7 +13,7 @@ var vectorContext = _ol_render_.toContext(canvas.getContext('2d'), {size: [100, var fill = new _ol_style_Fill_({color: 'blue'}); var stroke = new _ol_style_Stroke_({color: 'black'}); -var style = new _ol_style_Style_({ +var style = new Style({ fill: fill, stroke: stroke, image: new _ol_style_Circle_({ diff --git a/examples/snap.js b/examples/snap.js index 7a78c7105e..964f1220a5 100644 --- a/examples/snap.js +++ b/examples/snap.js @@ -11,7 +11,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var raster = new TileLayer({ source: new OSM() @@ -19,7 +19,7 @@ var raster = new TileLayer({ var vector = new VectorLayer({ source: new VectorSource(), - style: new _ol_style_Style_({ + style: new Style({ fill: new _ol_style_Fill_({ color: 'rgba(255, 255, 255, 0.2)' }), diff --git a/examples/street-labels.js b/examples/street-labels.js index fc2f0c9db5..56f1a4490d 100644 --- a/examples/street-labels.js +++ b/examples/street-labels.js @@ -7,10 +7,10 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import BingMaps from '../src/ol/source/BingMaps.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; import _ol_style_Text_ from '../src/ol/style/Text.js'; -var style = new _ol_style_Style_({ +var style = new Style({ text: new _ol_style_Text_({ font: 'bold 11px "Open Sans", "Arial Unicode MS", "sans-serif"', placement: 'line', diff --git a/examples/symbol-atlas-webgl.js b/examples/symbol-atlas-webgl.js index 1849c5fd5c..35dfb9da4c 100644 --- a/examples/symbol-atlas-webgl.js +++ b/examples/symbol-atlas-webgl.js @@ -9,7 +9,7 @@ import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var atlasManager = new AtlasManager({ // we increase the initial size so that all symbols fit into @@ -92,7 +92,7 @@ for (i = 0; i < featureCount; ++i) { [2 * e * Math.random() - e, 2 * e * Math.random() - e]); feature = new Feature(geometry); feature.setStyle( - new _ol_style_Style_({ + new Style({ image: symbols[i % symbolCount] }) ); diff --git a/examples/synthetic-lines.js b/examples/synthetic-lines.js index a5e41f051b..511e8fb2c2 100644 --- a/examples/synthetic-lines.js +++ b/examples/synthetic-lines.js @@ -5,7 +5,7 @@ import LineString from '../src/ol/geom/LineString.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var count = 10000; @@ -41,7 +41,7 @@ var vector = new VectorLayer({ features: features, wrapX: false }), - style: new _ol_style_Style_({ + style: new Style({ stroke: new _ol_style_Stroke_({ color: '#666666', width: 1 diff --git a/examples/synthetic-points.js b/examples/synthetic-points.js index 84b48cbd0f..51f5a3fafe 100644 --- a/examples/synthetic-points.js +++ b/examples/synthetic-points.js @@ -8,7 +8,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var count = 20000; @@ -24,14 +24,14 @@ for (var i = 0; i < count; ++i) { } var styles = { - '10': new _ol_style_Style_({ + '10': new Style({ image: new _ol_style_Circle_({ radius: 5, fill: new _ol_style_Fill_({color: '#666666'}), stroke: new _ol_style_Stroke_({color: '#bada55', width: 1}) }) }), - '20': new _ol_style_Style_({ + '20': new Style({ image: new _ol_style_Circle_({ radius: 10, fill: new _ol_style_Fill_({color: '#666666'}), @@ -100,7 +100,7 @@ var stroke = new _ol_style_Stroke_({ color: 'rgba(255,255,0,0.9)', width: 3 }); -var style = new _ol_style_Style_({ +var style = new Style({ stroke: stroke, image: new _ol_style_Circle_({ radius: 10, diff --git a/examples/topojson.js b/examples/topojson.js index 7f2b92922e..fcc39c7667 100644 --- a/examples/topojson.js +++ b/examples/topojson.js @@ -7,7 +7,7 @@ import TileJSON from '../src/ol/source/TileJSON.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var raster = new TileLayer({ @@ -16,7 +16,7 @@ var raster = new TileLayer({ }) }); -var style = new _ol_style_Style_({ +var style = new Style({ fill: new _ol_style_Fill_({ color: 'rgba(255, 255, 255, 0.6)' }), diff --git a/examples/topolis.js b/examples/topolis.js index 771e03bf60..e018f792cd 100644 --- a/examples/topolis.js +++ b/examples/topolis.js @@ -13,7 +13,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_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; @@ -28,7 +28,7 @@ var nodes = new VectorSource({wrapX: false}); var nodesLayer = new VectorLayer({ source: nodes, style: function(f) { - var style = new _ol_style_Style_({ + var style = new Style({ image: new _ol_style_Circle_({ radius: 8, fill: new _ol_style_Fill_({color: 'rgba(255, 0, 0, 0.2)'}), @@ -51,7 +51,7 @@ var edges = new VectorSource({wrapX: false}); var edgesLayer = new VectorLayer({ source: edges, style: function(f) { - var style = new _ol_style_Style_({ + var style = new Style({ stroke: new _ol_style_Stroke_({ color: 'blue', width: 1 @@ -73,7 +73,7 @@ var faces = new VectorSource({wrapX: false}); var facesLayer = new VectorLayer({ source: faces, style: function(f) { - var style = new _ol_style_Style_({ + var style = new Style({ stroke: new _ol_style_Stroke_({ color: 'black', width: 1 diff --git a/examples/vector-esri.js b/examples/vector-esri.js index c281795d51..b7ea164b4e 100644 --- a/examples/vector-esri.js +++ b/examples/vector-esri.js @@ -9,7 +9,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import XYZ from '../src/ol/source/XYZ.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; import _ol_tilegrid_ from '../src/ol/tilegrid.js'; @@ -20,7 +20,7 @@ var layer = '0'; var esrijsonFormat = new EsriJSON(); var styleCache = { - 'ABANDONED': new _ol_style_Style_({ + 'ABANDONED': new Style({ fill: new _ol_style_Fill_({ color: 'rgba(225, 225, 225, 255)' }), @@ -29,7 +29,7 @@ var styleCache = { width: 0.4 }) }), - 'GAS': new _ol_style_Style_({ + 'GAS': new Style({ fill: new _ol_style_Fill_({ color: 'rgba(255, 0, 0, 255)' }), @@ -38,7 +38,7 @@ var styleCache = { width: 0.4 }) }), - 'OIL': new _ol_style_Style_({ + 'OIL': new Style({ fill: new _ol_style_Fill_({ color: 'rgba(56, 168, 0, 255)' }), @@ -47,7 +47,7 @@ var styleCache = { width: 0 }) }), - 'OILGAS': new _ol_style_Style_({ + 'OILGAS': new Style({ fill: new _ol_style_Fill_({ color: 'rgba(168, 112, 0, 255)' }), diff --git a/examples/vector-label-decluttering.js b/examples/vector-label-decluttering.js index 5557e09e50..9b65088cb6 100644 --- a/examples/vector-label-decluttering.js +++ b/examples/vector-label-decluttering.js @@ -6,7 +6,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; import _ol_style_Text_ from '../src/ol/style/Text.js'; var map = new Map({ @@ -17,7 +17,7 @@ var map = new Map({ }) }); -var labelStyle = new _ol_style_Style_({ +var labelStyle = new Style({ geometry: function(feature) { var geometry = feature.getGeometry(); if (geometry.getType() == 'MultiPolygon') { @@ -47,7 +47,7 @@ var labelStyle = new _ol_style_Style_({ }) }) }); -var countryStyle = new _ol_style_Style_({ +var countryStyle = new Style({ fill: new _ol_style_Fill_({ color: 'rgba(255, 255, 255, 0.6)' }), diff --git a/examples/vector-labels.js b/examples/vector-labels.js index 1b2e65e382..a2ba95e8a9 100644 --- a/examples/vector-labels.js +++ b/examples/vector-labels.js @@ -8,7 +8,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; import _ol_style_Text_ from '../src/ol/style/Text.js'; var openSansAdded = false; @@ -128,7 +128,7 @@ var createTextStyle = function(feature, resolution, dom) { // Polygons function polygonStyleFunction(feature, resolution) { - return new _ol_style_Style_({ + return new Style({ stroke: new _ol_style_Stroke_({ color: 'blue', width: 1 @@ -151,7 +151,7 @@ var vectorPolygons = new VectorLayer({ // Lines function lineStyleFunction(feature, resolution) { - return new _ol_style_Style_({ + return new Style({ stroke: new _ol_style_Stroke_({ color: 'green', width: 2 @@ -171,7 +171,7 @@ var vectorLines = new VectorLayer({ // Points function pointStyleFunction(feature, resolution) { - return new _ol_style_Style_({ + return new Style({ image: new _ol_style_Circle_({ radius: 10, fill: new _ol_style_Fill_({color: 'rgba(255, 0, 0, 0.1)'}), diff --git a/examples/vector-layer.js b/examples/vector-layer.js index 22dcd5e206..8f5d7df56d 100644 --- a/examples/vector-layer.js +++ b/examples/vector-layer.js @@ -5,11 +5,11 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; import _ol_style_Text_ from '../src/ol/style/Text.js'; -var style = new _ol_style_Style_({ +var style = new Style({ fill: new _ol_style_Fill_({ color: 'rgba(255, 255, 255, 0.6)' }), @@ -49,7 +49,7 @@ var map = new Map({ }) }); -var highlightStyle = new _ol_style_Style_({ +var highlightStyle = new Style({ stroke: new _ol_style_Stroke_({ color: '#f00', width: 1 diff --git a/examples/vector-osm.js b/examples/vector-osm.js index d42d9521cb..3f1d953415 100644 --- a/examples/vector-osm.js +++ b/examples/vector-osm.js @@ -11,13 +11,13 @@ import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var map; var styles = { 'amenity': { - 'parking': new _ol_style_Style_({ + 'parking': new Style({ stroke: new _ol_style_Stroke_({ color: 'rgba(170, 170, 170, 1.0)', width: 1 @@ -28,7 +28,7 @@ var styles = { }) }, 'building': { - '.*': new _ol_style_Style_({ + '.*': new Style({ zIndex: 100, stroke: new _ol_style_Stroke_({ color: 'rgba(246, 99, 79, 1.0)', @@ -40,13 +40,13 @@ var styles = { }) }, 'highway': { - 'service': new _ol_style_Style_({ + 'service': new Style({ stroke: new _ol_style_Stroke_({ color: 'rgba(255, 255, 255, 1.0)', width: 2 }) }), - '.*': new _ol_style_Style_({ + '.*': new Style({ stroke: new _ol_style_Stroke_({ color: 'rgba(255, 255, 255, 1.0)', width: 3 @@ -54,7 +54,7 @@ var styles = { }) }, 'landuse': { - 'forest|grass|allotments': new _ol_style_Style_({ + 'forest|grass|allotments': new Style({ stroke: new _ol_style_Stroke_({ color: 'rgba(140, 208, 95, 1.0)', width: 1 @@ -65,7 +65,7 @@ var styles = { }) }, 'natural': { - 'tree': new _ol_style_Style_({ + 'tree': new Style({ image: new _ol_style_Circle_({ radius: 2, fill: new _ol_style_Fill_({ diff --git a/examples/vector-wfs-getfeature.js b/examples/vector-wfs-getfeature.js index 6a64ddbd5f..871efe3f5a 100644 --- a/examples/vector-wfs-getfeature.js +++ b/examples/vector-wfs-getfeature.js @@ -8,13 +8,13 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import BingMaps from '../src/ol/source/BingMaps.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var vectorSource = new VectorSource(); var vector = new VectorLayer({ source: vectorSource, - style: new _ol_style_Style_({ + style: new Style({ stroke: new _ol_style_Stroke_({ color: 'rgba(0, 0, 255, 1.0)', width: 2 diff --git a/examples/vector-wfs.js b/examples/vector-wfs.js index 01d9a85efe..c144c9a2ad 100644 --- a/examples/vector-wfs.js +++ b/examples/vector-wfs.js @@ -7,7 +7,7 @@ import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js'; import BingMaps from '../src/ol/source/BingMaps.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../src/ol/style/Style.js'; +import Style from '../src/ol/style/Style.js'; var vectorSource = new VectorSource({ @@ -24,7 +24,7 @@ var vectorSource = new VectorSource({ var vector = new VectorLayer({ source: vectorSource, - style: new _ol_style_Style_({ + style: new Style({ stroke: new _ol_style_Stroke_({ color: 'rgba(0, 0, 255, 1.0)', width: 2 diff --git a/src/ol/Feature.js b/src/ol/Feature.js index 6e9e78ff97..639aa36210 100644 --- a/src/ol/Feature.js +++ b/src/ol/Feature.js @@ -7,7 +7,7 @@ import EventType from './events/EventType.js'; import {inherits} from './index.js'; import BaseObject from './Object.js'; import Geometry from './geom/Geometry.js'; -import _ol_style_Style_ from './style/Style.js'; +import Style from './style/Style.js'; /** * @classdesc @@ -307,7 +307,7 @@ Feature.createStyleFunction = function(obj) { if (Array.isArray(obj)) { styles = obj; } else { - assert(obj instanceof _ol_style_Style_, + assert(obj instanceof Style, 41); // Expected an `ol.style.Style` or an array of `ol.style.Style` styles = [obj]; } diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index 3fcbf66bc4..394fcb86c3 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -25,7 +25,7 @@ import _ol_style_Icon_ from '../style/Icon.js'; import IconAnchorUnits from '../style/IconAnchorUnits.js'; import IconOrigin from '../style/IconOrigin.js'; import _ol_style_Stroke_ from '../style/Stroke.js'; -import _ol_style_Style_ from '../style/Style.js'; +import Style from '../style/Style.js'; import _ol_style_Text_ from '../style/Text.js'; import _ol_xml_ from '../xml.js'; @@ -253,7 +253,7 @@ KML.createStyleDefaults_ = function() { * @type {ol.style.Style} * @private */ - KML.DEFAULT_STYLE_ = new _ol_style_Style_({ + KML.DEFAULT_STYLE_ = new Style({ fill: KML.DEFAULT_FILL_STYLE_, image: KML.DEFAULT_IMAGE_STYLE_, text: KML.DEFAULT_TEXT_STYLE_, @@ -325,7 +325,7 @@ KML.createNameStyleFunction_ = function(foundStyle, name) { textStyle.setOffsetY(textOffset[1]); textStyle.setTextAlign(textAlign); - var nameStyle = new _ol_style_Style_({ + var nameStyle = new Style({ text: textStyle }); return nameStyle; @@ -1042,7 +1042,7 @@ KML.readStyle_ = function(node, objectStack) { if (outline !== undefined && !outline) { strokeStyle = null; } - return [new _ol_style_Style_({ + return [new Style({ fill: fillStyle, image: imageStyle, stroke: strokeStyle, diff --git a/src/ol/interaction/Draw.js b/src/ol/interaction/Draw.js index b7d4633eb9..dec83deed4 100644 --- a/src/ol/interaction/Draw.js +++ b/src/ol/interaction/Draw.js @@ -24,7 +24,7 @@ import PointerInteraction from '../interaction/Pointer.js'; import InteractionProperty from '../interaction/Property.js'; import VectorLayer from '../layer/Vector.js'; import VectorSource from '../source/Vector.js'; -import _ol_style_Style_ from '../style/Style.js'; +import Style from '../style/Style.js'; /** * @classdesc @@ -297,7 +297,7 @@ inherits(Draw, PointerInteraction); * @return {ol.StyleFunction} Styles. */ Draw.getDefaultStyleFunction = function() { - var styles = _ol_style_Style_.createDefaultEditing(); + var styles = Style.createDefaultEditing(); return function(feature, resolution) { return styles[feature.getGeometry().getType()]; }; diff --git a/src/ol/interaction/Extent.js b/src/ol/interaction/Extent.js index 0ec6a26a79..a85ebae843 100644 --- a/src/ol/interaction/Extent.js +++ b/src/ol/interaction/Extent.js @@ -15,7 +15,7 @@ import _ol_interaction_ExtentEventType_ from '../interaction/ExtentEventType.js' import PointerInteraction from '../interaction/Pointer.js'; import VectorLayer from '../layer/Vector.js'; import VectorSource from '../source/Vector.js'; -import _ol_style_Style_ from '../style/Style.js'; +import Style from '../style/Style.js'; /** * @classdesc @@ -243,7 +243,7 @@ ExtentInteraction.handleUpEvent_ = function(mapBrowserEvent) { * @private */ ExtentInteraction.getDefaultExtentStyleFunction_ = function() { - var style = _ol_style_Style_.createDefaultEditing(); + var style = Style.createDefaultEditing(); return function(feature, resolution) { return style[GeometryType.POLYGON]; }; @@ -256,7 +256,7 @@ ExtentInteraction.getDefaultExtentStyleFunction_ = function() { * @private */ ExtentInteraction.getDefaultPointerStyleFunction_ = function() { - var style = _ol_style_Style_.createDefaultEditing(); + var style = Style.createDefaultEditing(); return function(feature, resolution) { return style[GeometryType.POINT]; }; diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index 21f5106918..f8ceae718d 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -22,7 +22,7 @@ import VectorLayer from '../layer/Vector.js'; import VectorSource from '../source/Vector.js'; import VectorEventType from '../source/VectorEventType.js'; import RBush from '../structs/RBush.js'; -import _ol_style_Style_ from '../style/Style.js'; +import Style from '../style/Style.js'; /** * @classdesc @@ -1193,7 +1193,7 @@ Modify.prototype.updateSegmentIndices_ = function( * @return {ol.StyleFunction} Styles. */ Modify.getDefaultStyleFunction = function() { - var style = _ol_style_Style_.createDefaultEditing(); + var style = Style.createDefaultEditing(); return function(feature, resolution) { return style[GeometryType.POINT]; }; diff --git a/src/ol/interaction/Select.js b/src/ol/interaction/Select.js index c6f38bc626..2cd9d10a5f 100644 --- a/src/ol/interaction/Select.js +++ b/src/ol/interaction/Select.js @@ -13,7 +13,7 @@ import Interaction from '../interaction/Interaction.js'; import VectorLayer from '../layer/Vector.js'; import _ol_obj_ from '../obj.js'; import VectorSource from '../source/Vector.js'; -import _ol_style_Style_ from '../style/Style.js'; +import Style from '../style/Style.js'; /** * @classdesc @@ -325,7 +325,7 @@ Select.prototype.setMap = function(map) { * @return {ol.StyleFunction} Styles. */ Select.getDefaultStyleFunction = function() { - var styles = _ol_style_Style_.createDefaultEditing(); + var styles = Style.createDefaultEditing(); extend(styles[GeometryType.POLYGON], styles[GeometryType.LINE_STRING]); extend(styles[GeometryType.GEOMETRY_COLLECTION], styles[GeometryType.LINE_STRING]); diff --git a/src/ol/layer/Heatmap.js b/src/ol/layer/Heatmap.js index 25397b799f..a3080db07c 100644 --- a/src/ol/layer/Heatmap.js +++ b/src/ol/layer/Heatmap.js @@ -10,7 +10,7 @@ import {clamp} from '../math.js'; import _ol_obj_ from '../obj.js'; import RenderEventType from '../render/EventType.js'; import _ol_style_Icon_ from '../style/Icon.js'; -import _ol_style_Style_ from '../style/Style.js'; +import Style from '../style/Style.js'; /** @@ -117,7 +117,7 @@ var Heatmap = function(opt_options) { var style = this.styleCache_[index]; if (!style) { style = [ - new _ol_style_Style_({ + new Style({ image: new _ol_style_Icon_({ opacity: opacity, src: this.circleImage_ diff --git a/src/ol/layer/Vector.js b/src/ol/layer/Vector.js index 8a2f31c3e9..ea94399be8 100644 --- a/src/ol/layer/Vector.js +++ b/src/ol/layer/Vector.js @@ -6,7 +6,7 @@ import LayerType from '../LayerType.js'; import Layer from '../layer/Layer.js'; import _ol_layer_VectorRenderType_ from '../layer/VectorRenderType.js'; import _ol_obj_ from '../obj.js'; -import _ol_style_Style_ from '../style/Style.js'; +import Style from '../style/Style.js'; /** @@ -207,9 +207,9 @@ VectorLayer.prototype.setRenderOrder = function(renderOrder) { * @api */ VectorLayer.prototype.setStyle = function(style) { - this.style_ = style !== undefined ? style : _ol_style_Style_.defaultFunction; + this.style_ = style !== undefined ? style : Style.defaultFunction; this.styleFunction_ = style === null ? - undefined : _ol_style_Style_.createFunction(this.style_); + undefined : Style.createFunction(this.style_); this.changed(); }; diff --git a/src/ol/style/Style.js b/src/ol/style/Style.js index a179d34816..7185da082f 100644 --- a/src/ol/style/Style.js +++ b/src/ol/style/Style.js @@ -18,7 +18,7 @@ import _ol_style_Stroke_ from '../style/Stroke.js'; * @param {olx.style.StyleOptions=} opt_options Style options. * @api */ -var _ol_style_Style_ = function(opt_options) { +var Style = function(opt_options) { var options = opt_options || {}; @@ -32,7 +32,7 @@ var _ol_style_Style_ = function(opt_options) { * @private * @type {!ol.StyleGeometryFunction} */ - this.geometryFunction_ = _ol_style_Style_.defaultGeometryFunction; + this.geometryFunction_ = Style.defaultGeometryFunction; if (options.geometry !== undefined) { this.setGeometry(options.geometry); @@ -82,12 +82,12 @@ var _ol_style_Style_ = function(opt_options) { * @return {ol.style.Style} The cloned style. * @api */ -_ol_style_Style_.prototype.clone = function() { +Style.prototype.clone = function() { var geometry = this.getGeometry(); if (geometry && geometry.clone) { geometry = geometry.clone(); } - return new _ol_style_Style_({ + return new Style({ geometry: geometry, fill: this.getFill() ? this.getFill().clone() : undefined, image: this.getImage() ? this.getImage().clone() : undefined, @@ -104,7 +104,7 @@ _ol_style_Style_.prototype.clone = function() { * @return {ol.StyleRenderFunction|null} Custom renderer function. * @api */ -_ol_style_Style_.prototype.getRenderer = function() { +Style.prototype.getRenderer = function() { return this.renderer_; }; @@ -115,7 +115,7 @@ _ol_style_Style_.prototype.getRenderer = function() { * @param {ol.StyleRenderFunction|null} renderer Custom renderer function. * @api */ -_ol_style_Style_.prototype.setRenderer = function(renderer) { +Style.prototype.setRenderer = function(renderer) { this.renderer_ = renderer; }; @@ -127,7 +127,7 @@ _ol_style_Style_.prototype.setRenderer = function(renderer) { * be rendered with this style. * @api */ -_ol_style_Style_.prototype.getGeometry = function() { +Style.prototype.getGeometry = function() { return this.geometry_; }; @@ -138,7 +138,7 @@ _ol_style_Style_.prototype.getGeometry = function() { * and returns the geometry to render instead of the feature's geometry. * @api */ -_ol_style_Style_.prototype.getGeometryFunction = function() { +Style.prototype.getGeometryFunction = function() { return this.geometryFunction_; }; @@ -148,7 +148,7 @@ _ol_style_Style_.prototype.getGeometryFunction = function() { * @return {ol.style.Fill} Fill style. * @api */ -_ol_style_Style_.prototype.getFill = function() { +Style.prototype.getFill = function() { return this.fill_; }; @@ -158,7 +158,7 @@ _ol_style_Style_.prototype.getFill = function() { * @param {ol.style.Fill} fill Fill style. * @api */ -_ol_style_Style_.prototype.setFill = function(fill) { +Style.prototype.setFill = function(fill) { this.fill_ = fill; }; @@ -168,7 +168,7 @@ _ol_style_Style_.prototype.setFill = function(fill) { * @return {ol.style.Image} Image style. * @api */ -_ol_style_Style_.prototype.getImage = function() { +Style.prototype.getImage = function() { return this.image_; }; @@ -178,7 +178,7 @@ _ol_style_Style_.prototype.getImage = function() { * @param {ol.style.Image} image Image style. * @api */ -_ol_style_Style_.prototype.setImage = function(image) { +Style.prototype.setImage = function(image) { this.image_ = image; }; @@ -188,7 +188,7 @@ _ol_style_Style_.prototype.setImage = function(image) { * @return {ol.style.Stroke} Stroke style. * @api */ -_ol_style_Style_.prototype.getStroke = function() { +Style.prototype.getStroke = function() { return this.stroke_; }; @@ -198,7 +198,7 @@ _ol_style_Style_.prototype.getStroke = function() { * @param {ol.style.Stroke} stroke Stroke style. * @api */ -_ol_style_Style_.prototype.setStroke = function(stroke) { +Style.prototype.setStroke = function(stroke) { this.stroke_ = stroke; }; @@ -208,7 +208,7 @@ _ol_style_Style_.prototype.setStroke = function(stroke) { * @return {ol.style.Text} Text style. * @api */ -_ol_style_Style_.prototype.getText = function() { +Style.prototype.getText = function() { return this.text_; }; @@ -218,7 +218,7 @@ _ol_style_Style_.prototype.getText = function() { * @param {ol.style.Text} text Text style. * @api */ -_ol_style_Style_.prototype.setText = function(text) { +Style.prototype.setText = function(text) { this.text_ = text; }; @@ -228,7 +228,7 @@ _ol_style_Style_.prototype.setText = function(text) { * @return {number|undefined} ZIndex. * @api */ -_ol_style_Style_.prototype.getZIndex = function() { +Style.prototype.getZIndex = function() { return this.zIndex_; }; @@ -241,7 +241,7 @@ _ol_style_Style_.prototype.getZIndex = function() { * for this style. * @api */ -_ol_style_Style_.prototype.setGeometry = function(geometry) { +Style.prototype.setGeometry = function(geometry) { if (typeof geometry === 'function') { this.geometryFunction_ = geometry; } else if (typeof geometry === 'string') { @@ -249,7 +249,7 @@ _ol_style_Style_.prototype.setGeometry = function(geometry) { return /** @type {ol.geom.Geometry} */ (feature.get(geometry)); }; } else if (!geometry) { - this.geometryFunction_ = _ol_style_Style_.defaultGeometryFunction; + this.geometryFunction_ = Style.defaultGeometryFunction; } else if (geometry !== undefined) { this.geometryFunction_ = function() { return /** @type {ol.geom.Geometry} */ (geometry); @@ -265,7 +265,7 @@ _ol_style_Style_.prototype.setGeometry = function(geometry) { * @param {number|undefined} zIndex ZIndex. * @api */ -_ol_style_Style_.prototype.setZIndex = function(zIndex) { +Style.prototype.setZIndex = function(zIndex) { this.zIndex_ = zIndex; }; @@ -278,7 +278,7 @@ _ol_style_Style_.prototype.setZIndex = function(zIndex) { * A style function, a single style, or an array of styles. * @return {ol.StyleFunction} A style function. */ -_ol_style_Style_.createFunction = function(obj) { +Style.createFunction = function(obj) { var styleFunction; if (typeof obj === 'function') { @@ -291,7 +291,7 @@ _ol_style_Style_.createFunction = function(obj) { if (Array.isArray(obj)) { styles = obj; } else { - assert(obj instanceof _ol_style_Style_, + assert(obj instanceof Style, 41); // Expected an `ol.style.Style` or an array of `ol.style.Style` styles = [obj]; } @@ -307,7 +307,7 @@ _ol_style_Style_.createFunction = function(obj) { * @type {Array.} * @private */ -_ol_style_Style_.default_ = null; +Style.default_ = null; /** @@ -315,13 +315,13 @@ _ol_style_Style_.default_ = null; * @param {number} resolution Resolution. * @return {Array.} Style. */ -_ol_style_Style_.defaultFunction = function(feature, resolution) { +Style.defaultFunction = function(feature, resolution) { // We don't use an immediately-invoked function // and a closure so we don't get an error at script evaluation time in // browsers that do not support Canvas. (ol.style.Circle does // canvas.getContext('2d') at construction time, which will cause an.error // in such browsers.) - if (!_ol_style_Style_.default_) { + if (!Style.default_) { var fill = new _ol_style_Fill_({ color: 'rgba(255,255,255,0.4)' }); @@ -329,8 +329,8 @@ _ol_style_Style_.defaultFunction = function(feature, resolution) { color: '#3399CC', width: 1.25 }); - _ol_style_Style_.default_ = [ - new _ol_style_Style_({ + Style.default_ = [ + new Style({ image: new _ol_style_Circle_({ fill: fill, stroke: stroke, @@ -341,7 +341,7 @@ _ol_style_Style_.defaultFunction = function(feature, resolution) { }) ]; } - return _ol_style_Style_.default_; + return Style.default_; }; @@ -349,14 +349,14 @@ _ol_style_Style_.defaultFunction = function(feature, resolution) { * Default styles for editing features. * @return {Object.>} Styles */ -_ol_style_Style_.createDefaultEditing = function() { +Style.createDefaultEditing = function() { /** @type {Object.>} */ var styles = {}; var white = [255, 255, 255, 1]; var blue = [0, 153, 255, 1]; var width = 3; styles[GeometryType.POLYGON] = [ - new _ol_style_Style_({ + new Style({ fill: new _ol_style_Fill_({ color: [255, 255, 255, 0.5] }) @@ -366,13 +366,13 @@ _ol_style_Style_.createDefaultEditing = function() { styles[GeometryType.POLYGON]; styles[GeometryType.LINE_STRING] = [ - new _ol_style_Style_({ + new Style({ stroke: new _ol_style_Stroke_({ color: white, width: width + 2 }) }), - new _ol_style_Style_({ + new Style({ stroke: new _ol_style_Stroke_({ color: blue, width: width @@ -389,7 +389,7 @@ _ol_style_Style_.createDefaultEditing = function() { styles[GeometryType.POINT] = [ - new _ol_style_Style_({ + new Style({ image: new _ol_style_Circle_({ radius: width * 2, fill: new _ol_style_Fill_({ @@ -422,7 +422,7 @@ _ol_style_Style_.createDefaultEditing = function() { * for. * @return {ol.geom.Geometry|ol.render.Feature|undefined} Geometry to render. */ -_ol_style_Style_.defaultGeometryFunction = function(feature) { +Style.defaultGeometryFunction = function(feature) { return feature.getGeometry(); }; -export default _ol_style_Style_; +export default Style; diff --git a/test/rendering/ol/layer/clip.test.js b/test/rendering/ol/layer/clip.test.js index c620fdcb5f..c9cf241a23 100644 --- a/test/rendering/ol/layer/clip.test.js +++ b/test/rendering/ol/layer/clip.test.js @@ -4,7 +4,7 @@ import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; import TileLayer from '../../../../src/ol/layer/Tile.js'; import XYZ from '../../../../src/ol/source/XYZ.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; +import Style from '../../../../src/ol/style/Style.js'; describe('layer clipping', function() { @@ -69,7 +69,7 @@ describe('layer clipping', function() { [[[80, -40], [120, 0], [80, 40], [40, 0], [80, -40]]] ]).transform('EPSG:4326', 'EPSG:3857'); - var style = new _ol_style_Style_({ + var style = new Style({ stroke: new _ol_style_Stroke_({ width: 2, color: 'blue' diff --git a/test/rendering/ol/layer/vector.test.js b/test/rendering/ol/layer/vector.test.js index c034d5701b..3c5026091e 100644 --- a/test/rendering/ol/layer/vector.test.js +++ b/test/rendering/ol/layer/vector.test.js @@ -11,7 +11,7 @@ import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; +import Style from '../../../../src/ol/style/Style.js'; import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; @@ -79,7 +79,7 @@ describe('ol.rendering.layer.Vector', function() { [center[0], center[1] - 1], [center[0], center[1] + 1] ])); - smallLine.setStyle(new _ol_style_Style_({ + smallLine.setStyle(new Style({ zIndex: -99, stroke: new _ol_style_Stroke_({width: 75, color: 'red'}) })); @@ -105,7 +105,7 @@ describe('ol.rendering.layer.Vector', function() { [center[0], center[1] - 1], [center[0], center[1] + 1] ])); - smallLine.setStyle(new _ol_style_Style_({ + smallLine.setStyle(new Style({ zIndex: -99, stroke: new _ol_style_Stroke_({width: 75, color: 'red'}) })); @@ -133,10 +133,10 @@ describe('ol.rendering.layer.Vector', function() { [center[0], center[1] + 1] ])); smallLine.setStyle([ - new _ol_style_Style_({ + new Style({ stroke: new _ol_style_Stroke_({width: 75, color: 'red'}) }), - new _ol_style_Style_({ + new Style({ stroke: new _ol_style_Stroke_({width: 45, color: 'white'}) }) ]); @@ -146,10 +146,10 @@ describe('ol.rendering.layer.Vector', function() { [center[0], center[1] + 1000] ])); smallLine2.setStyle([ - new _ol_style_Style_({ + new Style({ stroke: new _ol_style_Stroke_({width: 35, color: 'blue'}) }), - new _ol_style_Style_({ + new Style({ stroke: new _ol_style_Stroke_({width: 15, color: 'green'}) }) ]); @@ -172,10 +172,10 @@ describe('ol.rendering.layer.Vector', function() { [center[0], center[1] + 1] ])); smallLine.setStyle([ - new _ol_style_Style_({ + new Style({ stroke: new _ol_style_Stroke_({width: 75, color: 'red'}) }), - new _ol_style_Style_({ + new Style({ stroke: new _ol_style_Stroke_({width: 45, color: 'white'}) }) ]); @@ -185,10 +185,10 @@ describe('ol.rendering.layer.Vector', function() { [center[0], center[1] + 1000] ])); smallLine2.setStyle([ - new _ol_style_Style_({ + new Style({ stroke: new _ol_style_Stroke_({width: 35, color: 'blue'}) }), - new _ol_style_Style_({ + new Style({ stroke: new _ol_style_Stroke_({width: 15, color: 'green'}) }) ]); @@ -212,7 +212,7 @@ describe('ol.rendering.layer.Vector', function() { addCircle(500); map.addLayer(new VectorLayer({ source: source, - style: new _ol_style_Style_({ + style: new Style({ stroke: new _ol_style_Stroke_({ width: 2, color: 'black' @@ -233,7 +233,7 @@ describe('ol.rendering.layer.Vector', function() { map.addLayer(new VectorLayer({ renderMode: 'image', source: source, - style: new _ol_style_Style_({ + style: new Style({ stroke: new _ol_style_Stroke_({ width: 2, color: 'black' @@ -254,7 +254,7 @@ describe('ol.rendering.layer.Vector', function() { map.addLayer(new VectorLayer({ renderMode: 'image', source: source, - style: new _ol_style_Style_({ + style: new Style({ fill: new _ol_style_Fill_({ color: 'rgba(255,0,0,0.5)' }), @@ -285,7 +285,7 @@ describe('ol.rendering.layer.Vector', function() { addPolygon(720); map.addLayer(new VectorLayer({ source: source, - style: new _ol_style_Style_({ + style: new Style({ stroke: new _ol_style_Stroke_({ color: '#3399CC', width: 1.25 @@ -309,7 +309,7 @@ describe('ol.rendering.layer.Vector', function() { addLineString(720); map.addLayer(new VectorLayer({ source: source, - style: new _ol_style_Style_({ + style: new Style({ stroke: new _ol_style_Stroke_({ color: '#3399CC', width: 1.25 @@ -350,7 +350,7 @@ describe('ol.rendering.layer.Vector', function() { source: createSource(true), style: function(feature) { alternateColor(); - return new _ol_style_Style_({ + return new Style({ stroke: new _ol_style_Stroke_({ color: alternateColor(), width: 1.25 @@ -401,7 +401,7 @@ describe('ol.rendering.layer.Vector', function() { source: createSource(true), style: function(feature) { alternateColor(); - return new _ol_style_Style_({ + return new Style({ stroke: new _ol_style_Stroke_({ color: alternateColor(), width: 1.25 @@ -470,7 +470,7 @@ describe('ol.rendering.layer.Vector', function() { source: new VectorSource({ features: [feature] }), - style: new _ol_style_Style_({ + style: new Style({ fill: new _ol_style_Fill_({ color: 'blue' }) @@ -534,7 +534,7 @@ describe('ol.rendering.layer.Vector', function() { }); it('renders partially out-of-view polygons with a fill and stroke', function(done) { - layer.setStyle(new _ol_style_Style_({ + layer.setStyle(new Style({ stroke: new _ol_style_Stroke_({ color: [0, 0, 0, 1], width: 2 @@ -550,7 +550,7 @@ describe('ol.rendering.layer.Vector', function() { }); it('renders partially out-of-view polygons with a fill', function(done) { - layer.setStyle(new _ol_style_Style_({ + layer.setStyle(new Style({ fill: new _ol_style_Fill_({ color: [0, 0, 0, 1] }) @@ -562,7 +562,7 @@ describe('ol.rendering.layer.Vector', function() { }); it('renders partially out-of-view polygons with a stroke', function(done) { - layer.setStyle(new _ol_style_Style_({ + layer.setStyle(new Style({ stroke: new _ol_style_Stroke_({ color: [0, 0, 0, 1], width: 2 @@ -605,7 +605,7 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { - return new _ol_style_Style_({ + return new Style({ text: new _ol_style_Text_({ text: feature.get('text'), font: '12px sans-serif' @@ -646,7 +646,7 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { - return new _ol_style_Style_({ + return new Style({ text: new _ol_style_Text_({ text: feature.get('text'), font: '12px sans-serif' @@ -688,7 +688,7 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { - return new _ol_style_Style_({ + return new Style({ zIndex: feature.get('zIndex'), text: new _ol_style_Text_({ text: feature.get('text'), @@ -723,7 +723,7 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { - return new _ol_style_Style_({ + return new Style({ image: new _ol_style_Circle_({ radius: 15, stroke: new _ol_style_Stroke_({ @@ -763,7 +763,7 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { - return new _ol_style_Style_({ + return new Style({ image: new _ol_style_Circle_({ radius: 15, stroke: new _ol_style_Stroke_({ @@ -804,7 +804,7 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { - return new _ol_style_Style_({ + return new Style({ zIndex: feature.get('zIndex'), image: new _ol_style_Circle_({ radius: 15, @@ -843,7 +843,7 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { - return new _ol_style_Style_({ + return new Style({ image: new _ol_style_Circle_({ radius: 5, stroke: new _ol_style_Stroke_({ @@ -873,7 +873,7 @@ describe('ol.rendering.layer.Vector', function() { map.addLayer(layer); var point = new Feature(new Point(center)); - point.setStyle(new _ol_style_Style_({ + point.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 8, stroke: new _ol_style_Stroke_({ @@ -885,7 +885,7 @@ describe('ol.rendering.layer.Vector', function() { [center[0] - 650, center[1] - 200], [center[0] + 650, center[1] - 200] ])); - line.setStyle(new _ol_style_Style_({ + line.setStyle(new Style({ stroke: new _ol_style_Stroke_({ color: '#CCC', width: 12 @@ -916,7 +916,7 @@ describe('ol.rendering.layer.Vector', function() { map.addLayer(layer); var point = new Feature(new Point(center)); - point.setStyle(new _ol_style_Style_({ + point.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 8, stroke: new _ol_style_Stroke_({ @@ -928,7 +928,7 @@ describe('ol.rendering.layer.Vector', function() { [center[0] - 650, center[1] - 200], [center[0] + 650, center[1] - 200] ])); - line.setStyle(new _ol_style_Style_({ + line.setStyle(new Style({ stroke: new _ol_style_Stroke_({ color: '#CCC', width: 12 @@ -959,7 +959,7 @@ describe('ol.rendering.layer.Vector', function() { map.addLayer(layer); var point = new Feature(new Point(center)); - point.setStyle(new _ol_style_Style_({ + point.setStyle(new Style({ zIndex: 2, image: new _ol_style_Circle_({ radius: 8, @@ -972,7 +972,7 @@ describe('ol.rendering.layer.Vector', function() { [center[0] - 650, center[1] - 200], [center[0] + 650, center[1] - 200] ])); - line.setStyle(new _ol_style_Style_({ + line.setStyle(new Style({ zIndex: 1, stroke: new _ol_style_Stroke_({ color: '#CCC', diff --git a/test/rendering/ol/layer/vectortile.test.js b/test/rendering/ol/layer/vectortile.test.js index 6a0afd35b0..fbd5cac5f6 100644 --- a/test/rendering/ol/layer/vectortile.test.js +++ b/test/rendering/ol/layer/vectortile.test.js @@ -10,7 +10,7 @@ import VectorSource from '../../../../src/ol/source/Vector.js'; import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; -import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; +import Style from '../../../../src/ol/style/Style.js'; import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -104,7 +104,7 @@ describe('ol.rendering.layer.VectorTile', function() { map.addLayer(new VectorLayer({ zIndex: 1, source: vectorSource, - style: new _ol_style_Style_({ + style: new Style({ image: new _ol_style_Circle_({ radius: 10, fill: new _ol_style_Fill_({ @@ -143,7 +143,7 @@ describe('ol.rendering.layer.VectorTile', function() { var style = function(feature, resolution) { var geom = feature.getGeometry(); if (geom.getType() == 'Point') { - return new _ol_style_Style_({ + return new Style({ image: new _ol_style_Circle_({ radius: 7, fill: new _ol_style_Fill_({ diff --git a/test/rendering/ol/render.test.js b/test/rendering/ol/render.test.js index 05244cc52a..7063712b70 100644 --- a/test/rendering/ol/render.test.js +++ b/test/rendering/ol/render.test.js @@ -7,7 +7,7 @@ import CanvasImmediateRenderer from '../../../src/ol/render/canvas/Immediate.js' import _ol_style_Circle_ from '../../../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../../../src/ol/style/Style.js'; +import Style from '../../../src/ol/style/Style.js'; function getContext() { return document.createElement('canvas').getContext('2d'); @@ -33,7 +33,7 @@ describe('ol.render', function() { size: [100, 100] }); - var style = new _ol_style_Style_({ + var style = new Style({ image: new _ol_style_Circle_({ fill: new _ol_style_Fill_({ color: 'green' @@ -57,7 +57,7 @@ describe('ol.render', function() { size: [100, 100] }); - var style = new _ol_style_Style_({ + var style = new Style({ stroke: new _ol_style_Stroke_({ color: 'red', width: 14 @@ -81,7 +81,7 @@ describe('ol.render', function() { size: [100, 100] }); - var style = new _ol_style_Style_({ + var style = new Style({ stroke: new _ol_style_Stroke_({ lineCap: 'butt', color: 'red', @@ -106,7 +106,7 @@ describe('ol.render', function() { size: [100, 100] }); - var style = new _ol_style_Style_({ + var style = new Style({ stroke: new _ol_style_Stroke_({ lineJoin: 'bevel', color: 'red', @@ -131,7 +131,7 @@ describe('ol.render', function() { size: [100, 100] }); - var style = new _ol_style_Style_({ + var style = new Style({ stroke: new _ol_style_Stroke_({ color: 'blue', width: 8 @@ -160,7 +160,7 @@ describe('ol.render', function() { size: [100, 100] }); - var style = new _ol_style_Style_({ + var style = new Style({ stroke: new _ol_style_Stroke_({ lineDash: [10, 5] }) @@ -185,7 +185,7 @@ describe('ol.render', function() { size: [100, 100] }); - var style = new _ol_style_Style_({ + var style = new Style({ stroke: new _ol_style_Stroke_({ lineDash: [10, 5], lineDashOffset: 5 diff --git a/test/rendering/ol/style/circle.test.js b/test/rendering/ol/style/circle.test.js index 4bf090bac1..02452dd9a2 100644 --- a/test/rendering/ol/style/circle.test.js +++ b/test/rendering/ol/style/circle.test.js @@ -7,7 +7,7 @@ import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; -import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; +import Style from '../../../../src/ol/style/Style.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -48,7 +48,7 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[-20, 18]]) : new Point([-20, 18]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 2, fill: new _ol_style_Fill_({ @@ -61,7 +61,7 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[-10, 18]]) : new Point([-10, 18]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 4, fill: new _ol_style_Fill_({ @@ -74,7 +74,7 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[4, 18]]) : new Point([4, 18]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 6, fill: new _ol_style_Fill_({ @@ -87,7 +87,7 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[-20, 3]]) : new Point([-20, 3]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 2, fill: new _ol_style_Fill_({ @@ -104,7 +104,7 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[-10, 3]]) : new Point([-10, 3]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 4, fill: new _ol_style_Fill_({ @@ -121,7 +121,7 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[4, 3]]) : new Point([4, 3]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 6, fill: new _ol_style_Fill_({ @@ -138,7 +138,7 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[-20, -15]]) : new Point([-20, -15]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 2, stroke: new _ol_style_Stroke_({ @@ -152,7 +152,7 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[-10, -15]]) : new Point([-10, -15]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 4, fill: new _ol_style_Fill_({ @@ -169,7 +169,7 @@ describe('ol.rendering.style.Circle', function() { feature = new Feature({ geometry: multi ? new MultiPoint([[4, -15]]) : new Point([4, -15]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 6, fill: new _ol_style_Fill_({ diff --git a/test/rendering/ol/style/icon.test.js b/test/rendering/ol/style/icon.test.js index 234e437378..3e364c6b95 100644 --- a/test/rendering/ol/style/icon.test.js +++ b/test/rendering/ol/style/icon.test.js @@ -5,7 +5,7 @@ import View from '../../../../src/ol/View.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js'; -import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; +import Style from '../../../../src/ol/style/Style.js'; describe('ol.rendering.style.Icon', function() { @@ -58,7 +58,7 @@ describe('ol.rendering.style.Icon', function() { var img = new Image(); img.onload = function() { imgInfo.img = img; - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ image: new _ol_style_Icon_(/** @type {olx.style.IconOptions} */ (imgInfo)) })); vectorSource.addFeature(feature); diff --git a/test/rendering/ol/style/linestring.test.js b/test/rendering/ol/style/linestring.test.js index 00cdfa5ee9..e7359e35c8 100644 --- a/test/rendering/ol/style/linestring.test.js +++ b/test/rendering/ol/style/linestring.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_Style_ from '../../../../src/ol/style/Style.js'; +import Style from '../../../../src/ol/style/Style.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -48,7 +48,7 @@ describe('ol.rendering.style.LineString', function() { [[-20, 20], [15, 20]] ) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ stroke: new _ol_style_Stroke_({color: '#DE213A', width: 3}) })); vectorSource.addFeature(feature); @@ -58,7 +58,7 @@ describe('ol.rendering.style.LineString', function() { [[-20, 15], [15, 15]] ) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ stroke: new _ol_style_Stroke_({color: '#9696EB', width: 1}) })); vectorSource.addFeature(feature); @@ -68,9 +68,9 @@ describe('ol.rendering.style.LineString', function() { [[-20, 10], [15, 10]] ) }); - feature.setStyle([new _ol_style_Style_({ + feature.setStyle([new Style({ stroke: new _ol_style_Stroke_({color: '#F2F211', width: 5}) - }), new _ol_style_Style_({ + }), new Style({ stroke: new _ol_style_Stroke_({color: '#292921', width: 1}) })]); vectorSource.addFeature(feature); @@ -80,7 +80,7 @@ describe('ol.rendering.style.LineString', function() { [[-20, -20], [-2, 0], [15, -20]] ) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ stroke: new _ol_style_Stroke_({ color: '#000000', width: 2, @@ -96,7 +96,7 @@ describe('ol.rendering.style.LineString', function() { [[-20, -15], [-2, 5], [15, -15]] ) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ stroke: new _ol_style_Stroke_({ color: '#000000', width: 2, diff --git a/test/rendering/ol/style/polygon.test.js b/test/rendering/ol/style/polygon.test.js index e1ac2fa2a8..414656e722 100644 --- a/test/rendering/ol/style/polygon.test.js +++ b/test/rendering/ol/style/polygon.test.js @@ -5,7 +5,7 @@ import View from '../../../../src/ol/View.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; -import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; +import Style from '../../../../src/ol/style/Style.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -53,7 +53,7 @@ describe('ol.rendering.style.Polygon', function() { [[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]] ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ fill: fill })); vectorSource.addFeature(feature); @@ -66,7 +66,7 @@ describe('ol.rendering.style.Polygon', function() { ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ fill: fill })); vectorSource.addFeature(feature); @@ -80,7 +80,7 @@ describe('ol.rendering.style.Polygon', function() { ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ fill: fill })); vectorSource.addFeature(feature); @@ -118,7 +118,7 @@ describe('ol.rendering.style.Polygon', function() { [[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]] ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ stroke: stroke })); vectorSource.addFeature(feature); @@ -131,7 +131,7 @@ describe('ol.rendering.style.Polygon', function() { ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ stroke: stroke })); vectorSource.addFeature(feature); @@ -145,7 +145,7 @@ describe('ol.rendering.style.Polygon', function() { ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ stroke: stroke })); vectorSource.addFeature(feature); @@ -178,7 +178,7 @@ describe('ol.rendering.style.Polygon', function() { [[-20, 10], [-20, 20], [-0, 20], [-0, 10], [-20, 10]] ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ fill: new _ol_style_Fill_({color: '#E31E10'}), zIndex: 2 })); @@ -190,7 +190,7 @@ describe('ol.rendering.style.Polygon', function() { [[-15, 5], [-15, 15], [5, 15], [5, 5], [-15, 5]] ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ fill: new _ol_style_Fill_({color: '#1A5E42'}), zIndex: 3 })); @@ -202,7 +202,7 @@ describe('ol.rendering.style.Polygon', function() { [[-10, 0], [-10, 10], [10, 10], [10, 0], [-10, 0]] ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ fill: new _ol_style_Fill_({color: '#DEDE21'}), zIndex: 1 })); @@ -235,7 +235,7 @@ describe('ol.rendering.style.Polygon', function() { [[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]] ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ fill: new _ol_style_Fill_({color: '#9696EB'}), stroke: new _ol_style_Stroke_({color: '#9696EB', width: 1}) })); @@ -247,7 +247,7 @@ describe('ol.rendering.style.Polygon', function() { [[0, 10], [0, 20], [15, 20], [15, 10], [0, 10]] ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ fill: new _ol_style_Fill_({color: 'rgba(255, 0, 0, 0.1)'}), stroke: new _ol_style_Stroke_({color: '#DE213A', width: 3}) })); @@ -259,7 +259,7 @@ describe('ol.rendering.style.Polygon', function() { [[-20, -20], [-20, 5], [15, 5], [15, -20], [-20, -20]] ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ fill: new _ol_style_Fill_({color: 'rgba(18, 204, 105, 0.3)'}), stroke: new _ol_style_Stroke_({color: '#032E17', width: 2}) })); @@ -321,7 +321,7 @@ describe('ol.rendering.style.Polygon', function() { [[-20, -20], [-20, 20], [18, 20], [-20, -20]] ]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ fill: new _ol_style_Fill_({color: createPattern()}), stroke: new _ol_style_Stroke_({color: createRainbowGradient(), width: 3}) })); diff --git a/test/rendering/ol/style/regularshape.test.js b/test/rendering/ol/style/regularshape.test.js index ee120eda97..26e8685e02 100644 --- a/test/rendering/ol/style/regularshape.test.js +++ b/test/rendering/ol/style/regularshape.test.js @@ -6,7 +6,7 @@ import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../../../../src/ol/style/RegularShape.js'; -import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; +import Style from '../../../../src/ol/style/Style.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -46,7 +46,7 @@ describe('ol.rendering.style.RegularShape', function() { geometry: new Point([-15, 15]) }); // square - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ image: new _ol_style_RegularShape_({ fill: fill, stroke: stroke, @@ -61,7 +61,7 @@ describe('ol.rendering.style.RegularShape', function() { geometry: new Point([8, 15]) }); // triangle - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ image: new _ol_style_RegularShape_({ fill: fill, stroke: stroke, @@ -77,7 +77,7 @@ describe('ol.rendering.style.RegularShape', function() { geometry: new Point([-10, -8]) }); // star - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ image: new _ol_style_RegularShape_({ fill: fill, stroke: stroke, @@ -93,7 +93,7 @@ describe('ol.rendering.style.RegularShape', function() { geometry: new Point([12, -8]) }); // cross - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ image: new _ol_style_RegularShape_({ fill: fill, stroke: stroke, diff --git a/test/rendering/ol/style/text.test.js b/test/rendering/ol/style/text.test.js index 73fc4760e8..9474aa4047 100644 --- a/test/rendering/ol/style/text.test.js +++ b/test/rendering/ol/style/text.test.js @@ -10,7 +10,7 @@ import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; -import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; +import Style from '../../../../src/ol/style/Style.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; describe('ol.rendering.style.Text', function() { @@ -52,7 +52,7 @@ describe('ol.rendering.style.Text', function() { feature = new Feature({ geometry: new Point([-20, 18]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ text: new _ol_style_Text_({ scale: scale, text: 'hello', @@ -64,7 +64,7 @@ describe('ol.rendering.style.Text', function() { feature = new Feature({ geometry: new Point([-10, 0]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ text: new _ol_style_Text_({ scale: scale, text: 'hello', @@ -83,7 +83,7 @@ describe('ol.rendering.style.Text', function() { feature = new Feature({ geometry: new Point([20, 10]) }); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ text: new _ol_style_Text_({ scale: scale, rotateWithView: true, @@ -107,7 +107,7 @@ describe('ol.rendering.style.Text', function() { function createLineString(coords, textAlign, maxAngle, strokeColor, strokeWidth, scale) { var geom = new LineString(); geom.setFlatCoordinates('XY', coords); - var style = new _ol_style_Style_({ + var style = new Style({ stroke: new _ol_style_Stroke_({ color: 'red' }), @@ -176,7 +176,7 @@ describe('ol.rendering.style.Text', function() { createMap('canvas'); var feature; feature = new Feature(new Point([25, 0])); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ text: new _ol_style_Text_({ text: 'Hello world\nleft', font: 'bold 14px sans-serif', @@ -185,7 +185,7 @@ describe('ol.rendering.style.Text', function() { })); vectorSource.addFeature(feature); feature = new Feature(new Point([-25, 0])); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ text: new _ol_style_Text_({ text: 'Hello world\nright', font: 'bold 14px sans-serif', @@ -194,7 +194,7 @@ describe('ol.rendering.style.Text', function() { })); vectorSource.addFeature(feature); feature = new Feature(new Point([0, 25])); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ text: new _ol_style_Text_({ text: 'Hello world\nbottom', font: 'bold 14px sans-serif', @@ -203,7 +203,7 @@ describe('ol.rendering.style.Text', function() { })); vectorSource.addFeature(feature); feature = new Feature(new Point([0, -25])); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ text: new _ol_style_Text_({ text: 'top\nHello world', font: 'bold 14px sans-serif', @@ -218,7 +218,7 @@ describe('ol.rendering.style.Text', function() { createMap('canvas'); var feature; feature = new Feature(new Point([0, 0])); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ text: new _ol_style_Text_({ text: 'Hello world\nleft', font: 'bold 14px sans-serif', @@ -228,7 +228,7 @@ describe('ol.rendering.style.Text', function() { })); vectorSource.addFeature(feature); feature = new Feature(new Point([0, 0])); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ text: new _ol_style_Text_({ text: 'Hello world\nright', font: 'bold 14px sans-serif', @@ -238,7 +238,7 @@ describe('ol.rendering.style.Text', function() { })); vectorSource.addFeature(feature); feature = new Feature(new Point([0, 0])); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ text: new _ol_style_Text_({ text: 'Hello world\nbottom', font: 'bold 14px sans-serif', @@ -248,7 +248,7 @@ describe('ol.rendering.style.Text', function() { })); vectorSource.addFeature(feature); feature = new Feature(new Point([0, 0])); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ text: new _ol_style_Text_({ text: 'top\nHello world', font: 'bold 14px sans-serif', @@ -273,7 +273,7 @@ describe('ol.rendering.style.Text', function() { line.translate(0, -100); geom.appendLineString(line); var feature = new Feature(geom); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ text: new _ol_style_Text_({ text: 'Hello world', placement: 'line', @@ -290,7 +290,7 @@ describe('ol.rendering.style.Text', function() { var geom = new Polygon(null); geom.setFlatCoordinates('XY', polygon, [polygon.length]); var feature = new Feature(geom); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ text: new _ol_style_Text_({ text: 'Hello world', font: 'bold 24px sans-serif', @@ -316,7 +316,7 @@ describe('ol.rendering.style.Text', function() { geom.translate(0, -60); multiPolygon.appendPolygon(geom); var feature = new Feature(multiPolygon); - feature.setStyle(new _ol_style_Style_({ + feature.setStyle(new Style({ text: new _ol_style_Text_({ text: 'Hello world', font: 'bold 24px sans-serif', diff --git a/test/spec/ol/feature.test.js b/test/spec/ol/feature.test.js index 5efa4a85bf..36f2761450 100644 --- a/test/spec/ol/feature.test.js +++ b/test/spec/ol/feature.test.js @@ -1,7 +1,7 @@ import Feature from '../../../src/ol/Feature.js'; import Point from '../../../src/ol/geom/Point.js'; import _ol_obj_ from '../../../src/ol/obj.js'; -import _ol_style_Style_ from '../../../src/ol/style/Style.js'; +import Style from '../../../src/ol/style/Style.js'; describe('ol.Feature', function() { @@ -298,7 +298,7 @@ describe('ol.Feature', function() { describe('#setStyle()', function() { - var style = new _ol_style_Style_(); + var style = new Style(); var styleFunction = function(feature, resolution) { return resolution; @@ -355,7 +355,7 @@ describe('ol.Feature', function() { describe('#getStyle()', function() { - var style = new _ol_style_Style_(); + var style = new Style(); var styleFunction = function(resolution) { return null; @@ -403,7 +403,7 @@ describe('ol.Feature', function() { feature.setGeometryName('geom'); var geometry = new Point([1, 2]); feature.setGeometry(geometry); - var style = new _ol_style_Style_({}); + var style = new Style({}); feature.setStyle(style); feature.set('barkey', 'barval'); @@ -448,7 +448,7 @@ describe('ol.Feature', function() { }); describe('ol.Feature.createStyleFunction()', function() { - var style = new _ol_style_Style_(); + var style = new Style(); it('creates a feature style function from a single style', function() { var styleFunction = Feature.createStyleFunction(style); diff --git a/test/spec/ol/format/kml.test.js b/test/spec/ol/format/kml.test.js index ca6ca8f0cc..2c5172b428 100644 --- a/test/spec/ol/format/kml.test.js +++ b/test/spec/ol/format/kml.test.js @@ -19,7 +19,7 @@ import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js'; import IconAnchorUnits from '../../../../src/ol/style/IconAnchorUnits.js'; import IconOrigin from '../../../../src/ol/style/IconOrigin.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; +import Style from '../../../../src/ol/style/Style.js'; import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; import _ol_xml_ from '../../../../src/ol/xml.js'; @@ -30,7 +30,7 @@ describe('ol.format.KML', function() { describe('using defaultStyle', function() { - var dfltStyle = new _ol_style_Style_(); + var dfltStyle = new Style(); beforeEach(function() { format = new KML({ @@ -61,7 +61,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style).to.be(dfltStyle); }); }); @@ -1719,7 +1719,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); expect(style.getFill().getColor()).to.eql([255, 255, 255, 1]); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); @@ -1752,7 +1752,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); var imageStyle = style.getImage(); @@ -1832,7 +1832,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); var imageStyle = style.getImage(); @@ -1903,7 +1903,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); var imageStyle = style.getImage(); @@ -1939,7 +1939,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); @@ -1974,7 +1974,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); var strokeStyle = style.getStroke(); @@ -2006,7 +2006,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); var fillStyle = style.getFill(); expect(fillStyle).to.be.an(_ol_style_Fill_); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); @@ -2043,7 +2043,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); var fillStyle = style.getFill(); expect(fillStyle).to.be.an(_ol_style_Fill_); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); @@ -2082,7 +2082,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getFill()).to.be(null); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); var strokeStyle = style.getStroke(); @@ -2119,7 +2119,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); var fillStyle = style.getFill(); expect(fillStyle).to.be.an(_ol_style_Fill_); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); @@ -2157,7 +2157,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getFill()).to.be(null); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); expect(style.getStroke()).to.be(null); @@ -2210,7 +2210,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(2); var style = styleArray[1]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getText().getText()).to.eql(f.getProperties()['name']); }); @@ -2259,12 +2259,12 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(2); var style = styleArray[1]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); expect(style.getText().getText()).to.eql(f.getProperties()['name']); }); it('can write an feature\'s icon style', function() { - var style = new _ol_style_Style_({ + var style = new Style({ image: new _ol_style_Icon_({ anchor: [0.25, 36], anchorOrigin: 'top-left', @@ -2313,7 +2313,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 _ol_style_Style_({ + var style = new Style({ image: new _ol_style_Icon_({ src: 'http://foo.png' }) @@ -2334,7 +2334,7 @@ describe('ol.format.KML', function() { }); it('skips image styles that are not icon styles', function() { - var style = new _ol_style_Style_({ + var style = new Style({ image: new _ol_style_Circle_({ radius: 4, fill: new _ol_style_Fill_({ @@ -2360,7 +2360,7 @@ describe('ol.format.KML', function() { }); it('can write an feature\'s text style', function() { - var style = new _ol_style_Style_({ + var style = new Style({ text: new _ol_style_Text_({ scale: 0.5, text: 'foo', @@ -2392,7 +2392,7 @@ describe('ol.format.KML', function() { }); it('can write an feature\'s stroke style', function() { - var style = new _ol_style_Style_({ + var style = new Style({ stroke: new _ol_style_Stroke_({ color: '#112233', width: 2 @@ -2420,7 +2420,7 @@ describe('ol.format.KML', function() { }); it('can write an feature\'s fill style', function() { - var style = new _ol_style_Style_({ + var style = new Style({ fill: new _ol_style_Fill_({ color: 'rgba(12, 34, 223, 0.7)' }) @@ -2446,7 +2446,7 @@ describe('ol.format.KML', function() { }); it('can write multiple features with Style', function() { - var style = new _ol_style_Style_({ + var style = new Style({ fill: new _ol_style_Fill_({ color: 'rgba(12, 34, 223, 0.7)' }) @@ -2513,7 +2513,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var s = styleArray[0]; - expect(s).to.be.an(_ol_style_Style_); + expect(s).to.be.an(Style); expect(s.getFill()).not.to.be(null); expect(s.getFill().getColor()).to.eql([0, 0, 0, 0]); }); @@ -2546,7 +2546,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var s = styleArray[0]; - expect(s).to.be.an(_ol_style_Style_); + expect(s).to.be.an(Style); expect(s).to.be(KML.DEFAULT_STYLE_); }); @@ -2587,7 +2587,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var s = styleArray[0]; - expect(s).to.be.an(_ol_style_Style_); + expect(s).to.be.an(Style); expect(s.getFill()).not.to.be(null); expect(s.getFill().getColor()).to.eql([0, 0, 0, 0]); }); @@ -2621,7 +2621,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var s = styleArray[0]; - expect(s).to.be.an(_ol_style_Style_); + expect(s).to.be.an(Style); expect(s.getFill()).not.to.be(null); expect(s.getFill().getColor()).to.eql([0, 0, 0, 0]); }); @@ -2655,7 +2655,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var s = styleArray[0]; - expect(s).to.be.an(_ol_style_Style_); + expect(s).to.be.an(Style); expect(s).to.be(KML.DEFAULT_STYLE_); }); @@ -2689,7 +2689,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var s = styleArray[0]; - expect(s).to.be.an(_ol_style_Style_); + expect(s).to.be.an(Style); expect(s.getFill()).not.to.be(null); expect(s.getFill().getColor()).to.eql([120, 86, 52, 18 / 255]); }); @@ -2722,7 +2722,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); var fillStyle = style.getFill(); expect(fillStyle).to.be.an(_ol_style_Fill_); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); @@ -2754,7 +2754,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.be.an(Array); expect(styleArray).to.have.length(1); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); var fillStyle = style.getFill(); expect(fillStyle).to.be.an(_ol_style_Fill_); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); @@ -3207,7 +3207,7 @@ describe('ol.format.KML', function() { var styleArray = styleFunction.call(f, 0); expect(styleArray).to.be.an(Array); var style = styleArray[0]; - expect(style).to.be.an(_ol_style_Style_); + expect(style).to.be.an(Style); var imageStyle = style.getImage(); expect(imageStyle).to.be.an(_ol_style_Icon_); expect(imageStyle.getSrc()).to.eql('http://maps.google.com/mapfiles/kml/shapes/star.png'); diff --git a/test/spec/ol/layer/vector.test.js b/test/spec/ol/layer/vector.test.js index 90049569dd..8672f0db4d 100644 --- a/test/spec/ol/layer/vector.test.js +++ b/test/spec/ol/layer/vector.test.js @@ -1,14 +1,14 @@ import Layer from '../../../../src/ol/layer/Layer.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; -import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; +import Style from '../../../../src/ol/style/Style.js'; describe('ol.layer.Vector', function() { describe('constructor', function() { var source = new VectorSource(); - var style = new _ol_style_Style_(); + var style = new Style(); it('creates a new layer', function() { var layer = new VectorLayer({source: source}); @@ -58,7 +58,7 @@ describe('ol.layer.Vector', function() { layer = new VectorLayer({ source: new VectorSource() }); - style = new _ol_style_Style_(); + style = new Style(); }); it('allows the style to be set after construction', function() { @@ -74,10 +74,10 @@ describe('ol.layer.Vector', function() { }); it('updates the internal style function', function() { - expect(layer.getStyleFunction()).to.be(_ol_style_Style_.defaultFunction); + expect(layer.getStyleFunction()).to.be(Style.defaultFunction); layer.setStyle(style); expect(layer.getStyleFunction()).not.to.be( - _ol_style_Style_.defaultFunction); + Style.defaultFunction); }); it('allows setting an null style', function() { @@ -89,8 +89,8 @@ describe('ol.layer.Vector', function() { it('sets the default style when passing undefined', function() { layer.setStyle(style); layer.setStyle(undefined); - expect(layer.getStyle()).to.be(_ol_style_Style_.defaultFunction); - expect(layer.getStyleFunction()).to.be(_ol_style_Style_.defaultFunction); + expect(layer.getStyle()).to.be(Style.defaultFunction); + expect(layer.getStyleFunction()).to.be(Style.defaultFunction); }); }); @@ -98,14 +98,14 @@ describe('ol.layer.Vector', function() { describe('#getStyle()', function() { var source = new VectorSource(); - var style = new _ol_style_Style_(); + var style = new Style(); it('returns what is provided to setStyle', function() { var layer = new VectorLayer({ source: source }); - expect(layer.getStyle()).to.be(_ol_style_Style_.defaultFunction); + expect(layer.getStyle()).to.be(Style.defaultFunction); layer.setStyle(style); expect(layer.getStyle()).to.be(style); diff --git a/test/spec/ol/render/canvas/immediate.test.js b/test/spec/ol/render/canvas/immediate.test.js index b096ca6278..d5a7c14e8d 100644 --- a/test/spec/ol/render/canvas/immediate.test.js +++ b/test/spec/ol/render/canvas/immediate.test.js @@ -11,7 +11,7 @@ import CanvasImmediateRenderer from '../../../../../src/ol/render/canvas/Immedia import _ol_style_Circle_ from '../../../../../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../../../../../src/ol/style/Style.js'; +import Style from '../../../../../src/ol/style/Style.js'; import _ol_style_Text_ from '../../../../../src/ol/style/Text.js'; @@ -46,7 +46,7 @@ describe('ol.render.canvas.Immediate', function() { var stroke = new _ol_style_Stroke_({}); var text = new _ol_style_Text_({}); var image = new _ol_style_Circle_({}); - var style = new _ol_style_Style_({ + var style = new Style({ fill: fill, stroke: stroke, image: image, diff --git a/test/spec/ol/render/webgl/immediate.test.js b/test/spec/ol/render/webgl/immediate.test.js index f67ee129b0..5f37920c60 100644 --- a/test/spec/ol/render/webgl/immediate.test.js +++ b/test/spec/ol/render/webgl/immediate.test.js @@ -15,13 +15,13 @@ import _ol_render_webgl_PolygonReplay_ from '../../../../../src/ol/render/webgl/ import _ol_style_Circle_ from '../../../../../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../../../../../src/ol/style/Style.js'; +import Style from '../../../../../src/ol/style/Style.js'; describe('ol.render.webgl.Immediate', function() { var context, style, circle, line, multiLine, point, multiPoint, polygon, multiPolygon; beforeEach(function() { context = new _ol_render_webgl_Immediate_({}, [0, 0], 0, 0, [0, 0], [-180, -90, 180, 90], 1); - style = new _ol_style_Style_({ + style = new Style({ image: new _ol_style_Circle_(), fill: new _ol_style_Fill_(), stroke: new _ol_style_Stroke_() diff --git a/test/spec/ol/renderer/canvas/map.test.js b/test/spec/ol/renderer/canvas/map.test.js index 9b65622676..8312fdc472 100644 --- a/test/spec/ol/renderer/canvas/map.test.js +++ b/test/spec/ol/renderer/canvas/map.test.js @@ -9,7 +9,7 @@ import CanvasLayerRenderer from '../../../../../src/ol/renderer/canvas/Layer.js' import CanvasMapRenderer from '../../../../../src/ol/renderer/canvas/Map.js'; import VectorSource from '../../../../../src/ol/source/Vector.js'; import _ol_style_Icon_ from '../../../../../src/ol/style/Icon.js'; -import _ol_style_Style_ from '../../../../../src/ol/style/Style.js'; +import Style from '../../../../../src/ol/style/Style.js'; describe('ol.renderer.canvas.Map', function() { @@ -58,7 +58,7 @@ describe('ol.renderer.canvas.Map', function() { }) ] }), - style: new _ol_style_Style_({ + style: new Style({ image: new _ol_style_Icon_({ img: img, imgSize: [1, 1] diff --git a/test/spec/ol/renderer/canvas/replay.test.js b/test/spec/ol/renderer/canvas/replay.test.js index 2f52a0dc85..d9807079a3 100644 --- a/test/spec/ol/renderer/canvas/replay.test.js +++ b/test/spec/ol/renderer/canvas/replay.test.js @@ -14,7 +14,7 @@ import _ol_render_canvas_ReplayGroup_ from '../../../../../src/ol/render/canvas/ import _ol_renderer_vector_ from '../../../../../src/ol/renderer/vector.js'; import _ol_style_Fill_ from '../../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../../../../../src/ol/style/Style.js'; +import Style from '../../../../../src/ol/style/Style.js'; import _ol_transform_ from '../../../../../src/ol/transform.js'; describe('ol.render.canvas.ReplayGroup', function() { @@ -37,17 +37,17 @@ describe('ol.render.canvas.ReplayGroup', function() { [[[90, 45], [90, 0], [0, 0], [0, 45], [90, 45]]])); feature3 = new Feature(new Polygon( [[[-90, -45], [-90, 45], [90, 45], [90, -45], [-90, -45]]])); - fill0 = new _ol_style_Style_({ + fill0 = new Style({ fill: new _ol_style_Fill_({color: 'black'}) }); - fill1 = new _ol_style_Style_({ + fill1 = new Style({ fill: new _ol_style_Fill_({color: 'red'}) }); - style1 = new _ol_style_Style_({ + style1 = new Style({ fill: new _ol_style_Fill_({color: 'black'}), stroke: new _ol_style_Stroke_({color: 'white', width: 1}) }); - style2 = new _ol_style_Style_({ + style2 = new Style({ fill: new _ol_style_Fill_({color: 'white'}), stroke: new _ol_style_Stroke_({color: 'black', width: 1, lineDash: [3, 6], lineDashOffset: 2}) @@ -216,7 +216,7 @@ describe('ol.render.canvas.ReplayGroup', function() { it('calls the renderer function configured for the style', function() { var calls = []; - var style = new _ol_style_Style_({ + var style = new Style({ renderer: function(coords, state) { calls.push({ coords: coords, diff --git a/test/spec/ol/renderer/canvas/vectorlayer.test.js b/test/spec/ol/renderer/canvas/vectorlayer.test.js index 4d393b4c09..216538b69e 100644 --- a/test/spec/ol/renderer/canvas/vectorlayer.test.js +++ b/test/spec/ol/renderer/canvas/vectorlayer.test.js @@ -10,7 +10,7 @@ import {get as getProjection} from '../../../../../src/ol/proj.js'; import _ol_render_canvas_ from '../../../../../src/ol/render/canvas.js'; import CanvasVectorLayerRenderer from '../../../../../src/ol/renderer/canvas/VectorLayer.js'; import VectorSource from '../../../../../src/ol/source/Vector.js'; -import _ol_style_Style_ from '../../../../../src/ol/style/Style.js'; +import Style from '../../../../../src/ol/style/Style.js'; import _ol_style_Text_ from '../../../../../src/ol/style/Text.js'; @@ -56,12 +56,12 @@ describe('ol.renderer.canvas.VectorLayer', function() { }), target: target }); - var layerStyle = [new _ol_style_Style_({ + var layerStyle = [new Style({ text: new _ol_style_Text_({ text: 'layer' }) })]; - var featureStyle = [new _ol_style_Style_({ + var featureStyle = [new Style({ text: new _ol_style_Text_({ text: 'feature' }) @@ -93,7 +93,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { }), target: target }); - var layerStyle = new _ol_style_Style_({ + var layerStyle = new Style({ text: new _ol_style_Text_({ text: 'layer', font: '12px "Unavailable Font",sans-serif' @@ -124,7 +124,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { }), target: target }); - var layerStyle = new _ol_style_Style_({ + var layerStyle = new Style({ text: new _ol_style_Text_({ text: 'layer', font: '12px sans-serif' @@ -156,7 +156,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { }), target: target }); - var layerStyle = new _ol_style_Style_({ + var layerStyle = new Style({ text: new _ol_style_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 259b6aeb8d..ae85667136 100644 --- a/test/spec/ol/renderer/canvas/vectortilelayer.test.js +++ b/test/spec/ol/renderer/canvas/vectortilelayer.test.js @@ -16,7 +16,7 @@ import _ol_render_canvas_ from '../../../../../src/ol/render/canvas.js'; 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 _ol_style_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_tilegrid_ from '../../../../../src/ol/tilegrid.js'; @@ -45,12 +45,12 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { }), target: target }); - layerStyle = [new _ol_style_Style_({ + layerStyle = [new Style({ text: new _ol_style_Text_({ text: 'layer' }) })]; - var featureStyle = [new _ol_style_Style_({ + var featureStyle = [new Style({ text: new _ol_style_Text_({ text: 'feature' }) @@ -133,7 +133,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { it('renders replays with custom renderers as direct replays', function() { layer.renderMode_ = 'image'; - layer.setStyle(new _ol_style_Style_({ + layer.setStyle(new Style({ renderer: function() {} })); var spy = sinon.spy(CanvasVectorTileLayerRenderer.prototype, @@ -216,7 +216,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { it('works for multiple layers that use the same source', function() { var layer2 = new VectorTileLayer({ source: source, - style: new _ol_style_Style_({ + style: new Style({ text: new _ol_style_Text_({ text: 'layer2' }) diff --git a/test/spec/ol/renderer/vector.test.js b/test/spec/ol/renderer/vector.test.js index e0434fa402..5e1808a18e 100644 --- a/test/spec/ol/renderer/vector.test.js +++ b/test/spec/ol/renderer/vector.test.js @@ -11,7 +11,7 @@ import _ol_renderer_vector_ from '../../../../src/ol/renderer/vector.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; -import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; +import Style from '../../../../src/ol/style/Style.js'; import Feature from '../../../../src/ol/Feature.js'; @@ -27,7 +27,7 @@ describe('ol.renderer.vector', function() { iconStyle = new _ol_style_Icon_({ src: 'http://example.com/icon.png' }); - style = new _ol_style_Style_({ + style = new Style({ image: iconStyle, fill: new _ol_style_Fill_({}), stroke: new _ol_style_Stroke_({}) diff --git a/test/spec/ol/style/style.test.js b/test/spec/ol/style/style.test.js index 955a9d9e3e..48ab73f405 100644 --- a/test/spec/ol/style/style.test.js +++ b/test/spec/ol/style/style.test.js @@ -1,6 +1,6 @@ import Feature from '../../../../src/ol/Feature.js'; import Point from '../../../../src/ol/geom/Point.js'; -import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; +import Style from '../../../../src/ol/style/Style.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -36,14 +36,14 @@ describe('ol.style.Style', function() { describe('#clone', function() { it('creates a new ol.style.Style', function() { - var original = new _ol_style_Style_(); + var original = new Style(); var clone = original.clone(); - expect(clone).to.be.an(_ol_style_Style_); + expect(clone).to.be.an(Style); expect(clone).to.not.be(original); }); it('copies all values', function() { - var original = new _ol_style_Style_({ + var original = new Style({ geometry: new Point([0, 0, 0]), fill: new _ol_style_Fill_({ color: '#319FD3' @@ -69,7 +69,7 @@ describe('ol.style.Style', function() { }); it('the clone does not reference the same objects as the original', function() { - var original = new _ol_style_Style_({ + var original = new Style({ geometry: new Point([0, 0, 0]), fill: new _ol_style_Fill_({ color: '#319FD3' @@ -107,7 +107,7 @@ describe('ol.style.Style', function() { describe('#setZIndex', function() { it('sets the zIndex', function() { - var style = new _ol_style_Style_(); + var style = new Style(); style.setZIndex(0.7); expect(style.getZIndex()).to.be(0.7); @@ -115,7 +115,7 @@ describe('ol.style.Style', function() { }); describe('#getFill', function() { - var style = new _ol_style_Style_({ + var style = new Style({ fill: testFill }); @@ -125,7 +125,7 @@ describe('ol.style.Style', function() { }); describe('#setFill', function() { - var style = new _ol_style_Style_(); + var style = new Style(); it('sets the fill style of a style', function() { style.setFill(testFill); @@ -134,7 +134,7 @@ describe('ol.style.Style', function() { }); describe('#getImage', function() { - var style = new _ol_style_Style_({ + var style = new Style({ image: testImage }); @@ -144,7 +144,7 @@ describe('ol.style.Style', function() { }); describe('#setImage', function() { - var style = new _ol_style_Style_(); + var style = new Style(); it('sets the image style of a style', function() { style.setImage(testImage); @@ -153,7 +153,7 @@ describe('ol.style.Style', function() { }); describe('#getStroke', function() { - var style = new _ol_style_Style_({ + var style = new Style({ stroke: testStroke }); @@ -163,7 +163,7 @@ describe('ol.style.Style', function() { }); describe('#setStroke', function() { - var style = new _ol_style_Style_(); + var style = new Style(); it('sets the stroke style of a style', function() { style.setStroke(testStroke); @@ -172,7 +172,7 @@ describe('ol.style.Style', function() { }); describe('#getText', function() { - var style = new _ol_style_Style_({ + var style = new Style({ text: testText }); @@ -182,7 +182,7 @@ describe('ol.style.Style', function() { }); describe('#setText', function() { - var style = new _ol_style_Style_(); + var style = new Style(); it('sets the text style of a style', function() { style.setText(testText); @@ -191,7 +191,7 @@ describe('ol.style.Style', function() { }); describe('#setGeometry', function() { - var style = new _ol_style_Style_(); + var style = new Style(); it('creates a geometry function from a string', function() { var feature = new Feature(); @@ -221,7 +221,7 @@ describe('ol.style.Style', function() { describe('#getGeometry', function() { it('returns whatever was passed to setGeometry', function() { - var style = new _ol_style_Style_(); + var style = new Style(); style.setGeometry('foo'); expect(style.getGeometry()).to.eql('foo'); var geom = new Point([1, 2]); @@ -241,15 +241,15 @@ describe('ol.style.Style', function() { }); describe('ol.style.Style.createFunction()', function() { - var style = new _ol_style_Style_(); + var style = new Style(); it('creates a style function from a single style', function() { - var styleFunction = _ol_style_Style_.createFunction(style); + var styleFunction = Style.createFunction(style); expect(styleFunction()).to.eql([style]); }); it('creates a style function from an array of styles', function() { - var styleFunction = _ol_style_Style_.createFunction([style]); + var styleFunction = Style.createFunction([style]); expect(styleFunction()).to.eql([style]); }); @@ -257,13 +257,13 @@ describe('ol.style.Style.createFunction()', function() { var original = function() { return [style]; }; - var styleFunction = _ol_style_Style_.createFunction(original); + var styleFunction = Style.createFunction(original); expect(styleFunction).to.be(original); }); it('throws on (some) unexpected input', function() { expect(function() { - _ol_style_Style_.createFunction({bogus: 'input'}); + Style.createFunction({bogus: 'input'}); }).to.throwException(); }); From dc6ae2293d6842d7fd01585212c0932f81af9203 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 13:23:27 -0700 Subject: [PATCH 25/35] Rename _ol_style_Fill_ to Fill --- examples/blend-modes.js | 8 ++--- examples/canvas-gradient-pattern.js | 4 +-- examples/center.js | 6 ++-- examples/cluster.js | 6 ++-- examples/custom-interactions.js | 4 +-- examples/drag-and-drop-image-vector.js | 10 +++---- examples/drag-and-drop.js | 10 +++---- examples/draw-and-modify-features.js | 6 ++-- examples/dynamic-data.js | 8 ++--- examples/earthquake-clusters.js | 10 +++---- examples/earthquake-custom-symbol.js | 4 +-- examples/feature-move-animation.js | 4 +-- examples/geojson.js | 10 +++---- examples/geolocation.js | 4 +-- examples/gpx.js | 4 +-- examples/igc.js | 4 +-- examples/image-vector-layer.js | 6 ++-- examples/kml-earthquakes.js | 4 +-- examples/kml-timezones.js | 4 +-- examples/layer-z-index.js | 8 ++--- examples/mapbox-vector-tiles-advanced.js | 4 +-- examples/mapbox-vector-tiles.js | 4 +-- examples/measure.js | 10 +++---- examples/modify-test.js | 12 ++++---- examples/osm-vector-tiles.js | 6 ++-- examples/polygon-styles.js | 6 ++-- examples/regularshape.js | 4 +-- examples/render-geometry.js | 4 +-- examples/snap.js | 6 ++-- examples/street-labels.js | 4 +-- examples/symbol-atlas-webgl.js | 6 ++-- examples/synthetic-points.js | 6 ++-- examples/topojson.js | 4 +-- examples/topolis.js | 12 ++++---- examples/vector-esri.js | 10 +++---- examples/vector-label-decluttering.js | 6 ++-- examples/vector-labels.js | 8 ++--- examples/vector-layer.js | 10 +++---- examples/vector-osm.js | 10 +++---- src/ol/Graticule.js | 6 ++-- src/ol/format/KML.js | 8 ++--- src/ol/style/Fill.js | 14 ++++----- src/ol/style/Style.js | 8 ++--- src/ol/style/Text.js | 4 +-- test/rendering/ol/layer/tile.test.js | 4 +-- test/rendering/ol/layer/vector.test.js | 14 ++++----- test/rendering/ol/layer/vectortile.test.js | 6 ++-- test/rendering/ol/render.test.js | 6 ++-- test/rendering/ol/style/circle.test.js | 18 +++++------ test/rendering/ol/style/polygon.test.js | 18 +++++------ test/rendering/ol/style/regularshape.test.js | 6 ++-- test/rendering/ol/style/text.test.js | 10 +++---- test/spec/ol/format/kml.test.js | 22 +++++++------- test/spec/ol/render/canvas/immediate.test.js | 4 +-- .../spec/ol/render/webgl/circlereplay.test.js | 4 +-- test/spec/ol/render/webgl/immediate.test.js | 4 +-- .../ol/render/webgl/polygonreplay.test.js | 6 ++-- test/spec/ol/render/webgl/textreplay.test.js | 16 +++++----- test/spec/ol/renderer/canvas/replay.test.js | 10 +++---- test/spec/ol/renderer/vector.test.js | 4 +-- test/spec/ol/style/circle.test.js | 30 +++++++++---------- test/spec/ol/style/fill.test.js | 10 +++---- test/spec/ol/style/regularshape.test.js | 28 ++++++++--------- test/spec/ol/style/style.test.js | 10 +++---- test/spec/ol/style/text.test.js | 10 +++---- 65 files changed, 268 insertions(+), 268 deletions(-) diff --git a/examples/blend-modes.js b/examples/blend-modes.js index 3541d6fc90..555682be14 100644 --- a/examples/blend-modes.js +++ b/examples/blend-modes.js @@ -5,7 +5,7 @@ import Point from '../src/ol/geom/Point.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -20,7 +20,7 @@ var redLayer = new VectorLayer({ }), style: new Style({ image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255,0,0,0.8)' }), stroke: new _ol_style_Stroke_({ @@ -38,7 +38,7 @@ var greenLayer = new VectorLayer({ }), style: new Style({ image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0,255,0,0.8)' }), stroke: new _ol_style_Stroke_({ @@ -55,7 +55,7 @@ var blueLayer = new VectorLayer({ }), style: new Style({ image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0,0,255,0.8)' }), stroke: new _ol_style_Stroke_({ diff --git a/examples/canvas-gradient-pattern.js b/examples/canvas-gradient-pattern.js index ceb4573098..1291293dc4 100644 --- a/examples/canvas-gradient-pattern.js +++ b/examples/canvas-gradient-pattern.js @@ -6,7 +6,7 @@ import _ol_has_ from '../src/ol/has.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import {fromLonLat} from '../src/ol/proj.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -57,7 +57,7 @@ var pattern = (function() { }()); // Generate style for gradient or pattern fill -var fill = new _ol_style_Fill_(); +var fill = new Fill(); var style = new Style({ fill: fill, stroke: new _ol_style_Stroke_({ diff --git a/examples/center.js b/examples/center.js index 8ffa8e0a13..27c41be7bf 100644 --- a/examples/center.js +++ b/examples/center.js @@ -7,7 +7,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -16,7 +16,7 @@ var source = new VectorSource({ format: new GeoJSON() }); var style = new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), stroke: new _ol_style_Stroke_({ @@ -25,7 +25,7 @@ var style = new Style({ }), image: new _ol_style_Circle_({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), stroke: new _ol_style_Stroke_({ diff --git a/examples/cluster.js b/examples/cluster.js index aceafc6e80..66669ccfdc 100644 --- a/examples/cluster.js +++ b/examples/cluster.js @@ -8,7 +8,7 @@ import Cluster from '../src/ol/source/Cluster.js'; import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_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'; @@ -46,13 +46,13 @@ var clusters = new VectorLayer({ stroke: new _ol_style_Stroke_({ color: '#fff' }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#3399CC' }) }), text: new _ol_style_Text_({ text: size.toString(), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#fff' }) }) diff --git a/examples/custom-interactions.js b/examples/custom-interactions.js index 11d5901ad8..5fdca8cd4b 100644 --- a/examples/custom-interactions.js +++ b/examples/custom-interactions.js @@ -11,7 +11,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_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 _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -168,7 +168,7 @@ var map = new Map({ width: 3, color: [255, 0, 0, 1] }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: [0, 0, 255, 0.6] }) }) diff --git a/examples/drag-and-drop-image-vector.js b/examples/drag-and-drop-image-vector.js index ba7ea9f0ee..af17dfa7b1 100644 --- a/examples/drag-and-drop-image-vector.js +++ b/examples/drag-and-drop-image-vector.js @@ -12,7 +12,7 @@ import TileLayer from '../src/ol/layer/Tile.js'; import BingMaps from '../src/ol/source/BingMaps.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -20,7 +20,7 @@ import Style from '../src/ol/style/Style.js'; var defaultStyle = { 'Point': new Style({ image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255,255,0,0.5)' }), radius: 5, @@ -37,7 +37,7 @@ var defaultStyle = { }) }), 'Polygon': new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0,255,255,0.5)' }), stroke: new _ol_style_Stroke_({ @@ -47,7 +47,7 @@ var defaultStyle = { }), 'MultiPoint': new Style({ image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255,0,255,0.5)' }), radius: 5, @@ -64,7 +64,7 @@ var defaultStyle = { }) }), 'MultiPolygon': new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0,0,255,0.5)' }), stroke: new _ol_style_Stroke_({ diff --git a/examples/drag-and-drop.js b/examples/drag-and-drop.js index 917200124f..6759be7abb 100644 --- a/examples/drag-and-drop.js +++ b/examples/drag-and-drop.js @@ -12,7 +12,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import BingMaps from '../src/ol/source/BingMaps.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -20,7 +20,7 @@ import Style from '../src/ol/style/Style.js'; var defaultStyle = { 'Point': new Style({ image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255,255,0,0.5)' }), radius: 5, @@ -37,7 +37,7 @@ var defaultStyle = { }) }), 'Polygon': new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0,255,255,0.5)' }), stroke: new _ol_style_Stroke_({ @@ -47,7 +47,7 @@ var defaultStyle = { }), 'MultiPoint': new Style({ image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255,0,255,0.5)' }), radius: 5, @@ -64,7 +64,7 @@ var defaultStyle = { }) }), 'MultiPolygon': new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0,0,255,0.5)' }), stroke: new _ol_style_Stroke_({ diff --git a/examples/draw-and-modify-features.js b/examples/draw-and-modify-features.js index a2f7b967a9..182af6edaf 100644 --- a/examples/draw-and-modify-features.js +++ b/examples/draw-and-modify-features.js @@ -8,7 +8,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -20,7 +20,7 @@ var source = new VectorSource(); var vector = new VectorLayer({ source: source, style: new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.2)' }), stroke: new _ol_style_Stroke_({ @@ -29,7 +29,7 @@ var vector = new VectorLayer({ }), image: new _ol_style_Circle_({ radius: 7, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#ffcc33' }) }) diff --git a/examples/dynamic-data.js b/examples/dynamic-data.js index 7c2de24d59..0f74528988 100644 --- a/examples/dynamic-data.js +++ b/examples/dynamic-data.js @@ -5,7 +5,7 @@ import Point from '../src/ol/geom/Point.js'; import TileLayer from '../src/ol/layer/Tile.js'; import OSM from '../src/ol/source/OSM.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -27,7 +27,7 @@ var imageStyle = new Style({ image: new _ol_style_Circle_({ radius: 5, snapToPixel: false, - fill: new _ol_style_Fill_({color: 'yellow'}), + fill: new Fill({color: 'yellow'}), stroke: new _ol_style_Stroke_({color: 'red', width: 1}) }) }); @@ -36,7 +36,7 @@ var headInnerImageStyle = new Style({ image: new _ol_style_Circle_({ radius: 2, snapToPixel: false, - fill: new _ol_style_Fill_({color: 'blue'}) + fill: new Fill({color: 'blue'}) }) }); @@ -44,7 +44,7 @@ var headOuterImageStyle = new Style({ image: new _ol_style_Circle_({ radius: 5, snapToPixel: false, - fill: new _ol_style_Fill_({color: 'black'}) + fill: new Fill({color: 'black'}) }) }); diff --git a/examples/earthquake-clusters.js b/examples/earthquake-clusters.js index 6e9a0e9ed6..6ba9c4f3f2 100644 --- a/examples/earthquake-clusters.js +++ b/examples/earthquake-clusters.js @@ -10,28 +10,28 @@ import Cluster from '../src/ol/source/Cluster.js'; import Stamen from '../src/ol/source/Stamen.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; import _ol_style_Text_ from '../src/ol/style/Text.js'; -var earthquakeFill = new _ol_style_Fill_({ +var earthquakeFill = new Fill({ color: 'rgba(255, 153, 0, 0.8)' }); var earthquakeStroke = new _ol_style_Stroke_({ color: 'rgba(255, 204, 0, 0.2)', width: 1 }); -var textFill = new _ol_style_Fill_({ +var textFill = new Fill({ color: '#fff' }); var textStroke = new _ol_style_Stroke_({ color: 'rgba(0, 0, 0, 0.6)', width: 3 }); -var invisibleFill = new _ol_style_Fill_({ +var invisibleFill = new Fill({ color: 'rgba(255, 255, 255, 0.01)' }); @@ -88,7 +88,7 @@ function styleFunction(feature, resolution) { style = new Style({ image: new _ol_style_Circle_({ radius: feature.get('radius'), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: [255, 153, 0, Math.min(0.8, 0.4 + (size / maxFeatureCount))] }) }), diff --git a/examples/earthquake-custom-symbol.js b/examples/earthquake-custom-symbol.js index fd3a756a84..74832551bf 100644 --- a/examples/earthquake-custom-symbol.js +++ b/examples/earthquake-custom-symbol.js @@ -7,7 +7,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import _ol_render_ from '../src/ol/render.js'; import Stamen from '../src/ol/source/Stamen.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -36,7 +36,7 @@ var styleFunction = function(feature) { /** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d')), {size: [size, size], pixelRatio: 1}); vectorContext.setStyle(new Style({ - fill: new _ol_style_Fill_({color: 'rgba(255, 153, 0, 0.4)'}), + fill: new Fill({color: 'rgba(255, 153, 0, 0.4)'}), stroke: new _ol_style_Stroke_({color: 'rgba(255, 204, 0, 0.2)', width: 2}) })); vectorContext.drawGeometry(new Polygon([symbol.map(scaleFunction)])); diff --git a/examples/feature-move-animation.js b/examples/feature-move-animation.js index c142c2ff4e..c99ed86423 100644 --- a/examples/feature-move-animation.js +++ b/examples/feature-move-animation.js @@ -8,7 +8,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import BingMaps from '../src/ol/source/BingMaps.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -100,7 +100,7 @@ var styles = { image: new _ol_style_Circle_({ radius: 7, snapToPixel: false, - fill: new _ol_style_Fill_({color: 'black'}), + fill: new Fill({color: 'black'}), stroke: new _ol_style_Stroke_({ color: 'white', width: 2 }) diff --git a/examples/geojson.js b/examples/geojson.js index 2ec7aa15ce..c9d5fda1b8 100644 --- a/examples/geojson.js +++ b/examples/geojson.js @@ -9,7 +9,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -44,7 +44,7 @@ var styles = { color: 'yellow', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 255, 0, 0.1)' }) }), @@ -54,7 +54,7 @@ var styles = { lineDash: [4], width: 3 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0, 0, 255, 0.1)' }) }), @@ -63,7 +63,7 @@ var styles = { color: 'magenta', width: 2 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'magenta' }), image: new _ol_style_Circle_({ @@ -79,7 +79,7 @@ var styles = { color: 'red', width: 2 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255,0,0,0.2)' }) }) diff --git a/examples/geolocation.js b/examples/geolocation.js index a4c5a47b65..471becd32f 100644 --- a/examples/geolocation.js +++ b/examples/geolocation.js @@ -9,7 +9,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -70,7 +70,7 @@ var positionFeature = new Feature(); positionFeature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 6, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#3399CC' }), stroke: new _ol_style_Stroke_({ diff --git a/examples/gpx.js b/examples/gpx.js index d17cac8ca8..4744598147 100644 --- a/examples/gpx.js +++ b/examples/gpx.js @@ -6,7 +6,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import BingMaps from '../src/ol/source/BingMaps.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -20,7 +20,7 @@ var raster = new TileLayer({ var style = { 'Point': new Style({ image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255,255,0,0.4)' }), radius: 5, diff --git a/examples/igc.js b/examples/igc.js index 9d652574bf..fc5854daca 100644 --- a/examples/igc.js +++ b/examples/igc.js @@ -10,7 +10,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -181,7 +181,7 @@ var featureOverlay = new VectorLayer({ style: new Style({ image: new _ol_style_Circle_({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255,0,0,0.9)' }) }) diff --git a/examples/image-vector-layer.js b/examples/image-vector-layer.js index 2627c065af..13fb0edb12 100644 --- a/examples/image-vector-layer.js +++ b/examples/image-vector-layer.js @@ -3,14 +3,14 @@ import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_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'; var style = new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), stroke: new _ol_style_Stroke_({ @@ -49,7 +49,7 @@ var featureOverlay = new VectorLayer({ color: '#f00', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255,0,0,0.1)' }) }) diff --git a/examples/kml-earthquakes.js b/examples/kml-earthquakes.js index c5c315a884..a37e2e1577 100644 --- a/examples/kml-earthquakes.js +++ b/examples/kml-earthquakes.js @@ -6,7 +6,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import Stamen from '../src/ol/source/Stamen.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -24,7 +24,7 @@ var styleFunction = function(feature) { style = new Style({ image: new _ol_style_Circle_({ radius: radius, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 153, 0, 0.4)' }), stroke: new _ol_style_Stroke_({ diff --git a/examples/kml-timezones.js b/examples/kml-timezones.js index 88d3849308..00554dcea4 100644 --- a/examples/kml-timezones.js +++ b/examples/kml-timezones.js @@ -5,7 +5,7 @@ import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import Stamen from '../src/ol/source/Stamen.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -36,7 +36,7 @@ var styleFunction = function(feature) { } var opacity = 0.75 * (1 - delta / 12); return new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: [0xff, 0xff, 0x33, opacity] }), stroke: new _ol_style_Stroke_({ diff --git a/examples/layer-z-index.js b/examples/layer-z-index.js index 980faa62db..e286d8aea9 100644 --- a/examples/layer-z-index.js +++ b/examples/layer-z-index.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_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -15,7 +15,7 @@ var stroke = new _ol_style_Stroke_({color: 'black', width: 1}); var styles = { 'square': new Style({ image: new _ol_style_RegularShape_({ - fill: new _ol_style_Fill_({color: 'blue'}), + fill: new Fill({color: 'blue'}), stroke: stroke, points: 4, radius: 80, @@ -24,7 +24,7 @@ var styles = { }), 'triangle': new Style({ image: new _ol_style_RegularShape_({ - fill: new _ol_style_Fill_({color: 'red'}), + fill: new Fill({color: 'red'}), stroke: stroke, points: 3, radius: 80, @@ -34,7 +34,7 @@ var styles = { }), 'star': new Style({ image: new _ol_style_RegularShape_({ - fill: new _ol_style_Fill_({color: 'green'}), + fill: new Fill({color: 'green'}), stroke: stroke, points: 5, radius: 80, diff --git a/examples/mapbox-vector-tiles-advanced.js b/examples/mapbox-vector-tiles-advanced.js index 4359817c5d..463133b4ee 100644 --- a/examples/mapbox-vector-tiles-advanced.js +++ b/examples/mapbox-vector-tiles-advanced.js @@ -4,7 +4,7 @@ import MVT from '../src/ol/format/MVT.js'; import VectorTileLayer from '../src/ol/layer/VectorTile.js'; import {get as getProjection} from '../src/ol/proj.js'; import VectorTileSource from '../src/ol/source/VectorTile.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -45,7 +45,7 @@ var map = new Map({ }), tileUrlFunction: tileUrlFunction }), - style: createMapboxStreetsV6Style(Style, _ol_style_Fill_, _ol_style_Stroke_, _ol_style_Icon_, _ol_style_Text_) + style: createMapboxStreetsV6Style(Style, Fill, _ol_style_Stroke_, _ol_style_Icon_, _ol_style_Text_) }) ], target: 'map', diff --git a/examples/mapbox-vector-tiles.js b/examples/mapbox-vector-tiles.js index 1000b987c1..d4aac95a47 100644 --- a/examples/mapbox-vector-tiles.js +++ b/examples/mapbox-vector-tiles.js @@ -3,7 +3,7 @@ import View from '../src/ol/View.js'; 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 _ol_style_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 _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.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, _ol_style_Fill_, _ol_style_Stroke_, _ol_style_Icon_, _ol_style_Text_) + style: createMapboxStreetsV6Style(Style, Fill, _ol_style_Stroke_, _ol_style_Icon_, _ol_style_Text_) }) ], target: 'map', diff --git a/examples/measure.js b/examples/measure.js index e084737cb1..90ad489d8b 100644 --- a/examples/measure.js +++ b/examples/measure.js @@ -11,7 +11,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -25,7 +25,7 @@ var source = new VectorSource(); var vector = new VectorLayer({ source: source, style: new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.2)' }), stroke: new _ol_style_Stroke_({ @@ -34,7 +34,7 @@ var vector = new VectorLayer({ }), image: new _ol_style_Circle_({ radius: 7, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#ffcc33' }) }) @@ -181,7 +181,7 @@ function addInteraction() { source: source, type: type, style: new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.2)' }), stroke: new _ol_style_Stroke_({ @@ -194,7 +194,7 @@ function addInteraction() { stroke: new _ol_style_Stroke_({ color: 'rgba(0, 0, 0, 0.7)' }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.2)' }) }) diff --git a/examples/modify-test.js b/examples/modify-test.js index 4652665be3..2133749dab 100644 --- a/examples/modify-test.js +++ b/examples/modify-test.js @@ -7,7 +7,7 @@ import Select from '../src/ol/interaction/Select.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -25,7 +25,7 @@ var styleFunction = (function() { color: 'blue', width: 3 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0, 0, 255, 0.1)' }) }); @@ -40,7 +40,7 @@ var styleFunction = (function() { color: 'yellow', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 255, 0, 0.1)' }) }); @@ -49,7 +49,7 @@ var styleFunction = (function() { color: 'red', width: 3 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 0, 0, 0.1)' }), image: image @@ -157,7 +157,7 @@ var overlayStyle = (function() { var styles = {}; styles['Polygon'] = [ new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: [255, 255, 255, 0.5] }) }), @@ -196,7 +196,7 @@ var overlayStyle = (function() { new Style({ image: new _ol_style_Circle_({ radius: 7, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: [0, 153, 255, 1] }), stroke: new _ol_style_Stroke_({ diff --git a/examples/osm-vector-tiles.js b/examples/osm-vector-tiles.js index dd490963c1..3fd1a68f80 100644 --- a/examples/osm-vector-tiles.js +++ b/examples/osm-vector-tiles.js @@ -4,7 +4,7 @@ import TopoJSON from '../src/ol/format/TopoJSON.js'; import VectorTileLayer from '../src/ol/layer/VectorTile.js'; import {fromLonLat} from '../src/ol/proj.js'; import VectorTileSource from '../src/ol/source/VectorTile.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -17,7 +17,7 @@ var roadColor = { 'highway': '#f39' }; var buildingStyle = new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#666', opacity: 0.4 }), @@ -27,7 +27,7 @@ var buildingStyle = new Style({ }) }); var waterStyle = new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#9db9e8' }) }); diff --git a/examples/polygon-styles.js b/examples/polygon-styles.js index 8134f5762d..43f4c10750 100644 --- a/examples/polygon-styles.js +++ b/examples/polygon-styles.js @@ -5,7 +5,7 @@ import MultiPoint from '../src/ol/geom/MultiPoint.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -22,14 +22,14 @@ var styles = [ color: 'blue', width: 3 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0, 0, 255, 0.1)' }) }), new Style({ image: new _ol_style_Circle_({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'orange' }) }), diff --git a/examples/regularshape.js b/examples/regularshape.js index fde861489b..060ef936c0 100644 --- a/examples/regularshape.js +++ b/examples/regularshape.js @@ -4,14 +4,14 @@ import View from '../src/ol/View.js'; import Point from '../src/ol/geom/Point.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; var stroke = new _ol_style_Stroke_({color: 'black', width: 2}); -var fill = new _ol_style_Fill_({color: 'red'}); +var fill = new Fill({color: 'red'}); var styles = { 'square': new Style({ diff --git a/examples/render-geometry.js b/examples/render-geometry.js index cafd0d616f..f334629ad6 100644 --- a/examples/render-geometry.js +++ b/examples/render-geometry.js @@ -3,7 +3,7 @@ import Point from '../src/ol/geom/Point.js'; import Polygon from '../src/ol/geom/Polygon.js'; import _ol_render_ from '../src/ol/render.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -11,7 +11,7 @@ import Style from '../src/ol/style/Style.js'; var canvas = document.getElementById('canvas'); var vectorContext = _ol_render_.toContext(canvas.getContext('2d'), {size: [100, 100]}); -var fill = new _ol_style_Fill_({color: 'blue'}); +var fill = new Fill({color: 'blue'}); var stroke = new _ol_style_Stroke_({color: 'black'}); var style = new Style({ fill: fill, diff --git a/examples/snap.js b/examples/snap.js index 964f1220a5..8896399a5d 100644 --- a/examples/snap.js +++ b/examples/snap.js @@ -9,7 +9,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -20,7 +20,7 @@ var raster = new TileLayer({ var vector = new VectorLayer({ source: new VectorSource(), style: new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.2)' }), stroke: new _ol_style_Stroke_({ @@ -29,7 +29,7 @@ var vector = new VectorLayer({ }), image: new _ol_style_Circle_({ radius: 7, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#ffcc33' }) }) diff --git a/examples/street-labels.js b/examples/street-labels.js index 56f1a4490d..4a5d178d01 100644 --- a/examples/street-labels.js +++ b/examples/street-labels.js @@ -6,7 +6,7 @@ import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import BingMaps from '../src/ol/source/BingMaps.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import 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'; @@ -14,7 +14,7 @@ var style = new Style({ text: new _ol_style_Text_({ font: 'bold 11px "Open Sans", "Arial Unicode MS", "sans-serif"', placement: 'line', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'white' }) }) diff --git a/examples/symbol-atlas-webgl.js b/examples/symbol-atlas-webgl.js index 35dfb9da4c..d72bfe70ea 100644 --- a/examples/symbol-atlas-webgl.js +++ b/examples/symbol-atlas-webgl.js @@ -6,7 +6,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import AtlasManager from '../src/ol/style/AtlasManager.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -51,7 +51,7 @@ for (i = 0; i < symbolInfo.length; ++i) { opacity: info.opacity, scale: info.scale, radius: radiuses[j], - fill: new _ol_style_Fill_({ + fill: new Fill({ color: info.fillColor }), stroke: new _ol_style_Stroke_({ @@ -71,7 +71,7 @@ for (i = 0; i < symbolInfo.length; ++i) { radius: radiuses[j], radius2: radiuses[j] * 0.7, angle: 1.4, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: info.fillColor }), stroke: new _ol_style_Stroke_({ diff --git a/examples/synthetic-points.js b/examples/synthetic-points.js index 51f5a3fafe..d08eafda2e 100644 --- a/examples/synthetic-points.js +++ b/examples/synthetic-points.js @@ -6,7 +6,7 @@ import Point from '../src/ol/geom/Point.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -27,14 +27,14 @@ var styles = { '10': new Style({ image: new _ol_style_Circle_({ radius: 5, - fill: new _ol_style_Fill_({color: '#666666'}), + fill: new Fill({color: '#666666'}), stroke: new _ol_style_Stroke_({color: '#bada55', width: 1}) }) }), '20': new Style({ image: new _ol_style_Circle_({ radius: 10, - fill: new _ol_style_Fill_({color: '#666666'}), + fill: new Fill({color: '#666666'}), stroke: new _ol_style_Stroke_({color: '#bada55', width: 1}) }) }) diff --git a/examples/topojson.js b/examples/topojson.js index fcc39c7667..0d0dd2d61c 100644 --- a/examples/topojson.js +++ b/examples/topojson.js @@ -5,7 +5,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_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -17,7 +17,7 @@ var raster = new TileLayer({ }); var style = new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), stroke: new _ol_style_Stroke_({ diff --git a/examples/topolis.js b/examples/topolis.js index e018f792cd..a3eb862218 100644 --- a/examples/topolis.js +++ b/examples/topolis.js @@ -15,7 +15,7 @@ import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import Style from '../src/ol/style/Style.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import 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 MousePosition from '../src/ol/control/MousePosition.js'; @@ -31,12 +31,12 @@ var nodesLayer = new VectorLayer({ var style = new Style({ image: new _ol_style_Circle_({ radius: 8, - fill: new _ol_style_Fill_({color: 'rgba(255, 0, 0, 0.2)'}), + fill: new Fill({color: 'rgba(255, 0, 0, 0.2)'}), stroke: new _ol_style_Stroke_({color: 'red', width: 1}) }), text: new _ol_style_Text_({ text: f.get('node').id.toString(), - fill: new _ol_style_Fill_({color: 'red'}), + fill: new Fill({color: 'red'}), stroke: new _ol_style_Stroke_({ color: 'white', width: 3 @@ -58,7 +58,7 @@ var edgesLayer = new VectorLayer({ }), text: new _ol_style_Text_({ text: f.get('edge').id.toString(), - fill: new _ol_style_Fill_({color: 'blue'}), + fill: new Fill({color: 'blue'}), stroke: new _ol_style_Stroke_({ color: 'white', width: 2 @@ -78,13 +78,13 @@ var facesLayer = new VectorLayer({ color: 'black', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0, 255, 0, 0.2)' }), text: new _ol_style_Text_({ font: 'bold 12px sans-serif', text: f.get('face').id.toString(), - fill: new _ol_style_Fill_({color: 'green'}), + fill: new Fill({color: 'green'}), stroke: new _ol_style_Stroke_({ color: 'white', width: 2 diff --git a/examples/vector-esri.js b/examples/vector-esri.js index b7ea164b4e..3f08e040f6 100644 --- a/examples/vector-esri.js +++ b/examples/vector-esri.js @@ -7,7 +7,7 @@ import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js'; import {fromLonLat} from '../src/ol/proj.js'; import VectorSource from '../src/ol/source/Vector.js'; import XYZ from '../src/ol/source/XYZ.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; import _ol_tilegrid_ from '../src/ol/tilegrid.js'; @@ -21,7 +21,7 @@ var esrijsonFormat = new EsriJSON(); var styleCache = { 'ABANDONED': new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(225, 225, 225, 255)' }), stroke: new _ol_style_Stroke_({ @@ -30,7 +30,7 @@ var styleCache = { }) }), 'GAS': new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 0, 0, 255)' }), stroke: new _ol_style_Stroke_({ @@ -39,7 +39,7 @@ var styleCache = { }) }), 'OIL': new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(56, 168, 0, 255)' }), stroke: new _ol_style_Stroke_({ @@ -48,7 +48,7 @@ var styleCache = { }) }), 'OILGAS': new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(168, 112, 0, 255)' }), stroke: new _ol_style_Stroke_({ diff --git a/examples/vector-label-decluttering.js b/examples/vector-label-decluttering.js index 9b65088cb6..3a9b56d401 100644 --- a/examples/vector-label-decluttering.js +++ b/examples/vector-label-decluttering.js @@ -4,7 +4,7 @@ import * as _ol_extent_ from '../src/ol/extent.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_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'; @@ -38,7 +38,7 @@ var labelStyle = new Style({ text: new _ol_style_Text_({ font: '12px Calibri,sans-serif', overflow: true, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#000' }), stroke: new _ol_style_Stroke_({ @@ -48,7 +48,7 @@ var labelStyle = new Style({ }) }); var countryStyle = new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), stroke: new _ol_style_Stroke_({ diff --git a/examples/vector-labels.js b/examples/vector-labels.js index a2ba95e8a9..a9f91f19cd 100644 --- a/examples/vector-labels.js +++ b/examples/vector-labels.js @@ -6,7 +6,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_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'; @@ -114,7 +114,7 @@ var createTextStyle = function(feature, resolution, dom) { textBaseline: baseline, font: font, text: getText(feature, resolution, dom), - fill: new _ol_style_Fill_({color: fillColor}), + fill: new Fill({color: fillColor}), stroke: new _ol_style_Stroke_({color: outlineColor, width: outlineWidth}), offsetX: offsetX, offsetY: offsetY, @@ -133,7 +133,7 @@ function polygonStyleFunction(feature, resolution) { color: 'blue', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0, 0, 255, 0.1)' }), text: createTextStyle(feature, resolution, myDom.polygons) @@ -174,7 +174,7 @@ function pointStyleFunction(feature, resolution) { return new Style({ image: new _ol_style_Circle_({ radius: 10, - fill: new _ol_style_Fill_({color: 'rgba(255, 0, 0, 0.1)'}), + fill: new Fill({color: 'rgba(255, 0, 0, 0.1)'}), stroke: new _ol_style_Stroke_({color: 'red', width: 1}) }), text: createTextStyle(feature, resolution, myDom.points) diff --git a/examples/vector-layer.js b/examples/vector-layer.js index 8f5d7df56d..f7666c3796 100644 --- a/examples/vector-layer.js +++ b/examples/vector-layer.js @@ -3,14 +3,14 @@ import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_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'; var style = new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), stroke: new _ol_style_Stroke_({ @@ -19,7 +19,7 @@ var style = new Style({ }), text: new _ol_style_Text_({ font: '12px Calibri,sans-serif', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#000' }), stroke: new _ol_style_Stroke_({ @@ -54,12 +54,12 @@ var highlightStyle = new Style({ color: '#f00', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255,0,0,0.1)' }), text: new _ol_style_Text_({ font: '12px Calibri,sans-serif', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#000' }), stroke: new _ol_style_Stroke_({ diff --git a/examples/vector-osm.js b/examples/vector-osm.js index 3f1d953415..77425061aa 100644 --- a/examples/vector-osm.js +++ b/examples/vector-osm.js @@ -9,7 +9,7 @@ import {transformExtent} from '../src/ol/proj.js'; import BingMaps from '../src/ol/source/BingMaps.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../src/ol/style/Fill.js'; +import Fill from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -22,7 +22,7 @@ var styles = { color: 'rgba(170, 170, 170, 1.0)', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(170, 170, 170, 0.3)' }) }) @@ -34,7 +34,7 @@ var styles = { color: 'rgba(246, 99, 79, 1.0)', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(246, 99, 79, 0.3)' }) }) @@ -59,7 +59,7 @@ var styles = { color: 'rgba(140, 208, 95, 1.0)', width: 1 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(140, 208, 95, 0.3)' }) }) @@ -68,7 +68,7 @@ var styles = { 'tree': new Style({ image: new _ol_style_Circle_({ radius: 2, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(140, 208, 95, 1.0)' }), stroke: null diff --git a/src/ol/Graticule.js b/src/ol/Graticule.js index 5df54754dd..6498342a20 100644 --- a/src/ol/Graticule.js +++ b/src/ol/Graticule.js @@ -10,7 +10,7 @@ import _ol_geom_flat_geodesic_ from './geom/flat/geodesic.js'; import {clamp} from './math.js'; import {get as getProjection, equivalent as equivalentProjection, getTransform, transformExtent} from './proj.js'; import RenderEventType from './render/EventType.js'; -import _ol_style_Fill_ from './style/Fill.js'; +import Fill from './style/Fill.js'; import _ol_style_Stroke_ from './style/Stroke.js'; import _ol_style_Text_ from './style/Text.js'; @@ -286,7 +286,7 @@ var Graticule = function(opt_options) { new _ol_style_Text_({ font: '12px Calibri,sans-serif', textBaseline: 'bottom', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0,0,0,1)' }), stroke: new _ol_style_Stroke_({ @@ -303,7 +303,7 @@ var Graticule = function(opt_options) { new _ol_style_Text_({ font: '12px Calibri,sans-serif', textAlign: 'end', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0,0,0,1)' }), stroke: new _ol_style_Stroke_({ diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index 394fcb86c3..83eeb36583 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -20,7 +20,7 @@ import Point from '../geom/Point.js'; import Polygon from '../geom/Polygon.js'; import {toRadians} from '../math.js'; import {get as getProjection} from '../proj.js'; -import _ol_style_Fill_ from '../style/Fill.js'; +import Fill from '../style/Fill.js'; import _ol_style_Icon_ from '../style/Icon.js'; import IconAnchorUnits from '../style/IconAnchorUnits.js'; import IconOrigin from '../style/IconOrigin.js'; @@ -145,7 +145,7 @@ KML.createStyleDefaults_ = function() { * @type {ol.style.Fill} * @private */ - KML.DEFAULT_FILL_STYLE_ = new _ol_style_Fill_({ + KML.DEFAULT_FILL_STYLE_ = new Fill({ color: KML.DEFAULT_COLOR_ }); @@ -666,7 +666,7 @@ KML.LabelStyleParser_ = function(node, objectStack) { } var styleObject = objectStack[objectStack.length - 1]; var textStyle = new _ol_style_Text_({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: /** @type {ol.Color} */ ('color' in object ? object['color'] : KML.DEFAULT_COLOR_) }), @@ -716,7 +716,7 @@ KML.PolyStyleParser_ = function(node, objectStack) { return; } var styleObject = objectStack[objectStack.length - 1]; - var fillStyle = new _ol_style_Fill_({ + var fillStyle = new Fill({ color: /** @type {ol.Color} */ ('color' in object ? object['color'] : KML.DEFAULT_COLOR_) }); diff --git a/src/ol/style/Fill.js b/src/ol/style/Fill.js index ebf65facb5..30fa9d7316 100644 --- a/src/ol/style/Fill.js +++ b/src/ol/style/Fill.js @@ -12,7 +12,7 @@ import {asString} from '../color.js'; * @param {olx.style.FillOptions=} opt_options Options. * @api */ -var _ol_style_Fill_ = function(opt_options) { +var Fill = function(opt_options) { var options = opt_options || {}; @@ -35,9 +35,9 @@ var _ol_style_Fill_ = function(opt_options) { * @return {ol.style.Fill} The cloned style. * @api */ -_ol_style_Fill_.prototype.clone = function() { +Fill.prototype.clone = function() { var color = this.getColor(); - return new _ol_style_Fill_({ + return new Fill({ color: (color && color.slice) ? color.slice() : color || undefined }); }; @@ -48,7 +48,7 @@ _ol_style_Fill_.prototype.clone = function() { * @return {ol.Color|ol.ColorLike} Color. * @api */ -_ol_style_Fill_.prototype.getColor = function() { +Fill.prototype.getColor = function() { return this.color_; }; @@ -59,7 +59,7 @@ _ol_style_Fill_.prototype.getColor = function() { * @param {ol.Color|ol.ColorLike} color Color. * @api */ -_ol_style_Fill_.prototype.setColor = function(color) { +Fill.prototype.setColor = function(color) { this.color_ = color; this.checksum_ = undefined; }; @@ -68,7 +68,7 @@ _ol_style_Fill_.prototype.setColor = function(color) { /** * @return {string} The checksum. */ -_ol_style_Fill_.prototype.getChecksum = function() { +Fill.prototype.getChecksum = function() { if (this.checksum_ === undefined) { if ( this.color_ instanceof CanvasPattern || @@ -82,4 +82,4 @@ _ol_style_Fill_.prototype.getChecksum = function() { return this.checksum_; }; -export default _ol_style_Fill_; +export default Fill; diff --git a/src/ol/style/Style.js b/src/ol/style/Style.js index 7185da082f..7fade69cad 100644 --- a/src/ol/style/Style.js +++ b/src/ol/style/Style.js @@ -4,7 +4,7 @@ import {assert} from '../asserts.js'; import GeometryType from '../geom/GeometryType.js'; import _ol_style_Circle_ from '../style/Circle.js'; -import _ol_style_Fill_ from '../style/Fill.js'; +import Fill from '../style/Fill.js'; import _ol_style_Stroke_ from '../style/Stroke.js'; /** @@ -322,7 +322,7 @@ Style.defaultFunction = function(feature, resolution) { // canvas.getContext('2d') at construction time, which will cause an.error // in such browsers.) if (!Style.default_) { - var fill = new _ol_style_Fill_({ + var fill = new Fill({ color: 'rgba(255,255,255,0.4)' }); var stroke = new _ol_style_Stroke_({ @@ -357,7 +357,7 @@ Style.createDefaultEditing = function() { var width = 3; styles[GeometryType.POLYGON] = [ new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: [255, 255, 255, 0.5] }) }) @@ -392,7 +392,7 @@ Style.createDefaultEditing = function() { new Style({ image: new _ol_style_Circle_({ radius: width * 2, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: blue }), stroke: new _ol_style_Stroke_({ diff --git a/src/ol/style/Text.js b/src/ol/style/Text.js index 279cece8ea..2f8c8ebfbe 100644 --- a/src/ol/style/Text.js +++ b/src/ol/style/Text.js @@ -1,7 +1,7 @@ /** * @module ol/style/Text */ -import _ol_style_Fill_ from '../style/Fill.js'; +import Fill from '../style/Fill.js'; import TextPlacement from '../style/TextPlacement.js'; /** @@ -63,7 +63,7 @@ var _ol_style_Text_ = function(opt_options) { * @type {ol.style.Fill} */ this.fill_ = options.fill !== undefined ? options.fill : - new _ol_style_Fill_({color: _ol_style_Text_.DEFAULT_FILL_COLOR_}); + new Fill({color: _ol_style_Text_.DEFAULT_FILL_COLOR_}); /** * @private diff --git a/test/rendering/ol/layer/tile.test.js b/test/rendering/ol/layer/tile.test.js index 36ad343f77..1690ab2e7c 100644 --- a/test/rendering/ol/layer/tile.test.js +++ b/test/rendering/ol/layer/tile.test.js @@ -8,7 +8,7 @@ import {transform} from '../../../../src/ol/proj.js'; import TileImage from '../../../../src/ol/source/TileImage.js'; import XYZ from '../../../../src/ol/source/XYZ.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; +import Fill from '../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -281,7 +281,7 @@ describe('ol.rendering.layer.Tile', function() { e.vectorContext.setImageStyle(new _ol_style_Circle_({ radius: 5, snapToPixel: false, - fill: new _ol_style_Fill_({color: 'yellow'}), + fill: new Fill({color: 'yellow'}), stroke: new _ol_style_Stroke_({color: 'red', width: 1}) })); e.vectorContext.drawPoint(new Point( diff --git a/test/rendering/ol/layer/vector.test.js b/test/rendering/ol/layer/vector.test.js index 3c5026091e..215843f88b 100644 --- a/test/rendering/ol/layer/vector.test.js +++ b/test/rendering/ol/layer/vector.test.js @@ -9,7 +9,7 @@ import Polygon from '../../../../src/ol/geom/Polygon.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; +import Fill from '../../../../src/ol/style/Fill.js'; import _ol_style_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'; @@ -255,7 +255,7 @@ describe('ol.rendering.layer.Vector', function() { renderMode: 'image', source: source, style: new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(255,0,0,0.5)' }), stroke: new _ol_style_Stroke_({ @@ -355,7 +355,7 @@ describe('ol.rendering.layer.Vector', function() { color: alternateColor(), width: 1.25 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: alternateColor() }) }); @@ -406,7 +406,7 @@ describe('ol.rendering.layer.Vector', function() { color: alternateColor(), width: 1.25 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: alternateColor() }) }); @@ -471,7 +471,7 @@ describe('ol.rendering.layer.Vector', function() { features: [feature] }), style: new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'blue' }) }) @@ -539,7 +539,7 @@ describe('ol.rendering.layer.Vector', function() { color: [0, 0, 0, 1], width: 2 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: [255, 0, 0, 1] }) })); @@ -551,7 +551,7 @@ describe('ol.rendering.layer.Vector', function() { it('renders partially out-of-view polygons with a fill', function(done) { layer.setStyle(new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: [0, 0, 0, 1] }) })); diff --git a/test/rendering/ol/layer/vectortile.test.js b/test/rendering/ol/layer/vectortile.test.js index fbd5cac5f6..d849d9a4c0 100644 --- a/test/rendering/ol/layer/vectortile.test.js +++ b/test/rendering/ol/layer/vectortile.test.js @@ -9,7 +9,7 @@ import _ol_obj_ from '../../../../src/ol/obj.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; +import 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 _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -107,7 +107,7 @@ describe('ol.rendering.layer.VectorTile', function() { style: new Style({ image: new _ol_style_Circle_({ radius: 10, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'red' }) }) @@ -146,7 +146,7 @@ describe('ol.rendering.layer.VectorTile', function() { return new Style({ image: new _ol_style_Circle_({ radius: 7, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'red' }) }), diff --git a/test/rendering/ol/render.test.js b/test/rendering/ol/render.test.js index 7063712b70..60c6ed44b5 100644 --- a/test/rendering/ol/render.test.js +++ b/test/rendering/ol/render.test.js @@ -5,7 +5,7 @@ import _ol_render_ from '../../../src/ol/render.js'; import VectorContext from '../../../src/ol/render/VectorContext.js'; import CanvasImmediateRenderer from '../../../src/ol/render/canvas/Immediate.js'; import _ol_style_Circle_ from '../../../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../../../src/ol/style/Fill.js'; +import Fill from '../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../src/ol/style/Stroke.js'; import Style from '../../../src/ol/style/Style.js'; @@ -35,7 +35,7 @@ describe('ol.render', function() { var style = new Style({ image: new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'green' }), radius: 10 @@ -136,7 +136,7 @@ describe('ol.render', function() { color: 'blue', width: 8 }), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0,0,255,0.5)' }) }); diff --git a/test/rendering/ol/style/circle.test.js b/test/rendering/ol/style/circle.test.js index 02452dd9a2..d673afe6e3 100644 --- a/test/rendering/ol/style/circle.test.js +++ b/test/rendering/ol/style/circle.test.js @@ -6,7 +6,7 @@ import View from '../../../../src/ol/View.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; +import Fill from '../../../../src/ol/style/Fill.js'; import Style from '../../../../src/ol/style/Style.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -51,7 +51,7 @@ describe('ol.rendering.style.Circle', function() { feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 2, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#91E339' }) }) @@ -64,7 +64,7 @@ describe('ol.rendering.style.Circle', function() { feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 4, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#5447E6' }) }) @@ -77,7 +77,7 @@ describe('ol.rendering.style.Circle', function() { feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 6, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#92A8A6' }) }) @@ -90,7 +90,7 @@ describe('ol.rendering.style.Circle', function() { feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 2, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#91E339' }), stroke: new _ol_style_Stroke_({ @@ -107,7 +107,7 @@ describe('ol.rendering.style.Circle', function() { feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 4, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#5447E6' }), stroke: new _ol_style_Stroke_({ @@ -124,7 +124,7 @@ describe('ol.rendering.style.Circle', function() { feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 6, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#92A8A6' }), stroke: new _ol_style_Stroke_({ @@ -155,7 +155,7 @@ describe('ol.rendering.style.Circle', function() { feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 4, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(0, 0, 255, 0.3)' }), stroke: new _ol_style_Stroke_({ @@ -172,7 +172,7 @@ describe('ol.rendering.style.Circle', function() { feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 6, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(235, 45, 70, 0.6)' }), stroke: new _ol_style_Stroke_({ diff --git a/test/rendering/ol/style/polygon.test.js b/test/rendering/ol/style/polygon.test.js index 414656e722..907b33dcac 100644 --- a/test/rendering/ol/style/polygon.test.js +++ b/test/rendering/ol/style/polygon.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_Fill_ from '../../../../src/ol/style/Fill.js'; +import Fill from '../../../../src/ol/style/Fill.js'; import Style from '../../../../src/ol/style/Style.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -44,7 +44,7 @@ describe('ol.rendering.style.Polygon', function() { describe('different types', function() { function createFeatures() { - var fill = new _ol_style_Fill_({color: 'red'}); + var fill = new Fill({color: 'red'}); var feature; // rectangle @@ -179,7 +179,7 @@ describe('ol.rendering.style.Polygon', function() { ]) }); feature.setStyle(new Style({ - fill: new _ol_style_Fill_({color: '#E31E10'}), + fill: new Fill({color: '#E31E10'}), zIndex: 2 })); vectorSource.addFeature(feature); @@ -191,7 +191,7 @@ describe('ol.rendering.style.Polygon', function() { ]) }); feature.setStyle(new Style({ - fill: new _ol_style_Fill_({color: '#1A5E42'}), + fill: new Fill({color: '#1A5E42'}), zIndex: 3 })); vectorSource.addFeature(feature); @@ -203,7 +203,7 @@ describe('ol.rendering.style.Polygon', function() { ]) }); feature.setStyle(new Style({ - fill: new _ol_style_Fill_({color: '#DEDE21'}), + fill: new Fill({color: '#DEDE21'}), zIndex: 1 })); vectorSource.addFeature(feature); @@ -236,7 +236,7 @@ describe('ol.rendering.style.Polygon', function() { ]) }); feature.setStyle(new Style({ - fill: new _ol_style_Fill_({color: '#9696EB'}), + fill: new Fill({color: '#9696EB'}), stroke: new _ol_style_Stroke_({color: '#9696EB', width: 1}) })); vectorSource.addFeature(feature); @@ -248,7 +248,7 @@ describe('ol.rendering.style.Polygon', function() { ]) }); feature.setStyle(new Style({ - fill: new _ol_style_Fill_({color: 'rgba(255, 0, 0, 0.1)'}), + fill: new Fill({color: 'rgba(255, 0, 0, 0.1)'}), stroke: new _ol_style_Stroke_({color: '#DE213A', width: 3}) })); vectorSource.addFeature(feature); @@ -260,7 +260,7 @@ describe('ol.rendering.style.Polygon', function() { ]) }); feature.setStyle(new Style({ - fill: new _ol_style_Fill_({color: 'rgba(18, 204, 105, 0.3)'}), + fill: new Fill({color: 'rgba(18, 204, 105, 0.3)'}), stroke: new _ol_style_Stroke_({color: '#032E17', width: 2}) })); vectorSource.addFeature(feature); @@ -322,7 +322,7 @@ describe('ol.rendering.style.Polygon', function() { ]) }); feature.setStyle(new Style({ - fill: new _ol_style_Fill_({color: createPattern()}), + fill: new Fill({color: createPattern()}), stroke: new _ol_style_Stroke_({color: createRainbowGradient(), width: 3}) })); vectorSource.addFeature(feature); diff --git a/test/rendering/ol/style/regularshape.test.js b/test/rendering/ol/style/regularshape.test.js index 26e8685e02..fe1e2336e5 100644 --- a/test/rendering/ol/style/regularshape.test.js +++ b/test/rendering/ol/style/regularshape.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_Fill_ from '../../../../src/ol/style/Fill.js'; +import Fill from '../../../../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../../../../src/ol/style/RegularShape.js'; import Style from '../../../../src/ol/style/Style.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -109,7 +109,7 @@ describe('ol.rendering.style.RegularShape', function() { describe('#render', function() { var stroke = new _ol_style_Stroke_({width: 2}); - var fill = new _ol_style_Fill_({color: 'red'}); + var fill = new Fill({color: 'red'}); it('tests the canvas renderer', function(done) { createMap('canvas'); @@ -144,7 +144,7 @@ describe('ol.rendering.style.RegularShape', function() { describe('uses the default fill and stroke color', function() { var stroke = new _ol_style_Stroke_(); - var fill = new _ol_style_Fill_(); + var fill = new Fill(); it('tests the canvas renderer', function(done) { createMap('canvas'); diff --git a/test/rendering/ol/style/text.test.js b/test/rendering/ol/style/text.test.js index 9474aa4047..04f0d6a9ce 100644 --- a/test/rendering/ol/style/text.test.js +++ b/test/rendering/ol/style/text.test.js @@ -9,7 +9,7 @@ import View from '../../../../src/ol/View.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; -import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; +import Fill from '../../../../src/ol/style/Fill.js'; import Style from '../../../../src/ol/style/Style.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -68,7 +68,7 @@ describe('ol.rendering.style.Text', function() { text: new _ol_style_Text_({ scale: scale, text: 'hello', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'red', font: '12px sans-serif' }), @@ -333,17 +333,17 @@ describe('ol.rendering.style.Text', function() { createMap('canvas'); createFeatures(); var features = vectorSource.getFeatures(); - features[0].getStyle().getText().setBackgroundFill(new _ol_style_Fill_({ + features[0].getStyle().getText().setBackgroundFill(new Fill({ color: 'red' })); - features[1].getStyle().getText().setBackgroundFill(new _ol_style_Fill_({ + features[1].getStyle().getText().setBackgroundFill(new Fill({ color: 'red' })); features[1].getStyle().getText().setBackgroundStroke(new _ol_style_Stroke_({ color: 'blue', width: 3 })); - features[2].getStyle().getText().setBackgroundFill(new _ol_style_Fill_({ + features[2].getStyle().getText().setBackgroundFill(new Fill({ color: 'red' })); features[2].getStyle().getText().setBackgroundStroke(new _ol_style_Stroke_({ diff --git a/test/spec/ol/format/kml.test.js b/test/spec/ol/format/kml.test.js index 2c5172b428..9c90f430cd 100644 --- a/test/spec/ol/format/kml.test.js +++ b/test/spec/ol/format/kml.test.js @@ -14,7 +14,7 @@ import {addProjection, addCoordinateTransforms, transform, get as getProjection} 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 _ol_style_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 IconAnchorUnits from '../../../../src/ol/style/IconAnchorUnits.js'; import IconOrigin from '../../../../src/ol/style/IconOrigin.js'; @@ -1947,7 +1947,7 @@ describe('ol.format.KML', function() { expect(textStyle).to.be.an(_ol_style_Text_); expect(textStyle.getScale()).to.be(0.25); var textFillStyle = textStyle.getFill(); - expect(textFillStyle).to.be.an(_ol_style_Fill_); + expect(textFillStyle).to.be.an(Fill); expect(textFillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(style.getZIndex()).to.be(undefined); }); @@ -2008,7 +2008,7 @@ describe('ol.format.KML', function() { var style = styleArray[0]; expect(style).to.be.an(Style); var fillStyle = style.getFill(); - expect(fillStyle).to.be.an(_ol_style_Fill_); + expect(fillStyle).to.be.an(Fill); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); @@ -2045,7 +2045,7 @@ describe('ol.format.KML', function() { var style = styleArray[0]; expect(style).to.be.an(Style); var fillStyle = style.getFill(); - expect(fillStyle).to.be.an(_ol_style_Fill_); + expect(fillStyle).to.be.an(Fill); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); var strokeStyle = style.getStroke(); @@ -2121,7 +2121,7 @@ describe('ol.format.KML', function() { var style = styleArray[0]; expect(style).to.be.an(Style); var fillStyle = style.getFill(); - expect(fillStyle).to.be.an(_ol_style_Fill_); + expect(fillStyle).to.be.an(Fill); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); expect(style.getStroke()).to.be(null); @@ -2337,7 +2337,7 @@ describe('ol.format.KML', function() { var style = new Style({ image: new _ol_style_Circle_({ radius: 4, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgb(12, 34, 223)' }) }) @@ -2364,7 +2364,7 @@ describe('ol.format.KML', function() { text: new _ol_style_Text_({ scale: 0.5, text: 'foo', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgb(12, 34, 223)' }) }) @@ -2421,7 +2421,7 @@ describe('ol.format.KML', function() { it('can write an feature\'s fill style', function() { var style = new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(12, 34, 223, 0.7)' }) }); @@ -2447,7 +2447,7 @@ describe('ol.format.KML', function() { it('can write multiple features with Style', function() { var style = new Style({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: 'rgba(12, 34, 223, 0.7)' }) }); @@ -2724,7 +2724,7 @@ describe('ol.format.KML', function() { var style = styleArray[0]; expect(style).to.be.an(Style); var fillStyle = style.getFill(); - expect(fillStyle).to.be.an(_ol_style_Fill_); + expect(fillStyle).to.be.an(Fill); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); }); @@ -2756,7 +2756,7 @@ describe('ol.format.KML', function() { var style = styleArray[0]; expect(style).to.be.an(Style); var fillStyle = style.getFill(); - expect(fillStyle).to.be.an(_ol_style_Fill_); + expect(fillStyle).to.be.an(Fill); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); }); diff --git a/test/spec/ol/render/canvas/immediate.test.js b/test/spec/ol/render/canvas/immediate.test.js index d5a7c14e8d..982eafd2fc 100644 --- a/test/spec/ol/render/canvas/immediate.test.js +++ b/test/spec/ol/render/canvas/immediate.test.js @@ -9,7 +9,7 @@ import Polygon from '../../../../../src/ol/geom/Polygon.js'; import VectorContext from '../../../../../src/ol/render/VectorContext.js'; import CanvasImmediateRenderer from '../../../../../src/ol/render/canvas/Immediate.js'; import _ol_style_Circle_ from '../../../../../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../../../../../src/ol/style/Fill.js'; +import Fill from '../../../../../src/ol/style/Fill.js'; import _ol_style_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'; @@ -42,7 +42,7 @@ describe('ol.render.canvas.Immediate', function() { sinon.spy(context, 'setFillStrokeStyle'); sinon.spy(context, 'setImageStyle'); sinon.spy(context, 'setTextStyle'); - var fill = new _ol_style_Fill_({}); + var fill = new Fill({}); var stroke = new _ol_style_Stroke_({}); var text = new _ol_style_Text_({}); var image = new _ol_style_Circle_({}); diff --git a/test/spec/ol/render/webgl/circlereplay.test.js b/test/spec/ol/render/webgl/circlereplay.test.js index 96463a08d8..48875635ea 100644 --- a/test/spec/ol/render/webgl/circlereplay.test.js +++ b/test/spec/ol/render/webgl/circlereplay.test.js @@ -4,7 +4,7 @@ import Circle from '../../../../../src/ol/geom/Circle.js'; import _ol_render_webgl_CircleReplay_ from '../../../../../src/ol/render/webgl/CircleReplay.js'; import _ol_render_webgl_circlereplay_defaultshader_ from '../../../../../src/ol/render/webgl/circlereplay/defaultshader.js'; import _ol_render_webgl_circlereplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/circlereplay/defaultshader/Locations.js'; -import _ol_style_Fill_ from '../../../../../src/ol/style/Fill.js'; +import Fill from '../../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; describe('ol.render.webgl.CircleReplay', function() { @@ -14,7 +14,7 @@ describe('ol.render.webgl.CircleReplay', function() { color: [0, 255, 0, 0.4] }); - var fillStyle = new _ol_style_Fill_({ + var fillStyle = new Fill({ color: [255, 0, 0, 1] }); diff --git a/test/spec/ol/render/webgl/immediate.test.js b/test/spec/ol/render/webgl/immediate.test.js index 5f37920c60..2f43240ab6 100644 --- a/test/spec/ol/render/webgl/immediate.test.js +++ b/test/spec/ol/render/webgl/immediate.test.js @@ -13,7 +13,7 @@ import _ol_render_webgl_Immediate_ from '../../../../../src/ol/render/webgl/Imme import _ol_render_webgl_LineStringReplay_ from '../../../../../src/ol/render/webgl/LineStringReplay.js'; import _ol_render_webgl_PolygonReplay_ from '../../../../../src/ol/render/webgl/PolygonReplay.js'; import _ol_style_Circle_ from '../../../../../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../../../../../src/ol/style/Fill.js'; +import Fill from '../../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; import Style from '../../../../../src/ol/style/Style.js'; @@ -23,7 +23,7 @@ describe('ol.render.webgl.Immediate', function() { context = new _ol_render_webgl_Immediate_({}, [0, 0], 0, 0, [0, 0], [-180, -90, 180, 90], 1); style = new Style({ image: new _ol_style_Circle_(), - fill: new _ol_style_Fill_(), + fill: new Fill(), stroke: new _ol_style_Stroke_() }); circle = new Circle([0, 0], 5); diff --git a/test/spec/ol/render/webgl/polygonreplay.test.js b/test/spec/ol/render/webgl/polygonreplay.test.js index d7fe75e5e9..545ccd52c1 100644 --- a/test/spec/ol/render/webgl/polygonreplay.test.js +++ b/test/spec/ol/render/webgl/polygonreplay.test.js @@ -7,13 +7,13 @@ import _ol_render_webgl_polygonreplay_defaultshader_ from '../../../../../src/ol import _ol_render_webgl_polygonreplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader/Locations.js'; import LinkedList from '../../../../../src/ol/structs/LinkedList.js'; import RBush from '../../../../../src/ol/structs/RBush.js'; -import _ol_style_Fill_ from '../../../../../src/ol/style/Fill.js'; +import Fill from '../../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; describe('ol.render.webgl.PolygonReplay', function() { var replay; - var fillStyle = new _ol_style_Fill_({ + var fillStyle = new Fill({ color: [0, 0, 255, 0.5] }); var strokeStyle = new _ol_style_Stroke_({ @@ -435,7 +435,7 @@ describe('ol.render.webgl.PolygonReplay', function() { }); it('draws the elements in batches if there are multiple fill styles', function() { - var fillStyle2 = new _ol_style_Fill_({ + var fillStyle2 = new Fill({ color: [0, 255, 0, 1] }); replay.setFillStrokeStyle(fillStyle, strokeStyle); diff --git a/test/spec/ol/render/webgl/textreplay.test.js b/test/spec/ol/render/webgl/textreplay.test.js index 11e7ab056b..6f5a5274ad 100644 --- a/test/spec/ol/render/webgl/textreplay.test.js +++ b/test/spec/ol/render/webgl/textreplay.test.js @@ -1,7 +1,7 @@ import {createCanvasContext2D} from '../../../../../src/ol/dom.js'; import Point from '../../../../../src/ol/geom/Point.js'; import _ol_render_webgl_TextReplay_ from '../../../../../src/ol/render/webgl/TextReplay.js'; -import _ol_style_Fill_ from '../../../../../src/ol/style/Fill.js'; +import Fill from '../../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; import _ol_style_Text_ from '../../../../../src/ol/style/Text.js'; @@ -37,7 +37,7 @@ describe('ol.render.webgl.TextReplay', function() { beforeEach(function() { textStyle1 = createTextStyle( - new _ol_style_Fill_({ + new Fill({ color: [0, 0, 0, 1] }), new _ol_style_Stroke_({ @@ -51,7 +51,7 @@ describe('ol.render.webgl.TextReplay', function() { }), 'someText'); textStyle2 = createTextStyle( - new _ol_style_Fill_({ + new Fill({ color: [255, 255, 255, 1] }), new _ol_style_Stroke_({ @@ -62,7 +62,7 @@ describe('ol.render.webgl.TextReplay', function() { ); textStyle3 = createTextStyle(null, null, 'someText'); textStyle4 = createTextStyle( - new _ol_style_Fill_({ + new Fill({ color: [0, 0, 0, 1] }), new _ol_style_Stroke_({ @@ -115,7 +115,7 @@ describe('ol.render.webgl.TextReplay', function() { describe('#drawText', function() { beforeEach(function() { var textStyle = createTextStyle( - new _ol_style_Fill_({ + new Fill({ color: [0, 0, 0, 1] }), null, 'someText'); @@ -171,7 +171,7 @@ describe('ol.render.webgl.TextReplay', function() { describe('#addCharToAtlas_', function() { beforeEach(function() { var textStyle = createTextStyle( - new _ol_style_Fill_({ + new Fill({ color: [0, 0, 0, 1] }), null, 'someText'); @@ -209,7 +209,7 @@ describe('ol.render.webgl.TextReplay', function() { describe('#getTextSize_', function() { beforeEach(function() { var textStyle = createTextStyle( - new _ol_style_Fill_({ + new Fill({ color: [0, 0, 0, 1] }), null, 'someText'); @@ -261,7 +261,7 @@ describe('ol.render.webgl.TextReplay', function() { describe('#getAtlas_', function() { beforeEach(function() { var textStyle = createTextStyle( - new _ol_style_Fill_({ + new Fill({ color: [0, 0, 0, 1] }), null, 'someText'); diff --git a/test/spec/ol/renderer/canvas/replay.test.js b/test/spec/ol/renderer/canvas/replay.test.js index d9807079a3..51f5ac65eb 100644 --- a/test/spec/ol/renderer/canvas/replay.test.js +++ b/test/spec/ol/renderer/canvas/replay.test.js @@ -12,7 +12,7 @@ import _ol_render_canvas_PolygonReplay_ from '../../../../../src/ol/render/canva import _ol_render_canvas_Replay_ from '../../../../../src/ol/render/canvas/Replay.js'; import _ol_render_canvas_ReplayGroup_ from '../../../../../src/ol/render/canvas/ReplayGroup.js'; import _ol_renderer_vector_ from '../../../../../src/ol/renderer/vector.js'; -import _ol_style_Fill_ from '../../../../../src/ol/style/Fill.js'; +import Fill from '../../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; import Style from '../../../../../src/ol/style/Style.js'; import _ol_transform_ from '../../../../../src/ol/transform.js'; @@ -38,17 +38,17 @@ describe('ol.render.canvas.ReplayGroup', function() { feature3 = new Feature(new Polygon( [[[-90, -45], [-90, 45], [90, 45], [90, -45], [-90, -45]]])); fill0 = new Style({ - fill: new _ol_style_Fill_({color: 'black'}) + fill: new Fill({color: 'black'}) }); fill1 = new Style({ - fill: new _ol_style_Fill_({color: 'red'}) + fill: new Fill({color: 'red'}) }); style1 = new Style({ - fill: new _ol_style_Fill_({color: 'black'}), + fill: new Fill({color: 'black'}), stroke: new _ol_style_Stroke_({color: 'white', width: 1}) }); style2 = new Style({ - fill: new _ol_style_Fill_({color: 'white'}), + fill: new Fill({color: 'white'}), stroke: new _ol_style_Stroke_({color: 'black', width: 1, lineDash: [3, 6], lineDashOffset: 2}) }); diff --git a/test/spec/ol/renderer/vector.test.js b/test/spec/ol/renderer/vector.test.js index 5e1808a18e..62f86af42d 100644 --- a/test/spec/ol/renderer/vector.test.js +++ b/test/spec/ol/renderer/vector.test.js @@ -8,7 +8,7 @@ import MultiPoint from '../../../../src/ol/geom/MultiPoint.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; import _ol_render_canvas_ReplayGroup_ from '../../../../src/ol/render/canvas/ReplayGroup.js'; import _ol_renderer_vector_ from '../../../../src/ol/renderer/vector.js'; -import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; +import Fill from '../../../../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; import Style from '../../../../src/ol/style/Style.js'; @@ -29,7 +29,7 @@ describe('ol.renderer.vector', function() { }); style = new Style({ image: iconStyle, - fill: new _ol_style_Fill_({}), + fill: new Fill({}), stroke: new _ol_style_Stroke_({}) }); squaredTolerance = 1; diff --git a/test/spec/ol/style/circle.test.js b/test/spec/ol/style/circle.test.js index 657d08fc97..f1f8c834b3 100644 --- a/test/spec/ol/style/circle.test.js +++ b/test/spec/ol/style/circle.test.js @@ -1,6 +1,6 @@ import AtlasManager from '../../../../src/ol/style/AtlasManager.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; -import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; +import Fill from '../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -24,7 +24,7 @@ describe('ol.style.Circle', function() { it('creates a canvas if no atlas is used (fill-style)', function() { var style = new _ol_style_Circle_({ radius: 10, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#FFFF00' }) }); @@ -58,7 +58,7 @@ describe('ol.style.Circle', function() { var style = new _ol_style_Circle_({ radius: 10, atlasManager: atlasManager, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#FFFF00' }) }); @@ -85,7 +85,7 @@ describe('ol.style.Circle', function() { it('copies all values', function() { var original = new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -107,7 +107,7 @@ describe('ol.style.Circle', function() { it('the clone does not reference the same objects as the original', function() { var original = new _ol_style_Circle_({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -155,7 +155,7 @@ describe('ol.style.Circle', function() { it('calculates not the same hash code (color)', function() { var style1 = new _ol_style_Circle_({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }) }); @@ -171,7 +171,7 @@ describe('ol.style.Circle', function() { it('calculates the same hash code (everything set)', function() { var style1 = new _ol_style_Circle_({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -185,7 +185,7 @@ describe('ol.style.Circle', function() { }); var style2 = new _ol_style_Circle_({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -203,7 +203,7 @@ describe('ol.style.Circle', function() { it('calculates not the same hash code (stroke width differs)', function() { var style1 = new _ol_style_Circle_({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -217,7 +217,7 @@ describe('ol.style.Circle', function() { }); var style2 = new _ol_style_Circle_({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -235,7 +235,7 @@ describe('ol.style.Circle', function() { it('invalidates a cached checksum if values change (fill)', function() { var style1 = new _ol_style_Circle_({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -244,7 +244,7 @@ describe('ol.style.Circle', function() { }); var style2 = new _ol_style_Circle_({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -260,7 +260,7 @@ describe('ol.style.Circle', function() { it('invalidates a cached checksum if values change (stroke)', function() { var style1 = new _ol_style_Circle_({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -269,7 +269,7 @@ describe('ol.style.Circle', function() { }); var style2 = new _ol_style_Circle_({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -288,7 +288,7 @@ describe('ol.style.Circle', function() { it('changes the circle radius', function() { var style = new _ol_style_Circle_({ radius: 10, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#FFFF00' }) }); diff --git a/test/spec/ol/style/fill.test.js b/test/spec/ol/style/fill.test.js index cf5b151eda..449085fe9b 100644 --- a/test/spec/ol/style/fill.test.js +++ b/test/spec/ol/style/fill.test.js @@ -1,18 +1,18 @@ -import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; +import Fill from '../../../../src/ol/style/Fill.js'; describe('ol.style.Fill', function() { describe('#clone', function() { it('creates a new ol.style.Fill', function() { - var original = new _ol_style_Fill_(); + var original = new Fill(); var clone = original.clone(); - expect(clone).to.be.an(_ol_style_Fill_); + expect(clone).to.be.an(Fill); expect(clone).to.not.be(original); }); it('copies all values', function() { - var original = new _ol_style_Fill_({ + var original = new Fill({ color: '#319FD3' }); var clone = original.clone(); @@ -20,7 +20,7 @@ describe('ol.style.Fill', function() { }); it('the clone does not reference the same objects as the original', function() { - var original = new _ol_style_Fill_({ + var original = new Fill({ color: [63, 255, 127, 0.7] }); var clone = original.clone(); diff --git a/test/spec/ol/style/regularshape.test.js b/test/spec/ol/style/regularshape.test.js index faf7a02de0..7d2c90e3ae 100644 --- a/test/spec/ol/style/regularshape.test.js +++ b/test/spec/ol/style/regularshape.test.js @@ -1,6 +1,6 @@ import AtlasManager from '../../../../src/ol/style/AtlasManager.js'; import _ol_style_RegularShape_ from '../../../../src/ol/style/RegularShape.js'; -import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; +import Fill from '../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; @@ -50,7 +50,7 @@ describe('ol.style.RegularShape', function() { it('creates a canvas if no atlas is used (fill-style)', function() { var style = new _ol_style_RegularShape_({ radius: 10, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#FFFF00' }) }); @@ -85,7 +85,7 @@ describe('ol.style.RegularShape', function() { var style = new _ol_style_RegularShape_({ radius: 10, atlasManager: atlasManager, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#FFFF00' }) }); @@ -114,7 +114,7 @@ describe('ol.style.RegularShape', function() { it('copies all values', function() { var original = new _ol_style_RegularShape_({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), points: 5, @@ -146,7 +146,7 @@ describe('ol.style.RegularShape', function() { it('the clone does not reference the same objects as the original', function() { var original = new _ol_style_RegularShape_({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -204,7 +204,7 @@ describe('ol.style.RegularShape', function() { it('calculates not the same hash code (color)', function() { var style1 = new _ol_style_RegularShape_({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }) }); @@ -223,7 +223,7 @@ describe('ol.style.RegularShape', function() { radius2: 3, angle: 1.41, points: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -240,7 +240,7 @@ describe('ol.style.RegularShape', function() { radius2: 3, angle: 1.41, points: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -261,7 +261,7 @@ describe('ol.style.RegularShape', function() { radius2: 3, angle: 1.41, points: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -278,7 +278,7 @@ describe('ol.style.RegularShape', function() { radius2: 3, angle: 1.41, points: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -296,7 +296,7 @@ describe('ol.style.RegularShape', function() { it('invalidates a cached checksum if values change (fill)', function() { var style1 = new _ol_style_RegularShape_({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -305,7 +305,7 @@ describe('ol.style.RegularShape', function() { }); var style2 = new _ol_style_RegularShape_({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -321,7 +321,7 @@ describe('ol.style.RegularShape', function() { it('invalidates a cached checksum if values change (stroke)', function() { var style1 = new _ol_style_RegularShape_({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ @@ -330,7 +330,7 @@ describe('ol.style.RegularShape', function() { }); var style2 = new _ol_style_RegularShape_({ radius: 5, - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ diff --git a/test/spec/ol/style/style.test.js b/test/spec/ol/style/style.test.js index 48ab73f405..7eca154061 100644 --- a/test/spec/ol/style/style.test.js +++ b/test/spec/ol/style/style.test.js @@ -1,7 +1,7 @@ import Feature from '../../../../src/ol/Feature.js'; import Point from '../../../../src/ol/geom/Point.js'; import Style from '../../../../src/ol/style/Style.js'; -import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; +import Fill from '../../../../src/ol/style/Fill.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; @@ -9,7 +9,7 @@ import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; describe('ol.style.Style', function() { - var testFill = new _ol_style_Fill_({ + var testFill = new Fill({ color: 'rgba(255, 255, 255, 0.6)' }); @@ -20,7 +20,7 @@ describe('ol.style.Style', function() { var testText = new _ol_style_Text_({ font: '12px Calibri,sans-serif', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#000' }), stroke: new _ol_style_Stroke_({ @@ -45,7 +45,7 @@ describe('ol.style.Style', function() { it('copies all values', function() { var original = new Style({ geometry: new Point([0, 0, 0]), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), image: new _ol_style_Circle_({ @@ -71,7 +71,7 @@ describe('ol.style.Style', function() { it('the clone does not reference the same objects as the original', function() { var original = new Style({ geometry: new Point([0, 0, 0]), - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), image: new _ol_style_Circle_({ diff --git a/test/spec/ol/style/text.test.js b/test/spec/ol/style/text.test.js index e3ae66d68d..5baa6d6085 100644 --- a/test/spec/ol/style/text.test.js +++ b/test/spec/ol/style/text.test.js @@ -1,4 +1,4 @@ -import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; +import Fill from '../../../../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; @@ -14,7 +14,7 @@ describe('ol.style.Text', function() { it('uses a provided fill style if one passed', function() { var style = new _ol_style_Text_({ - fill: new _ol_style_Fill_({color: '#123456'}) + fill: new Fill({color: '#123456'}) }); expect(style.getFill().getColor()).to.be('#123456'); }); @@ -47,13 +47,13 @@ describe('ol.style.Text', function() { text: 'test', textAlign: 'center', textBaseline: 'top', - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ color: '#319FD3' }), - backgroundFill: new _ol_style_Fill_({ + backgroundFill: new Fill({ color: 'white' }), backgroundStroke: new _ol_style_Stroke_({ @@ -78,7 +78,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_({ - fill: new _ol_style_Fill_({ + fill: new Fill({ color: '#319FD3' }), stroke: new _ol_style_Stroke_({ From f4484455aac3cfecd1bbbdb33ec1ff95e313f33f Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 13:24:13 -0700 Subject: [PATCH 26/35] Rename _ol_style_Stroke_ to Stroke --- examples/blend-modes.js | 8 +-- examples/canvas-gradient-pattern.js | 4 +- examples/center.js | 6 +- examples/cluster.js | 4 +- examples/custom-interactions.js | 4 +- examples/drag-and-drop-image-vector.js | 14 ++--- examples/drag-and-drop.js | 14 ++--- examples/draw-and-modify-features.js | 4 +- examples/dynamic-data.js | 4 +- examples/earthquake-clusters.js | 6 +- examples/earthquake-custom-symbol.js | 4 +- examples/feature-animation.js | 4 +- examples/feature-move-animation.js | 6 +- examples/flight-animation.js | 4 +- examples/geojson.js | 18 +++--- examples/geolocation.js | 4 +- examples/gpx.js | 8 +-- examples/graticule.js | 4 +- examples/hit-tolerance.js | 4 +- examples/igc.js | 6 +- examples/image-vector-layer.js | 6 +- examples/kml-earthquakes.js | 4 +- examples/kml-timezones.js | 4 +- examples/layer-z-index.js | 4 +- examples/line-arrows.js | 4 +- examples/mapbox-vector-tiles-advanced.js | 4 +- examples/mapbox-vector-tiles.js | 4 +- examples/measure.js | 8 +-- examples/modify-test.js | 22 +++---- examples/osm-vector-tiles.js | 6 +- examples/polygon-styles.js | 4 +- examples/regularshape.js | 4 +- examples/render-geometry.js | 4 +- examples/snap.js | 4 +- examples/symbol-atlas-webgl.js | 6 +- examples/synthetic-lines.js | 4 +- examples/synthetic-points.js | 8 +-- examples/topojson.js | 4 +- examples/topolis.js | 14 ++--- examples/vector-esri.js | 10 ++-- examples/vector-label-decluttering.js | 6 +- examples/vector-labels.js | 10 ++-- examples/vector-layer.js | 10 ++-- examples/vector-osm.js | 12 ++-- examples/vector-wfs-getfeature.js | 4 +- examples/vector-wfs.js | 4 +- src/ol/Graticule.js | 8 +-- src/ol/format/KML.js | 8 +-- src/ol/render/webgl/PolygonReplay.js | 4 +- src/ol/style/Stroke.js | 38 ++++++------ src/ol/style/Style.js | 10 ++-- test/rendering/ol/layer/clip.test.js | 4 +- test/rendering/ol/layer/tile.test.js | 4 +- test/rendering/ol/layer/vector.test.js | 60 +++++++++---------- test/rendering/ol/render.test.js | 14 ++--- test/rendering/ol/style/circle.test.js | 14 ++--- test/rendering/ol/style/linestring.test.js | 14 ++--- test/rendering/ol/style/polygon.test.js | 12 ++-- test/rendering/ol/style/regularshape.test.js | 10 ++-- test/rendering/ol/style/text.test.js | 14 ++--- test/spec/ol/format/kml.test.js | 10 ++-- test/spec/ol/graticule.test.js | 6 +- test/spec/ol/render/canvas/immediate.test.js | 4 +- .../spec/ol/render/webgl/circlereplay.test.js | 4 +- test/spec/ol/render/webgl/immediate.test.js | 4 +- .../ol/render/webgl/linestringreplay.test.js | 16 ++--- .../ol/render/webgl/polygonreplay.test.js | 4 +- test/spec/ol/render/webgl/textreplay.test.js | 8 +-- test/spec/ol/renderer/canvas/replay.test.js | 12 ++-- test/spec/ol/renderer/vector.test.js | 4 +- test/spec/ol/style/circle.test.js | 24 ++++---- test/spec/ol/style/regularshape.test.js | 24 ++++---- test/spec/ol/style/stroke.test.js | 10 ++-- test/spec/ol/style/style.test.js | 10 ++-- test/spec/ol/style/text.test.js | 8 +-- 75 files changed, 333 insertions(+), 333 deletions(-) diff --git a/examples/blend-modes.js b/examples/blend-modes.js index 555682be14..3c588f8775 100644 --- a/examples/blend-modes.js +++ b/examples/blend-modes.js @@ -6,7 +6,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -23,7 +23,7 @@ var redLayer = new VectorLayer({ fill: new Fill({ color: 'rgba(255,0,0,0.8)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgb(255,0,0)', width: 15 }), @@ -41,7 +41,7 @@ var greenLayer = new VectorLayer({ fill: new Fill({ color: 'rgba(0,255,0,0.8)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgb(0,255,0)', width: 15 }), @@ -58,7 +58,7 @@ var blueLayer = new VectorLayer({ fill: new Fill({ color: 'rgba(0,0,255,0.8)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgb(0,0,255)', width: 15 }), diff --git a/examples/canvas-gradient-pattern.js b/examples/canvas-gradient-pattern.js index 1291293dc4..7e7e1f6f98 100644 --- a/examples/canvas-gradient-pattern.js +++ b/examples/canvas-gradient-pattern.js @@ -7,7 +7,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import {fromLonLat} from '../src/ol/proj.js'; import VectorSource from '../src/ol/source/Vector.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; var canvas = document.createElement('canvas'); @@ -60,7 +60,7 @@ var pattern = (function() { var fill = new Fill(); var style = new Style({ fill: fill, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#333', width: 2 }) diff --git a/examples/center.js b/examples/center.js index 27c41be7bf..2bce5d3093 100644 --- a/examples/center.js +++ b/examples/center.js @@ -8,7 +8,7 @@ import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; var source = new VectorSource({ @@ -19,7 +19,7 @@ var style = new Style({ fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', width: 1 }), @@ -28,7 +28,7 @@ var style = new Style({ fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', width: 1 }) diff --git a/examples/cluster.js b/examples/cluster.js index 66669ccfdc..fb9843e82f 100644 --- a/examples/cluster.js +++ b/examples/cluster.js @@ -9,7 +9,7 @@ import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.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'; @@ -43,7 +43,7 @@ var clusters = new VectorLayer({ style = new Style({ image: new _ol_style_Circle_({ radius: 10, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#fff' }), fill: new Fill({ diff --git a/examples/custom-interactions.js b/examples/custom-interactions.js index 5fdca8cd4b..f22ac5d7a2 100644 --- a/examples/custom-interactions.js +++ b/examples/custom-interactions.js @@ -13,7 +13,7 @@ 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 _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -164,7 +164,7 @@ var map = new Map({ opacity: 0.95, src: 'data/icon.png' })), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ width: 3, color: [255, 0, 0, 1] }), diff --git a/examples/drag-and-drop-image-vector.js b/examples/drag-and-drop-image-vector.js index af17dfa7b1..0de0a04861 100644 --- a/examples/drag-and-drop-image-vector.js +++ b/examples/drag-and-drop-image-vector.js @@ -13,7 +13,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_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -24,14 +24,14 @@ var defaultStyle = { color: 'rgba(255,255,0,0.5)' }), radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#ff0', width: 1 }) }) }), 'LineString': new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#f00', width: 3 }) @@ -40,7 +40,7 @@ var defaultStyle = { fill: new Fill({ color: 'rgba(0,255,255,0.5)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#0ff', width: 1 }) @@ -51,14 +51,14 @@ var defaultStyle = { color: 'rgba(255,0,255,0.5)' }), radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#f0f', width: 1 }) }) }), 'MultiLineString': new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#0f0', width: 3 }) @@ -67,7 +67,7 @@ var defaultStyle = { fill: new Fill({ color: 'rgba(0,0,255,0.5)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#00f', width: 1 }) diff --git a/examples/drag-and-drop.js b/examples/drag-and-drop.js index 6759be7abb..86fd5b0d21 100644 --- a/examples/drag-and-drop.js +++ b/examples/drag-and-drop.js @@ -13,7 +13,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_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -24,14 +24,14 @@ var defaultStyle = { color: 'rgba(255,255,0,0.5)' }), radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#ff0', width: 1 }) }) }), 'LineString': new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#f00', width: 3 }) @@ -40,7 +40,7 @@ var defaultStyle = { fill: new Fill({ color: 'rgba(0,255,255,0.5)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#0ff', width: 1 }) @@ -51,14 +51,14 @@ var defaultStyle = { color: 'rgba(255,0,255,0.5)' }), radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#f0f', width: 1 }) }) }), 'MultiLineString': new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#0f0', width: 3 }) @@ -67,7 +67,7 @@ var defaultStyle = { fill: new Fill({ color: 'rgba(0,0,255,0.5)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#00f', width: 1 }) diff --git a/examples/draw-and-modify-features.js b/examples/draw-and-modify-features.js index 182af6edaf..4ce15fcac4 100644 --- a/examples/draw-and-modify-features.js +++ b/examples/draw-and-modify-features.js @@ -9,7 +9,7 @@ import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; var raster = new TileLayer({ @@ -23,7 +23,7 @@ var vector = new VectorLayer({ fill: new Fill({ color: 'rgba(255, 255, 255, 0.2)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#ffcc33', width: 2 }), diff --git a/examples/dynamic-data.js b/examples/dynamic-data.js index 0f74528988..d6857adce4 100644 --- a/examples/dynamic-data.js +++ b/examples/dynamic-data.js @@ -6,7 +6,7 @@ import TileLayer from '../src/ol/layer/Tile.js'; import OSM from '../src/ol/source/OSM.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -28,7 +28,7 @@ var imageStyle = new Style({ radius: 5, snapToPixel: false, fill: new Fill({color: 'yellow'}), - stroke: new _ol_style_Stroke_({color: 'red', width: 1}) + stroke: new Stroke({color: 'red', width: 1}) }) }); diff --git a/examples/earthquake-clusters.js b/examples/earthquake-clusters.js index 6ba9c4f3f2..471eb45018 100644 --- a/examples/earthquake-clusters.js +++ b/examples/earthquake-clusters.js @@ -12,7 +12,7 @@ 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_RegularShape_ from '../src/ol/style/RegularShape.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.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'; @@ -20,14 +20,14 @@ import _ol_style_Text_ from '../src/ol/style/Text.js'; var earthquakeFill = new Fill({ color: 'rgba(255, 153, 0, 0.8)' }); -var earthquakeStroke = new _ol_style_Stroke_({ +var earthquakeStroke = new Stroke({ color: 'rgba(255, 204, 0, 0.2)', width: 1 }); var textFill = new Fill({ color: '#fff' }); -var textStroke = new _ol_style_Stroke_({ +var textStroke = new Stroke({ color: 'rgba(0, 0, 0, 0.6)', width: 3 }); diff --git a/examples/earthquake-custom-symbol.js b/examples/earthquake-custom-symbol.js index 74832551bf..169157480e 100644 --- a/examples/earthquake-custom-symbol.js +++ b/examples/earthquake-custom-symbol.js @@ -9,7 +9,7 @@ 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 _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -37,7 +37,7 @@ var styleFunction = function(feature) { {size: [size, size], pixelRatio: 1}); vectorContext.setStyle(new Style({ fill: new Fill({color: 'rgba(255, 153, 0, 0.4)'}), - stroke: new _ol_style_Stroke_({color: 'rgba(255, 204, 0, 0.2)', width: 2}) + stroke: new Stroke({color: 'rgba(255, 204, 0, 0.2)', width: 2}) })); vectorContext.drawGeometry(new Polygon([symbol.map(scaleFunction)])); style = new Style({ diff --git a/examples/feature-animation.js b/examples/feature-animation.js index 77d1d5384a..aef9b4ef19 100644 --- a/examples/feature-animation.js +++ b/examples/feature-animation.js @@ -11,7 +11,7 @@ import {fromLonLat} from '../src/ol/proj.js'; import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -70,7 +70,7 @@ function flash(feature) { image: new _ol_style_Circle_({ radius: radius, snapToPixel: false, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(255, 0, 0, ' + opacity + ')', width: 0.25 + opacity }) diff --git a/examples/feature-move-animation.js b/examples/feature-move-animation.js index c99ed86423..ee8e088e8d 100644 --- a/examples/feature-move-animation.js +++ b/examples/feature-move-animation.js @@ -10,7 +10,7 @@ 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 _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; // This long string is placed here due to jsFiddle limitations. @@ -86,7 +86,7 @@ var endMarker = new Feature({ var styles = { 'route': new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ width: 6, color: [237, 212, 0, 0.8] }) }), @@ -101,7 +101,7 @@ var styles = { radius: 7, snapToPixel: false, fill: new Fill({color: 'black'}), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'white', width: 2 }) }) diff --git a/examples/flight-animation.js b/examples/flight-animation.js index dbfe79f07d..aacd445b96 100644 --- a/examples/flight-animation.js +++ b/examples/flight-animation.js @@ -7,7 +7,7 @@ import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import Stamen from '../src/ol/source/Stamen.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; var map = new Map({ @@ -26,7 +26,7 @@ var map = new Map({ }); var style = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#EAE911', width: 2 }) diff --git a/examples/geojson.js b/examples/geojson.js index c9d5fda1b8..58af905194 100644 --- a/examples/geojson.js +++ b/examples/geojson.js @@ -10,14 +10,14 @@ import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; var image = new _ol_style_Circle_({ radius: 5, fill: null, - stroke: new _ol_style_Stroke_({color: 'red', width: 1}) + stroke: new Stroke({color: 'red', width: 1}) }); var styles = { @@ -25,13 +25,13 @@ var styles = { image: image }), 'LineString': new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'green', width: 1 }) }), 'MultiLineString': new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'green', width: 1 }) @@ -40,7 +40,7 @@ var styles = { image: image }), 'MultiPolygon': new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'yellow', width: 1 }), @@ -49,7 +49,7 @@ var styles = { }) }), 'Polygon': new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue', lineDash: [4], width: 3 @@ -59,7 +59,7 @@ var styles = { }) }), 'GeometryCollection': new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'magenta', width: 2 }), @@ -69,13 +69,13 @@ var styles = { image: new _ol_style_Circle_({ radius: 10, fill: null, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'magenta' }) }) }), 'Circle': new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'red', width: 2 }), diff --git a/examples/geolocation.js b/examples/geolocation.js index 471becd32f..782323b316 100644 --- a/examples/geolocation.js +++ b/examples/geolocation.js @@ -10,7 +10,7 @@ import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; var view = new View({ @@ -73,7 +73,7 @@ positionFeature.setStyle(new Style({ fill: new Fill({ color: '#3399CC' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#fff', width: 2 }) diff --git a/examples/gpx.js b/examples/gpx.js index 4744598147..dfc5652d69 100644 --- a/examples/gpx.js +++ b/examples/gpx.js @@ -7,7 +7,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_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; var raster = new TileLayer({ @@ -24,20 +24,20 @@ var style = { color: 'rgba(255,255,0,0.4)' }), radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#ff0', width: 1 }) }) }), 'LineString': new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#f00', width: 3 }) }), 'MultiLineString': new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#0f0', width: 3 }) diff --git a/examples/graticule.js b/examples/graticule.js index 7a47183a95..f435460f72 100644 --- a/examples/graticule.js +++ b/examples/graticule.js @@ -4,7 +4,7 @@ import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {fromLonLat} from '../src/ol/proj.js'; import OSM from '../src/ol/source/OSM.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; var map = new Map({ @@ -25,7 +25,7 @@ var map = new Map({ // Create the graticule component var graticule = new Graticule({ // the style to use for the lines, optional. - strokeStyle: new _ol_style_Stroke_({ + strokeStyle: new Stroke({ color: 'rgba(255,120,0,0.9)', width: 2, lineDash: [0.5, 4] diff --git a/examples/hit-tolerance.js b/examples/hit-tolerance.js index 24cc041f57..015887f486 100644 --- a/examples/hit-tolerance.js +++ b/examples/hit-tolerance.js @@ -7,14 +7,14 @@ import VectorSource from '../src/ol/source/Vector.js'; import Feature from '../src/ol/Feature.js'; import LineString from '../src/ol/geom/LineString.js'; import Style from '../src/ol/style/Style.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; var raster = new TileLayer({ source: new OSM() }); var style = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'black', width: 1 }) diff --git a/examples/igc.js b/examples/igc.js index fc5854daca..fab2738d6a 100644 --- a/examples/igc.js +++ b/examples/igc.js @@ -11,7 +11,7 @@ import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -29,7 +29,7 @@ var styleFunction = function(feature) { var style = styleCache[color]; if (!style) { style = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: color, width: 3 }) @@ -152,7 +152,7 @@ map.on('click', function(evt) { displaySnap(evt.coordinate); }); -var stroke = new _ol_style_Stroke_({ +var stroke = new Stroke({ color: 'rgba(255,0,0,0.9)', width: 1 }); diff --git a/examples/image-vector-layer.js b/examples/image-vector-layer.js index 13fb0edb12..369c1cced6 100644 --- a/examples/image-vector-layer.js +++ b/examples/image-vector-layer.js @@ -4,7 +4,7 @@ import GeoJSON from '../src/ol/format/GeoJSON.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.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'; @@ -13,7 +13,7 @@ var style = new Style({ fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', width: 1 }), @@ -45,7 +45,7 @@ var featureOverlay = new VectorLayer({ source: new VectorSource(), map: map, style: new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#f00', width: 1 }), diff --git a/examples/kml-earthquakes.js b/examples/kml-earthquakes.js index a37e2e1577..621eb845e4 100644 --- a/examples/kml-earthquakes.js +++ b/examples/kml-earthquakes.js @@ -7,7 +7,7 @@ import Stamen from '../src/ol/source/Stamen.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -27,7 +27,7 @@ var styleFunction = function(feature) { fill: new Fill({ color: 'rgba(255, 153, 0, 0.4)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(255, 204, 0, 0.2)', width: 1 }) diff --git a/examples/kml-timezones.js b/examples/kml-timezones.js index 00554dcea4..5c6956d254 100644 --- a/examples/kml-timezones.js +++ b/examples/kml-timezones.js @@ -6,7 +6,7 @@ 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 Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -39,7 +39,7 @@ var styleFunction = function(feature) { fill: new Fill({ color: [0xff, 0xff, 0x33, opacity] }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#ffffff' }) }); diff --git a/examples/layer-z-index.js b/examples/layer-z-index.js index e286d8aea9..e3921bebe7 100644 --- a/examples/layer-z-index.js +++ b/examples/layer-z-index.js @@ -6,11 +6,11 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import Fill from '../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; -var stroke = new _ol_style_Stroke_({color: 'black', width: 1}); +var stroke = new Stroke({color: 'black', width: 1}); var styles = { 'square': new Style({ diff --git a/examples/line-arrows.js b/examples/line-arrows.js index 1c49d66cc4..083eafa8b5 100644 --- a/examples/line-arrows.js +++ b/examples/line-arrows.js @@ -7,7 +7,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; var raster = new TileLayer({ @@ -21,7 +21,7 @@ var styleFunction = function(feature) { var styles = [ // linestring new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#ffcc33', width: 2 }) diff --git a/examples/mapbox-vector-tiles-advanced.js b/examples/mapbox-vector-tiles-advanced.js index 463133b4ee..f9a0cf8349 100644 --- a/examples/mapbox-vector-tiles-advanced.js +++ b/examples/mapbox-vector-tiles-advanced.js @@ -6,7 +6,7 @@ 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 _ol_style_Stroke_ from '../src/ol/style/Stroke.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 TileGrid from '../src/ol/tilegrid/TileGrid.js'; @@ -45,7 +45,7 @@ var map = new Map({ }), tileUrlFunction: tileUrlFunction }), - style: createMapboxStreetsV6Style(Style, Fill, _ol_style_Stroke_, _ol_style_Icon_, _ol_style_Text_) + style: createMapboxStreetsV6Style(Style, Fill, Stroke, _ol_style_Icon_, _ol_style_Text_) }) ], target: 'map', diff --git a/examples/mapbox-vector-tiles.js b/examples/mapbox-vector-tiles.js index d4aac95a47..2f2a542785 100644 --- a/examples/mapbox-vector-tiles.js +++ b/examples/mapbox-vector-tiles.js @@ -5,7 +5,7 @@ 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 _ol_style_Stroke_ from '../src/ol/style/Stroke.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, _ol_style_Stroke_, _ol_style_Icon_, _ol_style_Text_) + style: createMapboxStreetsV6Style(Style, Fill, Stroke, _ol_style_Icon_, _ol_style_Text_) }) ], target: 'map', diff --git a/examples/measure.js b/examples/measure.js index 90ad489d8b..e42658c7d2 100644 --- a/examples/measure.js +++ b/examples/measure.js @@ -12,7 +12,7 @@ import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -28,7 +28,7 @@ var vector = new VectorLayer({ fill: new Fill({ color: 'rgba(255, 255, 255, 0.2)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#ffcc33', width: 2 }), @@ -184,14 +184,14 @@ function addInteraction() { fill: new Fill({ color: 'rgba(255, 255, 255, 0.2)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(0, 0, 0, 0.5)', lineDash: [10, 10], width: 2 }), image: new _ol_style_Circle_({ radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(0, 0, 0, 0.7)' }), fill: new Fill({ diff --git a/examples/modify-test.js b/examples/modify-test.js index 2133749dab..63bcc0a052 100644 --- a/examples/modify-test.js +++ b/examples/modify-test.js @@ -8,7 +8,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -17,11 +17,11 @@ var styleFunction = (function() { var image = new _ol_style_Circle_({ radius: 5, fill: null, - stroke: new _ol_style_Stroke_({color: 'orange', width: 2}) + stroke: new Stroke({color: 'orange', width: 2}) }); styles['Point'] = new Style({image: image}); styles['Polygon'] = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue', width: 3 }), @@ -30,13 +30,13 @@ var styleFunction = (function() { }) }); styles['MultiLineString'] = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'green', width: 3 }) }); styles['MultiPolygon'] = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'yellow', width: 1 }), @@ -45,7 +45,7 @@ var styleFunction = (function() { }) }); styles['default'] = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'red', width: 3 }), @@ -162,13 +162,13 @@ var overlayStyle = (function() { }) }), new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: [255, 255, 255, 1], width: 5 }) }), new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: [0, 153, 255, 1], width: 3 }) @@ -178,13 +178,13 @@ var overlayStyle = (function() { styles['LineString'] = [ new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: [255, 255, 255, 1], width: 5 }) }), new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: [0, 153, 255, 1], width: 3 }) @@ -199,7 +199,7 @@ var overlayStyle = (function() { fill: new Fill({ color: [0, 153, 255, 1] }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: [255, 255, 255, 0.75], width: 1.5 }) diff --git a/examples/osm-vector-tiles.js b/examples/osm-vector-tiles.js index 3fd1a68f80..5f0c7d332c 100644 --- a/examples/osm-vector-tiles.js +++ b/examples/osm-vector-tiles.js @@ -5,7 +5,7 @@ import VectorTileLayer from '../src/ol/layer/VectorTile.js'; import {fromLonLat} from '../src/ol/proj.js'; import VectorTileSource from '../src/ol/source/VectorTile.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; var key = 'vector-tiles-5eJz6JX'; @@ -21,7 +21,7 @@ var buildingStyle = new Style({ color: '#666', opacity: 0.4 }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#444', width: 1 }) @@ -47,7 +47,7 @@ var roadStyle = function(feature) { width = kind == 'highway' ? 1.5 : 1; } style = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: color, width: width }), diff --git a/examples/polygon-styles.js b/examples/polygon-styles.js index 43f4c10750..6a1d987316 100644 --- a/examples/polygon-styles.js +++ b/examples/polygon-styles.js @@ -6,7 +6,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; var styles = [ @@ -18,7 +18,7 @@ var styles = [ * the style. */ new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue', width: 3 }), diff --git a/examples/regularshape.js b/examples/regularshape.js index 060ef936c0..74236462de 100644 --- a/examples/regularshape.js +++ b/examples/regularshape.js @@ -6,11 +6,11 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import Fill from '../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; -var stroke = new _ol_style_Stroke_({color: 'black', width: 2}); +var stroke = new Stroke({color: 'black', width: 2}); var fill = new Fill({color: 'red'}); var styles = { diff --git a/examples/render-geometry.js b/examples/render-geometry.js index f334629ad6..4a68f096e2 100644 --- a/examples/render-geometry.js +++ b/examples/render-geometry.js @@ -4,7 +4,7 @@ import Polygon from '../src/ol/geom/Polygon.js'; import _ol_render_ from '../src/ol/render.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -12,7 +12,7 @@ var canvas = document.getElementById('canvas'); var vectorContext = _ol_render_.toContext(canvas.getContext('2d'), {size: [100, 100]}); var fill = new Fill({color: 'blue'}); -var stroke = new _ol_style_Stroke_({color: 'black'}); +var stroke = new Stroke({color: 'black'}); var style = new Style({ fill: fill, stroke: stroke, diff --git a/examples/snap.js b/examples/snap.js index 8896399a5d..b7ab4c0cb4 100644 --- a/examples/snap.js +++ b/examples/snap.js @@ -10,7 +10,7 @@ import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; var raster = new TileLayer({ @@ -23,7 +23,7 @@ var vector = new VectorLayer({ fill: new Fill({ color: 'rgba(255, 255, 255, 0.2)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#ffcc33', width: 2 }), diff --git a/examples/symbol-atlas-webgl.js b/examples/symbol-atlas-webgl.js index d72bfe70ea..e470aec390 100644 --- a/examples/symbol-atlas-webgl.js +++ b/examples/symbol-atlas-webgl.js @@ -8,7 +8,7 @@ import AtlasManager from '../src/ol/style/AtlasManager.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; var atlasManager = new AtlasManager({ @@ -54,7 +54,7 @@ for (i = 0; i < symbolInfo.length; ++i) { fill: new Fill({ color: info.fillColor }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: info.strokeColor, width: 1 }), @@ -74,7 +74,7 @@ for (i = 0; i < symbolInfo.length; ++i) { fill: new Fill({ color: info.fillColor }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: info.strokeColor, width: 1 }), diff --git a/examples/synthetic-lines.js b/examples/synthetic-lines.js index 511e8fb2c2..5854ac99c0 100644 --- a/examples/synthetic-lines.js +++ b/examples/synthetic-lines.js @@ -4,7 +4,7 @@ import View from '../src/ol/View.js'; import LineString from '../src/ol/geom/LineString.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -42,7 +42,7 @@ var vector = new VectorLayer({ wrapX: false }), style: new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#666666', width: 1 }) diff --git a/examples/synthetic-points.js b/examples/synthetic-points.js index d08eafda2e..758cb73316 100644 --- a/examples/synthetic-points.js +++ b/examples/synthetic-points.js @@ -7,7 +7,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -28,14 +28,14 @@ var styles = { image: new _ol_style_Circle_({ radius: 5, fill: new Fill({color: '#666666'}), - stroke: new _ol_style_Stroke_({color: '#bada55', width: 1}) + stroke: new Stroke({color: '#bada55', width: 1}) }) }), '20': new Style({ image: new _ol_style_Circle_({ radius: 10, fill: new Fill({color: '#666666'}), - stroke: new _ol_style_Stroke_({color: '#bada55', width: 1}) + stroke: new Stroke({color: '#bada55', width: 1}) }) }) }; @@ -96,7 +96,7 @@ map.on('click', function(evt) { displaySnap(evt.coordinate); }); -var stroke = new _ol_style_Stroke_({ +var stroke = new Stroke({ color: 'rgba(255,255,0,0.9)', width: 3 }); diff --git a/examples/topojson.js b/examples/topojson.js index 0d0dd2d61c..f43ca0fffb 100644 --- a/examples/topojson.js +++ b/examples/topojson.js @@ -6,7 +6,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_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -20,7 +20,7 @@ var style = new Style({ fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', width: 1 }) diff --git a/examples/topolis.js b/examples/topolis.js index a3eb862218..07a4603d9c 100644 --- a/examples/topolis.js +++ b/examples/topolis.js @@ -14,7 +14,7 @@ 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 Style from '../src/ol/style/Style.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.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'; @@ -32,12 +32,12 @@ var nodesLayer = new VectorLayer({ image: new _ol_style_Circle_({ radius: 8, fill: new Fill({color: 'rgba(255, 0, 0, 0.2)'}), - stroke: new _ol_style_Stroke_({color: 'red', width: 1}) + stroke: new Stroke({color: 'red', width: 1}) }), text: new _ol_style_Text_({ text: f.get('node').id.toString(), fill: new Fill({color: 'red'}), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'white', width: 3 }) @@ -52,14 +52,14 @@ var edgesLayer = new VectorLayer({ source: edges, style: function(f) { var style = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue', width: 1 }), text: new _ol_style_Text_({ text: f.get('edge').id.toString(), fill: new Fill({color: 'blue'}), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'white', width: 2 }) @@ -74,7 +74,7 @@ var facesLayer = new VectorLayer({ source: faces, style: function(f) { var style = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'black', width: 1 }), @@ -85,7 +85,7 @@ var facesLayer = new VectorLayer({ font: 'bold 12px sans-serif', text: f.get('face').id.toString(), fill: new Fill({color: 'green'}), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'white', width: 2 }) diff --git a/examples/vector-esri.js b/examples/vector-esri.js index 3f08e040f6..de7d898d67 100644 --- a/examples/vector-esri.js +++ b/examples/vector-esri.js @@ -8,7 +8,7 @@ import {fromLonLat} from '../src/ol/proj.js'; import VectorSource from '../src/ol/source/Vector.js'; import XYZ from '../src/ol/source/XYZ.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; import _ol_tilegrid_ from '../src/ol/tilegrid.js'; @@ -24,7 +24,7 @@ var styleCache = { fill: new Fill({ color: 'rgba(225, 225, 225, 255)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(0, 0, 0, 255)', width: 0.4 }) @@ -33,7 +33,7 @@ var styleCache = { fill: new Fill({ color: 'rgba(255, 0, 0, 255)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(110, 110, 110, 255)', width: 0.4 }) @@ -42,7 +42,7 @@ var styleCache = { fill: new Fill({ color: 'rgba(56, 168, 0, 255)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(110, 110, 110, 255)', width: 0 }) @@ -51,7 +51,7 @@ var styleCache = { fill: new Fill({ color: 'rgba(168, 112, 0, 255)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(110, 110, 110, 255)', width: 0.4 }) diff --git a/examples/vector-label-decluttering.js b/examples/vector-label-decluttering.js index 3a9b56d401..0505b3a687 100644 --- a/examples/vector-label-decluttering.js +++ b/examples/vector-label-decluttering.js @@ -5,7 +5,7 @@ import GeoJSON from '../src/ol/format/GeoJSON.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.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'; @@ -41,7 +41,7 @@ var labelStyle = new Style({ fill: new Fill({ color: '#000' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#fff', width: 3 }) @@ -51,7 +51,7 @@ var countryStyle = new Style({ fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', width: 1 }) diff --git a/examples/vector-labels.js b/examples/vector-labels.js index a9f91f19cd..1ebbef72a8 100644 --- a/examples/vector-labels.js +++ b/examples/vector-labels.js @@ -7,7 +7,7 @@ import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.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'; @@ -115,7 +115,7 @@ var createTextStyle = function(feature, resolution, dom) { font: font, text: getText(feature, resolution, dom), fill: new Fill({color: fillColor}), - stroke: new _ol_style_Stroke_({color: outlineColor, width: outlineWidth}), + stroke: new Stroke({color: outlineColor, width: outlineWidth}), offsetX: offsetX, offsetY: offsetY, placement: placement, @@ -129,7 +129,7 @@ var createTextStyle = function(feature, resolution, dom) { // Polygons function polygonStyleFunction(feature, resolution) { return new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue', width: 1 }), @@ -152,7 +152,7 @@ var vectorPolygons = new VectorLayer({ // Lines function lineStyleFunction(feature, resolution) { return new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'green', width: 2 }), @@ -175,7 +175,7 @@ function pointStyleFunction(feature, resolution) { image: new _ol_style_Circle_({ radius: 10, fill: new Fill({color: 'rgba(255, 0, 0, 0.1)'}), - stroke: new _ol_style_Stroke_({color: 'red', width: 1}) + stroke: new Stroke({color: 'red', width: 1}) }), text: createTextStyle(feature, resolution, myDom.points) }); diff --git a/examples/vector-layer.js b/examples/vector-layer.js index f7666c3796..7b69f61c2b 100644 --- a/examples/vector-layer.js +++ b/examples/vector-layer.js @@ -4,7 +4,7 @@ import GeoJSON from '../src/ol/format/GeoJSON.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.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'; @@ -13,7 +13,7 @@ var style = new Style({ fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', width: 1 }), @@ -22,7 +22,7 @@ var style = new Style({ fill: new Fill({ color: '#000' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#fff', width: 3 }) @@ -50,7 +50,7 @@ var map = new Map({ }); var highlightStyle = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#f00', width: 1 }), @@ -62,7 +62,7 @@ var highlightStyle = new Style({ fill: new Fill({ color: '#000' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#f00', width: 3 }) diff --git a/examples/vector-osm.js b/examples/vector-osm.js index 77425061aa..dd5e923251 100644 --- a/examples/vector-osm.js +++ b/examples/vector-osm.js @@ -10,7 +10,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_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; var map; @@ -18,7 +18,7 @@ var map; var styles = { 'amenity': { 'parking': new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(170, 170, 170, 1.0)', width: 1 }), @@ -30,7 +30,7 @@ var styles = { 'building': { '.*': new Style({ zIndex: 100, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(246, 99, 79, 1.0)', width: 1 }), @@ -41,13 +41,13 @@ var styles = { }, 'highway': { 'service': new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(255, 255, 255, 1.0)', width: 2 }) }), '.*': new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(255, 255, 255, 1.0)', width: 3 }) @@ -55,7 +55,7 @@ var styles = { }, 'landuse': { 'forest|grass|allotments': new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(140, 208, 95, 1.0)', width: 1 }), diff --git a/examples/vector-wfs-getfeature.js b/examples/vector-wfs-getfeature.js index 871efe3f5a..9b8b530f57 100644 --- a/examples/vector-wfs-getfeature.js +++ b/examples/vector-wfs-getfeature.js @@ -7,7 +7,7 @@ import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import BingMaps from '../src/ol/source/BingMaps.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -15,7 +15,7 @@ var vectorSource = new VectorSource(); var vector = new VectorLayer({ source: vectorSource, style: new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(0, 0, 255, 1.0)', width: 2 }) diff --git a/examples/vector-wfs.js b/examples/vector-wfs.js index c144c9a2ad..59275be629 100644 --- a/examples/vector-wfs.js +++ b/examples/vector-wfs.js @@ -6,7 +6,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js'; import BingMaps from '../src/ol/source/BingMaps.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; +import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -25,7 +25,7 @@ var vectorSource = new VectorSource({ var vector = new VectorLayer({ source: vectorSource, style: new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(0, 0, 255, 1.0)', width: 2 }) diff --git a/src/ol/Graticule.js b/src/ol/Graticule.js index 6498342a20..fd8a4992bf 100644 --- a/src/ol/Graticule.js +++ b/src/ol/Graticule.js @@ -11,7 +11,7 @@ import {clamp} from './math.js'; import {get as getProjection, equivalent as equivalentProjection, getTransform, transformExtent} from './proj.js'; import RenderEventType from './render/EventType.js'; import Fill from './style/Fill.js'; -import _ol_style_Stroke_ from './style/Stroke.js'; +import Stroke from './style/Stroke.js'; import _ol_style_Text_ from './style/Text.js'; @@ -20,7 +20,7 @@ import _ol_style_Text_ from './style/Text.js'; * @private * @const */ -var DEFAULT_STROKE_STYLE = new _ol_style_Stroke_({ +var DEFAULT_STROKE_STYLE = new Stroke({ color: 'rgba(0,0,0,0.2)' }); @@ -289,7 +289,7 @@ var Graticule = function(opt_options) { fill: new Fill({ color: 'rgba(0,0,0,1)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(255,255,255,1)', width: 3 }) @@ -306,7 +306,7 @@ var Graticule = function(opt_options) { fill: new Fill({ color: 'rgba(0,0,0,1)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'rgba(255,255,255,1)', width: 3 }) diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index 83eeb36583..880863a07e 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -24,7 +24,7 @@ import Fill from '../style/Fill.js'; import _ol_style_Icon_ from '../style/Icon.js'; import IconAnchorUnits from '../style/IconAnchorUnits.js'; import IconOrigin from '../style/IconOrigin.js'; -import _ol_style_Stroke_ from '../style/Stroke.js'; +import Stroke from '../style/Stroke.js'; import Style from '../style/Style.js'; import _ol_style_Text_ from '../style/Text.js'; import _ol_xml_ from '../xml.js'; @@ -221,7 +221,7 @@ KML.createStyleDefaults_ = function() { * @type {ol.style.Stroke} * @private */ - KML.DEFAULT_STROKE_STYLE_ = new _ol_style_Stroke_({ + KML.DEFAULT_STROKE_STYLE_ = new Stroke({ color: KML.DEFAULT_COLOR_, width: 1 }); @@ -231,7 +231,7 @@ KML.createStyleDefaults_ = function() { * @type {ol.style.Stroke} * @private */ - KML.DEFAULT_TEXT_STROKE_STYLE_ = new _ol_style_Stroke_({ + KML.DEFAULT_TEXT_STROKE_STYLE_ = new Stroke({ color: [51, 51, 51, 1], width: 2 }); @@ -694,7 +694,7 @@ KML.LineStyleParser_ = function(node, objectStack) { return; } var styleObject = objectStack[objectStack.length - 1]; - var strokeStyle = new _ol_style_Stroke_({ + var strokeStyle = new Stroke({ color: /** @type {ol.Color} */ ('color' in object ? object['color'] : KML.DEFAULT_COLOR_), width: /** @type {number} */ ('width' in object ? object['width'] : 1) diff --git a/src/ol/render/webgl/PolygonReplay.js b/src/ol/render/webgl/PolygonReplay.js index 494d58833b..8d3bfad1f9 100644 --- a/src/ol/render/webgl/PolygonReplay.js +++ b/src/ol/render/webgl/PolygonReplay.js @@ -14,7 +14,7 @@ import _ol_render_webgl_polygonreplay_defaultshader_Locations_ from '../webgl/po import _ol_render_webgl_LineStringReplay_ from '../webgl/LineStringReplay.js'; import _ol_render_webgl_Replay_ from '../webgl/Replay.js'; import _ol_render_webgl_ from '../webgl.js'; -import _ol_style_Stroke_ from '../../style/Stroke.js'; +import Stroke from '../../style/Stroke.js'; import LinkedList from '../../structs/LinkedList.js'; import RBush from '../../structs/RBush.js'; import _ol_webgl_ from '../../webgl.js'; @@ -1063,7 +1063,7 @@ _ol_render_webgl_PolygonReplay_.prototype.setFillStrokeStyle = function(fillStyl if (strokeStyle) { this.lineStringReplay.setFillStrokeStyle(null, strokeStyle); } else { - var nullStrokeStyle = new _ol_style_Stroke_({ + var nullStrokeStyle = new Stroke({ color: [0, 0, 0, 0], lineWidth: 0 }); diff --git a/src/ol/style/Stroke.js b/src/ol/style/Stroke.js index 4b9cf27eb6..d4c72ce7c4 100644 --- a/src/ol/style/Stroke.js +++ b/src/ol/style/Stroke.js @@ -14,7 +14,7 @@ import {getUid} from '../index.js'; * @param {olx.style.StrokeOptions=} opt_options Options. * @api */ -var _ol_style_Stroke_ = function(opt_options) { +var Stroke = function(opt_options) { var options = opt_options || {}; @@ -73,9 +73,9 @@ var _ol_style_Stroke_ = function(opt_options) { * @return {ol.style.Stroke} The cloned style. * @api */ -_ol_style_Stroke_.prototype.clone = function() { +Stroke.prototype.clone = function() { var color = this.getColor(); - return new _ol_style_Stroke_({ + return new Stroke({ color: (color && color.slice) ? color.slice() : color || undefined, lineCap: this.getLineCap(), lineDash: this.getLineDash() ? this.getLineDash().slice() : undefined, @@ -92,7 +92,7 @@ _ol_style_Stroke_.prototype.clone = function() { * @return {ol.Color|ol.ColorLike} Color. * @api */ -_ol_style_Stroke_.prototype.getColor = function() { +Stroke.prototype.getColor = function() { return this.color_; }; @@ -102,7 +102,7 @@ _ol_style_Stroke_.prototype.getColor = function() { * @return {string|undefined} Line cap. * @api */ -_ol_style_Stroke_.prototype.getLineCap = function() { +Stroke.prototype.getLineCap = function() { return this.lineCap_; }; @@ -112,7 +112,7 @@ _ol_style_Stroke_.prototype.getLineCap = function() { * @return {Array.} Line dash. * @api */ -_ol_style_Stroke_.prototype.getLineDash = function() { +Stroke.prototype.getLineDash = function() { return this.lineDash_; }; @@ -122,7 +122,7 @@ _ol_style_Stroke_.prototype.getLineDash = function() { * @return {number|undefined} Line dash offset. * @api */ -_ol_style_Stroke_.prototype.getLineDashOffset = function() { +Stroke.prototype.getLineDashOffset = function() { return this.lineDashOffset_; }; @@ -132,7 +132,7 @@ _ol_style_Stroke_.prototype.getLineDashOffset = function() { * @return {string|undefined} Line join. * @api */ -_ol_style_Stroke_.prototype.getLineJoin = function() { +Stroke.prototype.getLineJoin = function() { return this.lineJoin_; }; @@ -142,7 +142,7 @@ _ol_style_Stroke_.prototype.getLineJoin = function() { * @return {number|undefined} Miter limit. * @api */ -_ol_style_Stroke_.prototype.getMiterLimit = function() { +Stroke.prototype.getMiterLimit = function() { return this.miterLimit_; }; @@ -152,7 +152,7 @@ _ol_style_Stroke_.prototype.getMiterLimit = function() { * @return {number|undefined} Width. * @api */ -_ol_style_Stroke_.prototype.getWidth = function() { +Stroke.prototype.getWidth = function() { return this.width_; }; @@ -163,7 +163,7 @@ _ol_style_Stroke_.prototype.getWidth = function() { * @param {ol.Color|ol.ColorLike} color Color. * @api */ -_ol_style_Stroke_.prototype.setColor = function(color) { +Stroke.prototype.setColor = function(color) { this.color_ = color; this.checksum_ = undefined; }; @@ -175,7 +175,7 @@ _ol_style_Stroke_.prototype.setColor = function(color) { * @param {string|undefined} lineCap Line cap. * @api */ -_ol_style_Stroke_.prototype.setLineCap = function(lineCap) { +Stroke.prototype.setLineCap = function(lineCap) { this.lineCap_ = lineCap; this.checksum_ = undefined; }; @@ -193,7 +193,7 @@ _ol_style_Stroke_.prototype.setLineCap = function(lineCap) { * @param {Array.} lineDash Line dash. * @api */ -_ol_style_Stroke_.prototype.setLineDash = function(lineDash) { +Stroke.prototype.setLineDash = function(lineDash) { this.lineDash_ = lineDash; this.checksum_ = undefined; }; @@ -205,7 +205,7 @@ _ol_style_Stroke_.prototype.setLineDash = function(lineDash) { * @param {number|undefined} lineDashOffset Line dash offset. * @api */ -_ol_style_Stroke_.prototype.setLineDashOffset = function(lineDashOffset) { +Stroke.prototype.setLineDashOffset = function(lineDashOffset) { this.lineDashOffset_ = lineDashOffset; this.checksum_ = undefined; }; @@ -217,7 +217,7 @@ _ol_style_Stroke_.prototype.setLineDashOffset = function(lineDashOffset) { * @param {string|undefined} lineJoin Line join. * @api */ -_ol_style_Stroke_.prototype.setLineJoin = function(lineJoin) { +Stroke.prototype.setLineJoin = function(lineJoin) { this.lineJoin_ = lineJoin; this.checksum_ = undefined; }; @@ -229,7 +229,7 @@ _ol_style_Stroke_.prototype.setLineJoin = function(lineJoin) { * @param {number|undefined} miterLimit Miter limit. * @api */ -_ol_style_Stroke_.prototype.setMiterLimit = function(miterLimit) { +Stroke.prototype.setMiterLimit = function(miterLimit) { this.miterLimit_ = miterLimit; this.checksum_ = undefined; }; @@ -241,7 +241,7 @@ _ol_style_Stroke_.prototype.setMiterLimit = function(miterLimit) { * @param {number|undefined} width Width. * @api */ -_ol_style_Stroke_.prototype.setWidth = function(width) { +Stroke.prototype.setWidth = function(width) { this.width_ = width; this.checksum_ = undefined; }; @@ -250,7 +250,7 @@ _ol_style_Stroke_.prototype.setWidth = function(width) { /** * @return {string} The checksum. */ -_ol_style_Stroke_.prototype.getChecksum = function() { +Stroke.prototype.getChecksum = function() { if (this.checksum_ === undefined) { this.checksum_ = 's'; if (this.color_) { @@ -279,4 +279,4 @@ _ol_style_Stroke_.prototype.getChecksum = function() { return this.checksum_; }; -export default _ol_style_Stroke_; +export default Stroke; diff --git a/src/ol/style/Style.js b/src/ol/style/Style.js index 7fade69cad..44fb692856 100644 --- a/src/ol/style/Style.js +++ b/src/ol/style/Style.js @@ -5,7 +5,7 @@ import {assert} from '../asserts.js'; import GeometryType from '../geom/GeometryType.js'; import _ol_style_Circle_ from '../style/Circle.js'; import Fill from '../style/Fill.js'; -import _ol_style_Stroke_ from '../style/Stroke.js'; +import Stroke from '../style/Stroke.js'; /** * @classdesc @@ -325,7 +325,7 @@ Style.defaultFunction = function(feature, resolution) { var fill = new Fill({ color: 'rgba(255,255,255,0.4)' }); - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ color: '#3399CC', width: 1.25 }); @@ -367,13 +367,13 @@ Style.createDefaultEditing = function() { styles[GeometryType.LINE_STRING] = [ new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: white, width: width + 2 }) }), new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: blue, width: width }) @@ -395,7 +395,7 @@ Style.createDefaultEditing = function() { fill: new Fill({ color: blue }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: white, width: width / 2 }) diff --git a/test/rendering/ol/layer/clip.test.js b/test/rendering/ol/layer/clip.test.js index c9cf241a23..f179e8c3d9 100644 --- a/test/rendering/ol/layer/clip.test.js +++ b/test/rendering/ol/layer/clip.test.js @@ -3,7 +3,7 @@ import View from '../../../../src/ol/View.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; import TileLayer from '../../../../src/ol/layer/Tile.js'; import XYZ from '../../../../src/ol/source/XYZ.js'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; import Style from '../../../../src/ol/style/Style.js'; @@ -70,7 +70,7 @@ describe('layer clipping', function() { ]).transform('EPSG:4326', 'EPSG:3857'); var style = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ width: 2, color: 'blue' }) diff --git a/test/rendering/ol/layer/tile.test.js b/test/rendering/ol/layer/tile.test.js index 1690ab2e7c..be11e77268 100644 --- a/test/rendering/ol/layer/tile.test.js +++ b/test/rendering/ol/layer/tile.test.js @@ -9,7 +9,7 @@ import TileImage from '../../../../src/ol/source/TileImage.js'; import XYZ from '../../../../src/ol/source/XYZ.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import Fill from '../../../../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -282,7 +282,7 @@ describe('ol.rendering.layer.Tile', function() { radius: 5, snapToPixel: false, fill: new Fill({color: 'yellow'}), - stroke: new _ol_style_Stroke_({color: 'red', width: 1}) + stroke: new Stroke({color: 'red', width: 1}) })); e.vectorContext.drawPoint(new Point( transform([-123, 38], 'EPSG:4326', 'EPSG:3857'))); diff --git a/test/rendering/ol/layer/vector.test.js b/test/rendering/ol/layer/vector.test.js index 215843f88b..062b013dcb 100644 --- a/test/rendering/ol/layer/vector.test.js +++ b/test/rendering/ol/layer/vector.test.js @@ -10,7 +10,7 @@ import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import Fill from '../../../../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.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'; @@ -81,7 +81,7 @@ describe('ol.rendering.layer.Vector', function() { ])); smallLine.setStyle(new Style({ zIndex: -99, - stroke: new _ol_style_Stroke_({width: 75, color: 'red'}) + stroke: new Stroke({width: 75, color: 'red'}) })); source.addFeature(smallLine); addPolygon(100); @@ -107,7 +107,7 @@ describe('ol.rendering.layer.Vector', function() { ])); smallLine.setStyle(new Style({ zIndex: -99, - stroke: new _ol_style_Stroke_({width: 75, color: 'red'}) + stroke: new Stroke({width: 75, color: 'red'}) })); source.addFeature(smallLine); addPolygon(100); @@ -134,10 +134,10 @@ describe('ol.rendering.layer.Vector', function() { ])); smallLine.setStyle([ new Style({ - stroke: new _ol_style_Stroke_({width: 75, color: 'red'}) + stroke: new Stroke({width: 75, color: 'red'}) }), new Style({ - stroke: new _ol_style_Stroke_({width: 45, color: 'white'}) + stroke: new Stroke({width: 45, color: 'white'}) }) ]); source.addFeature(smallLine); @@ -147,10 +147,10 @@ describe('ol.rendering.layer.Vector', function() { ])); smallLine2.setStyle([ new Style({ - stroke: new _ol_style_Stroke_({width: 35, color: 'blue'}) + stroke: new Stroke({width: 35, color: 'blue'}) }), new Style({ - stroke: new _ol_style_Stroke_({width: 15, color: 'green'}) + stroke: new Stroke({width: 15, color: 'green'}) }) ]); source.addFeature(smallLine2); @@ -173,10 +173,10 @@ describe('ol.rendering.layer.Vector', function() { ])); smallLine.setStyle([ new Style({ - stroke: new _ol_style_Stroke_({width: 75, color: 'red'}) + stroke: new Stroke({width: 75, color: 'red'}) }), new Style({ - stroke: new _ol_style_Stroke_({width: 45, color: 'white'}) + stroke: new Stroke({width: 45, color: 'white'}) }) ]); source.addFeature(smallLine); @@ -186,10 +186,10 @@ describe('ol.rendering.layer.Vector', function() { ])); smallLine2.setStyle([ new Style({ - stroke: new _ol_style_Stroke_({width: 35, color: 'blue'}) + stroke: new Stroke({width: 35, color: 'blue'}) }), new Style({ - stroke: new _ol_style_Stroke_({width: 15, color: 'green'}) + stroke: new Stroke({width: 15, color: 'green'}) }) ]); source.addFeature(smallLine2); @@ -213,7 +213,7 @@ describe('ol.rendering.layer.Vector', function() { map.addLayer(new VectorLayer({ source: source, style: new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ width: 2, color: 'black' }) @@ -234,7 +234,7 @@ describe('ol.rendering.layer.Vector', function() { renderMode: 'image', source: source, style: new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ width: 2, color: 'black' }) @@ -258,7 +258,7 @@ describe('ol.rendering.layer.Vector', function() { fill: new Fill({ color: 'rgba(255,0,0,0.5)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ width: 2, color: 'black' }) @@ -286,7 +286,7 @@ describe('ol.rendering.layer.Vector', function() { map.addLayer(new VectorLayer({ source: source, style: new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#3399CC', width: 1.25 }) @@ -310,7 +310,7 @@ describe('ol.rendering.layer.Vector', function() { map.addLayer(new VectorLayer({ source: source, style: new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#3399CC', width: 1.25 }) @@ -351,7 +351,7 @@ describe('ol.rendering.layer.Vector', function() { style: function(feature) { alternateColor(); return new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: alternateColor(), width: 1.25 }), @@ -402,7 +402,7 @@ describe('ol.rendering.layer.Vector', function() { style: function(feature) { alternateColor(); return new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: alternateColor(), width: 1.25 }), @@ -535,7 +535,7 @@ describe('ol.rendering.layer.Vector', function() { it('renders partially out-of-view polygons with a fill and stroke', function(done) { layer.setStyle(new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: [0, 0, 0, 1], width: 2 }), @@ -563,7 +563,7 @@ describe('ol.rendering.layer.Vector', function() { it('renders partially out-of-view polygons with a stroke', function(done) { layer.setStyle(new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: [0, 0, 0, 1], width: 2 }) @@ -726,7 +726,7 @@ describe('ol.rendering.layer.Vector', function() { return new Style({ image: new _ol_style_Circle_({ radius: 15, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue' }) }) @@ -766,7 +766,7 @@ describe('ol.rendering.layer.Vector', function() { return new Style({ image: new _ol_style_Circle_({ radius: 15, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue' }) }) @@ -808,7 +808,7 @@ describe('ol.rendering.layer.Vector', function() { zIndex: feature.get('zIndex'), image: new _ol_style_Circle_({ radius: 15, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue' }) }) @@ -846,7 +846,7 @@ describe('ol.rendering.layer.Vector', function() { return new Style({ image: new _ol_style_Circle_({ radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue' }) }), @@ -876,7 +876,7 @@ describe('ol.rendering.layer.Vector', function() { point.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 8, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue' }) }) @@ -886,7 +886,7 @@ describe('ol.rendering.layer.Vector', function() { [center[0] + 650, center[1] - 200] ])); line.setStyle(new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#CCC', width: 12 }), @@ -919,7 +919,7 @@ describe('ol.rendering.layer.Vector', function() { point.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 8, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue' }) }) @@ -929,7 +929,7 @@ describe('ol.rendering.layer.Vector', function() { [center[0] + 650, center[1] - 200] ])); line.setStyle(new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#CCC', width: 12 }), @@ -963,7 +963,7 @@ describe('ol.rendering.layer.Vector', function() { zIndex: 2, image: new _ol_style_Circle_({ radius: 8, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue' }) }) @@ -974,7 +974,7 @@ describe('ol.rendering.layer.Vector', function() { ])); line.setStyle(new Style({ zIndex: 1, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#CCC', width: 12 }), diff --git a/test/rendering/ol/render.test.js b/test/rendering/ol/render.test.js index 60c6ed44b5..fe1efb4d40 100644 --- a/test/rendering/ol/render.test.js +++ b/test/rendering/ol/render.test.js @@ -6,7 +6,7 @@ import VectorContext from '../../../src/ol/render/VectorContext.js'; import CanvasImmediateRenderer from '../../../src/ol/render/canvas/Immediate.js'; import _ol_style_Circle_ from '../../../src/ol/style/Circle.js'; import Fill from '../../../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../../../src/ol/style/Stroke.js'; +import Stroke from '../../../src/ol/style/Stroke.js'; import Style from '../../../src/ol/style/Style.js'; function getContext() { @@ -58,7 +58,7 @@ describe('ol.render', function() { }); var style = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'red', width: 14 }) @@ -82,7 +82,7 @@ describe('ol.render', function() { }); var style = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ lineCap: 'butt', color: 'red', width: 14 @@ -107,7 +107,7 @@ describe('ol.render', function() { }); var style = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ lineJoin: 'bevel', color: 'red', width: 14 @@ -132,7 +132,7 @@ describe('ol.render', function() { }); var style = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'blue', width: 8 }), @@ -161,7 +161,7 @@ describe('ol.render', function() { }); var style = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ lineDash: [10, 5] }) }); @@ -186,7 +186,7 @@ describe('ol.render', function() { }); var style = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ lineDash: [10, 5], lineDashOffset: 5 }) diff --git a/test/rendering/ol/style/circle.test.js b/test/rendering/ol/style/circle.test.js index d673afe6e3..cc5416d109 100644 --- a/test/rendering/ol/style/circle.test.js +++ b/test/rendering/ol/style/circle.test.js @@ -8,7 +8,7 @@ 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 Style from '../../../../src/ol/style/Style.js'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; describe('ol.rendering.style.Circle', function() { @@ -93,7 +93,7 @@ describe('ol.rendering.style.Circle', function() { fill: new Fill({ color: '#91E339' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#000000', width: 1 }) @@ -110,7 +110,7 @@ describe('ol.rendering.style.Circle', function() { fill: new Fill({ color: '#5447E6' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#000000', width: 2 }) @@ -127,7 +127,7 @@ describe('ol.rendering.style.Circle', function() { fill: new Fill({ color: '#92A8A6' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#000000', width: 3 }) @@ -141,7 +141,7 @@ describe('ol.rendering.style.Circle', function() { feature.setStyle(new Style({ image: new _ol_style_Circle_({ radius: 2, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#256308', width: 1 }) @@ -158,7 +158,7 @@ describe('ol.rendering.style.Circle', function() { fill: new Fill({ color: 'rgba(0, 0, 255, 0.3)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#256308', width: 2 }) @@ -175,7 +175,7 @@ describe('ol.rendering.style.Circle', function() { fill: new Fill({ color: 'rgba(235, 45, 70, 0.6)' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#256308', width: 3 }) diff --git a/test/rendering/ol/style/linestring.test.js b/test/rendering/ol/style/linestring.test.js index e7359e35c8..6286668361 100644 --- a/test/rendering/ol/style/linestring.test.js +++ b/test/rendering/ol/style/linestring.test.js @@ -5,7 +5,7 @@ import View from '../../../../src/ol/View.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; import Style from '../../../../src/ol/style/Style.js'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; describe('ol.rendering.style.LineString', function() { @@ -49,7 +49,7 @@ describe('ol.rendering.style.LineString', function() { ) }); feature.setStyle(new Style({ - stroke: new _ol_style_Stroke_({color: '#DE213A', width: 3}) + stroke: new Stroke({color: '#DE213A', width: 3}) })); vectorSource.addFeature(feature); @@ -59,7 +59,7 @@ describe('ol.rendering.style.LineString', function() { ) }); feature.setStyle(new Style({ - stroke: new _ol_style_Stroke_({color: '#9696EB', width: 1}) + stroke: new Stroke({color: '#9696EB', width: 1}) })); vectorSource.addFeature(feature); @@ -69,9 +69,9 @@ describe('ol.rendering.style.LineString', function() { ) }); feature.setStyle([new Style({ - stroke: new _ol_style_Stroke_({color: '#F2F211', width: 5}) + stroke: new Stroke({color: '#F2F211', width: 5}) }), new Style({ - stroke: new _ol_style_Stroke_({color: '#292921', width: 1}) + stroke: new Stroke({color: '#292921', width: 1}) })]); vectorSource.addFeature(feature); @@ -81,7 +81,7 @@ describe('ol.rendering.style.LineString', function() { ) }); feature.setStyle(new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#000000', width: 2, lineCap: 'square', @@ -97,7 +97,7 @@ describe('ol.rendering.style.LineString', function() { ) }); feature.setStyle(new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#000000', width: 2, lineCap: 'square', diff --git a/test/rendering/ol/style/polygon.test.js b/test/rendering/ol/style/polygon.test.js index 907b33dcac..905e9764a2 100644 --- a/test/rendering/ol/style/polygon.test.js +++ b/test/rendering/ol/style/polygon.test.js @@ -6,7 +6,7 @@ import VectorLayer from '../../../../src/ol/layer/Vector.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_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; describe('ol.rendering.style.Polygon', function() { @@ -104,7 +104,7 @@ describe('ol.rendering.style.Polygon', function() { describe('different types with stroke', function() { function createFeatures() { - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ width: 10, color: '#000', lineJoin: 'round', @@ -237,7 +237,7 @@ describe('ol.rendering.style.Polygon', function() { }); feature.setStyle(new Style({ fill: new Fill({color: '#9696EB'}), - stroke: new _ol_style_Stroke_({color: '#9696EB', width: 1}) + stroke: new Stroke({color: '#9696EB', width: 1}) })); vectorSource.addFeature(feature); @@ -249,7 +249,7 @@ describe('ol.rendering.style.Polygon', function() { }); feature.setStyle(new Style({ fill: new Fill({color: 'rgba(255, 0, 0, 0.1)'}), - stroke: new _ol_style_Stroke_({color: '#DE213A', width: 3}) + stroke: new Stroke({color: '#DE213A', width: 3}) })); vectorSource.addFeature(feature); @@ -261,7 +261,7 @@ describe('ol.rendering.style.Polygon', function() { }); feature.setStyle(new Style({ fill: new Fill({color: 'rgba(18, 204, 105, 0.3)'}), - stroke: new _ol_style_Stroke_({color: '#032E17', width: 2}) + stroke: new Stroke({color: '#032E17', width: 2}) })); vectorSource.addFeature(feature); } @@ -323,7 +323,7 @@ describe('ol.rendering.style.Polygon', function() { }); feature.setStyle(new Style({ fill: new Fill({color: createPattern()}), - stroke: new _ol_style_Stroke_({color: createRainbowGradient(), width: 3}) + stroke: new Stroke({color: createRainbowGradient(), width: 3}) })); vectorSource.addFeature(feature); } diff --git a/test/rendering/ol/style/regularshape.test.js b/test/rendering/ol/style/regularshape.test.js index fe1e2336e5..508387b077 100644 --- a/test/rendering/ol/style/regularshape.test.js +++ b/test/rendering/ol/style/regularshape.test.js @@ -7,7 +7,7 @@ import VectorSource from '../../../../src/ol/source/Vector.js'; import Fill from '../../../../src/ol/style/Fill.js'; import _ol_style_RegularShape_ from '../../../../src/ol/style/RegularShape.js'; import Style from '../../../../src/ol/style/Style.js'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; describe('ol.rendering.style.RegularShape', function() { @@ -108,7 +108,7 @@ describe('ol.rendering.style.RegularShape', function() { describe('#render', function() { - var stroke = new _ol_style_Stroke_({width: 2}); + var stroke = new Stroke({width: 2}); var fill = new Fill({color: 'red'}); it('tests the canvas renderer', function(done) { @@ -119,7 +119,7 @@ describe('ol.rendering.style.RegularShape', function() { it('supports lineDash', function(done) { createMap('canvas'); - createFeatures(new _ol_style_Stroke_({ + createFeatures(new Stroke({ lineDash: [10, 5] })); expectResemble(map, 'rendering/ol/style/expected/regularshape-canvas-linedash.png', 5, done); @@ -127,7 +127,7 @@ describe('ol.rendering.style.RegularShape', function() { it('supports lineDashOffset', function(done) { createMap('canvas'); - createFeatures(new _ol_style_Stroke_({ + createFeatures(new Stroke({ lineDash: [10, 5], lineDashOffset: 5 })); @@ -143,7 +143,7 @@ describe('ol.rendering.style.RegularShape', function() { }); describe('uses the default fill and stroke color', function() { - var stroke = new _ol_style_Stroke_(); + var stroke = new Stroke(); var fill = new Fill(); it('tests the canvas renderer', function(done) { diff --git a/test/rendering/ol/style/text.test.js b/test/rendering/ol/style/text.test.js index 04f0d6a9ce..40ff98bfc5 100644 --- a/test/rendering/ol/style/text.test.js +++ b/test/rendering/ol/style/text.test.js @@ -11,7 +11,7 @@ import VectorSource from '../../../../src/ol/source/Vector.js'; import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; import Fill from '../../../../src/ol/style/Fill.js'; import Style from '../../../../src/ol/style/Style.js'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; describe('ol.rendering.style.Text', function() { @@ -72,7 +72,7 @@ describe('ol.rendering.style.Text', function() { color: 'red', font: '12px sans-serif' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#000', width: 3 }) @@ -89,7 +89,7 @@ describe('ol.rendering.style.Text', function() { rotateWithView: true, text: 'hello', font: '10px sans-serif', - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: [10, 10, 10, 0.5] }) }) @@ -108,7 +108,7 @@ describe('ol.rendering.style.Text', function() { var geom = new LineString(); geom.setFlatCoordinates('XY', coords); var style = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: 'red' }), text: new _ol_style_Text_({ @@ -118,7 +118,7 @@ describe('ol.rendering.style.Text', function() { textAlign: textAlign, maxAngle: maxAngle, placement: 'line', - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: strokeColor || 'white', width: strokeWidth }) @@ -339,14 +339,14 @@ describe('ol.rendering.style.Text', function() { features[1].getStyle().getText().setBackgroundFill(new Fill({ color: 'red' })); - features[1].getStyle().getText().setBackgroundStroke(new _ol_style_Stroke_({ + features[1].getStyle().getText().setBackgroundStroke(new Stroke({ color: 'blue', width: 3 })); features[2].getStyle().getText().setBackgroundFill(new Fill({ color: 'red' })); - features[2].getStyle().getText().setBackgroundStroke(new _ol_style_Stroke_({ + features[2].getStyle().getText().setBackgroundStroke(new Stroke({ color: 'blue', width: 3 })); diff --git a/test/spec/ol/format/kml.test.js b/test/spec/ol/format/kml.test.js index 9c90f430cd..8af5776aa6 100644 --- a/test/spec/ol/format/kml.test.js +++ b/test/spec/ol/format/kml.test.js @@ -18,7 +18,7 @@ import Fill from '../../../../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js'; import IconAnchorUnits from '../../../../src/ol/style/IconAnchorUnits.js'; import IconOrigin from '../../../../src/ol/style/IconOrigin.js'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import 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 _ol_xml_ from '../../../../src/ol/xml.js'; @@ -1978,7 +1978,7 @@ describe('ol.format.KML', function() { expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); var strokeStyle = style.getStroke(); - expect(strokeStyle).to.be.an(_ol_style_Stroke_); + expect(strokeStyle).to.be.an(Stroke); expect(strokeStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(strokeStyle.getWidth()).to.be(9); expect(style.getText()).to.be(KML.DEFAULT_TEXT_STYLE_); @@ -2049,7 +2049,7 @@ describe('ol.format.KML', function() { expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); var strokeStyle = style.getStroke(); - expect(strokeStyle).to.be.an(_ol_style_Stroke_); + expect(strokeStyle).to.be.an(Stroke); expect(strokeStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(strokeStyle.getWidth()).to.be(9); expect(style.getText()).to.be(KML.DEFAULT_TEXT_STYLE_); @@ -2086,7 +2086,7 @@ describe('ol.format.KML', function() { expect(style.getFill()).to.be(null); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); var strokeStyle = style.getStroke(); - expect(strokeStyle).to.be.an(_ol_style_Stroke_); + expect(strokeStyle).to.be.an(Stroke); expect(strokeStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(strokeStyle.getWidth()).to.be(9); expect(style.getText()).to.be(KML.DEFAULT_TEXT_STYLE_); @@ -2393,7 +2393,7 @@ describe('ol.format.KML', function() { it('can write an feature\'s stroke style', function() { var style = new Style({ - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#112233', width: 2 }) diff --git a/test/spec/ol/graticule.test.js b/test/spec/ol/graticule.test.js index c57d73d3f0..257b79f967 100644 --- a/test/spec/ol/graticule.test.js +++ b/test/spec/ol/graticule.test.js @@ -1,7 +1,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 _ol_style_Stroke_ from '../../../src/ol/style/Stroke.js'; +import Stroke from '../../../src/ol/style/Stroke.js'; import _ol_style_Text_ from '../../../src/ol/style/Text.js'; describe('ol.Graticule', function() { @@ -54,12 +54,12 @@ describe('ol.Graticule', function() { var actualStyle = graticule.strokeStyle_; expect(actualStyle).not.to.be(undefined); - expect(actualStyle instanceof _ol_style_Stroke_).to.be(true); + expect(actualStyle instanceof Stroke).to.be(true); }); it('can be configured with a stroke style', function() { createGraticule(); - var customStrokeStyle = new _ol_style_Stroke_({ + var customStrokeStyle = new Stroke({ color: 'rebeccapurple' }); var styledGraticule = new Graticule({ diff --git a/test/spec/ol/render/canvas/immediate.test.js b/test/spec/ol/render/canvas/immediate.test.js index 982eafd2fc..6eeaa074fc 100644 --- a/test/spec/ol/render/canvas/immediate.test.js +++ b/test/spec/ol/render/canvas/immediate.test.js @@ -10,7 +10,7 @@ import VectorContext from '../../../../../src/ol/render/VectorContext.js'; import CanvasImmediateRenderer from '../../../../../src/ol/render/canvas/Immediate.js'; import _ol_style_Circle_ from '../../../../../src/ol/style/Circle.js'; import Fill from '../../../../../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.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'; @@ -43,7 +43,7 @@ describe('ol.render.canvas.Immediate', function() { sinon.spy(context, 'setImageStyle'); sinon.spy(context, 'setTextStyle'); var fill = new Fill({}); - var stroke = new _ol_style_Stroke_({}); + var stroke = new Stroke({}); var text = new _ol_style_Text_({}); var image = new _ol_style_Circle_({}); var style = new Style({ diff --git a/test/spec/ol/render/webgl/circlereplay.test.js b/test/spec/ol/render/webgl/circlereplay.test.js index 48875635ea..8b79286274 100644 --- a/test/spec/ol/render/webgl/circlereplay.test.js +++ b/test/spec/ol/render/webgl/circlereplay.test.js @@ -5,12 +5,12 @@ import _ol_render_webgl_CircleReplay_ from '../../../../../src/ol/render/webgl/C import _ol_render_webgl_circlereplay_defaultshader_ from '../../../../../src/ol/render/webgl/circlereplay/defaultshader.js'; import _ol_render_webgl_circlereplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/circlereplay/defaultshader/Locations.js'; import Fill from '../../../../../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../../src/ol/style/Stroke.js'; describe('ol.render.webgl.CircleReplay', function() { var replay; - var strokeStyle = new _ol_style_Stroke_({ + var strokeStyle = new Stroke({ color: [0, 255, 0, 0.4] }); diff --git a/test/spec/ol/render/webgl/immediate.test.js b/test/spec/ol/render/webgl/immediate.test.js index 2f43240ab6..3964cadb3e 100644 --- a/test/spec/ol/render/webgl/immediate.test.js +++ b/test/spec/ol/render/webgl/immediate.test.js @@ -14,7 +14,7 @@ import _ol_render_webgl_LineStringReplay_ from '../../../../../src/ol/render/web import _ol_render_webgl_PolygonReplay_ from '../../../../../src/ol/render/webgl/PolygonReplay.js'; import _ol_style_Circle_ from '../../../../../src/ol/style/Circle.js'; import Fill from '../../../../../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../../src/ol/style/Stroke.js'; import Style from '../../../../../src/ol/style/Style.js'; describe('ol.render.webgl.Immediate', function() { @@ -24,7 +24,7 @@ describe('ol.render.webgl.Immediate', function() { style = new Style({ image: new _ol_style_Circle_(), fill: new Fill(), - stroke: new _ol_style_Stroke_() + stroke: new Stroke() }); circle = new Circle([0, 0], 5); line = new LineString([[0, 0], [5, 5]]); diff --git a/test/spec/ol/render/webgl/linestringreplay.test.js b/test/spec/ol/render/webgl/linestringreplay.test.js index c4c954ede4..7e09f3e778 100644 --- a/test/spec/ol/render/webgl/linestringreplay.test.js +++ b/test/spec/ol/render/webgl/linestringreplay.test.js @@ -5,16 +5,16 @@ import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js'; import _ol_render_webgl_LineStringReplay_ from '../../../../../src/ol/render/webgl/LineStringReplay.js'; import _ol_render_webgl_linestringreplay_defaultshader_ from '../../../../../src/ol/render/webgl/linestringreplay/defaultshader.js'; import _ol_render_webgl_linestringreplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/linestringreplay/defaultshader/Locations.js'; -import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../../src/ol/style/Stroke.js'; describe('ol.render.webgl.LineStringReplay', function() { var replay; - var strokeStyle1 = new _ol_style_Stroke_({ + var strokeStyle1 = new Stroke({ color: [0, 255, 0, 0.4] }); - var strokeStyle2 = new _ol_style_Stroke_({ + var strokeStyle2 = new Stroke({ color: [255, 0, 0, 1], lineCap: 'square', lineJoin: 'miter' @@ -100,7 +100,7 @@ describe('ol.render.webgl.LineStringReplay', function() { it('triangulates linestrings', function() { var linestring; - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ color: [0, 255, 0, 1], lineCap: 'butt', lineJoin: 'bevel' @@ -121,7 +121,7 @@ describe('ol.render.webgl.LineStringReplay', function() { it('optionally creates miters', function() { var linestring; - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ color: [0, 255, 0, 1], lineCap: 'butt' }); @@ -141,7 +141,7 @@ describe('ol.render.webgl.LineStringReplay', function() { it('optionally creates caps', function() { var linestring; - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ color: [0, 255, 0, 1] }); @@ -162,7 +162,7 @@ describe('ol.render.webgl.LineStringReplay', function() { it('respects segment orientation', function() { var linestring; - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ color: [0, 255, 0, 1], lineCap: 'butt', lineJoin: 'bevel' @@ -183,7 +183,7 @@ describe('ol.render.webgl.LineStringReplay', function() { it('closes boundaries', function() { var linestring; - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ color: [0, 255, 0, 1], lineCap: 'butt', lineJoin: 'bevel' diff --git a/test/spec/ol/render/webgl/polygonreplay.test.js b/test/spec/ol/render/webgl/polygonreplay.test.js index 545ccd52c1..7d8125d94a 100644 --- a/test/spec/ol/render/webgl/polygonreplay.test.js +++ b/test/spec/ol/render/webgl/polygonreplay.test.js @@ -8,7 +8,7 @@ import _ol_render_webgl_polygonreplay_defaultshader_Locations_ from '../../../.. import LinkedList from '../../../../../src/ol/structs/LinkedList.js'; import RBush from '../../../../../src/ol/structs/RBush.js'; import Fill from '../../../../../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../../src/ol/style/Stroke.js'; describe('ol.render.webgl.PolygonReplay', function() { var replay; @@ -16,7 +16,7 @@ describe('ol.render.webgl.PolygonReplay', function() { var fillStyle = new Fill({ color: [0, 0, 255, 0.5] }); - var strokeStyle = new _ol_style_Stroke_({ + var strokeStyle = new Stroke({ color: [0, 255, 0, 0.4] }); diff --git a/test/spec/ol/render/webgl/textreplay.test.js b/test/spec/ol/render/webgl/textreplay.test.js index 6f5a5274ad..14debc1c44 100644 --- a/test/spec/ol/render/webgl/textreplay.test.js +++ b/test/spec/ol/render/webgl/textreplay.test.js @@ -2,7 +2,7 @@ import {createCanvasContext2D} from '../../../../../src/ol/dom.js'; import Point from '../../../../../src/ol/geom/Point.js'; import _ol_render_webgl_TextReplay_ from '../../../../../src/ol/render/webgl/TextReplay.js'; import Fill from '../../../../../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../../src/ol/style/Stroke.js'; import _ol_style_Text_ from '../../../../../src/ol/style/Text.js'; describe('ol.render.webgl.TextReplay', function() { @@ -40,7 +40,7 @@ describe('ol.render.webgl.TextReplay', function() { new Fill({ color: [0, 0, 0, 1] }), - new _ol_style_Stroke_({ + new Stroke({ width: 1, color: [0, 0, 0, 1], lineCap: 'butt', @@ -54,7 +54,7 @@ describe('ol.render.webgl.TextReplay', function() { new Fill({ color: [255, 255, 255, 1] }), - new _ol_style_Stroke_({ + new Stroke({ width: 1, color: [255, 255, 255, 1] }), @@ -65,7 +65,7 @@ describe('ol.render.webgl.TextReplay', function() { new Fill({ color: [0, 0, 0, 1] }), - new _ol_style_Stroke_({ + new Stroke({ width: 1, color: [0, 0, 0, 1] }), diff --git a/test/spec/ol/renderer/canvas/replay.test.js b/test/spec/ol/renderer/canvas/replay.test.js index 51f5ac65eb..dd48156ddd 100644 --- a/test/spec/ol/renderer/canvas/replay.test.js +++ b/test/spec/ol/renderer/canvas/replay.test.js @@ -13,7 +13,7 @@ import _ol_render_canvas_Replay_ from '../../../../../src/ol/render/canvas/Repla 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_Stroke_ from '../../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../../src/ol/style/Stroke.js'; import Style from '../../../../../src/ol/style/Style.js'; import _ol_transform_ from '../../../../../src/ol/transform.js'; @@ -45,11 +45,11 @@ describe('ol.render.canvas.ReplayGroup', function() { }); style1 = new Style({ fill: new Fill({color: 'black'}), - stroke: new _ol_style_Stroke_({color: 'white', width: 1}) + stroke: new Stroke({color: 'white', width: 1}) }); style2 = new Style({ fill: new Fill({color: 'white'}), - stroke: new _ol_style_Stroke_({color: 'black', width: 1, lineDash: [3, 6], + stroke: new Stroke({color: 'black', width: 1, lineDash: [3, 6], lineDashOffset: 2}) }); fillCount = 0; @@ -448,7 +448,7 @@ describe('ol.render.canvas.LineStringReplay', function() { var resolution = 10; var replay = new _ol_render_canvas_LineStringReplay_(tolerance, extent, resolution); - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ width: 2 }); replay.setFillStrokeStyle(null, stroke); @@ -476,7 +476,7 @@ describe('ol.render.canvas.PolygonReplay', function() { it('returns correct offset', function() { var coords = [1, 2, 3, 4, 5, 6, 1, 2, 1, 2, 3, 4, 5, 6, 1, 2]; var ends = [7, 14]; - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ width: 5 }); replay.setFillStrokeStyle(null, stroke); @@ -491,7 +491,7 @@ describe('ol.render.canvas.PolygonReplay', function() { describe('#getBufferedMaxExtent()', function() { it('buffers the max extent to accommodate stroke width', function() { - var stroke = new _ol_style_Stroke_({ + var stroke = new Stroke({ width: 5 }); replay.setFillStrokeStyle(null, stroke); diff --git a/test/spec/ol/renderer/vector.test.js b/test/spec/ol/renderer/vector.test.js index 62f86af42d..d587050f73 100644 --- a/test/spec/ol/renderer/vector.test.js +++ b/test/spec/ol/renderer/vector.test.js @@ -10,7 +10,7 @@ import _ol_render_canvas_ReplayGroup_ from '../../../../src/ol/render/canvas/Rep 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 _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; import Style from '../../../../src/ol/style/Style.js'; import Feature from '../../../../src/ol/Feature.js'; @@ -30,7 +30,7 @@ describe('ol.renderer.vector', function() { style = new Style({ image: iconStyle, fill: new Fill({}), - stroke: new _ol_style_Stroke_({}) + stroke: new Stroke({}) }); squaredTolerance = 1; listener = function() {}; diff --git a/test/spec/ol/style/circle.test.js b/test/spec/ol/style/circle.test.js index f1f8c834b3..114694b29c 100644 --- a/test/spec/ol/style/circle.test.js +++ b/test/spec/ol/style/circle.test.js @@ -1,7 +1,7 @@ import AtlasManager from '../../../../src/ol/style/AtlasManager.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import Fill from '../../../../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; describe('ol.style.Circle', function() { @@ -88,7 +88,7 @@ describe('ol.style.Circle', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }), radius: 5, @@ -110,7 +110,7 @@ describe('ol.style.Circle', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); @@ -161,7 +161,7 @@ describe('ol.style.Circle', function() { }); var style2 = new _ol_style_Circle_({ radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); @@ -174,7 +174,7 @@ describe('ol.style.Circle', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', lineCap: 'round', lineDash: [5, 15, 25], @@ -188,7 +188,7 @@ describe('ol.style.Circle', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', lineCap: 'round', lineDash: [5, 15, 25], @@ -206,7 +206,7 @@ describe('ol.style.Circle', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', lineCap: 'round', lineDash: [5, 15, 25], @@ -220,7 +220,7 @@ describe('ol.style.Circle', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', lineCap: 'round', lineDash: [5, 15, 25], @@ -238,7 +238,7 @@ describe('ol.style.Circle', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); @@ -247,7 +247,7 @@ describe('ol.style.Circle', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); @@ -263,7 +263,7 @@ describe('ol.style.Circle', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); @@ -272,7 +272,7 @@ describe('ol.style.Circle', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); diff --git a/test/spec/ol/style/regularshape.test.js b/test/spec/ol/style/regularshape.test.js index 7d2c90e3ae..41ab809858 100644 --- a/test/spec/ol/style/regularshape.test.js +++ b/test/spec/ol/style/regularshape.test.js @@ -1,7 +1,7 @@ import AtlasManager from '../../../../src/ol/style/AtlasManager.js'; import _ol_style_RegularShape_ from '../../../../src/ol/style/RegularShape.js'; import Fill from '../../../../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; describe('ol.style.RegularShape', function() { @@ -122,7 +122,7 @@ describe('ol.style.RegularShape', function() { radius2: 6, angle: 1, snapToPixel: false, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }), rotation: 2, @@ -149,7 +149,7 @@ describe('ol.style.RegularShape', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); @@ -210,7 +210,7 @@ describe('ol.style.RegularShape', function() { }); var style2 = new _ol_style_RegularShape_({ radius: 5, - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); @@ -226,7 +226,7 @@ describe('ol.style.RegularShape', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', lineCap: 'round', lineDash: [5, 15, 25], @@ -243,7 +243,7 @@ describe('ol.style.RegularShape', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', lineCap: 'round', lineDash: [5, 15, 25], @@ -264,7 +264,7 @@ describe('ol.style.RegularShape', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', lineCap: 'round', lineDash: [5, 15, 25], @@ -281,7 +281,7 @@ describe('ol.style.RegularShape', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3', lineCap: 'round', lineDash: [5, 15, 25], @@ -299,7 +299,7 @@ describe('ol.style.RegularShape', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); @@ -308,7 +308,7 @@ describe('ol.style.RegularShape', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); @@ -324,7 +324,7 @@ describe('ol.style.RegularShape', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); @@ -333,7 +333,7 @@ describe('ol.style.RegularShape', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); diff --git a/test/spec/ol/style/stroke.test.js b/test/spec/ol/style/stroke.test.js index d16f42094a..93ee01f123 100644 --- a/test/spec/ol/style/stroke.test.js +++ b/test/spec/ol/style/stroke.test.js @@ -1,18 +1,18 @@ -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; describe('ol.style.Stroke', function() { describe('#clone', function() { it('creates a new ol.style.Stroke', function() { - var original = new _ol_style_Stroke_(); + var original = new Stroke(); var clone = original.clone(); - expect(clone).to.be.an(_ol_style_Stroke_); + expect(clone).to.be.an(Stroke); expect(clone).to.not.be(original); }); it('copies all values', function() { - var original = new _ol_style_Stroke_({ + var original = new Stroke({ color: '#319FD3', lineCap: 'square', lineJoin: 'miter', @@ -32,7 +32,7 @@ describe('ol.style.Stroke', function() { }); it('the clone does not reference the same objects as the original', function() { - var original = new _ol_style_Stroke_({ + var original = new Stroke({ color: [1, 2, 3, 0.4], lineDash: [1, 2, 3] }); diff --git a/test/spec/ol/style/style.test.js b/test/spec/ol/style/style.test.js index 7eca154061..06b8962b6c 100644 --- a/test/spec/ol/style/style.test.js +++ b/test/spec/ol/style/style.test.js @@ -3,7 +3,7 @@ import Point from '../../../../src/ol/geom/Point.js'; 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 _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; @@ -13,7 +13,7 @@ describe('ol.style.Style', function() { color: 'rgba(255, 255, 255, 0.6)' }); - var testStroke = new _ol_style_Stroke_({ + var testStroke = new Stroke({ color: '#319FD3', width: 1 }); @@ -23,7 +23,7 @@ describe('ol.style.Style', function() { fill: new Fill({ color: '#000' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#fff', width: 3 }) @@ -51,7 +51,7 @@ describe('ol.style.Style', function() { image: new _ol_style_Circle_({ radius: 5 }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }), text: new _ol_style_Text_({ @@ -77,7 +77,7 @@ describe('ol.style.Style', function() { image: new _ol_style_Circle_({ radius: 5 }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }), text: new _ol_style_Text_({ diff --git a/test/spec/ol/style/text.test.js b/test/spec/ol/style/text.test.js index 5baa6d6085..045ecc6675 100644 --- a/test/spec/ol/style/text.test.js +++ b/test/spec/ol/style/text.test.js @@ -1,5 +1,5 @@ import Fill from '../../../../src/ol/style/Fill.js'; -import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js'; +import Stroke from '../../../../src/ol/style/Stroke.js'; import _ol_style_Text_ from '../../../../src/ol/style/Text.js'; @@ -50,13 +50,13 @@ describe('ol.style.Text', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }), backgroundFill: new Fill({ color: 'white' }), - backgroundStroke: new _ol_style_Stroke_({ + backgroundStroke: new Stroke({ color: 'black' }) }); @@ -81,7 +81,7 @@ describe('ol.style.Text', function() { fill: new Fill({ color: '#319FD3' }), - stroke: new _ol_style_Stroke_({ + stroke: new Stroke({ color: '#319FD3' }) }); From fb22c587f8f66ecf7bda39f50f2b0dcbb776c8ad Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 13:25:01 -0700 Subject: [PATCH 27/35] 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 }); From c5a4be2edd614ae9c8f29ef104d7d3051c34399d Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 13:25:48 -0700 Subject: [PATCH 28/35] Rename _ol_style_Text_ to Text --- examples/cluster.js | 4 +- examples/earthquake-clusters.js | 4 +- examples/image-vector-layer.js | 4 +- examples/mapbox-vector-tiles-advanced.js | 4 +- examples/mapbox-vector-tiles.js | 4 +- examples/street-labels.js | 4 +- examples/topolis.js | 8 +- examples/vector-label-decluttering.js | 4 +- examples/vector-labels.js | 4 +- examples/vector-layer.js | 6 +- src/ol/Graticule.js | 6 +- src/ol/format/KML.js | 6 +- src/ol/style/Text.js | 78 +++++++++---------- test/rendering/ol/layer/vector.test.js | 16 ++-- test/rendering/ol/layer/vectortile.test.js | 4 +- test/rendering/ol/style/text.test.js | 32 ++++---- test/spec/ol/format/kml.test.js | 6 +- test/spec/ol/graticule.test.js | 6 +- test/spec/ol/render/canvas/immediate.test.js | 4 +- test/spec/ol/render/canvas/textreplay.test.js | 10 +-- test/spec/ol/render/webgl/textreplay.test.js | 4 +- .../ol/renderer/canvas/vectorlayer.test.js | 12 +-- .../renderer/canvas/vectortilelayer.test.js | 8 +- test/spec/ol/style/style.test.js | 8 +- test/spec/ol/style/text.test.js | 16 ++-- 25 files changed, 131 insertions(+), 131 deletions(-) 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' }), From 16c8d2c246001fa748f91e1e8132131c3e3aaaa0 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 13:26:51 -0700 Subject: [PATCH 29/35] Rename _ol_style_RegularShape_ to RegularShape --- examples/earthquake-clusters.js | 4 +- examples/layer-z-index.js | 8 +-- examples/regularshape.js | 12 ++--- examples/symbol-atlas-webgl.js | 4 +- src/ol/style/Circle.js | 6 +-- src/ol/style/RegularShape.js | 54 +++++++++---------- test/rendering/ol/style/regularshape.test.js | 10 ++-- test/spec/ol/style/regularshape.test.js | 56 ++++++++++---------- 8 files changed, 77 insertions(+), 77 deletions(-) diff --git a/examples/earthquake-clusters.js b/examples/earthquake-clusters.js index 03992f1620..2afa0de9ee 100644 --- a/examples/earthquake-clusters.js +++ b/examples/earthquake-clusters.js @@ -11,7 +11,7 @@ import Stamen from '../src/ol/source/Stamen.js'; import VectorSource from '../src/ol/source/Vector.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; +import RegularShape from '../src/ol/style/RegularShape.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; import Text from '../src/ol/style/Text.js'; @@ -45,7 +45,7 @@ function createEarthquakeStyle(feature) { return new Style({ geometry: feature.getGeometry(), - image: new _ol_style_RegularShape_({ + image: new RegularShape({ radius1: radius, radius2: 3, points: 5, diff --git a/examples/layer-z-index.js b/examples/layer-z-index.js index e3921bebe7..b20297559c 100644 --- a/examples/layer-z-index.js +++ b/examples/layer-z-index.js @@ -5,7 +5,7 @@ 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 Fill from '../src/ol/style/Fill.js'; -import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; +import RegularShape from '../src/ol/style/RegularShape.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -14,7 +14,7 @@ var stroke = new Stroke({color: 'black', width: 1}); var styles = { 'square': new Style({ - image: new _ol_style_RegularShape_({ + image: new RegularShape({ fill: new Fill({color: 'blue'}), stroke: stroke, points: 4, @@ -23,7 +23,7 @@ var styles = { }) }), 'triangle': new Style({ - image: new _ol_style_RegularShape_({ + image: new RegularShape({ fill: new Fill({color: 'red'}), stroke: stroke, points: 3, @@ -33,7 +33,7 @@ var styles = { }) }), 'star': new Style({ - image: new _ol_style_RegularShape_({ + image: new RegularShape({ fill: new Fill({color: 'green'}), stroke: stroke, points: 5, diff --git a/examples/regularshape.js b/examples/regularshape.js index 74236462de..34f851515e 100644 --- a/examples/regularshape.js +++ b/examples/regularshape.js @@ -5,7 +5,7 @@ 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 Fill from '../src/ol/style/Fill.js'; -import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; +import RegularShape from '../src/ol/style/RegularShape.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -15,7 +15,7 @@ var fill = new Fill({color: 'red'}); var styles = { 'square': new Style({ - image: new _ol_style_RegularShape_({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 4, @@ -24,7 +24,7 @@ var styles = { }) }), 'triangle': new Style({ - image: new _ol_style_RegularShape_({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 3, @@ -34,7 +34,7 @@ var styles = { }) }), 'star': new Style({ - image: new _ol_style_RegularShape_({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 5, @@ -44,7 +44,7 @@ var styles = { }) }), 'cross': new Style({ - image: new _ol_style_RegularShape_({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 4, @@ -54,7 +54,7 @@ var styles = { }) }), 'x': new Style({ - image: new _ol_style_RegularShape_({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 4, diff --git a/examples/symbol-atlas-webgl.js b/examples/symbol-atlas-webgl.js index e470aec390..1e1153098d 100644 --- a/examples/symbol-atlas-webgl.js +++ b/examples/symbol-atlas-webgl.js @@ -7,7 +7,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import AtlasManager from '../src/ol/style/AtlasManager.js'; import _ol_style_Circle_ from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_RegularShape_ from '../src/ol/style/RegularShape.js'; +import RegularShape from '../src/ol/style/RegularShape.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -64,7 +64,7 @@ for (i = 0; i < symbolInfo.length; ++i) { })); // star symbol - symbols.push(new _ol_style_RegularShape_({ + symbols.push(new RegularShape({ points: 8, opacity: info.opacity, scale: info.scale, diff --git a/src/ol/style/Circle.js b/src/ol/style/Circle.js index 3cb75c995a..a2d9215edb 100644 --- a/src/ol/style/Circle.js +++ b/src/ol/style/Circle.js @@ -2,7 +2,7 @@ * @module ol/style/Circle */ import {inherits} from '../index.js'; -import _ol_style_RegularShape_ from '../style/RegularShape.js'; +import RegularShape from '../style/RegularShape.js'; /** * @classdesc @@ -17,7 +17,7 @@ var _ol_style_Circle_ = function(opt_options) { var options = opt_options || {}; - _ol_style_RegularShape_.call(this, { + RegularShape.call(this, { points: Infinity, fill: options.fill, radius: options.radius, @@ -28,7 +28,7 @@ var _ol_style_Circle_ = function(opt_options) { }; -inherits(_ol_style_Circle_, _ol_style_RegularShape_); +inherits(_ol_style_Circle_, RegularShape); /** diff --git a/src/ol/style/RegularShape.js b/src/ol/style/RegularShape.js index c08d7066bb..84babb07e0 100644 --- a/src/ol/style/RegularShape.js +++ b/src/ol/style/RegularShape.js @@ -20,7 +20,7 @@ import _ol_style_Image_ from '../style/Image.js'; * @extends {ol.style.Image} * @api */ -var _ol_style_RegularShape_ = function(options) { +var RegularShape = function(options) { /** * @private * @type {Array.} @@ -135,7 +135,7 @@ var _ol_style_RegularShape_ = function(options) { }); }; -inherits(_ol_style_RegularShape_, _ol_style_Image_); +inherits(RegularShape, _ol_style_Image_); /** @@ -143,8 +143,8 @@ inherits(_ol_style_RegularShape_, _ol_style_Image_); * @return {ol.style.RegularShape} The cloned style. * @api */ -_ol_style_RegularShape_.prototype.clone = function() { - var style = new _ol_style_RegularShape_({ +RegularShape.prototype.clone = function() { + var style = new RegularShape({ fill: this.getFill() ? this.getFill().clone() : undefined, points: this.getPoints(), radius: this.getRadius(), @@ -166,7 +166,7 @@ _ol_style_RegularShape_.prototype.clone = function() { * @inheritDoc * @api */ -_ol_style_RegularShape_.prototype.getAnchor = function() { +RegularShape.prototype.getAnchor = function() { return this.anchor_; }; @@ -176,7 +176,7 @@ _ol_style_RegularShape_.prototype.getAnchor = function() { * @return {number} Shape's rotation in radians. * @api */ -_ol_style_RegularShape_.prototype.getAngle = function() { +RegularShape.prototype.getAngle = function() { return this.angle_; }; @@ -186,7 +186,7 @@ _ol_style_RegularShape_.prototype.getAngle = function() { * @return {ol.style.Fill} Fill style. * @api */ -_ol_style_RegularShape_.prototype.getFill = function() { +RegularShape.prototype.getFill = function() { return this.fill_; }; @@ -194,7 +194,7 @@ _ol_style_RegularShape_.prototype.getFill = function() { /** * @inheritDoc */ -_ol_style_RegularShape_.prototype.getHitDetectionImage = function(pixelRatio) { +RegularShape.prototype.getHitDetectionImage = function(pixelRatio) { return this.hitDetectionCanvas_; }; @@ -203,7 +203,7 @@ _ol_style_RegularShape_.prototype.getHitDetectionImage = function(pixelRatio) { * @inheritDoc * @api */ -_ol_style_RegularShape_.prototype.getImage = function(pixelRatio) { +RegularShape.prototype.getImage = function(pixelRatio) { return this.canvas_; }; @@ -211,7 +211,7 @@ _ol_style_RegularShape_.prototype.getImage = function(pixelRatio) { /** * @inheritDoc */ -_ol_style_RegularShape_.prototype.getImageSize = function() { +RegularShape.prototype.getImageSize = function() { return this.imageSize_; }; @@ -219,7 +219,7 @@ _ol_style_RegularShape_.prototype.getImageSize = function() { /** * @inheritDoc */ -_ol_style_RegularShape_.prototype.getHitDetectionImageSize = function() { +RegularShape.prototype.getHitDetectionImageSize = function() { return this.hitDetectionImageSize_; }; @@ -227,7 +227,7 @@ _ol_style_RegularShape_.prototype.getHitDetectionImageSize = function() { /** * @inheritDoc */ -_ol_style_RegularShape_.prototype.getImageState = function() { +RegularShape.prototype.getImageState = function() { return ImageState.LOADED; }; @@ -236,7 +236,7 @@ _ol_style_RegularShape_.prototype.getImageState = function() { * @inheritDoc * @api */ -_ol_style_RegularShape_.prototype.getOrigin = function() { +RegularShape.prototype.getOrigin = function() { return this.origin_; }; @@ -246,7 +246,7 @@ _ol_style_RegularShape_.prototype.getOrigin = function() { * @return {number} Number of points for stars and regular polygons. * @api */ -_ol_style_RegularShape_.prototype.getPoints = function() { +RegularShape.prototype.getPoints = function() { return this.points_; }; @@ -256,7 +256,7 @@ _ol_style_RegularShape_.prototype.getPoints = function() { * @return {number} Radius. * @api */ -_ol_style_RegularShape_.prototype.getRadius = function() { +RegularShape.prototype.getRadius = function() { return this.radius_; }; @@ -266,7 +266,7 @@ _ol_style_RegularShape_.prototype.getRadius = function() { * @return {number|undefined} Radius2. * @api */ -_ol_style_RegularShape_.prototype.getRadius2 = function() { +RegularShape.prototype.getRadius2 = function() { return this.radius2_; }; @@ -275,7 +275,7 @@ _ol_style_RegularShape_.prototype.getRadius2 = function() { * @inheritDoc * @api */ -_ol_style_RegularShape_.prototype.getSize = function() { +RegularShape.prototype.getSize = function() { return this.size_; }; @@ -285,7 +285,7 @@ _ol_style_RegularShape_.prototype.getSize = function() { * @return {ol.style.Stroke} Stroke style. * @api */ -_ol_style_RegularShape_.prototype.getStroke = function() { +RegularShape.prototype.getStroke = function() { return this.stroke_; }; @@ -293,26 +293,26 @@ _ol_style_RegularShape_.prototype.getStroke = function() { /** * @inheritDoc */ -_ol_style_RegularShape_.prototype.listenImageChange = function(listener, thisArg) {}; +RegularShape.prototype.listenImageChange = function(listener, thisArg) {}; /** * @inheritDoc */ -_ol_style_RegularShape_.prototype.load = function() {}; +RegularShape.prototype.load = function() {}; /** * @inheritDoc */ -_ol_style_RegularShape_.prototype.unlistenImageChange = function(listener, thisArg) {}; +RegularShape.prototype.unlistenImageChange = function(listener, thisArg) {}; /** * @protected * @param {ol.style.AtlasManager|undefined} atlasManager An atlas manager. */ -_ol_style_RegularShape_.prototype.render_ = function(atlasManager) { +RegularShape.prototype.render_ = function(atlasManager) { var imageSize; var lineCap = ''; var lineJoin = ''; @@ -422,7 +422,7 @@ _ol_style_RegularShape_.prototype.render_ = function(atlasManager) { * @param {number} x The origin for the symbol (x). * @param {number} y The origin for the symbol (y). */ -_ol_style_RegularShape_.prototype.draw_ = function(renderOptions, context, x, y) { +RegularShape.prototype.draw_ = function(renderOptions, context, x, y) { var i, angle0, radiusC; // reset transform context.setTransform(1, 0, 0, 1, 0, 0); @@ -480,7 +480,7 @@ _ol_style_RegularShape_.prototype.draw_ = function(renderOptions, context, x, y) * @private * @param {ol.RegularShapeRenderOptions} renderOptions Render options. */ -_ol_style_RegularShape_.prototype.createHitDetectionCanvas_ = function(renderOptions) { +RegularShape.prototype.createHitDetectionCanvas_ = function(renderOptions) { this.hitDetectionImageSize_ = [renderOptions.size, renderOptions.size]; if (this.fill_) { this.hitDetectionCanvas_ = this.canvas_; @@ -503,7 +503,7 @@ _ol_style_RegularShape_.prototype.createHitDetectionCanvas_ = function(renderOpt * @param {number} x The origin for the symbol (x). * @param {number} y The origin for the symbol (y). */ -_ol_style_RegularShape_.prototype.drawHitDetectionCanvas_ = function(renderOptions, context, x, y) { +RegularShape.prototype.drawHitDetectionCanvas_ = function(renderOptions, context, x, y) { // reset transform context.setTransform(1, 0, 0, 1, 0, 0); @@ -550,7 +550,7 @@ _ol_style_RegularShape_.prototype.drawHitDetectionCanvas_ = function(renderOptio /** * @return {string} The checksum. */ -_ol_style_RegularShape_.prototype.getChecksum = function() { +RegularShape.prototype.getChecksum = function() { var strokeChecksum = this.stroke_ ? this.stroke_.getChecksum() : '-'; var fillChecksum = this.fill_ ? @@ -576,4 +576,4 @@ _ol_style_RegularShape_.prototype.getChecksum = function() { return this.checksums_[0]; }; -export default _ol_style_RegularShape_; +export default RegularShape; diff --git a/test/rendering/ol/style/regularshape.test.js b/test/rendering/ol/style/regularshape.test.js index 508387b077..fca045054e 100644 --- a/test/rendering/ol/style/regularshape.test.js +++ b/test/rendering/ol/style/regularshape.test.js @@ -5,7 +5,7 @@ import View from '../../../../src/ol/View.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; import Fill from '../../../../src/ol/style/Fill.js'; -import _ol_style_RegularShape_ from '../../../../src/ol/style/RegularShape.js'; +import RegularShape from '../../../../src/ol/style/RegularShape.js'; import Style from '../../../../src/ol/style/Style.js'; import Stroke from '../../../../src/ol/style/Stroke.js'; @@ -47,7 +47,7 @@ describe('ol.rendering.style.RegularShape', function() { }); // square feature.setStyle(new Style({ - image: new _ol_style_RegularShape_({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 4, @@ -62,7 +62,7 @@ describe('ol.rendering.style.RegularShape', function() { }); // triangle feature.setStyle(new Style({ - image: new _ol_style_RegularShape_({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 3, @@ -78,7 +78,7 @@ describe('ol.rendering.style.RegularShape', function() { }); // star feature.setStyle(new Style({ - image: new _ol_style_RegularShape_({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 5, @@ -94,7 +94,7 @@ describe('ol.rendering.style.RegularShape', function() { }); // cross feature.setStyle(new Style({ - image: new _ol_style_RegularShape_({ + image: new RegularShape({ fill: fill, stroke: stroke, points: 4, diff --git a/test/spec/ol/style/regularshape.test.js b/test/spec/ol/style/regularshape.test.js index 41ab809858..e0a96ebad4 100644 --- a/test/spec/ol/style/regularshape.test.js +++ b/test/spec/ol/style/regularshape.test.js @@ -1,5 +1,5 @@ import AtlasManager from '../../../../src/ol/style/AtlasManager.js'; -import _ol_style_RegularShape_ from '../../../../src/ol/style/RegularShape.js'; +import RegularShape from '../../../../src/ol/style/RegularShape.js'; import Fill from '../../../../src/ol/style/Fill.js'; import Stroke from '../../../../src/ol/style/Stroke.js'; @@ -9,7 +9,7 @@ describe('ol.style.RegularShape', function() { describe('#constructor', function() { it('can use rotateWithView', function() { - var style = new _ol_style_RegularShape_({ + var style = new RegularShape({ rotateWithView: true, radius: 0 }); @@ -17,7 +17,7 @@ describe('ol.style.RegularShape', function() { }); it('can use radius', function() { - var style = new _ol_style_RegularShape_({ + var style = new RegularShape({ radius: 5, radius2: 10 }); @@ -26,7 +26,7 @@ describe('ol.style.RegularShape', function() { }); it('can use radius1 as an alias for radius', function() { - var style = new _ol_style_RegularShape_({ + var style = new RegularShape({ radius1: 5, radius2: 10 }); @@ -35,7 +35,7 @@ describe('ol.style.RegularShape', function() { }); it('creates a canvas if no atlas is used (no fill-style)', function() { - var style = new _ol_style_RegularShape_({radius: 10}); + var style = new RegularShape({radius: 10}); expect(style.getImage()).to.be.an(HTMLCanvasElement); expect(style.getSize()).to.eql([21, 21]); expect(style.getImageSize()).to.eql([21, 21]); @@ -48,7 +48,7 @@ describe('ol.style.RegularShape', function() { }); it('creates a canvas if no atlas is used (fill-style)', function() { - var style = new _ol_style_RegularShape_({ + var style = new RegularShape({ radius: 10, fill: new Fill({ color: '#FFFF00' @@ -67,7 +67,7 @@ describe('ol.style.RegularShape', function() { it('adds itself to an atlas manager (no fill-style)', function() { var atlasManager = new AtlasManager({initialSize: 512}); - var style = new _ol_style_RegularShape_( + var style = new RegularShape( {radius: 10, atlasManager: atlasManager}); expect(style.getImage()).to.be.an(HTMLCanvasElement); expect(style.getSize()).to.eql([21, 21]); @@ -82,7 +82,7 @@ describe('ol.style.RegularShape', function() { it('adds itself to an atlas manager (fill-style)', function() { var atlasManager = new AtlasManager({initialSize: 512}); - var style = new _ol_style_RegularShape_({ + var style = new RegularShape({ radius: 10, atlasManager: atlasManager, fill: new Fill({ @@ -104,16 +104,16 @@ describe('ol.style.RegularShape', function() { describe('#clone', function() { it('creates a new ol.style.RegularShape', function() { - var original = new _ol_style_RegularShape_({ + var original = new RegularShape({ points: 5 }); var clone = original.clone(); - expect(clone).to.be.an(_ol_style_RegularShape_); + expect(clone).to.be.an(RegularShape); expect(clone).to.not.be(original); }); it('copies all values', function() { - var original = new _ol_style_RegularShape_({ + var original = new RegularShape({ fill: new Fill({ color: '#319FD3' }), @@ -145,7 +145,7 @@ describe('ol.style.RegularShape', function() { }); it('the clone does not reference the same objects as the original', function() { - var original = new _ol_style_RegularShape_({ + var original = new RegularShape({ fill: new Fill({ color: '#319FD3' }), @@ -168,11 +168,11 @@ describe('ol.style.RegularShape', function() { describe('#getChecksum', function() { it('calculates not the same hash code (radius)', function() { - var style1 = new _ol_style_RegularShape_({ + var style1 = new RegularShape({ radius: 4, radius2: 5 }); - var style2 = new _ol_style_RegularShape_({ + var style2 = new RegularShape({ radius: 3, radius2: 5 }); @@ -180,11 +180,11 @@ describe('ol.style.RegularShape', function() { }); it('calculates not the same hash code (radius2)', function() { - var style1 = new _ol_style_RegularShape_({ + var style1 = new RegularShape({ radius: 4, radius2: 5 }); - var style2 = new _ol_style_RegularShape_({ + var style2 = new RegularShape({ radius: 4, radius2: 6 }); @@ -192,23 +192,23 @@ describe('ol.style.RegularShape', function() { }); it('calculates the same hash code (radius)', function() { - var style1 = new _ol_style_RegularShape_({ + var style1 = new RegularShape({ radius: 5 }); - var style2 = new _ol_style_RegularShape_({ + var style2 = new RegularShape({ radius: 5 }); expect(style1.getChecksum()).to.eql(style2.getChecksum()); }); it('calculates not the same hash code (color)', function() { - var style1 = new _ol_style_RegularShape_({ + var style1 = new RegularShape({ radius: 5, fill: new Fill({ color: '#319FD3' }) }); - var style2 = new _ol_style_RegularShape_({ + var style2 = new RegularShape({ radius: 5, stroke: new Stroke({ color: '#319FD3' @@ -218,7 +218,7 @@ describe('ol.style.RegularShape', function() { }); it('calculates the same hash code (everything set)', function() { - var style1 = new _ol_style_RegularShape_({ + var style1 = new RegularShape({ radius: 5, radius2: 3, angle: 1.41, @@ -235,7 +235,7 @@ describe('ol.style.RegularShape', function() { width: 2 }) }); - var style2 = new _ol_style_RegularShape_({ + var style2 = new RegularShape({ radius: 5, radius2: 3, angle: 1.41, @@ -256,7 +256,7 @@ describe('ol.style.RegularShape', function() { }); it('calculates not the same hash code (stroke width differs)', function() { - var style1 = new _ol_style_RegularShape_({ + var style1 = new RegularShape({ radius: 5, radius2: 3, angle: 1.41, @@ -273,7 +273,7 @@ describe('ol.style.RegularShape', function() { width: 3 }) }); - var style2 = new _ol_style_RegularShape_({ + var style2 = new RegularShape({ radius: 5, radius2: 3, angle: 1.41, @@ -294,7 +294,7 @@ describe('ol.style.RegularShape', function() { }); it('invalidates a cached checksum if values change (fill)', function() { - var style1 = new _ol_style_RegularShape_({ + var style1 = new RegularShape({ radius: 5, fill: new Fill({ color: '#319FD3' @@ -303,7 +303,7 @@ describe('ol.style.RegularShape', function() { color: '#319FD3' }) }); - var style2 = new _ol_style_RegularShape_({ + var style2 = new RegularShape({ radius: 5, fill: new Fill({ color: '#319FD3' @@ -319,7 +319,7 @@ describe('ol.style.RegularShape', function() { }); it('invalidates a cached checksum if values change (stroke)', function() { - var style1 = new _ol_style_RegularShape_({ + var style1 = new RegularShape({ radius: 5, fill: new Fill({ color: '#319FD3' @@ -328,7 +328,7 @@ describe('ol.style.RegularShape', function() { color: '#319FD3' }) }); - var style2 = new _ol_style_RegularShape_({ + var style2 = new RegularShape({ radius: 5, fill: new Fill({ color: '#319FD3' From 14ddcf843dc82cc3fb78d7814609e9b156a94f7a Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 13:27:54 -0700 Subject: [PATCH 30/35] Rename _ol_style_Circle_ to CircleStyle --- examples/blend-modes.js | 8 +-- examples/center.js | 4 +- examples/cluster.js | 4 +- examples/drag-and-drop-image-vector.js | 6 +-- examples/drag-and-drop.js | 6 +-- examples/draw-and-modify-features.js | 4 +- examples/dynamic-data.js | 8 +-- examples/earthquake-clusters.js | 6 +-- examples/feature-animation.js | 4 +- examples/feature-move-animation.js | 4 +- examples/geojson.js | 6 +-- examples/geolocation.js | 4 +- examples/gpx.js | 4 +- examples/igc.js | 6 +-- examples/kml-earthquakes.js | 4 +- examples/measure.js | 6 +-- examples/modify-test.js | 6 +-- examples/polygon-styles.js | 4 +- examples/render-geometry.js | 4 +- examples/snap.js | 4 +- examples/symbol-atlas-webgl.js | 4 +- examples/synthetic-points.js | 8 +-- examples/topolis.js | 4 +- examples/vector-labels.js | 4 +- examples/vector-osm.js | 4 +- src/ol/style/Circle.js | 12 ++--- src/ol/style/Style.js | 6 +-- test/rendering/ol/layer/tile.test.js | 4 +- test/rendering/ol/layer/vector.test.js | 16 +++--- test/rendering/ol/layer/vectortile.test.js | 6 +-- test/rendering/ol/render.test.js | 4 +- test/rendering/ol/style/circle.test.js | 20 ++++---- test/spec/ol/format/kml.test.js | 4 +- test/spec/ol/render/canvas/immediate.test.js | 4 +- test/spec/ol/render/webgl/immediate.test.js | 4 +- test/spec/ol/style/circle.test.js | 52 ++++++++++---------- test/spec/ol/style/style.test.js | 8 +-- 37 files changed, 133 insertions(+), 133 deletions(-) diff --git a/examples/blend-modes.js b/examples/blend-modes.js index 3c588f8775..45e900d178 100644 --- a/examples/blend-modes.js +++ b/examples/blend-modes.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_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -19,7 +19,7 @@ var redLayer = new VectorLayer({ features: [new Feature(new Point([0, 0]))] }), style: new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ fill: new Fill({ color: 'rgba(255,0,0,0.8)' }), @@ -37,7 +37,7 @@ var greenLayer = new VectorLayer({ features: [new Feature(new Point([250, 433.013]))] }), style: new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ fill: new Fill({ color: 'rgba(0,255,0,0.8)' }), @@ -54,7 +54,7 @@ var blueLayer = new VectorLayer({ features: [new Feature(new Point([500, 0]))] }), style: new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ fill: new Fill({ color: 'rgba(0,0,255,0.8)' }), diff --git a/examples/center.js b/examples/center.js index 2bce5d3093..f63b37e2de 100644 --- a/examples/center.js +++ b/examples/center.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_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -23,7 +23,7 @@ var style = new Style({ color: '#319FD3', width: 1 }), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 5, fill: new Fill({ color: 'rgba(255, 255, 255, 0.6)' diff --git a/examples/cluster.js b/examples/cluster.js index bd95ecda01..8016547cad 100644 --- a/examples/cluster.js +++ b/examples/cluster.js @@ -7,7 +7,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import Cluster from '../src/ol/source/Cluster.js'; import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -41,7 +41,7 @@ var clusters = new VectorLayer({ var style = styleCache[size]; if (!style) { style = new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 10, stroke: new Stroke({ color: '#fff' diff --git a/examples/drag-and-drop-image-vector.js b/examples/drag-and-drop-image-vector.js index 0de0a04861..4678ffbee0 100644 --- a/examples/drag-and-drop-image-vector.js +++ b/examples/drag-and-drop-image-vector.js @@ -11,7 +11,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import TileLayer from '../src/ol/layer/Tile.js'; import BingMaps from '../src/ol/source/BingMaps.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -19,7 +19,7 @@ import Style from '../src/ol/style/Style.js'; var defaultStyle = { 'Point': new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ fill: new Fill({ color: 'rgba(255,255,0,0.5)' }), @@ -46,7 +46,7 @@ var defaultStyle = { }) }), 'MultiPoint': new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ fill: new Fill({ color: 'rgba(255,0,255,0.5)' }), diff --git a/examples/drag-and-drop.js b/examples/drag-and-drop.js index 86fd5b0d21..4bfdd07686 100644 --- a/examples/drag-and-drop.js +++ b/examples/drag-and-drop.js @@ -11,7 +11,7 @@ import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import BingMaps from '../src/ol/source/BingMaps.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -19,7 +19,7 @@ import Style from '../src/ol/style/Style.js'; var defaultStyle = { 'Point': new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ fill: new Fill({ color: 'rgba(255,255,0,0.5)' }), @@ -46,7 +46,7 @@ var defaultStyle = { }) }), 'MultiPoint': new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ fill: new Fill({ color: 'rgba(255,0,255,0.5)' }), diff --git a/examples/draw-and-modify-features.js b/examples/draw-and-modify-features.js index 4ce15fcac4..19cab51e58 100644 --- a/examples/draw-and-modify-features.js +++ b/examples/draw-and-modify-features.js @@ -7,7 +7,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_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -27,7 +27,7 @@ var vector = new VectorLayer({ color: '#ffcc33', width: 2 }), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 7, fill: new Fill({ color: '#ffcc33' diff --git a/examples/dynamic-data.js b/examples/dynamic-data.js index d6857adce4..320aec8bb1 100644 --- a/examples/dynamic-data.js +++ b/examples/dynamic-data.js @@ -4,7 +4,7 @@ import MultiPoint from '../src/ol/geom/MultiPoint.js'; import Point from '../src/ol/geom/Point.js'; import TileLayer from '../src/ol/layer/Tile.js'; import OSM from '../src/ol/source/OSM.js'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -24,7 +24,7 @@ var map = new Map({ }); var imageStyle = new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 5, snapToPixel: false, fill: new Fill({color: 'yellow'}), @@ -33,7 +33,7 @@ var imageStyle = new Style({ }); var headInnerImageStyle = new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 2, snapToPixel: false, fill: new Fill({color: 'blue'}) @@ -41,7 +41,7 @@ var headInnerImageStyle = new Style({ }); var headOuterImageStyle = new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 5, snapToPixel: false, fill: new Fill({color: 'black'}) diff --git a/examples/earthquake-clusters.js b/examples/earthquake-clusters.js index 2afa0de9ee..c6131c996a 100644 --- a/examples/earthquake-clusters.js +++ b/examples/earthquake-clusters.js @@ -9,7 +9,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import Cluster from '../src/ol/source/Cluster.js'; import Stamen from '../src/ol/source/Stamen.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import RegularShape from '../src/ol/style/RegularShape.js'; import Stroke from '../src/ol/style/Stroke.js'; @@ -86,7 +86,7 @@ function styleFunction(feature, resolution) { var size = feature.get('features').length; if (size > 1) { style = new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: feature.get('radius'), fill: new Fill({ color: [255, 153, 0, Math.min(0.8, 0.4 + (size / maxFeatureCount))] @@ -107,7 +107,7 @@ function styleFunction(feature, resolution) { function selectStyleFunction(feature) { var styles = [new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: feature.get('radius'), fill: invisibleFill }) diff --git a/examples/feature-animation.js b/examples/feature-animation.js index aef9b4ef19..442e971df2 100644 --- a/examples/feature-animation.js +++ b/examples/feature-animation.js @@ -10,7 +10,7 @@ import VectorLayer from '../src/ol/layer/Vector.js'; import {fromLonLat} from '../src/ol/proj.js'; import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -67,7 +67,7 @@ function flash(feature) { var opacity = easeOut(1 - elapsedRatio); var style = new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: radius, snapToPixel: false, stroke: new Stroke({ diff --git a/examples/feature-move-animation.js b/examples/feature-move-animation.js index 2d9d74199d..fd34c697c1 100644 --- a/examples/feature-move-animation.js +++ b/examples/feature-move-animation.js @@ -7,7 +7,7 @@ import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import BingMaps from '../src/ol/source/BingMaps.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Icon from '../src/ol/style/Icon.js'; import Stroke from '../src/ol/style/Stroke.js'; @@ -97,7 +97,7 @@ var styles = { }) }), 'geoMarker': new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 7, snapToPixel: false, fill: new Fill({color: 'black'}), diff --git a/examples/geojson.js b/examples/geojson.js index 58af905194..fa497be054 100644 --- a/examples/geojson.js +++ b/examples/geojson.js @@ -8,13 +8,13 @@ import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import OSM from '../src/ol/source/OSM.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; -var image = new _ol_style_Circle_({ +var image = new CircleStyle({ radius: 5, fill: null, stroke: new Stroke({color: 'red', width: 1}) @@ -66,7 +66,7 @@ var styles = { fill: new Fill({ color: 'magenta' }), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 10, fill: null, stroke: new Stroke({ diff --git a/examples/geolocation.js b/examples/geolocation.js index 782323b316..0df94b6ef1 100644 --- a/examples/geolocation.js +++ b/examples/geolocation.js @@ -8,7 +8,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_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -68,7 +68,7 @@ geolocation.on('change:accuracyGeometry', function() { var positionFeature = new Feature(); positionFeature.setStyle(new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 6, fill: new Fill({ color: '#3399CC' diff --git a/examples/gpx.js b/examples/gpx.js index dfc5652d69..2861e70c84 100644 --- a/examples/gpx.js +++ b/examples/gpx.js @@ -5,7 +5,7 @@ import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import BingMaps from '../src/ol/source/BingMaps.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -19,7 +19,7 @@ var raster = new TileLayer({ var style = { 'Point': new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ fill: new Fill({ color: 'rgba(255,255,0,0.4)' }), diff --git a/examples/igc.js b/examples/igc.js index fab2738d6a..2e42f2e9ae 100644 --- a/examples/igc.js +++ b/examples/igc.js @@ -9,7 +9,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_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -158,7 +158,7 @@ var stroke = new Stroke({ }); var style = new Style({ stroke: stroke, - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 5, fill: null, stroke: stroke @@ -179,7 +179,7 @@ var featureOverlay = new VectorLayer({ source: new VectorSource(), map: map, style: new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 5, fill: new Fill({ color: 'rgba(255,0,0,0.9)' diff --git a/examples/kml-earthquakes.js b/examples/kml-earthquakes.js index 621eb845e4..e785399ae0 100644 --- a/examples/kml-earthquakes.js +++ b/examples/kml-earthquakes.js @@ -5,7 +5,7 @@ import TileLayer from '../src/ol/layer/Tile.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import Stamen from '../src/ol/source/Stamen.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -22,7 +22,7 @@ var styleFunction = function(feature) { var style = styleCache[radius]; if (!style) { style = new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: radius, fill: new Fill({ color: 'rgba(255, 153, 0, 0.4)' diff --git a/examples/measure.js b/examples/measure.js index e42658c7d2..b829c289a9 100644 --- a/examples/measure.js +++ b/examples/measure.js @@ -10,7 +10,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_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -32,7 +32,7 @@ var vector = new VectorLayer({ color: '#ffcc33', width: 2 }), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 7, fill: new Fill({ color: '#ffcc33' @@ -189,7 +189,7 @@ function addInteraction() { lineDash: [10, 10], width: 2 }), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 5, stroke: new Stroke({ color: 'rgba(0, 0, 0, 0.7)' diff --git a/examples/modify-test.js b/examples/modify-test.js index 63bcc0a052..f6501c30c6 100644 --- a/examples/modify-test.js +++ b/examples/modify-test.js @@ -6,7 +6,7 @@ import Modify from '../src/ol/interaction/Modify.js'; import Select from '../src/ol/interaction/Select.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -14,7 +14,7 @@ import Style from '../src/ol/style/Style.js'; var styleFunction = (function() { var styles = {}; - var image = new _ol_style_Circle_({ + var image = new CircleStyle({ radius: 5, fill: null, stroke: new Stroke({color: 'orange', width: 2}) @@ -194,7 +194,7 @@ var overlayStyle = (function() { styles['Point'] = [ new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 7, fill: new Fill({ color: [0, 153, 255, 1] diff --git a/examples/polygon-styles.js b/examples/polygon-styles.js index 6a1d987316..3928e95afd 100644 --- a/examples/polygon-styles.js +++ b/examples/polygon-styles.js @@ -4,7 +4,7 @@ import GeoJSON from '../src/ol/format/GeoJSON.js'; import MultiPoint from '../src/ol/geom/MultiPoint.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -27,7 +27,7 @@ var styles = [ }) }), new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 5, fill: new Fill({ color: 'orange' diff --git a/examples/render-geometry.js b/examples/render-geometry.js index 4a68f096e2..fc7d8450da 100644 --- a/examples/render-geometry.js +++ b/examples/render-geometry.js @@ -2,7 +2,7 @@ import LineString from '../src/ol/geom/LineString.js'; import Point from '../src/ol/geom/Point.js'; import Polygon from '../src/ol/geom/Polygon.js'; import _ol_render_ from '../src/ol/render.js'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -16,7 +16,7 @@ var stroke = new Stroke({color: 'black'}); var style = new Style({ fill: fill, stroke: stroke, - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 10, fill: fill, stroke: stroke diff --git a/examples/snap.js b/examples/snap.js index b7ab4c0cb4..34131a79bb 100644 --- a/examples/snap.js +++ b/examples/snap.js @@ -8,7 +8,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_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -27,7 +27,7 @@ var vector = new VectorLayer({ color: '#ffcc33', width: 2 }), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 7, fill: new Fill({ color: '#ffcc33' diff --git a/examples/symbol-atlas-webgl.js b/examples/symbol-atlas-webgl.js index 1e1153098d..ceaa52a172 100644 --- a/examples/symbol-atlas-webgl.js +++ b/examples/symbol-atlas-webgl.js @@ -5,7 +5,7 @@ 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 AtlasManager from '../src/ol/style/AtlasManager.js'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import RegularShape from '../src/ol/style/RegularShape.js'; import Stroke from '../src/ol/style/Stroke.js'; @@ -47,7 +47,7 @@ for (i = 0; i < symbolInfo.length; ++i) { var info = symbolInfo[i]; for (j = 0; j < radiuses.length; ++j) { // circle symbol - symbols.push(new _ol_style_Circle_({ + symbols.push(new CircleStyle({ opacity: info.opacity, scale: info.scale, radius: radiuses[j], diff --git a/examples/synthetic-points.js b/examples/synthetic-points.js index 758cb73316..a26d956984 100644 --- a/examples/synthetic-points.js +++ b/examples/synthetic-points.js @@ -5,7 +5,7 @@ import LineString from '../src/ol/geom/LineString.js'; import Point from '../src/ol/geom/Point.js'; import VectorLayer from '../src/ol/layer/Vector.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -25,14 +25,14 @@ for (var i = 0; i < count; ++i) { var styles = { '10': new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 5, fill: new Fill({color: '#666666'}), stroke: new Stroke({color: '#bada55', width: 1}) }) }), '20': new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 10, fill: new Fill({color: '#666666'}), stroke: new Stroke({color: '#bada55', width: 1}) @@ -102,7 +102,7 @@ var stroke = new Stroke({ }); var style = new Style({ stroke: stroke, - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 10, stroke: stroke }) diff --git a/examples/topolis.js b/examples/topolis.js index aae8664ce7..5358056cb3 100644 --- a/examples/topolis.js +++ b/examples/topolis.js @@ -16,7 +16,7 @@ import VectorSource from '../src/ol/source/Vector.js'; import Style from '../src/ol/style/Style.js'; import Stroke from '../src/ol/style/Stroke.js'; import Fill from '../src/ol/style/Fill.js'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Text from '../src/ol/style/Text.js'; import MousePosition from '../src/ol/control/MousePosition.js'; @@ -29,7 +29,7 @@ var nodesLayer = new VectorLayer({ source: nodes, style: function(f) { var style = new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 8, fill: new Fill({color: 'rgba(255, 0, 0, 0.2)'}), stroke: new Stroke({color: 'red', width: 1}) diff --git a/examples/vector-labels.js b/examples/vector-labels.js index d80fab0219..9b1858563f 100644 --- a/examples/vector-labels.js +++ b/examples/vector-labels.js @@ -5,7 +5,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_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -172,7 +172,7 @@ var vectorLines = new VectorLayer({ // Points function pointStyleFunction(feature, resolution) { return new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 10, fill: new Fill({color: 'rgba(255, 0, 0, 0.1)'}), stroke: new Stroke({color: 'red', width: 1}) diff --git a/examples/vector-osm.js b/examples/vector-osm.js index dd5e923251..2026eee098 100644 --- a/examples/vector-osm.js +++ b/examples/vector-osm.js @@ -8,7 +8,7 @@ import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js'; import {transformExtent} from '../src/ol/proj.js'; import BingMaps from '../src/ol/source/BingMaps.js'; import VectorSource from '../src/ol/source/Vector.js'; -import _ol_style_Circle_ from '../src/ol/style/Circle.js'; +import CircleStyle from '../src/ol/style/Circle.js'; import Fill from '../src/ol/style/Fill.js'; import Stroke from '../src/ol/style/Stroke.js'; import Style from '../src/ol/style/Style.js'; @@ -66,7 +66,7 @@ var styles = { }, 'natural': { 'tree': new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 2, fill: new Fill({ color: 'rgba(140, 208, 95, 1.0)' diff --git a/src/ol/style/Circle.js b/src/ol/style/Circle.js index a2d9215edb..992e8c3390 100644 --- a/src/ol/style/Circle.js +++ b/src/ol/style/Circle.js @@ -13,7 +13,7 @@ import RegularShape from '../style/RegularShape.js'; * @extends {ol.style.RegularShape} * @api */ -var _ol_style_Circle_ = function(opt_options) { +var CircleStyle = function(opt_options) { var options = opt_options || {}; @@ -28,7 +28,7 @@ var _ol_style_Circle_ = function(opt_options) { }; -inherits(_ol_style_Circle_, RegularShape); +inherits(CircleStyle, RegularShape); /** @@ -37,8 +37,8 @@ inherits(_ol_style_Circle_, RegularShape); * @override * @api */ -_ol_style_Circle_.prototype.clone = function() { - var style = new _ol_style_Circle_({ +CircleStyle.prototype.clone = function() { + var style = new CircleStyle({ fill: this.getFill() ? this.getFill().clone() : undefined, stroke: this.getStroke() ? this.getStroke().clone() : undefined, radius: this.getRadius(), @@ -57,8 +57,8 @@ _ol_style_Circle_.prototype.clone = function() { * @param {number} radius Circle radius. * @api */ -_ol_style_Circle_.prototype.setRadius = function(radius) { +CircleStyle.prototype.setRadius = function(radius) { this.radius_ = radius; this.render_(this.atlasManager_); }; -export default _ol_style_Circle_; +export default CircleStyle; diff --git a/src/ol/style/Style.js b/src/ol/style/Style.js index 44fb692856..ae33eb9d5d 100644 --- a/src/ol/style/Style.js +++ b/src/ol/style/Style.js @@ -3,7 +3,7 @@ */ import {assert} from '../asserts.js'; import GeometryType from '../geom/GeometryType.js'; -import _ol_style_Circle_ from '../style/Circle.js'; +import CircleStyle from '../style/Circle.js'; import Fill from '../style/Fill.js'; import Stroke from '../style/Stroke.js'; @@ -331,7 +331,7 @@ Style.defaultFunction = function(feature, resolution) { }); Style.default_ = [ new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ fill: fill, stroke: stroke, radius: 5 @@ -390,7 +390,7 @@ Style.createDefaultEditing = function() { styles[GeometryType.POINT] = [ new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: width * 2, fill: new Fill({ color: blue diff --git a/test/rendering/ol/layer/tile.test.js b/test/rendering/ol/layer/tile.test.js index be11e77268..d3b2c3783e 100644 --- a/test/rendering/ol/layer/tile.test.js +++ b/test/rendering/ol/layer/tile.test.js @@ -7,7 +7,7 @@ import _ol_obj_ from '../../../../src/ol/obj.js'; import {transform} from '../../../../src/ol/proj.js'; import TileImage from '../../../../src/ol/source/TileImage.js'; import XYZ from '../../../../src/ol/source/XYZ.js'; -import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; +import CircleStyle from '../../../../src/ol/style/Circle.js'; import Fill from '../../../../src/ol/style/Fill.js'; import Stroke from '../../../../src/ol/style/Stroke.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -278,7 +278,7 @@ describe('ol.rendering.layer.Tile', function() { }); onAddLayer = function(evt) { evt.element.on('render', function(e) { - e.vectorContext.setImageStyle(new _ol_style_Circle_({ + e.vectorContext.setImageStyle(new CircleStyle({ radius: 5, snapToPixel: false, fill: new Fill({color: 'yellow'}), diff --git a/test/rendering/ol/layer/vector.test.js b/test/rendering/ol/layer/vector.test.js index 3a3ab5fa38..b8e2e35a52 100644 --- a/test/rendering/ol/layer/vector.test.js +++ b/test/rendering/ol/layer/vector.test.js @@ -8,7 +8,7 @@ import Point from '../../../../src/ol/geom/Point.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; -import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; +import CircleStyle from '../../../../src/ol/style/Circle.js'; import Fill from '../../../../src/ol/style/Fill.js'; import Stroke from '../../../../src/ol/style/Stroke.js'; import Style from '../../../../src/ol/style/Style.js'; @@ -724,7 +724,7 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { return new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 15, stroke: new Stroke({ color: 'blue' @@ -764,7 +764,7 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { return new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 15, stroke: new Stroke({ color: 'blue' @@ -806,7 +806,7 @@ describe('ol.rendering.layer.Vector', function() { layer.setStyle(function(feature) { return new Style({ zIndex: feature.get('zIndex'), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 15, stroke: new Stroke({ color: 'blue' @@ -844,7 +844,7 @@ describe('ol.rendering.layer.Vector', function() { layer.setDeclutter(true); layer.setStyle(function(feature) { return new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 5, stroke: new Stroke({ color: 'blue' @@ -874,7 +874,7 @@ describe('ol.rendering.layer.Vector', function() { var point = new Feature(new Point(center)); point.setStyle(new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 8, stroke: new Stroke({ color: 'blue' @@ -917,7 +917,7 @@ describe('ol.rendering.layer.Vector', function() { var point = new Feature(new Point(center)); point.setStyle(new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 8, stroke: new Stroke({ color: 'blue' @@ -961,7 +961,7 @@ describe('ol.rendering.layer.Vector', function() { var point = new Feature(new Point(center)); point.setStyle(new Style({ zIndex: 2, - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 8, stroke: new Stroke({ color: 'blue' diff --git a/test/rendering/ol/layer/vectortile.test.js b/test/rendering/ol/layer/vectortile.test.js index e7131335b1..afbf12b35a 100644 --- a/test/rendering/ol/layer/vectortile.test.js +++ b/test/rendering/ol/layer/vectortile.test.js @@ -8,7 +8,7 @@ import VectorTileLayer from '../../../../src/ol/layer/VectorTile.js'; import _ol_obj_ from '../../../../src/ol/obj.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; -import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; +import CircleStyle from '../../../../src/ol/style/Circle.js'; import Fill from '../../../../src/ol/style/Fill.js'; import Style from '../../../../src/ol/style/Style.js'; import Text from '../../../../src/ol/style/Text.js'; @@ -105,7 +105,7 @@ describe('ol.rendering.layer.VectorTile', function() { zIndex: 1, source: vectorSource, style: new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 10, fill: new Fill({ color: 'red' @@ -144,7 +144,7 @@ describe('ol.rendering.layer.VectorTile', function() { var geom = feature.getGeometry(); if (geom.getType() == 'Point') { return new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 7, fill: new Fill({ color: 'red' diff --git a/test/rendering/ol/render.test.js b/test/rendering/ol/render.test.js index fe1efb4d40..7756e93ab0 100644 --- a/test/rendering/ol/render.test.js +++ b/test/rendering/ol/render.test.js @@ -4,7 +4,7 @@ import Polygon from '../../../src/ol/geom/Polygon.js'; import _ol_render_ from '../../../src/ol/render.js'; import VectorContext from '../../../src/ol/render/VectorContext.js'; import CanvasImmediateRenderer from '../../../src/ol/render/canvas/Immediate.js'; -import _ol_style_Circle_ from '../../../src/ol/style/Circle.js'; +import CircleStyle from '../../../src/ol/style/Circle.js'; import Fill from '../../../src/ol/style/Fill.js'; import Stroke from '../../../src/ol/style/Stroke.js'; import Style from '../../../src/ol/style/Style.js'; @@ -34,7 +34,7 @@ describe('ol.render', function() { }); var style = new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ fill: new Fill({ color: 'green' }), diff --git a/test/rendering/ol/style/circle.test.js b/test/rendering/ol/style/circle.test.js index cc5416d109..97f042e3a8 100644 --- a/test/rendering/ol/style/circle.test.js +++ b/test/rendering/ol/style/circle.test.js @@ -5,7 +5,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_Circle_ from '../../../../src/ol/style/Circle.js'; +import CircleStyle from '../../../../src/ol/style/Circle.js'; import Fill from '../../../../src/ol/style/Fill.js'; import Style from '../../../../src/ol/style/Style.js'; import Stroke from '../../../../src/ol/style/Stroke.js'; @@ -49,7 +49,7 @@ describe('ol.rendering.style.Circle', function() { geometry: multi ? new MultiPoint([[-20, 18]]) : new Point([-20, 18]) }); feature.setStyle(new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 2, fill: new Fill({ color: '#91E339' @@ -62,7 +62,7 @@ describe('ol.rendering.style.Circle', function() { geometry: multi ? new MultiPoint([[-10, 18]]) : new Point([-10, 18]) }); feature.setStyle(new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 4, fill: new Fill({ color: '#5447E6' @@ -75,7 +75,7 @@ describe('ol.rendering.style.Circle', function() { geometry: multi ? new MultiPoint([[4, 18]]) : new Point([4, 18]) }); feature.setStyle(new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 6, fill: new Fill({ color: '#92A8A6' @@ -88,7 +88,7 @@ describe('ol.rendering.style.Circle', function() { geometry: multi ? new MultiPoint([[-20, 3]]) : new Point([-20, 3]) }); feature.setStyle(new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 2, fill: new Fill({ color: '#91E339' @@ -105,7 +105,7 @@ describe('ol.rendering.style.Circle', function() { geometry: multi ? new MultiPoint([[-10, 3]]) : new Point([-10, 3]) }); feature.setStyle(new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 4, fill: new Fill({ color: '#5447E6' @@ -122,7 +122,7 @@ describe('ol.rendering.style.Circle', function() { geometry: multi ? new MultiPoint([[4, 3]]) : new Point([4, 3]) }); feature.setStyle(new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 6, fill: new Fill({ color: '#92A8A6' @@ -139,7 +139,7 @@ describe('ol.rendering.style.Circle', function() { geometry: multi ? new MultiPoint([[-20, -15]]) : new Point([-20, -15]) }); feature.setStyle(new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 2, stroke: new Stroke({ color: '#256308', @@ -153,7 +153,7 @@ describe('ol.rendering.style.Circle', function() { geometry: multi ? new MultiPoint([[-10, -15]]) : new Point([-10, -15]) }); feature.setStyle(new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 4, fill: new Fill({ color: 'rgba(0, 0, 255, 0.3)' @@ -170,7 +170,7 @@ describe('ol.rendering.style.Circle', function() { geometry: multi ? new MultiPoint([[4, -15]]) : new Point([4, -15]) }); feature.setStyle(new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 6, fill: new Fill({ color: 'rgba(235, 45, 70, 0.6)' diff --git a/test/spec/ol/format/kml.test.js b/test/spec/ol/format/kml.test.js index 40314fc547..52402f8e4e 100644 --- a/test/spec/ol/format/kml.test.js +++ b/test/spec/ol/format/kml.test.js @@ -13,7 +13,7 @@ import Polygon from '../../../../src/ol/geom/Polygon.js'; import {addProjection, addCoordinateTransforms, transform, get as getProjection} from '../../../../src/ol/proj.js'; import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; import {remove as removeTransform} from '../../../../src/ol/proj/transforms.js'; -import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; +import CircleStyle from '../../../../src/ol/style/Circle.js'; import Fill from '../../../../src/ol/style/Fill.js'; import Icon from '../../../../src/ol/style/Icon.js'; import IconAnchorUnits from '../../../../src/ol/style/IconAnchorUnits.js'; @@ -2335,7 +2335,7 @@ describe('ol.format.KML', function() { it('skips image styles that are not icon styles', function() { var style = new Style({ - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 4, fill: new Fill({ color: 'rgb(12, 34, 223)' diff --git a/test/spec/ol/render/canvas/immediate.test.js b/test/spec/ol/render/canvas/immediate.test.js index 1da35cc03e..8076239890 100644 --- a/test/spec/ol/render/canvas/immediate.test.js +++ b/test/spec/ol/render/canvas/immediate.test.js @@ -8,7 +8,7 @@ import Point from '../../../../../src/ol/geom/Point.js'; import Polygon from '../../../../../src/ol/geom/Polygon.js'; import VectorContext from '../../../../../src/ol/render/VectorContext.js'; import CanvasImmediateRenderer from '../../../../../src/ol/render/canvas/Immediate.js'; -import _ol_style_Circle_ from '../../../../../src/ol/style/Circle.js'; +import CircleStyle from '../../../../../src/ol/style/Circle.js'; import Fill from '../../../../../src/ol/style/Fill.js'; import Stroke from '../../../../../src/ol/style/Stroke.js'; import Style from '../../../../../src/ol/style/Style.js'; @@ -45,7 +45,7 @@ describe('ol.render.canvas.Immediate', function() { var fill = new Fill({}); var stroke = new Stroke({}); var text = new Text({}); - var image = new _ol_style_Circle_({}); + var image = new CircleStyle({}); var style = new Style({ fill: fill, stroke: stroke, diff --git a/test/spec/ol/render/webgl/immediate.test.js b/test/spec/ol/render/webgl/immediate.test.js index 3964cadb3e..149960f6bb 100644 --- a/test/spec/ol/render/webgl/immediate.test.js +++ b/test/spec/ol/render/webgl/immediate.test.js @@ -12,7 +12,7 @@ import _ol_render_webgl_ImageReplay_ from '../../../../../src/ol/render/webgl/Im import _ol_render_webgl_Immediate_ from '../../../../../src/ol/render/webgl/Immediate.js'; import _ol_render_webgl_LineStringReplay_ from '../../../../../src/ol/render/webgl/LineStringReplay.js'; import _ol_render_webgl_PolygonReplay_ from '../../../../../src/ol/render/webgl/PolygonReplay.js'; -import _ol_style_Circle_ from '../../../../../src/ol/style/Circle.js'; +import CircleStyle from '../../../../../src/ol/style/Circle.js'; import Fill from '../../../../../src/ol/style/Fill.js'; import Stroke from '../../../../../src/ol/style/Stroke.js'; import Style from '../../../../../src/ol/style/Style.js'; @@ -22,7 +22,7 @@ describe('ol.render.webgl.Immediate', function() { beforeEach(function() { context = new _ol_render_webgl_Immediate_({}, [0, 0], 0, 0, [0, 0], [-180, -90, 180, 90], 1); style = new Style({ - image: new _ol_style_Circle_(), + image: new CircleStyle(), fill: new Fill(), stroke: new Stroke() }); diff --git a/test/spec/ol/style/circle.test.js b/test/spec/ol/style/circle.test.js index 114694b29c..be9c38647d 100644 --- a/test/spec/ol/style/circle.test.js +++ b/test/spec/ol/style/circle.test.js @@ -1,5 +1,5 @@ import AtlasManager from '../../../../src/ol/style/AtlasManager.js'; -import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; +import CircleStyle from '../../../../src/ol/style/Circle.js'; import Fill from '../../../../src/ol/style/Fill.js'; import Stroke from '../../../../src/ol/style/Stroke.js'; @@ -9,7 +9,7 @@ describe('ol.style.Circle', function() { describe('#constructor', function() { it('creates a canvas if no atlas is used (no fill-style)', function() { - var style = new _ol_style_Circle_({radius: 10}); + var style = new CircleStyle({radius: 10}); expect(style.getImage()).to.be.an(HTMLCanvasElement); expect(style.getSize()).to.eql([21, 21]); expect(style.getImageSize()).to.eql([21, 21]); @@ -22,7 +22,7 @@ describe('ol.style.Circle', function() { }); it('creates a canvas if no atlas is used (fill-style)', function() { - var style = new _ol_style_Circle_({ + var style = new CircleStyle({ radius: 10, fill: new Fill({ color: '#FFFF00' @@ -41,7 +41,7 @@ describe('ol.style.Circle', function() { it('adds itself to an atlas manager (no fill-style)', function() { var atlasManager = new AtlasManager({initialSize: 512}); - var style = new _ol_style_Circle_({radius: 10, atlasManager: atlasManager}); + var style = new CircleStyle({radius: 10, atlasManager: atlasManager}); expect(style.getImage()).to.be.an(HTMLCanvasElement); expect(style.getSize()).to.eql([21, 21]); expect(style.getImageSize()).to.eql([512, 512]); @@ -55,7 +55,7 @@ describe('ol.style.Circle', function() { it('adds itself to an atlas manager (fill-style)', function() { var atlasManager = new AtlasManager({initialSize: 512}); - var style = new _ol_style_Circle_({ + var style = new CircleStyle({ radius: 10, atlasManager: atlasManager, fill: new Fill({ @@ -77,14 +77,14 @@ describe('ol.style.Circle', function() { describe('#clone', function() { it('creates a new ol.style.Circle', function() { - var original = new _ol_style_Circle_(); + var original = new CircleStyle(); var clone = original.clone(); - expect(clone).to.be.an(_ol_style_Circle_); + expect(clone).to.be.an(CircleStyle); expect(clone).to.not.be(original); }); it('copies all values', function() { - var original = new _ol_style_Circle_({ + var original = new CircleStyle({ fill: new Fill({ color: '#319FD3' }), @@ -106,7 +106,7 @@ describe('ol.style.Circle', function() { }); it('the clone does not reference the same objects as the original', function() { - var original = new _ol_style_Circle_({ + var original = new CircleStyle({ fill: new Fill({ color: '#319FD3' }), @@ -129,37 +129,37 @@ describe('ol.style.Circle', function() { describe('#getChecksum', function() { it('calculates the same hash code for default options', function() { - var style1 = new _ol_style_Circle_(); - var style2 = new _ol_style_Circle_(); + var style1 = new CircleStyle(); + var style2 = new CircleStyle(); expect(style1.getChecksum()).to.eql(style2.getChecksum()); }); it('calculates not the same hash code (radius)', function() { - var style1 = new _ol_style_Circle_(); - var style2 = new _ol_style_Circle_({ + var style1 = new CircleStyle(); + var style2 = new CircleStyle({ radius: 5 }); expect(style1.getChecksum()).to.not.eql(style2.getChecksum()); }); it('calculates the same hash code (radius)', function() { - var style1 = new _ol_style_Circle_({ + var style1 = new CircleStyle({ radius: 5 }); - var style2 = new _ol_style_Circle_({ + var style2 = new CircleStyle({ radius: 5 }); expect(style1.getChecksum()).to.eql(style2.getChecksum()); }); it('calculates not the same hash code (color)', function() { - var style1 = new _ol_style_Circle_({ + var style1 = new CircleStyle({ radius: 5, fill: new Fill({ color: '#319FD3' }) }); - var style2 = new _ol_style_Circle_({ + var style2 = new CircleStyle({ radius: 5, stroke: new Stroke({ color: '#319FD3' @@ -169,7 +169,7 @@ describe('ol.style.Circle', function() { }); it('calculates the same hash code (everything set)', function() { - var style1 = new _ol_style_Circle_({ + var style1 = new CircleStyle({ radius: 5, fill: new Fill({ color: '#319FD3' @@ -183,7 +183,7 @@ describe('ol.style.Circle', function() { width: 2 }) }); - var style2 = new _ol_style_Circle_({ + var style2 = new CircleStyle({ radius: 5, fill: new Fill({ color: '#319FD3' @@ -201,7 +201,7 @@ describe('ol.style.Circle', function() { }); it('calculates not the same hash code (stroke width differs)', function() { - var style1 = new _ol_style_Circle_({ + var style1 = new CircleStyle({ radius: 5, fill: new Fill({ color: '#319FD3' @@ -215,7 +215,7 @@ describe('ol.style.Circle', function() { width: 3 }) }); - var style2 = new _ol_style_Circle_({ + var style2 = new CircleStyle({ radius: 5, fill: new Fill({ color: '#319FD3' @@ -233,7 +233,7 @@ describe('ol.style.Circle', function() { }); it('invalidates a cached checksum if values change (fill)', function() { - var style1 = new _ol_style_Circle_({ + var style1 = new CircleStyle({ radius: 5, fill: new Fill({ color: '#319FD3' @@ -242,7 +242,7 @@ describe('ol.style.Circle', function() { color: '#319FD3' }) }); - var style2 = new _ol_style_Circle_({ + var style2 = new CircleStyle({ radius: 5, fill: new Fill({ color: '#319FD3' @@ -258,7 +258,7 @@ describe('ol.style.Circle', function() { }); it('invalidates a cached checksum if values change (stroke)', function() { - var style1 = new _ol_style_Circle_({ + var style1 = new CircleStyle({ radius: 5, fill: new Fill({ color: '#319FD3' @@ -267,7 +267,7 @@ describe('ol.style.Circle', function() { color: '#319FD3' }) }); - var style2 = new _ol_style_Circle_({ + var style2 = new CircleStyle({ radius: 5, fill: new Fill({ color: '#319FD3' @@ -286,7 +286,7 @@ describe('ol.style.Circle', function() { describe('#setRadius', function() { it('changes the circle radius', function() { - var style = new _ol_style_Circle_({ + var style = new CircleStyle({ radius: 10, fill: new Fill({ color: '#FFFF00' diff --git a/test/spec/ol/style/style.test.js b/test/spec/ol/style/style.test.js index 23dd9a7f8f..a6e64e1465 100644 --- a/test/spec/ol/style/style.test.js +++ b/test/spec/ol/style/style.test.js @@ -2,7 +2,7 @@ import Feature from '../../../../src/ol/Feature.js'; import Point from '../../../../src/ol/geom/Point.js'; 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 CircleStyle from '../../../../src/ol/style/Circle.js'; import Stroke from '../../../../src/ol/style/Stroke.js'; import Text from '../../../../src/ol/style/Text.js'; @@ -29,7 +29,7 @@ describe('ol.style.Style', function() { }) }); - var testImage = new _ol_style_Circle_({ + var testImage = new CircleStyle({ radius: 5 }); @@ -48,7 +48,7 @@ describe('ol.style.Style', function() { fill: new Fill({ color: '#319FD3' }), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 5 }), stroke: new Stroke({ @@ -74,7 +74,7 @@ describe('ol.style.Style', function() { fill: new Fill({ color: '#319FD3' }), - image: new _ol_style_Circle_({ + image: new CircleStyle({ radius: 5 }), stroke: new Stroke({ From 66182f4cfb889533002c576aa78373a4bc91b420 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 13:29:26 -0700 Subject: [PATCH 31/35] Rename _ol_style_IconImage_ to IconImage --- src/ol/style/Icon.js | 4 +-- src/ol/style/IconImage.js | 34 +++++++++++------------ test/spec/ol/style/icon.test.js | 6 ++-- test/spec/ol/style/iconimagecache.test.js | 12 ++++---- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/ol/style/Icon.js b/src/ol/style/Icon.js index 2fb6f4f2ab..82e8e8bc4b 100644 --- a/src/ol/style/Icon.js +++ b/src/ol/style/Icon.js @@ -8,7 +8,7 @@ import {asArray} from '../color.js'; import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import IconAnchorUnits from '../style/IconAnchorUnits.js'; -import _ol_style_IconImage_ from '../style/IconImage.js'; +import IconImage from '../style/IconImage.js'; import IconOrigin from '../style/IconOrigin.js'; import _ol_style_Image_ from '../style/Image.js'; @@ -107,7 +107,7 @@ var Icon = function(opt_options) { * @private * @type {ol.style.IconImage} */ - this.iconImage_ = _ol_style_IconImage_.get( + this.iconImage_ = IconImage.get( image, /** @type {string} */ (src), imgSize, this.crossOrigin_, imageState, this.color_); /** diff --git a/src/ol/style/IconImage.js b/src/ol/style/IconImage.js index 1174f69cd2..fb893e00a3 100644 --- a/src/ol/style/IconImage.js +++ b/src/ol/style/IconImage.js @@ -19,7 +19,7 @@ import {iconImageCache} from '../style.js'; * @param {ol.Color} color Color. * @extends {ol.events.EventTarget} */ -var _ol_style_IconImage_ = function(image, src, size, crossOrigin, imageState, +var IconImage = function(image, src, size, crossOrigin, imageState, color) { EventTarget.call(this); @@ -89,7 +89,7 @@ var _ol_style_IconImage_ = function(image, src, size, crossOrigin, imageState, }; -inherits(_ol_style_IconImage_, EventTarget); +inherits(IconImage, EventTarget); /** @@ -101,11 +101,11 @@ inherits(_ol_style_IconImage_, EventTarget); * @param {ol.Color} color Color. * @return {ol.style.IconImage} Icon image. */ -_ol_style_IconImage_.get = function(image, src, size, crossOrigin, imageState, +IconImage.get = function(image, src, size, crossOrigin, imageState, color) { var iconImage = iconImageCache.get(src, crossOrigin, color); if (!iconImage) { - iconImage = new _ol_style_IconImage_( + iconImage = new IconImage( image, src, size, crossOrigin, imageState, color); iconImageCache.set(src, crossOrigin, color, iconImage); } @@ -116,7 +116,7 @@ _ol_style_IconImage_.get = function(image, src, size, crossOrigin, imageState, /** * @private */ -_ol_style_IconImage_.prototype.determineTainting_ = function() { +IconImage.prototype.determineTainting_ = function() { var context = createCanvasContext2D(1, 1); try { context.drawImage(this.image_, 0, 0); @@ -130,7 +130,7 @@ _ol_style_IconImage_.prototype.determineTainting_ = function() { /** * @private */ -_ol_style_IconImage_.prototype.dispatchChangeEvent_ = function() { +IconImage.prototype.dispatchChangeEvent_ = function() { this.dispatchEvent(EventType.CHANGE); }; @@ -138,7 +138,7 @@ _ol_style_IconImage_.prototype.dispatchChangeEvent_ = function() { /** * @private */ -_ol_style_IconImage_.prototype.handleImageError_ = function() { +IconImage.prototype.handleImageError_ = function() { this.imageState_ = ImageState.ERROR; this.unlistenImage_(); this.dispatchChangeEvent_(); @@ -148,7 +148,7 @@ _ol_style_IconImage_.prototype.handleImageError_ = function() { /** * @private */ -_ol_style_IconImage_.prototype.handleImageLoad_ = function() { +IconImage.prototype.handleImageLoad_ = function() { this.imageState_ = ImageState.LOADED; if (this.size_) { this.image_.width = this.size_[0]; @@ -166,7 +166,7 @@ _ol_style_IconImage_.prototype.handleImageLoad_ = function() { * @param {number} pixelRatio Pixel ratio. * @return {Image|HTMLCanvasElement} Image or Canvas element. */ -_ol_style_IconImage_.prototype.getImage = function(pixelRatio) { +IconImage.prototype.getImage = function(pixelRatio) { return this.canvas_ ? this.canvas_ : this.image_; }; @@ -174,7 +174,7 @@ _ol_style_IconImage_.prototype.getImage = function(pixelRatio) { /** * @return {ol.ImageState} Image state. */ -_ol_style_IconImage_.prototype.getImageState = function() { +IconImage.prototype.getImageState = function() { return this.imageState_; }; @@ -183,7 +183,7 @@ _ol_style_IconImage_.prototype.getImageState = function() { * @param {number} pixelRatio Pixel ratio. * @return {Image|HTMLCanvasElement} Image element. */ -_ol_style_IconImage_.prototype.getHitDetectionImage = function(pixelRatio) { +IconImage.prototype.getHitDetectionImage = function(pixelRatio) { if (!this.hitDetectionImage_) { if (this.tainting_) { var width = this.size_[0]; @@ -202,7 +202,7 @@ _ol_style_IconImage_.prototype.getHitDetectionImage = function(pixelRatio) { /** * @return {ol.Size} Image size. */ -_ol_style_IconImage_.prototype.getSize = function() { +IconImage.prototype.getSize = function() { return this.size_; }; @@ -210,7 +210,7 @@ _ol_style_IconImage_.prototype.getSize = function() { /** * @return {string|undefined} Image src. */ -_ol_style_IconImage_.prototype.getSrc = function() { +IconImage.prototype.getSrc = function() { return this.src_; }; @@ -218,7 +218,7 @@ _ol_style_IconImage_.prototype.getSrc = function() { /** * Load not yet loaded URI. */ -_ol_style_IconImage_.prototype.load = function() { +IconImage.prototype.load = function() { if (this.imageState_ == ImageState.IDLE) { this.imageState_ = ImageState.LOADING; this.imageListenerKeys_ = [ @@ -239,7 +239,7 @@ _ol_style_IconImage_.prototype.load = function() { /** * @private */ -_ol_style_IconImage_.prototype.replaceColor_ = function() { +IconImage.prototype.replaceColor_ = function() { if (this.tainting_ || this.color_ === null) { return; } @@ -270,8 +270,8 @@ _ol_style_IconImage_.prototype.replaceColor_ = function() { * * @private */ -_ol_style_IconImage_.prototype.unlistenImage_ = function() { +IconImage.prototype.unlistenImage_ = function() { this.imageListenerKeys_.forEach(_ol_events_.unlistenByKey); this.imageListenerKeys_ = null; }; -export default _ol_style_IconImage_; +export default IconImage; diff --git a/test/spec/ol/style/icon.test.js b/test/spec/ol/style/icon.test.js index 9f4e4ff037..f333669fd5 100644 --- a/test/spec/ol/style/icon.test.js +++ b/test/spec/ol/style/icon.test.js @@ -1,7 +1,7 @@ import {getUid} from '../../../../src/ol/index.js'; import {iconImageCache} from '../../../../src/ol/style.js'; import Icon from '../../../../src/ol/style/Icon.js'; -import _ol_style_IconImage_ from '../../../../src/ol/style/IconImage.js'; +import IconImage from '../../../../src/ol/style/IconImage.js'; describe('ol.style.Icon', function() { @@ -17,7 +17,7 @@ describe('ol.style.Icon', function() { img: canvas, imgSize: size }); - expect(_ol_style_IconImage_.get( + expect(IconImage.get( canvas, getUid(canvas), size, '').getImage()).to.eql(canvas); }); @@ -227,7 +227,7 @@ describe('ol.style.Icon', function() { // pretend that the image is already in the cache, // this image will be used for the icon. var src = 'test.png'; - var iconImage = new _ol_style_IconImage_(null, 'test.png', imgSize); + var iconImage = new IconImage(null, 'test.png', imgSize); iconImageCache.set(src, null, null, iconImage); var iconStyle = new Icon({ diff --git a/test/spec/ol/style/iconimagecache.test.js b/test/spec/ol/style/iconimagecache.test.js index 2d1035dd8e..838b0a078a 100644 --- a/test/spec/ol/style/iconimagecache.test.js +++ b/test/spec/ol/style/iconimagecache.test.js @@ -1,7 +1,7 @@ import {nullFunction} from '../../../../src/ol/index.js'; import _ol_events_ from '../../../../src/ol/events.js'; import {iconImageCache} from '../../../../src/ol/style.js'; -import _ol_style_IconImage_ from '../../../../src/ol/style/IconImage.js'; +import IconImage from '../../../../src/ol/style/IconImage.js'; describe('ol.style.IconImageCache', function() { var originalMaxCacheSize; @@ -23,7 +23,7 @@ describe('ol.style.IconImageCache', function() { for (i = 0; i < 4; ++i) { src = i + ''; - iconImage = new _ol_style_IconImage_(null, src); + iconImage = new IconImage(null, src); iconImageCache.set(src, null, null, iconImage); } @@ -33,7 +33,7 @@ describe('ol.style.IconImageCache', function() { expect(iconImageCache.cacheSize_).to.eql(4); src = '4'; - iconImage = new _ol_style_IconImage_(null, src); + iconImage = new IconImage(null, src); iconImageCache.set(src, null, null, iconImage); expect(iconImageCache.cacheSize_).to.eql(5); @@ -41,13 +41,13 @@ describe('ol.style.IconImageCache', function() { expect(iconImageCache.cacheSize_).to.eql(3); src = '0'; - iconImage = new _ol_style_IconImage_(null, src); + iconImage = new IconImage(null, src); _ol_events_.listen(iconImage, 'change', nullFunction, false); iconImageCache.set(src, null, null, iconImage); expect(iconImageCache.cacheSize_).to.eql(4); src = '4'; - iconImage = new _ol_style_IconImage_(null, src); + iconImage = new IconImage(null, src); _ol_events_.listen(iconImage, 'change', nullFunction, false); iconImageCache.set(src, null, null, iconImage); expect(iconImageCache.cacheSize_).to.eql(5); @@ -65,7 +65,7 @@ describe('ol.style.IconImageCache', function() { for (i = 0; i < 3; ++i) { src = i + ''; - iconImage = new _ol_style_IconImage_(null, src); + iconImage = new IconImage(null, src); iconImageCache.set(src, null, null, iconImage); } From 893d134e36e0057de492037cabefef52b3e21ae6 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 13:29:59 -0700 Subject: [PATCH 32/35] Rename _ol_style_Image_ to ImageStyle --- src/ol/style/Icon.js | 6 +-- src/ol/style/Image.js | 46 +++++++++---------- src/ol/style/RegularShape.js | 6 +-- test/spec/ol/render/webgl/imagereplay.test.js | 4 +- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/ol/style/Icon.js b/src/ol/style/Icon.js index 82e8e8bc4b..8993a778bf 100644 --- a/src/ol/style/Icon.js +++ b/src/ol/style/Icon.js @@ -10,7 +10,7 @@ import EventType from '../events/EventType.js'; import IconAnchorUnits from '../style/IconAnchorUnits.js'; import IconImage from '../style/IconImage.js'; import IconOrigin from '../style/IconOrigin.js'; -import _ol_style_Image_ from '../style/Image.js'; +import ImageStyle from '../style/Image.js'; /** * @classdesc @@ -162,7 +162,7 @@ var Icon = function(opt_options) { var snapToPixel = options.snapToPixel !== undefined ? options.snapToPixel : true; - _ol_style_Image_.call(this, { + ImageStyle.call(this, { opacity: opacity, rotation: rotation, scale: scale, @@ -172,7 +172,7 @@ var Icon = function(opt_options) { }; -inherits(Icon, _ol_style_Image_); +inherits(Icon, ImageStyle); /** diff --git a/src/ol/style/Image.js b/src/ol/style/Image.js index 0a680147b2..aa82166f24 100644 --- a/src/ol/style/Image.js +++ b/src/ol/style/Image.js @@ -12,7 +12,7 @@ * @param {ol.StyleImageOptions} options Options. * @api */ -var _ol_style_Image_ = function(options) { +var ImageStyle = function(options) { /** * @private @@ -52,7 +52,7 @@ var _ol_style_Image_ = function(options) { * @return {number} Opacity. * @api */ -_ol_style_Image_.prototype.getOpacity = function() { +ImageStyle.prototype.getOpacity = function() { return this.opacity_; }; @@ -62,7 +62,7 @@ _ol_style_Image_.prototype.getOpacity = function() { * @return {boolean} Rotate with map. * @api */ -_ol_style_Image_.prototype.getRotateWithView = function() { +ImageStyle.prototype.getRotateWithView = function() { return this.rotateWithView_; }; @@ -72,7 +72,7 @@ _ol_style_Image_.prototype.getRotateWithView = function() { * @return {number} Rotation. * @api */ -_ol_style_Image_.prototype.getRotation = function() { +ImageStyle.prototype.getRotation = function() { return this.rotation_; }; @@ -82,7 +82,7 @@ _ol_style_Image_.prototype.getRotation = function() { * @return {number} Scale. * @api */ -_ol_style_Image_.prototype.getScale = function() { +ImageStyle.prototype.getScale = function() { return this.scale_; }; @@ -92,7 +92,7 @@ _ol_style_Image_.prototype.getScale = function() { * @return {boolean} The symbolizer should snap to a pixel. * @api */ -_ol_style_Image_.prototype.getSnapToPixel = function() { +ImageStyle.prototype.getSnapToPixel = function() { return this.snapToPixel_; }; @@ -103,7 +103,7 @@ _ol_style_Image_.prototype.getSnapToPixel = function() { * @abstract * @return {Array.} Anchor. */ -_ol_style_Image_.prototype.getAnchor = function() {}; +ImageStyle.prototype.getAnchor = function() {}; /** @@ -112,7 +112,7 @@ _ol_style_Image_.prototype.getAnchor = function() {}; * @param {number} pixelRatio Pixel ratio. * @return {HTMLCanvasElement|HTMLVideoElement|Image} Image element. */ -_ol_style_Image_.prototype.getImage = function(pixelRatio) {}; +ImageStyle.prototype.getImage = function(pixelRatio) {}; /** @@ -120,28 +120,28 @@ _ol_style_Image_.prototype.getImage = function(pixelRatio) {}; * @param {number} pixelRatio Pixel ratio. * @return {HTMLCanvasElement|HTMLVideoElement|Image} Image element. */ -_ol_style_Image_.prototype.getHitDetectionImage = function(pixelRatio) {}; +ImageStyle.prototype.getHitDetectionImage = function(pixelRatio) {}; /** * @abstract * @return {ol.ImageState} Image state. */ -_ol_style_Image_.prototype.getImageState = function() {}; +ImageStyle.prototype.getImageState = function() {}; /** * @abstract * @return {ol.Size} Image size. */ -_ol_style_Image_.prototype.getImageSize = function() {}; +ImageStyle.prototype.getImageSize = function() {}; /** * @abstract * @return {ol.Size} Size of the hit-detection image. */ -_ol_style_Image_.prototype.getHitDetectionImageSize = function() {}; +ImageStyle.prototype.getHitDetectionImageSize = function() {}; /** @@ -149,7 +149,7 @@ _ol_style_Image_.prototype.getHitDetectionImageSize = function() {}; * @abstract * @return {Array.} Origin. */ -_ol_style_Image_.prototype.getOrigin = function() {}; +ImageStyle.prototype.getOrigin = function() {}; /** @@ -157,7 +157,7 @@ _ol_style_Image_.prototype.getOrigin = function() {}; * @abstract * @return {ol.Size} Size. */ -_ol_style_Image_.prototype.getSize = function() {}; +ImageStyle.prototype.getSize = function() {}; /** @@ -166,7 +166,7 @@ _ol_style_Image_.prototype.getSize = function() {}; * @param {number} opacity Opacity. * @api */ -_ol_style_Image_.prototype.setOpacity = function(opacity) { +ImageStyle.prototype.setOpacity = function(opacity) { this.opacity_ = opacity; }; @@ -176,7 +176,7 @@ _ol_style_Image_.prototype.setOpacity = function(opacity) { * * @param {boolean} rotateWithView Rotate with map. */ -_ol_style_Image_.prototype.setRotateWithView = function(rotateWithView) { +ImageStyle.prototype.setRotateWithView = function(rotateWithView) { this.rotateWithView_ = rotateWithView; }; @@ -187,7 +187,7 @@ _ol_style_Image_.prototype.setRotateWithView = function(rotateWithView) { * @param {number} rotation Rotation. * @api */ -_ol_style_Image_.prototype.setRotation = function(rotation) { +ImageStyle.prototype.setRotation = function(rotation) { this.rotation_ = rotation; }; @@ -198,7 +198,7 @@ _ol_style_Image_.prototype.setRotation = function(rotation) { * @param {number} scale Scale. * @api */ -_ol_style_Image_.prototype.setScale = function(scale) { +ImageStyle.prototype.setScale = function(scale) { this.scale_ = scale; }; @@ -208,7 +208,7 @@ _ol_style_Image_.prototype.setScale = function(scale) { * * @param {boolean} snapToPixel Snap to pixel? */ -_ol_style_Image_.prototype.setSnapToPixel = function(snapToPixel) { +ImageStyle.prototype.setSnapToPixel = function(snapToPixel) { this.snapToPixel_ = snapToPixel; }; @@ -220,14 +220,14 @@ _ol_style_Image_.prototype.setSnapToPixel = function(snapToPixel) { * @return {ol.EventsKey|undefined} Listener key. * @template T */ -_ol_style_Image_.prototype.listenImageChange = function(listener, thisArg) {}; +ImageStyle.prototype.listenImageChange = function(listener, thisArg) {}; /** * Load not yet loaded URI. * @abstract */ -_ol_style_Image_.prototype.load = function() {}; +ImageStyle.prototype.load = function() {}; /** @@ -236,5 +236,5 @@ _ol_style_Image_.prototype.load = function() {}; * @param {T} thisArg Value to use as `this` when executing `listener`. * @template T */ -_ol_style_Image_.prototype.unlistenImageChange = function(listener, thisArg) {}; -export default _ol_style_Image_; +ImageStyle.prototype.unlistenImageChange = function(listener, thisArg) {}; +export default ImageStyle; diff --git a/src/ol/style/RegularShape.js b/src/ol/style/RegularShape.js index 84babb07e0..6dd283844b 100644 --- a/src/ol/style/RegularShape.js +++ b/src/ol/style/RegularShape.js @@ -7,7 +7,7 @@ import {createCanvasContext2D} from '../dom.js'; import _ol_has_ from '../has.js'; import ImageState from '../ImageState.js'; import _ol_render_canvas_ from '../render/canvas.js'; -import _ol_style_Image_ from '../style/Image.js'; +import ImageStyle from '../style/Image.js'; /** * @classdesc @@ -126,7 +126,7 @@ var RegularShape = function(options) { var rotateWithView = options.rotateWithView !== undefined ? options.rotateWithView : false; - _ol_style_Image_.call(this, { + ImageStyle.call(this, { opacity: 1, rotateWithView: rotateWithView, rotation: options.rotation !== undefined ? options.rotation : 0, @@ -135,7 +135,7 @@ var RegularShape = function(options) { }); }; -inherits(RegularShape, _ol_style_Image_); +inherits(RegularShape, ImageStyle); /** diff --git a/test/spec/ol/render/webgl/imagereplay.test.js b/test/spec/ol/render/webgl/imagereplay.test.js index 62608818b5..9cf95fe07d 100644 --- a/test/spec/ol/render/webgl/imagereplay.test.js +++ b/test/spec/ol/render/webgl/imagereplay.test.js @@ -1,13 +1,13 @@ import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js'; import Point from '../../../../../src/ol/geom/Point.js'; import _ol_render_webgl_ImageReplay_ from '../../../../../src/ol/render/webgl/ImageReplay.js'; -import _ol_style_Image_ from '../../../../../src/ol/style/Image.js'; +import ImageStyle from '../../../../../src/ol/style/Image.js'; describe('ol.render.webgl.ImageReplay', function() { var replay; var createImageStyle = function(image) { - var imageStyle = new _ol_style_Image_({ + var imageStyle = new ImageStyle({ opacity: 0.1, rotateWithView: true, rotation: 1.5, From aa89746c4730691c14a44e9e1171a114a79e7eed Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 13:33:41 -0700 Subject: [PATCH 33/35] Rename _ol_proj_Projection_ to Projection --- examples/geojson-vt.js | 4 +-- examples/sphere-mollweide.js | 4 +-- examples/static-image.js | 4 +-- examples/wms-custom-proj.js | 4 +-- examples/wms-image-custom-proj.js | 4 +-- examples/wms-no-proj.js | 4 +-- src/ol/format/MVT.js | 4 +-- src/ol/proj/EPSG3857.js | 6 ++-- src/ol/proj/EPSG4326.js | 6 ++-- src/ol/proj/Projection.js | 34 +++++++++---------- test/spec/ol/control/scaleline.test.js | 6 ++-- test/spec/ol/format/kml.test.js | 4 +-- test/spec/ol/proj.test.js | 20 +++++------ test/spec/ol/proj/transforms.test.js | 6 ++-- .../ol/renderer/canvas/imagelayer.test.js | 4 +-- .../renderer/canvas/vectortilelayer.test.js | 4 +-- test/spec/ol/source/raster.test.js | 4 +-- test/spec/ol/source/tile.test.js | 4 +-- test/spec/ol/source/tileimage.test.js | 4 +-- test/spec/ol/source/wmts.test.js | 8 ++--- test/spec/ol/source/zoomify.test.js | 4 +-- test/spec/ol/tilegrid/tilegrid.test.js | 4 +-- test/spec/ol/vectortile.test.js | 4 +-- 23 files changed, 75 insertions(+), 75 deletions(-) diff --git a/examples/geojson-vt.js b/examples/geojson-vt.js index 6aae1d7005..06ff1dc2d3 100644 --- a/examples/geojson-vt.js +++ b/examples/geojson-vt.js @@ -6,7 +6,7 @@ import OSM from '../src/ol/source/OSM.js'; import VectorTileSource from '../src/ol/source/VectorTile.js'; import TileLayer from '../src/ol/layer/Tile.js'; import VectorTileLayer from '../src/ol/layer/VectorTile.js'; -import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; +import Projection from '../src/ol/proj/Projection.js'; var replacer = function(key, value) { @@ -48,7 +48,7 @@ var replacer = function(key, value) { } }; -var tilePixels = new _ol_proj_Projection_({ +var tilePixels = new Projection({ code: 'TILE_PIXELS', units: 'tile-pixels' }); diff --git a/examples/sphere-mollweide.js b/examples/sphere-mollweide.js index 71ff806e43..09a667a1b1 100644 --- a/examples/sphere-mollweide.js +++ b/examples/sphere-mollweide.js @@ -3,7 +3,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import VectorLayer from '../src/ol/layer/Vector.js'; -import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; +import Projection from '../src/ol/proj/Projection.js'; import VectorSource from '../src/ol/source/Vector.js'; import {register} from '../src/ol/proj/proj4.js'; import proj4 from 'proj4'; @@ -15,7 +15,7 @@ register(proj4); // Configure the Sphere Mollweide projection object with an extent, // and a world extent. These are required for the Graticule. -var sphereMollweideProjection = new _ol_proj_Projection_({ +var sphereMollweideProjection = new Projection({ code: 'ESRI:53009', extent: [-9009954.605703328, -9009954.605703328, 9009954.605703328, 9009954.605703328], diff --git a/examples/static-image.js b/examples/static-image.js index 7cc3e4caeb..3e152094cf 100644 --- a/examples/static-image.js +++ b/examples/static-image.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import * as _ol_extent_ from '../src/ol/extent.js'; import ImageLayer from '../src/ol/layer/Image.js'; -import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; +import Projection from '../src/ol/proj/Projection.js'; import Static from '../src/ol/source/ImageStatic.js'; @@ -10,7 +10,7 @@ import Static from '../src/ol/source/ImageStatic.js'; // coordinates directly to map coordinates, so we create a projection that uses // the image extent in pixels. var extent = [0, 0, 1024, 968]; -var projection = new _ol_proj_Projection_({ +var projection = new Projection({ code: 'xkcd-image', units: 'pixels', extent: extent diff --git a/examples/wms-custom-proj.js b/examples/wms-custom-proj.js index 473997a764..918b165547 100644 --- a/examples/wms-custom-proj.js +++ b/examples/wms-custom-proj.js @@ -4,7 +4,7 @@ import {defaults as defaultControls} from '../src/ol/control.js'; import ScaleLine from '../src/ol/control/ScaleLine.js'; import TileLayer from '../src/ol/layer/Tile.js'; import {addProjection, addCoordinateTransforms, transform} from '../src/ol/proj.js'; -import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; +import Projection from '../src/ol/proj/Projection.js'; import TileWMS from '../src/ol/source/TileWMS.js'; @@ -13,7 +13,7 @@ import TileWMS from '../src/ol/source/TileWMS.js'; // ol.proj.addProjection to make it available to the library for lookup by its // code. -var projection = new _ol_proj_Projection_({ +var projection = new Projection({ code: 'EPSG:21781', // The extent is used to determine zoom level 0. Recommended values for a // projection's validity extent can be found at https://epsg.io/. diff --git a/examples/wms-image-custom-proj.js b/examples/wms-image-custom-proj.js index b3be1e0b07..e01e64c903 100644 --- a/examples/wms-image-custom-proj.js +++ b/examples/wms-image-custom-proj.js @@ -4,7 +4,7 @@ import {defaults as defaultControls} from '../src/ol/control.js'; import ScaleLine from '../src/ol/control/ScaleLine.js'; import ImageLayer from '../src/ol/layer/Image.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; +import Projection from '../src/ol/proj/Projection.js'; import ImageWMS from '../src/ol/source/ImageWMS.js'; import {register} from '../src/ol/proj/proj4.js'; import proj4 from 'proj4'; @@ -29,7 +29,7 @@ proj4.defs('EPSG:21781', '+towgs84=660.077,13.551,369.344,2.484,1.783,2.939,5.66 +units=m +no_defs'); register(proj4); -var projection = new _ol_proj_Projection_({ +var projection = new Projection({ code: 'EPSG:21781', extent: [485869.5728, 76443.1884, 837076.5648, 299941.7864] }); diff --git a/examples/wms-no-proj.js b/examples/wms-no-proj.js index dfe3625a45..2acc62144e 100644 --- a/examples/wms-no-proj.js +++ b/examples/wms-no-proj.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import ImageLayer from '../src/ol/layer/Image.js'; import TileLayer from '../src/ol/layer/Tile.js'; -import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; +import Projection from '../src/ol/proj/Projection.js'; import ImageWMS from '../src/ol/source/ImageWMS.js'; import TileWMS from '../src/ol/source/TileWMS.js'; @@ -37,7 +37,7 @@ var layers = [ // projection object. Requesting tiles only needs the code together with a // tile grid of Cartesian coordinates; it does not matter how those // coordinates relate to latitude or longitude. -var projection = new _ol_proj_Projection_({ +var projection = new Projection({ code: 'EPSG:21781', units: 'm' }); diff --git a/src/ol/format/MVT.js b/src/ol/format/MVT.js index 13322ed856..223fecd4e9 100644 --- a/src/ol/format/MVT.js +++ b/src/ol/format/MVT.js @@ -17,7 +17,7 @@ import MultiPolygon from '../geom/MultiPolygon.js'; import Point from '../geom/Point.js'; import Polygon from '../geom/Polygon.js'; import _ol_geom_flat_orient_ from '../geom/flat/orient.js'; -import _ol_proj_Projection_ from '../proj/Projection.js'; +import Projection from '../proj/Projection.js'; import Units from '../proj/Units.js'; import _ol_render_Feature_ from '../render/Feature.js'; @@ -39,7 +39,7 @@ var MVT = function(opt_options) { /** * @type {ol.proj.Projection} */ - this.defaultDataProjection = new _ol_proj_Projection_({ + this.defaultDataProjection = new Projection({ code: '', units: Units.TILE_PIXELS }); diff --git a/src/ol/proj/EPSG3857.js b/src/ol/proj/EPSG3857.js index 033a3ecdcc..e72398b3b7 100644 --- a/src/ol/proj/EPSG3857.js +++ b/src/ol/proj/EPSG3857.js @@ -3,7 +3,7 @@ */ import {inherits} from '../index.js'; import {cosh} from '../math.js'; -import _ol_proj_Projection_ from '../proj/Projection.js'; +import Projection from '../proj/Projection.js'; import Units from '../proj/Units.js'; var _ol_proj_EPSG3857_ = {}; @@ -18,7 +18,7 @@ var _ol_proj_EPSG3857_ = {}; * @private */ _ol_proj_EPSG3857_.Projection_ = function(code) { - _ol_proj_Projection_.call(this, { + Projection.call(this, { code: code, units: Units.METERS, extent: _ol_proj_EPSG3857_.EXTENT, @@ -29,7 +29,7 @@ _ol_proj_EPSG3857_.Projection_ = function(code) { } }); }; -inherits(_ol_proj_EPSG3857_.Projection_, _ol_proj_Projection_); +inherits(_ol_proj_EPSG3857_.Projection_, Projection); /** diff --git a/src/ol/proj/EPSG4326.js b/src/ol/proj/EPSG4326.js index cff4203b1b..645a3eb29c 100644 --- a/src/ol/proj/EPSG4326.js +++ b/src/ol/proj/EPSG4326.js @@ -2,7 +2,7 @@ * @module ol/proj/EPSG4326 */ import {inherits} from '../index.js'; -import _ol_proj_Projection_ from '../proj/Projection.js'; +import Projection from '../proj/Projection.js'; import Units from '../proj/Units.js'; var _ol_proj_EPSG4326_ = {}; @@ -22,7 +22,7 @@ var _ol_proj_EPSG4326_ = {}; * @private */ _ol_proj_EPSG4326_.Projection_ = function(code, opt_axisOrientation) { - _ol_proj_Projection_.call(this, { + Projection.call(this, { code: code, units: Units.DEGREES, extent: _ol_proj_EPSG4326_.EXTENT, @@ -32,7 +32,7 @@ _ol_proj_EPSG4326_.Projection_ = function(code, opt_axisOrientation) { worldExtent: _ol_proj_EPSG4326_.EXTENT }); }; -inherits(_ol_proj_EPSG4326_.Projection_, _ol_proj_Projection_); +inherits(_ol_proj_EPSG4326_.Projection_, Projection); /** diff --git a/src/ol/proj/Projection.js b/src/ol/proj/Projection.js index 08df01e4c1..75b6a916d0 100644 --- a/src/ol/proj/Projection.js +++ b/src/ol/proj/Projection.js @@ -33,7 +33,7 @@ import Units from '../proj/Units.js'; * @struct * @api */ -var _ol_proj_Projection_ = function(options) { +var Projection = function(options) { /** * @private * @type {string} @@ -110,7 +110,7 @@ var _ol_proj_Projection_ = function(options) { /** * @return {boolean} The projection is suitable for wrapping the x-axis */ -_ol_proj_Projection_.prototype.canWrapX = function() { +Projection.prototype.canWrapX = function() { return this.canWrapX_; }; @@ -120,7 +120,7 @@ _ol_proj_Projection_.prototype.canWrapX = function() { * @return {string} Code. * @api */ -_ol_proj_Projection_.prototype.getCode = function() { +Projection.prototype.getCode = function() { return this.code_; }; @@ -130,7 +130,7 @@ _ol_proj_Projection_.prototype.getCode = function() { * @return {ol.Extent} Extent. * @api */ -_ol_proj_Projection_.prototype.getExtent = function() { +Projection.prototype.getExtent = function() { return this.extent_; }; @@ -140,7 +140,7 @@ _ol_proj_Projection_.prototype.getExtent = function() { * @return {ol.proj.Units} Units. * @api */ -_ol_proj_Projection_.prototype.getUnits = function() { +Projection.prototype.getUnits = function() { return this.units_; }; @@ -152,7 +152,7 @@ _ol_proj_Projection_.prototype.getUnits = function() { * @return {number|undefined} Meters. * @api */ -_ol_proj_Projection_.prototype.getMetersPerUnit = function() { +Projection.prototype.getMetersPerUnit = function() { return this.metersPerUnit_ || Units.METERS_PER_UNIT[this.units_]; }; @@ -162,7 +162,7 @@ _ol_proj_Projection_.prototype.getMetersPerUnit = function() { * @return {ol.Extent} Extent. * @api */ -_ol_proj_Projection_.prototype.getWorldExtent = function() { +Projection.prototype.getWorldExtent = function() { return this.worldExtent_; }; @@ -178,7 +178,7 @@ _ol_proj_Projection_.prototype.getWorldExtent = function() { * @return {string} Axis orientation. * @api */ -_ol_proj_Projection_.prototype.getAxisOrientation = function() { +Projection.prototype.getAxisOrientation = function() { return this.axisOrientation_; }; @@ -188,7 +188,7 @@ _ol_proj_Projection_.prototype.getAxisOrientation = function() { * @return {boolean} Whether the projection is global. * @api */ -_ol_proj_Projection_.prototype.isGlobal = function() { +Projection.prototype.isGlobal = function() { return this.global_; }; @@ -198,7 +198,7 @@ _ol_proj_Projection_.prototype.isGlobal = function() { * @param {boolean} global Whether the projection is global. * @api */ -_ol_proj_Projection_.prototype.setGlobal = function(global) { +Projection.prototype.setGlobal = function(global) { this.global_ = global; this.canWrapX_ = !!(global && this.extent_); }; @@ -207,7 +207,7 @@ _ol_proj_Projection_.prototype.setGlobal = function(global) { /** * @return {ol.tilegrid.TileGrid} The default tile grid. */ -_ol_proj_Projection_.prototype.getDefaultTileGrid = function() { +Projection.prototype.getDefaultTileGrid = function() { return this.defaultTileGrid_; }; @@ -215,7 +215,7 @@ _ol_proj_Projection_.prototype.getDefaultTileGrid = function() { /** * @param {ol.tilegrid.TileGrid} tileGrid The default tile grid. */ -_ol_proj_Projection_.prototype.setDefaultTileGrid = function(tileGrid) { +Projection.prototype.setDefaultTileGrid = function(tileGrid) { this.defaultTileGrid_ = tileGrid; }; @@ -225,7 +225,7 @@ _ol_proj_Projection_.prototype.setDefaultTileGrid = function(tileGrid) { * @param {ol.Extent} extent Extent. * @api */ -_ol_proj_Projection_.prototype.setExtent = function(extent) { +Projection.prototype.setExtent = function(extent) { this.extent_ = extent; this.canWrapX_ = !!(this.global_ && extent); }; @@ -237,7 +237,7 @@ _ol_proj_Projection_.prototype.setExtent = function(extent) { * [minlon, minlat, maxlon, maxlat]. * @api */ -_ol_proj_Projection_.prototype.setWorldExtent = function(worldExtent) { +Projection.prototype.setWorldExtent = function(worldExtent) { this.worldExtent_ = worldExtent; }; @@ -248,7 +248,7 @@ _ol_proj_Projection_.prototype.setWorldExtent = function(worldExtent) { * @param {function(number, ol.Coordinate):number} func Function * @api */ -_ol_proj_Projection_.prototype.setGetPointResolution = function(func) { +Projection.prototype.setGetPointResolution = function(func) { this.getPointResolutionFunc_ = func; }; @@ -258,7 +258,7 @@ _ol_proj_Projection_.prototype.setGetPointResolution = function(func) { * @return {function(number, ol.Coordinate):number|undefined} The custom point * resolution function (if set). */ -_ol_proj_Projection_.prototype.getPointResolutionFunc = function() { +Projection.prototype.getPointResolutionFunc = function() { return this.getPointResolutionFunc_; }; -export default _ol_proj_Projection_; +export default Projection; diff --git a/test/spec/ol/control/scaleline.test.js b/test/spec/ol/control/scaleline.test.js index 46e91db67e..179dc5f12f 100644 --- a/test/spec/ol/control/scaleline.test.js +++ b/test/spec/ol/control/scaleline.test.js @@ -2,7 +2,7 @@ import Map from '../../../../src/ol/Map.js'; import View from '../../../../src/ol/View.js'; import ScaleLine from '../../../../src/ol/control/ScaleLine.js'; import {fromLonLat} from '../../../../src/ol/proj.js'; -import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; +import Projection from '../../../../src/ol/proj/Projection.js'; describe('ol.control.ScaleLine', function() { var map; @@ -272,7 +272,7 @@ describe('ol.control.ScaleLine', function() { center: [0, 0], zoom: 0, resolutions: [1], - projection: new _ol_proj_Projection_({ + projection: new Projection({ code: 'METERS', units: 'm', getPointResolution: function(r) { @@ -286,7 +286,7 @@ describe('ol.control.ScaleLine', function() { center: [0, 0], zoom: 0, resolutions: [1], - projection: new _ol_proj_Projection_({ + projection: new Projection({ code: 'PIXELS', units: 'pixels', metersPerUnit: 1 / 1000, diff --git a/test/spec/ol/format/kml.test.js b/test/spec/ol/format/kml.test.js index 52402f8e4e..fa6b9775ae 100644 --- a/test/spec/ol/format/kml.test.js +++ b/test/spec/ol/format/kml.test.js @@ -11,7 +11,7 @@ import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; import Point from '../../../../src/ol/geom/Point.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; import {addProjection, addCoordinateTransforms, transform, get as getProjection} from '../../../../src/ol/proj.js'; -import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; +import Projection from '../../../../src/ol/proj/Projection.js'; import {remove as removeTransform} from '../../../../src/ol/proj/transforms.js'; import CircleStyle from '../../../../src/ol/style/Circle.js'; import Fill from '../../../../src/ol/style/Fill.js'; @@ -356,7 +356,7 @@ describe('ol.format.KML', function() { }); it('can transform and write XYZ Point geometries', function() { - addProjection(new _ol_proj_Projection_({code: 'double'})); + addProjection(new Projection({code: 'double'})); addCoordinateTransforms('EPSG:4326', 'double', function(coordinate) { return [2 * coordinate[0], 2 * coordinate[1]]; diff --git a/test/spec/ol/proj.test.js b/test/spec/ol/proj.test.js index 345f55e07c..0cece3e2a5 100644 --- a/test/spec/ol/proj.test.js +++ b/test/spec/ol/proj.test.js @@ -14,7 +14,7 @@ import { import {register} from '../../../src/ol/proj/proj4.js'; import _ol_proj_EPSG3857_ from '../../../src/ol/proj/EPSG3857.js'; import _ol_proj_EPSG4326_ from '../../../src/ol/proj/EPSG4326.js'; -import _ol_proj_Projection_ from '../../../src/ol/proj/Projection.js'; +import Projection from '../../../src/ol/proj/Projection.js'; describe('ol.proj', function() { @@ -71,11 +71,11 @@ describe('ol.proj', function() { it('gives that custom 3413 is equivalent to self', function() { var code = 'EPSG:3413'; - var source = new _ol_proj_Projection_({ + var source = new Projection({ code: code }); - var destination = new _ol_proj_Projection_({ + var destination = new Projection({ code: code }); @@ -101,11 +101,11 @@ describe('ol.proj', function() { it('requires code and units to be equal for projection evquivalence', function() { - var proj1 = new _ol_proj_Projection_({ + var proj1 = new Projection({ code: 'EPSG:3857', units: 'm' }); - var proj2 = new _ol_proj_Projection_({ + var proj2 = new Projection({ code: 'EPSG:3857', units: 'tile-pixels' }); @@ -194,14 +194,14 @@ describe('ol.proj', function() { describe('canWrapX()', function() { it('requires an extent for allowing wrapX', function() { - var proj = new _ol_proj_Projection_({ + var proj = new Projection({ code: 'foo', global: true }); expect(proj.canWrapX()).to.be(false); proj.setExtent([1, 2, 3, 4]); expect(proj.canWrapX()).to.be(true); - proj = new _ol_proj_Projection_({ + proj = new Projection({ code: 'foo', global: true, extent: [1, 2, 3, 4] @@ -212,14 +212,14 @@ describe('ol.proj', function() { }); it('requires global to be true for allowing wrapX', function() { - var proj = new _ol_proj_Projection_({ + var proj = new Projection({ code: 'foo', extent: [1, 2, 3, 4] }); expect(proj.canWrapX()).to.be(false); proj.setGlobal(true); expect(proj.canWrapX()).to.be(true); - proj = new _ol_proj_Projection_({ + proj = new Projection({ code: 'foo', global: true, extent: [1, 2, 3, 4] @@ -395,7 +395,7 @@ describe('ol.proj', function() { it('does not overwrite existing projections in the registry', function() { register(proj4); var epsg4326 = getProjection('EPSG:4326'); - new _ol_proj_Projection_({ + new Projection({ code: 'EPSG:4326', units: 'degrees', extent: [-45, -45, 45, 45] diff --git a/test/spec/ol/proj/transforms.test.js b/test/spec/ol/proj/transforms.test.js index 80d674321d..01f2ab4e90 100644 --- a/test/spec/ol/proj/transforms.test.js +++ b/test/spec/ol/proj/transforms.test.js @@ -1,4 +1,4 @@ -import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; +import Projection from '../../../../src/ol/proj/Projection.js'; import * as transforms from '../../../../src/ol/proj/transforms.js'; @@ -8,12 +8,12 @@ describe('transforms.remove()', function() { var units = 'degrees'; it('removes functions cached by transforms.add()', function() { - var foo = new _ol_proj_Projection_({ + var foo = new Projection({ code: 'foo', units: units, extent: extent }); - var bar = new _ol_proj_Projection_({ + var bar = new Projection({ code: 'bar', units: units, extent: extent diff --git a/test/spec/ol/renderer/canvas/imagelayer.test.js b/test/spec/ol/renderer/canvas/imagelayer.test.js index 64ae4723ec..423e73eb16 100644 --- a/test/spec/ol/renderer/canvas/imagelayer.test.js +++ b/test/spec/ol/renderer/canvas/imagelayer.test.js @@ -1,7 +1,7 @@ import Map from '../../../../../src/ol/Map.js'; import View from '../../../../../src/ol/View.js'; import ImageLayer from '../../../../../src/ol/layer/Image.js'; -import _ol_proj_Projection_ from '../../../../../src/ol/proj/Projection.js'; +import Projection from '../../../../../src/ol/proj/Projection.js'; import Static from '../../../../../src/ol/source/ImageStatic.js'; @@ -11,7 +11,7 @@ describe('ol.renderer.canvas.ImageLayer', function() { var map, target, source; beforeEach(function(done) { - var projection = new _ol_proj_Projection_({ + var projection = new Projection({ code: 'custom-image', units: 'pixels', extent: [0, 0, 200, 200] diff --git a/test/spec/ol/renderer/canvas/vectortilelayer.test.js b/test/spec/ol/renderer/canvas/vectortilelayer.test.js index b738364496..369e170832 100644 --- a/test/spec/ol/renderer/canvas/vectortilelayer.test.js +++ b/test/spec/ol/renderer/canvas/vectortilelayer.test.js @@ -11,7 +11,7 @@ import MVT from '../../../../../src/ol/format/MVT.js'; import Point from '../../../../../src/ol/geom/Point.js'; import VectorTileLayer from '../../../../../src/ol/layer/VectorTile.js'; import {get as getProjection, fromLonLat} from '../../../../../src/ol/proj.js'; -import _ol_proj_Projection_ from '../../../../../src/ol/proj/Projection.js'; +import Projection from '../../../../../src/ol/proj/Projection.js'; import _ol_render_canvas_ from '../../../../../src/ol/render/canvas.js'; import _ol_render_Feature_ from '../../../../../src/ol/render/Feature.js'; import CanvasVectorTileLayerRenderer from '../../../../../src/ol/renderer/canvas/VectorTileLayer.js'; @@ -201,7 +201,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { }); it('Geometries are transformed from tile-pixels', function() { - var proj = new _ol_proj_Projection_({code: 'EPSG:3857', units: 'tile-pixels'}); + var proj = new Projection({code: 'EPSG:3857', units: 'tile-pixels'}); var tile; tileCallback = function(t) { t.setProjection(proj); diff --git a/test/spec/ol/source/raster.test.js b/test/spec/ol/source/raster.test.js index 225b5c59a9..ccbdfba202 100644 --- a/test/spec/ol/source/raster.test.js +++ b/test/spec/ol/source/raster.test.js @@ -2,7 +2,7 @@ import Map from '../../../../src/ol/Map.js'; import TileState from '../../../../src/ol/TileState.js'; import View from '../../../../src/ol/View.js'; import ImageLayer from '../../../../src/ol/layer/Image.js'; -import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; +import Projection from '../../../../src/ol/proj/Projection.js'; import Static from '../../../../src/ol/source/ImageStatic.js'; import RasterSource from '../../../../src/ol/source/Raster.js'; import Source from '../../../../src/ol/source/Source.js'; @@ -62,7 +62,7 @@ where('Uint8ClampedArray').describe('ol.source.Raster', function() { target: target, view: new View({ resolutions: [1], - projection: new _ol_proj_Projection_({ + projection: new Projection({ code: 'image', units: 'pixels', extent: extent diff --git a/test/spec/ol/source/tile.test.js b/test/spec/ol/source/tile.test.js index 79375e1bcf..f23a4bab63 100644 --- a/test/spec/ol/source/tile.test.js +++ b/test/spec/ol/source/tile.test.js @@ -2,7 +2,7 @@ import {inherits} from '../../../../src/ol/index.js'; import Tile from '../../../../src/ol/Tile.js'; import TileRange from '../../../../src/ol/TileRange.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; -import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; +import Projection from '../../../../src/ol/proj/Projection.js'; import Source from '../../../../src/ol/source/Source.js'; import TileSource from '../../../../src/ol/source/Tile.js'; import _ol_tilecoord_ from '../../../../src/ol/tilecoord.js'; @@ -258,7 +258,7 @@ describe('ol.source.Tile', function() { it('works with wrapX and custom projection without extent', function() { var tileSource = new TileSource({ - projection: new _ol_proj_Projection_({ + projection: new Projection({ code: 'foo', global: true, units: 'm' diff --git a/test/spec/ol/source/tileimage.test.js b/test/spec/ol/source/tileimage.test.js index efd743dd79..b09593ea18 100644 --- a/test/spec/ol/source/tileimage.test.js +++ b/test/spec/ol/source/tileimage.test.js @@ -5,7 +5,7 @@ import _ol_events_ from '../../../../src/ol/events.js'; import {addCommon, clearAllProjections, get as getProjection} from '../../../../src/ol/proj.js'; import {register} from '../../../../src/ol/proj/proj4.js'; import _ol_proj_EPSG3857_ from '../../../../src/ol/proj/EPSG3857.js'; -import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; +import Projection from '../../../../src/ol/proj/Projection.js'; import ReprojTile from '../../../../src/ol/reproj/Tile.js'; import TileImage from '../../../../src/ol/source/TileImage.js'; import _ol_tilecoord_ from '../../../../src/ol/tilecoord.js'; @@ -119,7 +119,7 @@ describe('ol.source.TileImage', function() { expect(tile3857).to.be.a(ImageTile); expect(tile3857).not.to.be.a(ReprojTile); - var projXXX = new _ol_proj_Projection_({ + var projXXX = new Projection({ code: 'XXX', units: 'degrees' }); diff --git a/test/spec/ol/source/wmts.test.js b/test/spec/ol/source/wmts.test.js index 78f8194359..6e59b6b646 100644 --- a/test/spec/ol/source/wmts.test.js +++ b/test/spec/ol/source/wmts.test.js @@ -1,6 +1,6 @@ import _ol_format_WMTSCapabilities_ from '../../../../src/ol/format/WMTSCapabilities.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; -import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; +import Projection from '../../../../src/ol/proj/Projection.js'; import WMTSTileGrid from '../../../../src/ol/tilegrid/WMTS.js'; import WMTS from '../../../../src/ol/source/WMTS.js'; @@ -57,7 +57,7 @@ describe('ol.source.WMTS', function() { expect(options.format).to.be.eql('image/jpeg'); - expect(options.projection).to.be.a(_ol_proj_Projection_); + expect(options.projection).to.be.a(Projection); expect(options.projection).to.be.eql(getProjection('EPSG:3857')); expect(options.requestEncoding).to.be.eql('KVP'); @@ -91,7 +91,7 @@ describe('ol.source.WMTS', function() { expect(options.format).to.be.eql('image/png'); - expect(options.projection).to.be.a(_ol_proj_Projection_); + expect(options.projection).to.be.a(Projection); expect(options.projection).to.be.eql(getProjection('EPSG:3857')); expect(options.requestEncoding).to.be.eql('REST'); @@ -139,7 +139,7 @@ describe('ol.source.WMTS', function() { it('uses the projection of the default MatrixSet if the config\'s projection is not supported', function() { var options = WMTS.optionsFromCapabilities(capabilities, { layer: 'BlueMarbleNextGeneration', - projection: new _ol_proj_Projection_({ + projection: new Projection({ code: 'EPSG:2056', units: 'm' }) diff --git a/test/spec/ol/source/zoomify.test.js b/test/spec/ol/source/zoomify.test.js index 0d529a4e5c..eb4c831728 100644 --- a/test/spec/ol/source/zoomify.test.js +++ b/test/spec/ol/source/zoomify.test.js @@ -1,6 +1,6 @@ import {DEFAULT_TILE_SIZE} from '../../../../src/ol/tilegrid/common.js'; import _ol_events_ from '../../../../src/ol/events.js'; -import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; +import Projection from '../../../../src/ol/proj/Projection.js'; import Zoomify from '../../../../src/ol/source/Zoomify.js'; import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js'; @@ -11,7 +11,7 @@ describe('ol.source.Zoomify', function() { var size = [w, h]; var zoomifyUrl = 'spec/ol/source/images/zoomify/{TileGroup}/{z}-{x}-{y}.jpg'; var iipUrl = 'spec/ol/source/images/zoomify?JTL={z},{tileIndex}'; - var proj = new _ol_proj_Projection_({ + var proj = new Projection({ code: 'ZOOMIFY', units: 'pixels', extent: [0, 0, w, h] diff --git a/test/spec/ol/tilegrid/tilegrid.test.js b/test/spec/ol/tilegrid/tilegrid.test.js index f6210f384f..5509fda135 100644 --- a/test/spec/ol/tilegrid/tilegrid.test.js +++ b/test/spec/ol/tilegrid/tilegrid.test.js @@ -3,7 +3,7 @@ import TileRange from '../../../../src/ol/TileRange.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js'; import {get as getProjection, METERS_PER_UNIT} from '../../../../src/ol/proj.js'; import _ol_proj_EPSG3857_ from '../../../../src/ol/proj/EPSG3857.js'; -import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js'; +import Projection from '../../../../src/ol/proj/Projection.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js'; @@ -335,7 +335,7 @@ describe('ol.tilegrid.TileGrid', function() { }); it('works for projections unknown to the client', function() { - var projection = new _ol_proj_Projection_( + var projection = new Projection( {code: 'EPSG:31287', units: 'm'}); var grid = _ol_tilegrid_.createForProjection(projection); var resolutions = grid.getResolutions(); diff --git a/test/spec/ol/vectortile.test.js b/test/spec/ol/vectortile.test.js index d129e92f3f..4a69833173 100644 --- a/test/spec/ol/vectortile.test.js +++ b/test/spec/ol/vectortile.test.js @@ -4,7 +4,7 @@ import VectorTile from '../../../src/ol/VectorTile.js'; import _ol_events_ from '../../../src/ol/events.js'; import TextFeature from '../../../src/ol/format/TextFeature.js'; import {get as getProjection} from '../../../src/ol/proj.js'; -import _ol_proj_Projection_ from '../../../src/ol/proj/Projection.js'; +import Projection from '../../../src/ol/proj/Projection.js'; describe('ol.VectorTile', function() { @@ -13,7 +13,7 @@ describe('ol.VectorTile', function() { // mock format that return a tile-pixels feature var format = new TextFeature(); format.readProjection = function(source) { - return new _ol_proj_Projection_({ + return new Projection({ code: '', units: 'tile-pixels' }); From 8cba211ecda4c2533f7f3b5644b8d6893e2a40d4 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 13:44:45 -0700 Subject: [PATCH 34/35] Rename _ol_pointer_PointerEvent_ to PointerEvent --- src/ol/pointer/PointerEvent.js | 16 ++++++------ src/ol/pointer/PointerEventHandler.js | 4 +-- test/spec/ol/control/zoomslider.test.js | 6 ++--- .../ol/interaction/dragrotateandzoom.test.js | 6 ++--- test/spec/ol/interaction/draw.test.js | 6 ++--- test/spec/ol/interaction/extent.test.js | 4 +-- test/spec/ol/interaction/modify.test.js | 4 +-- test/spec/ol/interaction/select.test.js | 4 +-- test/spec/ol/interaction/translate.test.js | 4 +-- test/spec/ol/mapbrowserevent.test.js | 26 +++++++++---------- .../ol/pointer/pointereventhandler.test.js | 6 ++--- 11 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/ol/pointer/PointerEvent.js b/src/ol/pointer/PointerEvent.js index d4ed88f2b5..24f87971c3 100644 --- a/src/ol/pointer/PointerEvent.js +++ b/src/ol/pointer/PointerEvent.js @@ -47,7 +47,7 @@ import Event from '../events/Event.js'; * @param {Object.=} opt_eventDict An optional dictionary of * initial event properties. */ -var _ol_pointer_PointerEvent_ = function(type, originalEvent, opt_eventDict) { +var PointerEvent = function(type, originalEvent, opt_eventDict) { Event.call(this, type); /** @@ -192,7 +192,7 @@ var _ol_pointer_PointerEvent_ = function(type, originalEvent, opt_eventDict) { } }; -inherits(_ol_pointer_PointerEvent_, Event); +inherits(PointerEvent, Event); /** @@ -200,7 +200,7 @@ inherits(_ol_pointer_PointerEvent_, Event); * @param {Object.} eventDict The event dictionary. * @return {number} Button indicator. */ -_ol_pointer_PointerEvent_.prototype.getButtons_ = function(eventDict) { +PointerEvent.prototype.getButtons_ = function(eventDict) { // According to the w3c spec, // http://www.w3.org/TR/DOM-Level-3-Events/#events-MouseEvent-button // MouseEvent.button == 0 can mean either no mouse button depressed, or the @@ -223,7 +223,7 @@ _ol_pointer_PointerEvent_.prototype.getButtons_ = function(eventDict) { // // This is fixed with DOM Level 4's use of buttons var buttons; - if (eventDict.buttons || _ol_pointer_PointerEvent_.HAS_BUTTONS) { + if (eventDict.buttons || PointerEvent.HAS_BUTTONS) { buttons = eventDict.buttons; } else { switch (eventDict.which) { @@ -243,7 +243,7 @@ _ol_pointer_PointerEvent_.prototype.getButtons_ = function(eventDict) { * @param {number} buttons Button indicator. * @return {number} The pressure. */ -_ol_pointer_PointerEvent_.prototype.getPressure_ = function(eventDict, buttons) { +PointerEvent.prototype.getPressure_ = function(eventDict, buttons) { // Spec requires that pointers without pressure specified use 0.5 for down // state and 0 for up state. var pressure = 0; @@ -260,7 +260,7 @@ _ol_pointer_PointerEvent_.prototype.getPressure_ = function(eventDict, buttons) * Is the `buttons` property supported? * @type {boolean} */ -_ol_pointer_PointerEvent_.HAS_BUTTONS = false; +PointerEvent.HAS_BUTTONS = false; /** @@ -269,9 +269,9 @@ _ol_pointer_PointerEvent_.HAS_BUTTONS = false; (function() { try { var ev = new MouseEvent('click', {buttons: 1}); - _ol_pointer_PointerEvent_.HAS_BUTTONS = ev.buttons === 1; + PointerEvent.HAS_BUTTONS = ev.buttons === 1; } catch (e) { // pass } })(); -export default _ol_pointer_PointerEvent_; +export default PointerEvent; diff --git a/src/ol/pointer/PointerEventHandler.js b/src/ol/pointer/PointerEventHandler.js index 6e38312604..fd585837a0 100644 --- a/src/ol/pointer/PointerEventHandler.js +++ b/src/ol/pointer/PointerEventHandler.js @@ -39,7 +39,7 @@ import PointerEventType from '../pointer/EventType.js'; import _ol_pointer_MouseSource_ from '../pointer/MouseSource.js'; import _ol_pointer_MsSource_ from '../pointer/MsSource.js'; import _ol_pointer_NativeSource_ from '../pointer/NativeSource.js'; -import _ol_pointer_PointerEvent_ from '../pointer/PointerEvent.js'; +import PointerEvent from '../pointer/PointerEvent.js'; import _ol_pointer_TouchSource_ from '../pointer/TouchSource.js'; /** @@ -353,7 +353,7 @@ PointerEventHandler.prototype.contains_ = function(container, contained) { * @return {ol.pointer.PointerEvent} A PointerEvent of type `inType`. */ PointerEventHandler.prototype.makeEvent = function(inType, data, event) { - return new _ol_pointer_PointerEvent_(inType, event, data); + return new PointerEvent(inType, event, data); }; diff --git a/test/spec/ol/control/zoomslider.test.js b/test/spec/ol/control/zoomslider.test.js index 37c45a5ab0..cb0c20bc95 100644 --- a/test/spec/ol/control/zoomslider.test.js +++ b/test/spec/ol/control/zoomslider.test.js @@ -1,7 +1,7 @@ import Map from '../../../../src/ol/Map.js'; import View from '../../../../src/ol/View.js'; import ZoomSlider from '../../../../src/ol/control/ZoomSlider.js'; -import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; +import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js'; describe('ol.control.ZoomSlider', function() { var map, target, zoomslider; @@ -111,7 +111,7 @@ describe('ol.control.ZoomSlider', function() { control.element.firstChild.style.height = '10px'; map.renderSync(); var dragger = control.dragger_; - var event = new _ol_pointer_PointerEvent_('pointerdown', { + var event = new PointerEvent('pointerdown', { target: control.element.firstElementChild }); event.clientX = control.widthLimit_; @@ -143,7 +143,7 @@ describe('ol.control.ZoomSlider', function() { map.getView().setZoom(8); map.renderSync(); var dragger = control.dragger_; - var event = new _ol_pointer_PointerEvent_('pointerdown', { + var event = new PointerEvent('pointerdown', { target: control.element.firstElementChild }); event.clientX = 0; diff --git a/test/spec/ol/interaction/dragrotateandzoom.test.js b/test/spec/ol/interaction/dragrotateandzoom.test.js index 4c8ab28ffc..6bee0b0ca3 100644 --- a/test/spec/ol/interaction/dragrotateandzoom.test.js +++ b/test/spec/ol/interaction/dragrotateandzoom.test.js @@ -4,7 +4,7 @@ import View from '../../../../src/ol/View.js'; import DragRotateAndZoom from '../../../../src/ol/interaction/DragRotateAndZoom.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; -import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; +import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; describe('ol.interaction.DragRotateAndZoom', function() { @@ -59,7 +59,7 @@ describe('ol.interaction.DragRotateAndZoom', function() { it('does not rotate when rotation is disabled on the view', function() { var event = new MapBrowserPointerEvent('pointermove', map, - new _ol_pointer_PointerEvent_('pointermove', {clientX: 20, clientY: 10}, {pointerType: 'mouse'}), + new PointerEvent('pointermove', {clientX: 20, clientY: 10}, {pointerType: 'mouse'}), true); interaction.lastAngle_ = Math.PI; var spy = sinon.spy(Interaction, 'rotateWithoutConstraints'); @@ -73,7 +73,7 @@ describe('ol.interaction.DragRotateAndZoom', function() { enableRotation: false })); event = new MapBrowserPointerEvent('pointermove', map, - new _ol_pointer_PointerEvent_('pointermove', {clientX: 24, clientY: 16}, {pointerType: 'mouse'}), + new PointerEvent('pointermove', {clientX: 24, clientY: 16}, {pointerType: 'mouse'}), true); interaction.handleDragEvent_(event); expect(spy.callCount).to.be(1); diff --git a/test/spec/ol/interaction/draw.test.js b/test/spec/ol/interaction/draw.test.js index 5371118549..fab70bc755 100644 --- a/test/spec/ol/interaction/draw.test.js +++ b/test/spec/ol/interaction/draw.test.js @@ -15,7 +15,7 @@ import Polygon from '../../../../src/ol/geom/Polygon.js'; import Draw from '../../../../src/ol/interaction/Draw.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; -import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; +import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; @@ -68,7 +68,7 @@ describe('ol.interaction.Draw', function() { // calculated in case body has top < 0 (test runner with small window) var position = viewport.getBoundingClientRect(); var shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false; - var event = new _ol_pointer_PointerEvent_(type, { + var event = new PointerEvent(type, { clientX: position.left + x + width / 2, clientY: position.top + y + height / 2, shiftKey: shiftKey @@ -94,7 +94,7 @@ describe('ol.interaction.Draw', function() { freehand: true }); - var event = new _ol_pointer_PointerEvent_('pointerdown', { + var event = new PointerEvent('pointerdown', { clientX: 0, clientY: 0, shiftKey: false diff --git a/test/spec/ol/interaction/extent.test.js b/test/spec/ol/interaction/extent.test.js index 7035966775..2eb75413d6 100644 --- a/test/spec/ol/interaction/extent.test.js +++ b/test/spec/ol/interaction/extent.test.js @@ -2,7 +2,7 @@ import Map from '../../../../src/ol/Map.js'; import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js'; import View from '../../../../src/ol/View.js'; import ExtentInteraction from '../../../../src/ol/interaction/Extent.js'; -import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; +import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js'; describe('ol.interaction.Extent', function() { var map, interaction; @@ -50,7 +50,7 @@ describe('ol.interaction.Extent', function() { // calculated in case body has top < 0 (test runner with small window) var position = viewport.getBoundingClientRect(); var shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false; - var pointerEvent = new _ol_pointer_PointerEvent_(type, { + var pointerEvent = new PointerEvent(type, { type: type, button: button, clientX: position.left + x + width / 2, diff --git a/test/spec/ol/interaction/modify.test.js b/test/spec/ol/interaction/modify.test.js index ca6d3fc80f..5f40904133 100644 --- a/test/spec/ol/interaction/modify.test.js +++ b/test/spec/ol/interaction/modify.test.js @@ -11,7 +11,7 @@ import Point from '../../../../src/ol/geom/Point.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; import Modify from '../../../../src/ol/interaction/Modify.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; -import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; +import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; @@ -81,7 +81,7 @@ describe('ol.interaction.Modify', function() { var viewport = map.getViewport(); // calculated in case body has top < 0 (test runner with small window) var position = viewport.getBoundingClientRect(); - var pointerEvent = new _ol_pointer_PointerEvent_(type, { + var pointerEvent = new PointerEvent(type, { type: type, clientX: position.left + x + width / 2, clientY: position.top + y + height / 2, diff --git a/test/spec/ol/interaction/select.test.js b/test/spec/ol/interaction/select.test.js index dd54fd0695..659d9e48fc 100644 --- a/test/spec/ol/interaction/select.test.js +++ b/test/spec/ol/interaction/select.test.js @@ -8,7 +8,7 @@ import Polygon from '../../../../src/ol/geom/Polygon.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js'; import Select from '../../../../src/ol/interaction/Select.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; -import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; +import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; @@ -92,7 +92,7 @@ describe('ol.interaction.Select', function() { // calculated in case body has top < 0 (test runner with small window) var position = viewport.getBoundingClientRect(); var shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false; - var event = new _ol_pointer_PointerEvent_(type, { + var event = new PointerEvent(type, { clientX: position.left + x + width / 2, clientY: position.top + y + height / 2, shiftKey: shiftKey diff --git a/test/spec/ol/interaction/translate.test.js b/test/spec/ol/interaction/translate.test.js index 0f5f8a1f91..63fe582a41 100644 --- a/test/spec/ol/interaction/translate.test.js +++ b/test/spec/ol/interaction/translate.test.js @@ -7,7 +7,7 @@ import Point from '../../../../src/ol/geom/Point.js'; import _ol_interaction_Translate_ from '../../../../src/ol/interaction/Translate.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; -import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; +import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; @@ -67,7 +67,7 @@ describe('ol.interaction.Translate', function() { var position = viewport.getBoundingClientRect(); var shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false; var event = new MapBrowserPointerEvent(type, map, - new _ol_pointer_PointerEvent_(type, { + new PointerEvent(type, { clientX: position.left + x + width / 2, clientY: position.top + y + height / 2, shiftKey: shiftKey diff --git a/test/spec/ol/mapbrowserevent.test.js b/test/spec/ol/mapbrowserevent.test.js index a5c80ca175..8a9a5f54d8 100644 --- a/test/spec/ol/mapbrowserevent.test.js +++ b/test/spec/ol/mapbrowserevent.test.js @@ -2,7 +2,7 @@ import Map from '../../../src/ol/Map.js'; import MapBrowserEventHandler from '../../../src/ol/MapBrowserEventHandler.js'; import _ol_events_ from '../../../src/ol/events.js'; import _ol_has_ from '../../../src/ol/has.js'; -import _ol_pointer_PointerEvent_ from '../../../src/ol/pointer/PointerEvent.js'; +import PointerEvent from '../../../src/ol/pointer/PointerEvent.js'; describe('ol.MapBrowserEventHandler', function() { describe('#emulateClick_', function() { @@ -36,7 +36,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('emulates click', function() { - handler.emulateClick_(new _ol_pointer_PointerEvent_('pointerdown', { + handler.emulateClick_(new PointerEvent('pointerdown', { type: 'mousedown', target: target, clientX: 0, @@ -46,7 +46,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('emulates singleclick', function() { - handler.emulateClick_(new _ol_pointer_PointerEvent_('pointerdown', { + handler.emulateClick_(new PointerEvent('pointerdown', { type: 'mousedown', target: target, clientX: 0, @@ -59,7 +59,7 @@ describe('ol.MapBrowserEventHandler', function() { expect(singleclickSpy.calledOnce).to.be.ok(); expect(dblclickSpy.called).to.not.be.ok(); - handler.emulateClick_(new _ol_pointer_PointerEvent_('pointerdown', { + handler.emulateClick_(new PointerEvent('pointerdown', { type: 'mousedown', target: target, clientX: 0, @@ -70,7 +70,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('emulates dblclick', function() { - handler.emulateClick_(new _ol_pointer_PointerEvent_('pointerdown', { + handler.emulateClick_(new PointerEvent('pointerdown', { type: 'mousedown', target: target, clientX: 0, @@ -79,7 +79,7 @@ describe('ol.MapBrowserEventHandler', function() { expect(singleclickSpy.called).to.not.be.ok(); expect(dblclickSpy.called).to.not.be.ok(); - handler.emulateClick_(new _ol_pointer_PointerEvent_('pointerdown', { + handler.emulateClick_(new PointerEvent('pointerdown', { type: 'mousedown', target: target, clientX: 0, @@ -107,7 +107,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('is an event after handlePointerDown_ has been called', function() { - var event = new _ol_pointer_PointerEvent_('pointerdown', {}); + var event = new PointerEvent('pointerdown', {}); handler.handlePointerDown_(event); expect(handler.down_).to.be(event); }); @@ -121,7 +121,7 @@ describe('ol.MapBrowserEventHandler', function() { beforeEach(function() { defaultHandler = new MapBrowserEventHandler(new Map({})); moveToleranceHandler = new MapBrowserEventHandler(new Map({}), 8); - pointerdownAt0 = new _ol_pointer_PointerEvent_('pointerdown', {}, { + pointerdownAt0 = new PointerEvent('pointerdown', {}, { clientX: 0, clientY: 0 }); @@ -130,7 +130,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('is not moving if distance is 0', function() { - var pointerdownAt0 = new _ol_pointer_PointerEvent_('pointerdown', {}, { + var pointerdownAt0 = new PointerEvent('pointerdown', {}, { clientX: 0, clientY: 0 }); @@ -138,7 +138,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('is moving if distance is 2', function() { - var pointerdownAt2 = new _ol_pointer_PointerEvent_('pointerdown', {}, { + var pointerdownAt2 = new PointerEvent('pointerdown', {}, { clientX: _ol_has_.DEVICE_PIXEL_RATIO + 1, clientY: _ol_has_.DEVICE_PIXEL_RATIO + 1 }); @@ -146,7 +146,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('is moving with negative distance', function() { - var pointerdownAt2 = new _ol_pointer_PointerEvent_('pointerdown', {}, { + var pointerdownAt2 = new PointerEvent('pointerdown', {}, { clientX: -(_ol_has_.DEVICE_PIXEL_RATIO + 1), clientY: -(_ol_has_.DEVICE_PIXEL_RATIO + 1) }); @@ -154,7 +154,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('is not moving if distance is less than move tolerance', function() { - var pointerdownAt2 = new _ol_pointer_PointerEvent_('pointerdown', {}, { + var pointerdownAt2 = new PointerEvent('pointerdown', {}, { clientX: _ol_has_.DEVICE_PIXEL_RATIO + 1, clientY: _ol_has_.DEVICE_PIXEL_RATIO + 1 }); @@ -162,7 +162,7 @@ describe('ol.MapBrowserEventHandler', function() { }); it('is moving if distance is greater than move tolerance', function() { - var pointerdownAt9 = new _ol_pointer_PointerEvent_('pointerdown', {}, { + var pointerdownAt9 = new PointerEvent('pointerdown', {}, { clientX: (_ol_has_.DEVICE_PIXEL_RATIO * 8) + 1, clientY: (_ol_has_.DEVICE_PIXEL_RATIO * 8) + 1 }); diff --git a/test/spec/ol/pointer/pointereventhandler.test.js b/test/spec/ol/pointer/pointereventhandler.test.js index 6d5959075b..dcde3beb7a 100644 --- a/test/spec/ol/pointer/pointereventhandler.test.js +++ b/test/spec/ol/pointer/pointereventhandler.test.js @@ -2,7 +2,7 @@ import _ol_events_ from '../../../../src/ol/events.js'; import EventTarget from '../../../../src/ol/events/EventTarget.js'; import _ol_has_ from '../../../../src/ol/has.js'; import _ol_pointer_MouseSource_ from '../../../../src/ol/pointer/MouseSource.js'; -import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js'; +import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js'; import PointerEventHandler from '../../../../src/ol/pointer/PointerEventHandler.js'; @@ -51,7 +51,7 @@ describe('ol.pointer.PointerEventHandler', function() { expect(eventSpy.calledOnce).to.be.ok(); var pointerEvent = eventSpy.firstCall.args[0]; - expect(pointerEvent).to.be.a(_ol_pointer_PointerEvent_); + expect(pointerEvent).to.be.a(PointerEvent); expect(pointerEvent.type).to.be('pointerdown'); expect(pointerEvent.pointerId).to.be(1); expect(pointerEvent.pointerType).to.be('mouse'); @@ -160,7 +160,7 @@ describe('ol.pointer.PointerEventHandler', function() { expect(pointerEvent.preventDefault).to.be.ok(); - expect(pointerEvent).to.be.a(_ol_pointer_PointerEvent_); + expect(pointerEvent).to.be.a(PointerEvent); }); }); From b7718fb0ed4e7094cd888e6a4584f667fd5ea74b Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 11 Jan 2018 13:45:50 -0700 Subject: [PATCH 35/35] Rename _ol_render_Feature_ to RenderFeature --- src/ol/format/MVT.js | 6 +-- src/ol/render/Feature.js | 44 +++++++++---------- test/spec/ol/format/mvt.test.js | 6 +-- test/spec/ol/render/feature.test.js | 16 +++---- .../renderer/canvas/vectortilelayer.test.js | 4 +- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/ol/format/MVT.js b/src/ol/format/MVT.js index 223fecd4e9..50cc47c91e 100644 --- a/src/ol/format/MVT.js +++ b/src/ol/format/MVT.js @@ -19,7 +19,7 @@ import Polygon from '../geom/Polygon.js'; import _ol_geom_flat_orient_ from '../geom/flat/orient.js'; import Projection from '../proj/Projection.js'; import Units from '../proj/Units.js'; -import _ol_render_Feature_ from '../render/Feature.js'; +import RenderFeature from '../render/Feature.js'; /** * @classdesc @@ -51,7 +51,7 @@ var MVT = function(opt_options) { * (Array.|Array.>),Object.,number)} */ this.featureClass_ = options.featureClass ? - options.featureClass : _ol_render_Feature_; + options.featureClass : RenderFeature; /** * @private @@ -287,7 +287,7 @@ MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options) { var geometryType = MVT.getGeometryType_(type, ends.length); - if (this.featureClass_ === _ol_render_Feature_) { + if (this.featureClass_ === RenderFeature) { feature = new this.featureClass_(geometryType, flatCoordinates, ends, values, id); } else { var geom; diff --git a/src/ol/render/Feature.js b/src/ol/render/Feature.js index eb09044de8..c129fa8653 100644 --- a/src/ol/render/Feature.js +++ b/src/ol/render/Feature.js @@ -24,7 +24,7 @@ import _ol_transform_ from '../transform.js'; * @param {Object.} properties Properties. * @param {number|string|undefined} id Feature id. */ -var _ol_render_Feature_ = function(type, flatCoordinates, ends, properties, id) { +var RenderFeature = function(type, flatCoordinates, ends, properties, id) { /** * @private * @type {ol.Extent|undefined} @@ -88,7 +88,7 @@ var _ol_render_Feature_ = function(type, flatCoordinates, ends, properties, id) * @return {*} Value for the requested key. * @api */ -_ol_render_Feature_.prototype.get = function(key) { +RenderFeature.prototype.get = function(key) { return this.properties_[key]; }; @@ -96,8 +96,8 @@ _ol_render_Feature_.prototype.get = function(key) { /** * @return {Array.|Array.>} Ends or endss. */ -_ol_render_Feature_.prototype.getEnds = -_ol_render_Feature_.prototype.getEndss = function() { +RenderFeature.prototype.getEnds = +RenderFeature.prototype.getEndss = function() { return this.ends_; }; @@ -107,7 +107,7 @@ _ol_render_Feature_.prototype.getEndss = function() { * @return {ol.Extent} Extent. * @api */ -_ol_render_Feature_.prototype.getExtent = function() { +RenderFeature.prototype.getExtent = function() { if (!this.extent_) { this.extent_ = this.type_ === GeometryType.POINT ? createOrUpdateFromCoordinate(this.flatCoordinates_) : @@ -122,7 +122,7 @@ _ol_render_Feature_.prototype.getExtent = function() { /** * @return {Array.} Flat interior points. */ -_ol_render_Feature_.prototype.getFlatInteriorPoint = function() { +RenderFeature.prototype.getFlatInteriorPoint = function() { if (!this.flatInteriorPoints_) { var flatCenter = getCenter(this.getExtent()); this.flatInteriorPoints_ = _ol_geom_flat_interiorpoint_.linearRings( @@ -135,7 +135,7 @@ _ol_render_Feature_.prototype.getFlatInteriorPoint = function() { /** * @return {Array.} Flat interior points. */ -_ol_render_Feature_.prototype.getFlatInteriorPoints = function() { +RenderFeature.prototype.getFlatInteriorPoints = function() { if (!this.flatInteriorPoints_) { var flatCenters = _ol_geom_flat_center_.linearRingss( this.flatCoordinates_, 0, this.ends_, 2); @@ -149,7 +149,7 @@ _ol_render_Feature_.prototype.getFlatInteriorPoints = function() { /** * @return {Array.} Flat midpoint. */ -_ol_render_Feature_.prototype.getFlatMidpoint = function() { +RenderFeature.prototype.getFlatMidpoint = function() { if (!this.flatMidpoints_) { this.flatMidpoints_ = _ol_geom_flat_interpolate_.lineString( this.flatCoordinates_, 0, this.flatCoordinates_.length, 2, 0.5); @@ -161,7 +161,7 @@ _ol_render_Feature_.prototype.getFlatMidpoint = function() { /** * @return {Array.} Flat midpoints. */ -_ol_render_Feature_.prototype.getFlatMidpoints = function() { +RenderFeature.prototype.getFlatMidpoints = function() { if (!this.flatMidpoints_) { this.flatMidpoints_ = []; var flatCoordinates = this.flatCoordinates_; @@ -184,7 +184,7 @@ _ol_render_Feature_.prototype.getFlatMidpoints = function() { * @return {number|string|undefined} Id. * @api */ -_ol_render_Feature_.prototype.getId = function() { +RenderFeature.prototype.getId = function() { return this.id_; }; @@ -192,7 +192,7 @@ _ol_render_Feature_.prototype.getId = function() { /** * @return {Array.} Flat coordinates. */ -_ol_render_Feature_.prototype.getOrientedFlatCoordinates = function() { +RenderFeature.prototype.getOrientedFlatCoordinates = function() { return this.flatCoordinates_; }; @@ -200,8 +200,8 @@ _ol_render_Feature_.prototype.getOrientedFlatCoordinates = function() { /** * @return {Array.} Flat coordinates. */ -_ol_render_Feature_.prototype.getFlatCoordinates = - _ol_render_Feature_.prototype.getOrientedFlatCoordinates; +RenderFeature.prototype.getFlatCoordinates = + RenderFeature.prototype.getOrientedFlatCoordinates; /** @@ -210,7 +210,7 @@ _ol_render_Feature_.prototype.getFlatCoordinates = * @return {ol.render.Feature} Feature. * @api */ -_ol_render_Feature_.prototype.getGeometry = function() { +RenderFeature.prototype.getGeometry = function() { return this; }; @@ -220,7 +220,7 @@ _ol_render_Feature_.prototype.getGeometry = function() { * @return {Object.} Feature properties. * @api */ -_ol_render_Feature_.prototype.getProperties = function() { +RenderFeature.prototype.getProperties = function() { return this.properties_; }; @@ -229,14 +229,14 @@ _ol_render_Feature_.prototype.getProperties = function() { * Get the feature for working with its geometry. * @return {ol.render.Feature} Feature. */ -_ol_render_Feature_.prototype.getSimplifiedGeometry = - _ol_render_Feature_.prototype.getGeometry; +RenderFeature.prototype.getSimplifiedGeometry = + RenderFeature.prototype.getGeometry; /** * @return {number} Stride. */ -_ol_render_Feature_.prototype.getStride = function() { +RenderFeature.prototype.getStride = function() { return 2; }; @@ -244,7 +244,7 @@ _ol_render_Feature_.prototype.getStride = function() { /** * @return {undefined} */ -_ol_render_Feature_.prototype.getStyleFunction = nullFunction; +RenderFeature.prototype.getStyleFunction = nullFunction; /** @@ -252,7 +252,7 @@ _ol_render_Feature_.prototype.getStyleFunction = nullFunction; * @return {ol.geom.GeometryType} Geometry type. * @api */ -_ol_render_Feature_.prototype.getType = function() { +RenderFeature.prototype.getType = function() { return this.type_; }; @@ -263,7 +263,7 @@ _ol_render_Feature_.prototype.getType = function() { * @param {ol.ProjectionLike} source The current projection * @param {ol.ProjectionLike} destination The desired projection. */ -_ol_render_Feature_.prototype.transform = function(source, destination) { +RenderFeature.prototype.transform = function(source, destination) { var pixelExtent = source.getExtent(); var projectedExtent = source.getWorldExtent(); var scale = getHeight(projectedExtent) / getHeight(pixelExtent); @@ -275,4 +275,4 @@ _ol_render_Feature_.prototype.transform = function(source, destination) { _ol_geom_flat_transform_.transform2D(this.flatCoordinates_, 0, this.flatCoordinates_.length, 2, transform, this.flatCoordinates_); }; -export default _ol_render_Feature_; +export default RenderFeature; diff --git a/test/spec/ol/format/mvt.test.js b/test/spec/ol/format/mvt.test.js index 63470023b2..67c9de8eac 100644 --- a/test/spec/ol/format/mvt.test.js +++ b/test/spec/ol/format/mvt.test.js @@ -4,7 +4,7 @@ import MVT from '../../../../src/ol/format/MVT.js'; import Point from '../../../../src/ol/geom/Point.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; -import _ol_render_Feature_ from '../../../../src/ol/render/Feature.js'; +import RenderFeature from '../../../../src/ol/render/Feature.js'; where('ArrayBuffer.isView').describe('ol.format.MVT', function() { @@ -25,7 +25,7 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() { it('uses ol.render.Feature as feature class by default', function() { var format = new MVT({layers: ['water']}); var features = format.readFeatures(data); - expect(features[0]).to.be.a(_ol_render_Feature_); + expect(features[0]).to.be.a(RenderFeature); }); it('parses only specified layers', function() { @@ -185,7 +185,7 @@ describe('ol.format.MVT', function() { }; var feature = format.createFeature_({}, rawFeature); MVT.readRawGeometry_ = readRawGeometry_; - expect(feature).to.be.a(_ol_render_Feature_); + expect(feature).to.be.a(RenderFeature); expect(feature.getType()).to.be('Polygon'); expect(feature.getFlatCoordinates()).to.equal(createdFlatCoordinates); expect(feature.getEnds()).to.equal(createdEnds); diff --git a/test/spec/ol/render/feature.test.js b/test/spec/ol/render/feature.test.js index a3f5376110..fa9d214a2d 100644 --- a/test/spec/ol/render/feature.test.js +++ b/test/spec/ol/render/feature.test.js @@ -2,7 +2,7 @@ import LineString from '../../../../src/ol/geom/LineString.js'; import MultiLineString from '../../../../src/ol/geom/MultiLineString.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; -import _ol_render_Feature_ from '../../../../src/ol/render/Feature.js'; +import RenderFeature from '../../../../src/ol/render/Feature.js'; describe('ol.render.Feature', function() { @@ -16,8 +16,8 @@ describe('ol.render.Feature', function() { describe('Constructor', function() { it('creates an instance', function() { renderFeature = - new _ol_render_Feature_(type, flatCoordinates, ends, properties, 'foo'); - expect(renderFeature).to.be.a(_ol_render_Feature_); + new RenderFeature(type, flatCoordinates, ends, properties, 'foo'); + expect(renderFeature).to.be.a(RenderFeature); }); }); @@ -42,7 +42,7 @@ describe('ol.render.Feature', function() { }); it('returns the correct extent for a linestring', function() { var feature = - new _ol_render_Feature_('LineString', [-1, -2, 2, 1], null, {}); + new RenderFeature('LineString', [-1, -2, 2, 1], null, {}); expect(feature.getExtent()).to.eql([-1, -2, 2, 1]); }); }); @@ -56,7 +56,7 @@ describe('ol.render.Feature', function() { describe('#getFlatInteriorPoint()', function() { it('returns correct point and caches it', function() { var polygon = new Polygon([[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]); - var feature = new _ol_render_Feature_('Polygon', polygon.getOrientedFlatCoordinates(), + var feature = new RenderFeature('Polygon', polygon.getOrientedFlatCoordinates(), polygon.getEnds()); expect(feature.getFlatInteriorPoint()).to.eql([5, 5, 10]); expect(feature.getFlatInteriorPoint()).to.be(feature.flatInteriorPoints_); @@ -69,7 +69,7 @@ describe('ol.render.Feature', function() { [[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]], [[[10, 0], [10, 10], [20, 10], [20, 0], [10, 0]]] ]); - var feature = new _ol_render_Feature_('MultiPolygon', polygon.getOrientedFlatCoordinates(), + var feature = new RenderFeature('MultiPolygon', polygon.getOrientedFlatCoordinates(), polygon.getEndss()); expect(feature.getFlatInteriorPoints()).to.eql([5, 5, 10, 15, 5, 10]); expect(feature.getFlatInteriorPoints()).to.be(feature.flatInteriorPoints_); @@ -79,7 +79,7 @@ describe('ol.render.Feature', function() { describe('#getFlatMidpoint()', function() { it('returns correct point', function() { var line = new LineString([[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]); - var feature = new _ol_render_Feature_('LineString', line.getFlatCoordinates()); + var feature = new RenderFeature('LineString', line.getFlatCoordinates()); expect(feature.getFlatMidpoint()).to.eql([10, 10]); expect(feature.getFlatMidpoint()).to.eql(feature.flatMidpoints_); }); @@ -91,7 +91,7 @@ describe('ol.render.Feature', function() { [[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]], [[10, 0], [10, 10], [20, 10], [20, 0], [10, 0]] ]); - var feature = new _ol_render_Feature_('MultiLineString', line.getFlatCoordinates(), + var feature = new RenderFeature('MultiLineString', line.getFlatCoordinates(), line.getEnds()); expect(feature.getFlatMidpoints()).to.eql([10, 10, 20, 10]); expect(feature.getFlatMidpoints()).to.be(feature.flatMidpoints_); diff --git a/test/spec/ol/renderer/canvas/vectortilelayer.test.js b/test/spec/ol/renderer/canvas/vectortilelayer.test.js index 369e170832..ee137c35a2 100644 --- a/test/spec/ol/renderer/canvas/vectortilelayer.test.js +++ b/test/spec/ol/renderer/canvas/vectortilelayer.test.js @@ -13,7 +13,7 @@ import VectorTileLayer from '../../../../../src/ol/layer/VectorTile.js'; import {get as getProjection, fromLonLat} from '../../../../../src/ol/proj.js'; import Projection from '../../../../../src/ol/proj/Projection.js'; import _ol_render_canvas_ from '../../../../../src/ol/render/canvas.js'; -import _ol_render_Feature_ from '../../../../../src/ol/render/Feature.js'; +import RenderFeature from '../../../../../src/ol/render/Feature.js'; import CanvasVectorTileLayerRenderer from '../../../../../src/ol/renderer/canvas/VectorTileLayer.js'; import VectorTileSource from '../../../../../src/ol/source/VectorTile.js'; import Style from '../../../../../src/ol/style/Style.js'; @@ -57,7 +57,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { })]; feature1 = new Feature(new Point([1, -1])); feature2 = new Feature(new Point([0, 0])); - feature3 = new _ol_render_Feature_('Point', [1, -1], []); + feature3 = new RenderFeature('Point', [1, -1], []); feature2.setStyle(featureStyle); var TileClass = function() { VectorTile.apply(this, arguments);