Merge pull request #955 from tschaub/proj

Move projection to ol.proj namespace and limit exports.
This commit is contained in:
Tim Schaub
2013-09-16 06:42:38 -07:00
32 changed files with 180 additions and 186 deletions

View File

@@ -6,7 +6,7 @@ In general every use of OpenLayers starts by initializing a map, then adding th
Projections 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, 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/). others can be used via [Proj4js](http://trac.osgeo.org/proj4js/).

View File

@@ -1,11 +1,11 @@
goog.require('ol.Attribution'); goog.require('ol.Attribution');
goog.require('ol.Map'); goog.require('ol.Map');
goog.require('ol.Projection');
goog.require('ol.ProjectionUnits');
goog.require('ol.RendererHints'); goog.require('ol.RendererHints');
goog.require('ol.View2D'); goog.require('ol.View2D');
goog.require('ol.layer.Image'); goog.require('ol.layer.Image');
goog.require('ol.layer.Tile'); goog.require('ol.layer.Tile');
goog.require('ol.proj.Projection');
goog.require('ol.proj.Units');
goog.require('ol.source.ImageWMS'); goog.require('ol.source.ImageWMS');
goog.require('ol.source.TileWMS'); goog.require('ol.source.TileWMS');
@@ -45,9 +45,9 @@ var layers = [
// A minimal projection object is configured with only the SRS code and the map // 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 // units. No client side coordinate transforms are possible with such a
// projection object. // projection object.
var projection = new ol.Projection({ var projection = new ol.proj.Projection({
code: 'EPSG:21781', code: 'EPSG:21781',
units: ol.ProjectionUnits.METERS units: ol.proj.Units.METERS
}); });
var map = new ol.Map({ var map = new ol.Map({

View File

@@ -14,7 +14,7 @@
* @typedef {Object} ol.GeolocationOptions * @typedef {Object} ol.GeolocationOptions
* @property {boolean|undefined} tracking Tracking. * @property {boolean|undefined} tracking Tracking.
* @property {GeolocationPositionOptions|undefined} trackingOptions Tracking options. * @property {GeolocationPositionOptions|undefined} trackingOptions Tracking options.
* @property {ol.ProjectionLike} projection Projection. * @property {ol.proj.ProjectionLike} projection Projection.
*/ */
/** /**
@@ -85,7 +85,7 @@
* Object literal with config options for the projection. * Object literal with config options for the projection.
* @typedef {Object} ol.ProjectionOptions * @typedef {Object} ol.ProjectionOptions
* @property {string} code The SRS identifier code, e.g. 'EPSG:4326'. * @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 {ol.Extent|undefined} extent The validity extent for the SRS.
* @property {string|undefined} axisOrientation The axis orientation as * @property {string|undefined} axisOrientation The axis orientation as
* specified in Proj4. The default is 'enu'. * specified in Proj4. The default is 'enu'.
@@ -108,7 +108,7 @@
* @property {number|undefined} maxZoom The maximum zoom level used to determine * @property {number|undefined} maxZoom The maximum zoom level used to determine
* the resolution constraint. It is used together with `maxResolution` and * the resolution constraint. It is used together with `maxResolution` and
* `zoomFactor`. Default is 28. * `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). * `EPSG:3857` (Spherical Mercator).
* @property {number|undefined} resolution The initial resolution for the view. * @property {number|undefined} resolution The initial resolution for the view.
* The units are `projection` units per pixel (e.g. meters per pixel). * 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 {string|undefined} className CSS class name. Default is 'ol-mouse-position'.
* @property {ol.CoordinateFormatType|undefined} coordinateFormat Coordinate * @property {ol.CoordinateFormatType|undefined} coordinateFormat Coordinate
* format. * format.
* @property {ol.ProjectionLike} projection Projection. * @property {ol.proj.ProjectionLike} projection Projection.
* @property {Element|undefined} target Target. * @property {Element|undefined} target Target.
* @property {string|undefined} undefinedHTML Markup for undefined coordinates. * @property {string|undefined} undefinedHTML Markup for undefined coordinates.
* Default is '' (empty string). * Default is '' (empty string).
@@ -388,7 +388,7 @@
/** /**
* @typedef {Object} ol.parser.GMLWriteOptions * @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. * @property {string|undefined} axisOrientation The axis orientation.
*/ */
@@ -459,7 +459,7 @@
/** /**
* @typedef {Object} ol.source.TileDebugOptions * @typedef {Object} ol.source.TileDebugOptions
* @property {ol.Extent|undefined} extent Extent. * @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. * @property {ol.tilegrid.TileGrid|undefined} tileGrid Tile grid.
*/ */
@@ -483,7 +483,7 @@
* `LAYERS` param is required. `STYLES` is '' by default. `VERSION` is * `LAYERS` param is required. `STYLES` is '' by default. `VERSION` is
* '1.3.0' by default. `WIDTH`, `HEIGHT`, `BBOX` and `CRS` (`SRS` for WMS * '1.3.0' by default. `WIDTH`, `HEIGHT`, `BBOX` and `CRS` (`SRS` for WMS
* version < 1.3.0) will be set dynamically. * 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 * @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 * of the map viewport, 2 means twice the size of the map viewport, and so
* on. * on.
@@ -497,7 +497,7 @@
* @property {Array.<ol.Attribution>|undefined} attributions Attributions. * @property {Array.<ol.Attribution>|undefined} attributions Attributions.
* @property {ol.Extent|undefined} extent Extent. * @property {ol.Extent|undefined} extent Extent.
* @property {string|undefined} logo Logo. * @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} extent Extent.
* @property {ol.Extent|undefined} imageExtent Extent of the image. * @property {ol.Extent|undefined} imageExtent Extent of the image.
* @property {ol.Size|undefined} imageSize Size 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. * @property {string|undefined} url Url.
*/ */
@@ -542,7 +542,7 @@
* getFeatureInfoOptions Options for GetFeatureInfo. * getFeatureInfoOptions Options for GetFeatureInfo.
* @property {ol.tilegrid.TileGrid|undefined} tileGrid Tile grid. * @property {ol.tilegrid.TileGrid|undefined} tileGrid Tile grid.
* @property {number|undefined} maxZoom Maximum zoom. * @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 {string|undefined} url WMS service url.
* @property {Array.<string>|undefined} urls WMS service urls. Use this instead * @property {Array.<string>|undefined} urls WMS service urls. Use this instead
* of `url` when the WMS supports multiple urls for GetMap requests. * of `url` when the WMS supports multiple urls for GetMap requests.
@@ -556,7 +556,7 @@
* @property {string|undefined} logo Logo. * @property {string|undefined} logo Logo.
* @property {ol.parser.Parser} parser Parser instance to parse data * @property {ol.parser.Parser} parser Parser instance to parse data
* provided as `data` or fetched from `url`. * 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 * 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 * 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. * projection determined by the parser needs to be overridden.
@@ -571,7 +571,7 @@
* lineStringCollections Line string collections. * lineStringCollections Line string collections.
* @property {Array.<ol.geom2.PointCollection>|undefined} pointCollections * @property {Array.<ol.geom2.PointCollection>|undefined} pointCollections
* Point collections. * Point collections.
* @property {ol.ProjectionLike} projection Projection. * @property {ol.proj.ProjectionLike} projection Projection.
*/ */
@@ -591,7 +591,7 @@
* requests. * requests.
* @property {ol.Extent|undefined} extent Extent. * @property {ol.Extent|undefined} extent Extent.
* @property {ol.tilegrid.WMTS} tileGrid Tile grid. * @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 * @property {ol.source.WMTSRequestEncoding|undefined} requestEncoding Request
* encoding. * encoding.
* @property {string} layer Layer. * @property {string} layer Layer.
@@ -612,7 +612,7 @@
* requests. * requests.
* @property {ol.Extent|undefined} extent Extent. * @property {ol.Extent|undefined} extent Extent.
* @property {string|undefined} logo Logo. * @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 * @property {number|undefined} maxZoom Optional max zoom level. The default is
* 18. * 18.
* @property {number|undefined} minZoom Unsupported (TODO: remove this). * @property {number|undefined} minZoom Unsupported (TODO: remove this).

View File

@@ -12,10 +12,10 @@ goog.require('goog.style');
goog.require('ol.CoordinateFormatType'); goog.require('ol.CoordinateFormatType');
goog.require('ol.Object'); goog.require('ol.Object');
goog.require('ol.Pixel'); goog.require('ol.Pixel');
goog.require('ol.Projection');
goog.require('ol.TransformFunction'); goog.require('ol.TransformFunction');
goog.require('ol.control.Control'); goog.require('ol.control.Control');
goog.require('ol.proj'); goog.require('ol.proj');
goog.require('ol.proj.Projection');
/** /**
@@ -80,7 +80,7 @@ ol.control.MousePosition = function(opt_options) {
/** /**
* @private * @private
* @type {ol.Projection} * @type {ol.proj.Projection}
*/ */
this.mapProjection_ = null; 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() { ol.control.MousePosition.prototype.getProjection = function() {
return /** @type {ol.Projection|undefined} */ ( return /** @type {ol.proj.Projection|undefined} */ (
this.get(ol.control.MousePositionProperty.PROJECTION)); this.get(ol.control.MousePositionProperty.PROJECTION));
}; };
goog.exportProperty( 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) { ol.control.MousePosition.prototype.setProjection = function(projection) {
this.set(ol.control.MousePositionProperty.PROJECTION, projection); this.set(ol.control.MousePositionProperty.PROJECTION, projection);

View File

@@ -10,12 +10,12 @@ goog.require('goog.events');
goog.require('goog.math'); goog.require('goog.math');
goog.require('goog.style'); goog.require('goog.style');
goog.require('ol.Object'); goog.require('ol.Object');
goog.require('ol.ProjectionUnits');
goog.require('ol.TransformFunction'); goog.require('ol.TransformFunction');
goog.require('ol.View2DState'); goog.require('ol.View2DState');
goog.require('ol.control.Control'); goog.require('ol.control.Control');
goog.require('ol.css'); goog.require('ol.css');
goog.require('ol.proj'); goog.require('ol.proj');
goog.require('ol.proj.Units');
goog.require('ol.sphere.NORMAL'); goog.require('ol.sphere.NORMAL');
@@ -197,7 +197,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
var cosLatitude; var cosLatitude;
var units = this.getUnits(); var units = this.getUnits();
if (projectionUnits == ol.ProjectionUnits.DEGREES && if (projectionUnits == ol.proj.Units.DEGREES &&
(units == ol.control.ScaleLineUnits.METRIC || (units == ol.control.ScaleLineUnits.METRIC ||
units == ol.control.ScaleLineUnits.IMPERIAL)) { units == ol.control.ScaleLineUnits.IMPERIAL)) {
@@ -205,10 +205,10 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
this.toEPSG4326_ = null; this.toEPSG4326_ = null;
cosLatitude = Math.cos(goog.math.toRadians(center[1])); cosLatitude = Math.cos(goog.math.toRadians(center[1]));
pointResolution *= Math.PI * cosLatitude * ol.sphere.NORMAL.radius / 180; pointResolution *= Math.PI * cosLatitude * ol.sphere.NORMAL.radius / 180;
projectionUnits = ol.ProjectionUnits.METERS; projectionUnits = ol.proj.Units.METERS;
} else if ((projectionUnits == ol.ProjectionUnits.FEET || } else if ((projectionUnits == ol.proj.Units.FEET ||
projectionUnits == ol.ProjectionUnits.METERS) && projectionUnits == ol.proj.Units.METERS) &&
units == ol.control.ScaleLineUnits.DEGREES) { units == ol.control.ScaleLineUnits.DEGREES) {
// Convert pointResolution from meters or feet to 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])); cosLatitude = Math.cos(goog.math.toRadians(this.toEPSG4326_(center)[1]));
var radius = ol.sphere.NORMAL.radius; var radius = ol.sphere.NORMAL.radius;
if (projectionUnits == ol.ProjectionUnits.FEET) { if (projectionUnits == ol.proj.Units.FEET) {
radius /= 0.3048; radius /= 0.3048;
} }
pointResolution *= 180 / (Math.PI * cosLatitude * radius); pointResolution *= 180 / (Math.PI * cosLatitude * radius);
projectionUnits = ol.ProjectionUnits.DEGREES; projectionUnits = ol.proj.Units.DEGREES;
} else { } else {
this.toEPSG4326_ = null; this.toEPSG4326_ = null;
@@ -231,9 +231,9 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
goog.asserts.assert( goog.asserts.assert(
((units == ol.control.ScaleLineUnits.METRIC || ((units == ol.control.ScaleLineUnits.METRIC ||
units == ol.control.ScaleLineUnits.IMPERIAL) && units == ol.control.ScaleLineUnits.IMPERIAL) &&
projectionUnits == ol.ProjectionUnits.METERS) || projectionUnits == ol.proj.Units.METERS) ||
(units == ol.control.ScaleLineUnits.DEGREES && (units == ol.control.ScaleLineUnits.DEGREES &&
projectionUnits == ol.ProjectionUnits.DEGREES)); projectionUnits == ol.proj.Units.DEGREES));
var nominalCount = this.minWidth_ * pointResolution; var nominalCount = this.minWidth_ * pointResolution;
var suffix = ''; var suffix = '';

View File

@@ -9,7 +9,6 @@ goog.require('goog.events.EventType');
goog.require('goog.math'); goog.require('goog.math');
goog.require('ol.Coordinate'); goog.require('ol.Coordinate');
goog.require('ol.Object'); goog.require('ol.Object');
goog.require('ol.Projection');
goog.require('ol.proj'); goog.require('ol.proj');
@@ -254,10 +253,10 @@ goog.exportProperty(
/** /**
* Get the projection associated with the position. * Get the projection associated with the position.
* @return {ol.Projection|undefined} projection. * @return {ol.proj.Projection|undefined} projection.
*/ */
ol.Geolocation.prototype.getProjection = function() { ol.Geolocation.prototype.getProjection = function() {
return /** @type {ol.Projection|undefined} */ ( return /** @type {ol.proj.Projection|undefined} */ (
this.get(ol.GeolocationProperty.PROJECTION)); this.get(ol.GeolocationProperty.PROJECTION));
}; };
goog.exportProperty( goog.exportProperty(
@@ -312,7 +311,7 @@ goog.exportProperty(
/** /**
* Set the projection to use for transforming the coordinates. * 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) { ol.Geolocation.prototype.setProjection = function(projection) {
this.set(ol.GeolocationProperty.PROJECTION, projection); this.set(ol.GeolocationProperty.PROJECTION, projection);

View File

@@ -6,7 +6,7 @@ goog.require('ol.Size');
/** /**
* @typedef {function(this:ol.source.Image, ol.Extent, ol.Size, * @typedef {function(this:ol.source.Image, ol.Extent, ol.Size,
* ol.Projection): (string|undefined)} * ol.proj.Projection): (string|undefined)}
*/ */
ol.ImageUrlFunctionType; ol.ImageUrlFunctionType;
@@ -15,7 +15,7 @@ ol.ImageUrlFunctionType;
* @param {string} baseUrl Base URL (may have query data). * @param {string} baseUrl Base URL (may have query data).
* @param {Object.<string,*>} params to encode in the url. * @param {Object.<string,*>} params to encode in the url.
* @param {function(string, Object.<string,*>, ol.Extent, ol.Size, * @param {function(string, Object.<string,*>, 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. * @return {ol.ImageUrlFunctionType} Image URL function.
*/ */
ol.ImageUrlFunction.createFromParamsFunction = ol.ImageUrlFunction.createFromParamsFunction =
@@ -25,7 +25,7 @@ ol.ImageUrlFunction.createFromParamsFunction =
* @this {ol.source.Image} * @this {ol.source.Image}
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @param {ol.Size} size Size. * @param {ol.Size} size Size.
* @param {ol.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @return {string|undefined} URL. * @return {string|undefined} URL.
*/ */
function(extent, size, projection) { function(extent, size, projection) {

View File

@@ -2,12 +2,11 @@ goog.provide('ol.IView2D');
goog.provide('ol.View2DState'); goog.provide('ol.View2DState');
goog.require('ol.Coordinate'); goog.require('ol.Coordinate');
goog.require('ol.Projection');
/** /**
* @typedef {{center: ol.Coordinate, * @typedef {{center: ol.Coordinate,
* projection: ol.Projection, * projection: ol.proj.Projection,
* resolution: number, * resolution: number,
* rotation: 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() { ol.IView2D.prototype.getProjection = function() {
}; };

View File

@@ -383,7 +383,7 @@ ol.layer.Vector.prototype.getStyle = function() {
* as the data for `extent` is available. * as the data for `extent` is available.
* *
* @param {ol.Extent} extent Bounding extent. * @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 {ol.geom.GeometryType=} opt_type Optional geometry type.
* @param {Function=} opt_callback Callback to call when data is parsed. * @param {Function=} opt_callback Callback to call when data is parsed.
* @return {Object.<string, ol.Feature>} Features or null if source is loading * @return {Object.<string, ol.Feature>} 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 {Object|Element|Document|string} data Feature data.
* @param {ol.parser.Parser} parser Feature parser. * @param {ol.parser.Parser} parser Feature parser.
* @param {ol.Projection} projection This sucks. The layer should be a view in * @param {ol.proj.Projection} projection This sucks. The layer should be a
* one projection. * view in one projection.
*/ */
ol.layer.Vector.prototype.parseFeatures = function(data, parser, projection) { ol.layer.Vector.prototype.parseFeatures = function(data, parser, projection) {
var lookup = {}; var lookup = {};

View File

@@ -98,7 +98,7 @@ ol.parser.ReadFeaturesCallback;
/** /**
* @typedef {{projection: ol.ProjectionLike}} * @typedef {{projection: ol.proj.ProjectionLike}}
*/ */
ol.parser.ReadFeaturesMetadata; ol.parser.ReadFeaturesMetadata;

View File

@@ -1,16 +1,10 @@
@exportClass ol.Projection ol.ProjectionOptions @exportClass ol.proj.Projection ol.ProjectionOptions
@exportProperty ol.Projection.prototype.getAxisOrientation @exportProperty ol.proj.Projection.prototype.getExtent
@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
@exportSymbol ol.ProjectionUnits @exportSymbol ol.proj.Units
@exportProperty ol.ProjectionUnits.DEGREES @exportProperty ol.proj.Units.DEGREES
@exportProperty ol.ProjectionUnits.FEET @exportProperty ol.proj.Units.FEET
@exportProperty ol.ProjectionUnits.METERS @exportProperty ol.proj.Units.METERS
@exportSymbol ol.proj.addProjection @exportSymbol ol.proj.addProjection
@exportSymbol ol.proj.get @exportSymbol ol.proj.get

View File

@@ -4,18 +4,18 @@ goog.provide('ol.proj.EPSG21781');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.math'); goog.require('goog.math');
goog.require('ol.Projection');
goog.require('ol.ProjectionUnits');
goog.require('ol.ellipsoid.BESSEL1841'); goog.require('ol.ellipsoid.BESSEL1841');
goog.require('ol.proj'); goog.require('ol.proj');
goog.require('ol.proj.EPSG4326'); goog.require('ol.proj.EPSG4326');
goog.require('ol.proj.Projection');
goog.require('ol.proj.Units');
/** /**
* Internal base class for Swiss grid projections. * Internal base class for Swiss grid projections.
* @constructor * @constructor
* @extends {ol.Projection} * @extends {ol.proj.Projection}
* @param {{code: string, extent: ol.Extent}} options Options. * @param {{code: string, extent: ol.Extent}} options Options.
*/ */
ol.proj.CH = function(options) { ol.proj.CH = function(options) {
@@ -23,10 +23,10 @@ ol.proj.CH = function(options) {
code: options.code, code: options.code,
extent: options.extent, extent: options.extent,
global: false, global: false,
units: ol.ProjectionUnits.METERS units: ol.proj.Units.METERS
}); });
}; };
goog.inherits(ol.proj.CH, ol.Projection); goog.inherits(ol.proj.CH, ol.proj.Projection);
/** /**

View File

@@ -2,27 +2,27 @@ goog.provide('ol.proj.EPSG3857');
goog.require('goog.array'); goog.require('goog.array');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('ol.Projection');
goog.require('ol.ProjectionUnits');
goog.require('ol.math'); goog.require('ol.math');
goog.require('ol.proj'); goog.require('ol.proj');
goog.require('ol.proj.Projection');
goog.require('ol.proj.Units');
/** /**
* @constructor * @constructor
* @extends {ol.Projection} * @extends {ol.proj.Projection}
* @param {string} code Code. * @param {string} code Code.
*/ */
ol.proj.EPSG3857 = function(code) { ol.proj.EPSG3857 = function(code) {
goog.base(this, { goog.base(this, {
code: code, code: code,
units: ol.ProjectionUnits.METERS, units: ol.proj.Units.METERS,
extent: ol.proj.EPSG3857.EXTENT, extent: ol.proj.EPSG3857.EXTENT,
global: true 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. * Projections equal to EPSG:3857.
* *
* @const * @const
* @type {Array.<ol.Projection>} * @type {Array.<ol.proj.Projection>}
*/ */
ol.proj.EPSG3857.PROJECTIONS = goog.array.map( ol.proj.EPSG3857.PROJECTIONS = goog.array.map(
ol.proj.EPSG3857.CODES, ol.proj.EPSG3857.CODES,

View File

@@ -1,27 +1,27 @@
goog.provide('ol.proj.EPSG4326'); goog.provide('ol.proj.EPSG4326');
goog.require('ol.Projection');
goog.require('ol.ProjectionUnits');
goog.require('ol.proj'); goog.require('ol.proj');
goog.require('ol.proj.Projection');
goog.require('ol.proj.Units');
/** /**
* @constructor * @constructor
* @extends {ol.Projection} * @extends {ol.proj.Projection}
* @param {string} code Code. * @param {string} code Code.
* @param {string=} opt_axisOrientation Axis orientation. * @param {string=} opt_axisOrientation Axis orientation.
*/ */
ol.proj.EPSG4326 = function(code, opt_axisOrientation) { ol.proj.EPSG4326 = function(code, opt_axisOrientation) {
goog.base(this, { goog.base(this, {
code: code, code: code,
units: ol.ProjectionUnits.DEGREES, units: ol.proj.Units.DEGREES,
extent: ol.proj.EPSG4326.EXTENT, extent: ol.proj.EPSG4326.EXTENT,
axisOrientation: opt_axisOrientation, axisOrientation: opt_axisOrientation,
global: true 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. * Projections equal to EPSG:4326.
* *
* @const * @const
* @type {Array.<ol.Projection>} * @type {Array.<ol.proj.Projection>}
*/ */
ol.proj.EPSG4326.PROJECTIONS = [ ol.proj.EPSG4326.PROJECTIONS = [
new ol.proj.EPSG4326('CRS:84'), new ol.proj.EPSG4326('CRS:84'),

View File

@@ -1,7 +1,7 @@
goog.provide('ol.Projection');
goog.provide('ol.ProjectionLike');
goog.provide('ol.ProjectionUnits');
goog.provide('ol.proj'); 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.array');
goog.require('goog.asserts'); goog.require('goog.asserts');
@@ -25,16 +25,17 @@ ol.HAVE_PROJ4JS = ol.ENABLE_PROJ4JS && typeof Proj4js == 'object';
/** /**
* A projection as {@link ol.Projection}, SRS identifier string or undefined. * A projection as {@link ol.proj.Projection}, SRS identifier string or
* @typedef {ol.Projection|string|undefined} ol.ProjectionLike * undefined.
* @typedef {ol.proj.Projection|string|undefined} ol.proj.ProjectionLike
*/ */
ol.ProjectionLike; ol.proj.ProjectionLike;
/** /**
* @enum {string} * @enum {string}
*/ */
ol.ProjectionUnits = { ol.proj.Units = {
DEGREES: 'degrees', DEGREES: 'degrees',
FEET: 'ft', FEET: 'ft',
METERS: 'm' METERS: 'm'
@@ -42,13 +43,13 @@ ol.ProjectionUnits = {
/** /**
* @const {Object.<ol.ProjectionUnits, number>} Meters per unit lookup table. * @const {Object.<ol.proj.Units, number>} Meters per unit lookup table.
*/ */
ol.METERS_PER_UNIT = {}; 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; 2 * Math.PI * ol.sphere.NORMAL.radius / 360;
ol.METERS_PER_UNIT[ol.ProjectionUnits.FEET] = 0.3048; ol.METERS_PER_UNIT[ol.proj.Units.FEET] = 0.3048;
ol.METERS_PER_UNIT[ol.ProjectionUnits.METERS] = 1; ol.METERS_PER_UNIT[ol.proj.Units.METERS] = 1;
@@ -56,7 +57,7 @@ ol.METERS_PER_UNIT[ol.ProjectionUnits.METERS] = 1;
* @constructor * @constructor
* @param {ol.ProjectionOptions} options Projection options. * @param {ol.ProjectionOptions} options Projection options.
*/ */
ol.Projection = function(options) { ol.proj.Projection = function(options) {
/** /**
* @private * @private
@@ -66,7 +67,7 @@ ol.Projection = function(options) {
/** /**
* @private * @private
* @type {ol.ProjectionUnits} * @type {ol.proj.Units}
*/ */
this.units_ = options.units; this.units_ = options.units;
@@ -102,7 +103,7 @@ ol.Projection = function(options) {
* Get the code for this projection, e.g. 'EPSG:4326'. * Get the code for this projection, e.g. 'EPSG:4326'.
* @return {string} Code. * @return {string} Code.
*/ */
ol.Projection.prototype.getCode = function() { ol.proj.Projection.prototype.getCode = function() {
return this.code_; return this.code_;
}; };
@@ -111,7 +112,7 @@ ol.Projection.prototype.getCode = function() {
* Get the validity extent for this projection. * Get the validity extent for this projection.
* @return {ol.Extent} Extent. * @return {ol.Extent} Extent.
*/ */
ol.Projection.prototype.getExtent = function() { ol.proj.Projection.prototype.getExtent = function() {
return this.extent_; return this.extent_;
}; };
@@ -126,14 +127,14 @@ ol.Projection.prototype.getExtent = function() {
* @param {ol.Coordinate} point Point. * @param {ol.Coordinate} point Point.
* @return {number} Point resolution. * @return {number} Point resolution.
*/ */
ol.Projection.prototype.getPointResolution = goog.abstractMethod; ol.proj.Projection.prototype.getPointResolution = goog.abstractMethod;
/** /**
* Get the units of this projection. * Get the units of this projection.
* @return {ol.ProjectionUnits} Units. * @return {ol.proj.Units} Units.
*/ */
ol.Projection.prototype.getUnits = function() { ol.proj.Projection.prototype.getUnits = function() {
return this.units_; return this.units_;
}; };
@@ -143,7 +144,7 @@ ol.Projection.prototype.getUnits = function() {
* not configured with a units identifier, the return is `undefined`. * not configured with a units identifier, the return is `undefined`.
* @return {number|undefined} Meters. * @return {number|undefined} Meters.
*/ */
ol.Projection.prototype.getMetersPerUnit = function() { ol.proj.Projection.prototype.getMetersPerUnit = function() {
return ol.METERS_PER_UNIT[this.units_]; return ol.METERS_PER_UNIT[this.units_];
}; };
@@ -158,7 +159,7 @@ ol.Projection.prototype.getMetersPerUnit = function() {
* "west positive" coordinate systems * "west positive" coordinate systems
* @return {string} Axis orientation. * @return {string} Axis orientation.
*/ */
ol.Projection.prototype.getAxisOrientation = function() { ol.proj.Projection.prototype.getAxisOrientation = function() {
return this.axisOrientation_; return this.axisOrientation_;
}; };
@@ -167,7 +168,7 @@ ol.Projection.prototype.getAxisOrientation = function() {
* Is this projection a global projection which spans the whole world? * Is this projection a global projection which spans the whole world?
* @return {boolean} Wether the projection is global. * @return {boolean} Wether the projection is global.
*/ */
ol.Projection.prototype.isGlobal = function() { ol.proj.Projection.prototype.isGlobal = function() {
return this.global_; return this.global_;
}; };
@@ -175,7 +176,7 @@ ol.Projection.prototype.isGlobal = function() {
/** /**
* @return {ol.tilegrid.TileGrid} The default tile grid. * @return {ol.tilegrid.TileGrid} The default tile grid.
*/ */
ol.Projection.prototype.getDefaultTileGrid = function() { ol.proj.Projection.prototype.getDefaultTileGrid = function() {
return this.defaultTileGrid_; return this.defaultTileGrid_;
}; };
@@ -183,7 +184,7 @@ ol.Projection.prototype.getDefaultTileGrid = function() {
/** /**
* @param {ol.tilegrid.TileGrid} tileGrid The default tile grid. * @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; this.defaultTileGrid_ = tileGrid;
}; };
@@ -191,14 +192,14 @@ ol.Projection.prototype.setDefaultTileGrid = function(tileGrid) {
/** /**
* @constructor * @constructor
* @extends {ol.Projection} * @extends {ol.proj.Projection}
* @param {Proj4js.Proj} proj4jsProj Proj4js projection. * @param {Proj4js.Proj} proj4jsProj Proj4js projection.
* @param {ol.Proj4jsProjectionOptions} options Proj4js projection options. * @param {ol.Proj4jsProjectionOptions} options Proj4js projection options.
* @private * @private
*/ */
ol.Proj4jsProjection_ = function(proj4jsProj, options) { 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} */ ({ var config = /** @type {ol.ProjectionOptions} */ ({
units: units, units: units,
@@ -221,7 +222,7 @@ ol.Proj4jsProjection_ = function(proj4jsProj, options) {
this.toEPSG4326_ = null; this.toEPSG4326_ = null;
}; };
goog.inherits(ol.Proj4jsProjection_, ol.Projection); goog.inherits(ol.Proj4jsProjection_, ol.proj.Projection);
/** /**
@@ -241,7 +242,7 @@ ol.Proj4jsProjection_.prototype.getMetersPerUnit = function() {
*/ */
ol.Proj4jsProjection_.prototype.getPointResolution = ol.Proj4jsProjection_.prototype.getPointResolution =
function(resolution, point) { function(resolution, point) {
if (this.getUnits() == ol.ProjectionUnits.DEGREES) { if (this.getUnits() == ol.proj.Units.DEGREES) {
return resolution; return resolution;
} else { } else {
// Estimate point resolution by transforming the center pixel to EPSG:4326, // Estimate point resolution by transforming the center pixel to EPSG:4326,
@@ -266,7 +267,7 @@ ol.Proj4jsProjection_.prototype.getPointResolution =
var height = ol.sphere.NORMAL.haversineDistance( var height = ol.sphere.NORMAL.haversineDistance(
vertices.slice(4, 6), vertices.slice(6, 8)); vertices.slice(4, 6), vertices.slice(6, 8));
var pointResolution = (width + height) / 2; 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 // The radius of the normal sphere is defined in meters, so we must
// convert back to feet. // convert back to feet.
pointResolution /= 0.3048; pointResolution /= 0.3048;
@@ -293,7 +294,7 @@ ol.proj.proj4jsProjections_ = {};
/** /**
* @private * @private
* @type {Object.<string, ol.Projection>} * @type {Object.<string, ol.proj.Projection>}
*/ */
ol.proj.projections_ = {}; ol.proj.projections_ = {};
@@ -309,7 +310,7 @@ ol.proj.transforms_ = {};
* Registers transformation functions that don't alter coordinates. Those allow * Registers transformation functions that don't alter coordinates. Those allow
* to transform between projections with equal meaning. * to transform between projections with equal meaning.
* *
* @param {Array.<ol.Projection>} projections Projections. * @param {Array.<ol.proj.Projection>} projections Projections.
*/ */
ol.proj.addEquivalentProjections = function(projections) { ol.proj.addEquivalentProjections = function(projections) {
ol.proj.addProjections(projections); ol.proj.addProjections(projections);
@@ -327,8 +328,10 @@ ol.proj.addEquivalentProjections = function(projections) {
* Registers transformation functions to convert coordinates in any projection * Registers transformation functions to convert coordinates in any projection
* in projection1 to any projection in projection2. * in projection1 to any projection in projection2.
* *
* @param {Array.<ol.Projection>} projections1 Projections with equal meaning. * @param {Array.<ol.proj.Projection>} projections1 Projections with equal
* @param {Array.<ol.Projection>} projections2 Projections with equal meaning. * meaning.
* @param {Array.<ol.proj.Projection>} projections2 Projections with equal
* meaning.
* @param {ol.TransformFunction} forwardTransform Transformation from any * @param {ol.TransformFunction} forwardTransform Transformation from any
* projection in projection1 to any projection in projection2. * projection in projection1 to any projection in projection2.
* @param {ol.TransformFunction} inverseTransform Transform from any projection * @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) { ol.proj.addProjection = function(projection) {
var projections = ol.proj.projections_; var projections = ol.proj.projections_;
@@ -369,7 +372,7 @@ ol.proj.addProjection = function(projection) {
/** /**
* @param {Array.<ol.Projection>} projections Projections. * @param {Array.<ol.proj.Projection>} projections Projections.
*/ */
ol.proj.addProjections = function(projections) { ol.proj.addProjections = function(projections) {
goog.array.forEach(projections, function(projection) { 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. * @param {string} defaultCode Default code.
* @return {ol.Projection} Projection. * @return {ol.proj.Projection} Projection.
*/ */
ol.proj.createProjection = function(projection, defaultCode) { ol.proj.createProjection = function(projection, defaultCode) {
if (!goog.isDefAndNotNull(projection)) { if (!goog.isDefAndNotNull(projection)) {
@@ -401,7 +404,7 @@ ol.proj.createProjection = function(projection, defaultCode) {
} else if (goog.isString(projection)) { } else if (goog.isString(projection)) {
return ol.proj.get(projection); return ol.proj.get(projection);
} else { } else {
goog.asserts.assertInstanceof(projection, ol.Projection); goog.asserts.assertInstanceof(projection, ol.proj.Projection);
return projection; return projection;
} }
}; };
@@ -411,8 +414,8 @@ ol.proj.createProjection = function(projection, defaultCode) {
* Registers a conversion function to convert coordinates from the source * Registers a conversion function to convert coordinates from the source
* projection to the destination projection. * projection to the destination projection.
* *
* @param {ol.Projection} source Source. * @param {ol.proj.Projection} source Source.
* @param {ol.Projection} destination Destination. * @param {ol.proj.Projection} destination Destination.
* @param {ol.TransformFunction} transformFn Transform. * @param {ol.TransformFunction} transformFn Transform.
*/ */
ol.proj.addTransform = function(source, destination, transformFn) { 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 * projection to the destination projection. This method is used to clean up
* cached transforms during testing. * cached transforms during testing.
* *
* @param {ol.Projection} source Source projection. * @param {ol.proj.Projection} source Source projection.
* @param {ol.Projection} destination Destination projection. * @param {ol.proj.Projection} destination Destination projection.
* @return {ol.TransformFunction} transformFn The unregistered transform. * @return {ol.TransformFunction} transformFn The unregistered transform.
*/ */
ol.proj.removeTransform = function(source, destination) { ol.proj.removeTransform = function(source, destination) {
@@ -452,14 +455,14 @@ ol.proj.removeTransform = function(source, destination) {
/** /**
* @param {ol.ProjectionLike} projectionLike Either a code string which is a * @param {ol.proj.ProjectionLike} projectionLike Either a code string which is
* combination of authority and identifier such as "EPSG:4326", or an * a combination of authority and identifier such as "EPSG:4326", or an
* existing projection object, or undefined. * existing projection object, or undefined.
* @return {ol.Projection} Projection. * @return {ol.proj.Projection} Projection.
*/ */
ol.proj.get = function(projectionLike) { ol.proj.get = function(projectionLike) {
var projection; var projection;
if (projectionLike instanceof ol.Projection) { if (projectionLike instanceof ol.proj.Projection) {
projection = projectionLike; projection = projectionLike;
} else if (goog.isString(projectionLike)) { } else if (goog.isString(projectionLike)) {
var code = 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 * projection does represent the same geographic point as the same coordinate in
* the other projection. * the other projection.
* *
* @param {ol.Projection} projection1 Projection 1. * @param {ol.proj.Projection} projection1 Projection 1.
* @param {ol.Projection} projection2 Projection 2. * @param {ol.proj.Projection} projection2 Projection 2.
* @return {boolean} Equivalent. * @return {boolean} Equivalent.
*/ */
ol.proj.equivalent = function(projection1, projection2) { ol.proj.equivalent = function(projection1, projection2) {
@@ -534,8 +537,8 @@ ol.proj.equivalent = function(projection1, projection2) {
* function to convert a coordinates array from the source projection to the * function to convert a coordinates array from the source projection to the
* destination projection. * destination projection.
* *
* @param {ol.ProjectionLike} source Source. * @param {ol.proj.ProjectionLike} source Source.
* @param {ol.ProjectionLike} destination Destination. * @param {ol.proj.ProjectionLike} destination Destination.
* @return {ol.TransformFunction} Transform. * @return {ol.TransformFunction} Transform.
*/ */
ol.proj.getTransform = function(source, destination) { ol.proj.getTransform = function(source, destination) {
@@ -550,8 +553,8 @@ ol.proj.getTransform = function(source, destination) {
* Searches a function that can be used to convert coordinates from the source * Searches a function that can be used to convert coordinates from the source
* projection to the destination projection. * projection to the destination projection.
* *
* @param {ol.Projection} sourceProjection Source projection. * @param {ol.proj.Projection} sourceProjection Source projection.
* @param {ol.Projection} destinationProjection Destination projection. * @param {ol.proj.Projection} destinationProjection Destination projection.
* @return {ol.TransformFunction} Transform. * @return {ol.TransformFunction} Transform.
*/ */
ol.proj.getTransformFromProjections = ol.proj.getTransformFromProjections =
@@ -669,8 +672,8 @@ ol.proj.cloneTransform = function(input, opt_output, opt_dimension) {
/** /**
* @param {ol.Coordinate} point Point. * @param {ol.Coordinate} point Point.
* @param {ol.ProjectionLike} source Source. * @param {ol.proj.ProjectionLike} source Source.
* @param {ol.ProjectionLike} destination Destination. * @param {ol.proj.ProjectionLike} destination Destination.
* @return {ol.Coordinate} Point. * @return {ol.Coordinate} Point.
*/ */
ol.proj.transform = function(point, source, destination) { ol.proj.transform = function(point, source, destination) {
@@ -683,8 +686,8 @@ ol.proj.transform = function(point, source, destination) {
* Transforms the given point to the destination projection. * Transforms the given point to the destination projection.
* *
* @param {ol.Coordinate} point Point. * @param {ol.Coordinate} point Point.
* @param {ol.Projection} sourceProjection Source projection. * @param {ol.proj.Projection} sourceProjection Source projection.
* @param {ol.Projection} destinationProjection Destination projection. * @param {ol.proj.Projection} destinationProjection Destination projection.
* @return {ol.Coordinate} Point. * @return {ol.Coordinate} Point.
*/ */
ol.proj.transformWithProjections = ol.proj.transformWithProjections =
@@ -697,7 +700,7 @@ ol.proj.transformWithProjections =
/** /**
* @param {ol.Proj4jsProjectionOptions} options Proj4js projection options. * @param {ol.Proj4jsProjectionOptions} options Proj4js projection options.
* @return {ol.Projection} Proj4js projection. * @return {ol.proj.Projection} Proj4js projection.
*/ */
ol.proj.configureProj4jsProjection = function(options) { ol.proj.configureProj4jsProjection = function(options) {
goog.asserts.assert(!goog.object.containsKey( goog.asserts.assert(!goog.object.containsKey(

View File

@@ -196,7 +196,7 @@ ol.renderer.Layer.prototype.updateUsedTiles =
* @param {function(ol.Tile): boolean} isLoadedFunction Function to * @param {function(ol.Tile): boolean} isLoadedFunction Function to
* determine if the tile is loaded. * determine if the tile is loaded.
* @param {ol.source.Tile} tileSource Tile source. * @param {ol.source.Tile} tileSource Tile source.
* @param {ol.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @protected * @protected
* @return {function(number, number, number): ol.Tile} Returns a tile if it is * @return {function(number, number, number): ol.Tile} Returns a tile if it is
* loaded. * loaded.
@@ -243,7 +243,7 @@ ol.renderer.Layer.prototype.snapCenterToPixel =
* @param {ol.FrameState} frameState Frame state. * @param {ol.FrameState} frameState Frame state.
* @param {ol.source.Tile} tileSource Tile source. * @param {ol.source.Tile} tileSource Tile source.
* @param {ol.tilegrid.TileGrid} tileGrid Tile grid. * @param {ol.tilegrid.TileGrid} tileGrid Tile grid.
* @param {ol.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @param {number} currentZ Current Z. * @param {number} currentZ Current Z.
* @param {number} preload Load low resolution tiles up to 'preload' levels. * @param {number} preload Load low resolution tiles up to 'preload' levels.

View File

@@ -90,7 +90,7 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse =
/** /**
* @this {ol.source.BingMaps} * @this {ol.source.BingMaps}
* @param {ol.TileCoord} tileCoord Tile coordinate. * @param {ol.TileCoord} tileCoord Tile coordinate.
* @param {ol.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @return {string|undefined} Tile URL. * @return {string|undefined} Tile URL.
*/ */
function(tileCoord, projection) { function(tileCoord, projection) {

View File

@@ -7,7 +7,6 @@ goog.require('ol.Extent');
goog.require('ol.Image'); goog.require('ol.Image');
goog.require('ol.ImageUrlFunction'); goog.require('ol.ImageUrlFunction');
goog.require('ol.ImageUrlFunctionType'); goog.require('ol.ImageUrlFunctionType');
goog.require('ol.Projection');
goog.require('ol.Size'); goog.require('ol.Size');
goog.require('ol.array'); goog.require('ol.array');
goog.require('ol.source.Source'); goog.require('ol.source.Source');
@@ -18,7 +17,7 @@ goog.require('ol.source.Source');
* crossOrigin: (null|string|undefined), * crossOrigin: (null|string|undefined),
* extent: (null|ol.Extent|undefined), * extent: (null|ol.Extent|undefined),
* logo: (string|undefined), * logo: (string|undefined),
* projection: ol.ProjectionLike, * projection: ol.proj.ProjectionLike,
* resolutions: (Array.<number>|undefined), * resolutions: (Array.<number>|undefined),
* imageUrlFunction: (ol.ImageUrlFunctionType| * imageUrlFunction: (ol.ImageUrlFunctionType|
* undefined)}} * undefined)}}
@@ -78,7 +77,7 @@ goog.inherits(ol.source.Image, ol.source.Source);
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @param {number} resolution Resolution. * @param {number} resolution Resolution.
* @param {ol.Size} size Size. * @param {ol.Size} size Size.
* @param {ol.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @return {ol.Image} Single image. * @return {ol.Image} Single image.
*/ */
ol.source.Image.prototype.createImage = ol.source.Image.prototype.createImage =
@@ -112,7 +111,7 @@ ol.source.Image.prototype.findNearestResolution =
/** /**
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @param {number} resolution Resolution. * @param {number} resolution Resolution.
* @param {ol.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @return {ol.Image} Single image. * @return {ol.Image} Single image.
*/ */
ol.source.Image.prototype.getImage = goog.abstractMethod; ol.source.Image.prototype.getImage = goog.abstractMethod;

View File

@@ -64,7 +64,7 @@ ol.source.ImageStatic.createImageFunction = function(url) {
/** /**
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @param {ol.Size} size Size. * @param {ol.Size} size Size.
* @param {ol.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @return {string|undefined} URL. * @return {string|undefined} URL.
*/ */
function(extent, size, projection) { function(extent, size, projection) {

View File

@@ -20,7 +20,7 @@ ol.source.Source = function(options) {
/** /**
* @private * @private
* @type {ol.Projection} * @type {ol.proj.Projection}
*/ */
this.projection_ = ol.proj.get(options.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() { ol.source.Source.prototype.getProjection = function() {
return this.projection_; 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) { ol.source.Source.prototype.setProjection = function(projection) {
this.projection_ = projection; this.projection_ = projection;

View File

@@ -4,7 +4,6 @@ goog.require('goog.asserts');
goog.require('ol.Attribution'); goog.require('ol.Attribution');
goog.require('ol.Extent'); goog.require('ol.Extent');
goog.require('ol.ImageTile'); goog.require('ol.ImageTile');
goog.require('ol.Projection');
goog.require('ol.Tile'); goog.require('ol.Tile');
goog.require('ol.TileCache'); goog.require('ol.TileCache');
goog.require('ol.TileCoord'); goog.require('ol.TileCoord');
@@ -21,7 +20,7 @@ goog.require('ol.tilegrid.TileGrid');
* extent: (ol.Extent|undefined), * extent: (ol.Extent|undefined),
* logo: (string|undefined), * logo: (string|undefined),
* opaque: (boolean|undefined), * opaque: (boolean|undefined),
* projection: ol.ProjectionLike, * projection: ol.proj.ProjectionLike,
* tileGrid: (ol.tilegrid.TileGrid|undefined), * tileGrid: (ol.tilegrid.TileGrid|undefined),
* tileUrlFunction: (ol.TileUrlFunctionType|undefined)}} * tileUrlFunction: (ol.TileUrlFunctionType|undefined)}}
*/ */

View File

@@ -16,7 +16,7 @@ goog.require('ol.tilegrid.TileGrid');
* extent: (ol.Extent|undefined), * extent: (ol.Extent|undefined),
* logo: (string|undefined), * logo: (string|undefined),
* opaque: (boolean|undefined), * opaque: (boolean|undefined),
* projection: ol.ProjectionLike, * projection: ol.proj.ProjectionLike,
* tileGrid: (ol.tilegrid.TileGrid|undefined)}} * tileGrid: (ol.tilegrid.TileGrid|undefined)}}
*/ */
ol.source.TileOptions; ol.source.TileOptions;
@@ -136,7 +136,7 @@ ol.source.Tile.prototype.getResolutions = function() {
* @param {number} z Tile coordinate z. * @param {number} z Tile coordinate z.
* @param {number} x Tile coordinate x. * @param {number} x Tile coordinate x.
* @param {number} y Tile coordinate y. * @param {number} y Tile coordinate y.
* @param {ol.Projection=} opt_projection Projection. * @param {ol.proj.Projection=} opt_projection Projection.
* @return {!ol.Tile} Tile. * @return {!ol.Tile} Tile.
*/ */
ol.source.Tile.prototype.getTile = goog.abstractMethod; ol.source.Tile.prototype.getTile = goog.abstractMethod;

View File

@@ -61,7 +61,7 @@ goog.inherits(ol.source.Vector, ol.source.Source);
/** /**
* @param {ol.layer.Vector} layer Layer that parses the data. * @param {ol.layer.Vector} layer Layer that parses the data.
* @param {ol.Extent} extent Extent that needs to be fetched. * @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 * @param {function()=} opt_callback Callback which is called when features are
* parsed after loading. * parsed after loading.
* @return {ol.source.VectorLoadState} The current load state. * @return {ol.source.VectorLoadState} The current load state.

View File

@@ -29,7 +29,7 @@ ol.source.WMSGetFeatureInfoMethod = {
* @param {Object.<string, string|number>} params Request parameters. * @param {Object.<string, string|number>} params Request parameters.
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @param {ol.Size} size Size. * @param {ol.Size} size Size.
* @param {ol.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @return {string} WMS GetMap request URL. * @return {string} WMS GetMap request URL.
*/ */
ol.source.wms.getUrl = ol.source.wms.getUrl =

View File

@@ -95,7 +95,7 @@ ol.source.WMTS = function(options) {
/** /**
* @this {ol.source.WMTS} * @this {ol.source.WMTS}
* @param {ol.TileCoord} tileCoord Tile coordinate. * @param {ol.TileCoord} tileCoord Tile coordinate.
* @param {ol.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @return {string|undefined} Tile URL. * @return {string|undefined} Tile URL.
*/ */
function(tileCoord, projection) { function(tileCoord, projection) {
@@ -136,7 +136,7 @@ ol.source.WMTS = function(options) {
tileUrlFunction = ol.TileUrlFunction.withTileCoordTransform( tileUrlFunction = ol.TileUrlFunction.withTileCoordTransform(
/** /**
* @param {ol.TileCoord} tileCoord Tile coordinate. * @param {ol.TileCoord} tileCoord Tile coordinate.
* @param {ol.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @param {ol.TileCoord=} opt_tileCoord Tile coordinate. * @param {ol.TileCoord=} opt_tileCoord Tile coordinate.
* @return {ol.TileCoord} Tile coordinate. * @return {ol.TileCoord} Tile coordinate.
*/ */

View File

@@ -3,13 +3,13 @@ goog.provide('ol.tilegrid.TileGrid');
goog.require('goog.array'); goog.require('goog.array');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('ol.Coordinate'); goog.require('ol.Coordinate');
goog.require('ol.Projection');
goog.require('ol.ProjectionUnits');
goog.require('ol.Size'); goog.require('ol.Size');
goog.require('ol.TileCoord'); goog.require('ol.TileCoord');
goog.require('ol.TileRange'); goog.require('ol.TileRange');
goog.require('ol.array'); goog.require('ol.array');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.proj.Projection');
goog.require('ol.proj.Units');
/** /**
@@ -106,8 +106,8 @@ ol.tilegrid.TileGrid.tmpTileCoord_ = new ol.TileCoord(0, 0, 0);
/** /**
* @param {{extent: (ol.Extent|undefined), * @param {{extent: (ol.Extent|undefined),
* wrapX: (boolean|undefined)}=} opt_options Options. * wrapX: (boolean|undefined)}=} opt_options Options.
* @return {function(ol.TileCoord, ol.Projection, ol.TileCoord=): ol.TileCoord} * @return {function(ol.TileCoord, ol.proj.Projection, ol.TileCoord=):
* Tile coordinate transform. * ol.TileCoord} Tile coordinate transform.
*/ */
ol.tilegrid.TileGrid.prototype.createTileCoordTransform = goog.abstractMethod; 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. * @return {ol.tilegrid.TileGrid} Default tile grid for the passed projection.
*/ */
ol.tilegrid.getForProjection = function(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 {number=} opt_maxZoom Maximum zoom level.
* @param {ol.Size=} opt_tileSize Tile size. * @param {ol.Size=} opt_tileSize Tile size.
* @return {ol.tilegrid.TileGrid} TileGrid instance. * @return {ol.tilegrid.TileGrid} TileGrid instance.
@@ -412,7 +412,7 @@ ol.tilegrid.createForProjection =
function(projection, opt_maxZoom, opt_tileSize) { function(projection, opt_maxZoom, opt_tileSize) {
var projectionExtent = projection.getExtent(); var projectionExtent = projection.getExtent();
var size = goog.isNull(projectionExtent) ? var size = goog.isNull(projectionExtent) ?
360 * ol.METERS_PER_UNIT[ol.ProjectionUnits.DEGREES] / 360 * ol.METERS_PER_UNIT[ol.proj.Units.DEGREES] /
projection.getMetersPerUnit() : projection.getMetersPerUnit() :
Math.max(projectionExtent[2] - projectionExtent[0], Math.max(projectionExtent[2] - projectionExtent[0],
projectionExtent[3] - projectionExtent[1]); projectionExtent[3] - projectionExtent[1]);

View File

@@ -59,7 +59,7 @@ ol.tilegrid.XYZ.prototype.createTileCoordTransform = function(opt_options) {
return ( return (
/** /**
* @param {ol.TileCoord} tileCoord Tile coordinate. * @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. * @param {ol.TileCoord=} opt_tileCoord Destination tile coordinate.
* @return {ol.TileCoord} Tile coordinate. * @return {ol.TileCoord} Tile coordinate.
*/ */

View File

@@ -9,13 +9,14 @@ goog.require('ol.extent');
/** /**
* @typedef {function(this: ol.source.TileImage, ol.TileCoord, * @typedef {function(this: ol.source.TileImage, ol.TileCoord,
* ol.Projection): (string|undefined)} * ol.proj.Projection): (string|undefined)}
*/ */
ol.TileUrlFunctionType; 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; ol.TileCoordTransformType;
@@ -29,7 +30,7 @@ ol.TileUrlFunction.createFromTemplate = function(template) {
/** /**
* @this {ol.source.TileImage} * @this {ol.source.TileImage}
* @param {ol.TileCoord} tileCoord Tile Coordinate. * @param {ol.TileCoord} tileCoord Tile Coordinate.
* @param {ol.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @return {string|undefined} Tile URL. * @return {string|undefined} Tile URL.
*/ */
function(tileCoord, projection) { function(tileCoord, projection) {
@@ -66,7 +67,7 @@ ol.TileUrlFunction.createFromTileUrlFunctions = function(tileUrlFunctions) {
/** /**
* @this {ol.source.TileImage} * @this {ol.source.TileImage}
* @param {ol.TileCoord} tileCoord Tile Coordinate. * @param {ol.TileCoord} tileCoord Tile Coordinate.
* @param {ol.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @return {string|undefined} Tile URL. * @return {string|undefined} Tile URL.
*/ */
function(tileCoord, projection) { function(tileCoord, projection) {
@@ -85,7 +86,7 @@ ol.TileUrlFunction.createFromTileUrlFunctions = function(tileUrlFunctions) {
* @param {string} baseUrl Base URL (may have query data). * @param {string} baseUrl Base URL (may have query data).
* @param {Object.<string,*>} params to encode in the url. * @param {Object.<string,*>} params to encode in the url.
* @param {function(this: ol.source.TileImage, string, Object.<string,*>, * @param {function(this: ol.source.TileImage, string, Object.<string,*>,
* 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. * @return {ol.TileUrlFunctionType} Tile URL function.
*/ */
ol.TileUrlFunction.createFromParamsFunction = ol.TileUrlFunction.createFromParamsFunction =
@@ -95,7 +96,7 @@ ol.TileUrlFunction.createFromParamsFunction =
/** /**
* @this {ol.source.TileImage} * @this {ol.source.TileImage}
* @param {ol.TileCoord} tileCoord Tile Coordinate. * @param {ol.TileCoord} tileCoord Tile Coordinate.
* @param {ol.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @return {string|undefined} Tile URL. * @return {string|undefined} Tile URL.
*/ */
function(tileCoord, projection) { function(tileCoord, projection) {
@@ -118,7 +119,7 @@ ol.TileUrlFunction.createFromParamsFunction =
/** /**
* @this {ol.source.TileImage} * @this {ol.source.TileImage}
* @param {ol.TileCoord} tileCoord Tile coordinate. * @param {ol.TileCoord} tileCoord Tile coordinate.
* @param {ol.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @return {string|undefined} Tile URL. * @return {string|undefined} Tile URL.
*/ */
ol.TileUrlFunction.nullTileUrlFunction = function(tileCoord, projection) { ol.TileUrlFunction.nullTileUrlFunction = function(tileCoord, projection) {
@@ -138,7 +139,7 @@ ol.TileUrlFunction.withTileCoordTransform =
/** /**
* @this {ol.source.TileImage} * @this {ol.source.TileImage}
* @param {ol.TileCoord} tileCoord Tile Coordinate. * @param {ol.TileCoord} tileCoord Tile Coordinate.
* @param {ol.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @return {string|undefined} Tile URL. * @return {string|undefined} Tile URL.
*/ */
function(tileCoord, projection) { function(tileCoord, projection) {

View File

@@ -7,8 +7,6 @@ goog.require('goog.asserts');
goog.require('ol.Constraints'); goog.require('ol.Constraints');
goog.require('ol.IView2D'); goog.require('ol.IView2D');
goog.require('ol.IView3D'); goog.require('ol.IView3D');
goog.require('ol.Projection');
goog.require('ol.ProjectionUnits');
goog.require('ol.ResolutionConstraint'); goog.require('ol.ResolutionConstraint');
goog.require('ol.RotationConstraint'); goog.require('ol.RotationConstraint');
goog.require('ol.RotationConstraintType'); goog.require('ol.RotationConstraintType');
@@ -17,6 +15,8 @@ goog.require('ol.View');
goog.require('ol.coordinate'); goog.require('ol.coordinate');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.proj'); goog.require('ol.proj');
goog.require('ol.proj.Projection');
goog.require('ol.proj.Units');
/** /**
@@ -234,7 +234,7 @@ ol.View2D.prototype.calculateExtent = function(size) {
* @inheritDoc * @inheritDoc
*/ */
ol.View2D.prototype.getProjection = function() { ol.View2D.prototype.getProjection = function() {
return /** @type {ol.Projection|undefined} */ ( return /** @type {ol.proj.Projection|undefined} */ (
this.get(ol.View2DProperty.PROJECTION)); this.get(ol.View2DProperty.PROJECTION));
}; };
goog.exportProperty( goog.exportProperty(
@@ -425,7 +425,7 @@ goog.exportProperty(
/** /**
* Set the projection of this view. * 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) { ol.View2D.prototype.setProjection = function(projection) {
this.set(ol.View2DProperty.PROJECTION, projection); this.set(ol.View2DProperty.PROJECTION, projection);
@@ -496,7 +496,7 @@ ol.View2D.createResolutionConstraint_ = function(options) {
.getExtent(); .getExtent();
var size = goog.isNull(projectionExtent) ? var size = goog.isNull(projectionExtent) ?
// use an extent that can fit the whole world if need be // 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()] : ol.METERS_PER_UNIT[projection.getUnits()] :
Math.max(projectionExtent[2] - projectionExtent[0], Math.max(projectionExtent[2] - projectionExtent[0],
projectionExtent[3] - projectionExtent[1]); projectionExtent[3] - projectionExtent[1]);

View File

@@ -47,7 +47,7 @@ describe('ol.proj.EPSG2056', function() {
beforeEach(function() { beforeEach(function() {
ol.proj.EPSG2056.add(); ol.proj.EPSG2056.add();
epsg2056 = ol.proj.get('EPSG:2056'); 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() { it('transforms from EPSG:2056 to EPSG:4326', function() {
@@ -82,7 +82,7 @@ describe('ol.proj.EPSG21781', function() {
beforeEach(function() { beforeEach(function() {
ol.proj.EPSG21781.add(); ol.proj.EPSG21781.add();
epsg21781 = ol.proj.get('EPSG:21781'); 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() { it('maintains accuracy when round-tripping', function() {
@@ -127,8 +127,8 @@ describe('ol.proj.EPSG21781', function() {
goog.require('goog.math'); goog.require('goog.math');
goog.require('ol.Projection');
goog.require('ol.proj'); goog.require('ol.proj');
goog.require('ol.proj.CH'); goog.require('ol.proj.CH');
goog.require('ol.proj.EPSG2056'); goog.require('ol.proj.EPSG2056');
goog.require('ol.proj.EPSG21781'); goog.require('ol.proj.EPSG21781');
goog.require('ol.proj.Projection');

View File

@@ -272,15 +272,15 @@ describe('ol.proj', function() {
describe('ol.proj.removeTransform()', function() { describe('ol.proj.removeTransform()', function() {
var extent = [180, -90, 180, 90]; var extent = [180, -90, 180, 90];
var units = ol.ProjectionUnits.DEGREES; var units = ol.proj.Units.DEGREES;
it('removes functions cached by addTransform', function() { it('removes functions cached by addTransform', function() {
var foo = new ol.Projection({ var foo = new ol.proj.Projection({
code: 'foo', code: 'foo',
units: units, units: units,
extent: extent extent: extent
}); });
var bar = new ol.Projection({ var bar = new ol.proj.Projection({
code: 'bar', code: 'bar',
units: units, units: units,
extent: extent 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() { beforeEach(function() {
Proj4js.defs['EPSG:26782'] = Proj4js.defs['EPSG:26782'] =
@@ -341,7 +341,7 @@ describe('ol.proj', function() {
}); });
expect(epsg21781.getCode()).to.eql('EPSG:21781'); expect(epsg21781.getCode()).to.eql('EPSG:21781');
expect(epsg21781.getExtent()).to.be(extent); 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(); expect(epsg21781.isGlobal()).to.not.be();
}); });
@@ -351,7 +351,7 @@ describe('ol.proj', function() {
goog.require('goog.array'); goog.require('goog.array');
goog.require('ol.Projection');
goog.require('ol.ProjectionUnits');
goog.require('ol.proj'); goog.require('ol.proj');
goog.require('ol.proj.Projection');
goog.require('ol.proj.Units');
goog.require('ol.proj.common'); goog.require('ol.proj.common');

View File

@@ -191,12 +191,12 @@ describe('ol.tilegrid.TileGrid', function() {
}); });
it('works for projections unknown to the client', 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'}); {code: 'EPSG:31287', units: 'm'});
var grid = ol.tilegrid.createForProjection(projection); var grid = ol.tilegrid.createForProjection(projection);
var resolutions = grid.getResolutions(); var resolutions = grid.getResolutions();
expect(resolutions[5]).to.be( 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)); ol.DEFAULT_TILE_SIZE / Math.pow(2, 5));
}); });
@@ -643,8 +643,8 @@ describe('ol.tilegrid.TileGrid', function() {
}); });
goog.require('ol.Coordinate'); goog.require('ol.Coordinate');
goog.require('ol.Projection');
goog.require('ol.ProjectionUnits');
goog.require('ol.TileCoord'); goog.require('ol.TileCoord');
goog.require('ol.proj'); goog.require('ol.proj');
goog.require('ol.proj.Projection');
goog.require('ol.proj.Units');
goog.require('ol.tilegrid.TileGrid'); goog.require('ol.tilegrid.TileGrid');