Small fixes.
This commit is contained in:
@@ -8,10 +8,10 @@ goog.require('ol.Projection');
|
||||
* @constructor
|
||||
* @param {number} x X.
|
||||
* @param {number} y Y.
|
||||
* @param {number} z Z.
|
||||
* @param {ol.Projection|undefined} projection Projection.
|
||||
* @param {number=} opt_z Z.
|
||||
* @param {ol.Projection=} opt_projection Projection.
|
||||
*/
|
||||
ol.Location = function(x, y, z, projection) {
|
||||
ol.Location = function(x, y, opt_z, opt_projection) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -27,15 +27,15 @@ ol.Location = function(x, y, z, projection) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.z_ = z;
|
||||
this.z_ = opt_z;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.Projection|undefined}
|
||||
*/
|
||||
this.projection_ = projection;
|
||||
this.projection_ = opt_projection;
|
||||
|
||||
};
|
||||
|
||||
@@ -65,7 +65,7 @@ ol.Location.prototype.getY = function() {
|
||||
|
||||
|
||||
/**
|
||||
* @return {number} Z.
|
||||
* @return {number|undefined} Z.
|
||||
*/
|
||||
ol.Location.prototype.getZ = function() {
|
||||
return this.z_;
|
||||
@@ -103,7 +103,7 @@ ol.Location.prototype.setY = function(y) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} z Z.
|
||||
* @param {number|undefined} z Z.
|
||||
* @return {ol.Location} This.
|
||||
*/
|
||||
ol.Location.prototype.setZ = function(z) {
|
||||
@@ -56,7 +56,7 @@ ol.Map.prototype.getZoom = function() {
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Center} center Center.
|
||||
* @param {ol.Location} center Center.
|
||||
* @return {ol.Map} This.
|
||||
*/
|
||||
ol.Map.prototype.setCenter = function(center) {
|
||||
|
||||
@@ -9,7 +9,7 @@ ol.Projection = function() {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {string=}
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
this.code_ = undefined;
|
||||
|
||||
@@ -17,7 +17,7 @@ ol.Projection = function() {
|
||||
|
||||
|
||||
/**
|
||||
* @return {string} Code.
|
||||
* @return {string|undefined} Code.
|
||||
*/
|
||||
ol.Projection.prototype.getCode = function() {
|
||||
return this.code_;
|
||||
@@ -25,7 +25,7 @@ ol.Projection.prototype.getCode = function() {
|
||||
|
||||
|
||||
/**
|
||||
* @param {string=} code Code.
|
||||
* @param {string|undefined} code Code.
|
||||
* @return {ol.Projection} This.
|
||||
*/
|
||||
ol.Projection.prototype.setCode = function(code) {
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
goog.provide('ol.loc');
|
||||
|
||||
goog.require('ol.Location');
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {ol.Location|Array.<number>|{{x:number, y:number, z:number=, projection: ol.Projection=}}} loc Location.
|
||||
*/
|
||||
ol.LocationLike;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @param {ol.LocationLike} loc Location.
|
||||
* @return {ol.Location} Location.
|
||||
*/
|
||||
ol.loc = function(loc) {
|
||||
|
||||
if (loc instanceof ol.Location) {
|
||||
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.Location(x, y, z, projection);
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @param {ol.Projection=} opt_arg Projection.
|
||||
* @return {ol.Location|ol.Projection} Result.
|
||||
*/
|
||||
ol.Location.prototype.projection = function(opt_arg) {
|
||||
if (arguments.length == 1) {
|
||||
return this.setProjection(opt_arg);
|
||||
} else {
|
||||
return this.getProjection();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @param {number=} opt_arg X.
|
||||
* @return {ol.Location|number} Result.
|
||||
*/
|
||||
ol.Location.prototype.x = function(opt_arg) {
|
||||
if (arguments.length == 1) {
|
||||
return this.setX(opt_arg);
|
||||
} else {
|
||||
return this.getX();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @param {number=} opt_arg Y.
|
||||
* @return {ol.Location|number} Result.
|
||||
*/
|
||||
ol.Location.prototype.y = function(opt_arg) {
|
||||
if (arguments.length == 1) {
|
||||
return this.setY(opt_arg);
|
||||
} else {
|
||||
return this.getY();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @param {number=} opt_arg Z.
|
||||
* @return {ol.Location|number} Result.
|
||||
*/
|
||||
ol.Location.prototype.z = function(opt_arg) {
|
||||
if (arguments.length == 1) {
|
||||
return this.setZ(opt_arg);
|
||||
} else {
|
||||
return this.getZ();
|
||||
}
|
||||
};
|
||||
@@ -1,44 +0,0 @@
|
||||
goog.provide('ol.map');
|
||||
|
||||
goog.require('ol.Location');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.Projection');
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {ol.Map|Object|string}
|
||||
*/
|
||||
ol.MapLike;
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.MapLike=} opt_arg Argument.
|
||||
* @return {ol.Map} Map.
|
||||
*/
|
||||
ol.map = function(opt_arg) {
|
||||
|
||||
/** @type {ol.Location|undefined} */
|
||||
var center;
|
||||
var target;
|
||||
|
||||
if (arguments.length == 1) {
|
||||
if (opt_arg instanceof ol.Map) {
|
||||
return opt_arg;
|
||||
} else if (goog.isObject(opt_arg)) {
|
||||
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;
|
||||
|
||||
};
|
||||
@@ -1,43 +0,0 @@
|
||||
goog.provide('ol.projection');
|
||||
|
||||
goog.require('ol.Projection');
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {ol.Projection|string}
|
||||
*/
|
||||
ol.ProjectionLike;
|
||||
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @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');
|
||||
}
|
||||
}
|
||||
return new ol.Projection(code);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @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();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user