interim map test updates
This commit is contained in:
@@ -20,8 +20,14 @@ ol.map = function(opt_arg){
|
|||||||
|
|
||||||
/** @type {ol.Loc|undefined} */
|
/** @type {ol.Loc|undefined} */
|
||||||
var center;
|
var center;
|
||||||
|
/** @type {number|undefined} */
|
||||||
|
var zoom;
|
||||||
|
/** @type {number|undefined} */
|
||||||
|
var numZoomLevels;
|
||||||
var target;
|
var target;
|
||||||
|
|
||||||
|
var map = new ol.Map();
|
||||||
|
|
||||||
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;
|
||||||
@@ -31,6 +37,15 @@ ol.map = function(opt_arg){
|
|||||||
var config = opt_arg;
|
var config = opt_arg;
|
||||||
if (goog.isDef(config.center)) {
|
if (goog.isDef(config.center)) {
|
||||||
center = ol.loc(config.center);
|
center = ol.loc(config.center);
|
||||||
|
map.setCenter(center);
|
||||||
|
}
|
||||||
|
if (goog.isDef(config.zoom)) {
|
||||||
|
zoom = config.zoom;
|
||||||
|
map.setZoom(zoom);
|
||||||
|
}
|
||||||
|
if (goog.isDef(config.numZoomLevels)) {
|
||||||
|
numZoomLevels = config.numZoomLevels;
|
||||||
|
map.setNumZoomLevels(numZoomLevels);
|
||||||
}
|
}
|
||||||
if (goog.isDef(config.target)) {
|
if (goog.isDef(config.target)) {
|
||||||
target = config.target;
|
target = config.target;
|
||||||
@@ -41,15 +56,13 @@ ol.map = function(opt_arg){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var map = new ol.Map();
|
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.LocLike=} opt_arg
|
* @param {ol.LocLike=} opt_arg Get or set the map center.
|
||||||
* @returns {ol.Map|ol.Loc|undefined} Map center.
|
* @returns {ol.Map|ol.Loc|undefined} The map center, or the map on set.
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.center = function(opt_arg) {
|
ol.Map.prototype.center = function(opt_arg) {
|
||||||
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
||||||
@@ -58,3 +71,39 @@ ol.Map.prototype.center = function(opt_arg) {
|
|||||||
return this.getCenter();
|
return this.getCenter();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {number|undefined} opt_arg Get or set the current zoom level.
|
||||||
|
* @returns {ol.Map|number|undefined} current zoom level on get or the map.
|
||||||
|
*/
|
||||||
|
ol.Map.prototype.zoom = function(opt_arg) {
|
||||||
|
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
||||||
|
return this.setZoom(opt_arg);
|
||||||
|
} else {
|
||||||
|
return this.getZoom();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {ol.Projection|string|undefined} opt_arg Get or set the map projection.
|
||||||
|
* @returns {ol.Map|number|undefined} the current zoom level, or the map on set.
|
||||||
|
*/
|
||||||
|
ol.Map.prototype.projection = function(opt_arg) {
|
||||||
|
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
||||||
|
return this.setZoom(opt_arg);
|
||||||
|
} else {
|
||||||
|
return this.getZoom();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {number|undefined} opt_arg Get or set the number of zoom levels.
|
||||||
|
* @returns {ol.Map|number|undefined} the number of zoom levels, or the map on set.
|
||||||
|
*/
|
||||||
|
ol.Map.prototype.numZoomLevels = function(opt_arg) {
|
||||||
|
if (arguments.length == 1 && goog.isDef(opt_arg)) {
|
||||||
|
return this.setNumZoomLevels(opt_arg);
|
||||||
|
} else {
|
||||||
|
return this.getNumZoomLevels();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ ol.Map = function() {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.Loc}
|
* @type {ol.Loc}
|
||||||
*/
|
*/
|
||||||
this.location_ = new ol.Loc(0, 0);
|
this.center_ = new ol.Loc(0, 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -28,6 +28,12 @@ ol.Map = function() {
|
|||||||
*/
|
*/
|
||||||
this.zoom_ = 0;
|
this.zoom_ = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
this.numZoomLevels_ = 22;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -55,6 +61,14 @@ ol.Map.prototype.getZoom = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {number} number of zoom levels.
|
||||||
|
*/
|
||||||
|
ol.Map.prototype.getNumZoomLevels = function() {
|
||||||
|
return this.numZoomLevels_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.Loc} center Center.
|
* @param {ol.Loc} center Center.
|
||||||
* @return {ol.Map} This.
|
* @return {ol.Map} This.
|
||||||
@@ -83,3 +97,13 @@ ol.Map.prototype.setZoom = function(zoom) {
|
|||||||
this.zoom_ = zoom;
|
this.zoom_ = zoom;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {number} nZoom Zoom.
|
||||||
|
* @return {ol.Map} This.
|
||||||
|
*/
|
||||||
|
ol.Map.prototype.setNumZoomLevels = function(nZoom) {
|
||||||
|
this.numZoomLevels_ = nZoom;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user