1.代码
1.
entity.polygon.material=new Cesium.GridMaterialProperty({
color : Cesium.Color.fromCssColorString(color),
cellAlpha : 0.3,
lineCount : new Cesium.Cartesian2(8,8),
lineThickness : new Cesium.Cartesian2(2.0, 2.0)
});
2.
$.getJSON("../../../data/china.json", function (result) {
for (var i = 0, len = result.features.length; i < len; i++) {
addBoundary(result.features[i]);
}
});
//墙效果
function addBoundary(feature) {
var coordinates = feature.geometry.coordinates[0];
var height = 800;
var positions = [];
var minimumHeights = [];
var maximumHeights = [];
for (var i = 0, len = coordinates.length; i < len; i++) {
positions.push(
Cesium.Cartesian3.fromDegrees(coordinates[i][0], coordinates[i][1])
);
maximumHeights.push(height * 150);
minimumHeights.push(0);
}
var en = viewer.entities.add({
wall: {
positions: positions,
maximumHeights: maximumHeights,
minimumHeights: minimumHeights,
material: new mars3d.AnimationLineMaterialProperty({
//动画线材质
color: new Cesium.Color.fromCssColorString("#ADADAD"),
duration: 5000, //时长,控制速度
url: "../../../images/fence.png",
repeat: new Cesium.Cartesian2(5, 1)
}),
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(2000)
},
});
}
2、效果
网格.png中国边界.png
网友评论