diff --git a/src/ol/epi/ol/location.js b/src/ol/epi/ol/location.js new file mode 100644 index 0000000000..a6dc602c8d --- /dev/null +++ b/src/ol/epi/ol/location.js @@ -0,0 +1,112 @@ +goog.provide('ol.Location'); + +goog.require('ol.Projection'); + + + +/** + * @constructor + * @param {number} x X. + * @param {number} y Y. + * @param {number} z Z. + * @param {ol.Projection|undefined} projection Projection. + */ +ol.Location = function(x, y, z, projection) { + + /** + * @private + * @type {number} + */ + this.x_ = x; + + /** + * @private + * @type {number} + */ + this.y_ = y; + + /** + * @private + * @type {number} + */ + this.z_ = z; + + /** + * @private + * @type {ol.Projection|undefined} + */ + this.projection_ = projection; + +}; + + +/** + * @return {ol.Projection|undefined} Projection. + */ +ol.Location.prototype.getProjection = function() { + return this.projection_; +}; + + +/** + * @return {number} X. + */ +ol.Location.prototype.getX = function() { + return this.x_; +}; + + +/** + * @return {number} Y. + */ +ol.Location.prototype.getY = function() { + return this.y_; +}; + + +/** + * @return {number} Z. + */ +ol.Location.prototype.getZ = function() { + return this.z_; +}; + + +/** + * @param {ol.Projection|undefined} projection Projection. + * @return {ol.Location} This. + */ +ol.Location.prototype.setProjection = function(projection) { + this.projection_ = projection; + return this; +}; + + +/** + * @return {number} X. + */ +ol.Location.prototype.setX = function() { + this.x_ = x; + return this; +}; + + +/** + * @return {number} Y. + */ +ol.Location.prototype.setY = function() { + this.y_ = y; + return this; +}; + + +/** + * @return {number} Z. + */ +ol.Location.prototype.setZ = function() { + this.z_ = z; + return this; +}; + + + diff --git a/src/ol/epi/ol/map.js b/src/ol/epi/ol/map.js new file mode 100644 index 0000000000..0f0c32c7d6 --- /dev/null +++ b/src/ol/epi/ol/map.js @@ -0,0 +1,85 @@ +goog.provide('ol.Map'); + +goog.require('ol.Location'); +goog.require('ol.Projection'); + + + +/** + * @constructor + */ +ol.Map = function() { + + /** + * @private + * @type {ol.Projection} + */ + this.projection_ = new ol.Projection(); + + /** + * @private + * @type {ol.Location} + */ + this.location_ = new ol.Location(0, 0); + + /** + * @private + * @type {number} + */ + this.zoom_ = 0; + +}; + + +/** + * @return {ol.Location} Location. + */ +ol.Map.prototype.getCenter = function() { + return this.center_; +}; + + +/** + * @return {ol.Projection} Projection. + */ +ol.Map.prototype.getProjection = function() { + return this.projection_; +}; + + +/** + * @return {number} Zoom. + */ +ol.Map.prototype.getZoom = function() { + return this.zoom_; +}; + + +/** + * @param {ol.Center} center Center. + * @return {ol.Map} This. + */ +ol.Map.prototype.setCenter = function(center) { + this.center_ = center; + return this; +}; + + +/** + * @param {ol.Projection} projection Projection. + * @return {ol.Map} This. + */ +ol.Map.prototype.setProjection = function(projection) { + this.projection_ = projection; + return this; +}; + + +/** + * @param {number} zoom Zoom. + * @return {ol.Map} This. + */ +ol.Map.prototype.setZoom = function(zoom) { + this.zoom_ = zoom; + return this; +}; diff --git a/src/ol/epi/ol/projection.js b/src/ol/epi/ol/projection.js new file mode 100644 index 0000000000..cb77844ae4 --- /dev/null +++ b/src/ol/epi/ol/projection.js @@ -0,0 +1,34 @@ +goog.provide('ol.Projection'); + + + +/** + * @constructor + */ +ol.Projection = function() { + + /** + * @private + * @type {string=} + */ + this.code_ = undefined; + +}; + + +/** + * @return {string} Code. + */ +ol.Projection.prototype.getCode = function() { + return this.code_; +}; + + +/** + * @param {string=} code Code. + * @return {ol.Projection} This. + */ +ol.Projection.prototype.setCode = function(code) { + this.code_ = code; + return this; +}; diff --git a/src/ol/hpi/ol/loc.js b/src/ol/hpi/ol/loc.js new file mode 100644 index 0000000000..e1a25db280 --- /dev/null +++ b/src/ol/hpi/ol/loc.js @@ -0,0 +1,114 @@ +goog.provide('ol.loc'); + +goog.require('ol.Location'); + + +/** + * @typedef {ol.Location|Array.|{{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(); + } +}; diff --git a/src/ol/hpi/ol/map.js b/src/ol/hpi/ol/map.js new file mode 100644 index 0000000000..16daa72a82 --- /dev/null +++ b/src/ol/hpi/ol/map.js @@ -0,0 +1,45 @@ +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(); + + if (goog.object.) { + } + +}; diff --git a/src/ol/hpi/ol/projection.js b/src/ol/hpi/ol/projection.js new file mode 100644 index 0000000000..2efaf32fe1 --- /dev/null +++ b/src/ol/hpi/ol/projection.js @@ -0,0 +1,43 @@ +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(); + } +};