change indentation.
This commit is contained in:
129
src/api/loc.js
129
src/api/loc.js
@@ -15,46 +15,49 @@ ol.LocLike;
|
|||||||
* @param {ol.LocLike} loc Location.
|
* @param {ol.LocLike} loc Location.
|
||||||
* @return {ol.Loc} Location.
|
* @return {ol.Loc} Location.
|
||||||
*/
|
*/
|
||||||
ol.loc = function(loc) {
|
ol.loc = function(loc){
|
||||||
|
|
||||||
if (loc instanceof ol.Loc) {
|
if (loc instanceof ol.Loc) {
|
||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
var x = 0;
|
var x = 0;
|
||||||
var y = 0;
|
var y = 0;
|
||||||
var z;
|
var z;
|
||||||
var projection;
|
var projection;
|
||||||
|
|
||||||
if (goog.isArray(loc)) {
|
if (goog.isArray(loc)) {
|
||||||
if (loc.length >= 1) {
|
if (loc.length >= 1) {
|
||||||
x = loc[0];
|
x = loc[0];
|
||||||
if (loc.length >= 2) {
|
if (loc.length >= 2) {
|
||||||
y = loc[1];
|
y = loc[1];
|
||||||
if (loc.length >= 3) {
|
if (loc.length >= 3) {
|
||||||
z = loc[2];
|
z = loc[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (goog.isObject(loc)) {
|
else
|
||||||
if (goog.isDef(loc.x)) {
|
if (goog.isObject(loc)) {
|
||||||
x = loc.x;
|
if (goog.isDef(loc.x)) {
|
||||||
}
|
x = loc.x;
|
||||||
if (goog.isDef(loc.y)) {
|
}
|
||||||
y = loc.y;
|
if (goog.isDef(loc.y)) {
|
||||||
}
|
y = loc.y;
|
||||||
if (goog.isDef(loc.z)) {
|
}
|
||||||
z = loc.z;
|
if (goog.isDef(loc.z)) {
|
||||||
}
|
z = loc.z;
|
||||||
if (goog.isDef(loc.projection)) {
|
}
|
||||||
projection = loc.projection;
|
if (goog.isDef(loc.projection)) {
|
||||||
}
|
projection = loc.projection;
|
||||||
} else {
|
}
|
||||||
throw new Error('ol.loc');
|
}
|
||||||
}
|
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.
|
* @param {ol.Projection=} opt_arg Projection.
|
||||||
* @return {ol.Loc|ol.Projection|undefined} Result.
|
* @return {ol.Loc|ol.Projection|undefined} Result.
|
||||||
*/
|
*/
|
||||||
ol.Loc.prototype.projection = function(opt_arg) {
|
ol.Loc.prototype.projection = function(opt_arg){
|
||||||
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
||||||
return this.setProjection(opt_arg);
|
return this.setProjection(opt_arg);
|
||||||
} else {
|
}
|
||||||
return this.getProjection();
|
else {
|
||||||
}
|
return this.getProjection();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -77,12 +81,13 @@ ol.Loc.prototype.projection = function(opt_arg) {
|
|||||||
* @param {number=} opt_arg X.
|
* @param {number=} opt_arg X.
|
||||||
* @return {ol.Loc|number} Result.
|
* @return {ol.Loc|number} Result.
|
||||||
*/
|
*/
|
||||||
ol.Loc.prototype.x = function(opt_arg) {
|
ol.Loc.prototype.x = function(opt_arg){
|
||||||
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
||||||
return this.setX(opt_arg);
|
return this.setX(opt_arg);
|
||||||
} else {
|
}
|
||||||
return this.getX();
|
else {
|
||||||
}
|
return this.getX();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -91,12 +96,13 @@ ol.Loc.prototype.x = function(opt_arg) {
|
|||||||
* @param {number=} opt_arg Y.
|
* @param {number=} opt_arg Y.
|
||||||
* @return {ol.Loc|number} Result.
|
* @return {ol.Loc|number} Result.
|
||||||
*/
|
*/
|
||||||
ol.Loc.prototype.y = function(opt_arg) {
|
ol.Loc.prototype.y = function(opt_arg){
|
||||||
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
||||||
return this.setY(opt_arg);
|
return this.setY(opt_arg);
|
||||||
} else {
|
}
|
||||||
return this.getY();
|
else {
|
||||||
}
|
return this.getY();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -105,10 +111,11 @@ ol.Loc.prototype.y = function(opt_arg) {
|
|||||||
* @param {number=} opt_arg Z.
|
* @param {number=} opt_arg Z.
|
||||||
* @return {ol.Loc|number|undefined} Result.
|
* @return {ol.Loc|number|undefined} Result.
|
||||||
*/
|
*/
|
||||||
ol.Loc.prototype.z = function(opt_arg) {
|
ol.Loc.prototype.z = function(opt_arg){
|
||||||
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
||||||
return this.setZ(opt_arg);
|
return this.setZ(opt_arg);
|
||||||
} else {
|
}
|
||||||
return this.getZ();
|
else {
|
||||||
}
|
return this.getZ();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,32 +16,35 @@ ol.MapLike;
|
|||||||
* @param {ol.MapLike=} opt_arg Argument.
|
* @param {ol.MapLike=} opt_arg Argument.
|
||||||
* @return {ol.Map} Map.
|
* @return {ol.Map} Map.
|
||||||
*/
|
*/
|
||||||
ol.map = function(opt_arg) {
|
ol.map = function(opt_arg){
|
||||||
|
|
||||||
/** @type {ol.Loc|undefined} */
|
/** @type {ol.Loc|undefined} */
|
||||||
var center;
|
var center;
|
||||||
var target;
|
var target;
|
||||||
|
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1) {
|
||||||
if (opt_arg instanceof ol.Map) {
|
if (opt_arg instanceof ol.Map) {
|
||||||
return opt_arg;
|
return opt_arg;
|
||||||
} else if (goog.isObject(opt_arg)) {
|
}
|
||||||
var config = opt_arg;
|
else
|
||||||
if (goog.isDef(config.center)) {
|
if (goog.isObject(opt_arg)) {
|
||||||
center = ol.loc(config.center);
|
var config = opt_arg;
|
||||||
}
|
if (goog.isDef(config.center)) {
|
||||||
if (goog.isDef(config.target)) {
|
center = ol.loc(config.center);
|
||||||
target = config.target;
|
}
|
||||||
}
|
if (goog.isDef(config.target)) {
|
||||||
} else {
|
target = config.target;
|
||||||
throw new Error('ol.map');
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Error('ol.map');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
var map = new ol.Map();
|
||||||
var map = new ol.Map();
|
|
||||||
|
return map;
|
||||||
return map;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,18 +14,21 @@ ol.ProjectionLike;
|
|||||||
* @param {ol.ProjectionLike=} opt_arg Argument.
|
* @param {ol.ProjectionLike=} opt_arg Argument.
|
||||||
* @return {ol.Projection} Projection.
|
* @return {ol.Projection} Projection.
|
||||||
*/
|
*/
|
||||||
ol.projection = function(opt_arg) {
|
ol.projection = function(opt_arg){
|
||||||
var code;
|
var code;
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1) {
|
||||||
if (opt_arg instanceof ol.Projection) {
|
if (opt_arg instanceof ol.Projection) {
|
||||||
return opt_arg;
|
return opt_arg;
|
||||||
} else if (goog.isString(arguments[0])) {
|
}
|
||||||
code = arguments[0];
|
else
|
||||||
} else {
|
if (goog.isString(arguments[0])) {
|
||||||
throw new Error('ol.projection');
|
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.
|
* @param {string=} opt_code Code.
|
||||||
* @return {ol.Projection|string} Result.
|
* @return {ol.Projection|string} Result.
|
||||||
*/
|
*/
|
||||||
ol.Projection.prototype.code = function(opt_code) {
|
ol.Projection.prototype.code = function(opt_code){
|
||||||
if (goog.isDef(opt_code)) {
|
if (goog.isDef(opt_code)) {
|
||||||
return this.setCode(opt_code);
|
return this.setCode(opt_code);
|
||||||
} else {
|
}
|
||||||
return this.getCode();
|
else {
|
||||||
}
|
return this.getCode();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,29 +13,29 @@ goog.require('ol.Projection');
|
|||||||
*/
|
*/
|
||||||
ol.Loc = function(x, y, opt_z, opt_projection) {
|
ol.Loc = function(x, y, opt_z, opt_projection) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
this.x_ = x;
|
this.x_ = x;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
this.y_ = y;
|
this.y_ = y;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {number|undefined}
|
* @type {number|undefined}
|
||||||
*/
|
*/
|
||||||
this.z_ = opt_z;
|
this.z_ = opt_z;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.Projection|undefined}
|
* @type {ol.Projection|undefined}
|
||||||
*/
|
*/
|
||||||
this.projection_ = opt_projection;
|
this.projection_ = opt_projection;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ ol.Loc = function(x, y, opt_z, opt_projection) {
|
|||||||
* @return {ol.Projection|undefined} Projection.
|
* @return {ol.Projection|undefined} Projection.
|
||||||
*/
|
*/
|
||||||
ol.Loc.prototype.getProjection = function() {
|
ol.Loc.prototype.getProjection = function() {
|
||||||
return this.projection_;
|
return this.projection_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ ol.Loc.prototype.getProjection = function() {
|
|||||||
* @return {number} X.
|
* @return {number} X.
|
||||||
*/
|
*/
|
||||||
ol.Loc.prototype.getX = function() {
|
ol.Loc.prototype.getX = function() {
|
||||||
return this.x_;
|
return this.x_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ ol.Loc.prototype.getX = function() {
|
|||||||
* @return {number} Y.
|
* @return {number} Y.
|
||||||
*/
|
*/
|
||||||
ol.Loc.prototype.getY = function() {
|
ol.Loc.prototype.getY = function() {
|
||||||
return this.y_;
|
return this.y_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ ol.Loc.prototype.getY = function() {
|
|||||||
* @return {number|undefined} Z.
|
* @return {number|undefined} Z.
|
||||||
*/
|
*/
|
||||||
ol.Loc.prototype.getZ = function() {
|
ol.Loc.prototype.getZ = function() {
|
||||||
return this.z_;
|
return this.z_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -77,8 +77,8 @@ ol.Loc.prototype.getZ = function() {
|
|||||||
* @return {ol.Loc} This.
|
* @return {ol.Loc} This.
|
||||||
*/
|
*/
|
||||||
ol.Loc.prototype.setProjection = function(projection) {
|
ol.Loc.prototype.setProjection = function(projection) {
|
||||||
this.projection_ = projection;
|
this.projection_ = projection;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -87,8 +87,8 @@ ol.Loc.prototype.setProjection = function(projection) {
|
|||||||
* @return {ol.Loc} This.
|
* @return {ol.Loc} This.
|
||||||
*/
|
*/
|
||||||
ol.Loc.prototype.setX = function(x) {
|
ol.Loc.prototype.setX = function(x) {
|
||||||
this.x_ = x;
|
this.x_ = x;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -97,8 +97,8 @@ ol.Loc.prototype.setX = function(x) {
|
|||||||
* @return {ol.Loc} This.
|
* @return {ol.Loc} This.
|
||||||
*/
|
*/
|
||||||
ol.Loc.prototype.setY = function(y) {
|
ol.Loc.prototype.setY = function(y) {
|
||||||
this.y_ = y;
|
this.y_ = y;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -107,8 +107,8 @@ ol.Loc.prototype.setY = function(y) {
|
|||||||
* @return {ol.Loc} This.
|
* @return {ol.Loc} This.
|
||||||
*/
|
*/
|
||||||
ol.Loc.prototype.setZ = function(z) {
|
ol.Loc.prototype.setZ = function(z) {
|
||||||
this.z_ = z;
|
this.z_ = z;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user