Skip to content

Commit

Permalink
Source.Feature增加setFeatures方法.
Browse files Browse the repository at this point in the history
  • Loading branch information
marsprj committed Dec 7, 2016
1 parent c4c723a commit fa544f1
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/GeoBeans/Source/Feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ GeoBeans.Source.Feature = GeoBeans.Class(GeoBeans.Source, {
if(isValid(options)){
this._geometryName = isValid(options.geometryName) ? options.geometryName : "geometry";
if(isValid(options.features)){
this._features = options.features;
this._features.length = 0;
var that = this;
options.features.forEach(function(f){
this._features.push(f);
});
}
}
},
Expand All @@ -34,6 +38,21 @@ GeoBeans.Source.Feature.prototype.getGeometryName = function(){
return this._geometryName;
}

/**
* 设置Source的Features
* @param {Array.<GeoBeans.Feature>} features 要素集合
* @public
*/
GeoBeans.Source.Feature.prototype.setFeatures = function(features){
this._features.length = 0;
if(features){
var that = this;
features.forEach(function(f){
that._features.push(f);
});
}
}

/**
* 获得符合查询条件的Feature
* @param {GeoBeans.Filter} filter 查询过滤器
Expand Down

0 comments on commit fa544f1

Please sign in to comment.