|
@@ -285,25 +285,23 @@ export class olMap {
|
|
|
/**
|
|
|
*
|
|
|
* @param {Geojon} chaozhou 根据geojson对象创建Featrue对象
|
|
|
- * @param {String} layerName 图层名称
|
|
|
* @returns VectorLayer
|
|
|
*/
|
|
|
- createVecByJson(json, layerName = '') {
|
|
|
+ createVecByJson(json, options) {
|
|
|
const format = new GeoJSON();
|
|
|
const fs = format.readFeatures(json);
|
|
|
- this.removeMask2();
|
|
|
- this.maskLayer = new VectorLayer({
|
|
|
+ const converLayer = new VectorLayer({
|
|
|
source: new VectorSource(),
|
|
|
style: new Style({
|
|
|
fill: new Fill({
|
|
|
- color: 'rgba(16, 36, 59, 0.65)'
|
|
|
+ color: options.fillColor ? options.fillColor : 'rgba(16, 36, 59, 0.65)'
|
|
|
}),
|
|
|
stroke: new Stroke({
|
|
|
- color: 'rgba(38, 138, 185, 1)',
|
|
|
+ color: options.strokeColor ? options.strokeColor : 'rgba(38, 138, 185, 1)',
|
|
|
width: 2
|
|
|
})
|
|
|
}),
|
|
|
- zIndex: 99
|
|
|
+ zIndex: options.zIndex ? options.zIndex : 99
|
|
|
});
|
|
|
this.map.addLayer(this.maskLayer);
|
|
|
const extent = [-180, -90, 180, 90];
|