在cesium中,只是为了简单显示,用Entity画一个多边形的顶部:
const DrawTop = () => {
const graphic1 = new mars3d.graphic.PolygonEntity({
positions: [
[106.4770141458, 29.4926427256324, 330],
[106.477014147859, 29.4925717567329, 330],
[106.476739448287, 29.4925720912176, 330],
[106.476739445011, 29.4926430592064, 330],
[106.4770141458, 29.4926427256324, 330],
[106.4770141458, 29.4926427256324, 330]
],
style: {
color: "red"
},
attr: { remark: "示例2" }
})
flyLineGraphicLayer.addGraphic(graphic1)
}
用多个Entity画多面体的各个面:
const DrawPolygon = () => {
const graphic1 = new mars3d.graphic.PolygonEntity({
positions: [
[116.3786111111111, 40.00222222222222, 30.655407652258873],
[116.3786111111111, 40.002361111111114, 30.655407652258873],
[116.37874999999998, 40.002361111111114, 30.655407652258873],
[116.37874999999998, 40.00222222222222, 30.655407652258873],
[116.3786111111111, 40.00222222222222, 30.655407652258873]
],
style: {
color: "red"
},
attr: { remark: "示例2" }
})
const graphic2 = new mars3d.graphic.PolygonEntity({
positions: [
[116.3786111111111, 40.00222222222222, 45.983166730962694],
[116.37874999999998, 40.00222222222222, 45.983166730962694],
[116.37874999999998, 40.002361111111114, 45.983166730962694],
[116.3786111111111, 40.002361111111114, 45.983166730962694],
[116.3786111111111, 40.00222222222222, 45.983166730962694]
],
style: {
color: "red"
},
attr: { remark: "示例2" }
})
const graphic3 = new mars3d.graphic.PolygonEntity({
positions: [
[116.3786111111111, 40.00222222222222, 30.655407652258873],
[116.3786111111111, 40.00222222222222, 45.983166730962694],
[116.3786111111111, 40.002361111111114, 45.983166730962694],
[116.3786111111111, 40.002361111111114, 30.655407652258873],
[116.3786111111111, 40.00222222222222, 30.655407652258873]
],
style: {
color: "red"
},
attr: { remark: "示例2" }
})
const graphic4 = new mars3d.graphic.PolygonEntity({
positions: [
[116.37874999999998, 40.00222222222222, 30.655407652258873],
[116.37874999999998, 40.002361111111114, 30.655407652258873],
[116.37874999999998, 40.002361111111114, 45.983166730962694],
[116.37874999999998, 40.00222222222222, 45.983166730962694],
[116.37874999999998, 40.00222222222222, 30.655407652258873]
],
style: {
color: "red"
},
attr: { remark: "示例2" }
})
const graphic5 = new mars3d.graphic.PolygonEntity({
positions: [
[116.3786111111111, 40.00222222222222, 30.655407652258873],
[116.37874999999998, 40.00222222222222, 30.655407652258873],
[116.37874999999998, 40.00222222222222, 45.983166730962694],
[116.3786111111111, 40.00222222222222, 45.983166730962694],
[116.3786111111111, 40.00222222222222, 30.655407652258873]
],
style: {
color: "red"
},
attr: { remark: "示例2" }
})
const graphic6 = new mars3d.graphic.PolygonEntity({
positions: [
[
[116.3786111111111, 40.002361111111114, 30.655407652258873],
[116.3786111111111, 40.002361111111114, 45.983166730962694],
[116.37874999999998, 40.002361111111114, 45.983166730962694],
[116.37874999999998, 40.002361111111114, 30.655407652258873],
[116.3786111111111, 40.002361111111114, 30.655407652258873]
]
],
style: {
color: "green"
},
attr: { remark: "示例2" }
})
flyLineGraphicLayer.addGraphic(graphic1)
flyLineGraphicLayer.addGraphic(graphic2)
flyLineGraphicLayer.addGraphic(graphic3)
flyLineGraphicLayer.addGraphic(graphic4)
flyLineGraphicLayer.addGraphic(graphic5)
flyLineGraphicLayer.addGraphic(graphic6)
}