diff --git a/changelog/upgrade-notes.md b/changelog/upgrade-notes.md index b38920b4c5..1d728abed9 100644 --- a/changelog/upgrade-notes.md +++ b/changelog/upgrade-notes.md @@ -17,9 +17,12 @@ A number of internal types have been renamed. This will not affect those who us * rename `ol.OverlayProperty` to `ol.Overlay.Property` * rename `ol.control.MousePositionProperty` to `ol.control.MousePosition.Property` * rename `ol.format.IGCZ` to `ol.format.IGC.Z` + * rename `ol.interaction.DragAndDropEvent` to `ol.interaction.DragAndDrop.Event` + * rename `ol.interaction.DragAndDropEventType` to `ol.interaction.DragAndDrop.EventType` * rename `ol.layer.GroupProperty` to `ol.layer.Group.Property` * rename `ol.layer.HeatmapLayerProperty` to `ol.layer.Heatmap.Property` * rename `ol.layer.VectorTileRenderType` to `ol.layer.VectorTile.RenderType` + * rename `ol.MapProperty` to `ol.Map.Property` * rename `ol.RendererType` to `ol.renderer.Type` * rename `ol.source.TileEvent` to `ol.source.Tile.Event` * rename `ol.source.TileEventType` to `ol.source.Tile.EventType` diff --git a/src/ol/control/overviewmap.js b/src/ol/control/overviewmap.js index 731d773c94..38ec4d5633 100644 --- a/src/ol/control/overviewmap.js +++ b/src/ol/control/overviewmap.js @@ -4,7 +4,6 @@ goog.require('ol'); goog.require('ol.Collection'); goog.require('ol.Map'); goog.require('ol.MapEventType'); -goog.require('ol.MapProperty'); goog.require('ol.Object'); goog.require('ol.ObjectEventType'); goog.require('ol.Overlay'); @@ -193,7 +192,7 @@ ol.control.OverviewMap.prototype.setMap = function(map) { * @private */ ol.control.OverviewMap.prototype.handleMapPropertyChange_ = function(event) { - if (event.key === ol.MapProperty.VIEW) { + if (event.key === ol.Map.Property.VIEW) { var oldView = /** @type {ol.View} */ (event.oldValue); if (oldView) { this.unbindView_(oldView); diff --git a/src/ol/interaction/draganddrop.js b/src/ol/interaction/draganddrop.js index b8bb22edfa..0ac9fdb4c4 100644 --- a/src/ol/interaction/draganddrop.js +++ b/src/ol/interaction/draganddrop.js @@ -1,7 +1,6 @@ // FIXME should handle all geo-referenced data, not just vector data goog.provide('ol.interaction.DragAndDrop'); -goog.provide('ol.interaction.DragAndDropEvent'); goog.require('ol'); goog.require('ol.functions'); @@ -18,7 +17,7 @@ goog.require('ol.proj'); * * @constructor * @extends {ol.interaction.Interaction} - * @fires ol.interaction.DragAndDropEvent + * @fires ol.interaction.DragAndDrop.Event * @param {olx.interaction.DragAndDropOptions=} opt_options Options. * @api stable */ @@ -118,8 +117,8 @@ ol.interaction.DragAndDrop.prototype.handleResult_ = function(file, event) { } } this.dispatchEvent( - new ol.interaction.DragAndDropEvent( - ol.interaction.DragAndDropEventType.ADD_FEATURES, file, + new ol.interaction.DragAndDrop.Event( + ol.interaction.DragAndDrop.EventType.ADD_FEATURES, file, features, projection)); }; @@ -179,10 +178,10 @@ ol.interaction.DragAndDrop.prototype.tryReadFeatures_ = function(format, text, o /** * @enum {string} */ -ol.interaction.DragAndDropEventType = { +ol.interaction.DragAndDrop.EventType = { /** * Triggered when features are added - * @event ol.interaction.DragAndDropEvent#addfeatures + * @event ol.interaction.DragAndDrop.Event#addfeatures * @api stable */ ADD_FEATURES: 'addfeatures' @@ -197,12 +196,12 @@ ol.interaction.DragAndDropEventType = { * @constructor * @extends {ol.events.Event} * @implements {oli.interaction.DragAndDropEvent} - * @param {ol.interaction.DragAndDropEventType} type Type. + * @param {ol.interaction.DragAndDrop.EventType} type Type. * @param {File} file File. * @param {Array.=} opt_features Features. * @param {ol.proj.Projection=} opt_projection Projection. */ -ol.interaction.DragAndDropEvent = function(type, file, opt_features, opt_projection) { +ol.interaction.DragAndDrop.Event = function(type, file, opt_features, opt_projection) { ol.events.Event.call(this, type); @@ -228,4 +227,4 @@ ol.interaction.DragAndDropEvent = function(type, file, opt_features, opt_project this.projection = opt_projection; }; -ol.inherits(ol.interaction.DragAndDropEvent, ol.events.Event); +ol.inherits(ol.interaction.DragAndDrop.Event, ol.events.Event); diff --git a/src/ol/map.js b/src/ol/map.js index 33fd0b3bbe..646542d390 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -3,7 +3,6 @@ // FIXME add tilt and height? goog.provide('ol.Map'); -goog.provide('ol.MapProperty'); goog.require('ol'); goog.require('ol.Collection'); @@ -84,17 +83,6 @@ ol.DEFAULT_RENDERER_TYPES = [ ]; -/** - * @enum {string} - */ -ol.MapProperty = { - LAYERGROUP: 'layergroup', - SIZE: 'size', - TARGET: 'target', - VIEW: 'view' -}; - - /** * @classdesc * The map is the core component of OpenLayers. For a map to render, a view, @@ -377,13 +365,13 @@ ol.Map = function(options) { this.skippedFeatureUids_ = {}; ol.events.listen( - this, ol.Object.getChangeEventType(ol.MapProperty.LAYERGROUP), + this, ol.Object.getChangeEventType(ol.Map.Property.LAYERGROUP), this.handleLayerGroupChanged_, this); - ol.events.listen(this, ol.Object.getChangeEventType(ol.MapProperty.VIEW), + ol.events.listen(this, ol.Object.getChangeEventType(ol.Map.Property.VIEW), this.handleViewChanged_, this); - ol.events.listen(this, ol.Object.getChangeEventType(ol.MapProperty.SIZE), + ol.events.listen(this, ol.Object.getChangeEventType(ol.Map.Property.SIZE), this.handleSizeChanged_, this); - ol.events.listen(this, ol.Object.getChangeEventType(ol.MapProperty.TARGET), + ol.events.listen(this, ol.Object.getChangeEventType(ol.Map.Property.TARGET), this.handleTargetChanged_, this); // setProperties will trigger the rendering of the map if the map @@ -714,7 +702,7 @@ ol.Map.prototype.getEventPixel = function(event) { */ ol.Map.prototype.getTarget = function() { return /** @type {Element|string|undefined} */ ( - this.get(ol.MapProperty.TARGET)); + this.get(ol.Map.Property.TARGET)); }; @@ -810,7 +798,7 @@ ol.Map.prototype.getInteractions = function() { * @api stable */ ol.Map.prototype.getLayerGroup = function() { - return /** @type {ol.layer.Group} */ (this.get(ol.MapProperty.LAYERGROUP)); + return /** @type {ol.layer.Group} */ (this.get(ol.Map.Property.LAYERGROUP)); }; @@ -859,7 +847,7 @@ ol.Map.prototype.getRenderer = function() { * @api stable */ ol.Map.prototype.getSize = function() { - return /** @type {ol.Size|undefined} */ (this.get(ol.MapProperty.SIZE)); + return /** @type {ol.Size|undefined} */ (this.get(ol.Map.Property.SIZE)); }; @@ -871,7 +859,7 @@ ol.Map.prototype.getSize = function() { * @api stable */ ol.Map.prototype.getView = function() { - return /** @type {ol.View} */ (this.get(ol.MapProperty.VIEW)); + return /** @type {ol.View} */ (this.get(ol.Map.Property.VIEW)); }; @@ -1323,7 +1311,7 @@ ol.Map.prototype.renderFrame_ = function(time) { * @api stable */ ol.Map.prototype.setLayerGroup = function(layerGroup) { - this.set(ol.MapProperty.LAYERGROUP, layerGroup); + this.set(ol.Map.Property.LAYERGROUP, layerGroup); }; @@ -1334,7 +1322,7 @@ ol.Map.prototype.setLayerGroup = function(layerGroup) { * @api */ ol.Map.prototype.setSize = function(size) { - this.set(ol.MapProperty.SIZE, size); + this.set(ol.Map.Property.SIZE, size); }; @@ -1346,7 +1334,7 @@ ol.Map.prototype.setSize = function(size) { * @api stable */ ol.Map.prototype.setTarget = function(target) { - this.set(ol.MapProperty.TARGET, target); + this.set(ol.Map.Property.TARGET, target); }; @@ -1357,7 +1345,7 @@ ol.Map.prototype.setTarget = function(target) { * @api stable */ ol.Map.prototype.setView = function(view) { - this.set(ol.MapProperty.VIEW, view); + this.set(ol.Map.Property.VIEW, view); }; @@ -1449,11 +1437,11 @@ ol.Map.createOptionsInternal = function(options) { var layerGroup = (options.layers instanceof ol.layer.Group) ? options.layers : new ol.layer.Group({layers: options.layers}); - values[ol.MapProperty.LAYERGROUP] = layerGroup; + values[ol.Map.Property.LAYERGROUP] = layerGroup; - values[ol.MapProperty.TARGET] = options.target; + values[ol.Map.Property.TARGET] = options.target; - values[ol.MapProperty.VIEW] = options.view !== undefined ? + values[ol.Map.Property.VIEW] = options.view !== undefined ? options.view : new ol.View(); /** @@ -1549,5 +1537,15 @@ ol.Map.createOptionsInternal = function(options) { }; +/** + * @enum {string} + */ +ol.Map.Property = { + LAYERGROUP: 'layergroup', + SIZE: 'size', + TARGET: 'target', + VIEW: 'view' +}; + ol.proj.common.add();