export default class newfiberVectorLayer { //添加geojson面 static addGeojsonPolygon(newfiberMap, geojson, newfiberId) { geojson.features.forEach( feature => (feature.properties = Object.assign(feature.properties, { style_: { type: NewFiberMap.Enum.VectorType.POLYGON, options: { show: true, material: !!feature.properties.fillcolor ? feature.properties.fillcolor : 'rgba(154,104,171,0.4)', outline: true, outlineColorBottom: !!feature.properties.outcolor ? feature.properties.outcolor : 'rgba(189,127,171,0.75)', outlineWidthBottom: 3, }, name: feature.properties.name != ' ' ? feature.properties.name : null, id: newfiberId, labelOptions: { font: '16px PingFang SC', color: 'rgba(175, 50, 50,1)', pixelOffset: [0, 0], backgroundColor: 'rgba(0,0,0,1)', showBackground: false, outlineColor: 'rgba(0, 0, 0, 0.8)', outlineWidth: 6, style: Cesium.LabelStyle.FILL_AND_OUTLINE, distanceDisplayCondition: [Number.MIN_VALUE, 7000000], }, }, })) ); if (newfiberMap.getLayers(newfiberId).length > 0) { return; } else { newfiberMap.geojsonToMap(geojson); } } //添加geojson立体墙 static addGeojsonWall(newfiberMap, geojson, newfiberId) { geojson.features.forEach(feature => { feature.properties = Object.assign(feature.properties, { style_: { type: NewFiberMap.Enum.VectorType.WALL, id: newfiberId, options: { maximumHeights: 1500, minimunHeights: 0, material: new NewFiberMap.Material.WallTrailMaterialProperty({ color: new Cesium.Color.fromCssColorString(feature.properties.fillcolor) || Cesium.Color.RED, speed: 1000, }), }, }, }); }); newfiberMap.geojsonToMap(geojson); } //添加动态河流 static addDynamicWater(newfiberMap, geojson, newfiberId) { NewFiberMap.Layer.Primitive.loadWaterPrimitive({ geojson: geojson, height: 10, id: newfiberId, show: true }, newfiberMap.getMap()); } //动态河流显示与隐藏 static setDynamicWaterVisible(visible) { let dynamicWaterList = newfiberMap.getMap().scene.primitives._primitives.filter(i => i.key == 'dynamicWater'); dynamicWaterList.map(feature => { feature.show = visible; }); } }