转载请认注明出处
animatingWater() {
let viewer = this.props.viewer;
//河道多边形
let position = Cesium.Cartesian3.fromDegreesArray(riverArray);
let holes = Cesium.Cartesian3.fromDegreesArray(holesArray);
var x = {
positions: position,
//由于挖的这个洞,是x本身的一种数组集合,所以每一个对象里,又是一个x的形式
holes: [{ positions: holes }]
};
// // new Cesium.PolygonHierarchy(),
var polygon1 = new Cesium.PolygonGeometry({
polygonHierarchy: x,
// hierarchy:x,
// extrudedHeight:0, //与height不能同时存在,否则height不生效
height: 19.0,
// perPositionHeight:false,
// outline: true,
// outlineWidth: 100,
// fill: false,
// arcType: Cesium.ArcType.RHUMB,
// material: Cesium.Color.RED,
vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT
});
River1 = new Cesium.Primitive({
geometryInstances: new Cesium.GeometryInstance({
geometry: polygon1
}),
appearance: new Cesium.EllipsoidSurfaceAppearance({
aboveGround: true
}),
show: true
});
var River1_Material = new Cesium.Material({
fabric: {
type: 'Water',
uniforms: {
// baseWaterColor:new Cesium.Color('#1E90FF'),00BFFF #40E0D0
blendColor: new Cesium.Color("#008B45"),
normalMap: waterNormals,
frequency: 100.0,
animationSpeed: 0.005,
amplitude: 10.0,
}
}
});
River1.appearance.material = River1_Material;
viewer.scene.primitives.add(River1);
}
//水体坐标格式
const riverArray = [
123.3, 34.3, 123.4, 33.3]
const holesArray = [
123.3, 33.5, 123.8, 33.9]