Merge pull request #2483 from fredj/view.projection
Remove projection from ol.View observable properties
This commit is contained in:
@@ -18,8 +18,7 @@ var view = new ol.View({
|
||||
zoom: 1
|
||||
});
|
||||
|
||||
var viewProjection = /** @type {ol.proj.Projection} */
|
||||
(view.getProjection());
|
||||
var viewProjection = view.getProjection();
|
||||
|
||||
var map = new ol.Map({
|
||||
layers: [wmsLayer],
|
||||
|
||||
@@ -24,7 +24,6 @@ goog.require('ol.proj.Units');
|
||||
*/
|
||||
ol.ViewProperty = {
|
||||
CENTER: 'center',
|
||||
PROJECTION: 'projection',
|
||||
RESOLUTION: 'resolution',
|
||||
ROTATION: 'rotation'
|
||||
};
|
||||
@@ -107,8 +106,12 @@ ol.View = function(opt_options) {
|
||||
var properties = {};
|
||||
properties[ol.ViewProperty.CENTER] = goog.isDef(options.center) ?
|
||||
options.center : null;
|
||||
properties[ol.ViewProperty.PROJECTION] = ol.proj.createProjection(
|
||||
options.projection, 'EPSG:3857');
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.proj.Projection}
|
||||
*/
|
||||
this.projection_ = ol.proj.createProjection(options.projection, 'EPSG:3857');
|
||||
|
||||
var resolutionConstraintInfo = ol.View.createResolutionConstraint_(
|
||||
options);
|
||||
@@ -275,18 +278,12 @@ ol.View.prototype.calculateExtent = function(size) {
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.proj.Projection|undefined} The projection of the view.
|
||||
* @observable
|
||||
* @return {ol.proj.Projection} The projection of the view.
|
||||
* @api
|
||||
*/
|
||||
ol.View.prototype.getProjection = function() {
|
||||
return /** @type {ol.proj.Projection|undefined} */ (
|
||||
this.get(ol.ViewProperty.PROJECTION));
|
||||
return this.projection_;
|
||||
};
|
||||
goog.exportProperty(
|
||||
ol.View.prototype,
|
||||
'getProjection',
|
||||
ol.View.prototype.getProjection);
|
||||
|
||||
|
||||
/**
|
||||
@@ -601,22 +598,6 @@ ol.View.prototype.setHint = function(hint, delta) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Set the projection of this view.
|
||||
* Warning! This code is not yet implemented. Function should not be used.
|
||||
* @param {ol.proj.Projection|undefined} projection The projection of the view.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
ol.View.prototype.setProjection = function(projection) {
|
||||
this.set(ol.ViewProperty.PROJECTION, projection);
|
||||
};
|
||||
goog.exportProperty(
|
||||
ol.View.prototype,
|
||||
'setProjection',
|
||||
ol.View.prototype.setProjection);
|
||||
|
||||
|
||||
/**
|
||||
* Set the resolution for this view.
|
||||
* @param {number|undefined} resolution The resolution of the view.
|
||||
|
||||
Reference in New Issue
Block a user