Remove property enum from map constructor

This commit is contained in:
Tim Schaub
2016-12-27 09:29:54 -07:00
parent 50b9e598f6
commit 0d3f792330
3 changed files with 29 additions and 27 deletions
+2 -1
View File
@@ -4,6 +4,7 @@ goog.require('ol');
goog.require('ol.Collection'); goog.require('ol.Collection');
goog.require('ol.Map'); goog.require('ol.Map');
goog.require('ol.MapEvent'); goog.require('ol.MapEvent');
goog.require('ol.MapProperty');
goog.require('ol.Object'); goog.require('ol.Object');
goog.require('ol.Overlay'); goog.require('ol.Overlay');
goog.require('ol.View'); goog.require('ol.View');
@@ -191,7 +192,7 @@ ol.control.OverviewMap.prototype.setMap = function(map) {
* @private * @private
*/ */
ol.control.OverviewMap.prototype.handleMapPropertyChange_ = function(event) { ol.control.OverviewMap.prototype.handleMapPropertyChange_ = function(event) {
if (event.key === ol.Map.Property.VIEW) { if (event.key === ol.MapProperty.VIEW) {
var oldView = /** @type {ol.View} */ (event.oldValue); var oldView = /** @type {ol.View} */ (event.oldValue);
if (oldView) { if (oldView) {
this.unbindView_(oldView); this.unbindView_(oldView);
+16 -26
View File
@@ -9,6 +9,7 @@ goog.require('ol.Collection');
goog.require('ol.MapBrowserEvent'); goog.require('ol.MapBrowserEvent');
goog.require('ol.MapBrowserEventHandler'); goog.require('ol.MapBrowserEventHandler');
goog.require('ol.MapEvent'); goog.require('ol.MapEvent');
goog.require('ol.MapProperty');
goog.require('ol.Object'); goog.require('ol.Object');
goog.require('ol.TileQueue'); goog.require('ol.TileQueue');
goog.require('ol.View'); goog.require('ol.View');
@@ -367,13 +368,13 @@ ol.Map = function(options) {
this.skippedFeatureUids_ = {}; this.skippedFeatureUids_ = {};
ol.events.listen( ol.events.listen(
this, ol.Object.getChangeEventType(ol.Map.Property.LAYERGROUP), this, ol.Object.getChangeEventType(ol.MapProperty.LAYERGROUP),
this.handleLayerGroupChanged_, this); this.handleLayerGroupChanged_, this);
ol.events.listen(this, ol.Object.getChangeEventType(ol.Map.Property.VIEW), ol.events.listen(this, ol.Object.getChangeEventType(ol.MapProperty.VIEW),
this.handleViewChanged_, this); this.handleViewChanged_, this);
ol.events.listen(this, ol.Object.getChangeEventType(ol.Map.Property.SIZE), ol.events.listen(this, ol.Object.getChangeEventType(ol.MapProperty.SIZE),
this.handleSizeChanged_, this); this.handleSizeChanged_, this);
ol.events.listen(this, ol.Object.getChangeEventType(ol.Map.Property.TARGET), ol.events.listen(this, ol.Object.getChangeEventType(ol.MapProperty.TARGET),
this.handleTargetChanged_, this); this.handleTargetChanged_, this);
// setProperties will trigger the rendering of the map if the map // setProperties will trigger the rendering of the map if the map
@@ -689,7 +690,7 @@ ol.Map.prototype.getEventPixel = function(event) {
*/ */
ol.Map.prototype.getTarget = function() { ol.Map.prototype.getTarget = function() {
return /** @type {Element|string|undefined} */ ( return /** @type {Element|string|undefined} */ (
this.get(ol.Map.Property.TARGET)); this.get(ol.MapProperty.TARGET));
}; };
@@ -785,7 +786,7 @@ ol.Map.prototype.getInteractions = function() {
* @api stable * @api stable
*/ */
ol.Map.prototype.getLayerGroup = function() { ol.Map.prototype.getLayerGroup = function() {
return /** @type {ol.layer.Group} */ (this.get(ol.Map.Property.LAYERGROUP)); return /** @type {ol.layer.Group} */ (this.get(ol.MapProperty.LAYERGROUP));
}; };
@@ -834,7 +835,7 @@ ol.Map.prototype.getRenderer = function() {
* @api stable * @api stable
*/ */
ol.Map.prototype.getSize = function() { ol.Map.prototype.getSize = function() {
return /** @type {ol.Size|undefined} */ (this.get(ol.Map.Property.SIZE)); return /** @type {ol.Size|undefined} */ (this.get(ol.MapProperty.SIZE));
}; };
@@ -846,7 +847,7 @@ ol.Map.prototype.getSize = function() {
* @api stable * @api stable
*/ */
ol.Map.prototype.getView = function() { ol.Map.prototype.getView = function() {
return /** @type {ol.View} */ (this.get(ol.Map.Property.VIEW)); return /** @type {ol.View} */ (this.get(ol.MapProperty.VIEW));
}; };
@@ -1305,7 +1306,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
* @api stable * @api stable
*/ */
ol.Map.prototype.setLayerGroup = function(layerGroup) { ol.Map.prototype.setLayerGroup = function(layerGroup) {
this.set(ol.Map.Property.LAYERGROUP, layerGroup); this.set(ol.MapProperty.LAYERGROUP, layerGroup);
}; };
@@ -1316,7 +1317,7 @@ ol.Map.prototype.setLayerGroup = function(layerGroup) {
* @api * @api
*/ */
ol.Map.prototype.setSize = function(size) { ol.Map.prototype.setSize = function(size) {
this.set(ol.Map.Property.SIZE, size); this.set(ol.MapProperty.SIZE, size);
}; };
@@ -1328,7 +1329,7 @@ ol.Map.prototype.setSize = function(size) {
* @api stable * @api stable
*/ */
ol.Map.prototype.setTarget = function(target) { ol.Map.prototype.setTarget = function(target) {
this.set(ol.Map.Property.TARGET, target); this.set(ol.MapProperty.TARGET, target);
}; };
@@ -1339,7 +1340,7 @@ ol.Map.prototype.setTarget = function(target) {
* @api stable * @api stable
*/ */
ol.Map.prototype.setView = function(view) { ol.Map.prototype.setView = function(view) {
this.set(ol.Map.Property.VIEW, view); this.set(ol.MapProperty.VIEW, view);
}; };
@@ -1431,11 +1432,11 @@ ol.Map.createOptionsInternal = function(options) {
var layerGroup = (options.layers instanceof ol.layer.Group) ? var layerGroup = (options.layers instanceof ol.layer.Group) ?
options.layers : new ol.layer.Group({layers: options.layers}); options.layers : new ol.layer.Group({layers: options.layers});
values[ol.Map.Property.LAYERGROUP] = layerGroup; values[ol.MapProperty.LAYERGROUP] = layerGroup;
values[ol.Map.Property.TARGET] = options.target; values[ol.MapProperty.TARGET] = options.target;
values[ol.Map.Property.VIEW] = options.view !== undefined ? values[ol.MapProperty.VIEW] = options.view !== undefined ?
options.view : new ol.View(); options.view : new ol.View();
/** /**
@@ -1531,15 +1532,4 @@ ol.Map.createOptionsInternal = function(options) {
}; };
/**
* @enum {string}
*/
ol.Map.Property = {
LAYERGROUP: 'layergroup',
SIZE: 'size',
TARGET: 'target',
VIEW: 'view'
};
ol.proj.common.add(); ol.proj.common.add();
+11
View File
@@ -0,0 +1,11 @@
goog.provide('ol.MapProperty');
/**
* @enum {string}
*/
ol.MapProperty = {
LAYERGROUP: 'layergroup',
SIZE: 'size',
TARGET: 'target',
VIEW: 'view'
};