@@ -133,7 +133,7 @@ export class WebMap extends ol.Observable {
133
133
} ) . then ( function ( response ) {
134
134
return response . json ( ) ;
135
135
} ) . then ( function ( mapInfo ) {
136
- that . baseProjection = mapInfo . projection ; //epsgCode是之前的数据格式 todo
136
+ that . baseProjection = mapInfo . projection ;
137
137
that . mapParams = {
138
138
title : mapInfo . title ,
139
139
description : mapInfo . description
@@ -325,7 +325,6 @@ export class WebMap extends ol.Observable {
325
325
* @returns {ol.source.Tianditu } 天地图的source
326
326
*/
327
327
createTiandituSource ( layerInfo , layerType , projection , isLabel ) {
328
- //todo 后台存储没有存储isLabel是否有标签
329
328
let options = {
330
329
layerType : layerType . split ( '_' ) [ 1 ] . toLowerCase ( ) ,
331
330
isLabel : isLabel || false ,
@@ -1018,6 +1017,7 @@ export class WebMap extends ol.Observable {
1018
1017
* @return {string }
1019
1018
*/
1020
1019
createGraphicLayer ( layerInfo , features ) {
1020
+ features = layerInfo . filterCondition ? this . getFiterFeatures ( layerInfo . filterCondition , features ) : features ;
1021
1021
let graphics = this . getGraphicsFromFeatures ( features , layerInfo . style ) ;
1022
1022
let source = new ol . source . Graphic ( {
1023
1023
graphics : graphics ,
@@ -1112,15 +1112,16 @@ export class WebMap extends ol.Observable {
1112
1112
* @private
1113
1113
* @function ol.supermap.WebMap.prototype.createSymbolLayer
1114
1114
* @description 添加符号图层
1115
- * @param {object } features - feature的集合
1115
+ * @param {object } layerInfo - 图层信息
1116
+ * @param {array } features - feature的集合
1116
1117
* @return {object }
1117
1118
*/
1118
1119
createSymbolLayer ( layerInfo , features ) {
1119
1120
let style = this . getSymbolStyle ( layerInfo . style ) ;
1120
1121
return new ol . layer . Vector ( {
1121
1122
style : style ,
1122
1123
source : new ol . source . Vector ( {
1123
- features : features ,
1124
+ features : layerInfo . filterCondition ? this . getFiterFeatures ( layerInfo . filterCondition , features ) : features ,
1124
1125
wrapX : false
1125
1126
} )
1126
1127
} ) ;
@@ -1136,7 +1137,6 @@ export class WebMap extends ol.Observable {
1136
1137
getSymbolStyle ( parameters ) {
1137
1138
let text = '' ;
1138
1139
if ( parameters . unicode ) {
1139
- //todo 为什么要判断,难道还有其他的图层会进来
1140
1140
text = String . fromCharCode ( parseInt ( parameters . unicode . replace ( / ^ & # x / , '' ) , 16 ) ) ;
1141
1141
}
1142
1142
// 填充色 + 透明度
@@ -1247,7 +1247,7 @@ export class WebMap extends ol.Observable {
1247
1247
return new ol . layer . Vector ( {
1248
1248
style : style ,
1249
1249
source : new ol . source . Vector ( {
1250
- features : features ,
1250
+ features : layerInfo . filterCondition ? this . getFiterFeatures ( layerInfo . filterCondition , features ) : features ,
1251
1251
wrapX : false
1252
1252
} )
1253
1253
} ) ;
@@ -1262,6 +1262,8 @@ export class WebMap extends ol.Observable {
1262
1262
* @returns {ol.layer.Heatmap }
1263
1263
*/
1264
1264
createHeatLayer ( layerInfo , features ) {
1265
+ //因为热力图,随着过滤,需要重新计算权重
1266
+ features = layerInfo . filterCondition ? this . getFiterFeatures ( layerInfo . filterCondition , features ) : features ;
1265
1267
let source = new ol . source . Vector ( {
1266
1268
features : features ,
1267
1269
wrapX : false
@@ -1292,6 +1294,7 @@ export class WebMap extends ol.Observable {
1292
1294
* @param {string } weightFeild - 权重字段
1293
1295
*/
1294
1296
changeWeight ( features , weightFeild ) {
1297
+ let that = this ;
1295
1298
this . fieldMaxValue = { } ;
1296
1299
this . getMaxValue ( features , weightFeild ) ;
1297
1300
let maxValue = this . fieldMaxValue [ weightFeild ] ;
@@ -1301,7 +1304,7 @@ export class WebMap extends ol.Observable {
1301
1304
let value = attributes [ weightFeild ] ;
1302
1305
feature . set ( 'weight' , value / maxValue ) ;
1303
1306
} catch ( e ) {
1304
- // V2 热力图没有权重字段 但恢复回来却有权重字段
1307
+ that . errorCallback && that . errorCallback ( e ) ;
1305
1308
}
1306
1309
} )
1307
1310
}
@@ -1314,8 +1317,7 @@ export class WebMap extends ol.Observable {
1314
1317
* @param {string } weightField - 权重字段
1315
1318
*/
1316
1319
getMaxValue ( features , weightField ) {
1317
- let values = [ ] ,
1318
- attributes ;
1320
+ let values = [ ] , that = this , attributes ;
1319
1321
let field = weightField ;
1320
1322
if ( this . fieldMaxValue [ field ] ) {
1321
1323
return ;
@@ -1326,7 +1328,7 @@ export class WebMap extends ol.Observable {
1326
1328
try {
1327
1329
values . push ( parseFloat ( attributes [ field ] ) ) ;
1328
1330
} catch ( e ) {
1329
- // V2 热力图没有权重字段 但恢复回来却有权重字段
1331
+ that . errorCallback && that . errorCallback ( e ) ;
1330
1332
}
1331
1333
} ) ;
1332
1334
this . fieldMaxValue [ field ] = ArrayStatistic . getArrayStatistic ( values , 'Maximum' ) ;
@@ -1527,7 +1529,7 @@ export class WebMap extends ol.Observable {
1527
1529
attributes ;
1528
1530
let segmentCount = count ;
1529
1531
let segmentMethod = method ;
1530
-
1532
+ let that = this ;
1531
1533
features . forEach ( function ( feature ) {
1532
1534
attributes = feature . get ( "Properties" ) || feature . attributes ;
1533
1535
try {
@@ -1543,7 +1545,7 @@ export class WebMap extends ol.Observable {
1543
1545
}
1544
1546
}
1545
1547
} catch ( e ) {
1546
- // console.log (e);
1548
+ that . errorCallback && that . errorCallback ( e ) ;
1547
1549
}
1548
1550
1549
1551
} ) ;
@@ -1552,7 +1554,7 @@ export class WebMap extends ol.Observable {
1552
1554
try {
1553
1555
segements = ArrayStatistic . getArraySegments ( values , segmentMethod , segmentCount ) ;
1554
1556
} catch ( e ) {
1555
- // console.log (e);
1557
+ that . errorCallback && that . errorCallback ( e ) ;
1556
1558
}
1557
1559
if ( segements ) {
1558
1560
let itemNum = segmentCount ;
0 commit comments