|
@@ -338,39 +338,39 @@ export class olMap {
|
|
|
this.map.addLayer(layer);
|
|
|
});
|
|
|
} else {
|
|
|
- const layer = new VectorLayer({
|
|
|
- source: new VectorSource(),
|
|
|
- style: new Style({
|
|
|
- fill: new Fill({
|
|
|
- color: options.fillColor ? options.fillColor : 'rgba(16, 36, 59, 0.65)'
|
|
|
- }),
|
|
|
- stroke: new Stroke({
|
|
|
- color: options.strokeColor ? options.strokeColor : 'rgba(38, 138, 185, 1)',
|
|
|
- width: 2
|
|
|
- })
|
|
|
- }),
|
|
|
- zIndex: options.zIndex ? options.zIndex : 99
|
|
|
- });
|
|
|
- // 合并区边界
|
|
|
- const format = new GeoJSON();
|
|
|
- const data2 = mergeGeoJsonPolygons(json);
|
|
|
- const fs = format.readFeatures(data2);
|
|
|
- const extent = [-180, -90, 180, 90];
|
|
|
- const polygonRing = fromExtent(extent);
|
|
|
- fs.forEach((x) => {
|
|
|
- const ft = x.values_.geometry;
|
|
|
- const coords = ft.getCoordinates();
|
|
|
- coords.forEach((coord) => {
|
|
|
- const linearRing = new LinearRing(coord[0]);
|
|
|
- polygonRing.appendLinearRing(linearRing);
|
|
|
- });
|
|
|
- });
|
|
|
- const convertFt = new Feature({
|
|
|
- geometry: polygonRing
|
|
|
- });
|
|
|
- layer.getSource().addFeature(convertFt);
|
|
|
- this.maskLayer2.push(layer);
|
|
|
- this.map.addLayer(layer);
|
|
|
+ // const layer = new VectorLayer({
|
|
|
+ // source: new VectorSource(),
|
|
|
+ // style: new Style({
|
|
|
+ // fill: new Fill({
|
|
|
+ // color: options.fillColor ? options.fillColor : 'rgba(16, 36, 59, 0.65)'
|
|
|
+ // }),
|
|
|
+ // stroke: new Stroke({
|
|
|
+ // color: options.strokeColor ? options.strokeColor : 'rgba(38, 138, 185, 1)',
|
|
|
+ // width: 2
|
|
|
+ // })
|
|
|
+ // }),
|
|
|
+ // zIndex: options.zIndex ? options.zIndex : 99
|
|
|
+ // });
|
|
|
+ // // 合并区边界
|
|
|
+ // const format = new GeoJSON();
|
|
|
+ // const data2 = mergeGeoJsonPolygons(json);
|
|
|
+ // const fs = format.readFeatures(data2);
|
|
|
+ // const extent = [-180, -90, 180, 90];
|
|
|
+ // const polygonRing = fromExtent(extent);
|
|
|
+ // fs.forEach((x) => {
|
|
|
+ // const ft = x.values_.geometry;
|
|
|
+ // const coords = ft.getCoordinates();
|
|
|
+ // coords.forEach((coord) => {
|
|
|
+ // const linearRing = new LinearRing(coord[0]);
|
|
|
+ // polygonRing.appendLinearRing(linearRing);
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ // const convertFt = new Feature({
|
|
|
+ // geometry: polygonRing
|
|
|
+ // });
|
|
|
+ // layer.getSource().addFeature(convertFt);
|
|
|
+ // this.maskLayer2.push(layer);
|
|
|
+ // this.map.addLayer(layer);
|
|
|
// 边界部分
|
|
|
json.features.forEach((feature) => {
|
|
|
if (feature.geometry.type === 'Polygon') {
|