How to simulate Building floor data in Cesium Development
This article mainly introduces how to simulate building floor data in Cesium development, which is very detailed and has a certain reference value. Interested friends must read it!
Multi-storey building, when the accurate model effect is not needed, use Cesium's Polygon to simulate the floor effect of each floor, set the height of each floor and the total number of floors, generate CZML files, and load the floor data in batches. According to Cesium's api, load a polygon with a high pull-up effect, using the following code:
Var greenPolygon = viewer.entities.add ({
Name: 'Green extruded polygon'
Polygon: {
Hierarchy: Cesium.Cartesian3.fromDegreesArray ([- 108.0, 42.0)
-100.0, 42.0
-104.0])
Height:50000
ExtrudedHeight: 100000.0
Material: Cesium.Color.GREEN
}
});
Height and extrudedHeight are the key parameters, height marks the height of polygon from the ground, extrudedHeight is the pull-up height of polygon, according to the floor height, set the height of each floor, add the floor height, set extrudedHeight to achieve the layered floor effect. The edits of the CZML data node are as follows:
{
"id": "floor_0"
"name": "floors"
, "polygon":
{"positions":
{"cartographicDegrees": [coordinate array]}
"material":
{
"solidColor":
{"color":
{"rgba": [255255255120]}
}
}
/ / ground height setting
"height": 0
/ / pull up height setting
"extrudedHeight": 4.6, "
Outline ": true}
}
Using js or other code, loop through the number of floors and height to generate the final CZML data.
The following is the simple floor display, plus the selection effect when you move the mouse:
These are all the contents of the article "how to simulate Building floor data in Cesium Development". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!