intialization of Map again
This commit is contained in:
+20
-2
@@ -19,9 +19,16 @@ ol.MapLike;
|
|||||||
*/
|
*/
|
||||||
ol.map = function(opt_arg){
|
ol.map = function(opt_arg){
|
||||||
|
|
||||||
|
/** @type {ol.Loc|undefined} */
|
||||||
var center;
|
var center;
|
||||||
var target;
|
/** @type {number|undefined} */
|
||||||
var zoom;
|
var zoom;
|
||||||
|
/** @type {number|undefined} */
|
||||||
|
var numZoomLevels;
|
||||||
|
/** @type {ol.Projection|undefined} */
|
||||||
|
var projection;
|
||||||
|
/** @type {ol.Projection|undefined} */
|
||||||
|
var userProjection;
|
||||||
|
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1) {
|
||||||
if (opt_arg instanceof ol.Map) {
|
if (opt_arg instanceof ol.Map) {
|
||||||
@@ -29,8 +36,10 @@ ol.map = function(opt_arg){
|
|||||||
}
|
}
|
||||||
else if (goog.isObject(opt_arg)) {
|
else if (goog.isObject(opt_arg)) {
|
||||||
center = opt_arg['center'];
|
center = opt_arg['center'];
|
||||||
target = opt_arg['target'];
|
|
||||||
zoom = opt_arg['zoom'];
|
zoom = opt_arg['zoom'];
|
||||||
|
numZoomLevels = opt_arg['numZoomLevels'];
|
||||||
|
projection = opt_arg['projection'];
|
||||||
|
userProjection = opt_arg['userProjection'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new Error('ol.map');
|
throw new Error('ol.map');
|
||||||
@@ -44,6 +53,15 @@ ol.map = function(opt_arg){
|
|||||||
if (goog.isDef(zoom)) {
|
if (goog.isDef(zoom)) {
|
||||||
map.setZoom(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;
|
return map;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -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.
|
* @return {ol.Map} This.
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.setUserProjection = function(userProjection) {
|
ol.Map.prototype.setUserProjection = function(userProjection) {
|
||||||
|
|||||||
Reference in New Issue
Block a user