change indentation.

This commit is contained in:
Marc Jansen
2012-06-19 10:56:01 +02:00
parent a6fa08550f
commit b1e26fab1d
4 changed files with 151 additions and 137 deletions

View File

@@ -15,45 +15,48 @@ 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;
}
if (loc instanceof ol.Loc) {
return loc;
}
var x = 0;
var y = 0;
var z;
var projection;
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 (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');
}
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);
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();
}
};

View File

@@ -16,31 +16,34 @@ 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;
/** @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');
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();
var map = new ol.Map();
return map;
return map;
};

View File

@@ -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();
}
};

View File

@@ -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.x_ = x;
/**
* @private
* @type {number}
*/
this.y_ = y;
/**
* @private
* @type {number}
*/
this.y_ = y;
/**
* @private
* @type {number|undefined}
*/
this.z_ = opt_z;
/**
* @private
* @type {number|undefined}
*/
this.z_ = opt_z;
/**
* @private
* @type {ol.Projection|undefined}
*/
this.projection_ = opt_projection;
/**
* @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;
};