轉載請認注明出處
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]