From f257a8938f2ccc920936adf6630ab5cfbfb77224 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 19 Jun 2018 09:59:42 +0200 Subject: [PATCH] Rename ol/source/TileUTFGrid to ol/source/UTFGrid --- changelog/upgrade-notes.md | 4 +++ examples/{tileutfgrid.css => utfgrid.css} | 0 examples/{tileutfgrid.html => utfgrid.html} | 6 ++--- examples/{tileutfgrid.js => utfgrid.js} | 2 +- src/ol/source.js | 2 +- src/ol/source/{TileUTFGrid.js => UTFGrid.js} | 8 +++--- .../data/{tileutfgrid.json => utfgrid.json} | 0 .../{tileutfgrid.test.js => utfgrid.test.js} | 26 +++++++++---------- 8 files changed, 26 insertions(+), 22 deletions(-) rename examples/{tileutfgrid.css => utfgrid.css} (100%) rename examples/{tileutfgrid.html => utfgrid.html} (82%) rename examples/{tileutfgrid.js => utfgrid.js} (97%) rename src/ol/source/{TileUTFGrid.js => UTFGrid.js} (97%) rename test/spec/ol/data/{tileutfgrid.json => utfgrid.json} (100%) rename test/spec/ol/source/{tileutfgrid.test.js => utfgrid.test.js} (93%) diff --git a/changelog/upgrade-notes.md b/changelog/upgrade-notes.md index ca7d18cc29..7857348188 100644 --- a/changelog/upgrade-notes.md +++ b/changelog/upgrade-notes.md @@ -2,6 +2,10 @@ ### Next release +#### Renamed `ol/source/TileUTFGrid` to `ol/source/UTFGrid` + +The module name is now `ol/source/UTFGrid` (`ol.source.UTFGrid` in the full build). + #### Renaming of the `defaultDataProjection` in the options and property of the `ol/format/Feature` class and its subclasses The `defaultDataProjection` option is now named `dataProjection`. The protected property available on the class is also renamed. diff --git a/examples/tileutfgrid.css b/examples/utfgrid.css similarity index 100% rename from examples/tileutfgrid.css rename to examples/utfgrid.css diff --git a/examples/tileutfgrid.html b/examples/utfgrid.html similarity index 82% rename from examples/tileutfgrid.html rename to examples/utfgrid.html index 40353fa95f..5e3f55778e 100644 --- a/examples/tileutfgrid.html +++ b/examples/utfgrid.html @@ -1,11 +1,11 @@ --- layout: example.html -title: Tiled UTFGrid -shortdesc: This example shows how to read data from a TileUTFGrid layer. +title: UTFGrid +shortdesc: This example shows how to read data from a UTFGrid source. docs: >

Point to a country to see its name and flag.

