Multiple polygons in one entity

494 views
Skip to first unread message

jwcro...@gmail.com

unread,
Nov 8, 2017, 11:39:57 AM11/8/17
to cesium-dev
I need to create a single cesium entity on the globe that is comprised of multiple polygons and polylines. I Know I can have 1 of each type of geometry on an entity and it will work just fine, but I need to be able to have multiple of ONE type of geometry as part of a single entity.


return {
name: track.data.Name,
polygon: {
hierarchy: newPoints,
material: Cesium.Color.RED.withAlpha( 0.2 )
},
polyline: {
positions: Cesium.Cartesian3.fromDegreesArray( segment ),
width: 1,
material: new Cesium.PolylineDashMaterialProperty( {
color: Cesium.Color.BLUE
} )
}
}

The above code handles 1 polygon and polyline as a single object.
-------------------------------------------------------------------
return {
name: track.data.Name,
polygon: {arrayOfPolygons},
polyline: {
positions: Cesium.Cartesian3.fromDegreesArray( segment ),
width: 1,
material: new Cesium.PolylineDashMaterialProperty( {
color: Cesium.Color.BLUE
} )
}
}
I would like to do this, but it cannot read an array in this way. I cannot statically declare each polygon because there is no knowledge of how many will be included beforehand. Is there any way to accomplish this?

I am trying to draw 2-d corridors made up of multiple polygons and polylines. The polylines are not always in the center of the polygon. I can create each individual segement(one polygon with one polyline) but I need to be able to make a group of them behave as a single entity.


The Cesium version, operating system and browser.
1.36.0 Windows 7 and Electron/ChromeV8


Thanks in advance!
Jonathan

Gabby Getz

unread,
Nov 9, 2017, 6:00:58 PM11/9/17
to cesium-dev
Hi Jonathan,

You can create two or more entities, then create one Enity to act as the parent. Either that, or you could try merging two entities after creating them.

Thanks, hope that helps,
Gabby
Reply all
Reply to author
Forward
0 new messages