|

楼主 |
发表于 2022-6-16 08:09:36
|
显示全部楼层
本帖最后由 tzbm123456 于 2022-7-3 08:00 编辑
//一、加载地形图b3dm文件
tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url : './DataSource/SQJS/XDY_DG/b3dm/Dxt/Dxt/tileset.json'
//url : './DataSource/TZBM/jjj/b3dm/jjj/tileset.json'
}));
//设置实体样式
var transparentStyle=new Cesium.Cesium3DTileStyle({
color: "color('white',1.0)",
show: true
});
tileset.style=transparentStyle;
viewer.flyTo(tileset,{
duration : 10,
maximumHeight : 1000000,
});
//二、设置地图材质
imageMaterial = new Cesium.ImageMaterialProperty ({
image:'./DataSource/SQJS/XDY_DG/b3dm/Dxt/Dxt/M_41.png',
color: Cesium.Color.WHITE,
repeat : new Cesium.Cartesian2(1, 1)
});
//三、添加地图材质
const polygon = viewer.entities.add({
polygon: {
hierarchy: new Cesium.PolygonHierarchy(
Cesium.Cartesian3.fromDegreesArray([116.3925,39.8990, 116.3935, 39.8990, 116.3935, 39.8997, 116.3925, 39.8997])
),
//material: Cesium.Color.BLUE.withAlpha(0.5),
material : imageMaterial,
classificationType: Cesium.ClassificationType.CESIUM_3D_TILE,
//classificationType: Cesium.ClassificationType.TERRAIN,
},
});
viewer.flyTo(polygon,{
duration : 10,
maximumHeight : 1000000,
});
/*
特别说明:
1、cesium.js:41 Entity geometry outlines are unsupported on terrain. Outlines will be disabled. To enable outlines, disable geometry terrain clamping by explicitly setting height to 0。
2、classificationType起作用,必须不设置height参数。
*/
|
|