From 3b20cc7b5322623b0a9dd093154e41c6bd4b0181 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Fri, 30 Aug 2013 14:19:05 -0600 Subject: [PATCH 1/5] Rename ol.Projection to ol.proj.Projection --- doc/index.md | 2 +- examples/wms-no-proj.js | 4 +- src/ol/control/mousepositioncontrol.js | 10 ++-- src/ol/geolocation.js | 7 +-- src/ol/imageurlfunction.js | 6 +- src/ol/iview2d.js | 5 +- src/ol/layer/vectorlayer.js | 6 +- src/ol/proj.exports | 16 +++--- src/ol/proj/chprojection.js | 6 +- src/ol/proj/epsg3857projection.js | 8 +-- src/ol/proj/epsg4326projection.js | 8 +-- src/ol/proj/proj.js | 77 +++++++++++++------------- src/ol/renderer/layerrenderer.js | 4 +- src/ol/source/bingmapssource.js | 2 +- src/ol/source/imagesource.js | 5 +- src/ol/source/imagestaticsource.js | 2 +- src/ol/source/source.js | 6 +- src/ol/source/tileimagesource.js | 1 - src/ol/source/tilesource.js | 2 +- src/ol/source/vectorsource.js | 2 +- src/ol/source/wmssource.js | 2 +- src/ol/source/wmtssource.js | 4 +- src/ol/tilegrid/tilegrid.js | 10 ++-- src/ol/tilegrid/xyztilegrid.js | 2 +- src/ol/tileurlfunction.js | 17 +++--- src/ol/view2d.js | 6 +- test/spec/ol/proj/chprojection.test.js | 6 +- test/spec/ol/proj/proj.test.js | 8 +-- test/spec/ol/tilegrid/tilegrid.test.js | 4 +- 29 files changed, 119 insertions(+), 119 deletions(-) diff --git a/doc/index.md b/doc/index.md index 431d7c0b4e..f4acd82ff3 100644 --- a/doc/index.md +++ b/doc/index.md @@ -6,7 +6,7 @@ In general every use of OpenLayers starts by initializing a map, then adding th Projections ----------- -A {@link ol.Projection} defines which point on earth is represented by a pair of coordinates. +A {@link ol.proj.Projection} defines which point on earth is represented by a pair of coordinates. Coordinates within OpenLayers can be used in various projections where some common projections are always supported, others can be used via [Proj4js](http://trac.osgeo.org/proj4js/). diff --git a/examples/wms-no-proj.js b/examples/wms-no-proj.js index f85dcbf4d8..d51f7ec345 100644 --- a/examples/wms-no-proj.js +++ b/examples/wms-no-proj.js @@ -1,11 +1,11 @@ goog.require('ol.Attribution'); goog.require('ol.Map'); -goog.require('ol.Projection'); goog.require('ol.ProjectionUnits'); goog.require('ol.RendererHints'); goog.require('ol.View2D'); goog.require('ol.layer.Image'); goog.require('ol.layer.Tile'); +goog.require('ol.proj.Projection'); goog.require('ol.source.ImageWMS'); goog.require('ol.source.TileWMS'); @@ -45,7 +45,7 @@ var layers = [ // A minimal projection object is configured with only the SRS code and the map // units. No client side coordinate transforms are possible with such a // projection object. -var projection = new ol.Projection({ +var projection = new ol.proj.Projection({ code: 'EPSG:21781', units: ol.ProjectionUnits.METERS }); diff --git a/src/ol/control/mousepositioncontrol.js b/src/ol/control/mousepositioncontrol.js index 6933af3bfa..40289563a9 100644 --- a/src/ol/control/mousepositioncontrol.js +++ b/src/ol/control/mousepositioncontrol.js @@ -12,10 +12,10 @@ goog.require('goog.style'); goog.require('ol.CoordinateFormatType'); goog.require('ol.Object'); goog.require('ol.Pixel'); -goog.require('ol.Projection'); goog.require('ol.TransformFunction'); goog.require('ol.control.Control'); goog.require('ol.proj'); +goog.require('ol.proj.Projection'); /** @@ -80,7 +80,7 @@ ol.control.MousePosition = function(opt_options) { /** * @private - * @type {ol.Projection} + * @type {ol.proj.Projection} */ this.mapProjection_ = null; @@ -139,10 +139,10 @@ goog.exportProperty( /** - * @return {ol.Projection|undefined} projection. + * @return {ol.proj.Projection|undefined} projection. */ ol.control.MousePosition.prototype.getProjection = function() { - return /** @type {ol.Projection|undefined} */ ( + return /** @type {ol.proj.Projection|undefined} */ ( this.get(ol.control.MousePositionProperty.PROJECTION)); }; goog.exportProperty( @@ -204,7 +204,7 @@ goog.exportProperty( /** - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. */ ol.control.MousePosition.prototype.setProjection = function(projection) { this.set(ol.control.MousePositionProperty.PROJECTION, projection); diff --git a/src/ol/geolocation.js b/src/ol/geolocation.js index ec5f762690..601baf1599 100644 --- a/src/ol/geolocation.js +++ b/src/ol/geolocation.js @@ -9,7 +9,6 @@ goog.require('goog.events.EventType'); goog.require('goog.math'); goog.require('ol.Coordinate'); goog.require('ol.Object'); -goog.require('ol.Projection'); goog.require('ol.proj'); @@ -254,10 +253,10 @@ goog.exportProperty( /** * Get the projection associated with the position. - * @return {ol.Projection|undefined} projection. + * @return {ol.proj.Projection|undefined} projection. */ ol.Geolocation.prototype.getProjection = function() { - return /** @type {ol.Projection|undefined} */ ( + return /** @type {ol.proj.Projection|undefined} */ ( this.get(ol.GeolocationProperty.PROJECTION)); }; goog.exportProperty( @@ -312,7 +311,7 @@ goog.exportProperty( /** * Set the projection to use for transforming the coordinates. - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. */ ol.Geolocation.prototype.setProjection = function(projection) { this.set(ol.GeolocationProperty.PROJECTION, projection); diff --git a/src/ol/imageurlfunction.js b/src/ol/imageurlfunction.js index 9648e1b18c..602c4d0796 100644 --- a/src/ol/imageurlfunction.js +++ b/src/ol/imageurlfunction.js @@ -6,7 +6,7 @@ goog.require('ol.Size'); /** * @typedef {function(this:ol.source.Image, ol.Extent, ol.Size, - * ol.Projection): (string|undefined)} + * ol.proj.Projection): (string|undefined)} */ ol.ImageUrlFunctionType; @@ -15,7 +15,7 @@ ol.ImageUrlFunctionType; * @param {string} baseUrl Base URL (may have query data). * @param {Object.} params to encode in the url. * @param {function(string, Object., ol.Extent, ol.Size, - * ol.Projection): (string|undefined)} paramsFunction params function. + * ol.proj.Projection): (string|undefined)} paramsFunction params function. * @return {ol.ImageUrlFunctionType} Image URL function. */ ol.ImageUrlFunction.createFromParamsFunction = @@ -25,7 +25,7 @@ ol.ImageUrlFunction.createFromParamsFunction = * @this {ol.source.Image} * @param {ol.Extent} extent Extent. * @param {ol.Size} size Size. - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @return {string|undefined} URL. */ function(extent, size, projection) { diff --git a/src/ol/iview2d.js b/src/ol/iview2d.js index ad1d28f564..784b91f7b7 100644 --- a/src/ol/iview2d.js +++ b/src/ol/iview2d.js @@ -2,12 +2,11 @@ goog.provide('ol.IView2D'); goog.provide('ol.View2DState'); goog.require('ol.Coordinate'); -goog.require('ol.Projection'); /** * @typedef {{center: ol.Coordinate, - * projection: ol.Projection, + * projection: ol.proj.Projection, * resolution: number, * rotation: number}} */ @@ -31,7 +30,7 @@ ol.IView2D.prototype.getCenter = function() { /** - * @return {ol.Projection|undefined} Map projection. + * @return {ol.proj.Projection|undefined} Map projection. */ ol.IView2D.prototype.getProjection = function() { }; diff --git a/src/ol/layer/vectorlayer.js b/src/ol/layer/vectorlayer.js index 01da071cd8..3cdd40814b 100644 --- a/src/ol/layer/vectorlayer.js +++ b/src/ol/layer/vectorlayer.js @@ -383,7 +383,7 @@ ol.layer.Vector.prototype.getStyle = function() { * as the data for `extent` is available. * * @param {ol.Extent} extent Bounding extent. - * @param {ol.Projection} projection Target projection. + * @param {ol.proj.Projection} projection Target projection. * @param {ol.geom.GeometryType=} opt_type Optional geometry type. * @param {Function=} opt_callback Callback to call when data is parsed. * @return {Object.} Features or null if source is loading @@ -492,8 +492,8 @@ ol.layer.Vector.prototype.getFeatureWithUid = function(uid) { /** * @param {Object|Element|Document|string} data Feature data. * @param {ol.parser.Parser} parser Feature parser. - * @param {ol.Projection} projection This sucks. The layer should be a view in - * one projection. + * @param {ol.proj.Projection} projection This sucks. The layer should be a + * view in one projection. */ ol.layer.Vector.prototype.parseFeatures = function(data, parser, projection) { var lookup = {}; diff --git a/src/ol/proj.exports b/src/ol/proj.exports index 6ad6796116..a4e9dd7459 100644 --- a/src/ol/proj.exports +++ b/src/ol/proj.exports @@ -1,11 +1,11 @@ -@exportClass ol.Projection ol.ProjectionOptions -@exportProperty ol.Projection.prototype.getAxisOrientation -@exportProperty ol.Projection.prototype.getCode -@exportProperty ol.Projection.prototype.getExtent -@exportProperty ol.Projection.prototype.getPointResolution -@exportProperty ol.Projection.prototype.getUnits -@exportProperty ol.Projection.prototype.getMetersPerUnit -@exportProperty ol.Projection.prototype.isGlobal +@exportClass ol.proj.Projection ol.ProjectionOptions +@exportProperty ol.proj.Projection.prototype.getAxisOrientation +@exportProperty ol.proj.Projection.prototype.getCode +@exportProperty ol.proj.Projection.prototype.getExtent +@exportProperty ol.proj.Projection.prototype.getPointResolution +@exportProperty ol.proj.Projection.prototype.getUnits +@exportProperty ol.proj.Projection.prototype.getMetersPerUnit +@exportProperty ol.proj.Projection.prototype.isGlobal @exportSymbol ol.ProjectionUnits @exportProperty ol.ProjectionUnits.DEGREES diff --git a/src/ol/proj/chprojection.js b/src/ol/proj/chprojection.js index e16fa0de69..255e0ac6fd 100644 --- a/src/ol/proj/chprojection.js +++ b/src/ol/proj/chprojection.js @@ -4,18 +4,18 @@ goog.provide('ol.proj.EPSG21781'); goog.require('goog.asserts'); goog.require('goog.math'); -goog.require('ol.Projection'); goog.require('ol.ProjectionUnits'); goog.require('ol.ellipsoid.BESSEL1841'); goog.require('ol.proj'); goog.require('ol.proj.EPSG4326'); +goog.require('ol.proj.Projection'); /** * Internal base class for Swiss grid projections. * @constructor - * @extends {ol.Projection} + * @extends {ol.proj.Projection} * @param {{code: string, extent: ol.Extent}} options Options. */ ol.proj.CH = function(options) { @@ -26,7 +26,7 @@ ol.proj.CH = function(options) { units: ol.ProjectionUnits.METERS }); }; -goog.inherits(ol.proj.CH, ol.Projection); +goog.inherits(ol.proj.CH, ol.proj.Projection); /** diff --git a/src/ol/proj/epsg3857projection.js b/src/ol/proj/epsg3857projection.js index e7739ffb0b..cddfb4ff13 100644 --- a/src/ol/proj/epsg3857projection.js +++ b/src/ol/proj/epsg3857projection.js @@ -2,16 +2,16 @@ goog.provide('ol.proj.EPSG3857'); goog.require('goog.array'); goog.require('goog.asserts'); -goog.require('ol.Projection'); goog.require('ol.ProjectionUnits'); goog.require('ol.math'); goog.require('ol.proj'); +goog.require('ol.proj.Projection'); /** * @constructor - * @extends {ol.Projection} + * @extends {ol.proj.Projection} * @param {string} code Code. */ ol.proj.EPSG3857 = function(code) { @@ -22,7 +22,7 @@ ol.proj.EPSG3857 = function(code) { global: true }); }; -goog.inherits(ol.proj.EPSG3857, ol.Projection); +goog.inherits(ol.proj.EPSG3857, ol.proj.Projection); /** @@ -67,7 +67,7 @@ ol.proj.EPSG3857.CODES = [ * Projections equal to EPSG:3857. * * @const - * @type {Array.} + * @type {Array.} */ ol.proj.EPSG3857.PROJECTIONS = goog.array.map( ol.proj.EPSG3857.CODES, diff --git a/src/ol/proj/epsg4326projection.js b/src/ol/proj/epsg4326projection.js index 57924a4ddc..49ee786bf1 100644 --- a/src/ol/proj/epsg4326projection.js +++ b/src/ol/proj/epsg4326projection.js @@ -1,14 +1,14 @@ goog.provide('ol.proj.EPSG4326'); -goog.require('ol.Projection'); goog.require('ol.ProjectionUnits'); goog.require('ol.proj'); +goog.require('ol.proj.Projection'); /** * @constructor - * @extends {ol.Projection} + * @extends {ol.proj.Projection} * @param {string} code Code. * @param {string=} opt_axisOrientation Axis orientation. */ @@ -21,7 +21,7 @@ ol.proj.EPSG4326 = function(code, opt_axisOrientation) { global: true }); }; -goog.inherits(ol.proj.EPSG4326, ol.Projection); +goog.inherits(ol.proj.EPSG4326, ol.proj.Projection); /** @@ -37,7 +37,7 @@ ol.proj.EPSG4326.EXTENT = [-180, -90, 180, 90]; * Projections equal to EPSG:4326. * * @const - * @type {Array.} + * @type {Array.} */ ol.proj.EPSG4326.PROJECTIONS = [ new ol.proj.EPSG4326('CRS:84'), diff --git a/src/ol/proj/proj.js b/src/ol/proj/proj.js index a82f443bbf..c1bbbde647 100644 --- a/src/ol/proj/proj.js +++ b/src/ol/proj/proj.js @@ -1,7 +1,7 @@ -goog.provide('ol.Projection'); goog.provide('ol.ProjectionLike'); goog.provide('ol.ProjectionUnits'); goog.provide('ol.proj'); +goog.provide('ol.proj.Projection'); goog.require('goog.array'); goog.require('goog.asserts'); @@ -25,8 +25,9 @@ ol.HAVE_PROJ4JS = ol.ENABLE_PROJ4JS && typeof Proj4js == 'object'; /** - * A projection as {@link ol.Projection}, SRS identifier string or undefined. - * @typedef {ol.Projection|string|undefined} ol.ProjectionLike + * A projection as {@link ol.proj.Projection}, SRS identifier string or + * undefined. + * @typedef {ol.proj.Projection|string|undefined} ol.ProjectionLike */ ol.ProjectionLike; @@ -56,7 +57,7 @@ ol.METERS_PER_UNIT[ol.ProjectionUnits.METERS] = 1; * @constructor * @param {ol.ProjectionOptions} options Projection options. */ -ol.Projection = function(options) { +ol.proj.Projection = function(options) { /** * @private @@ -102,7 +103,7 @@ ol.Projection = function(options) { * Get the code for this projection, e.g. 'EPSG:4326'. * @return {string} Code. */ -ol.Projection.prototype.getCode = function() { +ol.proj.Projection.prototype.getCode = function() { return this.code_; }; @@ -111,7 +112,7 @@ ol.Projection.prototype.getCode = function() { * Get the validity extent for this projection. * @return {ol.Extent} Extent. */ -ol.Projection.prototype.getExtent = function() { +ol.proj.Projection.prototype.getExtent = function() { return this.extent_; }; @@ -126,14 +127,14 @@ ol.Projection.prototype.getExtent = function() { * @param {ol.Coordinate} point Point. * @return {number} Point resolution. */ -ol.Projection.prototype.getPointResolution = goog.abstractMethod; +ol.proj.Projection.prototype.getPointResolution = goog.abstractMethod; /** * Get the units of this projection. * @return {ol.ProjectionUnits} Units. */ -ol.Projection.prototype.getUnits = function() { +ol.proj.Projection.prototype.getUnits = function() { return this.units_; }; @@ -143,7 +144,7 @@ ol.Projection.prototype.getUnits = function() { * not configured with a units identifier, the return is `undefined`. * @return {number|undefined} Meters. */ -ol.Projection.prototype.getMetersPerUnit = function() { +ol.proj.Projection.prototype.getMetersPerUnit = function() { return ol.METERS_PER_UNIT[this.units_]; }; @@ -158,7 +159,7 @@ ol.Projection.prototype.getMetersPerUnit = function() { * "west positive" coordinate systems * @return {string} Axis orientation. */ -ol.Projection.prototype.getAxisOrientation = function() { +ol.proj.Projection.prototype.getAxisOrientation = function() { return this.axisOrientation_; }; @@ -167,7 +168,7 @@ ol.Projection.prototype.getAxisOrientation = function() { * Is this projection a global projection which spans the whole world? * @return {boolean} Wether the projection is global. */ -ol.Projection.prototype.isGlobal = function() { +ol.proj.Projection.prototype.isGlobal = function() { return this.global_; }; @@ -175,7 +176,7 @@ ol.Projection.prototype.isGlobal = function() { /** * @return {ol.tilegrid.TileGrid} The default tile grid. */ -ol.Projection.prototype.getDefaultTileGrid = function() { +ol.proj.Projection.prototype.getDefaultTileGrid = function() { return this.defaultTileGrid_; }; @@ -183,7 +184,7 @@ ol.Projection.prototype.getDefaultTileGrid = function() { /** * @param {ol.tilegrid.TileGrid} tileGrid The default tile grid. */ -ol.Projection.prototype.setDefaultTileGrid = function(tileGrid) { +ol.proj.Projection.prototype.setDefaultTileGrid = function(tileGrid) { this.defaultTileGrid_ = tileGrid; }; @@ -191,7 +192,7 @@ ol.Projection.prototype.setDefaultTileGrid = function(tileGrid) { /** * @constructor - * @extends {ol.Projection} + * @extends {ol.proj.Projection} * @param {Proj4js.Proj} proj4jsProj Proj4js projection. * @param {ol.Proj4jsProjectionOptions} options Proj4js projection options. * @private @@ -221,7 +222,7 @@ ol.Proj4jsProjection_ = function(proj4jsProj, options) { this.toEPSG4326_ = null; }; -goog.inherits(ol.Proj4jsProjection_, ol.Projection); +goog.inherits(ol.Proj4jsProjection_, ol.proj.Projection); /** @@ -293,7 +294,7 @@ ol.proj.proj4jsProjections_ = {}; /** * @private - * @type {Object.} + * @type {Object.} */ ol.proj.projections_ = {}; @@ -309,7 +310,7 @@ ol.proj.transforms_ = {}; * Registers transformation functions that don't alter coordinates. Those allow * to transform between projections with equal meaning. * - * @param {Array.} projections Projections. + * @param {Array.} projections Projections. */ ol.proj.addEquivalentProjections = function(projections) { ol.proj.addProjections(projections); @@ -327,8 +328,10 @@ ol.proj.addEquivalentProjections = function(projections) { * Registers transformation functions to convert coordinates in any projection * in projection1 to any projection in projection2. * - * @param {Array.} projections1 Projections with equal meaning. - * @param {Array.} projections2 Projections with equal meaning. + * @param {Array.} projections1 Projections with equal + * meaning. + * @param {Array.} projections2 Projections with equal + * meaning. * @param {ol.TransformFunction} forwardTransform Transformation from any * projection in projection1 to any projection in projection2. * @param {ol.TransformFunction} inverseTransform Transform from any projection @@ -358,7 +361,7 @@ ol.proj.addProj4jsProjection_ = function(proj4jsProjection) { /** - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. */ ol.proj.addProjection = function(projection) { var projections = ol.proj.projections_; @@ -369,7 +372,7 @@ ol.proj.addProjection = function(projection) { /** - * @param {Array.} projections Projections. + * @param {Array.} projections Projections. */ ol.proj.addProjections = function(projections) { goog.array.forEach(projections, function(projection) { @@ -391,9 +394,9 @@ ol.proj.clearAllProjections = function() { /** - * @param {ol.Projection|string|undefined} projection Projection. + * @param {ol.proj.Projection|string|undefined} projection Projection. * @param {string} defaultCode Default code. - * @return {ol.Projection} Projection. + * @return {ol.proj.Projection} Projection. */ ol.proj.createProjection = function(projection, defaultCode) { if (!goog.isDefAndNotNull(projection)) { @@ -401,7 +404,7 @@ ol.proj.createProjection = function(projection, defaultCode) { } else if (goog.isString(projection)) { return ol.proj.get(projection); } else { - goog.asserts.assertInstanceof(projection, ol.Projection); + goog.asserts.assertInstanceof(projection, ol.proj.Projection); return projection; } }; @@ -411,8 +414,8 @@ ol.proj.createProjection = function(projection, defaultCode) { * Registers a conversion function to convert coordinates from the source * projection to the destination projection. * - * @param {ol.Projection} source Source. - * @param {ol.Projection} destination Destination. + * @param {ol.proj.Projection} source Source. + * @param {ol.proj.Projection} destination Destination. * @param {ol.TransformFunction} transformFn Transform. */ ol.proj.addTransform = function(source, destination, transformFn) { @@ -431,8 +434,8 @@ ol.proj.addTransform = function(source, destination, transformFn) { * projection to the destination projection. This method is used to clean up * cached transforms during testing. * - * @param {ol.Projection} source Source projection. - * @param {ol.Projection} destination Destination projection. + * @param {ol.proj.Projection} source Source projection. + * @param {ol.proj.Projection} destination Destination projection. * @return {ol.TransformFunction} transformFn The unregistered transform. */ ol.proj.removeTransform = function(source, destination) { @@ -455,11 +458,11 @@ ol.proj.removeTransform = function(source, destination) { * @param {ol.ProjectionLike} projectionLike Either a code string which is a * combination of authority and identifier such as "EPSG:4326", or an * existing projection object, or undefined. - * @return {ol.Projection} Projection. + * @return {ol.proj.Projection} Projection. */ ol.proj.get = function(projectionLike) { var projection; - if (projectionLike instanceof ol.Projection) { + if (projectionLike instanceof ol.proj.Projection) { projection = projectionLike; } else if (goog.isString(projectionLike)) { var code = projectionLike; @@ -512,8 +515,8 @@ ol.proj.getProj4jsProjectionFromCode_ = function(options) { * projection does represent the same geographic point as the same coordinate in * the other projection. * - * @param {ol.Projection} projection1 Projection 1. - * @param {ol.Projection} projection2 Projection 2. + * @param {ol.proj.Projection} projection1 Projection 1. + * @param {ol.proj.Projection} projection2 Projection 2. * @return {boolean} Equivalent. */ ol.proj.equivalent = function(projection1, projection2) { @@ -550,8 +553,8 @@ ol.proj.getTransform = function(source, destination) { * Searches a function that can be used to convert coordinates from the source * projection to the destination projection. * - * @param {ol.Projection} sourceProjection Source projection. - * @param {ol.Projection} destinationProjection Destination projection. + * @param {ol.proj.Projection} sourceProjection Source projection. + * @param {ol.proj.Projection} destinationProjection Destination projection. * @return {ol.TransformFunction} Transform. */ ol.proj.getTransformFromProjections = @@ -683,8 +686,8 @@ ol.proj.transform = function(point, source, destination) { * Transforms the given point to the destination projection. * * @param {ol.Coordinate} point Point. - * @param {ol.Projection} sourceProjection Source projection. - * @param {ol.Projection} destinationProjection Destination projection. + * @param {ol.proj.Projection} sourceProjection Source projection. + * @param {ol.proj.Projection} destinationProjection Destination projection. * @return {ol.Coordinate} Point. */ ol.proj.transformWithProjections = @@ -697,7 +700,7 @@ ol.proj.transformWithProjections = /** * @param {ol.Proj4jsProjectionOptions} options Proj4js projection options. - * @return {ol.Projection} Proj4js projection. + * @return {ol.proj.Projection} Proj4js projection. */ ol.proj.configureProj4jsProjection = function(options) { goog.asserts.assert(!goog.object.containsKey( diff --git a/src/ol/renderer/layerrenderer.js b/src/ol/renderer/layerrenderer.js index c33e0770ea..65d3d50af6 100644 --- a/src/ol/renderer/layerrenderer.js +++ b/src/ol/renderer/layerrenderer.js @@ -196,7 +196,7 @@ ol.renderer.Layer.prototype.updateUsedTiles = * @param {function(ol.Tile): boolean} isLoadedFunction Function to * determine if the tile is loaded. * @param {ol.source.Tile} tileSource Tile source. - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @protected * @return {function(number, number, number): ol.Tile} Returns a tile if it is * loaded. @@ -243,7 +243,7 @@ ol.renderer.Layer.prototype.snapCenterToPixel = * @param {ol.FrameState} frameState Frame state. * @param {ol.source.Tile} tileSource Tile source. * @param {ol.tilegrid.TileGrid} tileGrid Tile grid. - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @param {ol.Extent} extent Extent. * @param {number} currentZ Current Z. * @param {number} preload Load low resolution tiles up to 'preload' levels. diff --git a/src/ol/source/bingmapssource.js b/src/ol/source/bingmapssource.js index f2294d2f60..470194b511 100644 --- a/src/ol/source/bingmapssource.js +++ b/src/ol/source/bingmapssource.js @@ -90,7 +90,7 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse = /** * @this {ol.source.BingMaps} * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @return {string|undefined} Tile URL. */ function(tileCoord, projection) { diff --git a/src/ol/source/imagesource.js b/src/ol/source/imagesource.js index 1a9d6579b3..d3b523c6f8 100644 --- a/src/ol/source/imagesource.js +++ b/src/ol/source/imagesource.js @@ -7,7 +7,6 @@ goog.require('ol.Extent'); goog.require('ol.Image'); goog.require('ol.ImageUrlFunction'); goog.require('ol.ImageUrlFunctionType'); -goog.require('ol.Projection'); goog.require('ol.Size'); goog.require('ol.array'); goog.require('ol.source.Source'); @@ -78,7 +77,7 @@ goog.inherits(ol.source.Image, ol.source.Source); * @param {ol.Extent} extent Extent. * @param {number} resolution Resolution. * @param {ol.Size} size Size. - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @return {ol.Image} Single image. */ ol.source.Image.prototype.createImage = @@ -112,7 +111,7 @@ ol.source.Image.prototype.findNearestResolution = /** * @param {ol.Extent} extent Extent. * @param {number} resolution Resolution. - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @return {ol.Image} Single image. */ ol.source.Image.prototype.getImage = goog.abstractMethod; diff --git a/src/ol/source/imagestaticsource.js b/src/ol/source/imagestaticsource.js index b6e3742d9a..4f15199c41 100644 --- a/src/ol/source/imagestaticsource.js +++ b/src/ol/source/imagestaticsource.js @@ -64,7 +64,7 @@ ol.source.ImageStatic.createImageFunction = function(url) { /** * @param {ol.Extent} extent Extent. * @param {ol.Size} size Size. - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @return {string|undefined} URL. */ function(extent, size, projection) { diff --git a/src/ol/source/source.js b/src/ol/source/source.js index 0072d8f60e..2f1f0db681 100644 --- a/src/ol/source/source.js +++ b/src/ol/source/source.js @@ -20,7 +20,7 @@ ol.source.Source = function(options) { /** * @private - * @type {ol.Projection} + * @type {ol.proj.Projection} */ this.projection_ = ol.proj.get(options.projection); @@ -98,7 +98,7 @@ ol.source.Source.prototype.getLogo = function() { /** - * @return {ol.Projection} Projection. + * @return {ol.proj.Projection} Projection. */ ol.source.Source.prototype.getProjection = function() { return this.projection_; @@ -150,7 +150,7 @@ ol.source.Source.prototype.setLogo = function(logo) { /** - * @param {ol.Projection} projection Projetion. + * @param {ol.proj.Projection} projection Projetion. */ ol.source.Source.prototype.setProjection = function(projection) { this.projection_ = projection; diff --git a/src/ol/source/tileimagesource.js b/src/ol/source/tileimagesource.js index 7299595266..61ae2bd6c8 100644 --- a/src/ol/source/tileimagesource.js +++ b/src/ol/source/tileimagesource.js @@ -4,7 +4,6 @@ goog.require('goog.asserts'); goog.require('ol.Attribution'); goog.require('ol.Extent'); goog.require('ol.ImageTile'); -goog.require('ol.Projection'); goog.require('ol.Tile'); goog.require('ol.TileCache'); goog.require('ol.TileCoord'); diff --git a/src/ol/source/tilesource.js b/src/ol/source/tilesource.js index c357a8dbd7..14b2e5d77e 100644 --- a/src/ol/source/tilesource.js +++ b/src/ol/source/tilesource.js @@ -136,7 +136,7 @@ ol.source.Tile.prototype.getResolutions = function() { * @param {number} z Tile coordinate z. * @param {number} x Tile coordinate x. * @param {number} y Tile coordinate y. - * @param {ol.Projection=} opt_projection Projection. + * @param {ol.proj.Projection=} opt_projection Projection. * @return {!ol.Tile} Tile. */ ol.source.Tile.prototype.getTile = goog.abstractMethod; diff --git a/src/ol/source/vectorsource.js b/src/ol/source/vectorsource.js index a53eb708cb..4c24b94a1c 100644 --- a/src/ol/source/vectorsource.js +++ b/src/ol/source/vectorsource.js @@ -61,7 +61,7 @@ goog.inherits(ol.source.Vector, ol.source.Source); /** * @param {ol.layer.Vector} layer Layer that parses the data. * @param {ol.Extent} extent Extent that needs to be fetched. - * @param {ol.Projection} projection Projection of the view. + * @param {ol.proj.Projection} projection Projection of the view. * @param {function()=} opt_callback Callback which is called when features are * parsed after loading. * @return {ol.source.VectorLoadState} The current load state. diff --git a/src/ol/source/wmssource.js b/src/ol/source/wmssource.js index 1171f5babe..52e8d973cd 100644 --- a/src/ol/source/wmssource.js +++ b/src/ol/source/wmssource.js @@ -29,7 +29,7 @@ ol.source.WMSGetFeatureInfoMethod = { * @param {Object.} params Request parameters. * @param {ol.Extent} extent Extent. * @param {ol.Size} size Size. - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @return {string} WMS GetMap request URL. */ ol.source.wms.getUrl = diff --git a/src/ol/source/wmtssource.js b/src/ol/source/wmtssource.js index e4fecfcd05..d0ddb75e40 100644 --- a/src/ol/source/wmtssource.js +++ b/src/ol/source/wmtssource.js @@ -95,7 +95,7 @@ ol.source.WMTS = function(options) { /** * @this {ol.source.WMTS} * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @return {string|undefined} Tile URL. */ function(tileCoord, projection) { @@ -136,7 +136,7 @@ ol.source.WMTS = function(options) { tileUrlFunction = ol.TileUrlFunction.withTileCoordTransform( /** * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @param {ol.TileCoord=} opt_tileCoord Tile coordinate. * @return {ol.TileCoord} Tile coordinate. */ diff --git a/src/ol/tilegrid/tilegrid.js b/src/ol/tilegrid/tilegrid.js index fe90b19b5b..be6a12710d 100644 --- a/src/ol/tilegrid/tilegrid.js +++ b/src/ol/tilegrid/tilegrid.js @@ -3,13 +3,13 @@ goog.provide('ol.tilegrid.TileGrid'); goog.require('goog.array'); goog.require('goog.asserts'); goog.require('ol.Coordinate'); -goog.require('ol.Projection'); goog.require('ol.ProjectionUnits'); goog.require('ol.Size'); goog.require('ol.TileCoord'); goog.require('ol.TileRange'); goog.require('ol.array'); goog.require('ol.extent'); +goog.require('ol.proj.Projection'); /** @@ -106,8 +106,8 @@ ol.tilegrid.TileGrid.tmpTileCoord_ = new ol.TileCoord(0, 0, 0); /** * @param {{extent: (ol.Extent|undefined), * wrapX: (boolean|undefined)}=} opt_options Options. - * @return {function(ol.TileCoord, ol.Projection, ol.TileCoord=): ol.TileCoord} - * Tile coordinate transform. + * @return {function(ol.TileCoord, ol.proj.Projection, ol.TileCoord=): + * ol.TileCoord} Tile coordinate transform. */ ol.tilegrid.TileGrid.prototype.createTileCoordTransform = goog.abstractMethod; @@ -389,7 +389,7 @@ ol.tilegrid.TileGrid.prototype.getZForResolution = function(resolution) { /** - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @return {ol.tilegrid.TileGrid} Default tile grid for the passed projection. */ ol.tilegrid.getForProjection = function(projection) { @@ -403,7 +403,7 @@ ol.tilegrid.getForProjection = function(projection) { /** - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @param {number=} opt_maxZoom Maximum zoom level. * @param {ol.Size=} opt_tileSize Tile size. * @return {ol.tilegrid.TileGrid} TileGrid instance. diff --git a/src/ol/tilegrid/xyztilegrid.js b/src/ol/tilegrid/xyztilegrid.js index 40ba8ccdff..a68d754ed9 100644 --- a/src/ol/tilegrid/xyztilegrid.js +++ b/src/ol/tilegrid/xyztilegrid.js @@ -59,7 +59,7 @@ ol.tilegrid.XYZ.prototype.createTileCoordTransform = function(opt_options) { return ( /** * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @param {ol.TileCoord=} opt_tileCoord Destination tile coordinate. * @return {ol.TileCoord} Tile coordinate. */ diff --git a/src/ol/tileurlfunction.js b/src/ol/tileurlfunction.js index d69080dc0a..b9da756063 100644 --- a/src/ol/tileurlfunction.js +++ b/src/ol/tileurlfunction.js @@ -9,13 +9,14 @@ goog.require('ol.extent'); /** * @typedef {function(this: ol.source.TileImage, ol.TileCoord, - * ol.Projection): (string|undefined)} + * ol.proj.Projection): (string|undefined)} */ ol.TileUrlFunctionType; /** - * @typedef {function(ol.TileCoord, ol.Projection, ol.TileCoord=): ol.TileCoord} + * @typedef {function(ol.TileCoord, ol.proj.Projection, ol.TileCoord=): + * ol.TileCoord} */ ol.TileCoordTransformType; @@ -29,7 +30,7 @@ ol.TileUrlFunction.createFromTemplate = function(template) { /** * @this {ol.source.TileImage} * @param {ol.TileCoord} tileCoord Tile Coordinate. - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @return {string|undefined} Tile URL. */ function(tileCoord, projection) { @@ -66,7 +67,7 @@ ol.TileUrlFunction.createFromTileUrlFunctions = function(tileUrlFunctions) { /** * @this {ol.source.TileImage} * @param {ol.TileCoord} tileCoord Tile Coordinate. - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @return {string|undefined} Tile URL. */ function(tileCoord, projection) { @@ -85,7 +86,7 @@ ol.TileUrlFunction.createFromTileUrlFunctions = function(tileUrlFunctions) { * @param {string} baseUrl Base URL (may have query data). * @param {Object.} params to encode in the url. * @param {function(this: ol.source.TileImage, string, Object., - * ol.Extent, ol.Size, ol.Projection)} paramsFunction params function. + * ol.Extent, ol.Size, ol.proj.Projection)} paramsFunction params function. * @return {ol.TileUrlFunctionType} Tile URL function. */ ol.TileUrlFunction.createFromParamsFunction = @@ -95,7 +96,7 @@ ol.TileUrlFunction.createFromParamsFunction = /** * @this {ol.source.TileImage} * @param {ol.TileCoord} tileCoord Tile Coordinate. - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @return {string|undefined} Tile URL. */ function(tileCoord, projection) { @@ -118,7 +119,7 @@ ol.TileUrlFunction.createFromParamsFunction = /** * @this {ol.source.TileImage} * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @return {string|undefined} Tile URL. */ ol.TileUrlFunction.nullTileUrlFunction = function(tileCoord, projection) { @@ -138,7 +139,7 @@ ol.TileUrlFunction.withTileCoordTransform = /** * @this {ol.source.TileImage} * @param {ol.TileCoord} tileCoord Tile Coordinate. - * @param {ol.Projection} projection Projection. + * @param {ol.proj.Projection} projection Projection. * @return {string|undefined} Tile URL. */ function(tileCoord, projection) { diff --git a/src/ol/view2d.js b/src/ol/view2d.js index dd573f1306..9fe18e637d 100644 --- a/src/ol/view2d.js +++ b/src/ol/view2d.js @@ -7,7 +7,6 @@ goog.require('goog.asserts'); goog.require('ol.Constraints'); goog.require('ol.IView2D'); goog.require('ol.IView3D'); -goog.require('ol.Projection'); goog.require('ol.ProjectionUnits'); goog.require('ol.ResolutionConstraint'); goog.require('ol.RotationConstraint'); @@ -17,6 +16,7 @@ goog.require('ol.View'); goog.require('ol.coordinate'); goog.require('ol.extent'); goog.require('ol.proj'); +goog.require('ol.proj.Projection'); /** @@ -234,7 +234,7 @@ ol.View2D.prototype.calculateExtent = function(size) { * @inheritDoc */ ol.View2D.prototype.getProjection = function() { - return /** @type {ol.Projection|undefined} */ ( + return /** @type {ol.proj.Projection|undefined} */ ( this.get(ol.View2DProperty.PROJECTION)); }; goog.exportProperty( @@ -425,7 +425,7 @@ goog.exportProperty( /** * Set the projection of this view. - * @param {ol.Projection|undefined} projection Projection. + * @param {ol.proj.Projection|undefined} projection Projection. */ ol.View2D.prototype.setProjection = function(projection) { this.set(ol.View2DProperty.PROJECTION, projection); diff --git a/test/spec/ol/proj/chprojection.test.js b/test/spec/ol/proj/chprojection.test.js index 5b86aa6f20..b42f0322f6 100644 --- a/test/spec/ol/proj/chprojection.test.js +++ b/test/spec/ol/proj/chprojection.test.js @@ -47,7 +47,7 @@ describe('ol.proj.EPSG2056', function() { beforeEach(function() { ol.proj.EPSG2056.add(); epsg2056 = ol.proj.get('EPSG:2056'); - expect(epsg2056).to.be.an(ol.Projection); + expect(epsg2056).to.be.an(ol.proj.Projection); }); it('transforms from EPSG:2056 to EPSG:4326', function() { @@ -82,7 +82,7 @@ describe('ol.proj.EPSG21781', function() { beforeEach(function() { ol.proj.EPSG21781.add(); epsg21781 = ol.proj.get('EPSG:21781'); - expect(epsg21781).to.be.an(ol.Projection); + expect(epsg21781).to.be.an(ol.proj.Projection); }); it('maintains accuracy when round-tripping', function() { @@ -127,8 +127,8 @@ describe('ol.proj.EPSG21781', function() { goog.require('goog.math'); -goog.require('ol.Projection'); goog.require('ol.proj'); goog.require('ol.proj.CH'); goog.require('ol.proj.EPSG2056'); goog.require('ol.proj.EPSG21781'); +goog.require('ol.proj.Projection'); diff --git a/test/spec/ol/proj/proj.test.js b/test/spec/ol/proj/proj.test.js index 4171d5b4c4..d6db351141 100644 --- a/test/spec/ol/proj/proj.test.js +++ b/test/spec/ol/proj/proj.test.js @@ -275,12 +275,12 @@ describe('ol.proj', function() { var units = ol.ProjectionUnits.DEGREES; it('removes functions cached by addTransform', function() { - var foo = new ol.Projection({ + var foo = new ol.proj.Projection({ code: 'foo', units: units, extent: extent }); - var bar = new ol.Projection({ + var bar = new ol.proj.Projection({ code: 'bar', units: units, extent: extent @@ -298,7 +298,7 @@ describe('ol.proj', function() { }); - describe('ol.Projection.prototype.getMetersPerUnit()', function() { + describe('ol.proj.Projection.prototype.getMetersPerUnit()', function() { beforeEach(function() { Proj4js.defs['EPSG:26782'] = @@ -351,7 +351,7 @@ describe('ol.proj', function() { goog.require('goog.array'); -goog.require('ol.Projection'); goog.require('ol.ProjectionUnits'); goog.require('ol.proj'); +goog.require('ol.proj.Projection'); goog.require('ol.proj.common'); diff --git a/test/spec/ol/tilegrid/tilegrid.test.js b/test/spec/ol/tilegrid/tilegrid.test.js index 86700b6be6..a8e1965960 100644 --- a/test/spec/ol/tilegrid/tilegrid.test.js +++ b/test/spec/ol/tilegrid/tilegrid.test.js @@ -191,7 +191,7 @@ describe('ol.tilegrid.TileGrid', function() { }); it('works for projections unknown to the client', function() { - var projection = new ol.Projection( + var projection = new ol.proj.Projection( {code: 'EPSG:31287', units: 'm'}); var grid = ol.tilegrid.createForProjection(projection); var resolutions = grid.getResolutions(); @@ -643,8 +643,8 @@ describe('ol.tilegrid.TileGrid', function() { }); goog.require('ol.Coordinate'); -goog.require('ol.Projection'); goog.require('ol.ProjectionUnits'); goog.require('ol.TileCoord'); goog.require('ol.proj'); +goog.require('ol.proj.Projection'); goog.require('ol.tilegrid.TileGrid'); From 9a29c0e22d417fbfcff3587f0c69064d4a192a48 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Fri, 30 Aug 2013 14:22:57 -0600 Subject: [PATCH 2/5] Rename ol.ProjectionLike to ol.proj.ProjectionLike --- src/objectliterals.jsdoc | 26 +++++++++++++------------- src/ol/parser/featureparser.js | 2 +- src/ol/proj/proj.js | 18 +++++++++--------- src/ol/source/imagesource.js | 2 +- src/ol/source/tileimagesource.js | 2 +- src/ol/source/tilesource.js | 2 +- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 9ce3c92092..ead34bf81e 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -14,7 +14,7 @@ * @typedef {Object} ol.GeolocationOptions * @property {boolean|undefined} tracking Tracking. * @property {GeolocationPositionOptions|undefined} trackingOptions Tracking options. - * @property {ol.ProjectionLike} projection Projection. + * @property {ol.proj.ProjectionLike} projection Projection. */ /** @@ -108,7 +108,7 @@ * @property {number|undefined} maxZoom The maximum zoom level used to determine * the resolution constraint. It is used together with `maxResolution` and * `zoomFactor`. Default is 28. - * @property {ol.ProjectionLike} projection The projection. Default is + * @property {ol.proj.ProjectionLike} projection The projection. Default is * `EPSG:3857` (Spherical Mercator). * @property {number|undefined} resolution The initial resolution for the view. * The units are `projection` units per pixel (e.g. meters per pixel). @@ -198,7 +198,7 @@ * @property {string|undefined} className CSS class name. Default is 'ol-mouse-position'. * @property {ol.CoordinateFormatType|undefined} coordinateFormat Coordinate * format. - * @property {ol.ProjectionLike} projection Projection. + * @property {ol.proj.ProjectionLike} projection Projection. * @property {Element|undefined} target Target. * @property {string|undefined} undefinedHTML Markup for undefined coordinates. * Default is '' (empty string). @@ -388,7 +388,7 @@ /** * @typedef {Object} ol.parser.GMLWriteOptions - * @property {ol.ProjectionLike} srsName The srsName to use when writing. + * @property {ol.proj.ProjectionLike} srsName The srsName to use when writing. * @property {string|undefined} axisOrientation The axis orientation. */ @@ -459,7 +459,7 @@ /** * @typedef {Object} ol.source.TileDebugOptions * @property {ol.Extent|undefined} extent Extent. - * @property {ol.ProjectionLike} projection Projection. + * @property {ol.proj.ProjectionLike} projection Projection. * @property {ol.tilegrid.TileGrid|undefined} tileGrid Tile grid. */ @@ -483,7 +483,7 @@ * `LAYERS` param is required. `STYLES` is '' by default. `VERSION` is * '1.3.0' by default. `WIDTH`, `HEIGHT`, `BBOX` and `CRS` (`SRS` for WMS * version < 1.3.0) will be set dynamically. - * @property {ol.ProjectionLike} projection Projection. + * @property {ol.proj.ProjectionLike} projection Projection. * @property {number|undefined} ratio Ratio. 1 means image requests are the size * of the map viewport, 2 means twice the size of the map viewport, and so * on. @@ -497,7 +497,7 @@ * @property {Array.|undefined} attributions Attributions. * @property {ol.Extent|undefined} extent Extent. * @property {string|undefined} logo Logo. - * @property {ol.ProjectionLike} projection Projection. + * @property {ol.proj.ProjectionLike} projection Projection. */ /** @@ -517,7 +517,7 @@ * @property {ol.Extent|undefined} extent Extent. * @property {ol.Extent|undefined} imageExtent Extent of the image. * @property {ol.Size|undefined} imageSize Size of the image. - * @property {ol.ProjectionLike} projection Projection. + * @property {ol.proj.ProjectionLike} projection Projection. * @property {string|undefined} url Url. */ @@ -542,7 +542,7 @@ * getFeatureInfoOptions Options for GetFeatureInfo. * @property {ol.tilegrid.TileGrid|undefined} tileGrid Tile grid. * @property {number|undefined} maxZoom Maximum zoom. - * @property {ol.ProjectionLike} projection Projection. + * @property {ol.proj.ProjectionLike} projection Projection. * @property {string|undefined} url WMS service url. * @property {Array.|undefined} urls WMS service urls. Use this instead * of `url` when the WMS supports multiple urls for GetMap requests. @@ -556,7 +556,7 @@ * @property {string|undefined} logo Logo. * @property {ol.parser.Parser} parser Parser instance to parse data * provided as `data` or fetched from `url`. - * @property {ol.ProjectionLike|undefined} projection Projection. Usually the + * @property {ol.proj.ProjectionLike|undefined} projection Projection. Usually the * projection is provided by the parser, so this only needs to be set if * the parser does not know the SRS (e.g. in some GML flavors), or if the * projection determined by the parser needs to be overridden. @@ -571,7 +571,7 @@ * lineStringCollections Line string collections. * @property {Array.|undefined} pointCollections * Point collections. - * @property {ol.ProjectionLike} projection Projection. + * @property {ol.proj.ProjectionLike} projection Projection. */ @@ -591,7 +591,7 @@ * requests. * @property {ol.Extent|undefined} extent Extent. * @property {ol.tilegrid.WMTS} tileGrid Tile grid. - * @property {ol.ProjectionLike} projection Projection. + * @property {ol.proj.ProjectionLike} projection Projection. * @property {ol.source.WMTSRequestEncoding|undefined} requestEncoding Request * encoding. * @property {string} layer Layer. @@ -612,7 +612,7 @@ * requests. * @property {ol.Extent|undefined} extent Extent. * @property {string|undefined} logo Logo. - * @property {ol.ProjectionLike} projection Projection. + * @property {ol.proj.ProjectionLike} projection Projection. * @property {number|undefined} maxZoom Optional max zoom level. The default is * 18. * @property {number|undefined} minZoom Unsupported (TODO: remove this). diff --git a/src/ol/parser/featureparser.js b/src/ol/parser/featureparser.js index 0f09dc8511..d284865c1c 100644 --- a/src/ol/parser/featureparser.js +++ b/src/ol/parser/featureparser.js @@ -98,7 +98,7 @@ ol.parser.ReadFeaturesCallback; /** - * @typedef {{projection: ol.ProjectionLike}} + * @typedef {{projection: ol.proj.ProjectionLike}} */ ol.parser.ReadFeaturesMetadata; diff --git a/src/ol/proj/proj.js b/src/ol/proj/proj.js index c1bbbde647..c3f76b48c8 100644 --- a/src/ol/proj/proj.js +++ b/src/ol/proj/proj.js @@ -1,7 +1,7 @@ -goog.provide('ol.ProjectionLike'); goog.provide('ol.ProjectionUnits'); goog.provide('ol.proj'); goog.provide('ol.proj.Projection'); +goog.provide('ol.proj.ProjectionLike'); goog.require('goog.array'); goog.require('goog.asserts'); @@ -27,9 +27,9 @@ ol.HAVE_PROJ4JS = ol.ENABLE_PROJ4JS && typeof Proj4js == 'object'; /** * A projection as {@link ol.proj.Projection}, SRS identifier string or * undefined. - * @typedef {ol.proj.Projection|string|undefined} ol.ProjectionLike + * @typedef {ol.proj.Projection|string|undefined} ol.proj.ProjectionLike */ -ol.ProjectionLike; +ol.proj.ProjectionLike; /** @@ -455,8 +455,8 @@ ol.proj.removeTransform = function(source, destination) { /** - * @param {ol.ProjectionLike} projectionLike Either a code string which is a - * combination of authority and identifier such as "EPSG:4326", or an + * @param {ol.proj.ProjectionLike} projectionLike Either a code string which is + * a combination of authority and identifier such as "EPSG:4326", or an * existing projection object, or undefined. * @return {ol.proj.Projection} Projection. */ @@ -537,8 +537,8 @@ ol.proj.equivalent = function(projection1, projection2) { * function to convert a coordinates array from the source projection to the * destination projection. * - * @param {ol.ProjectionLike} source Source. - * @param {ol.ProjectionLike} destination Destination. + * @param {ol.proj.ProjectionLike} source Source. + * @param {ol.proj.ProjectionLike} destination Destination. * @return {ol.TransformFunction} Transform. */ ol.proj.getTransform = function(source, destination) { @@ -672,8 +672,8 @@ ol.proj.cloneTransform = function(input, opt_output, opt_dimension) { /** * @param {ol.Coordinate} point Point. - * @param {ol.ProjectionLike} source Source. - * @param {ol.ProjectionLike} destination Destination. + * @param {ol.proj.ProjectionLike} source Source. + * @param {ol.proj.ProjectionLike} destination Destination. * @return {ol.Coordinate} Point. */ ol.proj.transform = function(point, source, destination) { diff --git a/src/ol/source/imagesource.js b/src/ol/source/imagesource.js index d3b523c6f8..ad5e77a519 100644 --- a/src/ol/source/imagesource.js +++ b/src/ol/source/imagesource.js @@ -17,7 +17,7 @@ goog.require('ol.source.Source'); * crossOrigin: (null|string|undefined), * extent: (null|ol.Extent|undefined), * logo: (string|undefined), - * projection: ol.ProjectionLike, + * projection: ol.proj.ProjectionLike, * resolutions: (Array.|undefined), * imageUrlFunction: (ol.ImageUrlFunctionType| * undefined)}} diff --git a/src/ol/source/tileimagesource.js b/src/ol/source/tileimagesource.js index 61ae2bd6c8..338fbc5aa6 100644 --- a/src/ol/source/tileimagesource.js +++ b/src/ol/source/tileimagesource.js @@ -20,7 +20,7 @@ goog.require('ol.tilegrid.TileGrid'); * extent: (ol.Extent|undefined), * logo: (string|undefined), * opaque: (boolean|undefined), - * projection: ol.ProjectionLike, + * projection: ol.proj.ProjectionLike, * tileGrid: (ol.tilegrid.TileGrid|undefined), * tileUrlFunction: (ol.TileUrlFunctionType|undefined)}} */ diff --git a/src/ol/source/tilesource.js b/src/ol/source/tilesource.js index 14b2e5d77e..e0b7e11f1b 100644 --- a/src/ol/source/tilesource.js +++ b/src/ol/source/tilesource.js @@ -16,7 +16,7 @@ goog.require('ol.tilegrid.TileGrid'); * extent: (ol.Extent|undefined), * logo: (string|undefined), * opaque: (boolean|undefined), - * projection: ol.ProjectionLike, + * projection: ol.proj.ProjectionLike, * tileGrid: (ol.tilegrid.TileGrid|undefined)}} */ ol.source.TileOptions; From b524de417b4ea76e2b05df55f26e8f67b371690e Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Fri, 30 Aug 2013 14:30:43 -0600 Subject: [PATCH 3/5] Rename ol.ProjectionUnits to ol.proj.Units --- examples/wms-no-proj.js | 4 ++-- src/objectliterals.jsdoc | 2 +- src/ol/control/scalelinecontrol.js | 18 +++++++++--------- src/ol/proj.exports | 8 ++++---- src/ol/proj/chprojection.js | 4 ++-- src/ol/proj/epsg3857projection.js | 4 ++-- src/ol/proj/epsg4326projection.js | 4 ++-- src/ol/proj/proj.js | 22 +++++++++++----------- src/ol/tilegrid/tilegrid.js | 4 ++-- src/ol/view2d.js | 4 ++-- test/spec/ol/proj/proj.test.js | 6 +++--- test/spec/ol/tilegrid/tilegrid.test.js | 4 ++-- 12 files changed, 42 insertions(+), 42 deletions(-) diff --git a/examples/wms-no-proj.js b/examples/wms-no-proj.js index d51f7ec345..09e7da57a8 100644 --- a/examples/wms-no-proj.js +++ b/examples/wms-no-proj.js @@ -1,11 +1,11 @@ goog.require('ol.Attribution'); goog.require('ol.Map'); -goog.require('ol.ProjectionUnits'); goog.require('ol.RendererHints'); goog.require('ol.View2D'); goog.require('ol.layer.Image'); goog.require('ol.layer.Tile'); goog.require('ol.proj.Projection'); +goog.require('ol.proj.Units'); goog.require('ol.source.ImageWMS'); goog.require('ol.source.TileWMS'); @@ -47,7 +47,7 @@ var layers = [ // projection object. var projection = new ol.proj.Projection({ code: 'EPSG:21781', - units: ol.ProjectionUnits.METERS + units: ol.proj.Units.METERS }); var map = new ol.Map({ diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index ead34bf81e..0813116336 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -85,7 +85,7 @@ * Object literal with config options for the projection. * @typedef {Object} ol.ProjectionOptions * @property {string} code The SRS identifier code, e.g. 'EPSG:4326'. - * @property {ol.ProjectionUnits} units Units. + * @property {ol.proj.Units} units Units. * @property {ol.Extent|undefined} extent The validity extent for the SRS. * @property {string|undefined} axisOrientation The axis orientation as * specified in Proj4. The default is 'enu'. diff --git a/src/ol/control/scalelinecontrol.js b/src/ol/control/scalelinecontrol.js index ea9cdac7d3..b48c37f311 100644 --- a/src/ol/control/scalelinecontrol.js +++ b/src/ol/control/scalelinecontrol.js @@ -10,12 +10,12 @@ goog.require('goog.events'); goog.require('goog.math'); goog.require('goog.style'); goog.require('ol.Object'); -goog.require('ol.ProjectionUnits'); goog.require('ol.TransformFunction'); goog.require('ol.View2DState'); goog.require('ol.control.Control'); goog.require('ol.css'); goog.require('ol.proj'); +goog.require('ol.proj.Units'); goog.require('ol.sphere.NORMAL'); @@ -197,7 +197,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() { var cosLatitude; var units = this.getUnits(); - if (projectionUnits == ol.ProjectionUnits.DEGREES && + if (projectionUnits == ol.proj.Units.DEGREES && (units == ol.control.ScaleLineUnits.METRIC || units == ol.control.ScaleLineUnits.IMPERIAL)) { @@ -205,10 +205,10 @@ ol.control.ScaleLine.prototype.updateElement_ = function() { this.toEPSG4326_ = null; cosLatitude = Math.cos(goog.math.toRadians(center[1])); pointResolution *= Math.PI * cosLatitude * ol.sphere.NORMAL.radius / 180; - projectionUnits = ol.ProjectionUnits.METERS; + projectionUnits = ol.proj.Units.METERS; - } else if ((projectionUnits == ol.ProjectionUnits.FEET || - projectionUnits == ol.ProjectionUnits.METERS) && + } else if ((projectionUnits == ol.proj.Units.FEET || + projectionUnits == ol.proj.Units.METERS) && units == ol.control.ScaleLineUnits.DEGREES) { // Convert pointResolution from meters or feet to degrees @@ -218,11 +218,11 @@ ol.control.ScaleLine.prototype.updateElement_ = function() { } cosLatitude = Math.cos(goog.math.toRadians(this.toEPSG4326_(center)[1])); var radius = ol.sphere.NORMAL.radius; - if (projectionUnits == ol.ProjectionUnits.FEET) { + if (projectionUnits == ol.proj.Units.FEET) { radius /= 0.3048; } pointResolution *= 180 / (Math.PI * cosLatitude * radius); - projectionUnits = ol.ProjectionUnits.DEGREES; + projectionUnits = ol.proj.Units.DEGREES; } else { this.toEPSG4326_ = null; @@ -231,9 +231,9 @@ ol.control.ScaleLine.prototype.updateElement_ = function() { goog.asserts.assert( ((units == ol.control.ScaleLineUnits.METRIC || units == ol.control.ScaleLineUnits.IMPERIAL) && - projectionUnits == ol.ProjectionUnits.METERS) || + projectionUnits == ol.proj.Units.METERS) || (units == ol.control.ScaleLineUnits.DEGREES && - projectionUnits == ol.ProjectionUnits.DEGREES)); + projectionUnits == ol.proj.Units.DEGREES)); var nominalCount = this.minWidth_ * pointResolution; var suffix = ''; diff --git a/src/ol/proj.exports b/src/ol/proj.exports index a4e9dd7459..edc4a9a8a3 100644 --- a/src/ol/proj.exports +++ b/src/ol/proj.exports @@ -7,10 +7,10 @@ @exportProperty ol.proj.Projection.prototype.getMetersPerUnit @exportProperty ol.proj.Projection.prototype.isGlobal -@exportSymbol ol.ProjectionUnits -@exportProperty ol.ProjectionUnits.DEGREES -@exportProperty ol.ProjectionUnits.FEET -@exportProperty ol.ProjectionUnits.METERS +@exportSymbol ol.proj.Units +@exportProperty ol.proj.Units.DEGREES +@exportProperty ol.proj.Units.FEET +@exportProperty ol.proj.Units.METERS @exportSymbol ol.proj.addProjection @exportSymbol ol.proj.get diff --git a/src/ol/proj/chprojection.js b/src/ol/proj/chprojection.js index 255e0ac6fd..4a41c20873 100644 --- a/src/ol/proj/chprojection.js +++ b/src/ol/proj/chprojection.js @@ -4,11 +4,11 @@ goog.provide('ol.proj.EPSG21781'); goog.require('goog.asserts'); goog.require('goog.math'); -goog.require('ol.ProjectionUnits'); goog.require('ol.ellipsoid.BESSEL1841'); goog.require('ol.proj'); goog.require('ol.proj.EPSG4326'); goog.require('ol.proj.Projection'); +goog.require('ol.proj.Units'); @@ -23,7 +23,7 @@ ol.proj.CH = function(options) { code: options.code, extent: options.extent, global: false, - units: ol.ProjectionUnits.METERS + units: ol.proj.Units.METERS }); }; goog.inherits(ol.proj.CH, ol.proj.Projection); diff --git a/src/ol/proj/epsg3857projection.js b/src/ol/proj/epsg3857projection.js index cddfb4ff13..ee8322d280 100644 --- a/src/ol/proj/epsg3857projection.js +++ b/src/ol/proj/epsg3857projection.js @@ -2,10 +2,10 @@ goog.provide('ol.proj.EPSG3857'); goog.require('goog.array'); goog.require('goog.asserts'); -goog.require('ol.ProjectionUnits'); goog.require('ol.math'); goog.require('ol.proj'); goog.require('ol.proj.Projection'); +goog.require('ol.proj.Units'); @@ -17,7 +17,7 @@ goog.require('ol.proj.Projection'); ol.proj.EPSG3857 = function(code) { goog.base(this, { code: code, - units: ol.ProjectionUnits.METERS, + units: ol.proj.Units.METERS, extent: ol.proj.EPSG3857.EXTENT, global: true }); diff --git a/src/ol/proj/epsg4326projection.js b/src/ol/proj/epsg4326projection.js index 49ee786bf1..ab57400178 100644 --- a/src/ol/proj/epsg4326projection.js +++ b/src/ol/proj/epsg4326projection.js @@ -1,8 +1,8 @@ goog.provide('ol.proj.EPSG4326'); -goog.require('ol.ProjectionUnits'); goog.require('ol.proj'); goog.require('ol.proj.Projection'); +goog.require('ol.proj.Units'); @@ -15,7 +15,7 @@ goog.require('ol.proj.Projection'); ol.proj.EPSG4326 = function(code, opt_axisOrientation) { goog.base(this, { code: code, - units: ol.ProjectionUnits.DEGREES, + units: ol.proj.Units.DEGREES, extent: ol.proj.EPSG4326.EXTENT, axisOrientation: opt_axisOrientation, global: true diff --git a/src/ol/proj/proj.js b/src/ol/proj/proj.js index c3f76b48c8..ac8032b996 100644 --- a/src/ol/proj/proj.js +++ b/src/ol/proj/proj.js @@ -1,7 +1,7 @@ -goog.provide('ol.ProjectionUnits'); goog.provide('ol.proj'); goog.provide('ol.proj.Projection'); goog.provide('ol.proj.ProjectionLike'); +goog.provide('ol.proj.Units'); goog.require('goog.array'); goog.require('goog.asserts'); @@ -35,7 +35,7 @@ ol.proj.ProjectionLike; /** * @enum {string} */ -ol.ProjectionUnits = { +ol.proj.Units = { DEGREES: 'degrees', FEET: 'ft', METERS: 'm' @@ -43,13 +43,13 @@ ol.ProjectionUnits = { /** - * @const {Object.} Meters per unit lookup table. + * @const {Object.} Meters per unit lookup table. */ ol.METERS_PER_UNIT = {}; -ol.METERS_PER_UNIT[ol.ProjectionUnits.DEGREES] = +ol.METERS_PER_UNIT[ol.proj.Units.DEGREES] = 2 * Math.PI * ol.sphere.NORMAL.radius / 360; -ol.METERS_PER_UNIT[ol.ProjectionUnits.FEET] = 0.3048; -ol.METERS_PER_UNIT[ol.ProjectionUnits.METERS] = 1; +ol.METERS_PER_UNIT[ol.proj.Units.FEET] = 0.3048; +ol.METERS_PER_UNIT[ol.proj.Units.METERS] = 1; @@ -67,7 +67,7 @@ ol.proj.Projection = function(options) { /** * @private - * @type {ol.ProjectionUnits} + * @type {ol.proj.Units} */ this.units_ = options.units; @@ -132,7 +132,7 @@ ol.proj.Projection.prototype.getPointResolution = goog.abstractMethod; /** * Get the units of this projection. - * @return {ol.ProjectionUnits} Units. + * @return {ol.proj.Units} Units. */ ol.proj.Projection.prototype.getUnits = function() { return this.units_; @@ -199,7 +199,7 @@ ol.proj.Projection.prototype.setDefaultTileGrid = function(tileGrid) { */ ol.Proj4jsProjection_ = function(proj4jsProj, options) { - var units = /** @type {ol.ProjectionUnits} */ (proj4jsProj.units); + var units = /** @type {ol.proj.Units} */ (proj4jsProj.units); var config = /** @type {ol.ProjectionOptions} */ ({ units: units, @@ -242,7 +242,7 @@ ol.Proj4jsProjection_.prototype.getMetersPerUnit = function() { */ ol.Proj4jsProjection_.prototype.getPointResolution = function(resolution, point) { - if (this.getUnits() == ol.ProjectionUnits.DEGREES) { + if (this.getUnits() == ol.proj.Units.DEGREES) { return resolution; } else { // Estimate point resolution by transforming the center pixel to EPSG:4326, @@ -267,7 +267,7 @@ ol.Proj4jsProjection_.prototype.getPointResolution = var height = ol.sphere.NORMAL.haversineDistance( vertices.slice(4, 6), vertices.slice(6, 8)); var pointResolution = (width + height) / 2; - if (this.getUnits() == ol.ProjectionUnits.FEET) { + if (this.getUnits() == ol.proj.Units.FEET) { // The radius of the normal sphere is defined in meters, so we must // convert back to feet. pointResolution /= 0.3048; diff --git a/src/ol/tilegrid/tilegrid.js b/src/ol/tilegrid/tilegrid.js index be6a12710d..6285376d21 100644 --- a/src/ol/tilegrid/tilegrid.js +++ b/src/ol/tilegrid/tilegrid.js @@ -3,13 +3,13 @@ goog.provide('ol.tilegrid.TileGrid'); goog.require('goog.array'); goog.require('goog.asserts'); goog.require('ol.Coordinate'); -goog.require('ol.ProjectionUnits'); goog.require('ol.Size'); goog.require('ol.TileCoord'); goog.require('ol.TileRange'); goog.require('ol.array'); goog.require('ol.extent'); goog.require('ol.proj.Projection'); +goog.require('ol.proj.Units'); /** @@ -412,7 +412,7 @@ ol.tilegrid.createForProjection = function(projection, opt_maxZoom, opt_tileSize) { var projectionExtent = projection.getExtent(); var size = goog.isNull(projectionExtent) ? - 360 * ol.METERS_PER_UNIT[ol.ProjectionUnits.DEGREES] / + 360 * ol.METERS_PER_UNIT[ol.proj.Units.DEGREES] / projection.getMetersPerUnit() : Math.max(projectionExtent[2] - projectionExtent[0], projectionExtent[3] - projectionExtent[1]); diff --git a/src/ol/view2d.js b/src/ol/view2d.js index 9fe18e637d..75d569f975 100644 --- a/src/ol/view2d.js +++ b/src/ol/view2d.js @@ -7,7 +7,6 @@ goog.require('goog.asserts'); goog.require('ol.Constraints'); goog.require('ol.IView2D'); goog.require('ol.IView3D'); -goog.require('ol.ProjectionUnits'); goog.require('ol.ResolutionConstraint'); goog.require('ol.RotationConstraint'); goog.require('ol.RotationConstraintType'); @@ -17,6 +16,7 @@ goog.require('ol.coordinate'); goog.require('ol.extent'); goog.require('ol.proj'); goog.require('ol.proj.Projection'); +goog.require('ol.proj.Units'); /** @@ -496,7 +496,7 @@ ol.View2D.createResolutionConstraint_ = function(options) { .getExtent(); var size = goog.isNull(projectionExtent) ? // use an extent that can fit the whole world if need be - 360 * ol.METERS_PER_UNIT[ol.ProjectionUnits.DEGREES] / + 360 * ol.METERS_PER_UNIT[ol.proj.Units.DEGREES] / ol.METERS_PER_UNIT[projection.getUnits()] : Math.max(projectionExtent[2] - projectionExtent[0], projectionExtent[3] - projectionExtent[1]); diff --git a/test/spec/ol/proj/proj.test.js b/test/spec/ol/proj/proj.test.js index d6db351141..b373299a58 100644 --- a/test/spec/ol/proj/proj.test.js +++ b/test/spec/ol/proj/proj.test.js @@ -272,7 +272,7 @@ describe('ol.proj', function() { describe('ol.proj.removeTransform()', function() { var extent = [180, -90, 180, 90]; - var units = ol.ProjectionUnits.DEGREES; + var units = ol.proj.Units.DEGREES; it('removes functions cached by addTransform', function() { var foo = new ol.proj.Projection({ @@ -341,7 +341,7 @@ describe('ol.proj', function() { }); expect(epsg21781.getCode()).to.eql('EPSG:21781'); expect(epsg21781.getExtent()).to.be(extent); - expect(epsg21781.getUnits()).to.be(ol.ProjectionUnits.METERS); + expect(epsg21781.getUnits()).to.be(ol.proj.Units.METERS); expect(epsg21781.isGlobal()).to.not.be(); }); @@ -351,7 +351,7 @@ describe('ol.proj', function() { goog.require('goog.array'); -goog.require('ol.ProjectionUnits'); goog.require('ol.proj'); goog.require('ol.proj.Projection'); +goog.require('ol.proj.Units'); goog.require('ol.proj.common'); diff --git a/test/spec/ol/tilegrid/tilegrid.test.js b/test/spec/ol/tilegrid/tilegrid.test.js index a8e1965960..9f4f065ee8 100644 --- a/test/spec/ol/tilegrid/tilegrid.test.js +++ b/test/spec/ol/tilegrid/tilegrid.test.js @@ -196,7 +196,7 @@ describe('ol.tilegrid.TileGrid', function() { var grid = ol.tilegrid.createForProjection(projection); var resolutions = grid.getResolutions(); expect(resolutions[5]).to.be( - 360 * ol.METERS_PER_UNIT[ol.ProjectionUnits.DEGREES] / + 360 * ol.METERS_PER_UNIT[ol.proj.Units.DEGREES] / ol.DEFAULT_TILE_SIZE / Math.pow(2, 5)); }); @@ -643,8 +643,8 @@ describe('ol.tilegrid.TileGrid', function() { }); goog.require('ol.Coordinate'); -goog.require('ol.ProjectionUnits'); goog.require('ol.TileCoord'); goog.require('ol.proj'); goog.require('ol.proj.Projection'); +goog.require('ol.proj.Units'); goog.require('ol.tilegrid.TileGrid'); From 9a2dac71820e7c08861ec0738c98f28e49b1a73f Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Fri, 30 Aug 2013 14:37:53 -0600 Subject: [PATCH 4/5] Limit ol.proj exports --- src/ol/proj.exports | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/ol/proj.exports b/src/ol/proj.exports index edc4a9a8a3..5fa787c1f2 100644 --- a/src/ol/proj.exports +++ b/src/ol/proj.exports @@ -1,11 +1,4 @@ @exportClass ol.proj.Projection ol.ProjectionOptions -@exportProperty ol.proj.Projection.prototype.getAxisOrientation -@exportProperty ol.proj.Projection.prototype.getCode -@exportProperty ol.proj.Projection.prototype.getExtent -@exportProperty ol.proj.Projection.prototype.getPointResolution -@exportProperty ol.proj.Projection.prototype.getUnits -@exportProperty ol.proj.Projection.prototype.getMetersPerUnit -@exportProperty ol.proj.Projection.prototype.isGlobal @exportSymbol ol.proj.Units @exportProperty ol.proj.Units.DEGREES From e1bafd2f6e3e495d98ec986ac4122ab024a25583 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Fri, 30 Aug 2013 16:02:54 -0600 Subject: [PATCH 5/5] Export ol.proj.Projection.prototype.getExtent for use in WMTS example --- src/ol/proj.exports | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ol/proj.exports b/src/ol/proj.exports index 5fa787c1f2..8cfb8bba1a 100644 --- a/src/ol/proj.exports +++ b/src/ol/proj.exports @@ -1,4 +1,5 @@ @exportClass ol.proj.Projection ol.ProjectionOptions +@exportProperty ol.proj.Projection.prototype.getExtent @exportSymbol ol.proj.Units @exportProperty ol.proj.Units.DEGREES