s/transform/transformFn/

This commit is contained in:
Tom Payne
2012-07-30 21:37:25 +02:00
parent 95371b596e
commit ab8d297827
4 changed files with 19 additions and 18 deletions

View File

@@ -49,11 +49,11 @@ ol.Extent.prototype.clone = function() {
/**
* @param {ol.TransformFunction} transform Transform.
* @param {ol.TransformFunction} transformFn Transform function.
* @return {ol.Extent} Extent.
*/
ol.Extent.prototype.transform = function(transform) {
var min = transform(new ol.Coordinate(this.minX, this.minY));
var max = transform(new ol.Coordinate(this.maxX, this.maxY));
ol.Extent.prototype.transform = function(transformFn) {
var min = transformFn(new ol.Coordinate(this.minX, this.minY));
var max = transformFn(new ol.Coordinate(this.maxX, this.maxY));
return new ol.Extent(min.x, min.y, max.x, max.y);
};

View File

@@ -16,9 +16,10 @@ function testClone() {
function testTransform() {
var transform = ol.Projection.getTransformFromCodes('EPSG:4326', 'EPSG:3857');
var transformFn =
ol.Projection.getTransformFromCodes('EPSG:4326', 'EPSG:3857');
var sourceExtent = new ol.Extent(-15, -30, 45, 60);
var destinationExtent = sourceExtent.transform(transform);
var destinationExtent = sourceExtent.transform(transformFn);
assertNotNullNorUndefined(destinationExtent);
// FIXME check values with third-party tool
assertRoughlyEquals(-1669792.3618991037, destinationExtent.minX, 1e-9);

View File

@@ -140,9 +140,9 @@ ol.Projection.addProjections = function(projections) {
/**
* @param {ol.Projection} source Source.
* @param {ol.Projection} destination Destination.
* @param {ol.TransformFunction} transform Transform.
* @param {ol.TransformFunction} transformFn Transform.
*/
ol.Projection.addTransform = function(source, destination, transform) {
ol.Projection.addTransform = function(source, destination, transformFn) {
var projections = ol.Projection.projections_;
var sourceCode = source.getCode();
goog.asserts.assert(goog.object.containsKey(projections, sourceCode));
@@ -154,7 +154,7 @@ ol.Projection.addTransform = function(source, destination, transform) {
}
goog.asserts.assert(
!goog.object.containsKey(transforms[sourceCode], destinationCode));
transforms[sourceCode][destinationCode] = transform;
transforms[sourceCode][destinationCode] = transformFn;
};
@@ -180,8 +180,8 @@ ol.Projection.equivalent = function(projection1, projection2) {
} else if (projection1.getUnits() != projection2.getUnits()) {
return false;
} else {
var transform = ol.Projection.getTransform(projection1, projection2);
return transform === ol.Projection.cloneTransform;
var transformFn = ol.Projection.getTransform(projection1, projection2);
return transformFn === ol.Projection.cloneTransform;
}
};
@@ -239,8 +239,8 @@ ol.Projection.cloneTransform = function(point) {
* @return {ol.Coordinate} Point.
*/
ol.Projection.transform = function(point, source, destination) {
var transform = ol.Projection.getTransform(source, destination);
return transform(point);
var transformFn = ol.Projection.getTransform(source, destination);
return transformFn(point);
};
@@ -252,9 +252,9 @@ ol.Projection.transform = function(point, source, destination) {
*/
ol.Projection.transformWithCodes =
function(point, sourceCode, destinationCode) {
var transform = ol.Projection.getTransformFromCodes(
var transformFn = ol.Projection.getTransformFromCodes(
sourceCode, destinationCode);
return transform(point);
return transformFn(point);
};

View File

@@ -64,17 +64,17 @@ ol.TileUrlFunction.nullTileUrlFunction = function(tileCoord) {
/**
* @param {function(ol.TileCoord): ol.TileCoord} transform Transform.
* @param {function(ol.TileCoord): ol.TileCoord} transformFn Transform.function.
* @param {ol.TileUrlFunctionType} tileUrlFunction Tile URL function.
* @return {ol.TileUrlFunctionType} Tile URL function.
*/
ol.TileUrlFunction.withTileCoordTransform =
function(transform, tileUrlFunction) {
function(transformFn, tileUrlFunction) {
return function(tileCoord) {
if (goog.isNull(tileCoord)) {
return undefined;
} else {
return tileUrlFunction(transform(tileCoord));
return tileUrlFunction(transformFn(tileCoord));
}
};
};