//画集雨区
function painting_CatchmentAreaDb() {
var arr = []
shapefile.open(lin_url+static_SysSettings.CatchmentAreaDb)
.then(source => source.read()
.then(function log(result) {
if (result.done) return;
arr.push(result.value)
return source.read().then(log);
})
)
.catch(error => console.error(error.stack));
setTimeout(function () {
CatchmentAreaDb_data=arr
var color_arr = [
"rgba(0,255,255,0.3)",
"rgba(255,128,0,0.3)",
"rgba(255,0,255,0.3)",
"rgba(255,128,128,0.3)",
"rgba(154,196,220,0.3)",
"rgba(154,196,220,0.3)",
"rgba(153,205,208,0.3)",
"rgba(153,205,208,0.3)",
"rgba(152,214,196,0.3)",
"rgba(152,214,196,0.3)",
"rgba(151,232,173,0.3)",
]
var _source = new ol.source.Vector({
features: []
});
for (var i = 0; i < CatchmentAreaDb_data.length; i++) {
var feature = new ol.Feature({
geometry: new ol.geom.Polygon(CatchmentAreaDb_data[i].geometry.coordinates),
name: "CatchmentAreaDb_" + i,
});
// 设置颜色
var color = new ol.style.Style({
stroke: new ol.style.Stroke({
color: color_arr[i],
width: 0.5
}),
fill: new ol.style.Fill({
color: color_arr[i]
})
});
feature.setStyle(color)
_source.addFeature(feature)
}
CatchmentAreaDb.setSource(_source);
}, 1000)
}