Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is difference between Entity and Primitive in Cesiumjs?

What is difference between Entity and Primitive in Cesium.js? In my application I am using primitives and this (choose Drill Down Picking) uses Entities. I want to implement same highlighting functionality but with Primitives. How can I achieve this?

like image 531
meen Avatar asked Jan 11 '16 17:01

meen


1 Answers

The difference between Entity API and Primitive API is discussed in the first couple paragraphs of this tutorial. Primitives are lower-level graphical elements within Cesium, and Entities are built on top of Primitives. A single Entity may represent a point-of-interest or a moving vehicle, and that single Entity may contain several different kinds of Primitives: A label primitive, a billboard primitive, a path / polyline primitive, etc.

Generally, the Cesium team recommends using Entities where possible, since they more directly correspond to real-world objects. But the Primitive API is public and accessible for more low-level control of the graphics display.

In the demo you referenced, look near the end of the drill-picking function, which is a long one. You'll find this line of code which actually drill-picks the primitive and then looks up the owner entity. Picking the graphics primitive is the default behavior here, you can just skip the entity lookup if you're not using entities.

like image 197
emackey Avatar answered Oct 21 '22 16:10

emackey