I want to create primitive polyline(or any other primitive).
There two ways:
- Create a primitive with PolylineGeometry.
- Create a PolylineCollection, and add polyline.
Which is better? which to choose? (also consider performance, and memory)
Primitive has a property called: asynchronous : Boolean
Which says: “Determines if the geometry instances will be created and batched on a web worker.”
So if i assign: asynchronous =false; it means it will run on the main thread and drawn synchronously, right? maybe its a reason to use the first way above?
Thanks in advance
Unless you have a reason not to, i would recommend using the Entity API to draw your polylines: Cesium Sandcastle
It provides a more user-friendly API while managing lower level primitives/geometry optimally behind the scenes.
If you wanted to dig into using these lower level primitives directly- PolylineCollection and PolylineGeometry are very similar, but have slightly different feature support. PolylineCollection tends to be the better choice if you have a polyline that is updating frequently, and PolylineGeometry is faster for static polylines.
And yes, setting
asynchronous: false will force the geometry to compute it’s attributes as part of the main thread. If you have a large number of complex geometry, computing them in the main thread will keep the cesium viewer from rendering new frames while they are computing, making it appear frozen.