MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / getFiterFeatures

Method getFiterFeatures

src/openlayers/mapping/WebMap.js:3161–3183  ·  view source on GitHub ↗

* @private * @function WebMap.prototype.getFiterFeatures * @description 通过过滤条件查询满足的feature * @param {string} filterCondition - 过滤条件 * @param {Array} allFeatures - 图层上的feature集合

(filterCondition, allFeatures)

Source from the content-addressed store, hash-verified

3159 * @param {Array} allFeatures - 图层上的feature集合
3160 */
3161 getFiterFeatures(filterCondition, allFeatures) {
3162 let condition = this.parseFilterCondition(filterCondition);
3163 let filterFeatures = [];
3164 for (let i = 0; i < allFeatures.length; i++) {
3165 let feature = allFeatures[i];
3166 let filterResult = false;
3167 try {
3168 const properties = feature.get('attributes');
3169 const conditions = parseCondition(condition, Object.keys(properties));
3170 const filterFeature = parseConditionFeature(properties);
3171 const sql = 'select * from json where (' + conditions + ')';
3172 filterResult = window.jsonsql.query(sql, { attributes: filterFeature });
3173 } catch (err) {
3174 //必须把要过滤得内容封装成一个对象,主要是处理jsonsql(line : 62)中由于with语句遍历对象造成的问题
3175 continue;
3176 }
3177 if (filterResult && filterResult.length > 0) {
3178 //afterFilterFeatureIdx.push(i);
3179 filterFeatures.push(feature);
3180 }
3181 }
3182 return filterFeatures;
3183 }
3184
3185 /**
3186 * @private

Callers 9

addLayerMethod · 0.95
createGraphicLayerMethod · 0.95
createSymbolLayerMethod · 0.95
createVectorLayerMethod · 0.95
createHeatLayerMethod · 0.95
createUniqueLayerMethod · 0.95
createRangeLayerMethod · 0.95
createRankSymbolLayerMethod · 0.95
successCallbackFunction · 0.80

Calls 6

parseFilterConditionMethod · 0.95
parseConditionFunction · 0.90
parseConditionFeatureFunction · 0.90
pushMethod · 0.80
getMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected