Merge pull request #272 from twpayne/projection-get
allow people to specify projection as a string
This commit is contained in:
@@ -25,7 +25,7 @@ var map = new ol.Map({
|
|||||||
// Vienna label
|
// Vienna label
|
||||||
var vienna = new ol.AnchoredElement({
|
var vienna = new ol.AnchoredElement({
|
||||||
map: map,
|
map: map,
|
||||||
position: ol.projection.transformWithCodes(
|
position: ol.projection.transform(
|
||||||
new ol.Coordinate(16.3725, 48.208889), 'EPSG:4326', 'EPSG:3857'),
|
new ol.Coordinate(16.3725, 48.208889), 'EPSG:4326', 'EPSG:3857'),
|
||||||
element: document.getElementById('vienna')
|
element: document.getElementById('vienna')
|
||||||
});
|
});
|
||||||
@@ -39,7 +39,7 @@ map.addEventListener('click', function(evt) {
|
|||||||
var coordinate = evt.getCoordinate();
|
var coordinate = evt.getCoordinate();
|
||||||
popup.getElement().innerHTML =
|
popup.getElement().innerHTML =
|
||||||
'Welcome to ol3. The location you clicked was<br>' +
|
'Welcome to ol3. The location you clicked was<br>' +
|
||||||
ol.Coordinate.toStringHDMS(ol.projection.transformWithCodes(
|
ol.Coordinate.toStringHDMS(ol.projection.transform(
|
||||||
coordinate, 'EPSG:3857', 'EPSG:4326'));
|
coordinate, 'EPSG:3857', 'EPSG:4326'));
|
||||||
popup.setPosition(coordinate);
|
popup.setPosition(coordinate);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,15 +9,15 @@ goog.require('ol.projection');
|
|||||||
goog.require('ol.source.OpenStreetMap');
|
goog.require('ol.source.OpenStreetMap');
|
||||||
|
|
||||||
|
|
||||||
var london = ol.projection.transformWithCodes(
|
var london = ol.projection.transform(
|
||||||
new ol.Coordinate(-0.12755, 51.507222), 'EPSG:4326', 'EPSG:3857');
|
new ol.Coordinate(-0.12755, 51.507222), 'EPSG:4326', 'EPSG:3857');
|
||||||
var moscow = ol.projection.transformWithCodes(
|
var moscow = ol.projection.transform(
|
||||||
new ol.Coordinate(37.6178, 55.7517), 'EPSG:4326', 'EPSG:3857');
|
new ol.Coordinate(37.6178, 55.7517), 'EPSG:4326', 'EPSG:3857');
|
||||||
var instanbul = ol.projection.transformWithCodes(
|
var instanbul = ol.projection.transform(
|
||||||
new ol.Coordinate(28.9744, 41.0128), 'EPSG:4326', 'EPSG:3857');
|
new ol.Coordinate(28.9744, 41.0128), 'EPSG:4326', 'EPSG:3857');
|
||||||
var rome = ol.projection.transformWithCodes(
|
var rome = ol.projection.transform(
|
||||||
new ol.Coordinate(12.5, 41.9), 'EPSG:4326', 'EPSG:3857');
|
new ol.Coordinate(12.5, 41.9), 'EPSG:4326', 'EPSG:3857');
|
||||||
var bern = ol.projection.transformWithCodes(
|
var bern = ol.projection.transform(
|
||||||
new ol.Coordinate(7.4458, 46.95), 'EPSG:4326', 'EPSG:3857');
|
new ol.Coordinate(7.4458, 46.95), 'EPSG:4326', 'EPSG:3857');
|
||||||
|
|
||||||
var map = new ol.Map({
|
var map = new ol.Map({
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ var map = new ol.Map({
|
|||||||
renderers: ol.RendererHints.createFromQueryData(),
|
renderers: ol.RendererHints.createFromQueryData(),
|
||||||
target: 'map',
|
target: 'map',
|
||||||
view: new ol.View2D({
|
view: new ol.View2D({
|
||||||
center: ol.projection.transformWithCodes(
|
center: ol.projection.transform(
|
||||||
new ol.Coordinate(-123.1, 49.25), 'EPSG:4326', 'EPSG:3857'),
|
new ol.Coordinate(-123.1, 49.25), 'EPSG:4326', 'EPSG:3857'),
|
||||||
zoom: 8
|
zoom: 8
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ var layers = [
|
|||||||
}),
|
}),
|
||||||
new ol.layer.TileLayer({
|
new ol.layer.TileLayer({
|
||||||
source: new ol.source.DebugTileSource({
|
source: new ol.source.DebugTileSource({
|
||||||
projection: ol.projection.getFromCode('EPSG:3857'),
|
projection: 'EPSG:3857',
|
||||||
tileGrid: new ol.tilegrid.XYZ({
|
tileGrid: new ol.tilegrid.XYZ({
|
||||||
maxZoom: 22
|
maxZoom: 22
|
||||||
})
|
})
|
||||||
@@ -25,7 +25,7 @@ var layers = [
|
|||||||
|
|
||||||
var webglMap = new ol.Map({
|
var webglMap = new ol.Map({
|
||||||
view: new ol.View2D({
|
view: new ol.View2D({
|
||||||
center: ol.projection.transformWithCodes(
|
center: ol.projection.transform(
|
||||||
new ol.Coordinate(-0.1275, 51.507222), 'EPSG:4326', 'EPSG:3857'),
|
new ol.Coordinate(-0.1275, 51.507222), 'EPSG:4326', 'EPSG:3857'),
|
||||||
zoom: 10
|
zoom: 10
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ var map = new ol.Map({
|
|||||||
renderers: [ol.RendererHint.CANVAS, ol.RendererHint.DOM],
|
renderers: [ol.RendererHint.CANVAS, ol.RendererHint.DOM],
|
||||||
target: 'map',
|
target: 'map',
|
||||||
view: new ol.View2D({
|
view: new ol.View2D({
|
||||||
projection: ol.projection.getFromCode('EPSG:4326'),
|
projection: 'EPSG:4326',
|
||||||
center: new ol.Coordinate(0, 0),
|
center: new ol.Coordinate(0, 0),
|
||||||
zoom: 2
|
zoom: 2
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ var map = new ol.Map({
|
|||||||
renderers: ol.RendererHints.createFromQueryData(),
|
renderers: ol.RendererHints.createFromQueryData(),
|
||||||
target: 'map',
|
target: 'map',
|
||||||
view: new ol.View2D({
|
view: new ol.View2D({
|
||||||
center: ol.projection.transformWithCodes(
|
center: ol.projection.transform(
|
||||||
new ol.Coordinate(139.6917, 35.689506), 'EPSG:4326', 'EPSG:3857'),
|
new ol.Coordinate(139.6917, 35.689506), 'EPSG:4326', 'EPSG:3857'),
|
||||||
zoom: 9
|
zoom: 9
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ var map = new ol.Map({
|
|||||||
controls: ol.control.defaults({}, [
|
controls: ol.control.defaults({}, [
|
||||||
new ol.control.MousePosition({
|
new ol.control.MousePosition({
|
||||||
coordinateFormat: ol.Coordinate.toStringHDMS,
|
coordinateFormat: ol.Coordinate.toStringHDMS,
|
||||||
projection: ol.projection.getFromCode('EPSG:4326'),
|
projection: 'EPSG:4326',
|
||||||
target: document.getElementById('mouse-position'),
|
target: document.getElementById('mouse-position'),
|
||||||
undefinedHTML: ' '
|
undefinedHTML: ' '
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ goog.require('ol.projection');
|
|||||||
goog.require('ol.source.MapQuestOpenAerial');
|
goog.require('ol.source.MapQuestOpenAerial');
|
||||||
|
|
||||||
|
|
||||||
var LONDON = ol.projection.transformWithCodes(
|
var LONDON = ol.projection.transform(
|
||||||
new ol.Coordinate(-0.12755, 51.507222), 'EPSG:4326', 'EPSG:3857');
|
new ol.Coordinate(-0.12755, 51.507222), 'EPSG:4326', 'EPSG:3857');
|
||||||
var MOSCOW = ol.projection.transformWithCodes(
|
var MOSCOW = ol.projection.transform(
|
||||||
new ol.Coordinate(37.6178, 55.7517), 'EPSG:4326', 'EPSG:3857');
|
new ol.Coordinate(37.6178, 55.7517), 'EPSG:4326', 'EPSG:3857');
|
||||||
|
|
||||||
var layer = new ol.layer.TileLayer({
|
var layer = new ol.layer.TileLayer({
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ var map = new ol.Map({
|
|||||||
renderers: ol.RendererHints.createFromQueryData(),
|
renderers: ol.RendererHints.createFromQueryData(),
|
||||||
target: 'map',
|
target: 'map',
|
||||||
view: new ol.View2D({
|
view: new ol.View2D({
|
||||||
center: ol.projection.transformWithCodes(
|
center: ol.projection.transform(
|
||||||
new ol.Coordinate(-122.416667, 37.783333), 'EPSG:4326', 'EPSG:3857'),
|
new ol.Coordinate(-122.416667, 37.783333), 'EPSG:4326', 'EPSG:3857'),
|
||||||
zoom: 12
|
zoom: 12
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
@exportObjectLiteralProperty ol.View2DOptions.center ol.Coordinate|undefined
|
@exportObjectLiteralProperty ol.View2DOptions.center ol.Coordinate|undefined
|
||||||
@exportObjectLiteralProperty ol.View2DOptions.maxResolution number|undefined
|
@exportObjectLiteralProperty ol.View2DOptions.maxResolution number|undefined
|
||||||
@exportObjectLiteralProperty ol.View2DOptions.numZoomLevels number|undefined
|
@exportObjectLiteralProperty ol.View2DOptions.numZoomLevels number|undefined
|
||||||
@exportObjectLiteralProperty ol.View2DOptions.projection ol.Projection|string|undefined
|
@exportObjectLiteralProperty ol.View2DOptions.projection ol.ProjectionLike
|
||||||
@exportObjectLiteralProperty ol.View2DOptions.resolution number|undefined
|
@exportObjectLiteralProperty ol.View2DOptions.resolution number|undefined
|
||||||
@exportObjectLiteralProperty ol.View2DOptions.resolutions Array.<number>|undefined
|
@exportObjectLiteralProperty ol.View2DOptions.resolutions Array.<number>|undefined
|
||||||
@exportObjectLiteralProperty ol.View2DOptions.rotation number|undefined
|
@exportObjectLiteralProperty ol.View2DOptions.rotation number|undefined
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
@exportObjectLiteral ol.control.MousePositionOptions
|
@exportObjectLiteral ol.control.MousePositionOptions
|
||||||
@exportObjectLiteralProperty ol.control.MousePositionOptions.coordinateFormat ol.CoordinateFormatType|undefined
|
@exportObjectLiteralProperty ol.control.MousePositionOptions.coordinateFormat ol.CoordinateFormatType|undefined
|
||||||
@exportObjectLiteralProperty ol.control.MousePositionOptions.map ol.Map|undefined
|
@exportObjectLiteralProperty ol.control.MousePositionOptions.map ol.Map|undefined
|
||||||
@exportObjectLiteralProperty ol.control.MousePositionOptions.projection ol.Projection|undefined
|
@exportObjectLiteralProperty ol.control.MousePositionOptions.projection ol.ProjectionLike
|
||||||
@exportObjectLiteralProperty ol.control.MousePositionOptions.target Element|undefined
|
@exportObjectLiteralProperty ol.control.MousePositionOptions.target Element|undefined
|
||||||
@exportObjectLiteralProperty ol.control.MousePositionOptions.undefinedHTML string|undefined
|
@exportObjectLiteralProperty ol.control.MousePositionOptions.undefinedHTML string|undefined
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
|
|
||||||
@exportObjectLiteral ol.source.DebugTileSourceOptions
|
@exportObjectLiteral ol.source.DebugTileSourceOptions
|
||||||
@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.extent ol.Extent|undefined
|
@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.extent ol.Extent|undefined
|
||||||
@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.projection ol.Projection|undefined
|
@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.projection ol.ProjectionLike
|
||||||
@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.tileGrid ol.tilegrid.TileGrid|undefined
|
@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.tileGrid ol.tilegrid.TileGrid|undefined
|
||||||
|
|
||||||
@exportObjectLiteral ol.source.SingleImageWMSOptions
|
@exportObjectLiteral ol.source.SingleImageWMSOptions
|
||||||
@@ -111,7 +111,7 @@
|
|||||||
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.crossOrigin null|string|undefined
|
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.crossOrigin null|string|undefined
|
||||||
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.extent ol.Extent|undefined
|
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.extent ol.Extent|undefined
|
||||||
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.params Object.<string,*>
|
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.params Object.<string,*>
|
||||||
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.projection ol.Projection|undefined
|
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.projection ol.ProjectionLike
|
||||||
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.resolutions Array.<number>|undefined
|
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.resolutions Array.<number>|undefined
|
||||||
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.url string|undefined
|
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.url string|undefined
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
@exportObjectLiteralProperty ol.source.StaticImageOptions.extent ol.Extent|undefined
|
@exportObjectLiteralProperty ol.source.StaticImageOptions.extent ol.Extent|undefined
|
||||||
@exportObjectLiteralProperty ol.source.StaticImageOptions.imageExtent ol.Extent|undefined
|
@exportObjectLiteralProperty ol.source.StaticImageOptions.imageExtent ol.Extent|undefined
|
||||||
@exportObjectLiteralProperty ol.source.StaticImageOptions.imageSize ol.Size|undefined
|
@exportObjectLiteralProperty ol.source.StaticImageOptions.imageSize ol.Size|undefined
|
||||||
@exportObjectLiteralProperty ol.source.StaticImageOptions.projection ol.Projection|undefined
|
@exportObjectLiteralProperty ol.source.StaticImageOptions.projection ol.ProjectionLike
|
||||||
@exportObjectLiteralProperty ol.source.StaticImageOptions.url string|undefined
|
@exportObjectLiteralProperty ol.source.StaticImageOptions.url string|undefined
|
||||||
|
|
||||||
@exportObjectLiteral ol.source.TiledWMSOptions
|
@exportObjectLiteral ol.source.TiledWMSOptions
|
||||||
@@ -138,7 +138,7 @@
|
|||||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.extent ol.Extent|undefined
|
@exportObjectLiteralProperty ol.source.TiledWMSOptions.extent ol.Extent|undefined
|
||||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.tileGrid ol.tilegrid.TileGrid|undefined
|
@exportObjectLiteralProperty ol.source.TiledWMSOptions.tileGrid ol.tilegrid.TileGrid|undefined
|
||||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.maxZoom number|undefined
|
@exportObjectLiteralProperty ol.source.TiledWMSOptions.maxZoom number|undefined
|
||||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.projection ol.Projection|undefined
|
@exportObjectLiteralProperty ol.source.TiledWMSOptions.projection ol.ProjectionLike
|
||||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.url string|undefined
|
@exportObjectLiteralProperty ol.source.TiledWMSOptions.url string|undefined
|
||||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.urls Array.<string>|undefined
|
@exportObjectLiteralProperty ol.source.TiledWMSOptions.urls Array.<string>|undefined
|
||||||
|
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ ol.control.MousePosition = function(opt_options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.Projection|undefined}
|
* @type {ol.Projection}
|
||||||
*/
|
*/
|
||||||
this.projection_ = options.projection;
|
this.projection_ = ol.projection.get(options.projection);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -168,8 +168,8 @@ ol.control.MousePosition.prototype.updateHTML_ = function(pixel) {
|
|||||||
var html = this.undefinedHTML_;
|
var html = this.undefinedHTML_;
|
||||||
if (!goog.isNull(pixel)) {
|
if (!goog.isNull(pixel)) {
|
||||||
if (this.renderedProjection_ != this.mapProjection_) {
|
if (this.renderedProjection_ != this.mapProjection_) {
|
||||||
if (goog.isDef(this.projection_)) {
|
if (!goog.isNull(this.projection_)) {
|
||||||
this.transform_ = ol.projection.getTransform(
|
this.transform_ = ol.projection.getTransformFromProjections(
|
||||||
this.mapProjection_, this.projection_);
|
this.mapProjection_, this.projection_);
|
||||||
} else {
|
} else {
|
||||||
this.transform_ = ol.projection.identityTransform;
|
this.transform_ = ol.projection.identityTransform;
|
||||||
|
|||||||
@@ -176,8 +176,8 @@ ol.control.ScaleLine.prototype.updateElement_ = function(frameState) {
|
|||||||
|
|
||||||
// Convert pointResolution from meters or feet to degrees
|
// Convert pointResolution from meters or feet to degrees
|
||||||
if (goog.isNull(this.toEPSG4326_)) {
|
if (goog.isNull(this.toEPSG4326_)) {
|
||||||
this.toEPSG4326_ = ol.projection.getTransform(
|
this.toEPSG4326_ = ol.projection.getTransformFromProjections(
|
||||||
projection, ol.projection.getFromCode('EPSG:4326'));
|
projection, ol.projection.get('EPSG:4326'));
|
||||||
}
|
}
|
||||||
var vertex = [center.x, center.y];
|
var vertex = [center.x, center.y];
|
||||||
vertex = this.toEPSG4326_(vertex, vertex, 2);
|
vertex = this.toEPSG4326_(vertex, vertex, 2);
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ ol.Geolocation.prototype.disposeInternal = function() {
|
|||||||
ol.Geolocation.prototype.handleProjectionChanged_ = function() {
|
ol.Geolocation.prototype.handleProjectionChanged_ = function() {
|
||||||
var projection = this.getProjection();
|
var projection = this.getProjection();
|
||||||
if (goog.isDefAndNotNull(projection)) {
|
if (goog.isDefAndNotNull(projection)) {
|
||||||
this.transformFn_ = ol.projection.getTransform(
|
this.transformFn_ = ol.projection.getTransformFromProjections(
|
||||||
ol.projection.getFromCode('EPSG:4326'), projection);
|
ol.projection.get('EPSG:4326'), projection);
|
||||||
if (!goog.isNull(this.position_)) {
|
if (!goog.isNull(this.position_)) {
|
||||||
var vertex = [this.position_.x, this.position_.y];
|
var vertex = [this.position_.x, this.position_.y];
|
||||||
vertex = this.transformFn_(vertex, vertex, 2);
|
vertex = this.transformFn_(vertex, vertex, 2);
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ ol.parser.ogc.WMTSCapabilities_v1_0_0 = function() {
|
|||||||
var topLeftCorner = this.getChildValue(node);
|
var topLeftCorner = this.getChildValue(node);
|
||||||
var coords = topLeftCorner.split(' ');
|
var coords = topLeftCorner.split(' ');
|
||||||
var axisOrientation =
|
var axisOrientation =
|
||||||
ol.projection.getFromCode(obj['supportedCRS']).getAxisOrientation();
|
ol.projection.get(obj['supportedCRS']).getAxisOrientation();
|
||||||
obj['topLeftCorner'] = ol.Coordinate.fromProjectedArray(
|
obj['topLeftCorner'] = ol.Coordinate.fromProjectedArray(
|
||||||
[parseFloat(coords[0]), parseFloat(coords[1])], axisOrientation);
|
[parseFloat(coords[0]), parseFloat(coords[1])], axisOrientation);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,9 +13,9 @@
|
|||||||
@exportProperty ol.ProjectionUnits.METERS
|
@exportProperty ol.ProjectionUnits.METERS
|
||||||
|
|
||||||
@exportSymbol ol.projection.addProjection
|
@exportSymbol ol.projection.addProjection
|
||||||
@exportSymbol ol.projection.getFromCode
|
@exportSymbol ol.projection.get
|
||||||
@exportSymbol ol.projection.getTransform
|
@exportSymbol ol.projection.getTransform
|
||||||
@exportSymbol ol.projection.getTransformFromCodes
|
@exportSymbol ol.projection.getTransformFromProjections
|
||||||
@exportSymbol ol.projection.transform
|
@exportSymbol ol.projection.transform
|
||||||
@exportSymbol ol.projection.transformWithCodes
|
@exportSymbol ol.projection.transformWithProjections
|
||||||
@exportSymbol ol.projection.configureProj4jsProjection
|
@exportSymbol ol.projection.configureProj4jsProjection
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
goog.provide('ol.Projection');
|
goog.provide('ol.Projection');
|
||||||
|
goog.provide('ol.ProjectionLike');
|
||||||
goog.provide('ol.ProjectionUnits');
|
goog.provide('ol.ProjectionUnits');
|
||||||
goog.provide('ol.projection');
|
goog.provide('ol.projection');
|
||||||
|
|
||||||
@@ -23,6 +24,12 @@ ol.ENABLE_PROJ4JS = true;
|
|||||||
ol.HAVE_PROJ4JS = ol.ENABLE_PROJ4JS && typeof Proj4js == 'object';
|
ol.HAVE_PROJ4JS = ol.ENABLE_PROJ4JS && typeof Proj4js == 'object';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {ol.Projection|string|undefined}
|
||||||
|
*/
|
||||||
|
ol.ProjectionLike;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
@@ -211,7 +218,7 @@ ol.Proj4jsProjection_.prototype.getPointResolution =
|
|||||||
// measuring its width and height on the normal sphere, and taking the
|
// measuring its width and height on the normal sphere, and taking the
|
||||||
// average of the width and height.
|
// average of the width and height.
|
||||||
if (goog.isNull(this.toEPSG4326_)) {
|
if (goog.isNull(this.toEPSG4326_)) {
|
||||||
this.toEPSG4326_ = ol.projection.getTransform(
|
this.toEPSG4326_ = ol.projection.getTransformFromProjections(
|
||||||
this, ol.projection.getProj4jsProjectionFromCode_({
|
this, ol.projection.getProj4jsProjectionFromCode_({
|
||||||
code: 'EPSG:4326',
|
code: 'EPSG:4326',
|
||||||
extent: null
|
extent: null
|
||||||
@@ -365,9 +372,9 @@ ol.projection.clearAllProjections = function() {
|
|||||||
*/
|
*/
|
||||||
ol.projection.createProjection = function(projection, defaultCode) {
|
ol.projection.createProjection = function(projection, defaultCode) {
|
||||||
if (!goog.isDefAndNotNull(projection)) {
|
if (!goog.isDefAndNotNull(projection)) {
|
||||||
return ol.projection.getFromCode(defaultCode);
|
return ol.projection.get(defaultCode);
|
||||||
} else if (goog.isString(projection)) {
|
} else if (goog.isString(projection)) {
|
||||||
return ol.projection.getFromCode(projection);
|
return ol.projection.get(projection);
|
||||||
} else {
|
} else {
|
||||||
goog.asserts.assert(projection instanceof ol.Projection);
|
goog.asserts.assert(projection instanceof ol.Projection);
|
||||||
return projection;
|
return projection;
|
||||||
@@ -422,20 +429,29 @@ ol.projection.removeTransform = function(source, destination) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} code Code which is a combination of authority and identifier
|
* @param {ol.ProjectionLike} projectionLike Either a code string which is a
|
||||||
* such as “EPSG:4326”.
|
* combination of authority and identifier such as "EPSG:4326", or an
|
||||||
|
* existing projection object, or undefined.
|
||||||
* @return {ol.Projection} Projection.
|
* @return {ol.Projection} Projection.
|
||||||
*/
|
*/
|
||||||
ol.projection.getFromCode = function(code) {
|
ol.projection.get = function(projectionLike) {
|
||||||
var projection = ol.projection.projections_[code];
|
var projection;
|
||||||
if (ol.HAVE_PROJ4JS && !goog.isDef(projection)) {
|
if (projectionLike instanceof ol.Projection) {
|
||||||
projection = ol.projection.getProj4jsProjectionFromCode_({
|
projection = projectionLike;
|
||||||
code: code,
|
} else if (goog.isString(projectionLike)) {
|
||||||
extent: null
|
var code = projectionLike;
|
||||||
});
|
projection = ol.projection.projections_[code];
|
||||||
}
|
if (ol.HAVE_PROJ4JS && !goog.isDef(projection)) {
|
||||||
if (!goog.isDef(projection)) {
|
projection = ol.projection.getProj4jsProjectionFromCode_({
|
||||||
goog.asserts.assert(goog.isDef(projection));
|
code: code,
|
||||||
|
extent: null
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!goog.isDef(projection)) {
|
||||||
|
goog.asserts.assert(goog.isDef(projection));
|
||||||
|
projection = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
projection = null;
|
projection = null;
|
||||||
}
|
}
|
||||||
return projection;
|
return projection;
|
||||||
@@ -483,24 +499,43 @@ ol.projection.equivalent = function(projection1, projection2) {
|
|||||||
} else if (projection1.getUnits() != projection2.getUnits()) {
|
} else if (projection1.getUnits() != projection2.getUnits()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
var transformFn = ol.projection.getTransform(projection1, projection2);
|
var transformFn = ol.projection.getTransformFromProjections(
|
||||||
|
projection1, projection2);
|
||||||
return transformFn === ol.projection.cloneTransform;
|
return transformFn === ol.projection.cloneTransform;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given the projection-like objects this method searches for a transformation
|
||||||
|
* function to convert a coordinates array from the source projection to the
|
||||||
|
* destination projection.
|
||||||
|
*
|
||||||
|
* @param {ol.ProjectionLike} source Source.
|
||||||
|
* @param {ol.ProjectionLike} destination Destination.
|
||||||
|
* @return {ol.TransformFunction} Transform.
|
||||||
|
*/
|
||||||
|
ol.projection.getTransform = function(source, destination) {
|
||||||
|
var sourceProjection = ol.projection.get(source);
|
||||||
|
var destinationProjection = ol.projection.get(destination);
|
||||||
|
return ol.projection.getTransformFromProjections(
|
||||||
|
sourceProjection, destinationProjection);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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} source Source.
|
* @param {ol.Projection} sourceProjection Source projection.
|
||||||
* @param {ol.Projection} destination Destination.
|
* @param {ol.Projection} destinationProjection Destination projection.
|
||||||
* @return {ol.TransformFunction} Transform.
|
* @return {ol.TransformFunction} Transform.
|
||||||
*/
|
*/
|
||||||
ol.projection.getTransform = function(source, destination) {
|
ol.projection.getTransformFromProjections =
|
||||||
|
function(sourceProjection, destinationProjection) {
|
||||||
var transforms = ol.projection.transforms_;
|
var transforms = ol.projection.transforms_;
|
||||||
var sourceCode = source.getCode();
|
var sourceCode = sourceProjection.getCode();
|
||||||
var destinationCode = destination.getCode();
|
var destinationCode = destinationProjection.getCode();
|
||||||
var transform;
|
var transform;
|
||||||
if (goog.object.containsKey(transforms, sourceCode) &&
|
if (goog.object.containsKey(transforms, sourceCode) &&
|
||||||
goog.object.containsKey(transforms[sourceCode], destinationCode)) {
|
goog.object.containsKey(transforms[sourceCode], destinationCode)) {
|
||||||
@@ -508,23 +543,23 @@ ol.projection.getTransform = function(source, destination) {
|
|||||||
}
|
}
|
||||||
if (ol.HAVE_PROJ4JS && !goog.isDef(transform)) {
|
if (ol.HAVE_PROJ4JS && !goog.isDef(transform)) {
|
||||||
var proj4jsSource;
|
var proj4jsSource;
|
||||||
if (source instanceof ol.Proj4jsProjection_) {
|
if (sourceProjection instanceof ol.Proj4jsProjection_) {
|
||||||
proj4jsSource = source;
|
proj4jsSource = sourceProjection;
|
||||||
} else {
|
} else {
|
||||||
proj4jsSource =
|
proj4jsSource =
|
||||||
ol.projection.getProj4jsProjectionFromCode_({
|
ol.projection.getProj4jsProjectionFromCode_({
|
||||||
code: source.getCode(),
|
code: sourceCode,
|
||||||
extent: null
|
extent: null
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var sourceProj4jsProj = proj4jsSource.getProj4jsProj();
|
var sourceProj4jsProj = proj4jsSource.getProj4jsProj();
|
||||||
var proj4jsDestination;
|
var proj4jsDestination;
|
||||||
if (destination instanceof ol.Proj4jsProjection_) {
|
if (destinationProjection instanceof ol.Proj4jsProjection_) {
|
||||||
proj4jsDestination = destination;
|
proj4jsDestination = destinationProjection;
|
||||||
} else {
|
} else {
|
||||||
proj4jsDestination =
|
proj4jsDestination =
|
||||||
ol.projection.getProj4jsProjectionFromCode_({
|
ol.projection.getProj4jsProjectionFromCode_({
|
||||||
code: destination.getCode(),
|
code: destinationCode,
|
||||||
extent: null
|
extent: null
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -559,7 +594,8 @@ ol.projection.getTransform = function(source, destination) {
|
|||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
ol.projection.addTransform(source, destination, transform);
|
ol.projection.addTransform(
|
||||||
|
sourceProjection, destinationProjection, transform);
|
||||||
}
|
}
|
||||||
if (!goog.isDef(transform)) {
|
if (!goog.isDef(transform)) {
|
||||||
goog.asserts.assert(goog.isDef(transform));
|
goog.asserts.assert(goog.isDef(transform));
|
||||||
@@ -569,22 +605,6 @@ ol.projection.getTransform = function(source, destination) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Given the projection codes this method searches for a transformation function
|
|
||||||
* to convert a coordinates array from the source projection to the destination
|
|
||||||
* projection.
|
|
||||||
*
|
|
||||||
* @param {string} sourceCode Source code.
|
|
||||||
* @param {string} destinationCode Destination code.
|
|
||||||
* @return {ol.TransformFunction} Transform.
|
|
||||||
*/
|
|
||||||
ol.projection.getTransformFromCodes = function(sourceCode, destinationCode) {
|
|
||||||
var source = ol.projection.getFromCode(sourceCode);
|
|
||||||
var destination = ol.projection.getFromCode(destinationCode);
|
|
||||||
return ol.projection.getTransform(source, destination);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array.<number>} input Input coordinate array.
|
* @param {Array.<number>} input Input coordinate array.
|
||||||
* @param {Array.<number>=} opt_output Output array of coordinate values.
|
* @param {Array.<number>=} opt_output Output array of coordinate values.
|
||||||
@@ -626,11 +646,9 @@ ol.projection.cloneTransform = function(input, opt_output, opt_dimension) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transforms the given point to the destination projection.
|
|
||||||
*
|
|
||||||
* @param {ol.Coordinate} point Point.
|
* @param {ol.Coordinate} point Point.
|
||||||
* @param {ol.Projection} source Source.
|
* @param {ol.ProjectionLike} source Source.
|
||||||
* @param {ol.Projection} destination Destination.
|
* @param {ol.ProjectionLike} destination Destination.
|
||||||
* @return {ol.Coordinate} Point.
|
* @return {ol.Coordinate} Point.
|
||||||
*/
|
*/
|
||||||
ol.projection.transform = function(point, source, destination) {
|
ol.projection.transform = function(point, source, destination) {
|
||||||
@@ -642,15 +660,17 @@ ol.projection.transform = function(point, source, destination) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Transforms the given point to the destination projection.
|
||||||
|
*
|
||||||
* @param {ol.Coordinate} point Point.
|
* @param {ol.Coordinate} point Point.
|
||||||
* @param {string} sourceCode Source code.
|
* @param {ol.Projection} sourceProjection Source projection.
|
||||||
* @param {string} destinationCode Destination code.
|
* @param {ol.Projection} destinationProjection Destination projection.
|
||||||
* @return {ol.Coordinate} Point.
|
* @return {ol.Coordinate} Point.
|
||||||
*/
|
*/
|
||||||
ol.projection.transformWithCodes =
|
ol.projection.transformWithProjections =
|
||||||
function(point, sourceCode, destinationCode) {
|
function(point, sourceProjection, destinationProjection) {
|
||||||
var transformFn = ol.projection.getTransformFromCodes(
|
var transformFn = ol.projection.getTransformFromProjections(
|
||||||
sourceCode, destinationCode);
|
sourceProjection, destinationProjection);
|
||||||
var vertex = [point.x, point.y];
|
var vertex = [point.x, point.y];
|
||||||
vertex = transformFn(vertex, vertex, 2);
|
vertex = transformFn(vertex, vertex, 2);
|
||||||
return new ol.Coordinate(vertex[0], vertex[1]);
|
return new ol.Coordinate(vertex[0], vertex[1]);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ ol.source.BingMaps = function(bingMapsOptions) {
|
|||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
opaque: true,
|
opaque: true,
|
||||||
projection: ol.projection.getFromCode('EPSG:3857')
|
projection: ol.projection.get('EPSG:3857')
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,8 +111,8 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse =
|
|||||||
};
|
};
|
||||||
})));
|
})));
|
||||||
|
|
||||||
var transform = ol.projection.getTransform(
|
var transform = ol.projection.getTransformFromProjections(
|
||||||
ol.projection.getFromCode('EPSG:4326'), this.getProjection());
|
ol.projection.get('EPSG:4326'), this.getProjection());
|
||||||
var attributions = goog.array.map(
|
var attributions = goog.array.map(
|
||||||
resource.imageryProviders,
|
resource.imageryProviders,
|
||||||
function(imageryProvider) {
|
function(imageryProvider) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ goog.require('ol.source.Source');
|
|||||||
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
||||||
* crossOrigin: (null|string|undefined),
|
* crossOrigin: (null|string|undefined),
|
||||||
* extent: (null|ol.Extent|undefined),
|
* extent: (null|ol.Extent|undefined),
|
||||||
* projection: (ol.Projection|undefined),
|
* projection: ol.ProjectionLike,
|
||||||
* resolutions: (Array.<number>|undefined),
|
* resolutions: (Array.<number>|undefined),
|
||||||
* imageUrlFunction: (ol.ImageUrlFunctionType|
|
* imageUrlFunction: (ol.ImageUrlFunctionType|
|
||||||
* undefined)}}
|
* undefined)}}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ goog.require('ol.tilegrid.TileGrid');
|
|||||||
* crossOrigin: (null|string|undefined),
|
* crossOrigin: (null|string|undefined),
|
||||||
* extent: (ol.Extent|undefined),
|
* extent: (ol.Extent|undefined),
|
||||||
* opaque: (boolean|undefined),
|
* opaque: (boolean|undefined),
|
||||||
* projection: (ol.Projection|undefined),
|
* projection: ol.ProjectionLike,
|
||||||
* tileGrid: (ol.tilegrid.TileGrid|undefined),
|
* tileGrid: (ol.tilegrid.TileGrid|undefined),
|
||||||
* tileUrlFunction: (ol.TileUrlFunctionType|undefined)}}
|
* tileUrlFunction: (ol.TileUrlFunctionType|undefined)}}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ goog.require('goog.events.EventType');
|
|||||||
goog.require('goog.functions');
|
goog.require('goog.functions');
|
||||||
goog.require('ol.Attribution');
|
goog.require('ol.Attribution');
|
||||||
goog.require('ol.Extent');
|
goog.require('ol.Extent');
|
||||||
goog.require('ol.Projection');
|
goog.require('ol.projection');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
||||||
* extent: (ol.Extent|undefined),
|
* extent: (ol.Extent|undefined),
|
||||||
* projection: (ol.Projection|undefined)}}
|
* projection: ol.ProjectionLike}}
|
||||||
*/
|
*/
|
||||||
ol.source.SourceOptions;
|
ol.source.SourceOptions;
|
||||||
|
|
||||||
@@ -30,8 +30,7 @@ ol.source.Source = function(sourceOptions) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.Projection}
|
* @type {ol.Projection}
|
||||||
*/
|
*/
|
||||||
this.projection_ = goog.isDef(sourceOptions.projection) ?
|
this.projection_ = ol.projection.get(sourceOptions.projection);
|
||||||
sourceOptions.projection : null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -39,7 +38,7 @@ ol.source.Source = function(sourceOptions) {
|
|||||||
*/
|
*/
|
||||||
this.extent_ = goog.isDef(sourceOptions.extent) ?
|
this.extent_ = goog.isDef(sourceOptions.extent) ?
|
||||||
sourceOptions.extent : goog.isDef(sourceOptions.projection) ?
|
sourceOptions.extent : goog.isDef(sourceOptions.projection) ?
|
||||||
sourceOptions.projection.getExtent() : null;
|
this.projection_.getExtent() : null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ goog.provide('ol.source.StaticImage');
|
|||||||
|
|
||||||
goog.require('ol.Image');
|
goog.require('ol.Image');
|
||||||
goog.require('ol.ImageUrlFunctionType');
|
goog.require('ol.ImageUrlFunctionType');
|
||||||
|
goog.require('ol.projection');
|
||||||
goog.require('ol.source.ImageSource');
|
goog.require('ol.source.ImageSource');
|
||||||
|
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ ol.source.StaticImage = function(options) {
|
|||||||
var imageExtent = options.imageExtent;
|
var imageExtent = options.imageExtent;
|
||||||
var imageSize = options.imageSize;
|
var imageSize = options.imageSize;
|
||||||
var imageResolution = imageExtent.getHeight() / imageSize.height;
|
var imageResolution = imageExtent.getHeight() / imageSize.height;
|
||||||
var projection = goog.isDef(options.projection) ? options.projection : null;
|
var projection = ol.projection.get(options.projection);
|
||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
attributions: options.attributions,
|
attributions: options.attributions,
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
@exportSymbol ol.source.TiledWMS
|
@exportSymbol ol.source.TiledWMS
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ goog.exportSymbol('grid', grid);
|
|||||||
ol.source.TileJSON = function(tileJsonOptions) {
|
ol.source.TileJSON = function(tileJsonOptions) {
|
||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
projection: ol.projection.getFromCode('EPSG:3857')
|
projection: ol.projection.get('EPSG:3857')
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,15 +80,15 @@ ol.source.TileJSON.prototype.handleTileJSONResponse = function() {
|
|||||||
|
|
||||||
var tileJSON = ol.tilejson.grids_.pop();
|
var tileJSON = ol.tilejson.grids_.pop();
|
||||||
|
|
||||||
var epsg4326Projection = ol.projection.getFromCode('EPSG:4326');
|
var epsg4326Projection = ol.projection.get('EPSG:4326');
|
||||||
|
|
||||||
var epsg4326Extent, extent;
|
var epsg4326Extent, extent;
|
||||||
if (goog.isDef(tileJSON.bounds)) {
|
if (goog.isDef(tileJSON.bounds)) {
|
||||||
var bounds = tileJSON.bounds;
|
var bounds = tileJSON.bounds;
|
||||||
epsg4326Extent = new ol.Extent(
|
epsg4326Extent = new ol.Extent(
|
||||||
bounds[0], bounds[1], bounds[2], bounds[3]);
|
bounds[0], bounds[1], bounds[2], bounds[3]);
|
||||||
extent = epsg4326Extent.transform(
|
extent = epsg4326Extent.transform(ol.projection.getTransformFromProjections(
|
||||||
ol.projection.getTransform(epsg4326Projection, this.getProjection()));
|
epsg4326Projection, this.getProjection()));
|
||||||
this.setExtent(extent);
|
this.setExtent(extent);
|
||||||
} else {
|
} else {
|
||||||
epsg4326Extent = null;
|
epsg4326Extent = null;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ goog.provide('ol.source.TileSourceOptions');
|
|||||||
goog.require('goog.functions');
|
goog.require('goog.functions');
|
||||||
goog.require('ol.Attribution');
|
goog.require('ol.Attribution');
|
||||||
goog.require('ol.Extent');
|
goog.require('ol.Extent');
|
||||||
goog.require('ol.Projection');
|
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.Tile');
|
||||||
goog.require('ol.TileCoord');
|
goog.require('ol.TileCoord');
|
||||||
goog.require('ol.TileRange');
|
goog.require('ol.TileRange');
|
||||||
@@ -16,7 +15,7 @@ goog.require('ol.tilegrid.TileGrid');
|
|||||||
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
||||||
* extent: (ol.Extent|undefined),
|
* extent: (ol.Extent|undefined),
|
||||||
* opaque: (boolean|undefined),
|
* opaque: (boolean|undefined),
|
||||||
* projection: (ol.Projection|undefined),
|
* projection: ol.ProjectionLike,
|
||||||
* tileGrid: (ol.tilegrid.TileGrid|undefined)}}
|
* tileGrid: (ol.tilegrid.TileGrid|undefined)}}
|
||||||
*/
|
*/
|
||||||
ol.source.TileSourceOptions;
|
ol.source.TileSourceOptions;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ ol.source.XYZOptions;
|
|||||||
ol.source.XYZ = function(xyzOptions) {
|
ol.source.XYZ = function(xyzOptions) {
|
||||||
|
|
||||||
var projection = xyzOptions.projection ||
|
var projection = xyzOptions.projection ||
|
||||||
ol.projection.getFromCode('EPSG:3857');
|
ol.projection.get('EPSG:3857');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ol.TileUrlFunctionType}
|
* @type {ol.TileUrlFunctionType}
|
||||||
|
|||||||
@@ -70,8 +70,7 @@ describe('ol.Extent', function() {
|
|||||||
describe('transform', function() {
|
describe('transform', function() {
|
||||||
|
|
||||||
it('does transform', function() {
|
it('does transform', function() {
|
||||||
var transformFn =
|
var transformFn = ol.projection.getTransform('EPSG:4326', 'EPSG:3857');
|
||||||
ol.projection.getTransformFromCodes('EPSG:4326', 'EPSG:3857');
|
|
||||||
var sourceExtent = new ol.Extent(-15, -30, 45, 60);
|
var sourceExtent = new ol.Extent(-15, -30, 45, 60);
|
||||||
var destinationExtent = sourceExtent.transform(transformFn);
|
var destinationExtent = sourceExtent.transform(transformFn);
|
||||||
expect(destinationExtent).not.toBeUndefined();
|
expect(destinationExtent).not.toBeUndefined();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ describe('ol.layer.Layer', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
layer = new ol.layer.Layer({
|
layer = new ol.layer.Layer({
|
||||||
source: new ol.source.Source({
|
source: new ol.source.Source({
|
||||||
projection: ol.projection.getFromCode('EPSG:4326')
|
projection: ol.projection.get('EPSG:4326')
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -53,7 +53,7 @@ describe('ol.layer.Layer', function() {
|
|||||||
it('accepts options', function() {
|
it('accepts options', function() {
|
||||||
var layer = new ol.layer.Layer({
|
var layer = new ol.layer.Layer({
|
||||||
source: new ol.source.Source({
|
source: new ol.source.Source({
|
||||||
projection: ol.projection.getFromCode('EPSG:4326')
|
projection: ol.projection.get('EPSG:4326')
|
||||||
}),
|
}),
|
||||||
brightness: 0.5,
|
brightness: 0.5,
|
||||||
contrast: 10,
|
contrast: 10,
|
||||||
@@ -82,7 +82,7 @@ describe('ol.layer.Layer', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
layer = new ol.layer.Layer({
|
layer = new ol.layer.Layer({
|
||||||
source: new ol.source.Source({
|
source: new ol.source.Source({
|
||||||
projection: ol.projection.getFromCode('EPSG:4326')
|
projection: ol.projection.get('EPSG:4326')
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -120,7 +120,7 @@ describe('ol.layer.Layer', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
layer = new ol.layer.Layer({
|
layer = new ol.layer.Layer({
|
||||||
source: new ol.source.Source({
|
source: new ol.source.Source({
|
||||||
projection: ol.projection.getFromCode('EPSG:4326')
|
projection: ol.projection.get('EPSG:4326')
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -154,7 +154,7 @@ describe('ol.layer.Layer', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
layer = new ol.layer.Layer({
|
layer = new ol.layer.Layer({
|
||||||
source: new ol.source.Source({
|
source: new ol.source.Source({
|
||||||
projection: ol.projection.getFromCode('EPSG:4326')
|
projection: ol.projection.get('EPSG:4326')
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -193,7 +193,7 @@ describe('ol.layer.Layer', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
layer = new ol.layer.Layer({
|
layer = new ol.layer.Layer({
|
||||||
source: new ol.source.Source({
|
source: new ol.source.Source({
|
||||||
projection: ol.projection.getFromCode('EPSG:4326')
|
projection: ol.projection.get('EPSG:4326')
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -227,7 +227,7 @@ describe('ol.layer.Layer', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
layer = new ol.layer.Layer({
|
layer = new ol.layer.Layer({
|
||||||
source: new ol.source.Source({
|
source: new ol.source.Source({
|
||||||
projection: ol.projection.getFromCode('EPSG:4326')
|
projection: ol.projection.get('EPSG:4326')
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -259,7 +259,7 @@ describe('ol.layer.Layer', function() {
|
|||||||
it('sets visible property', function() {
|
it('sets visible property', function() {
|
||||||
var layer = new ol.layer.Layer({
|
var layer = new ol.layer.Layer({
|
||||||
source: new ol.source.Source({
|
source: new ol.source.Source({
|
||||||
projection: ol.projection.getFromCode('EPSG:4326')
|
projection: ol.projection.get('EPSG:4326')
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ describe('ol.projection.EPSG3857', function() {
|
|||||||
|
|
||||||
it('returns the correct point scale at the equator', function() {
|
it('returns the correct point scale at the equator', function() {
|
||||||
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
||||||
var epsg3857 = ol.projection.getFromCode('EPSG:3857');
|
var epsg3857 = ol.projection.get('EPSG:3857');
|
||||||
var resolution = 19.11;
|
var resolution = 19.11;
|
||||||
var point = new ol.Coordinate(0, 0);
|
var point = new ol.Coordinate(0, 0);
|
||||||
expect(epsg3857.getPointResolution(resolution, point)).
|
expect(epsg3857.getPointResolution(resolution, point)).
|
||||||
@@ -17,8 +17,8 @@ describe('ol.projection.EPSG3857', function() {
|
|||||||
it('returns the correct point scale at the latitude of Toronto',
|
it('returns the correct point scale at the latitude of Toronto',
|
||||||
function() {
|
function() {
|
||||||
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
||||||
var epsg3857 = ol.projection.getFromCode('EPSG:3857');
|
var epsg3857 = ol.projection.get('EPSG:3857');
|
||||||
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
var epsg4326 = ol.projection.get('EPSG:4326');
|
||||||
var resolution = 19.11;
|
var resolution = 19.11;
|
||||||
var point = ol.projection.transform(
|
var point = ol.projection.transform(
|
||||||
new ol.Coordinate(0, 43.65), epsg4326, epsg3857);
|
new ol.Coordinate(0, 43.65), epsg4326, epsg3857);
|
||||||
@@ -28,8 +28,8 @@ describe('ol.projection.EPSG3857', function() {
|
|||||||
|
|
||||||
it('returns the correct point scale at various latitudes', function() {
|
it('returns the correct point scale at various latitudes', function() {
|
||||||
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
||||||
var epsg3857 = ol.projection.getFromCode('EPSG:3857');
|
var epsg3857 = ol.projection.get('EPSG:3857');
|
||||||
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
var epsg4326 = ol.projection.get('EPSG:4326');
|
||||||
var resolution = 19.11;
|
var resolution = 19.11;
|
||||||
var latitude;
|
var latitude;
|
||||||
for (latitude = 0; latitude < 90; ++latitude) {
|
for (latitude = 0; latitude < 90; ++latitude) {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ describe('ol.projection', function() {
|
|||||||
describe('projection equivalence', function() {
|
describe('projection equivalence', function() {
|
||||||
|
|
||||||
function _testAllEquivalent(codes) {
|
function _testAllEquivalent(codes) {
|
||||||
var projections = goog.array.map(codes, ol.projection.getFromCode);
|
var projections = goog.array.map(codes, ol.projection.get);
|
||||||
goog.array.forEach(projections, function(source) {
|
goog.array.forEach(projections, function(source) {
|
||||||
goog.array.forEach(projections, function(destination) {
|
goog.array.forEach(projections, function(destination) {
|
||||||
expect(ol.projection.equivalent(source, destination)).toBeTruthy();
|
expect(ol.projection.equivalent(source, destination)).toBeTruthy();
|
||||||
@@ -56,7 +56,7 @@ describe('ol.projection', function() {
|
|||||||
describe('identify transform', function() {
|
describe('identify transform', function() {
|
||||||
|
|
||||||
it('returns a new object, with same coord values', function() {
|
it('returns a new object, with same coord values', function() {
|
||||||
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
var epsg4326 = ol.projection.get('EPSG:4326');
|
||||||
var uniqueObject = {};
|
var uniqueObject = {};
|
||||||
var sourcePoint = new ol.Coordinate(uniqueObject, uniqueObject);
|
var sourcePoint = new ol.Coordinate(uniqueObject, uniqueObject);
|
||||||
var destinationPoint = ol.projection.transform(
|
var destinationPoint = ol.projection.transform(
|
||||||
@@ -70,7 +70,7 @@ describe('ol.projection', function() {
|
|||||||
describe('transform 0,0 from 4326 to 3857', function() {
|
describe('transform 0,0 from 4326 to 3857', function() {
|
||||||
|
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var point = ol.projection.transformWithCodes(
|
var point = ol.projection.transform(
|
||||||
new ol.Coordinate(0, 0), 'EPSG:4326', 'EPSG:3857');
|
new ol.Coordinate(0, 0), 'EPSG:4326', 'EPSG:3857');
|
||||||
expect(point).not.toBeUndefined();
|
expect(point).not.toBeUndefined();
|
||||||
expect(point).not.toBeNull();
|
expect(point).not.toBeNull();
|
||||||
@@ -81,7 +81,7 @@ describe('ol.projection', function() {
|
|||||||
describe('transform 0,0 from 3857 to 4326', function() {
|
describe('transform 0,0 from 3857 to 4326', function() {
|
||||||
|
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var point = ol.projection.transformWithCodes(
|
var point = ol.projection.transform(
|
||||||
new ol.Coordinate(0, 0), 'EPSG:3857', 'EPSG:4326');
|
new ol.Coordinate(0, 0), 'EPSG:3857', 'EPSG:4326');
|
||||||
expect(point).not.toBeUndefined();
|
expect(point).not.toBeUndefined();
|
||||||
expect(point).not.toBeNull();
|
expect(point).not.toBeNull();
|
||||||
@@ -94,7 +94,7 @@ describe('ol.projection', function() {
|
|||||||
// http://alastaira.wordpress.com/2011/01/23/the-google-maps-bing-maps-spherical-mercator-projection/
|
// http://alastaira.wordpress.com/2011/01/23/the-google-maps-bing-maps-spherical-mercator-projection/
|
||||||
|
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var point = ol.projection.transformWithCodes(
|
var point = ol.projection.transform(
|
||||||
new ol.Coordinate(-5.625, 52.4827802220782),
|
new ol.Coordinate(-5.625, 52.4827802220782),
|
||||||
'EPSG:4326',
|
'EPSG:4326',
|
||||||
'EPSG:900913');
|
'EPSG:900913');
|
||||||
@@ -109,7 +109,7 @@ describe('ol.projection', function() {
|
|||||||
// http://alastaira.wordpress.com/2011/01/23/the-google-maps-bing-maps-spherical-mercator-projection/
|
// http://alastaira.wordpress.com/2011/01/23/the-google-maps-bing-maps-spherical-mercator-projection/
|
||||||
|
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var point = ol.projection.transformWithCodes(
|
var point = ol.projection.transform(
|
||||||
new ol.Coordinate(-626172.13571216376, 6887893.4928337997),
|
new ol.Coordinate(-626172.13571216376, 6887893.4928337997),
|
||||||
'EPSG:900913',
|
'EPSG:900913',
|
||||||
'EPSG:4326');
|
'EPSG:4326');
|
||||||
@@ -123,7 +123,7 @@ describe('ol.projection', function() {
|
|||||||
describe('Proj4js integration', function() {
|
describe('Proj4js integration', function() {
|
||||||
|
|
||||||
it('allows Proj4js projections to be used transparently', function() {
|
it('allows Proj4js projections to be used transparently', function() {
|
||||||
var point = ol.projection.transformWithCodes(
|
var point = ol.projection.transform(
|
||||||
new ol.Coordinate(-626172.13571216376, 6887893.4928337997),
|
new ol.Coordinate(-626172.13571216376, 6887893.4928337997),
|
||||||
'GOOGLE',
|
'GOOGLE',
|
||||||
'WGS84');
|
'WGS84');
|
||||||
@@ -136,7 +136,7 @@ describe('ol.projection', function() {
|
|||||||
'+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 ' +
|
'+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 ' +
|
||||||
'+k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel ' +
|
'+k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel ' +
|
||||||
'+towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs';
|
'+towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs';
|
||||||
var point = ol.projection.transformWithCodes(
|
var point = ol.projection.transform(
|
||||||
new ol.Coordinate(7.439583333333333, 46.95240555555556),
|
new ol.Coordinate(7.439583333333333, 46.95240555555556),
|
||||||
'EPSG:4326',
|
'EPSG:4326',
|
||||||
'EPSG:21781');
|
'EPSG:21781');
|
||||||
@@ -151,24 +151,24 @@ describe('ol.projection', function() {
|
|||||||
'+towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs';
|
'+towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs';
|
||||||
var code = 'urn:ogc:def:crs:EPSG:21781';
|
var code = 'urn:ogc:def:crs:EPSG:21781';
|
||||||
var srsCode = 'EPSG:21781';
|
var srsCode = 'EPSG:21781';
|
||||||
var proj = ol.projection.getFromCode(code);
|
var proj = ol.projection.get(code);
|
||||||
expect(ol.projection.proj4jsProjections_.hasOwnProperty(code))
|
expect(ol.projection.proj4jsProjections_.hasOwnProperty(code))
|
||||||
.toBeTruthy();
|
.toBeTruthy();
|
||||||
expect(ol.projection.proj4jsProjections_.hasOwnProperty(srsCode))
|
expect(ol.projection.proj4jsProjections_.hasOwnProperty(srsCode))
|
||||||
.toBeTruthy();
|
.toBeTruthy();
|
||||||
var proj2 = ol.projection.getFromCode(srsCode);
|
var proj2 = ol.projection.get(srsCode);
|
||||||
expect(proj2).toBe(proj);
|
expect(proj2).toBe(proj);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('numerically estimates point scale at the equator', function() {
|
it('numerically estimates point scale at the equator', function() {
|
||||||
var googleProjection = ol.projection.getFromCode('GOOGLE');
|
var googleProjection = ol.projection.get('GOOGLE');
|
||||||
expect(googleProjection.getPointResolution(1, new ol.Coordinate(0, 0))).
|
expect(googleProjection.getPointResolution(1, new ol.Coordinate(0, 0))).
|
||||||
toRoughlyEqual(1, 1e-1);
|
toRoughlyEqual(1, 1e-1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('numerically estimates point scale at various latitudes', function() {
|
it('numerically estimates point scale at various latitudes', function() {
|
||||||
var epsg3857Projection = ol.projection.getFromCode('EPSG:3857');
|
var epsg3857Projection = ol.projection.get('EPSG:3857');
|
||||||
var googleProjection = ol.projection.getFromCode('GOOGLE');
|
var googleProjection = ol.projection.get('GOOGLE');
|
||||||
var point, y;
|
var point, y;
|
||||||
for (y = -20; y <= 20; ++y) {
|
for (y = -20; y <= 20; ++y) {
|
||||||
point = new ol.Coordinate(0, 1000000 * y);
|
point = new ol.Coordinate(0, 1000000 * y);
|
||||||
@@ -178,8 +178,8 @@ describe('ol.projection', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('numerically estimates point scale at various points', function() {
|
it('numerically estimates point scale at various points', function() {
|
||||||
var epsg3857Projection = ol.projection.getFromCode('EPSG:3857');
|
var epsg3857Projection = ol.projection.get('EPSG:3857');
|
||||||
var googleProjection = ol.projection.getFromCode('GOOGLE');
|
var googleProjection = ol.projection.get('GOOGLE');
|
||||||
var point, x, y;
|
var point, x, y;
|
||||||
for (x = -20; x <= 20; ++x) {
|
for (x = -20; x <= 20; ++x) {
|
||||||
for (y = -20; y <= 20; ++y) {
|
for (y = -20; y <= 20; ++y) {
|
||||||
@@ -192,13 +192,13 @@ describe('ol.projection', function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('ol.projection.getTransform()', function() {
|
describe('ol.projection.getTransformFromProjections()', function() {
|
||||||
|
|
||||||
var sm = ol.projection.getFromCode('GOOGLE');
|
var sm = ol.projection.get('GOOGLE');
|
||||||
var gg = ol.projection.getFromCode('EPSG:4326');
|
var gg = ol.projection.get('EPSG:4326');
|
||||||
|
|
||||||
it('returns a transform function', function() {
|
it('returns a transform function', function() {
|
||||||
var transform = ol.projection.getTransform(sm, gg);
|
var transform = ol.projection.getTransformFromProjections(sm, gg);
|
||||||
expect(typeof transform).toBe('function');
|
expect(typeof transform).toBe('function');
|
||||||
|
|
||||||
var output = transform([-12000000, 5000000]);
|
var output = transform([-12000000, 5000000]);
|
||||||
@@ -208,7 +208,7 @@ describe('ol.projection', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('works for longer arrays', function() {
|
it('works for longer arrays', function() {
|
||||||
var transform = ol.projection.getTransform(sm, gg);
|
var transform = ol.projection.getTransformFromProjections(sm, gg);
|
||||||
expect(typeof transform).toBe('function');
|
expect(typeof transform).toBe('function');
|
||||||
|
|
||||||
var output = transform([-12000000, 5000000, -12000000, 5000000]);
|
var output = transform([-12000000, 5000000, -12000000, 5000000]);
|
||||||
@@ -221,17 +221,15 @@ describe('ol.projection', function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('ol.projection.getTransformFromCodes()', function() {
|
describe('ol.projection.getTransform()', function() {
|
||||||
|
|
||||||
it('returns a function', function() {
|
it('returns a function', function() {
|
||||||
var transform = ol.projection.getTransformFromCodes(
|
var transform = ol.projection.getTransform('GOOGLE', 'EPSG:4326');
|
||||||
'GOOGLE', 'EPSG:4326');
|
|
||||||
expect(typeof transform).toBe('function');
|
expect(typeof transform).toBe('function');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns a transform function', function() {
|
it('returns a transform function', function() {
|
||||||
var transform = ol.projection.getTransformFromCodes(
|
var transform = ol.projection.getTransform('GOOGLE', 'EPSG:4326');
|
||||||
'GOOGLE', 'EPSG:4326');
|
|
||||||
expect(typeof transform).toBe('function');
|
expect(typeof transform).toBe('function');
|
||||||
|
|
||||||
var output = transform([-626172.13571216376, 6887893.4928337997]);
|
var output = transform([-626172.13571216376, 6887893.4928337997]);
|
||||||
@@ -242,8 +240,7 @@ describe('ol.projection', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('works for longer arrays of coordinate values', function() {
|
it('works for longer arrays of coordinate values', function() {
|
||||||
var transform = ol.projection.getTransformFromCodes(
|
var transform = ol.projection.getTransform('GOOGLE', 'EPSG:4326');
|
||||||
'GOOGLE', 'EPSG:4326');
|
|
||||||
expect(typeof transform).toBe('function');
|
expect(typeof transform).toBe('function');
|
||||||
|
|
||||||
var output = transform([
|
var output = transform([
|
||||||
@@ -261,8 +258,7 @@ describe('ol.projection', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('accepts an optional destination array', function() {
|
it('accepts an optional destination array', function() {
|
||||||
var transform = ol.projection.getTransformFromCodes(
|
var transform = ol.projection.getTransform('EPSG:3857', 'EPSG:4326');
|
||||||
'EPSG:3857', 'EPSG:4326');
|
|
||||||
var input = [-12000000, 5000000];
|
var input = [-12000000, 5000000];
|
||||||
var output = [];
|
var output = [];
|
||||||
|
|
||||||
@@ -276,8 +272,7 @@ describe('ol.projection', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('accepts a dimension', function() {
|
it('accepts a dimension', function() {
|
||||||
var transform = ol.projection.getTransformFromCodes(
|
var transform = ol.projection.getTransform('GOOGLE', 'EPSG:4326');
|
||||||
'GOOGLE', 'EPSG:4326');
|
|
||||||
expect(typeof transform).toBe('function');
|
expect(typeof transform).toBe('function');
|
||||||
|
|
||||||
var dimension = 3;
|
var dimension = 3;
|
||||||
@@ -331,7 +326,7 @@ describe('ol.projection', function() {
|
|||||||
describe('ol.Projection.prototype.getMetersPerUnit()', function() {
|
describe('ol.Projection.prototype.getMetersPerUnit()', function() {
|
||||||
|
|
||||||
it('returns value in meters', function() {
|
it('returns value in meters', function() {
|
||||||
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
var epsg4326 = ol.projection.get('EPSG:4326');
|
||||||
expect(epsg4326.getMetersPerUnit()).toEqual(111194.87428468118);
|
expect(epsg4326.getMetersPerUnit()).toEqual(111194.87428468118);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ describe('ol.source.TileSource', function() {
|
|||||||
describe('constructor', function() {
|
describe('constructor', function() {
|
||||||
it('returns a tile source', function() {
|
it('returns a tile source', function() {
|
||||||
var source = new ol.source.TileSource({
|
var source = new ol.source.TileSource({
|
||||||
projection: ol.projection.getFromCode('EPSG:4326')
|
projection: ol.projection.get('EPSG:4326')
|
||||||
});
|
});
|
||||||
expect(source).toBeA(ol.source.Source);
|
expect(source).toBeA(ol.source.Source);
|
||||||
expect(source).toBeA(ol.source.TileSource);
|
expect(source).toBeA(ol.source.TileSource);
|
||||||
@@ -202,7 +202,7 @@ ol.test.source.MockTileSource = function(loaded) {
|
|||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
extent: extent,
|
extent: extent,
|
||||||
projection: ol.projection.getFromCode('EPSG:4326'),
|
projection: ol.projection.get('EPSG:4326'),
|
||||||
tileGrid: tileGrid
|
tileGrid: tileGrid
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
|||||||
describe('createForProjection', function() {
|
describe('createForProjection', function() {
|
||||||
|
|
||||||
it('allows easier creation of a tile grid', function() {
|
it('allows easier creation of a tile grid', function() {
|
||||||
var projection = ol.projection.getFromCode('EPSG:3857');
|
var projection = ol.projection.get('EPSG:3857');
|
||||||
var grid = ol.tilegrid.createForProjection(projection);
|
var grid = ol.tilegrid.createForProjection(projection);
|
||||||
expect(grid).toBeA(ol.tilegrid.TileGrid);
|
expect(grid).toBeA(ol.tilegrid.TileGrid);
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('accepts a number of zoom levels', function() {
|
it('accepts a number of zoom levels', function() {
|
||||||
var projection = ol.projection.getFromCode('EPSG:3857');
|
var projection = ol.projection.get('EPSG:3857');
|
||||||
var grid = ol.tilegrid.createForProjection(projection, 18);
|
var grid = ol.tilegrid.createForProjection(projection, 18);
|
||||||
expect(grid).toBeA(ol.tilegrid.TileGrid);
|
expect(grid).toBeA(ol.tilegrid.TileGrid);
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('accepts a big number of zoom levels', function() {
|
it('accepts a big number of zoom levels', function() {
|
||||||
var projection = ol.projection.getFromCode('EPSG:3857');
|
var projection = ol.projection.get('EPSG:3857');
|
||||||
var grid = ol.tilegrid.createForProjection(projection, 23);
|
var grid = ol.tilegrid.createForProjection(projection, 23);
|
||||||
expect(grid).toBeA(ol.tilegrid.TileGrid);
|
expect(grid).toBeA(ol.tilegrid.TileGrid);
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
|||||||
describe('getForProjection', function() {
|
describe('getForProjection', function() {
|
||||||
|
|
||||||
it('gets the default tile grid for a projection', function() {
|
it('gets the default tile grid for a projection', function() {
|
||||||
var projection = ol.projection.getFromCode('EPSG:3857');
|
var projection = ol.projection.get('EPSG:3857');
|
||||||
var grid = ol.tilegrid.getForProjection(projection);
|
var grid = ol.tilegrid.getForProjection(projection);
|
||||||
expect(grid).toBeA(ol.tilegrid.TileGrid);
|
expect(grid).toBeA(ol.tilegrid.TileGrid);
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('stores the default tile grid on a projection', function() {
|
it('stores the default tile grid on a projection', function() {
|
||||||
var projection = ol.projection.getFromCode('EPSG:3857');
|
var projection = ol.projection.get('EPSG:3857');
|
||||||
var grid = ol.tilegrid.getForProjection(projection);
|
var grid = ol.tilegrid.getForProjection(projection);
|
||||||
var gridAgain = ol.tilegrid.getForProjection(projection);
|
var gridAgain = ol.tilegrid.getForProjection(projection);
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ describe('ol.TileUrlFunction', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('creates expected URL', function() {
|
it('creates expected URL', function() {
|
||||||
var epsg3857 = ol.projection.getFromCode('EPSG:3857');
|
var epsg3857 = ol.projection.get('EPSG:3857');
|
||||||
var tileUrlFunction = ol.TileUrlFunction.createWMSParams(
|
var tileUrlFunction = ol.TileUrlFunction.createWMSParams(
|
||||||
'http://wms?foo=bar', {});
|
'http://wms?foo=bar', {});
|
||||||
var tileCoord = new ol.TileCoord(1, 0, 0);
|
var tileCoord = new ol.TileCoord(1, 0, 0);
|
||||||
@@ -81,7 +81,7 @@ describe('ol.TileUrlFunction', function() {
|
|||||||
expect(tileUrl).toEqual(expected);
|
expect(tileUrl).toEqual(expected);
|
||||||
});
|
});
|
||||||
it('creates expected URL respecting axis orientation', function() {
|
it('creates expected URL respecting axis orientation', function() {
|
||||||
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
var epsg4326 = ol.projection.get('EPSG:4326');
|
||||||
var tileUrlFunction = ol.TileUrlFunction.createWMSParams(
|
var tileUrlFunction = ol.TileUrlFunction.createWMSParams(
|
||||||
'http://wms?foo=bar', {});
|
'http://wms?foo=bar', {});
|
||||||
var tileCoord = new ol.TileCoord(1, 0, 0);
|
var tileCoord = new ol.TileCoord(1, 0, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user