Convert ol.interaction.DragAndDropEvent#get* methods into properties

This commit is contained in:
Tom Payne
2014-01-23 18:37:00 +01:00
parent 3d68a3550e
commit 45350a34ed
5 changed files with 20 additions and 27 deletions

View File

@@ -115,8 +115,8 @@ var map = new ol.Map({
dragAndDropInteraction.on('addfeatures', function(event) { dragAndDropInteraction.on('addfeatures', function(event) {
var vectorSource = new ol.source.Vector({ var vectorSource = new ol.source.Vector({
features: event.getFeatures(), features: event.features,
projection: event.getProjection() projection: event.projection
}); });
map.getLayers().push(new ol.layer.Image({ map.getLayers().push(new ol.layer.Image({
source: new ol.source.ImageVector({ source: new ol.source.ImageVector({

View File

@@ -114,8 +114,8 @@ var map = new ol.Map({
dragAndDropInteraction.on('addfeatures', function(event) { dragAndDropInteraction.on('addfeatures', function(event) {
var vectorSource = new ol.source.Vector({ var vectorSource = new ol.source.Vector({
features: event.getFeatures(), features: event.features,
projection: event.getProjection() projection: event.projection
}); });
map.getLayers().push(new ol.layer.Vector({ map.getLayers().push(new ol.layer.Vector({
source: vectorSource, source: vectorSource,

View File

@@ -29,3 +29,16 @@ oli.control.Control = function() {};
* @return {undefined} Undefined. * @return {undefined} Undefined.
*/ */
oli.control.Control.prototype.setMap = function(map) {}; oli.control.Control.prototype.setMap = function(map) {};
/** @interface */
oli.interaction.DragAndDropEvent = function() {};
/** @type {Array.<ol.Feature>} */
oli.interaction.DragAndDropEvent.prototype.features;
/** @type {ol.proj.Projection} */
oli.interaction.DragAndDropEvent.prototype.projection;

View File

@@ -1,4 +1 @@
@exportSymbol ol.interaction.DragAndDrop @exportSymbol ol.interaction.DragAndDrop
@exportProperty ol.interaction.DragAndDropEvent.prototype.getFeatures
@exportProperty ol.interaction.DragAndDropEvent.prototype.getProjection

View File

@@ -183,6 +183,7 @@ ol.interaction.DragAndDropEventType = {
/** /**
* @constructor * @constructor
* @extends {goog.events.Event} * @extends {goog.events.Event}
* @implements {oli.interaction.DragAndDropEvent}
* @param {ol.interaction.DragAndDropEventType} type Type. * @param {ol.interaction.DragAndDropEventType} type Type.
* @param {Object=} opt_target Target. * @param {Object=} opt_target Target.
* @param {Array.<ol.Feature>=} opt_features Features. * @param {Array.<ol.Feature>=} opt_features Features.
@@ -194,32 +195,14 @@ ol.interaction.DragAndDropEvent =
goog.base(this, type, opt_target); goog.base(this, type, opt_target);
/** /**
* @private
* @type {Array.<ol.Feature>|undefined} * @type {Array.<ol.Feature>|undefined}
*/ */
this.features_ = opt_features; this.features = opt_features;
/** /**
* @private
* @type {ol.proj.Projection|undefined} * @type {ol.proj.Projection|undefined}
*/ */
this.projection_ = opt_projection; this.projection = opt_projection;
}; };
goog.inherits(ol.interaction.DragAndDropEvent, goog.events.Event); goog.inherits(ol.interaction.DragAndDropEvent, goog.events.Event);
/**
* @return {Array.<ol.Feature>|undefined} Features.
*/
ol.interaction.DragAndDropEvent.prototype.getFeatures = function() {
return this.features_;
};
/**
* @return {ol.proj.Projection|undefined} Projection.
*/
ol.interaction.DragAndDropEvent.prototype.getProjection = function() {
return this.projection_;
};