Merge pull request #2483 from fredj/view.projection

Remove projection from ol.View observable properties
This commit is contained in:
Frédéric Junod
2014-08-01 16:01:10 +02:00
2 changed files with 9 additions and 29 deletions

View File

@@ -18,8 +18,7 @@ var view = new ol.View({
zoom: 1 zoom: 1
}); });
var viewProjection = /** @type {ol.proj.Projection} */ var viewProjection = view.getProjection();
(view.getProjection());
var map = new ol.Map({ var map = new ol.Map({
layers: [wmsLayer], layers: [wmsLayer],

View File

@@ -24,7 +24,6 @@ goog.require('ol.proj.Units');
*/ */
ol.ViewProperty = { ol.ViewProperty = {
CENTER: 'center', CENTER: 'center',
PROJECTION: 'projection',
RESOLUTION: 'resolution', RESOLUTION: 'resolution',
ROTATION: 'rotation' ROTATION: 'rotation'
}; };
@@ -107,8 +106,12 @@ ol.View = function(opt_options) {
var properties = {}; var properties = {};
properties[ol.ViewProperty.CENTER] = goog.isDef(options.center) ? properties[ol.ViewProperty.CENTER] = goog.isDef(options.center) ?
options.center : null; 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_( var resolutionConstraintInfo = ol.View.createResolutionConstraint_(
options); options);
@@ -275,18 +278,12 @@ ol.View.prototype.calculateExtent = function(size) {
/** /**
* @return {ol.proj.Projection|undefined} The projection of the view. * @return {ol.proj.Projection} The projection of the view.
* @observable
* @api * @api
*/ */
ol.View.prototype.getProjection = function() { ol.View.prototype.getProjection = function() {
return /** @type {ol.proj.Projection|undefined} */ ( return this.projection_;
this.get(ol.ViewProperty.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. * Set the resolution for this view.
* @param {number|undefined} resolution The resolution of the view. * @param {number|undefined} resolution The resolution of the view.