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
+4 -4
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. * @return {ol.Extent} Extent.
*/ */
ol.Extent.prototype.transform = function(transform) { ol.Extent.prototype.transform = function(transformFn) {
var min = transform(new ol.Coordinate(this.minX, this.minY)); var min = transformFn(new ol.Coordinate(this.minX, this.minY));
var max = transform(new ol.Coordinate(this.maxX, this.maxY)); var max = transformFn(new ol.Coordinate(this.maxX, this.maxY));
return new ol.Extent(min.x, min.y, max.x, max.y); return new ol.Extent(min.x, min.y, max.x, max.y);
}; };
+3 -2
View File
@@ -16,9 +16,10 @@ function testClone() {
function testTransform() { 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 sourceExtent = new ol.Extent(-15, -30, 45, 60);
var destinationExtent = sourceExtent.transform(transform); var destinationExtent = sourceExtent.transform(transformFn);
assertNotNullNorUndefined(destinationExtent); assertNotNullNorUndefined(destinationExtent);
// FIXME check values with third-party tool // FIXME check values with third-party tool
assertRoughlyEquals(-1669792.3618991037, destinationExtent.minX, 1e-9); assertRoughlyEquals(-1669792.3618991037, destinationExtent.minX, 1e-9);
+9 -9
View File
@@ -140,9 +140,9 @@ ol.Projection.addProjections = function(projections) {
/** /**
* @param {ol.Projection} source Source. * @param {ol.Projection} source Source.
* @param {ol.Projection} destination Destination. * @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 projections = ol.Projection.projections_;
var sourceCode = source.getCode(); var sourceCode = source.getCode();
goog.asserts.assert(goog.object.containsKey(projections, sourceCode)); goog.asserts.assert(goog.object.containsKey(projections, sourceCode));
@@ -154,7 +154,7 @@ ol.Projection.addTransform = function(source, destination, transform) {
} }
goog.asserts.assert( goog.asserts.assert(
!goog.object.containsKey(transforms[sourceCode], destinationCode)); !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()) { } else if (projection1.getUnits() != projection2.getUnits()) {
return false; return false;
} else { } else {
var transform = ol.Projection.getTransform(projection1, projection2); var transformFn = ol.Projection.getTransform(projection1, projection2);
return transform === ol.Projection.cloneTransform; return transformFn === ol.Projection.cloneTransform;
} }
}; };
@@ -239,8 +239,8 @@ ol.Projection.cloneTransform = function(point) {
* @return {ol.Coordinate} Point. * @return {ol.Coordinate} Point.
*/ */
ol.Projection.transform = function(point, source, destination) { ol.Projection.transform = function(point, source, destination) {
var transform = ol.Projection.getTransform(source, destination); var transformFn = ol.Projection.getTransform(source, destination);
return transform(point); return transformFn(point);
}; };
@@ -252,9 +252,9 @@ ol.Projection.transform = function(point, source, destination) {
*/ */
ol.Projection.transformWithCodes = ol.Projection.transformWithCodes =
function(point, sourceCode, destinationCode) { function(point, sourceCode, destinationCode) {
var transform = ol.Projection.getTransformFromCodes( var transformFn = ol.Projection.getTransformFromCodes(
sourceCode, destinationCode); sourceCode, destinationCode);
return transform(point); return transformFn(point);
}; };
+3 -3
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. * @param {ol.TileUrlFunctionType} tileUrlFunction Tile URL function.
* @return {ol.TileUrlFunctionType} Tile URL function. * @return {ol.TileUrlFunctionType} Tile URL function.
*/ */
ol.TileUrlFunction.withTileCoordTransform = ol.TileUrlFunction.withTileCoordTransform =
function(transform, tileUrlFunction) { function(transformFn, tileUrlFunction) {
return function(tileCoord) { return function(tileCoord) {
if (goog.isNull(tileCoord)) { if (goog.isNull(tileCoord)) {
return undefined; return undefined;
} else { } else {
return tileUrlFunction(transform(tileCoord)); return tileUrlFunction(transformFn(tileCoord));
} }
}; };
}; };