intialization of Map again

This commit is contained in:
Mike Adair
2012-06-19 09:16:56 -04:00
parent 322cf702ed
commit 171c8522b3
2 changed files with 21 additions and 3 deletions

View File

@@ -19,9 +19,16 @@ ol.MapLike;
*/
ol.map = function(opt_arg){
/** @type {ol.Loc|undefined} */
var center;
var target;
/** @type {number|undefined} */
var zoom;
/** @type {number|undefined} */
var numZoomLevels;
/** @type {ol.Projection|undefined} */
var projection;
/** @type {ol.Projection|undefined} */
var userProjection;
if (arguments.length == 1) {
if (opt_arg instanceof ol.Map) {
@@ -29,8 +36,10 @@ ol.map = function(opt_arg){
}
else if (goog.isObject(opt_arg)) {
center = opt_arg['center'];
target = opt_arg['target'];
zoom = opt_arg['zoom'];
numZoomLevels = opt_arg['numZoomLevels'];
projection = opt_arg['projection'];
userProjection = opt_arg['userProjection'];
}
else {
throw new Error('ol.map');
@@ -44,6 +53,15 @@ ol.map = function(opt_arg){
if (goog.isDef(zoom)) {
map.setZoom(zoom);
}
if (goog.isDef(numZoomLevels)) {
map.setNumZoomLevels(numZoomLevels);
}
if (goog.isDef(projection)) {
map.setProjection(projection);
}
if (goog.isDef(projection)) {
map.setUserProjection(projection);
}
return map;
};

View File

@@ -117,7 +117,7 @@ ol.Map.prototype.setProjection = function(projection) {
/**
* @param {ol.Projection} projection set the user projection.
* @param {ol.Projection} userProjection set the user projection.
* @return {ol.Map} This.
*/
ol.Map.prototype.setUserProjection = function(userProjection) {