Introduce tile-pixels units

This commit is contained in:
Andreas Hocevar
2015-10-13 14:15:30 +02:00
parent 05dfc226b7
commit 8f4756c99b
2 changed files with 8 additions and 1 deletions

View File

@@ -2,10 +2,12 @@ goog.provide('ol.geom.Geometry');
goog.provide('ol.geom.GeometryLayout');
goog.provide('ol.geom.GeometryType');
goog.require('goog.asserts');
goog.require('goog.functions');
goog.require('ol.Object');
goog.require('ol.extent');
goog.require('ol.proj');
goog.require('ol.proj.Units');
/**
@@ -250,6 +252,9 @@ ol.geom.Geometry.prototype.translate = goog.abstractMethod;
* @api stable
*/
ol.geom.Geometry.prototype.transform = function(source, destination) {
goog.asserts.assert(
ol.proj.get(source).getUnits() !== ol.proj.Units.TILE_PIXELS,
'cannot transform geometries with TILE_PIXELS units');
this.applyTransform(ol.proj.getTransform(source, destination));
return this;
};

View File

@@ -23,7 +23,8 @@ ol.proj.ProjectionLike;
/**
* Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, or `'us-ft'`.
* Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, `'tile-pixels'` or
* `'us-ft'`.
* @enum {string}
* @api stable
*/
@@ -32,6 +33,7 @@ ol.proj.Units = {
FEET: 'ft',
METERS: 'm',
PIXELS: 'pixels',
TILE_PIXELS: 'tile-pixels',
USFEET: 'us-ft'
};