mirage2d 1.1.15 → 1.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mirage2d.es.js
CHANGED
|
@@ -80238,14 +80238,20 @@ class baseGraphicLayer extends baseLayer {
|
|
|
80238
80238
|
feature2.setStyle(mStyle);
|
|
80239
80239
|
});
|
|
80240
80240
|
}
|
|
80241
|
-
setSymbolLevelColor(
|
|
80241
|
+
setSymbolLevelColor(levelOption) {
|
|
80242
80242
|
let arr = [];
|
|
80243
80243
|
let max4 = 0;
|
|
80244
80244
|
let average2 = 0;
|
|
80245
|
-
if (
|
|
80246
|
-
|
|
80245
|
+
if (levelOption.autolevel === void 0 || levelOption.autolevel === null) {
|
|
80246
|
+
levelOption.autolevel = true;
|
|
80247
80247
|
}
|
|
80248
80248
|
let mLevelColor = [
|
|
80249
|
+
{
|
|
80250
|
+
maxnum: 0,
|
|
80251
|
+
fillcolor: "rgba(255,255,255,0.1)",
|
|
80252
|
+
strokecolor: "rgba(255, 255, 255,1)",
|
|
80253
|
+
strokewidth: 1
|
|
80254
|
+
},
|
|
80249
80255
|
{
|
|
80250
80256
|
maxnum: 0,
|
|
80251
80257
|
fillcolor: "rgba(255,0,0,0.2)",
|
|
@@ -80277,45 +80283,44 @@ class baseGraphicLayer extends baseLayer {
|
|
|
80277
80283
|
strokewidth: 1
|
|
80278
80284
|
}
|
|
80279
80285
|
];
|
|
80280
|
-
if (
|
|
80281
|
-
mLevelColor =
|
|
80286
|
+
if (levelOption.levelColor) {
|
|
80287
|
+
mLevelColor = levelOption.levelColor;
|
|
80282
80288
|
}
|
|
80283
|
-
if (
|
|
80289
|
+
if (levelOption.autolevel) {
|
|
80284
80290
|
let level = mLevelColor.length;
|
|
80285
80291
|
this._source.getFeatures().forEach((feature2) => {
|
|
80286
|
-
let data2 = feature2.get(
|
|
80292
|
+
let data2 = feature2.get(levelOption.attributeName);
|
|
80287
80293
|
if (data2) {
|
|
80288
80294
|
arr.push(parseInt(data2));
|
|
80289
80295
|
}
|
|
80290
80296
|
});
|
|
80291
80297
|
max4 = Math.max(...arr);
|
|
80292
80298
|
average2 = max4 / level;
|
|
80293
|
-
|
|
80294
|
-
|
|
80295
|
-
if (data2) {
|
|
80296
|
-
for (let i2 = 1; i2 <= level; i2++) {
|
|
80297
|
-
if (parseInt(data2) <= average2 * i2) {
|
|
80298
|
-
let mStyle = MirageDefaultStyle.getStyle(feature2.getGeometry().getType(), { fillcolor: mLevelColor[i2 - 1].fillcolor, strokecolor: mLevelColor[i2 - 1].strokecolor, strokewidth: mLevelColor[i2 - 1].strokewidth });
|
|
80299
|
-
feature2.setStyle(mStyle);
|
|
80300
|
-
break;
|
|
80301
|
-
}
|
|
80302
|
-
}
|
|
80303
|
-
}
|
|
80299
|
+
mLevelColor.forEach((element, index2) => {
|
|
80300
|
+
element.maxnum = average2 * index2;
|
|
80304
80301
|
});
|
|
80305
|
-
}
|
|
80306
|
-
|
|
80307
|
-
|
|
80302
|
+
}
|
|
80303
|
+
this._source.getFeatures().forEach((feature2) => {
|
|
80304
|
+
if (feature2.get("classname") == levelOption.classname) {
|
|
80305
|
+
let data2 = feature2.get(levelOption.attributeName);
|
|
80308
80306
|
if (data2) {
|
|
80309
|
-
|
|
80310
|
-
|
|
80311
|
-
|
|
80312
|
-
|
|
80313
|
-
|
|
80314
|
-
|
|
80315
|
-
|
|
80307
|
+
if (parseFloat(data2) == 0) {
|
|
80308
|
+
let mStyle = MirageDefaultStyle.getStyle(feature2.getGeometry().getType(), { fillcolor: "rgba(255,255,255,0)", strokecolor: "rgba(255,255,255,0.1)", strokewidth: 1 });
|
|
80309
|
+
feature2.setStyle(mStyle);
|
|
80310
|
+
} else {
|
|
80311
|
+
mLevelColor.forEach((element) => {
|
|
80312
|
+
if (parseFloat(data2) > element.maxnum) {
|
|
80313
|
+
let mStyle = MirageDefaultStyle.getStyle(feature2.getGeometry().getType(), { fillcolor: element.fillcolor, strokecolor: element.strokecolor, strokewidth: element.strokewidth });
|
|
80314
|
+
feature2.setStyle(mStyle);
|
|
80315
|
+
return;
|
|
80316
|
+
}
|
|
80317
|
+
});
|
|
80318
|
+
}
|
|
80316
80319
|
}
|
|
80317
|
-
}
|
|
80318
|
-
}
|
|
80320
|
+
}
|
|
80321
|
+
});
|
|
80322
|
+
console.log(mLevelColor);
|
|
80323
|
+
return mLevelColor;
|
|
80319
80324
|
}
|
|
80320
80325
|
setSymbolByClassname(classname, styleOptions, callback) {
|
|
80321
80326
|
this._source.getFeatures().forEach((feature2) => {
|