map initialization

This commit is contained in:
Mike Adair
2012-06-19 09:23:58 -04:00
4 changed files with 32 additions and 16 deletions

View File

@@ -113,3 +113,15 @@ ol.Map.prototype.zoom = function(opt_arg) {
return this.getZoom();
}
};
/**
* @param {number=} opt_arg
* @returns {ol.Map|number|undefined} Map center.
*/
ol.Map.prototype.numZoomLevels = function(opt_arg) {
if (arguments.length == 1 && goog.isDef(opt_arg)) {
return this.setNumZoomLevels(opt_arg);
} else {
return this.getNumZoomLevels();
}
};

View File

@@ -42,12 +42,16 @@ ol.Map = function() {
};
ol.Map.prototype.defaults = {};
/**
@const
@type {string}
*/
ol.Map.prototype.defaults.projection = "EPSG:3857";
ol.Map.prototype.defaults.userProjection = "EPSG:4326";
ol.Map.prototype.DEFAULT_PROJECTION = "EPSG:3857";
/**
@const
@type {string}
*/
ol.Map.prototype.DEFAULT_USER_PROJECTION = "EPSG:4326";
/**
@@ -63,7 +67,7 @@ ol.Map.prototype.getCenter = function() {
*/
ol.Map.prototype.getProjection = function() {
if (!goog.isDef(this.projection_)) {
this.projection_ = new ol.Projection(this.defaults.projection);
this.projection_ = new ol.Projection(this.DEFAULT_PROJECTION);
}
return this.projection_;
};
@@ -74,7 +78,7 @@ ol.Map.prototype.getProjection = function() {
*/
ol.Map.prototype.getUserProjection = function() {
if (!goog.isDef(this.userProjection_)) {
this.userProjection_ = new ol.Projection(this.defaults.userProjection_);
this.userProjection_ = new ol.Projection(this.DEFAULT_USER_PROJECTION);
}
return this.userProjection_;
};