Tiles made with [TileMill](http://tilemill.com). Hosting on MapBox.com or with open-source [TileServer](https://github.com/klokantech/tileserver-php/). -tags: "utfgrid, tileutfgrid, tilejson" +tags: "utfgrid, tilejson" cloak: - key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg value: Your Mapbox access token from http://mapbox.com/ here diff --git a/examples/tileutfgrid.js b/examples/utfgrid.js similarity index 97% rename from examples/tileutfgrid.js rename to examples/utfgrid.js index 36fb17722e..11e6ee7fa2 100644 --- a/examples/tileutfgrid.js +++ b/examples/utfgrid.js @@ -3,7 +3,7 @@ import Overlay from '../src/ol/Overlay.js'; import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; import TileJSON from '../src/ol/source/TileJSON.js'; -import UTFGrid from '../src/ol/source/TileUTFGrid.js'; +import UTFGrid from '../src/ol/source/UTFGrid.js'; const key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg'; diff --git a/src/ol/source.js b/src/ol/source.js index af44577570..60c6e17b1a 100644 --- a/src/ol/source.js +++ b/src/ol/source.js @@ -20,9 +20,9 @@ export {default as TileArcGISRest} from './source/TileArcGISRest.js'; export {default as TileDebug} from './source/TileDebug.js'; export {default as TileImage} from './source/TileImage.js'; export {default as TileJSON} from './source/TileJSON.js'; -export {default as TileUTFGrid} from './source/TileUTFGrid.js'; export {default as TileWMS} from './source/TileWMS.js'; export {default as UrlTile} from './source/UrlTile.js'; +export {default as UTFGrid} from './source/UTFGrid.js'; export {default as Vector} from './source/Vector.js'; export {default as WMTS} from './source/WMTS.js'; export {default as XYZ} from './source/XYZ.js'; diff --git a/src/ol/source/TileUTFGrid.js b/src/ol/source/UTFGrid.js similarity index 97% rename from src/ol/source/TileUTFGrid.js rename to src/ol/source/UTFGrid.js index 0e320618dc..2007193766 100644 --- a/src/ol/source/TileUTFGrid.js +++ b/src/ol/source/UTFGrid.js @@ -1,5 +1,5 @@ /** - * @module ol/source/TileUTFGrid + * @module ol/source/UTFGrid */ import {inherits} from '../index.js'; import Tile from '../Tile.js'; @@ -252,7 +252,7 @@ CustomTile.prototype.load = function() { /** * @typedef {Object} Options * @property {boolean} [preemptive=true] - * If `true` the TileUTFGrid source loads the tiles based on their "visibility". + * If `true` the UTFGrid source loads the tiles based on their "visibility". * This improves the speed of response, but increases traffic. * Note that if set to `false`, you need to pass `true` as `opt_request` * to the `forDataAtCoordinateAndResolution` method otherwise no data @@ -272,7 +272,7 @@ CustomTile.prototype.load = function() { * * @constructor * @extends {module:ol/source/Tile} - * @param {module:ol/source/TileUTFGrid~Options=} options Source options. + * @param {module:ol/source/UTFGrid~Options=} options Source options. * @api */ const UTFGrid = function(options) { @@ -384,7 +384,7 @@ UTFGrid.prototype.forDataAtCoordinateAndResolution = function( if (this.tileGrid) { const tileCoord = this.tileGrid.getTileCoordForCoordAndResolution( coordinate, resolution); - const tile = /** @type {!module:ol/source/TileUTFGrid~CustomTile} */(this.getTile( + const tile = /** @type {!module:ol/source/UTFGrid~CustomTile} */(this.getTile( tileCoord[0], tileCoord[1], tileCoord[2], 1, this.getProjection())); tile.forDataAtCoordinate(coordinate, callback, null, opt_request); } else { diff --git a/test/spec/ol/data/tileutfgrid.json b/test/spec/ol/data/utfgrid.json similarity index 100% rename from test/spec/ol/data/tileutfgrid.json rename to test/spec/ol/data/utfgrid.json diff --git a/test/spec/ol/source/tileutfgrid.test.js b/test/spec/ol/source/utfgrid.test.js similarity index 93% rename from test/spec/ol/source/tileutfgrid.test.js rename to test/spec/ol/source/utfgrid.test.js index bf91a917bb..78c415b0b8 100644 --- a/test/spec/ol/source/tileutfgrid.test.js +++ b/test/spec/ol/source/utfgrid.test.js @@ -1,12 +1,12 @@ import {get as getProjection, transformExtent, fromLonLat} from '../../../../src/ol/proj.js'; import TileSource from '../../../../src/ol/source/Tile.js'; -import UTFGrid, {CustomTile} from '../../../../src/ol/source/TileUTFGrid.js'; +import UTFGrid, {CustomTile} from '../../../../src/ol/source/UTFGrid.js'; import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js'; -describe('ol.source.TileUTFGrid', function() { +describe('ol.source.UTFGrid', function() { - const url = 'spec/ol/data/tileutfgrid.json'; + const url = 'spec/ol/data/utfgrid.json'; let tileJson = null; // Load and parse the UTFGrid fixture @@ -27,7 +27,7 @@ describe('ol.source.TileUTFGrid', function() { tileJson = null; }); - function getTileUTFGrid() { + function getUTFGrid() { return new UTFGrid({ url: url }); @@ -51,7 +51,7 @@ describe('ol.source.TileUTFGrid', function() { return new UTFGrid({}); }).to.throwException(); - expect(getTileUTFGrid()).to.be.an(UTFGrid); + expect(getUTFGrid()).to.be.an(UTFGrid); }); }); @@ -93,7 +93,7 @@ describe('ol.source.TileUTFGrid', function() { describe('#handleTileJSONResponse', function() { it('sets up a tileGrid', function() { - const source = getTileUTFGrid(); + const source = getUTFGrid(); expect(source.getTileGrid()).to.be(null); // call the handleTileJSONResponse method with our // locally available tileJson (from `before`) @@ -105,7 +105,7 @@ describe('ol.source.TileUTFGrid', function() { }); it('sets up a tilegrid with expected extent', function() { - const source = getTileUTFGrid(); + const source = getUTFGrid(); // call the handleTileJSONResponse method with our // locally available tileJson (from `before`) source.handleTileJSONResponse(tileJson); @@ -127,7 +127,7 @@ describe('ol.source.TileUTFGrid', function() { }); it('sets up a tilegrid with expected minZoom', function() { - const source = getTileUTFGrid(); + const source = getUTFGrid(); // call the handleTileJSONResponse method with our // locally available tileJson (from `before`) source.handleTileJSONResponse(tileJson); @@ -138,7 +138,7 @@ describe('ol.source.TileUTFGrid', function() { }); it('sets up a tilegrid with expected maxZoom', function() { - const source = getTileUTFGrid(); + const source = getUTFGrid(); // call the handleTileJSONResponse method with our // locally available tileJson (from `before`) source.handleTileJSONResponse(tileJson); @@ -149,7 +149,7 @@ describe('ol.source.TileUTFGrid', function() { }); it('sets up a template', function() { - const source = getTileUTFGrid(); + const source = getUTFGrid(); expect(source.getTemplate()).to.be(undefined); // call the handleTileJSONResponse method with our @@ -162,7 +162,7 @@ describe('ol.source.TileUTFGrid', function() { }); it('sets up correct attribution', function() { - const source = getTileUTFGrid(); + const source = getUTFGrid(); expect(source.getAttributions()).to.be(null); // call the handleTileJSONResponse method with our @@ -175,7 +175,7 @@ describe('ol.source.TileUTFGrid', function() { }); it('sets correct state', function() { - const source = getTileUTFGrid(); + const source = getUTFGrid(); expect(source.getState()).to.be('loading'); // call the handleTileJSONResponse method with our @@ -215,7 +215,7 @@ describe('ol.source.TileUTFGrid', function() { }); beforeEach(function() { - source = getTileUTFGrid(); + source = getUTFGrid(); // call the handleTileJSONResponse method with our // locally available tileJson (from `before`) source.handleTileJSONResponse(tileJson);