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.