例如:运用在人工建模的流程中,需要设置需要设计的人工建模的墙体wall的高度,以及模型的wall的宽度,从而建设模型的初步样式
例如:墙体属于嵌套型矢量数据
演示图:
演示代码:绘制初步的墙体以及页面交互显示墙体设置模块
const drawWallData = () => {
let action = draw.create(DrawType.Polygon, {
useDefaultEntity: true});
action.on(DrawEventType.Complete, async (evt) => {
cc=[];
mh=[];
dd=[]
minh=[];
action.clearEntity();
evt.push(evt[0])
let aa: Cartographic[] = [];
evt.map((v: Cartesian3) => {
aa.push(Cartographic.fromCartesian(v))
})
let result = await sampleTerrainMostDetailed(view?.terrainProvider as TerrainProvider, aa);
for (var i = 0; i < result.length; i++) {
mh.push(1 + result[i].height)
minh.push(result[i].height)
let lng = CesiumMath.toDegrees(result[i].longitude)
let lat = CesiumMath.toDegrees(result[i].latitude)
cc.push(lng, lat, result[i].height +1);
dd.push({
x:lng,y:lat,z:result[i].height + 1})
}
handleAdd(evt);
});
}
const handleAdd = (evt: any) => {
const newData = {
key: `${
tableData.length + 1}`,
buildingName: '3',
textureName: `${
tableData.length + 1