From b1e26fab1d4ad3ef98f82c9c2edcd4d1d84b5c93 Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Tue, 19 Jun 2012 10:56:01 +0200 Subject: [PATCH] change indentation. --- src/api/loc.js | 129 ++++++++++++++++++++++-------------------- src/api/map.js | 51 +++++++++-------- src/api/projection.js | 38 +++++++------ src/ol/Loc.js | 70 +++++++++++------------ 4 files changed, 151 insertions(+), 137 deletions(-) diff --git a/src/api/loc.js b/src/api/loc.js index 65e1be4014..74138b049a 100644 --- a/src/api/loc.js +++ b/src/api/loc.js @@ -15,46 +15,49 @@ ol.LocLike; * @param {ol.LocLike} loc Location. * @return {ol.Loc} Location. */ -ol.loc = function(loc) { +ol.loc = function(loc){ - if (loc instanceof ol.Loc) { - return loc; - } - - var x = 0; - var y = 0; - var z; - var projection; - - if (goog.isArray(loc)) { - if (loc.length >= 1) { - x = loc[0]; - if (loc.length >= 2) { - y = loc[1]; - if (loc.length >= 3) { - z = loc[2]; + if (loc instanceof ol.Loc) { + return loc; + } + + var x = 0; + var y = 0; + var z; + var projection; + + if (goog.isArray(loc)) { + if (loc.length >= 1) { + x = loc[0]; + if (loc.length >= 2) { + y = loc[1]; + if (loc.length >= 3) { + z = loc[2]; + } + } } - } } - } else if (goog.isObject(loc)) { - if (goog.isDef(loc.x)) { - x = loc.x; - } - if (goog.isDef(loc.y)) { - y = loc.y; - } - if (goog.isDef(loc.z)) { - z = loc.z; - } - if (goog.isDef(loc.projection)) { - projection = loc.projection; - } - } else { - throw new Error('ol.loc'); - } - - return new ol.Loc(x, y, z, projection); - + else + if (goog.isObject(loc)) { + if (goog.isDef(loc.x)) { + x = loc.x; + } + if (goog.isDef(loc.y)) { + y = loc.y; + } + if (goog.isDef(loc.z)) { + z = loc.z; + } + if (goog.isDef(loc.projection)) { + projection = loc.projection; + } + } + else { + throw new Error('ol.loc'); + } + + return new ol.Loc(x, y, z, projection); + }; @@ -63,12 +66,13 @@ ol.loc = function(loc) { * @param {ol.Projection=} opt_arg Projection. * @return {ol.Loc|ol.Projection|undefined} Result. */ -ol.Loc.prototype.projection = function(opt_arg) { - if (arguments.length == 1 && goog.isDef(opt_arg)) { - return this.setProjection(opt_arg); - } else { - return this.getProjection(); - } +ol.Loc.prototype.projection = function(opt_arg){ + if (arguments.length == 1 && goog.isDef(opt_arg)) { + return this.setProjection(opt_arg); + } + else { + return this.getProjection(); + } }; @@ -77,12 +81,13 @@ ol.Loc.prototype.projection = function(opt_arg) { * @param {number=} opt_arg X. * @return {ol.Loc|number} Result. */ -ol.Loc.prototype.x = function(opt_arg) { - if (arguments.length == 1 && goog.isDef(opt_arg)) { - return this.setX(opt_arg); - } else { - return this.getX(); - } +ol.Loc.prototype.x = function(opt_arg){ + if (arguments.length == 1 && goog.isDef(opt_arg)) { + return this.setX(opt_arg); + } + else { + return this.getX(); + } }; @@ -91,12 +96,13 @@ ol.Loc.prototype.x = function(opt_arg) { * @param {number=} opt_arg Y. * @return {ol.Loc|number} Result. */ -ol.Loc.prototype.y = function(opt_arg) { - if (arguments.length == 1 && goog.isDef(opt_arg)) { - return this.setY(opt_arg); - } else { - return this.getY(); - } +ol.Loc.prototype.y = function(opt_arg){ + if (arguments.length == 1 && goog.isDef(opt_arg)) { + return this.setY(opt_arg); + } + else { + return this.getY(); + } }; @@ -105,10 +111,11 @@ ol.Loc.prototype.y = function(opt_arg) { * @param {number=} opt_arg Z. * @return {ol.Loc|number|undefined} Result. */ -ol.Loc.prototype.z = function(opt_arg) { - if (arguments.length == 1 && goog.isDef(opt_arg)) { - return this.setZ(opt_arg); - } else { - return this.getZ(); - } +ol.Loc.prototype.z = function(opt_arg){ + if (arguments.length == 1 && goog.isDef(opt_arg)) { + return this.setZ(opt_arg); + } + else { + return this.getZ(); + } }; diff --git a/src/api/map.js b/src/api/map.js index 82c95f90e2..72390f61b6 100644 --- a/src/api/map.js +++ b/src/api/map.js @@ -16,32 +16,35 @@ ol.MapLike; * @param {ol.MapLike=} opt_arg Argument. * @return {ol.Map} Map. */ -ol.map = function(opt_arg) { +ol.map = function(opt_arg){ - /** @type {ol.Loc|undefined} */ - var center; - var target; - - if (arguments.length == 1) { - if (opt_arg instanceof ol.Map) { - return opt_arg; - } else if (goog.isObject(opt_arg)) { - var config = opt_arg; - if (goog.isDef(config.center)) { - center = ol.loc(config.center); - } - if (goog.isDef(config.target)) { - target = config.target; - } - } else { - throw new Error('ol.map'); + /** @type {ol.Loc|undefined} */ + var center; + var target; + + if (arguments.length == 1) { + if (opt_arg instanceof ol.Map) { + return opt_arg; + } + else + if (goog.isObject(opt_arg)) { + var config = opt_arg; + if (goog.isDef(config.center)) { + center = ol.loc(config.center); + } + if (goog.isDef(config.target)) { + target = config.target; + } + } + else { + throw new Error('ol.map'); + } } - } - - var map = new ol.Map(); - - return map; - + + var map = new ol.Map(); + + return map; + }; /** diff --git a/src/api/projection.js b/src/api/projection.js index 2efaf32fe1..403fc88d0e 100644 --- a/src/api/projection.js +++ b/src/api/projection.js @@ -14,18 +14,21 @@ ol.ProjectionLike; * @param {ol.ProjectionLike=} opt_arg Argument. * @return {ol.Projection} Projection. */ -ol.projection = function(opt_arg) { - var code; - if (arguments.length == 1) { - if (opt_arg instanceof ol.Projection) { - return opt_arg; - } else if (goog.isString(arguments[0])) { - code = arguments[0]; - } else { - throw new Error('ol.projection'); +ol.projection = function(opt_arg){ + var code; + if (arguments.length == 1) { + if (opt_arg instanceof ol.Projection) { + return opt_arg; + } + else + if (goog.isString(arguments[0])) { + code = arguments[0]; + } + else { + throw new Error('ol.projection'); + } } - } - return new ol.Projection(code); + return new ol.Projection(code); }; @@ -34,10 +37,11 @@ ol.projection = function(opt_arg) { * @param {string=} opt_code Code. * @return {ol.Projection|string} Result. */ -ol.Projection.prototype.code = function(opt_code) { - if (goog.isDef(opt_code)) { - return this.setCode(opt_code); - } else { - return this.getCode(); - } +ol.Projection.prototype.code = function(opt_code){ + if (goog.isDef(opt_code)) { + return this.setCode(opt_code); + } + else { + return this.getCode(); + } }; diff --git a/src/ol/Loc.js b/src/ol/Loc.js index 9995defd74..38386fd1d6 100644 --- a/src/ol/Loc.js +++ b/src/ol/Loc.js @@ -13,29 +13,29 @@ goog.require('ol.Projection'); */ ol.Loc = function(x, y, opt_z, opt_projection) { - /** - * @private - * @type {number} - */ - this.x_ = x; - - /** - * @private - * @type {number} - */ - this.y_ = y; - - /** - * @private - * @type {number|undefined} - */ - this.z_ = opt_z; - - /** - * @private - * @type {ol.Projection|undefined} - */ - this.projection_ = opt_projection; + /** + * @private + * @type {number} + */ + this.x_ = x; + + /** + * @private + * @type {number} + */ + this.y_ = y; + + /** + * @private + * @type {number|undefined} + */ + this.z_ = opt_z; + + /** + * @private + * @type {ol.Projection|undefined} + */ + this.projection_ = opt_projection; }; @@ -44,7 +44,7 @@ ol.Loc = function(x, y, opt_z, opt_projection) { * @return {ol.Projection|undefined} Projection. */ ol.Loc.prototype.getProjection = function() { - return this.projection_; + return this.projection_; }; @@ -52,7 +52,7 @@ ol.Loc.prototype.getProjection = function() { * @return {number} X. */ ol.Loc.prototype.getX = function() { - return this.x_; + return this.x_; }; @@ -60,7 +60,7 @@ ol.Loc.prototype.getX = function() { * @return {number} Y. */ ol.Loc.prototype.getY = function() { - return this.y_; + return this.y_; }; @@ -68,7 +68,7 @@ ol.Loc.prototype.getY = function() { * @return {number|undefined} Z. */ ol.Loc.prototype.getZ = function() { - return this.z_; + return this.z_; }; @@ -77,8 +77,8 @@ ol.Loc.prototype.getZ = function() { * @return {ol.Loc} This. */ ol.Loc.prototype.setProjection = function(projection) { - this.projection_ = projection; - return this; + this.projection_ = projection; + return this; }; @@ -87,8 +87,8 @@ ol.Loc.prototype.setProjection = function(projection) { * @return {ol.Loc} This. */ ol.Loc.prototype.setX = function(x) { - this.x_ = x; - return this; + this.x_ = x; + return this; }; @@ -97,8 +97,8 @@ ol.Loc.prototype.setX = function(x) { * @return {ol.Loc} This. */ ol.Loc.prototype.setY = function(y) { - this.y_ = y; - return this; + this.y_ = y; + return this; }; @@ -107,8 +107,8 @@ ol.Loc.prototype.setY = function(y) { * @return {ol.Loc} This. */ ol.Loc.prototype.setZ = function(z) { - this.z_ = z; - return this; + this.z_ = z; + return this; };