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

Method redrawThematicFeatures

src/openlayers/overlay/Graph.js:117–152  ·  view source on GitHub ↗

* @function Graph.prototype.redrawThematicFeatures * @description 重绘所有专题要素。 * 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。 * 地图漫游时调用此方法进行图层刷新。 * @param {Object} extent - 重绘的范围。 *

(extent)

Source from the content-addressed store, hash-verified

115 *
116 */
117 redrawThematicFeatures(extent) {
118 //清除当前所有可视元素
119 this.renderer.clearAll();
120 var features = this.features;
121 for (var i = 0, len = features.length; i < len; i++) {
122 var feature = features[i];
123 // 要素范围判断
124 var feaBounds = feature.geometry.getBounds();
125 //剔除当前视图(地理)范围以外的数据
126 if (extent) {
127 var bounds = new Bounds(extent[0], extent[1], extent[2], extent[3]);
128 if (!bounds.intersectsBounds(feaBounds)) {
129 continue;
130 }
131 }
132 var cache = this.cache;
133 // 用 feature id 做缓存标识
134 var cacheField = feature.id;
135 // 数据对应的图表是否已缓存,没缓存则重新创建图表
136 if (cache[cacheField]) {
137 continue;
138 }
139 cache[cacheField] = cacheField;
140 var chart = this.createThematicFeature(feature);
141 // 压盖处理权重值
142 if (chart && this.overlayWeightField) {
143 if (feature.attributes[this.overlayWeightField] && !isNaN(feature.attributes[this.overlayWeightField])) {
144 chart["__overlayWeight"] = feature.attributes[this.overlayWeightField];
145 }
146 }
147 if (chart) {
148 this.charts.push(chart);
149 }
150 }
151 this.drawCharts();
152 }
153
154 /**
155 * @function Graph.prototype.createThematicFeature

Callers 1

redrawMethod · 0.95

Calls 6

intersectsBoundsMethod · 0.95
createThematicFeatureMethod · 0.95
drawChartsMethod · 0.95
pushMethod · 0.80
clearAllMethod · 0.45
getBoundsMethod · 0.45

Tested by

no test coverage detected