map initialization
This commit is contained in:
@@ -17,15 +17,15 @@
|
|||||||
"checks": {
|
"checks": {
|
||||||
// "accessControls": "ERROR",
|
// "accessControls": "ERROR",
|
||||||
// "visibility": "ERROR"
|
// "visibility": "ERROR"
|
||||||
"checkTypes": "ERROR",
|
// "checkTypes": "ERROR",
|
||||||
"checkRegExp": "ERROR",
|
// "checkRegExp": "ERROR",
|
||||||
"checkVars": "ERROR",
|
// "checkVars": "ERROR",
|
||||||
"deprecated": "ERROR",
|
// "deprecated": "ERROR",
|
||||||
"fileoverviewTags": "ERROR",
|
// "fileoverviewTags": "ERROR",
|
||||||
"invalidCasts": "ERROR",
|
// "invalidCasts": "ERROR",
|
||||||
"missingProperties": "ERROR",
|
// "missingProperties": "ERROR",
|
||||||
"nonStandardJsDocs": "ERROR",
|
// "nonStandardJsDocs": "ERROR",
|
||||||
"undefinedVars": "ERROR"
|
// "undefinedVars": "ERROR"
|
||||||
},
|
},
|
||||||
|
|
||||||
"jsdoc-html-output-path": "."
|
"jsdoc-html-output-path": "."
|
||||||
|
|||||||
@@ -113,3 +113,15 @@ ol.Map.prototype.zoom = function(opt_arg) {
|
|||||||
return this.getZoom();
|
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();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
+9
-5
@@ -42,12 +42,16 @@ ol.Map = function() {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ol.Map.prototype.defaults = {};
|
|
||||||
/**
|
/**
|
||||||
|
@const
|
||||||
@type {string}
|
@type {string}
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.defaults.projection = "EPSG:3857";
|
ol.Map.prototype.DEFAULT_PROJECTION = "EPSG:3857";
|
||||||
ol.Map.prototype.defaults.userProjection = "EPSG:4326";
|
/**
|
||||||
|
@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() {
|
ol.Map.prototype.getProjection = function() {
|
||||||
if (!goog.isDef(this.projection_)) {
|
if (!goog.isDef(this.projection_)) {
|
||||||
this.projection_ = new ol.Projection(this.defaults.projection);
|
this.projection_ = new ol.Projection(this.DEFAULT_PROJECTION);
|
||||||
}
|
}
|
||||||
return this.projection_;
|
return this.projection_;
|
||||||
};
|
};
|
||||||
@@ -74,7 +78,7 @@ ol.Map.prototype.getProjection = function() {
|
|||||||
*/
|
*/
|
||||||
ol.Map.prototype.getUserProjection = function() {
|
ol.Map.prototype.getUserProjection = function() {
|
||||||
if (!goog.isDef(this.userProjection_)) {
|
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_;
|
return this.userProjection_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ describe("ol.Map", function() {
|
|||||||
|
|
||||||
center = map.center();
|
center = map.center();
|
||||||
zoom = map.zoom();
|
zoom = map.zoom();
|
||||||
expect(center.x().toFixed(3)).toBe("1.000");
|
expect(center.x().toFixed(3)).toBe("4.000");
|
||||||
expect(center.y().toFixed(3)).toBe("2.000");
|
expect(center.y().toFixed(3)).toBe("5.000");
|
||||||
expect(zoom).toBe(6);
|
expect(zoom).toBe(6);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user